@laitszkin/apollo-toolkit 4.0.11 → 4.1.0

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.
Files changed (134) hide show
  1. package/AGENTS.md +37 -27
  2. package/CHANGELOG.md +31 -0
  3. package/CLAUDE.md +37 -27
  4. package/README.md +15 -2
  5. package/assets/spec/rg13-1780435029246/test-questions.json +1 -0
  6. package/assets/spec/rg13-1780468345132/test-questions.json +1 -0
  7. package/package.json +3 -3
  8. package/packages/cli/dist/tool-registration.js +1 -0
  9. package/packages/cli/dist/tsconfig.tsbuildinfo +1 -1
  10. package/packages/cli/tool-registration.ts +1 -0
  11. package/packages/tools/architecture/dist/index.js +539 -2
  12. package/packages/tools/architecture/dist/index.test.d.ts +1 -0
  13. package/packages/tools/architecture/dist/index.test.js +229 -0
  14. package/packages/tools/architecture/dist/tsconfig.tsbuildinfo +1 -1
  15. package/packages/tools/architecture/index.test.ts +329 -0
  16. package/packages/tools/architecture/index.ts +607 -5
  17. package/packages/tools/codegraph/dist/index.d.ts +3 -0
  18. package/packages/tools/codegraph/dist/index.js +157 -0
  19. package/packages/tools/codegraph/dist/lib/cg-instance.d.ts +29 -0
  20. package/packages/tools/codegraph/dist/lib/cg-instance.js +59 -0
  21. package/packages/tools/codegraph/dist/lib/cg-instance.test.d.ts +1 -0
  22. package/packages/tools/codegraph/dist/lib/cg-instance.test.js +27 -0
  23. package/packages/tools/codegraph/dist/lib/cmd-explore.d.ts +5 -0
  24. package/packages/tools/codegraph/dist/lib/cmd-explore.js +95 -0
  25. package/packages/tools/codegraph/dist/lib/cmd-explore.test.d.ts +1 -0
  26. package/packages/tools/codegraph/dist/lib/cmd-explore.test.js +133 -0
  27. package/packages/tools/codegraph/dist/lib/cmd-flag-splice.test.d.ts +1 -0
  28. package/packages/tools/codegraph/dist/lib/cmd-flag-splice.test.js +83 -0
  29. package/packages/tools/codegraph/dist/lib/cmd-init.d.ts +5 -0
  30. package/packages/tools/codegraph/dist/lib/cmd-init.js +50 -0
  31. package/packages/tools/codegraph/dist/lib/cmd-init.test.d.ts +1 -0
  32. package/packages/tools/codegraph/dist/lib/cmd-init.test.js +51 -0
  33. package/packages/tools/codegraph/dist/lib/cmd-list-apis.d.ts +5 -0
  34. package/packages/tools/codegraph/dist/lib/cmd-list-apis.js +64 -0
  35. package/packages/tools/codegraph/dist/lib/cmd-list-apis.test.d.ts +1 -0
  36. package/packages/tools/codegraph/dist/lib/cmd-list-apis.test.js +69 -0
  37. package/packages/tools/codegraph/dist/lib/cmd-search.d.ts +5 -0
  38. package/packages/tools/codegraph/dist/lib/cmd-search.js +21 -0
  39. package/packages/tools/codegraph/dist/lib/cmd-search.test.d.ts +1 -0
  40. package/packages/tools/codegraph/dist/lib/cmd-search.test.js +30 -0
  41. package/packages/tools/codegraph/dist/lib/cmd-status.d.ts +4 -0
  42. package/packages/tools/codegraph/dist/lib/cmd-status.js +44 -0
  43. package/packages/tools/codegraph/dist/lib/cmd-status.test.d.ts +1 -0
  44. package/packages/tools/codegraph/dist/lib/cmd-status.test.js +72 -0
  45. package/packages/tools/codegraph/dist/lib/cmd-survey.d.ts +36 -0
  46. package/packages/tools/codegraph/dist/lib/cmd-survey.js +142 -0
  47. package/packages/tools/codegraph/dist/lib/cmd-survey.test.d.ts +1 -0
  48. package/packages/tools/codegraph/dist/lib/cmd-survey.test.js +136 -0
  49. package/packages/tools/codegraph/dist/lib/cmd-sync.d.ts +4 -0
  50. package/packages/tools/codegraph/dist/lib/cmd-sync.js +51 -0
  51. package/packages/tools/codegraph/dist/lib/cmd-sync.test.d.ts +1 -0
  52. package/packages/tools/codegraph/dist/lib/cmd-sync.test.js +30 -0
  53. package/packages/tools/codegraph/dist/lib/cmd-verify.d.ts +4 -0
  54. package/packages/tools/codegraph/dist/lib/cmd-verify.js +134 -0
  55. package/packages/tools/codegraph/dist/lib/cmd-verify.test.d.ts +1 -0
  56. package/packages/tools/codegraph/dist/lib/cmd-verify.test.js +139 -0
  57. package/packages/tools/codegraph/dist/lib/formatter.d.ts +67 -0
  58. package/packages/tools/codegraph/dist/lib/formatter.js +107 -0
  59. package/packages/tools/codegraph/dist/lib/formatter.test.d.ts +1 -0
  60. package/packages/tools/codegraph/dist/lib/formatter.test.js +41 -0
  61. package/packages/tools/codegraph/dist/lib/survey/grouper.d.ts +19 -0
  62. package/packages/tools/codegraph/dist/lib/survey/grouper.js +194 -0
  63. package/packages/tools/codegraph/dist/lib/survey/grouper.test.d.ts +1 -0
  64. package/packages/tools/codegraph/dist/lib/survey/grouper.test.js +62 -0
  65. package/packages/tools/codegraph/dist/lib/survey/scanner.d.ts +31 -0
  66. package/packages/tools/codegraph/dist/lib/survey/scanner.js +50 -0
  67. package/packages/tools/codegraph/dist/lib/verify/checker.d.ts +32 -0
  68. package/packages/tools/codegraph/dist/lib/verify/checker.js +146 -0
  69. package/packages/tools/codegraph/dist/lib/verify/checker.test.d.ts +1 -0
  70. package/packages/tools/codegraph/dist/lib/verify/checker.test.js +128 -0
  71. package/packages/tools/codegraph/dist/tsconfig.tsbuildinfo +1 -0
  72. package/packages/tools/codegraph/env.d.ts +56 -0
  73. package/packages/tools/codegraph/index.ts +173 -0
  74. package/packages/tools/codegraph/lib/cg-instance.test.ts +36 -0
  75. package/packages/tools/codegraph/lib/cg-instance.ts +66 -0
  76. package/packages/tools/codegraph/lib/cmd-explore.test.ts +195 -0
  77. package/packages/tools/codegraph/lib/cmd-explore.ts +129 -0
  78. package/packages/tools/codegraph/lib/cmd-flag-splice.test.ts +94 -0
  79. package/packages/tools/codegraph/lib/cmd-init.test.ts +68 -0
  80. package/packages/tools/codegraph/lib/cmd-init.ts +60 -0
  81. package/packages/tools/codegraph/lib/cmd-list-apis.test.ts +80 -0
  82. package/packages/tools/codegraph/lib/cmd-list-apis.ts +90 -0
  83. package/packages/tools/codegraph/lib/cmd-search.test.ts +37 -0
  84. package/packages/tools/codegraph/lib/cmd-search.ts +32 -0
  85. package/packages/tools/codegraph/lib/cmd-status.test.ts +86 -0
  86. package/packages/tools/codegraph/lib/cmd-status.ts +53 -0
  87. package/packages/tools/codegraph/lib/cmd-survey.test.ts +161 -0
  88. package/packages/tools/codegraph/lib/cmd-survey.ts +199 -0
  89. package/packages/tools/codegraph/lib/cmd-sync.test.ts +41 -0
  90. package/packages/tools/codegraph/lib/cmd-sync.ts +62 -0
  91. package/packages/tools/codegraph/lib/cmd-verify.test.ts +162 -0
  92. package/packages/tools/codegraph/lib/cmd-verify.ts +145 -0
  93. package/packages/tools/codegraph/lib/formatter.test.ts +47 -0
  94. package/packages/tools/codegraph/lib/formatter.ts +130 -0
  95. package/packages/tools/codegraph/lib/survey/grouper.test.ts +72 -0
  96. package/packages/tools/codegraph/lib/survey/grouper.ts +226 -0
  97. package/packages/tools/codegraph/lib/survey/scanner.ts +89 -0
  98. package/packages/tools/codegraph/lib/verify/checker.test.ts +140 -0
  99. package/packages/tools/codegraph/lib/verify/checker.ts +172 -0
  100. package/packages/tools/codegraph/package.json +23 -0
  101. package/packages/tools/codegraph/tsconfig.json +22 -0
  102. package/resources/project-architecture/atlas/atlas.history.log +32 -0
  103. package/resources/project-architecture/atlas/atlas.history.undo.json +356 -28
  104. package/resources/project-architecture/atlas/atlas.history.undo.stack.json +14350 -0
  105. package/resources/project-architecture/atlas/atlas.index.yaml +76 -12
  106. package/resources/project-architecture/atlas/features/codegraph.yaml +95 -0
  107. package/resources/project-architecture/atlas/features/eval-ci-gate.yaml +6 -1
  108. package/resources/project-architecture/atlas/features/eval-cli.yaml +16 -1
  109. package/resources/project-architecture/atlas/features/eval-executor.yaml +12 -2
  110. package/resources/project-architecture/atlas/features/eval-isolation.yaml +6 -1
  111. package/resources/project-architecture/atlas/features/eval-optimizer.yaml +17 -2
  112. package/resources/project-architecture/atlas/features/eval-question.yaml +12 -2
  113. package/resources/project-architecture/atlas/features/eval-reporter.yaml +6 -1
  114. package/resources/project-architecture/atlas/features/eval-scorer.yaml +12 -2
  115. package/resources/project-architecture/features/codegraph/cg-discovery.html +47 -0
  116. package/resources/project-architecture/features/codegraph/cg-lifecycle.html +48 -0
  117. package/resources/project-architecture/features/codegraph/cg-validation.html +47 -0
  118. package/resources/project-architecture/features/codegraph/index.html +58 -0
  119. package/resources/project-architecture/features/eval-ci-gate/workflow-trigger.html +6 -1
  120. package/resources/project-architecture/features/eval-cli/cli-handler.html +8 -1
  121. package/resources/project-architecture/features/eval-executor/exec-api-client.html +6 -1
  122. package/resources/project-architecture/features/eval-executor/trace-recorder.html +6 -1
  123. package/resources/project-architecture/features/eval-isolation/tool-dispatcher.html +6 -1
  124. package/resources/project-architecture/features/eval-optimizer/dedup-engine.html +6 -1
  125. package/resources/project-architecture/features/eval-optimizer/issue-extractor.html +7 -1
  126. package/resources/project-architecture/features/eval-question/question-loader.html +6 -1
  127. package/resources/project-architecture/features/eval-question/variant-generator.html +6 -1
  128. package/resources/project-architecture/features/eval-reporter/report-composer.html +6 -1
  129. package/resources/project-architecture/features/eval-scorer/judge-api-client.html +6 -1
  130. package/resources/project-architecture/features/eval-scorer/judge-prompt-builder.html +6 -1
  131. package/resources/project-architecture/index.html +200 -94
  132. package/skills/design/SKILL.md +33 -0
  133. package/skills/init-project-html/SKILL.md +12 -11
  134. package/tsconfig.json +1 -0
