Skip to content

feat: AIGRO-4919 - Invoking allowed commands from outside the cli#1598

Draft
mwritter wants to merge 6 commits into
mainfrom
feat/aigro-4919
Draft

feat: AIGRO-4919 - Invoking allowed commands from outside the cli#1598
mwritter wants to merge 6 commits into
mainfrom
feat/aigro-4919

Conversation

@mwritter

@mwritter mwritter commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Screenshots - Locally tested linking cli changes to mellon and running pnpm inspect from mellon
image

Screenshot 2026-07-24 at 3 43 28 PM image

@mwritter
mwritter requested a review from jonahsnider July 24, 2026 19:14
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Stats — @sanity/cli

Compared against main (efb5705b)

@sanity/cli

Metric Value vs main (efb5705)
Internal (raw) 2.2 KB -
Internal (gzip) 838 B -
Bundled (raw) 11.20 MB +641 B, +0.0%
Bundled (gzip) 2.11 MB +206 B, +0.0%
Import time 876ms -5ms, -0.5%

bin:sanity

Metric Value vs main (efb5705)
Internal (raw) 782 B -
Internal (gzip) 423 B -
Bundled (raw) 9.90 MB -
Bundled (gzip) 1.78 MB -
Import time 2.12s +24ms, +1.1%

🗺️ 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 (efb5705b)

Metric Value vs main (efb5705)
Internal (raw) 118.2 KB +4.2 KB, +3.7%
Internal (gzip) 30.3 KB +1.1 KB, +3.9%
Bundled (raw) 21.77 MB +3.4 KB, +0.0%
Bundled (gzip) 3.47 MB +679 B, +0.0%
Import time 786ms +10ms, +1.3%

🗺️ 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-build

Compared against main (efb5705b)

@sanity/cli-build/_internal/build

Metric Value vs main (efb5705)
Internal (raw) 113.2 KB -
Internal (gzip) 28.7 KB -
Bundled (raw) 17.75 MB +1014 B, +0.0%
Bundled (gzip) 3.56 MB +430 B, +0.0%
Import time 1.15s +3ms, +0.2%

@sanity/cli-build/_internal/env

Metric Value vs main (efb5705)
Internal (raw) 1.8 KB -
Internal (gzip) 644 B -
Bundled (raw) 1.31 MB -
Bundled (gzip) 333.8 KB -
Import time 128ms -0ms, -0.0%

@sanity/cli-build/_internal/extract

Metric Value vs main (efb5705)
Internal (raw) 8.6 KB -
Internal (gzip) 2.7 KB -
Bundled (raw) 155.0 KB -
Bundled (gzip) 39.5 KB -
Import time 248ms +0ms, +0.2%

🗺️ ./_internal/env · ./_internal/extract · @sanity/cli-build:./_internal/build treemap too large to embed · 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 (efb5705b)

Metric Value vs main (efb5705)
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

Copy link
Copy Markdown
Contributor

Coverage Delta

File Statements
packages/@sanity/cli-core/src/SanityCommand.ts 89.0% (+ 5.0%)
packages/@sanity/cli-core/src/config/cli/cliUserConfig.ts 100.0% (±0%)
packages/@sanity/cli-core/src/config/findProjectRoot.ts 100.0% (±0%)
packages/@sanity/cli-core/src/config/findProjectRootSync.ts 100.0% (±0%)
packages/@sanity/cli-core/src/executionContext.ts 100.0% (new)
packages/@sanity/cli-core/src/util/isInteractive.ts 100.0% (±0%)
packages/@sanity/cli/src/commands/cors/add.ts 100.0% (±0%)
packages/@sanity/cli/src/commands/cors/delete.ts 100.0% (±0%)
packages/@sanity/cli/src/commands/cors/list.ts 100.0% (±0%)
packages/@sanity/cli/src/commands/projects/list.ts 23.1% (new)
packages/@sanity/cli/src/exports/invokeSanityCli/InvokableCommands.ts 100.0% (new)
packages/@sanity/cli/src/exports/invokeSanityCli/help.ts 94.1% (new)
packages/@sanity/cli/src/exports/invokeSanityCli/index.ts 93.3% (new)
packages/@sanity/cli/src/util/tokenizeCliArgs.ts 100.0% (new)

Comparing 14 changed files against main @ efb5705b0ccde1108a2503f921a9cab4f2aa850e

Overall Coverage

Metric Coverage
Statements 78.5% (+ 0.1%)
Branches 70.3% (+ 0.2%)
Functions 73.8% (+ 0.2%)
Lines 79.0% (+ 0.1%)

* @throws When the input contains an unterminated quote.
* @internal
*/
export function tokenizeCliArgs(input: string): string[] {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMO, rather than keeping this in the CLI project, the MCP server should handle parsing the args. this keeps the bundle size smaller for the CLI

Comment on lines +16 to +19
['cors add', CorsAdd],
['cors delete', CorsDelete],
['cors list', CorsList],
['projects list', ProjectsList],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is there a way we can run commands programmatically without needing to define them all here? we want to specify the allowed commands in the MCP server, not the CLI.

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.

2 participants