Skip to content

fix(cli): scope-aware odek init templates for global vs project configs - #121

Merged
jkyberneees merged 1 commit into
mainfrom
fix/init-global-local-config
Jul 28, 2026
Merged

fix(cli): scope-aware odek init templates for global vs project configs#121
jkyberneees merged 1 commit into
mainfrom
fix/init-global-local-config

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Problem

odek init used a single template for both scopes, so a fresh local ./odek.json came pre-filled with operator-only fields (api_key, base_url, system, dangerous, telegram, memory, maintenance, web_search, trusted_proxies, tools.enabled, skills.dirs) that the project-config loader ignores with a stderr warning on every run, plus sandbox: false / sandbox_readonly: false pins that project configs are not allowed to weaken.

Change

Split defaultConfigTemplate into two scope-aware templates:

  • globalConfigTemplate (~/.odek/config.json, operator-controlled): full schema — now also covering max_tool_parallel, prompt_caching, compaction, interaction_mode, tools, skills.auto_save/curation, memory, mcp_servers, web_search, schedules, and maintenance.
  • localConfigTemplate (./odek.json, untrusted): only fields a project may legitimately set, so a fresh odek init loads warning-free. Omits sandbox/sandbox_readonly entirely (projects may only enable, never disable) and all operator-only sections the loader rejects.

Also:

  • New explicit --local / -l flag (equivalent to the default); usage line updated.
  • Scope-appropriate post-create summaries: the global summary lists common fields + sections; the local summary explains which fields are operator-only and points at odek init --global.

Tests

  • Updated TestInitConfig_Local/Global/LocalForce for the new templates.
  • New TestInitConfig_LocalFlag--local writes only ./odek.json, never the global config.
  • New TestInitConfig_LocalTemplateLoadsClean / GlobalTemplateLoadsClean — both templates round-trip through config.FileConfig; the local template carries no operator-only fields and does not pin sandbox/sandbox_readonly.

Verified with clean env (env -u ODEK_MODEL -u ODEK_BASE_URL -u ODEK_PROMPT_CACHING -u ODEK_TELEGRAM_BOT_TOKEN):

  • go test -race -count=1 -run TestInitConfig ./cmd/odek/
  • go test -count=1 ./internal/config/
  • go test -count=1 ./cmd/odek/ (full suite) ✅

Docs

  • docs/CLI.md — init command row updated ([--global|--local], scope-aware note).
  • docs/CONFIG.mdodek init section rewritten to document the two templates and which fields belong where.

A single template served both scopes, so a fresh local ./odek.json came
pre-filled with operator-only fields (api_key, base_url, system,
dangerous, telegram, memory, maintenance, web_search, ...) that the
loader ignores with warnings on every run, plus sandbox=false /
sandbox_readonly=false pins that project configs are not allowed to
weaken.

Split defaultConfigTemplate into:

- globalConfigTemplate (~/.odek/config.json): full operator schema,
  now also covering max_tool_parallel, prompt_caching, compaction,
  interaction_mode, tools, skills.auto_save/curation, memory,
  mcp_servers, web_search, schedules, and maintenance.
- localConfigTemplate (./odek.json): only fields a project may
  legitimately set, so a fresh 'odek init' loads warning-free. Omits
  sandbox/sandbox_readonly entirely (projects may only enable, never
  disable) and operator-only sections rejected by the loader.

Also adds an explicit --local/-l flag (equivalent to the default),
scope-appropriate post-create summaries, and round-trip tests
asserting both templates unmarshal into config.FileConfig with the
expected operator-only fields absent/present.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
odek 313fa01 Commit Preview URL

Branch Preview URL
Jul 28 2026, 06:55 PM

@jkyberneees
jkyberneees merged commit d24a805 into main Jul 28, 2026
10 checks passed
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