diff options
51 files changed, 2219 insertions, 399 deletions
diff --git a/.antigravity-plugin/plugin.json b/.antigravity-plugin/plugin.json new file mode 100644 index 0000000..6f85dec --- /dev/null +++ b/.antigravity-plugin/plugin.json @@ -0,0 +1,27 @@ +{ + "name": "superpowers", + "displayName": "Superpowers", + "version": "7.0.0", + "description": "Make your coding agent a better engineer", + "logo": "assets/antigravity-logo.png", + "suggestedPrompts": [ + "I've got an idea for something I'd like to build", + "Let's figure out why this broke" + ], + "category": "Developer Tools", + "keywords": [ + "skills", + "tdd", + "debugging", + "collaboration", + "best-practices", + "workflows" + ], + "author": { + "name": "Jesse Vincent", + "email": "jesse@fsck.com" + }, + "homepage": "https://github.com/obra/superpowers", + "repository": "https://github.com/obra/superpowers", + "license": "MIT" +} diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 87d873f..92f8ab9 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -9,7 +9,7 @@ { "name": "superpowers", "description": "Core skills library for Claude Code: TDD, debugging, collaboration patterns, and proven techniques", - "version": "6.4.2", + "version": "7.0.0", "source": "./", "author": { "name": "Jesse Vincent", diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index aa2a09c..86e0b12 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "superpowers", "description": "Core skills library for Claude Code: TDD, debugging, collaboration patterns, and proven techniques", - "version": "6.4.2", + "version": "7.0.0", "author": { "name": "Jesse Vincent", "email": "jesse@fsck.com" diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index f147352..9a9d0fe 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "superpowers", - "version": "6.4.2", + "version": "7.0.0", "description": "An agentic skills framework & software development methodology that works: planning, TDD, debugging, and collaboration workflows.", "author": { "name": "Jesse Vincent", diff --git a/.cursor-plugin/plugin.json b/.cursor-plugin/plugin.json index 8a8475c..e769727 100644 --- a/.cursor-plugin/plugin.json +++ b/.cursor-plugin/plugin.json @@ -2,7 +2,7 @@ "name": "superpowers", "displayName": "Superpowers", "description": "Core skills library: TDD, debugging, collaboration patterns, and proven techniques", - "version": "6.4.2", + "version": "7.0.0", "author": { "name": "Jesse Vincent", "email": "jesse@fsck.com" diff --git a/.devin-plugin/plugin.json b/.devin-plugin/plugin.json index 71d0f0b..fd40a96 100644 --- a/.devin-plugin/plugin.json +++ b/.devin-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "superpowers", - "version": "6.4.2", + "version": "7.0.0", "description": "An agentic skills framework & software development methodology that works: planning, TDD, debugging, and collaboration workflows.", "author": { "name": "Jesse Vincent", diff --git a/.hermes-plugin/__init__.py b/.hermes-plugin/__init__.py index 3b41644..7d4e1f5 100644 --- a/.hermes-plugin/__init__.py +++ b/.hermes-plugin/__init__.py @@ -37,6 +37,25 @@ def _strip_frontmatter(content: str) -> str: return (match.group(1) if match else content).strip() +def _frontmatter_value(content: str, key: str) -> str: + """Return a flat ``key: value`` scalar from a SKILL.md frontmatter block. + + Hermes reads a skill's description from ``register_skill``'s ``description`` + argument, which defaults to "" — registering only the path left every stock + skill with a blank description in the skill catalogue, so the model had + nothing to select on. Stock frontmatter is a flat block of single-line + scalars, so a line scan covers it without a YAML dependency. + """ + match = re.match(r"^---\n([\s\S]*?)\n---\n", content) + if not match: + return "" + for line in match.group(1).splitlines(): + name, sep, value = line.partition(":") + if sep and name.strip() == key: + return value.strip().strip("\"'") + return "" + + def _build_bootstrap(skills_dir: str) -> str: with open( os.path.join(skills_dir, "using-superpowers", "SKILL.md"), @@ -82,7 +101,9 @@ def register(ctx): for name in sorted(os.listdir(skills_dir)): skill_md = os.path.join(skills_dir, name, "SKILL.md") if os.path.isfile(skill_md): - ctx.register_skill(name, Path(skill_md)) + with open(skill_md, encoding="utf-8") as f: + description = _frontmatter_value(f.read(), "description") + ctx.register_skill(name, Path(skill_md), description=description) # pre_llm_call returning {"context": ...} is the documented injection path # (on_session_start return values are ignored, and ctx.inject_message diff --git a/.hermes-plugin/plugin.yaml b/.hermes-plugin/plugin.yaml index 9de7655..f2da36c 100644 --- a/.hermes-plugin/plugin.yaml +++ b/.hermes-plugin/plugin.yaml @@ -1,5 +1,5 @@ name: superpowers -version: 6.4.2 +version: 7.0.0 description: Superpowers skills and workflow bootstrap for Hermes Agent author: obra provides_hooks: diff --git a/.kimi-plugin/plugin.json b/.kimi-plugin/plugin.json index 1effbcf..3da881d 100644 --- a/.kimi-plugin/plugin.json +++ b/.kimi-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "superpowers", - "version": "6.4.2", + "version": "7.0.0", "description": "An agentic skills framework and software development methodology.", "author": { "name": "Jesse Vincent", diff --git a/.muse-plugin/marketplace.json b/.muse-plugin/marketplace.json index c3d7295..4306a70 100644 --- a/.muse-plugin/marketplace.json +++ b/.muse-plugin/marketplace.json @@ -9,7 +9,7 @@ { "name": "superpowers", "description": "Core skills library for Muse: TDD, debugging, collaboration patterns, and proven techniques", - "version": "6.4.2", + "version": "7.0.0", "source": "./", "author": { "name": "Jesse Vincent", diff --git a/.muse-plugin/plugin.json b/.muse-plugin/plugin.json index 3588fd5..32bdcbf 100644 --- a/.muse-plugin/plugin.json +++ b/.muse-plugin/plugin.json @@ -2,7 +2,7 @@ "schemaVersion": 1, "name": "superpowers", "displayName": "Superpowers", - "version": "6.4.2", + "version": "7.0.0", "description": "Core skills library for Muse: TDD, debugging, collaboration patterns, and proven techniques", "compat": { "source": "native", diff --git a/.opencode/INSTALL.md b/.opencode/INSTALL.md index dca404b..2102fd1 100644 --- a/.opencode/INSTALL.md +++ b/.opencode/INSTALL.md @@ -79,7 +79,7 @@ V1 `plugin` key and the V2 `plugins` key): ```json { - "plugin": ["superpowers@git+https://github.com/obra/superpowers.git#v6.4.2"] + "plugin": ["superpowers@git+https://github.com/obra/superpowers.git#v7.0.0"] } ``` diff --git a/.version-bump.json b/.version-bump.json index 8d95be0..c80749f 100644 --- a/.version-bump.json +++ b/.version-bump.json @@ -7,6 +7,7 @@ { "path": ".codex-plugin/plugin.json", "field": "version" }, { "path": ".devin-plugin/plugin.json", "field": "version" }, { "path": ".kimi-plugin/plugin.json", "field": "version" }, + { "path": ".antigravity-plugin/plugin.json", "field": "version" }, { "path": ".muse-plugin/plugin.json", "field": "version" }, { "path": ".claude-plugin/marketplace.json", "field": "plugins.0.version" }, { "path": ".muse-plugin/marketplace.json", "field": "plugins.0.version" }, @@ -89,8 +89,9 @@ Install Superpowers as a plugin from this repository: agy plugin install https://github.com/obra/superpowers ``` -Antigravity runs the plugin's session-start hook, so Superpowers is active from -the first message. Reinstall with the same command to update. +Antigravity lists each installed skill's description, and the description of +the `using-superpowers` skill prompts the model to load that skill at the start +of a conversation. Reinstall with the same command to update. ### Codex App @@ -306,7 +307,7 @@ Restart any active Muse sessions after installing so the `SessionStart` hook tak ## The Basic Workflow -1. **brainstorming** - Activates before writing code. Refines rough ideas through questions, explores alternatives, presents design in sections for validation. Saves design document. +1. **brainstorming** - Activates before building anything. Draws out what you actually want, and why, through questions that get you describing it, then plays its understanding back for correction. Small changes get agreed in chat; projects get a written design document a builder could plan from. 2. **using-git-worktrees** - Activates after design approval. Creates isolated workspace on new branch, runs project setup, verifies clean test baseline. @@ -349,7 +350,7 @@ Superpowers is built by [Jesse Vincent](https://blog.fsck.com) and the rest of t - **diagnosing-superpowers** - Work out what went wrong in a session, with evidence; export a scrubbed bundle or file an issue **Collaboration** -- **brainstorming** - Socratic design refinement +- **brainstorming** - Drawing out intent before building - **writing-plans** - Detailed implementation plans - **executing-plans** - Inline plan execution: one context, one final review - **dispatching-parallel-agents** - Concurrent subagent workflows diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 44490ef..1789816 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,5 +1,53 @@ # Superpowers Release Notes +## v7.0.0 (2026-10-09) + +We rebuilt brainstorming from scratch so it does a much better job of what it was always for: helping you work out what you actually want and put it into words before anything gets built. The new skill asks you to describe what you're after and why, plays back what it heard so you can correct it, and keeps asking good questions until the picture is clear. Then it matches the process to the work, from just doing it to writing a full design. + +This release also adds a native plugin manifest for the Antigravity Marketplace and fixes Windows hook discovery, Git Bash paths, Hermes skill descriptions, and several smaller bugs. + +### Brainstorming + +- **Brainstorming draws out what you want before it proposes anything.** Its first message offers to skip the questions and asks one open question about a real moment or a concrete picture. It offers a menu only when you're stuck. Along the way, it offers to look at prior art, your project, or the web. As it understands each part, it plays that part back in a few hundred words and marks its guesses as guesses. (#2463) +- **It sizes the work after it understands what you want, and says so in plain words.** It does a quick, clear task right away, agrees a small change with you in chat, and writes a design document for a project. You can override its call, and it steps up a size if the work grows. (#2463) +- **A builder check replaces the spec-document reviewer.** A fresh subagent reads the design as the person who'll build it and lists what they'd still need to ask. Brainstorming answers what it can, makes the minor calls itself and marks them as its own, and brings you the questions that change what gets built, in one round. (#2463) +- **It finds out which choices about how the thing gets made you want to own.** Platform, language, libraries, medium: if you have strong views, it talks them through; if you hand them over, it picks sensible defaults and tells you what it picked. It does this even when you skip the questions. We made this change after a session designed an iOS app, never asked about platform, and built a web app. (#2482, #2483) +- **It offers the visual companion whenever seeing would help more than reading:** screens, layouts, flows, options that look different, diagrams. The offer drops its token-cost warning. (#2463) +- **The visual companion now shows screens containing `$'`, `$&`, and similar sequences intact.** The server inserted content with `String.replace`, which treats those sequences as replacement patterns. It now inserts content literally. Thanks @andrew-yian for the report and @luochen211 for the fix. (#2362, #2364) + +### Antigravity + +- **`agy plugin install https://github.com/obra/superpowers` now installs Superpowers as a native Antigravity plugin.** We added `.antigravity-plugin/plugin.json` with the Marketplace display name, logo, and suggested prompts. Previously, agy fell back to importing the repo as a Gemini CLI extension, then rejected the copied Claude-format hooks file on every session with `invalid hook "hooks": command hook must specify 'command'`. The install command stays the same. (#2479) +- **Superpowers bootstraps on Antigravity through skill discovery.** Antigravity has no session-start hook event, but it shows the model each installed skill's description, and `using-superpowers`' "Use when starting any conversation" prompts the model to load it. We verified this on agy 1.3.1 across 12 runs: "Let's make a react todo list" and "add a settings page" triggered brainstorming before any code, and a failing test triggered systematic-debugging before any edit. We also corrected the README and porting guide, which described a session-start hook and install script that never existed. (#2479) + +### Hooks + +- **SessionStart now works when the harness launches it with a broken `PATH`.** The hooks no longer look up `dirname`, `cat`, or `bash` on `PATH`, so a startup `PATH` that can't resolve them (anthropics/claude-code#43127) no longer drops the bootstrap. Thanks @kannan983 for the report and Ada Sen for the fix. (#2310, #2349) +- **Windows: `run-hook.cmd` finds per-user Git for Windows installs and skips WSL launchers.** It now checks `%LOCALAPPDATA%\Programs\Git`, and when it searches `PATH`, it skips the WSL `bash.exe` launchers, which fail without a Linux distro. Thanks @jp5247 for the report, and @citizen204 (#1864) and @KaiyiQuan (#2365) for the fixes we combined here. (#1863, #2393) +- **Windows: `run-hook.cmd` ignores `bash` and `where` in the current directory.** Previously, a repository could plant `bash.cmd` or `where.bat` and have it run at session start. (#2393) +- **Windows: `run-hook.cmd` now passes hook exit codes to the harness.** It used to report success even when the hook failed. (#2393) + +### Subagent-Driven Development + +- **`sdd-workspace` leaves a repo's own `.superpowers/sdd/.gitignore` alone.** It used to overwrite the file with `*` on every run, reverting any version a repo committed (for example, to track `progress.md` ledgers). It now writes the default only when no file exists. Thanks @aruizcu1989 for the fix. (#2161, #2399) +- **Plan markers stay repo-relative on Windows.** On Git Bash, `sdd-workspace` compared `git rev-parse`'s `C:/…` root with the plan's `/c/…` path, so every workspace marker recorded an absolute, machine-specific path. It now resolves the root the same way as the plan path. We found this while landing @t0domanh's Windows test fixes (#2149). + +### Executing Plans + +- **`task-done` now records tasks whose test command passes silently.** When a passing command printed nothing, `task-done` exited 1 without writing the ledger line, so a finished task looked unfinished. It now records `→ (no output)`. Thanks @KenM-BT for the report and Ada Sen for the fix. (#2385, #2388) + +### Requesting Code Review + +- **The example's base-SHA command survives skill arguments.** Claude Code replaces `$1` in a skill body with the second argument word, so invoking the skill with arguments turned `awk '{print $1}'` into `awk '{print <word>}'`. The example now uses `cut -d' ' -f1`, which contains no `$`. Thanks @errmakov for the report and @klemens-floege for the fix. (#2311, #2361) + +### Systematic Debugging + +- **The multi-layer diagnostic example no longer prints the secret it checks for.** `${IDENTITY:+SET}${IDENTITY:-UNSET}` and `env | grep IDENTITY` both echoed the signing identity's value into logs. The example now reports only whether the variable is set. Thanks @kennyg-g for the report and @m2dumpling for the fix. (#2375, #2380) + +### Hermes Agent + +- **Hermes' skill list now shows Superpowers skill descriptions.** Hermes lists each plugin skill with the description passed to `register_skill`, which defaults to empty. The plugin passed only a name and path, so every skill appeared blank and the model had nothing to choose from. The plugin now passes each skill's frontmatter description. Thanks @pepijn-blom for the fix. (#2284) + ## v6.4.2 (2026-09-25) `writing-plans` produces leaner plans, faster. Plans now record the decisions an implementer needs (signatures, test assertions, the spec's values) instead of writing out the code. Some frontier models, including Opus 5.5, could get overzealous during plan writing and, with certain prompting, would sometimes try to implement the entire project while designing the plan. The new skill keeps planning focused on the plan. When we reproduced the original report, the scratch builds went away, and plans took a quarter of the time and about a third of the tokens. Thanks to Harper Reed for the report and session bundle. (#2333) diff --git a/assets/antigravity-logo.png b/assets/antigravity-logo.png Binary files differnew file mode 100644 index 0000000..638935d --- /dev/null +++ b/assets/antigravity-logo.png diff --git a/docs/README.opencode.md b/docs/README.opencode.md index 404a65d..980941e 100644 --- a/docs/README.opencode.md +++ b/docs/README.opencode.md @@ -111,7 +111,7 @@ V1 `plugin` key and the V2 `plugins` key): ```json { - "plugin": ["superpowers@git+https://github.com/obra/superpowers.git#v6.4.2"] + "plugin": ["superpowers@git+https://github.com/obra/superpowers.git#v7.0.0"] } ``` diff --git a/docs/porting-to-a-new-harness.md b/docs/porting-to-a-new-harness.md index ce37418..f52cd70 100644 --- a/docs/porting-to-a-new-harness.md +++ b/docs/porting-to-a-new-harness.md @@ -292,10 +292,10 @@ part of the installed extension** — never substitute "edit the user's global | runs a shell command at session start and reads its stdout | A (shell-hook) | Cursor (`hooks/session-start` + `hooks/hooks-cursor.json` + `.cursor-plugin/`) | | is a JS/TS plugin host with session/message lifecycle callbacks | B (in-process) | OpenCode (`.opencode/`) — or pi (`.pi/`) if it has no native skill tool | | ships an extension-declared context file it always loads | C (instructions-file) | Gemini (`gemini-extension.json` + `GEMINI.md` + `references/gemini-tools.md`) | -| has a plugin install command and a manifest `contextFileName` (or equivalent) the installer keeps | C via the plugin installer | Antigravity (`.antigravity-plugin/` — `agy plugin install` ships a generated context file; verify the installer preserves it — Part 6) | +| lists each installed skill's description, with no session-start event and no context-file field | skill-index bootstrap (Part 5 Step 5, case 2 fallback) | Antigravity (`.antigravity-plugin/plugin.json` + `skills/` only) | -Most real harnesses fit one row cleanly; the last is the hybrid case (rule 2 still -holds — the bootstrap rides the install mechanism, never a user-config edit). +Most real harnesses fit one row cleanly; the last is the soft case — see Step 5's +fallback caveats (rule 2 still holds — never a user-config edit). --- @@ -525,11 +525,22 @@ honors the rule rather than breaking it. Distinguish three cases: the file-read tool when the skill applies** — the sanctioned mechanism here, the way `references/pi-tools.md` states it. - **For the bootstrap itself, prefer a declared context file (Part 6).** If the - harness has a `contextFileName`-style manifest field — as Antigravity does — - ship a generated context file through the installer: it's guaranteed-loaded and - carries both the `using-superpowers` content and the tool mapping. That is the - strong, preferred path. + **For the bootstrap itself, prefer something the harness loads every + session (Part 6)** — a declared context file where the manifest has a + `contextFileName`-style field. Antigravity has none, and its other options + cost more than they buy, so it uses the surfaced skill index below: + - Its hooks have no session-start event. `PreInvocation` runs before every + model call; an `ephemeralMessage` it injects is dropped on the next call, + and `invocationNum` resets on each user turn. A `userMessage` gated on + `invocationNum == 0` and `initialNumSteps == 1` injects exactly once per + conversation, but agy still starts the hook process on every model call. + `${PLUGIN_ROOT}` is not set in hooks (they run from the plugin root). + `hooks.json` must sit at the plugin root; no manifest field moves it. + - It loads `rules/*.md` from a plugin every session, but harnesses that + install from the git repo share its root, and Cursor is one of them: it + also loads any `rules/*.md` a plugin ships. A file in a shared plugin root + is visible to every harness that reads that root — check before adding + one. **Fallback — the surfaced skill index.** If there's no context-file field but the harness surfaces each installed skill's name + description at session start, @@ -678,7 +689,7 @@ it. Distribution differs per harness ecosystem — find yours: | External marketplace fork, synced by script | Codex | `scripts/sync-to-codex-plugin.sh` rsyncs the tracked plugin files into a separate fork repo and opens a PR. Read its include/exclude list so you ship the right tree (it deliberately drops repo-internal dirs and other harnesses' dotdirs). | | Git-URL extension install | Gemini, Kimi Code, OpenCode | Users install from a git URL (`gemini extensions install …`; Kimi Code `/plugins install …`; an `opencode.json` `plugin` array entry). Document the exact command. | | Package-manifest fields | pi | Declared through fields in the repo-root `package.json`; users install via the harness's package command. | -| Local installer (plugin install) | Antigravity (`agy`) | A small `install.sh` that runs the harness's own `agy plugin install` against a staging dir holding the manifest, the skills, and a generated `contextFileName` context file (the bootstrap). Everything arrives through the install mechanism — *not* by editing the user's config (see below). | +| Git-URL plugin install + marketplace | Antigravity (`agy`) | Users run `agy plugin install https://github.com/obra/superpowers`. agy reads `.antigravity-plugin/plugin.json`, whose Marketplace fields (`displayName`, `logo`, `suggestedPrompts`, `version`, `author`) also drive the Antigravity Marketplace listing. Without that manifest, agy falls back to importing `gemini-extension.json`. | Then: @@ -694,13 +705,9 @@ Then: session), that is the strongest clean bootstrap: declare it, and the installer preserves it *and* the harness loads it. Generate it at install time from the live `using-superpowers/SKILL.md` + the tool mapping (wrapped in - `<EXTREMELY_IMPORTANT>`) so the installed bootstrap never drifts. This is what - `.antigravity-plugin/install.sh` does — `agy plugin install` reports - `✔ context : ANTIGRAVITY.md`, and a clean session reads `using-superpowers`'s - SKILL.md, loads `brainstorming`, and enters the brainstorming flow before any - code. **Verify with a marker** that the installer keeps the file and the - harness loads it: one porter wrongly concluded it couldn't, because they - shipped the file *without* declaring `contextFileName` and it was stripped as + `<EXTREMELY_IMPORTANT>`) so the installed bootstrap never drifts. + **Verify with a marker** that the installer keeps the file and the + harness loads it: a file the manifest doesn't declare can be stripped as unrecognized. - **Otherwise lean on the installed `using-superpowers` skill itself.** If the harness surfaces each installed skill's name + description at session start, @@ -796,6 +803,7 @@ Use this as the live index; when in doubt, read the files, not this table. | Harness | Entry point | Bootstrap mechanism | Tool mapping | Tests | Distribution | |---|---|---|---|---|---| +| Antigravity (`agy`) | `.antigravity-plugin/plugin.json` | surfaced skill index: `using-superpowers`' description triggers it (no session-start hook event exists) | `references/antigravity-tools.md` | `tests/antigravity/` | `agy plugin install` git URL; Antigravity Marketplace | | Claude Code | `.claude-plugin/plugin.json` + `hooks/hooks.json` | shell hook → `hooks/session-start` (`hookSpecificOutput.additionalContext`) | native `Skill` tool; no adapter file needed | `tests/hooks/` | marketplace | | Codex | `.codex-plugin/plugin.json` (declares empty `hooks`) | native skill discovery (no session-start hook) | `references/codex-tools.md` | `tests/codex/`, `tests/codex-plugin-sync/` | fork sync (`scripts/sync-to-codex-plugin.sh`) | | Cursor | `.cursor-plugin/plugin.json` + `hooks/hooks-cursor.json` | shell hook → `hooks/session-start` (`additional_context`) | none needed (Claude Code–compatible tool surface) | `tests/hooks/` | hand-authored | diff --git a/docs/superpowers/plans/2026-10-06-antigravity-marketplace.md b/docs/superpowers/plans/2026-10-06-antigravity-marketplace.md new file mode 100644 index 0000000..5804e05 --- /dev/null +++ b/docs/superpowers/plans/2026-10-06-antigravity-marketplace.md @@ -0,0 +1,711 @@ +# Antigravity Marketplace Plugin Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Ship a native Antigravity plugin (manifest with Marketplace fields, logo, always-on rule bootstrap) so Superpowers can be listed in the Antigravity Marketplace. + +**Architecture:** agy reads `.antigravity-plugin/plugin.json` and discovers `skills/` by default. A one-line always-on rule, `rules/AGENTS.md`, `@`-points at `skills/using-superpowers/SKILL.md`; agy rewrites that path to an absolute install path and the model reads it with `view_file`. The logo is a PNG rendered from `assets/superpowers-small.svg` by a script. + +**Tech Stack:** bash, python3 (stdlib only, in tests), `rsvg-convert` (logo rendering only), `agy` 1.3.1 (optional in tests, required for live acceptance), `jq`. + +**Spec:** `docs/superpowers/specs/2026-10-06-antigravity-marketplace-design.md` + +> **Historical record.** This plan was executed as written. The `rules/AGENTS.md` bootstrap it describes was later removed in favor of skill discovery, and the Marketplace copy was replaced; see spec §1 and §2 for the shipped design. + +## Global Constraints + +- Work on branch `antigravity-marketplace`. PRs target `dev`. +- Never copy `using-superpowers` content into another file. The rule is a pointer only. +- No root `plugin.json` and no root `hooks.json` (either changes how agy reads the plugin). +- Manifest `name` is `superpowers`; must match `^[a-z0-9]+(-[a-z0-9]+)*$`. +- Manifest `description` is at most 160 characters. +- `suggestedPrompts`: 1–3 non-empty strings. +- Manifest `version` equals `.claude-plugin/plugin.json`'s `version` (6.4.2 at time of writing). +- `author` matches `.claude-plugin/plugin.json`: `{ "name": "Jesse Vincent", "email": "jesse@fsck.com" }`. +- Logo: `assets/antigravity-logo.png`, 512×512 RGBA PNG; white rounded square inset 31px, corner radius 100; mark `#1a1a1a`, scale 0.905 about (256,256). +- `${PLUGIN_ROOT}` is not substituted in rules. Do not use it in `rules/AGENTS.md`. +- New shell scripts must pass `scripts/lint-shell.sh <file>`. +- Any `agy plugin install` done for testing must be followed by `agy plugin uninstall superpowers`. + +--- + +## File Map + +| File | Action | Responsibility | +|---|---|---| +| `scripts/render-antigravity-logo.sh` | Create | Compose logo SVG from `assets/superpowers-small.svg`, rasterize to PNG | +| `assets/antigravity-logo.png` | Create (generated) | Marketplace logo | +| `.antigravity-plugin/plugin.json` | Create | Native manifest with Marketplace fields | +| `rules/AGENTS.md` | Create | Always-on bootstrap pointer | +| `.version-bump.json` | Modify | Register the new manifest's version | +| `tests/antigravity/test-logo.sh` | Create | Logo file shape checks | +| `tests/antigravity/test-plugin-manifest.sh` | Create | Manifest, rule, and layout checks; `agy plugin validate` when available | +| `tests/antigravity/test-antigravity-tools.sh` | Modify | Fix stale header comment | +| `scripts/sync-to-codex-plugin.sh` | Modify | Exclude Antigravity-only files from the Codex sync | +| `tests/codex-plugin-sync/test-sync-to-codex-plugin.sh` | Modify | Assert those exclusions | +| `README.md` | Modify | Antigravity section prose | +| `docs/porting-to-a-new-harness.md` | Modify (separate commit) | Remove phantom installer; record agy findings | + +--- + +### Task 1: Logo renderer and logo + +**Files:** +- Create: `scripts/render-antigravity-logo.sh` +- Create: `assets/antigravity-logo.png` (generated by the script) +- Test: `tests/antigravity/test-logo.sh` + +**Interfaces:** +- Produces: `assets/antigravity-logo.png` (Task 2's manifest `logo` field points here). `scripts/render-antigravity-logo.sh [--output PATH]`, default output `assets/antigravity-logo.png`. + +- [ ] **Step 1: Write the failing test** + +Create `tests/antigravity/test-logo.sh`: + +```bash +#!/usr/bin/env bash +# Check the Antigravity Marketplace logo: a square RGBA PNG at least 128x128 +# (the Marketplace minimum), at the path the manifest names. When rsvg-convert +# is available, also check the committed PNG matches a fresh render, so the +# asset can't drift from scripts/render-antigravity-logo.sh. +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +LOGO="$REPO_ROOT/assets/antigravity-logo.png" + +fail() { echo "FAIL: $*" >&2; exit 1; } + +echo "test-logo: checking Antigravity logo" + +[ -f "$LOGO" ] || fail "logo missing at $LOGO" + +python3 - "$LOGO" <<'PY' +import struct +import sys + +data = open(sys.argv[1], "rb").read() +if data[:8] != b"\x89PNG\r\n\x1a\n": + raise SystemExit("FAIL: logo is not a PNG") +width, height, bit_depth, color_type = struct.unpack(">IIBB", data[16:26]) +if width != height: + raise SystemExit(f"FAIL: logo is not square ({width}x{height})") +if width < 128: + raise SystemExit(f"FAIL: logo is smaller than 128x128 ({width}x{height})") +if color_type != 6: + raise SystemExit(f"FAIL: logo is not RGBA (PNG color type {color_type})") +PY + +if command -v rsvg-convert >/dev/null 2>&1; then + tmp="$(mktemp -d)" + trap 'rm -f "$tmp/logo.png"; rmdir "$tmp"' EXIT + bash "$REPO_ROOT/scripts/render-antigravity-logo.sh" --output "$tmp/logo.png" >/dev/null + cmp -s "$tmp/logo.png" "$LOGO" \ + || fail "assets/antigravity-logo.png is stale; run scripts/render-antigravity-logo.sh" +else + echo "SKIP: rsvg-convert not on PATH; not checking logo freshness" +fi + +echo "PASS: Antigravity logo valid" +``` + +- [ ] **Step 2: Run test to verify it fails** + +Run: `bash tests/antigravity/test-logo.sh` +Expected: `FAIL: logo missing at .../assets/antigravity-logo.png`, exit 1. + +- [ ] **Step 3: Write the renderer** + +Create `scripts/render-antigravity-logo.sh`: + +```bash +#!/usr/bin/env bash +# +# Render the Antigravity Marketplace logo from assets/superpowers-small.svg. +# +# Usage: +# scripts/render-antigravity-logo.sh [--output PATH] +# +# Draws the Superpowers mark in near-black on a white rounded square with +# transparent corners, 512x512 PNG. Run it whenever superpowers-small.svg +# changes; tests/antigravity/test-logo.sh fails if the committed PNG is stale. +# Requires rsvg-convert (Homebrew: librsvg). +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +SOURCE_SVG="$REPO_ROOT/assets/superpowers-small.svg" +OUTPUT="$REPO_ROOT/assets/antigravity-logo.png" + +usage() { + sed -n '2,11p' "$0" | sed 's/^# \{0,1\}//' +} + +die() { + echo "error: $*" >&2 + exit 1 +} + +while [[ $# -gt 0 ]]; do + case "$1" in + --output) + [[ $# -ge 2 ]] || die "--output needs a path" + OUTPUT="$2" + shift 2 + ;; + -h | --help) + usage + exit 0 + ;; + *) + usage >&2 + die "unknown argument: $1" + ;; + esac +done + +command -v rsvg-convert >/dev/null 2>&1 \ + || die "rsvg-convert is not on PATH (install librsvg, e.g. 'brew install librsvg')" +[[ -r "$SOURCE_SVG" ]] || die "source mark not readable: $SOURCE_SVG" + +# Everything inside the source <svg> element: the mark's paths and ellipse. +mark="$(sed -E 's/^.*<svg[^>]*>//; s#</svg>.*$##' "$SOURCE_SVG")" +[[ -n "$mark" ]] || die "could not extract the mark from $SOURCE_SVG" + +# The mark's bounding box is centered at (256,256) in its 512 viewBox and is +# 348 units wide; scale 0.905 makes it ~70% of the 450-unit rounded square. +composed="$(mktemp)" +trap 'rm -f "$composed"' EXIT +cat >"$composed" <<EOF +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512"> + <rect x="31" y="31" width="450" height="450" rx="100" ry="100" fill="#ffffff"/> + <g fill="#1a1a1a" transform="translate(256 256) scale(0.905) translate(-256 -256)">$mark</g> +</svg> +EOF + +rsvg-convert -w 512 -h 512 "$composed" -o "$OUTPUT" +echo "wrote $OUTPUT" +``` + +Then: `chmod +x scripts/render-antigravity-logo.sh` + +- [ ] **Step 4: Render the logo and look at it** + +Run: `bash scripts/render-antigravity-logo.sh` +Expected: `wrote .../assets/antigravity-logo.png`. + +Open `assets/antigravity-logo.png` with the Read tool and confirm: white rounded square, transparent corners, full mark (two arcs, two inner strokes, and the center dot) centered in near-black. + +- [ ] **Step 5: Run the test and the shell linter** + +Run: `bash tests/antigravity/test-logo.sh && scripts/lint-shell.sh scripts/render-antigravity-logo.sh tests/antigravity/test-logo.sh` +Expected: `PASS: Antigravity logo valid`, linter clean. Also run `bash scripts/render-antigravity-logo.sh --help` and confirm it prints usage. + +- [ ] **Step 6: Commit** + +```bash +git add scripts/render-antigravity-logo.sh assets/antigravity-logo.png tests/antigravity/test-logo.sh +git commit -m "feat(antigravity): render Marketplace logo from the Superpowers mark" +``` + +--- + +### Task 2: Native manifest, bootstrap rule, version bump + +**Files:** +- Create: `.antigravity-plugin/plugin.json` +- Create: `rules/AGENTS.md` +- Modify: `.version-bump.json` (add one entry to `files`) +- Test: `tests/antigravity/test-plugin-manifest.sh` + +**Interfaces:** +- Consumes: `assets/antigravity-logo.png` from Task 1. +- Produces: `.antigravity-plugin/plugin.json`, `rules/AGENTS.md` (Task 3 excludes both from the Codex sync; Task 5 installs them). + +- [ ] **Step 1: Write the failing test** + +Create `tests/antigravity/test-plugin-manifest.sh`: + +```bash +#!/usr/bin/env bash +# Validate the native Antigravity plugin: the Marketplace manifest, the +# always-on rule that bootstraps using-superpowers, and the repo layout agy +# depends on. CI-safe; when `agy` is on PATH, also runs `agy plugin validate`. +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" + +echo "test-plugin-manifest: checking Antigravity plugin" + +python3 - "$REPO_ROOT" <<'PY' +import json +import re +import struct +import sys +from pathlib import Path + +root = Path(sys.argv[1]) + +def fail(message): + raise SystemExit(f"FAIL: {message}") + +manifest_path = root / ".antigravity-plugin" / "plugin.json" +if not manifest_path.is_file(): + fail(f"manifest missing at {manifest_path}") +manifest = json.loads(manifest_path.read_text(encoding="utf-8")) + +# --- Marketplace-required fields ------------------------------------------- +for field in ["name", "description", "displayName", "logo", + "suggestedPrompts", "version", "author"]: + if not manifest.get(field): + fail(f"manifest field {field!r} is missing or empty") + +if manifest["name"] != "superpowers": + fail(f"name must be 'superpowers', got {manifest['name']!r}") +if not re.fullmatch(r"[a-z0-9]+(-[a-z0-9]+)*", manifest["name"]): + fail("name is not kebab-case") + +description_length = len(manifest["description"]) +if not 120 <= description_length <= 160: + fail(f"description is {description_length} characters; Marketplace wants 120-160") + +prompts = manifest["suggestedPrompts"] +if not isinstance(prompts, list) or not 1 <= len(prompts) <= 3: + fail("suggestedPrompts must be a list of 1-3 prompts") +if not all(isinstance(p, str) and p.strip() for p in prompts): + fail("suggestedPrompts entries must be non-empty strings") + +claude_manifest = json.loads( + (root / ".claude-plugin" / "plugin.json").read_text(encoding="utf-8")) +if manifest["version"] != claude_manifest["version"]: + fail(f"version {manifest['version']!r} != .claude-plugin version " + f"{claude_manifest['version']!r}") +if manifest["author"] != claude_manifest["author"]: + fail("author does not match .claude-plugin/plugin.json") + +# --- Logo ------------------------------------------------------------------ +logo = root / manifest["logo"] +if not logo.is_file(): + fail(f"logo {manifest['logo']!r} does not exist") +header = logo.read_bytes()[:26] +if header[:8] != b"\x89PNG\r\n\x1a\n": + fail("logo is not a PNG") +width, height = struct.unpack(">II", header[16:24]) +if width != height or width < 128: + fail(f"logo must be square and at least 128x128, got {width}x{height}") + +# --- Version bumps --------------------------------------------------------- +version_config = json.loads((root / ".version-bump.json").read_text(encoding="utf-8")) +if not any(entry.get("path") == ".antigravity-plugin/plugin.json" + and entry.get("field") == "version" + for entry in version_config.get("files", [])): + fail(".version-bump.json does not register .antigravity-plugin/plugin.json") + +# --- Bootstrap rule: @-pointers only, each resolving from rules/ ----------- +rule = root / "rules" / "AGENTS.md" +if not rule.is_file(): + fail(f"bootstrap rule missing at {rule}") +lines = [line.strip() for line in rule.read_text(encoding="utf-8").splitlines() + if line.strip()] +if not lines: + fail("bootstrap rule is empty") +for line in lines: + if not line.startswith("@"): + fail(f"bootstrap rule must contain only @-pointers, found: {line!r}") + target = (rule.parent / line[1:]).resolve() + if not target.is_file(): + fail(f"rule pointer {line!r} does not resolve from rules/ to a file") +if not any(line.endswith("skills/using-superpowers/SKILL.md") for line in lines): + fail("bootstrap rule does not point at using-superpowers") + +# --- Layout agy depends on ------------------------------------------------- +for stray in ["plugin.json", "hooks.json"]: + if (root / stray).exists(): + fail(f"root {stray} must not exist; agy would read it instead") +PY + +if command -v agy >/dev/null 2>&1; then + output="$(agy plugin validate "$REPO_ROOT" 2>&1)" \ + || { echo "$output" >&2; echo "FAIL: agy plugin validate failed" >&2; exit 1; } + grep -q '\[ok\]' <<<"$output" \ + || { echo "$output" >&2; echo "FAIL: agy plugin validate did not report [ok]" >&2; exit 1; } + grep -qE 'skills +: [0-9]+ processed' <<<"$output" \ + || { echo "$output" >&2; echo "FAIL: agy found no skills" >&2; exit 1; } +else + echo "SKIP: agy not on PATH; not running agy plugin validate" +fi + +echo "PASS: Antigravity plugin manifest and bootstrap rule valid" +``` + +Note: `agy plugin validate` output contains ANSI color codes around `[ok]`; the `grep -q '\[ok\]'` still matches because the codes surround, not split, the text. Verify this in Step 4; if it does not match, strip codes with `sed 's/\x1b\[[0-9;]*m//g'` before grepping. + +- [ ] **Step 2: Run test to verify it fails** + +Run: `bash tests/antigravity/test-plugin-manifest.sh` +Expected: `FAIL: manifest missing at .../.antigravity-plugin/plugin.json`, exit 1. + +- [ ] **Step 3: Write the manifest, the rule, and the version-bump entry** + +Create `.antigravity-plugin/plugin.json`: + +```json +{ + "name": "superpowers", + "displayName": "Superpowers", + "version": "6.4.2", + "description": "Skills that make your coding agent work like a senior engineer: brainstorming, planning, test-driven development, systematic debugging, and code review.", + "logo": "assets/antigravity-logo.png", + "suggestedPrompts": [ + "Let's brainstorm a new feature before writing any code", + "Help me systematically debug a failing test", + "Write an implementation plan for this change" + ], + "category": "Developer Tools", + "keywords": [ + "skills", + "tdd", + "debugging", + "collaboration", + "best-practices", + "workflows" + ], + "author": { + "name": "Jesse Vincent", + "email": "jesse@fsck.com" + }, + "homepage": "https://github.com/obra/superpowers", + "repository": "https://github.com/obra/superpowers", + "license": "MIT" +} +``` + +The `description` and `suggestedPrompts` copy needs Jesse's approval before this commit. If he changes it, keep the description 120–160 characters. + +Create `rules/AGENTS.md` containing exactly one line: + +``` +@../skills/using-superpowers/SKILL.md +``` + +In `.version-bump.json`, add after the `.kimi-plugin/plugin.json` entry: + +```json + { "path": ".antigravity-plugin/plugin.json", "field": "version" }, +``` + +- [ ] **Step 4: Run tests to verify they pass** + +Run: `bash tests/antigravity/test-plugin-manifest.sh && scripts/bump-version.sh --check && scripts/bump-version.sh --audit && bash tests/version-bump/test-bump-version.sh && scripts/lint-shell.sh tests/antigravity/test-plugin-manifest.sh` +Expected: `PASS: Antigravity plugin manifest and bootstrap rule valid` (with the agy validate step running, since agy is installed here), version check reports all files at 6.4.2, audit finds no unlisted version strings, version-bump test passes, linter clean. + +- [ ] **Step 5: Commit** + +```bash +git add .antigravity-plugin/plugin.json rules/AGENTS.md .version-bump.json tests/antigravity/test-plugin-manifest.sh +git commit -m "feat(antigravity): native plugin manifest with always-on bootstrap rule" +``` + +--- + +### Task 3: Keep Antigravity-only files out of the Codex sync + +**Files:** +- Modify: `scripts/sync-to-codex-plugin.sh` (the `EXCLUDES=(` array, ~line 45) +- Test: `tests/codex-plugin-sync/test-sync-to-codex-plugin.sh` + +**Interfaces:** +- Consumes: the paths `.antigravity-plugin/plugin.json`, `rules/AGENTS.md`, `assets/antigravity-logo.png`. + +- [ ] **Step 1: Write the failing test** + +In `tests/codex-plugin-sync/test-sync-to-codex-plugin.sh`: + +In `write_upstream_fixture`, add `"$repo/.antigravity-plugin"` and `"$repo/rules"` to the `mkdir -p` list. After the `.kimi-plugin/plugin.json` heredoc (~line 242), add: + +```bash + cat > "$repo/.antigravity-plugin/plugin.json" <<EOF +{ + "name": "superpowers", + "version": "$MANIFEST_VERSION" +} +EOF + + printf '@../skills/using-superpowers/SKILL.md\n' > "$repo/rules/AGENTS.md" + printf 'antigravity png fixture\n' > "$repo/assets/antigravity-logo.png" +``` + +Add these three paths to that function's `git -C "$repo" add` list: + +```bash + .antigravity-plugin/plugin.json \ + rules/AGENTS.md \ + assets/antigravity-logo.png \ +``` + +After the existing assertion `assert_not_contains "$preview_section" ".kimi-plugin/plugin.json" ...` (~line 659), add: + +```bash + assert_not_contains "$preview_section" ".antigravity-plugin/plugin.json" "Preview excludes Antigravity manifest from Codex sync" + assert_not_contains "$preview_section" "rules/AGENTS.md" "Preview excludes Antigravity bootstrap rule from Codex sync" + assert_not_contains "$preview_section" "assets/antigravity-logo.png" "Preview excludes Antigravity logo from Codex sync" +``` + +- [ ] **Step 2: Run test to verify it fails** + +Run: `bash tests/codex-plugin-sync/test-sync-to-codex-plugin.sh` +Expected: the three new assertions FAIL (the files appear in the preview); the rest pass. + +- [ ] **Step 3: Add the exclusions** + +In `scripts/sync-to-codex-plugin.sh`, in `EXCLUDES=(`: + +After `"/.claude/"` (alphabetical among dotdirs), add: + +```bash + "/.antigravity-plugin/" +``` + +Under `# Directories not shipped by canonical Codex plugins`, add `"/rules/"` in alphabetical position (after `"/lib/"`): + +```bash + "/rules/" +``` + +Add a new group after the directories group: + +```bash + + # Other harnesses' assets + "/assets/antigravity-logo.png" +``` + +- [ ] **Step 4: Run test to verify it passes** + +Run: `bash tests/codex-plugin-sync/test-sync-to-codex-plugin.sh && scripts/lint-shell.sh scripts/sync-to-codex-plugin.sh tests/codex-plugin-sync/test-sync-to-codex-plugin.sh` +Expected: all assertions pass, including `assets/app-icon.png` and `assets/superpowers-small.svg` still included; linter clean. + +- [ ] **Step 5: Commit** + +```bash +git add scripts/sync-to-codex-plugin.sh tests/codex-plugin-sync/test-sync-to-codex-plugin.sh +git commit -m "fix(codex-sync): exclude Antigravity manifest, rule, and logo" +``` + +--- + +### Task 4: README and stale test comment + +**Files:** +- Modify: `README.md:84-93` (the `### Antigravity` section) +- Modify: `tests/antigravity/test-antigravity-tools.sh:1-10` (header comment) + +**Interfaces:** none. + +- [ ] **Step 1: Update the README section** + +Replace the body of `### Antigravity` (keep the heading) with: + +````markdown +Install Superpowers as a plugin from this repository: + +```bash +agy plugin install https://github.com/obra/superpowers +``` + +The plugin ships an always-on rule that loads the `using-superpowers` skill, so +Superpowers is active from the first message. Reinstall with the same command to +update. +```` + +- [ ] **Step 2: Fix the stale header comment** + +In `tests/antigravity/test-antigravity-tools.sh`, replace lines 2–7: + +```bash +# Validate the Antigravity (agy) integration. agy installs the existing plugin +# directly (`agy plugin install <repo-url>`): it loads the bundled skills and +# runs the SessionStart hook for bootstrap, so there is no agy-specific scaffold +# to test. What IS agy-specific is the tool mapping — subagent dispatch via +# invoke_subagent (self/research types) and task tracking via a task artifact — +# and SKILL.md pointing at it. +``` + +with: + +```bash +# Validate the Antigravity (agy) tool mapping: subagent dispatch via +# invoke_subagent (self/research types), task tracking via a task artifact, and +# SKILL.md pointing at the mapping. The plugin manifest and bootstrap rule are +# checked by test-plugin-manifest.sh. +``` + +- [ ] **Step 3: Run the Antigravity suite** + +Run: `bash tests/antigravity/run-tests.sh` +Expected: all three tests pass, ending `=== All Antigravity tests passed ===`. + +- [ ] **Step 4: Commit** + +```bash +git add README.md tests/antigravity/test-antigravity-tools.sh +git commit -m "docs(antigravity): describe the always-on rule bootstrap" +``` + +--- + +### Task 5: Live acceptance on agy + +No repo changes. This is the end-to-end proof required by AGENTS.md's "New Harness Support" section. + +**Files:** none (scratch only). + +**Interfaces:** +- Consumes: the committed tree from Tasks 1–4. + +- [ ] **Step 1: Stage the committed tree and install it** + +Use the scratchpad directory (`$SCRATCH` below), never the repo: + +```bash +mkdir -p "$SCRATCH/accept/superpowers" +git archive HEAD | tar -x -C "$SCRATCH/accept/superpowers" +agy plugin install "$SCRATCH/accept/superpowers" +agy plugin list +``` + +Expected: install `[ok]`, skills processed, hooks skipped; `agy plugin list` shows `"source": "antigravity"`. + +- [ ] **Step 2: Run the acceptance prompt three times in fresh workspaces** + +For `n` in 1 2 3: + +```bash +mkdir -p "$SCRATCH/accept/ws$n" +cd "$SCRATCH/accept/ws$n" +agy -p "Let's make a react todo list" --output-format stream-json --print-timeout 240s > out.jsonl 2> err.txt +``` + +For each run, list the tool steps: + +```bash +python3 -I -c " +import json +for l in open('out.jsonl'): + e=json.loads(l); s=e.get('step_update') or {} + if s.get('state') in ('DONE','ERROR'): + p=(s.get('tool_info') or {}).get('parameters') or {} + print(s.get('step_index'), s.get('tool_name'), str(p.get('AbsolutePath') or p.get('TargetFile') or p.get('CommandLine') or '')[-90:]) + if e.get('event')=='result': print('RESULT:', e['result'].get('response','')[:600]) +" +``` + +Pass criteria for each run: a `view_file` of `.../skills/using-superpowers/SKILL.md` and of `.../skills/brainstorming/SKILL.md` occur before any `write_to_file` outside the agy `brain/` directory, and no project files (`package.json`, `*.jsx`, `*.tsx`) exist in the workspace afterward. Record each run's tool sequence and the final response. + +Also confirm `grep -c 'failed to parse hooks' ~/.gemini/antigravity-cli/cli.log` did not increase across the runs. + +- [ ] **Step 3: Uninstall** + +```bash +agy plugin uninstall superpowers +agy plugin list +``` + +Expected: `No imported plugins.` + +- [ ] **Step 4: Report** + +If any run fails, stop and report to Jesse with the tool sequence; do not change the rule without his approval. If all pass, save the three transcripts' tool sequences for the PR description. + +--- + +### Task 6: Porting guide (separate commit) + +**Files:** +- Modify: `docs/porting-to-a-new-harness.md` (lines ~295, ~520-534, ~681, ~690-705, index table ~797-810) + +**Interfaces:** none. + +- [ ] **Step 1: Routing table row (~line 295)** + +Replace: + +```markdown +| has a plugin install command and a manifest `contextFileName` (or equivalent) the installer keeps | C via the plugin installer | Antigravity (`.antigravity-plugin/` — `agy plugin install` ships a generated context file; verify the installer preserves it — Part 6) | +``` + +with: + +```markdown +| loads always-on rule files shipped inside a plugin | C via a plugin rule | Antigravity (`.antigravity-plugin/plugin.json` + `rules/AGENTS.md`, a one-line `@` pointer to `using-superpowers` — Part 6) | +``` + +- [ ] **Step 2: "No `Skill` tool" case (~lines 527-532)** + +Replace the paragraph beginning `**For the bootstrap itself, prefer a declared context file (Part 6).**` with: + +```markdown + **For the bootstrap itself, prefer something the harness loads every + session (Part 6).** That's a declared context file where the manifest has a + `contextFileName`-style field, or an always-on rule where the plugin format + has rules. Antigravity uses a rule: `rules/AGENTS.md` holds one line, + `@../skills/using-superpowers/SKILL.md`. agy rewrites a rule-relative `@` + path to the absolute install path but does not inline the file; the model + reads it with `view_file`. agy does not substitute `${PLUGIN_ROOT}` in rules. + Point at `using-superpowers`; never copy it into the rule. +``` + +- [ ] **Step 3: Distribution table row (~line 681)** + +Replace: + +```markdown +| Local installer (plugin install) | Antigravity (`agy`) | A small `install.sh` that runs the harness's own `agy plugin install` against a staging dir holding the manifest, the skills, and a generated `contextFileName` context file (the bootstrap). Everything arrives through the install mechanism — *not* by editing the user's config (see below). | +``` + +with: + +```markdown +| Git-URL plugin install + marketplace | Antigravity (`agy`) | Users run `agy plugin install https://github.com/obra/superpowers`. agy reads `.antigravity-plugin/plugin.json`, whose Marketplace fields (`displayName`, `logo`, `suggestedPrompts`, `version`, `author`) also drive the Antigravity Marketplace listing. Without that manifest, agy falls back to importing `gemini-extension.json`. | +``` + +- [ ] **Step 4: Installer-stripping section (~lines 690-705)** + +In the bullet beginning `**Ship a context file the manifest declares.**`, delete the sentences from `This is what` through `unrecognized.` (the `.antigravity-plugin/install.sh` / `ANTIGRAVITY.md` example), and replace them with: + +```markdown + **Verify with a marker** that the installer keeps the file and the + harness loads it: a file the manifest doesn't declare can be stripped as + unrecognized. +``` + +Immediately after that bullet, add a new bullet: + +```markdown + - **Or ship an always-on rule, if the plugin format has rules.** Antigravity + loads `rules/AGENTS.md` from an installed plugin every session; a one-line + `@` pointer there bootstraps `using-superpowers`. Run a marker test to + confirm what the harness does with `@` paths in rules — agy rewrites them + to absolute paths without inlining them. +``` + +- [ ] **Step 5: Harness index row (~line 799)** + +The table is alphabetical. Add this as the first data row, directly above `| Claude Code | ...`: + +```markdown +| Antigravity (`agy`) | `.antigravity-plugin/plugin.json` + `rules/AGENTS.md` | always-on plugin rule `@`-points at `using-superpowers` (no session-start hook event exists) | `references/antigravity-tools.md` | `tests/antigravity/` | `agy plugin install` git URL; Antigravity Marketplace | +``` + +- [ ] **Step 6: Check nothing else references the phantom files** + +Run: `grep -rn 'install.sh\|ANTIGRAVITY.md\|contextFileName' docs/porting-to-a-new-harness.md` +Expected: no remaining line ties `install.sh` or `ANTIGRAVITY.md` to Antigravity. Remaining `contextFileName` mentions must be generic or about Gemini. + +- [ ] **Step 7: Commit (on its own)** + +```bash +git add docs/porting-to-a-new-harness.md +git commit -m "docs(porting): describe Antigravity's rule bootstrap, drop phantom installer" +``` diff --git a/docs/superpowers/specs/2026-10-05-brainstorming-rebuild-design.md b/docs/superpowers/specs/2026-10-05-brainstorming-rebuild-design.md new file mode 100644 index 0000000..527a298 --- /dev/null +++ b/docs/superpowers/specs/2026-10-05-brainstorming-rebuild-design.md @@ -0,0 +1,165 @@ +# Brainstorming rebuild: intent + +## Why this exists + +Coding agents are very good at building. They build what they believe the +human wants, and they rarely ask enough or look around enough before they +start. The brainstorming skill exists to close that gap: draw the human's +real intent out of them, including the parts they haven't worked out yet, +before anything gets built. + +The original superpowers prompt did this well in about forty words: "I've +got an idea in my head. I'd like you to ask me lots of questions about it. +As you think you understand what I really want, describe it to me in +chunks of about 200-300 words. Once we're dialed in, write out an informal +spec." The current skill has grown to about 2,600 words, almost all of it +about routing (spike / bounded / architectural), approval gates, and the +spec-to-plan handoff. Intent got squeezed into one paragraph whose default +move is "ask one focused question about purpose", which doesn't work on +people. + +This is a rewrite from scratch, not an edit. + +## Goals + +- The agent understands the *why* behind anything non-trivial, because an + agent that knows the why makes the hundred unstated decisions well. +- The human ends up thinking through what they actually want. Good + questions help them flesh out an idea they haven't finished forming. +- Works for any domain: software, a talk, a renovation, a small business. +- Ends with a document a talented builder in that domain could plan from + without going back to the human. + +## How a session should feel + +**Start with a private check.** The agent asks itself: what do I actually +know about what they want, and why? If the answer is "nearly everything" +("make the icon cornflower blue"), it confirms and moves on. If anything +non-trivial is missing, it starts asking. + +**Ask, one question at a time.** Plain language by default, pitched just a +little above the human's level. Questions should help the human think, not +quiz them. + +- Get them describing first. Open questions beat menus because menus + garden-path people toward the agent's assumptions. +- Offer a menu only when they're struggling. +- If they say "just guess" or "what do you think", always propose. +- Ground questions in real moments ("walk me through the last time...") + and concrete tradeoffs ("if it could only do one of these well..."). +- Ask about prior art and current state: what exists elsewhere, what + exists now. +- Ask which parts of the *how* they want to decide, and which they'd + rather hand to the builder. + +The ground to cover, loosely in order: what kind of thing this is, what +makes it special, goals, non-goals, anti-goals, the details they care +about, and what they want to delegate. These are territory, not a script. +The agent never reads them out as literal questions. + +**Offer recon.** Once there's some grounding, the agent offers to go look: +the codebase or project, the human's own files and data, or the web. The +human decides whether it goes. + +**Show, don't tell, once things get concrete.** Use the visual companion +for diagrams, mockups, and throwaway prototypes where seeing beats reading. + +**Spike to feel things out.** Agentic development is waterfall, but very, +very fast. A quick throwaway build is often the cheapest way to find out +what the human wants or whether something works, and the agent should +offer one when it would help. When the human just wants to spike, the +agent gets out of the way. Spikes have no tests or minimal ones, aren't +bulletproof, and don't go through the full plan, implementation, and +review process. What a spike teaches feeds back into the conversation. + +**Think wide internally.** Before proposing anything, the agent generates +several ideas and discards the weak ones. It shows the human the comparison +only when that helps them decide. + +**Play it back.** Once the agent thinks it understands, it describes its +understanding in chunks of roughly 200-300 words and adjusts after each. + +## What it produces + +A plain written document covering: + +- intent and the why +- goals, non-goals, anti-goals +- constraints +- the parts of the how the human cares about, as they decided them +- what's explicitly left to the builder + +**Done test:** before the human reviews it, a fresh subagent playing a +talented builder in the domain reads the document and lists what it would +still need to ask. Those questions go back to the human. The document is +done when the builder has nothing important left to ask. + +**Sizing the work.** Once intent is clear, the agent sorts the work into +one of three sizes, says which out loud, and lets the human override: + +- **A quick, clear task.** Intent was clear from the start. Confirm and do it. +- **A small change.** The full description lives in chat. No document file. +- **A project with a written design.** The full description is the + document above, followed by a full plan (for software, the writing-plans + skill). + +This is where the old spike / bounded / architectural choice lives now: +after intent, not before it, with plain names. + +**Approval.** Whatever the size, the human approves the full description +before anything gets built: in chat for a small change, by reading the +document for a project. + +**Opting out.** Early in the session, the agent mentions once that if the +human doesn't want to go through this process, they can just say so. + +## Non-goals + +- Designing architecture the human didn't ask to decide. The doc records + the how the human cares about; the rest belongs to the builder. +- Being software-specific. +- Ceremony for trivial requests. + +## Anti-goals + +- Interrogation: a checklist of questions read at the human. +- Garden-pathing: steering the human into the agent's preferred idea with + leading menus. +- "What are you actually trying to do?" style questions that ask the human + to do the agent's thinking. +- Small asks inflating into multi-phase projects. +- Building before the human agrees with the playback. + +## Decisions + +- The skill keeps the name `brainstorming`. Other skills and the README + point at it. +- The visual companion and its server scripts stay as they are. +- `spec-document-reviewer-prompt.md` is replaced by the builder-check prompt. +- The agent screens the builder check's questions before bringing them to + the human: it answers what it can from context and drops questions about + delegated details. Without a subagent tool, it runs the check itself. +- A short hard gate stays: nothing gets built until the human approves the + full description. One exception: a spike the human said yes to. It stays + labeled throwaway. Keeping what it produced is a new request and goes + through the gate. +- The builder check runs only on the written document. Small changes stay + in chat. +- The trigger description keeps the strong "use before any creative work" + wording. The opening check keeps trivial asks cheap. +- The todo-list example from the old skill goes. The evals that encode the + old routing (`brainstorming-todo-purpose-discovery`, + `brainstorming-todo-shared-intent`) get rewritten to match. +- Software projects keep `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` + as the default location for the document. + +## Left to the builder + +- Section structure and wording of the skill. +- Exact prompts for the builder check. +- Where non-software documents get saved, absent a human preference. + +## Will be tuned after first use + +Jesse expects to tune the skill after real sessions. Ship something small +and sharp rather than complete. diff --git a/docs/superpowers/specs/2026-10-06-antigravity-marketplace-design.md b/docs/superpowers/specs/2026-10-06-antigravity-marketplace-design.md new file mode 100644 index 0000000..aab6ad2 --- /dev/null +++ b/docs/superpowers/specs/2026-10-06-antigravity-marketplace-design.md @@ -0,0 +1,181 @@ +# Antigravity Marketplace plugin + +## Goal + +List Superpowers in the Google Antigravity plugin Marketplace, as part of a +partnership with Google. That requires a native Antigravity plugin manifest with +the Marketplace presentation fields, a logo, and a session bootstrap that works +on the native plugin path. + +Source: "Antigravity Plugin Marketplace Publishing Guide" (PDF from Google), plus +probes against `agy` 1.3.1 recorded below. + +## Current state (agy 1.3.1) + +- `agy plugin install https://github.com/obra/superpowers` succeeds, but only + through agy's Gemini-extension fallback: `agy plugin list` reports + `"source": "gemini-cli"`. The bootstrap rides `GEMINI.md`'s `@` lines, which + the model treats as hints and follows with `view_file`. The acceptance test + passes on this path. +- agy copies our Claude-format `hooks/hooks.json` to the install root as + `hooks.json` and fails to parse it on every session: + `invalid hook "hooks": command hook must specify 'command'`. +- `agy plugin validate .` on the repo fails: `missing plugin.json`. + +## Probe findings (agy 1.3.1) + +Each probe installed a throwaway plugin, ran `agy -p`, and uninstalled it. + +1. agy's hook events are `PreToolUse`, `PostToolUse`, `PreInvocation`, + `PostInvocation`, and `Stop`. There is no `SessionStart`. agy's embedded docs + use named top-level hooks (`{"<name>": {"PreToolUse": [...]}}`), which differs + from the PDF's `{"hooks": {...}}` example. +2. `rules/AGENTS.md` in a plugin loads as an always-on rule on every session. +3. In a rule, an `@` path relative to the rule file is rewritten to an absolute + install path (`@../skills/x/SKILL.md` becomes + `@/Users/<u>/.gemini/config/plugins/<plugin>/skills/x/SKILL.md`). Its content + is not inlined. `${PLUGIN_ROOT}` is not substituted in rules. A path that does + not resolve relative to the rule file is left as written. +4. With `.antigravity-plugin/plugin.json` present, agy installs the plugin as + `"source": "antigravity"`, finds all 15 skills, and skips hooks (no root + `hooks.json`), so the parse warning goes away. +5. A staged copy of the repo with the native manifest and a one-line + `rules/AGENTS.md` (`@../skills/using-superpowers/SKILL.md`) passed the + acceptance test: the model read `using-superpowers`, then + `antigravity-tools.md`, then `brainstorming`, and replied + "Using superpowers:brainstorming…" with a clarifying question. No code. +6. The repo-root `AGENTS.md` (contributor guidelines) is copied into the install + but is not loaded as a rule. Only `rules/AGENTS.md` is. + +## Design + +### 1. Native manifest: `.antigravity-plugin/plugin.json` + +The guide allows the manifest at `.antigravity-plugin/plugin.json`, which +matches our other harness dotdirs. Fields: + +| Field | Value | +|---|---| +| `name` | `superpowers` | +| `displayName` | `Superpowers` | +| `version` | current release version, maintained by `.version-bump.json` | +| `description` | `Make your coding agent a better engineer` (Jesse's copy; shorter than the guide's recommended 120–160, at most 160) | +| `logo` | `assets/antigravity-logo.png` | +| `suggestedPrompts` | `I've got an idea for something I'd like to build`, `Let's figure out why this broke` (Jesse's copy) | +| `category` | `Developer Tools` | +| `keywords` | lowercase, matching `.claude-plugin/plugin.json` keywords | +| `author` | `{ "name": "Jesse Vincent", "email": "jesse@fsck.com" }`, matching `.claude-plugin/plugin.json` | +| `homepage`, `repository` | `https://github.com/obra/superpowers` | +| `license` | `MIT` | + +No `skills` or `mcpServers` fields: the defaults (`skills/`, no MCP config) are +what we want, and probe 4 confirmed default discovery finds all skills. + + +### 2. Bootstrap: skill discovery, no extra files + +agy lists each installed skill's description, and `using-superpowers`' +"Use when starting any conversation" gets the model to load it. The plugin +ships no `rules/` and no `hooks.json`. + +This replaced a first design, a one-line `rules/AGENTS.md` pointer, after the +final review found that Cursor also loads any `rules/*.md` a plugin ships from +the same repo root. Alternatives probed on agy 1.3.1 and rejected: + +- A `PreInvocation` hook. It runs before every model call and `hooks.json` + must sit at the plugin root. An `ephemeralMessage` is dropped on the next + call; a `userMessage` persists, and gating it on `invocationNum == 0` and + `initialNumSteps == 1` injects exactly once per conversation, but agy still + starts the hook process on every call. +- No manifest field relocates `hooks.json` or `rules/`. + +Verified with no bootstrap file, 12/12 runs: "Let's make a react todo list" +(3) and "add a settings page" (3) load brainstorming before any code; "this +test is failing, can you fix it?" (3) loads systematic-debugging before any +edit; a react-todo second turn after an unrelated first turn (3) loads +brainstorming. Model: Gemini 3.8 Flash. The risk is that triggering depends on +the model honoring a skill description; the once-per-conversation hook is the +fallback if it slips. + +### 3. Logo: `assets/antigravity-logo.png` + +512×512 PNG, transparent background. A white rounded square (inset 31px, +corner radius 100) holds the `assets/superpowers-small.svg` mark in `#1a1a1a`, +scaled to about 70% of the square's width and centered. No border; on a light +theme it reads as a bare mark on white, which is acceptable. + +`scripts/render-antigravity-logo.sh` composes the SVG from +`superpowers-small.svg` and rasterizes it with `rsvg-convert`. It is the only way +the PNG gets regenerated; it has help text and fails clearly when +`rsvg-convert` is missing. + +### 4. Version bumps + +Add `{ "path": ".antigravity-plugin/plugin.json", "field": "version" }` to +`.version-bump.json`. + +### 5. Codex sync + +Add `/.antigravity-plugin/` and `/assets/antigravity-logo.png` to +`EXCLUDES` in `scripts/sync-to-codex-plugin.sh`, and cover them in +`tests/codex-plugin-sync/test-sync-to-codex-plugin.sh`. + +### 6. README + +The Antigravity install command stays +`agy plugin install https://github.com/obra/superpowers`. The prose changes from +"runs the plugin's session-start hook" to describing skill discovery. Add the +Marketplace route once it exists; until then, no claim about it. + +### 7. Tests: `tests/antigravity/` + +- `test-plugin-manifest.sh` (CI-safe, mirrors `tests/kimi/test-plugin-manifest.sh`): + - manifest parses; `name` matches the kebab-case pattern and equals + `superpowers`; + - every Marketplace-required field is present and non-empty: `name`, + `description`, `displayName`, `logo`, `suggestedPrompts` (1–3 non-empty + strings), `version`, `author`; + - `description` is at most 160 characters; + - `version` equals `.claude-plugin/plugin.json`'s version; + - `logo` file exists, is a PNG, and is square and at least 128×128; + - `.version-bump.json` lists the manifest; + - `using-superpowers`' description still says "Use when starting any + conversation", which the bootstrap relies on; + - no root `plugin.json`, `hooks.json`, or `rules/` exists. +- When `agy` is on `PATH`, also run `agy plugin validate` on the repo and + require `[ok]` with skills processed. +- Update the header comment of `test-antigravity-tools.sh`, which still says agy + runs the SessionStart hook. + +Live acceptance (not in CI): install the branch's tree into agy, run +"Let's make a react todo list" at least three times in clean workspaces, and +require that brainstorming triggers before any code each time. Uninstall +afterward. + +### 8. Porting guide: separate commit + +`docs/porting-to-a-new-harness.md` describes `.antigravity-plugin/install.sh` +and a generated `ANTIGRAVITY.md` that do not exist. Fix it in its own commit: + +- Routing table row: Antigravity uses the surfaced skill index. +- The "no `Skill` tool" section: replace the `contextFileName` advice for + Antigravity with the skill-index bootstrap, and record the hook and rule + findings (no session-start event, `PreInvocation` per call, no + `${PLUGIN_ROOT}` in hooks, shared plugin roots leak `rules/` into Cursor). +- The distribution table: Antigravity installs from a git URL (`agy plugin + install <url>`) and lists in its Marketplace. +- The installer-stripping section: drop the `install.sh` / `ANTIGRAVITY.md` + example. +- The harness index table has no Antigravity row; add one (manifest, + bootstrap, tool mapping, tests, install). + +## Out of scope + +- Marketplace submission mechanics. The guide does not describe how to submit; + that goes through Jesse's Google contact. +- Antigravity 2.0 and the IDE. Not installed here, so not verified. The README + makes no claims about them. +- Open PR #2350, which copies `using-superpowers` into a generated rule. Jesse + decides how to respond after this lands; I draft the reply. +- `.hermes-plugin/` and `.muse-plugin/` are missing from the Codex sync + excludes. Unrelated; noted for a separate fix. diff --git a/docs/windows/polyglot-hooks.md b/docs/windows/polyglot-hooks.md index d1bcb84..3da01ae 100644 --- a/docs/windows/polyglot-hooks.md +++ b/docs/windows/polyglot-hooks.md @@ -77,12 +77,19 @@ afterward. 1. The batch section validates the script name and resolves the hook directory from the dispatcher's own location. -2. It tries bash in three places: +2. It tries bash in four places, in order: - `C:\Program Files\Git\bin\bash.exe` - `C:\Program Files (x86)\Git\bin\bash.exe` - - `bash` on `PATH` (MSYS2, Cygwin, or a non-default Git install) + - `%LOCALAPPDATA%\Programs\Git\bin\bash.exe` (a per-user Git for Windows + install), only when `LOCALAPPDATA` is set + - `bash` on `PATH` (MSYS2, Cygwin, or a non-default Git install), found by + running `%SystemRoot%\System32\where.exe $PATH:bash`, so neither `where` + nor `bash` is taken from the current directory. The WSL launchers + (`bash.exe` in `System32`, `Sysnative`, or + `%LOCALAPPDATA%\Microsoft\WindowsApps`) and extensionless matches are + skipped, since the launchers fail when no Linux distro is installed. 3. If bash is found, it runs the named extensionless hook script from the hooks - directory. + directory and exits with the script's exit code. 4. If no bash is found, the dispatcher exits `0` silently — the plugin continues working, it just skips the hook. 5. `exit /b` stops CMD before it reaches the Unix section. @@ -142,7 +149,7 @@ escape_for_json() { ### "bash is not recognized" -CMD couldn't find bash in any of the three locations the dispatcher tries. The dispatcher exits silently (0) rather than erroring, so the hook is skipped. Install Git for Windows at the standard path or ensure `bash` is on `PATH`. +CMD couldn't find bash in any of the four locations the dispatcher tries. The dispatcher exits silently (0) rather than erroring, so the hook is skipped. Install Git for Windows (system-wide or per-user) or ensure a non-WSL `bash` is on `PATH`. ### Hook runs on Unix but does nothing on Windows diff --git a/gemini-extension.json b/gemini-extension.json index 915bfd2..878b94a 100644 --- a/gemini-extension.json +++ b/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "superpowers", "description": "Core skills library: TDD, debugging, collaboration patterns, and proven techniques", - "version": "6.4.2", + "version": "7.0.0", "contextFileName": "GEMINI.md" } diff --git a/hooks/run-hook.cmd b/hooks/run-hook.cmd index ceec3a7..a2f7c48 100755 --- a/hooks/run-hook.cmd +++ b/hooks/run-hook.cmd @@ -15,32 +15,48 @@ if "%~1"=="" ( exit /b 1 ) +setlocal set "HOOK_DIR=%~dp0" +set "BASH_EXE=" -REM Try Git for Windows bash in standard locations -if exist "C:\Program Files\Git\bin\bash.exe" ( - "C:\Program Files\Git\bin\bash.exe" "%HOOK_DIR%%~1" %2 %3 %4 %5 %6 %7 %8 %9 - exit /b %ERRORLEVEL% -) -if exist "C:\Program Files (x86)\Git\bin\bash.exe" ( - "C:\Program Files (x86)\Git\bin\bash.exe" "%HOOK_DIR%%~1" %2 %3 %4 %5 %6 %7 %8 %9 - exit /b %ERRORLEVEL% -) +REM Git for Windows in its standard system-wide locations +if exist "C:\Program Files\Git\bin\bash.exe" set "BASH_EXE=C:\Program Files\Git\bin\bash.exe" +if not defined BASH_EXE if exist "C:\Program Files (x86)\Git\bin\bash.exe" set "BASH_EXE=C:\Program Files (x86)\Git\bin\bash.exe" -REM Try bash on PATH (e.g. user-installed Git Bash, MSYS2, Cygwin) -where bash >nul 2>nul -if %ERRORLEVEL% equ 0 ( - bash "%HOOK_DIR%%~1" %2 %3 %4 %5 %6 %7 %8 %9 - exit /b %ERRORLEVEL% -) +REM Per-user Git for Windows install (no admin rights needed). The defined +REM check matters: with LOCALAPPDATA unset the path would collapse to +REM \Programs\Git\... on the current drive, where any user can create it. +if not defined BASH_EXE if defined LOCALAPPDATA if exist "%LOCALAPPDATA%\Programs\Git\bin\bash.exe" set "BASH_EXE=%LOCALAPPDATA%\Programs\Git\bin\bash.exe" + +REM bash on PATH (MSYS2, Cygwin, a non-default Git install). where.exe is +REM called by full path and with $PATH: so neither it nor bash can come from +REM the current directory. The filters use for-variable modifiers, which never +REM re-expand the path, and skip extensionless matches and the WSL launchers +REM (System32, Sysnative, the Store alias in WindowsApps), which fail when no +REM Linux distro is installed. +if not defined BASH_EXE if defined SystemRoot for /f "delims=" %%B in ('"%SystemRoot%\System32\where.exe" $PATH:bash 2^>nul') do if not defined BASH_EXE if not "%%~xB"=="" if /i not "%%~dpB"=="%SystemRoot%\System32\" if /i not "%%~dpB"=="%SystemRoot%\Sysnative\" if /i not "%%~dpB"=="%LOCALAPPDATA%\Microsoft\WindowsApps\" set "BASH_EXE=%%B" REM No bash found - exit silently rather than error REM (plugin still works, just without SessionStart context injection) -exit /b 0 +if not defined BASH_EXE exit /b 0 + +REM Run bash outside any parenthesized block: cmd expands %ERRORLEVEL% +REM inside a block when it parses the block, which would lose the hook's +REM exit code. +"%BASH_EXE%" "%HOOK_DIR%%~1" %2 %3 %4 %5 %6 %7 %8 %9 +exit /b %ERRORLEVEL% CMDBLOCK # Unix: run the named script directly -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +# Splits $0 on its last / or \ (cmd passes Windows paths) instead of calling +# dirname, and uses $BASH (bash's own absolute path, always set once bash is +# running) instead of a PATH lookup for bash, so this keeps working when +# Claude Code spawns the SessionStart hook with a broken/empty PATH +# (anthropics/claude-code#43127). +case "$0" in + */*|*\\*) SCRIPT_DIR="$(cd "${0%[/\\]*}" && pwd)" ;; + *) SCRIPT_DIR="$(pwd)" ;; +esac SCRIPT_NAME="$1" shift -exec bash "${SCRIPT_DIR}/${SCRIPT_NAME}" "$@" +exec "${BASH:-bash}" "${SCRIPT_DIR}/${SCRIPT_NAME}" "$@" diff --git a/hooks/session-start b/hooks/session-start index 083cb23..63f82a6 100755 --- a/hooks/session-start +++ b/hooks/session-start @@ -3,12 +3,26 @@ set -euo pipefail -# Determine plugin root directory -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +# Determine plugin root directory. +# Splits $0 on its last / or \ (run-hook.cmd's cmd half passes a Windows +# path), with no separator meaning the current directory. This avoids +# dirname because a SessionStart:startup hook can run with a broken/empty +# PATH (anthropics/claude-code#43127) before any PATH-repairing sibling hook +# in the same startup batch takes effect. +case "$0" in + */*|*\\*) SCRIPT_DIR="$(cd "${0%[/\\]*}" && pwd)" ;; + *) SCRIPT_DIR="$(pwd)" ;; +esac PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" -# Read using-superpowers content -using_superpowers_content=$(cat "${PLUGIN_ROOT}/skills/using-superpowers/SKILL.md" 2>&1 || echo "Error reading using-superpowers skill") +# Read using-superpowers content via bash's builtin $(< file) instead of +# cat, for the same PATH-independence reason. +skill_md="${PLUGIN_ROOT}/skills/using-superpowers/SKILL.md" +if [ -r "$skill_md" ]; then + using_superpowers_content="$(<"$skill_md")" +else + using_superpowers_content="Error reading using-superpowers skill" +fi # Escape string for JSON embedding using bash parameter substitution. # Each ${s//old/new} is a single C-level pass - orders of magnitude @@ -36,18 +50,36 @@ session_context="<EXTREMELY_IMPORTANT>\nYou have superpowers.\n\n**Below is the # # Uses printf instead of heredoc to work around bash 5.3+ heredoc hang. # See: https://github.com/obra/superpowers/issues/571 +# +# emit_json pipes printf through `cat` when cat is on PATH, to absorb EPIPE +# on Windows. On Windows + Git Bash, the harness can close the hook's stdout +# before printf finishes, and Git Bash's printf reports that EPIPE as +# "printf: write error: Permission denied", which `set -euo pipefail` lets +# escape as a startup diagnostic every session. Letting cat receive the EPIPE +# keeps it out of the hook's error path (#1612). When PATH is broken and cat +# can't be found (#2310), it falls back to printf alone so context still +# gets injected. +emit_json() { + # shellcheck disable=SC2059 # every caller passes a literal format string + if command -v cat >/dev/null 2>&1; then + printf "$@" | cat + else + printf "$@" + fi +} + if [ -n "${CURSOR_PLUGIN_ROOT:-}" ]; then # Cursor sets CURSOR_PLUGIN_ROOT (may also set CLAUDE_PLUGIN_ROOT) - printf '{\n "additional_context": "%s"\n}\n' "$session_context" | cat + emit_json '{\n "additional_context": "%s"\n}\n' "$session_context" elif [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -z "${COPILOT_CLI:-}" ] && [ -z "${MUSE_PLUGIN_ROOT:-}" ]; then # Claude Code sets CLAUDE_PLUGIN_ROOT without COPILOT_CLI/MUSE_PLUGIN_ROOT - printf '{\n "hookSpecificOutput": {\n "hookEventName": "SessionStart",\n "additionalContext": "%s"\n }\n}\n' "$session_context" | cat + emit_json '{\n "hookSpecificOutput": {\n "hookEventName": "SessionStart",\n "additionalContext": "%s"\n }\n}\n' "$session_context" elif [ -n "${MUSE_PLUGIN_ROOT:-}" ]; then # Muse sets MUSE_PLUGIN_ROOT — try Claude-style nested output for Muse Spark - printf '{\n "hookSpecificOutput": {\n "hookEventName": "SessionStart",\n "additionalContext": "%s"\n }\n}\n' "$session_context" | cat + emit_json '{\n "hookSpecificOutput": {\n "hookEventName": "SessionStart",\n "additionalContext": "%s"\n }\n}\n' "$session_context" else # Copilot CLI (sets COPILOT_CLI=1) or unknown platform — SDK standard format - printf '{\n "additionalContext": "%s"\n}\n' "$session_context" | cat + emit_json '{\n "additionalContext": "%s"\n}\n' "$session_context" fi exit 0 diff --git a/package.json b/package.json index d9339ad..1dc53c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "superpowers", - "version": "6.4.2", + "version": "7.0.0", "description": "Superpowers skills and runtime bootstrap for coding agents", "type": "module", "main": ".opencode/plugins/superpowers.js", diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh index 14ead00..2f3acee 100755 --- a/scripts/bump-version.sh +++ b/scripts/bump-version.sh @@ -188,7 +188,9 @@ cmd_audit() { declared_paths+=("$path") done < <(declared_files) - # Grep for the version string + # Grep for the version string, but not inside a longer number such as an + # IP address; a "v" prefix or surrounding quotes still match. + local version_pattern="(^|[^0-9.])${current_version//./\\.}([^0-9]|$)" local found_undeclared=0 while IFS= read -r match; do local match_file @@ -212,7 +214,7 @@ cmd_audit() { fi echo " $match" fi - done < <(grep -rn "${exclude_args[@]}" -F "$current_version" "$REPO_ROOT" 2>/dev/null || true) + done < <(grep -rnE "${exclude_args[@]}" "$version_pattern" "$REPO_ROOT" 2>/dev/null || true) if [[ "$found_undeclared" -eq 0 ]]; then echo "No undeclared files contain the version string. All clear." diff --git a/scripts/render-antigravity-logo.sh b/scripts/render-antigravity-logo.sh new file mode 100755 index 0000000..82a5bd8 --- /dev/null +++ b/scripts/render-antigravity-logo.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +# +# Render the Antigravity Marketplace logo from assets/superpowers-small.svg. +# +# Usage: +# scripts/render-antigravity-logo.sh [--output PATH] +# +# Draws the Superpowers mark in near-black on a white rounded square with +# transparent corners, 512x512 PNG. Run it whenever superpowers-small.svg +# changes; tests/antigravity/test-logo.sh fails if the committed PNG is stale. +# Requires rsvg-convert (Homebrew: librsvg). +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +SOURCE_SVG="$REPO_ROOT/assets/superpowers-small.svg" +OUTPUT="$REPO_ROOT/assets/antigravity-logo.png" + +usage() { + sed -n '2,11p' "$0" | sed 's/^# \{0,1\}//' +} + +die() { + echo "error: $*" >&2 + exit 1 +} + +while [[ $# -gt 0 ]]; do + case "$1" in + --output) + [[ $# -ge 2 ]] || die "--output needs a path" + OUTPUT="$2" + shift 2 + ;; + -h | --help) + usage + exit 0 + ;; + *) + usage >&2 + die "unknown argument: $1" + ;; + esac +done + +command -v rsvg-convert >/dev/null 2>&1 \ + || die "rsvg-convert is not on PATH (install librsvg, e.g. 'brew install librsvg')" +[[ -r "$SOURCE_SVG" ]] || die "source mark not readable: $SOURCE_SVG" + +# Everything inside the source <svg> element: the mark's paths and ellipse. +mark="$(sed -E 's/^.*<svg[^>]*>//; s#</svg>.*$##' "$SOURCE_SVG")" +[[ -n "$mark" ]] || die "could not extract the mark from $SOURCE_SVG" + +# The mark's bounding box is centered at (256,256) in its 512 viewBox and is +# 348 units wide; scale 0.905 makes it ~70% of the 450-unit rounded square. +composed="$(mktemp)" +trap 'rm -f "$composed"' EXIT +cat >"$composed" <<EOF +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512"> + <rect x="31" y="31" width="450" height="450" rx="100" ry="100" fill="#ffffff"/> + <g fill="#1a1a1a" transform="translate(256 256) scale(0.905) translate(-256 -256)">$mark</g> +</svg> +EOF + +rsvg-convert -w 512 -h 512 "$composed" -o "$OUTPUT" +echo "wrote $OUTPUT" diff --git a/scripts/sync-to-codex-plugin.sh b/scripts/sync-to-codex-plugin.sh index 8ff283a..fc80ab2 100755 --- a/scripts/sync-to-codex-plugin.sh +++ b/scripts/sync-to-codex-plugin.sh @@ -44,6 +44,7 @@ DEST_REL="plugins/superpowers" # (.DS_Store is intentionally unanchored — Finder creates them everywhere.) EXCLUDES=( # Dotfiles and infra — top-level only + "/.antigravity-plugin/" "/.claude/" "/.claude-plugin/" "/.codex/" @@ -80,6 +81,9 @@ EXCLUDES=( "/scripts/" "/tests/" "/tmp/" + + # Other harnesses' assets + "/assets/antigravity-logo.png" ) # ============================================================================= diff --git a/skills/brainstorming/SKILL.md b/skills/brainstorming/SKILL.md index e3f1788..22b98fc 100644 --- a/skills/brainstorming/SKILL.md +++ b/skills/brainstorming/SKILL.md @@ -1,285 +1,225 @@ --- name: brainstorming -description: "You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation." +description: "You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation)." --- -# Brainstorming Ideas Into Designs +# Brainstorming + +You are very good at building. You build what you believe your human +partner wants, and that belief is usually thinner than it feels. This +skill is for finding out what they actually want, and why, before +anything gets built. + +People often haven't finished working out what they want. Good questions +help them think it through. When you understand the why, you make the +hundred decisions they never mention the way they would have made them. + +## First: What Do You Actually Know? + +Before you reply, ask yourself: what do I know about what they want, and +why? + +- **Everything that matters is in the request** ("make the icon cornflower + blue"). This is a quick, clear task. Do it, and say what you did. +- **Something non-trivial is missing.** Start the conversation. + +## Your First Message + +Your first message is two things, in this order: + +1. One line letting them know that if they'd rather skip the questions and + have you just start, they can say so. If they take you up on it, this + skill is done: state any significant how-it-gets-made choice + (platform, language, medium) in one plain line, then do what they + asked through the normal workflow. +2. One open question that gets them describing. Ask about a real moment + or a concrete picture: "What's the moment you find yourself wishing + this existed?" or "Tell me about the people who'll be in the room." + +That's the whole message. + +## The Conversation + +Each message ends with one question: a single sentence with no list of +example answers hanging off it. Use plain language, pitched just a little +above where your human partner is. Match their vocabulary; never use +process jargon. -Help turn ideas into fully formed designs and specs through natural collaborative dialogue. +Be clear and concise. Lead with what matters. Avoid jargon. When you +report what you found, give them the most important findings and offer +the rest. -Start by classifying how much process the request needs, then work -through your path: understand the context, refine the idea, present a -design, and get your human partner's approval. - -## Establish Shared Understanding - -The outcome of brainstorming is an understanding your human partner can -recognize and correct, grounded in what they want to accomplish. - -1. **Discover intent.** Use the request and available context to identify - the intended outcome, who it is for, and what success looks like. When - that information is missing, ask one focused question about purpose or - intended use before proposing features or an approach. Knowing the app - genre does not tell you why your partner wants it. Gathering missing - requirements does not ask them to authorize the task again. -2. **Write back your understanding.** Summarize the intended outcome, - relevant constraints, and success criteria in a short note your partner - can assess. Separate what they said from assumptions. Invite correction - and incorporate their answer before treating this as the design brief. -3. **Carry intent into the design.** Preserve the agreed understanding in - the selected path's design artifact: the written spec for architectural - work, or the in-chat design/probe for bounded work and spikes. Check - proposed features and technical choices against that understanding. - -When the request already supplies the purpose and constraints, reflect -that understanding instead of asking the same questions again. Keep the -note concise; its accuracy and the opportunity to correct it matter. +**Get them describing.** Open questions come first. Their own words carry +intent that your options can't. Offer a short menu only when they're +stuck. When they say "just guess" or "what do you think?", propose +something concrete. + +**How it gets made.** Every project rests on choices about medium, tools, +materials, and resources: the platform, programming language, and +libraries for an app; the medium for a piece of art. Find out early which +of those choices they want to make, which they're handing to you, and what +they already have to work with. Someone with strong views or skills will +want to talk it through. Someone counting on you needs sensible defaults, +said in plain words. When there's existing work, build on what it already +uses. Any choice you make goes in the design as your call, never as +something they agreed to. + +**Ground to cover.** This is territory, not a script. Never read these +out as questions: + +- what kind of thing this is, and what makes it special +- why now, and what success looks like to them +- goals, non-goals, and anti-goals (what would make this a failure even + if it technically works) +- prior art: what they've seen elsewhere, loved or hated +- current state: what exists now, what they've tried +- the details they care about + +**Questions that work** anchor in specifics: "Walk me through the last +time...", "If it could only do one of these well, which?", "What would +make you wince if I got it wrong?" A guess they can correct ("I'm +guessing this is because X keeps biting you?") often beats a question. + +**Offer recon.** Once you have a bit of grounding and looking would help, +offer to go look: their codebase or project, their own files and data, +or the web. Say what you'd look for. They decide whether you go. + +**Think wide privately.** Before you propose anything, come up with +several ideas and drop the weak ones, including any that fight what +they've told you about why. Show the comparison only when it helps them +decide. + +**Show, don't tell.** Offer the visual companion (below) whenever seeing +would help more than reading: + +- something they'll look at: a screen, a page, a printout, a sign +- a layout or arrangement: of a screen, a room, a schedule +- a flow or a sequence of steps +- options that would look different from each other +- a structure that's easier to see than read: a diagram, a timeline, a map + +Once they've accepted, use it for mockups to react to, side-by-side +options, and throwaway prototypes they can click. + +**Spike to feel things out.** Agentic work is waterfall, but very, very +fast. A quick throwaway build is often the cheapest way to learn what +they want or whether something works. Offer one when it would help. +When they just want to spike, get out of the way. Spikes get no tests +or minimal ones, aren't bulletproof, and skip the plan, implementation, +and review process. Bring what the spike taught you back into the +conversation. + +## Play It Back + +Play back as you go. As soon as you understand one part well enough to +describe it (what it's for and who it serves, say, or how one piece +behaves), describe that part back in about 200-300 words, then return to +questions about the next part. Playback and questions alternate through +the whole conversation; the last chunk covers whatever is left. + +Mark anything you're guessing as your guess; only what they said goes in +as theirs. End each chunk by asking what's wrong or missing. + +Before you send a chunk, check it: does it describe something they'll +look at, like a page, a screen, a schedule, or a printout? If so, and +they haven't seen the visual companion offer yet, send the offer instead +(its own message, below) and hold the chunk for the next message. Once +they've accepted, put a mockup next to the description. + +## Size the Work + +Once you understand what they want, pick a size and say it in plain +words. They can override it. + +| Size | The full description | Then | +|------|----------------------|------| +| A quick, clear task | the request itself | do it | +| A small change | in chat | build it through the normal workflow | +| A project with a written design | a written design document | a full plan (for software: superpowers:writing-plans) | + +If it grows mid-task, stop, say so, and step up a size. + +If this is really several independent projects, say so, agree on an +order, and brainstorm them one at a time. + +## The Written Design + +For a project, write a plain document a talented builder in the domain +could plan from without going back to your human partner. Cover: + +- intent and the why +- goals, non-goals, anti-goals +- constraints +- the parts of the how they decided, as they decided them +- what's left to the builder + +**Where it goes:** in a software repo, +`docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`, committed. +Otherwise, ask. Your human partner's preferences override both. + +**Builder check:** dispatch a fresh subagent with +`builder-check-prompt.md` in this directory. When you tell your human +partner you're writing it up, say a reviewer will read it first and you +may come back once with a few questions. Don't hand over the document +until the check is back. Sort what the builder asks into three piles: + +- **Answered already** by the conversation or the project: put the answer + in the document. +- **Minor:** a sensible builder could settle it without changing what gets + built. Settle it yourself and mark it in the document as your call. +- **Theirs:** only your human partner can answer it, and the answer changes + what gets built. + +Bring the "theirs" pile in one message, most important first. Update the +document with their answers, then hand it over with a short list of the +calls you made so they can check those while reading. That's the only +round of questions the check produces. Without a subagent tool, read the +document as that builder yourself. <HARD-GATE> -Before taking any implementation action, including invoking an -implementation skill, writing product code, scaffolding, installing -product dependencies, or creating an external project, complete the -selected path's prerequisites: - -- Spike: the human partner approves the question and probe. -- Bounded: the human partner approves the short in-chat design. -- Architectural: the human partner reviews and approves the written spec, - then reviews the written implementation plan and selects its execution - method. Conversational design approval only permits writing the spec; - written-spec approval only permits invoking writing-plans. - -A reply approves the stage actually presented. Approval of an idea or -feature scope does not approve artifacts that do not exist yet. Resume -at the earliest incomplete stage; do not turn one approval into permission -to skip the rest of the selected path. Read-only project exploration is -allowed while those prerequisites remain incomplete. +Nothing gets built until your human partner approves the full +description: in chat for a small change, the document for a project. +Building includes writing product code, scaffolding, installing +dependencies, creating projects, and invoking an implementation skill. +Reading and exploring are fine. + +Two exceptions. If they opted out of the questions, the skill is done +and the gate goes with it. A spike they said yes to may be built; it +stays labeled throwaway, and keeping what it produced is a new request +that comes back through this gate. + +After a project's document is approved, the next step is the plan. For +software, invoke superpowers:writing-plans and no other skill. </HARD-GATE> -## Three Paths - -Before your first question, classify the request and say the -classification out loud — "this looks bounded, so I'll present a short -design here rather than write a spec" — so your human partner can -override it: - -- **Spike** — a feasibility question ("can we...", "is it possible...", - "quick and dirty is fine") whose output is an answer, not code you - keep. Present the question and what you'll try in 2-3 sentences, get - a nod, then find out as cheaply as correctness allows. No design - doc, no spec file. Report findings as a recommendation; anything you - built stays labeled throwaway. -- **Bounded** — a well-scoped change to code that already exists in - this repo: a new flag, a small endpoint, a one-file fix. - Understanding the kind of app is not enough — bounded means the flow - you are changing is already here to read. If there is no existing - flow to change, the task is not bounded. Ask the clarifying - questions that matter, present a short design IN CHAT (a few - sentences to a few short paragraphs), and STOP. Implementation - starts only after your human partner says yes to that design — a - bounded task's approval is as hard a gate as an architectural - one. No spec file, no implementation plan document. -- **Architectural** — new projects, new subsystems, changes that - restructure how components fit together or alter interfaces others - depend on. Follow the full process: questions, approaches, sectioned - design, written spec, then the writing-plans skill. - -When in doubt between two paths, take the heavier one. The ratchet is -one-way: hidden complexity discovered mid-task upgrades the path — -stop, say so, and step up. Nothing downgrades mid-task. - -## Anti-Pattern: "Too Simple To Need Approval" - -Every path ends with your human partner approving the required design -before implementation. A bounded change may need only two sentences in -chat. A new todo-list project is architectural and requires the written -spec and planning handoffs. Scale the artifact to the selected path; -complete that path's reviews before implementation. - ## Red Flags | Thought | Reality | |---------|---------| -| "This is too simple to need a design" | Follow the selected path: a bounded change gets a short chat design; an architectural change gets the written spec and planning handoffs. | -| "I'll call it bounded and skip the spec" | Reaching for a label to skip work IS the doubt — take the heavier path. | -| "It's bounded and the design is obvious — I'll start while they read it" | The gate is the approval, not the design's length. Present, then stop until you hear yes. | -| "I understand this kind of app, so it's bounded" | Bounded measures the repo, not your familiarity. A new project has no existing flow — it is architectural. | -| "The spike works, so I'll keep the code" | A spike's output is an answer. Keeping the code is a new request — classify it. | -| "It grew, but I'm almost done — no need to re-classify" | Hidden complexity upgrades the path mid-task. Stop and say so. | -| "They approved the spike, so the follow-up change is approved too" | Each task gets its own classification and its own approval. | - -## Checklist - -Classify first, announce the path, then create a task for each item on -your path and complete them in order. - -**Spike:** -1. **Explore project context** — enough to frame the probe -2. **Present question + probe plan** — 2-3 sentences -3. **Get approval** — a nod is enough -4. **Investigate** — as cheaply as correctness allows -5. **Report findings** — a recommendation; label anything built as throwaway - -**Bounded:** -1. **Explore project context** — check files, docs, recent commits -2. **Ask clarifying questions** — one at a time, the ones that matter -3. **Present short design in chat** — approach, files touched, testing -4. **Get approval** — STOP and wait for an explicit yes; presenting the design and starting in the same breath is skipping the gate -5. **Implement** — proceed with the normal development workflow (TDD applies); no plan document - -**Architectural:** -1. **Explore project context** — check files, docs, recent commits -2. **Offer the visual companion just-in-time** — NOT upfront. The first time a question would genuinely be clearer shown than described, offer it then (its own message); on approval its browser tab opens for you. If no visual question ever arises, never offer it. See the Visual Companion section below. -3. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria -4. **Propose 2-3 approaches** — with trade-offs and your recommendation -5. **Present design** — in sections scaled to their complexity, get user approval after each section -6. **Write design doc** — save to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` and commit -7. **Spec self-review** — quick inline check for placeholders, contradictions, ambiguity, scope (see below) -8. **User reviews written spec** — ask user to review the spec file before proceeding -9. **Transition to implementation** — invoke writing-plans skill to create implementation plan - -## Process Flow - -```dot -digraph brainstorming { - "Classify: spike / bounded / architectural" [shape=diamond]; - "Present question + probe (2-3 sentences)" [shape=box]; - "Ask clarifying questions (bounded)" [shape=box]; - "Present short design in chat" [shape=box]; - "Human approves?" [shape=diamond]; - "Investigate; report recommendation" [shape=doublecircle]; - "Implement via normal workflow (no plan doc)" [shape=doublecircle]; - "Explore project context" [shape=box]; - "Ask clarifying questions" [shape=box]; - "Propose 2-3 approaches" [shape=box]; - "Present design sections" [shape=box]; - "User approves design?" [shape=diamond]; - "Write design doc" [shape=box]; - "Spec self-review\n(fix inline)" [shape=box]; - "User reviews spec?" [shape=diamond]; - "Invoke writing-plans skill" [shape=doublecircle]; - "Hidden complexity? Upgrade path" [shape=box]; - - "Classify: spike / bounded / architectural" -> "Present question + probe (2-3 sentences)" [label="spike"]; - "Classify: spike / bounded / architectural" -> "Ask clarifying questions (bounded)" [label="bounded"]; - "Classify: spike / bounded / architectural" -> "Explore project context" [label="architectural"]; - "Present question + probe (2-3 sentences)" -> "Human approves?"; - "Ask clarifying questions (bounded)" -> "Present short design in chat"; - "Present short design in chat" -> "Human approves?"; - "Human approves?" -> "Investigate; report recommendation" [label="spike: yes"]; - "Human approves?" -> "Implement via normal workflow (no plan doc)" [label="bounded: yes"]; - "Hidden complexity? Upgrade path" -> "Classify: spike / bounded / architectural"; - "Explore project context" -> "Ask clarifying questions"; - "Ask clarifying questions" -> "Propose 2-3 approaches"; - "Propose 2-3 approaches" -> "Present design sections"; - "Present design sections" -> "User approves design?"; - "User approves design?" -> "Present design sections" [label="no, revise"]; - "User approves design?" -> "Write design doc" [label="yes"]; - "Write design doc" -> "Spec self-review\n(fix inline)"; - "Spec self-review\n(fix inline)" -> "User reviews spec?"; - "User reviews spec?" -> "Write design doc" [label="changes requested"]; - "User reviews spec?" -> "Invoke writing-plans skill" [label="approved"]; -} -``` - -**Terminal states are path-bound.** Architectural: the ONLY skill you -invoke after brainstorming is writing-plans — never frontend-design, -mcp-builder, or any other implementation skill. Bounded: after -approval, implementation proceeds directly through the normal -development workflow; no plan document. Spike: the terminal state is a -reported recommendation. - -## The Process - -The subsections below serve the bounded and architectural paths (a -spike stops at "present the probe, get a nod"). Sections from -**Exploring approaches** onward are architectural-path depth — for -bounded work, context plus a few questions plus a short in-chat design -is the whole process. - -**Understanding the idea:** - -- Check out the current project state first (files, docs, recent commits) -- Before asking detailed questions, assess scope: if the request describes multiple independent subsystems (e.g., "build a platform with chat, file storage, billing, and analytics"), flag this immediately. Don't spend questions refining details of a project that needs to be decomposed first. -- If the project is too large for a single spec, help the user decompose into sub-projects: what are the independent pieces, how do they relate, what order should they be built? Then brainstorm the first sub-project through the normal design flow. Each sub-project gets its own spec → plan → implementation cycle. -- For appropriately-scoped projects, ask questions one at a time to refine the idea -- Prefer multiple choice questions when possible, but open-ended is fine too -- Only one question per message - if a topic needs more exploration, break it into multiple questions -- Focus on understanding: purpose, constraints, success criteria - -**Exploring approaches:** - -- Propose 2-3 different approaches with trade-offs -- Present options conversationally with your recommendation and reasoning -- Lead with your recommended option and explain why -- YAGNI ruthlessly - remove unnecessary features from every approach and design - -**Presenting the design:** - -- Once you believe you understand what you're building, present the design -- Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced -- Ask after each section whether it looks right so far -- Cover: architecture, components, data flow, error handling, testing -- Be ready to go back and clarify if something doesn't make sense - -**Design for isolation and clarity:** - -- Break the system into smaller units that each have one clear purpose, communicate through well-defined interfaces, and can be understood and tested independently -- For each unit, you should be able to answer: what does it do, how do you use it, and what does it depend on? -- Can someone understand what a unit does without reading its internals? Can you change the internals without breaking consumers? If not, the boundaries need work. -- Smaller, well-bounded units are also easier for you to work with - you reason better about code you can hold in context at once, and your edits are more reliable when files are focused. When a file grows large, that's often a signal that it's doing too much. - -**Working in existing codebases:** - -- Explore the current structure before proposing changes. Follow existing patterns. -- Where existing code has problems that affect the work (e.g., a file that's grown too large, unclear boundaries, tangled responsibilities), include targeted improvements as part of the design - the way a good developer improves code they're working in. -- Don't propose unrelated refactoring. Stay focused on what serves the current goal. - -## After the Design (architectural path) - -**Documentation:** - -- Write the validated design (spec) to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` - - (User preferences for spec location override this default) -- Use elements-of-style:writing-clearly-and-concisely skill if available -- Commit the design document to git - -**Spec Self-Review:** -After writing the spec document, look at it with fresh eyes: - -1. **Placeholder scan:** Any "TBD", "TODO", incomplete sections, or vague requirements? Fix them. -2. **Internal consistency:** Do any sections contradict each other? Does the architecture match the feature descriptions? -3. **Scope check:** Is this focused enough for a single implementation plan, or does it need decomposition? -4. **Ambiguity check:** Could any requirement be interpreted two different ways? If so, pick one and make it explicit. - -Fix any issues inline. No need to re-review — just fix and move on. - -**User Review Gate:** -After the spec review loop passes, ask the user to review the written spec before proceeding: - -> "Spec written and committed to `<path>`. Please review it and let me know if you want to make any changes before we start writing out the implementation plan." - -Wait for the user's response. If they request changes, make them and re-run the spec review loop. Only proceed once the user approves. - -**Implementation:** - -- Invoke the writing-plans skill to create a detailed implementation plan -- Do NOT invoke any other skill. writing-plans is the next step. +| "I'll offer options to save them effort" | Options steer. Ask them to describe it first. | +| "I'll fill in sensible defaults" | Good. Say them out loud. A default they never heard is one they couldn't reject. | +| "I should explain the process first" | Ask your question. The process shows itself. | +| "They said 'sounds good' to the idea" | Approval covers what you showed them. A description you haven't written isn't approved. | +| "The spike works, I'll keep building on it" | Keeping it is a new request. Back through the gate. | ## Visual Companion -A browser-based companion for showing mockups, diagrams, and visual options during brainstorming. Available as a tool — not a mode. Accepting the companion means it's available for questions that benefit from visual treatment; it does NOT mean every question goes through the browser. - -**Offering the companion (just-in-time):** Do NOT offer it upfront. Wait until a question would genuinely be clearer shown than told — a real mockup / layout / diagram question, not merely a UI *topic*. The first time that happens, offer it then, as its own message: -> "This next part might be easier if I show you — I can put together mockups, diagrams, and comparisons in a browser tab as we go. It's still new and can be token-intensive. Want me to? I'll open it for you." +A browser tab for showing mockups, diagrams, and prototypes. It's a +tool, not a mode: accepting it doesn't send every question to the +browser. -**This offer MUST be its own message.** Only the offer — no clarifying question, summary, or other content. Wait for the user's response. If they accept, start the server with `--open` so their browser opens to the first screen automatically. If they decline, continue text-only and don't offer again unless they raise it. +**Offer it just-in-time.** Offer it the first time one of the moments +above comes up, never upfront. The offer is its own message with nothing +else in it: -**Per-question decision:** Even after the user accepts, decide FOR EACH QUESTION whether to use the browser or the terminal. The test: **would the user understand this better by seeing it than reading it?** +> "This might be easier if I show you. Want me to open a browser tab with some mockups?" -- **Use the browser** for content that IS visual — mockups, wireframes, layout comparisons, architecture diagrams, side-by-side visual designs -- **Use the terminal** for content that is text — requirements questions, conceptual choices, tradeoff lists, A/B/C/D text options, scope decisions +If they decline, stay in text and don't offer again unless they raise it. -A question about a UI topic is not automatically a visual question. "What does personality mean in this context?" is a conceptual question — use the terminal. "Which wizard layout works better?" is a visual question — use the browser. +**Per question, ask: would they understand this better by seeing it?** +Mockups, layouts, diagrams, and side-by-side designs go in the browser. +Requirements, scope, tradeoffs, and conceptual choices stay in text. A +question about a UI topic isn't automatically a visual question. -If they agree to the companion, read the detailed guide before proceeding: -`skills/brainstorming/visual-companion.md` +If they accept, read `visual-companion.md` in this directory before +starting the server. diff --git a/skills/brainstorming/builder-check-prompt.md b/skills/brainstorming/builder-check-prompt.md new file mode 100644 index 0000000..136e9c1 --- /dev/null +++ b/skills/brainstorming/builder-check-prompt.md @@ -0,0 +1,23 @@ +# Builder Check Prompt + +Dispatch a fresh general-purpose subagent with this prompt once the +written design exists. Fill in the domain and the document path. + +``` +You are a talented [DOMAIN, e.g. "software engineer", "event planner", +"bakery consultant"]. You've been handed a design document and asked to +put together a plan to build what it describes. You will not be able to +talk to the person who wrote it. + +Read [DOCUMENT_PATH]. + +Report only the questions you'd still need answered before you could plan +this well: places where you'd have to guess and a wrong guess would +matter. For each, give the question and why the answer changes the plan. +Rank them by importance. + +Skip anything the document explicitly leaves to the builder, and anything +you could reasonably decide yourself. Skip nitpicks about wording. + +If nothing important is left, say "nothing important left". +``` diff --git a/skills/brainstorming/scripts/server.cjs b/skills/brainstorming/scripts/server.cjs index a828b35..fdc7961 100644 --- a/skills/brainstorming/scripts/server.cjs +++ b/skills/brainstorming/scripts/server.cjs @@ -261,7 +261,7 @@ function isFullDocument(html) { } function wrapInFrame(content) { - return renderBranding(frameTemplate).replace('<!-- CONTENT -->', content); + return renderBranding(frameTemplate).replace('<!-- CONTENT -->', () => content); } function getNewestScreen() { diff --git a/skills/brainstorming/spec-document-reviewer-prompt.md b/skills/brainstorming/spec-document-reviewer-prompt.md deleted file mode 100644 index 6099312..0000000 --- a/skills/brainstorming/spec-document-reviewer-prompt.md +++ /dev/null @@ -1,49 +0,0 @@ -# Spec Document Reviewer Prompt Template - -Use this template when dispatching a spec document reviewer subagent. - -**Purpose:** Verify the spec is complete, consistent, and ready for implementation planning. - -**Dispatch after:** Spec document is written to docs/superpowers/specs/ - -``` -Subagent (general-purpose): - description: "Review spec document" - prompt: | - You are a spec document reviewer. Verify this spec is complete and ready for planning. - - **Spec to review:** [SPEC_FILE_PATH] - - ## What to Check - - | Category | What to Look For | - |----------|------------------| - | Completeness | TODOs, placeholders, "TBD", incomplete sections | - | Consistency | Internal contradictions, conflicting requirements | - | Clarity | Requirements ambiguous enough to cause someone to build the wrong thing | - | Scope | Focused enough for a single plan — not covering multiple independent subsystems | - | YAGNI | Unrequested features, over-engineering | - - ## Calibration - - **Only flag issues that would cause real problems during implementation planning.** - A missing section, a contradiction, or a requirement so ambiguous it could be - interpreted two different ways — those are issues. Minor wording improvements, - stylistic preferences, and "sections less detailed than others" are not. - - Approve unless there are serious gaps that would lead to a flawed plan. - - ## Output Format - - ## Spec Review - - **Status:** Approved | Issues Found - - **Issues (if any):** - - [Section X]: [specific issue] - [why it matters for planning] - - **Recommendations (advisory, do not block approval):** - - [suggestions for improvement] -``` - -**Reviewer returns:** Status, Issues (if any), Recommendations diff --git a/skills/executing-plans/scripts/task-done b/skills/executing-plans/scripts/task-done index dd09871..e5fc6a9 100755 --- a/skills/executing-plans/scripts/task-done +++ b/skills/executing-plans/scripts/task-done @@ -45,7 +45,7 @@ if [ "$rc" -ne 0 ]; then exit "$rc" fi -last=$(grep -v '^[[:space:]]*$' "$log" | tail -n 1) +last=$(grep -v '^[[:space:]]*$' "$log" | tail -n 1) || last="(no output)" [ -f "$ledger" ] || printf '# SDD ledger — plan: %s\n' "$plan" > "$ledger" line="Task $n: complete (commits $(git rev-parse --short=7 "$base")..$(git rev-parse --short=7 HEAD), tests: $cmd → $last)" printf '%s\n' "$line" >> "$ledger" diff --git a/skills/requesting-code-review/SKILL.md b/skills/requesting-code-review/SKILL.md index 6d995da..68d338a 100644 --- a/skills/requesting-code-review/SKILL.md +++ b/skills/requesting-code-review/SKILL.md @@ -52,7 +52,7 @@ Dispatch a `general-purpose` subagent, filling the template at [code-reviewer.md You: Let me request code review before proceeding. -BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}') +BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | cut -d' ' -f1) HEAD_SHA=$(git rev-parse HEAD) [Dispatch code reviewer subagent] diff --git a/skills/subagent-driven-development/scripts/sdd-workspace b/skills/subagent-driven-development/scripts/sdd-workspace index ff6b983..b4661eb 100755 --- a/skills/subagent-driven-development/scripts/sdd-workspace +++ b/skills/subagent-driven-development/scripts/sdd-workspace @@ -42,13 +42,16 @@ slug=$(basename "$plan" .md) [ -n "$slug" ] && [ "$slug" != "." ] && [ "$slug" != ".." ] \ || { echo "cannot derive a workspace name from: $plan" >&2; exit 2; } -root=$(git rev-parse --show-toplevel) +# Physical path, spelled the way pwd -P spells the plan path below: on Git +# Bash, rev-parse prints C:/Users/... while pwd prints /c/Users/..., and the +# repo-relative marker check needs both in the same form. +root=$(CDPATH='' cd -- "$(git rev-parse --show-toplevel)" && pwd -P) base="$root/.superpowers/sdd" # Normalize the plan path (physical directory, so relative/absolute/../ # spellings of one plan compare equal) and express it as the marker value: # repo-relative when the plan lives under the repo root, absolute otherwise. -plan_dir=$(CDPATH= cd -- "$(dirname "$plan")" && pwd -P) +plan_dir=$(CDPATH='' cd -- "$(dirname "$plan")" && pwd -P) plan_abs="$plan_dir/$(basename "$plan")" case "$plan_abs" in "$root"/*) plan_id=${plan_abs#"$root"/} ;; @@ -78,5 +81,7 @@ if ! owns "$dir"; then fi fi -printf '*\n' > "$base/.gitignore" -CDPATH= cd -- "$dir" && pwd +# Create-only: a repo may commit its own .gitignore here (e.g. to version +# progress.md ledgers); overwriting it would revert that on every run. +[ -e "$base/.gitignore" ] || printf '*\n' > "$base/.gitignore" +CDPATH='' cd -- "$dir" && pwd diff --git a/skills/systematic-debugging/SKILL.md b/skills/systematic-debugging/SKILL.md index 095d194..62fc752 100644 --- a/skills/systematic-debugging/SKILL.md +++ b/skills/systematic-debugging/SKILL.md @@ -88,11 +88,11 @@ You MUST complete each phase before proceeding to the next. ```bash # Layer 1: Workflow echo "=== Secrets available in workflow: ===" - echo "IDENTITY: ${IDENTITY:+SET}${IDENTITY:-UNSET}" + echo "IDENTITY: $([ -n "${IDENTITY:-}" ] && echo SET || echo UNSET)" # Layer 2: Build script echo "=== Env vars in build script: ===" - env | grep IDENTITY || echo "IDENTITY not in environment" + printenv IDENTITY >/dev/null 2>&1 && echo "IDENTITY in environment" || echo "IDENTITY not in environment" # Layer 3: Signing script echo "=== Keychain state: ===" diff --git a/tests/antigravity/test-antigravity-tools.sh b/tests/antigravity/test-antigravity-tools.sh index e10edd4..ca83065 100755 --- a/tests/antigravity/test-antigravity-tools.sh +++ b/tests/antigravity/test-antigravity-tools.sh @@ -1,10 +1,8 @@ #!/usr/bin/env bash -# Validate the Antigravity (agy) integration. agy installs the existing plugin -# directly (`agy plugin install <repo-url>`): it loads the bundled skills and -# runs the SessionStart hook for bootstrap, so there is no agy-specific scaffold -# to test. What IS agy-specific is the tool mapping — subagent dispatch via -# invoke_subagent (self/research types) and task tracking via a task artifact — -# and SKILL.md pointing at it. +# Validate the Antigravity (agy) tool mapping: subagent dispatch via +# invoke_subagent (self/research types), task tracking via a task artifact, and +# SKILL.md pointing at the mapping. The plugin manifest and layout are checked +# by test-plugin-manifest.sh. # # Mirrors tests/pi/test-pi-extension.mjs's "tools reference documents # harness-specific mappings" check. CI-safe: does not require `agy` installed. diff --git a/tests/antigravity/test-logo.sh b/tests/antigravity/test-logo.sh new file mode 100755 index 0000000..6132e47 --- /dev/null +++ b/tests/antigravity/test-logo.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# Check the Antigravity Marketplace logo: a square RGBA PNG at least 128x128 +# (the Marketplace minimum), at the path the manifest names. When rsvg-convert +# is available, also check the committed PNG matches a fresh render, so the +# asset can't drift from scripts/render-antigravity-logo.sh. +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +LOGO="$REPO_ROOT/assets/antigravity-logo.png" + +fail() { echo "FAIL: $*" >&2; exit 1; } + +echo "test-logo: checking Antigravity logo" + +[ -f "$LOGO" ] || fail "logo missing at $LOGO" + +python3 - "$LOGO" <<'PY' +import struct +import sys + +data = open(sys.argv[1], "rb").read() +if data[:8] != b"\x89PNG\r\n\x1a\n": + raise SystemExit("FAIL: logo is not a PNG") +width, height, bit_depth, color_type = struct.unpack(">IIBB", data[16:26]) +if width != height: + raise SystemExit(f"FAIL: logo is not square ({width}x{height})") +if width < 128: + raise SystemExit(f"FAIL: logo is smaller than 128x128 ({width}x{height})") +if color_type != 6: + raise SystemExit(f"FAIL: logo is not RGBA (PNG color type {color_type})") +PY + +if command -v rsvg-convert >/dev/null 2>&1; then + tmp="$(mktemp -d)" + trap 'rm -f "$tmp/logo.png"; rmdir "$tmp"' EXIT + bash "$REPO_ROOT/scripts/render-antigravity-logo.sh" --output "$tmp/logo.png" >/dev/null + cmp -s "$tmp/logo.png" "$LOGO" \ + || fail "assets/antigravity-logo.png is stale; run scripts/render-antigravity-logo.sh" +else + echo "SKIP: rsvg-convert not on PATH; not checking logo freshness" +fi + +echo "PASS: Antigravity logo valid" diff --git a/tests/antigravity/test-plugin-manifest.sh b/tests/antigravity/test-plugin-manifest.sh new file mode 100755 index 0000000..ca2dad7 --- /dev/null +++ b/tests/antigravity/test-plugin-manifest.sh @@ -0,0 +1,107 @@ +#!/usr/bin/env bash +# Validate the native Antigravity plugin: the Marketplace manifest, the skill +# description agy relies on to bootstrap using-superpowers, and the repo layout +# agy depends on. CI-safe; when `agy` is on PATH, also runs `agy plugin validate`. +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" + +echo "test-plugin-manifest: checking Antigravity plugin" + +python3 - "$REPO_ROOT" <<'PY' +import json +import re +import struct +import sys +from pathlib import Path + +root = Path(sys.argv[1]) + +def fail(message): + raise SystemExit(f"FAIL: {message}") + +manifest_path = root / ".antigravity-plugin" / "plugin.json" +if not manifest_path.is_file(): + fail(f"manifest missing at {manifest_path}") +manifest = json.loads(manifest_path.read_text(encoding="utf-8")) + +# --- Marketplace-required fields ------------------------------------------- +for field in ["name", "description", "displayName", "logo", + "suggestedPrompts", "version", "author"]: + if not manifest.get(field): + fail(f"manifest field {field!r} is missing or empty") + +if manifest["name"] != "superpowers": + fail(f"name must be 'superpowers', got {manifest['name']!r}") +if not re.fullmatch(r"[a-z0-9]+(-[a-z0-9]+)*", manifest["name"]): + fail("name is not kebab-case") + +description_length = len(manifest["description"]) +# The guide recommends 120-160 characters for Marketplace cards; we use a +# shorter tagline by choice, so enforce only the upper bound. +if description_length > 160: + fail(f"description is {description_length} characters; Marketplace cards fit at most 160") + +prompts = manifest["suggestedPrompts"] +if not isinstance(prompts, list) or not 1 <= len(prompts) <= 3: + fail("suggestedPrompts must be a list of 1-3 prompts") +if not all(isinstance(p, str) and p.strip() for p in prompts): + fail("suggestedPrompts entries must be non-empty strings") + +claude_manifest = json.loads( + (root / ".claude-plugin" / "plugin.json").read_text(encoding="utf-8")) +if manifest["version"] != claude_manifest["version"]: + fail(f"version {manifest['version']!r} != .claude-plugin version " + f"{claude_manifest['version']!r}") +if manifest["author"] != claude_manifest["author"]: + fail("author does not match .claude-plugin/plugin.json") + +# --- Logo ------------------------------------------------------------------ +logo = root / manifest["logo"] +if not logo.is_file(): + fail(f"logo {manifest['logo']!r} does not exist") +header = logo.read_bytes()[:26] +if header[:8] != b"\x89PNG\r\n\x1a\n": + fail("logo is not a PNG") +width, height = struct.unpack(">II", header[16:24]) +if width != height or width < 128: + fail(f"logo must be square and at least 128x128, got {width}x{height}") + +# --- Version bumps --------------------------------------------------------- +version_config = json.loads((root / ".version-bump.json").read_text(encoding="utf-8")) +if not any(entry.get("path") == ".antigravity-plugin/plugin.json" + and entry.get("field") == "version" + for entry in version_config.get("files", [])): + fail(".version-bump.json does not register .antigravity-plugin/plugin.json") + +# --- Bootstrap: agy lists each skill's description, and using-superpowers' +# description is what gets the model to load it at the start of a session. +skill_md = (root / "skills" / "using-superpowers" / "SKILL.md").read_text(encoding="utf-8") +frontmatter = re.match(r"---\n(.*?)\n---\n", skill_md, re.DOTALL) +description = frontmatter and re.search(r"^description:(.*)$", frontmatter.group(1), re.MULTILINE) +if not description or "Use when starting any conversation" not in description.group(1): + fail("using-superpowers description no longer says 'Use when starting any " + "conversation'; Antigravity relies on it to bootstrap") + +# --- Layout agy depends on ------------------------------------------------- +# A root plugin.json would be read instead of .antigravity-plugin/plugin.json, +# a root hooks.json would run on every model call, and Cursor loads any +# rules/*.md shipped in a plugin. +for stray in ["plugin.json", "hooks.json", "rules"]: + if (root / stray).exists(): + fail(f"root {stray} must not exist") +PY + +if command -v agy >/dev/null 2>&1; then + output="$(agy plugin validate "$REPO_ROOT" 2>&1)" \ + || { echo "$output" >&2; echo "FAIL: agy plugin validate failed" >&2; exit 1; } + grep -q '\[ok\]' <<<"$output" \ + || { echo "$output" >&2; echo "FAIL: agy plugin validate did not report [ok]" >&2; exit 1; } + grep -qE 'skills +: [0-9]+ processed' <<<"$output" \ + || { echo "$output" >&2; echo "FAIL: agy found no skills" >&2; exit 1; } +else + echo "SKIP: agy not on PATH; not running agy plugin validate" +fi + +echo "PASS: Antigravity plugin manifest and layout valid" diff --git a/tests/brainstorm-server/lifecycle.test.js b/tests/brainstorm-server/lifecycle.test.js index c43d8c0..83b3193 100644 --- a/tests/brainstorm-server/lifecycle.test.js +++ b/tests/brainstorm-server/lifecycle.test.js @@ -102,16 +102,16 @@ async function waitForStartedOutput(child, timeoutMs = 5000) { } function makeShellTempDir(prefix) { - return execFileSync('bash', ['-lc', `mktemp -d "\${TMPDIR:-/tmp}/${prefix}-XXXXXX"`], { encoding: 'utf8' }).trim(); + return execFileSync('bash', ['-c', `mktemp -d "\${TMPDIR:-/tmp}/${prefix}-XXXXXX"`], { encoding: 'utf8' }).trim(); } function removeShellPath(p) { - execFileSync('bash', ['-lc', 'rm -rf "$1"', 'bash', p], { stdio: 'ignore' }); + execFileSync('bash', ['-c', 'rm -rf "$1"', 'bash', p], { stdio: 'ignore' }); } function newestSessionDir(projectDir) { const sessionDir = execFileSync('bash', [ - '-lc', + '-c', 'find "$1/.superpowers/brainstorm" -mindepth 1 -maxdepth 1 -type d -print | sort | tail -1', 'bash', projectDir diff --git a/tests/brainstorm-server/server.test.js b/tests/brainstorm-server/server.test.js index 5d62323..510ee98 100644 --- a/tests/brainstorm-server/server.test.js +++ b/tests/brainstorm-server/server.test.js @@ -211,6 +211,20 @@ async function runTests() { assert(res.body.includes('data-choice="a"'), 'Fragment interactive elements intact'); }); + await test('preserves literal replacement tokens in content fragments', async () => { + const tokens = ["$'", '$`', '$&', '$$', '$1', '$<name>']; + const fragment = '<h2>Literal tokens</h2><pre>' + tokens.join(' | ') + '</pre>'; + fs.writeFileSync(path.join(CONTENT_DIR, 'literal-tokens.html'), fragment); + await sleep(300); + + const res = await fetch(`http://localhost:${TEST_PORT}/`); + assert.strictEqual(res.status, 200); + assert(res.body.includes(fragment), 'Fragment must be inserted verbatim'); + assert.strictEqual(res.body.split('<div class="header">').length - 1, 1, 'Frame chrome must not be duplicated'); + assert(!res.body.includes('<!-- CONTENT -->'), 'Replacement tokens must not restore the placeholder'); + assert(res.body.includes('WebSocket'), 'Helper must still be injected'); + }); + await test('serves newest file by mtime', async () => { fs.writeFileSync(path.join(CONTENT_DIR, 'older.html'), '<h2>Older</h2>'); await sleep(100); @@ -577,7 +591,8 @@ async function runTests() { // ========== Summary ========== console.log(`\n--- Results: ${passed} passed, ${failed} failed, ${skipped} skipped ---`); - if (failed > 0) process.exit(1); + // exitCode, not exit(): exit() would skip the finally below and orphan the server. + if (failed > 0) process.exitCode = 1; } finally { server.kill(); diff --git a/tests/claude-code/test-executing-plans-scripts.sh b/tests/claude-code/test-executing-plans-scripts.sh index 994733b..e4e3904 100755 --- a/tests/claude-code/test-executing-plans-scripts.sh +++ b/tests/claude-code/test-executing-plans-scripts.sh @@ -33,6 +33,8 @@ main() { git init -q -b main "$TEST_ROOT/repo" local repo repo="$(cd "$TEST_ROOT/repo" && git rev-parse --show-toplevel)" + # Same spelling as the scripts print (pwd), not rev-parse's C:/... on Git Bash. + repo="$(cd "$repo" && pwd)" local git_id=(-c user.email=t@example.com -c user.name=t -c commit.gpgsign=false) cat > "$repo/plan.md" <<'PLAN' @@ -127,6 +129,31 @@ PLAN echo " got: $out" fi + # --- task-done: records a passing task whose test command prints nothing --- + # https://github.com/obra/superpowers/issues/2385 -- under `set -euo + # pipefail`, the ledger's `grep -v '^[[:space:]]*$' log | tail -n 1` + # exits 1 on an empty/blank log, which used to abort the whole script + # (silently, no ledger line) even though the test command itself passed. + ( cd "$repo" && echo y > work2.txt && git add work2.txt && git "${git_id[@]}" commit -qm "task 2" ) + local head2 + head2="$(cd "$repo" && git rev-parse HEAD)" + rc=0 + out="$(cd "$repo" && "$EP_SCRIPTS/task-done" plan.md 2 "$head" -- true 2>&1)" || rc=$? + if [[ "$rc" -eq 0 ]]; then + pass "task-done exits 0 when a passing test command prints nothing" + else + fail "task-done exits 0 when a passing test command prints nothing (got rc=$rc)" + echo " got: $out" + fi + local expected2="Task 2: complete (commits ${head:0:7}..${head2:0:7}, tests: true → (no output))" + if [[ -f "$ledger" ]] && grep -qF "$expected2" "$ledger"; then + pass "task-done records a passing task that printed no output" + else + fail "task-done records a passing task that printed no output" + echo " expected: $expected2" + echo " ledger:"; sed 's/^/ /' "$ledger" 2>/dev/null || echo " (missing)" + fi + echo if [[ "$FAILURES" -eq 0 ]]; then echo "PASS" diff --git a/tests/claude-code/test-sdd-workspace.sh b/tests/claude-code/test-sdd-workspace.sh index 2e8c227..16cf50d 100755 --- a/tests/claude-code/test-sdd-workspace.sh +++ b/tests/claude-code/test-sdd-workspace.sh @@ -17,6 +17,16 @@ fail() { FAILURES=$((FAILURES + 1)) } +# Push a path through the same `cd ... && pwd` normalization that +# sdd-workspace's own printed output goes through, so both sides of a +# string comparison are guaranteed to be spelled identically. On Windows +# Git Bash/MSYS, `git rev-parse --show-toplevel` (Windows-style, +# C:/Users/...) and `cd ... && pwd` (MSYS-style, /c/Users/...) can print +# different spellings of the identical physical directory; on Linux/macOS +# this is a no-op since the two already agree (module the resolved-symlink +# /var -> /private/var case handled by the mktemp comment above). +physical_path() { (cd "$1" && pwd); } + cleanup() { if [[ -n "$TEST_ROOT" && -d "$TEST_ROOT" ]]; then rm -rf "$TEST_ROOT" @@ -35,6 +45,7 @@ main() { git init -q -b main "$TEST_ROOT/repo" local repo repo="$(cd "$TEST_ROOT/repo" && git rev-parse --show-toplevel)" + repo="$(physical_path "$repo")" cat > "$repo/plan-a.md" <<'PLAN' # Plan A @@ -194,6 +205,7 @@ PLAN ( cd "$repo" && git worktree add -q "$wt" -b wt-feature ) local wt_root wt_dir wt_root="$(cd "$wt" && git rev-parse --show-toplevel)" + wt_root="$(physical_path "$wt_root")" wt_dir="$(cd "$wt" && "$SDD_SCRIPTS/sdd-workspace" plan-a.md)" if [[ "$wt_dir" == "$wt_root/.superpowers/sdd/plan-a" && "$wt_dir" != "$dir_a" ]]; then pass "linked worktree resolves its own distinct workspace" @@ -350,6 +362,24 @@ PLAN echo " marker: $(cat "$dir_out/plan-path" 2>/dev/null)" fi + # --- A repo's own committed .superpowers/sdd/.gitignore is left alone --- + git init -q -b main "$TEST_ROOT/own-ignore" + local own own_ignore + own="$(cd "$TEST_ROOT/own-ignore" && git rev-parse --show-toplevel)" + own_ignore=$'*\n!.gitignore\n!*/\n!*/progress.md' + mkdir -p "$own/.superpowers/sdd" + printf '%s\n' "$own_ignore" > "$own/.superpowers/sdd/.gitignore" + printf '# Plan\n\n## Task 1: One\n\nOne.\n' > "$own/plan.md" + (cd "$own" && git add -A && git -c user.name=t -c user.email=t@t commit -qm init) + (cd "$own" && "$SDD_SCRIPTS/sdd-workspace" plan.md >/dev/null) + if [[ "$(cat "$own/.superpowers/sdd/.gitignore")" == "$own_ignore" \ + && -z "$(cd "$own" && git status --porcelain -- .superpowers/sdd/.gitignore)" ]]; then + pass "an existing .superpowers/sdd/.gitignore is not overwritten" + else + fail "an existing .superpowers/sdd/.gitignore is not overwritten" + echo " now: $(cat "$own/.superpowers/sdd/.gitignore")" + fi + echo "" if [[ "$FAILURES" -ne 0 ]]; then echo "FAILED: $FAILURES assertion(s)." diff --git a/tests/codex-plugin-sync/test-sync-to-codex-plugin.sh b/tests/codex-plugin-sync/test-sync-to-codex-plugin.sh index 265aea1..84282c2 100755 --- a/tests/codex-plugin-sync/test-sync-to-codex-plugin.sh +++ b/tests/codex-plugin-sync/test-sync-to-codex-plugin.sh @@ -174,6 +174,7 @@ write_upstream_fixture() { local with_pure_ignored="${2:-1}" mkdir -p \ + "$repo/.antigravity-plugin" \ "$repo/.codex-plugin" \ "$repo/.kimi-plugin" \ "$repo/.private-journal" \ @@ -241,6 +242,15 @@ EOF } EOF + cat > "$repo/.antigravity-plugin/plugin.json" <<EOF +{ + "name": "superpowers", + "version": "$MANIFEST_VERSION" +} +EOF + + printf 'antigravity png fixture\n' > "$repo/assets/antigravity-logo.png" + cat > "$repo/assets/superpowers-small.svg" <<'EOF' <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1 1"></svg> EOF @@ -295,11 +305,13 @@ EOF fi git -C "$repo" add \ + .antigravity-plugin/plugin.json \ .codex-plugin/plugin.json \ .kimi-plugin/plugin.json \ .gitignore \ .gitmodules \ .pre-commit-config.yaml \ + assets/antigravity-logo.png \ assets/app-icon.png \ assets/superpowers-small.svg \ evals/drill/README.md \ @@ -657,6 +669,8 @@ main() { assert_not_contains "$preview_output" "Version: $PACKAGE_VERSION" "Preview does not use package.json version" assert_contains "$preview_section" ".codex-plugin/plugin.json" "Preview includes manifest path" assert_not_contains "$preview_section" ".kimi-plugin/plugin.json" "Preview excludes Kimi manifest from Codex sync" + assert_not_contains "$preview_section" ".antigravity-plugin/plugin.json" "Preview excludes Antigravity manifest from Codex sync" + assert_not_contains "$preview_section" "assets/antigravity-logo.png" "Preview excludes Antigravity logo from Codex sync" assert_contains "$preview_section" "assets/superpowers-small.svg" "Preview includes SVG asset" assert_contains "$preview_section" "assets/app-icon.png" "Preview includes PNG asset" assert_contains "$preview_section" "hooks/hooks-codex.json" "Preview includes Codex hook manifest" diff --git a/tests/hermes/conftest.py b/tests/hermes/conftest.py index 561cd8c..ec22bed 100644 --- a/tests/hermes/conftest.py +++ b/tests/hermes/conftest.py @@ -9,11 +9,12 @@ def mock_ctx(): ctx = MagicMock() ctx._hooks = {} ctx._skills = {} + ctx._descriptions = {} def register_hook(event, fn): ctx._hooks[event] = fn - def register_skill(name, path): + def register_skill(name, path, description="", frontmatter=None): # Mimic hermes' real register_skill, which calls path.exists() and # therefore breaks on a str (the bug that silently disabled the whole # plugin, found 2026-07-23). Keeping that fidelity here means a @@ -24,6 +25,7 @@ def mock_ctx(): f"register_skill requires a pathlib.Path, got {type(path).__name__}" ) ctx._skills[name] = path + ctx._descriptions[name] = description ctx.register_hook.side_effect = register_hook ctx.register_skill.side_effect = register_skill diff --git a/tests/hermes/test_plugin.py b/tests/hermes/test_plugin.py index 9c6c4f0..57d619e 100644 --- a/tests/hermes/test_plugin.py +++ b/tests/hermes/test_plugin.py @@ -1,6 +1,7 @@ import importlib import importlib.util import os +import re import shutil import sys from pathlib import Path @@ -140,3 +141,38 @@ class TestLayoutResolution: mod = self._load_from(plugdir) with pytest.raises(RuntimeError, match="cannot find the skills"): mod.register(mock_ctx) + + +class TestSkillDescriptions: + """Hermes builds its skill catalogue from register_skill(description=...), + which defaults to "". Registering the path alone left every stock skill + blank in that catalogue, so the model had nothing to select on.""" + + def test_every_stock_skill_registers_a_description(self, mock_ctx): + plugin = _load_plugin() + plugin.register(mock_ctx) + assert set(mock_ctx._descriptions) == set(mock_ctx._skills) + blank = sorted(n for n, d in mock_ctx._descriptions.items() if not d.strip()) + assert blank == [], f"registered without a description: {blank}" + + def test_descriptions_match_the_skill_frontmatter(self, mock_ctx): + plugin = _load_plugin() + plugin.register(mock_ctx) + skills_dir = Path(plugin._skills_dir()) + for name, description in mock_ctx._descriptions.items(): + text = (skills_dir / name / "SKILL.md").read_text(encoding="utf-8") + declared = re.search(r"^description:\s*(.+)$", text, re.M).group(1) + assert description == declared.strip().strip('"').strip("'") + + @pytest.mark.parametrize( + "block, expected", + [ + ('---\nname: demo\ndescription: "Quoted value."\n---\nbody', "Quoted value."), + ("---\nname: demo\ndescription: Bare value\n---\nbody", "Bare value"), + ("---\nname: demo\n---\nbody", ""), + ("no frontmatter at all", ""), + ], + ) + def test_frontmatter_value_parsing(self, block, expected): + plugin = _load_plugin() + assert plugin._frontmatter_value(block, "description") == expected diff --git a/tests/hooks/test-run-hook-cmd-windows.sh b/tests/hooks/test-run-hook-cmd-windows.sh new file mode 100755 index 0000000..b58c6d1 --- /dev/null +++ b/tests/hooks/test-run-hook-cmd-windows.sh @@ -0,0 +1,223 @@ +#!/usr/bin/env bash +# Tests for the Windows (cmd) half of hooks/run-hook.cmd: how it finds bash +# and whether the hook's exit code survives. Run from Git Bash on Windows; +# skips anywhere cmd.exe isn't available. +# +# Most cases need the fallback branches, which a machine with Git in +# Program Files never reaches. Those cases run a sandbox copy of the wrapper +# whose Program Files paths point at a directory that doesn't exist. +set -euo pipefail + +if ! command -v cmd >/dev/null 2>&1 || ! command -v cygpath >/dev/null 2>&1; then + echo "SKIP: cmd.exe not available (these tests run in Git Bash on Windows)" + exit 0 +fi + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +PF_GIT='C:\Program Files\Git' +# Spelled out: inside Git Bash, cygpath maps its own install dir to "/". +PF_GIT_UNIX='/c/Program Files/Git' + +if [[ ! -e "$PF_GIT_UNIX/bin/bash.exe" ]]; then + echo "SKIP: needs Git for Windows in $PF_GIT to stand in for other installs" + exit 0 +fi + +FAILURES=0 +TEST_ROOT="$(mktemp -d)" +JUNCTIONS=() + +cleanup() { + # Remove junctions with cmd's rmdir first, which never touches the + # target, so nothing below can recurse into the real Git install. + local j left=0 + for j in "${JUNCTIONS[@]}"; do + cmd //c rmdir "$j" >/dev/null 2>&1 || true + if [[ -e "$(cygpath "$j")" ]]; then + echo "WARNING: junction $j still exists; not deleting $TEST_ROOT" >&2 + left=1 + fi + done + [[ "$left" -eq 0 ]] && rm -rf "$TEST_ROOT" +} +trap cleanup EXIT + +pass() { echo " [PASS] $1"; } +fail() { echo " [FAIL] $1"; FAILURES=$((FAILURES + 1)); } + +junction() { + local link="$1" target="$2" + # Keep Git Bash from rewriting /J into a path. + MSYS2_ARG_CONV_EXCL="*" cmd /c mklink /J "$link" "$target" >/dev/null + JUNCTIONS+=("$link") +} + +# A plugin root with probe hooks. $1 = "real" keeps the wrapper as is; +# "sandbox" points its Program Files paths at nothing. +make_plugin() { + local dir="$1" mode="$2" + mkdir -p "$dir/hooks" + if [[ "$mode" == sandbox ]]; then + sed -e 's#C:\\Program Files\\Git\\#C:\\no-such-program-files\\Git\\#g' \ + -e 's#C:\\Program Files (x86)\\Git\\#C:\\no-such-program-files\\Git\\#g' \ + "$REPO_ROOT/hooks/run-hook.cmd" > "$dir/hooks/run-hook.cmd" + if grep -q 'Program Files' "$dir/hooks/run-hook.cmd"; then + echo "sandbox wrapper still mentions Program Files" >&2 + exit 1 + fi + else + cp "$REPO_ROOT/hooks/run-hook.cmd" "$dir/hooks/run-hook.cmd" + fi + printf 'echo probe-ran\n' > "$dir/hooks/probe-ok" + printf 'echo probe-ran\nexit 7\n' > "$dir/hooks/probe-exit" +} + +# run_hook PLUGIN_DIR CWD PROBE [VAR=value...] -> sets OUT and RC +run_hook() { + local plugin="$1" cwd="$2" probe="$3" + shift 3 + RC=0 + # tr drops the NUL bytes the WSL launcher prints (UTF-16 text). + OUT="$(cd "$cwd" && env "$@" cmd //c "$(cygpath -w "$plugin")\\hooks\\run-hook.cmd" "$probe" 2>&1 | tr -d '\000'; exit "${PIPESTATUS[0]}")" || RC=$? +} + +SYS32_PATH="/c/Windows/System32" +GIT_USR_BIN="$PF_GIT_UNIX/usr/bin" +NO_LA='C:\no-such-localappdata' + +echo "run-hook.cmd (Windows) tests" + +# --- exit code of the hook survives the wrapper --- +real="$TEST_ROOT/real" +make_plugin "$real" real +run_hook "$real" "$TEST_ROOT" probe-exit +if [[ "$RC" -eq 7 && "$OUT" == *probe-ran* ]]; then + pass "hook exit code propagates through run-hook.cmd" +else + fail "hook exit code propagates through run-hook.cmd (rc=$RC, out=$OUT)" +fi + +sandbox="$TEST_ROOT/sandbox" +make_plugin "$sandbox" sandbox + +# --- per-user Git install (%LOCALAPPDATA%\Programs\Git) --- +la="$TEST_ROOT/localappdata" +mkdir -p "$la/Programs" +junction "$(cygpath -w "$la/Programs/Git")" "$PF_GIT" +run_hook "$sandbox" "$TEST_ROOT" probe-exit \ + LOCALAPPDATA="$(cygpath -w "$la")" PATH="$SYS32_PATH" +if [[ "$RC" -eq 7 && "$OUT" == *probe-ran* ]]; then + pass "per-user Git install is found and its exit code propagates" +else + fail "per-user Git install is found and its exit code propagates (rc=$RC, out=$OUT)" +fi + +# --- the System32 WSL launcher on PATH is skipped for a real bash --- +run_hook "$sandbox" "$TEST_ROOT" probe-ok \ + LOCALAPPDATA="$NO_LA" PATH="$SYS32_PATH:$GIT_USR_BIN" +if [[ "$RC" -eq 0 && "$OUT" == *probe-ran* ]]; then + pass "System32 bash.exe (WSL launcher) is skipped in favor of Git's bash on PATH" +else + fail "System32 bash.exe (WSL launcher) is skipped in favor of Git's bash on PATH (rc=$RC, out=$OUT)" +fi + +# --- a bash under a WindowsApps directory (the Store WSL stub) is skipped --- +apps_la="$TEST_ROOT/apps-localappdata" +apps="$apps_la/Microsoft/WindowsApps" +mkdir -p "$apps" +apps_marker="$TEST_ROOT/windowsapps-ran" +printf '@echo off\r\necho stub> "%s"\r\n' "$(cygpath -w "$apps_marker")" > "$apps/bash.cmd" +run_hook "$sandbox" "$TEST_ROOT" probe-ok \ + LOCALAPPDATA="$(cygpath -w "$apps_la")" PATH="$apps:$SYS32_PATH:$GIT_USR_BIN" +if [[ ! -e "$apps_marker" && "$OUT" == *probe-ran* ]]; then + pass "bash under WindowsApps (Store WSL stub) is skipped" +else + fail "bash under WindowsApps (Store WSL stub) is skipped (stub ran: $([[ -e $apps_marker ]] && echo yes || echo no), out=$OUT)" +fi + +# --- nothing in the current directory is run: not bash, not where --- +plant="$TEST_ROOT/planted-cwd" +mkdir -p "$plant" +for name in bash.cmd where.bat; do + printf '@echo off\r\necho planted> "%s"\r\n' "$(cygpath -w "$TEST_ROOT/ran-$name")" > "$plant/$name" +done +run_hook "$sandbox" "$plant" probe-ok \ + LOCALAPPDATA="$NO_LA" PATH="$SYS32_PATH:$GIT_USR_BIN" +for name in bash.cmd where.bat; do + if [[ ! -e "$TEST_ROOT/ran-$name" && "$OUT" == *probe-ran* ]]; then + pass "$name in the current directory is not run" + else + fail "$name in the current directory is not run (ran: $([[ -e $TEST_ROOT/ran-$name ]] && echo yes || echo no), out=$OUT)" + fi +done + +# --- PATH entries whose names cmd could misparse still work --- +# fake_bash DIR: a bash.cmd that reports it ran. +fake_bash() { + mkdir -p "$1" + printf '@echo off\r\necho fake-bash-ran\r\n' > "$1/bash.cmd" +} +for dir_name in 'caret^and%OS%percent' $'caf\u00e9-bin' 'extensionless'; do + dir="$TEST_ROOT/$dir_name" + case "$dir_name" in + extensionless) + # An extensionless "bash" first on PATH must be skipped. + mkdir -p "$dir" + printf 'not a program\n' > "$dir/bash" + fake_bash "$TEST_ROOT/after-extensionless" + path="$dir:$TEST_ROOT/after-extensionless:$SYS32_PATH" + ;; + *) + fake_bash "$dir" + path="$dir:$SYS32_PATH" + ;; + esac + run_hook "$sandbox" "$TEST_ROOT" probe-ok LOCALAPPDATA="$NO_LA" PATH="$path" + if [[ "$RC" -eq 0 && "$OUT" == *fake-bash-ran* ]]; then + pass "bash on PATH is found under $dir_name" + else + fail "bash on PATH is found under $dir_name (rc=$RC, out=$OUT)" + fi +done + +# --- unset SystemRoot must not let the WSL launcher through --- +run_hook "$sandbox" "$TEST_ROOT" probe-ok -u SystemRoot \ + LOCALAPPDATA="$NO_LA" PATH="$SYS32_PATH:$GIT_USR_BIN" +if [[ "$RC" -eq 0 && "$OUT" != *Subsystem* ]]; then + pass "unset SystemRoot does not run the WSL launcher" +else + fail "unset SystemRoot does not run the WSL launcher (rc=$RC, out=$OUT)" +fi + +# --- unset LOCALAPPDATA must not probe \Programs\Git on the current drive --- +drive_programs="/c/Programs" +if [[ -e "$drive_programs" ]]; then + echo " [SKIP] unset LOCALAPPDATA: C:\\Programs already exists" +else + mkdir "$drive_programs" + junction 'C:\Programs\Git' "$PF_GIT" + run_hook "$sandbox" "$TEST_ROOT" probe-ok -u LOCALAPPDATA PATH="$SYS32_PATH" + cmd //c rmdir 'C:\Programs\Git' >/dev/null 2>&1 || true + rmdir "$drive_programs" + if [[ "$RC" -eq 0 && "$OUT" != *probe-ran* ]]; then + pass "unset LOCALAPPDATA does not run \\Programs\\Git on the current drive" + else + fail "unset LOCALAPPDATA does not run \\Programs\\Git on the current drive (rc=$RC, out=$OUT)" + fi +fi + +# --- no usable bash: exit 0 quietly, without invoking the WSL launcher --- +run_hook "$sandbox" "$TEST_ROOT" probe-ok \ + LOCALAPPDATA="$NO_LA" PATH="$SYS32_PATH" +if [[ "$RC" -eq 0 && -z "$OUT" ]]; then + pass "no usable bash exits 0 with no output" +else + fail "no usable bash exits 0 with no output (rc=$RC, out=$OUT)" +fi + +if [[ "$FAILURES" -gt 0 ]]; then + echo "STATUS: FAILED ($FAILURES failure(s))" + exit 1 +fi +echo "STATUS: PASSED" diff --git a/tests/hooks/test-session-start.sh b/tests/hooks/test-session-start.sh index c150829..6ddf011 100755 --- a/tests/hooks/test-session-start.sh +++ b/tests/hooks/test-session-start.sh @@ -217,6 +217,106 @@ assert_command_output \ CLAUDE_PLUGIN_ROOT="$REPO_ROOT" \ bash "$HOOK_UNDER_TEST" +# Regression for #2310: Claude Code can spawn SessionStart:startup hooks with +# a broken/empty PATH (anthropics/claude-code#43127). session-start and +# run-hook.cmd's Unix half both shell out to external binaries (dirname, cat) +# that an empty PATH cannot resolve, even though bash itself was invoked by +# absolute path. Every call here should use bash's own builtins/redirection +# instead, so an empty PATH must not change the result. +bash_bin="$(command -v bash)" + +broken_path_home="$(make_home broken-path)" +assert_command_output \ + "session-start with empty PATH still emits nested additionalContext" \ + "nested" \ + "" \ + "" \ + "$broken_path_home" \ + PATH="" \ + CLAUDE_PLUGIN_ROOT="$REPO_ROOT" \ + "$bash_bin" "$HOOK_UNDER_TEST" + +broken_path_wrapper_home="$(make_home broken-path-wrapper)" +assert_command_output \ + "run-hook.cmd with empty PATH still dispatches session-start" \ + "nested" \ + "" \ + "" \ + "$broken_path_wrapper_home" \ + PATH="" \ + CLAUDE_PLUGIN_ROOT="$REPO_ROOT" \ + "$bash_bin" "$WRAPPER_UNDER_TEST" session-start + +# Run by bare filename from inside hooks/ ($0 has no slash), the plugin root +# must still resolve. +bare_name_home="$(make_home bare-name)" +assert_command_output \ + "session-start run by bare filename from hooks/ still emits nested additionalContext" \ + "nested" \ + "" \ + "" \ + "$bare_name_home" \ + CLAUDE_PLUGIN_ROOT="$REPO_ROOT" \ + "$bash_bin" -c 'cd "$1" && exec "$2" session-start' _ "$REPO_ROOT/hooks" "$bash_bin" + +bare_name_wrapper_home="$(make_home bare-name-wrapper)" +assert_command_output \ + "run-hook.cmd run by bare filename from hooks/ still dispatches session-start" \ + "nested" \ + "" \ + "" \ + "$bare_name_wrapper_home" \ + CLAUDE_PLUGIN_ROOT="$REPO_ROOT" \ + "$bash_bin" -c 'cd "$1" && exec "$2" run-hook.cmd session-start' _ "$REPO_ROOT/hooks" "$bash_bin" + +# run-hook.cmd's Windows half starts bash with a backslash path +# (C:\...\hooks\session-start), so $0 can use \ as its separator. The skill +# must still be found. On Windows use the real Windows path; elsewhere build +# a plugin root whose hook is reached through a name containing a backslash. +backslash_home="$(make_home backslash)" +if command -v cygpath >/dev/null 2>&1; then + backslash_cwd="$REPO_ROOT" + backslash_hook="$(cygpath -w "$HOOK_UNDER_TEST")" +else + backslash_cwd="$TEST_ROOT/backslash/root" + mkdir -p "$backslash_cwd" + ln -s "$REPO_ROOT/hooks" "$backslash_cwd/hooks" + ln -s "$REPO_ROOT/skills" "$backslash_cwd/skills" + ln -s "$REPO_ROOT/hooks/session-start" "$backslash_cwd/hooks\\session-start" + backslash_hook='hooks\session-start' +fi +assert_command_output \ + "session-start reached through a backslash path still reads the skill" \ + "nested" \ + "" \ + "Error reading using-superpowers skill" \ + "$backslash_home" \ + CLAUDE_PLUGIN_ROOT="$REPO_ROOT" \ + "$bash_bin" -c 'cd "$1" && exec "$2" "$3"' _ "$backslash_cwd" "$bash_bin" "$backslash_hook" + +# When cat is on PATH, the JSON must still go through it: the pipe absorbs +# EPIPE on Windows + Git Bash (#1612). The stub records that it ran. +cat_stub_dir="$TEST_ROOT/cat-stub/bin" +cat_marker="$TEST_ROOT/cat-stub/used" +mkdir -p "$cat_stub_dir" +printf '#!%s\n: > "%s"\nexec /bin/cat "$@"\n' "$bash_bin" "$cat_marker" > "$cat_stub_dir/cat" +chmod +x "$cat_stub_dir/cat" +cat_stub_home="$(make_home cat-stub)" +assert_command_output \ + "session-start with cat on PATH emits nested additionalContext" \ + "nested" \ + "" \ + "" \ + "$cat_stub_home" \ + PATH="$cat_stub_dir" \ + CLAUDE_PLUGIN_ROOT="$REPO_ROOT" \ + "$bash_bin" "$HOOK_UNDER_TEST" +if [[ -f "$cat_marker" ]]; then + pass "session-start pipes its JSON through cat when cat is on PATH" +else + fail "session-start pipes its JSON through cat when cat is on PATH" +fi + if [[ "$FAILURES" -gt 0 ]]; then echo "STATUS: FAILED ($FAILURES failure(s))" exit 1 diff --git a/tests/version-bump/test-bump-version.sh b/tests/version-bump/test-bump-version.sh index 195d88a..2f77a48 100644 --- a/tests/version-bump/test-bump-version.sh +++ b/tests/version-bump/test-bump-version.sh @@ -73,4 +73,17 @@ cmp -s "$TEST_ROOT/package.before" "$invalid_repo/package.json" \ cmp -s "$TEST_ROOT/plugin.before" "$invalid_repo/.hermes-plugin/plugin.yaml" \ || fail "invalid YAML manifest changed" +audit_repo="$TEST_ROOT/audit-boundaries" +make_fixture "$audit_repo" $'name: superpowers\nversion: 1.2.3' +/bin/bash "$audit_repo/scripts/bump-version.sh" 4.0.0 >/dev/null +printf 'host = "10.4.0.0"\n' >"$audit_repo/server.js" +printf 'pin: superpowers.git#v4.0.0\n' >"$audit_repo/INSTALL.md" +/bin/bash "$audit_repo/scripts/bump-version.sh" --audit >"$TEST_ROOT/audit-boundaries.out" + +grep -q 'INSTALL.md' "$TEST_ROOT/audit-boundaries.out" \ + || fail "audit missed an undeclared #v4.0.0 pin" +if grep -q 'server.js' "$TEST_ROOT/audit-boundaries.out"; then + fail "audit flagged 10.4.0.0 as version 4.0.0" +fi + echo "Version-bump tests passed" diff --git a/tests/writing-skills/test-render-graphs.sh b/tests/writing-skills/test-render-graphs.sh index 349cd47..8bda626 100755 --- a/tests/writing-skills/test-render-graphs.sh +++ b/tests/writing-skills/test-render-graphs.sh @@ -4,7 +4,9 @@ set -u SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" SCRIPT_UNDER_TEST="$REPO_ROOT/skills/writing-skills/render-graphs.js" -NODE_BIN="$(command -v node)" +# Resolve the real binary: version-manager shims (mise, asdf) can't find node +# under the empty PATH used for the missing-Graphviz case. +NODE_BIN="$(node -p 'process.execPath')" PASSES=0 FAILURES=0 |
