-
Notifications
You must be signed in to change notification settings - Fork 0
chore: repo audit and docs refresh #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Commands | ||
|
|
||
| All tasks use [poethepoet](https://github.com/nat-n/poethepoet). Run with `poe <task>` or `poetry run poe <task>`: | ||
|
|
||
| ```bash | ||
| poe check # lint + format-check + typecheck + non-E2E tests (run before pushing) | ||
| poe lint # ruff check | ||
| poe format # ruff format (auto-fix) | ||
| poe typecheck # mypy src/planpilot | ||
| poe test # pytest -v --ignore=tests/e2e (includes coverage report) | ||
| poe test-e2e # offline E2E suite (tests/e2e/test_cli_e2e.py) | ||
| poe docs-links # validate internal markdown links | ||
| poe workflow-lint # actionlint on .github/workflows/ | ||
| ``` | ||
|
|
||
| Run a single test file: | ||
| ```bash | ||
| poetry run pytest tests/engine/test_engine.py -v | ||
| ``` | ||
|
|
||
| Run a single test by name: | ||
| ```bash | ||
| poetry run pytest tests/engine/test_engine.py -v -k "test_discovery" | ||
| ``` | ||
|
|
||
| Regenerate the GitHub GraphQL client (requires `gh` auth): | ||
| ```bash | ||
| poe gen-gql | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| planpilot is a CLI/SDK that syncs structured plan files (epics/stories/tasks) to GitHub Issues + Projects v2. It follows a strict layered architecture with downward-only dependencies: | ||
|
|
||
| ``` | ||
| Contracts → Core → SDK → CLI | ||
| ``` | ||
|
|
||
| **Contracts** (`src/planpilot/core/contracts/`) — Pure Pydantic models and ABCs. Six domains: `plan`, `item`, `sync`, `config`, `provider`, `renderer`. The `Provider` and `BodyRenderer` ABCs live here (not in Core) because they define what the system needs, not how it works. | ||
|
|
||
| **Core** (`src/planpilot/core/`) — Runtime business logic. Key modules: | ||
| - `engine/engine.py` — `SyncEngine`: 5-phase async pipeline (Discovery → Upsert → Enrich → Relations → Result). Epics/stories/tasks are processed sequentially by type level; operations within a level run concurrently via `asyncio.TaskGroup` gated by `asyncio.Semaphore(config.max_concurrent)`. | ||
| - `plan/` — JSON plan loading, relational validation (`PlanValidator`), deterministic hashing (`PlanHasher`). | ||
| - `providers/github/` — GitHub REST+GraphQL adapter. The GraphQL client under `providers/github/github_gql/` is **generated** by `ariadne-codegen` — do not hand-edit it. | ||
| - `providers/dry_run.py` — In-memory `DryRunProvider` used in `--dry-run` mode; no external API calls. | ||
| - `renderers/markdown.py` — `MarkdownRenderer`: renders issue bodies with a `PLANPILOT_META_V1` block at the top for idempotent discovery. | ||
|
|
||
| **SDK** (`src/planpilot/sdk.py`) — The sole composition root. `PlanPilot.from_config()` wires all Core domains together. This is the only place that sees all Core modules simultaneously. Re-exports selected Contracts types for external callers. | ||
|
|
||
| **CLI** (`src/planpilot/cli/`) — Thin I/O wrapper. Imports only from the SDK public API and `cli/persistence/`. Never imports Core directly. | ||
|
|
||
| ## Key Conventions | ||
|
|
||
| - **Layer discipline**: CLI → SDK only. SDK → Core. Core → Contracts. Never bypass layers. | ||
| - **Typing**: `disallow_untyped_defs = true` enforced by mypy on all runtime code in `src/planpilot`. Tests are not mypy-gated. | ||
| - **Tests are offline**: Use mocks/fakes (`tests/fakes/`) instead of live GitHub API calls. E2E tests call `planpilot.cli.main()` directly — no shell subprocess. | ||
| - **Test layout mirrors source**: `tests/engine/` → `src/planpilot/core/engine/`, etc. | ||
| - **Coverage target**: 90%+ branch coverage. | ||
| - **Commit format**: Conventional Commits required (`feat`, `fix`, `docs`, `chore`, etc.), max 72-char header. Enforced by CI (commitlint) and local hook (`./scripts/install-hooks.sh`). | ||
| - **Generated code**: `src/planpilot/core/providers/github/github_gql/` is excluded from mypy and coverage. Regenerate with `poe gen-gql`. | ||
|
|
||
| ## Anti-Patterns | ||
|
|
||
| - Do not import GitHub-specific modules into `engine/` or `contracts/`. | ||
| - Do not add direct provider/network calls in tests. | ||
| - Do not bypass `PlanValidator` before sync execution. | ||
| - Do not write side effects in dry-run code paths. | ||
| - Do not re-introduce legacy root domain modules outside `core/` and `cli/`. | ||
| - Do not hand-edit the generated GraphQL client as the primary change workflow. | ||
|
|
||
| ## Documentation Update Policy | ||
|
|
||
| For any user-visible behavior or architecture change, update docs in the same PR. Quick mapping: | ||
|
|
||
| | Change | Docs to update | | ||
| |--------|---------------| | ||
| | CLI flags/commands | `README.md`, `docs/modules/cli.md`, `docs/how-it-works.md` | | ||
| | Engine/sync semantics | `docs/design/engine.md`, `docs/how-it-works.md`, `docs/modules/sdk.md` | | ||
| | Provider behavior | `docs/modules/providers.md`, `docs/modules/github-provider.md` | | ||
| | Config/schema | `README.md`, `docs/modules/config.md`, `docs/reference/plan-schemas.md` | | ||
| | CI/release | `RELEASE.md`, `docs/reference/workflows-reference.md` | | ||
|
|
||
| Run `poe docs-links` after updating docs to verify no broken internal links. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a language specifier to the architecture fenced code block (MD040)
The bare fenced block is flagged by
markdownlint-cli2(MD040) and will fail any future markdownlint CI step.✏️ Proposed fix
Verify each finding against the current code and only fix it if needed.
In
@CLAUDE.mdaround lines 39 - 41, The fenced code block containing "Contracts→ Core → SDK → CLI" triggers markdownlint MD040 because it lacks a language
specifier; update that fenced block in CLAUDE.md (the triple-backtick block that
currently wraps "Contracts → Core → SDK → CLI") to include a language tag such
as
text so the block becomestext ... ``` to satisfy the linter.