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,90 +0,0 @@
|
|
|
1
|
-
import { V as k, a as m, l as c, b as y, J as I, I as b, K as R } from "./services-CwvXl2MB.js";
|
|
2
|
-
import { p as $, r as w, s as t, b as x } from "./shared-DSZTUx5b.js";
|
|
3
|
-
function C(o) {
|
|
4
|
-
return o ? o.replace(/^https?:\/\//, "").replace(/\/+$/, "") : x()?.host;
|
|
5
|
-
}
|
|
6
|
-
function v(o, e) {
|
|
7
|
-
if (!e)
|
|
8
|
-
try {
|
|
9
|
-
const r = y(process.argv.slice(2)), n = I(r), d = b(n), l = o.lastIndexOf("!");
|
|
10
|
-
if (l === -1) return;
|
|
11
|
-
const f = o.slice(0, l), s = o.slice(l + 1);
|
|
12
|
-
if (!Object.keys(d.entries).find(
|
|
13
|
-
(g) => d.entries[g].project === f && d.entries[g].iid === s
|
|
14
|
-
)) return;
|
|
15
|
-
R(n, d);
|
|
16
|
-
} catch (r) {
|
|
17
|
-
const n = r.message ?? String(r);
|
|
18
|
-
console.error(t.yellow(`Warning: Failed to update reviewed head in registry: ${n}`));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
async function V(o = {}) {
|
|
22
|
-
const e = !!o.dryRun, r = o.vcsContext?.token, n = o.vcsContext?.host ?? C(o.host);
|
|
23
|
-
if (!r)
|
|
24
|
-
return console.error(t.redBright.bold("✖ Ошибка:"), "Не найден токен доступа."), console.error(" Установите переменную окружения для вашего провайдера:"), console.error(t.cyan(' GitHub: export GITHUB_PERSONAL_TOKEN="..."')), console.error(t.cyan(' GitLab: export GITLAB_PERSONAL_TOKEN="..."')), { ok: !1, code: 1 };
|
|
25
|
-
if (!n)
|
|
26
|
-
return console.error(
|
|
27
|
-
t.redBright.bold("✖ Ошибка:"),
|
|
28
|
-
"Не определён VCS-хост. Укажите --vcs-host=<host> или запустите из репозитория с origin."
|
|
29
|
-
), { ok: !1, code: 1 };
|
|
30
|
-
const d = o.vcsContext?.provider ?? (/github/i.test(n) ? "github" : "gitlab"), l = d === "github" ? "https://api.github.com" : `https://${n}/api/v4`, f = d === "github" ? new k({ token: r, baseUrl: l }) : new m({ token: r, baseUrl: l });
|
|
31
|
-
if (o.todoId) {
|
|
32
|
-
if (c.debug(`[vcs-todo] [idle → marking] ${o.todoId}`), e)
|
|
33
|
-
return console.info(`Would mark todo done: ${o.todoId}`), { ok: !0, code: 0 };
|
|
34
|
-
try {
|
|
35
|
-
return await f.Inbox.markTodoDone({ todoId: o.todoId }), console.info(`${t.green("✔")} Todo marked done: ${o.todoId}`), c.info(`[vcs-todo] [marking → done] ${o.todoId}`), { ok: !0, code: 0 };
|
|
36
|
-
} catch (s) {
|
|
37
|
-
const u = new Error(`[vcs-todo] Failed to mark todo done: ${o.todoId}`, { cause: s });
|
|
38
|
-
return c.error(`[vcs-todo] [marking → failed] ${o.todoId}`, { error: u }), console.error(t.redBright.bold("✖ Ошибка:"), s.message ?? String(s)), { ok: !1, code: 1 };
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (o.doneRef) {
|
|
42
|
-
const s = o.doneRef.lastIndexOf("!");
|
|
43
|
-
if (s === -1)
|
|
44
|
-
return console.error(t.redBright.bold("✖ Ошибка:"), "Ожидался ref вида group/project!iid"), { ok: !1, code: 1 };
|
|
45
|
-
const u = o.doneRef.slice(0, s), g = o.doneRef.slice(s + 1);
|
|
46
|
-
try {
|
|
47
|
-
c.debug(`[vcs-todo] [idle → fetching] ${o.doneRef}`);
|
|
48
|
-
const i = (await f.Inbox.getActionable()).find((a) => a.project === u && a.iid === g);
|
|
49
|
-
if (!i || i.todoIds.length === 0)
|
|
50
|
-
return console.info(t.yellow("ℹ No pending todos for this MR")), c.info(`[vcs-todo] [fetching → no-todos] ${o.doneRef}`), v(o.doneRef, e), { ok: !0, code: 0 };
|
|
51
|
-
if (c.info(`[vcs-todo] [fetching → marking] ${i.todoIds.length} todos for ${o.doneRef}`), e)
|
|
52
|
-
for (const a of i.todoIds)
|
|
53
|
-
console.info(`Would mark todo done: ${a}`);
|
|
54
|
-
else
|
|
55
|
-
for (const a of i.todoIds)
|
|
56
|
-
await f.Inbox.markTodoDone({ todoId: a }), console.info(`${t.green("✔")} Todo marked done: ${a}`);
|
|
57
|
-
return c.info(`[vcs-todo] [marking → done] ${i.todoIds.length} todos for ${o.doneRef}`), v(o.doneRef, e), { ok: !0, code: 0 };
|
|
58
|
-
} catch (h) {
|
|
59
|
-
const i = new Error(`[vcs-todo] Failed to process todos for ${o.doneRef}`, { cause: h });
|
|
60
|
-
return c.error(`[vcs-todo] [fetching → failed] ${o.doneRef}`, { error: i }), console.error(t.redBright.bold("✖ Ошибка:"), h.message ?? String(h)), { ok: !1, code: 1 };
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return console.error(t.redBright.bold("✖ Ошибка:"), "Укажите --done <ref> или --id <todoId>."), { ok: !1, code: 1 };
|
|
64
|
-
}
|
|
65
|
-
async function p(o = process.argv) {
|
|
66
|
-
try {
|
|
67
|
-
const e = $(o, {
|
|
68
|
-
done: { aliases: ["done"], takesValue: !0 },
|
|
69
|
-
id: { aliases: ["id"], takesValue: !0 },
|
|
70
|
-
"dry-run": ["dry-run", "dry"],
|
|
71
|
-
"vcs-host": { aliases: ["vcs-host", "host", "vcs-source"], takesValue: !0 },
|
|
72
|
-
url: { aliases: ["url"], takesValue: !0 }
|
|
73
|
-
}), r = {
|
|
74
|
-
host: e["vcs-host"] || void 0,
|
|
75
|
-
url: e.url,
|
|
76
|
-
ref: e.done
|
|
77
|
-
}, n = await w(r);
|
|
78
|
-
return (await V({
|
|
79
|
-
doneRef: e.done,
|
|
80
|
-
todoId: e.id,
|
|
81
|
-
dryRun: !!e["dry-run"],
|
|
82
|
-
host: e["vcs-host"] || void 0,
|
|
83
|
-
vcsContext: n
|
|
84
|
-
})).code;
|
|
85
|
-
} catch (e) {
|
|
86
|
-
const r = e instanceof Error ? e.message : String(e);
|
|
87
|
-
return console.error(`✖ Ошибка: ${r}`), 1;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
process.exit(await p(process.argv));
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { spawnSync as l } from "node:child_process";
|
|
2
|
-
import { l as d } from "./services-CwvXl2MB.js";
|
|
3
|
-
const m = [
|
|
4
|
-
{ name: "format", mutates: !0 },
|
|
5
|
-
{ name: "lint", mutates: !0 },
|
|
6
|
-
{ name: "typecheck", mutates: !1 },
|
|
7
|
-
{ name: "test:coverage", mutates: !1 },
|
|
8
|
-
{ name: "yagni", mutates: !1, via: "gennady" }
|
|
9
|
-
], g = {
|
|
10
|
-
code: ["format", "lint", "typecheck", "yagni"],
|
|
11
|
-
test: ["format", "typecheck", "test:coverage"],
|
|
12
|
-
full: ["format", "lint", "typecheck", "test:coverage", "yagni"]
|
|
13
|
-
};
|
|
14
|
-
function p(e) {
|
|
15
|
-
const o = g[e];
|
|
16
|
-
return m.filter((t) => o.includes(t.name));
|
|
17
|
-
}
|
|
18
|
-
function x(e) {
|
|
19
|
-
return e === "code" || e === "test" || e === "full";
|
|
20
|
-
}
|
|
21
|
-
function $(e) {
|
|
22
|
-
return `${(e / 1e3).toFixed(1)}s`;
|
|
23
|
-
}
|
|
24
|
-
function y(e) {
|
|
25
|
-
const o = e.filter((n) => n.exitCode !== 0), t = e.filter((n) => n.exitCode === 0).map((n) => ` ✅ ${n.name} (${$(n.durationMs)})`);
|
|
26
|
-
if (o.length === 0)
|
|
27
|
-
return {
|
|
28
|
-
ok: !0,
|
|
29
|
-
text: [`[verify] ✅ ALL PASS (${e.length}/${e.length})`, ...t].join(`
|
|
30
|
-
`)
|
|
31
|
-
};
|
|
32
|
-
const i = o.map(
|
|
33
|
-
(n) => [
|
|
34
|
-
` ❌ ${n.name} — exit ${n.exitCode}`,
|
|
35
|
-
" --- output ---",
|
|
36
|
-
n.output.trimEnd(),
|
|
37
|
-
" --- end ---"
|
|
38
|
-
].join(`
|
|
39
|
-
`)
|
|
40
|
-
);
|
|
41
|
-
return {
|
|
42
|
-
ok: !1,
|
|
43
|
-
code: "ERR_CLI_SDD_VERIFY_GATE_FAILED",
|
|
44
|
-
exitCode: 1,
|
|
45
|
-
message: [
|
|
46
|
-
`[verify] ${e.length - o.length}/${e.length} passed — ${o.length} FAILED`,
|
|
47
|
-
...t,
|
|
48
|
-
...i
|
|
49
|
-
].join(`
|
|
50
|
-
`)
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function h(e, o) {
|
|
54
|
-
const t = l(e, o, { encoding: "utf-8" });
|
|
55
|
-
return t.error ? { exitCode: 127, output: `${e}: ${t.error.message}` } : { exitCode: t.status ?? 1, output: `${t.stdout ?? ""}${t.stderr ?? ""}` };
|
|
56
|
-
}
|
|
57
|
-
async function C(e, o = "full") {
|
|
58
|
-
const t = [];
|
|
59
|
-
for (const i of p(o)) {
|
|
60
|
-
const n = Date.now(), s = i.via === "gennady" ? e("npx", ["gennady", i.name]) : e("npm", ["run", i.name]), u = Date.now() - n;
|
|
61
|
-
d.debug(`[SddVerifyCommand#run] ${i.name} → exit ${s.exitCode} (${u}ms)`), t.push({ name: i.name, exitCode: s.exitCode, output: s.output, durationMs: u });
|
|
62
|
-
}
|
|
63
|
-
return y(t);
|
|
64
|
-
}
|
|
65
|
-
const a = process.argv.slice(2), f = a.indexOf("--profile"), k = f >= 0 ? a[f + 1] : a.find((e) => e.startsWith("--profile="))?.slice(10), c = k ?? "full";
|
|
66
|
-
x(c) || (console.error(`[verify] unknown --profile '${c}' (expected: code | test | full)`), process.exit(4));
|
|
67
|
-
const r = await C(h, c);
|
|
68
|
-
console.log(r.ok ? r.text : r.message);
|
|
69
|
-
process.exit(r.ok ? 0 : r.exitCode);
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { readFileSync as v, writeFileSync as D, existsSync as x, mkdirSync as S, statSync as T, readdirSync as M } from "node:fs";
|
|
2
|
-
import { resolve as g, relative as C, join as h, dirname as A } from "node:path";
|
|
3
|
-
import { l as j } from "./services-CwvXl2MB.js";
|
|
4
|
-
import { p as F, ad as L, ae as O, af as N, ag as P, ah as V, ai as G, aj as U, ak as W, al as Y, am as b, an as B, ao as K } from "./shared-DSZTUx5b.js";
|
|
5
|
-
const E = "ERR_CLI_SDD_MIGRATE_BAD_INVOCATION";
|
|
6
|
-
function y(a) {
|
|
7
|
-
return {
|
|
8
|
-
ok: !1,
|
|
9
|
-
code: E,
|
|
10
|
-
exitCode: 4,
|
|
11
|
-
message: [
|
|
12
|
-
`[sdd-migrate] ${E}: ${a}`,
|
|
13
|
-
" expected: gennady sdd-migrate anchors (<ticket> | --all [root]) [--write]",
|
|
14
|
-
" or: gennady sdd-migrate plan [root] [--write | --verify]",
|
|
15
|
-
" or: gennady sdd-migrate ids [root] (--map <tsv> | --from-plan) [--write]",
|
|
16
|
-
" or: gennady sdd-migrate move [root] --scope <scope> [--write]",
|
|
17
|
-
" Without --write it is a dry-run (reports what it would change)."
|
|
18
|
-
].join(`
|
|
19
|
-
`)
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function X(a) {
|
|
23
|
-
const e = [], n = (r) => {
|
|
24
|
-
let c;
|
|
25
|
-
try {
|
|
26
|
-
c = M(r, { withFileTypes: !0 });
|
|
27
|
-
} catch {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
for (const d of c) {
|
|
31
|
-
if (d.name.startsWith(".") || d.isSymbolicLink()) continue;
|
|
32
|
-
const l = h(r, d.name);
|
|
33
|
-
d.isDirectory() ? n(l) : d.isFile() && /\.task-[0-9]+\.md$/.test(d.name) && e.push(l);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
try {
|
|
37
|
-
T(h(a, "tasks")).isDirectory() && n(h(a, "tasks"));
|
|
38
|
-
} catch {
|
|
39
|
-
}
|
|
40
|
-
return e;
|
|
41
|
-
}
|
|
42
|
-
function q(a, e) {
|
|
43
|
-
if (e.verify) {
|
|
44
|
-
const s = P(a), t = s.map((u) => ` ERROR ${u.code} ${u.file} — ${u.message}`), i = `[sdd-migrate plan] VERIFY · ${s.length} finding(s)`;
|
|
45
|
-
return s.length === 0 ? { ok: !0, text: `${i}
|
|
46
|
-
план полон и не разошёлся с реальностью` } : {
|
|
47
|
-
ok: !1,
|
|
48
|
-
code: "ERR_CLI_SDD_MIGRATE_PLAN_VERIFY",
|
|
49
|
-
exitCode: 1,
|
|
50
|
-
message: [i, ...t].join(`
|
|
51
|
-
`)
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
const n = V(a), r = [];
|
|
55
|
-
let c = 0;
|
|
56
|
-
for (const s of n.units) {
|
|
57
|
-
const t = G(s), i = h(a, t), u = U(s), w = x(i);
|
|
58
|
-
e.write ? (S(A(i), { recursive: !0 }), D(i, u, "utf-8"), c++, r.push(` ${w ? "~" : "+"} ${t} — ${s.tickets.length} тикет(ов)`)) : r.push(
|
|
59
|
-
` would ${t} — ${s.tickets.length} тикет(ов)${w ? " (перезапишет)" : ""}`
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
e.write && D(h(a, "migration", "README.md"), W(n), "utf-8");
|
|
63
|
-
for (const s of n.orphanTickets) r.push(` ⚠ orphan ${s.file} — scope без спеки`);
|
|
64
|
-
const d = `[sdd-migrate plan] ${e.write ? "WRITE" : "DRY-RUN"} · ${n.units.length} юнит(ов), ${n.orphanTickets.length} orphan`, l = e.write ? `
|
|
65
|
-
${c} + README записаны. Дальше: заполнить карты юнитов, затем sdd-migrate plan --verify` : `
|
|
66
|
-
(dry-run — повторить с --write, чтобы записать слой migration/)`;
|
|
67
|
-
return { ok: !0, text: [d, ...r, l].join(`
|
|
68
|
-
`) };
|
|
69
|
-
}
|
|
70
|
-
function z(a, e) {
|
|
71
|
-
let n;
|
|
72
|
-
if (e.fromPlan) {
|
|
73
|
-
const t = Y(a);
|
|
74
|
-
if (!t.ok)
|
|
75
|
-
return {
|
|
76
|
-
ok: !1,
|
|
77
|
-
code: "ERR_CLI_SDD_MIGRATE_IDS_FROM_PLAN",
|
|
78
|
-
exitCode: 1,
|
|
79
|
-
message: [
|
|
80
|
-
"[sdd-migrate ids] --from-plan — невалидные строки Ticket Map:",
|
|
81
|
-
...t.errors.map((i) => ` ${i}`)
|
|
82
|
-
].join(`
|
|
83
|
-
`)
|
|
84
|
-
};
|
|
85
|
-
n = t.tsv;
|
|
86
|
-
} else if (e.mapFile)
|
|
87
|
-
n = v(g(e.mapFile), "utf-8");
|
|
88
|
-
else
|
|
89
|
-
return y("ids needs --map <tsv> or --from-plan");
|
|
90
|
-
const r = b(n);
|
|
91
|
-
if (!r.ok)
|
|
92
|
-
return {
|
|
93
|
-
ok: !1,
|
|
94
|
-
code: "ERR_CLI_SDD_MIGRATE_IDS_MAP",
|
|
95
|
-
exitCode: 1,
|
|
96
|
-
message: [
|
|
97
|
-
`[sdd-migrate ids] карта невалидна — ${r.errors.length} проблем(ы):`,
|
|
98
|
-
...r.errors.map((t) => ` ${t}`)
|
|
99
|
-
].join(`
|
|
100
|
-
`)
|
|
101
|
-
};
|
|
102
|
-
if (r.map.length === 0)
|
|
103
|
-
return {
|
|
104
|
-
ok: !0,
|
|
105
|
-
text: "[sdd-migrate ids] карта пуста — заменять нечего (заполни Ticket Map юнитов)"
|
|
106
|
-
};
|
|
107
|
-
const c = B(a, r.map, e.write), d = c.map(
|
|
108
|
-
(t) => ` ${e.write ? "~" : "would"} ${t.file} — ${t.count} замен(ы)`
|
|
109
|
-
), l = c.reduce((t, i) => t + i.count, 0), s = `[sdd-migrate ids] ${e.write ? "WRITE" : "DRY-RUN"} · ${r.map.length} ID · ${l} вхождений в ${c.length} файл(ах)`;
|
|
110
|
-
if (e.write) {
|
|
111
|
-
const t = K(a, r.map);
|
|
112
|
-
return t.length > 0 ? {
|
|
113
|
-
ok: !1,
|
|
114
|
-
code: "ERR_CLI_SDD_MIGRATE_IDS_LEFTOVER",
|
|
115
|
-
exitCode: 1,
|
|
116
|
-
message: [
|
|
117
|
-
s,
|
|
118
|
-
...d,
|
|
119
|
-
" ГЕЙТ ПРОВАЛЕН — старые ID остались:",
|
|
120
|
-
...t.map((i) => ` ${i.id} в ${i.file}`)
|
|
121
|
-
].join(`
|
|
122
|
-
`)
|
|
123
|
-
} : {
|
|
124
|
-
ok: !0,
|
|
125
|
-
text: [s, ...d, `
|
|
126
|
-
Гейт: ноль старых ID в зонах ✅. Дальше: sdd-check --all`].join(
|
|
127
|
-
`
|
|
128
|
-
`
|
|
129
|
-
)
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
ok: !0,
|
|
134
|
-
text: [s, ...d, `
|
|
135
|
-
(dry-run — повторить с --write, чтобы применить)`].join(`
|
|
136
|
-
`)
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
async function H(a) {
|
|
140
|
-
const e = F(a, {
|
|
141
|
-
all: ["all"],
|
|
142
|
-
write: ["write"],
|
|
143
|
-
verify: ["verify"],
|
|
144
|
-
map: { aliases: ["map"], takesValue: !0 },
|
|
145
|
-
scope: { aliases: ["scope"], takesValue: !0 },
|
|
146
|
-
"from-plan": ["from-plan"]
|
|
147
|
-
}), n = e._.filter(
|
|
148
|
-
(o) => typeof o == "string" && o !== "sdd-migrate"
|
|
149
|
-
), r = n[0];
|
|
150
|
-
if (r === "plan") {
|
|
151
|
-
const o = g(n[1] ?? ".");
|
|
152
|
-
return q(o, {
|
|
153
|
-
verify: e.verify === !0 || e.verify === "true",
|
|
154
|
-
write: e.write === !0 || e.write === "true"
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
if (r === "ids") {
|
|
158
|
-
const o = g(n[1] ?? ".");
|
|
159
|
-
return z(o, {
|
|
160
|
-
mapFile: typeof e.map == "string" ? e.map : null,
|
|
161
|
-
fromPlan: e["from-plan"] === !0 || e["from-plan"] === "true",
|
|
162
|
-
write: e.write === !0 || e.write === "true"
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
if (r === "move") {
|
|
166
|
-
const o = typeof e.scope == "string" ? e.scope : null;
|
|
167
|
-
if (!o) return y("move needs --scope <scope>");
|
|
168
|
-
const f = g(n[1] ?? "."), m = e.write === !0 || e.write === "true", p = L(f, o, m);
|
|
169
|
-
if (!p.ok)
|
|
170
|
-
return {
|
|
171
|
-
ok: !1,
|
|
172
|
-
code: "ERR_CLI_SDD_MIGRATE_MOVE_BLOCKED",
|
|
173
|
-
exitCode: 1,
|
|
174
|
-
message: [
|
|
175
|
-
`[sdd-migrate move] scope «${o}» заблокирован — ${p.errors.length} проблем(ы):`,
|
|
176
|
-
...p.errors.map((k) => ` ${k}`)
|
|
177
|
-
].join(`
|
|
178
|
-
`)
|
|
179
|
-
};
|
|
180
|
-
const R = `[sdd-migrate move] ${m ? "WRITE" : "DRY-RUN"} · scope ${o}`, _ = m ? `
|
|
181
|
-
Дальше: sdd-check --all specs/` + o + " (строгий v2-гейт scope)" : `
|
|
182
|
-
(dry-run — повторить с --write, чтобы применить)`;
|
|
183
|
-
return { ok: !0, text: [R, ...p.report, _].join(`
|
|
184
|
-
`) };
|
|
185
|
-
}
|
|
186
|
-
if (r !== "anchors")
|
|
187
|
-
return y(`unknown mode "${r ?? ""}" — supported: anchors, plan, ids, move`);
|
|
188
|
-
const c = e.write === !0 || e.write === "true", d = e.all === !0 || e.all === "true";
|
|
189
|
-
let l;
|
|
190
|
-
if (d)
|
|
191
|
-
l = X(g(n[1] ?? "."));
|
|
192
|
-
else {
|
|
193
|
-
const o = n[1];
|
|
194
|
-
if (!o) return y("need a <ticket> path or --all");
|
|
195
|
-
l = [g(o)];
|
|
196
|
-
}
|
|
197
|
-
const s = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), t = [];
|
|
198
|
-
let i = 0;
|
|
199
|
-
for (const o of l) {
|
|
200
|
-
const f = C(process.cwd(), o);
|
|
201
|
-
let m;
|
|
202
|
-
try {
|
|
203
|
-
m = v(o, "utf-8");
|
|
204
|
-
} catch {
|
|
205
|
-
t.push(` ERR ${f} — cannot read`);
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
const { text: p, injected: R } = O(m), { text: _, scaffolded: k } = N(p, s);
|
|
209
|
-
if (R.length === 0 && !k) {
|
|
210
|
-
t.push(` skip ${f} — already anchored / no canonical sections`);
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
const I = [...R];
|
|
214
|
-
k && I.push("EXECUTION_LOG (scaffolded — v1 ticket had none)"), c ? (D(o, _, "utf-8"), i++, t.push(` + ${f} — ${I.join(", ")}`)) : t.push(` would ${f} — ${I.join(", ")}`);
|
|
215
|
-
}
|
|
216
|
-
j.debug(
|
|
217
|
-
`[SddMigrateCommand#run] anchors ${c ? "write" : "dry-run"} over ${l.length} ticket(s)`
|
|
218
|
-
);
|
|
219
|
-
const u = `[sdd-migrate anchors] ${c ? "WRITE" : "DRY-RUN"} · ${l.length} ticket(s)`, w = c ? `
|
|
220
|
-
${i} written. Verify: gennady sdd-check --all` : `
|
|
221
|
-
(dry-run — re-run with --write to apply)`;
|
|
222
|
-
return { ok: !0, text: [u, ...t, w].join(`
|
|
223
|
-
`) };
|
|
224
|
-
}
|
|
225
|
-
const $ = await H(process.argv);
|
|
226
|
-
console.log($.ok ? $.text : $.message);
|
|
227
|
-
process.exit($.ok ? 0 : $.exitCode);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { p as e, r as t } from "./run-review-command.logic-CU1Slmc_.js";
|
|
2
|
-
import { r as i } from "./shared-B5CTGvpG.js";
|
|
3
|
-
const r = e(process.argv), c = {
|
|
4
|
-
ref: r.ref,
|
|
5
|
-
branch: r.branch,
|
|
6
|
-
project: r.project,
|
|
7
|
-
iid: r.iid ? Number(r.iid) : void 0,
|
|
8
|
-
host: r.host
|
|
9
|
-
};
|
|
10
|
-
try {
|
|
11
|
-
const o = await i(c), s = await t({
|
|
12
|
-
mode: "issues",
|
|
13
|
-
args: r,
|
|
14
|
-
vcsContext: o
|
|
15
|
-
});
|
|
16
|
-
s.output && console.info(s.output), process.exit(s.code);
|
|
17
|
-
} catch (o) {
|
|
18
|
-
const s = o instanceof Error ? o.message : String(o);
|
|
19
|
-
console.error(`✖ Ошибка: ${s}`), process.exit(1);
|
|
20
|
-
}
|