guardian-framework 0.1.0

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 (216) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +463 -0
  3. package/dist/cli.js +12958 -0
  4. package/dist/exports.js +12765 -0
  5. package/package.json +61 -0
  6. package/templates/languages/go-patterns.md +411 -0
  7. package/templates/languages/java-patterns.md +545 -0
  8. package/templates/languages/python-patterns.md +312 -0
  9. package/templates/languages/rust-patterns.md +232 -0
  10. package/templates/languages/typescript-patterns.md +313 -0
  11. package/templates/pi/INDEX.md +437 -0
  12. package/templates/pi/agent/AGENTS.md +166 -0
  13. package/templates/pi/agents/architecture-coordinator.md +40 -0
  14. package/templates/pi/agents/architecture-validator.md +36 -0
  15. package/templates/pi/agents/bootstrap-implementer.md +37 -0
  16. package/templates/pi/agents/issue-factory.md +31 -0
  17. package/templates/pi/agents/operations-validator.md +32 -0
  18. package/templates/pi/agents/security-validator.md +33 -0
  19. package/templates/pi/architecture/CHANGELOG.md +78 -0
  20. package/templates/pi/architecture/decisions/ADR-template.md +76 -0
  21. package/templates/pi/architecture/diagrams/system-overview.md +159 -0
  22. package/templates/pi/architecture/modules/module-template.md +152 -0
  23. package/templates/pi/context/checklists.md +91 -0
  24. package/templates/pi/context/domain-workflow.md +180 -0
  25. package/templates/pi/context/output-formats.md +135 -0
  26. package/templates/pi/context/patterns-base.md +47 -0
  27. package/templates/pi/context/patterns.md +38 -0
  28. package/templates/pi/context/project.md +88 -0
  29. package/templates/pi/domain/exploration.md +93 -0
  30. package/templates/pi/domain/ubiquitous-language.md +24 -0
  31. package/templates/pi/extensions/architect-lib/generators.ts +528 -0
  32. package/templates/pi/extensions/architect-lib/helpers.ts +344 -0
  33. package/templates/pi/extensions/architect-lib/types.ts +117 -0
  34. package/templates/pi/extensions/architect.ts +1425 -0
  35. package/templates/pi/extensions/ask-user-question.ts +579 -0
  36. package/templates/pi/extensions/bash-guard.ts +556 -0
  37. package/templates/pi/extensions/config-reload.ts +115 -0
  38. package/templates/pi/extensions/coordinator.ts +304 -0
  39. package/templates/pi/extensions/curator.ts +543 -0
  40. package/templates/pi/extensions/domain-explorer.ts +990 -0
  41. package/templates/pi/extensions/filechanges.ts +656 -0
  42. package/templates/pi/extensions/goal-loop.ts +717 -0
  43. package/templates/pi/extensions/hooks.ts +452 -0
  44. package/templates/pi/extensions/kanban.ts +547 -0
  45. package/templates/pi/extensions/pipeline.ts +1246 -0
  46. package/templates/pi/extensions/plan-mode.ts +209 -0
  47. package/templates/pi/extensions/project-scaffolder.ts +284 -0
  48. package/templates/pi/extensions/read-only-mode.ts +192 -0
  49. package/templates/pi/extensions/redaction.ts +128 -0
  50. package/templates/pi/extensions/session-persistence.ts +174 -0
  51. package/templates/pi/extensions/slash-commands.ts +229 -0
  52. package/templates/pi/extensions/snippets.ts +201 -0
  53. package/templates/pi/extensions/validation-runner.ts +100 -0
  54. package/templates/pi/github/agents/architecture-coordinator.agent.md +27 -0
  55. package/templates/pi/github/agents/architecture-validator.agent.md +20 -0
  56. package/templates/pi/github/agents/bootstrap-implementer.agent.md +20 -0
  57. package/templates/pi/github/agents/epic-planner.agent.md +70 -0
  58. package/templates/pi/github/agents/issue-factory.agent.md +20 -0
  59. package/templates/pi/github/agents/operations-validator.agent.md +20 -0
  60. package/templates/pi/github/agents/security-validator.agent.md +20 -0
  61. package/templates/pi/github/copilot/settings.json +16 -0
  62. package/templates/pi/github/copilot-instructions.md +155 -0
  63. package/templates/pi/github/instructions/architecture.instructions.md +71 -0
  64. package/templates/pi/github/instructions/validation.instructions.md +69 -0
  65. package/templates/pi/github/workflows/01-planning-workflow.md +75 -0
  66. package/templates/pi/github/workflows/02-issue-generation-workflow.md +69 -0
  67. package/templates/pi/github/workflows/03-implementation-workflow.md +80 -0
  68. package/templates/pi/github/workflows/04-validation-workflow.md +68 -0
  69. package/templates/pi/preflight_report.json +99 -0
  70. package/templates/pi/prompts/blueprint-update.md +262 -0
  71. package/templates/pi/prompts/blueprint-validate.md +218 -0
  72. package/templates/pi/prompts/bug-fix.md +50 -0
  73. package/templates/pi/prompts/ci-blueprint.md +131 -0
  74. package/templates/pi/prompts/context-refresh.md +258 -0
  75. package/templates/pi/prompts/epic-plan.md +356 -0
  76. package/templates/pi/prompts/epic-template.md +186 -0
  77. package/templates/pi/prompts/feature-development.md +131 -0
  78. package/templates/pi/prompts/git-issues.md +243 -0
  79. package/templates/pi/prompts/hotfix.md +71 -0
  80. package/templates/pi/prompts/issue-closeout.md +342 -0
  81. package/templates/pi/prompts/issue-draft.md +218 -0
  82. package/templates/pi/prompts/issue-implementation-series.md +173 -0
  83. package/templates/pi/prompts/issue-merge.md +372 -0
  84. package/templates/pi/prompts/issue-template-set.md +392 -0
  85. package/templates/pi/prompts/issue-template.md +207 -0
  86. package/templates/pi/prompts/pattern-extract.md +269 -0
  87. package/templates/pi/prompts/plan-to-issues.md +430 -0
  88. package/templates/pi/prompts/refactoring.md +82 -0
  89. package/templates/pi/prompts/scope-analyzer.md +254 -0
  90. package/templates/pi/prompts/sync-check.md +230 -0
  91. package/templates/pi/scripts/categorize-issues.sh +171 -0
  92. package/templates/pi/scripts/ci/check_architecture_conformance.sh +748 -0
  93. package/templates/pi/scripts/ci/check_planning_packet.py +228 -0
  94. package/templates/pi/scripts/ci/run_hardening_stages.sh +264 -0
  95. package/templates/pi/scripts/ci/run_preflight.sh +649 -0
  96. package/templates/pi/scripts/ci/run_stage.sh +193 -0
  97. package/templates/pi/scripts/ci/stage_docs_policy.sh +82 -0
  98. package/templates/pi/scripts/ci/stage_integration.sh +3 -0
  99. package/templates/pi/scripts/ci/stage_lint.sh +130 -0
  100. package/templates/pi/scripts/ci/stage_migration_verify.sh +3 -0
  101. package/templates/pi/scripts/ci/stage_package_build.sh +3 -0
  102. package/templates/pi/scripts/ci/stage_release_readiness.sh +3 -0
  103. package/templates/pi/scripts/ci/stage_remaining.sh +242 -0
  104. package/templates/pi/scripts/ci/stage_security.sh +3 -0
  105. package/templates/pi/scripts/ci/stage_static_analysis.sh +114 -0
  106. package/templates/pi/scripts/ci/stage_unit.sh +119 -0
  107. package/templates/pi/scripts/ci/validate_agent_output.py +181 -0
  108. package/templates/pi/scripts/ci/validate_agent_output.sh +243 -0
  109. package/templates/pi/scripts/create-feature-branch.sh +136 -0
  110. package/templates/pi/scripts/create-mr.sh +117 -0
  111. package/templates/pi/scripts/fetch-issues.sh +131 -0
  112. package/templates/pi/scripts/generate-architecture.sh +161 -0
  113. package/templates/pi/scripts/git/close-epic.sh +69 -0
  114. package/templates/pi/scripts/git/close-issue.sh +35 -0
  115. package/templates/pi/scripts/git/create-tracking-issue.sh +174 -0
  116. package/templates/pi/scripts/git/link-issue-to-epic.sh +51 -0
  117. package/templates/pi/scripts/git/update-tracking-issue.sh +66 -0
  118. package/templates/pi/scripts/languages/go/validate-architecture.sh +139 -0
  119. package/templates/pi/scripts/languages/go/validate-canonical.sh +129 -0
  120. package/templates/pi/scripts/languages/go/validate-ci.sh +132 -0
  121. package/templates/pi/scripts/languages/go/validate-integration.sh +156 -0
  122. package/templates/pi/scripts/languages/go/validate-operations.sh +146 -0
  123. package/templates/pi/scripts/languages/go/validate-security.sh +135 -0
  124. package/templates/pi/scripts/languages/go/validate-tests.sh +125 -0
  125. package/templates/pi/scripts/languages/java/validate-annotations.sh +185 -0
  126. package/templates/pi/scripts/languages/java/validate-architecture.sh +159 -0
  127. package/templates/pi/scripts/languages/java/validate-canonical.sh +114 -0
  128. package/templates/pi/scripts/languages/java/validate-ci.sh +269 -0
  129. package/templates/pi/scripts/languages/java/validate-integration.sh +149 -0
  130. package/templates/pi/scripts/languages/java/validate-operations.sh +142 -0
  131. package/templates/pi/scripts/languages/java/validate-security.sh +174 -0
  132. package/templates/pi/scripts/languages/java/validate-spring-architecture.sh +227 -0
  133. package/templates/pi/scripts/languages/java/validate-tests.sh +159 -0
  134. package/templates/pi/scripts/languages/python/validate-architecture.sh +99 -0
  135. package/templates/pi/scripts/languages/python/validate-canonical.sh +124 -0
  136. package/templates/pi/scripts/languages/python/validate-ci.sh +130 -0
  137. package/templates/pi/scripts/languages/python/validate-integration.sh +119 -0
  138. package/templates/pi/scripts/languages/python/validate-operations.sh +107 -0
  139. package/templates/pi/scripts/languages/python/validate-security.sh +68 -0
  140. package/templates/pi/scripts/languages/python/validate-tests.sh +102 -0
  141. package/templates/pi/scripts/languages/rust/validate-architecture.sh +188 -0
  142. package/templates/pi/scripts/languages/rust/validate-canonical.sh +146 -0
  143. package/templates/pi/scripts/languages/rust/validate-ci.sh +147 -0
  144. package/templates/pi/scripts/languages/rust/validate-integration.sh +149 -0
  145. package/templates/pi/scripts/languages/rust/validate-operations.sh +154 -0
  146. package/templates/pi/scripts/languages/rust/validate-security.sh +153 -0
  147. package/templates/pi/scripts/languages/rust/validate-tests.sh +150 -0
  148. package/templates/pi/scripts/languages/typescript/validate-architecture.sh +157 -0
  149. package/templates/pi/scripts/languages/typescript/validate-canonical.sh +135 -0
  150. package/templates/pi/scripts/languages/typescript/validate-ci.sh +244 -0
  151. package/templates/pi/scripts/languages/typescript/validate-integration.sh +166 -0
  152. package/templates/pi/scripts/languages/typescript/validate-operations.sh +162 -0
  153. package/templates/pi/scripts/languages/typescript/validate-security.sh +169 -0
  154. package/templates/pi/scripts/languages/typescript/validate-tests.sh +158 -0
  155. package/templates/pi/scripts/merge-mr.sh +95 -0
  156. package/templates/pi/scripts/mr-validation.sh +228 -0
  157. package/templates/pi/scripts/validate-architecture-readiness.sh +153 -0
  158. package/templates/pi/scripts/validate-architecture.sh +22 -0
  159. package/templates/pi/scripts/validate-canonical.sh +22 -0
  160. package/templates/pi/scripts/validate-ci.sh +37 -0
  161. package/templates/pi/scripts/validate-integration.sh +22 -0
  162. package/templates/pi/scripts/validate-operations.sh +22 -0
  163. package/templates/pi/scripts/validate-security.sh +22 -0
  164. package/templates/pi/scripts/validate-tests.sh +22 -0
  165. package/templates/pi/scripts/validate-ubiquitous-language.sh +291 -0
  166. package/templates/pi/scripts/validation-cache.sh +139 -0
  167. package/templates/pi/skills/agents/architecture-coordinator.md +178 -0
  168. package/templates/pi/skills/agents/architecture-generator.md +79 -0
  169. package/templates/pi/skills/agents/architecture-validator.md +74 -0
  170. package/templates/pi/skills/agents/ci-mr-validator.md +46 -0
  171. package/templates/pi/skills/agents/code-developer.md +76 -0
  172. package/templates/pi/skills/agents/commit.md +46 -0
  173. package/templates/pi/skills/agents/curator.md +71 -0
  174. package/templates/pi/skills/agents/debug.md +59 -0
  175. package/templates/pi/skills/agents/documentation-maintainer.md +36 -0
  176. package/templates/pi/skills/agents/goal-loop.md +125 -0
  177. package/templates/pi/skills/agents/hooks.md +122 -0
  178. package/templates/pi/skills/agents/integration-validator.md +35 -0
  179. package/templates/pi/skills/agents/issue-creator.md +75 -0
  180. package/templates/pi/skills/agents/issue-factory.md +143 -0
  181. package/templates/pi/skills/agents/kanban.md +85 -0
  182. package/templates/pi/skills/agents/land.md +59 -0
  183. package/templates/pi/skills/agents/operations-validator.md +43 -0
  184. package/templates/pi/skills/agents/pipeline.md +113 -0
  185. package/templates/pi/skills/agents/plan-mode.md +77 -0
  186. package/templates/pi/skills/agents/pull.md +40 -0
  187. package/templates/pi/skills/agents/push.md +41 -0
  188. package/templates/pi/skills/agents/security-validator.md +85 -0
  189. package/templates/pi/skills/agents/session-persistence.md +119 -0
  190. package/templates/pi/skills/agents/slash-commands.md +117 -0
  191. package/templates/pi/skills/agents/snippets.md +99 -0
  192. package/templates/pi/skills/agents/subagent-registry.md +78 -0
  193. package/templates/pi/skills/agents/test-validator.md +42 -0
  194. package/templates/pi/skills/validators/architecture-validator.md +43 -0
  195. package/templates/pi/skills/validators/ci-validator.md +27 -0
  196. package/templates/pi/skills/validators/context-compaction.md +73 -0
  197. package/templates/pi/skills/validators/integration-validator.md +38 -0
  198. package/templates/pi/skills/validators/model-registry.md +96 -0
  199. package/templates/pi/skills/validators/operations-validator.md +34 -0
  200. package/templates/pi/skills/validators/security-guards.md +72 -0
  201. package/templates/pi/skills/validators/security-validator.md +41 -0
  202. package/templates/pi/skills/validators/system-prompt-tiers.md +69 -0
  203. package/templates/pi/skills/validators/test-validator.md +33 -0
  204. package/templates/pi/types.ts +62 -0
  205. package/templates/pi/validators/README.md +93 -0
  206. package/templates/pi/validators/default.toml +209 -0
  207. package/templates/pi/validators/spring.toml +142 -0
  208. package/templates/pi/workpad.md +53 -0
  209. package/templates/project/java/Dockerfile +14 -0
  210. package/templates/project/java/README.md +40 -0
  211. package/templates/project/java/pom.xml +132 -0
  212. package/templates/project/typescript/Dockerfile +15 -0
  213. package/templates/project/typescript/README.md +29 -0
  214. package/templates/project/typescript/package.json +23 -0
  215. package/templates/project/typescript/tsconfig.json +21 -0
  216. package/templates/workflow.md +123 -0
@@ -0,0 +1,186 @@
1
+ # Guardian Epic Template
2
+
3
+ > **Use this template for feature epics and platform-hardening epics derived from canonical architecture modules.**
4
+ > Every epic generated by `/architect` follows this contract. The YAML front matter is parsed by Guardian for pipeline orchestration; the body is the human-readable epic description.
5
+
6
+ ## Purpose
7
+
8
+ Defines the structure for Guardian epics. Every epic generated by `/architect` follows this contract.
9
+
10
+ ---
11
+
12
+ ## Epic Title
13
+
14
+ `<type>: <feature or hardening stream>`
15
+
16
+ Examples:
17
+ - `feature: gate decision resume flow`
18
+ - `hardening: tenant-safe SSE and replay conformance`
19
+ - `platform: architecture and quality CI guardrails`
20
+
21
+ ---
22
+
23
+ ## Why
24
+
25
+ Describe the business, platform, reliability, security, or operational reason.
26
+
27
+ Prompts:
28
+ - What outcome does this epic unlock?
29
+ - What risk does it reduce?
30
+ - Why now?
31
+
32
+ ---
33
+
34
+ ## Target Outcome
35
+
36
+ Define the end state in concrete language.
37
+
38
+ Example:
39
+ - Gate decisions resume runs deterministically through the outbox → queue → worker path.
40
+ - Replay remains audit-safe and version-compatible.
41
+ - Guardian CI blocks merges that violate architecture conformance.
42
+
43
+ ---
44
+
45
+ ## Scope
46
+
47
+ State the exact scope boundaries.
48
+
49
+ Include:
50
+ - primary use case or hardening stream
51
+ - touched bounded contexts
52
+ - touched architecture layers
53
+ - touched runtime or operational behavior
54
+
55
+ ---
56
+
57
+ ## In Scope
58
+
59
+ - ...
60
+ - ...
61
+ - ...
62
+
63
+ ## Out of Scope
64
+
65
+ - ...
66
+ - ...
67
+ - ...
68
+
69
+ ---
70
+
71
+ ## Impacted Layers
72
+
73
+ Mark all that apply.
74
+
75
+ - [ ] Overview / orchestration
76
+ - [ ] Domain
77
+ - [ ] Application
78
+ - [ ] Infrastructure
79
+ - [ ] Runtime execution
80
+ - [ ] Security
81
+ - [ ] Operations
82
+
83
+ ---
84
+
85
+ ## Architecture Constraints
86
+
87
+ List non-negotiable rules from canonical docs.
88
+
89
+ Examples:
90
+ - `Run` aggregate remains the source of truth for lifecycle and gate state.
91
+ - Tenant-scoped DB work must use `begin_tenant_transaction()`.
92
+ - Event ordering remains authoritative in Postgres by `(run_id, sequence)`.
93
+ - Production SSE uses Redis Streams + DB catch-up, not non-durable Pub/Sub.
94
+
95
+ ---
96
+
97
+ ## Dependency Map
98
+
99
+ List issue order using dependency direction.
100
+
101
+ 1. contract issue
102
+ 2. schema/index issue
103
+ 3. repository/service issue
104
+ 4. handler/runtime issue
105
+ 5. verification issue
106
+ 6. rollout/runbook issue
107
+
108
+ ---
109
+
110
+ ## Required Child Issues
111
+
112
+ - [ ] Contract and architecture reconciliation
113
+ - [ ] Schema/index/config changes
114
+ - [ ] Implementation issues by layer
115
+ - [ ] Verification/conformance issue
116
+ - [ ] Rollout/runbook/observability issue
117
+
118
+ ---
119
+
120
+ ## Required Reviewers
121
+
122
+ - [ ] Architecture
123
+ - [ ] Security
124
+ - [ ] Operations
125
+ - [ ] Backend implementation owner
126
+
127
+ ---
128
+
129
+ ## Verification Strategy
130
+
131
+ Describe what must prove the epic is complete.
132
+
133
+ Include as applicable:
134
+ - unit tests
135
+ - integration tests
136
+ - architecture conformance tests
137
+ - migration verification
138
+ - security checks
139
+ - observability validation
140
+ - rollout rehearsal or dry run
141
+
142
+ ---
143
+
144
+ ## Rollout and Risk Notes
145
+
146
+ Describe:
147
+ - feature flag or staged rollout needed or not
148
+ - migration ordering risks
149
+ - backwards compatibility concerns
150
+ - failure modes
151
+ - rollback plan
152
+
153
+ ---
154
+
155
+ ## Canonical References
156
+
157
+ Must include exact docs used to derive this epic.
158
+
159
+ Minimum:
160
+ - `.pi/architecture/modules/<module>.md`
161
+ - relevant ADRs
162
+ - relevant workflow docs
163
+
164
+ Recommended pattern:
165
+ - `.pi/architecture/modules/<module>.md`
166
+ - `.pi/architecture/decisions/ADR-*.md`
167
+ - `.pi/prompts/epic-plan.md`
168
+ - `.pi/prompts/issue-implementation-series.md`
169
+ - layer-specific references for the impacted work
170
+
171
+ ---
172
+
173
+ ## Epic Checklist
174
+
175
+ - [ ] Scope is bounded
176
+ - [ ] Impacted layers are identified
177
+ - [ ] Architecture constraints are explicit
178
+ - [ ] Dependency order is explicit
179
+ - [ ] Required tests are explicit
180
+ - [ ] Required CI gates are explicit
181
+ - [ ] Reviewer map is explicit
182
+ - [ ] Rollout notes exist
183
+
184
+ ---
185
+
186
+ *Use this epic template before generating child issues.*
@@ -0,0 +1,131 @@
1
+ # Feature Development Workflow
2
+
3
+ <!--
4
+ Canonical Reference: .pi/prompts/feature-development.md
5
+ Blueprint Source: Guardian Framework v1.2
6
+ -->
7
+
8
+ **Scope:** Moderate, Complex, Critical
9
+ **Optimized for:** Minimal token usage via shift-left validation + automated post-code checks
10
+
11
+ ## Canonical Reference Requirement
12
+
13
+ **All implementation files created/modified in this workflow must include:**
14
+
15
+ ```typescript
16
+ /**
17
+ * Canonical Reference: .pi/architecture/modules/[module].md#[section]
18
+ * Implements: [feature from design proposal]
19
+ * Issue: #[issue-number]
20
+ * Last Architecture Sync: [check CHANGELOG.md]
21
+ ```
22
+
23
+ **Before implementation:**
24
+ 1. Check `.pi/architecture/CHANGELOG.md` for pending changes affecting target module
25
+ 2. Verify architecture module doc is current
26
+
27
+ **Validation Phase includes canonical reference check:** `validate-canonical.sh`
28
+
29
+ ## Flow
30
+
31
+ ```
32
+ User Request
33
+
34
+
35
+ ┌─────────────────────────────────┐
36
+ │ 1. COORDINATOR: Classify scope │
37
+ │ Load: context/project.md │
38
+ │ Output: scope + validators │
39
+ └──────────────┬──────────────────┘
40
+
41
+
42
+ ┌─────────────────────────────────┐
43
+ │ 2. ISSUE-CREATOR: Create issue │
44
+ │ Output: GitHub issue #N │
45
+ └──────────────┬──────────────────┘
46
+
47
+
48
+ ┌─────────────────────────────────────────────┐
49
+ │ 3. VALIDATORS (Parallel): Plan Review ONLY │
50
+ │ • architecture-validator (Moderate+) │
51
+ │ • security-validator (Complex+) │
52
+ │ Load: context/checklists.md (plan section)│
53
+ │ Output: Validation Contract (signed) │
54
+ └──────────────┬──────────────────────────────┘
55
+
56
+
57
+ ┌─────────────────────────────────┐
58
+ │ 4. COORDINATOR: Synthesize plan │
59
+ │ Output: Design Proposal │
60
+ │ → User approval if Critical │
61
+ └──────────────┬──────────────────┘
62
+
63
+
64
+ ┌──────────────────────────────────────┐
65
+ │ 5. CODE-DEVELOPER: Implement │
66
+ │ Input: Design Proposal + Contract │
67
+ │ Load: context/patterns.md │
68
+ │ Add: Canonical Reference Headers │
69
+ │ Output: Code + tests │
70
+ └──────────────┬───────────────────────┘
71
+
72
+
73
+ ┌─────────────────────────────────────────────┐
74
+ │ 6. POST-CODE: Automated Checks (NO LLM) │
75
+ │ • bash .pi/scripts/validate-ci.sh │
76
+ │ • bash .pi/scripts/validate-tests.sh │
77
+ │ • bash .pi/scripts/validate-operations.sh │
78
+ │ • bash .pi/scripts/validate-security.sh │
79
+ │ • bash .pi/scripts/validate-canonical.sh│
80
+ │ Output: Pass/Fail per check │
81
+ └──────────────┬──────────────────────────────┘
82
+
83
+
84
+ ┌─────────────────────────────────────────────┐
85
+ │ 7. LLM VALIDATORS: Wiring Checks ONLY │
86
+ │ • architecture-validator: callers, dupes │
87
+ │ • security-validator: manual review if │
88
+ │ automated scan flagged something │
89
+ │ Output: Final verdict │
90
+ └──────────────┬──────────────────────────────┘
91
+
92
+
93
+ ┌─────────────────────────────────┐
94
+ │ 8. CI-MR: Create PR + merge │
95
+ │ Output: Merged PR │
96
+ └─────────────────────────────────┘
97
+ ```
98
+
99
+ ## Key Optimization: Shift-Left Validation
100
+
101
+ **Old (token-heavy):**
102
+ - Validators review plan → Validators review code (same checks twice)
103
+ - 5 LLM validators × 2 passes = 10 LLM calls
104
+
105
+ **New (token-optimized):**
106
+ - Validators review plan ONCE → Sign Validation Contract
107
+ - Post-code = automated scripts + wiring checks only
108
+ - 2 LLM validators × 1 pass + 4 automated scripts = 2 LLM calls
109
+
110
+ ## Retry with Caching
111
+
112
+ If post-code wiring checks fail:
113
+ 1. `validation-cache.sh get-failed <task-id> architecture-validator`
114
+ 2. Re-check ONLY failed items (not all checks)
115
+ 3. `validation-cache.sh record <task-id> <validator> <check> pass`
116
+ 4. Repeat until all pass
117
+
118
+ ## Commands
119
+
120
+ ```bash
121
+ # Run all automated validators
122
+ bash .pi/scripts/validate-ci.sh
123
+ bash .pi/scripts/validate-tests.sh
124
+ bash .pi/scripts/validate-operations.sh [src_dir]
125
+ bash .pi/scripts/validate-security.sh [src_dir]
126
+ bash .pi/scripts/validate-canonical.sh # Check canonical references
127
+
128
+ # Validation cache
129
+ bash .pi/scripts/validation-cache.sh init <task-id>
130
+ bash .pi/scripts/validation-cache.sh summary <task-id>
131
+ ```
@@ -0,0 +1,243 @@
1
+ # Git Issues Workflow
2
+
3
+ **Purpose:** Create epics/milestones and all issues in GitHub or GitLab, including the tracking issue.
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ - Issue drafts approved (from `/issue-draft`)
10
+ - Git repository tool configured (`{{REPOTOOL}}`)
11
+ - Repository remote properly configured
12
+
13
+ ---
14
+
15
+ ## Workflow Steps
16
+
17
+ ### 1. Verify Repository Access
18
+
19
+ Check that the repository tool is configured and authenticated:
20
+
21
+ ```bash
22
+ # For GitHub (gh)
23
+ gh auth status
24
+ gh repo view {{REPOSITORY}}
25
+
26
+ # For GitLab (glab)
27
+ glab auth status
28
+ glab repo view {{REPOSITORY}}
29
+ ```
30
+
31
+ ### 2. Create Epic/Milestone
32
+
33
+ **For GitHub (using gh):**
34
+
35
+ ```bash
36
+ # Create milestone
37
+ gh api repos/{{REPOSITORY}}/milestones \
38
+ -f title="[EPIC_NAME]" \
39
+ -f description="[EPIC_DESCRIPTION]" \
40
+ -f state="open"
41
+
42
+ # Get milestone number
43
+ gh api repos/{{REPOSITORY}}/milestones --jq '.[] | select(.title=="[EPIC_NAME]") | .number'
44
+ ```
45
+
46
+ **For GitLab (using glab):**
47
+
48
+ ```bash
49
+ # Create epic (GitLab Premium/Ultimate)
50
+ glab api projects/:id/epics \
51
+ -f title="[EPIC_NAME]" \
52
+ -f description="[EPIC_DESCRIPTION]" \
53
+ -f labels="epic"
54
+
55
+ # Or create milestone for GitLab Free
56
+ glab api projects/:id/milestones \
57
+ -f title="[EPIC_NAME]" \
58
+ -f description="[EPIC_DESCRIPTION]"
59
+ ```
60
+
61
+ ### 3. Create Individual Issues
62
+
63
+ **For GitHub (gh):**
64
+
65
+ ```bash
66
+ gh issue create \
67
+ --title "[ISSUE_TITLE]" \
68
+ --body "[ISSUE_BODY_FROM_DRAFT]" \
69
+ --label "type:[feature/bug/refactor],scope:[simple/moderate/complex]" \
70
+ --milestone "[MILESTONE_NUMBER]"
71
+ ```
72
+
73
+ **For GitLab (glab):**
74
+
75
+ ```bash
76
+ glab issue create \
77
+ --title "[ISSUE_TITLE]" \
78
+ --description "[ISSUE_BODY_FROM_DRAFT]" \
79
+ --label "type:[feature/bug/refactor],scope:[simple/moderate/complex]" \
80
+ --milestone "[MILESTONE_ID]"
81
+ ```
82
+
83
+ ### 4. Record Issue Numbers
84
+
85
+ After creating each issue, record the issue number for the tracking issue:
86
+
87
+ ```markdown
88
+ ### Issue Numbers Created
89
+ - Issue 1: #[number]
90
+ - Issue 2: #[number]
91
+ - Issue 3: #[number]
92
+ - Milestone/Epic: #[number]
93
+ ```
94
+
95
+ ### 5. Create Tracking Issue
96
+
97
+ Create the tracking issue with links to all created issues:
98
+
99
+ **GitHub Tracking Issue:**
100
+
101
+ ```bash
102
+ gh issue create \
103
+ --title "Tracking: [EPIC_NAME]" \
104
+ --body "$(cat <<'EOF'
105
+ ## Epic Progress Tracking
106
+
107
+ ### Milestone: #[milestone_number]
108
+
109
+ ### Issues Checklist
110
+ - [ ] #[issue_1] - [Issue title]
111
+ - [ ] #[issue_2] - [Issue title]
112
+ - [ ] #[issue_3] - [Issue title]
113
+
114
+ ### Progress
115
+ - Total Issues: [N]
116
+ - Completed: 0/[N] (0%)
117
+ - In Progress: 0/[N] (0%)
118
+
119
+ ### Timeline
120
+ - Start: [date]
121
+ - Target: [date]
122
+
123
+ ---
124
+ *This issue will be updated as epic progresses*
125
+ EOF
126
+ )" \
127
+ --label "tracking,epic"
128
+ ```
129
+
130
+ **GitLab Tracking Issue:**
131
+
132
+ ```bash
133
+ glab issue create \
134
+ --title "Tracking: [EPIC_NAME]" \
135
+ --description "$(cat <<'EOF'
136
+ ## Epic Progress Tracking
137
+
138
+ ### Epic: #[epic_number]
139
+
140
+ ### Child Issues Checklist
141
+ - [ ] #[issue_1] - [Issue title]
142
+ - [ ] #[issue_2] - [Issue title]
143
+ - [ ] #[issue_3] - [Issue title]
144
+
145
+ ### Progress
146
+ - Total Issues: [N]
147
+ - Completed: 0/[N] (0%)
148
+
149
+ ---
150
+ *This issue will be updated as epic progresses*
151
+ EOF
152
+ )" \
153
+ --label "tracking,epic"
154
+ ```
155
+
156
+ ### 6. Link Issues to Epic/Milestone
157
+
158
+ **For GitHub:**
159
+ ```bash
160
+ # Issues automatically linked to milestone via --milestone flag
161
+ # Verify linking
162
+ gh issue view [issue_number] --json milestone
163
+ ```
164
+
165
+ **For GitLab:**
166
+ ```bash
167
+ # Link issues to epic (Premium/Ultimate)
168
+ glab api projects/:id/issues/[issue_iid] \
169
+ -f epic_id="[epic_id]"
170
+ ```
171
+
172
+ ### 7. Verify Creation
173
+
174
+ Verify all issues and tracking are created correctly:
175
+
176
+ ```bash
177
+ # For GitHub
178
+ gh issue list --milestone "[MILESTONE_TITLE]" --limit 50
179
+
180
+ # For GitLab
181
+ glab issue list --milestone "[MILESTONE_TITLE]"
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Output Summary
187
+
188
+ After completion, provide:
189
+
190
+ ```markdown
191
+ ## Git Issues Created
192
+
193
+ ### Repository: {{REPOSITORY}}
194
+ ### Tool: {{REPOTOOL}}
195
+
196
+ ### Epic/Milestone
197
+ - Title: [EPIC_NAME]
198
+ - Number/ID: #[number]
199
+
200
+ ### Issues Created
201
+ | # | Title | Scope | Status |
202
+ |---|-------|-------|--------|
203
+ | #[n] | [title] | [scope] | open |
204
+ | #[n] | [title] | [scope] | open |
205
+ | #[n] | [title] | [scope] | open |
206
+
207
+ ### Tracking Issue
208
+ - Number: #[number]
209
+ - Title: Tracking: [EPIC_NAME]
210
+
211
+ ### Next Steps
212
+ 1. Start implementation on first issue
213
+ 2. Use `/issue-closeout` when issue complete
214
+ 3. Update tracking issue after each merge
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Error Handling
220
+
221
+ | Error | Solution |
222
+ |-------|----------|
223
+ | Authentication failed | Run `gh auth login` or `glab auth login` |
224
+ | Repository not found | Check `{{REPOSITORY}}` format (owner/repo) |
225
+ | Milestone creation failed | Use project ID instead of name |
226
+ | Rate limited | Wait and retry, or use API token |
227
+
228
+ ---
229
+
230
+ ## Acceptance Criteria
231
+
232
+ - [ ] Milestone/Epic created successfully
233
+ - [ ] All individual issues created
234
+ - [ ] Tracking issue created
235
+ - [ ] Issues linked to milestone/epic
236
+ - [ ] Issue numbers recorded
237
+ - [ ] Verification confirms all issues visible
238
+
239
+ ---
240
+
241
+ ## Next Workflow
242
+
243
+ When ready to close out an issue after implementation, run: `/issue-closeout`
@@ -0,0 +1,71 @@
1
+ # Emergency Hotfix Workflow
2
+
3
+ **Scope:** Critical (production issue)
4
+ **Optimized for:** Speed with safety — skip planning, validate post-fix
5
+
6
+ ## Flow
7
+
8
+ ```
9
+ Production Issue Detected
10
+
11
+
12
+ ┌─────────────────────────────────┐
13
+ │ 1. COORDINATOR: Assess severity │
14
+ │ → If critical: hotfix path │
15
+ └──────────────┬──────────────────┘
16
+
17
+
18
+ ┌─────────────────────────────────┐
19
+ │ 2. CODE-DEVELOPER: Fix ASAP │
20
+ │ Minimal change, no refactor │
21
+ │ Load: context/patterns.md │
22
+ └──────────────┬──────────────────┘
23
+
24
+
25
+ ┌─────────────────────────────────┐
26
+ │ 3. ALL AUTOMATED VALIDATORS │
27
+ │ • validate-ci.sh │
28
+ │ • validate-tests.sh │
29
+ │ • validate-operations.sh │
30
+ │ • validate-security.sh │
31
+ └──────────────┬──────────────────┘
32
+
33
+
34
+ ┌─────────────────────────────────┐
35
+ │ 4. SECURITY-VALIDATOR: Review │
36
+ │ Hotfixes can introduce vulns │
37
+ │ Manual review REQUIRED │
38
+ └──────────────┬──────────────────┘
39
+
40
+
41
+ ┌─────────────────────────────────┐
42
+ │ 5. CI-MR: Fast-track merge │
43
+ │ Skip normal review queue │
44
+ │ Human approval still needed │
45
+ └──────────────┬──────────────────┘
46
+
47
+
48
+ ┌─────────────────────────────────┐
49
+ │ 6. POST-MERGE: Full validation │
50
+ │ Run complete validation suite│
51
+ │ Create follow-up issue if │
52
+ │ hotfix introduced tech debt │
53
+ └─────────────────────────────────┘
54
+ ```
55
+
56
+ ## Rules
57
+
58
+ - **NO planning phase** — fix first, validate after
59
+ - **Minimal change** — fix the bug, do NOT refactor
60
+ - **Security review mandatory** — hotfixes are high-risk for introducing vulnerabilities
61
+ - **Post-merge cleanup** — create follow-up issue for any tech debt introduced
62
+
63
+ ## Commands
64
+
65
+ ```bash
66
+ # Full automated validation
67
+ bash .pi/scripts/validate-ci.sh
68
+ bash .pi/scripts/validate-tests.sh
69
+ bash .pi/scripts/validate-operations.sh [src_dir]
70
+ bash .pi/scripts/validate-security.sh [src_dir]
71
+ ```