@polymorphism-tech/morph-spec 4.7.1 → 4.8.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.
Files changed (138) hide show
  1. package/.morph/analytics/threads-log.jsonl +54 -0
  2. package/.morph/state.json +198 -0
  3. package/LICENSE +1 -2
  4. package/README.md +379 -414
  5. package/bin/morph-spec.js +57 -403
  6. package/bin/validate.js +2 -26
  7. package/claude-plugin.json +2 -2
  8. package/docs/ARCHITECTURE.md +43 -46
  9. package/docs/CHEATSHEET.md +203 -221
  10. package/docs/COMMAND-FLOWS.md +319 -289
  11. package/docs/QUICKSTART.md +2 -8
  12. package/docs/plans/2026-02-22-claude-docs-morph-alignment-analysis.md +2 -0
  13. package/docs/plans/2026-02-22-claude-settings.md +2 -0
  14. package/docs/plans/2026-02-22-morph-cc-alignment-impl.md +2 -0
  15. package/docs/plans/2026-02-22-morph-spec-next.md +2 -0
  16. package/docs/plans/2026-02-22-native-alignment-design.md +2 -0
  17. package/docs/plans/2026-02-22-native-alignment-impl.md +2 -0
  18. package/docs/plans/2026-02-22-native-enrichment-design.md +2 -0
  19. package/docs/plans/2026-02-22-native-enrichment.md +2 -0
  20. package/docs/plans/2026-02-23-ddd-architecture-refactor.md +2 -0
  21. package/docs/plans/2026-02-23-ddd-nextsteps.md +2 -0
  22. package/docs/plans/2026-02-23-infra-architect-refactor.md +2 -0
  23. package/docs/plans/2026-02-23-nextjs-code-review-design.md +2 -1
  24. package/docs/plans/2026-02-23-nextjs-code-review-impl.md +2 -0
  25. package/docs/plans/2026-02-23-nextjs-standards-design.md +2 -1
  26. package/docs/plans/2026-02-23-nextjs-standards-impl.md +2 -0
  27. package/docs/plans/2026-02-24-cli-radical-simplification.md +592 -0
  28. package/docs/plans/2026-02-24-framework-failure-points.md +125 -0
  29. package/docs/plans/2026-02-24-morph-init-design.md +337 -0
  30. package/docs/plans/2026-02-24-morph-init-impl.md +1269 -0
  31. package/docs/plans/2026-02-24-tutorial-command-design.md +71 -0
  32. package/docs/plans/2026-02-24-tutorial-command.md +298 -0
  33. package/framework/CLAUDE.md +2 -2
  34. package/framework/commands/morph-proposal.md +3 -3
  35. package/framework/hooks/README.md +11 -10
  36. package/framework/hooks/claude-code/notification/approval-reminder.js +2 -0
  37. package/framework/hooks/claude-code/post-tool-use/dispatch.js +1 -1
  38. package/framework/hooks/claude-code/pre-tool-use/protect-readonly-files.js +4 -55
  39. package/framework/hooks/claude-code/session-start/inject-morph-context.js +20 -5
  40. package/framework/hooks/claude-code/statusline.py +6 -1
  41. package/framework/hooks/claude-code/stop/validate-completion.js +1 -1
  42. package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +1 -1
  43. package/framework/hooks/dev/check-sync-health.js +117 -0
  44. package/framework/hooks/dev/guard-version-numbers.js +57 -0
  45. package/framework/hooks/dev/sync-standards-registry.js +60 -0
  46. package/framework/hooks/dev/sync-template-registry.js +60 -0
  47. package/framework/hooks/dev/validate-skill-format.js +70 -0
  48. package/framework/hooks/dev/validate-standard-format.js +73 -0
  49. package/framework/hooks/shared/payload-utils.js +39 -0
  50. package/framework/hooks/shared/state-reader.js +25 -1
  51. package/framework/rules/morph-workflow.md +1 -1
  52. package/framework/skills/level-0-meta/morph-init/SKILL.md +216 -0
  53. package/framework/skills/level-0-meta/morph-replicate/SKILL.md +4 -4
  54. package/framework/skills/level-0-meta/tool-usage-guide/SKILL.md +4 -4
  55. package/framework/skills/level-0-meta/verification-before-completion/SKILL.md +1 -1
  56. package/framework/skills/level-1-workflows/phase-clarify/SKILL.md +192 -191
  57. package/framework/skills/level-1-workflows/phase-codebase-analysis/SKILL.md +181 -180
  58. package/framework/skills/level-1-workflows/phase-design/SKILL.md +339 -338
  59. package/framework/skills/level-1-workflows/phase-implement/SKILL.md +254 -253
  60. package/framework/skills/level-1-workflows/phase-setup/SKILL.md +168 -170
  61. package/framework/skills/level-1-workflows/phase-tasks/SKILL.md +284 -283
  62. package/framework/skills/level-1-workflows/phase-uiux/SKILL.md +246 -245
  63. package/framework/templates/examples/design-system-examples.md +1 -1
  64. package/framework/templates/ui/FluentDesignTheme.cs +1 -1
  65. package/framework/templates/ui/MudTheme.cs +1 -1
  66. package/framework/templates/ui/design-system.css +1 -1
  67. package/package.json +4 -2
  68. package/scripts/bump-version.js +248 -0
  69. package/scripts/install-dev-hooks.js +138 -0
  70. package/src/commands/agents/index.js +1 -2
  71. package/src/commands/index.js +13 -16
  72. package/src/commands/project/doctor.js +100 -14
  73. package/src/commands/project/index.js +7 -10
  74. package/src/commands/project/init.js +398 -555
  75. package/src/commands/project/install-plugin-cmd.js +28 -0
  76. package/src/commands/project/setup-infra-cmd.js +12 -0
  77. package/src/commands/project/tutorial.js +115 -0
  78. package/src/commands/project/update.js +22 -37
  79. package/src/commands/state/approve.js +213 -221
  80. package/src/commands/state/index.js +0 -1
  81. package/src/commands/state/state.js +337 -365
  82. package/src/commands/templates/index.js +0 -4
  83. package/src/commands/trust/trust.js +1 -93
  84. package/src/commands/utils/index.js +1 -5
  85. package/src/commands/validation/index.js +1 -5
  86. package/src/core/registry/command-registry.js +11 -285
  87. package/src/core/state/state-manager.js +5 -2
  88. package/src/lib/detectors/index.js +81 -87
  89. package/src/lib/detectors/structure-detector.js +275 -273
  90. package/src/lib/generators/recap-generator.js +232 -225
  91. package/src/lib/installers/mcp-installer.js +18 -3
  92. package/src/scripts/global-install.js +34 -0
  93. package/src/scripts/install-plugin.js +126 -0
  94. package/src/scripts/setup-infra.js +203 -0
  95. package/src/utils/agents-installer.js +10 -1
  96. package/src/utils/hooks-installer.js +70 -17
  97. package/CLAUDE.md +0 -77
  98. package/docs/claude-alignment-report.md +0 -137
  99. package/docs/examples/order-management/contracts.cs +0 -84
  100. package/docs/examples/order-management/proposal.md +0 -24
  101. package/docs/examples/order-management/spec.md +0 -162
  102. package/src/commands/feature/create-story.js +0 -362
  103. package/src/commands/feature/index.js +0 -6
  104. package/src/commands/feature/shard-spec.js +0 -225
  105. package/src/commands/feature/sprint-status.js +0 -250
  106. package/src/commands/generation/generate-onboarding.js +0 -169
  107. package/src/commands/generation/generate.js +0 -276
  108. package/src/commands/generation/index.js +0 -5
  109. package/src/commands/learning/capture-pattern.js +0 -121
  110. package/src/commands/learning/index.js +0 -5
  111. package/src/commands/learning/search-patterns.js +0 -126
  112. package/src/commands/mcp/mcp.js +0 -102
  113. package/src/commands/project/changes.js +0 -66
  114. package/src/commands/project/cost.js +0 -179
  115. package/src/commands/project/detect.js +0 -114
  116. package/src/commands/project/diff.js +0 -278
  117. package/src/commands/project/revert.js +0 -173
  118. package/src/commands/project/standards.js +0 -80
  119. package/src/commands/project/sync.js +0 -167
  120. package/src/commands/project/update-agents.js +0 -23
  121. package/src/commands/state/rollback-phase.js +0 -185
  122. package/src/commands/templates/template-customize.js +0 -87
  123. package/src/commands/templates/template-list.js +0 -114
  124. package/src/commands/templates/template-show.js +0 -129
  125. package/src/commands/templates/template-validate.js +0 -91
  126. package/src/commands/utils/troubleshoot.js +0 -222
  127. package/src/commands/validation/analyze-blazor-concurrency.js +0 -193
  128. package/src/commands/validation/lint-fluent.js +0 -352
  129. package/src/commands/validation/validate-blazor-state.js +0 -210
  130. package/src/commands/validation/validate-blazor.js +0 -156
  131. package/src/commands/validation/validate-css.js +0 -84
  132. package/src/lib/detectors/conversation-analyzer.js +0 -163
  133. package/src/lib/learning/index.js +0 -7
  134. package/src/lib/learning/learning-system.js +0 -520
  135. package/src/lib/troubleshooting/index.js +0 -8
  136. package/src/lib/troubleshooting/troubleshoot-grep.js +0 -198
  137. package/src/lib/troubleshooting/troubleshoot-index.js +0 -144
  138. package/src/llm/environment-detector.js +0 -43
