Skip to content

fix(cli): allow command flags to override globals#2295

Merged
IMax153 merged 6 commits into
Effect-TS:mainfrom
jgoux:codex/cli-local-flags-override-globals
May 28, 2026
Merged

fix(cli): allow command flags to override globals#2295
IMax153 merged 6 commits into
Effect-TS:mainfrom
jgoux:codex/cli-local-flags-override-globals

Conversation

@jgoux
Copy link
Copy Markdown
Contributor

@jgoux jgoux commented May 28, 2026

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Updates CLI global flag extraction so command-local flags take precedence when the selected command defines a flag with the same name or alias as a global flag.

Previously, global flags were consumed before command parsing, so a command-local flag such as --version <value> could be intercepted by the built-in global --version action. The same issue applied to aliases, for example a global --output/-o setting consuming -o csv before a selected command's local -o flag could parse it.

This change makes global flag consumption walk the command tree first. At each selected command level, local flags are preserved for command parsing before matching global flags. Global flags still work across the command tree, while command-local overrides on the active command path are now respected.

Adds regression tests for:

  • local --version <value> overriding the built-in global --version
  • local -o overriding a global --output/-o
  • local flags overriding scoped globals declared on another command branch

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 28, 2026

🦋 Changeset detected

Latest commit: 03f54cd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 27 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec032f6ad8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/effect/src/unstable/cli/internal/parser.ts Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 33136cd23f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/effect/src/unstable/cli/internal/parser.ts
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d2a705f12

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/effect/src/unstable/cli/internal/parser.ts Outdated
@IMax153 IMax153 enabled auto-merge (squash) May 28, 2026 13:42
@IMax153 IMax153 merged commit b1fc6a4 into Effect-TS:main May 28, 2026
25 of 26 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

Bundle Size Analysis

File Name Current Size Previous Size Difference
basic.ts 6.72 KB 6.72 KB 0.00 KB (0.00%)
batching.ts 9.23 KB 9.23 KB 0.00 KB (0.00%)
brand.ts 6.20 KB 6.20 KB 0.00 KB (0.00%)
cache.ts 9.70 KB 9.70 KB 0.00 KB (0.00%)
config.ts 18.40 KB 18.40 KB 0.00 KB (0.00%)
differ.ts 16.85 KB 16.85 KB 0.00 KB (0.00%)
http-client.ts 20.20 KB 20.20 KB 0.00 KB (0.00%)
logger.ts 10.18 KB 10.18 KB 0.00 KB (0.00%)
metric.ts 8.56 KB 8.56 KB 0.00 KB (0.00%)
optic.ts 7.37 KB 7.37 KB 0.00 KB (0.00%)
pubsub.ts 13.80 KB 13.80 KB 0.00 KB (0.00%)
queue.ts 11.08 KB 11.08 KB 0.00 KB (0.00%)
schedule.ts 10.08 KB 10.08 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 26.24 KB 26.24 KB 0.00 KB (0.00%)
schema-string-transformation.ts 12.59 KB 12.59 KB 0.00 KB (0.00%)
schema-string.ts 10.34 KB 10.34 KB 0.00 KB (0.00%)
schema-template-literal.ts 13.94 KB 13.94 KB 0.00 KB (0.00%)
schema-toArbitraryLazy.ts 18.51 KB 18.51 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 21.13 KB 21.13 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 17.67 KB 17.67 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 17.61 KB 17.61 KB 0.00 KB (0.00%)
schema-toFormatter.ts 17.44 KB 17.44 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 19.96 KB 19.96 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 18.00 KB 18.00 KB 0.00 KB (0.00%)
schema.ts 17.05 KB 17.05 KB 0.00 KB (0.00%)
stm.ts 11.95 KB 11.95 KB 0.00 KB (0.00%)
stream.ts 9.25 KB 9.25 KB 0.00 KB (0.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.

2 participants