claude-flow-novice 1.3.0 → 1.3.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-flow-novice/preferences/generation.json +147 -0
- package/.claude-flow-novice/preferences/language-configs/javascript.json +51 -0
- package/.claude-flow-novice/preferences/language-configs/python.json +50 -0
- package/.claude-flow-novice/preferences/language-configs/rust.json +237 -0
- package/.claude-flow-novice/preferences/language-configs/typescript.json +54 -0
- package/.claude-flow-novice/preferences/project-local.json +91 -0
- package/.claude-flow-novice/preferences/resource-delegation.json +120 -0
- package/.claude-flow-novice/preferences/team-shared.json +195 -0
- package/.claude-flow-novice/preferences/user-global.json +247 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-JAVASCRIPT.md +769 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-PYTHON.md +1214 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-RUST.md +475 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-TYPESCRIPT.md +851 -0
- package/.claude-flow-novice/templates/claude-md-templates/README.md +263 -0
- package/CLAUDE.md +81 -0
- package/README-NPM.md +0 -0
- package/package.json +11 -7
- package/scripts/build/README.md +167 -0
- package/scripts/build/build-config.js +27 -0
- package/scripts/build/build-prompt-copier.sh +30 -0
- package/scripts/build/performance-monitor.js +869 -0
- package/scripts/build/prepare-publish.js +150 -0
- package/scripts/build/typescript-fixer.js +621 -0
- package/scripts/build/unified-builder.sh +428 -0
- package/scripts/build/update-bin-version.js +32 -0
- package/scripts/dev/README.md +264 -0
- package/scripts/dev/claude-flow-wrapper.sh +35 -0
- package/scripts/dev/claude-monitor.py +419 -0
- package/scripts/dev/claude-sparc.sh +562 -0
- package/scripts/dev/claude-wrapper.sh +17 -0
- package/scripts/dev/demo-phase3-compliance.js +172 -0
- package/scripts/dev/demo-task-system.ts +224 -0
- package/scripts/dev/deployment-validator.js +315 -0
- package/scripts/dev/spawn-claude-terminal.sh +32 -0
- package/scripts/dev/start-portal.sh +506 -0
- package/scripts/dev/start-web-ui.js +15 -0
- package/scripts/dev/stop-portal.sh +311 -0
- package/scripts/dev/validate-examples.ts +288 -0
- package/scripts/dev/validate-phase2.cjs +451 -0
- package/scripts/dev/validate-phase2.js +785 -0
- package/scripts/dev/validate-phase3.cjs +208 -0
- package/scripts/dev/validate-security-remediation.js +1 -0
- package/scripts/legacy/README.md +272 -0
- package/scripts/legacy/batch-fix-ts.sh +54 -0
- package/scripts/legacy/build-migration.sh +105 -0
- package/scripts/legacy/build-monitor.js +209 -0
- package/scripts/legacy/build-with-filter.sh +84 -0
- package/scripts/legacy/build-workaround.sh +71 -0
- package/scripts/legacy/fix-ts-advanced.js +358 -0
- package/scripts/legacy/fix-ts-final.sh +50 -0
- package/scripts/legacy/fix-ts-targeted.sh +49 -0
- package/scripts/legacy/fix-typescript-errors.js +305 -0
- package/scripts/legacy/force-build.sh +63 -0
- package/scripts/legacy/optimize-performance.js +400 -0
- package/scripts/legacy/performance-monitor.js +263 -0
- package/scripts/legacy/performance-monitoring.js +532 -0
- package/scripts/legacy/performance-test-runner.js +645 -0
- package/scripts/legacy/quick-fix-ts.js +281 -0
- package/scripts/legacy/safe-build.sh +63 -0
- package/scripts/migration/README.md +434 -0
- package/scripts/migration/install-arm64.js +78 -0
- package/scripts/migration/install.js +83 -0
- package/scripts/migration/migrate-hooks.js +173 -0
- package/scripts/migration/migration-examples.ts +318 -0
- package/scripts/optimization/build-optimizer.js +438 -0
- package/scripts/optimization/config-validator.js +761 -0
- package/scripts/optimization/test-optimization.js +432 -0
- package/scripts/optimization/unified-activation.js +839 -0
- package/scripts/performance/ACTIVATION_COMMANDS.md +292 -0
- package/scripts/performance/sqlite-enhanced-activation.sh +583 -0
- package/scripts/performance/test-enhanced-backend.sh +504 -0
- package/scripts/performance-test-runner.js +698 -0
- package/scripts/security/README.md +339 -0
- package/scripts/security/install-git-hooks.sh +132 -0
- package/scripts/security/ruv-swarm-safe.js +74 -0
- package/scripts/test/README.md +236 -0
- package/scripts/test/check-links.ts +274 -0
- package/scripts/test/check-performance-regression.ts +168 -0
- package/scripts/test/coverage-report.ts +692 -0
- package/scripts/test/generate-swarm-tests.js +633 -0
- package/scripts/test/integration-test-validation.cjs +253 -0
- package/scripts/test/load-test-swarm.js +576 -0
- package/scripts/test/run-phase3-compliance-tests.js +427 -0
- package/scripts/test/test-batch-tasks.ts +29 -0
- package/scripts/test/test-byzantine-resolution.js +246 -0
- package/scripts/test/test-claude-spawn-options.sh +63 -0
- package/scripts/test/test-cli-wizard.js +331 -0
- package/scripts/test/test-comprehensive.js +401 -0
- package/scripts/test/test-coordination-features.ts +238 -0
- package/scripts/test/test-fallback-systems.js +276 -0
- package/scripts/test/test-init-command.ts +302 -0
- package/scripts/test/test-mcp.ts +251 -0
- package/scripts/test/test-runner.ts +568 -0
- package/scripts/test/test-swarm-integration.sh +92 -0
- package/scripts/test/test-swarm.ts +142 -0
- package/scripts/test/validation-summary.ts +408 -0
- package/scripts/utils/README.md +261 -0
- package/scripts/utils/clean-build-artifacts.sh +94 -0
- package/scripts/utils/cleanup-root.sh +69 -0
- package/scripts/utils/fix-cliffy-imports.js +307 -0
- package/scripts/utils/fix-duplicate-imports.js +114 -0
- package/scripts/utils/fix-error-handling.cjs +70 -0
- package/scripts/utils/fix-import-paths.js +104 -0
- package/scripts/utils/fix-imports.js +116 -0
- package/scripts/utils/fix-shebang.js +78 -0
- package/scripts/utils/fix-test-modules.js +27 -0
- package/scripts/utils/fix-timezone-issue-246.js +200 -0
- package/scripts/utils/fix-ts-comprehensive.py +182 -0
- package/scripts/utils/fix-ts-targeted-batch.js +250 -0
- package/scripts/utils/remove-benchmark-conflicts.sh +140 -0
- package/scripts/utils/simple-test-fixer.js +190 -0
- package/scripts/utils/validate-metrics-structure.cjs +144 -0
- package/scripts/verify-mcp-server.js +86 -0
- package/src/cli/simple-commands/__tests__/agent.test.js +291 -0
- package/src/cli/simple-commands/__tests__/memory.test.js +8 -0
- package/src/cli/simple-commands/__tests__/swarm.test.js +371 -0
- package/src/cli/simple-commands/__tests__/task.test.js +8 -0
- package/src/cli/simple-commands/agent.js +216 -0
- package/src/cli/simple-commands/analysis.js +570 -0
- package/src/cli/simple-commands/automation-executor.js +1603 -0
- package/src/cli/simple-commands/automation.js +627 -0
- package/src/cli/simple-commands/batch-manager.js +338 -0
- package/src/cli/simple-commands/claude-telemetry.js +311 -0
- package/src/cli/simple-commands/claude-track.js +102 -0
- package/src/cli/simple-commands/concurrent-display.js +348 -0
- package/src/cli/simple-commands/config.js +319 -0
- package/src/cli/simple-commands/coordination.js +307 -0
- package/src/cli/simple-commands/enhanced-ui-views.js +654 -0
- package/src/cli/simple-commands/enhanced-webui-complete.js +1038 -0
- package/src/cli/simple-commands/fix-hook-variables.js +363 -0
- package/src/cli/simple-commands/github/gh-coordinator.js +605 -0
- package/src/cli/simple-commands/github/github-api.js +624 -0
- package/src/cli/simple-commands/github/init.js +543 -0
- package/src/cli/simple-commands/github.js +377 -0
- package/src/cli/simple-commands/goal.js +145 -0
- package/src/cli/simple-commands/hive-mind/auto-save-middleware.js +311 -0
- package/src/cli/simple-commands/hive-mind/communication.js +740 -0
- package/src/cli/simple-commands/hive-mind/core.js +1031 -0
- package/src/cli/simple-commands/hive-mind/db-optimizer.js +872 -0
- package/src/cli/simple-commands/hive-mind/mcp-wrapper.js +1364 -0
- package/src/cli/simple-commands/hive-mind/memory.js +1292 -0
- package/src/cli/simple-commands/hive-mind/performance-optimizer.js +618 -0
- package/src/cli/simple-commands/hive-mind/performance-test.js +373 -0
- package/src/cli/simple-commands/hive-mind/queen.js +809 -0
- package/src/cli/simple-commands/hive-mind/session-manager.js +1223 -0
- package/src/cli/simple-commands/hive-mind-optimize.js +361 -0
- package/src/cli/simple-commands/hive-mind-wizard.js +281 -0
- package/src/cli/simple-commands/hive-mind.js +3112 -0
- package/src/cli/simple-commands/hive.js +140 -0
- package/src/cli/simple-commands/hook-safety.js +671 -0
- package/src/cli/simple-commands/hooks.js +1268 -0
- package/src/cli/simple-commands/init/.claude/checkpoints/1756224542.json +7 -0
- package/src/cli/simple-commands/init/.claude/checkpoints/1756224544.json +8 -0
- package/src/cli/simple-commands/init/README.md +106 -0
- package/src/cli/simple-commands/init/VALIDATION_ROLLBACK.md +488 -0
- package/src/cli/simple-commands/init/agent-copier.js +347 -0
- package/src/cli/simple-commands/init/batch-init.js +663 -0
- package/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +438 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +876 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +356 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +501 -0
- package/src/cli/simple-commands/init/claude-commands/slash-commands.js +57 -0
- package/src/cli/simple-commands/init/claude-commands/sparc-commands.js +296 -0
- package/src/cli/simple-commands/init/copy-revised-templates.js +175 -0
- package/src/cli/simple-commands/init/executable-wrapper.js +122 -0
- package/src/cli/simple-commands/init/gitignore-updater.js +137 -0
- package/src/cli/simple-commands/init/help.js +110 -0
- package/src/cli/simple-commands/init/hive-mind-init.js +749 -0
- package/src/cli/simple-commands/init/index.js +1953 -0
- package/src/cli/simple-commands/init/performance-monitor.js +344 -0
- package/src/cli/simple-commands/init/rollback/backup-manager.js +542 -0
- package/src/cli/simple-commands/init/rollback/index.js +399 -0
- package/src/cli/simple-commands/init/rollback/recovery-manager.js +778 -0
- package/src/cli/simple-commands/init/rollback/rollback-executor.js +521 -0
- package/src/cli/simple-commands/init/rollback/state-tracker.js +486 -0
- package/src/cli/simple-commands/init/sparc/roo-readme.js +61 -0
- package/src/cli/simple-commands/init/sparc/roomodes-config.js +102 -0
- package/src/cli/simple-commands/init/sparc/workflows.js +40 -0
- package/src/cli/simple-commands/init/sparc-structure.js +68 -0
- package/src/cli/simple-commands/init/template-copier.js +640 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md +1185 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md.optimized +265 -0
- package/src/cli/simple-commands/init/templates/claude-flow-universal +81 -0
- package/src/cli/simple-commands/init/templates/claude-flow.bat +18 -0
- package/src/cli/simple-commands/init/templates/claude-flow.ps1 +24 -0
- package/src/cli/simple-commands/init/templates/claude-md.js +1101 -0
- package/src/cli/simple-commands/init/templates/commands/analysis/bottleneck-detect.md +162 -0
- package/src/cli/simple-commands/init/templates/commands/automation/auto-agent.md +122 -0
- package/src/cli/simple-commands/init/templates/commands/coordination/swarm-init.md +85 -0
- package/src/cli/simple-commands/init/templates/commands/github/github-swarm.md +121 -0
- package/src/cli/simple-commands/init/templates/commands/helpers/standard-checkpoint-hooks.sh +179 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/notification.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-command.md +116 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-edit.md +117 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-task.md +112 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-command.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-edit.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-search.md +112 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-task.md +111 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-end.md +118 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-restore.md +118 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-start.md +117 -0
- package/src/cli/simple-commands/init/templates/coordination-md.js +340 -0
- package/src/cli/simple-commands/init/templates/coordination.md +16 -0
- package/src/cli/simple-commands/init/templates/enhanced-templates.js +2347 -0
- package/src/cli/simple-commands/init/templates/github-safe-enhanced.js +331 -0
- package/src/cli/simple-commands/init/templates/github-safe.js +106 -0
- package/src/cli/simple-commands/init/templates/memory-bank-md.js +259 -0
- package/src/cli/simple-commands/init/templates/memory-bank.md +16 -0
- package/src/cli/simple-commands/init/templates/readme-files.js +72 -0
- package/src/cli/simple-commands/init/templates/safe-hook-patterns.js +430 -0
- package/src/cli/simple-commands/init/templates/settings.json +109 -0
- package/src/cli/simple-commands/init/templates/settings.json.enhanced +35 -0
- package/src/cli/simple-commands/init/templates/sparc-modes.js +1401 -0
- package/src/cli/simple-commands/init/templates/verification-claude-md.js +432 -0
- package/src/cli/simple-commands/init/validation/config-validator.js +354 -0
- package/src/cli/simple-commands/init/validation/health-checker.js +599 -0
- package/src/cli/simple-commands/init/validation/index.js +388 -0
- package/src/cli/simple-commands/init/validation/mode-validator.js +387 -0
- package/src/cli/simple-commands/init/validation/post-init-validator.js +390 -0
- package/src/cli/simple-commands/init/validation/pre-init-validator.js +290 -0
- package/src/cli/simple-commands/init/validation/test-runner.js +488 -0
- package/src/cli/simple-commands/init.js +4 -0
- package/src/cli/simple-commands/mcp-health.js +163 -0
- package/src/cli/simple-commands/mcp-integration-layer.js +689 -0
- package/src/cli/simple-commands/mcp.js +420 -0
- package/src/cli/simple-commands/memory-consolidation.js +631 -0
- package/src/cli/simple-commands/memory.js +345 -0
- package/src/cli/simple-commands/migrate-hooks.js +63 -0
- package/src/cli/simple-commands/monitor.js +417 -0
- package/src/cli/simple-commands/neural.js +148 -0
- package/src/cli/simple-commands/pair-autofix-only.js +755 -0
- package/src/cli/simple-commands/pair-basic.js +751 -0
- package/src/cli/simple-commands/pair-old.js +623 -0
- package/src/cli/simple-commands/pair-working.js +849 -0
- package/src/cli/simple-commands/pair.js +849 -0
- package/src/cli/simple-commands/performance-hooks.js +149 -0
- package/src/cli/simple-commands/performance-metrics.js +601 -0
- package/src/cli/simple-commands/process-ui-enhanced.js +821 -0
- package/src/cli/simple-commands/process-ui.js +274 -0
- package/src/cli/simple-commands/realtime-update-system.js +659 -0
- package/src/cli/simple-commands/sparc/architecture.js +1750 -0
- package/src/cli/simple-commands/sparc/commands.js +575 -0
- package/src/cli/simple-commands/sparc/completion.js +1831 -0
- package/src/cli/simple-commands/sparc/coordinator.js +1045 -0
- package/src/cli/simple-commands/sparc/index.js +321 -0
- package/src/cli/simple-commands/sparc/phase-base.js +430 -0
- package/src/cli/simple-commands/sparc/pseudocode.js +984 -0
- package/src/cli/simple-commands/sparc/refinement.js +1856 -0
- package/src/cli/simple-commands/sparc/specification.js +736 -0
- package/src/cli/simple-commands/sparc-modes/architect.js +125 -0
- package/src/cli/simple-commands/sparc-modes/ask.js +126 -0
- package/src/cli/simple-commands/sparc-modes/code.js +148 -0
- package/src/cli/simple-commands/sparc-modes/debug.js +112 -0
- package/src/cli/simple-commands/sparc-modes/devops.js +137 -0
- package/src/cli/simple-commands/sparc-modes/docs-writer.js +38 -0
- package/src/cli/simple-commands/sparc-modes/generic.js +34 -0
- package/src/cli/simple-commands/sparc-modes/index.js +201 -0
- package/src/cli/simple-commands/sparc-modes/integration.js +55 -0
- package/src/cli/simple-commands/sparc-modes/mcp.js +38 -0
- package/src/cli/simple-commands/sparc-modes/monitoring.js +38 -0
- package/src/cli/simple-commands/sparc-modes/optimization.js +38 -0
- package/src/cli/simple-commands/sparc-modes/security-review.js +130 -0
- package/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +167 -0
- package/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +38 -0
- package/src/cli/simple-commands/sparc-modes/supabase-admin.js +149 -0
- package/src/cli/simple-commands/sparc-modes/swarm.js +436 -0
- package/src/cli/simple-commands/sparc-modes/tdd.js +112 -0
- package/src/cli/simple-commands/sparc-modes/tutorial.js +277 -0
- package/src/cli/simple-commands/sparc.js +530 -0
- package/src/cli/simple-commands/start-ui.js +147 -0
- package/src/cli/simple-commands/start-wrapper.js +285 -0
- package/src/cli/simple-commands/start.js +2 -0
- package/src/cli/simple-commands/status.js +303 -0
- package/src/cli/simple-commands/stream-chain-clean.js +221 -0
- package/src/cli/simple-commands/stream-chain-fixed.js +89 -0
- package/src/cli/simple-commands/stream-chain-real.js +408 -0
- package/src/cli/simple-commands/stream-chain-working.js +323 -0
- package/src/cli/simple-commands/stream-chain.js +491 -0
- package/src/cli/simple-commands/stream-processor.js +340 -0
- package/src/cli/simple-commands/swarm-executor.js +253 -0
- package/src/cli/simple-commands/swarm-metrics-integration.js +371 -0
- package/src/cli/simple-commands/swarm-ui.js +741 -0
- package/src/cli/simple-commands/swarm-webui-integration.js +311 -0
- package/src/cli/simple-commands/swarm.js +2277 -0
- package/src/cli/simple-commands/task.js +228 -0
- package/src/cli/simple-commands/templates/mle-star-workflow.json +294 -0
- package/src/cli/simple-commands/timestamp-fix.js +104 -0
- package/src/cli/simple-commands/token-tracker.js +372 -0
- package/src/cli/simple-commands/tool-execution-framework.js +555 -0
- package/src/cli/simple-commands/train-and-stream.js +354 -0
- package/src/cli/simple-commands/training-pipeline.js +874 -0
- package/src/cli/simple-commands/training.js +288 -0
- package/src/cli/simple-commands/verification-hooks.js +336 -0
- package/src/cli/simple-commands/verification-integration.js +464 -0
- package/src/cli/simple-commands/verification-training-integration.js +646 -0
- package/src/cli/simple-commands/verification.js +551 -0
- package/src/cli/simple-commands/web-server.js +929 -0
- package/src/cli/simple-commands/webui-validator.js +136 -0
- package/src/language/README.md +503 -0
- package/src/language/claude-md-generator.js +618 -0
- package/src/language/cli.js +422 -0
- package/src/language/example.js +347 -0
- package/src/language/integration-system.js +619 -0
- package/src/language/language-detector.js +581 -0
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
// state-tracker.js - Track initialization state and rollback points
|
|
3
|
+
|
|
4
|
+
export class StateTracker {
|
|
5
|
+
constructor(workingDir) {
|
|
6
|
+
this.workingDir = workingDir;
|
|
7
|
+
this.stateFile = `${workingDir}/.claude-flow-state.json`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Record a rollback point
|
|
12
|
+
*/
|
|
13
|
+
async recordRollbackPoint(type, data) {
|
|
14
|
+
const result = {
|
|
15
|
+
success: true,
|
|
16
|
+
errors: [],
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const state = await this.loadState();
|
|
21
|
+
|
|
22
|
+
const rollbackPoint = {
|
|
23
|
+
id: this.generateId(),
|
|
24
|
+
type,
|
|
25
|
+
timestamp: Date.now(),
|
|
26
|
+
data,
|
|
27
|
+
...data,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
state.rollbackPoints = state.rollbackPoints || [];
|
|
31
|
+
state.rollbackPoints.push(rollbackPoint);
|
|
32
|
+
|
|
33
|
+
// Keep only the last 10 rollback points
|
|
34
|
+
if (state.rollbackPoints.length > 10) {
|
|
35
|
+
state.rollbackPoints = state.rollbackPoints.slice(-10);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
await this.saveState(state);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
result.success = false;
|
|
41
|
+
result.errors.push(`Failed to record rollback point: ${error.message}`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Create a checkpoint
|
|
49
|
+
*/
|
|
50
|
+
async createCheckpoint(phase, data) {
|
|
51
|
+
const result = {
|
|
52
|
+
success: true,
|
|
53
|
+
id: null,
|
|
54
|
+
errors: [],
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
const state = await this.loadState();
|
|
59
|
+
|
|
60
|
+
const checkpoint = {
|
|
61
|
+
id: this.generateId(),
|
|
62
|
+
phase,
|
|
63
|
+
timestamp: Date.now(),
|
|
64
|
+
data,
|
|
65
|
+
status: 'active',
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
result.id = checkpoint.id;
|
|
69
|
+
|
|
70
|
+
state.checkpoints = state.checkpoints || [];
|
|
71
|
+
state.checkpoints.push(checkpoint);
|
|
72
|
+
|
|
73
|
+
// Keep only the last 20 checkpoints
|
|
74
|
+
if (state.checkpoints.length > 20) {
|
|
75
|
+
state.checkpoints = state.checkpoints.slice(-20);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
await this.saveState(state);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
result.success = false;
|
|
81
|
+
result.errors.push(`Failed to create checkpoint: ${error.message}`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Update a checkpoint
|
|
89
|
+
*/
|
|
90
|
+
async updateCheckpoint(checkpointId, updates) {
|
|
91
|
+
const result = {
|
|
92
|
+
success: true,
|
|
93
|
+
errors: [],
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
const state = await this.loadState();
|
|
98
|
+
|
|
99
|
+
if (state.checkpoints) {
|
|
100
|
+
const checkpoint = state.checkpoints.find((cp) => cp.id === checkpointId);
|
|
101
|
+
if (checkpoint) {
|
|
102
|
+
Object.assign(checkpoint, updates);
|
|
103
|
+
await this.saveState(state);
|
|
104
|
+
} else {
|
|
105
|
+
result.success = false;
|
|
106
|
+
result.errors.push(`Checkpoint not found: ${checkpointId}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} catch (error) {
|
|
110
|
+
result.success = false;
|
|
111
|
+
result.errors.push(`Failed to update checkpoint: ${error.message}`);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Record a rollback operation
|
|
119
|
+
*/
|
|
120
|
+
async recordRollback(targetId, rollbackType, phase = null) {
|
|
121
|
+
const result = {
|
|
122
|
+
success: true,
|
|
123
|
+
errors: [],
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
try {
|
|
127
|
+
const state = await this.loadState();
|
|
128
|
+
|
|
129
|
+
const rollbackRecord = {
|
|
130
|
+
id: this.generateId(),
|
|
131
|
+
targetId,
|
|
132
|
+
rollbackType,
|
|
133
|
+
phase,
|
|
134
|
+
timestamp: Date.now(),
|
|
135
|
+
status: 'completed',
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
state.rollbackHistory = state.rollbackHistory || [];
|
|
139
|
+
state.rollbackHistory.push(rollbackRecord);
|
|
140
|
+
|
|
141
|
+
// Keep only the last 50 rollback records
|
|
142
|
+
if (state.rollbackHistory.length > 50) {
|
|
143
|
+
state.rollbackHistory = state.rollbackHistory.slice(-50);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
await this.saveState(state);
|
|
147
|
+
} catch (error) {
|
|
148
|
+
result.success = false;
|
|
149
|
+
result.errors.push(`Failed to record rollback: ${error.message}`);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Get rollback points
|
|
157
|
+
*/
|
|
158
|
+
async getRollbackPoints() {
|
|
159
|
+
try {
|
|
160
|
+
const state = await this.loadState();
|
|
161
|
+
return state.rollbackPoints || [];
|
|
162
|
+
} catch {
|
|
163
|
+
return [];
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Get checkpoints
|
|
169
|
+
*/
|
|
170
|
+
async getCheckpoints() {
|
|
171
|
+
try {
|
|
172
|
+
const state = await this.loadState();
|
|
173
|
+
return state.checkpoints || [];
|
|
174
|
+
} catch {
|
|
175
|
+
return [];
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Get rollback history
|
|
181
|
+
*/
|
|
182
|
+
async getRollbackHistory() {
|
|
183
|
+
try {
|
|
184
|
+
const state = await this.loadState();
|
|
185
|
+
return state.rollbackHistory || [];
|
|
186
|
+
} catch {
|
|
187
|
+
return [];
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Track file operation
|
|
193
|
+
*/
|
|
194
|
+
async trackFileOperation(operation, filePath, metadata = {}) {
|
|
195
|
+
const result = {
|
|
196
|
+
success: true,
|
|
197
|
+
errors: [],
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
try {
|
|
201
|
+
const state = await this.loadState();
|
|
202
|
+
|
|
203
|
+
const fileOp = {
|
|
204
|
+
id: this.generateId(),
|
|
205
|
+
operation, // 'create', 'modify', 'delete'
|
|
206
|
+
filePath,
|
|
207
|
+
timestamp: Date.now(),
|
|
208
|
+
metadata,
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
state.fileOperations = state.fileOperations || [];
|
|
212
|
+
state.fileOperations.push(fileOp);
|
|
213
|
+
|
|
214
|
+
// Keep only the last 100 file operations
|
|
215
|
+
if (state.fileOperations.length > 100) {
|
|
216
|
+
state.fileOperations = state.fileOperations.slice(-100);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
await this.saveState(state);
|
|
220
|
+
} catch (error) {
|
|
221
|
+
result.success = false;
|
|
222
|
+
result.errors.push(`Failed to track file operation: ${error.message}`);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return result;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Get current initialization phase
|
|
230
|
+
*/
|
|
231
|
+
async getCurrentPhase() {
|
|
232
|
+
try {
|
|
233
|
+
const state = await this.loadState();
|
|
234
|
+
return state.currentPhase || 'not-started';
|
|
235
|
+
} catch {
|
|
236
|
+
return 'not-started';
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Set current initialization phase
|
|
242
|
+
*/
|
|
243
|
+
async setCurrentPhase(phase) {
|
|
244
|
+
const result = {
|
|
245
|
+
success: true,
|
|
246
|
+
errors: [],
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
const state = await this.loadState();
|
|
251
|
+
state.currentPhase = phase;
|
|
252
|
+
state.phaseTimestamp = Date.now();
|
|
253
|
+
|
|
254
|
+
// Track phase transitions
|
|
255
|
+
state.phaseHistory = state.phaseHistory || [];
|
|
256
|
+
state.phaseHistory.push({
|
|
257
|
+
phase,
|
|
258
|
+
timestamp: Date.now(),
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
await this.saveState(state);
|
|
262
|
+
} catch (error) {
|
|
263
|
+
result.success = false;
|
|
264
|
+
result.errors.push(`Failed to set phase: ${error.message}`);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return result;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Get initialization statistics
|
|
272
|
+
*/
|
|
273
|
+
async getInitializationStats() {
|
|
274
|
+
try {
|
|
275
|
+
const state = await this.loadState();
|
|
276
|
+
|
|
277
|
+
return {
|
|
278
|
+
rollbackPoints: (state.rollbackPoints || []).length,
|
|
279
|
+
checkpoints: (state.checkpoints || []).length,
|
|
280
|
+
rollbackHistory: (state.rollbackHistory || []).length,
|
|
281
|
+
fileOperations: (state.fileOperations || []).length,
|
|
282
|
+
currentPhase: state.currentPhase || 'not-started',
|
|
283
|
+
lastActivity: state.lastActivity || 0,
|
|
284
|
+
phaseHistory: state.phaseHistory || [],
|
|
285
|
+
};
|
|
286
|
+
} catch {
|
|
287
|
+
return {
|
|
288
|
+
rollbackPoints: 0,
|
|
289
|
+
checkpoints: 0,
|
|
290
|
+
rollbackHistory: 0,
|
|
291
|
+
fileOperations: 0,
|
|
292
|
+
currentPhase: 'not-started',
|
|
293
|
+
lastActivity: 0,
|
|
294
|
+
phaseHistory: [],
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Clean up old state data
|
|
301
|
+
*/
|
|
302
|
+
async cleanupOldState(daysToKeep = 7) {
|
|
303
|
+
const result = {
|
|
304
|
+
success: true,
|
|
305
|
+
cleaned: 0,
|
|
306
|
+
errors: [],
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
try {
|
|
310
|
+
const state = await this.loadState();
|
|
311
|
+
const cutoffTime = Date.now() - daysToKeep * 24 * 60 * 60 * 1000;
|
|
312
|
+
|
|
313
|
+
let cleaned = 0;
|
|
314
|
+
|
|
315
|
+
// Clean rollback points
|
|
316
|
+
if (state.rollbackPoints) {
|
|
317
|
+
const before = state.rollbackPoints.length;
|
|
318
|
+
state.rollbackPoints = state.rollbackPoints.filter((rp) => rp.timestamp > cutoffTime);
|
|
319
|
+
cleaned += before - state.rollbackPoints.length;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Clean checkpoints
|
|
323
|
+
if (state.checkpoints) {
|
|
324
|
+
const before = state.checkpoints.length;
|
|
325
|
+
state.checkpoints = state.checkpoints.filter((cp) => cp.timestamp > cutoffTime);
|
|
326
|
+
cleaned += before - state.checkpoints.length;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Clean file operations
|
|
330
|
+
if (state.fileOperations) {
|
|
331
|
+
const before = state.fileOperations.length;
|
|
332
|
+
state.fileOperations = state.fileOperations.filter((fo) => fo.timestamp > cutoffTime);
|
|
333
|
+
cleaned += before - state.fileOperations.length;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
result.cleaned = cleaned;
|
|
337
|
+
|
|
338
|
+
if (cleaned > 0) {
|
|
339
|
+
await this.saveState(state);
|
|
340
|
+
}
|
|
341
|
+
} catch (error) {
|
|
342
|
+
result.success = false;
|
|
343
|
+
result.errors.push(`State cleanup failed: ${error.message}`);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return result;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Validate state tracking system
|
|
351
|
+
*/
|
|
352
|
+
async validateStateTracking() {
|
|
353
|
+
const result = {
|
|
354
|
+
success: true,
|
|
355
|
+
errors: [],
|
|
356
|
+
warnings: [],
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
try {
|
|
360
|
+
// Test state file access
|
|
361
|
+
const state = await this.loadState();
|
|
362
|
+
|
|
363
|
+
// Test write access
|
|
364
|
+
state.lastValidation = Date.now();
|
|
365
|
+
await this.saveState(state);
|
|
366
|
+
|
|
367
|
+
// Validate state structure
|
|
368
|
+
const validationResult = this.validateStateStructure(state);
|
|
369
|
+
if (!validationResult.valid) {
|
|
370
|
+
result.warnings.push(...validationResult.issues);
|
|
371
|
+
}
|
|
372
|
+
} catch (error) {
|
|
373
|
+
result.success = false;
|
|
374
|
+
result.errors.push(`State tracking validation failed: ${error.message}`);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
return result;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Export state for backup
|
|
382
|
+
*/
|
|
383
|
+
async exportState() {
|
|
384
|
+
try {
|
|
385
|
+
const state = await this.loadState();
|
|
386
|
+
return {
|
|
387
|
+
success: true,
|
|
388
|
+
data: state,
|
|
389
|
+
timestamp: Date.now(),
|
|
390
|
+
};
|
|
391
|
+
} catch (error) {
|
|
392
|
+
return {
|
|
393
|
+
success: false,
|
|
394
|
+
error: error.message,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Import state from backup
|
|
401
|
+
*/
|
|
402
|
+
async importState(stateData) {
|
|
403
|
+
const result = {
|
|
404
|
+
success: true,
|
|
405
|
+
errors: [],
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
try {
|
|
409
|
+
if (this.validateStateStructure(stateData).valid) {
|
|
410
|
+
await this.saveState(stateData);
|
|
411
|
+
} else {
|
|
412
|
+
result.success = false;
|
|
413
|
+
result.errors.push('Invalid state data structure');
|
|
414
|
+
}
|
|
415
|
+
} catch (error) {
|
|
416
|
+
result.success = false;
|
|
417
|
+
result.errors.push(`State import failed: ${error.message}`);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
return result;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// Helper methods
|
|
424
|
+
|
|
425
|
+
async loadState() {
|
|
426
|
+
try {
|
|
427
|
+
const content = await fs.readFile(this.stateFile, 'utf8');
|
|
428
|
+
return JSON.parse(content);
|
|
429
|
+
} catch {
|
|
430
|
+
// Return default state if file doesn't exist or is invalid
|
|
431
|
+
return {
|
|
432
|
+
version: '1.0',
|
|
433
|
+
created: Date.now(),
|
|
434
|
+
lastActivity: Date.now(),
|
|
435
|
+
rollbackPoints: [],
|
|
436
|
+
checkpoints: [],
|
|
437
|
+
rollbackHistory: [],
|
|
438
|
+
fileOperations: [],
|
|
439
|
+
currentPhase: 'not-started',
|
|
440
|
+
phaseHistory: [],
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
async saveState(state) {
|
|
446
|
+
state.lastActivity = Date.now();
|
|
447
|
+
state.version = '1.0';
|
|
448
|
+
|
|
449
|
+
await fs.writeFile(this.stateFile, JSON.stringify(state, null, 2, 'utf8'));
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
generateId() {
|
|
453
|
+
return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
validateStateStructure(state) {
|
|
457
|
+
const result = {
|
|
458
|
+
valid: true,
|
|
459
|
+
issues: [],
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
if (!state || typeof state !== 'object') {
|
|
463
|
+
result.valid = false;
|
|
464
|
+
result.issues.push('State must be an object');
|
|
465
|
+
return result;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// Check required fields
|
|
469
|
+
const requiredFields = ['version', 'created', 'lastActivity'];
|
|
470
|
+
for (const field of requiredFields) {
|
|
471
|
+
if (!(field in state)) {
|
|
472
|
+
result.issues.push(`Missing required field: ${field}`);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// Check array fields
|
|
477
|
+
const arrayFields = ['rollbackPoints', 'checkpoints', 'rollbackHistory', 'fileOperations'];
|
|
478
|
+
for (const field of arrayFields) {
|
|
479
|
+
if (field in state && !Array.isArray(state[field])) {
|
|
480
|
+
result.issues.push(`Field ${field} must be an array`);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
return result;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// roo-readme.js - README for .roo directory
|
|
2
|
+
|
|
3
|
+
export function createRooReadme() {
|
|
4
|
+
return `# .roo Directory - SPARC Development Environment
|
|
5
|
+
|
|
6
|
+
This directory contains the SPARC (Specification, Pseudocode, Architecture, Refinement, Completion) development environment configuration and templates.
|
|
7
|
+
|
|
8
|
+
## Directory Structure
|
|
9
|
+
|
|
10
|
+
\`\`\`
|
|
11
|
+
.roo/
|
|
12
|
+
├── README.md # This file
|
|
13
|
+
├── templates/ # Template files for common patterns
|
|
14
|
+
├── workflows/ # Predefined SPARC workflows
|
|
15
|
+
│ └── basic-tdd.json # Basic TDD workflow
|
|
16
|
+
├── modes/ # Custom mode definitions (optional)
|
|
17
|
+
└── configs/ # Configuration files
|
|
18
|
+
\`\`\`
|
|
19
|
+
|
|
20
|
+
## SPARC Methodology
|
|
21
|
+
|
|
22
|
+
SPARC is a systematic approach to software development:
|
|
23
|
+
|
|
24
|
+
1. **Specification**: Define clear requirements and constraints
|
|
25
|
+
2. **Pseudocode**: Create detailed logic flows and algorithms
|
|
26
|
+
3. **Architecture**: Design system structure and components
|
|
27
|
+
4. **Refinement**: Implement, test, and optimize using TDD
|
|
28
|
+
5. **Completion**: Integrate, document, and validate
|
|
29
|
+
|
|
30
|
+
## Usage with Claude-Flow
|
|
31
|
+
|
|
32
|
+
Use the claude-flow SPARC commands to leverage this environment:
|
|
33
|
+
|
|
34
|
+
\`\`\`bash
|
|
35
|
+
# List available modes
|
|
36
|
+
claude-flow sparc modes
|
|
37
|
+
|
|
38
|
+
# Run specific mode
|
|
39
|
+
claude-flow sparc run code "implement user authentication"
|
|
40
|
+
|
|
41
|
+
# Execute full TDD workflow
|
|
42
|
+
claude-flow sparc tdd "payment processing system"
|
|
43
|
+
|
|
44
|
+
# Use custom workflow
|
|
45
|
+
claude-flow sparc workflow .roo/workflows/basic-tdd.json
|
|
46
|
+
\`\`\`
|
|
47
|
+
|
|
48
|
+
## Configuration
|
|
49
|
+
|
|
50
|
+
The main configuration is in \`.roomodes\` at the project root. This directory provides additional templates and workflows to support the SPARC development process.
|
|
51
|
+
|
|
52
|
+
## Customization
|
|
53
|
+
|
|
54
|
+
You can customize this environment by:
|
|
55
|
+
- Adding new workflow templates to \`workflows/\`
|
|
56
|
+
- Creating mode-specific templates in \`templates/\`
|
|
57
|
+
- Adding project-specific configurations in \`configs/\`
|
|
58
|
+
|
|
59
|
+
For more information, see: https://github.com/ruvnet/claude-code-flow/docs/sparc.md
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// roomodes-config.js - Basic .roomodes configuration
|
|
2
|
+
|
|
3
|
+
export function createBasicRoomodesConfig() {
|
|
4
|
+
return JSON.stringify(
|
|
5
|
+
{
|
|
6
|
+
customModes: [
|
|
7
|
+
{
|
|
8
|
+
slug: 'architect',
|
|
9
|
+
name: '🏗️ Architect',
|
|
10
|
+
roleDefinition:
|
|
11
|
+
'You design scalable, secure, and modular architectures based on functional specs and user needs. You define responsibilities across services, APIs, and components.',
|
|
12
|
+
customInstructions:
|
|
13
|
+
'Create architecture mermaid diagrams, data flows, and integration points. Ensure no part of the design includes secrets or hardcoded env values. Emphasize modular boundaries and maintain extensibility.',
|
|
14
|
+
groups: ['read', 'edit'],
|
|
15
|
+
source: 'project',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
slug: 'code',
|
|
19
|
+
name: '🧠 Auto-Coder',
|
|
20
|
+
roleDefinition:
|
|
21
|
+
'You write clean, efficient, modular code based on pseudocode and architecture. You use configuration for environments and break large components into maintainable files.',
|
|
22
|
+
customInstructions:
|
|
23
|
+
'Write modular code using clean architecture principles. Never hardcode secrets or environment values. Split code into files < 500 lines. Use config files or environment abstractions. Use `new_task` for subtasks and finish with `attempt_completion`.',
|
|
24
|
+
groups: ['read', 'edit', 'browser', 'mcp', 'command'],
|
|
25
|
+
source: 'project',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
slug: 'tdd',
|
|
29
|
+
name: '🧪 Tester (TDD)',
|
|
30
|
+
roleDefinition:
|
|
31
|
+
'You implement Test-Driven Development (TDD, London School), writing tests first and refactoring after minimal implementation passes.',
|
|
32
|
+
customInstructions:
|
|
33
|
+
'Write failing tests first. Implement only enough code to pass. Refactor after green. Ensure tests do not hardcode secrets. Keep files < 500 lines.',
|
|
34
|
+
groups: ['read', 'edit', 'browser', 'mcp', 'command'],
|
|
35
|
+
source: 'project',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
slug: 'spec-pseudocode',
|
|
39
|
+
name: '📋 Specification Writer',
|
|
40
|
+
roleDefinition:
|
|
41
|
+
'You capture full project context—functional requirements, edge cases, constraints—and translate that into modular pseudocode with TDD anchors.',
|
|
42
|
+
customInstructions:
|
|
43
|
+
'Write pseudocode as a series of md files with phase_number_name.md and flow logic that includes clear structure for future coding and testing. Split complex logic across modules.',
|
|
44
|
+
groups: ['read', 'edit'],
|
|
45
|
+
source: 'project',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
slug: 'integration',
|
|
49
|
+
name: '🔗 System Integrator',
|
|
50
|
+
roleDefinition:
|
|
51
|
+
'You merge the outputs of all modes into a working, tested, production-ready system. You ensure consistency, cohesion, and modularity.',
|
|
52
|
+
customInstructions:
|
|
53
|
+
'Verify interface compatibility, shared modules, and env config standards. Split integration logic across domains as needed. Use `new_task` for preflight testing.',
|
|
54
|
+
groups: ['read', 'edit', 'browser', 'mcp', 'command'],
|
|
55
|
+
source: 'project',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
slug: 'debug',
|
|
59
|
+
name: '🪲 Debugger',
|
|
60
|
+
roleDefinition:
|
|
61
|
+
'You troubleshoot runtime bugs, logic errors, or integration failures by tracing, inspecting, and analyzing behavior.',
|
|
62
|
+
customInstructions:
|
|
63
|
+
'Use logs, traces, and stack analysis to isolate bugs. Avoid changing env configuration directly. Keep fixes modular.',
|
|
64
|
+
groups: ['read', 'edit', 'browser', 'mcp', 'command'],
|
|
65
|
+
source: 'project',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
slug: 'security-review',
|
|
69
|
+
name: '🛡️ Security Reviewer',
|
|
70
|
+
roleDefinition:
|
|
71
|
+
'You perform static and dynamic audits to ensure secure code practices. You flag secrets, poor modular boundaries, and oversized files.',
|
|
72
|
+
customInstructions:
|
|
73
|
+
'Scan for exposed secrets, env leaks, and monoliths. Recommend mitigations or refactors to reduce risk. Flag files > 500 lines or direct environment coupling.',
|
|
74
|
+
groups: ['read', 'edit'],
|
|
75
|
+
source: 'project',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
slug: 'docs-writer',
|
|
79
|
+
name: '📚 Documentation Writer',
|
|
80
|
+
roleDefinition:
|
|
81
|
+
'You write concise, clear, and modular Markdown documentation that explains usage, integration, setup, and configuration.',
|
|
82
|
+
customInstructions:
|
|
83
|
+
'Only work in .md files. Use sections, examples, and headings. Keep each file under 500 lines. Do not leak env values.',
|
|
84
|
+
groups: ['read', ['edit', { fileRegex: '\\.md$', description: 'Markdown files only' }]],
|
|
85
|
+
source: 'project',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
slug: 'swarm',
|
|
89
|
+
name: '🐝 Swarm Coordinator',
|
|
90
|
+
roleDefinition:
|
|
91
|
+
'You are the swarm coordination specialist, orchestrating multiple AI agents to handle complex, long-running tasks that would be difficult or impossible for a single agent due to scope, complexity, or timeout constraints.',
|
|
92
|
+
customInstructions:
|
|
93
|
+
'Coordinate advanced multi-agent swarms with timeout-free execution capabilities. Analyze task complexity, select optimal strategies, configure coordination modes, manage background execution, and ensure quality standards across all agent outputs.',
|
|
94
|
+
groups: ['read', 'edit', 'command'],
|
|
95
|
+
source: 'project',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
null,
|
|
100
|
+
2,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// workflows.js - SPARC workflow templates
|
|
2
|
+
|
|
3
|
+
export function createBasicSparcWorkflow() {
|
|
4
|
+
return JSON.stringify(
|
|
5
|
+
{
|
|
6
|
+
name: 'Basic TDD Workflow',
|
|
7
|
+
description: 'A simple SPARC-based TDD workflow for development',
|
|
8
|
+
sequential: true,
|
|
9
|
+
steps: [
|
|
10
|
+
{
|
|
11
|
+
mode: 'spec-pseudocode',
|
|
12
|
+
description: 'Create detailed specifications and pseudocode',
|
|
13
|
+
phase: 'specification',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
mode: 'tdd',
|
|
17
|
+
description: 'Write failing tests (Red phase)',
|
|
18
|
+
phase: 'red',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
mode: 'code',
|
|
22
|
+
description: 'Implement minimal code to pass tests (Green phase)',
|
|
23
|
+
phase: 'green',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
mode: 'tdd',
|
|
27
|
+
description: 'Refactor and optimize (Refactor phase)',
|
|
28
|
+
phase: 'refactor',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
mode: 'integration',
|
|
32
|
+
description: 'Integrate and verify complete solution',
|
|
33
|
+
phase: 'integration',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
null,
|
|
38
|
+
2,
|
|
39
|
+
);
|
|
40
|
+
}
|