refactor: make objects set-access access a positional arg#101
Merged
Conversation
MantasMiksys
approved these changes
May 11, 2026
The `--access` flag was declared `required: true` on a spec option, which routes through `validateRequiredWhen` in `cli-core.ts`. That helper prints the error to stderr but doesn't `process.exit(1)`, leaving Node to exit 0. Other commands in the codebase that exit 1 on a missing required arg do so because the required arg is a positional — Commander's own missing-positional path exits 1. Make `access` a third positional, matching the codebase's pattern and `objects put`'s three-positional resolution shape: - `tigris objects set-access <bucket> <key> <access>` - `tigris objects set-access t3://my-bucket/my-file.txt public` Resolution mirrors `objects put`: when the first positional is a full `t3://bucket/key` path, the second positional becomes the access value and the third is omitted. The impl runtime-checks both for missing access and invalid value. Tests updated: - Old `--access public/private` invocations switched to positional - New case asserting t3:// path + positional access - New case asserting invalid-value path exits 1 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2aaa264 to
4b17e5f
Compare
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
Drop the
--accessflag in favor of a third positional. This makes the missing-required check actually exit1and lines the command up with how the rest of theobjectssubcommands work.Why
The
--accessflag was declaredrequired: trueon a spec option. That routes throughvalidateRequiredWhenincli-core.ts, which prints the error to stderr but doesn't callprocess.exit(1)— Node defaults to exit 0. The CI integration testobjects set-access > should error on missing --accessfailed for this reason after #100.Every other "X is required" assertion in the integration suite (
touch,cp,mv, etc.) succeeds because the required arg is a positional, and Commander's own missing-positional path exits with code 1. Following that pattern fixes the test naturally without touchingcli-core.ts.Changes
specs.yaml—accessmoved from option-style (alias: a,required: true) to a third positional withoptions: *access_optionsfor help text.src/lib/objects/set-access.ts— resolution mirrorsobjects put: if the first positional is at3://bucket/keypath, the second positional becomes the access value; otherwise the second is key and the third is access. Runtime checks for missing access and invalid value, both exiting 1 viafailWithError.test/cli.test.ts— old--access public/privateinvocations switched to positional; added cases for thet3://form, missing access (exit 1), and an invalid value (exit 1).Test plan
npm run lint,format:check,tsc --noEmitcleannpm test— 659 unit/spec tests passnpm run buildcleanbucket key public→ 0;t3://bucket/key public→ 0🤖 Generated with Claude Code