fix(flag): read every documented ALTIMATE_CLI_* name, not only two of them

Merged
SA
2mo ago
+464-74

Issue for this PR

Closes #1329

Type of change

  • Bug fix

What does this PR do?

docs/docs/usage/cli.md documents the flags under ALTIMATE_CLI_*, but flag.ts read that spelling for only two of them (YOLO, DISABLE_AUTOUPDATE). So ALTIMATE_CLI_DISABLE_EXTERNAL_SKILLS=true did nothing — the issue — and a cross-check of the whole table found the same for DISABLE_AUTOCOMPACT, DISABLE_DEFAULT_PLUGINS, DISABLE_LSP_DOWNLOAD, DISABLE_MODELS_FETCH, DISABLE_PROJECT_CONFIG, DISABLE_PRUNE, DISABLE_TERMINAL_TITLE, ENABLE_EXA, the EXPERIMENTAL* family, CONFIG, CONFIG_CONTENT, CONFIG_DIR, GIT_BASH_PATH, PERMISSION, SERVER_USERNAME and SERVER_PASSWORD. One instance was reported; the class is what's fixed.

There are three places a flag is read, and the first cut fixed only one — cubic caught that the gate the issue is about (RuntimeFlags.disableExternalSkills, an Effect Config) never went through it. The rule is now defined once, in packages/core's flag/flag.ts (documentedAlias / env: documented name first, empty counts as unset), and applied on every path:

  • the core Flag object (31 importers, config/config.ts among them — so ALTIMATE_CLI_CONFIG works too), including its two Effect Config flags;
  • the opencode Flag namespace, which imports the rule instead of its own copy — altTruthy/altEnv let a set documented value win outright, so a documented false beats a fallback true;
  • the Effect Config-backed services (RuntimeFlags, ServerAuthConfig): effect/config-service.ts wraps whatever ConfigProvider is active so the documented spelling is tried first (built with ConfigProvider.make; orElse's fallback bypasses mapInput);
  • the two remaining direct process.env reads, config.ts (OPENCODE_CONFIG_CONTENT) and run --attach (OPENCODE_SERVER_PASSWORD/_USERNAME).

The OPENCODE_ spellings keep working.

How did you verify your code works?

  • test/flag/external-skills-flag.test.ts (13 tests): the namespace in a subprocess (documented name alone, OPENCODE_ fallback, documented wins, the CLAUDE_CODE family, copy-on-select explicit false); every ALTIMATE_CLI_* name in the docs table reaches its flag; RuntimeFlags and ServerAuthConfig built through a fromEnv provider — ALTIMATE_CLI_DISABLE_EXTERNAL_SKILLS alone sets disableExternalSkills, documented false beats fallback true, empty documented falls back, numeric flags; the core Flag object in a subprocess (config paths, altTruthy precedence, the Effect Config flag).
  • Mutation: bypassing the provider wrap fails four tests. Restored.
  • test/flag, test/config, test/effect, test/server, test/skill, test/cli/cmd: 1,669 pass. packages/core test/config, test/filesystem: two pre-existing failures on the base (macOS tmp path, watcher timing), unrelated. Typecheck (all packages) and marker guard clean.

Screenshots / recordings

N/A.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

🤖 Generated with Claude Code

https://claude.ai/code/session_012Q51zFUmPg1WwtS5CrGJE6