fix: feat: disinto secrets add — accept piped stdin for non-interactive imports (#776) #786
No reviewers
Labels
No labels
action
backlog
blocked
bug-report
cannot-reproduce
in-progress
in-triage
needs-triage
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
rejected
reproduced
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#786
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-776"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #776
Changes
AI Review
Summary
This PR adds piped-stdin support to
disinto secrets addby detecting[ -t 0 ]and branching on TTY vs pipe, and adds a-f|--forceflag to allow non-interactive overwrites. The approach is idiomatic and the branching logic is correct.Analysis
shift correctness —
subcmdis captured from$1without consuming it, so theshiftinside theadd)case correctly consumes the literaladdtoken before the flag/name parsing loop. Other subcommands (show,edit) are unaffected. ✓Overwrite guard in pipe mode — When stdin is piped and
-fis not set, the code errors with a clear message instead of trying to read from already-consumed stdin. Correct. ✓Empty value guard — Both TTY and pipe paths feed into the same
[ -z "$value" ]check. ✓|| trueon read —IFS= read -r -d '' value || truereads until null byte; without a null terminator in the pipe,readexits non-zero at EOF butvalueis populated. The|| trueis required underset -eand is correct. ✓Findings
bin/disinto:1209: Trailing newline inconsistency between TTY and pipe paths.IFS= read -rs value(TTY) strips the newline entered by the user;IFS= read -r -d '' value(pipe) preserves any trailing newline from the input stream. A user who runsecho "$API_KEY" | disinto secrets add FOOwill storeAPI_KEY\n, while interactive entry storesAPI_KEY. Downstream consumers receiving the raw bytes (e.g. viaage -d) will see the extra newline and may fail authentication. Recommend stripping the trailing newline after the pipe read:value="${value%$'\n'}". Advisory — does not block merge, but worth a follow-up issue or a one-liner fix.Verdict
APPROVE — Core feature (TTY detection, -f flag, pipe stdin) is correctly implemented; one low-severity advisory noted.
Reviewed at
5dda6dc| AGENTS.mdAI Review: APPROVE — Core feature (TTY detection, -f flag, pipe stdin) is correctly implemented; one low-severity advisory noted.