@greenrenge/skills 0.2.0 → 0.3.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.
- package/README.md +27 -2
- package/bin/cli.mjs +115 -0
- package/bin/lib/onboard.mjs +12 -1
- package/bin/lib/probe.mjs +151 -0
- package/bin/lib/recipes/index.mjs +57 -0
- package/bin/lib/recipes/security-cron.mjs +1140 -0
- package/catalog.json +63 -2
- package/package.json +4 -3
- package/skills/security-remediation-epic/prompt-template.md +87 -20
- package/skills/ticket-orchestrator/SKILL.md +349 -0
- package/skills/ticket-orchestrator/references/proving-the-gates.md +63 -0
package/README.md
CHANGED
|
@@ -51,10 +51,35 @@ Some skill categories need local tools or environment-specific facts:
|
|
|
51
51
|
- **Open Code Review (`ocr`) CLI** — used by the `ocr` category (`open-code-review`, `open-code-review-delegate`). `onboard` and `doctor --setup-ocr` detect missing `ocr` or unconfigured `~/.opencodereview/config.json`, offer to install `@alibaba-group/open-code-review` globally, and guide `ocr config provider` + `ocr llm test`.
|
|
52
52
|
|
|
53
53
|
- **Host Profile (`~/.agents/rules/host-<hostname>.md`)** — used by diagram/deck skills (`diagram-router`, `archify`, `stack-diagram`, `diagram-design`, `pr-lens`, `deck-story`) to locate your local headless Chromium/Chrome binary, PNG renderer fallback, and scratch temp dir. Always written to **user scope** (and linked into `~/.claude/rules/` if `~/.claude` exists) so machine-specific paths never leak into shared repositories.
|
|
54
|
-
- **Orchestrator Run Contract (`~/.agents/rules/<repo>-contract.md` or `docs/agents/orchestrator-contract.md`)** — used by `t3-ticket-orchestrator` to supply repo-specific `target_branch`, `bootstrap_command`, `verify_targets`, and gate paths.
|
|
54
|
+
- **Orchestrator Run Contract (`~/.agents/rules/<repo>-contract.md` or `docs/agents/orchestrator-contract.md`)** — used by `ticket-orchestrator` and `t3-ticket-orchestrator` to supply repo-specific `target_branch`, `bootstrap_command`, `verify_targets`, and gate paths.
|
|
55
55
|
|
|
56
56
|
Run `npx @greenrenge/skills onboard` or `npx @greenrenge/skills doctor --setup-host` to detect and generate these automatically.
|
|
57
57
|
|
|
58
|
+
## Dedicated recipes (custom CLI flows)
|
|
59
|
+
|
|
60
|
+
Recipes compose an **overlapping, harness-aware slice of skills** alongside a tailored preflight probe, prompt renderer, and scheduler wiring:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# List dedicated recipes
|
|
64
|
+
npx @greenrenge/skills setup
|
|
65
|
+
|
|
66
|
+
# Interactive setup for scheduled security remediation
|
|
67
|
+
npx @greenrenge/skills security-cron
|
|
68
|
+
|
|
69
|
+
# Non-interactive examples across all 5 schedule backends
|
|
70
|
+
npx @greenrenge/skills security-cron --harness t3 --schedule t3 --time 04:00 --yes
|
|
71
|
+
npx @greenrenge/skills security-cron --harness claude --schedule claude-code --yes
|
|
72
|
+
npx @greenrenge/skills security-cron --harness codex --schedule os-cron --os-scheduler systemd --yes
|
|
73
|
+
npx @greenrenge/skills security-cron --harness claude --schedule github-actions --cron "0 2 * * 1" --yes
|
|
74
|
+
npx @greenrenge/skills security-cron --harness generic --schedule prompt-only --yes
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Turnkey GitHub Actions cron:** running `npx @greenrenge/skills security-cron --schedule github-actions` installs the skills into your repo (`skillfold.yaml` + `skillfold.lock`), renders `.agents/prompts/security-remediation.md`, and writes `.github/workflows/security-remediation-cron.yml`. Commit those files and set your provider API key secret (`ANTHROPIC_API_KEY` or `OPENAI_API_KEY`, plus optional `SECURITY_BOT_PAT` for Dependabot API & PR CI triggers) — ready to run on cron or `workflow_dispatch` (with a `dry_run` toggle).
|
|
78
|
+
|
|
79
|
+
| Recipe | Command | Overlapping skills | Schedules |
|
|
80
|
+
|---|---|---|---|
|
|
81
|
+
| `security-cron` — Scheduled Security Remediation | `npx @greenrenge/skills security-cron` | `security-remediation-epic`, `ticket-orchestrator`, `ticket-scheme` (+ optional `t3`, `ocr`) | `t3`, `claude-code`, `os-cron`, `github-actions`, `prompt-only` |
|
|
82
|
+
|
|
58
83
|
## Direct `skillfold` usage
|
|
59
84
|
|
|
60
85
|
Because `package.json` declares an `"agentskills"` map, you can also use `skillfold` directly:
|
|
@@ -70,7 +95,7 @@ npx skillfold add npm:@greenrenge/skills/diagram-router
|
|
|
70
95
|
| `workflow` — Core Workflow & Planning | no | `skill-maintainer`, `ulw-plan`, `plain-english-mode` | Skill maintenance, explore-first planning, and plain-English mode. |
|
|
71
96
|
| `ocr` — Code Review (OCR) | no | `open-code-review-rules`, `open-code-review`, `open-code-review-delegate` | AI-powered diff review and rule auditing with alibaba/open-code-review. Needs `ocr` CLI (`@alibaba-group/open-code-review`). |
|
|
72
97
|
| `diagrams` — Diagrams & Presentations | no | `diagram-router`, `pr-diagram-portfolio`, `deck-story`, `pr-lens`, `archify`, `stack-diagram`, `diagram-design` | Routed architecture, PR delta, portfolio, and slide-deck generation. Uses host profile (`~/.agents/rules/host-*.md`). |
|
|
73
|
-
| `orchestration` — Orchestration & Ticket Delivery | no | `ticket-scheme`, `t3-thread-bridge`, `t3-successor-handoff`, `t3-ticket-orchestrator`, `security-remediation-epic`, `to-spec`, `to-tickets`, `implement`, `tdd`, `code-review`, `handoff` | Spec-to-tickets scheme (with mattpocock/skills), T3 ticket orchestration, handoffs, and security remediation. Uses per-repo Run Contract. |
|
|
98
|
+
| `orchestration` — Orchestration & Ticket Delivery | no | `ticket-scheme`, `t3-thread-bridge`, `t3-successor-handoff`, `ticket-orchestrator`, `t3-ticket-orchestrator`, `security-remediation-epic`, `to-spec`, `to-tickets`, `implement`, `tdd`, `code-review`, `handoff` | Spec-to-tickets scheme (with mattpocock/skills), harness-agnostic & T3 ticket orchestration, handoffs, and security remediation. Uses per-repo Run Contract. |
|
|
74
99
|
| `web-ui` — Frontend & Web UI | yes | `frontend-design`, `modern-web-guidance` | Anti-slop UI design system and modern browser Web API guidance. |
|
|
75
100
|
| `cloudflare` — Cloudflare Workers & CLI | yes | `agents-sdk`, `cf-cli`, `durable-objects`, `frameworks-on-cloudflare`, `nextjs-on-cloudflare`, `workers-best-practices`, `workers-development`, `wrangler` | Cloudflare cf CLI, Wrangler, Workers, Durable Objects, and Agents SDK. |
|
|
76
101
|
|
package/bin/cli.mjs
CHANGED
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
runOnboard,
|
|
39
39
|
} from "./lib/onboard.mjs";
|
|
40
40
|
import { collectToolsToProbe, evaluateRequirements, probeHost } from "./lib/probe.mjs";
|
|
41
|
+
import { hasRecipe, renderRecipesList, runRecipe } from "./lib/recipes/index.mjs";
|
|
41
42
|
|
|
42
43
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
43
44
|
const PKG_ROOT = resolve(__dirname, "..");
|
|
@@ -56,6 +57,8 @@ function usage() {
|
|
|
56
57
|
Usage:
|
|
57
58
|
npx ${pkgJson.name} Start interactive onboarding (TTY)
|
|
58
59
|
npx ${pkgJson.name} onboard [options] Guided category picker + host facts setup
|
|
60
|
+
npx ${pkgJson.name} setup [recipe] [options] Run a dedicated workflow recipe (e.g. security-cron)
|
|
61
|
+
npx ${pkgJson.name} security-cron [options] Shortcut for "setup security-cron"
|
|
59
62
|
npx ${pkgJson.name} list List categories, bundles, and skills
|
|
60
63
|
npx ${pkgJson.name} info <bundle-or-skill> Show category, dependencies, and requirements
|
|
61
64
|
npx ${pkgJson.name} install <name...> [options] Install categories, bundles, or skills
|
|
@@ -78,6 +81,22 @@ Options:
|
|
|
78
81
|
--force Pass --force to skillfold install/update
|
|
79
82
|
--frozen Pass --frozen to skillfold install
|
|
80
83
|
--local Reference bundled skills by local path (testing)
|
|
84
|
+
|
|
85
|
+
Recipe options (for setup / security-cron):
|
|
86
|
+
--harness <name> t3 | claude | codex | opencode | generic
|
|
87
|
+
--schedule <type> t3 | claude-code | os-cron | github-actions | prompt-only
|
|
88
|
+
--cron "<expr>" 5-field cron expression (default: "0 2 * * 1")
|
|
89
|
+
--time "<HH:MM>" Explicit time-of-day override (e.g. 04:00)
|
|
90
|
+
--severity <level> Fix floor: critical | high | medium | low (default: medium)
|
|
91
|
+
--tracker <mode> local | github-issues (default: local)
|
|
92
|
+
--repo <owner/repo> Override detected GitHub owner/repo slug
|
|
93
|
+
--branch <name> Override detected default branch
|
|
94
|
+
--label <name> Optional PR review bot label
|
|
95
|
+
--with-ocr Include open-code-review + rules overlay
|
|
96
|
+
--no-ocr Exclude open-code-review overlay
|
|
97
|
+
--os-scheduler <m> auto | systemd | launchd | crontab (with --schedule os-cron)
|
|
98
|
+
--install-schedule Write generated systemd/launchd unit into user scheduler dir
|
|
99
|
+
--skip-install Generate prompt/schedule files without running skillfold install
|
|
81
100
|
-h, --help Show this help
|
|
82
101
|
-v, --version Show package version
|
|
83
102
|
`);
|
|
@@ -104,6 +123,19 @@ function parseArgs(argv) {
|
|
|
104
123
|
force: false,
|
|
105
124
|
frozen: false,
|
|
106
125
|
local: false,
|
|
126
|
+
harness: null,
|
|
127
|
+
schedule: null,
|
|
128
|
+
cron: null,
|
|
129
|
+
time: null,
|
|
130
|
+
severity: null,
|
|
131
|
+
tracker: null,
|
|
132
|
+
repo: null,
|
|
133
|
+
branch: null,
|
|
134
|
+
label: null,
|
|
135
|
+
withOcr: null,
|
|
136
|
+
osScheduler: null,
|
|
137
|
+
installSchedule: false,
|
|
138
|
+
skipInstall: false,
|
|
107
139
|
help: false,
|
|
108
140
|
version: false,
|
|
109
141
|
};
|
|
@@ -146,6 +178,42 @@ function parseArgs(argv) {
|
|
|
146
178
|
if (!flags.targets) die("--targets requires a comma-separated list");
|
|
147
179
|
} else if (arg.startsWith("--targets=")) {
|
|
148
180
|
flags.targets = arg.slice("--targets=".length);
|
|
181
|
+
} else if (arg === "--with-ocr") {
|
|
182
|
+
flags.withOcr = true;
|
|
183
|
+
} else if (arg === "--no-ocr") {
|
|
184
|
+
flags.withOcr = false;
|
|
185
|
+
} else if (arg === "--install-schedule") {
|
|
186
|
+
flags.installSchedule = true;
|
|
187
|
+
} else if (arg === "--skip-install") {
|
|
188
|
+
flags.skipInstall = true;
|
|
189
|
+
} else if (
|
|
190
|
+
[
|
|
191
|
+
"--harness",
|
|
192
|
+
"--schedule",
|
|
193
|
+
"--cron",
|
|
194
|
+
"--time",
|
|
195
|
+
"--severity",
|
|
196
|
+
"--tracker",
|
|
197
|
+
"--repo",
|
|
198
|
+
"--branch",
|
|
199
|
+
"--label",
|
|
200
|
+
"--os-scheduler",
|
|
201
|
+
].includes(arg)
|
|
202
|
+
) {
|
|
203
|
+
const val = argv[++i];
|
|
204
|
+
if (!val) die(`${arg} requires a value`);
|
|
205
|
+
const key =
|
|
206
|
+
arg === "--os-scheduler" ? "osScheduler" : arg.slice(2);
|
|
207
|
+
flags[key] = val;
|
|
208
|
+
} else if (
|
|
209
|
+
/^--(harness|schedule|cron|time|severity|tracker|repo|branch|label|os-scheduler)=/.test(
|
|
210
|
+
arg,
|
|
211
|
+
)
|
|
212
|
+
) {
|
|
213
|
+
const eq = arg.indexOf("=");
|
|
214
|
+
const k = arg.slice(2, eq);
|
|
215
|
+
const v = arg.slice(eq + 1);
|
|
216
|
+
flags[k === "os-scheduler" ? "osScheduler" : k] = v;
|
|
149
217
|
} else if (arg.startsWith("-")) {
|
|
150
218
|
die(`Unknown option: ${arg}`);
|
|
151
219
|
} else {
|
|
@@ -491,6 +559,33 @@ async function main() {
|
|
|
491
559
|
MANIFEST_FILENAME,
|
|
492
560
|
});
|
|
493
561
|
break;
|
|
562
|
+
case "setup":
|
|
563
|
+
case "recipe":
|
|
564
|
+
case "recipes": {
|
|
565
|
+
const recipeName = args[0];
|
|
566
|
+
if (!recipeName) {
|
|
567
|
+
console.log(renderRecipesList(catalog, pkgJson));
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
570
|
+
try {
|
|
571
|
+
await runRecipe(recipeName, {
|
|
572
|
+
catalog,
|
|
573
|
+
pkgJson,
|
|
574
|
+
flags,
|
|
575
|
+
args: args.slice(1),
|
|
576
|
+
resolveRoot,
|
|
577
|
+
parseTargetsList,
|
|
578
|
+
ensureManifest,
|
|
579
|
+
addSkillToManifest,
|
|
580
|
+
skillSource,
|
|
581
|
+
runSkillfold,
|
|
582
|
+
MANIFEST_FILENAME,
|
|
583
|
+
});
|
|
584
|
+
} catch (err) {
|
|
585
|
+
die(err.message);
|
|
586
|
+
}
|
|
587
|
+
break;
|
|
588
|
+
}
|
|
494
589
|
case "list":
|
|
495
590
|
case "ls":
|
|
496
591
|
cmdList();
|
|
@@ -518,6 +613,26 @@ async function main() {
|
|
|
518
613
|
runSkillfold(["check"], flags);
|
|
519
614
|
break;
|
|
520
615
|
default:
|
|
616
|
+
if (hasRecipe(command, catalog)) {
|
|
617
|
+
try {
|
|
618
|
+
await runRecipe(command, {
|
|
619
|
+
catalog,
|
|
620
|
+
pkgJson,
|
|
621
|
+
flags,
|
|
622
|
+
args,
|
|
623
|
+
resolveRoot,
|
|
624
|
+
parseTargetsList,
|
|
625
|
+
ensureManifest,
|
|
626
|
+
addSkillToManifest,
|
|
627
|
+
skillSource,
|
|
628
|
+
runSkillfold,
|
|
629
|
+
MANIFEST_FILENAME,
|
|
630
|
+
});
|
|
631
|
+
} catch (err) {
|
|
632
|
+
die(err.message);
|
|
633
|
+
}
|
|
634
|
+
break;
|
|
635
|
+
}
|
|
521
636
|
die(`Unknown command "${command}". Run with --help to see available commands.`);
|
|
522
637
|
}
|
|
523
638
|
}
|
package/bin/lib/onboard.mjs
CHANGED
|
@@ -220,9 +220,20 @@ export function renderCatalogList(catalog, pkgJson) {
|
|
|
220
220
|
}
|
|
221
221
|
});
|
|
222
222
|
|
|
223
|
+
const recipes = Object.entries(catalog.recipes ?? {});
|
|
224
|
+
if (recipes.length > 0) {
|
|
225
|
+
lines.push("");
|
|
226
|
+
lines.push(c.bold("Dedicated recipes (custom CLI workflows with overlapping skills):"));
|
|
227
|
+
for (const [id, meta] of recipes) {
|
|
228
|
+
lines.push(` ${c.bold(c.cyan(id.padEnd(18)))} ${meta.title}`);
|
|
229
|
+
lines.push(` ${c.dim(meta.description)}`);
|
|
230
|
+
lines.push(` ${c.dim(`└─ run: npx ${pkgJson.name} setup ${id} (or: npx ${pkgJson.name} ${id})`)}`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
223
234
|
lines.push("");
|
|
224
235
|
lines.push(
|
|
225
|
-
c.dim(`Tip: run "${pkgJson.name.startsWith("@") ? `npx ${pkgJson.name}` : pkgJson.name} onboard" for guided setup, or "install <category-or-skill>".`),
|
|
236
|
+
c.dim(`Tip: run "${pkgJson.name.startsWith("@") ? `npx ${pkgJson.name}` : pkgJson.name} onboard" for guided setup, "setup <recipe>" for workflows, or "install <category-or-skill>".`),
|
|
226
237
|
);
|
|
227
238
|
return lines.join("\n");
|
|
228
239
|
}
|
package/bin/lib/probe.mjs
CHANGED
|
@@ -92,6 +92,62 @@ export const TOOL_META = {
|
|
|
92
92
|
linux: "Built on first run by pr-lens, or pre-install into ~/.cache/pr-lens",
|
|
93
93
|
},
|
|
94
94
|
},
|
|
95
|
+
"pip-audit": {
|
|
96
|
+
label: "pip-audit (Python lockfile audit)",
|
|
97
|
+
hint: {
|
|
98
|
+
darwin: "uv tool install pip-audit (or pipx install pip-audit)",
|
|
99
|
+
linux: "uv tool install pip-audit (or pipx install pip-audit)",
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
pnpm: {
|
|
103
|
+
label: "pnpm (Node lockfile audit)",
|
|
104
|
+
hint: {
|
|
105
|
+
darwin: "corepack enable && corepack prepare pnpm@latest --activate",
|
|
106
|
+
linux: "corepack enable && corepack prepare pnpm@latest --activate",
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
npm: {
|
|
110
|
+
label: "npm (Node lockfile audit)",
|
|
111
|
+
hint: {
|
|
112
|
+
darwin: "Bundled with Node.js",
|
|
113
|
+
linux: "Bundled with Node.js",
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
"cargo-audit": {
|
|
117
|
+
label: "cargo-audit (Rust Cargo.lock audit)",
|
|
118
|
+
hint: {
|
|
119
|
+
darwin: "cargo install cargo-audit",
|
|
120
|
+
linux: "cargo install cargo-audit",
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
govulncheck: {
|
|
124
|
+
label: "govulncheck (Go module vulnerability audit)",
|
|
125
|
+
hint: {
|
|
126
|
+
darwin: "go install golang.org/x/vuln/cmd/govulncheck@latest",
|
|
127
|
+
linux: "go install golang.org/x/vuln/cmd/govulncheck@latest",
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
claude: {
|
|
131
|
+
label: "Claude Code CLI (claude)",
|
|
132
|
+
hint: {
|
|
133
|
+
darwin: "npm install -g @anthropic-ai/claude-code",
|
|
134
|
+
linux: "npm install -g @anthropic-ai/claude-code",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
codex: {
|
|
138
|
+
label: "Codex CLI (codex)",
|
|
139
|
+
hint: {
|
|
140
|
+
darwin: "npm install -g @openai/codex",
|
|
141
|
+
linux: "npm install -g @openai/codex",
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
opencode: {
|
|
145
|
+
label: "OpenCode CLI (opencode)",
|
|
146
|
+
hint: {
|
|
147
|
+
darwin: "brew install opencode (or npm install -g opencode-ai)",
|
|
148
|
+
linux: "npm install -g opencode-ai",
|
|
149
|
+
},
|
|
150
|
+
},
|
|
95
151
|
};
|
|
96
152
|
|
|
97
153
|
export const HOST_FACT_META = {
|
|
@@ -276,6 +332,21 @@ function probeSingleTool(name, homeDir) {
|
|
|
276
332
|
return { ok: false };
|
|
277
333
|
}
|
|
278
334
|
|
|
335
|
+
case "pip-audit":
|
|
336
|
+
case "pnpm":
|
|
337
|
+
case "npm":
|
|
338
|
+
case "cargo-audit":
|
|
339
|
+
case "govulncheck":
|
|
340
|
+
case "claude":
|
|
341
|
+
case "codex":
|
|
342
|
+
case "opencode": {
|
|
343
|
+
const bin = findInPath([name]);
|
|
344
|
+
if (!bin) return { ok: false };
|
|
345
|
+
const verFlag = name === "govulncheck" ? "-version" : "--version";
|
|
346
|
+
const ver = runQuick(bin, [verFlag], { timeout: 2500 });
|
|
347
|
+
return { ok: true, path: bin, version: firstLine(ver.out) || "installed" };
|
|
348
|
+
}
|
|
349
|
+
|
|
279
350
|
default: {
|
|
280
351
|
const bin = findInPath([name]);
|
|
281
352
|
return bin ? { ok: true, path: bin } : { ok: false };
|
|
@@ -629,3 +700,83 @@ export function evaluateRequirements(skillNames, catalog, probeResult) {
|
|
|
629
700
|
hasIssues: missingRequiredCount > 0 || warningCount > 0,
|
|
630
701
|
};
|
|
631
702
|
}
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Parse a git remote URL into "owner/repo" when it points at a GitHub-like host.
|
|
707
|
+
*/
|
|
708
|
+
export function parseOwnerRepo(remoteUrl) {
|
|
709
|
+
if (!remoteUrl || typeof remoteUrl !== "string") return null;
|
|
710
|
+
const trimmed = remoteUrl.trim().replace(/\.git$/, "");
|
|
711
|
+
// git@github.com:owner/repo or ssh://git@github.com/owner/repo or https://github.com/owner/repo
|
|
712
|
+
const sshColon = trimmed.match(/^[^@]+@[^:]+:([^/]+\/[^/]+)$/);
|
|
713
|
+
if (sshColon) return sshColon[1];
|
|
714
|
+
const urlMatch = trimmed.match(/^[a-z+]+:\/\/[^/]+\/([^/]+\/[^/]+)$/i);
|
|
715
|
+
if (urlMatch) return urlMatch[1];
|
|
716
|
+
return null;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* Inspect a repository for security-remediation prerequisites: git remote,
|
|
721
|
+
* default branch, lockfiles/ecosystems, and recommended scanners.
|
|
722
|
+
*/
|
|
723
|
+
export function probeSecurityRepo(projectDir) {
|
|
724
|
+
const dir = resolve(projectDir || process.cwd());
|
|
725
|
+
const remoteRes = runQuick("git", ["-C", dir, "remote", "get-url", "origin"], { timeout: 2000 });
|
|
726
|
+
const remoteUrl = remoteRes.ok ? firstLine(remoteRes.out) : null;
|
|
727
|
+
const ownerRepo = parseOwnerRepo(remoteUrl);
|
|
728
|
+
|
|
729
|
+
let defaultBranch = "main";
|
|
730
|
+
const headSym = runQuick("git", ["-C", dir, "symbolic-ref", "refs/remotes/origin/HEAD"], {
|
|
731
|
+
timeout: 2000,
|
|
732
|
+
});
|
|
733
|
+
if (headSym.ok && headSym.out.trim()) {
|
|
734
|
+
const parts = headSym.out.trim().split("/");
|
|
735
|
+
defaultBranch = parts[parts.length - 1] || "main";
|
|
736
|
+
} else {
|
|
737
|
+
const curBranch = runQuick("git", ["-C", dir, "rev-parse", "--abbrev-ref", "HEAD"], {
|
|
738
|
+
timeout: 2000,
|
|
739
|
+
});
|
|
740
|
+
if (curBranch.ok && curBranch.out.trim() && curBranch.out.trim() !== "HEAD") {
|
|
741
|
+
defaultBranch = curBranch.out.trim();
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
const lockfileSpecs = [
|
|
746
|
+
{ file: "pnpm-lock.yaml", ecosystem: "node", scanner: "pnpm" },
|
|
747
|
+
{ file: "package-lock.json", ecosystem: "node", scanner: "npm" },
|
|
748
|
+
{ file: "yarn.lock", ecosystem: "node", scanner: "osv-scanner" },
|
|
749
|
+
{ file: "bun.lock", ecosystem: "node", scanner: "osv-scanner" },
|
|
750
|
+
{ file: "bun.lockb", ecosystem: "node", scanner: "osv-scanner" },
|
|
751
|
+
{ file: "uv.lock", ecosystem: "python", scanner: "pip-audit" },
|
|
752
|
+
{ file: "poetry.lock", ecosystem: "python", scanner: "pip-audit" },
|
|
753
|
+
{ file: "requirements.txt", ecosystem: "python", scanner: "pip-audit" },
|
|
754
|
+
{ file: "Cargo.lock", ecosystem: "rust", scanner: "cargo-audit" },
|
|
755
|
+
{ file: "go.mod", ecosystem: "go", scanner: "govulncheck" },
|
|
756
|
+
];
|
|
757
|
+
|
|
758
|
+
const lockfiles = [];
|
|
759
|
+
const ecosystems = new Set();
|
|
760
|
+
const scanners = new Set(["osv-scanner"]);
|
|
761
|
+
|
|
762
|
+
for (const spec of lockfileSpecs) {
|
|
763
|
+
if (existsSync(join(dir, spec.file))) {
|
|
764
|
+
lockfiles.push(spec.file);
|
|
765
|
+
ecosystems.add(spec.ecosystem);
|
|
766
|
+
scanners.add(spec.scanner);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
return {
|
|
771
|
+
dir,
|
|
772
|
+
repoSlug: basename(dir),
|
|
773
|
+
remoteUrl,
|
|
774
|
+
ownerRepo,
|
|
775
|
+
defaultBranch,
|
|
776
|
+
lockfiles,
|
|
777
|
+
ecosystems: [...ecosystems],
|
|
778
|
+
recommendedScanners: [...scanners],
|
|
779
|
+
existingPrompt: existsSync(join(dir, ".agents", "prompts", "security-remediation.md")),
|
|
780
|
+
existingWorkflow: existsSync(join(dir, ".github", "workflows", "security-remediation-cron.yml")),
|
|
781
|
+
};
|
|
782
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dedicated workflow recipes registry for @greenrenge/skills.
|
|
3
|
+
*
|
|
4
|
+
* Unlike passive bundles, each recipe can compose an overlapping subset of
|
|
5
|
+
* skills, run a custom preflight probe, walk a tailored CLI wizard, and emit
|
|
6
|
+
* runnable artifacts (prompts, slash commands, runner scripts, CI workflows).
|
|
7
|
+
*/
|
|
8
|
+
import { c } from "../onboard.mjs";
|
|
9
|
+
import { runSecurityCronRecipe } from "./security-cron.mjs";
|
|
10
|
+
|
|
11
|
+
export const RECIPE_HANDLERS = {
|
|
12
|
+
"security-cron": runSecurityCronRecipe,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function hasRecipe(name, catalog) {
|
|
16
|
+
return Boolean(name && RECIPE_HANDLERS[name] && catalog.recipes?.[name]);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function renderRecipesList(catalog, pkgJson) {
|
|
20
|
+
const recipes = catalog.recipes ?? {};
|
|
21
|
+
const entries = Object.entries(recipes);
|
|
22
|
+
const lines = [];
|
|
23
|
+
lines.push(`${c.bold(pkgJson.name)} v${pkgJson.version} — Dedicated Recipes`);
|
|
24
|
+
lines.push("");
|
|
25
|
+
if (entries.length === 0) {
|
|
26
|
+
lines.push(" (no recipes registered)");
|
|
27
|
+
return lines.join("\n");
|
|
28
|
+
}
|
|
29
|
+
for (const [id, meta] of entries) {
|
|
30
|
+
lines.push(` ${c.bold(c.cyan(id))} — ${meta.title}`);
|
|
31
|
+
lines.push(` ${c.dim(meta.description)}`);
|
|
32
|
+
if (meta.baseSkills?.length) {
|
|
33
|
+
lines.push(` Base skills: ${meta.baseSkills.join(", ")}`);
|
|
34
|
+
}
|
|
35
|
+
if (meta.overlays && Object.keys(meta.overlays).length > 0) {
|
|
36
|
+
const ov = Object.entries(meta.overlays)
|
|
37
|
+
.map(([k, v]) => `${k}: [${v.join(", ")}]`)
|
|
38
|
+
.join(" | ");
|
|
39
|
+
lines.push(` Overlays: ${ov}`);
|
|
40
|
+
}
|
|
41
|
+
if (meta.schedules?.length) {
|
|
42
|
+
lines.push(` Schedules: ${meta.schedules.join(", ")}`);
|
|
43
|
+
}
|
|
44
|
+
lines.push(` Run: npx ${pkgJson.name} setup ${id} (or: npx ${pkgJson.name} ${id})`);
|
|
45
|
+
lines.push("");
|
|
46
|
+
}
|
|
47
|
+
return lines.join("\n");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function runRecipe(name, ctx) {
|
|
51
|
+
const handler = RECIPE_HANDLERS[name];
|
|
52
|
+
if (!handler || !ctx.catalog.recipes?.[name]) {
|
|
53
|
+
const known = Object.keys(ctx.catalog.recipes ?? {}).join(", ") || "(none)";
|
|
54
|
+
throw new Error(`Unknown recipe "${name}". Available recipes: ${known}`);
|
|
55
|
+
}
|
|
56
|
+
return await handler(ctx);
|
|
57
|
+
}
|