package/bin/morph-spec.js CHANGED
@@ -8,76 +8,36 @@ import { readFileSync } from 'fs';
8
8
 
9
9
  // Project commands
10
10
  import { initCommand } from '../src/commands/project/init.js';
11
+ import { setupInfraCommand } from '../src/commands/project/setup-infra-cmd.js';
12
+ import { installPluginCommand } from '../src/commands/project/install-plugin-cmd.js';
11
13
  import { updateCommand } from '../src/commands/project/update.js';
12
- import { updateAgentsCommand } from '../src/commands/project/update-agents.js';
13
14
  import { doctorCommand } from '../src/commands/project/doctor.js';
14
- import { detectCommand } from '../src/commands/project/detect.js';
15
+ import { tutorialCommand } from '../src/commands/project/tutorial.js';
15
16
 
16
- import { syncCommand } from '../src/commands/project/sync.js';
17
17
  import { statusCommand } from '../src/commands/project/status.js';
18
- import { diffCommand, diffSaveCommand } from '../src/commands/project/diff.js';
19
- import { costCommand } from '../src/commands/project/cost.js';
20
- import { revertCommand } from '../src/commands/project/revert.js';
21
18
  import { checkpointSaveCommand, checkpointRestoreCommand, checkpointListCommand } from '../src/commands/project/checkpoint.js';
