@polymorphism-tech/morph-spec 4.8.19 → 4.9.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.
Files changed (137) hide show
  1. package/CLAUDE.md +21 -0
  2. package/README.md +2 -2
  3. package/bin/morph-spec.js +15 -56
  4. package/bin/task-manager.js +115 -14
  5. package/bin/validate.js +67 -33
  6. package/claude-plugin.json +1 -1
  7. package/docs/CHEATSHEET.md +201 -203
  8. package/docs/QUICKSTART.md +2 -2
  9. package/framework/CLAUDE.md +21 -0
  10. package/framework/agents.json +698 -176
  11. package/framework/hooks/claude-code/post-tool-use/context-refresh.js +1 -1
  12. package/framework/hooks/claude-code/post-tool-use/dispatch.js +2 -2
  13. package/framework/hooks/claude-code/post-tool-use/skill-reminder.js +155 -0
  14. package/framework/hooks/claude-code/pre-tool-use/protect-spec-files.js +1 -1
  15. package/framework/hooks/claude-code/session-start/inject-morph-context.js +71 -2
  16. package/framework/hooks/claude-code/statusline.py +76 -30
  17. package/framework/hooks/claude-code/user-prompt/set-terminal-title.js +14 -6
  18. package/framework/hooks/shared/activity-logger.js +0 -24
  19. package/framework/hooks/shared/phase-utils.js +3 -0
  20. package/framework/hooks/shared/skill-reminder-helpers.js +79 -0
  21. package/framework/hooks/shared/stale-task-reset.js +57 -0
  22. package/framework/hooks/shared/state-reader.js +2 -2
  23. package/framework/hooks/shared/worktree-helpers.js +53 -0
  24. package/framework/phases.json +40 -8
  25. package/framework/skills/level-0-meta/brainstorming/SKILL.md +1 -1
  26. package/framework/skills/level-0-meta/code-review/SKILL.md +1 -1
  27. package/framework/skills/level-0-meta/code-review-nextjs/SKILL.md +163 -163
  28. package/framework/skills/level-0-meta/frontend-review/SKILL.md +5 -5
  29. package/framework/skills/level-0-meta/morph-checklist/SKILL.md +2 -2
  30. package/framework/skills/level-0-meta/morph-init/SKILL.md +5 -5
  31. package/framework/skills/level-0-meta/morph-replicate/SKILL.md +4 -4
  32. package/framework/skills/level-0-meta/morph-replicate/references/blazor-html-mapping.md +1 -1
  33. package/framework/skills/level-0-meta/post-implementation/SKILL.md +59 -12
  34. package/framework/skills/level-0-meta/simulation-checklist/SKILL.md +1 -1
  35. package/framework/skills/level-0-meta/terminal-title/SKILL.md +1 -1
  36. package/framework/skills/level-0-meta/tool-usage-guide/SKILL.md +1 -1
  37. package/framework/skills/level-0-meta/tool-usage-guide/references/tools-per-phase.md +6 -5
  38. package/framework/skills/level-0-meta/verification-before-completion/SKILL.md +1 -1
  39. package/framework/skills/level-1-workflows/phase-clarify/SKILL.md +215 -189
  40. package/framework/skills/level-1-workflows/phase-codebase-analysis/SKILL.md +251 -251
  41. package/framework/skills/level-1-workflows/phase-design/SKILL.md +382 -365
  42. package/framework/skills/level-1-workflows/phase-implement/SKILL.md +492 -450
  43. package/framework/skills/level-1-workflows/phase-setup/SKILL.md +194 -190
  44. package/framework/skills/level-1-workflows/phase-tasks/SKILL.md +270 -270
  45. package/framework/skills/level-1-workflows/phase-uiux/SKILL.md +285 -285
  46. package/framework/standards/STANDARDS.json +640 -88
  47. package/framework/standards/infrastructure/vercel/vercel-database.md +106 -0
  48. package/framework/templates/REGISTRY.json +1825 -1909
  49. package/framework/templates/context/CONTEXT-FEATURE.md +276 -276
  50. package/framework/templates/docs/onboarding.md +1 -5
  51. package/package.json +2 -6
  52. package/src/commands/agents/dispatch-agents.js +55 -4
  53. package/src/commands/project/doctor.js +16 -47
  54. package/src/commands/project/init.js +1 -1
  55. package/src/commands/project/status.js +2 -2
  56. package/src/commands/project/update.js +381 -365
  57. package/src/commands/project/worktree.js +154 -0
  58. package/src/commands/state/advance-phase.js +120 -30
  59. package/src/commands/state/approve.js +2 -2
  60. package/src/commands/state/index.js +7 -8
  61. package/src/commands/state/phase-runner.js +1 -1
  62. package/src/commands/state/state.js +61 -6
  63. package/src/commands/tasks/task.js +78 -99
  64. package/src/commands/templates/template-render.js +93 -173
  65. package/src/commands/trust/trust.js +26 -21
  66. package/src/core/paths/output-schema.js +15 -0
  67. package/src/core/state/state-manager.js +28 -54
  68. package/src/core/workflows/workflow-detector.js +9 -87
  69. package/src/lib/phase-chain/phase-validator.js +330 -0
  70. package/src/lib/stack/stack-profile.js +88 -0
  71. package/src/lib/tasks/task-classifier.js +16 -0
  72. package/src/lib/tasks/test-runner.js +77 -0
  73. package/src/lib/trust/trust-manager.js +32 -144
  74. package/src/lib/validators/spec-validator.js +58 -4
  75. package/src/lib/validators/validation-runner.js +23 -11
  76. package/src/scripts/setup-infra.js +240 -224
  77. package/src/utils/agents-installer.js +2 -2
  78. package/src/utils/banner.js +1 -1
  79. package/src/utils/claude-settings-manager.js +1 -1
  80. package/src/utils/file-copier.js +1 -0
  81. package/src/utils/hooks-installer.js +258 -8
  82. package/framework/hooks/dev/check-sync-health.js +0 -117
  83. package/framework/hooks/dev/guard-version-numbers.js +0 -57
  84. package/framework/hooks/dev/sync-standards-registry.js +0 -60
  85. package/framework/hooks/dev/sync-template-registry.js +0 -60
  86. package/framework/hooks/dev/validate-skill-format.js +0 -70
  87. package/framework/hooks/dev/validate-standard-format.js +0 -73
  88. package/framework/templates/meta-prompts/hops/hop-retry.md +0 -78
  89. package/framework/templates/meta-prompts/hops/hop-validation.md +0 -97
  90. package/framework/templates/meta-prompts/hops/hop-wrapper.md +0 -36
  91. package/framework/workflows/configs/design-impl.json +0 -49
  92. package/framework/workflows/configs/express.json +0 -45
  93. package/framework/workflows/configs/fast-track.json +0 -42
  94. package/framework/workflows/configs/full-morph.json +0 -79
  95. package/framework/workflows/configs/fusion.json +0 -39
  96. package/framework/workflows/configs/long-running.json +0 -33
  97. package/framework/workflows/configs/spec-only.json +0 -43
  98. package/framework/workflows/configs/ui-refresh.json +0 -49
  99. package/framework/workflows/configs/zero-touch.json +0 -82
  100. package/src/commands/project/monitor.js +0 -295
  101. package/src/commands/project/tutorial.js +0 -115
  102. package/src/commands/state/validate-phase.js +0 -238
  103. package/src/commands/templates/generate-contracts.js +0 -445
  104. package/src/core/orchestrator.js +0 -171
  105. package/src/core/registry/command-registry.js +0 -28
  106. package/src/core/registry/index.js +0 -8
  107. package/src/core/registry/validator-registry.js +0 -204
  108. package/src/core/templates/template-validator.js +0 -296
  109. package/src/generator/config-generator.js +0 -206
  110. package/src/generator/templates/config.json.template +0 -40
  111. package/src/generator/templates/project.md.template +0 -67
  112. package/src/lib/agents/micro-agent-factory.js +0 -161
  113. package/src/lib/analysis/complexity-analyzer.js +0 -441
  114. package/src/lib/analysis/index.js +0 -7
  115. package/src/lib/analytics/analytics-engine.js +0 -345
  116. package/src/lib/checkpoints/checkpoint-hooks.js +0 -298
  117. package/src/lib/checkpoints/index.js +0 -7
  118. package/src/lib/context/context-bundler.js +0 -241
  119. package/src/lib/context/context-optimizer.js +0 -212
  120. package/src/lib/context/context-tracker.js +0 -273
  121. package/src/lib/context/core-four-tracker.js +0 -201
  122. package/src/lib/context/mcp-optimizer.js +0 -200
  123. package/src/lib/execution/fusion-executor.js +0 -304
  124. package/src/lib/execution/parallel-executor.js +0 -270
  125. package/src/lib/hooks/stop-hook-executor.js +0 -286
  126. package/src/lib/hops/hop-composer.js +0 -221
  127. package/src/lib/phase-chain/eligibility-checker.js +0 -243
  128. package/src/lib/threads/thread-coordinator.js +0 -238
  129. package/src/lib/threads/thread-manager.js +0 -317
  130. package/src/lib/tracking/artifact-trail.js +0 -202
  131. package/src/scanner/project-scanner.js +0 -242
  132. package/src/ui/diff-display.js +0 -91
  133. package/src/ui/interactive-wizard.js +0 -96
  134. package/src/ui/user-review.js +0 -211
  135. package/src/ui/wizard-questions.js +0 -188
  136. package/src/utils/color-utils.js +0 -70
  137. package/src/utils/process-handler.js +0 -97
