Skip to content

feat(workbench): merge app group + priority into the core-app manifest#1146

Draft
gu-stav wants to merge 3 commits into
feat/workbench-define-app-namefrom
feat/cli-dock-group-priority
Draft

feat(workbench): merge app group + priority into the core-app manifest#1146
gu-stav wants to merge 3 commits into
feat/workbench-define-app-namefrom
feat/cli-dock-group-priority

Conversation

@gu-stav
Copy link
Copy Markdown
Member

@gu-stav gu-stav commented Jun 1, 2026

The CLI side of US2 — dock placement (002-workbench-extension-api), stacked on #1143. Companion to workbench PR #235.

Carries group/priority from unstable_defineApp into the core-app manifest:

  • coreAppManifestSchema + CliConfig.app type gain group/priority.
  • extractCoreAppManifest merges them alongside title/icon (priority: 0 preserved, not dropped as falsy).

For local sanity dev apps this rides the existing path with no new wiring: the config watcher re-extracts the manifest on sanity.cli.ts edits → registration.update rewrites the dev-server registry entry → watchRegistryws.send('sanity:workbench:local-applications'). So editing group/priority live re-sorts the dock without a restart (FR-024). The registry validates against the same extended coreAppManifestSchema, so the fields aren't stripped.

Added unit coverage in extractCoreAppManifest.test.ts (merge + priority: 0).

Note: the workbench canaries declaring group/priority (and clean cross-repo types) need this CLI to ship its @sanity/federation bump first — until then the workbench side keeps that as local WIP.

Carries dock placement from `unstable_defineApp({ group, priority })` into
the core-app manifest, so it deploys and — for local `sanity dev` apps —
rides the existing dev-server registry → workbench websocket. Editing
group/priority in `sanity.cli.ts` re-extracts the manifest and the dock
re-sorts live, no restart (the watcher/registry/ws path already handles
manifest changes). `priority: 0` is preserved (not dropped as falsy).
@claude
Copy link
Copy Markdown

claude Bot commented Jun 1, 2026

Claude finished @gu-stav's task in 2m 21s —— View job


Claude PR Review

  • Read changed files
  • Check changeset
  • Verify test coverage
  • Post review

Issues

1. group / priority are silently dropped on the legacy app config pathpackages/@sanity/cli-core/src/config/cli/schemas.ts:18-26

The CliConfig.app interface gains group and priority, but the runtime Zod schema (cliConfigSchema.app) wasn't updated. For non-workbench configs getCliConfig runs cliConfigSchema.safeParse(cliConfig) (getCliConfig.ts:110), which strips unknown keys. So a user who sets:

export default defineCliConfig({app: {group: 'dock.system', priority: 20, title: 'My App'}})

without unstable_defineApp will see group/priority disappear before they ever reach extractCoreAppManifest — no error, no warning, and the docstring on the type ("Defaults to dock.applications") doesn't hint that this only works for workbench apps.

Pick one:

  • Add them to the schema so both paths behave the same:
    app: z.optional(
      z.object({
        entry: z.optional(z.string()),
        group: z.optional(z.enum(['dock.applications', 'dock.system', 'dock.user'])),
        icon: z.optional(z.string()),
        id: z.optional(z.string()),
        organizationId: z.optional(z.string()),
        priority: z.optional(z.number()),
        title: z.optional(z.string()),
      }),
    ),
  • Or restrict the new type fields and document in JSDoc that they only apply via unstable_defineApp.

The first option is cheaper and matches the type. Fix this →