22
19
 
23
- import { changesCommand } from '../src/commands/project/changes.js';
24
-
25
- // Feature commands
26
- import { createStoryCommand } from '../src/commands/feature/create-story.js';
27
- import { shardSpecCommand } from '../src/commands/feature/shard-spec.js';
28
- import { sprintStatusCommand } from '../src/commands/feature/sprint-status.js';
29
-
30
20
  // State commands
31
21
  import { stateCommand } from '../src/commands/state/state.js';
32
22
  import { validatePhaseCommand } from '../src/commands/state/validate-phase.js';
33
- import { rollbackPhaseCommand } from '../src/commands/state/rollback-phase.js';
34
23
  import { advancePhaseCommand } from '../src/commands/state/advance-phase.js';
35
- import { approveCommand, rejectCommand, approvalStatusCommand } from '../src/commands/state/approve.js';
24
+ import { approveCommand, approvalStatusCommand, unapproveCommand } from '../src/commands/state/approve.js';
36
25
 
37
26
  // Task commands
38
27
  import { taskDoneCommand, taskStartCommand, taskNextCommand } from '../src/commands/tasks/task.js';
39
28
 
40
- // Generation commands
41
- import { generateDesignSystemCommand, generateMetadataCommand } from '../src/commands/generation/generate.js';
42
- import { generateOnboardingCommand } from '../src/commands/generation/generate-onboarding.js';
43
-
44
29
  // Validation commands
45
30
  import { validateCommand } from './validate.js';
46
- import { validateBlazorCommand } from '../src/commands/validation/validate-blazor.js';
47
- import { lintFluentCommand } from '../src/commands/validation/lint-fluent.js';
48
- import { analyzeBlazorConcurrencyCommand } from '../src/commands/validation/analyze-blazor-concurrency.js';
49
- import { validateBlazorStateCommand } from '../src/commands/validation/validate-blazor-state.js';
50
- import { validateCssCommand } from '../src/commands/validation/validate-css.js';
51
31
  import { validateFeatureCommand } from '../src/commands/validation/validate-feature.js';
52
32
 
53
33
  // Template commands
54
- import { templateListCommand } from '../src/commands/templates/template-list.js';
55
- import { templateShowCommand } from '../src/commands/templates/template-show.js';
56
34
  import { templateRenderCommand } from '../src/commands/templates/template-render.js';
57
- import { templateCustomizeCommand } from '../src/commands/templates/template-customize.js';
58
- import { templateValidateCommand } from '../src/commands/templates/template-validate.js';
59
-
60
- // Agent commands
61
35
 
62
- // Learning commands
63
- import capturePatternProgram from '../src/commands/learning/capture-pattern.js';
64
- import searchPatternsProgram from '../src/commands/learning/search-patterns.js';
65
-
66
- // Utility commands
67
- import troubleshootCommand from '../src/commands/utils/troubleshoot.js';
68
-
69
- // Context Optimization commands
70
- import { mcpOptimizeCommand, mcpListCommand } from '../src/commands/mcp/mcp.js';
36
+ // MCP commands
71
37
  import { mcpSetupCommand } from '../src/commands/mcp/mcp-setup.js';
72
38
 
73
39
  // Trust commands
74
- import {
75
- trustStatusCommand, trustSetCommand, trustHistoryCommand,
76
- trustAutoCalculateCommand, trustClearCommand
77
- } from '../src/commands/trust/trust.js';
78
-
79
- // Libraries
80
- import { LearningSystem } from '../src/lib/learning/learning-system.js';
40
+ import { trustStatusCommand, trustSetCommand } from '../src/commands/trust/trust.js';
81
41
 
82
42
  const __dirname = dirname(fileURLToPath(import.meta.url));
83
43
  const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
@@ -108,6 +68,17 @@ program
108
68
  .option('--skip-mcp', 'Skip MCP server auto-setup')
