@zoldia/omnigraph 1.2.0 → 1.3.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/README.md CHANGED
@@ -12,19 +12,30 @@ OmniGraph is a free, local developer tool that statically analyzes full-stack mo
12
12
  | **JavaScript** | `.js`, `.jsx` | CommonJS and ES module imports |
13
13
  | **Python** | `.py` | FastAPI (`@router.get`, `@app.post`), Flask (`@app.route`), Django (Views, Models) |
14
14
  | **PHP** | `.php` | Laravel (Controllers, Models, Middleware, Route definitions) |
15
+ | **Go** | `.go` | net/http, Gin, Echo, Fiber, Chi, Gorilla Mux handlers |
16
+ | **Rust** | `.rs` | Actix-web, Axum, Rocket route handlers |
17
+ | **Java** | `.java` | Spring Boot (`@RestController`, `@Service`, `@Repository`, `@GetMapping`) |
18
+ | **OpenAPI** | `.json`, `.yaml` | Swagger/OpenAPI path endpoints and schema models |
19
+ | **GraphQL** | `.graphql`, `.gql` | Type definitions, Query/Mutation/Subscription fields |
15
20
  | **Markdown** | `.md`, `.mdx` | Obsidian wiki-links (`[[Page]]`), embeds (`![[Page]]`), frontmatter tags/aliases |
16
21
 
17
22
  ## Quick Start
18
23
 
19
- **Prerequisites:** Node.js >= 18
24
+ **Prerequisites:** Node.js >= 18, npm >= 9
20
25
 
21
26
  ```bash
22
- # Run directly with npx (no install needed)
23
- npx @zoldia/omnigraph --path /path/to/your/project
27
+ # Clone the repository
28
+ git clone https://github.com/RMV-Coder/OmniGraph.git
29
+ cd OmniGraph
24
30
 
25
- # Or install globally
26
- npm install -g @zoldia/omnigraph
27
- omnigraph --path /path/to/your/project
31
+ # Install dependencies
32
+ npm install
33
+
34
+ # Build all packages
35
+ npm run build
36
+
37
+ # Analyze a repository
38
+ npm run dev -- --path ../my-project
28
39
  ```
29
40
 
30
41
  Then open `http://localhost:4000` in your browser.
@@ -35,6 +46,7 @@ Then open `http://localhost:4000` in your browser.
35
46
  # Start the visualization server (default action)
36
47
  omnigraph --path <repo-path> # Starts server on port 4000
37
48
  omnigraph --path <repo-path> serve --port 8080 # Custom port
49
+ omnigraph --path <repo-path> --watch # Live watch mode (auto-refresh on file changes)
38
50
 
39
51
  # Query the dependency graph
40
52
  omnigraph --path <repo-path> graph --stats # Summary statistics
@@ -56,15 +68,22 @@ omnigraph --path <repo-path> fetch --url http://localhost:3000/api/users \
56
68
  omnigraph --path <repo-path> schema --fk
57
69
  omnigraph --path <repo-path> schema --table users
58
70
 
71
+ # Diff / blast radius analysis
72
+ omnigraph --path <repo-path> diff # Changed files vs main branch
73
+ omnigraph --path <repo-path> diff --uncommitted # Uncommitted changes only
74
+ omnigraph --path <repo-path> diff --base develop --depth 3 # Custom base, BFS depth
75
+ omnigraph --path <repo-path> diff --blast-only # Only show affected dependents
76
+
59
77
  # Machine-readable JSON output (for AI coding agents)
60
78
  omnigraph --path <repo-path> --json graph --stats
61
79
  omnigraph --path <repo-path> --json trace --from src/index.ts
