@brainfish-ai/devdoc 0.1.36 → 0.1.38

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.
@@ -7,7 +7,7 @@ description: Create new documentation pages interactively. Analyzes codebase and
7
7
 
8
8
  When user wants to create documentation:
9
9
 
10
- ### Step 0: Read Context Memory
10
+ ### Step 0: Read Context & Code Graph
11
11
 
12
12
  **First, read `.devdoc/context.json` if it exists:**
13
13
  - Use `product.name` for product references
@@ -15,6 +15,13 @@ When user wants to create documentation:
15
15
  - Use `documentation.codeExamples.primaryLanguage` for code
16
16
  - Read templates from `documentation.templates`
17
17
 
18
+ **Then, read `.devdoc/code-graph.json` if it exists:**
19
+ - Use `modules` array to understand codebase structure
20
+ - Reference exact function signatures from `exports`
21
+ - Use `types` array for type definitions
22
+ - Find examples in `examples` array
23
+ - Reference `errors` for error handling docs
24
+
18
25
  ### Step 1: Understand What to Create
19
26
 
20
27
  Ask the user:
@@ -63,20 +70,30 @@ Based on their choice:
63
70
 
64
71
  When documenting code:
65
72
 
73
+ **If `.devdoc/code-graph.json` exists:**
74
+ ```
75
+ Read from code-graph.json:
76
+ - modules[].exports → Function signatures, params, returns
77
+ - types[] → Type definitions
78
+ - examples[] → Code examples
79
+ - api.endpoints[] → API routes
80
+ - errors[] → Error types
81
+ ```
82
+
83
+ **If code-graph.json doesn't exist:**
66
84
  ```
67
- Scan for:
85
+ Scan the codebase for:
68
86
  - Function signatures and JSDoc/docstrings
69
87
  - Type definitions and interfaces
70
88
  - Usage examples in tests
71
89
  - README sections about this feature
72
- - Existing related documentation
73
90
  ```
74
91
 
75
92
  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
93
+ "I found in code-graph.json:
94
+ - Module: `auth` with 5 exports (login, logout, verifyToken...)
95
+ - Types: User, AuthToken, Session
96
+ - Examples: `examples/auth-flow.ts`
80
97
 
81
98
  Should I proceed with generating documentation for these?"
82
99
 
@@ -98,9 +115,29 @@ Create the documentation:
98
115
 
99
116
  1. **Read the template** for structure guidance
100
117
  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.)
118
+ 3. **Use code-graph.json** for accuracy:
119
+ - Get exact function signatures from `exports`
120
+ - Get type definitions from `types`
121
+ - Reference examples from `examples` array
122
+ - Document errors from `errors` array
123
+ 4. **Include mermaid diagrams** for flows/architecture
124
+ 5. **Add real code examples** from codebase/code-graph
125
+ 6. **Use proper MDX components** (Steps, Cards, Tabs, etc.)
126
+
127
+ **Example using code-graph:**
128
+ ```
129
+ // From code-graph.json:
130
+ {
131
+ "name": "login",
132
+ "type": "function",
133
+ "signature": "login(email: string, password: string): Promise<AuthToken>",
134
+ "params": [...]
135
+ }
136
+
137
+ // Generate accurate documentation:
138
+ ## login(email, password)
139
+ Authenticate user and return JWT token.
140
+ ```
104
141
 
105
142
  ### Step 6: Propose File Location
106
143
 
@@ -7,7 +7,7 @@ description: Update existing documentation by analyzing codebase changes or user
7
7
 
8
8
  When user wants to update documentation:
9
9
 
10
- ### Step 0: Read Context Memory
10
+ ### Step 0: Read Context & Code Graph
11
11
 
12
12
  **First, read `.devdoc/context.json` if it exists:**
13
13
  - Use `product.name` for product references
@@ -15,6 +15,12 @@ When user wants to update documentation:
15
15
  - Avoid `terminology.avoidTerms`