109
69
  .action(initCommand);
110
70
 
71
+ program
72
+ .command('setup-infra')
73
+ .description('Install MORPH-SPEC infrastructure (headless, no prompts). Called by /morph-init skill.')
74
+ .option('-p, --path <path>', 'Target path (default: current directory)')
75
+ .action(setupInfraCommand);
76
+
77
+ program
78
+ .command('install-plugin <name>')
79
+ .description('Install a Claude Code plugin (superpowers, context7). Called by /morph-init skill.')
80
+ .action(installPluginCommand);
81
+
111
82
  program
112
83
  .command('update')
113
84
  .description('Update MORPH templates and standards to latest version')
@@ -115,11 +86,6 @@ program
115
86
  .option('--standards', 'Update only standards')
116
87
  .action(updateCommand);
117
88
 
118
- program
119
- .command('update-agents')
120
- .description('Refresh .claude/agents/ with latest morph orchestrator and domain agents')
121
- .action(updateAgentsCommand);
122
-
123
89
  program
124
90
  .command('doctor')
125
91
  .description('Check MORPH installation health')
@@ -128,19 +94,9 @@ program
128
94
  .action(doctorCommand);
129
95
 
130
96
  program
131
- .command('detect')
132
- .description('Detect project stack, architecture, and patterns')
133
- .option('-p, --path <path>', 'Project path (default: current directory)')
134
- .option('-v, --verbose', 'Show detailed detection results')
135
- .option('--no-save', 'Do not save results to .morph/project/')
136
- .action(detectCommand);
137
-
138
- program
139
- .command('sync')
140
- .description('Sync standards from feature decisions')
141
- .option('-p, --path <path>', 'Project path (default: current directory)')
142
- .option('--dry-run', 'Show what would be synced without updating files')
143
- .action(syncCommand);
97
+ .command('tutorial')
98
+ .description('Learn the MORPH-SPEC workflow — phase pipeline and getting started')
99
+ .action(tutorialCommand);
144
100
 
145
101
  program
146
102
  .command('status <feature>')
@@ -149,43 +105,10 @@ program
149
105
  .option('-v, --verbose', 'Show detailed output')
150
106
  .action(statusCommand);
151
107
 
152
- program
153
- .command('changes <feature>')
154
- .description('List files created/modified by a feature, grouped by phase')
155
- .option('--json', 'Output as JSON')
156
- .action((feature, options) => changesCommand(feature, options));
157
-
158
- // Story-driven development commands
159
- const storyCommand = program
160
- .command('story')
161
- .description('Story-driven development commands');
162
-
163
- storyCommand
164
- .command('create <feature> <story-id>')
165
- .description('Create a new story with auto-injected Dev Notes')
166
- .option('--title <title>', 'Story title')
167
- .option('--epic <epic>', 'Epic name')
168
- .option('--context <context>', 'Story context')
169
- .option('--tasks <tasks>', 'Comma-separated tasks')
170
- .option('--dry-run', 'Preview without writing file')
171
- .action(createStoryCommand);
172
-
173
- storyCommand
174
- .command('shard <feature>')
175
- .description('Shard spec.md into manageable chunks (90% token savings)')
176
- .option('--dry-run', 'Preview shards without writing files')
177
- .option('--verbose', 'Show detailed shard info')
178
- .action(shardSpecCommand);
179
-
180
- storyCommand
181
- .command('status <feature> [action] [story-id]')
182
- .description('Manage sprint status (show | start | qa | done | next)')
183
- .action(sprintStatusCommand);
184
-
185
108
  // State management commands
186
109
  program
187
110
  .command('state <action> [args...]')
188
- .description('Manage state.json (init | get | set | checkpoint | list | add-agent | remove-agent | mark-output)')
111
+ .description('Manage state.json (init | get | set | list | add-agent | remove-agent | mark-output)')
189
112
  .option('--force', 'Force overwrite (init command)')
190
113
  .option('--project <name>', 'Project name (init command)')
191
114
  .option('--type <type>', 'Project type (init command)')
@@ -218,19 +141,6 @@ const generateCommand = program
218
141
  .command('generate')
219
142
  .description('Generate code from templates');
220
143
 
221
- generateCommand
222
- .command('design-system <ui-design-system-md>')
223
- .description('Generate CSS + theme files from ui-design-system.md')
224
- .option('--fluent', 'Generate only Fluent UI theme')
225
- .option('--mud', 'Generate only MudBlazor theme')
226
- .option('--both', 'Generate both themes (default)')
227
- .option('--namespace <ns>', 'C# namespace (default: YourProject.Themes)')
228
- .option('--css-output <path>', 'CSS output path (default: wwwroot/css/design-system.css)')
229
- .option('--fluent-output <path>', 'Fluent theme output path (default: Themes/FluentDesignTheme.cs)')
230
- .option('--mud-output <path>', 'MudBlazor theme output path (default: Themes/MudDesignTheme.cs)')
231
- .option('--dry-run', 'Preview without writing files')
232
- .action(generateDesignSystemCommand);
233
-
234
144
  generateCommand