2. Missing changeset — this PR adds public type surface (CliConfig.app.group/priority) and changes manifest output, so it needs a .changeset/*.md. The companion pr-1143.md covers unstable_defineApp itself but not dock placement. Suggested:

---
'@sanity/cli-core': minor
'@sanity/cli': minor
---

Add `app.group` and `app.priority` to `unstable_defineApp` to control dock placement and sort order for core apps.

3. Type asymmetry between config and manifestCliConfig.app.group is narrowed to 'dock.applications' | 'dock.system' | 'dock.user', but coreAppManifestSchema.group (types.ts:28) is z.optional(z.string()). If the workbench is authoritative on valid group names, mirror the enum here too so the CLI fails fast on a typo instead of forwarding garbage. If it's intentionally loose because the workbench validates, drop a one-liner comment explaining why.

Notes

  • The priority === undefined check in extractCoreAppManifest.ts:82 is correct — priority: 0 is intentionally preserved, and the test at extractCoreAppManifest.test.ts:63-71 covers it.
  • The workbench path (parseWorkbenchCliConfig in workbenchApp.ts) intentionally bypasses cliConfigSchema for app, so group/priority survive there today. That's why issue chore: Configure Renovate - autoclosed #1 only affects the legacy path.
    · feat/cli-dock-group-priority

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

📦 Bundle Stats — @sanity/cli

Compared against feat/workbench-define-app-name (c496368b)

@sanity/cli

Metric Value vs feat/workbench-define-app-name (c496368)
Internal (raw) 2.4 KB -
Internal (gzip) 922 B -
Bundled (raw) 11.08 MB -
Bundled (gzip) 2.08 MB -
Import time 855ms -35ms, -4.0%

bin:sanity

Metric Value vs feat/workbench-define-app-name (c496368)
Internal (raw) 1023 B -
Internal (gzip) 486 B -
Bundled (raw) 9.84 MB -
Bundled (gzip) 1.77 MB -
Import time 2.04s +20ms, +1.0%

🗺️ 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 feat/workbench-define-app-name (c496368b)

Metric Value vs feat/workbench-define-app-name (c496368)
Internal (raw) 102.3 KB -
Internal (gzip) 24.7 KB -
Bundled (raw) 21.75 MB -
Bundled (gzip) 3.45 MB -
Import time 802ms +2ms, +0.2%

🗺️ 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 feat/workbench-define-app-name (c496368b)

Metric Value vs feat/workbench-define-app-name (c496368)
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.

@gu-stav gu-stav changed the title feat(cli): merge app group + priority into the core-app manifest feat(workbench): merge app group + priority into the core-app manifest Jun 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Coverage Delta

File Statements
packages/@sanity/cli-core/src/config/cli/getCliConfig.ts 100.0% (±0%)
packages/@sanity/cli-core/src/config/cli/getCliConfigSync.ts 81.0% (+ 38.9%)
packages/@sanity/cli-core/src/config/cli/workbenchApp.ts 100.0% (new)
packages/@sanity/cli-core/src/services/cliUserConfig.ts 100.0% (±0%)
packages/@sanity/cli-core/src/util/getSanityConfigDir.ts 66.7% (new)
packages/@sanity/cli/src/actions/build/buildApp.ts 95.3% (±0%)
packages/@sanity/cli/src/actions/build/buildStaticFiles.ts 97.6% (+ 0.9%)
packages/@sanity/cli/src/actions/build/buildStudio.ts 96.7% (±0%)
packages/@sanity/cli/src/actions/build/getViteConfig.ts 100.0% (new)
packages/@sanity/cli/src/actions/build/writeSanityRuntime.ts 96.2% (new)
packages/@sanity/cli/src/actions/deploy/deployApp.ts 80.5% (±0%)
packages/@sanity/cli/src/actions/deploy/deployStudioSchemasAndManifests.ts 100.0% (±0%)
packages/@sanity/cli/src/actions/dev/devAction.ts 96.7% (- 3.3%)
packages/@sanity/cli/src/actions/dev/devServerRegistry.ts 93.8% (new)
packages/@sanity/cli/src/actions/dev/extractDevServerManifest.ts 20.0% (new)
packages/@sanity/cli/src/actions/dev/getDevServerConfig.ts 100.0% (±0%)
packages/@sanity/cli/src/actions/dev/startAppDevServer.ts 100.0% (+ 13.0%)
packages/@sanity/cli/src/actions/dev/startDevManifestWatcher.ts 90.9% (new)
packages/@sanity/cli/src/actions/dev/startFederationRegistration.ts 100.0% (new)
packages/@sanity/cli/src/actions/dev/startStudioDevServer.ts 100.0% (+ 5.0%)
packages/@sanity/cli/src/actions/dev/startWorkbenchDevServer.ts 98.7% (new)
packages/@sanity/cli/src/actions/dev/writeWorkbenchRuntime.ts 100.0% (new)
packages/@sanity/cli/src/actions/init/createAppCliConfig.ts 100.0% (±0%)
packages/@sanity/cli/src/actions/init/createCliConfig.ts 50.0% (±0%)
packages/@sanity/cli/src/actions/manifest/extractCoreAppManifest.ts 93.1% (new)
packages/@sanity/cli/src/actions/manifest/extractManifest.ts 100.0% (±0%)
packages/@sanity/cli/src/actions/manifest/types.ts 100.0% (±0%)
packages/@sanity/cli/src/actions/manifest/writeManifestFile.ts 100.0% (±0%)
packages/@sanity/cli/src/commands/dev.ts 100.0% (±0%)
packages/@sanity/cli/src/commands/manifest/extract.ts 100.0% (±0%)
packages/@sanity/cli/src/commands/schemas/deploy.ts 95.0% (±0%)
packages/@sanity/cli/src/server/devServer.ts 94.1% (- 0.3%)
packages/@sanity/cli/src/util/determineIsApp.ts 100.0% (±0%)
packages/@sanity/cli/src/util/getSharedServerConfig.ts 100.0% (±0%)
packages/@sanity/cli/src/util/resolveReactStrictMode.ts 100.0% (new)

Comparing 35 changed files against main @ 7d2118d4509f4d0a7406b1e262d17f4b531d1d07

Overall Coverage

Metric Coverage
Statements 84.7% (+ 0.4%)
Branches 74.8% (+ 0.5%)
Functions 84.4% (+ 0.2%)
Lines 85.2% (+ 0.4%)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Preview this PR with pkg.pr.new

Run the Sanity CLI

npx https://pkg.pr.new/sanity-io/cli/@sanity/cli@4265702 <command>

...Or upgrade project dependencies

📦 @sanity/cli
pnpm install https://pkg.pr.new/@sanity/cli@4265702
📦 @sanity/cli-build
pnpm install https://pkg.pr.new/@sanity/cli-build@4265702
📦 @sanity/cli-core
pnpm install https://pkg.pr.new/@sanity/cli-core@4265702
📦 @sanity/cli-test
pnpm install https://pkg.pr.new/@sanity/cli-test@4265702
📦 @sanity/eslint-config-cli
pnpm install https://pkg.pr.new/@sanity/eslint-config-cli@4265702

View Commit (4265702)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant