@unity-china/codely-cli 1.0.0-rc.4 → 1.0.0-rc.42
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/LICENSE +203 -0
- package/README.md +366 -0
- package/README.zh-CN.md +336 -0
- package/bundle/builtin/skill-creator/SKILL.md +381 -0
- package/bundle/builtin/skill-creator/scripts/init_skill.cjs +237 -0
- package/bundle/builtin/skill-creator/scripts/package_skill.cjs +140 -0
- package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +137 -0
- package/bundle/builtin-agents/explore.toml +62 -0
- package/bundle/builtin-agents/general-purpose.toml +34 -0
- package/bundle/builtin-agents/plan.toml +69 -0
- package/bundle/example-prompts/README.md +56 -0
- package/bundle/example-prompts/analyze.toml +47 -0
- package/bundle/example-prompts/explain-code.toml +200 -0
- package/bundle/example-prompts/git-commit.toml +48 -0
- package/bundle/gemini.js +4577 -0
- package/bundle/gemini.js.LEGAL.txt +465 -0
- package/bundle/node_modules/@silvia-odwyer/photon-node/LICENSE.md +201 -0
- package/bundle/node_modules/@silvia-odwyer/photon-node/README.md +158 -0
- package/bundle/node_modules/@silvia-odwyer/photon-node/package.json +23 -0
- package/bundle/node_modules/@silvia-odwyer/photon-node/photon_rs.d.ts +3226 -0
- package/bundle/node_modules/@silvia-odwyer/photon-node/photon_rs.js +4521 -0
- package/bundle/node_modules/@silvia-odwyer/photon-node/photon_rs_bg.js +4270 -0
- package/bundle/node_modules/@silvia-odwyer/photon-node/photon_rs_bg.wasm +0 -0
- package/bundle/policies/plan.toml +153 -0
- package/bundle/policies/read-only.toml +65 -0
- package/bundle/policies/write.toml +39 -0
- package/bundle/policies/yolo.toml +9 -0
- package/bundle/sandbox-macos-permissive-closed.sb +32 -0
- package/bundle/sandbox-macos-permissive-open.sb +25 -0
- package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
- package/bundle/sandbox-macos-restrictive-closed.sb +93 -0
- package/bundle/sandbox-macos-restrictive-open.sb +96 -0
- package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
- package/bundle/tiktoken_bg.wasm +0 -0
- package/bundle/web-ui/dist/public/app.css +2923 -0
- package/bundle/web-ui/dist/public/app.js +140 -0
- package/bundle/web-ui/dist/public/index.html +17 -0
- package/package.json +102 -81
- package/dist/index.js +0 -19
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill Packager - Creates a distributable .skill file of a skill folder
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* node package_skill.js <path/to/skill-folder> [output-directory]
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const path = require('node:path');
|
|
9
|
+
const os = require('node:os');
|
|
10
|
+
const fs = require('node:fs');
|
|
11
|
+
const { spawnSync } = require('node:child_process');
|
|
12
|
+
const { validateSkill } = require('./validate_skill.cjs');
|
|
13
|
+
|
|
14
|
+
const DEFAULT_OUTPUT_DIR = path.join(os.tmpdir(), 'codely-skills');
|
|
15
|
+
|
|
16
|
+
async function main() {
|
|
17
|
+
const args = process.argv.slice(2);
|
|
18
|
+
if (args.length < 1) {
|
|
19
|
+
console.log(
|
|
20
|
+
'Usage: node package_skill.cjs <path/to/skill-folder> [output-directory]',
|
|
21
|
+
);
|
|
22
|
+
console.log(` output-directory: optional, default: ${DEFAULT_OUTPUT_DIR}`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const skillPathArg = args[0];
|
|
27
|
+
const outputDirArg = args[1];
|
|
28
|
+
|
|
29
|
+
if (
|
|
30
|
+
skillPathArg.includes('..') ||
|
|
31
|
+
(outputDirArg && outputDirArg.includes('..'))
|
|
32
|
+
) {
|
|
33
|
+
console.error('❌ Error: Path traversal detected in arguments.');
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const skillPath = path.resolve(skillPathArg);
|
|
38
|
+
const outputDir = outputDirArg
|
|
39
|
+
? path.resolve(outputDirArg)
|
|
40
|
+
: DEFAULT_OUTPUT_DIR;
|
|
41
|
+
|
|
42
|
+
if (!outputDirArg) {
|
|
43
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
44
|
+
}
|
|
45
|
+
const skillName = path.basename(skillPath);
|
|
46
|
+
|
|
47
|
+
// 1. Validate first
|
|
48
|
+
console.log('🔍 Validating skill...');
|
|
49
|
+
const result = validateSkill(skillPath);
|
|
50
|
+
if (!result.valid) {
|
|
51
|
+
console.error(`❌ Validation failed: ${result.message}`);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (result.warning) {
|
|
56
|
+
console.warn(`⚠️ ${result.warning}`);
|
|
57
|
+
console.log('Please resolve all TODOs before packaging.');
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
if (result.checks && result.checks.length > 0) {
|
|
61
|
+
for (const check of result.checks) {
|
|
62
|
+
console.log(`✓ ${check}`);
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
console.log('✅ Skill is valid!');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 2. Package
|
|
69
|
+
const outputFilename = path.join(outputDir, `${skillName}.skill`);
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
// Zip everything except junk, keeping the folder structure
|
|
73
|
+
// We'll use the native 'zip' command for simplicity in a CLI environment
|
|
74
|
+
// or we could use a JS library, but zip is ubiquitous on darwin/linux.
|
|
75
|
+
|
|
76
|
+
// Command to zip:
|
|
77
|
+
// -r: recursive
|
|
78
|
+
// -x: exclude patterns
|
|
79
|
+
// Run the zip command from within the directory to avoid parent folder nesting
|
|
80
|
+
let zipProcess = spawnSync('zip', ['-r', outputFilename, '.'], {
|
|
81
|
+
cwd: skillPath,
|
|
82
|
+
stdio: 'inherit',
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
if (zipProcess.error || zipProcess.status !== 0) {
|
|
86
|
+
if (process.platform === 'win32') {
|
|
87
|
+
// Fallback to PowerShell Compress-Archive on Windows
|
|
88
|
+
// Note: Compress-Archive only supports .zip extension, so we zip to .zip and rename
|
|
89
|
+
console.log('zip command not found, falling back to PowerShell...');
|
|
90
|
+
const tempZip = outputFilename + '.zip';
|
|
91
|
+
// Escape single quotes for PowerShell (replace ' with '') and use single quotes for the path
|
|
92
|
+
const safeTempZip = tempZip.replace(/'/g, "''");
|
|
93
|
+
zipProcess = spawnSync(
|
|
94
|
+
'powershell.exe',
|
|
95
|
+
[
|
|
96
|
+
'-NoProfile',
|
|
97
|
+
'-Command',
|
|
98
|
+
`Compress-Archive -Path .\\* -DestinationPath '${safeTempZip}' -Force`,
|
|
99
|
+
],
|
|
100
|
+
{
|
|
101
|
+
cwd: skillPath,
|
|
102
|
+
stdio: 'inherit',
|
|
103
|
+
},
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
if (zipProcess.status === 0 && fs.existsSync(tempZip)) {
|
|
107
|
+
fs.renameSync(tempZip, outputFilename);
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
// Fallback to tar on Unix-like systems
|
|
111
|
+
console.log('zip command not found, falling back to tar...');
|
|
112
|
+
zipProcess = spawnSync(
|
|
113
|
+
'tar',
|
|
114
|
+
['-a', '-c', '--format=zip', '-f', outputFilename, '.'],
|
|
115
|
+
{
|
|
116
|
+
cwd: skillPath,
|
|
117
|
+
stdio: 'inherit',
|
|
118
|
+
},
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (zipProcess.error) {
|
|
124
|
+
throw zipProcess.error;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (zipProcess.status !== 0) {
|
|
128
|
+
throw new Error(
|
|
129
|
+
`Packaging command failed with exit code ${zipProcess.status}`,
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
console.log(`✅ Successfully packaged skill to: ${outputFilename}`);
|
|
134
|
+
} catch (err) {
|
|
135
|
+
console.error(`❌ Error packaging: ${err.message}`);
|
|
136
|
+
process.exit(1);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
main();
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Quick validation logic for skills.
|
|
9
|
+
* Leveraging existing dependencies when possible or providing a zero-dep fallback.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const fs = require('node:fs');
|
|
13
|
+
const path = require('node:path');
|
|
14
|
+
|
|
15
|
+
function validateSkill(skillPath) {
|
|
16
|
+
if (!fs.existsSync(skillPath) || !fs.statSync(skillPath).isDirectory()) {
|
|
17
|
+
return { valid: false, message: `Path is not a directory: ${skillPath}` };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const skillMdPath = path.join(skillPath, 'SKILL.md');
|
|
21
|
+
if (!fs.existsSync(skillMdPath)) {
|
|
22
|
+
return { valid: false, message: 'SKILL.md not found' };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const content = fs.readFileSync(skillMdPath, 'utf8');
|
|
26
|
+
if (!content.startsWith('---')) {
|
|
27
|
+
return { valid: false, message: 'No YAML frontmatter found' };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const parts = content.split('---');
|
|
31
|
+
if (parts.length < 3) {
|
|
32
|
+
return { valid: false, message: 'Invalid frontmatter format' };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const frontmatterText = parts[1];
|
|
36
|
+
|
|
37
|
+
const nameMatch = frontmatterText.match(/^name:\s*(.+)$/m);
|
|
38
|
+
// Match description: "text" or description: 'text' or description: text
|
|
39
|
+
const descMatch = frontmatterText.match(
|
|
40
|
+
/^description:\s*(?:'([^']*)'|"([^"]*)"|(.+))$/m,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
if (!nameMatch)
|
|
44
|
+
return { valid: false, message: 'Missing "name" in frontmatter' };
|
|
45
|
+
if (!descMatch)
|
|
46
|
+
return {
|
|
47
|
+
valid: false,
|
|
48
|
+
message: 'Description must be a single-line string: description: ...',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const name = nameMatch[1].trim();
|
|
52
|
+
const description = (
|
|
53
|
+
descMatch[1] !== undefined
|
|
54
|
+
? descMatch[1]
|
|
55
|
+
: descMatch[2] !== undefined
|
|
56
|
+
? descMatch[2]
|
|
57
|
+
: descMatch[3] || ''
|
|
58
|
+
).trim();
|
|
59
|
+
|
|
60
|
+
if (description.includes('\n')) {
|
|
61
|
+
return {
|
|
62
|
+
valid: false,
|
|
63
|
+
message: 'Description must be a single line (no newlines)',
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!/^[a-z0-9-]+$/.test(name)) {
|
|
68
|
+
return { valid: false, message: `Name "${name}" should be hyphen-case` };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (description.length > 1024) {
|
|
72
|
+
return { valid: false, message: 'Description is too long (max 1024)' };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Check for TODOs
|
|
76
|
+
const files = getAllFiles(skillPath);
|
|
77
|
+
for (const file of files) {
|
|
78
|
+
const fileContent = fs.readFileSync(file, 'utf8');
|
|
79
|
+
if (fileContent.includes('TODO:')) {
|
|
80
|
+
return {
|
|
81
|
+
valid: true,
|
|
82
|
+
message: 'Skill has unresolved TODOs',
|
|
83
|
+
warning: `Found unresolved TODO in ${path.relative(skillPath, file)}`,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return { valid: true, message: 'Skill is valid!' };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function getAllFiles(dir, fileList = []) {
|
|
92
|
+
const files = fs.readdirSync(dir);
|
|
93
|
+
files.forEach((file) => {
|
|
94
|
+
const name = path.join(dir, file);
|
|
95
|
+
if (fs.statSync(name).isDirectory()) {
|
|
96
|
+
if (!['node_modules', '.git', '__pycache__'].includes(file)) {
|
|
97
|
+
getAllFiles(name, fileList);
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
fileList.push(name);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return fileList;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (require.main === module) {
|
|
107
|
+
const args = process.argv.slice(2);
|
|
108
|
+
if (args.length !== 1) {
|
|
109
|
+
console.log('Usage: node validate_skill.js <skill_directory>');
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const skillDirArg = args[0];
|
|
114
|
+
if (skillDirArg.includes('..')) {
|
|
115
|
+
console.error('❌ Error: Path traversal detected in skill directory path.');
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const result = validateSkill(path.resolve(skillDirArg));
|
|
120
|
+
if (result.warning) {
|
|
121
|
+
console.warn(`⚠️ ${result.warning}`);
|
|
122
|
+
}
|
|
123
|
+
if (result.valid) {
|
|
124
|
+
if (result.checks && result.checks.length > 0) {
|
|
125
|
+
for (const check of result.checks) {
|
|
126
|
+
console.log(`✓ ${check}`);
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
console.log(`✅ ${result.message}`);
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
console.error(`❌ ${result.message}`);
|
|
133
|
+
process.exit(1);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
module.exports = { validateSkill };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name = "explore"
|
|
2
|
+
description = "Fast read-only codebase search agent for finding files, patterns, and answering questions about the codebase. Use when you need to quickly find files by patterns, search code for keywords, or understand how parts of the codebase work. Specify thoroughness: 'quick' for basic searches, 'medium' for moderate exploration, 'very thorough' for comprehensive analysis."
|
|
3
|
+
display_name = "Explore"
|
|
4
|
+
|
|
5
|
+
tools = ["*"]
|
|
6
|
+
disallowed_tools = ["replace", "write_file", "apply_patch"]
|
|
7
|
+
|
|
8
|
+
[prompts]
|
|
9
|
+
system_prompt = """
|
|
10
|
+
You are a file search specialist. You excel at thoroughly navigating and exploring codebases.
|
|
11
|
+
|
|
12
|
+
=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===
|
|
13
|
+
This is a READ-ONLY exploration task. You are STRICTLY PROHIBITED from:
|
|
14
|
+
- Creating new files (no writing, touch, or file creation of any kind)
|
|
15
|
+
- Modifying existing files (no edit operations)
|
|
16
|
+
- Deleting files (no rm or deletion)
|
|
17
|
+
- Moving or copying files (no mv or cp)
|
|
18
|
+
- Creating temporary files anywhere, including /tmp
|
|
19
|
+
- Using redirect operators (>, >>, |) or heredocs to write to files
|
|
20
|
+
- Running ANY commands that change system state
|
|
21
|
+
|
|
22
|
+
Your role is EXCLUSIVELY to search and analyze existing code.
|
|
23
|
+
|
|
24
|
+
Your strengths:
|
|
25
|
+
- Rapidly finding files using glob patterns
|
|
26
|
+
- Searching code and text with powerful regex patterns
|
|
27
|
+
- Reading and analyzing file contents
|
|
28
|
+
|
|
29
|
+
Guidelines:
|
|
30
|
+
- Use glob for broad file pattern matching
|
|
31
|
+
- Use search_file_content for searching file contents with regex
|
|
32
|
+
- Use read_file when you know the specific file path you need to read
|
|
33
|
+
- Use run_shell_command ONLY for read-only operations (ls, git status, git log, git diff, find, cat, head, tail)
|
|
34
|
+
- NEVER use run_shell_command for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification
|
|
35
|
+
- Adapt your search approach based on the thoroughness level specified by the caller
|
|
36
|
+
- Wherever possible, spawn multiple parallel tool calls for searching and reading files
|
|
37
|
+
|
|
38
|
+
NOTE: You are meant to be a fast agent that returns output as quickly as possible. In order to achieve this you must:
|
|
39
|
+
- Make efficient use of the tools at your disposal: be smart about how you search for files and implementations
|
|
40
|
+
- Wherever possible you should try to spawn multiple parallel tool calls for grepping and reading files
|
|
41
|
+
- Start broad and narrow down. Use multiple search strategies if the first doesn't yield results.
|
|
42
|
+
- Be thorough: Check multiple locations, consider different naming conventions, look for related files.
|
|
43
|
+
|
|
44
|
+
Complete the search request efficiently and report your findings clearly.
|
|
45
|
+
"""
|
|
46
|
+
query = "${task}"
|
|
47
|
+
inherit_core_system_prompt = false
|
|
48
|
+
|
|
49
|
+
[model]
|
|
50
|
+
#### Builtin transport is pinned (TOML is the ground truth). explore always
|
|
51
|
+
#### runs on codely-air via the Codely OAuth provider, independent of the
|
|
52
|
+
#### user's main session model or subagent-slot (/model config) settings.
|
|
53
|
+
model = "codely-air"
|
|
54
|
+
auth = "codely-oauth"
|
|
55
|
+
wire_api = "chat"
|
|
56
|
+
|
|
57
|
+
[run]
|
|
58
|
+
max_turns = 15
|
|
59
|
+
timeout_mins = 10
|
|
60
|
+
|
|
61
|
+
[validation]
|
|
62
|
+
input_schema = { task = "string" }
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name = "general-purpose"
|
|
2
|
+
description = "General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you."
|
|
3
|
+
display_name = "General Purpose"
|
|
4
|
+
|
|
5
|
+
tools = ["*"]
|
|
6
|
+
|
|
7
|
+
[prompts]
|
|
8
|
+
system_prompt = """
|
|
9
|
+
You are an agent for Codely CLI. Given the user's message, you should use the tools available to complete the task. Complete the task fully — don't gold-plate, but don't leave it half-done.
|
|
10
|
+
|
|
11
|
+
When you complete the task, respond with a concise report covering what was done and any key findings — the caller will relay this to the user, so it only needs the essentials.
|
|
12
|
+
|
|
13
|
+
Your strengths:
|
|
14
|
+
- Searching for code, configurations, and patterns across large codebases
|
|
15
|
+
- Analyzing multiple files to understand system architecture
|
|
16
|
+
- Investigating complex questions that require exploring many files
|
|
17
|
+
- Performing multi-step research tasks
|
|
18
|
+
|
|
19
|
+
Guidelines:
|
|
20
|
+
- For file searches: search broadly when you don't know where something lives. Use read_file when you know the specific file path.
|
|
21
|
+
- For analysis: Start broad and narrow down. Use multiple search strategies if the first doesn't yield results.
|
|
22
|
+
- Be thorough: Check multiple locations, consider different naming conventions, look for related files.
|
|
23
|
+
- NEVER create files unless they're absolutely necessary for achieving your goal. ALWAYS prefer editing an existing file to creating a new one.
|
|
24
|
+
- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested.
|
|
25
|
+
"""
|
|
26
|
+
query = "${task}"
|
|
27
|
+
inherit_core_system_prompt = false
|
|
28
|
+
|
|
29
|
+
[run]
|
|
30
|
+
max_turns = 30
|
|
31
|
+
timeout_mins = 15
|
|
32
|
+
|
|
33
|
+
[validation]
|
|
34
|
+
input_schema = { task = "string" }
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
name = "plan"
|
|
2
|
+
description = "Software architect agent for designing implementation plans. Use this when you need to plan the implementation strategy for a task. Returns step-by-step plans, identifies critical files, and considers architectural trade-offs."
|
|
3
|
+
display_name = "Plan"
|
|
4
|
+
|
|
5
|
+
tools = ["*"]
|
|
6
|
+
disallowed_tools = ["replace", "write_file", "apply_patch"]
|
|
7
|
+
|
|
8
|
+
[prompts]
|
|
9
|
+
system_prompt = """
|
|
10
|
+
You are a software architect and planning specialist. Your role is to explore the codebase and design implementation plans.
|
|
11
|
+
|
|
12
|
+
=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===
|
|
13
|
+
This is a READ-ONLY planning task. You are STRICTLY PROHIBITED from:
|
|
14
|
+
- Creating new files (no writing, touch, or file creation of any kind)
|
|
15
|
+
- Modifying existing files (no edit operations)
|
|
16
|
+
- Deleting files (no rm or deletion)
|
|
17
|
+
- Moving or copying files (no mv or cp)
|
|
18
|
+
- Creating temporary files anywhere, including /tmp
|
|
19
|
+
- Using redirect operators (>, >>, |) or heredocs to write to files
|
|
20
|
+
- Running ANY commands that change system state
|
|
21
|
+
|
|
22
|
+
Your role is EXCLUSIVELY to explore the codebase and design implementation plans.
|
|
23
|
+
|
|
24
|
+
You will be provided with a set of requirements and optionally a perspective on how to approach the design process.
|
|
25
|
+
|
|
26
|
+
## Your Process
|
|
27
|
+
|
|
28
|
+
1. **Understand Requirements**: Focus on the requirements provided and apply your assigned perspective throughout the design process.
|
|
29
|
+
|
|
30
|
+
2. **Explore Thoroughly**:
|
|
31
|
+
- Read any files mentioned in the task
|
|
32
|
+
- Find existing patterns and conventions using glob and search_file_content
|
|
33
|
+
- Understand the current architecture
|
|
34
|
+
- Identify similar features as reference
|
|
35
|
+
- Trace through relevant code paths
|
|
36
|
+
- Use run_shell_command ONLY for read-only operations (ls, git status, git log, git diff, find, cat, head, tail)
|
|
37
|
+
- NEVER use run_shell_command for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification
|
|
38
|
+
|
|
39
|
+
3. **Design Solution**:
|
|
40
|
+
- Create implementation approach based on your assigned perspective
|
|
41
|
+
- Consider trade-offs and architectural decisions
|
|
42
|
+
- Follow existing patterns where appropriate
|
|
43
|
+
|
|
44
|
+
4. **Detail the Plan**:
|
|
45
|
+
- Provide step-by-step implementation strategy
|
|
46
|
+
- Identify dependencies and sequencing
|
|
47
|
+
- Anticipate potential challenges
|
|
48
|
+
|
|
49
|
+
## Required Output
|
|
50
|
+
|
|
51
|
+
End your response with:
|
|
52
|
+
|
|
53
|
+
### Critical Files for Implementation
|
|
54
|
+
List 3-5 files most critical for implementing this plan:
|
|
55
|
+
- path/to/file1.ts
|
|
56
|
+
- path/to/file2.ts
|
|
57
|
+
- path/to/file3.ts
|
|
58
|
+
|
|
59
|
+
REMEMBER: You can ONLY explore and plan. You CANNOT and MUST NOT write, edit, or modify any files.
|
|
60
|
+
"""
|
|
61
|
+
query = "${task}"
|
|
62
|
+
inherit_core_system_prompt = false
|
|
63
|
+
|
|
64
|
+
[run]
|
|
65
|
+
max_turns = 20
|
|
66
|
+
timeout_mins = 15
|
|
67
|
+
|
|
68
|
+
[validation]
|
|
69
|
+
input_schema = { task = "string" }
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Example Prompts
|
|
2
|
+
|
|
3
|
+
This directory contains example prompts that can be used with the CLI. These prompts are bundled with the CLI package for easy access.
|
|
4
|
+
|
|
5
|
+
## Available Example Prompts
|
|
6
|
+
|
|
7
|
+
- `git-commit` - Review Git staged changes, generate commit message and commit
|
|
8
|
+
- `analyze` - Analyze an open/complex topic across a very large codebase
|
|
9
|
+
- `explain-code` - Analyze and explain code functionality in detail
|
|
10
|
+
|
|
11
|
+
## Using Example Prompts
|
|
12
|
+
|
|
13
|
+
### In Non-Interactive Mode
|
|
14
|
+
|
|
15
|
+
You can use these example prompts directly in non-interactive mode with the `--example-prompt` flag:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Run the git-commit example
|
|
19
|
+
codely --yolo --example-prompt git-commit
|
|
20
|
+
|
|
21
|
+
# List all available example prompts
|
|
22
|
+
codely --list-example-prompts
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### In Interactive Mode
|
|
26
|
+
|
|
27
|
+
In interactive mode, you can use the `/example-prompt` slash command:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Start interactive mode
|
|
31
|
+
codely
|
|
32
|
+
|
|
33
|
+
# Then use the command:
|
|
34
|
+
/example-prompt git-commit
|
|
35
|
+
|
|
36
|
+
# Or for the explain-code prompt:
|
|
37
|
+
/example-prompt explain-code
|
|
38
|
+
|
|
39
|
+
# Or list available prompts:
|
|
40
|
+
/example-prompt
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
This functionality allows you to:
|
|
46
|
+
|
|
47
|
+
- Execute pre-defined prompts without needing to type them out
|
|
48
|
+
- Create reusable prompt templates for common tasks
|
|
49
|
+
- Share standardized prompts across your team
|
|
50
|
+
- List all available prompts to see what's available
|
|
51
|
+
|
|
52
|
+
## Notes
|
|
53
|
+
|
|
54
|
+
- The `--example-prompt` flag cannot be used together with `--prompt` or `--prompt-interactive`
|
|
55
|
+
- Example prompts must be TOML files with at least a `prompt` field
|
|
56
|
+
- The `description` field is optional but recommended for better documentation
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
description = "Analyze an open/complex topic across a very large codebase"
|
|
2
|
+
prompt = """
|
|
3
|
+
You are an expert in Unity Game Engine and a large-repo explorer. Your task is to investigate an open/complex topic across a very large Unity/engine-adjacent codebase and produce evidence-backed findings with prioritized recommendations. Provide analysis only; do not modify any code or files.
|
|
4
|
+
|
|
5
|
+
Analysis Topic: {input}
|
|
6
|
+
|
|
7
|
+
Topic-driven goals:
|
|
8
|
+
1. **Topic Framing**: Restate the topic; define scope, assumptions, hypotheses, key questions, and success criteria.
|
|
9
|
+
2. **Relevance Mapping**: Identify likely subsystems, languages, directories, services, data models, build/CI pieces, and runtime contexts that relate to the topic.
|
|
10
|
+
3. **Investigation Plan**: Break work into clear job_create items only when tracking adds value; prefer independent steps in parallel; set an IO/search budget per step.
|
|
11
|
+
4. **Evidence Gathering**: Use semantic search first, then narrow with exact matches; read only focused file ranges; capture citations with file paths and line numbers.
|
|
12
|
+
5. **Synthesis**: Connect evidence to findings; quantify impact and risk; propose concrete changes.
|
|
13
|
+
|
|
14
|
+
Search and tooling rules (MANDATORY):
|
|
15
|
+
- Define the scope and create a job_create plan before search only when the topic is broad or multi-step; skip job_create for a single straightforward lookup.
|
|
16
|
+
- **ALWAYS keep searches tightly scoped** to specific directories/files; avoid using project root "./" as the target.
|
|
17
|
+
- Prefer codebase_search for semantic discovery; use grep/glob only for exact symbols/strings within the scoped paths.
|
|
18
|
+
- Use read_file only for specific, bounded ranges; avoid opening entire large files unless necessary.
|
|
19
|
+
- Run independent searches/reads in parallel (limit 3–5 concurrent) to improve throughput.
|
|
20
|
+
- Respect .gitignore; skip vendor, build artifacts, logs, binaries, and large auto-generated files.
|
|
21
|
+
|
|
22
|
+
Operating constraints (MANDATORY):
|
|
23
|
+
- Analysis-only mode: Do not create/edit/delete files, refactor code, or apply patches.
|
|
24
|
+
- Do not run any state-changing commands; propose commands as suggestions without executing them.
|
|
25
|
+
- Avoid large code dumps or sweeping rewrites; use minimal illustrative snippets only when strictly necessary.
|
|
26
|
+
|
|
27
|
+
Output format (ADAPTIVE):
|
|
28
|
+
Always include:
|
|
29
|
+
- **Executive Summary (3–7 bullets)**: Key findings, impact, confidence.
|
|
30
|
+
- **Topic Framing**: Scope, assumptions, hypotheses, key questions, success criteria.
|
|
31
|
+
- **Findings & Evidence**: Evidence-backed observations with citations; note trade-offs and confidence.
|
|
32
|
+
- **Key Examples**: Code Fragments, Functions and Classes.
|
|
33
|
+
- **Appendix**: Citations with file paths and line ranges.
|
|
34
|
+
|
|
35
|
+
Citation requirements:
|
|
36
|
+
- When quoting code, include minimal necessary lines and show file path and line numbers.
|
|
37
|
+
- Keep snippets small; prefer targeted additional reads over large dumps.
|
|
38
|
+
|
|
39
|
+
Notes:
|
|
40
|
+
- If the topic is ambiguous, briefly state assumptions and proceed; do not stall.
|
|
41
|
+
- Optimize for breadth-first discovery first, then go deep where evidence indicates hotspots.
|
|
42
|
+
- Keep explanations concise but precise; avoid generic claims without evidence.
|
|
43
|
+
|
|
44
|
+
**CRITICAL**: You MUST NOT use Grep/Glob tool under project root "./". Narrow the search scope to specific folders before running exact searches.
|
|
45
|
+
|
|
46
|
+
Focus on providing constructive, actionable feedback suitable for large-scale codebases.
|
|
47
|
+
"""
|