# Changelog

All notable user-facing changes to `@google/stitch` (the `stitch` CLI, the `stitch-mcp` server and the SDK) are documented in this file. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). While the version is below 1.0, minor versions may include breaking changes; they are always listed first.

## [0.12.1] - 2026-10-29

`0.12.1` hardens CLI exit codes, `--schema` introspection, screenshot downloads, multi-screen design/variant/edit reporting, JSONC editor config support in `stitch mcp install`, and Canvas/OAuth reliability, alongside startup and cache performance wins.

### Behaviour changes
- **Exit codes:** CLI usage and argument syntax errors (unknown flags, missing required arguments, invalid format/JSON payloads, and unsupported `--schema` resources) now exit with POSIX code `2` instead of `1`. Operational, network, and API errors continue to exit with `1`. <!-- #493 #499 -->

### Features
- **Connections:** `stitch create connection` now accepts `--provider <id>` or a positional `<provider>` argument (e.g. `stitch create connection slack -w <ws>`), suggests working providers in help, explains unknown provider IDs with a pointer to `find connections`, and rejects conflicting or duplicate providers. <!-- #458 #466 #467 #468 #469 #470 #472 #473 #478 #479 -->
- **Schema & Help Introspection:** Root `stitch --schema` (and `stitch --schema --json`) now outputs a machine-readable JSON Schema catalog of top-level commands, per-resource `create <resource> --help` filters out unrelated resource flags, `--json` flag descriptions are standardized across commands, and experimentally gated commands appear in root and `enable` help. <!-- #480 #481 #484 #494 #495 #499 -->

### Fixes
- **Downloads:** Screenshots fetched from legacy Google image CDNs now download at full `=s0` resolution instead of 512px thumbnails, detect actual PNG/JPEG/WebP MIME types from magic bytes, default directory outputs to `.jpg` for JPEG screenshots, and warn when a requested file extension does not match the image payload. <!-- #462 #485 -->
- **Design, Variants & Multi-Screen Edits:** `stitch upload design --apply` now applies the design system to every screen when `--screen` is omitted, validates `--screen` IDs before creating the design system, and reports all resulting screen IDs; `stitch generate variants` lists every new variant screen with its ID and Canvas link; and `stitch edit screen` with multiple screen IDs reports all source and resulting screen IDs (`sourceScreenIds`, `resultScreenIds`). <!-- #446 #447 #490 #497 #504 -->
- **MCP & Agent Skills:** `stitch mcp install` now parses editor configs containing comments and trailing commas (`~/.gemini/settings.json`, VS Code `mcp.json`) while preserving comments and avoiding half-applied multi-editor installs. `stitch agent-skills add` installs plain runs only into `.agents/skills`, scopes `--target` to the project unless `--user` is passed, and preserves Antigravity skills in the directory Antigravity reads. <!-- #453 #454 #456 #474 #503 -->
- **API & Webhooks:** `stitch api` resolves Discovery method IDs (such as `stitch api workspaces.list` and `stitch api GET /workspaces`) in both execution and `--schema`, accepts `-w` / `--workspace` to satisfy `workspacesId`, and `stitch edit webhook` rejects immutable `url` edits client-side (`IMMUTABLE_FIELD`) and omits `url` from `--schema`. <!-- #461 #487 #488 -->
- **Auth & Security:** OAuth configuration persists and falls back to saved `client_id` and `client_secret` across sessions, and v2 transport errors mask echoed API keys. <!-- #450 #457 #486 -->
- **Canvas & SDK Reliability:** Canvas retries now apply only to rate-limited writes (skipping daily quota exhaustion, `ECONNREFUSED`, and `ENOTFOUND`), cap retry delays, surface real 5xx HTTP status codes and failing URLs, and prevent unhandled rejections in `workspace.batch`. <!-- #452 #455 #475 #491 #492 -->
- **CLI Polish, Capture, Feedback & Loop:** `-f` is now accepted for `--format` on `upload screen`, `delete`, `status`, `config`, and `feedback` (while bare `delete -f` points to `--yes`); early usage errors respect saved `output.format` config; `stitch capture` routes non-`http(s)` URLs cleanly; `stitch feedback` reads multi-word messages after an optional `submit` keyword and formats auth/network errors; `stitch create workspace` trims and rejects blank names; `stitch loop link` rejects missing `--project` instead of consuming flag values; and exit warnings only fire on lost cache writes while background notification refreshes back off cleanly. <!-- #448 #449 #451 #463 #464 #465 #483 #498 #505 #506 -->

