hero-mmt-kit 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +143 -158
- package/bin/hero-mmt-kit.js +0 -1
- package/package.json +2 -3
- package/skills.manifest.json +72 -72
- package/src/doctor.cjs +22 -27
- package/src/init.cjs +3 -25
- package/src/integrations.cjs +1 -1
- package/src/skills.cjs +1 -1
- package/src/update.cjs +1 -9
- package/templates/common/.claude/hooks/active-state-bridge.cjs +58 -0
- package/templates/common/.claude/hooks/git-guard.cjs +60 -20
- package/templates/common/.claude/hooks/stop-reminder.cjs +3 -11
- package/templates/common/.claude/settings.json +2 -3
- package/templates/docs/ACTIVE_STATE.md +6 -8
- package/templates/docs/SECURITY_STANDARDS.md +1 -1
- package/templates/skills/NOTICE +6 -3
- package/templates/skills/executing-plans/SKILL.md +4 -5
- package/templates/skills/hero-coding/SKILL.md +7 -7
- package/templates/skills/hero-planning/SKILL.md +7 -12
- package/templates/skills/hero-report/SKILL.md +46 -0
- package/templates/skills/hero-reviewing/SKILL.md +9 -6
- package/templates/skills/hero-security/SKILL.md +427 -425
- package/templates/skills/hero-strict/SKILL.md +5 -5
- package/templates/skills/hero-unit-test/SKILL.md +9 -10
- package/templates/skills/requesting-code-review/SKILL.md +1 -1
- package/templates/skills/subagent-driven-development/SKILL.md +0 -1
- package/templates/skills/using-git-worktrees/SKILL.md +0 -2
- package/templates/skills/using-hero/SKILL.md +16 -10
- package/templates/skills/writing-plans/SKILL.md +2 -2
- package/presets/enterprise.json +0 -3
- package/presets/small-team.json +0 -3
- package/presets/solo.json +0 -3
- package/src/workflow-state.cjs +0 -65
- package/templates/.hero-mmt-kit/session.schema.json +0 -15
- package/templates/common/.claude/hooks/session-bridge.cjs +0 -43
- package/templates/skills/finishing-a-development-branch/SKILL.md +0 -253
package/src/init.cjs
CHANGED
|
@@ -6,7 +6,6 @@ const { detect } = require('./detect.cjs');
|
|
|
6
6
|
const { renderTree, renderString } = require('./render.cjs');
|
|
7
7
|
const { mergeManagedBlock, mergeSettings } = require('./merge.cjs');
|
|
8
8
|
const { collectProfileConfig } = require('./profile-config.cjs');
|
|
9
|
-
const { defaultSession } = require('./workflow-state.cjs');
|
|
10
9
|
|
|
11
10
|
async function init(opts) {
|
|
12
11
|
const { pkgRoot, target, flags } = opts;
|
|
@@ -21,12 +20,6 @@ async function init(opts) {
|
|
|
21
20
|
|
|
22
21
|
// ---- config ----
|
|
23
22
|
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
23
|
try {
|
|
31
24
|
cfg = await collectProfileConfig(cfg, flags, ask);
|
|
32
25
|
} catch (e) {
|
|
@@ -34,7 +27,6 @@ async function init(opts) {
|
|
|
34
27
|
ask.close();
|
|
35
28
|
process.exit(1);
|
|
36
29
|
}
|
|
37
|
-
if (!cfg.enforceLevel) cfg.enforceLevel = 'mixed';
|
|
38
30
|
delete cfg.lang;
|
|
39
31
|
cfg.version = JSON.parse(fs.readFileSync(path.join(pkgRoot, 'package.json'), 'utf8')).version;
|
|
40
32
|
cfg.brownfield = d.brownfield;
|
|
@@ -65,11 +57,11 @@ async function init(opts) {
|
|
|
65
57
|
|
|
66
58
|
// ---- 3. Claude Code hooks + settings ----
|
|
67
59
|
ensureDir(path.join(target, '.claude', 'hooks'));
|
|
68
|
-
for (const h of ['git-guard.cjs', 'stop-reminder.cjs', '
|
|
60
|
+
for (const h of ['git-guard.cjs', 'stop-reminder.cjs', 'active-state-bridge.cjs']) {
|
|
69
61
|
fs.copyFileSync(path.join(templates, 'common', '.claude', 'hooks', h), path.join(target, '.claude', 'hooks', h));
|
|
70
62
|
}
|
|
71
63
|
mergeSettings(path.join(target, '.claude', 'settings.json'), path.join(templates, 'common', '.claude', 'settings.json'));
|
|
72
|
-
log.ok('Claude : git-guard + stop-reminder +
|
|
64
|
+
log.ok('Claude : git-guard + stop-reminder + active-state-bridge → .claude/hooks; settings.json merged');
|
|
73
65
|
|
|
74
66
|
// ---- 3a. selected vendored core skills ----
|
|
75
67
|
const skills = require('./skills.cjs');
|
|
@@ -77,24 +69,10 @@ async function init(opts) {
|
|
|
77
69
|
const sk = skills.installSkills(pkgRoot, target, { selectedSkills, destinations: skillDirs });
|
|
78
70
|
log.ok(`Skills : ${sk.skills} bundled core skill(s) → ${skillDirs.join(', ') || '(none)'}`);
|
|
79
71
|
|
|
80
|
-
// ---- 4. config
|
|
72
|
+
// ---- 4. config ----
|
|
81
73
|
writeJSON(path.join(target, '.hero-mmt-kit', 'config.json'), cfg);
|
|
82
74
|
log.ok('Config : .hero-mmt-kit/config.json');
|
|
83
75
|
|
|
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
76
|
// ---- 5. optional integrations ----
|
|
99
77
|
if (!flags['skip-integrations']) {
|
|
100
78
|
await require('./integrations.cjs').run({ target, cfg, detect: d, pkgRoot });
|
package/src/integrations.cjs
CHANGED
|
@@ -29,7 +29,7 @@ const SERENA_MEMOS = {
|
|
|
29
29
|
'Core skills: hero-planning (plan before code), hero-coding (implement), hero-reviewing (fresh-eyes check), ' +
|
|
30
30
|
'hero-unit-test (TDD-first or post-implementation tests), hero-security (standalone security review), ' +
|
|
31
31
|
'hero-strict (opt-in full verification pass before a "done" claim).\n\n' +
|
|
32
|
-
'Session state:
|
|
32
|
+
'Session state: docs/ACTIVE_STATE.md\'s Active Features table (the single source of durable workflow state).\n\n' +
|
|
33
33
|
'Details (always read the source files, do not duplicate here): docs/ACTIVE_STATE.md, docs/SECURITY_STANDARDS.md, ' +
|
|
34
34
|
'docs/PERFORMANCE_STANDARDS.md.\n',
|
|
35
35
|
'delegation_rules.md':
|
package/src/skills.cjs
CHANGED
|
@@ -17,13 +17,13 @@ const CORE_SKILL_ORDER = [
|
|
|
17
17
|
'dispatching-parallel-agents',
|
|
18
18
|
'subagent-driven-development',
|
|
19
19
|
'using-git-worktrees',
|
|
20
|
-
'finishing-a-development-branch',
|
|
21
20
|
'hero-planning',
|
|
22
21
|
'hero-coding',
|
|
23
22
|
'hero-reviewing',
|
|
24
23
|
'hero-unit-test',
|
|
25
24
|
'hero-security',
|
|
26
25
|
'hero-strict',
|
|
26
|
+
'hero-report',
|
|
27
27
|
];
|
|
28
28
|
|
|
29
29
|
function uniqueCoreSkills(names) {
|
package/src/update.cjs
CHANGED
|
@@ -5,7 +5,6 @@ const { log, exists, backup, readJSON, writeJSON, ensureDir } = require('./util.
|
|
|
5
5
|
const { renderTree, renderString } = require('./render.cjs');
|
|
6
6
|
const { mergeManagedBlock, mergeSettings } = require('./merge.cjs');
|
|
7
7
|
const { normalizeProfileConfig } = require('./profile-config.cjs');
|
|
8
|
-
const { defaultSession } = require('./workflow-state.cjs');
|
|
9
8
|
|
|
10
9
|
async function update(opts) {
|
|
11
10
|
const { pkgRoot, target, flags } = opts;
|
|
@@ -46,7 +45,7 @@ async function update(opts) {
|
|
|
46
45
|
log.ok(`AGENTS.md: ${mergeManagedBlock(path.join(target, 'AGENTS.md'), agentsInner, null)}`);
|
|
47
46
|
|
|
48
47
|
ensureDir(path.join(target, '.claude', 'hooks'));
|
|
49
|
-
for (const h of ['git-guard.cjs', 'stop-reminder.cjs', '
|
|
48
|
+
for (const h of ['git-guard.cjs', 'stop-reminder.cjs', 'active-state-bridge.cjs']) {
|
|
50
49
|
fs.copyFileSync(path.join(templates, 'common', '.claude', 'hooks', h), path.join(target, '.claude', 'hooks', h));
|
|
51
50
|
}
|
|
52
51
|
mergeSettings(path.join(target, '.claude', 'settings.json'), path.join(templates, 'common', '.claude', 'settings.json'));
|
|
@@ -58,13 +57,6 @@ async function update(opts) {
|
|
|
58
57
|
const sk = skills.installSkills(pkgRoot, target, { selectedSkills, destinations: skillDirs });
|
|
59
58
|
log.ok(`Skills refreshed: ${sk.skills} bundled core skill(s) → ${skillDirs.join(', ') || '(none)'}`);
|
|
60
59
|
|
|
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
60
|
const newVer = JSON.parse(fs.readFileSync(path.join(pkgRoot, 'package.json'), 'utf8')).version;
|
|
69
61
|
cfg.version = newVer;
|
|
70
62
|
delete cfg.lang;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/*
|
|
4
|
+
* active-state-bridge.cjs — session-start context injector (v2.0.0)
|
|
5
|
+
* Claude Code: SessionStart
|
|
6
|
+
*
|
|
7
|
+
* Reads docs/ACTIVE_STATE.md (the durable, single source of workflow state —
|
|
8
|
+
* there is no separate session.json pointer) and injects the "Active
|
|
9
|
+
* Features" and "Blockers / Pending Actions" sections as additional context
|
|
10
|
+
* at the start of the session. SessionStart already fires once per session,
|
|
11
|
+
* so no flag-file dedup is needed.
|
|
12
|
+
*/
|
|
13
|
+
const fs = require('fs');
|
|
14
|
+
const path = require('path');
|
|
15
|
+
|
|
16
|
+
const MAX_CHARS = 4000;
|
|
17
|
+
|
|
18
|
+
function extractSection(md, heading) {
|
|
19
|
+
const lines = md.split('\n');
|
|
20
|
+
const startIdx = lines.findIndex((l) => l.trim() === heading);
|
|
21
|
+
if (startIdx === -1) return null;
|
|
22
|
+
const rest = lines.slice(startIdx + 1);
|
|
23
|
+
const endOffset = rest.findIndex((l) => /^##\s/.test(l));
|
|
24
|
+
const body = (endOffset === -1 ? rest : rest.slice(0, endOffset)).join('\n').trim();
|
|
25
|
+
return body || null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let raw = '';
|
|
29
|
+
process.stdin.on('data', (d) => { raw += d; });
|
|
30
|
+
process.stdin.on('end', () => {
|
|
31
|
+
let payload = {};
|
|
32
|
+
try { payload = JSON.parse(raw || '{}'); } catch (_) { process.exit(0); }
|
|
33
|
+
|
|
34
|
+
const cwd = (payload && payload.cwd) || process.cwd();
|
|
35
|
+
const activeStatePath = path.join(cwd, 'docs', 'ACTIVE_STATE.md');
|
|
36
|
+
|
|
37
|
+
let md;
|
|
38
|
+
try { md = fs.readFileSync(activeStatePath, 'utf8'); } catch (_) { process.exit(0); }
|
|
39
|
+
|
|
40
|
+
const features = extractSection(md, '## Active Features in Pipeline');
|
|
41
|
+
const blockers = extractSection(md, '## Blockers / Pending Actions');
|
|
42
|
+
if (!features && !blockers) process.exit(0);
|
|
43
|
+
|
|
44
|
+
let context = '[hero-mmt-kit] docs/ACTIVE_STATE.md (auto-injected)\n';
|
|
45
|
+
if (features) context += '\n## Active Features in Pipeline\n' + features + '\n';
|
|
46
|
+
if (blockers) context += '\n## Blockers / Pending Actions\n' + blockers + '\n';
|
|
47
|
+
if (context.length > MAX_CHARS) {
|
|
48
|
+
context = context.slice(0, MAX_CHARS) + '\n...(truncated — read docs/ACTIVE_STATE.md directly for the rest)';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
process.stdout.write(JSON.stringify({
|
|
52
|
+
hookSpecificOutput: {
|
|
53
|
+
hookEventName: 'SessionStart',
|
|
54
|
+
additionalContext: context,
|
|
55
|
+
},
|
|
56
|
+
}));
|
|
57
|
+
process.exit(0);
|
|
58
|
+
});
|
|
@@ -1,56 +1,96 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
/*
|
|
4
|
-
* Shell git guard — Claude Code PreToolUse (matcher: Bash) — { tool_name, tool_input:{command} }
|
|
5
|
-
* BLOCKS dangerous git commands (exit 2).
|
|
4
|
+
* Shell git guard — Claude Code PreToolUse (matcher: Bash) — { tool_name, tool_input:{command}, cwd }
|
|
5
|
+
* BLOCKS a small set of genuinely dangerous git commands (exit 2).
|
|
6
6
|
* REMINDS on commits without blocking (exit 0, stderr -> user).
|
|
7
|
+
*
|
|
8
|
+
* Design notes:
|
|
9
|
+
* - Flag/keyword checks run on a quote- and heredoc-stripped copy of the
|
|
10
|
+
* command so that text inside a commit message — whether `-m "..."` or a
|
|
11
|
+
* `git commit -m "$(cat <<'EOF' ... EOF)"` heredoc body — can never be
|
|
12
|
+
* mistaken for a real flag. Branch/refspec checks use the same stripped copy.
|
|
13
|
+
* - Protected-branch detection resolves the repo's default branch dynamically
|
|
14
|
+
* (origin/HEAD → init.defaultBranch → "main"); nothing is hardcoded and no
|
|
15
|
+
* GitHub/GitLab-specific workflow term is assumed.
|
|
7
16
|
*/
|
|
17
|
+
const { execSync } = require('child_process');
|
|
18
|
+
|
|
19
|
+
// Remove the contents of single/double-quoted spans and heredoc bodies so
|
|
20
|
+
// message text can't look like a flag. Leaves the surrounding tokens intact.
|
|
21
|
+
function stripQuoted(s) {
|
|
22
|
+
return s
|
|
23
|
+
.replace(/<<[-~]?\s*(['"]?)(\w+)\1[\s\S]*?\n\s*\2\b/g, '<<$2\n$2')
|
|
24
|
+
.replace(/"(?:[^"\\]|\\.)*"/g, '""')
|
|
25
|
+
.replace(/'(?:[^'\\]|\\.)*'/g, "''");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function defaultBranch(cwd) {
|
|
29
|
+
const run = (c) => execSync(c, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
30
|
+
try {
|
|
31
|
+
const head = run('git symbolic-ref --short refs/remotes/origin/HEAD'); // e.g. "origin/main"
|
|
32
|
+
if (head) return head.replace(/^origin\//, '');
|
|
33
|
+
} catch (_) { /* no origin/HEAD */ }
|
|
34
|
+
try {
|
|
35
|
+
const cfg = run('git config --get init.defaultBranch');
|
|
36
|
+
if (cfg) return cfg;
|
|
37
|
+
} catch (_) { /* unset */ }
|
|
38
|
+
return 'main';
|
|
39
|
+
}
|
|
40
|
+
|
|
8
41
|
let raw = '';
|
|
9
42
|
process.stdin.on('data', (d) => { raw += d; });
|
|
10
43
|
process.stdin.on('end', () => {
|
|
11
44
|
let payload = {};
|
|
12
45
|
try { payload = JSON.parse(raw || '{}'); } catch (_) { process.exit(0); }
|
|
13
46
|
|
|
14
|
-
const cmd = (payload.tool_input && payload.tool_input.command) || '';
|
|
15
|
-
if (!cmd) process.exit(0);
|
|
16
47
|
if (payload.tool_name && payload.tool_name !== 'Bash') process.exit(0);
|
|
17
|
-
|
|
48
|
+
const cmd = (payload.tool_input && payload.tool_input.command) || '';
|
|
49
|
+
if (!cmd || !/\bgit\b/.test(cmd)) process.exit(0);
|
|
50
|
+
|
|
51
|
+
const cwd = payload.cwd || process.cwd();
|
|
52
|
+
const safe = stripQuoted(cmd); // flag/keyword checks run against this
|
|
18
53
|
|
|
19
54
|
const block = (msg) => {
|
|
20
55
|
console.error('⛔ [git-guard] ' + msg);
|
|
21
56
|
process.exit(2);
|
|
22
57
|
};
|
|
23
58
|
|
|
24
|
-
const isPush = /\bpush\b/.test(
|
|
25
|
-
const isCommit = /\bcommit\b/.test(
|
|
59
|
+
const isPush = /\bpush\b/.test(safe);
|
|
60
|
+
const isCommit = /\bcommit\b/.test(safe);
|
|
26
61
|
|
|
27
62
|
// 1) Force push (allow --force-with-lease)
|
|
28
|
-
if (isPush &&
|
|
29
|
-
block('Blocked force-push
|
|
30
|
-
'
|
|
63
|
+
if (isPush && (/--force(?!-with-lease)/.test(safe) || /(^|\s)-[a-z]*f[a-z]*(\s|$)/.test(safe))) {
|
|
64
|
+
block('Blocked force-push. If truly needed, prefer --force-with-lease and run it manually. ' +
|
|
65
|
+
'Protected branches should receive changes through a reviewed branch, not a force-push.');
|
|
31
66
|
}
|
|
32
67
|
|
|
33
|
-
// 2) commit --no-verify / -n (bypasses hooks/
|
|
34
|
-
if (isCommit && /(--no-verify|(^|\s)-n(\s|$))/.test(
|
|
35
|
-
block('Blocked `git commit --no-verify`: do not bypass hooks/checks unless the
|
|
68
|
+
// 2) commit --no-verify / -n (bypasses hooks/checks)
|
|
69
|
+
if (isCommit && /(--no-verify|(^|\s)-n(\s|$))/.test(safe)) {
|
|
70
|
+
block('Blocked `git commit --no-verify`: do not bypass hooks/checks unless the user explicitly requests it.');
|
|
36
71
|
}
|
|
37
72
|
|
|
38
73
|
// 3) reset --hard (can discard changes)
|
|
39
|
-
if (/\breset\b[\s\S]*--hard/.test(
|
|
74
|
+
if (/\breset\b[\s\S]*--hard/.test(safe)) {
|
|
40
75
|
block('Blocked `git reset --hard` (it can discard changes). Consider `git stash`, or run it manually if you truly intend it.');
|
|
41
76
|
}
|
|
42
77
|
|
|
43
|
-
// 4) direct push to
|
|
44
|
-
if (isPush &&
|
|
45
|
-
|
|
78
|
+
// 4) direct push to the repo's protected/default branch
|
|
79
|
+
if (isPush && !/--dry-run/.test(safe)) {
|
|
80
|
+
const def = defaultBranch(cwd);
|
|
81
|
+
const re = new RegExp('(^|\\s|:)' + def.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '(\\s|$)');
|
|
82
|
+
if (re.test(safe)) {
|
|
83
|
+
block(`Blocked direct push to the protected branch \`${def}\`. ` +
|
|
84
|
+
'Push a feature branch instead and merge it through your project\'s review process.');
|
|
85
|
+
}
|
|
46
86
|
}
|
|
47
87
|
|
|
48
88
|
// REMIND (non-blocking) on commit
|
|
49
89
|
if (isCommit) {
|
|
50
90
|
console.error('🔔 [git-guard] Before committing, check: ' +
|
|
51
|
-
'(1) docs/ACTIVE_STATE.md updated? ' +
|
|
52
|
-
'(2)
|
|
53
|
-
'(3)
|
|
91
|
+
'(1) docs/ACTIVE_STATE.md updated if work state changed? ' +
|
|
92
|
+
'(2) impact/change analysis run when code changed (if a code-intelligence tool is set up)? ' +
|
|
93
|
+
'(3) a clear, conventional commit message?');
|
|
54
94
|
}
|
|
55
95
|
|
|
56
96
|
process.exit(0);
|
|
@@ -6,15 +6,8 @@
|
|
|
6
6
|
* If there are uncommitted changes and docs/ACTIVE_STATE.md was not touched,
|
|
7
7
|
* print a reminder for the user. Do NOT block stopping (no exit 2 -> avoid loops).
|
|
8
8
|
*/
|
|
9
|
-
const fs = require('fs');
|
|
10
|
-
const path = require('path');
|
|
11
9
|
const { execSync } = require('child_process');
|
|
12
10
|
|
|
13
|
-
function cleanupSessionFlag(cwd) {
|
|
14
|
-
const flagPath = path.join(cwd, '.hero-mmt-kit', 'session-injected.flag');
|
|
15
|
-
try { fs.rmSync(flagPath, { force: true }); } catch (_) {}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
11
|
let raw = '';
|
|
19
12
|
process.stdin.on('data', (d) => { raw += d; });
|
|
20
13
|
process.stdin.on('end', () => {
|
|
@@ -26,18 +19,17 @@ process.stdin.on('end', () => {
|
|
|
26
19
|
let status = '';
|
|
27
20
|
try {
|
|
28
21
|
status = execSync('git status --porcelain', { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
|
|
29
|
-
} catch (_) {
|
|
22
|
+
} catch (_) { process.exit(0); }
|
|
30
23
|
|
|
31
24
|
const lines = status.split('\n').map((l) => l.trim()).filter(Boolean);
|
|
32
|
-
if (lines.length === 0)
|
|
25
|
+
if (lines.length === 0) process.exit(0); // no changes
|
|
33
26
|
|
|
34
27
|
const stateTouched = lines.some((l) => /ACTIVE_STATE\.md$/.test(l));
|
|
35
28
|
const otherChanged = lines.some((l) => !/ACTIVE_STATE\.md$/.test(l));
|
|
36
29
|
|
|
37
30
|
if (otherChanged && !stateTouched) {
|
|
38
31
|
console.error('🔔 [stop-reminder] There are uncommitted changes, but docs/ACTIVE_STATE.md was not updated. ' +
|
|
39
|
-
'If work state changed, update the Active Features table
|
|
32
|
+
'If work state changed, update the Active Features table.');
|
|
40
33
|
}
|
|
41
|
-
cleanupSessionFlag(cwd);
|
|
42
34
|
process.exit(0);
|
|
43
35
|
});
|
|
@@ -8,11 +8,10 @@
|
|
|
8
8
|
]
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
|
-
"
|
|
11
|
+
"SessionStart": [
|
|
12
12
|
{
|
|
13
|
-
"matcher": ".*",
|
|
14
13
|
"hooks": [
|
|
15
|
-
{ "type": "command", "command": "node .claude/hooks/
|
|
14
|
+
{ "type": "command", "command": "node .claude/hooks/active-state-bridge.cjs" }
|
|
16
15
|
]
|
|
17
16
|
}
|
|
18
17
|
],
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
## Active Features in Pipeline
|
|
10
10
|
|
|
11
|
-
| Feature / Epic | Path | Current phase | Branch
|
|
11
|
+
| Feature / Epic | Path | Current phase | Branch | Status | PRD | TDD |
|
|
12
12
|
| :--- | :--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
13
|
| N/A | N/A | N/A | - | Idle | - | - |
|
|
14
14
|
|
|
@@ -30,12 +30,10 @@ Do not paste long investigation notes, transcripts, screenshots, logs, PRDs, or
|
|
|
30
30
|
|
|
31
31
|
## Session Resume Protocol
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
- `.hero-mmt-kit/session.json` — a small derived pointer (`currentSkill`, `lastCheckpoint`, `resumePath`, `nextAction`). Read it first on resume; it is the fast path.
|
|
35
|
-
- `ACTIVE_STATE.md` — the durable backlog index. Read it when switching work items or when session.json is absent/stale.
|
|
33
|
+
This file is the single source of durable workflow state — there is no separate session pointer file. Its "Active Features" table above is injected into context automatically at the start of a session (via the `active-state-bridge` hook), so resuming usually needs no extra reading.
|
|
36
34
|
|
|
37
|
-
*An AI starting or resuming tracked work
|
|
38
|
-
1.
|
|
39
|
-
2.
|
|
40
|
-
3.
|
|
35
|
+
*An AI starting or resuming tracked work:*
|
|
36
|
+
1. Check the injected "Active Features" context (or read this table directly if it wasn't injected).
|
|
37
|
+
2. If a row names an artifact (plan/report), open it for concrete next steps.
|
|
38
|
+
3. If you need to switch work items, re-read this table plus `git branch` for local work in progress.
|
|
41
39
|
4. Update this table when durable work state changes. When a work item completes, replace the row with a one-line link to the artifact.
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
- Don't bypass hooks/CI "to go faster".
|
|
28
28
|
|
|
29
29
|
## 4. Automated tools (optional — degrade if absent)
|
|
30
|
-
> None of the hooks bundled by hero-mmt-kit (§3: `git-guard`, `
|
|
30
|
+
> None of the hooks bundled by hero-mmt-kit (§3: `git-guard`, `active-state-bridge`, `stop-reminder`) run secret scanning, dependency audit, or SAST. These are placeholders for the consuming project to wire up (e.g. a `gitleaks` pre-commit hook, an `<AUDIT_CMD>` step in CI). Do not assume any of §4 is enforced until the project has actually wired it — check for the tool/hook before claiming this baseline is met.
|
|
31
31
|
- **Secret scanning**: e.g. `gitleaks` (can run as a pre-commit hook to **block**). `<TBD: on/off>`
|
|
32
32
|
- **`<AUDIT_CMD>`** in CI / the `doctor` command.
|
|
33
33
|
- **SAST** (stack-dependent): `<TBD>`.
|
package/templates/skills/NOTICE
CHANGED
|
@@ -17,8 +17,11 @@ Vendored skills from obra/superpowers:
|
|
|
17
17
|
brainstorming, writing-plans, executing-plans, test-driven-development,
|
|
18
18
|
systematic-debugging, verification-before-completion, requesting-code-review,
|
|
19
19
|
receiving-code-review, dispatching-parallel-agents,
|
|
20
|
-
subagent-driven-development, using-git-worktrees,
|
|
21
|
-
|
|
20
|
+
subagent-driven-development, using-git-worktrees, using-superpowers
|
|
21
|
+
|
|
22
|
+
Note: finishing-a-development-branch was vendored previously but has been
|
|
23
|
+
dropped — hero-mmt-kit intentionally does not automate merge/PR/branch-cleanup
|
|
24
|
+
decisions; those stay with the human.
|
|
22
25
|
|
|
23
26
|
Note on subagent-driven-development: this skill received a selective backport of
|
|
24
27
|
newer upstream additions (durable progress ledger, task-brief/review-package
|
|
@@ -29,7 +32,7 @@ Review Budget tiering is a hero-mmt-kit original design choice.
|
|
|
29
32
|
|
|
30
33
|
Framework-authored skills shipped by hero-mmt-kit:
|
|
31
34
|
using-hero, hero-planning, hero-coding, hero-reviewing,
|
|
32
|
-
hero-unit-test, hero-security, hero-strict
|
|
35
|
+
hero-unit-test, hero-security, hero-strict, hero-report
|
|
33
36
|
|
|
34
37
|
Design / visual-direction skills are NOT vendored — they are referenced in
|
|
35
38
|
skills.manifest.json and installed from their original sources on demand.
|
|
@@ -29,14 +29,14 @@ For each task:
|
|
|
29
29
|
3. Run verifications as specified
|
|
30
30
|
4. Mark as completed
|
|
31
31
|
|
|
32
|
-
After completing a task group (a set of related tasks that form a logical unit), checkpoint durable state: update `ACTIVE_STATE.md
|
|
32
|
+
After completing a task group (a set of related tasks that form a logical unit), checkpoint durable state: update `ACTIVE_STATE.md`.
|
|
33
33
|
|
|
34
34
|
### Step 3: Complete Development
|
|
35
35
|
|
|
36
36
|
After all tasks complete and verified:
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
37
|
+
- Re-run the full verification the plan specifies (tests, build, lint) and confirm it passes.
|
|
38
|
+
- Report completion to your human partner with a concise summary of what changed and the evidence collected.
|
|
39
|
+
- Leave branch, merge, and PR decisions to the human — don't take git actions beyond what the plan or the human explicitly asked for.
|
|
40
40
|
|
|
41
41
|
## When to Stop and Ask for Help
|
|
42
42
|
|
|
@@ -69,4 +69,3 @@ After all tasks complete and verified:
|
|
|
69
69
|
**Required workflow skills:**
|
|
70
70
|
- **superpowers:using-git-worktrees** - Ensures isolated workspace (creates one or verifies existing)
|
|
71
71
|
- **superpowers:writing-plans** - Creates the plan this skill executes
|
|
72
|
-
- **superpowers:finishing-a-development-branch** - Complete development after all tasks
|
|
@@ -31,11 +31,11 @@ If there's no plan artifact, proceed on the strength of the request itself and n
|
|
|
31
31
|
3. For independent or parallel work streams, use the vendored `subagent-driven-development` and `dispatching-parallel-agents` skills to delegate. Keep dependent work sequential; only fan out work that has no shared state or ordering constraint.
|
|
32
32
|
4. If unexpected bugs surface mid-implementation, switch to the vendored `systematic-debugging` skill instead of guessing at fixes.
|
|
33
33
|
5. Run relevant verification — build, lint, targeted tests — as you go, not only at the end. Catching a break right after the edit that caused it is cheaper than catching it after ten more edits.
|
|
34
|
-
6.
|
|
34
|
+
6. Give a concise chat summary: what changed, the evidence collected, and any remaining risks or deviations from the plan. Don't write a report file by default — see Report Convention below.
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## Report Convention (on request)
|
|
37
37
|
|
|
38
|
-
`docs/coding-reports/YYYY-MM-DD-<slug>.md`
|
|
38
|
+
hero-coding does not write a report file automatically. If the user asks for a written report, invoke the `hero-report` skill — it writes to `docs/coding-reports/YYYY-MM-DD-<slug>.md` (same slug as the originating plan when one exists) using the contract below. This is the one place that contract is defined; `hero-report` reads it from here rather than duplicating it.
|
|
39
39
|
|
|
40
40
|
Report should cover:
|
|
41
41
|
- What changed (files, symbols, behavior) and why.
|
|
@@ -52,13 +52,12 @@ Report style:
|
|
|
52
52
|
## Definition of Done
|
|
53
53
|
|
|
54
54
|
- Implementation matches the plan, or deviations are documented and explained.
|
|
55
|
-
- Evidence of correctness is recorded — not just "tests pass" but which commands were run and what they showed.
|
|
56
|
-
-
|
|
55
|
+
- Evidence of correctness is recorded — not just "tests pass" but which commands were run and what they showed, at minimum in the chat summary.
|
|
56
|
+
- If a report was requested, it was written via `hero-report` at the path above.
|
|
57
57
|
|
|
58
58
|
## ACTIVE_STATE.md Update
|
|
59
59
|
|
|
60
|
-
- Update the Active Features row's status/phase in `docs/ACTIVE_STATE.md` to reflect coding is complete.
|
|
61
|
-
- Write `.hero-mmt-kit/session.json` with `currentSkill: "hero-coding"`, `resumePath` pointing at the coding report, `nextAction` (typically `"review"` or `"test"`), and `lastCheckpoint`/`updatedAt` set to the current ISO timestamp.
|
|
60
|
+
- Update the Active Features row's status/phase in `docs/ACTIVE_STATE.md` to reflect coding is complete. Link the coding report only if `hero-report` wrote one.
|
|
62
61
|
|
|
63
62
|
## Related Skills
|
|
64
63
|
|
|
@@ -67,3 +66,4 @@ This skill wraps the vendored `executing-plans`, `subagent-driven-development`,
|
|
|
67
66
|
- Reads its input from `hero-planning`.
|
|
68
67
|
- Hands off to `hero-reviewing` and/or `hero-unit-test` next.
|
|
69
68
|
- Recommend a separate `hero-security` pass if the change touched a sensitive surface (auth, data, secrets, external input, AI/LLM behavior); do not embed the security review in this coding stage.
|
|
69
|
+
- Use `hero-report` on request to write the coding report.
|
|
@@ -23,14 +23,14 @@ Skip it for typo fixes, trivial config edits, or an obvious one-file change —
|
|
|
23
23
|
|
|
24
24
|
- The user's request or brief.
|
|
25
25
|
- Existing codebase context — use GitNexus (`gitnexus_query`, `gitnexus_context`, `gitnexus_impact`) or Serena when available to understand what's already there; don't block on them if they aren't.
|
|
26
|
-
- Any existing state to resume from: `docs/ACTIVE_STATE.md`'s Active Features table
|
|
26
|
+
- Any existing state to resume from: `docs/ACTIVE_STATE.md`'s Active Features table.
|
|
27
27
|
|
|
28
28
|
## Process
|
|
29
29
|
|
|
30
30
|
1. **Brainstorm with the human first.** Invoke the vendored `brainstorming` skill to clarify goals, requirements, constraints, edge cases, and open questions before writing anything down. Don't skip this by guessing at intent — surface ambiguity and resolve it in conversation.
|
|
31
31
|
2. **Assess blast radius for existing-behavior changes.** For refactors or changes to existing behavior, run `gitnexus_impact` (upstream) if GitNexus is available, and report the blast radius — direct callers, affected processes, risk level — before proceeding.
|
|
32
|
-
3. **Write the plan.** Use the vendored `writing-plans` skill's structure to produce: scope, approach, files/areas touched, risks, and a step-by-step breakdown.
|
|
33
|
-
4. **
|
|
32
|
+
3. **Write the plan.** Use the vendored `writing-plans` skill's structure to produce: scope, approach, files/areas touched, risks, and a step-by-step breakdown. Save it to the artifact path below (this matches `writing-plans`' own default save path). Skip its "Execution Handoff" step-choice prompt entirely — that prompt does not apply inside hero-planning.
|
|
33
|
+
4. **Exit plan mode and stop — do not ask to implement.** Once the plan file is written and self-reviewed, exit plan mode (e.g. via `ExitPlanMode`) purely so the human can read the saved file in a normal turn. Report the saved path and stop. Do not ask "should I proceed to implement?", do not treat exiting plan mode as approval to start coding, and do not invoke `hero-coding` automatically. The human reviews the file on their own and comes back with edits, or their own explicit go-ahead, when ready.
|
|
34
34
|
|
|
35
35
|
## Output Artifact
|
|
36
36
|
|
|
@@ -45,20 +45,15 @@ Plan writing style:
|
|
|
45
45
|
## Definition of Done
|
|
46
46
|
|
|
47
47
|
- The plan covers scope, approach, touched files, risks, and a step-by-step breakdown.
|
|
48
|
-
- The
|
|
49
|
-
-
|
|
48
|
+
- The plan is saved at the artifact path above (not `writing-plans`' default location).
|
|
49
|
+
- Plan mode has been exited without asking the human to approve implementation — the plan is left for the human to review and request changes to on their own terms.
|
|
50
50
|
|
|
51
51
|
## ACTIVE_STATE.md Update
|
|
52
52
|
|
|
53
|
-
- Add or update this work item's row in the Active Features table in `docs/ACTIVE_STATE.md
|
|
54
|
-
- Write `.hero-mmt-kit/session.json` with:
|
|
55
|
-
- `currentSkill: "hero-planning"`
|
|
56
|
-
- `resumePath` pointing at the plan file
|
|
57
|
-
- `nextAction` describing the first concrete implementation step
|
|
58
|
-
- `updatedAt` (ISO timestamp)
|
|
53
|
+
- Add or update this work item's row in the Active Features table in `docs/ACTIVE_STATE.md`: path, current phase, status, and a link to the plan file.
|
|
59
54
|
|
|
60
55
|
## Related Skills
|
|
61
56
|
|
|
62
57
|
- Wraps the vendored `brainstorming` skill (requirements/edge-case discovery with the human) and `writing-plans` skill (plan structure).
|
|
63
|
-
- Hands off to `hero-coding`
|
|
58
|
+
- Hands off to `hero-coding` only when the human explicitly asks to implement — never automatically right after the plan is saved.
|
|
64
59
|
- For refactors, lean on `gitnexus_impact` and `gitnexus_rename` during planning and later execution.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hero-report
|
|
3
|
+
description: Use after hero-coding, hero-reviewing, or hero-unit-test finish work when the user asks for a written report — writes the artifact at the source skill's conventional path, on request only
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Hero Report
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
hero-report is the on-demand report writer for the hero-* workflow. `hero-coding`, `hero-reviewing`, and `hero-unit-test` do the actual work and end with a concise chat summary — they do not write a report file by default. Invoke `hero-report` only when a written record is actually wanted. It writes using the path convention and content contract documented in the source skill's own "Report Convention" section, so that convention has one home instead of being duplicated across skills.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- The user explicitly asks for a report, or for the work to be written down.
|
|
15
|
+
- The change is Standard-or-larger and a durable artifact would matter for handoff, audit, or review — flag this to the user and let them decide rather than writing unasked.
|
|
16
|
+
- `hero-strict` needs to append a verification section to a report that doesn't exist yet.
|
|
17
|
+
- A completed `hero-security` report needs a link from another report for traceability.
|
|
18
|
+
|
|
19
|
+
Skip it for Tiny/Fast work where a chat summary is enough and nobody asked for a file.
|
|
20
|
+
|
|
21
|
+
## Inputs
|
|
22
|
+
|
|
23
|
+
- Which stage just completed: `hero-coding`, `hero-reviewing`, or `hero-unit-test` (default to the most recently completed one unless the user names another).
|
|
24
|
+
- That stage's own "Report Convention" section in its SKILL.md — path pattern, required content, and style rules. This skill does not redefine them; it reads them from the source skill.
|
|
25
|
+
- What actually happened in this session: the real evidence (commands run, output, diffs, findings, decisions) — not a reconstruction or a guess.
|
|
26
|
+
|
|
27
|
+
## Process
|
|
28
|
+
|
|
29
|
+
1. Identify the stage (or stages) to report on.
|
|
30
|
+
2. Read that stage's SKILL.md "Report Convention" section for the path pattern, required content, and style.
|
|
31
|
+
3. Compose the report strictly from what happened in this session. Don't re-run work just to fill a template field, and don't fabricate evidence that wasn't actually collected.
|
|
32
|
+
4. Write the file at the conventional path (create parent directories as needed).
|
|
33
|
+
5. If `docs/ACTIVE_STATE.md` has a row for this work item, add a one-line link to the new report.
|
|
34
|
+
6. If asked to report on multiple stages, write one file per stage — never merge coding/review/test reports into a single file.
|
|
35
|
+
7. If invoked after `hero-security`, do not recreate or replace the security report; link to the standalone `docs/security-reports/...` artifact from the relevant coding/review/test report when traceability is needed.
|
|
36
|
+
|
|
37
|
+
## Definition of Done
|
|
38
|
+
|
|
39
|
+
- The report is saved at the path convention defined by the source stage's SKILL.md.
|
|
40
|
+
- Content matches that stage's required fields — nothing invented, nothing dropped.
|
|
41
|
+
- `docs/ACTIVE_STATE.md` links to the new report if a row exists for this item.
|
|
42
|
+
|
|
43
|
+
## Related Skills
|
|
44
|
+
|
|
45
|
+
- Reads the artifact convention from `hero-coding`, `hero-reviewing`, or `hero-unit-test` — does not duplicate it.
|
|
46
|
+
- May link to `hero-security`'s standalone `docs/security-reports/...` artifact from another report when traceability is useful.
|
|
@@ -36,11 +36,13 @@ If the plan artifact doesn't exist (small change that skipped planning), review
|
|
|
36
36
|
3. Check whether the implementation actually matches the plan: every planned step done, no silent scope cuts, no undocumented deviations. Flag anything the plan promised that the code doesn't deliver, and anything the code does that the plan didn't mention.
|
|
37
37
|
4. If delegating the review to a sub-agent, use the vendored `requesting-code-review` skill's prompt structure so the sub-agent has the right context and scope. If you are the one receiving findings back, follow `receiving-code-review` discipline: fix Critical/Important findings before proceeding, re-review only the fix or the disputed finding (don't re-review the whole diff) unless scope expanded, and push back on findings you believe are incorrect with evidence rather than accepting them by default.
|
|
38
38
|
5. Do not write or run unit tests in this phase — that's `hero-unit-test`'s job, not this skill's.
|
|
39
|
-
6.
|
|
39
|
+
6. State findings and a clear verdict in chat: pass, pass with follow-ups, or blocked. Don't write a report file by default — see Report Convention below.
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## Report Convention (on request)
|
|
42
42
|
|
|
43
|
-
`docs/reviews/YYYY-MM-DD-<slug>.md`
|
|
43
|
+
hero-reviewing does not write a report file automatically. If the user asks for a written report, invoke the `hero-report` skill — it writes to `docs/reviews/YYYY-MM-DD-<slug>.md` using the contract below.
|
|
44
|
+
|
|
45
|
+
Report should cover: findings plus a verdict.
|
|
44
46
|
|
|
45
47
|
Review style:
|
|
46
48
|
- Keep it concise: what was reviewed, what was found, what remains open.
|
|
@@ -50,13 +52,13 @@ Review style:
|
|
|
50
52
|
|
|
51
53
|
## Definition of Done
|
|
52
54
|
|
|
53
|
-
- Findings are
|
|
55
|
+
- Findings are stated with a clear verdict (pass / pass with follow-ups / blocked), at minimum in chat.
|
|
54
56
|
- Blocking issues are either resolved, or explicitly deferred with an owner and a stated reason — never silently dropped.
|
|
57
|
+
- If a report was requested, it was written via `hero-report` at the path above.
|
|
55
58
|
|
|
56
59
|
## ACTIVE_STATE.md Update
|
|
57
60
|
|
|
58
|
-
- Update the Active Features row's status in `docs/ACTIVE_STATE.md` to reflect the review verdict.
|
|
59
|
-
- Write `.hero-mmt-kit/session.json` with `currentSkill: "hero-reviewing"`, `resumePath` pointing at the review report, `nextAction` set to `"fix findings"` or `"proceed to delivery"`, and `updatedAt` as an ISO timestamp.
|
|
61
|
+
- Update the Active Features row's status in `docs/ACTIVE_STATE.md` to reflect the review verdict. Link the review report only if `hero-report` wrote one.
|
|
60
62
|
|
|
61
63
|
## Related Skills
|
|
62
64
|
|
|
@@ -64,3 +66,4 @@ Review style:
|
|
|
64
66
|
- Reads output from `hero-planning` (the plan) and `hero-coding` (the report and diff).
|
|
65
67
|
- May recommend a separate `hero-security` pass if the review surfaces a sensitive-surface concern (auth, data, secrets, external input, AI/LLM behavior).
|
|
66
68
|
- Complements `hero-unit-test`: the two are a parallel, independent stage — neither is a prerequisite for the other.
|
|
69
|
+
- Use `hero-report` on request to write the review report.
|