@rune-kit/rune 2.12.3 → 2.13.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 +26 -3
- package/compiler/__tests__/openclaw-adapter.test.js +26 -0
- package/compiler/adapters/openclaw.js +43 -3
- package/package.json +1 -1
- package/skills/adversary/SKILL.md +1 -1
- package/skills/autopsy/SKILL.md +1 -1
- package/skills/context-pack/SKILL.md +1 -1
- package/skills/graft/SKILL.md +1 -1
- package/skills/journal/SKILL.md +1 -1
- package/skills/marketing/SKILL.md +2 -1
- package/skills/safeguard/SKILL.md +1 -1
- package/skills/sentinel-env/SKILL.md +24 -13
- package/skills/skill-forge/SKILL.md +108 -1
- package/skills/surgeon/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -83,7 +83,15 @@ _Methodology: Claude Code CLI headless mode (`claude -p --output-format json`),
|
|
|
83
83
|
|
|
84
84
|
---
|
|
85
85
|
|
|
86
|
-
## What's New (v2.
|
|
86
|
+
## What's New (v2.13.0 — Script Contract + Media Pack)
|
|
87
|
+
|
|
88
|
+
- **`@rune-pro/media` pack v1.0.0** — new Pro pack: raster image generation across 5 providers (Codex CLI, DALL-E, Replicate, Stability AI, local SD), prompt engineering with 4-gate safety check (trademark, public-figure, prompt-injection, uncanny-precondition), batch asset pipeline with multi-resolution variants + WebP/AVIF conversion + EXIF strip. Fills the raster gap left by `asset-creator` (SVG/HTML only) and `video-creator` (planning only).
|
|
89
|
+
- **`sentinel-env` v0.3.0** — 9-tier binary detection for hard-dependency checks. Catches desktop-app bundles (macOS `.app`), npm-global on Windows (PATH oversight), platform release archives. Eliminates the "binary installed but not detected" failure class.
|
|
90
|
+
- **`skill-forge` v1.8.0** — new Phase 5.25 "Script Contract" — helper scripts must follow stdout=paths / stderr=diagnostics / `--json` opt-in / `--debug` opt-in pattern, implement semantic exit codes (including `4` timeout-partial vs `124` timeout-zero), honor OpenClaw artifact-directory fallback chain. HARD-GATE on pre-ship verification.
|
|
91
|
+
- **OpenClaw adapter** — `generateManifest` now declares `artifactConvention` (output-dir fallback order, output contract, exit-code vocabulary). Formalizes the de-facto in-the-wild convention from [codex-imagen](https://github.com/darkamenosa/codex-imagen).
|
|
92
|
+
- **Skill-count scaling** — OpenClaw manifest description now scales with actual skill count rather than hardcoded.
|
|
93
|
+
|
|
94
|
+
### Previous (v2.12.0 — Auto-Discipline)
|
|
87
95
|
|
|
88
96
|
- **Runtime auto-discipline** — `rune hooks install` wires native hooks on Claude Code, Cursor, Windsurf, Antigravity so `preflight`, `sentinel`, `completion-gate` auto-fire before tool use. No more "remember to invoke the skill."
|
|
89
97
|
- **Three presets** — `strict` (blocking gates), `gentle` (warnings, default), `off` (uninstall). Idempotent install / uninstall with full restore of user hooks.
|
|
@@ -548,17 +556,32 @@ npx @rune-kit/rune doctor
|
|
|
548
556
|
|
|
549
557
|
See [docs/MULTI-PLATFORM.md](docs/MULTI-PLATFORM.md) for the full architecture.
|
|
550
558
|
|
|
559
|
+
## Documentation
|
|
560
|
+
|
|
561
|
+
| Doc | What's inside |
|
|
562
|
+
|-----|---------------|
|
|
563
|
+
| [`docs/GETTING_STARTED.md`](docs/GETTING_STARTED.md) | Your first 5 minutes with Rune — install to first `/rune cook` |
|
|
564
|
+
| [`docs/SKILLS.md`](docs/SKILLS.md) | All 62 skills, searchable by intent and layer |
|
|
565
|
+
| [`docs/SIGNALS.md`](docs/SIGNALS.md) | Canonical signal inventory — 25 events, emit/listen graph |
|
|
566
|
+
| [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) | 5-layer mesh architecture reference |
|
|
567
|
+
| [`docs/VISION.md`](docs/VISION.md) | Philosophy — what Rune is and isn't |
|
|
568
|
+
| [`docs/HOOKS.md`](docs/HOOKS.md) | Auto-discipline hooks per platform |
|
|
569
|
+
| [`docs/TROUBLESHOOTING.md`](docs/TROUBLESHOOTING.md) | Common issues + fixes |
|
|
570
|
+
| [`CONTRIBUTING.md`](CONTRIBUTING.md) | How to contribute skills, packs, fixes |
|
|
571
|
+
| [`CHANGELOG.md`](CHANGELOG.md) | Release history |
|
|
572
|
+
| [`ROADMAP.md`](ROADMAP.md) | What's next |
|
|
573
|
+
|
|
551
574
|
## Numbers
|
|
552
575
|
|
|
553
576
|
```
|
|
554
577
|
Core Skills: 62 (L0: 1 │ L1: 5 │ L2: 29 │ L3: 27)
|
|
555
578
|
Extension Packs: 14 free + 5 pro + 4 business
|
|
556
579
|
Mesh Connections: 215+ cross-references
|
|
557
|
-
Mesh Signals:
|
|
580
|
+
Mesh Signals: 25 signals across 62 skills (emit/listen graph)
|
|
558
581
|
Connections/Skill: 3.4 avg
|
|
559
582
|
Platforms: 8 (Claude Code, Cursor, Windsurf, Antigravity, Codex, OpenCode, OpenClaw, Generic)
|
|
560
583
|
Compiler: ~1400 LOC (parser + 8 transforms + 8 adapters + CLI)
|
|
561
|
-
Tests:
|
|
584
|
+
Tests: 1,152+ (compiler + signals + status + visualizer + hooks + scripts + tier-hooks)
|
|
562
585
|
Pack Depth: 23 packs total (14 free + 5 pro + 4 business, all free packs rated Deep)
|
|
563
586
|
```
|
|
564
587
|
|
|
@@ -114,6 +114,32 @@ test('generateManifest defaults version when missing', () => {
|
|
|
114
114
|
assert.strictEqual(manifest.version, '0.0.0');
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
+
test('generateManifest declares artifact convention for OpenClaw skills', () => {
|
|
118
|
+
const manifest = openclaw.generateManifest(
|
|
119
|
+
[{ name: 'cook', layer: 'L1', group: 'orchestrator' }],
|
|
120
|
+
{ version: '1.0.0' },
|
|
121
|
+
);
|
|
122
|
+
assert.ok(manifest.artifactConvention, 'artifactConvention field exists');
|
|
123
|
+
assert.ok(Array.isArray(manifest.artifactConvention.outputDirPriority), 'outputDirPriority is array');
|
|
124
|
+
assert.ok(manifest.artifactConvention.outputDirPriority.length >= 4, 'at least 4 fallback tiers');
|
|
125
|
+
assert.ok(
|
|
126
|
+
manifest.artifactConvention.outputDirPriority.some((tier) => tier.includes('OPENCLAW_AGENT_DIR')),
|
|
127
|
+
'OPENCLAW_AGENT_DIR is a tier',
|
|
128
|
+
);
|
|
129
|
+
assert.ok(manifest.artifactConvention.outputContract, 'outputContract documented');
|
|
130
|
+
assert.strictEqual(manifest.artifactConvention.outputContract.exitCodes[0], 'success');
|
|
131
|
+
assert.strictEqual(manifest.artifactConvention.outputContract.exitCodes[4], 'timeout with partial results (accept)');
|
|
132
|
+
assert.strictEqual(manifest.artifactConvention.outputContract.exitCodes[124], 'timeout with zero results (retry or abort)');
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test('generateManifest description scales with skill count', () => {
|
|
136
|
+
const fewSkills = openclaw.generateManifest(
|
|
137
|
+
[{ name: 'cook', layer: 'L1' }, { name: 'plan', layer: 'L2' }],
|
|
138
|
+
{ version: '1.0.0' },
|
|
139
|
+
);
|
|
140
|
+
assert.ok(fewSkills.description.includes('2-skill'), 'description reflects actual skill count');
|
|
141
|
+
});
|
|
142
|
+
|
|
117
143
|
// --- generateEntryPoint ---
|
|
118
144
|
|
|
119
145
|
test('generateEntryPoint returns valid TypeScript with register(api)', () => {
|
|
@@ -7,6 +7,25 @@
|
|
|
7
7
|
* .openclaw/rune/skills/*.md (transformed skill files)
|
|
8
8
|
*
|
|
9
9
|
* Follows the NeuralMemory OpenClaw plugin pattern.
|
|
10
|
+
*
|
|
11
|
+
* ARTIFACT CONVENTION (v2.13+):
|
|
12
|
+
* OpenClaw skills that produce file artifacts (images, reports, data) should
|
|
13
|
+
* resolve output directory in this fallback order — honored by the Rune script
|
|
14
|
+
* output contract (see skills/skill-forge Phase 5.25):
|
|
15
|
+
*
|
|
16
|
+
* 1. --out-dir <path> (explicit caller intent)
|
|
17
|
+
* 2. <SKILL>_OUT_DIR (skill-specific env var)
|
|
18
|
+
* 3. OPENCLAW_OUTPUT_DIR (platform-wide override)
|
|
19
|
+
* 4. OPENCLAW_AGENT_DIR/artifacts/<skill> (per-agent scoped default)
|
|
20
|
+
* 5. OPENCLAW_STATE_DIR/artifacts/<skill> (state-scoped fallback)
|
|
21
|
+
* 6. ./.rune/<skill>/ (project-local default)
|
|
22
|
+
*
|
|
23
|
+
* Reference implementations in @rune-pro/media/scripts/:
|
|
24
|
+
* - codex_imagen_bridge.mjs (full resolution + 9-tier binary detection)
|
|
25
|
+
* - image_optimizer.py (Python equivalent)
|
|
26
|
+
*
|
|
27
|
+
* Reference codex-imagen repo (darkamenosa/codex-imagen) documents the
|
|
28
|
+
* de-facto in-the-wild convention this adapter formalizes.
|
|
10
29
|
*/
|
|
11
30
|
|
|
12
31
|
import { BRANDING_FOOTER } from '../transforms/branding.js';
|
|
@@ -67,15 +86,36 @@ export default {
|
|
|
67
86
|
* @param {object} pluginJson - Rune's .claude-plugin/plugin.json
|
|
68
87
|
* @returns {object} manifest object
|
|
69
88
|
*/
|
|
70
|
-
generateManifest(
|
|
89
|
+
generateManifest(skills, pluginJson) {
|
|
71
90
|
return {
|
|
72
91
|
id: 'rune',
|
|
73
92
|
name: 'Rune',
|
|
74
93
|
kind: 'skills',
|
|
75
|
-
description:
|
|
76
|
-
'62-skill mesh for AI coding assistants. Routes all code tasks through specialized skills. 215+ connections, 14 extension packs.',
|
|
94
|
+
description: `${skills.length}-skill mesh for AI coding assistants. Routes all code tasks through specialized skills. 215+ connections, 14 extension packs.`,
|
|
77
95
|
version: pluginJson.version || '0.0.0',
|
|
78
96
|
skills: ['./skills'],
|
|
97
|
+
artifactConvention: {
|
|
98
|
+
outputDirPriority: [
|
|
99
|
+
'--out-dir <path>',
|
|
100
|
+
'<SKILL>_OUT_DIR',
|
|
101
|
+
'OPENCLAW_OUTPUT_DIR',
|
|
102
|
+
'OPENCLAW_AGENT_DIR/artifacts/<skill>',
|
|
103
|
+
'OPENCLAW_STATE_DIR/artifacts/<skill>',
|
|
104
|
+
'./.rune/<skill>/',
|
|
105
|
+
],
|
|
106
|
+
outputContract: {
|
|
107
|
+
stdout: 'one artifact path per line (default) or JSON (--json mode)',
|
|
108
|
+
stderr: 'diagnostics + warnings',
|
|
109
|
+
exitCodes: {
|
|
110
|
+
0: 'success',
|
|
111
|
+
1: 'execution failed (retryable)',
|
|
112
|
+
2: 'usage error (bug)',
|
|
113
|
+
3: 'data-integrity error (halt)',
|
|
114
|
+
4: 'timeout with partial results (accept)',
|
|
115
|
+
124: 'timeout with zero results (retry or abort)',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
79
119
|
configSchema: {
|
|
80
120
|
jsonSchema: {
|
|
81
121
|
type: 'object',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rune-kit/rune",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "62-skill mesh for AI coding assistants — runtime auto-discipline via native hooks (Claude/Cursor/Windsurf/Antigravity), 5-layer architecture, 215+ connections, multi-platform compiler.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: adversary
|
|
3
|
-
description: Pre-implementation red-team analysis. Challenges plans before code is written — finds edge cases, security holes, scalability bottlenecks, error propagation risks, and integration conflicts. Catches flaws at plan time (10x cheaper than post-implementation).
|
|
3
|
+
description: "Pre-implementation red-team analysis. Use when a plan is high-risk, critical path, or expensive to reverse. Challenges plans before code is written — finds edge cases, security holes, scalability bottlenecks, error propagation risks, and integration conflicts. Catches flaws at plan time (10x cheaper than post-implementation)."
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
6
|
version: "0.1.0"
|
package/skills/autopsy/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: autopsy
|
|
3
|
-
description: Full codebase health assessment. Analyzes complexity, dependencies, dead code, tech debt, and git hotspots. Produces a health score and rescue plan.
|
|
3
|
+
description: Full codebase health assessment. Use when diagnosing project health or starting a rescue workflow on legacy code. Analyzes complexity, dependencies, dead code, tech debt, and git hotspots. Produces a health score and rescue plan.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
6
|
version: "0.4.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: context-pack
|
|
3
|
-
description: "Creates structured handoff briefings between agents. Packages task context, constraints, and progress into a compact packet that subagents can consume without re-reading the full conversation. Prevents the 'lost context' problem in multi-agent delegation."
|
|
3
|
+
description: "Creates structured handoff briefings between agents. Use when delegating complex work to subagents that would otherwise lose context. Packages task context, constraints, and progress into a compact packet that subagents can consume without re-reading the full conversation. Prevents the 'lost context' problem in multi-agent delegation."
|
|
4
4
|
user-invocable: false
|
|
5
5
|
metadata:
|
|
6
6
|
author: runedev
|
package/skills/graft/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: graft
|
|
3
|
-
description: "Clone, port, or convert features from any GitHub repo into your project. Understand before copy, challenge before implement. 4 modes: port (rewrite), compare (analysis), copy (transplant), improve (copy + optimize)."
|
|
3
|
+
description: "Clone, port, or convert features from any GitHub repo into your project. Use when stealing patterns from external repos or porting proven code. Understand before copy, challenge before implement. 4 modes: port (rewrite), compare (analysis), copy (transplant), improve (copy + optimize)."
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
6
|
version: "0.2.0"
|
package/skills/journal/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: journal
|
|
3
|
-
description: Persistent state tracking and Architecture Decision Records across sessions. Manages progress state, module health, dependency graphs, and ADRs for any workflow.
|
|
3
|
+
description: Persistent state tracking and Architecture Decision Records across sessions. Use when recording a decision, ADR, or progress that must survive session boundaries. Manages progress state, module health, dependency graphs, and ADRs for any workflow.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
6
|
version: "0.3.0"
|
|
@@ -3,11 +3,12 @@ name: marketing
|
|
|
3
3
|
description: Create marketing assets and execute launch strategy. Generates landing copy, social banners, SEO meta, blog posts, and video scripts.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.6.0"
|
|
7
7
|
layer: L2
|
|
8
8
|
model: sonnet
|
|
9
9
|
group: delivery
|
|
10
10
|
tools: "Read, Write, Edit, Glob, Grep, WebFetch, WebSearch"
|
|
11
|
+
emit: media.request
|
|
11
12
|
---
|
|
12
13
|
|
|
13
14
|
# marketing
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: safeguard
|
|
3
|
-
description: Build safety nets before refactoring. Creates characterization tests, boundary markers, config freezes, and rollback points.
|
|
3
|
+
description: Build safety nets before refactoring. Use when running surgeon or any risky refactor that needs a rollback point. Creates characterization tests, boundary markers, config freezes, and rollback points.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
6
|
version: "0.2.0"
|
|
@@ -3,7 +3,7 @@ name: sentinel-env
|
|
|
3
3
|
description: Environment-aware pre-flight check. Validates OS, runtime versions, installed tools, port availability, env vars, and disk space BEFORE coding starts. Prevents "works on my machine" failures. Like sentinel but for the environment, not the code.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.3.0"
|
|
7
7
|
layer: L3
|
|
8
8
|
model: haiku
|
|
9
9
|
group: validation
|
|
@@ -117,25 +117,36 @@ Detect and verify tools the project depends on:
|
|
|
117
117
|
- `Grep` for `subprocess.run(`, `child_process.exec(`, `Deno.Command(` → project invokes external CLI
|
|
118
118
|
- `Read` README/docs for "requires X installed" or "depends on X"
|
|
119
119
|
|
|
120
|
-
For each detected hard dependency
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
For each detected hard dependency, apply the **9-tier binary detection** below — checking only `which`/`where` is insufficient and produces the largest category of "works on my machine" false-negatives (user has binary installed but PATH is stale, or installed via a package manager that didn't register it, or installed as a desktop app with a bundled binary).
|
|
121
|
+
|
|
122
|
+
**9-Tier Binary Detection** (stop at first hit):
|
|
123
|
+
|
|
124
|
+
| Tier | Source | Catches |
|
|
125
|
+
|------|--------|---------|
|
|
126
|
+
| 1 | Explicit `--<tool>-bin <path>` flag | CI, automation, manual override |
|
|
127
|
+
| 2 | Skill-specific env var `<SKILL>_<TOOL>_BIN` | Per-project pinning |
|
|
128
|
+
| 3 | Tool-family env var `<TOOL>_APP_BIN` | Ecosystem conventions |
|
|
129
|
+
| 4 | Generic tool env var `<TOOL>_BIN` | Legacy overrides |
|
|
130
|
+
| 5 | Platform desktop-app bundle (macOS `.app/Contents/Resources`, Windows `%LOCALAPPDATA%\Programs`, Linux `/opt`) | Desktop app users (~40% of population) |
|
|
131
|
+
| 6 | PATH lookup (`which`/`where.exe`) | Standard shell users |
|
|
132
|
+
| 7 | Package manager global bin (`npm config get prefix`, `pnpm`, `pipx --list`, `cargo install --root`) | npm-global on Windows (PATH oversight) |
|
|
133
|
+
| 8 | Platform common directories (`~/.local/bin`, `~/.npm-global/bin`, Homebrew, `%APPDATA%\npm`, `%LOCALAPPDATA%\Microsoft\WindowsApps`, `%ProgramFiles%\nodejs`) | Manual installers |
|
|
134
|
+
| 9 | Platform release archive names (e.g., `codex-x86_64-unknown-linux-musl`, `<tool>-aarch64-apple-darwin`) | Release-tarball downloaders |
|
|
127
135
|
|
|
128
136
|
**Verdict:**
|
|
129
|
-
- Tool found
|
|
130
|
-
- Tool NOT found → **BLOCK** with
|
|
137
|
+
- Tool found via any tier → PASS (log which tier + version)
|
|
138
|
+
- Tool NOT found → **BLOCK** with per-OS install guidance:
|
|
131
139
|
```
|
|
132
|
-
[ENV-XXX] Required tool '<tool>' not found
|
|
140
|
+
[ENV-XXX] Required tool '<tool>' not found (9-tier lookup exhausted)
|
|
133
141
|
→ Debian/Ubuntu: sudo apt install <tool>
|
|
134
|
-
→ macOS: brew install <tool>
|
|
142
|
+
→ macOS: brew install <tool> (or desktop app: <URL>)
|
|
135
143
|
→ Windows: winget install <tool> (or choco install <tool>)
|
|
136
|
-
→
|
|
144
|
+
→ Any platform: npm install -g <package> (if Node tool)
|
|
145
|
+
→ Manual: <download URL>
|
|
146
|
+
→ Pin explicitly: export <TOOL>_BIN=/path/to/binary
|
|
137
147
|
```
|
|
138
148
|
- This prevents the entire class of "it worked in CI but not locally" failures where `subprocess.run()` silently fails
|
|
149
|
+
- Reference implementation: `scripts/codex_imagen_bridge.mjs` in `@rune-pro/media` ports this pattern
|
|
139
150
|
|
|
140
151
|
### Step 4: Port Availability Check
|
|
141
152
|
|
|
@@ -3,7 +3,7 @@ name: skill-forge
|
|
|
3
3
|
description: Use when creating new Rune skills, editing existing skills, or verifying skill quality before deployment. Applies TDD discipline to skill authoring — test before write, verify before ship.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "1.
|
|
6
|
+
version: "1.8.0"
|
|
7
7
|
layer: L2
|
|
8
8
|
model: opus
|
|
9
9
|
group: creation
|
|
@@ -277,6 +277,113 @@ Research (Meincke et al., 2025, 28,000 conversations) shows 33% → 72% complian
|
|
|
277
277
|
|
|
278
278
|
**Ethical test**: Would this serve the user's genuine interests if they fully understood the technique?
|
|
279
279
|
|
|
280
|
+
### Phase 5.25 — SCRIPT CONTRACT (skills with helper scripts only)
|
|
281
|
+
|
|
282
|
+
If the skill bundles executable scripts in its `scripts/` directory, those scripts MUST follow the Rune script output contract. This is a testable contract — orchestrators (cook, team, marketing) rely on it for piping and retry logic.
|
|
283
|
+
|
|
284
|
+
#### The Three-Mode Contract
|
|
285
|
+
|
|
286
|
+
Every helper script supports three output modes:
|
|
287
|
+
|
|
288
|
+
| Mode | Stdout | Stderr | File Artifacts |
|
|
289
|
+
|------|--------|--------|----------------|
|
|
290
|
+
| default | One artifact path per line | Diagnostics + warnings | Artifacts in declared out-dir |
|
|
291
|
+
| `--json` | Structured JSON summary | Diagnostics (unchanged) | Artifacts (unchanged) |
|
|
292
|
+
| `--debug` | Default stdout (paths) | Verbose trace + diagnostics | Default + JSONL redacted trace at `<out-dir>/<slug>.jsonl` |
|
|
293
|
+
|
|
294
|
+
**Why**: default-mode stdout-as-paths is the Unix way. Downstream skills pipe directly without log-parsing. `--json` is opt-in for callers that need metadata.
|
|
295
|
+
|
|
296
|
+
#### Required Flags
|
|
297
|
+
|
|
298
|
+
Every helper script MUST accept at least these flags:
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
--help Print usage + exit 0
|
|
302
|
+
--version Print version + exit 0
|
|
303
|
+
--json Structured JSON on stdout
|
|
304
|
+
--debug Write JSONL redacted trace
|
|
305
|
+
--dry-run Report plan, make no changes, exit 0
|
|
306
|
+
--smoke Pre-flight check (validate deps, exit 0 if healthy)
|
|
307
|
+
--out-dir <path> Override default artifact directory
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
And SHOULD accept when applicable:
|
|
311
|
+
```
|
|
312
|
+
--prompt-file <path> Read long text input from file (avoids shell-quoting hell on Windows)
|
|
313
|
+
--confirm Skip confirmation gate for expensive/destructive ops
|
|
314
|
+
--timeout-ms <n> Operation timeout (with semantic exit codes below)
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
#### Semantic Exit Codes
|
|
318
|
+
|
|
319
|
+
Adopt the standard Rune exit-code vocabulary:
|
|
320
|
+
|
|
321
|
+
| Code | Meaning | Orchestrator Response |
|
|
322
|
+
|------|---------|-----------------------|
|
|
323
|
+
| `0` | Success | Accept + chain to next |
|
|
324
|
+
| `1` | Execution failed (retryable) | Log + retry with alternate config |
|
|
325
|
+
| `2` | Usage error (bug) | Abort — don't retry |
|
|
326
|
+
| `3` | Data-integrity error | Halt — don't retry |
|
|
327
|
+
| `4` | Timeout with partial results | **Accept partial + continue** |
|
|
328
|
+
| `124` | Timeout with zero results | Retry with longer timeout or alternate provider |
|
|
329
|
+
|
|
330
|
+
Codes `5-63` are skill-specific. Document every code used in `references/<skill>/exit-codes.md`.
|
|
331
|
+
|
|
332
|
+
**Why `4` vs `124` matters**: Standard Unix collapses "timeout-with-2-of-3-images" and "timeout-with-0-images" into `124`. They are fundamentally different outcomes. Split them.
|
|
333
|
+
|
|
334
|
+
#### Default Artifact Directory Resolution
|
|
335
|
+
|
|
336
|
+
Resolve `--out-dir` in this fallback order:
|
|
337
|
+
|
|
338
|
+
1. `--out-dir <path>` explicit flag
|
|
339
|
+
2. `<SKILL>_OUT_DIR` env var (skill-specific)
|
|
340
|
+
3. `OPENCLAW_OUTPUT_DIR` (OpenClaw platform convention)
|
|
341
|
+
4. `OPENCLAW_AGENT_DIR/artifacts/<skill>` (OpenClaw default)
|
|
342
|
+
5. `OPENCLAW_STATE_DIR/artifacts/<skill>` (OpenClaw state fallback)
|
|
343
|
+
6. `./.rune/<skill>/` (project-local default)
|
|
344
|
+
|
|
345
|
+
**Why**: OpenClaw is one of Rune's adapter targets. Scripts that honor this convention work across adapters without modification.
|
|
346
|
+
|
|
347
|
+
#### Sensitive-Data Redaction
|
|
348
|
+
|
|
349
|
+
`--debug` trace MUST redact sensitive fields before write:
|
|
350
|
+
- Regex: `/authorization|bearer|token|api[_-]?key|secret|cookie|session[_-]?id|chatgpt[_-]?account/i` (key names)
|
|
351
|
+
- Any value exceeding 500 chars truncates to `<first-500>...`
|
|
352
|
+
- Never log env var VALUES — only presence check
|
|
353
|
+
|
|
354
|
+
#### Contract Test
|
|
355
|
+
|
|
356
|
+
Before shipping a helper script, verify:
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
# Contract smoke test:
|
|
360
|
+
node scripts/<script>.mjs --help # exit 0
|
|
361
|
+
node scripts/<script>.mjs --version # exit 0, prints version only
|
|
362
|
+
node scripts/<script>.mjs --smoke # exit 0 or 1, human-readable stderr
|
|
363
|
+
node scripts/<script>.mjs --dry-run ... # exit 0, no side effects
|
|
364
|
+
node scripts/<script>.mjs ... --json # stdout is parseable JSON
|
|
365
|
+
node scripts/<script>.mjs ... | head -1 # stdout default mode = path
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
<HARD-GATE>
|
|
369
|
+
Scripts that don't honor the contract cannot be shipped.
|
|
370
|
+
Specifically:
|
|
371
|
+
- Mixing paths and progress on stdout = BLOCK
|
|
372
|
+
- Silent failure (no install guidance on miss) = BLOCK
|
|
373
|
+
- Logging credentials in trace = CRITICAL-BLOCK
|
|
374
|
+
- Binary exit code (0/1 only) when timeout semantics apply = BLOCK
|
|
375
|
+
</HARD-GATE>
|
|
376
|
+
|
|
377
|
+
**Reference implementations**:
|
|
378
|
+
- `@rune-pro/media/scripts/codex_imagen_bridge.mjs` — full 9-tier binary detection + contract
|
|
379
|
+
- `@rune-pro/media/scripts/provider_probe.mjs` — `--smoke` convention exemplar
|
|
380
|
+
- `@rune-pro/media/scripts/image_optimizer.py` — Python contract implementation
|
|
381
|
+
|
|
382
|
+
**Reference docs**:
|
|
383
|
+
- `references/image-generator/script-contract.md` (pack-level contract)
|
|
384
|
+
- `references/image-generator/exit-codes.md` (exit-code vocabulary)
|
|
385
|
+
- `references/image-generator/binary-detection.md` (9-tier lookup)
|
|
386
|
+
|
|
280
387
|
### Phase 5.5 — SECURITY MODEL
|
|
281
388
|
|
|
282
389
|
Every skill that touches external systems, user data, or destructive operations MUST define an explicit Security Model section. This is a contract — not aspirational, but testable.
|
package/skills/surgeon/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: surgeon
|
|
3
|
-
description: Incremental refactorer. Refactors ONE module per session using proven patterns — Strangler Fig, Branch by Abstraction, Expand-Migrate-Contract.
|
|
3
|
+
description: Incremental refactorer. Use within a rescue workflow after safeguard has set up safety nets. Refactors ONE module per session using proven patterns — Strangler Fig, Branch by Abstraction, Expand-Migrate-Contract.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
6
|
version: "0.2.0"
|