claude-flow-novice 2.0.3 → 2.0.4
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/dist/src/cli/commands/guidance.js +487 -668
- package/dist/src/cli/commands/index-validate.js +18 -29
- package/dist/src/cli/commands/mcp-troubleshoot.js +230 -282
- package/dist/src/cli/commands/neural-goal-init.js +92 -125
- package/dist/src/cli/commands/swarm-exec.js +317 -393
- package/dist/src/cli/commands/swarm.js +1 -1
- package/dist/src/cli/commands/validate-framework.js +983 -1100
- package/dist/src/cli/commands/validate.js +144 -223
- package/dist/src/cli/simple-commands/__tests__/agent.test.js +265 -277
- package/dist/src/cli/simple-commands/__tests__/memory.test.js +6 -7
- package/dist/src/cli/simple-commands/__tests__/swarm.test.js +373 -356
- package/dist/src/cli/simple-commands/__tests__/task.test.js +6 -7
- package/dist/src/cli/simple-commands/agent.js +157 -193
- package/dist/src/cli/simple-commands/analysis.js +336 -446
- package/dist/src/cli/simple-commands/automation-executor.js +1095 -1339
- package/dist/src/cli/simple-commands/automation.js +481 -469
- package/dist/src/cli/simple-commands/batch-manager.js +261 -313
- package/dist/src/cli/simple-commands/claude-telemetry.js +241 -267
- package/dist/src/cli/simple-commands/claude-track.js +68 -90
- package/dist/src/cli/simple-commands/concurrent-display.js +266 -320
- package/dist/src/cli/simple-commands/config.js +245 -290
- package/dist/src/cli/simple-commands/coordination.js +182 -234
- package/dist/src/cli/simple-commands/enhanced-ui-views.js +812 -615
- package/dist/src/cli/simple-commands/enhanced-webui-complete.js +922 -981
- package/dist/src/cli/simple-commands/fix-hook-variables.js +274 -294
- package/dist/src/cli/simple-commands/github/gh-coordinator.js +378 -457
- package/dist/src/cli/simple-commands/github/github-api.js +535 -574
- package/dist/src/cli/simple-commands/github/init.js +276 -303
- package/dist/src/cli/simple-commands/github.js +222 -247
- package/dist/src/cli/simple-commands/goal.js +51 -63
- package/dist/src/cli/simple-commands/hive-mind/auto-save-middleware.js +208 -278
- package/dist/src/cli/simple-commands/hive-mind/communication.js +601 -696
- package/dist/src/cli/simple-commands/hive-mind/core.js +907 -979
- package/dist/src/cli/simple-commands/hive-mind/db-optimizer.js +406 -655
- package/dist/src/cli/simple-commands/hive-mind/mcp-wrapper.js +1125 -1245
- package/dist/src/cli/simple-commands/hive-mind/memory.js +854 -1090
- package/dist/src/cli/simple-commands/hive-mind/performance-optimizer.js +459 -574
- package/dist/src/cli/simple-commands/hive-mind/performance-test.js +263 -347
- package/dist/src/cli/simple-commands/hive-mind/queen.js +727 -768
- package/dist/src/cli/simple-commands/hive-mind/session-manager.js +745 -1049
- package/dist/src/cli/simple-commands/hive-mind-optimize.js +227 -283
- package/dist/src/cli/simple-commands/hive-mind-wizard.js +174 -217
- package/dist/src/cli/simple-commands/hive-mind.js +1842 -2283
- package/dist/src/cli/simple-commands/hive.js +90 -79
- package/dist/src/cli/simple-commands/hook-safety.js +431 -521
- package/dist/src/cli/simple-commands/hooks/session-start-soul.js +203 -254
- package/dist/src/cli/simple-commands/hooks.js +1064 -1204
- package/dist/src/cli/simple-commands/init/agent-copier.js +294 -319
- package/dist/src/cli/simple-commands/init/batch-init.js +496 -562
- package/dist/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +13 -19
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +13 -19
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +61 -88
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +125 -150
- package/dist/src/cli/simple-commands/init/claude-commands/slash-commands.js +42 -49
- package/dist/src/cli/simple-commands/init/claude-commands/sparc-commands.js +43 -61
- package/dist/src/cli/simple-commands/init/copy-revised-templates.js +141 -147
- package/dist/src/cli/simple-commands/init/executable-wrapper.js +31 -44
- package/dist/src/cli/simple-commands/init/gitignore-updater.js +64 -90
- package/dist/src/cli/simple-commands/init/help.js +104 -107
- package/dist/src/cli/simple-commands/init/hive-mind-init.js +509 -528
- package/dist/src/cli/simple-commands/init/index.js +1510 -1759
- package/dist/src/cli/simple-commands/init/performance-monitor.js +234 -317
- package/dist/src/cli/simple-commands/init/rollback/backup-manager.js +441 -504
- package/dist/src/cli/simple-commands/init/rollback/index.js +289 -364
- package/dist/src/cli/simple-commands/init/rollback/recovery-manager.js +652 -728
- package/dist/src/cli/simple-commands/init/rollback/rollback-executor.js +416 -481
- package/dist/src/cli/simple-commands/init/rollback/state-tracker.js +369 -448
- package/dist/src/cli/simple-commands/init/sparc/roo-readme.js +1 -2
- package/dist/src/cli/simple-commands/init/sparc/roomodes-config.js +122 -99
- package/dist/src/cli/simple-commands/init/sparc/workflows.js +32 -37
- package/dist/src/cli/simple-commands/init/sparc-structure.js +55 -62
- package/dist/src/cli/simple-commands/init/template-copier.js +421 -533
- package/dist/src/cli/simple-commands/init/templates/coordination-md.js +3 -6
- package/dist/src/cli/simple-commands/init/templates/enhanced-templates.js +344 -318
- package/dist/src/cli/simple-commands/init/templates/github-safe-enhanced.js +173 -218
- package/dist/src/cli/simple-commands/init/templates/github-safe.js +65 -75
- package/dist/src/cli/simple-commands/init/templates/memory-bank-md.js +3 -6
- package/dist/src/cli/simple-commands/init/templates/readme-files.js +2 -4
- package/dist/src/cli/simple-commands/init/templates/safe-hook-patterns.js +187 -230
- package/dist/src/cli/simple-commands/init/templates/sparc-modes.js +53 -80
- package/dist/src/cli/simple-commands/init/templates/verification-claude-md.js +101 -85
- package/dist/src/cli/simple-commands/init/validation/config-validator.js +283 -330
- package/dist/src/cli/simple-commands/init/validation/health-checker.js +495 -561
- package/dist/src/cli/simple-commands/init/validation/index.js +302 -358
- package/dist/src/cli/simple-commands/init/validation/mode-validator.js +308 -359
- package/dist/src/cli/simple-commands/init/validation/post-init-validator.js +389 -366
- package/dist/src/cli/simple-commands/init/validation/pre-init-validator.js +270 -268
- package/dist/src/cli/simple-commands/init/validation/test-runner.js +427 -447
- package/dist/src/cli/simple-commands/init.js +1 -2
- package/dist/src/cli/simple-commands/mcp-health.js +131 -158
- package/dist/src/cli/simple-commands/mcp-integration-layer.js +533 -634
- package/dist/src/cli/simple-commands/mcp.js +345 -400
- package/dist/src/cli/simple-commands/memory-consolidation.js +426 -537
- package/dist/src/cli/simple-commands/memory.js +247 -311
- package/dist/src/cli/simple-commands/migrate-hooks.js +39 -46
- package/dist/src/cli/simple-commands/monitor.js +294 -363
- package/dist/src/cli/simple-commands/neural.js +51 -65
- package/dist/src/cli/simple-commands/pair-autofix-only.js +538 -662
- package/dist/src/cli/simple-commands/pair-basic.js +528 -656
- package/dist/src/cli/simple-commands/pair-old.js +430 -543
- package/dist/src/cli/simple-commands/pair-working.js +615 -751
- package/dist/src/cli/simple-commands/pair.js +615 -751
- package/dist/src/cli/simple-commands/performance-hooks.js +83 -111
- package/dist/src/cli/simple-commands/performance-metrics.js +348 -433
- package/dist/src/cli/simple-commands/process-ui-enhanced.js +708 -787
- package/dist/src/cli/simple-commands/process-ui.js +230 -254
- package/dist/src/cli/simple-commands/realtime-update-system.js +525 -611
- package/dist/src/cli/simple-commands/sparc/architecture.js +1704 -1530
- package/dist/src/cli/simple-commands/sparc/commands.js +438 -516
- package/dist/src/cli/simple-commands/sparc/completion.js +1224 -1481
- package/dist/src/cli/simple-commands/sparc/coordinator.js +913 -978
- package/dist/src/cli/simple-commands/sparc/index.js +241 -298
- package/dist/src/cli/simple-commands/sparc/phase-base.js +314 -390
- package/dist/src/cli/simple-commands/sparc/pseudocode.js +965 -869
- package/dist/src/cli/simple-commands/sparc/refinement.js +980 -1273
- package/dist/src/cli/simple-commands/sparc/specification.js +559 -645
- package/dist/src/cli/simple-commands/sparc-modes/architect.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/ask.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/code.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/debug.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/devops.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/docs-writer.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/generic.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/index.js +47 -55
- package/dist/src/cli/simple-commands/sparc-modes/integration.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/mcp.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/monitoring.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/optimization.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/security-review.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/supabase-admin.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/swarm.js +101 -87
- package/dist/src/cli/simple-commands/sparc-modes/tdd.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/tutorial.js +1 -1
- package/dist/src/cli/simple-commands/sparc.js +465 -493
- package/dist/src/cli/simple-commands/start-ui.js +108 -132
- package/dist/src/cli/simple-commands/start-wrapper.js +240 -268
- package/dist/src/cli/simple-commands/start.js +1 -1
- package/dist/src/cli/simple-commands/status.js +254 -275
- package/dist/src/cli/simple-commands/stream-chain-clean.js +128 -171
- package/dist/src/cli/simple-commands/stream-chain-fixed.js +61 -82
- package/dist/src/cli/simple-commands/stream-chain-real.js +267 -331
- package/dist/src/cli/simple-commands/stream-chain-working.js +211 -263
- package/dist/src/cli/simple-commands/stream-chain.js +260 -318
- package/dist/src/cli/simple-commands/stream-processor.js +290 -315
- package/dist/src/cli/simple-commands/swarm-executor.js +189 -222
- package/dist/src/cli/simple-commands/swarm-metrics-integration.js +208 -300
- package/dist/src/cli/simple-commands/swarm-ui.js +623 -703
- package/dist/src/cli/simple-commands/swarm-webui-integration.js +258 -286
- package/dist/src/cli/simple-commands/swarm.js +887 -1082
- package/dist/src/cli/simple-commands/task.js +161 -206
- package/dist/src/cli/simple-commands/timestamp-fix.js +59 -89
- package/dist/src/cli/simple-commands/token-tracker.js +258 -316
- package/dist/src/cli/simple-commands/tool-execution-framework.js +433 -519
- package/dist/src/cli/simple-commands/train-and-stream.js +275 -331
- package/dist/src/cli/simple-commands/training-pipeline.js +619 -725
- package/dist/src/cli/simple-commands/training.js +170 -227
- package/dist/src/cli/simple-commands/verification-hooks.js +261 -284
- package/dist/src/cli/simple-commands/verification-integration.js +389 -417
- package/dist/src/cli/simple-commands/verification-training-integration.js +486 -606
- package/dist/src/cli/simple-commands/verification.js +493 -513
- package/dist/src/cli/simple-commands/web-server.js +766 -836
- package/dist/src/cli/simple-commands/webui-validator.js +106 -124
- package/dist/src/coordination/event-bus/demo-wasm-integration.js +212 -251
- package/dist/src/coordination/event-bus/qe-event-bus.js +608 -748
- package/dist/src/coordination/event-bus/qe-event-bus.test.js +379 -454
- package/dist/src/coordination/iteration-tracker.js +363 -454
- package/dist/src/enterprise/analytics-manager.js +1135 -0
- package/dist/src/enterprise/audit-manager.js +1115 -0
- package/dist/src/enterprise/cloud-manager.js +891 -0
- package/dist/src/enterprise/deployment-manager.js +966 -0
- package/dist/src/enterprise/index.js +6 -0
- package/dist/src/enterprise/project-manager.js +584 -0
- package/dist/src/enterprise/security-manager.js +991 -0
- package/dist/src/index.js +1 -1
- package/dist/src/mcp/DEPRECATED.js +46 -60
- package/dist/src/mcp/fixes/mcp-error-fixes.js +115 -134
- package/dist/src/mcp/implementations/agent-tracker.js +114 -128
- package/dist/src/mcp/implementations/daa-tools.js +292 -350
- package/dist/src/mcp/implementations/workflow-tools.js +329 -361
- package/dist/src/mcp/mcp-config-manager.js +1183 -1331
- package/dist/src/mcp/mcp-server-novice-simplified.js +11 -17
- package/dist/src/mcp/mcp-server-novice.js +11 -17
- package/dist/src/mcp/mcp-server-sdk.js +11 -17
- package/dist/src/mcp/mcp-server.js +1620 -1484
- package/dist/src/mcp/ruv-swarm-wrapper.js +209 -239
- package/dist/src/memory/advanced-serializer.js +609 -589
- package/dist/src/memory/enhanced-examples.js +220 -305
- package/dist/src/memory/enhanced-memory.js +295 -336
- package/dist/src/memory/enhanced-session-serializer.js +408 -492
- package/dist/src/memory/fallback-memory-system.js +900 -1021
- package/dist/src/memory/fallback-store.js +93 -131
- package/dist/src/memory/high-performance-serialization.js +592 -730
- package/dist/src/memory/in-memory-store.js +161 -213
- package/dist/src/memory/index.js +123 -157
- package/dist/src/memory/lock-free-structures.js +578 -764
- package/dist/src/memory/memory-mapped-persistence.js +585 -766
- package/dist/src/memory/memory-pressure-manager.js +569 -707
- package/dist/src/memory/migration.js +358 -445
- package/dist/src/memory/shared-memory.js +641 -768
- package/dist/src/memory/sqlite-store.js +245 -325
- package/dist/src/memory/sqlite-wrapper.js +122 -151
- package/dist/src/memory/swarm-memory.js +470 -603
- package/dist/src/memory/test-example.js +126 -134
- package/dist/src/memory/ultra-fast-memory-store.js +622 -821
- package/dist/src/memory/unified-memory-manager.js +356 -437
- package/dist/src/migration/index.js +92 -0
- package/dist/src/migration/logger.js +121 -0
- package/dist/src/migration/migration-analyzer.js +268 -0
- package/dist/src/migration/migration-runner.js +522 -0
- package/dist/src/migration/migration-validator.js +285 -0
- package/dist/src/migration/progress-reporter.js +150 -0
- package/dist/src/migration/rollback-manager.js +321 -0
- package/dist/src/migration/tests/migration-system.test.js +7 -0
- package/dist/src/migration/types.js +3 -0
- package/dist/src/swarm/CodeRefactoringSwarm.js +777 -952
- package/dist/src/swarm/__tests__/integration.test.js +227 -0
- package/dist/src/swarm/__tests__/prompt-copier.test.js +344 -0
- package/dist/src/swarm/advanced-orchestrator.js +1095 -0
- package/dist/src/swarm/claude-code-interface.js +961 -0
- package/dist/src/swarm/claude-flow-executor.js +229 -0
- package/dist/src/swarm/consensus-coordinator.js +475 -0
- package/dist/src/swarm/coordinator.js +2993 -0
- package/dist/src/swarm/direct-executor.js +1180 -0
- package/dist/src/swarm/error-recovery/advanced-error-detection.js +691 -0
- package/dist/src/swarm/error-recovery/automated-recovery-workflows.js +998 -0
- package/dist/src/swarm/error-recovery/error-recovery-coordinator.js +1197 -0
- package/dist/src/swarm/error-recovery/recovery-monitoring.js +772 -0
- package/dist/src/swarm/error-recovery/resilience-architecture.js +714 -0
- package/dist/src/swarm/error-recovery/self-healing-mechanisms.js +1319 -0
- package/dist/src/swarm/error-recovery/test-error-recovery-effectiveness.js +808 -0
- package/dist/src/swarm/executor-v2.js +322 -0
- package/dist/src/swarm/executor.js +815 -0
- package/dist/src/swarm/hive-mind-integration.js +703 -0
- package/dist/src/swarm/index.js +41 -0
- package/dist/src/swarm/json-output-aggregator.js +267 -0
- package/dist/src/swarm/large-scale-coordinator.js +542 -0
- package/dist/src/swarm/mcp-integration-wrapper.js +628 -0
- package/dist/src/swarm/memory.js +1117 -0
- package/dist/src/swarm/optimizations/__tests__/optimization.test.js +348 -0
- package/dist/src/swarm/optimizations/async-file-manager.js +285 -0
- package/dist/src/swarm/optimizations/circular-buffer.js +162 -0
- package/dist/src/swarm/optimizations/connection-pool.js +244 -0
- package/dist/src/swarm/optimizations/index.js +28 -0
- package/dist/src/swarm/optimizations/optimized-executor.js +320 -0
- package/dist/src/swarm/optimizations/ttl-map.js +234 -0
- package/dist/src/swarm/prompt-cli.js +200 -0
- package/dist/src/swarm/prompt-copier-enhanced.js +202 -0
- package/dist/src/swarm/prompt-copier.js +381 -0
- package/dist/src/swarm/prompt-manager.js +295 -0
- package/dist/src/swarm/prompt-utils.js +310 -0
- package/dist/src/swarm/result-aggregator.js +718 -0
- package/dist/src/swarm/sparc-executor.js +1568 -0
- package/dist/src/swarm/strategies/auto.js +758 -0
- package/dist/src/swarm/strategies/base.js +128 -0
- package/dist/src/swarm/strategies/research.js +914 -0
- package/dist/src/swarm/strategies/strategy-metrics-patch.js +2 -0
- package/dist/src/swarm/types.js +52 -0
- package/dist/src/swarm/workers/copy-worker.js +56 -0
- package/dist/src/utils/__tests__/github-cli-safety-wrapper.test.js +332 -400
- package/dist/src/utils/github-cli-safe.js +56 -64
- package/dist/src/utils/github-cli-safety-wrapper.js +451 -546
- package/dist/src/utils/npx-isolated-cache.js +104 -119
- package/dist/src/utils/preference-manager.js +622 -652
- package/dist/src/utils/timezone-utils.js +86 -105
- package/dist/src/validators/epic-config-schema.js +214 -0
- package/dist/src/validators/index.js +10 -0
- package/dist/src/validators/swarm-init-validator.js +259 -0
- package/dist/src/validators/todowrite-batching-validator.js +215 -0
- package/dist/src/validators/todowrite-integration.js +187 -0
- package/package.json +2 -2
|
@@ -1,736 +1,650 @@
|
|
|
1
1
|
// SPARC Specification Phase
|
|
2
2
|
// Gather requirements, define acceptance criteria, and establish project scope
|
|
3
|
-
|
|
4
|
-
import { SparcPhase } from './phase-base.js';
|
|
5
|
-
|
|
3
|
+
import { SparcPhase } from "./phase-base.js";
|
|
6
4
|
export class SparcSpecification extends SparcPhase {
|
|
7
|
-
|
|
8
|
-
super('specification', taskDescription, options);
|
|
9
|
-
this.requirements = [];
|
|
10
|
-
this.acceptanceCriteria = [];
|
|
11
|
-
this.userStories = [];
|
|
12
|
-
this.constraints = [];
|
|
13
|
-
this.assumptions = [];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
5
|
+
/**
|
|
17
6
|
* Execute specification phase
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// Identify risks
|
|
77
|
-
result.risks = await this.identifyRisks(result.requirements);
|
|
78
|
-
|
|
79
|
-
// Identify dependencies
|
|
80
|
-
result.dependencies = await this.identifyDependencies(result.requirements);
|
|
81
|
-
|
|
82
|
-
// Generate specification document
|
|
83
|
-
await this.generateSpecificationDocument(result);
|
|
84
|
-
|
|
85
|
-
// Store in memory
|
|
86
|
-
await this.storeInMemory('specification_complete', result);
|
|
87
|
-
|
|
88
|
-
console.log('✅ Specification phase completed');
|
|
89
|
-
return result;
|
|
90
|
-
} catch (error) {
|
|
91
|
-
console.error('❌ Specification phase failed:', error.message);
|
|
92
|
-
throw error;
|
|
7
|
+
*/ async execute() {
|
|
8
|
+
console.log('📋 Starting Specification Phase');
|
|
9
|
+
await this.initializePhase();
|
|
10
|
+
const result = {
|
|
11
|
+
requirements: [],
|
|
12
|
+
acceptanceCriteria: [],
|
|
13
|
+
userStories: [],
|
|
14
|
+
constraints: [],
|
|
15
|
+
assumptions: [],
|
|
16
|
+
stakeholders: [],
|
|
17
|
+
businessValue: '',
|
|
18
|
+
scope: {
|
|
19
|
+
included: [],
|
|
20
|
+
excluded: []
|
|
21
|
+
},
|
|
22
|
+
timeline: {
|
|
23
|
+
estimated: '',
|
|
24
|
+
phases: []
|
|
25
|
+
},
|
|
26
|
+
risks: [],
|
|
27
|
+
dependencies: []
|
|
28
|
+
};
|
|
29
|
+
try {
|
|
30
|
+
// Analyze task description
|
|
31
|
+
const analysis = await this.analyzeTaskDescription();
|
|
32
|
+
result.analysis = analysis;
|
|
33
|
+
// Extract requirements
|
|
34
|
+
result.requirements = await this.extractRequirements(analysis);
|
|
35
|
+
// Define acceptance criteria
|
|
36
|
+
result.acceptanceCriteria = await this.defineAcceptanceCriteria(result.requirements);
|
|
37
|
+
// Create user stories
|
|
38
|
+
result.userStories = await this.createUserStories(result.requirements);
|
|
39
|
+
// Identify constraints
|
|
40
|
+
result.constraints = await this.identifyConstraints();
|
|
41
|
+
// Document assumptions
|
|
42
|
+
result.assumptions = await this.documentAssumptions();
|
|
43
|
+
// Identify stakeholders
|
|
44
|
+
result.stakeholders = await this.identifyStakeholders();
|
|
45
|
+
// Define business value
|
|
46
|
+
result.businessValue = await this.defineBusiness();
|
|
47
|
+
// Define scope
|
|
48
|
+
result.scope = await this.defineScope(result.requirements);
|
|
49
|
+
// Estimate timeline
|
|
50
|
+
result.timeline = await this.estimateTimeline(result.requirements);
|
|
51
|
+
// Identify risks
|
|
52
|
+
result.risks = await this.identifyRisks(result.requirements);
|
|
53
|
+
// Identify dependencies
|
|
54
|
+
result.dependencies = await this.identifyDependencies(result.requirements);
|
|
55
|
+
// Generate specification document
|
|
56
|
+
await this.generateSpecificationDocument(result);
|
|
57
|
+
// Store in memory
|
|
58
|
+
await this.storeInMemory('specification_complete', result);
|
|
59
|
+
console.log('✅ Specification phase completed');
|
|
60
|
+
return result;
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.error('❌ Specification phase failed:', error.message);
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
93
65
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
/**
|
|
66
|
+
/**
|
|
97
67
|
* Analyze task description to extract key information
|
|
98
|
-
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
68
|
+
*/ async analyzeTaskDescription() {
|
|
69
|
+
const analysis = {
|
|
70
|
+
type: this.categorizeTask(),
|
|
71
|
+
complexity: this.assessComplexity(),
|
|
72
|
+
domain: this.identifyDomain(),
|
|
73
|
+
keywords: this.extractKeywords(),
|
|
74
|
+
verbs: this.extractActionVerbs(),
|
|
75
|
+
entities: this.extractEntities()
|
|
76
|
+
};
|
|
77
|
+
return analysis;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
113
80
|
* Categorize the task type
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
taskLower.includes('database') ||
|
|
132
|
-
taskLower.includes('data') ||
|
|
133
|
-
taskLower.includes('storage')
|
|
134
|
-
) {
|
|
135
|
-
return 'data_management';
|
|
136
|
-
} else if (taskLower.includes('test') || taskLower.includes('testing')) {
|
|
137
|
-
return 'testing';
|
|
138
|
-
} else if (taskLower.includes('deploy') || taskLower.includes('infrastructure')) {
|
|
139
|
-
return 'deployment';
|
|
140
|
-
} else if (taskLower.includes('refactor') || taskLower.includes('optimize')) {
|
|
141
|
-
return 'refactoring';
|
|
142
|
-
} else {
|
|
143
|
-
return 'general_development';
|
|
81
|
+
*/ categorizeTask() {
|
|
82
|
+
const taskLower = this.taskDescription.toLowerCase();
|
|
83
|
+
if (taskLower.includes('api') || taskLower.includes('endpoint') || taskLower.includes('service')) {
|
|
84
|
+
return 'api_development';
|
|
85
|
+
} else if (taskLower.includes('ui') || taskLower.includes('frontend') || taskLower.includes('interface')) {
|
|
86
|
+
return 'frontend_development';
|
|
87
|
+
} else if (taskLower.includes('database') || taskLower.includes('data') || taskLower.includes('storage')) {
|
|
88
|
+
return 'data_management';
|
|
89
|
+
} else if (taskLower.includes('test') || taskLower.includes('testing')) {
|
|
90
|
+
return 'testing';
|
|
91
|
+
} else if (taskLower.includes('deploy') || taskLower.includes('infrastructure')) {
|
|
92
|
+
return 'deployment';
|
|
93
|
+
} else if (taskLower.includes('refactor') || taskLower.includes('optimize')) {
|
|
94
|
+
return 'refactoring';
|
|
95
|
+
} else {
|
|
96
|
+
return 'general_development';
|
|
97
|
+
}
|
|
144
98
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
/**
|
|
99
|
+
/**
|
|
148
100
|
* Assess task complexity
|
|
149
|
-
*/
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return 'medium';
|
|
168
|
-
} else {
|
|
169
|
-
return 'low';
|
|
101
|
+
*/ assessComplexity() {
|
|
102
|
+
const wordCount = this.taskDescription.split(' ').length;
|
|
103
|
+
const complexityKeywords = [
|
|
104
|
+
'integrate',
|
|
105
|
+
'complex',
|
|
106
|
+
'multiple',
|
|
107
|
+
'advanced',
|
|
108
|
+
'enterprise',
|
|
109
|
+
'scalable'
|
|
110
|
+
];
|
|
111
|
+
const hasComplexityKeywords = complexityKeywords.some((keyword)=>this.taskDescription.toLowerCase().includes(keyword));
|
|
112
|
+
if (wordCount > 20 || hasComplexityKeywords) {
|
|
113
|
+
return 'high';
|
|
114
|
+
} else if (wordCount > 10) {
|
|
115
|
+
return 'medium';
|
|
116
|
+
} else {
|
|
117
|
+
return 'low';
|
|
118
|
+
}
|
|
170
119
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
/**
|
|
120
|
+
/**
|
|
174
121
|
* Identify domain
|
|
175
|
-
*/
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
122
|
+
*/ identifyDomain() {
|
|
123
|
+
const domains = {
|
|
124
|
+
web: [
|
|
125
|
+
'web',
|
|
126
|
+
'website',
|
|
127
|
+
'html',
|
|
128
|
+
'css',
|
|
129
|
+
'javascript'
|
|
130
|
+
],
|
|
131
|
+
mobile: [
|
|
132
|
+
'mobile',
|
|
133
|
+
'app',
|
|
134
|
+
'android',
|
|
135
|
+
'ios'
|
|
136
|
+
],
|
|
137
|
+
data: [
|
|
138
|
+
'data',
|
|
139
|
+
'analytics',
|
|
140
|
+
'ml',
|
|
141
|
+
'ai',
|
|
142
|
+
'machine learning'
|
|
143
|
+
],
|
|
144
|
+
security: [
|
|
145
|
+
'security',
|
|
146
|
+
'auth',
|
|
147
|
+
'authentication',
|
|
148
|
+
'encryption'
|
|
149
|
+
],
|
|
150
|
+
devops: [
|
|
151
|
+
'deploy',
|
|
152
|
+
'ci/cd',
|
|
153
|
+
'docker',
|
|
154
|
+
'kubernetes'
|
|
155
|
+
],
|
|
156
|
+
backend: [
|
|
157
|
+
'api',
|
|
158
|
+
'server',
|
|
159
|
+
'database',
|
|
160
|
+
'backend'
|
|
161
|
+
],
|
|
162
|
+
frontend: [
|
|
163
|
+
'ui',
|
|
164
|
+
'ux',
|
|
165
|
+
'frontend',
|
|
166
|
+
'interface'
|
|
167
|
+
]
|
|
168
|
+
};
|
|
169
|
+
const taskLower = this.taskDescription.toLowerCase();
|
|
170
|
+
for (const [domain, keywords] of Object.entries(domains)){
|
|
171
|
+
if (keywords.some((keyword)=>taskLower.includes(keyword))) {
|
|
172
|
+
return domain;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return 'general';
|
|
193
176
|
}
|
|
194
|
-
|
|
195
|
-
return 'general';
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
177
|
+
/**
|
|
199
178
|
* Extract keywords from task description
|
|
200
|
-
*/
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
.filter((word, index, arr) => arr.indexOf(word) === index) // Remove duplicates
|
|
223
|
-
.slice(0, 10); // Top 10 keywords
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
179
|
+
*/ extractKeywords() {
|
|
180
|
+
const words = this.taskDescription.toLowerCase().split(/\s+/);
|
|
181
|
+
const stopWords = [
|
|
182
|
+
'the',
|
|
183
|
+
'a',
|
|
184
|
+
'an',
|
|
185
|
+
'and',
|
|
186
|
+
'or',
|
|
187
|
+
'but',
|
|
188
|
+
'in',
|
|
189
|
+
'on',
|
|
190
|
+
'at',
|
|
191
|
+
'to',
|
|
192
|
+
'for',
|
|
193
|
+
'of',
|
|
194
|
+
'with',
|
|
195
|
+
'by'
|
|
196
|
+
];
|
|
197
|
+
return words.filter((word)=>word.length > 2 && !stopWords.includes(word)).filter((word, index, arr)=>arr.indexOf(word) === index) // Remove duplicates
|
|
198
|
+
.slice(0, 10); // Top 10 keywords
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
227
201
|
* Extract action verbs
|
|
228
|
-
*/
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
202
|
+
*/ extractActionVerbs() {
|
|
203
|
+
const verbs = [
|
|
204
|
+
'create',
|
|
205
|
+
'build',
|
|
206
|
+
'develop',
|
|
207
|
+
'implement',
|
|
208
|
+
'design',
|
|
209
|
+
'setup',
|
|
210
|
+
'configure',
|
|
211
|
+
'deploy',
|
|
212
|
+
'test',
|
|
213
|
+
'optimize',
|
|
214
|
+
'refactor',
|
|
215
|
+
'integrate'
|
|
216
|
+
];
|
|
217
|
+
const taskLower = this.taskDescription.toLowerCase();
|
|
218
|
+
return verbs.filter((verb)=>taskLower.includes(verb));
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
250
221
|
* Extract entities
|
|
251
|
-
*/
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
word.slice(1) === word.slice(1).toLowerCase()
|
|
262
|
-
) {
|
|
263
|
-
entities.push(word);
|
|
264
|
-
}
|
|
222
|
+
*/ extractEntities() {
|
|
223
|
+
const entities = [];
|
|
224
|
+
const words = this.taskDescription.split(/\s+/);
|
|
225
|
+
// Look for capitalized words (potential entities)
|
|
226
|
+
for (const word of words){
|
|
227
|
+
if (word.length > 2 && word[0] === word[0].toUpperCase() && word.slice(1) === word.slice(1).toLowerCase()) {
|
|
228
|
+
entities.push(word);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return entities;
|
|
265
232
|
}
|
|
266
|
-
|
|
267
|
-
return entities;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
233
|
+
/**
|
|
271
234
|
* Extract requirements from analysis
|
|
272
|
-
*/
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
break;
|
|
297
|
-
|
|
298
|
-
case 'data_management':
|
|
299
|
-
requirements.push(
|
|
300
|
-
'System must ensure data integrity',
|
|
301
|
-
'Data must be properly normalized',
|
|
302
|
-
'System must handle concurrent access',
|
|
303
|
-
'Data must be backed up regularly',
|
|
304
|
-
'System must provide data recovery mechanisms',
|
|
305
|
-
);
|
|
306
|
-
break;
|
|
307
|
-
|
|
308
|
-
case 'testing':
|
|
309
|
-
requirements.push(
|
|
310
|
-
'Test suite must achieve minimum 80% code coverage',
|
|
311
|
-
'Tests must be automated and repeatable',
|
|
312
|
-
'Tests must validate all critical paths',
|
|
313
|
-
'Test data must be properly managed',
|
|
314
|
-
'Tests must run efficiently',
|
|
315
|
-
);
|
|
316
|
-
break;
|
|
317
|
-
|
|
318
|
-
default:
|
|
319
|
-
requirements.push(
|
|
320
|
-
'System must be reliable and performant',
|
|
321
|
-
'Code must be maintainable and well-documented',
|
|
322
|
-
'System must handle edge cases gracefully',
|
|
323
|
-
'Implementation must follow best practices',
|
|
324
|
-
'System must be secure and robust',
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
// Add complexity-specific requirements
|
|
329
|
-
if (analysis.complexity === 'high') {
|
|
330
|
-
requirements.push(
|
|
331
|
-
'System must be scalable and handle high load',
|
|
332
|
-
'Architecture must be modular and extensible',
|
|
333
|
-
'System must have comprehensive monitoring',
|
|
334
|
-
'Implementation must include performance optimization',
|
|
335
|
-
);
|
|
235
|
+
*/ async extractRequirements(analysis) {
|
|
236
|
+
const requirements = [];
|
|
237
|
+
// Functional requirements based on task type
|
|
238
|
+
switch(analysis.type){
|
|
239
|
+
case 'api_development':
|
|
240
|
+
requirements.push('System must provide REST API endpoints', 'API must handle authentication and authorization', 'API must return appropriate HTTP status codes', 'API must validate input data', 'API must handle errors gracefully');
|
|
241
|
+
break;
|
|
242
|
+
case 'frontend_development':
|
|
243
|
+
requirements.push('Interface must be responsive and mobile-friendly', 'User interface must be intuitive and accessible', 'Application must handle user input validation', 'Interface must provide feedback for user actions', 'Application must be cross-browser compatible');
|
|
244
|
+
break;
|
|
245
|
+
case 'data_management':
|
|
246
|
+
requirements.push('System must ensure data integrity', 'Data must be properly normalized', 'System must handle concurrent access', 'Data must be backed up regularly', 'System must provide data recovery mechanisms');
|
|
247
|
+
break;
|
|
248
|
+
case 'testing':
|
|
249
|
+
requirements.push('Test suite must achieve minimum 80% code coverage', 'Tests must be automated and repeatable', 'Tests must validate all critical paths', 'Test data must be properly managed', 'Tests must run efficiently');
|
|
250
|
+
break;
|
|
251
|
+
default:
|
|
252
|
+
requirements.push('System must be reliable and performant', 'Code must be maintainable and well-documented', 'System must handle edge cases gracefully', 'Implementation must follow best practices', 'System must be secure and robust');
|
|
253
|
+
}
|
|
254
|
+
// Add complexity-specific requirements
|
|
255
|
+
if (analysis.complexity === 'high') {
|
|
256
|
+
requirements.push('System must be scalable and handle high load', 'Architecture must be modular and extensible', 'System must have comprehensive monitoring', 'Implementation must include performance optimization');
|
|
257
|
+
}
|
|
258
|
+
return requirements;
|
|
336
259
|
}
|
|
337
|
-
|
|
338
|
-
return requirements;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/**
|
|
260
|
+
/**
|
|
342
261
|
* Define acceptance criteria
|
|
343
|
-
*/
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
criteria.push(criterion);
|
|
262
|
+
*/ async defineAcceptanceCriteria(requirements) {
|
|
263
|
+
const criteria = [];
|
|
264
|
+
for (const requirement of requirements){
|
|
265
|
+
const criterion = {
|
|
266
|
+
requirement: requirement,
|
|
267
|
+
given: this.generateGivenCondition(requirement),
|
|
268
|
+
when: this.generateWhenCondition(requirement),
|
|
269
|
+
then: this.generateThenCondition(requirement),
|
|
270
|
+
priority: this.assessRequirementPriority(requirement),
|
|
271
|
+
testable: true
|
|
272
|
+
};
|
|
273
|
+
criteria.push(criterion);
|
|
274
|
+
}
|
|
275
|
+
return criteria;
|
|
358
276
|
}
|
|
359
|
-
|
|
360
|
-
return criteria;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/**
|
|
277
|
+
/**
|
|
364
278
|
* Generate Given condition for acceptance criteria
|
|
365
|
-
*/
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
279
|
+
*/ generateGivenCondition(requirement) {
|
|
280
|
+
if (requirement.includes('API')) {
|
|
281
|
+
return 'Given a valid API client';
|
|
282
|
+
} else if (requirement.includes('user')) {
|
|
283
|
+
return 'Given a valid user session';
|
|
284
|
+
} else if (requirement.includes('data')) {
|
|
285
|
+
return 'Given valid input data';
|
|
286
|
+
} else {
|
|
287
|
+
return 'Given a properly configured system';
|
|
288
|
+
}
|
|
375
289
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
/**
|
|
290
|
+
/**
|
|
379
291
|
* Generate When condition for acceptance criteria
|
|
380
|
-
*/
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
292
|
+
*/ generateWhenCondition(requirement) {
|
|
293
|
+
if (requirement.includes('provide')) {
|
|
294
|
+
return 'When the service is requested';
|
|
295
|
+
} else if (requirement.includes('handle')) {
|
|
296
|
+
return 'When the condition occurs';
|
|
297
|
+
} else if (requirement.includes('ensure')) {
|
|
298
|
+
return 'When the system operates';
|
|
299
|
+
} else {
|
|
300
|
+
return 'When the feature is used';
|
|
301
|
+
}
|
|
390
302
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
/**
|
|
303
|
+
/**
|
|
394
304
|
* Generate Then condition for acceptance criteria
|
|
395
|
-
*/
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
305
|
+
*/ generateThenCondition(requirement) {
|
|
306
|
+
if (requirement.includes('must')) {
|
|
307
|
+
return 'Then the requirement must be satisfied';
|
|
308
|
+
} else {
|
|
309
|
+
return 'Then the expected behavior occurs';
|
|
310
|
+
}
|
|
401
311
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
/**
|
|
312
|
+
/**
|
|
405
313
|
* Assess requirement priority
|
|
406
|
-
*/
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
314
|
+
*/ assessRequirementPriority(requirement) {
|
|
315
|
+
const highPriorityKeywords = [
|
|
316
|
+
'must',
|
|
317
|
+
'critical',
|
|
318
|
+
'security',
|
|
319
|
+
'authentication',
|
|
320
|
+
'data integrity'
|
|
321
|
+
];
|
|
322
|
+
const mediumPriorityKeywords = [
|
|
323
|
+
'should',
|
|
324
|
+
'performance',
|
|
325
|
+
'optimization',
|
|
326
|
+
'monitoring'
|
|
327
|
+
];
|
|
328
|
+
const reqLower = requirement.toLowerCase();
|
|
329
|
+
if (highPriorityKeywords.some((keyword)=>reqLower.includes(keyword))) {
|
|
330
|
+
return 'high';
|
|
331
|
+
} else if (mediumPriorityKeywords.some((keyword)=>reqLower.includes(keyword))) {
|
|
332
|
+
return 'medium';
|
|
333
|
+
} else {
|
|
334
|
+
return 'low';
|
|
335
|
+
}
|
|
425
336
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
/**
|
|
337
|
+
/**
|
|
429
338
|
* Create user stories
|
|
430
|
-
*/
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
stories.push(story);
|
|
339
|
+
*/ async createUserStories(requirements) {
|
|
340
|
+
const stories = [];
|
|
341
|
+
for (const requirement of requirements){
|
|
342
|
+
const story = {
|
|
343
|
+
title: this.generateStoryTitle(requirement),
|
|
344
|
+
narrative: this.generateStoryNarrative(requirement),
|
|
345
|
+
acceptanceCriteria: this.generateStoryAcceptanceCriteria(requirement),
|
|
346
|
+
priority: this.assessRequirementPriority(requirement),
|
|
347
|
+
estimation: this.estimateStoryPoints(requirement)
|
|
348
|
+
};
|
|
349
|
+
stories.push(story);
|
|
350
|
+
}
|
|
351
|
+
return stories;
|
|
444
352
|
}
|
|
445
|
-
|
|
446
|
-
return stories;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
/**
|
|
353
|
+
/**
|
|
450
354
|
* Generate story title
|
|
451
|
-
*/
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
355
|
+
*/ generateStoryTitle(requirement) {
|
|
356
|
+
const words = requirement.split(' ');
|
|
357
|
+
const actionWord = words.find((word)=>[
|
|
358
|
+
'provide',
|
|
359
|
+
'handle',
|
|
360
|
+
'ensure',
|
|
361
|
+
'validate'
|
|
362
|
+
].includes(word.toLowerCase()));
|
|
363
|
+
const objectWord = words.find((word)=>[
|
|
364
|
+
'API',
|
|
365
|
+
'data',
|
|
366
|
+
'user',
|
|
367
|
+
'system'
|
|
368
|
+
].includes(word));
|
|
369
|
+
return `${actionWord || 'Implement'} ${objectWord || 'functionality'}`;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
463
372
|
* Generate story narrative
|
|
464
|
-
*/
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
/**
|
|
373
|
+
*/ generateStoryNarrative(requirement) {
|
|
374
|
+
return `As a user, I want the system to ${requirement.toLowerCase()} so that I can achieve my goals effectively.`;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
470
377
|
* Generate story acceptance criteria
|
|
471
|
-
*/
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
378
|
+
*/ generateStoryAcceptanceCriteria(requirement) {
|
|
379
|
+
return [
|
|
380
|
+
`The system ${requirement.toLowerCase()}`
|
|
381
|
+
];
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
477
384
|
* Estimate story points
|
|
478
|
-
*/
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
return 1;
|
|
385
|
+
*/ estimateStoryPoints(requirement) {
|
|
386
|
+
const complexity = this.assessComplexity();
|
|
387
|
+
const priority = this.assessRequirementPriority(requirement);
|
|
388
|
+
if (complexity === 'high' && priority === 'high') {
|
|
389
|
+
return 8;
|
|
390
|
+
} else if (complexity === 'high' || priority === 'high') {
|
|
391
|
+
return 5;
|
|
392
|
+
} else if (complexity === 'medium' || priority === 'medium') {
|
|
393
|
+
return 3;
|
|
394
|
+
} else {
|
|
395
|
+
return 1;
|
|
396
|
+
}
|
|
491
397
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
/**
|
|
398
|
+
/**
|
|
495
399
|
* Identify constraints
|
|
496
|
-
*/
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
/**
|
|
400
|
+
*/ async identifyConstraints() {
|
|
401
|
+
return [
|
|
402
|
+
'Files must be under 500 lines',
|
|
403
|
+
'No hardcoded environment variables',
|
|
404
|
+
'Must follow security best practices',
|
|
405
|
+
'Must be compatible with existing systems',
|
|
406
|
+
'Must maintain backward compatibility',
|
|
407
|
+
'Must handle concurrent users',
|
|
408
|
+
'Must have proper error handling',
|
|
409
|
+
'Must include comprehensive logging'
|
|
410
|
+
];
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
511
413
|
* Document assumptions
|
|
512
|
-
*/
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
/**
|
|
414
|
+
*/ async documentAssumptions() {
|
|
415
|
+
return [
|
|
416
|
+
'Development environment is properly configured',
|
|
417
|
+
'Required dependencies are available',
|
|
418
|
+
'Database schema is stable',
|
|
419
|
+
'Network connectivity is reliable',
|
|
420
|
+
'Third-party APIs are stable',
|
|
421
|
+
'Security protocols are established',
|
|
422
|
+
'Backup procedures are in place',
|
|
423
|
+
'Monitoring systems are operational'
|
|
424
|
+
];
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
527
427
|
* Identify stakeholders
|
|
528
|
-
*/
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
428
|
+
*/ async identifyStakeholders() {
|
|
429
|
+
return [
|
|
430
|
+
{
|
|
431
|
+
role: 'Product Owner',
|
|
432
|
+
responsibility: 'Requirements definition'
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
role: 'Development Team',
|
|
436
|
+
responsibility: 'Implementation'
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
role: 'QA Team',
|
|
440
|
+
responsibility: 'Testing and validation'
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
role: 'DevOps Team',
|
|
444
|
+
responsibility: 'Deployment and operations'
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
role: 'Security Team',
|
|
448
|
+
responsibility: 'Security review'
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
role: 'End Users',
|
|
452
|
+
responsibility: 'Feedback and acceptance'
|
|
453
|
+
}
|
|
454
|
+
];
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
541
457
|
* Define business value
|
|
542
|
-
*/
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
return 'Addresses business requirements and improves system capabilities';
|
|
458
|
+
*/ async defineBusiness() {
|
|
459
|
+
const analysis = await this.analyzeTaskDescription();
|
|
460
|
+
switch(analysis.type){
|
|
461
|
+
case 'api_development':
|
|
462
|
+
return 'Enables system integration and data exchange, improving operational efficiency';
|
|
463
|
+
case 'frontend_development':
|
|
464
|
+
return 'Improves user experience and engagement, potentially increasing user satisfaction';
|
|
465
|
+
case 'data_management':
|
|
466
|
+
return 'Ensures data integrity and availability, supporting business decisions';
|
|
467
|
+
case 'testing':
|
|
468
|
+
return 'Reduces bugs and improves software quality, minimizing support costs';
|
|
469
|
+
default:
|
|
470
|
+
return 'Addresses business requirements and improves system capabilities';
|
|
471
|
+
}
|
|
557
472
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
/**
|
|
473
|
+
/**
|
|
561
474
|
* Define scope
|
|
562
|
-
*/
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
475
|
+
*/ async defineScope(requirements) {
|
|
476
|
+
const included = requirements.slice(0, Math.ceil(requirements.length * 0.8));
|
|
477
|
+
const excluded = [
|
|
478
|
+
'Performance optimization beyond basic requirements',
|
|
479
|
+
'Advanced security features not specified',
|
|
480
|
+
'Integration with non-specified external systems',
|
|
481
|
+
'Custom UI themes and branding',
|
|
482
|
+
'Advanced analytics and reporting',
|
|
483
|
+
'Mobile-specific optimizations',
|
|
484
|
+
'Legacy system migration',
|
|
485
|
+
'Third-party plugin development'
|
|
486
|
+
];
|
|
487
|
+
return {
|
|
488
|
+
included,
|
|
489
|
+
excluded
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
580
493
|
* Estimate timeline
|
|
581
|
-
*/
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
494
|
+
*/ async estimateTimeline(requirements) {
|
|
495
|
+
const totalStoryPoints = requirements.length * 3; // Average 3 points per requirement
|
|
496
|
+
const developmentVelocity = 10; // Points per sprint
|
|
497
|
+
const sprintsNeeded = Math.ceil(totalStoryPoints / developmentVelocity);
|
|
498
|
+
return {
|
|
499
|
+
estimated: `${sprintsNeeded * 2} weeks`,
|
|
500
|
+
phases: [
|
|
501
|
+
{
|
|
502
|
+
name: 'Specification',
|
|
503
|
+
duration: '1 week'
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
name: 'Architecture',
|
|
507
|
+
duration: '1 week'
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
name: 'Development',
|
|
511
|
+
duration: `${sprintsNeeded} weeks`
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
name: 'Testing',
|
|
515
|
+
duration: '1 week'
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
name: 'Deployment',
|
|
519
|
+
duration: '1 week'
|
|
520
|
+
}
|
|
521
|
+
]
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
600
525
|
* Identify risks
|
|
601
|
-
*/
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
/**
|
|
526
|
+
*/ async identifyRisks(requirements) {
|
|
527
|
+
return [
|
|
528
|
+
{
|
|
529
|
+
risk: 'Technical complexity higher than estimated',
|
|
530
|
+
probability: 'Medium',
|
|
531
|
+
impact: 'High',
|
|
532
|
+
mitigation: 'Conduct proof of concept before full implementation'
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
risk: 'Requirements change during development',
|
|
536
|
+
probability: 'High',
|
|
537
|
+
impact: 'Medium',
|
|
538
|
+
mitigation: 'Implement agile development with regular reviews'
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
risk: 'Integration issues with external systems',
|
|
542
|
+
probability: 'Medium',
|
|
543
|
+
impact: 'High',
|
|
544
|
+
mitigation: 'Early integration testing and API validation'
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
risk: 'Performance issues under load',
|
|
548
|
+
probability: 'Low',
|
|
549
|
+
impact: 'High',
|
|
550
|
+
mitigation: 'Load testing and performance monitoring'
|
|
551
|
+
}
|
|
552
|
+
];
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
632
555
|
* Identify dependencies
|
|
633
|
-
*/
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
556
|
+
*/ async identifyDependencies(requirements) {
|
|
557
|
+
const dependencies = [];
|
|
558
|
+
for (const requirement of requirements){
|
|
559
|
+
if (requirement.includes('API')) {
|
|
560
|
+
dependencies.push('Database schema definition');
|
|
561
|
+
dependencies.push('Authentication service');
|
|
562
|
+
}
|
|
563
|
+
if (requirement.includes('data')) {
|
|
564
|
+
dependencies.push('Data model design');
|
|
565
|
+
dependencies.push('Database setup');
|
|
566
|
+
}
|
|
567
|
+
if (requirement.includes('security')) {
|
|
568
|
+
dependencies.push('Security policy definition');
|
|
569
|
+
dependencies.push('Certificate management');
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
return [
|
|
573
|
+
...new Set(dependencies)
|
|
574
|
+
]; // Remove duplicates
|
|
650
575
|
}
|
|
651
|
-
|
|
652
|
-
return [...new Set(dependencies)]; // Remove duplicates
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
/**
|
|
576
|
+
/**
|
|
656
577
|
* Generate specification document
|
|
657
|
-
*/
|
|
658
|
-
|
|
659
|
-
const document = `# ${this.taskDescription} - Specification
|
|
578
|
+
*/ async generateSpecificationDocument(result) {
|
|
579
|
+
const document = `# ${this.taskDescription} - Specification
|
|
660
580
|
|
|
661
581
|
## Overview
|
|
662
582
|
${result.businessValue}
|
|
663
583
|
|
|
664
584
|
## Requirements
|
|
665
|
-
${result.requirements.map((req, index)
|
|
585
|
+
${result.requirements.map((req, index)=>`${index + 1}. ${req}`).join('\n')}
|
|
666
586
|
|
|
667
587
|
## Acceptance Criteria
|
|
668
|
-
${result.acceptanceCriteria
|
|
669
|
-
.map(
|
|
670
|
-
(criteria, index) => `
|
|
588
|
+
${result.acceptanceCriteria.map((criteria, index)=>`
|
|
671
589
|
### ${index + 1}. ${criteria.requirement}
|
|
672
590
|
- **Given**: ${criteria.given}
|
|
673
591
|
- **When**: ${criteria.when}
|
|
674
592
|
- **Then**: ${criteria.then}
|
|
675
593
|
- **Priority**: ${criteria.priority}
|
|
676
|
-
|
|
677
|
-
)
|
|
678
|
-
.join('\n')}
|
|
594
|
+
`).join('\n')}
|
|
679
595
|
|
|
680
596
|
## User Stories
|
|
681
|
-
${result.userStories
|
|
682
|
-
.map(
|
|
683
|
-
(story, index) => `
|
|
597
|
+
${result.userStories.map((story, index)=>`
|
|
684
598
|
### ${index + 1}. ${story.title}
|
|
685
599
|
${story.narrative}
|
|
686
600
|
**Acceptance Criteria**: ${story.acceptanceCriteria.join(', ')}
|
|
687
601
|
**Priority**: ${story.priority}
|
|
688
602
|
**Estimation**: ${story.estimation} points
|
|
689
|
-
|
|
690
|
-
)
|
|
691
|
-
.join('\n')}
|
|
603
|
+
`).join('\n')}
|
|
692
604
|
|
|
693
605
|
## Constraints
|
|
694
|
-
${result.constraints.map((constraint, index)
|
|
606
|
+
${result.constraints.map((constraint, index)=>`${index + 1}. ${constraint}`).join('\n')}
|
|
695
607
|
|
|
696
608
|
## Assumptions
|
|
697
|
-
${result.assumptions.map((assumption, index)
|
|
609
|
+
${result.assumptions.map((assumption, index)=>`${index + 1}. ${assumption}`).join('\n')}
|
|
698
610
|
|
|
699
611
|
## Scope
|
|
700
612
|
### Included
|
|
701
|
-
${result.scope.included.map((item, index)
|
|
613
|
+
${result.scope.included.map((item, index)=>`${index + 1}. ${item}`).join('\n')}
|
|
702
614
|
|
|
703
615
|
### Excluded
|
|
704
|
-
${result.scope.excluded.map((item, index)
|
|
616
|
+
${result.scope.excluded.map((item, index)=>`${index + 1}. ${item}`).join('\n')}
|
|
705
617
|
|
|
706
618
|
## Timeline
|
|
707
619
|
**Estimated Duration**: ${result.timeline.estimated}
|
|
708
620
|
|
|
709
|
-
${result.timeline.phases.map((phase)
|
|
621
|
+
${result.timeline.phases.map((phase)=>`- ${phase.name}: ${phase.duration}`).join('\n')}
|
|
710
622
|
|
|
711
623
|
## Risks
|
|
712
|
-
${result.risks
|
|
713
|
-
.map(
|
|
714
|
-
(risk, index) => `
|
|
624
|
+
${result.risks.map((risk, index)=>`
|
|
715
625
|
### ${index + 1}. ${risk.risk}
|
|
716
626
|
- **Probability**: ${risk.probability}
|
|
717
627
|
- **Impact**: ${risk.impact}
|
|
718
628
|
- **Mitigation**: ${risk.mitigation}
|
|
719
|
-
|
|
720
|
-
)
|
|
721
|
-
.join('\n')}
|
|
629
|
+
`).join('\n')}
|
|
722
630
|
|
|
723
631
|
## Dependencies
|
|
724
|
-
${result.dependencies.map((dep, index)
|
|
632
|
+
${result.dependencies.map((dep, index)=>`${index + 1}. ${dep}`).join('\n')}
|
|
725
633
|
|
|
726
634
|
## Stakeholders
|
|
727
|
-
${result.stakeholders.map((stakeholder)
|
|
635
|
+
${result.stakeholders.map((stakeholder)=>`- **${stakeholder.role}**: ${stakeholder.responsibility}`).join('\n')}
|
|
728
636
|
`;
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
637
|
+
// Save document
|
|
638
|
+
await this.saveArtifact('specification.md', document);
|
|
639
|
+
return document;
|
|
640
|
+
}
|
|
641
|
+
constructor(taskDescription, options){
|
|
642
|
+
super('specification', taskDescription, options);
|
|
643
|
+
this.requirements = [];
|
|
644
|
+
this.acceptanceCriteria = [];
|
|
645
|
+
this.userStories = [];
|
|
646
|
+
this.constraints = [];
|
|
647
|
+
this.assumptions = [];
|
|
648
|
+
}
|
|
734
649
|
}
|
|
735
|
-
|
|
736
650
|
export default SparcSpecification;
|