mindsystem-cc 3.0.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.
- package/LICENSE +21 -0
- package/README.md +501 -0
- package/agents/ms-codebase-mapper.md +739 -0
- package/agents/ms-debugger.md +1184 -0
- package/agents/ms-designer.md +414 -0
- package/agents/ms-executor.md +760 -0
- package/agents/ms-integration-checker.md +423 -0
- package/agents/ms-milestone-auditor.md +448 -0
- package/agents/ms-mock-generator.md +182 -0
- package/agents/ms-plan-checker.md +746 -0
- package/agents/ms-research-synthesizer.md +248 -0
- package/agents/ms-researcher.md +962 -0
- package/agents/ms-roadmapper.md +606 -0
- package/agents/ms-verifier.md +779 -0
- package/agents/ms-verify-fixer.md +124 -0
- package/bin/install.js +296 -0
- package/commands/ms/add-phase.md +207 -0
- package/commands/ms/add-todo.md +182 -0
- package/commands/ms/audit-milestone.md +318 -0
- package/commands/ms/check-phase.md +162 -0
- package/commands/ms/check-todos.md +217 -0
- package/commands/ms/complete-milestone.md +137 -0
- package/commands/ms/create-roadmap.md +273 -0
- package/commands/ms/debug.md +149 -0
- package/commands/ms/define-requirements.md +121 -0
- package/commands/ms/design-phase.md +341 -0
- package/commands/ms/discuss-milestone.md +48 -0
- package/commands/ms/discuss-phase.md +60 -0
- package/commands/ms/do-work.md +90 -0
- package/commands/ms/execute-phase.md +289 -0
- package/commands/ms/help.md +623 -0
- package/commands/ms/insert-phase.md +227 -0
- package/commands/ms/list-phase-assumptions.md +50 -0
- package/commands/ms/map-codebase.md +71 -0
- package/commands/ms/new-milestone.md +193 -0
- package/commands/ms/new-project.md +338 -0
- package/commands/ms/pause-work.md +123 -0
- package/commands/ms/plan-milestone-gaps.md +285 -0
- package/commands/ms/plan-phase.md +105 -0
- package/commands/ms/progress.md +370 -0
- package/commands/ms/remove-phase.md +338 -0
- package/commands/ms/research-phase.md +175 -0
- package/commands/ms/research-project.md +339 -0
- package/commands/ms/resume-work.md +40 -0
- package/commands/ms/review-design.md +484 -0
- package/commands/ms/simplify-flutter.md +193 -0
- package/commands/ms/update.md +159 -0
- package/commands/ms/verify-work.md +92 -0
- package/commands/ms/whats-new.md +124 -0
- package/mindsystem/references/checkpoints.md +788 -0
- package/mindsystem/references/continuation-format.md +255 -0
- package/mindsystem/references/debugging/debugging-mindset.md +11 -0
- package/mindsystem/references/debugging/hypothesis-testing.md +11 -0
- package/mindsystem/references/debugging/investigation-techniques.md +11 -0
- package/mindsystem/references/debugging/verification-patterns.md +11 -0
- package/mindsystem/references/debugging/when-to-research.md +11 -0
- package/mindsystem/references/git-integration.md +254 -0
- package/mindsystem/references/goal-backward.md +286 -0
- package/mindsystem/references/mock-patterns.md +294 -0
- package/mindsystem/references/plan-format.md +473 -0
- package/mindsystem/references/principles.md +73 -0
- package/mindsystem/references/questioning.md +140 -0
- package/mindsystem/references/research-pitfalls.md +233 -0
- package/mindsystem/references/scope-estimation.md +256 -0
- package/mindsystem/references/tdd.md +263 -0
- package/mindsystem/references/verification-patterns.md +595 -0
- package/mindsystem/templates/DEBUG.md +159 -0
- package/mindsystem/templates/UAT.md +403 -0
- package/mindsystem/templates/adhoc-summary.md +153 -0
- package/mindsystem/templates/codebase/architecture.md +255 -0
- package/mindsystem/templates/codebase/concerns.md +310 -0
- package/mindsystem/templates/codebase/conventions.md +307 -0
- package/mindsystem/templates/codebase/integrations.md +280 -0
- package/mindsystem/templates/codebase/stack.md +186 -0
- package/mindsystem/templates/codebase/structure.md +285 -0
- package/mindsystem/templates/codebase/testing.md +480 -0
- package/mindsystem/templates/config.json +26 -0
- package/mindsystem/templates/context.md +140 -0
- package/mindsystem/templates/continue-here.md +78 -0
- package/mindsystem/templates/debug-subagent-prompt.md +91 -0
- package/mindsystem/templates/design-iteration.md +208 -0
- package/mindsystem/templates/design.md +417 -0
- package/mindsystem/templates/discovery.md +146 -0
- package/mindsystem/templates/milestone-archive.md +123 -0
- package/mindsystem/templates/milestone-context.md +93 -0
- package/mindsystem/templates/milestone.md +115 -0
- package/mindsystem/templates/phase-prompt.md +574 -0
- package/mindsystem/templates/project.md +184 -0
- package/mindsystem/templates/requirements.md +231 -0
- package/mindsystem/templates/research-project/ARCHITECTURE.md +204 -0
- package/mindsystem/templates/research-project/FEATURES.md +147 -0
- package/mindsystem/templates/research-project/PITFALLS.md +200 -0
- package/mindsystem/templates/research-project/STACK.md +120 -0
- package/mindsystem/templates/research-project/SUMMARY.md +170 -0
- package/mindsystem/templates/research-subagent-prompt.md +92 -0
- package/mindsystem/templates/research.md +529 -0
- package/mindsystem/templates/roadmap.md +214 -0
- package/mindsystem/templates/state.md +224 -0
- package/mindsystem/templates/summary.md +269 -0
- package/mindsystem/templates/user-setup.md +323 -0
- package/mindsystem/templates/verification-report.md +322 -0
- package/mindsystem/workflows/complete-milestone.md +759 -0
- package/mindsystem/workflows/create-milestone.md +203 -0
- package/mindsystem/workflows/debug.md +14 -0
- package/mindsystem/workflows/define-requirements.md +330 -0
- package/mindsystem/workflows/diagnose-issues.md +241 -0
- package/mindsystem/workflows/discovery-phase.md +293 -0
- package/mindsystem/workflows/discuss-milestone.md +310 -0
- package/mindsystem/workflows/discuss-phase.md +237 -0
- package/mindsystem/workflows/do-work.md +359 -0
- package/mindsystem/workflows/execute-phase.md +644 -0
- package/mindsystem/workflows/execute-plan.md +1828 -0
- package/mindsystem/workflows/generate-mocks.md +187 -0
- package/mindsystem/workflows/list-phase-assumptions.md +178 -0
- package/mindsystem/workflows/map-codebase.md +289 -0
- package/mindsystem/workflows/plan-phase.md +876 -0
- package/mindsystem/workflows/research-phase.md +17 -0
- package/mindsystem/workflows/research-project.md +23 -0
- package/mindsystem/workflows/resume-project.md +311 -0
- package/mindsystem/workflows/transition.md +564 -0
- package/mindsystem/workflows/verify-phase.md +629 -0
- package/mindsystem/workflows/verify-work.md +823 -0
- package/package.json +32 -0
- package/scripts/generate-phase-patch.sh +169 -0
- package/scripts/ms-lookup/README.md +112 -0
- package/scripts/ms-lookup/ms_lookup/__init__.py +3 -0
- package/scripts/ms-lookup/ms_lookup/__main__.py +6 -0
- package/scripts/ms-lookup/ms_lookup/backends/__init__.py +6 -0
- package/scripts/ms-lookup/ms_lookup/backends/context7.py +219 -0
- package/scripts/ms-lookup/ms_lookup/backends/perplexity.py +145 -0
- package/scripts/ms-lookup/ms_lookup/cache.py +48 -0
- package/scripts/ms-lookup/ms_lookup/cli.py +219 -0
- package/scripts/ms-lookup/ms_lookup/config.py +23 -0
- package/scripts/ms-lookup/ms_lookup/errors.py +24 -0
- package/scripts/ms-lookup/ms_lookup/output.py +49 -0
- package/scripts/ms-lookup/ms_lookup/tokens.py +56 -0
- package/scripts/ms-lookup/pyproject.toml +17 -0
- package/scripts/ms-lookup/uv.lock +207 -0
- package/scripts/ms-lookup-wrapper.sh +21 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# Coding Conventions Template
|
|
2
|
+
|
|
3
|
+
Template for `.planning/codebase/CONVENTIONS.md` - captures coding style and patterns.
|
|
4
|
+
|
|
5
|
+
**Purpose:** Document how code is written in this codebase. Prescriptive guide for Claude to match existing style.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## File Template
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
# Coding Conventions
|
|
13
|
+
|
|
14
|
+
**Analysis Date:** [YYYY-MM-DD]
|
|
15
|
+
|
|
16
|
+
## Naming Patterns
|
|
17
|
+
|
|
18
|
+
**Files:**
|
|
19
|
+
- [Pattern: e.g., "kebab-case for all files"]
|
|
20
|
+
- [Test files: e.g., "*.test.ts alongside source"]
|
|
21
|
+
- [Components: e.g., "PascalCase.tsx for React components"]
|
|
22
|
+
|
|
23
|
+
**Functions:**
|
|
24
|
+
- [Pattern: e.g., "camelCase for all functions"]
|
|
25
|
+
- [Async: e.g., "no special prefix for async functions"]
|
|
26
|
+
- [Handlers: e.g., "handleEventName for event handlers"]
|
|
27
|
+
|
|
28
|
+
**Variables:**
|
|
29
|
+
- [Pattern: e.g., "camelCase for variables"]
|
|
30
|
+
- [Constants: e.g., "UPPER_SNAKE_CASE for constants"]
|
|
31
|
+
- [Private: e.g., "_prefix for private members" or "no prefix"]
|
|
32
|
+
|
|
33
|
+
**Types:**
|
|
34
|
+
- [Interfaces: e.g., "PascalCase, no I prefix"]
|
|
35
|
+
- [Types: e.g., "PascalCase for type aliases"]
|
|
36
|
+
- [Enums: e.g., "PascalCase for enum name, UPPER_CASE for values"]
|
|
37
|
+
|
|
38
|
+
## Code Style
|
|
39
|
+
|
|
40
|
+
**Formatting:**
|
|
41
|
+
- [Tool: e.g., "Prettier with config in .prettierrc"]
|
|
42
|
+
- [Line length: e.g., "100 characters max"]
|
|
43
|
+
- [Quotes: e.g., "single quotes for strings"]
|
|
44
|
+
- [Semicolons: e.g., "required" or "omitted"]
|
|
45
|
+
|
|
46
|
+
**Linting:**
|
|
47
|
+
- [Tool: e.g., "ESLint with eslint.config.js"]
|
|
48
|
+
- [Rules: e.g., "extends airbnb-base, no console in production"]
|
|
49
|
+
- [Run: e.g., "npm run lint"]
|
|
50
|
+
|
|
51
|
+
## Import Organization
|
|
52
|
+
|
|
53
|
+
**Order:**
|
|
54
|
+
1. [e.g., "External packages (react, express, etc.)"]
|
|
55
|
+
2. [e.g., "Internal modules (@/lib, @/components)"]
|
|
56
|
+
3. [e.g., "Relative imports (., ..)"]
|
|
57
|
+
4. [e.g., "Type imports (import type {})"]
|
|
58
|
+
|
|
59
|
+
**Grouping:**
|
|
60
|
+
- [Blank lines: e.g., "blank line between groups"]
|
|
61
|
+
- [Sorting: e.g., "alphabetical within each group"]
|
|
62
|
+
|
|
63
|
+
**Path Aliases:**
|
|
64
|
+
- [Aliases used: e.g., "@/ for src/, @components/ for src/components/"]
|
|
65
|
+
|
|
66
|
+
## Error Handling
|
|
67
|
+
|
|
68
|
+
**Patterns:**
|
|
69
|
+
- [Strategy: e.g., "throw errors, catch at boundaries"]
|
|
70
|
+
- [Custom errors: e.g., "extend Error class, named *Error"]
|
|
71
|
+
- [Async: e.g., "use try/catch, no .catch() chains"]
|
|
72
|
+
|
|
73
|
+
**Error Types:**
|
|
74
|
+
- [When to throw: e.g., "invalid input, missing dependencies"]
|
|
75
|
+
- [When to return: e.g., "expected failures return Result<T, E>"]
|
|
76
|
+
- [Logging: e.g., "log error with context before throwing"]
|
|
77
|
+
|
|
78
|
+
## Logging
|
|
79
|
+
|
|
80
|
+
**Framework:**
|
|
81
|
+
- [Tool: e.g., "console.log, pino, winston"]
|
|
82
|
+
- [Levels: e.g., "debug, info, warn, error"]
|
|
83
|
+
|
|
84
|
+
**Patterns:**
|
|
85
|
+
- [Format: e.g., "structured logging with context object"]
|
|
86
|
+
- [When: e.g., "log state transitions, external calls"]
|
|
87
|
+
- [Where: e.g., "log at service boundaries, not in utils"]
|
|
88
|
+
|
|
89
|
+
## Comments
|
|
90
|
+
|
|
91
|
+
**When to Comment:**
|
|
92
|
+
- [e.g., "explain why, not what"]
|
|
93
|
+
- [e.g., "document business logic, algorithms, edge cases"]
|
|
94
|
+
- [e.g., "avoid obvious comments like // increment counter"]
|
|
95
|
+
|
|
96
|
+
**JSDoc/TSDoc:**
|
|
97
|
+
- [Usage: e.g., "required for public APIs, optional for internal"]
|
|
98
|
+
- [Format: e.g., "use @param, @returns, @throws tags"]
|
|
99
|
+
|
|
100
|
+
**TODO Comments:**
|
|
101
|
+
- [Pattern: e.g., "// TODO(username): description"]
|
|
102
|
+
- [Tracking: e.g., "link to issue number if available"]
|
|
103
|
+
|
|
104
|
+
## Function Design
|
|
105
|
+
|
|
106
|
+
**Size:**
|
|
107
|
+
- [e.g., "keep under 50 lines, extract helpers"]
|
|
108
|
+
|
|
109
|
+
**Parameters:**
|
|
110
|
+
- [e.g., "max 3 parameters, use object for more"]
|
|
111
|
+
- [e.g., "destructure objects in parameter list"]
|
|
112
|
+
|
|
113
|
+
**Return Values:**
|
|
114
|
+
- [e.g., "explicit returns, no implicit undefined"]
|
|
115
|
+
- [e.g., "return early for guard clauses"]
|
|
116
|
+
|
|
117
|
+
## Module Design
|
|
118
|
+
|
|
119
|
+
**Exports:**
|
|
120
|
+
- [e.g., "named exports preferred, default exports for React components"]
|
|
121
|
+
- [e.g., "export from index.ts for public API"]
|
|
122
|
+
|
|
123
|
+
**Barrel Files:**
|
|
124
|
+
- [e.g., "use index.ts to re-export public API"]
|
|
125
|
+
- [e.g., "avoid circular dependencies"]
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
*Convention analysis: [date]*
|
|
130
|
+
*Update when patterns change*
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
<good_examples>
|
|
134
|
+
```markdown
|
|
135
|
+
# Coding Conventions
|
|
136
|
+
|
|
137
|
+
**Analysis Date:** 2025-01-20
|
|
138
|
+
|
|
139
|
+
## Naming Patterns
|
|
140
|
+
|
|
141
|
+
**Files:**
|
|
142
|
+
- kebab-case for all files (command-handler.ts, user-service.ts)
|
|
143
|
+
- *.test.ts alongside source files
|
|
144
|
+
- index.ts for barrel exports
|
|
145
|
+
|
|
146
|
+
**Functions:**
|
|
147
|
+
- camelCase for all functions
|
|
148
|
+
- No special prefix for async functions
|
|
149
|
+
- handleEventName for event handlers (handleClick, handleSubmit)
|
|
150
|
+
|
|
151
|
+
**Variables:**
|
|
152
|
+
- camelCase for variables
|
|
153
|
+
- UPPER_SNAKE_CASE for constants (MAX_RETRIES, API_BASE_URL)
|
|
154
|
+
- No underscore prefix (no private marker in TS)
|
|
155
|
+
|
|
156
|
+
**Types:**
|
|
157
|
+
- PascalCase for interfaces, no I prefix (User, not IUser)
|
|
158
|
+
- PascalCase for type aliases (UserConfig, ResponseData)
|
|
159
|
+
- PascalCase for enum names, UPPER_CASE for values (Status.PENDING)
|
|
160
|
+
|
|
161
|
+
## Code Style
|
|
162
|
+
|
|
163
|
+
**Formatting:**
|
|
164
|
+
- Prettier with .prettierrc
|
|
165
|
+
- 100 character line length
|
|
166
|
+
- Single quotes for strings
|
|
167
|
+
- Semicolons required
|
|
168
|
+
- 2 space indentation
|
|
169
|
+
|
|
170
|
+
**Linting:**
|
|
171
|
+
- ESLint with eslint.config.js
|
|
172
|
+
- Extends @typescript-eslint/recommended
|
|
173
|
+
- No console.log in production code (use logger)
|
|
174
|
+
- Run: npm run lint
|
|
175
|
+
|
|
176
|
+
## Import Organization
|
|
177
|
+
|
|
178
|
+
**Order:**
|
|
179
|
+
1. External packages (react, express, commander)
|
|
180
|
+
2. Internal modules (@/lib, @/services)
|
|
181
|
+
3. Relative imports (./utils, ../types)
|
|
182
|
+
4. Type imports (import type { User })
|
|
183
|
+
|
|
184
|
+
**Grouping:**
|
|
185
|
+
- Blank line between groups
|
|
186
|
+
- Alphabetical within each group
|
|
187
|
+
- Type imports last within each group
|
|
188
|
+
|
|
189
|
+
**Path Aliases:**
|
|
190
|
+
- @/ maps to src/
|
|
191
|
+
- No other aliases defined
|
|
192
|
+
|
|
193
|
+
## Error Handling
|
|
194
|
+
|
|
195
|
+
**Patterns:**
|
|
196
|
+
- Throw errors, catch at boundaries (route handlers, main functions)
|
|
197
|
+
- Extend Error class for custom errors (ValidationError, NotFoundError)
|
|
198
|
+
- Async functions use try/catch, no .catch() chains
|
|
199
|
+
|
|
200
|
+
**Error Types:**
|
|
201
|
+
- Throw on invalid input, missing dependencies, invariant violations
|
|
202
|
+
- Log error with context before throwing: logger.error({ err, userId }, 'Failed to process')
|
|
203
|
+
- Include cause in error message: new Error('Failed to X', { cause: originalError })
|
|
204
|
+
|
|
205
|
+
## Logging
|
|
206
|
+
|
|
207
|
+
**Framework:**
|
|
208
|
+
- pino logger instance exported from lib/logger.ts
|
|
209
|
+
- Levels: debug, info, warn, error (no trace)
|
|
210
|
+
|
|
211
|
+
**Patterns:**
|
|
212
|
+
- Structured logging with context: logger.info({ userId, action }, 'User action')
|
|
213
|
+
- Log at service boundaries, not in utility functions
|
|
214
|
+
- Log state transitions, external API calls, errors
|
|
215
|
+
- No console.log in committed code
|
|
216
|
+
|
|
217
|
+
## Comments
|
|
218
|
+
|
|
219
|
+
**When to Comment:**
|
|
220
|
+
- Explain why, not what: // Retry 3 times because API has transient failures
|
|
221
|
+
- Document business rules: // Users must verify email within 24 hours
|
|
222
|
+
- Explain non-obvious algorithms or workarounds
|
|
223
|
+
- Avoid obvious comments: // set count to 0
|
|
224
|
+
|
|
225
|
+
**JSDoc/TSDoc:**
|
|
226
|
+
- Required for public API functions
|
|
227
|
+
- Optional for internal functions if signature is self-explanatory
|
|
228
|
+
- Use @param, @returns, @throws tags
|
|
229
|
+
|
|
230
|
+
**TODO Comments:**
|
|
231
|
+
- Format: // TODO: description (no username, using git blame)
|
|
232
|
+
- Link to issue if exists: // TODO: Fix race condition (issue #123)
|
|
233
|
+
|
|
234
|
+
## Function Design
|
|
235
|
+
|
|
236
|
+
**Size:**
|
|
237
|
+
- Keep under 50 lines
|
|
238
|
+
- Extract helpers for complex logic
|
|
239
|
+
- One level of abstraction per function
|
|
240
|
+
|
|
241
|
+
**Parameters:**
|
|
242
|
+
- Max 3 parameters
|
|
243
|
+
- Use options object for 4+ parameters: function create(options: CreateOptions)
|
|
244
|
+
- Destructure in parameter list: function process({ id, name }: ProcessParams)
|
|
245
|
+
|
|
246
|
+
**Return Values:**
|
|
247
|
+
- Explicit return statements
|
|
248
|
+
- Return early for guard clauses
|
|
249
|
+
- Use Result<T, E> type for expected failures
|
|
250
|
+
|
|
251
|
+
## Module Design
|
|
252
|
+
|
|
253
|
+
**Exports:**
|
|
254
|
+
- Named exports preferred
|
|
255
|
+
- Default exports only for React components
|
|
256
|
+
- Export public API from index.ts barrel files
|
|
257
|
+
|
|
258
|
+
**Barrel Files:**
|
|
259
|
+
- index.ts re-exports public API
|
|
260
|
+
- Keep internal helpers private (don't export from index)
|
|
261
|
+
- Avoid circular dependencies (import from specific files if needed)
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
*Convention analysis: 2025-01-20*
|
|
266
|
+
*Update when patterns change*
|
|
267
|
+
```
|
|
268
|
+
</good_examples>
|
|
269
|
+
|
|
270
|
+
<guidelines>
|
|
271
|
+
**What belongs in CONVENTIONS.md:**
|
|
272
|
+
- Naming patterns observed in the codebase
|
|
273
|
+
- Formatting rules (Prettier config, linting rules)
|
|
274
|
+
- Import organization patterns
|
|
275
|
+
- Error handling strategy
|
|
276
|
+
- Logging approach
|
|
277
|
+
- Comment conventions
|
|
278
|
+
- Function and module design patterns
|
|
279
|
+
|
|
280
|
+
**What does NOT belong here:**
|
|
281
|
+
- Architecture decisions (that's ARCHITECTURE.md)
|
|
282
|
+
- Technology choices (that's STACK.md)
|
|
283
|
+
- Test patterns (that's TESTING.md)
|
|
284
|
+
- File organization (that's STRUCTURE.md)
|
|
285
|
+
|
|
286
|
+
**When filling this template:**
|
|
287
|
+
- Check .prettierrc, .eslintrc, or similar config files
|
|
288
|
+
- Examine 5-10 representative source files for patterns
|
|
289
|
+
- Look for consistency: if 80%+ follows a pattern, document it
|
|
290
|
+
- Be prescriptive: "Use X" not "Sometimes Y is used"
|
|
291
|
+
- Note deviations: "Legacy code uses Y, new code should use X"
|
|
292
|
+
- Keep under ~150 lines total
|
|
293
|
+
|
|
294
|
+
**Useful for phase planning when:**
|
|
295
|
+
- Writing new code (match existing style)
|
|
296
|
+
- Adding features (follow naming patterns)
|
|
297
|
+
- Refactoring (apply consistent conventions)
|
|
298
|
+
- Code review (check against documented patterns)
|
|
299
|
+
- Onboarding (understand style expectations)
|
|
300
|
+
|
|
301
|
+
**Analysis approach:**
|
|
302
|
+
- Scan src/ directory for file naming patterns
|
|
303
|
+
- Check package.json scripts for lint/format commands
|
|
304
|
+
- Read 5-10 files to identify function naming, error handling
|
|
305
|
+
- Look for config files (.prettierrc, eslint.config.js)
|
|
306
|
+
- Note patterns in imports, comments, function signatures
|
|
307
|
+
</guidelines>
|
|
@@ -0,0 +1,280 @@
|
|
|
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
|
+
## APIs & External Services
|
|
17
|
+
|
|
18
|
+
**Payment Processing:**
|
|
19
|
+
- [Service] - [What it's used for: e.g., "subscription billing, one-time payments"]
|
|
20
|
+
- SDK/Client: [e.g., "stripe npm package v14.x"]
|
|
21
|
+
- Auth: [e.g., "API key in STRIPE_SECRET_KEY env var"]
|
|
22
|
+
- Endpoints used: [e.g., "checkout sessions, webhooks"]
|
|
23
|
+
|
|
24
|
+
**Email/SMS:**
|
|
25
|
+
- [Service] - [What it's used for: e.g., "transactional emails"]
|
|
26
|
+
- SDK/Client: [e.g., "sendgrid/mail v8.x"]
|
|
27
|
+
- Auth: [e.g., "API key in SENDGRID_API_KEY env var"]
|
|
28
|
+
- Templates: [e.g., "managed in SendGrid dashboard"]
|
|
29
|
+
|
|
30
|
+
**External APIs:**
|
|
31
|
+
- [Service] - [What it's used for]
|
|
32
|
+
- Integration method: [e.g., "REST API via fetch", "GraphQL client"]
|
|
33
|
+
- Auth: [e.g., "OAuth2 token in AUTH_TOKEN env var"]
|
|
34
|
+
- Rate limits: [if applicable]
|
|
35
|
+
|
|
36
|
+
## Data Storage
|
|
37
|
+
|
|
38
|
+
**Databases:**
|
|
39
|
+
- [Type/Provider] - [e.g., "PostgreSQL on Supabase"]
|
|
40
|
+
- Connection: [e.g., "via DATABASE_URL env var"]
|
|
41
|
+
- Client: [e.g., "Prisma ORM v5.x"]
|
|
42
|
+
- Migrations: [e.g., "prisma migrate in migrations/"]
|
|
43
|
+
|
|
44
|
+
**File Storage:**
|
|
45
|
+
- [Service] - [e.g., "AWS S3 for user uploads"]
|
|
46
|
+
- SDK/Client: [e.g., "@aws-sdk/client-s3"]
|
|
47
|
+
- Auth: [e.g., "IAM credentials in AWS_* env vars"]
|
|
48
|
+
- Buckets: [e.g., "prod-uploads, dev-uploads"]
|
|
49
|
+
|
|
50
|
+
**Caching:**
|
|
51
|
+
- [Service] - [e.g., "Redis for session storage"]
|
|
52
|
+
- Connection: [e.g., "REDIS_URL env var"]
|
|
53
|
+
- Client: [e.g., "ioredis v5.x"]
|
|
54
|
+
|
|
55
|
+
## Authentication & Identity
|
|
56
|
+
|
|
57
|
+
**Auth Provider:**
|
|
58
|
+
- [Service] - [e.g., "Supabase Auth", "Auth0", "custom JWT"]
|
|
59
|
+
- Implementation: [e.g., "Supabase client SDK"]
|
|
60
|
+
- Token storage: [e.g., "httpOnly cookies", "localStorage"]
|
|
61
|
+
- Session management: [e.g., "JWT refresh tokens"]
|
|
62
|
+
|
|
63
|
+
**OAuth Integrations:**
|
|
64
|
+
- [Provider] - [e.g., "Google OAuth for sign-in"]
|
|
65
|
+
- Credentials: [e.g., "GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET"]
|
|
66
|
+
- Scopes: [e.g., "email, profile"]
|
|
67
|
+
|
|
68
|
+
## Monitoring & Observability
|
|
69
|
+
|
|
70
|
+
**Error Tracking:**
|
|
71
|
+
- [Service] - [e.g., "Sentry"]
|
|
72
|
+
- DSN: [e.g., "SENTRY_DSN env var"]
|
|
73
|
+
- Release tracking: [e.g., "via SENTRY_RELEASE"]
|
|
74
|
+
|
|
75
|
+
**Analytics:**
|
|
76
|
+
- [Service] - [e.g., "Mixpanel for product analytics"]
|
|
77
|
+
- Token: [e.g., "MIXPANEL_TOKEN env var"]
|
|
78
|
+
- Events tracked: [e.g., "user actions, page views"]
|
|
79
|
+
|
|
80
|
+
**Logs:**
|
|
81
|
+
- [Service] - [e.g., "CloudWatch", "Datadog", "none (stdout only)"]
|
|
82
|
+
- Integration: [e.g., "AWS Lambda built-in"]
|
|
83
|
+
|
|
84
|
+
## CI/CD & Deployment
|
|
85
|
+
|
|
86
|
+
**Hosting:**
|
|
87
|
+
- [Platform] - [e.g., "Vercel", "AWS Lambda", "Docker on ECS"]
|
|
88
|
+
- Deployment: [e.g., "automatic on main branch push"]
|
|
89
|
+
- Environment vars: [e.g., "configured in Vercel dashboard"]
|
|
90
|
+
|
|
91
|
+
**CI Pipeline:**
|
|
92
|
+
- [Service] - [e.g., "GitHub Actions"]
|
|
93
|
+
- Workflows: [e.g., "test.yml, deploy.yml"]
|
|
94
|
+
- Secrets: [e.g., "stored in GitHub repo secrets"]
|
|
95
|
+
|
|
96
|
+
## Environment Configuration
|
|
97
|
+
|
|
98
|
+
**Development:**
|
|
99
|
+
- Required env vars: [List critical vars]
|
|
100
|
+
- Secrets location: [e.g., ".env.local (gitignored)", "1Password vault"]
|
|
101
|
+
- Mock/stub services: [e.g., "Stripe test mode", "local PostgreSQL"]
|
|
102
|
+
|
|
103
|
+
**Staging:**
|
|
104
|
+
- Environment-specific differences: [e.g., "uses staging Stripe account"]
|
|
105
|
+
- Data: [e.g., "separate staging database"]
|
|
106
|
+
|
|
107
|
+
**Production:**
|
|
108
|
+
- Secrets management: [e.g., "Vercel environment variables"]
|
|
109
|
+
- Failover/redundancy: [e.g., "multi-region DB replication"]
|
|
110
|
+
|
|
111
|
+
## Webhooks & Callbacks
|
|
112
|
+
|
|
113
|
+
**Incoming:**
|
|
114
|
+
- [Service] - [Endpoint: e.g., "/api/webhooks/stripe"]
|
|
115
|
+
- Verification: [e.g., "signature validation via stripe.webhooks.constructEvent"]
|
|
116
|
+
- Events: [e.g., "payment_intent.succeeded, customer.subscription.updated"]
|
|
117
|
+
|
|
118
|
+
**Outgoing:**
|
|
119
|
+
- [Service] - [What triggers it]
|
|
120
|
+
- Endpoint: [e.g., "external CRM webhook on user signup"]
|
|
121
|
+
- Retry logic: [if applicable]
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
*Integration audit: [date]*
|
|
126
|
+
*Update when adding/removing external services*
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
<good_examples>
|
|
130
|
+
```markdown
|
|
131
|
+
# External Integrations
|
|
132
|
+
|
|
133
|
+
**Analysis Date:** 2025-01-20
|
|
134
|
+
|
|
135
|
+
## APIs & External Services
|
|
136
|
+
|
|
137
|
+
**Payment Processing:**
|
|
138
|
+
- Stripe - Subscription billing and one-time course payments
|
|
139
|
+
- SDK/Client: stripe npm package v14.8
|
|
140
|
+
- Auth: API key in STRIPE_SECRET_KEY env var
|
|
141
|
+
- Endpoints used: checkout sessions, customer portal, webhooks
|
|
142
|
+
|
|
143
|
+
**Email/SMS:**
|
|
144
|
+
- SendGrid - Transactional emails (receipts, password resets)
|
|
145
|
+
- SDK/Client: @sendgrid/mail v8.1
|
|
146
|
+
- Auth: API key in SENDGRID_API_KEY env var
|
|
147
|
+
- Templates: Managed in SendGrid dashboard (template IDs in code)
|
|
148
|
+
|
|
149
|
+
**External APIs:**
|
|
150
|
+
- OpenAI API - Course content generation
|
|
151
|
+
- Integration method: REST API via openai npm package v4.x
|
|
152
|
+
- Auth: Bearer token in OPENAI_API_KEY env var
|
|
153
|
+
- Rate limits: 3500 requests/min (tier 3)
|
|
154
|
+
|
|
155
|
+
## Data Storage
|
|
156
|
+
|
|
157
|
+
**Databases:**
|
|
158
|
+
- PostgreSQL on Supabase - Primary data store
|
|
159
|
+
- Connection: via DATABASE_URL env var
|
|
160
|
+
- Client: Prisma ORM v5.8
|
|
161
|
+
- Migrations: prisma migrate in prisma/migrations/
|
|
162
|
+
|
|
163
|
+
**File Storage:**
|
|
164
|
+
- Supabase Storage - User uploads (profile images, course materials)
|
|
165
|
+
- SDK/Client: @supabase/supabase-js v2.x
|
|
166
|
+
- Auth: Service role key in SUPABASE_SERVICE_ROLE_KEY
|
|
167
|
+
- Buckets: avatars (public), course-materials (private)
|
|
168
|
+
|
|
169
|
+
**Caching:**
|
|
170
|
+
- None currently (all database queries, no Redis)
|
|
171
|
+
|
|
172
|
+
## Authentication & Identity
|
|
173
|
+
|
|
174
|
+
**Auth Provider:**
|
|
175
|
+
- Supabase Auth - Email/password + OAuth
|
|
176
|
+
- Implementation: Supabase client SDK with server-side session management
|
|
177
|
+
- Token storage: httpOnly cookies via @supabase/ssr
|
|
178
|
+
- Session management: JWT refresh tokens handled by Supabase
|
|
179
|
+
|
|
180
|
+
**OAuth Integrations:**
|
|
181
|
+
- Google OAuth - Social sign-in
|
|
182
|
+
- Credentials: GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET (Supabase dashboard)
|
|
183
|
+
- Scopes: email, profile
|
|
184
|
+
|
|
185
|
+
## Monitoring & Observability
|
|
186
|
+
|
|
187
|
+
**Error Tracking:**
|
|
188
|
+
- Sentry - Server and client errors
|
|
189
|
+
- DSN: SENTRY_DSN env var
|
|
190
|
+
- Release tracking: Git commit SHA via SENTRY_RELEASE
|
|
191
|
+
|
|
192
|
+
**Analytics:**
|
|
193
|
+
- None (planned: Mixpanel)
|
|
194
|
+
|
|
195
|
+
**Logs:**
|
|
196
|
+
- Vercel logs - stdout/stderr only
|
|
197
|
+
- Retention: 7 days on Pro plan
|
|
198
|
+
|
|
199
|
+
## CI/CD & Deployment
|
|
200
|
+
|
|
201
|
+
**Hosting:**
|
|
202
|
+
- Vercel - Next.js app hosting
|
|
203
|
+
- Deployment: Automatic on main branch push
|
|
204
|
+
- Environment vars: Configured in Vercel dashboard (synced to .env.example)
|
|
205
|
+
|
|
206
|
+
**CI Pipeline:**
|
|
207
|
+
- GitHub Actions - Tests and type checking
|
|
208
|
+
- Workflows: .github/workflows/ci.yml
|
|
209
|
+
- Secrets: None needed (public repo tests only)
|
|
210
|
+
|
|
211
|
+
## Environment Configuration
|
|
212
|
+
|
|
213
|
+
**Development:**
|
|
214
|
+
- Required env vars: DATABASE_URL, NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY
|
|
215
|
+
- Secrets location: .env.local (gitignored), team shared via 1Password vault
|
|
216
|
+
- Mock/stub services: Stripe test mode, Supabase local dev project
|
|
217
|
+
|
|
218
|
+
**Staging:**
|
|
219
|
+
- Uses separate Supabase staging project
|
|
220
|
+
- Stripe test mode
|
|
221
|
+
- Same Vercel account, different environment
|
|
222
|
+
|
|
223
|
+
**Production:**
|
|
224
|
+
- Secrets management: Vercel environment variables
|
|
225
|
+
- Database: Supabase production project with daily backups
|
|
226
|
+
|
|
227
|
+
## Webhooks & Callbacks
|
|
228
|
+
|
|
229
|
+
**Incoming:**
|
|
230
|
+
- Stripe - /api/webhooks/stripe
|
|
231
|
+
- Verification: Signature validation via stripe.webhooks.constructEvent
|
|
232
|
+
- Events: payment_intent.succeeded, customer.subscription.updated, customer.subscription.deleted
|
|
233
|
+
|
|
234
|
+
**Outgoing:**
|
|
235
|
+
- None
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
*Integration audit: 2025-01-20*
|
|
240
|
+
*Update when adding/removing external services*
|
|
241
|
+
```
|
|
242
|
+
</good_examples>
|
|
243
|
+
|
|
244
|
+
<guidelines>
|
|
245
|
+
**What belongs in INTEGRATIONS.md:**
|
|
246
|
+
- External services the code communicates with
|
|
247
|
+
- Authentication patterns (where secrets live, not the secrets themselves)
|
|
248
|
+
- SDKs and client libraries used
|
|
249
|
+
- Environment variable names (not values)
|
|
250
|
+
- Webhook endpoints and verification methods
|
|
251
|
+
- Database connection patterns
|
|
252
|
+
- File storage locations
|
|
253
|
+
- Monitoring and logging services
|
|
254
|
+
|
|
255
|
+
**What does NOT belong here:**
|
|
256
|
+
- Actual API keys or secrets (NEVER write these)
|
|
257
|
+
- Internal architecture (that's ARCHITECTURE.md)
|
|
258
|
+
- Code patterns (that's PATTERNS.md)
|
|
259
|
+
- Technology choices (that's STACK.md)
|
|
260
|
+
- Performance issues (that's CONCERNS.md)
|
|
261
|
+
|
|
262
|
+
**When filling this template:**
|
|
263
|
+
- Check .env.example or .env.template for required env vars
|
|
264
|
+
- Look for SDK imports (stripe, @sendgrid/mail, etc.)
|
|
265
|
+
- Check for webhook handlers in routes/endpoints
|
|
266
|
+
- Note where secrets are managed (not the secrets)
|
|
267
|
+
- Document environment-specific differences (dev/staging/prod)
|
|
268
|
+
- Include auth patterns for each service
|
|
269
|
+
|
|
270
|
+
**Useful for phase planning when:**
|
|
271
|
+
- Adding new external service integrations
|
|
272
|
+
- Debugging authentication issues
|
|
273
|
+
- Understanding data flow outside the application
|
|
274
|
+
- Setting up new environments
|
|
275
|
+
- Auditing third-party dependencies
|
|
276
|
+
- Planning for service outages or migrations
|
|
277
|
+
|
|
278
|
+
**Security note:**
|
|
279
|
+
Document WHERE secrets live (env vars, Vercel dashboard, 1Password), never WHAT the secrets are.
|
|
280
|
+
</guidelines>
|