@polymorphism-tech/morph-spec 4.10.4 → 4.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/bin/morph-spec.js +4 -2
- package/bin/task-manager.js +21 -5
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +5 -5
- package/docs/QUICKSTART.md +5 -5
- package/framework/CLAUDE.md +4 -4
- package/framework/agents/infrastructure/azure-deploy-specialist.md +1 -1
- package/framework/agents/quality/code-analyzer.md +1 -1
- package/framework/commands/morph-apply.md +4 -4
- package/framework/commands/morph-infra.md +10 -10
- package/framework/commands/morph-preflight.md +3 -3
- package/framework/commands/morph-proposal.md +2 -2
- package/framework/commands/morph-status.md +3 -3
- package/framework/hooks/claude-code/post-tool-use/context-refresh.js +1 -1
- package/framework/hooks/claude-code/pre-compact/save-morph-context.js +1 -1
- package/framework/phases.json +17 -17
- package/framework/rules/morph-workflow.md +3 -3
- package/framework/skills/README.md +1 -1
- package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +1 -1
- package/framework/skills/level-0-meta/morph-checklist/SKILL.md +2 -2
- package/framework/skills/level-0-meta/morph-code-review/SKILL.md +1 -1
- package/framework/skills/level-0-meta/morph-code-review-nextjs/SKILL.md +1 -1
- package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +3 -3
- package/framework/skills/level-0-meta/morph-init/SKILL.md +8 -8
- package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +7 -7
- package/framework/skills/level-0-meta/morph-replicate/SKILL.md +4 -4
- package/framework/skills/level-0-meta/morph-replicate/references/blazor-html-mapping.md +1 -1
- package/framework/skills/level-0-meta/morph-simulation-checklist/SKILL.md +1 -1
- package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +1 -1
- package/framework/skills/level-0-meta/morph-verification-before-completion/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-clarify/SKILL.md +5 -5
- package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +2 -2
- package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +5 -5
- package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +6 -7
- package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +6 -7
- package/framework/skills/level-1-workflows/morph-phase-setup/SKILL.md +4 -4
- package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +6 -7
- package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +5 -5
- package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +3 -3
- package/framework/standards/ai-agents/team-orchestration.md +1 -1
- package/framework/workflows/docs/STORY-DRIVEN-DEVELOPMENT.md +1 -1
- package/package.json +1 -1
- package/src/commands/project/doctor.js +1 -1
- package/src/commands/project/init.js +1 -1
- package/src/commands/state/advance-phase.js +24 -11
- package/src/commands/state/approve.js +1 -1
- package/src/commands/state/state.js +26 -5
- package/src/lib/phase-chain/phase-validator.js +6 -1
- package/src/lib/tasks/task-parser.js +4 -0
- package/src/scripts/setup-infra.js +2 -2
- package/src/utils/agents-installer.js +20 -11
- package/src/utils/banner.js +1 -1
- package/src/utils/hooks-installer.js +739 -739
|
@@ -11,6 +11,24 @@ import { logger } from '../../utils/logger.js';
|
|
|
11
11
|
import * as StateManager from '../../core/state/state-manager.js';
|
|
12
12
|
import { derivePhase } from '../../core/state/state-manager.js';
|
|
13
13
|
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Phase Resolution
|
|
16
|
+
// ============================================================================
|
|
17
|
+
|
|
18
|
+
const PHASE_ORDER_LIST = ['setup', 'proposal', 'uiux', 'design', 'clarify', 'plan', 'tasks', 'implement', 'sync', 'archived'];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the effective phase: pick whichever is further ahead between the
|
|
22
|
+
* stored phase (set by `phase advance`) and the derived phase (from filesystem).
|
|
23
|
+
*/
|
|
24
|
+
function resolvePhase(storedPhase, derivedPhase) {
|
|
25
|
+
if (!storedPhase) return derivedPhase;
|
|
26
|
+
if (!derivedPhase) return storedPhase;
|
|
27
|
+
const storedIdx = PHASE_ORDER_LIST.indexOf(storedPhase);
|
|
28
|
+
const derivedIdx = PHASE_ORDER_LIST.indexOf(derivedPhase);
|
|
29
|
+
return storedIdx > derivedIdx ? storedPhase : derivedPhase;
|
|
30
|
+
}
|
|
31
|
+
|
|
14
32
|
// ============================================================================
|
|
15
33
|
// Phase Protection
|
|
16
34
|
// ============================================================================
|
|
@@ -167,7 +185,9 @@ async function getCommand(featureName, options) {
|
|
|
167
185
|
logger.header(`Feature: ${featureName}`);
|
|
168
186
|
logger.blank();
|
|
169
187
|
const featurePath = join(process.cwd(), '.morph/features', featureName);
|
|
170
|
-
const
|
|
188
|
+
const derivedPhase = derivePhase(featurePath);
|
|
189
|
+
// Use stored phase when it's ahead of derived (directory may not exist yet)
|
|
190
|
+
const phase = resolvePhase(feature.phase, derivedPhase);
|
|
171
191
|
const tasks = feature.tasks || { completed: 0, total: 0 };
|
|
172
192
|
// Prefer taskList.length as total when tasks.total is stale/zero (Problem 3 complement)
|
|
173
193
|
const total = tasks.total || (Array.isArray(feature.taskList) ? feature.taskList.length : 0);
|
|
@@ -293,13 +313,14 @@ async function listCommand(options) {
|
|
|
293
313
|
}[feature.status] || '❓';
|
|
294
314
|
|
|
295
315
|
const tasks = feature.tasks || {};
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
|
|
316
|
+
const total = tasks.total || (Array.isArray(feature.taskList) ? feature.taskList.length : 0);
|
|
317
|
+
const progress = total > 0
|
|
318
|
+
? `${tasks.completed || 0}/${total}`
|
|
319
|
+
: '-';
|
|
299
320
|
|
|
300
321
|
logger.info(`${statusEmoji} ${chalk.bold(name)}`);
|
|
301
322
|
const featurePath = join(process.cwd(), '.morph/features', name);
|
|
302
|
-
const featurePhase = derivePhase(featurePath);
|
|
323
|
+
const featurePhase = resolvePhase(feature.phase, derivePhase(featurePath));
|
|
303
324
|
logger.dim(` Phase: ${featurePhase.padEnd(16)} │ Tasks: ${progress}`);
|
|
304
325
|
logger.dim(` Agents: ${(feature.activeAgents || []).slice(0, 5).join(', ') || 'None'}`);
|
|
305
326
|
logger.blank();
|
|
@@ -99,7 +99,12 @@ const OUTPUT_PHASE_MAP = {
|
|
|
99
99
|
function checkOutput(featurePath, outputFile) {
|
|
100
100
|
const phaseDir = OUTPUT_PHASE_MAP[outputFile] || '';
|
|
101
101
|
const filePath = path.join(featurePath, phaseDir, outputFile);
|
|
102
|
-
|
|
102
|
+
if (fs.existsSync(filePath)) return true;
|
|
103
|
+
// Fallback: check feature root (some generators place files there instead of phase subdirs)
|
|
104
|
+
if (phaseDir) {
|
|
105
|
+
return fs.existsSync(path.join(featurePath, outputFile));
|
|
106
|
+
}
|
|
107
|
+
return false;
|
|
103
108
|
}
|
|
104
109
|
|
|
105
110
|
/**
|
|
@@ -86,6 +86,10 @@ export async function ensureTaskList(feature, featureName, cwd = process.cwd())
|
|
|
86
86
|
*/
|
|
87
87
|
export function syncCounters(feature) {
|
|
88
88
|
if (Array.isArray(feature.tasks)) return; // v2 format — nothing to sync
|
|
89
|
+
// Safety: ensure feature.tasks is an object (may be undefined after migration or corruption)
|
|
90
|
+
if (!feature.tasks || typeof feature.tasks !== 'object') {
|
|
91
|
+
feature.tasks = { total: 0, completed: 0, inProgress: 0, pending: 0 };
|
|
92
|
+
}
|
|
89
93
|
const list = feature.taskList || [];
|
|
90
94
|
feature.tasks.total = list.length;
|
|
91
95
|
feature.tasks.completed = list.filter(t => t.status === 'completed').length;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Headless infrastructure setup for MORPH-SPEC.
|
|
5
5
|
* Extracted from init.js (steps 1-10) so it can be called by the
|
|
6
|
-
* /morph
|
|
6
|
+
* /morph-init Claude Code skill via `morph-spec setup-infra` without
|
|
7
7
|
* interactive prompts or stack detection.
|
|
8
8
|
*
|
|
9
9
|
* Usage:
|
|
@@ -141,7 +141,7 @@ export async function setupInfra(targetPath, { _exec = execSync } = {}) {
|
|
|
141
141
|
const contextReadmePath = join(contextDir, 'README.md');
|
|
142
142
|
if (!(await pathExists(contextReadmePath))) {
|
|
143
143
|
const dirName = targetPath.split(/[\/]/).pop();
|
|
144
|
-
const readmeContent = `# ${dirName} — Project Context\n\nRun /morph
|
|
144
|
+
const readmeContent = `# ${dirName} — Project Context\n\nRun /morph-init to generate project context.\n`;
|
|
145
145
|
await writeFile(contextReadmePath, readmeContent);
|
|
146
146
|
}
|
|
147
147
|
|
|
@@ -39,9 +39,9 @@ export async function installAgents(projectDir, frameworkDir = 'framework', opti
|
|
|
39
39
|
mkdirSync(targetDir, { recursive: true });
|
|
40
40
|
|
|
41
41
|
const eligible = agents.filter(a => {
|
|
42
|
-
if (a.tier
|
|
43
|
-
//
|
|
44
|
-
if (a.tier
|
|
42
|
+
if (a.tier < 1 || a.tier > 4) return false;
|
|
43
|
+
// Must have a teammate with spawn_prompt (except tier-1 orchestrators which always have one)
|
|
44
|
+
if (a.tier >= 3 && !a.teammate?.spawn_prompt) return false;
|
|
45
45
|
// Filter by stacks if the agent declares them
|
|
46
46
|
const stacks = a.stacks ?? [];
|
|
47
47
|
if (!shouldInstall(stacks, projectTags)) return false;
|
|
@@ -50,13 +50,14 @@ export async function installAgents(projectDir, frameworkDir = 'framework', opti
|
|
|
50
50
|
|
|
51
51
|
let tier1 = 0;
|
|
52
52
|
let tier2 = 0;
|
|
53
|
+
let tier3 = 0;
|
|
53
54
|
let tier4 = 0;
|
|
54
55
|
const installed = new Set();
|
|
55
56
|
|
|
56
57
|
// Build the full set of possible filenames for orphan cleanup
|
|
57
58
|
const allPossible = new Set();
|
|
58
59
|
for (const a of agents) {
|
|
59
|
-
if (a.tier
|
|
60
|
+
if (a.tier < 1 || a.tier > 4) continue;
|
|
60
61
|
const slug = a.id ?? a.name?.toLowerCase().replace(/\s+/g, '-');
|
|
61
62
|
const prefix = a.tier === 4 ? 'morph-validator-' : 'morph-';
|
|
62
63
|
allPossible.add(`${prefix}${slug}.md`);
|
|
@@ -78,6 +79,7 @@ export async function installAgents(projectDir, frameworkDir = 'framework', opti
|
|
|
78
79
|
|
|
79
80
|
if (agent.tier === 1) tier1++;
|
|
80
81
|
else if (agent.tier === 2) tier2++;
|
|
82
|
+
else if (agent.tier === 3) tier3++;
|
|
81
83
|
else if (agent.tier === 4) tier4++;
|
|
82
84
|
}
|
|
83
85
|
|
|
@@ -88,7 +90,7 @@ export async function installAgents(projectDir, frameworkDir = 'framework', opti
|
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
return { tier1, tier2, tier4 };
|
|
93
|
+
return { tier1, tier2, tier3, tier4 };
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
/**
|
|
@@ -100,16 +102,23 @@ export async function installAgents(projectDir, frameworkDir = 'framework', opti
|
|
|
100
102
|
const TIER_DEFAULTS = {
|
|
101
103
|
1: {
|
|
102
104
|
model: 'inherit',
|
|
103
|
-
tools: 'Read, Grep, Glob, Bash, Task',
|
|
105
|
+
tools: 'Read, Grep, Glob, Bash, Task, Write, Edit',
|
|
104
106
|
maxTurns: 30,
|
|
105
|
-
skills: ['morph
|
|
107
|
+
skills: ['morph-checklist'],
|
|
106
108
|
memory: 'project',
|
|
107
109
|
},
|
|
108
110
|
2: {
|
|
109
111
|
model: 'inherit',
|
|
110
|
-
tools: 'Read,
|
|
112
|
+
tools: 'Read, Write, Edit, Bash, Glob, Grep',
|
|
111
113
|
maxTurns: 20,
|
|
112
|
-
skills: ['morph
|
|
114
|
+
skills: ['morph-checklist'],
|
|
115
|
+
memory: 'local',
|
|
116
|
+
},
|
|
117
|
+
3: {
|
|
118
|
+
model: 'sonnet',
|
|
119
|
+
tools: 'Read, Write, Edit, Bash, Glob, Grep',
|
|
120
|
+
maxTurns: 15,
|
|
121
|
+
skills: [],
|
|
113
122
|
memory: 'local',
|
|
114
123
|
},
|
|
115
124
|
4: {
|
|
@@ -309,8 +318,8 @@ export function checkMissingAgents(projectDir, frameworkDir, projectTags = []) {
|
|
|
309
318
|
.map(([id, data]) => ({ id, ...data }));
|
|
310
319
|
|
|
311
320
|
for (const a of agents) {
|
|
312
|
-
if (a.tier
|
|
313
|
-
if (a.tier
|
|
321
|
+
if (a.tier < 1 || a.tier > 4) continue;
|
|
322
|
+
if (a.tier >= 3 && !a.teammate?.spawn_prompt) continue;
|
|
314
323
|
const stacks = a.stacks ?? [];
|
|
315
324
|
if (!shouldInstall(stacks, projectTags)) continue;
|
|
316
325
|
|
package/src/utils/banner.js
CHANGED
|
@@ -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
|
|
48
|
+
` ${chalk.cyan('2.')} Run ${chalk.bold.white('/morph-init')}`,
|
|
49
49
|
'',
|
|
50
50
|
].join('\n'));
|
|
51
51
|
}
|