-
Notifications
You must be signed in to change notification settings - Fork 6
Add initial agents/claude tooling. #360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # Fetch OpenAPI Specification | ||
|
|
||
| ## Description | ||
|
|
||
| Use this skill when you need to look up details about the Oxide API, including: | ||
| - Finding endpoint definitions, paths, or HTTP methods | ||
| - Looking up schema/type definitions from the API spec | ||
| - Understanding request/response formats for API operations | ||
| - Investigating API changes or additions | ||
| - Comparing generated code against the source OpenAPI spec | ||
|
|
||
| ## Instructions | ||
|
|
||
| 1. Read the `VERSION_OMICRON` file to get the Omicron commit hash | ||
|
|
||
| 2. Check if a cached spec exists for this version: | ||
|
|
||
| ```bash | ||
| test -f /tmp/oxide-openapi-spec-{commit}.json && echo "cached" | ||
| ``` | ||
|
|
||
| If the file exists, skip to step 5 - the spec is already cached. Report that the cached spec is | ||
| being used. | ||
|
|
||
| 3. Use curl to get the symlink target (the versioned filename): | ||
|
|
||
| ```bash | ||
| curl -sL "https://raw.githubusercontent.com/oxidecomputer/omicron/{commit}/openapi/nexus/nexus-latest.json" | ||
| ``` | ||
|
|
||
| The response body contains the versioned filename (e.g., `nexus-2026010800.0.0-1844ae.json`) | ||
|
|
||
| 4. Download the actual OpenAPI spec: | ||
|
|
||
| ```bash | ||
| curl -sL "https://raw.githubusercontent.com/oxidecomputer/omicron/{commit}/openapi/nexus/{versioned-filename}" -o /tmp/oxide-openapi-spec-{commit}.json | ||
| ``` | ||
|
|
||
| 5. Report what you found: | ||
| - The Omicron commit version | ||
| - Whether the spec was fetched fresh or loaded from cache | ||
| - Confirm the spec is available at `/tmp/oxide-openapi-spec-{commit}.json` | ||
|
|
||
| 6. The spec is now available at `/tmp/oxide-openapi-spec-{commit}.json` for further analysis | ||
|
|
||
| ## Optional Arguments | ||
|
|
||
| If the user provides arguments like: | ||
|
|
||
| - `--endpoint <name>` or `endpoint <name>`: Search for and display details about a specific endpoint | ||
| - `--schema <name>` or `schema <name>` or `type <name>`: Search for and display a specific | ||
| schema/type definition | ||
| - `--search <term>`: Search endpoints and schemas for the given term | ||
|
|
||
| Use `jq` or read the temp file to fulfill these queries. | ||
|
|
||
| ## Output Format | ||
|
|
||
| - **Default to YAML** when displaying schemas or endpoint details (use `yq` or `jq ... | yq -P`) | ||
| - Only use JSON or table format if the user explicitly requests it (e.g., `--json` or `--table`) | ||
|
|
||
| ## Notes | ||
|
|
||
| - The spec is large (~2MB JSON), so summarize rather than output the entire thing | ||
| - If fetching fails, suggest checking if VERSION_OMICRON contains a valid commit hash | ||
| - Reference `internal/generate/main.go:getOpenAPISpecURL` for the canonical implementation |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../.agents/skills |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "proseWrap": "always", | ||
| "printWidth": 100 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # AGENTS.md | ||
|
|
||
| This file provides context for AI coding assistants working on this codebase. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| **oxide.go** is the official Go SDK for administrating an Oxide rack. It's an OpenAPI-generated | ||
| client library providing programmatic access to the Oxide infrastructure management API. | ||
|
|
||
| ## Build and Test Commands | ||
|
|
||
| ```bash | ||
| make all # Run fmt, lint, test, staticcheck, vet | ||
| make test # Run tests | ||
| make lint # Run golangci-lint | ||
| make generate # Regenerate SDK from OpenAPI spec | ||
| ``` | ||
|
|
||
| Note: prefer to run make targets like `make generate` over one-off `go generate` or `go run` | ||
| commands. The make targets include additional steps and context that are needed for correct | ||
| behavior. | ||
|
|
||
| Note: unless otherwise specified, we should update generated code and run unit tests before | ||
| considering a change complete. | ||
|
|
||
| ## Key Patterns | ||
|
|
||
| ### Code Generation | ||
|
|
||
| The SDK is generated from the Oxide API's OpenAPI specification: | ||
|
|
||
| - Source spec version tracked in `VERSION_OMICRON` | ||
| - Generator in `internal/generate/` | ||
| - Templates in `internal/generate/templates/` | ||
| - **Do not manually edit** `types.go`, `paths.go`, `responses.go`, or `version.go` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Late to the party, but I was actually wondering about it the other when I was prototyping splitting these files into groups if it would be better to add a prefix (like
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know we discussed this a bit on our sync this week but I wanted to comment here as well. We should feel free to make changes that enable better AI processing. Things like renaming files to |
||
|
|
||
| ### Finding the OpenAPI Specification | ||
|
|
||
| To fetch the upstream OpenAPI spec manually: | ||
|
|
||
| 1. Read `VERSION_OMICRON` to get the Omicron commit hash (e.g., `06c0808`) | ||
| 2. Fetch | ||
| `https://raw.githubusercontent.com/oxidecomputer/omicron/{commit}/openapi/nexus/nexus-latest.json` | ||
| 3. This file is a symlink - the response body contains the versioned filename (e.g., | ||
| `nexus-2025120300.0.0.json`) | ||
| 4. Fetch the actual spec at | ||
| `https://raw.githubusercontent.com/oxidecomputer/omicron/{commit}/openapi/nexus/{versioned-filename}` | ||
|
|
||
| See `getOpenAPISpecURL` in `internal/generate/main.go` for the full implementation. | ||
|
|
||
| For local testing, set `OPENAPI_SPEC_PATH` environment variable to use a local spec file instead. | ||
|
|
||
| **Skill:** The `fetch-spec` skill automatically fetches the spec and saves it to | ||
| `/tmp/oxide-openapi-spec.json`. Claude will use this skill automatically when looking up API | ||
| details, or you can invoke it explicitly with `/fetch-spec endpoint disk` or | ||
| `/fetch-spec schema Instance`. | ||
|
|
||
| ## Code Style | ||
|
|
||
| - Mozilla Public License headers on all files | ||
| - Run `make fmt` before committing | ||
| - Run `make lint` to check for issues | ||
| - Unexported functions/constants by default | ||
| - Clear godoc comments on public APIs | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice overview!