@zoldia/omnigraph 1.0.0 → 1.2.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
@@ -8,79 +8,119 @@ OmniGraph is a free, local developer tool that statically analyzes full-stack mo
8
8
 
9
9
  | Language | Extensions | Framework Detection |
10
10
  |----------|-----------|-------------------|
11
- | **TypeScript** | `.ts`, `.tsx` | NestJS (`@Controller`, `@Injectable`, `@Module`) |
11
+ | **TypeScript** | `.ts`, `.tsx` | NestJS (`@Controller`, `@Injectable`, `@Module`), Next.js (App Router, Pages Router) |
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
+ | **Markdown** | `.md`, `.mdx` | Obsidian wiki-links (`[[Page]]`), embeds (`![[Page]]`), frontmatter tags/aliases |
15
16
 
16
17
  ## Quick Start
17
18
 
18
- **Prerequisites:** Node.js >= 18, npm >= 9
19
+ **Prerequisites:** Node.js >= 18
19
20
 
20
21
  ```bash
21
- # Clone the repository
22
- git clone https://github.com/RMV-Coder/OmniGraph.git
23
- cd OmniGraph
22
+ # Run directly with npx (no install needed)
23
+ npx @zoldia/omnigraph --path /path/to/your/project
24
24
 
25
- # Install dependencies
26
- npm install
25
+ # Or install globally
26
+ npm install -g @zoldia/omnigraph
27
+ omnigraph --path /path/to/your/project
28
+ ```
27
29
 
28
- # Build all packages
29
- npm run build
30
+ Then open `http://localhost:4000` in your browser.
30
31
 
31
- # Analyze a repository
32
- npm run dev -- --path ../my-project
33
- ```
32
+ ### CLI Commands
33
+
34
+ ```bash
35
+ # Start the visualization server (default action)
36
+ omnigraph --path <repo-path> # Starts server on port 4000
37
+ omnigraph --path <repo-path> serve --port 8080 # Custom port
34
38
 
35
- Then open `http://localhost:3000` in your browser.
39
+ # Query the dependency graph
40
+ omnigraph --path <repo-path> graph --stats # Summary statistics
41
+ omnigraph --path <repo-path> graph --node src/index.ts # Inspect a node
42
+ omnigraph --path <repo-path> graph --deps src/index.ts # Transitive dependencies
43
+ omnigraph --path <repo-path> graph --filter nextjs-api-route # Filter by type
36
44
 
37
- ### CLI Options
45
+ # Trace data flow
46
+ omnigraph --path <repo-path> trace --from src/app/api/users/route.ts
38
47
 
39
- ```
40
- omnigraph --path <repo-path> # Required: path to the repo to analyze
41
- omnigraph --path <repo-path> --port 4000 # Optional: custom port (default 3000)
48
+ # List methods in a file
49
+ omnigraph --path <repo-path> methods --file src/lib/auth.ts --exported
50
+
51
+ # Make HTTP requests (like curl/Postman)
52
+ omnigraph --path <repo-path> fetch --url http://localhost:3000/api/users \
53
+ --method POST --body '{"email":"test@test.com"}' --env-token AUTH_TOKEN
54
+
55
+ # Inspect database schema from graph
56
+ omnigraph --path <repo-path> schema --fk
57
+ omnigraph --path <repo-path> schema --table users
58
+
59
+ # Machine-readable JSON output (for AI coding agents)
60
+ omnigraph --path <repo-path> --json graph --stats
61
+ omnigraph --path <repo-path> --json trace --from src/index.ts
42
62
  ```
43
63
 
44
64
  ## Features
45
65
 
46
66
  ### Multi-Language Dependency Graph
47
- Point OmniGraph at any project containing TypeScript, JavaScript, Python, or PHP files. It recursively walks the directory, respects `.gitignore`, and builds a dependency graph from import/require statements.
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.
48
68
 
49
69
  ### Framework-Aware Parsing
50
70
  OmniGraph doesn't just find imports — it understands framework patterns:
