feat(plan): implement plan slash command (#17698)

This commit is contained in:
Adib234
2026-02-04 12:01:43 -05:00
committed by GitHub
parent fedc0c5d60
commit 0012d95848
7 changed files with 250 additions and 2 deletions
@@ -38,6 +38,7 @@ describe('ExitPlanModeTool', () => {
mockConfig = {
getTargetDir: vi.fn().mockReturnValue(tempRootDir),
setApprovalMode: vi.fn(),
setApprovedPlanPath: vi.fn(),
storage: {
getProjectTempPlansDir: vi.fn().mockReturnValue(mockPlansDir),
} as unknown as Config['storage'],
@@ -200,6 +201,7 @@ The approved implementation plan is stored at: ${expectedPath}
Read and follow the plan strictly during implementation.`,
returnDisplay: `Plan approved: ${expectedPath}`,
});
expect(mockConfig.setApprovedPlanPath).toHaveBeenCalledWith(expectedPath);
});
it('should return approval message when plan is approved with AUTO_EDIT mode', async () => {
@@ -230,6 +232,7 @@ Read and follow the plan strictly during implementation.`,
expect(mockConfig.setApprovalMode).toHaveBeenCalledWith(
ApprovalMode.AUTO_EDIT,
);
expect(mockConfig.setApprovedPlanPath).toHaveBeenCalledWith(expectedPath);
});
it('should return feedback message when plan is rejected with feedback', async () => {
@@ -224,6 +224,7 @@ export class ExitPlanModeInvocation extends BaseToolInvocation<
if (payload?.approved) {
const newMode = payload.approvalMode ?? ApprovalMode.DEFAULT;
this.config.setApprovalMode(newMode);
this.config.setApprovedPlanPath(resolvedPlanPath);
const description = getApprovalModeDescription(newMode);