@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,224 +1,240 @@
1
- /**
2
- * setup-infra.js
3
- *
4
- * Headless infrastructure setup for MORPH-SPEC.
5
- * Extracted from init.js (steps 1-10) so it can be called by the
6
- * /morph-init Claude Code skill via `morph-spec setup-infra` without
7
- * interactive prompts or stack detection.
8
- *
9
- * Usage:
10
- * import { setupInfra } from './setup-infra.js';
11
- * await setupInfra('/path/to/project');
12
- */
13
-
14
- import { join, dirname } from 'path';
15
- import { fileURLToPath } from 'url';
16
- import { execSync } from 'child_process';
17
- import {
18
- copyDirectory,
19
- copyFile,
20
- pathExists,
21
- writeJson,
22
- ensureDir,
23
- writeFile,
24
- updateGitignore
25
- } from '../utils/file-copier.js';
26
- import { saveProjectMorphVersion, getInstalledCLIVersion } from '../utils/version-checker.js';
27
- import { installClaudeHooks, installGlobalStatusline } from '../utils/claude-settings-manager.js';
28
- import { installSkills } from '../utils/skills-installer.js';
29
- import { installAgents, installDomainAgents } from '../utils/agents-installer.js';
30
-
31
- const FRAMEWORK_DIR = join(dirname(fileURLToPath(import.meta.url)), '..', '..', 'framework');
32
-
33
- const REQUIRED_PLUGINS = [
34
- 'superpowers@claude-plugins-official',
35
- 'context7@claude-plugins-official',
36
- ];
37
-
38
- async function installRequiredPlugins(log, exec) {
39
- log('Step 0: Installing required Claude Code plugins...');
40
- for (const plugin of REQUIRED_PLUGINS) {
41
- try {
42
- exec(`claude plugin install ${plugin}`, { stdio: 'inherit' });
43
- log(` ✓ ${plugin}`);
44
- } catch {
45
- log(` ⚠ Failed to install ${plugin} — install manually: claude plugin install ${plugin}`);
46
- }
47
- }
48
- }
49
-
50
- /**
51
- * Installs MORPH-SPEC infrastructure into the target project directory.
52
- * Headless — no prompts, no spinner (suppressed when MORPH_QUIET=1), no stack detection.
53
- *
54
- * @param {string} targetPath - Absolute path to the target project directory
55
- */
56
- export async function setupInfra(targetPath, { _exec = execSync } = {}) {
57
- const quiet = process.env.MORPH_QUIET === '1';
58
-
59
- function log(msg) {
60
- if (!quiet) process.stdout.write(msg + '\n');
61
- }
62
-
63
- // --- 0. Install required Claude Code plugins ---
64
- await installRequiredPlugins(log, _exec);
65
-
66
- // --- 1. Copy CLAUDE.md (backup existing non-MORPH CLAUDE.md) ---
67
- log('Step 1: Copying CLAUDE.md...');
68
- const claudeMdSrc = join(FRAMEWORK_DIR, 'CLAUDE.md');
69
- const claudeMdDest = join(targetPath, 'CLAUDE.md');
70
-
71
- if (await pathExists(claudeMdDest)) {
72
- const { readFile } = await import('../utils/file-copier.js');
73
- const existingContent = await readFile(claudeMdDest);
74
- if (!existingContent.includes('MORPH-SPEC')) {
75
- await copyFile(claudeMdDest, `${claudeMdDest}.backup`);
76
- }
77
- }
78
- await copyFile(claudeMdSrc, claudeMdDest);
79
-
80
- // --- 2. Create .morph directory structure ---
81
- log('Step 2: Creating .morph structure...');
82
- const morphPath = join(targetPath, '.morph');
83
- const configDir = join(morphPath, 'config');
84
- const frameworkDestDir = join(morphPath, 'framework');
85
- const contextDir = join(morphPath, 'context');
86
- const featuresDir = join(morphPath, 'features');
87
- const checkpointsDir = join(morphPath, 'checkpoints');
88
- const memoryDir = join(morphPath, 'memory');
89
- const archiveDir = join(morphPath, 'archive');
90
-
91
- await ensureDir(configDir);
92
- await ensureDir(frameworkDestDir);
93
- await ensureDir(contextDir);
94
- await ensureDir(featuresDir);
95
- await ensureDir(checkpointsDir);
96
- await ensureDir(memoryDir);
97
- await ensureDir(archiveDir);
98
-
99
- // --- 3. Write minimal config.json (only if not exists) ---
100
- log('Step 3: Writing config.json...');
101
- const configPath = join(configDir, 'config.json');
102
- if (!(await pathExists(configPath))) {
103
- const dirName = targetPath.split(/[\/]/).pop();
104
- const config = {
105
- framework: 'global',
106
- frameworkVersion: getInstalledCLIVersion(),
107
- project: {
108
- name: dirName
109
- }
110
- };
111
- await writeJson(configPath, config);
112
- }
113
-
114
- // --- 4. Write placeholder context/README.md (only if not exists) ---
115
- log('Step 4: Writing context/README.md...');
116
- const contextReadmePath = join(contextDir, 'README.md');
117
- if (!(await pathExists(contextReadmePath))) {
118
- const dirName = targetPath.split(/[\/]/).pop();
119
- const readmeContent = `# ${dirName} — Project Context\n\nRun /morph-init to generate project context.\n`;
120
- await writeFile(contextReadmePath, readmeContent);
121
- }
122
-
123
- // --- 5. Copy framework/templates → .morph/framework/templates ---
124
- log('Step 5: Copying framework templates...');
125
- const frameworkTemplatesSrc = join(FRAMEWORK_DIR, 'templates');
126
- const templatesDest = join(frameworkDestDir, 'templates');
127
- if (await pathExists(frameworkTemplatesSrc)) {
128
- await copyDirectory(frameworkTemplatesSrc, templatesDest);
129
- } else {
130
- await ensureDir(templatesDest);
131
- }
132
-
133
- // --- 6. Copy framework/standards → .morph/framework/standards ---
134
- log('Step 6: Copying framework standards...');
135
- const frameworkStandardsSrc = join(FRAMEWORK_DIR, 'standards');
136
- const frameworkStandardsDest = join(frameworkDestDir, 'standards');
137
- if (await pathExists(frameworkStandardsSrc)) {
138
- await copyDirectory(frameworkStandardsSrc, frameworkStandardsDest);
139
- }
140
-
141
- // --- 7. Copy framework/hooks → .morph/framework/hooks ---
142
- log('Step 7: Copying hooks...');
143
- const hooksSrc = join(FRAMEWORK_DIR, 'hooks');
144
- const hooksDest = join(frameworkDestDir, 'hooks');
145
- if (await pathExists(hooksSrc)) {
146
- await copyDirectory(hooksSrc, hooksDest);
147
- }
148
-
149
- // --- 8. Copy framework/agents.json → .morph/framework/agents.json ---
150
- log('Step 8: Copying agents.json...');
151
- const agentsSrc = join(FRAMEWORK_DIR, 'agents.json');
152
- const agentsDest = join(frameworkDestDir, 'agents.json');
153
- if (await pathExists(agentsSrc)) {
154
- await copyFile(agentsSrc, agentsDest);
155
- }
156
-
157
- // --- 9. Copy framework/commands → .claude/commands ---
158
- log('Step 9: Setting up Claude Code integration...');
159
- const claudeDest = join(targetPath, '.claude');
160
- const commandsSrc = join(FRAMEWORK_DIR, 'commands');
161
- const commandsDest = join(claudeDest, 'commands');
162
- if (await pathExists(commandsSrc)) {
163
- await copyDirectory(commandsSrc, commandsDest);
164
- }
165
-
166
- // --- 10. Copy framework/rules → .claude/rules ---
167
- log('Step 10: Installing path-scoped rules...');
168
- const rulesSrc = join(FRAMEWORK_DIR, 'rules');
169
- const rulesDest = join(claudeDest, 'rules');
170
- if (await pathExists(rulesSrc)) {
171
- await copyDirectory(rulesSrc, rulesDest);
172
- }
173
-
174
- // --- 11. installSkills ---
175
- log('Step 11: Installing skills...');
176
- await installSkills(targetPath);
177
-
178
- // --- 12. installAgents ---
179
- log('Step 12: Installing agents...');
180
- const agentCounts = await installAgents(targetPath, FRAMEWORK_DIR, { projectStack: null });
181
-
182
- // --- 13. installDomainAgents ---
183
- log('Step 13: Installing domain agents...');
184
- const domainCounts = await installDomainAgents(targetPath, FRAMEWORK_DIR);
185
-
186
- // --- 14. Copy framework/CLAUDE.md → .claude/CLAUDE.md ---
187
- log('Step 14: Installing .claude/CLAUDE.md...');
188
- const runtimeClaudeMdDest = join(claudeDest, 'CLAUDE.md');
189
- if (await pathExists(claudeMdSrc)) {
190
- await copyFile(claudeMdSrc, runtimeClaudeMdDest);
191
- }
192
-
193
- // --- 15. installGlobalStatusline (non-critical) ---
194
- log('Step 15: Installing global statusline...');
195
- const HOOKS_SRC = join(FRAMEWORK_DIR, 'hooks', 'claude-code');
196
- try {
197
- await installGlobalStatusline(HOOKS_SRC);
198
- } catch {
199
- // Non-critical — global ~/.claude may not be writable
200
- }
201
-
202
- // --- 16. installClaudeHooks ---
203
- log('Step 16: Installing Claude Code hooks...');
204
- await installClaudeHooks(targetPath);
205
-
206
- // --- 17. saveProjectMorphVersion ---
207
- log('Step 17: Saving version info...');
208
- const cliVersion = getInstalledCLIVersion();
209
- await saveProjectMorphVersion(targetPath, cliVersion);
210
-
211
- // --- 18. updateGitignore ---
212
- log('Step 18: Updating .gitignore...');
213
- await updateGitignore(targetPath);
214
-
215
- log('setup-infra: complete.');
216
-
217
- return {
218
- agents: {
219
- tier1: agentCounts?.tier1 ?? 0,
220
- tier2: agentCounts?.tier2 ?? 0,
221
- specialists: domainCounts?.specialists ?? 0,
222
- },
223
- };
224
- }
1
+ /**
2
+ * setup-infra.js
3
+ *
4
+ * Headless infrastructure setup for MORPH-SPEC.
5
+ * Extracted from init.js (steps 1-10) so it can be called by the
6
+ * /morph-init Claude Code skill via `morph-spec setup-infra` without
7
+ * interactive prompts or stack detection.
8
+ *
9
+ * Usage:
10
+ * import { setupInfra } from './setup-infra.js';
11
+ * await setupInfra('/path/to/project');
12
+ */
13
+
14
+ import { join, dirname } from 'path';
15
+ import { fileURLToPath } from 'url';
16
+ import { execSync } from 'child_process';
17
+ import {
18
+ copyDirectory,
19
+ copyFile,
20
+ pathExists,
21
+ writeJson,
22
+ ensureDir,
23
+ writeFile,
24
+ updateGitignore
25
+ } from '../utils/file-copier.js';
26
+ import { saveProjectMorphVersion, getInstalledCLIVersion } from '../utils/version-checker.js';
27
+ import { installClaudeHooks, installGlobalStatusline, installVSCodeTerminalSettings, installShellIntegration } from '../utils/claude-settings-manager.js';
28
+ import { installSkills } from '../utils/skills-installer.js';
29
+ import { installAgents, installDomainAgents } from '../utils/agents-installer.js';
30
+
31
+ const FRAMEWORK_DIR = join(dirname(fileURLToPath(import.meta.url)), '..', '..', 'framework');
32
+
33
+ const REQUIRED_PLUGINS = [
34
+ 'superpowers@claude-plugins-official',
35
+ 'context7@claude-plugins-official',
36
+ ];
37
+
38
+ async function installRequiredPlugins(log, exec) {
39
+ log('Step 0: Installing required Claude Code plugins...');
40
+ for (const plugin of REQUIRED_PLUGINS) {
41
+ try {
42
+ exec(`claude plugin install ${plugin}`, { stdio: 'inherit' });
43
+ log(` ✓ ${plugin}`);
44
+ } catch {
45
+ log(` ⚠ Failed to install ${plugin} — install manually: claude plugin install ${plugin}`);
46
+ }
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Installs MORPH-SPEC infrastructure into the target project directory.
52
+ * Headless — no prompts, no spinner (suppressed when MORPH_QUIET=1), no stack detection.
53
+ *
54
+ * @param {string} targetPath - Absolute path to the target project directory
55
+ */
56
+ export async function setupInfra(targetPath, { _exec = execSync } = {}) {
57
+ const quiet = process.env.MORPH_QUIET === '1';
58
+
59
+ function log(msg) {
60
+ if (!quiet) process.stdout.write(msg + '\n');
61
+ }
62
+
63
+ // --- 0. Install required Claude Code plugins ---
64
+ await installRequiredPlugins(log, _exec);
65
+
66
+ // --- 1. Copy CLAUDE.md (backup existing non-MORPH CLAUDE.md) ---
67
+ log('Step 1: Copying CLAUDE.md...');
68
+ const claudeMdSrc = join(FRAMEWORK_DIR, 'CLAUDE.md');
69
+ const claudeMdDest = join(targetPath, 'CLAUDE.md');
70
+
71
+ if (await pathExists(claudeMdDest)) {
72
+ const { readFile } = await import('../utils/file-copier.js');
73
+ const existingContent = await readFile(claudeMdDest);
74
+ if (!existingContent.includes('MORPH-SPEC')) {
75
+ await copyFile(claudeMdDest, `${claudeMdDest}.backup`);
76
+ }
77
+ }
78
+ await copyFile(claudeMdSrc, claudeMdDest);
79
+
80
+ // --- 2. Create .morph directory structure ---
81
+ log('Step 2: Creating .morph structure...');
82
+ const morphPath = join(targetPath, '.morph');
83
+ const configDir = join(morphPath, 'config');
84
+ const frameworkDestDir = join(morphPath, 'framework');
85
+ const contextDir = join(morphPath, 'context');
86
+ const featuresDir = join(morphPath, 'features');
87
+ const checkpointsDir = join(morphPath, 'checkpoints');
88
+ const memoryDir = join(morphPath, 'memory');
89
+ const archiveDir = join(morphPath, 'archive');
90
+
91
+ await ensureDir(configDir);
92
+ await ensureDir(frameworkDestDir);
93
+ await ensureDir(contextDir);
94
+ await ensureDir(featuresDir);
95
+ await ensureDir(checkpointsDir);
96
+ await ensureDir(memoryDir);
97
+ await ensureDir(archiveDir);
98
+
99
+ // --- 3. Write minimal config.json (only if not exists) ---
100
+ log('Step 3: Writing config.json...');
101
+ const configPath = join(configDir, 'config.json');
102
+ if (!(await pathExists(configPath))) {
103
+ const dirName = targetPath.split(/[\/]/).pop();
104
+ const config = {
105
+ framework: 'global',
106
+ frameworkVersion: getInstalledCLIVersion(),
107
+ project: {
108
+ name: dirName
109
+ }
110
+ };
111
+ await writeJson(configPath, config);
112
+ }
113
+
114
+ // --- 4. Write placeholder context/README.md (only if not exists) ---
115
+ log('Step 4: Writing context/README.md...');
116
+ const contextReadmePath = join(contextDir, 'README.md');
117
+ if (!(await pathExists(contextReadmePath))) {
118
+ const dirName = targetPath.split(/[\/]/).pop();
119
+ const readmeContent = `# ${dirName} — Project Context\n\nRun /morph:init to generate project context.\n`;
120
+ await writeFile(contextReadmePath, readmeContent);
121
+ }
122
+
123
+ // --- 5. Copy framework/templates → .morph/framework/templates ---
124
+ log('Step 5: Copying framework templates...');
125
+ const frameworkTemplatesSrc = join(FRAMEWORK_DIR, 'templates');
126
+ const templatesDest = join(frameworkDestDir, 'templates');
127
+ if (await pathExists(frameworkTemplatesSrc)) {
128
+ await copyDirectory(frameworkTemplatesSrc, templatesDest);
129
+ } else {
130
+ await ensureDir(templatesDest);
131
+ }
132
+
133
+ // --- 6. Copy framework/standards → .morph/framework/standards ---
134
+ log('Step 6: Copying framework standards...');
135
+ const frameworkStandardsSrc = join(FRAMEWORK_DIR, 'standards');
136
+ const frameworkStandardsDest = join(frameworkDestDir, 'standards');
137
+ if (await pathExists(frameworkStandardsSrc)) {
138
+ await copyDirectory(frameworkStandardsSrc, frameworkStandardsDest);
139
+ }
140
+
141
+ // --- 7. Copy framework/hooks → .morph/framework/hooks ---
142
+ log('Step 7: Copying hooks...');
143
+ const hooksSrc = join(FRAMEWORK_DIR, 'hooks');
144
+ const hooksDest = join(frameworkDestDir, 'hooks');
145
+ if (await pathExists(hooksSrc)) {
146
+ await copyDirectory(hooksSrc, hooksDest);
147
+ }
148
+
149
+ // --- 8. Copy framework/agents.json → .morph/framework/agents.json ---
150
+ log('Step 8: Copying agents.json...');
151
+ const agentsSrc = join(FRAMEWORK_DIR, 'agents.json');
152
+ const agentsDest = join(frameworkDestDir, 'agents.json');
153
+ if (await pathExists(agentsSrc)) {
154
+ await copyFile(agentsSrc, agentsDest);
155
+ }
156
+
157
+ // --- 9. Copy framework/commands → .claude/commands ---
158
+ log('Step 9: Setting up Claude Code integration...');
159
+ const claudeDest = join(targetPath, '.claude');
160
+ const commandsSrc = join(FRAMEWORK_DIR, 'commands');
161
+ const commandsDest = join(claudeDest, 'commands');
162
+ if (await pathExists(commandsSrc)) {
163
+ await copyDirectory(commandsSrc, commandsDest);
164
+ }
165
+
166
+ // --- 10. Copy framework/rules → .claude/rules ---
167
+ log('Step 10: Installing path-scoped rules...');
168
+ const rulesSrc = join(FRAMEWORK_DIR, 'rules');
169
+ const rulesDest = join(claudeDest, 'rules');
170
+ if (await pathExists(rulesSrc)) {
171
+ await copyDirectory(rulesSrc, rulesDest);
172
+ }
173
+
174
+ // --- 11. installSkills ---
175
+ log('Step 11: Installing skills...');
176
+ await installSkills(targetPath);
177
+
178
+ // --- 12. installAgents ---
179
+ log('Step 12: Installing agents...');
180
+ const agentCounts = await installAgents(targetPath, FRAMEWORK_DIR, { projectStack: null });
181
+
182
+ // --- 13. installDomainAgents ---
183
+ log('Step 13: Installing domain agents...');
184
+ const domainCounts = await installDomainAgents(targetPath, FRAMEWORK_DIR);
185
+
186
+ // --- 14. Copy framework/CLAUDE.md → .claude/CLAUDE.md ---
187
+ log('Step 14: Installing .claude/CLAUDE.md...');
188
+ const runtimeClaudeMdDest = join(claudeDest, 'CLAUDE.md');
189
+ if (await pathExists(claudeMdSrc)) {
190
+ await copyFile(claudeMdSrc, runtimeClaudeMdDest);
191
+ }
192
+
193
+ // --- 15. installGlobalStatusline (non-critical) ---
194
+ log('Step 15: Installing global statusline...');
195
+ const HOOKS_SRC = join(FRAMEWORK_DIR, 'hooks', 'claude-code');
196
+ try {
197
+ await installGlobalStatusline(HOOKS_SRC);
198
+ } catch {
199
+ // Non-critical — global ~/.claude may not be writable
200
+ }
201
+
202
+ // --- 16. installClaudeHooks ---
203
+ log('Step 16: Installing Claude Code hooks...');
204
+ await installClaudeHooks(targetPath);
205
+
206
+ // --- 16a. installShellIntegration (non-critical) ---
207
+ log('Step 16a: Installing shell integration...');
208
+ try {
209
+ await installShellIntegration();
210
+ } catch {
211
+ // Non-critical shell profile may not be writable
212
+ }
213
+
214
+ // --- 16b. installVSCodeTerminalSettings (non-critical) ---
215
+ log('Step 16b: Configuring VS Code terminal settings...');
216
+ try {
217
+ await installVSCodeTerminalSettings();
218
+ } catch {
219
+ // Non-critical VS Code settings may not be present
220
+ }
221
+
222
+ // --- 17. saveProjectMorphVersion ---
223
+ log('Step 17: Saving version info...');
224
+ const cliVersion = getInstalledCLIVersion();
225
+ await saveProjectMorphVersion(targetPath, cliVersion);
226
+
227
+ // --- 18. updateGitignore ---
228
+ log('Step 18: Updating .gitignore...');
229
+ await updateGitignore(targetPath);
230
+
231
+ log('setup-infra: complete.');
232
+
233
+ return {
234
+ agents: {
235
+ tier1: agentCounts?.tier1 ?? 0,
236
+ tier2: agentCounts?.tier2 ?? 0,
237
+ specialists: domainCounts?.specialists ?? 0,
238
+ },
239
+ };
240
+ }
@@ -78,14 +78,14 @@ const TIER_DEFAULTS = {
78
78
  model: 'inherit',
79
79
  tools: 'Read, Grep, Glob, Bash, Task',
80
80
  maxTurns: 30,
81
- skills: ['morph-checklist'],
81
+ skills: ['morph:checklist'],
82
82
  memory: 'project',
83
83
  },
84
84
  2: {
85
85
  model: 'inherit',
86
86
  tools: 'Read, Grep, Glob, Bash',
87
87
  maxTurns: 20,
88
- skills: ['morph-checklist'],
88
+ skills: ['morph:checklist'],
89
89
  memory: 'local',
90
90
  },
91
91
  };
@@ -45,7 +45,7 @@ export function printInstallBanner({ version, nodeVersion, results = [] }) {
45
45
  '',
46
46
  sep('Next'),
47
47
  ` ${chalk.cyan('1.')} Open your project in Claude Code`,
48
- ` ${chalk.cyan('2.')} Run ${chalk.bold.white('/morph-init')}`,
48
+ ` ${chalk.cyan('2.')} Run ${chalk.bold.white('/morph:init')}`,
49
49
  '',
50
50
  ].join('\n'));
51
51
  }
@@ -17,7 +17,7 @@ const MORPH_MANAGED_KEY = '_morph_managed';
17
17
  // Re-export from hooks-installer (v2 registry-based)
18
18
  // ============================================================================
19
19
 
20
- export { installClaudeHooks, installGlobalStatusline, getHooksVersion } from './hooks-installer.js';
20
+ export { installClaudeHooks, installGlobalStatusline, installVSCodeTerminalSettings, installShellIntegration, getHooksVersion } from './hooks-installer.js';
21
21
  export { installAgents } from './agents-installer.js';
22
22
 
23
23
  // ============================================================================
@@ -145,6 +145,7 @@ export async function updateGitignore(projectPath) {
145
145
  '.claude/CLAUDE.md',
146
146
  '.claude/settings.local.json',
147
147
  '.mcp.json',
148
+ '.worktrees/',
148
149
  ''
149
150
  ];
150
151