codehere 0.4.0 → 0.5.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +113 -30
- package/dist/application/agents/execution-agent.js +2 -2
- package/dist/application/agents/execution-agent.js.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.d.ts +1 -0
- package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.js +10 -3
- package/dist/application/agents/multi-agent-orchestrator.js.map +1 -1
- package/dist/application/agents/planning-agent.d.ts.map +1 -1
- package/dist/application/agents/planning-agent.js +22 -10
- package/dist/application/agents/planning-agent.js.map +1 -1
- package/dist/application/agents/validation-agent.js +2 -2
- package/dist/application/agents/validation-agent.js.map +1 -1
- package/dist/application/reasoning/multi-model-planning-strategy.d.ts +21 -0
- package/dist/application/reasoning/multi-model-planning-strategy.d.ts.map +1 -0
- package/dist/application/reasoning/multi-model-planning-strategy.js +158 -0
- package/dist/application/reasoning/multi-model-planning-strategy.js.map +1 -0
- package/dist/application/reasoning/reasoning-config.d.ts +15 -0
- package/dist/application/reasoning/reasoning-config.d.ts.map +1 -0
- package/dist/application/reasoning/reasoning-config.js +50 -0
- package/dist/application/reasoning/reasoning-config.js.map +1 -0
- package/dist/application/reasoning/reasoning-orchestrator.d.ts +18 -0
- package/dist/application/reasoning/reasoning-orchestrator.d.ts.map +1 -0
- package/dist/application/reasoning/reasoning-orchestrator.js +170 -0
- package/dist/application/reasoning/reasoning-orchestrator.js.map +1 -0
- package/dist/application/reasoning/reasoning-strategy.interface.d.ts +24 -0
- package/dist/application/reasoning/reasoning-strategy.interface.d.ts.map +1 -0
- package/dist/application/reasoning/reasoning-strategy.interface.js +6 -0
- package/dist/application/reasoning/reasoning-strategy.interface.js.map +1 -0
- package/dist/application/reasoning/role-provider-resolver.d.ts +36 -0
- package/dist/application/reasoning/role-provider-resolver.d.ts.map +1 -0
- package/dist/application/reasoning/role-provider-resolver.js +74 -0
- package/dist/application/reasoning/role-provider-resolver.js.map +1 -0
- package/dist/application/reasoning/simple-planning-strategy.d.ts +22 -0
- package/dist/application/reasoning/simple-planning-strategy.d.ts.map +1 -0
- package/dist/application/reasoning/simple-planning-strategy.js +217 -0
- package/dist/application/reasoning/simple-planning-strategy.js.map +1 -0
- package/dist/application/reasoning/types.d.ts +65 -0
- package/dist/application/reasoning/types.d.ts.map +1 -0
- package/dist/application/reasoning/types.js +6 -0
- package/dist/application/reasoning/types.js.map +1 -0
- package/dist/application/reasoning/validator-strategy.d.ts +56 -0
- package/dist/application/reasoning/validator-strategy.d.ts.map +1 -0
- package/dist/application/reasoning/validator-strategy.js +103 -0
- package/dist/application/reasoning/validator-strategy.js.map +1 -0
- package/dist/application/services/dependency-container.d.ts +30 -6
- package/dist/application/services/dependency-container.d.ts.map +1 -1
- package/dist/application/services/dependency-container.js +96 -44
- package/dist/application/services/dependency-container.js.map +1 -1
- package/dist/application/services/intelligent-router.d.ts +6 -0
- package/dist/application/services/intelligent-router.d.ts.map +1 -1
- package/dist/application/services/intelligent-router.js +98 -9
- package/dist/application/services/intelligent-router.js.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.d.ts +1 -0
- package/dist/application/use-cases/ask-question-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.js +4 -3
- package/dist/application/use-cases/ask-question-use-case.js.map +1 -1
- package/dist/application/use-cases/planning-use-case.d.ts +14 -1
- package/dist/application/use-cases/planning-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/planning-use-case.js +109 -2
- package/dist/application/use-cases/planning-use-case.js.map +1 -1
- package/dist/domain/entities/memory.d.ts.map +1 -1
- package/dist/domain/entities/task.d.ts +1 -1
- package/dist/domain/entities/task.d.ts.map +1 -1
- package/dist/domain/entities/task.js +2 -2
- package/dist/domain/entities/task.js.map +1 -1
- package/dist/domain/errors/embeddings-not-found-error.d.ts +9 -0
- package/dist/domain/errors/embeddings-not-found-error.d.ts.map +1 -0
- package/dist/domain/errors/embeddings-not-found-error.js +13 -0
- package/dist/domain/errors/embeddings-not-found-error.js.map +1 -0
- package/dist/domain/interfaces/embedding-repository.interface.d.ts +5 -0
- package/dist/domain/interfaces/embedding-repository.interface.d.ts.map +1 -1
- package/dist/domain/services/environment-mode-manager.d.ts +4 -10
- package/dist/domain/services/environment-mode-manager.d.ts.map +1 -1
- package/dist/domain/services/environment-mode-manager.js +7 -22
- package/dist/domain/services/environment-mode-manager.js.map +1 -1
- package/dist/domain/services/query-intent-classifier.d.ts.map +1 -1
- package/dist/domain/services/query-intent-classifier.js +20 -1
- package/dist/domain/services/query-intent-classifier.js.map +1 -1
- package/dist/domain/services/risk-tier-detector.d.ts +8 -9
- package/dist/domain/services/risk-tier-detector.d.ts.map +1 -1
- package/dist/domain/services/risk-tier-detector.js +53 -40
- package/dist/domain/services/risk-tier-detector.js.map +1 -1
- package/dist/embed.d.ts.map +1 -1
- package/dist/embed.js +18 -8
- package/dist/embed.js.map +1 -1
- package/dist/index.js +405 -52
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.js +4 -4
- package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -1
- package/dist/infrastructure/ai/provider-ai-service.d.ts.map +1 -1
- package/dist/infrastructure/ai/provider-ai-service.js +7 -7
- package/dist/infrastructure/ai/provider-ai-service.js.map +1 -1
- package/dist/infrastructure/cache/query-result-cache.d.ts +14 -55
- package/dist/infrastructure/cache/query-result-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/query-result-cache.js +40 -112
- package/dist/infrastructure/cache/query-result-cache.js.map +1 -1
- package/dist/infrastructure/cache/response-cache.d.ts +10 -78
- package/dist/infrastructure/cache/response-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/response-cache.js +22 -198
- package/dist/infrastructure/cache/response-cache.js.map +1 -1
- package/dist/infrastructure/cache/security-scan-cache.d.ts +8 -49
- package/dist/infrastructure/cache/security-scan-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/security-scan-cache.js +25 -102
- package/dist/infrastructure/cache/security-scan-cache.js.map +1 -1
- package/dist/infrastructure/completion/bash-completion.d.ts +2 -3
- package/dist/infrastructure/completion/bash-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/bash-completion.js +11 -87
- package/dist/infrastructure/completion/bash-completion.js.map +1 -1
- package/dist/infrastructure/completion/fish-completion.d.ts +2 -3
- package/dist/infrastructure/completion/fish-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/fish-completion.js +15 -58
- package/dist/infrastructure/completion/fish-completion.js.map +1 -1
- package/dist/infrastructure/completion/zsh-completion.d.ts +2 -3
- package/dist/infrastructure/completion/zsh-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/zsh-completion.js +18 -73
- package/dist/infrastructure/completion/zsh-completion.js.map +1 -1
- package/dist/infrastructure/config/config-manager.d.ts +10 -0
- package/dist/infrastructure/config/config-manager.d.ts.map +1 -1
- package/dist/infrastructure/config/config-manager.js +13 -2
- package/dist/infrastructure/config/config-manager.js.map +1 -1
- package/dist/infrastructure/context/conversation-context.d.ts +27 -31
- package/dist/infrastructure/context/conversation-context.d.ts.map +1 -1
- package/dist/infrastructure/context/conversation-context.js +95 -136
- package/dist/infrastructure/context/conversation-context.js.map +1 -1
- package/dist/infrastructure/context/session-manager.d.ts +27 -11
- package/dist/infrastructure/context/session-manager.d.ts.map +1 -1
- package/dist/infrastructure/context/session-manager.js +69 -73
- package/dist/infrastructure/context/session-manager.js.map +1 -1
- package/dist/infrastructure/protocols/a2a-metadata.js +1 -1
- package/dist/infrastructure/protocols/mcp-oauth.js +1 -1
- package/dist/infrastructure/providers/cohere-provider.d.ts.map +1 -1
- package/dist/infrastructure/providers/cohere-provider.js +102 -17
- package/dist/infrastructure/providers/cohere-provider.js.map +1 -1
- package/dist/infrastructure/providers/openrouter-provider.d.ts +42 -0
- package/dist/infrastructure/providers/openrouter-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/openrouter-provider.js +401 -0
- package/dist/infrastructure/providers/openrouter-provider.js.map +1 -0
- package/dist/infrastructure/providers/operation-provider-resolver.d.ts.map +1 -1
- package/dist/infrastructure/providers/operation-provider-resolver.js +33 -7
- package/dist/infrastructure/providers/operation-provider-resolver.js.map +1 -1
- package/dist/infrastructure/security/input-validator.d.ts.map +1 -1
- package/dist/infrastructure/security/input-validator.js +19 -6
- package/dist/infrastructure/security/input-validator.js.map +1 -1
- package/dist/infrastructure/serialization/toon-serializer.d.ts +45 -0
- package/dist/infrastructure/serialization/toon-serializer.d.ts.map +1 -0
- package/dist/infrastructure/serialization/toon-serializer.js +119 -0
- package/dist/infrastructure/serialization/toon-serializer.js.map +1 -0
- package/dist/infrastructure/storage/embeddings-path.d.ts +18 -0
- package/dist/infrastructure/storage/embeddings-path.d.ts.map +1 -0
- package/dist/infrastructure/storage/embeddings-path.js +37 -0
- package/dist/infrastructure/storage/embeddings-path.js.map +1 -0
- package/dist/infrastructure/storage/plan-repository.d.ts +2 -0
- package/dist/infrastructure/storage/plan-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/plan-repository.js +36 -73
- package/dist/infrastructure/storage/plan-repository.js.map +1 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts +10 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.js +37 -3
- package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +1 -1
- package/dist/infrastructure/storage/task-helpers.d.ts +12 -1
- package/dist/infrastructure/storage/task-helpers.d.ts.map +1 -1
- package/dist/infrastructure/storage/task-helpers.js +48 -8
- package/dist/infrastructure/storage/task-helpers.js.map +1 -1
- package/dist/infrastructure/storage/task-repository.d.ts +2 -1
- package/dist/infrastructure/storage/task-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/task-repository.js +14 -3
- package/dist/infrastructure/storage/task-repository.js.map +1 -1
- package/dist/infrastructure/telemetry/telemetry-service.d.ts +74 -0
- package/dist/infrastructure/telemetry/telemetry-service.d.ts.map +1 -0
- package/dist/infrastructure/telemetry/telemetry-service.js +167 -0
- package/dist/infrastructure/telemetry/telemetry-service.js.map +1 -0
- package/dist/infrastructure/ux/capability-boundaries.d.ts +9 -37
- package/dist/infrastructure/ux/capability-boundaries.d.ts.map +1 -1
- package/dist/infrastructure/ux/capability-boundaries.js +23 -148
- package/dist/infrastructure/ux/capability-boundaries.js.map +1 -1
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts +12 -54
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts.map +1 -1
- package/dist/infrastructure/ux/comprehensive-formatter.js +87 -182
- package/dist/infrastructure/ux/comprehensive-formatter.js.map +1 -1
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts +5 -18
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts.map +1 -1
- package/dist/infrastructure/ux/contextual-feature-discovery.js +5 -139
- package/dist/infrastructure/ux/contextual-feature-discovery.js.map +1 -1
- package/dist/infrastructure/ux/feature-discovery.d.ts +3 -33
- package/dist/infrastructure/ux/feature-discovery.d.ts.map +1 -1
- package/dist/infrastructure/ux/feature-discovery.js +5 -181
- package/dist/infrastructure/ux/feature-discovery.js.map +1 -1
- package/dist/infrastructure/ux/feedback-prompt.d.ts +15 -31
- package/dist/infrastructure/ux/feedback-prompt.d.ts.map +1 -1
- package/dist/infrastructure/ux/feedback-prompt.js +30 -166
- package/dist/infrastructure/ux/feedback-prompt.js.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.d.ts +4 -6
- package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.js +35 -50
- package/dist/infrastructure/ux/progress-indicator.js.map +1 -1
- package/dist/infrastructure/ux/review-checkpoint.d.ts +3 -1
- package/dist/infrastructure/ux/review-checkpoint.d.ts.map +1 -1
- package/dist/infrastructure/ux/review-checkpoint.js +33 -80
- package/dist/infrastructure/ux/review-checkpoint.js.map +1 -1
- package/dist/infrastructure/ux/staged-feature-intro.d.ts +14 -39
- package/dist/infrastructure/ux/staged-feature-intro.d.ts.map +1 -1
- package/dist/infrastructure/ux/staged-feature-intro.js +12 -132
- package/dist/infrastructure/ux/staged-feature-intro.js.map +1 -1
- package/dist/infrastructure/ux/syntax-highlighter.d.ts +1 -2
- package/dist/infrastructure/ux/syntax-highlighter.d.ts.map +1 -1
- package/dist/infrastructure/ux/syntax-highlighter.js +67 -148
- package/dist/infrastructure/ux/syntax-highlighter.js.map +1 -1
- package/dist/infrastructure/validation/agent-feedback.d.ts +25 -89
- package/dist/infrastructure/validation/agent-feedback.d.ts.map +1 -1
- package/dist/infrastructure/validation/agent-feedback.js +32 -204
- package/dist/infrastructure/validation/agent-feedback.js.map +1 -1
- package/dist/infrastructure/validation/agent-validation-helper.d.ts +53 -53
- package/dist/infrastructure/validation/agent-validation-helper.d.ts.map +1 -1
- package/dist/infrastructure/validation/agent-validation-helper.js +110 -61
- package/dist/infrastructure/validation/agent-validation-helper.js.map +1 -1
- package/dist/infrastructure/validation/review-handler.d.ts +13 -41
- package/dist/infrastructure/validation/review-handler.d.ts.map +1 -1
- package/dist/infrastructure/validation/review-handler.js +23 -189
- package/dist/infrastructure/validation/review-handler.js.map +1 -1
- package/dist/infrastructure/validation/summary-aggregator.d.ts +25 -22
- package/dist/infrastructure/validation/summary-aggregator.d.ts.map +1 -1
- package/dist/infrastructure/validation/summary-aggregator.js +47 -133
- package/dist/infrastructure/validation/summary-aggregator.js.map +1 -1
- package/dist/infrastructure/validation/summary-extractor.d.ts +13 -48
- package/dist/infrastructure/validation/summary-extractor.d.ts.map +1 -1
- package/dist/infrastructure/validation/summary-extractor.js +32 -89
- package/dist/infrastructure/validation/summary-extractor.js.map +1 -1
- package/dist/infrastructure/validation/trace-summary.d.ts +30 -57
- package/dist/infrastructure/validation/trace-summary.d.ts.map +1 -1
- package/dist/infrastructure/validation/trace-summary.js +37 -356
- package/dist/infrastructure/validation/trace-summary.js.map +1 -1
- package/dist/monitoring.d.ts +1 -1
- package/dist/monitoring.d.ts.map +1 -1
- package/dist/monitoring.js +12 -9
- package/dist/monitoring.js.map +1 -1
- package/dist/parallel-processor.d.ts.map +1 -1
- package/dist/parallel-processor.js +124 -45
- package/dist/parallel-processor.js.map +1 -1
- package/dist/presentation/cli/commands/ask-command.d.ts +2 -0
- package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/ask-command.js +316 -129
- package/dist/presentation/cli/commands/ask-command.js.map +1 -1
- package/dist/presentation/cli/commands/config-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/config-command.js +22 -8
- package/dist/presentation/cli/commands/config-command.js.map +1 -1
- package/dist/presentation/cli/commands/decision-command.js +23 -6
- package/dist/presentation/cli/commands/decision-command.js.map +1 -1
- package/dist/presentation/cli/commands/docs-command.d.ts +3 -1
- package/dist/presentation/cli/commands/docs-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/docs-command.js +13 -184
- package/dist/presentation/cli/commands/docs-command.js.map +1 -1
- package/dist/presentation/cli/commands/fix-command.d.ts +2 -0
- package/dist/presentation/cli/commands/fix-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/fix-command.js +61 -276
- package/dist/presentation/cli/commands/fix-command.js.map +1 -1
- package/dist/presentation/cli/commands/help-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/help-command.js +21 -1
- package/dist/presentation/cli/commands/help-command.js.map +1 -1
- package/dist/presentation/cli/commands/memory-command.d.ts +17 -0
- package/dist/presentation/cli/commands/memory-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/memory-command.js +252 -0
- package/dist/presentation/cli/commands/memory-command.js.map +1 -0
- package/dist/presentation/cli/commands/models-command.d.ts +13 -0
- package/dist/presentation/cli/commands/models-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/models-command.js +194 -0
- package/dist/presentation/cli/commands/models-command.js.map +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/orchestrate-command.js +129 -14
- package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -1
- package/dist/presentation/cli/commands/plan-command.d.ts +1 -0
- package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/plan-command.js +134 -25
- package/dist/presentation/cli/commands/plan-command.js.map +1 -1
- package/dist/presentation/cli/commands/product-command.d.ts +6 -4
- package/dist/presentation/cli/commands/product-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/product-command.js +12 -178
- package/dist/presentation/cli/commands/product-command.js.map +1 -1
- package/dist/presentation/cli/commands/react-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/react-command.js +5 -1
- package/dist/presentation/cli/commands/react-command.js.map +1 -1
- package/dist/presentation/cli/commands/review-command.d.ts +7 -7
- package/dist/presentation/cli/commands/review-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/review-command.js +167 -16
- package/dist/presentation/cli/commands/review-command.js.map +1 -1
- package/dist/presentation/cli/commands/run-command.d.ts +6 -8
- package/dist/presentation/cli/commands/run-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/run-command.js +182 -23
- package/dist/presentation/cli/commands/run-command.js.map +1 -1
- package/dist/presentation/cli/commands/setup-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/setup-command.js +15 -0
- package/dist/presentation/cli/commands/setup-command.js.map +1 -1
- package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/smart-command.js +74 -6
- package/dist/presentation/cli/commands/smart-command.js.map +1 -1
- package/dist/presentation/cli/commands/status-command.d.ts +3 -0
- package/dist/presentation/cli/commands/status-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/status-command.js +151 -156
- package/dist/presentation/cli/commands/status-command.js.map +1 -1
- package/dist/presentation/cli/commands/suggest-command.d.ts +3 -5
- package/dist/presentation/cli/commands/suggest-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/suggest-command.js +132 -19
- package/dist/presentation/cli/commands/suggest-command.js.map +1 -1
- package/dist/presentation/cli/error-display.d.ts.map +1 -1
- package/dist/presentation/cli/error-display.js +75 -17
- package/dist/presentation/cli/error-display.js.map +1 -1
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +6 -1
- package/dist/search.js.map +1 -1
- package/dist/session.d.ts +1 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +55 -7
- package/dist/session.js.map +1 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +3 -0
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/git-tool.js +7 -7
- package/dist/tools/git-tool.js.map +1 -1
- package/dist/ui.d.ts +11 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +54 -1
- package/dist/ui.js.map +1 -1
- package/package.json +14 -4
|
@@ -1,47 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Staged Feature Introduction
|
|
3
|
+
* Checks feature access and displays availability
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
* Task 2.3: Show feature levels and gate features based on user experience
|
|
5
|
+
* Phase 1: v0.5.0-alpha.0
|
|
6
6
|
*/
|
|
7
|
-
import { ProgressiveDisclosure
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
export declare function displayUserLevel(level: UserLevel): string;
|
|
16
|
-
/**
|
|
17
|
-
* Display feature gating message when feature is not available
|
|
18
|
-
*/
|
|
19
|
-
export declare function displayFeatureGatingMessage(featureId: string, featureName: string, reason: string, suggestedLevel?: UserLevel, currentLevel?: UserLevel): void;
|
|
20
|
-
/**
|
|
21
|
-
* Display feature availability message
|
|
22
|
-
*/
|
|
23
|
-
export declare function displayFeatureAvailability(featureName: string, capability: FeatureCapability, userLevel: UserLevel): void;
|
|
24
|
-
/**
|
|
25
|
-
* Display upgrade notification when user levels up
|
|
26
|
-
*/
|
|
27
|
-
export declare function displayLevelUpNotification(oldLevel: UserLevel, newLevel: UserLevel, newFeatures: Array<{
|
|
28
|
-
name: string;
|
|
29
|
-
capability: FeatureCapability;
|
|
30
|
-
}>): void;
|
|
7
|
+
import type { ProgressiveDisclosure } from './progressive-disclosure.js';
|
|
8
|
+
export interface FeatureAvailability {
|
|
9
|
+
available: boolean;
|
|
10
|
+
message?: string;
|
|
11
|
+
upgradePath?: string;
|
|
12
|
+
shouldContinue?: boolean;
|
|
13
|
+
}
|
|
31
14
|
/**
|
|
32
|
-
* Check
|
|
15
|
+
* Check feature access
|
|
33
16
|
*/
|
|
34
|
-
export declare function checkFeatureAccess(progressiveDisclosure: ProgressiveDisclosure, userId: string,
|
|
35
|
-
available: boolean;
|
|
36
|
-
shouldContinue: boolean;
|
|
37
|
-
};
|
|
17
|
+
export declare function checkFeatureAccess(progressiveDisclosure: ProgressiveDisclosure, userId: string, feature: string): FeatureAvailability;
|
|
38
18
|
/**
|
|
39
|
-
*
|
|
19
|
+
* Display feature availability
|
|
40
20
|
*/
|
|
41
|
-
export declare function
|
|
42
|
-
userLevel: UserLevel;
|
|
43
|
-
totalFeatures: number;
|
|
44
|
-
availableFeatures: number;
|
|
45
|
-
nextLevelFeatures: number;
|
|
46
|
-
};
|
|
21
|
+
export declare function displayFeatureAvailability(featureName: string, capability: string, userLevel?: string): void;
|
|
47
22
|
//# sourceMappingURL=staged-feature-intro.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staged-feature-intro.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/ux/staged-feature-intro.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"staged-feature-intro.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/ux/staged-feature-intro.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,qBAAqB,EAAE,qBAAqB,EAC5C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,mBAAmB,CAMrB;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,GACjB,IAAI,CAGN"}
|
|
@@ -1,144 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Staged Feature Introduction
|
|
3
|
+
* Checks feature access and displays availability
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
* Task 2.3: Show feature levels and gate features based on user experience
|
|
5
|
+
* Phase 1: v0.5.0-alpha.0
|
|
6
6
|
*/
|
|
7
|
-
import { colors, separator } from '../../ui.js';
|
|
8
7
|
/**
|
|
9
|
-
*
|
|
8
|
+
* Check feature access
|
|
10
9
|
*/
|
|
11
|
-
export function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
experimental: colors.magenta,
|
|
17
|
-
};
|
|
18
|
-
const levelLabels = {
|
|
19
|
-
basic: 'Basic',
|
|
20
|
-
standard: 'Standard',
|
|
21
|
-
advanced: 'Advanced',
|
|
22
|
-
experimental: 'Experimental',
|
|
23
|
-
};
|
|
24
|
-
const colorFn = levelColors[capability] || colors.gray;
|
|
25
|
-
const label = levelLabels[capability] || capability;
|
|
26
|
-
return colorFn(`[${label}]`);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Display user level indicator
|
|
30
|
-
*/
|
|
31
|
-
export function displayUserLevel(level) {
|
|
32
|
-
const levelColors = {
|
|
33
|
-
beginner: colors.cyan,
|
|
34
|
-
intermediate: colors.blue,
|
|
35
|
-
advanced: colors.yellow,
|
|
36
|
-
expert: colors.magenta,
|
|
10
|
+
export function checkFeatureAccess(progressiveDisclosure, userId, feature) {
|
|
11
|
+
// In alpha, all features are available
|
|
12
|
+
return {
|
|
13
|
+
available: true,
|
|
14
|
+
shouldContinue: true,
|
|
37
15
|
};
|
|
38
|
-
const colorFn = levelColors[level] || colors.gray;
|
|
39
|
-
return colorFn(level.charAt(0).toUpperCase() + level.slice(1));
|
|
40
16
|
}
|
|
41
17
|
/**
|
|
42
|
-
* Display feature
|
|
43
|
-
*/
|
|
44
|
-
export function displayFeatureGatingMessage(featureId, featureName, reason, suggestedLevel, currentLevel) {
|
|
45
|
-
console.log('');
|
|
46
|
-
console.log(separator('═', 80));
|
|
47
|
-
console.log(colors.yellow(`⚠️ Feature Unavailable: ${featureName}`));
|
|
48
|
-
console.log(separator('═', 80));
|
|
49
|
-
console.log('');
|
|
50
|
-
console.log(colors.dim(`Reason: ${reason}`));
|
|
51
|
-
if (suggestedLevel && currentLevel) {
|
|
52
|
-
console.log('');
|
|
53
|
-
console.log(colors.bold('Upgrade Path:'));
|
|
54
|
-
console.log(` Current Level: ${displayUserLevel(currentLevel)}`);
|
|
55
|
-
console.log(` Required Level: ${displayUserLevel(suggestedLevel)}`);
|
|
56
|
-
console.log('');
|
|
57
|
-
console.log(colors.dim('Keep using Codehere to unlock more features!'));
|
|
58
|
-
console.log(colors.dim(` • Use basic features to progress to intermediate`));
|
|
59
|
-
console.log(colors.dim(` • Explore new capabilities to advance your level`));
|
|
60
|
-
}
|
|
61
|
-
console.log('');
|
|
62
|
-
console.log(separator('═', 80));
|
|
63
|
-
console.log('');
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Display feature availability message
|
|
18
|
+
* Display feature availability
|
|
67
19
|
*/
|
|
68
20
|
export function displayFeatureAvailability(featureName, capability, userLevel) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
// Only show for non-basic features to reduce noise
|
|
72
|
-
if (capability !== 'basic') {
|
|
73
|
-
console.log(colors.dim(`${levelBadge} Feature: ${featureName} (${userBadge} level)`));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Display upgrade notification when user levels up
|
|
78
|
-
*/
|
|
79
|
-
export function displayLevelUpNotification(oldLevel, newLevel, newFeatures) {
|
|
80
|
-
console.log('');
|
|
81
|
-
console.log(separator('═', 80));
|
|
82
|
-
console.log(colors.green(`🎉 Level Up! You're now ${displayUserLevel(newLevel)}`));
|
|
83
|
-
console.log(separator('═', 80));
|
|
84
|
-
console.log('');
|
|
85
|
-
if (newFeatures.length > 0) {
|
|
86
|
-
console.log(colors.bold('New Features Unlocked:'));
|
|
87
|
-
console.log('');
|
|
88
|
-
newFeatures.forEach(feature => {
|
|
89
|
-
const badge = displayFeatureLevel(feature.capability);
|
|
90
|
-
console.log(` ${badge} ${feature.name}`);
|
|
91
|
-
});
|
|
92
|
-
console.log('');
|
|
93
|
-
}
|
|
94
|
-
console.log(colors.dim('Keep exploring to unlock even more advanced capabilities!'));
|
|
95
|
-
console.log('');
|
|
96
|
-
console.log(separator('═', 80));
|
|
97
|
-
console.log('');
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Check if feature is available and show appropriate message
|
|
101
|
-
*/
|
|
102
|
-
export function checkFeatureAccess(progressiveDisclosure, userId, featureId) {
|
|
103
|
-
const check = progressiveDisclosure.shouldShowFeature(userId, featureId);
|
|
104
|
-
if (!check.show) {
|
|
105
|
-
const profile = progressiveDisclosure.getUserProfile(userId);
|
|
106
|
-
// Get feature from available features to find name
|
|
107
|
-
const availableFeatures = progressiveDisclosure.getAvailableFeatures(userId);
|
|
108
|
-
const allFeatures = [...availableFeatures];
|
|
109
|
-
const unavailableFeatures = progressiveDisclosure.getNextSuggestedFeatures(userId, 100);
|
|
110
|
-
const feature = [...allFeatures, ...unavailableFeatures].find(f => f.featureId === featureId);
|
|
111
|
-
if (feature) {
|
|
112
|
-
displayFeatureGatingMessage(featureId, feature.featureName, check.reason || 'Feature not available', check.suggestedLevel, profile.level);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
// Fallback if feature not found
|
|
116
|
-
displayFeatureGatingMessage(featureId, featureId.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase()), check.reason || 'Feature not available', check.suggestedLevel, profile.level);
|
|
117
|
-
}
|
|
118
|
-
return { available: false, shouldContinue: false };
|
|
119
|
-
}
|
|
120
|
-
return { available: true, shouldContinue: true };
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Get features summary for user
|
|
124
|
-
*/
|
|
125
|
-
export function getFeaturesSummary(progressiveDisclosure, userId) {
|
|
126
|
-
const profile = progressiveDisclosure.getUserProfile(userId);
|
|
127
|
-
const available = progressiveDisclosure.getAvailableFeatures(userId);
|
|
128
|
-
const allFeatures = Array.from(progressiveDisclosure.featureRegistry?.values() || []);
|
|
129
|
-
// Count features for next level
|
|
130
|
-
const levelOrder = ['beginner', 'intermediate', 'advanced', 'expert'];
|
|
131
|
-
const currentIndex = levelOrder.indexOf(profile.level);
|
|
132
|
-
const nextLevel = currentIndex < levelOrder.length - 1 ? levelOrder[currentIndex + 1] : null;
|
|
133
|
-
let nextLevelFeatures = 0;
|
|
134
|
-
if (nextLevel) {
|
|
135
|
-
nextLevelFeatures = allFeatures.filter((f) => f.requiredLevel === nextLevel).length;
|
|
136
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
userLevel: profile.level,
|
|
139
|
-
totalFeatures: allFeatures.length,
|
|
140
|
-
availableFeatures: available.length,
|
|
141
|
-
nextLevelFeatures,
|
|
142
|
-
};
|
|
21
|
+
// In alpha, no-op
|
|
22
|
+
// Can be enhanced later to show feature introductions
|
|
143
23
|
}
|
|
144
24
|
//# sourceMappingURL=staged-feature-intro.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staged-feature-intro.js","sourceRoot":"","sources":["../../../src/infrastructure/ux/staged-feature-intro.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"staged-feature-intro.js","sourceRoot":"","sources":["../../../src/infrastructure/ux/staged-feature-intro.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,qBAA4C,EAC5C,MAAc,EACd,OAAe;IAEf,uCAAuC;IACvC,OAAO;QACL,SAAS,EAAE,IAAI;QACf,cAAc,EAAE,IAAI;KACrB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACxC,WAAmB,EACnB,UAAkB,EAClB,SAAkB;IAElB,kBAAkB;IAClB,sDAAsD;AACxD,CAAC"}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* Syntax Highlighter for Terminal
|
|
3
3
|
* Provides basic syntax highlighting for code snippets using chalk
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* Supports: TypeScript, JavaScript, Python, JSON, YAML, Markdown, Shell
|
|
5
|
+
* Phase 1: v0.5.0-alpha.0
|
|
7
6
|
*/
|
|
8
7
|
export type SupportedLanguage = 'typescript' | 'javascript' | 'python' | 'json' | 'yaml' | 'markdown' | 'shell' | 'bash' | 'text';
|
|
9
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-highlighter.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/ux/syntax-highlighter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"syntax-highlighter.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/ux/syntax-highlighter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAElI;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAyBlE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,MAAM,GAAG,MAAM,CA6CzF;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAKvG"}
|
|
@@ -2,171 +2,90 @@
|
|
|
2
2
|
* Syntax Highlighter for Terminal
|
|
3
3
|
* Provides basic syntax highlighting for code snippets using chalk
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* Supports: TypeScript, JavaScript, Python, JSON, YAML, Markdown, Shell
|
|
5
|
+
* Phase 1: v0.5.0-alpha.0
|
|
7
6
|
*/
|
|
8
7
|
import { colors } from '../../ui.js';
|
|
9
8
|
/**
|
|
10
9
|
* Detect language from file extension
|
|
11
10
|
*/
|
|
12
11
|
export function detectLanguage(filepath) {
|
|
13
|
-
const ext = filepath.split('.').pop()?.toLowerCase()
|
|
14
|
-
|
|
15
|
-
'ts':
|
|
16
|
-
'tsx':
|
|
17
|
-
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
|
|
21
|
-
'py':
|
|
22
|
-
|
|
23
|
-
'
|
|
24
|
-
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return lines.map(line => {
|
|
37
|
-
let highlighted = line;
|
|
38
|
-
// Keywords (const, let, var, function, class, interface, type, etc.)
|
|
39
|
-
highlighted = highlighted.replace(/\b(const|let|var|function|class|interface|type|enum|namespace|import|export|from|as|default|extends|implements|public|private|protected|static|readonly|async|await|return|if|else|for|while|switch|case|break|continue|try|catch|finally|throw|new|this|super|typeof|instanceof|in|of)\b/g, (match) => colors.magenta(match));
|
|
40
|
-
// Strings (single, double, template literals)
|
|
41
|
-
highlighted = highlighted.replace(/(['"`])((?:\\.|(?!\1)[^\\])*?)\1/g, (match) => colors.green(match));
|
|
42
|
-
// Numbers
|
|
43
|
-
highlighted = highlighted.replace(/\b(\d+\.?\d*)\b/g, (match) => colors.yellow(match));
|
|
44
|
-
// Comments
|
|
45
|
-
highlighted = highlighted.replace(/(\/\/.*$|\/\*[\s\S]*?\*\/)/gm, (match) => colors.dim(match));
|
|
46
|
-
// Function/class names (before opening paren)
|
|
47
|
-
highlighted = highlighted.replace(/\b([A-Z][a-zA-Z0-9]*)\s*(?=\()/g, (match) => colors.cyan(match.trim()));
|
|
48
|
-
return highlighted;
|
|
49
|
-
}).join('\n');
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Highlight Python code
|
|
53
|
-
*/
|
|
54
|
-
function highlightPython(code) {
|
|
55
|
-
const lines = code.split('\n');
|
|
56
|
-
return lines.map(line => {
|
|
57
|
-
let highlighted = line;
|
|
58
|
-
// Keywords
|
|
59
|
-
highlighted = highlighted.replace(/\b(def|class|if|elif|else|for|while|try|except|finally|with|import|from|as|return|yield|lambda|pass|break|continue|raise|assert|and|or|not|in|is|None|True|False)\b/g, (match) => colors.magenta(match));
|
|
60
|
-
// Strings
|
|
61
|
-
highlighted = highlighted.replace(/(['"])((?:\\.|(?!\1)[^\\])*?)\1/g, (match) => colors.green(match));
|
|
62
|
-
// Numbers
|
|
63
|
-
highlighted = highlighted.replace(/\b(\d+\.?\d*)\b/g, (match) => colors.yellow(match));
|
|
64
|
-
// Comments
|
|
65
|
-
highlighted = highlighted.replace(/(#.*$)/gm, (match) => colors.dim(match));
|
|
66
|
-
// Function/class names
|
|
67
|
-
highlighted = highlighted.replace(/\b(def|class)\s+([a-zA-Z_][a-zA-Z0-9_]*)/g, (match, keyword, name) => colors.magenta(keyword) + ' ' + colors.cyan(name));
|
|
68
|
-
return highlighted;
|
|
69
|
-
}).join('\n');
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Highlight JSON code
|
|
73
|
-
*/
|
|
74
|
-
function highlightJSON(code) {
|
|
75
|
-
const lines = code.split('\n');
|
|
76
|
-
return lines.map(line => {
|
|
77
|
-
let highlighted = line;
|
|
78
|
-
// Keys (before colon)
|
|
79
|
-
highlighted = highlighted.replace(/"([^"]+)":/g, (match, key) => colors.green(`"${key}"`) + colors.dim(':'));
|
|
80
|
-
// Strings
|
|
81
|
-
highlighted = highlighted.replace(/"([^"]+)"/g, (match, value) => {
|
|
82
|
-
// Don't highlight keys again
|
|
83
|
-
if (match.includes(':'))
|
|
84
|
-
return match;
|
|
85
|
-
return colors.green(match);
|
|
86
|
-
});
|
|
87
|
-
// Numbers
|
|
88
|
-
highlighted = highlighted.replace(/\b(\d+\.?\d*)\b/g, (match) => colors.yellow(match));
|
|
89
|
-
// Booleans/null
|
|
90
|
-
highlighted = highlighted.replace(/\b(true|false|null)\b/g, (match) => colors.magenta(match));
|
|
91
|
-
return highlighted;
|
|
92
|
-
}).join('\n');
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Highlight Shell/Bash code
|
|
96
|
-
*/
|
|
97
|
-
function highlightShell(code) {
|
|
98
|
-
const lines = code.split('\n');
|
|
99
|
-
return lines.map(line => {
|
|
100
|
-
let highlighted = line;
|
|
101
|
-
// Commands (first word)
|
|
102
|
-
highlighted = highlighted.replace(/^(\s*)([a-zA-Z_][a-zA-Z0-9_-]*)\s/, (match, indent, cmd) => indent + colors.cyan(cmd) + ' ');
|
|
103
|
-
// Variables
|
|
104
|
-
highlighted = highlighted.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g, (match) => colors.yellow(match));
|
|
105
|
-
// Strings
|
|
106
|
-
highlighted = highlighted.replace(/(['"])((?:\\.|(?!\1)[^\\])*?)\1/g, (match) => colors.green(match));
|
|
107
|
-
// Comments
|
|
108
|
-
highlighted = highlighted.replace(/(#.*$)/gm, (match) => colors.dim(match));
|
|
109
|
-
return highlighted;
|
|
110
|
-
}).join('\n');
|
|
12
|
+
const ext = filepath.split('.').pop()?.toLowerCase();
|
|
13
|
+
switch (ext) {
|
|
14
|
+
case 'ts':
|
|
15
|
+
case 'tsx':
|
|
16
|
+
return 'typescript';
|
|
17
|
+
case 'js':
|
|
18
|
+
case 'jsx':
|
|
19
|
+
return 'javascript';
|
|
20
|
+
case 'py':
|
|
21
|
+
return 'python';
|
|
22
|
+
case 'json':
|
|
23
|
+
return 'json';
|
|
24
|
+
case 'yaml':
|
|
25
|
+
case 'yml':
|
|
26
|
+
return 'yaml';
|
|
27
|
+
case 'md':
|
|
28
|
+
return 'markdown';
|
|
29
|
+
case 'sh':
|
|
30
|
+
case 'bash':
|
|
31
|
+
return 'shell';
|
|
32
|
+
default:
|
|
33
|
+
return 'text';
|
|
34
|
+
}
|
|
111
35
|
}
|
|
112
36
|
/**
|
|
113
37
|
* Highlight code based on language
|
|
114
38
|
*/
|
|
115
39
|
export function highlightCode(code, language) {
|
|
116
|
-
if (!
|
|
117
|
-
return
|
|
118
|
-
const lang = (language || 'text');
|
|
119
|
-
// Check if terminal supports colors
|
|
120
|
-
if (!process.stdout.isTTY || process.env.NO_COLOR) {
|
|
121
|
-
return code; // Return unhighlighted if colors disabled
|
|
40
|
+
if (!language || language === 'text') {
|
|
41
|
+
return code;
|
|
122
42
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
43
|
+
// Basic keyword highlighting (minimal implementation)
|
|
44
|
+
const keywords = {
|
|
45
|
+
typescript: [
|
|
46
|
+
/\b(const|let|var|function|class|interface|type|enum|import|export|async|await|return|if|else|for|while|try|catch|throw)\b/g,
|
|
47
|
+
/\b(true|false|null|undefined)\b/g,
|
|
48
|
+
/(["'`])(?:(?=(\\?))\2.)*?\1/g, // Strings
|
|
49
|
+
/\/\/.*$/gm, // Comments
|
|
50
|
+
/\/\*[\s\S]*?\*\//g, // Block comments
|
|
51
|
+
],
|
|
52
|
+
javascript: [
|
|
53
|
+
/\b(const|let|var|function|class|async|await|return|if|else|for|while|try|catch|throw)\b/g,
|
|
54
|
+
/\b(true|false|null|undefined)\b/g,
|
|
55
|
+
/(["'`])(?:(?=(\\?))\2.)*?\1/g,
|
|
56
|
+
/\/\/.*$/gm,
|
|
57
|
+
/\/\*[\s\S]*?\*\//g,
|
|
58
|
+
],
|
|
59
|
+
python: [
|
|
60
|
+
/\b(def|class|import|from|if|else|elif|for|while|try|except|return|True|False|None)\b/g,
|
|
61
|
+
/(["'`])(?:(?=(\\?))\2.)*?\1/g,
|
|
62
|
+
/#.*$/gm,
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
const lang = language.toLowerCase();
|
|
66
|
+
const patterns = keywords[lang] || [];
|
|
67
|
+
let highlighted = code;
|
|
68
|
+
for (const pattern of patterns) {
|
|
69
|
+
highlighted = highlighted.replace(pattern, (match) => {
|
|
70
|
+
if (pattern.source.includes('string')) {
|
|
71
|
+
return colors.cyan(match);
|
|
72
|
+
}
|
|
73
|
+
else if (pattern.source.includes('comment')) {
|
|
74
|
+
return colors.gray(match);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return colors.yellow(match);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
146
80
|
}
|
|
81
|
+
return highlighted;
|
|
147
82
|
}
|
|
148
83
|
/**
|
|
149
84
|
* Format code block with syntax highlighting
|
|
150
85
|
*/
|
|
151
86
|
export function formatCodeBlockWithHighlight(code, language, filepath) {
|
|
152
|
-
const
|
|
153
|
-
const highlighted = highlightCode(code,
|
|
154
|
-
|
|
155
|
-
const maxWidth = process.stdout.columns || 80;
|
|
156
|
-
const indent = ' ';
|
|
157
|
-
let output = colors.dim('┌─ Code');
|
|
158
|
-
if (detectedLang !== 'text') {
|
|
159
|
-
output += colors.dim(` (${detectedLang})`);
|
|
160
|
-
}
|
|
161
|
-
output += colors.dim(' ─'.repeat(Math.max(0, Math.floor((maxWidth - 20) / 2))) + '┐\n');
|
|
162
|
-
for (const line of lines) {
|
|
163
|
-
// Truncate very long lines
|
|
164
|
-
const displayLine = line.length > maxWidth - 10
|
|
165
|
-
? line.substring(0, maxWidth - 13) + '...'
|
|
166
|
-
: line;
|
|
167
|
-
output += indent + displayLine + '\n';
|
|
168
|
-
}
|
|
169
|
-
output += colors.dim('└' + '─'.repeat(Math.max(0, maxWidth - 4)) + '┘');
|
|
170
|
-
return output;
|
|
87
|
+
const lang = language || (filepath ? detectLanguage(filepath) : 'text');
|
|
88
|
+
const highlighted = highlightCode(code, lang);
|
|
89
|
+
return `\n${colors.dim('```' + lang)}\n${highlighted}\n${colors.dim('```')}\n`;
|
|
171
90
|
}
|
|
172
91
|
//# sourceMappingURL=syntax-highlighter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-highlighter.js","sourceRoot":"","sources":["../../../src/infrastructure/ux/syntax-highlighter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"syntax-highlighter.js","sourceRoot":"","sources":["../../../src/infrastructure/ux/syntax-highlighter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,CAAC;IAErD,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,IAAI,CAAC;QACV,KAAK,KAAK;YACR,OAAO,YAAY,CAAC;QACtB,KAAK,IAAI,CAAC;QACV,KAAK,KAAK;YACR,OAAO,YAAY,CAAC;QACtB,KAAK,IAAI;YACP,OAAO,QAAQ,CAAC;QAClB,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB,KAAK,MAAM,CAAC;QACZ,KAAK,KAAK;YACR,OAAO,MAAM,CAAC;QAChB,KAAK,IAAI;YACP,OAAO,UAAU,CAAC;QACpB,KAAK,IAAI,CAAC;QACV,KAAK,MAAM;YACT,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,QAAqC;IAC/E,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,sDAAsD;IACtD,MAAM,QAAQ,GAA6B;QACzC,UAAU,EAAE;YACV,4HAA4H;YAC5H,kCAAkC;YAClC,8BAA8B,EAAE,UAAU;YAC1C,WAAW,EAAE,WAAW;YACxB,mBAAmB,EAAE,iBAAiB;SACvC;QACD,UAAU,EAAE;YACV,0FAA0F;YAC1F,kCAAkC;YAClC,8BAA8B;YAC9B,WAAW;YACX,mBAAmB;SACpB;QACD,MAAM,EAAE;YACN,uFAAuF;YACvF,8BAA8B;YAC9B,QAAQ;SACT;KACF,CAAC;IAEF,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAuB,CAAC;IACzD,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAEtC,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACnD,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACtC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC;iBAAM,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC9C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC;iBAAM,CAAC;gBACN,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAAC,IAAY,EAAE,QAAiB,EAAE,QAAiB;IAC7F,MAAM,IAAI,GAAG,QAAQ,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACxE,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE9C,OAAO,KAAK,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,WAAW,KAAK,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;AACjF,CAAC"}
|