### Performance
- **Startup, Cache & Queries:** Deferred heavy Node built-in imports off the CLI startup path, parallelized disk cache inventory/prune and `stitch status` facets, precomputed `find` sort keys, and switched ZIP CRC32 calculation to native `zlib.crc32`. <!-- #460 #471 #476 -->

## [0.12.0] - 2026-10-21

`0.12.0` makes `--help` and startup faster, makes the local cache reliable (writes now finish before exit, and `--no-cache` works), adds authenticated screen downloads, and hardens argument validation, capture and auth. If you script the CLI, read **Breaking changes** and **Behaviour changes** first.

### ⚠ Breaking changes
- **CLI / SDK:** The `stitch edit screen` command now returns the newly created screen's ID as `data.id` instead of the original source screen's ID. To help scripts track lineage, the JSON response now also includes explicit `sourceScreenId` and `resultScreenId` fields. Scripts parsing `edit` output should expect `id` to match the new revision. <!-- #347 -->

### Behaviour changes
These don't affect interactive use, but scripts may need updating.
- **Delete:** `stitch delete` now fails with `VALIDATION_ERROR` unless it runs in an interactive terminal or you pass `--yes` (or `--force`). Add `--yes` to `delete` calls in scripts and CI. <!-- #436 #354 -->
- **Argument validation:** Unparseable numbers (e.g. `--limit banana`) and unknown `--format` values are now rejected instead of silently falling back to defaults. `stitch generate` rejects flags that don't apply to the resource, such as `screen --title` without `--new-project`. <!-- #343 #338 -->
- **Workspace-qualified IDs:** A resource name like `workspaces/A/insights/i1` passed with `-w B` is now rejected instead of acting on workspace `B`. <!-- #346 -->
- **Loop filters:** `find` filters are validated before querying, and inequality filters no longer match resources where the field is unset. <!-- #242 -->

### Features
- **Canvas links:** Set `STITCH_CANVAS_URL` (for example `https://stitch-beta.withgoogle.com`) to point every generated Stitch Canvas link at another Stitch web host: `stitch url`, `stitch open`, `generate`, `edit`, `upload screen`, the TUIs and MCP `stitch_url`. Without it, links keep using `https://stitch.google.com`. <!-- canvas-url override -->
- **CLI:** The `stitch create workspace` command now accepts a `--name` flag. <!-- #312 -->
- **CLI:** The `stitch agent-skills add` command now accepts a `--target` flag to install skills for a specific AI client (e.g. `claude-code`, `antigravity`, `gemini-cli`) instead of all detected clients at once. <!-- #365 -->
- **Caching:** Improved disk caching reliability and manageability. The CLI now waits for background cache writes (and notification refreshes) to finish before exiting, sweeps stale temporary files, processes list entries concurrently, and correctly honors `--no-cache`. It also adds new `stitch cache stats` and `stitch cache prune` commands for manual cache management. <!-- #392 #394 #396 #397 #429 #431 #432 -->
- **Downloads:** `stitch download screen` fetches a screen's HTML or full-size PNG using your CLI credentials (API key or OAuth), and `stitch serve` renders screens and screenshots the same way. `generate` and `edit` now print a Stitch Canvas link instead of a raw download URL. <!-- #430 -->
- **Connections:** Built-in integrations that need no sign-in (such as Web Search) are activated directly by `stitch connect` and `create connection`, with no browser step. Built-in OAuth integrations start their OAuth flow, and third-party catalog integrations (Slack, Jira, …) keep using a browser connect link. <!-- #437 -->

