pan-wizard 2.8.1

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 (164) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +772 -0
  3. package/agents/pan-debugger.md +1246 -0
  4. package/agents/pan-document_code.md +965 -0
  5. package/agents/pan-executor.md +469 -0
  6. package/agents/pan-integration-checker.md +443 -0
  7. package/agents/pan-phase-researcher.md +572 -0
  8. package/agents/pan-plan-checker.md +763 -0
  9. package/agents/pan-planner.md +1297 -0
  10. package/agents/pan-project-researcher.md +647 -0
  11. package/agents/pan-research-synthesizer.md +239 -0
  12. package/agents/pan-reviewer.md +112 -0
  13. package/agents/pan-roadmapper.md +642 -0
  14. package/agents/pan-verifier.md +672 -0
  15. package/assets/pan-logo-2000-transparent.svg +30 -0
  16. package/assets/pan-logo-2000.svg +43 -0
  17. package/assets/terminal.svg +119 -0
  18. package/bin/install-lib.cjs +616 -0
  19. package/bin/install.js +1936 -0
  20. package/commands/pan/add-phase.md +44 -0
  21. package/commands/pan/assumptions.md +47 -0
  22. package/commands/pan/audit-deployment.md +378 -0
  23. package/commands/pan/debug.md +168 -0
  24. package/commands/pan/discord.md +19 -0
  25. package/commands/pan/discuss-phase.md +84 -0
  26. package/commands/pan/exec-phase.md +45 -0
  27. package/commands/pan/focus-auto.md +323 -0
  28. package/commands/pan/focus-design.md +816 -0
  29. package/commands/pan/focus-exec.md +316 -0
  30. package/commands/pan/focus-plan.md +101 -0
  31. package/commands/pan/focus-scan.md +272 -0
  32. package/commands/pan/focus-sync.md +104 -0
  33. package/commands/pan/health.md +23 -0
  34. package/commands/pan/help.md +23 -0
  35. package/commands/pan/insert-phase.md +33 -0
  36. package/commands/pan/map-codebase.md +72 -0
  37. package/commands/pan/milestone-audit.md +37 -0
  38. package/commands/pan/milestone-cleanup.md +19 -0
  39. package/commands/pan/milestone-done.md +137 -0
  40. package/commands/pan/milestone-gaps.md +35 -0
  41. package/commands/pan/milestone-new.md +45 -0
  42. package/commands/pan/new-project.md +43 -0
  43. package/commands/pan/patches.md +110 -0
  44. package/commands/pan/pause.md +39 -0
  45. package/commands/pan/phase-budget.md +23 -0
  46. package/commands/pan/phase-tests.md +42 -0
  47. package/commands/pan/plan-phase.md +46 -0
  48. package/commands/pan/profile.md +36 -0
  49. package/commands/pan/progress.md +25 -0
  50. package/commands/pan/quick.md +42 -0
  51. package/commands/pan/remove-phase.md +32 -0
  52. package/commands/pan/research-phase.md +190 -0
  53. package/commands/pan/resume.md +41 -0
  54. package/commands/pan/retro.md +33 -0
  55. package/commands/pan/settings.md +37 -0
  56. package/commands/pan/todo-add.md +48 -0
  57. package/commands/pan/todo-check.md +46 -0
  58. package/commands/pan/update.md +38 -0
  59. package/commands/pan/verify-phase.md +39 -0
  60. package/hooks/dist/pan-check-update.js +62 -0
  61. package/hooks/dist/pan-context-monitor.js +122 -0
  62. package/hooks/dist/pan-statusline.js +108 -0
  63. package/package.json +66 -0
  64. package/pan-wizard-core/bin/lib/codebase.cjs +746 -0
  65. package/pan-wizard-core/bin/lib/commands.cjs +1435 -0
  66. package/pan-wizard-core/bin/lib/config.cjs +611 -0
  67. package/pan-wizard-core/bin/lib/constants.cjs +696 -0
  68. package/pan-wizard-core/bin/lib/context-budget.cjs +150 -0
  69. package/pan-wizard-core/bin/lib/core.cjs +650 -0
  70. package/pan-wizard-core/bin/lib/focus.cjs +900 -0
  71. package/pan-wizard-core/bin/lib/frontmatter.cjs +442 -0
  72. package/pan-wizard-core/bin/lib/init.cjs +881 -0
  73. package/pan-wizard-core/bin/lib/milestone.cjs +276 -0
  74. package/pan-wizard-core/bin/lib/phase.cjs +1212 -0
  75. package/pan-wizard-core/bin/lib/roadmap.cjs +470 -0
  76. package/pan-wizard-core/bin/lib/state.cjs +1029 -0
  77. package/pan-wizard-core/bin/lib/template.cjs +314 -0
  78. package/pan-wizard-core/bin/lib/utils.cjs +171 -0
  79. package/pan-wizard-core/bin/lib/verify.cjs +1808 -0
  80. package/pan-wizard-core/bin/pan-tools.cjs +773 -0
  81. package/pan-wizard-core/references/checkpoints.md +776 -0
  82. package/pan-wizard-core/references/continuation-format.md +249 -0
  83. package/pan-wizard-core/references/decimal-phase-calculation.md +65 -0
  84. package/pan-wizard-core/references/git-integration.md +248 -0
  85. package/pan-wizard-core/references/git-planning-commit.md +38 -0
  86. package/pan-wizard-core/references/model-profile-resolution.md +34 -0
  87. package/pan-wizard-core/references/model-profiles.md +111 -0
  88. package/pan-wizard-core/references/phase-argument-parsing.md +61 -0
  89. package/pan-wizard-core/references/planning-config.md +196 -0
  90. package/pan-wizard-core/references/questioning.md +145 -0
  91. package/pan-wizard-core/references/tdd.md +263 -0
  92. package/pan-wizard-core/references/ui-brand.md +160 -0
  93. package/pan-wizard-core/references/verification-patterns.md +612 -0
  94. package/pan-wizard-core/templates/codebase/architecture.md +283 -0
  95. package/pan-wizard-core/templates/codebase/best-practices.md +133 -0
  96. package/pan-wizard-core/templates/codebase/concerns.md +325 -0
  97. package/pan-wizard-core/templates/codebase/conventions.md +307 -0
  98. package/pan-wizard-core/templates/codebase/integrations.md +305 -0
  99. package/pan-wizard-core/templates/codebase/relationships.md +124 -0
  100. package/pan-wizard-core/templates/codebase/stack.md +199 -0
  101. package/pan-wizard-core/templates/codebase/structure.md +298 -0
  102. package/pan-wizard-core/templates/codebase/testing.md +480 -0
  103. package/pan-wizard-core/templates/config.json +37 -0
  104. package/pan-wizard-core/templates/context.md +283 -0
  105. package/pan-wizard-core/templates/continue-here.md +78 -0
  106. package/pan-wizard-core/templates/debug-subagent-prompt.md +91 -0
  107. package/pan-wizard-core/templates/debug.md +164 -0
  108. package/pan-wizard-core/templates/discovery.md +146 -0
  109. package/pan-wizard-core/templates/milestone-archive.md +123 -0
  110. package/pan-wizard-core/templates/milestone.md +115 -0
  111. package/pan-wizard-core/templates/phase-prompt.md +593 -0
  112. package/pan-wizard-core/templates/planner-subagent-prompt.md +117 -0
  113. package/pan-wizard-core/templates/project.md +184 -0
  114. package/pan-wizard-core/templates/requirements.md +231 -0
  115. package/pan-wizard-core/templates/research-project/architecture.md +204 -0
  116. package/pan-wizard-core/templates/research-project/features.md +147 -0
  117. package/pan-wizard-core/templates/research-project/pitfalls.md +200 -0
  118. package/pan-wizard-core/templates/research-project/stack.md +120 -0
  119. package/pan-wizard-core/templates/research-project/summary.md +170 -0
  120. package/pan-wizard-core/templates/research.md +552 -0
  121. package/pan-wizard-core/templates/retrospective.md +54 -0
  122. package/pan-wizard-core/templates/roadmap.md +202 -0
  123. package/pan-wizard-core/templates/standards.md +24 -0
  124. package/pan-wizard-core/templates/state.md +176 -0
  125. package/pan-wizard-core/templates/summary-complex.md +59 -0
  126. package/pan-wizard-core/templates/summary-minimal.md +41 -0
  127. package/pan-wizard-core/templates/summary-standard.md +49 -0
  128. package/pan-wizard-core/templates/summary.md +249 -0
  129. package/pan-wizard-core/templates/uat.md +247 -0
  130. package/pan-wizard-core/templates/user-setup.md +311 -0
  131. package/pan-wizard-core/templates/validation.md +76 -0
  132. package/pan-wizard-core/templates/verification-report.md +322 -0
  133. package/pan-wizard-core/workflows/add-phase.md +111 -0
  134. package/pan-wizard-core/workflows/assumptions.md +178 -0
  135. package/pan-wizard-core/workflows/diagnose-issues.md +219 -0
  136. package/pan-wizard-core/workflows/discuss-phase.md +542 -0
  137. package/pan-wizard-core/workflows/exec-phase.md +572 -0
  138. package/pan-wizard-core/workflows/execute-plan.md +448 -0
  139. package/pan-wizard-core/workflows/health.md +156 -0
  140. package/pan-wizard-core/workflows/help.md +431 -0
  141. package/pan-wizard-core/workflows/insert-phase.md +129 -0
  142. package/pan-wizard-core/workflows/map-codebase.md +401 -0
  143. package/pan-wizard-core/workflows/milestone-audit.md +297 -0
  144. package/pan-wizard-core/workflows/milestone-cleanup.md +152 -0
  145. package/pan-wizard-core/workflows/milestone-gaps.md +274 -0
  146. package/pan-wizard-core/workflows/milestone-new.md +382 -0
  147. package/pan-wizard-core/workflows/new-project.md +1178 -0
  148. package/pan-wizard-core/workflows/pause.md +122 -0
  149. package/pan-wizard-core/workflows/phase-tests.md +388 -0
  150. package/pan-wizard-core/workflows/plan-phase.md +569 -0
  151. package/pan-wizard-core/workflows/profile.md +115 -0
  152. package/pan-wizard-core/workflows/progress.md +381 -0
  153. package/pan-wizard-core/workflows/quick.md +453 -0
  154. package/pan-wizard-core/workflows/remove-phase.md +154 -0
  155. package/pan-wizard-core/workflows/research-phase.md +73 -0
  156. package/pan-wizard-core/workflows/resume-project.md +306 -0
  157. package/pan-wizard-core/workflows/retro.md +121 -0
  158. package/pan-wizard-core/workflows/settings.md +213 -0
  159. package/pan-wizard-core/workflows/todo-add.md +157 -0
  160. package/pan-wizard-core/workflows/todo-check.md +176 -0
  161. package/pan-wizard-core/workflows/transition.md +544 -0
  162. package/pan-wizard-core/workflows/update.md +219 -0
  163. package/pan-wizard-core/workflows/verify-phase.md +301 -0
  164. package/scripts/build-hooks.js +43 -0