@@ -167,6 +167,10 @@ Each component should link to:
167
167
 
168
168
  #### 5e. Generate the Diff and Validate
169
169
 
170
+ Two alternative workflows — use the **Classic flow** when `codegraph` is not installed, or the **CodeGraph-integrated flow** when it is available.
171
+
172
+ **Classic flow** (manual):
173
+
170
174
  ```bash
171
175
  apltk architecture --spec <spec_dir> render
172
176
  apltk architecture --spec <spec_dir> validate
@@ -178,6 +182,35 @@ Confirm validation passes, then use the diff command to produce a visual compari
178
182
  apltk architecture diff
179
183
  ```
180
184
 
185
+ **New flow (CodeGraph-integrated):**
186
+
187
+ 1. **Survey the existing API landscape**:
188
+ ```bash
189
+ apltk codegraph list-apis --all
190
+ ```
191
+ This returns the full project API directory (function names, file paths, callers) as a reference for integration points. Use this data to understand what existing modules, services, and functions your new feature will interact with.
192
+
193
+ 2. **Fill the proposal skeleton**: Based on your design decisions from steps 5a-5d,
194
+ fill in the `proposal.yaml` file generated by `apltk architecture template`.
195
+ Define the feature, its submodules, their functions, and cross-feature edges.
196
+
197
+ 3. **Apply batch mutations**:
198
+ ```bash
199
+ apltk architecture apply <spec_dir>/architecture_diff/atlas/proposal.yaml --spec <spec_dir>
200
+ ```
201
+ This processes all mutations in one call with undo protection.
202
+
203
+ 4. **Verify correctness**:
204
+ ```bash
205
+ apltk codegraph verify --spec <spec_dir>
206
+ ```
207
+ This confirms every symbol and edge reference in the spec overlay exists in the actual code.
208
+
209
+ 5. **Render and validate** (optional, for visual confirmation):
210
+ ```bash
211
+ apltk architecture diff --spec <spec_dir>
212
+ ```
213
+
181
214
  **Single spec**: Produce one Architecture Diff for one SPEC.md.
