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.
Files changed (173) hide show
  1. project_init/__init__.py +4 -0
  2. project_init/__main__.py +662 -0
  3. project_init/mcps.py +57 -0
  4. project_init/scaffold.py +374 -0
  5. project_init/templates/base/AGENTS.md.tmpl +50 -0
  6. project_init/templates/base/CLAUDE.md.tmpl +16 -0
  7. project_init/templates/base/CONTRIBUTING.md.tmpl +55 -0
  8. project_init/templates/base/GEMINI.md.tmpl +16 -0
  9. project_init/templates/base/LICENSE.tmpl +231 -0
  10. project_init/templates/base/SECURITY.md.tmpl +26 -0
  11. project_init/templates/base/docs/explanation/index.md +9 -0
  12. project_init/templates/base/docs/how-to/index.md +7 -0
  13. project_init/templates/base/docs/index.md.tmpl +20 -0
  14. project_init/templates/base/docs/reference/index.md +13 -0
  15. project_init/templates/base/docs/tutorials/index.md +7 -0
  16. project_init/templates/base/dot_claude/agents/README.md +30 -0
  17. project_init/templates/base/dot_claude/config.yaml.tmpl +31 -0
  18. project_init/templates/base/dot_claude/docs/README.md +26 -0
  19. project_init/templates/base/dot_claude/docs/adr/adr-001-memory-stack.md.tmpl +22 -0
  20. project_init/templates/base/dot_claude/docs/adr/adr-002-mcp-choices.md.tmpl +32 -0
  21. project_init/templates/base/dot_claude/docs/adr/adr-template.md +29 -0
  22. project_init/templates/base/dot_claude/docs/development/conventions.md.tmpl +31 -0
  23. project_init/templates/base/dot_claude/docs/development/testing.md +25 -0
  24. project_init/templates/base/dot_claude/docs/guides/developer-onboarding.md +110 -0
  25. project_init/templates/base/dot_claude/docs/guides/issue-metadata.md +27 -0
  26. project_init/templates/base/dot_claude/docs/guides/secrets.md +50 -0
  27. project_init/templates/base/dot_claude/docs/guides/using-memory.md +36 -0
  28. project_init/templates/base/dot_claude/hooks/README.md +15 -0
  29. project_init/templates/base/dot_claude/hooks/agent_guard_adapter.py.tmpl +64 -0
  30. project_init/templates/base/dot_claude/hooks/dag_workflow.py +610 -0
  31. project_init/templates/base/dot_claude/memory/MEMORY.md.tmpl +11 -0
  32. project_init/templates/base/dot_claude/memory/README.md +51 -0
  33. project_init/templates/base/dot_claude/memory/SCHEMA.md +52 -0
  34. project_init/templates/base/dot_claude/memory/feedback_conventions.md +11 -0
  35. project_init/templates/base/dot_claude/memory/project_context.md.tmpl +11 -0
  36. project_init/templates/base/dot_claude/memory/user_role.md +7 -0
  37. project_init/templates/base/dot_claude/project-init.md.tmpl +174 -0
  38. project_init/templates/base/dot_claude/rules/go.md +14 -0
  39. project_init/templates/base/dot_claude/rules/hooks.md +30 -0
  40. project_init/templates/base/dot_claude/rules/node.md +17 -0
  41. project_init/templates/base/dot_claude/rules/python.md +25 -0
  42. project_init/templates/base/dot_claude/scripts/README.md +15 -0
  43. project_init/templates/base/dot_claude/scripts/create_issue.sh +577 -0
  44. project_init/templates/base/dot_claude/scripts/create_nojira_pr.sh +3 -0
  45. project_init/templates/base/dot_claude/scripts/finish_pr.sh +3 -0
  46. project_init/templates/base/dot_claude/scripts/install_hooks.sh +55 -0
  47. project_init/templates/base/dot_claude/scripts/monitor_pr.sh +270 -0
  48. project_init/templates/base/dot_claude/scripts/promote_review.sh +3 -0
  49. project_init/templates/base/dot_claude/scripts/push_branch.sh +5 -0
  50. project_init/templates/base/dot_claude/scripts/push_wiki.sh +34 -0
  51. project_init/templates/base/dot_claude/scripts/setup_github.sh +219 -0
  52. project_init/templates/base/dot_claude/scripts/start_issue.sh +134 -0
  53. project_init/templates/base/dot_claude/settings.json.tmpl +83 -0
  54. project_init/templates/base/dot_claude/skills/README.md +12 -0
  55. project_init/templates/base/dot_claude/skills/plan/SKILL.md.tmpl +40 -0
  56. project_init/templates/base/dot_claude/vault/README.md +21 -0
  57. project_init/templates/base/dot_claude/vault/decisions/README.md +22 -0
  58. project_init/templates/base/dot_claude/vault/design/README.md +3 -0
  59. project_init/templates/base/dot_claude/vault/knowledge/README.md +5 -0
  60. project_init/templates/base/dot_claude/vault/sessions/README.md +5 -0
  61. project_init/templates/base/dot_devcontainer/devcontainer.json.tmpl +17 -0
  62. project_init/templates/base/dot_devcontainer/post-create.sh.tmpl +31 -0
  63. project_init/templates/base/dot_env.example.tmpl +13 -0
  64. project_init/templates/base/dot_github/CODEOWNERS.tmpl +12 -0
  65. project_init/templates/base/dot_github/ISSUE_TEMPLATE/bug.yml +98 -0
  66. project_init/templates/base/dot_github/ISSUE_TEMPLATE/chore.yml +82 -0
  67. project_init/templates/base/dot_github/ISSUE_TEMPLATE/config.yml +5 -0
  68. project_init/templates/base/dot_github/ISSUE_TEMPLATE/docs.yml +84 -0
  69. project_init/templates/base/dot_github/ISSUE_TEMPLATE/feature.yml +87 -0
  70. project_init/templates/base/dot_github/ISSUE_TEMPLATE/test.yml +90 -0
  71. project_init/templates/base/dot_github/copilot-instructions.md.tmpl +25 -0
  72. project_init/templates/base/dot_github/hooks/commit-msg +52 -0
  73. project_init/templates/base/dot_github/hooks/pre-commit +16 -0
  74. project_init/templates/base/dot_github/hooks/pre-push +51 -0
  75. project_init/templates/base/dot_github/pull_request_template.md +22 -0
  76. project_init/templates/base/dot_github/workflows/board-automation.yml +232 -0
  77. project_init/templates/base/dot_github/workflows/ci.yml.tmpl +204 -0
  78. project_init/templates/base/dot_github/workflows/docs.yml.tmpl +98 -0
  79. project_init/templates/base/dot_github/workflows/issue-validation.yml +72 -0
  80. project_init/templates/base/dot_github/workflows/review-status.yml +48 -0
  81. project_init/templates/base/dot_github/workflows/validate-pr.yml +103 -0
  82. project_init/templates/base/dot_gitignore.tmpl +41 -0
  83. project_init/templates/base/dot_golangci.yml.tmpl +20 -0
  84. project_init/templates/base/dot_vscode/extensions.json.tmpl +10 -0
  85. project_init/templates/base/dot_vscode/settings.json.tmpl +8 -0
  86. project_init/templates/base/eslint.config.mjs.tmpl +29 -0
  87. project_init/templates/base/justfile.tmpl +95 -0
  88. project_init/templates/base/mise.toml.tmpl +20 -0
  89. project_init/templates/base/mkdocs.yml.tmpl +32 -0
  90. project_init/templates/base/renovate.json +14 -0
  91. project_init/templates/base/ruff.toml.tmpl +31 -0
  92. project_init/templates/base/typedoc.json.tmpl +14 -0
  93. project_init/templates/codex/dot_agents/skills/add_adr/SKILL.md +33 -0
  94. project_init/templates/codex/dot_agents/skills/add_command/SKILL.md +63 -0
  95. project_init/templates/codex/dot_agents/skills/add_hook/SKILL.md +112 -0
  96. project_init/templates/codex/dot_agents/skills/audit/SKILL.md +146 -0
  97. project_init/templates/codex/dot_agents/skills/create_issue/SKILL.md +59 -0
  98. project_init/templates/codex/dot_agents/skills/github_workflow/SKILL.md +80 -0
  99. project_init/templates/codex/dot_agents/skills/request_review/SKILL.md +19 -0
  100. project_init/templates/codex/dot_agents/skills/review/SKILL.md +17 -0
  101. project_init/templates/codex/dot_agents/skills/save_memory/SKILL.md +17 -0
  102. project_init/templates/codex/dot_agents/skills/session_summary/SKILL.md +35 -0
  103. project_init/templates/codex/dot_agents/skills/start_task/SKILL.md +48 -0
  104. project_init/templates/codex/dot_agents/skills/status/SKILL.md +15 -0
  105. project_init/templates/codex/dot_codex/hooks.json.tmpl +17 -0
  106. project_init/templates/fallback/dot_claude/hooks/github_command_guard.sh +11 -0
  107. project_init/templates/fallback/dot_claude/hooks/post_edit_lint.sh +58 -0
  108. project_init/templates/fallback/dot_claude/hooks/pre_commit_gate.sh +81 -0
  109. project_init/templates/fallback/dot_claude/hooks/prod_guard.py +140 -0
  110. project_init/templates/fallback/dot_claude/hooks/session_setup.sh +62 -0
  111. project_init/templates/fallback/dot_claude/hooks/workflow_state_reminder.sh +72 -0
  112. project_init/templates/fallback/dot_claude/skills/INDEX.md +28 -0
  113. project_init/templates/fallback/dot_claude/skills/add_adr/SKILL.md +33 -0
  114. project_init/templates/fallback/dot_claude/skills/add_command/SKILL.md +63 -0
  115. project_init/templates/fallback/dot_claude/skills/add_hook/SKILL.md +112 -0
  116. project_init/templates/fallback/dot_claude/skills/audit/SKILL.md +146 -0
  117. project_init/templates/fallback/dot_claude/skills/create_issue/SKILL.md +59 -0
  118. project_init/templates/fallback/dot_claude/skills/github_workflow/SKILL.md +80 -0
  119. project_init/templates/fallback/dot_claude/skills/request_review/SKILL.md +19 -0
  120. project_init/templates/fallback/dot_claude/skills/review/SKILL.md +17 -0
  121. project_init/templates/fallback/dot_claude/skills/save_memory/SKILL.md +17 -0
  122. project_init/templates/fallback/dot_claude/skills/session_summary/SKILL.md +35 -0
  123. project_init/templates/fallback/dot_claude/skills/start_task/SKILL.md +48 -0
  124. project_init/templates/fallback/dot_claude/skills/status/SKILL.md +15 -0
  125. project_init/templates/gemini/dot_agents/skills/add_adr/SKILL.md +33 -0
  126. project_init/templates/gemini/dot_agents/skills/add_command/SKILL.md +63 -0
  127. project_init/templates/gemini/dot_agents/skills/add_hook/SKILL.md +112 -0
  128. project_init/templates/gemini/dot_agents/skills/audit/SKILL.md +146 -0
  129. project_init/templates/gemini/dot_agents/skills/create_issue/SKILL.md +59 -0
  130. project_init/templates/gemini/dot_agents/skills/github_workflow/SKILL.md +80 -0
  131. project_init/templates/gemini/dot_agents/skills/request_review/SKILL.md +19 -0
  132. project_init/templates/gemini/dot_agents/skills/review/SKILL.md +17 -0
  133. project_init/templates/gemini/dot_agents/skills/save_memory/SKILL.md +17 -0
  134. project_init/templates/gemini/dot_agents/skills/session_summary/SKILL.md +35 -0
  135. project_init/templates/gemini/dot_agents/skills/start_task/SKILL.md +48 -0
  136. project_init/templates/gemini/dot_agents/skills/status/SKILL.md +15 -0
  137. project_init/templates/gemini/dot_claude/scripts/setup_gemini.sh.tmpl +16 -0
  138. project_init/templates/gemini/dot_gemini-extension/commands/add_adr.toml +5 -0
  139. project_init/templates/gemini/dot_gemini-extension/commands/add_command.toml +5 -0
  140. project_init/templates/gemini/dot_gemini-extension/commands/add_hook.toml +5 -0
  141. project_init/templates/gemini/dot_gemini-extension/commands/audit.toml +5 -0
  142. project_init/templates/gemini/dot_gemini-extension/commands/create_issue.toml +5 -0
  143. project_init/templates/gemini/dot_gemini-extension/commands/github_workflow.toml +5 -0
  144. project_init/templates/gemini/dot_gemini-extension/commands/request_review.toml +5 -0
  145. project_init/templates/gemini/dot_gemini-extension/commands/review.toml +5 -0
  146. project_init/templates/gemini/dot_gemini-extension/commands/save_memory.toml +5 -0
  147. project_init/templates/gemini/dot_gemini-extension/commands/session_summary.toml +5 -0
  148. project_init/templates/gemini/dot_gemini-extension/commands/start_task.toml +5 -0
  149. project_init/templates/gemini/dot_gemini-extension/commands/status.toml +5 -0
  150. project_init/templates/gemini/dot_gemini-extension/gemini-extension.json.tmpl +6 -0
  151. project_init/templates/gemini/dot_gemini-extension/hooks/hooks.json.tmpl +18 -0
  152. project_init/templates/graphify/dot_claude/docs/guides/using-graphify.md +37 -0
  153. project_init/templates/graphify/dot_claude/rules/graphify.md +18 -0
  154. project_init/templates/graphify/dot_claude/scripts/setup_graphify.sh +40 -0
  155. project_init/templates/obsidian/dot_claude/scripts/lint_memory.sh +115 -0
  156. project_init/templates/obsidian/dot_claude/vault/decisions/adr-000-project-setup.md.tmpl +22 -0
  157. project_init/templates/obsidian/dot_claude/vault/dot_obsidian/README.md +31 -0
  158. project_init/templates/obsidian/dot_claude/vault/dot_obsidian/app.json +6 -0
  159. project_init/templates/obsidian/dot_claude/vault/dot_obsidian/community-plugins.json +1 -0
  160. project_init/templates/obsidian/dot_claude/vault/dot_obsidian/core-plugins.json +1 -0
  161. project_init/templates/obsidian/dot_claude/vault/log.md +6 -0
  162. project_init/templates/obsidian/dot_claude/vault/templates/decision.md +16 -0
  163. project_init/templates/obsidian/dot_claude/vault/templates/design-note.md +14 -0
  164. project_init/templates/obsidian/dot_claude/vault/templates/knowledge-note.md +12 -0
  165. project_init/templates/obsidian/dot_claude/vault/templates/session-note.md +16 -0
  166. project_init/templates/presets/obsidian-graphify.toml +16 -0
  167. project_init/templates/presets/obsidian-only.toml +14 -0
  168. project_init/upgrade.py +569 -0
  169. project_init-0.3.0.dist-info/METADATA +342 -0
  170. project_init-0.3.0.dist-info/RECORD +173 -0
  171. project_init-0.3.0.dist-info/WHEEL +4 -0
  172. project_init-0.3.0.dist-info/entry_points.txt +2 -0
  173. project_init-0.3.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,27 @@
