Skip to content

feat(cli): surface project environment in config and doctor#93

Merged
nibzard merged 1 commit into
mainfrom
niko/projects
Jun 12, 2026
Merged

feat(cli): surface project environment in config and doctor#93
nibzard merged 1 commit into
mainfrom
niko/projects

Conversation

@nibzard

@nibzard nibzard commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Users had no way to tell from the CLI which project (environment) their API key is scoped to, or whether it's production. The API exposes this via GET /v1/projects (name, slug, isProduction), so this PR surfaces it in the two places users ask "where am I pointed?":

  • steel doctor — new "Project" check after auth:

    Auth
      ✓ API key valid
    Project
      ✓ Project "Default project" (default) — development
    

    Fetched concurrently with the existing auth probe (no added latency) and silently skipped on any error, so an informational check can never degrade doctor's overall status. JSON mode carries {project_id, name, slug, is_production} in the check detail.

  • steel config — prints project: Default project (default) and environment: development. Best-effort with a 2s timeout and graceful skip (offline, local mode, or no key), so the command stays instant and usable offline.

Implementation notes

  • New src/api/projects.rs owns the /projects binding, response parsing, and current-project resolution: a single project wins outright; among several, a sole isDefault wins; ambiguity resolves to nothing rather than a guess.
  • src/api/generated.rs is untouched — the long-term home for this binding is tagging GET /projects with x-steel-cli in the API's OpenAPI spec and regenerating.
  • Local mode skips the lookup entirely (no cloud project exists).

Testing

  • 17 new tests (parsing, resolution, env label, wiremock round-trip, doctor check construction), full suite green.
  • Verified live against api.steel.dev: steel config, steel doctor --preflight (text + --json).

🤖 Generated with Claude Code

Users had no way to tell which project (environment) their API key is
scoped to, or whether it is production. The API exposes this via
GET /projects (name, slug, isProduction), so:

- add src/api/projects.rs: /projects binding, response parsing, and
  current-project resolution (single project wins; among several, a
  sole default wins; ambiguity resolves to nothing rather than a guess)
- steel doctor: new "Project" check after auth, fetched concurrently
  with the auth probe and silently skipped on error so doctor never
  degrades because of an informational check
- steel config: print project name/slug and environment label, best
  effort with a 2s timeout so the command stays usable offline

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@nibzard nibzard requested a review from junhsss June 12, 2026 09:07
@nibzard nibzard merged commit f1e476e into main Jun 12, 2026
9 checks passed
@nibzard nibzard deleted the niko/projects branch June 12, 2026 09: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.

1 participant