@brainfish-ai/devdoc 0.1.39 → 0.1.41

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.
@@ -117,7 +117,7 @@ Files: 5 changed
117
117
 
118
118
  **Next steps:**
119
119
  1. **Push changes**: `git push origin main`
120
- 2. **Deploy docs**: `npx @brainfish-ai/devdoc deploy`
120
+ 2. **Deploy docs**: `npm run deploy`
121
121
  3. **Create PR**: If on a feature branch
122
122
 
123
123
  Would you like me to push the changes?"
@@ -159,7 +159,7 @@ Does this location work, or would you prefer somewhere else?"
159
159
  - `docs/guides/{topic}.mdx` - {description}
160
160
  - Updated `docs.json` navigation
161
161
 
162
- Preview with `npx @brainfish-ai/devdoc dev`
162
+ Preview with `npm run dev`
163
163
 
164
164
  Want me to create another page or make changes to this one?"
165
165
 
@@ -178,7 +178,7 @@ If pages were added/removed/moved:
178
178
  - `docs/quickstart.mdx` - Updated to v2.0.0
179
179
  - `docs.json` - Added webhooks page
180
180
 
181
- Changes ready for review. Run `npx @brainfish-ai/devdoc dev` to preview.
181
+ Changes ready for review. Run `npm run dev` to preview.
182
182
 
183
183
  Want me to commit these changes? Use `/commit` when ready."
184
184
 
@@ -1,290 +1,314 @@
1
1
  ---
2
- description: Rules for bootstrapping documentation with user-driven preferences and code memory mapping
2
+ description: Expert documentation bootstrap using Diátaxis framework and audience-driven planning
3
3
  globs: ["**/README.md", "**/package.json", "**/src/**", "**/lib/**"]
4
4
  ---
5
5
 
6
- # Repository Analysis for Documentation
6
+ # Expert Documentation Bootstrap
7
7
 
8
- When asked to bootstrap or generate initial documentation:
8
+ When bootstrapping documentation, follow the **Documentation Planning Pyramid**:
9
9
 
10
- ## Step 1: Check Existing Context & Codebase
10
+ ```
11
+ OVERVIEW → STRATEGY → IA → APPROVAL → CONTENT
12
+ ```
13
+
14
+ ## Phase 1: Strategy (WHY & WHO)
11
15
 
12
- **Detect if codebase exists:**
13
- - Look for: package.json, src/, lib/, app/, *.py, *.ts, *.go
16
+ ### Step 1: Project Overview (Quick Scan)
14
17
 
15
- **If NO codebase:**
16
- - "No codebase detected. Creating docs-only project."
17
- - Skip code-graph, go to Step 2 → Step 6
18
+ **Get a quick understanding using git:**
18
19
 
19
- **If codebase exists, check git:**
20
20
  ```bash
21
- git rev-parse HEAD # Current commit
21
+ git ls-files # List all files
22
+ git ls-files | cut -d'/' -f1 | sort -u # Top-level folders
23
+ git ls-files | grep -E "(README|package\.json|openapi|swagger)" # Key files
24
+ ```
25
+
26
+ **Generate brief summary (<100 words):**
27
+
28
+ ```
29
+ 📁 PROJECT OVERVIEW
30
+
31
+ Name: [from package.json/README]
32
+ Type: [API/Library/CLI/Web App]
33
+ Language: [TypeScript/Python/Go]
34
+ Framework: [Next.js/Express/FastAPI]
35
+
36
+ Structure:
37
+ ├── src/ → Source code
38
+ ├── lib/ → Library
39
+ ├── api/ → API routes
40
+ └── tests/ → Tests
41
+
42
+ Key Files: README.md, package.json, openapi.json
43
+
44
+ Summary: [One sentence describing what this project does]
22
45
  ```
23
46
 
24
- **If `.devdoc/code-graph.json` exists:**
25
- 1. Compare `git.commitHash` vs current HEAD
26
- 2. **Same commit** → "Code graph up to date" → Skip to Step 6
27
- 3. **Different commit** → "{N} files changed"
28
- - Ask: "1. Full rescan 2. Incremental 3. Skip"
47
+ **If NO codebase:** "No codebase detected. Creating docs-only project."
29
48
 