235
145
  .command('recap <feature>')
236
146
  .description('Auto-generate recap.md from project data (state, validation, contracts)')
@@ -240,18 +150,6 @@ generateCommand
240
150
  await generateRecap('.', feature, options);
241
151
  });
242
152
 
243
- generateCommand
244
- .command('metadata <feature>')
245
- .description('Generate metadata.json summary from markdown outputs')
246
- .option('--output <path>', 'Custom output path')
247
- .option('--verbose', 'Show detailed extraction info')
248
- .action((feature, options) => generateMetadataCommand(feature, options));
249
-
250
- generateCommand
251
- .command('onboarding')
252
- .description('Generate onboarding.md guide with project context, MCPs, agents, and workflows')
253
- .action(generateOnboardingCommand);
254
-
255
153
  // Validation commands (Sprint 4: Continuous Validation)
256
154
  program
257
155
  .command('validate [validator]')
@@ -259,241 +157,16 @@ program
259
157
  .option('-v, --verbose', 'Show detailed output')
260
158
  .option('--auto-fix, --fix', 'Auto-fix issues where possible')
261
159
  .option('--no-fail', 'Don\'t exit with error code')
262
- .option('-i, --insights', 'Show learning insights')
263
160
  .option('--wcag-aaa', 'Use WCAG AAA standard (stricter)')
264
161
  .action((validator, options) => {
265
162
  const args = validator ? [validator] : ['all'];
266
163
  if (options.verbose) args.push('--verbose');
267
164
  if (options.autoFix) args.push('--auto-fix');
268
165
  if (options.noFail) args.push('--no-fail');
269
- if (options.insights) args.push('--insights');
270
166
  if (options.wcagAaa) args.push('--wcag-aaa');
271
167
  validateCommand(args);
272
168
  });
273
169
 
