Skip to content

feat: config versioning + forge config get/set commands (#66, #74)#98

Merged
alohays merged 3 commits intomainfrom
feat/config-version-getset
Mar 19, 2026
Merged

feat: config versioning + forge config get/set commands (#66, #74)#98
alohays merged 3 commits intomainfrom
feat/config-version-getset

Conversation

@alohays
Copy link
Owner

@alohays alohays commented Mar 19, 2026

Summary

  • Add version field to config schema (default: '1') for future migration support
  • New forge config get <path> command — sub-tree accessor returning scalar or JSON object
  • New forge config set <path> <value> command — scalar setter with JSON.parse type detection, Zod validation, and stripped-key warnings for unknown paths
  • loadConfig() backfills missing version field with warning for pre-v0.3 configs
  • CLI version now derived from package.json (eliminates drift)
  • Version bumped to 0.3.0
  • All 15 presets updated with version: '1'

Test plan

  • forge config get monitor.name returns correct value
  • forge config get monitor returns full sub-tree as JSON
  • forge config set map.zoom 5 sets number (not string)
  • forge config set map.zoom abc fails with Zod validation error
  • forge config set monitor.nonexistent foo emits stripped-key warning
  • forge init --template tech-minimal --force stamps version: '1'
  • forge --version outputs 0.3.0 (from package.json)
  • Pre-v0.3 configs without version load with backfill warning
  • 356 tests pass, 0 typecheck errors
  • 13 new tests for config get/set commands

Closes #66, closes #74

🤖 Generated with Claude Code

alohays and others added 2 commits March 20, 2026 00:11
Add schema version field for future migration support and new CLI
commands for reading/writing config values by dot-notation path.

- Add `version` field (default: '1') to MonitorForgeConfigSchema
- loadConfig() backfills missing version with warning for pre-v0.3 configs
- New `forge config get <path>` — sub-tree accessor (scalar or object)
- New `forge config set <path> <value>` — scalar setter with JSON.parse
  type detection, Zod validation, and stripped-key warnings
- Derive CLI version from package.json (eliminate drift)
- Bump package version to 0.3.0
- Add version field to all 15 presets
- 13 new tests for config commands (356 total, 0 type errors)

Closes #66, closes #74

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add forbidden-key validation for __proto__, constructor, and prototype
segments in dot-path parsing. Remove redundant JSON.parse deep-copy
since setByPath already uses structuredClone.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alohays
Copy link
Owner Author

alohays commented Mar 19, 2026

Code review

Found 1 issue:

  1. config set success response missing next_steps field. Every other mutating command (source add, panel add, view add, theme set) includes next_steps: ['forge validate', 'forge dev'] in its success output. The config set command omits this, breaking the output contract documented in forge/AGENTS.md which specifies the JSON contract includes next_steps.

console.log(formatOutput(
success('config set', { path: dotPath, value }, {
changes: [{ type: 'modified', file: 'monitor-forge.config.json', description: `Set ${dotPath} = ${JSON.stringify(value)}` }],
warnings,
}),
format,
));

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

Match the output contract from forge/AGENTS.md and the pattern used by
all other mutating commands (source add, panel add, view add, theme set).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alohays alohays merged commit 01ed324 into main Mar 19, 2026
1 check passed
@alohays alohays deleted the feat/config-version-getset branch March 19, 2026 15:40
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.

feat: forge config get/set commands feat: config version field

1 participant