30
- **If `.devdoc/context.json` exists:** Read and use it.
31
- **If missing:** Proceed to ask user preferences first.
49
+ **If `.devdoc/context.json` exists:** Read and use existing preferences.
32
50
 
33
- ## Step 2: Ask User Preferences First
51
+ ### Step 2: Define Goals & Audience
34
52
 
35
- **Don't auto-scan yet. Ask what they want:**
53
+ **Ask strategic questions:**
36
54
 
37
- ### Question 1: Documentation Type
55
+ #### Question 1: Documentation Purpose
38
56
  ```
39
- What type of documentation are you creating?
57
+ What is the primary goal?
40
58
 
41
- 1. API Docs - REST/GraphQL API reference for developers
42
- 2. Product Docs - Feature guides and tutorials for end users
43
- 3. Internal Docs - Team setup, architecture, contribution guides
59
+ 1. **Enable team productivity** - Internal developers
60
+ 2. **Onboard new developers** - New team members
61
+ 3. **Support API consumers** - External developers
62
+ 4. **Guide product users** - End users
63
+ 5. **Inform stakeholders** - Architecture/decisions
44
64
  ```
45
65
 
46
- ### Question 2: API Type (if API Docs)
66
+ #### Question 2: Primary Audience
47
67
  ```
48
- What type of API do you have?
68
+ Who is your PRIMARY audience?
49
69
 
50
- 1. OpenAPI/REST - I have an OpenAPI/Swagger spec
51
- 2. GraphQL - I have a GraphQL schema
52
- 3. Both - REST and GraphQL APIs
53
- 4. Manual - I'll document manually (no spec)
70
+ 1. **Internal Developer** Code flow, architecture, debugging
71
+ 2. **External Developer** Quick start, auth, code examples
72
+ 3. **Product User** Tutorials, feature guides
73
+ 4. **Content Author** MDX syntax, structure
54
74
  ```
55
75
 
56
- ### Question 3: Target Audience
76
+ #### Question 3: Documentation Domain
57
77
  ```
58
- Who is your primary audience?
78
+ 1. **API Docs** - Voice: Professional, code-focused
79
+ 2. **Product Docs** - Voice: Friendly, approachable
80
+ 3. **Internal Docs** - Voice: Technical, direct
59
81
  ```
60
82
 
61
- ### Question 4: Code Examples Language
83
+ #### Question 4: API Type (if API Docs)
62
84
  ```
63
- What language for code examples? (TypeScript, Python, curl, etc.)
85
+ 1. **OpenAPI/REST** - Have spec file
86
+ 2. **GraphQL** - Have schema
87
+ 3. **Both** - REST and GraphQL
88
+ 4. **Manual** - No spec file
64
89
  ```
65
90
 
