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.
- package/.claude/CLAUDE.md +10 -0
- package/.claude/agents/action-planning-agent.md +857 -778
- package/.claude/agents/cli-execution-agent.md +266 -269
- package/.claude/agents/cli-explore-agent.md +2 -2
- package/.claude/agents/cli-lite-planning-agent.md +142 -92
- package/.claude/agents/cli-planning-agent.md +4 -4
- package/.claude/agents/code-developer.md +7 -6
- package/.claude/agents/conceptual-planning-agent.md +2 -2
- package/.claude/agents/context-search-agent.md +31 -32
- package/.claude/agents/doc-generator.md +4 -4
- package/.claude/agents/memory-bridge.md +93 -93
- package/.claude/agents/test-context-search-agent.md +8 -7
- package/.claude/agents/test-fix-agent.md +7 -6
- package/.claude/commands/clean.md +516 -0
- package/.claude/commands/memory/compact.md +383 -0
- package/.claude/commands/memory/docs-full-cli.md +471 -471
- package/.claude/commands/memory/docs-related-cli.md +386 -386
- package/.claude/commands/memory/docs.md +615 -615
- package/.claude/commands/memory/load.md +5 -5
- package/.claude/commands/memory/tech-research-rules.md +310 -0
- package/.claude/commands/memory/update-full.md +332 -332
- package/.claude/commands/memory/workflow-skill-memory.md +4 -4
- package/.claude/commands/task/create.md +151 -151
- package/.claude/commands/version.md +254 -254
- package/.claude/commands/workflow/brainstorm/api-designer.md +587 -585
- package/.claude/commands/workflow/brainstorm/artifacts.md +1 -0
- package/.claude/commands/workflow/brainstorm/auto-parallel.md +443 -443
- package/.claude/commands/workflow/brainstorm/data-architect.md +220 -220
- package/.claude/commands/workflow/brainstorm/product-manager.md +200 -200
- package/.claude/commands/workflow/brainstorm/product-owner.md +200 -200
- package/.claude/commands/workflow/brainstorm/scrum-master.md +200 -200
- package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +200 -200
- package/.claude/commands/workflow/brainstorm/system-architect.md +389 -387
- package/.claude/commands/workflow/brainstorm/ui-designer.md +221 -221
- package/.claude/commands/workflow/brainstorm/ux-expert.md +221 -221
- package/.claude/commands/workflow/debug.md +321 -0
- package/.claude/commands/workflow/execute.md +13 -0
- package/.claude/commands/workflow/init.md +165 -164
- package/.claude/commands/workflow/lite-execute.md +119 -13
- package/.claude/commands/workflow/lite-fix.md +623 -621
- package/.claude/commands/workflow/lite-plan.md +610 -592
- package/.claude/commands/workflow/plan.md +5 -5
- package/.claude/commands/workflow/review-module-cycle.md +2 -0
- package/.claude/commands/workflow/review-session-cycle.md +2 -0
- package/.claude/commands/workflow/review.md +297 -291
- package/.claude/commands/workflow/session/complete.md +153 -500
- package/.claude/commands/workflow/session/list.md +95 -95
- package/.claude/commands/workflow/session/resume.md +60 -60
- package/.claude/commands/workflow/session/start.md +199 -199
- package/.claude/commands/workflow/tdd-plan.md +3 -3
- package/.claude/commands/workflow/tdd-verify.md +23 -9
- package/.claude/commands/workflow/test-cycle-execute.md +2 -0
- package/.claude/commands/workflow/test-fix-gen.md +699 -699
- package/.claude/commands/workflow/tools/conflict-resolution.md +104 -18
- package/.claude/commands/workflow/tools/context-gather.md +436 -434
- package/.claude/commands/workflow/tools/task-generate-agent.md +490 -291
- package/.claude/commands/workflow/tools/task-generate-tdd.md +18 -10
- package/.claude/commands/workflow/tools/test-concept-enhanced.md +2 -1
- package/.claude/commands/workflow/tools/test-context-gather.md +1 -0
- package/.claude/commands/workflow/tools/test-task-generate.md +1 -0
- package/.claude/commands/workflow/ui-design/import-from-code.md +9 -6
- package/.claude/skills/command-guide/SKILL.md +5 -5
- package/.claude/skills/command-guide/index/all-commands.json +1 -1
- package/.claude/skills/command-guide/index/by-category.json +1 -1
- package/.claude/skills/command-guide/index/by-use-case.json +1 -1
- package/.claude/skills/command-guide/reference/agents/action-planning-agent.md +857 -778
- package/.claude/skills/command-guide/reference/agents/cli-execution-agent.md +266 -269
- package/.claude/skills/command-guide/reference/agents/cli-explore-agent.md +2 -2
- package/.claude/skills/command-guide/reference/agents/cli-lite-planning-agent.md +142 -92
- package/.claude/skills/command-guide/reference/agents/cli-planning-agent.md +4 -4
- package/.claude/skills/command-guide/reference/agents/code-developer.md +7 -6
- package/.claude/skills/command-guide/reference/agents/conceptual-planning-agent.md +2 -2
- package/.claude/skills/command-guide/reference/agents/context-search-agent.md +31 -32
- package/.claude/skills/command-guide/reference/agents/doc-generator.md +4 -4
- package/.claude/skills/command-guide/reference/agents/memory-bridge.md +93 -93
- package/.claude/skills/command-guide/reference/agents/test-context-search-agent.md +8 -7
- package/.claude/skills/command-guide/reference/agents/test-fix-agent.md +7 -6
- package/.claude/skills/command-guide/reference/commands/memory/docs-full-cli.md +471 -471
- package/.claude/skills/command-guide/reference/commands/memory/docs-related-cli.md +386 -386
- package/.claude/skills/command-guide/reference/commands/memory/docs.md +17 -16
- package/.claude/skills/command-guide/reference/commands/memory/load.md +5 -5
- package/.claude/skills/command-guide/reference/commands/memory/tech-research.md +194 -357
- package/.claude/skills/command-guide/reference/commands/memory/update-full.md +332 -332
- package/.claude/skills/command-guide/reference/commands/memory/workflow-skill-memory.md +4 -4
- package/.claude/skills/command-guide/reference/commands/task/create.md +151 -151
- package/.claude/skills/command-guide/reference/commands/version.md +254 -254
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/api-designer.md +585 -585
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/auto-parallel.md +443 -443
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/data-architect.md +220 -220
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-manager.md +200 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-owner.md +200 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/scrum-master.md +200 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/subject-matter-expert.md +200 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/system-architect.md +387 -387
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ui-designer.md +221 -221
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ux-expert.md +221 -221
- package/.claude/skills/command-guide/reference/commands/workflow/execute.md +25 -20
- package/.claude/skills/command-guide/reference/commands/workflow/init.md +164 -164
- package/.claude/skills/command-guide/reference/commands/workflow/lite-execute.md +748 -686
- package/.claude/skills/command-guide/reference/commands/workflow/lite-fix.md +664 -621
- package/.claude/skills/command-guide/reference/commands/workflow/lite-plan.md +645 -592
- package/.claude/skills/command-guide/reference/commands/workflow/plan.md +5 -5
- package/.claude/skills/command-guide/reference/commands/workflow/review.md +25 -18
- package/.claude/skills/command-guide/reference/commands/workflow/session/complete.md +547 -500
- package/.claude/skills/command-guide/reference/commands/workflow/session/list.md +45 -27
- package/.claude/skills/command-guide/reference/commands/workflow/session/resume.md +35 -19
- package/.claude/skills/command-guide/reference/commands/workflow/session/start.md +90 -33
- package/.claude/skills/command-guide/reference/commands/workflow/tdd-plan.md +3 -3
- package/.claude/skills/command-guide/reference/commands/workflow/tdd-verify.md +23 -9
- package/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md +699 -699
- package/.claude/skills/command-guide/reference/commands/workflow/tools/conflict-resolution.md +103 -17
- package/.claude/skills/command-guide/reference/commands/workflow/tools/context-gather.md +434 -434
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-agent.md +487 -291
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-tdd.md +17 -10
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-concept-enhanced.md +1 -1
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/import-from-code.md +6 -6
- package/.claude/workflows/chinese-response.md +38 -0
- package/.claude/workflows/cli-templates/prompts/rules/rule-api.txt +122 -0
- package/.claude/workflows/cli-templates/prompts/rules/rule-components.txt +122 -0
- package/.claude/workflows/cli-templates/prompts/rules/rule-config.txt +89 -0
- package/.claude/workflows/cli-templates/prompts/rules/rule-core.txt +60 -0
- package/.claude/workflows/cli-templates/prompts/rules/rule-patterns.txt +70 -0
- package/.claude/workflows/cli-templates/prompts/rules/rule-testing.txt +81 -0
- package/.claude/workflows/cli-templates/prompts/rules/tech-rules-agent-prompt.txt +89 -0
- package/.claude/workflows/cli-templates/prompts/workflow/gemini-solution-design.txt +131 -131
- package/.claude/workflows/cli-templates/prompts/workflow/skill-conflict-patterns.txt +5 -9
- package/.claude/workflows/cli-templates/prompts/workflow/skill-lessons-learned.txt +5 -9
- package/.claude/workflows/cli-templates/protocols/analysis-protocol.md +112 -0
- package/.claude/workflows/cli-templates/protocols/write-protocol.md +201 -0
- package/.claude/workflows/cli-templates/schemas/conflict-resolution-schema.json +137 -0
- package/.claude/workflows/cli-templates/schemas/debug-log-json-schema.json +127 -0
- package/.claude/workflows/cli-templates/schemas/fix-plan-json-schema.json +25 -0
- package/.claude/workflows/cli-templates/schemas/plan-json-schema.json +25 -0
- package/.claude/workflows/cli-tools-usage.md +526 -0
- package/{CLAUDE.md → .claude/workflows/coding-philosophy.md} +24 -45
- package/.claude/workflows/context-tools.md +84 -0
- package/.claude/workflows/file-modification.md +64 -0
- package/.claude/workflows/tool-strategy.md +216 -79
- package/.claude/workflows/windows-platform.md +16 -0
- package/.claude/workflows/workflow-architecture.md +942 -942
- package/.codex/AGENTS.md +63 -330
- package/.codex/prompts/debug.md +318 -0
- package/.codex/prompts/execute.md +273 -0
- package/.codex/prompts/lite-execute.md +164 -0
- package/.codex/prompts/lite-plan.md +469 -0
- package/.codex/prompts.zip +0 -0
- package/.gemini/GEMINI.md +25 -164
- package/.qwen/QWEN.md +0 -139
- package/README.md +29 -9
- package/ccw/README.md +30 -6
- package/ccw/bin/ccw-mcp.js +7 -0
- package/ccw/bin/ccw.js +9 -9
- package/ccw/package.json +65 -47
- package/ccw/src/.workflow/.cli-history/history.db +0 -0
- package/ccw/src/.workflow/.cli-history/history.db-shm +0 -0
- package/ccw/src/.workflow/.cli-history/history.db-wal +0 -0
- package/ccw/src/cli.ts +244 -0
- package/ccw/src/commands/cli.ts +740 -0
- package/ccw/src/commands/core-memory.ts +770 -0
- package/ccw/src/commands/hook.ts +315 -0
- package/ccw/src/commands/install.ts +519 -0
- package/ccw/src/commands/{list.js → list.ts} +1 -1
- package/ccw/src/commands/memory.ts +1090 -0
- package/ccw/src/commands/{serve.js → serve.ts} +14 -5
- package/ccw/src/commands/session-path-resolver.ts +372 -0
- package/ccw/src/commands/session.ts +1141 -0
- package/ccw/src/commands/{stop.js → stop.ts} +16 -6
- package/ccw/src/commands/tool.ts +201 -0
- package/ccw/src/commands/{uninstall.js → uninstall.ts} +89 -40
- package/ccw/src/commands/{upgrade.js → upgrade.ts} +68 -23
- package/ccw/src/commands/{view.js → view.ts} +22 -8
- package/ccw/src/config/storage-paths.ts +670 -0
- package/ccw/src/core/cache-manager.ts +294 -0
- package/ccw/src/core/claude-freshness.ts +319 -0
- package/ccw/src/core/core-memory-store.ts +1528 -0
- package/ccw/src/core/{dashboard-generator-patch.js → dashboard-generator-patch.ts} +18 -0
- package/ccw/src/core/{dashboard-generator.js → dashboard-generator.ts} +69 -12
- package/ccw/src/core/data-aggregator.ts +584 -0
- package/ccw/src/core/history-importer.ts +625 -0
- package/ccw/src/core/{lite-scanner.js → lite-scanner-complete.ts} +162 -66
- package/ccw/src/core/lite-scanner.ts +469 -0
- package/ccw/src/core/{manifest.js → manifest.ts} +104 -34
- package/ccw/src/core/memory-embedder-bridge.ts +262 -0
- package/ccw/src/core/memory-store.ts +978 -0
- package/ccw/src/core/routes/ccw-routes.ts +96 -0
- package/ccw/src/core/routes/claude-routes.ts +1183 -0
- package/ccw/src/core/routes/cli-routes.ts +561 -0
- package/ccw/src/core/routes/codexlens-routes.ts +806 -0
- package/ccw/src/core/routes/core-memory-routes.ts +605 -0
- package/ccw/src/core/routes/files-routes.ts +428 -0
- package/ccw/src/core/routes/graph-routes.md +164 -0
- package/ccw/src/core/routes/graph-routes.ts +626 -0
- package/ccw/src/core/routes/help-routes.ts +308 -0
- package/ccw/src/core/routes/hooks-routes.ts +405 -0
- package/ccw/src/core/routes/mcp-routes.ts +1271 -0
- package/ccw/src/core/routes/mcp-routes.ts.backup +550 -0
- package/ccw/src/core/routes/mcp-templates-db.ts +268 -0
- package/ccw/src/core/routes/memory-routes.ts +1206 -0
- package/ccw/src/core/routes/rules-routes.ts +526 -0
- package/ccw/src/core/routes/session-routes.ts +467 -0
- package/ccw/src/core/routes/skills-routes.ts +599 -0
- package/ccw/src/core/routes/status-routes.ts +57 -0
- package/ccw/src/core/routes/system-routes.ts +427 -0
- package/ccw/src/core/server.ts +431 -0
- package/ccw/src/core/session-clustering-service.ts +1258 -0
- package/ccw/src/core/session-scanner.ts +283 -0
- package/ccw/src/core/websocket.ts +190 -0
- package/ccw/src/{index.js → index.ts} +1 -0
- package/ccw/src/mcp-server/index.ts +186 -0
- package/ccw/src/templates/assets/css/github-dark.min.css +10 -0
- package/ccw/src/templates/assets/css/github.min.css +10 -0
- package/ccw/src/templates/assets/js/cytoscape.min.js +32 -0
- package/ccw/src/templates/assets/js/d3.min.js +2 -0
- package/ccw/src/templates/assets/js/highlight.min.js +1244 -0
- package/ccw/src/templates/assets/js/lucide.min.js +12 -0
- package/ccw/src/templates/assets/js/marked.min.js +69 -0
- package/ccw/src/templates/assets/js/tailwind.js +83 -0
- package/ccw/src/templates/dashboard-css/01-base.css +11 -0
- package/ccw/src/templates/dashboard-css/02-session.css +22 -0
- package/ccw/src/templates/dashboard-css/04-lite-tasks.css +10 -0
- package/ccw/src/templates/dashboard-css/06-cards.css +10 -4
- package/ccw/src/templates/dashboard-css/07-managers.css +1178 -7
- package/ccw/src/templates/dashboard-css/09-explorer.css +23 -12
- package/ccw/src/templates/dashboard-css/10-cli-status.css +337 -0
- package/ccw/src/templates/dashboard-css/11-cli-history.css +271 -0
- package/ccw/src/templates/dashboard-css/12-cli-legacy.css +796 -0
- package/ccw/src/templates/dashboard-css/13-cli-ccw.css +199 -0
- package/ccw/src/templates/dashboard-css/14-cli-modals.css +258 -0
- package/ccw/src/templates/dashboard-css/15-cli-endpoints.css +305 -0
- package/ccw/src/templates/dashboard-css/16-cli-session.css +241 -0
- package/ccw/src/templates/dashboard-css/17-cli-conversation.css +283 -0
- package/ccw/src/templates/dashboard-css/18-cli-settings.css +160 -0
- package/ccw/src/templates/dashboard-css/19-cli-native-session.css +496 -0
- package/ccw/src/templates/dashboard-css/20-cli-taskqueue.css +188 -0
- package/ccw/src/templates/dashboard-css/21-cli-toolmgmt.css +310 -0
- package/ccw/src/templates/dashboard-css/22-cli-semantic.css +240 -0
- package/ccw/src/templates/dashboard-css/23-memory.css +2390 -0
- package/ccw/src/templates/dashboard-css/24-prompt-history.css +1089 -0
- package/ccw/src/templates/dashboard-css/25-skills-rules.css +326 -0
- package/ccw/src/templates/dashboard-css/26-claude-manager.css +908 -0
- package/ccw/src/templates/dashboard-css/27-graph-explorer.css +1678 -0
- package/ccw/src/templates/dashboard-css/28-mcp-manager.css +748 -0
- package/ccw/src/templates/dashboard-css/29-help.css +264 -0
- package/ccw/src/templates/dashboard-css/30-core-memory.css +1700 -0
- package/ccw/src/templates/dashboard-js/api.js +162 -142
- package/ccw/src/templates/dashboard-js/components/carousel.js +4 -4
- package/ccw/src/templates/dashboard-js/components/cli-history.js +876 -0
- package/ccw/src/templates/dashboard-js/components/cli-status.js +978 -0
- package/ccw/src/templates/dashboard-js/components/global-notifications.js +508 -219
- package/ccw/src/templates/dashboard-js/components/hook-manager.js +1277 -282
- package/ccw/src/templates/dashboard-js/components/index-manager.js +302 -0
- package/ccw/src/templates/dashboard-js/components/mcp-manager.js +718 -27
- package/ccw/src/templates/dashboard-js/components/modals.js +66 -0
- package/ccw/src/templates/dashboard-js/components/navigation.js +80 -12
- package/ccw/src/templates/dashboard-js/components/notifications.js +758 -194
- package/ccw/src/templates/dashboard-js/components/storage-manager.js +478 -0
- package/ccw/src/templates/dashboard-js/components/tabs-other.js +157 -6
- package/ccw/src/templates/dashboard-js/components/task-queue-sidebar.js +716 -0
- package/ccw/src/templates/dashboard-js/help-i18n.js +272 -0
- package/ccw/src/templates/dashboard-js/i18n.js +2807 -0
- package/ccw/src/templates/dashboard-js/main.js +15 -0
- package/ccw/src/templates/dashboard-js/state.js +243 -42
- package/ccw/src/templates/dashboard-js/utils.js +47 -1
- package/ccw/src/templates/dashboard-js/views/claude-manager.js +912 -0
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +2272 -0
- package/ccw/src/templates/dashboard-js/views/codexlens-manager.js +964 -0
- package/ccw/src/templates/dashboard-js/views/core-memory-clusters.js +503 -0
- package/ccw/src/templates/dashboard-js/views/core-memory.js +782 -0
- package/ccw/src/templates/dashboard-js/views/explorer.js +888 -852
- package/ccw/src/templates/dashboard-js/views/graph-explorer.js +1157 -0
- package/ccw/src/templates/dashboard-js/views/help.js +856 -0
- package/ccw/src/templates/dashboard-js/views/history.js +337 -0
- package/ccw/src/templates/dashboard-js/views/home.js +61 -15
- package/ccw/src/templates/dashboard-js/views/hook-manager.js +311 -43
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +204 -28
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js +2187 -411
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js.backup +1729 -0
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js.new +928 -0
- package/ccw/src/templates/dashboard-js/views/memory.js +1221 -0
- package/ccw/src/templates/dashboard-js/views/prompt-history.js +713 -0
- package/ccw/src/templates/dashboard-js/views/rules-manager.js +828 -0
- package/ccw/src/templates/dashboard-js/views/session-detail.js +54 -53
- package/ccw/src/templates/dashboard-js/views/skills-manager.js +819 -0
- package/ccw/src/templates/dashboard.html +185 -85
- package/ccw/src/templates/hooks-config-example.json +60 -0
- package/ccw/src/tools/classify-folders.ts +245 -0
- package/ccw/src/tools/cli-config-manager.ts +268 -0
- package/ccw/src/tools/cli-executor.ts +2014 -0
- package/ccw/src/tools/cli-history-store.ts +1195 -0
- package/ccw/src/tools/codex-lens.ts +1141 -0
- package/ccw/src/tools/{convert-tokens-to-css.js → convert-tokens-to-css.ts} +73 -23
- package/ccw/src/tools/core-memory.ts +444 -0
- package/ccw/src/tools/detect-changed-modules.ts +325 -0
- package/ccw/src/tools/{discover-design-files.js → discover-design-files.ts} +74 -24
- package/ccw/src/tools/edit-file.ts +568 -0
- package/ccw/src/tools/{generate-module-docs.js → generate-module-docs.ts} +207 -185
- package/ccw/src/tools/{get-modules-by-depth.js → get-modules-by-depth.ts} +120 -79
- package/ccw/src/tools/index.ts +370 -0
- package/ccw/src/tools/native-session-discovery.ts +795 -0
- package/ccw/src/tools/notifier.ts +129 -0
- package/ccw/src/tools/read-file.ts +410 -0
- package/ccw/src/tools/resume-strategy.ts +345 -0
- package/ccw/src/tools/session-content-parser.ts +619 -0
- package/ccw/src/tools/session-manager.ts +1026 -0
- package/ccw/src/tools/smart-context.ts +228 -0
- package/ccw/src/tools/smart-search.ts +2065 -0
- package/ccw/src/tools/smart-search.ts.backup +1233 -0
- package/ccw/src/tools/storage-manager.ts +455 -0
- package/ccw/src/tools/write-file.ts +222 -0
- package/ccw/src/types/config.ts +11 -0
- package/ccw/src/types/index.ts +3 -0
- package/ccw/src/types/session.ts +25 -0
- package/ccw/src/types/tool.ts +41 -0
- package/ccw/src/utils/{browser-launcher.js → browser-launcher.ts} +10 -8
- package/ccw/src/utils/file-utils.ts +48 -0
- package/ccw/src/utils/{path-resolver.js → path-resolver.ts} +114 -78
- package/ccw/src/utils/path-validator.ts +153 -0
- package/ccw/src/utils/{ui.js → ui.ts} +32 -25
- package/codex-lens/pyproject.toml +48 -0
- package/codex-lens/src/codexlens/.workflow/.cli-history/history.db +0 -0
- package/codex-lens/src/codexlens/__init__.py +28 -0
- package/codex-lens/src/codexlens/__main__.py +14 -0
- package/codex-lens/src/codexlens/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/__main__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/config.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/entities.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/errors.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__init__.py +27 -0
- package/codex-lens/src/codexlens/cli/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/commands.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/embedding_manager.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/model_manager.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/output.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/cli/commands.py +1931 -0
- package/codex-lens/src/codexlens/cli/embedding_manager.py +620 -0
- package/codex-lens/src/codexlens/cli/model_manager.py +289 -0
- package/codex-lens/src/codexlens/cli/output.py +124 -0
- package/codex-lens/src/codexlens/config.py +201 -0
- package/codex-lens/src/codexlens/entities.py +121 -0
- package/codex-lens/src/codexlens/errors.py +55 -0
- package/codex-lens/src/codexlens/indexing/README.md +77 -0
- package/codex-lens/src/codexlens/indexing/__init__.py +4 -0
- package/codex-lens/src/codexlens/indexing/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/indexing/__pycache__/symbol_extractor.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/indexing/symbol_extractor.py +243 -0
- package/codex-lens/src/codexlens/parsers/__init__.py +8 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/encoding.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/factory.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/tokenizer.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/treesitter_parser.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/encoding.py +202 -0
- package/codex-lens/src/codexlens/parsers/factory.py +256 -0
- package/codex-lens/src/codexlens/parsers/tokenizer.py +98 -0
- package/codex-lens/src/codexlens/parsers/treesitter_parser.py +335 -0
- package/codex-lens/src/codexlens/search/__init__.py +15 -0
- package/codex-lens/src/codexlens/search/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/chain_search.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/enrichment.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/hybrid_search.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/query_parser.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/chain_search.py +647 -0
- package/codex-lens/src/codexlens/search/enrichment.py +150 -0
- package/codex-lens/src/codexlens/search/hybrid_search.py +313 -0
- package/codex-lens/src/codexlens/search/query_parser.py +242 -0
- package/codex-lens/src/codexlens/search/ranking.py +274 -0
- package/codex-lens/src/codexlens/semantic/__init__.py +39 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/ann_index.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/chunker.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/code_extractor.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/embedder.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/graph_analyzer.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/llm_enhancer.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/vector_store.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/ann_index.py +414 -0
- package/codex-lens/src/codexlens/semantic/chunker.py +448 -0
- package/codex-lens/src/codexlens/semantic/code_extractor.py +274 -0
- package/codex-lens/src/codexlens/semantic/embedder.py +185 -0
- package/codex-lens/src/codexlens/semantic/vector_store.py +955 -0
- package/codex-lens/src/codexlens/storage/__init__.py +29 -0
- package/codex-lens/src/codexlens/storage/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/dir_index.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/file_cache.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/index_tree.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/migration_manager.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/path_mapper.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/registry.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/sqlite_store.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/sqlite_utils.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/dir_index.py +1850 -0
- package/codex-lens/src/codexlens/storage/file_cache.py +32 -0
- package/codex-lens/src/codexlens/storage/index_tree.py +776 -0
- package/codex-lens/src/codexlens/storage/migration_manager.py +154 -0
- package/codex-lens/src/codexlens/storage/migrations/__init__.py +1 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_001_normalize_keywords.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_002_add_token_metadata.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_003_code_relationships.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_004_dual_fts.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_005_cleanup_unused_fields.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/migration_001_normalize_keywords.py +123 -0
- package/codex-lens/src/codexlens/storage/migrations/migration_002_add_token_metadata.py +48 -0
- package/codex-lens/src/codexlens/storage/migrations/migration_004_dual_fts.py +232 -0
- package/codex-lens/src/codexlens/storage/migrations/migration_005_cleanup_unused_fields.py +196 -0
- package/codex-lens/src/codexlens/storage/path_mapper.py +274 -0
- package/codex-lens/src/codexlens/storage/registry.py +670 -0
- package/codex-lens/src/codexlens/storage/sqlite_store.py +576 -0
- package/codex-lens/src/codexlens/storage/sqlite_utils.py +64 -0
- package/package.json +4 -1
- package/.claude/commands/memory/tech-research.md +0 -477
- package/.claude/scripts/classify-folders.sh +0 -39
- package/.claude/scripts/convert_tokens_to_css.sh +0 -229
- package/.claude/scripts/detect_changed_modules.sh +0 -161
- package/.claude/scripts/discover-design-files.sh +0 -87
- package/.claude/scripts/extract-animations.js +0 -243
- package/.claude/scripts/extract-computed-styles.js +0 -118
- package/.claude/scripts/extract-layout-structure.js +0 -411
- package/.claude/scripts/generate_module_docs.sh +0 -717
- package/.claude/scripts/get_modules_by_depth.sh +0 -170
- package/.claude/scripts/ui-generate-preview.sh +0 -395
- package/.claude/scripts/ui-instantiate-prototypes.sh +0 -815
- package/.claude/scripts/update_module_claude.sh +0 -337
- package/.claude/workflows/context-search-strategy.md +0 -77
- package/.claude/workflows/intelligent-tools-strategy.md +0 -662
- package/ccw/src/cli.js +0 -119
- package/ccw/src/commands/install.js +0 -324
- package/ccw/src/commands/tool.js +0 -138
- package/ccw/src/core/data-aggregator.js +0 -409
- package/ccw/src/core/server.js +0 -2063
- package/ccw/src/core/session-scanner.js +0 -235
- package/ccw/src/tools/classify-folders.js +0 -204
- package/ccw/src/tools/detect-changed-modules.js +0 -288
- package/ccw/src/tools/edit-file.js +0 -266
- package/ccw/src/tools/index.js +0 -176
- package/ccw/src/utils/file-utils.js +0 -48
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* Scan project structure and organize modules by directory depth (deepest first)
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import type { ToolSchema, ToolResult } from '../types/tool.js';
|
|
6
8
|
import { readdirSync, statSync, existsSync, readFileSync } from 'fs';
|
|
7
9
|
import { join, resolve, relative, extname } from 'path';
|
|
8
10
|
|
|
@@ -46,12 +48,35 @@ const SYSTEM_EXCLUDES = [
|
|
|
46
48
|
'MemoryCaptures', 'UserSettings'
|
|
47
49
|
];
|
|
48
50
|
|
|
51
|
+
// Define Zod schema for validation
|
|
52
|
+
const ParamsSchema = z.object({
|
|
53
|
+
format: z.enum(['list', 'grouped', 'json']).default('list'),
|
|
54
|
+
path: z.string().default('.'),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
type Params = z.infer<typeof ParamsSchema>;
|
|
58
|
+
|
|
59
|
+
interface ModuleInfo {
|
|
60
|
+
depth: number;
|
|
61
|
+
path: string;
|
|
62
|
+
files: number;
|
|
63
|
+
types: string[];
|
|
64
|
+
has_claude: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface ToolOutput {
|
|
68
|
+
format: string;
|
|
69
|
+
total_modules: number;
|
|
70
|
+
max_depth: number;
|
|
71
|
+
output: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
49
74
|
/**
|
|
50
75
|
* Parse .gitignore file and return patterns
|
|
51
76
|
*/
|
|
52
|
-
function parseGitignore(basePath) {
|
|
77
|
+
function parseGitignore(basePath: string): string[] {
|
|
53
78
|
const gitignorePath = join(basePath, '.gitignore');
|
|
54
|
-
const patterns = [];
|
|
79
|
+
const patterns: string[] = [];
|
|
55
80
|
|
|
56
81
|
if (existsSync(gitignorePath)) {
|
|
57
82
|
const content = readFileSync(gitignorePath, 'utf8');
|
|
@@ -71,7 +96,7 @@ function parseGitignore(basePath) {
|
|
|
71
96
|
/**
|
|
72
97
|
* Check if a path should be excluded
|
|
73
98
|
*/
|
|
74
|
-
function shouldExclude(name, gitignorePatterns) {
|
|
99
|
+
function shouldExclude(name: string, gitignorePatterns: string[]): boolean {
|
|
75
100
|
// Check system excludes
|
|
76
101
|
if (SYSTEM_EXCLUDES.includes(name)) return true;
|
|
77
102
|
|
|
@@ -91,8 +116,8 @@ function shouldExclude(name, gitignorePatterns) {
|
|
|
91
116
|
/**
|
|
92
117
|
* Get file types in a directory
|
|
93
118
|
*/
|
|
94
|
-
function getFileTypes(dirPath) {
|
|
95
|
-
const types = new Set();
|
|
119
|
+
function getFileTypes(dirPath: string): string[] {
|
|
120
|
+
const types = new Set<string>();
|
|
96
121
|
try {
|
|
97
122
|
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
98
123
|
entries.forEach(entry => {
|
|
@@ -110,7 +135,7 @@ function getFileTypes(dirPath) {
|
|
|
110
135
|
/**
|
|
111
136
|
* Count files in a directory (non-recursive)
|
|
112
137
|
*/
|
|
113
|
-
function countFiles(dirPath) {
|
|
138
|
+
function countFiles(dirPath: string): number {
|
|
114
139
|
try {
|
|
115
140
|
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
116
141
|
return entries.filter(e => e.isFile()).length;
|
|
@@ -122,7 +147,13 @@ function countFiles(dirPath) {
|
|
|
122
147
|
/**
|
|
123
148
|
* Recursively scan directories and collect info
|
|
124
149
|
*/
|
|
125
|
-
function scanDirectories(
|
|
150
|
+
function scanDirectories(
|
|
151
|
+
basePath: string,
|
|
152
|
+
currentPath: string,
|
|
153
|
+
depth: number,
|
|
154
|
+
gitignorePatterns: string[],
|
|
155
|
+
results: ModuleInfo[]
|
|
156
|
+
): void {
|
|
126
157
|
try {
|
|
127
158
|
const entries = readdirSync(currentPath, { withFileTypes: true });
|
|
128
159
|
|
|
@@ -159,7 +190,7 @@ function scanDirectories(basePath, currentPath, depth, gitignorePatterns, result
|
|
|
159
190
|
/**
|
|
160
191
|
* Format output as list (default)
|
|
161
192
|
*/
|
|
162
|
-
function formatList(results) {
|
|
193
|
+
function formatList(results: ModuleInfo[]): string {
|
|
163
194
|
// Sort by depth descending (deepest first)
|
|
164
195
|
results.sort((a, b) => b.depth - a.depth);
|
|
165
196
|
|
|
@@ -171,7 +202,7 @@ function formatList(results) {
|
|
|
171
202
|
/**
|
|
172
203
|
* Format output as grouped
|
|
173
204
|
*/
|
|
174
|
-
function formatGrouped(results) {
|
|
205
|
+
function formatGrouped(results: ModuleInfo[]): string {
|
|
175
206
|
// Sort by depth descending
|
|
176
207
|
results.sort((a, b) => b.depth - a.depth);
|
|
177
208
|
|
|
@@ -195,12 +226,12 @@ function formatGrouped(results) {
|
|
|
195
226
|
/**
|
|
196
227
|
* Format output as JSON
|
|
197
228
|
*/
|
|
198
|
-
function formatJson(results) {
|
|
229
|
+
function formatJson(results: ModuleInfo[]): string {
|
|
199
230
|
// Sort by depth descending
|
|
200
231
|
results.sort((a, b) => b.depth - a.depth);
|
|
201
232
|
|
|
202
233
|
const maxDepth = results.length > 0 ? Math.max(...results.map(r => r.depth)) : 0;
|
|
203
|
-
const modules = {};
|
|
234
|
+
const modules: Record<number, { path: string; has_claude: boolean }[]> = {};
|
|
204
235
|
|
|
205
236
|
for (let d = maxDepth; d >= 0; d--) {
|
|
206
237
|
const atDepth = results.filter(r => r.depth === d);
|
|
@@ -218,76 +249,13 @@ function formatJson(results) {
|
|
|
218
249
|
}, null, 2);
|
|
219
250
|
}
|
|
220
251
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
*/
|
|
224
|
-
async function execute(params) {
|
|
225
|
-
const { format = 'list', path: targetPath = '.' } = params;
|
|
226
|
-
|
|
227
|
-
const basePath = resolve(process.cwd(), targetPath);
|
|
228
|
-
|
|
229
|
-
if (!existsSync(basePath)) {
|
|
230
|
-
throw new Error(`Directory not found: ${basePath}`);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
const stat = statSync(basePath);
|
|
234
|
-
if (!stat.isDirectory()) {
|
|
235
|
-
throw new Error(`Not a directory: ${basePath}`);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// Parse gitignore
|
|
239
|
-
const gitignorePatterns = parseGitignore(basePath);
|
|
240
|
-
|
|
241
|
-
// Collect results
|
|
242
|
-
const results = [];
|
|
243
|
-
|
|
244
|
-
// Check root directory
|
|
245
|
-
const rootFileCount = countFiles(basePath);
|
|
246
|
-
if (rootFileCount > 0) {
|
|
247
|
-
results.push({
|
|
248
|
-
depth: 0,
|
|
249
|
-
path: '.',
|
|
250
|
-
files: rootFileCount,
|
|
251
|
-
types: getFileTypes(basePath),
|
|
252
|
-
has_claude: existsSync(join(basePath, 'CLAUDE.md'))
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// Scan subdirectories
|
|
257
|
-
scanDirectories(basePath, basePath, 0, gitignorePatterns, results);
|
|
258
|
-
|
|
259
|
-
// Format output
|
|
260
|
-
let output;
|
|
261
|
-
switch (format) {
|
|
262
|
-
case 'grouped':
|
|
263
|
-
output = formatGrouped(results);
|
|
264
|
-
break;
|
|
265
|
-
case 'json':
|
|
266
|
-
output = formatJson(results);
|
|
267
|
-
break;
|
|
268
|
-
case 'list':
|
|
269
|
-
default:
|
|
270
|
-
output = formatList(results);
|
|
271
|
-
break;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return {
|
|
275
|
-
format,
|
|
276
|
-
total_modules: results.length,
|
|
277
|
-
max_depth: results.length > 0 ? Math.max(...results.map(r => r.depth)) : 0,
|
|
278
|
-
output
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Tool Definition
|
|
284
|
-
*/
|
|
285
|
-
export const getModulesByDepthTool = {
|
|
252
|
+
// Tool schema for MCP
|
|
253
|
+
export const schema: ToolSchema = {
|
|
286
254
|
name: 'get_modules_by_depth',
|
|
287
255
|
description: `Scan project structure and organize modules by directory depth (deepest first).
|
|
288
256
|
Respects .gitignore patterns and excludes common system directories.
|
|
289
257
|
Output formats: list (pipe-delimited), grouped (human-readable), json.`,
|
|
290
|
-
|
|
258
|
+
inputSchema: {
|
|
291
259
|
type: 'object',
|
|
292
260
|
properties: {
|
|
293
261
|
format: {
|
|
@@ -303,6 +271,79 @@ Output formats: list (pipe-delimited), grouped (human-readable), json.`,
|
|
|
303
271
|
}
|
|
304
272
|
},
|
|
305
273
|
required: []
|
|
306
|
-
}
|
|
307
|
-
execute
|
|
274
|
+
}
|
|
308
275
|
};
|
|
276
|
+
|
|
277
|
+
// Handler function
|
|
278
|
+
export async function handler(params: Record<string, unknown>): Promise<ToolResult<ToolOutput>> {
|
|
279
|
+
const parsed = ParamsSchema.safeParse(params);
|
|
280
|
+
if (!parsed.success) {
|
|
281
|
+
return { success: false, error: `Invalid params: ${parsed.error.message}` };
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const { format, path: targetPath } = parsed.data;
|
|
285
|
+
|
|
286
|
+
try {
|
|
287
|
+
const basePath = resolve(process.cwd(), targetPath);
|
|
288
|
+
|
|
289
|
+
if (!existsSync(basePath)) {
|
|
290
|
+
return { success: false, error: `Directory not found: ${basePath}` };
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const stat = statSync(basePath);
|
|
294
|
+
if (!stat.isDirectory()) {
|
|
295
|
+
return { success: false, error: `Not a directory: ${basePath}` };
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Parse gitignore
|
|
299
|
+
const gitignorePatterns = parseGitignore(basePath);
|
|
300
|
+
|
|
301
|
+
// Collect results
|
|
302
|
+
const results: ModuleInfo[] = [];
|
|
303
|
+
|
|
304
|
+
// Check root directory
|
|
305
|
+
const rootFileCount = countFiles(basePath);
|
|
306
|
+
if (rootFileCount > 0) {
|
|
307
|
+
results.push({
|
|
308
|
+
depth: 0,
|
|
309
|
+
path: '.',
|
|
310
|
+
files: rootFileCount,
|
|
311
|
+
types: getFileTypes(basePath),
|
|
312
|
+
has_claude: existsSync(join(basePath, 'CLAUDE.md'))
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Scan subdirectories
|
|
317
|
+
scanDirectories(basePath, basePath, 0, gitignorePatterns, results);
|
|
318
|
+
|
|
319
|
+
// Format output
|
|
320
|
+
let output: string;
|
|
321
|
+
switch (format) {
|
|
322
|
+
case 'grouped':
|
|
323
|
+
output = formatGrouped(results);
|
|
324
|
+
break;
|
|
325
|
+
case 'json':
|
|
326
|
+
output = formatJson(results);
|
|
327
|
+
break;
|
|
328
|
+
case 'list':
|
|
329
|
+
default:
|
|
330
|
+
output = formatList(results);
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return {
|
|
335
|
+
success: true,
|
|
336
|
+
result: {
|
|
337
|
+
format,
|
|
338
|
+
total_modules: results.length,
|
|
339
|
+
max_depth: results.length > 0 ? Math.max(...results.map(r => r.depth)) : 0,
|
|
340
|
+
output
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
} catch (error) {
|
|
344
|
+
return {
|
|
345
|
+
success: false,
|
|
346
|
+
error: `Failed to scan modules: ${(error as Error).message}`
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Registry - MCP-like tool system for CCW
|
|
3
|
+
* Provides tool discovery, validation, and execution
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import http from 'http';
|
|
7
|
+
import type { ToolSchema, ToolResult } from '../types/tool.js';
|
|
8
|
+
|
|
9
|
+
// Import TypeScript migrated tools (schema + handler)
|
|
10
|
+
import * as editFileMod from './edit-file.js';
|
|
11
|
+
import * as writeFileMod from './write-file.js';
|
|
12
|
+
import * as getModulesByDepthMod from './get-modules-by-depth.js';
|
|
13
|
+
import * as classifyFoldersMod from './classify-folders.js';
|
|
14
|
+
import * as detectChangedModulesMod from './detect-changed-modules.js';
|
|
15
|
+
import * as discoverDesignFilesMod from './discover-design-files.js';
|
|
16
|
+
import * as generateModuleDocsMod from './generate-module-docs.js';
|
|
17
|
+
import * as convertTokensToCssMod from './convert-tokens-to-css.js';
|
|
18
|
+
import * as sessionManagerMod from './session-manager.js';
|
|
19
|
+
import * as cliExecutorMod from './cli-executor.js';
|
|
20
|
+
import * as smartSearchMod from './smart-search.js';
|
|
21
|
+
import { executeInitWithProgress } from './smart-search.js';
|
|
22
|
+
// codex_lens removed - functionality integrated into smart_search
|
|
23
|
+
import * as readFileMod from './read-file.js';
|
|
24
|
+
import * as coreMemoryMod from './core-memory.js';
|
|
25
|
+
import type { ProgressInfo } from './codex-lens.js';
|
|
26
|
+
|
|
27
|
+
// Import legacy JS tools
|
|
28
|
+
import { uiGeneratePreviewTool } from './ui-generate-preview.js';
|
|
29
|
+
import { uiInstantiatePrototypesTool } from './ui-instantiate-prototypes.js';
|
|
30
|
+
import { updateModuleClaudeTool } from './update-module-claude.js';
|
|
31
|
+
|
|
32
|
+
interface LegacyTool {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
parameters: {
|
|
36
|
+
type: string;
|
|
37
|
+
properties: Record<string, unknown>;
|
|
38
|
+
required?: string[];
|
|
39
|
+
};
|
|
40
|
+
execute: (params: Record<string, unknown>) => Promise<unknown>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Tool registry
|
|
44
|
+
const tools = new Map<string, LegacyTool>();
|
|
45
|
+
|
|
46
|
+
// Dashboard notification settings
|
|
47
|
+
const DASHBOARD_PORT = process.env.CCW_PORT || 3456;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Notify dashboard of tool execution events (fire and forget)
|
|
51
|
+
*/
|
|
52
|
+
function notifyDashboard(data: Record<string, unknown>): void {
|
|
53
|
+
const payload = JSON.stringify({
|
|
54
|
+
type: 'tool_execution',
|
|
55
|
+
...data,
|
|
56
|
+
timestamp: new Date().toISOString()
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const req = http.request({
|
|
60
|
+
hostname: 'localhost',
|
|
61
|
+
port: Number(DASHBOARD_PORT),
|
|
62
|
+
path: '/api/hook',
|
|
63
|
+
method: 'POST',
|
|
64
|
+
headers: {
|
|
65
|
+
'Content-Type': 'application/json',
|
|
66
|
+
'Content-Length': Buffer.byteLength(payload)
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Fire and forget - log errors only in debug mode
|
|
71
|
+
req.on('error', (err) => {
|
|
72
|
+
if (process.env.DEBUG) console.error('[Dashboard] Tool notification failed:', err.message);
|
|
73
|
+
});
|
|
74
|
+
req.write(payload);
|
|
75
|
+
req.end();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Convert new-style tool (schema + handler) to legacy format
|
|
80
|
+
*/
|
|
81
|
+
function toLegacyTool(mod: {
|
|
82
|
+
schema: ToolSchema;
|
|
83
|
+
handler: (params: Record<string, unknown>) => Promise<ToolResult<unknown>>;
|
|
84
|
+
}): LegacyTool {
|
|
85
|
+
return {
|
|
86
|
+
name: mod.schema.name,
|
|
87
|
+
description: mod.schema.description,
|
|
88
|
+
parameters: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: mod.schema.inputSchema?.properties || {},
|
|
91
|
+
required: mod.schema.inputSchema?.required || []
|
|
92
|
+
},
|
|
93
|
+
execute: async (params: Record<string, unknown>) => {
|
|
94
|
+
const result = await mod.handler(params);
|
|
95
|
+
if (!result.success) {
|
|
96
|
+
throw new Error(result.error);
|
|
97
|
+
}
|
|
98
|
+
return result.result;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Register a tool in the registry
|
|
105
|
+
*/
|
|
106
|
+
function registerTool(tool: LegacyTool): void {
|
|
107
|
+
if (!tool.name || !tool.execute) {
|
|
108
|
+
throw new Error('Tool must have name and execute function');
|
|
109
|
+
}
|
|
110
|
+
tools.set(tool.name, tool);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Get all registered tools
|
|
115
|
+
*/
|
|
116
|
+
export function listTools(): Array<Omit<LegacyTool, 'execute'>> {
|
|
117
|
+
return Array.from(tools.values()).map(tool => ({
|
|
118
|
+
name: tool.name,
|
|
119
|
+
description: tool.description,
|
|
120
|
+
parameters: tool.parameters
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Get a specific tool by name
|
|
126
|
+
*/
|
|
127
|
+
export function getTool(name: string): LegacyTool | null {
|
|
128
|
+
return tools.get(name) || null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Validate parameters against tool schema
|
|
133
|
+
*/
|
|
134
|
+
function validateParams(tool: LegacyTool, params: Record<string, unknown>): {
|
|
135
|
+
valid: boolean;
|
|
136
|
+
errors: string[];
|
|
137
|
+
} {
|
|
138
|
+
const errors: string[] = [];
|
|
139
|
+
const schema = tool.parameters;
|
|
140
|
+
|
|
141
|
+
if (!schema || !schema.properties) {
|
|
142
|
+
return { valid: true, errors: [] };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Check required parameters
|
|
146
|
+
const required = schema.required || [];
|
|
147
|
+
for (const req of required) {
|
|
148
|
+
if (params[req] === undefined || params[req] === null) {
|
|
149
|
+
errors.push(`Missing required parameter: ${req}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Type validation
|
|
154
|
+
for (const [key, value] of Object.entries(params)) {
|
|
155
|
+
const propSchema = schema.properties[key] as { type?: string };
|
|
156
|
+
if (!propSchema) {
|
|
157
|
+
continue; // Allow extra params
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (propSchema.type === 'string' && typeof value !== 'string') {
|
|
161
|
+
errors.push(`Parameter '${key}' must be a string`);
|
|
162
|
+
}
|
|
163
|
+
if (propSchema.type === 'boolean' && typeof value !== 'boolean') {
|
|
164
|
+
errors.push(`Parameter '${key}' must be a boolean`);
|
|
165
|
+
}
|
|
166
|
+
if (propSchema.type === 'number' && typeof value !== 'number') {
|
|
167
|
+
errors.push(`Parameter '${key}' must be a number`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return { valid: errors.length === 0, errors };
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Execute a tool with given parameters
|
|
176
|
+
*/
|
|
177
|
+
export async function executeTool(name: string, params: Record<string, unknown> = {}): Promise<{
|
|
178
|
+
success: boolean;
|
|
179
|
+
result?: unknown;
|
|
180
|
+
error?: string;
|
|
181
|
+
}> {
|
|
182
|
+
const tool = tools.get(name);
|
|
183
|
+
|
|
184
|
+
if (!tool) {
|
|
185
|
+
return {
|
|
186
|
+
success: false,
|
|
187
|
+
error: `Tool not found: ${name}`
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Validate parameters
|
|
192
|
+
const validation = validateParams(tool, params);
|
|
193
|
+
if (!validation.valid) {
|
|
194
|
+
return {
|
|
195
|
+
success: false,
|
|
196
|
+
error: `Parameter validation failed: ${validation.errors.join(', ')}`
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Notify dashboard - execution started
|
|
201
|
+
notifyDashboard({
|
|
202
|
+
toolName: name,
|
|
203
|
+
status: 'started',
|
|
204
|
+
params: sanitizeParams(params)
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// Execute tool
|
|
208
|
+
try {
|
|
209
|
+
const result = await tool.execute(params);
|
|
210
|
+
|
|
211
|
+
// Notify dashboard - execution completed
|
|
212
|
+
notifyDashboard({
|
|
213
|
+
toolName: name,
|
|
214
|
+
status: 'completed',
|
|
215
|
+
result: sanitizeResult(result)
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
return {
|
|
219
|
+
success: true,
|
|
220
|
+
result
|
|
221
|
+
};
|
|
222
|
+
} catch (error) {
|
|
223
|
+
// Notify dashboard - execution failed
|
|
224
|
+
notifyDashboard({
|
|
225
|
+
toolName: name,
|
|
226
|
+
status: 'failed',
|
|
227
|
+
error: (error as Error).message || 'Tool execution failed'
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
return {
|
|
231
|
+
success: false,
|
|
232
|
+
error: (error as Error).message || 'Tool execution failed'
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Sanitize params for notification (truncate large values)
|
|
239
|
+
*/
|
|
240
|
+
function sanitizeParams(params: Record<string, unknown>): Record<string, unknown> {
|
|
241
|
+
const sanitized: Record<string, unknown> = {};
|
|
242
|
+
for (const [key, value] of Object.entries(params)) {
|
|
243
|
+
if (typeof value === 'string' && value.length > 200) {
|
|
244
|
+
sanitized[key] = value.substring(0, 200) + '...';
|
|
245
|
+
} else if (typeof value === 'object' && value !== null) {
|
|
246
|
+
sanitized[key] = '[Object]';
|
|
247
|
+
} else {
|
|
248
|
+
sanitized[key] = value;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return sanitized;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Sanitize result for notification (truncate large values)
|
|
256
|
+
*/
|
|
257
|
+
function sanitizeResult(result: unknown): unknown {
|
|
258
|
+
if (result === null || result === undefined) return result;
|
|
259
|
+
const str = JSON.stringify(result);
|
|
260
|
+
if (str.length > 500) {
|
|
261
|
+
return { _truncated: true, preview: str.substring(0, 500) + '...' };
|
|
262
|
+
}
|
|
263
|
+
return result;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Execute a tool with progress callback (for init actions)
|
|
268
|
+
*/
|
|
269
|
+
export async function executeToolWithProgress(
|
|
270
|
+
name: string,
|
|
271
|
+
params: Record<string, unknown> = {},
|
|
272
|
+
onProgress?: (progress: ProgressInfo) => void
|
|
273
|
+
): Promise<{
|
|
274
|
+
success: boolean;
|
|
275
|
+
result?: unknown;
|
|
276
|
+
error?: string;
|
|
277
|
+
}> {
|
|
278
|
+
// For smart_search init, use special progress-aware execution
|
|
279
|
+
if (name === 'smart_search' && params.action === 'init') {
|
|
280
|
+
try {
|
|
281
|
+
// Notify dashboard - execution started
|
|
282
|
+
notifyDashboard({
|
|
283
|
+
toolName: name,
|
|
284
|
+
status: 'started',
|
|
285
|
+
params: sanitizeParams(params)
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
const result = await executeInitWithProgress(params, onProgress);
|
|
289
|
+
|
|
290
|
+
// Notify dashboard - execution completed
|
|
291
|
+
notifyDashboard({
|
|
292
|
+
toolName: name,
|
|
293
|
+
status: 'completed',
|
|
294
|
+
result: sanitizeResult(result)
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
return {
|
|
298
|
+
success: result.success,
|
|
299
|
+
result,
|
|
300
|
+
error: result.error
|
|
301
|
+
};
|
|
302
|
+
} catch (error) {
|
|
303
|
+
notifyDashboard({
|
|
304
|
+
toolName: name,
|
|
305
|
+
status: 'failed',
|
|
306
|
+
error: (error as Error).message || 'Tool execution failed'
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
return {
|
|
310
|
+
success: false,
|
|
311
|
+
error: (error as Error).message || 'Tool execution failed'
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Fall back to regular execution for other tools
|
|
317
|
+
return executeTool(name, params);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Get tool schema in MCP-compatible format
|
|
322
|
+
*/
|
|
323
|
+
export function getToolSchema(name: string): ToolSchema | null {
|
|
324
|
+
const tool = tools.get(name);
|
|
325
|
+
if (!tool) return null;
|
|
326
|
+
|
|
327
|
+
return {
|
|
328
|
+
name: tool.name,
|
|
329
|
+
description: tool.description,
|
|
330
|
+
inputSchema: {
|
|
331
|
+
type: 'object',
|
|
332
|
+
properties: tool.parameters?.properties || {},
|
|
333
|
+
required: tool.parameters?.required || []
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Get all tool schemas in MCP-compatible format
|
|
340
|
+
*/
|
|
341
|
+
export function getAllToolSchemas(): ToolSchema[] {
|
|
342
|
+
return Array.from(tools.keys()).map(name => getToolSchema(name)).filter((s): s is ToolSchema => s !== null);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// Register TypeScript migrated tools
|
|
346
|
+
registerTool(toLegacyTool(editFileMod));
|
|
347
|
+
registerTool(toLegacyTool(writeFileMod));
|
|
348
|
+
registerTool(toLegacyTool(getModulesByDepthMod));
|
|
349
|
+
registerTool(toLegacyTool(classifyFoldersMod));
|
|
350
|
+
registerTool(toLegacyTool(detectChangedModulesMod));
|
|
351
|
+
registerTool(toLegacyTool(discoverDesignFilesMod));
|
|
352
|
+
registerTool(toLegacyTool(generateModuleDocsMod));
|
|
353
|
+
registerTool(toLegacyTool(convertTokensToCssMod));
|
|
354
|
+
registerTool(toLegacyTool(sessionManagerMod));
|
|
355
|
+
registerTool(toLegacyTool(cliExecutorMod));
|
|
356
|
+
registerTool(toLegacyTool(smartSearchMod));
|
|
357
|
+
// codex_lens removed - functionality integrated into smart_search
|
|
358
|
+
registerTool(toLegacyTool(readFileMod));
|
|
359
|
+
registerTool(toLegacyTool(coreMemoryMod));
|
|
360
|
+
|
|
361
|
+
// Register legacy JS tools
|
|
362
|
+
registerTool(uiGeneratePreviewTool);
|
|
363
|
+
registerTool(uiInstantiatePrototypesTool);
|
|
364
|
+
registerTool(updateModuleClaudeTool);
|
|
365
|
+
|
|
366
|
+
// Export for external tool registration
|
|
367
|
+
export { registerTool };
|
|
368
|
+
|
|
369
|
+
// Export ToolSchema type
|
|
370
|
+
export type { ToolSchema };
|