@bluenyang/reins 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/cli/dist/commands/config-models.js +193 -0
- package/cli/dist/commands/config.js +42 -0
- package/cli/dist/commands/configure.js +61 -8
- package/cli/dist/commands/install.js +87 -13
- package/cli/dist/commands/stages.js +14 -0
- package/cli/dist/commands/status.js +4 -3
- package/cli/dist/commands/update.js +48 -0
- package/cli/dist/lib/bindings.js +177 -10
- package/cli/dist/lib/generate.js +4 -0
- package/cli/dist/lib/prompter.js +103 -0
- package/cli/dist/reins.js +41 -29
- package/docs/README.ko.md +8 -6
- package/harness/roles/advisor.md +1 -0
- package/harness/roles/code-review.md +1 -0
- package/harness/roles/deploy.md +1 -0
- package/harness/roles/docs.md +1 -0
- package/harness/roles/implementer.md +1 -0
- package/harness/roles/lookup.md +1 -0
- package/harness/roles/pl.md +1 -0
- package/harness/roles/planner.md +1 -0
- package/harness/roles/pm.md +1 -0
- package/harness/roles/qa-design.md +1 -0
- package/harness/roles/qa-run.md +1 -0
- package/harness/roles/verify-tool.md +1 -0
- package/harness/schemas/bindings-local.schema.json +3 -2
- package/package.json +2 -1
- package/skills/reins-loop/SKILL.md +2 -0
- package/skills/reins-setup/SKILL.md +3 -1
package/cli/dist/lib/bindings.js
CHANGED
|
@@ -9,6 +9,8 @@ import { splitFrontmatter } from './skills.js';
|
|
|
9
9
|
export const LOCAL_BINDINGS = '.loctx/bindings.local.yaml';
|
|
10
10
|
/** Used only when pm itself has no usable binding. */
|
|
11
11
|
export const DEFAULT_MODEL = 'claude-opus-5-5';
|
|
12
|
+
/** Always on (design §2): pm, implementer and verify-tool cannot be switched off. */
|
|
13
|
+
export const FIXED_ROLES = ['pm', 'implementer', 'verify-tool'];
|
|
12
14
|
const isObj = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
13
15
|
let validateLocal;
|
|
14
16
|
function localValid(doc) {
|
|
@@ -55,8 +57,15 @@ function loadLocal(root) {
|
|
|
55
57
|
};
|
|
56
58
|
if (isObj(doc['roles']))
|
|
57
59
|
for (const [k, v] of Object.entries(doc['roles']))
|
|
58
|
-
if (isObj(v)
|
|
59
|
-
|
|
60
|
+
if (isObj(v)) {
|
|
61
|
+
const e = {};
|
|
62
|
+
if (typeof v['model'] === 'string' && v['model'])
|
|
63
|
+
e.model = v['model'];
|
|
64
|
+
if (typeof v['enabled'] === 'boolean')
|
|
65
|
+
e.enabled = v['enabled'];
|
|
66
|
+
if (e.model !== undefined || e.enabled !== undefined)
|
|
67
|
+
out.roles[k] = e;
|
|
68
|
+
}
|
|
60
69
|
return out;
|
|
61
70
|
}
|
|
62
71
|
export function writeLocal(root, doc) {
|
|
@@ -83,11 +92,85 @@ function roleMeta(root) {
|
|
|
83
92
|
meta.set(f.slice(0, -3), {
|
|
84
93
|
def: typeof data?.['default_binding'] === 'string' ? data['default_binding'] : undefined,
|
|
85
94
|
fb: typeof data?.['fallback_binding'] === 'string' ? data['fallback_binding'] : undefined,
|
|
95
|
+
covered: typeof data?.['covered_by'] === 'string' && data['covered_by'] !== 'none'
|
|
96
|
+
? data['covered_by']
|
|
97
|
+
: undefined,
|
|
86
98
|
});
|
|
87
99
|
}
|
|
88
100
|
return meta;
|
|
89
101
|
}
|
|
90
|
-
|
|
102
|
+
/** `roles.<r>.enabled` of the committed file, where a boolean is written. */
|
|
103
|
+
export function teamEnabled(root) {
|
|
104
|
+
const path = join(root, '.agents/harness/bindings.yaml');
|
|
105
|
+
if (!existsSync(path))
|
|
106
|
+
return {};
|
|
107
|
+
try {
|
|
108
|
+
const doc = parse(readFileSync(path, 'utf8'));
|
|
109
|
+
const out = {};
|
|
110
|
+
for (const [r, b] of Object.entries(doc?.roles ?? {}))
|
|
111
|
+
if (isObj(b) && typeof b['enabled'] === 'boolean')
|
|
112
|
+
out[r] = b['enabled'];
|
|
113
|
+
return out;
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return {};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* On or off per role for this user, without resolving models (no vendor detection): fixed roles are
|
|
121
|
+
* on; otherwise `local enabled ?? team enabled ?? true`. `warnings` names a fixed role that carries
|
|
122
|
+
* `enabled: false` in either layer (ignored).
|
|
123
|
+
*/
|
|
124
|
+
export function roleStates(root) {
|
|
125
|
+
const local = readLocal(root);
|
|
126
|
+
const team = teamEnabled(root);
|
|
127
|
+
const meta = roleMeta(root);
|
|
128
|
+
const names = new Set([
|
|
129
|
+
...FIXED_ROLES,
|
|
130
|
+
...Object.keys(teamRoles(root)),
|
|
131
|
+
...meta.keys(),
|
|
132
|
+
...Object.keys(team),
|
|
133
|
+
...Object.keys(local.roles),
|
|
134
|
+
]);
|
|
135
|
+
const states = new Map();
|
|
136
|
+
const warnings = [];
|
|
137
|
+
for (const role of [...names].toSorted()) {
|
|
138
|
+
const covered = meta.get(role)?.covered;
|
|
139
|
+
let enabled = true;
|
|
140
|
+
let enabled_source = 'default';
|
|
141
|
+
if (FIXED_ROLES.includes(role)) {
|
|
142
|
+
enabled_source = 'fixed';
|
|
143
|
+
for (const [layer, v] of [
|
|
144
|
+
['bindings.yaml', team[role]],
|
|
145
|
+
[LOCAL_BINDINGS, local.roles[role]?.enabled],
|
|
146
|
+
])
|
|
147
|
+
if (v === false)
|
|
148
|
+
warnings.push(`warning: ${layer}: ${role} is always on — its enabled: false is ignored`);
|
|
149
|
+
}
|
|
150
|
+
else if (local.roles[role]?.enabled !== undefined) {
|
|
151
|
+
enabled = local.roles[role].enabled;
|
|
152
|
+
enabled_source = 'local';
|
|
153
|
+
}
|
|
154
|
+
else if (team[role] !== undefined) {
|
|
155
|
+
enabled = team[role];
|
|
156
|
+
enabled_source = 'team';
|
|
157
|
+
}
|
|
158
|
+
states.set(role, {
|
|
159
|
+
role,
|
|
160
|
+
enabled,
|
|
161
|
+
enabled_source,
|
|
162
|
+
...(covered ? { covered_by: covered } : {}),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
return { states, warnings };
|
|
166
|
+
}
|
|
167
|
+
/** The state column of status and the config table: `off → pm`, `on (local)`, or empty when plainly on. */
|
|
168
|
+
export function stateLabel(b) {
|
|
169
|
+
if (!b.enabled)
|
|
170
|
+
return `off${b.covered_by ? ` → ${b.covered_by}` : ''}`;
|
|
171
|
+
return b.enabled_source === 'local' ? 'on (local)' : '';
|
|
172
|
+
}
|
|
173
|
+
export function teamRoles(root) {
|
|
91
174
|
const path = join(root, '.agents/harness/bindings.yaml');
|
|
92
175
|
if (!existsSync(path))
|
|
93
176
|
return {};
|
|
@@ -115,6 +198,12 @@ export function resolveBindings(root, detect = vendors) {
|
|
|
115
198
|
const local = readLocal(root);
|
|
116
199
|
const team = teamRoles(root);
|
|
117
200
|
const meta = roleMeta(root);
|
|
201
|
+
const { states } = roleStates(root);
|
|
202
|
+
const stateOf = (role) => states.get(role) ?? {
|
|
203
|
+
role,
|
|
204
|
+
enabled: true,
|
|
205
|
+
enabled_source: FIXED_ROLES.includes(role) ? 'fixed' : 'default',
|
|
206
|
+
};
|
|
118
207
|
let live;
|
|
119
208
|
const detected = (v) => {
|
|
120
209
|
if (v === 'claude')
|
|
@@ -125,31 +214,41 @@ export function resolveBindings(root, detect = vendors) {
|
|
|
125
214
|
live ??= new Map(detect().map((x) => [x.name, x.detected]));
|
|
126
215
|
return live.get(v) ?? false;
|
|
127
216
|
};
|
|
128
|
-
const roles = [...new Set([...Object.keys(team), ...meta.keys()])].toSorted();
|
|
217
|
+
const roles = [...new Set([...FIXED_ROLES, ...Object.keys(team), ...meta.keys()])].toSorted();
|
|
218
|
+
const withState = (b) => {
|
|
219
|
+
const { enabled, enabled_source, covered_by } = stateOf(b.role);
|
|
220
|
+
return { ...b, enabled, enabled_source, ...(covered_by ? { covered_by } : {}) };
|
|
221
|
+
};
|
|
129
222
|
const one = (role, last) => {
|
|
130
223
|
const l = local.roles[role]?.model;
|
|
131
224
|
if (l)
|
|
132
|
-
return {
|
|
225
|
+
return withState({
|
|
226
|
+
role,
|
|
227
|
+
vendor: vendorOf(l),
|
|
228
|
+
model: l,
|
|
229
|
+
source: 'local',
|
|
230
|
+
reason: 'local override',
|
|
231
|
+
});
|
|
133
232
|
const t = team[role];
|
|
134
233
|
if (t && detected(t.vendor))
|
|
135
|
-
return { role, ...t, source: 'team', reason: 'team binding' };
|
|
234
|
+
return withState({ role, ...t, source: 'team', reason: 'team binding' });
|
|
136
235
|
const fb = meta.get(role)?.fb;
|
|
137
236
|
const why = t ? `${t.vendor} not detected` : 'no team binding';
|
|
138
237
|
if (fb && detected(vendorOf(fb)))
|
|
139
|
-
return {
|
|
238
|
+
return withState({
|
|
140
239
|
role,
|
|
141
240
|
vendor: vendorOf(fb),
|
|
142
241
|
model: fb,
|
|
143
242
|
source: 'fallback',
|
|
144
243
|
reason: `${why} — fallback_binding`,
|
|
145
|
-
};
|
|
146
|
-
return {
|
|
244
|
+
});
|
|
245
|
+
return withState({
|
|
147
246
|
role,
|
|
148
247
|
vendor: last.vendor,
|
|
149
248
|
model: last.model,
|
|
150
249
|
source: last.source,
|
|
151
250
|
reason: `${why} — ${last.label}`,
|
|
152
|
-
};
|
|
251
|
+
});
|
|
153
252
|
};
|
|
154
253
|
// pm first, through the same order; its last resort is the claude default model
|
|
155
254
|
const pmRes = one('pm', {
|
|
@@ -241,3 +340,71 @@ export function migrateDetected(root, dryRun = false) {
|
|
|
241
340
|
writeFileSync(path, doc.toString());
|
|
242
341
|
return touched;
|
|
243
342
|
}
|
|
343
|
+
function roleNames(root) {
|
|
344
|
+
const dir = join(root, '.agents/harness/roles');
|
|
345
|
+
return existsSync(dir)
|
|
346
|
+
? readdirSync(dir)
|
|
347
|
+
.filter((f) => f.endsWith('.md'))
|
|
348
|
+
.map((f) => f.slice(0, -3))
|
|
349
|
+
.toSorted()
|
|
350
|
+
: [];
|
|
351
|
+
}
|
|
352
|
+
/** Why a role cannot be switched on or off, or null (used before anything is written). */
|
|
353
|
+
export function roleEnabledRefusal(root, role, on) {
|
|
354
|
+
const names = roleNames(root);
|
|
355
|
+
if (!names.includes(role))
|
|
356
|
+
return `unknown role "${role}" — roles: ${names.join(', ')}`;
|
|
357
|
+
if (!on && FIXED_ROLES.includes(role))
|
|
358
|
+
return `${role} is always on and cannot be switched off (fixed roles: ${FIXED_ROLES.join(', ')})`;
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Switches a role on or off in one layer and touches nothing else. Global edits `bindings.yaml` through
|
|
363
|
+
* the Document API (comments and order stay; switching on removes the key, since on is the default);
|
|
364
|
+
* local drops its key when it equals the team value. Regenerating vendor files is the caller's job.
|
|
365
|
+
*/
|
|
366
|
+
export function setRoleEnabled(root, role, on, scope) {
|
|
367
|
+
const refused = roleEnabledRefusal(root, role, on);
|
|
368
|
+
if (refused)
|
|
369
|
+
return { refused, changed: false };
|
|
370
|
+
if (scope === 'local') {
|
|
371
|
+
const local = readLocal(root);
|
|
372
|
+
const teamValue = teamEnabled(root)[role] ?? true;
|
|
373
|
+
const before = local.roles[role]?.enabled;
|
|
374
|
+
const entry = { ...local.roles[role] };
|
|
375
|
+
if (on === teamValue)
|
|
376
|
+
delete entry.enabled;
|
|
377
|
+
else
|
|
378
|
+
entry.enabled = on;
|
|
379
|
+
if (entry.enabled === before)
|
|
380
|
+
return { changed: false };
|
|
381
|
+
if (entry.model === undefined && entry.enabled === undefined)
|
|
382
|
+
delete local.roles[role];
|
|
383
|
+
else
|
|
384
|
+
local.roles[role] = entry;
|
|
385
|
+
writeLocal(root, local);
|
|
386
|
+
return { changed: true };
|
|
387
|
+
}
|
|
388
|
+
const path = join(root, '.agents/harness/bindings.yaml');
|
|
389
|
+
if (!existsSync(path))
|
|
390
|
+
return { refused: 'no bindings.yaml — install the graph tier first', changed: false };
|
|
391
|
+
const doc = parseDocument(readFileSync(path, 'utf8'));
|
|
392
|
+
if (doc.errors.length > 0)
|
|
393
|
+
return { refused: 'bindings.yaml cannot be parsed', changed: false };
|
|
394
|
+
const was = doc.getIn(['roles', role, 'enabled']);
|
|
395
|
+
if (on) {
|
|
396
|
+
if (was === undefined)
|
|
397
|
+
return { changed: false };
|
|
398
|
+
doc.deleteIn(['roles', role, 'enabled']);
|
|
399
|
+
const entry = doc.getIn(['roles', role], true);
|
|
400
|
+
if (isMap(entry) && entry.items.length === 0)
|
|
401
|
+
doc.deleteIn(['roles', role]);
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
if (was === false)
|
|
405
|
+
return { changed: false };
|
|
406
|
+
doc.setIn(['roles', role, 'enabled'], false);
|
|
407
|
+
}
|
|
408
|
+
writeFileSync(path, doc.toString());
|
|
409
|
+
return { changed: true };
|
|
410
|
+
}
|
package/cli/dist/lib/generate.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { parse, stringify } from 'yaml';
|
|
3
3
|
import { workTreeReader } from './reader.js';
|
|
4
|
+
import { FIXED_ROLES } from './bindings.js';
|
|
4
5
|
import { vendorOf } from './detect.js';
|
|
5
6
|
import { splitFrontmatter } from './skills.js';
|
|
6
7
|
/**
|
|
@@ -112,6 +113,9 @@ export function generateVendorFiles(root, rd = workTreeReader(root)) {
|
|
|
112
113
|
const b = bindings[r.role];
|
|
113
114
|
if (!b)
|
|
114
115
|
continue;
|
|
116
|
+
// a role the team switched off gets no agent file (fixed roles cannot be off); the local file never counts
|
|
117
|
+
if (b.enabled === false && !FIXED_ROLES.includes(r.role))
|
|
118
|
+
continue;
|
|
115
119
|
// Committed team defaults only (never the local file), so no user's override makes drift.
|
|
116
120
|
// A role bound to another vendor still gets a Claude file on its fallback model, else pm's.
|
|
117
121
|
let model = b.model;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/** A screen asks for a value; the user may also go back one screen or leave (Ctrl-C). */
|
|
2
|
+
export const BACK = Symbol('reins.prompt.back');
|
|
3
|
+
export const EXIT = Symbol('reins.prompt.exit');
|
|
4
|
+
/** stdin and stdout are both terminals: only then may a screen be drawn. */
|
|
5
|
+
export function isInteractive(stdin = process.stdin, stdout = process.stdout) {
|
|
6
|
+
return Boolean(stdin.isTTY && stdout.isTTY);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The real prompter. `@clack/prompts` is loaded here, on first use, so a run that never draws a screen
|
|
10
|
+
* (non-TTY, `--json`, tests) never loads it. Cancel (Ctrl-C) becomes EXIT; nothing is written by the prompter.
|
|
11
|
+
*/
|
|
12
|
+
export async function clackPrompter() {
|
|
13
|
+
const p = await import('@clack/prompts');
|
|
14
|
+
const nav = (v) => (p.isCancel(v) ? EXIT : v);
|
|
15
|
+
return {
|
|
16
|
+
async select(q) {
|
|
17
|
+
const v = await p.select({
|
|
18
|
+
message: q.message,
|
|
19
|
+
options: q.options.map((o) => ({ value: o.value, label: o.label, hint: o.hint })),
|
|
20
|
+
initialValue: q.initial,
|
|
21
|
+
});
|
|
22
|
+
return nav(v);
|
|
23
|
+
},
|
|
24
|
+
async multiselect(q) {
|
|
25
|
+
const v = await p.multiselect({
|
|
26
|
+
message: q.message,
|
|
27
|
+
options: q.options.map((o) => ({ value: o.value, label: o.label, hint: o.hint })),
|
|
28
|
+
initialValues: q.initial,
|
|
29
|
+
required: q.required ?? false,
|
|
30
|
+
});
|
|
31
|
+
return nav(v);
|
|
32
|
+
},
|
|
33
|
+
async text(q) {
|
|
34
|
+
const v = await p.text({
|
|
35
|
+
message: q.message,
|
|
36
|
+
initialValue: q.initial,
|
|
37
|
+
placeholder: q.placeholder,
|
|
38
|
+
});
|
|
39
|
+
return nav(v);
|
|
40
|
+
},
|
|
41
|
+
async confirm(q) {
|
|
42
|
+
const v = await p.confirm({ message: q.message, initialValue: q.initial ?? true });
|
|
43
|
+
return nav(v);
|
|
44
|
+
},
|
|
45
|
+
note: (m) => p.log.message(m),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** Tests: answers come from a queue in order; every question is recorded. An empty queue answers EXIT. */
|
|
49
|
+
export function scriptedPrompter(answers) {
|
|
50
|
+
const queue = [...answers];
|
|
51
|
+
const asked = [];
|
|
52
|
+
const notes = [];
|
|
53
|
+
const next = (kind, message, values) => {
|
|
54
|
+
asked.push({ kind, message, values });
|
|
55
|
+
return queue.length ? queue.shift() : EXIT;
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
asked,
|
|
59
|
+
notes,
|
|
60
|
+
remaining: () => queue.length,
|
|
61
|
+
select: async (q) => next('select', q.message, q.options.map((o) => o.value)),
|
|
62
|
+
multiselect: async (q) => next('multiselect', q.message, q.options.map((o) => o.value)),
|
|
63
|
+
text: async (q) => next('text', q.message),
|
|
64
|
+
confirm: async (q) => next('confirm', q.message),
|
|
65
|
+
note: (m) => {
|
|
66
|
+
notes.push(m);
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Non-TTY bridge over the line-based `Asker`: each question is asked as one line and its answer parsed.
|
|
72
|
+
* select/multiselect take a value (or label) / a comma-separated list; confirm takes y/n; text takes the line.
|
|
73
|
+
* The default shown is the initial value.
|
|
74
|
+
*/
|
|
75
|
+
export function askerPrompter(asker) {
|
|
76
|
+
const pick = (raw, options) => options.find((o) => String(o.value) === raw || o.label === raw)?.value;
|
|
77
|
+
return {
|
|
78
|
+
async select(q) {
|
|
79
|
+
const d = String(q.initial ?? q.options[0]?.value ?? '');
|
|
80
|
+
const a = await asker.ask(`${q.message} (${q.options.map((o) => String(o.value)).join('/')})`, d);
|
|
81
|
+
return pick(a, q.options) ?? q.options[0]?.value;
|
|
82
|
+
},
|
|
83
|
+
async multiselect(q) {
|
|
84
|
+
const d = (q.initial ?? []).map(String).join(',');
|
|
85
|
+
const a = await asker.ask(`${q.message} (${q.options.map((o) => String(o.value)).join(',')})`, d);
|
|
86
|
+
return a
|
|
87
|
+
.split(',')
|
|
88
|
+
.map((s) => s.trim())
|
|
89
|
+
.filter(Boolean)
|
|
90
|
+
.map((s) => pick(s, q.options))
|
|
91
|
+
.filter((v) => v !== undefined);
|
|
92
|
+
},
|
|
93
|
+
async text(q) {
|
|
94
|
+
return asker.ask(q.message, q.initial ?? '');
|
|
95
|
+
},
|
|
96
|
+
async confirm(q) {
|
|
97
|
+
const d = (q.initial ?? true) ? 'y' : 'n';
|
|
98
|
+
const a = (await asker.ask(`${q.message} (y/n)`, d)).toLowerCase();
|
|
99
|
+
return a.startsWith('y');
|
|
100
|
+
},
|
|
101
|
+
note: () => { },
|
|
102
|
+
};
|
|
103
|
+
}
|
package/cli/dist/reins.js
CHANGED
|
@@ -7,13 +7,16 @@ import { runMigrate } from './commands/migrate.js';
|
|
|
7
7
|
import { acceptKnowledge, dismissKnowledge, proposeKnowledge } from './commands/knowledge.js';
|
|
8
8
|
import { formatRetro, runRetro } from './commands/retro.js';
|
|
9
9
|
import { runStatus } from './commands/status.js';
|
|
10
|
-
import { runUpdate } from './commands/update.js';
|
|
10
|
+
import { formatUpdate, runUpdate } from './commands/update.js';
|
|
11
11
|
import { configureBindings, configureGates } from './commands/configure.js';
|
|
12
|
+
import { runConfig } from './commands/config.js';
|
|
13
|
+
import { stateLabel } from './lib/bindings.js';
|
|
12
14
|
import { respondRefusal, runGates, writeResponse } from './commands/gate.js';
|
|
13
15
|
import { newIntent, newRequest, newTicket } from './commands/new.js';
|
|
14
16
|
import { collectMetrics, formatMetrics, logCheck, logGates, recordUsage, } from './commands/metrics.js';
|
|
15
17
|
import { repoRoot } from './lib/git.js';
|
|
16
18
|
import { defaultsAsker, stdinAsker } from './lib/ask.js';
|
|
19
|
+
import { clackPrompter, isInteractive } from './lib/prompter.js';
|
|
17
20
|
import { EXIT } from './lib/verdict.js';
|
|
18
21
|
// the version npm installed — cli/dist/reins.js sits two levels below package.json
|
|
19
22
|
const VERSION = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8')).version;
|
|
@@ -45,13 +48,16 @@ program
|
|
|
45
48
|
process.stderr.write(`reins install: tier must be harness, loop or graph (got "${tier}")\n`);
|
|
46
49
|
process.exit(2);
|
|
47
50
|
}
|
|
48
|
-
|
|
51
|
+
// screens only on a terminal, in manual mode, without --json; otherwise the line-based questions
|
|
52
|
+
const screens = o.mode === 'manual' && !o.json && isInteractive();
|
|
53
|
+
const asker = o.mode === 'auto' || screens ? defaultsAsker : await stdinAsker();
|
|
49
54
|
const r = await runInstall({
|
|
50
55
|
tier: tier,
|
|
51
56
|
mode: o.mode,
|
|
52
57
|
hooks: o.hooks,
|
|
53
58
|
dryRun: o.dryRun,
|
|
54
59
|
asker,
|
|
60
|
+
prompter: screens ? await clackPrompter() : undefined,
|
|
55
61
|
});
|
|
56
62
|
asker.close();
|
|
57
63
|
if (o.json) {
|
|
@@ -62,6 +68,10 @@ program
|
|
|
62
68
|
process.stderr.write(`reins install: ${r.refused}\n`);
|
|
63
69
|
process.exit(2);
|
|
64
70
|
}
|
|
71
|
+
if (r.cancelled) {
|
|
72
|
+
process.stdout.write('reins install: cancelled — nothing was written\n');
|
|
73
|
+
process.exit(0);
|
|
74
|
+
}
|
|
65
75
|
const a = r.applied;
|
|
66
76
|
const verb = o.dryRun ? 'would write' : 'wrote';
|
|
67
77
|
process.stdout.write(`reins install ${tier} — generation before: ${r.generation}\n`);
|
|
@@ -127,9 +137,16 @@ program
|
|
|
127
137
|
.command('update')
|
|
128
138
|
.description('re-apply the packaged harness: upstream files, managed blocks, vendor files, version pin')
|
|
129
139
|
.option('--dry-run', 'show what would change')
|
|
140
|
+
.option('--yes', 'do not ask for confirmation')
|
|
130
141
|
.option('--json')
|
|
131
142
|
.action(async (o) => {
|
|
132
|
-
|
|
143
|
+
// on a terminal, show the plan and ask first (design §9); otherwise run as before
|
|
144
|
+
const confirm = !o.yes && !o.dryRun && !o.json && isInteractive();
|
|
145
|
+
const r = await runUpdate({
|
|
146
|
+
dryRun: o.dryRun,
|
|
147
|
+
prompter: confirm ? await clackPrompter() : undefined,
|
|
148
|
+
show: (plan) => process.stdout.write(formatUpdate(plan, true)),
|
|
149
|
+
});
|
|
133
150
|
if (o.json) {
|
|
134
151
|
process.stdout.write(`${JSON.stringify(r, null, 2)}\n`);
|
|
135
152
|
process.exit(r.refused ? 2 : 0);
|
|
@@ -138,29 +155,18 @@ program
|
|
|
138
155
|
process.stderr.write(`reins update: ${r.refused}\n`);
|
|
139
156
|
process.exit(2);
|
|
140
157
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
process.stdout.write(` · ${c}\n`);
|
|
145
|
-
if (r.bindingsMoved)
|
|
146
|
-
process.stdout.write(`bindings: ${o.dryRun ? 'would move' : 'moved'} detected vendors (${r.bindingsMoved.join(', ')}) to .loctx/bindings.local.yaml\n`);
|
|
147
|
-
if (a && a.created.length + a.changed.length + a.removed.length === 0)
|
|
148
|
-
process.stdout.write('already up to date\n');
|
|
149
|
-
else if (a) {
|
|
150
|
-
process.stdout.write(`${o.dryRun ? 'would write' : 'wrote'}: ${a.created.length} new, ${a.changed.length} changed${a.removed.length ? `, ${a.removed.length} removed` : ''}\n`);
|
|
151
|
-
for (const p of [...a.created, ...a.changed])
|
|
152
|
-
process.stdout.write(` ~ ${p}\n`);
|
|
153
|
-
for (const p of a.removed)
|
|
154
|
-
process.stdout.write(` - ${p} (no longer installed by this tier)\n`);
|
|
158
|
+
if (r.declined) {
|
|
159
|
+
process.stdout.write('reins update: not applied — nothing was written\n');
|
|
160
|
+
process.exit(0);
|
|
155
161
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
process.stdout.write(formatUpdate(r, !!o.dryRun));
|
|
163
|
+
});
|
|
164
|
+
program
|
|
165
|
+
.command('config')
|
|
166
|
+
.description('settings screen on a terminal; the resolved bindings table otherwise')
|
|
167
|
+
.option('--json', 'print the resolved bindings as JSON (no screen)')
|
|
168
|
+
.action(async (o) => {
|
|
169
|
+
process.exit(await runConfig({ json: o.json }));
|
|
164
170
|
});
|
|
165
171
|
const configure = program.command('configure').description('change project-owned settings');
|
|
166
172
|
configure
|
|
@@ -169,29 +175,35 @@ configure
|
|
|
169
175
|
.option('--set <pairs...>', 'role=model pairs')
|
|
170
176
|
.option('--vendors <list>', 'rebuild every role from its defaults for these vendors (comma-separated)')
|
|
171
177
|
.option('--local', 'with --set: write your own override to .loctx/bindings.local.yaml')
|
|
178
|
+
.option('--disable <roles...>', 'switch roles off (pm, implementer and verify-tool cannot be)')
|
|
179
|
+
.option('--enable <roles...>', 'switch roles on again')
|
|
172
180
|
.option('--show', 'print what each role actually runs on')
|
|
173
181
|
.option('--json')
|
|
174
182
|
.action(async (o) => {
|
|
175
|
-
const asker = !o.set && !o.vendors && !o.local && !o.show
|
|
183
|
+
const asker = !o.set && !o.vendors && !o.local && !o.show && !o.disable && !o.enable
|
|
184
|
+
? await stdinAsker()
|
|
185
|
+
: undefined;
|
|
176
186
|
const r = await configureBindings({
|
|
177
187
|
local: o.local,
|
|
178
188
|
show: o.show,
|
|
179
189
|
set: o.set,
|
|
190
|
+
disable: o.disable,
|
|
191
|
+
enable: o.enable,
|
|
180
192
|
vendors: o.vendors?.split(',').map((s) => s.trim()),
|
|
181
193
|
asker,
|
|
182
194
|
});
|
|
183
195
|
asker?.close();
|
|
184
196
|
if (o.json) {
|
|
185
197
|
process.stdout.write(`${JSON.stringify(r, null, 2)}\n`);
|
|
186
|
-
process.exit(r.refused ? 2 : 0);
|
|
198
|
+
process.exit(r.refused ? (r.code ?? 2) : 0);
|
|
187
199
|
}
|
|
188
200
|
if (r.refused) {
|
|
189
201
|
process.stderr.write(`reins configure bindings: ${r.refused}\n`);
|
|
190
|
-
process.exit(2);
|
|
202
|
+
process.exit(r.code ?? 2);
|
|
191
203
|
}
|
|
192
204
|
if (o.show || o.local) {
|
|
193
205
|
for (const t of r.resolved ?? [])
|
|
194
|
-
process.stdout.write(` ${r.changed.includes(t.role) ? '*' : ' '} ${t.role.padEnd(12)} ${t.vendor.padEnd(7)} ${t.model} (${t.source}: ${t.reason})\n`);
|
|
206
|
+
process.stdout.write(` ${r.changed.includes(t.role) ? '*' : ' '} ${t.role.padEnd(12)} ${t.vendor.padEnd(7)} ${t.model} (${t.source}: ${t.reason})${stateLabel(t) ? ` ${stateLabel(t)}` : ''}\n`);
|
|
195
207
|
}
|
|
196
208
|
else
|
|
197
209
|
for (const t of r.table)
|
package/docs/README.ko.md
CHANGED
|
@@ -14,12 +14,13 @@ BlueNyang과 Team Croffle의 저장소 열두 곳이 같은 하네스 계보를
|
|
|
14
14
|
|
|
15
15
|
## 상태
|
|
16
16
|
|
|
17
|
-
0.1.
|
|
17
|
+
0.1.5가 npm에 있습니다: `npx @bluenyang/reins <command>`. 계획의 1차(round one)로, graph 단계이며
|
|
18
18
|
생성되는 벤더 파일은 Claude Code만 검증했습니다. loop와 harness 단계는 0.2에서 graph로부터 깎아
|
|
19
19
|
냅니다. 0.1.3에서 루프를 단계 스킬로 나누고 PR → CI → rc 릴리스 흐름을 넣었고, 0.1.4에서 큰 저장소
|
|
20
|
-
적용을 준비했습니다(릴리스 설정, 모노레포 게이트, migrate 수정).
|
|
20
|
+
적용을 준비했습니다(릴리스 설정, 모노레포 게이트, migrate 수정). 0.1.5는 어떤 규칙이 강제되고
|
|
21
21
|
어떤 규칙이 권고인지 밝히고, 모델 할당을 팀과 사용자 두 층으로 나누며, CI를 Ubuntu·Windows·macOS와
|
|
22
|
-
Node 22·24에서 돌립니다.
|
|
22
|
+
Node 22·24에서 돌립니다. rc 단계인 0.2.0은 모델과 역할을 터미널 화면에서 정하는 `reins config`를 더하고,
|
|
23
|
+
install과 update의 질문도 화면으로 묻습니다. 버전마다 바뀐 것은
|
|
23
24
|
[CHANGELOG.md](../CHANGELOG.md)에, 다음 계획은 로드맵에 있습니다.
|
|
24
25
|
|
|
25
26
|
reins는 자기 루프로 자기 자신을 개발합니다. intent 001(`reins status`), 002(`reins metrics`),
|
|
@@ -189,10 +190,11 @@ reins 자체를 개발하려면 `git clone https://github.com/bluenyang/reins.gi
|
|
|
189
190
|
|
|
190
191
|
| 명령 | 상태 | 하는 일 |
|
|
191
192
|
|---|---|---|
|
|
192
|
-
| `install <harness\|loop\|graph>` | 구현됨 | 하네스를 설치합니다. `--mode manual\|auto`, `--hooks`, `--dry-run`, `--json` |
|
|
193
|
+
| `install <harness\|loop\|graph>` | 구현됨 | 하네스를 설치합니다. 터미널에서 `--mode manual`이면 벤더·언어·게이트·하위 게이트를 화면으로 묻습니다. `--mode manual\|auto`, `--hooks`, `--dry-run`, `--json` |
|
|
193
194
|
| `migrate <tier>` | 구현됨 | 기존 하네스나 `.ai/` 작업 공간을 이 배치로 옮깁니다 |
|
|
194
|
-
| `update` | 구현됨 | 패키지된 하네스를 다시 적용하되 프로젝트 섹션은 건드리지 않습니다 |
|
|
195
|
-
| `
|
|
195
|
+
| `update` | 구현됨 | 패키지된 하네스를 다시 적용하되 프로젝트 섹션은 건드리지 않습니다. 터미널에서는 계획을 보여 주고 먼저 묻습니다(`--yes`는 묻지 않습니다) |
|
|
196
|
+
| `config` | 구현됨 | 터미널에서는 설정 화면(`models and roles configuration`, `exit`)을 띄웁니다. 터미널이 아니면 해석된 bindings 표와 바꾸는 방법을 출력합니다. `--json` |
|
|
197
|
+
| `configure bindings` | 구현됨 | `--set role=model ...` 또는 `--vendors claude,openai`. `--disable <role...>`·`--enable <role...>`은 역할을 끄고 켭니다(`--local`은 나만. pm·implementer·verify-tool은 끌 수 없습니다). 옵션이 없으면 묻습니다 |
|
|
196
198
|
| `gate [names...]` | 구현됨 | `gates.yaml`을 선언된 대로 실행하고 원본 출력을 `.loctx/reports/`에 남깁니다 |
|
|
197
199
|
| `status` | 구현됨 | 하네스, intent, ticket, bus, 마지막 history를 읽기 전용으로 보여 줍니다 |
|
|
198
200
|
| `check` | 구현됨 | `--stage ticket-start\|pre-commit\|verdict\|pre-push\|rc-close` 또는 `--drift` |
|
package/harness/roles/advisor.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
role: advisor
|
|
3
3
|
default_binding: "claude-fable-5-1"
|
|
4
4
|
summary: "Steps in at the end of the escalation chain: root cause, test plan, fix plan. Asks the user before anything beyond its authority."
|
|
5
|
+
covered_by: user
|
|
5
6
|
may:
|
|
6
7
|
- "read everything; run gates and scenarios"
|
|
7
8
|
- "write the analysis and plan to the bus and propose knowledge entries"
|
|
@@ -3,6 +3,7 @@ role: code-review
|
|
|
3
3
|
default_binding: "gpt-6.1-sol"
|
|
4
4
|
fallback_binding: "claude-sonnet-5-5"
|
|
5
5
|
summary: "Reviews the diff against plan and spec; proposes fixes; never edits."
|
|
6
|
+
covered_by: pl
|
|
6
7
|
capabilities: { write: false, shell: true }
|
|
7
8
|
may:
|
|
8
9
|
- "read the diff, plan.md, spec.md, knowledge/"
|
package/harness/roles/deploy.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
role: deploy
|
|
3
3
|
default_binding: "claude-haiku-5-5"
|
|
4
4
|
summary: "Pushes, opens PRs, cuts rc releases and publishes notes — inside the pre-release loop only."
|
|
5
|
+
covered_by: pm
|
|
5
6
|
may:
|
|
6
7
|
- "push the feature branch; open and rebase-merge the PR when checks are green"
|
|
7
8
|
- "dispatch the release workflows the repository configures (install.yaml release:); publish release notes"
|
package/harness/roles/docs.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
role: docs
|
|
3
3
|
default_binding: "claude-sonnet-5-5"
|
|
4
4
|
summary: "Writes human-facing text: README (en + .ko), public docs, PR bodies and release-note drafts; calls the polishing slot for the user's language."
|
|
5
|
+
covered_by: pm
|
|
5
6
|
may:
|
|
6
7
|
- "edit README*, docs/, .loctx/pr/, .loctx/release/"
|
|
7
8
|
- "call the language polishing skill when installed (optional slot, R61)"
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
role: implementer
|
|
3
3
|
default_binding: "claude-sonnet-5-5"
|
|
4
4
|
summary: "Implements one ticket on the plan's branch, runs the gates, commits. May run in parallel on independent tickets."
|
|
5
|
+
covered_by: none
|
|
5
6
|
may:
|
|
6
7
|
- "edit the files the plan names"
|
|
7
8
|
- "run gates declared in gates.yaml"
|
package/harness/roles/lookup.md
CHANGED
package/harness/roles/pl.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
role: pl
|
|
3
3
|
default_binding: "claude-sonnet-5-5"
|
|
4
4
|
summary: "Owns plan.md and the tickets; directs implementers; decides from verification results without judging them itself."
|
|
5
|
+
covered_by: pm
|
|
5
6
|
may:
|
|
6
7
|
- "write intent/<id>/plan.md; create and order tickets in .loctx/ticket/"
|
|
7
8
|
- "dispatch implementers (parallel when tickets have no dependencies)"
|
package/harness/roles/planner.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
role: planner
|
|
3
3
|
default_binding: "claude-opus-5-5"
|
|
4
4
|
summary: "Turns an approved intent into spec.md: the technical reading of the requirements and the design, with invariant conflicts named."
|
|
5
|
+
covered_by: pm
|
|
5
6
|
may:
|
|
6
7
|
- "read code and documents"
|
|
7
8
|
- "write intent/<id>/spec.md and the questionnaire record in intent.md"
|
package/harness/roles/pm.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
role: pm
|
|
3
3
|
default_binding: "claude-opus-5-5"
|
|
4
4
|
summary: "Talks with the user, owns intent confirmation, first spec review, budgets, roadmap and the project sections of AGENTS.md."
|
|
5
|
+
covered_by: none
|
|
5
6
|
may:
|
|
6
7
|
- "talk with the user and write the user-facing summary of a spec (R64)"
|
|
7
8
|
- "propose an intent for the user's approval; maintain docs/ROADMAP.md"
|
|
@@ -3,6 +3,7 @@ role: qa-design
|
|
|
3
3
|
default_binding: "gemini-4-argon-high"
|
|
4
4
|
fallback_binding: "claude-opus-5-5"
|
|
5
5
|
summary: "Designs test scenarios from intent, roadmap and architecture — never from code. Gives the first review of spec and a light review of plan."
|
|
6
|
+
covered_by: pm
|
|
6
7
|
may:
|
|
7
8
|
- "read intent.md, spec.md, docs/, AGENTS.md"
|
|
8
9
|
- "write scenarios (paths, expected results, how to verify: script, screenshot, static analysis)"
|
package/harness/roles/qa-run.md
CHANGED
|
@@ -3,6 +3,7 @@ role: qa-run
|
|
|
3
3
|
default_binding: "gemini-3.8-flash-medium"
|
|
4
4
|
fallback_binding: "claude-haiku-5-5"
|
|
5
5
|
summary: "Runs the designed scenarios and judges them; anything ambiguous fails."
|
|
6
|
+
covered_by: verify-tool
|
|
6
7
|
may:
|
|
7
8
|
- "run scenarios and the scripts they name"
|
|
8
9
|
- "write .loctx/reports/ with raw output"
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
role: verify-tool
|
|
3
3
|
default_binding: "claude-haiku-5-5"
|
|
4
4
|
summary: "Runs the declared gates and scenarios, attaches raw tool output, summarises failures so the PL can act."
|
|
5
|
+
covered_by: none
|
|
5
6
|
may:
|
|
6
7
|
- "run gates from gates.yaml and scenarios from the plan's test checklist"
|
|
7
8
|
- "write .loctx/reports/ with raw output (R46)"
|