@polymorphism-tech/morph-spec 4.21.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +57 -71
- package/README.md +2 -2
- package/bin/morph-spec.js +224 -491
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +55 -38
- package/framework/MORPH.md +244 -0
- package/framework/agents.json +127 -1183
- package/framework/commands/morph-apply.md +56 -240
- package/framework/commands/morph-archive.md +48 -85
- package/framework/commands/morph-preflight.md +7 -7
- package/framework/commands/morph-proposal.md +35 -191
- package/framework/commands/morph-status.md +19 -50
- package/framework/commands/morph-troubleshoot.md +2 -2
- package/framework/evals/rubrics/README.md +44 -0
- package/framework/evals/rubrics/architecture.md +46 -0
- package/framework/evals/rubrics/code-quality.md +50 -0
- package/framework/evals/rubrics/contracts.md +47 -0
- package/framework/evals/rubrics/test-coverage.md +50 -0
- package/framework/evals/scenarios/dotnet-crud.yaml +42 -0
- package/framework/evals/scenarios/nextjs-auth.yaml +38 -0
- package/framework/evals/suites/standard.yaml +5 -0
- package/framework/evals/trace-schema.md +67 -0
- package/framework/hooks/claude-code/core/README.md +3 -0
- package/framework/hooks/claude-code/core/denylist.json +14 -0
- package/framework/hooks/claude-code/{pre-tool-use → core}/enforce-phase-writes.js +5 -5
- package/framework/hooks/claude-code/core/post-edit-typecheck.js +69 -0
- package/framework/hooks/claude-code/core/pre-bash-denylist.js +29 -0
- package/framework/hooks/claude-code/{pre-tool-use → core}/protect-spec-files.js +4 -6
- package/framework/hooks/claude-code/{stop → core}/validate-completion.js +13 -82
- package/framework/hooks/shared/phase-utils.js +20 -28
- package/framework/hooks/shared/state-reader.js +4 -5
- package/framework/{skills/level-0-meta/mcp-registry.json → mcp/registry.json} +254 -210
- package/framework/phases.json +40 -114
- package/framework/rubrics/eval-rubric.json +66 -0
- package/framework/skills/README.md +39 -64
- package/framework/skills/core/README.md +3 -0
- package/framework/skills/core/morph-brainstorming/SKILL.md +102 -0
- package/framework/skills/core/morph-eval/SKILL.md +57 -0
- package/framework/skills/core/morph-implement/SKILL.md +83 -0
- package/framework/skills/core/morph-plan/SKILL.md +64 -0
- package/framework/skills/core/morph-review/SKILL.md +62 -0
- package/framework/skills/core/morph-stack-scan/SKILL.md +109 -0
- package/framework/skills/core/morph-standards/SKILL.md +49 -0
- package/framework/standards/STANDARDS.json +32 -0
- package/framework/standards/frontend/design-system/ai-image-generation.md +244 -0
- package/framework/standards/integration/mcp/mcp-tools.md +48 -0
- package/framework/templates/CLAUDE.md.core.guide.md +29 -0
- package/framework/templates/CLAUDE.md.core.template +22 -0
- package/framework/templates/REGISTRY.json +4 -4
- package/framework/workflows/configs/fast-track.json +5 -10
- package/framework/workflows/configs/full.json +4 -8
- package/framework/workflows/configs/quick.json +32 -0
- package/framework/workflows/configs/standard.json +57 -64
- package/package.json +7 -6
- package/src/commands/mcp/mcp-setup.js +58 -31
- package/src/commands/project/doctor.js +69 -70
- package/src/commands/project/init.js +26 -5
- package/src/commands/project/status.js +18 -19
- package/src/commands/state/approve.js +1 -1
- package/src/commands/validation/validate-feature.js +18 -112
- package/src/core/paths/output-schema.js +133 -151
- package/src/core/state/phase-state-machine.js +10 -24
- package/src/core/state/state-manager.js +17 -17
- package/src/core/workflows/workflow-detector.js +214 -31
- package/src/core/workflows/workflow-router.js +204 -0
- package/src/dashboard/app/pages/AgentMap.jsx +32 -33
- package/src/dashboard/app/pages/LiveState.jsx +1 -1
- package/src/dashboard/app/pages/PhasePipeline.jsx +2 -4
- package/src/dashboard/app/pages/SkillsLibrary.jsx +2 -3
- package/src/dashboard/app/pages/Workflows.jsx +2 -2
- package/src/dashboard/scanner/agents-scanner.js +30 -35
- package/src/lib/agents/metrics-aggregator.js +1 -1
- package/src/lib/agents/output-collector.js +7 -8
- package/src/lib/context/context-builder.js +289 -0
- package/src/lib/detectors/claude-config-detector.js +19 -3
- package/src/lib/generators/context-generator.js +20 -42
- package/src/lib/generators/index.js +1 -0
- package/src/lib/generators/mandate-generator.js +512 -0
- package/src/lib/generators/metadata-extractor.js +1 -1
- package/src/lib/generators/recap-generator.js +3 -4
- package/src/lib/installers/mcp-installer.js +300 -92
- package/src/lib/phase-chain/phase-validator.js +36 -40
- package/src/lib/stack/stack-profile.js +74 -91
- package/src/lib/tasks/task-parser.js +1 -1
- package/src/lib/tasks/wave-resolver.js +353 -0
- package/src/lib/validators/checkpoint-persistence.js +2 -2
- package/src/lib/validators/content/cross-phase-validator.js +281 -0
- package/src/lib/validators/content/index.js +1 -0
- package/src/lib/validators/shared/emit-validator-dispatch.js +6 -56
- package/src/scripts/global-install.js +2 -27
- package/src/utils/agents-installer.js +224 -447
- package/src/utils/claude-settings-manager.js +57 -15
- package/src/utils/file-copier.js +1 -0
- package/src/utils/hooks-installer.js +15 -117
- package/src/utils/skills-installer.js +12 -18
- package/bin/detect-agents.js +0 -226
- package/bin/task-manager.js +0 -1036
- package/framework/agents/README.md +0 -13
- package/framework/agents/ai-agents/ai-system-architect.md +0 -194
- package/framework/agents/ai-agents/vector-search-expert.md +0 -247
- package/framework/agents/architecture/architecture-expert.md +0 -98
- package/framework/agents/architecture/morph-spec-architect.md +0 -66
- package/framework/agents/architecture/packages-validator.md +0 -89
- package/framework/agents/architecture/security-expert.md +0 -79
- package/framework/agents/architecture/seo-growth-hacker.md +0 -168
- package/framework/agents/architecture/standards-architect.md +0 -153
- package/framework/agents/backend/dotnet-senior.md +0 -163
- package/framework/agents/backend/ef-modeler.md +0 -119
- package/framework/agents/backend/hangfire-orchestrator.md +0 -133
- package/framework/agents/backend/ms-agent-expert.md +0 -55
- package/framework/agents/backend/neon-expert.md +0 -379
- package/framework/agents/frontend/css-specialist.md +0 -89
- package/framework/agents/frontend/design-system-validator.md +0 -100
- package/framework/agents/frontend/gsap-animator.md +0 -131
- package/framework/agents/frontend/nextjs-component-validator.md +0 -97
- package/framework/agents/frontend/nextjs-expert.md +0 -201
- package/framework/agents/frontend/ui-designer.md +0 -259
- package/framework/agents/infrastructure/infra-architect.md +0 -215
- package/framework/agents/integrations/asaas-financial.md +0 -138
- package/framework/agents/integrations/neon-auth.md +0 -151
- package/framework/agents/integrations/resend-email.md +0 -127
- package/framework/hooks/claude-code/post-tool-use/agent-complete.js +0 -122
- package/framework/hooks/claude-code/post-tool-use/dispatch.js +0 -363
- package/framework/hooks/claude-code/post-tool-use/handle-tool-failure.js +0 -78
- package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +0 -194
- package/framework/hooks/claude-code/pre-compact/save-morph-context.js +0 -199
- package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +0 -55
- package/framework/hooks/claude-code/session-start/inject-morph-context.js +0 -323
- package/framework/hooks/claude-code/session-start/post-compact-restore.js +0 -41
- package/framework/hooks/claude-code/session-start/resume-context.js +0 -77
- package/framework/hooks/claude-code/teammate-idle/teammate-idle.js +0 -90
- package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +0 -114
- package/framework/hooks/shared/compact-restore.js +0 -123
- package/framework/hooks/shared/dispatch-helpers.js +0 -147
- package/framework/hooks/shared/skill-reminder-helpers.js +0 -79
- package/framework/hooks/shared/stale-task-reset.js +0 -57
- package/framework/hooks/shared/worktree-helpers.js +0 -75
- package/framework/skills/level-0-meta/README.md +0 -7
- package/framework/skills/level-0-meta/morph-agent-teams/SKILL.md +0 -472
- package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +0 -174
- package/framework/skills/level-0-meta/morph-brainstorming/references/proposal-example.md +0 -138
- package/framework/skills/level-0-meta/morph-checklist/SKILL.md +0 -145
- package/framework/skills/level-0-meta/morph-code-review/SKILL.md +0 -250
- package/framework/skills/level-0-meta/morph-code-review/references/review-example.md +0 -164
- package/framework/skills/level-0-meta/morph-code-review/references/review-guidelines.md +0 -100
- package/framework/skills/level-0-meta/morph-code-review/scripts/scan-csharp.mjs +0 -151
- package/framework/skills/level-0-meta/morph-code-review-nextjs/SKILL.md +0 -165
- package/framework/skills/level-0-meta/morph-code-review-nextjs/references/review-example-nextjs.md +0 -254
- package/framework/skills/level-0-meta/morph-code-review-nextjs/scripts/scan-nextjs.mjs +0 -189
- package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +0 -344
- package/framework/skills/level-0-meta/morph-frontend-review/scripts/scan-accessibility.mjs +0 -376
- package/framework/skills/level-0-meta/morph-init/SKILL.md +0 -537
- package/framework/skills/level-0-meta/morph-parallel-dispatch/SKILL.md +0 -225
- package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +0 -382
- package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-dev-server.mjs +0 -153
- package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-stack.mjs +0 -234
- package/framework/skills/level-0-meta/morph-simulation-checklist/SKILL.md +0 -106
- package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +0 -243
- package/framework/skills/level-0-meta/morph-tool-usage-guide/references/tools-per-phase.md +0 -169
- package/framework/skills/level-0-meta/morph-verification-before-completion/SKILL.md +0 -148
- package/framework/skills/level-0-meta/morph-verification-before-completion/scripts/check-phase-outputs.mjs +0 -110
- package/framework/skills/level-1-workflows/README.md +0 -7
- package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +0 -269
- package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +0 -453
- package/framework/skills/level-1-workflows/morph-phase-design/references/architecture-analysis-guide.md +0 -44
- package/framework/skills/level-1-workflows/morph-phase-design/references/spec-authoring-guide.md +0 -55
- package/framework/skills/level-1-workflows/morph-phase-design/references/spec-example.md +0 -253
- package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +0 -38
- package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +0 -493
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +0 -50
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +0 -46
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +0 -47
- package/framework/skills/level-1-workflows/morph-phase-implement/references/recap-example.md +0 -132
- package/framework/skills/level-1-workflows/morph-phase-implement/references/vsa-implementation-guide.md +0 -92
- package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +0 -257
- package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +0 -14
- package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +0 -291
- package/framework/skills/level-1-workflows/morph-phase-tasks/references/task-planning-patterns.md +0 -143
- package/framework/skills/level-1-workflows/morph-phase-tasks/references/tasks-example.md +0 -404
- package/framework/skills/level-1-workflows/morph-phase-tasks/scripts/validate-tasks.mjs +0 -112
- package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +0 -788
- package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +0 -147
- package/framework/squad-templates/backend-only.json +0 -47
- package/framework/squad-templates/frontend-only.json +0 -56
- package/framework/squad-templates/full-stack.json +0 -74
- package/src/commands/agents/agent-metrics.js +0 -174
- package/src/commands/agents/audit-dispatch.js +0 -82
- package/src/commands/agents/detect-agents.js +0 -275
- package/src/commands/agents/dispatch-agents.js +0 -461
- package/src/commands/agents/index.js +0 -13
- package/src/commands/agents/manage-agents.js +0 -352
- package/src/commands/agents/project-metrics.js +0 -74
- package/src/commands/phase/phase-reset.js +0 -74
- package/src/commands/scope/escalate.js +0 -217
- package/src/commands/state/advance-phase.js +0 -600
- package/src/commands/state/phase-runner.js +0 -215
- package/src/commands/state/state.js +0 -444
- package/src/commands/task/expand.js +0 -100
- package/src/commands/tasks/index.js +0 -4
- package/src/commands/tasks/task.js +0 -105
- package/src/commands/templates/index.js +0 -5
- package/src/commands/templates/template-render.js +0 -93
- package/src/commands/trust/trust.js +0 -118
- package/src/lib/agents/agents-manager.js +0 -349
- package/src/lib/build/build-runner.js +0 -99
- package/src/lib/checkpoints/checkpoint-hooks.js +0 -111
- package/src/lib/contracts/sprint-contract-generator.js +0 -137
- package/src/lib/scope/impact-analyzer.js +0 -106
- package/src/lib/trust/trust-manager.js +0 -157
- package/src/utils/tier-helpers.js +0 -24
- /package/framework/hooks/claude-code/{post-tool-use → core}/loop-detect.js +0 -0
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MORPH-SPEC Phase Runner
|
|
3
|
-
*
|
|
4
|
-
* Executes an automated phase chain loop for a feature.
|
|
5
|
-
* Reads eligibility at each step, auto-advances when eligible, and
|
|
6
|
-
* pauses on blockers (blocked_tasks, low_pass_rate, trust_too_low).
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* morph-spec phase run <feature>
|
|
10
|
-
* morph-spec phase run <feature> --dry-run
|
|
11
|
-
* morph-spec phase run <feature> --max-phases 3
|
|
12
|
-
*
|
|
13
|
-
* Eligibility gates:
|
|
14
|
-
* - Required outputs present on disk
|
|
15
|
-
* - No blocked tasks in validationHistory
|
|
16
|
-
* - Validation pass rate >= minPassRate (from workflow config)
|
|
17
|
-
* - Trust level meets gate requirements (or gates already approved)
|
|
18
|
-
*
|
|
19
|
-
* Level 3 autonomy: when run with zero-touch workflow + trust=maximum,
|
|
20
|
-
* executes proposal → design → tasks → implement without human input,
|
|
21
|
-
* pausing only on escalation triggers.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
import chalk from 'chalk';
|
|
25
|
-
import { join } from 'path';
|
|
26
|
-
import { checkPhaseEligibility, computePassRate } from '../../lib/phase-chain/phase-validator.js';
|
|
27
|
-
import { advancePhaseCommand } from './advance-phase.js';
|
|
28
|
-
import { loadState } from '../../core/state/state-manager.js';
|
|
29
|
-
import { derivePhase } from '../../core/state/state-manager.js';
|
|
30
|
-
import { getWorkflowConfig } from '../../core/workflows/workflow-detector.js';
|
|
31
|
-
|
|
32
|
-
// Phases that trigger a pause regardless of eligibility
|
|
33
|
-
const PAUSE_TRIGGERS = ['blocked_tasks', 'trust_too_low'];
|
|
34
|
-
|
|
35
|
-
// Maximum auto-phases before stopping (safety valve)
|
|
36
|
-
const DEFAULT_MAX_PHASES = 6;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Render a decision tree for --dry-run mode.
|
|
40
|
-
*/
|
|
41
|
-
function renderDecisionTree(featureName, eligibility, workflowConfig, dryRun) {
|
|
42
|
-
const { eligible, blockers, currentPhase, nextPhase, passRate } = eligibility;
|
|
43
|
-
|
|
44
|
-
console.log(chalk.cyan('\n╔════════════════════════════════════════════════╗'));
|
|
45
|
-
console.log(chalk.cyan('║ MORPH-SPEC PHASE CHAIN DECISION TREE ║'));
|
|
46
|
-
if (dryRun) console.log(chalk.yellow('║ *** DRY RUN *** ║'));
|
|
47
|
-
console.log(chalk.cyan('╚════════════════════════════════════════════════╝\n'));
|
|
48
|
-
|
|
49
|
-
console.log(chalk.gray('Feature:'), featureName);
|
|
50
|
-
console.log(chalk.gray('Current Phase:'), chalk.cyan(currentPhase));
|
|
51
|
-
console.log(chalk.gray('Next Phase:'), nextPhase ? chalk.cyan(nextPhase) : chalk.gray('(final)'));
|
|
52
|
-
if (passRate !== null) {
|
|
53
|
-
const rateColor = passRate >= 0.95 ? chalk.green : passRate >= 0.80 ? chalk.yellow : chalk.red;
|
|
54
|
-
console.log(chalk.gray('Pass Rate:'), rateColor(`${(passRate * 100).toFixed(0)}%`));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (workflowConfig?.phaseChain) {
|
|
58
|
-
console.log(chalk.gray('Phase Chain:'), chalk.green('enabled'));
|
|
59
|
-
console.log(chalk.gray('Max Auto Phases:'), workflowConfig.phaseChain.maxAutoPhases ?? DEFAULT_MAX_PHASES);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
console.log();
|
|
63
|
-
|
|
64
|
-
if (eligible) {
|
|
65
|
-
console.log(chalk.green(`✓ ELIGIBLE — can advance from ${currentPhase} → ${nextPhase}`));
|
|
66
|
-
} else {
|
|
67
|
-
console.log(chalk.red(`✗ BLOCKED — cannot advance from ${currentPhase}`));
|
|
68
|
-
console.log(chalk.yellow('\n Blockers:'));
|
|
69
|
-
for (const blocker of blockers) {
|
|
70
|
-
switch (blocker.type) {
|
|
71
|
-
case 'missing_outputs':
|
|
72
|
-
console.log(chalk.red(` • missing_outputs: ${blocker.items.join(', ')}`));
|
|
73
|
-
break;
|
|
74
|
-
case 'blocked_tasks':
|
|
75
|
-
console.log(chalk.red(` • blocked_tasks: ${blocker.items.join(', ')} (attempt ≥ 3, needs human review)`));
|
|
76
|
-
break;
|
|
77
|
-
case 'low_pass_rate':
|
|
78
|
-
console.log(chalk.red(` • low_pass_rate: ${(blocker.current * 100).toFixed(0)}% (required: ${(blocker.required * 100).toFixed(0)}%)`));
|
|
79
|
-
break;
|
|
80
|
-
case 'trust_too_low':
|
|
81
|
-
console.log(chalk.yellow(` • trust_too_low: ${blocker.items.join(', ')}`));
|
|
82
|
-
break;
|
|
83
|
-
default:
|
|
84
|
-
console.log(chalk.red(` • ${blocker.type}: ${(blocker.items || []).join(', ')}`));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
console.log();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Main command handler for `morph-spec phase run <feature>`.
|
|
94
|
-
*
|
|
95
|
-
* @param {string} featureName - Feature to run
|
|
96
|
-
* @param {Object} options
|
|
97
|
-
* @param {boolean} [options.dryRun] - Show decision tree without executing
|
|
98
|
-
* @param {number} [options.maxPhases] - Max phases to auto-advance (default: 6)
|
|
99
|
-
* @param {boolean} [options.skipApproval] - Skip approval gate checks
|
|
100
|
-
*/
|
|
101
|
-
export async function phaseRunCommand(featureName, options = {}) {
|
|
102
|
-
if (!featureName) {
|
|
103
|
-
console.error(chalk.red('Usage: morph-spec phase run <feature> [--dry-run] [--max-phases N]'));
|
|
104
|
-
process.exit(1);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const maxPhases = options.maxPhases ?? DEFAULT_MAX_PHASES;
|
|
108
|
-
const dryRun = options.dryRun ?? false;
|
|
109
|
-
|
|
110
|
-
// Load workflow config for phaseChain settings
|
|
111
|
-
const state = loadState(false);
|
|
112
|
-
const feature = state?.features?.[featureName];
|
|
113
|
-
let workflowConfig = null;
|
|
114
|
-
if (feature?.workflow && feature.workflow !== 'auto') {
|
|
115
|
-
try {
|
|
116
|
-
workflowConfig = getWorkflowConfig(feature.workflow);
|
|
117
|
-
} catch {
|
|
118
|
-
// Non-blocking
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Determine pause conditions from workflow
|
|
123
|
-
const pauseOnTypes = workflowConfig?.phaseChain?.pauseOn ?? PAUSE_TRIGGERS;
|
|
124
|
-
const autoChainMax = workflowConfig?.phaseChain?.maxAutoPhases ?? maxPhases;
|
|
125
|
-
|
|
126
|
-
if (!dryRun) {
|
|
127
|
-
console.log(chalk.cyan('\n╔════════════════════════════════════════════════╗'));
|
|
128
|
-
console.log(chalk.cyan('║ MORPH-SPEC PHASE CHAIN RUNNER ║'));
|
|
129
|
-
console.log(chalk.cyan('╚════════════════════════════════════════════════╝\n'));
|
|
130
|
-
console.log(chalk.gray('Feature:'), featureName);
|
|
131
|
-
console.log(chalk.gray('Max auto-phases:'), autoChainMax);
|
|
132
|
-
console.log();
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
let phasesAdvanced = 0;
|
|
136
|
-
|
|
137
|
-
while (phasesAdvanced < autoChainMax) {
|
|
138
|
-
// ── Check eligibility ──────────────────────────────────────────────────
|
|
139
|
-
const eligibility = checkPhaseEligibility(featureName, { projectPath: process.cwd() });
|
|
140
|
-
|
|
141
|
-
// Dry-run: just show the decision tree and exit
|
|
142
|
-
if (dryRun) {
|
|
143
|
-
renderDecisionTree(featureName, eligibility, workflowConfig, true);
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// Display current state
|
|
148
|
-
console.log(chalk.gray(`[${phasesAdvanced + 1}/${autoChainMax}] Checking phase: ${eligibility.currentPhase} → ${eligibility.nextPhase || '(final)'}`));
|
|
149
|
-
|
|
150
|
-
if (!eligibility.nextPhase) {
|
|
151
|
-
console.log(chalk.green('\n✓ Feature has reached the final phase!'));
|
|
152
|
-
console.log(chalk.gray(' Consider running: morph-spec generate recap ' + featureName));
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (!eligibility.eligible) {
|
|
157
|
-
// Check if any blocker type triggers a pause
|
|
158
|
-
const shouldPause = eligibility.blockers.some(b => pauseOnTypes.includes(b.type));
|
|
159
|
-
|
|
160
|
-
console.log(chalk.yellow(`\n⚠ Not eligible to advance (${eligibility.currentPhase} → ${eligibility.nextPhase})`));
|
|
161
|
-
for (const blocker of eligibility.blockers) {
|
|
162
|
-
switch (blocker.type) {
|
|
163
|
-
case 'missing_outputs':
|
|
164
|
-
console.log(chalk.gray(` • Missing outputs: ${blocker.items.join(', ')}`));
|
|
165
|
-
break;
|
|
166
|
-
case 'blocked_tasks':
|
|
167
|
-
console.log(chalk.red(` • Blocked tasks: ${blocker.items.join(', ')} — requires human review`));
|
|
168
|
-
break;
|
|
169
|
-
case 'low_pass_rate':
|
|
170
|
-
console.log(chalk.yellow(` • Low pass rate: ${(blocker.current * 100).toFixed(0)}% < ${(blocker.required * 100).toFixed(0)}% required`));
|
|
171
|
-
break;
|
|
172
|
-
case 'trust_too_low':
|
|
173
|
-
console.log(chalk.yellow(` • Trust too low: ${blocker.items.join(', ')}`));
|
|
174
|
-
break;
|
|
175
|
-
default:
|
|
176
|
-
console.log(chalk.gray(` • ${blocker.type}: ${(blocker.items || []).join(', ')}`));
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
if (shouldPause) {
|
|
181
|
-
console.log(chalk.red('\n⛔ Pausing phase chain — human intervention required'));
|
|
182
|
-
console.log(chalk.gray(' Fix the blockers above, then re-run: morph-spec phase run ' + featureName));
|
|
183
|
-
process.exit(1);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// Non-pause blocker (e.g. missing_optional_outputs) — still stop
|
|
187
|
-
console.log(chalk.yellow('\n Stopping chain — resolve blockers before continuing'));
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// ── Advance the phase ─────────────────────────────────────────────────
|
|
192
|
-
console.log(chalk.green(`\n✓ Eligible — advancing to ${eligibility.nextPhase}`));
|
|
193
|
-
|
|
194
|
-
try {
|
|
195
|
-
await advancePhaseCommand(featureName, {
|
|
196
|
-
skipOptional: false,
|
|
197
|
-
skipApproval: options.skipApproval,
|
|
198
|
-
});
|
|
199
|
-
phasesAdvanced++;
|
|
200
|
-
} catch (err) {
|
|
201
|
-
console.error(chalk.red(`\n✗ Phase advance failed: ${err.message}`));
|
|
202
|
-
console.log(chalk.gray(' Fix the issue and re-run: morph-spec phase run ' + featureName));
|
|
203
|
-
process.exit(1);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (phasesAdvanced >= autoChainMax) {
|
|
208
|
-
console.log(chalk.yellow(`\n⚠ Reached max auto-phases limit (${autoChainMax})`));
|
|
209
|
-
console.log(chalk.gray(' Use --max-phases N to increase the limit'));
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
if (phasesAdvanced > 0 && !dryRun) {
|
|
213
|
-
console.log(chalk.cyan(`\n ${phasesAdvanced} phase(s) advanced automatically`));
|
|
214
|
-
}
|
|
215
|
-
}
|
|
@@ -1,444 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MORPH-SPEC State Command
|
|
3
|
-
* CLI wrapper for state management operations
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { join } from 'path';
|
|
7
|
-
import { readFileSync, existsSync } from 'fs';
|
|
8
|
-
import ora from 'ora';
|
|
9
|
-
import chalk from 'chalk';
|
|
10
|
-
import { logger } from '../../utils/logger.js';
|
|
11
|
-
import * as StateManager from '../../core/state/state-manager.js';
|
|
12
|
-
import { derivePhase } from '../../core/state/state-manager.js';
|
|
13
|
-
|
|
14
|
-
// ============================================================================
|
|
15
|
-
// Phase Resolution
|
|
16
|
-
// ============================================================================
|
|
17
|
-
|
|
18
|
-
const PHASE_ORDER_LIST = ['proposal', 'uiux', 'design', 'plan', 'tasks', 'implement', 'sync', 'archived'];
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Resolve the effective phase: pick whichever is further ahead between the
|
|
22
|
-
* stored phase (set by `phase advance`) and the derived phase (from filesystem).
|
|
23
|
-
*/
|
|
24
|
-
function resolvePhase(storedPhase, derivedPhase) {
|
|
25
|
-
if (!storedPhase) return derivedPhase;
|
|
26
|
-
if (!derivedPhase) return storedPhase;
|
|
27
|
-
const storedIdx = PHASE_ORDER_LIST.indexOf(storedPhase);
|
|
28
|
-
const derivedIdx = PHASE_ORDER_LIST.indexOf(derivedPhase);
|
|
29
|
-
return storedIdx > derivedIdx ? storedPhase : derivedPhase;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// ============================================================================
|
|
33
|
-
// Phase Protection
|
|
34
|
-
// ============================================================================
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Phases that have approval gates and cannot be set directly via `state set`.
|
|
38
|
-
* These phases must be reached through `morph-spec phase advance` which enforces
|
|
39
|
-
* all validation gates (approval, output requirements, spec content, etc.).
|
|
40
|
-
*
|
|
41
|
-
* Lightweight phases (proposal, sync) are not in this list
|
|
42
|
-
* because they have no approval gates and are safe to set directly.
|
|
43
|
-
*/
|
|
44
|
-
export const PROTECTED_PHASES = ['design', 'tasks', 'uiux', 'implement'];
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Validate a direct phase-set request.
|
|
48
|
-
*
|
|
49
|
-
* @param {string} phase - The target phase value
|
|
50
|
-
* @returns {{ blocked: boolean, message?: string }}
|
|
51
|
-
*/
|
|
52
|
-
export function validatePhaseSet(phase) {
|
|
53
|
-
if (PROTECTED_PHASES.includes(phase)) {
|
|
54
|
-
return {
|
|
55
|
-
blocked: true,
|
|
56
|
-
message: `Phase "${phase}" has approval gates — use "morph-spec phase advance" instead of setting it directly.`
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
return { blocked: false };
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// ============================================================================
|
|
63
|
-
// Command Functions
|
|
64
|
-
// ============================================================================
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Main state command router
|
|
68
|
-
*/
|
|
69
|
-
export async function stateCommand(action, args, options) {
|
|
70
|
-
switch (action) {
|
|
71
|
-
case 'init':
|
|
72
|
-
await initCommand(options);
|
|
73
|
-
break;
|
|
74
|
-
|
|
75
|
-
case 'get':
|
|
76
|
-
await getCommand(args[0], options);
|
|
77
|
-
break;
|
|
78
|
-
|
|
79
|
-
case 'set':
|
|
80
|
-
await setCommand(args[0], args[1], args[2], options);
|
|
81
|
-
break;
|
|
82
|
-
|
|
83
|
-
case 'list':
|
|
84
|
-
await listCommand(options);
|
|
85
|
-
break;
|
|
86
|
-
|
|
87
|
-
case 'add-agent':
|
|
88
|
-
await addAgentCommand(args[0], args[1], options);
|
|
89
|
-
break;
|
|
90
|
-
|
|
91
|
-
case 'remove-agent':
|
|
92
|
-
await removeAgentCommand(args[0], args[1], options);
|
|
93
|
-
break;
|
|
94
|
-
|
|
95
|
-
case 'mark-output':
|
|
96
|
-
await markOutputCommand(args[0], args[1], options);
|
|
97
|
-
break;
|
|
98
|
-
|
|
99
|
-
default:
|
|
100
|
-
logger.error(`Unknown action: ${action}`);
|
|
101
|
-
logger.blank();
|
|
102
|
-
logger.info('Available actions:');
|
|
103
|
-
logger.dim(' init, get, set, list, add-agent, remove-agent, mark-output');
|
|
104
|
-
logger.blank();
|
|
105
|
-
logger.dim('Run "morph-spec state --help" for more information');
|
|
106
|
-
process.exit(1);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Initialize state file
|
|
112
|
-
*/
|
|
113
|
-
async function initCommand(options) {
|
|
114
|
-
logger.header('Initialize State');
|
|
115
|
-
logger.blank();
|
|
116
|
-
|
|
117
|
-
try {
|
|
118
|
-
if (StateManager.stateExists() && !options.force) {
|
|
119
|
-
logger.warn('State file already exists.');
|
|
120
|
-
logger.dim(' Use --force to overwrite');
|
|
121
|
-
logger.blank();
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const spinner = ora('Initializing state.json...').start();
|
|
126
|
-
|
|
127
|
-
// Read project name and stack from config.json if not provided via options
|
|
128
|
-
let projectName = options.project;
|
|
129
|
-
let projectType = options.type;
|
|
130
|
-
if (!projectName || !projectType) {
|
|
131
|
-
const configPath = join(process.cwd(), '.morph', 'config', 'config.json');
|
|
132
|
-
if (existsSync(configPath)) {
|
|
133
|
-
try {
|
|
134
|
-
const config = JSON.parse(readFileSync(configPath, 'utf8'));
|
|
135
|
-
projectName = projectName || config.project?.name || 'unknown';
|
|
136
|
-
projectType = projectType || config.project?.stack || 'unknown';
|
|
137
|
-
} catch {
|
|
138
|
-
projectName = projectName || 'unknown';
|
|
139
|
-
projectType = projectType || 'unknown';
|
|
140
|
-
}
|
|
141
|
-
} else {
|
|
142
|
-
projectName = projectName || 'unknown';
|
|
143
|
-
projectType = projectType || 'unknown';
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
StateManager.initState({
|
|
148
|
-
force: options.force,
|
|
149
|
-
projectName,
|
|
150
|
-
projectType
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
spinner.succeed('State initialized!');
|
|
154
|
-
logger.blank();
|
|
155
|
-
logger.dim(`Location: ${StateManager.getStatePath()}`);
|
|
156
|
-
logger.blank();
|
|
157
|
-
|
|
158
|
-
} catch (error) {
|
|
159
|
-
logger.error(error.message);
|
|
160
|
-
process.exit(1);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Get feature state
|
|
166
|
-
*/
|
|
167
|
-
async function getCommand(featureName, options) {
|
|
168
|
-
if (!featureName) {
|
|
169
|
-
logger.error('Feature name required');
|
|
170
|
-
logger.dim(' Usage: morph-spec state get <feature>');
|
|
171
|
-
process.exit(1);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
try {
|
|
175
|
-
const feature = StateManager.getFeature(featureName);
|
|
176
|
-
|
|
177
|
-
if (!feature) {
|
|
178
|
-
logger.error(`Feature '${featureName}' not found`);
|
|
179
|
-
process.exit(1);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (options.json) {
|
|
183
|
-
console.log(JSON.stringify(feature, null, 2));
|
|
184
|
-
} else {
|
|
185
|
-
logger.header(`Feature: ${featureName}`);
|
|
186
|
-
logger.blank();
|
|
187
|
-
const featurePath = join(process.cwd(), '.morph/features', featureName);
|
|
188
|
-
const derivedPhase = derivePhase(featurePath);
|
|
189
|
-
// Use stored phase when it's ahead of derived (directory may not exist yet)
|
|
190
|
-
const phase = resolvePhase(feature.phase, derivedPhase);
|
|
191
|
-
const tasks = feature.tasks || { completed: 0, total: 0 };
|
|
192
|
-
// Prefer taskList.length as total when tasks.total is stale/zero (Problem 3 complement)
|
|
193
|
-
const total = tasks.total || (Array.isArray(feature.taskList) ? feature.taskList.length : 0);
|
|
194
|
-
const taskDisplay = total > 0
|
|
195
|
-
? `${tasks.completed}/${total}`
|
|
196
|
-
: tasks.completed > 0 ? `${tasks.completed}/? (run task done to sync)` : '0/? (tasks not yet loaded)';
|
|
197
|
-
logger.info(`Status: ${chalk.cyan(feature.status || 'draft')}`);
|
|
198
|
-
logger.info(`Phase: ${chalk.cyan(phase)}`);
|
|
199
|
-
logger.info(`Tasks: ${chalk.cyan(taskDisplay)}`);
|
|
200
|
-
logger.info(`Agents: ${chalk.cyan((feature.activeAgents || []).join(', ') || 'None')}`);
|
|
201
|
-
const outputs = Object.keys(feature.outputs || {}).filter(k => feature.outputs[k]?.created);
|
|
202
|
-
if (outputs.length > 0) {
|
|
203
|
-
logger.info(`Outputs: ${chalk.cyan(outputs.join(', '))}`);
|
|
204
|
-
}
|
|
205
|
-
logger.blank();
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
} catch (error) {
|
|
209
|
-
logger.error(error.message);
|
|
210
|
-
process.exit(1);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Set feature property
|
|
216
|
-
*/
|
|
217
|
-
async function setCommand(featureName, key, value, options) {
|
|
218
|
-
if (!featureName || !key || value === undefined) {
|
|
219
|
-
logger.error('Missing required arguments');
|
|
220
|
-
logger.dim(' Usage: morph-spec state set <feature> <key> <value>');
|
|
221
|
-
logger.blank();
|
|
222
|
-
logger.dim(' Example: morph-spec state set my-feature phase implement');
|
|
223
|
-
process.exit(1);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
try {
|
|
227
|
-
// Guard: block protected phases unless --force is explicitly passed
|
|
228
|
-
if (key === 'phase') {
|
|
229
|
-
const phaseValidation = validatePhaseSet(value);
|
|
230
|
-
if (phaseValidation.blocked && !options.force) {
|
|
231
|
-
logger.error(phaseValidation.message);
|
|
232
|
-
logger.blank();
|
|
233
|
-
logger.dim(` Protected phases (have approval gates): ${PROTECTED_PHASES.join(', ')}`);
|
|
234
|
-
logger.dim(` Use the validated advance flow instead:`);
|
|
235
|
-
logger.dim(` morph-spec phase advance ${featureName}`);
|
|
236
|
-
logger.blank();
|
|
237
|
-
logger.dim(` To bypass all gates (expert use only):`);
|
|
238
|
-
logger.dim(` morph-spec state set ${featureName} phase ${value} --force`);
|
|
239
|
-
process.exit(1);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (phaseValidation.blocked) {
|
|
243
|
-
logger.warn(`FORCED phase override to "${value}" — all approval gates bypassed.`);
|
|
244
|
-
} else {
|
|
245
|
-
logger.warn(`Direct phase override — validation gates may be bypassed.`);
|
|
246
|
-
logger.dim(` The actual phase is derived from filesystem subdirectories`);
|
|
247
|
-
logger.dim(` (0-proposal/, 2-design/, 4-tasks/, 5-implement/). This sets a state.json`);
|
|
248
|
-
logger.dim(` override used only for lightweight phases (proposal, sync).`);
|
|
249
|
-
logger.dim(` Recommended: morph-spec phase advance ${featureName}`);
|
|
250
|
-
}
|
|
251
|
-
logger.blank();
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// Validate workflow values
|
|
255
|
-
if (key === 'workflow') {
|
|
256
|
-
try {
|
|
257
|
-
const { listWorkflows } = await import('../../core/workflows/workflow-detector.js');
|
|
258
|
-
const validIds = listWorkflows().map(w => w.id).concat(['auto']);
|
|
259
|
-
if (!validIds.includes(value)) {
|
|
260
|
-
logger.error(`Invalid workflow: "${value}"`);
|
|
261
|
-
logger.dim(` Valid workflows: ${validIds.join(', ')}`);
|
|
262
|
-
logger.blank();
|
|
263
|
-
process.exit(1);
|
|
264
|
-
}
|
|
265
|
-
} catch {
|
|
266
|
-
// Workflow detector unavailable — skip validation
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
const spinner = ora('Updating state...').start();
|
|
271
|
-
|
|
272
|
-
// Parse value automatically (JSON, number, boolean)
|
|
273
|
-
let parsedValue = value;
|
|
274
|
-
try {
|
|
275
|
-
parsedValue = JSON.parse(value);
|
|
276
|
-
} catch {
|
|
277
|
-
// Keep as string if not valid JSON
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
StateManager.updateFeature(featureName, key, parsedValue);
|
|
281
|
-
|
|
282
|
-
spinner.succeed(`Updated ${chalk.cyan(featureName)}.${chalk.cyan(key)}`);
|
|
283
|
-
logger.blank();
|
|
284
|
-
logger.dim(`Value: ${JSON.stringify(parsedValue)}`);
|
|
285
|
-
logger.blank();
|
|
286
|
-
|
|
287
|
-
} catch (error) {
|
|
288
|
-
logger.error(error.message);
|
|
289
|
-
process.exit(1);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* List all features
|
|
295
|
-
*/
|
|
296
|
-
async function listCommand(options) {
|
|
297
|
-
logger.header('MORPH-SPEC Project Status');
|
|
298
|
-
logger.blank();
|
|
299
|
-
|
|
300
|
-
try {
|
|
301
|
-
const summary = StateManager.getSummary();
|
|
302
|
-
const features = StateManager.listFeatures();
|
|
303
|
-
|
|
304
|
-
// Project info
|
|
305
|
-
const projectName = summary.project?.name || '(unnamed)';
|
|
306
|
-
const projectType = summary.project?.type || '(unknown)';
|
|
307
|
-
logger.info(`Project: ${chalk.cyan(projectName)}`);
|
|
308
|
-
logger.info(`Type: ${chalk.cyan(projectType)}`);
|
|
309
|
-
logger.blank();
|
|
310
|
-
|
|
311
|
-
if (features.length === 0) {
|
|
312
|
-
logger.warn('No features found');
|
|
313
|
-
logger.blank();
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
// Features table
|
|
318
|
-
logger.header('Features:');
|
|
319
|
-
logger.blank();
|
|
320
|
-
|
|
321
|
-
features.forEach(([name, feature]) => {
|
|
322
|
-
const statusEmoji = {
|
|
323
|
-
draft: '📝',
|
|
324
|
-
in_review: '👀',
|
|
325
|
-
approved: '✅',
|
|
326
|
-
in_progress: '🚧',
|
|
327
|
-
done: '✔️',
|
|
328
|
-
archived: '📦'
|
|
329
|
-
}[feature.status] || '❓';
|
|
330
|
-
|
|
331
|
-
const tasks = feature.tasks || {};
|
|
332
|
-
const total = tasks.total || (Array.isArray(feature.taskList) ? feature.taskList.length : 0);
|
|
333
|
-
const progress = total > 0
|
|
334
|
-
? `${tasks.completed || 0}/${total}`
|
|
335
|
-
: '-';
|
|
336
|
-
|
|
337
|
-
logger.info(`${statusEmoji} ${chalk.bold(name)}`);
|
|
338
|
-
const featurePath = join(process.cwd(), '.morph/features', name);
|
|
339
|
-
const featurePhase = resolvePhase(feature.phase, derivePhase(featurePath));
|
|
340
|
-
logger.dim(` Phase: ${featurePhase.padEnd(16)} │ Tasks: ${progress}`);
|
|
341
|
-
logger.dim(` Agents: ${(feature.activeAgents || []).slice(0, 5).join(', ') || 'None'}`);
|
|
342
|
-
logger.blank();
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
// Summary
|
|
346
|
-
logger.header('Summary:');
|
|
347
|
-
logger.info(`Total Features: ${chalk.cyan(summary.metadata?.totalFeatures ?? features.length)}`);
|
|
348
|
-
logger.info(`Completed: ${chalk.cyan(summary.metadata?.completedFeatures ?? 0)}`);
|
|
349
|
-
logger.blank();
|
|
350
|
-
|
|
351
|
-
} catch (error) {
|
|
352
|
-
logger.error(error.message);
|
|
353
|
-
process.exit(1);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* Add agent to feature
|
|
359
|
-
*/
|
|
360
|
-
async function addAgentCommand(featureName, agentId, options) {
|
|
361
|
-
if (!featureName || !agentId) {
|
|
362
|
-
logger.error('Missing required arguments');
|
|
363
|
-
logger.dim(' Usage: morph-spec state add-agent <feature> <agent-id>');
|
|
364
|
-
process.exit(1);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
try {
|
|
368
|
-
const added = StateManager.addAgent(featureName, agentId);
|
|
369
|
-
|
|
370
|
-
if (added) {
|
|
371
|
-
logger.success(`Agent '${chalk.cyan(agentId)}' added to ${chalk.cyan(featureName)}`);
|
|
372
|
-
} else {
|
|
373
|
-
logger.warn(`Agent '${agentId}' already active`);
|
|
374
|
-
}
|
|
375
|
-
logger.blank();
|
|
376
|
-
|
|
377
|
-
} catch (error) {
|
|
378
|
-
logger.error(error.message);
|
|
379
|
-
process.exit(1);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
/**
|
|
384
|
-
* Remove agent from feature
|
|
385
|
-
*/
|
|
386
|
-
async function removeAgentCommand(featureName, agentId, options) {
|
|
387
|
-
if (!featureName || !agentId) {
|
|
388
|
-
logger.error('Missing required arguments');
|
|
389
|
-
logger.dim(' Usage: morph-spec state remove-agent <feature> <agent-id>');
|
|
390
|
-
process.exit(1);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
try {
|
|
394
|
-
const removed = StateManager.removeAgent(featureName, agentId);
|
|
395
|
-
|
|
396
|
-
if (removed) {
|
|
397
|
-
logger.success(`Agent '${chalk.cyan(agentId)}' removed from ${chalk.cyan(featureName)}`);
|
|
398
|
-
} else {
|
|
399
|
-
logger.warn(`Agent '${agentId}' not found`);
|
|
400
|
-
}
|
|
401
|
-
logger.blank();
|
|
402
|
-
|
|
403
|
-
} catch (error) {
|
|
404
|
-
logger.error(error.message);
|
|
405
|
-
process.exit(1);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Mark output as created
|
|
411
|
-
*/
|
|
412
|
-
async function markOutputCommand(featureName, outputType, options) {
|
|
413
|
-
if (!featureName || !outputType) {
|
|
414
|
-
logger.error('Missing required arguments');
|
|
415
|
-
logger.dim(' Usage: morph-spec state mark-output <feature> <output-type>');
|
|
416
|
-
logger.blank();
|
|
417
|
-
logger.dim(' Valid types:');
|
|
418
|
-
logger.dim(' Proposal: proposal');
|
|
419
|
-
logger.dim(' Design: schemaAnalysis, spec, contracts, contractsVsa, decisions');
|
|
420
|
-
logger.dim(' Tasks: tasks');
|
|
421
|
-
logger.dim(' UI/UX: uiDesignSystem, uiMockups, uiComponents, uiFlows');
|
|
422
|
-
logger.dim(' Implement: recap');
|
|
423
|
-
logger.blank();
|
|
424
|
-
logger.dim(' Note: kebab-case aliases accepted (e.g., ui-design-system, schema-analysis)');
|
|
425
|
-
logger.blank();
|
|
426
|
-
logger.dim(' Examples:');
|
|
427
|
-
logger.dim(' morph-spec state mark-output my-feature spec');
|
|
428
|
-
logger.dim(' morph-spec state mark-output my-feature schemaAnalysis');
|
|
429
|
-
logger.dim(' morph-spec state mark-output my-feature uiDesignSystem');
|
|
430
|
-
logger.dim(' morph-spec state mark-output my-feature ui-design-system');
|
|
431
|
-
process.exit(1);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
try {
|
|
435
|
-
StateManager.markOutput(featureName, outputType);
|
|
436
|
-
|
|
437
|
-
logger.success(`Output '${chalk.cyan(outputType)}' marked as created for ${chalk.cyan(featureName)}`);
|
|
438
|
-
logger.blank();
|
|
439
|
-
|
|
440
|
-
} catch (error) {
|
|
441
|
-
logger.error(error.message);
|
|
442
|
-
process.exit(1);
|
|
443
|
-
}
|
|
444
|
-
}
|