Skip to content

Commit 23d4b9b

Browse files
fix: update CLI coverage workflow to perform full SDK method enumeration
The previous prompt only checked recent commits and vaguely asked to identify coverage gaps. This update makes the prompt explicit about: 1. Reading api.md as the authoritative source of ALL SDK methods 2. Reading param structs from Go files to enumerate ALL options/fields 3. Building an SDK coverage matrix (methods + params) 4. Building a CLI coverage matrix (commands + flags) 5. Performing gap analysis to find missing commands and flags 6. Mapping guidance for SDK param fields to CLI flags (CamelCase -> kebab-case) This ensures the agent does a complete enumeration rather than just checking what changed in the most recent commit. Co-authored-by: mason <mason@onkernel.com>
1 parent b6db773 commit 23d4b9b

1 file changed

Lines changed: 95 additions & 41 deletions

File tree

.github/workflows/update-cli-coverage.yml

Lines changed: 95 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -89,59 +89,103 @@ jobs:
8989
The Go SDK (this repo) was just updated by Stainless, and may contain new API methods. The CLI (kernel/cli) needs to be updated to expose these new methods as CLI commands.
9090
9191
# Source Files
92-
- SDK: Current directory - check for new/changed methods in the Go SDK
92+
- SDK api.md: Current directory - READ THIS FILE FIRST. This is the authoritative list of all SDK methods and their signatures.
93+
- SDK *.go files: Current directory - Contains param structs (e.g., BrowserNewParams, DeploymentListParams) with all available options/fields.
9394
- API Spec: /tmp/kernel-api/packages/api/stainless.yaml - SDK configuration with resources and methods
9495
- API Spec: /tmp/kernel-api/packages/api/openapi.yaml - Full OpenAPI specification
9596
- CLI: /tmp/kernel-cli - Existing CLI commands
9697
9798
# Task
98-
1. ALWAYS update the CLI to use the latest Go SDK version:
99-
- Go to /tmp/kernel-cli
100-
- Update go.mod to require the latest SDK: ${{ steps.sdk-version.outputs.module }}@${{ steps.sdk-version.outputs.version }}
101-
- Run: go get ${{ steps.sdk-version.outputs.module }}@${{ steps.sdk-version.outputs.version }}
102-
- Run: go mod tidy
103-
- This ensures the CLI always uses the latest SDK, even if no new commands are added
10499
105-
2. Check the recent commit(s) to this SDK repo to see what methods were added/changed:
106-
git log -1 --name-only
107-
git diff HEAD~1 --name-only
108-
109-
3. Read the stainless.yaml to understand the full resource/method structure
110-
111-
4. Check the CLI repo at /tmp/kernel-cli to see what commands already exist:
112-
- Look at cmd/ directory structure for existing commands
113-
- Identify which SDK methods have CLI command equivalents
114-
115-
5. Identify coverage gaps - SDK methods that don't have CLI equivalents, or new SDK method parameters that aren't exposed via the CLI
116-
117-
6. If new commands or flags are needed:
118-
- Implement them in /tmp/kernel-cli following existing patterns
119-
- Run \`go build ./...\` to verify the code compiles
120-
121-
7. Create and push changes (SDK version update + any new commands):
122-
- Create/update the evergreen branch: cli-coverage-update (always use this single branch name)
123-
- Commit with message describing SDK version bump and any new commands
124-
- Force push changes to the CLI repo (since we're updating an evergreen branch)
125-
- Create or update an evergreen PR in kernel/cli (check if PR already exists for this branch first)
126-
- Tag the commit author as a reviewer
127-
128-
8. If only SDK version was updated (no new commands), still update the evergreen PR with title 'CLI: Update Go SDK to <version>'
129-
130-
# Mapping Guide
131-
Use these mappings to implement CLI commands:
132-
- client.Resource.Create() -> kernel resource create
100+
## Step 1: Update SDK Version (ALWAYS DO THIS FIRST)
101+
- Go to /tmp/kernel-cli
102+
- Update go.mod to require the latest SDK: ${{ steps.sdk-version.outputs.module }}@${{ steps.sdk-version.outputs.version }}
103+
- Run: go get ${{ steps.sdk-version.outputs.module }}@${{ steps.sdk-version.outputs.version }}
104+
- Run: go mod tidy
105+
- This ensures the CLI always uses the latest SDK, even if no new commands are added
106+
107+
## Step 2: Full SDK Method Enumeration (CRITICAL - DO NOT SKIP)
108+
You MUST perform a complete enumeration of ALL SDK methods and their parameters. Do NOT rely only on recent commits.
109+
110+
2a. Read the api.md file in the SDK repo root. This file lists EVERY SDK method in the format:
111+
- \`client.Resource.Method(ctx, params)\` with links to param types
112+
Extract a complete list of all methods.
113+
114+
2b. For EACH SDK method, read the corresponding param type from the Go source files.
115+
For example:
116+
- BrowserNewParams in browser.go -> lists all fields like \`Proxy\`, \`Profile\`, \`Viewport\`, etc.
117+
- DeploymentNewParams in deployment.go -> lists all fields like \`AppName\`, \`Region\`, \`EnvVars\`, etc.
118+
Each field in a Params struct represents an option that could be a CLI flag.
119+
120+
2c. Build a complete SDK coverage matrix:
121+
| SDK Method | SDK Param Type | SDK Param Fields |
122+
|------------|----------------|------------------|
123+
| client.Browsers.New | BrowserNewParams | Proxy, Profile, Viewport, Extensions, ... |
124+
| client.Browsers.List | BrowserListParams | Limit, Offset, IncludeDeleted, ... |
125+
| client.Deployments.New | DeploymentNewParams | AppName, Region, EnvVars, ... |
126+
| ... | ... | ... |
127+
128+
## Step 3: Full CLI Command Enumeration (CRITICAL - DO NOT SKIP)
129+
Enumerate ALL existing CLI commands and their flags.
130+
131+
3a. Look at cmd/ directory structure for existing commands
132+
3b. For each command file, extract:
133+
- The command name/path (e.g., \`kernel browser create\`)
134+
- All flags defined for that command
135+
3c. Build a CLI coverage matrix:
136+
| CLI Command | CLI Flags |
137+
|-------------|-----------|
138+
| kernel browser create | --proxy, --profile, --viewport, ... |
139+
| kernel browser list | --limit, --offset, ... |
140+
| ... | ... |
141+
142+
## Step 4: Gap Analysis (CRITICAL - DO NOT SKIP)
143+
Compare the SDK matrix (Step 2) with the CLI matrix (Step 3) to identify:
144+
145+
4a. Missing commands: SDK methods with NO corresponding CLI command
146+
4b. Missing flags: SDK param fields with NO corresponding CLI flag
147+
4c. Create a gap report:
148+
## Missing Commands
149+
- client.Browsers.LoadExtensions -> needs \`kernel browser load-extensions\`
150+
- client.Proxies.Check -> needs \`kernel proxy check\`
151+
152+
## Missing Flags
153+
- BrowserNewParams.SomeNewField -> \`kernel browser create\` needs --some-new-field
154+
- DeploymentListParams.Status -> \`kernel deployment list\` needs --status
155+
156+
## Step 5: Implement Missing Coverage
157+
For each gap identified in Step 4:
158+
- Implement missing commands following existing patterns
159+
- Add missing flags to existing commands
160+
- Run \`go build ./...\` to verify the code compiles
161+
162+
## Step 6: Commit and Push
163+
- Create/update the evergreen branch: cli-coverage-update (always use this single branch name)
164+
- Commit with message describing SDK version bump and any new commands/flags
165+
- Force push changes to the CLI repo (since we're updating an evergreen branch)
166+
- Create or update an evergreen PR in kernel/cli
167+
168+
# SDK Method -> CLI Command Mapping Guide
169+
- client.Resource.New() -> kernel resource create
133170
- client.Resource.List() -> kernel resource list
134171
- client.Resource.Get() -> kernel resource get
135172
- client.Resource.Delete() -> kernel resource delete
136173
- client.Resource.Update() -> kernel resource update
137174
- client.Resource.Sub.Action() -> kernel resource sub action
175+
- client.Resource.CustomAction() -> kernel resource custom-action
176+
177+
# SDK Param Field -> CLI Flag Mapping Guide
178+
- CamelCaseField -> --camel-case-field
179+
- TimeoutSeconds -> --timeout-seconds
180+
- IncludeDeleted -> --include-deleted
181+
- Nested structs: Viewport.Width -> --viewport-width or separate flags
138182
139183
# Implementation Guidelines
140184
- Follow the existing CLI code patterns in /tmp/kernel-cli
141185
- Use cobra for command definitions
142186
- Use the Kernel Go SDK (this repo) for API calls
143-
- Include proper flag definitions with descriptions
144-
- Add help text for commands
187+
- Include proper flag definitions with descriptions matching SDK field comments
188+
- Add help text for commands matching SDK method comments
145189
- Handle errors appropriately
146190
- Match the style of existing commands
147191
@@ -161,28 +205,38 @@ jobs:
161205
## SDK Update
162206
- Updated kernel-go-sdk to ${{ steps.sdk-version.outputs.version }}
163207
164-
## New Commands/Flags
208+
## Coverage Analysis
209+
This PR was generated by performing a full enumeration of SDK methods and CLI commands.
210+
211+
## New Commands
165212
- \`kernel <resource> <action>\` for \`client.Resource.Action()\`
166213
214+
## New Flags
215+
- \`--flag-name\` for \`ResourceParams.FieldName\`
216+
167217
Triggered by: kernel/kernel-go-sdk@${{ github.sha }}
168218
Reviewer: @<commit_author>'
169219
170-
If only SDK version update (no new commands):
220+
If only SDK version update (no coverage gaps found):
171221
Title: 'CLI: Update Go SDK to ${{ steps.sdk-version.outputs.version }}'
172222
Body:
173223
'This PR updates the Go SDK dependency to the latest version.
174224
175225
## SDK Update
176226
- Updated kernel-go-sdk to ${{ steps.sdk-version.outputs.version }}
177227
228+
## Coverage Analysis
229+
A full enumeration of SDK methods and CLI commands was performed. No coverage gaps were found.
230+
178231
Triggered by: kernel/kernel-go-sdk@${{ github.sha }}
179232
Reviewer: @<commit_author>'
180233
181234
# Constraints
182235
- ALWAYS update the SDK version in go.mod - this is the primary purpose
183-
- Only implement genuinely missing CLI functionality for new commands
236+
- ALWAYS perform the full enumeration (Steps 2-4) - this is critical for finding gaps
237+
- Only implement genuinely missing CLI functionality
184238
- Internal/admin methods may not need CLI commands
185239
- Streaming methods may have different CLI implementations
186-
- Even if no new commands are needed, still create a PR for the SDK version bump
240+
- Even if no coverage gaps are found, still create a PR for the SDK version bump
187241
- Ensure code compiles before pushing
188242
" --model opus-4.5 --force --output-format=text

0 commit comments

Comments
 (0)