codehere 0.2.0 → 0.3.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.

Potentially problematic release.


This version of codehere might be problematic. Click here for more details.

Files changed (166) hide show
  1. package/dist/application/agents/multi-agent-orchestrator.d.ts +1 -0
  2. package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -1
  3. package/dist/application/agents/multi-agent-orchestrator.js.map +1 -1
  4. package/dist/application/services/dependency-container.d.ts +3 -0
  5. package/dist/application/services/dependency-container.d.ts.map +1 -1
  6. package/dist/application/services/dependency-container.js +24 -0
  7. package/dist/application/services/dependency-container.js.map +1 -1
  8. package/dist/application/use-cases/ask-question-use-case.d.ts +12 -0
  9. package/dist/application/use-cases/ask-question-use-case.d.ts.map +1 -1
  10. package/dist/application/use-cases/ask-question-use-case.js +129 -9
  11. package/dist/application/use-cases/ask-question-use-case.js.map +1 -1
  12. package/dist/application/use-cases/edit-file-use-case.d.ts.map +1 -1
  13. package/dist/application/use-cases/edit-file-use-case.js +70 -3
  14. package/dist/application/use-cases/edit-file-use-case.js.map +1 -1
  15. package/dist/application/use-cases/planning-use-case.d.ts.map +1 -1
  16. package/dist/application/use-cases/planning-use-case.js +10 -1
  17. package/dist/application/use-cases/planning-use-case.js.map +1 -1
  18. package/dist/application/use-cases/react-orchestration-use-case.d.ts.map +1 -1
  19. package/dist/application/use-cases/react-orchestration-use-case.js +6 -2
  20. package/dist/application/use-cases/react-orchestration-use-case.js.map +1 -1
  21. package/dist/domain/services/react-loop.d.ts +8 -0
  22. package/dist/domain/services/react-loop.d.ts.map +1 -1
  23. package/dist/domain/services/react-loop.js +82 -6
  24. package/dist/domain/services/react-loop.js.map +1 -1
  25. package/dist/formatter.d.ts +2 -2
  26. package/dist/formatter.d.ts.map +1 -1
  27. package/dist/formatter.js +30 -17
  28. package/dist/formatter.js.map +1 -1
  29. package/dist/index.js +134 -15
  30. package/dist/index.js.map +1 -1
  31. package/dist/infrastructure/ai/cohere-ai-service.d.ts +3 -1
  32. package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -1
  33. package/dist/infrastructure/ai/cohere-ai-service.js +51 -4
  34. package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -1
  35. package/dist/infrastructure/cache/query-result-cache.d.ts +68 -0
  36. package/dist/infrastructure/cache/query-result-cache.d.ts.map +1 -0
  37. package/dist/infrastructure/cache/query-result-cache.js +138 -0
  38. package/dist/infrastructure/cache/query-result-cache.js.map +1 -0
  39. package/dist/infrastructure/cache/security-scan-cache.d.ts +57 -0
  40. package/dist/infrastructure/cache/security-scan-cache.d.ts.map +1 -0
  41. package/dist/infrastructure/cache/security-scan-cache.js +124 -0
  42. package/dist/infrastructure/cache/security-scan-cache.js.map +1 -0
  43. package/dist/infrastructure/completion/bash-completion.d.ts +8 -0
  44. package/dist/infrastructure/completion/bash-completion.d.ts.map +1 -0
  45. package/dist/infrastructure/completion/bash-completion.js +101 -0
  46. package/dist/infrastructure/completion/bash-completion.js.map +1 -0
  47. package/dist/infrastructure/completion/completion-generator.d.ts +42 -0
  48. package/dist/infrastructure/completion/completion-generator.d.ts.map +1 -0
  49. package/dist/infrastructure/completion/completion-generator.js +184 -0
  50. package/dist/infrastructure/completion/completion-generator.js.map +1 -0
  51. package/dist/infrastructure/completion/fish-completion.d.ts +8 -0
  52. package/dist/infrastructure/completion/fish-completion.d.ts.map +1 -0
  53. package/dist/infrastructure/completion/fish-completion.js +65 -0
  54. package/dist/infrastructure/completion/fish-completion.js.map +1 -0
  55. package/dist/infrastructure/completion/zsh-completion.d.ts +8 -0
  56. package/dist/infrastructure/completion/zsh-completion.d.ts.map +1 -0
  57. package/dist/infrastructure/completion/zsh-completion.js +85 -0
  58. package/dist/infrastructure/completion/zsh-completion.js.map +1 -0
  59. package/dist/infrastructure/context/context-compressor.d.ts +94 -0
  60. package/dist/infrastructure/context/context-compressor.d.ts.map +1 -0
  61. package/dist/infrastructure/context/context-compressor.js +329 -0
  62. package/dist/infrastructure/context/context-compressor.js.map +1 -0
  63. package/dist/infrastructure/governance/policy-as-code.d.ts.map +1 -1
  64. package/dist/infrastructure/governance/policy-as-code.js +18 -3
  65. package/dist/infrastructure/governance/policy-as-code.js.map +1 -1
  66. package/dist/infrastructure/observability/execution-tracer.d.ts +5 -2
  67. package/dist/infrastructure/observability/execution-tracer.d.ts.map +1 -1
  68. package/dist/infrastructure/observability/execution-tracer.js +45 -8
  69. package/dist/infrastructure/observability/execution-tracer.js.map +1 -1
  70. package/dist/infrastructure/security/ai-sast-scanner.d.ts +4 -0
  71. package/dist/infrastructure/security/ai-sast-scanner.d.ts.map +1 -1
  72. package/dist/infrastructure/security/ai-sast-scanner.js +82 -4
  73. package/dist/infrastructure/security/ai-sast-scanner.js.map +1 -1
  74. package/dist/infrastructure/security/enhanced-security-gate.d.ts +2 -0
  75. package/dist/infrastructure/security/enhanced-security-gate.d.ts.map +1 -1
  76. package/dist/infrastructure/security/enhanced-security-gate.js +74 -15
  77. package/dist/infrastructure/security/enhanced-security-gate.js.map +1 -1
  78. package/dist/infrastructure/storage/plan-repository.d.ts +38 -0
  79. package/dist/infrastructure/storage/plan-repository.d.ts.map +1 -0
  80. package/dist/infrastructure/storage/plan-repository.js +133 -0
  81. package/dist/infrastructure/storage/plan-repository.js.map +1 -0
  82. package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts +11 -0
  83. package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -1
  84. package/dist/infrastructure/storage/sqlite-embedding-repository.js +121 -6
  85. package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +1 -1
  86. package/dist/infrastructure/ux/contextual-feature-discovery.d.ts +24 -0
  87. package/dist/infrastructure/ux/contextual-feature-discovery.d.ts.map +1 -0
  88. package/dist/infrastructure/ux/contextual-feature-discovery.js +144 -0
  89. package/dist/infrastructure/ux/contextual-feature-discovery.js.map +1 -0
  90. package/dist/infrastructure/ux/expectation-management.d.ts +33 -0
  91. package/dist/infrastructure/ux/expectation-management.d.ts.map +1 -1
  92. package/dist/infrastructure/ux/expectation-management.js +138 -4
  93. package/dist/infrastructure/ux/expectation-management.js.map +1 -1
  94. package/dist/infrastructure/ux/feature-discovery.d.ts +47 -0
  95. package/dist/infrastructure/ux/feature-discovery.d.ts.map +1 -0
  96. package/dist/infrastructure/ux/feature-discovery.js +190 -0
  97. package/dist/infrastructure/ux/feature-discovery.js.map +1 -0
  98. package/dist/infrastructure/ux/hitl-review-portal.d.ts +47 -0
  99. package/dist/infrastructure/ux/hitl-review-portal.d.ts.map +1 -0
  100. package/dist/infrastructure/ux/hitl-review-portal.js +225 -0
  101. package/dist/infrastructure/ux/hitl-review-portal.js.map +1 -0
  102. package/dist/infrastructure/ux/progress-indicator.d.ts +54 -0
  103. package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -0
  104. package/dist/infrastructure/ux/progress-indicator.js +121 -0
  105. package/dist/infrastructure/ux/progress-indicator.js.map +1 -0
  106. package/dist/infrastructure/ux/progressive-disclosure.d.ts.map +1 -1
  107. package/dist/infrastructure/ux/progressive-disclosure.js +2 -1
  108. package/dist/infrastructure/ux/progressive-disclosure.js.map +1 -1
  109. package/dist/infrastructure/ux/review-checkpoint.d.ts +35 -0
  110. package/dist/infrastructure/ux/review-checkpoint.d.ts.map +1 -0
  111. package/dist/infrastructure/ux/review-checkpoint.js +119 -0
  112. package/dist/infrastructure/ux/review-checkpoint.js.map +1 -0
  113. package/dist/infrastructure/ux/staged-feature-intro.d.ts +47 -0
  114. package/dist/infrastructure/ux/staged-feature-intro.d.ts.map +1 -0
  115. package/dist/infrastructure/ux/staged-feature-intro.js +144 -0
  116. package/dist/infrastructure/ux/staged-feature-intro.js.map +1 -0
  117. package/dist/infrastructure/ux/syntax-highlighter.d.ts +21 -0
  118. package/dist/infrastructure/ux/syntax-highlighter.d.ts.map +1 -0
  119. package/dist/infrastructure/ux/syntax-highlighter.js +172 -0
  120. package/dist/infrastructure/ux/syntax-highlighter.js.map +1 -0
  121. package/dist/infrastructure/xai/cot-visualizer.d.ts +1 -0
  122. package/dist/infrastructure/xai/cot-visualizer.d.ts.map +1 -1
  123. package/dist/infrastructure/xai/cot-visualizer.js +57 -10
  124. package/dist/infrastructure/xai/cot-visualizer.js.map +1 -1
  125. package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -1
  126. package/dist/presentation/cli/commands/ask-command.js +68 -11
  127. package/dist/presentation/cli/commands/ask-command.js.map +1 -1
  128. package/dist/presentation/cli/commands/orchestrate-command.d.ts +1 -0
  129. package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
  130. package/dist/presentation/cli/commands/orchestrate-command.js +35 -1
  131. package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -1
  132. package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -1
  133. package/dist/presentation/cli/commands/plan-command.js +57 -5
  134. package/dist/presentation/cli/commands/plan-command.js.map +1 -1
  135. package/dist/presentation/cli/commands/react-command.d.ts.map +1 -1
  136. package/dist/presentation/cli/commands/react-command.js +95 -15
  137. package/dist/presentation/cli/commands/react-command.js.map +1 -1
  138. package/dist/presentation/cli/commands/setup-command.d.ts.map +1 -1
  139. package/dist/presentation/cli/commands/setup-command.js +67 -12
  140. package/dist/presentation/cli/commands/setup-command.js.map +1 -1
  141. package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -1
  142. package/dist/presentation/cli/commands/smart-command.js +136 -18
  143. package/dist/presentation/cli/commands/smart-command.js.map +1 -1
  144. package/dist/presentation/cli/commands/trace-command.d.ts.map +1 -1
  145. package/dist/presentation/cli/commands/trace-command.js +9 -5
  146. package/dist/presentation/cli/commands/trace-command.js.map +1 -1
  147. package/dist/presentation/cli/commands/undo-command.js +15 -6
  148. package/dist/presentation/cli/commands/undo-command.js.map +1 -1
  149. package/dist/presentation/cli/error-display.d.ts +2 -0
  150. package/dist/presentation/cli/error-display.d.ts.map +1 -1
  151. package/dist/presentation/cli/error-display.js +177 -2
  152. package/dist/presentation/cli/error-display.js.map +1 -1
  153. package/dist/presentation/cli/keyboard-shortcuts.d.ts +27 -0
  154. package/dist/presentation/cli/keyboard-shortcuts.d.ts.map +1 -0
  155. package/dist/presentation/cli/keyboard-shortcuts.js +77 -0
  156. package/dist/presentation/cli/keyboard-shortcuts.js.map +1 -0
  157. package/dist/session.d.ts.map +1 -1
  158. package/dist/session.js +20 -0
  159. package/dist/session.js.map +1 -1
  160. package/dist/utils/version.js +2 -2
  161. package/dist/verification/backup.d.ts.map +1 -1
  162. package/dist/verification/backup.js +24 -3
  163. package/dist/verification/backup.js.map +1 -1
  164. package/dist/verification/compiler.js +47 -12
  165. package/dist/verification/compiler.js.map +1 -1
  166. package/package.json +1 -1