274
- // Fluent UI Blazor validation commands
275
- program
276
- .command('validate-blazor [path]')
277
- .description('Validate Fluent UI Blazor patterns and icons')
278
- .option('-v, --verbose', 'Show detailed output')
279
- .option('--fix', 'Auto-fix issues where possible')
280
- .action(validateBlazorCommand);
281
-
282
- program
283
- .command('lint-fluent [path]')
284
- .description('Lint Fluent UI patterns for common issues')
285
- .option('-v, --verbose', 'Show detailed output')
286
- .action(lintFluentCommand);
287
-
288
- program
289
- .command('analyze-blazor-concurrency [path]')
290
- .description('Analyze Blazor Server code for DbContext concurrency issues')
291
- .option('-v, --verbose', 'Show detailed output')
292
- .action(analyzeBlazorConcurrencyCommand);
293
-
294
- program
295
- .command('validate-blazor-state [path]')
296
- .description('Validate Blazor Server session state patterns')
297
- .option('-v, --verbose', 'Show detailed output')
298
- .action(validateBlazorStateCommand);
299
-
300
- program
301
- .command('validate-css [path]')
302
- .description('Validate CSS classes used in Razor files exist in CSS files')
303
- .option('-v, --verbose', 'Show detailed output')
304
- .option('--generate-stub', 'Generate a CSS stub file with missing classes')
305
- .option('--include-utilities', 'Include utility classes (Tailwind, Bootstrap) in validation')
306
- .action(validateCssCommand);
307
-
308
- // Learning commands (Sprint 4: Learning System)
309
- const learnCommand = program
310
- .command('learn')
311
- .description('AI learning system commands');
312
-
313
- learnCommand
314
- .command('analyze')
315
- .description('Learn from project history (decisions.md files)')
316
- .option('-v, --verbose', 'Show detailed learning progress')
317
- .action(async (options) => {
318
- const learner = new LearningSystem('.');
319
- await learner.learnFromProject();
320
-
321
- if (options.verbose) {
322
- learner.formatInsights();
323
- }
324
- });
325
-
326
- learnCommand
327
- .command('insights')
328
- .description('Show AI insights and patterns')
329
- .option('--json', 'Output as JSON')
330
- .action((options) => {
331
- const learner = new LearningSystem('.');
332
-
333
- if (options.json) {
334
- console.log(JSON.stringify(learner.getInsightsSummary(), null, 2));
335
- } else {
336
- learner.formatInsights();
337
- }
338
- });
339
-
340
- learnCommand
341
- .command('suggest [category]')
342
- .description('Get AI suggestions for a category (uiLibrary | architecture | infrastructure | authentication | stateManagement | testing)')
343
- .option('--json', 'Output as JSON')
344
- .action((category, options) => {
345
- const learner = new LearningSystem('.');
346
-
347
- if (category) {
348
- const suggestion = learner.getSuggestion(category);
349
- if (options.json) {
350
- console.log(JSON.stringify(suggestion, null, 2));
351
- } else {
352
- console.log(chalk.cyan(`\n💡 Suggestion for ${category}:\n`));
353
- if (suggestion.confidence === 'none') {
354
- console.log(chalk.yellow(` ${suggestion.reason}`));
355
- } else {
356
- console.log(chalk.white(` → ${suggestion.suggestion} (${suggestion.percentage}% confidence)`));
357
- console.log(chalk.gray(` ${suggestion.reason}`));
358
- }
359
- console.log('');
360
- }
361
- } else {
362
- const suggestions = learner.getAllSuggestions();
363
- if (options.json) {
364
- console.log(JSON.stringify(suggestions, null, 2));
365
- } else {
366
- learner.formatSuggestions(suggestions);
367
- }
368
- }
369
- });
370
-
371
- learnCommand
372
- .command('reset')
373
- .description('Reset knowledge base (clear all learned patterns)')
374
- .option('--force', 'Skip confirmation')
375
- .action((options) => {
376
- if (!options.force) {
377
- console.log(chalk.yellow('\n⚠️ This will delete all learned patterns and preferences.'));
378
- console.log(chalk.gray(' Run with --force to confirm.\n'));
379
- process.exit(1);
380
- }
381
-
382
- const learner = new LearningSystem('.');
383
- learner.reset();
384
- console.log(chalk.green('\n✅ Knowledge base reset\n'));
385
- });
386
-
387
- // Standards browsing command
388
- program
389
- .command('standards')
390
- .description('Browse framework standards library')
391
- .option('--list', 'List all standards')
392
- .option('--search <query>', 'Search standards by keyword')
393
- .option('--show <id>', 'Show full content of a standard')
394
- .option('--category <cat>', 'Filter by category (core, backend, frontend, infrastructure, ...)')
395
- .option('--json', 'Output as JSON')
396
- .action(async (opts) => {
397
- const { listStandards, searchStandards, showStandard } = await import('../src/commands/project/standards.js');
398
- if (opts.search) {
399
- await searchStandards(opts.search, opts);
400
- } else if (opts.show) {
401
- await showStandard(opts.show);
402
- } else {
403
- await listStandards(opts);
404
- }
405
- });
406
-
407
- // Template management commands
408
- const templateCommand = program
409
- .command('template')
410
- .description('Template management (list | show | render | customize | validate)');
411
-
412
- templateCommand
413
- .command('list')
414
- .description('List all available templates')
415
- .option('--category <category>', 'Filter by category (documentation, code, infrastructure, context, examples)')
416
- .option('--phase <phase>', 'Filter by phase (proposal, design, implement, etc.)')
417
- .option('--required', 'Show only required templates')
418
- .action(templateListCommand);
419
-
420
- templateCommand
421
- .command('show <template-id>')
422
- .description('Show detailed information about a template')
423
- .option('--show-path', 'Show resolved template file path')
424
- .option('--preview', 'Show first 20 lines of template content')
425
- .option('--project-path <path>', 'Project path (default: current directory)')
426
- .action(templateShowCommand);
427
-
428
- templateCommand
429
- .command('render <template-id> <output-path> <variables-json>')
430
- .description('Render a template with variables')
431
- .option('--dry-run', 'Preview without writing file')
432
- .option('--project-path <path>', 'Project path (default: current directory)')
433
- .option('-v, --verbose', 'Show detailed output')
434
- .action(templateRenderCommand);
435
-
436
- templateCommand
437
- .command('customize <template-id>')
438
- .description('Copy framework template to project for customization')
439
- .option('--local', 'Copy to project .morph/templates/')
440
- .option('--force', 'Overwrite existing customized template')
441
- .option('--project-path <path>', 'Project path (default: current directory)')
442
- .option('-v, --verbose', 'Show detailed output')
443
- .action(templateCustomizeCommand);
444
-
445
- templateCommand
446
- .command('validate [template-id]')
447
- .description('Validate template(s) for correct Handlebars syntax')
448
- .option('--category <category>', 'Validate templates in specific category')
449
- .option('--technology <technology>', 'Validate templates for specific technology')
450
- .option('--include-deprecated', 'Include deprecated templates')
451
- .option('--show-valid', 'Show valid templates in output')
452
- .option('--strict', 'Exit with error on warnings')
453
- .option('--project-path <path>', 'Project path (default: current directory)')
454
- .option('-v, --verbose', 'Show detailed validation information')
455
- .action(templateValidateCommand);
456
-
457
- // Trust commands
458
- const trustCommand = program
459
- .command('trust')
460
- .description('Trust level management for zero-touch execution');
461
-
462
- trustCommand
463
- .command('status [feature]')
464
- .description('Show trust level and auto-approval status')
465
- .action(trustStatusCommand);
466
-
467
- trustCommand
468
- .command('set <feature> <level> [reason]')
469
- .description('Manually set trust level (low|medium|high|maximum)')
470
- .action(trustSetCommand);
471
-
472
- trustCommand
473
- .command('history')
474
- .description('Show trust history for all features')
475
- .action(trustHistoryCommand);
476
-
477
- trustCommand
478
- .command('auto-calculate <feature>')
479
- .description('Recalculate trust from checkpoint history')
480
- .action(trustAutoCalculateCommand);
481
-
482
- trustCommand
483
- .command('clear <feature>')
484
- .description('Clear manual trust override (revert to calculated)')
485
- .action(trustClearCommand);
486
-
487
- // Troubleshooting command
488
- program
489
- .command('troubleshoot <keywords...>')
490
- .alias('ts')
491
- .description('Search troubleshooting solutions for common errors')
492
- .option('--category <cat>', 'Filter by category (blazor, efcore, azure, auth, deploy)')
493
- .option('-v, --verbose', 'Show full solution content')
494
- .option('--list-categories', 'List available categories')
495
- .action(troubleshootCommand);
496
-
497
170
  // Phase management commands