@@ -1,188 +0,0 @@
1
- /**
2
- * @fileoverview Wizard Questions - Defines interactive wizard questions
3
- * @module morph-spec/ui/wizard-questions
4
- */
5
-
6
- /**
7
- * Get wizard questions for interactive mode
8
- * @returns {Array} Inquirer questions
9
- */
10
- export function getWizardQuestions() {
11
- return [
12
- {
13
- type: 'input',
14
- name: 'name',
15
- message: '1/7 Project name:',
16
- default: process.cwd().split(/[/\\]/).pop(),
17
- validate: (input) => {
18
- if (!input || input.trim().length === 0) {
19
- return 'Project name is required';
20
- }
21
- return true;
22
- }
23
- },
24
- {
25
- type: 'input',
26
- name: 'description',
27
- message: '2/7 Project description (1-2 sentences):',
28
- validate: (input) => {
29
- if (!input || input.trim().length < 10) {
30
- return 'Description must be at least 10 characters';
31
- }
32
- return true;
33
- }
34
- },
35
- {
36
- type: 'list',
37
- name: 'type',
38
- message: '3/7 Project type:',
39
- choices: [
40
- { name: 'Blazor Server (.NET)', value: 'blazor-server' },
41
- { name: 'Next.js (React)', value: 'nextjs' },
42
- { name: '.NET Web API', value: 'dotnet-api' },
43
- { name: 'CLI Tool', value: 'cli-tool' },
44
- { name: 'Monorepo (multiple projects)', value: 'monorepo' },
45
- { name: 'Other', value: 'other' }
46
- ]
47
- },
48
- {
49
- type: 'list',
50
- name: 'frontend',
51
- message: '4/7 Frontend technology:',
52
- choices: [
53
- { name: 'Blazor Server', value: 'blazor' },
54
- { name: 'Next.js', value: 'nextjs' },
55
- { name: 'React', value: 'react' },
56
- { name: 'Vue.js', value: 'vue' },
57
- { name: 'Angular', value: 'angular' },
58
- { name: 'None (backend-only)', value: null }
59
- ],
60
- when: (answers) => answers.type !== 'cli-tool' && answers.type !== 'dotnet-api'
61
- },
62
- {
63
- type: 'list',
64
- name: 'backend',
65
- message: '5/7 Backend technology:',
66
- choices: [
67
- { name: '.NET 10', value: 'dotnet-10' },
68
- { name: '.NET 9', value: 'dotnet-9' },
69
- { name: '.NET 8', value: 'dotnet-8' },
70
- { name: 'Node.js', value: 'nodejs' },
71
- { name: 'Other', value: 'other' }
72
- ],
73
- default: 'dotnet-10'
74
- },
75
- {
76
- type: 'list',
77
- name: 'database',
78
- message: '6/7 Database:',
79
- choices: [
80
- { name: 'Azure SQL Database', value: 'azure-sql' },
81
- { name: 'PostgreSQL', value: 'postgresql' },
82
- { name: 'Cosmos DB', value: 'cosmosdb' },
83
- { name: 'MongoDB', value: 'mongodb' },
84
- { name: 'SQLite', value: 'sqlite' },
85
- { name: 'Supabase (PostgreSQL)', value: 'supabase' },
86
- { name: 'None (no database)', value: null }
87
- ]
88
- },
89
- {
90
- type: 'confirm',
91
- name: 'hasAzure',
92
- message: '7a/7 Uses Azure infrastructure?',
93
- default: false
94
- },
95
- {
96
- type: 'confirm',
97
- name: 'hasDocker',
98
- message: '7b/7 Uses Docker containerization?',
99
- default: true
100
- }
101
- ];
102
- }
103
-
104
- /**
105
- * Map wizard answers to ProjectConfig
106
- * @param {Object} answers - Wizard answers from inquirer
107
- * @returns {ProjectConfig} Mapped project config
108
- */
109
- export function mapAnswersToConfig(answers) {
110
- // Parse backend tech and version
111
- const backendParts = answers.backend.split('-');
112
- const backendTech = backendParts[0] === 'dotnet' ? '.NET' :
113
- backendParts[0] === 'nodejs' ? 'Node.js' :
114
- answers.backend;
115
- const backendVersion = backendParts[1] || 'latest';
116
-
117
- // Map frontend
118
- let frontend = null;
119
- if (answers.frontend) {
120
- const frontendMap = {
121
- 'blazor': { tech: 'Blazor', version: backendVersion, details: 'Blazor Server' },
122
- 'nextjs': { tech: 'Next.js', version: '15', details: 'App Router' },
123
- 'react': { tech: 'React', version: '18', details: null },
124
- 'vue': { tech: 'Vue.js', version: '3', details: null },
125
- 'angular': { tech: 'Angular', version: '17', details: null }
126
- };
127
- frontend = frontendMap[answers.frontend] || null;
128
- }
129
-
130
- // Map database
131
- let database = null;
132
- if (answers.database) {
133
- const databaseMap = {
134
- 'azure-sql': { tech: 'Azure SQL', version: 'latest', details: 'Managed SQL Database' },
135
- 'postgresql': { tech: 'PostgreSQL', version: '16', details: null },
136
- 'cosmosdb': { tech: 'Cosmos DB', version: 'latest', details: 'NoSQL' },
137
- 'mongodb': { tech: 'MongoDB', version: '7', details: null },
138
- 'sqlite': { tech: 'SQLite', version: '3', details: null },
139
- 'supabase': { tech: 'PostgreSQL', version: '16', details: 'Managed by Supabase' }
140
- };
141
- database = databaseMap[answers.database] || null;
142
- }
143
-
144
- // Infer architecture from project type
145
- const architectureMap = {
146
- 'blazor-server': 'clean-architecture',
147
- 'nextjs': 'layered',
148
- 'dotnet-api': 'clean-architecture',
149
- 'cli-tool': 'monolith',
150
- 'monorepo': 'microservices',
151
- 'other': 'layered'
152
- };
153
-
154
- const architecture = architectureMap[answers.type] || 'layered';
155
-
156
- // Infer hosting
157
- let hosting = null;
158
- if (answers.hasAzure) {
159
- hosting = 'Azure';
160
- } else if (answers.hasDocker) {
161
- hosting = 'Docker';
162
- }
163
-
164
- return {
165
- name: answers.name,
166
- description: answers.description,
167
- type: answers.type,
168
- stack: {
169
- frontend,
170
- backend: {
171
- tech: backendTech,
172
- version: backendVersion,
173
- details: null
174
- },
175
- database,
176
- hosting
177
- },
178
- architecture,
179
- projectStructure: 'User-specified configuration via interactive wizard',
180
- conventions: 'Standard conventions for ' + backendTech,
181
- repository: null,
182
- hasAzure: answers.hasAzure,
183
- hasDocker: answers.hasDocker,
184
- hasDevOps: false,
185
- confidence: 100, // User input is 100% confident
186
- warnings: ['Configuration was manually entered, not auto-detected']
187
- };
188
- }
@@ -1,70 +0,0 @@
1
- /**
2
- * Unified color utilities for CLI output
3
- *
4
- * Replaces manual ANSI codes with consistent chalk usage.
5
- * Standardizes color handling across the codebase.
6
- */
7
-
8
- import chalk from 'chalk';
9
-
10
- // Re-export chalk for direct usage
11
- export { chalk };
12
-
13
- /**
14
- * Predefined color functions for common use cases
15
- */
16
- export const colors = {
17
- error: chalk.red,
18
- success: chalk.green,
19
- warning: chalk.yellow,
20
- info: chalk.blue,
21
- dim: chalk.gray,
22
- bold: chalk.bold,
23
- highlight: chalk.cyan,
24
- };
25
-
26
- /**
27
- * Status indicators with colors
28
- */
29
- export const status = {
30
- success: chalk.green('✓'),
31
- error: chalk.red('✗'),
32
- warning: chalk.yellow('⚠'),
33
- info: chalk.blue('ℹ'),
34
- };
35
-
36
- /**
37
- * Format a success message
38
- * @param {string} message - Message to format
39
- * @returns {string} Formatted message
40
- */
41
- export function formatSuccess(message) {
42
- return `${status.success} ${chalk.green(message)}`;
43
- }
44
-
45
- /**
46
- * Format an error message
47
- * @param {string} message - Message to format
48
- * @returns {string} Formatted message
49
- */
50
- export function formatError(message) {
51
- return `${status.error} ${chalk.red(message)}`;
52
- }
53
-
54
- /**
55
- * Format a warning message
56
- * @param {string} message - Message to format
57
- * @returns {string} Formatted message
58
- */
59
- export function formatWarning(message) {
60
- return `${status.warning} ${chalk.yellow(message)}`;
61
- }
62
-
63
- /**
64
- * Format an info message
65
- * @param {string} message - Message to format
66
- * @returns {string} Formatted message
67
- */
68
- export function formatInfo(message) {
69
- return `${status.info} ${chalk.blue(message)}`;
70
- }
@@ -1,97 +0,0 @@
1
- /**
2
- * Process Handler - Testable Exit Strategy
3
- *
4
- * Replaces direct process.exit() calls with a mockable handler.
5
- * Makes the codebase testable by allowing exit behavior to be intercepted.
6
- *
7
- * @module process-handler
8
- */
9
-
10
- import chalk from 'chalk';
11
-
12
- /**
13
- * Process Handler Class
14
- *
15
- * Provides testable process exit functionality.
16
- */
17
- export class ProcessHandler {
18
- /**
19
- * @param {Function} exitFn - Exit function (defaults to process.exit)
20
- */
21
- constructor(exitFn = process.exit.bind(process)) {
22
- this.exitFn = exitFn;
23
- }
24
-
25
- /**
26
- * Exit the process with optional message
27
- *
28
- * @param {number} code - Exit code (0 = success, non-zero = error)
29
- * @param {string} [message] - Optional message to display
30
- */
31
- exit(code = 0, message = null) {
32
- if (message) {
33
- if (code === 0) {
34
- console.log(message);
35
- } else {
36
- console.error(message);
37
- }
38
- }
39
- this.exitFn(code);
40
- }
41
-
42
- /**
43
- * Exit with error message (code 1)
44
- *
45
- * @param {string} message - Error message
46
- * @param {number} [code=1] - Error code
47
- */
48
- exitWithError(message, code = 1) {
49
- this.exit(code, chalk.red(message));
50
- }
51
-
52
- /**
53
- * Exit with success message (code 0)
54
- *
55
- * @param {string} message - Success message
56
- */
57
- exitWithSuccess(message) {
58
- this.exit(0, chalk.green(message));
59
- }
60
-
61
- /**
62
- * Exit with warning message (code 0, but highlighted)
63
- *
64
- * @param {string} message - Warning message
65
- */
66
- exitWithWarning(message) {
67
- this.exit(0, chalk.yellow(message));
68
- }
69
- }
70
-
71
- // Default instance for general use
72
- export const processHandler = new ProcessHandler();
73
-
74
- /**
75
- * Create a test handler for unit tests
76
- *
77
- * @returns {{handler: ProcessHandler, getExitCode: Function, getExited: Function}}
78
- */
79
- export function createTestHandler() {
80
- let exitCode = null;
81
- let exited = false;
82
-
83
- const handler = new ProcessHandler((code) => {
84
- exitCode = code;
85
- exited = true;
86
- });
87
-
88
- return {
89
- handler,
90
- getExitCode: () => exitCode,
91
- getExited: () => exited,
92
- reset: () => {
93
- exitCode = null;
94
- exited = false;
95
- },
96
- };
97
- }