codehere 0.3.0 → 0.5.0-alpha.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/README.md +230 -42
- 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 +3 -0
- package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.js +86 -0
- 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 +146 -70
- 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/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 +177 -7
- package/dist/application/services/dependency-container.js.map +1 -1
- package/dist/application/services/intelligent-router.d.ts +13 -0
- package/dist/application/services/intelligent-router.d.ts.map +1 -1
- package/dist/application/services/intelligent-router.js +306 -90
- package/dist/application/services/intelligent-router.js.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.d.ts +19 -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 +125 -46
- 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/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/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/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 +398 -164
- 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 +18 -5
- 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.js +2 -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 +128 -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/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 +399 -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 +105 -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/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 +67 -0
- package/dist/infrastructure/storage/task-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/task-repository.js +205 -0
- package/dist/infrastructure/storage/task-repository.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 +4 -5
- package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.js +35 -40
- 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.map +1 -1
- package/dist/presentation/cli/commands/ask-command.js +225 -86
- 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 +8 -6
- package/dist/presentation/cli/commands/config-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 +53 -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 +2 -0
- package/dist/presentation/cli/commands/help-command.js.map +1 -1
- 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 +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/orchestrate-command.js +68 -7
- package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -1
- package/dist/presentation/cli/commands/plan-command.d.ts +1 -0
- package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/plan-command.js +88 -8
- 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 +3 -1
- 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 +154 -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 +92 -6
- 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 +167 -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 +43 -0
- 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.js +19 -2
- package/dist/session.js.map +1 -1
- package/dist/ui.d.ts +6 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +43 -6
- package/dist/ui.js.map +1 -1
- package/package.json +16 -3
package/dist/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import { config } from 'dotenv';
|
|
|
4
4
|
import { join, dirname } from 'path';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
import { indexRepositoryParallel } from './embed.js';
|
|
7
|
-
import { generateAndApplyEdit } from './edit.js';
|
|
8
7
|
import { executeAskCommand } from './presentation/cli/commands/ask-command.js';
|
|
9
8
|
import { executeReactCommand } from './presentation/cli/commands/react-command.js';
|
|
10
9
|
import { executeSmartCommand } from './presentation/cli/commands/smart-command.js';
|
|
10
|
+
import { executeFixCommand } from './presentation/cli/commands/fix-command.js';
|
|
11
11
|
import { executeSetupCommand } from './presentation/cli/commands/setup-command.js';
|
|
12
12
|
import { executeConfigCommand } from './presentation/cli/commands/config-command.js';
|
|
13
13
|
import { executeHelpCommand } from './presentation/cli/commands/help-command.js';
|
|
@@ -17,6 +17,13 @@ import { refactorMultiFile, findFilesByPattern } from './refactor.js';
|
|
|
17
17
|
import { getGitStatus, formatGitStatus, getAllGitDiffs, analyzeDiff, getGitDiff } from './git.js';
|
|
18
18
|
import { executePlanCommand } from './presentation/cli/commands/plan-command.js';
|
|
19
19
|
import { executeOrchestrateCommand } from './presentation/cli/commands/orchestrate-command.js';
|
|
20
|
+
import { executeDocsCommand } from './presentation/cli/commands/docs-command.js';
|
|
21
|
+
import { executeProductCommand } from './presentation/cli/commands/product-command.js';
|
|
22
|
+
import { executeStatusCommand } from './presentation/cli/commands/status-command.js';
|
|
23
|
+
import { executeSuggestCommand } from './presentation/cli/commands/suggest-command.js';
|
|
24
|
+
import { executeRunCommand } from './presentation/cli/commands/run-command.js';
|
|
25
|
+
import { executeModelsCommand } from './presentation/cli/commands/models-command.js';
|
|
26
|
+
import { executeReviewCommand } from './presentation/cli/commands/review-command.js';
|
|
20
27
|
import { executeDecisionCommand } from './presentation/cli/commands/decision-command.js';
|
|
21
28
|
import { executeKnowledgeCommand } from './presentation/cli/commands/knowledge-command.js';
|
|
22
29
|
import { executeLearningDashboardCommand } from './presentation/cli/commands/learning-dashboard-command.js';
|
|
@@ -26,12 +33,11 @@ import { reviewFile, formatReview } from './review.js';
|
|
|
26
33
|
import { formatLearningInsights, getPerformanceInsights } from './learning.js';
|
|
27
34
|
import { getCacheStats, clearAllCaches } from './cache.js';
|
|
28
35
|
import { planMigration, formatMigrationPlan } from './migrate.js';
|
|
29
|
-
import { generateFileDocs, generateREADME, updateDocs, saveDocs } from './docs.js';
|
|
30
36
|
import { generateTests, getTestFilePath, saveTests, improveTests } from './testgen.js';
|
|
31
37
|
import { startSession } from './session.js';
|
|
32
38
|
import { cleanResponse } from './formatter.js';
|
|
33
39
|
import { displayError } from './presentation/cli/error-display.js';
|
|
34
|
-
import { colors, createSpinner, createBanner, createTable, success, error, warning, info, formatPath, formatNumber, sectionHeader, newline,
|
|
40
|
+
import { colors, createSpinner, createBanner, createTable, success, error, warning, info, formatPath, formatNumber, sectionHeader, newline, createWelcomeMessage, isMinimalStyle, printMinimalHeader, } from './ui.js';
|
|
35
41
|
// Load environment variables - try agent directory first, then current directory
|
|
36
42
|
try {
|
|
37
43
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -60,7 +66,8 @@ program
|
|
|
60
66
|
// Smart routing: if query provided as argument, route intelligently
|
|
61
67
|
program
|
|
62
68
|
.argument('[query]', 'Your query - Codehere will understand what you need')
|
|
63
|
-
.
|
|
69
|
+
.option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
|
|
70
|
+
.action(async (query, options) => {
|
|
64
71
|
if (query && query.trim()) {
|
|
65
72
|
// Direct query - use intelligent router
|
|
66
73
|
initLogFile();
|
|
@@ -77,7 +84,8 @@ program
|
|
|
77
84
|
process.exit(1);
|
|
78
85
|
}
|
|
79
86
|
try {
|
|
80
|
-
|
|
87
|
+
const opts = program.opts();
|
|
88
|
+
await executeSmartCommand(query.trim(), { review: opts.review || false });
|
|
81
89
|
logEntry({
|
|
82
90
|
timestamp: new Date().toISOString(),
|
|
83
91
|
command: 'smart',
|
|
@@ -129,6 +137,30 @@ program
|
|
|
129
137
|
.action(async (action, key, value) => {
|
|
130
138
|
await executeConfigCommand(action, key, value);
|
|
131
139
|
});
|
|
140
|
+
program
|
|
141
|
+
.command('models')
|
|
142
|
+
.description('List, search, and get info about available AI models')
|
|
143
|
+
.option('-l, --list', 'List all available models')
|
|
144
|
+
.option('-s, --search <query>', 'Search models by name or ID')
|
|
145
|
+
.option('-i, --info <model-id>', 'Get detailed info about a specific model')
|
|
146
|
+
.option('-p, --provider <provider>', 'Filter by provider (cohere, openai, openrouter, etc.)')
|
|
147
|
+
.option('--json', 'Output in JSON format')
|
|
148
|
+
.action(async (options) => {
|
|
149
|
+
initLogFile();
|
|
150
|
+
try {
|
|
151
|
+
await executeModelsCommand({
|
|
152
|
+
list: options.list,
|
|
153
|
+
search: options.search,
|
|
154
|
+
info: options.info,
|
|
155
|
+
provider: options.provider,
|
|
156
|
+
json: options.json,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
console.error(error('Error:'), err instanceof Error ? err.message : String(err));
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
132
164
|
program
|
|
133
165
|
.command('help')
|
|
134
166
|
.description('Show help for commands')
|
|
@@ -142,7 +174,8 @@ program
|
|
|
142
174
|
.option('-r, --repo <path>', 'Repository path (default: current directory)')
|
|
143
175
|
.action(async (options) => {
|
|
144
176
|
initLogFile();
|
|
145
|
-
|
|
177
|
+
// Allow fake AI for testing, or require real API key
|
|
178
|
+
if (!process.env.COHERE_API_KEY && process.env.CODEHERE_FAKE_AI !== '1') {
|
|
146
179
|
newline();
|
|
147
180
|
console.error(error('COHERE_API_KEY not found in environment'));
|
|
148
181
|
newline();
|
|
@@ -151,12 +184,20 @@ program
|
|
|
151
184
|
console.log(' 2. Create a .env file in your project root:');
|
|
152
185
|
console.log(colors.cyan(' echo "COHERE_API_KEY=your_key_here" > .env'));
|
|
153
186
|
console.log(' 3. Run the command again');
|
|
187
|
+
console.log('');
|
|
188
|
+
console.log(colors.dim('Note: For testing without API calls, set CODEHERE_FAKE_AI=1'));
|
|
154
189
|
newline();
|
|
155
190
|
process.exit(1);
|
|
156
191
|
}
|
|
157
192
|
try {
|
|
158
|
-
|
|
159
|
-
|
|
193
|
+
if (isMinimalStyle()) {
|
|
194
|
+
console.log(colors.cyan('Indexing codebase...'));
|
|
195
|
+
newline();
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
console.log(createBanner('Indexing Repository', 'Building semantic search index'));
|
|
199
|
+
newline();
|
|
200
|
+
}
|
|
160
201
|
const repoPath = options.repo || process.cwd();
|
|
161
202
|
// NEW: Use parallel indexing with caching
|
|
162
203
|
await indexRepositoryParallel(repoPath, {
|
|
@@ -169,10 +210,32 @@ program
|
|
|
169
210
|
policyStatus: 'allowed',
|
|
170
211
|
});
|
|
171
212
|
newline();
|
|
172
|
-
|
|
213
|
+
if (isMinimalStyle()) {
|
|
214
|
+
console.log(success('Indexing complete. Cache written to .codehere-cache/'));
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
console.log(success('Indexing complete!'));
|
|
218
|
+
}
|
|
219
|
+
process.exit(0);
|
|
173
220
|
}
|
|
174
221
|
catch (err) {
|
|
175
|
-
|
|
222
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
223
|
+
// Check for 401 Unauthorized errors
|
|
224
|
+
if (errorMessage.includes('401') || errorMessage.includes('Unauthorized') || errorMessage.includes('no api key')) {
|
|
225
|
+
newline();
|
|
226
|
+
console.error(error('Authentication failed: Invalid or missing API key'));
|
|
227
|
+
newline();
|
|
228
|
+
console.log(colors.bold('Troubleshooting:'));
|
|
229
|
+
console.log(' 1. Verify your COHERE_API_KEY is set correctly:');
|
|
230
|
+
console.log(colors.cyan(' echo $COHERE_API_KEY'));
|
|
231
|
+
console.log(' 2. Check if the key is valid at: https://dashboard.cohere.com/api-keys');
|
|
232
|
+
console.log(' 3. If using a .env file, ensure it\'s loaded (e.g., use dotenv)');
|
|
233
|
+
console.log(' 4. For testing, you can use: CODEHERE_FAKE_AI=1 codehere index');
|
|
234
|
+
newline();
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
console.error(error('Error indexing repository:'), errorMessage);
|
|
238
|
+
}
|
|
176
239
|
process.exit(1);
|
|
177
240
|
}
|
|
178
241
|
});
|
|
@@ -196,7 +259,7 @@ Make sure to run "codehere index" first!
|
|
|
196
259
|
`)
|
|
197
260
|
.action(async (question) => {
|
|
198
261
|
initLogFile();
|
|
199
|
-
if (!process.env.COHERE_API_KEY) {
|
|
262
|
+
if (!process.env.COHERE_API_KEY && process.env.CODEHERE_FAKE_AI !== '1') {
|
|
200
263
|
newline();
|
|
201
264
|
console.error(error('COHERE_API_KEY not found in environment'));
|
|
202
265
|
newline();
|
|
@@ -209,21 +272,7 @@ Make sure to run "codehere index" first!
|
|
|
209
272
|
process.exit(1);
|
|
210
273
|
}
|
|
211
274
|
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
|
-
}
|
|
275
|
+
await executeAskCommand(question);
|
|
227
276
|
logEntry({
|
|
228
277
|
timestamp: new Date().toISOString(),
|
|
229
278
|
command: 'ask',
|
|
@@ -232,7 +281,12 @@ Make sure to run "codehere index" first!
|
|
|
232
281
|
});
|
|
233
282
|
}
|
|
234
283
|
catch (err) {
|
|
235
|
-
|
|
284
|
+
const errMessage = err instanceof Error ? err.message : String(err);
|
|
285
|
+
// If it's a missing embeddings error, exit with 1
|
|
286
|
+
if (errMessage.includes('No embeddings found')) {
|
|
287
|
+
process.exit(1);
|
|
288
|
+
}
|
|
289
|
+
console.error(error('Error:'), errMessage);
|
|
236
290
|
process.exit(1);
|
|
237
291
|
}
|
|
238
292
|
});
|
|
@@ -242,10 +296,11 @@ program
|
|
|
242
296
|
.argument('<file>', 'Path to the file to edit')
|
|
243
297
|
.argument('<instruction>', 'Natural language instruction for the edit')
|
|
244
298
|
.alias('edit')
|
|
299
|
+
.option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
|
|
245
300
|
.addHelpText('after', `
|
|
246
301
|
Examples:
|
|
247
302
|
$ codehere fix src/auth.ts "Add error handling for invalid tokens"
|
|
248
|
-
$ codehere fix utils/helpers.js "Rename function foo() to bar()"
|
|
303
|
+
$ codehere fix utils/helpers.js "Rename function foo() to bar()" --review
|
|
249
304
|
$ codehere edit app.js "Add input validation"
|
|
250
305
|
|
|
251
306
|
This command will:
|
|
@@ -254,12 +309,15 @@ This command will:
|
|
|
254
309
|
• Apply the changes to your file
|
|
255
310
|
• Log the operation for audit
|
|
256
311
|
|
|
312
|
+
Options:
|
|
313
|
+
--review Enable review & feedback capture (used for trust scoring and Validation Mode)
|
|
314
|
+
|
|
257
315
|
Safety policies:
|
|
258
316
|
• Maximum 50 lines changed per edit
|
|
259
317
|
• Cannot edit files in restricted folders (infra/, billing/)
|
|
260
318
|
• Only one file can be edited at a time
|
|
261
319
|
`)
|
|
262
|
-
.action(async (file, instruction) => {
|
|
320
|
+
.action(async (file, instruction, options) => {
|
|
263
321
|
initLogFile();
|
|
264
322
|
if (!process.env.COHERE_API_KEY) {
|
|
265
323
|
newline();
|
|
@@ -274,93 +332,31 @@ Safety policies:
|
|
|
274
332
|
process.exit(1);
|
|
275
333
|
}
|
|
276
334
|
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());
|
|
335
|
+
// Check if embeddings exist for this repository (skip check if using fake AI for testing)
|
|
336
|
+
if (process.env.CODEHERE_FAKE_AI !== '1') {
|
|
337
|
+
const { container } = await import('./application/services/dependency-container.js');
|
|
338
|
+
const embeddingRepo = container.getEmbeddingRepository(process.cwd());
|
|
339
|
+
const hasEmbeddings = await embeddingRepo.hasEmbeddings();
|
|
340
|
+
if (!hasEmbeddings) {
|
|
315
341
|
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());
|
|
342
|
+
console.error(colors.red('No embeddings found for this repository.'));
|
|
343
|
+
newline();
|
|
344
|
+
console.log('Run:');
|
|
345
|
+
console.log(colors.cyan(' codehere index'));
|
|
346
|
+
console.log('');
|
|
347
|
+
console.log('then re-run this command.');
|
|
327
348
|
newline();
|
|
349
|
+
process.exit(1);
|
|
328
350
|
}
|
|
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
351
|
}
|
|
352
|
+
await executeFixCommand(file, instruction, { review: options?.review });
|
|
353
|
+
logEntry({
|
|
354
|
+
timestamp: new Date().toISOString(),
|
|
355
|
+
command: 'fix',
|
|
356
|
+
query: instruction,
|
|
357
|
+
filepath: file,
|
|
358
|
+
policyStatus: 'allowed',
|
|
359
|
+
});
|
|
364
360
|
}
|
|
365
361
|
catch (err) {
|
|
366
362
|
displayError(err, {
|
|
@@ -403,8 +399,30 @@ This command will:
|
|
|
403
399
|
process.exit(1);
|
|
404
400
|
}
|
|
405
401
|
try {
|
|
406
|
-
|
|
407
|
-
|
|
402
|
+
// Check if embeddings exist for this repository (skip check if using fake AI for testing)
|
|
403
|
+
if (process.env.CODEHERE_FAKE_AI !== '1') {
|
|
404
|
+
const { container } = await import('./application/services/dependency-container.js');
|
|
405
|
+
const embeddingRepo = container.getEmbeddingRepository(process.cwd());
|
|
406
|
+
const hasEmbeddings = await embeddingRepo.hasEmbeddings();
|
|
407
|
+
if (!hasEmbeddings) {
|
|
408
|
+
newline();
|
|
409
|
+
console.error(colors.red('No embeddings found for this repository.'));
|
|
410
|
+
newline();
|
|
411
|
+
console.log('Run:');
|
|
412
|
+
console.log(colors.cyan(' codehere index'));
|
|
413
|
+
console.log('');
|
|
414
|
+
console.log('then re-run this command.');
|
|
415
|
+
newline();
|
|
416
|
+
process.exit(1);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
if (isMinimalStyle()) {
|
|
420
|
+
printMinimalHeader('explain', file);
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
console.log(createBanner('Explain File', 'AI-powered code explanation'));
|
|
424
|
+
newline();
|
|
425
|
+
}
|
|
408
426
|
const fullPath = join(process.cwd(), file);
|
|
409
427
|
// Check if file exists
|
|
410
428
|
const { existsSync } = await import('fs');
|
|
@@ -454,9 +472,14 @@ program
|
|
|
454
472
|
.option('-m, --metrics', 'Show detailed metrics')
|
|
455
473
|
.action((options) => {
|
|
456
474
|
const health = performHealthCheck();
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
475
|
+
if (isMinimalStyle()) {
|
|
476
|
+
printMinimalHeader('health', '');
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
newline();
|
|
480
|
+
console.log(createBanner('System Health', 'Enterprise monitoring'));
|
|
481
|
+
newline();
|
|
482
|
+
}
|
|
460
483
|
console.log(formatHealthStatus(health));
|
|
461
484
|
if (options.metrics) {
|
|
462
485
|
newline();
|
|
@@ -557,13 +580,13 @@ program
|
|
|
557
580
|
}
|
|
558
581
|
});
|
|
559
582
|
program
|
|
560
|
-
.command('review')
|
|
583
|
+
.command('git-review')
|
|
561
584
|
.description('Review git changes and suggest improvements')
|
|
562
585
|
.option('-f, --file <file>', 'Review specific file')
|
|
563
586
|
.action((options) => {
|
|
564
587
|
initLogFile();
|
|
565
588
|
try {
|
|
566
|
-
console.log(createBanner('
|
|
589
|
+
console.log(createBanner('Git Review', 'Git-aware code analysis'));
|
|
567
590
|
newline();
|
|
568
591
|
const status = getGitStatus();
|
|
569
592
|
if (!status.isRepo) {
|
|
@@ -612,6 +635,7 @@ program
|
|
|
612
635
|
.description('Plan a complex multi-step task')
|
|
613
636
|
.argument('<instruction>', 'Complex instruction to plan')
|
|
614
637
|
.option('-e, --execute', 'Execute the plan after creating it')
|
|
638
|
+
.option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
|
|
615
639
|
.action(async (instruction, options) => {
|
|
616
640
|
initLogFile();
|
|
617
641
|
if (!process.env.COHERE_API_KEY) {
|
|
@@ -619,12 +643,17 @@ program
|
|
|
619
643
|
process.exit(1);
|
|
620
644
|
}
|
|
621
645
|
try {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
646
|
+
if (isMinimalStyle()) {
|
|
647
|
+
printMinimalHeader('plan', instruction);
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
console.log(createBanner('Task Planning', 'Intelligent multi-step execution'));
|
|
651
|
+
newline();
|
|
652
|
+
console.log(colors.bold('Instruction:') + ' ' + colors.cyan(instruction));
|
|
653
|
+
}
|
|
625
654
|
newline();
|
|
626
655
|
// Use new memory-based planning
|
|
627
|
-
await executePlanCommand(instruction, { execute: options.execute });
|
|
656
|
+
await executePlanCommand(instruction, { execute: options.execute, review: options.review });
|
|
628
657
|
}
|
|
629
658
|
catch (err) {
|
|
630
659
|
console.error(error('Error:'), err instanceof Error ? err.message : String(err));
|
|
@@ -703,24 +732,38 @@ program
|
|
|
703
732
|
process.exit(1);
|
|
704
733
|
}
|
|
705
734
|
try {
|
|
706
|
-
|
|
707
|
-
|
|
735
|
+
if (isMinimalStyle()) {
|
|
736
|
+
console.log(colors.bold(`Review: ${file}`));
|
|
737
|
+
newline();
|
|
738
|
+
}
|
|
739
|
+
else {
|
|
740
|
+
console.log(createBanner('Code Review', 'Automated senior-level analysis'));
|
|
741
|
+
newline();
|
|
742
|
+
}
|
|
708
743
|
const reviewSpinner = createSpinner('Reviewing code...');
|
|
709
744
|
reviewSpinner.start();
|
|
710
745
|
const review = await reviewFile(file);
|
|
711
746
|
reviewSpinner.stop();
|
|
712
747
|
newline();
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
748
|
+
if (isMinimalStyle()) {
|
|
749
|
+
console.log(colors.bold('Findings:'));
|
|
750
|
+
console.log(formatReview(review));
|
|
751
|
+
newline();
|
|
752
|
+
console.log(colors.dim(`Score: ${review.score}/100`));
|
|
753
|
+
}
|
|
754
|
+
else {
|
|
755
|
+
console.log(formatReview(review));
|
|
756
|
+
// Display score
|
|
757
|
+
newline();
|
|
758
|
+
sectionHeader('Review Score');
|
|
759
|
+
const scoreTable = createTable(['Metric', 'Value'], [
|
|
760
|
+
['Overall Score', `${review.score}/100`],
|
|
761
|
+
['Errors', formatNumber(review.issues.filter(i => i.severity === 'error').length)],
|
|
762
|
+
['Warnings', formatNumber(review.issues.filter(i => i.severity === 'warning').length)],
|
|
763
|
+
['Info', formatNumber(review.issues.filter(i => i.severity === 'info').length)],
|
|
764
|
+
]);
|
|
765
|
+
console.log(scoreTable.toString());
|
|
766
|
+
}
|
|
724
767
|
}
|
|
725
768
|
catch (err) {
|
|
726
769
|
console.error(error('Error:'), err instanceof Error ? err.message : String(err));
|
|
@@ -809,44 +852,233 @@ program
|
|
|
809
852
|
process.exit(1);
|
|
810
853
|
}
|
|
811
854
|
});
|
|
855
|
+
// DocumentationAgent-based docs command
|
|
812
856
|
program
|
|
813
857
|
.command('docs')
|
|
814
|
-
.description('Generate
|
|
815
|
-
.argument('<
|
|
816
|
-
.
|
|
817
|
-
.option('--
|
|
818
|
-
.option('--
|
|
819
|
-
.
|
|
858
|
+
.description('Generate documentation using DocumentationAgent')
|
|
859
|
+
.argument('<generate>', 'Command: generate')
|
|
860
|
+
.argument('<type>', 'Documentation type: readme, api, or all')
|
|
861
|
+
.option('--target <dir>', 'Target directory for API docs (default: src)')
|
|
862
|
+
.option('--update-existing', 'Update existing documentation files')
|
|
863
|
+
.option('--output <path>', 'Output path for generated docs')
|
|
864
|
+
.option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
|
|
865
|
+
.addHelpText('after', `
|
|
866
|
+
Examples:
|
|
867
|
+
$ codehere docs generate readme
|
|
868
|
+
$ codehere docs generate api --target src
|
|
869
|
+
$ codehere docs generate all --update-existing
|
|
870
|
+
$ codehere docs generate readme --review
|
|
871
|
+
|
|
872
|
+
Warning: This command may modify README.md and docs/api.md files.
|
|
873
|
+
`)
|
|
874
|
+
.action(async (cmd, type, options) => {
|
|
875
|
+
if (cmd !== 'generate') {
|
|
876
|
+
console.error(error(`Unknown command: ${cmd}. Use 'generate' to create documentation.`));
|
|
877
|
+
process.exit(1);
|
|
878
|
+
}
|
|
879
|
+
if (!process.env.COHERE_API_KEY) {
|
|
880
|
+
console.error(error('COHERE_API_KEY not found in environment'));
|
|
881
|
+
process.exit(1);
|
|
882
|
+
}
|
|
883
|
+
initLogFile();
|
|
884
|
+
await executeDocsCommand(type, {
|
|
885
|
+
target: options.target,
|
|
886
|
+
updateExisting: options.updateExisting,
|
|
887
|
+
outputPath: options.output,
|
|
888
|
+
review: Boolean(options.review),
|
|
889
|
+
});
|
|
890
|
+
});
|
|
891
|
+
// ProductRequirementsAgent-based product command
|
|
892
|
+
program
|
|
893
|
+
.command('product')
|
|
894
|
+
.description('Generate product requirements documents using ProductRequirementsAgent')
|
|
895
|
+
.argument('<spec>', 'Command: spec')
|
|
896
|
+
.argument('<goal>', 'Product goal or feature description')
|
|
897
|
+
.option('--format <format>', 'Output format: markdown, json, or both', 'both')
|
|
898
|
+
.option('--output <path>', 'Output path for generated PRD (optional)')
|
|
899
|
+
.option('--detail <level>', 'Detail level: low, medium, or high', 'medium')
|
|
900
|
+
.option('--include-technical-spec', 'Include technical specification document')
|
|
901
|
+
.option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
|
|
902
|
+
.addHelpText('after', `
|
|
903
|
+
Examples:
|
|
904
|
+
$ codehere product spec "Add team dashboards for executive reporting"
|
|
905
|
+
$ codehere product spec "Build user authentication system" --format markdown --output prd.md
|
|
906
|
+
$ codehere product spec "Implement payment gateway" --detail high --include-technical-spec --review
|
|
907
|
+
|
|
908
|
+
Warning: This command may create new files if --output is specified.
|
|
909
|
+
`)
|
|
910
|
+
.action(async (cmd, goal, options) => {
|
|
911
|
+
if (cmd !== 'spec') {
|
|
912
|
+
console.error(error(`Unknown command: ${cmd}. Use 'spec' to generate product requirements.`));
|
|
913
|
+
process.exit(1);
|
|
914
|
+
}
|
|
915
|
+
if (!process.env.COHERE_API_KEY && process.env.CODEHERE_FAKE_AI !== '1') {
|
|
916
|
+
console.error(error('COHERE_API_KEY not found in environment'));
|
|
917
|
+
process.exit(1);
|
|
918
|
+
}
|
|
919
|
+
initLogFile();
|
|
920
|
+
// Note: --review flag is defined on parent 'product' command, not 'spec' subcommand
|
|
921
|
+
// In commander.js, parent command options may not be merged into subcommand options
|
|
922
|
+
// So we check both options.review (subcommand) and program.opts().review (parent command)
|
|
923
|
+
// This ensures --review works correctly for 'product spec' commands
|
|
924
|
+
const reviewValue = options.review !== undefined ? options.review : program.opts().review;
|
|
925
|
+
await executeProductCommand(goal, {
|
|
926
|
+
format: options.format,
|
|
927
|
+
output: options.output,
|
|
928
|
+
detail: options.detail,
|
|
929
|
+
includeTechnicalSpec: options.includeTechnicalSpec || false,
|
|
930
|
+
review: Boolean(reviewValue),
|
|
931
|
+
});
|
|
932
|
+
});
|
|
933
|
+
// Status command
|
|
934
|
+
program
|
|
935
|
+
.command('status')
|
|
936
|
+
.description('Show system status and optionally list recent tasks')
|
|
937
|
+
.option('--json', 'Output machine-readable JSON summary instead of text')
|
|
938
|
+
.option('--tasks', 'Show recent tasks (experimental)')
|
|
939
|
+
.option('--env', 'Show environment details')
|
|
940
|
+
.option('--track', 'Show what works (success rates by command)')
|
|
941
|
+
.action(async (options) => {
|
|
942
|
+
await executeStatusCommand({
|
|
943
|
+
json: Boolean(options.json),
|
|
944
|
+
tasks: Boolean(options.tasks),
|
|
945
|
+
env: Boolean(options.env),
|
|
946
|
+
track: Boolean(options.track),
|
|
947
|
+
});
|
|
948
|
+
});
|
|
949
|
+
// Suggest command - Read-only assistant mode
|
|
950
|
+
program
|
|
951
|
+
.command('suggest')
|
|
952
|
+
.description('Read-only assistant mode - ask questions and get explanations without making changes')
|
|
953
|
+
.argument('<query>', 'The question or request')
|
|
954
|
+
.option('--file <file>', 'Focus on a specific file')
|
|
955
|
+
.addHelpText('after', `
|
|
956
|
+
Examples:
|
|
957
|
+
$ codehere suggest "How does authentication work?"
|
|
958
|
+
$ codehere suggest "Explain this function" --file src/auth.ts
|
|
959
|
+
|
|
960
|
+
This command:
|
|
961
|
+
• Searches your codebase for relevant code
|
|
962
|
+
• Provides contextual answers and explanations
|
|
963
|
+
• Does NOT make any changes (read-only mode)
|
|
964
|
+
• Creates a task record for tracking
|
|
965
|
+
`)
|
|
966
|
+
.action(async (query, options) => {
|
|
820
967
|
initLogFile();
|
|
821
968
|
if (!process.env.COHERE_API_KEY) {
|
|
969
|
+
newline();
|
|
822
970
|
console.error(error('COHERE_API_KEY not found in environment'));
|
|
823
971
|
process.exit(1);
|
|
824
972
|
}
|
|
825
973
|
try {
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
974
|
+
await executeSuggestCommand(query, {
|
|
975
|
+
file: options.file,
|
|
976
|
+
stream: false,
|
|
977
|
+
});
|
|
978
|
+
logEntry({
|
|
979
|
+
timestamp: new Date().toISOString(),
|
|
980
|
+
command: 'suggest',
|
|
981
|
+
query,
|
|
982
|
+
policyStatus: 'allowed',
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
catch (err) {
|
|
986
|
+
const errMessage = err instanceof Error ? err.message : String(err);
|
|
987
|
+
// If it's a missing embeddings error, exit with 1 (message already shown)
|
|
988
|
+
if (errMessage.includes('No embeddings found')) {
|
|
989
|
+
process.exit(1);
|
|
839
990
|
}
|
|
840
|
-
|
|
991
|
+
console.error(error('Error:'), errMessage);
|
|
992
|
+
process.exit(1);
|
|
993
|
+
}
|
|
994
|
+
});
|
|
995
|
+
// Run command - Unified agentic execution
|
|
996
|
+
program
|
|
997
|
+
.command('run')
|
|
998
|
+
.description('Unified agentic execution - execute a task or goal')
|
|
999
|
+
.argument('<goal>', 'The goal to execute')
|
|
1000
|
+
.option('--task-id <id>', 'Continue execution of an existing task')
|
|
1001
|
+
.option('--file <file>', 'Focus on a specific file')
|
|
1002
|
+
.option('--files <files>', 'Comma-separated list of files to process')
|
|
1003
|
+
.option('--review', 'Enable review before applying changes')
|
|
1004
|
+
.addHelpText('after', `
|
|
1005
|
+
Examples:
|
|
1006
|
+
$ codehere run "Add error handling to the login function"
|
|
1007
|
+
$ codehere run "Refactor authentication module" --file src/auth.ts
|
|
1008
|
+
$ codehere run "Fix bug in payment processing" --task-id task-12345
|
|
1009
|
+
|
|
1010
|
+
This command:
|
|
1011
|
+
• Creates a plan for the goal
|
|
1012
|
+
• Executes the plan step-by-step
|
|
1013
|
+
• Creates/updates task records for tracking
|
|
1014
|
+
• Shows risk tier and environment mode (advisory)
|
|
1015
|
+
`)
|
|
1016
|
+
.action(async (goal, options) => {
|
|
1017
|
+
initLogFile();
|
|
1018
|
+
if (!process.env.COHERE_API_KEY) {
|
|
841
1019
|
newline();
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
1020
|
+
console.error(error('COHERE_API_KEY not found in environment'));
|
|
1021
|
+
process.exit(1);
|
|
1022
|
+
}
|
|
1023
|
+
try {
|
|
1024
|
+
const files = options.files ? options.files.split(',').map((f) => f.trim()) : undefined;
|
|
1025
|
+
await executeRunCommand(goal, {
|
|
1026
|
+
taskId: options.taskId,
|
|
1027
|
+
file: options.file,
|
|
1028
|
+
files,
|
|
1029
|
+
review: Boolean(options.review),
|
|
1030
|
+
});
|
|
1031
|
+
logEntry({
|
|
1032
|
+
timestamp: new Date().toISOString(),
|
|
1033
|
+
command: 'run',
|
|
1034
|
+
query: goal,
|
|
1035
|
+
policyStatus: 'allowed',
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
catch (err) {
|
|
1039
|
+
console.error(error('Error:'), err instanceof Error ? err.message : String(err));
|
|
1040
|
+
process.exit(1);
|
|
1041
|
+
}
|
|
1042
|
+
});
|
|
1043
|
+
// Review command - Task review interface
|
|
1044
|
+
program
|
|
1045
|
+
.command('review')
|
|
1046
|
+
.description('Review and approve/reject tasks')
|
|
1047
|
+
.argument('[task-id]', 'Task ID to review (omit to list tasks)')
|
|
1048
|
+
.option('--list', 'List tasks needing review')
|
|
1049
|
+
.option('--approve', 'Approve the task')
|
|
1050
|
+
.option('--reject', 'Reject the task')
|
|
1051
|
+
.option('--comment <text>', 'Add a comment to the review')
|
|
1052
|
+
.option('--all', 'Show all completed tasks in list mode')
|
|
1053
|
+
.addHelpText('after', `
|
|
1054
|
+
Examples:
|
|
1055
|
+
$ codehere review --list
|
|
1056
|
+
$ codehere review task-12345
|
|
1057
|
+
$ codehere review task-12345 --approve
|
|
1058
|
+
$ codehere review task-12345 --reject --comment "Security concerns"
|
|
1059
|
+
|
|
1060
|
+
This command:
|
|
1061
|
+
• Lists tasks that need review
|
|
1062
|
+
• Shows task details (files changed, risk tier, etc.)
|
|
1063
|
+
• Allows approving or rejecting tasks
|
|
1064
|
+
• Updates task status and review records
|
|
1065
|
+
`)
|
|
1066
|
+
.action(async (taskId, options) => {
|
|
1067
|
+
initLogFile();
|
|
1068
|
+
try {
|
|
1069
|
+
await executeReviewCommand(taskId, {
|
|
1070
|
+
list: Boolean(options.list),
|
|
1071
|
+
approve: Boolean(options.approve),
|
|
1072
|
+
reject: Boolean(options.reject),
|
|
1073
|
+
comment: options.comment,
|
|
1074
|
+
all: Boolean(options.all),
|
|
1075
|
+
});
|
|
1076
|
+
logEntry({
|
|
1077
|
+
timestamp: new Date().toISOString(),
|
|
1078
|
+
command: 'review',
|
|
1079
|
+
query: taskId,
|
|
1080
|
+
policyStatus: 'allowed',
|
|
1081
|
+
});
|
|
850
1082
|
}
|
|
851
1083
|
catch (err) {
|
|
852
1084
|
console.error(error('Error:'), err instanceof Error ? err.message : String(err));
|
|
@@ -949,6 +1181,7 @@ program
|
|
|
949
1181
|
.argument('<goal>', 'The goal to orchestrate')
|
|
950
1182
|
.option('-m, --mode <mode>', 'Orchestration mode: plan-only, execute-only, or full', 'full')
|
|
951
1183
|
.option('-p, --plan-id <planId>', 'Load and execute a previously saved plan by ID')
|
|
1184
|
+
.option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
|
|
952
1185
|
.action(async (goal, options) => {
|
|
953
1186
|
initLogFile();
|
|
954
1187
|
if (!process.env.COHERE_API_KEY) {
|
|
@@ -960,6 +1193,7 @@ program
|
|
|
960
1193
|
await executeOrchestrateCommand(goal, {
|
|
961
1194
|
mode: options.mode,
|
|
962
1195
|
planId: options.planId,
|
|
1196
|
+
review: options.review,
|
|
963
1197
|
});
|
|
964
1198
|
logEntry({
|
|
965
1199
|
timestamp: new Date().toISOString(),
|