Add contributor guide and project usage docs

This commit is contained in:
2026-02-16 22:48:05 +09:00
parent 1e552f8c46
commit 87482efd6d
16 changed files with 671 additions and 1 deletions

44
AGENTS.md Normal file
View File

@@ -0,0 +1,44 @@
# Repository Guidelines
## Project Structure & Module Organization
This project uses a `src/` layout:
- `src/lazy_enter/`: application code (`bridge.py`, `slack_handler.py`, `pty_manager.py`, `config.py`, `hooks.py`)
- `tests/`: `pytest` test suite (`test_*.py` files)
- `pyproject.toml`: packaging, lint, type-check, and test configuration
- `.env.example`: environment variable template for local setup
Use module boundaries intentionally: `bridge.py` orchestrates flow, while Slack, PTY, config, and hook parsing stay in their dedicated modules.
## Build, Test, and Development Commands
- `pip install -e .`: install the package in editable mode for local development.
- `python -m lazy_enter` or `lazy-enter`: run the bridge locally.
- `pytest`: run all tests.
- `pytest tests/test_hooks.py -v`: run one test file with verbose output.
- `ruff check src/ tests/`: lint imports and code quality rules.
- `ruff format src/ tests/`: apply standard formatting.
- `mypy src/`: run strict static type checks.
## Coding Style & Naming Conventions
Target runtime is Python 3.10+ with 4-space indentation and type hints on public functions.
Follow `ruff` rules (`E`, `F`, `I`, `N`, `W`, `UP`) and keep imports sorted.
Naming patterns:
- modules/files: `snake_case.py`
- functions/variables: `snake_case`
- classes: `PascalCase`
- constants/env keys: `UPPER_SNAKE_CASE`
## Testing Guidelines
Use `pytest` with tests under `tests/` and names matching `test_*.py` (configured in `pyproject.toml`).
Prefer focused unit tests per module (see `tests/test_hooks.py`, `tests/test_config.py`).
For bug fixes, add or update a regression test in the matching test file before finalizing.
## Commit & Pull Request Guidelines
Current git history is minimal (`Initial commit`), so enforce clear conventions now:
- Commit messages: imperative, concise subject (e.g., `Add Slack user/channel guard`).
- Keep commits scoped to one logical change.
- PRs should include: problem summary, what changed, test evidence (`pytest`, `ruff`, `mypy`), and linked issue/context.
- Include screenshots or log snippets when behavior changes are user-visible (for example, Slack message formatting).
## Security & Configuration Tips
Do not commit secrets. Copy `.env.example` to `.env` locally.
Restrict Slack access with `SLACK_ALLOWED_USER_ID` and `SLACK_ALLOWED_CHANNEL_ID` before running in shared workspaces.