Elffuss BraidHub

kikocis/continue public

feat: /init slash command for cli
Changeset0f66b271fe859ecdcc5e1fe0f46421358d73f0843b032862af216665eafab7dd
AuthorNate <sestinj@gmail.com> · 2025-09-09 14:42 -07:00
CommitterNate <sestinj@gmail.com> · 2025-09-09 14:42 -07:00
Parentsdd35e28818ae

Browse the files at this changeset

3 files changed

modified extensions/cli/src/commands/commands.ts +5 −1
@@ -65,7 +65,11 @@
6565 description: "Manage MCP server connections",
6666 category: "system",
6767 },
68-
68+ {
69+ name: "init",
70+ description: "Create an AGENTS.md file",
71+ category: "system",
72+ },
6973 {
7074 name: "compact",
7175 description: "Summarize chat history into a compact form",
added extensions/cli/src/commands/init.ts +45 −0
@@ -0,0 +1,45 @@
1+import { type AssistantConfig } from "@continuedev/sdk";
2+
3+import { SlashCommandResult } from "../ui/hooks/useChat.types.js";
4+
5+function createInitPrompt(): string {
6+ 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.
7+
8+Create an AGENTS.md file with the following structure:
9+
10+# Repository Overview
11+
12+## Project Description
13+- What this project does
14+- Main purpose and goals
15+- Key technologies used
16+
17+## Architecture Overview
18+- High-level architecture
19+- Main components and their relationships
20+- Data flow and system interactions
21+
22+## Directory Structure
23+- Important directories and their purposes
24+- Key files and configuration
25+- Entry points and main modules
26+
27+## Development Workflow
28+- How to build/run the project
29+- Testing approach
30+- Development environment setup
31+- Lint and format commands
32+
33+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.`;
34+}
35+
36+export async function handleInit(
37+ _args: string[],
38+ _assistant: AssistantConfig,
39+): Promise<SlashCommandResult> {
40+ const prompt = createInitPrompt();
41+
42+ return {
43+ newInput: prompt,
44+ };
45+}
modified extensions/cli/src/slashCommands.ts +5 −0
@@ -7,6 +7,7 @@
77 loadAuthConfig,
88 } from "./auth/workos.js";
99 import { getAllSlashCommands } from "./commands/commands.js";
10+import { handleInit } from "./commands/init.js";
1011 import { handleInfoSlashCommand } from "./infoScreen.js";
1112 import { reloadService, SERVICE_NAMES, services } from "./services/index.js";
1213 import { getCurrentSession } from "./session.js";
@@ -176,6 +177,10 @@
176177 return { openSessionSelector: true };
177178 },
178179 fork: handleFork,
180+ init: (args, assistant) => {
181+ posthogService.capture("useSlashCommand", { name: "init" });
182+ return handleInit(args, assistant);
183+ },
179184 };
180185
181186 export async function handleSlashCommands(