@@ -0,0 +1,305 @@
1
+ # External Integrations Template
2
+
3
+ Template for `.planning/codebase/INTEGRATIONS.md` - captures external service dependencies.
4
+
5
+ **Purpose:** Document what external systems this codebase communicates with. Focused on "what lives outside our code that we depend on."
6
+
7
+ ---
8
+
9
+ ## File Template
10
+
11
+ ```markdown
12
+ # External Integrations
13
+
14
+ **Analysis Date:** [YYYY-MM-DD]
15
+
16
+ ## Data Architecture
17
+
18
+ ### External Service Map
19
+
20
+ ```mermaid
21
+ graph LR
22
+ App[Application] --> DB[(Database)]
23
+ App --> Cache[(Cache)]
24
+ App --> Auth[Auth Provider]
25
+ App --> API[External APIs]
26
+ App --> Storage[File Storage]
27
+ App --> Monitor[Monitoring]
28
+ ```
29
+
30
+ ### Entity Relationships
31
+
32
+ [Include only when database/ORM is detected]
33
+
34
+ ```mermaid
35
+ erDiagram
36
+ USER ||--o{ ORDER : places
37
+ ORDER ||--|{ LINE_ITEM : contains
38
+ PRODUCT ||--o{ LINE_ITEM : "appears in"
39
+ ```
40
+
41
+ ## APIs & External Services
42
+
43
+ **Payment Processing:**
44
+ - [Service] - [What it's used for: e.g., "subscription billing, one-time payments"]
45
+ - SDK/Client: [e.g., "stripe npm package v14.x"]
46
+ - Auth: [e.g., "API key in STRIPE_SECRET_KEY env var"]
47
+ - Endpoints used: [e.g., "checkout sessions, webhooks"]
48
+
49
+ **Email/SMS:**
50
+ - [Service] - [What it's used for: e.g., "transactional emails"]
51
+ - SDK/Client: [e.g., "sendgrid/mail v8.x"]
52
+ - Auth: [e.g., "API key in SENDGRID_API_KEY env var"]
53
+ - Templates: [e.g., "managed in SendGrid dashboard"]
54
+
55
+ **External APIs:**
56
+ - [Service] - [What it's used for]
57
+ - Integration method: [e.g., "REST API via fetch", "GraphQL client"]
58
+ - Auth: [e.g., "OAuth2 token in AUTH_TOKEN env var"]
59
+ - Rate limits: [if applicable]
60
+
61
+ ## Data Storage
62
+
63
+ **Databases:**
64
+ - [Type/Provider] - [e.g., "PostgreSQL on Supabase"]
65
+ - Connection: [e.g., "via DATABASE_URL env var"]
66
+ - Client: [e.g., "Prisma ORM v5.x"]
67
+ - Migrations: [e.g., "prisma migrate in migrations/"]
68
+
69
+ **File Storage:**
70
+ - [Service] - [e.g., "AWS S3 for user uploads"]
71
+ - SDK/Client: [e.g., "@aws-sdk/client-s3"]
72
+ - Auth: [e.g., "IAM credentials in AWS_* env vars"]
73
+ - Buckets: [e.g., "prod-uploads, dev-uploads"]
74
+
75
+ **Caching:**
76
+ - [Service] - [e.g., "Redis for session storage"]
77
+ - Connection: [e.g., "REDIS_URL env var"]
78
+ - Client: [e.g., "ioredis v5.x"]
79
+
80
+ ## Authentication & Identity
81
+
82
+ **Auth Provider:**
83
+ - [Service] - [e.g., "Supabase Auth", "Auth0", "custom JWT"]
84
+ - Implementation: [e.g., "Supabase client SDK"]
85
+ - Token storage: [e.g., "httpOnly cookies", "localStorage"]
86
+ - Session management: [e.g., "JWT refresh tokens"]
87
+
88
+ **OAuth Integrations:**
89
+ - [Provider] - [e.g., "Google OAuth for sign-in"]
90
+ - Credentials: [e.g., "GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET"]
91
+ - Scopes: [e.g., "email, profile"]
92
+
93
+ ## Monitoring & Observability
94
+
95
+ **Error Tracking:**
96
+ - [Service] - [e.g., "Sentry"]
97
+ - DSN: [e.g., "SENTRY_DSN env var"]
98
+ - Release tracking: [e.g., "via SENTRY_RELEASE"]
99
+
100
+ **Analytics:**
101
+ - [Service] - [e.g., "Mixpanel for product analytics"]
102
+ - Token: [e.g., "MIXPANEL_TOKEN env var"]
103
+ - Events tracked: [e.g., "user actions, page views"]
104
+
105
+ **Logs:**
106
+ - [Service] - [e.g., "CloudWatch", "Datadog", "none (stdout only)"]
107
+ - Integration: [e.g., "AWS Lambda built-in"]
108
+
109
+ ## CI/CD & Deployment
110
+
111
+ **Hosting:**
112
+ - [Platform] - [e.g., "Vercel", "AWS Lambda", "Docker on ECS"]
113
+ - Deployment: [e.g., "automatic on main branch push"]
114
+ - Environment vars: [e.g., "configured in Vercel dashboard"]
115
+
116
+ **CI Pipeline:**
117
+ - [Service] - [e.g., "GitHub Actions"]
118
+ - Workflows: [e.g., "test.yml, deploy.yml"]
119
+ - Secrets: [e.g., "stored in GitHub repo secrets"]
120
+
121
+ ## Environment Configuration
122
+
123
+ **Development:**
124
+ - Required env vars: [List critical vars]
125
+ - Secrets location: [e.g., ".env.local (gitignored)", "1Password vault"]
126
+ - Mock/stub services: [e.g., "Stripe test mode", "local PostgreSQL"]
127
+
128
+ **Staging:**
129
+ - Environment-specific differences: [e.g., "uses staging Stripe account"]
130
+ - Data: [e.g., "separate staging database"]
131
+
132
+ **Production:**
133
+ - Secrets management: [e.g., "Vercel environment variables"]
134
+ - Failover/redundancy: [e.g., "multi-region DB replication"]
135
+
136
+ ## Webhooks & Callbacks
137
+
138
+ **Incoming:**
139
+ - [Service] - [Endpoint: e.g., "/api/webhooks/stripe"]
140
+ - Verification: [e.g., "signature validation via stripe.webhooks.constructEvent"]
141
+ - Events: [e.g., "payment_intent.succeeded, customer.subscription.updated"]
142
+
143
+ **Outgoing:**
144
+ - [Service] - [What triggers it]
145
+ - Endpoint: [e.g., "external CRM webhook on user signup"]
146
+ - Retry logic: [if applicable]
147
+
148
+ ---
149
+
150
+ *Integration audit: [date]*
151
+ *Update when adding/removing external services*
152
+ ```
153
+
154
+ <good_examples>
155
+ ```markdown
156
+ # External Integrations
157
+
158
+ **Analysis Date:** 2025-01-20
159
+
160
+ ## APIs & External Services
161
+
162
+ **Payment Processing:**
163
+ - Stripe - Subscription billing and one-time course payments
164
+ - SDK/Client: stripe npm package v14.8
165
+ - Auth: API key in STRIPE_SECRET_KEY env var
166
+ - Endpoints used: checkout sessions, customer portal, webhooks
167
+
168
+ **Email/SMS:**
169
+ - SendGrid - Transactional emails (receipts, password resets)
170
+ - SDK/Client: @sendgrid/mail v8.1
171
+ - Auth: API key in SENDGRID_API_KEY env var
172
+ - Templates: Managed in SendGrid dashboard (template IDs in code)
173
+
174
+ **External APIs:**
175
+ - OpenAI API - Course content generation
176
+ - Integration method: REST API via openai npm package v4.x
177
+ - Auth: Bearer token in OPENAI_API_KEY env var
178
+ - Rate limits: 3500 requests/min (tier 3)
179
+
180
+ ## Data Storage
181
+
182
+ **Databases:**
183
+ - PostgreSQL on Supabase - Primary data store
184
+ - Connection: via DATABASE_URL env var
185
+ - Client: Prisma ORM v5.8
186
+ - Migrations: prisma migrate in prisma/migrations/
187
+
188
+ **File Storage:**
189
+ - Supabase Storage - User uploads (profile images, course materials)
190
+ - SDK/Client: @supabase/supabase-js v2.x
191
+ - Auth: Service role key in SUPABASE_SERVICE_ROLE_KEY
192
+ - Buckets: avatars (public), course-materials (private)
193
+
194
+ **Caching:**
195
+ - None currently (all database queries, no Redis)
196
+
197
+ ## Authentication & Identity
198
+
199
+ **Auth Provider:**
200
+ - Supabase Auth - Email/password + OAuth
201
+ - Implementation: Supabase client SDK with server-side session management
202
+ - Token storage: httpOnly cookies via @supabase/ssr
203
+ - Session management: JWT refresh tokens handled by Supabase
204
+
205
+ **OAuth Integrations:**
206
+ - Google OAuth - Social sign-in
207
+ - Credentials: GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET (Supabase dashboard)
208
+ - Scopes: email, profile
209
+
210
+ ## Monitoring & Observability
211
+
212
+ **Error Tracking:**
213
+ - Sentry - Server and client errors
214
+ - DSN: SENTRY_DSN env var
215
+ - Release tracking: Git commit SHA via SENTRY_RELEASE
216
+
217
+ **Analytics:**
218
+ - None (planned: Mixpanel)
219
+
220
+ **Logs:**
221
+ - Vercel logs - stdout/stderr only
222
+ - Retention: 7 days on Pro plan
223
+
224
+ ## CI/CD & Deployment
225
+
226
+ **Hosting:**
227
+ - Vercel - Next.js app hosting
228
+ - Deployment: Automatic on main branch push
229
+ - Environment vars: Configured in Vercel dashboard (synced to .env.example)
230
+
231
+ **CI Pipeline:**
232
+ - GitHub Actions - Tests and type checking
233
+ - Workflows: .github/workflows/ci.yml
234
+ - Secrets: None needed (public repo tests only)
235
+
236
+ ## Environment Configuration
237
+
238
+ **Development:**
239
+ - Required env vars: DATABASE_URL, NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY
240
+ - Secrets location: .env.local (gitignored), team shared via 1Password vault
241
+ - Mock/stub services: Stripe test mode, Supabase local dev project
242
+
243
+ **Staging:**
244
+ - Uses separate Supabase staging project
245
+ - Stripe test mode
246
+ - Same Vercel account, different environment
247
+
248
+ **Production:**
249
+ - Secrets management: Vercel environment variables
250
+ - Database: Supabase production project with daily backups
251
+
252
+ ## Webhooks & Callbacks
253
+
254
+ **Incoming:**
255
+ - Stripe - /api/webhooks/stripe
256
+ - Verification: Signature validation via stripe.webhooks.constructEvent
257
+ - Events: payment_intent.succeeded, customer.subscription.updated, customer.subscription.deleted
258
+
259
+ **Outgoing:**
260
+ - None
261
+
262
+ ---
263
+
264
+ *Integration audit: 2025-01-20*
265
+ *Update when adding/removing external services*
266
+ ```
267
+ </good_examples>
268
+
269
+ <guidelines>
270
+ **What belongs in INTEGRATIONS.md:**
271
+ - External services the code communicates with
272
+ - Authentication patterns (where secrets live, not the secrets themselves)
273
+ - SDKs and client libraries used
274
+ - Environment variable names (not values)
275
+ - Webhook endpoints and verification methods
276
+ - Database connection patterns
277
+ - File storage locations
278
+ - Monitoring and logging services
279
+
280
+ **What does NOT belong here:**
281
+ - Actual API keys or secrets (NEVER write these)
282
+ - Internal architecture (that's ARCHITECTURE.md)
283
+ - Code patterns (that's PATTERNS.md)
284
+ - Technology choices (that's STACK.md)
285
+ - Performance issues (that's CONCERNS.md)
286
+
287
+ **When filling this template:**
288
+ - Check .env.example or .env.template for required env vars
289
+ - Look for SDK imports (stripe, @sendgrid/mail, etc.)
290
+ - Check for webhook handlers in routes/endpoints
291
+ - Note where secrets are managed (not the secrets)
292
+ - Document environment-specific differences (dev/staging/prod)
293
+ - Include auth patterns for each service
294
+
295
+ **Useful for phase planning when:**
296
+ - Adding new external service integrations
297
+ - Debugging authentication issues
298
+ - Understanding data flow outside the application
299
+ - Setting up new environments
300
+ - Auditing third-party dependencies
301
+ - Planning for service outages or migrations
302
+
303
+ **Security note:**
304
+ Document WHERE secrets live (env vars, Vercel dashboard, 1Password), never WHAT the secrets are.
305
+ </guidelines>
@@ -0,0 +1,124 @@
1
+ # Relationships Template
2
+
3
+ Template for `.planning/codebase/relationships.md` - maps module dependencies and coupling.
4
+
5
+ **Purpose:** Document how modules relate to each other. Answers "what depends on what?" and "what breaks if I change X?"
6
+
7
+ ---
8
+
9
+ ## File Template
10
+
11
+ ```markdown
12
+ # Module Relationships
13
+
14
+ **Analysis Date:** [YYYY-MM-DD]
15
+
16
+ ## Dependency Overview
17
+
18
+ | Metric | Value |
19
+ |--------|-------|
20
+ | Total modules | [N] |
21
+ | Total import relationships | [N] |
22
+ | Circular dependencies | [N] |
23
+ | Orphan modules | [N] |
24
+ | Entry points | [N] |
25
+
26
+ ## Module Dependency Graph
27
+
28
+ ```mermaid
29
+ graph LR
30
+ [ModuleA] --> [ModuleB]
31
+ [ModuleB] --> [ModuleC]
32
+ ```
33
+
34
+ ## Circular Dependencies
35
+
36
+ [If none: "No circular dependencies detected."]
37
+
38
+ **Cycle [N]:** `[file-a]` -> `[file-b]` -> `[file-a]`
39
+ - Severity: [High/Medium/Low]
40
+ - Impact: [What breaks or is fragile]
41
+ - Fix approach: [Extract shared code, invert dependency, use interface]
42
+
43
+ ## High-Coupling Modules
44
+
45
+ Modules with the most connections (incoming + outgoing):
46
+
47
+ | Module | Incoming | Outgoing | Total | Risk |
48
+ |--------|----------|----------|-------|------|
49
+ | `[path]` | [N] | [N] | [N] | [Hub/Gateway/Leaf] |
50
+
51
+ ## Orphan Modules
52
+
53
+ Files that export symbols but are never imported (potential dead code):
54
+
55
+ - `[path]` - exports `[function/class names]`
56
+
57
+ [If none: "No orphan modules detected."]
58
+
59
+ ## Entry Points
60
+
61
+ Application roots (files imported by nothing):
62
+
63
+ - `[path]` - [Purpose: main entry, CLI entry, test runner, etc.]
64
+
65
+ ## Layer Boundaries
66
+
67
+ [Describe the architectural layers detected in the codebase]
68
+
69
+ **Layers:**
70
+ 1. [Layer name] - `[directory pattern]`
71
+ 2. [Layer name] - `[directory pattern]`
72
+
73
+ ## Layer Violations
74
+
75
+ Imports that cross architectural boundaries:
76
+
77
+ - `[source file]` imports `[target file]` - [Why this is a violation]
78
+
79
+ [If none: "No layer violations detected."]
80
+
81
+ ## Import Patterns
82
+
83
+ **Module system:** [CommonJS / ESM / Mixed]
84
+
85
+ **Internal imports:** [Relative paths / Aliases / Barrel files]
86
+
87
+ **External dependencies:** [How third-party packages are imported]
88
+
89
+ ---
90
+
91
+ *Relationship analysis: [date]*
92
+ *Update when module structure changes*
93
+ ```
94
+
95
+ <guidelines>
96
+ **What belongs in relationships.md:**
97
+ - Module dependency graph (Mermaid)
98
+ - Circular dependency warnings with fix suggestions
99
+ - High-coupling modules (hub detection)
100
+ - Orphan modules (dead code candidates)
101
+ - Entry points (application roots)
102
+ - Layer boundaries and violations
103
+ - Import pattern summary
104
+
105
+ **What does NOT belong here:**
106
+ - Individual function signatures (that's ARCHITECTURE.md)
107
+ - File listing (that's STRUCTURE.md)
108
+ - Code quality issues (that's CONCERNS.md)
109
+ - Technology choices (that's STACK.md)
110
+
111
+ **When filling this template:**
112
+ - Use pre-computed dependency graph data if provided in the prompt
113
+ - Verify circular dependencies by tracing the import chain
114
+ - Classify coupling risk: Hub (>10 connections), Gateway (5-10), Leaf (<5)
115
+ - Entry points are files with zero incoming edges
116
+ - Layer violations require understanding the intended architecture
117
+
118
+ **Mermaid graph guidelines:**
119
+ - Maximum 15 nodes per diagram
120
+ - Use `graph LR` for dependency flow
121
+ - Show module short names, not full paths
122
+ - Highlight circular deps with red styling if supported
123
+ - Add "... and N more" note for large graphs
124
+ </guidelines>
@@ -0,0 +1,199 @@
1
+ # Technology Stack Template
2
+
3
+ Template for `.planning/codebase/STACK.md` - captures the technology foundation.
4
+
5
+ **Purpose:** Document what technologies run this codebase. Focused on "what executes when you run the code."
6
+
7
+ ---
8
+
9
+ ## File Template
10
+
11
+ ```markdown
12
+ # Technology Stack
13
+
14
+ **Analysis Date:** [YYYY-MM-DD]
15
+
16
+ ## Technology Architecture
17
+
18
+ ### Deployment Topology
19
+
20
+ ```mermaid
21
+ graph TD
22
+ User[User/Developer] --> CLI[CLI / Browser]
23
+ CLI --> Runtime[Runtime Environment]
24
+ Runtime --> App[Application]
25
+ App --> FS[File System]
26
+ App --> ExtSvc[External Services]
27
+ ```
28
+
29
+ ## Languages
30
+
31
+ **Primary:**
32
+ - [Language] [Version] - [Where used: e.g., "all application code"]
33
+
34
+ **Secondary:**
35
+ - [Language] [Version] - [Where used: e.g., "build scripts, tooling"]
36
+
37
+ ## Runtime
38
+
39
+ **Environment:**
40
+ - [Runtime] [Version] - [e.g., "Node.js 20.x"]
41
+ - [Additional requirements if any]
42
+
43
+ **Package Manager:**
44
+ - [Manager] [Version] - [e.g., "npm 10.x"]
45
+ - Lockfile: [e.g., "package-lock.json present"]
46
+
47
+ ## Frameworks
48
+
49
+ **Core:**
50
+ - [Framework] [Version] - [Purpose: e.g., "web server", "UI framework"]
51
+
52
+ **Testing:**
53
+ - [Framework] [Version] - [e.g., "Jest for unit tests"]
54
+ - [Framework] [Version] - [e.g., "Playwright for E2E"]
55
+
56
+ **Build/Dev:**
57
+ - [Tool] [Version] - [e.g., "Vite for bundling"]
58
+ - [Tool] [Version] - [e.g., "TypeScript compiler"]
59
+
60
+ ## Key Dependencies
61
+
62
+ [Only include dependencies critical to understanding the stack - limit to 5-10 most important]
63
+
64
+ **Critical:**
65
+ - [Package] [Version] - [Why it matters: e.g., "authentication", "database access"]
66
+ - [Package] [Version] - [Why it matters]
67
+
68
+ **Infrastructure:**
69
+ - [Package] [Version] - [e.g., "Express for HTTP routing"]
70
+ - [Package] [Version] - [e.g., "PostgreSQL client"]
71
+
72
+ ## Configuration
73
+
74
+ **Environment:**
75
+ - [How configured: e.g., ".env files", "environment variables"]
76
+ - [Key configs: e.g., "DATABASE_URL, API_KEY required"]
77
+
78
+ **Build:**
79
+ - [Build config files: e.g., "vite.config.ts, tsconfig.json"]
80
+
81
+ ## Platform Requirements
82
+
83
+ **Development:**
84
+ - [OS requirements or "any platform"]
85
+ - [Additional tooling: e.g., "Docker for local DB"]
86
+
87
+ **Production:**
88
+ - [Deployment target: e.g., "Vercel", "AWS Lambda", "Docker container"]
89
+ - [Version requirements]
90
+
91
+ ---
92
+
93
+ *Stack analysis: [date]*
94
+ *Update after major dependency changes*
95
+ ```
96
+
97
+ <good_examples>
98
+ ```markdown
99
+ # Technology Stack
100
+
101
+ **Analysis Date:** 2025-01-20
102
+
103
+ ## Languages
104
+
105
+ **Primary:**
106
+ - TypeScript 5.3 - All application code
107
+
108
+ **Secondary:**
109
+ - JavaScript - Build scripts, config files
110
+
111
+ ## Runtime
112
+
113
+ **Environment:**
114
+ - Node.js 20.x (LTS)
115
+ - No browser runtime (CLI tool only)
116
+
117
+ **Package Manager:**
118
+ - npm 10.x
119
+ - Lockfile: `package-lock.json` present
120
+
121
+ ## Frameworks
122
+
123
+ **Core:**
124
+ - None (vanilla Node.js CLI)
125
+
126
+ **Testing:**
127
+ - Vitest 1.0 - Unit tests
128
+ - tsx - TypeScript execution without build step
129
+
130
+ **Build/Dev:**
131
+ - TypeScript 5.3 - Compilation to JavaScript
132
+ - esbuild - Used by Vitest for fast transforms
133
+
134
+ ## Key Dependencies
135
+
136
+ **Critical:**
137
+ - commander 11.x - CLI argument parsing and command structure
138
+ - chalk 5.x - Terminal output styling
139
+ - fs-extra 11.x - Extended file system operations
140
+
141
+ **Infrastructure:**
142
+ - Node.js built-ins - fs, path, child_process for file operations
143
+
144
+ ## Configuration
145
+
146
+ **Environment:**
147
+ - No environment variables required
148
+ - Configuration via CLI flags only
149
+
150
+ **Build:**
151
+ - `tsconfig.json` - TypeScript compiler options
152
+ - `vitest.config.ts` - Test runner configuration
153
+
154
+ ## Platform Requirements
155
+
156
+ **Development:**
157
+ - macOS/Linux/Windows (any platform with Node.js)
158
+ - No external dependencies
159
+
160
+ **Production:**
161
+ - Distributed as npm package
162
+ - Installed globally via npm install -g
163
+ - Runs on user's Node.js installation
164
+
165
+ ---
166
+
167
+ *Stack analysis: 2025-01-20*
168
+ *Update after major dependency changes*
169
+ ```
170
+ </good_examples>
171
+
172
+ <guidelines>
173
+ **What belongs in STACK.md:**
174
+ - Languages and versions
175
+ - Runtime requirements (Node, Bun, Deno, browser)
176
+ - Package manager and lockfile
177
+ - Framework choices
178
+ - Critical dependencies (limit to 5-10 most important)
179
+ - Build tooling
180
+ - Platform/deployment requirements
181
+
182
+ **What does NOT belong here:**
183
+ - File structure (that's STRUCTURE.md)
184
+ - Architectural patterns (that's ARCHITECTURE.md)
185
+ - Every dependency in package.json (only critical ones)
186
+ - Implementation details (defer to code)
187
+
188
+ **When filling this template:**
189
+ - Check package.json for dependencies
190
+ - Note runtime version from .nvmrc or package.json engines
191
+ - Include only dependencies that affect understanding (not every utility)
192
+ - Specify versions only when version matters (breaking changes, compatibility)
193
+
194
+ **Useful for phase planning when:**
195
+ - Adding new dependencies (check compatibility)
196
+ - Upgrading frameworks (know what's in use)
197
+ - Choosing implementation approach (must work with existing stack)
198
+ - Understanding build requirements
199
+ </guidelines>