@bluenyang/reins 0.1.2 → 0.1.3-rc.2
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 +11 -9
- package/cli/dist/commands/check.js +32 -1
- package/cli/dist/commands/gate.js +83 -1
- package/cli/dist/commands/install.js +1 -0
- package/cli/dist/commands/knowledge.js +111 -0
- package/cli/dist/commands/migrate.js +1 -0
- package/cli/dist/commands/new.js +193 -0
- package/cli/dist/commands/retro.js +7 -0
- package/cli/dist/commands/stages.js +31 -0
- package/cli/dist/commands/status.js +9 -0
- package/cli/dist/lib/git.js +10 -0
- package/cli/dist/lib/retro.js +179 -0
- package/cli/dist/lib/upstream.js +14 -1
- package/cli/dist/reins.js +92 -3
- package/cli/dist/scripts/sync-version.js +23 -7
- package/docs/README.ko.md +11 -9
- package/harness/CHANGELOG.md +4 -0
- package/harness/VERSION +1 -1
- package/harness/roles/advisor.md +2 -0
- package/harness/roles/code-review.md +2 -0
- package/harness/roles/deploy.md +22 -1
- package/harness/roles/docs.md +2 -0
- package/harness/roles/implementer.md +2 -0
- package/harness/roles/lookup.md +2 -0
- package/harness/roles/pl.md +2 -0
- package/harness/roles/planner.md +2 -0
- package/harness/roles/pm.md +3 -1
- package/harness/roles/qa-design.md +2 -0
- package/harness/roles/qa-run.md +2 -0
- package/harness/roles/verify-tool.md +4 -3
- package/harness/schemas/intent.schema.json +1 -1
- package/package.json +1 -1
- package/skills/reins-implement/SKILL.md +20 -0
- package/skills/reins-intent/SKILL.md +8 -17
- package/skills/reins-loop/SKILL.md +10 -38
- package/skills/reins-loop/references/vendor-cli.md +2 -2
- package/skills/reins-release/SKILL.md +17 -0
- package/skills/reins-retro/SKILL.md +20 -0
- package/skills/reins-review/SKILL.md +23 -0
- package/skills/reins-roadmap/SKILL.md +17 -0
- package/skills/reins-setup/SKILL.md +1 -1
- package/skills/reins-spec/SKILL.md +22 -0
- package/skills/reins-test/SKILL.md +18 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { intentIds, historyPages, intentFile } from './work.js';
|
|
4
|
+
import { readMetrics, summarize } from './metrics.js';
|
|
5
|
+
import { splitFrontmatter } from './skills.js';
|
|
6
|
+
/** One line per dismissal: the key, how many units it had then, when and why. */
|
|
7
|
+
export const DISMISSED = '.loctx/knowledge-proposals/dismissed.jsonl';
|
|
8
|
+
/** The latest dismissal of each key; unreadable lines are skipped. */
|
|
9
|
+
export function readDismissals(root) {
|
|
10
|
+
const out = new Map();
|
|
11
|
+
const f = join(root, DISMISSED);
|
|
12
|
+
if (!existsSync(f))
|
|
13
|
+
return out;
|
|
14
|
+
for (const line of readFileSync(f, 'utf8').split('\n')) {
|
|
15
|
+
try {
|
|
16
|
+
const d = JSON.parse(line);
|
|
17
|
+
if (typeof d.key === 'string' && typeof d.units === 'number')
|
|
18
|
+
out.set(d.key, d);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
// a blank or broken line dismisses nothing
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
/** `stop:F2` → `F2`; a bare slug stays as it is. */
|
|
27
|
+
export const bareKey = (k) => k.replace(/^(stop|reason|decision):/, '');
|
|
28
|
+
/** `reasons:` lines of history pages: `reasons: a, b` (design §4, optional line after `decisions:`). */
|
|
29
|
+
export function recordedReasons(root) {
|
|
30
|
+
const out = [];
|
|
31
|
+
for (const h of historyPages(root)) {
|
|
32
|
+
const line = /^reasons:\s*(.+)$/m.exec(h.text)?.[1];
|
|
33
|
+
if (line)
|
|
34
|
+
for (const x of line.split(','))
|
|
35
|
+
if (x.trim())
|
|
36
|
+
out.push({ path: h.path, reason: x.trim() });
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
/** Slugs already promoted: `decisions` and `symptoms` of `status: active` knowledge entries. */
|
|
41
|
+
export function promotedSlugs(root) {
|
|
42
|
+
const dir = join(root, '.agents', 'knowledge');
|
|
43
|
+
const out = new Set();
|
|
44
|
+
if (!existsSync(dir))
|
|
45
|
+
return out;
|
|
46
|
+
for (const e of readdirSync(dir).filter((x) => x.endsWith('.md'))) {
|
|
47
|
+
const { data } = splitFrontmatter(readFileSync(join(dir, e), 'utf8'));
|
|
48
|
+
if (!data || data['status'] !== 'active')
|
|
49
|
+
continue;
|
|
50
|
+
for (const f of ['decisions', 'symptoms']) {
|
|
51
|
+
const v = data[f];
|
|
52
|
+
if (Array.isArray(v))
|
|
53
|
+
for (const x of v)
|
|
54
|
+
out.add(String(x));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
/** Pages the tool wrote itself (install, update, migrate): marked `source: tool`, or named so before the marker existed. */
|
|
60
|
+
export const toolPage = (h) => /^source:\s*tool\s*$/m.test(h.text) ||
|
|
61
|
+
(!ticketOfPage(h.path) && /_(install|update|migrate)-(harness|loop|graph)\.md$/.test(h.path));
|
|
62
|
+
const ticketOfPage = (path) => /_(\d{3}-\d+)(?:-|\.|$)/.exec(path)?.[1];
|
|
63
|
+
function releaseIntents(root, version) {
|
|
64
|
+
const out = new Set();
|
|
65
|
+
for (const id of intentIds(root)) {
|
|
66
|
+
const v = intentFile(root, id, 'intent')?.data['version'];
|
|
67
|
+
if (v !== undefined && String(v) === version)
|
|
68
|
+
out.add(id);
|
|
69
|
+
}
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
export function collectRetro(root, opts = {}) {
|
|
73
|
+
const release = opts.release ?? null;
|
|
74
|
+
const scope = release ? releaseIntents(root, release) : null;
|
|
75
|
+
const inScope = (intent) => !scope || (!!intent && scope.has(intent));
|
|
76
|
+
const records = readMetrics(root).records.filter((r) => inScope(r.intent));
|
|
77
|
+
const units = new Map();
|
|
78
|
+
const add = (key, axis, unit, page) => {
|
|
79
|
+
let e = units.get(key);
|
|
80
|
+
if (!e)
|
|
81
|
+
units.set(key, (e = { axis, units: new Set(), pages: new Set() }));
|
|
82
|
+
e.units.add(unit);
|
|
83
|
+
if (page)
|
|
84
|
+
e.pages.add(page);
|
|
85
|
+
};
|
|
86
|
+
const stops = {};
|
|
87
|
+
const failedRounds = { HOLD: 0, STOP: 0 };
|
|
88
|
+
for (const r of records) {
|
|
89
|
+
if (r.kind !== 'check')
|
|
90
|
+
continue;
|
|
91
|
+
if (r.verdict === 'HOLD' || r.verdict === 'STOP')
|
|
92
|
+
failedRounds[r.verdict]++;
|
|
93
|
+
for (const id of new Set(r.reasons)) {
|
|
94
|
+
stops[id] = (stops[id] ?? 0) + 1;
|
|
95
|
+
if (r.ticket)
|
|
96
|
+
add(`stop:${id}`, 'stop', r.ticket);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const pageIn = (path) => {
|
|
100
|
+
const t = ticketOfPage(path);
|
|
101
|
+
return !scope || (!!t && scope.has(t.slice(0, 3)));
|
|
102
|
+
};
|
|
103
|
+
for (const h of historyPages(root)) {
|
|
104
|
+
if (!pageIn(h.path) || toolPage(h))
|
|
105
|
+
continue;
|
|
106
|
+
const unit = ticketOfPage(h.path) ?? h.path;
|
|
107
|
+
for (const [axis, field] of [
|
|
108
|
+
['reason', 'reasons'],
|
|
109
|
+
['decision', 'decisions'],
|
|
110
|
+
]) {
|
|
111
|
+
const line = new RegExp(`^${field}:\\s*(.+)$`, 'm').exec(h.text)?.[1];
|
|
112
|
+
if (!line)
|
|
113
|
+
continue;
|
|
114
|
+
for (const x of line.split(',')) {
|
|
115
|
+
const slug = x.trim();
|
|
116
|
+
if (slug)
|
|
117
|
+
add(`${axis}:${slug}`, axis, unit, h.path);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const keys = [...units]
|
|
122
|
+
.map(([key, e]) => ({
|
|
123
|
+
key,
|
|
124
|
+
axis: e.axis,
|
|
125
|
+
units: [...e.units].toSorted(),
|
|
126
|
+
pages: [...e.pages].toSorted(),
|
|
127
|
+
}))
|
|
128
|
+
.toSorted((a, b) => b.units.length - a.units.length || a.key.localeCompare(b.key));
|
|
129
|
+
const done = promotedSlugs(root);
|
|
130
|
+
const dismissals = readDismissals(root);
|
|
131
|
+
const isDismissed = (k) => k.units.length <= (dismissals.get(k.key)?.units ?? 0);
|
|
132
|
+
const repeated = keys.filter((k) => k.units.length >= 2 && !done.has(bareKey(k.key)));
|
|
133
|
+
const candidates = repeated.filter((k) => !isDismissed(k));
|
|
134
|
+
const dismissed = repeated.filter(isDismissed);
|
|
135
|
+
return {
|
|
136
|
+
release,
|
|
137
|
+
stops: Object.fromEntries(Object.entries(stops).toSorted(([a], [b]) => a.localeCompare(b))),
|
|
138
|
+
failedRounds,
|
|
139
|
+
tokens: summarize(records).tokens,
|
|
140
|
+
keys,
|
|
141
|
+
candidates,
|
|
142
|
+
dismissed,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/** The number `reins status` shows; the same count as `retro` over the whole record. */
|
|
146
|
+
export const candidateCount = (root) => collectRetro(root).candidates.length;
|
|
147
|
+
export function formatRetro(r) {
|
|
148
|
+
const n = (x) => x.toLocaleString('en-US');
|
|
149
|
+
const out = [`reins retro${r.release ? ` — release ${r.release}` : ''}`];
|
|
150
|
+
out.push(`failed rounds: HOLD ${r.failedRounds.HOLD} · STOP ${r.failedRounds.STOP}`);
|
|
151
|
+
out.push('stops by id');
|
|
152
|
+
const s = Object.entries(r.stops);
|
|
153
|
+
if (!s.length)
|
|
154
|
+
out.push(' —');
|
|
155
|
+
for (const [id, c] of s)
|
|
156
|
+
out.push(` ${id.padEnd(8)} ${c}`);
|
|
157
|
+
out.push(`tokens: ${n(r.tokens.total)}`);
|
|
158
|
+
const roles = Object.entries(r.tokens.byRole);
|
|
159
|
+
if (!roles.length)
|
|
160
|
+
out.push(' —');
|
|
161
|
+
for (const [k, v] of roles)
|
|
162
|
+
out.push(` ${k.padEnd(14)} ${n(v).padStart(12)}`);
|
|
163
|
+
for (const axis of ['stop', 'reason', 'decision']) {
|
|
164
|
+
const rows = r.keys.filter((k) => k.axis === axis && k.units.length >= 2);
|
|
165
|
+
out.push(`repeated ${axis} keys`);
|
|
166
|
+
if (!rows.length)
|
|
167
|
+
out.push(' —');
|
|
168
|
+
for (const k of rows) {
|
|
169
|
+
const cand = r.candidates.some((c) => c.key === k.key);
|
|
170
|
+
const dism = r.dismissed.some((c) => c.key === k.key);
|
|
171
|
+
const shown = k.units.slice(0, 4).join(', ') + (k.units.length > 4 ? `, +${k.units.length - 4}` : '');
|
|
172
|
+
out.push(` ${k.key} ×${k.units.length} (${shown})${cand ? '' : dism ? ' — dismissed' : ' — promoted'}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
out.push(`knowledge candidates: ${r.candidates.length}`);
|
|
176
|
+
for (const c of r.candidates)
|
|
177
|
+
out.push(` ${c.key}`);
|
|
178
|
+
return `${out.join('\n')}\n`;
|
|
179
|
+
}
|
package/cli/dist/lib/upstream.js
CHANGED
|
@@ -20,5 +20,18 @@ export function packageSkills() {
|
|
|
20
20
|
}
|
|
21
21
|
/** Which packaged skills a tier installs: the harness tier has no loop to run. */
|
|
22
22
|
export function tierSkills(tier) {
|
|
23
|
-
return tier === 'harness'
|
|
23
|
+
return tier === 'harness'
|
|
24
|
+
? ['reins-setup']
|
|
25
|
+
: [
|
|
26
|
+
'reins-setup',
|
|
27
|
+
'reins-roadmap',
|
|
28
|
+
'reins-intent',
|
|
29
|
+
'reins-spec',
|
|
30
|
+
'reins-implement',
|
|
31
|
+
'reins-review',
|
|
32
|
+
'reins-test',
|
|
33
|
+
'reins-release',
|
|
34
|
+
'reins-retro',
|
|
35
|
+
'reins-loop',
|
|
36
|
+
];
|
|
24
37
|
}
|
package/cli/dist/reins.js
CHANGED
|
@@ -4,11 +4,15 @@ import { Command } from 'commander';
|
|
|
4
4
|
import { runCheck, STAGES } from './commands/check.js';
|
|
5
5
|
import { runInstall } from './commands/install.js';
|
|
6
6
|
import { runMigrate } from './commands/migrate.js';
|
|
7
|
+
import { acceptKnowledge, dismissKnowledge, proposeKnowledge } from './commands/knowledge.js';
|
|
8
|
+
import { formatRetro, runRetro } from './commands/retro.js';
|
|
7
9
|
import { runStatus } from './commands/status.js';
|
|
8
10
|
import { runUpdate } from './commands/update.js';
|
|
9
11
|
import { configureBindings } from './commands/configure.js';
|
|
10
|
-
import { runGates } from './commands/gate.js';
|
|
12
|
+
import { respondRefusal, runGates, writeResponse } from './commands/gate.js';
|
|
13
|
+
import { newIntent, newRequest, newTicket } from './commands/new.js';
|
|
11
14
|
import { collectMetrics, formatMetrics, logCheck, logGates, recordUsage, } from './commands/metrics.js';
|
|
15
|
+
import { repoRoot } from './lib/git.js';
|
|
12
16
|
import { defaultsAsker, stdinAsker } from './lib/ask.js';
|
|
13
17
|
import { EXIT } from './lib/verdict.js';
|
|
14
18
|
// the version npm installed — cli/dist/reins.js sits two levels below package.json
|
|
@@ -177,19 +181,68 @@ program
|
|
|
177
181
|
.argument('[names...]', 'gates to run (default: the declared order)')
|
|
178
182
|
.option('--ticket <id>', 'name the reports after this ticket')
|
|
179
183
|
.option('--all', 'keep going after a failure')
|
|
184
|
+
.option('--respond', 'with --ticket: write the bus response for the open verify request (one line per gate on stdout)')
|
|
180
185
|
.option('--json')
|
|
181
186
|
.action((names, o) => {
|
|
187
|
+
const refusal = o.respond ? respondRefusal(names) : null;
|
|
188
|
+
if (refusal) {
|
|
189
|
+
process.stderr.write(`reins gate: ${refusal}\n`);
|
|
190
|
+
process.exit(2);
|
|
191
|
+
}
|
|
192
|
+
if (o.respond && !o.ticket) {
|
|
193
|
+
process.stderr.write('reins gate: --respond needs --ticket <id>\n');
|
|
194
|
+
process.exit(2);
|
|
195
|
+
}
|
|
182
196
|
const r = runGates({ names, ticket: o.ticket, all: o.all });
|
|
183
197
|
logGates(r.runs, { ticket: o.ticket });
|
|
198
|
+
const resp = o.respond && o.ticket && !r.refused
|
|
199
|
+
? writeResponse(repoRoot(process.cwd()), o.ticket, r.runs)
|
|
200
|
+
: null;
|
|
184
201
|
if (o.json)
|
|
185
|
-
process.stdout.write(`${JSON.stringify(r, null, 2)}\n`);
|
|
202
|
+
process.stdout.write(`${JSON.stringify(resp ? { ...r, respond: resp } : r, null, 2)}\n`);
|
|
186
203
|
else if (r.refused)
|
|
187
204
|
process.stderr.write(`reins gate: ${r.refused}\n`);
|
|
188
205
|
else
|
|
189
206
|
for (const g of r.runs)
|
|
190
207
|
process.stdout.write(` ${g.skipped ? '-' : g.exit === 0 ? 'ok' : 'FAIL'} ${g.gate.padEnd(10)} ${g.skipped ?? `exit ${g.exit} → ${g.report}`}\n`);
|
|
191
|
-
|
|
208
|
+
if (resp && !o.json) {
|
|
209
|
+
for (const [gate, s] of Object.entries(resp.summaries))
|
|
210
|
+
process.stdout.write(` ! ${gate}: ${s}\n`);
|
|
211
|
+
if (resp.response)
|
|
212
|
+
process.stdout.write(`response: ${resp.response} (${resp.verdict})\n`);
|
|
213
|
+
else
|
|
214
|
+
process.stderr.write(`reins gate: no response written — ${resp.refused}\n`);
|
|
215
|
+
}
|
|
216
|
+
process.exit(r.refused ? 2 : resp?.refused ? 1 : r.runs.every((g) => g.exit === 0) ? 0 : 1);
|
|
192
217
|
});
|
|
218
|
+
const done = (r) => {
|
|
219
|
+
process.stdout.write(r.stdout);
|
|
220
|
+
process.stderr.write(r.stderr);
|
|
221
|
+
process.exit(r.code);
|
|
222
|
+
};
|
|
223
|
+
const nw = program
|
|
224
|
+
.command('new')
|
|
225
|
+
.description('create an intent, ticket or bus request from the templates (no prompts, never overwrites)');
|
|
226
|
+
nw.command('intent')
|
|
227
|
+
.argument('<slug>')
|
|
228
|
+
.option('--version <v>', 'target version')
|
|
229
|
+
.option('--origin <o>', 'user | agent | incident')
|
|
230
|
+
.action((slug, o) => done(newIntent(process.cwd(), slug, o)));
|
|
231
|
+
nw.command('ticket')
|
|
232
|
+
.argument('<intent>')
|
|
233
|
+
.argument('<step>', "the plan's order-of-work step")
|
|
234
|
+
.argument('<slug>')
|
|
235
|
+
.option('--title <t>')
|
|
236
|
+
.option('--depends <ids>', 'comma separated ticket ids')
|
|
237
|
+
.option('--role <r>')
|
|
238
|
+
.option('--release <r>', 'planned | stabilization')
|
|
239
|
+
.action((intent, step, slug, o) => done(newTicket(process.cwd(), intent, step, slug, o)));
|
|
240
|
+
nw.command('request')
|
|
241
|
+
.argument('<ticket>')
|
|
242
|
+
.argument('<kind>', 'implement | verify | review | question | stop-report')
|
|
243
|
+
.option('--from <r>')
|
|
244
|
+
.option('--to <r>')
|
|
245
|
+
.action((ticket, kind, o) => done(newRequest(process.cwd(), ticket, kind, o)));
|
|
193
246
|
program
|
|
194
247
|
.command('status')
|
|
195
248
|
.description('where the project stands: harness, intents, tickets, bus, last history (read-only)')
|
|
@@ -232,6 +285,42 @@ metrics
|
|
|
232
285
|
? `${JSON.stringify(u, null, 2)}\n`
|
|
233
286
|
: `recorded: ${u.role} (${u.vendor}/${u.model}) ${u.tokens} tokens${u.ticket ? ` · ticket ${u.ticket}` : ''}${u.intent ? ` · intent ${u.intent}` : ''}\n`);
|
|
234
287
|
});
|
|
288
|
+
program
|
|
289
|
+
.command('retro')
|
|
290
|
+
.description('what repeated: stop ids, review reasons, decisions, failed rounds, tokens; knowledge candidates')
|
|
291
|
+
.option('--release <v>', 'only the intents whose version is v')
|
|
292
|
+
.option('--json')
|
|
293
|
+
.action((o) => {
|
|
294
|
+
const r = runRetro({ release: o.release });
|
|
295
|
+
process.stdout.write(o.json ? `${JSON.stringify(r, null, 2)}\n` : formatRetro(r));
|
|
296
|
+
});
|
|
297
|
+
const knowledge = program
|
|
298
|
+
.command('knowledge')
|
|
299
|
+
.description('promote a repeated key to a knowledge entry');
|
|
300
|
+
const knowledgeDone = (verb, r) => {
|
|
301
|
+
if (r.refused) {
|
|
302
|
+
process.stderr.write(`reins knowledge ${verb}: ${r.refused}\n`);
|
|
303
|
+
process.exit(1);
|
|
304
|
+
}
|
|
305
|
+
process.stdout.write(`${r.path}\n`);
|
|
306
|
+
};
|
|
307
|
+
knowledge
|
|
308
|
+
.command('propose')
|
|
309
|
+
.description('write a draft to .loctx/knowledge-proposals/ (records no approval)')
|
|
310
|
+
.argument('<key>', 'a retro key (decision:<slug>) or a slug')
|
|
311
|
+
.option('--from <history...>', 'history pages that back it')
|
|
312
|
+
.action((key, o) => knowledgeDone('propose', proposeKnowledge(key, o)));
|
|
313
|
+
knowledge
|
|
314
|
+
.command('accept')
|
|
315
|
+
.description('after the user approves: write .agents/knowledge/<date>_<slug>.md with approved')
|
|
316
|
+
.argument('<draft>', 'the draft slug')
|
|
317
|
+
.action((draft) => knowledgeDone('accept', acceptKnowledge(draft)));
|
|
318
|
+
knowledge
|
|
319
|
+
.command('dismiss')
|
|
320
|
+
.description('record that a candidate is not a lesson; it returns when it repeats further')
|
|
321
|
+
.argument('<key>', 'a candidate key as reins retro prints it')
|
|
322
|
+
.requiredOption('--reason <text>', 'why it is not a lesson')
|
|
323
|
+
.action((key, o) => knowledgeDone('dismiss', dismissKnowledge(key, o)));
|
|
235
324
|
for (const n of ['recall', 'doctor'])
|
|
236
325
|
program.command(n).allowUnknownOption().allowExcessArguments().action(notYet(n));
|
|
237
326
|
program
|
|
@@ -3,14 +3,30 @@
|
|
|
3
3
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import { resolve } from 'node:path';
|
|
5
5
|
import { pathToFileURL } from 'node:url';
|
|
6
|
+
/** Replaces only the first `"version": "<x>"` value; every other byte stays. Null when there is no such key. */
|
|
7
|
+
export function replaceVersion(text, version) {
|
|
8
|
+
const re = /("version"\s*:\s*")[^"]*(")/;
|
|
9
|
+
return re.test(text)
|
|
10
|
+
? text.replace(re, (_m, a, b) => `${a}${version}${b}`)
|
|
11
|
+
: null;
|
|
12
|
+
}
|
|
6
13
|
// compiled to cli/dist/scripts/: the repository root is three levels up (or the first argument)
|
|
7
14
|
const root = pathToFileURL(`${resolve(process.argv[2] ?? new URL('../../../', import.meta.url).pathname)}/`);
|
|
8
15
|
const read = (p) => readFileSync(new URL(p, root), 'utf8');
|
|
9
16
|
const write = (p, s) => writeFileSync(new URL(p, root), s);
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
export function sync() {
|
|
18
|
+
const version = JSON.parse(read('package.json')).version;
|
|
19
|
+
const pluginPath = '.claude-plugin/plugin.json';
|
|
20
|
+
const next = replaceVersion(read(pluginPath), version);
|
|
21
|
+
if (next === null) {
|
|
22
|
+
console.error(`sync-version: no "version" key in ${pluginPath}`);
|
|
23
|
+
return 1;
|
|
24
|
+
}
|
|
25
|
+
write(pluginPath, next);
|
|
26
|
+
const skillPath = 'skills/reins-setup/SKILL.md';
|
|
27
|
+
write(skillPath, read(skillPath).replace(/@bluenyang\/reins@[0-9][\w.+-]*/g, `@bluenyang/reins@${version}`));
|
|
28
|
+
console.log(`synced to ${version}`);
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href)
|
|
32
|
+
process.exitCode = sync();
|
package/docs/README.ko.md
CHANGED
|
@@ -129,22 +129,24 @@ T1(`ticket-start`), T2(`pre-commit`), T3(`verdict`), T4(`pre-push`), T5(`rc-clos
|
|
|
129
129
|
|
|
130
130
|
## 스킬
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
스킬 열 개가 `SKILL.md` 표준을 따릅니다. `reins-setup`은 설치, `reins-loop`는 지휘를 맡고, 나머지 단계 스킬 여덟 개는 단계 하나씩을 맡아 단독으로도 부를 수 있습니다.
|
|
133
133
|
|
|
134
134
|
| 스킬 | 쓸 때 |
|
|
135
135
|
|---|---|
|
|
136
136
|
| `reins-setup` | reins를 설치하거나 기존 하네스를 옮길 때 |
|
|
137
|
-
| `reins-
|
|
138
|
-
| `reins-
|
|
137
|
+
| `reins-roadmap` | 공개 로드맵을 고치고 대상 버전을 정할 때 |
|
|
138
|
+
| `reins-intent` | 새 요청이 들어올 때: 질문지와 승인된 intent |
|
|
139
|
+
| `reins-spec` | intent가 승인됐을 때: 수락된 spec, plan, ticket |
|
|
140
|
+
| `reins-implement` | ticket이 준비됐을 때: 커밋 단위로 구현 |
|
|
141
|
+
| `reins-review` | ticket이 끝났을 때: 검증, 리뷰, 닫기 |
|
|
142
|
+
| `reins-test` | 버전의 ticket이 모두 끝났을 때: 시나리오와 빌드 |
|
|
143
|
+
| `reins-release` | 버전 테스트가 끝났을 때: PR, CI, merge, rc |
|
|
144
|
+
| `reins-retro` | 버전이 릴리스됐을 때: 회고와 knowledge 제안 |
|
|
145
|
+
| `reins-loop` | spec이 수락됐을 때: 단계 스킬을 순서대로 호출 |
|
|
139
146
|
|
|
140
147
|
## 로드맵
|
|
141
148
|
|
|
142
|
-
|
|
143
|
-
|---|---|
|
|
144
|
-
| 0.1 | graph 설계, 이 저장소의 자기 설치·자기 이전, 검증기, 스킬 세 개, metrics, 위반 시나리오. 0.1.0 배포됨, 0.1.1 안정화(루프가 찾은 문제 수정), 0.1.2 Claude Code 플러그인(마켓플레이스 설치) |
|
|
145
|
-
| 0.2 | graph에서 loop·harness 깎기, Codex·Gemini·Cursor 생성물, `recall`·`doctor`·예산 정지, 이전 세대 하네스 시험 이전 |
|
|
146
|
-
| 0.3 | Team Croffle 저장소에 적용 |
|
|
147
|
-
| 1.0 | 정해진 일정은 없습니다. 0.x에서 기능을 더해 가다가 메인테이너가 체계가 잡혔다고 판단할 때 1.0이 됩니다. 안정화만으로 1.0이 되지는 않습니다 |
|
|
149
|
+
전체 계획은 [docs/ROADMAP.ko.md](ROADMAP.ko.md)에 있습니다([English](ROADMAP.md)).
|
|
148
150
|
|
|
149
151
|
## 문서
|
|
150
152
|
|
package/harness/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ Read by `reins update`: it lists the entries newer than a project's pinned versi
|
|
|
4
4
|
`[skill]` needs the project's own sections touched — `reins update` then points to `/reins-update`,
|
|
5
5
|
where the PM proposes those changes for the user to approve.
|
|
6
6
|
|
|
7
|
+
## 0.1.2
|
|
8
|
+
- Intent status gains `released` (set once a stable version of the intent is out); `reins status` folds such an intent into one line with no next action. Additive: existing values are unchanged.
|
|
9
|
+
- `reins gate --ticket <id> --respond` writes the bus response for the open verify request; verify-tool is now that call plus `reins check --stage verdict`.
|
|
10
|
+
|
|
7
11
|
## 0.1.1
|
|
8
12
|
- qa-design default binding is now gemini-4-argon-high and qa-run gemini-3.8-flash-medium (fallbacks unchanged).
|
|
9
13
|
- Generated settings deny `Bash(git commit -n *)` alongside `--no-verify`.
|
package/harness/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.2
|
package/harness/roles/advisor.md
CHANGED
|
@@ -16,6 +16,8 @@ must_not:
|
|
|
16
16
|
|
|
17
17
|
# code-review
|
|
18
18
|
|
|
19
|
+
Stage skills: `reins-review`.
|
|
20
|
+
|
|
19
21
|
1. Read only the diff and the request body you were given. Do not explore the repository or open other files. Read English docs only (never `.ko.md`).
|
|
20
22
|
1a. Requirement text (`changes[].requirement`) and the allowed file list (top-level `why`, "allowed files:") come inside the request; do not open the spec or plan.
|
|
21
23
|
2. Do not re-run gates or any command; cite the evidence paths from `changes[].evidence`.
|
package/harness/roles/deploy.md
CHANGED
|
@@ -14,4 +14,25 @@ must_not:
|
|
|
14
14
|
|
|
15
15
|
# deploy
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Stage skills: `reins-release`.
|
|
18
|
+
|
|
19
|
+
1. Only when the PL marks the work ready and T4 passes. 2. Announce each step. 3. Stop at anything in stop group A.
|
|
20
|
+
|
|
21
|
+
## Merge procedure (design §4 PR flow)
|
|
22
|
+
|
|
23
|
+
1. Push the feature branch (`type/topic`); never push to `master`/`main` (T4 holds it, A4).
|
|
24
|
+
2. Open the PR with `gh pr create`; the body comes from the docs role.
|
|
25
|
+
3. Wait: `gh pr checks --watch`.
|
|
26
|
+
4. Only when every required check is green: `gh pr merge --rebase --delete-branch`.
|
|
27
|
+
5. If any check is red, do not merge. Return it to the PL (D2: a red check twice).
|
|
28
|
+
|
|
29
|
+
## rc procedure (design §4)
|
|
30
|
+
|
|
31
|
+
1. Run `reins check --stage rc-close --release <V>`. Anything but CONTINUE (open `release: planned` or `release: stabilization` tickets, F2) means no dispatch.
|
|
32
|
+
2. Take the rc number T5 reports (`next rc: <V>-rc.<N>`; rc.1 when `.loctx/release/<V>.md` is missing).
|
|
33
|
+
3. Note the time, then `gh workflow run publish.yml -f version=<V>-rc.<N> -f dry_run=false`.
|
|
34
|
+
4. Identify the dispatched run: poll `gh run list --workflow publish.yml --event workflow_dispatch --json databaseId,displayTitle,headSha,createdAt` (every 5 s, up to ~60 s) for a run whose `displayTitle` is exactly `publish <V>-rc.<N> (dry_run=false)`, `createdAt` is after the noted time and `headSha` is the master commit being released. Never fall back to another run; none found means stop and report to the PL. Then `gh run watch <id> --exit-status`. On failure: no ledger line; report to the PL.
|
|
35
|
+
5. Only on success: read the stage id from that run's log line "staged with id …" and its release commit/tag, then append `- rc.<N> <commit> <stage-id> <date>` to `.loctx/release/<V>.md` (local ledger, not committed).
|
|
36
|
+
6. Ask the user to approve the staged version on npm. Fixes after an rc are `release: stabilization` tickets; the next rc follows the next T5 pass.
|
|
37
|
+
7. Stable (`version=<V>`) only on the user's explicit instruction; the workflow requires a `v<V>-rc.*` tag at master HEAD. After the stable version is approved on npm, set the intent's `status: released` in its intent.md (S-8, intent 011) and commit it.
|
|
38
|
+
|
package/harness/roles/docs.md
CHANGED
|
@@ -16,6 +16,8 @@ must_not:
|
|
|
16
16
|
|
|
17
17
|
# implementer
|
|
18
18
|
|
|
19
|
+
Stage skills: `reins-implement`.
|
|
20
|
+
|
|
19
21
|
1. Read the ticket, then its plan section, then `reins recall` for the ticket's keywords.
|
|
20
22
|
2. Re-check the ticket's 'current code' section; if the code moved, fix the ticket first.
|
|
21
23
|
3. Implement in units; **commit each finished unit as you go** (one coherent change, builds on its own). The hook runs `reins check --stage pre-commit` on every commit.
|
package/harness/roles/lookup.md
CHANGED
package/harness/roles/pl.md
CHANGED
|
@@ -15,6 +15,8 @@ must_not:
|
|
|
15
15
|
|
|
16
16
|
# pl
|
|
17
17
|
|
|
18
|
+
Stage skills: `reins-spec`, `reins-review`.
|
|
19
|
+
|
|
18
20
|
1. From an accepted spec: write plan.md (files that change, order of work, risks, proof, test checklist). Each order-of-work item becomes one ticket.
|
|
19
21
|
2. For each ticket: hand to an implementer (bus kind: implement) with the plan section and knowledge hits. A ticket's checklist items are the expected commit units.
|
|
20
22
|
3. On a verify-tool failure summary: decide fix (new ticket or same ticket) or escalate per the chain.
|
package/harness/roles/planner.md
CHANGED
|
@@ -14,6 +14,8 @@ must_not:
|
|
|
14
14
|
|
|
15
15
|
# planner
|
|
16
16
|
|
|
17
|
+
Stage skills: `reins-spec`.
|
|
18
|
+
|
|
17
19
|
1. Read intent.md fully, then knowledge/ (`reins recall`) for prior decisions that touch it.
|
|
18
20
|
2. Write spec.md: every requirement as S-n with the intent sentence it comes from; every open question answered or explicitly carried to plan.
|
|
19
21
|
3. Check each design invariant in AGENTS.md (reins:read invariants) — state conflict or none.
|
package/harness/roles/pm.md
CHANGED
|
@@ -16,8 +16,10 @@ must_not:
|
|
|
16
16
|
|
|
17
17
|
# pm
|
|
18
18
|
|
|
19
|
+
Stage skills: `reins-roadmap`, `reins-intent`, `reins-spec`, `reins-retro`.
|
|
20
|
+
|
|
19
21
|
1. Session start: read AGENTS.md, docs/ROADMAP.md, open intents (.agents/intent/*/intent.md with status draft|approved), then `reins status`.
|
|
20
22
|
2. New request → run the questionnaire skill; write intent.md in the user's words; ask the user to approve. Never set `status: approved` yourself.
|
|
21
23
|
3. Spec review: read spec.md against intent.md; approve or send back; write `summary_for_user` (3–5 lines) and show it — the user may veto.
|
|
22
24
|
4. Budgets: set `budget:` in plan.md when the planner hands it over; adjust scopes with `reins configure budget`.
|
|
23
|
-
5.
|
|
25
|
+
5. Retro (`reins-retro`): `reins retro` candidates → `reins knowledge propose` → show drafts → the user approves → `reins knowledge accept`, commit with `Approved-by: user`. Never accept unapproved.
|
|
@@ -15,5 +15,7 @@ must_not:
|
|
|
15
15
|
|
|
16
16
|
# qa-design
|
|
17
17
|
|
|
18
|
+
Stage skills: `reins-spec`, `reins-test`.
|
|
19
|
+
|
|
18
20
|
1. From spec.md: one scenario per S-n plus the risky paths the spec names.
|
|
19
21
|
2. Each scenario: steps, expected, verification method, pass criterion. Ambiguous expected results are a spec defect — send spec back.
|
package/harness/roles/qa-run.md
CHANGED
|
@@ -14,6 +14,7 @@ must_not:
|
|
|
14
14
|
|
|
15
15
|
# verify-tool
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
Stage skills: `reins-review`, `reins-test`.
|
|
18
|
+
|
|
19
|
+
1. Run `reins gate --ticket <id> --respond` — the declared order, stopping at the first failure (`--all` when asked). One call runs the gates, keeps each gate's raw output in `.loctx/reports/<ticket>_<gate>.log` (`$ cmd`, output untouched, `exit N`) and writes the bus response `<ticket>_<nn>.response.yaml` for the newest open `kind: verify` request (verdict pass|fail, `evidence:` the report paths, may_proceed). Never run a gate through a pipe or a chain; never trim its output (C5). Stdout is only a summary line per gate and, for a failure, its signature and file:line — judge from the report files, not from stdout. No open verify request: nothing is written and the call exits 1; report that to the PL.
|
|
20
|
+
2. Run `reins check --stage verdict --ticket <id>` (T3): a pass without raw evidence is D5, a non-zero exit or a massaged gate is D4. Add matching knowledge ids from `reins recall` to the hand-back only when asked.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"id": { "type": "string", "pattern": "^[0-9]{3}$" },
|
|
5
5
|
"slug": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
|
|
6
6
|
"version": { "type": "string" },
|
|
7
|
-
"status": { "enum": ["draft", "approved", "superseded"] },
|
|
7
|
+
"status": { "enum": ["draft", "approved", "released", "superseded"] },
|
|
8
8
|
"origin": { "enum": ["user", "agent", "incident"] },
|
|
9
9
|
"approvals": { "$ref": "#/$defs/approvals" },
|
|
10
10
|
"supersedes": { "type": ["string", "null"] }
|
package/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reins-implement
|
|
3
|
+
description: Implement one ticket as the implementer role — runs the T1 ticket-start check, then implements on the feature branch with one commit per finished unit (the hook runs T2). Use when a ticket is ready, the user says implement, next ticket or continue, or to resume a stopped ticket. Does not verify or review (reins-review).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# reins-implement
|
|
7
|
+
|
|
8
|
+
implementer role. Run the CLI as `npx @bluenyang/reins@<v>` where `<v>` is `version` in `.agents/harness/install.yaml` (inside the reins repository: `node cli/dist/reins.js`). Verdicts: CONTINUE (exit 0) go on · HOLD (10) ask the user, one line: reason id + what you need · STOP (20) do what `resume` says, then re-run the same check · ESCALATE (30) next role in the chain (pl → pm → advisor → user).
|
|
9
|
+
|
|
10
|
+
1. **Check first (T1).** `reins check --stage ticket-start --ticket <id>`. Not CONTINUE → stop and follow the verdict; do not start. Open `asks:` hold for the user; the check also names recorded decisions that may already answer them.
|
|
11
|
+
2. Branch `type/<NNN>-<slug>` from the default branch (never commit on it). Launch the `reins-implementer` subagent: ticket → plan section → `reins recall` → implement.
|
|
12
|
+
3. **One commit per finished unit** (a coherent change that builds on its own). The hook runs **T2** on every commit; never bypass it.
|
|
13
|
+
4. A diff outside the plan updates plan.md's departure log in the same commit (P2), or opens a new ticket (C10).
|
|
14
|
+
5. Tick the ticket checklist. Do not judge your own work or declare tests passed.
|
|
15
|
+
|
|
16
|
+
Interrupted (G1): write ticket, step, last commit, open bus files and the next command into the ticket, so the same command resumes.
|
|
17
|
+
|
|
18
|
+
Next: `reins-review`.
|
|
19
|
+
|
|
20
|
+
**Metrics.** After each role run, report what it cost with one call: `reins metrics record --role <role> --tokens <n> --intent <id> [--ticket <id>] --vendor <v> --model <m>`. No token count from the vendor → record nothing, never guess.
|