@seanyao/roll 3.609.2 → 3.610.2

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.
Files changed (103) hide show
  1. package/CHANGELOG.md +44 -1
  2. package/README.md +5 -6
  3. package/dist/roll.mjs +16146 -16186
  4. package/package.json +3 -2
  5. package/skills/README.md +14 -1
  6. package/skills/docs/skill-authoring.md +66 -0
  7. package/skills/reports/skill-audit-summary.md +53 -0
  8. package/skills/roll-.changelog/SKILL.md +25 -443
  9. package/skills/roll-.changelog/references/full-contract.md +462 -0
  10. package/skills/roll-.clarify/SKILL.md +6 -4
  11. package/skills/roll-.dream/SKILL.md +26 -353
  12. package/skills/roll-.dream/references/full-contract.md +365 -0
  13. package/skills/roll-.echo/SKILL.md +6 -4
  14. package/skills/roll-.qa/SKILL.md +25 -236
  15. package/skills/roll-.qa/references/full-contract.md +256 -0
  16. package/skills/roll-.review/SKILL.md +6 -2
  17. package/skills/roll-brief/SKILL.md +6 -8
  18. package/skills/roll-build/SKILL.md +28 -864
  19. package/skills/roll-build/references/full-contract.md +883 -0
  20. package/skills/roll-debug/SKILL.md +26 -585
  21. package/skills/roll-debug/references/full-contract.md +607 -0
  22. package/skills/roll-design/SKILL.md +28 -903
  23. package/skills/roll-design/references/full-contract.md +923 -0
  24. package/skills/roll-doc/SKILL.md +25 -574
  25. package/skills/roll-doc/references/full-contract.md +594 -0
  26. package/skills/roll-doctor/SKILL.md +21 -2
  27. package/skills/roll-fix/SKILL.md +28 -621
  28. package/skills/roll-fix/references/full-contract.md +640 -0
  29. package/skills/roll-idea/SKILL.md +6 -2
  30. package/skills/roll-loop/SKILL.md +27 -543
  31. package/skills/roll-loop/references/full-contract.md +555 -0
  32. package/skills/roll-notes/SKILL.md +6 -2
  33. package/skills/roll-onboard/SKILL.md +6 -2
  34. package/skills/roll-peer/SKILL.md +27 -316
  35. package/skills/roll-peer/references/full-contract.md +329 -0
  36. package/skills/roll-propose/SKILL.md +6 -8
  37. package/skills/roll-review-pr/SKILL.md +6 -2
  38. package/skills/roll-sentinel/SKILL.md +26 -344
  39. package/skills/roll-sentinel/references/full-contract.md +363 -0
  40. package/skills/roll-spar/SKILL.md +27 -269
  41. package/skills/roll-spar/references/full-contract.md +288 -0
  42. package/skills/route-cases/skills.json +235 -0
  43. package/skills/scripts/audit-skills.mjs +272 -0
  44. package/skills/scripts/test-audit-skills.mjs +39 -0
  45. package/skills/tests/fixtures/skill-audit/block-skill/SKILL.md +12 -0
  46. package/skills/tests/fixtures/skill-audit/minimal-skill/SKILL.md +8 -0
  47. package/skills/tests/fixtures/skill-audit/quoted-skill/SKILL.md +10 -0
  48. package/skills/tests/fixtures/skill-audit/route-cases.json +21 -0
  49. package/skills/tests/fixtures/skill-audit/spoke-skill/SKILL.md +12 -0
  50. package/skills/tests/fixtures/skill-audit/spoke-skill/references/runbook.md +3 -0
  51. package/bin/roll +0 -15361
  52. package/lib/backfill-pi-usage.py +0 -243
  53. package/lib/changelog_audit.py +0 -149
  54. package/lib/changelog_generate.py +0 -470
  55. package/lib/consistency_check.py +0 -409
  56. package/lib/context_feed_budget.sh +0 -194
  57. package/lib/github_sync.py +0 -876
  58. package/lib/i18n/slides.sh +0 -3
  59. package/lib/i18n/slides_build.sh +0 -38
  60. package/lib/i18n/slides_delete.sh +0 -19
  61. package/lib/i18n/slides_list.sh +0 -14
  62. package/lib/i18n/slides_logs.sh +0 -12
  63. package/lib/i18n/slides_new.sh +0 -15
  64. package/lib/i18n/slides_preview.sh +0 -14
  65. package/lib/i18n/slides_templates.sh +0 -7
  66. package/lib/i18n.sh +0 -211
  67. package/lib/loop-exit-summary.py +0 -393
  68. package/lib/loop-fmt.py +0 -589
  69. package/lib/loop_pick_agent.py +0 -316
  70. package/lib/loop_result_eval.py +0 -469
  71. package/lib/loop_unstick.py +0 -180
  72. package/lib/model_prices.py +0 -194
  73. package/lib/prices_fetcher.py +0 -534
  74. package/lib/roll-backlog.py +0 -225
  75. package/lib/roll-brief.py +0 -286
  76. package/lib/roll-help.py +0 -158
  77. package/lib/roll-home.py +0 -556
  78. package/lib/roll-init.py +0 -156
  79. package/lib/roll-loop-status.py +0 -1691
  80. package/lib/roll-loop-story.py +0 -191
  81. package/lib/roll-peer.py +0 -252
  82. package/lib/roll-setup.py +0 -102
  83. package/lib/roll-status.py +0 -367
  84. package/lib/roll_git.py +0 -41
  85. package/lib/roll_render.py +0 -414
  86. package/lib/slides/components/README.md +0 -123
  87. package/lib/slides/components/cards-2.html +0 -9
  88. package/lib/slides/components/cards-3.html +0 -9
  89. package/lib/slides/components/cards-4.html +0 -9
  90. package/lib/slides/components/compare.html +0 -22
  91. package/lib/slides/components/highlight.html +0 -9
  92. package/lib/slides/components/pipeline.html +0 -12
  93. package/lib/slides/components/plain.html +0 -7
  94. package/lib/slides/components/quote.html +0 -4
  95. package/lib/slides/components/timeline.html +0 -9
  96. package/lib/slides/templates/introduction-v3.html +0 -571
  97. package/lib/slides/templates/pitch.html +0 -0
  98. package/lib/slides-render.py +0 -778
  99. package/lib/slides-validate.py +0 -357
  100. package/lib/test_quality_gate.py +0 -143
  101. package/skills/roll-deck/SKILL.md +0 -296
  102. /package/skills/roll-debug/{injectable-bb.js → assets/injectable-bb.js} +0 -0
  103. /package/skills/roll-design/{ENGINEERING_CHECKLIST.md → references/engineering-checklist.md} +0 -0
