@polymorphism-tech/morph-spec 11.1.1 → 11.2.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.
- package/README.md +1 -1
- package/bin/morph-spec.js +9 -19
- package/docs/CHEATSHEET.md +3 -3
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +2 -0
- package/framework/MORPH.md +7 -2
- package/framework/agents.json +3 -3
- package/framework/docs/CLI.md +14 -12
- package/framework/evals/review-checklist.md +9 -16
- package/framework/hooks/README.md +15 -9
- package/framework/hooks/claude-code/core/README.md +2 -2
- package/framework/hooks/claude-code/core/chain.js +9 -25
- package/framework/hooks/claude-code/core/comment-guard.js +3 -9
- package/framework/hooks/claude-code/core/conventional-commit.js +3 -3
- package/framework/hooks/claude-code/core/graph-refresh-kick.js +4 -4
- package/framework/hooks/claude-code/core/masked-exit.js +4 -3
- package/framework/hooks/claude-code/core/pre-bash-denylist.js +2 -2
- package/framework/hooks/claude-code/core/protect-spec-files.js +2 -4
- package/framework/hooks/claude-code/core/stack-changed.js +5 -4
- package/framework/hooks/claude-code/core/validate-completion.js +15 -12
- package/framework/hooks/shared/contract.js +22 -1
- package/framework/hooks/shared/git-paths.js +6 -0
- package/framework/hooks/shared/graph-freshness.js +3 -3
- package/framework/hooks/shared/graph-refresh.js +5 -10
- package/framework/hooks/shared/hook-response.js +1 -18
- package/framework/hooks/shared/payload-utils.js +12 -1
- package/framework/hooks/shared/phase-utils.js +4 -52
- package/framework/hooks/shared/report-progress.js +1 -1
- package/framework/mcp/registry.json +1 -17
- package/framework/rules/dotnet-templates.md +32 -33
- package/framework/rules/infrastructure-standards.md +9 -9
- package/framework/rules/neon-standards.md +4 -4
- package/framework/rules/nextjs-templates.md +10 -11
- package/framework/rules/ui-design.md +2 -2
- package/framework/schemas/config.schema.json +4 -0
- package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
- package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
- package/framework/skills/core/morph-apply/SKILL.md +5 -4
- package/framework/skills/core/morph-plan/SKILL.md +1 -1
- package/framework/skills/core/morph-uiux/SKILL.md +5 -5
- package/framework/standards/integration/mcp/mcp-tools.md +2 -2
- package/framework/templates/REGISTRY.json +1 -75
- package/framework/templates/docs/plan.md +1 -1
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Morph.AiKit.Tests.csproj +1 -1
- package/framework/templates/infrastructure/docker/docker-compose.template.yml +15 -16
- package/package.json +6 -15
- package/src/commands/graph/build.js +2 -2
- package/src/commands/mcp/mcp-setup.js +6 -4
- package/src/commands/project/doctor.js +42 -126
- package/src/commands/project/env.js +2 -1
- package/src/commands/project/init.js +28 -170
- package/src/commands/project/stack-set.js +3 -1
- package/src/commands/project/update.js +49 -153
- package/src/commands/scaffold/scaffold.js +21 -4
- package/src/commands/validation/check.js +12 -10
- package/src/commands/validation/prove-red.js +61 -22
- package/src/core/paths/output-schema.js +8 -27
- package/src/core/templates/template-registry.js +8 -43
- package/src/core/templates/template-renderer.js +3 -200
- package/src/lib/ai/ai-checks.js +1 -1
- package/src/lib/ai/ai-project-scan.js +1 -1
- package/src/lib/ai/code-audit.js +2 -2
- package/src/lib/check/signals.js +25 -7
- package/src/lib/contract/defaults.js +2 -2
- package/src/lib/detectors/claude-config-detector.js +0 -52
- package/src/lib/detectors/index.js +5 -30
- package/src/lib/diff/diff-lines.js +3 -3
- package/src/lib/generators/scaffold-generator.js +5 -17
- package/src/lib/git/default-branch.js +5 -13
- package/src/lib/graph/graph-health.js +1 -1
- package/src/lib/graph/graphifyignore.js +3 -4
- package/src/lib/graph/sanitize.js +2 -2
- package/src/lib/installers/effects.js +0 -13
- package/src/lib/installers/mcp-installer.js +5 -17
- package/src/lib/installers/memory-installer.js +5 -8
- package/src/lib/installers/stack-assets.js +33 -7
- package/src/lib/installers/stack-sync.js +4 -4
- package/src/lib/plan/checks.js +1 -1
- package/src/lib/plan/media.js +3 -3
- package/src/lib/plan/plan-parser.js +1 -1
- package/src/lib/review-reports.js +8 -14
- package/src/lib/scan/worktree-dirs.js +1 -3
- package/src/lib/specs/adr-index.js +4 -4
- package/src/lib/specs/revocations.js +3 -3
- package/src/lib/stack/stack-scan.js +3 -3
- package/src/lib/standards/registry.js +1 -1
- package/src/lib/standards/verified-against.js +2 -2
- package/src/lib/tests-audit/audit.js +2 -2
- package/src/scripts/global-install.js +41 -19
- package/src/scripts/setup-infra.js +57 -165
- package/src/utils/agents-installer.js +8 -30
- package/src/utils/claude-settings-manager.js +29 -27
- package/src/utils/hooks-installer.js +30 -44
- package/src/utils/version-checker.js +2 -31
- package/CLAUDE.md +0 -118
- package/framework/commands/create-umbraco-lp.md +0 -37
- package/framework/commands/migrate-lp-to-umbraco.md +0 -35
- package/framework/commands/morph-apply.md +0 -14
- package/framework/hooks/shared/spawn-command.js +0 -23
- package/framework/templates/CLAUDE.md.core.guide.md +0 -29
- package/framework/templates/CLAUDE.md.core.template +0 -22
- package/framework/templates/context/ARCHITECTURE.md +0 -106
- package/src/commands/context/context-refresh.js +0 -63
- package/src/lib/generators/architecture-scanner.js +0 -543
- package/src/lib/generators/settings-generator.js +0 -97
- package/src/lib/graph/god-nodes.js +0 -65
|
@@ -33,7 +33,7 @@ export async function detectStack(targetPath) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
try {
|
|
36
|
-
const results = await detectProject(targetPath
|
|
36
|
+
const results = await detectProject(targetPath);
|
|
37
37
|
return results.structure?.stack || 'unknown';
|
|
38
38
|
} catch {
|
|
39
39
|
return 'unknown';
|
|
@@ -54,7 +54,7 @@ export async function detectIntegrations(targetPath) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
try {
|
|
57
|
-
const results = await detectProject(targetPath
|
|
57
|
+
const results = await detectProject(targetPath);
|
|
58
58
|
return results.structure?.integrations ?? [];
|
|
59
59
|
} catch {
|
|
60
60
|
return [];
|
|
@@ -158,15 +158,17 @@ async function setupSpecificMcp(targetPath, name, stack, existingMcps) {
|
|
|
158
158
|
console.log(chalk.red(`\n Unknown MCP: ${name}`));
|
|
159
159
|
console.log(chalk.gray(` Available: ${Object.keys(registry.mcps).join(', ')}`));
|
|
160
160
|
console.log('');
|
|
161
|
+
process.exitCode = 1;
|
|
161
162
|
return;
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
if (!mcpEntry.install) {
|
|
165
166
|
console.log(chalk.red(`\n MCP "${name}" has no install configuration.\n`));
|
|
167
|
+
process.exitCode = 1;
|
|
166
168
|
return;
|
|
167
169
|
}
|
|
168
170
|
|
|
169
|
-
const isInstalled = existingMcps.some(s => s.name.toLowerCase().
|
|
171
|
+
const isInstalled = existingMcps.some(s => s.name.toLowerCase() === name.toLowerCase());
|
|
170
172
|
if (isInstalled) {
|
|
171
173
|
const { reconfigure } = await inquirer.prompt([{
|
|
172
174
|
type: 'confirm',
|
|
@@ -230,7 +232,7 @@ async function setupSpecificMcp(targetPath, name, stack, existingMcps) {
|
|
|
230
232
|
const { installNow } = await inquirer.prompt([{
|
|
231
233
|
type: 'confirm',
|
|
232
234
|
name: 'installNow',
|
|
233
|
-
message: '
|
|
235
|
+
message: 'Run it now (claude mcp add)?',
|
|
234
236
|
default: true
|
|
235
237
|
}]);
|
|
236
238
|
|
|
@@ -18,6 +18,7 @@ import { stackRuleGaps } from '../../lib/installers/stack-sync.js';
|
|
|
18
18
|
import { auditGraph } from '../../lib/graph/graph-health.js';
|
|
19
19
|
|
|
20
20
|
const isWindows = platform() === 'win32';
|
|
21
|
+
const PACKAGE_FRAMEWORK = join(import.meta.dirname, '..', '..', '..', 'framework');
|
|
21
22
|
|
|
22
23
|
export function checkInstalledPlugins(pluginsData) {
|
|
23
24
|
const REQUIRED = ['context7'];
|
|
@@ -57,20 +58,6 @@ function getNpmGlobalPrefix() {
|
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
const REQUIRED_LIB_FILES = [
|
|
61
|
-
'src/lib/stack-filter.js'
|
|
62
|
-
];
|
|
63
|
-
|
|
64
|
-
const REQUIRED_COMMAND_FILES = [
|
|
65
|
-
'src/commands/project/init.js',
|
|
66
|
-
'src/commands/project/update.js',
|
|
67
|
-
'src/commands/project/doctor.js',
|
|
68
|
-
'src/commands/validation/check.js',
|
|
69
|
-
'src/commands/scaffold/scaffold.js',
|
|
70
|
-
'src/commands/mcp/mcp-setup.js',
|
|
71
|
-
'src/commands/context/context-refresh.js',
|
|
72
|
-
];
|
|
73
|
-
|
|
74
61
|
export function validateAgentsJson(agentsData) {
|
|
75
62
|
const checks = [];
|
|
76
63
|
const agentEntries = Object.entries(agentsData.agents || {})
|
|
@@ -101,14 +88,9 @@ export function validateAgentsJson(agentsData) {
|
|
|
101
88
|
|
|
102
89
|
const version = agentsData.version || 'unknown';
|
|
103
90
|
const isCurrent = version.startsWith('6.');
|
|
104
|
-
const v4Fields = [];
|
|
105
91
|
const missingFields = [];
|
|
106
92
|
|
|
107
93
|
for (const [id, data] of agentEntries) {
|
|
108
|
-
if (data.tier !== undefined) v4Fields.push(`${id}.tier`);
|
|
109
|
-
if (data.active_phases !== undefined) v4Fields.push(`${id}.active_phases`);
|
|
110
|
-
if (data.reports_to !== undefined) v4Fields.push(`${id}.reports_to`);
|
|
111
|
-
if (data.teammate !== undefined) v4Fields.push(`${id}.teammate`);
|
|
112
94
|
if (!data.title) missingFields.push(`${id}.title`);
|
|
113
95
|
if (!Array.isArray(data.domains)) missingFields.push(`${id}.domains`);
|
|
114
96
|
if (typeof data.persona !== 'string' || !data.persona) missingFields.push(`${id}.persona`);
|
|
@@ -124,15 +106,6 @@ export function validateAgentsJson(agentsData) {
|
|
|
124
106
|
});
|
|
125
107
|
}
|
|
126
108
|
|
|
127
|
-
if (v4Fields.length > 0) {
|
|
128
|
-
const sample = v4Fields.slice(0, 3).join(', ');
|
|
129
|
-
checks.push({
|
|
130
|
-
name: 'agents.json deprecated v4 fields',
|
|
131
|
-
status: 'warn',
|
|
132
|
-
msg: `${v4Fields.length} v4 field(s) found: ${sample}${v4Fields.length > 3 ? '...' : ''}`
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
|
|
136
109
|
// The installer's own rule, so this cannot pass a value it refuses. ERROR: that persona is not generated.
|
|
137
110
|
const maxTurnsErrors = agentEntries
|
|
138
111
|
.map(([id, data]) => maxTurnsError(id, data?.maxTurns))
|
|
@@ -193,37 +166,16 @@ async function doctorFullCommand(frameworkRoot) {
|
|
|
193
166
|
}
|
|
194
167
|
};
|
|
195
168
|
|
|
196
|
-
// Two layouts reach this command (framework repo:
|
|
197
|
-
// .morph/framework
|
|
169
|
+
// Two layouts reach this command (framework repo: framework/, no .morph/; installed project:
|
|
170
|
+
// .morph/framework/). Each check runs only where it means something.
|
|
198
171
|
const installedAgentsPath = join(frameworkRoot, '.morph/framework/agents.json');
|
|
199
|
-
const
|
|
172
|
+
const sourceAgentsPath = join(frameworkRoot, 'framework/agents.json');
|
|
200
173
|
const inFrameworkRepo = !(await pathExists(installedAgentsPath))
|
|
201
|
-
&& await pathExists(
|
|
202
|
-
const agentsPath = inFrameworkRepo ?
|
|
174
|
+
&& await pathExists(sourceAgentsPath);
|
|
175
|
+
const agentsPath = inFrameworkRepo ? sourceAgentsPath : installedAgentsPath;
|
|
203
176
|
|
|
204
177
|
console.log(chalk.gray(`\n Contexto: ${inFrameworkRepo ? 'repo do framework' : 'projeto instalado'}`));
|
|
205
178
|
|
|
206
|
-
// An installed project has no src/: the CLI's integrity in node_modules is npm's job.
|
|
207
|
-
if (inFrameworkRepo) {
|
|
208
|
-
console.log(chalk.cyan(`\n src/lib/ — Core Libraries (${REQUIRED_LIB_FILES.length} files)`));
|
|
209
|
-
const missingLibs = [];
|
|
210
|
-
for (const f of REQUIRED_LIB_FILES) {
|
|
211
|
-
if (!(await pathExists(join(frameworkRoot, f)))) missingLibs.push(f.split('/').pop());
|
|
212
|
-
}
|
|
213
|
-
check(`Core Libraries (${REQUIRED_LIB_FILES.length - missingLibs.length}/${REQUIRED_LIB_FILES.length})`,
|
|
214
|
-
missingLibs.length === 0, false,
|
|
215
|
-
missingLibs.length > 0 ? `missing: ${missingLibs.join(', ')}` : '');
|
|
216
|
-
|
|
217
|
-
console.log(chalk.cyan(`\n src/commands/ — Command Files (${REQUIRED_COMMAND_FILES.length} files)`));
|
|
218
|
-
const missingCmds = [];
|
|
219
|
-
for (const f of REQUIRED_COMMAND_FILES) {
|
|
220
|
-
if (!(await pathExists(join(frameworkRoot, f)))) missingCmds.push(f.split('/').pop());
|
|
221
|
-
}
|
|
222
|
-
check(`Command Files (${REQUIRED_COMMAND_FILES.length - missingCmds.length}/${REQUIRED_COMMAND_FILES.length})`,
|
|
223
|
-
missingCmds.length === 0, false,
|
|
224
|
-
missingCmds.length > 0 ? `missing: ${missingCmds.join(', ')}` : '');
|
|
225
|
-
}
|
|
226
|
-
|
|
227
179
|
const stdsRoot = inFrameworkRepo ? frameworkRoot : join(frameworkRoot, '.morph');
|
|
228
180
|
console.log(chalk.cyan(`\n ${inFrameworkRepo ? '' : '.morph/'}framework/standards/ — Framework Standards (${FRAMEWORK_STANDARDS.length} files)`));
|
|
229
181
|
const missingStds = [];
|
|
@@ -251,10 +203,10 @@ async function doctorFullCommand(frameworkRoot) {
|
|
|
251
203
|
}
|
|
252
204
|
|
|
253
205
|
// Installed project only: in the framework repo source and installed copy are the same file.
|
|
254
|
-
if (!inFrameworkRepo && await pathExists(agentsPath)
|
|
206
|
+
if (!inFrameworkRepo && await pathExists(agentsPath)) {
|
|
255
207
|
try {
|
|
256
208
|
const installed = JSON.parse(await fs.readFile(agentsPath, 'utf8'));
|
|
257
|
-
const canonical = JSON.parse(await fs.readFile(
|
|
209
|
+
const canonical = JSON.parse(await fs.readFile(join(PACKAGE_FRAMEWORK, 'agents.json'), 'utf8'));
|
|
258
210
|
const installedVer = installed.version || 'unknown';
|
|
259
211
|
const canonicalVer = canonical.version || 'unknown';
|
|
260
212
|
const isFresh = installedVer === canonicalVer;
|
|
@@ -279,7 +231,7 @@ async function doctorFullCommand(frameworkRoot) {
|
|
|
279
231
|
// installed .morph/framework/ has no mcp/, and rendering without it
|
|
280
232
|
// flagged every persona with an `mcp` grant as stale on a clean install.
|
|
281
233
|
const drift = checkAgentsDrift(frameworkRoot, join(frameworkRoot, '.morph/framework'), projectTags,
|
|
282
|
-
{ mcpRegistryDir:
|
|
234
|
+
{ mcpRegistryDir: PACKAGE_FRAMEWORK });
|
|
283
235
|
if (drift.invalid.length > 0) {
|
|
284
236
|
check('Personas agents.json valid', false, false,
|
|
285
237
|
`${drift.invalid.map(i => i.reason).join(' | ')} — corrija o agents.json e rode 'morph-spec update'`);
|
|
@@ -533,16 +485,16 @@ export async function doctorAiCommand(targetPath, options = {}) {
|
|
|
533
485
|
}
|
|
534
486
|
|
|
535
487
|
export async function doctorCommand(options = {}) {
|
|
536
|
-
//
|
|
488
|
+
// Duas superfícies dariam dois códigos de saída no mesmo processo: recusa.
|
|
489
|
+
const [first, ...rest] = ['ai', 'full', 'mcp', 'reset'].filter((f) => options[f]).map((f) => `--${f}`);
|
|
490
|
+
if (rest.length) {
|
|
491
|
+
logger.error(`${first} não se combina com ${rest.join(' e ')} — cada superfície tem o seu relatório e o seu código de saída.`);
|
|
492
|
+
logger.dim(` Rode uma por vez: morph-spec doctor ${first}`);
|
|
493
|
+
process.exitCode = 1;
|
|
494
|
+
return false;
|
|
495
|
+
}
|
|
496
|
+
|
|
537
497
|
if (options.ai) {
|
|
538
|
-
const conflicts = ['full', 'mcp'].filter((f) => options[f]);
|
|
539
|
-
if (conflicts.length) {
|
|
540
|
-
const flags = conflicts.map((f) => `--${f}`).join(' e ');
|
|
541
|
-
logger.error(`--ai não se combina com ${flags} — cada superfície tem o seu relatório e o seu código de saída.`);
|
|
542
|
-
logger.dim(' Rode: morph-spec doctor --ai');
|
|
543
|
-
process.exitCode = 1;
|
|
544
|
-
return false;
|
|
545
|
-
}
|
|
546
498
|
return doctorAiCommand(process.cwd(), options);
|
|
547
499
|
}
|
|
548
500
|
|
|
@@ -587,16 +539,6 @@ export async function doctorCommand(options = {}) {
|
|
|
587
539
|
let hasErrors = false;
|
|
588
540
|
let hasWarnings = false;
|
|
589
541
|
|
|
590
|
-
const check = (name, passed, warnOnly = false, msg = '') => {
|
|
591
|
-
if (passed) {
|
|
592
|
-
checks.push({ name, status: 'ok' });
|
|
593
|
-
} else {
|
|
594
|
-
checks.push({ name, status: warnOnly ? 'warn' : 'missing', msg });
|
|
595
|
-
if (warnOnly) hasWarnings = true;
|
|
596
|
-
else hasErrors = true;
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
|
|
600
542
|
const cliCheck = await checkCLIOutdated();
|
|
601
543
|
const projectCheck = await checkProjectOutdated(targetPath);
|
|
602
544
|
|
|
@@ -688,6 +630,7 @@ export async function doctorCommand(options = {}) {
|
|
|
688
630
|
checks.push({ name: 'config.json', status: 'ok' });
|
|
689
631
|
} else {
|
|
690
632
|
checks.push({ name: 'config.json', status: 'warn', msg: 'project.name not set' });
|
|
633
|
+
hasWarnings = true;
|
|
691
634
|
}
|
|
692
635
|
} catch {
|
|
693
636
|
checks.push({ name: 'config.json', status: 'error', msg: 'invalid JSON' });
|
|
@@ -717,11 +660,9 @@ export async function doctorCommand(options = {}) {
|
|
|
717
660
|
}
|
|
718
661
|
|
|
719
662
|
const standardsPath = join(morphPath, 'framework', 'standards');
|
|
720
|
-
const frameworkStdsRoot = join(
|
|
663
|
+
const frameworkStdsRoot = join(PACKAGE_FRAMEWORK, 'standards');
|
|
721
664
|
if (await pathExists(standardsPath)) {
|
|
722
|
-
|
|
723
|
-
await pathExists(join(standardsPath, 'vertical-slice.md'));
|
|
724
|
-
if (vsaStd) {
|
|
665
|
+
if (await pathExists(join(standardsPath, 'architecture', 'vertical-slice', 'vertical-slice.md'))) {
|
|
725
666
|
checks.push({ name: 'standards/', status: 'ok' });
|
|
726
667
|
} else {
|
|
727
668
|
checks.push({ name: 'standards/', status: 'warn', msg: 'VSA standard missing — run morph-spec init' });
|
|
@@ -755,29 +696,6 @@ export async function doctorCommand(options = {}) {
|
|
|
755
696
|
if (hasCommands && hasSkills) {
|
|
756
697
|
checks.push({ name: '.claude/', status: 'ok' });
|
|
757
698
|
|
|
758
|
-
const skillEntries = await fs.readdir(skillsPath, { withFileTypes: true });
|
|
759
|
-
const skillDirs = skillEntries.filter(e => e.isDirectory() || e.isSymbolicLink());
|
|
760
|
-
let linkedCount = 0;
|
|
761
|
-
|
|
762
|
-
for (const dir of skillDirs) {
|
|
763
|
-
try {
|
|
764
|
-
const stat = await fs.lstat(join(skillsPath, dir.name));
|
|
765
|
-
if (stat.isSymbolicLink()) linkedCount++;
|
|
766
|
-
} catch {}
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
if (skillDirs.length > 0) {
|
|
770
|
-
if (linkedCount === skillDirs.length) {
|
|
771
|
-
checks.push({ name: '.claude/skills/ links', status: 'ok', msg: `${linkedCount} categories linked` });
|
|
772
|
-
} else if (linkedCount > 0) {
|
|
773
|
-
checks.push({ name: '.claude/skills/ links', status: 'warn', msg: `${linkedCount}/${skillDirs.length} linked, rest copied` });
|
|
774
|
-
hasWarnings = true;
|
|
775
|
-
} else {
|
|
776
|
-
checks.push({ name: '.claude/skills/ links', status: 'warn', msg: 'all categories copied (no auto-update)' });
|
|
777
|
-
hasWarnings = true;
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
|
|
781
699
|
const rulesPath = join(claudePath, 'rules');
|
|
782
700
|
if (await pathExists(rulesPath)) {
|
|
783
701
|
const ruleFiles = await fs.readdir(rulesPath);
|
|
@@ -794,7 +712,7 @@ export async function doctorCommand(options = {}) {
|
|
|
794
712
|
hasWarnings = true;
|
|
795
713
|
}
|
|
796
714
|
if (gaps?.missing.length) {
|
|
797
|
-
checks.push({ name: 'stack rules', status: 'warn', msg: `faltando para [${gaps.tags.join(', ')}]: ${gaps.missing.join(', ')} — rode morph-spec
|
|
715
|
+
checks.push({ name: 'stack rules', status: 'warn', msg: `faltando para [${gaps.tags.join(', ')}]: ${gaps.missing.join(', ')} — rode morph-spec update` });
|
|
798
716
|
hasWarnings = true;
|
|
799
717
|
}
|
|
800
718
|
|
|
@@ -811,8 +729,7 @@ export async function doctorCommand(options = {}) {
|
|
|
811
729
|
projectTags = getProjectTags(await readJson(configPath));
|
|
812
730
|
} catch {}
|
|
813
731
|
const tagsLabel = projectTags.length > 0 ? projectTags.join(', ') : 'all (stack unknown)';
|
|
814
|
-
const
|
|
815
|
-
const { missing } = checkMissingAgents(targetPath, frameworkDir, projectTags);
|
|
732
|
+
const { missing } = checkMissingAgents(targetPath, PACKAGE_FRAMEWORK, projectTags);
|
|
816
733
|
if (missing.length > 0) {
|
|
817
734
|
const names = missing.map(m => m.name).join(', ');
|
|
818
735
|
checks.push({
|
|
@@ -887,15 +804,17 @@ export async function doctorCommand(options = {}) {
|
|
|
887
804
|
}
|
|
888
805
|
} catch {}
|
|
889
806
|
|
|
890
|
-
console.log(chalk.cyan('\n Claude Code Plugins (required by morph-spec init)'));
|
|
891
807
|
const pluginsFile = join(homedir(), '.claude', 'plugins', 'installed_plugins.json');
|
|
892
808
|
let pluginData = { plugins: {} };
|
|
893
809
|
try {
|
|
894
810
|
pluginData = JSON.parse(await fs.readFile(pluginsFile, 'utf8'));
|
|
895
811
|
} catch {}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
812
|
+
if (checkInstalledPlugins(pluginData.plugins || {}).context7) {
|
|
813
|
+
checks.push({ name: 'context7 plugin', status: 'ok' });
|
|
814
|
+
} else {
|
|
815
|
+
checks.push({ name: 'context7 plugin', status: 'missing', msg: 'run: claude plugin install context7@claude-plugins-official' });
|
|
816
|
+
hasErrors = true;
|
|
817
|
+
}
|
|
899
818
|
} else {
|
|
900
819
|
// `.claude/` without commands/ or skills/: count what is left; near-total loss is an ERROR with the fix.
|
|
901
820
|
const pieces = ['agents', 'rules', 'skills', 'commands'];
|
|
@@ -936,10 +855,9 @@ export async function doctorCommand(options = {}) {
|
|
|
936
855
|
checks.push({ name: 'codebase graph', status: 'ok', msg: graphAudit.msg });
|
|
937
856
|
}
|
|
938
857
|
|
|
939
|
-
const frameworkTemplatesRoot = join(import.meta.dirname, '..', '..', '..', 'framework', 'templates');
|
|
940
858
|
const keyTemplates = [
|
|
941
|
-
{ name: 'plan.md', path: join(
|
|
942
|
-
{ name: 'morph-uiux mockups.md', path: join(
|
|
859
|
+
{ name: 'plan.md', path: join(PACKAGE_FRAMEWORK, 'templates', 'docs', 'plan.md') },
|
|
860
|
+
{ name: 'morph-uiux mockups.md', path: join(PACKAGE_FRAMEWORK, 'skills', 'core', 'morph-uiux', 'references', 'mockups.md') }
|
|
943
861
|
];
|
|
944
862
|
const missingTemplates = [];
|
|
945
863
|
for (const template of keyTemplates) {
|
|
@@ -960,24 +878,22 @@ export async function doctorCommand(options = {}) {
|
|
|
960
878
|
|
|
961
879
|
const nodeVersion = process.version;
|
|
962
880
|
const majorVersion = parseInt(nodeVersion.slice(1).split('.')[0], 10);
|
|
963
|
-
if (majorVersion >=
|
|
881
|
+
if (majorVersion >= 22) {
|
|
964
882
|
checks.push({ name: `Node.js ${nodeVersion}`, status: 'ok' });
|
|
965
883
|
} else {
|
|
966
|
-
checks.push({ name: `Node.js ${nodeVersion}`, status: 'warn', msg: '
|
|
884
|
+
checks.push({ name: `Node.js ${nodeVersion}`, status: 'warn', msg: 'v22+ required' });
|
|
967
885
|
hasWarnings = true;
|
|
968
886
|
}
|
|
969
887
|
|
|
970
|
-
for (const
|
|
971
|
-
if (
|
|
972
|
-
console.log(chalk.green(` ✓ ${
|
|
973
|
-
} else if (
|
|
974
|
-
console.log(chalk.yellow(` ⚠ ${
|
|
975
|
-
} else if (
|
|
976
|
-
console.log(chalk.red(` ✗ ${
|
|
977
|
-
} else if (
|
|
978
|
-
console.log(chalk.red(` ✗ ${
|
|
979
|
-
} else if (check.status === 'skip') {
|
|
980
|
-
console.log(chalk.gray(` ○ ${check.name}`) + chalk.gray(check.msg ? ` (${check.msg})` : ''));
|
|
888
|
+
for (const c of checks) {
|
|
889
|
+
if (c.status === 'ok') {
|
|
890
|
+
console.log(chalk.green(` ✓ ${c.name}`));
|
|
891
|
+
} else if (c.status === 'warn') {
|
|
892
|
+
console.log(chalk.yellow(` ⚠ ${c.name}`) + chalk.gray(` (${c.msg})`));
|
|
893
|
+
} else if (c.status === 'missing') {
|
|
894
|
+
console.log(chalk.red(` ✗ ${c.name}`) + chalk.gray(c.msg ? ` (missing — ${c.msg})` : ' (missing)'));
|
|
895
|
+
} else if (c.status === 'error') {
|
|
896
|
+
console.log(chalk.red(` ✗ ${c.name}`) + chalk.gray(` (${c.msg})`));
|
|
981
897
|
}
|
|
982
898
|
}
|
|
983
899
|
|
|
@@ -3,7 +3,8 @@ import { execFileSync } from 'child_process';
|
|
|
3
3
|
import { readMorphConfig } from '../../lib/config/project-config.js';
|
|
4
4
|
import { branchEnv } from '../../lib/contract/ports.js';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/** `null` on a detached HEAD or outside git. */
|
|
7
|
+
export function currentBranch(cwd) {
|
|
7
8
|
try {
|
|
8
9
|
const branch = execFileSync('git', ['rev-parse', '--abbrev-ref', 'HEAD'], { cwd, stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim();
|
|
9
10
|
return branch && branch !== 'HEAD' ? branch : null;
|