Agent-authoring: --scaffold, schema, render --redact fix + Claude Code skill#1
Merged
Conversation
…ct fix Make the "AI authors the story, renderer stays separate" thesis a first-class CLI flow so any coding agent (not just the built-in anthropic adapter) can drive patchstory: - `--scaffold` on the source commands (diff/commits/file/github) emits the editable pr-walkthrough.json (the IR) instead of rendering a site. `--emit-diff` additionally writes the exact resolved diff bytes, so the same input can be passed to `render --diff` with hunk line refs still aligned. - `schema` command prints the canonical WALKTHROUGH_JSON_SCHEMA for validation. - Fix `render --redact`: it was a no-op, because redaction only ran inside buildWalkthrough (the source paths), never in renderCommand — which parses the --diff file itself. Now render calls redactParsedDiff on the parsed diff, so secrets are masked in the embedded output and the "masked N lines" count is truthful. Adds tests/cli.test.ts covering schema output, scaffold validity + byte-identical --emit-diff, and the render --redact masking (regression guard). Skips when the bundle isn't built; CI builds before testing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A ready-to-install skill that drives patchstory with Claude authoring the narrative (the JSON IR), built on the new CLI primitives so it stays thin: - scripts/collect.sh resolves the source (branch's open PR, else branch-vs-base, or an explicit PR#/URL/range/branch) and runs a single `patchstory scaffold --emit-diff` to produce skel.json + the exact diff. No more re-implementing redaction or rendering a whole site just to get a skeleton. - SKILL.md: the authoring rubric + the scaffold -> author -> render --redact --open flow. References `patchstory schema` as the contract. - README.md: symlink/copy install, prerequisites (Linux/macOS, node/git/gh). The top-level README's "Author the story with your own AI agent" section now links here; the recipe is agent-agnostic, this is the turnkey reference impl. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Releases the agent-authoring CLI primitives (--scaffold/--emit-diff, schema, and the render --redact fix) to npm. publish.yml publishes packages/cli on a GitHub Release via OIDC; npm refuses to re-publish 0.1.2, so the bump is required. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Lets users install with the marketplace instead of a manual symlink:
/plugin marketplace add russ/patchstory
/plugin install patchstory@russ-patchstory
- .claude-plugin/marketplace.json (repo root) catalogs the plugin
(source: ./integrations/claude-code/patchstory).
- integrations/claude-code/patchstory/.claude-plugin/plugin.json manifest.
- Move the skill into the plugin skill layout: skills/patchstory/{SKILL.md,
scripts/collect.sh} (history preserved via git mv).
- SKILL.md resolves its helper via $CLAUDE_PLUGIN_ROOT with manual-install
fallbacks, since CLAUDE_PLUGIN_ROOT isn't guaranteed for model-run Bash.
- READMEs document the plugin install (primary) and manual symlink.
Validated with `claude plugin validate .` (passed).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make PatchStory's core thesis — the AI-authored story is separate from the renderer — a first-class workflow, so any coding agent (not just the built-in
anthropicadapter) can author the walkthrough. The agent reads the diff in repo context, so the narrative is better than a one-shot API call, and no API key is involved.CLI primitives (
836b4d9)--scaffoldon the source commands (diff/commits/file/github) emits the editablepr-walkthrough.json(the IR) instead of rendering a site — to a file (-o) or stdout. Implemented as a flag, symmetric with--single-file/--zip, so it reuses all source detection.--emit-diff <file>(with--scaffold) also writes the exact resolved diff bytes, so the same input can be passed torender --diffwith hunk line refs still aligned.schemacommand prints the canonicalWALKTHROUGH_JSON_SCHEMAfor validation.render --redact— it was a no-op: redaction only ran insidebuildWalkthrough(the source paths), never inrenderCommand, which parses the--difffile itself. It now callsredactParsedDiffon the parsed diff, so secrets are masked in the embedded output and the "masked N lines" count is truthful.Adds
tests/cli.test.ts(spawns the built bundle; skips if unbuilt — CI builds first) covering schema output, scaffold validity + byte-identical--emit-diff, and therender --redactmasking as a regression guard.Claude Code skill (
db8063b)integrations/claude-code/ships a ready-to-install skill that runs the flow: resolve source →patchstory scaffold --emit-diff→ Claude authors the narrative →render --redact --single-file --open. The new primitives keep it thin (no re-implemented redaction, no scaffold hacks). The top-level README's "Author the story with your own AI agent" section documents the agent-agnostic recipe and links here.Verification
npm run build && npm run typecheck && npm test— 23/23 green. Exercised end-to-end in bothgithubanddiffmodes.🤖 Generated with Claude Code