thachvd-kit 1.0.11 → 1.0.13
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/bin/cli.js +265 -180
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -942,14 +942,16 @@ ${autoSkillsList}
|
|
|
942
942
|
- **In Progress:** Initial setup
|
|
943
943
|
- **Next:** —
|
|
944
944
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
945
|
+
|
|
946
|
+
---
|
|
947
|
+
|
|
948
|
+
## Known Issues / Tasks
|
|
949
|
+
|
|
950
|
+
<!-- Add known issues or pending tasks -->
|
|
951
|
+
`;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
|
|
953
955
|
function generateClaudeMd(data) {
|
|
954
956
|
return `# CLAUDE.md — ${data.project_name}
|
|
955
957
|
# Generated by thachvd-kit. See PROJECT_CONTEXT.md for full stack info.
|
|
@@ -958,132 +960,260 @@ function generateClaudeMd(data) {
|
|
|
958
960
|
## Project
|
|
959
961
|
${data.description}
|
|
960
962
|
Stack: ${data.primary_language} | ${(data.frameworks || []).join(', ')}
|
|
961
|
-
|
|
963
|
+
|
|
962
964
|
## Rules
|
|
963
965
|
- Read PROJECT_CONTEXT.md first for stack details and agent routing.
|
|
964
966
|
- If PROJECT_CONTEXT.md is missing or stale, create/update it before major work.
|
|
965
967
|
- Follow skills in .agent/skills/ (or .claude/skills/).
|
|
966
968
|
- Tests are mandatory. Verify before claiming done.
|
|
967
969
|
- Max ${data.max_file_lines || '300'} lines per file.
|
|
968
|
-
|
|
969
|
-
## Key Skills
|
|
970
|
-
- Plan: \`plan-writing\` → \`executing-plans\`
|
|
971
|
-
- Review: \`requesting-code-review\` / \`receiving-code-review\`
|
|
972
|
-
- Quality: \`clean-code\`, \`verification-before-completion\`
|
|
973
|
-
- Workflow: \`subagent-driven-development\`, \`finishing-a-development-branch\`
|
|
974
|
-
|
|
975
|
-
## Commands
|
|
976
|
-
- \`/plan\` — Create implementation plan
|
|
977
|
-
- \`/debug\` — Systematic debugging
|
|
978
|
-
- \`/test\` — Run test suite
|
|
979
|
-
- \`/deploy\` — Deploy checklist
|
|
970
|
+
|
|
971
|
+
## Key Skills
|
|
972
|
+
- Plan: \`plan-writing\` → \`executing-plans\`
|
|
973
|
+
- Review: \`requesting-code-review\` / \`receiving-code-review\`
|
|
974
|
+
- Quality: \`clean-code\`, \`verification-before-completion\`
|
|
975
|
+
- Workflow: \`subagent-driven-development\`, \`finishing-a-development-branch\`
|
|
976
|
+
|
|
977
|
+
## Commands
|
|
978
|
+
- \`/plan\` — Create implementation plan
|
|
979
|
+
- \`/debug\` — Systematic debugging
|
|
980
|
+
- \`/test\` — Run test suite
|
|
981
|
+
- \`/deploy\` — Deploy checklist
|
|
980
982
|
|
|
981
983
|
See PROJECT_CONTEXT.md for full agent routing table.
|
|
982
984
|
`;
|
|
983
985
|
}
|
|
984
986
|
|
|
985
987
|
function generateAgentsMd(data) {
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
988
|
+
const frameworks = (data.frameworks || []);
|
|
989
|
+
const primaryLang = data.primary_language || 'javascript';
|
|
990
|
+
const pkgManager = data.package_manager || 'npm';
|
|
991
|
+
const testFramework = data.test_framework || 'auto-detect';
|
|
992
|
+
const database = data.database || 'none';
|
|
993
|
+
const cloud = data.cloud || 'none';
|
|
994
|
+
const infrastructure = (data.infrastructure || []);
|
|
995
|
+
const appRoot = data.app_root || '.';
|
|
996
|
+
const maxFileLines = data.max_file_lines || '300';
|
|
997
|
+
|
|
998
|
+
// Build dev commands section based on detected package manager and framework
|
|
999
|
+
const isNode = ['javascript', 'typescript'].includes(primaryLang);
|
|
1000
|
+
const isPython = primaryLang === 'python';
|
|
1001
|
+
const isGo = primaryLang === 'go';
|
|
1002
|
+
const isRust = primaryLang === 'rust';
|
|
1003
|
+
const isPhp = primaryLang === 'php';
|
|
1004
|
+
|
|
1005
|
+
let installCmd = 'npm install';
|
|
1006
|
+
let devCmd = 'npm run dev';
|
|
1007
|
+
let buildCmd = 'npm run build';
|
|
1008
|
+
let testCmd = 'npm test';
|
|
1009
|
+
let lintCmd = 'npm run lint';
|
|
1010
|
+
|
|
1011
|
+
if (pkgManager === 'pnpm') { installCmd = 'pnpm install'; devCmd = 'pnpm dev'; buildCmd = 'pnpm build'; testCmd = 'pnpm test'; lintCmd = 'pnpm lint'; }
|
|
1012
|
+
else if (pkgManager === 'yarn') { installCmd = 'yarn'; devCmd = 'yarn dev'; buildCmd = 'yarn build'; testCmd = 'yarn test'; lintCmd = 'yarn lint'; }
|
|
1013
|
+
else if (pkgManager === 'bun') { installCmd = 'bun install'; devCmd = 'bun dev'; buildCmd = 'bun run build'; testCmd = 'bun test'; lintCmd = 'bun run lint'; }
|
|
1014
|
+
else if (isPython) { installCmd = 'pip install -r requirements.txt'; devCmd = 'python manage.py runserver'; buildCmd = '# no build step'; testCmd = 'pytest'; lintCmd = 'ruff check .'; }
|
|
1015
|
+
else if (isGo) { installCmd = 'go mod download'; devCmd = 'go run .'; buildCmd = 'go build ./...'; testCmd = 'go test ./...'; lintCmd = 'golangci-lint run'; }
|
|
1016
|
+
else if (isRust) { installCmd = 'cargo build'; devCmd = 'cargo run'; buildCmd = 'cargo build --release'; testCmd = 'cargo test'; lintCmd = 'cargo clippy'; }
|
|
1017
|
+
else if (isPhp) { installCmd = 'composer install'; devCmd = 'php artisan serve'; buildCmd = '# no build step'; testCmd = testFramework === 'pest' ? './vendor/bin/pest' : './vendor/bin/phpunit'; lintCmd = 'php artisan pint'; }
|
|
1018
|
+
|
|
1019
|
+
if (testFramework === 'vitest') testCmd = `${pkgManager === 'pnpm' ? 'pnpm' : pkgManager === 'yarn' ? 'yarn' : pkgManager === 'bun' ? 'bun run' : 'npx'} vitest`;
|
|
1020
|
+
else if (testFramework === 'jest') testCmd = `${pkgManager === 'pnpm' ? 'pnpm' : pkgManager === 'yarn' ? 'yarn' : 'npx'} jest`;
|
|
1021
|
+
|
|
1022
|
+
// Build stack overview section
|
|
1023
|
+
const stackLines = [
|
|
1024
|
+
`- **Language:** ${primaryLang}`,
|
|
1025
|
+
frameworks.length > 0 ? `- **Frameworks:** ${frameworks.join(', ')}` : null,
|
|
1026
|
+
database !== 'none' ? `- **Database:** ${database}` : null,
|
|
1027
|
+
pkgManager !== 'auto-detect' ? `- **Package Manager:** ${pkgManager}` : null,
|
|
1028
|
+
testFramework !== 'auto-detect' ? `- **Test Framework:** ${testFramework}` : null,
|
|
1029
|
+
cloud !== 'none' ? `- **Cloud:** ${cloud}` : null,
|
|
1030
|
+
infrastructure.length > 0 ? `- **Infrastructure:** ${infrastructure.join(', ')}` : null,
|
|
1031
|
+
].filter(Boolean).join('\n');
|
|
1032
|
+
|
|
1033
|
+
// Build architecture notes hint
|
|
1034
|
+
const archNotes = data.architecture_notes && !data.architecture_notes.includes('<!-- Add')
|
|
1035
|
+
? `\n${data.architecture_notes}`
|
|
1036
|
+
: '';
|
|
1037
|
+
|
|
1038
|
+
// Agent routing table
|
|
1039
|
+
const agentTable = resolveAgentTable(data);
|
|
1040
|
+
const agentRows = agentTable.map(([task, agent, skills]) => `| ${task} | \`${agent}\` | ${skills} |`).join('\n');
|
|
1041
|
+
|
|
1042
|
+
// Auto-resolved skills
|
|
1043
|
+
const autoSkills = resolveSkills(data);
|
|
1044
|
+
const skillsList = autoSkills.map(s => `- ${s}`).join('\n');
|
|
1045
|
+
|
|
1046
|
+
return `# ${data.project_name}
|
|
989
1047
|
|
|
990
|
-
## Project
|
|
991
1048
|
${data.description}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
-
|
|
1014
|
-
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1049
|
+
|
|
1050
|
+
## Project Overview
|
|
1051
|
+
|
|
1052
|
+
${stackLines}
|
|
1053
|
+
|
|
1054
|
+
---
|
|
1055
|
+
|
|
1056
|
+
## Core Architecture
|
|
1057
|
+
|
|
1058
|
+
<!-- AI: Scan the project and replace this section with actual directory structure and key module descriptions -->
|
|
1059
|
+
${appRoot !== '.' ? `- **App Root:** \`${appRoot}\`` : ''}
|
|
1060
|
+
|
|
1061
|
+
---
|
|
1062
|
+
|
|
1063
|
+
## Development Workflow
|
|
1064
|
+
|
|
1065
|
+
### Prerequisites
|
|
1066
|
+
- ${primaryLang.charAt(0).toUpperCase() + primaryLang.slice(1)} toolchain installed
|
|
1067
|
+
${pkgManager !== 'auto-detect' ? `- \`${pkgManager}\` (Package Manager)` : ''}
|
|
1068
|
+
|
|
1069
|
+
### Key Commands
|
|
1070
|
+
- **Install Dependencies:** \`${installCmd}\`
|
|
1071
|
+
- **Development Server:** \`${devCmd}\`
|
|
1072
|
+
- **Build for Production:** \`${buildCmd}\`
|
|
1073
|
+
- **Run Tests:** \`${testCmd}\`
|
|
1074
|
+
- **Linting:** \`${lintCmd}\`
|
|
1075
|
+
|
|
1076
|
+
---
|
|
1077
|
+
|
|
1078
|
+
## Coding Conventions
|
|
1079
|
+
|
|
1080
|
+
<!-- AI: Scan the project and replace this section with actual conventions (API patterns, state management, styling, naming, routing) -->
|
|
1081
|
+
|
|
1082
|
+
---
|
|
1083
|
+
|
|
1084
|
+
## Performance & Optimization
|
|
1085
|
+
|
|
1086
|
+
<!-- AI: Scan vite.config / webpack / build config and replace with actual optimizations used -->
|
|
1087
|
+
|
|
1088
|
+
---
|
|
1089
|
+
|
|
1090
|
+
## Coding Rules
|
|
1091
|
+
|
|
1092
|
+
**Don't assume. Don't hide confusion. Surface tradeoffs.**
|
|
1093
|
+
|
|
1094
|
+
Before implementing:
|
|
1095
|
+
- State your assumptions explicitly. If uncertain, ask.
|
|
1096
|
+
- If multiple interpretations exist, present them — don't pick silently.
|
|
1097
|
+
- If a simpler approach exists, say so. Push back when warranted.
|
|
1098
|
+
- If something is unclear, stop. Name what's confusing. Ask.
|
|
1099
|
+
|
|
1100
|
+
### 1. Simplicity First
|
|
1101
|
+
|
|
1102
|
+
**Minimum code that solves the problem. Nothing speculative.**
|
|
1103
|
+
|
|
1104
|
+
- No features beyond what was asked.
|
|
1105
|
+
- No abstractions for single-use code.
|
|
1106
|
+
- No "flexibility" or "configurability" that wasn't requested.
|
|
1107
|
+
- No error handling for impossible scenarios.
|
|
1108
|
+
- If you write 200 lines and it could be 50, rewrite it.
|
|
1109
|
+
|
|
1110
|
+
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
|
|
1111
|
+
|
|
1112
|
+
### 2. Surgical Changes
|
|
1113
|
+
|
|
1114
|
+
**Touch only what you must. Clean up only your own mess.**
|
|
1115
|
+
|
|
1116
|
+
When editing existing code:
|
|
1117
|
+
- Don't "improve" adjacent code, comments, or formatting.
|
|
1118
|
+
- Don't refactor things that aren't broken.
|
|
1119
|
+
- Match existing style, even if you'd do it differently.
|
|
1120
|
+
- If you notice unrelated dead code, mention it — don't delete it.
|
|
1121
|
+
|
|
1122
|
+
When your changes create orphans:
|
|
1123
|
+
- Remove imports/variables/functions that YOUR changes made unused.
|
|
1124
|
+
- Don't remove pre-existing dead code unless asked.
|
|
1125
|
+
|
|
1126
|
+
The test: Every changed line should trace directly to the user's request.
|
|
1127
|
+
|
|
1128
|
+
### 3. Goal-Driven Execution
|
|
1129
|
+
|
|
1130
|
+
**Define success criteria. Loop until verified.**
|
|
1131
|
+
|
|
1132
|
+
Transform tasks into verifiable goals:
|
|
1133
|
+
- "Add validation" → "Write tests for invalid inputs, then make them pass"
|
|
1134
|
+
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
|
|
1135
|
+
- "Refactor X" → "Ensure tests pass before and after"
|
|
1136
|
+
|
|
1137
|
+
For multi-step tasks, state a brief plan:
|
|
1138
|
+
\`\`\`
|
|
1139
|
+
1. [Step] → verify: [check]
|
|
1140
|
+
2. [Step] → verify: [check]
|
|
1141
|
+
3. [Step] → verify: [check]
|
|
1142
|
+
\`\`\`
|
|
1143
|
+
|
|
1144
|
+
Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
|
|
1145
|
+
|
|
1146
|
+
### 4. Universal Standards
|
|
1147
|
+
|
|
1148
|
+
- Respond in user's language; code/comments in English.
|
|
1149
|
+
- \`clean-code\` applies to all code, all languages.
|
|
1150
|
+
- Tests are mandatory.
|
|
1151
|
+
- Verify with evidence before claiming done.
|
|
1152
|
+
- Identify dependent files before modifying any.
|
|
1153
|
+
- Keep files under ${maxFileLines} lines; split into modules if exceeded.
|
|
1023
1154
|
`;
|
|
1024
1155
|
}
|
|
1025
1156
|
|
|
1026
|
-
function
|
|
1157
|
+
function generateAgentsMdRefinementPrompt(data) {
|
|
1027
1158
|
const evidence = (data.scan_evidence || []).length > 0
|
|
1028
1159
|
? (data.scan_evidence || []).map(line => `- ${line}`).join('\n')
|
|
1029
1160
|
: '- No scan evidence was captured during init.';
|
|
1030
1161
|
|
|
1031
|
-
return `#
|
|
1032
|
-
|
|
1033
|
-
Use this prompt in your AI editor after \`thachvd-kit init\`.
|
|
1034
|
-
|
|
1035
|
-
## Goal
|
|
1162
|
+
return `# AGENTS.md Refinement Prompt
|
|
1036
1163
|
|
|
1037
|
-
|
|
1164
|
+
Run this in your AI editor right after \`thachvd-kit init --scan\`.
|
|
1165
|
+
The goal is to replace the placeholder sections in \`AGENTS.md\` with real project knowledge.
|
|
1038
1166
|
|
|
1039
|
-
##
|
|
1167
|
+
## Baseline Detected
|
|
1040
1168
|
|
|
1041
|
-
- Project
|
|
1042
|
-
-
|
|
1043
|
-
-
|
|
1044
|
-
-
|
|
1045
|
-
- Infra: ${(data.infrastructure || []).join(', ') || 'none'}
|
|
1169
|
+
- **Project:** ${data.project_name}
|
|
1170
|
+
- **Stack:** ${data.primary_language} | ${(data.frameworks || []).join(', ') || 'no framework'}
|
|
1171
|
+
- **Database:** ${data.database || 'none'}
|
|
1172
|
+
- **Package Manager:** ${data.package_manager || 'auto-detect'}
|
|
1046
1173
|
|
|
1047
1174
|
## Scan Evidence
|
|
1048
1175
|
|
|
1049
1176
|
${evidence}
|
|
1050
1177
|
|
|
1051
|
-
##
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
-
|
|
1071
|
-
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
-
|
|
1077
|
-
-
|
|
1078
|
-
-
|
|
1079
|
-
-
|
|
1080
|
-
|
|
1081
|
-
##
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
-
|
|
1085
|
-
-
|
|
1086
|
-
-
|
|
1178
|
+
## Your Task
|
|
1179
|
+
|
|
1180
|
+
Update **only** the placeholder sections in \`AGENTS.md\` (marked with \`<!-- AI: ... --\`>):
|
|
1181
|
+
|
|
1182
|
+
### 1. Core Architecture
|
|
1183
|
+
Scan the \`src/\` (or equivalent) directory. For each major folder, write one bullet:
|
|
1184
|
+
\`- **\`src/folder/\`**: What it contains and its role\`
|
|
1185
|
+
Keep it concise — one line per folder.
|
|
1186
|
+
|
|
1187
|
+
### 2. Coding Conventions
|
|
1188
|
+
Inspect actual code patterns and write conventions grouped by topic:
|
|
1189
|
+
- API integration patterns (how HTTP calls are made)
|
|
1190
|
+
- State management patterns
|
|
1191
|
+
- Styling conventions
|
|
1192
|
+
- Component/file naming rules
|
|
1193
|
+
- Routing and auth patterns
|
|
1194
|
+
|
|
1195
|
+
### 3. Performance & Optimization
|
|
1196
|
+
Check \`vite.config.js\`, \`webpack.config.js\`, \`package.json\` scripts, or build configs. List actual optimizations:
|
|
1197
|
+
- Code splitting, lazy loading, chunking
|
|
1198
|
+
- Compression, caching strategies
|
|
1199
|
+
- PWA, image optimization, etc.
|
|
1200
|
+
|
|
1201
|
+
## Rules
|
|
1202
|
+
|
|
1203
|
+
- Replace placeholders with real content. Remove the \`<!-- AI: ... -->\` comments.
|
|
1204
|
+
- Do NOT change \`## Project Overview\`, \`## Development Workflow\`, or \`## Coding Rules\` sections.
|
|
1205
|
+
- Do NOT implement any product code.
|
|
1206
|
+
- If a section is not applicable, write \`N/A\` and remove the placeholder.
|
|
1207
|
+
|
|
1208
|
+
## Files To Inspect
|
|
1209
|
+
|
|
1210
|
+
- \`src/\` or \`app/\` directory structure
|
|
1211
|
+
- Build config: \`vite.config.*\`, \`webpack.config.*\`, \`next.config.*\`
|
|
1212
|
+
- Entry points: \`main.js\`, \`app.js\`, \`index.ts\`
|
|
1213
|
+
- Router definition
|
|
1214
|
+
- Example API service files
|
|
1215
|
+
- Example store/state files
|
|
1216
|
+
- README if present
|
|
1087
1217
|
`;
|
|
1088
1218
|
}
|
|
1089
1219
|
|
|
@@ -1115,7 +1245,7 @@ async function main() {
|
|
|
1115
1245
|
|
|
1116
1246
|
console.log(pc.bold(pc.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')));
|
|
1117
1247
|
console.log(' ' + pc.bold('thachvd-kit') + ' — Project Init Wizard');
|
|
1118
|
-
console.log(` Generates .
|
|
1248
|
+
console.log(` Generates AGENTS.md${useScan ? ' (scan-assisted)' : ''}`);
|
|
1119
1249
|
console.log(pc.bold(pc.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')) + '\n');
|
|
1120
1250
|
|
|
1121
1251
|
let projectSetup = 'new';
|
|
@@ -1265,91 +1395,46 @@ async function main() {
|
|
|
1265
1395
|
data.scan_evidence = scanned?.scan_evidence || [];
|
|
1266
1396
|
data.app_root = scanned?.app_root || '.';
|
|
1267
1397
|
|
|
1268
|
-
if (!assumeYes) {
|
|
1269
|
-
const aiRefineAnswer = await askQuestions({
|
|
1270
|
-
type: 'confirm',
|
|
1271
|
-
name: 'ai_refine',
|
|
1272
|
-
message: 'Should the agent refine PROJECT_CONTEXT.md on first session start?',
|
|
1273
|
-
initial: useScan
|
|
1274
|
-
});
|
|
1275
|
-
requestAiRefinement = Boolean(aiRefineAnswer.ai_refine);
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
data.context_status = 'baseline';
|
|
1279
|
-
data.needs_ai_refinement = requestAiRefinement;
|
|
1280
|
-
data.last_refined_at = 'not-yet-refined';
|
|
1281
1398
|
data.infrastructure = [];
|
|
1282
1399
|
if (data.uses_docker) data.infrastructure.push('docker');
|
|
1283
1400
|
if (data.cloud !== 'none') data.infrastructure.push(data.cloud);
|
|
1284
|
-
|
|
1285
|
-
// --- Copy .agent folder ---
|
|
1286
|
-
const agentDir = path.join(targetDir, '.agent');
|
|
1287
|
-
console.log(`\n${pc.bold(pc.cyan('━━ Generating Files ━━'))}`);
|
|
1288
|
-
|
|
1289
|
-
if (!fs.existsSync(agentDir)) {
|
|
1290
|
-
fs.mkdirSync(agentDir, { recursive: true });
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
// Copy folders: agents, rules, skills, workflows
|
|
1294
|
-
const foldersToCopy = ['agents', 'rules', 'skills', 'workflows'];
|
|
1295
|
-
for (const folder of foldersToCopy) {
|
|
1296
|
-
const srcPath = path.join(sourceDir, folder);
|
|
1297
|
-
const destPath = path.join(agentDir, folder);
|
|
1298
|
-
if (fs.existsSync(srcPath)) {
|
|
1299
|
-
// Use basic recursive copy since Node 16.7 fs.cpSync handles this
|
|
1300
|
-
fs.cpSync(srcPath, destPath, { recursive: true, force: true });
|
|
1301
|
-
console.log(` ${pc.green('✓')} Copied ${pc.bold(`.agent/${folder}`)}`);
|
|
1302
|
-
} else {
|
|
1303
|
-
console.log(` ${pc.yellow('-')} Source ${folder} not found.`);
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
// Write contexts
|
|
1308
|
-
const projectContextPath = path.join(targetDir, 'PROJECT_CONTEXT.md');
|
|
1309
|
-
fs.writeFileSync(projectContextPath, generateProjectContext(data), 'utf8');
|
|
1310
|
-
console.log(` ${pc.green('✓')} Generated ${pc.bold('PROJECT_CONTEXT.md')}`);
|
|
1311
1401
|
|
|
1312
|
-
|
|
1313
|
-
fs.writeFileSync(claudeMdPath, generateClaudeMd(data), 'utf8');
|
|
1314
|
-
console.log(` ${pc.green('✓')} Generated ${pc.bold('CLAUDE.md')}`);
|
|
1402
|
+
console.log(`\n${pc.bold(pc.cyan('━━ Generating Files ━━'))}`);
|
|
1315
1403
|
|
|
1404
|
+
// Write AGENTS.md — the only output file
|
|
1316
1405
|
const agentsMdPath = path.join(targetDir, 'AGENTS.md');
|
|
1406
|
+
const agentsMdExists = fs.existsSync(agentsMdPath);
|
|
1407
|
+
if (agentsMdExists && !assumeYes) {
|
|
1408
|
+
const res = await askQuestions({
|
|
1409
|
+
type: 'confirm',
|
|
1410
|
+
name: 'overwrite',
|
|
1411
|
+
message: 'AGENTS.md already exists. Overwrite?',
|
|
1412
|
+
initial: false
|
|
1413
|
+
});
|
|
1414
|
+
if (!res.overwrite) {
|
|
1415
|
+
console.log(pc.yellow('\nAborted. Existing AGENTS.md unchanged.'));
|
|
1416
|
+
process.exit(0);
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1317
1420
|
fs.writeFileSync(agentsMdPath, generateAgentsMd(data), 'utf8');
|
|
1318
1421
|
console.log(` ${pc.green('✓')} Generated ${pc.bold('AGENTS.md')}`);
|
|
1319
1422
|
|
|
1320
|
-
|
|
1321
|
-
if (requestAiRefinement) {
|
|
1322
|
-
aiRefinementPath = path.join(targetDir, 'AI_CONTEXT_REFINEMENT.md');
|
|
1323
|
-
fs.writeFileSync(aiRefinementPath, generateAiContextRefinementPrompt(data), 'utf8');
|
|
1324
|
-
console.log(` ${pc.green('✓')} Generated ${pc.bold('AI_CONTEXT_REFINEMENT.md')}`);
|
|
1325
|
-
}
|
|
1423
|
+
console.log(`\n${pc.bold(pc.green('━━ Done! ━━'))}
|
|
1326
1424
|
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
${pc.bold('Project:')} ${data.project_name}
|
|
1332
|
-
${pc.bold('Stack:')} ${data.primary_language} | ${(data.frameworks || []).join(', ') || 'no framework'}
|
|
1333
|
-
${pc.bold('Infra:')} ${(data.infrastructure || []).join(', ') || 'none'}
|
|
1334
|
-
|
|
1335
|
-
${pc.bold('Auto-resolved skills:')}
|
|
1336
|
-
${autoSkills.map(s => ' · ' + s).join('\n')}
|
|
1337
|
-
|
|
1338
|
-
${pc.bold('Generated files:')}
|
|
1339
|
-
· ${pc.bold(projectContextPath)}
|
|
1340
|
-
· ${pc.bold(claudeMdPath)}
|
|
1341
|
-
· ${pc.bold(agentsMdPath)}
|
|
1342
|
-
${aiRefinementPath ? ` · ${pc.bold(aiRefinementPath)}` : ''}
|
|
1425
|
+
${pc.bold('Project:')} ${data.project_name}
|
|
1426
|
+
${pc.bold('Stack:')} ${data.primary_language} | ${(data.frameworks || []).join(', ') || 'no framework'}
|
|
1427
|
+
|
|
1428
|
+
${pc.bold('Generated:')} ${pc.bold(agentsMdPath)}
|
|
1343
1429
|
|
|
1344
1430
|
${pc.bold('Next steps:')}
|
|
1345
|
-
1.
|
|
1346
|
-
2.
|
|
1347
|
-
3.
|
|
1348
|
-
4. Open project in Claude Code or Codex — the agent will read context on start
|
|
1431
|
+
1. ${useScan ? `Open ${pc.bold('AGENTS.md')} — paste its content into your AI editor to fill in the placeholders` : `Edit ${pc.bold('AGENTS.md')} and fill in Core Architecture, Coding Conventions, Performance sections`}
|
|
1432
|
+
2. Commit ${pc.bold('AGENTS.md')} to the repo
|
|
1433
|
+
3. Open project in Claude Code / Codex / Antigravity — agent reads AGENTS.md automatically
|
|
1349
1434
|
`);
|
|
1350
1435
|
}
|
|
1351
|
-
|
|
1352
|
-
main().catch(err => {
|
|
1353
|
-
console.error(pc.red('\nError during init:'), err);
|
|
1354
|
-
process.exit(1);
|
|
1355
|
-
});
|
|
1436
|
+
|
|
1437
|
+
main().catch(err => {
|
|
1438
|
+
console.error(pc.red('\nError during init:'), err);
|
|
1439
|
+
process.exit(1);
|
|
1440
|
+
});
|