Repository navigation
Claude Code runs the guide, the check and schema sync without asking (#89) - #91
Merged
Merged
Conversation
… without asking (#89) `agent install` adds exact allow rules to .claude/settings.json for the four commands the instructions name: `envshield agent guide`, both checks and `envshield schema sync`. Never a prefix, never for Codex (its approval policy is per user). Existing permissions are kept. Claude Code applies a project's allow rules only after the folder is trusted, and `claude -p` never asks, so install also prints the same rules as an `--allowedTools` flag for unattended runs. Live run with the flag: Claude read the guide, declared the variable with a type, ran schema sync and both checks. Closes #89 (BL-206). Marks #63 (BL-192) merged in BACKLOG and AGENTS.md.
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 #89
In one line:
agent installlets Claude Code run the four commands the instructions name without a permission prompt, and prints a flag that does the same for unattended runs.Problem
In #63's live run, Claude needed approval to run
envshield agent guideand the check, so it skipped both. It relied on the hook alone and left outtypeand the.env.exampleupdate (BL-206).Design (maintainer decisions on #89)
agent installadds exact rules to.claude/settings.jsonpermissions.allow:Bash(envshield agent guide),Bash(envshield check --since HEAD --code-only --json),Bash(envshield check --json),Bash(envshield schema sync). No prefix rules. Added once; otherpermissionskeys and rules are kept, and a user'sdenystill wins. Malformedpermissionsleaves the file unchanged. Nothing is set for Codex: its approval policy is per user.claude -pnever shows it. A headless run in an untrusted folder still asked before each command. Option 1 (chosen): keep the rules for trusted interactive sessions, where the trust dialog lists them, and haveagent install(andinit's offer) print the same rules as--allowedTools "..."forclaude -pand CI. That flag needs no trust.Alternatives
Bash(envshield check:*)): rejected, wider than needed.Security
The rules cover read-only commands, plus
schema sync, which writes only.env.example, built from the schema with no secret values. They are exact strings, so a chained command (envshield check --json; curl ...) still prompts. Writes still go throughopen_for_write.Compatibility
Re-running
agent installon a #63 install adds the rules and keeps everything else.Tests
envshield/tests/test_agent_setup.py. They check that the rules are exactly the commands the instructions name (no wildcards); added once and kept beside the user'sallow/deny/ask/defaultMode; added to an older install; none for Codex; malformedpermissionsleaves the file unchanged; a declined hook replacement still adds the rules; the flag is printed.ruff checkandruff format --checkclean.Live runs (fixture project, recorded in BL-206)
claude -p --permission-mode acceptEditswith the rules in an untrusted folder: still asked before running the guide and the check. That's the trust limit above.--allowedTools <the four rules>: Claude ranagent guideand declaredSLACK_WEBHOOK_URLwithtype = "url",secret = trueand theservicesline. It ranschema sync(.env.exampleupdated) and both checks. The only prompts were for shell glue it chained on (echo,cat > app.py). No canary value in the transcript.~/.claude.json, which the session's safety check blocked.Product / market impact
Table stakes: it removes friction from the agent loop #63 set up.
🤖 Generated with Claude Code