Repository navigation
Closed
Description
Goal
Centralize config so both writ and lore consume it from the same place.
Non-Goals
- Refactoring struct design (see Refactor config struct design #68)
- Generating schema from code (see Generate JSON schemas from Go structs #66)
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- RootConfigstruct withLoad()andSave()functions -
lore.go-LoreConfig,Preferences,Sources,CorporateSource -
model.go-ModelConfigwithWithDefaults()method and constants -
registry.go-RegistryConfigwithWithDefaults()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- Useconfig.ModelConfig -
internal/model/config.go- Useconfig.Load(),config.Save(),config.ModelConfig -
internal/lorepackage/registry.go- DELETENewDefault(), single factoryNewRegistry() -
internal/lore/commands.go- Useconfig.ModelConfig -
internal/lore/builder.go- Uselorepackage.NewRegistry() -
internal/e2e/harness.go- Useconfig.ModelConfig -
internal/writ/migrate_cmd.go- Uselorepackage.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 useconfig.ModelConfig{}.WithDefaults() -
internal/lorepackage/registry_test.go- Updated forNewRegistry() - 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: desktopEnvironment 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
go build ./...- ✅ Passesgo test ./...- ✅ All tests passlore config listworkswrit config listworks- Both show same registry/model values
Related
- Generate JSON schemas from Go structs #66 - Generate JSON schemas from Go structs
- Refactor config struct design #68 - Refactor config struct design
Metadata
Metadata
Assignees
Labels
No labels
Activity
feat(config): consolidate configuration into internal/config package
Add tests for unified config (lore/writ config list)
David-Noble-at-work commentedon Feb 6, 2026
PR #69 implements this. Adds unified config tests in
internal/cli/config_test.goverifying thatlore config listandwrit config listshow the same shared config.Consolidate config types into internal/config package (#69)