182
215
  **Batch spec**: Produce **one** unified Architecture Diff covering all SPEC.md files in the batch.
183
216
 
@@ -52,7 +52,7 @@ At load time, check the project state to select the correct mode:
52
52
 
53
53
  適用模式:design(完整初始化)、record(快速記錄)
54
54
 
55
- ### 1. 閱讀並理解代碼庫 先建立 System Context
55
+ ### 1. 使用 codegraph survey 取得專案結構
56
56
 
57
57
  在深入程式碼前,先建立系統的宏觀認知:
58
58
  - 系統與哪些外部 actor 互動(使用者、第三方服務、其他系統)
@@ -60,18 +60,18 @@ At load time, check the project state to select the correct mode:
60
60
 
61
61
  然後閱讀 `sample-demo/` 了解預期的輸出格式與抽象層級。
62
62
 
63
- 按照功能模塊定義,全面檢索代碼庫。
64
- 將其拆分為單個或多個功能模塊(對應 C4 Container 層級)。
65
- 接著,識別功能模塊下的子模塊(對應 C4 Component 層級),並進行深度閱讀。
63
+ 接著使用 `apltk codegraph survey` 取得專案的結構化調查報告:
64
+ - 專案目錄下的所有檔案清單與函式數量
65
+ - Entry points(被外部檔案呼叫的公開函式)
66
+ - 建議的 submodule 分組與跨邊界 edge
67
+ - 支援 `--json` 輸出供 LLM 程式化消費
66
68
 