498
171
  const phaseCommand = program
499
172
  .command('phase')
@@ -522,33 +195,6 @@ program
522
195
  .option('-v, --verbose', 'Show detailed output')
523
196
  .action(validateFeatureCommand);
524
197
 
525
- // Diff command
526
- program
527
- .command('diff <feature> [output-file]')
528
- .description('Show changes to specifications since last snapshot')
529
- .option('--json', 'Output as JSON')
530
- .action(diffCommand);
531
-
532
- program
533
- .command('diff-save <feature>')
534
- .description('Save current outputs as snapshot for future diffs')
535
- .action(diffSaveCommand);
536
-
537
- // Cost tracking command
538
- program
539
- .command('cost <feature>')
540
- .description('Track token usage and cost estimates across phases')
541
- .option('--json', 'Output as JSON')
542
- .action(costCommand);
543
-
544
- // Revert command
545
- program
546
- .command('revert <feature>')
547
- .description('Revert feature to a previous phase')
548
- .option('--to <phase>', 'Target phase to revert to')
549
- .option('--delete-outputs', 'Delete output files (default: preserve files, reset state)')
550
- .action(revertCommand);
551
-
552
198
  // Checkpoint save/restore commands
553
199
  program
554
200
  .command('checkpoint-save <feature>')
@@ -567,14 +213,6 @@ program
567
213
  .option('--json', 'Output as JSON')
568
214
  .action(checkpointListCommand);
569
215
 
570
- // Rollback phase command
571
- program
572
- .command('rollback <feature> <phase>')
573
- .description('Rollback feature to a previous phase (marks outputs as draft)')
574
- .option('--force', 'Skip confirmation')
575
- .option('-v, --verbose', 'Show detailed output')
576
- .action(rollbackPhaseCommand);
577
-
578
216
  // Approval workflow commands
579
217
  program
580
218
  .command('approve <feature> <gate>')
@@ -583,37 +221,53 @@ program
583
221
  .option('--notes <notes>', 'Approval notes')
584
222
  .action((feature, gate, options) => approveCommand(feature, gate, options));
585
223
 
586
- program
587
- .command('reject <feature> <gate> [reason]')
588
- .description('Reject a phase gate with optional reason')
589
- .action((feature, gate, reason, options) => rejectCommand(feature, gate, reason, options));
590
-
591
224
  program
592
225
  .command('approval-status <feature>')
593
226
  .description('Show approval status for all gates')
594
227
  .option('--json', 'Output as JSON')
595
228
  .action((feature, options) => approvalStatusCommand(feature, options));
596
229
 
597
- // Pattern learning system - Add as subcommands
598
- program.addCommand(capturePatternProgram);
599
- program.addCommand(searchPatternsProgram);
230
+ program
231
+ .command('unapprove <feature> <gate>')
232
+ .description('Revoke a phase gate approval (proposal, design, tasks, uiux)')
233
+ .option('--revoker <name>', 'Name of person revoking (default: current user)')
234
+ .option('--reason <reason>', 'Reason for revocation')
235
+ .action((feature, gate, options) => unapproveCommand(feature, gate, options));
236
+
237
+ // Template management commands
238
+ const templateCommand = program
239
+ .command('template')
240
+ .description('Template management (render)');
241
+
242
+ templateCommand
243
+ .command('render <template-id> <output-path> <variables-json>')
244
+ .description('Render a template with variables')
245
+ .option('--dry-run', 'Preview without writing file')
246
+ .option('--project-path <path>', 'Project path (default: current directory)')
247
+ .option('-v, --verbose', 'Show detailed output')
248
+ .action(templateRenderCommand);
249
+
250
+ // Trust commands
251
+ const trustCommand = program
252
+ .command('trust')
253
+ .description('Trust level management for zero-touch execution');
254
+
255
+ trustCommand
256
+ .command('status [feature]')
257
+ .description('Show trust level and auto-approval status')
258
+ .action(trustStatusCommand);
259
+
260
+ trustCommand
261
+ .command('set <feature> <level> [reason]')
262
+ .description('Manually set trust level (low|medium|high|maximum)')
263
+ .action(trustSetCommand);
600
264
 
