claude-code-workflow 6.1.4 → 6.2.2

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 (437) hide show
  1. package/.claude/CLAUDE.md +10 -0
  2. package/.claude/agents/action-planning-agent.md +857 -778
  3. package/.claude/agents/cli-execution-agent.md +266 -269
  4. package/.claude/agents/cli-explore-agent.md +2 -2
  5. package/.claude/agents/cli-lite-planning-agent.md +142 -92
  6. package/.claude/agents/cli-planning-agent.md +4 -4
  7. package/.claude/agents/code-developer.md +7 -6
  8. package/.claude/agents/conceptual-planning-agent.md +2 -2
  9. package/.claude/agents/context-search-agent.md +31 -32
  10. package/.claude/agents/doc-generator.md +4 -4
  11. package/.claude/agents/memory-bridge.md +93 -93
  12. package/.claude/agents/test-context-search-agent.md +8 -7
  13. package/.claude/agents/test-fix-agent.md +7 -6
  14. package/.claude/commands/clean.md +516 -0
  15. package/.claude/commands/memory/compact.md +383 -0
  16. package/.claude/commands/memory/docs-full-cli.md +471 -471
  17. package/.claude/commands/memory/docs-related-cli.md +386 -386
  18. package/.claude/commands/memory/docs.md +615 -615
  19. package/.claude/commands/memory/load.md +5 -5
  20. package/.claude/commands/memory/tech-research-rules.md +310 -0
  21. package/.claude/commands/memory/update-full.md +332 -332
  22. package/.claude/commands/memory/workflow-skill-memory.md +4 -4
  23. package/.claude/commands/task/create.md +151 -151
  24. package/.claude/commands/version.md +254 -254
  25. package/.claude/commands/workflow/brainstorm/api-designer.md +587 -585
  26. package/.claude/commands/workflow/brainstorm/artifacts.md +1 -0
  27. package/.claude/commands/workflow/brainstorm/auto-parallel.md +443 -443
  28. package/.claude/commands/workflow/brainstorm/data-architect.md +220 -220
  29. package/.claude/commands/workflow/brainstorm/product-manager.md +200 -200
  30. package/.claude/commands/workflow/brainstorm/product-owner.md +200 -200
  31. package/.claude/commands/workflow/brainstorm/scrum-master.md +200 -200
  32. package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +200 -200
  33. package/.claude/commands/workflow/brainstorm/system-architect.md +389 -387
  34. package/.claude/commands/workflow/brainstorm/ui-designer.md +221 -221
  35. package/.claude/commands/workflow/brainstorm/ux-expert.md +221 -221
  36. package/.claude/commands/workflow/debug.md +321 -0
  37. package/.claude/commands/workflow/execute.md +13 -0
  38. package/.claude/commands/workflow/init.md +165 -164
  39. package/.claude/commands/workflow/lite-execute.md +119 -13
  40. package/.claude/commands/workflow/lite-fix.md +623 -621
  41. package/.claude/commands/workflow/lite-plan.md +610 -592
  42. package/.claude/commands/workflow/plan.md +5 -5
  43. package/.claude/commands/workflow/review-module-cycle.md +2 -0
  44. package/.claude/commands/workflow/review-session-cycle.md +2 -0
  45. package/.claude/commands/workflow/review.md +297 -291
  46. package/.claude/commands/workflow/session/complete.md +153 -500
  47. package/.claude/commands/workflow/session/list.md +95 -95
  48. package/.claude/commands/workflow/session/resume.md +60 -60
  49. package/.claude/commands/workflow/session/start.md +199 -199
  50. package/.claude/commands/workflow/tdd-plan.md +3 -3
  51. package/.claude/commands/workflow/tdd-verify.md +23 -9
  52. package/.claude/commands/workflow/test-cycle-execute.md +2 -0
  53. package/.claude/commands/workflow/test-fix-gen.md +699 -699
  54. package/.claude/commands/workflow/tools/conflict-resolution.md +104 -18
  55. package/.claude/commands/workflow/tools/context-gather.md +436 -434
  56. package/.claude/commands/workflow/tools/task-generate-agent.md +490 -291
  57. package/.claude/commands/workflow/tools/task-generate-tdd.md +18 -10
  58. package/.claude/commands/workflow/tools/test-concept-enhanced.md +2 -1
  59. package/.claude/commands/workflow/tools/test-context-gather.md +1 -0
  60. package/.claude/commands/workflow/tools/test-task-generate.md +1 -0
  61. package/.claude/commands/workflow/ui-design/import-from-code.md +9 -6
  62. package/.claude/skills/command-guide/SKILL.md +5 -5
  63. package/.claude/skills/command-guide/index/all-commands.json +1 -1
  64. package/.claude/skills/command-guide/index/by-category.json +1 -1
  65. package/.claude/skills/command-guide/index/by-use-case.json +1 -1
  66. package/.claude/skills/command-guide/reference/agents/action-planning-agent.md +857 -778
  67. package/.claude/skills/command-guide/reference/agents/cli-execution-agent.md +266 -269
  68. package/.claude/skills/command-guide/reference/agents/cli-explore-agent.md +2 -2
  69. package/.claude/skills/command-guide/reference/agents/cli-lite-planning-agent.md +142 -92
  70. package/.claude/skills/command-guide/reference/agents/cli-planning-agent.md +4 -4
  71. package/.claude/skills/command-guide/reference/agents/code-developer.md +7 -6
  72. package/.claude/skills/command-guide/reference/agents/conceptual-planning-agent.md +2 -2
  73. package/.claude/skills/command-guide/reference/agents/context-search-agent.md +31 -32
  74. package/.claude/skills/command-guide/reference/agents/doc-generator.md +4 -4
  75. package/.claude/skills/command-guide/reference/agents/memory-bridge.md +93 -93
  76. package/.claude/skills/command-guide/reference/agents/test-context-search-agent.md +8 -7
  77. package/.claude/skills/command-guide/reference/agents/test-fix-agent.md +7 -6
  78. package/.claude/skills/command-guide/reference/commands/memory/docs-full-cli.md +471 -471
  79. package/.claude/skills/command-guide/reference/commands/memory/docs-related-cli.md +386 -386
  80. package/.claude/skills/command-guide/reference/commands/memory/docs.md +17 -16
  81. package/.claude/skills/command-guide/reference/commands/memory/load.md +5 -5
  82. package/.claude/skills/command-guide/reference/commands/memory/tech-research.md +194 -357
  83. package/.claude/skills/command-guide/reference/commands/memory/update-full.md +332 -332
  84. package/.claude/skills/command-guide/reference/commands/memory/workflow-skill-memory.md +4 -4
  85. package/.claude/skills/command-guide/reference/commands/task/create.md +151 -151
  86. package/.claude/skills/command-guide/reference/commands/version.md +254 -254
  87. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/api-designer.md +585 -585
  88. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/auto-parallel.md +443 -443
  89. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/data-architect.md +220 -220
  90. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-manager.md +200 -200
  91. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-owner.md +200 -200
  92. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/scrum-master.md +200 -200
  93. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/subject-matter-expert.md +200 -200
  94. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/system-architect.md +387 -387
  95. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ui-designer.md +221 -221
  96. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ux-expert.md +221 -221
  97. package/.claude/skills/command-guide/reference/commands/workflow/execute.md +25 -20
  98. package/.claude/skills/command-guide/reference/commands/workflow/init.md +164 -164
  99. package/.claude/skills/command-guide/reference/commands/workflow/lite-execute.md +748 -686
  100. package/.claude/skills/command-guide/reference/commands/workflow/lite-fix.md +664 -621
  101. package/.claude/skills/command-guide/reference/commands/workflow/lite-plan.md +645 -592
  102. package/.claude/skills/command-guide/reference/commands/workflow/plan.md +5 -5
  103. package/.claude/skills/command-guide/reference/commands/workflow/review.md +25 -18
  104. package/.claude/skills/command-guide/reference/commands/workflow/session/complete.md +547 -500
  105. package/.claude/skills/command-guide/reference/commands/workflow/session/list.md +45 -27
  106. package/.claude/skills/command-guide/reference/commands/workflow/session/resume.md +35 -19
  107. package/.claude/skills/command-guide/reference/commands/workflow/session/start.md +90 -33
  108. package/.claude/skills/command-guide/reference/commands/workflow/tdd-plan.md +3 -3
  109. package/.claude/skills/command-guide/reference/commands/workflow/tdd-verify.md +23 -9
  110. package/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md +699 -699
  111. package/.claude/skills/command-guide/reference/commands/workflow/tools/conflict-resolution.md +103 -17
  112. package/.claude/skills/command-guide/reference/commands/workflow/tools/context-gather.md +434 -434
  113. package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-agent.md +487 -291
  114. package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-tdd.md +17 -10
  115. package/.claude/skills/command-guide/reference/commands/workflow/tools/test-concept-enhanced.md +1 -1
  116. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/import-from-code.md +6 -6
  117. package/.claude/workflows/chinese-response.md +38 -0
  118. package/.claude/workflows/cli-templates/prompts/rules/rule-api.txt +122 -0
  119. package/.claude/workflows/cli-templates/prompts/rules/rule-components.txt +122 -0
  120. package/.claude/workflows/cli-templates/prompts/rules/rule-config.txt +89 -0
  121. package/.claude/workflows/cli-templates/prompts/rules/rule-core.txt +60 -0
  122. package/.claude/workflows/cli-templates/prompts/rules/rule-patterns.txt +70 -0
  123. package/.claude/workflows/cli-templates/prompts/rules/rule-testing.txt +81 -0
  124. package/.claude/workflows/cli-templates/prompts/rules/tech-rules-agent-prompt.txt +89 -0
  125. package/.claude/workflows/cli-templates/prompts/workflow/gemini-solution-design.txt +131 -131
  126. package/.claude/workflows/cli-templates/prompts/workflow/skill-conflict-patterns.txt +5 -9
  127. package/.claude/workflows/cli-templates/prompts/workflow/skill-lessons-learned.txt +5 -9
  128. package/.claude/workflows/cli-templates/protocols/analysis-protocol.md +112 -0
  129. package/.claude/workflows/cli-templates/protocols/write-protocol.md +201 -0
  130. package/.claude/workflows/cli-templates/schemas/conflict-resolution-schema.json +137 -0
  131. package/.claude/workflows/cli-templates/schemas/debug-log-json-schema.json +127 -0
  132. package/.claude/workflows/cli-templates/schemas/fix-plan-json-schema.json +25 -0
  133. package/.claude/workflows/cli-templates/schemas/plan-json-schema.json +25 -0
  134. package/.claude/workflows/cli-tools-usage.md +526 -0
  135. package/{CLAUDE.md → .claude/workflows/coding-philosophy.md} +24 -45
  136. package/.claude/workflows/context-tools.md +84 -0
  137. package/.claude/workflows/file-modification.md +64 -0
  138. package/.claude/workflows/tool-strategy.md +216 -79
  139. package/.claude/workflows/windows-platform.md +16 -0
  140. package/.claude/workflows/workflow-architecture.md +942 -942
  141. package/.codex/AGENTS.md +63 -330
  142. package/.codex/prompts/debug.md +318 -0
  143. package/.codex/prompts/execute.md +273 -0
  144. package/.codex/prompts/lite-execute.md +164 -0
  145. package/.codex/prompts/lite-plan.md +469 -0
  146. package/.codex/prompts.zip +0 -0
  147. package/.gemini/GEMINI.md +25 -164
  148. package/.qwen/QWEN.md +0 -139
  149. package/README.md +29 -9
  150. package/ccw/README.md +30 -6
  151. package/ccw/bin/ccw-mcp.js +7 -0
  152. package/ccw/bin/ccw.js +9 -9
  153. package/ccw/package.json +65 -47
  154. package/ccw/src/.workflow/.cli-history/history.db +0 -0
  155. package/ccw/src/.workflow/.cli-history/history.db-shm +0 -0
  156. package/ccw/src/.workflow/.cli-history/history.db-wal +0 -0
  157. package/ccw/src/cli.ts +244 -0
  158. package/ccw/src/commands/cli.ts +740 -0
  159. package/ccw/src/commands/core-memory.ts +770 -0
  160. package/ccw/src/commands/hook.ts +315 -0
  161. package/ccw/src/commands/install.ts +519 -0
  162. package/ccw/src/commands/{list.js → list.ts} +1 -1
  163. package/ccw/src/commands/memory.ts +1090 -0
  164. package/ccw/src/commands/{serve.js → serve.ts} +14 -5
  165. package/ccw/src/commands/session-path-resolver.ts +372 -0
  166. package/ccw/src/commands/session.ts +1141 -0
  167. package/ccw/src/commands/{stop.js → stop.ts} +16 -6
  168. package/ccw/src/commands/tool.ts +201 -0
  169. package/ccw/src/commands/{uninstall.js → uninstall.ts} +89 -40
  170. package/ccw/src/commands/{upgrade.js → upgrade.ts} +68 -23
  171. package/ccw/src/commands/{view.js → view.ts} +22 -8
  172. package/ccw/src/config/storage-paths.ts +670 -0
  173. package/ccw/src/core/cache-manager.ts +294 -0
  174. package/ccw/src/core/claude-freshness.ts +319 -0
  175. package/ccw/src/core/core-memory-store.ts +1528 -0
  176. package/ccw/src/core/{dashboard-generator-patch.js → dashboard-generator-patch.ts} +18 -0
  177. package/ccw/src/core/{dashboard-generator.js → dashboard-generator.ts} +69 -12
  178. package/ccw/src/core/data-aggregator.ts +584 -0
  179. package/ccw/src/core/history-importer.ts +625 -0
  180. package/ccw/src/core/{lite-scanner.js → lite-scanner-complete.ts} +162 -66
  181. package/ccw/src/core/lite-scanner.ts +469 -0
  182. package/ccw/src/core/{manifest.js → manifest.ts} +104 -34
  183. package/ccw/src/core/memory-embedder-bridge.ts +262 -0
  184. package/ccw/src/core/memory-store.ts +978 -0
  185. package/ccw/src/core/routes/ccw-routes.ts +96 -0
  186. package/ccw/src/core/routes/claude-routes.ts +1183 -0
  187. package/ccw/src/core/routes/cli-routes.ts +561 -0
  188. package/ccw/src/core/routes/codexlens-routes.ts +806 -0
  189. package/ccw/src/core/routes/core-memory-routes.ts +605 -0
  190. package/ccw/src/core/routes/files-routes.ts +428 -0
  191. package/ccw/src/core/routes/graph-routes.md +164 -0
  192. package/ccw/src/core/routes/graph-routes.ts +626 -0
  193. package/ccw/src/core/routes/help-routes.ts +308 -0
  194. package/ccw/src/core/routes/hooks-routes.ts +405 -0
  195. package/ccw/src/core/routes/mcp-routes.ts +1271 -0
  196. package/ccw/src/core/routes/mcp-routes.ts.backup +550 -0
  197. package/ccw/src/core/routes/mcp-templates-db.ts +268 -0
  198. package/ccw/src/core/routes/memory-routes.ts +1206 -0
  199. package/ccw/src/core/routes/rules-routes.ts +526 -0
  200. package/ccw/src/core/routes/session-routes.ts +467 -0
  201. package/ccw/src/core/routes/skills-routes.ts +599 -0
  202. package/ccw/src/core/routes/status-routes.ts +57 -0
  203. package/ccw/src/core/routes/system-routes.ts +427 -0
  204. package/ccw/src/core/server.ts +431 -0
  205. package/ccw/src/core/session-clustering-service.ts +1258 -0
  206. package/ccw/src/core/session-scanner.ts +283 -0
  207. package/ccw/src/core/websocket.ts +190 -0
  208. package/ccw/src/{index.js → index.ts} +1 -0
  209. package/ccw/src/mcp-server/index.ts +186 -0
  210. package/ccw/src/templates/assets/css/github-dark.min.css +10 -0
  211. package/ccw/src/templates/assets/css/github.min.css +10 -0
  212. package/ccw/src/templates/assets/js/cytoscape.min.js +32 -0
  213. package/ccw/src/templates/assets/js/d3.min.js +2 -0
  214. package/ccw/src/templates/assets/js/highlight.min.js +1244 -0
  215. package/ccw/src/templates/assets/js/lucide.min.js +12 -0
  216. package/ccw/src/templates/assets/js/marked.min.js +69 -0
  217. package/ccw/src/templates/assets/js/tailwind.js +83 -0
  218. package/ccw/src/templates/dashboard-css/01-base.css +11 -0
  219. package/ccw/src/templates/dashboard-css/02-session.css +22 -0
  220. package/ccw/src/templates/dashboard-css/04-lite-tasks.css +10 -0
  221. package/ccw/src/templates/dashboard-css/06-cards.css +10 -4
  222. package/ccw/src/templates/dashboard-css/07-managers.css +1178 -7
  223. package/ccw/src/templates/dashboard-css/09-explorer.css +23 -12
  224. package/ccw/src/templates/dashboard-css/10-cli-status.css +337 -0
  225. package/ccw/src/templates/dashboard-css/11-cli-history.css +271 -0
  226. package/ccw/src/templates/dashboard-css/12-cli-legacy.css +796 -0
  227. package/ccw/src/templates/dashboard-css/13-cli-ccw.css +199 -0
  228. package/ccw/src/templates/dashboard-css/14-cli-modals.css +258 -0
  229. package/ccw/src/templates/dashboard-css/15-cli-endpoints.css +305 -0
  230. package/ccw/src/templates/dashboard-css/16-cli-session.css +241 -0
  231. package/ccw/src/templates/dashboard-css/17-cli-conversation.css +283 -0
  232. package/ccw/src/templates/dashboard-css/18-cli-settings.css +160 -0
  233. package/ccw/src/templates/dashboard-css/19-cli-native-session.css +496 -0
  234. package/ccw/src/templates/dashboard-css/20-cli-taskqueue.css +188 -0
  235. package/ccw/src/templates/dashboard-css/21-cli-toolmgmt.css +310 -0
  236. package/ccw/src/templates/dashboard-css/22-cli-semantic.css +240 -0
  237. package/ccw/src/templates/dashboard-css/23-memory.css +2390 -0
  238. package/ccw/src/templates/dashboard-css/24-prompt-history.css +1089 -0
  239. package/ccw/src/templates/dashboard-css/25-skills-rules.css +326 -0
  240. package/ccw/src/templates/dashboard-css/26-claude-manager.css +908 -0
  241. package/ccw/src/templates/dashboard-css/27-graph-explorer.css +1678 -0
  242. package/ccw/src/templates/dashboard-css/28-mcp-manager.css +748 -0
  243. package/ccw/src/templates/dashboard-css/29-help.css +264 -0
  244. package/ccw/src/templates/dashboard-css/30-core-memory.css +1700 -0
  245. package/ccw/src/templates/dashboard-js/api.js +162 -142
  246. package/ccw/src/templates/dashboard-js/components/carousel.js +4 -4
  247. package/ccw/src/templates/dashboard-js/components/cli-history.js +876 -0
  248. package/ccw/src/templates/dashboard-js/components/cli-status.js +978 -0
  249. package/ccw/src/templates/dashboard-js/components/global-notifications.js +508 -219
  250. package/ccw/src/templates/dashboard-js/components/hook-manager.js +1277 -282
  251. package/ccw/src/templates/dashboard-js/components/index-manager.js +302 -0
  252. package/ccw/src/templates/dashboard-js/components/mcp-manager.js +718 -27
  253. package/ccw/src/templates/dashboard-js/components/modals.js +66 -0
  254. package/ccw/src/templates/dashboard-js/components/navigation.js +80 -12
  255. package/ccw/src/templates/dashboard-js/components/notifications.js +758 -194
  256. package/ccw/src/templates/dashboard-js/components/storage-manager.js +478 -0
  257. package/ccw/src/templates/dashboard-js/components/tabs-other.js +157 -6
  258. package/ccw/src/templates/dashboard-js/components/task-queue-sidebar.js +716 -0
  259. package/ccw/src/templates/dashboard-js/help-i18n.js +272 -0
  260. package/ccw/src/templates/dashboard-js/i18n.js +2807 -0
  261. package/ccw/src/templates/dashboard-js/main.js +15 -0
  262. package/ccw/src/templates/dashboard-js/state.js +243 -42
  263. package/ccw/src/templates/dashboard-js/utils.js +47 -1
  264. package/ccw/src/templates/dashboard-js/views/claude-manager.js +912 -0
  265. package/ccw/src/templates/dashboard-js/views/cli-manager.js +2272 -0
  266. package/ccw/src/templates/dashboard-js/views/codexlens-manager.js +964 -0
  267. package/ccw/src/templates/dashboard-js/views/core-memory-clusters.js +503 -0
  268. package/ccw/src/templates/dashboard-js/views/core-memory.js +782 -0
  269. package/ccw/src/templates/dashboard-js/views/explorer.js +888 -852
  270. package/ccw/src/templates/dashboard-js/views/graph-explorer.js +1157 -0
  271. package/ccw/src/templates/dashboard-js/views/help.js +856 -0
  272. package/ccw/src/templates/dashboard-js/views/history.js +337 -0
  273. package/ccw/src/templates/dashboard-js/views/home.js +61 -15
  274. package/ccw/src/templates/dashboard-js/views/hook-manager.js +311 -43
  275. package/ccw/src/templates/dashboard-js/views/lite-tasks.js +204 -28
  276. package/ccw/src/templates/dashboard-js/views/mcp-manager.js +2187 -411
  277. package/ccw/src/templates/dashboard-js/views/mcp-manager.js.backup +1729 -0
  278. package/ccw/src/templates/dashboard-js/views/mcp-manager.js.new +928 -0
  279. package/ccw/src/templates/dashboard-js/views/memory.js +1221 -0
  280. package/ccw/src/templates/dashboard-js/views/prompt-history.js +713 -0
  281. package/ccw/src/templates/dashboard-js/views/rules-manager.js +828 -0
  282. package/ccw/src/templates/dashboard-js/views/session-detail.js +54 -53
  283. package/ccw/src/templates/dashboard-js/views/skills-manager.js +819 -0
  284. package/ccw/src/templates/dashboard.html +185 -85
  285. package/ccw/src/templates/hooks-config-example.json +60 -0
  286. package/ccw/src/tools/classify-folders.ts +245 -0
  287. package/ccw/src/tools/cli-config-manager.ts +268 -0
  288. package/ccw/src/tools/cli-executor.ts +2014 -0
  289. package/ccw/src/tools/cli-history-store.ts +1195 -0
  290. package/ccw/src/tools/codex-lens.ts +1141 -0
  291. package/ccw/src/tools/{convert-tokens-to-css.js → convert-tokens-to-css.ts} +73 -23
  292. package/ccw/src/tools/core-memory.ts +444 -0
  293. package/ccw/src/tools/detect-changed-modules.ts +325 -0
  294. package/ccw/src/tools/{discover-design-files.js → discover-design-files.ts} +74 -24
  295. package/ccw/src/tools/edit-file.ts +568 -0
  296. package/ccw/src/tools/{generate-module-docs.js → generate-module-docs.ts} +207 -185
  297. package/ccw/src/tools/{get-modules-by-depth.js → get-modules-by-depth.ts} +120 -79
  298. package/ccw/src/tools/index.ts +370 -0
  299. package/ccw/src/tools/native-session-discovery.ts +795 -0
  300. package/ccw/src/tools/notifier.ts +129 -0
  301. package/ccw/src/tools/read-file.ts +410 -0
  302. package/ccw/src/tools/resume-strategy.ts +345 -0
  303. package/ccw/src/tools/session-content-parser.ts +619 -0
  304. package/ccw/src/tools/session-manager.ts +1026 -0
  305. package/ccw/src/tools/smart-context.ts +228 -0
  306. package/ccw/src/tools/smart-search.ts +2065 -0
  307. package/ccw/src/tools/smart-search.ts.backup +1233 -0
  308. package/ccw/src/tools/storage-manager.ts +455 -0
  309. package/ccw/src/tools/write-file.ts +222 -0
  310. package/ccw/src/types/config.ts +11 -0
  311. package/ccw/src/types/index.ts +3 -0
  312. package/ccw/src/types/session.ts +25 -0
  313. package/ccw/src/types/tool.ts +41 -0
  314. package/ccw/src/utils/{browser-launcher.js → browser-launcher.ts} +10 -8
  315. package/ccw/src/utils/file-utils.ts +48 -0
  316. package/ccw/src/utils/{path-resolver.js → path-resolver.ts} +114 -78
  317. package/ccw/src/utils/path-validator.ts +153 -0
  318. package/ccw/src/utils/{ui.js → ui.ts} +32 -25
  319. package/codex-lens/pyproject.toml +48 -0
  320. package/codex-lens/src/codexlens/.workflow/.cli-history/history.db +0 -0
  321. package/codex-lens/src/codexlens/__init__.py +28 -0
  322. package/codex-lens/src/codexlens/__main__.py +14 -0
  323. package/codex-lens/src/codexlens/__pycache__/__init__.cpython-313.pyc +0 -0
  324. package/codex-lens/src/codexlens/__pycache__/__main__.cpython-313.pyc +0 -0
  325. package/codex-lens/src/codexlens/__pycache__/config.cpython-313.pyc +0 -0
  326. package/codex-lens/src/codexlens/__pycache__/entities.cpython-313.pyc +0 -0
  327. package/codex-lens/src/codexlens/__pycache__/errors.cpython-313.pyc +0 -0
  328. package/codex-lens/src/codexlens/cli/__init__.py +27 -0
  329. package/codex-lens/src/codexlens/cli/__pycache__/__init__.cpython-313.pyc +0 -0
  330. package/codex-lens/src/codexlens/cli/__pycache__/commands.cpython-313.pyc +0 -0
  331. package/codex-lens/src/codexlens/cli/__pycache__/embedding_manager.cpython-313.pyc +0 -0
  332. package/codex-lens/src/codexlens/cli/__pycache__/model_manager.cpython-313.pyc +0 -0
  333. package/codex-lens/src/codexlens/cli/__pycache__/output.cpython-313.pyc +0 -0
  334. package/codex-lens/src/codexlens/cli/commands.py +1931 -0
  335. package/codex-lens/src/codexlens/cli/embedding_manager.py +620 -0
  336. package/codex-lens/src/codexlens/cli/model_manager.py +289 -0
  337. package/codex-lens/src/codexlens/cli/output.py +124 -0
  338. package/codex-lens/src/codexlens/config.py +201 -0
  339. package/codex-lens/src/codexlens/entities.py +121 -0
  340. package/codex-lens/src/codexlens/errors.py +55 -0
  341. package/codex-lens/src/codexlens/indexing/README.md +77 -0
  342. package/codex-lens/src/codexlens/indexing/__init__.py +4 -0
  343. package/codex-lens/src/codexlens/indexing/__pycache__/__init__.cpython-313.pyc +0 -0
  344. package/codex-lens/src/codexlens/indexing/__pycache__/symbol_extractor.cpython-313.pyc +0 -0
  345. package/codex-lens/src/codexlens/indexing/symbol_extractor.py +243 -0
  346. package/codex-lens/src/codexlens/parsers/__init__.py +8 -0
  347. package/codex-lens/src/codexlens/parsers/__pycache__/__init__.cpython-313.pyc +0 -0
  348. package/codex-lens/src/codexlens/parsers/__pycache__/encoding.cpython-313.pyc +0 -0
  349. package/codex-lens/src/codexlens/parsers/__pycache__/factory.cpython-313.pyc +0 -0
  350. package/codex-lens/src/codexlens/parsers/__pycache__/tokenizer.cpython-313.pyc +0 -0
  351. package/codex-lens/src/codexlens/parsers/__pycache__/treesitter_parser.cpython-313.pyc +0 -0
  352. package/codex-lens/src/codexlens/parsers/encoding.py +202 -0
  353. package/codex-lens/src/codexlens/parsers/factory.py +256 -0
  354. package/codex-lens/src/codexlens/parsers/tokenizer.py +98 -0
  355. package/codex-lens/src/codexlens/parsers/treesitter_parser.py +335 -0
  356. package/codex-lens/src/codexlens/search/__init__.py +15 -0
  357. package/codex-lens/src/codexlens/search/__pycache__/__init__.cpython-313.pyc +0 -0
  358. package/codex-lens/src/codexlens/search/__pycache__/chain_search.cpython-313.pyc +0 -0
  359. package/codex-lens/src/codexlens/search/__pycache__/enrichment.cpython-313.pyc +0 -0
  360. package/codex-lens/src/codexlens/search/__pycache__/hybrid_search.cpython-313.pyc +0 -0
  361. package/codex-lens/src/codexlens/search/__pycache__/query_parser.cpython-313.pyc +0 -0
  362. package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-313.pyc +0 -0
  363. package/codex-lens/src/codexlens/search/chain_search.py +647 -0
  364. package/codex-lens/src/codexlens/search/enrichment.py +150 -0
  365. package/codex-lens/src/codexlens/search/hybrid_search.py +313 -0
  366. package/codex-lens/src/codexlens/search/query_parser.py +242 -0
  367. package/codex-lens/src/codexlens/search/ranking.py +274 -0
  368. package/codex-lens/src/codexlens/semantic/__init__.py +39 -0
  369. package/codex-lens/src/codexlens/semantic/__pycache__/__init__.cpython-313.pyc +0 -0
  370. package/codex-lens/src/codexlens/semantic/__pycache__/ann_index.cpython-313.pyc +0 -0
  371. package/codex-lens/src/codexlens/semantic/__pycache__/chunker.cpython-313.pyc +0 -0
  372. package/codex-lens/src/codexlens/semantic/__pycache__/code_extractor.cpython-313.pyc +0 -0
  373. package/codex-lens/src/codexlens/semantic/__pycache__/embedder.cpython-313.pyc +0 -0
  374. package/codex-lens/src/codexlens/semantic/__pycache__/graph_analyzer.cpython-313.pyc +0 -0
  375. package/codex-lens/src/codexlens/semantic/__pycache__/llm_enhancer.cpython-313.pyc +0 -0
  376. package/codex-lens/src/codexlens/semantic/__pycache__/vector_store.cpython-313.pyc +0 -0
  377. package/codex-lens/src/codexlens/semantic/ann_index.py +414 -0
  378. package/codex-lens/src/codexlens/semantic/chunker.py +448 -0
  379. package/codex-lens/src/codexlens/semantic/code_extractor.py +274 -0
  380. package/codex-lens/src/codexlens/semantic/embedder.py +185 -0
  381. package/codex-lens/src/codexlens/semantic/vector_store.py +955 -0
  382. package/codex-lens/src/codexlens/storage/__init__.py +29 -0
  383. package/codex-lens/src/codexlens/storage/__pycache__/__init__.cpython-313.pyc +0 -0
  384. package/codex-lens/src/codexlens/storage/__pycache__/dir_index.cpython-313.pyc +0 -0
  385. package/codex-lens/src/codexlens/storage/__pycache__/file_cache.cpython-313.pyc +0 -0
  386. package/codex-lens/src/codexlens/storage/__pycache__/index_tree.cpython-313.pyc +0 -0
  387. package/codex-lens/src/codexlens/storage/__pycache__/migration_manager.cpython-313.pyc +0 -0
  388. package/codex-lens/src/codexlens/storage/__pycache__/path_mapper.cpython-313.pyc +0 -0
  389. package/codex-lens/src/codexlens/storage/__pycache__/registry.cpython-313.pyc +0 -0
  390. package/codex-lens/src/codexlens/storage/__pycache__/sqlite_store.cpython-313.pyc +0 -0
  391. package/codex-lens/src/codexlens/storage/__pycache__/sqlite_utils.cpython-313.pyc +0 -0
  392. package/codex-lens/src/codexlens/storage/dir_index.py +1850 -0
  393. package/codex-lens/src/codexlens/storage/file_cache.py +32 -0
  394. package/codex-lens/src/codexlens/storage/index_tree.py +776 -0
  395. package/codex-lens/src/codexlens/storage/migration_manager.py +154 -0
  396. package/codex-lens/src/codexlens/storage/migrations/__init__.py +1 -0
  397. package/codex-lens/src/codexlens/storage/migrations/__pycache__/__init__.cpython-313.pyc +0 -0
  398. package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_001_normalize_keywords.cpython-313.pyc +0 -0
  399. package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_002_add_token_metadata.cpython-313.pyc +0 -0
  400. package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_003_code_relationships.cpython-313.pyc +0 -0
  401. package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_004_dual_fts.cpython-313.pyc +0 -0
  402. package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_005_cleanup_unused_fields.cpython-313.pyc +0 -0
  403. package/codex-lens/src/codexlens/storage/migrations/migration_001_normalize_keywords.py +123 -0
  404. package/codex-lens/src/codexlens/storage/migrations/migration_002_add_token_metadata.py +48 -0
  405. package/codex-lens/src/codexlens/storage/migrations/migration_004_dual_fts.py +232 -0
  406. package/codex-lens/src/codexlens/storage/migrations/migration_005_cleanup_unused_fields.py +196 -0
  407. package/codex-lens/src/codexlens/storage/path_mapper.py +274 -0
  408. package/codex-lens/src/codexlens/storage/registry.py +670 -0
  409. package/codex-lens/src/codexlens/storage/sqlite_store.py +576 -0
  410. package/codex-lens/src/codexlens/storage/sqlite_utils.py +64 -0
  411. package/package.json +4 -1
  412. package/.claude/commands/memory/tech-research.md +0 -477
  413. package/.claude/scripts/classify-folders.sh +0 -39
  414. package/.claude/scripts/convert_tokens_to_css.sh +0 -229
  415. package/.claude/scripts/detect_changed_modules.sh +0 -161
  416. package/.claude/scripts/discover-design-files.sh +0 -87
  417. package/.claude/scripts/extract-animations.js +0 -243
  418. package/.claude/scripts/extract-computed-styles.js +0 -118
  419. package/.claude/scripts/extract-layout-structure.js +0 -411
  420. package/.claude/scripts/generate_module_docs.sh +0 -717
  421. package/.claude/scripts/get_modules_by_depth.sh +0 -170
  422. package/.claude/scripts/ui-generate-preview.sh +0 -395
  423. package/.claude/scripts/ui-instantiate-prototypes.sh +0 -815
  424. package/.claude/scripts/update_module_claude.sh +0 -337
  425. package/.claude/workflows/context-search-strategy.md +0 -77
  426. package/.claude/workflows/intelligent-tools-strategy.md +0 -662
  427. package/ccw/src/cli.js +0 -119
  428. package/ccw/src/commands/install.js +0 -324
  429. package/ccw/src/commands/tool.js +0 -138
  430. package/ccw/src/core/data-aggregator.js +0 -409
  431. package/ccw/src/core/server.js +0 -2063
  432. package/ccw/src/core/session-scanner.js +0 -235
  433. package/ccw/src/tools/classify-folders.js +0 -204
  434. package/ccw/src/tools/detect-changed-modules.js +0 -288
  435. package/ccw/src/tools/edit-file.js +0 -266
  436. package/ccw/src/tools/index.js +0 -176
  437. package/ccw/src/utils/file-utils.js +0 -48
