Skip to content

Init command

Muhammet Şafak edited this page May 27, 2026 · 1 revision

commitbrief init

Scaffold the two review-rules files in the current repo.

Synopsis

commitbrief init [--force]

What it writes

  • <repo-root>/COMMITBRIEF.md — the team-shared review rules, written from the embedded default at internal/rules/default.md. Mode 0644. Commit this to git.
  • <repo-root>/.commitbrief/OUTPUT.md — the per-user output template, written from the embedded default at internal/rules/output.md. Mode 0644. Gitignored by default.

The parent .commitbrief/ directory is created with mode 0700.

Both files fall back to the embedded defaults at runtime, so running init is only necessary when you want to customise the prompt or the output format.

Independent per-file behavior

The two artefacts are independent. If only COMMITBRIEF.md exists (e.g. a customised file from an older release that pre-dated OUTPUT.md), init still writes the missing OUTPUT.md and leaves COMMITBRIEF.md untouched. Each file is processed in isolation:

  • File missing → write from embedded default; log Wrote <path>.
  • File exists, overwrite OFF → log Skipped <path> (already exists; pass --force to overwrite); do not touch.
  • File exists, overwrite ON → overwrite from embedded default; log Wrote <path>.

init only returns an error on real I/O failures. "Already exists" is not an error.

Flags

Flag Notes
--force Overwrite existing files. Same semantic as --yes for this command. Long form only — -f is reserved for the global --file flag.

The global --yes flag also triggers overwrite (back-compat with pre-v1.0 scripts).

Examples

# First-time scaffolding.
commitbrief init

# After upgrading from a pre-OUTPUT.md release — writes the missing
# OUTPUT.md while leaving your customised COMMITBRIEF.md alone.
commitbrief init

# Restore both files to the embedded defaults (destroys customisations).
commitbrief init --force

See also

Clone this wiki locally