Skip to content

fix: honor logged-in env for api-url, stop live menu leak, fix --env docs#18

Merged
riglar merged 2 commits into
devfrom
fix/feature-sweep-15-16-17
Jun 16, 2026
Merged

fix: honor logged-in env for api-url, stop live menu leak, fix --env docs#18
riglar merged 2 commits into
devfrom
fix/feature-sweep-15-16-17

Conversation

@riglar

@riglar riglar commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #15, #16, #17 — found during a full feature sweep of v5.0.0 against the dev environment.

Changes

#16 — session commands ignored the env stored by dcd login

cloud/upload/list/status/artifacts/live defaulted --api-url to prod and ignored the api_url stored at login, so a dev/staging Bearer token was sent to prod and rejected with a misleading "Invalid or expired JWT". switch-org already guarded against this with a hand-rolled fallback.

  • Added resolveApiUrl(flag) in utils/config-store.ts with precedence explicit flag → stored config.api_url → prod.
  • Removed the hard-coded prod default from apiFlags['api-url'] so explicit-vs-default is distinguishable.
  • Routed all six commands through the helper; switch-org now uses it too (dedupes its copy).
  • API-key users (no stored config) still default to prod — unchanged.

#15dcd live <subcommand> printed the parent menu afterwards

citty invokes a parent command's run after dispatching to a subcommand, and liveCommand defines both subCommands and a run that prints the menu. run now returns early when the first positional in rawArgs is a subcommand name (the same "first non-flag arg" rule citty uses to dispatch, so it can't disagree with what citty actually ran).

Also fixes the systemic doubled wording in ApiGateway.handleApiError — operation strings are phrased "Failed to …" while the default branch appended " failed:", yielding e.g. Failed to execute test failed: …. Now Failed to execute test: ….

#17--env documented as a file path

The flag parses KEY=VALUE pairs but was described as "environment variable files" with valueHint: 'path'. Corrected the description and valueHint to KEY=VALUE.

Tests

  • New resolveApiUrl precedence suite (explicit > stored > prod, blank flag handling).
  • New live command menu suite (bare live shows the menu; every subcommand suppresses it).
  • Full suite: 128 passing (was 122). Lint 0 errors, typecheck clean.

🤖 Generated with Claude Code

…docs

Fixes three issues found during a full feature sweep of v5.0.0:

- #15: `dcd live <subcommand>` printed the parent "Live Session Commands"
  menu after every subcommand, because citty invokes a parent command's
  `run` after dispatching to a subcommand. `liveCommand.run` now returns
  early when the first positional matches a subcommand name (same rule
  citty uses to dispatch). Also fixes the systemic doubled error wording
  ("Failed to execute test failed: ...") in ApiGateway.handleApiError.

- #16: session commands defaulted --api-url to prod and ignored the
  api_url stored by `dcd login`, so a dev/staging Bearer token was sent
  to prod and rejected as "Invalid or expired JWT". Added resolveApiUrl()
  (explicit flag > stored config.api_url > prod) and routed cloud, upload,
  list, status, artifacts and live through it. switch-org now uses the
  shared helper instead of a hand-rolled copy.

- #17: --env was described as "environment variable files" (valueHint:
  path) but actually parses KEY=VALUE pairs. Corrected the description
  and valueHint.

Adds 6 unit tests covering resolveApiUrl precedence and the live menu
behavior. Full suite: 128 passing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Jun 16, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

The `pnpm audit --audit-level moderate` CI step flagged three advisories in
transitive/direct deps (unrelated to the feature fixes):

- ws <8.21.0 (high, GHSA-96hv-2xvq-fx4p) via @supabase/realtime-js
- tar <=7.5.15 (moderate, GHSA-vmf3-w455-68vh)
- js-yaml <=4.1.1 (moderate, GHSA-h67p-54hq-rp68)

Extend the existing pnpm.overrides pattern to force patched versions:
ws 8.21.0, tar 7.5.16, js-yaml 4.2.0. `pnpm audit` is now clean; full
suite still 128 passing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Jun 16, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@riglar riglar merged commit 4fee5a6 into dev Jun 16, 2026
2 checks passed
@riglar riglar deleted the fix/feature-sweep-15-16-17 branch June 18, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dcd live <subcommand> prints the parent help menu after every subcommand

1 participant