1
+ # Issue metadata
2
+
3
+ Issues carry planning metadata in two places.
4
+
5
+ ## GitHub labels
6
+
7
+ Use labels for values that workflows and project boards can read.
8
+
9
+ - Type labels: `feature`, `bug`, `chore`, `documentation`, `test`
10
+ - Priority labels: `priority:high`, `priority:medium`, `priority:low`
11
+ - Size labels: `size:XS`, `size:S`, `size:M`, `size:L`, `size:XL`
12
+ - Area labels are repository-specific. Use existing labels only; do not invent new area labels from agent context.
13
+
14
+ `create_issue.sh` creates missing priority and size labels when the token has permission. If label creation fails, the issue is still created and the value remains in the markdown body.
15
+
16
+ ## Markdown body
17
+
18
+ Use the markdown body for context GitHub does not model portably:
19
+
20
+ - references to issues, PRs, ADRs, docs, designs, logs, or external links
21
+ - dependencies, blocked-by, parent, and follow-up relationships
22
+ - acceptance criteria
23
+ - implementation notes and affected areas
24
+ - Definition of Ready
25
+ - Definition of Done
26
+
27
+ GitHub Projects fields are synced opportunistically by `board-automation.yml`. Missing fields or options are logged and skipped so issue creation does not fail in a new repository.
@@ -0,0 +1,50 @@
1
+ # Secrets handling
2
+
3
+ How secrets flow through this project, and when to escalate beyond `.env`.
4
+
5
+ ## The local pattern (scaffolded)
6
+
7
+ - `.env.example` documents every variable the project needs — committed,
8
+ values empty.
9
+ - `.env` holds your real local values — gitignored, never committed.
10
+ - Loading order: shell exports win over `.env`; tools load `.env`
11
+ explicitly (`uv run --env-file .env`, bun auto-load, or direnv).
12
+ - Enforcement: the pre-commit hook runs a gitleaks scan and CI re-scans
13
+ the full history (ADR-007). A leaked value that reaches a commit must be
14
+ **rotated**, not just deleted — assume it is compromised.
15
+
16
+ ## When .env stops being enough
17
+
18
+ `.env` files do not scale past a single developer: no audit trail, no
19
+ rotation, manual sharing. Escalate to a secret manager when the team or
20
+ the secret count grows. Common paths, in rough order of adoption effort:
21
+
22
+ | Option | Shape | Fits when |
23
+ |---|---|---|
24
+ | [sops](https://github.com/getsops/sops) + age | encrypted files in the repo | small teams, GitOps workflows, no SaaS dependency |
25
+ | [1Password CLI](https://developer.1password.com/docs/cli/) (`op run`) | secrets injected from a shared vault | team already uses 1Password |
26
+ | [Doppler](https://docs.doppler.com/) | hosted secret manager with env sync | many environments/services, need audit + rotation |
27
+ | Cloud-native (AWS/GCP/Azure secret managers) | IAM-scoped, per-service | production workloads already on that cloud |
28
+
29
+ The scaffolder deliberately installs **none** of these — the choice is
30
+ org-specific. Whichever you pick, keep the contract: `.env.example` stays
31
+ the documentation of record for *what* variables exist; the manager owns
32
+ *values*.
33
+
34
+ ## Credential separation (the actual prod-safety boundary)
35
+
36
+ The `prod_guard` hook flags destructive commands (`terraform destroy`,
37
+ `DROP DATABASE`, cloud deletes — see the `prod_guard` hook), but a
38
+ deny-list is a guardrail, not a guarantee (ADR-012). The guarantee is that
39
+ **agent sessions never hold production credentials**:
40
+
41
+ - `.env` files used in agent sessions contain dev/staging values only.
42
+ - Production credentials live in the secret manager and are injected
43
+ exclusively into review-gated CI deploy jobs — never into a local shell
44
+ an agent runs in.
45
+ - A guard cannot delete what the session cannot reach.
46
+
47
+ ## CI secrets
48
+
49
+ Use the platform's mechanism (GitHub Actions secrets/environments), never
50
+ files in the repo. Scope them per-environment and rotate on offboarding.
@@ -0,0 +1,36 @@
1
+ # Using Memory
2
+
3
+ Two complementary memory systems work together in this project.
4
+
5
+ ## `.claude/memory/` — Agent recall
6
+
7
+ Small, structured facts that agents read at the start of each session.
8
+
9
+ - **Index:** `memory/MEMORY.md` — one line per memory file, loaded every session
10
+ - **Files:** `memory/<topic>.md` with frontmatter (`name`, `description`, `type`)
11
+ - **Types:** `user`, `feedback`, `project`, `reference`
12
+ - **When to write:** Learning something reusable that would save time next session
13
+
14
+ Quick-save via slash command:
15
+ ```
16
+ /save_memory <fact>
17
+ ```
18
+
19
+ ## `.claude/vault/` — Human workspace
20
+
21
+ Exploratory notes, session logs, design sketches. Managed in Obsidian.
22
+
23
+ - **Sessions:** `vault/sessions/YYYY-MM-DD.md` — written by the `/session_summary` skill
24
+ - **Decisions:** `vault/decisions/` — working notes before a decision solidifies
25
+ - **Knowledge:** `vault/knowledge/` — concepts, research, architecture explorations
26
+
27
+ ## The one-way flow
28
+
29
+ When an exploratory vault note becomes a real decision:
30
+
31
+ 1. Create `docs/adr/adr-NNN-<topic>.md` (see existing ADRs for format)
32
+ 2. Update `docs/README.md` to link the new ADR
33
+ 3. Commit and push
34
+ 4. Delete or summarise the vault note (avoid duplication)
35
+
36
+ Agents read `docs/adr/` — not vault — for authoritative decisions.
@@ -0,0 +1,15 @@
1
+ # `.claude/hooks/`
2
+
3
+ Session hooks — deterministic bash or python scripts. The `settings.json` at `.claude/settings.json` wires them to Claude Code events (SessionStart, SessionEnd, PreToolUse, etc.).
4
+
5
+ Keep hooks fast, idempotent, and non-interactive.
6
+
7
+ These hooks are fast-feedback UX for Claude Code sessions — they are not the
8
+ security boundary. Secret scanning (gitleaks) and lifecycle gating run as git
9
+ hooks installed by `.claude/scripts/install_hooks.sh`, with CI as the
10
+ backstop, so they bind every agent and every human (ADR-007).
11
+
12
+ ## Hook Executability Convention
13
+
14
+ - **Shell hooks** (`.sh` files): Must have the executable bit (`+x`). They run directly via `bash path/to/hook.sh`.
15
+ - **Python hooks** (`.py` files): Do NOT need the executable bit. They are invoked via `python3 path/to/hook.py`.
@@ -0,0 +1,64 @@
1
+ {{#if multi_agent}}#!/usr/bin/env python3
2
+ """Adapt non-Claude agent hook payloads for the shared dag_workflow guard.
3
+
4
+ Codex (PreToolUse via .codex/hooks.json) and Gemini CLI (BeforeTool via the
5
+ project extension) reuse the same COMMAND_RULES enforcement Claude Code gets
6
+ from github_command_guard.sh. Payloads differ slightly per agent, so this
7
+ shim extracts the shell command, feeds a Claude-shaped payload into
8
+ dag_workflow.py guard, and translates the verdict to the caller's dialect:
9
+
10
+ codex -> {"decision": "block", ...} (Codex accepts Claude's shape)
11
+ gemini -> {"decision": "deny", ...}
12
+
13
+ Fail-open by design: on any parse error the command proceeds — git hooks
14
+ and CI remain the real enforcement boundary (ADR-007).
15
+
16
+ Usage (wired by the scaffolded hook configs): agent_guard_adapter.py <dialect>
17
+ """
18
+
19
+ import json
20
+ import subprocess
21
+ import sys
22
+ from pathlib import Path
23
+
24
+
25
+ def _extract_command(payload: dict) -> str:
26
+ tool_input = payload.get("tool_input") or payload.get("toolInput") or {}
27
+ command = tool_input.get("command") or tool_input.get("cmd") or ""
28
+ if isinstance(command, list):
29
+ command = " ".join(str(part) for part in command)
30
+ return str(command)
31
+
32
+
33
+ def main() -> int:
34
+ dialect = sys.argv[1] if len(sys.argv) > 1 else "codex"
35
+ try:
36
+ payload = json.loads(sys.stdin.read() or "{}")
37
+ except json.JSONDecodeError:
38
+ return 0
39
+ command = _extract_command(payload)
40
+ if not command:
41
+ return 0
42
+
43
+ guard = Path(__file__).with_name("dag_workflow.py")
44
+ proc = subprocess.run(
45
+ [sys.executable, str(guard), "guard"],
46
+ input=json.dumps({"tool_input": {"command": command}}),
47
+ capture_output=True,
48
+ text=True,
49
+ check=False,
50
+ )
51
+ try:
52
+ verdict = json.loads(proc.stdout.strip() or "null")
53
+ except json.JSONDecodeError:
54
+ return 0
55
+ if isinstance(verdict, dict) and verdict.get("decision") == "block":
56
+ if dialect == "gemini":
57
+ verdict = {"decision": "deny", "reason": verdict.get("reason", "")}
58
+ sys.stdout.write(json.dumps(verdict))
59
+ return 0
60
+
61
+
62
+ if __name__ == "__main__":
63
+ sys.exit(main())
64
+ {{/if multi_agent}}