Skip to content

feat: add bootcamp init to scaffold a config file#49

Merged
Arthur742Ramos merged 1 commit into
mainfrom
arthur742ramos/init-command-pr
Jun 11, 2026
Merged

feat: add bootcamp init to scaffold a config file#49
Arthur742Ramos merged 1 commit into
mainfrom
arthur742ramos/init-command-pr

Conversation

@Arthur742Ramos

Copy link
Copy Markdown
Owner

Summary

Adds a bootcamp init command that scaffolds a .bootcamprc.json configuration file in the current directory, so users can customize style, defaults, prompts, and excluded docs without hand-writing config from scratch.

Usage

bootcamp init                          # write .bootcamprc.json
bootcamp init --print                  # preview on stdout, write nothing
bootcamp init --force                  # overwrite an existing config
bootcamp init --style corporate --path bootcamp.config.json

Behavior

  • Writes .bootcamprc.json (or --path) using the existing generateExampleConfig() template
  • Refuses to overwrite an existing file unless --force
  • --print writes to stdout instead of disk (handy for piping/inspection)
  • --style presets a built-in pack and is validated against the known packs

Implementation note

The root command already defines -s, --style, so Commander routes a bare --style to the root rather than the subcommand. This is the same collision the diff command handles for --output, so init reuses the existing getCliFlagValue helper to read --style reliably.

Changes

  • src/commands/init-command.tsrunInitCommand() + buildInitConfig()
  • src/cli.ts — registers the init subcommand
  • Docs: README (config section + commands table) + CHANGELOG

Testing

  • test/init-command.test.ts — 9 unit tests (default write, overwrite guard, --force, --print, invalid style, style embedding, custom path, buildInitConfig) with mocked fs/promises
  • test/e2e/init-command.e2e.test.ts — 4 real-CLI e2e tests in an isolated temp cwd (scaffold + overwrite guard + --force, --print, --style/--path, invalid style)
  • Added an init subcommand assertion to the CLI wiring test
  • Local validation: lint ✓, typecheck ✓, build ✓, full unit suite 1049 passing, coverage above thresholds (init-command.ts ~91%), all e2e ✓

Scaffold a .bootcamprc.json in the current directory so users can customize style, defaults, prompts, and excluded docs without hand-writing config.

- --force to overwrite, --print to preview on stdout, --path for a custom location, --style to preset a built-in pack
- Reuses generateExampleConfig(); validates --style against known packs
- Routes --style via getCliFlagValue to avoid the root --style option collision (same pattern as diff --output)
- Unit tests (mocked fs) + real-CLI e2e tests in an isolated temp cwd
- README + CHANGELOG updates

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Arthur742Ramos Arthur742Ramos merged commit e09e8bf into main Jun 11, 2026
13 checks passed
@Arthur742Ramos Arthur742Ramos deleted the arthur742ramos/init-command-pr branch June 11, 2026 17:15
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.

2 participants