hero-mmt-kit 1.0.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/CHANGELOG.md +57 -0
- package/LICENSE +21 -0
- package/README.md +158 -0
- package/bin/hero-mmt-kit.js +70 -0
- package/package.json +35 -0
- package/presets/enterprise.json +3 -0
- package/presets/small-team.json +3 -0
- package/presets/solo.json +3 -0
- package/skills.manifest.json +72 -0
- package/src/detect.cjs +43 -0
- package/src/discover.cjs +159 -0
- package/src/doctor.cjs +130 -0
- package/src/init.cjs +114 -0
- package/src/integrations.cjs +93 -0
- package/src/links.cjs +37 -0
- package/src/merge.cjs +61 -0
- package/src/profile-config.cjs +28 -0
- package/src/render.cjs +27 -0
- package/src/skills.cjs +107 -0
- package/src/update.cjs +75 -0
- package/src/util.cjs +56 -0
- package/src/workflow-state.cjs +65 -0
- package/templates/.hero-mmt-kit/session.schema.json +15 -0
- package/templates/AGENTS.md.tmpl +16 -0
- package/templates/CLAUDE.md.tmpl +23 -0
- package/templates/common/.claude/hooks/git-guard.cjs +57 -0
- package/templates/common/.claude/hooks/session-bridge.cjs +43 -0
- package/templates/common/.claude/hooks/stop-reminder.cjs +43 -0
- package/templates/common/.claude/settings.json +27 -0
- package/templates/docs/ACTIVE_STATE.md +41 -0
- package/templates/docs/BROWNFIELD_DISCOVERY.md +45 -0
- package/templates/docs/DESIGN_STANDARDS.md +86 -0
- package/templates/docs/INTERACTION_PATTERNS.md +58 -0
- package/templates/docs/PERFORMANCE_STANDARDS.md +31 -0
- package/templates/docs/SECURITY_STANDARDS.md +38 -0
- package/templates/docs/templates/DESIGN_BRIEF.md +44 -0
- package/templates/docs/templates/PRD_AI_FEATURE.md +87 -0
- package/templates/skills/NOTICE +69 -0
- package/templates/skills/brainstorming/SKILL.md +161 -0
- package/templates/skills/brainstorming/scripts/frame-template.html +214 -0
- package/templates/skills/brainstorming/scripts/helper.js +88 -0
- package/templates/skills/brainstorming/scripts/server.cjs +354 -0
- package/templates/skills/brainstorming/scripts/start-server.sh +148 -0
- package/templates/skills/brainstorming/scripts/stop-server.sh +56 -0
- package/templates/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/templates/skills/brainstorming/visual-companion.md +287 -0
- package/templates/skills/dispatching-parallel-agents/SKILL.md +186 -0
- package/templates/skills/executing-plans/SKILL.md +72 -0
- package/templates/skills/finishing-a-development-branch/SKILL.md +253 -0
- package/templates/skills/hero-coding/SKILL.md +69 -0
- package/templates/skills/hero-planning/SKILL.md +64 -0
- package/templates/skills/hero-reviewing/SKILL.md +66 -0
- package/templates/skills/hero-security/SKILL.md +425 -0
- package/templates/skills/hero-strict/SKILL.md +77 -0
- package/templates/skills/hero-unit-test/SKILL.md +79 -0
- package/templates/skills/receiving-code-review/SKILL.md +213 -0
- package/templates/skills/requesting-code-review/SKILL.md +108 -0
- package/templates/skills/requesting-code-review/code-reviewer.md +168 -0
- package/templates/skills/subagent-driven-development/SKILL.md +269 -0
- package/templates/skills/subagent-driven-development/code-quality-reviewer-prompt.md +34 -0
- package/templates/skills/subagent-driven-development/implementer-prompt.md +121 -0
- package/templates/skills/subagent-driven-development/scripts/review-package.sh +38 -0
- package/templates/skills/subagent-driven-development/scripts/sdd-workspace.sh +25 -0
- package/templates/skills/subagent-driven-development/scripts/task-brief.sh +58 -0
- package/templates/skills/subagent-driven-development/spec-reviewer-prompt.md +76 -0
- package/templates/skills/systematic-debugging/SKILL.md +296 -0
- package/templates/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/templates/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/templates/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/templates/skills/systematic-debugging/find-polluter.sh +63 -0
- package/templates/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/templates/skills/test-driven-development/SKILL.md +371 -0
- package/templates/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/templates/skills/using-git-worktrees/SKILL.md +206 -0
- package/templates/skills/using-hero/SKILL.md +54 -0
- package/templates/skills/using-superpowers/SKILL.md +119 -0
- package/templates/skills/verification-before-completion/SKILL.md +139 -0
- package/templates/skills/writing-plans/SKILL.md +173 -0
- package/templates/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
package/src/doctor.cjs
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const { spawnSync } = require('child_process');
|
|
5
|
+
const { log, exists, readJSON } = require('./util.cjs');
|
|
6
|
+
const { checkLinks } = require('./links.cjs');
|
|
7
|
+
const { readSession, validateSession } = require('./workflow-state.cjs');
|
|
8
|
+
|
|
9
|
+
const ACTIVE_STATE_BLOAT_LINES = 150;
|
|
10
|
+
|
|
11
|
+
function hookCheck(hookFile, payload) {
|
|
12
|
+
const r = spawnSync('node', [hookFile], { input: JSON.stringify(payload), encoding: 'utf8' });
|
|
13
|
+
return { code: r.status, err: (r.stderr || '').trim(), out: (r.stdout || '').trim() };
|
|
14
|
+
}
|
|
15
|
+
function which(cmd) {
|
|
16
|
+
const r = spawnSync(process.platform === 'win32' ? 'where' : 'which', [cmd], { encoding: 'utf8' });
|
|
17
|
+
return r.status === 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function checkGitGuard(gg) {
|
|
21
|
+
const block = hookCheck(gg, { tool_name: 'Bash', tool_input: { command: 'git push -f origin main' } });
|
|
22
|
+
const allow = hookCheck(gg, { tool_name: 'Bash', tool_input: { command: 'git status' } });
|
|
23
|
+
return block.code === 2 && allow.code === 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getGitDirtyFiles(target) {
|
|
27
|
+
try {
|
|
28
|
+
const r = spawnSync('git', ['status', '--porcelain'], { cwd: target, encoding: 'utf8', timeout: 5000 });
|
|
29
|
+
if (r.status !== 0) return null;
|
|
30
|
+
return (r.stdout || '').split('\n').filter(Boolean).map((l) => l.slice(3).trim());
|
|
31
|
+
} catch { return null; }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function doctor(opts) {
|
|
35
|
+
const { target, flags } = opts;
|
|
36
|
+
const strict = !!(flags && flags.strict);
|
|
37
|
+
log.title('hero-mmt-kit · doctor' + (strict ? ' --strict' : ''));
|
|
38
|
+
let pass = 0, warn = 0, fail = 0, strictWarn = 0;
|
|
39
|
+
const ok = (m) => { log.ok(m); pass++; };
|
|
40
|
+
const wn = (m) => { log.warn(m); warn++; };
|
|
41
|
+
const er = (m) => { log.err(m); fail++; };
|
|
42
|
+
// sw = compliance warning: escalates to fail in --strict mode
|
|
43
|
+
const sw = (m) => { if (strict) { log.err(m); fail++; strictWarn++; } else { log.warn(m); warn++; } };
|
|
44
|
+
|
|
45
|
+
const cfg = readJSON(path.join(target, '.hero-mmt-kit', 'config.json'), null);
|
|
46
|
+
if (cfg) {
|
|
47
|
+
ok(`config: v${cfg.version} · ${cfg.brownfield ? 'brownfield' : 'new'}`);
|
|
48
|
+
} else er('config missing (.hero-mmt-kit/config.json) — run `hero-mmt-kit init`');
|
|
49
|
+
|
|
50
|
+
const sp = path.join(target, '.claude', 'settings.json');
|
|
51
|
+
const settings = readJSON(sp, null);
|
|
52
|
+
if (!exists(sp)) er('.claude/settings.json missing');
|
|
53
|
+
else if (!settings) er('.claude/settings.json is invalid JSON');
|
|
54
|
+
else {
|
|
55
|
+
const cmds = JSON.stringify(settings.hooks || {});
|
|
56
|
+
cmds.includes('git-guard.cjs') ? ok('Claude settings.json: git-guard hook wired') : wn('Claude git-guard hook not wired in settings.json');
|
|
57
|
+
cmds.includes('stop-reminder.cjs') ? ok('Claude settings.json: stop-reminder hook wired') : wn('Claude stop-reminder hook not wired');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const gg = path.join(target, '.claude', 'hooks', 'git-guard.cjs');
|
|
61
|
+
if (exists(gg)) {
|
|
62
|
+
checkGitGuard(gg)
|
|
63
|
+
? ok('Claude git-guard self-test: blocks force-push, allows safe git')
|
|
64
|
+
: er('Claude git-guard self-test failed');
|
|
65
|
+
} else er('.claude/hooks/git-guard.cjs missing');
|
|
66
|
+
|
|
67
|
+
const sr = path.join(target, '.claude', 'hooks', 'stop-reminder.cjs');
|
|
68
|
+
if (exists(sr)) {
|
|
69
|
+
const r = hookCheck(sr, { hook_event_name: 'Stop', stop_hook_active: true, cwd: target });
|
|
70
|
+
r.code === 0 ? ok('Claude stop-reminder self-test: ok') : er('Claude stop-reminder self-test failed');
|
|
71
|
+
} else er('.claude/hooks/stop-reminder.cjs missing');
|
|
72
|
+
|
|
73
|
+
// --- Workflow compliance ---
|
|
74
|
+
log.title('Workflow compliance');
|
|
75
|
+
|
|
76
|
+
const session = readSession(target);
|
|
77
|
+
if (!session) {
|
|
78
|
+
sw('session.json missing (.hero-mmt-kit/session.json) — run `hero-mmt-kit update`');
|
|
79
|
+
} else {
|
|
80
|
+
const { ok: sessionOk, errors: sessionErrors } = validateSession(session);
|
|
81
|
+
if (sessionOk) {
|
|
82
|
+
ok('session.json: valid (schemaVersion 1)');
|
|
83
|
+
} else {
|
|
84
|
+
er('session.json invalid: ' + sessionErrors.join('; '));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ACTIVE_STATE.md bloat check
|
|
88
|
+
const activePath = path.join(target, 'docs', 'ACTIVE_STATE.md');
|
|
89
|
+
if (exists(activePath)) {
|
|
90
|
+
const lines = fs.readFileSync(activePath, 'utf8').split('\n').length;
|
|
91
|
+
if (lines > ACTIVE_STATE_BLOAT_LINES) {
|
|
92
|
+
sw(`ACTIVE_STATE.md has ${lines} lines (>${ACTIVE_STATE_BLOAT_LINES}) — archive completed items to docs/reports/ to keep it a short index`);
|
|
93
|
+
} else {
|
|
94
|
+
ok(`ACTIVE_STATE.md: ${lines} lines (under ${ACTIVE_STATE_BLOAT_LINES} threshold)`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Dirty git + ACTIVE_STATE not touched
|
|
99
|
+
const dirtyFiles = getGitDirtyFiles(target);
|
|
100
|
+
if (dirtyFiles !== null && dirtyFiles.length > 0) {
|
|
101
|
+
const activeStateChanged = dirtyFiles.some((f) => f === 'docs/ACTIVE_STATE.md' || f === path.join('docs', 'ACTIVE_STATE.md'));
|
|
102
|
+
if (!activeStateChanged && !dirtyFiles.some((f) => f === '.hero-mmt-kit/session.json')) {
|
|
103
|
+
wn('git working tree is dirty but neither ACTIVE_STATE.md nor session.json is in the changes — consider updating workflow state');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// --- Doc links ---
|
|
109
|
+
const { broken, checked } = checkLinks([path.join(target, 'docs'), path.join(target, 'CLAUDE.md'), path.join(target, 'AGENTS.md')]);
|
|
110
|
+
if (broken.length === 0) ok(`doc links: ${checked} checked, 0 broken`);
|
|
111
|
+
else { er(`doc links: ${broken.length} broken`); broken.slice(0, 8).forEach((b) => console.log(' - ' + path.relative(target, b.file) + ' -> ' + b.link)); }
|
|
112
|
+
|
|
113
|
+
log.title('Tools');
|
|
114
|
+
ok(`node: ${process.version} (required)`);
|
|
115
|
+
// Tool presence is always warn-only (never strict-fail) — optional/recommended absences are expected
|
|
116
|
+
status('git', which('git'), 'recommended');
|
|
117
|
+
status('Claude skills (.claude/skills)', exists(path.join(target, '.claude', 'skills')), 'recommended');
|
|
118
|
+
status('GitNexus index (.gitnexus)', exists(path.join(target, '.gitnexus')), 'optional');
|
|
119
|
+
status('Serena (.serena)', exists(path.join(target, '.serena')), 'optional');
|
|
120
|
+
|
|
121
|
+
function status(name, present, tier) { present ? ok(`${name}: present (${tier})`) : wn(`${name}: absent (${tier})`); }
|
|
122
|
+
|
|
123
|
+
log.title(`Result: ${pass} ok · ${warn} warn · ${fail} fail`);
|
|
124
|
+
if (strict && strictWarn > 0) {
|
|
125
|
+
process.stderr.write(` ✗ --strict mode: ${strictWarn} compliance warning(s) treated as failure(s)\n`);
|
|
126
|
+
}
|
|
127
|
+
process.exit(fail > 0 ? 1 : 0);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
module.exports = { doctor };
|
package/src/init.cjs
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { log, ensureDir, exists, backup, writeJSON, makeAsker } = require('./util.cjs');
|
|
5
|
+
const { detect } = require('./detect.cjs');
|
|
6
|
+
const { renderTree, renderString } = require('./render.cjs');
|
|
7
|
+
const { mergeManagedBlock, mergeSettings } = require('./merge.cjs');
|
|
8
|
+
const { collectProfileConfig } = require('./profile-config.cjs');
|
|
9
|
+
const { defaultSession } = require('./workflow-state.cjs');
|
|
10
|
+
|
|
11
|
+
async function init(opts) {
|
|
12
|
+
const { pkgRoot, target, flags } = opts;
|
|
13
|
+
const templates = path.join(pkgRoot, 'templates');
|
|
14
|
+
const auto = !!flags.yes;
|
|
15
|
+
const ask = makeAsker(auto);
|
|
16
|
+
|
|
17
|
+
log.title('hero-mmt-kit · init');
|
|
18
|
+
const d = detect(target);
|
|
19
|
+
log.step(`Target : ${target}`);
|
|
20
|
+
log.step(`Mode : ${d.brownfield ? 'brownfield (existing project)' : 'new project'}`);
|
|
21
|
+
|
|
22
|
+
// ---- config ----
|
|
23
|
+
let cfg = {};
|
|
24
|
+
if (flags.preset) {
|
|
25
|
+
const pf = path.join(pkgRoot, 'presets', String(flags.preset) + '.json');
|
|
26
|
+
if (!exists(pf)) { log.err(`Unknown preset: ${flags.preset}`); ask.close(); process.exit(1); }
|
|
27
|
+
cfg = JSON.parse(fs.readFileSync(pf, 'utf8'));
|
|
28
|
+
log.ok(`Preset : ${flags.preset}`);
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
cfg = await collectProfileConfig(cfg, flags, ask);
|
|
32
|
+
} catch (e) {
|
|
33
|
+
log.err(e.message);
|
|
34
|
+
ask.close();
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
if (!cfg.enforceLevel) cfg.enforceLevel = 'mixed';
|
|
38
|
+
delete cfg.lang;
|
|
39
|
+
cfg.version = JSON.parse(fs.readFileSync(path.join(pkgRoot, 'package.json'), 'utf8')).version;
|
|
40
|
+
cfg.brownfield = d.brownfield;
|
|
41
|
+
|
|
42
|
+
const vars = { DATE: new Date().toISOString().slice(0, 10) };
|
|
43
|
+
|
|
44
|
+
const skillDirs = ['.claude/skills'];
|
|
45
|
+
|
|
46
|
+
// ---- 1. docs ----
|
|
47
|
+
const srcDocs = path.join(templates, 'docs');
|
|
48
|
+
let docCount = 0, keptActiveState = false;
|
|
49
|
+
for (const f of renderTree(srcDocs, vars)) {
|
|
50
|
+
const dest = path.join(target, 'docs', f.rel);
|
|
51
|
+
if (path.basename(f.rel) === 'ACTIVE_STATE.md' && exists(dest)) { keptActiveState = true; continue; }
|
|
52
|
+
if (path.basename(f.rel) === 'BROWNFIELD_DISCOVERY.md' && exists(dest)) continue;
|
|
53
|
+
ensureDir(path.dirname(dest));
|
|
54
|
+
if (exists(dest)) backup(dest);
|
|
55
|
+
fs.writeFileSync(dest, f.content);
|
|
56
|
+
docCount++;
|
|
57
|
+
}
|
|
58
|
+
log.ok(`Docs : ${docCount} file(s)` + (keptActiveState ? ' · kept existing ACTIVE_STATE.md' : ''));
|
|
59
|
+
|
|
60
|
+
// ---- 2. CLAUDE.md / AGENTS.md managed block ----
|
|
61
|
+
const claudeInner = renderString(fs.readFileSync(path.join(templates, 'CLAUDE.md.tmpl'), 'utf8'), vars);
|
|
62
|
+
const agentsInner = renderString(fs.readFileSync(path.join(templates, 'AGENTS.md.tmpl'), 'utf8'), vars);
|
|
63
|
+
log.ok(`CLAUDE.md: ${mergeManagedBlock(path.join(target, 'CLAUDE.md'), claudeInner, 'Project')}`);
|
|
64
|
+
log.ok(`AGENTS.md: ${mergeManagedBlock(path.join(target, 'AGENTS.md'), agentsInner, null)}`);
|
|
65
|
+
|
|
66
|
+
// ---- 3. Claude Code hooks + settings ----
|
|
67
|
+
ensureDir(path.join(target, '.claude', 'hooks'));
|
|
68
|
+
for (const h of ['git-guard.cjs', 'stop-reminder.cjs', 'session-bridge.cjs']) {
|
|
69
|
+
fs.copyFileSync(path.join(templates, 'common', '.claude', 'hooks', h), path.join(target, '.claude', 'hooks', h));
|
|
70
|
+
}
|
|
71
|
+
mergeSettings(path.join(target, '.claude', 'settings.json'), path.join(templates, 'common', '.claude', 'settings.json'));
|
|
72
|
+
log.ok('Claude : git-guard + stop-reminder + session-bridge → .claude/hooks; settings.json merged');
|
|
73
|
+
|
|
74
|
+
// ---- 3a. selected vendored core skills ----
|
|
75
|
+
const skills = require('./skills.cjs');
|
|
76
|
+
const selectedSkills = skills.selectProcessSkills(cfg);
|
|
77
|
+
const sk = skills.installSkills(pkgRoot, target, { selectedSkills, destinations: skillDirs });
|
|
78
|
+
log.ok(`Skills : ${sk.skills} bundled core skill(s) → ${skillDirs.join(', ') || '(none)'}`);
|
|
79
|
+
|
|
80
|
+
// ---- 4. config + session state ----
|
|
81
|
+
writeJSON(path.join(target, '.hero-mmt-kit', 'config.json'), cfg);
|
|
82
|
+
log.ok('Config : .hero-mmt-kit/config.json');
|
|
83
|
+
|
|
84
|
+
const sessionPath = path.join(target, '.hero-mmt-kit', 'session.json');
|
|
85
|
+
if (!exists(sessionPath)) {
|
|
86
|
+
writeJSON(sessionPath, defaultSession());
|
|
87
|
+
log.ok('Session : .hero-mmt-kit/session.json (seeded)');
|
|
88
|
+
} else {
|
|
89
|
+
log.ok('Session : .hero-mmt-kit/session.json (preserved)');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const schemaSrc = path.join(pkgRoot, 'templates', '.hero-mmt-kit', 'session.schema.json');
|
|
93
|
+
if (exists(schemaSrc)) {
|
|
94
|
+
const schemaDest = path.join(target, '.hero-mmt-kit', 'session.schema.json');
|
|
95
|
+
if (!exists(schemaDest)) fs.copyFileSync(schemaSrc, schemaDest);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ---- 5. optional integrations ----
|
|
99
|
+
if (!flags['skip-integrations']) {
|
|
100
|
+
await require('./integrations.cjs').run({ target, cfg, detect: d, pkgRoot });
|
|
101
|
+
} else {
|
|
102
|
+
log.warn('Skipped integrations (design skills / gitnexus / serena). Core skills are bundled regardless.');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
ask.close();
|
|
106
|
+
|
|
107
|
+
log.title('Next steps');
|
|
108
|
+
console.log(' 1. Invoke the using-hero skill for an overview of the hero-* workflow skills.');
|
|
109
|
+
console.log(' 2. Restart Claude Code (or run /hooks) to activate .claude hooks.');
|
|
110
|
+
console.log(' 3. Fill <TBD> in SECURITY_STANDARDS / PERFORMANCE_STANDARDS when you pick a stack.');
|
|
111
|
+
console.log(' 4. Run: npx hero-mmt-kit doctor');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
module.exports = { init };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { spawnSync } = require('child_process');
|
|
5
|
+
const { log, exists, ensureDir, readJSON, writeJSON } = require('./util.cjs');
|
|
6
|
+
|
|
7
|
+
function uniqueSources(group) {
|
|
8
|
+
return Array.from(new Set((group && group.skills || []).map((s) => s.source)));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function installableSources(group) {
|
|
12
|
+
return uniqueSources(group).filter((src) => src && src !== '<TBD>');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function wantsDesignIntegration(cfg) {
|
|
16
|
+
return !!(cfg && cfg.installTasteSkill);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function runCmd(cmd, args, cwd) {
|
|
20
|
+
try {
|
|
21
|
+
const r = spawnSync(cmd, args, { cwd, stdio: 'inherit', shell: process.platform === 'win32' });
|
|
22
|
+
return r.status === 0;
|
|
23
|
+
} catch (_) { return false; }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const SERENA_MEMOS = {
|
|
27
|
+
'hero_workflow.md':
|
|
28
|
+
'Human-led Claude Code workflow (hero-mmt-kit). Use the **using-hero** skill for the overview.\n\n' +
|
|
29
|
+
'Core skills: hero-planning (plan before code), hero-coding (implement), hero-reviewing (fresh-eyes check), ' +
|
|
30
|
+
'hero-unit-test (TDD-first or post-implementation tests), hero-security (standalone security review), ' +
|
|
31
|
+
'hero-strict (opt-in full verification pass before a "done" claim).\n\n' +
|
|
32
|
+
'Session state: `.hero-mmt-kit/session.json` (currentSkill, resumePath, nextAction) + docs/ACTIVE_STATE.md.\n\n' +
|
|
33
|
+
'Details (always read the source files, do not duplicate here): docs/ACTIVE_STATE.md, docs/SECURITY_STANDARDS.md, ' +
|
|
34
|
+
'docs/PERFORMANCE_STANDARDS.md.\n',
|
|
35
|
+
'delegation_rules.md':
|
|
36
|
+
'Sub-agent delegation is optional, not automatic.\n\n' +
|
|
37
|
+
'Summary: sub-agents are best as context-collectors (research/exploration) and reviewers (hero-reviewing). ' +
|
|
38
|
+
'Delegating implementation (hero-coding) is OPTIONAL: work directly with full context by default, and delegate ' +
|
|
39
|
+
'only when it genuinely helps (independent parallel tracks, or to isolate context). Not every task needs a sub-agent. ' +
|
|
40
|
+
'Sub-agents do NOT inherit the conversation/skills/context → any delegated prompt must be SELF-CONTAINED ' +
|
|
41
|
+
'(plan/report links, skills to invoke, Definition of Done, relevant files). Use isolation: "worktree" for overlapping edits.\n',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
async function run(ctx) {
|
|
45
|
+
const { target, cfg, detect, pkgRoot } = ctx;
|
|
46
|
+
const manifest = readJSON(path.join(pkgRoot, 'skills.manifest.json'), { groups: {} });
|
|
47
|
+
cfg.integrations = cfg.integrations || {};
|
|
48
|
+
|
|
49
|
+
log.title('Integrations (auto-detected — no prompts)');
|
|
50
|
+
|
|
51
|
+
// ---- Skills (process core) ----
|
|
52
|
+
// Core process skills are now VENDORED and installed by init/update into
|
|
53
|
+
// .claude/skills/ (no `skills` CLI needed). Nothing to do here.
|
|
54
|
+
cfg.integrations.skills = 'bundled';
|
|
55
|
+
|
|
56
|
+
// ---- Skills (design — installed only when the user opted into the taste/design skill) ----
|
|
57
|
+
const wantsDesign = wantsDesignIntegration(cfg);
|
|
58
|
+
const designGroups = ['brand', 'design-direction', 'design-tools'];
|
|
59
|
+
const designSources = Array.from(new Set(designGroups.flatMap((name) => installableSources(manifest.groups && manifest.groups[name]))));
|
|
60
|
+
if (wantsDesign && designSources.length) {
|
|
61
|
+
for (const src of designSources) runCmd('npx', ['--yes', 'skills', 'add', src, '--yes'], target);
|
|
62
|
+
cfg.integrations.design = 'installed';
|
|
63
|
+
log.ok('Design packs installed — set ONE direction + profile in docs/DESIGN_STANDARDS.md §2.');
|
|
64
|
+
} else {
|
|
65
|
+
cfg.integrations.design = 'skipped';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ---- GitNexus (auto-run only if this repo already has a .gitnexus index) ----
|
|
69
|
+
if (detect.hasGitnexus) {
|
|
70
|
+
log.step('npx gitnexus analyze');
|
|
71
|
+
cfg.integrations.gitnexus = runCmd('npx', ['--yes', 'gitnexus', 'analyze'], target) ? 'indexed' : 'failed';
|
|
72
|
+
if (cfg.integrations.gitnexus === 'failed') log.warn('GitNexus not run. Install/retry later: npx gitnexus analyze');
|
|
73
|
+
} else {
|
|
74
|
+
cfg.integrations.gitnexus = 'skipped';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ---- Serena (auto-seed pointer notes only if Serena is already installed) ----
|
|
78
|
+
if (detect.hasSerena) {
|
|
79
|
+
const memDir = path.join(target, '.serena', 'memories', 'project');
|
|
80
|
+
ensureDir(memDir);
|
|
81
|
+
for (const [name, content] of Object.entries(SERENA_MEMOS)) {
|
|
82
|
+
fs.writeFileSync(path.join(memDir, name), content);
|
|
83
|
+
}
|
|
84
|
+
cfg.integrations.serena = 'seeded';
|
|
85
|
+
log.ok('Serena pointer notes seeded (.serena/memories/project/).');
|
|
86
|
+
} else {
|
|
87
|
+
cfg.integrations.serena = 'skipped';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
writeJSON(path.join(target, '.hero-mmt-kit', 'config.json'), cfg);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
module.exports = { installableSources, run, wantsDesignIntegration };
|
package/src/links.cjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
function walk(dir) {
|
|
6
|
+
let out = [];
|
|
7
|
+
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
8
|
+
const p = path.join(dir, e.name);
|
|
9
|
+
if (e.isDirectory()) out = out.concat(walk(p));
|
|
10
|
+
else out.push(p);
|
|
11
|
+
}
|
|
12
|
+
return out;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Check relative .md links resolve. roots = list of files or dirs.
|
|
16
|
+
function checkLinks(roots) {
|
|
17
|
+
const broken = [];
|
|
18
|
+
let checked = 0;
|
|
19
|
+
for (const root of roots) {
|
|
20
|
+
if (!fs.existsSync(root)) continue;
|
|
21
|
+
const files = fs.statSync(root).isDirectory() ? walk(root).filter((f) => f.endsWith('.md')) : [root];
|
|
22
|
+
for (const f of files) {
|
|
23
|
+
const dir = path.dirname(f);
|
|
24
|
+
const txt = fs.readFileSync(f, 'utf8');
|
|
25
|
+
const re = /\]\((\.{1,2}\/[^)#? ]+\.md)/g;
|
|
26
|
+
let m;
|
|
27
|
+
while ((m = re.exec(txt))) {
|
|
28
|
+
checked++;
|
|
29
|
+
const t = path.normalize(path.join(dir, m[1]));
|
|
30
|
+
if (!fs.existsSync(t)) broken.push({ file: f, link: m[1] });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return { broken, checked };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = { checkLinks, walk };
|
package/src/merge.cjs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { ensureDir, exists, backup } = require('./util.cjs');
|
|
5
|
+
|
|
6
|
+
const START = '<!-- hero-mmt-kit:start -->';
|
|
7
|
+
const END = '<!-- hero-mmt-kit:end -->';
|
|
8
|
+
|
|
9
|
+
function escapeRe(s) { return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); }
|
|
10
|
+
|
|
11
|
+
function block(inner) {
|
|
12
|
+
return `${START}\n<!-- Managed by hero-mmt-kit. Update via the framework; edits inside this block are overwritten on \`update\`. -->\n${inner.trim()}\n${END}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Insert/replace the hero-mmt-kit managed block. Preserves everything outside the markers.
|
|
16
|
+
function mergeManagedBlock(file, inner, titleIfNew) {
|
|
17
|
+
const b = block(inner);
|
|
18
|
+
if (!exists(file)) {
|
|
19
|
+
ensureDir(path.dirname(file));
|
|
20
|
+
const head = titleIfNew ? `# ${titleIfNew}\n\n` : '';
|
|
21
|
+
fs.writeFileSync(file, head + b + '\n');
|
|
22
|
+
return 'created';
|
|
23
|
+
}
|
|
24
|
+
let txt = fs.readFileSync(file, 'utf8');
|
|
25
|
+
backup(file);
|
|
26
|
+
if (txt.includes(START) && txt.includes(END)) {
|
|
27
|
+
txt = txt.replace(new RegExp(escapeRe(START) + '[\\s\\S]*?' + escapeRe(END)), b);
|
|
28
|
+
} else {
|
|
29
|
+
txt = txt.replace(/\s*$/, '') + '\n\n' + b + '\n';
|
|
30
|
+
}
|
|
31
|
+
fs.writeFileSync(file, txt);
|
|
32
|
+
return 'merged';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Deep-merge our hooks + permissions into an existing settings.json without clobbering the user's.
|
|
36
|
+
function mergeSettings(file, templateFile) {
|
|
37
|
+
const tpl = JSON.parse(fs.readFileSync(templateFile, 'utf8'));
|
|
38
|
+
let cur = {};
|
|
39
|
+
if (exists(file)) { cur = JSON.parse(fs.readFileSync(file, 'utf8')); backup(file); }
|
|
40
|
+
else ensureDir(path.dirname(file));
|
|
41
|
+
|
|
42
|
+
cur.hooks = cur.hooks || {};
|
|
43
|
+
for (const ev of Object.keys(tpl.hooks || {})) {
|
|
44
|
+
cur.hooks[ev] = cur.hooks[ev] || [];
|
|
45
|
+
const existingCmds = new Set();
|
|
46
|
+
for (const m of cur.hooks[ev]) for (const h of (m.hooks || [])) existingCmds.add(h.command);
|
|
47
|
+
for (const matcher of tpl.hooks[ev]) {
|
|
48
|
+
const newHooks = (matcher.hooks || []).filter((h) => !existingCmds.has(h.command));
|
|
49
|
+
if (newHooks.length) cur.hooks[ev].push(Object.assign({}, matcher, { hooks: newHooks }));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (tpl.permissions && tpl.permissions.allow) {
|
|
54
|
+
cur.permissions = cur.permissions || {};
|
|
55
|
+
cur.permissions.allow = Array.from(new Set([...(cur.permissions.allow || []), ...tpl.permissions.allow]));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fs.writeFileSync(file, JSON.stringify(cur, null, 2) + '\n');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = { mergeManagedBlock, mergeSettings, START, END };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function normalizeProfileConfig(input, flags) {
|
|
4
|
+
input = input || {};
|
|
5
|
+
flags = flags || {};
|
|
6
|
+
const installTasteSkill = Object.prototype.hasOwnProperty.call(flags, 'taste')
|
|
7
|
+
? !!flags.taste
|
|
8
|
+
: !!input.installTasteSkill;
|
|
9
|
+
return Object.assign({}, input, { installTasteSkill });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async function collectProfileConfig(input, flags, ask) {
|
|
13
|
+
input = input || {};
|
|
14
|
+
flags = flags || {};
|
|
15
|
+
|
|
16
|
+
if (!Object.prototype.hasOwnProperty.call(flags, 'taste') && typeof input.installTasteSkill !== 'boolean') {
|
|
17
|
+
input = Object.assign({}, input, {
|
|
18
|
+
installTasteSkill: await ask.yesno('Install the taste/design skill?', false),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return normalizeProfileConfig(input, flags);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = {
|
|
26
|
+
normalizeProfileConfig,
|
|
27
|
+
collectProfileConfig,
|
|
28
|
+
};
|
package/src/render.cjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
function renderString(s, vars) {
|
|
6
|
+
return s.replace(/\{\{(\w+)\}\}/g, (m, k) => (k in vars ? vars[k] : m));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function walk(dir) {
|
|
10
|
+
let out = [];
|
|
11
|
+
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
12
|
+
const p = path.join(dir, e.name);
|
|
13
|
+
if (e.isDirectory()) out = out.concat(walk(p));
|
|
14
|
+
else out.push(p);
|
|
15
|
+
}
|
|
16
|
+
return out;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Returns [{ rel, content }] with placeholders substituted.
|
|
20
|
+
function renderTree(srcDir, vars) {
|
|
21
|
+
return walk(srcDir).map((abs) => ({
|
|
22
|
+
rel: path.relative(srcDir, abs),
|
|
23
|
+
content: renderString(fs.readFileSync(abs, 'utf8'), vars),
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = { renderString, renderTree, walk };
|
package/src/skills.cjs
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { exists, ensureDir } = require('./util.cjs');
|
|
5
|
+
|
|
6
|
+
const CORE_SKILL_ORDER = [
|
|
7
|
+
'using-superpowers',
|
|
8
|
+
'using-hero',
|
|
9
|
+
'brainstorming',
|
|
10
|
+
'writing-plans',
|
|
11
|
+
'executing-plans',
|
|
12
|
+
'test-driven-development',
|
|
13
|
+
'systematic-debugging',
|
|
14
|
+
'verification-before-completion',
|
|
15
|
+
'requesting-code-review',
|
|
16
|
+
'receiving-code-review',
|
|
17
|
+
'dispatching-parallel-agents',
|
|
18
|
+
'subagent-driven-development',
|
|
19
|
+
'using-git-worktrees',
|
|
20
|
+
'finishing-a-development-branch',
|
|
21
|
+
'hero-planning',
|
|
22
|
+
'hero-coding',
|
|
23
|
+
'hero-reviewing',
|
|
24
|
+
'hero-unit-test',
|
|
25
|
+
'hero-security',
|
|
26
|
+
'hero-strict',
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
function uniqueCoreSkills(names) {
|
|
30
|
+
const allowed = new Set(CORE_SKILL_ORDER);
|
|
31
|
+
const selected = new Set();
|
|
32
|
+
for (const name of names) {
|
|
33
|
+
if (!allowed.has(name)) throw new Error(`Unknown core skill: ${name}`);
|
|
34
|
+
selected.add(name);
|
|
35
|
+
}
|
|
36
|
+
return CORE_SKILL_ORDER.filter((name) => selected.has(name));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function selectProcessSkills() {
|
|
40
|
+
return CORE_SKILL_ORDER.slice();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Recursively copy a directory tree, returning the number of files written.
|
|
44
|
+
function copyTree(srcDir, dstDir) {
|
|
45
|
+
ensureDir(dstDir);
|
|
46
|
+
let files = 0;
|
|
47
|
+
for (const entry of fs.readdirSync(srcDir, { withFileTypes: true })) {
|
|
48
|
+
const s = path.join(srcDir, entry.name);
|
|
49
|
+
const d = path.join(dstDir, entry.name);
|
|
50
|
+
if (entry.isDirectory()) files += copyTree(s, d);
|
|
51
|
+
else { fs.copyFileSync(s, d); files++; }
|
|
52
|
+
}
|
|
53
|
+
return files;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function sourceEntries(src, selectedSkills) {
|
|
57
|
+
const selected = selectedSkills ? new Set(uniqueCoreSkills(selectedSkills)) : null;
|
|
58
|
+
return fs.readdirSync(src, { withFileTypes: true }).filter((entry) => {
|
|
59
|
+
return !entry.isDirectory() || !selected || selected.has(entry.name);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Install vendored core skills (templates/skills/<name>/) into the consumer's
|
|
64
|
+
// .claude/skills/ dir. Framework-managed:
|
|
65
|
+
// overwrites requested framework skill dirs and the NOTICE file, but never deletes
|
|
66
|
+
// user-added skill dirs outside the framework-managed process suite.
|
|
67
|
+
function installSkills(pkgRoot, target, opts) {
|
|
68
|
+
opts = opts || {};
|
|
69
|
+
const src = path.join(pkgRoot, 'templates', 'skills');
|
|
70
|
+
if (!exists(src)) return { skills: 0, files: 0, selectedSkills: [] };
|
|
71
|
+
const selectedSkills = opts.selectedSkills ? uniqueCoreSkills(opts.selectedSkills) : null;
|
|
72
|
+
const destinations = opts.destinations || ['.claude/skills'];
|
|
73
|
+
let skills = 0, files = 0;
|
|
74
|
+
const installed = [];
|
|
75
|
+
|
|
76
|
+
if (selectedSkills) {
|
|
77
|
+
for (const name of selectedSkills) {
|
|
78
|
+
const skillDir = path.join(src, name);
|
|
79
|
+
if (!exists(skillDir)) throw new Error(`Selected core skill is not vendored: ${name}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
for (const rel of destinations) {
|
|
84
|
+
const dstRoot = path.join(target, rel);
|
|
85
|
+
for (const entry of sourceEntries(src, selectedSkills)) {
|
|
86
|
+
if (entry.isDirectory()) {
|
|
87
|
+
const dstDir = path.join(dstRoot, entry.name);
|
|
88
|
+
if (selectedSkills && exists(dstDir)) fs.rmSync(dstDir, { recursive: true, force: true });
|
|
89
|
+
files += copyTree(path.join(src, entry.name), dstDir);
|
|
90
|
+
if (!installed.includes(entry.name)) installed.push(entry.name);
|
|
91
|
+
skills = Math.max(skills, installed.length);
|
|
92
|
+
} else {
|
|
93
|
+
ensureDir(dstRoot);
|
|
94
|
+
fs.copyFileSync(path.join(src, entry.name), path.join(dstRoot, entry.name));
|
|
95
|
+
files++;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return { skills, files, selectedSkills: selectedSkills || installed };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
module.exports = {
|
|
103
|
+
CORE_SKILL_ORDER,
|
|
104
|
+
installSkills,
|
|
105
|
+
copyTree,
|
|
106
|
+
selectProcessSkills,
|
|
107
|
+
};
|
package/src/update.cjs
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { log, exists, backup, readJSON, writeJSON, ensureDir } = require('./util.cjs');
|
|
5
|
+
const { renderTree, renderString } = require('./render.cjs');
|
|
6
|
+
const { mergeManagedBlock, mergeSettings } = require('./merge.cjs');
|
|
7
|
+
const { normalizeProfileConfig } = require('./profile-config.cjs');
|
|
8
|
+
const { defaultSession } = require('./workflow-state.cjs');
|
|
9
|
+
|
|
10
|
+
async function update(opts) {
|
|
11
|
+
const { pkgRoot, target, flags } = opts;
|
|
12
|
+
const templates = path.join(pkgRoot, 'templates');
|
|
13
|
+
log.title('hero-mmt-kit · update');
|
|
14
|
+
|
|
15
|
+
let cfg = readJSON(path.join(target, '.hero-mmt-kit', 'config.json'), null);
|
|
16
|
+
if (!cfg) { log.err('Not initialized (.hero-mmt-kit/config.json missing). Run `hero-mmt-kit init`.'); process.exit(1); }
|
|
17
|
+
try {
|
|
18
|
+
cfg = normalizeProfileConfig(cfg, flags || {});
|
|
19
|
+
} catch (e) {
|
|
20
|
+
log.err(e.message);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const vars = { DATE: new Date().toISOString().slice(0, 10) };
|
|
25
|
+
|
|
26
|
+
const skillDirs = ['.claude/skills'];
|
|
27
|
+
|
|
28
|
+
// Re-render managed docs; NEVER touch ACTIVE_STATE (working state).
|
|
29
|
+
const srcDocs = path.join(templates, 'docs');
|
|
30
|
+
let n = 0;
|
|
31
|
+
for (const f of renderTree(srcDocs, vars)) {
|
|
32
|
+
if (path.basename(f.rel) === 'ACTIVE_STATE.md') continue;
|
|
33
|
+
const dest = path.join(target, 'docs', f.rel);
|
|
34
|
+
if (path.basename(f.rel) === 'BROWNFIELD_DISCOVERY.md' && exists(dest)) continue;
|
|
35
|
+
ensureDir(path.dirname(dest));
|
|
36
|
+
if (exists(dest)) backup(dest);
|
|
37
|
+
fs.writeFileSync(dest, f.content);
|
|
38
|
+
n++;
|
|
39
|
+
}
|
|
40
|
+
log.ok(`Docs re-rendered: ${n} (ACTIVE_STATE.md preserved)`);
|
|
41
|
+
|
|
42
|
+
// Managed blocks (content outside markers preserved)
|
|
43
|
+
const claudeInner = renderString(fs.readFileSync(path.join(templates, 'CLAUDE.md.tmpl'), 'utf8'), vars);
|
|
44
|
+
const agentsInner = renderString(fs.readFileSync(path.join(templates, 'AGENTS.md.tmpl'), 'utf8'), vars);
|
|
45
|
+
log.ok(`CLAUDE.md: ${mergeManagedBlock(path.join(target, 'CLAUDE.md'), claudeInner, 'Project')}`);
|
|
46
|
+
log.ok(`AGENTS.md: ${mergeManagedBlock(path.join(target, 'AGENTS.md'), agentsInner, null)}`);
|
|
47
|
+
|
|
48
|
+
ensureDir(path.join(target, '.claude', 'hooks'));
|
|
49
|
+
for (const h of ['git-guard.cjs', 'stop-reminder.cjs', 'session-bridge.cjs']) {
|
|
50
|
+
fs.copyFileSync(path.join(templates, 'common', '.claude', 'hooks', h), path.join(target, '.claude', 'hooks', h));
|
|
51
|
+
}
|
|
52
|
+
mergeSettings(path.join(target, '.claude', 'settings.json'), path.join(templates, 'common', '.claude', 'settings.json'));
|
|
53
|
+
log.ok('Claude Code hooks + settings.json refreshed');
|
|
54
|
+
|
|
55
|
+
// Refresh bundled core skills (framework-managed; user-added skills untouched)
|
|
56
|
+
const skills = require('./skills.cjs');
|
|
57
|
+
const selectedSkills = skills.selectProcessSkills(cfg);
|
|
58
|
+
const sk = skills.installSkills(pkgRoot, target, { selectedSkills, destinations: skillDirs });
|
|
59
|
+
log.ok(`Skills refreshed: ${sk.skills} bundled core skill(s) → ${skillDirs.join(', ') || '(none)'}`);
|
|
60
|
+
|
|
61
|
+
const sessionPath = path.join(target, '.hero-mmt-kit', 'session.json');
|
|
62
|
+
if (!exists(sessionPath)) {
|
|
63
|
+
ensureDir(path.dirname(sessionPath));
|
|
64
|
+
writeJSON(sessionPath, defaultSession());
|
|
65
|
+
log.ok('Session : .hero-mmt-kit/session.json (seeded — was missing)');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const newVer = JSON.parse(fs.readFileSync(path.join(pkgRoot, 'package.json'), 'utf8')).version;
|
|
69
|
+
cfg.version = newVer;
|
|
70
|
+
delete cfg.lang;
|
|
71
|
+
writeJSON(path.join(target, '.hero-mmt-kit', 'config.json'), cfg);
|
|
72
|
+
log.ok(`Now at v${newVer}`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = { update };
|