80
+ omnigraph --path <repo-path> --json diff --uncommitted
62
81
  ```
63
82
 
64
83
  ## Features
65
84
 
66
85
  ### Multi-Language Dependency Graph
67
- Point OmniGraph at any project containing TypeScript, JavaScript, Python, PHP, or Markdown files. It recursively walks the directory, respects `.gitignore`, and builds a dependency graph from import/require statements and wiki-links.
86
+ Point OmniGraph at any project containing TypeScript, JavaScript, Python, PHP, Go, Rust, Java, OpenAPI, GraphQL, or Markdown files. It recursively walks the directory, respects `.gitignore`, and builds a dependency graph from import/require statements and wiki-links.
68
87
 
69
88
  ### Framework-Aware Parsing
70
89
  OmniGraph doesn't just find imports — it understands framework patterns:
@@ -73,6 +92,11 @@ OmniGraph doesn't just find imports — it understands framework patterns:
73
92
  - **FastAPI/Flask**: Detects route decorators (`@router.get("/users")`) with HTTP methods and paths
74
93
  - **Django**: Detects class-based views (`APIView`, `ViewSet`) and models
75
94
  - **Laravel**: Detects controllers, models, middleware, and `Route::get()` definitions
95
+ - **Go**: Detects HTTP handlers for net/http, Gin, Echo, Fiber, Chi, and Gorilla Mux
96
+ - **Rust**: Detects route attributes for Actix-web, Axum, and Rocket (`#[get("/path")]`)
97
+ - **Java/Spring**: Detects `@RestController`, `@Service`, `@Repository` stereotypes and `@GetMapping`/`@PostMapping` routes
98
+ - **OpenAPI/Swagger**: Extracts path endpoints and schema models from `.json`/`.yaml` specs
99
+ - **GraphQL**: Extracts type definitions and Query/Mutation/Subscription fields
76
100
  - **Obsidian/Markdown**: Detects wiki-links (`[[Page]]`), embeds (`![[Page]]`), YAML frontmatter (tags, aliases), and classifies MOC/daily/readme note types
77
101
 
78
102
  ### Interactive Visualization
@@ -83,9 +107,27 @@ OmniGraph doesn't just find imports — it understands framework patterns:
83
107
  - **Hub-Centric Compaction**: After filtering, compact visible nodes around the most-connected hub node(s) using d3-force. Single hub stays pinned; multiple hubs meet at their average position.
84
108
  - **Node Inspector**: Click any node to see its file path, type, route metadata, and ID in the sidebar. Expand file nodes into individual method-level nodes.
85
109
  - **Database ERD**: DB tables connected via foreign key edges (ERD-style). Click an API route to highlight all connected DB tables.
86
- - **Color-Coded Types**: Each node type has a distinct color — controllers (red), injectables (blue), modules (orange), Python files (blue), FastAPI routes (teal), Laravel controllers (red), markdown (purple), DB tables (steel-blue), and more
110
+ - **Dark/Light Theme**: System-aware theme toggle with dark (default) and light modes. Persisted in localStorage.
111
+ - **Color-Coded Types**: Each node type has a distinct color — controllers (red), injectables (blue), modules (orange), Python files (blue), FastAPI routes (teal), Laravel controllers (red), Go files (cyan), Rust files (sandy), Java/Spring (green), OpenAPI (lime), GraphQL (pink), markdown (purple), DB tables (steel-blue), and more
87
112
  - **Clickable Minimap**: Zoom and pan directly on the minimap for faster navigation
88
113
 
114
+ ### Live Watch Mode
115
+ Start with `--watch` to enable live file watching. OmniGraph monitors your project for changes and automatically re-parses and pushes updates to the UI via Server-Sent Events (SSE). No manual refresh needed.
116
+
117
+ ### Keyboard Shortcuts
118
+ - `Ctrl+K` / `⌘K` — Focus search
119
+ - `1`–`6` — Switch layout presets
120
+ - `C` — Compact visible nodes
121
+ - `?` — Show shortcut help overlay
122
+ - `Esc` — Close panels and overlays
123
+
124
+ ### Bookmarks & Annotations
125
+ - **Bookmarks** — Save named graph views (layout, search query, active filters, depth) and restore them instantly. Export/import as JSON.
126
+ - **Annotations** — Attach text notes to any node. Annotations persist in localStorage and can be exported/imported.
127
+
128
+ ### Diff & Blast Radius
129
+ The `diff` command analyzes which files changed between git refs (or uncommitted changes) and computes a blast radius — the set of files transitively affected by those changes via the dependency graph. Useful for estimating the impact of a PR.
130
+
89
131
  ### CLI for Humans and AI Agents
