feat(env): add environment overrides for embedded use#278
Conversation
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (25)
Summary by CodeRabbit
WalkthroughThis PR introduces environment variable overrides that enable non-interactive CLI operation. Store paths ( 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
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
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
ESLint install timed out. The project may have too many dependencies for the sandbox. Comment |
Why
The OOMOL desktop app bundles the
oobinary and drives it as a subprocess via environment variables, so it needs to isolate state from a user's ownooinstall, 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), outranksXDG_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.ts→requireCurrentAccount/resolveCurrentEndpoint)OO_API_KEY— builds a login-free in-memory account; execution commands run without reading/requiring/writingauth.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 legacyOOMOL_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— refusesupdate/install/check-updateand forces self-update PATH modification off.Notes
OO_API_KEYruns asauthenticatedwithout touchingauth.toml.oo skills publishrejects the scope-less env override with a clear error instead of deriving an invalid package name.docs/commands.mdanddocs/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-loginconnector search/llm confighitting*.oomol.dev,auth.tomlnever read underOO_API_KEY, zero writes to agent homes, and self-update refusal).