@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
@@ -1,12 +1,54 @@
1
1
  ---
2
2
  name: check-docs
3
- description: Quick check for documentation issues without making changes
3
+ description: Quick health check for documentation issues. Reads context memory for validation.
4
4
  ---
5
5
 
6
6
  ## Instructions
7
7
 
8
- Run a quick audit of documentation health:
8
+ Run a quick audit of documentation health.
9
9
 
10
+ ### Step 0: Read Context Memory
11
+
12
+ **First, read `.devdoc/context.json` if it exists:**
13
+
14
+ ```json
15
+ {
16
+ "product": { "name": "..." },
17
+ "terminology": {
18
+ "glossary": { "term": "definition" },
19
+ "avoidTerms": [{ "wrong": "...", "correct": "..." }],
20
+ "brandNames": { "ProductName": "ProductName" }
21
+ },
22
+ "api": { "style": "REST", "authentication": { "type": "api_key" } }
23
+ }
24
+ ```
25
+
26
+ **Use context for additional checks:**
27
+ - Verify terminology usage matches glossary
28
+ - Flag usage of terms in `avoidTerms`
29
+ - Check brand name capitalization
30
+ - Validate API patterns match `api.conventions`
31
+
32
+ ### Step 1: Get Documentation Type
33
+
34
+ **Read `docs.json` for `docType` field:**
35
+ ```json
36
+ { "docType": "api" } // "internal" | "api" | "product"
37
+ ```
38
+
39
+ **If not set, detect from structure:**
40
+ - Has `architecture/`, `development/` → "internal"
41
+ - Has `api-reference/`, `sdks/` → "api"
42
+ - Has `features/`, `tutorials/` → "product"
43
+
44
+ This helps tailor the checks:
45
+ - **internal**: Should have setup guides, architecture docs
46
+ - **api**: Should have authentication, error handling, API reference
47
+ - **product**: Should have screenshots, tutorials, FAQs
48
+
49
+ ### Step 2: Run Checks
50
+
51
+ #### Standard Checks:
10
52
  1. **Broken Links** - Check all internal href links resolve
11
53
  2. **Missing Pages** - Pages in docs.json but file doesn't exist
12
54
  3. **Orphan Pages** - MDX files not in docs.json navigation
@@ -14,33 +56,78 @@ Run a quick audit of documentation health:
14
56
  5. **Outdated Examples** - Compare imports against package exports
15
57
  6. **Stale Versions** - Check version numbers against package.json
16
58
 
17
- ## Output Format
59
+ #### Context-Based Checks (if context.json exists):
60
+ 7. **Terminology** - Flag incorrect terms from `avoidTerms`
61
+ 8. **Brand Names** - Check capitalization matches `brandNames`
62
+ 9. **Product Name** - Ensure consistent use of `product.name`
63
+ 10. **API Patterns** - Verify examples follow `api.conventions`
64
+
65
+ ### Output Format
18
66
 
19
67
  ```
20
68
  Documentation Health Check
21
69
  ==========================
22
70
 
71
+ Context: Using .devdoc/context.json ✓
72
+ DocType: api
73
+
23
74
  Summary: X issues found
24
75
 
25
- Broken Links (count)
76
+ ## Critical Issues
77
+
78
+ ### Broken Links (count)
26
79
  file.mdx:line → /path (page not found)
27
80
 
28
- Outdated Code (count)
81
+ ### Missing Pages (count)
82
+ docs.json references 'page' but file not found
83
+
84
+ ## Warnings
85
+
86
+ ### Terminology Issues (count)
87
+ file.mdx:line → Uses "charge" instead of "payment"
88
+ file.mdx:line → Uses "transaction" instead of "payment"
89
+ (per terminology.avoidTerms in context)
90
+
91
+ ### Brand Name Issues (count)
92
+ file.mdx:line → "productname" should be "ProductName"
93
+
94
+ ### Outdated Code (count)
29
95
  file.mdx:line → import { oldFunc } from 'pkg'
30
96
  'oldFunc' no longer exported, use 'newFunc'
31
97
 
32
- Orphan Pages (count)
98
+ ### Orphan Pages (count)
33
99
  path/to/file.mdx (not in navigation)
34
100
 
35
- Missing Pages (count)
36
- docs.json references 'page' but file not found
101
+ ## Passed
37
102
 
38
- All version numbers current
39
- All pages in docs.json exist
40
- No syntax errors in code blocks
103
+ All version numbers current
104
+ All internal links resolve
105
+ No syntax errors in code blocks
106
+ ✓ Product name used consistently
41
107
  ```
