arbiterdesign 0.1.1 → 0.1.3
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 +151 -143
- 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 +87 -2
- package/dist/commands/record.js +7 -1
- package/dist/commands/rules.js +7 -2
- package/dist/commands/setup.js +23 -0
- package/dist/commands/update.js +114 -0
- package/dist/hosted.js +5 -0
- package/dist/index.js +36 -2
- package/dist/sweep.js +9 -2
- package/package.json +45 -44
- package/templates/SKILL.md +403 -348
- 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 -198
- package/dist/test/polish.test.js +0 -130
- package/dist/test/record.test.js +0 -102
- package/dist/test/stages.test.js +0 -188
package/dist/test/record.test.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const node_test_1 = require("node:test");
|
|
7
|
-
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
8
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
10
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
-
const record_1 = require("../commands/record");
|
|
12
|
-
const format_1 = require("../format");
|
|
13
|
-
const store_1 = require("../store");
|
|
14
|
-
const rule = (over = {}) => JSON.stringify({
|
|
15
|
-
decision: 'Destructive actions confirm in a modal, never inline',
|
|
16
|
-
rationale: 'Inline confirms get clicked through.',
|
|
17
|
-
trigger: 'Delete flow used an inline link',
|
|
18
|
-
scope: 'pattern:destructive-confirm',
|
|
19
|
-
class: 'judgment',
|
|
20
|
-
dimension: 'interaction',
|
|
21
|
-
verdict: 'rule',
|
|
22
|
-
...over,
|
|
23
|
-
});
|
|
24
|
-
const tmp = () => node_fs_1.default.mkdtempSync(node_path_1.default.join(node_os_1.default.tmpdir(), 'arbiter-'));
|
|
25
|
-
const opts = (cwd, extra = {}) => ({ cwd, author: 'test', ...extra });
|
|
26
|
-
(0, node_test_1.test)('format round-trips losslessly', () => {
|
|
27
|
-
const d = {
|
|
28
|
-
id: 'D-0001', date: '2026-09-15T10:00:00Z', author: 'Edmond Hua', class: 'judgment', dimension: 'interaction',
|
|
29
|
-
rejected: ['Inline confirm — clicked through', 'Toast with undo — too easy to miss · and this has a dot'],
|
|
30
|
-
decision: 'Use · dots · freely in the statement', trigger: 'A "quoted" trigger: with colons',
|
|
31
|
-
change: 'The confirm · link became a modal', level: 'feature',
|
|
32
|
-
verdict: 'rule', scope: 'file:src/a b/c.tsx', rationale: 'Because **bold** and `code` should survive.',
|
|
33
|
-
supersedes: null, ref: 'https://linear.app/acme/issue/ENG-123', commit: null,
|
|
34
|
-
files: ['src/a b/c.tsx', 'src/d.tsx'], paths: ['src/components', 'src/marketing/Hero.tsx'], expect: { present: ['brand.500'], absent: ['#3B7BE0', 'weird · dot'] }, verified: true, candidate: 'C-0002',
|
|
35
|
-
};
|
|
36
|
-
strict_1.default.deepEqual((0, format_1.parseEntries)((0, format_1.formatEntry)(d)), [d]);
|
|
37
|
-
const d2 = { ...d, id: 'D-0002', supersedes: 'D-0001', commit: 'abc1234', rejected: [], dimension: 'states', ref: null, files: [], paths: [], expect: null, verified: null, candidate: null };
|
|
38
|
-
strict_1.default.deepEqual((0, format_1.parseEntries)((0, format_1.formatEntry)(d) + '\n' + (0, format_1.formatEntry)(d2)), [d, d2]);
|
|
39
|
-
});
|
|
40
|
-
(0, node_test_1.test)('rule goes to both files; accept and fix go to archive only', () => {
|
|
41
|
-
const cwd = tmp();
|
|
42
|
-
strict_1.default.equal((0, record_1.record)(rule(), opts(cwd)).exitCode, 0);
|
|
43
|
-
strict_1.default.equal((0, record_1.record)(rule({ verdict: 'accept', scope: 'file:x.tsx' }), opts(cwd)).exitCode, 0);
|
|
44
|
-
strict_1.default.equal((0, record_1.record)(rule({ verdict: 'fix', scope: 'file:y.tsx' }), opts(cwd)).exitCode, 0);
|
|
45
|
-
const p = (0, store_1.resolvePaths)(cwd);
|
|
46
|
-
strict_1.default.equal((0, store_1.readActive)(p).length, 1);
|
|
47
|
-
strict_1.default.equal((0, store_1.readArchive)(p).length, 3);
|
|
48
|
-
strict_1.default.deepEqual((0, store_1.readArchive)(p).map((d) => d.id), ['D-0001', 'D-0002', 'D-0003']);
|
|
49
|
-
});
|
|
50
|
-
(0, node_test_1.test)('overlap blocks the write and offers supersedes', () => {
|
|
51
|
-
const cwd = tmp();
|
|
52
|
-
(0, record_1.record)(rule(), opts(cwd));
|
|
53
|
-
const r = (0, record_1.record)(rule({ decision: 'Destructive confirms name the thing being deleted' }), opts(cwd));
|
|
54
|
-
strict_1.default.equal(r.exitCode, 2);
|
|
55
|
-
const overlaps = r.output.overlaps;
|
|
56
|
-
strict_1.default.deepEqual(overlaps.map((o) => [o.id, o.confidence]), [['D-0001', 'exact']]);
|
|
57
|
-
strict_1.default.equal((0, store_1.readArchive)((0, store_1.resolvePaths)(cwd)).length, 1, 'nothing written');
|
|
58
|
-
const r2 = (0, record_1.record)(rule({ decision: 'Destructive confirms name the thing being deleted' }), opts(cwd, { supersedes: 'D-0001' }));
|
|
59
|
-
strict_1.default.equal(r2.exitCode, 0);
|
|
60
|
-
const active = (0, store_1.readActive)((0, store_1.resolvePaths)(cwd));
|
|
61
|
-
strict_1.default.deepEqual(active.map((d) => [d.id, d.supersedes]), [['D-0002', 'D-0001']]);
|
|
62
|
-
strict_1.default.equal((0, store_1.readArchive)((0, store_1.resolvePaths)(cwd)).length, 2, 'old rule stays in archive');
|
|
63
|
-
});
|
|
64
|
-
(0, node_test_1.test)('fuzzy overlap is marked possible; --keep-both bypasses', () => {
|
|
65
|
-
const cwd = tmp();
|
|
66
|
-
(0, record_1.record)(rule({ decision: 'Interactive elements use brand tokens, never raw hex', scope: 'global' }), opts(cwd));
|
|
67
|
-
const r = (0, record_1.record)(rule({ decision: 'Text colours come from tokens, not raw hex', scope: 'global' }), opts(cwd));
|
|
68
|
-
strict_1.default.equal(r.exitCode, 2);
|
|
69
|
-
strict_1.default.equal(r.output.overlaps[0].confidence, 'possible');
|
|
70
|
-
strict_1.default.equal((0, record_1.record)(rule({ decision: 'Text colours come from tokens, not raw hex', scope: 'global' }), opts(cwd, { keepBoth: true })).exitCode, 0);
|
|
71
|
-
strict_1.default.equal((0, store_1.readActive)((0, store_1.resolvePaths)(cwd)).length, 2);
|
|
72
|
-
});
|
|
73
|
-
(0, node_test_1.test)('cap refuses the 41st rule', () => {
|
|
74
|
-
const cwd = tmp();
|
|
75
|
-
for (let i = 0; i < 40; i++) {
|
|
76
|
-
strict_1.default.equal((0, record_1.record)(rule({ decision: `Rule number ${i} about widget${i}`, scope: `pattern:p${i}` }), opts(cwd, { keepBoth: true })).exitCode, 0, `rule ${i}`);
|
|
77
|
-
}
|
|
78
|
-
const r = (0, record_1.record)(rule({ decision: 'One too many', scope: 'pattern:extra' }), opts(cwd));
|
|
79
|
-
strict_1.default.equal(r.exitCode, 3);
|
|
80
|
-
strict_1.default.equal((0, store_1.readActive)((0, store_1.resolvePaths)(cwd)).length, 40);
|
|
81
|
-
});
|
|
82
|
-
(0, node_test_1.test)('invalid input is rejected with field-level errors', () => {
|
|
83
|
-
const r = (0, record_1.record)('{"decision":"x","verdict":"maybe"}', opts(tmp()));
|
|
84
|
-
strict_1.default.equal(r.exitCode, 1);
|
|
85
|
-
strict_1.default.ok(r.output.errors.some((e) => e.includes('verdict')));
|
|
86
|
-
strict_1.default.equal((0, record_1.record)('not json', opts(tmp())).exitCode, 1);
|
|
87
|
-
});
|
|
88
|
-
(0, node_test_1.test)('DECISIONS.md groups by dimension and still round-trips', () => {
|
|
89
|
-
const cwd = tmp();
|
|
90
|
-
(0, record_1.record)(rule({ decision: 'Modal for destructive confirms', dimension: 'interaction', scope: 'pattern:destructive-confirm', rejected: ['Inline confirm — clicked through'] }), opts(cwd));
|
|
91
|
-
(0, record_1.record)(rule({ decision: 'Empty states are one line and one action', dimension: 'states', scope: 'pattern:empty-state' }), opts(cwd));
|
|
92
|
-
(0, record_1.record)(rule({ decision: 'Page titles are sentence case', dimension: 'content', scope: 'global' }), opts(cwd));
|
|
93
|
-
(0, record_1.record)(rule({ decision: 'Sheets put primary action bottom-right', dimension: 'interaction', scope: 'pattern:sheet-actions' }), opts(cwd));
|
|
94
|
-
const p = (0, store_1.resolvePaths)(cwd);
|
|
95
|
-
const md = node_fs_1.default.readFileSync(p.decisions, 'utf8');
|
|
96
|
-
const headings = md.split('\n').filter((l) => /^## /.test(l));
|
|
97
|
-
strict_1.default.deepEqual(headings, ['## Interaction', '## States', '## Content']);
|
|
98
|
-
const active = (0, store_1.readActive)(p);
|
|
99
|
-
strict_1.default.deepEqual(active.map((d) => d.id), ['D-0001', 'D-0004', 'D-0002', 'D-0003']);
|
|
100
|
-
strict_1.default.deepEqual(active[0].rejected, ['Inline confirm — clicked through']);
|
|
101
|
-
strict_1.default.deepEqual((0, store_1.readArchive)(p).map((d) => d.id), ['D-0001', 'D-0002', 'D-0003', 'D-0004']);
|
|
102
|
-
});
|
package/dist/test/stages.test.js
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const node_test_1 = require("node:test");
|
|
7
|
-
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
8
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
10
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
-
const node_child_process_1 = require("node:child_process");
|
|
12
|
-
const record_1 = require("../commands/record");
|
|
13
|
-
const sweep_1 = require("../commands/sweep");
|
|
14
|
-
const verify_1 = require("../commands/verify");
|
|
15
|
-
const candidate_1 = require("../commands/candidate");
|
|
16
|
-
const board_1 = require("../commands/board");
|
|
17
|
-
const candidates_1 = require("../candidates");
|
|
18
|
-
const store_1 = require("../store");
|
|
19
|
-
const findings_1 = require("../findings");
|
|
20
|
-
const tmp = () => node_fs_1.default.mkdtempSync(node_path_1.default.join(node_os_1.default.tmpdir(), 'arbiter-stages-'));
|
|
21
|
-
const write = (cwd, rel, text) => {
|
|
22
|
-
node_fs_1.default.mkdirSync(node_path_1.default.join(cwd, node_path_1.default.dirname(rel)), { recursive: true });
|
|
23
|
-
node_fs_1.default.writeFileSync(node_path_1.default.join(cwd, rel), text);
|
|
24
|
-
};
|
|
25
|
-
const mech = (over = {}) => JSON.stringify({
|
|
26
|
-
decision: 'Interactive elements use brand tokens, never raw hex',
|
|
27
|
-
rationale: 'Raw hex drifts.',
|
|
28
|
-
trigger: 'Button build',
|
|
29
|
-
scope: 'global',
|
|
30
|
-
dimension: 'visual',
|
|
31
|
-
class: 'mechanical',
|
|
32
|
-
verdict: 'rule',
|
|
33
|
-
files: ['src/Button.tsx'],
|
|
34
|
-
expect: { present: ['brand-500'], absent: ['#3B7BE0'] },
|
|
35
|
-
...over,
|
|
36
|
-
});
|
|
37
|
-
(0, node_test_1.test)('stage 2: contradicted claims are refused; verified once true', () => {
|
|
38
|
-
const cwd = tmp();
|
|
39
|
-
const o = { cwd, author: 'test' };
|
|
40
|
-
write(cwd, 'src/Button.tsx', 'const c = "#3B7BE0";');
|
|
41
|
-
const r = (0, record_1.record)(mech(), o);
|
|
42
|
-
strict_1.default.equal(r.exitCode, 4);
|
|
43
|
-
strict_1.default.equal((0, store_1.readArchive)((0, store_1.resolvePaths)(cwd)).length, 0);
|
|
44
|
-
strict_1.default.equal(r.output.failed.length, 2);
|
|
45
|
-
strict_1.default.equal((0, record_1.record)(mech(), { ...o, unverified: true }).exitCode, 0, '--unverified records anyway');
|
|
46
|
-
strict_1.default.equal((0, store_1.readActive)((0, store_1.resolvePaths)(cwd))[0].verified, false);
|
|
47
|
-
write(cwd, 'src/Button.tsx', 'const c = "brand-500";');
|
|
48
|
-
const ok = (0, record_1.record)(mech({ scope: 'pattern:buttons' }), { ...o, keepBoth: true });
|
|
49
|
-
strict_1.default.equal(ok.exitCode, 0);
|
|
50
|
-
strict_1.default.equal(ok.output.verified, true);
|
|
51
|
-
strict_1.default.equal((0, verify_1.verifyCommand)(undefined, { cwd }).ok, true, 'both rules hold now the file is fixed');
|
|
52
|
-
write(cwd, 'src/Button.tsx', 'const c = "#3B7BE0"; // regressed');
|
|
53
|
-
strict_1.default.equal((0, verify_1.verifyCommand)(undefined, { cwd }).ok, false, 're-check catches a regression');
|
|
54
|
-
});
|
|
55
|
-
(0, node_test_1.test)('stage 2: accept is never verified; fix is', () => {
|
|
56
|
-
const cwd = tmp();
|
|
57
|
-
const o = { cwd, author: 'test' };
|
|
58
|
-
write(cwd, 'src/Hero.tsx', 'bg: "#0A0A0A"');
|
|
59
|
-
const a = (0, record_1.record)(mech({ verdict: 'accept', files: ['src/Hero.tsx'], expect: { absent: ['#0A0A0A'] } }), o);
|
|
60
|
-
strict_1.default.equal(a.exitCode, 0);
|
|
61
|
-
strict_1.default.equal(a.output.verified, null);
|
|
62
|
-
const f = (0, record_1.record)(mech({ verdict: 'fix', files: ['src/Hero.tsx'], expect: { absent: ['#0A0A0A'] } }), o);
|
|
63
|
-
strict_1.default.equal(f.exitCode, 4);
|
|
64
|
-
});
|
|
65
|
-
(0, node_test_1.test)('stage 2: findings adapter parses ESLint and flat shapes and queues them', () => {
|
|
66
|
-
const eslint = [{ filePath: '/p/src/A.tsx', messages: [{ ruleId: 'x/no-hex', line: 3, message: 'Raw hex', suggestion: 'Use token' }, { message: 'Other' }] }];
|
|
67
|
-
const flat = { findings: [{ file: 'src/B.tsx', rule: 'r', message: 'm' }, { path: 'src/C.css', description: 'd', line: 9 }, { nope: true }] };
|
|
68
|
-
strict_1.default.equal((0, findings_1.parseFindings)(eslint).length, 2);
|
|
69
|
-
strict_1.default.equal((0, findings_1.parseFindings)(flat).length, 2);
|
|
70
|
-
strict_1.default.equal((0, findings_1.parseFindings)(eslint)[0].suggestion, 'Use token');
|
|
71
|
-
const cwd = tmp();
|
|
72
|
-
write(cwd, 'findings.json', JSON.stringify(flat));
|
|
73
|
-
const r = (0, record_1.queueFindings)('findings.json', { cwd, author: 'test', tool: 'lint' });
|
|
74
|
-
strict_1.default.equal(r.output.queued, 2);
|
|
75
|
-
strict_1.default.equal((0, record_1.queueFindings)('findings.json', { cwd, author: 'test', tool: 'lint' }).output.skippedDuplicates, 2);
|
|
76
|
-
const p = (0, store_1.readPending)((0, store_1.resolvePaths)(cwd));
|
|
77
|
-
strict_1.default.equal(p.length, 2);
|
|
78
|
-
strict_1.default.equal(p[0].scope, 'file:src/B.tsx');
|
|
79
|
-
strict_1.default.equal(p[0].class, 'mechanical');
|
|
80
|
-
});
|
|
81
|
-
(0, node_test_1.test)('stage 3: sweep finds violations, skips docs and node_modules, queues per file', () => {
|
|
82
|
-
const cwd = tmp();
|
|
83
|
-
const o = { cwd, author: 'test' };
|
|
84
|
-
write(cwd, 'src/Button.tsx', 'brand-500');
|
|
85
|
-
write(cwd, 'src/Badge.tsx', 'x = "#3B7BE0"');
|
|
86
|
-
write(cwd, 'src/Hero.tsx', 'a = "#3B7BE0"; b = "#3B7BE0"');
|
|
87
|
-
write(cwd, 'node_modules/lib/index.js', '"#3B7BE0"');
|
|
88
|
-
write(cwd, 'README.md', '#3B7BE0');
|
|
89
|
-
const r = (0, record_1.record)(mech(), o);
|
|
90
|
-
strict_1.default.equal(r.exitCode, 0);
|
|
91
|
-
// Counted per line: Hero's two hits on one line are one violation.
|
|
92
|
-
strict_1.default.deepEqual(r.output.sweep.violations, 2);
|
|
93
|
-
strict_1.default.deepEqual(r.output.sweep.files, 2);
|
|
94
|
-
const s = (0, sweep_1.sweepCommand)('D-0001', { cwd, queue: true, author: 'test' });
|
|
95
|
-
strict_1.default.equal(s.result.violations.length, 2);
|
|
96
|
-
strict_1.default.deepEqual(s.queued, ['P-0001', 'P-0002']);
|
|
97
|
-
strict_1.default.equal((0, sweep_1.sweepCommand)('D-0001', { cwd, queue: true, author: 'test' }).queued.length, 0, 'no duplicate queue');
|
|
98
|
-
// Confirm one file as an exception: an accept, unverified by design.
|
|
99
|
-
const acc = (0, record_1.judge)('P-0001', { cwd, author: 'test', as: 'accept' });
|
|
100
|
-
strict_1.default.equal(acc.exitCode, 0);
|
|
101
|
-
strict_1.default.equal(acc.output.verified, null);
|
|
102
|
-
});
|
|
103
|
-
(0, node_test_1.test)('stage 3: judgment rules cannot sweep', () => {
|
|
104
|
-
const cwd = tmp();
|
|
105
|
-
(0, record_1.record)(mech({ class: 'judgment', files: [], expect: null }), { cwd, author: 'test' });
|
|
106
|
-
const s = (0, sweep_1.sweepCommand)('D-0001', { cwd });
|
|
107
|
-
strict_1.default.equal(s.result.sweepable, false);
|
|
108
|
-
});
|
|
109
|
-
(0, node_test_1.test)('stage 4: candidates round-trip; approve supersedes siblings with reason', () => {
|
|
110
|
-
const cwd = tmp();
|
|
111
|
-
const o = { cwd, author: 'test' };
|
|
112
|
-
const a = (0, candidate_1.addCandidate)('Settings — single page', { ...o, feature: 'settings', notes: 'first pass' });
|
|
113
|
-
const b = (0, candidate_1.addCandidate)('Settings — tabs', { ...o, feature: 'settings' });
|
|
114
|
-
const c = (0, candidate_1.addCandidate)('Billing', { ...o, feature: 'billing' });
|
|
115
|
-
strict_1.default.deepEqual([a.output.id, b.output.id, c.output.id], ['C-0001', 'C-0002', 'C-0003']);
|
|
116
|
-
(0, record_1.queue)(mech({ class: 'judgment', files: [], expect: null, scope: 'pattern:settings-layout', dimension: 'structure' }), { ...o, candidate: 'C-0001' });
|
|
117
|
-
const md = node_fs_1.default.readFileSync(node_path_1.default.join(cwd, '.arbiter/candidates/C-0001.md'), 'utf8');
|
|
118
|
-
strict_1.default.ok(md.includes('**P-0001**'), 'candidate page lists linked pending decision');
|
|
119
|
-
const up = (0, candidate_1.updateCandidate)('C-0001', { ...o, state: 'approved', why: 'tabs hid the danger zone' });
|
|
120
|
-
strict_1.default.deepEqual(up.output.superseded, ['C-0002']);
|
|
121
|
-
const all = (0, candidates_1.readCandidates)((0, store_1.resolvePaths)(cwd));
|
|
122
|
-
const tabs = all.find((x) => x.id === 'C-0002');
|
|
123
|
-
strict_1.default.equal(tabs.state, 'superseded');
|
|
124
|
-
strict_1.default.equal(tabs.supersededBy, 'C-0001');
|
|
125
|
-
strict_1.default.equal(tabs.reason, 'tabs hid the danger zone');
|
|
126
|
-
strict_1.default.equal(all.find((x) => x.id === 'C-0003').state, 'generated', 'other feature untouched');
|
|
127
|
-
for (const cand of all)
|
|
128
|
-
strict_1.default.deepEqual((0, candidates_1.parseCandidate)((0, candidates_1.formatCandidate)(cand, [])), cand);
|
|
129
|
-
strict_1.default.ok((0, board_1.board)({ cwd }).includes('superseded → C-0001'));
|
|
130
|
-
strict_1.default.equal((0, candidate_1.updateCandidate)('C-0003', { ...o, state: 'superseded' }).exitCode, 1, 'superseded needs --by');
|
|
131
|
-
});
|
|
132
|
-
(0, node_test_1.test)('stage 5: git destination writes index, commits candidate files only, links to GitHub', () => {
|
|
133
|
-
const cwd = tmp();
|
|
134
|
-
const git = (...a) => (0, node_child_process_1.execFileSync)('git', a, { cwd, stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim();
|
|
135
|
-
git('init', '-q', '-b', 'main');
|
|
136
|
-
git('config', 'user.email', 't@t');
|
|
137
|
-
git('config', 'user.name', 'T');
|
|
138
|
-
git('remote', 'add', 'origin', 'https://github.com/acme/app.git');
|
|
139
|
-
write(cwd, 'src/unrelated.ts', 'x');
|
|
140
|
-
git('add', '-A');
|
|
141
|
-
git('commit', '-qm', 'init');
|
|
142
|
-
write(cwd, 'src/unrelated.ts', 'y — uncommitted, must stay uncommitted');
|
|
143
|
-
(0, store_1.writeConfig)((0, store_1.resolvePaths)(cwd), { version: 1, destination: 'git', author: 'test' });
|
|
144
|
-
const r = (0, candidate_1.addCandidate)('Billing v1', { cwd, feature: 'billing' });
|
|
145
|
-
strict_1.default.equal(r.output.destination, 'git');
|
|
146
|
-
strict_1.default.ok(r.output.committed);
|
|
147
|
-
strict_1.default.deepEqual(r.output.links, ['https://github.com/acme/app/blob/main/.arbiter/candidates/C-0001.md']);
|
|
148
|
-
strict_1.default.ok(node_fs_1.default.existsSync(node_path_1.default.join(cwd, 'CANDIDATES.md')));
|
|
149
|
-
strict_1.default.equal(r.output.pages, 'https://acme.github.io/app/arbiter/');
|
|
150
|
-
strict_1.default.ok(node_fs_1.default.existsSync(node_path_1.default.join(cwd, 'docs/arbiter/index.html')), 'board page exported for GitHub Pages');
|
|
151
|
-
strict_1.default.ok(git('show', '--stat', '--oneline', 'HEAD').includes('docs/arbiter/index.html'), 'and committed');
|
|
152
|
-
strict_1.default.ok(git('log', '-1', '--pretty=%s').startsWith('arbiter: add C-0001'));
|
|
153
|
-
strict_1.default.equal(git('status', '--porcelain', 'src/'), 'M src/unrelated.ts', 'host changes never swept into the commit');
|
|
154
|
-
const again = (0, candidate_1.updateCandidate)('C-0001', { cwd, notes: 'unchanged state' });
|
|
155
|
-
strict_1.default.ok(again.output.committed, 'edits commit too');
|
|
156
|
-
});
|
|
157
|
-
(0, node_test_1.test)('stage 5: local destination commits nothing', () => {
|
|
158
|
-
const cwd = tmp();
|
|
159
|
-
const r = (0, candidate_1.addCandidate)('X', { cwd, author: 'test' });
|
|
160
|
-
strict_1.default.equal(r.output.destination, 'local');
|
|
161
|
-
strict_1.default.equal(r.output.committed, undefined);
|
|
162
|
-
strict_1.default.ok(!node_fs_1.default.existsSync(node_path_1.default.join(cwd, 'CANDIDATES.md')));
|
|
163
|
-
});
|
|
164
|
-
(0, node_test_1.test)('sweep: rule.files narrows the scan; config excludes apply; globs match', () => {
|
|
165
|
-
const cwd = tmp();
|
|
166
|
-
const o = { cwd, author: 'test' };
|
|
167
|
-
write(cwd, 'app/components/A.tsx', '"#3B7BE0"');
|
|
168
|
-
write(cwd, 'app/globals.css', '--brand: #3B7BE0;');
|
|
169
|
-
write(cwd, 'docs/ref.html', '#3B7BE0');
|
|
170
|
-
write(cwd, 'design-reference/x/y.html', '#3B7BE0');
|
|
171
|
-
write(cwd, 'arbiter.json', JSON.stringify({ version: 1, destination: 'local', sweep: { exclude: ['app/globals.css', 'docs/**', 'design-reference/**'] } }));
|
|
172
|
-
const wide = (0, record_1.record)(mech({ files: [], expect: { absent: ['#3B7BE0'] } }), o);
|
|
173
|
-
strict_1.default.equal(wide.output.sweep.files, 1, 'excludes removed three of four');
|
|
174
|
-
const narrow = (0, record_1.record)(mech({ scope: 'pattern:components', files: [], paths: ['app/components'], expect: { absent: ['#3B7BE0'] } }), { ...o, keepBoth: true });
|
|
175
|
-
const s = (0, sweep_1.sweepCommand)(narrow.output.id, { cwd });
|
|
176
|
-
strict_1.default.equal(s.result.scanned, 'rule.paths');
|
|
177
|
-
strict_1.default.equal(s.result.filesScanned, 1);
|
|
178
|
-
});
|
|
179
|
-
(0, node_test_1.test)('overlap: generic UI nouns and other dimensions do not trigger possible matches', () => {
|
|
180
|
-
const cwd = tmp();
|
|
181
|
-
const o = { cwd, author: 'test' };
|
|
182
|
-
(0, record_1.record)(mech({ class: 'judgment', files: [], expect: null, decision: 'Audit run button shows a spinner while the scan is running', dimension: 'states', scope: 'pattern:audit-run' }), o);
|
|
183
|
-
const r = (0, record_1.record)(mech({ class: 'judgment', files: [], expect: null, decision: 'Audit empty state offers a Run first audit button', dimension: 'states', scope: 'pattern:audit-empty' }), o);
|
|
184
|
-
strict_1.default.equal(r.exitCode, 0, 'shared: audit, run, button, state — but button/run/state are generic and audit alone is not enough');
|
|
185
|
-
write(cwd, 'arbiter.json', JSON.stringify({ version: 1, destination: 'local', overlap: { ignore: ['spinner'] } }));
|
|
186
|
-
const r2 = (0, record_1.record)(mech({ class: 'judgment', files: [], expect: null, decision: 'Journeys board shows a spinner while journeys load', dimension: 'interaction', scope: 'pattern:board-loading' }), o);
|
|
187
|
-
strict_1.default.equal(r2.exitCode, 0, 'different dimension never matches on wording');
|
|
188
|
-
});
|