### Fixes
- **Auth & Login:** Addressed several login flow edge cases. The CLI now prevents concurrent token refreshes, handles OAuth state validation errors gracefully, reuses existing sessions during loop setup, offers better hints when encountering `EADDRINUSE` port conflicts, and properly gates workspace prompts. <!-- #333 #336 #352 #356 #372 -->
- **Generation:** The `stitch generate` command now enforces correct flag combinations for specific resources, rejecting invalid combinations like passing `--title` without `--new-project`. <!-- #338 #375 -->
- **Canvas / SDK:** Normalized Canvas project IDs across `find`/`get`/`create` operations, enforced proper Canvas credential precedence, and made `create connection` prefer an exact provider ID over a display-name match (so `slack` connects Slack, not Slackbot). <!-- #340 #349 #350 #362 #439 -->
- **Capture:** The `stitch capture` command now reliably fails on bad schemes or fragment navigation, bounds browser waits to prevent hangs on unresponsive assets, properly inlines complex assets (like `@import`, `srcset`, and SVG `href`), and supports nested React Router routes. <!-- #351 #355 #358 #405 -->
- **Serve & Upload:** Addressed serving and uploading inconsistencies. The CLI now honors Git ignore files (`.gitignore` and `.git/info/exclude`) during uploads, surfaces screen listing errors, renders `DESIGN.md` as plain text, recovers hidden screens when `list_screens` is empty, and smoothly falls back on expired download URLs. <!-- #344 #345 #361 #367 #368 #369 #370 #435 -->
- **Core CLI:** Fixed the Loop TUI crashing on first render. Commands now fail fast on refused connections or unknown hosts instead of hanging for ~16 s under Node, home-directory resolution works when `HOME` is unset (e.g. on Windows), and every exit flushes pending work safely. <!-- #339 #343 #346 #348 #354 #360 #378 #395 #423 #427 #436 -->
- **Status & Discovery:** The `stitch status` command now accurately walks up to the Git root, checks actual file paths for design status, validates explicit workspace IDs, and reports clear loop authentication errors. <!-- #341 #363 #364 -->
- **Errors & Telemetry:** Error reporting is now clearer when the server returns an empty error body, correctly classifies quota and 5xx errors as recoverable, and preserves errors on unreachable GitHub status probes. <!-- #210 #211 #342 #357 -->
- **Agent Skills:** The `stitch agent-skills` command now reports prune and backup operations in JSON, verifies integrity during listing, and properly resets customized skills. <!-- #216 #353 #399 -->
- **Loop / Webhooks:** Validates Loop find filters before querying (avoiding unset-field inequality matches) and properly unwraps webhook verification responses to display accurate timestamps. <!-- #242 #331 -->

### Performance
- **CLI Startup:** Optimized CLI startup and command execution by enabling V8 compile caching via a launcher shim, lazy-loading subcommands and platform hooks, skipping unnecessary banner fetches in JSON mode, and computing static help metadata ahead of time. <!-- #319 #320 #326 #327 #438 -->
- **Files & Capture:** Sped up capture and file operations by parallelizing asset inlining with timeouts, prefetching tree content concurrently, optimizing disk cache I/O, and hardening watch directory syncs. <!-- #329 #332 #402 -->
- **Networking:** Capped Terms of Service checks at 5 seconds and memoized enforcement to reduce redundant network overhead. <!-- #321 -->

## [0.11.1] - 2026-10-08

### Features
- **Design:** `stitch upload design` now supports `--apply` and `--screen` flags, and suggests the next apply command. <!-- #316 -->
- **Telemetry & Secrets:** Attached active CLI command names to the Canvas User-Agent, and added scrubbing of local `.env` secrets and API tokens before snapshot uploads. <!-- #324 #325 -->
- **Canvas:** Wrapped the Stitch Canvas toolClient with exponential backoff retries. <!-- #314 -->
- **Feedback:** Added the `stitch feedback` command and a matching SDK method. <!-- #48 -->

### Fixes
- **Auth:** Auto-refreshes expired OAuth tokens upfront in `stitch status`, and refreshes server notifications while displaying disclaimers upon login. <!-- #313 #328 -->
- **Errors:** Classifies HTTP 429 and 5xx errors as recoverable, provides guidance on 403 scope errors, and ignores ambient `GOOGLE_CLOUD_PROJECT` to prevent misrouting. <!-- #315 -->
- **Upload:** Preserves the root `/` route, normalizes relative slugs, and correctly extracts Link/navigate routes during upload. <!-- #322 -->
- **Capture:** The `stitch capture` command now lists `--wait-for` in help, accepts empty `--auth` files, and explains redirects under `--auth`. <!-- #304 -->
- **CLI / Output:** Disabled ANSI formatting when output is piped or color is disabled, supported `--dry-run` and its JSON payload in the API, and stopped progress redraw artifacts. <!-- #203 #213 #303 -->
- **Connections:** Routed catalog toolkit connections to the toolkit connect link RPC. <!-- #317 -->

## [0.11.0] - 2026-10-01

- Initial beta npm release for `@google/stitch`.

