@brainfish-ai/devdoc 0.1.32 → 0.1.34

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 (35) hide show
  1. package/ai-agents/.claude/skills/blame-doc/SKILL.md +171 -0
  2. package/ai-agents/.claude/skills/bootstrap-docs/SKILL.md +519 -64
  3. package/ai-agents/.claude/skills/check-docs/SKILL.md +107 -12
  4. package/ai-agents/.claude/skills/commit-doc/SKILL.md +214 -0
  5. package/ai-agents/.claude/skills/create-doc/SKILL.md +198 -0
  6. package/ai-agents/.claude/skills/delete-doc/SKILL.md +164 -0
  7. package/ai-agents/.claude/skills/update-doc/SKILL.md +219 -0
  8. package/ai-agents/.cursor/rules/devdoc-blame.mdc +114 -0
  9. package/ai-agents/.cursor/rules/devdoc-bootstrap.mdc +207 -41
  10. package/ai-agents/.cursor/rules/devdoc-commit.mdc +103 -0
  11. package/ai-agents/.cursor/rules/devdoc-create.mdc +89 -0
  12. package/ai-agents/.cursor/rules/devdoc-delete.mdc +101 -0
  13. package/ai-agents/.cursor/rules/devdoc-update.mdc +95 -0
  14. package/ai-agents/.devdoc/context.json +66 -0
  15. package/ai-agents/.devdoc/templates/api-reference.md +211 -0
  16. package/ai-agents/.devdoc/templates/guide.md +133 -0
  17. package/ai-agents/.devdoc/templates/quickstart.md +179 -0
  18. package/ai-agents/.devdoc/templates/troubleshooting.md +215 -0
  19. package/ai-agents/.devdoc/templates/tutorial.md +212 -0
  20. package/ai-agents/CLAUDE.md +15 -3
  21. package/ai-agents/schemas/context.schema.json +259 -0
  22. package/dist/cli/commands/ai.d.ts +1 -0
  23. package/dist/cli/commands/ai.js +115 -46
  24. package/dist/cli/commands/create.d.ts +12 -0
  25. package/dist/cli/commands/create.js +110 -62
  26. package/dist/cli/commands/init.js +11 -7
  27. package/dist/cli/index.js +4 -2
  28. package/package.json +1 -1
  29. package/renderer/components/docs-viewer/sidebar/index.tsx +118 -87
  30. package/ai-agents/.claude/skills/create-doc-page/SKILL.md +0 -57
  31. package/ai-agents/.claude/skills/docs-from-code/SKILL.md +0 -73
  32. package/ai-agents/.claude/skills/generate-api-docs/SKILL.md +0 -94
  33. package/ai-agents/.claude/skills/sync-docs/SKILL.md +0 -112
  34. package/ai-agents/.claude/skills/update-docs-json/SKILL.md +0 -60
  35. package/ai-agents/.cursor/rules/devdoc-sync.mdc +0 -70
