$npx -y skills add lathe-cli/lathe --skill lathe-releaseRun Lathe release validation and publishing workflows. Use when the user asks to prepare, validate, cut, tag, publish, or ship a Lathe versioned release; runs the captured pre-release regression gate before tagging.
| 1 | # Lathe Release |
| 2 | |
| 3 | ## Contract |
| 4 | |
| 5 | Start read-only. Read repo-local instructions first: `AGENTS.md`, `CLAUDE.md`, `CONTRIBUTING.md`, release docs, Makefile, CI, and release config. Trust live code/config over old docs. |
| 6 | |
| 7 | Default to validation only. Do not create tags, commits, pushes, PRs, or GitHub releases unless the user explicitly asks to cut/publish/release the target version. |
| 8 | |
| 9 | Require a concrete target version before any publish step. If the version is missing or conflicts with existing tags/releases, ask one question. |
| 10 | |
| 11 | Use ignored scratch paths for generated validation artifacts. Prefer `.local/regression-$VERSION/` and ignored release output such as `dist/`. |
| 12 | |
| 13 | Use `rtk` for commands when available. If `rtk` blocks a command, run the command raw and report the fallback. |
| 14 | |
| 15 | ## Release Flow |
| 16 | |
| 17 | 1. Confirm target version and current baseline. |
| 18 | 2. Check worktree cleanliness and current branch. |
| 19 | 3. Fetch tags and verify the target tag does not exist locally or remotely. |
| 20 | 4. Read release workflow config and CI status for `HEAD`. |
| 21 | 5. Run the repo's declared local gate plus release-specific artifact dry-run. |
| 22 | 6. Run product-specific end-to-end smoke tests. |
| 23 | 7. Report `ready`, `blocked`, or `ready with skipped checks`. |
| 24 | 8. Only if explicitly asked to publish: create the tag, push it, then monitor the release workflow. |
| 25 | |
| 26 | Never claim a release is ready without fresh command output from this run. |
| 27 | |
| 28 | ## Lathe Pre-Release Gate |
| 29 | |
| 30 | Use this section in `/Users/x/git/samzong/lathe` or another Lathe checkout. It captures the v0.4.3 regression shape and should evolve with Lathe's real release surface. |
| 31 | |
| 32 | ### Live State |
| 33 | |
| 34 | ```bash |
| 35 | git status --short --branch |
| 36 | git fetch origin --tags --prune |
| 37 | gh release list --limit 10 |
| 38 | git tag --list 'v*' --sort=-v:refname | head -20 |
| 39 | git ls-remote --tags origin "refs/tags/$VERSION" |
| 40 | gh run list --branch main --limit 6 --json databaseId,headSha,event,status,conclusion,workflowName,createdAt,updatedAt |
| 41 | ``` |
| 42 | |
| 43 | Set the baseline to the latest GitHub release tag unless the user gives another baseline. |
| 44 | |
| 45 | ```bash |
| 46 | BASELINE=$(gh release list --limit 1 --json tagName -q '.[0].tagName') |
| 47 | git log --oneline --decorate --no-merges "$BASELINE"..HEAD |
| 48 | git diff --stat "$BASELINE"..HEAD |
| 49 | git diff --name-only "$BASELINE"..HEAD |
| 50 | ``` |
| 51 | |
| 52 | Treat non-green `ci`, `codeql`, or `scorecard` on `HEAD` as a release blocker unless the user explicitly accepts the risk. |
| 53 | |
| 54 | ### Local Gates |
| 55 | |
| 56 | ```bash |
| 57 | make check |
| 58 | go test -race ./... |
| 59 | go build ./... |
| 60 | git diff --check |
| 61 | ``` |
| 62 | |
| 63 | Run uncached targeted tests for Lathe's release-sensitive surfaces. |
| 64 | |
| 65 | ```bash |
| 66 | go test ./internal/sourceconfig ./internal/specsync -count=1 |
| 67 | go test ./internal/codegen/render ./internal/overlay -count=1 |
| 68 | go test ./internal/codegen/backends/... -count=1 |
| 69 | go test ./pkg/runtime ./pkg/lathe -count=1 |
| 70 | ``` |
| 71 | |
| 72 | ### Candidate Binary |
| 73 | |
| 74 | ```bash |
| 75 | ROOT=".local/regression-$VERSION" |
| 76 | rm -rf "$ROOT" |
| 77 | mkdir -p "$ROOT/bin" |
| 78 | COMMIT=$(git rev-parse --short HEAD) |
| 79 | DATE_UTC=$(date -u +%Y-%m-%dT%H:%M:%SZ) |
| 80 | go build -trimpath -ldflags "-X github.com/lathe-cli/lathe/pkg/lathe.Version=$VERSION -X github.com/lathe-cli/lathe/pkg/lathe.Commit=$COMMIT -X github.com/lathe-cli/lathe/pkg/lathe.Date=$DATE_UTC" -o "$ROOT/bin/lathe" ./cmd/lathe |
| 81 | "$ROOT/bin/lathe" version |
| 82 | CATALOG_SCHEMA=$(awk '/const CatalogSchemaVersion =/{print $4}' pkg/runtime/catalog.go) |
| 83 | REPO=$(pwd) |
| 84 | ``` |
| 85 | |
| 86 | ### Generated CLI E2E |
| 87 | |
| 88 | Copy examples into scratch and rewrite their module replacement to the live checkout. |
| 89 | |
| 90 | ```bash |
| 91 | for EX in petstore richapi graphql; do |
| 92 | cp -R "examples/$EX" "$ROOT/$EX" |
| 93 | rm -rf "$ROOT/$EX/internal/generated" "$ROOT/$EX/skills" "$ROOT/$EX/bin" "$ROOT/$EX/go.sum" |
| 94 | (cd "$ROOT/$EX" && go mod edit -replace github.com/lathe-cli/lathe="$REPO") |
| 95 | done |
| 96 | ``` |
| 97 | |
| 98 | Petstore proves OpenAPI codegen, overlay shortcut, catalog, search, show, and schema. |
| 99 | |
| 100 | ```bash |
| 101 | cd "$ROOT/petstore" |
| 102 | ../bin/lathe codegen -cache fixtures -overlay overlays |
| 103 | go mod tidy |
| 104 | go build -trimpath -o bin/petstore ./cmd/petstore |
| 105 | ./bin/petstore --help | grep -F -- "pet-123" >/dev/null |
| 106 | ./bin/petstore commands --json | jq -e --argjson schema "$CATALOG_SCHEMA" '.catalog_schema_version == $schema and (.commands[] | select(.path == ["pets","get"] and .http.method == "GET" and .http.path_template == "/pets/{id}" and .shortcuts[0].use == "pet-123"))' >/dev/null |
| 107 | ./bin/petstore commands show pets get --json | jq -e '.path == ["pets","get"] and (.flags[] | select(.name == "id" and .required == true))' >/dev/null |
| 108 | ./bin/petstore commands schema --json | jq -e --argjson schema "$CATALOG_SCHEMA" '.catalog_schema_version == $schema' >/dev/null |
| 109 | ./bin/petstore search pet --json | jq -e 'length > 0' >/dev/null |
| 110 | cd "$REPO" |
| 111 | ``` |
| 112 | |
| 113 | Richapi proves pagination, non-JSON body, body file help, long-running wait help, public auth, streaming hints, and search. |
| 114 | |
| 115 | ```bash |
| 116 | cd "$ROOT/richapi" |
| 117 | ../bin/ |