codehere 0.2.2 → 0.3.0-rc.10

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.
Files changed (238) hide show
  1. package/README.md +88 -68
  2. package/dist/domain/entities/task.js +4 -4
  3. package/dist/error-handler.js +4 -9
  4. package/dist/index.js +261 -1224
  5. package/dist/infrastructure/config/product-context.js +7 -6
  6. package/dist/infrastructure/hooks/claude-sdk-hook.js +348 -72
  7. package/dist/infrastructure/observability/execution-tracer.js +11 -6
  8. package/dist/infrastructure/orchestration/agent-adapter.js +13 -0
  9. package/dist/infrastructure/orchestration/agent-installer.js +101 -0
  10. package/dist/infrastructure/orchestration/agents-config-seed.js +56 -0
  11. package/dist/infrastructure/orchestration/aider-adapter.js +319 -0
  12. package/dist/infrastructure/orchestration/artifacts-extractor.js +175 -0
  13. package/dist/infrastructure/orchestration/claude-code-adapter.js +352 -0
  14. package/dist/infrastructure/orchestration/codex-adapter.js +310 -0
  15. package/dist/infrastructure/orchestration/conductor-adapter.js +340 -0
  16. package/dist/infrastructure/orchestration/generic-cli-adapter.js +553 -0
  17. package/dist/infrastructure/orchestration/opencode-adapter.js +275 -0
  18. package/dist/infrastructure/orchestration/progress-aggregator.js +189 -0
  19. package/dist/infrastructure/orchestration/readiness.js +106 -0
  20. package/dist/infrastructure/orchestration/session-manager.js +278 -0
  21. package/dist/infrastructure/orchestration/session-persistence.js +109 -0
  22. package/dist/infrastructure/protocols/mcp-helpers.js +10 -30
  23. package/dist/infrastructure/protocols/mcp-server-impl.js +359 -21
  24. package/dist/infrastructure/protocols/probe-port.js +36 -0
  25. package/dist/infrastructure/protocols/ui-page.js +1827 -0
  26. package/dist/infrastructure/security/file-collection.js +115 -0
  27. package/dist/infrastructure/security/trust-scorer.js +301 -56
  28. package/dist/infrastructure/storage/task-repository.js +8 -7
  29. package/dist/monitoring.js +9 -38
  30. package/dist/presentation/cli/commands/help-command.js +96 -139
  31. package/dist/presentation/cli/commands/hook-command.js +17 -24
  32. package/dist/presentation/cli/commands/report-command.js +59 -72
  33. package/dist/presentation/cli/commands/setup-command.js +4 -4
  34. package/dist/presentation/cli/commands/status-command.js +321 -30
  35. package/dist/presentation/cli/commands/trust-command.js +84 -72
  36. package/dist/presentation/cli/error-display.js +17 -21
  37. package/dist/presentation/cli/repl.js +474 -0
  38. package/dist/ui.js +11 -11
  39. package/package.json +24 -62
  40. package/dist/agents/base.js +0 -101
  41. package/dist/agents/orchestrator-model-driven.js +0 -141
  42. package/dist/agents/react-orchestrator-agent.js +0 -54
  43. package/dist/application/agents/execution-agent.js +0 -508
  44. package/dist/application/agents/multi-agent-orchestrator.js +0 -295
  45. package/dist/application/agents/planning-agent.js +0 -433
  46. package/dist/application/agents/validation-agent.js +0 -317
  47. package/dist/application/architectures/plan-and-act.js +0 -242
  48. package/dist/application/index.js +0 -12
  49. package/dist/application/services/agent-factory.js +0 -28
  50. package/dist/application/services/dependency-container.js +0 -596
  51. package/dist/application/services/git-context-service.js +0 -83
  52. package/dist/application/services/intelligent-router.js +0 -934
  53. package/dist/application/services/tool-executor-service.js +0 -94
  54. package/dist/application/use-cases/ask-question-use-case.js +0 -338
  55. package/dist/application/use-cases/edit-file-use-case.js +0 -830
  56. package/dist/application/use-cases/explain-file-use-case.js +0 -50
  57. package/dist/application/use-cases/index-codebase-use-case.js +0 -113
  58. package/dist/application/use-cases/planning-use-case.js +0 -276
  59. package/dist/application/use-cases/react-orchestration-use-case.js +0 -329
  60. package/dist/application/use-cases/reflexion-use-case.js +0 -30
  61. package/dist/application/workflows/deterministic-workflows.js +0 -189
  62. package/dist/ast-parser.js +0 -331
  63. package/dist/cache.js +0 -180
  64. package/dist/chat.js +0 -251
  65. package/dist/code-analysis.js +0 -327
  66. package/dist/context.js +0 -187
  67. package/dist/docs.js +0 -146
  68. package/dist/domain/entities/code-chunk.js +0 -6
  69. package/dist/domain/entities/decision.js +0 -9
  70. package/dist/domain/entities/edit.js +0 -6
  71. package/dist/domain/entities/knowledge-node.js +0 -9
  72. package/dist/domain/entities/knowledge-preservation.js +0 -10
  73. package/dist/domain/entities/memory.js +0 -6
  74. package/dist/domain/entities/pattern.js +0 -7
  75. package/dist/domain/entities/plan.js +0 -6
  76. package/dist/domain/entities/query.js +0 -6
  77. package/dist/domain/errors/embeddings-not-found-error.js +0 -13
  78. package/dist/domain/index.js +0 -19
  79. package/dist/domain/interfaces/ai-service.interface.js +0 -6
  80. package/dist/domain/interfaces/code-analyzer.interface.js +0 -6
  81. package/dist/domain/interfaces/decision-repository.interface.js +0 -9
  82. package/dist/domain/interfaces/embedding-repository.interface.js +0 -6
  83. package/dist/domain/interfaces/knowledge-graph-repository.interface.js +0 -9
  84. package/dist/domain/interfaces/knowledge-preservation-repository.interface.js +0 -8
  85. package/dist/domain/interfaces/memory-repository.interface.js +0 -6
  86. package/dist/domain/interfaces/pattern-repository.interface.js +0 -6
  87. package/dist/domain/interfaces/verification-service.interface.js +0 -6
  88. package/dist/domain/services/cross-team-pattern-sharing.js +0 -125
  89. package/dist/domain/services/decision-recorder.js +0 -223
  90. package/dist/domain/services/decision-retriever.js +0 -133
  91. package/dist/domain/services/environment-mode-manager.js +0 -22
  92. package/dist/domain/services/graded-memory-activation.js +0 -69
  93. package/dist/domain/services/knowledge-access.js +0 -132
  94. package/dist/domain/services/knowledge-extractor.js +0 -247
  95. package/dist/domain/services/knowledge-graph-builder.js +0 -268
  96. package/dist/domain/services/knowledge-graph-query.js +0 -187
  97. package/dist/domain/services/memory-retriever.js +0 -82
  98. package/dist/domain/services/memory-synthesizer.js +0 -91
  99. package/dist/domain/services/pattern-extractor.js +0 -442
  100. package/dist/domain/services/query-intent-classifier.js +0 -140
  101. package/dist/domain/services/react-loop.js +0 -186
  102. package/dist/domain/services/risk-tier-detector.js +0 -78
  103. package/dist/edit.js +0 -319
  104. package/dist/embed.js +0 -459
  105. package/dist/formatter.js +0 -168
  106. package/dist/git.js +0 -198
  107. package/dist/infrastructure/ai/cohere-ai-service.js +0 -607
  108. package/dist/infrastructure/ai/command-r-evaluation.js +0 -206
  109. package/dist/infrastructure/ai/model-config.js +0 -84
  110. package/dist/infrastructure/ai/provider-ai-service.js +0 -477
  111. package/dist/infrastructure/cache/embedding-cache.js +0 -175
  112. package/dist/infrastructure/cache/query-result-cache.js +0 -66
  113. package/dist/infrastructure/cache/response-cache.js +0 -48
  114. package/dist/infrastructure/cache/security-scan-cache.js +0 -47
  115. package/dist/infrastructure/chunking/ast-code-chunker.js +0 -19
  116. package/dist/infrastructure/chunking/code-aware-chunker.js +0 -397
  117. package/dist/infrastructure/context/context-compressor.js +0 -329
  118. package/dist/infrastructure/context/conversation-context.js +0 -128
  119. package/dist/infrastructure/context/session-manager.js +0 -94
  120. package/dist/infrastructure/cost/cost-tracker.js +0 -360
  121. package/dist/infrastructure/file-scanner/file-scanner.js +0 -106
  122. package/dist/infrastructure/governance/nist-ai-rmf.js +0 -292
  123. package/dist/infrastructure/governance/policy-as-code.js +0 -258
  124. package/dist/infrastructure/governance/prompt-to-code-lineage.js +0 -239
  125. package/dist/infrastructure/index.js +0 -7
  126. package/dist/infrastructure/observability/prompt-versioner.js +0 -145
  127. package/dist/infrastructure/protocols/a2a-metadata.js +0 -137
  128. package/dist/infrastructure/protocols/a2a-protocol.js +0 -314
  129. package/dist/infrastructure/protocols/mcp-oauth.js +0 -184
  130. package/dist/infrastructure/protocols/mcp-server.js +0 -333
  131. package/dist/infrastructure/protocols/streaming-handler.js +0 -103
  132. package/dist/infrastructure/providers/cohere-provider.js +0 -444
  133. package/dist/infrastructure/providers/fake-provider.js +0 -130
  134. package/dist/infrastructure/providers/local-llm-provider.js +0 -330
  135. package/dist/infrastructure/providers/model-config.types.js +0 -9
  136. package/dist/infrastructure/providers/model-provider.interface.js +0 -8
  137. package/dist/infrastructure/providers/openai-provider.js +0 -413
  138. package/dist/infrastructure/providers/openrouter-provider.js +0 -399
  139. package/dist/infrastructure/providers/operation-provider-resolver.js +0 -105
  140. package/dist/infrastructure/providers/provider-config-loader.js +0 -120
  141. package/dist/infrastructure/providers/provider-registry.js +0 -88
  142. package/dist/infrastructure/safety/pattern-detector.js +0 -133
  143. package/dist/infrastructure/security/ai-sast-scanner.js +0 -290
  144. package/dist/infrastructure/security/docker-sandbox.js +0 -178
  145. package/dist/infrastructure/security/enhanced-security-gate.js +0 -151
  146. package/dist/infrastructure/security/license-scanner.js +0 -167
  147. package/dist/infrastructure/security/provider-bias-detector.js +0 -164
  148. package/dist/infrastructure/security/sandbox-executor.js +0 -64
  149. package/dist/infrastructure/serialization/toon-serializer.js +0 -119
  150. package/dist/infrastructure/storage/memory-stream-service.js +0 -204
  151. package/dist/infrastructure/storage/plan-repository.js +0 -96
  152. package/dist/infrastructure/storage/sqlite-decision-repository.js +0 -232
  153. package/dist/infrastructure/storage/sqlite-embedding-repository.js +0 -311
  154. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js +0 -417
  155. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js +0 -230
  156. package/dist/infrastructure/storage/sqlite-memory-repository.js +0 -229
  157. package/dist/infrastructure/storage/sqlite-pattern-repository.js +0 -249
  158. package/dist/infrastructure/storage/task-helpers.js +0 -197
  159. package/dist/infrastructure/telemetry/telemetry-service.js +0 -167
  160. package/dist/infrastructure/ux/appropriate-friction.js +0 -213
  161. package/dist/infrastructure/ux/bi-directional-learning.js +0 -337
  162. package/dist/infrastructure/ux/capability-boundaries.js +0 -42
  163. package/dist/infrastructure/ux/comprehensive-formatter.js +0 -117
  164. package/dist/infrastructure/ux/contextual-feature-discovery.js +0 -10
  165. package/dist/infrastructure/ux/expectation-management.js +0 -327
  166. package/dist/infrastructure/ux/feature-discovery.js +0 -14
  167. package/dist/infrastructure/ux/feedback-prompt.js +0 -45
  168. package/dist/infrastructure/ux/hitl-validation.js +0 -297
  169. package/dist/infrastructure/ux/progress-indicator.js +0 -116
  170. package/dist/infrastructure/ux/progressive-disclosure.js +0 -236
  171. package/dist/infrastructure/ux/review-checkpoint.js +0 -72
  172. package/dist/infrastructure/ux/staged-feature-intro.js +0 -24
  173. package/dist/infrastructure/ux/stream-markdown.js +0 -151
  174. package/dist/infrastructure/ux/syntax-highlighter.js +0 -91
  175. package/dist/infrastructure/ux/team-standards.js +0 -196
  176. package/dist/infrastructure/ux/transparency.js +0 -71
  177. package/dist/infrastructure/validation/agent-feedback.js +0 -55
  178. package/dist/infrastructure/validation/agent-validation-helper.js +0 -137
  179. package/dist/infrastructure/validation/review-handler.js +0 -40
  180. package/dist/infrastructure/validation/summary-aggregator.js +0 -70
  181. package/dist/infrastructure/validation/summary-extractor.js +0 -45
  182. package/dist/infrastructure/validation/trace-summary.js +0 -52
  183. package/dist/infrastructure/verification/verification-service.js +0 -47
  184. package/dist/infrastructure/xai/attention-visualizer.js +0 -172
  185. package/dist/infrastructure/xai/cot-visualizer.js +0 -283
  186. package/dist/infrastructure/xai/decision-tree-log.js +0 -212
  187. package/dist/infrastructure/xai/interactive-xai.js +0 -260
  188. package/dist/infrastructure/xai/uncertainty-quantifier.js +0 -198
  189. package/dist/intelligent-retrieval.js +0 -272
  190. package/dist/intent/classifier.js +0 -2
  191. package/dist/intent/context.js +0 -2
  192. package/dist/iterative-refinement.js +0 -189
  193. package/dist/learning.js +0 -232
  194. package/dist/log.js +0 -31
  195. package/dist/migrate.js +0 -133
  196. package/dist/parallel-processor.js +0 -534
  197. package/dist/planner.js +0 -198
  198. package/dist/policy.js +0 -26
  199. package/dist/presentation/cli/commands/ask-command.js +0 -314
  200. package/dist/presentation/cli/commands/cost-command.js +0 -191
  201. package/dist/presentation/cli/commands/decision-command.js +0 -207
  202. package/dist/presentation/cli/commands/docs-command.js +0 -25
  203. package/dist/presentation/cli/commands/fix-command.js +0 -53
  204. package/dist/presentation/cli/commands/knowledge-command.js +0 -129
  205. package/dist/presentation/cli/commands/learning-dashboard-command.js +0 -183
  206. package/dist/presentation/cli/commands/models-command.js +0 -194
  207. package/dist/presentation/cli/commands/orchestrate-command.js +0 -207
  208. package/dist/presentation/cli/commands/plan-command.js +0 -246
  209. package/dist/presentation/cli/commands/product-command.js +0 -199
  210. package/dist/presentation/cli/commands/react-command.js +0 -181
  211. package/dist/presentation/cli/commands/review-command.js +0 -154
  212. package/dist/presentation/cli/commands/run-command.js +0 -188
  213. package/dist/presentation/cli/commands/smart-command.js +0 -395
  214. package/dist/presentation/cli/commands/suggest-command.js +0 -138
  215. package/dist/presentation/cli/commands/trace-command.js +0 -129
  216. package/dist/presentation/cli/commands/undo-command.js +0 -150
  217. package/dist/query-optimizer.js +0 -205
  218. package/dist/refactor.js +0 -116
  219. package/dist/review.js +0 -206
  220. package/dist/search.js +0 -163
  221. package/dist/session.js +0 -704
  222. package/dist/task-verification.js +0 -336
  223. package/dist/testgen.js +0 -166
  224. package/dist/token-optimizer.js +0 -277
  225. package/dist/tools/bash.js +0 -213
  226. package/dist/tools/edit.js +0 -235
  227. package/dist/tools/executor.js +0 -153
  228. package/dist/tools/git-tool.js +0 -292
  229. package/dist/tools/parser.js +0 -158
  230. package/dist/tools/registry.js +0 -302
  231. package/dist/tools/search.js +0 -100
  232. package/dist/types.js +0 -2
  233. package/dist/utils/check-api-status.js +0 -100
  234. package/dist/utils/diff-parser.js +0 -162
  235. package/dist/verification/backup.js +0 -259
  236. package/dist/verification/compiler.js +0 -264
  237. package/dist/verification/index.js +0 -273
  238. package/dist/verification/test-runner.js +0 -379
