- Source:
src/— CLI entry (src/cli.ts), subcommands insrc/commands/, helpers insrc/utils/. - Tests:
tests/— specs undertests/specs/, fixtures intests/fixtures/, runner attests/index.ts. - Build output:
dist/— compiled.mjsshipped viabin(aicommit,aic). - Config: optional project-level
.ai-commit.jsonat repo root to add context and override defaults.
npm run build— bundle TypeScript withpkgrolland minify todist/.npm test— run test suite withtsx+manten.npm run lint— lint codebase with ESLint (@typescript-eslint).npm run type-check— TypeScript type checking without emit.
Example local workflow:
npm ci
npm run lint && npm run type-check
npm test
npm run build
- Language: TypeScript (ESM). Prefer explicit exports; avoid default exports in new code.
- Indentation: spaces; 4 spaces per
.editorconfig(YAML uses 2). - Linting: ESLint with
@typescript-eslint(see.eslintrc.cjs). Fix or justify warnings. - Names:
kebab-casefiles for CLIs/commands (e.g.,prepare-commit-msg-hook.ts),camelCasefunctions,PascalCasetypes. - Paths: keep new commands in
src/commands/and utilities insrc/utils/.
- Frameworks:
mantentest runner; executed viatsx. - Location: place new specs in
tests/specs/mirroringsrc/paths. - Names: prefer descriptive test names; one behavior per
it. - Run:
npm test. Aim to keep tests hermetic; usetests/fixtures/for filesystem cases.
- Commits: follow Conventional Commits (e.g.,
feat: ...,fix: ...,docs: ...,refactor: ...,chore: ...). Keep subject ≤ 72 chars; imperative mood. - PRs: include a clear description, linked issues (
Closes #123), and before/after output for CLI-facing changes. Add test coverage for new behavior. - Scope small and focused; update README or inline help when user-facing changes occur.
- Do not commit secrets. Configure API keys with
aicommit config set OPENAI_KEY=...(not.env). - If adding new configuration, document keys in README and support overrides via
.ai-commit.json.