@greenrenge/skills 0.0.0-stage → 0.2.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.
Files changed (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +99 -2
  3. package/bin/cli.mjs +525 -0
  4. package/bin/lib/onboard.mjs +1168 -0
  5. package/bin/lib/probe.mjs +631 -0
  6. package/catalog.json +590 -0
  7. package/package.json +50 -4
  8. package/skills/deck-story/SKILL.md +258 -0
  9. package/skills/deck-story/check-svg-text.mjs +94 -0
  10. package/skills/deck-story/check.mjs +348 -0
  11. package/skills/diagram-router/LICENSE +21 -0
  12. package/skills/diagram-router/SKILL.md +193 -0
  13. package/skills/diagram-router/THIRD_PARTY_NOTICES.md +15 -0
  14. package/skills/diagram-router/references/channels.md +213 -0
  15. package/skills/diagram-router/references/evals.md +85 -0
  16. package/skills/diagram-router/references/gathering.md +101 -0
  17. package/skills/diagram-router/references/prior-art.md +65 -0
  18. package/skills/diagram-router/references/routing.md +166 -0
  19. package/skills/diagram-router/skill-release.json +17 -0
  20. package/skills/frontend-design/SKILL.md +443 -0
  21. package/skills/frontend-design/references/rtl.md +72 -0
  22. package/skills/frontend-design/scripts/.upstream-sha +1 -0
  23. package/skills/frontend-design/scripts/LICENSE +21 -0
  24. package/skills/frontend-design/scripts/README.md +24 -0
  25. package/skills/frontend-design/scripts/gates.md +243 -0
  26. package/skills/frontend-design/scripts/sloplint-render.mjs +1283 -0
  27. package/skills/frontend-design/scripts/sloplint.mjs +4426 -0
  28. package/skills/open-code-review-rules/SKILL.md +59 -0
  29. package/skills/open-code-review-rules/references/ocr-allowlists.json +161 -0
  30. package/skills/open-code-review-rules/references/ocr-rule-semantics.md +39 -0
  31. package/skills/open-code-review-rules/scripts/verify_ocr_rules.py +836 -0
  32. package/skills/plain-english-mode/SKILL.md +41 -0
  33. package/skills/pr-diagram-portfolio/SKILL.md +75 -0
  34. package/skills/pr-diagram-portfolio/references/angle-framework.md +124 -0
  35. package/skills/pr-diagram-portfolio/references/portfolio-delivery.md +79 -0
  36. package/skills/pr-diagram-portfolio/scripts/restore_still_css.py +180 -0
  37. package/skills/pr-lens/LICENSE-upstream +21 -0
  38. package/skills/pr-lens/SKILL.md +99 -0
  39. package/skills/pr-lens/VENDOR.md +47 -0
  40. package/skills/pr-lens/package-lock.json +91 -0
  41. package/skills/pr-lens/package.json +9 -0
  42. package/skills/pr-lens/references/config.md +90 -0
  43. package/skills/pr-lens/references/example.graph.json +580 -0
  44. package/skills/pr-lens/references/graph-document.md +233 -0
  45. package/skills/pr-lens/skill-release.json +16 -0
  46. package/skills/security-remediation-epic/SKILL.md +316 -0
  47. package/skills/security-remediation-epic/prompt-template.md +33 -0
  48. package/skills/skill-maintainer/SKILL.md +99 -0
  49. package/skills/skill-maintainer/references/placement-and-coupling.md +43 -0
  50. package/skills/skill-maintainer/scripts/audit_skills.py +297 -0
  51. package/skills/t3-successor-handoff/SKILL.md +141 -0
  52. package/skills/t3-thread-bridge/SKILL.md +175 -0
  53. package/skills/t3-thread-bridge/references/launch-recipes.md +123 -0
  54. package/skills/t3-thread-bridge/references/ping-back.md +108 -0
  55. package/skills/t3-thread-bridge/scripts/thread_ledger.py +203 -0
  56. package/skills/t3-ticket-orchestrator/SKILL.md +304 -0
  57. package/skills/t3-ticket-orchestrator/references/proving-the-gates.md +63 -0
  58. package/skills/ticket-scheme/SKILL.md +144 -0
  59. package/skills/ulw-plan/SKILL.md +98 -0
  60. package/skills/ulw-plan/references/full-workflow.md +255 -0
  61. package/skills/ulw-plan/references/intent-clear.md +44 -0
  62. package/skills/ulw-plan/references/intent-unclear.md +44 -0
  63. package/skills/ulw-plan/scripts/plan-templates.mjs +180 -0
  64. package/skills/ulw-plan/scripts/scaffold-plan.mjs +187 -0
@@ -0,0 +1,187 @@
1
+ #!/usr/bin/env node
2
+ // scaffold-plan.mjs - generate the ulw-plan draft + plan skeleton deterministically.
3
+ //
4
+ // Zero external dependencies (node:fs/path/process/url builtins only) so it runs
5
+ // byte-identically under `node` and `bun` on macOS, Linux, and Windows with no uv
6
+ // bootstrap, no npm/pip install, and no POSIX-shell or python3 precondition - the
7
+ // two things genuinely not guaranteed on native Windows across the omo harnesses.
8
+ //
9
+ // Usage: node "<skill-root>/scripts/scaffold-plan.mjs" <slug> [--clear|--unclear] [--draft-only] [--review-required] [--reset [--force]]
10
+ //
11
+ // RESUME-SAFE: run it ONCE at plan generation. A plain re-run on an existing
12
+ // ulw-plan artifact is a NO-OP success (it never overwrites your appended todos),
13
+ // so a model resuming after compaction cannot crash the turn or clobber the plan.
14
+ // Destructive overwrite is reserved behind --reset, and --reset refuses to discard
15
+ // a hand-edited file unless --force is also passed.
16
+ //
17
+ // WRITE BOUNDARY: the prometheus-md-only hook gates Write/Edit but NOT Bash, so
18
+ // this node:fs script writes out of band of that hook. It self-guards THIS script's
19
+ // own writes to resolve under .omo/ (it does not, and cannot, contain other Bash
20
+ // commands; it only guarantees the mandated generator never escapes .omo). Mirrors
21
+ // packages/omo-opencode/src/hooks/prometheus-md-only/path-policy.ts.
22
+
23
+ import { lstat, mkdir, writeFile, readFile, realpath } from "node:fs/promises";
24
+ import { dirname, join, relative, resolve, isAbsolute } from "node:path";
25
+ import { pathToFileURL } from "node:url";
26
+ import { FINAL_VERIFICATION_ITEMS, PLAN_SECTION_HEADERS, buildDraft, buildPlanSkeleton } from "./plan-templates.mjs";
27
+
28
+ // The emitted text lives in plan-templates.mjs; re-exported so importers keep one entry point.
29
+ export { FINAL_VERIFICATION_ITEMS, PLAN_SECTION_HEADERS, buildDraft, buildPlanSkeleton };
30
+
31
+ const SLUG_PATTERN = /^[a-z0-9][a-z0-9-]{0,79}$/;
32
+
33
+ export function parseArgs(argv) {
34
+ const rest = argv.slice(2);
35
+ let slug;
36
+ let intent = "unspecified";
37
+ let force = false;
38
+ let reset = false;
39
+ let draftOnly = false;
40
+ let reviewRequired = false;
41
+ for (const arg of rest) {
42
+ if (arg === "--clear") intent = "clear";
43
+ else if (arg === "--unclear") intent = "unclear";
44
+ else if (arg === "--reset") reset = true;
45
+ else if (arg === "--force") force = true;
46
+ else if (arg === "--draft-only") draftOnly = true;
47
+ else if (arg === "--review-required") reviewRequired = true;
48
+ else if (arg.startsWith("--")) throw new Error(`unknown flag: ${arg}`);
49
+ else if (slug === undefined) slug = arg;
50
+ else throw new Error(`unexpected argument: ${arg}`);
51
+ }
52
+ if (!slug) throw new Error('usage: scaffold-plan.mjs <slug> [--clear|--unclear] [--draft-only] [--review-required] [--reset [--force]]');
53
+ if (!SLUG_PATTERN.test(slug)) {
54
+ throw new Error(`invalid slug "${slug}" - use lowercase letters, digits, and hyphens only`);
55
+ }
56
+ return { slug, intent, reset, force, draftOnly, reviewRequired };
57
+ }
58
+
59
+ // Resolve a project-relative path and confine it under .omo/ - the script's own
60
+ // enforcement of the prometheus planner write boundary.
61
+ export function resolveSafeOmoPath(cwd, relPath) {
62
+ const resolved = resolve(cwd, relPath);
63
+ const rel = relative(cwd, resolved);
64
+ if (rel.startsWith("..") || isAbsolute(rel)) {
65
+ throw new Error(`refused: path escapes the workspace root: ${relPath}`);
66
+ }
67
+ if (!/(^|[/\\])\.omo([/\\]|$)/i.test(rel)) {
68
+ throw new Error(`refused: ulw-plan may only write under .omo/: ${relPath}`);
69
+ }
70
+ if (!resolved.toLowerCase().endsWith(".md")) {
71
+ throw new Error(`refused: ulw-plan may only write .md files: ${relPath}`);
72
+ }
73
+ return resolved;
74
+ }
75
+
76
+ function assertContainedPath(parent, child, message) {
77
+ const rel = relative(parent, child);
78
+ if (rel.startsWith("..") || isAbsolute(rel)) {
79
+ throw new Error(message);
80
+ }
81
+ }
82
+
83
+ async function mkdirWithoutSymlinks(dir, stopAt) {
84
+ if (dir === stopAt) return;
85
+ const parent = dirname(dir);
86
+ if (parent === dir || relative(stopAt, dir).startsWith("..") || isAbsolute(relative(stopAt, dir))) {
87
+ throw new Error(`refused: path escapes the workspace root: ${dir}`);
88
+ }
89
+ await mkdirWithoutSymlinks(parent, stopAt);
90
+ const stat = await lstat(dir).catch((err) => {
91
+ if (err && err.code === "ENOENT") return null;
92
+ throw err;
93
+ });
94
+ if (stat) {
95
+ if (stat.isSymbolicLink()) {
96
+ throw new Error(`refused: path component is a symlink: ${dir}`);
97
+ }
98
+ if (!stat.isDirectory()) {
99
+ throw new Error(`refused: path component is not a directory: ${dir}`);
100
+ }
101
+ return;
102
+ }
103
+ await mkdir(dir);
104
+ }
105
+
106
+ async function assertSafeWriteParent(cwd, target) {
107
+ const workspaceReal = await realpath(cwd);
108
+ const workspaceRoot = resolve(cwd);
109
+ const omoRoot = resolve(cwd, ".omo");
110
+ const parent = dirname(target);
111
+ assertContainedPath(workspaceRoot, parent, `refused: path escapes the workspace root: ${target}`);
112
+ assertContainedPath(omoRoot, parent, `refused: ulw-plan may only write under .omo/: ${target}`);
113
+ await mkdirWithoutSymlinks(parent, workspaceRoot);
114
+ const omoReal = await realpath(omoRoot);
115
+ const parentReal = await realpath(parent);
116
+ assertContainedPath(workspaceReal, parentReal, `refused: path escapes the workspace root through symlinks: ${target}`);
117
+ assertContainedPath(omoReal, parentReal, `refused: ulw-plan may only write under .omo/ through real paths: ${target}`);
118
+ }
119
+
120
+ async function assertSafeWriteTarget(target) {
121
+ const stat = await lstat(target).catch((err) => {
122
+ if (err && err.code === "ENOENT") return null;
123
+ throw err;
124
+ });
125
+ if (stat?.isSymbolicLink()) {
126
+ throw new Error(`refused: target is a symlink: ${target}`);
127
+ }
128
+ }
129
+
130
+ // A file this script previously emitted (plan skeleton or draft), used to make a
131
+ // plain re-run a safe no-op instead of a crash or a clobber.
132
+ export function isUlwArtifact(content) {
133
+ const isPlan = content.includes("## TL;DR (For humans)") && content.includes("## Final verification wave");
134
+ const isDraft = content.includes("# Draft:") && content.includes("## Approval gate");
135
+ return isPlan || isDraft;
136
+ }
137
+
138
+ // Resume-safe write: plain re-run on an existing ulw-plan artifact is a no-op
139
+ // success; --reset overwrites but refuses to discard a hand-edited file unless
140
+ // --force is also passed.
141
+ export async function writeGuarded(cwd, relPath, content, { reset = false, force = false } = {}) {
142
+ const target = resolveSafeOmoPath(cwd, relPath);
143
+ await assertSafeWriteParent(cwd, target);
144
+ await assertSafeWriteTarget(target);
145
+ const existing = await readFile(target, "utf8").catch(() => null);
146
+ if (existing && existing.trim() !== "") {
147
+ if (!reset) {
148
+ if (isUlwArtifact(existing)) return { relPath, status: "exists" };
149
+ throw new Error(`refused: ${relPath} exists and is not a ulw-plan artifact (pass --reset to overwrite)`);
150
+ }
151
+ if (existing.trim() !== content.trim() && !force) {
152
+ throw new Error(`refused: ${relPath} has edits that differ from a fresh skeleton; pass --reset --force to discard them`);
153
+ }
154
+ }
155
+ await writeFile(target, content, "utf8");
156
+ return { relPath, status: existing ? "reset" : "created" };
157
+ }
158
+
159
+ export async function scaffold(cwd, { slug, intent, reset = false, force = false, draftOnly = false, reviewRequired = false }) {
160
+ const draftRel = join(".omo", "drafts", `${slug}.md`);
161
+ const draft = await writeGuarded(cwd, draftRel, buildDraft(slug, intent, { reviewRequired }), { reset, force });
162
+ if (draftOnly) return [draft];
163
+ const planRel = join(".omo", "plans", `${slug}.md`);
164
+ const plan = await writeGuarded(cwd, planRel, buildPlanSkeleton(slug, intent), { reset, force });
165
+ return [draft, plan];
166
+ }
167
+
168
+ async function main() {
169
+ const { slug, intent, reset, force, draftOnly, reviewRequired } = parseArgs(process.argv);
170
+ const results = await scaffold(process.cwd(), { slug, intent, reset, force, draftOnly, reviewRequired });
171
+ for (const r of results) process.stdout.write(`${r.status}: ${r.relPath}\n`);
172
+ const created = results.some((r) => r.status !== "exists");
173
+ process.stdout.write(
174
+ draftOnly
175
+ ? `next: record intent, findings, decisions, review state, and the approval gate in the draft; create the plan only after approval.\n`
176
+ : created
177
+ ? `next: record findings/decisions in the draft, then APPEND task batches into the "## Todos" region of the plan; fill "## TL;DR (For humans)" LAST.\n`
178
+ : `skeleton already present - left untouched. APPEND task batches into the "## Todos" region; the human "## TL;DR (For humans)" stays on top.\n`,
179
+ );
180
+ }
181
+
182
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
183
+ await main().catch((err) => {
184
+ process.stderr.write(`${err instanceof Error ? err.message : String(err)}\n`);
185
+ process.exit(1);
186
+ });
187
+ }