@@ -0,0 +1,215 @@
1
+ # Troubleshooting Template
2
+
3
+ Use this structure for troubleshooting and FAQ documentation.
4
+
5
+ ## Format
6
+
7
+ ```mdx
8
+ ---
9
+ title: Troubleshooting [Topic]
10
+ description: Solutions for common [Topic] issues
11
+ ---
12
+
13
+ ## Decision Tree
14
+
15
+ Use this to find your issue:
16
+
17
+ ```mermaid
18
+ flowchart TD
19
+ A[Having Issues?] --> B{Can you install?}
20
+ B -->|No| C[Installation Issues]
21
+ B -->|Yes| D{Can you authenticate?}
22
+ D -->|No| E[Auth Issues]
23
+ D -->|Yes| F{Getting errors?}
24
+ F -->|Yes| G[Error Reference]
25
+ F -->|No| H[Performance Issues]
26
+
27
+ click C "#installation-issues"
28
+ click E "#authentication-issues"
29
+ click G "#error-reference"
30
+ click H "#performance-issues"
31
+ ```
32
+
33
+ ## Common Issues
34
+
35
+ ### Error: [Exact error message]
36
+
37
+ <Accordion title="[Short description of the error]">
38
+ **Symptoms:**
39
+ - What the user sees
40
+ - When it typically occurs
41
+
42
+ **Cause:**
43
+ Brief explanation of why this happens.
44
+
45
+ **Solution:**
46
+
47
+ <Steps>
48
+ <Step title="Check [first thing]">
49
+ ```bash
50
+ command to diagnose
51
+ ```
52
+ </Step>
53
+ <Step title="Fix [the issue]">
54
+ ```bash
55
+ command to fix
56
+ ```
57
+ </Step>
58
+ </Steps>
59
+
60
+ **Prevention:**
61
+ How to avoid this in the future.
62
+ </Accordion>
63
+
64
+ ### [Another common issue]
65
+
66
+ <Accordion title="[Description]">
67
+ **Symptoms:**
68
+ - Symptom 1
69
+ - Symptom 2
70
+
71
+ **Cause:**
72
+ Explanation.
73
+
74
+ **Solution:**
75
+ Step-by-step fix.
76
+ </Accordion>
77
+
78
+ ## Error Flow Reference
79
+
80
+ ```mermaid
81
+ flowchart LR
82
+ subgraph "400 Errors"
83
+ A[400 Bad Request]
84
+ B[401 Unauthorized]
85
+ C[403 Forbidden]
86
+ D[404 Not Found]
87
+ E[429 Rate Limited]
88
+ end
89
+ subgraph "500 Errors"
90
+ F[500 Server Error]
91
+ G[502 Bad Gateway]
92
+ H[503 Unavailable]
93
+ end
94
+ ```
95
+
96
+ ## Diagnostic Commands
97
+
98
+ Useful commands for debugging:
99
+
100
+ ```bash
101
+ # Check version
102
+ package-name --version
103
+
104
+ # Verify configuration
105
+ package-name config validate
106
+
107
+ # Test connection
108
+ package-name ping
109
+
110
+ # Debug mode
111
+ DEBUG=* package-name command
112
+ ```
113
+
114
+ ## Connection Troubleshooting
115
+
116
+ ```mermaid
117
+ sequenceDiagram
118
+ participant You
119
+ participant CLI
120
+ participant API
121
+
122
+ You->>CLI: Run command
123
+ CLI->>API: Connect
124
+
125
+ alt Success
126
+ API-->>CLI: 200 OK
127
+ CLI-->>You: ✓ Connected
128
+ else Timeout
129
+ API--xCLI: Timeout
130
+ CLI-->>You: ✗ Connection timeout
131
+ Note over You,CLI: Check network/firewall
132
+ else Auth Error
133
+ API-->>CLI: 401 Unauthorized
134
+ CLI-->>You: ✗ Invalid API key
135
+ Note over You,CLI: Regenerate API key
136
+ end
137
+ ```
138
+
139
+ ## Getting Help
140
+
141
+ If you're still experiencing issues:
142
+
143
+ 1. **Search existing issues:** [GitHub Issues](https://github.com/org/repo/issues)
144
+ 2. **Community support:** [Discord](https://discord.gg/example)
145
+ 3. **Contact support:** [support@example.com](mailto:support@example.com)
146
+
147
+ When reporting an issue, include:
148
+ - Error message (full stack trace)
149
+ - Package version (`package-name --version`)
150
+ - Environment (OS, Node version, etc.)
151
+ - Steps to reproduce
152
+ ```
153
+
154
+ ## Mermaid Diagram Guidelines
155
+
156
+ ### Decision Trees
157
+
158
+ Help users find their issue:
159
+
160
+ ```mermaid
161
+ flowchart TD
162
+ A{What's happening?}
163
+ A -->|Can't install| B[Check Node version >= 18]
164
+ A -->|Can't connect| C[Check API key]
165
+ A -->|Slow performance| D[Check rate limits]
166
+ A -->|Unexpected results| E[Check request params]
167
+
168
+ B --> B1[npm cache clean]
169
+ C --> C1[Regenerate key]
170
+ D --> D1[Implement caching]
171
+ E --> E1[Enable debug mode]
172
+ ```
173
+
174
+ ### Error Code Reference
175
+
176
+ ```mermaid
177
+ flowchart LR
178
+ subgraph Client["Client Errors (4xx)"]
179
+ A[400] --> A1[Bad Request]
180
+ B[401] --> B1[Unauthorized]
181
+ C[403] --> C1[Forbidden]
182
+ D[404] --> D1[Not Found]
183
+ E[429] --> E1[Rate Limited]
184
+ end
185
+ subgraph Server["Server Errors (5xx)"]
186
+ F[500] --> F1[Server Error]
187
+ G[502] --> G1[Bad Gateway]
188
+ H[503] --> H1[Unavailable]
189
+ end
190
+ ```
191
+
192
+ ### Retry Logic
193
+
194
+ ```mermaid
195
+ flowchart TD
196
+ A[Request] --> B{Success?}
197
+ B -->|Yes| C[Done]
198
+ B -->|No| D{Retryable?}
199
+ D -->|No| E[Fail]
200
+ D -->|Yes| F{Retries < 3?}
201
+ F -->|No| E
202
+ F -->|Yes| G[Wait with backoff]
203
+ G --> A
204
+ ```
205
+
206
+ ## Guidelines
207
+
208
+ - Use exact error messages as headings (searchable)
209
+ - Provide copy-paste solutions
210
+ - Include diagnostic commands
211
+ - Explain the "why" not just the "how"
212
+ - Link to support channels
213
+ - **Use decision trees** to guide users to solutions
214
+ - **Use sequence diagrams** for debugging flows
215
+ - **Use flowcharts** for retry/error handling logic
@@ -0,0 +1,212 @@
1
+ # Tutorial Template
2
+
3
+ Use this structure when creating step-by-step tutorials.
4
+
5
+ ## Format
6
+
7
+ ```mdx
8
+ ---
9
+ title: Build [Something] with [Technology]
10
+ description: A complete tutorial to [achieve outcome] from scratch
11
+ ---
12
+
13
+ ## What You'll Build
14
+
15
+ [Screenshot or diagram of the final result]
16
+
17
+ Brief description of the end result and why it's useful.
18
+
19
+ **Time to complete:** ~X minutes
20
+
21
+ ## Architecture Overview
22
+
23
+ Show the system architecture with a mermaid diagram:
24
+
25
+ ```mermaid
26
+ flowchart TB
27
+ subgraph Frontend
28
+ A[React App]
29
+ end
30
+ subgraph Backend
31
+ B[API Server]
32
+ C[Database]
33
+ end
34
+ A -->|REST API| B
35
+ B --> C
36
+ ```
37
+
38
+ ## Prerequisites
39
+
40
+ - [Prerequisite 1 with link]
41
+ - [Prerequisite 2 with link]
42
+ - Basic knowledge of [topic]
43
+
44
+ ## Project Setup
45
+
46
+ <Steps>
47
+ <Step title="Create a new project">
48
+ ```bash
49
+ mkdir my-project && cd my-project
50
+ npm init -y
51
+ ```
52
+ </Step>
53
+
54
+ <Step title="Install dependencies">
55
+ ```bash
56
+ npm install package-name
57
+ ```
58
+ </Step>
59
+ </Steps>
60
+
61
+ ## Part 1: [First Major Section]
62
+
63
+ ### Step 1.1: [Specific Task]
64
+
65
+ Explanation of what we're doing and why.
66
+
67
+ ```language
68
+ // Code with comments explaining key parts
69
+ ```
70
+
71
+ <Tip>
72
+ Pro tip or best practice related to this step.
73
+ </Tip>
74
+
75
+ ### Step 1.2: [Next Task]
76
+
77
+ Continue building on the previous step.
78
+
79
+ ## Part 2: [Second Major Section]
80
+
81
+ ### Data Flow
82
+
83
+ Visualize the data flow:
84
+
85
+ ```mermaid
86
+ sequenceDiagram
87
+ participant User
88
+ participant Frontend
89
+ participant API
90
+ participant DB
91
+
92
+ User->>Frontend: Click button
93
+ Frontend->>API: POST /action
94
+ API->>DB: Query
95
+ DB-->>API: Result
96
+ API-->>Frontend: Response
97
+ Frontend-->>User: Update UI
98
+ ```
99
+
100
+ ### Step 2.1: [Task]
101
+
102
+ Break complex tutorials into logical parts.
103
+
104
+ ## Testing Your Implementation
105
+
106
+ How to verify everything works:
107
+
108
+ ```bash
109
+ npm test
110
+ # or
111
+ npm run dev
112
+ ```
113
+
114
+ Expected output:
115
+ ```
116
+ ✓ All tests passed
117
+ ```
118
+
119
+ ## Troubleshooting
120
+
121
+ <Accordion title="Error: [Common error message]">
122
+ **Cause:** Explanation of why this happens.
123
+
124
+ **Solution:** How to fix it.
125
+ </Accordion>
126
+
127
+ ## Next Steps
128
+
129
+ Now that you've built [X], you can:
130
+
131
+ - [Enhancement 1]
132
+ - [Enhancement 2]
133
+ - [Related tutorial link]
134
+
135
+ ## Complete Code
136
+
137
+ <Accordion title="View complete source code">
138
+ ```language
139
+ // Full working code
140
+ ```
141
+ </Accordion>
142
+ ```
143
+
144
+ ## Mermaid Diagram Guidelines
145
+
146
+ ### Architecture Diagrams
147
+
148
+ Use subgraphs to group related components:
149
+
150
+ ```mermaid
151
+ flowchart TB
152
+ subgraph Client["Client Layer"]
153
+ A[Web App]
154
+ B[Mobile App]
155
+ end
156
+ subgraph Services["Service Layer"]
157
+ C[Auth Service]
158
+ D[API Gateway]
159
+ end
160
+ subgraph Data["Data Layer"]
161
+ E[(Database)]
162
+ F[(Cache)]
163
+ end
164
+ A --> D
165
+ B --> D
166
+ D --> C
167
+ D --> E
168
+ D --> F
169
+ ```
170
+
171
+ ### Process Flow
172
+
173
+ Show the build/deploy process:
174
+
175
+ ```mermaid
176
+ flowchart LR
177
+ A[Code] --> B[Build]
178
+ B --> C[Test]
179
+ C --> D{Pass?}
180
+ D -->|Yes| E[Deploy]
181
+ D -->|No| F[Fix]
182
+ F --> B
183
+ ```
184
+
185
+ ### Class/Component Diagram
186
+
187
+ ```mermaid
188
+ classDiagram
189
+ class User {
190
+ +String id
191
+ +String email
192
+ +create()
193
+ +update()
194
+ }
195
+ class Order {
196
+ +String id
197
+ +String userId
198
+ +submit()
199
+ }
200
+ User "1" --> "*" Order
201
+ ```
202
+
203
+ ## Guidelines
204
+
205
+ - Show the end result first to motivate readers
206
+ - Break into digestible parts (10-15 min each)
207
+ - Include checkpoints where readers can verify progress
208
+ - Provide complete code at the end for reference
209
+ - Add troubleshooting for common issues
210
+ - **Use architecture diagrams** at the start
211
+ - **Use sequence diagrams** for API interactions
212
+ - **Use flowcharts** for decision logic
@@ -2,6 +2,15 @@
2
2
 
