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
+11
View File
@@ -627,9 +627,12 @@ export class Config {
private latestApiRequest: GenerateContentParameters | undefined;
private lastModeSwitchTime: number = Date.now();
private approvedPlanPath: string | undefined;
constructor(params: ConfigParameters) {
this.sessionId = params.sessionId;
this.clientVersion = params.clientVersion ?? 'unknown';
this.approvedPlanPath = undefined;
this.embeddingModel =
params.embeddingModel ?? DEFAULT_GEMINI_EMBEDDING_MODEL;
this.fileSystemService = new StandardFileSystemService();
@@ -1706,6 +1709,14 @@ export class Config {
return this.planEnabled;
}
getApprovedPlanPath(): string | undefined {
return this.approvedPlanPath;
}
setApprovedPlanPath(path: string | undefined): void {
this.approvedPlanPath = path;
}
isAgentsEnabled(): boolean {
return this.enableAgents;
}
@@ -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);