42
108
 
43
- ## Checks Performed
109
+ ## Checks By DocType
110
+
111
+ ### For docType: "internal"
112
+ - [ ] Setup guide exists and references correct tools
113
+ - [ ] Architecture docs present
114
+ - [ ] Development workflow documented
115
+ - [ ] Prerequisites clearly listed
116
+
117
+ ### For docType: "api"
118
+ - [ ] Authentication page exists
119
+ - [ ] Error codes documented
120
+ - [ ] API reference present (OpenAPI or manual)
121
+ - [ ] Quickstart under 5 minutes
122
+ - [ ] Code examples in primary language
123
+
124
+ ### For docType: "product"
125
+ - [ ] Screenshots present and described
126
+ - [ ] Tutorials have clear steps
127
+ - [ ] FAQ section exists
128
+ - [ ] Non-technical language used
129
+
130
+ ## Detailed Checks
44
131
 
45
132
  ### Link Validation
46
133
  - Internal links (`href="/path"`)
@@ -51,6 +138,7 @@ No syntax errors in code blocks
51
138
  - Language tag present
52
139
  - Valid syntax (basic check)
53
140
  - Import statements resolve
141
+ - Uses correct primary language from context
54
142
 
55
143
  ### Navigation Validation
56
144
  - All pages in docs.json exist
@@ -62,6 +150,11 @@ No syntax errors in code blocks
62
150
  - No H1 headings (title from frontmatter)
63
151
  - Images have alt text
64
152
 
153
+ ### Terminology Validation (from context)
154
+ - No terms from `avoidTerms` used
155
+ - Brand names capitalized correctly
156
+ - Glossary terms used consistently
157
+
65
158
  ## Quick Fixes
66
159
 
67
160
  After running check, common fixes:
@@ -70,3 +163,5 @@ After running check, common fixes:
70
163
  2. **Orphan page** → Add to docs.json or delete if unused
71
164
  3. **Missing frontmatter** → Add title and description
72
165
  4. **Outdated import** → Update to current export name
