You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[feature] sp new --stdin / quick-capture from a pipe (headless scratch creation) #27
Today sp new always shells out to $EDITOR — perfect for interactive use, useless in a pipeline or from another tool/AI agent. There's no way to say "take this text and stash it as a scratch" without a human opening an editor. Add a headless capture path so scratchpatch can ingest content programmatically:
pytest -q 2>&1| sp new failing-tests --stdin --tag ci
sp new note --stdin <<'EOF'remember to revoke that tokenEOF
curl -s https://api.example.com/thing | sp new resp --ext json --stdin
This turns scratchpatch into a sink for throwaway output (logs, API responses, generated snippets), which is squarely on-mission ("give every throwaway a home with an expiry") and directly serves the AI-agent-hygiene angle from PLAN.md — agents can park temp output in the reaped store instead of littering the repo.
Why it fits
Reuses the exact create/index path sp new already uses; only difference is content comes from stdin (or --content/--from-file) instead of an editor round-trip.
Composes with the existing secret tripwire: piped-in content should still get scanned so a secret gets flagged (🔑) at capture time.
Pure additive flag on an existing command; interactive sp new behavior unchanged when --stdin is absent.
Acceptance criteria
sp new [name] --stdin reads content from standard input and creates the scratch without launching $EDITOR.
Honors existing --ttl, --ext, --tag flags on the same invocation.
Sensible companions: --content "<text>" for a one-liner and/or --from-file <path> to seed from an existing file (pick at least --stdin; the others are nice-to-have if cheap).
Empty stdin is handled deliberately (either refuse with a clear message or create an empty scratch — document the choice).
On success, prints the same tombstone-flavored confirmation as interactive sp new (still leads with the stable created scratch <id> anchor so scripts/tests keep working).
Newly captured content is run through the secret scanner so sp ls shows the 🔑 marker and sp promote guards it, same as editor-created scratches.
--stdin + a TTY with no piped input doesn't hang forever (guard/allow but document).
Tests cover: stdin capture, flag combos, secret detection on piped content, and that $EDITOR is not invoked. go build/go vet/go test ./.../gofmt clean.
README documents the headless/pipe workflow with examples.
Opened #29 with the headless capture path (--stdin / --content / --from-file, editor-suppressed, secret-scanned, TTY-hang-guarded). Leaving merge to the next triage cycle once CI is green.
Activity
rwrife commentedon Jul 10, 2026
Opened #29 with the headless capture path (
--stdin/--content/--from-file, editor-suppressed, secret-scanned, TTY-hang-guarded). Leaving merge to the next triage cycle once CI is green.Add headless scratch capture: sp new --stdin/--content/--from-file (#27…