Changesets · Branches · Tags · Compare
| Changeset | c3cb880f79e5fbf3e7328b5a888df767a9402bb9ee1a4c202b0eb3f9f41cc633 |
|---|---|
| Author | Nate Sesti <33237525+sestinj@users.noreply.github.com> · 2025-09-10 14:36 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-09-10 14:36 -07:00 |
| Parents | 8a6602dc5d0c, 5875481a5280 |
4 files changed
modified extensions/cli/src/commands/commands.ts +5 −1
| @@ -65,7 +65,11 @@ | ||
| 65 | 65 | description: "Manage MCP server connections", |
| 66 | 66 | category: "system", |
| 67 | 67 | }, |
| 68 | - | |
| 68 | + { | |
| 69 | + name: "init", | |
| 70 | + description: "Create an AGENTS.md file", | |
| 71 | + category: "system", | |
| 72 | + }, | |
| 69 | 73 | { |
| 70 | 74 | name: "compact", |
| 71 | 75 | 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 @@ | ||
| 7 | 7 | loadAuthConfig, |
| 8 | 8 | } from "./auth/workos.js"; |
| 9 | 9 | import { getAllSlashCommands } from "./commands/commands.js"; |
| 10 | +import { handleInit } from "./commands/init.js"; | |
| 10 | 11 | import { handleInfoSlashCommand } from "./infoScreen.js"; |
| 11 | 12 | import { reloadService, SERVICE_NAMES, services } from "./services/index.js"; |
| 12 | 13 | import { getCurrentSession } from "./session.js"; |
| @@ -176,6 +177,10 @@ | ||
| 176 | 177 | return { openSessionSelector: true }; |
| 177 | 178 | }, |
| 178 | 179 | fork: handleFork, |
| 180 | + init: (args, assistant) => { | |
| 181 | + posthogService.capture("useSlashCommand", { name: "init" }); | |
| 182 | + return handleInit(args, assistant); | |
| 183 | + }, | |
| 179 | 184 | }; |
| 180 | 185 | |
| 181 | 186 | export async function handleSlashCommands( |
modified extensions/cli/src/ui/TipsDisplay.tsx +1 −0
| @@ -9,6 +9,7 @@ | ||
| 9 | 9 | 'Multi-line input is supported by typing "\\" and pressing enter', |
| 10 | 10 | "Use `cn ls` or `/resume` to resume a previous conversation", |
| 11 | 11 | 'Run `cn` with the `-p` flag for headless mode. For example: `cn -p "Generate a commit message for the current changes. Output _only_ the commit message and nothing else."`', |
| 12 | + "Use the /init slash command to generate an AGENTS.md file. This will help `cn` understand your codebase and generate better responses.", | |
| 12 | 13 | ]; |
| 13 | 14 | |
| 14 | 15 | interface TipsDisplayProps { |