166
+ 5. **Wrong terminology** → Replace with correct term from context
167
+ 6. **Brand name** → Fix capitalization per context.json
@@ -0,0 +1,214 @@
1
+ ---
2
+ name: commit-doc
3
+ description: Commit documentation changes to git after reviewing and confirming.
4
+ ---
5
+
6
+ ## Instructions
7
+
8
+ When user wants to commit documentation changes:
9
+
10
+ ### Step 1: Check Current Status
11
+
12
+ Run git status to see what's changed:
13
+
14
+ ```bash
15
+ git status
16
+ git diff --stat
17
+ ```
18
+
19
+ Show summary to user:
20
+
21
+ "**Documentation Changes Ready to Commit:**
22
+
23
+ Modified files (3):
24
+ - `docs/guides/authentication.mdx` - Updated code examples
25
+ - `docs/api/users.mdx` - Added new endpoint docs
26
+ - `docs.json` - Updated navigation
27
+
28
+ New files (1):
29
+ - `docs/guides/webhooks.mdx` - New webhook guide
30
+
31
+ Deleted files (1):
32
+ - `docs/old/deprecated-api.mdx` - Removed deprecated docs
33
+
34
+ Would you like to:
35
+ 1. **Review changes** - Show me the detailed diff
36
+ 2. **Commit all** - Commit everything with a message
37
+ 3. **Selective commit** - Choose which files to commit
38
+ 4. **Cancel** - Don't commit yet"
39
+
40
+ ### Step 2: Review Changes (if requested)
41
+
42
+ Show meaningful diff summary:
43
+
44
+ "**Changes in `docs/guides/authentication.mdx`:**
45
+
46
+ ```diff
47
+ - const token = auth.getToken(user);
48
+ + const token = await auth.getToken(user, { refresh: true });
49
+ ```
50
+
51
+ Added:
52
+ - New `refresh` parameter documentation
53
+ - Updated example code
54
+ - Added error handling section
55
+
56
+ **Changes in `docs.json`:**
57
+ - Added 'Webhooks' to Guides group
58
+ - Removed 'Deprecated API' from navigation
59
+
60
+ Continue to commit?"
61
+
62
+ ### Step 3: Generate Commit Message
63
+
64
+ Analyze changes and suggest a commit message:
65
+
66
+ "Suggested commit message:
67
+
68
+ ```
69
+ docs: update authentication guide and add webhooks documentation
70
+
71
+ - Update auth.getToken() examples with new refresh parameter
72
+ - Add webhook integration guide
73
+ - Remove deprecated API documentation
74
+ - Update navigation structure
75
+ ```
76
+
77
+ Options:
78
+ 1. **Use this message** - Commit with suggested message
79
+ 2. **Edit message** - Modify the commit message
80
+ 3. **Custom message** - Write your own message"
81
+
82
+ ### Step 4: Confirm and Commit
83
+
84
+ "Ready to commit with message:
85
+
86
+ ```
87
+ docs: update authentication guide and add webhooks documentation
88
+ ```
89
+
90
+ This will commit:
91
+ - 3 modified files
92
+ - 1 new file
93
+ - 1 deleted file
94
+
95
+ **Proceed with commit?** (yes/no)"
96
+
97
+ ### Step 5: Execute Commit
98
+
99
+ ```bash
100
+ git add docs/
101
+ git add docs.json
102
+ git commit -m "docs: update authentication guide and add webhooks documentation
103
+
104
+ - Update auth.getToken() examples with new refresh parameter
105
+ - Add webhook integration guide
106
+ - Remove deprecated API documentation
107
+ - Update navigation structure"
108
+ ```
109
+
110
+ ### Step 6: Summary and Next Steps
111
+
112
+ "✓ **Committed successfully!**
113
+
114
+ Commit: `abc1234`
115
+ Branch: `main`
116
+ Files: 5 changed
117
+
118
+ **Next steps:**
119
+ 1. **Push changes**: `git push origin main`
120
+ 2. **Deploy docs**: `npx @brainfish-ai/devdoc deploy`
121
+ 3. **Create PR**: If on a feature branch
122
+
123
+ Would you like me to push the changes?"
124
+
125
+ ---
126
+
127
+ ## Commit Message Guidelines
128
+
129
+ ### Format
130
+ ```
131
+ <type>: <short description>
132
+
133
+ <detailed description>
134
+
135
+ <list of changes>
136
+ ```
137
+
138
+ ### Types
139
+ - `docs:` - Documentation changes (most common)
140
+ - `fix:` - Fix documentation errors
141
+ - `feat:` - New documentation features
142
+ - `refactor:` - Reorganize documentation
143
+ - `chore:` - Maintenance tasks
144
+
145
+ ### Examples
146
+
147
+ **New documentation:**
148
+ ```
149
+ docs: add webhook integration guide
150
+
151
+ - Add complete webhook setup guide
152
+ - Include payload examples
153
+ - Add troubleshooting section
154
+ ```
155
+
156
+ **Update existing:**
157
+ ```
158
+ docs: update authentication examples for v2.0
159
+
160
+ - Update code examples to use async/await
161
+ - Add new refresh token parameter
162
+ - Fix deprecated method references
163
+ ```
164
+
165
+ **Fix errors:**
166
+ ```
167
+ fix(docs): correct API endpoint URLs
168
+
169
+ - Fix base URL from /v1 to /v2
170
+ - Update authentication header name
171
+ - Fix typos in error codes
172
+ ```
173
+
174
+ **Reorganize:**
175
+ ```
176
+ refactor(docs): reorganize guide structure
177
+
178
+ - Move tutorials to dedicated folder
179
+ - Update navigation hierarchy
180
+ - Add cross-references between guides
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Selective Commit
186
+
187
+ When user wants to commit specific files:
188
+
189
+ "Select files to commit:
190
+
191
+ [ ] `docs/guides/authentication.mdx`
192
+ [ ] `docs/api/users.mdx`
193
+ [ ] `docs/guides/webhooks.mdx`
194
+ [x] `docs.json`
195
+
196
+ Enter file numbers to toggle (e.g., '1,3' or 'all'):"
197
+
198
+ After selection:
199
+ ```bash
200
+ git add docs.json
201
+ git add docs/guides/webhooks.mdx
202
+ git commit -m "docs: add webhooks guide and update navigation"
203
+ ```
204
+
205
+ ---
206
+
207
+ ## Safety Guidelines
208
+
209
+ - **Always show changes** before committing
210
+ - **Generate meaningful messages** based on actual changes
211
+ - **Don't commit sensitive data** - check for API keys, secrets
212
+ - **Suggest pushing** but don't auto-push
213
+ - **Keep commits focused** - one logical change per commit
214
+ - **Reference issues** if mentioned by user (e.g., "Fixes #123")
@@ -0,0 +1,198 @@
1
+ ---
2
+ name: create-doc
3
+ description: Create new documentation pages interactively. Analyzes codebase and guides you through the process.
4
+ ---
5
+
6
+ ## Instructions
7
+
8
+ When user wants to create documentation:
9
+
10
+ ### Step 0: Read Context Memory
11
+
12
+ **First, read `.devdoc/context.json` if it exists:**
13
+ - Use `product.name` for product references
14
+ - Apply `terminology.glossary` for correct terms
15
+ - Use `documentation.codeExamples.primaryLanguage` for code
16
+ - Read templates from `documentation.templates`
17
+
18
+ ### Step 1: Understand What to Create
19
+
20
+ Ask the user:
21
+
22
+ "What would you like to document?
23
+
24
+ 1. **A specific feature or concept** - I'll create a guide/tutorial
25
+ 2. **Code files or functions** - Point me to the code, I'll generate docs
26
+ 3. **API endpoints** - I'll analyze your API and create reference docs
27
+ 4. **Something else** - Describe what you need"
28
+
29
+ ### Step 2: Gather Information
30
+
31
+ Based on their choice:
32
+
33
+ #### For Feature/Concept:
34
+ - "What's the topic/title?"
35
+ - "What type of page?
36
+ - Guide - Explains how to do something
37
+ - Tutorial - Step-by-step walkthrough
38
+ - Reference - Technical specifications
39
+ - Troubleshooting - Problem/solution format"
40
+ - "Any specific sections you want included?"
41
+
42
+ #### For Code Documentation:
43
+ - "Which files or directories should I analyze?"
44
+ - "What should I focus on?
45
+ - Public API/exports
46
+ - Internal architecture
47
+ - Usage examples
48
+ - All of the above"
49
+ - Read the specified files
50
+ - Extract functions, classes, types, examples
51
+
52
+ #### For API Documentation:
53
+ - Check for existing OpenAPI/GraphQL specs
54
+ - If found: "I found `{spec}`. Should I generate docs from it?"
55
+ - If not: "Point me to your API routes/controllers"
56
+ - Extract endpoints, parameters, responses
57
+
58
+ #### For Other:
59
+ - Ask clarifying questions
60
+ - Understand the scope and purpose
61
+
62
+ ### Step 3: Analyze Codebase (if applicable)
63
+
64
+ When documenting code:
65
+
66
+ ```
67
+ Scan for:
68
+ - Function signatures and JSDoc/docstrings
69
+ - Type definitions and interfaces
70
+ - Usage examples in tests
71
+ - README sections about this feature
72
+ - Existing related documentation
73
+ ```
74
+
75
+ Show user what you found:
76
+ "I found:
77
+ - 5 exported functions in `src/utils/`
78
+ - Type definitions in `types/index.ts`
79
+ - 3 test files with usage examples
80
+
81
+ Should I proceed with generating documentation for these?"
82
+
83
+ ### Step 4: Choose Template
84
+
85
+ Read the appropriate template from `.devdoc/templates/`:
86
+
87
+ | Content Type | Template |
88
+ |--------------|----------|
89
+ | How-to guide | `guide.md` |
90
+ | Tutorial | `tutorial.md` |
91
+ | API endpoint | `api-reference.md` |
92
+ | Quick start | `quickstart.md` |
93
+ | FAQ/Issues | `troubleshooting.md` |
94
+
95
+ ### Step 5: Generate Content
96
+
97
+ Create the documentation:
98
+
99
+ 1. **Read the template** for structure guidance
100
+ 2. **Apply context** (terminology, voice, language)
101
+ 3. **Include mermaid diagrams** for flows/architecture
102
+ 4. **Add real code examples** from codebase
103
+ 5. **Use proper MDX components** (Steps, Cards, Tabs, etc.)
104
+
105
+ ### Step 6: Propose File Location
106
+
107
+ Suggest where to save:
108
+
109
+ "I'll create this page at: `docs/guides/{topic}.mdx`
110
+
111
+ Does this location work, or would you prefer somewhere else?"
112
+
113
+ ### Step 7: Create and Update Navigation
114
+
115
+ 1. Write the MDX file
116
+ 2. Ask: "Should I add this to the navigation in docs.json?"
117
+ 3. If yes, update docs.json with the new page
118
+
119
+ ### Step 8: Summary
120
+
121
+ "Created:
122
+ - `docs/guides/{topic}.mdx` - {description}
123
+ - Updated `docs.json` navigation
124
+
125
+ Preview with `npx @brainfish-ai/devdoc dev`
126
+
127
+ Want me to create another page or make changes to this one?"
128
+
129
+ ---
130
+
131
+ ## Code Documentation Examples
132
+
133
+ ### From TypeScript/JavaScript:
134
+
135
+ ```typescript
136
+ // Source: src/utils/auth.ts
137
+ export function validateToken(token: string): boolean {
138
+ // ... implementation
139
+ }
140
+ ```
141
+
142
+ Generates:
143
+
144
+ ```mdx
145
+ ## validateToken
146
+
147
+ Validates an authentication token.
148
+
149
+ ### Parameters
150
+
151
+ | Parameter | Type | Description |
152
+ |-----------|------|-------------|
153
+ | `token` | `string` | The JWT token to validate |
154
+
155
+ ### Returns
156
+
157
+ `boolean` - `true` if valid, `false` otherwise
158
+
159
+ ### Example
160
+
161
+ ```typescript
162
+ import { validateToken } from '@package/auth';
163
+
164
+ const isValid = validateToken(userToken);
165
+ if (!isValid) {
166
+ throw new Error('Invalid token');
167
+ }
168
+ ```
169
+ ```
170
+
171
+ ### From Python:
172
+
173
+ ```python
174
+ # Source: src/auth.py
175
+ def validate_token(token: str) -> bool:
176
+ """
177
+ Validate an authentication token.
178
+
179
+ Args:
180
+ token: The JWT token to validate
181
+
182
+ Returns:
183
+ True if valid, False otherwise
184
+ """
185
+ ```
186
+
187
+ Generates similar documentation following the template structure.
188
+
189
+ ---
190
+
191
+ ## Quality Guidelines
192
+
193
+ - Extract real code examples, don't fabricate
194
+ - Include error handling in examples
195
+ - Add TODO markers for sections needing human review
196
+ - Use mermaid diagrams for complex flows
197
+ - Link to related documentation
198
+ - Apply terminology from context.json