Commit 4cb135d
authored
Require project IDs for CLI request scoping (#218)
## Summary
- document the global `--project` flag as accepting project IDs only
- use the Go SDK's typed `option.WithProjectID` client option
- align `KERNEL_PROJECT` examples with the merged API contract
## Why
`X-Kernel-Project-Id` is an ID selector on the merged API. Advertising
project names here can scope a command incorrectly or produce a
confusing not-found response. The typed SDK option also keeps client
configuration aligned with generated SDK behavior.
## Implementation
The request still carries the same `X-Kernel-Project-Id` header. This
changes the public CLI guidance and replaces the manually named header
option with the SDK's first-class project option.
## Verification
- `go test -short -timeout=2m ./...`
- `go vet ./...`
- `gofmt -l cmd`
- `git diff --check`
- crap4go: changed `resolveProjectSelection` CRAP 2.0; root `init` CRAP
5.8
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Small client-option refactor with equivalent header behavior; main
user-facing change is clearer docs that names are not valid for global
scoping.
>
> **Overview**
> **Global project scoping** (`--project` / `KERNEL_PROJECT`) is now
documented and intended for **project IDs only**, not names, matching
the API’s `X-Kernel-Project-Id` contract.
>
> Client setup switches from a manual `X-Kernel-Project-Id` header
option to the Go SDK’s **`option.WithProjectID`** (same header, typed
configuration). README and flag help text are updated accordingly,
including clarification that **`api-keys create --project-id`** is
separate from the global scoping flag. Tests use ID-style example
values.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
8f4d57d. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 3c77a11 commit 4cb135d
3 files changed
Lines changed: 8 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| |||
622 | 623 | | |
623 | 624 | | |
624 | 625 | | |
625 | | - | |
| 626 | + | |
626 | 627 | | |
627 | 628 | | |
628 | 629 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
| 83 | + | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
| 88 | + | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
0 commit comments