90
132
  All CLI commands support `--json` for machine-readable output, designed for AI coding agents (Claude Code, Cursor, etc.):
91
133
  - **`graph`** — Query nodes, edges, dependencies, reverse dependencies, stats
@@ -93,6 +135,7 @@ All CLI commands support `--json` for machine-readable output, designed for AI c
93
135
  - **`fetch`** — HTTP client with `.env` token resolution (like curl/Postman)
94
136
  - **`methods`** — List functions/methods in a file with filters
95
137
  - **`schema`** — Inspect database tables, foreign keys, code references
138
+ - **`diff`** — Git diff analysis with blast radius computation
96
139
 
97
140
  ### Export
98
141
  - **PNG** — 2x resolution raster image
@@ -102,25 +145,33 @@ All CLI commands support `--json` for machine-readable output, designed for AI c
102
145
 
103
146
  ### Sidebar Tabs
104
147
  The right sidebar has four tabs:
105
- - **Graph** — Layout selector (6 presets), search/filter with depth slider, type chips, node inspector with method expansion, export dropdown, compact button
148
+ - **Graph** — Layout selector (6 presets), search/filter with depth slider, type chips, node inspector with method expansion, bookmarks, export dropdown, compact button
106
149
  - **API** — Postman-style API debugger with configurable base URL (auto-fills from cross-network edges)
107
150
  - **Trace** — Step-through flow tracer with Back/Next navigation, animated highlighting, and database query/join/result steps
108
- - **Settings** — Configurable edge labels (show/hide per type, color, font size), graph options (minimap, edge animation, FK labels), search defaults, with per-category reset and localStorage persistence
151
+ - **Settings** — Theme toggle (system/dark/light), configurable edge labels (show/hide per type, color, font size), graph options (minimap, edge animation, FK labels), search defaults, with per-category reset and localStorage persistence
109
152
 
110
153
  ## Technology Stack
111
154
 
112
155
  | Component | Technology |
113
156
  |-----------|-----------|
157
+ | Monorepo | npm workspaces (5 packages) |
114
158
  | CLI | Node.js + TypeScript + Commander.js |
115
- | Server | Express.js with rate limiting |
159
+ | Server | Express.js with rate limiting + SSE watch mode |
116
160
  | TypeScript/JS Parser | `@typescript-eslint/typescript-estree` |
117
161
  | Python Parser | Regex-based AST extraction |
118
162
  | PHP Parser | Regex-based AST extraction |
163
+ | Go Parser | Regex-based (imports, structs, HTTP handlers) |
164
+ | Rust Parser | Regex-based (mod/use, structs, route attributes) |
165
+ | Java Parser | Regex-based (imports, Spring annotations) |
166
+ | OpenAPI Parser | JSON.parse + line-based YAML extraction |
167
+ | GraphQL Parser | Regex-based type/field extraction |
119
168
  | Markdown Parser | Regex-based wiki-link/embed/frontmatter extraction |
120
169
  | Frontend | React 18 + Vite |
121
170
  | Graph Engine | React Flow |
122
171
  | Layout Engines | dagre (hierarchical/mind map), d3-force (force-directed, compaction), custom column flow |
172
+ | Theming | CSS custom properties with system/dark/light modes |
123
173
  | GIF Export | gif.js (web worker encoding) |
174
+ | Testing | Vitest |
124
175
 
125
176
  ## Architecture
126
177
 
