geneseed 5.0.3 → 5.1.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/CHANGELOG.md +83 -0
- package/README.md +3 -3
- package/SHIPPED.md +2 -2
- package/adapters/claude-code/README.md +5 -1
- package/adapters/openclaude/README.md +3 -1
- package/adapters/opencode/plugins/geneseed-workflow.js +1 -1
- package/adapters/opencode/workflows/_runtime.js +1 -1
- package/bin/geneseed-cli.mjs +3 -0
- package/bin/geneseed-hook.mjs +10 -2
- package/docs/PRD.md +1 -1
- package/docs/README.md +4 -1
- package/docs/concepts/enforcement-table.md +1 -1
- package/docs/concepts/exclusions.md +1 -1
- package/docs/concepts/factories.md +203 -0
- package/docs/concepts/hooks.md +1 -1
- package/docs/concepts/host-matrix.md +1 -0
- package/docs/concepts/loop-gates.md +6 -0
- package/docs/concepts/loops.md +1 -0
- package/docs/concepts/rules.md +1 -1
- package/docs/concepts/shared-tier.md +14 -0
- package/docs/extending.md +5 -1
- package/docs/guides/autostart.md +2 -0
- package/docs/guides/migrate.md +1 -1
- package/docs/guides/run-a-factory.md +116 -0
- package/docs/guides/set-up-ownership.md +1 -0
- package/docs/guides/upgrade-to-5.md +2 -2
- package/docs/reference/factory-actions.md +22 -0
- package/docs/reference/loop-actions.md +1 -1
- package/docs/reference/plugin-activity.md +1 -1
- package/docs/web-ui.md +47 -2
- package/harness.config.json +1 -1
- package/js/README.md +21 -2
- package/js/build/args.mjs +44 -12
- package/js/build/emit-claude.mjs +3 -0
- package/js/build/emit-opencode.mjs +4 -0
- package/js/build/retired-skills.mjs +158 -0
- package/js/build/source.mjs +41 -2
- package/js/cli-table.json +193 -3
- package/js/factory/cli.mjs +194 -0
- package/js/factory/graph.mjs +309 -0
- package/js/factory/registry.mjs +71 -0
- package/js/factory/state.mjs +511 -0
- package/js/hosts/activity.mjs +3 -3
- package/js/hosts/done-checks.mjs +3 -2
- package/js/hosts/geneseed-dir.mjs +1 -1
- package/js/hosts/gitref.mjs +21 -0
- package/js/hosts/hooks-context.mjs +63 -9
- package/js/hosts/hooks-prims.mjs +1 -1
- package/js/hosts/memory-files.mjs +4 -2
- package/js/hosts/settings.mjs +5 -4
- package/js/inspect/checks-authoring.mjs +11 -1
- package/js/inspect/cost.mjs +91 -5
- package/js/inspect/doctor.mjs +2 -1
- package/js/inspect/inventory.mjs +1 -1
- package/js/loop/catalog.mjs +30 -12
- package/js/loop/cli.mjs +27 -15
- package/js/loop/graph.mjs +13 -4
- package/js/loop/registry.mjs +65 -28
- package/js/loop/state.mjs +18 -8
- package/js/maintain/migrate.mjs +39 -25
- package/js/web/api.mjs +43 -1
- package/js/web/catalog.mjs +38 -2
- package/js/web/daemon.mjs +191 -6
- package/js/web/handler.mjs +27 -5
- package/js/web/routes.mjs +10 -3
- package/js/web/server.mjs +4 -1
- package/package.json +1 -1
- package/registry.json +14 -0
- package/src/AGENT.md.tmpl +5 -7
- package/src/bricks/checks.md +62 -0
- package/src/bricks/docs-update.md +5 -0
- package/src/bricks/holdout-write.md +23 -0
- package/src/bricks/holdout.md +25 -0
- package/src/bricks/intake.md +27 -0
- package/src/bricks/merge-gate.md +31 -0
- package/src/bricks/pr-open.md +21 -0
- package/src/bricks/retro.md +22 -0
- package/src/bricks/review-panel.md +43 -0
- package/src/bricks/spec.md +20 -6
- package/src/bricks/test.md +4 -1
- package/src/bricks/triage.md +19 -0
- package/src/doctrines/comms.md +29 -41
- package/src/doctrines/craft.md +3 -10
- package/src/doctrines/ops.md +4 -15
- package/src/doctrines/rigor.md +1 -5
- package/src/factories/analysis-to-build.json +52 -0
- package/src/factories/bug-report-to-fix.json +50 -0
- package/src/factories/issue-to-pr.json +67 -0
- package/src/skills/_checkpoints.md +1 -0
- package/src/skills/adhd.md +1 -1
- package/src/skills/factory-forge.md +115 -0
- package/src/skills/factory.md +196 -0
- package/src/skills/loop.md +3 -2
- package/src/skills/parallel-agents.md +1 -1
- package/src/skills/workflow.md +2 -1
- package/themes/_TEMPLATE.json +4 -2
- package/themes/biker.json +4 -2
- package/themes/commentator.json +4 -2
- package/themes/cyberpunk.json +4 -2
- package/themes/gamer.json +4 -2
- package/themes/imperial.json +4 -2
- package/themes/joker.json +4 -2
- package/themes/marvin.json +4 -2
- package/themes/mean.json +4 -2
- package/themes/military.json +4 -2
- package/themes/neutral.json +4 -2
- package/themes/pirate.json +4 -2
- package/themes/sports.json +4 -2
- package/themes/verstappen.json +4 -2
- package/themes/wizard.json +4 -2
- package/web/dist/assets/ActiveLoops-BTHIaRhn.js +1 -0
- package/web/dist/assets/{Activity-Ck_Xffpo.js → Activity-CpkBwpu7.js} +1 -1
- package/web/dist/assets/{ActivityDetail-CBxVS4mU.js → ActivityDetail-DTPziZWM.js} +1 -1
- package/web/dist/assets/{Bonsai-BlOwsvW6.js → Bonsai-hiG_gGNU.js} +1 -1
- package/web/dist/assets/{CopyButton-DFMOIGbe.js → CopyButton-DUIUfNp6.js} +1 -1
- package/web/dist/assets/Dashboard-Dnw6EyX7.js +2 -0
- package/web/dist/assets/{Docs-D_2Jt6gU.js → Docs-BEET_l16.js} +2 -2
- package/web/dist/assets/Factories-D6KXkfWw.js +1 -0
- package/web/dist/assets/{GreenhouseView-WalcX5bp.js → GreenhouseView-BKxy5apE.js} +1 -1
- package/web/dist/assets/{Installs-UGiPDMDt.js → Installs-CnFVlVD0.js} +3 -3
- package/web/dist/assets/{JournalView-CZtXQz-v.js → JournalView-ChFitHjo.js} +1 -1
- package/web/dist/assets/{Kits-XQHsazCN.js → Kits-CcR-OlwQ.js} +1 -1
- package/web/dist/assets/Laws-B1s5idOg.js +4 -0
- package/web/dist/assets/LibRows-BZgdbI1l.js +1 -0
- package/web/dist/assets/Library-x6TkkEVF.js +3 -0
- package/web/dist/assets/Loops-BH93KKxn.js +2 -0
- package/web/dist/assets/{OperatorHudView-CeDw5qMB.js → OperatorHudView-BO0aIKPL.js} +1 -1
- package/web/dist/assets/{Personal-PVmGA2-M.js → Personal-CE_0Vhh0.js} +2 -2
- package/web/dist/assets/{Settings-DWuxwh4i.js → Settings-CbpZvVN_.js} +1 -1
- package/web/dist/assets/{Tabs-d2RIRAKT.js → Tabs-C2oW7oEj.js} +1 -1
- package/web/dist/assets/api-DLDVY3K-.js +1 -0
- package/web/dist/assets/{index-BNttaGQb.js → index-BQwOmbor.js} +3 -3
- package/web/dist/assets/index-CuIop_pO.css +1 -0
- package/web/dist/index.html +3 -3
- package/web/dist/assets/Dashboard-BUdUTjbB.js +0 -2
- package/web/dist/assets/Laws-B6A55S-2.js +0 -4
- package/web/dist/assets/Library-D7L0Wdbh.js +0 -3
- package/web/dist/assets/Loops-C0loS73u.js +0 -2
- package/web/dist/assets/RailCats-BGZnJ6fa.js +0 -1
- package/web/dist/assets/api-BMFDSXoB.js +0 -1
- package/web/dist/assets/index-BEI5ugYQ.css +0 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retired skill folders — `skills/<name>` that an earlier build rendered under a name this one no
|
|
3
|
+
* longer ships (an `aliases:` marker or a `RETIRED_SKILL_IDS` entry), that no manifest owns, and
|
|
4
|
+
* that no emit would therefore ever prune. The user decided (2026-11-09) that such a folder is
|
|
5
|
+
* Geneseed's leftover, not their change: every canonical global emit moves it aside.
|
|
6
|
+
*
|
|
7
|
+
* An alias is a plain word, so a folder under one may be the user's own (`grill-me` on this very
|
|
8
|
+
* machine is a user skill, and a link). A folder moves only when ALL of these hold:
|
|
9
|
+
* (a) its name is retired and not a live skill;
|
|
10
|
+
* (b) no manifest owns a path under it — an owned one is the ordinary prune's;
|
|
11
|
+
* (c) it, the `skills/` root, and everything inside it are real entries, never a link;
|
|
12
|
+
* (d) its SKILL.md carries the render's fingerprint (`isRendered`).
|
|
13
|
+
* Anything else stays where it is and `migrate --dry-run` keeps calling it an orphan.
|
|
14
|
+
*
|
|
15
|
+
* Moved, not deleted: to `<cfg>/archived-skills/<name>/<stamp>/`, outside the `skills/` root a
|
|
16
|
+
* host scans (`archiveStore`'s sibling would sit inside it and load again).
|
|
17
|
+
*/
|
|
18
|
+
import { lstatSync, readdirSync, readFileSync, renameSync } from 'node:fs';
|
|
19
|
+
import path from 'node:path';
|
|
20
|
+
|
|
21
|
+
import { RETIRED_SKILL_IDS, THEMES, knownSkillIds, skillAliases } from './source.mjs';
|
|
22
|
+
import { isCanonical } from '../hosts/hosts.mjs';
|
|
23
|
+
import { archiveStore } from '../hosts/memory-files.mjs';
|
|
24
|
+
|
|
25
|
+
/** Every name an earlier build shipped a skill folder under and this one does not. */
|
|
26
|
+
export function retiredSkillNames({ live = knownSkillIds(), aliases = skillAliases() } = {}) {
|
|
27
|
+
return [...new Set([...aliases.keys(), ...Object.keys(RETIRED_SKILL_IDS)])].filter((n) => !live.includes(n));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Whether a manifest `owned` list holds `rel` or a path under it. */
|
|
31
|
+
export const ownsRel = (owned, rel) => owned.some((o) => o === rel || o.startsWith(`${rel}/`));
|
|
32
|
+
|
|
33
|
+
const lstat = (p) => { try { return lstatSync(p); } catch { return null; } };
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* (c): `dir` is a real directory and nothing under it is a link. lstat only: a link is never
|
|
37
|
+
* followed. A folder it cannot list is not plain: its reason goes into `unreadable`.
|
|
38
|
+
*/
|
|
39
|
+
function plainTree(dir, readdir, unreadable) {
|
|
40
|
+
const st = lstat(dir);
|
|
41
|
+
if (!st || st.isSymbolicLink() || !st.isDirectory()) return false;
|
|
42
|
+
let names;
|
|
43
|
+
try { names = readdir(dir); } catch (e) { unreadable.push(`${dir} (${e.message})`); return false; }
|
|
44
|
+
for (const name of names) {
|
|
45
|
+
const p = path.join(dir, name);
|
|
46
|
+
const s = lstat(p);
|
|
47
|
+
if (!s || s.isSymbolicLink()) return false;
|
|
48
|
+
if (s.isDirectory() && !plainTree(p, readdir, unreadable)) return false;
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
54
|
+
|
|
55
|
+
/** Every theme's `SKILL` label — the `{{SKILL}}` of a rendered heading — read off `themes/*.json`. */
|
|
56
|
+
let labelsCache = null;
|
|
57
|
+
export function skillLabels(themes = THEMES) {
|
|
58
|
+
if (themes === THEMES && labelsCache) return labelsCache;
|
|
59
|
+
const labels = new Set();
|
|
60
|
+
for (const f of readdirSync(themes).filter((n) => n.endsWith('.json') && !n.startsWith('_'))) {
|
|
61
|
+
try {
|
|
62
|
+
const v = JSON.parse(readFileSync(path.join(themes, f), 'utf8')).SKILL;
|
|
63
|
+
if (typeof v === 'string' && v) labels.add(v);
|
|
64
|
+
} catch { /* a broken theme labels nothing */ }
|
|
65
|
+
}
|
|
66
|
+
if (themes === THEMES) labelsCache = labels;
|
|
67
|
+
return labels;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* (d): the fingerprint every native skill writer has produced since the first one (Python
|
|
72
|
+
* `build.py`, 2026-06-04, through `js/hosts/native.mjs` today):
|
|
73
|
+
* - the file opens `---` / `name: <folder>` / `description: <json.dumps of it>`, and the value
|
|
74
|
+
* parses as a JSON string — a hand-written skill almost always writes plain YAML;
|
|
75
|
+
* - outside any code fence, the body holds the `# {{SKILL}}: <id>` heading every first-party
|
|
76
|
+
* source opens with, where the label is some theme's `SKILL` value and the id is the folder's
|
|
77
|
+
* own name, or the skill it aliases (an alias render carries its target's body). Anywhere in
|
|
78
|
+
* the body, because an authoring comment may precede it, as `herdr`'s did.
|
|
79
|
+
* A "Step 1: …" or "Grill Me: …" heading in a user's skill matches neither half of that.
|
|
80
|
+
*/
|
|
81
|
+
export function isRendered(dir, name, { aliases = skillAliases(), labels = skillLabels() } = {}) {
|
|
82
|
+
let text;
|
|
83
|
+
try { text = readFileSync(path.join(dir, 'SKILL.md'), 'utf8'); } catch { return false; }
|
|
84
|
+
const m = new RegExp(`^---\\r?\\nname: ${escapeRe(name)}\\r?\\ndescription: (".*")\\r?\\n`).exec(text);
|
|
85
|
+
if (!m) return false;
|
|
86
|
+
try { if (typeof JSON.parse(m[1]) !== 'string') return false; } catch { return false; }
|
|
87
|
+
// From the description line's own `\n`, so a frontmatter with no further key closes too.
|
|
88
|
+
const from = m[0].length - 1;
|
|
89
|
+
const close = /\n---\r?\n/.exec(text.slice(from));
|
|
90
|
+
if (!close) return false;
|
|
91
|
+
const ids = new Set([name, aliases.get(name)].filter(Boolean));
|
|
92
|
+
let fenced = false;
|
|
93
|
+
for (const line of text.slice(from + close.index + close[0].length).split(/\r?\n/)) {
|
|
94
|
+
if (/^\s*(```|~~~)/.test(line)) { fenced = !fenced; continue; }
|
|
95
|
+
if (fenced) continue;
|
|
96
|
+
const h = /^# (.+?): (\S+)\s*$/.exec(line);
|
|
97
|
+
if (h && labels.has(h[1]) && ids.has(h[2])) return true;
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The retired folders of `cfg` split by what the next canonical emit does with them:
|
|
104
|
+
* `prune` (a-d all hold) and `keep` (unowned, present, but failing c or d). Paths are absolute.
|
|
105
|
+
* `unreadable` names each folder kept because it could not be listed, with the reason.
|
|
106
|
+
* `opts.readdir` is the listing call, injectable so a test can make a folder unreadable.
|
|
107
|
+
*/
|
|
108
|
+
export function retiredSkillFolders(cfg, owned, opts = {}) {
|
|
109
|
+
const { readdir = readdirSync } = opts;
|
|
110
|
+
const prune = [];
|
|
111
|
+
const keep = [];
|
|
112
|
+
const unreadable = [];
|
|
113
|
+
const root = path.join(cfg, 'skills');
|
|
114
|
+
const rootStat = lstat(root);
|
|
115
|
+
if (!rootStat) return { prune, keep, unreadable };
|
|
116
|
+
// A linked `skills/` root (a dotfiles setup) is the user's whole tree: nothing in it moves.
|
|
117
|
+
const linkedRoot = rootStat.isSymbolicLink();
|
|
118
|
+
const aliases = opts.aliases ?? skillAliases();
|
|
119
|
+
for (const name of retiredSkillNames({ ...opts, aliases })) {
|
|
120
|
+
if (ownsRel(owned, `skills/${name}`)) continue;
|
|
121
|
+
const dir = path.join(root, name);
|
|
122
|
+
if (!lstat(dir)) continue;
|
|
123
|
+
(!linkedRoot && plainTree(dir, readdir, unreadable) && isRendered(dir, name, { aliases }) ? prune : keep).push(dir);
|
|
124
|
+
}
|
|
125
|
+
return { prune, keep, unreadable };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Where `pruneRetiredSkills` moves `skills/<name>`: the stamp folder goes under it. */
|
|
129
|
+
export const retiredArchiveOf = (cfg, name) => path.join(cfg, 'archived-skills', name);
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The emit's call, before the skill layer writes (so an alias freed here is claimed in the same
|
|
133
|
+
* emit, and the next one has nothing to do), with the manifest's `owned` from BEFORE this emit.
|
|
134
|
+
* Canonical global installs only: `diff`, Restore and a stray `--config-dir` never move a thing.
|
|
135
|
+
* A folder it cannot read, or a failed move, warns and leaves the folder; it never fails the emit.
|
|
136
|
+
* Raw stream writes, as `pruneOwned`'s: the driver's `withPlatformNewlines` already translates,
|
|
137
|
+
* and `printOut` on top of it would print `\r\r\n` on Windows.
|
|
138
|
+
*/
|
|
139
|
+
export function pruneRetiredSkills(host, cfg, oldOwned) {
|
|
140
|
+
if (!isCanonical(cfg, host)) return;
|
|
141
|
+
let found;
|
|
142
|
+
try { found = retiredSkillFolders(cfg, oldOwned); } catch (e) {
|
|
143
|
+
process.stderr.write(`[geneseed] WARN: ${host}: could not survey retired skills (${e.message}); nothing moved\n`);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
for (const u of found.unreadable) {
|
|
147
|
+
process.stderr.write(`[geneseed] WARN: ${host}: could not read retired skill folder ${u}; it stays\n`);
|
|
148
|
+
}
|
|
149
|
+
for (const dir of found.prune) {
|
|
150
|
+
const name = path.basename(dir);
|
|
151
|
+
try {
|
|
152
|
+
const dest = archiveStore(dir, renameSync, retiredArchiveOf(cfg, name));
|
|
153
|
+
process.stdout.write(`[geneseed] ${host}: pruned retired skill skills/${name} (moved to ${dest})\n`);
|
|
154
|
+
} catch (e) {
|
|
155
|
+
process.stderr.write(`[geneseed] WARN: ${host}: could not move retired skill skills/${name} aside (${e.message}); it stays\n`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
package/js/build/source.mjs
CHANGED
|
@@ -88,6 +88,11 @@ export const RULE_ID_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
|
88
88
|
export const RETIRED_RULE_IDS = {
|
|
89
89
|
'external-gate': { was: 'Law IX', liveAs: 'DOCTRINE', note: 'moved to the rigor pack' },
|
|
90
90
|
'absence-is-a-claim': { was: 'Law XI', liveAs: null, note: 'folded into verify-before-asserting' },
|
|
91
|
+
// 2026-11-08: both rules set the reply format and shared one example, so one rule now holds both.
|
|
92
|
+
// `effect`: what an old exclusion of the address no longer does, printed with its WARN.
|
|
93
|
+
'mark-the-ask': { was: 'comms 5', liveAs: null, note: 'merged into comms 1, Codes and Markers',
|
|
94
|
+
effect: 'the ask markers it held now bind inside comms 1, so this exclusion no longer removes them; '
|
|
95
|
+
+ "only excluding 'comms 1' would, and that drops the item codes too" },
|
|
91
96
|
};
|
|
92
97
|
|
|
93
98
|
/**
|
|
@@ -384,8 +389,42 @@ export const PACK_ORDER = ['craft', 'rigor', 'ops', 'process', 'comms'];
|
|
|
384
389
|
* constitution in the same sequence; a sort would silently disagree with a file whose headings
|
|
385
390
|
* were ever out of order, and disagree in the direction that reads as correct.
|
|
386
391
|
*/
|
|
387
|
-
export function knownRuleIds() {
|
|
388
|
-
return
|
|
392
|
+
export function knownRuleIds(rules = ruleCanon(SRC).rules) {
|
|
393
|
+
return rules.filter((r) => r.kind === 'DOCTRINE').map((r) => `${r.pack}.${r.n}`);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* `<pack>.<n>` -> its `RETIRED_RULE_IDS` entry (`note`, and `effect` when set), for every
|
|
398
|
+
* retired doctrine rule whose address no live rule took over. Read off `was`, so the reason has
|
|
399
|
+
* one home. An install that excluded `comms 5` replays it on every rebuild; refusing it would
|
|
400
|
+
* break that rebuild forever, so the flag parsers warn and drop it instead. A live address is
|
|
401
|
+
* never retired: a rule appended later at the same number takes the address back
|
|
402
|
+
* (`reusedRuleAddresses`).
|
|
403
|
+
*/
|
|
404
|
+
export function retiredRuleAddresses(known = knownRuleIds()) {
|
|
405
|
+
const out = new Map();
|
|
406
|
+
for (const entry of Object.values(RETIRED_RULE_IDS)) {
|
|
407
|
+
const m = /^([a-z]+) (\d+)$/.exec(entry.was);
|
|
408
|
+
const id = m && `${m[1]}.${m[2]}`;
|
|
409
|
+
if (id && PACK_ORDER.includes(m[1]) && !known.includes(id)) out.set(id, entry);
|
|
410
|
+
}
|
|
411
|
+
return out;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* `<pack>.<n>` -> `{ old, note, now }` for every retired doctrine rule whose address a different
|
|
416
|
+
* live rule (`now`, a `ruleCanon` rule) holds today. An exclusion stored for `old` would bind
|
|
417
|
+
* `now` in silence, so the flag parsers warn loudly with both names; the exclusion still binds,
|
|
418
|
+
* because the address is the new rule's now and nothing tells an old entry from a new one.
|
|
419
|
+
*/
|
|
420
|
+
export function reusedRuleAddresses(rules = ruleCanon(SRC).rules) {
|
|
421
|
+
const out = new Map();
|
|
422
|
+
for (const [old, { was, note }] of Object.entries(RETIRED_RULE_IDS)) {
|
|
423
|
+
const m = /^([a-z]+) (\d+)$/.exec(was);
|
|
424
|
+
const now = m && rules.find((r) => r.kind === 'DOCTRINE' && r.pack === m[1] && r.n === Number(m[2]));
|
|
425
|
+
if (now && now.id !== old) out.set(`${m[1]}.${m[2]}`, { old, note, now });
|
|
426
|
+
}
|
|
427
|
+
return out;
|
|
389
428
|
}
|
|
390
429
|
|
|
391
430
|
/**
|
package/js/cli-table.json
CHANGED
|
@@ -663,6 +663,183 @@
|
|
|
663
663
|
"options": [],
|
|
664
664
|
"mutex": []
|
|
665
665
|
},
|
|
666
|
+
{
|
|
667
|
+
"name": "factory",
|
|
668
|
+
"help": "run a factory: carry one work item through a graph of bricks and whole loops to an open PR (check/list/init/next/record/decide)",
|
|
669
|
+
"description": "",
|
|
670
|
+
"positionals": [
|
|
671
|
+
{
|
|
672
|
+
"names": [],
|
|
673
|
+
"dest": "action",
|
|
674
|
+
"metavar": null,
|
|
675
|
+
"help": "",
|
|
676
|
+
"choices": [
|
|
677
|
+
"check",
|
|
678
|
+
"list",
|
|
679
|
+
"init",
|
|
680
|
+
"next",
|
|
681
|
+
"record",
|
|
682
|
+
"decide"
|
|
683
|
+
],
|
|
684
|
+
"default": null,
|
|
685
|
+
"required": true,
|
|
686
|
+
"nargs": null,
|
|
687
|
+
"is_flag": false,
|
|
688
|
+
"type": null,
|
|
689
|
+
"hidden": false
|
|
690
|
+
}
|
|
691
|
+
],
|
|
692
|
+
"options": [
|
|
693
|
+
{
|
|
694
|
+
"names": ["--factory"],
|
|
695
|
+
"dest": "factory",
|
|
696
|
+
"metavar": null,
|
|
697
|
+
"help": "a factory name, or a .json factory file relative to the current directory (check, init)",
|
|
698
|
+
"choices": null,
|
|
699
|
+
"default": null,
|
|
700
|
+
"required": false,
|
|
701
|
+
"nargs": null,
|
|
702
|
+
"is_flag": false,
|
|
703
|
+
"type": null,
|
|
704
|
+
"hidden": false
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
"names": ["--title"],
|
|
708
|
+
"dest": "title",
|
|
709
|
+
"metavar": null,
|
|
710
|
+
"help": "the run's title, written into FACTORY.md",
|
|
711
|
+
"choices": null,
|
|
712
|
+
"default": null,
|
|
713
|
+
"required": false,
|
|
714
|
+
"nargs": null,
|
|
715
|
+
"is_flag": false,
|
|
716
|
+
"type": null,
|
|
717
|
+
"hidden": false
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"names": ["--requirement"],
|
|
721
|
+
"dest": "requirement",
|
|
722
|
+
"metavar": null,
|
|
723
|
+
"help": "the work item the run exists to carry to a PR",
|
|
724
|
+
"choices": null,
|
|
725
|
+
"default": null,
|
|
726
|
+
"required": false,
|
|
727
|
+
"nargs": null,
|
|
728
|
+
"is_flag": false,
|
|
729
|
+
"type": null,
|
|
730
|
+
"hidden": false
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
"names": ["--input"],
|
|
734
|
+
"dest": "input",
|
|
735
|
+
"metavar": null,
|
|
736
|
+
"help": "where the work item came from: an issue URL, a file path or pasted text (init)",
|
|
737
|
+
"choices": null,
|
|
738
|
+
"default": null,
|
|
739
|
+
"required": false,
|
|
740
|
+
"nargs": null,
|
|
741
|
+
"is_flag": false,
|
|
742
|
+
"type": null,
|
|
743
|
+
"hidden": false
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
"names": ["--outcome"],
|
|
747
|
+
"dest": "outcome",
|
|
748
|
+
"metavar": null,
|
|
749
|
+
"help": "the stage's reported outcome, one of its declared outcomes",
|
|
750
|
+
"choices": null,
|
|
751
|
+
"default": null,
|
|
752
|
+
"required": false,
|
|
753
|
+
"nargs": null,
|
|
754
|
+
"is_flag": false,
|
|
755
|
+
"type": null,
|
|
756
|
+
"hidden": false
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
"names": ["--spec"],
|
|
760
|
+
"dest": "spec",
|
|
761
|
+
"metavar": null,
|
|
762
|
+
"help": "the spec a stage wrote, at specs/<slug>/spec.md (a path relative to the current directory); its ordered tasks replay the next loop stage once each (record)",
|
|
763
|
+
"choices": null,
|
|
764
|
+
"default": null,
|
|
765
|
+
"required": false,
|
|
766
|
+
"nargs": null,
|
|
767
|
+
"is_flag": false,
|
|
768
|
+
"type": null,
|
|
769
|
+
"hidden": false
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
"names": ["--carry"],
|
|
773
|
+
"dest": "carry",
|
|
774
|
+
"metavar": null,
|
|
775
|
+
"help": "the reason the next stage must hear, such as why CI failed; a re-entered loop starts with it as a note (record)",
|
|
776
|
+
"choices": null,
|
|
777
|
+
"default": null,
|
|
778
|
+
"required": false,
|
|
779
|
+
"nargs": null,
|
|
780
|
+
"is_flag": false,
|
|
781
|
+
"type": null,
|
|
782
|
+
"hidden": false
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
"names": ["--carry-file"],
|
|
786
|
+
"dest": "carry_file",
|
|
787
|
+
"metavar": null,
|
|
788
|
+
"help": "record's carry read from this file (relative to the current directory; CRLF folded, trimmed) — for free text, or text that mentions git commit/push",
|
|
789
|
+
"choices": null,
|
|
790
|
+
"default": null,
|
|
791
|
+
"required": false,
|
|
792
|
+
"nargs": null,
|
|
793
|
+
"is_flag": false,
|
|
794
|
+
"type": null,
|
|
795
|
+
"hidden": false
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
"names": ["--verdict"],
|
|
799
|
+
"dest": "verdict",
|
|
800
|
+
"metavar": null,
|
|
801
|
+
"help": "the user's answer to a held gate",
|
|
802
|
+
"choices": [
|
|
803
|
+
"ok",
|
|
804
|
+
"no",
|
|
805
|
+
"amend"
|
|
806
|
+
],
|
|
807
|
+
"default": null,
|
|
808
|
+
"required": false,
|
|
809
|
+
"nargs": null,
|
|
810
|
+
"is_flag": false,
|
|
811
|
+
"type": null,
|
|
812
|
+
"hidden": false
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
"names": ["--note"],
|
|
816
|
+
"dest": "note",
|
|
817
|
+
"metavar": null,
|
|
818
|
+
"help": "a note attached to a decide verdict; an amend hands it to the re-run stage",
|
|
819
|
+
"choices": null,
|
|
820
|
+
"default": null,
|
|
821
|
+
"required": false,
|
|
822
|
+
"nargs": null,
|
|
823
|
+
"is_flag": false,
|
|
824
|
+
"type": null,
|
|
825
|
+
"hidden": false
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
"names": ["--note-file"],
|
|
829
|
+
"dest": "note_file",
|
|
830
|
+
"metavar": null,
|
|
831
|
+
"help": "decide's note read from this file (relative to the current directory; CRLF folded, trimmed) — for the user's own words, or text that mentions git commit/push",
|
|
832
|
+
"choices": null,
|
|
833
|
+
"default": null,
|
|
834
|
+
"required": false,
|
|
835
|
+
"nargs": null,
|
|
836
|
+
"is_flag": false,
|
|
837
|
+
"type": null,
|
|
838
|
+
"hidden": false
|
|
839
|
+
}
|
|
840
|
+
],
|
|
841
|
+
"mutex": []
|
|
842
|
+
},
|
|
666
843
|
{
|
|
667
844
|
"name": "git-gate",
|
|
668
845
|
"help": "PreToolUse hook: ASK before a history-discarding git act (Deletion Is Deliberate), a recursive scan of a whole filesystem (Commands Must Return) and every git commit/push (Consent Before Push backstop)",
|
|
@@ -1081,7 +1258,7 @@
|
|
|
1081
1258
|
"names": ["--note"],
|
|
1082
1259
|
"dest": "note",
|
|
1083
1260
|
"metavar": null,
|
|
1084
|
-
"help": "a note attached to a record or a decide verdict, written into LOOP.md so it survives the unit",
|
|
1261
|
+
"help": "a note attached to a record or a decide verdict, written into LOOP.md so it survives the unit; on init, the note the loop starts with",
|
|
1085
1262
|
"choices": null,
|
|
1086
1263
|
"default": null,
|
|
1087
1264
|
"required": false,
|
|
@@ -1094,7 +1271,20 @@
|
|
|
1094
1271
|
"names": ["--note-file"],
|
|
1095
1272
|
"dest": "note_file",
|
|
1096
1273
|
"metavar": null,
|
|
1097
|
-
"help": "record's note read from this file instead of the command line (CRLF folded, trimmed) — for a multi-line note or one that mentions git commit/push",
|
|
1274
|
+
"help": "record's or init's note read from this file instead of the command line (CRLF folded, trimmed) — for a multi-line note or one that mentions git commit/push",
|
|
1275
|
+
"choices": null,
|
|
1276
|
+
"default": null,
|
|
1277
|
+
"required": false,
|
|
1278
|
+
"nargs": null,
|
|
1279
|
+
"is_flag": false,
|
|
1280
|
+
"type": null,
|
|
1281
|
+
"hidden": false
|
|
1282
|
+
},
|
|
1283
|
+
{
|
|
1284
|
+
"names": ["--factory"],
|
|
1285
|
+
"dest": "factory",
|
|
1286
|
+
"metavar": null,
|
|
1287
|
+
"help": "on init, the slug of the factory run this loop is a stage of, stored on the loop's registry row",
|
|
1098
1288
|
"choices": null,
|
|
1099
1289
|
"default": null,
|
|
1100
1290
|
"required": false,
|
|
@@ -1218,7 +1408,7 @@
|
|
|
1218
1408
|
],
|
|
1219
1409
|
"dest": "dry_run",
|
|
1220
1410
|
"metavar": null,
|
|
1221
|
-
"help": "survey and print the plan, with the fold each global install would run and any orphan; write nothing",
|
|
1411
|
+
"help": "survey and print the plan, with the fold each global install would run, the retired skill folders it would prune and any orphan; write nothing",
|
|
1222
1412
|
"choices": null,
|
|
1223
1413
|
"default": false,
|
|
1224
1414
|
"required": false,
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `geneseed factory <action>` — the factory engine's only face, built as `geneseed loop` is
|
|
3
|
+
* (`js/loop/cli.mjs`): one JSON object per action, exit 1 on any refusal, no spawn. git and
|
|
4
|
+
* `gh`/`glab` are the model's job; the porcelain reaches `record` on stdin, and a TTY stdin reads
|
|
5
|
+
* as `null` ("none given"), never as a clean tree.
|
|
6
|
+
*
|
|
7
|
+
* FACTORY.md LIVES AT THE GIT ROOT, beside LOOP.md, for the same reason LOOP.md does: the loop
|
|
8
|
+
* engine filters both out of every diff by their root-relative name (`ENGINE_FILES`). So the root
|
|
9
|
+
* is found by walking up to `.git`, never taken from the caller. The same root answers R3: the
|
|
10
|
+
* status in the LOOP.md there (`loopStatus`) goes to the engine, which refuses while it is neither
|
|
11
|
+
* `done` nor `stopped`, holds a loop stage's outcome to it (R2: stopped is fail, done is pass), and
|
|
12
|
+
* refuses `next` on a loop stage while any LOOP.md is left. A loop that ends on `$stop` leaves its
|
|
13
|
+
* LOOP.md in place, so without that read R2 could never be recorded. A LOOP.md that does not parse
|
|
14
|
+
* counts as running: refusing is the safe side, and `loop` itself refuses it too. Its graph name
|
|
15
|
+
* (`loopTemplate`) and the HEAD commit (`headCommit`, read off disk) go along: `next` on a loop
|
|
16
|
+
* stage stores the launch in FACTORY.md with the time now, so `next` writes, and `record` checks
|
|
17
|
+
* the loop against it — with the loop registry's last `loop init` time for this root
|
|
18
|
+
* (`loopInitAt`, a read of `loops.json`, no write), which a `pass` with no LOOP.md left needs.
|
|
19
|
+
*
|
|
20
|
+
* THE PORCELAIN IS TRUSTED AS PIPED. A TTY stdin is `null` and the engine refuses it after a
|
|
21
|
+
* stage outside a loop (J5); an empty pipe (or a null device) reads as a clean tree, and nothing
|
|
22
|
+
* here can tell it from one. The Rite pipes `git status --porcelain --untracked-files=all` straight
|
|
23
|
+
* into `record`, in one command, so a new spec reaches the engine as its own path. No temp status
|
|
24
|
+
* file and no shell variable: three attempts at those (F1/F2) shared a file across repos, broke on
|
|
25
|
+
* zsh's read-only `$status`, or put free text back on the line. Windows PowerShell 5.1 pipes too,
|
|
26
|
+
* but ends lines with CRLF, and adds a leading BOM when `$OutputEncoding` is UTF-8; both are stripped below.
|
|
27
|
+
* The git gate (`GIT_GATE_RE`) asks on a line that holds the word `git` and the word `commit` or
|
|
28
|
+
* `push`, so a record line whose spec path, carry path or outcome holds `commit` or `push` asks.
|
|
29
|
+
* That ask is a false alarm the user answers yes to, and the skill says so; a shared or broken
|
|
30
|
+
* status file would be a wrong record. `init` refuses a `loop/factory-<slug>` branch whose slug
|
|
31
|
+
* holds those words, which removes the commonest case.
|
|
32
|
+
*
|
|
33
|
+
* `--spec` IS READ HERE, not in the state module: the engine stays pure, and the CLI is the one
|
|
34
|
+
* layer that may read files. The path is stored root-relative with forward slashes, the form a
|
|
35
|
+
* porcelain line carries it in, and a path outside the root is refused before it is read.
|
|
36
|
+
*
|
|
37
|
+
* EVERY PATH ARGUMENT RESOLVES AGAINST THE CURRENT DIRECTORY (M6): `--spec`, `--factory <file>`,
|
|
38
|
+
* `--carry-file` and `--note-file`, as `geneseed loop`'s `--note-file` does and as a shell user
|
|
39
|
+
* means a relative path. Only FACTORY.md itself is found at the git root. `--spec` resolved
|
|
40
|
+
* against the root once, so the same relative path named two files depending on the flag.
|
|
41
|
+
*
|
|
42
|
+
* `--carry-file` AND `--note-file` (M7) take the text from a file, never the command line
|
|
43
|
+
* (`textArg`, shared with `geneseed loop`): free text can hold any word and any quote. The Rite
|
|
44
|
+
* writes that file with the host's file tool, never the shell, under a name it makes unique.
|
|
45
|
+
*/
|
|
46
|
+
import { readFileSync } from 'node:fs';
|
|
47
|
+
import path from 'node:path';
|
|
48
|
+
import { readText, isFile, printOut } from '../lib/fs.mjs';
|
|
49
|
+
import { gitRootOf, headCommit, currentBranch } from '../hosts/gitref.mjs';
|
|
50
|
+
import { loadCatalog } from '../loop/catalog.mjs';
|
|
51
|
+
import { LOOP_FILE, parseLoopFile } from '../loop/state.mjs';
|
|
52
|
+
import { loopInitAt } from '../loop/registry.mjs';
|
|
53
|
+
import { textArg } from '../loop/cli.mjs';
|
|
54
|
+
import { recordFactory } from './registry.mjs';
|
|
55
|
+
import { checkFactory, factoryCatalogProblems } from './graph.mjs';
|
|
56
|
+
import {
|
|
57
|
+
FACTORY_FILE, initFactory, nextStage, recordStage, decideFactory, writeFactoryFile, parseFactoryFile,
|
|
58
|
+
validateFactoryState, countSpecTasks,
|
|
59
|
+
} from './state.mjs';
|
|
60
|
+
|
|
61
|
+
const emit = (obj) => { printOut(`${JSON.stringify(obj)}\n`); return obj.error || obj.ok === false ? 1 : 0; };
|
|
62
|
+
const stdin = () => (process.stdin.isTTY ? null : readFileSync(0, 'utf8'));
|
|
63
|
+
const byName = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
/** R3: the LOOP.md at `root` — its status (`running` when it does not parse) and graph name; nulls without one. */
|
|
67
|
+
function loopFileOf(root) {
|
|
68
|
+
const file = path.join(root, LOOP_FILE);
|
|
69
|
+
if (!isFile(file)) return { loopStatus: null, loopTemplate: null };
|
|
70
|
+
try {
|
|
71
|
+
const loop = parseLoopFile(readText(file));
|
|
72
|
+
return { loopStatus: String(loop?.status ?? 'running'), loopTemplate: loop?.graph?.name ?? null };
|
|
73
|
+
} catch { return { loopStatus: 'running', loopTemplate: null }; }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function requireRoot() {
|
|
77
|
+
const root = gitRootOf(process.cwd());
|
|
78
|
+
if (!root) throw new Error('not inside a git repository');
|
|
79
|
+
return root;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* R4: an unreadable FACTORY.md throws in `parseFactoryFile` or `validateFactoryState`, before `fn`
|
|
84
|
+
* runs or anything is written.
|
|
85
|
+
*/
|
|
86
|
+
function withState(fn) {
|
|
87
|
+
const root = requireRoot();
|
|
88
|
+
const file = path.join(root, FACTORY_FILE);
|
|
89
|
+
if (!isFile(file)) throw new Error(`${file} does not exist — run \`geneseed factory init\` first`);
|
|
90
|
+
const state = parseFactoryFile(readText(file));
|
|
91
|
+
const catalog = loadCatalog({ projectRoot: root });
|
|
92
|
+
validateFactoryState(state, catalog);
|
|
93
|
+
const result = fn(state, catalog, { root, head: headCommit(root), ...loopFileOf(root) });
|
|
94
|
+
writeFactoryFile(file, state);
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function resolveFactory(spec, catalog) {
|
|
99
|
+
if (spec.endsWith('.json')) return JSON.parse(readText(path.resolve(spec)));
|
|
100
|
+
const f = catalog.factories.get(spec);
|
|
101
|
+
if (!f) {
|
|
102
|
+
// M8: a file of that name that does not load is why, and is named; it never falls back to a lower level's factory
|
|
103
|
+
const why = catalog.factoryProblems.filter((p) => p.startsWith(`factories/${spec}.json (`));
|
|
104
|
+
throw new Error(`no factory named ${JSON.stringify(spec)}${why.length ? `: ${why.join('; ')}` : ''}`);
|
|
105
|
+
}
|
|
106
|
+
const { origin, ...factory } = f;
|
|
107
|
+
return factory;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const ACTIONS = {
|
|
111
|
+
check(args) {
|
|
112
|
+
const root = gitRootOf(process.cwd()) ?? process.cwd();
|
|
113
|
+
const catalog = loadCatalog({ projectRoot: root });
|
|
114
|
+
if (args.factory) {
|
|
115
|
+
const problems = checkFactory(resolveFactory(args.factory, catalog), catalog);
|
|
116
|
+
return { ok: !problems.length, problems };
|
|
117
|
+
}
|
|
118
|
+
const problems = factoryCatalogProblems(catalog);
|
|
119
|
+
return {
|
|
120
|
+
ok: !problems.length, problems, factories: [...catalog.factories.keys()].sort(byName),
|
|
121
|
+
...(catalog.factoryOverridden.length ? { overridden: catalog.factoryOverridden } : {}),
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
list() {
|
|
125
|
+
const root = gitRootOf(process.cwd()) ?? process.cwd();
|
|
126
|
+
const { factories } = loadCatalog({ projectRoot: root });
|
|
127
|
+
return {
|
|
128
|
+
factories: [...factories.values()].sort((a, b) => byName(a.name, b.name)).map((f) => ({
|
|
129
|
+
name: f.name, description: f.description ?? '', category: f.category ?? null, origin: f.origin,
|
|
130
|
+
})),
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
init(args) {
|
|
134
|
+
const root = requireRoot();
|
|
135
|
+
const file = path.join(root, FACTORY_FILE);
|
|
136
|
+
if (isFile(file)) throw new Error(`${file} already exists — a factory is already running here`);
|
|
137
|
+
if (!args.title || !args.requirement || !args.factory) throw new Error('init needs --title, --requirement and --factory');
|
|
138
|
+
// F1: the slug lands on the spec's record line (`--spec specs/<slug>/spec.md`), where the git
|
|
139
|
+
// gate asks on the words git, commit and push. The run's branch carries it, so check it there.
|
|
140
|
+
// Case-insensitive on purpose: stricter than the (case-sensitive) gate.
|
|
141
|
+
const slug = /^loop\/factory-(.+)$/.exec(currentBranch(root) ?? '')?.[1];
|
|
142
|
+
const word = slug && /\b(git|commit|push)\b/i.exec(slug);
|
|
143
|
+
if (word) {
|
|
144
|
+
throw new Error(`the run's slug ${JSON.stringify(slug)} holds the word ${word[1]}, in any case refused: the git gate `
|
|
145
|
+
+ 'asks on git, commit and push on the spec\'s record line. Rename the branch loop/factory-<slug> to a slug without '
|
|
146
|
+
+ 'git, commit or push (spell them g1t, cmt, psh)');
|
|
147
|
+
}
|
|
148
|
+
const catalog = loadCatalog({ projectRoot: root });
|
|
149
|
+
const factory = resolveFactory(args.factory, catalog);
|
|
150
|
+
const problems = checkFactory(factory, catalog);
|
|
151
|
+
if (problems.length) return { error: 'the factory does not pass factory check', problems };
|
|
152
|
+
const state = initFactory({ title: args.title, requirement: args.requirement, factory, input: args.input ?? null });
|
|
153
|
+
writeFactoryFile(file, state);
|
|
154
|
+
// Best-effort, as `loop init`'s `recordLoop`: the registry is how the console finds the run.
|
|
155
|
+
recordFactory({ root, branch: currentBranch(root), factory: factory.name, title: args.title });
|
|
156
|
+
return { file, factory: factory.name, stage: state.stage, status: state.status };
|
|
157
|
+
},
|
|
158
|
+
next: () => withState((s, c, { loopStatus, head }) => nextStage(s, c, { loopStatus, head, now: new Date().toISOString() })),
|
|
159
|
+
record(args) {
|
|
160
|
+
if (!args.outcome) throw new Error('record needs --outcome');
|
|
161
|
+
const carry = textArg(args, 'carry', 'carry', 'record');
|
|
162
|
+
const porcelain = stdin();
|
|
163
|
+
return withState((s, c, { root, loopStatus, loopTemplate, head }) => {
|
|
164
|
+
let specPath = null; let taskCount = null;
|
|
165
|
+
if (args.spec) {
|
|
166
|
+
const abs = path.resolve(args.spec);
|
|
167
|
+
const rel = path.relative(root, abs);
|
|
168
|
+
if (!rel || rel === '..' || rel.startsWith(`..${path.sep}`) || path.isAbsolute(rel)) throw new Error(`--spec ${args.spec} is outside the worktree`);
|
|
169
|
+
let text;
|
|
170
|
+
try { text = readText(abs); } catch (e) { throw new Error(`cannot read --spec ${args.spec}: ${e.message}`, { cause: e }); }
|
|
171
|
+
specPath = rel.replaceAll('\\', '/');
|
|
172
|
+
taskCount = countSpecTasks(text);
|
|
173
|
+
}
|
|
174
|
+
return recordStage(s, c, args.outcome, {
|
|
175
|
+
// Windows PowerShell 5.1 re-encodes a native pipe: CRLF line ends, and a leading BOM when $OutputEncoding is UTF-8
|
|
176
|
+
porcelain: porcelain === null ? null : porcelain.replace(/^\uFEFF/, '').replace(/\r\n/g, '\n').trimEnd(),
|
|
177
|
+
specPath, taskCount, carry, loopStatus, loopTemplate, head,
|
|
178
|
+
loopInitAt: loopInitAt(root),
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
decide(args) {
|
|
183
|
+
const note = textArg(args, 'note', 'note', 'decide') ?? '';
|
|
184
|
+
return withState((s, c) => decideFactory(s, c, args.verdict, note));
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export function cmdFactory(args) {
|
|
189
|
+
try {
|
|
190
|
+
return emit(ACTIONS[args.action](args));
|
|
191
|
+
} catch (e) {
|
|
192
|
+
return emit({ error: e.message });
|
|
193
|
+
}
|
|
194
|
+
}
|