Skip to content

CLI ​

The Typer-based CLI is the most common entry point for local use.

Install ​

bash
uv sync

occam-gitignore is registered as a workspace script.

generate ​

bash
uv run occam-gitignore generate <PATH> [OPTIONS]

Walks the given path, fingerprints features, and writes a .gitignore to <PATH>/.gitignore (unless --stdout).

Options ​

FlagTypeDefaultDescription
--templates DIRpathdata/templatesDirectory of <feature>.gitignore files
--rules-table FILEpathdata/rules_table.jsonMined rules table
--no-commentsflagfalseSuppress header and section comments
--provenanceflagfalseAppend # <feature> to each rule
--extra PATTERNrepeatnoneAdd a user pattern (sorted last)
--stdoutflagfalsePrint to stdout instead of writing a file

Example ​

bash
uv run occam-gitignore generate ./services/api \
  --provenance \
  --extra "secrets/" \
  --extra "*.env.local"

inspect ​

bash
uv run occam-gitignore inspect <PATH>

Prints the fingerprint result without generating a file. Useful when you want to check what was detected before committing to an output.

version ​

bash
uv run occam-gitignore version

Prints core_version and the loaded rules_table_version.

Exit codes ​

CodeMeaning
0Success
1Generic error (I/O, missing template)
2Argument parsing error (Typer default)

Released under the MIT License. · Privacy & legal