codehere 0.3.0 → 0.5.0-alpha
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/LICENSE +1 -1
- package/README.md +329 -65
- package/dist/application/agents/documentation-agent.d.ts +24 -0
- package/dist/application/agents/documentation-agent.d.ts.map +1 -0
- package/dist/application/agents/documentation-agent.js +399 -0
- package/dist/application/agents/documentation-agent.js.map +1 -0
- package/dist/application/agents/execution-agent.d.ts +11 -0
- package/dist/application/agents/execution-agent.d.ts.map +1 -1
- package/dist/application/agents/execution-agent.js +289 -80
- package/dist/application/agents/execution-agent.js.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.d.ts +4 -0
- package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.js +95 -2
- package/dist/application/agents/multi-agent-orchestrator.js.map +1 -1
- package/dist/application/agents/planning-agent.d.ts +3 -0
- package/dist/application/agents/planning-agent.d.ts.map +1 -1
- package/dist/application/agents/planning-agent.js +151 -71
- package/dist/application/agents/planning-agent.js.map +1 -1
- package/dist/application/agents/product-requirements-agent.d.ts +21 -0
- package/dist/application/agents/product-requirements-agent.d.ts.map +1 -0
- package/dist/application/agents/product-requirements-agent.js +247 -0
- package/dist/application/agents/product-requirements-agent.js.map +1 -0
- package/dist/application/agents/validation-agent.d.ts +5 -1
- package/dist/application/agents/validation-agent.d.ts.map +1 -1
- package/dist/application/agents/validation-agent.js +156 -21
- package/dist/application/agents/validation-agent.js.map +1 -1
- package/dist/application/reasoning/multi-model-planning-strategy.d.ts +21 -0
- package/dist/application/reasoning/multi-model-planning-strategy.d.ts.map +1 -0
- package/dist/application/reasoning/multi-model-planning-strategy.js +158 -0
- package/dist/application/reasoning/multi-model-planning-strategy.js.map +1 -0
- package/dist/application/reasoning/reasoning-config.d.ts +15 -0
- package/dist/application/reasoning/reasoning-config.d.ts.map +1 -0
- package/dist/application/reasoning/reasoning-config.js +50 -0
- package/dist/application/reasoning/reasoning-config.js.map +1 -0
- package/dist/application/reasoning/reasoning-orchestrator.d.ts +18 -0
- package/dist/application/reasoning/reasoning-orchestrator.d.ts.map +1 -0
- package/dist/application/reasoning/reasoning-orchestrator.js +170 -0
- package/dist/application/reasoning/reasoning-orchestrator.js.map +1 -0
- package/dist/application/reasoning/reasoning-strategy.interface.d.ts +24 -0
- package/dist/application/reasoning/reasoning-strategy.interface.d.ts.map +1 -0
- package/dist/application/reasoning/reasoning-strategy.interface.js +6 -0
- package/dist/application/reasoning/reasoning-strategy.interface.js.map +1 -0
- package/dist/application/reasoning/role-provider-resolver.d.ts +36 -0
- package/dist/application/reasoning/role-provider-resolver.d.ts.map +1 -0
- package/dist/application/reasoning/role-provider-resolver.js +74 -0
- package/dist/application/reasoning/role-provider-resolver.js.map +1 -0
- package/dist/application/reasoning/simple-planning-strategy.d.ts +22 -0
- package/dist/application/reasoning/simple-planning-strategy.d.ts.map +1 -0
- package/dist/application/reasoning/simple-planning-strategy.js +217 -0
- package/dist/application/reasoning/simple-planning-strategy.js.map +1 -0
- package/dist/application/reasoning/types.d.ts +65 -0
- package/dist/application/reasoning/types.d.ts.map +1 -0
- package/dist/application/reasoning/types.js +6 -0
- package/dist/application/reasoning/types.js.map +1 -0
- package/dist/application/reasoning/validator-strategy.d.ts +56 -0
- package/dist/application/reasoning/validator-strategy.d.ts.map +1 -0
- package/dist/application/reasoning/validator-strategy.js +103 -0
- package/dist/application/reasoning/validator-strategy.js.map +1 -0
- package/dist/application/services/dependency-container.d.ts +46 -2
- package/dist/application/services/dependency-container.d.ts.map +1 -1
- package/dist/application/services/dependency-container.js +198 -8
- package/dist/application/services/dependency-container.js.map +1 -1
- package/dist/application/services/intelligent-router.d.ts +19 -0
- package/dist/application/services/intelligent-router.d.ts.map +1 -1
- package/dist/application/services/intelligent-router.js +393 -91
- package/dist/application/services/intelligent-router.js.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.d.ts +20 -0
- package/dist/application/use-cases/ask-question-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.js +129 -49
- package/dist/application/use-cases/ask-question-use-case.js.map +1 -1
- package/dist/application/use-cases/edit-file-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/edit-file-use-case.js +16 -1
- package/dist/application/use-cases/edit-file-use-case.js.map +1 -1
- package/dist/application/use-cases/planning-use-case.d.ts +14 -1
- package/dist/application/use-cases/planning-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/planning-use-case.js +109 -2
- package/dist/application/use-cases/planning-use-case.js.map +1 -1
- package/dist/domain/entities/documentation.d.ts +35 -0
- package/dist/domain/entities/documentation.d.ts.map +1 -0
- package/dist/domain/entities/documentation.js +6 -0
- package/dist/domain/entities/documentation.js.map +1 -0
- package/dist/domain/entities/memory.d.ts.map +1 -1
- package/dist/domain/entities/product-requirements.d.ts +50 -0
- package/dist/domain/entities/product-requirements.d.ts.map +1 -0
- package/dist/domain/entities/product-requirements.js +6 -0
- package/dist/domain/entities/product-requirements.js.map +1 -0
- package/dist/domain/entities/task.d.ts +152 -0
- package/dist/domain/entities/task.d.ts.map +1 -0
- package/dist/domain/entities/task.js +61 -0
- package/dist/domain/entities/task.js.map +1 -0
- package/dist/domain/errors/embeddings-not-found-error.d.ts +9 -0
- package/dist/domain/errors/embeddings-not-found-error.d.ts.map +1 -0
- package/dist/domain/errors/embeddings-not-found-error.js +13 -0
- package/dist/domain/errors/embeddings-not-found-error.js.map +1 -0
- package/dist/domain/interfaces/agent.interface.d.ts +15 -0
- package/dist/domain/interfaces/agent.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/agent.interface.js +6 -0
- package/dist/domain/interfaces/agent.interface.js.map +1 -0
- package/dist/domain/interfaces/embedding-repository.interface.d.ts +5 -0
- package/dist/domain/interfaces/embedding-repository.interface.d.ts.map +1 -1
- package/dist/domain/services/environment-mode-manager.d.ts +12 -0
- package/dist/domain/services/environment-mode-manager.d.ts.map +1 -0
- package/dist/domain/services/environment-mode-manager.js +22 -0
- package/dist/domain/services/environment-mode-manager.js.map +1 -0
- package/dist/domain/services/query-intent-classifier.d.ts.map +1 -1
- package/dist/domain/services/query-intent-classifier.js +20 -1
- package/dist/domain/services/query-intent-classifier.js.map +1 -1
- package/dist/domain/services/risk-tier-detector.d.ts +17 -0
- package/dist/domain/services/risk-tier-detector.d.ts.map +1 -0
- package/dist/domain/services/risk-tier-detector.js +78 -0
- package/dist/domain/services/risk-tier-detector.js.map +1 -0
- package/dist/embed.d.ts.map +1 -1
- package/dist/embed.js +18 -8
- package/dist/embed.js.map +1 -1
- package/dist/formatter.d.ts.map +1 -1
- package/dist/formatter.js +10 -3
- package/dist/formatter.js.map +1 -1
- package/dist/index.js +494 -167
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.js +19 -6
- package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -1
- package/dist/infrastructure/ai/fake-ai-service.d.ts +22 -0
- package/dist/infrastructure/ai/fake-ai-service.d.ts.map +1 -0
- package/dist/infrastructure/ai/fake-ai-service.js +59 -0
- package/dist/infrastructure/ai/fake-ai-service.js.map +1 -0
- package/dist/infrastructure/ai/provider-ai-service.d.ts +59 -0
- package/dist/infrastructure/ai/provider-ai-service.d.ts.map +1 -0
- package/dist/infrastructure/ai/provider-ai-service.js +477 -0
- package/dist/infrastructure/ai/provider-ai-service.js.map +1 -0
- package/dist/infrastructure/cache/embedding-cache.d.ts +13 -1
- package/dist/infrastructure/cache/embedding-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/embedding-cache.js +80 -9
- package/dist/infrastructure/cache/embedding-cache.js.map +1 -1
- package/dist/infrastructure/cache/query-result-cache.d.ts +14 -55
- package/dist/infrastructure/cache/query-result-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/query-result-cache.js +40 -112
- package/dist/infrastructure/cache/query-result-cache.js.map +1 -1
- package/dist/infrastructure/cache/response-cache.d.ts +18 -0
- package/dist/infrastructure/cache/response-cache.d.ts.map +1 -0
- package/dist/infrastructure/cache/response-cache.js +48 -0
- package/dist/infrastructure/cache/response-cache.js.map +1 -0
- package/dist/infrastructure/cache/security-scan-cache.d.ts +8 -49
- package/dist/infrastructure/cache/security-scan-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/security-scan-cache.js +25 -102
- package/dist/infrastructure/cache/security-scan-cache.js.map +1 -1
- package/dist/infrastructure/completion/bash-completion.d.ts +2 -3
- package/dist/infrastructure/completion/bash-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/bash-completion.js +11 -87
- package/dist/infrastructure/completion/bash-completion.js.map +1 -1
- package/dist/infrastructure/completion/fish-completion.d.ts +2 -3
- package/dist/infrastructure/completion/fish-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/fish-completion.js +15 -58
- package/dist/infrastructure/completion/fish-completion.js.map +1 -1
- package/dist/infrastructure/completion/zsh-completion.d.ts +2 -3
- package/dist/infrastructure/completion/zsh-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/zsh-completion.js +18 -73
- package/dist/infrastructure/completion/zsh-completion.js.map +1 -1
- package/dist/infrastructure/config/config-manager.d.ts +10 -0
- package/dist/infrastructure/config/config-manager.d.ts.map +1 -1
- package/dist/infrastructure/config/config-manager.js +13 -2
- package/dist/infrastructure/config/config-manager.js.map +1 -1
- package/dist/infrastructure/context/conversation-context.d.ts +54 -0
- package/dist/infrastructure/context/conversation-context.d.ts.map +1 -0
- package/dist/infrastructure/context/conversation-context.js +129 -0
- package/dist/infrastructure/context/conversation-context.js.map +1 -0
- package/dist/infrastructure/context/session-manager.d.ts +42 -0
- package/dist/infrastructure/context/session-manager.d.ts.map +1 -0
- package/dist/infrastructure/context/session-manager.js +94 -0
- package/dist/infrastructure/context/session-manager.js.map +1 -0
- package/dist/infrastructure/cost/cost-tracker.d.ts +1 -0
- package/dist/infrastructure/cost/cost-tracker.d.ts.map +1 -1
- package/dist/infrastructure/cost/cost-tracker.js +12 -5
- package/dist/infrastructure/cost/cost-tracker.js.map +1 -1
- package/dist/infrastructure/governance/nist-ai-rmf.d.ts +6 -8
- package/dist/infrastructure/governance/nist-ai-rmf.d.ts.map +1 -1
- package/dist/infrastructure/governance/nist-ai-rmf.js +6 -8
- package/dist/infrastructure/governance/nist-ai-rmf.js.map +1 -1
- package/dist/infrastructure/governance/policy-as-code.d.ts +6 -8
- package/dist/infrastructure/governance/policy-as-code.d.ts.map +1 -1
- package/dist/infrastructure/governance/policy-as-code.js +6 -8
- package/dist/infrastructure/governance/policy-as-code.js.map +1 -1
- package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts +7 -9
- package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts.map +1 -1
- package/dist/infrastructure/governance/prompt-to-code-lineage.js +7 -9
- package/dist/infrastructure/governance/prompt-to-code-lineage.js.map +1 -1
- package/dist/infrastructure/protocols/a2a-metadata.js +1 -1
- package/dist/infrastructure/protocols/mcp-oauth.js +1 -1
- package/dist/infrastructure/providers/cohere-provider.d.ts +39 -0
- package/dist/infrastructure/providers/cohere-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/cohere-provider.js +444 -0
- package/dist/infrastructure/providers/cohere-provider.js.map +1 -0
- package/dist/infrastructure/providers/fake-provider.d.ts +43 -0
- package/dist/infrastructure/providers/fake-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/fake-provider.js +130 -0
- package/dist/infrastructure/providers/fake-provider.js.map +1 -0
- package/dist/infrastructure/providers/local-llm-provider.d.ts +49 -0
- package/dist/infrastructure/providers/local-llm-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/local-llm-provider.js +330 -0
- package/dist/infrastructure/providers/local-llm-provider.js.map +1 -0
- package/dist/infrastructure/providers/model-config.types.d.ts +70 -0
- package/dist/infrastructure/providers/model-config.types.d.ts.map +1 -0
- package/dist/infrastructure/providers/model-config.types.js +9 -0
- package/dist/infrastructure/providers/model-config.types.js.map +1 -0
- package/dist/infrastructure/providers/model-provider.interface.d.ts +113 -0
- package/dist/infrastructure/providers/model-provider.interface.d.ts.map +1 -0
- package/dist/infrastructure/providers/model-provider.interface.js +8 -0
- package/dist/infrastructure/providers/model-provider.interface.js.map +1 -0
- package/dist/infrastructure/providers/openai-provider.d.ts +38 -0
- package/dist/infrastructure/providers/openai-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/openai-provider.js +413 -0
- package/dist/infrastructure/providers/openai-provider.js.map +1 -0
- package/dist/infrastructure/providers/openrouter-provider.d.ts +42 -0
- package/dist/infrastructure/providers/openrouter-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/openrouter-provider.js +401 -0
- package/dist/infrastructure/providers/openrouter-provider.js.map +1 -0
- package/dist/infrastructure/providers/operation-provider-resolver.d.ts +48 -0
- package/dist/infrastructure/providers/operation-provider-resolver.d.ts.map +1 -0
- package/dist/infrastructure/providers/operation-provider-resolver.js +131 -0
- package/dist/infrastructure/providers/operation-provider-resolver.js.map +1 -0
- package/dist/infrastructure/providers/provider-config-loader.d.ts +37 -0
- package/dist/infrastructure/providers/provider-config-loader.d.ts.map +1 -0
- package/dist/infrastructure/providers/provider-config-loader.js +120 -0
- package/dist/infrastructure/providers/provider-config-loader.js.map +1 -0
- package/dist/infrastructure/providers/provider-registry.d.ts +53 -0
- package/dist/infrastructure/providers/provider-registry.d.ts.map +1 -0
- package/dist/infrastructure/providers/provider-registry.js +88 -0
- package/dist/infrastructure/providers/provider-registry.js.map +1 -0
- package/dist/infrastructure/security/input-validator.d.ts.map +1 -1
- package/dist/infrastructure/security/input-validator.js +19 -6
- package/dist/infrastructure/security/input-validator.js.map +1 -1
- package/dist/infrastructure/serialization/toon-serializer.d.ts +45 -0
- package/dist/infrastructure/serialization/toon-serializer.d.ts.map +1 -0
- package/dist/infrastructure/serialization/toon-serializer.js +119 -0
- package/dist/infrastructure/serialization/toon-serializer.js.map +1 -0
- package/dist/infrastructure/storage/embeddings-path.d.ts +18 -0
- package/dist/infrastructure/storage/embeddings-path.d.ts.map +1 -0
- package/dist/infrastructure/storage/embeddings-path.js +37 -0
- package/dist/infrastructure/storage/embeddings-path.js.map +1 -0
- package/dist/infrastructure/storage/plan-repository.d.ts +2 -0
- package/dist/infrastructure/storage/plan-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/plan-repository.js +36 -73
- package/dist/infrastructure/storage/plan-repository.js.map +1 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts +10 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.js +37 -3
- package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +1 -1
- package/dist/infrastructure/storage/task-helpers.d.ts +69 -0
- package/dist/infrastructure/storage/task-helpers.d.ts.map +1 -0
- package/dist/infrastructure/storage/task-helpers.js +197 -0
- package/dist/infrastructure/storage/task-helpers.js.map +1 -0
- package/dist/infrastructure/storage/task-repository.d.ts +68 -0
- package/dist/infrastructure/storage/task-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/task-repository.js +216 -0
- package/dist/infrastructure/storage/task-repository.js.map +1 -0
- package/dist/infrastructure/telemetry/telemetry-service.d.ts +74 -0
- package/dist/infrastructure/telemetry/telemetry-service.d.ts.map +1 -0
- package/dist/infrastructure/telemetry/telemetry-service.js +167 -0
- package/dist/infrastructure/telemetry/telemetry-service.js.map +1 -0
- package/dist/infrastructure/ux/bi-directional-learning.d.ts +22 -0
- package/dist/infrastructure/ux/bi-directional-learning.d.ts.map +1 -1
- package/dist/infrastructure/ux/bi-directional-learning.js +144 -7
- package/dist/infrastructure/ux/bi-directional-learning.js.map +1 -1
- package/dist/infrastructure/ux/capability-boundaries.d.ts +22 -0
- package/dist/infrastructure/ux/capability-boundaries.d.ts.map +1 -0
- package/dist/infrastructure/ux/capability-boundaries.js +42 -0
- package/dist/infrastructure/ux/capability-boundaries.js.map +1 -0
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts +21 -0
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts.map +1 -0
- package/dist/infrastructure/ux/comprehensive-formatter.js +117 -0
- package/dist/infrastructure/ux/comprehensive-formatter.js.map +1 -0
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts +5 -18
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts.map +1 -1
- package/dist/infrastructure/ux/contextual-feature-discovery.js +5 -139
- package/dist/infrastructure/ux/contextual-feature-discovery.js.map +1 -1
- package/dist/infrastructure/ux/feature-discovery.d.ts +3 -33
- package/dist/infrastructure/ux/feature-discovery.d.ts.map +1 -1
- package/dist/infrastructure/ux/feature-discovery.js +5 -181
- package/dist/infrastructure/ux/feature-discovery.js.map +1 -1
- package/dist/infrastructure/ux/feedback-prompt.d.ts +26 -0
- package/dist/infrastructure/ux/feedback-prompt.d.ts.map +1 -0
- package/dist/infrastructure/ux/feedback-prompt.js +45 -0
- package/dist/infrastructure/ux/feedback-prompt.js.map +1 -0
- package/dist/infrastructure/ux/hitl-review-portal.d.ts.map +1 -1
- package/dist/infrastructure/ux/hitl-review-portal.js +4 -1
- package/dist/infrastructure/ux/hitl-review-portal.js.map +1 -1
- package/dist/infrastructure/ux/hitl-validation.d.ts +35 -0
- package/dist/infrastructure/ux/hitl-validation.d.ts.map +1 -1
- package/dist/infrastructure/ux/hitl-validation.js +86 -0
- package/dist/infrastructure/ux/hitl-validation.js.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.d.ts +5 -6
- package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.js +36 -41
- package/dist/infrastructure/ux/progress-indicator.js.map +1 -1
- package/dist/infrastructure/ux/proportional-friction.d.ts +73 -0
- package/dist/infrastructure/ux/proportional-friction.d.ts.map +1 -0
- package/dist/infrastructure/ux/proportional-friction.js +200 -0
- package/dist/infrastructure/ux/proportional-friction.js.map +1 -0
- package/dist/infrastructure/ux/review-checkpoint.d.ts +3 -1
- package/dist/infrastructure/ux/review-checkpoint.d.ts.map +1 -1
- package/dist/infrastructure/ux/review-checkpoint.js +33 -80
- package/dist/infrastructure/ux/review-checkpoint.js.map +1 -1
- package/dist/infrastructure/ux/staged-feature-intro.d.ts +14 -39
- package/dist/infrastructure/ux/staged-feature-intro.d.ts.map +1 -1
- package/dist/infrastructure/ux/staged-feature-intro.js +12 -132
- package/dist/infrastructure/ux/staged-feature-intro.js.map +1 -1
- package/dist/infrastructure/ux/syntax-highlighter.d.ts +1 -2
- package/dist/infrastructure/ux/syntax-highlighter.d.ts.map +1 -1
- package/dist/infrastructure/ux/syntax-highlighter.js +67 -148
- package/dist/infrastructure/ux/syntax-highlighter.js.map +1 -1
- package/dist/infrastructure/validation/agent-feedback.d.ts +51 -0
- package/dist/infrastructure/validation/agent-feedback.d.ts.map +1 -0
- package/dist/infrastructure/validation/agent-feedback.js +55 -0
- package/dist/infrastructure/validation/agent-feedback.js.map +1 -0
- package/dist/infrastructure/validation/agent-validation-helper.d.ts +75 -0
- package/dist/infrastructure/validation/agent-validation-helper.d.ts.map +1 -0
- package/dist/infrastructure/validation/agent-validation-helper.js +137 -0
- package/dist/infrastructure/validation/agent-validation-helper.js.map +1 -0
- package/dist/infrastructure/validation/feedback-stats.d.ts +99 -0
- package/dist/infrastructure/validation/feedback-stats.d.ts.map +1 -0
- package/dist/infrastructure/validation/feedback-stats.js +173 -0
- package/dist/infrastructure/validation/feedback-stats.js.map +1 -0
- package/dist/infrastructure/validation/review-handler.d.ts +26 -0
- package/dist/infrastructure/validation/review-handler.d.ts.map +1 -0
- package/dist/infrastructure/validation/review-handler.js +40 -0
- package/dist/infrastructure/validation/review-handler.js.map +1 -0
- package/dist/infrastructure/validation/summary-aggregator.d.ts +45 -0
- package/dist/infrastructure/validation/summary-aggregator.d.ts.map +1 -0
- package/dist/infrastructure/validation/summary-aggregator.js +70 -0
- package/dist/infrastructure/validation/summary-aggregator.js.map +1 -0
- package/dist/infrastructure/validation/summary-extractor.d.ts +24 -0
- package/dist/infrastructure/validation/summary-extractor.d.ts.map +1 -0
- package/dist/infrastructure/validation/summary-extractor.js +45 -0
- package/dist/infrastructure/validation/summary-extractor.js.map +1 -0
- package/dist/infrastructure/validation/trace-summary.d.ts +45 -0
- package/dist/infrastructure/validation/trace-summary.d.ts.map +1 -0
- package/dist/infrastructure/validation/trace-summary.js +52 -0
- package/dist/infrastructure/validation/trace-summary.js.map +1 -0
- package/dist/infrastructure/validation/trust-config.d.ts +27 -0
- package/dist/infrastructure/validation/trust-config.d.ts.map +1 -0
- package/dist/infrastructure/validation/trust-config.js +113 -0
- package/dist/infrastructure/validation/trust-config.js.map +1 -0
- package/dist/infrastructure/xai/attention-visualizer.d.ts +6 -8
- package/dist/infrastructure/xai/attention-visualizer.d.ts.map +1 -1
- package/dist/infrastructure/xai/attention-visualizer.js +6 -8
- package/dist/infrastructure/xai/attention-visualizer.js.map +1 -1
- package/dist/infrastructure/xai/cot-visualizer.d.ts +6 -9
- package/dist/infrastructure/xai/cot-visualizer.d.ts.map +1 -1
- package/dist/infrastructure/xai/cot-visualizer.js +6 -9
- package/dist/infrastructure/xai/cot-visualizer.js.map +1 -1
- package/dist/infrastructure/xai/decision-tree-log.d.ts +6 -10
- package/dist/infrastructure/xai/decision-tree-log.d.ts.map +1 -1
- package/dist/infrastructure/xai/decision-tree-log.js +6 -10
- package/dist/infrastructure/xai/decision-tree-log.js.map +1 -1
- package/dist/infrastructure/xai/interactive-xai.d.ts +6 -8
- package/dist/infrastructure/xai/interactive-xai.d.ts.map +1 -1
- package/dist/infrastructure/xai/interactive-xai.js +6 -8
- package/dist/infrastructure/xai/interactive-xai.js.map +1 -1
- package/dist/infrastructure/xai/uncertainty-quantifier.d.ts +6 -9
- package/dist/infrastructure/xai/uncertainty-quantifier.d.ts.map +1 -1
- package/dist/infrastructure/xai/uncertainty-quantifier.js +6 -9
- package/dist/infrastructure/xai/uncertainty-quantifier.js.map +1 -1
- package/dist/monitoring.d.ts +1 -1
- package/dist/monitoring.d.ts.map +1 -1
- package/dist/monitoring.js +12 -9
- package/dist/monitoring.js.map +1 -1
- package/dist/parallel-processor.d.ts.map +1 -1
- package/dist/parallel-processor.js +124 -45
- package/dist/parallel-processor.js.map +1 -1
- package/dist/presentation/cli/commands/ask-command.d.ts +2 -0
- package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/ask-command.js +356 -87
- package/dist/presentation/cli/commands/ask-command.js.map +1 -1
- package/dist/presentation/cli/commands/config-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/config-command.js +22 -8
- package/dist/presentation/cli/commands/config-command.js.map +1 -1
- package/dist/presentation/cli/commands/decision-command.js +23 -6
- package/dist/presentation/cli/commands/decision-command.js.map +1 -1
- package/dist/presentation/cli/commands/docs-command.d.ts +14 -0
- package/dist/presentation/cli/commands/docs-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/docs-command.js +25 -0
- package/dist/presentation/cli/commands/docs-command.js.map +1 -0
- package/dist/presentation/cli/commands/fix-command.d.ts +10 -0
- package/dist/presentation/cli/commands/fix-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/fix-command.js +94 -0
- package/dist/presentation/cli/commands/fix-command.js.map +1 -0
- package/dist/presentation/cli/commands/help-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/help-command.js +23 -1
- package/dist/presentation/cli/commands/help-command.js.map +1 -1
- package/dist/presentation/cli/commands/memory-command.d.ts +17 -0
- package/dist/presentation/cli/commands/memory-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/memory-command.js +252 -0
- package/dist/presentation/cli/commands/memory-command.js.map +1 -0
- package/dist/presentation/cli/commands/models-command.d.ts +13 -0
- package/dist/presentation/cli/commands/models-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/models-command.js +194 -0
- package/dist/presentation/cli/commands/models-command.js.map +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts +2 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/orchestrate-command.js +182 -14
- package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -1
- package/dist/presentation/cli/commands/plan-command.d.ts +2 -0
- package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/plan-command.js +212 -26
- package/dist/presentation/cli/commands/plan-command.js.map +1 -1
- package/dist/presentation/cli/commands/product-command.d.ts +14 -0
- package/dist/presentation/cli/commands/product-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/product-command.js +22 -0
- package/dist/presentation/cli/commands/product-command.js.map +1 -0
- package/dist/presentation/cli/commands/react-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/react-command.js +8 -2
- package/dist/presentation/cli/commands/react-command.js.map +1 -1
- package/dist/presentation/cli/commands/review-command.d.ts +14 -0
- package/dist/presentation/cli/commands/review-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/review-command.js +173 -0
- package/dist/presentation/cli/commands/review-command.js.map +1 -0
- package/dist/presentation/cli/commands/run-command.d.ts +13 -0
- package/dist/presentation/cli/commands/run-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/run-command.js +188 -0
- package/dist/presentation/cli/commands/run-command.js.map +1 -0
- package/dist/presentation/cli/commands/setup-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/setup-command.js +15 -0
- package/dist/presentation/cli/commands/setup-command.js.map +1 -1
- package/dist/presentation/cli/commands/smart-command.d.ts +3 -1
- package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/smart-command.js +165 -11
- package/dist/presentation/cli/commands/smart-command.js.map +1 -1
- package/dist/presentation/cli/commands/status-command.d.ts +14 -0
- package/dist/presentation/cli/commands/status-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/status-command.js +171 -0
- package/dist/presentation/cli/commands/status-command.js.map +1 -0
- package/dist/presentation/cli/commands/suggest-command.d.ts +11 -0
- package/dist/presentation/cli/commands/suggest-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/suggest-command.js +138 -0
- package/dist/presentation/cli/commands/suggest-command.js.map +1 -0
- package/dist/presentation/cli/error-display.d.ts.map +1 -1
- package/dist/presentation/cli/error-display.js +118 -17
- package/dist/presentation/cli/error-display.js.map +1 -1
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +6 -1
- package/dist/search.js.map +1 -1
- package/dist/session.d.ts +1 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +69 -4
- package/dist/session.js.map +1 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +3 -0
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/git-tool.js +7 -7
- package/dist/tools/git-tool.js.map +1 -1
- package/dist/ui.d.ts +11 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +62 -6
- package/dist/ui.js.map +1 -1
- package/package.json +22 -4
package/dist/index.js
CHANGED
|
@@ -3,11 +3,12 @@ import { Command } from 'commander';
|
|
|
3
3
|
import { config } from 'dotenv';
|
|
4
4
|
import { join, dirname } from 'path';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
|
+
import { existsSync } from 'fs';
|
|
6
7
|
import { indexRepositoryParallel } from './embed.js';
|
|
7
|
-
import { generateAndApplyEdit } from './edit.js';
|
|
8
8
|
import { executeAskCommand } from './presentation/cli/commands/ask-command.js';
|
|
9
9
|
import { executeReactCommand } from './presentation/cli/commands/react-command.js';
|
|
10
10
|
import { executeSmartCommand } from './presentation/cli/commands/smart-command.js';
|
|
11
|
+
import { executeFixCommand } from './presentation/cli/commands/fix-command.js';
|
|
11
12
|
import { executeSetupCommand } from './presentation/cli/commands/setup-command.js';
|
|
12
13
|
import { executeConfigCommand } from './presentation/cli/commands/config-command.js';
|
|
13
14
|
import { executeHelpCommand } from './presentation/cli/commands/help-command.js';
|
|
@@ -17,21 +18,29 @@ import { refactorMultiFile, findFilesByPattern } from './refactor.js';
|
|
|
17
18
|
import { getGitStatus, formatGitStatus, getAllGitDiffs, analyzeDiff, getGitDiff } from './git.js';
|
|
18
19
|
import { executePlanCommand } from './presentation/cli/commands/plan-command.js';
|
|
19
20
|
import { executeOrchestrateCommand } from './presentation/cli/commands/orchestrate-command.js';
|
|
21
|
+
import { executeDocsCommand } from './presentation/cli/commands/docs-command.js';
|
|
22
|
+
import { executeProductCommand } from './presentation/cli/commands/product-command.js';
|
|
23
|
+
import { executeStatusCommand } from './presentation/cli/commands/status-command.js';
|
|
24
|
+
import { executeSuggestCommand } from './presentation/cli/commands/suggest-command.js';
|
|
25
|
+
import { executeRunCommand } from './presentation/cli/commands/run-command.js';
|
|
26
|
+
import { executeModelsCommand } from './presentation/cli/commands/models-command.js';
|
|
27
|
+
import { executeReviewCommand } from './presentation/cli/commands/review-command.js';
|
|
20
28
|
import { executeDecisionCommand } from './presentation/cli/commands/decision-command.js';
|
|
21
29
|
import { executeKnowledgeCommand } from './presentation/cli/commands/knowledge-command.js';
|
|
22
30
|
import { executeLearningDashboardCommand } from './presentation/cli/commands/learning-dashboard-command.js';
|
|
23
31
|
import { executeTraceCommand } from './presentation/cli/commands/trace-command.js';
|
|
24
32
|
import { executeUndoCommand } from './presentation/cli/commands/undo-command.js';
|
|
33
|
+
import { executeMemoryCommand } from './presentation/cli/commands/memory-command.js';
|
|
25
34
|
import { reviewFile, formatReview } from './review.js';
|
|
26
35
|
import { formatLearningInsights, getPerformanceInsights } from './learning.js';
|
|
27
36
|
import { getCacheStats, clearAllCaches } from './cache.js';
|
|
28
37
|
import { planMigration, formatMigrationPlan } from './migrate.js';
|
|
29
|
-
import { generateFileDocs, generateREADME, updateDocs, saveDocs } from './docs.js';
|
|
30
38
|
import { generateTests, getTestFilePath, saveTests, improveTests } from './testgen.js';
|
|
31
39
|
import { startSession } from './session.js';
|
|
32
40
|
import { cleanResponse } from './formatter.js';
|
|
33
41
|
import { displayError } from './presentation/cli/error-display.js';
|
|
34
|
-
import {
|
|
42
|
+
import { getTelemetryService } from './infrastructure/telemetry/telemetry-service.js';
|
|
43
|
+
import { colors, createSpinner, createBanner, createTable, success, error, warning, info, formatPath, formatNumber, sectionHeader, newline, createWelcomeMessage, isMinimalStyle, printMinimalHeader, } from './ui.js';
|
|
35
44
|
// Load environment variables - try agent directory first, then current directory
|
|
36
45
|
try {
|
|
37
46
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -60,7 +69,8 @@ program
|
|
|
60
69
|
// Smart routing: if query provided as argument, route intelligently
|
|
61
70
|
program
|
|
62
71
|
.argument('[query]', 'Your query - Codehere will understand what you need')
|
|
63
|
-
.
|
|
72
|
+
.option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
|
|
73
|
+
.action(async (query, options) => {
|
|
64
74
|
if (query && query.trim()) {
|
|
65
75
|
// Direct query - use intelligent router
|
|
66
76
|
initLogFile();
|
|
@@ -77,7 +87,8 @@ program
|
|
|
77
87
|
process.exit(1);
|
|
78
88
|
}
|
|
79
89
|
try {
|
|
80
|
-
|
|
90
|
+
const opts = program.opts();
|
|
91
|
+
await executeSmartCommand(query.trim(), { review: opts.review || false });
|
|
81
92
|
logEntry({
|
|
82
93
|
timestamp: new Date().toISOString(),
|
|
83
94
|
command: 'smart',
|
|
@@ -129,6 +140,90 @@ program
|
|
|
129
140
|
.action(async (action, key, value) => {
|
|
130
141
|
await executeConfigCommand(action, key, value);
|
|
131
142
|
});
|
|
143
|
+
program
|
|
144
|
+
.command('models')
|
|
145
|
+
.description('List, search, and get info about available AI models')
|
|
146
|
+
.option('-l, --list', 'List all available models')
|
|
147
|
+
.option('-s, --search <query>', 'Search models by name or ID')
|
|
148
|
+
.option('-i, --info <model-id>', 'Get detailed info about a specific model')
|
|
149
|
+
.option('-p, --provider <provider>', 'Filter by provider (cohere, openai, openrouter, etc.)')
|
|
150
|
+
.option('--json', 'Output in JSON format')
|
|
151
|
+
.action(async (options) => {
|
|
152
|
+
initLogFile();
|
|
153
|
+
try {
|
|
154
|
+
await executeModelsCommand({
|
|
155
|
+
list: options.list,
|
|
156
|
+
search: options.search,
|
|
157
|
+
info: options.info,
|
|
158
|
+
provider: options.provider,
|
|
159
|
+
json: options.json,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
catch (err) {
|
|
163
|
+
console.error(error('Error:'), err instanceof Error ? err.message : String(err));
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
program
|
|
168
|
+
.command('telemetry')
|
|
169
|
+
.description('Manage telemetry settings (opt-in, privacy-first)')
|
|
170
|
+
.option('--enable', 'Enable telemetry')
|
|
171
|
+
.option('--disable', 'Disable telemetry')
|
|
172
|
+
.option('--status', 'Show telemetry status')
|
|
173
|
+
.action(async (options) => {
|
|
174
|
+
const telemetry = getTelemetryService();
|
|
175
|
+
if (options.enable) {
|
|
176
|
+
telemetry.enable();
|
|
177
|
+
console.log(success('Telemetry enabled. Thank you for helping improve Codehere!'));
|
|
178
|
+
console.log(colors.dim('Data is anonymized and no code/content is transmitted.'));
|
|
179
|
+
newline();
|
|
180
|
+
}
|
|
181
|
+
else if (options.disable) {
|
|
182
|
+
telemetry.disable();
|
|
183
|
+
console.log(success('Telemetry disabled.'));
|
|
184
|
+
newline();
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
console.log(colors.bold('Telemetry Status:'));
|
|
188
|
+
newline();
|
|
189
|
+
console.log(telemetry.isEnabled()
|
|
190
|
+
? success('Enabled (opt-in)')
|
|
191
|
+
: colors.dim('Disabled (set --enable to opt-in)'));
|
|
192
|
+
newline();
|
|
193
|
+
console.log(colors.dim('Telemetry helps us understand usage patterns and improve Codehere.'));
|
|
194
|
+
console.log(colors.dim('All data is anonymized. No code or content is transmitted.'));
|
|
195
|
+
console.log(colors.dim('Enable with: codehere telemetry --enable'));
|
|
196
|
+
newline();
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
program
|
|
200
|
+
.command('memory')
|
|
201
|
+
.description('View and manage Codehere\'s operation history (XAI: See what Codehere remembers)')
|
|
202
|
+
.option('-l, --list', 'List all memories')
|
|
203
|
+
.option('-s, --search <term>', 'Search memories by description or type')
|
|
204
|
+
.option('--stats', 'Show memory statistics')
|
|
205
|
+
.option('--clear', 'Clear memories (requires --confirm)')
|
|
206
|
+
.option('--limit <number>', 'Limit number of results (default: 20)')
|
|
207
|
+
.option('--type <type>', 'Filter by memory type (observation, reflection, plan)')
|
|
208
|
+
.option('--json', 'Output in JSON format')
|
|
209
|
+
.action(async (options) => {
|
|
210
|
+
initLogFile();
|
|
211
|
+
try {
|
|
212
|
+
await executeMemoryCommand({
|
|
213
|
+
list: options.list,
|
|
214
|
+
search: options.search,
|
|
215
|
+
stats: options.stats,
|
|
216
|
+
clear: options.clear,
|
|
217
|
+
limit: options.limit ? parseInt(options.limit, 10) : undefined,
|
|
218
|
+
type: options.type,
|
|
219
|
+
json: options.json,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
catch (err) {
|
|
223
|
+
displayError(err, { operation: 'memory' });
|
|
224
|
+
process.exit(1);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
132
227
|
program
|
|
133
228
|
.command('help')
|
|
134
229
|
.description('Show help for commands')
|
|
@@ -142,7 +237,8 @@ program
|
|
|
142
237
|
.option('-r, --repo <path>', 'Repository path (default: current directory)')
|
|
143
238
|
.action(async (options) => {
|
|
144
239
|
initLogFile();
|
|
145
|
-
|
|
240
|
+
// Allow fake AI for testing, or require real API key
|
|
241
|
+
if (!process.env.COHERE_API_KEY && process.env.CODEHERE_FAKE_AI !== '1') {
|
|
146
242
|
newline();
|
|
147
243
|
console.error(error('COHERE_API_KEY not found in environment'));
|
|
148
244
|
newline();
|
|
@@ -151,12 +247,20 @@ program
|
|
|
151
247
|
console.log(' 2. Create a .env file in your project root:');
|
|
152
248
|
console.log(colors.cyan(' echo "COHERE_API_KEY=your_key_here" > .env'));
|
|
153
249
|
console.log(' 3. Run the command again');
|
|
250
|
+
console.log('');
|
|
251
|
+
console.log(colors.dim('Note: For testing without API calls, set CODEHERE_FAKE_AI=1'));
|
|
154
252
|
newline();
|
|
155
253
|
process.exit(1);
|
|
156
254
|
}
|
|
157
255
|
try {
|
|
158
|
-
|
|
159
|
-
|
|
256
|
+
if (isMinimalStyle()) {
|
|
257
|
+
console.log(colors.cyan('Indexing codebase...'));
|
|
258
|
+
newline();
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
console.log(createBanner('Indexing Repository', 'Building semantic search index'));
|
|
262
|
+
newline();
|
|
263
|
+
}
|
|
160
264
|
const repoPath = options.repo || process.cwd();
|
|
161
265
|
// NEW: Use parallel indexing with caching
|
|
162
266
|
await indexRepositoryParallel(repoPath, {
|
|
@@ -169,10 +273,32 @@ program
|
|
|
169
273
|
policyStatus: 'allowed',
|
|
170
274
|
});
|
|
171
275
|
newline();
|
|
172
|
-
|
|
276
|
+
if (isMinimalStyle()) {
|
|
277
|
+
console.log(success('Indexing complete. Cache written to .codehere-cache/'));
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
console.log(success('Indexing complete!'));
|
|
281
|
+
}
|
|
282
|
+
process.exit(0);
|
|
173
283
|
}
|
|
174
284
|
catch (err) {
|
|
175
|
-
|
|
285
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
286
|
+
// Check for 401 Unauthorized errors
|
|
287
|
+
if (errorMessage.includes('401') || errorMessage.includes('Unauthorized') || errorMessage.includes('no api key')) {
|
|
288
|
+
newline();
|
|
289
|
+
console.error(error('Authentication failed: Invalid or missing API key'));
|
|
290
|
+
newline();
|
|
291
|
+
console.log(colors.bold('Troubleshooting:'));
|
|
292
|
+
console.log(' 1. Verify your COHERE_API_KEY is set correctly:');
|
|
293
|
+
console.log(colors.cyan(' echo $COHERE_API_KEY'));
|
|
294
|
+
console.log(' 2. Check if the key is valid at: https://dashboard.cohere.com/api-keys');
|
|
295
|
+
console.log(' 3. If using a .env file, ensure it\'s loaded (e.g., use dotenv)');
|
|
296
|
+
console.log(' 4. For testing, you can use: CODEHERE_FAKE_AI=1 codehere index');
|
|
297
|
+
newline();
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
console.error(error('Error indexing repository:'), errorMessage);
|
|
301
|
+
}
|
|
176
302
|
process.exit(1);
|
|
177
303
|
}
|
|
178
304
|
});
|
|
@@ -181,22 +307,28 @@ program
|
|
|
181
307
|
.description('Ask questions about your codebase using semantic search')
|
|
182
308
|
.argument('<question>', 'The question to ask about your code')
|
|
183
309
|
.alias('q')
|
|
310
|
+
.option('--explain', 'Show explainable AI (XAI) reasoning steps')
|
|
311
|
+
.option('--json', 'Output in JSON format')
|
|
184
312
|
.addHelpText('after', `
|
|
185
313
|
Examples:
|
|
186
314
|
$ codehere ask "How does authentication work?"
|
|
187
|
-
$ codehere ask "Where is the user login function?"
|
|
315
|
+
$ codehere ask "Where is the user login function?" --explain
|
|
188
316
|
$ codehere q "Explain the database schema"
|
|
189
317
|
|
|
190
318
|
This command will:
|
|
191
319
|
• Search your indexed codebase for relevant code
|
|
192
320
|
• Use AI to generate a contextual answer
|
|
193
321
|
• Show which files were used as context
|
|
322
|
+
• Use memories from past interactions (XAI: visible with --explain)
|
|
323
|
+
|
|
324
|
+
Options:
|
|
325
|
+
--explain Show explainable AI (XAI) reasoning steps
|
|
194
326
|
|
|
195
327
|
Make sure to run "codehere index" first!
|
|
196
328
|
`)
|
|
197
|
-
.action(async (question) => {
|
|
329
|
+
.action(async (question, options) => {
|
|
198
330
|
initLogFile();
|
|
199
|
-
if (!process.env.COHERE_API_KEY) {
|
|
331
|
+
if (!process.env.COHERE_API_KEY && process.env.CODEHERE_FAKE_AI !== '1') {
|
|
200
332
|
newline();
|
|
201
333
|
console.error(error('COHERE_API_KEY not found in environment'));
|
|
202
334
|
newline();
|
|
@@ -209,21 +341,7 @@ Make sure to run "codehere index" first!
|
|
|
209
341
|
process.exit(1);
|
|
210
342
|
}
|
|
211
343
|
try {
|
|
212
|
-
|
|
213
|
-
newline();
|
|
214
|
-
// Display query
|
|
215
|
-
console.log(colors.bold('Query:'));
|
|
216
|
-
console.log(colors.cyan(' ' + question));
|
|
217
|
-
newline();
|
|
218
|
-
// Use clean architecture
|
|
219
|
-
const searchSpinner = createSpinner('Searching codebase...');
|
|
220
|
-
searchSpinner.start();
|
|
221
|
-
try {
|
|
222
|
-
await executeAskCommand(question);
|
|
223
|
-
}
|
|
224
|
-
finally {
|
|
225
|
-
searchSpinner.stop();
|
|
226
|
-
}
|
|
344
|
+
await executeAskCommand(question, { explain: options?.explain, json: options?.json });
|
|
227
345
|
logEntry({
|
|
228
346
|
timestamp: new Date().toISOString(),
|
|
229
347
|
command: 'ask',
|
|
@@ -232,7 +350,12 @@ Make sure to run "codehere index" first!
|
|
|
232
350
|
});
|
|
233
351
|
}
|
|
234
352
|
catch (err) {
|
|
235
|
-
|
|
353
|
+
const errMessage = err instanceof Error ? err.message : String(err);
|
|
354
|
+
// If it's a missing embeddings error, exit with 1
|
|
355
|
+
if (errMessage.includes('No embeddings found')) {
|
|
356
|
+
process.exit(1);
|
|
357
|
+
}
|
|
358
|
+
console.error(error('Error:'), errMessage);
|
|
236
359
|
process.exit(1);
|
|
237
360
|
}
|
|
238
361
|
});
|
|
@@ -242,10 +365,11 @@ program
|
|
|
242
365
|
.argument('<file>', 'Path to the file to edit')
|
|
243
366
|
.argument('<instruction>', 'Natural language instruction for the edit')
|
|
244
367
|
.alias('edit')
|
|
368
|
+
.option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
|
|
245
369
|
.addHelpText('after', `
|
|
246
370
|
Examples:
|
|
247
371
|
$ codehere fix src/auth.ts "Add error handling for invalid tokens"
|
|
248
|
-
$ codehere fix utils/helpers.js "Rename function foo() to bar()"
|
|
372
|
+
$ codehere fix utils/helpers.js "Rename function foo() to bar()" --review
|
|
249
373
|
$ codehere edit app.js "Add input validation"
|
|
250
374
|
|
|
251
375
|
This command will:
|
|
@@ -254,12 +378,15 @@ This command will:
|
|
|
254
378
|
• Apply the changes to your file
|
|
255
379
|
• Log the operation for audit
|
|
256
380
|
|
|
381
|
+
Options:
|
|
382
|
+
--review Enable review & feedback capture (used for trust scoring and Validation Mode)
|
|
383
|
+
|
|
257
384
|
Safety policies:
|
|
258
385
|
• Maximum 50 lines changed per edit
|
|
259
386
|
• Cannot edit files in restricted folders (infra/, billing/)
|
|
260
387
|
• Only one file can be edited at a time
|
|
261
388
|
`)
|
|
262
|
-
.action(async (file, instruction) => {
|
|
389
|
+
.action(async (file, instruction, options) => {
|
|
263
390
|
initLogFile();
|
|
264
391
|
if (!process.env.COHERE_API_KEY) {
|
|
265
392
|
newline();
|
|
@@ -274,93 +401,31 @@ Safety policies:
|
|
|
274
401
|
process.exit(1);
|
|
275
402
|
}
|
|
276
403
|
try {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
// Generate diff with spinner
|
|
284
|
-
const diffSpinner = createSpinner('Generating code changes...');
|
|
285
|
-
diffSpinner.start();
|
|
286
|
-
// Check if file exists
|
|
287
|
-
const { existsSync } = await import('fs');
|
|
288
|
-
const fullPath = join(process.cwd(), file);
|
|
289
|
-
if (!existsSync(fullPath)) {
|
|
290
|
-
diffSpinner.stop();
|
|
291
|
-
displayError(new Error(`File not found: ${file}`), {
|
|
292
|
-
operation: 'edit',
|
|
293
|
-
query: instruction,
|
|
294
|
-
filepath: file,
|
|
295
|
-
showSuggestions: true,
|
|
296
|
-
});
|
|
297
|
-
console.log(info(`Looking for: ${fullPath}`));
|
|
298
|
-
console.log(info('Tip: Use a relative path from your current directory'));
|
|
299
|
-
newline();
|
|
300
|
-
process.exit(1);
|
|
301
|
-
}
|
|
302
|
-
const result = await generateAndApplyEdit(file, instruction);
|
|
303
|
-
diffSpinner.stop();
|
|
304
|
-
if (result.success) {
|
|
305
|
-
newline();
|
|
306
|
-
// Policy check display
|
|
307
|
-
if (result.policyResult) {
|
|
308
|
-
sectionHeader('Policy Check');
|
|
309
|
-
const policyTable = createTable(['Check', 'Status'], [
|
|
310
|
-
['Line Limit (≤50)', result.policyResult.allowed ? statusIndicator('success') + ' Passed' : statusIndicator('error') + ' Failed'],
|
|
311
|
-
['Restricted Folders', result.policyResult.allowed ? statusIndicator('success') + ' Passed' : statusIndicator('error') + ' Failed'],
|
|
312
|
-
['Single File Only', result.policyResult.allowed ? statusIndicator('success') + ' Passed' : statusIndicator('error') + ' Failed'],
|
|
313
|
-
]);
|
|
314
|
-
console.log(policyTable.toString());
|
|
404
|
+
// Check if embeddings exist for this repository (skip check if using fake AI for testing)
|
|
405
|
+
if (process.env.CODEHERE_FAKE_AI !== '1') {
|
|
406
|
+
const { container } = await import('./application/services/dependency-container.js');
|
|
407
|
+
const embeddingRepo = container.getEmbeddingRepository(process.cwd());
|
|
408
|
+
const hasEmbeddings = await embeddingRepo.hasEmbeddings();
|
|
409
|
+
if (!hasEmbeddings) {
|
|
315
410
|
newline();
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
['Lines Removed', formatNumber(result.diffStats.linesRemoved)],
|
|
323
|
-
['Total Changes', formatNumber(result.diffStats.linesAdded + result.diffStats.linesRemoved)],
|
|
324
|
-
['Files Changed', formatNumber(result.diffStats.filesChanged)],
|
|
325
|
-
]);
|
|
326
|
-
console.log(statsTable.toString());
|
|
411
|
+
console.error(colors.red('No embeddings found for this repository.'));
|
|
412
|
+
newline();
|
|
413
|
+
console.log('Run:');
|
|
414
|
+
console.log(colors.cyan(' codehere index'));
|
|
415
|
+
console.log('');
|
|
416
|
+
console.log('then re-run this command.');
|
|
327
417
|
newline();
|
|
418
|
+
process.exit(1);
|
|
328
419
|
}
|
|
329
|
-
console.log(success('Edit applied successfully'));
|
|
330
|
-
logEntry({
|
|
331
|
-
timestamp: new Date().toISOString(),
|
|
332
|
-
command: 'fix',
|
|
333
|
-
query: instruction,
|
|
334
|
-
filepath: file,
|
|
335
|
-
diffStats: result.diffStats,
|
|
336
|
-
policyStatus: result.policyResult?.allowed ? 'allowed' : 'rejected',
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
// Use centralized error display
|
|
341
|
-
const errorMessage = result.policyResult && !result.policyResult.allowed
|
|
342
|
-
? result.policyResult.reason || 'Policy check failed'
|
|
343
|
-
: result.error || 'Edit failed';
|
|
344
|
-
const policyError = result.policyResult && !result.policyResult.allowed
|
|
345
|
-
? new Error(`Policy check failed: ${result.policyResult.reason || 'Unknown reason'}`)
|
|
346
|
-
: new Error(`Edit failed: ${result.error || 'Unknown error'}`);
|
|
347
|
-
logEntry({
|
|
348
|
-
timestamp: new Date().toISOString(),
|
|
349
|
-
command: 'fix',
|
|
350
|
-
query: instruction,
|
|
351
|
-
filepath: file,
|
|
352
|
-
diffStats: result.diffStats,
|
|
353
|
-
policyStatus: 'rejected',
|
|
354
|
-
policyReason: result.error,
|
|
355
|
-
});
|
|
356
|
-
displayError(policyError, {
|
|
357
|
-
operation: 'edit',
|
|
358
|
-
query: instruction,
|
|
359
|
-
filepath: file,
|
|
360
|
-
showSuggestions: true,
|
|
361
|
-
});
|
|
362
|
-
process.exit(1);
|
|
363
420
|
}
|
|
421
|
+
await executeFixCommand(file, instruction, { review: options?.review });
|
|
422
|
+
logEntry({
|
|
423
|
+
timestamp: new Date().toISOString(),
|
|
424
|
+
command: 'fix',
|
|
425
|
+
query: instruction,
|
|
426
|
+
filepath: file,
|
|
427
|
+
policyStatus: 'allowed',
|
|
428
|
+
});
|
|
364
429
|
}
|
|
365
430
|
catch (err) {
|
|
366
431
|
displayError(err, {
|
|
@@ -403,8 +468,30 @@ This command will:
|
|
|
403
468
|
process.exit(1);
|
|
404
469
|
}
|
|
405
470
|
try {
|
|
406
|
-
|
|
407
|
-
|
|
471
|
+
// Check if embeddings exist for this repository (skip check if using fake AI for testing)
|
|
472
|
+
if (process.env.CODEHERE_FAKE_AI !== '1') {
|
|
473
|
+
const { container } = await import('./application/services/dependency-container.js');
|
|
474
|
+
const embeddingRepo = container.getEmbeddingRepository(process.cwd());
|
|
475
|
+
const hasEmbeddings = await embeddingRepo.hasEmbeddings();
|
|
476
|
+
if (!hasEmbeddings) {
|
|
477
|
+
newline();
|
|
478
|
+
console.error(colors.red('No embeddings found for this repository.'));
|
|
479
|
+
newline();
|
|
480
|
+
console.log('Run:');
|
|
481
|
+
console.log(colors.cyan(' codehere index'));
|
|
482
|
+
console.log('');
|
|
483
|
+
console.log('then re-run this command.');
|
|
484
|
+
newline();
|
|
485
|
+
process.exit(1);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (isMinimalStyle()) {
|
|
489
|
+
printMinimalHeader('explain', file);
|
|
490
|
+
}
|
|
491
|
+
else {
|
|
492
|
+
console.log(createBanner('Explain File', 'AI-powered code explanation'));
|
|
493
|
+
newline();
|
|
494
|
+
}
|
|
408
495
|
const fullPath = join(process.cwd(), file);
|
|
409
496
|
// Check if file exists
|
|
410
497
|
const { existsSync } = await import('fs');
|
|
@@ -454,9 +541,14 @@ program
|
|
|
454
541
|
.option('-m, --metrics', 'Show detailed metrics')
|
|
455
542
|
.action((options) => {
|
|
456
543
|
const health = performHealthCheck();
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
544
|
+
if (isMinimalStyle()) {
|
|
545
|
+
printMinimalHeader('health', '');
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
newline();
|
|
549
|
+
console.log(createBanner('System Health', 'Enterprise monitoring'));
|
|
550
|
+
newline();
|
|
551
|
+
}
|
|
460
552
|
console.log(formatHealthStatus(health));
|
|
461
553
|
if (options.metrics) {
|
|
462
554
|
newline();
|
|
@@ -557,13 +649,13 @@ program
|
|
|
557
649
|
}
|
|
558
650
|
});
|
|
559
651
|
program
|
|
560
|
-
.command('review')
|
|
652
|
+
.command('git-review')
|
|
561
653
|
.description('Review git changes and suggest improvements')
|
|
562
654
|
.option('-f, --file <file>', 'Review specific file')
|
|
563
655
|
.action((options) => {
|
|
564
656
|
initLogFile();
|
|
565
657
|
try {
|
|
566
|
-
console.log(createBanner('
|
|
658
|
+
console.log(createBanner('Git Review', 'Git-aware code analysis'));
|
|
567
659
|
newline();
|
|
568
660
|
const status = getGitStatus();
|
|
569
661
|
if (!status.isRepo) {
|
|
@@ -612,6 +704,8 @@ program
|
|
|
612
704
|
.description('Plan a complex multi-step task')
|
|
613
705
|
.argument('<instruction>', 'Complex instruction to plan')
|
|
614
706
|
.option('-e, --execute', 'Execute the plan after creating it')
|
|
707
|
+
.option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
|
|
708
|
+
.option('--json', 'Output in JSON format')
|
|
615
709
|
.action(async (instruction, options) => {
|
|
616
710
|
initLogFile();
|
|
617
711
|
if (!process.env.COHERE_API_KEY) {
|
|
@@ -619,12 +713,20 @@ program
|
|
|
619
713
|
process.exit(1);
|
|
620
714
|
}
|
|
621
715
|
try {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
716
|
+
// Suppress header in JSON mode
|
|
717
|
+
if (!options.json) {
|
|
718
|
+
if (isMinimalStyle()) {
|
|
719
|
+
printMinimalHeader('plan', instruction);
|
|
720
|
+
}
|
|
721
|
+
else {
|
|
722
|
+
console.log(createBanner('Task Planning', 'Intelligent multi-step execution'));
|
|
723
|
+
newline();
|
|
724
|
+
console.log(colors.bold('Instruction:') + ' ' + colors.cyan(instruction));
|
|
725
|
+
}
|
|
726
|
+
newline();
|
|
727
|
+
}
|
|
626
728
|
// Use new memory-based planning
|
|
627
|
-
await executePlanCommand(instruction, { execute: options.execute });
|
|
729
|
+
await executePlanCommand(instruction, { execute: options.execute, review: options.review, json: options.json });
|
|
628
730
|
}
|
|
629
731
|
catch (err) {
|
|
630
732
|
console.error(error('Error:'), err instanceof Error ? err.message : String(err));
|
|
@@ -703,24 +805,38 @@ program
|
|
|
703
805
|
process.exit(1);
|
|
704
806
|
}
|
|
705
807
|
try {
|
|
706
|
-
|
|
707
|
-
|
|
808
|
+
if (isMinimalStyle()) {
|
|
809
|
+
console.log(colors.bold(`Review: ${file}`));
|
|
810
|
+
newline();
|
|
811
|
+
}
|
|
812
|
+
else {
|
|
813
|
+
console.log(createBanner('Code Review', 'Automated senior-level analysis'));
|
|
814
|
+
newline();
|
|
815
|
+
}
|
|
708
816
|
const reviewSpinner = createSpinner('Reviewing code...');
|
|
709
817
|
reviewSpinner.start();
|
|
710
818
|
const review = await reviewFile(file);
|
|
711
819
|
reviewSpinner.stop();
|
|
712
820
|
newline();
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
821
|
+
if (isMinimalStyle()) {
|
|
822
|
+
console.log(colors.bold('Findings:'));
|
|
823
|
+
console.log(formatReview(review));
|
|
824
|
+
newline();
|
|
825
|
+
console.log(colors.dim(`Score: ${review.score}/100`));
|
|
826
|
+
}
|
|
827
|
+
else {
|
|
828
|
+
console.log(formatReview(review));
|
|
829
|
+
// Display score
|
|
830
|
+
newline();
|
|
831
|
+
sectionHeader('Review Score');
|
|
832
|
+
const scoreTable = createTable(['Metric', 'Value'], [
|
|
833
|
+
['Overall Score', `${review.score}/100`],
|
|
834
|
+
['Errors', formatNumber(review.issues.filter(i => i.severity === 'error').length)],
|
|
835
|
+
['Warnings', formatNumber(review.issues.filter(i => i.severity === 'warning').length)],
|
|
836
|
+
['Info', formatNumber(review.issues.filter(i => i.severity === 'info').length)],
|
|
837
|
+
]);
|
|
838
|
+
console.log(scoreTable.toString());
|
|
839
|
+
}
|
|
724
840
|
}
|
|
725
841
|
catch (err) {
|
|
726
842
|
console.error(error('Error:'), err instanceof Error ? err.message : String(err));
|
|
@@ -809,44 +925,233 @@ program
|
|
|
809
925
|
process.exit(1);
|
|
810
926
|
}
|
|
811
927
|
});
|
|
928
|
+
// DocumentationAgent-based docs command
|
|
812
929
|
program
|
|
813
930
|
.command('docs')
|
|
814
|
-
.description('Generate
|
|
815
|
-
.argument('<
|
|
816
|
-
.
|
|
817
|
-
.option('--
|
|
818
|
-
.option('--
|
|
819
|
-
.
|
|
931
|
+
.description('Generate documentation using DocumentationAgent')
|
|
932
|
+
.argument('<generate>', 'Command: generate')
|
|
933
|
+
.argument('<type>', 'Documentation type: readme, api, or all')
|
|
934
|
+
.option('--target <dir>', 'Target directory for API docs (default: src)')
|
|
935
|
+
.option('--update-existing', 'Update existing documentation files')
|
|
936
|
+
.option('--output <path>', 'Output path for generated docs')
|
|
937
|
+
.option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
|
|
938
|
+
.addHelpText('after', `
|
|
939
|
+
Examples:
|
|
940
|
+
$ codehere docs generate readme
|
|
941
|
+
$ codehere docs generate api --target src
|
|
942
|
+
$ codehere docs generate all --update-existing
|
|
943
|
+
$ codehere docs generate readme --review
|
|
944
|
+
|
|
945
|
+
Warning: This command may modify README.md and docs/api.md files.
|
|
946
|
+
`)
|
|
947
|
+
.action(async (cmd, type, options) => {
|
|
948
|
+
if (cmd !== 'generate') {
|
|
949
|
+
console.error(error(`Unknown command: ${cmd}. Use 'generate' to create documentation.`));
|
|
950
|
+
process.exit(1);
|
|
951
|
+
}
|
|
952
|
+
if (!process.env.COHERE_API_KEY) {
|
|
953
|
+
console.error(error('COHERE_API_KEY not found in environment'));
|
|
954
|
+
process.exit(1);
|
|
955
|
+
}
|
|
956
|
+
initLogFile();
|
|
957
|
+
await executeDocsCommand(type, {
|
|
958
|
+
target: options.target,
|
|
959
|
+
updateExisting: options.updateExisting,
|
|
960
|
+
outputPath: options.output,
|
|
961
|
+
review: Boolean(options.review),
|
|
962
|
+
});
|
|
963
|
+
});
|
|
964
|
+
// ProductRequirementsAgent-based product command
|
|
965
|
+
program
|
|
966
|
+
.command('product')
|
|
967
|
+
.description('Generate product requirements documents using ProductRequirementsAgent')
|
|
968
|
+
.argument('<spec>', 'Command: spec')
|
|
969
|
+
.argument('<goal>', 'Product goal or feature description')
|
|
970
|
+
.option('--format <format>', 'Output format: markdown, json, or both', 'both')
|
|
971
|
+
.option('--output <path>', 'Output path for generated PRD (optional)')
|
|
972
|
+
.option('--detail <level>', 'Detail level: low, medium, or high', 'medium')
|
|
973
|
+
.option('--include-technical-spec', 'Include technical specification document')
|
|
974
|
+
.option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
|
|
975
|
+
.addHelpText('after', `
|
|
976
|
+
Examples:
|
|
977
|
+
$ codehere product spec "Add team dashboards for executive reporting"
|
|
978
|
+
$ codehere product spec "Build user authentication system" --format markdown --output prd.md
|
|
979
|
+
$ codehere product spec "Implement payment gateway" --detail high --include-technical-spec --review
|
|
980
|
+
|
|
981
|
+
Warning: This command may create new files if --output is specified.
|
|
982
|
+
`)
|
|
983
|
+
.action(async (cmd, goal, options) => {
|
|
984
|
+
if (cmd !== 'spec') {
|
|
985
|
+
console.error(error(`Unknown command: ${cmd}. Use 'spec' to generate product requirements.`));
|
|
986
|
+
process.exit(1);
|
|
987
|
+
}
|
|
988
|
+
if (!process.env.COHERE_API_KEY && process.env.CODEHERE_FAKE_AI !== '1') {
|
|
989
|
+
console.error(error('COHERE_API_KEY not found in environment'));
|
|
990
|
+
process.exit(1);
|
|
991
|
+
}
|
|
992
|
+
initLogFile();
|
|
993
|
+
// Note: --review flag is defined on parent 'product' command, not 'spec' subcommand
|
|
994
|
+
// In commander.js, parent command options may not be merged into subcommand options
|
|
995
|
+
// So we check both options.review (subcommand) and program.opts().review (parent command)
|
|
996
|
+
// This ensures --review works correctly for 'product spec' commands
|
|
997
|
+
const reviewValue = options.review !== undefined ? options.review : program.opts().review;
|
|
998
|
+
await executeProductCommand(goal, {
|
|
999
|
+
format: options.format,
|
|
1000
|
+
output: options.output,
|
|
1001
|
+
detail: options.detail,
|
|
1002
|
+
includeTechnicalSpec: options.includeTechnicalSpec || false,
|
|
1003
|
+
review: Boolean(reviewValue),
|
|
1004
|
+
});
|
|
1005
|
+
});
|
|
1006
|
+
// Status command
|
|
1007
|
+
program
|
|
1008
|
+
.command('status')
|
|
1009
|
+
.description('Show system status and optionally list recent tasks')
|
|
1010
|
+
.option('--json', 'Output machine-readable JSON summary instead of text')
|
|
1011
|
+
.option('--tasks', 'Show recent tasks (experimental)')
|
|
1012
|
+
.option('--env', 'Show environment details')
|
|
1013
|
+
.option('--track', 'Show what works (success rates by command)')
|
|
1014
|
+
.action(async (options) => {
|
|
1015
|
+
await executeStatusCommand({
|
|
1016
|
+
json: Boolean(options.json),
|
|
1017
|
+
tasks: Boolean(options.tasks),
|
|
1018
|
+
env: Boolean(options.env),
|
|
1019
|
+
track: Boolean(options.track),
|
|
1020
|
+
});
|
|
1021
|
+
});
|
|
1022
|
+
// Suggest command - Read-only assistant mode
|
|
1023
|
+
program
|
|
1024
|
+
.command('suggest')
|
|
1025
|
+
.description('Read-only assistant mode - ask questions and get explanations without making changes')
|
|
1026
|
+
.argument('<query>', 'The question or request')
|
|
1027
|
+
.option('--file <file>', 'Focus on a specific file')
|
|
1028
|
+
.addHelpText('after', `
|
|
1029
|
+
Examples:
|
|
1030
|
+
$ codehere suggest "How does authentication work?"
|
|
1031
|
+
$ codehere suggest "Explain this function" --file src/auth.ts
|
|
1032
|
+
|
|
1033
|
+
This command:
|
|
1034
|
+
• Searches your codebase for relevant code
|
|
1035
|
+
• Provides contextual answers and explanations
|
|
1036
|
+
• Does NOT make any changes (read-only mode)
|
|
1037
|
+
• Creates a task record for tracking
|
|
1038
|
+
`)
|
|
1039
|
+
.action(async (query, options) => {
|
|
820
1040
|
initLogFile();
|
|
821
1041
|
if (!process.env.COHERE_API_KEY) {
|
|
1042
|
+
newline();
|
|
822
1043
|
console.error(error('COHERE_API_KEY not found in environment'));
|
|
823
1044
|
process.exit(1);
|
|
824
1045
|
}
|
|
825
1046
|
try {
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
1047
|
+
await executeSuggestCommand(query, {
|
|
1048
|
+
file: options.file,
|
|
1049
|
+
stream: false,
|
|
1050
|
+
});
|
|
1051
|
+
logEntry({
|
|
1052
|
+
timestamp: new Date().toISOString(),
|
|
1053
|
+
command: 'suggest',
|
|
1054
|
+
query,
|
|
1055
|
+
policyStatus: 'allowed',
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
catch (err) {
|
|
1059
|
+
const errMessage = err instanceof Error ? err.message : String(err);
|
|
1060
|
+
// If it's a missing embeddings error, exit with 1 (message already shown)
|
|
1061
|
+
if (errMessage.includes('No embeddings found')) {
|
|
1062
|
+
process.exit(1);
|
|
839
1063
|
}
|
|
840
|
-
|
|
1064
|
+
console.error(error('Error:'), errMessage);
|
|
1065
|
+
process.exit(1);
|
|
1066
|
+
}
|
|
1067
|
+
});
|
|
1068
|
+
// Run command - Unified agentic execution
|
|
1069
|
+
program
|
|
1070
|
+
.command('run')
|
|
1071
|
+
.description('Unified agentic execution - execute a task or goal')
|
|
1072
|
+
.argument('<goal>', 'The goal to execute')
|
|
1073
|
+
.option('--task-id <id>', 'Continue execution of an existing task')
|
|
1074
|
+
.option('--file <file>', 'Focus on a specific file')
|
|
1075
|
+
.option('--files <files>', 'Comma-separated list of files to process')
|
|
1076
|
+
.option('--review', 'Enable review before applying changes')
|
|
1077
|
+
.addHelpText('after', `
|
|
1078
|
+
Examples:
|
|
1079
|
+
$ codehere run "Add error handling to the login function"
|
|
1080
|
+
$ codehere run "Refactor authentication module" --file src/auth.ts
|
|
1081
|
+
$ codehere run "Fix bug in payment processing" --task-id task-12345
|
|
1082
|
+
|
|
1083
|
+
This command:
|
|
1084
|
+
• Creates a plan for the goal
|
|
1085
|
+
• Executes the plan step-by-step
|
|
1086
|
+
• Creates/updates task records for tracking
|
|
1087
|
+
• Shows risk tier and environment mode (advisory)
|
|
1088
|
+
`)
|
|
1089
|
+
.action(async (goal, options) => {
|
|
1090
|
+
initLogFile();
|
|
1091
|
+
if (!process.env.COHERE_API_KEY) {
|
|
841
1092
|
newline();
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
1093
|
+
console.error(error('COHERE_API_KEY not found in environment'));
|
|
1094
|
+
process.exit(1);
|
|
1095
|
+
}
|
|
1096
|
+
try {
|
|
1097
|
+
const files = options.files ? options.files.split(',').map((f) => f.trim()) : undefined;
|
|
1098
|
+
await executeRunCommand(goal, {
|
|
1099
|
+
taskId: options.taskId,
|
|
1100
|
+
file: options.file,
|
|
1101
|
+
files,
|
|
1102
|
+
review: Boolean(options.review),
|
|
1103
|
+
});
|
|
1104
|
+
logEntry({
|
|
1105
|
+
timestamp: new Date().toISOString(),
|
|
1106
|
+
command: 'run',
|
|
1107
|
+
query: goal,
|
|
1108
|
+
policyStatus: 'allowed',
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
catch (err) {
|
|
1112
|
+
console.error(error('Error:'), err instanceof Error ? err.message : String(err));
|
|
1113
|
+
process.exit(1);
|
|
1114
|
+
}
|
|
1115
|
+
});
|
|
1116
|
+
// Review command - Task review interface
|
|
1117
|
+
program
|
|
1118
|
+
.command('review')
|
|
1119
|
+
.description('Review and approve/reject tasks')
|
|
1120
|
+
.argument('[task-id]', 'Task ID to review (omit to list tasks)')
|
|
1121
|
+
.option('--list', 'List tasks needing review')
|
|
1122
|
+
.option('--approve', 'Approve the task')
|
|
1123
|
+
.option('--reject', 'Reject the task')
|
|
1124
|
+
.option('--comment <text>', 'Add a comment to the review')
|
|
1125
|
+
.option('--all', 'Show all completed tasks in list mode')
|
|
1126
|
+
.addHelpText('after', `
|
|
1127
|
+
Examples:
|
|
1128
|
+
$ codehere review --list
|
|
1129
|
+
$ codehere review task-12345
|
|
1130
|
+
$ codehere review task-12345 --approve
|
|
1131
|
+
$ codehere review task-12345 --reject --comment "Security concerns"
|
|
1132
|
+
|
|
1133
|
+
This command:
|
|
1134
|
+
• Lists tasks that need review
|
|
1135
|
+
• Shows task details (files changed, risk tier, etc.)
|
|
1136
|
+
• Allows approving or rejecting tasks
|
|
1137
|
+
• Updates task status and review records
|
|
1138
|
+
`)
|
|
1139
|
+
.action(async (taskId, options) => {
|
|
1140
|
+
initLogFile();
|
|
1141
|
+
try {
|
|
1142
|
+
await executeReviewCommand(taskId, {
|
|
1143
|
+
list: Boolean(options.list),
|
|
1144
|
+
approve: Boolean(options.approve),
|
|
1145
|
+
reject: Boolean(options.reject),
|
|
1146
|
+
comment: options.comment,
|
|
1147
|
+
all: Boolean(options.all),
|
|
1148
|
+
});
|
|
1149
|
+
logEntry({
|
|
1150
|
+
timestamp: new Date().toISOString(),
|
|
1151
|
+
command: 'review',
|
|
1152
|
+
query: taskId,
|
|
1153
|
+
policyStatus: 'allowed',
|
|
1154
|
+
});
|
|
850
1155
|
}
|
|
851
1156
|
catch (err) {
|
|
852
1157
|
console.error(error('Error:'), err instanceof Error ? err.message : String(err));
|
|
@@ -945,10 +1250,12 @@ This command uses ReAct (Reasoning + Acting) pattern:
|
|
|
945
1250
|
});
|
|
946
1251
|
program
|
|
947
1252
|
.command('orchestrate')
|
|
1253
|
+
.option('--json', 'Output in JSON format')
|
|
948
1254
|
.description('Orchestrate multi-agent workflows (plan, execute, validate)')
|
|
949
1255
|
.argument('<goal>', 'The goal to orchestrate')
|
|
950
1256
|
.option('-m, --mode <mode>', 'Orchestration mode: plan-only, execute-only, or full', 'full')
|
|
951
1257
|
.option('-p, --plan-id <planId>', 'Load and execute a previously saved plan by ID')
|
|
1258
|
+
.option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
|
|
952
1259
|
.action(async (goal, options) => {
|
|
953
1260
|
initLogFile();
|
|
954
1261
|
if (!process.env.COHERE_API_KEY) {
|
|
@@ -960,6 +1267,8 @@ program
|
|
|
960
1267
|
await executeOrchestrateCommand(goal, {
|
|
961
1268
|
mode: options.mode,
|
|
962
1269
|
planId: options.planId,
|
|
1270
|
+
review: options.review,
|
|
1271
|
+
json: options.json,
|
|
963
1272
|
});
|
|
964
1273
|
logEntry({
|
|
965
1274
|
timestamp: new Date().toISOString(),
|
|
@@ -1076,5 +1385,23 @@ program
|
|
|
1076
1385
|
process.exit(1);
|
|
1077
1386
|
}
|
|
1078
1387
|
});
|
|
1388
|
+
// Initialize telemetry and track command
|
|
1389
|
+
const telemetry = getTelemetryService();
|
|
1390
|
+
// Track command usage (if enabled)
|
|
1391
|
+
const commandName = process.argv[2] || 'default';
|
|
1392
|
+
if (commandName !== 'telemetry') {
|
|
1393
|
+
telemetry.trackCommand(commandName);
|
|
1394
|
+
}
|
|
1395
|
+
// Check for first run (install tracking)
|
|
1396
|
+
const codebaseRoot = process.cwd();
|
|
1397
|
+
const codehereDir = join(codebaseRoot, '.codehere');
|
|
1398
|
+
if (!existsSync(codehereDir)) {
|
|
1399
|
+
// First run - track install
|
|
1400
|
+
telemetry.track('install', {
|
|
1401
|
+
version: process.env.npm_package_version || 'unknown',
|
|
1402
|
+
os: process.platform,
|
|
1403
|
+
nodeVersion: process.version,
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1079
1406
|
program.parse();
|
|
1080
1407
|
//# sourceMappingURL=index.js.map
|