Skip to content

Consolidate config types into unified internal/config/ package #67

Closed

Description

@David-Noble-at-work

Goal

Centralize config so both writ and lore consume it from the same place.

Non-Goals

Important: No Legacy

We have no legacy. We do not need aliases or any concern for backwards compatibility. We are in a period of rapid change. It is dangerous to leave anything that smacks of preserving legacy.

When migrating code:

  • Delete old types completely
  • Update all callers to use new types directly
  • No type aliases
  • No deprecation warnings
  • No shims or adapters

Deliverables

Code Changes

New Config Package (internal/config/)

  • config.go - Root Config struct with Load() and Save() functions
  • lore.go - LoreConfig, Preferences, Sources, CorporateSource
  • model.go - ModelConfig with WithDefaults() method and constants
  • registry.go - RegistryConfig with WithDefaults() method and constants
  • writ.go - WritConfig
  • config_test.go - Comprehensive tests for Load, Save, env overrides

Migrations (delete old types, update callers)

  • internal/model/provider.go - Use config.ModelConfig
  • internal/model/config.go - Use config.Load(), config.Save(), config.ModelConfig
  • internal/lorepackage/registry.go - DELETE NewDefault(), single factory NewRegistry()
  • internal/lore/commands.go - Use config.ModelConfig
  • internal/lore/builder.go - Use lorepackage.NewRegistry()
  • internal/e2e/harness.go - Use config.ModelConfig
  • internal/writ/migrate_cmd.go - Use lorepackage.NewRegistry()

Schema Updates

  • schema/devlore-config.json - Updated with shared resources and rclone-style env var naming

Tests

  • internal/config/config_test.go - 10 comprehensive tests
  • internal/model/provider_test.go - Updated to use config.ModelConfig{}.WithDefaults()
  • internal/lorepackage/registry_test.go - Updated for NewRegistry()
  • All existing tests pass (go test ./...)

Config Structure

# Shared runtime options
verbosity: quiet | normal | verbose  # replaces verbose + quiet bools
dry_run: false

# Shared resources (used by both lore and writ)
model:
  provider: anthropic
  name: claude-sonnet-4-20250514
  endpoint: ""  # optional
  api_key: ""   # prefer native keystore

registry:
  url: https://github.com/NobleFactor/devlore-registry.git
  branch: develop
  force_tags: false

# Tool-specific configuration
lore:
  preferences:
    shell: zsh
    # ... other preferences
  sources:
    corporate: []

writ:
  segments: [ROLE, SITE]
  vars:
    ROLE: desktop

Environment Variables (rclone-style)

Naming convention: DEVLORE_ + config path with underscores, uppercase.

Config Path Environment Variable
verbosity DEVLORE_VERBOSITY
dry_run DEVLORE_DRY_RUN
model.provider DEVLORE_MODEL_PROVIDER
model.name DEVLORE_MODEL_NAME
model.endpoint DEVLORE_MODEL_ENDPOINT
model.api_key DEVLORE_MODEL_API_KEY
registry.url DEVLORE_REGISTRY_URL
registry.branch DEVLORE_REGISTRY_BRANCH

Verification

  1. go build ./... - ✅ Passes
  2. go test ./... - ✅ All tests pass
  3. lore config list works
  4. writ config list works
  5. Both show same registry/model values

Related

Activity

  1. added 2 commits that reference this issue on Feb 6, 2026
    f74409a
    2a34687
  2. David-Noble-at-work commented on Feb 6, 2026

    @David-Noble-at-work
    ContributorAuthor

    PR #69 implements this. Adds unified config tests in internal/cli/config_test.go verifying that lore config list and writ config list show the same shared config.

  3. added a commit that references this issue on Feb 6, 2026
    8f0c27f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions