project-init 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- project_init/__init__.py +4 -0
- project_init/__main__.py +662 -0
- project_init/mcps.py +57 -0
- project_init/scaffold.py +374 -0
- project_init/templates/base/AGENTS.md.tmpl +50 -0
- project_init/templates/base/CLAUDE.md.tmpl +16 -0
- project_init/templates/base/CONTRIBUTING.md.tmpl +55 -0
- project_init/templates/base/GEMINI.md.tmpl +16 -0
- project_init/templates/base/LICENSE.tmpl +231 -0
- project_init/templates/base/SECURITY.md.tmpl +26 -0
- project_init/templates/base/docs/explanation/index.md +9 -0
- project_init/templates/base/docs/how-to/index.md +7 -0
- project_init/templates/base/docs/index.md.tmpl +20 -0
- project_init/templates/base/docs/reference/index.md +13 -0
- project_init/templates/base/docs/tutorials/index.md +7 -0
- project_init/templates/base/dot_claude/agents/README.md +30 -0
- project_init/templates/base/dot_claude/config.yaml.tmpl +31 -0
- project_init/templates/base/dot_claude/docs/README.md +26 -0
- project_init/templates/base/dot_claude/docs/adr/adr-001-memory-stack.md.tmpl +22 -0
- project_init/templates/base/dot_claude/docs/adr/adr-002-mcp-choices.md.tmpl +32 -0
- project_init/templates/base/dot_claude/docs/adr/adr-template.md +29 -0
- project_init/templates/base/dot_claude/docs/development/conventions.md.tmpl +31 -0
- project_init/templates/base/dot_claude/docs/development/testing.md +25 -0
- project_init/templates/base/dot_claude/docs/guides/developer-onboarding.md +110 -0
- project_init/templates/base/dot_claude/docs/guides/issue-metadata.md +27 -0
- project_init/templates/base/dot_claude/docs/guides/secrets.md +50 -0
- project_init/templates/base/dot_claude/docs/guides/using-memory.md +36 -0
- project_init/templates/base/dot_claude/hooks/README.md +15 -0
- project_init/templates/base/dot_claude/hooks/agent_guard_adapter.py.tmpl +64 -0
- project_init/templates/base/dot_claude/hooks/dag_workflow.py +610 -0
- project_init/templates/base/dot_claude/memory/MEMORY.md.tmpl +11 -0
- project_init/templates/base/dot_claude/memory/README.md +51 -0
- project_init/templates/base/dot_claude/memory/SCHEMA.md +52 -0
- project_init/templates/base/dot_claude/memory/feedback_conventions.md +11 -0
- project_init/templates/base/dot_claude/memory/project_context.md.tmpl +11 -0
- project_init/templates/base/dot_claude/memory/user_role.md +7 -0
- project_init/templates/base/dot_claude/project-init.md.tmpl +174 -0
- project_init/templates/base/dot_claude/rules/go.md +14 -0
- project_init/templates/base/dot_claude/rules/hooks.md +30 -0
- project_init/templates/base/dot_claude/rules/node.md +17 -0
- project_init/templates/base/dot_claude/rules/python.md +25 -0
- project_init/templates/base/dot_claude/scripts/README.md +15 -0
- project_init/templates/base/dot_claude/scripts/create_issue.sh +577 -0
- project_init/templates/base/dot_claude/scripts/create_nojira_pr.sh +3 -0
- project_init/templates/base/dot_claude/scripts/finish_pr.sh +3 -0
- project_init/templates/base/dot_claude/scripts/install_hooks.sh +55 -0
- project_init/templates/base/dot_claude/scripts/monitor_pr.sh +270 -0
- project_init/templates/base/dot_claude/scripts/promote_review.sh +3 -0
- project_init/templates/base/dot_claude/scripts/push_branch.sh +5 -0
- project_init/templates/base/dot_claude/scripts/push_wiki.sh +34 -0
- project_init/templates/base/dot_claude/scripts/setup_github.sh +219 -0
- project_init/templates/base/dot_claude/scripts/start_issue.sh +134 -0
- project_init/templates/base/dot_claude/settings.json.tmpl +83 -0
- project_init/templates/base/dot_claude/skills/README.md +12 -0
- project_init/templates/base/dot_claude/skills/plan/SKILL.md.tmpl +40 -0
- project_init/templates/base/dot_claude/vault/README.md +21 -0
- project_init/templates/base/dot_claude/vault/decisions/README.md +22 -0
- project_init/templates/base/dot_claude/vault/design/README.md +3 -0
- project_init/templates/base/dot_claude/vault/knowledge/README.md +5 -0
- project_init/templates/base/dot_claude/vault/sessions/README.md +5 -0
- project_init/templates/base/dot_devcontainer/devcontainer.json.tmpl +17 -0
- project_init/templates/base/dot_devcontainer/post-create.sh.tmpl +31 -0
- project_init/templates/base/dot_env.example.tmpl +13 -0
- project_init/templates/base/dot_github/CODEOWNERS.tmpl +12 -0
- project_init/templates/base/dot_github/ISSUE_TEMPLATE/bug.yml +98 -0
- project_init/templates/base/dot_github/ISSUE_TEMPLATE/chore.yml +82 -0
- project_init/templates/base/dot_github/ISSUE_TEMPLATE/config.yml +5 -0
- project_init/templates/base/dot_github/ISSUE_TEMPLATE/docs.yml +84 -0
- project_init/templates/base/dot_github/ISSUE_TEMPLATE/feature.yml +87 -0
- project_init/templates/base/dot_github/ISSUE_TEMPLATE/test.yml +90 -0
- project_init/templates/base/dot_github/copilot-instructions.md.tmpl +25 -0
- project_init/templates/base/dot_github/hooks/commit-msg +52 -0
- project_init/templates/base/dot_github/hooks/pre-commit +16 -0
- project_init/templates/base/dot_github/hooks/pre-push +51 -0
- project_init/templates/base/dot_github/pull_request_template.md +22 -0
- project_init/templates/base/dot_github/workflows/board-automation.yml +232 -0
- project_init/templates/base/dot_github/workflows/ci.yml.tmpl +204 -0
- project_init/templates/base/dot_github/workflows/docs.yml.tmpl +98 -0
- project_init/templates/base/dot_github/workflows/issue-validation.yml +72 -0
- project_init/templates/base/dot_github/workflows/review-status.yml +48 -0
- project_init/templates/base/dot_github/workflows/validate-pr.yml +103 -0
- project_init/templates/base/dot_gitignore.tmpl +41 -0
- project_init/templates/base/dot_golangci.yml.tmpl +20 -0
- project_init/templates/base/dot_vscode/extensions.json.tmpl +10 -0
- project_init/templates/base/dot_vscode/settings.json.tmpl +8 -0
- project_init/templates/base/eslint.config.mjs.tmpl +29 -0
- project_init/templates/base/justfile.tmpl +95 -0
- project_init/templates/base/mise.toml.tmpl +20 -0
- project_init/templates/base/mkdocs.yml.tmpl +32 -0
- project_init/templates/base/renovate.json +14 -0
- project_init/templates/base/ruff.toml.tmpl +31 -0
- project_init/templates/base/typedoc.json.tmpl +14 -0
- project_init/templates/codex/dot_agents/skills/add_adr/SKILL.md +33 -0
- project_init/templates/codex/dot_agents/skills/add_command/SKILL.md +63 -0
- project_init/templates/codex/dot_agents/skills/add_hook/SKILL.md +112 -0
- project_init/templates/codex/dot_agents/skills/audit/SKILL.md +146 -0
- project_init/templates/codex/dot_agents/skills/create_issue/SKILL.md +59 -0
- project_init/templates/codex/dot_agents/skills/github_workflow/SKILL.md +80 -0
- project_init/templates/codex/dot_agents/skills/request_review/SKILL.md +19 -0
- project_init/templates/codex/dot_agents/skills/review/SKILL.md +17 -0
- project_init/templates/codex/dot_agents/skills/save_memory/SKILL.md +17 -0
- project_init/templates/codex/dot_agents/skills/session_summary/SKILL.md +35 -0
- project_init/templates/codex/dot_agents/skills/start_task/SKILL.md +48 -0
- project_init/templates/codex/dot_agents/skills/status/SKILL.md +15 -0
- project_init/templates/codex/dot_codex/hooks.json.tmpl +17 -0
- project_init/templates/fallback/dot_claude/hooks/github_command_guard.sh +11 -0
- project_init/templates/fallback/dot_claude/hooks/post_edit_lint.sh +58 -0
- project_init/templates/fallback/dot_claude/hooks/pre_commit_gate.sh +81 -0
- project_init/templates/fallback/dot_claude/hooks/prod_guard.py +140 -0
- project_init/templates/fallback/dot_claude/hooks/session_setup.sh +62 -0
- project_init/templates/fallback/dot_claude/hooks/workflow_state_reminder.sh +72 -0
- project_init/templates/fallback/dot_claude/skills/INDEX.md +28 -0
- project_init/templates/fallback/dot_claude/skills/add_adr/SKILL.md +33 -0
- project_init/templates/fallback/dot_claude/skills/add_command/SKILL.md +63 -0
- project_init/templates/fallback/dot_claude/skills/add_hook/SKILL.md +112 -0
- project_init/templates/fallback/dot_claude/skills/audit/SKILL.md +146 -0
- project_init/templates/fallback/dot_claude/skills/create_issue/SKILL.md +59 -0
- project_init/templates/fallback/dot_claude/skills/github_workflow/SKILL.md +80 -0
- project_init/templates/fallback/dot_claude/skills/request_review/SKILL.md +19 -0
- project_init/templates/fallback/dot_claude/skills/review/SKILL.md +17 -0
- project_init/templates/fallback/dot_claude/skills/save_memory/SKILL.md +17 -0
- project_init/templates/fallback/dot_claude/skills/session_summary/SKILL.md +35 -0
- project_init/templates/fallback/dot_claude/skills/start_task/SKILL.md +48 -0
- project_init/templates/fallback/dot_claude/skills/status/SKILL.md +15 -0
- project_init/templates/gemini/dot_agents/skills/add_adr/SKILL.md +33 -0
- project_init/templates/gemini/dot_agents/skills/add_command/SKILL.md +63 -0
- project_init/templates/gemini/dot_agents/skills/add_hook/SKILL.md +112 -0
- project_init/templates/gemini/dot_agents/skills/audit/SKILL.md +146 -0
- project_init/templates/gemini/dot_agents/skills/create_issue/SKILL.md +59 -0
- project_init/templates/gemini/dot_agents/skills/github_workflow/SKILL.md +80 -0
- project_init/templates/gemini/dot_agents/skills/request_review/SKILL.md +19 -0
- project_init/templates/gemini/dot_agents/skills/review/SKILL.md +17 -0
- project_init/templates/gemini/dot_agents/skills/save_memory/SKILL.md +17 -0
- project_init/templates/gemini/dot_agents/skills/session_summary/SKILL.md +35 -0
- project_init/templates/gemini/dot_agents/skills/start_task/SKILL.md +48 -0
- project_init/templates/gemini/dot_agents/skills/status/SKILL.md +15 -0
- project_init/templates/gemini/dot_claude/scripts/setup_gemini.sh.tmpl +16 -0
- project_init/templates/gemini/dot_gemini-extension/commands/add_adr.toml +5 -0
- project_init/templates/gemini/dot_gemini-extension/commands/add_command.toml +5 -0
- project_init/templates/gemini/dot_gemini-extension/commands/add_hook.toml +5 -0
- project_init/templates/gemini/dot_gemini-extension/commands/audit.toml +5 -0
- project_init/templates/gemini/dot_gemini-extension/commands/create_issue.toml +5 -0
- project_init/templates/gemini/dot_gemini-extension/commands/github_workflow.toml +5 -0
- project_init/templates/gemini/dot_gemini-extension/commands/request_review.toml +5 -0
- project_init/templates/gemini/dot_gemini-extension/commands/review.toml +5 -0
- project_init/templates/gemini/dot_gemini-extension/commands/save_memory.toml +5 -0
- project_init/templates/gemini/dot_gemini-extension/commands/session_summary.toml +5 -0
- project_init/templates/gemini/dot_gemini-extension/commands/start_task.toml +5 -0
- project_init/templates/gemini/dot_gemini-extension/commands/status.toml +5 -0
- project_init/templates/gemini/dot_gemini-extension/gemini-extension.json.tmpl +6 -0
- project_init/templates/gemini/dot_gemini-extension/hooks/hooks.json.tmpl +18 -0
- project_init/templates/graphify/dot_claude/docs/guides/using-graphify.md +37 -0
- project_init/templates/graphify/dot_claude/rules/graphify.md +18 -0
- project_init/templates/graphify/dot_claude/scripts/setup_graphify.sh +40 -0
- project_init/templates/obsidian/dot_claude/scripts/lint_memory.sh +115 -0
- project_init/templates/obsidian/dot_claude/vault/decisions/adr-000-project-setup.md.tmpl +22 -0
- project_init/templates/obsidian/dot_claude/vault/dot_obsidian/README.md +31 -0
- project_init/templates/obsidian/dot_claude/vault/dot_obsidian/app.json +6 -0
- project_init/templates/obsidian/dot_claude/vault/dot_obsidian/community-plugins.json +1 -0
- project_init/templates/obsidian/dot_claude/vault/dot_obsidian/core-plugins.json +1 -0
- project_init/templates/obsidian/dot_claude/vault/log.md +6 -0
- project_init/templates/obsidian/dot_claude/vault/templates/decision.md +16 -0
- project_init/templates/obsidian/dot_claude/vault/templates/design-note.md +14 -0
- project_init/templates/obsidian/dot_claude/vault/templates/knowledge-note.md +12 -0
- project_init/templates/obsidian/dot_claude/vault/templates/session-note.md +16 -0
- project_init/templates/presets/obsidian-graphify.toml +16 -0
- project_init/templates/presets/obsidian-only.toml +14 -0
- project_init/upgrade.py +569 -0
- project_init-0.3.0.dist-info/METADATA +342 -0
- project_init-0.3.0.dist-info/RECORD +173 -0
- project_init-0.3.0.dist-info/WHEEL +4 -0
- project_init-0.3.0.dist-info/entry_points.txt +2 -0
- project_init-0.3.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Memory Schema
|
|
2
|
+
|
|
3
|
+
Authoritative governance for `.claude/memory/` files. `lint_memory.sh` enforces these rules.
|
|
4
|
+
|
|
5
|
+
## Required frontmatter
|
|
6
|
+
|
|
7
|
+
Every memory file (except MEMORY.md, SCHEMA.md, README.md) must have:
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
---
|
|
11
|
+
name: <short title>
|
|
12
|
+
description: <one-line summary used for relevance ranking>
|
|
13
|
+
type: user | feedback | project | reference
|
|
14
|
+
---
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Types
|
|
18
|
+
|
|
19
|
+
| Type | Purpose | Body structure |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| `user` | About the human — role, preferences, expertise | Free-form |
|
|
22
|
+
| `feedback` | Rules/corrections the user has given | **Why:** + **How to apply:** |
|
|
23
|
+
| `project` | Current-state facts — goals, deadlines, decisions | **Why:** + **How to apply:** |
|
|
24
|
+
| `reference` | Pointers to external systems — URLs, dashboards | Free-form |
|
|
25
|
+
|
|
26
|
+
## File naming
|
|
27
|
+
|
|
28
|
+
Convention (not enforced by lint): `<type>_<slug>.md` — lowercase, hyphenated slug.
|
|
29
|
+
|
|
30
|
+
Examples: `user_role.md`, `feedback_testing.md`, `project_deadline.md`, `reference_api-docs.md`
|
|
31
|
+
|
|
32
|
+
## Index
|
|
33
|
+
|
|
34
|
+
Every memory file must appear in `MEMORY.md` as a one-line bullet:
|
|
35
|
+
|
|
36
|
+
```markdown
|
|
37
|
+
- [Title](filename.md) — short description
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Keep lines under ~150 characters. `lint_memory.sh` checks for orphaned files and stale index entries.
|
|
41
|
+
|
|
42
|
+
## What NOT to store
|
|
43
|
+
|
|
44
|
+
- Code patterns or architecture (derivable from the repo)
|
|
45
|
+
- Git history (`git log`)
|
|
46
|
+
- Ephemeral task state (use TODOs)
|
|
47
|
+
- Anything already in `CLAUDE.md` or `project-init.md`
|
|
48
|
+
- Large documents (put those in `vault/`)
|
|
49
|
+
|
|
50
|
+
## Relationship to vault
|
|
51
|
+
|
|
52
|
+
`memory/` holds small structured facts for fast agent recall. `vault/` holds richer human-authored documentation (Obsidian). When a vault note distills into a reusable fact, create a memory file and link back to the vault note for context.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Conventions feedback
|
|
3
|
+
description: Rules about how agents should behave in this project
|
|
4
|
+
type: feedback
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<!-- Add corrections and confirmed approaches as they accumulate -->
|
|
8
|
+
|
|
9
|
+
**Why:** <!-- why the convention matters -->
|
|
10
|
+
|
|
11
|
+
**How to apply:** <!-- specific behavior change for agents -->
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Project context
|
|
3
|
+
description: Goals, constraints, and key decisions for {{project_name}}
|
|
4
|
+
type: project
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<!-- Fill after scaffolding: why this project exists, key constraints, stakeholder goals -->
|
|
8
|
+
|
|
9
|
+
**Why:** <!-- reason this project exists -->
|
|
10
|
+
|
|
11
|
+
**How to apply:** <!-- how this context should shape agent suggestions -->
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Project: {{project_name}}
|
|
2
|
+
|
|
3
|
+
> {{project_description}}
|
|
4
|
+
|
|
5
|
+
Scaffolded with [project-init]({{project_init_url}}) on {{created_date}}.
|
|
6
|
+
|
|
7
|
+
| | |
|
|
8
|
+
|---|---|
|
|
9
|
+
| Language | {{language}} |
|
|
10
|
+
| Memory stack | {{memory_stack}} |
|
|
11
|
+
| MCPs | {{installed_mcps}} |
|
|
12
|
+
|
|
13
|
+
## Workflow
|
|
14
|
+
|
|
15
|
+
1. **Start of session** — read [`memory/MEMORY.md`](memory/MEMORY.md), then check [`docs/adr/`](docs/adr/) for relevant decisions.
|
|
16
|
+
2. **During work** — permanent decisions → [`docs/adr/`](docs/adr/); exploratory notes → [`vault/`](vault/); reusable facts → [`memory/`](memory/).
|
|
17
|
+
3. **End of session** — run `/session_summary` to write a session log to [`vault/sessions/`](vault/sessions/).
|
|
18
|
+
|
|
19
|
+
## Tools
|
|
20
|
+
|
|
21
|
+
| Type | Name | Purpose |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| Command | `/status` | git state, recent commits, open TODOs |
|
|
24
|
+
| Command | `/review` | code review of staged changes or a file |
|
|
25
|
+
| Command | `/plan <task>` | acceptance tests first, then implementation plan |
|
|
26
|
+
| Command | `/request_review` | mark PR ready for review, optional agent review |
|
|
27
|
+
| Script | `create_issue.sh <type> "desc"` | create typed issue, prints issue number |
|
|
28
|
+
| Script | `create_nojira_pr.sh <type> "desc"` | branch + push + draft PR without an issue |
|
|
29
|
+
| Script | `setup_github.sh [branch] [--protect]` | provision board fields and review settings; `--protect` applies baseline branch protection |
|
|
30
|
+
| Script | `start_issue.sh <n> <type>` | branch + draft PR |
|
|
31
|
+
| Script | `promote_review.sh` | mark PR ready (board card moves automatically) |
|
|
32
|
+
| Script | `monitor_pr.sh <n> [--merge]` | wait for CI; --merge squash-merges when clean |
|
|
33
|
+
| Script | `finish_pr.sh [n] [--review-cycle N]` | push branch, mark ready, monitor checks/review, and merge |
|
|
34
|
+
| Skill | `session_summary` | summarise session and save to vault |
|
|
35
|
+
| Skill | `add_hook` | add a new deterministic hook |
|
|
36
|
+
| Skill | `add_command` | add a new slash command |
|
|
37
|
+
| Skill | `audit` | full project health scan, creates issue with findings |
|
|
38
|
+
| Agent | `reviewer` | code review specialist |
|
|
39
|
+
| Agent | `researcher` | codebase explorer |
|
|
40
|
+
|
|
41
|
+
Hooks run automatically via `settings.json`: `github_command_guard`, `workflow_state_reminder`, `pre_commit_gate`, `post_edit_lint`. Secret scanning and lifecycle gating are enforced agent-agnostically by git hooks (gitleaks pre-commit, commit-msg, pre-push — installed via `.claude/scripts/install_hooks.sh`) and mirrored in CI; the `security-guidance` plugin provides Claude-side guidance.
|
|
42
|
+
|
|
43
|
+
**Rules** (`.claude/rules/`): per-filetype conventions loaded automatically by Claude Code when you open a matching file.
|
|
44
|
+
|
|
45
|
+
## Coding standards
|
|
46
|
+
|
|
47
|
+
- No comments unless the WHY is non-obvious.
|
|
48
|
+
- No premature abstractions — three similar lines before extracting.
|
|
49
|
+
- No error handling for impossible scenarios.
|
|
50
|
+
- No backwards-compatibility shims — delete removed code.
|
|
51
|
+
- Prefer editing existing files over creating new ones.
|
|
52
|
+
{{#if lint_command}}- `just lint` must pass before closing a task (`just --list` shows all recipes).
|
|
53
|
+
{{/if}}
|
|
54
|
+
|
|
55
|
+
## TDD
|
|
56
|
+
|
|
57
|
+
Write failing tests before implementation. Tests define the contract.
|
|
58
|
+
|
|
59
|
+
1. `/plan <task>` → acceptance tests (red)
|
|
60
|
+
2. Commit failing tests
|
|
61
|
+
3. Implement until green
|
|
62
|
+
4. Lint and clean up
|
|
63
|
+
{{#if python}}
|
|
64
|
+
Test conventions: one assertion per test, name as `test_<unit>_<scenario>`, run with `uv run pytest`. Real DB/API instances — no mocks.
|
|
65
|
+
{{/if}}
|
|
66
|
+
|
|
67
|
+
## GitHub Projects tracking
|
|
68
|
+
|
|
69
|
+
Work items are GitHub Issues; the project board is GitHub Projects (kanban with To Do / In Progress / In Review / Done columns). Board cards move automatically via `board-automation.yml` — **no manual board moves needed**.
|
|
70
|
+
|
|
71
|
+
### Lifecycle: Issue → branch → draft PR → merge
|
|
72
|
+
|
|
73
|
+
Every non-trivial task follows this exact sequence. Run the scripts; the LLM's only job is writing commit messages and fixing CI failures.
|
|
74
|
+
|
|
75
|
+
| Step | Command | What happens automatically |
|
|
76
|
+
|------|---------|---------------------------|
|
|
77
|
+
| 1. Create issue | `.claude/scripts/create_issue.sh <type> "description" --priority <priority> --area "<area>" --size <size> --acceptance "<criterion>"` | Issue created with metadata, board card → **To Do** |
|
|
78
|
+
| 2. Start work | `.claude/scripts/start_issue.sh <issue-n> <type>` | Branch (`<issue_type>/<project_abbr>-<issue_number>-<slug>`) + push + draft PR, board → **In Progress** |
|
|
79
|
+
| 3. Commit | `git add … && git commit -m "type(<KEY>-<n>): message"` | `commit-msg` hook validates format; `pre_commit_gate` auto-lints |
|
|
80
|
+
| 4. Push | `.claude/scripts/push_branch.sh` | CI runs; if it fails a comment is posted on the PR with `gh run view --log-failed` |
|
|
81
|
+
| 5. Finish PR | `.claude/scripts/finish_pr.sh <n>` | Pushes, marks ready, monitors CI/review, and merges when clean |
|
|
82
|
+
|
|
83
|
+
Steps 3–4 repeat until the work is complete. **When asked to push or finish a PR, keep going until the lifecycle is complete**: `finish_pr.sh` → fix any CI or review failures → rerun with the next review cycle until merged.
|
|
84
|
+
|
|
85
|
+
### Merge setup (one-time per repo)
|
|
86
|
+
|
|
87
|
+
Automated completion via `monitor_pr.sh --merge` works after checks pass. GitHub-native auto-merge requires two repo settings enabled by an admin:
|
|
88
|
+
|
|
89
|
+
1. **GitHub Settings → General → Allow auto-merge** — tick the checkbox
|
|
90
|
+
2. **Branch protection rule on `main`** — require CI status checks to pass
|
|
91
|
+
|
|
92
|
+
Without GitHub-native auto-merge, `monitor_pr.sh --merge` still works by merging explicitly after CI passes.
|
|
93
|
+
|
|
94
|
+
Run the scaffolded setup helper after creating the repository:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
.claude/scripts/setup_github.sh --protect
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
It attempts to configure branch protection, required checks, conversation resolution, and Copilot code review. If GitHub does not expose a setting through the API or your token lacks permission, it prints the manual setup step.
|
|
101
|
+
|
|
102
|
+
### Commit and PR format
|
|
103
|
+
|
|
104
|
+
| What | Format | Example |
|
|
105
|
+
|------|--------|---------|
|
|
106
|
+
| Commit message | `<type>(KEY-<n>): description` | `feat(PI-42): Add OAuth login` |
|
|
107
|
+
| PR title | `<type>(KEY-<n>): description` | `feat(PI-42): Add OAuth login` |
|
|
108
|
+
| No-issue PR | `<type>: description` (no scope) | `fix: Fix typo` |
|
|
109
|
+
| PR body | must include `Closes #<n>` | triggers auto-close on merge |
|
|
110
|
+
| Branch | `<type>/<KEY>-<n>-<slug>` | `feat/PI-42-add-oauth-login` |
|
|
111
|
+
|
|
112
|
+
Types: `feat` · `fix` · `chore` · `docs` · `test`
|
|
113
|
+
|
|
114
|
+
For minor work without an issue, use `.claude/scripts/create_nojira_pr.sh <type> "description"`.
|
|
115
|
+
It creates or reuses a typed `nojira` branch, pushes through `push_branch.sh`,
|
|
116
|
+
and opens a draft PR titled `type: description` (no scope = no linked issue).
|
|
117
|
+
|
|
118
|
+
### Rules
|
|
119
|
+
|
|
120
|
+
- **No direct commits to `main`** — all changes through PRs. The `pre-push` hook enforces this locally.
|
|
121
|
+
- Install hooks once after cloning:
|
|
122
|
+
```bash
|
|
123
|
+
.claude/scripts/install_hooks.sh
|
|
124
|
+
```
|
|
125
|
+
- One issue → one branch → one PR.
|
|
126
|
+
- Draft PRs created immediately when work starts — not when it's done.
|
|
127
|
+
- PRs must pass CI (tests + lint) before merging.
|
|
128
|
+
|
|
129
|
+
### Handling CI failures
|
|
130
|
+
|
|
131
|
+
When CI fails, GitHub posts a comment on the PR. Read it, fix the code, push:
|
|
132
|
+
```bash
|
|
133
|
+
gh run view --log-failed # full failure output
|
|
134
|
+
# fix the code
|
|
135
|
+
git add … && git commit -m "fix(<KEY>-<n>): Fix failing tests"
|
|
136
|
+
.claude/scripts/push_branch.sh
|
|
137
|
+
.claude/scripts/monitor_pr.sh <n> --merge # wait and merge when clean
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Code review
|
|
141
|
+
|
|
142
|
+
`finish_pr.sh` and `monitor_pr.sh --merge` wait for GitHub's review decision and print review feedback when changes are requested. Resolve actionable comments, post a review response, push with `.claude/scripts/push_branch.sh`, then rerun `monitor_pr.sh` with the next `--review-cycle`.
|
|
143
|
+
|
|
144
|
+
`/request_review` may also invoke the local `reviewer` agent for an extra pre-merge pass; that agent review is optional, but the GitHub PR review gate is part of the normal lifecycle.
|
|
145
|
+
|
|
146
|
+
### Quick reference
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
.claude/scripts/create_issue.sh <type> "description" --priority high --area docs --size S --acceptance "Done when ..." # new issue → prints issue number
|
|
150
|
+
.claude/scripts/start_issue.sh <n> <type> # branch + draft PR
|
|
151
|
+
.claude/scripts/create_nojira_pr.sh fix "description" # no-issue branch + draft PR
|
|
152
|
+
.claude/scripts/setup_github.sh --protect # one-time governance setup + branch protection
|
|
153
|
+
.claude/scripts/promote_review.sh # mark PR ready for review
|
|
154
|
+
.claude/scripts/monitor_pr.sh <n> --merge # wait for CI, merge when clean
|
|
155
|
+
.claude/scripts/finish_pr.sh <n> # push, ready, monitor, merge
|
|
156
|
+
gh run view --log-failed # see what CI failed
|
|
157
|
+
gh issue list # open issues
|
|
158
|
+
gh pr list # open PRs
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Conventions
|
|
162
|
+
|
|
163
|
+
- Hooks and scripts prefer bash/python. LLM calls only for generative steps.
|
|
164
|
+
- `AGENTS.md` is the canonical root instruction file (the standard most agents read natively). `CLAUDE.md` and `GEMINI.md` redirect to it.
|
|
165
|
+
- Everything else lives under `.claude/`.
|
|
166
|
+
|
|
167
|
+
## Compact Instructions
|
|
168
|
+
|
|
169
|
+
When compacting, preserve:
|
|
170
|
+
- GitHub Issue number being worked on
|
|
171
|
+
- Files modified this session
|
|
172
|
+
- Test results (pass/fail count, failing test names)
|
|
173
|
+
- Unresolved errors or lint failures
|
|
174
|
+
- Decisions not yet committed to `docs/adr/`
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Hook reference — what each hook does and how to invoke manually
|
|
3
|
+
globs: [".claude/settings.json", ".claude/hooks/**"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Hooks in this project
|
|
8
|
+
|
|
9
|
+
All hooks fire automatically — do not invoke them manually in normal flow.
|
|
10
|
+
|
|
11
|
+
| Hook | Event | Trigger |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `github_command_guard.sh` | PreToolUse | Bash — steers agents toward lifecycle scripts |
|
|
14
|
+
| `pre_commit_gate.sh` | PreToolUse | Bash containing `git commit` |
|
|
15
|
+
| `post_edit_lint.sh` | PostToolUse | Edit / Write / MultiEdit |
|
|
16
|
+
| `workflow_state_reminder.sh` | UserPromptSubmit | injects workflow lifecycle context |
|
|
17
|
+
|
|
18
|
+
Security enforcement is agent-agnostic (ADR-007), not a Claude hook:
|
|
19
|
+
secret scanning runs as a git pre-commit hook (gitleaks) plus a CI
|
|
20
|
+
`secret-scan` job; lifecycle gating runs as git `commit-msg`/`pre-push`
|
|
21
|
+
hooks plus the `validate-pr` workflow. Claude-side security guidance comes
|
|
22
|
+
from the `security-guidance` plugin enabled in `settings.json`.
|
|
23
|
+
|
|
24
|
+
**Manual invocation** (debugging or one-off runs only):
|
|
25
|
+
```bash
|
|
26
|
+
just lint # the same gate the hooks enforce
|
|
27
|
+
# (with --no-plugin scaffolds the hook scripts live in .claude/hooks/)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Do not read hook scripts to understand their logic — descriptions above are sufficient. Only open a hook file if you are modifying it. To add a new hook, run the `add_hook` skill.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Node.js / Bun environment and tooling
|
|
3
|
+
globs: ["**/*.ts", "**/*.tsx", "**/*.js", "package.json", "bun.lockb"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Node.js environment
|
|
8
|
+
|
|
9
|
+
Uses [`bun`](https://bun.sh). Never `npm` or `npx`.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bun install # install deps
|
|
13
|
+
bun run <script> # run a package.json script
|
|
14
|
+
bunx <package> # run a binary (replaces npx)
|
|
15
|
+
bun run lint # lint
|
|
16
|
+
bun test # tests
|
|
17
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Python environment, tooling, and test conventions
|
|
3
|
+
globs: ["**/*.py", "pyproject.toml", "uv.lock"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Python environment
|
|
8
|
+
|
|
9
|
+
Uses [`uv`](https://docs.astral.sh/uv/).
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
uv sync # install deps
|
|
13
|
+
uv run <command> # run in the project venv
|
|
14
|
+
uv run ruff check . # lint
|
|
15
|
+
uv run ruff format . # format
|
|
16
|
+
uv run pytest -n auto -q # tests (parallel mode, requires pytest-xdist)
|
|
17
|
+
uv run pytest -q --tb=short # tests (single-threaded fallback)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Test Optimization**: Use `pytest -n auto` in CI to parallelize tests across CPU cores (30-50% faster). Requires `pytest-xdist` in dev dependencies. See `ci.yml.tmpl` for a full optimized CI config.
|
|
21
|
+
|
|
22
|
+
## Test conventions
|
|
23
|
+
|
|
24
|
+
- One assertion per test; name: `test_<unit>_<scenario>`
|
|
25
|
+
- External services (DB, API) use a real instance, not a mock
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# `.claude/scripts/`
|
|
2
|
+
|
|
3
|
+
Helper scripts invoked by the user, by hooks, or by agents via the Bash tool. Prefer bash or python stdlib. Document each script with a one-line header comment.
|
|
4
|
+
|
|
5
|
+
## Available scripts
|
|
6
|
+
|
|
7
|
+
- **`install_hooks.sh`** — Symlink or copy git hooks from `.github/hooks/` to `.git/hooks/`
|
|
8
|
+
- **`create_issue.sh`** — Create a typed GitHub issue and print its issue number
|
|
9
|
+
- **`start_issue.sh`** — Create an issue branch, push it, and open a draft PR
|
|
10
|
+
- **`create_nojira_pr.sh`** — Create or reuse a no-issue branch, push it, and open a draft PR
|
|
11
|
+
- **`push_branch.sh`** — Push current branch with retry and remote-SHA verification (handles transient 5xx errors)
|
|
12
|
+
- **`promote_review.sh`** — Mark a draft PR ready for review
|
|
13
|
+
- **`monitor_pr.sh`** — Poll PR checks and optionally squash-merge with `--merge`
|
|
14
|
+
- **`finish_pr.sh`** — Composite: push, mark ready, monitor checks/review, and merge
|
|
15
|
+
- **`setup_github.sh`** — One-time GitHub repository governance setup (board fields, review settings; `--protect` applies baseline branch protection)
|