fix(cli): scope-aware odek init templates for global vs project configs - #121
Merged
Conversation
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.
Deploying with
|
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
odek initused a single template for both scopes, so a fresh local./odek.jsoncame 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, plussandbox: false/sandbox_readonly: falsepins that project configs are not allowed to weaken.Change
Split
defaultConfigTemplateinto two scope-aware templates:globalConfigTemplate(~/.odek/config.json, operator-controlled): full schema — now also coveringmax_tool_parallel,prompt_caching,compaction,interaction_mode,tools,skills.auto_save/curation,memory,mcp_servers,web_search,schedules, andmaintenance.localConfigTemplate(./odek.json, untrusted): only fields a project may legitimately set, so a freshodek initloads warning-free. Omitssandbox/sandbox_readonlyentirely (projects may only enable, never disable) and all operator-only sections the loader rejects.Also:
--local/-lflag (equivalent to the default); usage line updated.odek init --global.Tests
TestInitConfig_Local/Global/LocalForcefor the new templates.TestInitConfig_LocalFlag—--localwrites only./odek.json, never the global config.TestInitConfig_LocalTemplateLoadsClean/GlobalTemplateLoadsClean— both templates round-trip throughconfig.FileConfig; the local template carries no operator-only fields and does not pinsandbox/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.md—odek initsection rewritten to document the two templates and which fields belong where.