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,269 @@
1
+ # Pattern Extract Workflow
2
+
3
+ **Purpose:** Extract code patterns from implementation files and add to `.pi/context/patterns.md` for reuse.
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ - Implementation code exists
10
+ - `.pi/context/patterns.md` exists
11
+ - Pattern candidates identified (manual or from context-refresh)
12
+
13
+ ---
14
+
15
+ ## Canonical Reference Requirement
16
+
17
+ **Extracted patterns must include source reference:**
18
+
19
+ ```markdown
20
+ ## Pattern: [Name]
21
+
22
+ <!--
23
+ Canonical Reference: .pi/context/patterns.md#[name]
24
+ Source: src/[original-file].ts
25
+ Extracted: [date]
26
+ -->
27
+
28
+ ### Context
29
+ [When to use]
30
+
31
+ ### Code Template
32
+ ```typescript
33
+ [Pattern code]
34
+ ```
35
+ ```
36
+
37
+ **Original implementation files should reference pattern:**
38
+
39
+ ```typescript
40
+ /**
41
+ * Canonical Reference: .pi/context/patterns.md#[pattern-name]
42
+ * This file demonstrates the [pattern-name] pattern
43
+ */
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Workflow Steps
49
+
50
+ ### 1. Identify Pattern Candidates
51
+
52
+ Find code that could be a reusable pattern:
53
+
54
+ ```bash
55
+ # Functions that appear multiple times
56
+ grep -r "function " src/ | cut -d: -f2 | sort | uniq -c | sort -rn | head -20
57
+
58
+ # Common code blocks
59
+ grep -r "try {" src/ | wc -l
60
+ grep -r "await " src/ | wc -l
61
+
62
+ # Error handling approaches
63
+ grep -r "throw new" src/ | cut -d: -f2 | sort | uniq -c | sort -rn
64
+
65
+ # Type definitions
66
+ grep -r "interface " src/ | cut -d: -f2 | sort | uniq
67
+ ```
68
+
69
+ ### 2. Pattern Candidate Evaluation
70
+
71
+ Evaluate each candidate:
72
+
73
+ **Evaluation Criteria:**
74
+
75
+ | Criterion | Check |
76
+ |-----------|-------|
77
+ | Reusable | Can be applied in multiple contexts |
78
+ | Distinct | Not just standard library usage |
79
+ | Documentable | Clear purpose and usage |
80
+ | Complete | Includes necessary error handling |
81
+
82
+ **Candidate Template:**
83
+
84
+ ```markdown
85
+ ### Candidate: [Name]
86
+
87
+ **Location:** src/foo.ts:50-70
88
+ **Occurrences:** [N] similar patterns found
89
+ **Reusable:** [yes/no/with-modifications]
90
+ **Distinct:** [yes/no]
91
+ **Recommendation:** [extract/dont-extract/modify-first]
92
+ ```
93
+
94
+ ### 3. Extract Pattern Code
95
+
96
+ Extract the pattern from source:
97
+
98
+ ```bash
99
+ # Extract specific lines
100
+ sed -n '50,70p' src/foo.ts
101
+
102
+ # Or extract function
103
+ awk '/^export function foo/,/^}' src/foo.ts
104
+ ```
105
+
106
+ ### 4. Generalize Pattern
107
+
108
+ Convert specific code to general template:
109
+
110
+ **Before (specific):**
111
+ ```typescript
112
+ export async function loadUserConfig() {
113
+ const configPath = path.join(process.cwd(), 'config.json');
114
+ try {
115
+ const content = await fs.readFile(configPath, 'utf-8');
116
+ return JSON.parse(content);
117
+ } catch (err) {
118
+ throw new ConfigError(`Failed to load config: ${err.message}`);
119
+ }
120
+ }
121
+ ```
122
+
123
+ **After (pattern):**
124
+ ```typescript
125
+ /**
126
+ * Pattern: Atomic File Read with Error Handling
127
+ *
128
+ * Usage: Reading configuration or data files with proper error handling
129
+ */
130
+ export async function safeFileRead<T>(
131
+ filePath: string,
132
+ parser: (content: string) => T
133
+ ): Promise<T> {
134
+ try {
135
+ const content = await fs.readFile(filePath, 'utf-8');
136
+ return parser(content);
137
+ } catch (err) {
138
+ throw new FileReadError(`Failed to read ${filePath}: ${err.message}`);
139
+ }
140
+ }
141
+ ```
142
+
143
+ ### 5. Document Pattern
144
+
145
+ Add pattern to patterns.md:
146
+
147
+ ```markdown
148
+ ## Pattern: Safe File Read with Parser
149
+
150
+ <!--
151
+ Canonical Reference: .pi/context/patterns.md#safe-file-read
152
+ Source: src/lib/config.ts
153
+ Extracted: 2026-04-26
154
+ -->
155
+
156
+ ### Context
157
+ Use when reading and parsing files with proper error handling.
158
+
159
+ ### Code Template
160
+ ```typescript
161
+ export async function safeFileRead<T>(
162
+ filePath: string,
163
+ parser: (content: string) => T
164
+ ): Promise<T> {
165
+ try {
166
+ const content = await fs.readFile(filePath, 'utf-8');
167
+ return parser(content);
168
+ } catch (err) {
169
+ throw new FileReadError(`Failed to read ${filePath}: ${err.message}`);
170
+ }
171
+ }
172
+ ```
173
+
174
+ ### Usage Example
175
+ ```typescript
176
+ const config = await safeFileRead('config.json', JSON.parse);
177
+ ```
178
+
179
+ ### Files Using This Pattern
180
+ - src/lib/config.ts (source)
181
+ - src/lib/settings.ts
182
+ ```
183
+
184
+ ### 6. Add Canonical Reference to Source
185
+
186
+ Update original implementation file:
187
+
188
+ ```typescript
189
+ /**
190
+ * Canonical Reference: .pi/context/patterns.md#safe-file-read
191
+ * This implementation demonstrates the Safe File Read pattern
192
+ */
193
+ export async function loadUserConfig() {
194
+ return safeFileRead(
195
+ path.join(process.cwd(), 'config.json'),
196
+ JSON.parse
197
+ );
198
+ }
199
+ ```
200
+
201
+ ### 7. Validate Pattern Integrity
202
+
203
+ Check pattern references:
204
+
205
+ ```bash
206
+ # Verify patterns.md references valid source files
207
+ grep "Source: src/" .pi/context/patterns.md | while read line; do
208
+ file=$(echo "$line" | grep -o 'src/[^(]*')
209
+ if [ -f "$file" ]; then
210
+ echo "✅ Source exists: $file"
211
+ else
212
+ echo "❌ Source missing: $file"
213
+ fi
214
+ done
215
+
216
+ # Verify source files reference patterns
217
+ grep -r "Canonical Reference: .pi/context/patterns.md" src/ | while read line; do
218
+ pattern=$(echo "$line" | grep -o 'patterns.md#[^"]*')
219
+ if grep -q "## Pattern: ${pattern#patterns.md#}" .pi/context/patterns.md; then
220
+ echo "✅ Pattern exists: $pattern"
221
+ else
222
+ echo "❌ Pattern missing: $pattern"
223
+ fi
224
+ done
225
+ ```
226
+
227
+ ---
228
+
229
+ ## Output Summary
230
+
231
+ ```markdown
232
+ ## Pattern Extract Report
233
+
234
+ ### Candidates Evaluated
235
+ - Total candidates: [N]
236
+ - Extracted: [M]
237
+ - Rejected: [K]
238
+
239
+ ### Patterns Added
240
+ | Pattern | Source | Section |
241
+ |---------|--------|---------|
242
+ | [name] | src/[file].ts | patterns.md#[section] |
243
+
244
+ ### Canonical References Added
245
+ - [N] files updated with pattern references
246
+
247
+ ### Validation
248
+ - Pattern references: ✅ valid
249
+ - Source references: ✅ valid
250
+ ```
251
+
252
+ ---
253
+
254
+ ## Acceptance Criteria
255
+
256
+ - [ ] Pattern candidates identified
257
+ - [ ] Patterns evaluated for reusability
258
+ - [ ] Pattern code generalized
259
+ - [ ] Pattern documented in patterns.md
260
+ - [ ] Canonical reference added to patterns.md entry
261
+ - [ ] Canonical reference added to source file
262
+ - [ ] Pattern references validated
263
+ - [ ] Blueprint updated (not generated files)
264
+
265
+ ---
266
+
267
+ ## Next Workflow
268
+
269
+ After pattern extraction, run `/sync-check` then `guardian generate`
@@ -0,0 +1,430 @@
1
+ # Plan to Issues Workflow
2
+
3
+ **Purpose:** Read a superpowers plan file and convert it to GitHub/GitLab issues with epics and tracking.
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ - Superpowers plan file exists in `docs/superpowers/plans/*.md`
10
+ - Git repository tool configured (`{{REPOTOOL}}`)
11
+ - Repository remote properly configured
12
+
13
+ ---
14
+
15
+ ## Input Format (Superpowers Plan)
16
+
17
+ Superpowers plans follow this structure:
18
+
19
+ ```markdown
20
+ # [Plan Title]
21
+
22
+ **Date:** YYYY-MM-DD
23
+ **Status:** draft/approved/in-progress
24
+
25
+ ---
26
+
27
+ ## Milestone 1: [Milestone Name] (CRITICAL PATH or priority)
28
+
29
+ ### Task 1: [Task Title]
30
+
31
+ - [ ] **Step 1: [Step description]**
32
+ ```[language]
33
+ [code snippet if applicable]
34
+ ```
35
+ - File: `[filename]`
36
+
37
+ - [ ] **Step 2: [Step description]**
38
+ - Commit message: `[message]`
39
+
40
+ ### Task 2: [Task Title]
41
+ ...
42
+
43
+ ## Milestone 2: [Milestone Name]
44
+ ...
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Workflow Steps
50
+
51
+ ### 1. Locate Plan File
52
+
53
+ Find the superpowers plan file:
54
+
55
+ ```bash
56
+ # List available plan files
57
+ ls -la docs/superpowers/plans/
58
+
59
+ # Or search for specific plan
60
+ find . -path "*/superpowers/plans/*.md" -type f
61
+ ```
62
+
63
+ Prompt user to select plan if multiple exist.
64
+
65
+ ### 2. Parse Plan Structure
66
+
67
+ Parse the plan to extract:
68
+
69
+ **Milestones → Epics:**
70
+ - Milestone title → Epic name
71
+ - Milestone priority (CRITICAL PATH, HIGH, MEDIUM) → Epic priority
72
+ - Tasks count → Scope estimation
73
+
74
+ **Tasks → Issues:**
75
+ - Task title → Issue title
76
+ - Task number → Issue ordering
77
+ - Steps → Acceptance criteria
78
+
79
+ **Steps → Checklist Items:**
80
+ - Step description → Acceptance criterion
81
+ - Step checkbox (- [ ]) → Checklist item
82
+ - Code snippets → Implementation hints
83
+ - File references → Files affected
84
+
85
+ ### 3. Parse Algorithm
86
+
87
+ ```bash
88
+ # Read plan file
89
+ PLAN_FILE="docs/superpowers/plans/YYYY-MM-DD-plan-name.md"
90
+ cat "$PLAN_FILE"
91
+ ```
92
+
93
+ **Parsing Logic:**
94
+
95
+ 1. Find all `## Milestone N:` lines → extract milestone name
96
+ 2. Within each milestone, find all `### Task N:` lines → extract task title
97
+ 3. Within each task, find all `- [ ] **Step N:**` lines → extract step description
98
+ 4. Capture code blocks between triple-backticks as implementation hints
99
+ 5. Capture file references as affected files
100
+
101
+ ### 4. Determine Scope Classification
102
+
103
+ For each task, estimate scope based on:
104
+
105
+ | Factor | Simple | Moderate | Complex | Critical |
106
+ |--------|--------|----------|---------|----------|
107
+ | **Steps count** | 1-3 | 4-7 | 8-15 | 15+ |
108
+ | **Code snippets** | 0-1 | 2-3 | 4-8 | 8+ |
109
+ | **Files mentioned** | 1 | 2-3 | 4-8 | 8+ |
110
+ | **New dependencies** | No | Maybe | Yes | Multiple |
111
+
112
+ **Validators Required:**
113
+ - Simple: CI + canonical
114
+ - Moderate: CI + architecture + canonical
115
+ - Complex: CI + architecture + security + canonical
116
+ - Critical: All validators + human approval
117
+
118
+ ### 5. Create Issue Drafts Directory
119
+
120
+ ```bash
121
+ mkdir -p .pi/context/issue-drafts/
122
+ ```
123
+
124
+ ### 6. Generate Epic Drafts
125
+
126
+ For each milestone, create an epic draft:
127
+
128
+ **Epic Template:**
129
+
130
+ ```markdown
131
+ ## Epic: [MILESTONE_NAME]
132
+
133
+ ### Source Milestone: Milestone N from [PLAN_FILE]
134
+
135
+ ### Priority: [CRITICAL PATH / HIGH / MEDIUM / LOW]
136
+
137
+ ### Description
138
+ [Extract any milestone-level description from plan]
139
+
140
+ ### Goals
141
+ - Goal 1: Complete all tasks in milestone
142
+ - Goal 2: [Specific goal from plan context]
143
+
144
+ ### Issues Included (Tasks)
145
+ | Task | Title | Scope | Validators |
146
+ |------|-------|-------|------------|
147
+ | Task 1 | [title] | [scope] | [validators] |
148
+ | Task 2 | [title] | [scope] | [validators] |
149
+
150
+ ### Dependency Order
151
+ [List tasks in order with dependencies noted]
152
+
153
+ ### Estimated Timeline
154
+ - Start: [today's date]
155
+ - Target: [estimate based on complexity]
156
+ ```
157
+
158
+ ### 7. Generate Issue Drafts
159
+
160
+ For each task, create an issue draft:
161
+
162
+ **Issue Template:**
163
+
164
+ ```markdown
165
+ ## Issue: [TASK_TITLE]
166
+
167
+ ### Epic: [MILESTONE_NAME]
168
+
169
+ ### Source: Task N from [PLAN_FILE]
170
+
171
+ ### Type: feature
172
+
173
+ ### Priority: [from milestone priority]
174
+
175
+ ### Description
176
+ [Task description from plan, or derived from steps]
177
+
178
+ ### Acceptance Criteria (from Steps)
179
+ - [ ] **Step 1:** [Step description from plan]
180
+ - [ ] **Step 2:** [Step description from plan]
181
+ - [ ] **Step 3:** [Step description from plan]
182
+ ...
183
+
184
+ ### Implementation Notes
185
+ [Code snippets from steps, formatted as hints]
186
+
187
+ **Example from Step 1:**
188
+ ```[language]
189
+ [Code snippet from plan]
190
+ ```
191
+
192
+ **Files Affected:**
193
+ - [File 1 from step references]
194
+ - [File 2 from step references]
195
+
196
+ ### Dependencies
197
+ - [Depends on Task X (if sequential)]
198
+ - [Blocks Task Y (if sequential)]
199
+
200
+ ### Estimated Scope
201
+ - Files: [count from file references]
202
+ - Lines: [estimate from code snippets]
203
+ - Validator Scope: [simple/moderate/complex]
204
+
205
+ ### Testing Requirements
206
+ - [ ] Unit tests for [functionality]
207
+ - [ ] Integration tests for [feature]
208
+
209
+ ### Documentation Updates
210
+ - [ ] Update [file] for [feature]
211
+ - [ ] Add [doc] for [API/component]
212
+ ```
213
+
214
+ ### 8. Generate Tracking Issue Draft
215
+
216
+ Create a tracking issue that monitors all epics:
217
+
218
+ **Tracking Issue Template:**
219
+
220
+ ```markdown
221
+ ## Tracking: [PLAN_NAME] Implementation
222
+
223
+ ### Source Plan: [PLAN_FILE]
224
+
225
+ ### Plan Date: [date from plan]
226
+
227
+ ### Status: [draft/approved/in-progress]
228
+
229
+ ### Epics Checklist (Milestones)
230
+ - [ ] Epic 1: [Milestone 1 name] - [N] tasks
231
+ - [ ] Epic 2: [Milestone 2 name] - [N] tasks
232
+ - [ ] Epic 3: [Milestone 3 name] - [N] tasks
233
+
234
+ ### Issues Checklist (All Tasks)
235
+ **Epic 1: [Milestone 1]**
236
+ - [ ] Task 1: [title] - Status: pending
237
+ - [ ] Task 2: [title] - Status: pending
238
+
239
+ **Epic 2: [Milestone 2]**
240
+ - [ ] Task 1: [title] - Status: pending
241
+ - [ ] Task 2: [title] - Status: pending
242
+
243
+ ### Overall Progress
244
+ - Total Epics: [N]
245
+ - Total Issues: [N]
246
+ - Completed: 0/[N] (0%)
247
+ - In Progress: 0/[N] (0%)
248
+
249
+ ### Critical Path
250
+ [List milestones marked CRITICAL PATH]
251
+
252
+ ### Timeline
253
+ - Plan Date: [date]
254
+ - Started: [today or pending]
255
+ - Target Completion: [estimate]
256
+
257
+ ### Notes
258
+ [Any plan-level notes or context]
259
+ ```
260
+
261
+ ### 9. Save All Drafts
262
+
263
+ ```bash
264
+ # Save to drafts directory
265
+ cat > .pi/context/issue-drafts/epic-1-draft.md << 'EOF'
266
+ [Epic 1 content]
267
+ EOF
268
+
269
+ cat > .pi/context/issue-drafts/issue-1-1-draft.md << 'EOF'
270
+ [Issue 1 of Epic 1 content]
271
+ EOF
272
+
273
+ cat > .pi/context/issue-drafts/tracking-issue-draft.md << 'EOF'
274
+ [Tracking issue content]
275
+ EOF
276
+
277
+ # Create summary
278
+ cat > .pi/context/issue-drafts/summary.md << 'EOF'
279
+ ## Plan-to-Issues Conversion Summary
280
+
281
+ ### Source Plan: [PLAN_FILE]
282
+ ### Conversion Date: [today]
283
+
284
+ ### Epics Created
285
+ | Epic | Milestone | Tasks | Scope |
286
+ |------|-----------|-------|-------|
287
+ | Epic 1 | [name] | [N] | [priority] |
288
+ | Epic 2 | [name] | [N] | [priority] |
289
+
290
+ ### Issues Created
291
+ | Epic | Task | Title | Scope | Validators |
292
+ |------|------|-------|-------|------------|
293
+ | 1 | 1 | [title] | simple | ci,canonical |
294
+ | 1 | 2 | [title] | moderate | ci,architecture,canonical |
295
+ ...
296
+
297
+ ### Next Steps
298
+ 1. Review drafts in .pi/context/issue-drafts/
299
+ 2. Edit any issue details as needed
300
+ 3. Run `/git-issues` to create in repository
301
+ EOF
302
+ ```
303
+
304
+ ### 10. Review Drafts
305
+
306
+ Before proceeding, review all drafts:
307
+
308
+ **Review Checklist:**
309
+ - [ ] All milestones converted to epics
310
+ - [ ] All tasks converted to issues
311
+ - [ ] All steps converted to acceptance criteria
312
+ - [ ] Code snippets preserved as implementation hints
313
+ - [ ] File references captured as affected files
314
+ - [ ] Scope classification reasonable
315
+ - [ ] Validators assigned appropriately
316
+ - [ ] Dependencies mapped correctly
317
+ - [ ] Tracking issue includes all epics/issues
318
+
319
+ ---
320
+
321
+ ## Output Format
322
+
323
+ ```
324
+ .pi/context/issue-drafts/
325
+ ├── summary.md # Conversion summary
326
+ ├── tracking-issue-draft.md # Overall tracking
327
+ ├── epic-1-draft.md # Epic for Milestone 1
328
+ ├── epic-2-draft.md # Epic for Milestone 2
329
+ ├── issue-1-1-draft.md # Issue for Epic 1, Task 1
330
+ ├── issue-1-2-draft.md # Issue for Epic 1, Task 2
331
+ ├── issue-2-1-draft.md # Issue for Epic 2, Task 1
332
+ └── review-checklist.md # Review checklist
333
+ ```
334
+
335
+ ---
336
+
337
+ ## Git Repository Tool
338
+
339
+ Using `{{REPOTOOL}}`:
340
+
341
+ | Tool | Preview Command |
342
+ |------|-----------------|
343
+ | **gh** | `gh issue create --title "[TITLE]" --body "[BODY]"` |
344
+ | **glab** | `glab issue create --title "[TITLE]" --description "[BODY]"` |
345
+
346
+ ---
347
+
348
+ ## Acceptance Criteria
349
+
350
+ - [ ] Plan file located and parsed successfully
351
+ - [ ] All milestones converted to epic drafts
352
+ - [ ] All tasks converted to issue drafts
353
+ - [ ] All steps converted to acceptance criteria
354
+ - [ ] Code snippets preserved as implementation hints
355
+ - [ ] Scope classification applied to each issue
356
+ - [ ] Validators assigned based on scope
357
+ - [ ] Tracking issue draft created
358
+ - [ ] All drafts saved to .pi/context/issue-drafts/
359
+ - [ ] Summary generated
360
+ - [ ] Ready for `/git-issues`
361
+
362
+ ---
363
+
364
+ ## Example Conversion
365
+
366
+ **Input (Plan):**
367
+ ```markdown
368
+ ## Milestone 1: L402 Payment End-to-End (CRITICAL PATH)
369
+
370
+ ### Task 1: Project Scaffold
371
+
372
+ - [ ] **Step 1: Create autonomics package.json**
373
+ ```json
374
+ {
375
+ "name": "autonomics",
376
+ "version": "0.1.0"
377
+ }
378
+ ```
379
+ - File: `package.json`
380
+
381
+ - [ ] **Step 2: Initialize TypeScript config**
382
+ - Commit message: `chore: init tsconfig`
383
+ ```
384
+
385
+ **Output (Issue Draft):**
386
+ ```markdown
387
+ ## Issue: Project Scaffold
388
+
389
+ ### Epic: L402 Payment End-to-End
390
+
391
+ ### Type: feature
392
+
393
+ ### Priority: high (CRITICAL PATH)
394
+
395
+ ### Description
396
+ Initialize project scaffold with package.json and TypeScript configuration.
397
+
398
+ ### Acceptance Criteria
399
+ - [ ] **Step 1:** Create autonomics package.json
400
+ - [ ] **Step 2:** Initialize TypeScript config
401
+
402
+ ### Implementation Notes
403
+
404
+ **Example for Step 1:**
405
+ ```json
406
+ {
407
+ "name": "autonomics",
408
+ "version": "0.1.0"
409
+ }
410
+ ```
411
+
412
+ **Files Affected:**
413
+ - package.json
414
+
415
+ **Commit Message:** `chore: init tsconfig`
416
+
417
+ ### Estimated Scope
418
+ - Files: 1
419
+ - Lines: < 50
420
+ - Validator Scope: simple
421
+
422
+ ### Validators Required
423
+ - ci, canonical
424
+ ```
425
+
426
+ ---
427
+
428
+ ## Next Workflow
429
+
430
+ After draft review and approval, run: `/git-issues` to create in repository.