@travisennis/acai 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +29 -27
- package/dist/cli/stdin.d.ts +2 -1
- package/dist/cli/stdin.d.ts.map +1 -1
- package/dist/commands/generate-rules/service.d.ts +3 -2
- package/dist/commands/generate-rules/service.d.ts.map +1 -1
- package/dist/commands/health/utils.d.ts +3 -2
- package/dist/commands/health/utils.d.ts.map +1 -1
- package/dist/commands/init-project/utils.d.ts +2 -1
- package/dist/commands/init-project/utils.d.ts.map +1 -1
- package/dist/commands/init-project/utils.js +0 -11
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +6 -1
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +4 -1
- package/dist/commands/review/utils.d.ts +6 -1
- package/dist/commands/review/utils.d.ts.map +1 -1
- package/dist/commands/session/index.d.ts.map +1 -1
- package/dist/commands/session/index.js +6 -0
- package/dist/commands/session/types.d.ts +1 -0
- package/dist/commands/session/types.d.ts.map +1 -1
- package/dist/commands/tools/index.d.ts +3 -0
- package/dist/commands/tools/index.d.ts.map +1 -0
- package/dist/commands/tools/index.js +190 -0
- package/dist/commands/tools/templates.d.ts +6 -0
- package/dist/commands/tools/templates.d.ts.map +1 -0
- package/dist/commands/tools/templates.js +97 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +41 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -3
- package/dist/models/anthropic-provider.d.ts +1 -1
- package/dist/models/deepseek-provider.d.ts +3 -3
- package/dist/models/deepseek-provider.js +17 -17
- package/dist/models/google-provider.d.ts +2 -4
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/google-provider.js +2 -17
- package/dist/models/groq-provider.d.ts +2 -4
- package/dist/models/groq-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.js +3 -21
- package/dist/models/opencode-go-provider.d.ts +35 -0
- package/dist/models/opencode-go-provider.d.ts.map +1 -0
- package/dist/models/opencode-go-provider.js +214 -0
- package/dist/models/opencode-zen-provider.d.ts +5 -5
- package/dist/models/opencode-zen-provider.d.ts.map +1 -1
- package/dist/models/opencode-zen-provider.js +41 -47
- package/dist/models/openrouter-provider.d.ts +5 -13
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +34 -138
- package/dist/models/providers.d.ts +3 -3
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +6 -0
- package/dist/models/xai-provider.d.ts +1 -2
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/models/xai-provider.js +0 -13
- package/dist/prompts/manager.d.ts.map +1 -1
- package/dist/prompts/manager.js +5 -1
- package/dist/prompts/mentions.d.ts.map +1 -1
- package/dist/prompts/mentions.js +35 -6
- package/dist/prompts/system-prompt.d.ts +1 -0
- package/dist/prompts/system-prompt.d.ts.map +1 -1
- package/dist/prompts/system-prompt.js +20 -5
- package/dist/repl/index.d.ts +1 -2
- package/dist/repl/index.d.ts.map +1 -1
- package/dist/repl/index.js +14 -53
- package/dist/sessions/manager.d.ts +3 -3
- package/dist/sessions/manager.d.ts.map +1 -1
- package/dist/sessions/manager.js +1 -1
- package/dist/skills/activated-tracker.d.ts +11 -0
- package/dist/skills/activated-tracker.d.ts.map +1 -0
- package/dist/skills/activated-tracker.js +16 -0
- package/dist/skills/index.d.ts +3 -2
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +7 -1
- package/dist/subagents/index.d.ts +2 -1
- package/dist/subagents/index.d.ts.map +1 -1
- package/dist/terminal/table/utils.d.ts +1 -1
- package/dist/terminal/table/utils.d.ts.map +1 -1
- package/dist/terminal/wrap-ansi.js +2 -2
- package/dist/tools/agent.js +1 -1
- package/dist/tools/apply-patch.d.ts +62 -0
- package/dist/tools/apply-patch.d.ts.map +1 -0
- package/dist/tools/apply-patch.js +377 -0
- package/dist/tools/bash.d.ts +4 -4
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +40 -8
- package/dist/tools/directory-tree.d.ts +4 -4
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +3 -1
- package/dist/tools/dynamic-tool-loader.d.ts +12 -3
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +299 -39
- package/dist/tools/edit-file.d.ts +2 -2
- package/dist/tools/edit-file.d.ts.map +1 -1
- package/dist/tools/edit-file.js +188 -79
- package/dist/tools/glob.d.ts +16 -16
- package/dist/tools/glob.d.ts.map +1 -1
- package/dist/tools/glob.js +30 -15
- package/dist/tools/grep.d.ts +14 -14
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +50 -29
- package/dist/tools/index.d.ts +57 -84
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +20 -5
- package/dist/tools/ls.d.ts +2 -2
- package/dist/tools/ls.d.ts.map +1 -1
- package/dist/tools/ls.js +2 -1
- package/dist/tools/read-file.d.ts +9 -11
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +21 -16
- package/dist/tools/save-file.d.ts +4 -4
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +26 -21
- package/dist/tools/skill.d.ts +2 -1
- package/dist/tools/skill.d.ts.map +1 -1
- package/dist/tools/skill.js +55 -12
- package/dist/tools/types.d.ts +8 -2
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/web-fetch.d.ts +6 -18
- package/dist/tools/web-fetch.d.ts.map +1 -1
- package/dist/tools/web-fetch.js +45 -9
- package/dist/tools/web-search.d.ts +4 -22
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +1 -1
- package/dist/tui/autocomplete/file-search-provider.js +1 -1
- package/dist/tui/autocomplete/utils.d.ts +2 -1
- package/dist/tui/autocomplete/utils.d.ts.map +1 -1
- package/dist/tui/autocomplete/utils.js +25 -23
- package/dist/tui/components/editor.d.ts +2 -1
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +1 -1
- package/dist/tui/components/footer.d.ts +0 -2
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +1 -17
- package/dist/tui/components/markdown.d.ts +2 -2
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/welcome.d.ts +2 -1
- package/dist/tui/components/welcome.d.ts.map +1 -1
- package/dist/tui/editor-launcher.d.ts +3 -2
- package/dist/tui/editor-launcher.d.ts.map +1 -1
- package/dist/tui/index.d.ts +0 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/tui.d.ts +1 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +9 -0
- package/dist/tui/utils.d.ts +1 -5
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +271 -44
- package/dist/utils/binary-output.d.ts +32 -0
- package/dist/utils/binary-output.d.ts.map +1 -0
- package/dist/utils/binary-output.js +127 -0
- package/dist/utils/command-protection.d.ts.map +1 -1
- package/dist/utils/command-protection.js +92 -9
- package/dist/utils/parsing.d.ts +1 -1
- package/dist/utils/parsing.d.ts.map +1 -1
- package/package.json +28 -26
- package/dist/commands/add-directory/types.d.ts +0 -6
- package/dist/commands/add-directory/types.d.ts.map +0 -1
- package/dist/commands/add-directory/types.js +0 -1
- package/dist/commands/copy/types.d.ts +0 -3
- package/dist/commands/copy/types.d.ts.map +0 -1
- package/dist/commands/copy/types.js +0 -1
- package/dist/commands/review/types.d.ts +0 -12
- package/dist/commands/review/types.d.ts.map +0 -1
- package/dist/commands/review/types.js +0 -1
- package/dist/modes/manager.d.ts +0 -23
- package/dist/modes/manager.d.ts.map +0 -1
- package/dist/modes/manager.js +0 -77
- package/dist/modes/prompts.d.ts +0 -2
- package/dist/modes/prompts.d.ts.map +0 -1
- package/dist/modes/prompts.js +0 -143
- package/dist/tools/code-search.d.ts +0 -41
- package/dist/tools/code-search.d.ts.map +0 -1
- package/dist/tools/code-search.js +0 -195
- package/dist/utils/iterables.d.ts +0 -2
- package/dist/utils/iterables.d.ts.map +0 -1
- package/dist/utils/iterables.js +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-protection.d.ts","sourceRoot":"","sources":["../../source/utils/command-protection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,KAAK,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,GAAG,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"command-protection.d.ts","sourceRoot":"","sources":["../../source/utils/command-protection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,KAAK,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,GAAG,iBAAiB,CAAC;AA0E3E;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CA4B7E;AA8WD;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,oBAAoB,GAC3B,MAAM,CAQR"}
|
|
@@ -2,6 +2,66 @@
|
|
|
2
2
|
* Command Protection Module
|
|
3
3
|
* Detects and blocks destructive commands that could cause data loss
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Check if a git subcommand appears as an actual command (not inside quoted strings).
|
|
7
|
+
* This helps avoid false positives when destructive command text appears in
|
|
8
|
+
* commit messages or other quoted strings.
|
|
9
|
+
*/
|
|
10
|
+
function isActualGitCommand(command, subcommand) {
|
|
11
|
+
const pattern = new RegExp(`\\bgit\\s+${subcommand}\\b`, "gi");
|
|
12
|
+
// Find all matches of git <subcommand>
|
|
13
|
+
const matches = [];
|
|
14
|
+
let match = pattern.exec(command);
|
|
15
|
+
while (match !== null) {
|
|
16
|
+
matches.push({ index: match.index, text: match[0] });
|
|
17
|
+
match = pattern.exec(command);
|
|
18
|
+
}
|
|
19
|
+
if (matches.length === 0)
|
|
20
|
+
return false;
|
|
21
|
+
// For each match, check if it's inside quotes
|
|
22
|
+
for (const { index } of matches) {
|
|
23
|
+
if (!isInsideQuotes(command, index)) {
|
|
24
|
+
// Also check if it's at the start or after command separators
|
|
25
|
+
const beforeMatch = command.slice(0, index).trim();
|
|
26
|
+
if (beforeMatch === "" ||
|
|
27
|
+
beforeMatch.endsWith("&&") ||
|
|
28
|
+
beforeMatch.endsWith("||") ||
|
|
29
|
+
beforeMatch.endsWith(";") ||
|
|
30
|
+
beforeMatch.endsWith("|") ||
|
|
31
|
+
beforeMatch.endsWith("\n")) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Check if a position in a string is inside quotes (single or double).
|
|
40
|
+
* Handles escaped quotes.
|
|
41
|
+
*/
|
|
42
|
+
function isInsideQuotes(command, position) {
|
|
43
|
+
let inSingleQuote = false;
|
|
44
|
+
let inDoubleQuote = false;
|
|
45
|
+
let escaped = false;
|
|
46
|
+
for (let i = 0; i < position; i++) {
|
|
47
|
+
const char = command[i];
|
|
48
|
+
if (escaped) {
|
|
49
|
+
escaped = false;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (char === "\\") {
|
|
53
|
+
escaped = true;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (char === '"' && !inSingleQuote) {
|
|
57
|
+
inDoubleQuote = !inDoubleQuote;
|
|
58
|
+
}
|
|
59
|
+
else if (char === "'" && !inDoubleQuote) {
|
|
60
|
+
inSingleQuote = !inSingleQuote;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return inSingleQuote || inDoubleQuote;
|
|
64
|
+
}
|
|
5
65
|
/**
|
|
6
66
|
* Detects if a command is destructive and should be blocked
|
|
7
67
|
* @param command - The full command string to check
|
|
@@ -91,15 +151,19 @@ function detectDestructiveGitCommands(command) {
|
|
|
91
151
|
};
|
|
92
152
|
}
|
|
93
153
|
// Block git branch -D (force delete without merge check)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
154
|
+
// Check for uppercase flag on original command (lowercase -d is safe)
|
|
155
|
+
// Match 'git' case-insensitively, but preserve case for the flag
|
|
156
|
+
// Only match if git branch appears as an actual command (not inside quoted strings)
|
|
157
|
+
const branchMatch = lowerCommand.match(/git\s+branch\s+-([a-z])/);
|
|
158
|
+
if (branchMatch) {
|
|
159
|
+
// Check if the flag in the original command is uppercase
|
|
160
|
+
const flagInOriginal = command.match(/git\s+branch\s+-([A-Za-z])/i);
|
|
161
|
+
if (flagInOriginal &&
|
|
162
|
+
flagInOriginal[1] === flagInOriginal[1].toUpperCase()) {
|
|
163
|
+
// Verify this is an actual git branch command, not text inside quotes
|
|
164
|
+
// Check if git branch appears at start or after command separators
|
|
165
|
+
const isActualCommand = isActualGitCommand(command, "branch");
|
|
166
|
+
if (isActualCommand) {
|
|
103
167
|
return {
|
|
104
168
|
blocked: true,
|
|
105
169
|
reason: "git branch -D force-deletes branches without checking if they're merged",
|
|
@@ -216,8 +280,27 @@ function detectDangerousInlineScripts(command) {
|
|
|
216
280
|
}
|
|
217
281
|
/**
|
|
218
282
|
* Detect dangerous patterns in heredocs and here-strings
|
|
283
|
+
* Only blocks heredocs that are explicitly executed by a scripting language,
|
|
284
|
+
* not heredocs used as data (e.g., commit messages, config files).
|
|
219
285
|
*/
|
|
220
286
|
function detectDangerousHeredocs(command) {
|
|
287
|
+
// Check if heredoc is being executed by a scripting language
|
|
288
|
+
// Patterns that indicate execution:
|
|
289
|
+
// 1. bash <<EOF, sh <<EOF, python <<EOF, etc. (language reads from heredoc)
|
|
290
|
+
// 2. cat <<EOF | bash, <<EOF | python, etc. (heredoc piped to language)
|
|
291
|
+
const executionPatterns = [
|
|
292
|
+
// Shell languages reading heredoc directly
|
|
293
|
+
/\b(bash|sh|zsh|dash|ksh)\s*<<-?\s*['"]?\w+/i,
|
|
294
|
+
// Scripting languages reading heredoc directly
|
|
295
|
+
/\b(python\d?|ruby|perl|node)\s*<<-?\s*['"]?\w+/i,
|
|
296
|
+
// Heredoc piped to shell
|
|
297
|
+
/<<-?\s*['"]?\w+['"]?\s*\|\s*(bash|sh|zsh|dash|ksh)\b/i,
|
|
298
|
+
];
|
|
299
|
+
const isExecutableHeredoc = executionPatterns.some((pattern) => pattern.test(command));
|
|
300
|
+
// Only scan heredoc content if it's being executed by a scripting language
|
|
301
|
+
if (!isExecutableHeredoc) {
|
|
302
|
+
return { blocked: false };
|
|
303
|
+
}
|
|
221
304
|
// Match heredoc patterns: <<EOF ... EOF
|
|
222
305
|
const heredocPattern = /<<-?\s*['"]?(\w+)['"]?\s*([\s\S]*?)\n\1\b/gi;
|
|
223
306
|
let match = null;
|
package/dist/utils/parsing.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsing.d.ts","sourceRoot":"","sources":["../../source/utils/parsing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBtC,wBAAgB,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"parsing.d.ts","sourceRoot":"","sources":["../../source/utils/parsing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBtC,wBAAgB,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC,sBAE1D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travisennis/acai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "An AI assistant for developing software.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"lint:ast-grep:fix": "sg scan --update-all",
|
|
34
34
|
"lint:biome": "biome lint",
|
|
35
35
|
"lint:biome:fix": "biome lint --unsafe --write",
|
|
36
|
-
"lint:fix": "
|
|
36
|
+
"lint:fix": "npm run lint:ast-grep && npm run lint:biome:fix",
|
|
37
37
|
"lint:staged": "biome lint --error-on-warnings --no-errors-on-unmatched --staged",
|
|
38
38
|
"format:staged": "biome check --staged --formatter-enabled=true --linter-enabled=false --no-errors-on-unmatched",
|
|
39
39
|
"prepack": "npm run clean && npm run build",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"oxlint:single": "oxlint --type-aware --ignore-path .gitignore -A all -c .oxlintrc.json",
|
|
50
50
|
"knip": "npx knip",
|
|
51
51
|
"knip:prod": "npx knip --production",
|
|
52
|
+
"setup": "node scripts/setup.ts",
|
|
52
53
|
"update": "npx npm-check-updates --interactive --format group",
|
|
53
54
|
"cpd": "npx jscpd ./source",
|
|
54
55
|
"typecheck": "tsc --noEmit --pretty -p tsconfig.json",
|
|
@@ -57,45 +58,46 @@
|
|
|
57
58
|
"lint:length": "find source -name '*.ts' | xargs -I{} awk 'END{if(NR>500)print FILENAME\": \"NR\" lines\"}' {}"
|
|
58
59
|
},
|
|
59
60
|
"dependencies": {
|
|
60
|
-
"@ai-sdk/
|
|
61
|
-
"@ai-sdk/
|
|
62
|
-
"@ai-sdk/
|
|
63
|
-
"@ai-sdk/
|
|
64
|
-
"@ai-sdk/
|
|
65
|
-
"@ai-sdk/
|
|
66
|
-
"@ai-sdk/
|
|
67
|
-
"@ai-sdk/openai
|
|
61
|
+
"@ai-sdk/alibaba": "^1.0.21",
|
|
62
|
+
"@ai-sdk/anthropic": "^3.0.74",
|
|
63
|
+
"@ai-sdk/deepseek": "^2.0.32",
|
|
64
|
+
"@ai-sdk/devtools": "^0.0.17",
|
|
65
|
+
"@ai-sdk/google": "^3.0.67",
|
|
66
|
+
"@ai-sdk/groq": "^3.0.38",
|
|
67
|
+
"@ai-sdk/open-responses": "^1.0.14",
|
|
68
|
+
"@ai-sdk/openai": "^3.0.58",
|
|
69
|
+
"@ai-sdk/openai-compatible": "^2.0.45",
|
|
68
70
|
"@crosscopy/clipboard": "^0.3.6",
|
|
69
71
|
"@travisennis/stdlib": "^0.0.14",
|
|
70
|
-
"ai": "^6.0.
|
|
72
|
+
"ai": "^6.0.174",
|
|
71
73
|
"cheerio": "^1.2.0",
|
|
72
|
-
"diff": "^
|
|
74
|
+
"diff": "^9.0.0",
|
|
73
75
|
"fast-glob": "^3.3.3",
|
|
74
76
|
"fdir": "^6.5.0",
|
|
75
77
|
"highlight.js": "^11.11.1",
|
|
76
|
-
"marked": "
|
|
78
|
+
"marked": "18.0.3",
|
|
77
79
|
"p-throttle": "^8.1.0",
|
|
78
|
-
"parse5": "^8.0.
|
|
79
|
-
"parse5-htmlparser2-tree-adapter": "^8.0.
|
|
80
|
+
"parse5": "^8.0.1",
|
|
81
|
+
"parse5-htmlparser2-tree-adapter": "^8.0.1",
|
|
80
82
|
"pino": "^10.3.1",
|
|
81
83
|
"pino-pretty": "^13.1.3",
|
|
82
84
|
"pino-roll": "^4.0.0",
|
|
83
85
|
"tiktoken": "^1.0.22",
|
|
84
|
-
"zod": "^4.
|
|
86
|
+
"zod": "^4.4.2"
|
|
85
87
|
},
|
|
86
88
|
"devDependencies": {
|
|
87
|
-
"@ai-sdk/provider": "^3.0.
|
|
88
|
-
"@ast-grep/napi": "^0.
|
|
89
|
-
"@biomejs/biome": "2.4.
|
|
90
|
-
"@commitlint/config-conventional": "^20.
|
|
91
|
-
"@types/node": "^25.
|
|
89
|
+
"@ai-sdk/provider": "^3.0.10",
|
|
90
|
+
"@ast-grep/napi": "^0.42.1",
|
|
91
|
+
"@biomejs/biome": "2.4.14",
|
|
92
|
+
"@commitlint/config-conventional": "^20.5.3",
|
|
93
|
+
"@types/node": "^25.6.0",
|
|
92
94
|
"c8": "^11.0.0",
|
|
93
|
-
"commitlint": "^20.
|
|
94
|
-
"domhandler": "^
|
|
95
|
+
"commitlint": "^20.5.3",
|
|
96
|
+
"domhandler": "^6.0.1",
|
|
95
97
|
"husky": "^9.1.7",
|
|
96
|
-
"oxlint": "^1.
|
|
97
|
-
"oxlint-tsgolint": "^0.
|
|
98
|
-
"typescript": "^
|
|
98
|
+
"oxlint": "^1.62.0",
|
|
99
|
+
"oxlint-tsgolint": "^0.22.1",
|
|
100
|
+
"typescript": "^6.0.3"
|
|
99
101
|
},
|
|
100
102
|
"engines": {
|
|
101
103
|
"node": ">=20"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/add-directory/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,gBAAgB,CAAC;CAC7B;AAED,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/copy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAEjD,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface FileChange {
|
|
2
|
-
fileName: string;
|
|
3
|
-
diff: string;
|
|
4
|
-
stats: string;
|
|
5
|
-
}
|
|
6
|
-
export interface ReviewCommandOptions {
|
|
7
|
-
tui: unknown;
|
|
8
|
-
container: unknown;
|
|
9
|
-
editor: unknown;
|
|
10
|
-
inputContainer: unknown;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/review/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc,EAAE,OAAO,CAAC;CACzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/modes/manager.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { UserModelMessage } from "ai";
|
|
2
|
-
export type Mode = "normal" | "planning" | "research";
|
|
3
|
-
export declare class ModeManager {
|
|
4
|
-
private currentMode;
|
|
5
|
-
private firstMessageInMode;
|
|
6
|
-
getCurrentMode(): Mode;
|
|
7
|
-
getDisplayName(): string;
|
|
8
|
-
cycleMode(): void;
|
|
9
|
-
getInitialPrompt(): string;
|
|
10
|
-
getReminderPrompt(): string;
|
|
11
|
-
isNormal(): boolean;
|
|
12
|
-
isFirstMessage(): boolean;
|
|
13
|
-
markFirstMessageSent(): void;
|
|
14
|
-
getReminderMessage(): UserModelMessage | undefined;
|
|
15
|
-
reset(): void;
|
|
16
|
-
toJson(): {
|
|
17
|
-
mode: Mode;
|
|
18
|
-
};
|
|
19
|
-
fromJson(data: {
|
|
20
|
-
mode?: string;
|
|
21
|
-
}): void;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../source/modes/manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAI3C,MAAM,MAAM,IAAI,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;AAmCtD,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,kBAAkB,CAAQ;IAElC,cAAc,IAAI,IAAI;IAItB,cAAc,IAAI,MAAM;IAIxB,SAAS,IAAI,IAAI;IAOjB,gBAAgB,IAAI,MAAM;IAI1B,iBAAiB,IAAI,MAAM;IAI3B,QAAQ,IAAI,OAAO;IAInB,cAAc,IAAI,OAAO;IAIzB,oBAAoB,IAAI,IAAI;IAI5B,kBAAkB,IAAI,gBAAgB,GAAG,SAAS;IAWlD,KAAK,IAAI,IAAI;IAKb,MAAM,IAAI;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE;IAIxB,QAAQ,CAAC,IAAI,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAMxC"}
|
package/dist/modes/manager.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { createUserMessage } from "../sessions/manager.js";
|
|
2
|
-
import { planningPrompt } from "./prompts.js";
|
|
3
|
-
const MODE_DEFINITIONS = {
|
|
4
|
-
normal: {
|
|
5
|
-
name: "normal",
|
|
6
|
-
displayName: "Normal",
|
|
7
|
-
initialPrompt: "",
|
|
8
|
-
reminderPrompt: "",
|
|
9
|
-
},
|
|
10
|
-
planning: {
|
|
11
|
-
name: "planning",
|
|
12
|
-
displayName: "Plan",
|
|
13
|
-
initialPrompt: planningPrompt,
|
|
14
|
-
reminderPrompt: "Remember: You are still in Plan Mode. Continue focusing on architectural design, systematic planning, and high-level considerations.",
|
|
15
|
-
},
|
|
16
|
-
research: {
|
|
17
|
-
name: "research",
|
|
18
|
-
displayName: "Research",
|
|
19
|
-
initialPrompt: "You are in RESEARCH MODE. Your goal is to thoroughly investigate:\n\n1. Current state and context\n2. Existing solutions\n3. Best practices\n4. Trade-offs\n5. Potential pitfalls",
|
|
20
|
-
reminderPrompt: "Remember: You are still in RESEARCH MODE. Continue investigating thoroughly. Synthesize findings.",
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
const ALL_MODES = ["normal", "planning", "research"];
|
|
24
|
-
export class ModeManager {
|
|
25
|
-
currentMode = "normal";
|
|
26
|
-
firstMessageInMode = true;
|
|
27
|
-
getCurrentMode() {
|
|
28
|
-
return this.currentMode;
|
|
29
|
-
}
|
|
30
|
-
getDisplayName() {
|
|
31
|
-
return MODE_DEFINITIONS[this.currentMode].displayName;
|
|
32
|
-
}
|
|
33
|
-
cycleMode() {
|
|
34
|
-
const currentIndex = ALL_MODES.indexOf(this.currentMode);
|
|
35
|
-
const nextIndex = (currentIndex + 1) % ALL_MODES.length;
|
|
36
|
-
this.currentMode = ALL_MODES[nextIndex];
|
|
37
|
-
this.firstMessageInMode = true;
|
|
38
|
-
}
|
|
39
|
-
getInitialPrompt() {
|
|
40
|
-
return MODE_DEFINITIONS[this.currentMode].initialPrompt;
|
|
41
|
-
}
|
|
42
|
-
getReminderPrompt() {
|
|
43
|
-
return MODE_DEFINITIONS[this.currentMode].reminderPrompt;
|
|
44
|
-
}
|
|
45
|
-
isNormal() {
|
|
46
|
-
return this.currentMode === "normal";
|
|
47
|
-
}
|
|
48
|
-
isFirstMessage() {
|
|
49
|
-
return this.firstMessageInMode;
|
|
50
|
-
}
|
|
51
|
-
markFirstMessageSent() {
|
|
52
|
-
this.firstMessageInMode = false;
|
|
53
|
-
}
|
|
54
|
-
getReminderMessage() {
|
|
55
|
-
if (this.isNormal() || this.firstMessageInMode) {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
const reminder = this.getReminderPrompt();
|
|
59
|
-
if (!reminder) {
|
|
60
|
-
return undefined;
|
|
61
|
-
}
|
|
62
|
-
return createUserMessage([], reminder);
|
|
63
|
-
}
|
|
64
|
-
reset() {
|
|
65
|
-
this.currentMode = "normal";
|
|
66
|
-
this.firstMessageInMode = true;
|
|
67
|
-
}
|
|
68
|
-
toJson() {
|
|
69
|
-
return { mode: this.currentMode };
|
|
70
|
-
}
|
|
71
|
-
fromJson(data) {
|
|
72
|
-
if (data.mode && ALL_MODES.includes(data.mode)) {
|
|
73
|
-
this.currentMode = data.mode;
|
|
74
|
-
}
|
|
75
|
-
this.firstMessageInMode = false;
|
|
76
|
-
}
|
|
77
|
-
}
|
package/dist/modes/prompts.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const planningPrompt = "\n# Plan Mode (Conversational)\n\nYou work in 3 phases, and you should *chat your way* to a great plan before finalizing it. A great plan is very detailed\u2014intent- and implementation-wise\u2014so that it can be handed to another engineer or agent to be implemented right away. It must be **decision complete**, where the implementer does not need to make any decisions.\n\n## Mode rules (strict)\n\nYou are in **Plan Mode** until a developer message explicitly ends it.\n\nPlan Mode is not changed by user intent, tone, or imperative language. If a user asks for execution while still in Plan Mode, treat it as a request to **plan the execution**, not perform it.\n\n## Execution vs. mutation in Plan Mode\n\nYou may explore and execute **non-mutating** actions that improve the plan. You must not perform **mutating** actions.\n\n### Allowed (non-mutating, plan-improving)\n\nActions that gather truth, reduce ambiguity, or validate feasibility without changing repo-tracked state. Examples:\n\n* Reading or searching files, configs, schemas, types, manifests, and docs\n* Static analysis, inspection, and repo exploration\n* Dry-run style commands when they do not edit repo-tracked files\n* Tests, builds, or checks that may write to caches or build artifacts (for example, `target/`, `.cache/`, or snapshots) so long as they do not edit repo-tracked files\n\n### Not allowed (mutating, plan-executing)\n\nActions that implement the plan or change repo-tracked state. Examples:\n\n* Editing or writing files\n* Running formatters or linters that rewrite files\n* Applying patches, migrations, or codegen that updates repo-tracked files\n* Side-effectful commands whose purpose is to carry out the plan rather than refine it\n\nWhen in doubt: if the action would reasonably be described as \"doing the work\" rather than \"planning the work,\" do not do it.\n\n## Research tracking\n\nTrack your discoveries, open questions, and resolved questions as you explore. Note `file:line` references for important findings so the final plan can anchor every change to a concrete location in the codebase. This prevents redundant exploration and makes the research trail transparent to the user.\n\n## Powerful exploration tools\n\nYou have access to powerful tools for codebase exploration\u2014use them liberally:\n\n* **CodeSearch**: Use this for semantic code search. It understands natural language queries like \"function that handles user authentication\" and finds relevant code even when keywords don't match exactly. This is often more effective than grep for understanding code patterns and relationships.\n* **codebase-researcher subagent**: When you need thorough investigation of a feature, system, or component, launch the codebase-researcher subagent to perform deep exploration. Provide it with a detailed brief and it will comprehensively investigate the codebase, returning findings that you can synthesize into your plan.\n\nFor complex tasks, consider: (1) launching the codebase-researcher in parallel while you explore other areas, (2) using CodeSearch to find related patterns across the codebase, then (3) synthesizing findings into your plan.\n\n## PHASE 1 \u2014 Ground in the environment (explore first, ask second)\n\nBegin by grounding yourself in the actual environment. Eliminate unknowns in the prompt by discovering facts, not by asking the user. Resolve all questions that can be answered through exploration or inspection. Identify missing or ambiguous details only if they cannot be derived from the environment. Silent exploration between turns is allowed and encouraged.\n\nBefore asking the user any question, perform at least one targeted non-mutating exploration pass (for example: search relevant files, inspect likely entrypoints/configs, confirm current implementation shape), unless no local environment/repo is available.\n\nException: you may ask clarifying questions about the user's prompt before exploring, ONLY if there are obvious ambiguities or contradictions in the prompt itself. However, if ambiguity might be resolved by exploring, always prefer exploring first.\n\nDo not ask questions that can be answered from the repo or system (for example, \"where is this struct?\" or \"which UI component should we use?\" when exploration can make it clear). Only ask once you have exhausted reasonable non-mutating exploration.\n\n## PHASE 2 \u2014 Intent chat (what they actually want)\n\n* Keep asking until you can clearly state: goal + success criteria, audience, in/out of scope, constraints, current state, and the key preferences/tradeoffs.\n* Require an explicit **\"Out of Scope\"** statement \u2014 what we are NOT doing. This prevents scope creep and sets clear expectations.\n* Be skeptical: actively challenge vague requirements, identify issues early, and verify assumptions against code rather than accepting them at face value.\n* Bias toward questions over guessing: if any high-impact ambiguity remains, do NOT plan yet\u2014ask.\n\n## PHASE 3 \u2014 Implementation chat (what/how we\u2019ll build)\n\n* Once intent is stable, keep asking until the spec is decision complete: approach, interfaces (APIs/schemas/I/O), data flow, edge cases/failure modes, testing + acceptance criteria, rollout/monitoring, and any migrations/compat constraints.\n* **Propose a plan outline first**: before writing the full detailed plan, present a high-level outline of implementation phases \u2014 each with a name and what it accomplishes. Get user feedback on structure before filling in details.\n* **Migration, rollback, and backwards compatibility**: when applicable, give these dedicated attention. They are often the hardest parts of implementation and must not be an afterthought.\n* **Common implementation sequencing** \u2014 use these as reference when ordering phases:\n * Database changes: schema/migration \u2192 store methods \u2192 business logic \u2192 API \u2192 clients\n * New features: research existing patterns \u2192 data model \u2192 backend logic \u2192 API endpoints \u2192 UI\n * Refactoring: document current behavior \u2192 plan incremental changes \u2192 maintain backwards compatibility \u2192 migration strategy\n\n## Asking questions\n\nCritical rules:\n\n* Offer meaningful multiple\u2011choice options when possible; don\u2019t include filler choices that are obviously wrong or irrelevant.\n\nYou SHOULD ask many questions, but each question must:\n\n* materially change the spec/plan, OR\n* confirm/lock an assumption, OR\n* choose between meaningful tradeoffs.\n* not be answerable by non-mutating commands.\n\n## Two kinds of unknowns (treat differently)\n\n1. **Discoverable facts** (repo/system truth): explore first.\n\n * Before asking, run targeted searches and check likely sources of truth (configs/manifests/entrypoints/schemas/types/constants).\n * Ask only if: multiple plausible candidates; nothing found but you need a missing identifier/context; or ambiguity is actually product intent.\n * If asking, present concrete candidates (paths/service names) + recommend one.\n * Never ask questions you can answer from your environment (e.g., \u201Cwhere is this struct\u201D).\n\n2. **Preferences/tradeoffs** (not discoverable): ask early.\n\n * These are intent or implementation preferences that cannot be derived from exploration.\n * Provide 2\u20134 mutually exclusive options + a recommended default.\n * If unanswered, proceed with the recommended option and record it as an assumption in the final plan.\n\n## Finalization rule\n\nOnly output the final plan when it is decision complete and leaves no decisions to the implementer.\n\nWhen you present the official plan, wrap it in a `<proposed_plan>` block so the client can render it specially:\n\n1) The opening tag must be on its own line.\n2) Start the plan content on the next line (no text on the same line as the tag).\n3) The closing tag must be on its own line.\n4) Use Markdown inside the block.\n5) Keep the tags exactly as `<proposed_plan>` and `</proposed_plan>` (do not translate or rename them), even if the plan content is in another language.\n\nExample:\n\n<proposed_plan>\nplan content\n</proposed_plan>\n\nplan content should be human and agent digestible. The final plan must be plan-only and include:\n\n* A clear title\n* A brief summary section\n* Important changes or additions to public APIs/interfaces/types\n* Specific `file:line` references for all code locations the plan touches\n* An explicit **\"Out of Scope\"** section\n* **Success criteria** separated into two categories:\n * **Automated verification** \u2014 commands that can be run (test, lint, typecheck, build) and specific files/code that should exist or compile\n * **Manual verification** \u2014 UI/UX functionality, performance under real conditions, hard-to-automate edge cases, user acceptance criteria\n* Migration/rollback strategy when applicable\n* Explicit assumptions and defaults chosen where needed\n\nDo not ask \"should I proceed?\" in the final output. The user can easily switch out of Plan mode and request implementation if you have included a `<proposed_plan>` block in your response. Alternatively, they can decide to stay in Plan mode and continue refining the plan.\n\nOnly produce at most one `<proposed_plan>` block per turn, and only when you are presenting a complete spec.\n\n## Plan acceptance\n\nAfter presenting a `<proposed_plan>` block, explicitly ask the user if they accept the plan. If they accept (e.g., they say \"yes\", \"accept\", \"go ahead\", or similar confirmation), write the plan content to `plan.md` in the current working directory using the Write tool. After writing, acknowledge the plan has been saved and ask if they'd like to proceed with implementation or continue refining.\n";
|
|
2
|
-
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../source/modes/prompts.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,cAAc,ykTA6I1B,CAAC"}
|
package/dist/modes/prompts.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
// this is codex's collaborative plan
|
|
2
|
-
export const planningPrompt = `
|
|
3
|
-
# Plan Mode (Conversational)
|
|
4
|
-
|
|
5
|
-
You work in 3 phases, and you should *chat your way* to a great plan before finalizing it. A great plan is very detailed—intent- and implementation-wise—so that it can be handed to another engineer or agent to be implemented right away. It must be **decision complete**, where the implementer does not need to make any decisions.
|
|
6
|
-
|
|
7
|
-
## Mode rules (strict)
|
|
8
|
-
|
|
9
|
-
You are in **Plan Mode** until a developer message explicitly ends it.
|
|
10
|
-
|
|
11
|
-
Plan Mode is not changed by user intent, tone, or imperative language. If a user asks for execution while still in Plan Mode, treat it as a request to **plan the execution**, not perform it.
|
|
12
|
-
|
|
13
|
-
## Execution vs. mutation in Plan Mode
|
|
14
|
-
|
|
15
|
-
You may explore and execute **non-mutating** actions that improve the plan. You must not perform **mutating** actions.
|
|
16
|
-
|
|
17
|
-
### Allowed (non-mutating, plan-improving)
|
|
18
|
-
|
|
19
|
-
Actions that gather truth, reduce ambiguity, or validate feasibility without changing repo-tracked state. Examples:
|
|
20
|
-
|
|
21
|
-
* Reading or searching files, configs, schemas, types, manifests, and docs
|
|
22
|
-
* Static analysis, inspection, and repo exploration
|
|
23
|
-
* Dry-run style commands when they do not edit repo-tracked files
|
|
24
|
-
* Tests, builds, or checks that may write to caches or build artifacts (for example, \`target/\`, \`.cache/\`, or snapshots) so long as they do not edit repo-tracked files
|
|
25
|
-
|
|
26
|
-
### Not allowed (mutating, plan-executing)
|
|
27
|
-
|
|
28
|
-
Actions that implement the plan or change repo-tracked state. Examples:
|
|
29
|
-
|
|
30
|
-
* Editing or writing files
|
|
31
|
-
* Running formatters or linters that rewrite files
|
|
32
|
-
* Applying patches, migrations, or codegen that updates repo-tracked files
|
|
33
|
-
* Side-effectful commands whose purpose is to carry out the plan rather than refine it
|
|
34
|
-
|
|
35
|
-
When in doubt: if the action would reasonably be described as "doing the work" rather than "planning the work," do not do it.
|
|
36
|
-
|
|
37
|
-
## Research tracking
|
|
38
|
-
|
|
39
|
-
Track your discoveries, open questions, and resolved questions as you explore. Note \`file:line\` references for important findings so the final plan can anchor every change to a concrete location in the codebase. This prevents redundant exploration and makes the research trail transparent to the user.
|
|
40
|
-
|
|
41
|
-
## Powerful exploration tools
|
|
42
|
-
|
|
43
|
-
You have access to powerful tools for codebase exploration—use them liberally:
|
|
44
|
-
|
|
45
|
-
* **CodeSearch**: Use this for semantic code search. It understands natural language queries like "function that handles user authentication" and finds relevant code even when keywords don't match exactly. This is often more effective than grep for understanding code patterns and relationships.
|
|
46
|
-
* **codebase-researcher subagent**: When you need thorough investigation of a feature, system, or component, launch the codebase-researcher subagent to perform deep exploration. Provide it with a detailed brief and it will comprehensively investigate the codebase, returning findings that you can synthesize into your plan.
|
|
47
|
-
|
|
48
|
-
For complex tasks, consider: (1) launching the codebase-researcher in parallel while you explore other areas, (2) using CodeSearch to find related patterns across the codebase, then (3) synthesizing findings into your plan.
|
|
49
|
-
|
|
50
|
-
## PHASE 1 — Ground in the environment (explore first, ask second)
|
|
51
|
-
|
|
52
|
-
Begin by grounding yourself in the actual environment. Eliminate unknowns in the prompt by discovering facts, not by asking the user. Resolve all questions that can be answered through exploration or inspection. Identify missing or ambiguous details only if they cannot be derived from the environment. Silent exploration between turns is allowed and encouraged.
|
|
53
|
-
|
|
54
|
-
Before asking the user any question, perform at least one targeted non-mutating exploration pass (for example: search relevant files, inspect likely entrypoints/configs, confirm current implementation shape), unless no local environment/repo is available.
|
|
55
|
-
|
|
56
|
-
Exception: you may ask clarifying questions about the user's prompt before exploring, ONLY if there are obvious ambiguities or contradictions in the prompt itself. However, if ambiguity might be resolved by exploring, always prefer exploring first.
|
|
57
|
-
|
|
58
|
-
Do not ask questions that can be answered from the repo or system (for example, "where is this struct?" or "which UI component should we use?" when exploration can make it clear). Only ask once you have exhausted reasonable non-mutating exploration.
|
|
59
|
-
|
|
60
|
-
## PHASE 2 — Intent chat (what they actually want)
|
|
61
|
-
|
|
62
|
-
* Keep asking until you can clearly state: goal + success criteria, audience, in/out of scope, constraints, current state, and the key preferences/tradeoffs.
|
|
63
|
-
* Require an explicit **"Out of Scope"** statement — what we are NOT doing. This prevents scope creep and sets clear expectations.
|
|
64
|
-
* Be skeptical: actively challenge vague requirements, identify issues early, and verify assumptions against code rather than accepting them at face value.
|
|
65
|
-
* Bias toward questions over guessing: if any high-impact ambiguity remains, do NOT plan yet—ask.
|
|
66
|
-
|
|
67
|
-
## PHASE 3 — Implementation chat (what/how we’ll build)
|
|
68
|
-
|
|
69
|
-
* Once intent is stable, keep asking until the spec is decision complete: approach, interfaces (APIs/schemas/I/O), data flow, edge cases/failure modes, testing + acceptance criteria, rollout/monitoring, and any migrations/compat constraints.
|
|
70
|
-
* **Propose a plan outline first**: before writing the full detailed plan, present a high-level outline of implementation phases — each with a name and what it accomplishes. Get user feedback on structure before filling in details.
|
|
71
|
-
* **Migration, rollback, and backwards compatibility**: when applicable, give these dedicated attention. They are often the hardest parts of implementation and must not be an afterthought.
|
|
72
|
-
* **Common implementation sequencing** — use these as reference when ordering phases:
|
|
73
|
-
* Database changes: schema/migration → store methods → business logic → API → clients
|
|
74
|
-
* New features: research existing patterns → data model → backend logic → API endpoints → UI
|
|
75
|
-
* Refactoring: document current behavior → plan incremental changes → maintain backwards compatibility → migration strategy
|
|
76
|
-
|
|
77
|
-
## Asking questions
|
|
78
|
-
|
|
79
|
-
Critical rules:
|
|
80
|
-
|
|
81
|
-
* Offer meaningful multiple‑choice options when possible; don’t include filler choices that are obviously wrong or irrelevant.
|
|
82
|
-
|
|
83
|
-
You SHOULD ask many questions, but each question must:
|
|
84
|
-
|
|
85
|
-
* materially change the spec/plan, OR
|
|
86
|
-
* confirm/lock an assumption, OR
|
|
87
|
-
* choose between meaningful tradeoffs.
|
|
88
|
-
* not be answerable by non-mutating commands.
|
|
89
|
-
|
|
90
|
-
## Two kinds of unknowns (treat differently)
|
|
91
|
-
|
|
92
|
-
1. **Discoverable facts** (repo/system truth): explore first.
|
|
93
|
-
|
|
94
|
-
* Before asking, run targeted searches and check likely sources of truth (configs/manifests/entrypoints/schemas/types/constants).
|
|
95
|
-
* Ask only if: multiple plausible candidates; nothing found but you need a missing identifier/context; or ambiguity is actually product intent.
|
|
96
|
-
* If asking, present concrete candidates (paths/service names) + recommend one.
|
|
97
|
-
* Never ask questions you can answer from your environment (e.g., “where is this struct”).
|
|
98
|
-
|
|
99
|
-
2. **Preferences/tradeoffs** (not discoverable): ask early.
|
|
100
|
-
|
|
101
|
-
* These are intent or implementation preferences that cannot be derived from exploration.
|
|
102
|
-
* Provide 2–4 mutually exclusive options + a recommended default.
|
|
103
|
-
* If unanswered, proceed with the recommended option and record it as an assumption in the final plan.
|
|
104
|
-
|
|
105
|
-
## Finalization rule
|
|
106
|
-
|
|
107
|
-
Only output the final plan when it is decision complete and leaves no decisions to the implementer.
|
|
108
|
-
|
|
109
|
-
When you present the official plan, wrap it in a \`<proposed_plan>\` block so the client can render it specially:
|
|
110
|
-
|
|
111
|
-
1) The opening tag must be on its own line.
|
|
112
|
-
2) Start the plan content on the next line (no text on the same line as the tag).
|
|
113
|
-
3) The closing tag must be on its own line.
|
|
114
|
-
4) Use Markdown inside the block.
|
|
115
|
-
5) Keep the tags exactly as \`<proposed_plan>\` and \`</proposed_plan>\` (do not translate or rename them), even if the plan content is in another language.
|
|
116
|
-
|
|
117
|
-
Example:
|
|
118
|
-
|
|
119
|
-
<proposed_plan>
|
|
120
|
-
plan content
|
|
121
|
-
</proposed_plan>
|
|
122
|
-
|
|
123
|
-
plan content should be human and agent digestible. The final plan must be plan-only and include:
|
|
124
|
-
|
|
125
|
-
* A clear title
|
|
126
|
-
* A brief summary section
|
|
127
|
-
* Important changes or additions to public APIs/interfaces/types
|
|
128
|
-
* Specific \`file:line\` references for all code locations the plan touches
|
|
129
|
-
* An explicit **"Out of Scope"** section
|
|
130
|
-
* **Success criteria** separated into two categories:
|
|
131
|
-
* **Automated verification** — commands that can be run (test, lint, typecheck, build) and specific files/code that should exist or compile
|
|
132
|
-
* **Manual verification** — UI/UX functionality, performance under real conditions, hard-to-automate edge cases, user acceptance criteria
|
|
133
|
-
* Migration/rollback strategy when applicable
|
|
134
|
-
* Explicit assumptions and defaults chosen where needed
|
|
135
|
-
|
|
136
|
-
Do not ask "should I proceed?" in the final output. The user can easily switch out of Plan mode and request implementation if you have included a \`<proposed_plan>\` block in your response. Alternatively, they can decide to stay in Plan mode and continue refining the plan.
|
|
137
|
-
|
|
138
|
-
Only produce at most one \`<proposed_plan>\` block per turn, and only when you are presenting a complete spec.
|
|
139
|
-
|
|
140
|
-
## Plan acceptance
|
|
141
|
-
|
|
142
|
-
After presenting a \`<proposed_plan>\` block, explicitly ask the user if they accept the plan. If they accept (e.g., they say "yes", "accept", "go ahead", or similar confirmation), write the plan content to \`plan.md\` in the current working directory using the Write tool. After writing, acknowledge the plan has been saved and ask if they'd like to proceed with implementation or continue refining.
|
|
143
|
-
`;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { ToolExecutionOptions } from "./types.ts";
|
|
3
|
-
export declare const CodeSearchTool: {
|
|
4
|
-
name: "CodeSearch";
|
|
5
|
-
};
|
|
6
|
-
declare const inputSchema: z.ZodObject<{
|
|
7
|
-
query: z.ZodString;
|
|
8
|
-
path: z.ZodDefault<z.ZodString>;
|
|
9
|
-
regexPattern: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodString>>;
|
|
10
|
-
filePattern: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodString>>;
|
|
11
|
-
excludePattern: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodString>>;
|
|
12
|
-
excludeDir: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodString>>;
|
|
13
|
-
maxResults: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
14
|
-
contextLines: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
15
|
-
filesOnly: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedBoolean<unknown>>>;
|
|
16
|
-
showContent: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedBoolean<unknown>>>;
|
|
17
|
-
codeOnly: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedBoolean<unknown>>>;
|
|
18
|
-
}, z.core.$strip>;
|
|
19
|
-
type CodeSearchInputSchema = z.infer<typeof inputSchema>;
|
|
20
|
-
export declare const createCodeSearchTool: () => {
|
|
21
|
-
toolDef: {
|
|
22
|
-
description: string;
|
|
23
|
-
inputSchema: z.ZodObject<{
|
|
24
|
-
query: z.ZodString;
|
|
25
|
-
path: z.ZodDefault<z.ZodString>;
|
|
26
|
-
regexPattern: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodString>>;
|
|
27
|
-
filePattern: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodString>>;
|
|
28
|
-
excludePattern: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodString>>;
|
|
29
|
-
excludeDir: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodString>>;
|
|
30
|
-
maxResults: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
31
|
-
contextLines: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
32
|
-
filesOnly: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedBoolean<unknown>>>;
|
|
33
|
-
showContent: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedBoolean<unknown>>>;
|
|
34
|
-
codeOnly: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedBoolean<unknown>>>;
|
|
35
|
-
}, z.core.$strip>;
|
|
36
|
-
};
|
|
37
|
-
display({ query, path, regexPattern, filePattern, excludePattern, excludeDir, maxResults, contextLines, filesOnly, showContent, codeOnly, }: CodeSearchInputSchema): string;
|
|
38
|
-
execute({ query, path, regexPattern, filePattern, excludePattern, excludeDir, maxResults, contextLines, filesOnly, showContent, codeOnly, }: CodeSearchInputSchema, { abortSignal }: ToolExecutionOptions): Promise<string>;
|
|
39
|
-
};
|
|
40
|
-
export {};
|
|
41
|
-
//# sourceMappingURL=code-search.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-search.d.ts","sourceRoot":"","sources":["../../source/tools/code-search.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAMvD,eAAO,MAAM,cAAc;;CAE1B,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;;;;;;;iBA8Bf,CAAC;AAEH,KAAK,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AA4GzD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;iJAkB1B,qBAAqB;iJAsDnB,qBAAqB,mBACP,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;CAgCrB,CAAC"}
|