thachvd-kit 1.0.10 → 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/README.md +3 -2
- package/bin/cli.js +282 -151
- package/kit/README.md +9 -8
- package/package.json +1 -1
- package/rules/GEMINI.md +5 -5
- package/scripts/init.py +65 -16
package/README.md
CHANGED
|
@@ -40,6 +40,7 @@ Generated files:
|
|
|
40
40
|
- `.agent/workflows`
|
|
41
41
|
- `PROJECT_CONTEXT.md`
|
|
42
42
|
- `CLAUDE.md`
|
|
43
|
+
- `AGENTS.md`
|
|
43
44
|
- `AI_CONTEXT_REFINEMENT.md` when first-session AI refinement is enabled
|
|
44
45
|
|
|
45
46
|
## Scan Behavior
|
|
@@ -73,7 +74,7 @@ If you enable first-session AI refinement, the generated context is marked with:
|
|
|
73
74
|
- `context.status: baseline`
|
|
74
75
|
- `context.needs_ai_refinement: true`
|
|
75
76
|
|
|
76
|
-
Then, when your agent opens the project, `GEMINI.md` / `CLAUDE.md` instruct it to:
|
|
77
|
+
Then, when your agent opens the project, `GEMINI.md` / `CLAUDE.md` / `AGENTS.md` instruct it to:
|
|
77
78
|
|
|
78
79
|
1. Read `PROJECT_CONTEXT.md`
|
|
79
80
|
2. Refine the context once if `needs_ai_refinement` is `true`
|
|
@@ -107,5 +108,5 @@ Generic quality skills such as `clean-code` and `systematic-debugging` are alway
|
|
|
107
108
|
|
|
108
109
|
## Notes
|
|
109
110
|
|
|
110
|
-
- `thachvd-kit`
|
|
111
|
+
- `thachvd-kit` generates both `CLAUDE.md` for Claude Code and `AGENTS.md` for Codex/AGENTS-compatible editors.
|
|
111
112
|
- The npm package page updates only after a new `npm publish`, not just after pushing to GitHub.
|
package/bin/cli.js
CHANGED
|
@@ -942,107 +942,278 @@ ${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.
|
|
956
|
-
#
|
|
957
|
-
|
|
958
|
-
## Project
|
|
959
|
-
${data.description}
|
|
960
|
-
Stack: ${data.primary_language} | ${(data.frameworks || []).join(', ')}
|
|
961
|
-
|
|
958
|
+
# Platform: Claude Code
|
|
959
|
+
|
|
960
|
+
## Project
|
|
961
|
+
${data.description}
|
|
962
|
+
Stack: ${data.primary_language} | ${(data.frameworks || []).join(', ')}
|
|
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
|
|
980
|
-
|
|
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
|
|
982
|
+
|
|
981
983
|
See PROJECT_CONTEXT.md for full agent routing table.
|
|
982
984
|
`;
|
|
983
985
|
}
|
|
984
986
|
|
|
985
|
-
function
|
|
987
|
+
function generateAgentsMd(data) {
|
|
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}
|
|
1047
|
+
|
|
1048
|
+
${data.description}
|
|
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.
|
|
1154
|
+
`;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
function generateAgentsMdRefinementPrompt(data) {
|
|
986
1158
|
const evidence = (data.scan_evidence || []).length > 0
|
|
987
1159
|
? (data.scan_evidence || []).map(line => `- ${line}`).join('\n')
|
|
988
1160
|
: '- No scan evidence was captured during init.';
|
|
989
1161
|
|
|
990
|
-
return `#
|
|
1162
|
+
return `# AGENTS.md Refinement Prompt
|
|
991
1163
|
|
|
992
|
-
|
|
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.
|
|
993
1166
|
|
|
994
|
-
##
|
|
1167
|
+
## Baseline Detected
|
|
995
1168
|
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
- Project: ${data.project_name}
|
|
1001
|
-
- Type: ${data.project_type}
|
|
1002
|
-
- Stack: ${data.primary_language} | ${(data.frameworks || []).join(', ') || 'no framework'}
|
|
1003
|
-
- Database: ${data.database || 'none'}
|
|
1004
|
-
- 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'}
|
|
1005
1173
|
|
|
1006
1174
|
## Scan Evidence
|
|
1007
1175
|
|
|
1008
1176
|
${evidence}
|
|
1009
1177
|
|
|
1010
|
-
##
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
-
|
|
1030
|
-
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
-
|
|
1036
|
-
-
|
|
1037
|
-
-
|
|
1038
|
-
-
|
|
1039
|
-
|
|
1040
|
-
##
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
-
|
|
1044
|
-
-
|
|
1045
|
-
-
|
|
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
|
|
1046
1217
|
`;
|
|
1047
1218
|
}
|
|
1048
1219
|
|
|
@@ -1074,7 +1245,7 @@ async function main() {
|
|
|
1074
1245
|
|
|
1075
1246
|
console.log(pc.bold(pc.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')));
|
|
1076
1247
|
console.log(' ' + pc.bold('thachvd-kit') + ' — Project Init Wizard');
|
|
1077
|
-
console.log(` Generates .
|
|
1248
|
+
console.log(` Generates AGENTS.md${useScan ? ' (scan-assisted)' : ''}`);
|
|
1078
1249
|
console.log(pc.bold(pc.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')) + '\n');
|
|
1079
1250
|
|
|
1080
1251
|
let projectSetup = 'new';
|
|
@@ -1224,86 +1395,46 @@ async function main() {
|
|
|
1224
1395
|
data.scan_evidence = scanned?.scan_evidence || [];
|
|
1225
1396
|
data.app_root = scanned?.app_root || '.';
|
|
1226
1397
|
|
|
1227
|
-
if (!assumeYes) {
|
|
1228
|
-
const aiRefineAnswer = await askQuestions({
|
|
1229
|
-
type: 'confirm',
|
|
1230
|
-
name: 'ai_refine',
|
|
1231
|
-
message: 'Should the agent refine PROJECT_CONTEXT.md on first session start?',
|
|
1232
|
-
initial: useScan
|
|
1233
|
-
});
|
|
1234
|
-
requestAiRefinement = Boolean(aiRefineAnswer.ai_refine);
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
data.context_status = 'baseline';
|
|
1238
|
-
data.needs_ai_refinement = requestAiRefinement;
|
|
1239
|
-
data.last_refined_at = 'not-yet-refined';
|
|
1240
1398
|
data.infrastructure = [];
|
|
1241
1399
|
if (data.uses_docker) data.infrastructure.push('docker');
|
|
1242
1400
|
if (data.cloud !== 'none') data.infrastructure.push(data.cloud);
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
console.log(` ${pc.green('✓')} Copied ${pc.bold(`.agent/${folder}`)}`);
|
|
1261
|
-
} else {
|
|
1262
|
-
console.log(` ${pc.yellow('-')} Source ${folder} not found.`);
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
// Write contexts
|
|
1267
|
-
const projectContextPath = path.join(targetDir, 'PROJECT_CONTEXT.md');
|
|
1268
|
-
fs.writeFileSync(projectContextPath, generateProjectContext(data), 'utf8');
|
|
1269
|
-
console.log(` ${pc.green('✓')} Generated ${pc.bold('PROJECT_CONTEXT.md')}`);
|
|
1270
|
-
|
|
1271
|
-
const claudeMdPath = path.join(targetDir, 'CLAUDE.md');
|
|
1272
|
-
fs.writeFileSync(claudeMdPath, generateClaudeMd(data), 'utf8');
|
|
1273
|
-
console.log(` ${pc.green('✓')} Generated ${pc.bold('CLAUDE.md')}`);
|
|
1274
|
-
|
|
1275
|
-
let aiRefinementPath = null;
|
|
1276
|
-
if (requestAiRefinement) {
|
|
1277
|
-
aiRefinementPath = path.join(targetDir, 'AI_CONTEXT_REFINEMENT.md');
|
|
1278
|
-
fs.writeFileSync(aiRefinementPath, generateAiContextRefinementPrompt(data), 'utf8');
|
|
1279
|
-
console.log(` ${pc.green('✓')} Generated ${pc.bold('AI_CONTEXT_REFINEMENT.md')}`);
|
|
1401
|
+
|
|
1402
|
+
console.log(`\n${pc.bold(pc.cyan('━━ Generating Files ━━'))}`);
|
|
1403
|
+
|
|
1404
|
+
// Write AGENTS.md — the only output file
|
|
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
|
+
}
|
|
1280
1418
|
}
|
|
1281
1419
|
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
${pc.bold('
|
|
1288
|
-
${pc.bold('
|
|
1289
|
-
|
|
1290
|
-
${pc.bold('
|
|
1291
|
-
${autoSkills.map(s => ' · ' + s).join('\n')}
|
|
1292
|
-
|
|
1293
|
-
${pc.bold('Generated files:')}
|
|
1294
|
-
· ${pc.bold(projectContextPath)}
|
|
1295
|
-
· ${pc.bold(claudeMdPath)}
|
|
1296
|
-
${aiRefinementPath ? ` · ${pc.bold(aiRefinementPath)}` : ''}
|
|
1420
|
+
fs.writeFileSync(agentsMdPath, generateAgentsMd(data), 'utf8');
|
|
1421
|
+
console.log(` ${pc.green('✓')} Generated ${pc.bold('AGENTS.md')}`);
|
|
1422
|
+
|
|
1423
|
+
console.log(`\n${pc.bold(pc.green('━━ Done! ━━'))}
|
|
1424
|
+
|
|
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)}
|
|
1297
1429
|
|
|
1298
1430
|
${pc.bold('Next steps:')}
|
|
1299
|
-
1.
|
|
1300
|
-
2.
|
|
1301
|
-
3.
|
|
1302
|
-
4. Open project in Antigravity or Claude Code — 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
|
|
1303
1434
|
`);
|
|
1304
1435
|
}
|
|
1305
|
-
|
|
1306
|
-
main().catch(err => {
|
|
1307
|
-
console.error(pc.red('\nError during init:'), err);
|
|
1308
|
-
process.exit(1);
|
|
1309
|
-
});
|
|
1436
|
+
|
|
1437
|
+
main().catch(err => {
|
|
1438
|
+
console.error(pc.red('\nError during init:'), err);
|
|
1439
|
+
process.exit(1);
|
|
1440
|
+
});
|
package/kit/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# 🛡️
|
|
2
|
-
|
|
3
|
-
This toolkit helps you build high-quality, modular, and performance-optimized applications by leveraging
|
|
1
|
+
# 🛡️ Cross-Platform Project Kit
|
|
2
|
+
|
|
3
|
+
This toolkit helps you build high-quality, modular, and performance-optimized applications by leveraging AI agents with a context-first approach across Antigravity, Claude Code, and Codex-compatible editors.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -11,10 +11,11 @@ This toolkit helps you build high-quality, modular, and performance-optimized ap
|
|
|
11
11
|
- Update project metadata (e.g., `package.json`).
|
|
12
12
|
- Rename and fill out `PROJECT_CONTEXT.template.md` as `PROJECT_CONTEXT.md` in the root directory.
|
|
13
13
|
|
|
14
|
-
### 2. Working with AI Agents
|
|
15
|
-
- Always use the templates provided in `kit/PROMPT_RECIPE.md`.
|
|
16
|
-
- Ensure the Agent reads and updates `PROJECT_CONTEXT.md`.
|
|
17
|
-
-
|
|
14
|
+
### 2. Working with AI Agents
|
|
15
|
+
- Always use the templates provided in `kit/PROMPT_RECIPE.md`.
|
|
16
|
+
- Ensure the Agent reads and updates `PROJECT_CONTEXT.md`.
|
|
17
|
+
- Use `CLAUDE.md` for Claude Code and `AGENTS.md` for Codex when generating project-specific entry files.
|
|
18
|
+
- Enforce file splitting rules (e.g., Max 250 lines) to maintain a clean codebase.
|
|
18
19
|
|
|
19
20
|
### 3. Proposed Structure
|
|
20
21
|
- `.agent/rules/GEMINI.md`: Core behavioral rules and protocols.
|
|
@@ -29,4 +30,4 @@ This toolkit helps you build high-quality, modular, and performance-optimized ap
|
|
|
29
30
|
|
|
30
31
|
---
|
|
31
32
|
|
|
32
|
-
*Powered by
|
|
33
|
+
*Powered by thachvd-kit.*
|
package/package.json
CHANGED
package/rules/GEMINI.md
CHANGED
|
@@ -21,7 +21,7 @@ trigger: always_on
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
> All routing decisions below depend on PROJECT_CONTEXT.md.
|
|
24
|
-
> Without it, ask user to run: `
|
|
24
|
+
> Without it, ask user to run: `thachvd-kit init`
|
|
25
25
|
> Baseline context must be refined once when `context.needs_ai_refinement = true`.
|
|
26
26
|
|
|
27
27
|
---
|
|
@@ -203,7 +203,7 @@ scripts/ → scripts/init.py, checklist.py, verify_all.py
|
|
|
203
203
|
| Platform | Rules File | Skills Dir | Workflows |
|
|
204
204
|
|----------|-----------|-----------|-----------|
|
|
205
205
|
| **Antigravity** | `rules/GEMINI.md` (this file) | `skills/` | `workflows/` |
|
|
206
|
-
| **Claude Code** | `CLAUDE.md` at project root | `.
|
|
207
|
-
| **Codex / OpenCode** | `
|
|
208
|
-
|
|
209
|
-
> Run `
|
|
206
|
+
| **Claude Code** | `CLAUDE.md` at project root | `.agent/skills/` | `.agent/workflows/` |
|
|
207
|
+
| **Codex / OpenCode** | `AGENTS.md` at project root | `.agent/skills/` | `.agent/workflows/` |
|
|
208
|
+
|
|
209
|
+
> Run `thachvd-kit init` to generate project context and platform entry files automatically.
|
package/scripts/init.py
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
thachvd-kit — Project Init Wizard
|
|
4
4
|
Generates PROJECT_CONTEXT.md and optional platform config files.
|
|
5
5
|
|
|
6
|
-
Usage:
|
|
7
|
-
python scripts/init.py # Interactive wizard
|
|
8
|
-
python scripts/init.py --platform all # Also generate CLAUDE.md
|
|
9
|
-
python scripts/init.py --platform claude # Only CLAUDE.md
|
|
6
|
+
Usage:
|
|
7
|
+
python scripts/init.py # Interactive wizard
|
|
8
|
+
python scripts/init.py --platform all # Also generate CLAUDE.md + AGENTS.md
|
|
9
|
+
python scripts/init.py --platform claude # Only CLAUDE.md
|
|
10
|
+
python scripts/init.py --platform codex # Only AGENTS.md
|
|
10
11
|
"""
|
|
11
12
|
|
|
12
13
|
import sys
|
|
@@ -695,14 +696,14 @@ Based on your stack, these skills will be loaded automatically:
|
|
|
695
696
|
"""
|
|
696
697
|
|
|
697
698
|
def generate_claude_md(data):
|
|
698
|
-
"""Generate CLAUDE.md for Claude Code
|
|
699
|
-
return f"""# CLAUDE.md — {data['project_name']}
|
|
700
|
-
# Generated by thachvd-kit. See PROJECT_CONTEXT.md for full stack info.
|
|
701
|
-
#
|
|
702
|
-
|
|
703
|
-
## Project
|
|
704
|
-
{data['description']}
|
|
705
|
-
Stack: {data['primary_language']} | {', '.join(data.get('frameworks', []))}
|
|
699
|
+
"""Generate CLAUDE.md for Claude Code."""
|
|
700
|
+
return f"""# CLAUDE.md — {data['project_name']}
|
|
701
|
+
# Generated by thachvd-kit. See PROJECT_CONTEXT.md for full stack info.
|
|
702
|
+
# Platform: Claude Code
|
|
703
|
+
|
|
704
|
+
## Project
|
|
705
|
+
{data['description']}
|
|
706
|
+
Stack: {data['primary_language']} | {', '.join(data.get('frameworks', []))}
|
|
706
707
|
|
|
707
708
|
## Rules
|
|
708
709
|
- Read PROJECT_CONTEXT.md first for stack details and agent routing.
|
|
@@ -726,6 +727,47 @@ Stack: {data['primary_language']} | {', '.join(data.get('frameworks', []))}
|
|
|
726
727
|
See PROJECT_CONTEXT.md for full agent routing table.
|
|
727
728
|
"""
|
|
728
729
|
|
|
730
|
+
def generate_agents_md(data):
|
|
731
|
+
"""Generate AGENTS.md for Codex and AGENTS-compatible editors."""
|
|
732
|
+
return f"""# AGENTS.md — {data['project_name']}
|
|
733
|
+
# Generated by thachvd-kit. See PROJECT_CONTEXT.md for full stack info.
|
|
734
|
+
# Platform: Codex / AGENTS-compatible editors
|
|
735
|
+
|
|
736
|
+
## Project
|
|
737
|
+
{data['description']}
|
|
738
|
+
Stack: {data['primary_language']} | {', '.join(data.get('frameworks', [])) or 'no framework'}
|
|
739
|
+
|
|
740
|
+
## Mandatory First Action
|
|
741
|
+
- Read `PROJECT_CONTEXT.md` before making plans or code changes.
|
|
742
|
+
- If `PROJECT_CONTEXT.md` is missing or stale, create/update it before major work.
|
|
743
|
+
- If `context.needs_ai_refinement: true`, refine `PROJECT_CONTEXT.md` first, then set:
|
|
744
|
+
- `context.status: refined`
|
|
745
|
+
- `context.needs_ai_refinement: false`
|
|
746
|
+
- `context.last_refined_at: <today>`
|
|
747
|
+
|
|
748
|
+
## Working Rules
|
|
749
|
+
- Use `.agent/agents`, `.agent/skills`, `.agent/rules`, and `.agent/workflows` as the local project kit.
|
|
750
|
+
- Match the task against the Agent Routing table in `PROJECT_CONTEXT.md`.
|
|
751
|
+
- Load relevant skills before editing code.
|
|
752
|
+
- Tests are mandatory. Verify before claiming done.
|
|
753
|
+
- Keep files under {data.get('max_file_lines', '300')} lines when practical, then split into modules.
|
|
754
|
+
- Update dependent files together when a change crosses boundaries.
|
|
755
|
+
|
|
756
|
+
## Preferred Workflow
|
|
757
|
+
- Plan work from `PROJECT_CONTEXT.md` first.
|
|
758
|
+
- For feature work, use: `plan-writing` -> `executing-plans` -> `verification-before-completion`.
|
|
759
|
+
- For reviews, use: `requesting-code-review` / `receiving-code-review`.
|
|
760
|
+
- For debugging, use: `systematic-debugging`.
|
|
761
|
+
|
|
762
|
+
## Key Paths
|
|
763
|
+
- Project context: `PROJECT_CONTEXT.md`
|
|
764
|
+
- Agent kit: `.agent/`
|
|
765
|
+
- Skills: `.agent/skills/`
|
|
766
|
+
- Workflows: `.agent/workflows/`
|
|
767
|
+
|
|
768
|
+
See `PROJECT_CONTEXT.md` for stack details, routing, and auto-resolved skills.
|
|
769
|
+
"""
|
|
770
|
+
|
|
729
771
|
def generate_ai_context_refinement_prompt(data):
|
|
730
772
|
scan_evidence = data.get("scan_evidence", [])
|
|
731
773
|
evidence_block = "\n".join("- " + line for line in scan_evidence) if scan_evidence else "- No scan evidence was captured during init."
|
|
@@ -805,7 +847,7 @@ def format_scan_preview_lines(scanned):
|
|
|
805
847
|
|
|
806
848
|
def main():
|
|
807
849
|
parser = argparse.ArgumentParser(description="thachvd-kit project init wizard")
|
|
808
|
-
parser.add_argument("--platform", choices=["antigravity", "claude", "all"], default="antigravity",
|
|
850
|
+
parser.add_argument("--platform", choices=["antigravity", "claude", "codex", "all"], default="antigravity",
|
|
809
851
|
help="Which platform config to generate (default: antigravity)")
|
|
810
852
|
parser.add_argument("--yes", "-y", action="store_true", help="Use defaults without prompting")
|
|
811
853
|
parser.add_argument("--scan", action="store_true", help="Scan the current project to prefill or auto-generate PROJECT_CONTEXT.md")
|
|
@@ -956,11 +998,17 @@ def main():
|
|
|
956
998
|
output_path.write_text(context_content, encoding="utf-8")
|
|
957
999
|
print(f" {green('✓')} {bold('PROJECT_CONTEXT.md')} generated")
|
|
958
1000
|
|
|
959
|
-
# CLAUDE.md (for Claude Code
|
|
1001
|
+
# CLAUDE.md (for Claude Code)
|
|
960
1002
|
if args.platform in ("claude", "all"):
|
|
961
1003
|
claude_path = Path("CLAUDE.md")
|
|
962
1004
|
claude_path.write_text(generate_claude_md(data), encoding="utf-8")
|
|
963
|
-
print(f" {green('✓')} {bold('CLAUDE.md')} generated (Claude Code
|
|
1005
|
+
print(f" {green('✓')} {bold('CLAUDE.md')} generated (Claude Code)")
|
|
1006
|
+
|
|
1007
|
+
# AGENTS.md (for Codex / AGENTS-compatible editors)
|
|
1008
|
+
if args.platform in ("codex", "all"):
|
|
1009
|
+
agents_path = Path("AGENTS.md")
|
|
1010
|
+
agents_path.write_text(generate_agents_md(data), encoding="utf-8")
|
|
1011
|
+
print(f" {green('✓')} {bold('AGENTS.md')} generated (Codex)")
|
|
964
1012
|
|
|
965
1013
|
ai_refine_path = None
|
|
966
1014
|
if data.get("needs_ai_refinement"):
|
|
@@ -983,6 +1031,7 @@ def main():
|
|
|
983
1031
|
{bold('Generated files:')}
|
|
984
1032
|
· {bold(str(output_path.resolve()))}
|
|
985
1033
|
· {bold(str(Path("CLAUDE.md").resolve())) if args.platform in ("claude", "all") else 'CLAUDE.md not generated for this platform'}
|
|
1034
|
+
· {bold(str(Path("AGENTS.md").resolve())) if args.platform in ("codex", "all") else 'AGENTS.md not generated for this platform'}
|
|
986
1035
|
· {bold(str(ai_refine_path.resolve())) if ai_refine_path else 'AI_CONTEXT_REFINEMENT.md not generated'}
|
|
987
1036
|
|
|
988
1037
|
{bold('Next steps:')}
|
|
@@ -991,7 +1040,7 @@ def main():
|
|
|
991
1040
|
3. Open project in your AI editor (Antigravity / Claude Code / Codex)
|
|
992
1041
|
4. The agent will read PROJECT_CONTEXT.md on session start
|
|
993
1042
|
|
|
994
|
-
{dim(' Tip: Run with --platform all to also generate CLAUDE.md')}
|
|
1043
|
+
{dim(' Tip: Run with --platform all to also generate CLAUDE.md and AGENTS.md')}
|
|
995
1044
|
""")
|
|
996
1045
|
|
|
997
1046
|
if __name__ == "__main__":
|