feat: add CLI read-only mode (--read-only / REDMINE_READ_ONLY / read_only)#137
Merged
Merged
Conversation
Show the read-only flag in 'redmine config' (table and JSON), name all three activation sources in the ErrReadOnly message, fix the --read-only help text (OPTIONS is also allowed), and extend test coverage to PUT, DELETE, raw PATCH, and the config-file-only and env-disables-config precedence paths.
Add a read-only mode section to the configuration guide (flag, env var, per-profile setting, precedence), list --read-only and REDMINE_READ_ONLY in the flag and env tables, and cross-reference the HTTP-layer guarantee from the AI agents guide.
Owner
|
Thanks for opening the PR, I have released it with https://github.com/aarondpn/redmine-cli/releases/tag/v2.10.0 |
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.
Summary
Adds an opt-in read-only mode to the CLI, complementing the read-only gating that already exists in the MCP layer. When enabled, any mutating HTTP request is refused before it is sent, so the tool can be pointed at a production Redmine for safe browsing/scripting.
How it works
readOnlyTransportRoundTripper): onlyGET/HEAD/OPTIONSpass; anything else returnsErrReadOnlywithout hitting the network. A single choke point means new commands are covered automatically.--read-onlyglobal flagREDMINE_READ_ONLYenvironment variableread_only:in the config fileTests
internal/api/read_only_test.go— transport refuses mutating methods, allows reads.internal/cmdutil/factory_test.go— flag/env/config precedence.internal/config/config_test.go—REDMINE_READ_ONLYoverride.go build,go vet,gofmt, and fullgo test ./...all pass on top of currentmain(including #134/#135).Notes
The docs site (
docs/) is not updated in this PR — happy to add a page if you'd like it.