codehere 0.4.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 +113 -30
- package/dist/application/agents/execution-agent.js +2 -2
- package/dist/application/agents/execution-agent.js.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.d.ts +1 -0
- package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.js +10 -3
- package/dist/application/agents/multi-agent-orchestrator.js.map +1 -1
- package/dist/application/agents/planning-agent.d.ts.map +1 -1
- package/dist/application/agents/planning-agent.js +22 -10
- package/dist/application/agents/planning-agent.js.map +1 -1
- package/dist/application/agents/validation-agent.js +2 -2
- 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 +30 -6
- package/dist/application/services/dependency-container.d.ts.map +1 -1
- package/dist/application/services/dependency-container.js +96 -44
- package/dist/application/services/dependency-container.js.map +1 -1
- package/dist/application/services/intelligent-router.d.ts +6 -0
- package/dist/application/services/intelligent-router.d.ts.map +1 -1
- package/dist/application/services/intelligent-router.js +98 -9
- package/dist/application/services/intelligent-router.js.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.d.ts +1 -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 +4 -3
- package/dist/application/use-cases/ask-question-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/memory.d.ts.map +1 -1
- package/dist/domain/entities/task.d.ts +1 -1
- package/dist/domain/entities/task.d.ts.map +1 -1
- package/dist/domain/entities/task.js +2 -2
- package/dist/domain/entities/task.js.map +1 -1
- 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/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 +4 -10
- package/dist/domain/services/environment-mode-manager.d.ts.map +1 -1
- package/dist/domain/services/environment-mode-manager.js +7 -22
- package/dist/domain/services/environment-mode-manager.js.map +1 -1
- 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 +8 -9
- package/dist/domain/services/risk-tier-detector.d.ts.map +1 -1
- package/dist/domain/services/risk-tier-detector.js +53 -40
- package/dist/domain/services/risk-tier-detector.js.map +1 -1
- package/dist/embed.d.ts.map +1 -1
- package/dist/embed.js +18 -8
- package/dist/embed.js.map +1 -1
- package/dist/index.js +405 -52
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.js +4 -4
- package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -1
- package/dist/infrastructure/ai/provider-ai-service.d.ts.map +1 -1
- package/dist/infrastructure/ai/provider-ai-service.js +7 -7
- package/dist/infrastructure/ai/provider-ai-service.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 +10 -78
- package/dist/infrastructure/cache/response-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/response-cache.js +22 -198
- package/dist/infrastructure/cache/response-cache.js.map +1 -1
- 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 +27 -31
- package/dist/infrastructure/context/conversation-context.d.ts.map +1 -1
- package/dist/infrastructure/context/conversation-context.js +95 -136
- package/dist/infrastructure/context/conversation-context.js.map +1 -1
- package/dist/infrastructure/context/session-manager.d.ts +27 -11
- package/dist/infrastructure/context/session-manager.d.ts.map +1 -1
- package/dist/infrastructure/context/session-manager.js +69 -73
- package/dist/infrastructure/context/session-manager.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.map +1 -1
- package/dist/infrastructure/providers/cohere-provider.js +102 -17
- package/dist/infrastructure/providers/cohere-provider.js.map +1 -1
- 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.map +1 -1
- package/dist/infrastructure/providers/operation-provider-resolver.js +33 -7
- package/dist/infrastructure/providers/operation-provider-resolver.js.map +1 -1
- 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 +12 -1
- package/dist/infrastructure/storage/task-helpers.d.ts.map +1 -1
- package/dist/infrastructure/storage/task-helpers.js +48 -8
- package/dist/infrastructure/storage/task-helpers.js.map +1 -1
- package/dist/infrastructure/storage/task-repository.d.ts +2 -1
- package/dist/infrastructure/storage/task-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/task-repository.js +14 -3
- package/dist/infrastructure/storage/task-repository.js.map +1 -1
- 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/capability-boundaries.d.ts +9 -37
- package/dist/infrastructure/ux/capability-boundaries.d.ts.map +1 -1
- package/dist/infrastructure/ux/capability-boundaries.js +23 -148
- package/dist/infrastructure/ux/capability-boundaries.js.map +1 -1
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts +12 -54
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts.map +1 -1
- package/dist/infrastructure/ux/comprehensive-formatter.js +87 -182
- package/dist/infrastructure/ux/comprehensive-formatter.js.map +1 -1
- 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 +15 -31
- package/dist/infrastructure/ux/feedback-prompt.d.ts.map +1 -1
- package/dist/infrastructure/ux/feedback-prompt.js +30 -166
- package/dist/infrastructure/ux/feedback-prompt.js.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.d.ts +4 -6
- package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.js +35 -50
- package/dist/infrastructure/ux/progress-indicator.js.map +1 -1
- 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 +25 -89
- package/dist/infrastructure/validation/agent-feedback.d.ts.map +1 -1
- package/dist/infrastructure/validation/agent-feedback.js +32 -204
- package/dist/infrastructure/validation/agent-feedback.js.map +1 -1
- package/dist/infrastructure/validation/agent-validation-helper.d.ts +53 -53
- package/dist/infrastructure/validation/agent-validation-helper.d.ts.map +1 -1
- package/dist/infrastructure/validation/agent-validation-helper.js +110 -61
- package/dist/infrastructure/validation/agent-validation-helper.js.map +1 -1
- package/dist/infrastructure/validation/review-handler.d.ts +13 -41
- package/dist/infrastructure/validation/review-handler.d.ts.map +1 -1
- package/dist/infrastructure/validation/review-handler.js +23 -189
- package/dist/infrastructure/validation/review-handler.js.map +1 -1
- package/dist/infrastructure/validation/summary-aggregator.d.ts +25 -22
- package/dist/infrastructure/validation/summary-aggregator.d.ts.map +1 -1
- package/dist/infrastructure/validation/summary-aggregator.js +47 -133
- package/dist/infrastructure/validation/summary-aggregator.js.map +1 -1
- package/dist/infrastructure/validation/summary-extractor.d.ts +13 -48
- package/dist/infrastructure/validation/summary-extractor.d.ts.map +1 -1
- package/dist/infrastructure/validation/summary-extractor.js +32 -89
- package/dist/infrastructure/validation/summary-extractor.js.map +1 -1
- package/dist/infrastructure/validation/trace-summary.d.ts +30 -57
- package/dist/infrastructure/validation/trace-summary.d.ts.map +1 -1
- package/dist/infrastructure/validation/trace-summary.js +37 -356
- package/dist/infrastructure/validation/trace-summary.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 +316 -129
- 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 +3 -1
- package/dist/presentation/cli/commands/docs-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/docs-command.js +13 -184
- package/dist/presentation/cli/commands/docs-command.js.map +1 -1
- package/dist/presentation/cli/commands/fix-command.d.ts +2 -0
- package/dist/presentation/cli/commands/fix-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/fix-command.js +61 -276
- package/dist/presentation/cli/commands/fix-command.js.map +1 -1
- package/dist/presentation/cli/commands/help-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/help-command.js +21 -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 +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/orchestrate-command.js +129 -14
- 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 +134 -25
- package/dist/presentation/cli/commands/plan-command.js.map +1 -1
- package/dist/presentation/cli/commands/product-command.d.ts +6 -4
- package/dist/presentation/cli/commands/product-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/product-command.js +12 -178
- package/dist/presentation/cli/commands/product-command.js.map +1 -1
- package/dist/presentation/cli/commands/react-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/react-command.js +5 -1
- package/dist/presentation/cli/commands/react-command.js.map +1 -1
- package/dist/presentation/cli/commands/review-command.d.ts +7 -7
- package/dist/presentation/cli/commands/review-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/review-command.js +167 -16
- package/dist/presentation/cli/commands/review-command.js.map +1 -1
- package/dist/presentation/cli/commands/run-command.d.ts +6 -8
- package/dist/presentation/cli/commands/run-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/run-command.js +182 -23
- package/dist/presentation/cli/commands/run-command.js.map +1 -1
- 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.map +1 -1
- package/dist/presentation/cli/commands/smart-command.js +74 -6
- package/dist/presentation/cli/commands/smart-command.js.map +1 -1
- package/dist/presentation/cli/commands/status-command.d.ts +3 -0
- package/dist/presentation/cli/commands/status-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/status-command.js +151 -156
- package/dist/presentation/cli/commands/status-command.js.map +1 -1
- package/dist/presentation/cli/commands/suggest-command.d.ts +3 -5
- package/dist/presentation/cli/commands/suggest-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/suggest-command.js +132 -19
- package/dist/presentation/cli/commands/suggest-command.js.map +1 -1
- package/dist/presentation/cli/error-display.d.ts.map +1 -1
- package/dist/presentation/cli/error-display.js +75 -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 +55 -7
- 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 +54 -1
- package/dist/ui.js.map +1 -1
- package/package.json +14 -4
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ 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
8
|
import { executeAskCommand } from './presentation/cli/commands/ask-command.js';
|
|
8
9
|
import { executeReactCommand } from './presentation/cli/commands/react-command.js';
|
|
@@ -20,11 +21,16 @@ import { executeOrchestrateCommand } from './presentation/cli/commands/orchestra
|
|
|
20
21
|
import { executeDocsCommand } from './presentation/cli/commands/docs-command.js';
|
|
21
22
|
import { executeProductCommand } from './presentation/cli/commands/product-command.js';
|
|
22
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';
|
|
23
28
|
import { executeDecisionCommand } from './presentation/cli/commands/decision-command.js';
|
|
24
29
|
import { executeKnowledgeCommand } from './presentation/cli/commands/knowledge-command.js';
|
|
25
30
|
import { executeLearningDashboardCommand } from './presentation/cli/commands/learning-dashboard-command.js';
|
|
26
31
|
import { executeTraceCommand } from './presentation/cli/commands/trace-command.js';
|
|
27
32
|
import { executeUndoCommand } from './presentation/cli/commands/undo-command.js';
|
|
33
|
+
import { executeMemoryCommand } from './presentation/cli/commands/memory-command.js';
|
|
28
34
|
import { reviewFile, formatReview } from './review.js';
|
|
29
35
|
import { formatLearningInsights, getPerformanceInsights } from './learning.js';
|
|
30
36
|
import { getCacheStats, clearAllCaches } from './cache.js';
|
|
@@ -33,7 +39,8 @@ import { generateTests, getTestFilePath, saveTests, improveTests } from './testg
|
|
|
33
39
|
import { startSession } from './session.js';
|
|
34
40
|
import { cleanResponse } from './formatter.js';
|
|
35
41
|
import { displayError } from './presentation/cli/error-display.js';
|
|
36
|
-
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';
|
|
37
44
|
// Load environment variables - try agent directory first, then current directory
|
|
38
45
|
try {
|
|
39
46
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -133,6 +140,90 @@ program
|
|
|
133
140
|
.action(async (action, key, value) => {
|
|
134
141
|
await executeConfigCommand(action, key, value);
|
|
135
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
|
+
});
|
|
136
227
|
program
|
|
137
228
|
.command('help')
|
|
138
229
|
.description('Show help for commands')
|
|
@@ -146,7 +237,8 @@ program
|
|
|
146
237
|
.option('-r, --repo <path>', 'Repository path (default: current directory)')
|
|
147
238
|
.action(async (options) => {
|
|
148
239
|
initLogFile();
|
|
149
|
-
|
|
240
|
+
// Allow fake AI for testing, or require real API key
|
|
241
|
+
if (!process.env.COHERE_API_KEY && process.env.CODEHERE_FAKE_AI !== '1') {
|
|
150
242
|
newline();
|
|
151
243
|
console.error(error('COHERE_API_KEY not found in environment'));
|
|
152
244
|
newline();
|
|
@@ -155,12 +247,20 @@ program
|
|
|
155
247
|
console.log(' 2. Create a .env file in your project root:');
|
|
156
248
|
console.log(colors.cyan(' echo "COHERE_API_KEY=your_key_here" > .env'));
|
|
157
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'));
|
|
158
252
|
newline();
|
|
159
253
|
process.exit(1);
|
|
160
254
|
}
|
|
161
255
|
try {
|
|
162
|
-
|
|
163
|
-
|
|
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
|
+
}
|
|
164
264
|
const repoPath = options.repo || process.cwd();
|
|
165
265
|
// NEW: Use parallel indexing with caching
|
|
166
266
|
await indexRepositoryParallel(repoPath, {
|
|
@@ -173,10 +273,32 @@ program
|
|
|
173
273
|
policyStatus: 'allowed',
|
|
174
274
|
});
|
|
175
275
|
newline();
|
|
176
|
-
|
|
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);
|
|
177
283
|
}
|
|
178
284
|
catch (err) {
|
|
179
|
-
|
|
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
|
+
}
|
|
180
302
|
process.exit(1);
|
|
181
303
|
}
|
|
182
304
|
});
|
|
@@ -185,22 +307,28 @@ program
|
|
|
185
307
|
.description('Ask questions about your codebase using semantic search')
|
|
186
308
|
.argument('<question>', 'The question to ask about your code')
|
|
187
309
|
.alias('q')
|
|
310
|
+
.option('--explain', 'Show explainable AI (XAI) reasoning steps')
|
|
311
|
+
.option('--json', 'Output in JSON format')
|
|
188
312
|
.addHelpText('after', `
|
|
189
313
|
Examples:
|
|
190
314
|
$ codehere ask "How does authentication work?"
|
|
191
|
-
$ codehere ask "Where is the user login function?"
|
|
315
|
+
$ codehere ask "Where is the user login function?" --explain
|
|
192
316
|
$ codehere q "Explain the database schema"
|
|
193
317
|
|
|
194
318
|
This command will:
|
|
195
319
|
• Search your indexed codebase for relevant code
|
|
196
320
|
• Use AI to generate a contextual answer
|
|
197
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
|
|
198
326
|
|
|
199
327
|
Make sure to run "codehere index" first!
|
|
200
328
|
`)
|
|
201
|
-
.action(async (question) => {
|
|
329
|
+
.action(async (question, options) => {
|
|
202
330
|
initLogFile();
|
|
203
|
-
if (!process.env.COHERE_API_KEY) {
|
|
331
|
+
if (!process.env.COHERE_API_KEY && process.env.CODEHERE_FAKE_AI !== '1') {
|
|
204
332
|
newline();
|
|
205
333
|
console.error(error('COHERE_API_KEY not found in environment'));
|
|
206
334
|
newline();
|
|
@@ -213,21 +341,7 @@ Make sure to run "codehere index" first!
|
|
|
213
341
|
process.exit(1);
|
|
214
342
|
}
|
|
215
343
|
try {
|
|
216
|
-
|
|
217
|
-
newline();
|
|
218
|
-
// Display query
|
|
219
|
-
console.log(colors.bold('Query:'));
|
|
220
|
-
console.log(colors.cyan(' ' + question));
|
|
221
|
-
newline();
|
|
222
|
-
// Use clean architecture
|
|
223
|
-
const searchSpinner = createSpinner('Searching codebase...');
|
|
224
|
-
searchSpinner.start();
|
|
225
|
-
try {
|
|
226
|
-
await executeAskCommand(question);
|
|
227
|
-
}
|
|
228
|
-
finally {
|
|
229
|
-
searchSpinner.stop();
|
|
230
|
-
}
|
|
344
|
+
await executeAskCommand(question, { explain: options?.explain, json: options?.json });
|
|
231
345
|
logEntry({
|
|
232
346
|
timestamp: new Date().toISOString(),
|
|
233
347
|
command: 'ask',
|
|
@@ -236,7 +350,12 @@ Make sure to run "codehere index" first!
|
|
|
236
350
|
});
|
|
237
351
|
}
|
|
238
352
|
catch (err) {
|
|
239
|
-
|
|
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);
|
|
240
359
|
process.exit(1);
|
|
241
360
|
}
|
|
242
361
|
});
|
|
@@ -282,6 +401,23 @@ Safety policies:
|
|
|
282
401
|
process.exit(1);
|
|
283
402
|
}
|
|
284
403
|
try {
|
|
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) {
|
|
410
|
+
newline();
|
|
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.');
|
|
417
|
+
newline();
|
|
418
|
+
process.exit(1);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
285
421
|
await executeFixCommand(file, instruction, { review: options?.review });
|
|
286
422
|
logEntry({
|
|
287
423
|
timestamp: new Date().toISOString(),
|
|
@@ -332,8 +468,30 @@ This command will:
|
|
|
332
468
|
process.exit(1);
|
|
333
469
|
}
|
|
334
470
|
try {
|
|
335
|
-
|
|
336
|
-
|
|
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
|
+
}
|
|
337
495
|
const fullPath = join(process.cwd(), file);
|
|
338
496
|
// Check if file exists
|
|
339
497
|
const { existsSync } = await import('fs');
|
|
@@ -383,9 +541,14 @@ program
|
|
|
383
541
|
.option('-m, --metrics', 'Show detailed metrics')
|
|
384
542
|
.action((options) => {
|
|
385
543
|
const health = performHealthCheck();
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
544
|
+
if (isMinimalStyle()) {
|
|
545
|
+
printMinimalHeader('health', '');
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
newline();
|
|
549
|
+
console.log(createBanner('System Health', 'Enterprise monitoring'));
|
|
550
|
+
newline();
|
|
551
|
+
}
|
|
389
552
|
console.log(formatHealthStatus(health));
|
|
390
553
|
if (options.metrics) {
|
|
391
554
|
newline();
|
|
@@ -486,13 +649,13 @@ program
|
|
|
486
649
|
}
|
|
487
650
|
});
|
|
488
651
|
program
|
|
489
|
-
.command('review')
|
|
652
|
+
.command('git-review')
|
|
490
653
|
.description('Review git changes and suggest improvements')
|
|
491
654
|
.option('-f, --file <file>', 'Review specific file')
|
|
492
655
|
.action((options) => {
|
|
493
656
|
initLogFile();
|
|
494
657
|
try {
|
|
495
|
-
console.log(createBanner('
|
|
658
|
+
console.log(createBanner('Git Review', 'Git-aware code analysis'));
|
|
496
659
|
newline();
|
|
497
660
|
const status = getGitStatus();
|
|
498
661
|
if (!status.isRepo) {
|
|
@@ -542,6 +705,7 @@ program
|
|
|
542
705
|
.argument('<instruction>', 'Complex instruction to plan')
|
|
543
706
|
.option('-e, --execute', 'Execute the plan after creating it')
|
|
544
707
|
.option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
|
|
708
|
+
.option('--json', 'Output in JSON format')
|
|
545
709
|
.action(async (instruction, options) => {
|
|
546
710
|
initLogFile();
|
|
547
711
|
if (!process.env.COHERE_API_KEY) {
|
|
@@ -549,12 +713,20 @@ program
|
|
|
549
713
|
process.exit(1);
|
|
550
714
|
}
|
|
551
715
|
try {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
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
|
+
}
|
|
556
728
|
// Use new memory-based planning
|
|
557
|
-
await executePlanCommand(instruction, { execute: options.execute, review: options.review });
|
|
729
|
+
await executePlanCommand(instruction, { execute: options.execute, review: options.review, json: options.json });
|
|
558
730
|
}
|
|
559
731
|
catch (err) {
|
|
560
732
|
console.error(error('Error:'), err instanceof Error ? err.message : String(err));
|
|
@@ -633,24 +805,38 @@ program
|
|
|
633
805
|
process.exit(1);
|
|
634
806
|
}
|
|
635
807
|
try {
|
|
636
|
-
|
|
637
|
-
|
|
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
|
+
}
|
|
638
816
|
const reviewSpinner = createSpinner('Reviewing code...');
|
|
639
817
|
reviewSpinner.start();
|
|
640
818
|
const review = await reviewFile(file);
|
|
641
819
|
reviewSpinner.stop();
|
|
642
820
|
newline();
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
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
|
+
}
|
|
654
840
|
}
|
|
655
841
|
catch (err) {
|
|
656
842
|
console.error(error('Error:'), err instanceof Error ? err.message : String(err));
|
|
@@ -820,10 +1006,157 @@ Warning: This command may create new files if --output is specified.
|
|
|
820
1006
|
// Status command
|
|
821
1007
|
program
|
|
822
1008
|
.command('status')
|
|
823
|
-
.description('Show
|
|
1009
|
+
.description('Show system status and optionally list recent tasks')
|
|
824
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)')
|
|
825
1014
|
.action(async (options) => {
|
|
826
|
-
await executeStatusCommand({
|
|
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) => {
|
|
1040
|
+
initLogFile();
|
|
1041
|
+
if (!process.env.COHERE_API_KEY) {
|
|
1042
|
+
newline();
|
|
1043
|
+
console.error(error('COHERE_API_KEY not found in environment'));
|
|
1044
|
+
process.exit(1);
|
|
1045
|
+
}
|
|
1046
|
+
try {
|
|
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);
|
|
1063
|
+
}
|
|
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) {
|
|
1092
|
+
newline();
|
|
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
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
catch (err) {
|
|
1157
|
+
console.error(error('Error:'), err instanceof Error ? err.message : String(err));
|
|
1158
|
+
process.exit(1);
|
|
1159
|
+
}
|
|
827
1160
|
});
|
|
828
1161
|
program
|
|
829
1162
|
.command('test')
|
|
@@ -917,6 +1250,7 @@ This command uses ReAct (Reasoning + Acting) pattern:
|
|
|
917
1250
|
});
|
|
918
1251
|
program
|
|
919
1252
|
.command('orchestrate')
|
|
1253
|
+
.option('--json', 'Output in JSON format')
|
|
920
1254
|
.description('Orchestrate multi-agent workflows (plan, execute, validate)')
|
|
921
1255
|
.argument('<goal>', 'The goal to orchestrate')
|
|
922
1256
|
.option('-m, --mode <mode>', 'Orchestration mode: plan-only, execute-only, or full', 'full')
|
|
@@ -934,6 +1268,7 @@ program
|
|
|
934
1268
|
mode: options.mode,
|
|
935
1269
|
planId: options.planId,
|
|
936
1270
|
review: options.review,
|
|
1271
|
+
json: options.json,
|
|
937
1272
|
});
|
|
938
1273
|
logEntry({
|
|
939
1274
|
timestamp: new Date().toISOString(),
|
|
@@ -1050,5 +1385,23 @@ program
|
|
|
1050
1385
|
process.exit(1);
|
|
1051
1386
|
}
|
|
1052
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
|
+
}
|
|
1053
1406
|
program.parse();
|
|
1054
1407
|
//# sourceMappingURL=index.js.map
|