claude-code-workflow 6.3.53 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/action-planning-agent.md +358 -188
- package/.claude/agents/cli-execution-agent.md +13 -12
- package/.claude/agents/cli-explore-agent.md +66 -11
- package/.claude/agents/cli-lite-planning-agent.md +908 -892
- package/.claude/agents/cli-roadmap-plan-agent.md +1001 -0
- package/.claude/agents/code-developer.md +75 -85
- package/.claude/agents/conceptual-planning-agent.md +49 -19
- package/.claude/agents/context-search-agent.md +96 -19
- package/.claude/agents/debug-explore-agent.md +439 -436
- package/.claude/agents/issue-plan-agent.md +15 -11
- package/.claude/agents/memory-bridge.md +2 -2
- package/.claude/agents/tdd-developer.md +84 -107
- package/.claude/agents/team-worker.md +440 -0
- package/.claude/agents/test-action-planning-agent.md +684 -0
- package/.claude/agents/test-fix-agent.md +24 -12
- package/.claude/agents/ui-design-agent.md +3 -3
- package/.claude/agents/universal-executor.md +1 -1
- package/.claude/commands/ccw-coordinator.md +316 -62
- package/.claude/commands/ccw.md +502 -172
- package/.claude/commands/cli/cli-init.md +441 -441
- package/.claude/commands/flow-create.md +666 -0
- package/.claude/commands/issue/convert-to-plan.md +21 -19
- package/.claude/commands/issue/discover-by-prompt.md +2 -2
- package/.claude/commands/issue/discover.md +4 -4
- package/.claude/commands/issue/execute.md +43 -15
- package/.claude/commands/issue/from-brainstorm.md +5 -5
- package/.claude/commands/issue/plan.md +335 -335
- package/.claude/commands/issue/queue.md +1 -1
- package/.claude/commands/memory/prepare.md +240 -0
- package/.claude/commands/memory/style-skill-memory.md +2 -2
- package/.claude/commands/workflow/analyze-with-file.md +639 -667
- package/.claude/commands/workflow/brainstorm-with-file.md +779 -1153
- package/.claude/commands/workflow/clean.md +572 -548
- package/.claude/commands/workflow/collaborative-plan-with-file.md +635 -761
- package/.claude/commands/workflow/debug-with-file.md +648 -672
- package/.claude/commands/workflow/init-guidelines.md +447 -0
- package/.claude/commands/workflow/init-specs.md +380 -0
- package/.claude/commands/workflow/init.md +291 -224
- package/.claude/commands/workflow/integration-test-cycle.md +932 -0
- package/.claude/commands/workflow/refactor-cycle.md +852 -0
- package/.claude/commands/workflow/roadmap-with-file.md +544 -0
- package/.claude/commands/workflow/session/complete.md +139 -203
- package/.claude/commands/workflow/session/solidify.md +453 -303
- package/.claude/commands/workflow/session/start.md +202 -202
- package/.claude/commands/workflow/session/sync.md +201 -0
- package/.claude/commands/workflow/ui-design/codify-style.md +20 -20
- package/.claude/commands/workflow/ui-design/design-sync.md +7 -7
- package/.claude/commands/workflow/ui-design/explore-auto.md +16 -16
- package/.claude/commands/workflow/ui-design/generate.md +1 -1
- package/.claude/commands/workflow/ui-design/imitate-auto.md +19 -19
- package/.claude/commands/workflow/ui-design/import-from-code.md +540 -540
- package/.claude/commands/workflow/unified-execute-with-file.md +864 -904
- package/.claude/scripts/cleanup-ghost-commands.mjs +402 -0
- package/.claude/skills/_shared/COMMAND-TO-SKILL-CONVERSION.md +741 -0
- package/.claude/skills/brainstorm/SKILL.md +382 -0
- package/.claude/skills/brainstorm/phases/01-mode-routing.md +207 -0
- package/.claude/skills/brainstorm/phases/02-artifacts.md +457 -0
- package/.claude/skills/brainstorm/phases/03-role-analysis.md +718 -0
- package/.claude/skills/brainstorm/phases/04-synthesis.md +817 -0
- package/.claude/skills/ccw-help/SKILL.md +176 -176
- package/.claude/skills/ccw-help/index/all-commands.json +376 -805
- package/.claude/skills/ccw-help/index/by-category.json +400 -833
- package/.claude/skills/ccw-help/index/by-use-case.json +388 -819
- package/.claude/skills/ccw-help/index/command-relationships.json +15 -160
- package/.claude/skills/ccw-help/index/essential-commands.json +13 -90
- package/.claude/skills/command-generator/SKILL.md +190 -0
- package/.claude/skills/command-generator/phases/01-parameter-validation.md +174 -0
- package/.claude/skills/command-generator/phases/02-target-path-resolution.md +171 -0
- package/.claude/skills/command-generator/phases/03-template-loading.md +123 -0
- package/.claude/skills/command-generator/phases/04-content-formatting.md +184 -0
- package/.claude/skills/command-generator/phases/05-file-generation.md +185 -0
- package/.claude/skills/command-generator/specs/command-design-spec.md +160 -0
- package/.claude/skills/command-generator/templates/command-md.md +75 -0
- package/.claude/skills/issue-manage/SKILL.md +291 -285
- package/.claude/skills/memory-capture/SKILL.md +129 -0
- package/.claude/skills/memory-capture/phases/01-compact.md +254 -0
- package/.claude/skills/memory-capture/phases/02-tips.md +206 -0
- package/.claude/skills/memory-manage/SKILL.md +229 -0
- package/.claude/skills/memory-manage/phases/01-update-full.md +316 -0
- package/.claude/skills/memory-manage/phases/02-update-related.md +267 -0
- package/.claude/skills/memory-manage/phases/03-update-single.md +306 -0
- package/.claude/skills/memory-manage/phases/04-docs-full.md +435 -0
- package/.claude/skills/memory-manage/phases/05-docs-related.md +315 -0
- package/.claude/skills/review-cycle/SKILL.md +128 -0
- package/.claude/skills/review-cycle/phases/review-fix.md +760 -0
- package/.claude/skills/review-cycle/phases/review-module.md +764 -0
- package/.claude/skills/review-cycle/phases/review-session.md +775 -0
- package/.claude/skills/skill-generator/templates/llm-action.md +3 -3
- package/.claude/skills/spec-generator/README.md +81 -0
- package/.claude/skills/spec-generator/SKILL.md +290 -0
- package/.claude/skills/spec-generator/phases/01-5-requirement-clarification.md +404 -0
- package/.claude/skills/spec-generator/phases/01-discovery.md +242 -0
- package/.claude/skills/spec-generator/phases/02-product-brief.md +247 -0
- package/.claude/skills/spec-generator/phases/03-requirements.md +179 -0
- package/.claude/skills/spec-generator/phases/04-architecture.md +213 -0
- package/.claude/skills/spec-generator/phases/05-epics-stories.md +168 -0
- package/.claude/skills/spec-generator/phases/06-readiness-check.md +449 -0
- package/.claude/skills/spec-generator/specs/document-standards.md +248 -0
- package/.claude/skills/spec-generator/specs/quality-gates.md +219 -0
- package/.claude/skills/spec-generator/templates/architecture-doc.md +254 -0
- package/.claude/skills/spec-generator/templates/epics-template.md +196 -0
- package/.claude/skills/spec-generator/templates/product-brief.md +133 -0
- package/.claude/skills/spec-generator/templates/requirements-prd.md +224 -0
- package/.claude/skills/team-brainstorm/SKILL.md +407 -0
- package/.claude/skills/team-brainstorm/roles/challenger.md +167 -0
- package/.claude/skills/team-brainstorm/roles/coordinator.md +257 -0
- package/.claude/skills/team-brainstorm/roles/evaluator.md +157 -0
- package/.claude/skills/team-brainstorm/roles/ideator.md +160 -0
- package/.claude/skills/team-brainstorm/roles/synthesizer.md +168 -0
- package/.claude/skills/team-brainstorm/specs/team-config.json +86 -0
- package/.claude/skills/team-coordinate/SKILL.md +445 -0
- package/.claude/skills/team-coordinate/roles/coordinator/commands/analyze-task.md +197 -0
- package/.claude/skills/team-coordinate/roles/coordinator/commands/dispatch.md +85 -0
- package/.claude/skills/team-coordinate/roles/coordinator/commands/monitor.md +296 -0
- package/.claude/skills/team-coordinate/roles/coordinator/role.md +283 -0
- package/.claude/skills/team-coordinate/specs/role-template.md +434 -0
- package/.claude/skills/team-coordinate/subagents/discuss-subagent.md +133 -0
- package/.claude/skills/team-coordinate/subagents/explore-subagent.md +120 -0
- package/.claude/skills/team-coordinate-v2/SKILL.md +265 -0
- package/.claude/skills/team-coordinate-v2/roles/coordinator/commands/analyze-task.md +185 -0
- package/.claude/skills/team-coordinate-v2/roles/coordinator/commands/dispatch.md +87 -0
- package/.claude/skills/team-coordinate-v2/roles/coordinator/commands/monitor.md +301 -0
- package/.claude/skills/team-coordinate-v2/roles/coordinator/role.md +297 -0
- package/.claude/skills/team-coordinate-v2/specs/role-spec-template.md +295 -0
- package/.claude/skills/team-coordinate-v2/subagents/discuss-subagent.md +133 -0
- package/.claude/skills/team-coordinate-v2/subagents/explore-subagent.md +120 -0
- package/.claude/skills/team-executor/SKILL.md +372 -0
- package/.claude/skills/team-executor/roles/executor/commands/monitor.md +277 -0
- package/.claude/skills/team-executor/roles/executor/role.md +202 -0
- package/.claude/skills/team-executor/specs/session-schema.md +272 -0
- package/.claude/skills/team-executor-v2/SKILL.md +215 -0
- package/.claude/skills/team-executor-v2/roles/executor/commands/monitor.md +239 -0
- package/.claude/skills/team-executor-v2/roles/executor/role.md +171 -0
- package/.claude/skills/team-executor-v2/specs/session-schema.md +264 -0
- package/.claude/skills/team-frontend/SKILL.md +426 -0
- package/.claude/skills/team-frontend/roles/analyst/commands/design-intelligence.md +150 -0
- package/.claude/skills/team-frontend/roles/analyst/role.md +225 -0
- package/.claude/skills/team-frontend/roles/architect/role.md +219 -0
- package/.claude/skills/team-frontend/roles/coordinator/role.md +257 -0
- package/.claude/skills/team-frontend/roles/developer/role.md +238 -0
- package/.claude/skills/team-frontend/roles/qa/commands/pre-delivery-checklist.md +116 -0
- package/.claude/skills/team-frontend/roles/qa/role.md +257 -0
- package/.claude/skills/team-frontend/specs/team-config.json +84 -0
- package/.claude/skills/team-issue/SKILL.md +425 -0
- package/.claude/skills/team-issue/roles/coordinator.md +340 -0
- package/.claude/skills/team-issue/roles/explorer.md +212 -0
- package/.claude/skills/team-issue/roles/implementer.md +322 -0
- package/.claude/skills/team-issue/roles/integrator.md +241 -0
- package/.claude/skills/team-issue/roles/planner.md +207 -0
- package/.claude/skills/team-issue/roles/reviewer.md +268 -0
- package/.claude/skills/team-issue/specs/team-config.json +70 -0
- package/.claude/skills/team-iterdev/SKILL.md +493 -0
- package/.claude/skills/team-iterdev/roles/architect.md +265 -0
- package/.claude/skills/team-iterdev/roles/coordinator.md +423 -0
- package/.claude/skills/team-iterdev/roles/developer.md +280 -0
- package/.claude/skills/team-iterdev/roles/reviewer.md +307 -0
- package/.claude/skills/team-iterdev/roles/tester.md +253 -0
- package/.claude/skills/team-iterdev/specs/team-config.json +172 -0
- package/.claude/skills/team-lifecycle-v3/SKILL.md +384 -0
- package/.claude/skills/team-lifecycle-v3/roles/analyst/role.md +113 -0
- package/.claude/skills/team-lifecycle-v3/roles/architect/commands/assess.md +193 -0
- package/.claude/skills/team-lifecycle-v3/roles/architect/role.md +103 -0
- package/.claude/skills/team-lifecycle-v3/roles/coordinator/commands/dispatch.md +142 -0
- package/.claude/skills/team-lifecycle-v3/roles/coordinator/commands/monitor.md +180 -0
- package/.claude/skills/team-lifecycle-v3/roles/coordinator/role.md +209 -0
- package/.claude/skills/team-lifecycle-v3/roles/discussant/commands/critique.md +136 -0
- package/.claude/skills/team-lifecycle-v3/roles/discussant/role.md +128 -0
- package/.claude/skills/team-lifecycle-v3/roles/executor/commands/implement.md +166 -0
- package/.claude/skills/team-lifecycle-v3/roles/executor/role.md +103 -0
- package/.claude/skills/team-lifecycle-v3/roles/explorer/role.md +91 -0
- package/.claude/skills/team-lifecycle-v3/roles/fe-developer/role.md +111 -0
- package/.claude/skills/team-lifecycle-v3/roles/fe-qa/commands/pre-delivery-checklist.md +152 -0
- package/.claude/skills/team-lifecycle-v3/roles/fe-qa/role.md +113 -0
- package/.claude/skills/team-lifecycle-v3/roles/planner/commands/explore.md +154 -0
- package/.claude/skills/team-lifecycle-v3/roles/planner/role.md +120 -0
- package/.claude/skills/team-lifecycle-v3/roles/reviewer/commands/code-review.md +163 -0
- package/.claude/skills/team-lifecycle-v3/roles/reviewer/commands/spec-quality.md +202 -0
- package/.claude/skills/team-lifecycle-v3/roles/reviewer/role.md +104 -0
- package/.claude/skills/team-lifecycle-v3/roles/tester/commands/validate.md +152 -0
- package/.claude/skills/team-lifecycle-v3/roles/tester/role.md +108 -0
- package/.claude/skills/team-lifecycle-v3/roles/writer/commands/generate-doc.md +187 -0
- package/.claude/skills/team-lifecycle-v3/roles/writer/role.md +96 -0
- package/.claude/skills/team-lifecycle-v3/specs/document-standards.md +192 -0
- package/.claude/skills/team-lifecycle-v3/specs/quality-gates.md +207 -0
- package/.claude/skills/team-lifecycle-v3/specs/team-config.json +158 -0
- package/.claude/skills/team-lifecycle-v3/templates/architecture-doc.md +254 -0
- package/.claude/skills/team-lifecycle-v3/templates/epics-template.md +196 -0
- package/.claude/skills/team-lifecycle-v3/templates/product-brief.md +133 -0
- package/.claude/skills/team-lifecycle-v3/templates/requirements-prd.md +224 -0
- package/.claude/skills/team-lifecycle-v4/SKILL.md +643 -0
- package/.claude/skills/team-lifecycle-v4/roles/analyst/role.md +174 -0
- package/.claude/skills/team-lifecycle-v4/roles/architect/commands/assess.md +193 -0
- package/.claude/skills/team-lifecycle-v4/roles/architect/role.md +103 -0
- package/.claude/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +198 -0
- package/.claude/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +413 -0
- package/.claude/skills/team-lifecycle-v4/roles/coordinator/role.md +230 -0
- package/.claude/skills/team-lifecycle-v4/roles/executor/commands/implement.md +166 -0
- package/.claude/skills/team-lifecycle-v4/roles/executor/role.md +103 -0
- package/.claude/skills/team-lifecycle-v4/roles/fe-developer/role.md +111 -0
- package/.claude/skills/team-lifecycle-v4/roles/fe-qa/commands/pre-delivery-checklist.md +152 -0
- package/.claude/skills/team-lifecycle-v4/roles/fe-qa/role.md +113 -0
- package/.claude/skills/team-lifecycle-v4/roles/planner/commands/explore.md +172 -0
- package/.claude/skills/team-lifecycle-v4/roles/planner/role.md +139 -0
- package/.claude/skills/team-lifecycle-v4/roles/reviewer/commands/code-review.md +163 -0
- package/.claude/skills/team-lifecycle-v4/roles/reviewer/commands/spec-quality.md +202 -0
- package/.claude/skills/team-lifecycle-v4/roles/reviewer/role.md +150 -0
- package/.claude/skills/team-lifecycle-v4/roles/tester/commands/validate.md +152 -0
- package/.claude/skills/team-lifecycle-v4/roles/tester/role.md +108 -0
- package/.claude/skills/team-lifecycle-v4/roles/writer/commands/generate-doc.md +192 -0
- package/.claude/skills/team-lifecycle-v4/roles/writer/role.md +246 -0
- package/.claude/skills/team-lifecycle-v4/specs/document-standards.md +192 -0
- package/.claude/skills/team-lifecycle-v4/specs/quality-gates.md +207 -0
- package/.claude/skills/team-lifecycle-v4/specs/team-config.json +200 -0
- package/.claude/skills/team-lifecycle-v4/subagents/discuss-subagent.md +169 -0
- package/.claude/skills/team-lifecycle-v4/subagents/doc-generation-subagent.md +62 -0
- package/.claude/skills/team-lifecycle-v4/subagents/explore-subagent.md +172 -0
- package/.claude/skills/team-lifecycle-v4/templates/architecture-doc.md +254 -0
- package/.claude/skills/team-lifecycle-v4/templates/epics-template.md +196 -0
- package/.claude/skills/team-lifecycle-v4/templates/product-brief.md +133 -0
- package/.claude/skills/team-lifecycle-v4/templates/requirements-prd.md +224 -0
- package/.claude/skills/team-lifecycle-v5/SKILL.md +320 -0
- package/.claude/skills/team-lifecycle-v5/role-specs/analyst.md +93 -0
- package/.claude/skills/team-lifecycle-v5/role-specs/architect.md +76 -0
- package/.claude/skills/team-lifecycle-v5/role-specs/executor.md +67 -0
- package/.claude/skills/team-lifecycle-v5/role-specs/fe-developer.md +79 -0
- package/.claude/skills/team-lifecycle-v5/role-specs/fe-qa.md +79 -0
- package/.claude/skills/team-lifecycle-v5/role-specs/planner.md +98 -0
- package/.claude/skills/team-lifecycle-v5/role-specs/reviewer.md +94 -0
- package/.claude/skills/team-lifecycle-v5/role-specs/tester.md +76 -0
- package/.claude/skills/team-lifecycle-v5/role-specs/writer.md +126 -0
- package/.claude/skills/team-lifecycle-v5/roles/coordinator/commands/dispatch.md +178 -0
- package/.claude/skills/team-lifecycle-v5/roles/coordinator/commands/monitor.md +237 -0
- package/.claude/skills/team-lifecycle-v5/roles/coordinator/role.md +194 -0
- package/.claude/skills/team-lifecycle-v5/specs/document-standards.md +192 -0
- package/.claude/skills/team-lifecycle-v5/specs/quality-gates.md +207 -0
- package/.claude/skills/team-lifecycle-v5/specs/team-config.json +218 -0
- package/.claude/skills/team-lifecycle-v5/subagents/discuss-subagent.md +169 -0
- package/.claude/skills/team-lifecycle-v5/subagents/doc-generation-subagent.md +62 -0
- package/.claude/skills/team-lifecycle-v5/subagents/explore-subagent.md +172 -0
- package/.claude/skills/team-lifecycle-v5/templates/architecture-doc.md +254 -0
- package/.claude/skills/team-lifecycle-v5/templates/epics-template.md +196 -0
- package/.claude/skills/team-lifecycle-v5/templates/product-brief.md +133 -0
- package/.claude/skills/team-lifecycle-v5/templates/requirements-prd.md +224 -0
- package/.claude/skills/team-planex/SKILL.md +439 -0
- package/.claude/skills/team-planex/roles/executor.md +356 -0
- package/.claude/skills/team-planex/roles/planner.md +315 -0
- package/.claude/skills/team-quality-assurance/SKILL.md +466 -0
- package/.claude/skills/team-quality-assurance/roles/analyst/commands/quality-report.md +360 -0
- package/.claude/skills/team-quality-assurance/roles/analyst/role.md +186 -0
- package/.claude/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +169 -0
- package/.claude/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +336 -0
- package/.claude/skills/team-quality-assurance/roles/coordinator/role.md +195 -0
- package/.claude/skills/team-quality-assurance/roles/executor/commands/run-fix-cycle.md +220 -0
- package/.claude/skills/team-quality-assurance/roles/executor/role.md +179 -0
- package/.claude/skills/team-quality-assurance/roles/generator/commands/generate-tests.md +258 -0
- package/.claude/skills/team-quality-assurance/roles/generator/role.md +172 -0
- package/.claude/skills/team-quality-assurance/roles/scout/commands/scan.md +216 -0
- package/.claude/skills/team-quality-assurance/roles/scout/role.md +244 -0
- package/.claude/skills/team-quality-assurance/roles/strategist/commands/analyze-scope.md +221 -0
- package/.claude/skills/team-quality-assurance/roles/strategist/role.md +166 -0
- package/.claude/skills/team-quality-assurance/specs/team-config.json +131 -0
- package/.claude/skills/team-review/SKILL.md +264 -0
- package/.claude/skills/team-review/roles/coordinator/commands/dispatch.md +145 -0
- package/.claude/skills/team-review/roles/coordinator/commands/monitor.md +218 -0
- package/.claude/skills/team-review/roles/coordinator/role.md +244 -0
- package/.claude/skills/team-review/roles/fixer/commands/execute-fixes.md +163 -0
- package/.claude/skills/team-review/roles/fixer/commands/plan-fixes.md +187 -0
- package/.claude/skills/team-review/roles/fixer/role.md +247 -0
- package/.claude/skills/team-review/roles/reviewer/commands/deep-analyze.md +186 -0
- package/.claude/skills/team-review/roles/reviewer/commands/generate-report.md +174 -0
- package/.claude/skills/team-review/roles/reviewer/role.md +233 -0
- package/.claude/skills/team-review/roles/scanner/commands/semantic-scan.md +186 -0
- package/.claude/skills/team-review/roles/scanner/commands/toolchain-scan.md +187 -0
- package/.claude/skills/team-review/roles/scanner/role.md +255 -0
- package/.claude/skills/team-review/specs/dimensions.md +82 -0
- package/.claude/skills/team-review/specs/finding-schema.json +82 -0
- package/.claude/skills/team-review/specs/team-config.json +27 -0
- package/.claude/skills/team-roadmap-dev/SKILL.md +389 -0
- package/.claude/skills/team-roadmap-dev/roles/coordinator/commands/dispatch.md +213 -0
- package/.claude/skills/team-roadmap-dev/roles/coordinator/commands/monitor.md +378 -0
- package/.claude/skills/team-roadmap-dev/roles/coordinator/commands/pause.md +91 -0
- package/.claude/skills/team-roadmap-dev/roles/coordinator/commands/resume.md +138 -0
- package/.claude/skills/team-roadmap-dev/roles/coordinator/commands/roadmap-discuss.md +287 -0
- package/.claude/skills/team-roadmap-dev/roles/coordinator/role.md +237 -0
- package/.claude/skills/team-roadmap-dev/roles/executor/commands/implement.md +309 -0
- package/.claude/skills/team-roadmap-dev/roles/executor/role.md +220 -0
- package/.claude/skills/team-roadmap-dev/roles/planner/commands/create-plans.md +362 -0
- package/.claude/skills/team-roadmap-dev/roles/planner/commands/research.md +219 -0
- package/.claude/skills/team-roadmap-dev/roles/planner/role.md +243 -0
- package/.claude/skills/team-roadmap-dev/roles/verifier/commands/verify.md +335 -0
- package/.claude/skills/team-roadmap-dev/roles/verifier/role.md +247 -0
- package/.claude/skills/team-roadmap-dev/specs/team-config.json +96 -0
- package/.claude/skills/team-tech-debt/SKILL.md +473 -0
- package/.claude/skills/team-tech-debt/roles/assessor/commands/evaluate.md +164 -0
- package/.claude/skills/team-tech-debt/roles/assessor/role.md +187 -0
- package/.claude/skills/team-tech-debt/roles/coordinator/commands/dispatch.md +157 -0
- package/.claude/skills/team-tech-debt/roles/coordinator/commands/monitor.md +434 -0
- package/.claude/skills/team-tech-debt/roles/coordinator/role.md +387 -0
- package/.claude/skills/team-tech-debt/roles/executor/commands/remediate.md +180 -0
- package/.claude/skills/team-tech-debt/roles/executor/role.md +228 -0
- package/.claude/skills/team-tech-debt/roles/planner/commands/create-plan.md +165 -0
- package/.claude/skills/team-tech-debt/roles/planner/role.md +190 -0
- package/.claude/skills/team-tech-debt/roles/scanner/commands/scan-debt.md +388 -0
- package/.claude/skills/team-tech-debt/roles/scanner/role.md +225 -0
- package/.claude/skills/team-tech-debt/roles/validator/commands/verify.md +203 -0
- package/.claude/skills/team-tech-debt/roles/validator/role.md +237 -0
- package/.claude/skills/team-tech-debt/specs/team-config.json +132 -0
- package/.claude/skills/team-testing/SKILL.md +362 -0
- package/.claude/skills/team-testing/roles/analyst.md +265 -0
- package/.claude/skills/team-testing/roles/coordinator.md +304 -0
- package/.claude/skills/team-testing/roles/executor.md +300 -0
- package/.claude/skills/team-testing/roles/generator.md +272 -0
- package/.claude/skills/team-testing/roles/strategist.md +218 -0
- package/.claude/skills/team-testing/specs/team-config.json +93 -0
- package/.claude/skills/team-uidesign/SKILL.md +419 -0
- package/.claude/skills/team-uidesign/roles/coordinator.md +315 -0
- package/.claude/skills/team-uidesign/roles/designer.md +251 -0
- package/.claude/skills/team-uidesign/roles/implementer.md +280 -0
- package/.claude/skills/team-uidesign/roles/researcher.md +286 -0
- package/.claude/skills/team-uidesign/roles/reviewer.md +301 -0
- package/.claude/skills/team-uidesign/specs/team-config.json +107 -0
- package/.claude/skills/team-ultra-analyze/SKILL.md +444 -0
- package/.claude/skills/team-ultra-analyze/roles/analyst/commands/analyze.md +210 -0
- package/.claude/skills/team-ultra-analyze/roles/analyst/role.md +253 -0
- package/.claude/skills/team-ultra-analyze/roles/coordinator/commands/dispatch.md +237 -0
- package/.claude/skills/team-ultra-analyze/roles/coordinator/commands/monitor.md +461 -0
- package/.claude/skills/team-ultra-analyze/roles/coordinator/role.md +354 -0
- package/.claude/skills/team-ultra-analyze/roles/discussant/commands/deepen.md +222 -0
- package/.claude/skills/team-ultra-analyze/roles/discussant/role.md +227 -0
- package/.claude/skills/team-ultra-analyze/roles/explorer/commands/explore.md +194 -0
- package/.claude/skills/team-ultra-analyze/roles/explorer/role.md +219 -0
- package/.claude/skills/team-ultra-analyze/roles/synthesizer/commands/synthesize.md +255 -0
- package/.claude/skills/team-ultra-analyze/roles/synthesizer/role.md +251 -0
- package/.claude/skills/team-ultra-analyze/specs/team-config.json +131 -0
- package/.claude/skills/workflow-execute/SKILL.md +625 -0
- package/.claude/skills/workflow-execute/phases/06-review.md +215 -0
- package/.claude/skills/workflow-lite-plan/SKILL.md +174 -0
- package/.claude/skills/workflow-lite-plan/phases/01-lite-plan.md +762 -0
- package/.claude/skills/workflow-lite-plan/phases/02-lite-execute.md +786 -0
- package/.claude/skills/workflow-multi-cli-plan/SKILL.md +163 -0
- package/.claude/skills/workflow-multi-cli-plan/phases/01-multi-cli-plan.md +604 -0
- package/.claude/skills/workflow-multi-cli-plan/phases/02-lite-execute.md +788 -0
- package/.claude/skills/workflow-plan/SKILL.md +441 -0
- package/.claude/skills/workflow-plan/phases/01-session-discovery.md +99 -0
- package/.claude/skills/workflow-plan/phases/02-context-gathering.md +338 -0
- package/.claude/skills/workflow-plan/phases/03-conflict-resolution.md +422 -0
- package/.claude/skills/workflow-plan/phases/04-task-generation.md +433 -0
- package/.claude/skills/workflow-plan/phases/05-plan-verify.md +391 -0
- package/.claude/skills/workflow-plan/phases/06-replan.md +594 -0
- package/.claude/skills/workflow-skill-designer/SKILL.md +496 -0
- package/.claude/skills/workflow-skill-designer/phases/01-requirements-analysis.md +356 -0
- package/.claude/skills/workflow-skill-designer/phases/02-orchestrator-design.md +444 -0
- package/.claude/skills/workflow-skill-designer/phases/03-phase-design.md +458 -0
- package/.claude/skills/workflow-skill-designer/phases/04-validation.md +471 -0
- package/.claude/skills/workflow-tdd/SKILL.md +502 -0
- package/.claude/skills/workflow-tdd/phases/01-session-discovery.md +57 -0
- package/.claude/skills/workflow-tdd/phases/02-context-gathering.md +406 -0
- package/.claude/skills/workflow-tdd/phases/03-test-coverage-analysis.md +172 -0
- package/.claude/skills/workflow-tdd/phases/04-conflict-resolution.md +426 -0
- package/.claude/skills/workflow-tdd/phases/05-tdd-task-generation.md +472 -0
- package/.claude/skills/workflow-tdd/phases/06-tdd-structure-validation.md +189 -0
- package/.claude/skills/workflow-tdd/phases/07-tdd-verify.md +635 -0
- package/.claude/skills/workflow-test-fix/SKILL.md +458 -0
- package/.claude/skills/workflow-test-fix/phases/01-session-start.md +60 -0
- package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +492 -0
- package/.claude/skills/workflow-test-fix/phases/03-test-concept-enhanced.md +150 -0
- package/.claude/skills/workflow-test-fix/phases/04-test-task-generate.md +346 -0
- package/.claude/skills/workflow-test-fix/phases/05-test-cycle-execute.md +537 -0
- package/.codex/AGENTS.md +126 -122
- package/.codex/agents/action-planning-agent.md +88 -93
- package/.codex/agents/cli-execution-agent.md +4 -4
- package/.codex/agents/cli-explore-agent.md +56 -11
- package/.codex/agents/cli-lite-planning-agent.md +906 -736
- package/.codex/agents/code-developer.md +147 -38
- package/.codex/agents/conceptual-planning-agent.md +5 -5
- package/.codex/agents/context-search-agent.md +8 -4
- package/.codex/agents/issue-plan-agent.md +11 -11
- package/.codex/agents/memory-bridge.md +2 -2
- package/.codex/agents/tdd-developer.md +512 -0
- package/.codex/agents/test-action-planning-agent.md +684 -0
- package/.codex/agents/test-fix-agent.md +19 -7
- package/.codex/agents/ui-design-agent.md +3 -3
- package/.codex/prompts/prep-cycle.md +416 -0
- package/.codex/prompts/prep-plan.md +371 -0
- package/.codex/skills/analyze-with-file/EXECUTE.md +716 -0
- package/.codex/skills/analyze-with-file/SKILL.md +1049 -0
- package/.codex/skills/brainstorm-with-file/SKILL.md +1033 -0
- package/.codex/skills/clean/SKILL.md +421 -0
- package/.codex/skills/collaborative-plan-with-file/SKILL.md +822 -0
- package/.codex/skills/debug-with-file/SKILL.md +617 -0
- package/.codex/skills/issue-discover/SKILL.md +353 -0
- package/.codex/skills/issue-discover/phases/01-issue-new.md +334 -0
- package/.codex/skills/issue-discover/phases/02-discover.md +369 -0
- package/.codex/skills/issue-discover/phases/03-discover-by-prompt.md +531 -0
- package/.codex/skills/issue-discover/phases/04-quick-execute.md +241 -0
- package/.codex/skills/memory-compact/SKILL.md +381 -0
- package/.codex/skills/parallel-dev-cycle/SKILL.md +401 -0
- package/.codex/skills/parallel-dev-cycle/phases/00-prep-checklist.md +191 -0
- package/.codex/skills/parallel-dev-cycle/phases/01-session-init.md +261 -0
- package/.codex/skills/parallel-dev-cycle/phases/02-agent-execution.md +449 -0
- package/.codex/skills/parallel-dev-cycle/phases/03-result-aggregation.md +230 -0
- package/.codex/skills/parallel-dev-cycle/phases/04-completion-summary.md +109 -0
- package/.codex/skills/parallel-dev-cycle/roles/code-developer.md +392 -0
- package/.codex/skills/parallel-dev-cycle/roles/exploration-planner.md +352 -0
- package/.codex/skills/parallel-dev-cycle/roles/requirements-analyst.md +433 -0
- package/.codex/skills/parallel-dev-cycle/roles/validation-archivist.md +447 -0
- package/.codex/skills/review-cycle/SKILL.md +476 -0
- package/.codex/skills/review-cycle/phases/01-discovery-initialization.md +341 -0
- package/.codex/skills/review-cycle/phases/02-parallel-review.md +546 -0
- package/.codex/skills/review-cycle/phases/03-aggregation.md +74 -0
- package/.codex/skills/review-cycle/phases/04-iterative-deep-dive.md +333 -0
- package/.codex/skills/review-cycle/phases/05-review-completion.md +173 -0
- package/.codex/skills/review-cycle/phases/06-fix-discovery-batching.md +238 -0
- package/.codex/skills/review-cycle/phases/07-fix-parallel-planning.md +223 -0
- package/.codex/skills/review-cycle/phases/08-fix-execution.md +238 -0
- package/.codex/skills/review-cycle/phases/09-fix-completion.md +141 -0
- package/.codex/skills/roadmap-with-file/SKILL.md +898 -0
- package/.codex/skills/team-lifecycle/agents/analyst.md +424 -0
- package/.codex/skills/team-lifecycle/agents/architect.md +274 -0
- package/.codex/skills/team-lifecycle/agents/discuss-agent.md +422 -0
- package/.codex/skills/team-lifecycle/agents/executor.md +423 -0
- package/.codex/skills/team-lifecycle/agents/explore-agent.md +471 -0
- package/.codex/skills/team-lifecycle/agents/fe-developer.md +239 -0
- package/.codex/skills/team-lifecycle/agents/fe-qa.md +357 -0
- package/.codex/skills/team-lifecycle/agents/planner.md +437 -0
- package/.codex/skills/team-lifecycle/agents/reviewer.md +483 -0
- package/.codex/skills/team-lifecycle/agents/tester.md +423 -0
- package/.codex/skills/team-lifecycle/agents/writer.md +502 -0
- package/.codex/skills/team-lifecycle/orchestrator.md +817 -0
- package/.codex/skills/team-lifecycle/phases/01-requirement-clarification.md +209 -0
- package/.codex/skills/team-lifecycle/phases/02-team-initialization.md +205 -0
- package/.codex/skills/team-lifecycle/phases/03-task-chain-creation.md +251 -0
- package/.codex/skills/team-lifecycle/phases/04-pipeline-coordination.md +719 -0
- package/.codex/skills/team-lifecycle/phases/05-completion-report.md +288 -0
- package/.codex/skills/team-lifecycle/specs/document-standards.md +192 -0
- package/.codex/skills/team-lifecycle/specs/quality-gates.md +207 -0
- package/.codex/skills/team-lifecycle/templates/architecture-doc.md +254 -0
- package/.codex/skills/team-lifecycle/templates/epics-template.md +196 -0
- package/.codex/skills/team-lifecycle/templates/product-brief.md +133 -0
- package/.codex/skills/team-lifecycle/templates/requirements-prd.md +224 -0
- package/.codex/skills/team-planex/agents/executor.md +217 -0
- package/.codex/skills/team-planex/agents/planner.md +183 -0
- package/.codex/skills/team-planex/orchestrator.md +284 -0
- package/.codex/skills/unified-execute-with-file/SKILL.md +786 -0
- package/.codex/skills/workflow-test-fix-cycle/SKILL.md +391 -0
- package/.codex/skills/workflow-test-fix-cycle/phases/01-test-fix-gen.md +452 -0
- package/.codex/skills/workflow-test-fix-cycle/phases/02-test-cycle-execute.md +476 -0
- package/README.md +187 -157
- package/ccw/README.md +46 -0
- package/ccw/bin/ccw-mcp.js +16 -1
- package/ccw/dist/cli.d.ts.map +1 -1
- package/ccw/dist/cli.js +58 -2
- package/ccw/dist/cli.js.map +1 -1
- package/ccw/dist/commands/cli.d.ts +3 -0
- package/ccw/dist/commands/cli.d.ts.map +1 -1
- package/ccw/dist/commands/cli.js +109 -63
- package/ccw/dist/commands/cli.js.map +1 -1
- package/ccw/dist/commands/core-memory.d.ts +5 -0
- package/ccw/dist/commands/core-memory.d.ts.map +1 -1
- package/ccw/dist/commands/core-memory.js +307 -2
- package/ccw/dist/commands/core-memory.js.map +1 -1
- package/ccw/dist/commands/hook.d.ts +3 -1
- package/ccw/dist/commands/hook.d.ts.map +1 -1
- package/ccw/dist/commands/hook.js +669 -85
- package/ccw/dist/commands/hook.js.map +1 -1
- package/ccw/dist/commands/install.d.ts +12 -0
- package/ccw/dist/commands/install.d.ts.map +1 -1
- package/ccw/dist/commands/install.js +313 -3
- package/ccw/dist/commands/install.js.map +1 -1
- package/ccw/dist/commands/issue.d.ts +18 -5
- package/ccw/dist/commands/issue.d.ts.map +1 -1
- package/ccw/dist/commands/issue.js +58 -19
- package/ccw/dist/commands/issue.js.map +1 -1
- package/ccw/dist/commands/memory.d.ts +1 -1
- package/ccw/dist/commands/memory.d.ts.map +1 -1
- package/ccw/dist/commands/memory.js +371 -1
- package/ccw/dist/commands/memory.js.map +1 -1
- package/ccw/dist/commands/serve.d.ts.map +1 -1
- package/ccw/dist/commands/serve.js +74 -4
- package/ccw/dist/commands/serve.js.map +1 -1
- package/ccw/dist/commands/spec.d.ts +24 -0
- package/ccw/dist/commands/spec.d.ts.map +1 -0
- package/ccw/dist/commands/spec.js +374 -0
- package/ccw/dist/commands/spec.js.map +1 -0
- package/ccw/dist/commands/stop.d.ts +0 -4
- package/ccw/dist/commands/stop.d.ts.map +1 -1
- package/ccw/dist/commands/stop.js +135 -12
- package/ccw/dist/commands/stop.js.map +1 -1
- package/ccw/dist/commands/team.d.ts +27 -0
- package/ccw/dist/commands/team.d.ts.map +1 -0
- package/ccw/dist/commands/team.js +164 -0
- package/ccw/dist/commands/team.js.map +1 -0
- package/ccw/dist/commands/upgrade.js +4 -2
- package/ccw/dist/commands/upgrade.js.map +1 -1
- package/ccw/dist/commands/view.d.ts.map +1 -1
- package/ccw/dist/commands/view.js +2 -3
- package/ccw/dist/commands/view.js.map +1 -1
- package/ccw/dist/commands/workflow.js +2 -2
- package/ccw/dist/commands/workflow.js.map +1 -1
- package/ccw/dist/config/cli-settings-manager.d.ts +12 -3
- package/ccw/dist/config/cli-settings-manager.d.ts.map +1 -1
- package/ccw/dist/config/cli-settings-manager.js +146 -12
- package/ccw/dist/config/cli-settings-manager.js.map +1 -1
- package/ccw/dist/config/litellm-static-models.d.ts +30 -0
- package/ccw/dist/config/litellm-static-models.d.ts.map +1 -0
- package/ccw/dist/config/litellm-static-models.js +82 -0
- package/ccw/dist/config/litellm-static-models.js.map +1 -0
- package/ccw/dist/config/provider-models.d.ts +5 -32
- package/ccw/dist/config/provider-models.d.ts.map +1 -1
- package/ccw/dist/config/provider-models.js +5 -103
- package/ccw/dist/config/provider-models.js.map +1 -1
- package/ccw/dist/config/remote-notification-config.d.ts +32 -0
- package/ccw/dist/config/remote-notification-config.d.ts.map +1 -0
- package/ccw/dist/config/remote-notification-config.js +131 -0
- package/ccw/dist/config/remote-notification-config.js.map +1 -0
- package/ccw/dist/config/storage-paths.d.ts +22 -0
- package/ccw/dist/config/storage-paths.d.ts.map +1 -1
- package/ccw/dist/config/storage-paths.js +27 -0
- package/ccw/dist/config/storage-paths.js.map +1 -1
- package/ccw/dist/core/a2ui/A2UITypes.d.ts +143 -0
- package/ccw/dist/core/a2ui/A2UITypes.d.ts.map +1 -0
- package/ccw/dist/core/a2ui/A2UITypes.js +84 -0
- package/ccw/dist/core/a2ui/A2UITypes.js.map +1 -0
- package/ccw/dist/core/a2ui/A2UIWebSocketHandler.d.ts +170 -0
- package/ccw/dist/core/a2ui/A2UIWebSocketHandler.d.ts.map +1 -0
- package/ccw/dist/core/a2ui/A2UIWebSocketHandler.js +718 -0
- package/ccw/dist/core/a2ui/A2UIWebSocketHandler.js.map +1 -0
- package/ccw/dist/core/a2ui/index.d.ts +3 -0
- package/ccw/dist/core/a2ui/index.d.ts.map +1 -0
- package/ccw/dist/core/a2ui/index.js +6 -0
- package/ccw/dist/core/a2ui/index.js.map +1 -0
- package/ccw/dist/core/auth/csrf-middleware.d.ts.map +1 -1
- package/ccw/dist/core/auth/csrf-middleware.js +26 -8
- package/ccw/dist/core/auth/csrf-middleware.js.map +1 -1
- package/ccw/dist/core/auth/middleware.d.ts.map +1 -1
- package/ccw/dist/core/auth/middleware.js +55 -0
- package/ccw/dist/core/auth/middleware.js.map +1 -1
- package/ccw/dist/core/core-memory-store.d.ts +99 -5
- package/ccw/dist/core/core-memory-store.d.ts.map +1 -1
- package/ccw/dist/core/core-memory-store.js +389 -56
- package/ccw/dist/core/core-memory-store.js.map +1 -1
- package/ccw/dist/core/data-aggregator.d.ts +6 -0
- package/ccw/dist/core/data-aggregator.d.ts.map +1 -1
- package/ccw/dist/core/data-aggregator.js +6 -35
- package/ccw/dist/core/data-aggregator.js.map +1 -1
- package/ccw/dist/core/hooks/context-limit-detector.d.ts +65 -0
- package/ccw/dist/core/hooks/context-limit-detector.d.ts.map +1 -0
- package/ccw/dist/core/hooks/context-limit-detector.js +91 -0
- package/ccw/dist/core/hooks/context-limit-detector.js.map +1 -0
- package/ccw/dist/core/hooks/index.d.ts +11 -0
- package/ccw/dist/core/hooks/index.d.ts.map +1 -0
- package/ccw/dist/core/hooks/index.js +16 -0
- package/ccw/dist/core/hooks/index.js.map +1 -0
- package/ccw/dist/core/hooks/keyword-detector.d.ts +106 -0
- package/ccw/dist/core/hooks/keyword-detector.d.ts.map +1 -0
- package/ccw/dist/core/hooks/keyword-detector.js +194 -0
- package/ccw/dist/core/hooks/keyword-detector.js.map +1 -0
- package/ccw/dist/core/hooks/recovery-handler.d.ts +114 -0
- package/ccw/dist/core/hooks/recovery-handler.d.ts.map +1 -0
- package/ccw/dist/core/hooks/recovery-handler.js +244 -0
- package/ccw/dist/core/hooks/recovery-handler.js.map +1 -0
- package/ccw/dist/core/hooks/stop-handler.d.ts +128 -0
- package/ccw/dist/core/hooks/stop-handler.d.ts.map +1 -0
- package/ccw/dist/core/hooks/stop-handler.js +269 -0
- package/ccw/dist/core/hooks/stop-handler.js.map +1 -0
- package/ccw/dist/core/hooks/user-abort-detector.d.ts +76 -0
- package/ccw/dist/core/hooks/user-abort-detector.d.ts.map +1 -0
- package/ccw/dist/core/hooks/user-abort-detector.js +168 -0
- package/ccw/dist/core/hooks/user-abort-detector.js.map +1 -0
- package/ccw/dist/core/lite-scanner-complete.d.ts +18 -3
- package/ccw/dist/core/lite-scanner-complete.d.ts.map +1 -1
- package/ccw/dist/core/lite-scanner-complete.js +54 -12
- package/ccw/dist/core/lite-scanner-complete.js.map +1 -1
- package/ccw/dist/core/lite-scanner.d.ts +74 -3
- package/ccw/dist/core/lite-scanner.d.ts.map +1 -1
- package/ccw/dist/core/lite-scanner.js +57 -12
- package/ccw/dist/core/lite-scanner.js.map +1 -1
- package/ccw/dist/core/memory-consolidation-pipeline.d.ts +126 -0
- package/ccw/dist/core/memory-consolidation-pipeline.d.ts.map +1 -0
- package/ccw/dist/core/memory-consolidation-pipeline.js +364 -0
- package/ccw/dist/core/memory-consolidation-pipeline.js.map +1 -0
- package/ccw/dist/core/memory-consolidation-prompts.d.ts +27 -0
- package/ccw/dist/core/memory-consolidation-prompts.d.ts.map +1 -0
- package/ccw/dist/core/memory-consolidation-prompts.js +103 -0
- package/ccw/dist/core/memory-consolidation-prompts.js.map +1 -0
- package/ccw/dist/core/memory-embedder-bridge.d.ts +22 -0
- package/ccw/dist/core/memory-embedder-bridge.d.ts.map +1 -1
- package/ccw/dist/core/memory-embedder-bridge.js +85 -0
- package/ccw/dist/core/memory-embedder-bridge.js.map +1 -1
- package/ccw/dist/core/memory-extraction-pipeline.d.ts +244 -0
- package/ccw/dist/core/memory-extraction-pipeline.d.ts.map +1 -0
- package/ccw/dist/core/memory-extraction-pipeline.js +934 -0
- package/ccw/dist/core/memory-extraction-pipeline.js.map +1 -0
- package/ccw/dist/core/memory-extraction-prompts.d.ts +29 -0
- package/ccw/dist/core/memory-extraction-prompts.d.ts.map +1 -0
- package/ccw/dist/core/memory-extraction-prompts.js +99 -0
- package/ccw/dist/core/memory-extraction-prompts.js.map +1 -0
- package/ccw/dist/core/memory-job-scheduler.d.ts +92 -0
- package/ccw/dist/core/memory-job-scheduler.d.ts.map +1 -0
- package/ccw/dist/core/memory-job-scheduler.js +264 -0
- package/ccw/dist/core/memory-job-scheduler.js.map +1 -0
- package/ccw/dist/core/memory-v2-config.d.ts +48 -0
- package/ccw/dist/core/memory-v2-config.d.ts.map +1 -0
- package/ccw/dist/core/memory-v2-config.js +51 -0
- package/ccw/dist/core/memory-v2-config.js.map +1 -0
- package/ccw/dist/core/mode-workflow-map.d.ts +148 -0
- package/ccw/dist/core/mode-workflow-map.d.ts.map +1 -0
- package/ccw/dist/core/mode-workflow-map.js +271 -0
- package/ccw/dist/core/mode-workflow-map.js.map +1 -0
- package/ccw/dist/core/pattern-detector.d.ts +99 -0
- package/ccw/dist/core/pattern-detector.d.ts.map +1 -0
- package/ccw/dist/core/pattern-detector.js +385 -0
- package/ccw/dist/core/pattern-detector.js.map +1 -0
- package/ccw/dist/core/routes/analysis-routes.d.ts +40 -0
- package/ccw/dist/core/routes/analysis-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/analysis-routes.js +172 -0
- package/ccw/dist/core/routes/analysis-routes.js.map +1 -0
- package/ccw/dist/core/routes/audit-routes.d.ts +14 -0
- package/ccw/dist/core/routes/audit-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/audit-routes.js +150 -0
- package/ccw/dist/core/routes/audit-routes.js.map +1 -0
- package/ccw/dist/core/routes/ccw-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/ccw-routes.js +87 -0
- package/ccw/dist/core/routes/ccw-routes.js.map +1 -1
- package/ccw/dist/core/routes/claude-routes.js +13 -13
- package/ccw/dist/core/routes/claude-routes.js.map +1 -1
- package/ccw/dist/core/routes/cli-routes.d.ts +6 -2
- package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/cli-routes.js +308 -22
- package/ccw/dist/core/routes/cli-routes.js.map +1 -1
- package/ccw/dist/core/routes/cli-sessions-routes.d.ts +20 -0
- package/ccw/dist/core/routes/cli-sessions-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/cli-sessions-routes.js +449 -0
- package/ccw/dist/core/routes/cli-sessions-routes.js.map +1 -0
- package/ccw/dist/core/routes/cli-settings-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/cli-settings-routes.js +217 -3
- package/ccw/dist/core/routes/cli-settings-routes.js.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.js +164 -26
- package/ccw/dist/core/routes/codexlens/config-handlers.js.map +1 -1
- package/ccw/dist/core/routes/codexlens/index-handlers.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens/index-handlers.js +98 -1
- package/ccw/dist/core/routes/codexlens/index-handlers.js.map +1 -1
- package/ccw/dist/core/routes/codexlens/semantic-handlers.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens/semantic-handlers.js +308 -0
- package/ccw/dist/core/routes/codexlens/semantic-handlers.js.map +1 -1
- package/ccw/dist/core/routes/commands-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/commands-routes.js +399 -1
- package/ccw/dist/core/routes/commands-routes.js.map +1 -1
- package/ccw/dist/core/routes/config-routes.d.ts +22 -0
- package/ccw/dist/core/routes/config-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/config-routes.js +291 -0
- package/ccw/dist/core/routes/config-routes.js.map +1 -0
- package/ccw/dist/core/routes/core-memory-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/core-memory-routes.js +461 -5
- package/ccw/dist/core/routes/core-memory-routes.js.map +1 -1
- package/ccw/dist/core/routes/dashboard-routes.d.ts +15 -0
- package/ccw/dist/core/routes/dashboard-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/dashboard-routes.js +121 -0
- package/ccw/dist/core/routes/dashboard-routes.js.map +1 -0
- package/ccw/dist/core/routes/files-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/files-routes.js +296 -8
- package/ccw/dist/core/routes/files-routes.js.map +1 -1
- package/ccw/dist/core/routes/hooks-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/hooks-routes.js +274 -67
- package/ccw/dist/core/routes/hooks-routes.js.map +1 -1
- package/ccw/dist/core/routes/issue-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/issue-routes.js +399 -27
- package/ccw/dist/core/routes/issue-routes.js.map +1 -1
- package/ccw/dist/core/routes/litellm-api-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/litellm-api-routes.js +74 -135
- package/ccw/dist/core/routes/litellm-api-routes.js.map +1 -1
- package/ccw/dist/core/routes/mcp-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/mcp-routes.js +79 -15
- package/ccw/dist/core/routes/mcp-routes.js.map +1 -1
- package/ccw/dist/core/routes/mcp-templates-db.d.ts.map +1 -1
- package/ccw/dist/core/routes/mcp-templates-db.js +20 -7
- package/ccw/dist/core/routes/mcp-templates-db.js.map +1 -1
- package/ccw/dist/core/routes/memory-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/memory-routes.js +137 -0
- package/ccw/dist/core/routes/memory-routes.js.map +1 -1
- package/ccw/dist/core/routes/notification-routes.d.ts +10 -0
- package/ccw/dist/core/routes/notification-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/notification-routes.js +507 -0
- package/ccw/dist/core/routes/notification-routes.js.map +1 -0
- package/ccw/dist/core/routes/orchestrator-routes.d.ts +282 -0
- package/ccw/dist/core/routes/orchestrator-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/orchestrator-routes.js +1564 -0
- package/ccw/dist/core/routes/orchestrator-routes.js.map +1 -0
- package/ccw/dist/core/routes/provider-routes.d.ts +4 -0
- package/ccw/dist/core/routes/provider-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/provider-routes.js +45 -11
- package/ccw/dist/core/routes/provider-routes.js.map +1 -1
- package/ccw/dist/core/routes/queue-routes.d.ts +22 -0
- package/ccw/dist/core/routes/queue-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/queue-routes.js +164 -0
- package/ccw/dist/core/routes/queue-routes.js.map +1 -0
- package/ccw/dist/core/routes/skill-hub-routes.d.ts +77 -0
- package/ccw/dist/core/routes/skill-hub-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/skill-hub-routes.js +988 -0
- package/ccw/dist/core/routes/skill-hub-routes.js.map +1 -0
- package/ccw/dist/core/routes/skills-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/skills-routes.js +105 -62
- package/ccw/dist/core/routes/skills-routes.js.map +1 -1
- package/ccw/dist/core/routes/spec-routes.d.ts +7 -0
- package/ccw/dist/core/routes/spec-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/spec-routes.js +266 -0
- package/ccw/dist/core/routes/spec-routes.js.map +1 -0
- package/ccw/dist/core/routes/status-routes.js +4 -4
- package/ccw/dist/core/routes/status-routes.js.map +1 -1
- package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/system-routes.js +537 -6
- package/ccw/dist/core/routes/system-routes.js.map +1 -1
- package/ccw/dist/core/routes/team-routes.d.ts +27 -0
- package/ccw/dist/core/routes/team-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/team-routes.js +557 -0
- package/ccw/dist/core/routes/team-routes.js.map +1 -0
- package/ccw/dist/core/routes/unified-memory-routes.d.ts +16 -0
- package/ccw/dist/core/routes/unified-memory-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/unified-memory-routes.js +135 -0
- package/ccw/dist/core/routes/unified-memory-routes.js.map +1 -0
- package/ccw/dist/core/routes/unsplash-routes.d.ts +4 -0
- package/ccw/dist/core/routes/unsplash-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/unsplash-routes.js +197 -0
- package/ccw/dist/core/routes/unsplash-routes.js.map +1 -0
- package/ccw/dist/core/schemas/issue-schema.d.ts +115 -0
- package/ccw/dist/core/schemas/issue-schema.d.ts.map +1 -0
- package/ccw/dist/core/schemas/issue-schema.js +117 -0
- package/ccw/dist/core/schemas/issue-schema.js.map +1 -0
- package/ccw/dist/core/server.d.ts +1 -0
- package/ccw/dist/core/server.d.ts.map +1 -1
- package/ccw/dist/core/server.js +223 -218
- package/ccw/dist/core/server.js.map +1 -1
- package/ccw/dist/core/services/checkpoint-service.d.ts +215 -0
- package/ccw/dist/core/services/checkpoint-service.d.ts.map +1 -0
- package/ccw/dist/core/services/checkpoint-service.js +376 -0
- package/ccw/dist/core/services/checkpoint-service.js.map +1 -0
- package/ccw/dist/core/services/cli-instruction-assembler.d.ts +10 -0
- package/ccw/dist/core/services/cli-instruction-assembler.d.ts.map +1 -0
- package/ccw/dist/core/services/cli-instruction-assembler.js +28 -0
- package/ccw/dist/core/services/cli-instruction-assembler.js.map +1 -0
- package/ccw/dist/core/services/cli-launch-registry.d.ts +9 -0
- package/ccw/dist/core/services/cli-launch-registry.d.ts.map +1 -0
- package/ccw/dist/core/services/cli-launch-registry.js +40 -0
- package/ccw/dist/core/services/cli-launch-registry.js.map +1 -0
- package/ccw/dist/core/services/cli-session-audit.d.ts +15 -0
- package/ccw/dist/core/services/cli-session-audit.d.ts.map +1 -0
- package/ccw/dist/core/services/cli-session-audit.js +18 -0
- package/ccw/dist/core/services/cli-session-audit.js.map +1 -0
- package/ccw/dist/core/services/cli-session-command-builder.d.ts +20 -0
- package/ccw/dist/core/services/cli-session-command-builder.d.ts.map +1 -0
- package/ccw/dist/core/services/cli-session-command-builder.js +66 -0
- package/ccw/dist/core/services/cli-session-command-builder.js.map +1 -0
- package/ccw/dist/core/services/cli-session-manager.d.ts +84 -0
- package/ccw/dist/core/services/cli-session-manager.d.ts.map +1 -0
- package/ccw/dist/core/services/cli-session-manager.js +538 -0
- package/ccw/dist/core/services/cli-session-manager.js.map +1 -0
- package/ccw/dist/core/services/cli-session-mux.d.ts +18 -0
- package/ccw/dist/core/services/cli-session-mux.d.ts.map +1 -0
- package/ccw/dist/core/services/cli-session-mux.js +18 -0
- package/ccw/dist/core/services/cli-session-mux.js.map +1 -0
- package/ccw/dist/core/services/cli-session-policy.d.ts +15 -0
- package/ccw/dist/core/services/cli-session-policy.d.ts.map +1 -0
- package/ccw/dist/core/services/cli-session-policy.js +40 -0
- package/ccw/dist/core/services/cli-session-policy.js.map +1 -0
- package/ccw/dist/core/services/cli-session-share.d.ts +27 -0
- package/ccw/dist/core/services/cli-session-share.d.ts.map +1 -0
- package/ccw/dist/core/services/cli-session-share.js +85 -0
- package/ccw/dist/core/services/cli-session-share.js.map +1 -0
- package/ccw/dist/core/services/config-backup.d.ts +69 -0
- package/ccw/dist/core/services/config-backup.d.ts.map +1 -0
- package/ccw/dist/core/services/config-backup.js +171 -0
- package/ccw/dist/core/services/config-backup.js.map +1 -0
- package/ccw/dist/core/services/config-sync.d.ts +73 -0
- package/ccw/dist/core/services/config-sync.d.ts.map +1 -0
- package/ccw/dist/core/services/config-sync.js +235 -0
- package/ccw/dist/core/services/config-sync.js.map +1 -0
- package/ccw/dist/core/services/flow-executor.d.ts +204 -0
- package/ccw/dist/core/services/flow-executor.d.ts.map +1 -0
- package/ccw/dist/core/services/flow-executor.js +775 -0
- package/ccw/dist/core/services/flow-executor.js.map +1 -0
- package/ccw/dist/core/services/hook-context-service.d.ts +139 -0
- package/ccw/dist/core/services/hook-context-service.d.ts.map +1 -0
- package/ccw/dist/core/services/hook-context-service.js +248 -0
- package/ccw/dist/core/services/hook-context-service.js.map +1 -0
- package/ccw/dist/core/services/index.d.ts +22 -0
- package/ccw/dist/core/services/index.d.ts.map +1 -0
- package/ccw/dist/core/services/index.js +22 -0
- package/ccw/dist/core/services/index.js.map +1 -0
- package/ccw/dist/core/services/issue-service.d.ts +54 -0
- package/ccw/dist/core/services/issue-service.d.ts.map +1 -0
- package/ccw/dist/core/services/issue-service.js +107 -0
- package/ccw/dist/core/services/issue-service.js.map +1 -0
- package/ccw/dist/core/services/mode-registry-service.d.ts +254 -0
- package/ccw/dist/core/services/mode-registry-service.d.ts.map +1 -0
- package/ccw/dist/core/services/mode-registry-service.js +587 -0
- package/ccw/dist/core/services/mode-registry-service.js.map +1 -0
- package/ccw/dist/core/services/pending-question-service.d.ts +51 -0
- package/ccw/dist/core/services/pending-question-service.d.ts.map +1 -0
- package/ccw/dist/core/services/pending-question-service.js +201 -0
- package/ccw/dist/core/services/pending-question-service.js.map +1 -0
- package/ccw/dist/core/services/queue-scheduler-service.d.ts +136 -0
- package/ccw/dist/core/services/queue-scheduler-service.d.ts.map +1 -0
- package/ccw/dist/core/services/queue-scheduler-service.js +587 -0
- package/ccw/dist/core/services/queue-scheduler-service.js.map +1 -0
- package/ccw/dist/core/services/rate-limiter.d.ts +20 -0
- package/ccw/dist/core/services/rate-limiter.d.ts.map +1 -0
- package/ccw/dist/core/services/rate-limiter.js +33 -0
- package/ccw/dist/core/services/rate-limiter.js.map +1 -0
- package/ccw/dist/core/services/remote-notification-service.d.ts +132 -0
- package/ccw/dist/core/services/remote-notification-service.d.ts.map +1 -0
- package/ccw/dist/core/services/remote-notification-service.js +953 -0
- package/ccw/dist/core/services/remote-notification-service.js.map +1 -0
- package/ccw/dist/core/services/session-end-service.d.ts +155 -0
- package/ccw/dist/core/services/session-end-service.d.ts.map +1 -0
- package/ccw/dist/core/services/session-end-service.js +302 -0
- package/ccw/dist/core/services/session-end-service.js.map +1 -0
- package/ccw/dist/core/services/session-state-service.d.ts +148 -0
- package/ccw/dist/core/services/session-state-service.d.ts.map +1 -0
- package/ccw/dist/core/services/session-state-service.js +259 -0
- package/ccw/dist/core/services/session-state-service.js.map +1 -0
- package/ccw/dist/core/services/version-checker.d.ts +50 -0
- package/ccw/dist/core/services/version-checker.d.ts.map +1 -0
- package/ccw/dist/core/services/version-checker.js +141 -0
- package/ccw/dist/core/services/version-checker.js.map +1 -0
- package/ccw/dist/core/session-clustering-service.d.ts +43 -2
- package/ccw/dist/core/session-clustering-service.d.ts.map +1 -1
- package/ccw/dist/core/session-clustering-service.js +210 -6
- package/ccw/dist/core/session-clustering-service.js.map +1 -1
- package/ccw/dist/core/types/issue.d.ts +103 -0
- package/ccw/dist/core/types/issue.d.ts.map +1 -0
- package/ccw/dist/core/types/issue.js +6 -0
- package/ccw/dist/core/types/issue.js.map +1 -0
- package/ccw/dist/core/unified-context-builder.d.ts +88 -0
- package/ccw/dist/core/unified-context-builder.d.ts.map +1 -0
- package/ccw/dist/core/unified-context-builder.js +379 -0
- package/ccw/dist/core/unified-context-builder.js.map +1 -0
- package/ccw/dist/core/unified-memory-service.d.ts +142 -0
- package/ccw/dist/core/unified-memory-service.d.ts.map +1 -0
- package/ccw/dist/core/unified-memory-service.js +348 -0
- package/ccw/dist/core/unified-memory-service.js.map +1 -0
- package/ccw/dist/core/unified-vector-index.d.ts +171 -0
- package/ccw/dist/core/unified-vector-index.d.ts.map +1 -0
- package/ccw/dist/core/unified-vector-index.js +332 -0
- package/ccw/dist/core/unified-vector-index.js.map +1 -0
- package/ccw/dist/core/websocket.d.ts +195 -0
- package/ccw/dist/core/websocket.d.ts.map +1 -1
- package/ccw/dist/core/websocket.js +156 -25
- package/ccw/dist/core/websocket.js.map +1 -1
- package/ccw/dist/index.d.ts +0 -1
- package/ccw/dist/index.d.ts.map +1 -1
- package/ccw/dist/index.js +0 -1
- package/ccw/dist/index.js.map +1 -1
- package/ccw/dist/mcp-server/index.js +16 -8
- package/ccw/dist/mcp-server/index.js.map +1 -1
- package/ccw/dist/tools/ask-question.d.ts +43 -0
- package/ccw/dist/tools/ask-question.d.ts.map +1 -0
- package/ccw/dist/tools/ask-question.js +1061 -0
- package/ccw/dist/tools/ask-question.js.map +1 -0
- package/ccw/dist/tools/claude-cli-tools.d.ts +18 -4
- package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.js +44 -37
- package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
- package/ccw/dist/tools/claude-session-parser.d.ts +116 -0
- package/ccw/dist/tools/claude-session-parser.d.ts.map +1 -0
- package/ccw/dist/tools/claude-session-parser.js +364 -0
- package/ccw/dist/tools/claude-session-parser.js.map +1 -0
- package/ccw/dist/tools/cli-config-manager.d.ts +3 -0
- package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -1
- package/ccw/dist/tools/cli-config-manager.js +4 -1
- package/ccw/dist/tools/cli-config-manager.js.map +1 -1
- package/ccw/dist/tools/cli-executor-core.d.ts +24 -0
- package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
- package/ccw/dist/tools/cli-executor-core.js +103 -8
- package/ccw/dist/tools/cli-executor-core.js.map +1 -1
- package/ccw/dist/tools/cli-executor-state.d.ts.map +1 -1
- package/ccw/dist/tools/cli-executor-state.js +4 -4
- package/ccw/dist/tools/cli-executor-state.js.map +1 -1
- package/ccw/dist/tools/cli-executor-utils.d.ts +2 -0
- package/ccw/dist/tools/cli-executor-utils.d.ts.map +1 -1
- package/ccw/dist/tools/cli-executor-utils.js +14 -5
- package/ccw/dist/tools/cli-executor-utils.js.map +1 -1
- package/ccw/dist/tools/cli-history-store.d.ts +11 -6
- package/ccw/dist/tools/cli-history-store.d.ts.map +1 -1
- package/ccw/dist/tools/cli-history-store.js +134 -17
- package/ccw/dist/tools/cli-history-store.js.map +1 -1
- package/ccw/dist/tools/cli-output-converter.d.ts +7 -0
- package/ccw/dist/tools/cli-output-converter.d.ts.map +1 -1
- package/ccw/dist/tools/cli-output-converter.js +166 -16
- package/ccw/dist/tools/cli-output-converter.js.map +1 -1
- package/ccw/dist/tools/codex-lens.d.ts +13 -0
- package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
- package/ccw/dist/tools/codex-lens.js +200 -185
- package/ccw/dist/tools/codex-lens.js.map +1 -1
- package/ccw/dist/tools/command-registry.test.js +727 -0
- package/ccw/dist/tools/core-memory.d.ts +35 -1
- package/ccw/dist/tools/core-memory.d.ts.map +1 -1
- package/ccw/dist/tools/core-memory.js +195 -5
- package/ccw/dist/tools/core-memory.js.map +1 -1
- package/ccw/dist/tools/edit-file.d.ts.map +1 -1
- package/ccw/dist/tools/edit-file.js +69 -31
- package/ccw/dist/tools/edit-file.js.map +1 -1
- package/ccw/dist/tools/generate-module-docs.d.ts.map +1 -1
- package/ccw/dist/tools/generate-module-docs.js +9 -14
- package/ccw/dist/tools/generate-module-docs.js.map +1 -1
- package/ccw/dist/tools/index.d.ts.map +1 -1
- package/ccw/dist/tools/index.js +8 -2
- package/ccw/dist/tools/index.js.map +1 -1
- package/ccw/dist/tools/native-session-discovery.d.ts +19 -2
- package/ccw/dist/tools/native-session-discovery.d.ts.map +1 -1
- package/ccw/dist/tools/native-session-discovery.js +191 -20
- package/ccw/dist/tools/native-session-discovery.js.map +1 -1
- package/ccw/dist/tools/opencode-session-parser.d.ts +120 -0
- package/ccw/dist/tools/opencode-session-parser.d.ts.map +1 -0
- package/ccw/dist/tools/opencode-session-parser.js +330 -0
- package/ccw/dist/tools/opencode-session-parser.js.map +1 -0
- package/ccw/dist/tools/read-file.d.ts +5 -24
- package/ccw/dist/tools/read-file.d.ts.map +1 -1
- package/ccw/dist/tools/read-file.js +44 -282
- package/ccw/dist/tools/read-file.js.map +1 -1
- package/ccw/dist/tools/read-many-files.d.ts +15 -0
- package/ccw/dist/tools/read-many-files.d.ts.map +1 -0
- package/ccw/dist/tools/read-many-files.js +166 -0
- package/ccw/dist/tools/read-many-files.js.map +1 -0
- package/ccw/dist/tools/read-outline.d.ts +13 -0
- package/ccw/dist/tools/read-outline.d.ts.map +1 -0
- package/ccw/dist/tools/read-outline.js +86 -0
- package/ccw/dist/tools/read-outline.js.map +1 -0
- package/ccw/dist/tools/resume-strategy.d.ts.map +1 -1
- package/ccw/dist/tools/resume-strategy.js +16 -0
- package/ccw/dist/tools/resume-strategy.js.map +1 -1
- package/ccw/dist/tools/session-content-parser.d.ts +3 -3
- package/ccw/dist/tools/session-content-parser.d.ts.map +1 -1
- package/ccw/dist/tools/session-content-parser.js +40 -10
- package/ccw/dist/tools/session-content-parser.js.map +1 -1
- package/ccw/dist/tools/spec-index-builder.d.ts +140 -0
- package/ccw/dist/tools/spec-index-builder.d.ts.map +1 -0
- package/ccw/dist/tools/spec-index-builder.js +340 -0
- package/ccw/dist/tools/spec-index-builder.js.map +1 -0
- package/ccw/dist/tools/spec-init.d.ts +46 -0
- package/ccw/dist/tools/spec-init.d.ts.map +1 -0
- package/ccw/dist/tools/spec-init.js +226 -0
- package/ccw/dist/tools/spec-init.js.map +1 -0
- package/ccw/dist/tools/spec-keyword-extractor.d.ts +52 -0
- package/ccw/dist/tools/spec-keyword-extractor.d.ts.map +1 -0
- package/ccw/dist/tools/spec-keyword-extractor.js +183 -0
- package/ccw/dist/tools/spec-keyword-extractor.js.map +1 -0
- package/ccw/dist/tools/spec-loader.d.ts +119 -0
- package/ccw/dist/tools/spec-loader.d.ts.map +1 -0
- package/ccw/dist/tools/spec-loader.js +326 -0
- package/ccw/dist/tools/spec-loader.js.map +1 -0
- package/ccw/dist/tools/team-msg.d.ts +61 -0
- package/ccw/dist/tools/team-msg.d.ts.map +1 -0
- package/ccw/dist/tools/team-msg.js +331 -0
- package/ccw/dist/tools/team-msg.js.map +1 -0
- package/ccw/dist/tools/template-discovery.d.ts +1 -1
- package/ccw/dist/tools/template-discovery.js +2 -2
- package/ccw/dist/tools/template-discovery.js.map +1 -1
- package/ccw/dist/tools/ui-generate-preview.js +7 -7
- package/ccw/dist/tools/ui-generate-preview.js.map +1 -1
- package/ccw/dist/tools/update-module-claude.d.ts.map +1 -1
- package/ccw/dist/tools/update-module-claude.js +18 -32
- package/ccw/dist/tools/update-module-claude.js.map +1 -1
- package/ccw/dist/types/cli-settings.d.ts +139 -9
- package/ccw/dist/types/cli-settings.d.ts.map +1 -1
- package/ccw/dist/types/cli-settings.js +67 -13
- package/ccw/dist/types/cli-settings.js.map +1 -1
- package/ccw/dist/types/queue-types.d.ts +156 -0
- package/ccw/dist/types/queue-types.d.ts.map +1 -0
- package/ccw/dist/types/queue-types.js +6 -0
- package/ccw/dist/types/queue-types.js.map +1 -0
- package/ccw/dist/types/remote-notification.d.ts +209 -0
- package/ccw/dist/types/remote-notification.d.ts.map +1 -0
- package/ccw/dist/types/remote-notification.js +86 -0
- package/ccw/dist/types/remote-notification.js.map +1 -0
- package/ccw/dist/types/util.d.ts +28 -0
- package/ccw/dist/types/util.d.ts.map +1 -0
- package/ccw/dist/types/util.js +35 -0
- package/ccw/dist/types/util.js.map +1 -0
- package/ccw/dist/utils/dashboard-launcher.d.ts +36 -0
- package/ccw/dist/utils/dashboard-launcher.d.ts.map +1 -0
- package/ccw/dist/utils/dashboard-launcher.js +166 -0
- package/ccw/dist/utils/dashboard-launcher.js.map +1 -0
- package/ccw/dist/utils/db-loader.d.ts +15 -0
- package/ccw/dist/utils/db-loader.d.ts.map +1 -0
- package/ccw/dist/utils/db-loader.js +51 -0
- package/ccw/dist/utils/db-loader.js.map +1 -0
- package/ccw/dist/utils/file-reader.d.ts +73 -0
- package/ccw/dist/utils/file-reader.d.ts.map +1 -0
- package/ccw/dist/utils/file-reader.js +201 -0
- package/ccw/dist/utils/file-reader.js.map +1 -0
- package/ccw/dist/utils/outline-parser.d.ts +28 -0
- package/ccw/dist/utils/outline-parser.d.ts.map +1 -0
- package/ccw/dist/utils/outline-parser.js +273 -0
- package/ccw/dist/utils/outline-parser.js.map +1 -0
- package/ccw/dist/utils/outline-queries.d.ts +15 -0
- package/ccw/dist/utils/outline-queries.d.ts.map +1 -0
- package/ccw/dist/utils/outline-queries.js +141 -0
- package/ccw/dist/utils/outline-queries.js.map +1 -0
- package/ccw/dist/utils/package-discovery.d.ts +69 -0
- package/ccw/dist/utils/package-discovery.d.ts.map +1 -0
- package/ccw/dist/utils/package-discovery.js +258 -0
- package/ccw/dist/utils/package-discovery.js.map +1 -0
- package/ccw/dist/utils/path-validator.d.ts +3 -3
- package/ccw/dist/utils/path-validator.d.ts.map +1 -1
- package/ccw/dist/utils/path-validator.js +12 -12
- package/ccw/dist/utils/path-validator.js.map +1 -1
- package/ccw/dist/utils/react-frontend.d.ts +19 -0
- package/ccw/dist/utils/react-frontend.d.ts.map +1 -0
- package/ccw/dist/utils/react-frontend.js +203 -0
- package/ccw/dist/utils/react-frontend.js.map +1 -0
- package/ccw/dist/utils/secret-redactor.d.ts +23 -0
- package/ccw/dist/utils/secret-redactor.d.ts.map +1 -0
- package/ccw/dist/utils/secret-redactor.js +48 -0
- package/ccw/dist/utils/secret-redactor.js.map +1 -0
- package/ccw/dist/utils/security-validation.d.ts +48 -0
- package/ccw/dist/utils/security-validation.d.ts.map +1 -0
- package/ccw/dist/utils/security-validation.js +117 -0
- package/ccw/dist/utils/security-validation.js.map +1 -0
- package/ccw/dist/utils/uv-manager.d.ts +3 -2
- package/ccw/dist/utils/uv-manager.d.ts.map +1 -1
- package/ccw/dist/utils/uv-manager.js +7 -4
- package/ccw/dist/utils/uv-manager.js.map +1 -1
- package/ccw/scripts/prepublish-clean.mjs +32 -0
- package/ccw/scripts/unified_memory_embedder.py +473 -0
- package/codex-lens/pyproject.toml +37 -46
- package/codex-lens/src/codexlens/api/__init__.py +5 -0
- package/codex-lens/src/codexlens/api/lsp_lifecycle.py +124 -0
- package/codex-lens/src/codexlens/api/semantic.py +33 -22
- package/codex-lens/src/codexlens/cli/commands.py +392 -552
- package/codex-lens/src/codexlens/cli/embedding_manager.py +558 -367
- package/codex-lens/src/codexlens/config.py +525 -129
- package/codex-lens/src/codexlens/env_config.py +21 -1
- package/codex-lens/src/codexlens/lsp/keepalive_bridge.py +135 -0
- package/codex-lens/src/codexlens/lsp/lsp_bridge.py +33 -10
- package/codex-lens/src/codexlens/lsp/lsp_graph_builder.py +12 -4
- package/codex-lens/src/codexlens/lsp/standalone_manager.py +114 -21
- package/codex-lens/src/codexlens/parsers/__init__.py +8 -2
- package/codex-lens/src/codexlens/parsers/astgrep_binding.py +320 -0
- package/codex-lens/src/codexlens/parsers/astgrep_js_ts_processor.py +306 -0
- package/codex-lens/src/codexlens/parsers/astgrep_processor.py +1033 -0
- package/codex-lens/src/codexlens/parsers/factory.py +10 -2
- package/codex-lens/src/codexlens/parsers/patterns/__init__.py +5 -0
- package/codex-lens/src/codexlens/parsers/patterns/javascript/__init__.py +92 -0
- package/codex-lens/src/codexlens/parsers/patterns/python/__init__.py +204 -0
- package/codex-lens/src/codexlens/parsers/patterns/python/call.yaml +87 -0
- package/codex-lens/src/codexlens/parsers/patterns/python/imports.yaml +82 -0
- package/codex-lens/src/codexlens/parsers/patterns/python/inherits.yaml +42 -0
- package/codex-lens/src/codexlens/parsers/patterns/typescript/__init__.py +73 -0
- package/codex-lens/src/codexlens/parsers/treesitter_parser.py +135 -9
- package/codex-lens/src/codexlens/search/__init__.py +2 -0
- package/codex-lens/src/codexlens/search/binary_searcher.py +67 -35
- package/codex-lens/src/codexlens/search/chain_search.py +825 -251
- package/codex-lens/src/codexlens/search/clustering/hdbscan_strategy.py +24 -2
- package/codex-lens/src/codexlens/search/global_graph_expander.py +250 -0
- package/codex-lens/src/codexlens/search/hybrid_search.py +11 -203
- package/codex-lens/src/codexlens/search/ranking.py +8 -35
- package/codex-lens/src/codexlens/semantic/reranker/api_reranker.py +41 -2
- package/codex-lens/src/codexlens/storage/global_index.py +225 -5
- package/codex-lens/src/codexlens/storage/index_tree.py +46 -0
- package/codex-lens/src/codexlens/storage/path_mapper.py +8 -8
- package/codex-lens/src/codexlens/watcher/incremental_indexer.py +55 -1
- package/package.json +102 -92
- package/.claude/CLAUDE.md +0 -44
- package/.claude/commands/ccw-debug.md +0 -832
- package/.claude/commands/codex-coordinator.md +0 -513
- package/.claude/commands/memory/compact.md +0 -383
- package/.claude/commands/memory/docs-full-cli.md +0 -471
- package/.claude/commands/memory/docs-related-cli.md +0 -386
- package/.claude/commands/memory/load.md +0 -240
- package/.claude/commands/memory/tips.md +0 -332
- package/.claude/commands/memory/update-full.md +0 -332
- package/.claude/commands/memory/update-related.md +0 -332
- package/.claude/commands/view.md +0 -367
- package/.claude/commands/workflow/brainstorm/artifacts.md +0 -457
- package/.claude/commands/workflow/brainstorm/auto-parallel.md +0 -433
- package/.claude/commands/workflow/brainstorm/role-analysis.md +0 -705
- package/.claude/commands/workflow/brainstorm/synthesis.md +0 -402
- package/.claude/commands/workflow/execute.md +0 -548
- package/.claude/commands/workflow/lite-execute.md +0 -743
- package/.claude/commands/workflow/lite-fix.md +0 -809
- package/.claude/commands/workflow/lite-lite-lite.md +0 -465
- package/.claude/commands/workflow/lite-plan.md +0 -698
- package/.claude/commands/workflow/multi-cli-plan.md +0 -572
- package/.claude/commands/workflow/plan-verify.md +0 -362
- package/.claude/commands/workflow/plan.md +0 -691
- package/.claude/commands/workflow/replan.md +0 -648
- package/.claude/commands/workflow/review-cycle-fix.md +0 -608
- package/.claude/commands/workflow/review-module-cycle.md +0 -771
- package/.claude/commands/workflow/review-session-cycle.md +0 -782
- package/.claude/commands/workflow/review.md +0 -322
- package/.claude/commands/workflow/tdd-plan.md +0 -630
- package/.claude/commands/workflow/tdd-verify.md +0 -585
- package/.claude/commands/workflow/test-cycle-execute.md +0 -504
- package/.claude/commands/workflow/test-fix-gen.md +0 -699
- package/.claude/commands/workflow/test-gen.md +0 -529
- package/.claude/commands/workflow/tools/conflict-resolution.md +0 -604
- package/.claude/commands/workflow/tools/context-gather.md +0 -404
- package/.claude/commands/workflow/tools/task-generate-agent.md +0 -667
- package/.claude/commands/workflow/tools/task-generate-tdd.md +0 -749
- package/.claude/commands/workflow/tools/tdd-coverage-analysis.md +0 -309
- package/.claude/commands/workflow/tools/test-concept-enhanced.md +0 -164
- package/.claude/commands/workflow/tools/test-context-gather.md +0 -235
- package/.claude/commands/workflow/tools/test-task-generate.md +0 -255
- package/.claude/skills/ccw-loop/SKILL.md +0 -259
- package/.claude/skills/ccw-loop/phases/actions/action-complete.md +0 -320
- package/.claude/skills/ccw-loop/phases/actions/action-debug-with-file.md +0 -485
- package/.claude/skills/ccw-loop/phases/actions/action-develop-with-file.md +0 -365
- package/.claude/skills/ccw-loop/phases/actions/action-init.md +0 -200
- package/.claude/skills/ccw-loop/phases/actions/action-menu.md +0 -192
- package/.claude/skills/ccw-loop/phases/actions/action-validate-with-file.md +0 -307
- package/.claude/skills/ccw-loop/phases/orchestrator.md +0 -486
- package/.claude/skills/ccw-loop/phases/state-schema.md +0 -474
- package/.claude/skills/ccw-loop/specs/action-catalog.md +0 -300
- package/.claude/skills/ccw-loop/specs/loop-requirements.md +0 -192
- package/.claude/skills/ccw-loop/templates/progress-template.md +0 -175
- package/.claude/skills/ccw-loop/templates/understanding-template.md +0 -303
- package/.claude/skills/ccw-loop/templates/validation-template.md +0 -258
- package/.claude/skills/copyright-docs/SKILL.md +0 -132
- package/.claude/skills/copyright-docs/phases/01-metadata-collection.md +0 -78
- package/.claude/skills/copyright-docs/phases/01.5-project-exploration.md +0 -150
- package/.claude/skills/copyright-docs/phases/02-deep-analysis.md +0 -664
- package/.claude/skills/copyright-docs/phases/02.5-consolidation.md +0 -192
- package/.claude/skills/copyright-docs/phases/04-document-assembly.md +0 -261
- package/.claude/skills/copyright-docs/phases/05-compliance-refinement.md +0 -192
- package/.claude/skills/copyright-docs/specs/cpcc-requirements.md +0 -121
- package/.claude/skills/copyright-docs/templates/agent-base.md +0 -200
- package/.claude/skills/lite-skill-generator/SKILL.md +0 -650
- package/.claude/skills/lite-skill-generator/templates/simple-skill.md +0 -68
- package/.claude/skills/lite-skill-generator/templates/style-guide.md +0 -64
- package/.claude/skills/project-analyze/SKILL.md +0 -162
- package/.claude/skills/project-analyze/phases/01-requirements-discovery.md +0 -79
- package/.claude/skills/project-analyze/phases/02-project-exploration.md +0 -176
- package/.claude/skills/project-analyze/phases/03-deep-analysis.md +0 -854
- package/.claude/skills/project-analyze/phases/03.5-consolidation.md +0 -233
- package/.claude/skills/project-analyze/phases/04-report-generation.md +0 -217
- package/.claude/skills/project-analyze/phases/05-iterative-refinement.md +0 -124
- package/.claude/skills/project-analyze/specs/quality-standards.md +0 -115
- package/.claude/skills/project-analyze/specs/writing-style.md +0 -152
- package/.claude/skills/prompt-enhancer/SKILL.md +0 -124
- package/.claude/skills/software-manual/SKILL.md +0 -184
- package/.claude/skills/software-manual/phases/01-requirements-discovery.md +0 -162
- package/.claude/skills/software-manual/phases/02-project-exploration.md +0 -101
- package/.claude/skills/software-manual/phases/02.5-api-extraction.md +0 -161
- package/.claude/skills/software-manual/phases/03-parallel-analysis.md +0 -183
- package/.claude/skills/software-manual/phases/03.5-consolidation.md +0 -82
- package/.claude/skills/software-manual/phases/04-screenshot-capture.md +0 -89
- package/.claude/skills/software-manual/phases/05-html-assembly.md +0 -132
- package/.claude/skills/software-manual/phases/06-iterative-refinement.md +0 -259
- package/.claude/skills/software-manual/scripts/api-extractor.md +0 -245
- package/.claude/skills/software-manual/scripts/assemble_docsify.py +0 -584
- package/.claude/skills/software-manual/scripts/bundle-libraries.md +0 -85
- package/.claude/skills/software-manual/scripts/extract_apis.py +0 -270
- package/.claude/skills/software-manual/scripts/screenshot-helper.md +0 -447
- package/.claude/skills/software-manual/scripts/swagger-runner.md +0 -419
- package/.claude/skills/software-manual/scripts/typedoc-runner.md +0 -357
- package/.claude/skills/software-manual/specs/html-template.md +0 -325
- package/.claude/skills/software-manual/specs/quality-standards.md +0 -253
- package/.claude/skills/software-manual/specs/writing-style.md +0 -298
- package/.claude/skills/software-manual/templates/css/docsify-base.css +0 -984
- package/.claude/skills/software-manual/templates/css/wiki-base.css +0 -788
- package/.claude/skills/software-manual/templates/css/wiki-dark.css +0 -278
- package/.claude/skills/software-manual/templates/docsify-shell.html +0 -466
- package/.claude/skills/software-manual/templates/tiddlywiki-shell.html +0 -327
- package/.claude/skills/text-formatter/SKILL.md +0 -196
- package/.claude/skills/text-formatter/phases/01-input-collection.md +0 -111
- package/.claude/skills/text-formatter/phases/02-content-analysis.md +0 -248
- package/.claude/skills/text-formatter/phases/03-format-transform.md +0 -245
- package/.claude/skills/text-formatter/phases/04-output-preview.md +0 -183
- package/.claude/skills/text-formatter/specs/callout-types.md +0 -293
- package/.claude/skills/text-formatter/specs/element-mapping.md +0 -226
- package/.claude/skills/text-formatter/specs/format-rules.md +0 -273
- package/.claude/skills/text-formatter/templates/bbcode-template.md +0 -350
- package/.claude/workflows/_template-compare-matrix.html +0 -692
- package/.claude/workflows/chinese-response.md +0 -25
- package/.claude/workflows/cli-templates/fix-plan-template.json +0 -75
- package/.claude/workflows/cli-templates/fix-progress-template.json +0 -48
- package/.claude/workflows/cli-templates/memory/style-skill-memory/skill-md-template.md +0 -299
- package/.claude/workflows/cli-templates/planning-roles/data-architect.md +0 -120
- package/.claude/workflows/cli-templates/planning-roles/product-manager.md +0 -119
- package/.claude/workflows/cli-templates/planning-roles/product-owner.md +0 -261
- package/.claude/workflows/cli-templates/planning-roles/scrum-master.md +0 -186
- package/.claude/workflows/cli-templates/planning-roles/subject-matter-expert.md +0 -281
- package/.claude/workflows/cli-templates/planning-roles/synthesis-role.md +0 -414
- package/.claude/workflows/cli-templates/planning-roles/system-architect.md +0 -106
- package/.claude/workflows/cli-templates/planning-roles/test-strategist.md +0 -124
- package/.claude/workflows/cli-templates/planning-roles/ui-designer.md +0 -379
- package/.claude/workflows/cli-templates/planning-roles/ux-expert.md +0 -240
- package/.claude/workflows/cli-templates/prompts/analysis-analyze-code-patterns.txt +0 -37
- package/.claude/workflows/cli-templates/prompts/analysis-analyze-performance.txt +0 -29
- package/.claude/workflows/cli-templates/prompts/analysis-analyze-technical-document.txt +0 -33
- package/.claude/workflows/cli-templates/prompts/analysis-assess-security-risks.txt +0 -29
- package/.claude/workflows/cli-templates/prompts/analysis-diagnose-bug-root-cause.txt +0 -127
- package/.claude/workflows/cli-templates/prompts/analysis-review-architecture.txt +0 -29
- package/.claude/workflows/cli-templates/prompts/analysis-review-code-quality.txt +0 -28
- package/.claude/workflows/cli-templates/prompts/analysis-review-quality-standards.txt +0 -29
- package/.claude/workflows/cli-templates/prompts/analysis-trace-code-execution.txt +0 -115
- package/.claude/workflows/cli-templates/prompts/development-debug-runtime-issues.txt +0 -55
- package/.claude/workflows/cli-templates/prompts/development-generate-tests.txt +0 -70
- package/.claude/workflows/cli-templates/prompts/development-implement-component-ui.txt +0 -55
- package/.claude/workflows/cli-templates/prompts/development-implement-feature.txt +0 -58
- package/.claude/workflows/cli-templates/prompts/development-refactor-codebase.txt +0 -55
- package/.claude/workflows/cli-templates/prompts/documentation-api.txt +0 -15
- package/.claude/workflows/cli-templates/prompts/documentation-folder-navigation.txt +0 -27
- package/.claude/workflows/cli-templates/prompts/documentation-module-readme.txt +0 -49
- package/.claude/workflows/cli-templates/prompts/documentation-project-architecture.txt +0 -41
- package/.claude/workflows/cli-templates/prompts/documentation-project-examples.txt +0 -35
- package/.claude/workflows/cli-templates/prompts/documentation-project-readme.txt +0 -35
- package/.claude/workflows/cli-templates/prompts/documentation-swagger-api.txt +0 -266
- package/.claude/workflows/cli-templates/prompts/memory-document-module-structure.txt +0 -165
- package/.claude/workflows/cli-templates/prompts/planning-breakdown-task-steps.txt +0 -30
- package/.claude/workflows/cli-templates/prompts/planning-design-component-spec.txt +0 -28
- package/.claude/workflows/cli-templates/prompts/planning-evaluate-concept-feasibility.txt +0 -127
- package/.claude/workflows/cli-templates/prompts/planning-plan-architecture-design.txt +0 -109
- package/.claude/workflows/cli-templates/prompts/planning-plan-migration-strategy.txt +0 -30
- package/.claude/workflows/cli-templates/prompts/rules-rule-api.txt +0 -122
- package/.claude/workflows/cli-templates/prompts/rules-rule-components.txt +0 -122
- package/.claude/workflows/cli-templates/prompts/rules-rule-config.txt +0 -89
- package/.claude/workflows/cli-templates/prompts/rules-rule-core.txt +0 -60
- package/.claude/workflows/cli-templates/prompts/rules-rule-patterns.txt +0 -70
- package/.claude/workflows/cli-templates/prompts/rules-rule-testing.txt +0 -81
- package/.claude/workflows/cli-templates/prompts/rules-tech-rules-agent-prompt.txt +0 -89
- package/.claude/workflows/cli-templates/prompts/tech-tech-module-format.txt +0 -359
- package/.claude/workflows/cli-templates/prompts/tech-tech-skill-index.txt +0 -185
- package/.claude/workflows/cli-templates/prompts/test-test-concept-analysis.txt +0 -179
- package/.claude/workflows/cli-templates/prompts/universal-universal-creative-style.txt +0 -95
- package/.claude/workflows/cli-templates/prompts/universal-universal-rigorous-style.txt +0 -92
- package/.claude/workflows/cli-templates/prompts/verification-codex-technical.txt +0 -28
- package/.claude/workflows/cli-templates/prompts/verification-cross-validation.txt +0 -28
- package/.claude/workflows/cli-templates/prompts/verification-gemini-strategic.txt +0 -27
- package/.claude/workflows/cli-templates/prompts/workflow-analysis-results-structure.txt +0 -224
- package/.claude/workflows/cli-templates/prompts/workflow-codex-feasibility-validation.txt +0 -176
- package/.claude/workflows/cli-templates/prompts/workflow-gemini-solution-design.txt +0 -131
- package/.claude/workflows/cli-templates/prompts/workflow-impl-plan-template.txt +0 -286
- package/.claude/workflows/cli-templates/prompts/workflow-skill-aggregation.txt +0 -172
- package/.claude/workflows/cli-templates/prompts/workflow-skill-conflict-patterns.txt +0 -94
- package/.claude/workflows/cli-templates/prompts/workflow-skill-index.txt +0 -224
- package/.claude/workflows/cli-templates/prompts/workflow-skill-lessons-learned.txt +0 -94
- package/.claude/workflows/cli-templates/prompts/workflow-skill-sessions-timeline.txt +0 -53
- package/.claude/workflows/cli-templates/prompts/workflow-task-json-agent-mode.txt +0 -123
- package/.claude/workflows/cli-templates/prompts/workflow-task-json-cli-mode.txt +0 -182
- package/.claude/workflows/cli-templates/protocols/analysis-protocol.md +0 -119
- package/.claude/workflows/cli-templates/protocols/write-protocol.md +0 -136
- package/.claude/workflows/cli-templates/schemas/conflict-resolution-schema.json +0 -151
- package/.claude/workflows/cli-templates/schemas/debug-log-json-schema.json +0 -127
- package/.claude/workflows/cli-templates/schemas/diagnosis-json-schema.json +0 -234
- package/.claude/workflows/cli-templates/schemas/discovery-finding-schema.json +0 -219
- package/.claude/workflows/cli-templates/schemas/discovery-state-schema.json +0 -125
- package/.claude/workflows/cli-templates/schemas/explore-json-schema.json +0 -124
- package/.claude/workflows/cli-templates/schemas/fix-plan-json-schema.json +0 -298
- package/.claude/workflows/cli-templates/schemas/issues-jsonl-schema.json +0 -170
- package/.claude/workflows/cli-templates/schemas/multi-cli-discussion-schema.json +0 -421
- package/.claude/workflows/cli-templates/schemas/plan-json-schema.json +0 -444
- package/.claude/workflows/cli-templates/schemas/plan-verify-agent-schema.json +0 -47
- package/.claude/workflows/cli-templates/schemas/project-guidelines-schema.json +0 -141
- package/.claude/workflows/cli-templates/schemas/project-tech-schema.json +0 -221
- package/.claude/workflows/cli-templates/schemas/queue-schema.json +0 -248
- package/.claude/workflows/cli-templates/schemas/registry-schema.json +0 -94
- package/.claude/workflows/cli-templates/schemas/review-deep-dive-results-schema.json +0 -82
- package/.claude/workflows/cli-templates/schemas/review-dimension-results-schema.json +0 -51
- package/.claude/workflows/cli-templates/schemas/solution-schema.json +0 -166
- package/.claude/workflows/cli-templates/schemas/verify-json-schema.json +0 -158
- package/.claude/workflows/cli-templates/tech-stacks/go-dev.md +0 -91
- package/.claude/workflows/cli-templates/tech-stacks/java-dev.md +0 -107
- package/.claude/workflows/cli-templates/tech-stacks/javascript-dev.md +0 -58
- package/.claude/workflows/cli-templates/tech-stacks/python-dev.md +0 -79
- package/.claude/workflows/cli-templates/tech-stacks/react-dev.md +0 -103
- package/.claude/workflows/cli-templates/tech-stacks/typescript-dev.md +0 -83
- package/.claude/workflows/cli-templates/ui-design/systems/animation-tokens.json +0 -247
- package/.claude/workflows/cli-templates/ui-design/systems/design-tokens.json +0 -342
- package/.claude/workflows/cli-templates/ui-design/systems/layout-templates.json +0 -145
- package/.claude/workflows/cli-tools-usage.md +0 -538
- package/.claude/workflows/coding-philosophy.md +0 -70
- package/.claude/workflows/context-tools.md +0 -76
- package/.claude/workflows/file-modification.md +0 -64
- package/.claude/workflows/review-directory-specification.md +0 -336
- package/.claude/workflows/task-core.md +0 -214
- package/.claude/workflows/tool-strategy.md +0 -216
- package/.claude/workflows/windows-platform.md +0 -19
- package/.claude/workflows/workflow-architecture.md +0 -942
- package/.codex/agents/ccw-loop-b-complete.md +0 -227
- package/.codex/agents/ccw-loop-b-debug.md +0 -172
- package/.codex/agents/ccw-loop-b-develop.md +0 -147
- package/.codex/agents/ccw-loop-b-init.md +0 -82
- package/.codex/agents/ccw-loop-b-validate.md +0 -204
- package/.codex/agents/ccw-loop-executor.md +0 -260
- package/.codex/prompts/analyze-with-file.md +0 -610
- package/.codex/prompts/brainstorm-to-cycle.md +0 -456
- package/.codex/prompts/brainstorm-with-file.md +0 -1004
- package/.codex/prompts/clean.md +0 -414
- package/.codex/prompts/compact.md +0 -380
- package/.codex/prompts/debug-with-file.md +0 -608
- package/.codex/prompts/execute.md +0 -277
- package/.codex/prompts/issue-discover-by-prompt.md +0 -364
- package/.codex/prompts/issue-discover.md +0 -261
- package/.codex/prompts/issue-execute.md +0 -768
- package/.codex/prompts/issue-new.md +0 -390
- package/.codex/prompts/issue-plan.md +0 -246
- package/.codex/prompts/issue-queue.md +0 -298
- package/.codex/prompts/lite-execute.md +0 -684
- package/.codex/prompts/lite-fix.md +0 -674
- package/.codex/prompts/lite-plan-a.md +0 -341
- package/.codex/prompts/lite-plan-b.md +0 -489
- package/.codex/prompts/lite-plan-c.md +0 -605
- package/.codex/prompts/merge-plans-with-file.md +0 -530
- package/.codex/prompts/unified-execute-with-file.md +0 -722
- package/.codex/skills/ccw-loop/README.md +0 -171
- package/.codex/skills/ccw-loop/SKILL.md +0 -350
- package/.codex/skills/ccw-loop/phases/actions/action-complete.md +0 -269
- package/.codex/skills/ccw-loop/phases/actions/action-debug.md +0 -286
- package/.codex/skills/ccw-loop/phases/actions/action-develop.md +0 -183
- package/.codex/skills/ccw-loop/phases/actions/action-init.md +0 -164
- package/.codex/skills/ccw-loop/phases/actions/action-menu.md +0 -205
- package/.codex/skills/ccw-loop/phases/actions/action-validate.md +0 -250
- package/.codex/skills/ccw-loop/phases/orchestrator.md +0 -416
- package/.codex/skills/ccw-loop/phases/state-schema.md +0 -388
- package/.codex/skills/ccw-loop/specs/action-catalog.md +0 -182
- package/.codex/skills/ccw-loop-b/README.md +0 -301
- package/.codex/skills/ccw-loop-b/SKILL.md +0 -323
- package/.codex/skills/ccw-loop-b/phases/orchestrator.md +0 -257
- package/.codex/skills/ccw-loop-b/phases/state-schema.md +0 -181
- package/.codex/skills/ccw-loop-b/specs/action-catalog.md +0 -383
- package/.codex/skills/codex-issue-plan-execute/SKILL.md +0 -214
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-complete.md +0 -173
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-execute.md +0 -220
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-init.md +0 -86
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-list.md +0 -165
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-plan.md +0 -170
- package/.codex/skills/codex-issue-plan-execute/phases/orchestrator.md +0 -212
- package/.codex/skills/codex-issue-plan-execute/phases/state-schema.md +0 -136
- package/.codex/skills/codex-issue-plan-execute/prompts/execution-agent-system.md +0 -32
- package/.codex/skills/codex-issue-plan-execute/prompts/execution-agent.md +0 -323
- package/.codex/skills/codex-issue-plan-execute/prompts/planning-agent-system.md +0 -32
- package/.codex/skills/codex-issue-plan-execute/prompts/planning-agent.md +0 -224
- package/.codex/skills/codex-issue-plan-execute/specs/agent-roles.md +0 -468
- package/.codex/skills/codex-issue-plan-execute/specs/issue-handling.md +0 -187
- package/.codex/skills/codex-issue-plan-execute/specs/quality-standards.md +0 -231
- package/.codex/skills/codex-issue-plan-execute/specs/solution-schema.md +0 -270
- package/.codex/skills/codex-issue-plan-execute/specs/subagent-roles.md +0 -32
- package/.codex/skills/parallel-dev-cycle/README.md +0 -385
- package/.codex/skills/parallel-dev-cycle/phases/agents/code-developer.md +0 -327
- package/.codex/skills/parallel-dev-cycle/phases/agents/exploration-planner.md +0 -285
- package/.codex/skills/parallel-dev-cycle/phases/agents/requirements-analyst.md +0 -370
- package/.codex/skills/parallel-dev-cycle/phases/agents/validation-archivist.md +0 -381
- package/.codex/skills/parallel-dev-cycle/phases/orchestrator.md +0 -696
- package/.codex/skills/parallel-dev-cycle/phases/state-schema.md +0 -436
- package/.codex/skills/parallel-dev-cycle/skill.md +0 -194
- package/.codex/skills/parallel-dev-cycle/specs/communication-optimization.md +0 -423
- package/.codex/skills/parallel-dev-cycle/specs/coordination-protocol.md +0 -406
- package/.codex/skills/parallel-dev-cycle/specs/versioning-strategy.md +0 -331
- package/ccw/dist/core/dashboard-generator-patch.d.ts +0 -2
- package/ccw/dist/core/dashboard-generator-patch.d.ts.map +0 -1
- package/ccw/dist/core/dashboard-generator-patch.js +0 -48
- package/ccw/dist/core/dashboard-generator-patch.js.map +0 -1
- package/ccw/dist/core/dashboard-generator.d.ts +0 -8
- package/ccw/dist/core/dashboard-generator.d.ts.map +0 -1
- package/ccw/dist/core/dashboard-generator.js +0 -706
- package/ccw/dist/core/dashboard-generator.js.map +0 -1
- package/ccw/dist/core/routes/model-routes.d.ts +0 -11
- package/ccw/dist/core/routes/model-routes.d.ts.map +0 -1
- package/ccw/dist/core/routes/model-routes.js +0 -112
- package/ccw/dist/core/routes/model-routes.js.map +0 -1
- package/ccw/dist/tools/command-registry.test.d.ts +0 -14
- package/ccw/dist/tools/command-registry.test.d.ts.map +0 -1
- package/ccw/dist/tools/command-registry.test.js.map +0 -1
- package/ccw/scripts/__pycache__/memory_embedder.cpython-313.pyc +0 -0
- package/ccw/scripts/__pycache__/test_memory_embedder.cpython-313-pytest-8.4.2.pyc +0 -0
- 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 +0 -326
- package/ccw/src/commands/cli.ts +0 -1492
- package/ccw/src/commands/core-memory.ts +0 -770
- package/ccw/src/commands/hook.ts +0 -316
- package/ccw/src/commands/install.ts +0 -799
- package/ccw/src/commands/issue.ts +0 -3150
- package/ccw/src/commands/list.ts +0 -37
- package/ccw/src/commands/loop.ts +0 -344
- package/ccw/src/commands/memory.ts +0 -1090
- package/ccw/src/commands/serve.ts +0 -86
- package/ccw/src/commands/session-path-resolver.ts +0 -372
- package/ccw/src/commands/session.ts +0 -1141
- package/ccw/src/commands/stop.ts +0 -138
- package/ccw/src/commands/tool.ts +0 -216
- package/ccw/src/commands/uninstall.ts +0 -309
- package/ccw/src/commands/upgrade.ts +0 -352
- package/ccw/src/commands/view.ts +0 -133
- package/ccw/src/commands/workflow.ts +0 -348
- package/ccw/src/config/.litellm-api-config-manager.ts.2025-12-23T11-57-43-727Z.bak +0 -441
- package/ccw/src/config/cli-settings-manager.ts +0 -460
- package/ccw/src/config/litellm-api-config-manager.ts +0 -1350
- package/ccw/src/config/litellm-provider-models.ts +0 -222
- package/ccw/src/config/provider-models.ts +0 -123
- package/ccw/src/config/storage-paths.ts +0 -685
- package/ccw/src/core/auth/csrf-manager.ts +0 -104
- package/ccw/src/core/auth/csrf-middleware.ts +0 -161
- package/ccw/src/core/auth/middleware.ts +0 -94
- package/ccw/src/core/auth/token-manager.ts +0 -219
- package/ccw/src/core/cache-manager.ts +0 -304
- package/ccw/src/core/claude-freshness.ts +0 -339
- package/ccw/src/core/core-memory-store.ts +0 -1529
- package/ccw/src/core/cors.ts +0 -10
- package/ccw/src/core/dashboard-generator-patch.ts +0 -47
- package/ccw/src/core/dashboard-generator.ts +0 -802
- package/ccw/src/core/data-aggregator.ts +0 -690
- package/ccw/src/core/history-importer.ts +0 -625
- package/ccw/src/core/lite-scanner-complete.ts +0 -473
- package/ccw/src/core/lite-scanner.ts +0 -978
- package/ccw/src/core/manifest.ts +0 -271
- package/ccw/src/core/memory-embedder-bridge.ts +0 -258
- package/ccw/src/core/memory-store.ts +0 -978
- package/ccw/src/core/routes/auth-routes.ts +0 -98
- package/ccw/src/core/routes/ccw-routes.ts +0 -86
- package/ccw/src/core/routes/claude-routes.ts +0 -1512
- package/ccw/src/core/routes/cli-routes.ts +0 -1002
- package/ccw/src/core/routes/cli-settings-routes.ts +0 -279
- package/ccw/src/core/routes/codexlens/README.md +0 -37
- package/ccw/src/core/routes/codexlens/config-handlers.ts +0 -1273
- package/ccw/src/core/routes/codexlens/index-handlers.ts +0 -354
- package/ccw/src/core/routes/codexlens/semantic-handlers.ts +0 -932
- package/ccw/src/core/routes/codexlens/utils.ts +0 -96
- package/ccw/src/core/routes/codexlens/watcher-handlers.ts +0 -265
- package/ccw/src/core/routes/codexlens-routes.ts +0 -23
- package/ccw/src/core/routes/commands-routes.ts +0 -620
- package/ccw/src/core/routes/core-memory-routes.ts +0 -607
- package/ccw/src/core/routes/discovery-routes.ts +0 -664
- package/ccw/src/core/routes/files-routes.ts +0 -502
- package/ccw/src/core/routes/graph-routes.md +0 -164
- package/ccw/src/core/routes/graph-routes.ts +0 -635
- package/ccw/src/core/routes/help-routes.ts +0 -508
- package/ccw/src/core/routes/hooks-routes.ts +0 -473
- package/ccw/src/core/routes/issue-routes.ts +0 -1547
- package/ccw/src/core/routes/litellm-api-routes.ts +0 -1482
- package/ccw/src/core/routes/litellm-routes.ts +0 -115
- package/ccw/src/core/routes/loop-routes.ts +0 -386
- package/ccw/src/core/routes/loop-v2-routes.ts +0 -1470
- package/ccw/src/core/routes/mcp-routes.ts +0 -1372
- package/ccw/src/core/routes/mcp-templates-db.ts +0 -267
- package/ccw/src/core/routes/memory-routes.ts +0 -1345
- package/ccw/src/core/routes/nav-status-routes.ts +0 -325
- package/ccw/src/core/routes/provider-routes.ts +0 -78
- package/ccw/src/core/routes/rules-routes.ts +0 -1064
- package/ccw/src/core/routes/session-routes.ts +0 -649
- package/ccw/src/core/routes/skills-routes.ts +0 -1278
- package/ccw/src/core/routes/status-routes.ts +0 -132
- package/ccw/src/core/routes/system-routes.ts +0 -575
- package/ccw/src/core/routes/task-routes.ts +0 -361
- package/ccw/src/core/routes/test-loop-routes.ts +0 -312
- package/ccw/src/core/routes/types.ts +0 -25
- package/ccw/src/core/server.ts +0 -776
- package/ccw/src/core/services/api-key-tester.ts +0 -166
- package/ccw/src/core/services/health-check-service.ts +0 -366
- package/ccw/src/core/session-clustering-service.ts +0 -1258
- package/ccw/src/core/session-scanner.ts +0 -283
- package/ccw/src/core/websocket.ts +0 -302
- package/ccw/src/index.ts +0 -10
- package/ccw/src/mcp-server/index.ts +0 -191
- package/ccw/src/templates/assets/css/github-dark.min.css +0 -10
- package/ccw/src/templates/assets/css/github.min.css +0 -10
- package/ccw/src/templates/assets/js/cytoscape.min.js +0 -32
- package/ccw/src/templates/assets/js/d3.min.js +0 -2
- package/ccw/src/templates/assets/js/highlight.min.js +0 -1244
- package/ccw/src/templates/assets/js/lucide.min.js +0 -12
- package/ccw/src/templates/assets/js/marked.min.js +0 -69
- package/ccw/src/templates/assets/js/tailwind.js +0 -83
- package/ccw/src/templates/dashboard-css/01-base.css +0 -419
- package/ccw/src/templates/dashboard-css/02-session.css +0 -831
- package/ccw/src/templates/dashboard-css/03-tasks.css +0 -517
- package/ccw/src/templates/dashboard-css/04-lite-tasks.css +0 -4354
- package/ccw/src/templates/dashboard-css/05-context.css +0 -2206
- package/ccw/src/templates/dashboard-css/06-cards.css +0 -1576
- package/ccw/src/templates/dashboard-css/07-managers.css +0 -2107
- package/ccw/src/templates/dashboard-css/08-review.css +0 -1266
- package/ccw/src/templates/dashboard-css/09-explorer.css +0 -1408
- package/ccw/src/templates/dashboard-css/10-cli-status.css +0 -539
- package/ccw/src/templates/dashboard-css/11-cli-history.css +0 -271
- package/ccw/src/templates/dashboard-css/12-cli-legacy.css +0 -896
- package/ccw/src/templates/dashboard-css/13-cli-ccw.css +0 -199
- package/ccw/src/templates/dashboard-css/14-cli-modals.css +0 -258
- package/ccw/src/templates/dashboard-css/15-cli-endpoints.css +0 -305
- package/ccw/src/templates/dashboard-css/16-cli-session.css +0 -241
- package/ccw/src/templates/dashboard-css/17-cli-conversation.css +0 -283
- package/ccw/src/templates/dashboard-css/18-cli-settings.css +0 -229
- package/ccw/src/templates/dashboard-css/19-cli-native-session.css +0 -496
- package/ccw/src/templates/dashboard-css/20-cli-taskqueue.css +0 -188
- package/ccw/src/templates/dashboard-css/21-cli-toolmgmt.css +0 -820
- package/ccw/src/templates/dashboard-css/22-cli-semantic.css +0 -240
- package/ccw/src/templates/dashboard-css/23-memory.css +0 -2390
- package/ccw/src/templates/dashboard-css/24-prompt-history.css +0 -1089
- package/ccw/src/templates/dashboard-css/25-skills-rules.css +0 -326
- package/ccw/src/templates/dashboard-css/26-claude-manager.css +0 -1087
- package/ccw/src/templates/dashboard-css/27-graph-explorer.css +0 -1678
- package/ccw/src/templates/dashboard-css/28-mcp-manager.css +0 -748
- package/ccw/src/templates/dashboard-css/29-help.css +0 -264
- package/ccw/src/templates/dashboard-css/30-core-memory.css +0 -1720
- package/ccw/src/templates/dashboard-css/31-api-settings.css +0 -3002
- package/ccw/src/templates/dashboard-css/32-issue-manager.css +0 -3619
- package/ccw/src/templates/dashboard-css/33-cli-stream-viewer.css +0 -860
- package/ccw/src/templates/dashboard-css/34-discovery.css +0 -783
- package/ccw/src/templates/dashboard-css/36-loop-monitor.css +0 -1896
- package/ccw/src/templates/dashboard-css/36-loop-monitor.css.backup +0 -1877
- package/ccw/src/templates/dashboard-css/37-commands.css +0 -193
- package/ccw/src/templates/dashboard-js/api.js +0 -225
- package/ccw/src/templates/dashboard-js/components/_conflict_tab.js +0 -112
- package/ccw/src/templates/dashboard-js/components/_exp_helpers.js +0 -54
- package/ccw/src/templates/dashboard-js/components/_review_tab.js +0 -640
- package/ccw/src/templates/dashboard-js/components/carousel.js +0 -398
- package/ccw/src/templates/dashboard-js/components/cli-history.js +0 -913
- package/ccw/src/templates/dashboard-js/components/cli-status.js +0 -1617
- package/ccw/src/templates/dashboard-js/components/cli-stream-viewer.js +0 -985
- package/ccw/src/templates/dashboard-js/components/flowchart.js +0 -493
- package/ccw/src/templates/dashboard-js/components/global-notifications.js +0 -508
- package/ccw/src/templates/dashboard-js/components/hook-manager.js +0 -1493
- package/ccw/src/templates/dashboard-js/components/index-manager.js +0 -302
- package/ccw/src/templates/dashboard-js/components/mcp-manager.js +0 -1760
- package/ccw/src/templates/dashboard-js/components/modals.js +0 -326
- package/ccw/src/templates/dashboard-js/components/navigation.js +0 -430
- package/ccw/src/templates/dashboard-js/components/notifications.js +0 -934
- package/ccw/src/templates/dashboard-js/components/sidebar.js +0 -31
- package/ccw/src/templates/dashboard-js/components/storage-manager.js +0 -478
- package/ccw/src/templates/dashboard-js/components/tabs-context.js +0 -1093
- package/ccw/src/templates/dashboard-js/components/tabs-other.js +0 -424
- package/ccw/src/templates/dashboard-js/components/task-drawer-core.js +0 -477
- package/ccw/src/templates/dashboard-js/components/task-drawer-renderers.js +0 -447
- package/ccw/src/templates/dashboard-js/components/task-queue-sidebar.js +0 -716
- package/ccw/src/templates/dashboard-js/components/theme.js +0 -49
- package/ccw/src/templates/dashboard-js/components/version-check.js +0 -339
- package/ccw/src/templates/dashboard-js/help-i18n.js +0 -272
- package/ccw/src/templates/dashboard-js/i18n.js +0 -5558
- package/ccw/src/templates/dashboard-js/main.js +0 -158
- package/ccw/src/templates/dashboard-js/services.js +0 -289
- package/ccw/src/templates/dashboard-js/state.js +0 -245
- package/ccw/src/templates/dashboard-js/utils.js +0 -199
- package/ccw/src/templates/dashboard-js/views/api-settings.js +0 -5646
- package/ccw/src/templates/dashboard-js/views/claude-manager.js +0 -1129
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +0 -3615
- package/ccw/src/templates/dashboard-js/views/codexlens-manager.js +0 -7123
- package/ccw/src/templates/dashboard-js/views/commands-manager.js +0 -503
- package/ccw/src/templates/dashboard-js/views/core-memory-clusters.js +0 -503
- package/ccw/src/templates/dashboard-js/views/core-memory.js +0 -891
- package/ccw/src/templates/dashboard-js/views/explorer.js +0 -888
- package/ccw/src/templates/dashboard-js/views/fix-session.js +0 -180
- package/ccw/src/templates/dashboard-js/views/graph-explorer.js +0 -1157
- package/ccw/src/templates/dashboard-js/views/help.js +0 -1278
- package/ccw/src/templates/dashboard-js/views/history.js +0 -390
- package/ccw/src/templates/dashboard-js/views/home.js +0 -244
- package/ccw/src/templates/dashboard-js/views/hook-manager.js +0 -696
- package/ccw/src/templates/dashboard-js/views/issue-discovery.js +0 -730
- package/ccw/src/templates/dashboard-js/views/issue-manager.js +0 -3248
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +0 -3546
- package/ccw/src/templates/dashboard-js/views/loop-monitor.js +0 -3345
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js +0 -2261
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js.backup +0 -1729
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js.new +0 -928
- package/ccw/src/templates/dashboard-js/views/memory.js +0 -1221
- package/ccw/src/templates/dashboard-js/views/project-overview.js +0 -548
- package/ccw/src/templates/dashboard-js/views/prompt-history.js +0 -713
- package/ccw/src/templates/dashboard-js/views/review-session.js +0 -1030
- package/ccw/src/templates/dashboard-js/views/rules-manager.js +0 -880
- package/ccw/src/templates/dashboard-js/views/session-detail.js +0 -781
- package/ccw/src/templates/dashboard-js/views/skills-manager.js +0 -1282
- package/ccw/src/templates/dashboard.html +0 -1104
- package/ccw/src/templates/hooks-config-example.json +0 -60
- package/ccw/src/templates/review-cycle-dashboard.html +0 -1930
- package/ccw/src/templates/workflow-dashboard.html +0 -401
- package/ccw/src/tools/README.md +0 -29
- package/ccw/src/tools/classify-folders.ts +0 -245
- package/ccw/src/tools/claude-cli-tools.ts +0 -1271
- package/ccw/src/tools/cli-config-manager.ts +0 -169
- package/ccw/src/tools/cli-executor-core.ts +0 -1665
- package/ccw/src/tools/cli-executor-state.ts +0 -562
- package/ccw/src/tools/cli-executor-utils.ts +0 -394
- package/ccw/src/tools/cli-executor.ts +0 -7
- package/ccw/src/tools/cli-history-store.ts +0 -1498
- package/ccw/src/tools/cli-output-converter.ts +0 -1301
- package/ccw/src/tools/cli-prompt-builder.ts +0 -487
- package/ccw/src/tools/codex-lens-lsp.ts +0 -402
- package/ccw/src/tools/codex-lens.ts +0 -1863
- package/ccw/src/tools/command-registry.test.ts +0 -669
- package/ccw/src/tools/command-registry.ts +0 -323
- package/ccw/src/tools/context-cache-store.ts +0 -368
- package/ccw/src/tools/context-cache.ts +0 -393
- package/ccw/src/tools/convert-tokens-to-css.ts +0 -300
- package/ccw/src/tools/core-memory.ts +0 -458
- package/ccw/src/tools/detect-changed-modules.ts +0 -343
- package/ccw/src/tools/discover-design-files.ts +0 -184
- package/ccw/src/tools/edit-file.ts +0 -568
- package/ccw/src/tools/generate-module-docs.ts +0 -442
- package/ccw/src/tools/get-modules-by-depth.ts +0 -349
- package/ccw/src/tools/index.ts +0 -384
- package/ccw/src/tools/litellm-client.ts +0 -288
- package/ccw/src/tools/litellm-executor.ts +0 -360
- package/ccw/src/tools/loop-manager.ts +0 -519
- package/ccw/src/tools/loop-state-manager.ts +0 -173
- package/ccw/src/tools/loop-task-manager.ts +0 -391
- package/ccw/src/tools/memory-update-queue.js +0 -493
- package/ccw/src/tools/native-session-discovery.ts +0 -1034
- package/ccw/src/tools/notifier.ts +0 -129
- package/ccw/src/tools/pattern-parser.ts +0 -329
- package/ccw/src/tools/read-file.ts +0 -410
- package/ccw/src/tools/resume-strategy.ts +0 -345
- package/ccw/src/tools/session-content-parser.ts +0 -619
- package/ccw/src/tools/session-manager.ts +0 -1114
- package/ccw/src/tools/skill-context-loader.ts +0 -213
- package/ccw/src/tools/smart-context.ts +0 -228
- package/ccw/src/tools/smart-search.ts +0 -2658
- package/ccw/src/tools/smart-search.ts.backup +0 -1233
- package/ccw/src/tools/storage-manager.ts +0 -455
- package/ccw/src/tools/template-discovery.ts +0 -303
- package/ccw/src/tools/ui-generate-preview.js +0 -350
- package/ccw/src/tools/ui-instantiate-prototypes.js +0 -301
- package/ccw/src/tools/update-module-claude.js +0 -380
- package/ccw/src/tools/vscode-lsp.ts +0 -317
- package/ccw/src/tools/write-file.ts +0 -222
- package/ccw/src/types/cli-settings.ts +0 -137
- package/ccw/src/types/config.ts +0 -11
- package/ccw/src/types/index.ts +0 -4
- package/ccw/src/types/litellm-api-config.ts +0 -456
- package/ccw/src/types/loop.ts +0 -316
- package/ccw/src/types/session.ts +0 -25
- package/ccw/src/types/skill-types.ts +0 -99
- package/ccw/src/types/tool.ts +0 -41
- package/ccw/src/utils/browser-launcher.ts +0 -62
- package/ccw/src/utils/codexlens-path.ts +0 -60
- package/ccw/src/utils/exec-constants.ts +0 -24
- package/ccw/src/utils/file-utils.ts +0 -48
- package/ccw/src/utils/path-resolver.ts +0 -392
- package/ccw/src/utils/path-validator.ts +0 -187
- package/ccw/src/utils/project-root.ts +0 -73
- package/ccw/src/utils/python-utils.ts +0 -140
- package/ccw/src/utils/shell-escape.ts +0 -117
- package/ccw/src/utils/ui.ts +0 -155
- package/ccw/src/utils/update-checker.ts +0 -178
- package/ccw/src/utils/uv-manager.ts +0 -797
- package/ccw-litellm/src/ccw_litellm/__pycache__/__init__.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/__pycache__/__init__.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/__pycache__/__init__.cpython-313.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/__pycache__/cli.cpython-313.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/__init__.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/__init__.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/__init__.cpython-313.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/litellm_embedder.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/litellm_embedder.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/litellm_embedder.cpython-313.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/litellm_llm.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/litellm_llm.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/litellm_llm.cpython-313.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/__init__.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/__init__.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/__init__.cpython-313.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/loader.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/loader.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/loader.cpython-313.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/models.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/models.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/models.cpython-313.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/__init__.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/__init__.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/__init__.cpython-313.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/embedder.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/embedder.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/embedder.cpython-313.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/llm.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/llm.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/llm.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/.workflow/.cli-history/history.db +0 -0
- package/codex-lens/src/codexlens/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/__main__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/__main__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/__main__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/config.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/config.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/config.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/entities.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/entities.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/entities.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/env_config.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/env_config.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/env_config.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/errors.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/errors.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/errors.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/definition.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/definition.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/file_context.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/file_context.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/hover.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/hover.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/models.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/models.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/references.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/references.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/semantic.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/semantic.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/symbols.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/symbols.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/utils.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/utils.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/commands.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/commands.cpython-312.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-310.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/embedding_manager.cpython-312.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-310.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/model_manager.cpython-312.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-310.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/output.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/output.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/hybrid_search/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/hybrid_search/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/hybrid_search/__pycache__/data_structures.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/hybrid_search/__pycache__/data_structures.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/hybrid_search/__pycache__/engine.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/indexing/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/indexing/__pycache__/embedding.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/indexing/__pycache__/symbol_extractor.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/handlers.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/lsp_bridge.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/lsp_bridge.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/lsp_graph_builder.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/lsp_graph_builder.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/providers.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/server.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/standalone_manager.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/mcp/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/mcp/__pycache__/hooks.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/mcp/__pycache__/provider.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/mcp/__pycache__/schema.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/__init__.cpython-312.pyc +0 -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-310.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/factory.cpython-312.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-310.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/tokenizer.cpython-312.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-310.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/treesitter_parser.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/treesitter_parser.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/binary_searcher.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/chain_search.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/chain_search.cpython-312.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__/graph_expander.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/hybrid_search.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/hybrid_search.cpython-312.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-310.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/association_tree/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/association_tree/__pycache__/builder.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/association_tree/__pycache__/data_structures.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/association_tree/__pycache__/deduplicator.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/base.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/base.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/dbscan_strategy.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/factory.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/factory.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/frequency_strategy.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/frequency_strategy.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/hdbscan_strategy.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/noop_strategy.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/noop_strategy.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/SPLADE_IMPLEMENTATION.md +0 -225
- package/codex-lens/src/codexlens/semantic/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/ann_index.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/ann_index.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/ann_index.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/base.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/base.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/base.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/chunker.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/chunker.cpython-312.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-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/embedder.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/embedder.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/factory.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/factory.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/factory.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/gpu_support.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/gpu_support.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/gpu_support.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__/litellm_embedder.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/litellm_embedder.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/litellm_embedder.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__/ollama_backend.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/reranker.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/splade_encoder.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/splade_encoder.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/splade_encoder.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/vector_store.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/vector_store.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/vector_store.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/api_reranker.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/api_reranker.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/api_reranker.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/base.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/base.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/base.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/factory.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/factory.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/factory.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/fastembed_reranker.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/fastembed_reranker.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/fastembed_reranker.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/legacy.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/legacy.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/legacy.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/litellm_reranker.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/onnx_reranker.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/onnx_reranker.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/onnx_reranker.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/splade_encoder.py +0 -567
- package/codex-lens/src/codexlens/storage/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/dir_index.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/dir_index.cpython-312.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__/global_index.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/global_index.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/global_index.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/index_tree.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/index_tree.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/index_tree.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/merkle_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-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/path_mapper.cpython-312.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-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/registry.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/registry.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/splade_index.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/splade_index.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/splade_index.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/sqlite_store.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/sqlite_store.cpython-312.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-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/sqlite_utils.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/sqlite_utils.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/vector_meta_store.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/vector_meta_store.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/vector_meta_store.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/__init__.cpython-312.pyc +0 -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/__pycache__/migration_006_enhance_relationships.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_007_add_graph_neighbors.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_007_add_graph_neighbors.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_007_add_graph_neighbors.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_008_add_merkle_hashes.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_009_add_splade.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_010_add_multi_vector_chunks.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/migration_009_add_splade.py +0 -103
- package/codex-lens/src/codexlens/storage/splade_index.py +0 -578
- package/codex-lens/src/codexlens/watcher/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/events.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/events.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/events.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/file_watcher.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/file_watcher.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/file_watcher.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/incremental_indexer.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/incremental_indexer.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/incremental_indexer.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/manager.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/manager.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/manager.cpython-313.pyc +0 -0
|
@@ -1,2658 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Smart Search Tool - Unified intelligent search with CodexLens integration
|
|
3
|
-
*
|
|
4
|
-
* Features:
|
|
5
|
-
* - Fuzzy mode: FTS + ripgrep fusion with RRF ranking (default)
|
|
6
|
-
* - Semantic mode: Dense coarse retrieval + cross-encoder reranking
|
|
7
|
-
* - CodexLens integration (init, dense_rerank, fts)
|
|
8
|
-
* - Ripgrep fallback for exact mode
|
|
9
|
-
* - Index status checking and warnings
|
|
10
|
-
* - Multi-backend search routing with RRF ranking
|
|
11
|
-
*
|
|
12
|
-
* Actions:
|
|
13
|
-
* - init: Initialize CodexLens index
|
|
14
|
-
* - search: Intelligent search with fuzzy (default) or semantic mode
|
|
15
|
-
* - status: Check index status
|
|
16
|
-
* - update: Incremental index update for changed files
|
|
17
|
-
* - watch: Start file watcher for automatic updates
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { z } from 'zod';
|
|
21
|
-
import type { ToolSchema, ToolResult } from '../types/tool.js';
|
|
22
|
-
import { spawn, execSync } from 'child_process';
|
|
23
|
-
import {
|
|
24
|
-
ensureReady as ensureCodexLensReady,
|
|
25
|
-
executeCodexLens,
|
|
26
|
-
} from './codex-lens.js';
|
|
27
|
-
import type { ProgressInfo } from './codex-lens.js';
|
|
28
|
-
import { getProjectRoot } from '../utils/path-validator.js';
|
|
29
|
-
import { EXEC_TIMEOUTS } from '../utils/exec-constants.js';
|
|
30
|
-
|
|
31
|
-
// Timing utilities for performance analysis
|
|
32
|
-
const TIMING_ENABLED = process.env.SMART_SEARCH_TIMING === '1' || process.env.DEBUG?.includes('timing');
|
|
33
|
-
|
|
34
|
-
interface TimingData {
|
|
35
|
-
[key: string]: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function createTimer(): { mark: (name: string) => void; getTimings: () => TimingData; log: () => void } {
|
|
39
|
-
const startTime = performance.now();
|
|
40
|
-
const marks: { name: string; time: number }[] = [];
|
|
41
|
-
let lastMark = startTime;
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
mark(name: string) {
|
|
45
|
-
const now = performance.now();
|
|
46
|
-
marks.push({ name, time: now - lastMark });
|
|
47
|
-
lastMark = now;
|
|
48
|
-
},
|
|
49
|
-
getTimings(): TimingData {
|
|
50
|
-
const timings: TimingData = {};
|
|
51
|
-
marks.forEach(m => { timings[m.name] = Math.round(m.time * 100) / 100; });
|
|
52
|
-
timings['_total'] = Math.round((performance.now() - startTime) * 100) / 100;
|
|
53
|
-
return timings;
|
|
54
|
-
},
|
|
55
|
-
log() {
|
|
56
|
-
if (TIMING_ENABLED) {
|
|
57
|
-
const timings = this.getTimings();
|
|
58
|
-
console.error(`[TIMING] smart-search: ${JSON.stringify(timings)}`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Define Zod schema for validation
|
|
65
|
-
const ParamsSchema = z.object({
|
|
66
|
-
// Action: search (content), find_files (path/name pattern), init, init_force, status, update (incremental), watch
|
|
67
|
-
// Note: search_files is deprecated, use search with output_mode='files_only'
|
|
68
|
-
// init: incremental index (skip existing), init_force: force full rebuild (delete and recreate)
|
|
69
|
-
action: z.enum(['init', 'init_force', 'search', 'search_files', 'find_files', 'status', 'update', 'watch']).default('search'),
|
|
70
|
-
query: z.string().optional().describe('Content search query (for action="search")'),
|
|
71
|
-
pattern: z.string().optional().describe('Glob pattern for path matching (for action="find_files")'),
|
|
72
|
-
mode: z.enum(['fuzzy', 'semantic']).default('fuzzy'),
|
|
73
|
-
output_mode: z.enum(['full', 'files_only', 'count']).default('full'),
|
|
74
|
-
path: z.string().optional(),
|
|
75
|
-
paths: z.array(z.string()).default([]),
|
|
76
|
-
contextLines: z.number().default(0),
|
|
77
|
-
maxResults: z.number().default(5), // Default 5 with full content
|
|
78
|
-
includeHidden: z.boolean().default(false),
|
|
79
|
-
languages: z.array(z.string()).optional(),
|
|
80
|
-
limit: z.number().default(5), // Default 5 with full content
|
|
81
|
-
extraFilesCount: z.number().default(10), // Additional file-only results
|
|
82
|
-
maxContentLength: z.number().default(200), // Max content length for truncation (50-2000)
|
|
83
|
-
offset: z.number().default(0), // NEW: Pagination offset (start_index)
|
|
84
|
-
enrich: z.boolean().default(false),
|
|
85
|
-
// Search modifiers for ripgrep mode
|
|
86
|
-
regex: z.boolean().default(true), // Use regex pattern matching (default: enabled)
|
|
87
|
-
caseSensitive: z.boolean().default(true), // Case sensitivity (default: case-sensitive)
|
|
88
|
-
tokenize: z.boolean().default(true), // Tokenize multi-word queries for OR matching (default: enabled)
|
|
89
|
-
// File type filtering (default: code only)
|
|
90
|
-
excludeExtensions: z.array(z.string()).optional().describe('File extensions to exclude from results (e.g., ["md", "txt"])'),
|
|
91
|
-
codeOnly: z.boolean().default(true).describe('Only return code files (excludes md, txt, json, yaml, xml, etc.). Default: true'),
|
|
92
|
-
withDoc: z.boolean().default(false).describe('Include documentation files (md, txt, rst, etc.). Overrides codeOnly when true'),
|
|
93
|
-
// Watcher options
|
|
94
|
-
debounce: z.number().default(1000).describe('Debounce interval in ms for watch action'),
|
|
95
|
-
// Fuzzy matching is implicit in hybrid mode (RRF fusion)
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
type Params = z.infer<typeof ParamsSchema>;
|
|
99
|
-
|
|
100
|
-
// Search mode constants
|
|
101
|
-
const SEARCH_MODES = ['fuzzy', 'semantic'] as const;
|
|
102
|
-
|
|
103
|
-
// Classification confidence threshold
|
|
104
|
-
const CONFIDENCE_THRESHOLD = 0.7;
|
|
105
|
-
|
|
106
|
-
// File filtering configuration (ported from code-index)
|
|
107
|
-
const FILTER_CONFIG = {
|
|
108
|
-
exclude_directories: new Set([
|
|
109
|
-
'.git', '.svn', '.hg', '.bzr',
|
|
110
|
-
'node_modules', '__pycache__', '.venv', 'venv', 'vendor', 'bower_components',
|
|
111
|
-
'dist', 'build', 'target', 'out', 'bin', 'obj',
|
|
112
|
-
'.idea', '.vscode', '.vs', '.sublime-workspace',
|
|
113
|
-
'.pytest_cache', '.coverage', '.tox', '.nyc_output', 'coverage', 'htmlcov',
|
|
114
|
-
'.next', '.nuxt', '.cache', '.parcel-cache',
|
|
115
|
-
'.DS_Store', 'Thumbs.db',
|
|
116
|
-
]),
|
|
117
|
-
exclude_files: new Set([
|
|
118
|
-
'*.tmp', '*.temp', '*.swp', '*.swo', '*.bak', '*~', '*.orig', '*.log',
|
|
119
|
-
'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'Pipfile.lock',
|
|
120
|
-
]),
|
|
121
|
-
// Windows device files - must use **/ pattern to match in any directory
|
|
122
|
-
// These cause "os error 1" on Windows when accessed
|
|
123
|
-
windows_device_files: new Set([
|
|
124
|
-
'nul', 'con', 'aux', 'prn',
|
|
125
|
-
'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9',
|
|
126
|
-
'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9',
|
|
127
|
-
]),
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
function buildExcludeArgs(): string[] {
|
|
131
|
-
const args: string[] = [];
|
|
132
|
-
for (const dir of FILTER_CONFIG.exclude_directories) {
|
|
133
|
-
args.push('--glob', `!**/${dir}/**`);
|
|
134
|
-
}
|
|
135
|
-
for (const pattern of FILTER_CONFIG.exclude_files) {
|
|
136
|
-
args.push('--glob', `!${pattern}`);
|
|
137
|
-
}
|
|
138
|
-
// Windows device files need case-insensitive matching in any directory
|
|
139
|
-
for (const device of FILTER_CONFIG.windows_device_files) {
|
|
140
|
-
args.push('--glob', `!**/${device}`);
|
|
141
|
-
args.push('--glob', `!**/${device.toUpperCase()}`);
|
|
142
|
-
}
|
|
143
|
-
return args;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Tokenize query for multi-word OR matching
|
|
148
|
-
* Splits on whitespace and common delimiters, filters stop words and short tokens
|
|
149
|
-
* @param query - The search query
|
|
150
|
-
* @returns Array of tokens
|
|
151
|
-
*/
|
|
152
|
-
function tokenizeQuery(query: string): string[] {
|
|
153
|
-
// Stop words for filtering (common English + programming keywords)
|
|
154
|
-
const stopWords = new Set([
|
|
155
|
-
'the', 'a', 'an', 'is', 'are', 'was', 'were', 'be', 'been', 'being',
|
|
156
|
-
'have', 'has', 'had', 'do', 'does', 'did', 'will', 'would', 'could',
|
|
157
|
-
'should', 'may', 'might', 'must', 'can', 'to', 'of', 'in', 'for', 'on',
|
|
158
|
-
'with', 'at', 'by', 'from', 'as', 'into', 'through', 'and', 'but', 'if',
|
|
159
|
-
'or', 'not', 'this', 'that', 'these', 'those', 'it', 'its', 'how', 'what',
|
|
160
|
-
'where', 'when', 'why', 'which', 'who', 'whom',
|
|
161
|
-
]);
|
|
162
|
-
|
|
163
|
-
// Split on whitespace and common delimiters, keep meaningful tokens
|
|
164
|
-
const tokens = query
|
|
165
|
-
.split(/[\s,;:]+/)
|
|
166
|
-
.map(token => token.trim())
|
|
167
|
-
.filter(token => {
|
|
168
|
-
// Keep tokens that are:
|
|
169
|
-
// - At least 2 characters long
|
|
170
|
-
// - Not a stop word (case-insensitive)
|
|
171
|
-
// - Or look like identifiers (contain underscore/camelCase)
|
|
172
|
-
if (token.length < 2) return false;
|
|
173
|
-
if (stopWords.has(token.toLowerCase()) && !token.includes('_') && !/[A-Z]/.test(token)) {
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
return true;
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
return tokens;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Score results based on token match count for ranking
|
|
184
|
-
* @param results - Search results
|
|
185
|
-
* @param tokens - Query tokens
|
|
186
|
-
* @returns Results with match scores
|
|
187
|
-
*/
|
|
188
|
-
function scoreByTokenMatch(results: ExactMatch[], tokens: string[]): ExactMatch[] {
|
|
189
|
-
if (tokens.length <= 1) return results;
|
|
190
|
-
|
|
191
|
-
// Create case-insensitive patterns for each token
|
|
192
|
-
const tokenPatterns = tokens.map(t => {
|
|
193
|
-
const escaped = t.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
194
|
-
return new RegExp(escaped, 'i');
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
return results.map(r => {
|
|
198
|
-
const content = r.content || '';
|
|
199
|
-
const file = r.file || '';
|
|
200
|
-
const searchText = `${file} ${content}`;
|
|
201
|
-
|
|
202
|
-
// Count how many tokens match
|
|
203
|
-
let matchCount = 0;
|
|
204
|
-
for (const pattern of tokenPatterns) {
|
|
205
|
-
if (pattern.test(searchText)) {
|
|
206
|
-
matchCount++;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Calculate match ratio (0 to 1)
|
|
211
|
-
const matchRatio = matchCount / tokens.length;
|
|
212
|
-
|
|
213
|
-
return {
|
|
214
|
-
...r,
|
|
215
|
-
matchScore: matchRatio,
|
|
216
|
-
matchCount,
|
|
217
|
-
};
|
|
218
|
-
}).sort((a, b) => {
|
|
219
|
-
// Sort by match ratio (descending), then by line number
|
|
220
|
-
if (b.matchScore !== a.matchScore) {
|
|
221
|
-
return b.matchScore - a.matchScore;
|
|
222
|
-
}
|
|
223
|
-
return (a.line || 0) - (b.line || 0);
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
interface Classification {
|
|
228
|
-
mode: string;
|
|
229
|
-
confidence: number;
|
|
230
|
-
reasoning: string;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
interface ExactMatch {
|
|
234
|
-
file: string;
|
|
235
|
-
line: number;
|
|
236
|
-
column: number;
|
|
237
|
-
content: string;
|
|
238
|
-
matchScore?: number; // Token match ratio (0-1) for multi-word queries
|
|
239
|
-
matchCount?: number; // Number of tokens matched
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
interface RelationshipInfo {
|
|
243
|
-
type: string; // 'calls', 'imports', 'called_by', 'imported_by'
|
|
244
|
-
direction: 'outgoing' | 'incoming';
|
|
245
|
-
target?: string; // Target symbol name (for outgoing)
|
|
246
|
-
source?: string; // Source symbol name (for incoming)
|
|
247
|
-
file: string; // File path
|
|
248
|
-
line?: number; // Line number
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
interface SemanticMatch {
|
|
252
|
-
file: string;
|
|
253
|
-
score: number;
|
|
254
|
-
content: string;
|
|
255
|
-
symbol: string | null;
|
|
256
|
-
relationships?: RelationshipInfo[];
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
interface GraphMatch {
|
|
260
|
-
file: string;
|
|
261
|
-
symbols: unknown;
|
|
262
|
-
relationships: unknown[];
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// File match for find_files action (path-based search)
|
|
266
|
-
interface FileMatch {
|
|
267
|
-
path: string;
|
|
268
|
-
type: 'file' | 'directory';
|
|
269
|
-
name: string; // Filename only
|
|
270
|
-
extension?: string; // File extension (without dot)
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
interface PaginationInfo {
|
|
274
|
-
offset: number; // Starting index of returned results
|
|
275
|
-
limit: number; // Number of results requested
|
|
276
|
-
total: number; // Total number of results found
|
|
277
|
-
has_more: boolean; // True if more results are available
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
interface SearchMetadata {
|
|
281
|
-
mode?: string;
|
|
282
|
-
backend?: string;
|
|
283
|
-
count?: number;
|
|
284
|
-
query?: string;
|
|
285
|
-
pattern?: string; // For find_files action
|
|
286
|
-
classified_as?: string;
|
|
287
|
-
confidence?: number;
|
|
288
|
-
reasoning?: string;
|
|
289
|
-
embeddings_coverage_percent?: number;
|
|
290
|
-
warning?: string;
|
|
291
|
-
note?: string;
|
|
292
|
-
index_status?: 'indexed' | 'not_indexed' | 'partial';
|
|
293
|
-
fallback?: string; // Fallback mode used (e.g., 'fuzzy')
|
|
294
|
-
fallback_history?: string[];
|
|
295
|
-
suggested_weights?: Record<string, number>;
|
|
296
|
-
// Tokenization metadata (ripgrep mode)
|
|
297
|
-
tokens?: string[]; // Query tokens used for multi-word search
|
|
298
|
-
tokenized?: boolean; // Whether tokenization was applied
|
|
299
|
-
// Pagination metadata
|
|
300
|
-
pagination?: PaginationInfo;
|
|
301
|
-
// Performance timing data (when SMART_SEARCH_TIMING=1 or DEBUG includes 'timing')
|
|
302
|
-
timing?: TimingData;
|
|
303
|
-
// Init action specific
|
|
304
|
-
action?: string;
|
|
305
|
-
path?: string;
|
|
306
|
-
progress?: {
|
|
307
|
-
stage: string;
|
|
308
|
-
message: string;
|
|
309
|
-
percent: number;
|
|
310
|
-
filesProcessed?: number;
|
|
311
|
-
totalFiles?: number;
|
|
312
|
-
};
|
|
313
|
-
progressHistory?: ProgressInfo[];
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
interface SearchResult {
|
|
317
|
-
success: boolean;
|
|
318
|
-
results?: ExactMatch[] | SemanticMatch[] | GraphMatch[] | FileMatch[] | unknown;
|
|
319
|
-
extra_files?: string[]; // Additional file paths without content
|
|
320
|
-
output?: string;
|
|
321
|
-
metadata?: SearchMetadata;
|
|
322
|
-
error?: string;
|
|
323
|
-
status?: unknown;
|
|
324
|
-
message?: string;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
interface ModelInfo {
|
|
328
|
-
model_profile?: string;
|
|
329
|
-
model_name?: string;
|
|
330
|
-
embedding_dim?: number;
|
|
331
|
-
backend?: string;
|
|
332
|
-
created_at?: string;
|
|
333
|
-
updated_at?: string;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
interface CodexLensConfig {
|
|
337
|
-
config_file?: string;
|
|
338
|
-
index_dir?: string;
|
|
339
|
-
embedding_backend?: string; // 'fastembed' (local) or 'litellm' (api)
|
|
340
|
-
embedding_model?: string;
|
|
341
|
-
reranker_enabled?: boolean;
|
|
342
|
-
reranker_backend?: string; // 'onnx' (local) or 'api'
|
|
343
|
-
reranker_model?: string;
|
|
344
|
-
reranker_top_k?: number;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
interface IndexStatus {
|
|
348
|
-
indexed: boolean;
|
|
349
|
-
has_embeddings: boolean;
|
|
350
|
-
file_count?: number;
|
|
351
|
-
embeddings_coverage_percent?: number;
|
|
352
|
-
total_chunks?: number;
|
|
353
|
-
model_info?: ModelInfo | null;
|
|
354
|
-
config?: CodexLensConfig | null;
|
|
355
|
-
warning?: string;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* Strip ANSI color codes from string (for JSON parsing)
|
|
360
|
-
*/
|
|
361
|
-
function stripAnsi(str: string): string {
|
|
362
|
-
return str.replace(/\x1b\[[0-9;]*m/g, '');
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
/** Default maximum content length to return (avoid excessive output) */
|
|
366
|
-
const DEFAULT_MAX_CONTENT_LENGTH = 200;
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* Truncate content to specified length with ellipsis
|
|
370
|
-
* @param content - The content to truncate
|
|
371
|
-
* @param maxLength - Maximum length (default: 200)
|
|
372
|
-
*/
|
|
373
|
-
function truncateContent(content: string | null | undefined, maxLength: number = DEFAULT_MAX_CONTENT_LENGTH): string {
|
|
374
|
-
if (!content) return '';
|
|
375
|
-
if (content.length <= maxLength) return content;
|
|
376
|
-
return content.slice(0, maxLength) + '...';
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* Split results into full content results and extra file-only results
|
|
381
|
-
* Generic function supporting both SemanticMatch and ExactMatch types
|
|
382
|
-
* @param allResults - All search results (must have 'file' property)
|
|
383
|
-
* @param fullContentLimit - Number of results with full content (default: 5)
|
|
384
|
-
* @param extraFilesCount - Number of additional file-only results (default: 10)
|
|
385
|
-
*/
|
|
386
|
-
function splitResultsWithExtraFiles<T extends { file: string }>(
|
|
387
|
-
allResults: T[],
|
|
388
|
-
fullContentLimit: number = 5,
|
|
389
|
-
extraFilesCount: number = 10
|
|
390
|
-
): { results: T[]; extra_files: string[] } {
|
|
391
|
-
// First N results with full content
|
|
392
|
-
const results = allResults.slice(0, fullContentLimit);
|
|
393
|
-
|
|
394
|
-
// Next M results as file paths only (deduplicated)
|
|
395
|
-
const extraResults = allResults.slice(fullContentLimit, fullContentLimit + extraFilesCount);
|
|
396
|
-
const extra_files = [...new Set(extraResults.map(r => r.file))];
|
|
397
|
-
|
|
398
|
-
return { results, extra_files };
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Check if CodexLens index exists for current directory
|
|
403
|
-
* @param path - Directory path to check
|
|
404
|
-
* @returns Index status
|
|
405
|
-
*/
|
|
406
|
-
async function checkIndexStatus(path: string = '.'): Promise<IndexStatus> {
|
|
407
|
-
try {
|
|
408
|
-
// Fetch both status and config in parallel
|
|
409
|
-
const [statusResult, configResult] = await Promise.all([
|
|
410
|
-
executeCodexLens(['status', '--json'], { cwd: path }),
|
|
411
|
-
executeCodexLens(['config', 'show', '--json'], { cwd: path }),
|
|
412
|
-
]);
|
|
413
|
-
|
|
414
|
-
// Parse config
|
|
415
|
-
let config: CodexLensConfig | null = null;
|
|
416
|
-
if (configResult.success && configResult.output) {
|
|
417
|
-
try {
|
|
418
|
-
const cleanConfigOutput = stripAnsi(configResult.output);
|
|
419
|
-
const parsedConfig = JSON.parse(cleanConfigOutput);
|
|
420
|
-
const configData = parsedConfig.result || parsedConfig;
|
|
421
|
-
config = {
|
|
422
|
-
config_file: configData.config_file,
|
|
423
|
-
index_dir: configData.index_dir,
|
|
424
|
-
embedding_backend: configData.embedding_backend,
|
|
425
|
-
embedding_model: configData.embedding_model,
|
|
426
|
-
reranker_enabled: configData.reranker_enabled,
|
|
427
|
-
reranker_backend: configData.reranker_backend,
|
|
428
|
-
reranker_model: configData.reranker_model,
|
|
429
|
-
reranker_top_k: configData.reranker_top_k,
|
|
430
|
-
};
|
|
431
|
-
} catch {
|
|
432
|
-
// Config parse failed, continue without it
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
if (!statusResult.success) {
|
|
437
|
-
return {
|
|
438
|
-
indexed: false,
|
|
439
|
-
has_embeddings: false,
|
|
440
|
-
config,
|
|
441
|
-
warning: 'No CodexLens index found. Run smart_search(action="init") to create index for better search results.',
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
// Parse status output
|
|
446
|
-
try {
|
|
447
|
-
// Strip ANSI color codes from JSON output
|
|
448
|
-
const cleanOutput = stripAnsi(statusResult.output || '{}');
|
|
449
|
-
const parsed = JSON.parse(cleanOutput);
|
|
450
|
-
// Handle both direct and nested response formats (status returns {success, result: {...}})
|
|
451
|
-
const status = parsed.result || parsed;
|
|
452
|
-
const indexed = status.projects_count > 0 || status.total_files > 0;
|
|
453
|
-
|
|
454
|
-
// Get embeddings coverage from comprehensive status
|
|
455
|
-
const embeddingsData = status.embeddings || {};
|
|
456
|
-
const embeddingsCoverage = embeddingsData.coverage_percent || 0;
|
|
457
|
-
const has_embeddings = embeddingsCoverage >= 50; // Threshold: 50%
|
|
458
|
-
const totalChunks = embeddingsData.total_chunks || 0;
|
|
459
|
-
|
|
460
|
-
// Extract model info if available
|
|
461
|
-
const modelInfoData = embeddingsData.model_info;
|
|
462
|
-
const modelInfo: ModelInfo | undefined = modelInfoData ? {
|
|
463
|
-
model_profile: modelInfoData.model_profile,
|
|
464
|
-
model_name: modelInfoData.model_name,
|
|
465
|
-
embedding_dim: modelInfoData.embedding_dim,
|
|
466
|
-
backend: modelInfoData.backend,
|
|
467
|
-
created_at: modelInfoData.created_at,
|
|
468
|
-
updated_at: modelInfoData.updated_at,
|
|
469
|
-
} : undefined;
|
|
470
|
-
|
|
471
|
-
let warning: string | undefined;
|
|
472
|
-
if (!indexed) {
|
|
473
|
-
warning = 'No CodexLens index found. Run smart_search(action="init") to create index for better search results.';
|
|
474
|
-
} else if (embeddingsCoverage === 0) {
|
|
475
|
-
warning = 'Index exists but no embeddings generated. Run: codexlens embeddings-generate --recursive';
|
|
476
|
-
} else if (embeddingsCoverage < 50) {
|
|
477
|
-
warning = `Embeddings coverage is ${embeddingsCoverage.toFixed(1)}% (below 50%). Hybrid search will use exact mode. Run: codexlens embeddings-generate --recursive`;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
return {
|
|
481
|
-
indexed,
|
|
482
|
-
has_embeddings,
|
|
483
|
-
file_count: status.total_files,
|
|
484
|
-
embeddings_coverage_percent: embeddingsCoverage,
|
|
485
|
-
total_chunks: totalChunks,
|
|
486
|
-
// Ensure model_info is null instead of undefined so it's included in JSON
|
|
487
|
-
model_info: modelInfo ?? null,
|
|
488
|
-
config,
|
|
489
|
-
warning,
|
|
490
|
-
};
|
|
491
|
-
} catch {
|
|
492
|
-
return {
|
|
493
|
-
indexed: false,
|
|
494
|
-
has_embeddings: false,
|
|
495
|
-
config,
|
|
496
|
-
warning: 'Failed to parse index status',
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
} catch {
|
|
500
|
-
return {
|
|
501
|
-
indexed: false,
|
|
502
|
-
has_embeddings: false,
|
|
503
|
-
warning: 'CodexLens not available',
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* Detection heuristics for intent classification
|
|
510
|
-
*/
|
|
511
|
-
|
|
512
|
-
/**
|
|
513
|
-
* Detect literal string query (simple alphanumeric or quoted strings)
|
|
514
|
-
*/
|
|
515
|
-
function detectLiteral(query: string): boolean {
|
|
516
|
-
return /^[a-zA-Z0-9_-]+$/.test(query) || /^["'].*["']$/.test(query);
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* Detect regex pattern (contains regex metacharacters)
|
|
521
|
-
*/
|
|
522
|
-
function detectRegex(query: string): boolean {
|
|
523
|
-
return /[.*+?^${}()|[\]\\]/.test(query);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
* Detect natural language query (sentence structure, questions, multi-word phrases)
|
|
528
|
-
*/
|
|
529
|
-
function detectNaturalLanguage(query: string): boolean {
|
|
530
|
-
return query.split(/\s+/).length >= 3 || /\?$/.test(query);
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
/**
|
|
534
|
-
* Detect file path query (path separators, file extensions)
|
|
535
|
-
*/
|
|
536
|
-
function detectFilePath(query: string): boolean {
|
|
537
|
-
return /[/\\]/.test(query) || /\.[a-z]{2,4}$/i.test(query);
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
* Detect relationship query (import, export, dependency keywords)
|
|
542
|
-
*/
|
|
543
|
-
function detectRelationship(query: string): boolean {
|
|
544
|
-
return /(import|export|uses?|depends?|calls?|extends?)\s/i.test(query);
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
function looksLikeCodeQuery(query: string): boolean {
|
|
548
|
-
if (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(query)) return true;
|
|
549
|
-
if (/[:.<>\-=(){}[\]]/.test(query) && query.split(/\s+/).length <= 2) return true;
|
|
550
|
-
if (/\.\*|\\\(|\\\[|\\s/.test(query)) return true;
|
|
551
|
-
if (/^[a-zA-Z_][a-zA-Z0-9_]*\.[a-zA-Z_][a-zA-Z0-9_]*$/.test(query)) return true;
|
|
552
|
-
return false;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* Classify query intent and recommend search mode
|
|
557
|
-
* Simple mapping: hybrid (NL + index + embeddings) | exact (index or insufficient embeddings) | ripgrep (no index)
|
|
558
|
-
* @param query - Search query string
|
|
559
|
-
* @param hasIndex - Whether CodexLens index exists
|
|
560
|
-
* @param hasSufficientEmbeddings - Whether embeddings coverage >= 50%
|
|
561
|
-
* @returns Classification result
|
|
562
|
-
*/
|
|
563
|
-
function classifyIntent(query: string, hasIndex: boolean = false, hasSufficientEmbeddings: boolean = false): Classification {
|
|
564
|
-
const isNaturalLanguage = detectNaturalLanguage(query);
|
|
565
|
-
const isCodeQuery = looksLikeCodeQuery(query);
|
|
566
|
-
const isRegexPattern = detectRegex(query);
|
|
567
|
-
|
|
568
|
-
let mode: string;
|
|
569
|
-
let confidence: number;
|
|
570
|
-
|
|
571
|
-
if (!hasIndex) {
|
|
572
|
-
mode = 'ripgrep';
|
|
573
|
-
confidence = 1.0;
|
|
574
|
-
} else if (isCodeQuery || isRegexPattern) {
|
|
575
|
-
mode = 'exact';
|
|
576
|
-
confidence = 0.95;
|
|
577
|
-
} else if (isNaturalLanguage && hasSufficientEmbeddings) {
|
|
578
|
-
mode = 'hybrid';
|
|
579
|
-
confidence = 0.9;
|
|
580
|
-
} else {
|
|
581
|
-
mode = 'exact';
|
|
582
|
-
confidence = 0.8;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
const detectedPatterns: string[] = [];
|
|
586
|
-
if (detectLiteral(query)) detectedPatterns.push('literal');
|
|
587
|
-
if (detectRegex(query)) detectedPatterns.push('regex');
|
|
588
|
-
if (detectNaturalLanguage(query)) detectedPatterns.push('natural language');
|
|
589
|
-
if (detectFilePath(query)) detectedPatterns.push('file path');
|
|
590
|
-
if (detectRelationship(query)) detectedPatterns.push('relationship');
|
|
591
|
-
if (isCodeQuery) detectedPatterns.push('code identifier');
|
|
592
|
-
|
|
593
|
-
const reasoning = `Query classified as ${mode} (confidence: ${confidence.toFixed(2)}, detected: ${detectedPatterns.join(', ')}, index: ${hasIndex ? 'available' : 'not available'}, embeddings: ${hasSufficientEmbeddings ? 'sufficient' : 'insufficient'})`;
|
|
594
|
-
|
|
595
|
-
return { mode, confidence, reasoning };
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* Check if a tool is available in PATH
|
|
600
|
-
* @param toolName - Tool executable name
|
|
601
|
-
* @returns True if available
|
|
602
|
-
*/
|
|
603
|
-
function checkToolAvailability(toolName: string): boolean {
|
|
604
|
-
try {
|
|
605
|
-
const isWindows = process.platform === 'win32';
|
|
606
|
-
const command = isWindows ? 'where' : 'which';
|
|
607
|
-
execSync(`${command} ${toolName}`, { stdio: 'ignore', timeout: EXEC_TIMEOUTS.SYSTEM_INFO });
|
|
608
|
-
return true;
|
|
609
|
-
} catch {
|
|
610
|
-
return false;
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
/**
|
|
615
|
-
* Build ripgrep command arguments
|
|
616
|
-
* Supports tokenized multi-word queries with OR matching
|
|
617
|
-
* @param params - Search parameters
|
|
618
|
-
* @returns Command, arguments, and tokens used
|
|
619
|
-
*/
|
|
620
|
-
function buildRipgrepCommand(params: {
|
|
621
|
-
query: string;
|
|
622
|
-
paths: string[];
|
|
623
|
-
contextLines: number;
|
|
624
|
-
maxResults: number;
|
|
625
|
-
includeHidden: boolean;
|
|
626
|
-
regex?: boolean;
|
|
627
|
-
caseSensitive?: boolean;
|
|
628
|
-
tokenize?: boolean;
|
|
629
|
-
}): { command: string; args: string[]; tokens: string[] } {
|
|
630
|
-
const { query, paths = ['.'], contextLines = 0, maxResults = 10, includeHidden = false, regex = false, caseSensitive = true, tokenize = true } = params;
|
|
631
|
-
|
|
632
|
-
const args = [
|
|
633
|
-
'-n',
|
|
634
|
-
'--color=never',
|
|
635
|
-
'--json',
|
|
636
|
-
];
|
|
637
|
-
|
|
638
|
-
// Add file filtering (unless includeHidden is true)
|
|
639
|
-
if (!includeHidden) {
|
|
640
|
-
args.push(...buildExcludeArgs());
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
// Case sensitivity
|
|
644
|
-
if (!caseSensitive) {
|
|
645
|
-
args.push('--ignore-case');
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
if (contextLines > 0) {
|
|
649
|
-
args.push('-C', contextLines.toString());
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
if (maxResults > 0) {
|
|
653
|
-
args.push('--max-count', maxResults.toString());
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
if (includeHidden) {
|
|
657
|
-
args.push('--hidden');
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
// Tokenize query for multi-word OR matching
|
|
661
|
-
const tokens = tokenize ? tokenizeQuery(query) : [query];
|
|
662
|
-
|
|
663
|
-
if (tokens.length > 1) {
|
|
664
|
-
// Multi-token: use multiple -e patterns (OR matching)
|
|
665
|
-
// Each token is escaped for regex safety unless regex mode is enabled
|
|
666
|
-
for (const token of tokens) {
|
|
667
|
-
if (regex) {
|
|
668
|
-
args.push('-e', token);
|
|
669
|
-
} else {
|
|
670
|
-
// Escape regex special chars for literal matching
|
|
671
|
-
const escaped = token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
672
|
-
args.push('-e', escaped);
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
} else {
|
|
676
|
-
// Single token or no tokenization: use original behavior
|
|
677
|
-
if (regex) {
|
|
678
|
-
args.push('-e', query);
|
|
679
|
-
} else {
|
|
680
|
-
args.push('-F', query);
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
args.push(...paths);
|
|
685
|
-
|
|
686
|
-
return { command: 'rg', args, tokens };
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* Action: init - Initialize CodexLens index (FTS only, no embeddings)
|
|
691
|
-
* For semantic/vector search, use ccw view dashboard or codexlens CLI directly
|
|
692
|
-
* @param params - Search parameters
|
|
693
|
-
* @param force - If true, force full rebuild (delete existing index first)
|
|
694
|
-
*/
|
|
695
|
-
async function executeInitAction(params: Params, force: boolean = false): Promise<SearchResult> {
|
|
696
|
-
const { path = '.', languages } = params;
|
|
697
|
-
|
|
698
|
-
// Check CodexLens availability
|
|
699
|
-
const readyStatus = await ensureCodexLensReady();
|
|
700
|
-
if (!readyStatus.ready) {
|
|
701
|
-
return {
|
|
702
|
-
success: false,
|
|
703
|
-
error: `CodexLens not available: ${readyStatus.error}. CodexLens will be auto-installed on first use.`,
|
|
704
|
-
};
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
// Build args with --no-embeddings for FTS-only index (faster)
|
|
708
|
-
// Use 'index init' subcommand (new CLI structure)
|
|
709
|
-
const args = ['index', 'init', path, '--no-embeddings'];
|
|
710
|
-
if (force) {
|
|
711
|
-
args.push('--force'); // Force full rebuild
|
|
712
|
-
}
|
|
713
|
-
if (languages && languages.length > 0) {
|
|
714
|
-
args.push('--language', languages.join(','));
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
// Track progress updates
|
|
718
|
-
const progressUpdates: ProgressInfo[] = [];
|
|
719
|
-
let lastProgress: ProgressInfo | null = null;
|
|
720
|
-
|
|
721
|
-
const result = await executeCodexLens(args, {
|
|
722
|
-
cwd: path,
|
|
723
|
-
timeout: 1800000, // 30 minutes for large codebases
|
|
724
|
-
onProgress: (progress: ProgressInfo) => {
|
|
725
|
-
progressUpdates.push(progress);
|
|
726
|
-
lastProgress = progress;
|
|
727
|
-
},
|
|
728
|
-
});
|
|
729
|
-
|
|
730
|
-
// Build metadata with progress info
|
|
731
|
-
const metadata: SearchMetadata = {
|
|
732
|
-
action: force ? 'init_force' : 'init',
|
|
733
|
-
path,
|
|
734
|
-
};
|
|
735
|
-
|
|
736
|
-
if (lastProgress !== null) {
|
|
737
|
-
const p = lastProgress as ProgressInfo;
|
|
738
|
-
metadata.progress = {
|
|
739
|
-
stage: p.stage,
|
|
740
|
-
message: p.message,
|
|
741
|
-
percent: p.percent,
|
|
742
|
-
filesProcessed: p.filesProcessed,
|
|
743
|
-
totalFiles: p.totalFiles,
|
|
744
|
-
};
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
if (progressUpdates.length > 0) {
|
|
748
|
-
metadata.progressHistory = progressUpdates.slice(-5); // Keep last 5 progress updates
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
const actionLabel = force ? 'rebuilt (force)' : 'created';
|
|
752
|
-
const successMessage = result.success
|
|
753
|
-
? `FTS index ${actionLabel} for ${path}. Note: For semantic/vector search, create vector index via "ccw view" dashboard or run "codexlens init ${path}" (without --no-embeddings).`
|
|
754
|
-
: undefined;
|
|
755
|
-
|
|
756
|
-
return {
|
|
757
|
-
success: result.success,
|
|
758
|
-
error: result.error,
|
|
759
|
-
message: successMessage,
|
|
760
|
-
metadata,
|
|
761
|
-
};
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
/**
|
|
765
|
-
* Action: status - Check CodexLens index status
|
|
766
|
-
*/
|
|
767
|
-
async function executeStatusAction(params: Params): Promise<SearchResult> {
|
|
768
|
-
const { path = '.' } = params;
|
|
769
|
-
|
|
770
|
-
const indexStatus = await checkIndexStatus(path);
|
|
771
|
-
|
|
772
|
-
// Build detailed status message
|
|
773
|
-
const statusParts: string[] = [];
|
|
774
|
-
|
|
775
|
-
// Index status
|
|
776
|
-
statusParts.push(`Index: ${indexStatus.indexed ? 'indexed' : 'not indexed'}`);
|
|
777
|
-
if (indexStatus.file_count) {
|
|
778
|
-
statusParts.push(`Files: ${indexStatus.file_count}`);
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
// Embeddings status
|
|
782
|
-
if (indexStatus.embeddings_coverage_percent !== undefined) {
|
|
783
|
-
statusParts.push(`Embeddings: ${indexStatus.embeddings_coverage_percent.toFixed(1)}%`);
|
|
784
|
-
}
|
|
785
|
-
if (indexStatus.total_chunks) {
|
|
786
|
-
statusParts.push(`Chunks: ${indexStatus.total_chunks}`);
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
// Config summary
|
|
790
|
-
if (indexStatus.config) {
|
|
791
|
-
const cfg = indexStatus.config;
|
|
792
|
-
// Embedding backend info
|
|
793
|
-
const embeddingType = cfg.embedding_backend === 'litellm' ? 'API' : 'Local';
|
|
794
|
-
statusParts.push(`Embedding: ${embeddingType} (${cfg.embedding_model || 'default'})`);
|
|
795
|
-
|
|
796
|
-
// Reranker info
|
|
797
|
-
if (cfg.reranker_enabled) {
|
|
798
|
-
const rerankerType = cfg.reranker_backend === 'onnx' ? 'Local' : 'API';
|
|
799
|
-
statusParts.push(`Reranker: ${rerankerType} (${cfg.reranker_model || 'default'})`);
|
|
800
|
-
} else {
|
|
801
|
-
statusParts.push('Reranker: disabled');
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
return {
|
|
806
|
-
success: true,
|
|
807
|
-
status: indexStatus,
|
|
808
|
-
message: indexStatus.warning || statusParts.join(' | '),
|
|
809
|
-
};
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
/**
|
|
813
|
-
* Action: update - Incremental index update
|
|
814
|
-
* Updates index for changed files without full rebuild
|
|
815
|
-
*/
|
|
816
|
-
async function executeUpdateAction(params: Params): Promise<SearchResult> {
|
|
817
|
-
const { path = '.', languages } = params;
|
|
818
|
-
|
|
819
|
-
// Check CodexLens availability
|
|
820
|
-
const readyStatus = await ensureCodexLensReady();
|
|
821
|
-
if (!readyStatus.ready) {
|
|
822
|
-
return {
|
|
823
|
-
success: false,
|
|
824
|
-
error: `CodexLens not available: ${readyStatus.error}`,
|
|
825
|
-
};
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
// Check if index exists first
|
|
829
|
-
const indexStatus = await checkIndexStatus(path);
|
|
830
|
-
if (!indexStatus.indexed) {
|
|
831
|
-
return {
|
|
832
|
-
success: false,
|
|
833
|
-
error: `Directory not indexed. Run smart_search(action="init") first.`,
|
|
834
|
-
};
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
// Build args for incremental init (without --force)
|
|
838
|
-
// Use 'index init' subcommand (new CLI structure)
|
|
839
|
-
const args = ['index', 'init', path];
|
|
840
|
-
if (languages && languages.length > 0) {
|
|
841
|
-
args.push('--language', languages.join(','));
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
// Track progress updates
|
|
845
|
-
const progressUpdates: ProgressInfo[] = [];
|
|
846
|
-
let lastProgress: ProgressInfo | null = null;
|
|
847
|
-
|
|
848
|
-
const result = await executeCodexLens(args, {
|
|
849
|
-
cwd: path,
|
|
850
|
-
timeout: 600000, // 10 minutes for incremental updates
|
|
851
|
-
onProgress: (progress: ProgressInfo) => {
|
|
852
|
-
progressUpdates.push(progress);
|
|
853
|
-
lastProgress = progress;
|
|
854
|
-
},
|
|
855
|
-
});
|
|
856
|
-
|
|
857
|
-
// Build metadata with progress info
|
|
858
|
-
const metadata: SearchMetadata = {
|
|
859
|
-
action: 'update',
|
|
860
|
-
path,
|
|
861
|
-
};
|
|
862
|
-
|
|
863
|
-
if (lastProgress !== null) {
|
|
864
|
-
const p = lastProgress as ProgressInfo;
|
|
865
|
-
metadata.progress = {
|
|
866
|
-
stage: p.stage,
|
|
867
|
-
message: p.message,
|
|
868
|
-
percent: p.percent,
|
|
869
|
-
filesProcessed: p.filesProcessed,
|
|
870
|
-
totalFiles: p.totalFiles,
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
if (progressUpdates.length > 0) {
|
|
875
|
-
metadata.progressHistory = progressUpdates.slice(-5);
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
return {
|
|
879
|
-
success: result.success,
|
|
880
|
-
error: result.error,
|
|
881
|
-
message: result.success
|
|
882
|
-
? `Incremental update completed for ${path}`
|
|
883
|
-
: undefined,
|
|
884
|
-
metadata,
|
|
885
|
-
};
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
/**
|
|
889
|
-
* Action: watch - Start file watcher for automatic incremental updates
|
|
890
|
-
* Note: This starts a background process, returns immediately with status
|
|
891
|
-
*/
|
|
892
|
-
async function executeWatchAction(params: Params): Promise<SearchResult> {
|
|
893
|
-
const { path = '.', languages, debounce = 1000 } = params;
|
|
894
|
-
|
|
895
|
-
// Check CodexLens availability
|
|
896
|
-
const readyStatus = await ensureCodexLensReady();
|
|
897
|
-
if (!readyStatus.ready) {
|
|
898
|
-
return {
|
|
899
|
-
success: false,
|
|
900
|
-
error: `CodexLens not available: ${readyStatus.error}`,
|
|
901
|
-
};
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
// Check if index exists first
|
|
905
|
-
const indexStatus = await checkIndexStatus(path);
|
|
906
|
-
if (!indexStatus.indexed) {
|
|
907
|
-
return {
|
|
908
|
-
success: false,
|
|
909
|
-
error: `Directory not indexed. Run smart_search(action="init") first.`,
|
|
910
|
-
};
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
// Build args for watch command
|
|
914
|
-
const args = ['watch', path, '--debounce', debounce.toString()];
|
|
915
|
-
if (languages && languages.length > 0) {
|
|
916
|
-
args.push('--language', languages.join(','));
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
// Start watcher in background (non-blocking)
|
|
920
|
-
// Note: The watcher runs until manually stopped
|
|
921
|
-
const result = await executeCodexLens(args, {
|
|
922
|
-
cwd: path,
|
|
923
|
-
timeout: 5000, // Short timeout for initial startup check
|
|
924
|
-
});
|
|
925
|
-
|
|
926
|
-
return {
|
|
927
|
-
success: true,
|
|
928
|
-
message: `File watcher started for ${path}. Use Ctrl+C or kill the process to stop.`,
|
|
929
|
-
metadata: {
|
|
930
|
-
action: 'watch',
|
|
931
|
-
path,
|
|
932
|
-
note: 'Watcher runs in background. Changes are indexed automatically with debounce.',
|
|
933
|
-
},
|
|
934
|
-
};
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
/**
|
|
938
|
-
* Mode: fuzzy - FTS + ripgrep fusion with RRF ranking
|
|
939
|
-
* Runs both exact (FTS) and ripgrep searches in parallel, merges and ranks results
|
|
940
|
-
*/
|
|
941
|
-
async function executeFuzzyMode(params: Params): Promise<SearchResult> {
|
|
942
|
-
const { query, path = '.', maxResults = 5, extraFilesCount = 10, codeOnly = true, withDoc = false, excludeExtensions } = params;
|
|
943
|
-
// withDoc overrides codeOnly
|
|
944
|
-
const effectiveCodeOnly = withDoc ? false : codeOnly;
|
|
945
|
-
|
|
946
|
-
if (!query) {
|
|
947
|
-
return {
|
|
948
|
-
success: false,
|
|
949
|
-
error: 'Query is required for search',
|
|
950
|
-
};
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
const timer = createTimer();
|
|
954
|
-
|
|
955
|
-
// Run both searches in parallel
|
|
956
|
-
const [ftsResult, ripgrepResult] = await Promise.allSettled([
|
|
957
|
-
executeCodexLensExactMode(params),
|
|
958
|
-
executeRipgrepMode(params),
|
|
959
|
-
]);
|
|
960
|
-
timer.mark('parallel_search');
|
|
961
|
-
|
|
962
|
-
// Collect results from both sources
|
|
963
|
-
const resultsMap = new Map<string, any[]>();
|
|
964
|
-
|
|
965
|
-
// Add FTS results if successful
|
|
966
|
-
if (ftsResult.status === 'fulfilled' && ftsResult.value.success && ftsResult.value.results) {
|
|
967
|
-
resultsMap.set('exact', ftsResult.value.results as any[]);
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
// Add ripgrep results if successful
|
|
971
|
-
if (ripgrepResult.status === 'fulfilled' && ripgrepResult.value.success && ripgrepResult.value.results) {
|
|
972
|
-
resultsMap.set('ripgrep', ripgrepResult.value.results as any[]);
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
// If both failed, return error
|
|
976
|
-
if (resultsMap.size === 0) {
|
|
977
|
-
const errors: string[] = [];
|
|
978
|
-
if (ftsResult.status === 'rejected') errors.push(`FTS: ${ftsResult.reason}`);
|
|
979
|
-
if (ripgrepResult.status === 'rejected') errors.push(`Ripgrep: ${ripgrepResult.reason}`);
|
|
980
|
-
return {
|
|
981
|
-
success: false,
|
|
982
|
-
error: `Both search backends failed: ${errors.join('; ')}`,
|
|
983
|
-
};
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
// Apply RRF fusion with fuzzy-optimized weights
|
|
987
|
-
// Fuzzy mode: balanced between exact and ripgrep
|
|
988
|
-
const fusionWeights = { exact: 0.5, ripgrep: 0.5 };
|
|
989
|
-
const totalToFetch = maxResults + extraFilesCount;
|
|
990
|
-
const fusedResults = applyRRFFusion(resultsMap, fusionWeights, totalToFetch);
|
|
991
|
-
timer.mark('rrf_fusion');
|
|
992
|
-
|
|
993
|
-
// Apply code-only and extension filtering after fusion
|
|
994
|
-
const filteredFusedResults = filterNoisyFiles(fusedResults as any[], { codeOnly: effectiveCodeOnly, excludeExtensions });
|
|
995
|
-
|
|
996
|
-
// Normalize results format
|
|
997
|
-
const normalizedResults = filteredFusedResults.map((item: any) => ({
|
|
998
|
-
file: item.file || item.path,
|
|
999
|
-
line: item.line || 0,
|
|
1000
|
-
column: item.column || 0,
|
|
1001
|
-
content: item.content || '',
|
|
1002
|
-
score: item.fusion_score || 0,
|
|
1003
|
-
matchCount: item.matchCount,
|
|
1004
|
-
matchScore: item.matchScore,
|
|
1005
|
-
}));
|
|
1006
|
-
|
|
1007
|
-
// Split results: first N with full content, rest as file paths only
|
|
1008
|
-
const { results, extra_files } = splitResultsWithExtraFiles(normalizedResults, maxResults, extraFilesCount);
|
|
1009
|
-
|
|
1010
|
-
// Log timing
|
|
1011
|
-
timer.log();
|
|
1012
|
-
const timings = timer.getTimings();
|
|
1013
|
-
|
|
1014
|
-
return {
|
|
1015
|
-
success: true,
|
|
1016
|
-
results,
|
|
1017
|
-
extra_files: extra_files.length > 0 ? extra_files : undefined,
|
|
1018
|
-
metadata: {
|
|
1019
|
-
mode: 'fuzzy',
|
|
1020
|
-
backend: 'fts+ripgrep',
|
|
1021
|
-
count: results.length,
|
|
1022
|
-
query,
|
|
1023
|
-
note: `Fuzzy search using RRF fusion of FTS and ripgrep (weights: exact=${fusionWeights.exact}, ripgrep=${fusionWeights.ripgrep})`,
|
|
1024
|
-
timing: TIMING_ENABLED ? timings : undefined,
|
|
1025
|
-
},
|
|
1026
|
-
};
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
/**
|
|
1030
|
-
* Mode: auto - Intent classification and mode selection
|
|
1031
|
-
* Routes to: hybrid (NL + index) | exact (index) | ripgrep (no index)
|
|
1032
|
-
*/
|
|
1033
|
-
async function executeAutoMode(params: Params): Promise<SearchResult> {
|
|
1034
|
-
const { query, path = '.' } = params;
|
|
1035
|
-
|
|
1036
|
-
if (!query) {
|
|
1037
|
-
return {
|
|
1038
|
-
success: false,
|
|
1039
|
-
error: 'Query is required for search action',
|
|
1040
|
-
};
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
// Check index status
|
|
1044
|
-
const indexStatus = await checkIndexStatus(path);
|
|
1045
|
-
|
|
1046
|
-
// Classify intent with index and embeddings awareness
|
|
1047
|
-
const classification = classifyIntent(
|
|
1048
|
-
query,
|
|
1049
|
-
indexStatus.indexed,
|
|
1050
|
-
indexStatus.has_embeddings // This now considers 50% threshold
|
|
1051
|
-
);
|
|
1052
|
-
|
|
1053
|
-
// Route to appropriate mode based on classification
|
|
1054
|
-
let result: SearchResult;
|
|
1055
|
-
|
|
1056
|
-
switch (classification.mode) {
|
|
1057
|
-
case 'hybrid':
|
|
1058
|
-
result = await executeHybridMode(params);
|
|
1059
|
-
break;
|
|
1060
|
-
|
|
1061
|
-
case 'exact':
|
|
1062
|
-
result = await executeCodexLensExactMode(params);
|
|
1063
|
-
break;
|
|
1064
|
-
|
|
1065
|
-
case 'ripgrep':
|
|
1066
|
-
result = await executeRipgrepMode(params);
|
|
1067
|
-
break;
|
|
1068
|
-
|
|
1069
|
-
default:
|
|
1070
|
-
// Fallback to ripgrep
|
|
1071
|
-
result = await executeRipgrepMode(params);
|
|
1072
|
-
break;
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
// Add classification metadata
|
|
1076
|
-
if (result.metadata) {
|
|
1077
|
-
result.metadata.classified_as = classification.mode;
|
|
1078
|
-
result.metadata.confidence = classification.confidence;
|
|
1079
|
-
result.metadata.reasoning = classification.reasoning;
|
|
1080
|
-
result.metadata.embeddings_coverage_percent = indexStatus.embeddings_coverage_percent;
|
|
1081
|
-
result.metadata.index_status = indexStatus.indexed
|
|
1082
|
-
? (indexStatus.has_embeddings ? 'indexed' : 'partial')
|
|
1083
|
-
: 'not_indexed';
|
|
1084
|
-
|
|
1085
|
-
// Add warning if needed
|
|
1086
|
-
if (indexStatus.warning) {
|
|
1087
|
-
result.metadata.warning = indexStatus.warning;
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
return result;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
/**
|
|
1095
|
-
* Mode: ripgrep - Fast literal string matching using ripgrep
|
|
1096
|
-
* No index required, fallback to CodexLens if ripgrep unavailable
|
|
1097
|
-
* Supports tokenized multi-word queries with OR matching and result ranking
|
|
1098
|
-
*/
|
|
1099
|
-
async function executeRipgrepMode(params: Params): Promise<SearchResult> {
|
|
1100
|
-
const { query, paths = [], contextLines = 0, maxResults = 5, extraFilesCount = 10, maxContentLength = 200, includeHidden = false, path = '.', regex = true, caseSensitive = true, tokenize = true, codeOnly = true, withDoc = false, excludeExtensions } = params;
|
|
1101
|
-
// withDoc overrides codeOnly
|
|
1102
|
-
const effectiveCodeOnly = withDoc ? false : codeOnly;
|
|
1103
|
-
|
|
1104
|
-
if (!query) {
|
|
1105
|
-
return {
|
|
1106
|
-
success: false,
|
|
1107
|
-
error: 'Query is required for search',
|
|
1108
|
-
};
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
// Check if ripgrep is available
|
|
1112
|
-
const hasRipgrep = checkToolAvailability('rg');
|
|
1113
|
-
|
|
1114
|
-
// Calculate total to fetch for split (full content + extra files)
|
|
1115
|
-
const totalToFetch = maxResults + extraFilesCount;
|
|
1116
|
-
|
|
1117
|
-
// If ripgrep not available, fall back to CodexLens exact mode
|
|
1118
|
-
if (!hasRipgrep) {
|
|
1119
|
-
const readyStatus = await ensureCodexLensReady();
|
|
1120
|
-
if (!readyStatus.ready) {
|
|
1121
|
-
return {
|
|
1122
|
-
success: false,
|
|
1123
|
-
error: 'Neither ripgrep nor CodexLens available. Install ripgrep (rg) or CodexLens for search functionality.',
|
|
1124
|
-
};
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
// Use CodexLens fts mode as fallback
|
|
1128
|
-
const args = ['search', query, '--limit', totalToFetch.toString(), '--method', 'fts', '--json'];
|
|
1129
|
-
const result = await executeCodexLens(args, { cwd: path });
|
|
1130
|
-
|
|
1131
|
-
if (!result.success) {
|
|
1132
|
-
return {
|
|
1133
|
-
success: false,
|
|
1134
|
-
error: result.error,
|
|
1135
|
-
metadata: {
|
|
1136
|
-
mode: 'ripgrep',
|
|
1137
|
-
backend: 'codexlens-fallback',
|
|
1138
|
-
count: 0,
|
|
1139
|
-
query,
|
|
1140
|
-
},
|
|
1141
|
-
};
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
// Parse results
|
|
1145
|
-
let allResults: SemanticMatch[] = [];
|
|
1146
|
-
try {
|
|
1147
|
-
const parsed = JSON.parse(stripAnsi(result.output || '{}'));
|
|
1148
|
-
const data = parsed.result?.results || parsed.results || parsed;
|
|
1149
|
-
allResults = (Array.isArray(data) ? data : []).map((item: any) => ({
|
|
1150
|
-
file: item.path || item.file,
|
|
1151
|
-
score: item.score || 0,
|
|
1152
|
-
content: truncateContent(item.content || item.excerpt, maxContentLength),
|
|
1153
|
-
symbol: item.symbol || null,
|
|
1154
|
-
}));
|
|
1155
|
-
} catch {
|
|
1156
|
-
// Keep empty results
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
// Split results: first N with full content, rest as file paths only
|
|
1160
|
-
const { results, extra_files } = splitResultsWithExtraFiles(allResults, maxResults, extraFilesCount);
|
|
1161
|
-
|
|
1162
|
-
return {
|
|
1163
|
-
success: true,
|
|
1164
|
-
results,
|
|
1165
|
-
extra_files: extra_files.length > 0 ? extra_files : undefined,
|
|
1166
|
-
metadata: {
|
|
1167
|
-
mode: 'ripgrep',
|
|
1168
|
-
backend: 'codexlens-fallback',
|
|
1169
|
-
count: results.length,
|
|
1170
|
-
query,
|
|
1171
|
-
note: 'Using CodexLens exact mode (ripgrep not available)',
|
|
1172
|
-
},
|
|
1173
|
-
};
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
// Use ripgrep - request more results to support split
|
|
1177
|
-
const { command, args, tokens } = buildRipgrepCommand({
|
|
1178
|
-
query,
|
|
1179
|
-
paths: paths.length > 0 ? paths : [path],
|
|
1180
|
-
contextLines,
|
|
1181
|
-
maxResults: totalToFetch, // Fetch more to support split
|
|
1182
|
-
includeHidden,
|
|
1183
|
-
regex,
|
|
1184
|
-
caseSensitive,
|
|
1185
|
-
tokenize,
|
|
1186
|
-
});
|
|
1187
|
-
|
|
1188
|
-
return new Promise((resolve) => {
|
|
1189
|
-
const child = spawn(command, args, {
|
|
1190
|
-
cwd: path || getProjectRoot(),
|
|
1191
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
1192
|
-
});
|
|
1193
|
-
|
|
1194
|
-
let stdout = '';
|
|
1195
|
-
let stderr = '';
|
|
1196
|
-
let resultLimitReached = false;
|
|
1197
|
-
|
|
1198
|
-
child.stdout.on('data', (data) => {
|
|
1199
|
-
stdout += data.toString();
|
|
1200
|
-
});
|
|
1201
|
-
|
|
1202
|
-
child.stderr.on('data', (data) => {
|
|
1203
|
-
stderr += data.toString();
|
|
1204
|
-
});
|
|
1205
|
-
|
|
1206
|
-
child.on('close', (code) => {
|
|
1207
|
-
const allResults: ExactMatch[] = [];
|
|
1208
|
-
const lines = stdout.split('\n').filter((line) => line.trim());
|
|
1209
|
-
// Limit total results to prevent memory overflow (--max-count only limits per-file)
|
|
1210
|
-
const effectiveLimit = totalToFetch > 0 ? totalToFetch : 500;
|
|
1211
|
-
|
|
1212
|
-
for (const line of lines) {
|
|
1213
|
-
// Stop collecting if we've reached the limit
|
|
1214
|
-
if (allResults.length >= effectiveLimit) {
|
|
1215
|
-
resultLimitReached = true;
|
|
1216
|
-
break;
|
|
1217
|
-
}
|
|
1218
|
-
|
|
1219
|
-
try {
|
|
1220
|
-
const item = JSON.parse(line);
|
|
1221
|
-
|
|
1222
|
-
if (item.type === 'match') {
|
|
1223
|
-
const match: ExactMatch = {
|
|
1224
|
-
file: item.data.path.text,
|
|
1225
|
-
line: item.data.line_number,
|
|
1226
|
-
column:
|
|
1227
|
-
item.data.submatches && item.data.submatches[0]
|
|
1228
|
-
? item.data.submatches[0].start + 1
|
|
1229
|
-
: 1,
|
|
1230
|
-
content: item.data.lines.text.trim(),
|
|
1231
|
-
};
|
|
1232
|
-
allResults.push(match);
|
|
1233
|
-
}
|
|
1234
|
-
} catch {
|
|
1235
|
-
continue;
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
// Handle Windows device file errors gracefully (os error 1)
|
|
1240
|
-
// If we have results despite the error, return them as partial success
|
|
1241
|
-
const isWindowsDeviceError = stderr.includes('os error 1') || stderr.includes('函数不正确');
|
|
1242
|
-
|
|
1243
|
-
// Apply token-based scoring and sorting for multi-word queries
|
|
1244
|
-
// Results matching more tokens are ranked higher (exact matches first)
|
|
1245
|
-
const scoredResults = tokens.length > 1 ? scoreByTokenMatch(allResults, tokens) : allResults;
|
|
1246
|
-
|
|
1247
|
-
// Apply code-only and extension filtering
|
|
1248
|
-
const filteredResults = filterNoisyFiles(scoredResults as any[], { codeOnly: effectiveCodeOnly, excludeExtensions });
|
|
1249
|
-
|
|
1250
|
-
if (code === 0 || code === 1 || (isWindowsDeviceError && filteredResults.length > 0)) {
|
|
1251
|
-
// Split results: first N with full content, rest as file paths only
|
|
1252
|
-
const { results, extra_files } = splitResultsWithExtraFiles(filteredResults, maxResults, extraFilesCount);
|
|
1253
|
-
|
|
1254
|
-
// Build warning message for various conditions
|
|
1255
|
-
const warnings: string[] = [];
|
|
1256
|
-
if (resultLimitReached) {
|
|
1257
|
-
warnings.push(`Result limit reached (${effectiveLimit}). Use a more specific query or increase limit.`);
|
|
1258
|
-
}
|
|
1259
|
-
if (isWindowsDeviceError) {
|
|
1260
|
-
warnings.push('Some Windows device files were skipped');
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
resolve({
|
|
1264
|
-
success: true,
|
|
1265
|
-
results,
|
|
1266
|
-
extra_files: extra_files.length > 0 ? extra_files : undefined,
|
|
1267
|
-
metadata: {
|
|
1268
|
-
mode: 'ripgrep',
|
|
1269
|
-
backend: 'ripgrep',
|
|
1270
|
-
count: results.length,
|
|
1271
|
-
query,
|
|
1272
|
-
tokens: tokens.length > 1 ? tokens : undefined, // Include tokens in metadata for debugging
|
|
1273
|
-
tokenized: tokens.length > 1,
|
|
1274
|
-
...(warnings.length > 0 && { warning: warnings.join('; ') }),
|
|
1275
|
-
},
|
|
1276
|
-
});
|
|
1277
|
-
} else if (isWindowsDeviceError && allResults.length === 0) {
|
|
1278
|
-
// Windows device error but no results - might be the only issue
|
|
1279
|
-
resolve({
|
|
1280
|
-
success: true,
|
|
1281
|
-
results: [],
|
|
1282
|
-
metadata: {
|
|
1283
|
-
mode: 'ripgrep',
|
|
1284
|
-
backend: 'ripgrep',
|
|
1285
|
-
count: 0,
|
|
1286
|
-
query,
|
|
1287
|
-
warning: 'No matches found (some Windows device files were skipped)',
|
|
1288
|
-
},
|
|
1289
|
-
});
|
|
1290
|
-
} else {
|
|
1291
|
-
resolve({
|
|
1292
|
-
success: false,
|
|
1293
|
-
error: `ripgrep execution failed with code ${code}: ${stderr}`,
|
|
1294
|
-
results: [],
|
|
1295
|
-
});
|
|
1296
|
-
}
|
|
1297
|
-
});
|
|
1298
|
-
|
|
1299
|
-
child.on('error', (error) => {
|
|
1300
|
-
resolve({
|
|
1301
|
-
success: false,
|
|
1302
|
-
error: `Failed to spawn ripgrep: ${error.message}`,
|
|
1303
|
-
results: [],
|
|
1304
|
-
});
|
|
1305
|
-
});
|
|
1306
|
-
});
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
/**
|
|
1310
|
-
* Mode: exact - CodexLens exact/FTS search
|
|
1311
|
-
* Requires index
|
|
1312
|
-
*/
|
|
1313
|
-
async function executeCodexLensExactMode(params: Params): Promise<SearchResult> {
|
|
1314
|
-
const { query, path = '.', maxResults = 5, extraFilesCount = 10, maxContentLength = 200, enrich = false, excludeExtensions, codeOnly = true, withDoc = false, offset = 0 } = params;
|
|
1315
|
-
// withDoc overrides codeOnly
|
|
1316
|
-
const effectiveCodeOnly = withDoc ? false : codeOnly;
|
|
1317
|
-
|
|
1318
|
-
if (!query) {
|
|
1319
|
-
return {
|
|
1320
|
-
success: false,
|
|
1321
|
-
error: 'Query is required for search',
|
|
1322
|
-
};
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
// Check CodexLens availability
|
|
1326
|
-
const readyStatus = await ensureCodexLensReady();
|
|
1327
|
-
if (!readyStatus.ready) {
|
|
1328
|
-
return {
|
|
1329
|
-
success: false,
|
|
1330
|
-
error: `CodexLens not available: ${readyStatus.error}`,
|
|
1331
|
-
};
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1334
|
-
// Check index status
|
|
1335
|
-
const indexStatus = await checkIndexStatus(path);
|
|
1336
|
-
|
|
1337
|
-
// Request more results to support split (full content + extra files)
|
|
1338
|
-
const totalToFetch = maxResults + extraFilesCount;
|
|
1339
|
-
const args = ['search', query, '--limit', totalToFetch.toString(), '--offset', offset.toString(), '--method', 'fts', '--json'];
|
|
1340
|
-
if (enrich) {
|
|
1341
|
-
args.push('--enrich');
|
|
1342
|
-
}
|
|
1343
|
-
// Add code_only filter if requested (default: true)
|
|
1344
|
-
if (effectiveCodeOnly) {
|
|
1345
|
-
args.push('--code-only');
|
|
1346
|
-
}
|
|
1347
|
-
// Add exclude_extensions filter if provided
|
|
1348
|
-
if (excludeExtensions && excludeExtensions.length > 0) {
|
|
1349
|
-
args.push('--exclude-extensions', excludeExtensions.join(','));
|
|
1350
|
-
}
|
|
1351
|
-
const result = await executeCodexLens(args, { cwd: path });
|
|
1352
|
-
|
|
1353
|
-
if (!result.success) {
|
|
1354
|
-
return {
|
|
1355
|
-
success: false,
|
|
1356
|
-
error: result.error,
|
|
1357
|
-
metadata: {
|
|
1358
|
-
mode: 'exact',
|
|
1359
|
-
backend: 'codexlens',
|
|
1360
|
-
count: 0,
|
|
1361
|
-
query,
|
|
1362
|
-
warning: indexStatus.warning,
|
|
1363
|
-
},
|
|
1364
|
-
};
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
// Parse results
|
|
1368
|
-
let allResults: SemanticMatch[] = [];
|
|
1369
|
-
try {
|
|
1370
|
-
const parsed = JSON.parse(stripAnsi(result.output || '{}'));
|
|
1371
|
-
const data = parsed.result?.results || parsed.results || parsed;
|
|
1372
|
-
allResults = (Array.isArray(data) ? data : []).map((item: any) => ({
|
|
1373
|
-
file: item.path || item.file,
|
|
1374
|
-
score: item.score || 0,
|
|
1375
|
-
content: truncateContent(item.content || item.excerpt, maxContentLength),
|
|
1376
|
-
symbol: item.symbol || null,
|
|
1377
|
-
}));
|
|
1378
|
-
} catch {
|
|
1379
|
-
// Keep empty results
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
// Fallback to fuzzy mode if exact returns no results
|
|
1383
|
-
if (allResults.length === 0) {
|
|
1384
|
-
const fuzzyArgs = ['search', query, '--limit', totalToFetch.toString(), '--offset', offset.toString(), '--method', 'fts', '--use-fuzzy', '--json'];
|
|
1385
|
-
if (enrich) {
|
|
1386
|
-
fuzzyArgs.push('--enrich');
|
|
1387
|
-
}
|
|
1388
|
-
// Add code_only filter if requested (default: true)
|
|
1389
|
-
if (effectiveCodeOnly) {
|
|
1390
|
-
fuzzyArgs.push('--code-only');
|
|
1391
|
-
}
|
|
1392
|
-
// Add exclude_extensions filter if provided
|
|
1393
|
-
if (excludeExtensions && excludeExtensions.length > 0) {
|
|
1394
|
-
fuzzyArgs.push('--exclude-extensions', excludeExtensions.join(','));
|
|
1395
|
-
}
|
|
1396
|
-
const fuzzyResult = await executeCodexLens(fuzzyArgs, { cwd: path });
|
|
1397
|
-
|
|
1398
|
-
if (fuzzyResult.success) {
|
|
1399
|
-
try {
|
|
1400
|
-
const parsed = JSON.parse(stripAnsi(fuzzyResult.output || '{}'));
|
|
1401
|
-
const data = parsed.result?.results || parsed.results || parsed;
|
|
1402
|
-
allResults = (Array.isArray(data) ? data : []).map((item: any) => ({
|
|
1403
|
-
file: item.path || item.file,
|
|
1404
|
-
score: item.score || 0,
|
|
1405
|
-
content: truncateContent(item.content || item.excerpt, maxContentLength),
|
|
1406
|
-
symbol: item.symbol || null,
|
|
1407
|
-
}));
|
|
1408
|
-
} catch {
|
|
1409
|
-
// Keep empty results
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
if (allResults.length > 0) {
|
|
1413
|
-
// Split results: first N with full content, rest as file paths only
|
|
1414
|
-
const { results, extra_files } = splitResultsWithExtraFiles(allResults, maxResults, extraFilesCount);
|
|
1415
|
-
return {
|
|
1416
|
-
success: true,
|
|
1417
|
-
results,
|
|
1418
|
-
extra_files: extra_files.length > 0 ? extra_files : undefined,
|
|
1419
|
-
metadata: {
|
|
1420
|
-
mode: 'exact',
|
|
1421
|
-
backend: 'codexlens',
|
|
1422
|
-
count: results.length,
|
|
1423
|
-
query,
|
|
1424
|
-
warning: indexStatus.warning,
|
|
1425
|
-
note: 'No exact matches found, showing fuzzy results',
|
|
1426
|
-
fallback: 'fuzzy',
|
|
1427
|
-
},
|
|
1428
|
-
};
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
|
|
1433
|
-
// Split results: first N with full content, rest as file paths only
|
|
1434
|
-
const { results, extra_files } = splitResultsWithExtraFiles(allResults, maxResults, extraFilesCount);
|
|
1435
|
-
|
|
1436
|
-
return {
|
|
1437
|
-
success: true,
|
|
1438
|
-
results,
|
|
1439
|
-
extra_files: extra_files.length > 0 ? extra_files : undefined,
|
|
1440
|
-
metadata: {
|
|
1441
|
-
mode: 'exact',
|
|
1442
|
-
backend: 'codexlens',
|
|
1443
|
-
count: results.length,
|
|
1444
|
-
query,
|
|
1445
|
-
warning: indexStatus.warning,
|
|
1446
|
-
},
|
|
1447
|
-
};
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
/**
|
|
1451
|
-
* Mode: hybrid - Best quality semantic search
|
|
1452
|
-
* Uses CodexLens dense_rerank method (dense coarse + cross-encoder rerank)
|
|
1453
|
-
* Requires index with embeddings
|
|
1454
|
-
*/
|
|
1455
|
-
async function executeHybridMode(params: Params): Promise<SearchResult> {
|
|
1456
|
-
const timer = createTimer();
|
|
1457
|
-
const { query, path = '.', maxResults = 5, extraFilesCount = 10, maxContentLength = 200, enrich = false, excludeExtensions, codeOnly = true, withDoc = false, offset = 0 } = params;
|
|
1458
|
-
// withDoc overrides codeOnly
|
|
1459
|
-
const effectiveCodeOnly = withDoc ? false : codeOnly;
|
|
1460
|
-
|
|
1461
|
-
if (!query) {
|
|
1462
|
-
return {
|
|
1463
|
-
success: false,
|
|
1464
|
-
error: 'Query is required for search',
|
|
1465
|
-
};
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
// Check CodexLens availability
|
|
1469
|
-
const readyStatus = await ensureCodexLensReady();
|
|
1470
|
-
timer.mark('codexlens_ready_check');
|
|
1471
|
-
if (!readyStatus.ready) {
|
|
1472
|
-
return {
|
|
1473
|
-
success: false,
|
|
1474
|
-
error: `CodexLens not available: ${readyStatus.error}`,
|
|
1475
|
-
};
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
// Check index status
|
|
1479
|
-
const indexStatus = await checkIndexStatus(path);
|
|
1480
|
-
timer.mark('index_status_check');
|
|
1481
|
-
|
|
1482
|
-
// Request more results to support split (full content + extra files)
|
|
1483
|
-
const totalToFetch = maxResults + extraFilesCount;
|
|
1484
|
-
const args = ['search', query, '--limit', totalToFetch.toString(), '--offset', offset.toString(), '--method', 'dense_rerank', '--json'];
|
|
1485
|
-
if (enrich) {
|
|
1486
|
-
args.push('--enrich');
|
|
1487
|
-
}
|
|
1488
|
-
// Add code_only filter if requested (default: true)
|
|
1489
|
-
if (effectiveCodeOnly) {
|
|
1490
|
-
args.push('--code-only');
|
|
1491
|
-
}
|
|
1492
|
-
// Add exclude_extensions filter if provided
|
|
1493
|
-
if (excludeExtensions && excludeExtensions.length > 0) {
|
|
1494
|
-
args.push('--exclude-extensions', excludeExtensions.join(','));
|
|
1495
|
-
}
|
|
1496
|
-
const result = await executeCodexLens(args, { cwd: path });
|
|
1497
|
-
timer.mark('codexlens_search');
|
|
1498
|
-
|
|
1499
|
-
if (!result.success) {
|
|
1500
|
-
timer.log();
|
|
1501
|
-
return {
|
|
1502
|
-
success: false,
|
|
1503
|
-
error: result.error,
|
|
1504
|
-
metadata: {
|
|
1505
|
-
mode: 'hybrid',
|
|
1506
|
-
backend: 'codexlens',
|
|
1507
|
-
count: 0,
|
|
1508
|
-
query,
|
|
1509
|
-
warning: indexStatus.warning,
|
|
1510
|
-
},
|
|
1511
|
-
};
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1514
|
-
// Parse results
|
|
1515
|
-
let allResults: SemanticMatch[] = [];
|
|
1516
|
-
let baselineInfo: { score: number; count: number } | null = null;
|
|
1517
|
-
let initialCount = 0;
|
|
1518
|
-
|
|
1519
|
-
try {
|
|
1520
|
-
const parsed = JSON.parse(stripAnsi(result.output || '{}'));
|
|
1521
|
-
const data = parsed.result?.results || parsed.results || parsed;
|
|
1522
|
-
allResults = (Array.isArray(data) ? data : []).map((item: any) => {
|
|
1523
|
-
const rawScore = item.score || 0;
|
|
1524
|
-
// Hybrid mode returns distance scores (lower is better).
|
|
1525
|
-
// Convert to similarity scores (higher is better) for consistency.
|
|
1526
|
-
// Formula: similarity = 1 / (1 + distance)
|
|
1527
|
-
const similarityScore = rawScore > 0 ? 1 / (1 + rawScore) : 1;
|
|
1528
|
-
return {
|
|
1529
|
-
file: item.path || item.file,
|
|
1530
|
-
score: similarityScore,
|
|
1531
|
-
content: truncateContent(item.content || item.excerpt, maxContentLength),
|
|
1532
|
-
symbol: item.symbol || null,
|
|
1533
|
-
};
|
|
1534
|
-
});
|
|
1535
|
-
timer.mark('parse_results');
|
|
1536
|
-
|
|
1537
|
-
initialCount = allResults.length;
|
|
1538
|
-
|
|
1539
|
-
// Post-processing pipeline to improve semantic search quality
|
|
1540
|
-
// 0. Filter dominant baseline scores (hot spot detection)
|
|
1541
|
-
const baselineResult = filterDominantBaselineScores(allResults);
|
|
1542
|
-
allResults = baselineResult.filteredResults;
|
|
1543
|
-
baselineInfo = baselineResult.baselineInfo;
|
|
1544
|
-
|
|
1545
|
-
// 1. Filter noisy directories (node_modules, etc.)
|
|
1546
|
-
// NOTE: Extension filtering is now done engine-side via --code-only and --exclude-extensions
|
|
1547
|
-
allResults = filterNoisyFiles(allResults, {});
|
|
1548
|
-
// 2. Boost results containing query keywords
|
|
1549
|
-
allResults = applyKeywordBoosting(allResults, query);
|
|
1550
|
-
// 3. Enforce score diversity (penalize identical scores)
|
|
1551
|
-
allResults = enforceScoreDiversity(allResults);
|
|
1552
|
-
// 4. Re-sort by adjusted scores
|
|
1553
|
-
allResults.sort((a, b) => b.score - a.score);
|
|
1554
|
-
timer.mark('post_processing');
|
|
1555
|
-
} catch {
|
|
1556
|
-
return {
|
|
1557
|
-
success: true,
|
|
1558
|
-
results: [],
|
|
1559
|
-
output: result.output,
|
|
1560
|
-
metadata: {
|
|
1561
|
-
mode: 'hybrid',
|
|
1562
|
-
backend: 'codexlens',
|
|
1563
|
-
count: 0,
|
|
1564
|
-
query,
|
|
1565
|
-
warning: indexStatus.warning || 'Failed to parse JSON output',
|
|
1566
|
-
},
|
|
1567
|
-
};
|
|
1568
|
-
}
|
|
1569
|
-
|
|
1570
|
-
// Split results: first N with full content, rest as file paths only
|
|
1571
|
-
const { results, extra_files } = splitResultsWithExtraFiles(allResults, maxResults, extraFilesCount);
|
|
1572
|
-
timer.mark('split_results');
|
|
1573
|
-
|
|
1574
|
-
// Build metadata with baseline info if detected
|
|
1575
|
-
let note = 'Using dense_rerank (dense coarse + cross-encoder rerank) for semantic search';
|
|
1576
|
-
if (baselineInfo) {
|
|
1577
|
-
note += ` | Filtered ${initialCount - allResults.length} hot-spot results with baseline score ~${baselineInfo.score.toFixed(4)}`;
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
|
-
// Log timing data
|
|
1581
|
-
timer.log();
|
|
1582
|
-
const timings = timer.getTimings();
|
|
1583
|
-
|
|
1584
|
-
return {
|
|
1585
|
-
success: true,
|
|
1586
|
-
results,
|
|
1587
|
-
extra_files: extra_files.length > 0 ? extra_files : undefined,
|
|
1588
|
-
metadata: {
|
|
1589
|
-
mode: 'hybrid',
|
|
1590
|
-
backend: 'codexlens',
|
|
1591
|
-
count: results.length,
|
|
1592
|
-
query,
|
|
1593
|
-
note,
|
|
1594
|
-
warning: indexStatus.warning,
|
|
1595
|
-
suggested_weights: getRRFWeights(query),
|
|
1596
|
-
timing: TIMING_ENABLED ? timings : undefined,
|
|
1597
|
-
},
|
|
1598
|
-
};
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
/**
|
|
1602
|
-
* Query intent used to adapt RRF weights (Python parity).
|
|
1603
|
-
*
|
|
1604
|
-
* Keep this logic aligned with CodexLens Python hybrid search:
|
|
1605
|
-
* `codex-lens/src/codexlens/search/hybrid_search.py`
|
|
1606
|
-
*/
|
|
1607
|
-
export type QueryIntent = 'keyword' | 'semantic' | 'mixed';
|
|
1608
|
-
|
|
1609
|
-
// Python default: vector 60%, exact 30%, fuzzy 10%
|
|
1610
|
-
const DEFAULT_RRF_WEIGHTS = {
|
|
1611
|
-
exact: 0.3,
|
|
1612
|
-
fuzzy: 0.1,
|
|
1613
|
-
vector: 0.6,
|
|
1614
|
-
} as const;
|
|
1615
|
-
|
|
1616
|
-
function normalizeWeights(weights: Record<string, number>): Record<string, number> {
|
|
1617
|
-
const sum = Object.values(weights).reduce((acc, v) => acc + v, 0);
|
|
1618
|
-
if (!Number.isFinite(sum) || sum <= 0) return { ...weights };
|
|
1619
|
-
return Object.fromEntries(Object.entries(weights).map(([k, v]) => [k, v / sum]));
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
/**
|
|
1623
|
-
* Detect query intent using the same heuristic signals as Python:
|
|
1624
|
-
* - Code patterns: `.`, `::`, `->`, CamelCase, snake_case, common code keywords
|
|
1625
|
-
* - Natural language patterns: >5 words, question marks, interrogatives, common verbs
|
|
1626
|
-
*/
|
|
1627
|
-
export function detectQueryIntent(query: string): QueryIntent {
|
|
1628
|
-
const trimmed = query.trim();
|
|
1629
|
-
if (!trimmed) return 'mixed';
|
|
1630
|
-
|
|
1631
|
-
const lower = trimmed.toLowerCase();
|
|
1632
|
-
const wordCount = trimmed.split(/\s+/).filter(Boolean).length;
|
|
1633
|
-
|
|
1634
|
-
const hasCodeSignals =
|
|
1635
|
-
/(::|->|\.)/.test(trimmed) ||
|
|
1636
|
-
/[A-Z][a-z]+[A-Z]/.test(trimmed) ||
|
|
1637
|
-
/\b\w+_\w+\b/.test(trimmed) ||
|
|
1638
|
-
/\b(def|class|function|const|let|var|import|from|return|async|await|interface|type)\b/i.test(lower);
|
|
1639
|
-
|
|
1640
|
-
const hasNaturalSignals =
|
|
1641
|
-
wordCount > 5 ||
|
|
1642
|
-
/\?/.test(trimmed) ||
|
|
1643
|
-
/\b(how|what|why|when|where)\b/i.test(trimmed) ||
|
|
1644
|
-
/\b(handle|explain|fix|implement|create|build|use|find|search|convert|parse|generate|support)\b/i.test(trimmed);
|
|
1645
|
-
|
|
1646
|
-
if (hasCodeSignals && hasNaturalSignals) return 'mixed';
|
|
1647
|
-
if (hasCodeSignals) return 'keyword';
|
|
1648
|
-
if (hasNaturalSignals) return 'semantic';
|
|
1649
|
-
return 'mixed';
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
|
-
/**
|
|
1653
|
-
* Intent → weights mapping (Python parity).
|
|
1654
|
-
* - keyword: exact-heavy
|
|
1655
|
-
* - semantic: vector-heavy
|
|
1656
|
-
* - mixed: keep defaults
|
|
1657
|
-
*/
|
|
1658
|
-
export function adjustWeightsByIntent(
|
|
1659
|
-
intent: QueryIntent,
|
|
1660
|
-
baseWeights: Record<string, number>,
|
|
1661
|
-
): Record<string, number> {
|
|
1662
|
-
if (intent === 'keyword') return normalizeWeights({ exact: 0.5, fuzzy: 0.1, vector: 0.4 });
|
|
1663
|
-
if (intent === 'semantic') return normalizeWeights({ exact: 0.2, fuzzy: 0.1, vector: 0.7 });
|
|
1664
|
-
return normalizeWeights({ ...baseWeights });
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
export function getRRFWeights(
|
|
1668
|
-
query: string,
|
|
1669
|
-
baseWeights: Record<string, number> = DEFAULT_RRF_WEIGHTS,
|
|
1670
|
-
): Record<string, number> {
|
|
1671
|
-
return adjustWeightsByIntent(detectQueryIntent(query), baseWeights);
|
|
1672
|
-
}
|
|
1673
|
-
|
|
1674
|
-
/**
|
|
1675
|
-
* Post-processing: Filter noisy files from semantic search results
|
|
1676
|
-
* Uses FILTER_CONFIG patterns to remove irrelevant files.
|
|
1677
|
-
* Optimized: pre-compiled regexes, accurate path segment matching.
|
|
1678
|
-
*/
|
|
1679
|
-
// Pre-compile file exclusion regexes once (avoid recompilation in loop)
|
|
1680
|
-
const FILE_EXCLUDE_REGEXES = [...FILTER_CONFIG.exclude_files].map(pattern =>
|
|
1681
|
-
new RegExp('^' + pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/\\\*/g, '.*') + '$')
|
|
1682
|
-
);
|
|
1683
|
-
|
|
1684
|
-
// Non-code file extensions (for codeOnly filter)
|
|
1685
|
-
const NON_CODE_EXTENSIONS = new Set([
|
|
1686
|
-
'md', 'txt', 'json', 'yaml', 'yml', 'xml', 'csv', 'log',
|
|
1687
|
-
'ini', 'cfg', 'conf', 'toml', 'env', 'properties',
|
|
1688
|
-
'html', 'htm', 'svg', 'png', 'jpg', 'jpeg', 'gif', 'ico', 'webp',
|
|
1689
|
-
'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx',
|
|
1690
|
-
'lock', 'sum', 'mod',
|
|
1691
|
-
]);
|
|
1692
|
-
|
|
1693
|
-
interface FilterOptions {
|
|
1694
|
-
excludeExtensions?: string[];
|
|
1695
|
-
codeOnly?: boolean;
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
function filterNoisyFiles(results: SemanticMatch[], options: FilterOptions = {}): SemanticMatch[] {
|
|
1699
|
-
const { excludeExtensions = [], codeOnly = false } = options;
|
|
1700
|
-
|
|
1701
|
-
// Build extension filter set
|
|
1702
|
-
const excludedExtSet = new Set(excludeExtensions.map(ext => ext.toLowerCase().replace(/^\./, '')));
|
|
1703
|
-
if (codeOnly) {
|
|
1704
|
-
NON_CODE_EXTENSIONS.forEach(ext => excludedExtSet.add(ext));
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
return results.filter(r => {
|
|
1708
|
-
// Support both 'file' and 'path' field names (different backends use different names)
|
|
1709
|
-
const filePath = r.file || (r as any).path || '';
|
|
1710
|
-
if (!filePath) return true;
|
|
1711
|
-
|
|
1712
|
-
const segments: string[] = filePath.split(/[/\\]/);
|
|
1713
|
-
|
|
1714
|
-
// Accurate directory check: segment must exactly match excluded directory
|
|
1715
|
-
if (segments.some((segment: string) => FILTER_CONFIG.exclude_directories.has(segment))) {
|
|
1716
|
-
return false;
|
|
1717
|
-
}
|
|
1718
|
-
|
|
1719
|
-
// Accurate file check: pattern matches filename only (not full path)
|
|
1720
|
-
const filename = segments.pop() || '';
|
|
1721
|
-
if (FILE_EXCLUDE_REGEXES.some(regex => regex.test(filename))) {
|
|
1722
|
-
return false;
|
|
1723
|
-
}
|
|
1724
|
-
|
|
1725
|
-
// Extension filter check
|
|
1726
|
-
if (excludedExtSet.size > 0) {
|
|
1727
|
-
const ext = filename.split('.').pop()?.toLowerCase() || '';
|
|
1728
|
-
if (excludedExtSet.has(ext)) {
|
|
1729
|
-
return false;
|
|
1730
|
-
}
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1733
|
-
return true;
|
|
1734
|
-
});
|
|
1735
|
-
}
|
|
1736
|
-
|
|
1737
|
-
/**
|
|
1738
|
-
* Post-processing: Boost results containing query keywords
|
|
1739
|
-
* Extracts keywords from query and boosts matching results.
|
|
1740
|
-
* Optimized: uses whole-word matching with regex for accuracy.
|
|
1741
|
-
*/
|
|
1742
|
-
// Helper to escape regex special characters
|
|
1743
|
-
function escapeRegExp(str: string): string {
|
|
1744
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
function applyKeywordBoosting(results: SemanticMatch[], query: string): SemanticMatch[] {
|
|
1748
|
-
// Extract meaningful keywords (ignore common words)
|
|
1749
|
-
const stopWords = new Set(['the', 'a', 'an', 'is', 'are', 'was', 'were', 'be', 'been', 'being', 'have', 'has', 'had', 'do', 'does', 'did', 'will', 'would', 'could', 'should', 'may', 'might', 'must', 'shall', 'can', 'need', 'dare', 'ought', 'used', 'to', 'of', 'in', 'for', 'on', 'with', 'at', 'by', 'from', 'as', 'into', 'through', 'during', 'before', 'after', 'above', 'below', 'between', 'under', 'again', 'further', 'then', 'once', 'here', 'there', 'when', 'where', 'why', 'how', 'all', 'each', 'few', 'more', 'most', 'other', 'some', 'such', 'no', 'nor', 'not', 'only', 'own', 'same', 'so', 'than', 'too', 'very', 'just', 'and', 'but', 'if', 'or', 'because', 'until', 'while', 'although', 'though', 'after', 'before', 'when', 'whenever', 'where', 'wherever', 'whether', 'which', 'who', 'whom', 'whose', 'what', 'whatever', 'whichever', 'whoever', 'whomever', 'this', 'that', 'these', 'those', 'it', 'its']);
|
|
1750
|
-
|
|
1751
|
-
const keywords = query
|
|
1752
|
-
.toLowerCase()
|
|
1753
|
-
.split(/[\s,.;:()"{}[\]-]+/) // More robust splitting on punctuation
|
|
1754
|
-
.filter(word => word.length > 2 && !stopWords.has(word));
|
|
1755
|
-
|
|
1756
|
-
if (keywords.length === 0) return results;
|
|
1757
|
-
|
|
1758
|
-
// Create case-insensitive regexes for whole-word matching
|
|
1759
|
-
const keywordRegexes = keywords.map(kw => new RegExp(`\\b${escapeRegExp(kw)}\\b`, 'i'));
|
|
1760
|
-
|
|
1761
|
-
return results.map(r => {
|
|
1762
|
-
const content = r.content || '';
|
|
1763
|
-
const file = r.file || '';
|
|
1764
|
-
|
|
1765
|
-
// Count keyword matches using whole-word regex
|
|
1766
|
-
let matchCount = 0;
|
|
1767
|
-
for (const regex of keywordRegexes) {
|
|
1768
|
-
if (regex.test(content) || regex.test(file)) {
|
|
1769
|
-
matchCount++;
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
|
|
1773
|
-
// Apply boost only if there are matches
|
|
1774
|
-
if (matchCount > 0) {
|
|
1775
|
-
const matchRatio = matchCount / keywords.length;
|
|
1776
|
-
const boost = 1 + (matchRatio * 0.3); // Up to 30% boost for full match
|
|
1777
|
-
return {
|
|
1778
|
-
...r,
|
|
1779
|
-
score: r.score * boost,
|
|
1780
|
-
};
|
|
1781
|
-
}
|
|
1782
|
-
|
|
1783
|
-
return r;
|
|
1784
|
-
});
|
|
1785
|
-
}
|
|
1786
|
-
|
|
1787
|
-
/**
|
|
1788
|
-
* Post-processing: Enforce score diversity
|
|
1789
|
-
* Penalizes results with identical scores (indicates undifferentiated matching)
|
|
1790
|
-
*/
|
|
1791
|
-
function enforceScoreDiversity(results: SemanticMatch[]): SemanticMatch[] {
|
|
1792
|
-
if (results.length < 2) return results;
|
|
1793
|
-
|
|
1794
|
-
// Count occurrences of each score (rounded to 3 decimal places for comparison)
|
|
1795
|
-
const scoreCounts = new Map<number, number>();
|
|
1796
|
-
for (const r of results) {
|
|
1797
|
-
const roundedScore = Math.round(r.score * 1000) / 1000;
|
|
1798
|
-
scoreCounts.set(roundedScore, (scoreCounts.get(roundedScore) || 0) + 1);
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
// Apply penalty to scores that appear more than twice
|
|
1802
|
-
return results.map(r => {
|
|
1803
|
-
const roundedScore = Math.round(r.score * 1000) / 1000;
|
|
1804
|
-
const count = scoreCounts.get(roundedScore) || 1;
|
|
1805
|
-
|
|
1806
|
-
if (count > 2) {
|
|
1807
|
-
// Progressive penalty: more duplicates = bigger penalty
|
|
1808
|
-
const penalty = Math.max(0.7, 1 - (count * 0.05));
|
|
1809
|
-
return { ...r, score: r.score * penalty };
|
|
1810
|
-
}
|
|
1811
|
-
return r;
|
|
1812
|
-
});
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
/**
|
|
1816
|
-
* Post-processing: Filter results with dominant baseline score (hot spot detection)
|
|
1817
|
-
* When backend returns default "hot spot" files with identical high scores,
|
|
1818
|
-
* this function detects and removes them.
|
|
1819
|
-
*
|
|
1820
|
-
* Detection criteria:
|
|
1821
|
-
* - A single score appears in >50% of results
|
|
1822
|
-
* - That score is suspiciously high (>0.9)
|
|
1823
|
-
* - This indicates fallback mechanism returned placeholder results
|
|
1824
|
-
*/
|
|
1825
|
-
function filterDominantBaselineScores(
|
|
1826
|
-
results: SemanticMatch[]
|
|
1827
|
-
): { filteredResults: SemanticMatch[]; baselineInfo: { score: number; count: number } | null } {
|
|
1828
|
-
if (results.length < 4) {
|
|
1829
|
-
return { filteredResults: results, baselineInfo: null };
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
// Count occurrences of each score (rounded to 4 decimal places)
|
|
1833
|
-
const scoreCounts = new Map<number, number>();
|
|
1834
|
-
results.forEach(r => {
|
|
1835
|
-
const rounded = Math.round(r.score * 10000) / 10000;
|
|
1836
|
-
scoreCounts.set(rounded, (scoreCounts.get(rounded) || 0) + 1);
|
|
1837
|
-
});
|
|
1838
|
-
|
|
1839
|
-
// Find the most dominant score
|
|
1840
|
-
let dominantScore: number | null = null;
|
|
1841
|
-
let dominantCount = 0;
|
|
1842
|
-
scoreCounts.forEach((count, score) => {
|
|
1843
|
-
if (count > dominantCount) {
|
|
1844
|
-
dominantCount = count;
|
|
1845
|
-
dominantScore = score;
|
|
1846
|
-
}
|
|
1847
|
-
});
|
|
1848
|
-
|
|
1849
|
-
// If a single score is present in >50% of results and is high (>0.9),
|
|
1850
|
-
// treat it as a suspicious baseline score and filter it out
|
|
1851
|
-
const BASELINE_THRESHOLD = 0.5; // >50% of results have same score
|
|
1852
|
-
const HIGH_SCORE_THRESHOLD = 0.9; // Score above 0.9 is suspiciously high
|
|
1853
|
-
|
|
1854
|
-
if (
|
|
1855
|
-
dominantScore !== null &&
|
|
1856
|
-
dominantCount > results.length * BASELINE_THRESHOLD &&
|
|
1857
|
-
dominantScore > HIGH_SCORE_THRESHOLD
|
|
1858
|
-
) {
|
|
1859
|
-
const filteredResults = results.filter(r => {
|
|
1860
|
-
const rounded = Math.round(r.score * 10000) / 10000;
|
|
1861
|
-
return rounded !== dominantScore;
|
|
1862
|
-
});
|
|
1863
|
-
|
|
1864
|
-
return {
|
|
1865
|
-
filteredResults,
|
|
1866
|
-
baselineInfo: { score: dominantScore, count: dominantCount },
|
|
1867
|
-
};
|
|
1868
|
-
}
|
|
1869
|
-
|
|
1870
|
-
return { filteredResults: results, baselineInfo: null };
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
/**
|
|
1874
|
-
* TypeScript implementation of Reciprocal Rank Fusion
|
|
1875
|
-
* Reference: codex-lens/src/codexlens/search/ranking.py
|
|
1876
|
-
* Formula: score(d) = Σ weight_source / (k + rank_source(d))
|
|
1877
|
-
*/
|
|
1878
|
-
function applyRRFFusion(
|
|
1879
|
-
resultsMap: Map<string, any[]>,
|
|
1880
|
-
weightsOrQuery: Record<string, number> | string,
|
|
1881
|
-
limit: number,
|
|
1882
|
-
k: number = 60,
|
|
1883
|
-
): any[] {
|
|
1884
|
-
const weights = typeof weightsOrQuery === 'string' ? getRRFWeights(weightsOrQuery) : weightsOrQuery;
|
|
1885
|
-
const pathScores = new Map<string, { score: number; result: any; sources: string[] }>();
|
|
1886
|
-
|
|
1887
|
-
resultsMap.forEach((results, source) => {
|
|
1888
|
-
const weight = weights[source] || 0;
|
|
1889
|
-
if (weight === 0 || !results) return;
|
|
1890
|
-
|
|
1891
|
-
results.forEach((result, rank) => {
|
|
1892
|
-
const path = result.file || result.path;
|
|
1893
|
-
if (!path) return;
|
|
1894
|
-
|
|
1895
|
-
const rrfContribution = weight / (k + rank + 1);
|
|
1896
|
-
|
|
1897
|
-
if (!pathScores.has(path)) {
|
|
1898
|
-
pathScores.set(path, { score: 0, result, sources: [] });
|
|
1899
|
-
}
|
|
1900
|
-
const entry = pathScores.get(path)!;
|
|
1901
|
-
entry.score += rrfContribution;
|
|
1902
|
-
if (!entry.sources.includes(source)) {
|
|
1903
|
-
entry.sources.push(source);
|
|
1904
|
-
}
|
|
1905
|
-
});
|
|
1906
|
-
});
|
|
1907
|
-
|
|
1908
|
-
// Sort by fusion score descending
|
|
1909
|
-
return Array.from(pathScores.values())
|
|
1910
|
-
.sort((a, b) => b.score - a.score)
|
|
1911
|
-
.slice(0, limit)
|
|
1912
|
-
.map(item => ({
|
|
1913
|
-
...item.result,
|
|
1914
|
-
fusion_score: item.score,
|
|
1915
|
-
matched_backends: item.sources,
|
|
1916
|
-
}));
|
|
1917
|
-
}
|
|
1918
|
-
|
|
1919
|
-
/**
|
|
1920
|
-
* Promise wrapper with timeout support
|
|
1921
|
-
* @param promise - The promise to wrap
|
|
1922
|
-
* @param ms - Timeout in milliseconds
|
|
1923
|
-
* @param modeName - Name of the mode for error message
|
|
1924
|
-
* @returns A new promise that rejects on timeout
|
|
1925
|
-
*/
|
|
1926
|
-
function withTimeout<T>(promise: Promise<T>, ms: number, modeName: string): Promise<T> {
|
|
1927
|
-
return new Promise((resolve, reject) => {
|
|
1928
|
-
const timer = setTimeout(() => {
|
|
1929
|
-
reject(new Error(`'${modeName}' search timed out after ${ms}ms`));
|
|
1930
|
-
}, ms);
|
|
1931
|
-
|
|
1932
|
-
promise
|
|
1933
|
-
.then(resolve)
|
|
1934
|
-
.catch(reject)
|
|
1935
|
-
.finally(() => clearTimeout(timer));
|
|
1936
|
-
});
|
|
1937
|
-
}
|
|
1938
|
-
|
|
1939
|
-
/**
|
|
1940
|
-
* Mode: priority - Fallback search strategy: hybrid -> exact -> ripgrep
|
|
1941
|
-
* Returns results from the first backend that succeeds and provides results.
|
|
1942
|
-
* More efficient than parallel mode - stops as soon as valid results are found.
|
|
1943
|
-
*/
|
|
1944
|
-
async function executePriorityFallbackMode(params: Params): Promise<SearchResult> {
|
|
1945
|
-
const { query, path = '.' } = params;
|
|
1946
|
-
const fallbackHistory: string[] = [];
|
|
1947
|
-
|
|
1948
|
-
if (!query) {
|
|
1949
|
-
return { success: false, error: 'Query is required for search' };
|
|
1950
|
-
}
|
|
1951
|
-
|
|
1952
|
-
// Check index status first
|
|
1953
|
-
const indexStatus = await checkIndexStatus(path);
|
|
1954
|
-
|
|
1955
|
-
// 1. Try Hybrid search (highest priority) - 90s timeout for large indexes
|
|
1956
|
-
if (indexStatus.indexed && indexStatus.has_embeddings) {
|
|
1957
|
-
try {
|
|
1958
|
-
const hybridResult = await withTimeout(executeHybridMode(params), 90000, 'hybrid');
|
|
1959
|
-
if (hybridResult.success && hybridResult.results && (hybridResult.results as any[]).length > 0) {
|
|
1960
|
-
fallbackHistory.push('hybrid: success');
|
|
1961
|
-
return {
|
|
1962
|
-
...hybridResult,
|
|
1963
|
-
metadata: {
|
|
1964
|
-
...hybridResult.metadata,
|
|
1965
|
-
mode: 'priority',
|
|
1966
|
-
note: 'Result from hybrid search (semantic + vector).',
|
|
1967
|
-
fallback_history: fallbackHistory,
|
|
1968
|
-
},
|
|
1969
|
-
};
|
|
1970
|
-
}
|
|
1971
|
-
fallbackHistory.push('hybrid: no results');
|
|
1972
|
-
} catch (error) {
|
|
1973
|
-
fallbackHistory.push(`hybrid: ${(error as Error).message}`);
|
|
1974
|
-
}
|
|
1975
|
-
} else {
|
|
1976
|
-
fallbackHistory.push(`hybrid: skipped (${!indexStatus.indexed ? 'no index' : 'no embeddings'})`);
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
// 2. Fallback to Exact search - 10s timeout
|
|
1980
|
-
if (indexStatus.indexed) {
|
|
1981
|
-
try {
|
|
1982
|
-
const exactResult = await withTimeout(executeCodexLensExactMode(params), 10000, 'exact');
|
|
1983
|
-
if (exactResult.success && exactResult.results && (exactResult.results as any[]).length > 0) {
|
|
1984
|
-
fallbackHistory.push('exact: success');
|
|
1985
|
-
return {
|
|
1986
|
-
...exactResult,
|
|
1987
|
-
metadata: {
|
|
1988
|
-
...exactResult.metadata,
|
|
1989
|
-
mode: 'priority',
|
|
1990
|
-
note: 'Result from exact/FTS search (fallback from hybrid).',
|
|
1991
|
-
fallback_history: fallbackHistory,
|
|
1992
|
-
},
|
|
1993
|
-
};
|
|
1994
|
-
}
|
|
1995
|
-
fallbackHistory.push('exact: no results');
|
|
1996
|
-
} catch (error) {
|
|
1997
|
-
fallbackHistory.push(`exact: ${(error as Error).message}`);
|
|
1998
|
-
}
|
|
1999
|
-
} else {
|
|
2000
|
-
fallbackHistory.push('exact: skipped (no index)');
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
// 3. Final fallback to Ripgrep - 5s timeout
|
|
2004
|
-
try {
|
|
2005
|
-
const ripgrepResult = await withTimeout(executeRipgrepMode(params), 5000, 'ripgrep');
|
|
2006
|
-
fallbackHistory.push(ripgrepResult.success ? 'ripgrep: success' : 'ripgrep: failed');
|
|
2007
|
-
return {
|
|
2008
|
-
...ripgrepResult,
|
|
2009
|
-
metadata: {
|
|
2010
|
-
...ripgrepResult.metadata,
|
|
2011
|
-
mode: 'priority',
|
|
2012
|
-
note: 'Result from ripgrep search (final fallback).',
|
|
2013
|
-
fallback_history: fallbackHistory,
|
|
2014
|
-
},
|
|
2015
|
-
};
|
|
2016
|
-
} catch (error) {
|
|
2017
|
-
fallbackHistory.push(`ripgrep: ${(error as Error).message}`);
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
// All modes failed
|
|
2021
|
-
return {
|
|
2022
|
-
success: false,
|
|
2023
|
-
error: 'All search backends in priority mode failed or returned no results.',
|
|
2024
|
-
metadata: {
|
|
2025
|
-
mode: 'priority',
|
|
2026
|
-
query,
|
|
2027
|
-
fallback_history: fallbackHistory,
|
|
2028
|
-
} as any,
|
|
2029
|
-
};
|
|
2030
|
-
}
|
|
2031
|
-
|
|
2032
|
-
// Tool schema for MCP
|
|
2033
|
-
export const schema: ToolSchema = {
|
|
2034
|
-
name: 'smart_search',
|
|
2035
|
-
description: `Unified code search tool with content search, file discovery, and semantic search capabilities.
|
|
2036
|
-
|
|
2037
|
-
**Actions:**
|
|
2038
|
-
- search: Search file content (default)
|
|
2039
|
-
- find_files: Find files by path/name pattern (glob matching)
|
|
2040
|
-
- init: Create FTS index (incremental - skips existing)
|
|
2041
|
-
- init_force: Force full rebuild (delete and recreate index)
|
|
2042
|
-
- status: Check index status
|
|
2043
|
-
- update: Incremental index update (for changed files)
|
|
2044
|
-
- watch: Start file watcher for automatic updates
|
|
2045
|
-
|
|
2046
|
-
**Content Search (action="search"):**
|
|
2047
|
-
smart_search(query="authentication logic") # fuzzy mode (default) - FTS + ripgrep fusion
|
|
2048
|
-
smart_search(query="MyClass", mode="fuzzy") # fuzzy mode - fast hybrid search
|
|
2049
|
-
smart_search(query="how to auth", mode="semantic") # semantic mode - dense + reranker
|
|
2050
|
-
|
|
2051
|
-
**File Discovery (action="find_files"):**
|
|
2052
|
-
smart_search(action="find_files", pattern="*.ts") # find all TypeScript files
|
|
2053
|
-
smart_search(action="find_files", pattern="src/**/*.js") # recursive glob pattern
|
|
2054
|
-
smart_search(action="find_files", pattern="test_*.py") # find test files
|
|
2055
|
-
smart_search(action="find_files", pattern="*.tsx", offset=20, limit=10) # pagination
|
|
2056
|
-
|
|
2057
|
-
**Index Maintenance:**
|
|
2058
|
-
smart_search(action="update", path="/project") # incremental index update
|
|
2059
|
-
smart_search(action="watch", path="/project") # start file watcher
|
|
2060
|
-
smart_search(action="watch", debounce=2000) # custom debounce interval
|
|
2061
|
-
|
|
2062
|
-
**Pagination:** All actions support offset/limit for paginated results:
|
|
2063
|
-
smart_search(query="auth", limit=10, offset=0) # first page
|
|
2064
|
-
smart_search(query="auth", limit=10, offset=10) # second page
|
|
2065
|
-
|
|
2066
|
-
**Modes:** fuzzy (FTS + ripgrep fusion, default), semantic (dense + reranker)`,
|
|
2067
|
-
inputSchema: {
|
|
2068
|
-
type: 'object',
|
|
2069
|
-
properties: {
|
|
2070
|
-
action: {
|
|
2071
|
-
type: 'string',
|
|
2072
|
-
enum: ['init', 'init_force', 'search', 'find_files', 'status', 'update', 'watch', 'search_files'],
|
|
2073
|
-
description: 'Action: search (content search), find_files (path pattern matching), init (create index, incremental), init_force (force full rebuild), status (check index), update (incremental update), watch (auto-update). Note: search_files is deprecated.',
|
|
2074
|
-
default: 'search',
|
|
2075
|
-
},
|
|
2076
|
-
query: {
|
|
2077
|
-
type: 'string',
|
|
2078
|
-
description: 'Content search query (for action="search")',
|
|
2079
|
-
},
|
|
2080
|
-
pattern: {
|
|
2081
|
-
type: 'string',
|
|
2082
|
-
description: 'Glob pattern for file discovery (for action="find_files"). Examples: "*.ts", "src/**/*.js", "test_*.py"',
|
|
2083
|
-
},
|
|
2084
|
-
mode: {
|
|
2085
|
-
type: 'string',
|
|
2086
|
-
enum: SEARCH_MODES,
|
|
2087
|
-
description: 'Search mode: fuzzy (FTS + ripgrep fusion, default), semantic (dense + reranker for natural language queries)',
|
|
2088
|
-
default: 'fuzzy',
|
|
2089
|
-
},
|
|
2090
|
-
output_mode: {
|
|
2091
|
-
type: 'string',
|
|
2092
|
-
enum: ['full', 'files_only', 'count'],
|
|
2093
|
-
description: 'Output format: full (default), files_only (paths only), count (per-file counts)',
|
|
2094
|
-
default: 'full',
|
|
2095
|
-
},
|
|
2096
|
-
path: {
|
|
2097
|
-
type: 'string',
|
|
2098
|
-
description: 'Directory path for init/search actions (default: current directory)',
|
|
2099
|
-
},
|
|
2100
|
-
paths: {
|
|
2101
|
-
type: 'array',
|
|
2102
|
-
description: 'Multiple paths to search within (for search action)',
|
|
2103
|
-
items: {
|
|
2104
|
-
type: 'string',
|
|
2105
|
-
},
|
|
2106
|
-
default: [],
|
|
2107
|
-
},
|
|
2108
|
-
contextLines: {
|
|
2109
|
-
type: 'number',
|
|
2110
|
-
description: 'Number of context lines around matches (exact mode only)',
|
|
2111
|
-
default: 0,
|
|
2112
|
-
},
|
|
2113
|
-
maxResults: {
|
|
2114
|
-
type: 'number',
|
|
2115
|
-
description: 'Maximum number of results (default: 20)',
|
|
2116
|
-
default: 20,
|
|
2117
|
-
},
|
|
2118
|
-
limit: {
|
|
2119
|
-
type: 'number',
|
|
2120
|
-
description: 'Alias for maxResults (default: 20)',
|
|
2121
|
-
default: 20,
|
|
2122
|
-
},
|
|
2123
|
-
extraFilesCount: {
|
|
2124
|
-
type: 'number',
|
|
2125
|
-
description: 'Number of additional file-only results (paths without content)',
|
|
2126
|
-
default: 10,
|
|
2127
|
-
},
|
|
2128
|
-
maxContentLength: {
|
|
2129
|
-
type: 'number',
|
|
2130
|
-
description: 'Maximum content length for truncation (50-2000)',
|
|
2131
|
-
default: 200,
|
|
2132
|
-
},
|
|
2133
|
-
offset: {
|
|
2134
|
-
type: 'number',
|
|
2135
|
-
description: 'Pagination offset - skip first N results (default: 0)',
|
|
2136
|
-
default: 0,
|
|
2137
|
-
},
|
|
2138
|
-
includeHidden: {
|
|
2139
|
-
type: 'boolean',
|
|
2140
|
-
description: 'Include hidden files/directories',
|
|
2141
|
-
default: false,
|
|
2142
|
-
},
|
|
2143
|
-
languages: {
|
|
2144
|
-
type: 'array',
|
|
2145
|
-
items: { type: 'string' },
|
|
2146
|
-
description: 'Languages to index (for init action). Example: ["javascript", "typescript"]',
|
|
2147
|
-
},
|
|
2148
|
-
enrich: {
|
|
2149
|
-
type: 'boolean',
|
|
2150
|
-
description: 'Enrich search results with code graph relationships (calls, imports, called_by, imported_by).',
|
|
2151
|
-
default: false,
|
|
2152
|
-
},
|
|
2153
|
-
regex: {
|
|
2154
|
-
type: 'boolean',
|
|
2155
|
-
description: 'Use regex pattern matching instead of literal string (ripgrep mode only). Default: enabled. Example: smart_search(query="class.*Builder")',
|
|
2156
|
-
default: true,
|
|
2157
|
-
},
|
|
2158
|
-
caseSensitive: {
|
|
2159
|
-
type: 'boolean',
|
|
2160
|
-
description: 'Case-sensitive search (default: true). Set to false for case-insensitive matching.',
|
|
2161
|
-
default: true,
|
|
2162
|
-
},
|
|
2163
|
-
tokenize: {
|
|
2164
|
-
type: 'boolean',
|
|
2165
|
-
description: 'Tokenize multi-word queries for OR matching (ripgrep mode). Default: true. Results are ranked by token match count (exact matches first).',
|
|
2166
|
-
default: true,
|
|
2167
|
-
},
|
|
2168
|
-
},
|
|
2169
|
-
required: [],
|
|
2170
|
-
},
|
|
2171
|
-
};
|
|
2172
|
-
|
|
2173
|
-
/**
|
|
2174
|
-
* Action: find_files - Find files by path/name pattern (glob matching)
|
|
2175
|
-
* Unlike search which looks inside file content, find_files matches file paths
|
|
2176
|
-
*/
|
|
2177
|
-
async function executeFindFilesAction(params: Params): Promise<SearchResult> {
|
|
2178
|
-
const { pattern, path = '.', limit = 20, offset = 0, includeHidden = false, caseSensitive = true } = params;
|
|
2179
|
-
|
|
2180
|
-
if (!pattern) {
|
|
2181
|
-
return {
|
|
2182
|
-
success: false,
|
|
2183
|
-
error: 'Pattern is required for find_files action. Use glob patterns like "*.ts", "src/**/*.js", or "test_*.py"',
|
|
2184
|
-
};
|
|
2185
|
-
}
|
|
2186
|
-
|
|
2187
|
-
// Use ripgrep with --files flag for fast file listing with glob pattern
|
|
2188
|
-
const hasRipgrep = checkToolAvailability('rg');
|
|
2189
|
-
|
|
2190
|
-
if (!hasRipgrep) {
|
|
2191
|
-
// Fallback to CodexLens file listing if available
|
|
2192
|
-
const readyStatus = await ensureCodexLensReady();
|
|
2193
|
-
if (!readyStatus.ready) {
|
|
2194
|
-
return {
|
|
2195
|
-
success: false,
|
|
2196
|
-
error: 'Neither ripgrep nor CodexLens available for file discovery.',
|
|
2197
|
-
};
|
|
2198
|
-
}
|
|
2199
|
-
|
|
2200
|
-
// Try CodexLens file list command
|
|
2201
|
-
const args = ['list-files', '--json'];
|
|
2202
|
-
const result = await executeCodexLens(args, { cwd: path });
|
|
2203
|
-
|
|
2204
|
-
if (!result.success) {
|
|
2205
|
-
return {
|
|
2206
|
-
success: false,
|
|
2207
|
-
error: `Failed to list files: ${result.error}`,
|
|
2208
|
-
};
|
|
2209
|
-
}
|
|
2210
|
-
|
|
2211
|
-
// Parse and filter results by pattern
|
|
2212
|
-
let files: string[] = [];
|
|
2213
|
-
try {
|
|
2214
|
-
const parsed = JSON.parse(stripAnsi(result.output || '[]'));
|
|
2215
|
-
files = Array.isArray(parsed) ? parsed : (parsed.files || []);
|
|
2216
|
-
} catch {
|
|
2217
|
-
return {
|
|
2218
|
-
success: false,
|
|
2219
|
-
error: 'Failed to parse file list from CodexLens',
|
|
2220
|
-
};
|
|
2221
|
-
}
|
|
2222
|
-
|
|
2223
|
-
// Apply glob pattern matching using minimatch-style regex
|
|
2224
|
-
const globRegex = globToRegex(pattern, caseSensitive);
|
|
2225
|
-
const matchedFiles = files.filter(f => globRegex.test(f));
|
|
2226
|
-
|
|
2227
|
-
// Apply pagination
|
|
2228
|
-
const total = matchedFiles.length;
|
|
2229
|
-
const paginatedFiles = matchedFiles.slice(offset, offset + limit);
|
|
2230
|
-
|
|
2231
|
-
const results: FileMatch[] = paginatedFiles.map(filePath => {
|
|
2232
|
-
const parts = filePath.split(/[/\\]/);
|
|
2233
|
-
const name = parts[parts.length - 1] || '';
|
|
2234
|
-
const ext = name.includes('.') ? name.split('.').pop() : undefined;
|
|
2235
|
-
return {
|
|
2236
|
-
path: filePath,
|
|
2237
|
-
type: 'file' as const,
|
|
2238
|
-
name,
|
|
2239
|
-
extension: ext,
|
|
2240
|
-
};
|
|
2241
|
-
});
|
|
2242
|
-
|
|
2243
|
-
return {
|
|
2244
|
-
success: true,
|
|
2245
|
-
results,
|
|
2246
|
-
metadata: {
|
|
2247
|
-
pattern,
|
|
2248
|
-
backend: 'codexlens',
|
|
2249
|
-
count: results.length,
|
|
2250
|
-
pagination: {
|
|
2251
|
-
offset,
|
|
2252
|
-
limit,
|
|
2253
|
-
total,
|
|
2254
|
-
has_more: offset + limit < total,
|
|
2255
|
-
},
|
|
2256
|
-
},
|
|
2257
|
-
};
|
|
2258
|
-
}
|
|
2259
|
-
|
|
2260
|
-
// Use ripgrep --files with glob pattern for fast file discovery
|
|
2261
|
-
return new Promise((resolve) => {
|
|
2262
|
-
const args = ['--files'];
|
|
2263
|
-
|
|
2264
|
-
// Add exclude patterns
|
|
2265
|
-
if (!includeHidden) {
|
|
2266
|
-
args.push(...buildExcludeArgs());
|
|
2267
|
-
} else {
|
|
2268
|
-
args.push('--hidden');
|
|
2269
|
-
}
|
|
2270
|
-
|
|
2271
|
-
// Add glob pattern
|
|
2272
|
-
args.push('--glob', pattern);
|
|
2273
|
-
|
|
2274
|
-
// Case sensitivity for glob matching
|
|
2275
|
-
if (!caseSensitive) {
|
|
2276
|
-
args.push('--iglob', pattern);
|
|
2277
|
-
// Remove the case-sensitive glob and use iglob instead
|
|
2278
|
-
const globIndex = args.indexOf('--glob');
|
|
2279
|
-
if (globIndex !== -1) {
|
|
2280
|
-
args.splice(globIndex, 2);
|
|
2281
|
-
}
|
|
2282
|
-
}
|
|
2283
|
-
|
|
2284
|
-
const child = spawn('rg', args, {
|
|
2285
|
-
cwd: path || getProjectRoot(),
|
|
2286
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
2287
|
-
});
|
|
2288
|
-
|
|
2289
|
-
let stdout = '';
|
|
2290
|
-
let stderr = '';
|
|
2291
|
-
|
|
2292
|
-
child.stdout.on('data', (data) => {
|
|
2293
|
-
stdout += data.toString();
|
|
2294
|
-
});
|
|
2295
|
-
|
|
2296
|
-
child.stderr.on('data', (data) => {
|
|
2297
|
-
stderr += data.toString();
|
|
2298
|
-
});
|
|
2299
|
-
|
|
2300
|
-
child.on('close', (code) => {
|
|
2301
|
-
// ripgrep returns 1 when no matches found, which is not an error
|
|
2302
|
-
if (code !== 0 && code !== 1 && !stderr.includes('os error 1')) {
|
|
2303
|
-
resolve({
|
|
2304
|
-
success: false,
|
|
2305
|
-
error: `ripgrep file search failed: ${stderr}`,
|
|
2306
|
-
});
|
|
2307
|
-
return;
|
|
2308
|
-
}
|
|
2309
|
-
|
|
2310
|
-
const allFiles = stdout.split('\n').filter(line => line.trim());
|
|
2311
|
-
const total = allFiles.length;
|
|
2312
|
-
|
|
2313
|
-
// Apply pagination
|
|
2314
|
-
const paginatedFiles = allFiles.slice(offset, offset + limit);
|
|
2315
|
-
|
|
2316
|
-
const results: FileMatch[] = paginatedFiles.map(filePath => {
|
|
2317
|
-
const normalizedPath = filePath.replace(/\\/g, '/');
|
|
2318
|
-
const parts = normalizedPath.split('/');
|
|
2319
|
-
const name = parts[parts.length - 1] || '';
|
|
2320
|
-
const ext = name.includes('.') ? name.split('.').pop() : undefined;
|
|
2321
|
-
return {
|
|
2322
|
-
path: normalizedPath,
|
|
2323
|
-
type: 'file' as const,
|
|
2324
|
-
name,
|
|
2325
|
-
extension: ext,
|
|
2326
|
-
};
|
|
2327
|
-
});
|
|
2328
|
-
|
|
2329
|
-
resolve({
|
|
2330
|
-
success: true,
|
|
2331
|
-
results,
|
|
2332
|
-
metadata: {
|
|
2333
|
-
pattern,
|
|
2334
|
-
backend: 'ripgrep',
|
|
2335
|
-
count: results.length,
|
|
2336
|
-
pagination: {
|
|
2337
|
-
offset,
|
|
2338
|
-
limit,
|
|
2339
|
-
total,
|
|
2340
|
-
has_more: offset + limit < total,
|
|
2341
|
-
},
|
|
2342
|
-
},
|
|
2343
|
-
});
|
|
2344
|
-
});
|
|
2345
|
-
|
|
2346
|
-
child.on('error', (error) => {
|
|
2347
|
-
resolve({
|
|
2348
|
-
success: false,
|
|
2349
|
-
error: `Failed to spawn ripgrep: ${error.message}`,
|
|
2350
|
-
});
|
|
2351
|
-
});
|
|
2352
|
-
});
|
|
2353
|
-
}
|
|
2354
|
-
|
|
2355
|
-
/**
|
|
2356
|
-
* Convert glob pattern to regex for file matching
|
|
2357
|
-
* Supports: *, **, ?, [abc], [!abc]
|
|
2358
|
-
*/
|
|
2359
|
-
function globToRegex(pattern: string, caseSensitive: boolean = true): RegExp {
|
|
2360
|
-
let i = 0;
|
|
2361
|
-
const out: string[] = [];
|
|
2362
|
-
const special = '.^$+{}|()';
|
|
2363
|
-
|
|
2364
|
-
while (i < pattern.length) {
|
|
2365
|
-
const c = pattern[i];
|
|
2366
|
-
|
|
2367
|
-
if (c === '*') {
|
|
2368
|
-
if (i + 1 < pattern.length && pattern[i + 1] === '*') {
|
|
2369
|
-
// ** matches any path including /
|
|
2370
|
-
out.push('.*');
|
|
2371
|
-
i += 2;
|
|
2372
|
-
// Skip following / if present
|
|
2373
|
-
if (pattern[i] === '/') {
|
|
2374
|
-
i++;
|
|
2375
|
-
}
|
|
2376
|
-
continue;
|
|
2377
|
-
} else {
|
|
2378
|
-
// * matches any character except /
|
|
2379
|
-
out.push('[^/]*');
|
|
2380
|
-
}
|
|
2381
|
-
} else if (c === '?') {
|
|
2382
|
-
out.push('[^/]');
|
|
2383
|
-
} else if (c === '[') {
|
|
2384
|
-
// Character class
|
|
2385
|
-
let j = i + 1;
|
|
2386
|
-
let negated = false;
|
|
2387
|
-
if (pattern[j] === '!' || pattern[j] === '^') {
|
|
2388
|
-
negated = true;
|
|
2389
|
-
j++;
|
|
2390
|
-
}
|
|
2391
|
-
let classContent = '';
|
|
2392
|
-
while (j < pattern.length && pattern[j] !== ']') {
|
|
2393
|
-
classContent += pattern[j];
|
|
2394
|
-
j++;
|
|
2395
|
-
}
|
|
2396
|
-
if (negated) {
|
|
2397
|
-
out.push(`[^${classContent}]`);
|
|
2398
|
-
} else {
|
|
2399
|
-
out.push(`[${classContent}]`);
|
|
2400
|
-
}
|
|
2401
|
-
i = j;
|
|
2402
|
-
} else if (special.includes(c)) {
|
|
2403
|
-
out.push('\\' + c);
|
|
2404
|
-
} else {
|
|
2405
|
-
out.push(c);
|
|
2406
|
-
}
|
|
2407
|
-
i++;
|
|
2408
|
-
}
|
|
2409
|
-
|
|
2410
|
-
const flags = caseSensitive ? '' : 'i';
|
|
2411
|
-
return new RegExp('^' + out.join('') + '$', flags);
|
|
2412
|
-
}
|
|
2413
|
-
|
|
2414
|
-
/**
|
|
2415
|
-
* Apply pagination to search results and add pagination metadata
|
|
2416
|
-
*/
|
|
2417
|
-
function applyPagination<T>(
|
|
2418
|
-
results: T[],
|
|
2419
|
-
offset: number,
|
|
2420
|
-
limit: number
|
|
2421
|
-
): { paginatedResults: T[]; pagination: PaginationInfo } {
|
|
2422
|
-
const total = results.length;
|
|
2423
|
-
const paginatedResults = results.slice(offset, offset + limit);
|
|
2424
|
-
|
|
2425
|
-
return {
|
|
2426
|
-
paginatedResults,
|
|
2427
|
-
pagination: {
|
|
2428
|
-
offset,
|
|
2429
|
-
limit,
|
|
2430
|
-
total,
|
|
2431
|
-
has_more: offset + limit < total,
|
|
2432
|
-
},
|
|
2433
|
-
};
|
|
2434
|
-
}
|
|
2435
|
-
|
|
2436
|
-
/**
|
|
2437
|
-
* Transform results based on output_mode
|
|
2438
|
-
*/
|
|
2439
|
-
function transformOutput(
|
|
2440
|
-
results: ExactMatch[] | SemanticMatch[] | GraphMatch[] | unknown[],
|
|
2441
|
-
outputMode: 'full' | 'files_only' | 'count'
|
|
2442
|
-
): unknown {
|
|
2443
|
-
if (!Array.isArray(results)) {
|
|
2444
|
-
return results;
|
|
2445
|
-
}
|
|
2446
|
-
|
|
2447
|
-
switch (outputMode) {
|
|
2448
|
-
case 'files_only': {
|
|
2449
|
-
// Extract unique file paths
|
|
2450
|
-
const files = [...new Set(results.map((r: any) => r.file))].filter(Boolean);
|
|
2451
|
-
return { files, count: files.length };
|
|
2452
|
-
}
|
|
2453
|
-
case 'count': {
|
|
2454
|
-
// Count matches per file
|
|
2455
|
-
const counts: Record<string, number> = {};
|
|
2456
|
-
for (const r of results) {
|
|
2457
|
-
const file = (r as any).file;
|
|
2458
|
-
if (file) {
|
|
2459
|
-
counts[file] = (counts[file] || 0) + 1;
|
|
2460
|
-
}
|
|
2461
|
-
}
|
|
2462
|
-
return {
|
|
2463
|
-
files: Object.entries(counts).map(([file, count]) => ({ file, count })),
|
|
2464
|
-
total: results.length,
|
|
2465
|
-
};
|
|
2466
|
-
}
|
|
2467
|
-
case 'full':
|
|
2468
|
-
default:
|
|
2469
|
-
return results;
|
|
2470
|
-
}
|
|
2471
|
-
}
|
|
2472
|
-
|
|
2473
|
-
// Handler function
|
|
2474
|
-
export async function handler(params: Record<string, unknown>): Promise<ToolResult<SearchResult>> {
|
|
2475
|
-
const parsed = ParamsSchema.safeParse(params);
|
|
2476
|
-
if (!parsed.success) {
|
|
2477
|
-
return { success: false, error: `Invalid params: ${parsed.error.message}` };
|
|
2478
|
-
}
|
|
2479
|
-
|
|
2480
|
-
const { action, mode, output_mode, offset = 0 } = parsed.data;
|
|
2481
|
-
|
|
2482
|
-
// Sync limit and maxResults - use the larger of the two if both provided
|
|
2483
|
-
// This ensures user-provided values take precedence over defaults
|
|
2484
|
-
const effectiveLimit = Math.max(parsed.data.limit || 20, parsed.data.maxResults || 20);
|
|
2485
|
-
parsed.data.maxResults = effectiveLimit;
|
|
2486
|
-
parsed.data.limit = effectiveLimit;
|
|
2487
|
-
|
|
2488
|
-
// Track if search_files was used (deprecated)
|
|
2489
|
-
let deprecationWarning: string | undefined;
|
|
2490
|
-
|
|
2491
|
-
try {
|
|
2492
|
-
let result: SearchResult;
|
|
2493
|
-
|
|
2494
|
-
// Handle actions
|
|
2495
|
-
switch (action) {
|
|
2496
|
-
case 'init':
|
|
2497
|
-
result = await executeInitAction(parsed.data, false);
|
|
2498
|
-
break;
|
|
2499
|
-
|
|
2500
|
-
case 'init_force':
|
|
2501
|
-
result = await executeInitAction(parsed.data, true);
|
|
2502
|
-
break;
|
|
2503
|
-
|
|
2504
|
-
case 'status':
|
|
2505
|
-
result = await executeStatusAction(parsed.data);
|
|
2506
|
-
break;
|
|
2507
|
-
|
|
2508
|
-
case 'find_files':
|
|
2509
|
-
// NEW: File path/name pattern matching (glob-based)
|
|
2510
|
-
result = await executeFindFilesAction(parsed.data);
|
|
2511
|
-
break;
|
|
2512
|
-
|
|
2513
|
-
case 'update':
|
|
2514
|
-
// Incremental index update
|
|
2515
|
-
result = await executeUpdateAction(parsed.data);
|
|
2516
|
-
break;
|
|
2517
|
-
|
|
2518
|
-
case 'watch':
|
|
2519
|
-
// Start file watcher (returns status, watcher runs in background)
|
|
2520
|
-
result = await executeWatchAction(parsed.data);
|
|
2521
|
-
break;
|
|
2522
|
-
|
|
2523
|
-
case 'search_files':
|
|
2524
|
-
// DEPRECATED: Redirect to search with files_only output
|
|
2525
|
-
deprecationWarning = 'action="search_files" is deprecated. Use action="search" with output_mode="files_only" for content-to-files search, or action="find_files" for path pattern matching.';
|
|
2526
|
-
parsed.data.output_mode = 'files_only';
|
|
2527
|
-
// Fall through to search
|
|
2528
|
-
|
|
2529
|
-
case 'search':
|
|
2530
|
-
default:
|
|
2531
|
-
// Handle search modes: fuzzy | semantic
|
|
2532
|
-
switch (mode) {
|
|
2533
|
-
case 'fuzzy':
|
|
2534
|
-
result = await executeFuzzyMode(parsed.data);
|
|
2535
|
-
break;
|
|
2536
|
-
case 'semantic':
|
|
2537
|
-
result = await executeHybridMode(parsed.data);
|
|
2538
|
-
break;
|
|
2539
|
-
default:
|
|
2540
|
-
throw new Error(`Unsupported mode: ${mode}. Use: fuzzy or semantic`);
|
|
2541
|
-
}
|
|
2542
|
-
break;
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
|
-
// Transform output based on output_mode (for search actions only)
|
|
2546
|
-
if (action === 'search' || action === 'search_files') {
|
|
2547
|
-
if (result.success && result.results && output_mode !== 'full') {
|
|
2548
|
-
result.results = transformOutput(result.results as any[], output_mode);
|
|
2549
|
-
}
|
|
2550
|
-
|
|
2551
|
-
// Add pagination metadata for search results if not already present
|
|
2552
|
-
if (result.success && result.results && Array.isArray(result.results)) {
|
|
2553
|
-
const totalResults = (result.results as any[]).length;
|
|
2554
|
-
if (!result.metadata) {
|
|
2555
|
-
result.metadata = {};
|
|
2556
|
-
}
|
|
2557
|
-
if (!result.metadata.pagination) {
|
|
2558
|
-
result.metadata.pagination = {
|
|
2559
|
-
offset: 0,
|
|
2560
|
-
limit: effectiveLimit,
|
|
2561
|
-
total: totalResults,
|
|
2562
|
-
has_more: false, // Already limited by backend
|
|
2563
|
-
};
|
|
2564
|
-
}
|
|
2565
|
-
}
|
|
2566
|
-
}
|
|
2567
|
-
|
|
2568
|
-
// Add deprecation warning if applicable
|
|
2569
|
-
if (deprecationWarning && result.metadata) {
|
|
2570
|
-
result.metadata.warning = deprecationWarning;
|
|
2571
|
-
}
|
|
2572
|
-
|
|
2573
|
-
return result.success ? { success: true, result } : { success: false, error: result.error };
|
|
2574
|
-
} catch (error) {
|
|
2575
|
-
return { success: false, error: (error as Error).message };
|
|
2576
|
-
}
|
|
2577
|
-
}
|
|
2578
|
-
|
|
2579
|
-
/**
|
|
2580
|
-
* Execute init action with external progress callback
|
|
2581
|
-
* Used by MCP server for streaming progress
|
|
2582
|
-
* @param params - Search parameters (path, languages, force)
|
|
2583
|
-
* @param onProgress - Optional callback for progress updates
|
|
2584
|
-
*/
|
|
2585
|
-
export async function executeInitWithProgress(
|
|
2586
|
-
params: Record<string, unknown>,
|
|
2587
|
-
onProgress?: (progress: ProgressInfo) => void
|
|
2588
|
-
): Promise<SearchResult> {
|
|
2589
|
-
const path = (params.path as string) || '.';
|
|
2590
|
-
const languages = params.languages as string[] | undefined;
|
|
2591
|
-
const force = params.force as boolean || false;
|
|
2592
|
-
|
|
2593
|
-
// Check CodexLens availability
|
|
2594
|
-
const readyStatus = await ensureCodexLensReady();
|
|
2595
|
-
if (!readyStatus.ready) {
|
|
2596
|
-
return {
|
|
2597
|
-
success: false,
|
|
2598
|
-
error: `CodexLens not available: ${readyStatus.error}. CodexLens will be auto-installed on first use.`,
|
|
2599
|
-
};
|
|
2600
|
-
}
|
|
2601
|
-
|
|
2602
|
-
// Use 'index init' subcommand (new CLI structure)
|
|
2603
|
-
const args = ['index', 'init', path];
|
|
2604
|
-
if (force) {
|
|
2605
|
-
args.push('--force'); // Force full rebuild
|
|
2606
|
-
}
|
|
2607
|
-
if (languages && languages.length > 0) {
|
|
2608
|
-
args.push('--language', languages.join(','));
|
|
2609
|
-
}
|
|
2610
|
-
|
|
2611
|
-
// Track progress updates
|
|
2612
|
-
const progressUpdates: ProgressInfo[] = [];
|
|
2613
|
-
let lastProgress: ProgressInfo | null = null;
|
|
2614
|
-
|
|
2615
|
-
const result = await executeCodexLens(args, {
|
|
2616
|
-
cwd: path,
|
|
2617
|
-
timeout: 1800000, // 30 minutes for large codebases
|
|
2618
|
-
onProgress: (progress: ProgressInfo) => {
|
|
2619
|
-
progressUpdates.push(progress);
|
|
2620
|
-
lastProgress = progress;
|
|
2621
|
-
// Call external progress callback if provided
|
|
2622
|
-
if (onProgress) {
|
|
2623
|
-
onProgress(progress);
|
|
2624
|
-
}
|
|
2625
|
-
},
|
|
2626
|
-
});
|
|
2627
|
-
|
|
2628
|
-
// Build metadata with progress info
|
|
2629
|
-
const metadata: SearchMetadata = {
|
|
2630
|
-
action: force ? 'init_force' : 'init',
|
|
2631
|
-
path,
|
|
2632
|
-
};
|
|
2633
|
-
|
|
2634
|
-
if (lastProgress !== null) {
|
|
2635
|
-
const p = lastProgress as ProgressInfo;
|
|
2636
|
-
metadata.progress = {
|
|
2637
|
-
stage: p.stage,
|
|
2638
|
-
message: p.message,
|
|
2639
|
-
percent: p.percent,
|
|
2640
|
-
filesProcessed: p.filesProcessed,
|
|
2641
|
-
totalFiles: p.totalFiles,
|
|
2642
|
-
};
|
|
2643
|
-
}
|
|
2644
|
-
|
|
2645
|
-
if (progressUpdates.length > 0) {
|
|
2646
|
-
metadata.progressHistory = progressUpdates.slice(-5);
|
|
2647
|
-
}
|
|
2648
|
-
|
|
2649
|
-
const actionLabel = force ? 'rebuilt (force)' : 'created';
|
|
2650
|
-
return {
|
|
2651
|
-
success: result.success,
|
|
2652
|
-
error: result.error,
|
|
2653
|
-
message: result.success
|
|
2654
|
-
? `CodexLens index ${actionLabel} successfully for ${path}`
|
|
2655
|
-
: undefined,
|
|
2656
|
-
metadata,
|
|
2657
|
-
};
|
|
2658
|
-
}
|