16
16
  - Match `documentation.voice` for writing style
17
17
 
18
+ **Then, read `.devdoc/code-graph.json` if it exists:**
19
+ - Compare documented signatures vs code-graph exports
20
+ - Check if new exports need documentation
21
+ - Verify types match code-graph definitions
22
+ - Find new examples to include
23
+
18
24
  ### Step 1: Understand What to Update
19
25
 
20
26
  Ask the user:
@@ -42,13 +48,24 @@ Based on their choice:
42
48
  - Other (describe)"
43
49
 
44
50
  #### For Codebase Sync:
45
- - Locate source code (from context or `../`)
46
- - Compare documentation against code:
51
+ **If code-graph.json exists:**
52
+ - Re-scan codebase to update code-graph.json
53
+ - Compare OLD code-graph vs NEW code-graph:
54
+ - Changed function signatures
55
+ - New exports added
56
+ - Removed exports
57
+ - Changed types
58
+ - Generate sync report (see below)
59
+
60
+ **If code-graph.json doesn't exist:**
61
+ - Run bootstrap first: "Run `/bootstrap-docs` first to create code-graph.json"
62
+ - Or manually scan source code
63
+
64
+ Compare documentation against code-graph:
47
65
  - Function signatures changed?
48
66
  - New exports not documented?
49
67
  - Removed features still documented?
50
68
  - Version numbers outdated?
51
- - Generate sync report (see below)
52
69
 
53
70
  #### For Navigation:
54
71
  - Read current `docs.json`
@@ -69,24 +86,31 @@ Based on their choice:
69
86
 
70
87
  ### Step 3: Generate Sync Report (if syncing)
71
88
 
89
+ **Compare docs against code-graph.json:**
90
+
72
91
  ```
73
92
  ## Documentation Sync Report
74
93
 
75
- ### Outdated (Action Required)
94
+ ### Signature Changes (from code-graph.json)
76
95
  - `docs/api/users.mdx`: Function signature changed
77
96
  - Documented: `createUser(name, email)`
78
- - Current: `createUser(options: CreateUserInput)`
97
+ - Code-graph: `createUser(options: CreateUserInput)`
79
98
 
80
- - `docs/quickstart.mdx`: Package version outdated
81
- - Documented: v1.2.0
82
- - Current: v2.0.0
99
+ ### New Exports (in code-graph, not in docs)
100
+ - Module `auth`: `refreshToken()` - Not documented
101
+ - Module `users`: `deleteUser()` - Not documented
102
+ - Type: `SessionConfig` - Not documented
103
+
104
+ ### Removed (in docs, not in code-graph)
105
+ - `legacyAuth()` - Removed from codebase
106
+ - Type: `OldUserFormat` - No longer exists
83
107
 
84
- ### Terminology Issues
85
- - `docs/guides/intro.mdx:15`: Uses "charge" instead of "payment"
108
+ ### Type Changes
109
+ - `User` interface: Added `role` property
110
+ - `AuthToken`: Changed `expiresAt` type
86
111
 
87
- ### Missing Documentation
88
- - `src/utils/newFeature.ts` - New export, not documented
89
- - `POST /api/v2/webhooks` - New endpoint
112
+ ### New Endpoints (from code-graph.api.endpoints)
113
+ - `POST /api/v2/webhooks` - Not documented
90
114
 
91
115
  ### Up to Date ✓
92
116
  - `docs/guides/authentication.mdx`
@@ -96,7 +120,8 @@ Based on their choice:
96
120
  Ask: "How would you like to proceed?
97
121
  1. **Fix all** - Update everything automatically
98
122
  2. **Interactive** - Review each change
99
- 3. **Specific items** - Tell me which to fix"
123
+ 3. **Specific items** - Tell me which to fix
124
+ 4. **Refresh code-graph first** - Re-scan codebase before updating"
100
125
 
101
126
  ### Step 4: Propose Changes
102
127