thachvd-kit 1.0.6 → 1.0.7

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 CHANGED
@@ -18,6 +18,7 @@ npx github:thachvd/thachvd-kit init
18
18
  The interactive wizard will first ask whether this is a new project or an existing one.
19
19
  If it is an existing project, it can scan the current codebase to prefill `PROJECT_CONTEXT.md`, or let you enter everything manually.
20
20
  The scan mode uses evidence-based detectors and shows why a framework was inferred, so you can quickly confirm or correct it.
21
+ After init, you can also generate an AI refinement prompt to let your editor/agent deepen the project context.
21
22
 
22
23
  ```bash
23
24
  thachvd-kit init --scan
package/bin/cli.js CHANGED
@@ -842,9 +842,73 @@ Stack: ${data.primary_language} | ${(data.frameworks || []).join(', ')}
842
842
  - \`/test\` — Run test suite
843
843
  - \`/deploy\` — Deploy checklist
844
844
 
845
- See PROJECT_CONTEXT.md for full agent routing table.
846
- `;
847
- }
845
+ See PROJECT_CONTEXT.md for full agent routing table.
846
+ `;
847
+ }
848
+
849
+ function generateAiContextRefinementPrompt(data) {
850
+ const evidence = (data.scan_evidence || []).length > 0
851
+ ? (data.scan_evidence || []).map(line => `- ${line}`).join('\n')
852
+ : '- No scan evidence was captured during init.';
853
+
854
+ return `# AI Context Refinement
855
+
856
+ Use this prompt in your AI editor after \`thachvd-kit init\`.
857
+
858
+ ## Goal
859
+
860
+ Refine \`PROJECT_CONTEXT.md\` so it reflects the real project more accurately than the baseline init scan.
861
+
862
+ ## Current Baseline
863
+
864
+ - Project: ${data.project_name}
865
+ - Type: ${data.project_type}
866
+ - Stack: ${data.primary_language} | ${(data.frameworks || []).join(', ') || 'no framework'}
867
+ - Database: ${data.database || 'none'}
868
+ - Infra: ${(data.infrastructure || []).join(', ') || 'none'}
869
+
870
+ ## Scan Evidence
871
+
872
+ ${evidence}
873
+
874
+ ## Instructions For The AI Agent
875
+
876
+ 1. Read \`PROJECT_CONTEXT.md\` first.
877
+ 2. Inspect the project selectively to improve factual accuracy.
878
+ 3. Prioritize:
879
+ - real database/config detection
880
+ - domain/capability inference
881
+ - architecture notes
882
+ - more accurate auto-resolved skills
883
+ - important project-specific constraints
884
+ 4. Update \`PROJECT_CONTEXT.md\` directly.
885
+ 5. Distinguish facts from inferences when uncertain.
886
+ 6. Do not implement product code in this pass. Only refine project context.
887
+
888
+ ## Suggested Files To Inspect
889
+
890
+ - Root manifests: \`package.json\`, \`composer.json\`, \`Cargo.toml\`, \`pyproject.toml\`
891
+ - Infrastructure/config: Docker, CI, env, framework config files
892
+ - Database config and models
893
+ - Main app entry points, routing, controllers/services
894
+ - README and existing documentation
895
+
896
+ ## Desired Improvements
897
+
898
+ - Correct the \`database\` field if config files reveal the real DB.
899
+ - Add architecture notes that explain the actual structure.
900
+ - Infer domain capabilities such as scraping, browser automation, external API integrations, queues, workers, etc.
901
+ - Expand auto-resolved skills when there is clear evidence in the codebase.
902
+ - Add caveats or assumptions if parts of the stack are still uncertain.
903
+
904
+ ## Completion Standard
905
+
906
+ When done, summarize:
907
+ - what was corrected
908
+ - what is still inferred
909
+ - which files provided the strongest evidence
910
+ `;
911
+ }
848
912
 
849
913
  // --- Main CLI ---
850
914
 
