@polymorphism-tech/morph-spec 4.9.0 → 4.10.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 (164) hide show
  1. package/README.md +2 -2
  2. package/bin/morph-spec.js +30 -0
  3. package/bin/task-manager.js +34 -22
  4. package/claude-plugin.json +1 -1
  5. package/docs/CHEATSHEET.md +1 -1
  6. package/docs/QUICKSTART.md +1 -1
  7. package/framework/CLAUDE.md +35 -98
  8. package/framework/agents/backend/api-designer.md +3 -0
  9. package/framework/agents/backend/dotnet-senior.md +3 -0
  10. package/framework/agents/backend/ef-modeler.md +2 -0
  11. package/framework/agents/backend/hangfire-orchestrator.md +2 -0
  12. package/framework/agents/backend/ms-agent-expert.md +2 -0
  13. package/framework/agents/frontend/blazor-builder.md +2 -0
  14. package/framework/agents/frontend/nextjs-expert.md +2 -0
  15. package/framework/agents/infrastructure/azure-architect.md +2 -0
  16. package/framework/agents/infrastructure/azure-deploy-specialist.md +2 -0
  17. package/framework/agents/infrastructure/bicep-architect.md +2 -0
  18. package/framework/agents/infrastructure/container-specialist.md +2 -0
  19. package/framework/agents/infrastructure/devops-engineer.md +3 -0
  20. package/framework/agents/infrastructure/infra-architect.md +3 -0
  21. package/framework/agents/integrations/asaas-financial.md +2 -0
  22. package/framework/agents/integrations/azure-identity.md +2 -0
  23. package/framework/agents/integrations/clerk-auth.md +3 -0
  24. package/framework/agents/integrations/hangfire-integration.md +2 -0
  25. package/framework/agents/integrations/resend-email.md +2 -0
  26. package/framework/agents.json +37 -7
  27. package/framework/commands/commit.md +166 -0
  28. package/framework/commands/morph-apply.md +156 -155
  29. package/framework/commands/morph-archive.md +33 -27
  30. package/framework/commands/morph-infra.md +83 -77
  31. package/framework/commands/morph-preflight.md +97 -55
  32. package/framework/commands/morph-proposal.md +131 -58
  33. package/framework/commands/morph-status.md +36 -30
  34. package/framework/commands/morph-troubleshoot.md +68 -59
  35. package/framework/hooks/claude-code/notification/approval-reminder.js +3 -2
  36. package/framework/hooks/claude-code/post-tool-use/dispatch.js +154 -31
  37. package/framework/hooks/claude-code/post-tool-use/skill-reminder.js +7 -84
  38. package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +8 -17
  39. package/framework/hooks/claude-code/pre-compact/save-morph-context.js +16 -3
  40. package/framework/hooks/claude-code/pre-tool-use/enforce-phase-writes.js +4 -3
  41. package/framework/hooks/claude-code/pre-tool-use/protect-spec-files.js +3 -2
  42. package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +60 -0
  43. package/framework/hooks/claude-code/session-start/inject-morph-context.js +55 -2
  44. package/framework/hooks/claude-code/session-start/post-compact-restore.js +41 -0
  45. package/framework/hooks/claude-code/stop/validate-completion.js +2 -15
  46. package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +23 -5
  47. package/framework/hooks/shared/compact-restore.js +100 -0
  48. package/framework/hooks/shared/dispatch-helpers.js +116 -0
  49. package/framework/hooks/shared/phase-utils.js +9 -5
  50. package/framework/hooks/shared/state-reader.js +27 -3
  51. package/framework/phases.json +30 -7
  52. package/framework/rules/csharp-standards.md +3 -0
  53. package/framework/rules/frontend-standards.md +2 -0
  54. package/framework/rules/infrastructure-standards.md +3 -0
  55. package/framework/rules/morph-workflow.md +143 -86
  56. package/framework/rules/nextjs-standards.md +2 -0
  57. package/framework/rules/testing-standards.md +3 -0
  58. package/framework/skills/level-0-meta/mcp-registry.json +86 -51
  59. package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +139 -0
  60. package/framework/skills/level-0-meta/morph-checklist/SKILL.md +42 -19
  61. package/framework/skills/level-0-meta/{code-review → morph-code-review}/SKILL.md +8 -5
  62. package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/SKILL.md +8 -6
  63. package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +362 -0
  64. package/framework/skills/level-0-meta/morph-init/SKILL.md +114 -20
  65. package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +362 -0
  66. package/framework/skills/level-0-meta/morph-replicate/SKILL.md +95 -87
  67. package/framework/skills/level-0-meta/{simulation-checklist → morph-simulation-checklist}/SKILL.md +24 -0
  68. package/framework/skills/level-0-meta/{tool-usage-guide → morph-tool-usage-guide}/SKILL.md +43 -43
  69. package/framework/skills/level-0-meta/{tool-usage-guide → morph-tool-usage-guide}/references/tools-per-phase.md +1 -2
  70. package/framework/skills/level-0-meta/{verification-before-completion → morph-verification-before-completion}/SKILL.md +23 -12
  71. package/framework/skills/level-0-meta/{verification-before-completion → morph-verification-before-completion}/scripts/check-phase-outputs.mjs +2 -2
  72. package/framework/skills/level-1-workflows/morph-phase-clarify/SKILL.md +247 -0
  73. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +270 -0
  74. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +499 -0
  75. package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +38 -0
  76. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +472 -0
  77. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +50 -0
  78. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +45 -0
  79. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +47 -0
  80. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +246 -0
  81. package/framework/skills/level-1-workflows/morph-phase-setup/SKILL.md +238 -0
  82. package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +14 -0
  83. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +312 -0
  84. package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/scripts/validate-tasks.mjs +3 -3
  85. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +324 -0
  86. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +146 -0
  87. package/framework/standards/integration/mcp/mcp-tools.md +25 -7
  88. package/framework/templates/docs/onboarding.md +2 -2
  89. package/package.json +3 -4
  90. package/src/commands/agents/dispatch-agents.js +50 -3
  91. package/src/commands/mcp/mcp-setup.js +39 -2
  92. package/src/commands/phase/phase-reset.js +74 -0
  93. package/src/commands/project/doctor.js +26 -7
  94. package/src/commands/project/update.js +4 -4
  95. package/src/commands/scope/escalate.js +215 -0
  96. package/src/commands/state/advance-phase.js +27 -53
  97. package/src/commands/state/state.js +1 -1
  98. package/src/commands/task/expand.js +100 -0
  99. package/src/core/paths/output-schema.js +4 -3
  100. package/src/core/state/phase-state-machine.js +7 -4
  101. package/src/core/state/state-manager.js +4 -3
  102. package/src/lib/detectors/claude-config-detector.js +93 -347
  103. package/src/lib/detectors/design-system-detector.js +189 -189
  104. package/src/lib/detectors/index.js +155 -57
  105. package/src/lib/generators/context-generator.js +2 -2
  106. package/src/lib/installers/mcp-installer.js +37 -5
  107. package/src/lib/phase-chain/phase-validator.js +22 -16
  108. package/src/lib/scope/impact-analyzer.js +106 -0
  109. package/src/lib/stack-filter.js +58 -0
  110. package/src/lib/tasks/task-parser.js +1 -1
  111. package/src/lib/validators/shared/emit-validator-dispatch.js +64 -0
  112. package/src/scripts/setup-infra.js +68 -18
  113. package/src/utils/agents-installer.js +51 -17
  114. package/src/utils/claude-md-injector.js +90 -0
  115. package/src/utils/file-copier.js +0 -1
  116. package/src/utils/hooks-installer.js +16 -5
  117. package/src/utils/skills-installer.js +67 -7
  118. package/CLAUDE.md +0 -98
  119. package/framework/memory/patterns-learned.md +0 -766
  120. package/framework/skills/level-0-meta/brainstorming/SKILL.md +0 -137
  121. package/framework/skills/level-0-meta/frontend-review/SKILL.md +0 -359
  122. package/framework/skills/level-0-meta/post-implementation/SKILL.md +0 -362
  123. package/framework/skills/level-0-meta/terminal-title/SKILL.md +0 -61
  124. package/framework/skills/level-0-meta/terminal-title/scripts/set_title.sh +0 -65
  125. package/framework/skills/level-1-workflows/phase-clarify/SKILL.md +0 -216
  126. package/framework/skills/level-1-workflows/phase-codebase-analysis/SKILL.md +0 -252
  127. package/framework/skills/level-1-workflows/phase-design/SKILL.md +0 -383
  128. package/framework/skills/level-1-workflows/phase-implement/SKILL.md +0 -492
  129. package/framework/skills/level-1-workflows/phase-setup/SKILL.md +0 -195
  130. package/framework/skills/level-1-workflows/phase-tasks/SKILL.md +0 -271
  131. package/framework/skills/level-1-workflows/phase-uiux/SKILL.md +0 -286
  132. package/src/commands/project/index.js +0 -8
  133. package/src/core/index.js +0 -10
  134. package/src/core/state/index.js +0 -8
  135. package/src/core/templates/index.js +0 -9
  136. package/src/core/templates/template-data-sources.js +0 -325
  137. package/src/core/workflows/index.js +0 -7
  138. package/src/lib/detectors/config-detector.js +0 -223
  139. package/src/lib/detectors/standards-generator.js +0 -335
  140. package/src/lib/detectors/structure-detector.js +0 -275
  141. package/src/lib/monitor/agent-resolver.js +0 -144
  142. package/src/lib/monitor/renderer.js +0 -230
  143. package/src/lib/orchestration/index.js +0 -7
  144. package/src/lib/orchestration/team-orchestrator.js +0 -404
  145. package/src/sanitizer/context-sanitizer.js +0 -221
  146. package/src/sanitizer/patterns.js +0 -163
  147. package/src/writer/file-writer.js +0 -86
  148. /package/framework/skills/level-0-meta/{brainstorming → morph-brainstorming}/references/proposal-example.md +0 -0
  149. /package/framework/skills/level-0-meta/{code-review → morph-code-review}/references/review-example.md +0 -0
  150. /package/framework/skills/level-0-meta/{code-review → morph-code-review}/references/review-guidelines.md +0 -0
  151. /package/framework/skills/level-0-meta/{code-review → morph-code-review}/scripts/scan-csharp.mjs +0 -0
  152. /package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/references/review-example-nextjs.md +0 -0
  153. /package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/scripts/scan-nextjs.mjs +0 -0
  154. /package/framework/skills/level-0-meta/{frontend-review → morph-frontend-review}/scripts/scan-accessibility.mjs +0 -0
  155. /package/framework/skills/level-0-meta/{post-implementation → morph-post-implementation}/scripts/detect-dev-server.mjs +0 -0
  156. /package/framework/skills/level-0-meta/{post-implementation → morph-post-implementation}/scripts/detect-stack.mjs +0 -0
  157. /package/framework/skills/level-1-workflows/{phase-clarify → morph-phase-clarify}/references/clarifications-example.md +0 -0
  158. /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/architecture-analysis-guide.md +0 -0
  159. /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/spec-authoring-guide.md +0 -0
  160. /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/spec-example.md +0 -0
  161. /package/framework/skills/level-1-workflows/{phase-implement → morph-phase-implement}/references/recap-example.md +0 -0
  162. /package/framework/skills/level-1-workflows/{phase-implement → morph-phase-implement}/references/vsa-implementation-guide.md +0 -0
  163. /package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/references/task-planning-patterns.md +0 -0
  164. /package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/references/tasks-example.md +0 -0
