wicked-brain 0.9.1 → 0.9.2
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/package.json
CHANGED
package/server/package.json
CHANGED
|
@@ -41,6 +41,29 @@ Create a structured summary of what you found.
|
|
|
41
41
|
- Trace primary data flows (request → handler → storage → response)
|
|
42
42
|
- Note external dependencies and integrations
|
|
43
43
|
|
|
44
|
+
#### Step 2b: Extract symbols (JS/TS projects)
|
|
45
|
+
|
|
46
|
+
If the brain server has an LSP running, query it for exported symbols:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
curl -s -X POST http://localhost:{port}/api \
|
|
50
|
+
-H "Content-Type: application/json" \
|
|
51
|
+
-d '{"action":"lsp-workspace-symbols","params":{"query":""}}'
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
If LSP is unavailable (check `{"action":"lsp-health"}`), fall back to reading
|
|
55
|
+
key source files directly and listing their exports with Grep:
|
|
56
|
+
- `export function`, `export class`, `export const`, `export default`
|
|
57
|
+
- `module.exports`, `exports.`
|
|
58
|
+
|
|
59
|
+
For each major module/directory, record:
|
|
60
|
+
- **File inventory**: files with approximate LOC
|
|
61
|
+
- **Exported symbols**: class names, function names, const names with their file paths
|
|
62
|
+
- **Public API surface**: which symbols are entry points vs internal helpers
|
|
63
|
+
|
|
64
|
+
Be specific — write `analyzeProject(desc: string): SignalAnalysis` not just
|
|
65
|
+
"analyzes projects". Include parameter types and return types when visible.
|
|
66
|
+
|
|
44
67
|
### Step 3: Extract conventions
|
|
45
68
|
|
|
46
69
|
- **Naming**: file naming, function naming, variable naming patterns
|
|
@@ -53,11 +76,35 @@ Create a structured summary of what you found.
|
|
|
53
76
|
For each major finding (architecture, conventions, dependencies), write a chunk to `{brain_path}/chunks/extracted/project-{safe_project_name}/`:
|
|
54
77
|
|
|
55
78
|
Each chunk should be a focused topic:
|
|
56
|
-
- `chunk-001-structure.md` — project structure and layout
|
|
79
|
+
- `chunk-001-structure.md` — project structure and layout (directory tree with file counts and LOC)
|
|
57
80
|
- `chunk-002-architecture.md` — architecture and data flow
|
|
58
81
|
- `chunk-003-conventions.md` — coding conventions and patterns
|
|
59
82
|
- `chunk-004-dependencies.md` — key dependencies and integrations
|
|
60
83
|
- `chunk-005-build-deploy.md` — build, test, and deployment
|
|
84
|
+
- `chunk-006-symbols.md` — exported symbols per module (from Step 2b)
|
|
85
|
+
|
|
86
|
+
**chunk-006-symbols.md format:** List symbols grouped by module/directory. For each
|
|
87
|
+
symbol include: name, kind (class/function/const/interface), file path, and signature
|
|
88
|
+
when available. Example:
|
|
89
|
+
|
|
90
|
+
```markdown
|
|
91
|
+
## server/lib/
|
|
92
|
+
|
|
93
|
+
### sqlite-search.mjs (878 LOC)
|
|
94
|
+
- `class SqliteSearch` — FTS5 search engine wrapping better-sqlite3
|
|
95
|
+
- `search({ query, limit, offset, since, session_id })` → `{ results, total_matches, showing }`
|
|
96
|
+
- `wikiList({ query, limit })` → `{ articles: [{ path, title, description, tags, word_count }] }`
|
|
97
|
+
- `index(doc)` — upsert document + FTS + wikilinks
|
|
98
|
+
- `stats()` → `{ total, chunks, wiki, memory, ... }`
|
|
99
|
+
- `function deriveSourceType(path)` → `"wiki" | "memory" | "chunk"`
|
|
100
|
+
|
|
101
|
+
### file-watcher.mjs (330 LOC)
|
|
102
|
+
- `class FileWatcher` — recursive fs.watch with polling fallback
|
|
103
|
+
- `start()` / `stop()` — lifecycle
|
|
104
|
+
- `onFileChange(callback)` — hook for LSP integration
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
This gives compile enough structural detail to weave into wiki articles.
|
|
61
108
|
|
|
62
109
|
Use standard chunk frontmatter with rich synonym-expanded `contains:` tags.
|
|
63
110
|
|
|
@@ -71,10 +118,14 @@ If re-onboarding (chunks already exist), follow the archive-then-replace pattern
|
|
|
71
118
|
Invoke `wicked-brain:compile` (or write directly) to create a wiki article at `{brain_path}/wiki/projects/{safe_project_name}.md` that synthesizes:
|
|
72
119
|
- Project overview (what it does, who it's for)
|
|
73
120
|
- Architecture summary with module map
|
|
121
|
+
- **API surface** — key exported symbols per module (from chunk-006-symbols), with signatures
|
|
122
|
+
- **File inventory** — directories with file counts and total LOC
|
|
74
123
|
- Key conventions
|
|
75
124
|
- Build/test/deploy quickstart
|
|
76
125
|
- Links to detailed chunks via [[wikilinks]]
|
|
77
126
|
|
|
127
|
+
The wiki article should answer both "how does X work?" (narrative) and "what does X export?" (structural). Include actual function names, class names, and signatures — not just descriptions.
|
|
128
|
+
|
|
78
129
|
### Step 6: Configure
|
|
79
130
|
|
|
80
131
|
Invoke `wicked-brain:configure` to update the CLI's agent config file with brain-aware instructions.
|