@@ -0,0 +1,272 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ function readText(file) {
8
+ return fs.readFileSync(file, "utf8");
9
+ }
10
+
11
+ function stripYamlQuotes(value) {
12
+ const trimmed = value.trim();
13
+ if (
14
+ (trimmed.startsWith('"') && trimmed.endsWith('"')) ||
15
+ (trimmed.startsWith("'") && trimmed.endsWith("'"))
16
+ ) {
17
+ return trimmed.slice(1, -1);
18
+ }
19
+ return trimmed;
20
+ }
21
+
22
+ export function parseFrontmatter(text) {
23
+ if (!text.startsWith("---\n")) {
24
+ return { fields: {}, body: text, ok: false };
25
+ }
26
+
27
+ const end = text.indexOf("\n---", 4);
28
+ if (end === -1) {
29
+ return { fields: {}, body: text, ok: false };
30
+ }
31
+
32
+ const raw = text.slice(4, end);
33
+ const bodyStart = text.indexOf("\n", end + 4);
34
+ const body = bodyStart === -1 ? "" : text.slice(bodyStart + 1);
35
+ const fields = {};
36
+ const lines = raw.split(/\r?\n/);
37
+
38
+ for (let index = 0; index < lines.length; index += 1) {
39
+ const line = lines[index];
40
+ const blockMatch = line.match(/^([A-Za-z0-9_.-]+):\s*\|\s*$/);
41
+ if (blockMatch) {
42
+ const key = blockMatch[1];
43
+ const blockLines = [];
44
+ index += 1;
45
+ while (index < lines.length) {
46
+ const next = lines[index];
47
+ if (/^\S[^:]*:/.test(next)) {
48
+ index -= 1;
49
+ break;
50
+ }
51
+ blockLines.push(next.replace(/^ ?/, ""));
52
+ index += 1;
53
+ }
54
+ fields[key] = blockLines.join("\n").trim();
55
+ continue;
56
+ }
57
+
58
+ const scalarMatch = line.match(/^([A-Za-z0-9_.-]+):\s*(.*)$/);
59
+ if (scalarMatch) {
60
+ fields[scalarMatch[1]] = stripYamlQuotes(scalarMatch[2]);
61
+ }
62
+ }
63
+
64
+ return { fields, body, ok: true };
65
+ }
66
+
67
+ export function wordCount(text) {
68
+ const words = text.trim().split(/\s+/).filter(Boolean);
69
+ return words.length;
70
+ }
71
+
72
+ function walkFiles(dir) {
73
+ if (!fs.existsSync(dir)) return [];
74
+ return fs
75
+ .readdirSync(dir, { withFileTypes: true })
76
+ .flatMap((entry) => {
77
+ const full = path.join(dir, entry.name);
78
+ if (entry.isDirectory()) return walkFiles(full);
79
+ if (entry.isFile()) return [full];
80
+ return [];
81
+ });
82
+ }
83
+
84
+ function toPosix(relativePath) {
85
+ return relativePath.split(path.sep).join("/");
86
+ }
87
+
88
+ function collectSpokeFiles(skillDir) {
89
+ return ["references", "assets", "scripts"].flatMap((dirName) => {
90
+ const base = path.join(skillDir, dirName);
91
+ return walkFiles(base).map((file) => toPosix(path.relative(skillDir, file)));
92
+ });
93
+ }
94
+
95
+ function collectReferencedSpokes(body) {
96
+ const refs = new Set();
97
+ const patterns = [
98
+ /\]\(((?:references|assets|scripts)\/[^)#\s]+)(?:#[^)]+)?\)/g,
99
+ /`((?:references|assets|scripts)\/[^`#]+)(?:#[^`]*)?`/g,
100
+ ];
101
+
102
+ for (const pattern of patterns) {
103
+ for (const match of body.matchAll(pattern)) {
104
+ refs.add(match[1].replace(/^\.\//, ""));
105
+ }
106
+ }
107
+
108
+ return [...refs].sort();
109
+ }
110
+
111
+ export function parseSkillFile(file) {
112
+ const text = readText(file);
113
+ const { fields, body, ok } = parseFrontmatter(text);
114
+ const skillDir = path.dirname(file);
115
+ const description = fields.description ?? "";
116
+ const spokeFiles = collectSpokeFiles(skillDir);
117
+ const referencedSpokes = collectReferencedSpokes(body);
118
+
119
+ return {
120
+ name: fields.name ?? path.basename(skillDir),
121
+ file,
122
+ frontmatterOk: ok,
123
+ lines: text.trimEnd().split(/\r?\n/).length,
124
+ description,
125
+ descriptionWordCount: wordCount(description),
126
+ descriptionLoadTrigger: /^Load when\b/i.test(description),
127
+ hasWhenNotToUse: /^##\s+When Not to Use\b/im.test(body),
128
+ hasGotchas: /^##\s+(Gotchas|Known Failure Modes)\b/im.test(body),
129
+ hasReviewedWaiver: /Reviewed Waiver:/i.test(body),
130
+ auxiliaryDirs: ["scripts", "references", "assets"].filter((dirName) =>
131
+ fs.existsSync(path.join(skillDir, dirName)),
132
+ ),
133
+ spokeFiles,
134
+ referencedSpokes,
135
+ missingSpokeRefs: referencedSpokes.filter((ref) => !spokeFiles.includes(ref)),
136
+ unreferencedSpokes: spokeFiles.filter((filePath) => !referencedSpokes.includes(filePath)),
137
+ };
138
+ }
139
+
140
+ export function findSkillFiles(skillsDir) {
141
+ return fs
142
+ .readdirSync(skillsDir, { withFileTypes: true })
143
+ .filter((entry) => entry.isDirectory())
144
+ .map((entry) => path.join(skillsDir, entry.name, "SKILL.md"))
145
+ .filter((file) => fs.existsSync(file))
146
+ .sort();
147
+ }
148
+
149
+ function loadRouteCases(routeFile) {
150
+ if (!fs.existsSync(routeFile)) {
151
+ return { skills: {} };
152
+ }
153
+ return JSON.parse(readText(routeFile));
154
+ }
155
+
156
+ function routeCoverageFor(skillName, routes) {
157
+ const entry = routes.skills?.[skillName] ?? {};
158
+ const positive = Array.isArray(entry.positive) ? entry.positive : [];
159
+ const negative = Array.isArray(entry.negative) ? entry.negative : [];
160
+ return {
161
+ positive,
162
+ negative,
163
+ hasMinimumCoverage: positive.length >= 2 && negative.length >= 2,
164
+ };
165
+ }
166
+
167
+ function violationsFor(skill, routeCoverage) {
168
+ const violations = [];
169
+
170
+ if (!skill.frontmatterOk) violations.push("frontmatter-missing-or-invalid");
171
+ if (!skill.descriptionLoadTrigger) violations.push("description-not-load-trigger");
172
+ if (skill.descriptionWordCount > 50) violations.push("description-over-50-words");
173
+ if (!routeCoverage.hasMinimumCoverage) violations.push("route-fixture-coverage-missing");
174
+ if (!skill.hasGotchas) violations.push("gotchas-missing");
175
+ if (skill.lines > 250 && !skill.hasReviewedWaiver) violations.push("hub-over-250-lines");
176
+ for (const missing of skill.missingSpokeRefs) violations.push(`missing-spoke-ref:${missing}`);
177
+ for (const extra of skill.unreferencedSpokes) violations.push(`unreferenced-spoke:${extra}`);
178
+
179
+ return violations;
180
+ }
181
+
182
+ export function auditSkills({ skillsDir, routeFile }) {
183
+ const routes = loadRouteCases(routeFile);
184
+ const skills = findSkillFiles(skillsDir).map((file) => {
185
+ const skill = parseSkillFile(file);
186
+ const routeCoverage = routeCoverageFor(skill.name, routes);
187
+ return {
188
+ ...skill,
189
+ routeCoverage: {
190
+ positiveCount: routeCoverage.positive.length,
191
+ negativeCount: routeCoverage.negative.length,
192
+ hasMinimumCoverage: routeCoverage.hasMinimumCoverage,
193
+ },
194
+ violations: violationsFor(skill, routeCoverage),
195
+ };
196
+ });
197
+
198
+ const summary = {
199
+ skills: skills.length,
200
+ violations: skills.reduce((count, skill) => count + skill.violations.length, 0),
201
+ over250: skills.filter((skill) => skill.lines > 250).length,
202
+ withGotchas: skills.filter((skill) => skill.hasGotchas).length,
203
+ loadTriggerDescriptions: skills.filter((skill) => skill.descriptionLoadTrigger).length,
204
+ withAuxiliaryFiles: skills.filter((skill) => skill.spokeFiles.length > 0).length,
205
+ };
206
+
207
+ return { summary, skills };
208
+ }
209
+
210
+ function printHuman(report) {
211
+ console.log(`Skill audit: ${report.summary.skills} skills`);
212
+ console.log(`Load-trigger descriptions: ${report.summary.loadTriggerDescriptions}/${report.summary.skills}`);
213
+ console.log(`Gotchas coverage: ${report.summary.withGotchas}/${report.summary.skills}`);
214
+ console.log(`Skills over 250 lines: ${report.summary.over250}`);
215
+ console.log(`Skills with auxiliary files: ${report.summary.withAuxiliaryFiles}`);
216
+ console.log(`Violations: ${report.summary.violations}`);
217
+
218
+ for (const skill of report.skills) {
219
+ const markers = [];
220
+ markers.push(`${skill.lines} lines`);
221
+ markers.push(`${skill.descriptionWordCount} desc words`);
222
+ markers.push(`${skill.routeCoverage.positiveCount}+/${skill.routeCoverage.negativeCount}- route cases`);
223
+ if (skill.spokeFiles.length > 0) markers.push(`${skill.spokeFiles.length} spokes`);
224
+ const status = skill.violations.length === 0 ? "ok" : skill.violations.join(", ");
225
+ console.log(`- ${skill.name}: ${status} (${markers.join("; ")})`);
226
+ }
227
+ }
228
+
229
+ function parseArgs(argv) {
230
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
231
+ const options = {
232
+ skillsDir: root,
233
+ routeFile: path.join(root, "route-cases", "skills.json"),
234
+ json: false,
235
+ strict: false,
236
+ };
237
+
238
+ for (let index = 0; index < argv.length; index += 1) {
239
+ const arg = argv[index];
240
+ if (arg === "--json") options.json = true;
241
+ else if (arg === "--strict") options.strict = true;
242
+ else if (arg === "--skills-dir") {
243
+ index += 1;
244
+ options.skillsDir = path.resolve(argv[index]);
245
+ } else if (arg === "--routes") {
246
+ index += 1;
247
+ options.routeFile = path.resolve(argv[index]);
248
+ } else {
249
+ throw new Error(`Unknown argument: ${arg}`);
250
+ }
251
+ }
252
+
253
+ return options;
254
+ }
255
+
256
+ async function main() {
257
+ const options = parseArgs(process.argv.slice(2));
258
+ const report = auditSkills(options);
259
+ if (options.json) console.log(JSON.stringify(report, null, 2));
260
+ else printHuman(report);
261
+
262
+ if (options.strict && report.summary.violations > 0) {
263
+ process.exitCode = 1;
264
+ }
265
+ }
266
+
267
+ if (import.meta.url === `file://${process.argv[1]}`) {
268
+ main().catch((error) => {
269
+ console.error(error.message);
270
+ process.exitCode = 1;
271
+ });
272
+ }
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+
3
+ import assert from "node:assert/strict";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { auditSkills, parseSkillFile } from "./audit-skills.mjs";
7
+
8
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
9
+ const fixtureRoot = path.join(root, "tests", "fixtures", "skill-audit");
10
+
11
+ const quoted = parseSkillFile(path.join(fixtureRoot, "quoted-skill", "SKILL.md"));
12
+ assert.equal(quoted.name, "quoted-skill");
13
+ assert.equal(quoted.description, "Load when quoted scalar YAML should parse cleanly.");
14
+ assert.equal(quoted.descriptionLoadTrigger, true);
15
+
16
+ const block = parseSkillFile(path.join(fixtureRoot, "block-skill", "SKILL.md"));
17
+ assert.equal(block.name, "block-skill");
18
+ assert.match(block.description, /Load when block descriptions/);
19
+ assert.equal(block.descriptionLoadTrigger, true);
20
+
21
+ const minimal = parseSkillFile(path.join(fixtureRoot, "minimal-skill", "SKILL.md"));
22
+ assert.equal(minimal.hasGotchas, false);
23
+ assert.equal(minimal.hasWhenNotToUse, false);
24
+
25
+ const spoke = parseSkillFile(path.join(fixtureRoot, "spoke-skill", "SKILL.md"));
26
+ assert.deepEqual(spoke.spokeFiles, ["references/runbook.md"]);
27
+ assert.deepEqual(spoke.referencedSpokes, ["references/runbook.md"]);
28
+ assert.deepEqual(spoke.missingSpokeRefs, []);
29
+ assert.deepEqual(spoke.unreferencedSpokes, []);
30
+
31
+ const report = auditSkills({
32
+ skillsDir: fixtureRoot,
33
+ routeFile: path.join(fixtureRoot, "route-cases.json"),
34
+ });
35
+ assert.equal(report.summary.skills, 4);
36
+ assert.equal(report.skills.find((skill) => skill.name === "minimal-skill").violations.includes("gotchas-missing"), true);
37
+ assert.equal(report.skills.find((skill) => skill.name === "spoke-skill").violations.length, 0);
38
+
39
+ console.log("audit-skills tests passed");
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: block-skill
3
+ description: |
4
+ Load when block descriptions span more than one physical line
5
+ but still describe one routing trigger.
6
+ ---
7
+
8
+ # Block Skill
9
+
10
+ ## Gotchas
11
+
12
+ - Preserve indentation when parsing block descriptions.
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: minimal-skill
3
+ description: "Load when missing optional sections should not crash the audit."
4
+ ---
5
+
6
+ # Minimal Skill
7
+
8
+ This intentionally omits optional sections.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: quoted-skill
3
+ description: "Load when quoted scalar YAML should parse cleanly."
4
+ ---
5
+
6
+ # Quoted Skill
7
+
8
+ ## Gotchas
9
+
10
+ - Keep quoted descriptions parseable without requiring a YAML dependency.
@@ -0,0 +1,21 @@
1
+ {
2
+ "version": 1,
3
+ "skills": {
4
+ "quoted-skill": {
5
+ "positive": ["parse a quoted description", "audit scalar YAML frontmatter"],
6
+ "negative": ["parse block YAML only", "ignore all skill files"]
7
+ },
8
+ "block-skill": {
9
+ "positive": ["parse a block description", "audit multiline YAML frontmatter"],
10
+ "negative": ["parse quoted YAML only", "skip description checks"]
11
+ },
12
+ "minimal-skill": {
13
+ "positive": ["confirm missing optional sections do not crash", "audit a tiny skill"],
14
+ "negative": ["validate spoke references", "require gotchas to parse frontmatter"]
15
+ },
16
+ "spoke-skill": {
17
+ "positive": ["validate spoke references", "find auxiliary runbooks"],
18
+ "negative": ["audit only frontmatter", "ignore references directories"]
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: spoke-skill
3
+ description: "Load when auxiliary files and references need integrity checks."
4
+ ---
5
+
6
+ # Spoke Skill
7
+
8
+ Read [the runbook](references/runbook.md) when executing the full workflow.
9
+
10
+ ## Gotchas
11
+
12
+ - Every spoke file must be referenced by the hub.
@@ -0,0 +1,3 @@
1
+ # Spoke Runbook
2
+
3
+ Fixture-only reference file.