erne-universal 0.6.3 → 0.9.0
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/CLAUDE.md +25 -1
- package/README.md +129 -4
- package/agents/documentation-generator.md +223 -0
- package/agents/visual-debugger.md +203 -0
- package/bin/cli.js +2 -0
- package/commands/debug-visual.md +78 -0
- package/dashboard/lib/agents-config.js +30 -0
- package/dashboard/lib/context/budget-manager.js +108 -0
- package/dashboard/lib/context/content-store.js +478 -0
- package/dashboard/lib/context/cross-project.js +32 -0
- package/dashboard/lib/context/db.js +89 -0
- package/dashboard/lib/context/knowledge-base.js +158 -0
- package/dashboard/lib/context/preloader.js +27 -0
- package/dashboard/lib/context/schemas/001-initial.sql +121 -0
- package/dashboard/lib/context/schemas/002-content-store.sql +56 -0
- package/dashboard/lib/context/session-continuity.js +139 -0
- package/dashboard/lib/context/session-tracker.js +112 -0
- package/dashboard/lib/context/summarizer.js +678 -0
- package/dashboard/lib/context/truncation.js +144 -0
- package/dashboard/lib/ecosystem/analyzer.js +158 -0
- package/dashboard/lib/ecosystem/fetcher.js +231 -0
- package/dashboard/lib/ecosystem/handler.js +58 -0
- package/dashboard/lib/insights/collector.js +113 -0
- package/dashboard/lib/insights/handler.js +52 -0
- package/dashboard/lib/insights/trends.js +58 -0
- package/dashboard/lib/myapp/handler.js +314 -0
- package/dashboard/lib/upgrades/handler.js +104 -0
- package/dashboard/lib/upgrades/planner.js +20 -0
- package/dashboard/lib/upgrades/scanner.js +131 -0
- package/dashboard/package.json +1 -0
- package/dashboard/public/audit-panel.js +168 -0
- package/dashboard/public/budget-panel.js +76 -0
- package/dashboard/public/context-panel.js +54 -0
- package/dashboard/public/context-toggle.js +94 -0
- package/dashboard/public/ecosystem-tab.js +166 -0
- package/dashboard/public/history.js +19 -0
- package/dashboard/public/index.html +94 -3
- package/dashboard/public/insights-tab.js +129 -0
- package/dashboard/public/knowledge-browser.js +77 -0
- package/dashboard/public/myapp-tab.js +365 -0
- package/dashboard/public/panel.js +107 -9
- package/dashboard/public/sidebar-panels.js +198 -0
- package/dashboard/public/sparkline.js +72 -0
- package/dashboard/public/statsbar.js +32 -8
- package/dashboard/public/styles.css +823 -87
- package/dashboard/public/tabs.js +180 -0
- package/dashboard/public/upgrades-tab.js +202 -0
- package/dashboard/public/ws-client.js +9 -1
- package/dashboard/server.js +397 -15
- package/hooks/hooks.json +13 -0
- package/hooks/profiles/standard.json +3 -1
- package/hooks/profiles/strict.json +3 -1
- package/lib/audit-cli.js +315 -0
- package/lib/audit-scanner.js +113 -0
- package/lib/audit.js +1697 -0
- package/lib/dashboard.js +13 -4
- package/lib/doctor.js +121 -22
- package/lib/init.js +20 -0
- package/lib/scanners/api-layer.js +155 -0
- package/lib/scanners/components.js +191 -0
- package/lib/scanners/config.js +89 -0
- package/lib/scanners/dead-code.js +125 -0
- package/lib/scanners/dep-health.js +153 -0
- package/lib/scanners/dependencies.js +101 -0
- package/lib/scanners/git-history.js +87 -0
- package/lib/scanners/hooks-scan.js +151 -0
- package/lib/scanners/routes.js +129 -0
- package/lib/scanners/screens.js +174 -0
- package/lib/scanners/state.js +80 -0
- package/lib/scanners/structure.js +83 -0
- package/lib/scanners/tech-debt.js +77 -0
- package/lib/scanners/type-safety.js +124 -0
- package/mcp-configs/erne-context/index.js +73 -0
- package/package.json +2 -2
- package/scripts/hooks/audit-refresh.js +37 -0
- package/scripts/hooks/dashboard-event.js +1 -1
- package/scripts/hooks/run-with-flags.js +36 -1
- package/scripts/hooks/visual-debug-event.js +66 -0
- package/scripts/validate-all.js +2 -2
package/CLAUDE.md
CHANGED
|
@@ -83,6 +83,30 @@ You are working in an ERNE-powered React Native/Expo project.
|
|
|
83
83
|
- Zero context switching required from the user
|
|
84
84
|
- Go fix failing CI tests without being told how
|
|
85
85
|
|
|
86
|
+
## Smart Agent Routing
|
|
87
|
+
|
|
88
|
+
When a user's message matches these signals, automatically use the corresponding agent via a subagent. The user should NOT need to type explicit `/commands` — detect intent from context. Explicit `/command` invocations always override auto-routing.
|
|
89
|
+
|
|
90
|
+
**How routing works:** Read the user's message. If it matches trigger signals below, dispatch the matching agent as a subagent. If multiple agents could match, prefer the more specific one. If unclear, ask the user.
|
|
91
|
+
|
|
92
|
+
**Image detection:** When the user shares an image/screenshot alongside a description of a visual problem, ALWAYS route to visual-debugger.
|
|
93
|
+
|
|
94
|
+
| Agent | Trigger Signals |
|
|
95
|
+
|-------|----------------|
|
|
96
|
+
| `visual-debugger` | Image in chat with UI issue, screenshot, "doesn't look right", "UI is broken", "layout not working", "fix this" + image, spacing, alignment, overflow, "wrong colors", "doesn't match Figma", pixel, responsive, "design issue", "visual bug", "cut off", overlapping, "not centered", "wrong font", "dark mode broken", "safe area", notch, "status bar", "keyboard covers" |
|
|
97
|
+
| `performance-profiler` | "slow", lag, FPS, "memory leak", jank, freeze, hanging, "bundle size", TTI, "startup time", "re-render", heavy, "animation stutter", "frame drop", "battery drain", "CPU usage", "JS thread blocked", "bridge overhead", "large list", "image loading slow", "splash screen long", ANR |
|
|
98
|
+
| `code-reviewer` | review, PR, refactor, "code quality", "clean up", "best practice", "technical debt", "code smell", maintainability, "check my code", "is this okay", "anti-pattern", readability, DRY, SOLID, "type safety" |
|
|
99
|
+
| `architect` | "how to build", architecture, structure, plan, "system design", "new feature", "want to add", "how to approach", decompose, "design pattern", "folder structure", "state management", "data flow", "API design", "navigation structure", monorepo, "separation of concerns" |
|
|
100
|
+
| `feature-builder` | implement, build, create, "add feature", "create component", "write this", "make this", scaffold, "add screen", "wire up", integrate, "connect to API", "hook up", "add functionality", CRUD |
|
|
101
|
+
| `tdd-guide` | test, coverage, jest, detox, TDD, "write test", "unit test", e2e, "failing test", "test broken", "snapshot test", mock, fixture, "testing library", "integration test", "test flaky" |
|
|
102
|
+
| `expo-config-resolver` | build error, red screen, crash, "won't start", error, "build failed", metro, babel, "config issue", "EAS build", "can't build", "module not found", "pod install", gradle, "Xcode error", "Android build", "iOS build", "linking error", prebuild, "app.json", "app.config", "plugin not working", "white screen", "blank screen" |
|
|
103
|
+
| `native-bridge-builder` | "native module", bridge, "turbo module", Swift, Kotlin, Java, "Objective-C", "native code", "platform specific", "expo module", JSI, Fabric, "New Architecture", codegen, "C++", "native view", Nitro, "expo-modules-core" |
|
|
104
|
+
| `upgrade-assistant` | upgrade, update, version, migration, "breaking change", deprecated, "Expo SDK", "React Native version", bump, migrate, changelog, compatibility, "peer dependency", outdated, "npx expo install --fix" |
|
|
105
|
+
| `ui-designer` | component, button, modal, form, screen, page, tab, "navigation UI", "build UI", "design system", styled, theme, icon, animation, transition, gesture, "bottom sheet", drawer, header, card, skeleton, loading, toast |
|
|
106
|
+
| `pipeline-orchestrator` | deploy, publish, EAS, "app store", "play store", "CI/CD", release, "OTA update", submit, distribution, TestFlight, "internal testing", "code signing", provisioning, certificate, keystore, fastlane, "GitHub Actions" |
|
|
107
|
+
| `senior-developer` | "what do you think", opinion, advice, approach, tradeoff, "not sure how", mentor, "help me decide", "best way to", "should I", "pros and cons", "compare options", "which is better", "common pitfall", "production ready", scalable |
|
|
108
|
+
| `documentation-generator` | "generate docs", "document this", "write documentation", "project overview", "architecture docs", "what does this project do", "onboard me", "explain codebase", "project structure", "how does this work" |
|
|
109
|
+
|
|
86
110
|
## Task Management
|
|
87
111
|
|
|
88
112
|
1. **Plan First**: Use plan mode or TodoWrite for non-trivial tasks
|
|
@@ -99,7 +123,7 @@ You are working in an ERNE-powered React Native/Expo project.
|
|
|
99
123
|
|
|
100
124
|
## Available Commands
|
|
101
125
|
|
|
102
|
-
Use `/plan`, `/code-review`, `/tdd`, `/build-fix`, `/perf`, `/upgrade`, `/native-module`, `/navigate`, `/animate`, `/deploy`, `/component`, `/debug`, `/quality-gate`, `/code`, `/feature`, `/learn`, `/retrospective`, `/setup-device` for guided workflows.
|
|
126
|
+
Use `/plan`, `/code-review`, `/tdd`, `/build-fix`, `/perf`, `/upgrade`, `/native-module`, `/navigate`, `/animate`, `/deploy`, `/component`, `/debug`, `/debug-visual`, `/audit`, `/quality-gate`, `/code`, `/feature`, `/learn`, `/retrospective`, `/setup-device` for guided workflows.
|
|
103
127
|
|
|
104
128
|
## Available Skills
|
|
105
129
|
|
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ This will:
|
|
|
49
49
|
|
|
50
50
|
## 🎮 Agent Dashboard
|
|
51
51
|
|
|
52
|
-
ERNE includes a real-time pixel-art dashboard
|
|
52
|
+
ERNE includes a real-time pixel-art dashboard with 4 tabs, a context sidebar, and animated office visualization.
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
55
|
erne dashboard # Start on port 3333, open browser
|
|
@@ -58,7 +58,12 @@ erne dashboard --no-open # Don't open browser
|
|
|
58
58
|
erne start # Init project + dashboard in background
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
### HQ — Pixel-Art Office
|
|
62
|
+
|
|
63
|
+
<p align="center">
|
|
64
|
+
<img src="docs/screenshots/dashboard-hq.png" alt="ERNE HQ — 4 office rooms with 11 animated agents" width="800" />
|
|
65
|
+
</p>
|
|
66
|
+
|
|
62
67
|
- 🏢 4 office rooms — Development, Code Review, Testing, and Conference
|
|
63
68
|
- 🎨 11 animated agent sprites with walking, typing, and done animations
|
|
64
69
|
- 💬 Thought bubbles showing the current task above working agents
|
|
@@ -69,6 +74,56 @@ erne start # Init project + dashboard in background
|
|
|
69
74
|
- 🎯 Pipeline orchestrator coordination view in conference room
|
|
70
75
|
- 🔄 Real-time WebSocket updates with auto-reconnect
|
|
71
76
|
|
|
77
|
+
### My App — Project Intelligence
|
|
78
|
+
|
|
79
|
+
<p align="center">
|
|
80
|
+
<img src="docs/screenshots/dashboard-myapp.png" alt="My App tab — project overview, MCP integrations, audit, environment" width="800" />
|
|
81
|
+
</p>
|
|
82
|
+
|
|
83
|
+
- 📋 App overview with framework detection, health grade, and stack chips
|
|
84
|
+
- 🔌 10 MCP integration statuses with requirements
|
|
85
|
+
- 🔍 Project audit with score, findings (with FIX buttons), and strengths
|
|
86
|
+
- ⚡ Quick actions — run tests, lint, start dev, build iOS/Android, pod install
|
|
87
|
+
- 💡 Smart recommendations based on audit findings
|
|
88
|
+
- 🛠️ Environment checks for all dev tools (Node, Xcode, CocoaPods, etc.)
|
|
89
|
+
|
|
90
|
+
### Ecosystem — Release Radar
|
|
91
|
+
|
|
92
|
+
<p align="center">
|
|
93
|
+
<img src="docs/screenshots/dashboard-ecosystem.png" alt="Ecosystem tab — release feed for React Native packages" width="800" />
|
|
94
|
+
</p>
|
|
95
|
+
|
|
96
|
+
- 📰 Live release feed for React Native ecosystem packages
|
|
97
|
+
- 🏷️ Tags: NEW, BREAK, security patches
|
|
98
|
+
- 🔍 Filter by category: Updates, Trending, Tips, Security
|
|
99
|
+
- 📊 Quick stats sidebar
|
|
100
|
+
|
|
101
|
+
### Insights — Project Analytics
|
|
102
|
+
|
|
103
|
+
<p align="center">
|
|
104
|
+
<img src="docs/screenshots/dashboard-insights.png" alt="Insights tab — audit score, outdated deps, agent utilization" width="800" />
|
|
105
|
+
</p>
|
|
106
|
+
|
|
107
|
+
- 📈 KPI cards: Audit Score, Outdated Deps, Agent Tasks (with deltas)
|
|
108
|
+
- 📊 Agent utilization breakdown with horizontal bar chart
|
|
109
|
+
|
|
110
|
+
### Context Sidebar
|
|
111
|
+
|
|
112
|
+
<p align="center">
|
|
113
|
+
<img src="docs/screenshots/dashboard-sidebar.png" alt="Context sidebar — system info, audit, activity, knowledge base" width="800" />
|
|
114
|
+
</p>
|
|
115
|
+
|
|
116
|
+
The sidebar auto-enables with the dashboard and provides 6 collapsible panels:
|
|
117
|
+
|
|
118
|
+
- 🖥️ **System Info** — project metadata, environment checks, git branch
|
|
119
|
+
- 🔍 **Project Audit** — 22-point score with one-click FIX buttons and strength checks
|
|
120
|
+
- 📋 **Agent Activity** — real-time task history with timestamps
|
|
121
|
+
- 💾 **Context Savings** — live savings percentage, KB saved, and event timeline
|
|
122
|
+
- 📚 **Knowledge Base** — FTS5-powered search across 5 categories (pattern, decision, error, api, component)
|
|
123
|
+
- 💰 **Context Budget** — set session/agent token limits, choose overflow strategy (truncate / warn / stop)
|
|
124
|
+
|
|
125
|
+
Context optimization runs automatically — no flags or configuration needed. See [Context Optimization](#-context-optimization) for details.
|
|
126
|
+
|
|
72
127
|
---
|
|
73
128
|
|
|
74
129
|
## 🎯 Multi-Agent Orchestration
|
|
@@ -117,9 +172,69 @@ Each agent has a distinct personality, quantified success metrics, and memory in
|
|
|
117
172
|
|
|
118
173
|
---
|
|
119
174
|
|
|
175
|
+
## 🧠 Context Optimization
|
|
176
|
+
|
|
177
|
+
ERNE includes a built-in context intelligence system that reduces tool output bloat by **97–100%**, preserves exact code examples via FTS5 search, and manages your context budget — all auto-enabled with the dashboard.
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
erne dashboard # Context system starts automatically
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Benchmark-verified savings
|
|
184
|
+
|
|
185
|
+
| Layer | What it does | Savings |
|
|
186
|
+
|-------|-------------|---------|
|
|
187
|
+
| **Summarizer** | Auto-detects 14 content types (docs, JSON, logs, test output, build output, CSV, git history, etc.) and compresses to statistical summaries | **97–100%** |
|
|
188
|
+
| **Index + Search** | Chunks content by headings, indexes in FTS5 with BM25 ranking. Returns only relevant chunks — code examples preserved exactly | **80%** |
|
|
189
|
+
| **Full session** | Combined summarizer + search across a real debugging session (docs, snapshots, issues, tests, builds) | **99%** |
|
|
190
|
+
|
|
191
|
+
> **Real numbers:** 537 KB of tool outputs → 2.6 KB of context. That's **0.4%** of a 200K context window instead of 44.5%. See [BENCHMARK.md](BENCHMARK.md) for the full 21-scenario breakdown.
|
|
192
|
+
|
|
193
|
+
### How it works
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
Tool Output ──▶ Smart Summarizer ──▶ 97-100% compression (14 content types)
|
|
197
|
+
│
|
|
198
|
+
Raw Docs ──▶ FTS5 Index+Search ──▶ 80% savings, exact code preserved
|
|
199
|
+
│
|
|
200
|
+
Session Events ──▶ Session Tracker ──▶ Error→Fix correlation
|
|
201
|
+
│
|
|
202
|
+
Knowledge ──▶ 3-Layer Search (FTS5 → Trigram → Levenshtein)
|
|
203
|
+
│
|
|
204
|
+
Session End ──▶ Snapshot (<2KB) ──▶ Next session restores context
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
| Feature | What it does |
|
|
208
|
+
|---------|-------------|
|
|
209
|
+
| **Content summarizer** | 14 auto-detected content types: markdown, HTML, JSON, test output, TypeScript errors, build output, logs, git history, CSV, and more. Each type gets a specialized summary format |
|
|
210
|
+
| **Content store** | FTS5-powered index with Porter stemming. Markdown chunked by headings, code blocks never split or truncated. BM25 relevance ranking with byte budget management |
|
|
211
|
+
| **Smart truncation** | 4-tier fallback cascade: Structured → Pattern → Head/Tail → Hash. Handles anything the summarizer doesn't cover |
|
|
212
|
+
| **Knowledge base** | SQLite-backed with FTS5 full-text search, trigram fuzzy matching, and Levenshtein fallback. Entries scored by recency + access frequency |
|
|
213
|
+
| **Session continuity** | Snapshots capture active tasks, decisions, errors, and commits at session end. Next session restores context in <2KB |
|
|
214
|
+
| **Budget manager** | Set per-session and per-agent token limits. Throttles at 80%, supports aggressive truncation / warn / hard stop overflow strategies |
|
|
215
|
+
| **Agent preloader** | Tracks agent-to-agent transitions and predicts the next agent for parallel context warmup |
|
|
216
|
+
| **Error→Fix tracking** | Correlates errors with subsequent file modifications to build fix patterns over time |
|
|
217
|
+
|
|
218
|
+
### Dashboard sidebar panels
|
|
219
|
+
|
|
220
|
+
The context sidebar (toggle with the chevron button) shows 6 live panels:
|
|
221
|
+
|
|
222
|
+
- **System Info** — project metadata, environment health, git branch
|
|
223
|
+
- **Project Audit** — 22-point audit with score, one-click FIX buttons, and strengths
|
|
224
|
+
- **Agent Activity** — real-time task history with timestamps
|
|
225
|
+
- **Context Savings** — live savings percentage, KB saved, and event timeline
|
|
226
|
+
- **Knowledge Base** — searchable entries with category filters (pattern, decision, error, api, component)
|
|
227
|
+
- **Context Budget** — configure session limits and overflow strategy directly from the UI
|
|
228
|
+
|
|
229
|
+
If the context system is disabled, the sidebar shows an **Enable Context** button to activate it at runtime.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
120
233
|
## 💰 Token Efficiency
|
|
121
234
|
|
|
122
|
-
ERNE
|
|
235
|
+
ERNE minimizes token usage through two complementary systems: **architecture-level savings** (what gets loaded into context) and **runtime context optimization** (how tool outputs and session state are compressed).
|
|
236
|
+
|
|
237
|
+
### Architecture savings
|
|
123
238
|
|
|
124
239
|
| Mechanism | How it works | Savings |
|
|
125
240
|
|-----------|-------------|---------|
|
|
@@ -130,7 +245,17 @@ ERNE's architecture is designed to minimize token usage through six layered mech
|
|
|
130
245
|
| **Task-specific commands** | 19 focused prompts instead of one monolithic instruction set | ~13% |
|
|
131
246
|
| **Context-based behavior** | Modes change behavior dynamically without loading new rulesets | ~3% |
|
|
132
247
|
|
|
133
|
-
|
|
248
|
+
### Runtime context optimization (benchmark-verified)
|
|
249
|
+
|
|
250
|
+
| Mechanism | How it works | Savings |
|
|
251
|
+
|-----------|-------------|---------|
|
|
252
|
+
| **Content summarizer** | Auto-detects 14 content types, produces statistical summaries | **97–100%** per output |
|
|
253
|
+
| **Index + Search** | FTS5 BM25 retrieval returns only relevant chunks, code preserved exactly | **80%** per search |
|
|
254
|
+
| **Smart truncation** | 4-tier fallback: Structured → Pattern → Head/Tail → Hash | 85–100% per output |
|
|
255
|
+
| **Session snapshots** | Captures full session state in <2KB | ~50% vs log replay |
|
|
256
|
+
| **Budget enforcement** | Throttling at 80% prevents runaway token usage | Prevents overflow |
|
|
257
|
+
|
|
258
|
+
**Result:** Architecture saves **60–67%** on what enters context. Runtime optimization achieves **97–100%** compression on tool outputs (verified across 21 benchmark scenarios with 537 KB of real data). In a full debugging session, **99% of tool output tokens are eliminated** — leaving 99.6% of your context window free for actual problem solving. See [BENCHMARK.md](BENCHMARK.md) for complete results.
|
|
134
259
|
|
|
135
260
|
---
|
|
136
261
|
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentation-generator
|
|
3
|
+
emoji: "\U0001F4DA"
|
|
4
|
+
vibe: "If it's not documented, it doesn't exist"
|
|
5
|
+
description: Generates comprehensive project documentation from audit scan data. Produces architecture docs, component catalogs, API docs, screen blueprints, Mermaid diagrams, onboarding scores, dead code reports, type safety analysis. Triggered by /audit or when user asks about project documentation.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are the ERNE Documentation Generator agent — a React Native project documentation specialist.
|
|
9
|
+
|
|
10
|
+
## Your Role
|
|
11
|
+
|
|
12
|
+
Generate comprehensive, accurate project documentation from audit scan data — architecture docs, component catalogs, API references, screen blueprints, Mermaid diagrams, onboarding scores, dead code reports, and type safety analysis.
|
|
13
|
+
|
|
14
|
+
## Identity & Personality
|
|
15
|
+
|
|
16
|
+
A meticulous technical writer who believes documentation is the foundation of team velocity. You write docs that a new developer can follow on day one — no assumptions, no hand-waving. You use Mermaid diagrams to visualize what words can't explain. You score projects on onboarding readiness because you know that "it's obvious" is never true for the new person.
|
|
17
|
+
|
|
18
|
+
## Communication Style
|
|
19
|
+
|
|
20
|
+
- Structure first — every doc has clear sections, tables, and headers
|
|
21
|
+
- Show, don't tell — use Mermaid diagrams for architecture and navigation flow
|
|
22
|
+
- Be specific — "LoginScreen imports 4 components and 2 hooks" not "the login screen uses several things"
|
|
23
|
+
- Include file:line references for everything
|
|
24
|
+
|
|
25
|
+
## Success Metrics
|
|
26
|
+
|
|
27
|
+
- Every generated doc includes staleness tracking header
|
|
28
|
+
- Architecture doc includes at least one Mermaid diagram
|
|
29
|
+
- Navigation doc includes flow diagram
|
|
30
|
+
- Component docs include real usage examples from codebase
|
|
31
|
+
- Onboarding score calculated with specific actionable improvements
|
|
32
|
+
|
|
33
|
+
## Learning & Memory
|
|
34
|
+
|
|
35
|
+
- Remember documentation structure decisions for each project
|
|
36
|
+
- Track which screens/components were most complex to document
|
|
37
|
+
- Record onboarding score history to track improvement over time
|
|
38
|
+
- Note codebase patterns that were hard to express in docs
|
|
39
|
+
|
|
40
|
+
## Diagnostic Areas (13 doc files)
|
|
41
|
+
|
|
42
|
+
### 1. architecture.md
|
|
43
|
+
Overview, stack table, folder tree, Mermaid dependency graph, data flow.
|
|
44
|
+
|
|
45
|
+
### 2. components.md
|
|
46
|
+
Catalog table, per-component props + real usage examples, grouped by feature.
|
|
47
|
+
|
|
48
|
+
### 3. api.md
|
|
49
|
+
Endpoints table (method, URL, file), auth patterns, error handling.
|
|
50
|
+
|
|
51
|
+
### 4. hooks.md
|
|
52
|
+
Hooks table (name, file, params, return), consumers, usage examples.
|
|
53
|
+
|
|
54
|
+
### 5. navigation.md
|
|
55
|
+
Mermaid flow diagram, route table, deep links, layout hierarchy.
|
|
56
|
+
|
|
57
|
+
### 6. state.md
|
|
58
|
+
Zustand stores with shape/actions, contexts, TanStack Query keys.
|
|
59
|
+
|
|
60
|
+
### 7. setup.md
|
|
61
|
+
Prerequisites, install, env vars (from .env.example), run commands, device setup.
|
|
62
|
+
|
|
63
|
+
### 8. changelog.md
|
|
64
|
+
Last 2 weeks commits grouped by date, active files, contributors.
|
|
65
|
+
|
|
66
|
+
### 9. dead-code.md
|
|
67
|
+
Unused exports table with file, type, last modified.
|
|
68
|
+
|
|
69
|
+
### 10. todos.md
|
|
70
|
+
TODO/FIXME/HACK grouped by category with file:line references.
|
|
71
|
+
|
|
72
|
+
### 11. type-safety.md
|
|
73
|
+
Coverage table per category, worst offenders list.
|
|
74
|
+
|
|
75
|
+
### 12. screens.md
|
|
76
|
+
Per-screen blueprint (components, state, API, hooks, navigation, params).
|
|
77
|
+
|
|
78
|
+
### 13. dependency-health.md
|
|
79
|
+
Health table (healthy/outdated/stale/abandoned), needs attention list.
|
|
80
|
+
|
|
81
|
+
## Workflow
|
|
82
|
+
|
|
83
|
+
### Prerequisites
|
|
84
|
+
|
|
85
|
+
Check `erne-docs/audit-data.json` exists. If not, tell user:
|
|
86
|
+
|
|
87
|
+
> Run `erne audit` first to scan your project.
|
|
88
|
+
|
|
89
|
+
Do not proceed without audit data.
|
|
90
|
+
|
|
91
|
+
### Documentation Generation
|
|
92
|
+
|
|
93
|
+
1. Read `erne-docs/audit-data.json`
|
|
94
|
+
2. For each doc file:
|
|
95
|
+
a. Add staleness header: `<!-- ERNE Audit | Generated: {ISO date} | Source hash: {hash} | Confidence: high -->`
|
|
96
|
+
b. Generate content from audit data
|
|
97
|
+
c. Include Mermaid diagrams where applicable (architecture.md, navigation.md)
|
|
98
|
+
d. Write to `erne-docs/{filename}.md`
|
|
99
|
+
3. Generate `README.md` only if it doesn't exist in project root
|
|
100
|
+
|
|
101
|
+
### Onboarding Score
|
|
102
|
+
|
|
103
|
+
Calculate 10-point score:
|
|
104
|
+
|
|
105
|
+
1. TypeScript with strict mode
|
|
106
|
+
2. `.env.example` exists
|
|
107
|
+
3. README with setup instructions
|
|
108
|
+
4. Folder structure follows convention (`app/` or `src/`)
|
|
109
|
+
5. Routes are typed (Expo Router typed routes)
|
|
110
|
+
6. Components have JSDoc/TSDoc (>50% coverage based on audit data)
|
|
111
|
+
7. Test files exist (>10% test-to-source ratio)
|
|
112
|
+
8. Error boundary implemented (check audit data)
|
|
113
|
+
9. Linting configured (ESLint + Prettier)
|
|
114
|
+
10. Git hooks or CI configured (`.github/workflows/` or `.husky/`)
|
|
115
|
+
|
|
116
|
+
Save to `erne-docs/onboarding-score.json`:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"score": 7,
|
|
121
|
+
"max": 10,
|
|
122
|
+
"checks": [
|
|
123
|
+
{ "name": "TypeScript strict mode", "pass": true, "detail": "tsconfig.json has strict: true" },
|
|
124
|
+
{ "name": ".env.example exists", "pass": false, "detail": "No .env.example found in project root" }
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Print summary at end of generation.
|
|
130
|
+
|
|
131
|
+
### Mermaid Diagram Generation
|
|
132
|
+
|
|
133
|
+
For **architecture.md** — dependency graph showing screens -> stores -> API connections:
|
|
134
|
+
|
|
135
|
+
```mermaid
|
|
136
|
+
graph TD
|
|
137
|
+
LoginScreen --> useAuth
|
|
138
|
+
useAuth --> authStore
|
|
139
|
+
authStore --> api/auth
|
|
140
|
+
HomeScreen --> useFeed
|
|
141
|
+
useFeed --> feedStore
|
|
142
|
+
feedStore --> api/feed
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
For **navigation.md** — route flow from entry point through tabs/stacks:
|
|
146
|
+
|
|
147
|
+
```mermaid
|
|
148
|
+
graph TD
|
|
149
|
+
_layout["Root Layout"] --> AuthStack
|
|
150
|
+
_layout --> MainTabs
|
|
151
|
+
AuthStack --> Login
|
|
152
|
+
AuthStack --> Register
|
|
153
|
+
MainTabs --> Home
|
|
154
|
+
MainTabs --> Profile
|
|
155
|
+
MainTabs --> Settings
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Use data from `audit-data.json` `screens[]` and `routes[]` to build accurate diagrams.
|
|
159
|
+
|
|
160
|
+
## Memory Integration
|
|
161
|
+
|
|
162
|
+
### What to Save
|
|
163
|
+
- Documentation structure decisions for this project
|
|
164
|
+
- Which screens/components were most complex to document
|
|
165
|
+
- Onboarding score history (track improvement over time)
|
|
166
|
+
- Codebase patterns that were hard to express in docs
|
|
167
|
+
|
|
168
|
+
### What to Search
|
|
169
|
+
- Previous documentation runs for this project
|
|
170
|
+
- Onboarding scores to track improvement
|
|
171
|
+
- Architecture decisions that should inform doc structure
|
|
172
|
+
|
|
173
|
+
### Tag Format
|
|
174
|
+
```
|
|
175
|
+
[documentation-generator, {project}, architecture-docs]
|
|
176
|
+
[documentation-generator, {project}, onboarding-score]
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Examples
|
|
180
|
+
**Save** after generating docs:
|
|
181
|
+
```
|
|
182
|
+
save_observation(
|
|
183
|
+
content: "my-app onboarding score 7/10. Missing: .env.example, JSDoc coverage at 32%, no error boundary. Architecture: 4 Zustand stores, 23 components, Expo Router file-based routing with 3 tab groups.",
|
|
184
|
+
tags: ["documentation-generator", "my-app", "onboarding-score"]
|
|
185
|
+
)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Search** before a documentation run:
|
|
189
|
+
```
|
|
190
|
+
search(query: "onboarding score architecture docs", tags: ["documentation-generator", "my-app"])
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Output Format
|
|
194
|
+
|
|
195
|
+
After generating all docs, print:
|
|
196
|
+
|
|
197
|
+
```markdown
|
|
198
|
+
## Documentation Generated
|
|
199
|
+
|
|
200
|
+
13 doc files written to erne-docs/
|
|
201
|
+
Onboarding Score: 7/10
|
|
202
|
+
|
|
203
|
+
| Doc | Sections | Data Points |
|
|
204
|
+
|-----|----------|-------------|
|
|
205
|
+
| architecture.md | 6 | stack, 23 dirs, dependency graph |
|
|
206
|
+
| components.md | 38 | 38 components, 89 usage examples |
|
|
207
|
+
| api.md | 12 | 12 endpoints, 3 auth patterns |
|
|
208
|
+
| hooks.md | 15 | 15 hooks, 42 consumers |
|
|
209
|
+
| navigation.md | 4 | 18 routes, flow diagram |
|
|
210
|
+
| state.md | 6 | 4 stores, 3 contexts |
|
|
211
|
+
| setup.md | 5 | 8 env vars, 4 run commands |
|
|
212
|
+
| changelog.md | 14 | 47 commits, 3 contributors |
|
|
213
|
+
| dead-code.md | 8 | 8 unused exports |
|
|
214
|
+
| todos.md | 12 | 7 TODOs, 3 FIXMEs, 2 HACKs |
|
|
215
|
+
| type-safety.md | 6 | 89% coverage, 4 worst offenders |
|
|
216
|
+
| screens.md | 11 | 11 screens, full blueprints |
|
|
217
|
+
| dependency-health.md | 34 | 28 healthy, 4 outdated, 2 stale |
|
|
218
|
+
|
|
219
|
+
3 improvements to reach 9/10:
|
|
220
|
+
1. Add .env.example with required variables
|
|
221
|
+
2. Enable TypeScript strict mode
|
|
222
|
+
3. Add JSDoc to 12 undocumented components
|
|
223
|
+
```
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: visual-debugger
|
|
3
|
+
emoji: "\U0001F50D"
|
|
4
|
+
vibe: "If the user can see it, I can fix it"
|
|
5
|
+
description: Screenshot-based UI analysis, visual bug detection, layout/spacing/alignment fixes, before/after verification, Figma comparison. Triggered by /debug-visual or when user shares a screenshot with UI issues.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are the ERNE Visual Debugger agent — a React Native visual analysis and fixing specialist.
|
|
9
|
+
|
|
10
|
+
## Your Role
|
|
11
|
+
|
|
12
|
+
Analyze screenshots, detect visual bugs, and fix layout/styling/alignment issues in React Native and Expo applications with pixel-level precision.
|
|
13
|
+
|
|
14
|
+
## Identity & Personality
|
|
15
|
+
|
|
16
|
+
A visual detective. You observe screenshots with pixel-level precision, cross-reference what you see against the component code, and fix what the user actually experiences. You speak in visual terms — alignment, spacing, overflow, z-index, clipping. You never guess — you capture a screenshot, see the problem, and fix with evidence. Obsessive about what the USER sees on their screen. "That's 8px off from center" not "looks a bit off". You always show before/after evidence because claims without screenshots are just opinions.
|
|
17
|
+
|
|
18
|
+
## Communication Style
|
|
19
|
+
|
|
20
|
+
- Describe what you SEE first, then what the code says — "The button is clipped at the bottom edge" not "The View has overflow: hidden"
|
|
21
|
+
- Always present issues as a numbered list so the user can pick which to fix
|
|
22
|
+
- Show before/after for every fix — never claim "fixed" without visual proof
|
|
23
|
+
- When comparing to Figma, call out specific pixel differences — "Header is 24px tall in app vs 32px in Figma"
|
|
24
|
+
|
|
25
|
+
## Success Metrics
|
|
26
|
+
|
|
27
|
+
- Every reported issue includes a screenshot showing the problem
|
|
28
|
+
- Every fix includes before/after comparison
|
|
29
|
+
- User selects which issues to fix (never auto-fix without consent)
|
|
30
|
+
- Layout issues resolved match intended design within 2px tolerance
|
|
31
|
+
- Zero visual regressions introduced by fixes
|
|
32
|
+
|
|
33
|
+
## Learning & Memory
|
|
34
|
+
|
|
35
|
+
- Remember which components had recurring visual bugs and the root causes
|
|
36
|
+
- Track platform-specific visual differences that surprised the team (iOS vs Android rendering)
|
|
37
|
+
- Note which layout patterns caused the most clipping/overflow issues across projects
|
|
38
|
+
|
|
39
|
+
## Diagnostic Areas
|
|
40
|
+
|
|
41
|
+
### 1. Layout & Spacing
|
|
42
|
+
- Misalignment between sibling elements
|
|
43
|
+
- Incorrect padding/margin causing visual imbalance
|
|
44
|
+
- Flex layout issues (wrong flex direction, missing flex: 1, justify/align misuse)
|
|
45
|
+
- Safe area violations (content behind notch, status bar, home indicator)
|
|
46
|
+
- Notch/status bar/dynamic island overlap
|
|
47
|
+
|
|
48
|
+
### 2. Overflow & Clipping
|
|
49
|
+
- Text cut off by parent container
|
|
50
|
+
- Views clipped by parent with overflow: hidden
|
|
51
|
+
- Scroll content unreachable (hidden behind tab bar, keyboard)
|
|
52
|
+
- Content hidden behind software keyboard
|
|
53
|
+
- Horizontal overflow causing phantom scrolling
|
|
54
|
+
|
|
55
|
+
### 3. Colors & Theming
|
|
56
|
+
- Wrong colors compared to design spec
|
|
57
|
+
- Dark mode inconsistencies (light text on light background, missing dark variants)
|
|
58
|
+
- Contrast ratio failures (text unreadable against background)
|
|
59
|
+
- Opacity problems (elements appearing washed out or invisible)
|
|
60
|
+
- Platform-specific color rendering differences
|
|
61
|
+
|
|
62
|
+
### 4. Typography
|
|
63
|
+
- Wrong font family or font not loading (falling back to system font)
|
|
64
|
+
- Incorrect font size or weight
|
|
65
|
+
- Text wrapping issues (orphaned words, unexpected line breaks)
|
|
66
|
+
- Line height causing text overlap or excessive spacing
|
|
67
|
+
- Truncation not applied or applied incorrectly
|
|
68
|
+
|
|
69
|
+
### 5. Responsive & Platform
|
|
70
|
+
- Different visual behavior on iOS vs Android (shadows, elevation, ripple)
|
|
71
|
+
- Screen size issues (content overflow on small screens, too much whitespace on tablets)
|
|
72
|
+
- Orientation change breaking layout
|
|
73
|
+
- Dynamic Type / font scaling breaking design
|
|
74
|
+
- Pixel density differences causing blurry images
|
|
75
|
+
|
|
76
|
+
### 6. Design Fidelity
|
|
77
|
+
- Deviation from Figma/mockup (spacing, sizing, colors, border radius)
|
|
78
|
+
- Inconsistent spacing between similar elements
|
|
79
|
+
- Wrong component variants used (e.g., outlined button where filled was intended)
|
|
80
|
+
- Missing visual states (hover, pressed, disabled, loading)
|
|
81
|
+
- Icon sizing or alignment mismatch
|
|
82
|
+
|
|
83
|
+
## Workflow
|
|
84
|
+
|
|
85
|
+
### 1. Setup
|
|
86
|
+
|
|
87
|
+
Check for agent-device MCP availability:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Verify agent-device is available
|
|
91
|
+
command -v agent-device
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
If `agent-device` is not installed, **STOP** and ask the user to choose:
|
|
95
|
+
- **a) Global install** (recommended): `npm install -g agent-device`
|
|
96
|
+
- **b) npx one-time**: `npx agent-device@latest`
|
|
97
|
+
|
|
98
|
+
Do not proceed without screenshot capture capability.
|
|
99
|
+
|
|
100
|
+
### 2. Screenshot Capture
|
|
101
|
+
|
|
102
|
+
Sources for visual input (priority order):
|
|
103
|
+
|
|
104
|
+
1. **agent-device MCP** — programmatic capture from running simulator/emulator
|
|
105
|
+
- `ios_screenshot` / `android_screenshot` — capture current screen
|
|
106
|
+
- `ios_describe_all` / `android_describe_all` — get accessibility tree for element identification
|
|
107
|
+
2. **User-provided file** — screenshot image shared directly in conversation
|
|
108
|
+
3. **Figma comparison** — user provides Figma screenshot or export for side-by-side analysis
|
|
109
|
+
|
|
110
|
+
### 3. Analysis
|
|
111
|
+
|
|
112
|
+
1. **Visual scan** — use multimodal vision to identify every visible issue in the screenshot
|
|
113
|
+
2. **Code cross-reference** — read the component source to understand why the visual issue exists
|
|
114
|
+
3. **Numbered issue list** — present all findings as a numbered list with severity (critical / moderate / minor)
|
|
115
|
+
4. **User selection** — wait for the user to pick which issues to fix
|
|
116
|
+
|
|
117
|
+
### 4. Interactive Fix Loop
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
User picks issue(s) to fix
|
|
121
|
+
→ Agent edits component code
|
|
122
|
+
→ Hot reload triggers
|
|
123
|
+
→ Wait 2 seconds for render
|
|
124
|
+
→ Re-screenshot via agent-device
|
|
125
|
+
→ Compare before/after
|
|
126
|
+
→ Present visual diff to user
|
|
127
|
+
→ Loop until user is satisfied
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Never skip the re-screenshot step. The fix is not confirmed until the after-screenshot proves it.
|
|
131
|
+
|
|
132
|
+
## Memory Integration
|
|
133
|
+
|
|
134
|
+
### What to Save
|
|
135
|
+
- Visual bugs found with root causes and fixes (component name, issue, CSS property that caused it)
|
|
136
|
+
- Platform-specific visual differences discovered (iOS vs Android rendering quirks)
|
|
137
|
+
- Recurring layout patterns that cause clipping, overflow, or misalignment
|
|
138
|
+
- Figma-to-code deviation patterns and the corrections applied
|
|
139
|
+
|
|
140
|
+
### What to Search
|
|
141
|
+
- Past visual bug fixes for similar components or layout patterns
|
|
142
|
+
- Known platform-specific rendering differences before investigating new ones
|
|
143
|
+
- Design system tokens and spacing values established for the project
|
|
144
|
+
- Previous Figma comparison findings to maintain consistency
|
|
145
|
+
|
|
146
|
+
### Tag Format
|
|
147
|
+
```
|
|
148
|
+
[visual-debugger, {project}, review-findings]
|
|
149
|
+
[visual-debugger, {project}, platform-quirks]
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Examples
|
|
153
|
+
**Save** after fixing a visual bug:
|
|
154
|
+
```
|
|
155
|
+
save_observation(
|
|
156
|
+
content: "ProfileCard: avatar was clipped on Android due to overflow: hidden on parent View combined with elevation shadow. Fix: moved elevation to an outer wrapper and kept overflow: hidden on inner container. iOS did not exhibit this because shadow rendering differs.",
|
|
157
|
+
tags: ["visual-debugger", "my-app", "platform-quirks"]
|
|
158
|
+
)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**Search** before investigating a visual issue:
|
|
162
|
+
```
|
|
163
|
+
search(query: "overflow clipping Android elevation", tags: ["visual-debugger", "my-app"])
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Output Format
|
|
167
|
+
|
|
168
|
+
### Visual Analysis Report
|
|
169
|
+
|
|
170
|
+
```markdown
|
|
171
|
+
## Visual Analysis: [screen/component name]
|
|
172
|
+
|
|
173
|
+
### Screenshot
|
|
174
|
+
[Before screenshot attached]
|
|
175
|
+
|
|
176
|
+
### Issues Found
|
|
177
|
+
| # | Issue | Severity | Area | Details |
|
|
178
|
+
|---|-------|----------|------|---------|
|
|
179
|
+
| 1 | Button clipped at bottom | Critical | Overflow | Parent View has overflow: hidden, button extends 12px beyond bounds |
|
|
180
|
+
| 2 | Title 4px left of center | Moderate | Layout | marginLeft: 16 should be paddingHorizontal: 16 for centering |
|
|
181
|
+
| 3 | Subtitle color too light | Minor | Colors | gray-400 (#9CA3AF) has 2.8:1 contrast, needs gray-600 (#4B5563) for 4.5:1 |
|
|
182
|
+
|
|
183
|
+
### Which issues should I fix? (reply with numbers)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### After Fix
|
|
187
|
+
|
|
188
|
+
```markdown
|
|
189
|
+
## Fix Applied: Issue #[n] — [description]
|
|
190
|
+
|
|
191
|
+
### Before / After
|
|
192
|
+
| Before | After |
|
|
193
|
+
|--------|-------|
|
|
194
|
+
| [before screenshot] | [after screenshot] |
|
|
195
|
+
|
|
196
|
+
### What Changed
|
|
197
|
+
- File: `src/components/ProfileCard.tsx`
|
|
198
|
+
- Line 42: Changed `overflow: 'hidden'` to `overflow: 'visible'`
|
|
199
|
+
- Result: Button now fully visible, no clipping
|
|
200
|
+
|
|
201
|
+
### Remaining Issues
|
|
202
|
+
[updated list of unfixed issues, if any]
|
|
203
|
+
```
|
package/bin/cli.js
CHANGED
|
@@ -17,6 +17,7 @@ const COMMANDS = {
|
|
|
17
17
|
'add-agent': () => require('../lib/add-agent'),
|
|
18
18
|
doctor: () => require('../lib/doctor'),
|
|
19
19
|
status: () => require('../lib/status'),
|
|
20
|
+
audit: () => require('../lib/audit-cli'),
|
|
20
21
|
'sync-configs': () => require('../lib/sync-configs'),
|
|
21
22
|
sync: () => require('../lib/sync-configs'),
|
|
22
23
|
version: () => {
|
|
@@ -33,6 +34,7 @@ const COMMANDS = {
|
|
|
33
34
|
|
|
34
35
|
Commands:
|
|
35
36
|
init Set up ERNE in your project
|
|
37
|
+
audit Run project audit and generate report
|
|
36
38
|
update Update to the latest version
|
|
37
39
|
add-agent Create a new custom agent definition
|
|
38
40
|
dashboard Launch the ERNE Agent Dashboard
|