Skip to content

refactor(cli): use defaults-with-overrides pattern for EDITOR_CONFIGS#886

Merged
drewlyton merged 1 commit intocursor/ai-dev-tools-support-2783from
refactor/editor-configs-defaults
Apr 6, 2026
Merged

refactor(cli): use defaults-with-overrides pattern for EDITOR_CONFIGS#886
drewlyton merged 1 commit intocursor/ai-dev-tools-support-2783from
refactor/editor-configs-defaults

Conversation

@drewlyton
Copy link
Copy Markdown

Summary

  • Introduces an EDITOR_DEFAULTS constant with the most common EditorConfig values (defaultHttpConfig, mcpServers, jsonc, readTokenFromHeaders)
  • Each EDITOR_CONFIGS entry now spreads the defaults and only declares detect + any overrides, making deviations from the norm immediately visible
  • Removes 5 pass-through buildServerConfig wrappers that just returned defaultHttpConfig(token)

Reduces editorConfigs.ts from 350 to 267 lines (-24%) with no behavioral change. Types, lint, and all direct unit tests pass.

Introduce EDITOR_DEFAULTS constant with the most common EditorConfig
values (defaultHttpConfig, mcpServers, jsonc, readTokenFromHeaders).
Each EDITOR_CONFIGS entry now spreads the defaults and only declares
detect + any overrides, making deviations immediately visible.

Remove 5 pass-through buildServerConfig wrappers that just returned
defaultHttpConfig(token): buildClaudeCodeServerConfig,
buildCursorServerConfig, buildGeminiCliServerConfig,
buildVSCodeServerConfig, buildVSCodeInsidersServerConfig.

Reduces editorConfigs.ts from 350 to 267 lines with no behavioral
change.
@drewlyton drewlyton requested a review from a team as a code owner April 6, 2026 14:38
@drewlyton drewlyton requested review from ryanbonial and removed request for a team April 6, 2026 14:38
@claude
Copy link
Copy Markdown

claude bot commented Apr 6, 2026

Claude finished @drewlyton's task in 27s —— View job


Review

  • Read changed file and diff
  • Review for issues

Codex CLI loses its buildServerConfig override implicitly

The Codex CLI entry spreads EDITOR_DEFAULTS (which sets buildServerConfig: defaultHttpConfig) and then does not override buildServerConfig. But buildCodexCliServerConfig existed in the original code and returns a different shape from defaultHttpConfig — it adds extra fields. The old entry used buildCodexCliServerConfig; the new one silently falls back to defaultHttpConfig. This is a behavior change.

Looking at the diff more carefully — buildCodexCliServerConfig is still defined but is no longer referenced anywhere in EDITOR_CONFIGS. It should either be set on the Codex CLI entry or deleted. Fix this →


@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

📦 Bundle Stats — @sanity/cli

Compared against cursor/ai-dev-tools-support-2783 (dc59192e)

@sanity/cli

Metric Value vs cursor/ai-dev-tools-support-2783 (dc59192)
Internal (raw) 2.1 KB -
Internal (gzip) 799 B -
Bundled (raw) 10.95 MB -
Bundled (gzip) 2.06 MB -
Import time 741ms +0ms, +0.0%

bin:sanity

Metric Value vs cursor/ai-dev-tools-support-2783 (dc59192)
Internal (raw) 975 B -
Internal (gzip) 460 B -
Bundled (raw) 9.84 MB -
Bundled (gzip) 1.77 MB -
Import time 1.75s +1ms, +0.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 cursor/ai-dev-tools-support-2783 (dc59192e)

Metric Value vs cursor/ai-dev-tools-support-2783 (dc59192)
Internal (raw) 92.3 KB -
Internal (gzip) 21.6 KB -
Bundled (raw) 21.53 MB -
Bundled (gzip) 3.41 MB -
Import time 691ms -4ms, -0.6%

🗺️ 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 cursor/ai-dev-tools-support-2783 (dc59192e)

Metric Value vs cursor/ai-dev-tools-support-2783 (dc59192)
Internal (raw) 976 B -
Internal (gzip) 507 B -
Bundled (raw) 50.7 KB -
Bundled (gzip) 12.6 KB -
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.

@drewlyton drewlyton merged commit ada91a8 into cursor/ai-dev-tools-support-2783 Apr 6, 2026
37 of 43 checks passed
@drewlyton drewlyton deleted the refactor/editor-configs-defaults branch April 6, 2026 15:00
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