codehere 0.2.2 → 0.3.0-rc.2

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 (235) 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 +253 -1219
  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/generic-cli-adapter.js +553 -0
  16. package/dist/infrastructure/orchestration/opencode-adapter.js +275 -0
  17. package/dist/infrastructure/orchestration/progress-aggregator.js +189 -0
  18. package/dist/infrastructure/orchestration/readiness.js +106 -0
  19. package/dist/infrastructure/orchestration/session-manager.js +272 -0
  20. package/dist/infrastructure/orchestration/session-persistence.js +109 -0
  21. package/dist/infrastructure/protocols/mcp-helpers.js +10 -30
  22. package/dist/infrastructure/protocols/mcp-server-impl.js +359 -21
  23. package/dist/infrastructure/protocols/ui-page.js +1827 -0
  24. package/dist/infrastructure/security/file-collection.js +115 -0
  25. package/dist/infrastructure/security/trust-scorer.js +301 -56
  26. package/dist/infrastructure/storage/task-repository.js +8 -7
  27. package/dist/monitoring.js +9 -38
  28. package/dist/presentation/cli/commands/help-command.js +96 -139
  29. package/dist/presentation/cli/commands/hook-command.js +17 -24
  30. package/dist/presentation/cli/commands/report-command.js +59 -72
  31. package/dist/presentation/cli/commands/setup-command.js +4 -4
  32. package/dist/presentation/cli/commands/status-command.js +321 -30
  33. package/dist/presentation/cli/commands/trust-command.js +84 -72
  34. package/dist/presentation/cli/error-display.js +17 -21
  35. package/dist/ui.js +11 -11
  36. package/package.json +24 -62
  37. package/dist/agents/base.js +0 -101
  38. package/dist/agents/orchestrator-model-driven.js +0 -141
  39. package/dist/agents/react-orchestrator-agent.js +0 -54
  40. package/dist/application/agents/execution-agent.js +0 -508
  41. package/dist/application/agents/multi-agent-orchestrator.js +0 -295
  42. package/dist/application/agents/planning-agent.js +0 -433
  43. package/dist/application/agents/validation-agent.js +0 -317
  44. package/dist/application/architectures/plan-and-act.js +0 -242
  45. package/dist/application/index.js +0 -12
  46. package/dist/application/services/agent-factory.js +0 -28
  47. package/dist/application/services/dependency-container.js +0 -596
  48. package/dist/application/services/git-context-service.js +0 -83
  49. package/dist/application/services/intelligent-router.js +0 -934
  50. package/dist/application/services/tool-executor-service.js +0 -94
  51. package/dist/application/use-cases/ask-question-use-case.js +0 -338
  52. package/dist/application/use-cases/edit-file-use-case.js +0 -830
  53. package/dist/application/use-cases/explain-file-use-case.js +0 -50
  54. package/dist/application/use-cases/index-codebase-use-case.js +0 -113
  55. package/dist/application/use-cases/planning-use-case.js +0 -276
  56. package/dist/application/use-cases/react-orchestration-use-case.js +0 -329
  57. package/dist/application/use-cases/reflexion-use-case.js +0 -30
  58. package/dist/application/workflows/deterministic-workflows.js +0 -189
  59. package/dist/ast-parser.js +0 -331
  60. package/dist/cache.js +0 -180
  61. package/dist/chat.js +0 -251
  62. package/dist/code-analysis.js +0 -327
  63. package/dist/context.js +0 -187
  64. package/dist/docs.js +0 -146
  65. package/dist/domain/entities/code-chunk.js +0 -6
  66. package/dist/domain/entities/decision.js +0 -9
  67. package/dist/domain/entities/edit.js +0 -6
  68. package/dist/domain/entities/knowledge-node.js +0 -9
  69. package/dist/domain/entities/knowledge-preservation.js +0 -10
  70. package/dist/domain/entities/memory.js +0 -6
  71. package/dist/domain/entities/pattern.js +0 -7
  72. package/dist/domain/entities/plan.js +0 -6
  73. package/dist/domain/entities/query.js +0 -6
  74. package/dist/domain/errors/embeddings-not-found-error.js +0 -13
  75. package/dist/domain/index.js +0 -19
  76. package/dist/domain/interfaces/ai-service.interface.js +0 -6
  77. package/dist/domain/interfaces/code-analyzer.interface.js +0 -6
  78. package/dist/domain/interfaces/decision-repository.interface.js +0 -9
  79. package/dist/domain/interfaces/embedding-repository.interface.js +0 -6
  80. package/dist/domain/interfaces/knowledge-graph-repository.interface.js +0 -9
  81. package/dist/domain/interfaces/knowledge-preservation-repository.interface.js +0 -8
  82. package/dist/domain/interfaces/memory-repository.interface.js +0 -6
  83. package/dist/domain/interfaces/pattern-repository.interface.js +0 -6
  84. package/dist/domain/interfaces/verification-service.interface.js +0 -6
  85. package/dist/domain/services/cross-team-pattern-sharing.js +0 -125
  86. package/dist/domain/services/decision-recorder.js +0 -223
  87. package/dist/domain/services/decision-retriever.js +0 -133
  88. package/dist/domain/services/environment-mode-manager.js +0 -22
  89. package/dist/domain/services/graded-memory-activation.js +0 -69
  90. package/dist/domain/services/knowledge-access.js +0 -132
  91. package/dist/domain/services/knowledge-extractor.js +0 -247
  92. package/dist/domain/services/knowledge-graph-builder.js +0 -268
  93. package/dist/domain/services/knowledge-graph-query.js +0 -187
  94. package/dist/domain/services/memory-retriever.js +0 -82
  95. package/dist/domain/services/memory-synthesizer.js +0 -91
  96. package/dist/domain/services/pattern-extractor.js +0 -442
  97. package/dist/domain/services/query-intent-classifier.js +0 -140
  98. package/dist/domain/services/react-loop.js +0 -186
  99. package/dist/domain/services/risk-tier-detector.js +0 -78
  100. package/dist/edit.js +0 -319
  101. package/dist/embed.js +0 -459
  102. package/dist/formatter.js +0 -168
  103. package/dist/git.js +0 -198
  104. package/dist/infrastructure/ai/cohere-ai-service.js +0 -607
  105. package/dist/infrastructure/ai/command-r-evaluation.js +0 -206
  106. package/dist/infrastructure/ai/model-config.js +0 -84
  107. package/dist/infrastructure/ai/provider-ai-service.js +0 -477
  108. package/dist/infrastructure/cache/embedding-cache.js +0 -175
  109. package/dist/infrastructure/cache/query-result-cache.js +0 -66
  110. package/dist/infrastructure/cache/response-cache.js +0 -48
  111. package/dist/infrastructure/cache/security-scan-cache.js +0 -47
  112. package/dist/infrastructure/chunking/ast-code-chunker.js +0 -19
  113. package/dist/infrastructure/chunking/code-aware-chunker.js +0 -397
  114. package/dist/infrastructure/context/context-compressor.js +0 -329
  115. package/dist/infrastructure/context/conversation-context.js +0 -128
  116. package/dist/infrastructure/context/session-manager.js +0 -94
  117. package/dist/infrastructure/cost/cost-tracker.js +0 -360
  118. package/dist/infrastructure/file-scanner/file-scanner.js +0 -106
  119. package/dist/infrastructure/governance/nist-ai-rmf.js +0 -292
  120. package/dist/infrastructure/governance/policy-as-code.js +0 -258
  121. package/dist/infrastructure/governance/prompt-to-code-lineage.js +0 -239
  122. package/dist/infrastructure/index.js +0 -7
  123. package/dist/infrastructure/observability/prompt-versioner.js +0 -145
  124. package/dist/infrastructure/protocols/a2a-metadata.js +0 -137
  125. package/dist/infrastructure/protocols/a2a-protocol.js +0 -314
  126. package/dist/infrastructure/protocols/mcp-oauth.js +0 -184
  127. package/dist/infrastructure/protocols/mcp-server.js +0 -333
  128. package/dist/infrastructure/protocols/streaming-handler.js +0 -103
  129. package/dist/infrastructure/providers/cohere-provider.js +0 -444
  130. package/dist/infrastructure/providers/fake-provider.js +0 -130
  131. package/dist/infrastructure/providers/local-llm-provider.js +0 -330
  132. package/dist/infrastructure/providers/model-config.types.js +0 -9
  133. package/dist/infrastructure/providers/model-provider.interface.js +0 -8
  134. package/dist/infrastructure/providers/openai-provider.js +0 -413
  135. package/dist/infrastructure/providers/openrouter-provider.js +0 -399
  136. package/dist/infrastructure/providers/operation-provider-resolver.js +0 -105
  137. package/dist/infrastructure/providers/provider-config-loader.js +0 -120
  138. package/dist/infrastructure/providers/provider-registry.js +0 -88
  139. package/dist/infrastructure/safety/pattern-detector.js +0 -133
  140. package/dist/infrastructure/security/ai-sast-scanner.js +0 -290
  141. package/dist/infrastructure/security/docker-sandbox.js +0 -178
  142. package/dist/infrastructure/security/enhanced-security-gate.js +0 -151
  143. package/dist/infrastructure/security/license-scanner.js +0 -167
  144. package/dist/infrastructure/security/provider-bias-detector.js +0 -164
  145. package/dist/infrastructure/security/sandbox-executor.js +0 -64
  146. package/dist/infrastructure/serialization/toon-serializer.js +0 -119
  147. package/dist/infrastructure/storage/memory-stream-service.js +0 -204
  148. package/dist/infrastructure/storage/plan-repository.js +0 -96
  149. package/dist/infrastructure/storage/sqlite-decision-repository.js +0 -232
  150. package/dist/infrastructure/storage/sqlite-embedding-repository.js +0 -311
  151. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js +0 -417
  152. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js +0 -230
  153. package/dist/infrastructure/storage/sqlite-memory-repository.js +0 -229
  154. package/dist/infrastructure/storage/sqlite-pattern-repository.js +0 -249
  155. package/dist/infrastructure/storage/task-helpers.js +0 -197
  156. package/dist/infrastructure/telemetry/telemetry-service.js +0 -167
  157. package/dist/infrastructure/ux/appropriate-friction.js +0 -213
  158. package/dist/infrastructure/ux/bi-directional-learning.js +0 -337
  159. package/dist/infrastructure/ux/capability-boundaries.js +0 -42
  160. package/dist/infrastructure/ux/comprehensive-formatter.js +0 -117
  161. package/dist/infrastructure/ux/contextual-feature-discovery.js +0 -10
  162. package/dist/infrastructure/ux/expectation-management.js +0 -327
  163. package/dist/infrastructure/ux/feature-discovery.js +0 -14
  164. package/dist/infrastructure/ux/feedback-prompt.js +0 -45
  165. package/dist/infrastructure/ux/hitl-validation.js +0 -297
  166. package/dist/infrastructure/ux/progress-indicator.js +0 -116
  167. package/dist/infrastructure/ux/progressive-disclosure.js +0 -236
  168. package/dist/infrastructure/ux/review-checkpoint.js +0 -72
  169. package/dist/infrastructure/ux/staged-feature-intro.js +0 -24
  170. package/dist/infrastructure/ux/stream-markdown.js +0 -151
  171. package/dist/infrastructure/ux/syntax-highlighter.js +0 -91
  172. package/dist/infrastructure/ux/team-standards.js +0 -196
  173. package/dist/infrastructure/ux/transparency.js +0 -71
  174. package/dist/infrastructure/validation/agent-feedback.js +0 -55
  175. package/dist/infrastructure/validation/agent-validation-helper.js +0 -137
  176. package/dist/infrastructure/validation/review-handler.js +0 -40
  177. package/dist/infrastructure/validation/summary-aggregator.js +0 -70
  178. package/dist/infrastructure/validation/summary-extractor.js +0 -45
  179. package/dist/infrastructure/validation/trace-summary.js +0 -52
  180. package/dist/infrastructure/verification/verification-service.js +0 -47
  181. package/dist/infrastructure/xai/attention-visualizer.js +0 -172
  182. package/dist/infrastructure/xai/cot-visualizer.js +0 -283
  183. package/dist/infrastructure/xai/decision-tree-log.js +0 -212
  184. package/dist/infrastructure/xai/interactive-xai.js +0 -260
  185. package/dist/infrastructure/xai/uncertainty-quantifier.js +0 -198
  186. package/dist/intelligent-retrieval.js +0 -272
  187. package/dist/intent/classifier.js +0 -2
  188. package/dist/intent/context.js +0 -2
  189. package/dist/iterative-refinement.js +0 -189
  190. package/dist/learning.js +0 -232
  191. package/dist/log.js +0 -31
  192. package/dist/migrate.js +0 -133
  193. package/dist/parallel-processor.js +0 -534
  194. package/dist/planner.js +0 -198
  195. package/dist/policy.js +0 -26
  196. package/dist/presentation/cli/commands/ask-command.js +0 -314
  197. package/dist/presentation/cli/commands/cost-command.js +0 -191
  198. package/dist/presentation/cli/commands/decision-command.js +0 -207
  199. package/dist/presentation/cli/commands/docs-command.js +0 -25
  200. package/dist/presentation/cli/commands/fix-command.js +0 -53
  201. package/dist/presentation/cli/commands/knowledge-command.js +0 -129
  202. package/dist/presentation/cli/commands/learning-dashboard-command.js +0 -183
  203. package/dist/presentation/cli/commands/models-command.js +0 -194
  204. package/dist/presentation/cli/commands/orchestrate-command.js +0 -207
  205. package/dist/presentation/cli/commands/plan-command.js +0 -246
  206. package/dist/presentation/cli/commands/product-command.js +0 -199
  207. package/dist/presentation/cli/commands/react-command.js +0 -181
  208. package/dist/presentation/cli/commands/review-command.js +0 -154
  209. package/dist/presentation/cli/commands/run-command.js +0 -188
  210. package/dist/presentation/cli/commands/smart-command.js +0 -395
  211. package/dist/presentation/cli/commands/suggest-command.js +0 -138
  212. package/dist/presentation/cli/commands/trace-command.js +0 -129
  213. package/dist/presentation/cli/commands/undo-command.js +0 -150
  214. package/dist/query-optimizer.js +0 -205
  215. package/dist/refactor.js +0 -116
  216. package/dist/review.js +0 -206
  217. package/dist/search.js +0 -163
  218. package/dist/session.js +0 -704
  219. package/dist/task-verification.js +0 -336
  220. package/dist/testgen.js +0 -166
  221. package/dist/token-optimizer.js +0 -277
  222. package/dist/tools/bash.js +0 -213
  223. package/dist/tools/edit.js +0 -235
  224. package/dist/tools/executor.js +0 -153
  225. package/dist/tools/git-tool.js +0 -292
  226. package/dist/tools/parser.js +0 -158
  227. package/dist/tools/registry.js +0 -302
  228. package/dist/tools/search.js +0 -100
  229. package/dist/types.js +0 -2
  230. package/dist/utils/check-api-status.js +0 -100
  231. package/dist/utils/diff-parser.js +0 -162
  232. package/dist/verification/backup.js +0 -259
  233. package/dist/verification/compiler.js +0 -264
  234. package/dist/verification/index.js +0 -273
  235. 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