Skip to content

feat: add sanity skills install command to allow manual skills install#1292

Open
mwritter wants to merge 10 commits into
mainfrom
feat/aigro-5089
Open

feat: add sanity skills install command to allow manual skills install#1292
mwritter wants to merge 10 commits into
mainfrom
feat/aigro-5089

Conversation

@mwritter

@mwritter mwritter commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a standalone sanity skills install command so users can install (and refresh) Sanity agent skills for their detected AI editors at any time, not just during sanity init. Previously skills install only ran as part of init (bundled into the combined MCP + skills prompt) and there was no way to re-run it afterward, nor did sanity mcp configure cover skills. This command fills that gap while keeping skills logic cleanly decoupled from MCP setup.

The command is intentionally non-interactive: it forwards every detected editor that has a skills-CLI mapping straight to setupSkills, with no agent-selection prompt. Re-running is idempotent — skills add ... -g -y overwrites the skill files in place, so running sanity skills install again updates already-installed skills to the latest version.

AIGRO-5089

What to review

  • New MCP-free orchestrator + command (actions/skills/configureSkills.ts, commands/skills/install.ts) — configureSkills dedupes the detected editors' skills-CLI agents and forwards all of them to setupSkills; no prompt and no installed-state filtering, since re-installs are intentional and idempotent. The command skips authentication because skills install creates no Sanity token. Telemetry SkillsInstallTrace records standalone installs.
  • setupSkills progress UX (actions/skills/setupSkills.ts) — wraps the install in a spinner and prints ✔ Sanity agent skills installed on success (or a failure message on error) so the user sees the CLI is doing work.
  • readSkillState universal-agent handling (actions/skills/readSkillState.ts, actions/skills/skillCandidates.ts) — now takes the detected editors and credits "universal" editors (whose skills live in the shared .agents/skills dir) as installed even when skills list -g --json omits them. Worth confirming the universal-path detection.
  • setupMCP / init alignment (actions/mcp/setupMCP.ts, types.ts, editorConfigs.ts) — init's combined prompt still derives "needs skills" from the shared getSkillCandidates primitive (replacing the old editor.skillInstalled marking, now removed from the Editor type). sanity init runs the skills install immediately after the MCP/skills step (right after setupMCP), before the scaffolding "Success!" output, so the progress + result surface in sequence rather than trailing it.
  • Topic registration (oclif.config.js, scripts/check-topic-aliases.ts).

Testing

Added/updated unit tests:

  • configureSkills.test.ts — forwards every detected agent without prompting, dedupes agents, warns when no editors map to a skills agent, surfaces install failures, and re-installs even when skills are already present (update-in-place).
  • skillCandidates.test.ts — candidate semantics and installed-agent display-name resolution.
  • readSkillState.test.ts — credits universal editors when skills resolve under .agents/skills, and does not credit them otherwise.
  • commands/skills/__tests__/install.test.ts — command success, install-error (non-fatal), and throw (exit 1) paths.
  • Re-ran setupMCP.test.ts and init.bootstrap-app.test.ts to confirm the refactor and new init ordering are preserved.

All of check:types, check:lint, check:deps, and the build's topic-alias check pass.

Screenshots

Screenshot 2026-06-17 at 9 58 52 AM

Note

Medium Risk
Changes init ordering and how installed skills are inferred across editors; mistakes could cause redundant installs or skip needed ones, but there is no auth or data-path exposure.

Overview
Adds a sanity skills topic and sanity skills install so Sanity agent skills can be installed outside sanity init, via MCP-free configureSkills (detect editors → dedupe skills-CLI agents → setupSkills). Re-runs are intentional to refresh skill files in place.

Init / MCP alignment: setupMCP now derives “needs skills” from shared getSkillCandidates instead of mutating Editor.skillInstalled. readSkillState takes detected editors and treats skills under .agents/skills as installed for “universal” editors (e.g. Cursor) even when skills list omits them; editor configs gain skillsDir (Claude Code uses .claude/skills).

UX: sanity init runs skills install immediately after the MCP/skills step (before scaffolding success output). setupSkills uses a spinner for progress. Telemetry SkillsInstallTrace records standalone installs.

Reviewed by Cursor Bugbot for commit 0f9462e. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Stats — @sanity/cli

Compared against main (fe61c5dd)

@sanity/cli

Metric Value vs main (fe61c5d)
Internal (raw) 2.1 KB -
Internal (gzip) 799 B -
Bundled (raw) 11.13 MB -
Bundled (gzip) 2.10 MB -
Import time 902ms -2ms, -0.2%

bin:sanity

Metric Value vs main (fe61c5d)
Internal (raw) 782 B -
Internal (gzip) 423 B -
Bundled (raw) 9.87 MB -
Bundled (gzip) 1.77 MB -
Import time 2.06s -9ms, -0.4%

🗺️ View treemap · Artifacts

Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

📦 Bundle Stats — @sanity/cli-core

Compared against main (fe61c5dd)

Metric Value vs main (fe61c5d)
Internal (raw) 98.2 KB -
Internal (gzip) 23.3 KB -
Bundled (raw) 21.70 MB -
Bundled (gzip) 3.45 MB -
Import time 798ms -13ms, -1.5%

🗺️ View treemap · Artifacts

Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

📦 Bundle Stats — create-sanity

Compared against main (fe61c5dd)

Metric Value vs main (fe61c5d)
Internal (raw) 908 B -
Internal (gzip) 483 B -
Bundled (raw) 931 B -
Bundled (gzip) 491 B -
Import time ❌ ChildProcess denied: node -
Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Coverage Delta

File Statements
packages/@sanity/cli/src/actions/init/initAction.ts 93.2% (- 0.1%)
packages/@sanity/cli/src/actions/mcp/editorConfigs.ts 99.0% (- 1.0%)
packages/@sanity/cli/src/actions/mcp/setupMCP.ts 98.3% (- 0.8%)
packages/@sanity/cli/src/actions/skills/configureSkills.ts 100.0% (new)
packages/@sanity/cli/src/actions/skills/readSkillState.ts 100.0% (±0%)
packages/@sanity/cli/src/actions/skills/setupSkills.ts 95.7% (+ 3.1%)
packages/@sanity/cli/src/actions/skills/skillCandidates.ts 100.0% (new)
packages/@sanity/cli/src/commands/skills/install.ts 100.0% (new)
packages/@sanity/cli/src/telemetry/skills.telemetry.ts 100.0% (new)

Comparing 9 changed files against main @ 491d3aef0d2eafb141af0eaa143e1b5259a7736e

Overall Coverage

Metric Coverage
Statements 87.5% (+ 0.1%)
Branches 77.3% (+ 0.1%)
Functions 86.8% (+ 0.1%)
Lines 87.9% (+ 0.2%)

@mwritter mwritter marked this pull request as ready for review June 12, 2026 14:59
@mwritter mwritter requested a review from a team as a code owner June 12, 2026 14:59

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e6a1629. Configure here.

Comment thread packages/@sanity/cli/src/actions/skills/configureSkills.ts Outdated
@jwoods02 jwoods02 self-requested a review June 15, 2026 15:51
@mwritter mwritter changed the title feat: add sanity skills configure command to allow manual skills install feat: add sanity skills install command to allow manual skills install Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant