From faabbf2653647918ec37fc48f4e310e0016dc0e0 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 21 Sep 2025 22:42:50 -0700 Subject: [PATCH 1/2] feat(cli): enhance /init command to create custom slash command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the /init slash command prompt to also create a custom "review" slash command file at .continue/rules/review.md with invokable frontmatter and review-focused instructions. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- extensions/cli/src/commands/init.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/extensions/cli/src/commands/init.ts b/extensions/cli/src/commands/init.ts index f4c31e61444..d0ca11ebc93 100644 --- a/extensions/cli/src/commands/init.ts +++ b/extensions/cli/src/commands/init.ts @@ -3,7 +3,7 @@ import { type AssistantConfig } from "@continuedev/sdk"; import { SlashCommandResult } from "../ui/hooks/useChat.types.js"; function createInitPrompt(): string { - return `Please analyze this repository and create a comprehensive AGENTS.md file. Use your available tools to understand the project structure, read important files like README.md, package.json, requirements.txt, and other configuration files to understand the technology stack and setup. + return `Please analyze this repository and create a comprehensive AGENTS.md file, along with a custom slash command. Use your available tools to understand the project structure, read important files like README.md, package.json, requirements.txt, and other configuration files to understand the technology stack and setup. Create an AGENTS.md file with the following structure: @@ -30,7 +30,23 @@ Create an AGENTS.md file with the following structure: - Development environment setup - Lint and format commands -Please create the AGENTS.md file using the Write tool after analyzing the repository. Focus on providing actionable information that would help both AI agents and human developers understand and work effectively with this codebase. Keep the file concise but informational.`; +Additionally, create a slash command file at .continue/rules/review.md with the following structure: + +\`\`\`md +--- +invokable: true +--- + +Review this code for potential issues, including: + + + +Provide specific, actionable feedback for improvements. +\`\`\` + +This slash command will be invokable using /review and will provide instructions for code review tasks common to this repository. + +Please create both the AGENTS.md file and the .continue/rules/review.md file using the Write tool after analyzing the repository. Focus on providing actionable information that would help both AI agents and human developers understand and work effectively with this codebase. Keep the files concise but informational.`; } export async function handleInit( From ef3230e737f5d9e1d1fe2556a7e38e434cf5dda9 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 22 Sep 2025 20:19:11 -0700 Subject: [PATCH 2/2] fix: address feedback --- core/config/markdown/utils.ts | 14 ++++++++++---- extensions/cli/src/commands/init.ts | 4 +++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/core/config/markdown/utils.ts b/core/config/markdown/utils.ts index 5fbade09bdd..df64a75be7b 100644 --- a/core/config/markdown/utils.ts +++ b/core/config/markdown/utils.ts @@ -4,6 +4,15 @@ import { } from "@continuedev/config-yaml"; import { joinPathsToUri } from "../../util/uri"; +function createRelativeRuleFilePathParts(ruleName: string): string[] { + const safeRuleName = sanitizeRuleName(ruleName); + return [".continue", "rules", `${safeRuleName}.${RULE_FILE_EXTENSION}`]; +} + +export function createRelativeRuleFilePath(ruleName: string): string { + return createRelativeRuleFilePathParts(ruleName).join("/"); +} + /** * Creates the file path for a rule in the workspace .continue/rules directory */ @@ -11,11 +20,8 @@ export function createRuleFilePath( workspaceDir: string, ruleName: string, ): string { - const safeRuleName = sanitizeRuleName(ruleName); return joinPathsToUri( workspaceDir, - ".continue", - "rules", - `${safeRuleName}.${RULE_FILE_EXTENSION}`, + ...createRelativeRuleFilePathParts(ruleName), ); } diff --git a/extensions/cli/src/commands/init.ts b/extensions/cli/src/commands/init.ts index d0ca11ebc93..ad50333ef54 100644 --- a/extensions/cli/src/commands/init.ts +++ b/extensions/cli/src/commands/init.ts @@ -1,8 +1,10 @@ import { type AssistantConfig } from "@continuedev/sdk"; +import { createRelativeRuleFilePath } from "core/config/markdown/utils.js"; import { SlashCommandResult } from "../ui/hooks/useChat.types.js"; function createInitPrompt(): string { + const relativeRuleFilepath = createRelativeRuleFilePath("review"); return `Please analyze this repository and create a comprehensive AGENTS.md file, along with a custom slash command. Use your available tools to understand the project structure, read important files like README.md, package.json, requirements.txt, and other configuration files to understand the technology stack and setup. Create an AGENTS.md file with the following structure: @@ -30,7 +32,7 @@ Create an AGENTS.md file with the following structure: - Development environment setup - Lint and format commands -Additionally, create a slash command file at .continue/rules/review.md with the following structure: +Additionally, create a slash command file at ${relativeRuleFilepath} with the following structure: \`\`\`md ---