601
265
  // ─────────────────────────────────────────────────────────────────────────────
602
- // MCP Optimizer
266
+ // MCP Setup
603
267
  // ─────────────────────────────────────────────────────────────────────────────
604
268
  const mcpCommand = program
605
269
  .command('mcp')
606
- .description('MCP server analysis and optimization');
607
-
608
- mcpCommand
609
- .command('optimize')
610
- .description('Analyze MCP servers and suggest optimizations')
611
- .action((options) => mcpOptimizeCommand(options));
612
-
613
- mcpCommand
614
- .command('list')
615
- .description('List configured MCP servers with usage stats')
616
- .action((options) => mcpListCommand(options));
270
+ .description('MCP server setup and configuration');
617
271
 
618
272
  mcpCommand
619
273
  .command('setup [name]')
package/bin/validate.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Validation CLI
5
5
  *
6
6
  * Runs all validators (package, architecture, contrast) on the project.
7
- * Part of Sprint 4: Continuous Validation + Learning System
7
+ * Part of Sprint 4: Continuous Validation
8
8
  *
9
9
  * Usage:
10
10
  * morph-spec validate [options]
@@ -20,7 +20,6 @@ import chalk from 'chalk';
20
20
  import { validatePackages } from '../src/lib/validators/packages/package-validator.js';
21
21
  import { validateArchitecture } from '../src/lib/validators/architecture/architecture-validator.js';
22
22
  import { validateContrast } from '../src/lib/validators/ui/ui-contrast-validator.js';
23
- import { LearningSystem } from '../src/lib/learning/learning-system.js';
24
23
 
25
24
  const VALIDATORS = {
26
25
  packages: {
@@ -164,10 +163,6 @@ export async function validateCommand(args = []) {
164
163
  process.exit(1);
165
164
  }
166
165
 
167
- // Show learning insights if --insights flag
168
- if (options.insights) {
169
- await showLearningInsights(options);
170
- }
171
166
  }
172
167
 
173
168
  /**
@@ -266,21 +261,6 @@ async function runValidator(name, options) {
266
261
  }
267
262
  }
268
263
 
269
- /**
270
- * Show learning insights
271
- */
272
- async function showLearningInsights(options) {
273
- console.log(chalk.bold.cyan('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
274
-
275
- const learner = new LearningSystem('.');
276
- learner.formatInsights();
277
-
278
- if (options.verbose) {
279
- const suggestions = learner.getAllSuggestions();
280
- learner.formatSuggestions(suggestions);
281
- }
282
- }
283
-
284
264
  /**
285
265
  * Parse command-line options
286
266
  */
@@ -289,7 +269,6 @@ function parseOptions(args) {
289
269
  verbose: false,
290
270
  autoFix: false,
291
271
  noFail: false,
292
- insights: false,
293
272
  wcagLevel: 'AA'
294
273
  };
295
274
 
@@ -300,8 +279,6 @@ function parseOptions(args) {
300
279
  options.autoFix = true;
301
280
  } else if (arg === '--no-fail') {
302
281
  options.noFail = true;
303
- } else if (arg === '--insights' || arg === '-i') {
304
- options.insights = true;
305
282
  } else if (arg === '--wcag-aaa') {
306
283
  options.wcagLevel = 'AAA';
307
284
  }
@@ -330,7 +307,6 @@ ${chalk.bold('OPTIONS')}
330
307
  --verbose, -v Show detailed output
331
308
  --auto-fix, --fix Auto-fix issues where possible
332
309
  --no-fail Don't exit with error code
333
- --insights, -i Show learning insights
334
310
  --wcag-aaa Use WCAG AAA standard (stricter)
335
311
 
336
312
  ${chalk.bold('EXAMPLES')}
@@ -338,7 +314,7 @@ ${chalk.bold('EXAMPLES')}
338
314
  morph-spec validate packages --fix # Validate packages and auto-fix
339
315
  morph-spec validate architecture -v # Verbose architecture validation
340
316
  morph-spec validate contrast --wcag-aaa # Stricter contrast validation
341
- morph-spec validate all --insights # All validators + AI insights
317
+ morph-spec validate all # Run all validators
342
318
 
343
319
  ${chalk.bold('EXIT CODES')}
344
320
  0 All validations passed
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "morph-spec",
3
- "version": "4.3.7",
3
+ "version": "4.8.1",
4
4
  "displayName": "MORPH-SPEC Framework",
5
- "description": "Spec-driven development with 37 agents and 5-phase workflow for .NET/Blazor/Next.js",
5
+ "description": "Spec-driven development with 38 agents and 8-phase workflow for .NET/Blazor/Next.js/Azure",
6
6
  "publisher": "polymorphism-tech",
7
7
  "skills": {
8
8
  "directory": "framework/skills",