@@ -1,163 +0,0 @@
1
- /**
2
- * @fileoverview Sanitization patterns - Whitelists, Blacklists, Secret patterns
3
- * @module morph-spec/sanitizer/patterns
4
- */
5
-
6
- /**
7
- * Whitelist: Files explicitly allowed to be read and sent to LLM
8
- */
9
- export const WHITELIST_FILES = [
10
- 'package.json',
11
- 'package-lock.json',
12
- 'yarn.lock',
13
- 'pnpm-lock.yaml',
14
- '*.csproj',
15
- '*.sln',
16
- 'README.md',
17
- 'CLAUDE.md',
18
- 'Dockerfile',
19
- 'docker-compose.yml',
20
- 'docker-compose.*.yml',
21
- '*.bicep',
22
- 'azure-pipelines.yml',
23
- '.github/workflows/*.yml',
24
- '.gitlab-ci.yml',
25
- 'tsconfig.json',
26
- 'jsconfig.json',
27
- '.eslintrc*',
28
- '.prettierrc*',
29
- 'vite.config.*',
30
- 'next.config.*',
31
- 'nuxt.config.*'
32
- ];
33
-
34
- /**
35
- * Blacklist: Directories to NEVER scan or read
36
- */
37
- export const BLACKLIST_DIRECTORIES = [
38
- 'node_modules',
39
- '.git',
40
- '.svn',
41
- '.hg',
42
- 'bin',
43
- 'obj',
44
- 'dist',
45
- 'build',
46
- 'out',
47
- '.next',
48
- '.nuxt',
49
- 'coverage',
50
- '__pycache__',
51
- '.pytest_cache',
52
- 'venv',
53
- 'env',
54
- '.venv',
55
- '.env.*',
56
- 'temp',
57
- 'tmp',
58
- '.cache'
59
- ];
60
-
61
- /**
62
- * Blacklist: File patterns to NEVER read (even if matched by whitelist)
63
- */
64
- export const BLACKLIST_FILES = [
65
- '.env',
66
- '.env.local',
67
- '.env.*.local',
68
- '.env.production',
69
- '*.key',
70
- '*.pem',
71
- '*.pfx',
72
- '*.p12',
73
- '*.cert',
74
- '*.crt',
75
- '*secret*',
76
- '*password*',
77
- '*credentials*',
78
- '*token*',
79
- 'secrets.json',
80
- 'appsettings.Production.json',
81
- 'appsettings.Staging.json',
82
- '*.log',
83
- '*.sqlite',
84
- '*.db'
85
- ];
86
-
87
- /**
88
- * Secret patterns to redact from file contents
89
- * Each pattern has: regex, replacement text, description
90
- */
91
- export const SECRET_PATTERNS = [
92
- {
93
- name: 'api-key',
94
- regex: /(?:api[_-]?key|apikey|api[_-]?secret)[\s:=]+["']?([a-zA-Z0-9_\-]{20,})["']?/gi,
95
- replacement: 'API_KEY=***REDACTED***',
96
- description: 'API keys'
97
- },
98
- {
99
- name: 'bearer-token',
100
- regex: /(?:bearer|authorization)[\s:=]+["']?([a-zA-Z0-9_\-\.]{20,})["']?/gi,
101
- replacement: 'Bearer ***REDACTED***',
102
- description: 'Bearer tokens'
103
- },
104
- {
105
- name: 'connection-string',
106
- regex: /(?:connection[_-]?string|connectionstring)[\s:=]+["']?([^"'\n]{30,})["']?/gi,
107
- replacement: 'ConnectionString=***REDACTED***',
108
- description: 'Connection strings'
109
- },
110
- {
111
- name: 'sql-password',
112
- regex: /(?:password|pwd)=([^;"\s]{6,})/gi,
113
- replacement: 'Password=***REDACTED***',
114
- description: 'SQL passwords in connection strings'
115
- },
116
- {
117
- name: 'azure-key',
118
- regex: /(?:account[_-]?key|accountkey)[\s:=]+["']?([a-zA-Z0-9+/=]{40,})["']?/gi,
119
- replacement: 'AccountKey=***REDACTED***',
120
- description: 'Azure Storage Account Keys'
121
- },
122
- {
123
- name: 'jwt-secret',
124
- regex: /(?:jwt[_-]?secret|jwtsecret)[\s:=]+["']?([a-zA-Z0-9_\-]{16,})["']?/gi,
125
- replacement: 'JwtSecret=***REDACTED***',
126
- description: 'JWT secrets'
127
- },
128
- {
129
- name: 'private-key',
130
- regex: /-----BEGIN (?:RSA |EC )?PRIVATE KEY-----[\s\S]+?-----END (?:RSA |EC )?PRIVATE KEY-----/gi,
131
- replacement: '-----BEGIN PRIVATE KEY-----\n***REDACTED***\n-----END PRIVATE KEY-----',
132
- description: 'Private keys (PEM format)'
133
- },
134
- {
135
- name: 'github-token',
136
- regex: /gh[pousr]_[a-zA-Z0-9]{36,}/gi,
137
- replacement: 'ghp_***REDACTED***',
138
- description: 'GitHub personal access tokens'
139
- },
140
- {
141
- name: 'npm-token',
142
- regex: /npm_[a-zA-Z0-9]{36,}/gi,
143
- replacement: 'npm_***REDACTED***',
144
- description: 'NPM tokens'
145
- },
146
- {
147
- name: 'generic-secret',
148
- regex: /(?:secret|password|pwd|pass|token)[\s:=]+["']([^"'\n]{8,})["']/gi,
149
- replacement: 'secret=***REDACTED***',
150
- description: 'Generic secrets'
151
- }
152
- ];
153
-
154
- /**
155
- * Maximum file size to include (50KB)
156
- * Files larger than this are truncated with a summary
157
- */
158
- export const MAX_FILE_SIZE = 50 * 1024; // 50KB
159
-
160
- /**
161
- * Maximum content length for README/CLAUDE.md summaries
162
- */
163
- export const MAX_SUMMARY_LENGTH = 500; // 500 chars
@@ -1,86 +0,0 @@
1
- /**
2
- * @fileoverview FileWriter - Saves generated configs to filesystem
3
- * @module morph-spec/writer/file-writer
4
- */
5
-
6
- import { writeFile, mkdir, access } from 'fs/promises';
7
- import { join, dirname } from 'path';
8
- import chalk from 'chalk';
9
-
10
- /**
11
- * @typedef {import('../types/index.js').GeneratedConfigs} GeneratedConfigs
12
- */
13
-
14
- /**
15
- * FileWriter - Saves configuration files to .morph/ directory
16
- * @class
17
- */
18
- export class FileWriter {
19
- /**
20
- * Save generated configs to filesystem
21
- * @param {string} cwd - Current working directory
22
- * @param {GeneratedConfigs} configs - Configs to save
23
- * @returns {Promise<void>}
24
- */
25
- async save(cwd, configs) {
26
- const morphDir = join(cwd, '.morph');
27
- const configDir = join(morphDir, 'config');
28
-
29
- // Ensure directories exist
30
- await this.ensureDirectoryExists(morphDir);
31
- await this.ensureDirectoryExists(configDir);
32
-
33
- // Write files
34
- const projectMdPath = join(morphDir, 'project.md');
35
- const configJsonPath = join(configDir, 'config.json');
36
-
37
- await Promise.all([
38
- this.writeProjectMd(projectMdPath, configs.projectMd),
39
- this.writeConfigJson(configJsonPath, configs.configJson)
40
- ]);
41
-
42
- // Display success message
43
- console.log(chalk.bold.green('\n✅ Configuration files saved:\n'));
44
- console.log(chalk.cyan(` 📄 ${projectMdPath}`));
45
- console.log(chalk.cyan(` ⚙️ ${configJsonPath}`));
46
- console.log();
47
- }
48
-
49
- /**
50
- * Write project.md file
51
- * @param {string} filepath - File path
52
- * @param {string} content - File content
53
- * @returns {Promise<void>}
54
- */
55
- async writeProjectMd(filepath, content) {
56
- await writeFile(filepath, content, 'utf-8');
57
- }
58
-
59
- /**
60
- * Write config.json file (with pretty formatting)
61
- * @param {string} filepath - File path
62
- * @param {string} content - File content (JSON string)
63
- * @returns {Promise<void>}
64
- */
65
- async writeConfigJson(filepath, content) {
66
- // Parse and re-stringify with pretty formatting
67
- const parsed = JSON.parse(content);
68
- const formatted = JSON.stringify(parsed, null, 2);
69
-
70
- await writeFile(filepath, formatted, 'utf-8');
71
- }
72
-
73
- /**
74
- * Ensure directory exists (create if not)
75
- * @param {string} dirPath - Directory path
76
- * @returns {Promise<void>}
77
- */
78
- async ensureDirectoryExists(dirPath) {
79
- try {
80
- await access(dirPath);
81
- } catch (error) {
82
- // Directory doesn't exist, create it
83
- await mkdir(dirPath, { recursive: true });
84
- }
85
- }
86
- }