Skip to Content
AgentsGit history hygiene (for humans & coding agents)

Git history hygiene (for humans & coding agents)

This repository uses small, coherent commits so history is reviewable, bisect-friendly, and each change maps to one concern. Agents should follow this method whenever they introduce or change features.

Principles

  1. One concern per commit — A commit touches one vertical slice (e.g. one command + its user-facing doc) or one horizontal layer (e.g. logger policy only) — not unrelated refactors mixed with features.
  2. Code + docs together — When you add or change a CLI command, include docs/commands/<slug>/README.md (and docs/commands/README.md index row if new) in the same commit as the implementation. Users and the docs site stay aligned.
  3. Tests with the feature — Unit tests for a module ship with that module’s commit. Integration tests that cover several commands can land in a dedicated test: commit after the commands exist, or with the last command they need.
  4. Messages — Prefer Conventional Commits : feat(validate): …, fix(sync): …, docs(generate): …, chore: …, test: …, refactor(core): ….
  5. No drive-by churn — Do not reformat unrelated files or rename symbols outside the stated scope of the commit.

What to bundle

Change typeInclude in the same commit
New / updated commandpackages/cli/src/commands/..., packages/cli/src/types/command/... if any, packages/cli/bin/cli.ts registration lines for that command, docs/commands/.../README.md, packages/cli/src/utils/cli/banner.ts / packages/cli/src/constants/docs.ts if new slug
Global CLI flagpackages/cli/bin/cli.ts, packages/cli/src/core/context/* or packages/cli/src/core/runtime/*, docs/cli/* or docs/behavior/* as appropriate
Config fieldpackages/cli/src/config/schema.ts, packages/cli/src/types/config/*, i18nprune.config.ts.example, docs/config/*
Report / output contractpackages/cli/src/utils/report/*, consumers, docs/commands/report/README.md

packages/cli/bin/cli.ts

The CLI entry registers all commands in one file. Options:

  • Incremental history: Each command commit adds only the program.command(...) block (and shared preAction updates) needed for that command. Final commits still touch packages/cli/bin/cli.ts often — that is acceptable.
  • Single wiring commit: Implement commands in separate commits without registering them, then one commit feat(cli): register <list> commands — only works if you tolerate temporary dead code or feature branches; usually not preferred on main.

Preferred: Register each command in the same commit as its implementation so the tree always runs.

Proposed commit plan (fresh git init)

Use this order after git init (or to reconstruct a clean history from a single working tree). Adjust paths if your tree differs. Do not treat this as a one-shot script — run commits one at a time and verify pnpm typecheck / pnpm test where noted.

Layer 0 — Repository metadata

  1. chore: add package metadata and build tooling
    package.json, pnpm-lock.yaml, tsconfig.json, tsup.config.ts, vitest.config.ts, .gitignore, LICENSE, README.md (minimal stub without agent section if you prefer a later docs commit).

Layer 1 — Types & constants

  1. feat(types): add shared command and config typespackages/cli/src/types/** (excluding command-specific folders until those commands exist, or add all packages/cli/src/types if already present).
  2. feat(constants): add CLI and docs URL constantspackages/cli/src/constants/**.

Layer 2 — Config & context

  1. feat(config): schema, load, resolve, and defineConfig exportpackages/cli/src/config/**, packages/cli/src/exports/config.ts, i18nprune.config.ts.example.
  2. feat(core): context, runtime options, errors, globalspackages/cli/src/core/context/**, packages/cli/src/core/runtime/**, packages/cli/src/core/errors/**, packages/cli/src/core/context/globals.ts (or equivalent).

Layer 3 — Domain core (shared)

  1. feat(core): JSON path, merge, prune, leavespackages/cli/src/core/json/**.
  2. feat(core): languages catalog and normalizationpackages/cli/src/core/languages/**.
  3. feat(core): extractor, scanner, dynamic key heuristicspackages/cli/src/core/extractor/**, packages/cli/src/core/scanner/**, packages/cli/src/core/extractor/dynamic/**, packages/cli/src/core/constmap/** if present.
  4. feat(core): translator, progress, parity helperspackages/cli/src/core/translator/**, packages/cli/src/core/progress/**, packages/cli/src/core/parity/**, packages/cli/src/providers/**.

Layer 4 — Utilities & CLI infrastructure

  1. feat(utils): fs, rg, ansi, style, width, interactivepackages/cli/src/utils/fs, packages/cli/src/utils/rg, packages/cli/src/utils/ansi, packages/cli/src/utils/style, packages/cli/src/utils/width, packages/cli/src/utils/interactive, etc.
  2. feat(cli): logger policy and loggerpackages/cli/src/utils/logger/**, packages/cli/src/types/core/logger/**.
  3. feat(cli): argv preprocessing and help stylingpackages/cli/src/argv/**, packages/cli/src/commands/help/**, packages/cli/src/utils/help/**, packages/cli/src/utils/cli/path.ts, packages/cli/src/utils/cli/banner.ts.
  4. feat(cli): locale args helperspackages/cli/src/utils/cli/args.ts, packages/cli/src/utils/cli/__tests__/args.test.ts.
  5. feat(utils): structured report file writerpackages/cli/src/utils/report/**, packages/cli/src/core/context/report.ts, packages/cli/src/utils/report/types.ts.

Layer 5 — Commands (each: implementation + types + docs + bin slice)

For each row, include the matching docs/commands/.../README.md and the packages/cli/bin/cli.ts block that registers the command (and locales subcommands as you add them).

  1. feat(init): init commandpackages/cli/src/commands/init/** or packages/cli/src/config/init/**, docs/commands/init/README.md, packages/cli/bin/cli.ts.
  2. feat(config): config commandpackages/cli/src/commands/config/**, docs/commands/config/README.md, packages/cli/bin/cli.ts.
  3. feat(validate): validate commandpackages/cli/src/commands/validate/**, packages/cli/src/types/command/validate/**, docs/commands/validate/README.md, packages/cli/bin/cli.ts.
  4. feat(sync): sync command and human summarypackages/cli/src/commands/sync/**, packages/cli/src/types/command/sync/**, docs/commands/sync/README.md, packages/cli/bin/cli.ts.
  5. feat(generate): generate command and promptspackages/cli/src/commands/generate/**, packages/cli/src/types/command/generate/**, docs/commands/generate/README.md, packages/cli/bin/cli.ts.
  6. feat(fill): fill commandpackages/cli/src/commands/fill/**, packages/cli/src/types/command/fill/**, docs/commands/fill/README.md, packages/cli/bin/cli.ts.
  7. feat(quality): quality commandpackages/cli/src/commands/quality/**, packages/cli/src/types/command/quality/**, docs/commands/quality/README.md, packages/cli/bin/cli.ts.
  8. feat(review): review commandpackages/cli/src/commands/review/**, packages/cli/src/types/command/review/**, docs/commands/review/README.md, packages/cli/bin/cli.ts.
  9. feat(cleanup): cleanup commandpackages/cli/src/commands/cleanup/**, packages/cli/src/types/command/cleanup/**, docs/commands/cleanup/README.md, packages/cli/bin/cli.ts.
  10. feat(languages): languages commandpackages/cli/src/commands/languages/**, docs/commands/languages/README.md, packages/cli/bin/cli.ts.
  11. feat(locales): locales list, edit, dynamic, deletepackages/cli/src/commands/locales/**, docs/commands/locales/README.md, docs/commands/locales/list|edit|dynamic|delete/README.md, packages/cli/bin/cli.ts.
  12. feat(report): report help topicpackages/cli/src/commands/report/**, docs/commands/report/README.md, packages/cli/bin/cli.ts.
  13. feat(doctor): doctor commandpackages/cli/src/commands/doctor/**, docs/commands/doctor/README.md, packages/cli/bin/cli.ts.
  14. feat(help): help commandpackages/cli/src/commands/help/**, docs/commands/help/README.md, packages/cli/bin/cli.ts.

Layer 6 — Exports, tests, docs site

  1. feat(exports): add core library exportpackages/cli/src/exports/core.ts, packages/cli/src/core/** public surface if split.
  2. test: add integration and config teststests/**, packages/cli/src/**/__tests__/** not already committed.
  3. docs: command index and cross-linksdocs/commands/README.md, docs/behavior/commands.md, docs/README.md, docs/roadmap/README.md, etc.
  4. chore(docs-site): sync script and site assetsapps/docs/scripts/sync-content.js, apps/docs/** as tracked (exclude node_modules, .next, out), document pnpm docs:sync.
  5. docs(agents): contributor and agent guidesdocs/agents/**, links from root README.md and docs/README.md.

Optional final polish

  1. chore: scripts and fixture appscripts/**, tests/fixtures/** if kept separate.

After .git was removed

If history was discarded on purpose, run git init, then apply the plan above in order. First commit should establish main (or your default branch name):

git init -b main git add <files-for-commit-1> git commit -m "chore: add package metadata and build tooling" # …repeat

Checklist before pushing

  • pnpm typecheck
  • pnpm test
  • pnpm run build
  • If docs changed: pnpm docs:sync and commit apps/docs/content if your workflow tracks it

See also: Analysis for project structure and Contributors README.