Repository navigation
fix(cli): accept /api paths, positional env pairs, and hint at login on 401 - #1130
Merged
Hydralerne merged 1 commit intoOct 11, 2026
Merged
Conversation
…on 401 `openship api /api/projects/<id>` requested /api/api/... because the client always prefixes /api; a leading /api segment is now stripped. `project env set <id> KEY=VALUE` failed with "too many arguments"; the pairs are now accepted next to --set. A 401 from a project command now adds "Run `openship login` first.", as server and service commands do. Fixes oblien#1023
Member
|
Great, thank you |
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
Fixes three of the CLI problems in #1023:
openship apino longer doubles the/apiprefix,project env setacceptsKEY=VALUEpairs as arguments, and project commands say to runopenship loginwhen the API answers 401.Motivation
api.tsalways puts the path under/api, soopenship api /api/projects/<id>(the path as the API routes name it) requested/api/api/projects/<id>and got404 Not Found.project env set <id> FOO=barfailed withtoo many arguments for 'set'. Expected 1 argument but got 2., because the command only took pairs through--set.Unauthorized. Theserverandservicecommands already say "Runopenship loginfirst."Related issue
Fixes #1023. Point 4 (
--local-path) is already explained in the option's help, so it isn't changed here.Changes
apps/clicommands/api.ts: a leading/apisegment is stripped before the client adds its own (/apiand/api/...only;/apisis left alone)./projects/x,projects/xand/api/projects/xnow all request/api/projects/x.apps/clicommands/project.ts:env settakes optional[pairs...], merged with--setand checked by the sameparsePairs;--setworks as before. The--secrethelp and the "Nothing to do" message mention the positional pairs.openship loginfirst."; other statuses print as before. Commands inproject-management.tsandproject-data.tsreport through the sharedfail()and are unchanged.apps/webcontent/docs/cli/reference/project/index.mdx: the generated reference forenv set, matching the new--help(checked against the repo's generator).apps/cli/test/e2e/api.test.tsandapps/cli/test/e2e/project.test.ts.Verification
Against a local API (
apps/apion port 4400, a project created withproject create --local-path …):project.ts,project.test.tsand the docs page already have Prettier drift upstream. The two changed lines inproject.tskeep that file's one-line style (theupsertsline was already this long), so I didn't runbun formatover them.Checklist
bun run test,bun run --cwd <workspace> lint, andbun formatall pass locally (CLI tests and lint pass; see the Prettier note above)