gennady 0.8.2 → 0.8.4
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 +212 -3
- package/ai/agents/agent-resolve-conflicts.xml +148 -3
- package/ai/agents/agent-review-verifier.xml +181 -3
- package/ai/directives/sdd/audit.directive.xml +22 -11
- package/ai/directives/sdd/critic-protocol.xml +3 -0
- package/ai/directives/sdd/critic.directive.xml +25 -3
- package/ai/skills/README.md +150 -0
- package/ai/skills/sdd-check/SKILL.md +19 -9
- package/ai/skills/sdd-execute/scripts/README.md +3 -0
- package/ai/skills/sdd-execute/scripts/_sdd-lib.sh +60 -0
- package/ai/skills/sdd-execute/scripts/check.sh +238 -0
- package/ai/skills/sdd-execute/scripts/sdd +12 -0
- package/ai/skills/sdd-hooks-install/SKILL.md +88 -0
- package/ai/skills/workspace-permission-setup/SKILL.md +193 -0
- package/cli/cmd/README.md +185 -0
- package/dist/ai/agents/agent-resolve-conflicts.xml +148 -3
- package/dist/ai/agents/agent-review-verifier.xml +181 -3
- package/dist/ai/directives/sdd/audit.directive.xml +22 -11
- package/dist/ai/directives/sdd/critic-protocol.xml +3 -0
- package/dist/ai/directives/sdd/critic.directive.xml +25 -3
- package/dist/ai/skills/README.md +150 -0
- package/dist/ai/skills/sdd-check/SKILL.md +19 -9
- package/dist/ai/skills/sdd-execute/scripts/README.md +3 -0
- package/dist/ai/skills/sdd-execute/scripts/_sdd-lib.sh +60 -0
- package/dist/ai/skills/sdd-execute/scripts/check.sh +238 -0
- package/dist/ai/skills/sdd-execute/scripts/sdd +12 -0
- package/dist/ai/skills/sdd-hooks-install/SKILL.md +88 -0
- package/dist/ai/skills/workspace-permission-setup/SKILL.md +193 -0
- package/dist/chunks/index-BHEP1kYv.js +164 -0
- package/dist/chunks/index-DqSFtXFv.js +813 -0
- package/dist/chunks/index-Ukr3nSKB.js +377 -0
- package/dist/cli/cmd/lint/checks/anchor-thin.check.d.ts +11 -0
- package/dist/cli/cmd/lint/lint.cmd.d.ts +1 -1
- package/dist/cli/cmd/lint/lint.types.d.ts +2 -0
- package/dist/gennady.js +4 -4
- package/package.json +1 -1
- package/dist/chunks/index-4fUNp3za.js +0 -156
- package/dist/chunks/index-C9UEDrqg.js +0 -754
- package/dist/chunks/index-jOIhIHdS.js +0 -369
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
import { readdirSync as $, statSync as v, readFileSync as N, rmdirSync as U, unlinkSync as O, mkdirSync as x, writeFileSync as T } from "node:fs";
|
|
2
|
-
import { join as k, sep as W } from "node:path";
|
|
3
|
-
import { fileURLToPath as K } from "node:url";
|
|
4
|
-
import { l as I } from "./services-IgZptnTi.js";
|
|
5
|
-
import { n as z, d as b, b as B, p as M, r as G } from "./shared-9J_oXE74.js";
|
|
6
|
-
class j {
|
|
7
|
-
/** @purpose List of all synced file entries, sorted lexicographically by skillName then relativePath. */
|
|
8
|
-
entries;
|
|
9
|
-
/**
|
|
10
|
-
* @purpose Construct a SyncSkillsResult from a list of entries.
|
|
11
|
-
* @param entries File entries.
|
|
12
|
-
*/
|
|
13
|
-
constructor(e) {
|
|
14
|
-
this.entries = e;
|
|
15
|
-
}
|
|
16
|
-
/** @purpose Files with status "added". | @returns Array of added entries. */
|
|
17
|
-
get added() {
|
|
18
|
-
return this.entries.filter((e) => e.status === "added");
|
|
19
|
-
}
|
|
20
|
-
/** @purpose Files with status "updated". | @returns Array of updated entries. */
|
|
21
|
-
get updated() {
|
|
22
|
-
return this.entries.filter((e) => e.status === "updated");
|
|
23
|
-
}
|
|
24
|
-
/** @purpose Files with status "deleted". | @returns Array of deleted entries. */
|
|
25
|
-
get deleted() {
|
|
26
|
-
return this.entries.filter((e) => e.status === "deleted");
|
|
27
|
-
}
|
|
28
|
-
/** @purpose Files with status "unchanged". | @returns Array of unchanged entries. */
|
|
29
|
-
get unchanged() {
|
|
30
|
-
return this.entries.filter((e) => e.status === "unchanged");
|
|
31
|
-
}
|
|
32
|
-
/** @purpose Files with status "deleteFailed". | @returns Array of delete-failed entries. */
|
|
33
|
-
get deleteFailed() {
|
|
34
|
-
return this.entries.filter((e) => e.status === "deleteFailed");
|
|
35
|
-
}
|
|
36
|
-
/** @purpose Human-readable summary of sync counts. | @returns Summary string. */
|
|
37
|
-
get summary() {
|
|
38
|
-
const e = this.added.length, r = this.updated.length, a = this.unchanged.length, c = this.deleted.length, i = this.deleteFailed.length;
|
|
39
|
-
let l = `Synced: ${e} added, ${r} updated, ${a} skipped, ${c} deleted`;
|
|
40
|
-
return i > 0 && (l += `, ${i} delete failed`), l;
|
|
41
|
-
}
|
|
42
|
-
/** @purpose Dry-run summary message. | @returns Dry-run message. */
|
|
43
|
-
get dryRunSummary() {
|
|
44
|
-
return "Dry-run: no files written.";
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const P = "ERR_SKILLS_SOURCE_NOT_FOUND", C = "ERR_SKILLS_SKILL_NOT_FOUND", w = /* @__PURE__ */ new Set([".DS_Store"]);
|
|
48
|
-
function H(t, e) {
|
|
49
|
-
const r = $(t).filter((i) => {
|
|
50
|
-
if (i.startsWith(".") || w.has(i)) return !1;
|
|
51
|
-
try {
|
|
52
|
-
return v(k(t, i)).isDirectory();
|
|
53
|
-
} catch {
|
|
54
|
-
return !1;
|
|
55
|
-
}
|
|
56
|
-
}), a = e && e.length > 0 ? e : r;
|
|
57
|
-
for (const i of a)
|
|
58
|
-
if (!r.includes(i)) {
|
|
59
|
-
const l = `[scanSkills] Skill "${i}" not found in source.
|
|
60
|
-
Available: ${r.join(", ")}`, s = new Error(l);
|
|
61
|
-
throw s.code = C, s;
|
|
62
|
-
}
|
|
63
|
-
const c = /* @__PURE__ */ new Map();
|
|
64
|
-
for (const i of a) {
|
|
65
|
-
const l = k(t, i), s = /* @__PURE__ */ new Map();
|
|
66
|
-
L(l, "", void 0, s), c.set(i, s);
|
|
67
|
-
}
|
|
68
|
-
return c;
|
|
69
|
-
}
|
|
70
|
-
function L(t, e, r, a) {
|
|
71
|
-
const c = r ? r.readdir : $, i = r ? r.stat : v, l = r ? r.readFile : N;
|
|
72
|
-
let s;
|
|
73
|
-
try {
|
|
74
|
-
s = c(t);
|
|
75
|
-
} catch {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
for (const d of s) {
|
|
79
|
-
if (d.startsWith(".") || w.has(d)) continue;
|
|
80
|
-
const g = k(t, d), y = e ? k(e, d) : d;
|
|
81
|
-
let n;
|
|
82
|
-
try {
|
|
83
|
-
n = i(g);
|
|
84
|
-
} catch {
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
if (n) {
|
|
88
|
-
if (n.isDirectory())
|
|
89
|
-
L(g, y, r, a);
|
|
90
|
-
else if (n.isFile()) {
|
|
91
|
-
const f = y.split(W).join("/");
|
|
92
|
-
a.set(f, l(g));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function X(t, e, r, a, c, i, l, s) {
|
|
98
|
-
let d;
|
|
99
|
-
if (a ? B(r, a) ? d = "updated" : d = "unchanged" : d = "added", !i && d !== "unchanged") {
|
|
100
|
-
const g = k(c, e);
|
|
101
|
-
s(k(g, ".."), { recursive: !0 }), l(g, r);
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
skillName: t,
|
|
105
|
-
relativePath: e,
|
|
106
|
-
status: d,
|
|
107
|
-
sourceSize: r.length,
|
|
108
|
-
targetSize: a?.length
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
function F(t, e) {
|
|
112
|
-
const r = [];
|
|
113
|
-
let a;
|
|
114
|
-
try {
|
|
115
|
-
a = e.readdir(t);
|
|
116
|
-
} catch {
|
|
117
|
-
return r;
|
|
118
|
-
}
|
|
119
|
-
for (const c of a) {
|
|
120
|
-
if (c.startsWith(".") || w.has(c)) continue;
|
|
121
|
-
const i = k(t, c);
|
|
122
|
-
try {
|
|
123
|
-
const l = e.stat(i);
|
|
124
|
-
l.isDirectory() ? r.push(...F(i, e).map((s) => k(c, s))) : l.isFile() && r.push(c);
|
|
125
|
-
} catch {
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return r;
|
|
129
|
-
}
|
|
130
|
-
function Y(t, e, r, a) {
|
|
131
|
-
const c = k(e, t);
|
|
132
|
-
let i = [];
|
|
133
|
-
try {
|
|
134
|
-
i = F(c, a);
|
|
135
|
-
} catch {
|
|
136
|
-
}
|
|
137
|
-
if (r) {
|
|
138
|
-
const y = [
|
|
139
|
-
{
|
|
140
|
-
skillName: t,
|
|
141
|
-
relativePath: "",
|
|
142
|
-
status: "deleted",
|
|
143
|
-
sourceSize: void 0,
|
|
144
|
-
targetSize: void 0
|
|
145
|
-
}
|
|
146
|
-
];
|
|
147
|
-
for (const n of i.sort())
|
|
148
|
-
y.push({
|
|
149
|
-
skillName: t,
|
|
150
|
-
relativePath: n,
|
|
151
|
-
status: "deleted",
|
|
152
|
-
sourceSize: void 0,
|
|
153
|
-
targetSize: void 0
|
|
154
|
-
});
|
|
155
|
-
return y;
|
|
156
|
-
}
|
|
157
|
-
const l = a.unlink ?? (() => {
|
|
158
|
-
}), s = a.rmdir ?? (() => {
|
|
159
|
-
});
|
|
160
|
-
let d = !1, g;
|
|
161
|
-
for (const y of i) {
|
|
162
|
-
const n = k(c, y);
|
|
163
|
-
try {
|
|
164
|
-
l(n);
|
|
165
|
-
} catch (f) {
|
|
166
|
-
d = !0, g = f.code ?? "UNKNOWN";
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
try {
|
|
170
|
-
s(c, { recursive: !0 });
|
|
171
|
-
} catch (y) {
|
|
172
|
-
d = !0, g = y.code ?? "UNKNOWN";
|
|
173
|
-
}
|
|
174
|
-
return d ? [
|
|
175
|
-
{
|
|
176
|
-
skillName: t,
|
|
177
|
-
relativePath: "",
|
|
178
|
-
status: "deleteFailed",
|
|
179
|
-
errorCode: g
|
|
180
|
-
}
|
|
181
|
-
] : [
|
|
182
|
-
{
|
|
183
|
-
skillName: t,
|
|
184
|
-
relativePath: "",
|
|
185
|
-
status: "deleted"
|
|
186
|
-
}
|
|
187
|
-
];
|
|
188
|
-
}
|
|
189
|
-
function q(t, e) {
|
|
190
|
-
let r;
|
|
191
|
-
try {
|
|
192
|
-
r = t.stat(e.sourceDir);
|
|
193
|
-
} catch {
|
|
194
|
-
const n = `[collectAndCompareSkills] Source directory not found: ${e.sourceDir}`, f = new Error(n);
|
|
195
|
-
throw f.code = P, f;
|
|
196
|
-
}
|
|
197
|
-
if (!r.isDirectory())
|
|
198
|
-
throw new Error(`[collectAndCompareSkills] sourceDir is not a directory: ${e.sourceDir}`);
|
|
199
|
-
const a = k(e.targetDir, "..");
|
|
200
|
-
try {
|
|
201
|
-
if (t.stat(a).isFile())
|
|
202
|
-
throw new Error("[collectAndCompareSkills] .claude exists but is not a directory");
|
|
203
|
-
} catch (n) {
|
|
204
|
-
if (n.code !== "ENOENT") throw n;
|
|
205
|
-
}
|
|
206
|
-
try {
|
|
207
|
-
t.mkdir(e.targetDir, { recursive: !0 });
|
|
208
|
-
} catch (n) {
|
|
209
|
-
const f = n;
|
|
210
|
-
throw f.code === "EACCES" ? new Error(`[collectAndCompareSkills] cannot write to ${e.targetDir}: ${f.code}`, {
|
|
211
|
-
cause: n
|
|
212
|
-
}) : f.code === "ENOTDIR" ? new Error("[collectAndCompareSkills] .claude exists but is not a directory", {
|
|
213
|
-
cause: n
|
|
214
|
-
}) : n;
|
|
215
|
-
}
|
|
216
|
-
const c = t.writeFile, i = t.mkdir, l = H(e.sourceDir, e.skillNames);
|
|
217
|
-
let s = [];
|
|
218
|
-
try {
|
|
219
|
-
s = t.readdir(e.targetDir).filter((n) => {
|
|
220
|
-
if (n.startsWith(".") || w.has(n)) return !1;
|
|
221
|
-
try {
|
|
222
|
-
return t.stat(k(e.targetDir, n)).isDirectory();
|
|
223
|
-
} catch {
|
|
224
|
-
return !1;
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
} catch {
|
|
228
|
-
}
|
|
229
|
-
const d = [];
|
|
230
|
-
for (const n of [...l.keys()].sort()) {
|
|
231
|
-
const f = l.get(n), o = k(e.targetDir, n);
|
|
232
|
-
let h = /* @__PURE__ */ new Map();
|
|
233
|
-
L(o, "", t, h);
|
|
234
|
-
for (const [p, D] of [...f.entries()].sort(
|
|
235
|
-
([m], [S]) => m.localeCompare(S)
|
|
236
|
-
)) {
|
|
237
|
-
const m = z(D.toString("utf-8"), b), S = Buffer.from(m, "utf-8"), u = h.get(p);
|
|
238
|
-
d.push(
|
|
239
|
-
X(
|
|
240
|
-
n,
|
|
241
|
-
p,
|
|
242
|
-
S,
|
|
243
|
-
u,
|
|
244
|
-
o,
|
|
245
|
-
e.dryRun ?? !1,
|
|
246
|
-
c,
|
|
247
|
-
i
|
|
248
|
-
)
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
|
-
s = s.filter((p) => p !== n);
|
|
252
|
-
}
|
|
253
|
-
const g = e.skillNames, y = g ? s.filter((n) => g.includes(n)) : s;
|
|
254
|
-
for (const n of y.sort())
|
|
255
|
-
d.push(...Y(n, e.targetDir, e.dryRun ?? !1, t));
|
|
256
|
-
return new j(d);
|
|
257
|
-
}
|
|
258
|
-
const J = "(would add)", Q = "(would update)", V = "(would delete)", Z = "(unchanged, skip)", ee = "(unchanged)", E = {
|
|
259
|
-
added: 0,
|
|
260
|
-
updated: 1,
|
|
261
|
-
deleted: 2,
|
|
262
|
-
deleteFailed: 3,
|
|
263
|
-
unchanged: 4
|
|
264
|
-
};
|
|
265
|
-
function te(t, e = {}) {
|
|
266
|
-
const r = e.dryRun === !0;
|
|
267
|
-
if (t.length === 0)
|
|
268
|
-
return r ? ["Dry-run: no files written."] : ["Synced: 0 added, 0 updated, 0 skipped, 0 deleted"];
|
|
269
|
-
const a = /* @__PURE__ */ new Map();
|
|
270
|
-
for (const o of t) {
|
|
271
|
-
let h = a.get(o.skillName);
|
|
272
|
-
h || (h = { entries: [], dominantStatus: "unchanged" }, a.set(o.skillName, h)), h.entries.push(o);
|
|
273
|
-
const p = E[o.status], D = E[h.dominantStatus];
|
|
274
|
-
p < D && (h.dominantStatus = o.status);
|
|
275
|
-
}
|
|
276
|
-
const c = [...a.entries()].sort(([o, h], [p, D]) => {
|
|
277
|
-
const m = E[h.dominantStatus] - E[D.dominantStatus];
|
|
278
|
-
return m !== 0 ? m : o.localeCompare(p);
|
|
279
|
-
}), l = Math.max(...c.map(([o]) => ` _ ${o}/`.length)) + 4, s = [];
|
|
280
|
-
for (const [o, h] of c) {
|
|
281
|
-
const p = h.dominantStatus;
|
|
282
|
-
if (p === "added") {
|
|
283
|
-
const m = ` + ${o}/`;
|
|
284
|
-
s.push(m);
|
|
285
|
-
for (const S of h.entries.sort((u, _) => u.relativePath.localeCompare(_.relativePath)))
|
|
286
|
-
r ? s.push(` ${S.relativePath}`.padEnd(l) + J) : s.push(` ${S.relativePath}`);
|
|
287
|
-
} else if (p === "updated") {
|
|
288
|
-
const m = ` ~ ${o}/`;
|
|
289
|
-
s.push(m);
|
|
290
|
-
const S = h.entries.filter((u) => u.status === "added" || u.status === "updated").sort((u, _) => u.relativePath.localeCompare(_.relativePath));
|
|
291
|
-
for (const u of S)
|
|
292
|
-
r ? s.push(` ${u.relativePath}`.padEnd(l) + Q) : s.push(` ${u.relativePath}`);
|
|
293
|
-
} else if (p === "deleted") {
|
|
294
|
-
const m = ` - ${o}/`;
|
|
295
|
-
r ? s.push(m.padEnd(l) + V) : s.push(m);
|
|
296
|
-
for (const S of h.entries.filter((u) => u.relativePath !== "").sort((u, _) => u.relativePath.localeCompare(_.relativePath)))
|
|
297
|
-
s.push(` ${S.relativePath}`);
|
|
298
|
-
} else if (p === "deleteFailed") {
|
|
299
|
-
const m = h.entries.find((u) => u.errorCode)?.errorCode ?? "UNKNOWN", S = ` ! ${o}/`;
|
|
300
|
-
s.push(S.padEnd(l) + `(delete failed: ${m})`);
|
|
301
|
-
} else {
|
|
302
|
-
const m = ` = ${o}/`, S = r ? Z : ee;
|
|
303
|
-
s.push(m.padEnd(l) + S);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
const d = t.filter((o) => o.status === "added").length, g = t.filter((o) => o.status === "updated").length, y = t.filter((o) => o.status === "unchanged").length, n = t.filter((o) => o.status === "deleted").length, f = t.filter((o) => o.status === "deleteFailed").length;
|
|
307
|
-
if (r)
|
|
308
|
-
s.push("Dry-run: no files written.");
|
|
309
|
-
else {
|
|
310
|
-
let o = `Synced: ${d} added, ${g} updated, ${y} skipped, ${n} deleted`;
|
|
311
|
-
f > 0 && (o += `, ${f} delete failed`), s.push(o);
|
|
312
|
-
}
|
|
313
|
-
return s;
|
|
314
|
-
}
|
|
315
|
-
function re(t, e, r, a) {
|
|
316
|
-
r.write(`Sync skills${e ? " (dry-run)" : ""}: ${a}
|
|
317
|
-
`);
|
|
318
|
-
const c = te(t, { dryRun: e });
|
|
319
|
-
for (const i of c)
|
|
320
|
-
r.write(i + `
|
|
321
|
-
`);
|
|
322
|
-
}
|
|
323
|
-
function R(t, e) {
|
|
324
|
-
const r = N, a = T, c = x, i = v, l = $, s = O, d = U, g = G, y = process.stdout, n = process.stderr, f = M(t, {
|
|
325
|
-
dryRun: ["dry-run"]
|
|
326
|
-
}), o = f.dryRun === !0 || f.dryRun === "true", h = f._.filter(
|
|
327
|
-
(u) => typeof u == "string" && u !== "sync-skills"
|
|
328
|
-
), p = process.cwd(), D = g(p, "ai/skills");
|
|
329
|
-
if (!D)
|
|
330
|
-
return n.write(`Error: gennady package not found. Install it locally: npm i -D gennady
|
|
331
|
-
`), 1;
|
|
332
|
-
const m = k(p, ".claude", "skills"), S = {
|
|
333
|
-
sourceDir: D,
|
|
334
|
-
targetDir: m,
|
|
335
|
-
skillNames: h.length > 0 ? h : void 0,
|
|
336
|
-
dryRun: o
|
|
337
|
-
};
|
|
338
|
-
try {
|
|
339
|
-
const _ = q({
|
|
340
|
-
readFile: r,
|
|
341
|
-
writeFile: a,
|
|
342
|
-
mkdir: c,
|
|
343
|
-
stat: (A) => i(A),
|
|
344
|
-
readdir: l,
|
|
345
|
-
unlink: s,
|
|
346
|
-
rmdir: d,
|
|
347
|
-
resolvePackageDir: g
|
|
348
|
-
}, S);
|
|
349
|
-
return re(_.entries, o, y, p), 0;
|
|
350
|
-
} catch (u) {
|
|
351
|
-
const _ = u;
|
|
352
|
-
if (_.code === C || _.code === P)
|
|
353
|
-
return n.write(`Error: ${_.message}
|
|
354
|
-
`), 1;
|
|
355
|
-
throw _;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
if (process.argv[1]) {
|
|
359
|
-
const t = K(import.meta.url);
|
|
360
|
-
if (t === process.argv[1] || t.endsWith(process.argv[1]))
|
|
361
|
-
try {
|
|
362
|
-
const e = R(process.argv);
|
|
363
|
-
process.exit(e);
|
|
364
|
-
} catch (e) {
|
|
365
|
-
const r = new Error("[syncSkillsCmd] Self-execution failed", { cause: e });
|
|
366
|
-
I.error("[syncSkillsCmd#run] [self-executing → failed]", { error: r }), process.exit(1);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
process.exit(R(process.argv));
|