51
71
  - **NestJS**: Detects `@Controller`, `@Injectable`, `@Module` decorators with route metadata
72
+ - **Next.js**: Detects App Router (`route.ts`, `page.tsx`, `layout.tsx`) and Pages Router (`pages/api/`)
52
73
  - **FastAPI/Flask**: Detects route decorators (`@router.get("/users")`) with HTTP methods and paths
53
74
  - **Django**: Detects class-based views (`APIView`, `ViewSet`) and models
54
75
  - **Laravel**: Detects controllers, models, middleware, and `Route::get()` definitions
76
+ - **Obsidian/Markdown**: Detects wiki-links (`[[Page]]`), embeds (`![[Page]]`), YAML frontmatter (tags, aliases), and classifies MOC/daily/readme note types
55
77
 
56
78
  ### Interactive Visualization
57
- - **5 Layout Presets**: Directory (grouped by folder), Hierarchical, Force-Directed, Grid, Mind Map (LR/RL)
79
+ - **6 Layout Presets**: Directory (grouped by folder), Hierarchical, Column Flow (Frontend/API/Services/Database), Force-Directed, Grid, Mind Map (LR/RL)
80
+ - **Column Flow Layout**: Top-to-bottom layout with 4 columns. Nodes are auto-classified by type and file path. Column-aware compaction preserves columns while collapsing vertical gaps.
58
81
  - **Live Force Simulation**: In force-directed mode, dragging a node causes nearby nodes to push and pull reactively via d3-force physics
59
- - **Search & Filter**: Search nodes by name, filter by type with color-coded toggle chips
60
- - **Node Inspector**: Click any node to see its file path, type, route metadata, and ID in the sidebar
61
- - **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), and more
62
-
63
- ### Sidebar Controls
64
- All controls live in a clean right sidebar:
65
- - Layout preset selector with mind map direction toggle
66
- - Real-time search with match count
67
- - Type filter chips with color legend
68
- - Node inspector panel below a divider
82
+ - **Search & Filter with BFS Expansion**: Search nodes by name, filter by type with color-coded toggle chips. Hide or dim non-matching nodes. Connected nodes expand via BFS depth slider to reveal full data flow paths.
83
+ - **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
+ - **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
+ - **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
87
+ - **Clickable Minimap**: Zoom and pan directly on the minimap for faster navigation
88
+
89
+ ### CLI for Humans and AI Agents
90
+ All CLI commands support `--json` for machine-readable output, designed for AI coding agents (Claude Code, Cursor, etc.):
91
+ - **`graph`** Query nodes, edges, dependencies, reverse dependencies, stats
92
+ - **`trace`** — Trace data flow from a file through HTTP calls to database queries
93
+ - **`fetch`** — HTTP client with `.env` token resolution (like curl/Postman)
94
+ - **`methods`** — List functions/methods in a file with filters
95
+ - **`schema`** — Inspect database tables, foreign keys, code references
96
+
97
+ ### Export
98
+ - **PNG** — 2x resolution raster image
99
+ - **SVG** — Scalable vector graphic
100
+ - **JSON** — Raw OmniGraph data
101
+ - **GIF** — 1-second animated GIF (30fps) showing edge flow direction with a progress overlay
102
+
103
+ ### Sidebar Tabs
104
+ 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
106
+ - **API** — Postman-style API debugger with configurable base URL (auto-fills from cross-network edges)
107
+ - **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
69
109
 
70
110
  ## Technology Stack
71
111
 
72
112
  | Component | Technology |
73
113
  |-----------|-----------|
74
- | Monorepo | npm workspaces (5 packages) |
75
114
  | CLI | Node.js + TypeScript + Commander.js |
76
115
  | Server | Express.js with rate limiting |
77
116
  | TypeScript/JS Parser | `@typescript-eslint/typescript-estree` |
78
117
  | Python Parser | Regex-based AST extraction |
79
118
  | PHP Parser | Regex-based AST extraction |
119
+ | Markdown Parser | Regex-based wiki-link/embed/frontmatter extraction |
80
120
  | Frontend | React 18 + Vite |