66
- ## Step 3: Import API Spec (if applicable)
91
+ #### Question 5: Code Examples Language
92
+ ```
93
+ TypeScript, Python, curl, Go, etc.
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Phase 2: Information Architecture (WHAT)
67
99
 
68
- **Ask user for spec path or search:**
100
+ ### Step 3: Import API Specs (if applicable)
69
101
 
70
- OpenAPI: `openapi.json`, `swagger.json`, `**/openapi.*`
71
- GraphQL: `schema.graphql`, `schema.gql`, `**/*.graphql`
102
+ **OpenAPI:** Search for `openapi.json`, `swagger.json`
103
+ **GraphQL:** Search for `schema.graphql`
72
104
 
73
105
  1. Copy spec to `api-reference/`
74
106
  2. Validate format
75
- 3. Extract metadata (endpoints, auth, types)
107
+ 3. Extract metadata
76
108
 
77
- ## Step 4: Build Code Graph (Optional)
109
+ ### Step 4: Plan Content Using Diátaxis Framework
78
110
 
79
- **Skip if:** No codebase, user chose skip, or docs-only project.
111
+ | Type | Purpose | Examples |
112
+ |------|---------|----------|
113
+ | **Tutorial** | Learning-oriented | "Build Your First..." |
114
+ | **How-To** | Task-oriented | "Add Custom Domain" |
115
+ | **Reference** | Information lookup | CLI flags, Config |
116
+ | **Explanation** | Understanding | Architecture, Concepts |
80
117
 
81
- **If scanning, create `.devdoc/code-graph.json`:**
118
+ **Structure by Domain:**
82
119
 
120
+ #### API Docs
83
121
  ```
84
- Scan and map:
85
- ├── README.md → name, description, features
86
- ├── package.json → language, framework, deps
87
- ├── src/
88
- ├── api/ → routes, controllers
89
- │ ├── models/ → data schemas
90
- │ ├── services/ → business logic
91
- │ └── types/ → type definitions
92
- ├── tests/ → code examples
93
- └── examples/ → usage examples
122
+ docs/
123
+ ├── index.mdx # [explanation]
124
+ ├── quickstart.mdx # [tutorial]
125
+ ├── authentication.mdx # [how-to]
126
+ ├── guides/ # [explanation/how-to]
127
+ └── api-reference/ # [reference]
94
128
  ```
95
129
 
96
- **For each module, extract:**
97
- - All public functions with FULL signatures
98
- - Class definitions with methods
99
- - Type/interface definitions
100
- - Exported constants
101
- - Error types and codes
130
+ #### Product Docs
131
+ ```
132
+ docs/
133
+ ├── index.mdx # [explanation]
134
+ ├── getting-started/ # [tutorial]
135
+ ├── features/ # [how-to]
136
+ └── troubleshooting/ # [how-to]
137
+ ```
102
138
 
103
- **Save to `.devdoc/code-graph.json`:**
104
- ```json
105
- {
106
- "$schema": "https://devdoc.sh/schemas/code-graph.json",
107
- "version": "1.0",
108
- "generatedAt": "[timestamp]",
109
- "git": {
110
- "commitHash": "[full 40-char hash]",
111
- "commitShort": "[7-char hash]",
112
- "branch": "[branch name]",
113
- "isDirty": false
114
- },
115
- "project": {
116
- "name": "[name]",
117
- "language": "[lang]",
118
- "framework": "[framework]",
119
- "rootDir": "src/"
120
- },
121
- "modules": [
122
- {
123
- "name": "auth",
124
- "path": "src/auth/",
125
- "description": "Authentication",
126
- "exports": [
127
- {
128
- "name": "login",
129
- "type": "function",
130
- "signature": "login(email: string, password: string): Promise<AuthToken>",
131
- "params": [
132
- { "name": "email", "type": "string" },
133
- { "name": "password", "type": "string" }
134
- ],
135
- "returns": { "type": "Promise<AuthToken>" },
136
- "async": true
137
- }
138
- ],
139
- "docPriority": "high"
140
- }
141
- ],
142
- "types": [
143
- {
144
- "name": "AuthToken",
145
- "path": "src/types/auth.ts",
146
- "kind": "interface",
147
- "definition": "interface AuthToken { token: string; expiresAt: Date; }"
148
- }
149
- ],
150
- "examples": [
151
- { "path": "examples/basic.ts", "description": "Basic usage", "tags": ["auth"] }
152
- ],
153
- "errors": [
154
- { "name": "AuthError", "code": "AUTH_FAILED", "message": "Invalid credentials" }
155
- ]
156
- }
139
+ #### Internal Docs
140
+ ```
141
+ docs/
142
+ ├── index.mdx # [explanation]
143
+ ├── getting-started/ # [how-to]
144
+ ├── architecture/ # [explanation]
145
+ ├── development/ # [how-to]
146
+ └── contributing.mdx # [how-to]
157
147
  ```
158
148
 
159
- ## Step 5: Save Context
149
+ ---
160
150
 
161
- Create `.devdoc/context.json`:
162
- ```json
163
- {
164
- "preferences": {
165
- "docType": "[api/product/internal]",
166
- "apiType": "[openapi/graphql/both/manual]",
167
- "audience": "[target audience]",
168
- "codeLanguage": "[language]"
169
- },
170
- "product": {
171
- "name": "[name]",
172
- "description": "[desc]"
173
- },
174
- "api": {
175
- "style": "[REST/GraphQL]",
176
- "specPath": "[path if imported]"
177
- }
178
- }
179
- ```
151
+ ## Phase 3: Approval (REQUIRED)
180
152
 
181
- ## Step 6: Plan Structure Based on Preferences
153
+ ### Step 5: Present IA for User Approval
154
+
155
+ **IMPORTANT: Always get user approval before generating.**
182
156
 
183
- ### API Docs
184
157
  ```
158
+ 📋 PROPOSED DOCUMENTATION ARCHITECTURE
159
+
160
+ Based on your preferences:
161
+ - Goal: [selected goal]
162
+ - Audience: [primary audience]
163
+ - Domain: [api/product/internal]
164
+
165
+ ═══════════════════════════════════════════════════
166
+ NAVIGATION STRUCTURE
167
+ ═══════════════════════════════════════════════════
168
+
169
+ 📑 TAB: Guides
170
+ ├── 📁 Getting Started
171
+ │ ├── Introduction # index.mdx [explanation]
172
+ │ ├── Quickstart # quickstart.mdx [tutorial]
173
+ │ └── Authentication # authentication.mdx [how-to]
174
+ └── 📁 Core Concepts
175
+ └── Overview # guides/overview.mdx [explanation]
176
+
177
+ 📑 TAB: API Reference (OpenAPI)
178
+ └── [Auto-generated from openapi.json]
179
+
180
+ ═══════════════════════════════════════════════════
181
+ FILE STRUCTURE
182
+ ═══════════════════════════════════════════════════
183
+
185
184
  docs/
186
185
  ├── index.mdx
187
186
  ├── quickstart.mdx
188
187
  ├── authentication.mdx
189
- ├── guides/
190
- ├── api-reference/
191
- │ ├── openapi.json (or schema.graphql)
192
- │ └── introduction.mdx
193
- └── sdks/
194
- ```
188
+ └── api-reference/openapi.json
195
189
 
196
- ### Product Docs
197
- ```
198
- docs/
199
- ├── index.mdx
200
- ├── getting-started/
201
- ├── features/
202
- ├── tutorials/
203
- └── troubleshooting/
204
- ```
190
+ ═══════════════════════════════════════════════════
191
+ CONTENT SUMMARY
192
+ ═══════════════════════════════════════════════════
205
193
 
206
- ### Internal Docs
207
- ```
208
- docs/
209
- ├── index.mdx
210
- ├── getting-started/
211
- ├── architecture/
212
- ├── development/
213
- └── contributing.mdx
214
- ```
194
+ 📚 Tutorials: 1 page
195
+ 📝 How-To Guides: 1 page
196
+ 💡 Explanations: 2 pages
197
+
198
+ Total: 4 pages
199
+
200
+ ═══════════════════════════════════════════════════
201
+ GAPS ANALYSIS
202
+ ═══════════════════════════════════════════════════
215
203
 
216
- ## Step 7: Generate Documentation
204
+ ⚠️ No troubleshooting guide
205
+ ⚠️ No changelog
217
206
 
218
- **Use code graph for accuracy:**
207
+ ───────────────────────────────────────────────────
208
+
209
+ Does this look complete?
210
+
211
+ 1. ✅ **Approve** - Generate with this structure
212
+ 2. ✏️ **Modify** - Change pages/navigation
213
+ 3. ➕ **Add suggested** - Add missing docs
214
+ 4. ❌ **Restart** - Reconsider goals
215
+ ```
216
+
217
+ ---
219
218
 
220
- 1. Read `.devdoc/code-graph.json` before each page
221
- 2. Use EXACT function signatures from exports
222
- 3. Reference types from types array
223
- 4. Extract examples from examples array
224
- 5. Document errors from errors array
225
- 6. Add TODO markers for uncertain sections
219
+ ## Phase 4: Content (HOW)
226
220
 
227
- ## Step 8: Update docs.json
221
+ ### Step 6: Save Context (After Approval)
228
222
 
229
- **OpenAPI:**
223
+ Create `.devdoc/context.json`:
230
224
  ```json
231
225
  {
232
- "docType": "api",
233
- "navigation": {
234
- "tabs": [
235
- { "tab": "Guides", "groups": [...] },
236
- { "tab": "API Reference", "type": "openapi", "spec": "api-reference/openapi.json" }
226
+ "strategy": {
227
+ "goal": "[goal]",
228
+ "audience": { "primary": "[type]", "needs": [...] }
229
+ },
230
+ "preferences": {
231
+ "docType": "[api/product/internal]",
232
+ "codeLanguage": "[language]"
233
+ },
234
+ "contentPlan": {
235
+ "approved": true,
236
+ "pages": [
237
+ { "path": "index.mdx", "type": "explanation" },
238
+ { "path": "quickstart.mdx", "type": "tutorial" }
237
239
  ]
238
240
  }
239
241
  }
240
242
  ```
241
243
 
242
- **GraphQL:**
244
+ ### Step 7: Generate Using Writing Guidelines
245
+
246
+ **Only after user approval in Step 5.**
247
+
248
+ **Expert Writing Standards:**
249
+ 1. **Second Person** - "You can configure..."
250
+ 2. **Active Voice** - "Run the command"
251
+ 3. **Task-Oriented Headings** - "How to add..."
252
+ 4. **Include Examples** - Every concept
253
+ 5. **Progressive Disclosure** - Basic → Advanced
254
+
255
+ ### Step 8: Update docs.json
256
+
243
257
  ```json
244
258
  {
259
+ "docType": "api",
245
260
  "navigation": {
246
261
  "tabs": [
247
262
  { "tab": "Guides", "groups": [...] },
248
- { "tab": "GraphQL API", "type": "graphql", "schema": "api-reference/schema.graphql" }
263
+ { "tab": "API Reference", "type": "openapi", "spec": "api-reference/openapi.json" }
249
264
  ]
250
265
  }
251
266
  }
252
267
  ```
253
268
 
254
- ## Step 9: Summary
269
+ ### Step 9: Summary
255
270
 
256
271
  ```
257
272
  ✅ Documentation Generated!
258
273
 
259
- Preferences:
260
- - Type: API Documentation
261
- - API: OpenAPI/REST
274
+ Strategy:
275
+ - Goal: [goal]
262
276
  - Audience: [audience]
263
- - Code: [language]
277
+ - Domain: [domain]
278
+
279
+ Content (Diátaxis):
280
+ - Tutorials: X pages
281
+ - How-To: X pages
282
+ - Reference: X pages
283
+ - Explanations: X pages
264
284
 
265
285
  Files created:
266
- - .devdoc/context.json (preferences)
267
- - .devdoc/code-graph.json (code analysis)
286
+ - .devdoc/context.json
268
287
  - docs.json
269
- - [list of mdx files]
288
+ - [mdx files]
270
289
 
271
- Next: Run `devdoc dev` to preview, then "whisk theme" for branding.
290
+ Next: `devdoc dev` to preview
272
291
  ```
273
292
 
293
+ ---
294
+
274
295
  ## Key Principles
275
296
 
276
297
  | Principle | Description |
277
298
  |-----------|-------------|
278
- | Ask first | Get user preferences before scanning |
279
- | Build code graph | Scan entire codebase with full signatures |
280
- | Store the graph | Save to code-graph.json for updates |
281
- | Real code only | Use exact signatures, never fabricate |
282
- | Mark unknowns | Add TODO for sections needing review |
283
-
284
- ## Code Graph Benefits
285
-
286
- - **Accurate docs** - Exact function signatures
287
- - **Complete coverage** - All exports documented
288
- - **Easy updates** - Re-scan refreshes the graph
289
- - **No hallucination** - Only document real code
290
- - **Type safety** - Reference actual type definitions
299
+ | **Project overview first** | Quick git scan to understand structure |
300
+ | **Strategy first** | Goals and audience before structure |
301
+ | **Audience-driven** | Match content to user needs |
302
+ | **Diátaxis types** | Classify every page |
303
+ | **IA approval required** | User confirms before generating |
304
+ | **Expert writing** | 2nd person, active voice |
305
+ | **Mark unknowns** | Add TODO for review |
306
+
307
+ ## Quality Checklist
308
+
309
+ - [ ] Title is clear
310
+ - [ ] Intro explains "why"
311
+ - [ ] Content type matches purpose
312
+ - [ ] Code examples included
313
+ - [ ] Links to related docs
314
+ - [ ] Progressive disclosure
@@ -83,7 +83,7 @@ Branch: `main`
83
83
 
84
84
  Next steps:
85
85
  1. Push: `git push`
86
- 2. Deploy: `npx @brainfish-ai/devdoc deploy`
86
+ 2. Deploy: `npm run deploy`
87
87
 
88
88
  Push changes?"
89
89