Config: TOML config and state, token resolution, host selection #5

Closed
opened 2026-10-01 21:55:16 -05:00 by deadstyle · 2 comments
Owner

Problem

lazyforge needs to know which forge to talk to and how to sign in, and it has to save that as TOML. This ticket is the config layer. The onboarding, Settings and host-picker screens on top of it moved to #24.

Plan

  1. internal/config: load and save config.toml and state.toml as described in ADR 0004 (atomic writes; 0600 and a permission check whenever a pasted token is stored; XDG paths). Validation errors name the field.
  2. Token resolution: run token_cmd through sh -c with a timeout, or use the stored token. Tokens are never logged and never appear in error strings.
  3. Merge-gating setting: "only merge when CI is green", per host with a per-repo override, off by default (PM decision, #13). Config shape: require_green_ci on the host, plus a per-repo override table.
  4. Host selection: --host, then the only configured host, then default_host, otherwise report that the picker is needed (#24 builds it). --config <path> overrides the config location.

Depends on

#4 (merged).

Context

  • ADR 0004 (TOML, no database, token handling), docs/architecture.md → "Configuration and stored state".
  • go-development → I/O, context and secrets. The TOML dependency (BurntSushi/toml) is already approved in ADR 0004.

Out of scope

OS keyring storage (later). All screens (#24).

## Problem lazyforge needs to know which forge to talk to and how to sign in, and it has to save that as TOML. This ticket is the config layer. The onboarding, Settings and host-picker screens on top of it moved to #24. ## Plan 1. **`internal/config`:** load and save `config.toml` and `state.toml` as described in ADR 0004 (atomic writes; `0600` and a permission check whenever a pasted token is stored; XDG paths). Validation errors name the field. 2. **Token resolution:** run `token_cmd` through `sh -c` with a timeout, or use the stored `token`. Tokens are never logged and never appear in error strings. 3. **Merge-gating setting:** "only merge when CI is green", per host with a per-repo override, off by default (PM decision, #13). Config shape: `require_green_ci` on the host, plus a per-repo override table. 4. **Host selection:** `--host`, then the only configured host, then `default_host`, otherwise report that the picker is needed (#24 builds it). `--config <path>` overrides the config location. ## Depends on #4 (merged). ## Context - ADR 0004 (TOML, no database, token handling), `docs/architecture.md` → "Configuration and stored state". - `go-development` → I/O, context and secrets. The TOML dependency (`BurntSushi/toml`) is already approved in ADR 0004. ## Out of scope OS keyring storage (later). All screens (#24).
deadstyle changed title from Config file, token_cmd and host selection to Onboarding, Settings screen and TOML config 2026-10-01 22:08:47 -05:00
deadstyle changed title from Onboarding, Settings screen and TOML config to Config: TOML config and state, token resolution, host selection 2026-10-02 12:01:19 -05:00
Author
Owner

🤖 Split: this ticket bundled the config layer with three screens (onboarding, Settings, host picker). The screens should follow the UI patterns #8 sets, so they moved to #24, which depends on #5 and #8. #5 is now the config layer only, and it can land before the UI exists.

🤖 Split: this ticket bundled the config layer with three screens (onboarding, Settings, host picker). The screens should follow the UI patterns #8 sets, so they moved to #24, which depends on #5 and #8. #5 is now the config layer only, and it can land before the UI exists.
Author
Owner

🤖 Merged in #25. Settings and remembered values are saved as TOML, the sign-in token comes from the command or a 0600 file, and the host is chosen by --host, then the only host, then default_host. The 'only merge when CI is green' setting is per host with a per-repo override, off by default. The screens are in #24.

🤖 Merged in #25. Settings and remembered values are saved as TOML, the sign-in token comes from the command or a 0600 file, and the host is chosen by --host, then the only host, then default_host. The 'only merge when CI is green' setting is per host with a per-repo override, off by default. The screens are in #24.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
deadstyle/lazyforge#5
No description provided.