codehere 0.4.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 +7 -0
- package/dist/application/agents/execution-agent.js +2 -2
- package/dist/application/agents/execution-agent.js.map +1 -1
- package/dist/application/agents/planning-agent.d.ts.map +1 -1
- package/dist/application/agents/planning-agent.js +16 -8
- 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/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 +75 -43
- package/dist/application/services/dependency-container.js.map +1 -1
- package/dist/application/services/intelligent-router.d.ts.map +1 -1
- package/dist/application/services/intelligent-router.js +6 -3
- package/dist/application/services/intelligent-router.js.map +1 -1
- package/dist/domain/entities/task.d.ts.map +1 -1
- package/dist/domain/entities/task.js +1 -1
- 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/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 +308 -48
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.js +3 -3
- 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 +6 -6
- 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.js +2 -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 +94 -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/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 +399 -0
- package/dist/infrastructure/providers/openrouter-provider.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 +11 -0
- package/dist/infrastructure/storage/task-helpers.d.ts.map +1 -1
- package/dist/infrastructure/storage/task-helpers.js +47 -7
- package/dist/infrastructure/storage/task-helpers.js.map +1 -1
- package/dist/infrastructure/storage/task-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/task-repository.js.map +1 -1
- 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 +3 -5
- package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.js +34 -49
- 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.map +1 -1
- package/dist/presentation/cli/commands/ask-command.js +185 -128
- 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 +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 +25 -281
- package/dist/presentation/cli/commands/fix-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.map +1 -1
- package/dist/presentation/cli/commands/orchestrate-command.js +15 -7
- package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -1
- package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/plan-command.js +9 -6
- 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/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 +148 -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.js +1 -1
- 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 +147 -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/search.d.ts.map +1 -1
- package/dist/search.js +6 -1
- package/dist/search.js.map +1 -1
- package/dist/session.js +1 -1
- 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 +35 -1
- package/dist/ui.js.map +1 -1
- package/package.json +8 -3
|
@@ -2,171 +2,90 @@
|
|
|
2
2
|
* Syntax Highlighter for Terminal
|
|
3
3
|
* Provides basic syntax highlighting for code snippets using chalk
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* Supports: TypeScript, JavaScript, Python, JSON, YAML, Markdown, Shell
|
|
5
|
+
* Phase 1: v0.5.0-alpha.0
|
|
7
6
|
*/
|
|
8
7
|
import { colors } from '../../ui.js';
|
|
9
8
|
/**
|
|
10
9
|
* Detect language from file extension
|
|
11
10
|
*/
|
|
12
11
|
export function detectLanguage(filepath) {
|
|
13
|
-
const ext = filepath.split('.').pop()?.toLowerCase()
|
|
14
|
-
|
|
15
|
-
'ts':
|
|
16
|
-
'tsx':
|
|
17
|
-
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
|
|
21
|
-
'py':
|
|
22
|
-
|
|
23
|
-
'
|
|
24
|
-
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return lines.map(line => {
|
|
37
|
-
let highlighted = line;
|
|
38
|
-
// Keywords (const, let, var, function, class, interface, type, etc.)
|
|
39
|
-
highlighted = highlighted.replace(/\b(const|let|var|function|class|interface|type|enum|namespace|import|export|from|as|default|extends|implements|public|private|protected|static|readonly|async|await|return|if|else|for|while|switch|case|break|continue|try|catch|finally|throw|new|this|super|typeof|instanceof|in|of)\b/g, (match) => colors.magenta(match));
|
|
40
|
-
// Strings (single, double, template literals)
|
|
41
|
-
highlighted = highlighted.replace(/(['"`])((?:\\.|(?!\1)[^\\])*?)\1/g, (match) => colors.green(match));
|
|
42
|
-
// Numbers
|
|
43
|
-
highlighted = highlighted.replace(/\b(\d+\.?\d*)\b/g, (match) => colors.yellow(match));
|
|
44
|
-
// Comments
|
|
45
|
-
highlighted = highlighted.replace(/(\/\/.*$|\/\*[\s\S]*?\*\/)/gm, (match) => colors.dim(match));
|
|
46
|
-
// Function/class names (before opening paren)
|
|
47
|
-
highlighted = highlighted.replace(/\b([A-Z][a-zA-Z0-9]*)\s*(?=\()/g, (match) => colors.cyan(match.trim()));
|
|
48
|
-
return highlighted;
|
|
49
|
-
}).join('\n');
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Highlight Python code
|
|
53
|
-
*/
|
|
54
|
-
function highlightPython(code) {
|
|
55
|
-
const lines = code.split('\n');
|
|
56
|
-
return lines.map(line => {
|
|
57
|
-
let highlighted = line;
|
|
58
|
-
// Keywords
|
|
59
|
-
highlighted = highlighted.replace(/\b(def|class|if|elif|else|for|while|try|except|finally|with|import|from|as|return|yield|lambda|pass|break|continue|raise|assert|and|or|not|in|is|None|True|False)\b/g, (match) => colors.magenta(match));
|
|
60
|
-
// Strings
|
|
61
|
-
highlighted = highlighted.replace(/(['"])((?:\\.|(?!\1)[^\\])*?)\1/g, (match) => colors.green(match));
|
|
62
|
-
// Numbers
|
|
63
|
-
highlighted = highlighted.replace(/\b(\d+\.?\d*)\b/g, (match) => colors.yellow(match));
|
|
64
|
-
// Comments
|
|
65
|
-
highlighted = highlighted.replace(/(#.*$)/gm, (match) => colors.dim(match));
|
|
66
|
-
// Function/class names
|
|
67
|
-
highlighted = highlighted.replace(/\b(def|class)\s+([a-zA-Z_][a-zA-Z0-9_]*)/g, (match, keyword, name) => colors.magenta(keyword) + ' ' + colors.cyan(name));
|
|
68
|
-
return highlighted;
|
|
69
|
-
}).join('\n');
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Highlight JSON code
|
|
73
|
-
*/
|
|
74
|
-
function highlightJSON(code) {
|
|
75
|
-
const lines = code.split('\n');
|
|
76
|
-
return lines.map(line => {
|
|
77
|
-
let highlighted = line;
|
|
78
|
-
// Keys (before colon)
|
|
79
|
-
highlighted = highlighted.replace(/"([^"]+)":/g, (match, key) => colors.green(`"${key}"`) + colors.dim(':'));
|
|
80
|
-
// Strings
|
|
81
|
-
highlighted = highlighted.replace(/"([^"]+)"/g, (match, value) => {
|
|
82
|
-
// Don't highlight keys again
|
|
83
|
-
if (match.includes(':'))
|
|
84
|
-
return match;
|
|
85
|
-
return colors.green(match);
|
|
86
|
-
});
|
|
87
|
-
// Numbers
|
|
88
|
-
highlighted = highlighted.replace(/\b(\d+\.?\d*)\b/g, (match) => colors.yellow(match));
|
|
89
|
-
// Booleans/null
|
|
90
|
-
highlighted = highlighted.replace(/\b(true|false|null)\b/g, (match) => colors.magenta(match));
|
|
91
|
-
return highlighted;
|
|
92
|
-
}).join('\n');
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Highlight Shell/Bash code
|
|
96
|
-
*/
|
|
97
|
-
function highlightShell(code) {
|
|
98
|
-
const lines = code.split('\n');
|
|
99
|
-
return lines.map(line => {
|
|
100
|
-
let highlighted = line;
|
|
101
|
-
// Commands (first word)
|
|
102
|
-
highlighted = highlighted.replace(/^(\s*)([a-zA-Z_][a-zA-Z0-9_-]*)\s/, (match, indent, cmd) => indent + colors.cyan(cmd) + ' ');
|
|
103
|
-
// Variables
|
|
104
|
-
highlighted = highlighted.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g, (match) => colors.yellow(match));
|
|
105
|
-
// Strings
|
|
106
|
-
highlighted = highlighted.replace(/(['"])((?:\\.|(?!\1)[^\\])*?)\1/g, (match) => colors.green(match));
|
|
107
|
-
// Comments
|
|
108
|
-
highlighted = highlighted.replace(/(#.*$)/gm, (match) => colors.dim(match));
|
|
109
|
-
return highlighted;
|
|
110
|
-
}).join('\n');
|
|
12
|
+
const ext = filepath.split('.').pop()?.toLowerCase();
|
|
13
|
+
switch (ext) {
|
|
14
|
+
case 'ts':
|
|
15
|
+
case 'tsx':
|
|
16
|
+
return 'typescript';
|
|
17
|
+
case 'js':
|
|
18
|
+
case 'jsx':
|
|
19
|
+
return 'javascript';
|
|
20
|
+
case 'py':
|
|
21
|
+
return 'python';
|
|
22
|
+
case 'json':
|
|
23
|
+
return 'json';
|
|
24
|
+
case 'yaml':
|
|
25
|
+
case 'yml':
|
|
26
|
+
return 'yaml';
|
|
27
|
+
case 'md':
|
|
28
|
+
return 'markdown';
|
|
29
|
+
case 'sh':
|
|
30
|
+
case 'bash':
|
|
31
|
+
return 'shell';
|
|
32
|
+
default:
|
|
33
|
+
return 'text';
|
|
34
|
+
}
|
|
111
35
|
}
|
|
112
36
|
/**
|
|
113
37
|
* Highlight code based on language
|
|
114
38
|
*/
|
|
115
39
|
export function highlightCode(code, language) {
|
|
116
|
-
if (!
|
|
117
|
-
return
|
|
118
|
-
const lang = (language || 'text');
|
|
119
|
-
// Check if terminal supports colors
|
|
120
|
-
if (!process.stdout.isTTY || process.env.NO_COLOR) {
|
|
121
|
-
return code; // Return unhighlighted if colors disabled
|
|
40
|
+
if (!language || language === 'text') {
|
|
41
|
+
return code;
|
|
122
42
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
43
|
+
// Basic keyword highlighting (minimal implementation)
|
|
44
|
+
const keywords = {
|
|
45
|
+
typescript: [
|
|
46
|
+
/\b(const|let|var|function|class|interface|type|enum|import|export|async|await|return|if|else|for|while|try|catch|throw)\b/g,
|
|
47
|
+
/\b(true|false|null|undefined)\b/g,
|
|
48
|
+
/(["'`])(?:(?=(\\?))\2.)*?\1/g, // Strings
|
|
49
|
+
/\/\/.*$/gm, // Comments
|
|
50
|
+
/\/\*[\s\S]*?\*\//g, // Block comments
|
|
51
|
+
],
|
|
52
|
+
javascript: [
|
|
53
|
+
/\b(const|let|var|function|class|async|await|return|if|else|for|while|try|catch|throw)\b/g,
|
|
54
|
+
/\b(true|false|null|undefined)\b/g,
|
|
55
|
+
/(["'`])(?:(?=(\\?))\2.)*?\1/g,
|
|
56
|
+
/\/\/.*$/gm,
|
|
57
|
+
/\/\*[\s\S]*?\*\//g,
|
|
58
|
+
],
|
|
59
|
+
python: [
|
|
60
|
+
/\b(def|class|import|from|if|else|elif|for|while|try|except|return|True|False|None)\b/g,
|
|
61
|
+
/(["'`])(?:(?=(\\?))\2.)*?\1/g,
|
|
62
|
+
/#.*$/gm,
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
const lang = language.toLowerCase();
|
|
66
|
+
const patterns = keywords[lang] || [];
|
|
67
|
+
let highlighted = code;
|
|
68
|
+
for (const pattern of patterns) {
|
|
69
|
+
highlighted = highlighted.replace(pattern, (match) => {
|
|
70
|
+
if (pattern.source.includes('string')) {
|
|
71
|
+
return colors.cyan(match);
|
|
72
|
+
}
|
|
73
|
+
else if (pattern.source.includes('comment')) {
|
|
74
|
+
return colors.gray(match);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return colors.yellow(match);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
146
80
|
}
|
|
81
|
+
return highlighted;
|
|
147
82
|
}
|
|
148
83
|
/**
|
|
149
84
|
* Format code block with syntax highlighting
|
|
150
85
|
*/
|
|
151
86
|
export function formatCodeBlockWithHighlight(code, language, filepath) {
|
|
152
|
-
const
|
|
153
|
-
const highlighted = highlightCode(code,
|
|
154
|
-
|
|
155
|
-
const maxWidth = process.stdout.columns || 80;
|
|
156
|
-
const indent = ' ';
|
|
157
|
-
let output = colors.dim('┌─ Code');
|
|
158
|
-
if (detectedLang !== 'text') {
|
|
159
|
-
output += colors.dim(` (${detectedLang})`);
|
|
160
|
-
}
|
|
161
|
-
output += colors.dim(' ─'.repeat(Math.max(0, Math.floor((maxWidth - 20) / 2))) + '┐\n');
|
|
162
|
-
for (const line of lines) {
|
|
163
|
-
// Truncate very long lines
|
|
164
|
-
const displayLine = line.length > maxWidth - 10
|
|
165
|
-
? line.substring(0, maxWidth - 13) + '...'
|
|
166
|
-
: line;
|
|
167
|
-
output += indent + displayLine + '\n';
|
|
168
|
-
}
|
|
169
|
-
output += colors.dim('└' + '─'.repeat(Math.max(0, maxWidth - 4)) + '┘');
|
|
170
|
-
return output;
|
|
87
|
+
const lang = language || (filepath ? detectLanguage(filepath) : 'text');
|
|
88
|
+
const highlighted = highlightCode(code, lang);
|
|
89
|
+
return `\n${colors.dim('```' + lang)}\n${highlighted}\n${colors.dim('```')}\n`;
|
|
171
90
|
}
|
|
172
91
|
//# sourceMappingURL=syntax-highlighter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-highlighter.js","sourceRoot":"","sources":["../../../src/infrastructure/ux/syntax-highlighter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"syntax-highlighter.js","sourceRoot":"","sources":["../../../src/infrastructure/ux/syntax-highlighter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,CAAC;IAErD,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,IAAI,CAAC;QACV,KAAK,KAAK;YACR,OAAO,YAAY,CAAC;QACtB,KAAK,IAAI,CAAC;QACV,KAAK,KAAK;YACR,OAAO,YAAY,CAAC;QACtB,KAAK,IAAI;YACP,OAAO,QAAQ,CAAC;QAClB,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB,KAAK,MAAM,CAAC;QACZ,KAAK,KAAK;YACR,OAAO,MAAM,CAAC;QAChB,KAAK,IAAI;YACP,OAAO,UAAU,CAAC;QACpB,KAAK,IAAI,CAAC;QACV,KAAK,MAAM;YACT,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,QAAqC;IAC/E,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,sDAAsD;IACtD,MAAM,QAAQ,GAA6B;QACzC,U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E,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE9C,OAAO,KAAK,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,WAAW,KAAK,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;AACjF,CAAC"}
|
|
@@ -1,115 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Agent Feedback
|
|
3
|
+
* Records and manages feedback about agent operations
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* - Record success/failure, user approval, user modifications, errors
|
|
7
|
-
* - Store anonymously in local memory for pattern improvements
|
|
8
|
-
* - JSON-based, appended per operation
|
|
9
|
-
* - Privacy-first design with opt-out support
|
|
5
|
+
* Phase 1: v0.5.0-alpha.0
|
|
10
6
|
*/
|
|
11
|
-
export
|
|
12
|
-
export type UserAction = 'approved' | 'rejected' | 'modified' | 'skipped' | 'not_required';
|
|
13
|
-
export interface AgentFeedback {
|
|
14
|
-
feedbackId: string;
|
|
7
|
+
export interface FeedbackRecord {
|
|
15
8
|
runId: string;
|
|
16
9
|
agentName: string;
|
|
17
|
-
timestamp: number;
|
|
18
10
|
operation: string;
|
|
19
11
|
query?: string;
|
|
20
|
-
outcome:
|
|
21
|
-
userAction
|
|
12
|
+
outcome: 'success' | 'failure' | 'cancelled' | 'partial';
|
|
13
|
+
userAction?: 'approved' | 'rejected' | 'not_required' | 'cancelled';
|
|
22
14
|
filesChanged?: string[];
|
|
23
15
|
filesCreated?: string[];
|
|
24
16
|
filesDeleted?: string[];
|
|
25
|
-
userModifications?: Array<{
|
|
26
|
-
filepath: string;
|
|
27
|
-
modificationType: 'edited' | 'reverted' | 'accepted' | 'rejected';
|
|
28
|
-
description?: string;
|
|
29
|
-
}>;
|
|
30
17
|
errors?: string[];
|
|
31
18
|
warnings?: string[];
|
|
32
|
-
validationChecks?:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
message?: string;
|
|
36
|
-
}>;
|
|
37
|
-
metrics?: {
|
|
38
|
-
tokensUsed?: number;
|
|
39
|
-
duration?: number;
|
|
40
|
-
filesAnalyzed?: number;
|
|
41
|
-
changesProposed?: number;
|
|
42
|
-
changesApplied?: number;
|
|
43
|
-
};
|
|
44
|
-
context?: {
|
|
45
|
-
codebaseType?: string;
|
|
46
|
-
fileCount?: number;
|
|
47
|
-
operationType?: string;
|
|
48
|
-
};
|
|
49
|
-
userFeedback?: {
|
|
50
|
-
rating?: number;
|
|
51
|
-
comment?: string;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
export interface AgentFeedbackConfig {
|
|
55
|
-
enabled: boolean;
|
|
56
|
-
storagePath?: string;
|
|
57
|
-
anonymize: boolean;
|
|
58
|
-
optOut: boolean;
|
|
19
|
+
validationChecks?: any[];
|
|
20
|
+
metrics?: Record<string, any>;
|
|
21
|
+
timestamp?: number;
|
|
59
22
|
}
|
|
60
23
|
/**
|
|
61
24
|
* Agent Feedback Manager
|
|
62
|
-
* Lightweight, privacy-first feedback capture
|
|
63
25
|
*/
|
|
64
|
-
|
|
65
|
-
private
|
|
66
|
-
private
|
|
67
|
-
private feedbackHistory;
|
|
68
|
-
constructor(config?: Partial<AgentFeedbackConfig>);
|
|
26
|
+
declare class AgentFeedbackManager {
|
|
27
|
+
private feedbackRecords;
|
|
28
|
+
private readonly maxRecords;
|
|
69
29
|
/**
|
|
70
30
|
* Record feedback for an agent operation
|
|
71
|
-
* userAction is required - must be provided by caller
|
|
72
|
-
*/
|
|
73
|
-
recordFeedback(feedback: Omit<AgentFeedback, 'feedbackId' | 'timestamp'> & {
|
|
74
|
-
userAction: UserAction;
|
|
75
|
-
}): string;
|
|
76
|
-
/**
|
|
77
|
-
* Get feedback for a run
|
|
78
|
-
*/
|
|
79
|
-
getFeedbackForRun(runId: string): AgentFeedback | null;
|
|
80
|
-
/**
|
|
81
|
-
* Get recent feedback patterns (for learning)
|
|
82
|
-
*/
|
|
83
|
-
getRecentFeedback(limit?: number): AgentFeedback[];
|
|
84
|
-
/**
|
|
85
|
-
* Get feedback statistics
|
|
86
|
-
*/
|
|
87
|
-
getFeedbackStats(): {
|
|
88
|
-
total: number;
|
|
89
|
-
byOutcome: Record<FeedbackOutcome, number>;
|
|
90
|
-
byAgent: Record<string, number>;
|
|
91
|
-
averageRating?: number;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Anonymize feedback (remove sensitive data)
|
|
95
|
-
*/
|
|
96
|
-
private anonymizeFeedback;
|
|
97
|
-
/**
|
|
98
|
-
* Anonymize file path (keep structure, not actual names)
|
|
99
|
-
*/
|
|
100
|
-
private anonymizePath;
|
|
101
|
-
/**
|
|
102
|
-
* Load recent feedback from disk
|
|
103
31
|
*/
|
|
104
|
-
|
|
32
|
+
recordFeedback(feedback: FeedbackRecord): void;
|
|
105
33
|
/**
|
|
106
|
-
*
|
|
34
|
+
* Get feedback records for an agent
|
|
107
35
|
*/
|
|
108
|
-
|
|
36
|
+
getFeedbackForAgent(agentName: string, limit?: number): FeedbackRecord[];
|
|
109
37
|
/**
|
|
110
|
-
*
|
|
38
|
+
* Get all feedback records
|
|
111
39
|
*/
|
|
112
|
-
|
|
40
|
+
getAllFeedback(limit?: number): FeedbackRecord[];
|
|
113
41
|
}
|
|
114
42
|
export declare const agentFeedbackManager: AgentFeedbackManager;
|
|
43
|
+
/**
|
|
44
|
+
* AgentFeedback class (kept for backward compatibility)
|
|
45
|
+
*/
|
|
46
|
+
export declare class AgentFeedback {
|
|
47
|
+
data: FeedbackRecord;
|
|
48
|
+
constructor(data: FeedbackRecord);
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
115
51
|
//# sourceMappingURL=agent-feedback.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-feedback.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validation/agent-feedback.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version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