@polymorphism-tech/morph-spec 1.0.4 → 2.0.0
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 +1381 -0
- package/LICENSE +72 -0
- package/README.md +89 -6
- package/bin/detect-agents.js +225 -0
- package/bin/morph-spec.js +120 -0
- package/bin/render-template.js +302 -0
- package/bin/semantic-detect-agents.js +246 -0
- package/bin/validate-agents-skills.js +239 -0
- package/bin/validate-agents.js +69 -0
- package/bin/validate-phase.js +263 -0
- package/content/.azure/README.md +293 -0
- package/content/.azure/docs/azure-devops-setup.md +454 -0
- package/content/.azure/docs/branch-strategy.md +398 -0
- package/content/.azure/docs/local-development.md +515 -0
- package/content/.azure/pipelines/pipeline-variables.yml +34 -0
- package/content/.azure/pipelines/prod-pipeline.yml +319 -0
- package/content/.azure/pipelines/staging-pipeline.yml +234 -0
- package/content/.azure/pipelines/templates/build-dotnet.yml +75 -0
- package/content/.azure/pipelines/templates/deploy-app-service.yml +94 -0
- package/content/.azure/pipelines/templates/deploy-container-app.yml +120 -0
- package/content/.azure/pipelines/templates/infra-deploy.yml +90 -0
- package/content/.claude/commands/morph-apply.md +118 -26
- package/content/.claude/commands/morph-archive.md +9 -9
- package/content/.claude/commands/morph-clarify.md +184 -0
- package/content/.claude/commands/morph-design.md +275 -0
- package/content/.claude/commands/morph-proposal.md +56 -15
- package/content/.claude/commands/morph-setup.md +100 -0
- package/content/.claude/commands/morph-status.md +47 -32
- package/content/.claude/commands/morph-tasks.md +319 -0
- package/content/.claude/commands/morph-uiux.md +211 -0
- package/content/.claude/skills/specialists/ai-system-architect.md +604 -0
- package/content/.claude/skills/specialists/ms-agent-expert.md +143 -89
- package/content/.claude/skills/specialists/ui-ux-designer.md +744 -9
- package/content/.claude/skills/stacks/dotnet-blazor.md +244 -8
- package/content/.claude/skills/stacks/dotnet-nextjs.md +2 -2
- package/content/.morph/.morphversion +5 -0
- package/content/.morph/config/agents.json +101 -8
- package/content/.morph/config/azure-pricing.json +70 -0
- package/content/.morph/config/azure-pricing.schema.json +50 -0
- package/content/.morph/config/config.template.json +15 -3
- package/content/.morph/docs/STORY-DRIVEN-DEVELOPMENT.md +392 -0
- package/content/.morph/hooks/README.md +239 -0
- package/content/.morph/hooks/pre-commit-agents.sh +24 -0
- package/content/.morph/hooks/pre-commit-all.sh +48 -0
- package/content/.morph/hooks/pre-commit-costs.sh +91 -0
- package/content/.morph/hooks/pre-commit-specs.sh +49 -0
- package/content/.morph/hooks/pre-commit-tests.sh +60 -0
- package/content/.morph/project.md +5 -4
- package/content/.morph/schemas/agent.schema.json +296 -0
- package/content/.morph/standards/agent-framework-setup.md +453 -0
- package/content/.morph/standards/architecture.md +142 -7
- package/content/.morph/standards/azure.md +218 -23
- package/content/.morph/standards/coding.md +47 -12
- package/content/.morph/standards/dotnet10-migration.md +494 -0
- package/content/.morph/standards/fluent-ui-setup.md +590 -0
- package/content/.morph/standards/migration-guide.md +514 -0
- package/content/.morph/standards/passkeys-auth.md +423 -0
- package/content/.morph/standards/vector-search-rag.md +536 -0
- package/content/.morph/state.json +18 -0
- package/content/.morph/templates/FluentDesignTheme.cs +149 -0
- package/content/.morph/templates/MudTheme.cs +281 -0
- package/content/.morph/templates/contracts.cs +55 -55
- package/content/.morph/templates/decisions.md +4 -4
- package/content/.morph/templates/design-system.css +226 -0
- package/content/.morph/templates/infra/.dockerignore.example +89 -0
- package/content/.morph/templates/infra/Dockerfile.example +82 -0
- package/content/.morph/templates/infra/README.md +286 -0
- package/content/.morph/templates/infra/app-service.bicep +164 -0
- package/content/.morph/templates/infra/deploy.ps1 +229 -0
- package/content/.morph/templates/infra/deploy.sh +208 -0
- package/content/.morph/templates/infra/main.bicep +41 -7
- package/content/.morph/templates/infra/parameters.dev.json +6 -0
- package/content/.morph/templates/infra/parameters.prod.json +6 -0
- package/content/.morph/templates/infra/parameters.staging.json +29 -0
- package/content/.morph/templates/proposal.md +3 -3
- package/content/.morph/templates/recap.md +3 -3
- package/content/.morph/templates/spec.md +9 -8
- package/content/.morph/templates/sprint-status.yaml +68 -0
- package/content/.morph/templates/state.template.json +222 -0
- package/content/.morph/templates/story.md +143 -0
- package/content/.morph/templates/tasks.md +1 -1
- package/content/.morph/templates/ui-components.md +276 -0
- package/content/.morph/templates/ui-design-system.md +286 -0
- package/content/.morph/templates/ui-flows.md +336 -0
- package/content/.morph/templates/ui-mockups.md +133 -0
- package/content/.morph/test-infra/example.bicep +59 -0
- package/content/CLAUDE.md +124 -0
- package/content/README.md +79 -0
- package/detectors/config-detector.js +223 -0
- package/detectors/conversation-analyzer.js +163 -0
- package/detectors/index.js +84 -0
- package/detectors/standards-generator.js +275 -0
- package/detectors/structure-detector.js +221 -0
- package/docs/README.md +149 -0
- package/docs/api/cost-calculator.js.html +513 -0
- package/docs/api/design-system-generator.js.html +382 -0
- package/docs/api/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/api/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/api/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/api/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/api/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/api/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/api/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/api/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/api/global.html +5263 -0
- package/docs/api/index.html +96 -0
- package/docs/api/scripts/collapse.js +39 -0
- package/docs/api/scripts/commonNav.js +28 -0
- package/docs/api/scripts/linenumber.js +25 -0
- package/docs/api/scripts/nav.js +12 -0
- package/docs/api/scripts/polyfill.js +4 -0
- package/docs/api/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/docs/api/scripts/prettify/lang-css.js +2 -0
- package/docs/api/scripts/prettify/prettify.js +28 -0
- package/docs/api/scripts/search.js +99 -0
- package/docs/api/state-manager.js.html +423 -0
- package/docs/api/styles/jsdoc.css +776 -0
- package/docs/api/styles/prettify.css +80 -0
- package/docs/examples.md +328 -0
- package/docs/getting-started.md +302 -0
- package/docs/installation.md +361 -0
- package/docs/templates.md +418 -0
- package/docs/validation-checklist.md +266 -0
- package/package.json +39 -12
- package/src/commands/cost.js +181 -0
- package/src/commands/create-story.js +283 -0
- package/src/commands/detect.js +104 -0
- package/src/commands/doctor.js +67 -0
- package/src/commands/generate.js +149 -0
- package/src/commands/init.js +69 -45
- package/src/commands/shard-spec.js +224 -0
- package/src/commands/sprint-status.js +250 -0
- package/src/commands/state.js +333 -0
- package/src/commands/sync.js +167 -0
- package/src/commands/update-pricing.js +206 -0
- package/src/commands/update.js +88 -13
- package/src/lib/complexity-analyzer.js +292 -0
- package/src/lib/cost-calculator.js +429 -0
- package/src/lib/design-system-generator.js +298 -0
- package/src/lib/state-manager.js +340 -0
- package/src/utils/file-copier.js +59 -0
- package/src/utils/version-checker.js +175 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MORPH-SPEC Sprint Status Manager
|
|
3
|
+
* Updates sprint-status.yaml and shows next story
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import yaml from 'yaml';
|
|
9
|
+
import ora from 'ora';
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
import { logger } from '../utils/logger.js';
|
|
12
|
+
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Helper Functions
|
|
15
|
+
// ============================================================================
|
|
16
|
+
|
|
17
|
+
function loadSprintStatus(featureName) {
|
|
18
|
+
const statusPath = path.join(process.cwd(), `.morph/project/outputs/${featureName}/sprint-status.yaml`);
|
|
19
|
+
|
|
20
|
+
if (!fs.existsSync(statusPath)) {
|
|
21
|
+
throw new Error(`Sprint status not found: ${statusPath}\n\n💡 Create a sprint status file first:\n morph-spec story create ${featureName} STORY-001`);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const content = fs.readFileSync(statusPath, 'utf-8');
|
|
25
|
+
return { path: statusPath, data: yaml.parse(content) };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function saveSprintStatus(statusPath, data) {
|
|
29
|
+
const content = yaml.stringify(data);
|
|
30
|
+
fs.writeFileSync(statusPath, content);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function updateMetrics(sprint) {
|
|
34
|
+
const stories = sprint.stories || [];
|
|
35
|
+
const metrics = {
|
|
36
|
+
total_stories: stories.length,
|
|
37
|
+
ready: stories.filter(s => s.status === 'ready').length,
|
|
38
|
+
in_progress: stories.filter(s => s.status === 'in_progress').length,
|
|
39
|
+
ready_for_qa: stories.filter(s => s.status === 'ready_for_qa').length,
|
|
40
|
+
done: stories.filter(s => s.status === 'done').length,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
metrics.completion_percent = stories.length > 0
|
|
44
|
+
? Math.round((metrics.done / stories.length) * 100)
|
|
45
|
+
: 0;
|
|
46
|
+
|
|
47
|
+
sprint.metrics = metrics;
|
|
48
|
+
sprint.updated = new Date().toISOString().split('T')[0];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function findStory(sprint, storyId) {
|
|
52
|
+
return sprint.stories.find(s => s.id === storyId);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function getNextStory(sprint) {
|
|
56
|
+
// Find first story that is "ready" (not in_progress or done)
|
|
57
|
+
return sprint.stories.find(s => s.status === 'ready' || s.status === 'pending');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function displayStatus(sprint) {
|
|
61
|
+
logger.header(`Sprint Status: ${sprint.feature}`);
|
|
62
|
+
logger.blank();
|
|
63
|
+
logger.info(`Epic: ${chalk.cyan(sprint.epic)}`);
|
|
64
|
+
logger.info(`Progress: ${chalk.green(`${sprint.metrics.completion_percent}%`)} (${sprint.metrics.done}/${sprint.metrics.total_stories} stories done)`);
|
|
65
|
+
logger.blank();
|
|
66
|
+
|
|
67
|
+
logger.header('Stories:');
|
|
68
|
+
sprint.stories.forEach(story => {
|
|
69
|
+
const statusEmoji = {
|
|
70
|
+
pending: '⏸️ ',
|
|
71
|
+
ready: '✅',
|
|
72
|
+
in_progress: '🔄',
|
|
73
|
+
ready_for_qa: '👀',
|
|
74
|
+
done: '✔️ ',
|
|
75
|
+
}[story.status] || '❓';
|
|
76
|
+
|
|
77
|
+
const statusColor = {
|
|
78
|
+
pending: chalk.dim,
|
|
79
|
+
ready: chalk.cyan,
|
|
80
|
+
in_progress: chalk.yellow,
|
|
81
|
+
ready_for_qa: chalk.magenta,
|
|
82
|
+
done: chalk.green,
|
|
83
|
+
}[story.status] || chalk.white;
|
|
84
|
+
|
|
85
|
+
logger.dim(` ${statusEmoji} ${story.id}: ${story.title} ${statusColor(`(${story.status})`)}`);
|
|
86
|
+
});
|
|
87
|
+
logger.blank();
|
|
88
|
+
|
|
89
|
+
if (sprint.current && sprint.current.story_id) {
|
|
90
|
+
logger.info(`🎯 Current Focus: ${chalk.cyan(sprint.current.story_id)} (${sprint.current.agent} agent)`);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (sprint.next && sprint.next.story_id) {
|
|
94
|
+
logger.info(`📋 Next Story: ${chalk.cyan(sprint.next.story_id)}`);
|
|
95
|
+
logger.dim(` ${sprint.next.recommendation || 'Ready for development'}`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
logger.blank();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ============================================================================
|
|
102
|
+
// Command Function
|
|
103
|
+
// ============================================================================
|
|
104
|
+
|
|
105
|
+
export async function sprintStatusCommand(feature, action, storyId, options) {
|
|
106
|
+
// Default action is 'show'
|
|
107
|
+
const cmd = action || 'show';
|
|
108
|
+
|
|
109
|
+
if (cmd === 'help' || options.help) {
|
|
110
|
+
logger.header('MORPH-SPEC Sprint Status Manager');
|
|
111
|
+
logger.blank();
|
|
112
|
+
logger.info('Usage:');
|
|
113
|
+
logger.dim(' morph-spec story status <feature> [command] [story-id]');
|
|
114
|
+
logger.blank();
|
|
115
|
+
logger.info('Commands:');
|
|
116
|
+
logger.dim(' show Display current sprint status (default)');
|
|
117
|
+
logger.dim(' start <story-id> Mark story as in_progress');
|
|
118
|
+
logger.dim(' qa <story-id> Mark story as ready_for_qa');
|
|
119
|
+
logger.dim(' done <story-id> Mark story as done');
|
|
120
|
+
logger.dim(' next Show next story to work on');
|
|
121
|
+
logger.blank();
|
|
122
|
+
logger.info('Examples:');
|
|
123
|
+
logger.dim(' morph-spec story status scheduled-reports show');
|
|
124
|
+
logger.dim(' morph-spec story status scheduled-reports start SR-001');
|
|
125
|
+
logger.dim(' morph-spec story status scheduled-reports qa SR-001');
|
|
126
|
+
logger.dim(' morph-spec story status scheduled-reports done SR-001');
|
|
127
|
+
logger.dim(' morph-spec story status scheduled-reports next');
|
|
128
|
+
logger.blank();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
try {
|
|
133
|
+
// Load sprint status
|
|
134
|
+
const { path: statusPath, data: sprint } = loadSprintStatus(feature);
|
|
135
|
+
|
|
136
|
+
// Execute command
|
|
137
|
+
switch (cmd) {
|
|
138
|
+
case 'show':
|
|
139
|
+
displayStatus(sprint);
|
|
140
|
+
break;
|
|
141
|
+
|
|
142
|
+
case 'start':
|
|
143
|
+
if (!storyId) {
|
|
144
|
+
throw new Error('Story ID required for "start" command');
|
|
145
|
+
}
|
|
146
|
+
const storyToStart = findStory(sprint, storyId);
|
|
147
|
+
if (!storyToStart) {
|
|
148
|
+
throw new Error(`Story not found: ${storyId}`);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const spinner = ora('Updating story status...').start();
|
|
152
|
+
storyToStart.status = 'in_progress';
|
|
153
|
+
storyToStart.started = new Date().toISOString().split('T')[0];
|
|
154
|
+
storyToStart.assigned = 'dev';
|
|
155
|
+
sprint.current = { story_id: storyId, agent: 'dev', phase: 'implementation' };
|
|
156
|
+
updateMetrics(sprint);
|
|
157
|
+
saveSprintStatus(statusPath, sprint);
|
|
158
|
+
spinner.succeed(`Story ${chalk.cyan(storyId)} marked as IN PROGRESS`);
|
|
159
|
+
logger.blank();
|
|
160
|
+
logger.info('💡 Recommendation: Run this story in a FRESH Claude session');
|
|
161
|
+
logger.dim(' /dev → Implement story → Add Dev Notes');
|
|
162
|
+
logger.blank();
|
|
163
|
+
break;
|
|
164
|
+
|
|
165
|
+
case 'qa':
|
|
166
|
+
if (!storyId) {
|
|
167
|
+
throw new Error('Story ID required for "qa" command');
|
|
168
|
+
}
|
|
169
|
+
const storyForQA = findStory(sprint, storyId);
|
|
170
|
+
if (!storyForQA) {
|
|
171
|
+
throw new Error(`Story not found: ${storyId}`);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const qaSpinner = ora('Updating story status...').start();
|
|
175
|
+
storyForQA.status = 'ready_for_qa';
|
|
176
|
+
storyForQA.assigned = 'qa';
|
|
177
|
+
sprint.current = { story_id: storyId, agent: 'qa', phase: 'review' };
|
|
178
|
+
updateMetrics(sprint);
|
|
179
|
+
saveSprintStatus(statusPath, sprint);
|
|
180
|
+
qaSpinner.succeed(`Story ${chalk.cyan(storyId)} marked as READY FOR QA`);
|
|
181
|
+
logger.blank();
|
|
182
|
+
logger.info('💡 Recommendation: QA in a FRESH Claude session');
|
|
183
|
+
logger.dim(' /qa → Review code → Add QA Notes');
|
|
184
|
+
logger.blank();
|
|
185
|
+
break;
|
|
186
|
+
|
|
187
|
+
case 'done':
|
|
188
|
+
if (!storyId) {
|
|
189
|
+
throw new Error('Story ID required for "done" command');
|
|
190
|
+
}
|
|
191
|
+
const storyDone = findStory(sprint, storyId);
|
|
192
|
+
if (!storyDone) {
|
|
193
|
+
throw new Error(`Story not found: ${storyId}`);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const doneSpinner = ora('Updating story status...').start();
|
|
197
|
+
storyDone.status = 'done';
|
|
198
|
+
storyDone.completed = new Date().toISOString().split('T')[0];
|
|
199
|
+
updateMetrics(sprint);
|
|
200
|
+
|
|
201
|
+
// Update next story
|
|
202
|
+
const nextStory = getNextStory(sprint);
|
|
203
|
+
if (nextStory) {
|
|
204
|
+
sprint.next = {
|
|
205
|
+
story_id: nextStory.id,
|
|
206
|
+
recommendation: `Story ${nextStory.id} is ready for development`,
|
|
207
|
+
};
|
|
208
|
+
} else {
|
|
209
|
+
sprint.next = null;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
saveSprintStatus(statusPath, sprint);
|
|
213
|
+
doneSpinner.succeed(`Story ${chalk.cyan(storyId)} marked as DONE`);
|
|
214
|
+
logger.blank();
|
|
215
|
+
|
|
216
|
+
if (nextStory) {
|
|
217
|
+
logger.info(`📋 Next Story: ${chalk.cyan(nextStory.id)}`);
|
|
218
|
+
logger.dim(` ${nextStory.title}`);
|
|
219
|
+
logger.blank();
|
|
220
|
+
} else {
|
|
221
|
+
logger.success('🎉 All stories completed! Feature ready for final review.');
|
|
222
|
+
logger.blank();
|
|
223
|
+
}
|
|
224
|
+
break;
|
|
225
|
+
|
|
226
|
+
case 'next':
|
|
227
|
+
const next = getNextStory(sprint);
|
|
228
|
+
if (next) {
|
|
229
|
+
logger.header('Next Story:');
|
|
230
|
+
logger.blank();
|
|
231
|
+
logger.info(`📋 Story ID: ${chalk.cyan(next.id)}`);
|
|
232
|
+
logger.info(` Title: ${next.title}`);
|
|
233
|
+
logger.info(` File: ${chalk.dim(next.file)}`);
|
|
234
|
+
logger.info(` Status: ${next.status}`);
|
|
235
|
+
logger.blank();
|
|
236
|
+
} else {
|
|
237
|
+
logger.success('🎉 No pending stories! Sprint complete.');
|
|
238
|
+
logger.blank();
|
|
239
|
+
}
|
|
240
|
+
break;
|
|
241
|
+
|
|
242
|
+
default:
|
|
243
|
+
throw new Error(`Unknown command: ${cmd}\n Use --help to see available commands`);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
} catch (error) {
|
|
247
|
+
logger.error(error.message);
|
|
248
|
+
process.exit(1);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MORPH-SPEC State Command
|
|
3
|
+
* CLI wrapper for state management operations
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import ora from 'ora';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import { logger } from '../utils/logger.js';
|
|
9
|
+
import * as StateManager from '../lib/state-manager.js';
|
|
10
|
+
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// Command Functions
|
|
13
|
+
// ============================================================================
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Main state command router
|
|
17
|
+
*/
|
|
18
|
+
export async function stateCommand(action, args, options) {
|
|
19
|
+
switch (action) {
|
|
20
|
+
case 'init':
|
|
21
|
+
await initCommand(options);
|
|
22
|
+
break;
|
|
23
|
+
|
|
24
|
+
case 'get':
|
|
25
|
+
await getCommand(args[0], options);
|
|
26
|
+
break;
|
|
27
|
+
|
|
28
|
+
case 'set':
|
|
29
|
+
await setCommand(args[0], args[1], args[2], options);
|
|
30
|
+
break;
|
|
31
|
+
|
|
32
|
+
case 'checkpoint':
|
|
33
|
+
await checkpointCommand(args[0], args.slice(1).join(' '), options);
|
|
34
|
+
break;
|
|
35
|
+
|
|
36
|
+
case 'list':
|
|
37
|
+
await listCommand(options);
|
|
38
|
+
break;
|
|
39
|
+
|
|
40
|
+
case 'add-agent':
|
|
41
|
+
await addAgentCommand(args[0], args[1], options);
|
|
42
|
+
break;
|
|
43
|
+
|
|
44
|
+
case 'remove-agent':
|
|
45
|
+
await removeAgentCommand(args[0], args[1], options);
|
|
46
|
+
break;
|
|
47
|
+
|
|
48
|
+
case 'mark-output':
|
|
49
|
+
await markOutputCommand(args[0], args[1], options);
|
|
50
|
+
break;
|
|
51
|
+
|
|
52
|
+
default:
|
|
53
|
+
logger.error(`Unknown action: ${action}`);
|
|
54
|
+
logger.blank();
|
|
55
|
+
logger.info('Available actions:');
|
|
56
|
+
logger.dim(' init, get, set, checkpoint, list, add-agent, remove-agent, mark-output');
|
|
57
|
+
logger.blank();
|
|
58
|
+
logger.dim('Run "morph-spec state --help" for more information');
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Initialize state file
|
|
65
|
+
*/
|
|
66
|
+
async function initCommand(options) {
|
|
67
|
+
logger.header('Initialize State');
|
|
68
|
+
logger.blank();
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
if (StateManager.stateExists() && !options.force) {
|
|
72
|
+
logger.warn('State file already exists.');
|
|
73
|
+
logger.dim(' Use --force to overwrite');
|
|
74
|
+
logger.blank();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const spinner = ora('Initializing state.json...').start();
|
|
79
|
+
|
|
80
|
+
StateManager.initState({
|
|
81
|
+
force: options.force,
|
|
82
|
+
projectName: options.project || '{PROJECT_NAME}',
|
|
83
|
+
projectType: options.type || 'blazor-server'
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
spinner.succeed('State initialized!');
|
|
87
|
+
logger.blank();
|
|
88
|
+
logger.dim(`Location: ${StateManager.getStatePath()}`);
|
|
89
|
+
logger.blank();
|
|
90
|
+
|
|
91
|
+
} catch (error) {
|
|
92
|
+
logger.error(error.message);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get feature state
|
|
99
|
+
*/
|
|
100
|
+
async function getCommand(featureName, options) {
|
|
101
|
+
if (!featureName) {
|
|
102
|
+
logger.error('Feature name required');
|
|
103
|
+
logger.dim(' Usage: morph-spec state get <feature>');
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
const feature = StateManager.getFeature(featureName);
|
|
109
|
+
|
|
110
|
+
if (!feature) {
|
|
111
|
+
logger.error(`Feature '${featureName}' not found`);
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (options.json) {
|
|
116
|
+
console.log(JSON.stringify(feature, null, 2));
|
|
117
|
+
} else {
|
|
118
|
+
logger.header(`Feature: ${featureName}`);
|
|
119
|
+
logger.blank();
|
|
120
|
+
logger.info(`Status: ${chalk.cyan(feature.status)}`);
|
|
121
|
+
logger.info(`Phase: ${chalk.cyan(feature.phase)}`);
|
|
122
|
+
logger.info(`Tasks: ${chalk.cyan(`${feature.tasks.completed}/${feature.tasks.total}`)}`);
|
|
123
|
+
logger.info(`Agents: ${chalk.cyan(feature.activeAgents.join(', ') || 'None')}`);
|
|
124
|
+
logger.blank();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
} catch (error) {
|
|
128
|
+
logger.error(error.message);
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Set feature property
|
|
135
|
+
*/
|
|
136
|
+
async function setCommand(featureName, key, value, options) {
|
|
137
|
+
if (!featureName || !key || value === undefined) {
|
|
138
|
+
logger.error('Missing required arguments');
|
|
139
|
+
logger.dim(' Usage: morph-spec state set <feature> <key> <value>');
|
|
140
|
+
logger.blank();
|
|
141
|
+
logger.dim(' Example: morph-spec state set my-feature phase implement');
|
|
142
|
+
process.exit(1);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
try {
|
|
146
|
+
const spinner = ora('Updating state...').start();
|
|
147
|
+
|
|
148
|
+
// Parse value automatically (JSON, number, boolean)
|
|
149
|
+
let parsedValue = value;
|
|
150
|
+
try {
|
|
151
|
+
parsedValue = JSON.parse(value);
|
|
152
|
+
} catch {
|
|
153
|
+
// Keep as string if not valid JSON
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
StateManager.updateFeature(featureName, key, parsedValue);
|
|
157
|
+
|
|
158
|
+
spinner.succeed(`Updated ${chalk.cyan(featureName)}.${chalk.cyan(key)}`);
|
|
159
|
+
logger.blank();
|
|
160
|
+
logger.dim(`Value: ${JSON.stringify(parsedValue)}`);
|
|
161
|
+
logger.blank();
|
|
162
|
+
|
|
163
|
+
} catch (error) {
|
|
164
|
+
logger.error(error.message);
|
|
165
|
+
process.exit(1);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Add checkpoint
|
|
171
|
+
*/
|
|
172
|
+
async function checkpointCommand(featureName, note, options) {
|
|
173
|
+
if (!featureName || !note) {
|
|
174
|
+
logger.error('Missing required arguments');
|
|
175
|
+
logger.dim(' Usage: morph-spec state checkpoint <feature> "<note>"');
|
|
176
|
+
logger.blank();
|
|
177
|
+
logger.dim(' Example: morph-spec state checkpoint my-feature "Completed T001-T003"');
|
|
178
|
+
process.exit(1);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
try {
|
|
182
|
+
const spinner = ora('Creating checkpoint...').start();
|
|
183
|
+
|
|
184
|
+
const checkpoint = StateManager.addCheckpoint(featureName, note);
|
|
185
|
+
|
|
186
|
+
spinner.succeed(`Checkpoint registered for ${chalk.cyan(featureName)}`);
|
|
187
|
+
logger.blank();
|
|
188
|
+
logger.dim(` ${checkpoint.note}`);
|
|
189
|
+
logger.dim(` Phase: ${checkpoint.phase}`);
|
|
190
|
+
logger.dim(` Tasks completed: ${checkpoint.completedTasks}`);
|
|
191
|
+
logger.blank();
|
|
192
|
+
|
|
193
|
+
} catch (error) {
|
|
194
|
+
logger.error(error.message);
|
|
195
|
+
process.exit(1);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* List all features
|
|
201
|
+
*/
|
|
202
|
+
async function listCommand(options) {
|
|
203
|
+
logger.header('MORPH-SPEC Project Status');
|
|
204
|
+
logger.blank();
|
|
205
|
+
|
|
206
|
+
try {
|
|
207
|
+
const summary = StateManager.getSummary();
|
|
208
|
+
const features = StateManager.listFeatures();
|
|
209
|
+
|
|
210
|
+
// Project info
|
|
211
|
+
logger.info(`Project: ${chalk.cyan(summary.project.name)}`);
|
|
212
|
+
logger.info(`Type: ${chalk.cyan(summary.project.type)}`);
|
|
213
|
+
logger.blank();
|
|
214
|
+
|
|
215
|
+
if (features.length === 0) {
|
|
216
|
+
logger.warn('No features found');
|
|
217
|
+
logger.blank();
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Features table
|
|
222
|
+
logger.header('Features:');
|
|
223
|
+
logger.blank();
|
|
224
|
+
|
|
225
|
+
features.forEach(([name, feature]) => {
|
|
226
|
+
const statusEmoji = {
|
|
227
|
+
draft: '📝',
|
|
228
|
+
in_review: '👀',
|
|
229
|
+
approved: '✅',
|
|
230
|
+
in_progress: '🚧',
|
|
231
|
+
done: '✔️',
|
|
232
|
+
archived: '📦'
|
|
233
|
+
}[feature.status] || '❓';
|
|
234
|
+
|
|
235
|
+
const progress = feature.tasks.total > 0
|
|
236
|
+
? `${feature.tasks.completed}/${feature.tasks.total}`
|
|
237
|
+
: '0/0';
|
|
238
|
+
|
|
239
|
+
logger.info(`${statusEmoji} ${chalk.bright(name)}`);
|
|
240
|
+
logger.dim(` Phase: ${feature.phase.padEnd(16)} │ Tasks: ${progress}`);
|
|
241
|
+
logger.dim(` Agents: ${feature.activeAgents.slice(0, 5).join(', ') || 'None'}`);
|
|
242
|
+
logger.blank();
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
// Summary
|
|
246
|
+
logger.header('Summary:');
|
|
247
|
+
logger.info(`Total Features: ${chalk.cyan(summary.metadata.totalFeatures)}`);
|
|
248
|
+
logger.info(`Completed: ${chalk.cyan(summary.metadata.completedFeatures)}`);
|
|
249
|
+
logger.info(`Estimated Cost: ${chalk.cyan(`$${summary.metadata.totalCostEstimated.toFixed(2)}/month`)}`);
|
|
250
|
+
logger.blank();
|
|
251
|
+
|
|
252
|
+
} catch (error) {
|
|
253
|
+
logger.error(error.message);
|
|
254
|
+
process.exit(1);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Add agent to feature
|
|
260
|
+
*/
|
|
261
|
+
async function addAgentCommand(featureName, agentId, options) {
|
|
262
|
+
if (!featureName || !agentId) {
|
|
263
|
+
logger.error('Missing required arguments');
|
|
264
|
+
logger.dim(' Usage: morph-spec state add-agent <feature> <agent-id>');
|
|
265
|
+
process.exit(1);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
try {
|
|
269
|
+
const added = StateManager.addAgent(featureName, agentId);
|
|
270
|
+
|
|
271
|
+
if (added) {
|
|
272
|
+
logger.success(`Agent '${chalk.cyan(agentId)}' added to ${chalk.cyan(featureName)}`);
|
|
273
|
+
} else {
|
|
274
|
+
logger.warn(`Agent '${agentId}' already active`);
|
|
275
|
+
}
|
|
276
|
+
logger.blank();
|
|
277
|
+
|
|
278
|
+
} catch (error) {
|
|
279
|
+
logger.error(error.message);
|
|
280
|
+
process.exit(1);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Remove agent from feature
|
|
286
|
+
*/
|
|
287
|
+
async function removeAgentCommand(featureName, agentId, options) {
|
|
288
|
+
if (!featureName || !agentId) {
|
|
289
|
+
logger.error('Missing required arguments');
|
|
290
|
+
logger.dim(' Usage: morph-spec state remove-agent <feature> <agent-id>');
|
|
291
|
+
process.exit(1);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
try {
|
|
295
|
+
const removed = StateManager.removeAgent(featureName, agentId);
|
|
296
|
+
|
|
297
|
+
if (removed) {
|
|
298
|
+
logger.success(`Agent '${chalk.cyan(agentId)}' removed from ${chalk.cyan(featureName)}`);
|
|
299
|
+
} else {
|
|
300
|
+
logger.warn(`Agent '${agentId}' not found`);
|
|
301
|
+
}
|
|
302
|
+
logger.blank();
|
|
303
|
+
|
|
304
|
+
} catch (error) {
|
|
305
|
+
logger.error(error.message);
|
|
306
|
+
process.exit(1);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Mark output as created
|
|
312
|
+
*/
|
|
313
|
+
async function markOutputCommand(featureName, outputType, options) {
|
|
314
|
+
if (!featureName || !outputType) {
|
|
315
|
+
logger.error('Missing required arguments');
|
|
316
|
+
logger.dim(' Usage: morph-spec state mark-output <feature> <output-type>');
|
|
317
|
+
logger.blank();
|
|
318
|
+
logger.dim(' Valid types: proposal, spec, contracts, tasks, decisions, recap');
|
|
319
|
+
logger.dim(' uiDesignSystem, uiMockups, uiComponents, uiFlows');
|
|
320
|
+
process.exit(1);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
try {
|
|
324
|
+
StateManager.markOutput(featureName, outputType);
|
|
325
|
+
|
|
326
|
+
logger.success(`Output '${chalk.cyan(outputType)}' marked as created for ${chalk.cyan(featureName)}`);
|
|
327
|
+
logger.blank();
|
|
328
|
+
|
|
329
|
+
} catch (error) {
|
|
330
|
+
logger.error(error.message);
|
|
331
|
+
process.exit(1);
|
|
332
|
+
}
|
|
333
|
+
}
|