gennady 0.8.4-draft.2 → 0.8.4-draft.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/ai/directives/sdd-v2/root.directive.xml +36 -3
- package/ai/directives/sdd-v2/router.directive.xml +22 -1
- package/ai/kit/templates/sdd-v2/root.directive.hbs +11 -3
- package/ai/kit/templates/sdd-v2/router.directive.hbs +22 -1
- package/ai/skills/agent-inbox/SKILL.md +1 -1
- package/ai/skills/sdd/SKILL.md +5 -3
- package/ai/skills/sdd-audit/SKILL.md +5 -2
- package/ai/skills/sdd-check/SKILL.md +2 -2
- package/ai/skills/sdd-code-review/SKILL.md +4 -1
- package/ai/skills/sdd-critic/SKILL.md +5 -2
- package/ai/skills/sdd-execute/SKILL.md +5 -2
- package/ai/skills/sdd-reconcile/SKILL.md +5 -2
- package/ai/skills/sdd-scaffold/SKILL.md +5 -2
- package/dist/ai/directives/sdd-v2/root.directive.xml +36 -3
- package/dist/ai/directives/sdd-v2/router.directive.xml +22 -1
- package/dist/ai/kit/templates/sdd-v2/root.directive.hbs +11 -3
- package/dist/ai/kit/templates/sdd-v2/router.directive.hbs +22 -1
- package/dist/ai/skills/agent-inbox/SKILL.md +1 -1
- package/dist/ai/skills/sdd/SKILL.md +5 -3
- package/dist/ai/skills/sdd-audit/SKILL.md +5 -2
- package/dist/ai/skills/sdd-check/SKILL.md +2 -2
- package/dist/ai/skills/sdd-code-review/SKILL.md +4 -1
- package/dist/ai/skills/sdd-critic/SKILL.md +5 -2
- package/dist/ai/skills/sdd-execute/SKILL.md +5 -2
- package/dist/ai/skills/sdd-reconcile/SKILL.md +5 -2
- package/dist/ai/skills/sdd-scaffold/SKILL.md +5 -2
- package/dist/chunks/{classify-mr-stage.logic-BiCHTmPp.js → classify-mr-stage.logic-CazmQDwZ.js} +2 -2
- package/dist/chunks/{config-index-9VHWSDQD.js → config-index-DU8-FEjq.js} +1 -1
- package/dist/chunks/{devtools-b0DwO1x_.js → devtools-1JmXJjUG.js} +1 -1
- package/dist/chunks/{eval.cmd-CwNPaNJd.js → eval.cmd-CBANnOFG.js} +1 -1
- package/dist/chunks/{help-D5cXtdMI.js → help-DVloaFF5.js} +1 -1
- package/dist/chunks/{index-BVnJEutp.js → index-2xhpqJtd.js} +2 -2
- package/dist/chunks/{index-RR5OUxje.js → index-AxsLBUAx.js} +14 -14
- package/dist/chunks/{index-CUkeTGqM.js → index-B7sydB0W.js} +2 -2
- package/dist/chunks/{index-CMCn9ErF.js → index-BKxk4zOz.js} +2 -2
- package/dist/chunks/{index-Db13NlHh.js → index-BNMmX_Mv.js} +21 -21
- package/dist/chunks/{index-CmQO-RmM.js → index-BPzldG3a.js} +2 -2
- package/dist/chunks/{index-BOQl7F_Z.js → index-BQlFDvKW.js} +2 -2
- package/dist/chunks/{index-RzkvIfJQ.js → index-Baq7RL1L.js} +3 -3
- package/dist/chunks/index-BbPiwvY9.js +2 -0
- package/dist/chunks/{index-ClJLPEUB.js → index-BreGNLJ_.js} +1 -1
- package/dist/chunks/{index-DjSafAkN.js → index-BslPwGtM.js} +2 -2
- package/dist/chunks/{index-DiMFxS0z.js → index-BtCUN2fZ.js} +16 -16
- package/dist/chunks/{index-CS0VbiLD.js → index-C10-EOdB.js} +1 -1
- package/dist/chunks/{index-2BOEcJIa.js → index-C4JmZLaj.js} +2 -2
- package/dist/chunks/index-CA-JKLr4.js +2 -0
- package/dist/chunks/{index-43GiH--T.js → index-CG_jJZVu.js} +2 -2
- package/dist/chunks/{index-BdkFKsMm.js → index-CGyP2uDE.js} +3 -3
- package/dist/chunks/{index-BOKv0b01.js → index-CPl1s9XJ.js} +2 -2
- package/dist/chunks/{index-DIPrBH-4.js → index-CSxE4cEm.js} +9 -9
- package/dist/chunks/{index-Cm7U1-fU.js → index-CWR5EzXx.js} +2 -2
- package/dist/chunks/{index-BwN5llCR.js → index-Camql5kL.js} +2 -2
- package/dist/chunks/{index-Drh-J9O7.js → index-CdUiTipO.js} +7 -7
- package/dist/chunks/{index-Cn029KTN.js → index-Crg61pK5.js} +2 -2
- package/dist/chunks/{index-Dja2O-hV.js → index-Cv9ZYXso.js} +1 -1
- package/dist/chunks/{index-Ck8v_Gv7.js → index-D7ADMlG3.js} +1 -1
- package/dist/chunks/index-DNl2gC8l.js +158 -0
- package/dist/chunks/{index-BYIzl-Ut.js → index-DVJA0qVm.js} +36 -36
- package/dist/chunks/{index-BAEIZVx0.js → index-DcFJhkY1.js} +2 -2
- package/dist/chunks/{index-Dx5_CB2E.js → index-DdEd-L3x.js} +2 -2
- package/dist/chunks/{index-DVmqMmgb.js → index-DkGA1eW_.js} +32 -32
- package/dist/chunks/{index-3k7mPX1e.js → index-Dnwxlti3.js} +1 -1
- package/dist/chunks/{index-CrizvxOJ.js → index-DqdEJDi2.js} +2 -2
- package/dist/chunks/{index-BIPebtDl.js → index-DqiwmBt4.js} +1 -1
- package/dist/chunks/{index-DS4MhAw-.js → index-PfuqBWjY.js} +2 -2
- package/dist/chunks/{index-BmFT1Kx2.js → index-SVP6RfVl.js} +2 -2
- package/dist/chunks/{index-CDxV4b81.js → index-Y8wu48Q0.js} +1 -1
- package/dist/chunks/index-_ewSKppm.js +2 -0
- package/dist/chunks/{index-Ctcr_Qeu.js → index-aBVtCLIJ.js} +2 -2
- package/dist/chunks/index-dNdz9j6d.js +2 -0
- package/dist/chunks/{index-BFUkVkSo.js → index-gskOpu3H.js} +16 -16
- package/dist/chunks/{index-CXpkT25O.js → index-pBSLMn5Q.js} +3 -3
- package/dist/chunks/index-sqPhX5Io.js +2 -0
- package/dist/chunks/{index-BzmR4Es2.js → index-vfrjhUD1.js} +39 -39
- package/dist/chunks/{index-J2NvjjDV.js → index-xGF5XC_i.js} +2 -2
- package/dist/chunks/{run-review-command.logic-CA2Rjymb.js → run-review-command.logic-B9GoCxh-.js} +24 -24
- package/dist/chunks/{serve.cmd-RxYS6WoN.js → serve.cmd-UXkaeaPI.js} +2 -2
- package/dist/chunks/{services-Csd556Tv.js → services-BYCeGBlO.js} +4 -4
- package/dist/chunks/{shared-B5CTGvpG.js → shared-B3cXL2Np.js} +1178 -1117
- package/dist/chunks/{stats-index-BLztvK69.js → stats-index-AIAnnp9S.js} +2 -2
- package/dist/gennady.js +46 -46
- package/dist/index.js +4 -4
- package/dist/shared/sdd/ladder.d.ts +42 -0
- package/dist/shared/sdd/module-specs.d.ts +7 -0
- package/dist/shared/sdd/tracker.d.ts +9 -0
- package/package.json +1 -1
- package/dist/chunks/classify-mr-stage.logic-ClmhzQPQ.js +0 -53
- package/dist/chunks/config-index-RFeqlDWs.js +0 -104
- package/dist/chunks/devtools-p8tmPuLn.js +0 -79
- package/dist/chunks/eval.cmd-ewU5lcUY.js +0 -34
- package/dist/chunks/help-DzGnMNi2.js +0 -7
- package/dist/chunks/index--AXFi0ty.js +0 -89
- package/dist/chunks/index-64TSesTc.js +0 -186
- package/dist/chunks/index-9Gv5trS_.js +0 -125
- package/dist/chunks/index-B1DQIryA.js +0 -2
- package/dist/chunks/index-B1PiBeQ3.js +0 -2
- package/dist/chunks/index-B4rzuhkt.js +0 -183
- package/dist/chunks/index-B97HJjkg.js +0 -159
- package/dist/chunks/index-BF6qypm0.js +0 -131
- package/dist/chunks/index-BK84ZQsh.js +0 -128
- package/dist/chunks/index-BRVIirjj.js +0 -141
- package/dist/chunks/index-BXnryCGW.js +0 -96
- package/dist/chunks/index-BaZm7Otb.js +0 -2
- package/dist/chunks/index-Bhk746A2.js +0 -129
- package/dist/chunks/index-Bi-eY_dY.js +0 -164
- package/dist/chunks/index-BjumU69g.js +0 -2
- package/dist/chunks/index-BkWXcpXU.js +0 -16979
- package/dist/chunks/index-BlY4jQIA.js +0 -168
- package/dist/chunks/index-C0iy7GxD.js +0 -140
- package/dist/chunks/index-CCBTXczb.js +0 -56
- package/dist/chunks/index-CDAfkSrr.js +0 -2
- package/dist/chunks/index-CDHymWzC.js +0 -102
- package/dist/chunks/index-CNfXJAao.js +0 -2
- package/dist/chunks/index-CQsae1nq.js +0 -207
- package/dist/chunks/index-CVmd0prf.js +0 -2
- package/dist/chunks/index-CZuTNeNm.js +0 -2
- package/dist/chunks/index-CasNhhrL.js +0 -96
- package/dist/chunks/index-Ce7GWENF.js +0 -377
- package/dist/chunks/index-Cf-02TAg.js +0 -265
- package/dist/chunks/index-CfjQWSrh.js +0 -52
- package/dist/chunks/index-Chr7gBBz.js +0 -443
- package/dist/chunks/index-Ci875Zlg.js +0 -346
- package/dist/chunks/index-CwA6RzIB.js +0 -3793
- package/dist/chunks/index-D1dI63ej.js +0 -46
- package/dist/chunks/index-DCS32A2i.js +0 -663
- package/dist/chunks/index-DOFoNxvb.js +0 -131
- package/dist/chunks/index-DVkCEuws.js +0 -136
- package/dist/chunks/index-DkadaaXq.js +0 -658
- package/dist/chunks/index-Dn11CLtk.js +0 -7
- package/dist/chunks/index-Do3spFJT.js +0 -340
- package/dist/chunks/index-DrFRZ0Yg.js +0 -2
- package/dist/chunks/index-DvEQhXi2.js +0 -1054
- package/dist/chunks/index-GiS0x6jg.js +0 -90
- package/dist/chunks/index-NacvqeQ5.js +0 -69
- package/dist/chunks/index-RNJhFzdr.js +0 -227
- package/dist/chunks/index-R_vUB6CL.js +0 -2
- package/dist/chunks/index-TQft1s5H.js +0 -20
- package/dist/chunks/index-ZmQRP38W.js +0 -26969
- package/dist/chunks/index-jdOZ4AkD.js +0 -143
- package/dist/chunks/index-kNa21kUI.js +0 -279
- package/dist/chunks/index-v4AV9kAc.js +0 -108
- package/dist/chunks/run-review-command.logic-CU1Slmc_.js +0 -331
- package/dist/chunks/serve.cmd-dWu_k_G_.js +0 -162
- package/dist/chunks/services-CwvXl2MB.js +0 -46832
- package/dist/chunks/shared-DSZTUx5b.js +0 -4509
- package/dist/chunks/stats-index-H6ALcjxy.js +0 -66
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { statSync as m, readFileSync as l } from "node:fs";
|
|
2
|
-
import { resolve as R, join as i } from "node:path";
|
|
3
|
-
import { l as E } from "./services-Csd556Tv.js";
|
|
4
|
-
import { p as _, e as A, h as D, i as O, j as C } from "./shared-B5CTGvpG.js";
|
|
5
|
-
const h = "ERR_CLI_SDD_STATE_BAD_INVOCATION", $ = "ERR_CLI_SDD_STATE_BAD_ROOT";
|
|
6
|
-
function P(e) {
|
|
7
|
-
const s = [
|
|
8
|
-
"# sdd-state v1",
|
|
9
|
-
`ROOT=${e.root}`,
|
|
10
|
-
`FLOW_VERSION=${e.flowVersion}`,
|
|
11
|
-
`PORTAL=${e.portalPresent ? "present" : "absent"} ${e.portalPath}`,
|
|
12
|
-
"",
|
|
13
|
-
"[READINESS]",
|
|
14
|
-
`package.json ${e.readiness.packageJsonPresent ? "✔" : "✘"}`,
|
|
15
|
-
"# required-script declared"
|
|
16
|
-
];
|
|
17
|
-
for (const t of e.readiness.required) s.push(`${t.name} ${t.present ? "✔" : "✘"}`);
|
|
18
|
-
if (s.push(`lint→gennady ${e.readiness.lintHasGennady ? "✔" : "✘"}`), s.push(`gennady-installed ${e.readiness.gennadyAvailable ? "✔" : "✘"}`), s.push(
|
|
19
|
-
e.readiness.ready ? "READINESS=ready" : `READINESS=not-ready (missing: ${e.readiness.missing.join(", ")})`
|
|
20
|
-
), s.push("", "[SCOPES]", "# name type status description spec"), !e.portalPresent)
|
|
21
|
-
s.push("# (portal absent — route to project-setup / root flow)");
|
|
22
|
-
else if (e.scopes.length === 0)
|
|
23
|
-
s.push("# (portal present, no scopes listed yet)");
|
|
24
|
-
else
|
|
25
|
-
for (const t of e.scopes)
|
|
26
|
-
s.push(
|
|
27
|
-
`${t.name} ${t.type} ${t.status} ${t.description || "—"} ${t.specPath ?? "-"}`
|
|
28
|
-
);
|
|
29
|
-
return s.push("", "[SESSION]", "# specs/.sdd-session.md"), s.push(e.sessionContent ? e.sessionContent : "# (no active session)"), e.probe && (s.push("", "[PROBE]"), s.push(
|
|
30
|
-
`CODE=${e.probe.codePresent ? "present" : "absent"} ${e.probe.codeFileCount} file(s)`
|
|
31
|
-
), e.probe.codeDirs.length > 0 && s.push(`code-dirs ${e.probe.codeDirs.join(", ")}`), s.push(`INFRA=${e.probe.infraPresent ? "present" : "absent"}`), e.probe.configFiles.length > 0 && s.push(`configs ${e.probe.configFiles.join(", ")}`)), s.push(
|
|
32
|
-
"",
|
|
33
|
-
"[SUMMARY]",
|
|
34
|
-
`flow=${e.flowVersion}`,
|
|
35
|
-
`portal=${e.portalPresent ? "present" : "absent"}`,
|
|
36
|
-
`readiness=${e.readiness.ready ? "ready" : "not-ready"}`,
|
|
37
|
-
`scopes=${e.scopes.length}`,
|
|
38
|
-
`session=${e.sessionContent ? "present" : "absent"}`
|
|
39
|
-
), e.probe && s.push(
|
|
40
|
-
`code=${e.probe.codePresent ? "present" : "absent"}`,
|
|
41
|
-
`infra=${e.probe.infraPresent ? "present" : "absent"}`
|
|
42
|
-
), s.join(`
|
|
43
|
-
`);
|
|
44
|
-
}
|
|
45
|
-
function j(e) {
|
|
46
|
-
return {
|
|
47
|
-
ok: !1,
|
|
48
|
-
code: h,
|
|
49
|
-
exitCode: 4,
|
|
50
|
-
message: [
|
|
51
|
-
`[sdd-state] ${h}`,
|
|
52
|
-
" expected: gennady sdd-state [project-root] (zero or one positional argument)",
|
|
53
|
-
` got: ${e || "(extra arguments)"}`
|
|
54
|
-
].join(`
|
|
55
|
-
`)
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function b(e) {
|
|
59
|
-
return {
|
|
60
|
-
ok: !1,
|
|
61
|
-
code: $,
|
|
62
|
-
exitCode: 2,
|
|
63
|
-
message: [
|
|
64
|
-
`[sdd-state] ${$}: ${e}`,
|
|
65
|
-
" Pass an existing project root, or run with no argument from inside the project."
|
|
66
|
-
].join(`
|
|
67
|
-
`)
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
function I(e) {
|
|
71
|
-
try {
|
|
72
|
-
return m(i(e, "node_modules", ".bin", "gennady")), !0;
|
|
73
|
-
} catch {
|
|
74
|
-
return !1;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
async function T(e) {
|
|
78
|
-
const s = _(e, { probe: ["probe"] }), t = s._.filter(
|
|
79
|
-
(o) => typeof o == "string" && o !== "sdd-state"
|
|
80
|
-
);
|
|
81
|
-
if (t.length > 1) return j(t.join(" "));
|
|
82
|
-
const n = R(t[0] ?? ".");
|
|
83
|
-
try {
|
|
84
|
-
if (!m(n).isDirectory()) return b(n);
|
|
85
|
-
} catch {
|
|
86
|
-
return b(n);
|
|
87
|
-
}
|
|
88
|
-
const u = A(n), y = "specs/README.md";
|
|
89
|
-
let a = !1, p = [];
|
|
90
|
-
try {
|
|
91
|
-
const o = l(i(n, "specs", "README.md"), "utf-8");
|
|
92
|
-
a = !0, p = D(o);
|
|
93
|
-
} catch {
|
|
94
|
-
a = !1;
|
|
95
|
-
}
|
|
96
|
-
let f = {}, c = !1;
|
|
97
|
-
try {
|
|
98
|
-
const o = JSON.parse(l(i(n, "package.json"), "utf-8"));
|
|
99
|
-
c = !0, f = o.scripts ?? {};
|
|
100
|
-
} catch {
|
|
101
|
-
c = !1;
|
|
102
|
-
}
|
|
103
|
-
const g = O({
|
|
104
|
-
packageJsonPresent: c,
|
|
105
|
-
scripts: f,
|
|
106
|
-
gennadyAvailable: I(n)
|
|
107
|
-
});
|
|
108
|
-
let d = null;
|
|
109
|
-
try {
|
|
110
|
-
d = l(i(n, "specs", ".sdd-session.md"), "utf-8").trim() || null;
|
|
111
|
-
} catch {
|
|
112
|
-
d = null;
|
|
113
|
-
}
|
|
114
|
-
E.debug(
|
|
115
|
-
`[SddStateCommand#run] flow=${u} portal=${a} ready=${g.ready} scopes=${p.length}`
|
|
116
|
-
);
|
|
117
|
-
const S = s.probe === !0 ? C(n) : void 0;
|
|
118
|
-
return { ok: !0, text: P({
|
|
119
|
-
root: n,
|
|
120
|
-
flowVersion: u,
|
|
121
|
-
portalPresent: a,
|
|
122
|
-
portalPath: y,
|
|
123
|
-
scopes: p,
|
|
124
|
-
readiness: g,
|
|
125
|
-
sessionContent: d,
|
|
126
|
-
probe: S
|
|
127
|
-
}) };
|
|
128
|
-
}
|
|
129
|
-
const r = await T(process.argv);
|
|
130
|
-
console.log(r.ok ? r.text : r.message);
|
|
131
|
-
process.exit(r.ok ? 0 : r.exitCode);
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { readFileSync as l } from "node:fs";
|
|
2
|
-
import { resolve as m } from "node:path";
|
|
3
|
-
import { l as s } from "./services-Csd556Tv.js";
|
|
4
|
-
import { a5 as h, p as g, a6 as O, N as S } from "./shared-B5CTGvpG.js";
|
|
5
|
-
const E = "ERR_CLI_SDD_EXTRACT_BAD_INVOCATION", C = "ERR_CLI_SDD_EXTRACT_INVALID_NAME", R = "ERR_CLI_SDD_EXTRACT_FILE_NOT_FOUND", A = "ERR_CLI_SDD_EXTRACT_FILE_NOT_READABLE", T = "ERR_CLI_SDD_EXTRACT_ANCHOR_NOT_FOUND", D = "ERR_CLI_SDD_EXTRACT_ANCHOR_EMPTY", u = "ERR_CLI_SDD_EXTRACT_ANCHOR_UNBALANCED", N = "ERR_CLI_SDD_EXTRACT_ANCHOR_DUPLICATED", $ = "META, PHASES_OVERVIEW, PHASE_P<N>, PHASE_P<N>_FIX, BDD, VERIFICATION, TEST_COVERAGE, EXECUTION_LOG";
|
|
6
|
-
function p() {
|
|
7
|
-
return {
|
|
8
|
-
ok: !1,
|
|
9
|
-
code: E,
|
|
10
|
-
exitCode: 4,
|
|
11
|
-
message: [
|
|
12
|
-
`[sdd-extract] ${E}`,
|
|
13
|
-
" expected: gennady sdd-extract <file> <NAME>",
|
|
14
|
-
` NAME must match ${h} — e.g. META, PHASES_OVERVIEW, PHASE_P1, BDD, EXECUTION_LOG.`
|
|
15
|
-
].join(`
|
|
16
|
-
`)
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function I(e) {
|
|
20
|
-
return {
|
|
21
|
-
ok: !1,
|
|
22
|
-
code: C,
|
|
23
|
-
exitCode: 4,
|
|
24
|
-
message: [
|
|
25
|
-
`[sdd-extract] ${C}: "${e}"`,
|
|
26
|
-
" Use uppercase letters, digits, and underscores, starting with a letter.",
|
|
27
|
-
" Put attributes (kind, rules) inside the section body, not in the anchor name.",
|
|
28
|
-
` Canonical: ${$}.`
|
|
29
|
-
].join(`
|
|
30
|
-
`)
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function f(e) {
|
|
34
|
-
return {
|
|
35
|
-
ok: !1,
|
|
36
|
-
code: R,
|
|
37
|
-
exitCode: 1,
|
|
38
|
-
message: [
|
|
39
|
-
`[sdd-extract] ${R}: ${e}`,
|
|
40
|
-
" Verify the path (typo, wrong scope, wrong task-id). Do not dispatch a phase agent until the ticket is located."
|
|
41
|
-
].join(`
|
|
42
|
-
`)
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function x(e) {
|
|
46
|
-
return {
|
|
47
|
-
ok: !1,
|
|
48
|
-
code: A,
|
|
49
|
-
exitCode: 1,
|
|
50
|
-
message: [
|
|
51
|
-
`[sdd-extract] ${A}: ${e}`,
|
|
52
|
-
" The path exists but cannot be read (permissions, or it is a directory). Check it, then retry."
|
|
53
|
-
].join(`
|
|
54
|
-
`)
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function L(e, a, t) {
|
|
58
|
-
const n = `<!--SECTION:${a}-->`, o = `<!--/SECTION:${a}-->`;
|
|
59
|
-
switch (t.status) {
|
|
60
|
-
case "ok":
|
|
61
|
-
return { ok: !0, content: t.content };
|
|
62
|
-
case "invalid_name":
|
|
63
|
-
return I(a);
|
|
64
|
-
case "not_found":
|
|
65
|
-
return {
|
|
66
|
-
ok: !1,
|
|
67
|
-
code: T,
|
|
68
|
-
exitCode: 2,
|
|
69
|
-
message: [
|
|
70
|
-
`[sdd-extract] ${T}: section ${a} in ${e}`,
|
|
71
|
-
` searched: ${n} / ${o}`,
|
|
72
|
-
" Read the file: if the section exists as a header, retrofit anchors; if absent, the ticket needs (re)scaffolding.",
|
|
73
|
-
" Do not dispatch a phase agent until anchors are in place."
|
|
74
|
-
].join(`
|
|
75
|
-
`)
|
|
76
|
-
};
|
|
77
|
-
case "empty":
|
|
78
|
-
return {
|
|
79
|
-
ok: !1,
|
|
80
|
-
code: D,
|
|
81
|
-
exitCode: 2,
|
|
82
|
-
message: [
|
|
83
|
-
`[sdd-extract] ${D}: section ${a} in ${e}`,
|
|
84
|
-
" Markers are present and balanced but the section is empty. Re-author the content, or reference a section that carries payload."
|
|
85
|
-
].join(`
|
|
86
|
-
`)
|
|
87
|
-
};
|
|
88
|
-
case "unbalanced":
|
|
89
|
-
return {
|
|
90
|
-
ok: !1,
|
|
91
|
-
code: u,
|
|
92
|
-
exitCode: 3,
|
|
93
|
-
message: [
|
|
94
|
-
`[sdd-extract] ${u}: section ${a} in ${e}`,
|
|
95
|
-
` ${n} ×${t.startCount}, ${o} ×${t.endCount}`,
|
|
96
|
-
" Restore the missing marker or remove the duplicate, then retry. Do not dispatch a phase agent until markers balance."
|
|
97
|
-
].join(`
|
|
98
|
-
`)
|
|
99
|
-
};
|
|
100
|
-
case "duplicated":
|
|
101
|
-
return {
|
|
102
|
-
ok: !1,
|
|
103
|
-
code: N,
|
|
104
|
-
exitCode: 3,
|
|
105
|
-
message: [
|
|
106
|
-
`[sdd-extract] ${N}: section ${a} ×${t.count} in ${e}`,
|
|
107
|
-
" The section appears more than once — extraction is ambiguous. Merge them or rename one (e.g. PHASE_P1 vs PHASE_P1_FIX), then retry."
|
|
108
|
-
].join(`
|
|
109
|
-
`)
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
async function X(e) {
|
|
114
|
-
const t = g(e, {})._.filter(
|
|
115
|
-
(c) => typeof c == "string" && c !== "sdd-extract"
|
|
116
|
-
);
|
|
117
|
-
if (t.length !== 2)
|
|
118
|
-
return s.warn(
|
|
119
|
-
`[SddExtractCommand#run] bad invocation — ${t.length} positional arg(s), expected 2`
|
|
120
|
-
), p();
|
|
121
|
-
const [n, o] = t;
|
|
122
|
-
if (!O(o))
|
|
123
|
-
return s.warn(`[SddExtractCommand#run] invalid section name: ${o}`), I(o);
|
|
124
|
-
let i;
|
|
125
|
-
try {
|
|
126
|
-
s.debug(`[SddExtractCommand#run] [idle → reading] ${n}`), i = l(m(n), "utf-8");
|
|
127
|
-
} catch (c) {
|
|
128
|
-
const d = c;
|
|
129
|
-
return s.warn(`[SddExtractCommand#run] [reading → failed] ${n}: ${d.code ?? "UNKNOWN"}`), d.code === "ENOENT" ? f(n) : x(n);
|
|
130
|
-
}
|
|
131
|
-
const _ = S(i, o);
|
|
132
|
-
return s.debug(`[SddExtractCommand#run] [reading → ${_.status}] section ${o}`), L(n, o, _);
|
|
133
|
-
}
|
|
134
|
-
const r = await X(process.argv);
|
|
135
|
-
console.log(r.ok ? r.content : r.message);
|
|
136
|
-
process.exit(r.ok ? 0 : r.exitCode);
|