@@ -925,6 +989,7 @@ async function main() {
925
989
 
926
990
  const scanned = useScan ? scanProject() : null;
927
991
  let reviewScannedFields = !useScan;
992
+ let requestAiRefinement = false;
928
993
 
929
994
  if (useScan) {
930
995
  console.log(`${pc.bold(' Scan result:')} ${scanned.primary_language} | ${scanned.frameworks.join(', ') || 'no framework'}`);
@@ -1052,9 +1117,26 @@ async function main() {
1052
1117
  const claudeMdPath = path.join(targetDir, 'CLAUDE.md');
1053
1118
  fs.writeFileSync(claudeMdPath, generateClaudeMd(data), 'utf8');
1054
1119
  console.log(` ${pc.green('✓')} Generated ${pc.bold('CLAUDE.md')}`);
1055
-
1056
- // Summary
1057
- const autoSkills = resolveSkills(data);
1120
+
1121
+ if (!assumeYes) {
1122
+ const aiRefineAnswer = await askQuestions({
1123
+ type: 'confirm',
1124
+ name: 'ai_refine',
1125
+ message: 'Do you want an AI refinement prompt for PROJECT_CONTEXT.md?',
1126
+ initial: useScan
1127
+ });
1128
+ requestAiRefinement = Boolean(aiRefineAnswer.ai_refine);
1129
+ }
1130
+
1131
+ let aiRefinementPath = null;
1132
+ if (requestAiRefinement) {
1133
+ aiRefinementPath = path.join(targetDir, 'AI_CONTEXT_REFINEMENT.md');
1134
+ fs.writeFileSync(aiRefinementPath, generateAiContextRefinementPrompt(data), 'utf8');
1135
+ console.log(` ${pc.green('✓')} Generated ${pc.bold('AI_CONTEXT_REFINEMENT.md')}`);
1136
+ }
1137
+
1138
+ // Summary
1139
+ const autoSkills = resolveSkills(data);
1058
1140
  console.log(`\n${pc.bold(pc.green('━━ Done! ━━'))}
1059
1141
 
1060
1142
  ${pc.bold('Project:')} ${data.project_name}
@@ -1067,11 +1149,12 @@ ${autoSkills.map(s => ' · ' + s).join('\n')}
1067
1149
  ${pc.bold('Generated files:')}
1068
1150
  · ${pc.bold(projectContextPath)}
1069
1151
  · ${pc.bold(claudeMdPath)}
1152
+ ${aiRefinementPath ? ` · ${pc.bold(aiRefinementPath)}` : ''}
1070
1153
 
1071
1154
  ${pc.bold('Next steps:')}
1072
1155
  1. Your kit is installed in ${pc.bold('./.agent')}
1073
1156
  2. Review ${pc.bold('PROJECT_CONTEXT.md')} first and add architecture notes
1074
- 3. Instruct the agent to read/update ${pc.bold('PROJECT_CONTEXT.md')} before major tasks
1157
+ 3. ${aiRefinementPath ? `Open ${pc.bold('AI_CONTEXT_REFINEMENT.md')} in your AI editor to refine project context` : `Instruct the agent to read/update ${pc.bold('PROJECT_CONTEXT.md')} before major tasks`}
1075
1158
  4. Open project in Antigravity or Claude Code — the agent will read context on start
1076
1159
  `);
1077
1160
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thachvd-kit",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Universal Agent Kit for Antigravity, Claude Code, and OpenCode",
5
5
  "bin": {
6
6
  "thachvd-kit": "./bin/cli.js"
package/scripts/init.py CHANGED
@@ -607,7 +607,7 @@ Based on your stack, these skills will be loaded automatically:
607
607
  {data.get('known_issues', '<!-- Add known issues or pending tasks -->')}
608
608
  """
609
609
 
610
- def generate_claude_md(data):
610
+ def generate_claude_md(data):
611
611
  """Generate CLAUDE.md for Claude Code / Codex compatibility."""
612
612
  return f"""# CLAUDE.md — {data['project_name']}
613
613
  # Generated by thachvd-kit. See PROJECT_CONTEXT.md for full stack info.
@@ -636,8 +636,69 @@ Stack: {data['primary_language']} | {', '.join(data.get('frameworks', []))}
636
636
  - `/test` — Run test suite
637
637
  - `/deploy` — Deploy checklist
638
638
 
639
- See PROJECT_CONTEXT.md for full agent routing table.
640
- """
639
+ See PROJECT_CONTEXT.md for full agent routing table.
640
+ """
641
+
642
+ def generate_ai_context_refinement_prompt(data):
643
+ scan_evidence = data.get("scan_evidence", [])
644
+ evidence_block = "\n".join("- " + line for line in scan_evidence) if scan_evidence else "- No scan evidence was captured during init."
645
+ return f"""# AI Context Refinement
646
+
647
+ Use this prompt in your AI editor after `thachvd-kit init`.
648
+
649
+ ## Goal
650
+
651
+ Refine `PROJECT_CONTEXT.md` so it reflects the real project more accurately than the baseline init scan.
652
+
653
+ ## Current Baseline
654
+
655
+ - Project: {data['project_name']}
656
+ - Type: {data['project_type']}
657
+ - Stack: {data['primary_language']} | {', '.join(data.get('frameworks', [])) or 'no framework'}
658
+ - Database: {data.get('database', 'none')}
659
+ - Infra: {', '.join(data.get('infrastructure', [])) or 'none'}
660
+
661
+ ## Scan Evidence
662
+
663
+ {evidence_block}
664
+
665
+ ## Instructions For The AI Agent
666
+
667
+ 1. Read `PROJECT_CONTEXT.md` first.
668
+ 2. Inspect the project selectively to improve factual accuracy.
669
+ 3. Prioritize:
670
+ - real database/config detection
671
+ - domain/capability inference
672
+ - architecture notes
673
+ - more accurate auto-resolved skills
674
+ - important project-specific constraints
675
+ 4. Update `PROJECT_CONTEXT.md` directly.
676
+ 5. Distinguish facts from inferences when uncertain.
677
+ 6. Do not implement product code in this pass. Only refine project context.
678
+
679
+ ## Suggested Files To Inspect
680
+
681
+ - Root manifests: `package.json`, `composer.json`, `Cargo.toml`, `pyproject.toml`
682
+ - Infrastructure/config: Docker, CI, env, framework config files
683
+ - Database config and models
684
+ - Main app entry points, routing, controllers/services
685
+ - README and existing documentation
686
+
687
+ ## Desired Improvements
688
+
689
+ - Correct the `database` field if config files reveal the real DB.
690
+ - Add architecture notes that explain the actual structure.
691
+ - Infer domain capabilities such as scraping, browser automation, external API integrations, queues, workers, etc.
692
+ - Expand auto-resolved skills when there is clear evidence in the codebase.
693
+ - Add caveats or assumptions if parts of the stack are still uncertain.
694
+
695
+ ## Completion Standard
696
+
697
+ When done, summarize:
698
+ - what was corrected
699
+ - what is still inferred
700
+ - which files provided the strongest evidence
701
+ """
641
702
 
642
703
  # ─── Main wizard ─────────────────────────────────────────────────────────────
643
704
 
@@ -788,11 +849,17 @@ def main():
788
849
  # CLAUDE.md (for Claude Code / Codex)
789
850
  if args.platform in ("claude", "all"):
790
851
  claude_path = Path("CLAUDE.md")
791
- claude_path.write_text(generate_claude_md(data), encoding="utf-8")
792
- print(f" {green('✓')} {bold('CLAUDE.md')} generated (Claude Code / Codex)")
793
-
794
- # Summary
795
- auto_skills = resolve_skills(data)
852
+ claude_path.write_text(generate_claude_md(data), encoding="utf-8")
853
+ print(f" {green('✓')} {bold('CLAUDE.md')} generated (Claude Code / Codex)")
854
+
855
+ ai_refine_path = None
856
+ if not args.yes and ask_bool("Generate AI context refinement prompt?", default=use_scan):
857
+ ai_refine_path = Path("AI_CONTEXT_REFINEMENT.md")
858
+ ai_refine_path.write_text(generate_ai_context_refinement_prompt(data), encoding="utf-8")
859
+ print(f" {green('✓')} {bold('AI_CONTEXT_REFINEMENT.md')} generated")
860
+
861
+ # Summary
862
+ auto_skills = resolve_skills(data)
796
863
  print(f"""
797
864
  {bold(green('━━ Done! ━━'))}
798
865
 
@@ -806,10 +873,11 @@ def main():
806
873
  {bold('Generated files:')}
807
874
  · {bold(str(output_path.resolve()))}
808
875
  · {bold(str(Path("CLAUDE.md").resolve())) if args.platform in ("claude", "all") else 'CLAUDE.md not generated for this platform'}
876
+ · {bold(str(ai_refine_path.resolve())) if ai_refine_path else 'AI_CONTEXT_REFINEMENT.md not generated'}
809
877
 
810
878
  {bold('Next steps:')}
811
879
  1. Review {bold('PROJECT_CONTEXT.md')} first and add architecture notes
812
- 2. Instruct the agent to read/update {bold('PROJECT_CONTEXT.md')} before major tasks
880
+ 2. {"Open " + bold("AI_CONTEXT_REFINEMENT.md") + " in your AI editor to refine project context" if ai_refine_path else "Instruct the agent to read/update " + bold("PROJECT_CONTEXT.md") + " before major tasks"}
813
881
  3. Open project in your AI editor (Antigravity / Claude Code / Codex)
814
882
  4. The agent will read PROJECT_CONTEXT.md on session start
815
883