Skip to content

Commit 4cb1b3a

Browse files
fix(core): ensure edit and write-file tools use storage.getPlansDir
This fixes test failures introduced during conflict resolution by strictly calling storage.getPlansDir as per the new config architecture.
1 parent 0b21597 commit 4cb1b3a

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

packages/core/src/tools/edit.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,9 @@ class EditToolInvocation
469469
try {
470470
this.resolvedPath = resolveAndValidatePlanPath(
471471
this.params.file_path,
472-
this.config.getPlansDir(),
472+
this.config.storage.getPlansDir(),
473473
);
474-
} catch (e) {
474+
} catch {
475475
// Validation fails, set resolvedPath to something that will fail validation downstream or just the raw path.
476476
// It's safer to store it so validation in execute() or getConfirmationDetails() catches it.
477477
this.resolvedPath = this.params.file_path;
@@ -1064,7 +1064,7 @@ export class EditTool
10641064
try {
10651065
resolvedPath = resolveAndValidatePlanPath(
10661066
params.file_path,
1067-
this.config.getPlansDir(),
1067+
this.config.storage.getPlansDir(),
10681068
);
10691069
} catch (err) {
10701070
return err instanceof Error ? err.message : String(err);

packages/core/src/tools/exit-plan-mode.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ export class ExitPlanModeTool extends BaseDeclarativeTool<
6666
try {
6767
resolveAndValidatePlanPath(
6868
params.plan_filename,
69-
this.config.getPlansDir(),
69+
this.config.storage.getPlansDir(),
7070
);
7171
} catch (e) {
7272
if (e instanceof Error && e.message.startsWith('Security violation')) {
7373
return `Access denied: plan path (${path.join(
74-
this.config.getPlansDir(),
74+
this.config.storage.getPlansDir(),
7575
params.plan_filename,
76-
)}) must be within the designated plans directory (${this.config.getPlansDir()}).`;
76+
)}) must be within the designated plans directory (${this.config.storage.getPlansDir()}).`;
7777
}
7878
return e instanceof Error ? e.message : String(e);
7979
}
@@ -126,7 +126,7 @@ export class ExitPlanModeInvocation extends BaseToolInvocation<
126126

127127
const pathError = await validatePlanPath(
128128
this.params.plan_filename,
129-
this.config.getPlansDir(),
129+
this.config.storage.getPlansDir(),
130130
);
131131
if (pathError) {
132132
this.planValidationError = pathError;
@@ -176,7 +176,7 @@ export class ExitPlanModeInvocation extends BaseToolInvocation<
176176
}
177177

178178
getDescription(): string {
179-
return `Requesting plan approval for: ${path.join(this.config.getPlansDir(), this.params.plan_filename)}`;
179+
return `Requesting plan approval for: ${path.join(this.config.storage.getPlansDir(), this.params.plan_filename)}`;
180180
}
181181

182182
/**
@@ -186,7 +186,7 @@ export class ExitPlanModeInvocation extends BaseToolInvocation<
186186
private getResolvedPlanPath(): string {
187187
return resolveAndValidatePlanPath(
188188
this.params.plan_filename,
189-
this.config.getPlansDir(),
189+
this.config.storage.getPlansDir(),
190190
);
191191
}
192192

packages/core/src/tools/write-file.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ class WriteFileToolInvocation extends BaseToolInvocation<
172172
try {
173173
this.resolvedPath = resolveAndValidatePlanPath(
174174
this.params.file_path,
175-
this.config.getPlansDir(),
175+
this.config.storage.getPlansDir(),
176176
);
177-
} catch (e) {
177+
} catch {
178178
// Validation fails, set resolvedPath to something that will fail validation downstream or just the raw path.
179179
this.resolvedPath = this.params.file_path;
180180
}
@@ -509,7 +509,7 @@ export class WriteFileTool
509509
try {
510510
resolvedPath = resolveAndValidatePlanPath(
511511
filePath,
512-
this.config.getPlansDir(),
512+
this.config.storage.getPlansDir(),
513513
);
514514
} catch (err) {
515515
return err instanceof Error ? err.message : String(err);

0 commit comments

Comments
 (0)