arbiterdesign 0.1.4 → 0.1.7
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 +457 -115
- package/dist/commands/export.js +9 -6
- package/dist/commands/init.js +24 -6
- package/dist/commands/publish.js +12 -1
- package/dist/commands/pull.js +25 -4
- package/dist/commands/record.js +164 -14
- package/dist/commands/remove.js +17 -1
- package/dist/commands/request.js +123 -0
- package/dist/commands/review.js +95 -9
- package/dist/commands/rules.js +76 -9
- package/dist/commands/setup.js +39 -2
- package/dist/commands/snapshot.js +12 -5
- package/dist/commands/sweep.js +3 -0
- package/dist/findings.js +10 -1
- package/dist/format.js +42 -22
- package/dist/hosted.js +60 -13
- package/dist/index.js +25 -8
- package/dist/pictures.js +52 -0
- package/dist/requests.js +194 -0
- package/dist/schema.js +29 -2
- package/dist/store.js +9 -0
- package/package.json +1 -1
- package/templates/SKILL.md +362 -35
- package/templates/review.html +127 -6
package/dist/schema.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* nowhere to live.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.CANDIDATE_ID = exports.PENDING_ID = exports.DECISION_ID = exports.ID_PATTERN = exports.FIELDS = exports.DIMENSIONS = exports.SCOPE_KINDS = exports.VERDICTS = exports.LEVELS = exports.CLASSES = void 0;
|
|
9
|
+
exports.CANDIDATE_ID = exports.PENDING_ID = exports.DECISION_ID = exports.ID_PATTERN = exports.FIELDS = exports.CALLS = exports.DIMENSIONS = exports.SCOPE_KINDS = exports.VERDICTS = exports.LEVELS = exports.CLASSES = void 0;
|
|
10
10
|
exports.validateInput = validateInput;
|
|
11
11
|
exports.parseScope = parseScope;
|
|
12
12
|
exports.CLASSES = ['mechanical', 'judgment'];
|
|
@@ -21,6 +21,13 @@ exports.VERDICTS = ['fix', 'accept', 'rule', 'retire'];
|
|
|
21
21
|
exports.SCOPE_KINDS = ['global', 'file', 'pattern'];
|
|
22
22
|
/** What the decision is about. Fixed order — DECISIONS.md groups by it in this order. */
|
|
23
23
|
exports.DIMENSIONS = ['structure', 'interaction', 'states', 'content', 'visual', 'motion', 'access'];
|
|
24
|
+
/**
|
|
25
|
+
* Who made the call. What lets a real choice be told from the agent's habit:
|
|
26
|
+
* asked the user asked for it
|
|
27
|
+
* corrected the user changed what the agent did — what they rejected is on record
|
|
28
|
+
* agent the agent weighed real options and picked one
|
|
29
|
+
*/
|
|
30
|
+
exports.CALLS = ['asked', 'corrected', 'agent'];
|
|
24
31
|
/** Fields in file order. Also the order they're serialized in. */
|
|
25
32
|
exports.FIELDS = [
|
|
26
33
|
'id',
|
|
@@ -44,6 +51,9 @@ exports.FIELDS = [
|
|
|
44
51
|
'expect',
|
|
45
52
|
'verified',
|
|
46
53
|
'candidate',
|
|
54
|
+
'against',
|
|
55
|
+
'call',
|
|
56
|
+
'reworded',
|
|
47
57
|
];
|
|
48
58
|
exports.ID_PATTERN = /^[DP]-\d{4,}$/;
|
|
49
59
|
exports.DECISION_ID = /^D-\d{4,}$/;
|
|
@@ -86,6 +96,7 @@ function validateInput(raw, options = {}) {
|
|
|
86
96
|
const commit = line('commit', false);
|
|
87
97
|
const date = line('date', false);
|
|
88
98
|
const ref = line('ref', false);
|
|
99
|
+
const call = line('call', false);
|
|
89
100
|
const supersedesRaw = obj.supersedes;
|
|
90
101
|
if (cls !== undefined && !exports.CLASSES.includes(cls)) {
|
|
91
102
|
errors.push(`class must be one of ${exports.CLASSES.join(' | ')}`);
|
|
@@ -99,6 +110,9 @@ function validateInput(raw, options = {}) {
|
|
|
99
110
|
if (level !== undefined && !exports.LEVELS.includes(level)) {
|
|
100
111
|
errors.push(`level must be one of ${exports.LEVELS.join(' | ')}`);
|
|
101
112
|
}
|
|
113
|
+
if (call !== undefined && !exports.CALLS.includes(call)) {
|
|
114
|
+
errors.push(`call must be one of ${exports.CALLS.join(' | ')}`);
|
|
115
|
+
}
|
|
102
116
|
if (scope !== undefined && !SCOPE_PATTERN.test(scope)) {
|
|
103
117
|
errors.push('scope must be `global`, `file:<path>`, or `pattern:<name>`');
|
|
104
118
|
}
|
|
@@ -193,8 +207,19 @@ function validateInput(raw, options = {}) {
|
|
|
193
207
|
}
|
|
194
208
|
if (verdict === 'retire' && !supersedes)
|
|
195
209
|
errors.push('retire needs supersedes: the rule being retired');
|
|
210
|
+
let against;
|
|
211
|
+
if (obj.against !== undefined) {
|
|
212
|
+
if (obj.against === null || obj.against === '')
|
|
213
|
+
against = null;
|
|
214
|
+
else if (typeof obj.against !== 'string' || !exports.DECISION_ID.test(obj.against.trim()))
|
|
215
|
+
errors.push('against must be a rule id like D-0011, or null');
|
|
216
|
+
else
|
|
217
|
+
against = obj.against.trim();
|
|
218
|
+
}
|
|
219
|
+
if (against && verdict === 'retire')
|
|
220
|
+
errors.push('against does not apply to a retire');
|
|
196
221
|
for (const key of Object.keys(obj)) {
|
|
197
|
-
if (!exports.FIELDS.includes(key) || key === 'verified' || key === 'id')
|
|
222
|
+
if (!exports.FIELDS.includes(key) || key === 'verified' || key === 'id' || key === 'reworded')
|
|
198
223
|
errors.push(`unknown field: ${key}`);
|
|
199
224
|
}
|
|
200
225
|
if (errors.length)
|
|
@@ -221,6 +246,8 @@ function validateInput(raw, options = {}) {
|
|
|
221
246
|
...(date !== undefined && { date }),
|
|
222
247
|
...(supersedes !== undefined && { supersedes }),
|
|
223
248
|
...(ref !== undefined && { ref }),
|
|
249
|
+
...(against !== undefined && { against }),
|
|
250
|
+
...(call !== undefined && { call: call }),
|
|
224
251
|
},
|
|
225
252
|
};
|
|
226
253
|
}
|
package/dist/store.js
CHANGED
|
@@ -23,8 +23,10 @@ exports.nextPendingId = nextPendingId;
|
|
|
23
23
|
exports.nextId = nextId;
|
|
24
24
|
exports.currentCommit = currentCommit;
|
|
25
25
|
exports.gitUserName = gitUserName;
|
|
26
|
+
exports.currentAuthor = currentAuthor;
|
|
26
27
|
exports.now = now;
|
|
27
28
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
29
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
28
30
|
const node_path_1 = __importDefault(require("node:path"));
|
|
29
31
|
const node_child_process_1 = require("node:child_process");
|
|
30
32
|
const format_1 = require("./format");
|
|
@@ -137,6 +139,13 @@ function gitUserName(root) {
|
|
|
137
139
|
return null;
|
|
138
140
|
}
|
|
139
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Whoever is at the keyboard. arbiter.json's author is committed, so in a shared repo it names
|
|
144
|
+
* whoever ran init — it's the fallback for a machine with no git identity, not the default.
|
|
145
|
+
*/
|
|
146
|
+
function currentAuthor(root) {
|
|
147
|
+
return gitUserName(root) ?? readConfig(resolvePaths(root))?.author ?? node_os_1.default.userInfo().username;
|
|
148
|
+
}
|
|
140
149
|
/** Timestamp without milliseconds: 2026-09-15T14:32:10Z */
|
|
141
150
|
function now() {
|
|
142
151
|
return new Date().toISOString().replace(/\.\d{3}Z$/, 'Z');
|
package/package.json
CHANGED