sp new --stdin: headless scratch capture from a pipe (#27) - #29
Merged
Conversation
9 tasks
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.
Closes #27
What changed
Adds a headless capture path to
sp newso scratchpatch can ingest content programmatically instead of always shelling out to$EDITOR:--stdin— read content from standard input (pipes, heredocs)--content "<text>"— one-liner content--from-file <path>— seed from an existing fileAny of these suppresses
$EDITOR. Exactly one source per invocation (conflicts error out). Interactivesp newis unchanged when none are set.Implementation
store.WriteContentseeds a scratch's content file and refreshes recorded size (reuses the existing create/index/live-path machinery).captureContenthelper gathers + validates the source; TTY-with-no-pipe on--stdinrefuses rather than hanging;--content ""is a deliberate empty scratch.sp ls's live secret scan flags piped-in credentials with 🔑 andsp promoteguards them — same as editor scratches. No metadata/source-of-truth changes.Acceptance criteria
--stdinreads stdin, no$EDITOR--ttl/--ext/--tag--contentand--from-filecompanions--contenthandled deliberately (empty scratch)created scratch <id>anchor preservedsp ls)--stdinon a bare TTY doesn't hang (refuses)go build/go vet/go test ./.../gofmtcleanTesting
go build ./...,go vet ./...,gofmt -l(clean),go test ./...all green; manual smoke test of pipe capture,--content, and the 🔑 marker on a piped secret.