opencastle 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 (224) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +215 -0
  3. package/bin/cli.mjs +69 -0
  4. package/dist/cli/adapters/claude-code.d.ts +22 -0
  5. package/dist/cli/adapters/claude-code.d.ts.map +1 -0
  6. package/dist/cli/adapters/claude-code.js +237 -0
  7. package/dist/cli/adapters/claude-code.js.map +1 -0
  8. package/dist/cli/adapters/cursor.d.ts +20 -0
  9. package/dist/cli/adapters/cursor.d.ts.map +1 -0
  10. package/dist/cli/adapters/cursor.js +231 -0
  11. package/dist/cli/adapters/cursor.js.map +1 -0
  12. package/dist/cli/adapters/vscode.d.ts +20 -0
  13. package/dist/cli/adapters/vscode.d.ts.map +1 -0
  14. package/dist/cli/adapters/vscode.js +132 -0
  15. package/dist/cli/adapters/vscode.js.map +1 -0
  16. package/dist/cli/copy.d.ts +14 -0
  17. package/dist/cli/copy.d.ts.map +1 -0
  18. package/dist/cli/copy.js +62 -0
  19. package/dist/cli/copy.js.map +1 -0
  20. package/dist/cli/dashboard.d.ts +3 -0
  21. package/dist/cli/dashboard.d.ts.map +1 -0
  22. package/dist/cli/dashboard.js +183 -0
  23. package/dist/cli/dashboard.js.map +1 -0
  24. package/dist/cli/diff.d.ts +3 -0
  25. package/dist/cli/diff.d.ts.map +1 -0
  26. package/dist/cli/diff.js +27 -0
  27. package/dist/cli/diff.js.map +1 -0
  28. package/dist/cli/eject.d.ts +3 -0
  29. package/dist/cli/eject.d.ts.map +1 -0
  30. package/dist/cli/eject.js +27 -0
  31. package/dist/cli/eject.js.map +1 -0
  32. package/dist/cli/init.d.ts +3 -0
  33. package/dist/cli/init.d.ts.map +1 -0
  34. package/dist/cli/init.js +92 -0
  35. package/dist/cli/init.js.map +1 -0
  36. package/dist/cli/manifest.d.ts +14 -0
  37. package/dist/cli/manifest.d.ts.map +1 -0
  38. package/dist/cli/manifest.js +34 -0
  39. package/dist/cli/manifest.js.map +1 -0
  40. package/dist/cli/mcp.d.ts +14 -0
  41. package/dist/cli/mcp.d.ts.map +1 -0
  42. package/dist/cli/mcp.js +35 -0
  43. package/dist/cli/mcp.js.map +1 -0
  44. package/dist/cli/prompt.d.ts +12 -0
  45. package/dist/cli/prompt.d.ts.map +1 -0
  46. package/dist/cli/prompt.js +104 -0
  47. package/dist/cli/prompt.js.map +1 -0
  48. package/dist/cli/run/adapters/claude-code.d.ts +16 -0
  49. package/dist/cli/run/adapters/claude-code.d.ts.map +1 -0
  50. package/dist/cli/run/adapters/claude-code.js +82 -0
  51. package/dist/cli/run/adapters/claude-code.js.map +1 -0
  52. package/dist/cli/run/adapters/copilot.d.ts +16 -0
  53. package/dist/cli/run/adapters/copilot.d.ts.map +1 -0
  54. package/dist/cli/run/adapters/copilot.js +84 -0
  55. package/dist/cli/run/adapters/copilot.js.map +1 -0
  56. package/dist/cli/run/adapters/cursor.d.ts +16 -0
  57. package/dist/cli/run/adapters/cursor.d.ts.map +1 -0
  58. package/dist/cli/run/adapters/cursor.js +81 -0
  59. package/dist/cli/run/adapters/cursor.js.map +1 -0
  60. package/dist/cli/run/adapters/index.d.ts +14 -0
  61. package/dist/cli/run/adapters/index.d.ts.map +1 -0
  62. package/dist/cli/run/adapters/index.js +35 -0
  63. package/dist/cli/run/adapters/index.js.map +1 -0
  64. package/dist/cli/run/executor.d.ts +15 -0
  65. package/dist/cli/run/executor.d.ts.map +1 -0
  66. package/dist/cli/run/executor.js +249 -0
  67. package/dist/cli/run/executor.js.map +1 -0
  68. package/dist/cli/run/reporter.d.ts +10 -0
  69. package/dist/cli/run/reporter.d.ts.map +1 -0
  70. package/dist/cli/run/reporter.js +112 -0
  71. package/dist/cli/run/reporter.js.map +1 -0
  72. package/dist/cli/run/schema.d.ts +28 -0
  73. package/dist/cli/run/schema.d.ts.map +1 -0
  74. package/dist/cli/run/schema.js +511 -0
  75. package/dist/cli/run/schema.js.map +1 -0
  76. package/dist/cli/run.d.ts +6 -0
  77. package/dist/cli/run.d.ts.map +1 -0
  78. package/dist/cli/run.js +123 -0
  79. package/dist/cli/run.js.map +1 -0
  80. package/dist/cli/stack-config.d.ts +12 -0
  81. package/dist/cli/stack-config.d.ts.map +1 -0
  82. package/dist/cli/stack-config.js +146 -0
  83. package/dist/cli/stack-config.js.map +1 -0
  84. package/dist/cli/types.d.ts +169 -0
  85. package/dist/cli/types.d.ts.map +1 -0
  86. package/dist/cli/types.js +2 -0
  87. package/dist/cli/types.js.map +1 -0
  88. package/dist/cli/update.d.ts +3 -0
  89. package/dist/cli/update.d.ts.map +1 -0
  90. package/dist/cli/update.js +50 -0
  91. package/dist/cli/update.js.map +1 -0
  92. package/package.json +48 -0
  93. package/src/cli/adapters/claude-code.ts +287 -0
  94. package/src/cli/adapters/cursor.ts +377 -0
  95. package/src/cli/adapters/vscode.ts +168 -0
  96. package/src/cli/copy.ts +79 -0
  97. package/src/cli/dashboard.ts +225 -0
  98. package/src/cli/diff.ts +44 -0
  99. package/src/cli/eject.ts +39 -0
  100. package/src/cli/init.ts +120 -0
  101. package/src/cli/manifest.ts +45 -0
  102. package/src/cli/mcp.ts +49 -0
  103. package/src/cli/prompt.ts +115 -0
  104. package/src/cli/run/adapters/claude-code.ts +95 -0
  105. package/src/cli/run/adapters/copilot.ts +97 -0
  106. package/src/cli/run/adapters/cursor.ts +94 -0
  107. package/src/cli/run/adapters/index.ts +40 -0
  108. package/src/cli/run/executor.ts +292 -0
  109. package/src/cli/run/reporter.ts +129 -0
  110. package/src/cli/run/schema.ts +595 -0
  111. package/src/cli/run.ts +137 -0
  112. package/src/cli/stack-config.ts +180 -0
  113. package/src/cli/types.ts +207 -0
  114. package/src/cli/update.ts +75 -0
  115. package/src/dashboard/astro.config.mjs +6 -0
  116. package/src/dashboard/package-lock.json +5455 -0
  117. package/src/dashboard/package.json +14 -0
  118. package/src/dashboard/public/data/delegations.ndjson +35 -0
  119. package/src/dashboard/public/data/panels.ndjson +13 -0
  120. package/src/dashboard/public/data/sessions.ndjson +50 -0
  121. package/src/dashboard/public/icon-192.png +0 -0
  122. package/src/dashboard/scripts/generate-seed-data.ts +355 -0
  123. package/src/dashboard/src/layouts/Layout.astro +25 -0
  124. package/src/dashboard/src/pages/index.astro +1070 -0
  125. package/src/dashboard/src/styles/dashboard.css +1078 -0
  126. package/src/dashboard/tsconfig.json +6 -0
  127. package/src/orchestrator/agent-workflows/README.md +22 -0
  128. package/src/orchestrator/agent-workflows/bug-fix.md +128 -0
  129. package/src/orchestrator/agent-workflows/data-pipeline.md +145 -0
  130. package/src/orchestrator/agent-workflows/database-migration.md +159 -0
  131. package/src/orchestrator/agent-workflows/feature-implementation.md +223 -0
  132. package/src/orchestrator/agent-workflows/performance-optimization.md +125 -0
  133. package/src/orchestrator/agent-workflows/refactoring.md +142 -0
  134. package/src/orchestrator/agent-workflows/schema-changes.md +164 -0
  135. package/src/orchestrator/agent-workflows/security-audit.md +148 -0
  136. package/src/orchestrator/agent-workflows/shared-delivery-phase.md +33 -0
  137. package/src/orchestrator/agents/api-designer.agent.md +68 -0
  138. package/src/orchestrator/agents/architect.agent.md +129 -0
  139. package/src/orchestrator/agents/content-engineer.agent.md +57 -0
  140. package/src/orchestrator/agents/copywriter.agent.md +95 -0
  141. package/src/orchestrator/agents/data-expert.agent.md +63 -0
  142. package/src/orchestrator/agents/database-engineer.agent.md +62 -0
  143. package/src/orchestrator/agents/developer.agent.md +66 -0
  144. package/src/orchestrator/agents/devops-expert.agent.md +57 -0
  145. package/src/orchestrator/agents/documentation-writer.agent.md +60 -0
  146. package/src/orchestrator/agents/performance-expert.agent.md +58 -0
  147. package/src/orchestrator/agents/release-manager.agent.md +72 -0
  148. package/src/orchestrator/agents/researcher.agent.md +145 -0
  149. package/src/orchestrator/agents/reviewer.agent.md +62 -0
  150. package/src/orchestrator/agents/security-expert.agent.md +64 -0
  151. package/src/orchestrator/agents/seo-specialist.agent.md +67 -0
  152. package/src/orchestrator/agents/team-lead.agent.md +644 -0
  153. package/src/orchestrator/agents/testing-expert.agent.md +85 -0
  154. package/src/orchestrator/agents/ui-ux-expert.agent.md +63 -0
  155. package/src/orchestrator/copilot-instructions.md +3 -0
  156. package/src/orchestrator/customizations/AGENT-EXPERTISE.md +325 -0
  157. package/src/orchestrator/customizations/AGENT-FAILURES.md +69 -0
  158. package/src/orchestrator/customizations/AGENT-PERFORMANCE.md +58 -0
  159. package/src/orchestrator/customizations/DISPUTES.md +162 -0
  160. package/src/orchestrator/customizations/KNOWLEDGE-GRAPH.md +10 -0
  161. package/src/orchestrator/customizations/LESSONS-LEARNED.md +70 -0
  162. package/src/orchestrator/customizations/README.md +59 -0
  163. package/src/orchestrator/customizations/agents/agent-registry.md +46 -0
  164. package/src/orchestrator/customizations/agents/skill-matrix.md +142 -0
  165. package/src/orchestrator/customizations/logs/README.md +181 -0
  166. package/src/orchestrator/customizations/logs/delegations.ndjson +1 -0
  167. package/src/orchestrator/customizations/logs/panels.ndjson +1 -0
  168. package/src/orchestrator/customizations/logs/sessions.ndjson +1 -0
  169. package/src/orchestrator/customizations/project/docs-structure.md +23 -0
  170. package/src/orchestrator/customizations/project/tracker-config.md +45 -0
  171. package/src/orchestrator/customizations/project.instructions.md +64 -0
  172. package/src/orchestrator/customizations/stack/api-config.md +37 -0
  173. package/src/orchestrator/customizations/stack/cms-config.md +26 -0
  174. package/src/orchestrator/customizations/stack/data-pipeline-config.md +41 -0
  175. package/src/orchestrator/customizations/stack/database-config.md +44 -0
  176. package/src/orchestrator/customizations/stack/deployment-config.md +45 -0
  177. package/src/orchestrator/customizations/stack/testing-config.md +56 -0
  178. package/src/orchestrator/instructions/ai-optimization.instructions.md +143 -0
  179. package/src/orchestrator/instructions/general.instructions.md +194 -0
  180. package/src/orchestrator/mcp.json +55 -0
  181. package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +235 -0
  182. package/src/orchestrator/prompts/brainstorm.prompt.md +115 -0
  183. package/src/orchestrator/prompts/bug-fix.prompt.md +141 -0
  184. package/src/orchestrator/prompts/create-skill.prompt.md +103 -0
  185. package/src/orchestrator/prompts/generate-task-spec.prompt.md +154 -0
  186. package/src/orchestrator/prompts/implement-feature.prompt.md +124 -0
  187. package/src/orchestrator/prompts/metrics-report.prompt.md +142 -0
  188. package/src/orchestrator/prompts/quick-refinement.prompt.md +137 -0
  189. package/src/orchestrator/prompts/resolve-pr-comments.prompt.md +100 -0
  190. package/src/orchestrator/skills/accessibility-standards/SKILL.md +164 -0
  191. package/src/orchestrator/skills/agent-hooks/SKILL.md +147 -0
  192. package/src/orchestrator/skills/agent-memory/SKILL.md +144 -0
  193. package/src/orchestrator/skills/api-patterns/SKILL.md +106 -0
  194. package/src/orchestrator/skills/browser-testing/SKILL.md +203 -0
  195. package/src/orchestrator/skills/code-commenting/SKILL.md +133 -0
  196. package/src/orchestrator/skills/contentful-cms/SKILL.md +43 -0
  197. package/src/orchestrator/skills/context-map/SKILL.md +135 -0
  198. package/src/orchestrator/skills/convex-database/SKILL.md +80 -0
  199. package/src/orchestrator/skills/data-engineering/SKILL.md +99 -0
  200. package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +49 -0
  201. package/src/orchestrator/skills/documentation-standards/SKILL.md +85 -0
  202. package/src/orchestrator/skills/fast-review/SKILL.md +327 -0
  203. package/src/orchestrator/skills/frontend-design/SKILL.md +42 -0
  204. package/src/orchestrator/skills/jira-management/SKILL.md +168 -0
  205. package/src/orchestrator/skills/memory-merger/SKILL.md +123 -0
  206. package/src/orchestrator/skills/nextjs-patterns/SKILL.md +75 -0
  207. package/src/orchestrator/skills/nx-workspace/SKILL.md +192 -0
  208. package/src/orchestrator/skills/panel-majority-vote/SKILL.md +184 -0
  209. package/src/orchestrator/skills/panel-majority-vote/panel-report.template.md +38 -0
  210. package/src/orchestrator/skills/performance-optimization/SKILL.md +101 -0
  211. package/src/orchestrator/skills/react-development/SKILL.md +117 -0
  212. package/src/orchestrator/skills/sanity-cms/SKILL.md +18 -0
  213. package/src/orchestrator/skills/security-hardening/SKILL.md +118 -0
  214. package/src/orchestrator/skills/self-improvement/SKILL.md +137 -0
  215. package/src/orchestrator/skills/seo-patterns/SKILL.md +40 -0
  216. package/src/orchestrator/skills/session-checkpoints/SKILL.md +205 -0
  217. package/src/orchestrator/skills/slack-notifications/SKILL.md +211 -0
  218. package/src/orchestrator/skills/strapi-cms/SKILL.md +43 -0
  219. package/src/orchestrator/skills/supabase-database/SKILL.md +24 -0
  220. package/src/orchestrator/skills/task-management/SKILL.md +143 -0
  221. package/src/orchestrator/skills/team-lead-reference/SKILL.md +317 -0
  222. package/src/orchestrator/skills/teams-notifications/SKILL.md +249 -0
  223. package/src/orchestrator/skills/testing-workflow/SKILL.md +134 -0
  224. package/src/orchestrator/skills/validation-gates/SKILL.md +100 -0
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "astro/tsconfigs/strict",
3
+ "compilerOptions": {
4
+ "strictNullChecks": true
5
+ }
6
+ }
@@ -0,0 +1,22 @@
1
+ # Workflow Templates
2
+
3
+ Declarative workflow templates for common orchestration patterns. Inspired by Sandcastle's YAML workflow engine, these templates provide reproducible execution plans that the Team Lead and prompts can reference.
4
+
5
+ ## How to Use
6
+
7
+ 1. **Reference in prompts** — When delegating, cite the relevant template and phase
8
+ 2. **Customize per task** — Templates define the structure; fill in specific files, agents, and criteria
9
+ 3. **Track progress** — Use the phase structure to update session checkpoints
10
+
11
+ ## Available Templates
12
+
13
+ | Template | Use Case |
14
+ |----------|----------|
15
+ | [Feature Implementation](feature-implementation.md) | Multi-layer features spanning DB → Query → UI → Tests |
16
+ | [Bug Fix](bug-fix.md) | Triage → RCA → Fix → Verify workflow |
17
+ | [Data Pipeline](data-pipeline.md) | Scrape → Convert → Enrich → Validate → Import |
18
+ | [Security Audit](security-audit.md) | Comprehensive security review workflow |
19
+ | [Performance Optimization](performance-optimization.md) | Measure → Analyze → Optimize → Verify |
20
+ | [Schema Changes](schema-changes.md) | CMS schema modifications, query updates, content model changes |
21
+ | [Database Migration](database-migration.md) | Database migrations, RLS policies, type generation, rollback |
22
+ | [Refactoring](refactoring.md) | Safe code refactoring with baseline metrics and behavior preservation |
@@ -0,0 +1,128 @@
1
+ # Workflow: Bug Fix
2
+
3
+ Structured workflow for investigating and fixing reported bugs.
4
+
5
+ ## Phases
6
+
7
+ ```
8
+ Phase 1: Triage & Reproduce (sub-agent, inline)
9
+ Phase 2: Root Cause Analysis (sub-agent, inline)
10
+ Phase 3: Fix Implementation (sub-agent or background)
11
+ Phase 4: Verification (sub-agent, inline)
12
+ Phase 5: Compound (direct, Team Lead)
13
+ ```
14
+
15
+ ---
16
+
17
+ ## Branch & Delivery Strategy
18
+
19
+ Follow the **Delivery Outcome** in `general.instructions.md` and the **Branch Ownership** rules in `team-lead.agent.md`. Branch naming: `fix/<ticket-id>-<short-description>`.
20
+
21
+ ---
22
+
23
+ ## Phase 1: Triage & Reproduce
24
+
25
+ **Agent:** Team Lead (self)
26
+ **Type:** Direct research
27
+
28
+ ### Steps
29
+
30
+ 1. Check `docs/KNOWN-ISSUES.md` for existing entry
31
+ 2. Check Linear for existing bug ticket
32
+ 3. Read `.github/customizations/LESSONS-LEARNED.md` for related pitfalls
33
+ 4. **Reproduce the bug** — this is mandatory before any fix attempt:
34
+ a. Start the dev server: `yarn nx run <app>:serve`
35
+ b. Navigate to the affected page in Chrome
36
+ c. Follow the reproduction steps from the bug report
37
+ d. **Confirm the failure** — screenshot the broken state as evidence
38
+ e. If the bug **cannot be reproduced**, document what was tried and ask the reporter for more detail. Do NOT proceed to Phase 2 without reproduction
39
+ 5. Assess severity (Critical/High/Medium/Low)
40
+ 6. Create Linear issue with `[Bug]` prefix and `bug` label, including reproduction steps and screenshot
41
+
42
+ ### Exit Criteria
43
+
44
+ - [ ] Bug **confirmed reproduced** with screenshot evidence (or documented as non-reproducible with investigation notes)
45
+ - [ ] Severity assessed
46
+ - [ ] Linear issue created with reproduction steps and screenshot
47
+ - [ ] Affected apps identified (see `project.instructions.md` for inventory)
48
+
49
+ ---
50
+
51
+ ## Phase 2: Root Cause Analysis
52
+
53
+ **Agent:** Specialist (based on bug domain — Developer, Security Expert, etc.)
54
+ **Type:** Sub-agent (inline, result needed for Phase 3)
55
+
56
+ ### Steps
57
+
58
+ 1. Search codebase for components, queries, and logic involved
59
+ 2. Trace data flow from source → query → component → render
60
+ 3. Check `git log` on suspected files for recent changes
61
+ 4. Identify root cause category:
62
+ - Code bug (logic error, missing null check)
63
+ - Data issue (unexpected shape, missing field)
64
+ - Race condition (timing, hydration mismatch)
65
+ - CSS/Layout (specificity, overflow, responsive)
66
+ - Integration (API contract mismatch, schema drift)
67
+ 5. Update Linear issue with root cause and affected files
68
+
69
+ ### Exit Criteria
70
+
71
+ - [ ] Root cause identified and documented
72
+ - [ ] Affected files listed (defines the fix partition)
73
+ - [ ] Fix approach decided
74
+
75
+ ---
76
+
77
+ ## Phase 3: Fix Implementation
78
+
79
+ **Agent:** Specialist (same as Phase 2)
80
+ **Type:** Sub-agent (simple fix) or Background (complex fix)
81
+
82
+ ### Steps
83
+
84
+ 1. Implement the fix within the identified file partition
85
+ 2. Add or update tests covering the bug scenario
86
+ 3. Run lint + test + build for affected projects
87
+ 4. Return output contract
88
+
89
+ ### Exit Criteria
90
+
91
+ - [ ] Fix implemented
92
+ - [ ] Test covering the bug added
93
+ - [ ] Lint + test + build pass
94
+ - [ ] Output contract returned
95
+
96
+ ---
97
+
98
+ ## Phase 4: Verification
99
+
100
+ **Agent:** Team Lead (self)
101
+ **Type:** Direct verification
102
+
103
+ ### Steps
104
+
105
+ 1. Review the output contract
106
+ 2. Start dev server with clean cache
107
+ 3. Verify the bug is fixed in Chrome (screenshot the working state)
108
+ 4. Test adjacent features for regressions
109
+ 5. If security-related: schedule panel review
110
+ 6. Move Linear issue to Done
111
+ 7. Update `docs/KNOWN-ISSUES.md` if the bug was listed there
112
+ 8. Commit and push
113
+
114
+ ### Exit Criteria
115
+
116
+ - [ ] Bug confirmed fixed with screenshot
117
+ - [ ] No regressions introduced
118
+ - [ ] Linear issue moved to Done
119
+ - [ ] Known issues updated (if applicable)
120
+ - [ ] Delivery Outcome completed (see `general.instructions.md`) — branch pushed, PR opened (not merged), Linear linked
121
+
122
+ ---
123
+
124
+ ### Phase 5: Delivery (Compound)
125
+
126
+ > **See [shared-delivery-phase.md](shared-delivery-phase.md) for the standard delivery steps.**
127
+ >
128
+ > Commit → Push → PR → Linear linkage. Team Lead owns delivery.
@@ -0,0 +1,145 @@
1
+ # Workflow: Data Pipeline
2
+
3
+ Standard execution plan for scraping, processing, and importing data.
4
+
5
+ > **Project config:** For project-specific paths, data schema, CLI commands, and processing rules, see `data-pipeline-config.md`. For data model docs, see `docs-structure.md`.
6
+
7
+ ## Phases
8
+
9
+ ```
10
+ Phase 1: Source Analysis (sub-agent, inline)
11
+ Phase 2: Scraping (background agent)
12
+ Phase 3: Processing (sub-agent, sequential)
13
+ Phase 4: Validation (sub-agent, inline)
14
+ Phase 5: Import (sub-agent, inline)
15
+ Phase 6: Compound (direct, Team Lead)
16
+ ```
17
+
18
+ ---
19
+
20
+ ## Branch & Delivery Strategy
21
+
22
+ Follow the **Delivery Outcome** in `general.instructions.md` and the **Branch Ownership** rules in `team-lead.agent.md`. Branch naming: `feat/<ticket-id>-<short-description>`. Only code changes are committed — NDJSON data files in `tmp/` are NOT committed to Git.
23
+
24
+ ---
25
+
26
+ ## Phase 1: Source Analysis
27
+
28
+ **Agent:** Data Expert (via sub-agent)
29
+ **Type:** Sub-agent (inline)
30
+
31
+ ### Steps
32
+
33
+ 1. Analyze the target data source (website, API, file)
34
+ 2. Identify data fields available and their mapping to the place schema
35
+ 3. Check the data model documentation (see `docs-structure.md`) for required fields
36
+ 4. Estimate record count
37
+ 5. Check for existing scraper patterns (see **data-engineering** skill)
38
+ 6. Create Linear issue with data source details
39
+
40
+ ### Exit Criteria
41
+
42
+ - [ ] Source structure documented
43
+ - [ ] Field mapping defined (source field → target field)
44
+ - [ ] Estimated record count
45
+ - [ ] Linear issue created
46
+ - [ ] Scraper approach decided (Puppeteer, fetch, API)
47
+
48
+ ---
49
+
50
+ ## Phase 2: Scraping
51
+
52
+ **Agent:** Data Expert
53
+ **Type:** Background agent (may be long-running)
54
+
55
+ ### Steps
56
+
57
+ 1. Implement scraper following existing patterns (see `data-pipeline-config.md`)
58
+ 2. Output raw data as NDJSON
59
+ 3. Handle pagination, rate limiting, and error recovery
60
+ 4. Log scraping statistics (pages visited, records extracted, errors)
61
+
62
+ ### Exit Criteria
63
+
64
+ - [ ] Raw NDJSON file produced
65
+ - [ ] Scraping statistics logged
66
+ - [ ] No duplicate records
67
+ - [ ] Output contract returned
68
+
69
+ ---
70
+
71
+ ## Phase 3: Processing
72
+
73
+ **Agent:** Data Expert (via sub-agent)
74
+ **Type:** Sub-agent (sequential — depends on Phase 2 output)
75
+
76
+ ### Steps
77
+
78
+ 1. Convert raw data to the target schema format
79
+ 2. Enrich with geocoding, slug generation, image optimization
80
+ 3. Normalize text fields (see data-pipeline-config.md for rules)
81
+ 4. Validate against place schema
82
+ 5. Output processed NDJSON
83
+
84
+ ### Exit Criteria
85
+
86
+ - [ ] Processed NDJSON matches place schema
87
+ - [ ] All required fields present
88
+ - [ ] Slugs are unique
89
+ - [ ] Geocoding complete
90
+ - [ ] Pipeline tests pass: `yarn nx run data-pipeline:test`
91
+ - [ ] Output contract returned with quality metrics
92
+
93
+ ---
94
+
95
+ ## Phase 4: Validation
96
+
97
+ **Agent:** Team Lead (self)
98
+ **Type:** Sub-agent (inline)
99
+
100
+ ### Steps
101
+
102
+ 1. Spot-check 10-20 records manually
103
+ 2. Run validation script against full dataset
104
+ 3. Check for duplicates against existing data
105
+ 4. Verify image URLs are accessible
106
+ 5. Confirm field mapping accuracy
107
+
108
+ ### Exit Criteria
109
+
110
+ - [ ] Spot check passed
111
+ - [ ] Validation script reports <1% error rate
112
+ - [ ] No duplicates with existing data
113
+ - [ ] Images accessible
114
+
115
+ ---
116
+
117
+ ## Phase 5: Import
118
+
119
+ **Agent:** Data Expert (via sub-agent)
120
+ **Type:** Sub-agent (inline — need immediate feedback)
121
+
122
+ ### Steps
123
+
124
+ 1. Import small test batch (5-10 records) first
125
+ 2. Verify in CMS
126
+ 3. Import full dataset
127
+ 4. Log import statistics (created, updated, skipped, failed)
128
+ 5. Update Linear issue and roadmap
129
+
130
+ ### Exit Criteria
131
+
132
+ - [ ] Test batch verified in CMS
133
+ - [ ] Full import complete
134
+ - [ ] Import statistics logged
135
+ - [ ] <0.1% failure rate
136
+ - [ ] Output contract returned
137
+ - [ ] Delivery Outcome completed (see `general.instructions.md`) — branch pushed, PR opened (not merged), Linear linked
138
+
139
+ ---
140
+
141
+ ### Phase 6: Delivery (Compound)
142
+
143
+ > **See [shared-delivery-phase.md](shared-delivery-phase.md) for the standard delivery steps.**
144
+ >
145
+ > Commit → Push → PR → Linear linkage. Team Lead owns delivery.
@@ -0,0 +1,159 @@
1
+ # Workflow: Database Migration
2
+
3
+ Structured workflow for database schema changes, RLS policies, and data migrations.
4
+
5
+ > **Project config:** For database-specific paths, schema details, and migration conventions, see the relevant database customization file (e.g., `supabase-config.md`).
6
+
7
+ ## Phases
8
+
9
+ ```
10
+ Phase 1: Migration Planning (sub-agent, inline)
11
+ Phase 2: Migration Implementation (sub-agent or background)
12
+ Phase 3: Type Generation (sub-agent, sequential)
13
+ Phase 4: Code Integration (sub-agent, sequential)
14
+ Phase 5: Verification & Rollback Test (sub-agent, inline)
15
+ Phase 6: Compound (direct, Team Lead)
16
+ ```
17
+
18
+ ---
19
+
20
+ ## Branch & Delivery Strategy
21
+
22
+ Follow the **Delivery Outcome** in `general.instructions.md` and the **Branch Ownership** rules in `team-lead.agent.md`. Branch naming: `feat/<ticket-id>-<short-description>` or `fix/<ticket-id>-<short-description>`.
23
+
24
+ ---
25
+
26
+ ## Phase 1: Migration Planning
27
+
28
+ **Agent:** Database Engineer (via sub-agent)
29
+ **Type:** Sub-agent (inline)
30
+
31
+ ### Steps
32
+
33
+ 1. Read current schema in the migrations directory (see database customization) to understand existing tables
34
+ 2. Check existing RLS policies using the database query tool
35
+ 3. Read `docs/PROJECT.md` for database architecture
36
+ 4. Check `docs/KNOWN-ISSUES.md` for database-related limitations
37
+ 5. Document the migration plan: tables affected, columns added/removed, RLS changes
38
+ 6. Write rollback strategy (how to reverse the migration)
39
+ 7. Create Linear issue with migration details and rollback plan
40
+
41
+ ### Exit Criteria
42
+
43
+ - [ ] Current schema understood
44
+ - [ ] Migration plan documented
45
+ - [ ] Rollback strategy defined
46
+ - [ ] Impact on existing data assessed
47
+ - [ ] Linear issue created with rollback plan
48
+
49
+ ---
50
+
51
+ ## Phase 2: Migration Implementation
52
+
53
+ **Agent:** Database Engineer
54
+ **Type:** Sub-agent (simple changes) or Background (complex migrations)
55
+
56
+ ### File Partition
57
+
58
+ > See the database customization file for project-specific migration paths.
59
+
60
+ - Migrations directory — migration SQL files
61
+
62
+ ### Steps
63
+
64
+ 1. Create migration file following naming convention: `YYYYMMDDHHMMSS_description.sql`
65
+ 2. Write idempotent SQL (can safely re-run)
66
+ 3. Include RLS policies for any new tables — default deny, explicit allow
67
+ 4. Add indexes for frequently queried columns
68
+ 5. Include SQL comments documenting the purpose
69
+ 6. Apply migration using the database MCP tool
70
+ 7. Verify migration applied successfully
71
+
72
+ ### Exit Criteria
73
+
74
+ - [ ] Migration file created with idempotent SQL
75
+ - [ ] RLS policies included for new tables
76
+ - [ ] Indexes added for query columns
77
+ - [ ] Migration applied successfully
78
+ - [ ] Rollback SQL tested (or documented)
79
+ - [ ] Output contract returned
80
+
81
+ ---
82
+
83
+ ## Phase 3: Type Generation
84
+
85
+ **Agent:** Database Engineer (via sub-agent)
86
+ **Type:** Sub-agent (sequential — depends on Phase 2)
87
+
88
+ ### Steps
89
+
90
+ 1. Generate updated TypeScript types using the database MCP tool
91
+ 2. Update any local type files that reference the changed tables
92
+ 3. Verify types compile correctly
93
+
94
+ ### Exit Criteria
95
+
96
+ - [ ] TypeScript types regenerated
97
+ - [ ] Types compile without errors
98
+ - [ ] Output contract returned
99
+
100
+ ---
101
+
102
+ ## Phase 4: Code Integration
103
+
104
+ **Agent:** Developer (via sub-agent)
105
+ **Type:** Sub-agent (sequential — depends on Phase 3)
106
+
107
+ ### File Partition
108
+
109
+ - Varies by feature — typically Server Actions, API routes, React components
110
+
111
+ ### Steps
112
+
113
+ 1. Update Server Actions / API routes to use new schema
114
+ 2. Update components to handle new data fields
115
+ 3. Run lint + test + build for affected projects
116
+ 4. Start dev server and test in browser
117
+
118
+ ### Exit Criteria
119
+
120
+ - [ ] Server Actions updated
121
+ - [ ] Components updated
122
+ - [ ] Lint + test + build pass
123
+ - [ ] Browser verification complete
124
+ - [ ] Output contract returned
125
+
126
+ ---
127
+
128
+ ## Phase 5: Verification & Rollback Test
129
+
130
+ **Agent:** Team Lead (self)
131
+ **Type:** Direct verification
132
+
133
+ ### Steps
134
+
135
+ 1. Review all output contracts from Phases 2–4
136
+ 2. Verify RLS policies from different user roles (anon, authenticated, admin)
137
+ 3. Spot-check data using the database query tool
138
+ 4. Start dev server and verify end-to-end functionality
139
+ 5. **Security check:** If the migration touches auth or RLS, schedule panel review
140
+ 6. Document rollback procedure in Linear issue
141
+ 7. Move Linear issue to Done
142
+
143
+ ### Exit Criteria
144
+
145
+ - [ ] RLS policies tested from multiple roles
146
+ - [ ] Data integrity verified
147
+ - [ ] End-to-end flow works in browser
148
+ - [ ] Panel review passed (if auth/RLS changes)
149
+ - [ ] Rollback procedure documented
150
+ - [ ] Linear issue moved to Done
151
+ - [ ] Delivery Outcome completed (see `general.instructions.md`) — branch pushed, PR opened (not merged), Linear linked
152
+
153
+ ---
154
+
155
+ ### Phase 6: Delivery (Compound)
156
+
157
+ > **See [shared-delivery-phase.md](shared-delivery-phase.md) for the standard delivery steps.**
158
+ >
159
+ > Commit → Push → PR → Linear linkage. Team Lead owns delivery.
@@ -0,0 +1,223 @@
1
+ # Workflow: Feature Implementation
2
+
3
+ Standard execution plan for multi-layer features. Customize file paths, agents, and criteria per task.
4
+
5
+ ## Phases
6
+
7
+ ```
8
+ Phase 0: Brainstorm (sub-agent or direct, optional)
9
+ Phase 1: Research (sub-agent, inline)
10
+ Phase 2: Foundation (background agents, parallel)
11
+ Phase 3: Integration (sub-agent, sequential)
12
+ Phase 4: Validation (background agents, parallel)
13
+ Phase 5: QA Gate (sub-agent, inline)
14
+ Phase 6: Compound (direct, Team Lead)
15
+ ```
16
+
17
+ ---
18
+
19
+ ## State Tracking
20
+
21
+ Every Team Lead response during feature work **must** end with a state block. This enables context recovery after interruption and keeps the user informed:
22
+
23
+ ```
24
+ 📍 Phase 2/6 — Foundation | Progress: 3/7 issues | Budget: 2/7 delegations
25
+ Last: ✅ TAS-42 schema deployed (Content Engineer)
26
+ Next: Delegate TAS-43 migration (DB Engineer)
27
+ Cost: ~45K tokens (Standard×2)
28
+ ```
29
+
30
+ Fields: current phase, issues completed/total, delegations used/budget, last completed action, next planned action, running estimated token cost.
31
+
32
+ ---
33
+
34
+ ## Branch Strategy
35
+
36
+ 1. **Team Lead creates the feature branch** in Phase 1 before any delegation: `git checkout -b feat/<ticket-id>-<short-description>`
37
+ 2. **Sub-agents** work directly on the feature branch (they share the Team Lead’s working tree)
38
+ 3. **Background agents** work in isolated worktrees branched from the feature branch
39
+ 4. **Team Lead merges worktrees back** in Phase 5 (QA Gate) after verifying each background agent’s output
40
+ 5. **Only the Team Lead pushes** to the feature branch and opens the PR
41
+
42
+ ---
43
+
44
+ ## Phase 0: Brainstorm (Optional)
45
+
46
+ **Agent:** Team Lead (self)
47
+ **Type:** Direct or sub-agent
48
+ **Blocking:** No — skip when the approach is obvious
49
+
50
+ Run the `brainstorm` prompt when the task has ambiguity, multiple valid approaches, or significant design decisions. Skip for well-defined tasks with obvious implementation paths.
51
+
52
+ ### Steps
53
+
54
+ 1. Clarify the problem — restate, surface assumptions
55
+ 2. Explore solution space — search existing code, check docs
56
+ 3. Generate 2-3 alternative approaches with trade-offs
57
+ 4. Recommend an approach with rationale
58
+ 5. Define scope boundaries (in/out/deferred)
59
+
60
+ ### Exit Criteria
61
+
62
+ - [ ] Problem clearly understood
63
+ - [ ] Alternatives explored
64
+ - [ ] Approach chosen with rationale
65
+ - [ ] Scope boundaries defined
66
+ - [ ] Brainstorm report produced (feeds into Phase 1)
67
+
68
+ ---
69
+
70
+ ## Phase 1: Research & Planning
71
+
72
+ **Agent:** Team Lead (self)
73
+ **Type:** Sub-agent or direct
74
+ **Blocking:** Yes — all other phases depend on this
75
+
76
+ ### Steps
77
+
78
+ 1. Read `docs/PROJECT.md`, `docs/KNOWN-ISSUES.md`, `.github/customizations/LESSONS-LEARNED.md`
79
+ 2. Search codebase for existing implementations
80
+ 3. Identify affected apps, libs, and layers
81
+ 4. **Spec flow analysis** — Trace the complete user flow end-to-end and identify:
82
+ - All user-visible states (loading, empty, populated, error, partial)
83
+ - State transitions and what triggers them
84
+ - Edge cases (network failure, invalid data, concurrent access, empty collections)
85
+ - Missing paths in the spec ("what happens when X?")
86
+ - Accessibility flows (keyboard navigation, screen reader announcements)
87
+ - Document findings as acceptance criteria on the Linear issues
88
+ 5. Decompose into Linear issues with file partitions
89
+ 6. **Surface Open Questions** — Collect ambiguities, design choices, and assumptions that need user input. Present as a structured list for approval before proceeding.
90
+ 7. Create session checkpoint
91
+
92
+ ### Open Questions Gate
93
+
94
+ > **MANDATORY STOP.** Do not proceed to Phase 2 until the user has answered all open questions.
95
+
96
+ After decomposition, present a structured list of open questions. Each question should:
97
+ - State the decision needed clearly
98
+ - Offer 2-3 concrete options with brief trade-offs
99
+ - Flag a recommended option if one is obvious
100
+
101
+ ```markdown
102
+ **Open Questions (answer before implementation begins):**
103
+ 1. [Question]? Option A (trade-off) / Option B (trade-off) / **Recommended: A**
104
+ 2. [Question]? Option A / Option B
105
+ ```
106
+
107
+ If there are no open questions, explicitly state: "No open questions — plan is unambiguous."
108
+
109
+ ### Exit Criteria
110
+
111
+ - [ ] All relevant docs read
112
+ - [ ] **User flow traced** — all states, transitions, and edge cases documented
113
+ - [ ] Linear issues created for every subtask (including edge case coverage)
114
+ - [ ] File partitions mapped (no overlaps)
115
+ - [ ] Dependencies identified
116
+ - [ ] **Open questions answered** by user (or none identified)
117
+ - [ ] Session checkpoint saved
118
+
119
+ ---
120
+
121
+ ## Phase 2: Foundation (Parallel)
122
+
123
+ **Agents:** Varies by task (DB Engineer, Content Engineer, UI Expert)
124
+ **Type:** Background agents (parallel)
125
+ **Blocking:** Phase 3 depends on this
126
+
127
+ ### Typical Partitions
128
+
129
+ > For project-specific paths, see `project.instructions.md` and the relevant `stack/` customization files.
130
+
131
+ | Track | Agent | Files | Purpose |
132
+ |-------|-------|-------|----------|
133
+ | A: Schema | Content Engineer | CMS schema directory | CMS schema changes |
134
+ | B: Database | Database Engineer | Database migrations directory | Migration + RLS policies |
135
+ | C: Components | UI/UX Expert | Shared component library | New UI components |
136
+
137
+ ### Exit Criteria (per track)
138
+
139
+ - [ ] Schema deployed or migration applied
140
+ - [ ] Type definitions generated
141
+ - [ ] Lint + test pass
142
+ - [ ] Output contract returned
143
+
144
+ ---
145
+
146
+ ## Phase 3: Integration (Sequential)
147
+
148
+ **Agent:** Developer
149
+ **Type:** Sub-agent (needs Phase 2 results)
150
+ **Blocking:** Phase 4 depends on this
151
+
152
+ ### Steps
153
+
154
+ 1. Wire new components to data queries
155
+ 2. Update data queries (see relevant skill for query library location)
156
+ 3. Integrate into page routes
157
+ 4. Add loading/error states
158
+ 5. Run lint + test + build
159
+
160
+ ### Exit Criteria
161
+
162
+ - [ ] Feature works end-to-end (data → query → component → page)
163
+ - [ ] Loading and error states implemented
164
+ - [ ] All affected projects build
165
+ - [ ] Output contract returned
166
+
167
+ ---
168
+
169
+ ## Phase 4: Validation (Parallel)
170
+
171
+ **Agents:** Testing Expert, Security Expert, Documentation Writer
172
+ **Type:** Background agents (parallel)
173
+
174
+ ### Tracks
175
+
176
+ | Track | Agent | Focus |
177
+ |-------|-------|-------|
178
+ | A: Tests | Testing Expert | Unit tests, E2E browser tests |
179
+ | B: Security | Security Expert | RLS audit, input validation, auth check |
180
+ | C: Docs | Documentation Writer | Roadmap, ADRs, known issues |
181
+
182
+ ### Exit Criteria (per track)
183
+
184
+ - [ ] 95% test coverage on new code
185
+ - [ ] Browser screenshots at all breakpoints
186
+ - [ ] Security audit passes (or panel review scheduled)
187
+ - [ ] Documentation updated
188
+ - [ ] Output contracts returned
189
+
190
+ ---
191
+
192
+ ## Phase 5: QA Gate
193
+
194
+ **Agent:** Team Lead (self)
195
+ **Type:** Sub-agent (inline)
196
+ **Blocking:** Must pass before merge
197
+
198
+ ### Steps
199
+
200
+ 1. Review all output contracts from Phases 2-4
201
+ 2. Run full lint + test + build across all affected projects
202
+ 3. Verify no files outside partitions were modified
203
+ 4. Check all Linear issue acceptance criteria
204
+ 5. Run panel review if high-stakes (security, DB, architecture)
205
+ 6. Move all issues to Done
206
+ 7. Update session checkpoint → delete checkpoint
207
+ 8. Update `docs/ROADMAP-POST-MVP.md`
208
+
209
+ ### Exit Criteria
210
+
211
+ - [ ] All phases verified
212
+ - [ ] All Linear issues Done
213
+ - [ ] Full build passes
214
+ - [ ] Roadmap updated
215
+ - [ ] Delivery Outcome completed (see `general.instructions.md`) — branch pushed, PR opened (not merged), Linear linked
216
+
217
+ ---
218
+
219
+ ### Phase 6: Delivery (Compound)
220
+
221
+ > **See [shared-delivery-phase.md](shared-delivery-phase.md) for the standard delivery steps.**
222
+ >
223
+ > Commit → Push → PR → Linear linkage. Team Lead owns delivery.