@@ -131,6 +182,36 @@ CLI (@omnigraph/cli) → Server (@omnigraph/server) → Parsers (@omnigraph/pars
131
182
 
132
183
  **Data flow:** Filesystem → AST parsing → OmniGraph model (nodes/edges) → JSON API (`/api/graph`) → React Flow UI
133
184
 
185
+ ## How to Add a New Language Parser
186
+
187
+ OmniGraph is extensible by design. To add support for a new language or framework:
188
+
189
+ 1. Create a new file in `packages/parsers/src/<language>/<language>-parser.ts`
190
+ 2. Implement the `IParser` interface:
191
+ ```typescript
192
+ import { IParser } from '../IParser';
193
+ import { OmniGraph } from '../types';
194
+
195
+ export class MyLanguageParser implements IParser {
196
+ canHandle(filePath: string): boolean {
197
+ return /\.mylang$/.test(filePath);
198
+ }
199
+
200
+ parse(filePath: string, source: string): Partial<OmniGraph> {
201
+ // Extract nodes and edges from source code
202
+ return { nodes: [...], edges: [...] };
203
+ }
204
+ }
205
+ ```
206
+ 3. Register your parser in `packages/parsers/src/parser-registry.ts`:
207
+ ```typescript
208
+ import { MyLanguageParser } from './mylanguage/mylanguage-parser';
209
+ const parsers: IParser[] = [..., new MyLanguageParser()];
210
+ ```
211
+ 4. Add node colors in `packages/ui/src/layout/shared.ts` and labels in `packages/ui/src/components/Sidebar.tsx`
212
+
213
+ No changes to the server, CLI, or graph engine are needed — the plugin architecture handles the rest.
214
+
134
215
  ## Omni JSON Schema
135
216
 
136
217
  All parsers produce a standardized graph format regardless of source language:
@@ -159,11 +240,42 @@ All parsers produce a standardized graph format regardless of source language:
159
240
  }
160
241
  ```
161
242
 
162
- ## Links
243
+ ## Running Tests
244
+
245
+ ```bash
246
+ npx vitest run # Run all tests
247
+ npx vitest --watch # Watch mode
248
+ ```
249
+
250
+ ## Contributing
251
+
252
+ Contributions are welcome! Here's how to get started:
253
+
254
+ 1. **Fork the repo** and create a feature branch
255
+ 2. **Install dependencies**: `npm install`
256
+ 3. **Build**: `npm run build`
257
+ 4. **Run tests**: `npx vitest run` — make sure all tests pass
258
+ 5. **Submit a PR** with a clear description of what you changed and why
259
+
260
+ ### Good First Issues
261
+
262
+ - Add a new language parser (C#, Ruby, Swift, Kotlin)
263
+ - Improve import resolution for edge cases (barrel exports, dynamic imports)
264
+ - Add Dockerfile / docker-compose parsing
265
+ - Terraform / infrastructure-as-code graph support
266
+
267
+ ## Project Documentation
163
268
 
164
- - [GitHub Repository](https://github.com/RMV-Coder/OmniGraph)
165
- - [Changelog](https://github.com/RMV-Coder/OmniGraph/blob/main/CHANGELOG.md)
166
- - [API Specification](https://github.com/RMV-Coder/OmniGraph/blob/main/docs/API-SPEC.md)
269
+ | Document | Description |
270
+ |----------|-------------|
271
+ | [PRD](docs/PRD.md) | Product requirements, feature status, and roadmap |
272
+ | [SAD](docs/SAD.md) | Software architecture, data flow, and design decisions |
273
+ | [ADR-001](docs/adr/ADR-001-parsing-engine.md) | Why typescript-estree for Phase 1 |
274
+ | [ADR-002](docs/adr/ADR-002-phase2-multi-language-parsing.md) | Why regex-based parsing for Phase 2 Python/PHP |
275
+ | [ADR-003](docs/adr/ADR-003-markdown-obsidian-parser.md) | Markdown/Obsidian wiki-link parser design |
276
+ | [ADR-004](docs/adr/ADR-004-database-integration.md) | Database integration architecture |
277
+ | [API Spec](docs/API-SPEC.md) | HTTP endpoint and CLI interface documentation |
278
+ | [Changelog](CHANGELOG.md) | Detailed release changelog |
167
279
 
168
280
  ## License
169
281