|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +This document defines **project-specific assumptions, restrictions, and priorities** for AI agents working in this repository. |
| 4 | +It is intended to be read by both human contributors and AI assistants. |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +## 1. Communication |
| 9 | + |
| 10 | +- **Language** |
| 11 | + - Conversations, explanations, and review comments may be in Japanese or English depending on the user’s preference. |
| 12 | + - Code comments and documentation should follow the existing style in the repo and are **primarily written in English** (e.g. `README.md`). |
| 13 | +- **Tone** |
| 14 | + - Keep explanations **concise and information-dense**. |
| 15 | + - Always leave at least a short note about the motivation or background of non-trivial changes. |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## 2. Project Overview (for AI) |
| 20 | + |
| 21 | +- This package is a **CLI tool to keep git commit messages consistent**. |
| 22 | +- Entry point: `lib/index.js` (wired via `bin.git-consistent`). |
| 23 | +- Main tech stack: |
| 24 | + - Node.js ESM (`"type": "module"`) |
| 25 | + - CLI: `commander`, `inquirer`, `prompt-sync` |
| 26 | + - Configuration: `.git_consistent` (YAML) and `.gitcommit_template` |
| 27 | + - Tests: `ava` |
| 28 | + - Lint / formatting: `eslint` + `prettier` |
| 29 | + |
| 30 | +**Key files / directories** |
| 31 | + |
| 32 | +- `lib/` – CLI implementation |
| 33 | +- `.git_consistent` – sample configuration for user projects |
| 34 | +- `.gitcommit_template` – commit template |
| 35 | +- `test/` – AVA tests |
| 36 | +- `.github/workflows/main.yml` – CI (lint + test) |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## 3. Change Policy and Priorities |
| 41 | + |
| 42 | +- **Do not break existing CLI behavior** |
| 43 | + - When changing flags, prompts, or interactive flows, **update tests and documentation** accordingly. |
| 44 | +- **Treat user-facing surfaces as public API** |
| 45 | + - Command-line options, configuration file format, and template variable names are de facto public API. |
| 46 | + - If compatibility is intentionally broken, update `CHANGELOG.md` and the relevant sections of `README.md`. |
| 47 | +- **Prefer small and safe steps** |
| 48 | + - Before large refactors, introduce internal helpers and additional tests to create a safety net. |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +## 4. Coding Guidelines (for AI-generated code) |
| 53 | + |
| 54 | +- **Style** |
| 55 | + - Use **ES Modules** (`import` / `export`) to match existing code. |
| 56 | + - Follow eslint/prettier for details like semicolons and indentation; do not introduce a custom manual style. |
| 57 | +- **Lint / Format** |
| 58 | + - Write code with `npm run lint` in mind; avoid patterns that will obviously violate rules. |
| 59 | + - Assume `npm run fix` exists for auto-fixes, but do not rely on it to hide poor structure. |
| 60 | +- **Tests** |
| 61 | + - When adding or changing logic, usually add or update **AVA tests in `test/`**. |
| 62 | + - Read existing test names and assertions carefully to avoid breaking their intent. |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | +## 5. `.git_consistent` and `.gitcommit_template` |
| 67 | + |
| 68 | +- These files directly affect users’ commit workflows, so **prioritize compatibility and clarity**. |
| 69 | +- When changing samples: |
| 70 | + - Ensure the examples are consistent with explanations in `README.md`. |
| 71 | + - Ensure the configuration actually works with `git consistent` and produces sensible commit messages. |
| 72 | + |
| 73 | +--- |
| 74 | + |
| 75 | +## 6. Documentation Rules |
| 76 | + |
| 77 | +- When changing CLI options or behavior: |
| 78 | + - Update the relevant sections in `README.md` (for example the **Command Reference**). |
| 79 | + - Add a short note to `CHANGELOG.md` describing the change (in English). |
| 80 | +- If only internal implementation details change and behavior stays the same: |
| 81 | + - README updates are usually unnecessary, but you may add comments or tests to clarify intent. |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +## 7. Special Instructions for AI Agents |
| 86 | + |
| 87 | +- Avoid asking the user for clarification more than necessary; instead, **infer reasonable assumptions** from existing code and `README.md`. |
| 88 | +- For changes that might be controversial or breaking, leave clear reasoning: |
| 89 | + - Potentially breaking changes in behavior or semantics |
| 90 | + - Modifications to CLI interface or configuration format |
| 91 | +- When reasonable, add 1–2 lines explaining **why** a change was made, either here in `AGENTS.md`, in commit messages, or in code comments. |
0 commit comments