@@ -1,116 +0,0 @@
1
- /**
2
- * Progress Indicator Utilities
3
- * Provides progress indicators for long-running operations
4
- *
5
- * Phase 1: v0.5.0-alpha.0
6
- */
7
- import { createSpinner } from '../../ui.js';
8
- export class ProgressIndicator {
9
- spinner = null;
10
- progressBar = '';
11
- operationStartTime = 0;
12
- currentValue = 0;
13
- total = 0;
14
- message = '';
15
- /**
16
- * Start progress indicator
17
- */
18
- start(options = {}) {
19
- this.operationStartTime = Date.now();
20
- this.currentValue = 0;
21
- this.total = options.total || 0;
22
- this.message = options.message || 'Processing...';
23
- if (this.total > 0) {
24
- // Progress bar mode
25
- this.update(0, this.message);
26
- }
27
- else {
28
- // Spinner mode
29
- this.spinner = createSpinner(this.message);
30
- this.spinner.start();
31
- }
32
- }
33
- /**
34
- * Update progress
35
- */
36
- update(value, message) {
37
- this.currentValue = value;
38
- if (message) {
39
- this.message = message;
40
- }
41
- if (this.total > 0) {
42
- // Progress bar
43
- const percentage = Math.min(100, Math.floor((value / this.total) * 100));
44
- const barLength = 20;
45
- const filled = Math.floor((percentage / 100) * barLength);
46
- const bar = '█'.repeat(filled) + '░'.repeat(barLength - filled);
47
- process.stdout.write(`\r${this.message} [${bar}] ${percentage}% (${value}/${this.total})`);
48
- }
49
- else if (this.spinner) {
50
- // Spinner
51
- this.spinner.text = this.message;
52
- }
53
- }
54
- /**
55
- * Increment progress
56
- */
57
- increment(delta = 1, message) {
58
- this.update(this.currentValue + delta, message);
59
- }
60
- /**
61
- * Stop progress indicator with smooth transition
62
- */
63
- stop(success = true, finalMessage) {
64
- if (this.spinner) {
65
- this.spinner.stop();
66
- this.spinner = null;
67
- }
68
- else if (this.total > 0) {
69
- // Clear progress bar
70
- process.stdout.write('\r' + ' '.repeat(80) + '\r');
71
- }
72
- if (finalMessage) {
73
- console.log(finalMessage);
74
- }
75
- }
76
- /**
77
- * Get elapsed time
78
- */
79
- getElapsedTime() {
80
- return Date.now() - this.operationStartTime;
81
- }
82
- }
83
- /**
84
- * Create progress indicator for embedding search
85
- */
86
- export function createEmbeddingSearchProgress(total) {
87
- const indicator = new ProgressIndicator();
88
- indicator.start({
89
- total,
90
- message: 'Searching embeddings',
91
- showPercentage: true,
92
- showCount: true,
93
- });
94
- return indicator;
95
- }
96
- /**
97
- * Create progress indicator for plan generation
98
- */
99
- export function createPlanGenerationProgress() {
100
- const indicator = new ProgressIndicator();
101
- indicator.start({
102
- message: 'Generating plan',
103
- });
104
- return indicator;
105
- }
106
- /**
107
- * Create progress indicator for memory synthesis
108
- */
109
- export function createMemorySynthesisProgress() {
110
- const indicator = new ProgressIndicator();
111
- indicator.start({
112
- message: 'Synthesizing memories',
113
- });
114
- return indicator;
115
- }
116
- //# sourceMappingURL=progress-indicator.js.map
@@ -1,236 +0,0 @@
1
- /**
2
- * Infrastructure: Progressive Disclosure System
3
- *
4
- * Staged capability introduction to build trust and reduce cognitive load
5
- * Research: Progressive disclosure for capability introduction, expectation management
6
- *
7
- * Features:
8
- * - Feature capability levels (beginner, intermediate, advanced)
9
- * - Staged feature revelation based on user experience
10
- * - Contextual feature discovery
11
- * - Onboarding flow management
12
- */
13
- /**
14
- * Progressive Disclosure System
15
- * Manages staged feature introduction based on user experience
16
- */
17
- export class ProgressiveDisclosure {
18
- featureRegistry = new Map();
19
- userProfiles = new Map();
20
- constructor() {
21
- this.initializeDefaultFeatures();
22
- }
23
- /**
24
- * Register feature capability level
25
- */
26
- registerFeature(feature) {
27
- this.featureRegistry.set(feature.featureId, feature);
28
- }
29
- /**
30
- * Get user profile (create if doesn't exist)
31
- */
32
- getUserProfile(userId) {
33
- if (!this.userProfiles.has(userId)) {
34
- this.userProfiles.set(userId, {
35
- userId,
36
- level: 'beginner',
37
- featuresDiscovered: [],
38
- featuresUsed: new Map(),
39
- onboardingComplete: false,
40
- createdAt: Date.now(),
41
- lastUpdated: Date.now(),
42
- });
43
- }
44
- return this.userProfiles.get(userId);
45
- }
46
- /**
47
- * Check if feature should be shown to user
48
- */
49
- shouldShowFeature(userId, featureId) {
50
- const profile = this.getUserProfile(userId);
51
- const feature = this.featureRegistry.get(featureId);
52
- if (!feature) {
53
- return { show: false, reason: 'Feature not found' };
54
- }
55
- // Check if prerequisites are met
56
- if (feature.prerequisites) {
57
- for (const prereqId of feature.prerequisites) {
58
- if (!profile.featuresDiscovered.includes(prereqId)) {
59
- return {
60
- show: false,
61
- reason: `Requires learning "${prereqId}" first`,
62
- };
63
- }
64
- }
65
- }
66
- // Check user level
67
- const levelOrder = ['beginner', 'intermediate', 'advanced', 'expert'];
68
- const userLevelIndex = levelOrder.indexOf(profile.level);
69
- const requiredLevelIndex = levelOrder.indexOf(feature.requiredLevel);
70
- if (userLevelIndex < requiredLevelIndex) {
71
- return {
72
- show: false,
73
- reason: `Requires ${feature.requiredLevel} level (you are ${profile.level})`,
74
- suggestedLevel: feature.requiredLevel,
75
- };
76
- }
77
- return { show: true };
78
- }
79
- /**
80
- * Get features available to user
81
- */
82
- getAvailableFeatures(userId) {
83
- const profile = this.getUserProfile(userId);
84
- const available = [];
85
- const features = Array.from(this.featureRegistry.values());
86
- for (const feature of features) {
87
- const { show } = this.shouldShowFeature(userId, feature.featureId);
88
- if (show) {
89
- available.push(feature);
90
- }
91
- }
92
- return available.sort((a, b) => {
93
- // Sort by capability level (basic first) then by name
94
- const capabilityOrder = ['basic', 'standard', 'advanced', 'experimental'];
95
- const aIndex = capabilityOrder.indexOf(a.capability);
96
- const bIndex = capabilityOrder.indexOf(b.capability);
97
- if (aIndex !== bIndex)
98
- return aIndex - bIndex;
99
- return a.featureName.localeCompare(b.featureName);
100
- });
101
- }
102
- /**
103
- * Get features to suggest next (not yet discovered)
104
- */
105
- getNextSuggestedFeatures(userId, limit = 3) {
106
- const profile = this.getUserProfile(userId);
107
- const available = this.getAvailableFeatures(userId);
108
- const undiscovered = available.filter(f => !profile.featuresDiscovered.includes(f.featureId));
109
- return undiscovered.slice(0, limit);
110
- }
111
- /**
112
- * Mark feature as discovered
113
- */
114
- markFeatureDiscovered(userId, featureId) {
115
- const profile = this.getUserProfile(userId);
116
- if (!profile.featuresDiscovered.includes(featureId)) {
117
- profile.featuresDiscovered.push(featureId);
118
- profile.lastUpdated = Date.now();
119
- }
120
- }
121
- /**
122
- * Record feature usage
123
- */
124
- recordFeatureUsage(userId, featureId) {
125
- const profile = this.getUserProfile(userId);
126
- const currentCount = profile.featuresUsed.get(featureId) || 0;
127
- profile.featuresUsed.set(featureId, currentCount + 1);
128
- profile.lastUpdated = Date.now();
129
- // Auto-discover on first use
130
- this.markFeatureDiscovered(userId, featureId);
131
- // Check for level progression
132
- this.checkLevelProgression(userId);
133
- }
134
- /**
135
- * Update user level
136
- */
137
- setUserLevel(userId, level) {
138
- const profile = this.getUserProfile(userId);
139
- profile.level = level;
140
- profile.lastUpdated = Date.now();
141
- }
142
- /**
143
- * Mark onboarding as complete
144
- */
145
- completeOnboarding(userId) {
146
- const profile = this.getUserProfile(userId);
147
- profile.onboardingComplete = true;
148
- profile.lastUpdated = Date.now();
149
- }
150
- // Private helpers
151
- initializeDefaultFeatures() {
152
- // Basic features (beginner)
153
- this.registerFeature({
154
- featureId: 'ask-question',
155
- featureName: 'Ask Questions About Code',
156
- capability: 'basic',
157
- requiredLevel: 'beginner',
158
- description: 'Ask questions about your codebase and get AI-powered answers',
159
- });
160
- this.registerFeature({
161
- featureId: 'edit-file',
162
- featureName: 'Edit Files',
163
- capability: 'basic',
164
- requiredLevel: 'beginner',
165
- description: 'Edit existing files with natural language instructions',
166
- });
167
- // Standard features (intermediate)
168
- this.registerFeature({
169
- featureId: 'multi-file-edit',
170
- featureName: 'Multi-File Editing',
171
- capability: 'standard',
172
- requiredLevel: 'intermediate',
173
- description: 'Edit multiple files in a single operation',
174
- prerequisites: ['edit-file'],
175
- });
176
- this.registerFeature({
177
- featureId: 'code-search',
178
- featureName: 'Intelligent Code Search',
179
- capability: 'standard',
180
- requiredLevel: 'intermediate',
181
- description: 'Search codebase using AST-based understanding',
182
- prerequisites: ['ask-question'],
183
- });
184
- // Advanced features (advanced)
185
- this.registerFeature({
186
- featureId: 'react-orchestration',
187
- featureName: 'ReAct Orchestration',
188
- capability: 'advanced',
189
- requiredLevel: 'advanced',
190
- description: 'Multi-step reasoning with tool execution',
191
- prerequisites: ['edit-file', 'code-search'],
192
- });
193
- this.registerFeature({
194
- featureId: 'planning',
195
- featureName: 'Hierarchical Planning',
196
- capability: 'advanced',
197
- requiredLevel: 'advanced',
198
- description: 'Break down complex tasks into sub-plans',
199
- prerequisites: ['react-orchestration'],
200
- });
201
- // Experimental features (expert)
202
- this.registerFeature({
203
- featureId: 'xai-visualization',
204
- featureName: 'XAI Visualization',
205
- capability: 'experimental',
206
- requiredLevel: 'expert',
207
- description: 'Interactive explainable AI features (CoT, Attention)',
208
- prerequisites: ['react-orchestration'],
209
- });
210
- this.registerFeature({
211
- featureId: 'governance-policies',
212
- featureName: 'Governance Policies',
213
- capability: 'experimental',
214
- requiredLevel: 'expert',
215
- description: 'Policy-as-Code and governance features',
216
- prerequisites: ['planning'],
217
- });
218
- }
219
- checkLevelProgression(userId) {
220
- const profile = this.getUserProfile(userId);
221
- const featuresUsed = Array.from(profile.featuresUsed.values());
222
- const totalUsage = featuresUsed.reduce((sum, count) => sum + count, 0);
223
- const uniqueFeaturesUsed = profile.featuresUsed.size;
224
- // Progression logic
225
- if (profile.level === 'beginner' && uniqueFeaturesUsed >= 3 && totalUsage >= 10) {
226
- this.setUserLevel(userId, 'intermediate');
227
- }
228
- else if (profile.level === 'intermediate' && uniqueFeaturesUsed >= 6 && totalUsage >= 30) {
229
- this.setUserLevel(userId, 'advanced');
230
- }
231
- else if (profile.level === 'advanced' && uniqueFeaturesUsed >= 10 && totalUsage >= 100) {
232
- this.setUserLevel(userId, 'expert');
233
- }
234
- }
235
- }
236
- //# sourceMappingURL=progressive-disclosure.js.map
@@ -1,72 +0,0 @@
1
- /**
2
- * Review Checkpoint UI
3
- * Shows summary before applying edits
4
- *
5
- * Phase 1: v0.5.0-alpha.0
6
- */
7
- import { colors, separator } from '../../ui.js';
8
- /**
9
- * Display review checkpoint before applying edits
10
- */
11
- export function displayReviewCheckpoint(info) {
12
- console.log('\n' + separator('═', 80));
13
- console.log(colors.bold('📋 Review Checkpoint'));
14
- console.log(separator('═', 80));
15
- // Files summary
16
- console.log(`\n${colors.bold('Files to modify:')} ${info.filesToModify.length}`);
17
- info.filesToModify.forEach((file, idx) => {
18
- console.log(` ${idx + 1}. ${file.filepath}`);
19
- console.log(` +${file.linesAdded} -${file.linesRemoved} ~${file.linesChanged}`);
20
- });
21
- // Validation status
22
- console.log(`\n${colors.bold('Validation:')}`);
23
- console.log(` Security scan: ${info.securityScanPassed ? colors.green('✓ Passed') : colors.red('✗ Failed')}`);
24
- console.log(` Compilation: ${info.compilationValid ? colors.green('✓ Valid') : colors.red('✗ Invalid')}`);
25
- // Risk level
26
- const riskColor = info.riskLevel === 'low' ? colors.green :
27
- info.riskLevel === 'medium' ? colors.yellow :
28
- info.riskLevel === 'high' ? colors.red :
29
- colors.red;
30
- console.log(` Risk level: ${riskColor(info.riskLevel.toUpperCase())}`);
31
- if (info.uncertainty !== undefined) {
32
- console.log(` Uncertainty: ${(info.uncertainty * 100).toFixed(1)}%`);
33
- }
34
- console.log(separator('═', 80) + '\n');
35
- }
36
- /**
37
- * Calculate diff summary from old and new content
38
- */
39
- export function calculateDiffSummary(oldContent, newContent) {
40
- const oldLines = oldContent.split('\n');
41
- const newLines = newContent.split('\n');
42
- let linesAdded = 0;
43
- let linesRemoved = 0;
44
- let linesChanged = 0;
45
- // Simple line-by-line comparison
46
- const maxLen = Math.max(oldLines.length, newLines.length);
47
- for (let i = 0; i < maxLen; i++) {
48
- const oldLine = oldLines[i];
49
- const newLine = newLines[i];
50
- if (oldLine === undefined) {
51
- linesAdded++;
52
- }
53
- else if (newLine === undefined) {
54
- linesRemoved++;
55
- }
56
- else if (oldLine !== newLine) {
57
- linesChanged++;
58
- }
59
- }
60
- return {
61
- linesAdded,
62
- linesRemoved,
63
- linesChanged,
64
- };
65
- }
66
- /**
67
- * Format edit summary for display
68
- */
69
- export function formatEditSummary(summary) {
70
- return `${summary.filepath}: +${summary.linesAdded} -${summary.linesRemoved} ~${summary.linesChanged}`;
71
- }
72
- //# sourceMappingURL=review-checkpoint.js.map
@@ -1,24 +0,0 @@
1
- /**
2
- * Staged Feature Introduction
3
- * Checks feature access and displays availability
4
- *
5
- * Phase 1: v0.5.0-alpha.0
6
- */
7
- /**
8
- * Check feature access
9
- */
10
- export function checkFeatureAccess(progressiveDisclosure, userId, feature) {
11
- // In alpha, all features are available
12
- return {
13
- available: true,
14
- shouldContinue: true,
15
- };
16
- }
17
- /**
18
- * Display feature availability
19
- */
20
- export function displayFeatureAvailability(featureName, capability, userLevel) {
21
- // In alpha, no-op
22
- // Can be enhanced later to show feature introductions
23
- }
24
- //# sourceMappingURL=staged-feature-intro.js.map
@@ -1,151 +0,0 @@
1
- /**
2
- * Incremental Markdown Renderer for Streaming Output
3
- *
4
- * Converts markdown to terminal formatting as tokens arrive.
5
- * Handles: ## headers, **bold**, `code`, ```code blocks```, - bullets
6
- */
7
- import chalk from 'chalk';
8
- export function createMarkdownStream() {
9
- let buffer = '';
10
- let inCodeBlock = false;
11
- let codeBlockLang = '';
12
- let lineStart = true; // Are we at the start of a new line?
13
- function emit(text) {
14
- process.stdout.write(text);
15
- }
16
- function processLine(line) {
17
- // Code block fence
18
- if (line.startsWith('```')) {
19
- if (!inCodeBlock) {
20
- inCodeBlock = true;
21
- codeBlockLang = line.slice(3).trim();
22
- return chalk.dim(' ┌' + (codeBlockLang ? ' ' + codeBlockLang : ''));
23
- }
24
- else {
25
- inCodeBlock = false;
26
- codeBlockLang = '';
27
- return chalk.dim(' └');
28
- }
29
- }
30
- // Inside code block — dim, indented
31
- if (inCodeBlock) {
32
- return chalk.cyan(' │ ') + line;
33
- }
34
- // Headers
35
- if (line.startsWith('### ')) {
36
- return chalk.bold(line.slice(4));
37
- }
38
- if (line.startsWith('## ')) {
39
- return '\n' + chalk.bold(line.slice(3));
40
- }
41
- if (line.startsWith('# ')) {
42
- return '\n' + chalk.bold(line.slice(2));
43
- }
44
- // Bullet points
45
- if (line.startsWith('- ') || line.startsWith('* ')) {
46
- return ' • ' + formatInline(line.slice(2));
47
- }
48
- // Numbered list
49
- const numMatch = line.match(/^(\d+)\.\s/);
50
- if (numMatch) {
51
- return ' ' + numMatch[1] + '. ' + formatInline(line.slice(numMatch[0].length));
52
- }
53
- // Regular line
54
- return formatInline(line);
55
- }
56
- function formatInline(text) {
57
- // Bold: **text**
58
- text = text.replace(/\*\*(.+?)\*\*/g, (_, content) => chalk.bold(content));
59
- // Inline code: `text`
60
- text = text.replace(/`([^`]+)`/g, (_, content) => chalk.cyan(content));
61
- // Italic: *text* (but not inside **)
62
- text = text.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g, (_, content) => chalk.dim(content));
63
- return text;
64
- }
65
- return {
66
- write(token) {
67
- buffer += token;
68
- // Process complete lines
69
- while (buffer.includes('\n')) {
70
- const newlineIdx = buffer.indexOf('\n');
71
- const line = buffer.slice(0, newlineIdx);
72
- buffer = buffer.slice(newlineIdx + 1);
73
- const formatted = processLine(line);
74
- emit(formatted + '\n');
75
- lineStart = true;
76
- }
77
- // If there's remaining buffer without a newline, check for inline patterns
78
- // Don't emit yet — wait for the line to complete
79
- // Exception: if buffer is getting long (>200 chars without newline), flush it
80
- if (buffer.length > 200) {
81
- emit(formatInline(buffer));
82
- buffer = '';
83
- lineStart = false;
84
- }
85
- },
86
- flush() {
87
- if (buffer.length > 0) {
88
- const formatted = processLine(buffer);
89
- emit(formatted);
90
- buffer = '';
91
- }
92
- },
93
- };
94
- }
95
- /**
96
- * Format a complete markdown string for terminal display (returns string, doesn't write to stdout).
97
- */
98
- export function formatMarkdownForTerminal(text) {
99
- const output = [];
100
- let inCodeBlock = false;
101
- let codeBlockLang = '';
102
- function fmtInline(t) {
103
- t = t.replace(/\*\*(.+?)\*\*/g, (_, c) => chalk.bold(c));
104
- t = t.replace(/`([^`]+)`/g, (_, c) => chalk.cyan(c));
105
- t = t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g, (_, c) => chalk.dim(c));
106
- return t;
107
- }
108
- for (const line of text.split('\n')) {
109
- if (line.startsWith('```')) {
110
- if (!inCodeBlock) {
111
- inCodeBlock = true;
112
- codeBlockLang = line.slice(3).trim();
113
- output.push(chalk.dim(' ┌' + (codeBlockLang ? ' ' + codeBlockLang : '')));
114
- }
115
- else {
116
- inCodeBlock = false;
117
- codeBlockLang = '';
118
- output.push(chalk.dim(' └'));
119
- }
120
- continue;
121
- }
122
- if (inCodeBlock) {
123
- output.push(chalk.cyan(' │ ') + line);
124
- continue;
125
- }
126
- if (line.startsWith('### ')) {
127
- output.push(chalk.bold(line.slice(4)));
128
- continue;
129
- }
130
- if (line.startsWith('## ')) {
131
- output.push('\n' + chalk.bold(line.slice(3)));
132
- continue;
133
- }
134
- if (line.startsWith('# ')) {
135
- output.push('\n' + chalk.bold(line.slice(2)));
136
- continue;
137
- }
138
- if (line.startsWith('- ') || line.startsWith('* ')) {
139
- output.push(' • ' + fmtInline(line.slice(2)));
140
- continue;
141
- }
142
- const numMatch = line.match(/^(\d+)\.\s/);
143
- if (numMatch) {
144
- output.push(' ' + numMatch[1] + '. ' + fmtInline(line.slice(numMatch[0].length)));
145
- continue;
146
- }
147
- output.push(fmtInline(line));
148
- }
149
- return output.join('\n');
150
- }
151
- //# sourceMappingURL=stream-markdown.js.map
@@ -1,91 +0,0 @@
1
- /**
2
- * Syntax Highlighter for Terminal
3
- * Provides basic syntax highlighting for code snippets using chalk
4
- *
5
- * Phase 1: v0.5.0-alpha.0
6
- */
7
- import { colors } from '../../ui.js';
8
- /**
9
- * Detect language from file extension
10
- */
11
- export function detectLanguage(filepath) {
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
- }
35
- }
36
- /**
37
- * Highlight code based on language
38
- */
39
- export function highlightCode(code, language) {
40
- if (!language || language === 'text') {
41
- return code;
42
- }
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
- });
80
- }
81
- return highlighted;
82
- }
83
- /**
84
- * Format code block with syntax highlighting
85
- */
86
- export function formatCodeBlockWithHighlight(code, language, filepath) {
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`;
90
- }
91
- //# sourceMappingURL=syntax-highlighter.js.map