81
121
  | Graph Engine | React Flow |
82
- | Layout Engines | dagre (hierarchical/mind map), d3-force (force-directed) |
83
- | Testing | Vitest |
122
+ | Layout Engines | dagre (hierarchical/mind map), d3-force (force-directed, compaction), custom column flow |
123
+ | GIF Export | gif.js (web worker encoding) |
84
124
 
85
125
  ## Architecture
86
126
 
@@ -91,36 +131,6 @@ CLI (@omnigraph/cli) → Server (@omnigraph/server) → Parsers (@omnigraph/pars
91
131
 
92
132
  **Data flow:** Filesystem → AST parsing → OmniGraph model (nodes/edges) → JSON API (`/api/graph`) → React Flow UI
93
133
 
94
- ## How to Add a New Language Parser
95
-
96
- OmniGraph is extensible by design. To add support for a new language or framework:
97
-
98
- 1. Create a new file in `packages/parsers/src/<language>/<language>-parser.ts`
99
- 2. Implement the `IParser` interface:
100
- ```typescript
101
- import { IParser } from '../IParser';
102
- import { OmniGraph } from '../types';
103
-
104
- export class MyLanguageParser implements IParser {
105
- canHandle(filePath: string): boolean {
106
- return /\.mylang$/.test(filePath);
107
- }
108
-
109
- parse(filePath: string, source: string): Partial<OmniGraph> {
110
- // Extract nodes and edges from source code
111
- return { nodes: [...], edges: [...] };
112
- }
113
- }
114
- ```
115
- 3. Register your parser in `packages/parsers/src/parser-registry.ts`:
116
- ```typescript
117
- import { MyLanguageParser } from './mylanguage/mylanguage-parser';
118
- const parsers: IParser[] = [..., new MyLanguageParser()];
119
- ```
120
- 4. Add node colors in `packages/ui/src/layout/shared.ts` and labels in `packages/ui/src/components/Sidebar.tsx`
121
-
122
- No changes to the server, CLI, or graph engine are needed — the plugin architecture handles the rest.
123
-
124
134
  ## Omni JSON Schema
125
135
 
126
136
  All parsers produce a standardized graph format regardless of source language:
@@ -149,39 +159,11 @@ All parsers produce a standardized graph format regardless of source language:
149
159
  }
150
160
  ```
151
161
 
152
- ## Running Tests
153
-
154
- ```bash
155
- npx vitest run # Run all tests (56 tests across 6 files)
156
- npx vitest --watch # Watch mode
157
- ```
158
-
159
- ## Contributing
160
-
161
- Contributions are welcome! Here's how to get started:
162
-
163
- 1. **Fork the repo** and create a feature branch
164
- 2. **Install dependencies**: `npm install`
165
- 3. **Build**: `npm run build`
166
- 4. **Run tests**: `npx vitest run` — make sure all tests pass
167
- 5. **Submit a PR** with a clear description of what you changed and why
168
-
169
- ### Good First Issues
170
-
171
- - Add a new language parser (Go, Rust, Java, C#, Ruby)
172
- - Add export functionality (SVG, PNG, JSON)
173
- - Improve import resolution for edge cases (barrel exports, dynamic imports)
174
- - Add dark/light theme toggle
175
-
176
- ## Project Documentation
162
+ ## Links
177
163
 
178
- | Document | Description |
179
- |----------|-------------|
180
- | [PRD](docs/PRD.md) | Product requirements, feature status, and roadmap |
181
- | [SAD](docs/SAD.md) | Software architecture, data flow, and design decisions |
182
- | [ADR-001](docs/adr/ADR-001-parsing-engine.md) | Why typescript-estree for Phase 1 |
183
- | [ADR-002](docs/adr/ADR-002-phase2-multi-language-parsing.md) | Why regex-based parsing for Phase 2 Python/PHP |
184
- | [API Spec](docs/API-SPEC.md) | HTTP endpoint and CLI interface documentation |
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)
185
167
 
186
168
  ## License
187
169