@@ -1,717 +0,0 @@
1
- #!/bin/bash
2
- # ⚠️ DEPRECATED: This script is deprecated.
3
- # Please use: ccw tool exec generate_module_docs '{"path":".","strategy":"single-layer","tool":"gemini"}'
4
- # This file will be removed in a future version.
5
-
6
- # Generate documentation for modules and projects with multiple strategies
7
- # Usage: generate_module_docs.sh <strategy> <source_path> <project_name> [tool] [model]
8
- # strategy: full|single|project-readme|project-architecture|http-api
9
- # source_path: Path to the source module directory (or project root for project-level docs)
10
- # project_name: Project name for output path (e.g., "myproject")
11
- # tool: gemini|qwen|codex (default: gemini)
12
- # model: Model name (optional, uses tool defaults)
13
- #
14
- # Default Models:
15
- # gemini: gemini-2.5-flash
16
- # qwen: coder-model
17
- # codex: gpt5-codex
18
- #
19
- # Module-Level Strategies:
20
- # full: Full documentation generation
21
- # - Read: All files in current and subdirectories (@**/*)
22
- # - Generate: API.md + README.md for each directory containing code files
23
- # - Use: Deep directories (Layer 3), comprehensive documentation
24
- #
25
- # single: Single-layer documentation
26
- # - Read: Current directory code + child API.md/README.md files
27
- # - Generate: API.md + README.md only in current directory
28
- # - Use: Upper layers (Layer 1-2), incremental updates
29
- #
30
- # Project-Level Strategies:
31
- # project-readme: Project overview documentation
32
- # - Read: All module API.md and README.md files
33
- # - Generate: README.md (project root)
34
- # - Use: After all module docs are generated
35
- #
36
- # project-architecture: System design documentation
37
- # - Read: All module docs + project README
38
- # - Generate: ARCHITECTURE.md + EXAMPLES.md
39
- # - Use: After project README is generated
40
- #
41
- # http-api: HTTP API documentation
42
- # - Read: API route files + existing docs
43
- # - Generate: api/README.md
44
- # - Use: For projects with HTTP APIs
45
- #
46
- # Output Structure:
47
- # Module docs: .workflow/docs/{project_name}/{source_path}/API.md
48
- # Module docs: .workflow/docs/{project_name}/{source_path}/README.md
49
- # Project docs: .workflow/docs/{project_name}/README.md
50
- # Project docs: .workflow/docs/{project_name}/ARCHITECTURE.md
51
- # Project docs: .workflow/docs/{project_name}/EXAMPLES.md
52
- # API docs: .workflow/docs/{project_name}/api/README.md
53
- #
54
- # Features:
55
- # - Path mirroring: source structure → docs structure
56
- # - Template-driven generation
57
- # - Respects .gitignore patterns
58
- # - Detects code vs navigation folders
59
- # - Tool fallback support
60
-
61
- # Build exclusion filters from .gitignore
62
- build_exclusion_filters() {
63
- local filters=""
64
-
65
- # Common system/cache directories to exclude
66
- local system_excludes=(
67
- ".git" "__pycache__" "node_modules" ".venv" "venv" "env"
68
- "dist" "build" ".cache" ".pytest_cache" ".mypy_cache"
69
- "coverage" ".nyc_output" "logs" "tmp" "temp" ".workflow"
70
- )
71
-
72
- for exclude in "${system_excludes[@]}"; do
73
- filters+=" -not -path '*/$exclude' -not -path '*/$exclude/*'"
74
- done
75
-
76
- # Find and parse .gitignore (current dir first, then git root)
77
- local gitignore_file=""
78
-
79
- # Check current directory first
80
- if [ -f ".gitignore" ]; then
81
- gitignore_file=".gitignore"
82
- else
83
- # Try to find git root and check for .gitignore there
84
- local git_root=$(git rev-parse --show-toplevel 2>/dev/null)
85
- if [ -n "$git_root" ] && [ -f "$git_root/.gitignore" ]; then
86
- gitignore_file="$git_root/.gitignore"
87
- fi
88
- fi
89
-
90
- # Parse .gitignore if found
91
- if [ -n "$gitignore_file" ]; then
92
- while IFS= read -r line; do
93
- # Skip empty lines and comments
94
- [[ -z "$line" || "$line" =~ ^[[:space:]]*# ]] && continue
95
-
96
- # Remove trailing slash and whitespace
97
- line=$(echo "$line" | sed 's|/$||' | xargs)
98
-
99
- # Skip wildcards patterns (too complex for simple find)
100
- [[ "$line" =~ \* ]] && continue
101
-
102
- # Add to filters
103
- filters+=" -not -path '*/$line' -not -path '*/$line/*'"
104
- done < "$gitignore_file"
105
- fi
106
-
107
- echo "$filters"
108
- }
109
-
110
- # Detect folder type (code vs navigation)
111
- detect_folder_type() {
112
- local target_path="$1"
113
- local exclusion_filters="$2"
114
-
115
- # Count code files (primary indicators)
116
- local code_count=$(eval "find \"$target_path\" -maxdepth 1 -type f \\( -name '*.ts' -o -name '*.tsx' -o -name '*.js' -o -name '*.jsx' -o -name '*.py' -o -name '*.sh' -o -name '*.go' -o -name '*.rs' \\) $exclusion_filters 2>/dev/null" | wc -l)
117
-
118
- if [ $code_count -gt 0 ]; then
119
- echo "code"
120
- else
121
- echo "navigation"
122
- fi
123
- }
124
-
125
- # Scan directory structure and generate structured information
126
- scan_directory_structure() {
127
- local target_path="$1"
128
- local strategy="$2"
129
-
130
- if [ ! -d "$target_path" ]; then
131
- echo "Directory not found: $target_path"
132
- return 1
133
- fi
134
-
135
- local exclusion_filters=$(build_exclusion_filters)
136
- local structure_info=""
137
-
138
- # Get basic directory info
139
- local dir_name=$(basename "$target_path")
140
- local total_files=$(eval "find \"$target_path\" -type f $exclusion_filters 2>/dev/null" | wc -l)
141
- local total_dirs=$(eval "find \"$target_path\" -type d $exclusion_filters 2>/dev/null" | wc -l)
142
- local folder_type=$(detect_folder_type "$target_path" "$exclusion_filters")
143
-
144
- structure_info+="Directory: $dir_name\n"
145
- structure_info+="Total files: $total_files\n"
146
- structure_info+="Total directories: $total_dirs\n"
147
- structure_info+="Folder type: $folder_type\n\n"
148
-
149
- if [ "$strategy" = "full" ]; then
150
- # For full: show all subdirectories with file counts
151
- structure_info+="Subdirectories with files:\n"
152
- while IFS= read -r dir; do
153
- if [ -n "$dir" ] && [ "$dir" != "$target_path" ]; then
154
- local rel_path=${dir#$target_path/}
155
- local file_count=$(eval "find \"$dir\" -maxdepth 1 -type f $exclusion_filters 2>/dev/null" | wc -l)
156
- if [ $file_count -gt 0 ]; then
157
- local subdir_type=$(detect_folder_type "$dir" "$exclusion_filters")
158
- structure_info+=" - $rel_path/ ($file_count files, type: $subdir_type)\n"
159
- fi
160
- fi
161
- done < <(eval "find \"$target_path\" -type d $exclusion_filters 2>/dev/null")
162
- else
163
- # For single: show direct children only
164
- structure_info+="Direct subdirectories:\n"
165
- while IFS= read -r dir; do
166
- if [ -n "$dir" ]; then
167
- local dir_name=$(basename "$dir")
168
- local file_count=$(eval "find \"$dir\" -maxdepth 1 -type f $exclusion_filters 2>/dev/null" | wc -l)
169
- local has_api=$([ -f "$dir/API.md" ] && echo " [has API.md]" || echo "")
170
- local has_readme=$([ -f "$dir/README.md" ] && echo " [has README.md]" || echo "")
171
- structure_info+=" - $dir_name/ ($file_count files)$has_api$has_readme\n"
172
- fi
173
- done < <(eval "find \"$target_path\" -maxdepth 1 -type d $exclusion_filters 2>/dev/null" | grep -v "^$target_path$")
174
- fi
175
-
176
- # Show main file types in current directory
177
- structure_info+="\nCurrent directory files:\n"
178
- local code_files=$(eval "find \"$target_path\" -maxdepth 1 -type f \\( -name '*.ts' -o -name '*.tsx' -o -name '*.js' -o -name '*.jsx' -o -name '*.py' -o -name '*.sh' -o -name '*.go' -o -name '*.rs' \\) $exclusion_filters 2>/dev/null" | wc -l)
179
- local config_files=$(eval "find \"$target_path\" -maxdepth 1 -type f \\( -name '*.json' -o -name '*.yaml' -o -name '*.yml' -o -name '*.toml' \\) $exclusion_filters 2>/dev/null" | wc -l)
180
- local doc_files=$(eval "find \"$target_path\" -maxdepth 1 -type f -name '*.md' $exclusion_filters 2>/dev/null" | wc -l)
181
-
182
- structure_info+=" - Code files: $code_files\n"
183
- structure_info+=" - Config files: $config_files\n"
184
- structure_info+=" - Documentation: $doc_files\n"
185
-
186
- printf "%b" "$structure_info"
187
- }
188
-
189
- # Calculate output path based on source path and project name
190
- calculate_output_path() {
191
- local source_path="$1"
192
- local project_name="$2"
193
- local project_root="$3"
194
-
195
- # Get absolute path of source (normalize to Unix-style path)
196
- local abs_source=$(cd "$source_path" && pwd)
197
-
198
- # Normalize project root to same format
199
- local norm_project_root=$(cd "$project_root" && pwd)
200
-
201
- # Calculate relative path from project root
202
- local rel_path="${abs_source#$norm_project_root}"
203
-
204
- # Remove leading slash if present
205
- rel_path="${rel_path#/}"
206
-
207
- # If source is project root, use project name directly
208
- if [ "$abs_source" = "$norm_project_root" ] || [ -z "$rel_path" ]; then
209
- echo "$norm_project_root/.workflow/docs/$project_name"
210
- else
211
- echo "$norm_project_root/.workflow/docs/$project_name/$rel_path"
212
- fi
213
- }
214
-
215
- generate_module_docs() {
216
- local strategy="$1"
217
- local source_path="$2"
218
- local project_name="$3"
219
- local tool="${4:-gemini}"
220
- local model="$5"
221
-
222
- # Validate parameters
223
- if [ -z "$strategy" ] || [ -z "$source_path" ] || [ -z "$project_name" ]; then
224
- echo "❌ Error: Strategy, source path, and project name are required"
225
- echo "Usage: generate_module_docs.sh <strategy> <source_path> <project_name> [tool] [model]"
226
- echo "Module strategies: full, single"
227
- echo "Project strategies: project-readme, project-architecture, http-api"
228
- return 1
229
- fi
230
-
231
- # Validate strategy
232
- local valid_strategies=("full" "single" "project-readme" "project-architecture" "http-api")
233
- local strategy_valid=false
234
- for valid_strategy in "${valid_strategies[@]}"; do
235
- if [ "$strategy" = "$valid_strategy" ]; then
236
- strategy_valid=true
237
- break
238
- fi
239
- done
240
-
241
- if [ "$strategy_valid" = false ]; then
242
- echo "❌ Error: Invalid strategy '$strategy'"
243
- echo "Valid module strategies: full, single"
244
- echo "Valid project strategies: project-readme, project-architecture, http-api"
245
- return 1
246
- fi
247
-
248
- if [ ! -d "$source_path" ]; then
249
- echo "❌ Error: Source directory '$source_path' does not exist"
250
- return 1
251
- fi
252
-
253
- # Set default models if not specified
254
- if [ -z "$model" ]; then
255
- case "$tool" in
256
- gemini)
257
- model="gemini-2.5-flash"
258
- ;;
259
- qwen)
260
- model="coder-model"
261
- ;;
262
- codex)
263
- model="gpt5-codex"
264
- ;;
265
- *)
266
- model=""
267
- ;;
268
- esac
269
- fi
270
-
271
- # Build exclusion filters
272
- local exclusion_filters=$(build_exclusion_filters)
273
-
274
- # Get project root
275
- local project_root=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
276
-
277
- # Determine if this is a project-level strategy
278
- local is_project_level=false
279
- if [[ "$strategy" =~ ^project- ]] || [ "$strategy" = "http-api" ]; then
280
- is_project_level=true
281
- fi
282
-
283
- # Calculate output path
284
- local output_path
285
- if [ "$is_project_level" = true ]; then
286
- # Project-level docs go to project root
287
- if [ "$strategy" = "http-api" ]; then
288
- output_path="$project_root/.workflow/docs/$project_name/api"
289
- else
290
- output_path="$project_root/.workflow/docs/$project_name"
291
- fi
292
- else
293
- output_path=$(calculate_output_path "$source_path" "$project_name" "$project_root")
294
- fi
295
-
296
- # Create output directory
297
- mkdir -p "$output_path"
298
-
299
- # Detect folder type (only for module-level strategies)
300
- local folder_type=""
301
- if [ "$is_project_level" = false ]; then
302
- folder_type=$(detect_folder_type "$source_path" "$exclusion_filters")
303
- fi
304
-
305
- # Load templates based on strategy
306
- local api_template=""
307
- local readme_template=""
308
- local template_content=""
309
-
310
- if [ "$is_project_level" = true ]; then
311
- # Project-level templates
312
- case "$strategy" in
313
- project-readme)
314
- local proj_readme_path="$HOME/.claude/workflows/cli-templates/prompts/documentation/project-readme.txt"
315
- if [ -f "$proj_readme_path" ]; then
316
- template_content=$(cat "$proj_readme_path")
317
- echo " 📋 Loaded Project README template: $(wc -l < "$proj_readme_path") lines"
318
- fi
319
- ;;
320
- project-architecture)
321
- local arch_path="$HOME/.claude/workflows/cli-templates/prompts/documentation/project-architecture.txt"
322
- local examples_path="$HOME/.claude/workflows/cli-templates/prompts/documentation/project-examples.txt"
323
- if [ -f "$arch_path" ]; then
324
- template_content=$(cat "$arch_path")
325
- echo " 📋 Loaded Architecture template: $(wc -l < "$arch_path") lines"
326
- fi
327
- if [ -f "$examples_path" ]; then
328
- template_content="$template_content
329
-
330
- EXAMPLES TEMPLATE:
331
- $(cat "$examples_path")"
332
- echo " 📋 Loaded Examples template: $(wc -l < "$examples_path") lines"
333
- fi
334
- ;;
335
- http-api)
336
- local api_path="$HOME/.claude/workflows/cli-templates/prompts/documentation/api.txt"
337
- if [ -f "$api_path" ]; then
338
- template_content=$(cat "$api_path")
339
- echo " 📋 Loaded HTTP API template: $(wc -l < "$api_path") lines"
340
- fi
341
- ;;
342
- esac
343
- else
344
- # Module-level templates
345
- local api_template_path="$HOME/.claude/workflows/cli-templates/prompts/documentation/api.txt"
346
- local readme_template_path="$HOME/.claude/workflows/cli-templates/prompts/documentation/module-readme.txt"
347
- local nav_template_path="$HOME/.claude/workflows/cli-templates/prompts/documentation/folder-navigation.txt"
348
-
349
- if [ "$folder_type" = "code" ]; then
350
- if [ -f "$api_template_path" ]; then
351
- api_template=$(cat "$api_template_path")
352
- echo " 📋 Loaded API template: $(wc -l < "$api_template_path") lines"
353
- fi
354
- if [ -f "$readme_template_path" ]; then
355
- readme_template=$(cat "$readme_template_path")
356
- echo " 📋 Loaded README template: $(wc -l < "$readme_template_path") lines"
357
- fi
358
- else
359
- # Navigation folder uses navigation template
360
- if [ -f "$nav_template_path" ]; then
361
- readme_template=$(cat "$nav_template_path")
362
- echo " 📋 Loaded Navigation template: $(wc -l < "$nav_template_path") lines"
363
- fi
364
- fi
365
- fi
366
-
367
- # Scan directory structure (only for module-level strategies)
368
- local structure_info=""
369
- if [ "$is_project_level" = false ]; then
370
- echo " 🔍 Scanning directory structure..."
371
- structure_info=$(scan_directory_structure "$source_path" "$strategy")
372
- fi
373
-
374
- # Prepare logging info
375
- local module_name=$(basename "$source_path")
376
-
377
- echo "⚡ Generating docs: $source_path → $output_path"
378
- echo " Strategy: $strategy | Tool: $tool | Model: $model | Type: $folder_type"
379
- echo " Output: $output_path"
380
-
381
- # Build strategy-specific prompt
382
- local final_prompt=""
383
-
384
- # Project-level strategies
385
- if [ "$strategy" = "project-readme" ]; then
386
- final_prompt="PURPOSE: Generate comprehensive project overview documentation
387
-
388
- PROJECT: $project_name
389
- OUTPUT: Current directory (file will be moved to final location)
390
-
391
- Read: @.workflow/docs/$project_name/**/*.md
392
-
393
- Context: All module documentation files from the project
394
-
395
- Generate ONE documentation file in current directory:
396
- - README.md - Project root documentation
397
-
398
- Template:
399
- $template_content
400
-
401
- Instructions:
402
- - Create README.md in CURRENT DIRECTORY
403
- - Synthesize information from all module docs
404
- - Include project overview, getting started, and navigation
405
- - Create clear module navigation with links
406
- - Follow template structure exactly"
407
-
408
- elif [ "$strategy" = "project-architecture" ]; then
409
- final_prompt="PURPOSE: Generate system design and usage examples documentation
410
-
411
- PROJECT: $project_name
412
- OUTPUT: Current directory (files will be moved to final location)
413
-
414
- Read: @.workflow/docs/$project_name/**/*.md
415
-
416
- Context: All project documentation including module docs and project README
417
-
418
- Generate TWO documentation files in current directory:
419
- 1. ARCHITECTURE.md - System architecture and design patterns
420
- 2. EXAMPLES.md - End-to-end usage examples
421
-
422
- Template:
423
- $template_content
424
-
425
- Instructions:
426
- - Create both ARCHITECTURE.md and EXAMPLES.md in CURRENT DIRECTORY
427
- - Synthesize architectural patterns from module documentation
428
- - Document system structure, module relationships, and design decisions
429
- - Provide practical code examples and usage scenarios
430
- - Follow template structure for both files"
431
-
432
- elif [ "$strategy" = "http-api" ]; then
433
- final_prompt="PURPOSE: Generate HTTP API reference documentation
434
-
435
- PROJECT: $project_name
436
- OUTPUT: Current directory (file will be moved to final location)
437
-
438
- Read: @**/*.{ts,js,py,go,rs} @.workflow/docs/$project_name/**/*.md
439
-
440
- Context: API route files and existing documentation
441
-
442
- Generate ONE documentation file in current directory:
443
- - README.md - HTTP API documentation (in api/ subdirectory)
444
-
445
- Template:
446
- $template_content
447
-
448
- Instructions:
449
- - Create README.md in CURRENT DIRECTORY
450
- - Document all HTTP endpoints (routes, methods, parameters, responses)
451
- - Include authentication requirements and error codes
452
- - Provide request/response examples
453
- - Follow template structure (Part B: HTTP API documentation)"
454
-
455
- # Module-level strategies
456
- elif [ "$strategy" = "full" ]; then
457
- # Full strategy: read all files, generate for each directory
458
- if [ "$folder_type" = "code" ]; then
459
- final_prompt="PURPOSE: Generate comprehensive API and module documentation
460
-
461
- Directory Structure Analysis:
462
- $structure_info
463
-
464
- SOURCE: $source_path
465
- OUTPUT: Current directory (files will be moved to final location)
466
-
467
- Read: @**/*
468
-
469
- Generate TWO documentation files in current directory:
470
- 1. API.md - Code API documentation (functions, classes, interfaces)
471
- Template:
472
- $api_template
473
-
474
- 2. README.md - Module overview documentation
475
- Template:
476
- $readme_template
477
-
478
- Instructions:
479
- - Generate both API.md and README.md in CURRENT DIRECTORY
480
- - If subdirectories contain code files, generate their docs too (recursive)
481
- - Work bottom-up: deepest directories first
482
- - Follow template structure exactly
483
- - Use structure analysis for context"
484
- else
485
- # Navigation folder - README only
486
- final_prompt="PURPOSE: Generate navigation documentation for folder structure
487
-
488
- Directory Structure Analysis:
489
- $structure_info
490
-
491
- SOURCE: $source_path
492
- OUTPUT: Current directory (file will be moved to final location)
493
-
494
- Read: @**/*
495
-
496
- Generate ONE documentation file in current directory:
497
- - README.md - Navigation and folder overview
498
-
499
- Template:
500
- $readme_template
501
-
502
- Instructions:
503
- - Create README.md in CURRENT DIRECTORY
504
- - Focus on folder structure and navigation
505
- - Link to subdirectory documentation
506
- - Use structure analysis for context"
507
- fi
508
- else
509
- # Single strategy: read current + child docs only
510
- if [ "$folder_type" = "code" ]; then
511
- final_prompt="PURPOSE: Generate API and module documentation for current directory
512
-
513
- Directory Structure Analysis:
514
- $structure_info
515
-
516
- SOURCE: $source_path
517
- OUTPUT: Current directory (files will be moved to final location)
518
-
519
- Read: @*/API.md @*/README.md @*.ts @*.tsx @*.js @*.jsx @*.py @*.sh @*.go @*.rs @*.md @*.json @*.yaml @*.yml
520
-
521
- Generate TWO documentation files in current directory:
522
- 1. API.md - Code API documentation
523
- Template:
524
- $api_template
525
-
526
- 2. README.md - Module overview
527
- Template:
528
- $readme_template
529
-
530
- Instructions:
531
- - Generate both API.md and README.md in CURRENT DIRECTORY
532
- - Reference child documentation, do not duplicate
533
- - Follow template structure
534
- - Use structure analysis for current directory context"
535
- else
536
- # Navigation folder - README only
537
- final_prompt="PURPOSE: Generate navigation documentation
538
-
539
- Directory Structure Analysis:
540
- $structure_info
541
-
542
- SOURCE: $source_path
543
- OUTPUT: Current directory (file will be moved to final location)
544
-
545
- Read: @*/API.md @*/README.md @*.md
546
-
547
- Generate ONE documentation file in current directory:
548
- - README.md - Navigation and overview
549
-
550
- Template:
551
- $readme_template
552
-
553
- Instructions:
554
- - Create README.md in CURRENT DIRECTORY
555
- - Link to child documentation
556
- - Use structure analysis for navigation context"
557
- fi
558
- fi
559
-
560
- # Execute documentation generation
561
- local start_time=$(date +%s)
562
- echo " 🔄 Starting documentation generation..."
563
-
564
- if cd "$source_path" 2>/dev/null; then
565
- local tool_result=0
566
-
567
- # Store current output path for CLI context
568
- export DOC_OUTPUT_PATH="$output_path"
569
-
570
- # Record git HEAD before CLI execution (to detect unwanted auto-commits)
571
- local git_head_before=""
572
- if git rev-parse --git-dir >/dev/null 2>&1; then
573
- git_head_before=$(git rev-parse HEAD 2>/dev/null)
574
- fi
575
-
576
- # Execute with selected tool
577
- case "$tool" in
578
- qwen)
579
- if [ "$model" = "coder-model" ]; then
580
- qwen -p "$final_prompt" --yolo 2>&1
581
- else
582
- qwen -p "$final_prompt" -m "$model" --yolo 2>&1
583
- fi
584
- tool_result=$?
585
- ;;
586
- codex)
587
- codex --full-auto exec "$final_prompt" -m "$model" --skip-git-repo-check -s danger-full-access 2>&1
588
- tool_result=$?
589
- ;;
590
- gemini)
591
- gemini -p "$final_prompt" -m "$model" --yolo 2>&1
592
- tool_result=$?
593
- ;;
594
- *)
595
- echo " ⚠️ Unknown tool: $tool, defaulting to gemini"
596
- gemini -p "$final_prompt" -m "$model" --yolo 2>&1
597
- tool_result=$?
598
- ;;
599
- esac
600
-
601
- # Move generated files to output directory
602
- local docs_created=0
603
- local moved_files=""
604
-
605
- if [ $tool_result -eq 0 ]; then
606
- if [ "$is_project_level" = true ]; then
607
- # Project-level documentation files
608
- case "$strategy" in
609
- project-readme)
610
- if [ -f "README.md" ]; then
611
- mv "README.md" "$output_path/README.md" 2>/dev/null && {
612
- docs_created=$((docs_created + 1))
613
- moved_files+="README.md "
614
- }
615
- fi
616
- ;;
617
- project-architecture)
618
- if [ -f "ARCHITECTURE.md" ]; then
619
- mv "ARCHITECTURE.md" "$output_path/ARCHITECTURE.md" 2>/dev/null && {
620
- docs_created=$((docs_created + 1))
621
- moved_files+="ARCHITECTURE.md "
622
- }
623
- fi
624
- if [ -f "EXAMPLES.md" ]; then
625
- mv "EXAMPLES.md" "$output_path/EXAMPLES.md" 2>/dev/null && {
626
- docs_created=$((docs_created + 1))
627
- moved_files+="EXAMPLES.md "
628
- }
629
- fi
630
- ;;
631
- http-api)
632
- if [ -f "README.md" ]; then
633
- mv "README.md" "$output_path/README.md" 2>/dev/null && {
634
- docs_created=$((docs_created + 1))
635
- moved_files+="api/README.md "
636
- }
637
- fi
638
- ;;
639
- esac
640
- else
641
- # Module-level documentation files
642
- # Check and move API.md if it exists
643
- if [ "$folder_type" = "code" ] && [ -f "API.md" ]; then
644
- mv "API.md" "$output_path/API.md" 2>/dev/null && {
645
- docs_created=$((docs_created + 1))
646
- moved_files+="API.md "
647
- }
648
- fi
649
-
650
- # Check and move README.md if it exists
651
- if [ -f "README.md" ]; then
652
- mv "README.md" "$output_path/README.md" 2>/dev/null && {
653
- docs_created=$((docs_created + 1))
654
- moved_files+="README.md "
655
- }
656
- fi
657
- fi
658
- fi
659
-
660
- # Check if CLI tool auto-committed (and revert if needed)
661
- if [ -n "$git_head_before" ]; then
662
- local git_head_after=$(git rev-parse HEAD 2>/dev/null)
663
- if [ "$git_head_before" != "$git_head_after" ]; then
664
- echo " ⚠️ Detected unwanted auto-commit by CLI tool, reverting..."
665
- git reset --soft "$git_head_before" 2>/dev/null
666
- echo " ✅ Auto-commit reverted (files remain staged)"
667
- fi
668
- fi
669
-
670
- if [ $docs_created -gt 0 ]; then
671
- local end_time=$(date +%s)
672
- local duration=$((end_time - start_time))
673
- echo " ✅ Generated $docs_created doc(s) in ${duration}s: $moved_files"
674
- cd - > /dev/null
675
- return 0
676
- else
677
- echo " ❌ Documentation generation failed for $source_path"
678
- cd - > /dev/null
679
- return 1
680
- fi
681
- else
682
- echo " ❌ Cannot access directory: $source_path"
683
- return 1
684
- fi
685
- }
686
-
687
- # Execute function if script is run directly
688
- if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
689
- # Show help if no arguments or help requested
690
- if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
691
- echo "Usage: generate_module_docs.sh <strategy> <source_path> <project_name> [tool] [model]"
692
- echo ""
693
- echo "Module-Level Strategies:"
694
- echo " full - Generate docs for all subdirectories with code"
695
- echo " single - Generate docs only for current directory"
696
- echo ""
697
- echo "Project-Level Strategies:"
698
- echo " project-readme - Generate project root README.md"
699
- echo " project-architecture - Generate ARCHITECTURE.md + EXAMPLES.md"
700
- echo " http-api - Generate HTTP API documentation (api/README.md)"
701
- echo ""
702
- echo "Tools: gemini (default), qwen, codex"
703
- echo "Models: Use tool defaults if not specified"
704
- echo ""
705
- echo "Module Examples:"
706
- echo " ./generate_module_docs.sh full ./src/auth myproject"
707
- echo " ./generate_module_docs.sh single ./components myproject gemini"
708
- echo ""
709
- echo "Project Examples:"
710
- echo " ./generate_module_docs.sh project-readme . myproject"
711
- echo " ./generate_module_docs.sh project-architecture . myproject qwen"
712
- echo " ./generate_module_docs.sh http-api . myproject"
713
- exit 0
714
- fi
715
-
716
- generate_module_docs "$@"
717
- fi