codehere 1.0.1 → 1.0.3
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 +35 -193
- package/dist/application/use-cases/check-claimed-tests.js +81 -0
- package/dist/application/use-cases/detect-test-weakening.js +237 -0
- package/dist/application/use-cases/rerun-tests.js +110 -7
- package/dist/index.js +38 -1212
- package/dist/infrastructure/orchestration/artifacts-extractor.js +2 -323
- package/dist/presentation/cli/commands/check-command.js +178 -23
- package/dist/presentation/cli/commands/help-command.js +21 -285
- package/dist/ui.js +5 -236
- package/dist/utils/version.js +0 -6
- package/package.json +9 -38
- package/dist/application/services/verdict-service.js +0 -154
- package/dist/application/use-cases/assess-cross-vendor.js +0 -126
- package/dist/application/use-cases/build-cross-vendor-verdict.js +0 -118
- package/dist/application/use-cases/domain-trust.js +0 -110
- package/dist/application/use-cases/export-aat.js +0 -107
- package/dist/application/use-cases/generate-acceptance-criteria.js +0 -223
- package/dist/application/use-cases/generate-final-report.js +0 -259
- package/dist/application/use-cases/generate-narration.js +0 -130
- package/dist/application/use-cases/generate-thread-title.js +0 -181
- package/dist/application/use-cases/narrator-prompt-template.js +0 -158
- package/dist/application/use-cases/plan-auto-review.js +0 -57
- package/dist/application/use-cases/reconcile-audit.js +0 -100
- package/dist/application/use-cases/search-sessions.js +0 -70
- package/dist/application/use-cases/should-auto-review.js +0 -71
- package/dist/application/use-cases/thread-export.js +0 -245
- package/dist/application/use-cases/verify-claim.js +0 -456
- package/dist/application/use-cases/write-pass.js +0 -277
- package/dist/domain/audit.js +0 -11
- package/dist/domain/services/codebase-detector.js +0 -85
- package/dist/domain/task.js +0 -91
- package/dist/error-handler.js +0 -139
- package/dist/infrastructure/completion/bash-completion.js +0 -29
- package/dist/infrastructure/completion/fish-completion.js +0 -17
- package/dist/infrastructure/completion/zsh-completion.js +0 -25
- package/dist/infrastructure/config/config-manager.js +0 -174
- package/dist/infrastructure/config/product-context.js +0 -49
- package/dist/infrastructure/context/adapters/drawio-source.js +0 -157
- package/dist/infrastructure/context/adapters/figma-source.js +0 -198
- package/dist/infrastructure/context/adapters/github-issue-source.js +0 -160
- package/dist/infrastructure/context/adapters/linear-source.js +0 -190
- package/dist/infrastructure/context/context-resolver.js +0 -144
- package/dist/infrastructure/context/context-source.js +0 -114
- package/dist/infrastructure/context/github-api.js +0 -110
- package/dist/infrastructure/context/github-device-flow.js +0 -65
- package/dist/infrastructure/context/oauth-flow.js +0 -207
- package/dist/infrastructure/context/oauth-store.js +0 -122
- package/dist/infrastructure/context/registry-bootstrap.js +0 -95
- package/dist/infrastructure/context/write-pass-resolver.js +0 -106
- package/dist/infrastructure/cost/budget-config.js +0 -114
- package/dist/infrastructure/cost/cost-router.js +0 -97
- package/dist/infrastructure/cost/spend-aggregator.js +0 -222
- package/dist/infrastructure/cost/team-ledger.js +0 -355
- package/dist/infrastructure/discovery/discovery-log.js +0 -85
- package/dist/infrastructure/hooks/audit-tip-signature.js +0 -336
- package/dist/infrastructure/hooks/claude-sdk-hook.js +0 -1018
- package/dist/infrastructure/hooks/hook-mode.js +0 -87
- package/dist/infrastructure/hooks/mirror-tool-call-to-audit.js +0 -49
- package/dist/infrastructure/hooks/pre-prompt-scan.js +0 -122
- package/dist/infrastructure/hooks/session-analyzer.js +0 -177
- package/dist/infrastructure/observability/execution-tracer.js +0 -227
- package/dist/infrastructure/orchestration/agent-adapter.js +0 -13
- package/dist/infrastructure/orchestration/agent-installer.js +0 -101
- package/dist/infrastructure/orchestration/agents-config-seed.js +0 -68
- package/dist/infrastructure/orchestration/aider-adapter.js +0 -611
- package/dist/infrastructure/orchestration/cassette-recorder.js +0 -120
- package/dist/infrastructure/orchestration/claude-code-adapter.js +0 -592
- package/dist/infrastructure/orchestration/codex-adapter.js +0 -574
- package/dist/infrastructure/orchestration/conductor-adapter.js +0 -416
- package/dist/infrastructure/orchestration/context-handoff.js +0 -162
- package/dist/infrastructure/orchestration/control/codex-control-surface.js +0 -99
- package/dist/infrastructure/orchestration/control/control-surface.js +0 -15
- package/dist/infrastructure/orchestration/detect-ollama.js +0 -75
- package/dist/infrastructure/orchestration/failover-classifier.js +0 -151
- package/dist/infrastructure/orchestration/failover-config.js +0 -67
- package/dist/infrastructure/orchestration/failover-policy.js +0 -106
- package/dist/infrastructure/orchestration/gemini-adapter.js +0 -663
- package/dist/infrastructure/orchestration/generic-cli-adapter.js +0 -689
- package/dist/infrastructure/orchestration/graphify-context.js +0 -209
- package/dist/infrastructure/orchestration/memory-injector.js +0 -380
- package/dist/infrastructure/orchestration/mocks/mock-agent-repl.js +0 -388
- package/dist/infrastructure/orchestration/mocks/mock-codex-app-server.js +0 -73
- package/dist/infrastructure/orchestration/mocks/mock-synthesis.js +0 -83
- package/dist/infrastructure/orchestration/mocks/resolve-agent-spawn.js +0 -37
- package/dist/infrastructure/orchestration/opencode-adapter.js +0 -580
- package/dist/infrastructure/orchestration/progress-aggregator.js +0 -906
- package/dist/infrastructure/orchestration/readiness.js +0 -103
- package/dist/infrastructure/orchestration/session-manager.js +0 -1590
- package/dist/infrastructure/orchestration/session-persistence.js +0 -394
- package/dist/infrastructure/orchestration/thread-key-store.js +0 -127
- package/dist/infrastructure/orchestration/write-pass-store.js +0 -38
- package/dist/infrastructure/protocols/cloud-sync.js +0 -207
- package/dist/infrastructure/protocols/mcp-helpers.js +0 -25
- package/dist/infrastructure/protocols/mcp-server-impl.js +0 -3935
- package/dist/infrastructure/protocols/mcp-tools.js +0 -401
- package/dist/infrastructure/protocols/probe-port.js +0 -36
- package/dist/infrastructure/protocols/thread-phase.js +0 -105
- package/dist/infrastructure/protocols/ui/app-script-artifacts.js +0 -121
- package/dist/infrastructure/protocols/ui/app-script-audit-footer.js +0 -44
- package/dist/infrastructure/protocols/ui/app-script-audit-verify.js +0 -56
- package/dist/infrastructure/protocols/ui/app-script-composer-cost.js +0 -588
- package/dist/infrastructure/protocols/ui/app-script-context-sources.js +0 -168
- package/dist/infrastructure/protocols/ui/app-script-conversation.js +0 -67
- package/dist/infrastructure/protocols/ui/app-script-drawer.js +0 -115
- package/dist/infrastructure/protocols/ui/app-script-failover.js +0 -133
- package/dist/infrastructure/protocols/ui/app-script-github.js +0 -113
- package/dist/infrastructure/protocols/ui/app-script-observer.js +0 -104
- package/dist/infrastructure/protocols/ui/app-script-onboarding.js +0 -80
- package/dist/infrastructure/protocols/ui/app-script-overlay.js +0 -203
- package/dist/infrastructure/protocols/ui/app-script-recovery.js +0 -136
- package/dist/infrastructure/protocols/ui/app-script-render.js +0 -166
- package/dist/infrastructure/protocols/ui/app-script-share.js +0 -78
- package/dist/infrastructure/protocols/ui/app-script-sidebar.js +0 -194
- package/dist/infrastructure/protocols/ui/app-script-tour.js +0 -78
- package/dist/infrastructure/protocols/ui/app-script-wpass.js +0 -312
- package/dist/infrastructure/protocols/ui/app-script.js +0 -2998
- package/dist/infrastructure/protocols/ui/font-faces.js +0 -7
- package/dist/infrastructure/protocols/ui/styles.js +0 -2147
- package/dist/infrastructure/protocols/ui/tokens.js +0 -96
- package/dist/infrastructure/protocols/ui-page-v2.js +0 -320
- package/dist/infrastructure/protocols/verify-page.js +0 -1677
- package/dist/infrastructure/security/file-collection.js +0 -118
- package/dist/infrastructure/security/fix-code.js +0 -144
- package/dist/infrastructure/security/fix-secret.js +0 -89
- package/dist/infrastructure/security/permissions-config.js +0 -235
- package/dist/infrastructure/security/scan-types.js +0 -10
- package/dist/infrastructure/security/ship-scan.js +0 -195
- package/dist/infrastructure/security/trust-scorer.js +0 -724
- package/dist/infrastructure/security/vibe-checks.js +0 -99
- package/dist/infrastructure/storage/atomic-write.js +0 -86
- package/dist/infrastructure/storage/cross-tool-agents.js +0 -268
- package/dist/infrastructure/storage/project-thread-migration.js +0 -237
- package/dist/infrastructure/storage/project-thread-mirror.js +0 -671
- package/dist/infrastructure/storage/project-thread-reader.js +0 -409
- package/dist/infrastructure/storage/project-thread-title-backfill.js +0 -214
- package/dist/monitoring.js +0 -212
- package/dist/presentation/cli/commands/audit-command.js +0 -201
- package/dist/presentation/cli/commands/budget-command.js +0 -79
- package/dist/presentation/cli/commands/config-command.js +0 -125
- package/dist/presentation/cli/commands/context-source-command.js +0 -217
- package/dist/presentation/cli/commands/hook-command.js +0 -265
- package/dist/presentation/cli/commands/init-command.js +0 -590
- package/dist/presentation/cli/commands/memory-command.js +0 -1031
- package/dist/presentation/cli/commands/narrator-command.js +0 -101
- package/dist/presentation/cli/commands/permission-command.js +0 -105
- package/dist/presentation/cli/commands/protocols-builder.js +0 -254
- package/dist/presentation/cli/commands/protocols-command.js +0 -84
- package/dist/presentation/cli/commands/repo-map-builder.js +0 -247
- package/dist/presentation/cli/commands/report-command.js +0 -403
- package/dist/presentation/cli/commands/scan-command.js +0 -52
- package/dist/presentation/cli/commands/scan-tool-command.js +0 -110
- package/dist/presentation/cli/commands/search-command.js +0 -51
- package/dist/presentation/cli/commands/setup-command.js +0 -330
- package/dist/presentation/cli/commands/status-command.js +0 -614
- package/dist/presentation/cli/commands/team-command.js +0 -256
- package/dist/presentation/cli/commands/thread-command.js +0 -370
- package/dist/presentation/cli/commands/trust-command.js +0 -328
- package/dist/presentation/cli/commands/verify-command.js +0 -298
- package/dist/presentation/cli/error-display.js +0 -328
- package/dist/presentation/cli/repl.js +0 -805
- package/dist/presentation/cli/task-deliverable.js +0 -153
- package/dist/testing/cassette.js +0 -125
- package/dist/testing/replay-adapter.js +0 -147
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized Error Display Utility
|
|
3
|
-
* Provides consistent, helpful error messages with recovery suggestions
|
|
4
|
-
*
|
|
5
|
-
* Clean Architecture: Presentation Layer
|
|
6
|
-
*/
|
|
7
|
-
import { ErrorType, classifyError, EnterpriseError } from '../../error-handler.js';
|
|
8
|
-
import { colors, separator, newline, symbols } from '../../ui.js';
|
|
9
|
-
/**
|
|
10
|
-
* Determine error severity based on error type
|
|
11
|
-
*/
|
|
12
|
-
function getErrorSeverity(errorType) {
|
|
13
|
-
switch (errorType) {
|
|
14
|
-
case ErrorType.FATAL:
|
|
15
|
-
case ErrorType.POLICY:
|
|
16
|
-
return 'critical';
|
|
17
|
-
case ErrorType.RATE_LIMIT:
|
|
18
|
-
case ErrorType.API_ERROR:
|
|
19
|
-
case ErrorType.VALIDATION:
|
|
20
|
-
return 'warning';
|
|
21
|
-
case ErrorType.NETWORK:
|
|
22
|
-
case ErrorType.RETRYABLE:
|
|
23
|
-
return 'info';
|
|
24
|
-
default:
|
|
25
|
-
return 'warning';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Get severity label (text-based, enterprise-grade)
|
|
30
|
-
*/
|
|
31
|
-
function getSeverityLabel(severity) {
|
|
32
|
-
switch (severity) {
|
|
33
|
-
case 'critical':
|
|
34
|
-
return colors.red('[CRITICAL] Error:');
|
|
35
|
-
case 'warning':
|
|
36
|
-
return colors.yellow('[WARNING] Error:');
|
|
37
|
-
case 'info':
|
|
38
|
-
return colors.cyan('[INFO] Error:');
|
|
39
|
-
default:
|
|
40
|
-
return colors.red('Error:');
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Extract file path from error message
|
|
45
|
-
*/
|
|
46
|
-
function extractFilePath(errorMessage) {
|
|
47
|
-
// Patterns: "File not found: path/to/file", "in path/to/file", "at path/to/file"
|
|
48
|
-
const patterns = [
|
|
49
|
-
/(?:File|file)\s+(?:not found|error|issue)[:\s]+([^\s]+)/i,
|
|
50
|
-
/(?:in|at)\s+([^\s]+\.(ts|js|py|json|md|yaml|yml))/i,
|
|
51
|
-
/([^\s]+\.(ts|js|py|json|md|yaml|yml)(?::\d+)?)/i,
|
|
52
|
-
];
|
|
53
|
-
for (const pattern of patterns) {
|
|
54
|
-
const match = errorMessage.match(pattern);
|
|
55
|
-
if (match && match[1]) {
|
|
56
|
-
return match[1].replace(/^["']|["']$/g, ''); // Remove quotes
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Extract line number from error message
|
|
63
|
-
*/
|
|
64
|
-
function extractLineNumber(errorMessage) {
|
|
65
|
-
// Patterns: "line 42", ":42", "at line 42"
|
|
66
|
-
const patterns = [/(?:line|Line)\s+(\d+)/i, /:(\d+):/, /\((\d+)\)/];
|
|
67
|
-
for (const pattern of patterns) {
|
|
68
|
-
const match = errorMessage.match(pattern);
|
|
69
|
-
if (match && match[1]) {
|
|
70
|
-
const line = parseInt(match[1], 10);
|
|
71
|
-
if (!isNaN(line) && line > 0) {
|
|
72
|
-
return line;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return undefined;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Get recovery commands based on error type and context
|
|
80
|
-
*/
|
|
81
|
-
function getRecoveryCommands(errorType, errorMessage, context) {
|
|
82
|
-
const commands = [];
|
|
83
|
-
const lowerMessage = errorMessage.toLowerCase();
|
|
84
|
-
switch (errorType) {
|
|
85
|
-
case ErrorType.VALIDATION:
|
|
86
|
-
if (lowerMessage.includes('file') || lowerMessage.includes('not found')) {
|
|
87
|
-
if (context.filepath) {
|
|
88
|
-
commands.push(`codehere trust ${context.filepath}`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
break;
|
|
92
|
-
case ErrorType.API_ERROR:
|
|
93
|
-
if (lowerMessage.includes('api') || lowerMessage.includes('key')) {
|
|
94
|
-
commands.push('codehere setup');
|
|
95
|
-
commands.push('codehere config --help');
|
|
96
|
-
}
|
|
97
|
-
break;
|
|
98
|
-
case ErrorType.POLICY:
|
|
99
|
-
if (context.filepath) {
|
|
100
|
-
commands.push(`codehere trust ${context.filepath}`);
|
|
101
|
-
commands.push('codehere config policies');
|
|
102
|
-
}
|
|
103
|
-
break;
|
|
104
|
-
case ErrorType.RATE_LIMIT:
|
|
105
|
-
commands.push('codehere config --help');
|
|
106
|
-
break;
|
|
107
|
-
default:
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
return commands;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Get help command for operation (Task 7.3: Contextual Help Integration)
|
|
114
|
-
*/
|
|
115
|
-
function getHelpCommandForOperation(operation) {
|
|
116
|
-
const operationLower = operation.toLowerCase();
|
|
117
|
-
// Map operations to help commands
|
|
118
|
-
if (operationLower.includes('ask') || operationLower.includes('question')) {
|
|
119
|
-
return 'ask';
|
|
120
|
-
}
|
|
121
|
-
if (operationLower.includes('explain')) {
|
|
122
|
-
return 'explain';
|
|
123
|
-
}
|
|
124
|
-
if (operationLower.includes('plan')) {
|
|
125
|
-
return 'plan';
|
|
126
|
-
}
|
|
127
|
-
if (operationLower.includes('orchestrate')) {
|
|
128
|
-
return 'orchestrate';
|
|
129
|
-
}
|
|
130
|
-
if (operationLower.includes('react')) {
|
|
131
|
-
return 'react';
|
|
132
|
-
}
|
|
133
|
-
if (operationLower.includes('index')) {
|
|
134
|
-
return 'index';
|
|
135
|
-
}
|
|
136
|
-
if (operationLower.includes('setup') || operationLower.includes('config')) {
|
|
137
|
-
return 'setup';
|
|
138
|
-
}
|
|
139
|
-
if (operationLower.includes('undo')) {
|
|
140
|
-
return 'undo';
|
|
141
|
-
}
|
|
142
|
-
if (operationLower.includes('trace')) {
|
|
143
|
-
return 'trace';
|
|
144
|
-
}
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Get documentation link for error type
|
|
149
|
-
*/
|
|
150
|
-
function getDocumentationLink(errorType) {
|
|
151
|
-
const baseUrl = 'https://docs.codehere.dev';
|
|
152
|
-
switch (errorType) {
|
|
153
|
-
case ErrorType.POLICY:
|
|
154
|
-
return `${baseUrl}/security-policies`;
|
|
155
|
-
case ErrorType.API_ERROR:
|
|
156
|
-
case ErrorType.RATE_LIMIT:
|
|
157
|
-
return `${baseUrl}/setup/api-keys`;
|
|
158
|
-
case ErrorType.VALIDATION:
|
|
159
|
-
return `${baseUrl}/troubleshooting`;
|
|
160
|
-
case ErrorType.NETWORK:
|
|
161
|
-
return `${baseUrl}/troubleshooting/network`;
|
|
162
|
-
default:
|
|
163
|
-
return undefined;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Generate error code for troubleshooting
|
|
168
|
-
*/
|
|
169
|
-
function generateErrorCode(errorType, errorMessage) {
|
|
170
|
-
const prefix = errorType.toUpperCase().substring(0, 3);
|
|
171
|
-
const hash = errorMessage.split('').reduce((acc, char) => {
|
|
172
|
-
return (acc << 5) - acc + char.charCodeAt(0);
|
|
173
|
-
}, 0);
|
|
174
|
-
const code = Math.abs(hash).toString(16).substring(0, 4).toUpperCase();
|
|
175
|
-
return `${prefix}-${code}`;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Display error with helpful context and recovery suggestions
|
|
179
|
-
*/
|
|
180
|
-
export function displayError(error, options = {}) {
|
|
181
|
-
const { operation = 'operation', query, showSuggestions = true, showStack = false } = options;
|
|
182
|
-
const errorType = classifyError(error);
|
|
183
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
184
|
-
const isEnterpriseError = error instanceof EnterpriseError;
|
|
185
|
-
// Generate error code for troubleshooting
|
|
186
|
-
const errorCode = generateErrorCode(errorType, errorMessage);
|
|
187
|
-
// Determine error severity (based on error type)
|
|
188
|
-
const severity = getErrorSeverity(errorType);
|
|
189
|
-
// Extract file/line context from error message or options
|
|
190
|
-
const fileContext = options.filepath || extractFilePath(errorMessage);
|
|
191
|
-
const lineContext = options.lineNumber || extractLineNumber(errorMessage);
|
|
192
|
-
// Display error header
|
|
193
|
-
newline();
|
|
194
|
-
console.log(separator('═', 80));
|
|
195
|
-
// Show severity indicator (text-based, no emojis for enterprise)
|
|
196
|
-
const severityLabel = getSeverityLabel(severity);
|
|
197
|
-
if (severityLabel) {
|
|
198
|
-
console.log(severityLabel + ` ${errorMessage}`);
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
console.log(colors.red(`Error: ${errorMessage}`));
|
|
202
|
-
}
|
|
203
|
-
if (errorCode) {
|
|
204
|
-
console.log(colors.dim(`Error Code: ${errorCode}`));
|
|
205
|
-
}
|
|
206
|
-
// Show file/line context if available
|
|
207
|
-
if (fileContext) {
|
|
208
|
-
console.log(colors.dim(`File: ${fileContext}${lineContext ? `:${lineContext}` : ''}`));
|
|
209
|
-
}
|
|
210
|
-
console.log(separator('═', 80));
|
|
211
|
-
newline();
|
|
212
|
-
// Show error type if it's an EnterpriseError
|
|
213
|
-
if (isEnterpriseError) {
|
|
214
|
-
console.log(colors.dim(`Type: ${errorType}`));
|
|
215
|
-
if (error.context?.attempt !== undefined) {
|
|
216
|
-
console.log(colors.dim(`Attempt: ${error.context.attempt + 1}/${error.context.maxRetries || '?'}`));
|
|
217
|
-
}
|
|
218
|
-
newline();
|
|
219
|
-
}
|
|
220
|
-
// Show suggestions based on error type
|
|
221
|
-
if (showSuggestions) {
|
|
222
|
-
const suggestions = getErrorSuggestions(errorType, errorMessage, { operation, query, filepath: fileContext });
|
|
223
|
-
if (suggestions.length > 0) {
|
|
224
|
-
console.log(colors.bold('Suggestions:'));
|
|
225
|
-
suggestions.forEach((suggestion) => {
|
|
226
|
-
console.log(colors.dim(` ${symbols.bullet} ${suggestion}`));
|
|
227
|
-
});
|
|
228
|
-
newline();
|
|
229
|
-
}
|
|
230
|
-
// Show recovery commands for certain error types
|
|
231
|
-
const recoveryCommands = getRecoveryCommands(errorType, errorMessage, {
|
|
232
|
-
operation,
|
|
233
|
-
query,
|
|
234
|
-
filepath: fileContext,
|
|
235
|
-
lineNumber: lineContext,
|
|
236
|
-
});
|
|
237
|
-
if (recoveryCommands.length > 0) {
|
|
238
|
-
console.log(colors.bold('Recovery Commands:'));
|
|
239
|
-
recoveryCommands.forEach((cmd) => {
|
|
240
|
-
console.log(colors.cyan(` $ ${cmd}`));
|
|
241
|
-
});
|
|
242
|
-
newline();
|
|
243
|
-
}
|
|
244
|
-
// Show documentation link for complex errors
|
|
245
|
-
const docLink = getDocumentationLink(errorType);
|
|
246
|
-
if (docLink) {
|
|
247
|
-
console.log(colors.dim(`Learn More: ${docLink}`));
|
|
248
|
-
newline();
|
|
249
|
-
}
|
|
250
|
-
// Contextual help suggestion (Task 7.3: Contextual Help Integration)
|
|
251
|
-
if (operation) {
|
|
252
|
-
const helpCommand = getHelpCommandForOperation(operation);
|
|
253
|
-
if (helpCommand) {
|
|
254
|
-
console.log(colors.dim(`Get help: ${colors.cyan(`codehere help ${helpCommand}`)}`));
|
|
255
|
-
newline();
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
// Show stack trace if requested (for debugging)
|
|
260
|
-
if (showStack && error instanceof Error && error.stack) {
|
|
261
|
-
console.log(colors.dim('Stack trace:'));
|
|
262
|
-
console.log(colors.dim(error.stack));
|
|
263
|
-
newline();
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Get recovery suggestions based on error type
|
|
268
|
-
*/
|
|
269
|
-
function getErrorSuggestions(errorType, errorMessage, _context) {
|
|
270
|
-
const suggestions = [];
|
|
271
|
-
const lowerMessage = errorMessage.toLowerCase();
|
|
272
|
-
switch (errorType) {
|
|
273
|
-
case ErrorType.RATE_LIMIT:
|
|
274
|
-
suggestions.push("You've reached the API rate limit or monthly quota");
|
|
275
|
-
suggestions.push('Wait a moment and try again');
|
|
276
|
-
suggestions.push('Check your API key limits at: https://dashboard.cohere.com/api-keys');
|
|
277
|
-
suggestions.push('Consider upgrading your API key for higher limits');
|
|
278
|
-
break;
|
|
279
|
-
case ErrorType.API_ERROR:
|
|
280
|
-
case ErrorType.VALIDATION:
|
|
281
|
-
if (lowerMessage.includes('api') || lowerMessage.includes('key')) {
|
|
282
|
-
suggestions.push('Check your COHERE_API_KEY is set correctly');
|
|
283
|
-
suggestions.push('Verify your API key at: https://dashboard.cohere.com/api-keys');
|
|
284
|
-
suggestions.push('Make sure .env file exists in your project root');
|
|
285
|
-
suggestions.push('Run "codehere setup" to configure your API key');
|
|
286
|
-
suggestions.push('For troubleshooting, include the error code when reporting issues');
|
|
287
|
-
}
|
|
288
|
-
else if (lowerMessage.includes('not found') || lowerMessage.includes('missing')) {
|
|
289
|
-
suggestions.push("Make sure you're in the correct directory");
|
|
290
|
-
suggestions.push('Run "codehere trust ." to verify the path is scanned');
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
suggestions.push('Check the error message above for specific details');
|
|
294
|
-
suggestions.push('Run "codehere setup" to verify your configuration');
|
|
295
|
-
}
|
|
296
|
-
break;
|
|
297
|
-
case ErrorType.NETWORK:
|
|
298
|
-
suggestions.push('Check your internet connection');
|
|
299
|
-
suggestions.push('Verify the API service is accessible');
|
|
300
|
-
suggestions.push('Try again in a few moments');
|
|
301
|
-
break;
|
|
302
|
-
case ErrorType.POLICY:
|
|
303
|
-
suggestions.push('The operation was blocked by safety policies');
|
|
304
|
-
suggestions.push('Review the policy reason above');
|
|
305
|
-
suggestions.push('Modify your request to comply with safety rules');
|
|
306
|
-
break;
|
|
307
|
-
case ErrorType.FATAL:
|
|
308
|
-
suggestions.push('This is a fatal error that cannot be recovered');
|
|
309
|
-
suggestions.push('Check the error message for details');
|
|
310
|
-
suggestions.push('If this persists, please report the issue');
|
|
311
|
-
break;
|
|
312
|
-
default:
|
|
313
|
-
// Generic suggestions for retryable errors
|
|
314
|
-
if (lowerMessage.includes('file') || lowerMessage.includes('path')) {
|
|
315
|
-
suggestions.push('Verify the file path is correct');
|
|
316
|
-
suggestions.push('Check file permissions');
|
|
317
|
-
}
|
|
318
|
-
else if (lowerMessage.includes('memory') || lowerMessage.includes('database')) {
|
|
319
|
-
suggestions.push('Run "codehere health" to inspect runtime state');
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
322
|
-
suggestions.push('This error may be temporary - try again');
|
|
323
|
-
suggestions.push('Check the error message for specific details');
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
return suggestions;
|
|
327
|
-
}
|
|
328
|
-
//# sourceMappingURL=error-display.js.map
|