Skip to content

Consolidate config types into internal/config package - #69

Merged
David-Noble-at-work merged 3 commits into
developfrom
feature/config-consolidation-67
Feb 6, 2026
Merged

David-Noble-at-work merged 3 commits into
developfrom
feature/config-consolidation-67

Conversation

@David-Noble-at-work

Copy link
Copy Markdown
Contributor

Summary

  • Centralizes configuration into internal/config/ package so both lore and writ consume config from the same place
  • Shared resources (model, registry) and runtime options (verbosity, dry_run) at root level
  • Tool-specific settings nested under lore and writ keys
  • rclone-style environment variable naming: DEVLORE_ + config path, uppercase, underscores
  • Single verbosity field with values quiet, normal, verbose (replaces separate verbose/quiet bools)

Config Package Structure

internal/config/
├── config.go    # Root Config struct, Load(), Save()
├── lore.go      # LoreConfig, Preferences, Sources
├── model.go     # ModelConfig with defaults
├── registry.go  # RegistryConfig with defaults
└── writ.go      # WritConfig (Segments, Vars)

Unified Config Verification

Tests in internal/cli/config_test.go verify that lore config list and writ config list show the same unified config:

  • TestSharedConfigPath - Both tools use same config path
  • TestUnifiedConfig_BothToolsSeeSharedSettings - Shared settings visible to both
  • TestUnifiedConfig_ToolSpecificSettingsVisible - Tool-specific settings accessible
  • TestConfigListOutput_SameForBothTools - Identical output from both tools

Test plan

  • go test ./... passes
  • lore config list and writ config list use shared config path
  • Environment variable overrides work (DEVLORE_*)
  • API keys stored in native keystore, not config file

Closes #67

David Noble added 3 commits February 5, 2026 20:54
Centralize config so both lore and writ consume it from the same place.

Changes:
- New internal/config/ package with Config, ModelConfig, RegistryConfig,
  LoreConfig, WritConfig types
- Single Verbosity field (quiet/normal/verbose) replaces separate
  verbose and quiet booleans
- rclone-style environment variable naming: DEVLORE_ + config path
  (e.g., DEVLORE_MODEL_NAME instead of DEVLORE_MODEL)
- Delete duplicate loaders: model.LoadConfig/SaveConfig removed,
  all callers use config.Load/Save
- Delete lorepackage.NewDefault(), callers use NewRegistry()
- Comprehensive test coverage for config package (10 tests)

Environment variables:
- DEVLORE_VERBOSITY (quiet/normal/verbose)
- DEVLORE_DRY_RUN
- DEVLORE_MODEL_PROVIDER, DEVLORE_MODEL_NAME, DEVLORE_MODEL_ENDPOINT,
  DEVLORE_MODEL_API_KEY
- DEVLORE_REGISTRY_URL, DEVLORE_REGISTRY_BRANCH

Closes #67
Adds test file internal/cli/config_test.go with tests verifying that
both lore and writ read from the same shared config file and display
identical output for 'config list'.

Tests cover:
- Shared config path consistency
- Visibility of shared settings (model, registry, verbosity)
- Visibility of tool-specific settings (lore.*, writ.*)
- Config set/unset operations for all paths
- Edge cases (empty file, directory creation)

Part of #67 config consolidation.
@David-Noble-at-work
David-Noble-at-work merged commit 8f0c27f into develop Feb 6, 2026
1 check passed
@David-Noble-at-work
David-Noble-at-work deleted the feature/config-consolidation-67 branch February 6, 2026 06:00
David-Noble-at-work added a commit that referenced this pull request Jul 28, 2026
… the stated mechanism (#302)

The #300 live proof cut both ways: the --admin merge worked (site PR
#211, merged by the app with checks pending and zero reviews), then the
very next run's merge died on a GitHub 502 and stranded site PR #212
open with green checks. All three sync merges (docs, install script,
registry knowledge) now run in a bounded retry loop — 5 attempts,
10/20/30/40s backoff — that consults the PR state before retrying,
since a 5xx can arrive after the merge landed server-side.

The registry merge also gains --admin: devlore-registry develop sits
under the same org ruleset, and the plain merge already failed live —
registry PR #69 was app-created, its Knowledge Extract run failed on
the merge step, and the PR was merged by hand two minutes later.

Comments corrected: --admin disarms gh's client-side merge-state veto;
the server-side entitlement is the automation app's "always" bypass on
the org ruleset, not repository admin rights. Correction noted in
docs/plans/ci-admin-merge-sync-prs.md.

Workflow-only change; the live proof is the next sync chain run. Plan:
docs/plans/ci-sync-merge-retry.md.

Co-authored-by: David Noble <[email protected]>
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.

Consolidate config types into unified internal/config/ package

1 participant