arbiterdesign 0.1.2 → 0.1.4
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/LICENSE +21 -21
- package/README.md +183 -143
- package/dist/autopublish.js +81 -0
- package/dist/commands/candidate.js +1 -1
- package/dist/commands/export.js +58 -58
- package/dist/commands/init.js +67 -27
- package/dist/commands/publish.js +104 -2
- package/dist/commands/record.js +6 -1
- package/dist/commands/remove.js +232 -0
- package/dist/commands/review.js +18 -1
- package/dist/commands/rules.js +4 -2
- package/dist/commands/snapshot.js +10 -2
- package/dist/commands/update.js +114 -0
- package/dist/format.js +4 -3
- package/dist/hosted.js +5 -0
- package/dist/index.js +67 -4
- package/dist/store.js +10 -0
- package/dist/sweep.js +9 -2
- package/package.json +45 -44
- package/templates/SKILL.md +468 -393
- package/templates/review.html +479 -479
- package/dist/test/hosted.test.js +0 -189
- package/dist/test/init.test.js +0 -54
- package/dist/test/pending.test.js +0 -214
- package/dist/test/polish.test.js +0 -130
- package/dist/test/record.test.js +0 -102
- package/dist/test/stages.test.js +0 -188
|
@@ -21,12 +21,20 @@ function snapshotWork(name, opts) {
|
|
|
21
21
|
if (!opts.file && !opts.capture)
|
|
22
22
|
return { exitCode: 1, output: { status: 'invalid', errors: ['pass --file <image> or --capture'] } };
|
|
23
23
|
const id = (0, work_1.workId)(trigger);
|
|
24
|
-
|
|
24
|
+
// A work card is built from judged decisions only, so a picture for work still in the queue has
|
|
25
|
+
// nothing to hang on yet. Counting the queue here would report success for a board that stays empty.
|
|
26
|
+
const judged = (0, store_1.readArchive)(paths).some((d) => (0, work_1.workId)(d.trigger) === id && d.verdict !== 'retire');
|
|
27
|
+
const queued = (0, store_1.readPending)(paths).filter((d) => (0, work_1.workId)(d.trigger) === id).length;
|
|
25
28
|
const r = opts.capture ? (0, work_1.captureImage)((0, work_1.workDir)(paths), id) : (0, work_1.copyImage)(root, (0, work_1.workDir)(paths), id, opts.file);
|
|
26
29
|
if (!r.ok)
|
|
27
30
|
return { exitCode: 1, output: { status: 'failed', error: r.error } };
|
|
31
|
+
const note = judged
|
|
32
|
+
? null
|
|
33
|
+
: queued
|
|
34
|
+
? `"${trigger}" has ${queued} decision${queued === 1 ? '' : 's'} still in the queue — the picture shows on the board once they're judged (/arbiter, or npx arbiter review)`
|
|
35
|
+
: `no decisions mention "${trigger}" yet — the picture shows once some do`;
|
|
28
36
|
return {
|
|
29
37
|
exitCode: 0,
|
|
30
|
-
output: { status: 'saved', work: trigger, id, file: node_path_1.default.relative(root, node_path_1.default.join((0, work_1.workDir)(paths), r.file)), ...(
|
|
38
|
+
output: { status: 'saved', work: trigger, id, file: node_path_1.default.relative(root, node_path_1.default.join((0, work_1.workDir)(paths), r.file)), ...(note ? { note } : {}) },
|
|
31
39
|
};
|
|
32
40
|
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `arbiter update` — bring a project up to the newest Arbiter, and `updateStatus`, the offline
|
|
4
|
+
* check behind the agent's one-line notice.
|
|
5
|
+
*
|
|
6
|
+
* Two things go stale independently: the package pinned in the host's devDependencies, and the
|
|
7
|
+
* skill file init copied into the project — the agent's whole protocol. The second is the one
|
|
8
|
+
* that matters, and it's detectable with no network: init stamps the skill with the version
|
|
9
|
+
* that wrote it. Nothing here checks the registry; "is there a newer version" is the package
|
|
10
|
+
* manager's job when `update` runs.
|
|
11
|
+
*
|
|
12
|
+
* 1. install arbiterdesign@latest as a dev dependency (skipped without a package.json)
|
|
13
|
+
* 2. re-run init from the *installed* copy — the running process is the old version
|
|
14
|
+
* 3. re-pin the publish workflow, if there is one
|
|
15
|
+
*
|
|
16
|
+
* Never touches arbiter.json's settings, DECISIONS.md, or the archive: init leaves those alone.
|
|
17
|
+
*/
|
|
18
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.updateStatus = updateStatus;
|
|
23
|
+
exports.updateNotice = updateNotice;
|
|
24
|
+
exports.update = update;
|
|
25
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
26
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
27
|
+
const node_child_process_1 = require("node:child_process");
|
|
28
|
+
const init_1 = require("./init");
|
|
29
|
+
const publish_1 = require("./publish");
|
|
30
|
+
const store_1 = require("../store");
|
|
31
|
+
/** Offline. Null when this isn't an Arbiter project. */
|
|
32
|
+
function updateStatus(paths) {
|
|
33
|
+
const config = (0, store_1.readConfig)(paths);
|
|
34
|
+
if (!config)
|
|
35
|
+
return null;
|
|
36
|
+
const cli = (0, init_1.selfVersion)();
|
|
37
|
+
const clients = config.client === 'cursor' ? ['cursor'] : config.client === 'claude-code' ? ['claude-code'] : ['claude-code', 'cursor'];
|
|
38
|
+
const file = clients.map(init_1.skillPath).find((f) => node_fs_1.default.existsSync(node_path_1.default.join(paths.root, f))) ?? null;
|
|
39
|
+
if (!file)
|
|
40
|
+
return { cli, skill: null, file: null, stale: false };
|
|
41
|
+
const skill = init_1.SKILL_MARKER.exec(node_fs_1.default.readFileSync(node_path_1.default.join(paths.root, file), 'utf8'))?.[1] ?? null;
|
|
42
|
+
return { cli, skill, file: file.split(node_path_1.default.sep).join('/'), stale: skill !== cli };
|
|
43
|
+
}
|
|
44
|
+
/** What `record --pending` and `rules --pending --json` carry when the skill file is behind. */
|
|
45
|
+
function updateNotice(paths) {
|
|
46
|
+
const s = updateStatus(paths);
|
|
47
|
+
return s?.stale ? { update: { skill: s.skill ?? 'before 0.1.3', cli: s.cli, command: 'npx arbiter update' } } : {};
|
|
48
|
+
}
|
|
49
|
+
async function update(opts = {}) {
|
|
50
|
+
const root = (0, store_1.findRoot)(opts.cwd);
|
|
51
|
+
const paths = (0, store_1.resolvePaths)(root);
|
|
52
|
+
const before = updateStatus(paths);
|
|
53
|
+
if (!before)
|
|
54
|
+
throw new Error('no arbiter.json here — run `npx arbiter init` first');
|
|
55
|
+
const steps = [];
|
|
56
|
+
if (opts.check)
|
|
57
|
+
return { ok: true, before, after: before, steps };
|
|
58
|
+
const done = (step, note) => steps.push({ step, outcome: 'done', note });
|
|
59
|
+
const skip = (step, note) => steps.push({ step, outcome: 'skipped', note });
|
|
60
|
+
const fail = (step, note) => steps.push({ step, outcome: 'failed', note });
|
|
61
|
+
// 1. the package
|
|
62
|
+
let installed = null;
|
|
63
|
+
if (opts.skipInstall)
|
|
64
|
+
skip('package', '--skip-install');
|
|
65
|
+
else if (!node_fs_1.default.existsSync(node_path_1.default.join(root, 'package.json')))
|
|
66
|
+
skip('package', 'no package.json here — the skill is refreshed from this copy');
|
|
67
|
+
else {
|
|
68
|
+
const pm = (0, init_1.detectPm)(root);
|
|
69
|
+
if ((0, init_1.addDevDependency)(root, pm, 'arbiterdesign@latest')) {
|
|
70
|
+
installed = installedCopy(root);
|
|
71
|
+
done('package', installed ? `arbiterdesign ${installed.version} (${pm})` : `installed (${pm})`);
|
|
72
|
+
}
|
|
73
|
+
else
|
|
74
|
+
fail('package', `${pm} could not install arbiterdesign@latest — check the network, then re-run`);
|
|
75
|
+
}
|
|
76
|
+
// 2. the skill — from the copy that was just installed, so a new template lands, not this one's
|
|
77
|
+
try {
|
|
78
|
+
if (installed && installed.version !== (0, init_1.selfVersion)()) {
|
|
79
|
+
(0, node_child_process_1.execFileSync)(process.execPath, [installed.bin, 'init', '--yes', '--skip-install'], { cwd: root, stdio: ['ignore', 'ignore', 'pipe'] });
|
|
80
|
+
done('skill', `refreshed by arbiter ${installed.version}`);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
await (0, init_1.init)({ cwd: root, yes: true, skipInstall: true });
|
|
84
|
+
done('skill', `refreshed by this copy (${(0, init_1.selfVersion)()})`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
fail('skill', `init failed: ${e.message.split('\n')[0]}`);
|
|
89
|
+
}
|
|
90
|
+
// 3. the publish workflow, if publish --on-push wrote one: it pins a version
|
|
91
|
+
const wf = node_path_1.default.join(root, publish_1.WORKFLOW_FILE);
|
|
92
|
+
if (node_fs_1.default.existsSync(wf)) {
|
|
93
|
+
const to = installed?.version ?? (0, init_1.selfVersion)();
|
|
94
|
+
const text = node_fs_1.default.readFileSync(wf, 'utf8');
|
|
95
|
+
const next = text.replace(/arbiterdesign@[^\s'"]+/g, `arbiterdesign@${to}`);
|
|
96
|
+
if (next !== text) {
|
|
97
|
+
node_fs_1.default.writeFileSync(wf, next);
|
|
98
|
+
done('workflow', `${publish_1.WORKFLOW_FILE} → arbiterdesign@${to} (commit it)`);
|
|
99
|
+
}
|
|
100
|
+
else
|
|
101
|
+
skip('workflow', `already arbiterdesign@${to}`);
|
|
102
|
+
}
|
|
103
|
+
const after = updateStatus(paths) ?? before;
|
|
104
|
+
return { ok: steps.every((s) => s.outcome !== 'failed'), before, after, steps };
|
|
105
|
+
}
|
|
106
|
+
/** The package as installed in the host's node_modules, if it's there. */
|
|
107
|
+
function installedCopy(root) {
|
|
108
|
+
const dir = node_path_1.default.join(root, 'node_modules', 'arbiterdesign');
|
|
109
|
+
const pkg = node_path_1.default.join(dir, 'package.json');
|
|
110
|
+
const bin = node_path_1.default.join(dir, 'dist', 'index.js');
|
|
111
|
+
if (!node_fs_1.default.existsSync(pkg) || !node_fs_1.default.existsSync(bin))
|
|
112
|
+
return null;
|
|
113
|
+
return { version: JSON.parse(node_fs_1.default.readFileSync(pkg, 'utf8')).version, bin };
|
|
114
|
+
}
|
package/dist/format.js
CHANGED
|
@@ -229,9 +229,10 @@ function archiveHeader() {
|
|
|
229
229
|
return [
|
|
230
230
|
'# Decision archive',
|
|
231
231
|
'',
|
|
232
|
-
'Every decision ever recorded, in order.
|
|
233
|
-
'
|
|
234
|
-
'
|
|
232
|
+
'Every decision ever recorded, in order. A decision you changed your mind about is superseded,',
|
|
233
|
+
'never rewritten; only `npx arbiter remove` takes an entry out, for a record of something that',
|
|
234
|
+
'never happened. Active rules live in `DECISIONS.md`; this file is for traceability and is never',
|
|
235
|
+
'loaded into agent context.',
|
|
235
236
|
'',
|
|
236
237
|
].join('\n');
|
|
237
238
|
}
|
package/dist/hosted.js
CHANGED
|
@@ -165,6 +165,11 @@ async function publishHosted(paths, serviceUrl, opts = {}) {
|
|
|
165
165
|
let link = readLink(paths);
|
|
166
166
|
let created = false;
|
|
167
167
|
if (!link || link.url !== base) {
|
|
168
|
+
// Automation republishes an existing board; it never creates one. Without this, a repo where
|
|
169
|
+
// hosted.json wasn't committed would mint a fresh orphan board on every push.
|
|
170
|
+
if (process.env.CI && !process.env.ARBITER_CREATE_IN_CI) {
|
|
171
|
+
throw new Error(`no .arbiter/hosted.json for ${base} — publish once from a laptop and commit that file, so CI updates the existing board instead of creating a new one`);
|
|
172
|
+
}
|
|
168
173
|
const admin = opts.admin ?? process.env[exports.ADMIN_ENV];
|
|
169
174
|
const r = await api(`${base}/api/projects`, { method: 'POST', body: JSON.stringify({ name: node_path_1.default.basename(paths.root) }), admin });
|
|
170
175
|
if (r.status === 401)
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,9 @@ const setup_1 = require("./commands/setup");
|
|
|
16
16
|
const rules_1 = require("./commands/rules");
|
|
17
17
|
const init_1 = require("./commands/init");
|
|
18
18
|
const review_1 = require("./commands/review");
|
|
19
|
+
const update_1 = require("./commands/update");
|
|
20
|
+
const remove_1 = require("./commands/remove");
|
|
21
|
+
const autopublish_1 = require("./autopublish");
|
|
19
22
|
const program = new commander_1.Command();
|
|
20
23
|
program
|
|
21
24
|
.name('arbiter')
|
|
@@ -78,6 +81,9 @@ program
|
|
|
78
81
|
result = opts.pending ? (0, record_1.queue)(input, opts) : (0, record_1.record)(input, opts);
|
|
79
82
|
}
|
|
80
83
|
process.stdout.write(JSON.stringify(result.output, null, 2) + '\n');
|
|
84
|
+
// Queueing never reaches the board — work cards are built from judged decisions.
|
|
85
|
+
if (result.exitCode === 0 && !opts.pending)
|
|
86
|
+
await boardUpdated(opts.cwd);
|
|
81
87
|
process.exit(result.exitCode);
|
|
82
88
|
});
|
|
83
89
|
program
|
|
@@ -138,9 +144,11 @@ program
|
|
|
138
144
|
.description('Attach a picture to a piece of work, named as its decisions named it: snapshot "Settings build" --file shot.png')
|
|
139
145
|
.option('--file <image>', 'screenshot to keep beside the work')
|
|
140
146
|
.option('--capture', 'macOS: drag-select a region of the screen')
|
|
141
|
-
.action((work, opts) => {
|
|
147
|
+
.action(async (work, opts) => {
|
|
142
148
|
const result = (0, snapshot_1.snapshotWork)(work, opts);
|
|
143
149
|
process.stdout.write(JSON.stringify(result.output, null, 2) + '\n');
|
|
150
|
+
if (result.exitCode === 0)
|
|
151
|
+
await boardUpdated(opts.cwd);
|
|
144
152
|
process.exit(result.exitCode);
|
|
145
153
|
});
|
|
146
154
|
program
|
|
@@ -155,9 +163,11 @@ program
|
|
|
155
163
|
.option('--by <id>', 'with --state superseded: the candidate that replaced it')
|
|
156
164
|
.option('--keep-others', "approving doesn't supersede sibling directions")
|
|
157
165
|
.option('--author <name>', 'override the author')
|
|
158
|
-
.action((idOrAdd, name, opts) => {
|
|
166
|
+
.action(async (idOrAdd, name, opts) => {
|
|
159
167
|
const result = idOrAdd === 'add' ? (0, candidate_1.addCandidate)(name ?? '', opts) : (0, candidate_1.updateCandidate)(idOrAdd, opts);
|
|
160
168
|
process.stdout.write(JSON.stringify(result.output, null, 2) + '\n');
|
|
169
|
+
if (result.exitCode === 0)
|
|
170
|
+
await boardUpdated(opts.cwd);
|
|
161
171
|
process.exit(result.exitCode);
|
|
162
172
|
});
|
|
163
173
|
program
|
|
@@ -189,12 +199,15 @@ program
|
|
|
189
199
|
});
|
|
190
200
|
program
|
|
191
201
|
.command('publish')
|
|
192
|
-
.description('Put the board online at arbiter.design and print the link. --to <url> for your own hosted Arbiter; --to pages for GitHub Pages (git destination, export, commit, push). Nothing to set up first.
|
|
202
|
+
.description('Put the board online at arbiter.design and print the link. --to <url> for your own hosted Arbiter; --to pages for GitHub Pages (git destination, export, commit, push). Nothing to set up first.')
|
|
193
203
|
.option('--to <url|pages>', 'where to publish: a hosted Arbiter (default arbiter.design), or `pages` for GitHub Pages')
|
|
194
204
|
.option('--admin-token <token>', 'only for a self-hosted Arbiter that gates board creation')
|
|
195
205
|
.option('--no-push', 'GitHub Pages mode: do everything except push')
|
|
206
|
+
.option('--on-push', 'also write a GitHub Actions workflow that republishes on every push, and set its secret')
|
|
207
|
+
.option('--auto', 'republish whenever the record changes — no GitHub, no CI, no repository needed')
|
|
208
|
+
.option('--no-auto', 'stop republishing automatically')
|
|
196
209
|
.action(async (opts) => {
|
|
197
|
-
const r = await (0, publish_1.publish)({ noPush: opts.push === false, to: opts.to, admin: opts.adminToken });
|
|
210
|
+
const r = await (0, publish_1.publish)({ noPush: opts.push === false, to: opts.to, admin: opts.adminToken, onPush: opts.onPush, auto: opts.auto === undefined ? undefined : !!opts.auto });
|
|
198
211
|
const w = Math.max(...r.steps.map((s) => s.step.length));
|
|
199
212
|
for (const s of r.steps)
|
|
200
213
|
process.stdout.write(` ${s.step.padEnd(w)} ${s.outcome}${s.note ? ` — ${s.note}` : ''}\n`);
|
|
@@ -216,6 +229,50 @@ program
|
|
|
216
229
|
.action(async (opts) => {
|
|
217
230
|
await (0, review_1.review)(opts);
|
|
218
231
|
});
|
|
232
|
+
program
|
|
233
|
+
.command('remove [id]')
|
|
234
|
+
.description('Take a record out that was never real: a decision (D-0004), a screen (C-0001), or a picture (--snapshot "<work>"). A rule that is simply over is `record --retire` instead.')
|
|
235
|
+
.option('--snapshot <work>', 'remove the picture attached to a piece of work or a screen, keeping the record')
|
|
236
|
+
.option('--force', 'with a screen: unlink the decisions on it rather than refusing')
|
|
237
|
+
.action(async (id, opts) => {
|
|
238
|
+
const result = opts.snapshot ? (0, remove_1.removeSnapshot)(opts.snapshot, opts) : (0, remove_1.remove)(id ?? '', opts);
|
|
239
|
+
process.stdout.write(JSON.stringify(result.output, null, 2) + '\n');
|
|
240
|
+
if (result.exitCode === 0)
|
|
241
|
+
await boardUpdated(opts.cwd);
|
|
242
|
+
process.exit(result.exitCode);
|
|
243
|
+
});
|
|
244
|
+
program
|
|
245
|
+
.command('unlink <ids...>')
|
|
246
|
+
.description('Detach decisions from the screen they were recorded against. The decisions stay exactly as they are.')
|
|
247
|
+
.action(async (ids, opts) => {
|
|
248
|
+
const result = (0, remove_1.unlink)(ids, opts);
|
|
249
|
+
process.stdout.write(JSON.stringify(result.output, null, 2) + '\n');
|
|
250
|
+
if (result.exitCode === 0)
|
|
251
|
+
await boardUpdated(opts.cwd);
|
|
252
|
+
process.exit(result.exitCode);
|
|
253
|
+
});
|
|
254
|
+
program
|
|
255
|
+
.command('update')
|
|
256
|
+
.description('Bring this project up to the newest Arbiter: install it, refresh the skill file, re-pin the publish workflow. Settings and decisions untouched.')
|
|
257
|
+
.option('--check', 'report whether the skill file is behind the CLI; change nothing')
|
|
258
|
+
.option('--skip-install', 'refresh the skill from this copy without touching package.json')
|
|
259
|
+
.action(async (opts) => {
|
|
260
|
+
const r = await (0, update_1.update)(opts);
|
|
261
|
+
const ver = (v) => v ?? 'before 0.1.3';
|
|
262
|
+
if (opts.check) {
|
|
263
|
+
const s = r.before;
|
|
264
|
+
const line = s.file
|
|
265
|
+
? `${s.file}: ${ver(s.skill)} · cli: ${s.cli} · ${s.stale ? 'behind — run: npx arbiter update' : 'current'}`
|
|
266
|
+
: 'no skill file — run: npx arbiter init';
|
|
267
|
+
process.stdout.write(line + '\n');
|
|
268
|
+
process.exit(s.stale ? 1 : 0);
|
|
269
|
+
}
|
|
270
|
+
const w = Math.max(...r.steps.map((s) => s.step.length));
|
|
271
|
+
for (const s of r.steps)
|
|
272
|
+
process.stdout.write(` ${s.step.padEnd(w)} ${s.outcome}${s.note ? ` — ${s.note}` : ''}\n`);
|
|
273
|
+
process.stdout.write(`\n${r.after.file ?? 'skill'}: ${ver(r.before.skill)} → ${ver(r.after.skill)}${r.ok ? '. Start a new agent session to pick it up.' : ''}\n`);
|
|
274
|
+
process.exit(r.ok ? 0 : 1);
|
|
275
|
+
});
|
|
219
276
|
program
|
|
220
277
|
.command('rules [id]')
|
|
221
278
|
.description('Read decisions. No args: active rules. An id (D-0003): that one in full.')
|
|
@@ -230,6 +287,12 @@ program.parseAsync(process.argv).catch((e) => {
|
|
|
230
287
|
process.stderr.write(`arbiter: ${e.message}\n`);
|
|
231
288
|
process.exit(1);
|
|
232
289
|
});
|
|
290
|
+
/** With `hosted.auto`, the board follows the record. Prints a line when it does, or why it didn't. */
|
|
291
|
+
async function boardUpdated(cwd) {
|
|
292
|
+
const line = await (0, autopublish_1.autoPublish)(cwd);
|
|
293
|
+
if (line)
|
|
294
|
+
process.stdout.write(line + '\n');
|
|
295
|
+
}
|
|
233
296
|
function readStdin() {
|
|
234
297
|
if (process.stdin.isTTY)
|
|
235
298
|
return Promise.resolve('');
|
package/dist/store.js
CHANGED
|
@@ -16,6 +16,7 @@ exports.readActive = readActive;
|
|
|
16
16
|
exports.writeActive = writeActive;
|
|
17
17
|
exports.readArchive = readArchive;
|
|
18
18
|
exports.appendArchive = appendArchive;
|
|
19
|
+
exports.writeArchive = writeArchive;
|
|
19
20
|
exports.readPending = readPending;
|
|
20
21
|
exports.writePending = writePending;
|
|
21
22
|
exports.nextPendingId = nextPendingId;
|
|
@@ -79,6 +80,15 @@ function appendArchive(paths, d) {
|
|
|
79
80
|
const prefix = exists ? '\n' : (0, format_1.archiveHeader)() + '\n';
|
|
80
81
|
node_fs_1.default.appendFileSync(paths.archive, prefix + (0, format_1.formatEntry)(d));
|
|
81
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Rewrites the archive in full. Only `remove` and `unlink` use this: the archive is append-only
|
|
85
|
+
* for judgments — a decision you changed your mind about is superseded, never rewritten — but a
|
|
86
|
+
* record of something that never happened is noise, not history, and has to be able to leave.
|
|
87
|
+
*/
|
|
88
|
+
function writeArchive(paths, decisions) {
|
|
89
|
+
node_fs_1.default.mkdirSync(paths.archiveDir, { recursive: true });
|
|
90
|
+
node_fs_1.default.writeFileSync(paths.archive, (0, format_1.archiveHeader)() + '\n' + decisions.map(format_1.formatEntry).join('\n'));
|
|
91
|
+
}
|
|
82
92
|
function readPending(paths) {
|
|
83
93
|
if (!node_fs_1.default.existsSync(paths.pending))
|
|
84
94
|
return [];
|
package/dist/sweep.js
CHANGED
|
@@ -66,7 +66,7 @@ function targetFiles(root, rule) {
|
|
|
66
66
|
const abs = node_path_1.default.resolve(root, p);
|
|
67
67
|
if (!abs.startsWith(node_path_1.default.resolve(root)) || !node_fs_1.default.existsSync(abs))
|
|
68
68
|
return [];
|
|
69
|
-
return node_fs_1.default.statSync(abs).isFile() ? [
|
|
69
|
+
return node_fs_1.default.statSync(abs).isFile() ? [rel(root, abs)] : walk(abs, root);
|
|
70
70
|
};
|
|
71
71
|
if (rule.paths.length)
|
|
72
72
|
return { files: [...new Set(rule.paths.flatMap(expand))], scanned: 'rule.paths' };
|
|
@@ -75,6 +75,13 @@ function targetFiles(root, rule) {
|
|
|
75
75
|
return { files: expand(scope.target), scanned: 'scope' };
|
|
76
76
|
return { files: walk(root, root), scanned: 'project' };
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* A path relative to the root, always with `/`. Windows' path.relative gives `docs\ref.html`,
|
|
80
|
+
* but excludes and rule.paths are written as globs with `/` — unnormalised, every exclude
|
|
81
|
+
* silently matched nothing there. It's also what gets recorded and published, so one project's
|
|
82
|
+
* violations shouldn't read differently depending on who swept.
|
|
83
|
+
*/
|
|
84
|
+
const rel = (root, abs) => node_path_1.default.relative(root, abs).split(node_path_1.default.sep).join('/');
|
|
78
85
|
function walk(dir, root, out = []) {
|
|
79
86
|
if (out.length >= MAX_FILES)
|
|
80
87
|
return out;
|
|
@@ -93,7 +100,7 @@ function walk(dir, root, out = []) {
|
|
|
93
100
|
walk(node_path_1.default.join(dir, e.name), root, out);
|
|
94
101
|
}
|
|
95
102
|
else if (e.isFile() && SOURCE_EXT.has(node_path_1.default.extname(e.name))) {
|
|
96
|
-
out.push(
|
|
103
|
+
out.push(rel(root, node_path_1.default.join(dir, e.name)));
|
|
97
104
|
}
|
|
98
105
|
}
|
|
99
106
|
return out;
|
package/package.json
CHANGED
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "arbiterdesign",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Records design decisions made during agent-assisted UI work and feeds them back into the agent's context.",
|
|
5
|
-
"homepage": "https://arbiter.design",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/eddie199/arbiter.git"
|
|
9
|
-
},
|
|
10
|
-
"bugs": {
|
|
11
|
-
"url": "https://github.com/eddie199/arbiter/issues"
|
|
12
|
-
},
|
|
13
|
-
"keywords": [
|
|
14
|
-
"design",
|
|
15
|
-
"decisions",
|
|
16
|
-
"claude-code",
|
|
17
|
-
"cursor",
|
|
18
|
-
"agents",
|
|
19
|
-
"ui"
|
|
20
|
-
],
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"bin": {
|
|
23
|
-
"arbiter": "dist/index.js"
|
|
24
|
-
},
|
|
25
|
-
"files": [
|
|
26
|
-
"dist",
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "arbiterdesign",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "Records design decisions made during agent-assisted UI work and feeds them back into the agent's context.",
|
|
5
|
+
"homepage": "https://arbiter.design",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/eddie199/arbiter.git"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/eddie199/arbiter/issues"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"design",
|
|
15
|
+
"decisions",
|
|
16
|
+
"claude-code",
|
|
17
|
+
"cursor",
|
|
18
|
+
"agents",
|
|
19
|
+
"ui"
|
|
20
|
+
],
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"bin": {
|
|
23
|
+
"arbiter": "dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"!dist/test",
|
|
28
|
+
"templates"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc -p tsconfig.json",
|
|
32
|
+
"prepare": "npm run build",
|
|
33
|
+
"test": "node --test \"dist/test/**/*.test.js\""
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=20"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"commander": "^12.1.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^20.14.0",
|
|
43
|
+
"typescript": "^5.5.0"
|
|
44
|
+
}
|
|
45
|
+
}
|