67
- 並行調度 subagents,並為每一個功能模塊分配一個 subagent 進行深度閱讀,要求 subagents 完整列出:
68
- - 該功能模塊與其他功能模塊之間是否存在交互;如有,如何交互。
69
- - 該功能模塊內部存在哪些子模塊,這些子模塊之間如何交互並實現功能模塊的功能。
70
- - 該功能模塊及下屬子模塊的資料流、錯誤處理。
69
+ 根據 survey 報告,決定功能模塊的劃分(對應 C4 Container 層級):
70
+ - 將高度互相呼叫的函式群歸類為同一功能模塊的子模塊
71
+ - 識別功能模塊之間的邊界與跨模塊呼叫關係
72
+ - 記錄每個功能模塊對應的目錄路徑與 entry point
71
73
 
72
- > 每個 subagent 回報的每個宣告都應附上對應的程式碼檔案路徑與行號,作為證據追溯的基礎。
73
-
74
- ### 2. 使用 `apltk` cli 工具協助生成架構圖
74
+ ### 2. 使用 `apltk architecture apply` 批次寫入 atlas
75
75
 
76
76
  依照 C4 層級逐步產生:
77
77
  在操作 CLI 前先閱讀 `references/architecture.md` 了解所有參數與 mutation 系列的使用方式。
@@ -81,6 +81,7 @@ At load time, check the project state to select the correct mode:
81
81
  3. **Component 層級**:定義子模塊(submodule)及其內部元素(function、variable、dataflow、error)
82
82
  4. **Code 層級**(選擇性):對關鍵路徑補充函式層級細節
83
83
 
84
+ 使用 `apltk architecture apply <proposal.yaml>` 進行批次 atlas 寫入(取代逐一手動 mutation)。
84
85
  將前一步獲取的代碼庫知識透過 CLI 工具轉化為清晰的架構圖。
85
86
  完成後驗證架構圖格式正確且可渲染。
86
87
 
package/tsconfig.json CHANGED
@@ -21,6 +21,7 @@
21
21
  { "path": "packages/tool-utils" },
22
22
  { "path": "packages/cli" },
23
23
  { "path": "packages/tools/architecture" },
24
+ { "path": "packages/tools/codegraph" },
24
25
  { "path": "packages/tools/eval" },
25
26
  { "path": "packages/tools/create-review-report" },
26
27
  { "path": "packages/tools/create-specs" },