@@ -0,0 +1,184 @@
1
+ /**
2
+ * Shell Completion Generator
3
+ * Generates completion scripts for bash, zsh, and fish shells
4
+ */
5
+ import { readFileSync, existsSync } from 'fs';
6
+ import { join } from 'path';
7
+ // All commands and their definitions
8
+ export const COMMAND_DEFINITIONS = {
9
+ 'ask': {
10
+ name: 'ask',
11
+ description: 'Ask questions about your codebase',
12
+ options: [
13
+ { flag: '--stream', description: 'Enable streaming output' },
14
+ { flag: '--no-stream', description: 'Disable streaming output' },
15
+ ],
16
+ },
17
+ 'explain': {
18
+ name: 'explain',
19
+ description: 'Get detailed explanations of code files',
20
+ },
21
+ 'plan': {
22
+ name: 'plan',
23
+ description: 'Generate hierarchical plan',
24
+ options: [
25
+ { flag: '--execute', description: 'Execute the plan after generation' },
26
+ ],
27
+ },
28
+ 'orchestrate': {
29
+ name: 'orchestrate',
30
+ description: 'Orchestrate multi-agent workflows',
31
+ options: [
32
+ { flag: '--mode <mode>', description: 'Mode: plan-only, execute-only, full' },
33
+ { flag: '--plan-id <id>', description: 'Plan ID to load' },
34
+ ],
35
+ },
36
+ 'react': {
37
+ name: 'react',
38
+ description: 'Use ReAct reasoning loop',
39
+ options: [
40
+ { flag: '--stream', description: 'Enable streaming output' },
41
+ ],
42
+ },
43
+ 'setup': {
44
+ name: 'setup',
45
+ description: 'Interactive setup wizard',
46
+ options: [
47
+ { flag: '--force, -f', description: 'Force reconfiguration' },
48
+ ],
49
+ },
50
+ 'config': {
51
+ name: 'config',
52
+ description: 'Manage configuration',
53
+ subcommands: ['get', 'set', 'reset'],
54
+ dynamicCompletions: async (context) => {
55
+ // Dynamic completion for config keys
56
+ if (context.subcommand === 'get' || context.subcommand === 'set') {
57
+ return getConfigKeys();
58
+ }
59
+ return [];
60
+ },
61
+ },
62
+ 'index': {
63
+ name: 'index',
64
+ description: 'Build semantic embeddings index',
65
+ options: [
66
+ { flag: '--repo <path>, -r <path>', description: 'Repository path' },
67
+ ],
68
+ },
69
+ 'help': {
70
+ name: 'help',
71
+ description: 'Show help for commands',
72
+ },
73
+ 'undo': {
74
+ name: 'undo',
75
+ description: 'Undo file changes',
76
+ subcommands: ['undo', 'list', 'restore'],
77
+ },
78
+ 'trace': {
79
+ name: 'trace',
80
+ description: 'View execution traces',
81
+ subcommands: ['show', 'reproduce', 'list'],
82
+ },
83
+ 'decision': {
84
+ name: 'decision',
85
+ description: 'Record and query architectural decisions',
86
+ subcommands: ['record', 'list', 'query', 'explain'],
87
+ },
88
+ 'knowledge': {
89
+ name: 'knowledge',
90
+ description: 'Query preserved knowledge',
91
+ subcommands: ['query', 'list', 'summary', 'extract'],
92
+ },
93
+ 'learning': {
94
+ name: 'learning',
95
+ description: 'View learning dashboard',
96
+ subcommands: ['overview', 'patterns', 'knowledge', 'insights'],
97
+ },
98
+ 'cost': {
99
+ name: 'cost',
100
+ description: 'View API cost tracking',
101
+ subcommands: ['status', 'summary', 'run', 'reset'],
102
+ },
103
+ };
104
+ /**
105
+ * Get all command names
106
+ */
107
+ export function getAllCommands() {
108
+ return Object.keys(COMMAND_DEFINITIONS);
109
+ }
110
+ /**
111
+ * Get command definition
112
+ */
113
+ export function getCommandDefinition(command) {
114
+ return COMMAND_DEFINITIONS[command];
115
+ }
116
+ /**
117
+ * Get subcommands for a command
118
+ */
119
+ export function getSubcommands(command) {
120
+ const def = getCommandDefinition(command);
121
+ return def?.subcommands || [];
122
+ }
123
+ /**
124
+ * Get options for a command
125
+ */
126
+ export function getCommandOptions(command) {
127
+ const def = getCommandDefinition(command);
128
+ if (!def?.options)
129
+ return [];
130
+ return def.options.map(opt => {
131
+ // Extract flag names (e.g., "--force, -f" -> ["--force", "-f"])
132
+ const flags = opt.flag.split(',').map(f => f.trim());
133
+ // Return short and long flags
134
+ return flags.map(f => {
135
+ if (f.includes('<') || f.includes('[')) {
136
+ // Option with argument, return base flag
137
+ return f.split(/[<\[ ]/)[0];
138
+ }
139
+ return f;
140
+ });
141
+ }).flat();
142
+ }
143
+ /**
144
+ * Get config keys dynamically
145
+ */
146
+ async function getConfigKeys() {
147
+ try {
148
+ const configPath = join(process.cwd(), 'data', 'config.json');
149
+ if (existsSync(configPath)) {
150
+ const config = JSON.parse(readFileSync(configPath, 'utf-8'));
151
+ return Object.keys(config.preferences || {});
152
+ }
153
+ // Default config keys
154
+ return [
155
+ 'autoCommit',
156
+ 'temperature',
157
+ 'maxResults',
158
+ 'model',
159
+ 'enableStreaming',
160
+ 'enableSecurityScan',
161
+ 'enableVerification',
162
+ ];
163
+ }
164
+ catch {
165
+ return [
166
+ 'autoCommit',
167
+ 'temperature',
168
+ 'maxResults',
169
+ 'model',
170
+ 'enableStreaming',
171
+ 'enableSecurityScan',
172
+ 'enableVerification',
173
+ ];
174
+ }
175
+ }
176
+ /**
177
+ * Generate file completions (for filepath arguments)
178
+ */
179
+ export async function getFileCompletions(prefix) {
180
+ // This would need filesystem access - simplified for now
181
+ // In a real implementation, you'd list files matching the prefix
182
+ return [];
183
+ }
184
+ //# sourceMappingURL=completion-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion-generator.js","sourceRoot":"","sources":["../../../src/infrastructure/completion/completion-generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OA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;GAEG;AACH,KAAK,UAAU,aAAa;IAC1B,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;QAC9D,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;YAC7D,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;QAC/C,CAAC;QACD,sBAAsB;QACtB,OAAO;YACL,YAAY;YACZ,aAAa;YACb,YAAY;YACZ,OAAO;YACP,iBAAiB;YACjB,oBAAoB;YACpB,oBAAoB;SACrB,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,YAAY;YACZ,aAAa;YACb,YAAY;YACZ,OAAO;YACP,iBAAiB;YACjB,oBAAoB;YACpB,oBAAoB;SACrB,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAc;IACrD,yDAAyD;IACzD,iEAAiE;IACjE,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Fish Completion Script Generator
3
+ */
4
+ /**
5
+ * Generate fish completion script
6
+ */
7
+ export declare function generateFishCompletion(): string;
8
+ //# sourceMappingURL=fish-completion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fish-completion.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/completion/fish-completion.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAyD/C"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Fish Completion Script Generator
3
+ */
4
+ import { getAllCommands, } from './completion-generator.js';
5
+ /**
6
+ * Generate fish completion script
7
+ */
8
+ export function generateFishCompletion() {
9
+ return `# Fish completion for codehere
10
+ # Installation: codehere --completion fish | source
11
+
12
+ function __codehere_complete_commands
13
+ echo ${getAllCommands().join(' ')}
14
+ end
15
+
16
+ function __codehere_complete_config_actions
17
+ echo get set reset
18
+ end
19
+
20
+ function __codehere_complete_config_keys
21
+ echo autoCommit temperature maxResults model enableStreaming enableSecurityScan enableVerification
22
+ end
23
+
24
+ function __codehere_complete_undo_actions
25
+ echo undo list restore
26
+ end
27
+
28
+ function __codehere_complete_trace_actions
29
+ echo show reproduce list
30
+ end
31
+
32
+ function __codehere_complete_decision_actions
33
+ echo record list query explain
34
+ end
35
+
36
+ function __codehere_complete_knowledge_actions
37
+ echo query list summary extract
38
+ end
39
+
40
+ function __codehere_complete_learning_actions
41
+ echo overview patterns knowledge insights
42
+ end
43
+
44
+ function __codehere_complete_cost_actions
45
+ echo status summary run reset
46
+ end
47
+
48
+ complete -c codehere -f -a "(__codehere_complete_commands)"
49
+
50
+ complete -c codehere -f -n "__fish_seen_subcommand_from config" -a "(__codehere_complete_config_actions)"
51
+ complete -c codehere -f -n "__fish_seen_subcommand_from config; and __fish_seen_subcommand_from get set" -a "(__codehere_complete_config_keys)"
52
+
53
+ complete -c codehere -f -n "__fish_seen_subcommand_from undo" -a "(__codehere_complete_undo_actions)"
54
+ complete -c codehere -f -n "__fish_seen_subcommand_from trace" -a "(__codehere_complete_trace_actions)"
55
+ complete -c codehere -f -n "__fish_seen_subcommand_from decision" -a "(__codehere_complete_decision_actions)"
56
+ complete -c codehere -f -n "__fish_seen_subcommand_from knowledge" -a "(__codehere_complete_knowledge_actions)"
57
+ complete -c codehere -f -n "__fish_seen_subcommand_from learning" -a "(__codehere_complete_learning_actions)"
58
+ complete -c codehere -f -n "__fish_seen_subcommand_from cost" -a "(__codehere_complete_cost_actions)"
59
+
60
+ complete -c codehere -s h -l help -d "Show help"
61
+ complete -c codehere -s v -l version -d "Show version"
62
+ complete -c codehere -l completion -d "Show shell completion script"
63
+ `;
64
+ }
65
+ //# sourceMappingURL=fish-completion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fish-completion.js","sourceRoot":"","sources":["../../../src/infrastructure/completion/fish-completion.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,cAAc,GAKf,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO;;;;SAIA,cAAc,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDlC,CAAC;AAEF,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Zsh Completion Script Generator
3
+ */
4
+ /**
5
+ * Generate zsh completion script
6
+ */
7
+ export declare function generateZshCompletion(): string;
8
+ //# sourceMappingURL=zsh-completion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zsh-completion.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/completion/zsh-completion.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CA6E9C"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Zsh Completion Script Generator
3
+ */
4
+ import { getAllCommands, } from './completion-generator.js';
5
+ /**
6
+ * Generate zsh completion script
7
+ */
8
+ export function generateZshCompletion() {
9
+ return `# Zsh completion for codehere
10
+ # Installation: source <(codehere --completion zsh) or add to ~/.zshrc
11
+
12
+ _codehere() {
13
+ local context state state_descr line
14
+ typeset -A opt_args
15
+
16
+ _arguments -C \\
17
+ "1: :->command" \\
18
+ "*::arg:->args"
19
+
20
+ case $state in
21
+ command)
22
+ local commands="${getAllCommands().join(' ')}"
23
+ _values 'commands' $commands
24
+ ;;
25
+ args)
26
+ case $words[1] in
27
+ config)
28
+ _arguments \\
29
+ "1: :->config_action" \\
30
+ "*::arg:->config_args"
31
+ ;;
32
+ undo)
33
+ _arguments \\
34
+ "1: :->undo_action"
35
+ ;;
36
+ trace)
37
+ _arguments \\
38
+ "1: :->trace_action"
39
+ ;;
40
+ decision)
41
+ _arguments \\
42
+ "1: :->decision_action"
43
+ ;;
44
+ knowledge)
45
+ _arguments \\
46
+ "1: :->knowledge_action"
47
+ ;;
48
+ learning)
49
+ _arguments \\
50
+ "1: :->learning_action"
51
+ ;;
52
+ cost)
53
+ _arguments \\
54
+ "1: :->cost_action"
55
+ ;;
56
+ esac
57
+ ;;
58
+ config_action)
59
+ _values 'config actions' get set reset
60
+ ;;
61
+ undo_action)
62
+ _values 'undo actions' undo list restore
63
+ ;;
64
+ trace_action)
65
+ _values 'trace actions' show reproduce list
66
+ ;;
67
+ decision_action)
68
+ _values 'decision actions' record list query explain
69
+ ;;
70
+ knowledge_action)
71
+ _values 'knowledge actions' query list summary extract
72
+ ;;
73
+ learning_action)
74
+ _values 'learning actions' overview patterns knowledge insights
75
+ ;;
76
+ cost_action)
77
+ _values 'cost actions' status summary run reset
78
+ ;;
79
+ esac
80
+ }
81
+
82
+ compdef _codehere codehere
83
+ `;
84
+ }
85
+ //# sourceMappingURL=zsh-completion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zsh-completion.js","sourceRoot":"","sources":["../../../src/infrastructure/completion/zsh-completion.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,cAAc,GAKf,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO;;;;;;;;;;;;;wBAae,cAAc,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DjD,CAAC;AAEF,CAAC"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Infrastructure: Context Compression Service
3
+ *
4
+ * Prevents context bloat through intelligent compression techniques
5
+ * Research: Context bloat leads to escalating costs and degraded reliability
6
+ *
7
+ * Techniques:
8
+ * 1. LLM Summarization: Compress large contexts into concise summaries
9
+ * 2. Observation Masking: Remove redundant observations in ReAct loops
10
+ * 3. Hybrid Memory: Combine transient (session) and persistent (long-term) memory
11
+ * 4. Selective Context: Keep only most relevant chunks based on attention scores
12
+ */
13
+ import type { IAIService } from '../../domain/interfaces/ai-service.interface.js';
14
+ import type { CodeChunk } from '../../domain/entities/code-chunk.js';
15
+ import type { Memory } from '../../domain/entities/memory.js';
16
+ export interface CompressionStrategy {
17
+ maxTokens: number;
18
+ preserveCode: boolean;
19
+ preserveErrors: boolean;
20
+ compressMemories: boolean;
21
+ compressObservations: boolean;
22
+ }
23
+ export interface CompressedContext {
24
+ chunks: CodeChunk[];
25
+ memories: Memory[];
26
+ summary?: string;
27
+ originalTokenCount: number;
28
+ compressedTokenCount: number;
29
+ reductionPercent: number;
30
+ strategy: CompressionStrategy;
31
+ }
32
+ export interface ObservationMask {
33
+ toolCalls: boolean;
34
+ observations: boolean;
35
+ errors: boolean;
36
+ thoughts: boolean;
37
+ maxHistoryLength: number;
38
+ }
39
+ /**
40
+ * Context Compressor Service
41
+ * Implements multiple compression techniques to prevent context bloat
42
+ */
43
+ export declare class ContextCompressor {
44
+ private aiService;
45
+ constructor(aiService: IAIService);
46
+ /**
47
+ * Compress context using multi-stage compression (selective + summarization)
48
+ * OPTIMIZED: Multi-stage approach achieves 50%+ reduction
49
+ */
50
+ compressWithSummarization(chunks: CodeChunk[], query: string, strategy: CompressionStrategy): Promise<CompressedContext>;
51
+ /**
52
+ * Mask observations in ReAct loops
53
+ * Remove redundant observations while preserving critical information
54
+ */
55
+ maskObservations(observations: string[], toolCalls: string[], errors: string[], mask: ObservationMask): {
56
+ maskedObservations: string[];
57
+ maskedToolCalls: string[];
58
+ maskedErrors: string[];
59
+ };
60
+ /**
61
+ * Compress memories by summarizing similar memories
62
+ */
63
+ compressMemories(memories: Memory[], query: string, maxMemories?: number): Promise<Memory[]>;
64
+ /**
65
+ * Hybrid memory compression: Combine transient and persistent
66
+ */
67
+ createHybridContext(transientMemories: Memory[], // Recent session memories
68
+ persistentMemories: Memory[], // Long-term memories
69
+ query: string): Memory[];
70
+ /**
71
+ * Selective context compression: Keep only most relevant chunks
72
+ */
73
+ selectiveCompression(chunks: CodeChunk[], query: string, maxChunks: number, attentionScores?: Map<string, number>): CodeChunk[];
74
+ /**
75
+ * Preprocess code: remove comments, excessive whitespace, etc.
76
+ * Achieves ~15-20% reduction without LLM calls
77
+ */
78
+ private preprocessCode;
79
+ private summarizeFileContext;
80
+ /**
81
+ * Aggressive summarization: Target 50%+ reduction
82
+ */
83
+ private summarizeFileContextAggressive;
84
+ private summarizeFileContent;
85
+ /**
86
+ * Aggressive summarization: Target 50%+ reduction
87
+ */
88
+ private summarizeFileContentAggressive;
89
+ private groupChunksByFile;
90
+ private groupSimilarMemories;
91
+ private calculateRelevance;
92
+ private estimateTokens;
93
+ }
94
+ //# sourceMappingURL=context-compressor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-compressor.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/context/context-compressor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iDAAiD,CAAC;AAClF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAA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