3
3
  This is a DevDoc documentation project using MDX (Markdown + React components).
4
4
 
5
+ ## Source Code Location
6
+
7
+ If this docs folder is inside a larger repository, the source code is in the parent directory:
8
+ - Source code: `../src/` or `../lib/`
9
+ - Package config: `../package.json`
10
+ - README: `../README.md`
11
+
12
+ When generating documentation, always check the parent directory (`../`) for source code to document.
13
+
5
14
  ## Project Structure
6
15
 
7
16
  ```
@@ -188,7 +197,10 @@ If you have Claude Code skills installed (`devdoc ai`):
188
197
 
189
198
  - `/bootstrap-docs` - Generate documentation from codebase
190
199
  - `/migrate-docs` - Migrate from other platforms
191
- - `/sync-docs` - Update outdated documentation
200
+ - `/import-api-spec` - Import OpenAPI, GraphQL, or AsyncAPI specs
192
201
  - `/check-docs` - Health check for docs
193
- - `/create-doc-page` - Create new MDX page
194
- - `/update-docs-json` - Update navigation
202
+ - `/blame-doc` - Find duplicates, outdated content, discrepancies
203
+ - `/create-doc` - Create new documentation page
204
+ - `/update-doc` - Update existing documentation
205
+ - `/delete-doc` - Delete documentation pages
206
+ - `/commit-doc` - Commit documentation changes
@@ -0,0 +1,259 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://devdoc.sh/schemas/context.json",
4
+ "title": "DevDoc Context Memory",
5
+ "description": "AI agent context memory for understanding and documenting products consistently",
6
+ "type": "object",
7
+ "properties": {
8
+ "$schema": {
9
+ "type": "string",
10
+ "description": "JSON Schema reference"
11
+ },
12
+ "version": {
13
+ "type": "string",
14
+ "description": "Schema version",
15
+ "default": "1.0"
16
+ },
17
+ "lastUpdated": {
18
+ "type": ["string", "null"],
19
+ "format": "date-time",
20
+ "description": "ISO 8601 timestamp of last update"
21
+ },
22
+ "product": {
23
+ "type": "object",
24
+ "description": "Core product information",
25
+ "properties": {
26
+ "name": {
27
+ "type": "string",
28
+ "description": "Product or company name"
29
+ },
30
+ "description": {
31
+ "type": "string",
32
+ "description": "Brief description of what the product does"
33
+ },
34
+ "type": {
35
+ "type": "string",
36
+ "enum": ["api", "sdk", "platform", "cli", "library", "saas", "other"],
37
+ "description": "Type of product being documented"
38
+ },
39
+ "domain": {
40
+ "type": "string",
41
+ "description": "Industry or domain (e.g., fintech, healthcare, devtools)"
42
+ },
43
+ "targetAudience": {
44
+ "type": "string",
45
+ "description": "Primary audience for the documentation"
46
+ },
47
+ "keyFeatures": {
48
+ "type": "array",
49
+ "items": { "type": "string" },
50
+ "description": "Main features or capabilities"
51
+ }
52
+ }
53
+ },
54
+ "terminology": {
55
+ "type": "object",
56
+ "description": "Product-specific terminology and language rules",
57
+ "properties": {
58
+ "glossary": {
59
+ "type": "object",
60
+ "additionalProperties": { "type": "string" },
61
+ "description": "Term definitions (key: term, value: definition)"
62
+ },
63
+ "avoidTerms": {
64
+ "type": "array",
65
+ "items": {
66
+ "type": "object",
67
+ "properties": {
68
+ "wrong": { "type": "string" },
69
+ "correct": { "type": "string" },
70
+ "reason": { "type": "string" }
71
+ },
72
+ "required": ["wrong", "correct"]
73
+ },
74
+ "description": "Terms to avoid and their correct alternatives"
75
+ },
76
+ "brandNames": {
77
+ "type": "object",
78
+ "additionalProperties": { "type": "string" },
79
+ "description": "Correct capitalization/spelling of brand names"
80
+ }
81
+ }
82
+ },
83
+ "api": {
84
+ "type": "object",
85
+ "description": "API-specific information (if applicable)",
86
+ "properties": {
87
+ "style": {
88
+ "type": "string",
89
+ "enum": ["REST", "GraphQL", "gRPC", "WebSocket", "mixed"],
90
+ "description": "API architecture style"
91
+ },
92
+ "baseUrl": {
93
+ "type": "string",
94
+ "description": "Base URL for API requests"
95
+ },
96
+ "authentication": {
97
+ "type": "object",
98
+ "properties": {
99
+ "type": {
100
+ "type": "string",
101
+ "enum": ["api_key", "oauth2", "jwt", "basic", "bearer", "custom"],
102
+ "description": "Authentication method"
103
+ },
104
+ "headerName": {
105
+ "type": "string",
106
+ "description": "Header name for auth (if applicable)"
107
+ },
108
+ "description": {
109
+ "type": "string",
110
+ "description": "How to obtain/use credentials"
111
+ }
112
+ }
113
+ },
114
+ "conventions": {
115
+ "type": "object",
116
+ "properties": {
117
+ "pagination": { "type": "string" },
118
+ "errorFormat": { "type": "string" },
119
+ "dateFormat": { "type": "string" },
120
+ "idFormat": { "type": "string" }
121
+ },
122
+ "description": "API conventions and patterns"
123
+ },
124
+ "commonPatterns": {
125
+ "type": "array",
126
+ "items": { "type": "string" },
127
+ "description": "Common patterns used across the API"
128
+ }
129
+ }
130
+ },
131
+ "codebase": {
132
+ "type": "object",
133
+ "description": "Source code information",
134
+ "properties": {
135
+ "language": {
136
+ "type": "string",
137
+ "description": "Primary programming language"
138
+ },
139
+ "framework": {
140
+ "type": "string",
141
+ "description": "Main framework used"
142
+ },
143
+ "sourceLocation": {
144
+ "type": "string",
145
+ "description": "Relative path to source code from docs folder"
146
+ },
147
+ "keyDirectories": {
148
+ "type": "object",
149
+ "additionalProperties": { "type": "string" },
150
+ "description": "Important directories in the codebase"
151
+ },
152
+ "namingConventions": {
153
+ "type": "object",
154
+ "properties": {
155
+ "files": { "type": "string" },
156
+ "functions": { "type": "string" },
157
+ "classes": { "type": "string" },
158
+ "variables": { "type": "string" }
159
+ },
160
+ "description": "Code naming conventions"
161
+ }
162
+ }
163
+ },
164
+ "documentation": {
165
+ "type": "object",
166
+ "description": "Documentation style and conventions",
167
+ "properties": {
168
+ "voice": {
169
+ "type": "string",
170
+ "description": "Writing voice (e.g., professional, friendly, technical)"
171
+ },
172
+ "perspective": {
173
+ "type": "string",
174
+ "enum": ["first_person", "second_person", "third_person"],
175
+ "description": "Writing perspective"
176
+ },
177
+ "codeExamples": {
178
+ "type": "object",
179
+ "properties": {
180
+ "primaryLanguage": {
181
+ "type": "string",
182
+ "description": "Default language for code examples"
183
+ },
184
+ "additionalLanguages": {
185
+ "type": "array",
186
+ "items": { "type": "string" },
187
+ "description": "Other languages to include"
188
+ },
189
+ "style": {
190
+ "type": "string",
191
+ "description": "Code example style (e.g., complete, minimal)"
192
+ }
193
+ }
194
+ },
195
+ "templates": {
196
+ "type": "object",
197
+ "properties": {
198
+ "guide": {
199
+ "type": "string",
200
+ "description": "Path to guide template file"
201
+ },
202
+ "apiReference": {
203
+ "type": "string",
204
+ "description": "Path to API reference template file"
205
+ },
206
+ "tutorial": {
207
+ "type": "string",
208
+ "description": "Path to tutorial template file"
209
+ },
210
+ "quickstart": {
211
+ "type": "string",
212
+ "description": "Path to quickstart template file"
213
+ },
214
+ "troubleshooting": {
215
+ "type": "string",
216
+ "description": "Path to troubleshooting template file"
217
+ }
218
+ },
219
+ "description": "Paths to documentation template files"
220
+ }
221
+ }
222
+ },
223
+ "learned": {
224
+ "type": "object",
225
+ "description": "Information learned during documentation sessions",
226
+ "properties": {
227
+ "insights": {
228
+ "type": "array",
229
+ "items": {
230
+ "type": "object",
231
+ "properties": {
232
+ "date": { "type": "string", "format": "date" },
233
+ "category": { "type": "string" },
234
+ "insight": { "type": "string" },
235
+ "source": { "type": "string" }
236
+ },
237
+ "required": ["date", "insight"]
238
+ },
239
+ "description": "Discovered patterns and insights"
240
+ },
241
+ "corrections": {
242
+ "type": "array",
243
+ "items": {
244
+ "type": "object",
245
+ "properties": {
246
+ "date": { "type": "string", "format": "date" },
247
+ "wrong": { "type": "string" },
248
+ "correct": { "type": "string" },
249
+ "context": { "type": "string" }
250
+ },
251
+ "required": ["date", "wrong", "correct"]
252
+ },
253
+ "description": "Corrections made based on user feedback"
254
+ }
255
+ }
256
+ }
257
+ },
258
+ "required": ["version"]
259
+ }