specweave 0.21.3 ā 0.22.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.
- package/CLAUDE.md +409 -6
- package/README.md +38 -8
- package/bin/specweave.js +5 -8
- package/dist/plugins/specweave-github/lib/CodeValidator.d.ts +101 -0
- package/dist/plugins/specweave-github/lib/CodeValidator.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/CodeValidator.js +219 -0
- package/dist/plugins/specweave-github/lib/CodeValidator.js.map +1 -0
- package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.d.ts +182 -0
- package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.js +603 -0
- package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-client-v2.d.ts +10 -0
- package/dist/plugins/specweave-github/lib/github-client-v2.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-client-v2.js +26 -0
- package/dist/plugins/specweave-github/lib/github-client-v2.js.map +1 -1
- package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/task-sync.js +7 -0
- package/dist/plugins/specweave-github/lib/task-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/types.d.ts +34 -0
- package/dist/plugins/specweave-github/lib/types.d.ts.map +1 -1
- package/dist/src/cli/commands/init.d.ts.map +1 -1
- package/dist/src/cli/commands/init.js +60 -5
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/migrate-to-profiles.d.ts +1 -0
- package/dist/src/cli/commands/migrate-to-profiles.d.ts.map +1 -1
- package/dist/src/cli/commands/migrate-to-profiles.js +12 -1
- package/dist/src/cli/commands/migrate-to-profiles.js.map +1 -1
- package/dist/src/cli/commands/next-command.d.ts +52 -0
- package/dist/src/cli/commands/next-command.d.ts.map +1 -0
- package/dist/src/cli/commands/next-command.js +204 -0
- package/dist/src/cli/commands/next-command.js.map +1 -0
- package/dist/src/cli/commands/sync-specs.d.ts +16 -0
- package/dist/src/cli/commands/sync-specs.d.ts.map +1 -0
- package/dist/src/cli/commands/sync-specs.js +130 -0
- package/dist/src/cli/commands/sync-specs.js.map +1 -0
- package/dist/src/cli/count-tasks.d.ts +20 -0
- package/dist/src/cli/count-tasks.d.ts.map +1 -0
- package/dist/src/cli/count-tasks.js +50 -0
- package/dist/src/cli/count-tasks.js.map +1 -0
- package/dist/src/config/ConfigManager.d.ts.map +1 -1
- package/dist/src/config/ConfigManager.js +2 -1
- package/dist/src/config/ConfigManager.js.map +1 -1
- package/dist/src/config/types.d.ts +58 -58
- package/dist/src/core/cicd/state-manager.d.ts +8 -0
- package/dist/src/core/cicd/state-manager.d.ts.map +1 -1
- package/dist/src/core/cicd/state-manager.js +60 -15
- package/dist/src/core/cicd/state-manager.js.map +1 -1
- package/dist/src/core/cost-tracker.d.ts.map +1 -1
- package/dist/src/core/cost-tracker.js +2 -1
- package/dist/src/core/cost-tracker.js.map +1 -1
- package/dist/src/core/iac/template-engine.d.ts.map +1 -1
- package/dist/src/core/iac/template-engine.js +28 -0
- package/dist/src/core/iac/template-engine.js.map +1 -1
- package/dist/src/core/iac/template-generator.d.ts +53 -0
- package/dist/src/core/iac/template-generator.d.ts.map +1 -0
- package/dist/src/core/iac/template-generator.js +125 -0
- package/dist/src/core/iac/template-generator.js.map +1 -0
- package/dist/src/core/increment/status-auto-transition.js +3 -3
- package/dist/src/core/increment/status-auto-transition.js.map +1 -1
- package/dist/src/core/living-docs/CodeValidator.js +1 -1
- package/dist/src/core/living-docs/CodeValidator.js.map +1 -1
- package/dist/src/core/living-docs/CompletionPropagator.d.ts.map +1 -1
- package/dist/src/core/living-docs/CompletionPropagator.js +4 -3
- package/dist/src/core/living-docs/CompletionPropagator.js.map +1 -1
- package/dist/src/core/living-docs/SpecDistributor.d.ts +5 -0
- package/dist/src/core/living-docs/SpecDistributor.d.ts.map +1 -1
- package/dist/src/core/living-docs/SpecDistributor.js +12 -0
- package/dist/src/core/living-docs/SpecDistributor.js.map +1 -1
- package/dist/src/core/living-docs/content-distributor.d.ts.map +1 -1
- package/dist/src/core/living-docs/content-distributor.js +11 -1
- package/dist/src/core/living-docs/content-distributor.js.map +1 -1
- package/dist/src/core/living-docs/living-docs-sync.d.ts +166 -0
- package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -0
- package/dist/src/core/living-docs/living-docs-sync.js +726 -0
- package/dist/src/core/living-docs/living-docs-sync.js.map +1 -0
- package/dist/src/core/living-docs/project-detector.d.ts.map +1 -1
- package/dist/src/core/living-docs/project-detector.js +38 -0
- package/dist/src/core/living-docs/project-detector.js.map +1 -1
- package/dist/src/core/living-docs/task-project-specific-generator.d.ts +7 -3
- package/dist/src/core/living-docs/task-project-specific-generator.d.ts.map +1 -1
- package/dist/src/core/living-docs/task-project-specific-generator.js +40 -24
- package/dist/src/core/living-docs/task-project-specific-generator.js.map +1 -1
- package/dist/src/core/plugin-loader.d.ts +7 -0
- package/dist/src/core/plugin-loader.d.ts.map +1 -1
- package/dist/src/core/plugin-loader.js +18 -1
- package/dist/src/core/plugin-loader.js.map +1 -1
- package/dist/src/core/serverless/platform-data-loader.d.ts +8 -0
- package/dist/src/core/serverless/platform-data-loader.d.ts.map +1 -1
- package/dist/src/core/serverless/platform-data-loader.js +14 -0
- package/dist/src/core/serverless/platform-data-loader.js.map +1 -1
- package/dist/src/core/serverless/types.d.ts +1 -1
- package/dist/src/core/serverless/types.d.ts.map +1 -1
- package/dist/src/core/status-line/status-line-manager.d.ts +6 -2
- package/dist/src/core/status-line/status-line-manager.d.ts.map +1 -1
- package/dist/src/core/status-line/status-line-manager.js +11 -5
- package/dist/src/core/status-line/status-line-manager.js.map +1 -1
- package/dist/src/core/status-line/task-counter.d.ts +69 -0
- package/dist/src/core/status-line/task-counter.d.ts.map +1 -0
- package/dist/src/core/status-line/task-counter.js +107 -0
- package/dist/src/core/status-line/task-counter.js.map +1 -0
- package/dist/src/core/types/config.d.ts +23 -0
- package/dist/src/core/types/config.d.ts.map +1 -1
- package/dist/src/core/types/config.js +10 -0
- package/dist/src/core/types/config.js.map +1 -1
- package/dist/src/core/workflow/autonomous-executor.d.ts +111 -0
- package/dist/src/core/workflow/autonomous-executor.d.ts.map +1 -0
- package/dist/src/core/workflow/autonomous-executor.js +275 -0
- package/dist/src/core/workflow/autonomous-executor.js.map +1 -0
- package/dist/src/core/workflow/backlog-scanner.d.ts +94 -0
- package/dist/src/core/workflow/backlog-scanner.d.ts.map +1 -0
- package/dist/src/core/workflow/backlog-scanner.js +170 -0
- package/dist/src/core/workflow/backlog-scanner.js.map +1 -0
- package/dist/src/core/workflow/command-invoker.d.ts +86 -0
- package/dist/src/core/workflow/command-invoker.d.ts.map +1 -0
- package/dist/src/core/workflow/command-invoker.js +131 -0
- package/dist/src/core/workflow/command-invoker.js.map +1 -0
- package/dist/src/core/workflow/cost-estimator.d.ts +120 -0
- package/dist/src/core/workflow/cost-estimator.d.ts.map +1 -0
- package/dist/src/core/workflow/cost-estimator.js +222 -0
- package/dist/src/core/workflow/cost-estimator.js.map +1 -0
- package/dist/src/core/workflow/index.d.ts +20 -0
- package/dist/src/core/workflow/index.d.ts.map +1 -0
- package/dist/src/core/workflow/index.js +24 -0
- package/dist/src/core/workflow/index.js.map +1 -0
- package/dist/src/core/workflow/state-manager.d.ts +107 -0
- package/dist/src/core/workflow/state-manager.d.ts.map +1 -0
- package/dist/src/core/workflow/state-manager.js +126 -0
- package/dist/src/core/workflow/state-manager.js.map +1 -0
- package/dist/src/core/workflow/workflow-orchestrator.d.ts +93 -0
- package/dist/src/core/workflow/workflow-orchestrator.d.ts.map +1 -0
- package/dist/src/core/workflow/workflow-orchestrator.js +195 -0
- package/dist/src/core/workflow/workflow-orchestrator.js.map +1 -0
- package/dist/src/init/ArchitecturePresenter.d.ts +47 -0
- package/dist/src/init/ArchitecturePresenter.d.ts.map +1 -0
- package/dist/src/init/ArchitecturePresenter.js +180 -0
- package/dist/src/init/ArchitecturePresenter.js.map +1 -0
- package/dist/src/init/InitFlow.d.ts.map +1 -1
- package/dist/src/init/InitFlow.js +30 -1
- package/dist/src/init/InitFlow.js.map +1 -1
- package/dist/src/init/architecture/CostEstimator.d.ts +52 -0
- package/dist/src/init/architecture/CostEstimator.d.ts.map +1 -0
- package/dist/src/init/architecture/CostEstimator.js +107 -0
- package/dist/src/init/architecture/CostEstimator.js.map +1 -0
- package/dist/src/init/architecture/InfrastructureMapper.d.ts +41 -0
- package/dist/src/init/architecture/InfrastructureMapper.d.ts.map +1 -0
- package/dist/src/init/architecture/InfrastructureMapper.js +140 -0
- package/dist/src/init/architecture/InfrastructureMapper.js.map +1 -0
- package/dist/src/init/architecture/ProjectGenerator.d.ts +44 -0
- package/dist/src/init/architecture/ProjectGenerator.d.ts.map +1 -0
- package/dist/src/init/architecture/ProjectGenerator.js +216 -0
- package/dist/src/init/architecture/ProjectGenerator.js.map +1 -0
- package/dist/src/init/architecture/types.d.ts +10 -10
- package/dist/src/init/research/src/config/types.d.ts +8 -8
- package/dist/src/metrics/dora-calculator.js +2 -2
- package/dist/src/metrics/dora-calculator.js.map +1 -1
- package/dist/src/utils/pricing-constants.d.ts +5 -2
- package/dist/src/utils/pricing-constants.d.ts.map +1 -1
- package/dist/src/utils/pricing-constants.js +3 -2
- package/dist/src/utils/pricing-constants.js.map +1 -1
- package/package.json +9 -8
- package/plugins/specweave/agents/infrastructure/AGENT.md +88 -46
- package/plugins/specweave/agents/pm/AGENT.md +58 -1
- package/plugins/specweave/commands/specweave-archive-features.md +1 -1
- package/plugins/specweave/commands/specweave-archive-increments.md +1 -1
- package/plugins/specweave/commands/specweave-check-hooks.md +5 -0
- package/plugins/specweave/commands/specweave-done.md +12 -0
- package/plugins/specweave/commands/specweave-plan.md +1 -1
- package/plugins/specweave/commands/specweave-progress.md +108 -379
- package/plugins/specweave/commands/specweave-reopen.md +1 -1
- package/plugins/specweave/commands/specweave-restore-feature.md +1 -1
- package/plugins/specweave/commands/specweave-sync-specs.md +20 -48
- package/plugins/specweave/hooks/lib/update-status-line.sh +44 -35
- package/plugins/specweave/hooks/lib/validate-spec-status.sh +163 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh +17 -35
- package/plugins/specweave/lib/hooks/update-tasks-md.js +52 -9
- package/plugins/specweave/lib/hooks/update-tasks-md.ts +77 -16
- package/plugins/specweave/templates/iac/aws-lambda/defaults.json +24 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/README.md.hbs +260 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/environments/dev.tfvars.hbs +34 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/environments/prod.tfvars.hbs +37 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/environments/staging.tfvars.hbs +35 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/outputs.tf.hbs +77 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/providers.tf.hbs +36 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/variables.tf.hbs +115 -0
- package/plugins/specweave/templates/iac/azure-functions/defaults.json +25 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/README.md.hbs +268 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/environments/dev.tfvars.hbs +34 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/environments/prod.tfvars.hbs +46 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/environments/staging.tfvars.hbs +34 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/main.tf.hbs +225 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/outputs.tf.hbs +89 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/provider.tf.hbs +27 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/providers.tf.hbs +35 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/variables.tf.hbs +124 -0
- package/plugins/specweave/templates/iac/firebase/defaults.json +29 -0
- package/plugins/specweave/templates/iac/firebase/templates/README.md.hbs +35 -0
- package/plugins/specweave/templates/iac/firebase/templates/environments/dev.tfvars.hbs +7 -0
- package/plugins/specweave/templates/iac/firebase/templates/environments/prod.tfvars.hbs +7 -0
- package/plugins/specweave/templates/iac/firebase/templates/environments/staging.tfvars.hbs +7 -0
- package/plugins/specweave/templates/iac/firebase/templates/main.tf.hbs +90 -0
- package/plugins/specweave/templates/iac/firebase/templates/outputs.tf.hbs +15 -0
- package/plugins/specweave/templates/iac/firebase/templates/providers.tf.hbs +23 -0
- package/plugins/specweave/templates/iac/firebase/templates/variables.tf.hbs +42 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/defaults.json +26 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/README.md.hbs +299 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/environments/dev.tfvars.hbs +36 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/environments/prod.tfvars.hbs +48 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/environments/staging.tfvars.hbs +41 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/main.tf.hbs +192 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/outputs.tf.hbs +66 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/providers.tf.hbs +25 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/variables.tf.hbs +119 -0
- package/plugins/specweave/templates/iac/supabase/defaults.json +15 -0
- package/plugins/specweave/templates/iac/supabase/templates/README.md.hbs +46 -0
- package/plugins/specweave/templates/iac/supabase/templates/main.tf.hbs +50 -0
- package/plugins/specweave-ado/lib/enhanced-ado-sync.js +170 -0
- package/plugins/specweave-github/agents/github-manager/AGENT.md +39 -7
- package/plugins/specweave-github/commands/specweave-github-create-issue.md +5 -5
- package/plugins/specweave-github/lib/CodeValidator.js +195 -0
- package/plugins/specweave-github/lib/CodeValidator.ts +284 -0
- package/plugins/specweave-github/lib/ThreeLayerSyncManager.js +545 -0
- package/plugins/specweave-github/lib/ThreeLayerSyncManager.ts +809 -0
- package/plugins/specweave-github/lib/github-client-v2.js +29 -0
- package/plugins/specweave-github/lib/github-client-v2.ts +30 -0
- package/plugins/specweave-github/lib/task-sync.js +4 -0
- package/plugins/specweave-github/lib/task-sync.ts +7 -0
- package/plugins/specweave-github/lib/types.ts +38 -0
- package/plugins/specweave-jira/lib/enhanced-jira-sync.js +3 -3
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +3222 -0
- package/src/templates/AGENTS.md.template +22 -1
- package/src/templates/CLAUDE.md.template +31 -0
- package/dist/src/core/living-docs/ThreeLayerSyncManager.d.ts +0 -116
- package/dist/src/core/living-docs/ThreeLayerSyncManager.d.ts.map +0 -1
- package/dist/src/core/living-docs/ThreeLayerSyncManager.js +0 -356
- package/dist/src/core/living-docs/ThreeLayerSyncManager.js.map +0 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State Manager - Workflow state tracking and checkpointing
|
|
3
|
+
*
|
|
4
|
+
* Manages workflow state, checkpoints, and recovery for autonomous execution.
|
|
5
|
+
*
|
|
6
|
+
* Part of increment 0039: Ultra-Smart Next Command
|
|
7
|
+
*
|
|
8
|
+
* @module core/workflow/state-manager
|
|
9
|
+
* @since v0.22.0
|
|
10
|
+
*/
|
|
11
|
+
import * as fs from 'fs-extra';
|
|
12
|
+
import * as path from 'path';
|
|
13
|
+
/**
|
|
14
|
+
* State Manager - Track workflow state and checkpoints
|
|
15
|
+
*/
|
|
16
|
+
export class StateManager {
|
|
17
|
+
constructor(checkpointDir, maxCheckpoints = 10) {
|
|
18
|
+
this.checkpointDir = checkpointDir || '.specweave/checkpoints';
|
|
19
|
+
this.maxCheckpoints = maxCheckpoints;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Save checkpoint
|
|
23
|
+
*
|
|
24
|
+
* @param checkpoint - Checkpoint data
|
|
25
|
+
*/
|
|
26
|
+
async saveCheckpoint(checkpoint) {
|
|
27
|
+
await fs.ensureDir(this.checkpointDir);
|
|
28
|
+
const checkpointPath = path.join(this.checkpointDir, `${checkpoint.incrementId}-${checkpoint.id}.json`);
|
|
29
|
+
await fs.writeJson(checkpointPath, checkpoint, { spaces: 2 });
|
|
30
|
+
// Cleanup old checkpoints
|
|
31
|
+
await this.cleanupOldCheckpoints(checkpoint.incrementId);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Load checkpoints for increment
|
|
35
|
+
*
|
|
36
|
+
* @param incrementId - Increment ID
|
|
37
|
+
* @returns Array of checkpoints (sorted by timestamp, newest first)
|
|
38
|
+
*/
|
|
39
|
+
async loadCheckpoints(incrementId) {
|
|
40
|
+
if (!await fs.pathExists(this.checkpointDir)) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
const files = await fs.readdir(this.checkpointDir);
|
|
44
|
+
const checkpointFiles = files.filter(f => f.startsWith(`${incrementId}-`) && f.endsWith('.json'));
|
|
45
|
+
const checkpoints = [];
|
|
46
|
+
for (const file of checkpointFiles) {
|
|
47
|
+
try {
|
|
48
|
+
const checkpoint = await fs.readJson(path.join(this.checkpointDir, file));
|
|
49
|
+
checkpoints.push(checkpoint);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
// Skip corrupted checkpoints
|
|
53
|
+
console.warn(`Failed to load checkpoint ${file}:`, error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Sort by timestamp (newest first)
|
|
57
|
+
return checkpoints.sort((a, b) => b.timestamp - a.timestamp);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get latest checkpoint for increment
|
|
61
|
+
*
|
|
62
|
+
* @param incrementId - Increment ID
|
|
63
|
+
* @returns Latest checkpoint or null
|
|
64
|
+
*/
|
|
65
|
+
async getLatestCheckpoint(incrementId) {
|
|
66
|
+
const checkpoints = await this.loadCheckpoints(incrementId);
|
|
67
|
+
return checkpoints[0] || null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Delete checkpoint
|
|
71
|
+
*
|
|
72
|
+
* @param incrementId - Increment ID
|
|
73
|
+
* @param checkpointId - Checkpoint ID
|
|
74
|
+
*/
|
|
75
|
+
async deleteCheckpoint(incrementId, checkpointId) {
|
|
76
|
+
const checkpointPath = path.join(this.checkpointDir, `${incrementId}-${checkpointId}.json`);
|
|
77
|
+
if (await fs.pathExists(checkpointPath)) {
|
|
78
|
+
await fs.remove(checkpointPath);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Cleanup old checkpoints (keep only N most recent)
|
|
83
|
+
*
|
|
84
|
+
* @param incrementId - Increment ID
|
|
85
|
+
*/
|
|
86
|
+
async cleanupOldCheckpoints(incrementId) {
|
|
87
|
+
const checkpoints = await this.loadCheckpoints(incrementId);
|
|
88
|
+
if (checkpoints.length > this.maxCheckpoints) {
|
|
89
|
+
const toDelete = checkpoints.slice(this.maxCheckpoints);
|
|
90
|
+
for (const checkpoint of toDelete) {
|
|
91
|
+
await this.deleteCheckpoint(incrementId, checkpoint.id);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Detect infinite loop in phase history
|
|
97
|
+
*
|
|
98
|
+
* Checks if the same phase has been visited too many times in a row.
|
|
99
|
+
*
|
|
100
|
+
* @param phaseHistory - Recent phase history
|
|
101
|
+
* @param threshold - Max same-phase repetitions (default: 3)
|
|
102
|
+
* @returns True if loop detected
|
|
103
|
+
*/
|
|
104
|
+
detectLoop(phaseHistory, threshold = 3) {
|
|
105
|
+
if (phaseHistory.length < threshold) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
// Check if last N phases are all the same
|
|
109
|
+
const recentPhases = phaseHistory.slice(-threshold);
|
|
110
|
+
const uniquePhases = new Set(recentPhases);
|
|
111
|
+
return uniquePhases.size === 1;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Record state transition
|
|
115
|
+
*
|
|
116
|
+
* (For now, this is a no-op - will be used for analytics/debugging)
|
|
117
|
+
*
|
|
118
|
+
* @param transition - State transition record
|
|
119
|
+
*/
|
|
120
|
+
recordTransition(transition) {
|
|
121
|
+
// TODO: Implement transition logging
|
|
122
|
+
// For now, just log to console
|
|
123
|
+
console.log(`State transition: ${transition.from} ā ${transition.to} (${transition.action})`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=state-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-manager.js","sourceRoot":"","sources":["../../../../src/core/workflow/state-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAyC7B;;GAEG;AACH,MAAM,OAAO,YAAY;IAIvB,YAAY,aAAsB,EAAE,iBAAyB,EAAE;QAC7D,IAAI,CAAC,aAAa,GAAG,aAAa,IAAI,wBAAwB,CAAC;QAC/D,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAAC,UAAsB;QACzC,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAEvC,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAC9B,IAAI,CAAC,aAAa,EAClB,GAAG,UAAU,CAAC,WAAW,IAAI,UAAU,CAAC,EAAE,OAAO,CAClD,CAAC;QAEF,MAAM,EAAE,CAAC,SAAS,CAAC,cAAc,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;QAE9D,0BAA0B;QAC1B,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,eAAe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,EAAE,KAAK,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;IAChG,CAAC;CACF"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow Orchestrator - Core orchestration logic for /specweave:next
|
|
3
|
+
*
|
|
4
|
+
* Coordinates workflow execution by detecting current phase and
|
|
5
|
+
* invoking appropriate commands.
|
|
6
|
+
*
|
|
7
|
+
* Part of increment 0039: Ultra-Smart Next Command
|
|
8
|
+
*
|
|
9
|
+
* @module core/workflow/workflow-orchestrator
|
|
10
|
+
* @since v0.22.0
|
|
11
|
+
*/
|
|
12
|
+
import { WorkflowPhase } from './types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Workflow execution options
|
|
15
|
+
*/
|
|
16
|
+
export interface WorkflowExecuteOptions {
|
|
17
|
+
/** Auto-approve actions without prompting (dangerous!) */
|
|
18
|
+
autonomous?: boolean;
|
|
19
|
+
/** Show detailed execution information */
|
|
20
|
+
verbose?: boolean;
|
|
21
|
+
/** Dry-run mode (preview actions without executing) */
|
|
22
|
+
dryRun?: boolean;
|
|
23
|
+
/** Force execution even with low confidence */
|
|
24
|
+
force?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Workflow execution result
|
|
28
|
+
*/
|
|
29
|
+
export interface WorkflowExecutionResult {
|
|
30
|
+
/** Execution succeeded */
|
|
31
|
+
success: boolean;
|
|
32
|
+
/** Phase that was detected */
|
|
33
|
+
phase: WorkflowPhase;
|
|
34
|
+
/** Confidence score for phase detection */
|
|
35
|
+
confidence: number;
|
|
36
|
+
/** Action that was taken */
|
|
37
|
+
action?: string;
|
|
38
|
+
/** Command that was invoked */
|
|
39
|
+
command?: string;
|
|
40
|
+
/** Error message if failed */
|
|
41
|
+
error?: string;
|
|
42
|
+
/** Human-readable explanation */
|
|
43
|
+
reasoning?: string;
|
|
44
|
+
/** Phase detection evidence */
|
|
45
|
+
evidence?: string[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Workflow Orchestrator - Coordinates intelligent workflow execution
|
|
49
|
+
*
|
|
50
|
+
* This is a simplified initial implementation focusing on core phase detection.
|
|
51
|
+
* Full autonomous execution will be added in future tasks.
|
|
52
|
+
*/
|
|
53
|
+
export declare class WorkflowOrchestrator {
|
|
54
|
+
private phaseDetector;
|
|
55
|
+
private activeIncrementManager;
|
|
56
|
+
constructor();
|
|
57
|
+
/**
|
|
58
|
+
* Execute next step in workflow (interactive mode)
|
|
59
|
+
*
|
|
60
|
+
* Detects current phase and suggests/executes appropriate action.
|
|
61
|
+
*
|
|
62
|
+
* @param incrementId - Optional increment ID (auto-detects if not provided)
|
|
63
|
+
* @param options - Execution options
|
|
64
|
+
* @returns Workflow execution result
|
|
65
|
+
*/
|
|
66
|
+
executeNext(incrementId?: string, options?: WorkflowExecuteOptions): Promise<WorkflowExecutionResult>;
|
|
67
|
+
/**
|
|
68
|
+
* Format reasoning from phase detection result
|
|
69
|
+
*/
|
|
70
|
+
private formatReasoning;
|
|
71
|
+
/**
|
|
72
|
+
* Detect current workflow phase for increment
|
|
73
|
+
*
|
|
74
|
+
* @param incrementId - Increment ID (auto-detects if not provided)
|
|
75
|
+
* @returns Phase detection result
|
|
76
|
+
*/
|
|
77
|
+
private detectCurrentPhase;
|
|
78
|
+
/**
|
|
79
|
+
* Auto-detect active increment
|
|
80
|
+
*
|
|
81
|
+
* @returns Increment ID or throws if none found
|
|
82
|
+
*/
|
|
83
|
+
private detectActiveIncrement;
|
|
84
|
+
/**
|
|
85
|
+
* Determine action based on phase and confidence
|
|
86
|
+
*
|
|
87
|
+
* @param detection - Phase detection result
|
|
88
|
+
* @param options - Execution options
|
|
89
|
+
* @returns Suggested action
|
|
90
|
+
*/
|
|
91
|
+
private determineAction;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=workflow-orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-orchestrator.d.ts","sourceRoot":"","s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
/**
|
|
2
|
+
* Workflow Orchestrator - Core orchestration logic for /specweave:next
|
|
3
|
+
*
|
|
4
|
+
* Coordinates workflow execution by detecting current phase and
|
|
5
|
+
* invoking appropriate commands.
|
|
6
|
+
*
|
|
7
|
+
* Part of increment 0039: Ultra-Smart Next Command
|
|
8
|
+
*
|
|
9
|
+
* @module core/workflow/workflow-orchestrator
|
|
10
|
+
* @since v0.22.0
|
|
11
|
+
*/
|
|
12
|
+
import { PhaseDetector } from './phase-detector.js';
|
|
13
|
+
import { WorkflowPhase } from './types.js';
|
|
14
|
+
import { ActiveIncrementManager } from '../increment/active-increment-manager.js';
|
|
15
|
+
/**
|
|
16
|
+
* Workflow Orchestrator - Coordinates intelligent workflow execution
|
|
17
|
+
*
|
|
18
|
+
* This is a simplified initial implementation focusing on core phase detection.
|
|
19
|
+
* Full autonomous execution will be added in future tasks.
|
|
20
|
+
*/
|
|
21
|
+
export class WorkflowOrchestrator {
|
|
22
|
+
constructor() {
|
|
23
|
+
this.phaseDetector = new PhaseDetector();
|
|
24
|
+
this.activeIncrementManager = new ActiveIncrementManager();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Execute next step in workflow (interactive mode)
|
|
28
|
+
*
|
|
29
|
+
* Detects current phase and suggests/executes appropriate action.
|
|
30
|
+
*
|
|
31
|
+
* @param incrementId - Optional increment ID (auto-detects if not provided)
|
|
32
|
+
* @param options - Execution options
|
|
33
|
+
* @returns Workflow execution result
|
|
34
|
+
*/
|
|
35
|
+
async executeNext(incrementId, options = {}) {
|
|
36
|
+
try {
|
|
37
|
+
// Phase 1: Detect current workflow phase
|
|
38
|
+
const detection = await this.detectCurrentPhase(incrementId);
|
|
39
|
+
// Phase 2: Determine action based on phase and confidence
|
|
40
|
+
const action = this.determineAction(detection, options);
|
|
41
|
+
// Format reasoning from detection evidence
|
|
42
|
+
const reasoning = this.formatReasoning(detection);
|
|
43
|
+
// Phase 3: Execute action (or return suggestion)
|
|
44
|
+
if (options.dryRun) {
|
|
45
|
+
return {
|
|
46
|
+
success: true,
|
|
47
|
+
phase: detection.phase,
|
|
48
|
+
confidence: detection.confidence,
|
|
49
|
+
action: action.description,
|
|
50
|
+
reasoning: `[DRY RUN] Would execute: ${action.description}\n\n${reasoning}`
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// For now, return suggestion (actual execution will be added in later tasks)
|
|
54
|
+
return {
|
|
55
|
+
success: true,
|
|
56
|
+
phase: detection.phase,
|
|
57
|
+
confidence: detection.confidence,
|
|
58
|
+
action: action.description,
|
|
59
|
+
command: action.command,
|
|
60
|
+
reasoning
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
return {
|
|
65
|
+
success: false,
|
|
66
|
+
phase: WorkflowPhase.UNKNOWN,
|
|
67
|
+
confidence: 0,
|
|
68
|
+
error: error instanceof Error ? error.message : String(error),
|
|
69
|
+
reasoning: 'Failed to detect workflow phase or execute action'
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Format reasoning from phase detection result
|
|
75
|
+
*/
|
|
76
|
+
formatReasoning(detection) {
|
|
77
|
+
const parts = [];
|
|
78
|
+
// Add suggestion reason if present
|
|
79
|
+
if (detection.suggestionReason) {
|
|
80
|
+
parts.push(detection.suggestionReason);
|
|
81
|
+
}
|
|
82
|
+
// Add evidence summary
|
|
83
|
+
if (detection.evidence && detection.evidence.length > 0) {
|
|
84
|
+
parts.push('\nEvidence:');
|
|
85
|
+
detection.evidence.forEach(ev => {
|
|
86
|
+
parts.push(`- ${ev.description} (${(ev.weight * 100).toFixed(0)}% weight)`);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return parts.join('\n');
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Detect current workflow phase for increment
|
|
93
|
+
*
|
|
94
|
+
* @param incrementId - Increment ID (auto-detects if not provided)
|
|
95
|
+
* @returns Phase detection result
|
|
96
|
+
*/
|
|
97
|
+
async detectCurrentPhase(incrementId) {
|
|
98
|
+
// If no increment ID provided, try to auto-detect active increment
|
|
99
|
+
if (!incrementId) {
|
|
100
|
+
incrementId = await this.detectActiveIncrement();
|
|
101
|
+
}
|
|
102
|
+
// Build detection context
|
|
103
|
+
const context = {
|
|
104
|
+
userPrompt: 'Detect current workflow phase',
|
|
105
|
+
incrementId,
|
|
106
|
+
workingDirectory: process.cwd()
|
|
107
|
+
};
|
|
108
|
+
// Detect phase using PhaseDetector
|
|
109
|
+
return this.phaseDetector.detect(context);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Auto-detect active increment
|
|
113
|
+
*
|
|
114
|
+
* @returns Increment ID or throws if none found
|
|
115
|
+
*/
|
|
116
|
+
async detectActiveIncrement() {
|
|
117
|
+
const activeIds = this.activeIncrementManager.getActive();
|
|
118
|
+
if (activeIds.length === 0) {
|
|
119
|
+
throw new Error('No active increments found. Use /specweave:increment to create one.');
|
|
120
|
+
}
|
|
121
|
+
if (activeIds.length === 1) {
|
|
122
|
+
return activeIds[0];
|
|
123
|
+
}
|
|
124
|
+
// Multiple active increments - return primary (first)
|
|
125
|
+
console.log(`Multiple active increments detected: ${activeIds.join(', ')}`);
|
|
126
|
+
console.log(`Using primary increment: ${activeIds[0]}`);
|
|
127
|
+
return activeIds[0];
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Determine action based on phase and confidence
|
|
131
|
+
*
|
|
132
|
+
* @param detection - Phase detection result
|
|
133
|
+
* @param options - Execution options
|
|
134
|
+
* @returns Suggested action
|
|
135
|
+
*/
|
|
136
|
+
determineAction(detection, options) {
|
|
137
|
+
const { phase, confidence } = detection;
|
|
138
|
+
// Low confidence - prompt user
|
|
139
|
+
if (confidence < 0.7 && !options.force) {
|
|
140
|
+
return {
|
|
141
|
+
description: `Phase detection confidence is low (${(confidence * 100).toFixed(0)}%). Please specify action manually.`,
|
|
142
|
+
command: undefined
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
// Map phase to action
|
|
146
|
+
switch (phase) {
|
|
147
|
+
case WorkflowPhase.PLAN_GENERATION:
|
|
148
|
+
return {
|
|
149
|
+
description: 'Generate implementation plan',
|
|
150
|
+
command: '/specweave:plan'
|
|
151
|
+
};
|
|
152
|
+
case WorkflowPhase.IMPLEMENTATION:
|
|
153
|
+
return {
|
|
154
|
+
description: 'Execute tasks',
|
|
155
|
+
command: '/specweave:do'
|
|
156
|
+
};
|
|
157
|
+
case WorkflowPhase.TESTING:
|
|
158
|
+
return {
|
|
159
|
+
description: 'Run tests',
|
|
160
|
+
command: 'npm test'
|
|
161
|
+
};
|
|
162
|
+
case WorkflowPhase.REVIEW:
|
|
163
|
+
return {
|
|
164
|
+
description: 'Run quality assessment',
|
|
165
|
+
command: '/specweave:qa'
|
|
166
|
+
};
|
|
167
|
+
case WorkflowPhase.COMPLETION:
|
|
168
|
+
return {
|
|
169
|
+
description: 'Close increment',
|
|
170
|
+
command: '/specweave:done'
|
|
171
|
+
};
|
|
172
|
+
case WorkflowPhase.SPEC_WRITING:
|
|
173
|
+
return {
|
|
174
|
+
description: 'Complete spec.md and generate plan',
|
|
175
|
+
command: '/specweave:plan'
|
|
176
|
+
};
|
|
177
|
+
case WorkflowPhase.TASK_BREAKDOWN:
|
|
178
|
+
return {
|
|
179
|
+
description: 'Create tasks and start implementation',
|
|
180
|
+
command: '/specweave:do'
|
|
181
|
+
};
|
|
182
|
+
case WorkflowPhase.DOCUMENTATION:
|
|
183
|
+
return {
|
|
184
|
+
description: 'Update living documentation',
|
|
185
|
+
command: '/specweave:sync-docs update'
|
|
186
|
+
};
|
|
187
|
+
default:
|
|
188
|
+
return {
|
|
189
|
+
description: 'Phase detection unclear - please specify action manually',
|
|
190
|
+
command: undefined
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=workflow-orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-orchestrator.js","sourceRoot":"","sources":["../../../../src/core/workflow/workflow-orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAA0C,MAAM,YAAY,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAsClF;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAI/B;QACE,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;QACzC,IAAI,CAAC,sBAAsB,GAAG,IAAI,sBAAsB,EAAE,CAAC;IAC7D,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,WAAW,CACf,WAAoB,EACpB,UAAkC,EAAE;QAEpC,IAAI,CAAC;YACH,yCAAyC;YACzC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;YAE7D,0DAA0D;YAC1D,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAExD,2CAA2C;YAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YAElD,iDAAiD;YACjD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;gBACnB,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,KAAK,EAAE,SAAS,CAAC,KAAK;oBACtB,UAAU,EAAE,SAAS,CAAC,UAAU;oBAChC,MAAM,EAAE,MAAM,CAAC,WAAW;oBAC1B,SAAS,EAAE,4BAA4B,MAAM,CAAC,WAAW,OAAO,SAAS,EAAE;iBAC5E,CAAC;YACJ,CAAC;YAED,6EAA6E;YAC7E,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,SAAS,CAAC,KAAK;gBACtB,UAAU,EAAE,SAAS,CAAC,UAAU;gBAChC,M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AAE,CAAC;YACd,KAAK,aAAa,CAAC,eAAe;gBAChC,OAAO;oBACL,WAAW,EAAE,8BAA8B;oBAC3C,OAAO,EAAE,iBAAiB;iBAC3B,CAAC;YAEJ,KAAK,aAAa,CAAC,cAAc;gBAC/B,OAAO;oBACL,WAAW,EAAE,eAAe;oBAC5B,OAAO,EAAE,eAAe;iBACzB,CAAC;YAEJ,KAAK,aAAa,CAAC,OAAO;gBACxB,OAAO;oBACL,WAAW,EAAE,WAAW;oBACxB,OAAO,EAAE,UAAU;iBACpB,CAAC;YAEJ,KAAK,aAAa,CAAC,MAAM;gBACvB,OAAO;oBACL,WAAW,EAAE,wBAAwB;oBACrC,OAAO,EAAE,eAAe;iBACzB,CAAC;YAEJ,KAAK,aAAa,CAAC,UAAU;gBAC3B,OAAO;oBACL,WAAW,EAAE,iBAAiB;oBAC9B,OAAO,EAAE,iBAAiB;iBAC3B,CAAC;YAEJ,KAAK,aAAa,CAAC,YAAY;gBAC7B,OAAO;oBACL,WAAW,EAAE,oCAAoC;oBACjD,OAAO,EAAE,iBAAiB;iBAC3B,CAAC;YAEJ,KAAK,aAAa,CAAC,cAAc;gBAC/B,OAAO;oBACL,WAAW,EAAE,uCAAuC;oBACpD,OAAO,EAAE,eAAe;iBACzB,CAAC;YAEJ,KAAK,aAAa,CAAC,aAAa;gBAC9B,OAAO;oBACL,WAAW,EAAE,6BAA6B;oBAC1C,OAAO,EAAE,6BAA6B;iBACvC,CAAC;YAEJ;gBACE,OAAO;oBACL,WAAW,EAAE,0DAA0D;oBACvE,OAAO,EAAE,SAAS;iBACnB,CAAC;QACN,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Architecture Presenter - Display recommendations with interactive UI
|
|
3
|
+
*
|
|
4
|
+
* Presents architecture recommendations with clear rationale and allows
|
|
5
|
+
* user to accept, reject, or modify the suggestion.
|
|
6
|
+
*
|
|
7
|
+
* AC-US5-08: Clear rationale for architecture decision
|
|
8
|
+
* AC-US5-09: User can accept/reject/modify recommendation
|
|
9
|
+
*/
|
|
10
|
+
import type { ArchitectureRecommendation } from './architecture/types.js';
|
|
11
|
+
import type { TeamRecommendation } from './team/types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Present architecture recommendation to user with full details
|
|
14
|
+
*
|
|
15
|
+
* Shows:
|
|
16
|
+
* - Architecture type with rationale
|
|
17
|
+
* - Infrastructure components
|
|
18
|
+
* - Cost estimates at different scales
|
|
19
|
+
* - Cloud credits available
|
|
20
|
+
* - Generated project list
|
|
21
|
+
* - Team recommendations
|
|
22
|
+
*
|
|
23
|
+
* @param architecture - Architecture recommendation from decision engine
|
|
24
|
+
* @param teams - Team recommendations
|
|
25
|
+
*/
|
|
26
|
+
export declare function presentArchitectureRecommendation(architecture: ArchitectureRecommendation | any, teams: TeamRecommendation | any): void;
|
|
27
|
+
/**
|
|
28
|
+
* Prompt user to accept, reject, or modify recommendation
|
|
29
|
+
*
|
|
30
|
+
* Note: In real implementation, this would use inquirer for interactive prompts
|
|
31
|
+
* For now, we provide the interface structure
|
|
32
|
+
*/
|
|
33
|
+
export declare function promptAcceptArchitecture(): Promise<'accept' | 'reject' | 'modify'>;
|
|
34
|
+
/**
|
|
35
|
+
* Prompt user to modify architecture recommendation
|
|
36
|
+
*
|
|
37
|
+
* Allows customization of:
|
|
38
|
+
* - Architecture type
|
|
39
|
+
* - Infrastructure components
|
|
40
|
+
* - Project structure
|
|
41
|
+
*/
|
|
42
|
+
export declare function promptModifyArchitecture(architecture: ArchitectureRecommendation): Promise<ArchitectureRecommendation>;
|
|
43
|
+
/**
|
|
44
|
+
* Present architecture summary after user acceptance
|
|
45
|
+
*/
|
|
46
|
+
export declare function presentArchitectureSummary(architecture: ArchitectureRecommendation): void;
|
|
47
|
+
//# sourceMappingURL=ArchitecturePresenter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArchitecturePresenter.d.ts","sourceRoot":"","sources":["../../../src/init/ArchitecturePresenter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iCAAiC,CAC/C,YAAY,EAAE,0BAA0B,GAAG,GAAG,EAC9C,KAAK,EAAE,kBAAkB,GAAG,GAAG,GAC9B,IAAI,CA6GN;AAkBD;;;;;GAKG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC,CAUxF;AAED;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,YAAY,EAAE,0BAA0B,GACvC,OAAO,CAAC,0BAA0B,CAAC,CAUrC;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,0BAA0B,GAAG,IAAI,CAMzF"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Architecture Presenter - Display recommendations with interactive UI
|
|
3
|
+
*
|
|
4
|
+
* Presents architecture recommendations with clear rationale and allows
|
|
5
|
+
* user to accept, reject, or modify the suggestion.
|
|
6
|
+
*
|
|
7
|
+
* AC-US5-08: Clear rationale for architecture decision
|
|
8
|
+
* AC-US5-09: User can accept/reject/modify recommendation
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Present architecture recommendation to user with full details
|
|
12
|
+
*
|
|
13
|
+
* Shows:
|
|
14
|
+
* - Architecture type with rationale
|
|
15
|
+
* - Infrastructure components
|
|
16
|
+
* - Cost estimates at different scales
|
|
17
|
+
* - Cloud credits available
|
|
18
|
+
* - Generated project list
|
|
19
|
+
* - Team recommendations
|
|
20
|
+
*
|
|
21
|
+
* @param architecture - Architecture recommendation from decision engine
|
|
22
|
+
* @param teams - Team recommendations
|
|
23
|
+
*/
|
|
24
|
+
export function presentArchitectureRecommendation(architecture, teams) {
|
|
25
|
+
console.log('\n' + 'ā'.repeat(70));
|
|
26
|
+
console.log(' šļø ARCHITECTURE RECOMMENDATION');
|
|
27
|
+
console.log('ā'.repeat(70));
|
|
28
|
+
// Handle array format (legacy architecture decisions)
|
|
29
|
+
if (Array.isArray(architecture)) {
|
|
30
|
+
console.log('\nš Architecture Decisions:');
|
|
31
|
+
for (const decision of architecture) {
|
|
32
|
+
console.log(`\n⢠${decision.category}: ${decision.decision}`);
|
|
33
|
+
console.log(` ${decision.rationale}`);
|
|
34
|
+
}
|
|
35
|
+
// Show team recommendations (legacy format)
|
|
36
|
+
if (teams) {
|
|
37
|
+
console.log('\nš„ Team Recommendations:');
|
|
38
|
+
console.log(` ⢠Recommended Size: ${teams.recommended} people`);
|
|
39
|
+
console.log(` ⢠Range: ${teams.min}-${teams.max} people`);
|
|
40
|
+
console.log(` ⢠Roles: ${teams.roles.join(', ')}`);
|
|
41
|
+
console.log(`\nš” ${teams.rationale}`);
|
|
42
|
+
}
|
|
43
|
+
console.log('\n' + 'ā'.repeat(70));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
// Full ArchitectureRecommendation format
|
|
47
|
+
const arch = architecture;
|
|
48
|
+
// 1. Architecture Type & Rationale
|
|
49
|
+
console.log(`\nš Architecture Type: ${formatArchitectureType(arch.architecture)}`);
|
|
50
|
+
console.log(`\nš” Rationale:`);
|
|
51
|
+
console.log(` ${arch.rationale}`);
|
|
52
|
+
// 2. Infrastructure Components
|
|
53
|
+
if (arch.infrastructure && arch.infrastructure.length > 0) {
|
|
54
|
+
console.log(`\nš§ Infrastructure:`);
|
|
55
|
+
for (const component of arch.infrastructure) {
|
|
56
|
+
console.log(` ⢠${component}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// 3. Cost Estimates
|
|
60
|
+
if (arch.costEstimate) {
|
|
61
|
+
console.log(`\nš° Cost Estimates:`);
|
|
62
|
+
console.log(` ⢠At 1K users: ${arch.costEstimate.at1K}`);
|
|
63
|
+
console.log(` ⢠At 10K users: ${arch.costEstimate.at10K}`);
|
|
64
|
+
console.log(` ⢠At 100K users: ${arch.costEstimate.at100K}`);
|
|
65
|
+
console.log(` ⢠At 1M users: ${arch.costEstimate.at1M}`);
|
|
66
|
+
}
|
|
67
|
+
// 4. Cloud Credits
|
|
68
|
+
if (arch.cloudCredits && arch.cloudCredits.length > 0) {
|
|
69
|
+
console.log(`\nāļø Available Cloud Credits:`);
|
|
70
|
+
for (const credit of arch.cloudCredits.slice(0, 3)) {
|
|
71
|
+
console.log(` ⢠${credit.provider}: ${credit.amount} (${credit.duration})`);
|
|
72
|
+
if (credit.requirements) {
|
|
73
|
+
console.log(` Requirements: ${credit.requirements}`);
|
|
74
|
+
}
|
|
75
|
+
if (credit.url) {
|
|
76
|
+
console.log(` Apply: ${credit.url}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// 5. Generated Projects
|
|
81
|
+
if (arch.projects && arch.projects.length > 0) {
|
|
82
|
+
console.log(`\nš¦ Generated Projects:`);
|
|
83
|
+
for (const project of arch.projects) {
|
|
84
|
+
console.log(` ⢠${project.name}`);
|
|
85
|
+
console.log(` ${project.description}`);
|
|
86
|
+
if (project.stack && project.stack.length > 0) {
|
|
87
|
+
console.log(` Stack: ${project.stack.join(', ')}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// 6. Team Recommendations
|
|
92
|
+
if (teams) {
|
|
93
|
+
console.log(`\nš„ Team Recommendations:`);
|
|
94
|
+
if (typeof teams.recommended === 'number') {
|
|
95
|
+
console.log(` ⢠Recommended Size: ${teams.recommended} people`);
|
|
96
|
+
console.log(` ⢠Range: ${teams.min}-${teams.max} people`);
|
|
97
|
+
}
|
|
98
|
+
if (teams.roles && teams.roles.length > 0) {
|
|
99
|
+
console.log(` ⢠Roles: ${teams.roles.join(', ')}`);
|
|
100
|
+
}
|
|
101
|
+
if (teams.rationale) {
|
|
102
|
+
console.log(`\nš” ${teams.rationale}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// 7. Alternative Architectures
|
|
106
|
+
if (arch.alternatives && arch.alternatives.length > 0) {
|
|
107
|
+
console.log(`\nš Alternative Architectures Considered:`);
|
|
108
|
+
for (const alt of arch.alternatives) {
|
|
109
|
+
console.log(`\n ${formatArchitectureType(alt.architecture)}:`);
|
|
110
|
+
console.log(` Pros:`);
|
|
111
|
+
for (const pro of alt.pros) {
|
|
112
|
+
console.log(` ā ${pro}`);
|
|
113
|
+
}
|
|
114
|
+
console.log(` Cons:`);
|
|
115
|
+
for (const con of alt.cons) {
|
|
116
|
+
console.log(` ā ${con}`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
console.log('\n' + 'ā'.repeat(70));
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Format architecture type for display
|
|
124
|
+
*/
|
|
125
|
+
function formatArchitectureType(type) {
|
|
126
|
+
const typeMap = {
|
|
127
|
+
'serverless': 'Serverless (AWS Lambda, Vercel, Supabase)',
|
|
128
|
+
'traditional-monolith': 'Traditional Monolith (EC2/ECS)',
|
|
129
|
+
'microservices': 'Microservices (Kubernetes)',
|
|
130
|
+
'modular-monolith': 'Modular Monolith',
|
|
131
|
+
'jamstack': 'JAMstack (Static site + APIs)',
|
|
132
|
+
'hybrid': 'Hybrid Architecture'
|
|
133
|
+
};
|
|
134
|
+
return typeMap[type] || type;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Prompt user to accept, reject, or modify recommendation
|
|
138
|
+
*
|
|
139
|
+
* Note: In real implementation, this would use inquirer for interactive prompts
|
|
140
|
+
* For now, we provide the interface structure
|
|
141
|
+
*/
|
|
142
|
+
export async function promptAcceptArchitecture() {
|
|
143
|
+
// TODO: Replace with interactive prompt using inquirer
|
|
144
|
+
// Question: "Do you accept this architecture recommendation?"
|
|
145
|
+
// Options:
|
|
146
|
+
// - "Yes, this looks good (accept)"
|
|
147
|
+
// - "No, I want a different architecture (reject)"
|
|
148
|
+
// - "Let me customize this recommendation (modify)"
|
|
149
|
+
// Default to accept for now
|
|
150
|
+
return 'accept';
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Prompt user to modify architecture recommendation
|
|
154
|
+
*
|
|
155
|
+
* Allows customization of:
|
|
156
|
+
* - Architecture type
|
|
157
|
+
* - Infrastructure components
|
|
158
|
+
* - Project structure
|
|
159
|
+
*/
|
|
160
|
+
export async function promptModifyArchitecture(architecture) {
|
|
161
|
+
// TODO: Replace with interactive prompt using inquirer
|
|
162
|
+
// Allow user to:
|
|
163
|
+
// 1. Change architecture type
|
|
164
|
+
// 2. Add/remove infrastructure components
|
|
165
|
+
// 3. Customize project list
|
|
166
|
+
// 4. Adjust cost estimates
|
|
167
|
+
// For now, return unchanged
|
|
168
|
+
return architecture;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Present architecture summary after user acceptance
|
|
172
|
+
*/
|
|
173
|
+
export function presentArchitectureSummary(architecture) {
|
|
174
|
+
console.log('\nā
Architecture Confirmed!\n');
|
|
175
|
+
console.log(` Type: ${formatArchitectureType(architecture.architecture)}`);
|
|
176
|
+
console.log(` Projects: ${architecture.projects.length} projects`);
|
|
177
|
+
console.log(` Infrastructure: ${architecture.infrastructure.length} components`);
|
|
178
|
+
console.log('\n Your architecture is ready to use.\n');
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=ArchitecturePresenter.js.map
|