Skip to content

feat: add config init scaffolding and shared config file writer#35

Merged
jy-tan merged 2 commits intomainfrom
config-init
Feb 11, 2026
Merged

feat: add config init scaffolding and shared config file writer#35
jy-tan merged 2 commits intomainfrom
config-init

Conversation

@jy-tan
Copy link
Contributor

@jy-tan jy-tan commented Feb 10, 2026

Summary

Add a first-class fence config init flow to bootstrap usable config files and refactor config JSON/file rendering into internal/config so both init and import share the same writer primitives while preserving import-specific output behavior.

Resolves #34.

Changes

  • Add fence config init with support for --template, --minimal, --output, --force, and --print.
  • Add --scaffold mode to generate properly indented JSON with empty hint arrays for editable sections.
  • Add init-specific top-of-file guidance comments (distinct wording from import comments) for files written by config init.
  • Refactor config file rendering/writing into internal/config/config_file.go via shared APIs (MarshalConfigJSON, FormatConfigForFile, WriteConfigFile).
  • Keep fence import behavior stable by retaining importer wrappers and import-specific header comments while delegating rendering/writing to internal/config.
  • Add/expand tests in cmd/fence/main_test.go and new internal/config/config_file_test.go; update docs in README.md and docs/quickstart.md.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 7 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="internal/config/config_file.go">

<violation number="1" location="internal/config/config_file.go:30">
P2: Filesystem config serialization drops AllowRead/AllowExecute/DefaultDenyRead/WSLInterop, so writing a config will silently lose these settings. Include these fields in the clean filesystem struct and update the empty-check logic to preserve them.</violation>

<violation number="2" location="internal/config/config_file.go:45">
P2: SSH configuration is never serialized, so any SSH rules in a config are silently lost when writing the file. Add a clean SSH struct and include cfg.SSH in MarshalConfigJSON/empty checks.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@jy-tan jy-tan merged commit ed4b4a5 into main Feb 11, 2026
8 of 9 checks passed
@jy-tan jy-tan deleted the config-init branch February 11, 2026 00:22
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.

Provide a way for users to easily create their first config

1 participant