Skip to content

feat(env): add environment overrides for embedded use#278

Merged
BlackHole1 merged 1 commit into
mainfrom
add-env
Jun 11, 2026
Merged

feat(env): add environment overrides for embedded use#278
BlackHole1 merged 1 commit into
mainfrom
add-env

Conversation

@BlackHole1

Copy link
Copy Markdown
Member

Why

The OOMOL desktop app bundles the oo binary and drives it as a subprocess via environment variables, so it needs to isolate state from a user's own oo install, run without an interactive login, and suppress side effects that don't belong in an embedded run (skills sync, self-update, PATH rewrites, telemetry).

What

New environment variables, honored across the CLI (truthy values: 1/true/yes/on):

Directories (src/adapters/store/store-path.ts)

  • OO_CONFIG_DIR — config root override (auth/settings/telemetry), outranks XDG_CONFIG_HOME, used as the root directly.
  • OO_DATA_DIR — data dir override (cache/uploads/download-sessions).
  • OO_LOG_DIR — log dir override, outranks every platform default.

Auth / endpoint (auth-env-override.tsrequireCurrentAccount / resolveCurrentEndpoint)

  • OO_API_KEY — builds a login-free in-memory account; execution commands run without reading/requiring/writing auth.toml; outranks any persisted account.
  • OO_ENDPOINT — base domain (e.g. oomol.com/oomol.dev) driving all service-URL derivation for execution commands; also redirects a persisted account's endpoint. Outranks the legacy OOMOL_ENDPOINT.

Side-effect guards

  • OO_SKILLS_SYNC_DISABLED — guards the startup managed-skill sync + legacy cleanup so nothing is written into other agents' homes (~/.agents, ~/.claude, ...).
  • OO_NO_SELF_UPDATE — refuses update/install/check-update and forces self-update PATH modification off.

Notes

  • Telemetry reports OO_API_KEY runs as authenticated without touching auth.toml.
  • oo skills publish rejects the scope-less env override with a clear error instead of deriving an invalid package name.
  • Docs updated in both docs/commands.md and docs/commands.zh-CN.md.

Testing

  • bun run lint:fix, bun run ts-check, bun run knip — clean.
  • bun run test — 1348 pass, 0 fail. New unit + CLI integration tests cover each variable's set/unset/priority paths (incl. no-login connector search/llm config hitting *.oomol.dev, auth.toml never read under OO_API_KEY, zero writes to agent homes, and self-update refusal).

The OOMOL desktop app bundles the oo binary and drives it as a
subprocess, so it needs to isolate state from a user's own oo install
and suppress side effects that do not belong in an embedded run.

Add environment overrides honored across the CLI:
- OO_CONFIG_DIR / OO_DATA_DIR / OO_LOG_DIR redirect the config, data,
  and log directories, taking precedence over XDG and platform defaults.
- OO_API_KEY / OO_ENDPOINT resolve a login-free in-memory account at the
  requireCurrentAccount chokepoint, so execution commands run without
  reading or writing auth.toml; OO_ENDPOINT also redirects the endpoint
  of a persisted account.
- OO_SKILLS_SYNC_DISABLED guards the startup managed-skill sync and
  legacy cleanup so no files are written into other agents' homes.
- OO_NO_SELF_UPDATE refuses update/install/check-update and forces
  self-update PATH modification off.

Telemetry reports OO_API_KEY runs as authenticated without touching
auth.toml, and skill publish rejects the scope-less env override
instead of deriving an invalid package name.

Signed-off-by: Kevin Cui <bh@bugs.cc>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 86b8d1e3-728a-4029-a5af-e349bcb45788

📥 Commits

Reviewing files that changed from the base of the PR and between 91fd80f and 211e121.

📒 Files selected for processing (25)
  • docs/commands.md
  • docs/commands.zh-CN.md
  • src/adapters/store/store-path.test.ts
  • src/adapters/store/store-path.ts
  • src/application/bootstrap/run-cli.test.ts
  • src/application/bootstrap/run-cli.ts
  • src/application/commands/check-update.cli.test.ts
  • src/application/commands/check-update.ts
  • src/application/commands/connector/index.cli.test.ts
  • src/application/commands/install.ts
  • src/application/commands/llm/index.cli.test.ts
  • src/application/commands/self-update.cli.test.ts
  • src/application/commands/shared/auth-env-override.test.ts
  • src/application/commands/shared/auth-env-override.ts
  • src/application/commands/shared/auth-utils.test.ts
  • src/application/commands/shared/auth-utils.ts
  • src/application/commands/skills/publish.test.ts
  • src/application/commands/skills/publish.ts
  • src/application/commands/update.ts
  • src/application/self-update/modify-path-preference.test.ts
  • src/application/self-update/modify-path-preference.ts
  • src/application/self-update/self-update-disabled-preference.test.ts
  • src/application/self-update/self-update-disabled-preference.ts
  • src/application/telemetry/emitter.ts
  • src/i18n/catalog.ts

Summary by CodeRabbit

  • Documentation

    • Added environment variables reference guide documenting CLI configuration options.
  • New Features

    • Added support for environment variable-based configuration: OO_CONFIG_DIR, OO_DATA_DIR, OO_LOG_DIR for path customization; OO_API_KEY and OO_ENDPOINT for authentication and service routing; OO_SKILLS_SYNC_DISABLED and OO_NO_SELF_UPDATE for behavior control.

Walkthrough

This PR introduces environment variable overrides that enable non-interactive CLI operation. Store paths (OO_CONFIG_DIR, OO_DATA_DIR, OO_LOG_DIR) override resolved directories before defaults. Authentication environment variables (OO_API_KEY, OO_ENDPOINT) build synthetic in-memory accounts and redirect service endpoints without requiring persisted auth.toml. Behavior controls (OO_SKILLS_SYNC_DISABLED, OO_NO_SELF_UPDATE) suppress startup side effects and self-update operations. The changes span path resolution, authentication utilities, command handlers, telemetry, and documentation with comprehensive test coverage and bilingual user guidance.

Sequence Diagram(s)

No additional sequence diagrams are generated because the high-level interaction flows are captured within the hidden review stack layers, and the individual command integration patterns are test-driven rather than presenting new architectural sequences beyond the existing precedence and fallback chains.

Possibly related PRs

  • oomol-lab/oo-cli#185: Modifies resolveSkillPublishPackageName logic in skills publish command alongside this PR's env-override account validation.
  • oomol-lab/oo-cli#230: New oo info command would display resolved paths/auth info affected by this PR's directory and auth overrides.
  • oomol-lab/oo-cli#81: Self-update behavior changes in update.ts overlap with this PR's OO_NO_SELF_UPDATE enforcement logic.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding environment variable overrides for embedded CLI usage.
Description check ✅ Passed The description is well-structured and directly related to the changeset, covering the motivation, implementation details, and testing of the environment variable overrides.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch add-env

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Comment @coderabbitai help to get the list of available commands and usage tips.

@BlackHole1 BlackHole1 merged commit 097fed3 into main Jun 11, 2026
6 checks passed
@BlackHole1 BlackHole1 deleted the add-env branch June 11, 2026 17:45
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