Skip to content

Turn complex codebases into clear, navigable architecture diagrams with Claude Code.

Initial commit

tachyon65fa0980ec7c2
diff --git a/.claude/skills/omm-push/SKILL.md b/.claude/skills/omm-push/SKILL.md
new file mode 100644
index 0000000..5e5235d
--- /dev/null
+++ b/.claude/skills/omm-push/SKILL.md
@@ -0,0 +1,52 @@
+---
+name: omm-push
+description: Push architecture docs to oh-my-mermaid cloud. Handles login, link, and push workflow with error guidance. Use when the user says "omm push", "push to cloud", "deploy architecture", or "share architecture".
+---
+
+# omm-push — Cloud Push Workflow
+
+## Purpose
+
+Automate the full workflow of pushing .omm/ architecture docs to the oh-my-mermaid cloud service.
+
+## Prerequisites
+
+The `omm` CLI must be installed (`npm install -g oh-my-mermaid`).
+
+## Workflow
+
+### Step 1: Check Login Status
+
+Run `omm share` via Bash. If it errors with "not logged in":
+- Tell the user: "You need to log in first."
+- Run `omm login` — this opens a browser for GitHub OAuth
+- Wait for the user to complete login
+
+### Step 2: Check Project Link
+
+Run `omm share` via Bash. If it errors with "no project slug":
+- Run `omm link` — this sets the cloud project slug from the directory name
+- Confirm: "Linked to {slug}"
+
+### Step 3: Push
+
+Run `omm push` via Bash.
+
+Handle errors:
+- **401 Unauthorized**: "Login expired. Run `omm login` again."
+- **403 Free plan limit**: "Free plan allows 1 project. Upgrade at https://ohmymermaid.com/pricing"
+- **Network error**: "Cannot reach server. Check your connection."
+
+### Step 4: Report
+
+On success, output:
+- Number of files uploaded
+- View URL: `https://ohmymermaid.com/p/{slug}`
+- Share URL (if Pro): "Run `omm share` to get the shareable link"
+
+## Rules
+
+- Always check login before pushing
+- Always check link before pushing
+- Do NOT skip steps — each depends on the previous
+- If any step fails, stop and report the error with guidance
diff --git a/.claude/skills/omm-scan/SKILL.md b/.claude/skills/omm-scan/SKILL.md
new file mode 100644
index 0000000..c65d23e
--- /dev/null
+++ b/.claude/skills/omm-scan/SKILL.md
@@ -0,0 +1,271 @@
+---
+name: omm-scan
+description: Scan codebase architecture and generate/update .omm/ documentation. Without arguments does a full scan; with arguments focuses on a specific topic and auto-links to parent diagrams. Use when the user says "omm scan", "scan architecture", "update architecture", "refresh diagrams", "omm scan auth flow", "analyze the payment module", or "dive into auth".
+argument-hint: "[topic]"
+---
+
+# omm-scan — Architecture Scanner (Full + Focused)
+
+## Purpose
+
+Analyze the codebase and generate/update `.omm/` architecture documentation using the `omm` CLI.
+Operates in two modes based on whether arguments are provided.
+
+## Prerequisites
+
+The `omm` CLI must be installed (`npm install -g oh-my-mermaid` or available via npx).
+
+## Mode Detection
+
+- **No arguments** (`/omm-scan`): Full scan mode — analyze entire codebase
+- **With arguments** (`/omm-scan auth flow`): Focused mode — analyze specific topic only
+
+---
+
+## A. Full Scan Mode (no arguments)
+
+### Step 1: Initialize
+
+If `.omm/` does not exist, run `omm init` first.
+
+```bash
+omm init
+```
+
+### Step 2: Check Existing State
+
+```bash
+omm list
+```
+
+For each existing class, read current content:
+```bash
+omm <class> description
+omm <class> diagram
+```
+
+### Step 3: Explore the Codebase
+
+Use Glob and Read to understand the project:
+- Read `package.json`, `tsconfig.json`, or equivalent config files
+- List top-level directories to identify module boundaries
+- Read key entry points (main, index, app files)
+- Look for route definitions, service layers, database connections
+
+### Step 4: Generate/Update Classes
+
+**First run (no existing classes):** Create classes based on what a person new to this codebase most needs to understand. Always start with `overall-architecture`, then add perspectives from this list based on what exists in the code:
+
+| Class name | When to create | What it answers |
+|---|---|---|
+| `overall-architecture` | Always | What exists and how pieces relate |
+| `request-lifecycle` | Any server/API | How a request enters and gets handled end-to-end |
+| `data-flow` | Any data processing | Where data comes from, transforms, and lands |
+| `auth-flow` | Any auth/session logic | How identity is established and propagated |
+| `dependency-map` | Complex module graph | What depends on what, what's shared |
+| `state-transitions` | Stateful features | How state changes and what triggers it |
+| `external-integrations` | External APIs/services | What the system connects to and why |
+
+Only create a class if it meaningfully exists in the code. 3-5 classes is usually right; avoid forcing perspectives that don't exist.
+
+**Subsequent runs:** Compare existing docs against current code, update only what changed.
+
+For each class, call the CLI with **each field separately**:
+
+```bash
+omm <class> description - <<'EOF'
+(1-2 sentences: what this diagram shows AND who should read it)
+- e.g., "Shows how an HTTP request flows from entry point to response. Start here if you want to understand how the API handles a request."
+EOF
+
+omm <class> diagram - <<'MERMAID'
+graph LR
+ (Accurate mermaid diagram based on actual code)
+MERMAID
+
+omm <class> context - <<'EOF'
+(The most important field for human understanding: WHY this architecture exists)
+- Key decisions made and why (e.g., "Chose event-driven over direct calls to decouple billing from orders")
+- Constraints that shaped the design (e.g., "Must support offline mode — hence local-first storage")
+- Alternatives considered and rejected
+- Historical reasons if relevant
+EOF
+
+omm <class> constraint - <<'EOF'
+(Rules that MUST be followed when changing this area)
+- e.g., "API layer must never import from repository directly — always go through service"
+EOF
+
+omm <class> concern - <<'EOF'
+(Risks, technical debt, known issues a reader should be aware of)
+- e.g., "Auth service is a single point of failure — no fallback if it's down"
+EOF
+
+omm <class> todo - <<'EOF'
+(Concrete next steps or planned improvements)
+- e.g., "Add caching layer between service and repository"
+EOF
+
+omm <class> note - <<'EOF'
+(Anything else a new reader would want to know that doesn't fit above)
+EOF
+```
+
+### Step 5: Cross-References
+
+Use `@class-name` convention for nodes that represent another class. For `@ref` nodes, do NOT add a path as the second line — instead, use a plain concept label:
+
+```mermaid
+graph LR
+ client["Browser Client\nsrc/client/"]
+ client -->|"HTTP request"| @api-layer["API Layer"]
+ client -->|"authenticate"| @auth-flow["Auth Service"]
+```
+
+The `@` prefix tells the viewer this node is a drill-down into another class. Adding a file path would be misleading since it represents a whole sub-diagram, not a single file.
+
+### Step 6: Summarize
+
+Report what was created/updated and suggest `omm serve` to view.
+
+---
+
+## B. Focused Mode (with arguments)
+
+### Step 1: Parse Topic
+
+Convert `$ARGUMENTS` to a kebab-case class name:
+- "auth flow" → `auth-flow`
+- "payment service" → `payment-service`
+- "database schema" → `database-schema`
+
+### Step 2: Deep Analysis
+
+Focus Glob and Read on code related to the topic:
+- Search for files matching the topic (e.g., `*auth*`, `*payment*`)
+- Trace imports and dependencies from those files
+- Understand the full flow for this specific concern
+
+### Step 3: Create/Update Class
+
+Generate all fields via CLI (same as full scan, but for this one class only).
+
+### Step 4: Auto-Link to Parent
+
+This is the key differentiator from full scan:
+
+1. Run `omm list` to get existing classes
+2. For each existing class, run `omm <class> diagram` to read its diagram
+3. Check if the new class is already referenced as `@new-class`
+4. If NOT referenced, find the logical parent (usually `overall-architecture`) and update its diagram to include `@new-class[Label]` node
+
+Example: After creating `auth-flow`, update `overall-architecture`:
+```bash
+# Read current parent diagram
+omm overall-architecture diagram
+# Add @auth-flow reference and rewrite
+omm overall-architecture diagram - <<'MERMAID'
+graph LR
+ Client --> @auth-flow[Auth Service]
+ ...existing nodes...
+MERMAID
+```
+
+### Step 5: Verify and Summarize
+
+```bash
+omm refs <new-class>
+```
+
+Report: "auth-flow created, @auth-flow added to overall-architecture"
+
+---
+
+### Nested Architecture Analysis
+
+When analyzing the codebase, identify sub-systems that are complex enough to warrant their own diagram (5+ nodes). Create separate classes for these and reference them with `@class-name` in the parent diagram.
+
+**When to nest:**
+- A module has 5+ internal components with their own relationships
+- A subsystem has distinct layers or flows worth documenting separately
+- A feature area (auth, billing, data pipeline) has its own internal architecture
+
+**How to nest:**
+1. Create a new class: `omm <child-class> diagram - <<'MERMAID'...MERMAID`
+2. In the parent diagram, use `@child-class[Label]` as the node ID
+3. Fill all 7 fields for the child class (description, constraint, concern, context, todo, note)
+
+**Example:**
+If `overall-architecture` has an auth subsystem with 8+ nodes:
+- Create `auth-flow` class with its own detailed diagram
+- In `overall-architecture` diagram: `Client --> @auth-flow[Auth Service]`
+- The viewer will render `@auth-flow` as a clickable, expandable sub-group
+
+### Edge Labels
+
+Every edge MUST have a meaningful label. The label should answer **"why does this connection exist?"** — not just the protocol.
+
+**Format:** `A -->|"label"| B`
+
+**What to include in labels (priority order):**
+1. The purpose/intent: what does this relationship accomplish?
+2. What data/result flows: what is actually transferred?
+3. Protocol/method only if it adds clarity (HTTP, IPC, Event, etc.)
+
+**Good examples:**
+```mermaid
+Client -->|"login request (HTTP POST)"| AuthService
+AuthService -->|"issue session token"| Client
+AuthService -->|"verify user exists"| UserRepository
+OrderService -->|"request payment authorization"| PaymentGateway
+PaymentGateway -->|"authorization result callback"| OrderService
+EventBus -->|"emit: order.completed"| NotificationService
+```
+
+**Bad examples (avoid):**
+```mermaid
+A --> B
+Client --> Server
+AuthService -->|"HTTP"| UserRepository
+```
+
+The test: if you remove the label, does the reader lose important understanding? If yes, the label is good. If the label is just a protocol name, it's probably not enough.
+
+## Rules (Both Modes)
+
+- Write all content (node labels, edge labels, field text) in **English by default**. If the user wrote in another language, match that language throughout.
+- ONLY document what actually exists in the code. Do not invent or speculate.
+- **Node labels must use two-line format**: concept name on the first line, file/directory path on the second line, separated by `\n`:
+ ```
+ auth_service["Auth Service\nsrc/auth/service.ts"]
+ user_repo["User Repository\nsrc/user/repository.ts"]
+ payment_module["Payment Module\nsrc/payment/"]
+ ```
+ - First line: role/responsibility in plain language (what it does)
+ - Second line: actual path relative to project root (where to find it)
+ - The viewer renders the path smaller and muted below the concept name
+ - For modules/folders, use the directory path (e.g., `src/payment/`)
+ - For single files, use the file path (e.g., `src/auth/service.ts`)
+- Keep diagrams readable — 5-15 nodes max per diagram.
+- Use `graph LR` for most diagrams, `graph TD` for hierarchies.
+- Do NOT rewrite classes that haven't changed.
+- Do NOT delete classes — only report if obsolete.
+- Write each field separately (constraint, concern, context, todo, note) — do NOT combine them.
+- Use `omm diff <class>` after updating to verify changes.
+- Use `classDef` to visually distinguish node roles — apply only when the distinction genuinely helps a reader:
+
+ | Class | Color | When to use |
+ |---|---|---|
+ | `external` | muted gray `#585b70` | Third-party services, APIs outside your codebase (DB, S3, Stripe, etc.) |
+ | `concern` | red `#f38ba8` | Nodes that are a known risk or bottleneck (single point of failure, legacy code) |
+ | `entry` | blue `#89b4fa` | Entry points (HTTP handler, CLI, queue consumer) |
+ | `store` | green `#a6e3a1` | Persistent storage (DB, cache, file system) |
+
+ ```
+ classDef external fill:#585b70,stroke:#585b70,color:#cdd6f4
+ classDef concern fill:#f38ba8,stroke:#f38ba8,color:#1e1e2e
+ classDef entry fill:#89b4fa,stroke:#89b4fa,color:#1e1e2e
+ classDef store fill:#a6e3a1,stroke:#a6e3a1,color:#1e1e2e
+ ```
+
+ Do not overuse — if everything has a color, nothing stands out.
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f4c2b7d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+node_modules/
+dist/
+.omc/
+*.tgz
diff --git a/.omm/cli-commands/constraint.md b/.omm/cli-commands/constraint.md
new file mode 100644
index 0000000..7302b7f
--- /dev/null
+++ b/.omm/cli-commands/constraint.md
@@ -0,0 +1,3 @@
+- Class-field pattern (`omm <class> <field>`) requires at least 2 args; first arg must NOT be a global command keyword
+- Valid fields: description, diagram, constraint, concern, context, todo, note (enforced by `VALID_FIELDS` in types.ts)
+- When field is `-`, content is read from stdin — critical for multi-line heredoc writes from Claude
diff --git a/.omm/cli-commands/description.md b/.omm/cli-commands/description.md
new file mode 100644
index 0000000..2b020fe
--- /dev/null
+++ b/.omm/cli-commands/description.md
@@ -0,0 +1 @@
+Covers how `omm` CLI dispatches commands and how class-field writes work. Read this if you want to add a new command or understand the class-field pattern.
diff --git a/.omm/cli-commands/diagram.mmd b/.omm/cli-commands/diagram.mmd
new file mode 100644
index 0000000..3604aca
--- /dev/null
+++ b/.omm/cli-commands/diagram.mmd
@@ -0,0 +1,12 @@
+graph TD
+ classDef entry fill:#89b4fa,stroke:#89b4fa,color:#1e1e2e
+
+ cli["omm CLI Entry\nsrc/cli.ts"]:::entry
+ cli -->|"global commands"| global["Global Commands\ninit / list / show / delete\nstatus / diff / refs / serve"]
+ cli -->|"cloud commands"| cloud_cmds["Cloud Commands\nlogin / logout / push / pull\nlink / share"]
+ cli -->|"omm <class> <field>"| class_field["Class-Field Command\nsrc/commands/class-field.ts"]
+ class_field -->|"stdin (-) or inline"| read_content["Read Content\nstdin piped or args"]
+ class_field -->|"write field"| store["Store Write\nsrc/lib/store.ts"]
+ class_field -->|"validate"| types["Field Validation\nsrc/types.ts"]
+ global -->|"reads"| store
+ cloud_cmds -->|"auth + HTTP"| cloud_lib["Cloud Client\nsrc/lib/cloud.ts"]
diff --git a/.omm/cli-commands/meta.yaml b/.omm/cli-commands/meta.yaml
new file mode 100644
index 0000000..474c991
--- /dev/null
+++ b/.omm/cli-commands/meta.yaml
@@ -0,0 +1,6 @@
+created: 2026-03-22T06:05:52.486Z
+updated: 2026-03-22T06:05:58.024Z
+update_count: 4
+last_field: note
+git_commit: 55c1fe5
+git_branch: main
diff --git a/.omm/cli-commands/note.md b/.omm/cli-commands/note.md
new file mode 100644
index 0000000..855ea53
--- /dev/null
+++ b/.omm/cli-commands/note.md
@@ -0,0 +1 @@
+The class-field dispatch is a catch-all `default` case in the switch: any unknown first arg is treated as a class name. This means typos in command names silently become class names. Intentional design — keeps the API simple.
diff --git a/.omm/config.yaml b/.omm/config.yaml
new file mode 100644
index 0000000..55cb48c
--- /dev/null
+++ b/.omm/config.yaml
@@ -0,0 +1,3 @@
+version: 0.1.0
+cloud:
+ project_slug: oh-my-mermaid
diff --git a/.omm/overall-architecture/constraint.md b/.omm/overall-architecture/constraint.md
new file mode 100644
index 0000000..6003540
--- /dev/null
+++ b/.omm/overall-architecture/constraint.md
@@ -0,0 +1,3 @@
+- Server is strictly read-only: never write `.omm/` data through HTTP API, only through the CLI
+- All `.omm/` content must be plain text (markdown or mermaid) — no binary files
+- Cloud credentials stored only in `~/.omm/credentials.json`, never in `.omm/` or git
diff --git a/.omm/overall-architecture/context.md b/.omm/overall-architecture/context.md
new file mode 100644
index 0000000..611f7cc
--- /dev/null
+++ b/.omm/overall-architecture/context.md
@@ -0,0 +1,7 @@
+omm is a CLI tool that generates and serves architecture documentation as Mermaid diagrams. The core loop is: AI scans code → writes `.omm/` files via CLI → developer serves them locally or pushes to cloud.
+
+Key decisions:
+- Local-first: all data lives in `.omm/` plain files (markdown + mmd), no database
+- CLI as the write interface: Claude Code uses `omm <class> <field> - <<'EOF'` to write docs; the server is read-only
+- SSE for live reload: avoids WebSocket complexity while enabling instant viewer refresh as Claude writes
+- Cloud sync is optional: push/pull uploads raw `.omm/` files; cloud hosts its own renderer (separate from viewer.html)
diff --git a/.omm/overall-architecture/description.md b/.omm/overall-architecture/description.md
new file mode 100644
index 0000000..9bf8518
--- /dev/null
+++ b/.omm/overall-architecture/description.md
@@ -0,0 +1 @@
+Top-level view of the oh-my-mermaid (omm) CLI tool — architecture mirror for vibe coding. Read this first to understand how the CLI, local viewer, storage, and cloud sync all connect.
diff --git a/.omm/overall-architecture/diagram.mmd b/.omm/overall-architecture/diagram.mmd
new file mode 100644
index 0000000..b076464
--- /dev/null
+++ b/.omm/overall-architecture/diagram.mmd
@@ -0,0 +1,13 @@
+graph LR
+ classDef entry fill:#89b4fa,stroke:#89b4fa,color:#1e1e2e
+ classDef store fill:#a6e3a1,stroke:#a6e3a1,color:#1e1e2e
+ classDef external fill:#585b70,stroke:#585b70,color:#cdd6f4
+
+ cli["omm CLI\nsrc/cli.ts"]:::entry
+ cli -->|"dispatch command"| @cli-commands["CLI Commands\nsrc/commands/"]
+ @cli-commands -->|"read/write fields"| @storage-model["Storage Model\n.omm/"]
+ @cli-commands -->|"omm serve"| @serve-layer["Local Server\nsrc/server/"]
+ @serve-layer -->|"serve viewer + API"| @viewer-rendering["Browser Viewer\nsrc/server/viewer.html"]
+ @serve-layer -->|"read class data"| @storage-model
+ @cli-commands -->|"omm push/pull/login"| cloud["ohmymermaid.com\nhttps://ohmymermaid.com"]:::external
+ cloud -->|"shareable URL"| browser["Browser\n(remote viewer)"]:::external
diff --git a/.omm/overall-architecture/meta.yaml b/.omm/overall-architecture/meta.yaml
new file mode 100644
index 0000000..314d8f6
--- /dev/null
+++ b/.omm/overall-architecture/meta.yaml
@@ -0,0 +1,6 @@
+created: 2026-03-22T06:05:25.271Z
+updated: 2026-03-22T06:05:43.316Z
+update_count: 4
+last_field: constraint
+git_commit: 55c1fe5
+git_branch: main
diff --git a/.omm/serve-layer/constraint.md b/.omm/serve-layer/constraint.md
new file mode 100644
index 0000000..81303c9
--- /dev/null
+++ b/.omm/serve-layer/constraint.md
@@ -0,0 +1,3 @@
+- The API is strictly read-only: no POST/PUT/DELETE routes — all writes go through the CLI
+- `viewer.html` is served from `dist/` in production (bundled by tsup), with fallback to `src/server/viewer.html` for dev
+- Project name is injected server-side via `window.__projectName` script tag before `</head>` — not passed via API
diff --git a/.omm/serve-layer/description.md b/.omm/serve-layer/description.md
new file mode 100644
index 0000000..4b66c2a
--- /dev/null
+++ b/.omm/serve-layer/description.md
@@ -0,0 +1 @@
+The local HTTP server started by `omm serve`. Serves the viewer HTML, a read-only JSON API, and a Server-Sent Events stream for live reload. Read this if you're modifying the server or adding API endpoints.
diff --git a/.omm/serve-layer/diagram.mmd b/.omm/serve-layer/diagram.mmd
new file mode 100644
index 0000000..95d1c8c
--- /dev/null
+++ b/.omm/serve-layer/diagram.mmd
@@ -0,0 +1,13 @@
+graph LR
+ classDef entry fill:#89b4fa,stroke:#89b4fa,color:#1e1e2e
+ classDef store fill:#a6e3a1,stroke:#a6e3a1,color:#1e1e2e
+
+ browser["Browser\n(localhost)"]:::entry
+ browser -->|"GET /"| html_handler["HTML Handler\nsrc/server/index.ts"]
+ html_handler -->|"injects project name"| viewer_html["viewer.html\nsrc/server/viewer.html"]
+ browser -->|"GET /api/classes\nGET /api/class/:name\nGET /api/class/:name/diff\nGET /api/class/:name/refs"| api["API Handler\nsrc/server/api.ts"]
+ api -->|"read only"| store["Store / Lib\nsrc/lib/store.ts"]:::store
+ browser -->|"GET /events (SSE)"| sse["SSE Endpoint\nsrc/server/index.ts"]
+ sse --> watcher["File Watcher\nsrc/server/watcher.ts"]
+ watcher -->|"fs.watch .omm/ recursive"| omm_dir[".omm/\nfile system"]:::store
+ watcher -->|"broadcast change event (300ms debounce)"| sse
diff --git a/.omm/serve-layer/meta.yaml b/.omm/serve-layer/meta.yaml
new file mode 100644
index 0000000..a90d230
--- /dev/null
+++ b/.omm/serve-layer/meta.yaml
@@ -0,0 +1,6 @@
+created: 2026-03-22T06:06:21.806Z
+updated: 2026-03-22T06:06:26.692Z
+update_count: 4
+last_field: note
+git_commit: 55c1fe5
+git_branch: main
diff --git a/.omm/serve-layer/note.md b/.omm/serve-layer/note.md
new file mode 100644
index 0000000..3c1f45a
--- /dev/null
+++ b/.omm/serve-layer/note.md
@@ -0,0 +1 @@
+The SSE watcher uses a 300ms debounce to coalesce rapid file changes (e.g., Claude writing multiple fields in sequence) into a single browser reload event.
diff --git a/.omm/storage-model/concern.md b/.omm/storage-model/concern.md
new file mode 100644
index 0000000..f9ad71e
--- /dev/null
+++ b/.omm/storage-model/concern.md
@@ -0,0 +1,2 @@
+- `prev_diagram` only stores the immediately previous version — no full history; multiple rapid writes lose intermediate states
+- No locking: concurrent CLI writes to the same class could corrupt meta.yaml (unlikely in practice but possible if parallelized)
diff --git a/.omm/storage-model/constraint.md b/.omm/storage-model/constraint.md
new file mode 100644
index 0000000..74c6018
--- /dev/null
+++ b/.omm/storage-model/constraint.md
@@ -0,0 +1,3 @@
+- `prev_diagram` in meta.yaml is automatically saved whenever the `diagram` field is overwritten — enables diff without git
+- Never write class data through the HTTP API; only `src/lib/store.ts` may write to `.omm/`
+- `config.yaml` lives directly in `.omm/` (not in a class dir); class dirs are identified by `isDirectory()` filter in `listClasses()`
diff --git a/.omm/storage-model/description.md b/.omm/storage-model/description.md
new file mode 100644
index 0000000..31cae23
--- /dev/null
+++ b/.omm/storage-model/description.md
@@ -0,0 +1 @@
+How omm persists architecture data as a directory tree of plain text files. Read this if you're working on the store, meta tracking, or the diff system.
diff --git a/.omm/storage-model/diagram.mmd b/.omm/storage-model/diagram.mmd
new file mode 100644
index 0000000..6ddc3cf
--- /dev/null
+++ b/.omm/storage-model/diagram.mmd
@@ -0,0 +1,18 @@
+graph TD
+ classDef store fill:#a6e3a1,stroke:#a6e3a1,color:#1e1e2e
+
+ omm_dir[".omm/\nproject root"]:::store
+ omm_dir --> config[".omm/config.yaml\nversion + cloud.project_slug"]
+ omm_dir --> class_dir[".omm/<class>/\none dir per class"]:::store
+ class_dir --> description["description.md\nhuman-readable summary"]
+ class_dir --> diagram["diagram.mmd\nmermaid source"]
+ class_dir --> constraint["constraint.md"]
+ class_dir --> concern["concern.md"]
+ class_dir --> context["context.md"]
+ class_dir --> todo["todo.md"]
+ class_dir --> note["note.md"]
+ class_dir --> meta["meta.yaml\ncreated/updated/update_count\nlast_field/git_commit/prev_diagram"]
+
+ store_ts["Store API\nsrc/lib/store.ts"] -->|"read/write"| omm_dir
+ meta_ts["Meta Updater\nsrc/lib/meta.ts"] -->|"auto-update on write"| meta
+ store_ts -->|"save prev on diagram write"| meta
diff --git a/.omm/storage-model/meta.yaml b/.omm/storage-model/meta.yaml
new file mode 100644
index 0000000..40bcbef
--- /dev/null
+++ b/.omm/storage-model/meta.yaml
@@ -0,0 +1,6 @@
+created: 2026-03-22T06:06:06.850Z
+updated: 2026-03-22T06:06:13.178Z
+update_count: 4
+last_field: concern
+git_commit: 55c1fe5
+git_branch: main
diff --git a/.omm/viewer-rendering/concern.md b/.omm/viewer-rendering/concern.md
new file mode 100644
index 0000000..f92a63a
--- /dev/null
+++ b/.omm/viewer-rendering/concern.md
@@ -0,0 +1,2 @@
+- Single large HTML file (~2000+ lines) with inline CSS and JS — hard to maintain as complexity grows; no component abstraction
+- Custom Mermaid parser is a subset of Mermaid syntax — edge cases in Mermaid spec may not render correctly
diff --git a/.omm/viewer-rendering/constraint.md b/.omm/viewer-rendering/constraint.md
new file mode 100644
index 0000000..6ab71cb
--- /dev/null
+++ b/.omm/viewer-rendering/constraint.md
@@ -0,0 +1,3 @@
+- Mermaid is NOT rendered via the official mermaid.js library — the viewer uses a custom dagre-based layout engine for full control over node interaction and styling
+- `@class-name` nodes in diagrams must be recognized as drill-down references; do not use `@` prefix for non-class nodes
+- viewer.html is a single self-contained file (no build step for frontend); all CSS/JS is inline
diff --git a/.omm/viewer-rendering/context.md b/.omm/viewer-rendering/context.md
new file mode 100644
index 0000000..064d106
--- /dev/null
+++ b/.omm/viewer-rendering/context.md
@@ -0,0 +1,7 @@
+The viewer deliberately avoids the official mermaid.js renderer to enable:
+1. Clickable nodes that navigate between classes
+2. Custom `@ref` node rendering (glow, expand, nested group reveal)
+3. Fine-grained zoom/pan control and focus-exempt behavior
+4. Inline detail sidebar driven by the same class data
+
+The dagre library handles graph layout; the viewer draws SVG manually on top of dagre's position output.
diff --git a/.omm/viewer-rendering/description.md b/.omm/viewer-rendering/description.md
new file mode 100644
index 0000000..06e1d43
--- /dev/null
+++ b/.omm/viewer-rendering/description.md
@@ -0,0 +1 @@
+The browser-side viewer in viewer.html: sidebar navigation, Mermaid diagram rendering (custom dagre-based engine), and the detail sidebar. Read this if you're modifying how diagrams look or how class navigation works.
diff --git a/.omm/viewer-rendering/diagram.mmd b/.omm/viewer-rendering/diagram.mmd
new file mode 100644
index 0000000..d70733c
--- /dev/null
+++ b/.omm/viewer-rendering/diagram.mmd
@@ -0,0 +1,13 @@
+graph TD
+ classDef entry fill:#89b4fa,stroke:#89b4fa,color:#1e1e2e
+
+ sse["SSE /events\n(live reload)"]:::entry
+ api["REST API\n/api/*"]:::entry
+ sse -->|"change event → refetch"| state["App State\nclasses / activeClass / data"]
+ api -->|"fetch on load + navigate"| state
+ state -->|"render"| nav["Nav Sidebar\nclass list + tree"]
+ state -->|"render"| diagram_canvas["Diagram Canvas\ndagre layout engine"]
+ state -->|"render"| detail_sidebar["Detail Sidebar\ndescription / context / constraints\nconcerns / todos / notes"]
+ diagram_canvas -->|"@class-name nodes"| nav_ref["Clickable Sub-diagram\ndrills into referenced class"]
+ diagram_canvas -->|"node click"| detail_sidebar
+ detail_sidebar -->|"outgoing refs"| nav_ref
diff --git a/.omm/viewer-rendering/meta.yaml b/.omm/viewer-rendering/meta.yaml
new file mode 100644
index 0000000..985b65c
--- /dev/null
+++ b/.omm/viewer-rendering/meta.yaml
@@ -0,0 +1,6 @@
+created: 2026-03-22T06:06:37.243Z
+updated: 2026-03-22T06:06:47.420Z
+update_count: 5
+last_field: concern
+git_commit: 55c1fe5
+git_branch: main
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..7c3c361
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2025 oh-my-mermaid
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/PLAN.md b/PLAN.md
new file mode 100644
index 0000000..6ed536d
--- /dev/null
+++ b/PLAN.md
@@ -0,0 +1,773 @@
+# oh-my-mermaid (omm) — Implementation Plan
+
+## Context
+
+바이브코딩 시 아키텍처가 비대해지고 개발자가 자기 코드를 이해하지 못하는 문제를 해결하는 도구.
+**CLI가 `.omm/` 파일을 결정적으로 관리하고, Claude Code Skill이 AI 분석 후 CLI를 호출하는 구조.**
+웹 뷰어(localhost:3000)로 mermaid 다이어그램을 실시간 시각화.
+
+## 핵심 설계 결정
+
+- **파일 구조**: 7파일 (description, diagram, constraint, concern, context, todo, note) + 자동 meta.yaml
+- **note.md 세분화**: constraint(규칙), concern(위험), context(배경/결정), todo(할일), note(기타)로 분리하여 AI 분석 품질 향상
+- **Skill 배포**: npm 패키지에 번들, `omm init` 시 `.claude/skills/omm-*/`에 자동 복사
+- **MVP 범위**: CLI 전체 + omm-init/omm-scan 스킬 + 웹 뷰어 + diff 시각화
+- **Class 간 연결**: `@class-name` 노드 네이밍 컨벤션 (플랫 구조 유지, N:N 참조 지원)
+
+## 데이터 구조
+
+```
+.omm/
+├── config.yaml # 프로젝트 설정
+├── overall-architecture/
+│ ├── description.md # 이 다이어그램이 뭘 보여주는지
+│ ├── diagram.mmd # mermaid 코드
+│ ├── constraint.md # 반드시 지켜야 할 규칙/제약
+│ ├── concern.md # 위험, 기술부채, 주의사항
+│ ├── context.md # 왜 이 구조인지, 배경, 결정 근거
+│ ├── todo.md # 해야 할 일, 개선 사항
+│ ├── note.md # 기타 추가 메모
+│ └── meta.yaml # 자동 관리 (날짜, 커밋 등)
+└── auth-flow/
+ ├── description.md
+ ├── diagram.mmd
+ ├── constraint.md
+ ├── concern.md
+ ├── context.md
+ ├── todo.md
+ ├── note.md
+ └── meta.yaml
+```
+
+## CLI 명령어
+
+### 글로벌 명령어
+
+```bash
+omm init # .omm/ 생성 + skills 자동 설치
+omm list # 모든 class 목록
+omm show <class> # class의 모든 필드 출력
+omm delete <class> # class 삭제
+omm status # 전체 요약 (class 수, 마지막 갱신 등)
+omm diff <class> # 현재 vs 이전 다이어그램 diff
+omm refs <class> # 이 class를 참조하는 다른 class 목록
+omm refs --reverse <class> # 이 class가 참조하는 다른 class 목록
+omm serve [--port 3000] # 웹 뷰어 시작
+```
+
+### Class-Field 명령어
+
+```bash
+omm <class> <field> <content> # 쓰기 (content 있으면)
+omm <class> <field> # 읽기 (content 없으면)
+omm <class> <field> - # stdin에서 읽기 (멀티라인)
+```
+
+**유효 필드**: `description`, `diagram`, `constraint`, `concern`, `context`, `todo`, `note`
+
+**스킬에서 사용 예시** (heredoc):
+```bash
+omm auth-flow diagram - <<'MERMAID'
+graph LR
+ A[Client] --> B[API Gateway]
+ B --> C[Auth Service]
+MERMAID
+```
+
+### 동작 규칙
+
+| 동작 | 규칙 |
+|------|------|
+| 쓰기 시 class 없으면 | 자동 생성 |
+| 쓰기 시 meta.yaml | 자동 갱신 (updated, git_commit 등) |
+| 읽기 출력 | stdout에 raw content (파이핑 가능) |
+| 쓰기 확인 | stderr에 `wrote auth-flow/diagram.mmd (142 bytes)` |
+| .omm/ 없을 때 | `error: .omm/ not found. Run 'omm init' first.` exit 1 |
+| 잘못된 field | `error: unknown field 'foo'. Valid: description, diagram, note` exit 1 |
+
+## 프로젝트 파일 구조
+
+```
+c-mermaid/oh-my-mermaid/
+├── package.json
+├── tsconfig.json
+├── tsup.config.ts
+├── src/
+│ ├── cli.ts # 진입점, 인자 파싱
+│ ├── commands/
+│ │ ├── init.ts # omm init (+ skill 자동 설치)
+│ │ ├── class-field.ts # omm <class> <field> [content|-]
+│ │ ├── list.ts # omm list
+│ │ ├── show.ts # omm show <class>
+│ │ ├── delete.ts # omm delete <class>
+│ │ ├── status.ts # omm status
+│ │ ├── diff.ts # omm diff <class>
+│ │ ├── refs.ts # omm refs <class>
+│ │ └── serve.ts # omm serve
+│ ├── lib/
+│ │ ├── store.ts # .omm/ 파일 I/O 핵심 레이어
+│ │ ├── meta.ts # meta.yaml 자동 관리 (prev_diagram 보관 포함)
+│ │ ├── diff.ts # mermaid 경량 파서 + 노드/엣지 set diff
+│ │ └── refs.ts # @class-name 파싱 + 참조 그래프 생성
+│ ├── server/
+│ │ ├── index.ts # HTTP 서버
+│ │ ├── api.ts # REST API 라우트
+│ │ ├── watcher.ts # fs.watch + SSE
+│ │ └── viewer.html # 단일 HTML (mermaid.js + marked.js CDN)
+│ └── types.ts
+├── skills/ # npm 패키지에 포함, omm init 시 복사
+│ └── omm-scan/
+│ └── SKILL.md # 전체 스캔 + 집중 분석 통합 (인자로 모드 판별)
+└── test/
+ ├── store.test.ts
+ └── cli.test.ts
+```
+
+## Skill 설계
+
+**역할 분리**: CLI `omm init`은 순수 파일시스템 셋업만 담당. AI 분석은 모두 Skill에서 처리.
+
+### /omm-scan — 통합 스킬 (전체 스캔 + 집중 분석)
+
+```yaml
+---
+name: omm-scan
+description: 코드베이스 아키텍처를 분석하여 .omm/ 문서를 생성/갱신한다. 인자 없이 호출하면 전체 스캔, 인자가 있으면 해당 영역만 집중 분석하고 부모 diagram에 @참조를 자동 추가한다. "omm scan", "scan architecture", "update architecture", "omm scan auth flow", "analyze payment" 등으로 호출.
+argument-hint: [topic]
+---
+```
+
+**동작 모드 (인자 유무로 자동 판별):**
+
+**A. 전체 스캔 모드** (`/omm-scan` — 인자 없음):
+1. `.omm/`가 없으면 `omm init` 실행 (CLI)
+2. `omm list`로 기존 class 확인
+3. 프로젝트 구조 탐색 (Glob, Read — package.json, 디렉토리, 진입점)
+4. **첫 실행 (class 없음)**: 전체 코드베이스 분석 → 3-7개 class 생성
+5. **갱신 (class 있음)**: 기존 내용 읽기 → `git diff` 또는 재분석 → 변경된 class만 갱신
+6. 각 class에 대해 CLI 호출:
+ - `omm <class> description - <<'EOF'...EOF`
+ - `omm <class> diagram - <<'MERMAID'...MERMAID`
+ - `omm <class> constraint - <<'EOF'...EOF`
+ - `omm <class> concern - <<'EOF'...EOF`
+ - `omm <class> context - <<'EOF'...EOF`
+ - `omm <class> todo - <<'EOF'...EOF`
+ - `omm <class> note - <<'EOF'...EOF` (필요 시)
+7. `@class-name` 참조 일관성 확인
+8. 변경 요약 출력
+
+**B. 집중 분석 모드** (`/omm-scan auth flow` — 인자 있음):
+1. `$ARGUMENTS`에서 분석 대상 주제 파악 (e.g., "auth flow")
+2. 주제를 kebab-case class 이름으로 변환 (e.g., "auth-flow")
+3. 해당 주제 관련 코드를 깊이 분석 (Grep, Read로 관련 파일 추적)
+4. 기존 class가 있으면 갱신, 없으면 새로 생성
+5. **부모 자동 감지 및 갱신**:
+ - `omm list`로 기존 class들 조회
+ - 각 class의 diagram을 읽어서 새 class가 이미 참조되는지 확인
+ - 참조가 없지만 논리적 부모가 있으면 (e.g., overall-architecture)
+ → 부모 diagram에 `@new-class[Label]` 노드를 추가하여 갱신
+6. `omm refs <class>`로 참조 관계 확인 출력
+7. 결과 요약: "auth-flow 생성됨, overall-architecture에 @auth-flow 추가됨"
+
+## 웹 뷰어 설계
+
+### 인터페이스
+
+```
+┌─────────────────────────────────────────────┐
+│ oh-my-mermaid [dark] │
+├──────────┬──────────────────────────────────┤
+│ Classes │ │
+│ │ ┌────────────────────────────┐ │
+│ ● overall│ │ │ │
+│ auth │ │ (rendered mermaid SVG) │ │
+│ data │ │ │ │
+│ │ └────────────────────────────┘ │
+│ │ │
+│ │ Description │
+│ │ 이 다이어그램은 전체 시스템의... │
+│ │ │
+│ │ Notes │
+│ │ - API 레이어 → Service만 허용 │
+│ │ - TODO: 캐시 레이어 추가 필요 │
+│ │ │
+│ │ Meta │
+│ │ Updated: 2026-03-21 14:30 │
+├──────────┴──────────────────────────────────┤
+│ ◀ prev next ▶ │
+└─────────────────────────────────────────────┘
+```
+
+### Class 간 연결 (`@` 컨벤션)
+
+diagram.mmd 안에서 `@class-name` 형태의 노드 ID를 사용하면, 해당 노드가 다른 class로의 링크가 됨.
+
+**파일 구조는 플랫 유지:**
+```
+.omm/
+├── overall-architecture/
+│ └── diagram.mmd ← @auth-flow, @data-pipeline 노드 포함
+├── auth-flow/ ← 플랫하게 존재
+│ └── diagram.mmd
+└── data-pipeline/
+ └── diagram.mmd
+```
+
+**diagram.mmd 예시:**
+```mermaid
+graph LR
+ Client --> @auth-flow[Auth Service]
+ Client --> @data-pipeline[Data Pipeline]
+ @auth-flow --> DB[(Database)]
+```
+
+**규칙:**
+- `@`로 시작하는 노드 ID → `.omm/`의 해당 class로 자동 링크
+- 파서: `/^@([\w-]+)/` 정규식으로 감지
+- 대상 class가 존재하지 않으면 웹 뷰어에서 경고 표시 (끊어진 링크)
+- 하나의 class가 여러 diagram에서 참조 가능 (N:N)
+
+**웹 뷰어 동작:**
+- `@` 노드는 시각적으로 구분: 밑줄 + 포인터 커서 + 드릴다운 아이콘
+- 클릭 시 해당 class 상세 뷰로 전환 (브레드크럼 네비게이션)
+- 사이드바에서 참조 관계 트리로 표시
+
+**CLI 지원:**
+```bash
+omm refs <class> # 이 class를 참조하는 다른 class 목록
+omm refs --reverse <class> # 이 class가 참조하는 다른 class 목록
+```
+
+**필요한 구현:**
+- `src/lib/refs.ts`: diagram.mmd 파싱 → `@` 노드 추출 → 참조 그래프 생성
+- `src/commands/refs.ts`: refs CLI 명령어
+- `src/server/viewer.html`: `@` 노드에 click 핸들러 + 브레드크럼 UI
+- `src/server/api.ts`: `GET /api/class/:name/refs` 엔드포인트
+- Skill (omm-init, omm-scan): diagram 생성 시 하위 class를 `@class-name`으로 명명하도록 지시
+
+### UI 개선 사항 (MVP 포함)
+
+**Mermaid 테마/classDef 자동 적용:**
+- Skill이 diagram 생성 시 노드 상태별 색상 자동 부여
+ - 우려점 있는 모듈 → 빨간색 (`classDef concern`)
+ - 정상 모듈 → 초록색 (`classDef healthy`)
+ - 최근 변경 모듈 → 노란색 (`classDef changed`)
+ - 외부 의존성 → 회색 (`classDef external`)
+- `.omm/config.yaml`에 테마 설정 포함
+
+**인터랙티브 오버레이 (Mermaid SVG 후처리):**
+
+1. **`@` 참조 노드 시각적 구분**:
+ - `@class-name` 노드에 파란 점선 테두리 + 🔗 아이콘 + pointer 커서
+ - 클릭 시 해당 class 상세 뷰로 이동
+ - 대상 class가 없으면 빨간 점선 (끊어진 링크)
+
+2. **백링크 바 (상단)**:
+ - 현재 class를 참조하는 다른 class 목록을 다이어그램 위에 표시
+ - `← Referenced by: overall-architecture, security-overview`
+ - 클릭 시 해당 class로 이동
+
+3. **줌/팬**:
+ - 마우스 휠 → SVG viewBox 스케일 조정 (줌)
+ - 마우스 드래그 → SVG viewBox 이동 (팬)
+ - 줌 리셋 버튼
+
+4. **Edge highlight**:
+ - 노드 hover 시 연결된 엣지만 강조, 나머지 dim 처리
+
+**대시보드 카드 뷰:**
+- 모든 class를 카드 형태로 조감 (기본 진입점)
+- 카드에 축소 SVG + note 개수 + 마지막 갱신 시간 표시
+- 카드 클릭 → 상세 뷰 전환
+
+### Diff 시각화 (MVP 포함)
+
+아키텍처 변경을 시각적으로 보여주는 핵심 기능.
+
+**동작 방식:**
+1. `omm <class> diagram` 쓰기 시, 이전 내용을 `meta.yaml`의 `prev_diagram` 필드에 자동 보관
+2. 웹 뷰어에서 [Diff] 버튼 클릭 시 Before/After 병렬 비교
+3. 변경된 노드/엣지를 색상으로 하이라이트
+
+**Diff 렌더링:**
+```
+┌──────────── Before ────────────┬──────────── After ───────────────┐
+│ │ │
+│ A → B → C │ A → B → C │
+│ │ ↘ │
+│ │ D (🟢 추가됨) │
+│ │ │
+│ B → E │ B → E (🔴 제거됨 → 점선) │
+└────────────────────────────────┴──────────────────────────────────┘
+```
+
+**구현 방법:**
+- mermaid 텍스트를 라인 단위로 파싱하여 노드/엣지 목록 추출 (정규식 기반 경량 파서)
+- Before/After 노드/엣지 집합을 비교 (set diff)
+- After 다이어그램에 classDef 주입: 추가=초록, 제거=빨강 점선, 변경=노랑
+- 두 다이어그램을 side-by-side로 렌더링
+
+**CLI 지원:**
+```bash
+omm diff <class> # 현재 vs 이전 버전 diff (터미널 텍스트 출력)
+```
+
+**필요한 변경:**
+- `src/lib/meta.ts`: diagram 쓰기 시 이전 내용을 `prev_diagram`에 보관
+- `src/lib/diff.ts`: mermaid 텍스트 경량 파서 + set diff 로직
+- `src/commands/diff.ts`: CLI diff 명령어
+- `src/server/viewer.html`: Diff 뷰 UI (side-by-side + 하이라이트)
+- `src/server/api.ts`: `GET /api/class/:name/diff` 엔드포인트
+
+### 기술 구현
+
+- **서버**: Node.js `http` 모듈 (express 없이)
+- **클라이언트**: 단일 HTML + mermaid.js (CDN) + marked.js (CDN) + vanilla JS
+- **실시간 갱신**: SSE (Server-Sent Events) — fs.watch → SSE push → 브라우저 리렌더
+- **API**:
+ - `GET /` — HTML 페이지
+ - `GET /api/classes` — class 목록 JSON
+ - `GET /api/class/:name` — class 전체 내용 JSON
+ - `GET /api/class/:name/diff` — diff 데이터 JSON
+ - `GET /api/class/:name/refs` — 참조 관계 JSON
+ - `GET /events` — SSE 스트림
+
+## 구현 순서
+
+### Step 1: 프로젝트 초기화
+- `npm init`, tsconfig.json, tsup.config.ts
+- package.json의 `"bin": { "omm": "./dist/cli.js" }`
+
+### Step 2: 코어 라이브러리
+- `src/lib/store.ts` — .omm/ 읽기/쓰기 핵심
+- `src/lib/meta.ts` — meta.yaml 자동 관리
+- `src/types.ts` — 타입 정의
+
+### Step 3: CLI 명령어
+- `src/cli.ts` — 인자 파싱 + 라우팅
+- `src/commands/init.ts`
+- `src/commands/class-field.ts` (핵심: read/write/stdin)
+- `src/commands/list.ts`, `show.ts`, `delete.ts`, `status.ts`
+- `src/commands/diff.ts` — 현재 vs 이전 다이어그램 비교
+- `src/commands/refs.ts` — class 간 참조 관계 조회
+- `src/lib/diff.ts` — mermaid 경량 파서 (노드/엣지 추출 + set diff)
+- `src/lib/refs.ts` — `@class-name` 파싱 + 참조 그래프
+
+### Step 4: 웹 뷰어
+- `src/server/viewer.html` — 단일 HTML 템플릿
+- `src/server/api.ts` — REST API
+- `src/server/watcher.ts` — fs.watch + SSE
+- `src/server/index.ts` — HTTP 서버
+- `src/commands/serve.ts`
+
+### Step 5: Skills
+- `skills/omm-scan/SKILL.md` — 통합 스킬 갱신 (전체 스캔 + 집중 분석, 인자로 모드 판별)
+- `omm init`이 `.claude/skills/`에 복사 (기존 로직 유지)
+- 기존 `skills/omm-init/` 디렉토리 삭제
+
+### Step 6: 빌드 & 로컬 테스트
+- tsup으로 빌드
+- `npm link`로 로컬 `omm` 명령어 등록
+- CLI 전체 명령어 수동 테스트
+- vitest 단위 테스트 (store, diff, refs)
+
+### Step 7: 통합 테스트
+- 이 프로젝트(c-mermaid) 자체를 대상으로 `/omm-init` 실행하여 검증
+- `omm serve` → 웹 뷰어 동작 확인
+- `@` 참조 네비게이션, diff 시각화 확인
+
+### Step 8: 배포 준비
+- `npm pack`으로 tarball 생성 → 로컬 설치 테스트
+- `npx oh-my-mermaid init` 동작 확인
+- skill 자동 복사 경로 검증 (dist/ 기준 상대 경로)
+- npm publish
+
+## 기술 스택
+
+| 영역 | 선택 | 이유 |
+|------|------|------|
+| 언어 | TypeScript | 타입 안전성 |
+| 빌드 | tsup | 제로 설정, 빠름 |
+| CLI 파싱 | process.argv 직접 | 문법이 단순, 의존성 최소화 |
+| YAML | `yaml` npm | config.yaml, meta.yaml 처리 |
+| 웹 서버 | Node.js `http` | 의존성 없음 |
+| Mermaid 렌더링 | mermaid.js CDN (클라이언트) | 서버 의존성 없음 |
+| Markdown 렌더링 | marked.js CDN (클라이언트) | 서버 의존성 없음 |
+| 테스트 | vitest | tsup과 같은 esbuild 기반, 설정 최소 |
+
+## 배포 전략
+
+### package.json 핵심 설정
+
+```json
+{
+ "name": "oh-my-mermaid",
+ "version": "0.1.0",
+ "description": "Architecture mirror for vibe coding — CLI + Claude Code skills",
+ "bin": { "omm": "./dist/cli.js" },
+ "main": "./dist/index.js",
+ "types": "./dist/index.d.ts",
+ "files": [
+ "dist/",
+ "skills/",
+ "LICENSE"
+ ],
+ "keywords": ["mermaid", "architecture", "diagram", "claude-code", "vibe-coding"],
+ "engines": { "node": ">=18" },
+ "scripts": {
+ "build": "tsup",
+ "prepublishOnly": "npm run build"
+ }
+}
+```
+
+### 빌드 설정 (tsup.config.ts)
+
+```typescript
+export default defineConfig({
+ entry: {
+ cli: 'src/cli.ts',
+ index: 'src/index.ts' // 라이브러리 진입점 (프로그래밍 API)
+ },
+ format: ['esm'],
+ dts: true,
+ clean: true,
+ banner: {
+ js: '#!/usr/bin/env node' // cli.js에만 적용
+ },
+ // viewer.html을 dist/에 복사
+ onSuccess: 'cp src/server/viewer.html dist/'
+})
+```
+
+### 배포 대상
+
+| 방식 | 명령어 | 용도 |
+|------|--------|------|
+| **글로벌 설치** | `npm install -g oh-my-mermaid` | 일반 사용자 |
+| **npx 일회성** | `npx oh-my-mermaid init` | 빠른 체험 |
+| **프로젝트 dev** | `npm install -D oh-my-mermaid` | CI/CD 통합 |
+
+### 번들링 고려사항
+
+**dist/ 구조 (배포 시 포함):**
+```
+dist/
+├── cli.js # CLI 진입점 (#!/usr/bin/env node)
+├── index.js # 라이브러리 API (프로그래밍적 사용)
+├── index.d.ts # 타입 정의
+└── viewer.html # 웹 뷰어 HTML (단일 파일, CDN 참조)
+```
+
+**skills/ 디렉토리 (배포 시 포함):**
+```
+skills/
+├── omm-init/SKILL.md
+└── omm-scan/SKILL.md
+```
+
+### Skill 자동 설치 로직 (init.ts)
+
+```typescript
+// omm init 시:
+// 1. .omm/ 디렉토리 생성
+// 2. skills/ → .claude/skills/omm-*/ 복사
+// - 이미 존재하면 버전 비교 후 갱신 여부 확인
+// - package.json 버전을 skill에 주석으로 포함하여 버전 추적
+// 3. config.yaml 생성
+```
+
+`omm init` 실행 시 `skills/`를 사용자 프로젝트의 `.claude/skills/`로 복사.
+복사 소스 경로: `path.join(__dirname, '..', 'skills')` (dist/ 기준 상대 경로).
+**omm-scan 스킬**: `.omm/`가 없으면 내부에서 `omm init` 자동 실행.
+
+### npm publish 워크플로우
+
+```bash
+# 로컬 테스트
+npm run build
+npm link
+omm init # 동작 확인
+
+# 배포
+npm version patch # 버전 범프
+npm publish # npm 레지스트리에 배포
+
+# 사용자 설치
+npm install -g oh-my-mermaid
+omm init
+```
+
+### CI/CD 통합 (사용자 프로젝트에서)
+
+```json
+// 사용자 프로젝트의 package.json
+{
+ "devDependencies": {
+ "oh-my-mermaid": "^0.1.0"
+ },
+ "scripts": {
+ "arch:check": "omm status",
+ "arch:serve": "omm serve"
+ }
+}
+```
+
+```yaml
+# GitHub Actions 예시 — PR에서 아키텍처 변경 체크
+- name: Check architecture freshness
+ run: npx oh-my-mermaid status
+```
+
+### 버전 관리 전략
+
+- **Semantic Versioning**: major.minor.patch
+- `0.x.y` 동안은 API 불안정 허용
+- Skill 파일에 `# omm-version: 0.1.0` 주석 포함 → `omm init` 시 구버전 skill 감지 및 갱신 제안
+
+---
+
+# Cloud Service MVP — Hosted Viewer
+
+## Context
+
+oh-my-mermaid CLI는 오픈소스로 유지. 클라우드 서비스로 BM화하여 수익 모델 구축.
+첫 MVP: `omm push` → Supabase에 업로드 → 공유 가능한 URL로 아키텍처 다이어그램 제공.
+
+## BM 구조
+
+```
+Open Source (무료) Cloud Service (유료)
+┌──────────────┐ ┌──────────────────────┐
+│ omm CLI │ omm push → │ Hosted Viewer │
+│ omm serve │ │ 공유 URL │
+│ /omm-scan │ omm pull ← │ 팀 대시보드 │
+│ 로컬 viewer │ │ 변경 알림 │
+└──────────────┘ └──────────────────────┘
+ 무료 Free: 1 프로젝트
+ Pro: $9/월 무제한
+```
+
+## 기술 스택
+
+| 영역 | 선택 | 이유 |
+|------|------|------|
+| Frontend | Vercel (Next.js) | viewer.html 기반 확장, SSR |
+| Auth | Supabase Auth | GitHub OAuth, 간편 |
+| DB | Supabase PostgreSQL | 프로젝트/유저/팀 관리 |
+| Storage | Supabase Storage | .omm/ 파일 저장 (S3 호환) |
+| Hosting | Vercel | Next.js 최적, 자동 배포 |
+| CLI 연동 | REST API on Vercel | /api/push, /api/pull 등 |
+| Supabase Client | @supabase/supabase-js + @supabase/ssr | SSR 지원 |
+
+**Supabase API Keys (최신):**
+- `sb_publishable_...` — 클라이언트용 (기존 anon key 대체)
+- `sb_secret_...` — 서버용 (기존 service_role key 대체, 복수 생성 가능)
+- Secret key는 JWT가 아니므로 Authorization 헤더에 직접 사용 불가
+- 서버 사이드(API Routes, Edge Functions)에서만 사용
+
+## 아키텍처
+
+```
+omm push (CLI)
+ │
+ ▼ REST API (JWT)
+┌─── Vercel API Routes ────────────────────┐
+│ │
+│ POST /api/push ← .omm/ 파일 업로드 │
+│ GET /api/pull ← .omm/ 파일 다운로드 │
+│ GET /api/project ← 프로젝트 메타데이터 │
+│ POST /api/auth ← GitHub OAuth │
+│ │
+└────┬──────────────┬──────────────────────┘
+ │ │
+┌────▼────┐ ┌─────▼─────────┐
+│Supabase │ │ Supabase │
+│ DB │ │ Storage │
+│(PG) │ │ (.omm files) │
+└─────────┘ └───────────────┘
+
+브라우저:
+ https://omm.dev/p/{project-slug}
+ → Vercel SSR/CSR
+ → Supabase에서 .omm/ 파일 fetch
+ → mermaid.js로 렌더링 (기존 viewer.html 로직 재사용)
+```
+
+## DB 스키마 (Supabase PostgreSQL)
+
+```sql
+-- 사용자
+create table users (
+ id uuid primary key default gen_random_uuid(),
+ github_id text unique not null,
+ github_username text not null,
+ email text,
+ created_at timestamptz default now()
+);
+
+-- 프로젝트
+create table projects (
+ id uuid primary key default gen_random_uuid(),
+ owner_id uuid references users(id),
+ slug text unique not null, -- URL용: omm.dev/p/{slug}
+ name text not null, -- 프로젝트 이름
+ description text,
+ is_public boolean default false, -- 공개/비공개
+ plan text default 'free', -- free, pro, team
+ created_at timestamptz default now(),
+ updated_at timestamptz default now()
+);
+
+-- API 토큰 (CLI 인증용)
+create table api_tokens (
+ id uuid primary key default gen_random_uuid(),
+ user_id uuid references users(id),
+ token_hash text unique not null,
+ name text,
+ last_used_at timestamptz,
+ created_at timestamptz default now()
+);
+
+-- Push 히스토리
+create table push_history (
+ id uuid primary key default gen_random_uuid(),
+ project_id uuid references projects(id),
+ user_id uuid references users(id),
+ git_commit text,
+ classes_count int,
+ created_at timestamptz default now()
+);
+```
+
+## Supabase Storage 구조
+
+```
+omm-files/
+├── {project-id}/
+│ ├── config.yaml
+│ ├── overall-architecture/
+│ │ ├── description.md
+│ │ ├── diagram.mmd
+│ │ ├── constraint.md
+│ │ ├── concern.md
+│ │ ├── context.md
+│ │ ├── todo.md
+│ │ ├── note.md
+│ │ └── meta.yaml
+│ └── auth-flow/
+│ └── ...
+```
+
+## CLI 추가 명령어 (오픈소스에 포함)
+
+```bash
+omm login # GitHub OAuth → API 토큰 발급
+omm push # .omm/ → Supabase Storage 업로드
+omm pull # Supabase Storage → .omm/ 다운로드
+omm link # 현재 프로젝트를 클라우드 프로젝트에 연결
+omm share # 공유 URL 출력
+omm logout # 토큰 삭제
+```
+
+### omm push 동작
+
+```
+1. .omm/config.yaml에서 cloud.project_id 확인
+2. 없으면 → omm link 안내 또는 신규 프로젝트 생성
+3. .omm/ 디렉토리 전체를 Supabase Storage에 업로드
+ - 변경된 파일만 업로드 (meta.yaml의 updated 기준)
+4. push_history에 기록
+5. 공유 URL 출력: https://omm.dev/p/{slug}
+```
+
+### omm login 동작
+
+```
+1. 브라우저 열기 → https://omm.dev/auth/cli
+2. GitHub OAuth 인증
+3. 콜백으로 API 토큰 수신
+4. ~/.omm/credentials.json에 저장
+```
+
+## Vercel 프로젝트 구조
+
+```
+cloud/
+├── package.json
+├── next.config.ts
+├── src/
+│ ├── app/
+│ │ ├── page.tsx # 랜딩 페이지
+│ │ ├── p/[slug]/page.tsx # Hosted Viewer (핵심)
+│ │ ├── dashboard/page.tsx # 내 프로젝트 목록
+│ │ └── auth/
+│ │ ├── login/page.tsx # GitHub OAuth
+│ │ └── cli/page.tsx # CLI 인증 콜백
+│ ├── api/
+│ │ ├── push/route.ts # POST: .omm/ 업로드
+│ │ ├── pull/route.ts # GET: .omm/ 다운로드
+│ │ ├── project/route.ts # CRUD: 프로젝트 관리
+│ │ └── auth/route.ts # 토큰 발급
+│ ├── components/
+│ │ ├── MermaidViewer.tsx # viewer.html → React 컴포넌트화
+│ │ ├── Dashboard.tsx # 카드 뷰 대시보드
+│ │ ├── ClassDetail.tsx # 상세 뷰
+│ │ └── DiffView.tsx # Diff 시각화
+│ └── lib/
+│ ├── supabase.ts # Supabase 클라이언트
+│ └── omm.ts # .omm/ 파일 파싱 유틸
+├── supabase/
+│ └── migrations/
+│ └── 001_initial.sql # DB 스키마
+└── .env.local
+ # NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co
+ # NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=sb_publishable_...
+ # SUPABASE_SECRET_KEY=sb_secret_... (서버 전용, 복수 생성 가능)
+```
+
+## 구현 순서
+
+### Step 1: Supabase 셋업
+- Supabase 프로젝트 생성
+- DB 마이그레이션 (users, projects, api_tokens, push_history)
+- Storage 버킷 생성 (omm-files)
+- Auth: GitHub OAuth provider 설정
+
+### Step 2: Vercel 프로젝트 초기화
+- Next.js 프로젝트 생성 (cloud/ 디렉토리)
+- Supabase 클라이언트 설정
+- 환경변수 설정
+
+### Step 3: API 라우트
+- POST /api/auth — GitHub OAuth → 토큰 발급
+- POST /api/push — .omm/ 파일 수신 → Supabase Storage 저장
+- GET /api/pull — Supabase Storage → .omm/ 파일 반환
+- CRUD /api/project — 프로젝트 생성/조회
+
+### Step 4: Hosted Viewer 페이지
+- /p/[slug] — 기존 viewer.html 로직을 React 컴포넌트로 전환
+- Supabase Storage에서 .omm/ 파일 fetch
+- mermaid.js 렌더링 + diff + refs 네비게이션
+
+### Step 5: CLI 명령어 추가
+- omm login, push, pull, link, share, logout
+- ~/.omm/credentials.json 관리
+- .omm/config.yaml에 cloud 섹션 추가
+
+### Step 6: 배포 & 테스트
+- Vercel 배포
+- 도메인 연결 (omm.dev 또는 유사)
+- E2E: `omm login` → `omm push` → 브라우저에서 URL 확인
+
+## 검증 방법
+
+1. **CLI 단위 테스트**: `omm init` → `.omm/` 생성 확인, `omm test-class diagram "graph LR; A-->B"` → 파일 쓰기 확인
+2. **스킬 통합 테스트**: `/omm-init` 실행 → `.omm/` 에 class들 생성 확인
+3. **웹 뷰어 테스트**: `omm serve` → localhost:3000 접속 → 다이어그램 렌더링 확인
+4. **실시간 갱신 테스트**: `omm serve` 실행 중 → 다른 터미널에서 `omm <class> diagram ...` → 브라우저 자동 갱신 확인
+5. **E2E 시나리오**: `omm init` → `/omm-scan` → `omm serve` → 브라우저에서 아키텍처 확인
+6. **배포 테스트**: `npm pack` → 로컬 tarball 설치 → `npx oh-my-mermaid init` 동작 확인
+7. **Skill 설치 테스트**: `omm init` → `.claude/skills/omm-init/SKILL.md` 존재 확인
+8. **Diff 테스트**: diagram 두 번 쓰기 → `omm diff <class>` → 변경사항 출력 확인
+9. **Refs 테스트**: `@class-name` 노드 포함 diagram 생성 → `omm refs <class>` → 참조 관계 출력 확인
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e2e1d03
--- /dev/null
+++ b/README.md
@@ -0,0 +1,179 @@
+# oh-my-mermaid (omm)
+
+[![npm version](https://img.shields.io/npm/v/oh-my-mermaid)](https://www.npmjs.com/package/oh-my-mermaid)
+[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
+
+**Turn complex codebases into clear, navigable architecture diagrams with Claude Code.**
+
+> `omm init` → `claude` → `/omm-scan` → done. Your architecture docs write themselves.
+
+![omm viewer screenshot](./docs/screenshot.png)
+
+## Why?
+
+Plain Mermaid diagrams are flat — one file, one diagram, no connections between them.
+
+omm structures your architecture as **interconnected classes** that you can drill into. Use `@class-name` references to nest diagrams inside each other, zoom out to see the full picture, or click into a subsystem to focus on the details. Each class carries not just a diagram, but also context, constraints, and concerns — so the *why* behind your architecture lives right next to the *what*.
+
+[Claude Code](https://docs.anthropic.com/en/docs/claude-code) does the heavy lifting: it analyzes your code and generates everything automatically.
+
+```
+Your code → Claude Code analyzes → .omm/ stores diagrams → Live viewer in browser
+```
+
+## Prerequisites
+
+- [Node.js](https://nodejs.org/) 18+
+- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) (`npm install -g @anthropic-ai/claude-code`)
+
+## Install
+
+```bash
+npm install -g oh-my-mermaid
+```
+
+## Quick Start
+
+```bash
+# 1. Initialize in your project
+cd your-project
+omm init
+
+# 2. Launch Claude Code
+claude
+
+# 3. Scan your architecture (inside Claude Code)
+/omm-scan
+
+# 4. View in browser
+omm serve
+# → http://localhost:3000
+```
+
+`/omm-scan` makes Claude analyze your code and generate architecture docs in the `.omm/` directory.
+To focus on a specific area, pass a topic: `/omm-scan auth flow`.
+
+## How It Works
+
+### The `.omm/` directory
+
+omm creates an `.omm/` directory at your project root. Each architectural unit ("class") gets its own folder with up to 7 documentation fields:
+
+```
+.omm/
+├── config.yaml
+├── overall-architecture/
+│ ├── description.md # What this diagram represents
+│ ├── diagram.mmd # Mermaid flowchart code
+│ ├── context.md # Why this architecture exists
+│ ├── constraint.md # Rules that must be followed
+│ ├── concern.md # Risks, tech debt, known issues
+│ ├── todo.md # Planned improvements
+│ ├── note.md # Additional notes
+│ └── meta.yaml # Auto-managed (timestamps, git info)
+├── auth-flow/
+│ └── ...
+└── data-pipeline/
+ └── ...
+```
+
+### Cross-references
+
+Use `@class-name` in diagram nodes to link between classes:
+
+```text
+graph LR
+ Client -->|"HTTP"| @auth-flow[Auth Service]
+ Client -->|"WebSocket"| @data-pipeline[Data Pipeline]
+```
+
+Click `@auth-flow` in the viewer to navigate to that class.
+
+## CLI Commands
+
+### Basics
+
+```bash
+omm init # Initialize .omm/ and install Claude Code skills
+omm list # List all classes
+omm show <class> # Display all fields for a class
+omm status # Overview of all classes
+omm delete <class> # Delete a class
+```
+
+### Read / Write fields
+
+```bash
+omm <class> <field> # Read a field
+omm <class> <field> "content" # Write to a field
+omm <class> <field> - # Write from stdin (multiline)
+```
+
+Available fields: `description`, `diagram`, `context`, `constraint`, `concern`, `todo`, `note`
+
+### Analysis
+
+```bash
+omm diff <class> # Compare current vs previous diagram
+omm refs <class> # Show classes that reference this one
+omm refs --reverse <class> # Show classes this one references
+```
+
+### Local viewer
+
+```bash
+omm serve # Start live viewer at http://localhost:3000
+omm serve --port 8080 # Custom port
+```
+
+Auto-refreshes in the browser when files change (via SSE).
+
+## Cloud
+
+Share your architecture with your team via [ohmymermaid.com](https://ohmymermaid.com).
+
+```bash
+omm login # Sign in (opens browser)
+omm link # Link project to cloud
+omm push # Upload to cloud
+omm share # Print shareable URL
+
+omm pull # Download from cloud
+omm logout # Sign out
+```
+
+Or use `/omm-push` inside Claude Code to handle login, link, and push in one step.
+
+## Claude Code Skills
+
+| Skill | Description |
+|-------|-------------|
+| `/omm-scan` | Analyze full codebase → auto-generate architecture docs |
+| `/omm-scan [topic]` | Focus on a specific area (e.g. `/omm-scan auth flow`) |
+| `/omm-push` | Login + link + push to cloud in one step |
+
+## Development
+
+```bash
+git clone https://github.com/oh-my-mermaid/oh-my-mermaid.git
+cd oh-my-mermaid
+npm install
+npm run build
+
+# Watch mode
+npm run dev
+
+# Test
+npm test
+```
+
+## Contributing
+
+Issues and PRs are welcome.
+
+1. Fork → branch → change → PR
+2. Use [Conventional Commits](https://www.conventionalcommits.org/) for commit messages
+
+## License
+
+[MIT](./LICENSE)
diff --git a/docs/screenshot.png b/docs/screenshot.png
new file mode 100644
index 0000000..ed6cffd
Binary files /dev/null and b/docs/screenshot.png differ
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..5738eca
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,2483 @@
+{
+ "name": "oh-my-mermaid",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "oh-my-mermaid",
+ "version": "0.1.0",
+ "license": "MIT",
+ "dependencies": {
+ "yaml": "^2.8.3"
+ },
+ "bin": {
+ "omm": "dist/cli.js"
+ },
+ "devDependencies": {
+ "@types/node": "^25.5.0",
+ "tsup": "^8.5.1",
+ "typescript": "^5.9.3",
+ "vitest": "^4.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/aix-ppc64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.4.tgz",
+ "integrity": "sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.4.tgz",
+ "integrity": "sha512-X9bUgvxiC8CHAGKYufLIHGXPJWnr0OCdR0anD2e21vdvgCI8lIfqFbnoeOz7lBjdrAGUhqLZLcQo6MLhTO2DKQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.4.tgz",
+ "integrity": "sha512-gdLscB7v75wRfu7QSm/zg6Rx29VLdy9eTr2t44sfTW7CxwAtQghZ4ZnqHk3/ogz7xao0QAgrkradbBzcqFPasw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-x64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.4.tgz",
+ "integrity": "sha512-PzPFnBNVF292sfpfhiyiXCGSn9HZg5BcAz+ivBuSsl6Rk4ga1oEXAamhOXRFyMcjwr2DVtm40G65N3GLeH1Lvw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-arm64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.4.tgz",
+ "integrity": "sha512-b7xaGIwdJlht8ZFCvMkpDN6uiSmnxxK56N2GDTMYPr2/gzvfdQN8rTfBsvVKmIVY/X7EM+/hJKEIbbHs9oA4tQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-x64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.4.tgz",
+ "integrity": "sha512-sR+OiKLwd15nmCdqpXMnuJ9W2kpy0KigzqScqHI3Hqwr7IXxBp3Yva+yJwoqh7rE8V77tdoheRYataNKL4QrPw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.4.tgz",
+ "integrity": "sha512-jnfpKe+p79tCnm4GVav68A7tUFeKQwQyLgESwEAUzyxk/TJr4QdGog9sqWNcUbr/bZt/O/HXouspuQDd9JxFSw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-x64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.4.tgz",
+ "integrity": "sha512-2kb4ceA/CpfUrIcTUl1wrP/9ad9Atrp5J94Lq69w7UwOMolPIGrfLSvAKJp0RTvkPPyn6CIWrNy13kyLikZRZQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.4.tgz",
+ "integrity": "sha512-aBYgcIxX/wd5n2ys0yESGeYMGF+pv6g0DhZr3G1ZG4jMfruU9Tl1i2Z+Wnj9/KjGz1lTLCcorqE2viePZqj4Eg==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.4.tgz",
+ "integrity": "sha512-7nQOttdzVGth1iz57kxg9uCz57dxQLHWxopL6mYuYthohPKEK0vU0C3O21CcBK6KDlkYVcnDXY099HcCDXd9dA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ia32": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.4.tgz",
+ "integrity": "sha512-oPtixtAIzgvzYcKBQM/qZ3R+9TEUd1aNJQu0HhGyqtx6oS7qTpvjheIWBbes4+qu1bNlo2V4cbkISr8q6gRBFA==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-loong64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.4.tgz",
+ "integrity": "sha512-8mL/vh8qeCoRcFH2nM8wm5uJP+ZcVYGGayMavi8GmRJjuI3g1v6Z7Ni0JJKAJW+m0EtUuARb6Lmp4hMjzCBWzA==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-mips64el": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.4.tgz",
+ "integrity": "sha512-1RdrWFFiiLIW7LQq9Q2NES+HiD4NyT8Itj9AUeCl0IVCA459WnPhREKgwrpaIfTOe+/2rdntisegiPWn/r/aAw==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ppc64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.4.tgz",
+ "integrity": "sha512-tLCwNG47l3sd9lpfyx9LAGEGItCUeRCWeAx6x2Jmbav65nAwoPXfewtAdtbtit/pJFLUWOhpv0FpS6GQAmPrHA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-riscv64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.4.tgz",
+ "integrity": "sha512-BnASypppbUWyqjd1KIpU4AUBiIhVr6YlHx/cnPgqEkNoVOhHg+YiSVxM1RLfiy4t9cAulbRGTNCKOcqHrEQLIw==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-s390x": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.4.tgz",
+ "integrity": "sha512-+eUqgb/Z7vxVLezG8bVB9SfBie89gMueS+I0xYh2tJdw3vqA/0ImZJ2ROeWwVJN59ihBeZ7Tu92dF/5dy5FttA==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-x64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.4.tgz",
+ "integrity": "sha512-S5qOXrKV8BQEzJPVxAwnryi2+Iq5pB40gTEIT69BQONqR7JH1EPIcQ/Uiv9mCnn05jff9umq/5nqzxlqTOg9NA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-arm64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.4.tgz",
+ "integrity": "sha512-xHT8X4sb0GS8qTqiwzHqpY00C95DPAq7nAwX35Ie/s+LO9830hrMd3oX0ZMKLvy7vsonee73x0lmcdOVXFzd6Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-x64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.4.tgz",
+ "integrity": "sha512-RugOvOdXfdyi5Tyv40kgQnI0byv66BFgAqjdgtAKqHoZTbTF2QqfQrFwa7cHEORJf6X2ht+l9ABLMP0dnKYsgg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-arm64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.4.tgz",
+ "integrity": "sha512-2MyL3IAaTX+1/qP0O1SwskwcwCoOI4kV2IBX1xYnDDqthmq5ArrW94qSIKCAuRraMgPOmG0RDTA74mzYNQA9ow==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-x64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.4.tgz",
+ "integrity": "sha512-u8fg/jQ5aQDfsnIV6+KwLOf1CmJnfu1ShpwqdwC0uA7ZPwFws55Ngc12vBdeUdnuWoQYx/SOQLGDcdlfXhYmXQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openharmony-arm64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.4.tgz",
+ "integrity": "sha512-JkTZrl6VbyO8lDQO3yv26nNr2RM2yZzNrNHEsj9bm6dOwwu9OYN28CjzZkH57bh4w0I2F7IodpQvUAEd1mbWXg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/sunos-x64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.4.tgz",
+ "integrity": "sha512-/gOzgaewZJfeJTlsWhvUEmUG4tWEY2Spp5M20INYRg2ZKl9QPO3QEEgPeRtLjEWSW8FilRNacPOg8R1uaYkA6g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-arm64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.4.tgz",
+ "integrity": "sha512-Z9SExBg2y32smoDQdf1HRwHRt6vAHLXcxD2uGgO/v2jK7Y718Ix4ndsbNMU/+1Qiem9OiOdaqitioZwxivhXYg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-ia32": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.4.tgz",
+ "integrity": "sha512-DAyGLS0Jz5G5iixEbMHi5KdiApqHBWMGzTtMiJ72ZOLhbu/bzxgAe8Ue8CTS3n3HbIUHQz/L51yMdGMeoxXNJw==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-x64": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.4.tgz",
+ "integrity": "sha512-+knoa0BDoeXgkNvvV1vvbZX4+hizelrkwmGJBdT17t8FNPwG2lKemmuMZlmaNQ3ws3DKKCxpb4zRZEIp3UxFCg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@jridgewell/gen-mapping": {
+ "version": "0.3.13",
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.0",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.5.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.31",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.1.0",
+ "@jridgewell/sourcemap-codec": "^1.4.14"
+ }
+ },
+ "node_modules/@rollup/rollup-android-arm-eabi": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.1.tgz",
+ "integrity": "sha512-xB0b51TB7IfDEzAojXahmr+gfA00uYVInJGgNNkeQG6RPnCPGr7udsylFLTubuIUSRE6FkcI1NElyRt83PP5oQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
+ },
+ "node_modules/@rollup/rollup-android-arm64": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.59.1.tgz",
+ "integrity": "sha512-XOjPId0qwSDKHaIsdzHJtKCxX0+nH8MhBwvrNsT7tVyKmdTx1jJ4XzN5RZXCdTzMpufLb+B8llTC0D8uCrLhcw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
+ },
+ "node_modules/@rollup/rollup-darwin-arm64": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.59.1.tgz",
+ "integrity": "sha512-vQuRd28p0gQpPrS6kppd8IrWmFo42U8Pz1XLRjSZXq5zCqyMDYFABT7/sywL11mO1EL10Qhh7MVPEwkG8GiBeg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@rollup/rollup-darwin-x64": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.1.tgz",
+ "integrity": "sha512-x6VG6U29+Ivlnajrg1IHdzXeAwSoEHBFVO+CtC9Brugx6de712CUJobRUxsIA0KYrQvCmzNrMPFTT1A4CCqNTg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@rollup/rollup-freebsd-arm64": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.59.1.tgz",
+ "integrity": "sha512-Sgi0Uo6t1YCHJMNO3Y8+bm+SvOanUGkoZKn/VJPwYUe2kp31X5KnXmzKd/NjW8iA3gFcfNZ64zh14uOGrIllCQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-freebsd-x64": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.59.1.tgz",
+ "integrity": "sha512-AM4xnwEZwukdhk7laMWfzWu9JGSVnJd+Fowt6Fd7QW1nrf3h0Hp7Qx5881M4aqrUlKBCybOxz0jofvIIfl7C5g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.59.1.tgz",
+ "integrity": "sha512-KUizqxpwaR2AZdAUsMWfL/C94pUu7TKpoPd88c8yFVixJ+l9hejkrwoK5Zj3wiNh65UeyryKnJyxL1b7yNqFQA==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.59.1.tgz",
+ "integrity": "sha512-MZoQ/am77ckJtZGFAtPucgUuJWiop3m2R3lw7tC0QCcbfl4DRhQUBUkHWCkcrT3pqy5Mzv5QQgY6Dmlba6iTWg==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-gnu": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.59.1.tgz",
+ "integrity": "sha512-Sez95TP6xGjkWB1608EfhCX1gdGrO5wzyN99VqzRtC17x/1bhw5VU1V0GfKUwbW/Xr1J8mSasoFoJa6Y7aGGSA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-musl": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.59.1.tgz",
+ "integrity": "sha512-9Cs2Seq98LWNOJzR89EGTZoiP8EkZ9UbQhBlDgfAkM6asVna1xJ04W2CLYWDN/RpUgOjtQvcv8wQVi1t5oQazA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-loong64-gnu": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.59.1.tgz",
+ "integrity": "sha512-n9yqttftgFy7IrNEnHy1bOp6B4OSe8mJDiPkT7EqlM9FnKOwUMnCK62ixW0Kd9Clw0/wgvh8+SqaDXMFvw3KqQ==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-loong64-musl": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.59.1.tgz",
+ "integrity": "sha512-SfpNXDzVTqs/riak4xXcLpq5gIQWsqGWMhN1AGRQKB4qGSs4r0sEs3ervXPcE1O9RsQ5bm8Muz6zmQpQnPss1g==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.59.1.tgz",
+ "integrity": "sha512-LjaChED0wQnjKZU+tsmGbN+9nN1XhaWUkAlSbTdhpEseCS4a15f/Q8xC2BN4GDKRzhhLZpYtJBZr2NZhR0jvNw==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-ppc64-musl": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.59.1.tgz",
+ "integrity": "sha512-ojW7iTJSIs4pwB2xV6QXGwNyDctvXOivYllttuPbXguuKDX5vwpqYJsHc6D2LZzjDGHML414Tuj3LvVPe1CT1A==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.59.1.tgz",
+ "integrity": "sha512-FP+Q6WTcxxvsr0wQczhSE+tOZvFPV8A/mUE6mhZYFW9/eea/y/XqAgRoLLMuE9Cz0hfX5bi7p116IWoB+P237A==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-musl": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.59.1.tgz",
+ "integrity": "sha512-L1uD9b/Ig8Z+rn1KttCJjwhN1FgjRMBKsPaBsDKkfUl7GfFq71pU4vWCnpOsGljycFEbkHWARZLf4lMYg3WOLw==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-s390x-gnu": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.59.1.tgz",
+ "integrity": "sha512-EZc9NGTk/oSUzzOD4nYY4gIjteo2M3CiozX6t1IXGCOdgxJTlVu/7EdPeiqeHPSIrxkLhavqpBAUCfvC6vBOug==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-gnu": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.59.1.tgz",
+ "integrity": "sha512-NQ9KyU1Anuy59L8+HHOKM++CoUxrQWrZWXRik4BJFm+7i5NP6q/SW43xIBr80zzt+PDBJ7LeNmloQGfa0JGk0w==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-musl": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.59.1.tgz",
+ "integrity": "sha512-GZkLk2t6naywsveSFBsEb0PLU+JC9ggVjbndsbG20VPhar6D1gkMfCx4NfP9owpovBXTN+eRdqGSkDGIxPHhmQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-openbsd-x64": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.59.1.tgz",
+ "integrity": "sha512-1hjG9Jpl2KDOetr64iQd8AZAEjkDUUK5RbDkYWsViYLC1op1oNzdjMJeFiofcGhqbNTaY2kfgqowE7DILifsrA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-openharmony-arm64": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.59.1.tgz",
+ "integrity": "sha512-ARoKfflk0SiiYm3r1fmF73K/yB+PThmOwfWCk1sr7x/k9dc3uGLWuEE9if+Pw21el8MSpp3TMnG5vLNsJ/MMGQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-arm64-msvc": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.59.1.tgz",
+ "integrity": "sha512-oOST61G6VM45Mz2vdzWMr1s2slI7y9LqxEV5fCoWi2MDONmMvgsJVHSXxce/I2xOSZPTZ47nDPOl1tkwKWSHcw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-ia32-msvc": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.59.1.tgz",
+ "integrity": "sha512-x5WgLi5dWpRz7WclKBGEF15LcWTh0ewrHM6Cq4A+WUbkysUMZNeqt05bwPonOQ3ihPS/WMhAZV5zB1DfnI4Sxg==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-x64-gnu": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.59.1.tgz",
+ "integrity": "sha512-wS+zHAJRVP5zOL0e+a3V3E/NTEwM2HEvvNKoDy5Xcfs0o8lljxn+EAFPkUsxihBdmDq1JWzXmmB9cbssCPdxxw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-x64-msvc": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.1.tgz",
+ "integrity": "sha512-rhHyrMeLpErT/C7BxcEsU4COHQUzHyrPYW5tOZUeUhziNtRuYxmDWvqQqzpuUt8xpOgmbKa1btGXfnA/ANVO+g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@standard-schema/spec": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",
+ "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/chai": {
+ "version": "5.2.3",
+ "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",
+ "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/deep-eql": "*",
+ "assertion-error": "^2.0.1"
+ }
+ },
+ "node_modules/@types/deep-eql": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",
+ "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/estree": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/node": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-25.5.0.tgz",
+ "integrity": "sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~7.18.0"
+ }
+ },
+ "node_modules/@vitest/expect": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.0.tgz",
+ "integrity": "sha512-EIxG7k4wlWweuCLG9Y5InKFwpMEOyrMb6ZJ1ihYu02LVj/bzUwn2VMU+13PinsjRW75XnITeFrQBMH5+dLvCDA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@standard-schema/spec": "^1.1.0",
+ "@types/chai": "^5.2.2",
+ "@vitest/spy": "4.1.0",
+ "@vitest/utils": "4.1.0",
+ "chai": "^6.2.2",
+ "tinyrainbow": "^3.0.3"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/mocker": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.0.tgz",
+ "integrity": "sha512-evxREh+Hork43+Y4IOhTo+h5lGmVRyjqI739Rz4RlUPqwrkFFDF6EMvOOYjTx4E8Tl6gyCLRL8Mu7Ry12a13Tw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/spy": "4.1.0",
+ "estree-walker": "^3.0.3",
+ "magic-string": "^0.30.21"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "msw": "^2.4.9",
+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0-0"
+ },
+ "peerDependenciesMeta": {
+ "msw": {
+ "optional": true
+ },
+ "vite": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@vitest/pretty-format": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.0.tgz",
+ "integrity": "sha512-3RZLZlh88Ib0J7NQTRATfc/3ZPOnSUn2uDBUoGNn5T36+bALixmzphN26OUD3LRXWkJu4H0s5vvUeqBiw+kS0A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "tinyrainbow": "^3.0.3"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/runner": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.0.tgz",
+ "integrity": "sha512-Duvx2OzQ7d6OjchL+trw+aSrb9idh7pnNfxrklo14p3zmNL4qPCDeIJAK+eBKYjkIwG96Bc6vYuxhqDXQOWpoQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/utils": "4.1.0",
+ "pathe": "^2.0.3"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/snapshot": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.0.tgz",
+ "integrity": "sha512-0Vy9euT1kgsnj1CHttwi9i9o+4rRLEaPRSOJ5gyv579GJkNpgJK+B4HSv/rAWixx2wdAFci1X4CEPjiu2bXIMg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/pretty-format": "4.1.0",
+ "@vitest/utils": "4.1.0",
+ "magic-string": "^0.30.21",
+ "pathe": "^2.0.3"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/spy": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.0.tgz",
+ "integrity": "sha512-pz77k+PgNpyMDv2FV6qmk5ZVau6c3R8HC8v342T2xlFxQKTrSeYw9waIJG8KgV9fFwAtTu4ceRzMivPTH6wSxw==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/utils": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.0.tgz",
+ "integrity": "sha512-XfPXT6a8TZY3dcGY8EdwsBulFCIw+BeeX0RZn2x/BtiY/75YGh8FeWGG8QISN/WhaqSrE2OrlDgtF8q5uhOTmw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/pretty-format": "4.1.0",
+ "convert-source-map": "^2.0.0",
+ "tinyrainbow": "^3.0.3"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/acorn": {
+ "version": "8.16.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz",
+ "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "acorn": "bin/acorn"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/any-promise": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
+ "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/assertion-error": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
+ "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/bundle-require": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-5.1.0.tgz",
+ "integrity": "sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "load-tsconfig": "^0.2.3"
+ },
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "peerDependencies": {
+ "esbuild": ">=0.18"
+ }
+ },
+ "node_modules/cac": {
+ "version": "6.7.14",
+ "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",
+ "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/chai": {
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz",
+ "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/chokidar": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
+ "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "readdirp": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 14.16.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/commander": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
+ "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/confbox": {
+ "version": "0.1.8",
+ "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz",
+ "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/consola": {
+ "version": "3.4.2",
+ "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz",
+ "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^14.18.0 || >=16.10.0"
+ }
+ },
+ "node_modules/convert-source-map": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
+ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/es-module-lexer": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.0.0.tgz",
+ "integrity": "sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/esbuild": {
+ "version": "0.27.4",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.4.tgz",
+ "integrity": "sha512-Rq4vbHnYkK5fws5NF7MYTU68FPRE1ajX7heQ/8QXXWqNgqqJ/GkmmyxIzUnf2Sr/bakf8l54716CcMGHYhMrrQ==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "@esbuild/aix-ppc64": "0.27.4",
+ "@esbuild/android-arm": "0.27.4",
+ "@esbuild/android-arm64": "0.27.4",
+ "@esbuild/android-x64": "0.27.4",
+ "@esbuild/darwin-arm64": "0.27.4",
+ "@esbuild/darwin-x64": "0.27.4",
+ "@esbuild/freebsd-arm64": "0.27.4",
+ "@esbuild/freebsd-x64": "0.27.4",
+ "@esbuild/linux-arm": "0.27.4",
+ "@esbuild/linux-arm64": "0.27.4",
+ "@esbuild/linux-ia32": "0.27.4",
+ "@esbuild/linux-loong64": "0.27.4",
+ "@esbuild/linux-mips64el": "0.27.4",
+ "@esbuild/linux-ppc64": "0.27.4",
+ "@esbuild/linux-riscv64": "0.27.4",
+ "@esbuild/linux-s390x": "0.27.4",
+ "@esbuild/linux-x64": "0.27.4",
+ "@esbuild/netbsd-arm64": "0.27.4",
+ "@esbuild/netbsd-x64": "0.27.4",
+ "@esbuild/openbsd-arm64": "0.27.4",
+ "@esbuild/openbsd-x64": "0.27.4",
+ "@esbuild/openharmony-arm64": "0.27.4",
+ "@esbuild/sunos-x64": "0.27.4",
+ "@esbuild/win32-arm64": "0.27.4",
+ "@esbuild/win32-ia32": "0.27.4",
+ "@esbuild/win32-x64": "0.27.4"
+ }
+ },
+ "node_modules/estree-walker": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "^1.0.0"
+ }
+ },
+ "node_modules/expect-type": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz",
+ "integrity": "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
+ "node_modules/fdir": {
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/fix-dts-default-cjs-exports": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/fix-dts-default-cjs-exports/-/fix-dts-default-cjs-exports-1.0.1.tgz",
+ "integrity": "sha512-pVIECanWFC61Hzl2+oOCtoJ3F17kglZC/6N94eRWycFgBH35hHx0Li604ZIzhseh97mf2p0cv7vVrOZGoqhlEg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "magic-string": "^0.30.17",
+ "mlly": "^1.7.4",
+ "rollup": "^4.34.8"
+ }
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/joycon": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz",
+ "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/lilconfig": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz",
+ "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/antonk52"
+ }
+ },
+ "node_modules/lines-and-columns": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
+ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/load-tsconfig": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/load-tsconfig/-/load-tsconfig-0.2.5.tgz",
+ "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ }
+ },
+ "node_modules/magic-string": {
+ "version": "0.30.21",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
+ "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.5"
+ }
+ },
+ "node_modules/mlly": {
+ "version": "1.8.2",
+ "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.2.tgz",
+ "integrity": "sha512-d+ObxMQFmbt10sretNDytwt85VrbkhhUA/JBGm1MPaWJ65Cl4wOgLaB1NYvJSZ0Ef03MMEU/0xpPMXUIQ29UfA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "acorn": "^8.16.0",
+ "pathe": "^2.0.3",
+ "pkg-types": "^1.3.1",
+ "ufo": "^1.6.3"
+ }
+ },
+ "node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/mz": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
+ "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "any-promise": "^1.0.0",
+ "object-assign": "^4.0.1",
+ "thenify-all": "^1.0.0"
+ }
+ },
+ "node_modules/nanoid": {
+ "version": "3.3.11",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
+ "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/obug": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz",
+ "integrity": "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==",
+ "dev": true,
+ "funding": [
+ "https://github.com/sponsors/sxzz",
+ "https://opencollective.com/debug"
+ ],
+ "license": "MIT"
+ },
+ "node_modules/pathe": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
+ "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/picocolors": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/picomatch": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
+ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/pirates": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz",
+ "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/pkg-types": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz",
+ "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "confbox": "^0.1.8",
+ "mlly": "^1.7.4",
+ "pathe": "^2.0.1"
+ }
+ },
+ "node_modules/postcss": {
+ "version": "8.5.8",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.8.tgz",
+ "integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "nanoid": "^3.3.11",
+ "picocolors": "^1.1.1",
+ "source-map-js": "^1.2.1"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ }
+ },
+ "node_modules/postcss-load-config": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz",
+ "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "lilconfig": "^3.1.1"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "peerDependencies": {
+ "jiti": ">=1.21.0",
+ "postcss": ">=8.0.9",
+ "tsx": "^4.8.1",
+ "yaml": "^2.4.2"
+ },
+ "peerDependenciesMeta": {
+ "jiti": {
+ "optional": true
+ },
+ "postcss": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/readdirp": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
+ "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14.18.0"
+ },
+ "funding": {
+ "type": "individual",
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/resolve-from": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",
+ "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/rollup": {
+ "version": "4.59.1",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.1.tgz",
+ "integrity": "sha512-iZKH8BeoCwTCBTZBZWQQMreekd4mdomwdjIQ40GC1oZm6o+8PnNMIxFOiCsGMWeS8iDJ7KZcl7KwmKk/0HOQpA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "1.0.8"
+ },
+ "bin": {
+ "rollup": "dist/bin/rollup"
+ },
+ "engines": {
+ "node": ">=18.0.0",
+ "npm": ">=8.0.0"
+ },
+ "optionalDependencies": {
+ "@rollup/rollup-android-arm-eabi": "4.59.1",
+ "@rollup/rollup-android-arm64": "4.59.1",
+ "@rollup/rollup-darwin-arm64": "4.59.1",
+ "@rollup/rollup-darwin-x64": "4.59.1",
+ "@rollup/rollup-freebsd-arm64": "4.59.1",
+ "@rollup/rollup-freebsd-x64": "4.59.1",
+ "@rollup/rollup-linux-arm-gnueabihf": "4.59.1",
+ "@rollup/rollup-linux-arm-musleabihf": "4.59.1",
+ "@rollup/rollup-linux-arm64-gnu": "4.59.1",
+ "@rollup/rollup-linux-arm64-musl": "4.59.1",
+ "@rollup/rollup-linux-loong64-gnu": "4.59.1",
+ "@rollup/rollup-linux-loong64-musl": "4.59.1",
+ "@rollup/rollup-linux-ppc64-gnu": "4.59.1",
+ "@rollup/rollup-linux-ppc64-musl": "4.59.1",
+ "@rollup/rollup-linux-riscv64-gnu": "4.59.1",
+ "@rollup/rollup-linux-riscv64-musl": "4.59.1",
+ "@rollup/rollup-linux-s390x-gnu": "4.59.1",
+ "@rollup/rollup-linux-x64-gnu": "4.59.1",
+ "@rollup/rollup-linux-x64-musl": "4.59.1",
+ "@rollup/rollup-openbsd-x64": "4.59.1",
+ "@rollup/rollup-openharmony-arm64": "4.59.1",
+ "@rollup/rollup-win32-arm64-msvc": "4.59.1",
+ "@rollup/rollup-win32-ia32-msvc": "4.59.1",
+ "@rollup/rollup-win32-x64-gnu": "4.59.1",
+ "@rollup/rollup-win32-x64-msvc": "4.59.1",
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/siginfo": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",
+ "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/source-map": {
+ "version": "0.7.6",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz",
+ "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">= 12"
+ }
+ },
+ "node_modules/source-map-js": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/stackback": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz",
+ "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/std-env": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.0.0.tgz",
+ "integrity": "sha512-zUMPtQ/HBY3/50VbpkupYHbRroTRZJPRLvreamgErJVys0ceuzMkD44J/QjqhHjOzK42GQ3QZIeFG1OYfOtKqQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/sucrase": {
+ "version": "3.35.1",
+ "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz",
+ "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.2",
+ "commander": "^4.0.0",
+ "lines-and-columns": "^1.1.6",
+ "mz": "^2.7.0",
+ "pirates": "^4.0.1",
+ "tinyglobby": "^0.2.11",
+ "ts-interface-checker": "^0.1.9"
+ },
+ "bin": {
+ "sucrase": "bin/sucrase",
+ "sucrase-node": "bin/sucrase-node"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ }
+ },
+ "node_modules/thenify": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",
+ "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "any-promise": "^1.0.0"
+ }
+ },
+ "node_modules/thenify-all": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz",
+ "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "thenify": ">= 3.1.0 < 4"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
+ "node_modules/tinybench": {
+ "version": "2.9.0",
+ "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz",
+ "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/tinyexec": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz",
+ "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/tinyglobby": {
+ "version": "0.2.15",
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
+ "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fdir": "^6.5.0",
+ "picomatch": "^4.0.3"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/SuperchupuDev"
+ }
+ },
+ "node_modules/tinyrainbow": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.0.tgz",
+ "integrity": "sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
+ "node_modules/tree-kill": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz",
+ "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "tree-kill": "cli.js"
+ }
+ },
+ "node_modules/ts-interface-checker": {
+ "version": "0.1.13",
+ "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",
+ "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==",
+ "dev": true,
+ "license": "Apache-2.0"
+ },
+ "node_modules/tsup": {
+ "version": "8.5.1",
+ "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.5.1.tgz",
+ "integrity": "sha512-xtgkqwdhpKWr3tKPmCkvYmS9xnQK3m3XgxZHwSUjvfTjp7YfXe5tT3GgWi0F2N+ZSMsOeWeZFh7ZZFg5iPhing==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "bundle-require": "^5.1.0",
+ "cac": "^6.7.14",
+ "chokidar": "^4.0.3",
+ "consola": "^3.4.0",
+ "debug": "^4.4.0",
+ "esbuild": "^0.27.0",
+ "fix-dts-default-cjs-exports": "^1.0.0",
+ "joycon": "^3.1.1",
+ "picocolors": "^1.1.1",
+ "postcss-load-config": "^6.0.1",
+ "resolve-from": "^5.0.0",
+ "rollup": "^4.34.8",
+ "source-map": "^0.7.6",
+ "sucrase": "^3.35.0",
+ "tinyexec": "^0.3.2",
+ "tinyglobby": "^0.2.11",
+ "tree-kill": "^1.2.2"
+ },
+ "bin": {
+ "tsup": "dist/cli-default.js",
+ "tsup-node": "dist/cli-node.js"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@microsoft/api-extractor": "^7.36.0",
+ "@swc/core": "^1",
+ "postcss": "^8.4.12",
+ "typescript": ">=4.5.0"
+ },
+ "peerDependenciesMeta": {
+ "@microsoft/api-extractor": {
+ "optional": true
+ },
+ "@swc/core": {
+ "optional": true
+ },
+ "postcss": {
+ "optional": true
+ },
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/typescript": {
+ "version": "5.9.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
+ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
+ "node_modules/ufo": {
+ "version": "1.6.3",
+ "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz",
+ "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/undici-types": {
+ "version": "7.18.2",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
+ "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/vite": {
+ "version": "6.4.1",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz",
+ "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "esbuild": "^0.25.0",
+ "fdir": "^6.4.4",
+ "picomatch": "^4.0.2",
+ "postcss": "^8.5.3",
+ "rollup": "^4.34.9",
+ "tinyglobby": "^0.2.13"
+ },
+ "bin": {
+ "vite": "bin/vite.js"
+ },
+ "engines": {
+ "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/vitejs/vite?sponsor=1"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
+ },
+ "peerDependencies": {
+ "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
+ "jiti": ">=1.21.0",
+ "less": "*",
+ "lightningcss": "^1.21.0",
+ "sass": "*",
+ "sass-embedded": "*",
+ "stylus": "*",
+ "sugarss": "*",
+ "terser": "^5.16.0",
+ "tsx": "^4.8.1",
+ "yaml": "^2.4.2"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ },
+ "jiti": {
+ "optional": true
+ },
+ "less": {
+ "optional": true
+ },
+ "lightningcss": {
+ "optional": true
+ },
+ "sass": {
+ "optional": true
+ },
+ "sass-embedded": {
+ "optional": true
+ },
+ "stylus": {
+ "optional": true
+ },
+ "sugarss": {
+ "optional": true
+ },
+ "terser": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/aix-ppc64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
+ "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/android-arm": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz",
+ "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/android-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz",
+ "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/android-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz",
+ "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/darwin-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz",
+ "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/darwin-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz",
+ "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/freebsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz",
+ "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/linux-arm": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz",
+ "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/linux-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz",
+ "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/linux-ia32": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz",
+ "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/linux-loong64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz",
+ "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/linux-mips64el": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz",
+ "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/linux-ppc64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz",
+ "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/linux-riscv64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz",
+ "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/linux-s390x": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz",
+ "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/linux-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz",
+ "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/netbsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/netbsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz",
+ "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/openbsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/openbsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz",
+ "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/openharmony-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz",
+ "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/sunos-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz",
+ "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/win32-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz",
+ "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/win32-ia32": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz",
+ "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/@esbuild/win32-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz",
+ "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vite/node_modules/esbuild": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz",
+ "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "@esbuild/aix-ppc64": "0.25.12",
+ "@esbuild/android-arm": "0.25.12",
+ "@esbuild/android-arm64": "0.25.12",
+ "@esbuild/android-x64": "0.25.12",
+ "@esbuild/darwin-arm64": "0.25.12",
+ "@esbuild/darwin-x64": "0.25.12",
+ "@esbuild/freebsd-arm64": "0.25.12",
+ "@esbuild/freebsd-x64": "0.25.12",
+ "@esbuild/linux-arm": "0.25.12",
+ "@esbuild/linux-arm64": "0.25.12",
+ "@esbuild/linux-ia32": "0.25.12",
+ "@esbuild/linux-loong64": "0.25.12",
+ "@esbuild/linux-mips64el": "0.25.12",
+ "@esbuild/linux-ppc64": "0.25.12",
+ "@esbuild/linux-riscv64": "0.25.12",
+ "@esbuild/linux-s390x": "0.25.12",
+ "@esbuild/linux-x64": "0.25.12",
+ "@esbuild/netbsd-arm64": "0.25.12",
+ "@esbuild/netbsd-x64": "0.25.12",
+ "@esbuild/openbsd-arm64": "0.25.12",
+ "@esbuild/openbsd-x64": "0.25.12",
+ "@esbuild/openharmony-arm64": "0.25.12",
+ "@esbuild/sunos-x64": "0.25.12",
+ "@esbuild/win32-arm64": "0.25.12",
+ "@esbuild/win32-ia32": "0.25.12",
+ "@esbuild/win32-x64": "0.25.12"
+ }
+ },
+ "node_modules/vitest": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.0.tgz",
+ "integrity": "sha512-YbDrMF9jM2Lqc++2530UourxZHmkKLxrs4+mYhEwqWS97WJ7wOYEkcr+QfRgJ3PW9wz3odRijLZjHEaRLTNbqw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/expect": "4.1.0",
+ "@vitest/mocker": "4.1.0",
+ "@vitest/pretty-format": "4.1.0",
+ "@vitest/runner": "4.1.0",
+ "@vitest/snapshot": "4.1.0",
+ "@vitest/spy": "4.1.0",
+ "@vitest/utils": "4.1.0",
+ "es-module-lexer": "^2.0.0",
+ "expect-type": "^1.3.0",
+ "magic-string": "^0.30.21",
+ "obug": "^2.1.1",
+ "pathe": "^2.0.3",
+ "picomatch": "^4.0.3",
+ "std-env": "^4.0.0-rc.1",
+ "tinybench": "^2.9.0",
+ "tinyexec": "^1.0.2",
+ "tinyglobby": "^0.2.15",
+ "tinyrainbow": "^3.0.3",
+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0-0",
+ "why-is-node-running": "^2.3.0"
+ },
+ "bin": {
+ "vitest": "vitest.mjs"
+ },
+ "engines": {
+ "node": "^20.0.0 || ^22.0.0 || >=24.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "@edge-runtime/vm": "*",
+ "@opentelemetry/api": "^1.9.0",
+ "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0",
+ "@vitest/browser-playwright": "4.1.0",
+ "@vitest/browser-preview": "4.1.0",
+ "@vitest/browser-webdriverio": "4.1.0",
+ "@vitest/ui": "4.1.0",
+ "happy-dom": "*",
+ "jsdom": "*",
+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0-0"
+ },
+ "peerDependenciesMeta": {
+ "@edge-runtime/vm": {
+ "optional": true
+ },
+ "@opentelemetry/api": {
+ "optional": true
+ },
+ "@types/node": {
+ "optional": true
+ },
+ "@vitest/browser-playwright": {
+ "optional": true
+ },
+ "@vitest/browser-preview": {
+ "optional": true
+ },
+ "@vitest/browser-webdriverio": {
+ "optional": true
+ },
+ "@vitest/ui": {
+ "optional": true
+ },
+ "happy-dom": {
+ "optional": true
+ },
+ "jsdom": {
+ "optional": true
+ },
+ "vite": {
+ "optional": false
+ }
+ }
+ },
+ "node_modules/vitest/node_modules/tinyexec": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.4.tgz",
+ "integrity": "sha512-u9r3uZC0bdpGOXtlxUIdwf9pkmvhqJdrVCH9fapQtgy/OeTTMZ1nqH7agtvEfmGui6e1XxjcdrlxvxJvc3sMqw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/why-is-node-running": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz",
+ "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "siginfo": "^2.0.0",
+ "stackback": "0.0.2"
+ },
+ "bin": {
+ "why-is-node-running": "cli.js"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/yaml": {
+ "version": "2.8.3",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz",
+ "integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==",
+ "license": "ISC",
+ "bin": {
+ "yaml": "bin.mjs"
+ },
+ "engines": {
+ "node": ">= 14.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/eemeli"
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..4902547
--- /dev/null
+++ b/package.json
@@ -0,0 +1,43 @@
+{
+ "name": "oh-my-mermaid",
+ "version": "0.1.3",
+ "description": "Architecture mirror for vibe coding — CLI + Claude Code skills",
+ "type": "module",
+ "bin": {
+ "omm": "./dist/cli.js"
+ },
+ "main": "./dist/index.js",
+ "types": "./dist/index.d.ts",
+ "files": [
+ "dist/",
+ "skills/",
+ "LICENSE"
+ ],
+ "keywords": [
+ "mermaid",
+ "architecture",
+ "diagram",
+ "claude-code",
+ "vibe-coding"
+ ],
+ "engines": {
+ "node": ">=18"
+ },
+ "scripts": {
+ "build": "tsup",
+ "dev": "tsup --watch",
+ "test": "vitest run",
+ "prepublishOnly": "npm run build"
+ },
+ "author": "",
+ "license": "MIT",
+ "devDependencies": {
+ "@types/node": "^25.5.0",
+ "tsup": "^8.5.1",
+ "typescript": "^5.9.3",
+ "vitest": "^4.1.0"
+ },
+ "dependencies": {
+ "yaml": "^2.8.3"
+ }
+}
diff --git a/skills/omm-push/SKILL.md b/skills/omm-push/SKILL.md
new file mode 100644
index 0000000..5e5235d
--- /dev/null
+++ b/skills/omm-push/SKILL.md
@@ -0,0 +1,52 @@
+---
+name: omm-push
+description: Push architecture docs to oh-my-mermaid cloud. Handles login, link, and push workflow with error guidance. Use when the user says "omm push", "push to cloud", "deploy architecture", or "share architecture".
+---
+
+# omm-push — Cloud Push Workflow
+
+## Purpose
+
+Automate the full workflow of pushing .omm/ architecture docs to the oh-my-mermaid cloud service.
+
+## Prerequisites
+
+The `omm` CLI must be installed (`npm install -g oh-my-mermaid`).
+
+## Workflow
+
+### Step 1: Check Login Status
+
+Run `omm share` via Bash. If it errors with "not logged in":
+- Tell the user: "You need to log in first."
+- Run `omm login` — this opens a browser for GitHub OAuth
+- Wait for the user to complete login
+
+### Step 2: Check Project Link
+
+Run `omm share` via Bash. If it errors with "no project slug":
+- Run `omm link` — this sets the cloud project slug from the directory name
+- Confirm: "Linked to {slug}"
+
+### Step 3: Push
+
+Run `omm push` via Bash.
+
+Handle errors:
+- **401 Unauthorized**: "Login expired. Run `omm login` again."
+- **403 Free plan limit**: "Free plan allows 1 project. Upgrade at https://ohmymermaid.com/pricing"
+- **Network error**: "Cannot reach server. Check your connection."
+
+### Step 4: Report
+
+On success, output:
+- Number of files uploaded
+- View URL: `https://ohmymermaid.com/p/{slug}`
+- Share URL (if Pro): "Run `omm share` to get the shareable link"
+
+## Rules
+
+- Always check login before pushing
+- Always check link before pushing
+- Do NOT skip steps — each depends on the previous
+- If any step fails, stop and report the error with guidance
diff --git a/skills/omm-scan/SKILL.md b/skills/omm-scan/SKILL.md
new file mode 100644
index 0000000..c65d23e
--- /dev/null
+++ b/skills/omm-scan/SKILL.md
@@ -0,0 +1,271 @@
+---
+name: omm-scan
+description: Scan codebase architecture and generate/update .omm/ documentation. Without arguments does a full scan; with arguments focuses on a specific topic and auto-links to parent diagrams. Use when the user says "omm scan", "scan architecture", "update architecture", "refresh diagrams", "omm scan auth flow", "analyze the payment module", or "dive into auth".
+argument-hint: "[topic]"
+---
+
+# omm-scan — Architecture Scanner (Full + Focused)
+
+## Purpose
+
+Analyze the codebase and generate/update `.omm/` architecture documentation using the `omm` CLI.
+Operates in two modes based on whether arguments are provided.
+
+## Prerequisites
+
+The `omm` CLI must be installed (`npm install -g oh-my-mermaid` or available via npx).
+
+## Mode Detection
+
+- **No arguments** (`/omm-scan`): Full scan mode — analyze entire codebase
+- **With arguments** (`/omm-scan auth flow`): Focused mode — analyze specific topic only
+
+---
+
+## A. Full Scan Mode (no arguments)
+
+### Step 1: Initialize
+
+If `.omm/` does not exist, run `omm init` first.
+
+```bash
+omm init
+```
+
+### Step 2: Check Existing State
+
+```bash
+omm list
+```
+
+For each existing class, read current content:
+```bash
+omm <class> description
+omm <class> diagram
+```
+
+### Step 3: Explore the Codebase
+
+Use Glob and Read to understand the project:
+- Read `package.json`, `tsconfig.json`, or equivalent config files
+- List top-level directories to identify module boundaries
+- Read key entry points (main, index, app files)
+- Look for route definitions, service layers, database connections
+
+### Step 4: Generate/Update Classes
+
+**First run (no existing classes):** Create classes based on what a person new to this codebase most needs to understand. Always start with `overall-architecture`, then add perspectives from this list based on what exists in the code:
+
+| Class name | When to create | What it answers |
+|---|---|---|
+| `overall-architecture` | Always | What exists and how pieces relate |
+| `request-lifecycle` | Any server/API | How a request enters and gets handled end-to-end |
+| `data-flow` | Any data processing | Where data comes from, transforms, and lands |
+| `auth-flow` | Any auth/session logic | How identity is established and propagated |
+| `dependency-map` | Complex module graph | What depends on what, what's shared |
+| `state-transitions` | Stateful features | How state changes and what triggers it |
+| `external-integrations` | External APIs/services | What the system connects to and why |
+
+Only create a class if it meaningfully exists in the code. 3-5 classes is usually right; avoid forcing perspectives that don't exist.
+
+**Subsequent runs:** Compare existing docs against current code, update only what changed.
+
+For each class, call the CLI with **each field separately**:
+
+```bash
+omm <class> description - <<'EOF'
+(1-2 sentences: what this diagram shows AND who should read it)
+- e.g., "Shows how an HTTP request flows from entry point to response. Start here if you want to understand how the API handles a request."
+EOF
+
+omm <class> diagram - <<'MERMAID'
+graph LR
+ (Accurate mermaid diagram based on actual code)
+MERMAID
+
+omm <class> context - <<'EOF'
+(The most important field for human understanding: WHY this architecture exists)
+- Key decisions made and why (e.g., "Chose event-driven over direct calls to decouple billing from orders")
+- Constraints that shaped the design (e.g., "Must support offline mode — hence local-first storage")
+- Alternatives considered and rejected
+- Historical reasons if relevant
+EOF
+
+omm <class> constraint - <<'EOF'
+(Rules that MUST be followed when changing this area)
+- e.g., "API layer must never import from repository directly — always go through service"
+EOF
+
+omm <class> concern - <<'EOF'
+(Risks, technical debt, known issues a reader should be aware of)
+- e.g., "Auth service is a single point of failure — no fallback if it's down"
+EOF
+
+omm <class> todo - <<'EOF'
+(Concrete next steps or planned improvements)
+- e.g., "Add caching layer between service and repository"
+EOF
+
+omm <class> note - <<'EOF'
+(Anything else a new reader would want to know that doesn't fit above)
+EOF
+```
+
+### Step 5: Cross-References
+
+Use `@class-name` convention for nodes that represent another class. For `@ref` nodes, do NOT add a path as the second line — instead, use a plain concept label:
+
+```mermaid
+graph LR
+ client["Browser Client\nsrc/client/"]
+ client -->|"HTTP request"| @api-layer["API Layer"]
+ client -->|"authenticate"| @auth-flow["Auth Service"]
+```
+
+The `@` prefix tells the viewer this node is a drill-down into another class. Adding a file path would be misleading since it represents a whole sub-diagram, not a single file.
+
+### Step 6: Summarize
+
+Report what was created/updated and suggest `omm serve` to view.
+
+---
+
+## B. Focused Mode (with arguments)
+
+### Step 1: Parse Topic
+
+Convert `$ARGUMENTS` to a kebab-case class name:
+- "auth flow" → `auth-flow`
+- "payment service" → `payment-service`
+- "database schema" → `database-schema`
+
+### Step 2: Deep Analysis
+
+Focus Glob and Read on code related to the topic:
+- Search for files matching the topic (e.g., `*auth*`, `*payment*`)
+- Trace imports and dependencies from those files
+- Understand the full flow for this specific concern
+
+### Step 3: Create/Update Class
+
+Generate all fields via CLI (same as full scan, but for this one class only).
+
+### Step 4: Auto-Link to Parent
+
+This is the key differentiator from full scan:
+
+1. Run `omm list` to get existing classes
+2. For each existing class, run `omm <class> diagram` to read its diagram
+3. Check if the new class is already referenced as `@new-class`
+4. If NOT referenced, find the logical parent (usually `overall-architecture`) and update its diagram to include `@new-class[Label]` node
+
+Example: After creating `auth-flow`, update `overall-architecture`:
+```bash
+# Read current parent diagram
+omm overall-architecture diagram
+# Add @auth-flow reference and rewrite
+omm overall-architecture diagram - <<'MERMAID'
+graph LR
+ Client --> @auth-flow[Auth Service]
+ ...existing nodes...
+MERMAID
+```
+
+### Step 5: Verify and Summarize
+
+```bash
+omm refs <new-class>
+```
+
+Report: "auth-flow created, @auth-flow added to overall-architecture"
+
+---
+
+### Nested Architecture Analysis
+
+When analyzing the codebase, identify sub-systems that are complex enough to warrant their own diagram (5+ nodes). Create separate classes for these and reference them with `@class-name` in the parent diagram.
+
+**When to nest:**
+- A module has 5+ internal components with their own relationships
+- A subsystem has distinct layers or flows worth documenting separately
+- A feature area (auth, billing, data pipeline) has its own internal architecture
+
+**How to nest:**
+1. Create a new class: `omm <child-class> diagram - <<'MERMAID'...MERMAID`
+2. In the parent diagram, use `@child-class[Label]` as the node ID
+3. Fill all 7 fields for the child class (description, constraint, concern, context, todo, note)
+
+**Example:**
+If `overall-architecture` has an auth subsystem with 8+ nodes:
+- Create `auth-flow` class with its own detailed diagram
+- In `overall-architecture` diagram: `Client --> @auth-flow[Auth Service]`
+- The viewer will render `@auth-flow` as a clickable, expandable sub-group
+
+### Edge Labels
+
+Every edge MUST have a meaningful label. The label should answer **"why does this connection exist?"** — not just the protocol.
+
+**Format:** `A -->|"label"| B`
+
+**What to include in labels (priority order):**
+1. The purpose/intent: what does this relationship accomplish?
+2. What data/result flows: what is actually transferred?
+3. Protocol/method only if it adds clarity (HTTP, IPC, Event, etc.)
+
+**Good examples:**
+```mermaid
+Client -->|"login request (HTTP POST)"| AuthService
+AuthService -->|"issue session token"| Client
+AuthService -->|"verify user exists"| UserRepository
+OrderService -->|"request payment authorization"| PaymentGateway
+PaymentGateway -->|"authorization result callback"| OrderService
+EventBus -->|"emit: order.completed"| NotificationService
+```
+
+**Bad examples (avoid):**
+```mermaid
+A --> B
+Client --> Server
+AuthService -->|"HTTP"| UserRepository
+```
+
+The test: if you remove the label, does the reader lose important understanding? If yes, the label is good. If the label is just a protocol name, it's probably not enough.
+
+## Rules (Both Modes)
+
+- Write all content (node labels, edge labels, field text) in **English by default**. If the user wrote in another language, match that language throughout.
+- ONLY document what actually exists in the code. Do not invent or speculate.
+- **Node labels must use two-line format**: concept name on the first line, file/directory path on the second line, separated by `\n`:
+ ```
+ auth_service["Auth Service\nsrc/auth/service.ts"]
+ user_repo["User Repository\nsrc/user/repository.ts"]
+ payment_module["Payment Module\nsrc/payment/"]
+ ```
+ - First line: role/responsibility in plain language (what it does)
+ - Second line: actual path relative to project root (where to find it)
+ - The viewer renders the path smaller and muted below the concept name
+ - For modules/folders, use the directory path (e.g., `src/payment/`)
+ - For single files, use the file path (e.g., `src/auth/service.ts`)
+- Keep diagrams readable — 5-15 nodes max per diagram.
+- Use `graph LR` for most diagrams, `graph TD` for hierarchies.
+- Do NOT rewrite classes that haven't changed.
+- Do NOT delete classes — only report if obsolete.
+- Write each field separately (constraint, concern, context, todo, note) — do NOT combine them.
+- Use `omm diff <class>` after updating to verify changes.
+- Use `classDef` to visually distinguish node roles — apply only when the distinction genuinely helps a reader:
+
+ | Class | Color | When to use |
+ |---|---|---|
+ | `external` | muted gray `#585b70` | Third-party services, APIs outside your codebase (DB, S3, Stripe, etc.) |
+ | `concern` | red `#f38ba8` | Nodes that are a known risk or bottleneck (single point of failure, legacy code) |
+ | `entry` | blue `#89b4fa` | Entry points (HTTP handler, CLI, queue consumer) |
+ | `store` | green `#a6e3a1` | Persistent storage (DB, cache, file system) |
+
+ ```
+ classDef external fill:#585b70,stroke:#585b70,color:#cdd6f4
+ classDef concern fill:#f38ba8,stroke:#f38ba8,color:#1e1e2e
+ classDef entry fill:#89b4fa,stroke:#89b4fa,color:#1e1e2e
+ classDef store fill:#a6e3a1,stroke:#a6e3a1,color:#1e1e2e
+ ```
+
+ Do not overuse — if everything has a color, nothing stands out.
diff --git a/src/cli.ts b/src/cli.ts
new file mode 100644
index 0000000..ba9f8f4
--- /dev/null
+++ b/src/cli.ts
@@ -0,0 +1,170 @@
+#!/usr/bin/env node
+
+import { commandInit } from './commands/init.js';
+import { commandClassField } from './commands/class-field.js';
+import { commandList } from './commands/list.js';
+import { commandShow } from './commands/show.js';
+import { commandDelete } from './commands/delete.js';
+import { commandStatus } from './commands/status.js';
+import { commandDiff } from './commands/diff.js';
+import { commandRefs } from './commands/refs.js';
+import { commandServe } from './commands/serve.js';
+import { commandLogin } from './commands/login.js';
+import { commandLogout } from './commands/logout.js';
+import { commandPush } from './commands/push.js';
+import { commandPull } from './commands/pull.js';
+import { commandLink } from './commands/link.js';
+import { commandShare } from './commands/share.js';
+
+const GLOBAL_COMMANDS = ['init', 'list', 'show', 'delete', 'status', 'diff', 'refs', 'serve', 'login', 'logout', 'push', 'pull', 'link', 'share', 'help'];
+
+function printHelp(): void {
+ const help = `
+oh-my-mermaid (omm) — Architecture mirror for vibe coding
+
+Usage:
+ omm init Initialize .omm/ and install skills
+ omm list List all classes
+ omm show <class> Show all fields for a class
+ omm delete <class> Delete a class
+ omm status Show overview of all classes
+ omm diff <class> Compare current vs previous diagram
+ omm refs <class> Show classes that reference this class
+ omm refs --reverse <class> Show classes this class references
+ omm serve [--port <port>] Start web viewer (default: 3000)
+
+ omm <class> <field> Read a field (stdout)
+ omm <class> <field> <content> Write a field
+ omm <class> <field> - Write a field from stdin
+
+Cloud:
+ omm login Log in to omm.dev
+ omm logout Log out
+ omm link [slug] Link project to a cloud slug
+ omm push Push .omm/ to cloud
+ omm pull Pull .omm/ from cloud
+ omm share Print the shareable URL
+
+Fields: description, diagram, constraint, concern, context, todo, note
+`;
+ process.stdout.write(help.trim() + '\n');
+}
+
+async function main(): Promise<void> {
+ const args = process.argv.slice(2);
+
+ if (args.length === 0 || args[0] === 'help' || args[0] === '--help' || args[0] === '-h') {
+ printHelp();
+ return;
+ }
+
+ const cmd = args[0];
+
+ switch (cmd) {
+ case 'init':
+ commandInit();
+ return;
+
+ case 'list':
+ commandList();
+ return;
+
+ case 'show':
+ if (!args[1]) {
+ process.stderr.write('error: omm show <class>\n');
+ process.exit(1);
+ }
+ commandShow(args[1]);
+ return;
+
+ case 'delete':
+ if (!args[1]) {
+ process.stderr.write('error: omm delete <class>\n');
+ process.exit(1);
+ }
+ commandDelete(args[1]);
+ return;
+
+ case 'status':
+ commandStatus();
+ return;
+
+ case 'diff':
+ if (!args[1]) {
+ process.stderr.write('error: omm diff <class>\n');
+ process.exit(1);
+ }
+ commandDiff(args[1]);
+ return;
+
+ case 'refs': {
+ let reverse = false;
+ let className = args[1];
+ if (args[1] === '--reverse') {
+ reverse = true;
+ className = args[2];
+ }
+ if (!className) {
+ process.stderr.write('error: omm refs [--reverse] <class>\n');
+ process.exit(1);
+ }
+ commandRefs(className, reverse);
+ return;
+ }
+
+ case 'serve': {
+ let port = 3000;
+ if (args[1] === '--port' && args[2]) {
+ port = parseInt(args[2], 10);
+ if (isNaN(port)) {
+ process.stderr.write('error: invalid port number\n');
+ process.exit(1);
+ }
+ }
+ commandServe(port);
+ return;
+ }
+
+ case 'login':
+ await commandLogin();
+ return;
+
+ case 'logout':
+ commandLogout();
+ return;
+
+ case 'link':
+ commandLink(args[1]);
+ return;
+
+ case 'push':
+ await commandPush();
+ return;
+
+ case 'pull':
+ await commandPull();
+ return;
+
+ case 'share':
+ commandShare();
+ return;
+
+ default:
+ // Class-field pattern: omm <class> <field> [content]
+ if (args.length >= 2 && !GLOBAL_COMMANDS.includes(cmd)) {
+ const className = cmd;
+ const field = args[1];
+ const content = args.length >= 3 ? args.slice(2).join(' ') : undefined;
+ await commandClassField(className, field, content);
+ return;
+ }
+
+ process.stderr.write(`error: unknown command '${cmd}'. Run 'omm help' for usage.\n`);
+ process.exit(1);
+ }
+}
+
+main().catch(err => {
+ process.stderr.write(`error: ${err.message}\n`);
+ process.exit(1);
+});
diff --git a/src/commands/class-field.ts b/src/commands/class-field.ts
new file mode 100644
index 0000000..23fe698
--- /dev/null
+++ b/src/commands/class-field.ts
@@ -0,0 +1,48 @@
+import { ensureOmm, isValidField, readField, writeField, classExists } from '../lib/store.js';
+import { VALID_FIELDS, type Field } from '../types.js';
+
+function readStdin(): Promise<string> {
+ return new Promise((resolve, reject) => {
+ let data = '';
+ process.stdin.setEncoding('utf-8');
+ process.stdin.on('data', chunk => { data += chunk; });
+ process.stdin.on('end', () => resolve(data));
+ process.stdin.on('error', reject);
+ });
+}
+
+export async function commandClassField(className: string, field: string, content?: string): Promise<void> {
+ ensureOmm();
+
+ if (!isValidField(field)) {
+ process.stderr.write(`error: unknown field '${field}'. Valid: ${VALID_FIELDS.join(', ')}\n`);
+ process.exit(1);
+ }
+
+ const typedField = field as Field;
+
+ // Read mode: no content argument
+ if (content === undefined) {
+ if (!classExists(className)) {
+ process.stderr.write(`error: class '${className}' not found\n`);
+ process.exit(1);
+ }
+ const value = readField(className, typedField);
+ if (value === null) {
+ process.stderr.write(`error: ${className}/${field} is empty\n`);
+ process.exit(1);
+ }
+ process.stdout.write(value);
+ return;
+ }
+
+ // Write mode: content is '-' means read from stdin
+ let finalContent: string;
+ if (content === '-') {
+ finalContent = await readStdin();
+ } else {
+ finalContent = content;
+ }
+
+ writeField(className, typedField, finalContent);
+}
diff --git a/src/commands/delete.ts b/src/commands/delete.ts
new file mode 100644
index 0000000..be5341f
--- /dev/null
+++ b/src/commands/delete.ts
@@ -0,0 +1,11 @@
+import { ensureOmm, deleteClass } from '../lib/store.js';
+
+export function commandDelete(className: string): void {
+ ensureOmm();
+ if (deleteClass(className)) {
+ process.stderr.write(`deleted class '${className}'\n`);
+ } else {
+ process.stderr.write(`error: class '${className}' not found\n`);
+ process.exit(1);
+ }
+}
diff --git a/src/commands/diff.ts b/src/commands/diff.ts
new file mode 100644
index 0000000..c126b1b
--- /dev/null
+++ b/src/commands/diff.ts
@@ -0,0 +1,27 @@
+import { ensureOmm, readField, readMeta, classExists } from '../lib/store.js';
+import { diffMermaid, formatDiff } from '../lib/diff.js';
+
+export function commandDiff(className: string): void {
+ ensureOmm();
+
+ if (!classExists(className)) {
+ process.stderr.write(`error: class '${className}' not found\n`);
+ process.exit(1);
+ }
+
+ const current = readField(className, 'diagram');
+ if (!current) {
+ process.stderr.write(`error: ${className}/diagram.mmd is empty\n`);
+ process.exit(1);
+ }
+
+ const meta = readMeta(className);
+ const prev = meta?.prev_diagram;
+ if (!prev) {
+ process.stderr.write(`No previous diagram version for '${className}'.\n`);
+ return;
+ }
+
+ const diff = diffMermaid(prev, current);
+ process.stdout.write(formatDiff(diff));
+}
diff --git a/src/commands/init.ts b/src/commands/init.ts
new file mode 100644
index 0000000..bb45025
--- /dev/null
+++ b/src/commands/init.ts
@@ -0,0 +1,63 @@
+import fs from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { initOmm, ommExists } from '../lib/store.js';
+
+const __filename = fileURLToPath(import.meta.url);
+const __dirname = path.dirname(__filename);
+
+function copySkills(cwd: string): void {
+ // Skills are at ../skills/ relative to dist/ (or src/ in dev)
+ const candidates = [
+ path.join(__dirname, '..', 'skills'), // from dist/cli.js
+ path.join(__dirname, '..', '..', 'skills'), // from src/commands/init.ts (dev)
+ ];
+
+ let skillsSource: string | null = null;
+ for (const candidate of candidates) {
+ if (fs.existsSync(candidate)) {
+ skillsSource = candidate;
+ break;
+ }
+ }
+
+ if (!skillsSource) {
+ process.stderr.write('warning: skills directory not found, skipping skill installation\n');
+ return;
+ }
+
+ const targetDir = path.join(cwd, '.claude', 'skills');
+ const skillDirs = fs.readdirSync(skillsSource, { withFileTypes: true })
+ .filter(d => d.isDirectory());
+
+ for (const skillDir of skillDirs) {
+ const src = path.join(skillsSource, skillDir.name);
+ const dst = path.join(targetDir, skillDir.name);
+
+ if (fs.existsSync(dst)) {
+ process.stderr.write(` skill ${skillDir.name} already exists, skipping\n`);
+ continue;
+ }
+
+ fs.mkdirSync(dst, { recursive: true });
+ const files = fs.readdirSync(src);
+ for (const file of files) {
+ fs.copyFileSync(path.join(src, file), path.join(dst, file));
+ }
+ process.stderr.write(` installed skill: ${skillDir.name}\n`);
+ }
+}
+
+export function commandInit(): void {
+ const cwd = process.cwd();
+
+ if (ommExists(cwd)) {
+ process.stderr.write('.omm/ already exists\n');
+ } else {
+ initOmm(cwd);
+ process.stderr.write('created .omm/\n');
+ }
+
+ copySkills(cwd);
+ process.stderr.write('omm initialized.\n');
+}
diff --git a/src/commands/link.ts b/src/commands/link.ts
new file mode 100644
index 0000000..373d631
--- /dev/null
+++ b/src/commands/link.ts
@@ -0,0 +1,25 @@
+import fs from 'node:fs';
+import path from 'node:path';
+import YAML from 'yaml';
+import { ensureOmm, getOmmDir } from '../lib/store.js';
+
+export function commandLink(slug?: string): void {
+ ensureOmm();
+
+ const resolvedSlug = slug || path.basename(process.cwd());
+
+ const configPath = path.join(getOmmDir(), 'config.yaml');
+ let config: Record<string, unknown> = {};
+ if (fs.existsSync(configPath)) {
+ const raw = fs.readFileSync(configPath, 'utf-8');
+ config = (YAML.parse(raw) as Record<string, unknown>) || {};
+ }
+
+ config.cloud = {
+ ...(config.cloud as Record<string, unknown> | undefined),
+ project_slug: resolvedSlug,
+ };
+
+ fs.writeFileSync(configPath, YAML.stringify(config), 'utf-8');
+ process.stderr.write(`Linked to ${resolvedSlug}. Run 'omm push' to upload.\n`);
+}
diff --git a/src/commands/list.ts b/src/commands/list.ts
new file mode 100644
index 0000000..0e9917f
--- /dev/null
+++ b/src/commands/list.ts
@@ -0,0 +1,11 @@
+import { ensureOmm, listClasses } from '../lib/store.js';
+
+export function commandList(): void {
+ ensureOmm();
+ const classes = listClasses();
+ if (classes.length === 0) {
+ process.stderr.write('No classes found.\n');
+ return;
+ }
+ process.stdout.write(classes.join('\n') + '\n');
+}
diff --git a/src/commands/login.ts b/src/commands/login.ts
new file mode 100644
index 0000000..ca6ee87
--- /dev/null
+++ b/src/commands/login.ts
@@ -0,0 +1,83 @@
+import http from 'node:http';
+import { execSync } from 'node:child_process';
+import { getApiUrl, saveToken } from '../lib/cloud.js';
+
+function findOpenPort(): Promise<number> {
+ return new Promise((resolve, reject) => {
+ const srv = http.createServer();
+ srv.listen(0, () => {
+ const addr = srv.address();
+ if (addr && typeof addr === 'object') {
+ const port = addr.port;
+ srv.close(() => resolve(port));
+ } else {
+ reject(new Error('Could not find open port'));
+ }
+ });
+ });
+}
+
+export async function commandLogin(): Promise<void> {
+ const apiUrl = getApiUrl();
+ const port = await findOpenPort();
+ const callbackUrl = `http://localhost:${port}/callback`;
+
+ const tokenPromise = new Promise<string>((resolve, reject) => {
+ const timeout = setTimeout(() => {
+ server.close();
+ reject(new Error('Login timed out (60s). Try again.'));
+ }, 60_000);
+
+ const server = http.createServer((req, res) => {
+ const url = new URL(req.url || '/', `http://localhost:${port}`);
+
+ if (url.pathname === '/callback') {
+ const token = url.searchParams.get('token');
+
+ // Send response page
+ res.writeHead(200, { 'Content-Type': 'text/html' });
+ res.end(`
+ <html><body style="background:#1e1e2e;color:#a6e3a1;font-family:monospace;display:flex;align-items:center;justify-content:center;height:100vh;margin:0">
+ <div style="text-align:center">
+ <h2>${token ? 'Login successful!' : 'Login failed.'}</h2>
+ <p style="color:#a6adc8">${token ? 'You can close this tab and return to your terminal.' : 'No token received.'}</p>
+ </div>
+ </body></html>
+ `);
+
+ clearTimeout(timeout);
+ server.close();
+
+ if (token) {
+ resolve(token);
+ } else {
+ reject(new Error('No token received'));
+ }
+ } else {
+ res.writeHead(404);
+ res.end('Not found');
+ }
+ });
+
+ server.listen(port);
+ });
+
+ const authUrl = `${apiUrl}/auth/cli?callback=${encodeURIComponent(callbackUrl)}`;
+ process.stderr.write(`Opening browser for login...\n`);
+ try {
+ execSync(`open "${authUrl}"`, { stdio: 'ignore' });
+ } catch {
+ process.stderr.write(`Could not open browser. Visit:\n${authUrl}\n`);
+ }
+ process.stderr.write(`Waiting for authentication...\n`);
+
+ try {
+ const token = await tokenPromise;
+ saveToken(token);
+ process.stderr.write('Logged in successfully\n');
+ } catch (err: unknown) {
+ const msg = err instanceof Error ? err.message : String(err);
+ process.stderr.write(`error: ${msg}\n`);
+ process.exit(1);
+ }
+}
diff --git a/src/commands/logout.ts b/src/commands/logout.ts
new file mode 100644
index 0000000..a404013
--- /dev/null
+++ b/src/commands/logout.ts
@@ -0,0 +1,6 @@
+import { deleteToken } from '../lib/cloud.js';
+
+export function commandLogout(): void {
+ deleteToken();
+ process.stderr.write('Logged out\n');
+}
diff --git a/src/commands/pull.ts b/src/commands/pull.ts
new file mode 100644
index 0000000..e6d5b61
--- /dev/null
+++ b/src/commands/pull.ts
@@ -0,0 +1,51 @@
+import fs from 'node:fs';
+import path from 'node:path';
+import YAML from 'yaml';
+import { getToken, apiRequest } from '../lib/cloud.js';
+import { ensureOmm, getOmmDir } from '../lib/store.js';
+
+export async function commandPull(): Promise<void> {
+ ensureOmm();
+
+ const token = getToken();
+ if (!token) {
+ process.stderr.write("error: not logged in. Run 'omm login' first.\n");
+ process.exit(1);
+ }
+
+ const ommDir = getOmmDir();
+ const configPath = path.join(ommDir, 'config.yaml');
+ if (!fs.existsSync(configPath)) {
+ process.stderr.write("error: .omm/config.yaml not found.\n");
+ process.exit(1);
+ }
+
+ const raw = fs.readFileSync(configPath, 'utf-8');
+ const config = YAML.parse(raw) as Record<string, unknown>;
+ const cloud = config.cloud as Record<string, unknown> | undefined;
+ const slug = cloud?.project_slug as string | undefined;
+
+ if (!slug) {
+ process.stderr.write("error: no project slug set. Run 'omm link' first.\n");
+ process.exit(1);
+ }
+
+ const res = await apiRequest('GET', `/api/pull?slug=${encodeURIComponent(slug)}`);
+
+ if (!res.ok) {
+ const text = await res.text();
+ process.stderr.write(`error: pull failed (${res.status}): ${text}\n`);
+ process.exit(1);
+ }
+
+ const data = await res.json() as { files?: Array<{ path: string; content: string }> };
+ const files = data.files ?? [];
+
+ for (const file of files) {
+ const dest = path.join(ommDir, file.path);
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
+ fs.writeFileSync(dest, file.content, 'utf-8');
+ }
+
+ process.stderr.write(`Pulled ${files.length} files from cloud\n`);
+}
diff --git a/src/commands/push.ts b/src/commands/push.ts
new file mode 100644
index 0000000..f983568
--- /dev/null
+++ b/src/commands/push.ts
@@ -0,0 +1,77 @@
+import fs from 'node:fs';
+import path from 'node:path';
+import { execSync } from 'node:child_process';
+import YAML from 'yaml';
+import { getToken, getApiUrl, apiRequest } from '../lib/cloud.js';
+import { ensureOmm, getOmmDir } from '../lib/store.js';
+
+function walkDir(dir: string, base: string): Array<{ path: string; content: string }> {
+ const files: Array<{ path: string; content: string }> = [];
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
+ for (const entry of entries) {
+ const fullPath = path.join(dir, entry.name);
+ if (entry.isDirectory()) {
+ files.push(...walkDir(fullPath, base));
+ } else {
+ const relativePath = path.relative(base, fullPath);
+ const content = fs.readFileSync(fullPath, 'utf-8');
+ files.push({ path: relativePath, content });
+ }
+ }
+ return files;
+}
+
+function getGitCommit(): string | undefined {
+ try {
+ return execSync('git rev-parse --short HEAD', { stdio: ['ignore', 'pipe', 'ignore'] })
+ .toString()
+ .trim();
+ } catch {
+ return undefined;
+ }
+}
+
+export async function commandPush(): Promise<void> {
+ ensureOmm();
+
+ const token = getToken();
+ if (!token) {
+ process.stderr.write("error: not logged in. Run 'omm login' first.\n");
+ process.exit(1);
+ }
+
+ const ommDir = getOmmDir();
+ const configPath = path.join(ommDir, 'config.yaml');
+ if (!fs.existsSync(configPath)) {
+ process.stderr.write("error: .omm/config.yaml not found.\n");
+ process.exit(1);
+ }
+
+ const raw = fs.readFileSync(configPath, 'utf-8');
+ const config = YAML.parse(raw) as Record<string, unknown>;
+ const cloud = config.cloud as Record<string, unknown> | undefined;
+ const slug = cloud?.project_slug as string | undefined;
+
+ if (!slug) {
+ process.stderr.write("error: no project slug set. Run 'omm link' first.\n");
+ process.exit(1);
+ }
+
+ const files = walkDir(ommDir, ommDir);
+ const git_commit = getGitCommit();
+
+ process.stderr.write(`Pushing ${files.length} files to ${getApiUrl()}/p/${slug}...\n`);
+
+ const res = await apiRequest('POST', '/api/push', { slug, files, git_commit });
+
+ if (!res.ok) {
+ const text = await res.text();
+ process.stderr.write(`error: push failed (${res.status}): ${text}\n`);
+ process.exit(1);
+ }
+
+ const data = await res.json() as { uploaded?: number; url?: string };
+ const uploaded = data.uploaded ?? files.length;
+ const url = data.url ?? `${getApiUrl()}/p/${slug}`;
+ process.stdout.write(`Uploaded ${uploaded} files. View at: ${url}\n`);
+}
diff --git a/src/commands/refs.ts b/src/commands/refs.ts
new file mode 100644
index 0000000..1839f6d
--- /dev/null
+++ b/src/commands/refs.ts
@@ -0,0 +1,35 @@
+import { ensureOmm, classExists } from '../lib/store.js';
+import { getIncomingRefs, getOutgoingRefs } from '../lib/refs.js';
+
+export function commandRefs(className: string, reverse: boolean): void {
+ ensureOmm();
+
+ if (!classExists(className)) {
+ process.stderr.write(`error: class '${className}' not found\n`);
+ process.exit(1);
+ }
+
+ if (reverse) {
+ // Show what this class references (outgoing)
+ const refs = getOutgoingRefs(className);
+ if (refs.length === 0) {
+ process.stdout.write(`${className} does not reference any other class.\n`);
+ return;
+ }
+ process.stdout.write(`${className} references:\n`);
+ for (const ref of refs) {
+ process.stdout.write(` → ${ref.target_class}\n`);
+ }
+ } else {
+ // Show what references this class (incoming)
+ const refs = getIncomingRefs(className);
+ if (refs.length === 0) {
+ process.stdout.write(`No class references ${className}.\n`);
+ return;
+ }
+ process.stdout.write(`Referenced by:\n`);
+ for (const ref of refs) {
+ process.stdout.write(` ← ${ref.source_class}\n`);
+ }
+ }
+}
diff --git a/src/commands/serve.ts b/src/commands/serve.ts
new file mode 100644
index 0000000..7f069c2
--- /dev/null
+++ b/src/commands/serve.ts
@@ -0,0 +1,7 @@
+import { ensureOmm } from '../lib/store.js';
+import { startServer } from '../server/index.js';
+
+export function commandServe(port: number = 3000): void {
+ ensureOmm();
+ startServer(port);
+}
diff --git a/src/commands/share.ts b/src/commands/share.ts
new file mode 100644
index 0000000..936db9b
--- /dev/null
+++ b/src/commands/share.ts
@@ -0,0 +1,29 @@
+import fs from 'node:fs';
+import path from 'node:path';
+import YAML from 'yaml';
+import { getApiUrl } from '../lib/cloud.js';
+import { ensureOmm, getOmmDir } from '../lib/store.js';
+
+export function commandShare(): void {
+ ensureOmm();
+
+ const configPath = path.join(getOmmDir(), 'config.yaml');
+ if (!fs.existsSync(configPath)) {
+ process.stderr.write("error: .omm/config.yaml not found. Run 'omm init' first.\n");
+ process.exit(1);
+ }
+
+ const raw = fs.readFileSync(configPath, 'utf-8');
+ const config = YAML.parse(raw) as Record<string, unknown>;
+ const cloud = config.cloud as Record<string, unknown> | undefined;
+ const slug = cloud?.project_slug as string | undefined;
+
+ if (!slug) {
+ process.stderr.write("error: no project slug set. Run 'omm link' first.\n");
+ process.exit(1);
+ }
+
+ const viewUrl = `${getApiUrl()}/p/${slug}`;
+ process.stdout.write(`Owner view: ${viewUrl}\n`);
+ process.stdout.write(`Public share: use the Share button on the dashboard (Pro)\n`);
+}
diff --git a/src/commands/show.ts b/src/commands/show.ts
new file mode 100644
index 0000000..1315a9c
--- /dev/null
+++ b/src/commands/show.ts
@@ -0,0 +1,21 @@
+import YAML from 'yaml';
+import { ensureOmm, showClass } from '../lib/store.js';
+
+export function commandShow(className: string): void {
+ ensureOmm();
+ const data = showClass(className);
+ if (!data) {
+ process.stderr.write(`error: class '${className}' not found\n`);
+ process.exit(1);
+ }
+
+ const fields = ['description', 'diagram', 'constraint', 'concern', 'context', 'todo', 'note'] as const;
+ for (const field of fields) {
+ if (data[field]) {
+ process.stdout.write(`--- field: ${field} ---\n${data[field]}\n`);
+ }
+ }
+ if (data.meta) {
+ process.stdout.write(`--- field: meta ---\n${YAML.stringify(data.meta)}`);
+ }
+}
diff --git a/src/commands/status.ts b/src/commands/status.ts
new file mode 100644
index 0000000..6988736
--- /dev/null
+++ b/src/commands/status.ts
@@ -0,0 +1,21 @@
+import { ensureOmm, listClasses, readMeta } from '../lib/store.js';
+
+export function commandStatus(): void {
+ ensureOmm();
+ const classes = listClasses();
+
+ if (classes.length === 0) {
+ process.stdout.write('No classes found. Run /omm-init to scan your codebase.\n');
+ return;
+ }
+
+ process.stdout.write(`Classes: ${classes.length}\n\n`);
+
+ for (const cls of classes) {
+ const meta = readMeta(cls);
+ const updated = meta?.updated ? new Date(meta.updated).toLocaleString() : 'unknown';
+ const count = meta?.update_count ?? 0;
+ process.stdout.write(` ${cls}\n`);
+ process.stdout.write(` updated: ${updated} (${count} updates)\n`);
+ }
+}
diff --git a/src/index.ts b/src/index.ts
new file mode 100644
index 0000000..0ed4d98
--- /dev/null
+++ b/src/index.ts
@@ -0,0 +1,6 @@
+// oh-my-mermaid public API
+export { initOmm, listClasses, readField, writeField, showClass, deleteClass, classExists } from './lib/store.js';
+export { diffMermaid, parseMermaid, formatDiff } from './lib/diff.js';
+export { extractRefs, getIncomingRefs, getOutgoingRefs, buildRefGraph } from './lib/refs.js';
+export { VALID_FIELDS, FIELD_FILES } from './types.js';
+export type { Field, ClassMeta, ClassData, DiffResult, RefEntry, OmmConfig } from './types.js';
diff --git a/src/lib/cloud.ts b/src/lib/cloud.ts
new file mode 100644
index 0000000..30b888c
--- /dev/null
+++ b/src/lib/cloud.ts
@@ -0,0 +1,61 @@
+import fs from 'node:fs';
+import path from 'node:path';
+import os from 'node:os';
+
+const CREDENTIALS_DIR = path.join(os.homedir(), '.omm');
+const CREDENTIALS_FILE = path.join(CREDENTIALS_DIR, 'credentials.json');
+const DEFAULT_API_URL = 'https://ohmymermaid.com';
+
+export function getCredentialsPath(): string {
+ return CREDENTIALS_FILE;
+}
+
+export function getApiUrl(): string {
+ return process.env.OMM_API_URL || DEFAULT_API_URL;
+}
+
+export function getToken(): string | null {
+ if (!fs.existsSync(CREDENTIALS_FILE)) return null;
+ try {
+ const raw = fs.readFileSync(CREDENTIALS_FILE, 'utf-8');
+ const data = JSON.parse(raw) as { token?: string };
+ return data.token ?? null;
+ } catch {
+ return null;
+ }
+}
+
+export function saveToken(token: string): void {
+ if (!fs.existsSync(CREDENTIALS_DIR)) {
+ fs.mkdirSync(CREDENTIALS_DIR, { recursive: true });
+ }
+ fs.writeFileSync(CREDENTIALS_FILE, JSON.stringify({ token }, null, 2), 'utf-8');
+}
+
+export function deleteToken(): void {
+ if (fs.existsSync(CREDENTIALS_FILE)) {
+ fs.unlinkSync(CREDENTIALS_FILE);
+ }
+}
+
+export async function apiRequest(
+ method: string,
+ urlPath: string,
+ body?: unknown,
+): Promise<Response> {
+ const token = getToken();
+ const headers: Record<string, string> = {
+ 'Content-Type': 'application/json',
+ };
+ if (token) {
+ headers['Authorization'] = `Bearer ${token}`;
+ }
+
+ const url = `${getApiUrl()}${urlPath}`;
+ const res = await fetch(url, {
+ method,
+ headers,
+ body: body !== undefined ? JSON.stringify(body) : undefined,
+ });
+ return res;
+}
diff --git a/src/lib/diff.ts b/src/lib/diff.ts
new file mode 100644
index 0000000..c9466e9
--- /dev/null
+++ b/src/lib/diff.ts
@@ -0,0 +1,99 @@
+import type { DiffResult } from '../types.js';
+
+interface MermaidElement {
+ nodes: Set<string>;
+ edges: Set<string>;
+}
+
+/**
+ * Lightweight mermaid parser — extracts node IDs and edges from mermaid text.
+ * Handles: graph/flowchart LR/TD/TB, subgraph, and common arrow syntaxes.
+ */
+export function parseMermaid(text: string): MermaidElement {
+ const nodes = new Set<string>();
+ const edges = new Set<string>();
+
+ const lines = text.split('\n').map(l => l.trim()).filter(l => l && !l.startsWith('%%'));
+
+ for (const line of lines) {
+ // Skip directives, classDef, click, style, etc.
+ if (/^(graph|flowchart|sequenceDiagram|classDiagram|erDiagram|gantt|pie|gitGraph)/i.test(line)) continue;
+ if (/^(classDef|class |click |style |linkStyle|subgraph|end$)/i.test(line)) continue;
+ if (/^%%\{/.test(line)) continue;
+
+ // Match edges: A --> B, A -->|label| B, A -- text --> B, etc.
+ const edgePattern = /^(\S+?)(?:\[.*?\]|(?:\(.*?\))|\{.*?\}|>.*?])?(\s*)(-->|--o|--x|---|-.->|==>|~~>|--\|.*?\|)(\s*)(\S+?)(?:\[.*?\]|(?:\(.*?\))|\{.*?\}|>.*?])?$/;
+ const edgeMatch = line.match(edgePattern);
+ if (edgeMatch) {
+ const [, src, , arrow, , dst] = edgeMatch;
+ const srcId = src.replace(/["']/g, '');
+ const dstId = dst.replace(/["']/g, '');
+ nodes.add(srcId);
+ nodes.add(dstId);
+ edges.add(`${srcId} ${arrow} ${dstId}`);
+ continue;
+ }
+
+ // Broader edge match for complex syntax: A[Label] --> B[Label]
+ const broadEdge = /^([^\s[\]({]+).*?(-->|--o|--x|---|-.->|==>|~~>).*?([^\s[\]({]+)/;
+ const broadMatch = line.match(broadEdge);
+ if (broadMatch) {
+ const [, src, arrow, dst] = broadMatch;
+ const srcId = src.replace(/["']/g, '');
+ const dstId = dst.replace(/["']/g, '');
+ nodes.add(srcId);
+ nodes.add(dstId);
+ edges.add(`${srcId} ${arrow} ${dstId}`);
+ continue;
+ }
+
+ // Standalone node: A[Label] or A((Label)) or A{Label}
+ const nodeMatch = line.match(/^([^\s[\]({]+)[\[({]/);
+ if (nodeMatch) {
+ nodes.add(nodeMatch[1].replace(/["']/g, ''));
+ }
+ }
+
+ return { nodes, edges };
+}
+
+export function diffMermaid(before: string, after: string): DiffResult {
+ const prev = parseMermaid(before);
+ const curr = parseMermaid(after);
+
+ const added_nodes = [...curr.nodes].filter(n => !prev.nodes.has(n));
+ const removed_nodes = [...prev.nodes].filter(n => !curr.nodes.has(n));
+ const added_edges = [...curr.edges].filter(e => !prev.edges.has(e));
+ const removed_edges = [...prev.edges].filter(e => !curr.edges.has(e));
+
+ return {
+ added_nodes,
+ removed_nodes,
+ added_edges,
+ removed_edges,
+ has_changes: added_nodes.length > 0 || removed_nodes.length > 0 || added_edges.length > 0 || removed_edges.length > 0,
+ };
+}
+
+export function formatDiff(diff: DiffResult): string {
+ if (!diff.has_changes) return 'No changes detected.\n';
+
+ const lines: string[] = [];
+ if (diff.added_nodes.length) {
+ lines.push('Added nodes:');
+ diff.added_nodes.forEach(n => lines.push(` + ${n}`));
+ }
+ if (diff.removed_nodes.length) {
+ lines.push('Removed nodes:');
+ diff.removed_nodes.forEach(n => lines.push(` - ${n}`));
+ }
+ if (diff.added_edges.length) {
+ lines.push('Added edges:');
+ diff.added_edges.forEach(e => lines.push(` + ${e}`));
+ }
+ if (diff.removed_edges.length) {
+ lines.push('Removed edges:');
+ diff.removed_edges.forEach(e => lines.push(` - ${e}`));
+ }
+ return lines.join('\n') + '\n';
+}
diff --git a/src/lib/meta.ts b/src/lib/meta.ts
new file mode 100644
index 0000000..93909e4
--- /dev/null
+++ b/src/lib/meta.ts
@@ -0,0 +1,46 @@
+import fs from 'node:fs';
+import path from 'node:path';
+import { execSync } from 'node:child_process';
+import YAML from 'yaml';
+import type { Field, ClassMeta } from '../types.js';
+
+const META_FILE = 'meta.yaml';
+
+function getGitInfo(cwd: string): { commit?: string; branch?: string } {
+ try {
+ const commit = execSync('git rev-parse --short HEAD', { cwd, stdio: ['pipe', 'pipe', 'pipe'] })
+ .toString().trim();
+ const branch = execSync('git branch --show-current', { cwd, stdio: ['pipe', 'pipe', 'pipe'] })
+ .toString().trim();
+ return { commit: commit || undefined, branch: branch || undefined };
+ } catch {
+ return {};
+ }
+}
+
+export function updateMeta(className: string, field: Field, cwd: string = process.cwd()): void {
+ const ommDir = path.join(cwd, '.omm');
+ const metaPath = path.join(ommDir, className, META_FILE);
+
+ let meta: ClassMeta;
+ if (fs.existsSync(metaPath)) {
+ meta = YAML.parse(fs.readFileSync(metaPath, 'utf-8')) as ClassMeta;
+ meta.updated = new Date().toISOString();
+ meta.update_count = (meta.update_count || 0) + 1;
+ meta.last_field = field;
+ } else {
+ const now = new Date().toISOString();
+ meta = {
+ created: now,
+ updated: now,
+ update_count: 1,
+ last_field: field,
+ };
+ }
+
+ const git = getGitInfo(cwd);
+ if (git.commit) meta.git_commit = git.commit;
+ if (git.branch) meta.git_branch = git.branch;
+
+ fs.writeFileSync(metaPath, YAML.stringify(meta), 'utf-8');
+}
diff --git a/src/lib/refs.ts b/src/lib/refs.ts
new file mode 100644
index 0000000..1c6bcf3
--- /dev/null
+++ b/src/lib/refs.ts
@@ -0,0 +1,74 @@
+import { listClasses, readField } from './store.js';
+import type { RefEntry } from '../types.js';
+
+const REF_PATTERN = /@([\w-]+)/g;
+
+/**
+ * Extract @class-name references from a mermaid diagram text.
+ */
+export function extractRefs(diagramText: string): string[] {
+ const refs: string[] = [];
+ let match: RegExpExecArray | null;
+ const pattern = new RegExp(REF_PATTERN.source, 'g');
+ while ((match = pattern.exec(diagramText)) !== null) {
+ if (!refs.includes(match[1])) {
+ refs.push(match[1]);
+ }
+ }
+ return refs;
+}
+
+/**
+ * Get all classes that the given class references (outgoing refs).
+ */
+export function getOutgoingRefs(className: string, cwd?: string): RefEntry[] {
+ const diagram = readField(className, 'diagram', cwd);
+ if (!diagram) return [];
+
+ const refs = extractRefs(diagram);
+ return refs.map(target => ({
+ source_class: className,
+ target_class: target,
+ node_id: `@${target}`,
+ }));
+}
+
+/**
+ * Get all classes that reference the given class (incoming refs).
+ */
+export function getIncomingRefs(className: string, cwd?: string): RefEntry[] {
+ const classes = listClasses(cwd);
+ const incoming: RefEntry[] = [];
+
+ for (const cls of classes) {
+ if (cls === className) continue;
+ const diagram = readField(cls, 'diagram', cwd);
+ if (!diagram) continue;
+
+ const refs = extractRefs(diagram);
+ if (refs.includes(className)) {
+ incoming.push({
+ source_class: cls,
+ target_class: className,
+ node_id: `@${className}`,
+ });
+ }
+ }
+
+ return incoming;
+}
+
+/**
+ * Build a full reference graph for all classes.
+ */
+export function buildRefGraph(cwd?: string): RefEntry[] {
+ const classes = listClasses(cwd);
+ const allRefs: RefEntry[] = [];
+
+ for (const cls of classes) {
+ const refs = getOutgoingRefs(cls, cwd);
+ allRefs.push(...refs);
+ }
+
+ return allRefs;
+}
diff --git a/src/lib/store.ts b/src/lib/store.ts
new file mode 100644
index 0000000..e40d4f0
--- /dev/null
+++ b/src/lib/store.ts
@@ -0,0 +1,140 @@
+import fs from 'node:fs';
+import path from 'node:path';
+import YAML from 'yaml';
+import { VALID_FIELDS, FIELD_FILES, type Field, type ClassMeta, type ClassData, type OmmConfig } from '../types.js';
+import { updateMeta } from './meta.js';
+
+const OMM_DIR = '.omm';
+const CONFIG_FILE = 'config.yaml';
+const META_FILE = 'meta.yaml';
+
+export function getOmmDir(cwd: string = process.cwd()): string {
+ return path.join(cwd, OMM_DIR);
+}
+
+export function ommExists(cwd?: string): boolean {
+ return fs.existsSync(getOmmDir(cwd));
+}
+
+export function ensureOmm(cwd?: string): void {
+ if (!ommExists(cwd)) {
+ process.stderr.write(`error: .omm/ not found. Run 'omm init' first.\n`);
+ process.exit(1);
+ }
+}
+
+export function isValidField(field: string): field is Field {
+ return (VALID_FIELDS as readonly string[]).includes(field);
+}
+
+// --- Init ---
+
+export function initOmm(cwd?: string): void {
+ const dir = getOmmDir(cwd);
+ if (!fs.existsSync(dir)) {
+ fs.mkdirSync(dir, { recursive: true });
+ }
+ const configPath = path.join(dir, CONFIG_FILE);
+ if (!fs.existsSync(configPath)) {
+ const config: OmmConfig = { version: '0.1.0' };
+ fs.writeFileSync(configPath, YAML.stringify(config), 'utf-8');
+ }
+}
+
+// --- Class operations ---
+
+function classDir(className: string, cwd?: string): string {
+ return path.join(getOmmDir(cwd), className);
+}
+
+function ensureClassDir(className: string, cwd?: string): string {
+ const dir = classDir(className, cwd);
+ if (!fs.existsSync(dir)) {
+ fs.mkdirSync(dir, { recursive: true });
+ }
+ return dir;
+}
+
+export function classExists(className: string, cwd?: string): boolean {
+ return fs.existsSync(classDir(className, cwd));
+}
+
+export function listClasses(cwd?: string): string[] {
+ const dir = getOmmDir(cwd);
+ if (!fs.existsSync(dir)) return [];
+ return fs.readdirSync(dir, { withFileTypes: true })
+ .filter(d => d.isDirectory())
+ .map(d => d.name)
+ .sort();
+}
+
+export function deleteClass(className: string, cwd?: string): boolean {
+ const dir = classDir(className, cwd);
+ if (!fs.existsSync(dir)) return false;
+ fs.rmSync(dir, { recursive: true });
+ return true;
+}
+
+// --- Field read/write ---
+
+export function readField(className: string, field: Field, cwd?: string): string | null {
+ const filePath = path.join(classDir(className, cwd), FIELD_FILES[field]);
+ if (!fs.existsSync(filePath)) return null;
+ return fs.readFileSync(filePath, 'utf-8');
+}
+
+export function writeField(className: string, field: Field, content: string, cwd?: string): number {
+ const dir = ensureClassDir(className, cwd);
+ const filePath = path.join(dir, FIELD_FILES[field]);
+
+ // If writing diagram, save previous version to meta
+ if (field === 'diagram') {
+ const prev = readField(className, 'diagram', cwd);
+ if (prev !== null) {
+ const meta = readMeta(className, cwd);
+ if (meta) {
+ meta.prev_diagram = prev;
+ writeMeta(className, meta, cwd);
+ }
+ }
+ }
+
+ fs.writeFileSync(filePath, content, 'utf-8');
+ updateMeta(className, field, cwd);
+
+ const bytes = Buffer.byteLength(content, 'utf-8');
+ process.stderr.write(`wrote ${className}/${FIELD_FILES[field]} (${bytes} bytes)\n`);
+ return bytes;
+}
+
+// --- Meta ---
+
+export function readMeta(className: string, cwd?: string): ClassMeta | null {
+ const filePath = path.join(classDir(className, cwd), META_FILE);
+ if (!fs.existsSync(filePath)) return null;
+ const raw = fs.readFileSync(filePath, 'utf-8');
+ return YAML.parse(raw) as ClassMeta;
+}
+
+export function writeMeta(className: string, meta: ClassMeta, cwd?: string): void {
+ const dir = ensureClassDir(className, cwd);
+ const filePath = path.join(dir, META_FILE);
+ fs.writeFileSync(filePath, YAML.stringify(meta), 'utf-8');
+}
+
+// --- Show (all fields) ---
+
+export function showClass(className: string, cwd?: string): ClassData | null {
+ if (!classExists(className, cwd)) return null;
+ return {
+ name: className,
+ description: readField(className, 'description', cwd) ?? undefined,
+ diagram: readField(className, 'diagram', cwd) ?? undefined,
+ constraint: readField(className, 'constraint', cwd) ?? undefined,
+ concern: readField(className, 'concern', cwd) ?? undefined,
+ context: readField(className, 'context', cwd) ?? undefined,
+ todo: readField(className, 'todo', cwd) ?? undefined,
+ note: readField(className, 'note', cwd) ?? undefined,
+ meta: readMeta(className, cwd) ?? undefined,
+ };
+}
diff --git a/src/server/api.ts b/src/server/api.ts
new file mode 100644
index 0000000..6f1c5a4
--- /dev/null
+++ b/src/server/api.ts
@@ -0,0 +1,60 @@
+import type { IncomingMessage, ServerResponse } from 'node:http';
+import { listClasses, showClass, readMeta, readField } from '../lib/store.js';
+import { diffMermaid } from '../lib/diff.js';
+import { getIncomingRefs, getOutgoingRefs } from '../lib/refs.js';
+
+function json(res: ServerResponse, data: unknown, status = 200): void {
+ res.writeHead(status, { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*' });
+ res.end(JSON.stringify(data));
+}
+
+export function handleApi(req: IncomingMessage, res: ServerResponse): boolean {
+ const url = new URL(req.url || '/', `http://${req.headers.host}`);
+ const path = url.pathname;
+
+ // GET /api/classes
+ if (path === '/api/classes') {
+ json(res, listClasses());
+ return true;
+ }
+
+ // GET /api/class/:name
+ const classMatch = path.match(/^\/api\/class\/([^/]+)$/);
+ if (classMatch) {
+ const data = showClass(classMatch[1]);
+ if (!data) {
+ json(res, { error: 'class not found' }, 404);
+ } else {
+ json(res, data);
+ }
+ return true;
+ }
+
+ // GET /api/class/:name/diff
+ const diffMatch = path.match(/^\/api\/class\/([^/]+)\/diff$/);
+ if (diffMatch) {
+ const className = diffMatch[1];
+ const current = readField(className, 'diagram');
+ const meta = readMeta(className);
+ const prev = meta?.prev_diagram;
+ if (!current || !prev) {
+ json(res, { error: 'no diff available', has_changes: false });
+ } else {
+ const diff = diffMermaid(prev, current);
+ json(res, { ...diff, prev_diagram: prev, current_diagram: current });
+ }
+ return true;
+ }
+
+ // GET /api/class/:name/refs
+ const refsMatch = path.match(/^\/api\/class\/([^/]+)\/refs$/);
+ if (refsMatch) {
+ const className = refsMatch[1];
+ const incoming = getIncomingRefs(className);
+ const outgoing = getOutgoingRefs(className);
+ json(res, { incoming, outgoing });
+ return true;
+ }
+
+ return false;
+}
diff --git a/src/server/index.ts b/src/server/index.ts
new file mode 100644
index 0000000..7e1c423
--- /dev/null
+++ b/src/server/index.ts
@@ -0,0 +1,73 @@
+import http from 'node:http';
+import fs from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { handleApi } from './api.js';
+import { addSSEClient, startWatcher } from './watcher.js';
+
+const __filename = fileURLToPath(import.meta.url);
+const __dirname = path.dirname(__filename);
+
+function getViewerHtml(): string {
+ // Try dist/ first, then src/server/ for dev
+ const candidates = [
+ path.join(__dirname, 'viewer.html'),
+ path.join(__dirname, '..', 'server', 'viewer.html'),
+ path.join(__dirname, '..', 'src', 'server', 'viewer.html'),
+ ];
+ for (const p of candidates) {
+ if (fs.existsSync(p)) {
+ return fs.readFileSync(p, 'utf-8');
+ }
+ }
+ return '<html><body><h1>viewer.html not found</h1></body></html>';
+}
+
+export function startServer(port: number): void {
+ startWatcher();
+
+ const server = http.createServer((req, res) => {
+ const url = new URL(req.url || '/', `http://${req.headers.host}`);
+
+ // SSE endpoint
+ if (url.pathname === '/events') {
+ addSSEClient(res);
+ return;
+ }
+
+ // API endpoints
+ if (url.pathname.startsWith('/api/')) {
+ if (handleApi(req, res)) return;
+ res.writeHead(404, { 'Content-Type': 'application/json' });
+ res.end(JSON.stringify({ error: 'not found' }));
+ return;
+ }
+
+ // Serve viewer HTML
+ if (url.pathname === '/' || url.pathname === '/index.html') {
+ let html = getViewerHtml();
+ const projectName = path.basename(process.cwd());
+ html = html.replace('</head>', `<script>window.__projectName=${JSON.stringify(projectName)};</script>\n</head>`);
+ res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
+ res.end(html);
+ return;
+ }
+
+ res.writeHead(404);
+ res.end('Not Found');
+ });
+
+ server.on('error', (err: NodeJS.ErrnoException) => {
+ if (err.code === 'EADDRINUSE') {
+ process.stderr.write(`Port ${port} in use, trying ${port + 1}...\n`);
+ server.close();
+ startServer(port + 1);
+ } else {
+ throw err;
+ }
+ });
+
+ server.listen(port, () => {
+ process.stderr.write(`oh-my-mermaid viewer running at http://localhost:${port}\n`);
+ });
+}
diff --git a/src/server/viewer.html b/src/server/viewer.html
new file mode 100644
index 0000000..5057a62
--- /dev/null
+++ b/src/server/viewer.html
@@ -0,0 +1,1235 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<title>oh-my-mermaid</title>
+<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/dagre.min.js"></script>
+<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
+<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Geist+Mono:wght@400;500&family=Plus+Jakarta+Sans:wght@500;600;700&display=swap" rel="stylesheet">
+<style>
+*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
+:root {
+ --bg: #000000;
+ --border: #333333;
+ --border-hi: #333;
+ --text: #ffffff;
+ --text-mid: #888;
+ --text-dim: #555;
+ --font: 'Inter', system-ui, -apple-system, sans-serif;
+ --mono: 'SF Mono', 'Fira Code', monospace;
+ --sidebar-w: 400px;
+}
+html, body { height: 100%; overflow: hidden; }
+body { font-family: var(--font); background: var(--bg); color: var(--text); display: flex; flex-direction: column; }
+
+/* Nav sidebar */
+#nav-sidebar {
+ position: fixed; top: 0; left: 0; bottom: 0; width: 200px;
+ background: #000; border-right: 1px solid var(--border);
+ display: flex; flex-direction: column;
+ z-index: 200;
+}
+#nav-title {
+ padding: 14px 16px;
+ font-size: 13px; font-weight: 600; color: #fff;
+ font-family: var(--mono);
+}
+#nav-list {
+ flex: 1; overflow-y: auto;
+ scrollbar-width: thin; scrollbar-color: #1a1a1a transparent;
+}
+.nav-item {
+ display: flex; align-items: center; width: 100%; height: 24px;
+ padding: 0 16px 0 0;
+ font-size: 11.5px; font-family: 'Geist Mono', 'JetBrains Mono', 'Fira Code', var(--mono);
+ color: #666; cursor: pointer;
+ border: none; background: none; text-align: left;
+ transition: color .12s, background .12s;
+ white-space: nowrap; overflow: hidden;
+}
+.nav-item.nav-root { color: #bbb; font-size: 12px; height: 28px; padding-left: 16px; margin-top: 2px; }
+.nav-pre { display: flex; align-self: stretch; align-items: stretch; flex-shrink: 0; padding-left: 16px; }
+.nav-slot { width: 12px; position: relative; flex-shrink: 0; }
+.nav-slot-line::before {
+ content: ''; position: absolute;
+ left: 6px; top: 0; bottom: 0; width: 1px; background: #222;
+}
+.nav-conn { width: 18px; position: relative; flex-shrink: 0; }
+.nav-conn::before {
+ content: ''; position: absolute;
+ left: 6px; top: 0; width: 1px; background: #2e2e2e;
+}
+.nav-conn:not(.nav-conn-last)::before { bottom: 0; }
+.nav-conn-last::before { bottom: 50%; }
+.nav-conn::after {
+ content: ''; position: absolute;
+ left: 6px; right: 0; top: 50%; height: 1px;
+ transform: translateY(-50%); background: #2e2e2e;
+}
+.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
+.nav-item:hover { color: #fff; background: #0d0d0d; }
+.nav-item:hover .nav-slot-line::before,
+.nav-item:hover .nav-conn::before,
+.nav-item:hover .nav-conn::after { background: #555; }
+.nav-item.active { color: #fff; background: #141414; }
+.nav-item.active .nav-slot-line::before,
+.nav-item.active .nav-conn::before,
+.nav-item.active .nav-conn::after { background: #555; }
+
+/* Floating controls */
+.float-controls {
+ position: absolute; top: 12px; right: 12px;
+ display: flex; align-items: center; gap: 3px;
+ z-index: 100;
+ background: rgba(0,0,0,0.7);
+ border: 1px solid var(--border);
+ border-radius: 6px;
+ padding: 4px 6px;
+ backdrop-filter: blur(8px);
+}
+.hbtn { background: none; border: 1px solid var(--border-hi); color: var(--text-mid); height: 26px; min-width: 26px; padding: 0 8px; border-radius: 5px; cursor: pointer; font-size: 13px; font-family: var(--font); transition: border-color .12s, color .12s; }
+.hbtn:hover { border-color: #3a3a3a; color: var(--text); }
+#zoom-label { font-size: 11px; color: var(--text-dim); width: 38px; text-align: center; font-family: var(--mono); }
+
+#canvas-wrap {
+ flex: 1; position: relative; overflow: hidden; cursor: grab; margin-left: 200px;
+ background-color: var(--bg);
+ background-image: radial-gradient(circle, #1a1a1a 1px, transparent 1px);
+ background-size: 28px 28px;
+ user-select: none;
+}
+#canvas-wrap.panning { cursor: grabbing; }
+#canvas { position: absolute; transform-origin: 0 0; }
+#canvas svg { display: block; overflow: visible; }
+
+/* SVG interactive elements */
+.grp-node { cursor: pointer; }
+.grp-node .grp-border { transition: stroke .12s, filter .12s; }
+.grp-node:hover > .grp-border { stroke: #ffffff !important; stroke-width: 2.5px; filter: drop-shadow(0 0 6px rgba(255,255,255,0.5)); }
+.grp-node.selected > .grp-border { stroke: #818cf8 !important; stroke-width: 2.5px; stroke-dasharray: none !important; filter: drop-shadow(0 0 8px rgba(129,140,248,0.6)); }
+.reg-node { cursor: pointer; }
+.reg-node .nshape { transition: stroke .12s, filter .12s; }
+.reg-node:hover .nshape { stroke: #ffffff !important; stroke-width: 2.5px; filter: drop-shadow(0 0 6px rgba(255,255,255,0.5)); }
+/* Edge highlight on node hover */
+.edge-path.edge-hl { stroke: #ffffff !important; stroke-width: 2.5px; opacity: 1; transition: all .15s; }
+.reg-node.selected .nshape { stroke: #818cf8 !important; stroke-width: 2.5px; filter: drop-shadow(0 0 8px rgba(129,140,248,0.6)); }
+/* Overview mode: per-element fade — borders + edges stay visible */
+.grp-inner { transition: opacity .25s; }
+#canvas-wrap.zoom-overview .grp-inner { pointer-events: none; }
+#canvas-wrap.zoom-overview .grp-inner > .reg-node { opacity: 0.2; transition: opacity .25s; }
+#canvas-wrap.zoom-overview .grp-inner .edge-path { opacity: 0.4; transition: opacity .25s; }
+#canvas-wrap.zoom-overview .grp-inner .edge-label { opacity: 0; }
+#canvas-wrap.zoom-overview .grp-inner > .grp-node > .grp-inner { opacity: 0.06; }
+#canvas-wrap.zoom-overview .grp-inner > .grp-node > .grp-border { opacity: 0.60; }
+#canvas-wrap.zoom-overview .grp-inner > .grp-node > .grp-label-top { opacity: 0; }
+/* Top-level group labels */
+.grp-label-center { display: none; }
+#canvas-wrap.zoom-overview .grp-label-top { display: none; }
+#canvas-wrap.zoom-overview .grp-label-center { display: block; }
+/* Sub-group overlay labels (outside grp-inner — unaffected by opacity) */
+.grp-sub-labels { display: none; pointer-events: none; }
+.grp-sub-labels text { opacity: 0.45; }
+/* Depth-aware labels: expanded groups hide center, show top-left */
+.grp-node.grp-expanded > .grp-label-center { display: none; }
+/* Non-expanded: show center label over top label */
+.grp-node:not(.grp-expanded) > .grp-label-center { display: block; opacity: 0.7; }
+/* Top-level expanded: hide center */
+[data-cls].grp-expanded > .grp-label-center { display: none; }
+#canvas-wrap.zoom-overview .grp-sub-labels { display: block; }
+/* Focused group: restore full visibility */
+#canvas-wrap.zoom-overview [data-cls].focus-exempt > .grp-inner { pointer-events: auto !important; }
+#canvas-wrap.zoom-overview [data-cls].focus-exempt > .grp-inner > .reg-node { opacity: 1 !important; }
+#canvas-wrap.zoom-overview [data-cls].focus-exempt > .grp-inner .edge-path { opacity: 1 !important; }
+#canvas-wrap.zoom-overview [data-cls].focus-exempt > .grp-inner .edge-label { opacity: 1 !important; }
+#canvas-wrap.zoom-overview [data-cls].focus-exempt > .grp-inner .grp-node .grp-inner { opacity: 1 !important; }
+#canvas-wrap.zoom-overview [data-cls].focus-exempt > .grp-inner .grp-node .grp-border { opacity: 1 !important; }
+#canvas-wrap.zoom-overview [data-cls].focus-exempt > .grp-inner .grp-node .grp-label-top { opacity: 1 !important; }
+#canvas-wrap.zoom-overview [data-cls].focus-exempt .grp-label-top { display: block !important; }
+#canvas-wrap.zoom-overview [data-cls].focus-exempt .grp-label-center { display: none !important; }
+#canvas-wrap.zoom-overview [data-cls].focus-exempt > .grp-sub-labels { display: none !important; }
+
+/* Sidebar */
+#sidebar {
+ position: fixed; top: 0; right: 0; bottom: 0; width: var(--sidebar-w);
+ background: #000; border-left: 1px solid var(--border);
+ transform: translateX(100%);
+ transition: transform .22s cubic-bezier(.4,0,.2,1);
+ z-index: 300; display: flex; flex-direction: column;
+}
+#sidebar.open { transform: translateX(0); }
+#sb-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
+#sb-title { flex: 1; font-size: 14px; font-weight: 600; color: #fff; font-family: var(--mono); }
+#sb-close { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 22px; line-height: 1; padding: 0; }
+#sb-close:hover { color: #888; }
+#sb-body { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #1a1a1a transparent; }
+
+.sb-diagram { padding: 16px; border-bottom: 1px solid var(--border); background: #030303; }
+.sb-diagram svg { display: block; width: 100%; height: auto; overflow: visible; }
+.sb-fields { padding: 16px 20px; }
+.sb-sec { margin-bottom: 20px; }
+.sb-sec-title { font-size: 9px; text-transform: uppercase; letter-spacing: .14em; color: #888; padding-bottom: 7px; border-bottom: 1px solid #1e1e1e; margin-bottom: 9px; font-weight: 600; }
+.sb-sec-body { font-size: 12px; line-height: 1.72; color: #bbb; }
+.sb-sec-body p { margin-bottom: 6px; }
+.sb-sec-body ul, .sb-sec-body ol { padding-left: 16px; }
+.sb-sec-body li { margin-bottom: 3px; }
+.sb-sec-body code { background: #111; padding: 1px 5px; border-radius: 2px; font-size: 11px; color: #ccc; font-family: var(--mono); }
+.sb-sec-body strong { color: #eee; }
+.sb-concern .sb-sec-body { border-left: 2px solid #444; padding-left: 10px; }
+.sb-meta-text { font-size: 10px; color: #777; line-height: 1.9; font-family: var(--mono); }
+.sb-refs { display: flex; flex-direction: column; gap: 4px; }
+.sb-ref { font-size: 11px; color: #999; padding: 5px 10px; background: #090909; border: 1px solid #1e1e1e; border-radius: 4px; cursor: pointer; display: block; font-family: var(--mono); transition: border-color .12s, color .12s; }
+.sb-ref:hover { border-color: #333; color: #bbb; }
+.empty-state { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; pointer-events: none; }
+.empty-state p { font-size: 12px; color: #444; line-height: 1.9; }
+/* Light mode */
+body.light { --bg: #f0f0f0; --border: #ddd; --border-hi: #bbb; --text: #1a1a1a; --text-mid: #555; --text-dim: #aaa; }
+body.light header { background: #fff; }
+body.light #canvas-wrap { background-color: #f0f0f0; background-image: radial-gradient(circle, #ccc 1px, transparent 1px); }
+body.light #sidebar { background: #fafafa; }
+body.light #sb-body { scrollbar-color: #ddd transparent; }
+body.light .hbtn { border-color: #ccc; color: #666; }
+body.light .hbtn:hover { border-color: #aaa; color: #222; }
+body.light .sb-diagram { background: #f5f5f5; }
+body.light .sb-sec-title { color: #aaa; border-color: #ddd; }
+body.light .sb-sec-body { color: #555; }
+body.light .sb-sec-body code { background: #e5e5e5; color: #333; }
+body.light .sb-sec-body strong { color: #222; }
+body.light .sb-concern .sb-sec-body { border-color: #ccc; }
+body.light .sb-meta-text { color: #999; }
+body.light .sb-ref { background: #eee; border-color: #ddd; color: #555; }
+body.light .sb-ref:hover { border-color: #aaa; color: #111; }
+body.light .empty-state p { color: #bbb; }
+body.light #nav-sidebar { background: #fff; }
+body.light .nav-item { color: #999; }
+body.light .nav-item.nav-root { color: #333; }
+body.light .nav-slot-line::before { background: #ddd; }
+body.light .nav-conn::before, body.light .nav-conn::after { background: #ddd; }
+body.light .nav-item:hover { color: #000; background: #f5f5f5; }
+body.light .nav-item:hover .nav-slot-line::before,
+body.light .nav-item:hover .nav-conn::before,
+body.light .nav-item:hover .nav-conn::after { background: #bbb; }
+body.light .nav-item.active { color: #000; background: #ebebeb; }
+body.light .nav-item.active .nav-slot-line::before,
+body.light .nav-item.active .nav-conn::before,
+body.light .nav-item.active .nav-conn::after { background: #bbb; }
+body.light .float-controls { background: rgba(255,255,255,0.8); }
+body.light .grp-node:hover > .grp-border { stroke: #000 !important; filter: drop-shadow(0 0 6px rgba(0,0,0,0.3)); }
+body.light .grp-node.selected > .grp-border { stroke: #4f46e5 !important; filter: drop-shadow(0 0 8px rgba(79,70,229,0.4)); }
+body.light .reg-node:hover .nshape { stroke: #000 !important; filter: drop-shadow(0 0 6px rgba(0,0,0,0.3)); }
+body.light .reg-node.selected .nshape { stroke: #4f46e5 !important; filter: drop-shadow(0 0 8px rgba(79,70,229,0.4)); }
+body.light .reg-node:hover .nshape { stroke: #000 !important; }
+</style>
+</head>
+<body>
+<div id="nav-sidebar">
+ <div id="nav-title">omm</div>
+ <div id="nav-list"></div>
+</div>
+
+<div id="canvas-wrap">
+ <div class="float-controls">
+ <button class="hbtn" onclick="zoomOut()">−</button>
+ <span id="zoom-label">70%</span>
+ <button class="hbtn" onclick="zoomIn()">+</button>
+ <button class="hbtn" onclick="resetView()" style="font-size:11px">fit</button>
+ <button class="hbtn" id="theme-btn" onclick="toggleTheme()" style="font-size:13px">○</button>
+ </div>
+ <div id="canvas"></div>
+</div>
+
+<div id="sidebar">
+ <div id="sb-head"><div id="sb-title"></div><button id="sb-close" onclick="closeSidebar()">×</button></div>
+ <div id="sb-body">
+ <div class="sb-diagram" id="sb-diagram"></div>
+ <div class="sb-fields" id="sb-fields"></div>
+ </div>
+</div>
+
+<script type="module">
+// ── theme ─────────────────────────────────────────────────
+let isDark = localStorage.getItem('omm-theme') !== 'light';
+function applyTheme() {
+ document.body.classList.toggle('light', !isDark);
+ const btn = document.getElementById('theme-btn');
+ if (btn) btn.textContent = isDark ? '○' : '●';
+}
+window.toggleTheme = function() {
+ isDark = !isDark;
+ localStorage.setItem('omm-theme', isDark ? 'dark' : 'light');
+ applyTheme();
+ rebuildCanvas();
+};
+function theme() {
+ return isDark ? {
+ groupFill:'#0a0a0a', groupStroke:'#666666',
+ subFill:'#111111', subStroke:'#666666', subLabelFill:'#ffffff',
+ edgeColor0:'#909090', edgeColor1:'#787878',
+ edgeLabelBg:'#000000', edgeLabelText:'#aaaaaa',
+ grpLabelFill:'#ffffff', grpLabelCenterFill:'#dddddd',
+ } : {
+ groupFill:'#f8f8f8', groupStroke:'#bbb',
+ subFill:'#efefef', subStroke:'#bbb', subLabelFill:'#888',
+ edgeColor0:'#94a3b8', edgeColor1:'#bbb',
+ edgeLabelBg:'#e8e8e8', edgeLabelText:'#475569',
+ grpLabelFill:'#475569', grpLabelCenterFill:'#222',
+ };
+}
+
+// ── helpers ──────────────────────────────────────────────
+const _tm = document.createElement('canvas').getContext('2d');
+function tw(t, f) { _tm.font = f || '11px Inter,system-ui'; return Math.ceil(_tm.measureText(t).width); }
+function esc(s) { return String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;'); }
+function r1(n) { return +n.toFixed(1); }
+function fmtLabel(s) { return s.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' '); }
+
+// ── flowchart parser ──────────────────────────────────────
+function parseFlowchart(raw) {
+ const lines = raw.split('\n').map(l=>l.trim()).filter(l=>l&&!l.startsWith('%%'));
+ let rankdir = 'LR';
+ const nodesMap = new Map(), edges = [], classOf = {};
+
+ function cleanLabel(s) { return s.replace(/<br\s*\/?>/gi, '\n').replace(/\\n/g, '\n'); }
+ function tok(t) {
+ t = t.trim();
+ let m;
+ m = t.match(/^(@?[\w-]+)\["([^"]+)"\]$/); if (m) return {id:m[1].replace(/^@/,''),label:cleanLabel(m[2]),shape:'rect',isRef:m[1].startsWith('@')};
+ m = t.match(/^(@?[\w-]+)\[([^\]]+)\]$/); if (m) return {id:m[1].replace(/^@/,''),label:cleanLabel(m[2]),shape:'rect',isRef:m[1].startsWith('@')};
+ m = t.match(/^(@?[\w-]+)\(\(([^)]+)\)\)$/); if (m) return {id:m[1].replace(/^@/,''),label:cleanLabel(m[2]),shape:'stadium',isRef:m[1].startsWith('@')};
+ m = t.match(/^(@?[\w-]+)\(([^)]+)\)$/); if (m) return {id:m[1].replace(/^@/,''),label:cleanLabel(m[2]),shape:'round',isRef:m[1].startsWith('@')};
+ m = t.match(/^(@?[\w-]+)\{([^}]+)\}$/); if (m) return {id:m[1].replace(/^@/,''),label:cleanLabel(m[2]),shape:'diamond',isRef:m[1].startsWith('@')};
+ if (/^@?[\w-]+$/.test(t)) { const id=t.replace(/^@/,''); return {id,label:id,shape:'rect',isRef:t.startsWith('@')}; }
+ return null;
+ }
+
+ // Edge pattern: A --> B, A -->|label| B, A -- "label" --> B, etc.
+ const edgeLineRe = /^(.+?)\s+--\s+"([^"]+)"\s+-->\s+(.+)$/;
+ const arrowRe = /(-->(?:\|[^|]*\|)?|--o|--x|---|-.->|==>|~~>)/;
+ for (const line of lines) {
+ const dir = line.match(/^(?:graph|flowchart)\s+([A-Z]{2})/i);
+ if (dir) { const d=dir[1].toUpperCase(); rankdir=(d==='TD'||d==='TB')?'TB':d; continue; }
+ if (/^(classDef|click |style |linkStyle|subgraph|end$)/i.test(line)) continue;
+ const ca = line.match(/^class\s+([\w\-,\s]+)\s+(\w+)$/);
+ if (ca) { ca[1].split(',').map(s=>s.trim()).forEach(id=>classOf[id]=ca[2]); continue; }
+ // Try "-- label -->" syntax first (e.g., APP -- "HTTP API" --> SERVER)
+ const labelEdge = line.match(edgeLineRe);
+ if (labelEdge) {
+ const src=tok(labelEdge[1]), dst=tok(labelEdge[3]);
+ if (src&&dst) {
+ if (!nodesMap.has(src.id)) nodesMap.set(src.id,src);
+ if (!nodesMap.has(dst.id)) nodesMap.set(dst.id,dst);
+ edges.push({from:src.id,to:dst.id,label:labelEdge[2].replace(/<br\s*\/?>/gi,' ')});
+ }
+ continue;
+ }
+ const parts = line.split(arrowRe);
+ if (parts.length >= 3) {
+ const src=tok(parts[0]), dst=tok(parts[2]);
+ if (src&&dst) {
+ if (!nodesMap.has(src.id)) nodesMap.set(src.id,src);
+ if (!nodesMap.has(dst.id)) nodesMap.set(dst.id,dst);
+ const lm=parts[1].match(/\|([^|]+)\|/);
+ edges.push({from:src.id,to:dst.id,label:lm?lm[1].replace(/<br\s*\/?>/gi,' '):''});
+ }
+ } else {
+ const n=tok(line); if (n&&!nodesMap.has(n.id)) nodesMap.set(n.id,n);
+ }
+ }
+ for (const [id,cls] of Object.entries(classOf)) { const n=nodesMap.get(id); if (n) n.cls=cls; }
+ return {rankdir, nodes:[...nodesMap.values()], edges};
+}
+
+// ── node style ────────────────────────────────────────────
+function nodeStyle(node) {
+ const c = node.cls||'';
+ if (isDark) {
+ if (c==='external') return {bg:'#0a0a0a',border:'#666666',dash:null,text:'#cccccc'};
+ if (c==='lib') return {bg:'#0a0a0a',border:'#666666',dash:null, text:'#cccccc'};
+ return {bg:'#0a0a0a',border:'#666666',dash:null, text:'#ffffff'};
+ } else {
+ if (c==='external') return {bg:'#e0e0e0',border:'#bbb',dash:null,text:'#64748b'};
+ if (c==='lib') return {bg:'#e8e8e8',border:'#c0c0c0',dash:null, text:'#553388'};
+ return {bg:'#f0f0f0',border:'#999', dash:null, text:'#1a1a1a'};
+ }
+}
+
+// ── smooth path through all Dagre waypoints ───────────────
+// Uses quadratic bezier spline so edges respect Dagre's obstacle routing
+function smoothPath(pts) {
+ if (!pts || pts.length < 2) return '';
+ if (pts.length === 2) {
+ // Simple S-curve for two-point edges
+ const [a, b] = pts;
+ const mx = r1((a.x+b.x)/2), my = r1((a.y+b.y)/2);
+ return `M${r1(a.x)},${r1(a.y)} C${mx},${r1(a.y)} ${mx},${r1(b.y)} ${r1(b.x)},${r1(b.y)}`;
+ }
+ // Quadratic bezier spline: smooth through all waypoints
+ let d = `M${r1(pts[0].x)},${r1(pts[0].y)}`;
+ for (let i = 1; i < pts.length - 1; i++) {
+ const mid = { x: (pts[i].x + pts[i+1].x) / 2, y: (pts[i].y + pts[i+1].y) / 2 };
+ d += ` Q${r1(pts[i].x)},${r1(pts[i].y)} ${r1(mid.x)},${r1(mid.y)}`;
+ }
+ const last = pts[pts.length-1];
+ d += ` L${r1(last.x)},${r1(last.y)}`;
+ return d;
+}
+
+// ── render one class group (recursive) ────────────────────
+// _expandedGlobal prevents same class from expanding in multiple branches
+let _expandedGlobal = new Set();
+
+function renderGroup(cls, classesData, allClasses, level, seen = new Set()) {
+ if (seen.has(cls)) return null;
+ seen = new Set(seen); seen.add(cls);
+ let labelOverlay = ''; // centered labels for sub-groups, rendered outside grp-inner
+
+ const data = classesData[cls];
+ if (!data?.diagram) return null;
+
+ const parsed = parseFlowchart(data.diagram);
+ const {rankdir, nodes, edges} = parsed;
+ if (!nodes.length) return null;
+
+ // padding around the group content
+ const PAD_L = 16, PAD_R = 20, PAD_T = level===0 ? 20 : 22, PAD_B = 16;
+
+ // For level 0: expand @ref nodes as sub-groups
+ const subGroups = {}; // nodeId -> { cls, W, H, svgContent }
+ const nodeDims = {}; // nodeId -> { width, height }
+
+ for (const n of nodes) {
+ const refCls = n.isRef ? n.id : null;
+ if (level < maxDepth && refCls && allClasses.includes(refCls) && !seen.has(refCls) && !_expandedGlobal.has(refCls)) {
+ _expandedGlobal.add(refCls);
+ const sub = renderGroup(refCls, classesData, allClasses, level+1, seen);
+ if (sub) {
+ subGroups[n.id] = { cls: refCls, ...sub };
+ // sub-group dims = content + inner padding
+ nodeDims[n.id] = { width: sub.W + 24, height: sub.H + 30 }; // 30 = 16 top label + 14 bottom
+ }
+ }
+ if (!nodeDims[n.id]) {
+ const lbl = n.label.replace(/^@/,'');
+ const [mainLbl] = lbl.split('\n');
+ const hasPath = lbl.includes('\n');
+ const maxW = nodes.length > 10 ? 160 : 220;
+ const w = Math.min(maxW, Math.max(80, tw(mainLbl, level===0?'12px Inter,system-ui':'11px Inter,system-ui') + 44));
+ const baseH = n.shape==='diamond' ? 42 : (level===0 ? 38 : 34);
+ nodeDims[n.id] = {width: w, height: hasPath ? baseH + 14 : baseH};
+ }
+ }
+
+ // Pre-process: identify fan-out groups for compact grid layout
+ const maxPerRow = 3;
+ const _gridGroups = {}; // virtualId -> { parentId, children[], cols, cellW, cellH }
+ const _gridExcluded = new Set(); // node IDs replaced by virtual nodes
+ const _gridPositions = {}; // childId -> { x, y } (filled after dagre)
+
+ for (const n of nodes) {
+ const outEdges = edges.filter(e => e.from === n.id);
+ const leafTargets = outEdges
+ .map(e => e.to)
+ .filter(tid => !edges.some(e2 => e2.from === tid) && !subGroups[tid]);
+ if (leafTargets.length > maxPerRow) {
+ const cols = maxPerRow;
+ const rows = Math.ceil(leafTargets.length / cols);
+ const maxCW = Math.max(...leafTargets.map(id => nodeDims[id].width));
+ const maxCH = Math.max(...leafTargets.map(id => nodeDims[id].height));
+ const cellW = maxCW + 16;
+ const cellH = maxCH + 10;
+ const vid = `__grid_${n.id}`;
+ _gridGroups[vid] = { parentId: n.id, children: leafTargets, cols, cellW, cellH };
+ nodeDims[vid] = { width: cols * cellW, height: rows * cellH };
+ leafTargets.forEach(id => _gridExcluded.add(id));
+ }
+ }
+
+ // Dagre layout with virtual grid nodes
+ const dense = nodes.length > 10;
+ function buildGraph(rd) {
+ const g = new dagre.graphlib.Graph();
+ const nsep = level===0 ? (dense ? 20 : 32) : (dense ? 16 : 24);
+ const rsep = level===0 ? (dense ? 28 : 44) : (dense ? 22 : 32);
+ g.setGraph({rankdir: rd, nodesep:nsep, ranksep:rsep, marginx:PAD_L, marginy:PAD_T});
+ g.setDefaultEdgeLabel(() => ({}));
+ for (const n of nodes) {
+ if (!_gridExcluded.has(n.id)) g.setNode(n.id, nodeDims[n.id]);
+ }
+ for (const vid of Object.keys(_gridGroups)) g.setNode(vid, nodeDims[vid]);
+ const _addedVirtEdges = new Set();
+ for (const e of edges) {
+ let from = e.from, to = e.to;
+ if (_gridExcluded.has(from)) continue;
+ if (_gridExcluded.has(to)) {
+ const vEntry = Object.entries(_gridGroups).find(([,gr]) => gr.children.includes(to));
+ if (!vEntry) continue;
+ to = vEntry[0];
+ const ek = `${from}->${to}`;
+ if (_addedVirtEdges.has(ek)) continue;
+ _addedVirtEdges.add(ek);
+ }
+ if (g.hasNode(from) && g.hasNode(to)) g.setEdge(from, to, {label: e.label});
+ }
+ try { dagre.layout(g); return g; } catch { return null; }
+ }
+
+ let g = buildGraph(rankdir);
+ if (!g) return null;
+ const gi0 = g.graph();
+ const aspectThreshold = nodes.length > 12 ? 1.4 : nodes.length > 7 ? 1.6 : 2.0;
+ if (gi0.width > 0 && gi0.height > 0 && gi0.width / gi0.height > aspectThreshold && rankdir !== 'TB') {
+ const gTB = buildGraph('TB');
+ if (gTB) g = gTB;
+ }
+
+ // Expand virtual grid nodes into child positions
+ for (const [vid, group] of Object.entries(_gridGroups)) {
+ const vNode = g.node(vid);
+ if (!vNode) continue;
+ const { children, cols, cellW, cellH } = group;
+ const rows = Math.ceil(children.length / cols);
+ const startX = vNode.x - ((cols - 1) * cellW) / 2;
+ const startY = vNode.y - ((rows - 1) * cellH) / 2;
+ children.forEach((childId, i) => {
+ _gridPositions[childId] = {
+ x: startX + (i % cols) * cellW,
+ y: startY + Math.floor(i / cols) * cellH
+ };
+ });
+ }
+
+ const gi = g.graph();
+ const W = r1(gi.width + PAD_R);
+ const H = r1(gi.height + PAD_B);
+
+ const uid = `${cls.replace(/[^a-z0-9]/gi,'')}_l${level}_`;
+ const th = theme();
+ let svg = '';
+
+ // edges
+ edges.forEach((e,i) => {
+ if (_gridExcluded.has(e.from)) return; // skip edges from grid children
+ let pts, d, mid;
+ const srcPos = g.node(e.from) || _gridPositions[e.from];
+ const tgtPos = _gridPositions[e.to] || g.node(e.to);
+ if (!srcPos || !tgtPos) return;
+ if (_gridPositions[e.to]) {
+ // Edge to grid child: direct path from parent to child grid position
+ const mx = (srcPos.x + tgtPos.x) / 2, my = (srcPos.y + tgtPos.y) / 2;
+ pts = [{x:srcPos.x,y:srcPos.y},{x:mx,y:my},{x:tgtPos.x,y:tgtPos.y}];
+ d = smoothPath(pts);
+ mid = {x:mx, y:my};
+ } else {
+ const ed = g.edge(e.from, e.to); if (!ed?.points?.length) return;
+ pts = ed.points;
+ d = smoothPath(pts);
+ mid = pts[Math.floor(pts.length/2)];
+ }
+ const ec = level===0 ? th.edgeColor0 : th.edgeColor1;
+ const mk = `${uid}m${i}`;
+ svg += `<defs><marker id="${mk}" markerWidth="6" markerHeight="5" refX="5" refY="2.5" orient="auto" markerUnits="userSpaceOnUse">
+ <path d="M0,0.5 L0,4.5 L6,2.5 z" fill="${ec}"/></marker></defs>
+ <path class="edge-path" d="${d}" stroke="${ec}" stroke-width="2" fill="none" marker-end="url(#${mk})" data-from="${esc(e.from)}" data-to="${esc(e.to)}"/>`;
+ if (e.label) {
+ const lw = tw(e.label,'9px Inter')+8;
+ const mx=r1(mid.x), my=r1(mid.y);
+ svg += `<g class="edge-label"><rect x="${mx-lw/2}" y="${my-6}" width="${lw}" height="12" rx="2" fill="${th.edgeLabelBg}"/>
+ <text x="${mx}" y="${my+3}" text-anchor="middle" font-family="Inter,system-ui" font-size="9" fill="${th.edgeLabelText}">${esc(e.label)}</text></g>`;
+ }
+ });
+
+ // nodes
+ for (const n of nodes) {
+ const pos = _gridPositions[n.id] || g.node(n.id); if (!pos) continue;
+ const dim = nodeDims[n.id];
+ const nx = r1(pos.x - dim.width/2);
+ const ny = r1(pos.y - dim.height/2);
+ const sg = subGroups[n.id];
+
+ if (sg) {
+ // ── sub-group: dashed boundary + nested content ──
+ const safeId = esc(sg.cls);
+ const isRef = n.label.startsWith('@');
+ const refSubStroke = th.subStroke;
+ const refDash = '';
+ svg += `<g class="grp-node" onclick="event.stopPropagation();window.__openSb('${safeId}')" data-cls="${safeId}" data-depth="${level+1}" transform="translate(${nx},${ny})">`;
+ svg += `<rect class="grp-border" width="${dim.width}" height="${dim.height}" rx="5"
+ fill="${th.subFill}" stroke="${refSubStroke}" stroke-width="2"/>`;
+ const _slW = tw(fmtLabel(sg.cls), '600 9px "Plus Jakarta Sans",Inter,system-ui') + 12;
+ svg += `<rect class="grp-label-top grp-label-bg" x="5" y="-7" width="${_slW}" height="14" rx="2" fill="${th.subFill}" opacity="1"/>`;
+ svg += `<text class="grp-label-top" x="10" y="2" font-family="&quot;Plus Jakarta Sans&quot;,Inter,system-ui" font-size="9" font-weight="600"
+ fill="${th.subLabelFill}" letter-spacing="0.05em">${esc(fmtLabel(sg.cls))}</text>`;
+ svg += `<g class="grp-inner" transform="translate(12,18)">${sg.svgContent}</g>`;
+ svg += `</g>`;
+ labelOverlay += `<text class="grp-label-center" x="${r1(nx + dim.width/2)}" y="${r1(ny + dim.height/2)}" text-anchor="middle" dominant-baseline="central"
+ font-family="&quot;Plus Jakarta Sans&quot;,Inter,system-ui" font-size="9" font-weight="600" fill="${th.grpLabelCenterFill}" letter-spacing="0.05em">${esc(fmtLabel(sg.cls))}</text>`;
+ } else {
+ // ── regular node ──
+ const st = nodeStyle(n);
+ if (n.label.startsWith('@')) {
+ // @ref nodes keep same border as default (white)
+ // @ref nodes keep solid border
+ }
+ const da = st.dash ? `stroke-dasharray="${st.dash}"` : '';
+ const rawLbl = n.label.replace(/^@/,'');
+ const [mainLbl, pathLbl] = rawLbl.split('\n');
+ const cx = r1(pos.x), cy = r1(pos.y);
+ const fs = level===0 ? 12 : 11;
+ const safeId = esc(n.id);
+ let shape = '';
+ if (n.shape==='diamond') {
+ shape = `<polygon class="nshape" points="${cx},${ny} ${nx+dim.width},${cy} ${cx},${ny+dim.height} ${nx},${cy}"
+ fill="${st.bg}" stroke="${st.border}" stroke-width="2" ${da}/>`;
+ } else if (n.shape==='stadium'||n.shape==='round') {
+ shape = `<rect class="nshape" x="${nx}" y="${ny}" width="${dim.width}" height="${dim.height}"
+ rx="${dim.height/2}" fill="${st.bg}" stroke="${st.border}" stroke-width="2" ${da}/>`;
+ } else {
+ shape = `<rect class="nshape" x="${nx}" y="${ny}" width="${dim.width}" height="${dim.height}"
+ rx="4" fill="${st.bg}" stroke="${st.border}" stroke-width="2" ${da}/>`;
+ }
+ if (pathLbl) {
+ svg += `<g class="reg-node" data-cls="${safeId}" onclick="event.stopPropagation();window.__openSb('${safeId}')">${shape}
+ <text class="node-lbl" x="${cx}" y="${r1(cy - 7)}" text-anchor="middle" dominant-baseline="central"
+ font-family="Inter,system-ui,sans-serif" font-size="${fs}" fill="${st.text}">${esc(mainLbl)}</text>
+ <text class="node-path" x="${cx}" y="${r1(cy + 7)}" text-anchor="middle" dominant-baseline="central"
+ font-family="'SF Mono','Fira Code',monospace" font-size="9" fill="${st.text}" opacity="0.45">${esc(pathLbl)}</text>
+ </g>`;
+ } else {
+ svg += `<g class="reg-node" data-cls="${safeId}" onclick="event.stopPropagation();window.__openSb('${safeId}')">${shape}
+ <text class="node-lbl" x="${cx}" y="${cy}" text-anchor="middle" dominant-baseline="central"
+ font-family="Inter,system-ui,sans-serif" font-size="${fs}" fill="${st.text}">${esc(mainLbl)}</text>
+ </g>`;
+ }
+ }
+ }
+
+ return { svgContent: svg, W, H, labelOverlay };
+}
+
+// ── sidebar diagram renderer (flat, for sidebar only) ─────
+function renderFlatSVG(text) {
+ if (!text) return null;
+ let parsed; try { parsed = parseFlowchart(text); } catch { return null; }
+ const {rankdir, nodes, edges} = parsed;
+ if (!nodes.length) return null;
+ const g = new dagre.graphlib.Graph();
+ g.setGraph({rankdir, nodesep:36, ranksep:48, marginx:18, marginy:14});
+ g.setDefaultEdgeLabel(() => ({}));
+ const dims = {};
+ for (const n of nodes) {
+ const lbl = n.label.replace(/^@/,'');
+ const [mainLbl] = lbl.split('\n');
+ const hasPath = lbl.includes('\n');
+ const w = Math.min(180,Math.max(60,tw(mainLbl,'11px Inter,system-ui')+28));
+ const h = (n.shape==='diamond'?34:28) + (hasPath ? 12 : 0);
+ dims[n.id]={w,h}; g.setNode(n.id,{width:w,height:h});
+ }
+ for (const e of edges) { if (g.hasNode(e.from)&&g.hasNode(e.to)) g.setEdge(e.from,e.to,{label:e.label}); }
+ try { dagre.layout(g); } catch { return null; }
+ const gi = g.graph();
+ const W = r1((gi.width||150)+36), H = r1((gi.height||80)+28);
+ let edg='', nds='';
+ const sth = theme();
+ edges.forEach((e,i) => {
+ const ed=g.edge(e.from,e.to); if (!ed?.points?.length) return;
+ const pts=ed.points, d=smoothPath(pts);
+ const mid=pts[Math.floor(pts.length/2)];
+ const mk=`sbm${i}${Math.random().toString(36).slice(2,5)}`;
+ edg+=`<defs><marker id="${mk}" markerWidth="6" markerHeight="5" refX="5" refY="2.5" orient="auto" markerUnits="userSpaceOnUse">
+ <path d="M0,0.5 L0,4.5 L6,2.5 z" fill="${sth.edgeColor0}"/></marker></defs>
+ <path class="edge-path" d="${d}" stroke="${sth.edgeColor0}" stroke-width="2" fill="none" marker-end="url(#${mk})" data-from="${esc(e.from)}" data-to="${esc(e.to)}"/>`;
+ if (e.label) {
+ const lw=tw(e.label,'9px Inter')+8, mx=r1(mid.x), my=r1(mid.y);
+ edg+=`<rect x="${mx-lw/2}" y="${my-6}" width="${lw}" height="12" rx="2" fill="${sth.edgeLabelBg}"/>
+ <text x="${mx}" y="${my+3}" text-anchor="middle" font-family="Inter,system-ui" font-size="9" fill="${sth.edgeLabelText}">${esc(e.label)}</text>`;
+ }
+ });
+ for (const n of nodes) {
+ const pos=g.node(n.id); if (!pos) continue;
+ const {w,h}=dims[n.id];
+ const nx=r1(pos.x-w/2), ny=r1(pos.y-h/2), cx=r1(pos.x), cy=r1(pos.y);
+ const st=nodeStyle(n), da=st.dash?`stroke-dasharray="${st.dash}"`:'';
+ const rawLbl=n.label.replace(/^@/,'');
+ const [mainLbl, pathLbl]=rawLbl.split('\n');
+ let shape='';
+ if (n.shape==='diamond') shape=`<polygon points="${cx},${ny} ${nx+w},${cy} ${cx},${ny+h} ${nx},${cy}" fill="${st.bg}" stroke="${st.border}" stroke-width="2" ${da}/>`;
+ else if (n.shape==='stadium'||n.shape==='round') shape=`<rect x="${nx}" y="${ny}" width="${w}" height="${h}" rx="${h/2}" fill="${st.bg}" stroke="${st.border}" stroke-width="2" ${da}/>`;
+ else shape=`<rect x="${nx}" y="${ny}" width="${w}" height="${h}" rx="4" fill="${st.bg}" stroke="${st.border}" stroke-width="2" ${da}/>`;
+ if (pathLbl) {
+ nds+=`<g>${shape}
+ <text x="${cx}" y="${r1(cy-6)}" text-anchor="middle" dominant-baseline="central"
+ font-family="Inter,system-ui" font-size="11" fill="${st.text}">${esc(mainLbl)}</text>
+ <text x="${cx}" y="${r1(cy+6)}" text-anchor="middle" dominant-baseline="central"
+ font-family="'SF Mono','Fira Code',monospace" font-size="9" fill="${st.text}" opacity="0.45">${esc(pathLbl)}</text>
+ </g>`;
+ } else {
+ nds+=`<g>${shape}<text x="${cx}" y="${cy}" text-anchor="middle" dominant-baseline="central"
+ font-family="Inter,system-ui" font-size="11" fill="${st.text}">${esc(mainLbl)}</text></g>`;
+ }
+ }
+ return `<svg viewBox="0 0 ${W} ${H}" style="width:100%;height:auto;overflow:visible" xmlns="http://www.w3.org/2000/svg">${edg}${nds}</svg>`;
+}
+
+// ── canvas pan/zoom ───────────────────────────────────────
+const canvasWrap = document.getElementById('canvas-wrap');
+const canvasEl = document.getElementById('canvas');
+const sidebar = document.getElementById('sidebar');
+const sbTitle = document.getElementById('sb-title');
+const sbDiagram = document.getElementById('sb-diagram');
+const sbFields = document.getElementById('sb-fields');
+const zoomLabel = document.getElementById('zoom-label');
+const navTitle = document.getElementById('nav-title');
+const navList = document.getElementById('nav-list');
+
+let vpX=0, vpY=0, vpScale=0.7;
+let classes=[], classesData={}, refsData={};
+let selectedCls=null, svgW=0, svgH=0;
+let maxDepth = 2; // dynamically updated based on zoom
+
+const api = p => fetch(p).then(r=>r.json()).catch(()=>({}));
+
+// ── transform ──────────────────────────────────────────────
+const MIN_SCALE = 0.02, MAX_SCALE = 8;
+
+function applyTransform() {
+ canvasEl.style.transform=`translate(${vpX}px,${vpY}px) scale(${vpScale})`;
+ const pct = Math.round(vpScale*100);
+ zoomLabel.textContent = pct >= 1000 ? `${(pct/100).toFixed(0)}k%` : `${pct}%`;
+
+ // Scale-compensated group labels: keep ~13px rendered size
+ const targetPx = 13;
+ const fs = Math.min(72, Math.max(10, targetPx / vpScale));
+ const fsStr = (Math.round(fs * 10) / 10).toString();
+ const labelFill = isDark ? (vpScale < 0.5 ? '#ccc' : '#cbd5e1') : (vpScale < 0.5 ? '#333' : '#475569');
+ document.querySelectorAll('#canvas .grp-label-top').forEach(el => {
+ if (el.tagName === 'text') {
+ el.setAttribute('font-size', fsStr);
+ el.setAttribute('fill', labelFill);
+ } else if (el.classList.contains('grp-label-bg')) {
+ // Scale background rect height to match font-size
+ el.setAttribute('height', String(Math.round(fs * 1.5)));
+ }
+ });
+ // Center label: keep ~20px rendered size in overview
+ const fsCtr = Math.min(120, Math.max(14, 20 / vpScale));
+ const fsCtrStr = (Math.round(fsCtr * 10) / 10).toString();
+ document.querySelectorAll('#canvas .grp-label-center').forEach(el => {
+ el.setAttribute('font-size', fsCtrStr);
+ });
+ // Scale-compensated node labels: keep ~11px rendered size at any zoom level
+ const fsNode = Math.min(60, Math.max(11, 11 / vpScale));
+ const fsNodeStr = (Math.round(fsNode * 10) / 10).toString();
+ document.querySelectorAll('#canvas .node-lbl').forEach(el => {
+ el.setAttribute('font-size', fsNodeStr);
+ });
+
+ canvasWrap.classList.toggle('zoom-overview', vpScale < 0.42);
+
+ // Viewport-relative expansion: measure group's own border rect
+ const vpW = canvasWrap.clientWidth;
+ document.querySelectorAll('#canvas [data-depth]').forEach(el => {
+ const border = el.querySelector(':scope > .grp-border');
+ if (!border) return;
+ const rect = border.getBoundingClientRect();
+ const depth = parseInt(el.getAttribute('data-depth') || '0', 10);
+ // Root=50%, depth1=65%, depth2=80% of viewport width to expand
+ const threshold = 0.5 + depth * 0.15;
+ const expanded = rect.width >= vpW * threshold;
+ el.classList.toggle('grp-expanded', expanded);
+ });
+
+ // Depth-based re-render (debounced)
+ // Depth scales with zoom — no hard cap
+ const neededDepth = vpScale >= 3.0 ? 6 : vpScale >= 1.5 ? 5 : vpScale >= 0.9 ? 4 : vpScale >= 0.55 ? 3 : 2;
+ if (neededDepth !== maxDepth) {
+ maxDepth = neededDepth;
+ if (_depthTimer) clearTimeout(_depthTimer);
+ _depthTimer = setTimeout(rebuildCanvas, 180);
+ }
+}
+let _depthTimer = null;
+
+function zoomTo(newScale, originX, originY) {
+ const s = Math.max(MIN_SCALE, Math.min(MAX_SCALE, newScale));
+ const cW = canvasWrap.clientWidth, cH = canvasWrap.clientHeight;
+ const cx = originX ?? cW/2, cy = originY ?? cH/2;
+ vpX = cx - (cx - vpX) * (s / vpScale);
+ vpY = cy - (cy - vpY) * (s / vpScale);
+ vpScale = s;
+ applyTransform();
+}
+
+function centerView() {
+ if (!svgW) return;
+ const cW=canvasWrap.clientWidth, cH=canvasWrap.clientHeight;
+ const s = Math.min(0.9, (cW-80)/svgW, (cH-80)/svgH);
+ vpScale = s;
+ vpX = cW/2 - (svgW/2)*s;
+ vpY = cH/2 - (svgH/2)*s;
+ applyTransform();
+}
+
+window.zoomIn = () => zoomTo(vpScale * 1.25);
+window.zoomOut = () => zoomTo(vpScale / 1.25);
+window.resetView = centerView;
+
+// ── animated transition ────────────────────────────────────
+let _raf = null;
+function animateTo(toX, toY, toScale, duration=380) {
+ if (_raf) cancelAnimationFrame(_raf);
+ const fromX = vpX, fromY = vpY, fromS = vpScale;
+ const t0 = performance.now();
+ function frame(now) {
+ const t = Math.min(1, (now - t0) / duration);
+ const e = 1 - Math.pow(1 - t, 3); // ease-out cubic
+ vpX = fromX + (toX - fromX) * e;
+ vpY = fromY + (toY - fromY) * e;
+ vpScale = fromS + (toScale - fromS) * e;
+ applyTransform();
+ if (t < 1) _raf = requestAnimationFrame(frame);
+ }
+ _raf = requestAnimationFrame(frame);
+}
+
+function focusGroup(cls) {
+ // Mark focused group as exempt from blur
+ document.querySelectorAll('#canvas [data-cls].focus-exempt').forEach(el => el.classList.remove('focus-exempt'));
+ const el = document.querySelector(`#canvas [data-cls="${CSS.escape(cls)}"]`);
+ if (!el) return;
+ el.classList.add('focus-exempt');
+ // Also exempt all ancestor groups so parent blur doesn't hide focused child
+ let ancestor = el.parentElement;
+ while (ancestor) {
+ if (ancestor.hasAttribute && ancestor.hasAttribute('data-cls')) {
+ ancestor.classList.add('focus-exempt');
+ }
+ ancestor = ancestor.parentElement;
+ }
+
+ // Use the group's border rect for accurate dimensions
+ const border = el.querySelector(':scope > .grp-border') || el;
+ const rect = border.getBoundingClientRect();
+ const wrapRect = canvasWrap.getBoundingClientRect();
+
+ // Convert screen coords to SVG space
+ const svgCenterX = (rect.left + rect.width/2 - wrapRect.left - vpX) / vpScale;
+ const svgCenterY = (rect.top + rect.height/2 - wrapRect.top - vpY) / vpScale;
+ const svgW = rect.width / vpScale;
+ const svgH = rect.height / vpScale;
+
+ // Available viewport (account for right sidebar overlay)
+ const sbW = sidebar.classList.contains('open') ? 400 : 0;
+ const availW = canvasWrap.clientWidth - sbW - 60;
+ const availH = canvasWrap.clientHeight - 60;
+
+ // Target scale to fit element with padding
+ const targetScale = Math.min(2.5, Math.max(0.15, Math.min(availW / svgW, availH / svgH) * 0.85));
+
+ // Center in available viewport
+ const centerX = (canvasWrap.clientWidth - sbW) / 2;
+ const centerY = canvasWrap.clientHeight / 2;
+ const toX = centerX - svgCenterX * targetScale;
+ const toY = centerY - svgCenterY * targetScale;
+
+ animateTo(toX, toY, targetScale);
+}
+
+// ── wheel: Figma-style ─────────────────────────────────────
+// trackpad two-finger scroll → pan
+// trackpad pinch (ctrlKey) / Ctrl+mousewheel → zoom
+canvasWrap.addEventListener('wheel', e => {
+ e.preventDefault();
+ clearFocusExempt();
+
+ if (e.ctrlKey || e.metaKey) {
+ // Zoom — trackpad pinch gives pixel deltas, mouse wheel gives line deltas
+ let factor;
+ if (e.deltaMode === 0) {
+ // trackpad pinch: more responsive
+ factor = Math.pow(0.993, e.deltaY);
+ } else {
+ // mouse wheel: snappier step
+ factor = e.deltaY < 0 ? 1.22 : 1/1.22;
+ }
+ zoomTo(vpScale * factor, e.clientX, e.clientY);
+ } else {
+ // Pan — respect both axes (trackpad two-finger swipe)
+ vpX -= e.deltaX;
+ vpY -= e.deltaY;
+ applyTransform();
+ }
+}, { passive: false });
+
+// ── pan: space+drag, middle-mouse, empty-area drag ─────────
+let spaceHeld = false;
+let panning = false, panA = {}, panV = {};
+
+function updateCursor() {
+ if (panning) canvasWrap.style.cursor = 'grabbing';
+ else if (spaceHeld) canvasWrap.style.cursor = 'grab';
+ else canvasWrap.style.cursor = '';
+}
+
+window.addEventListener('keydown', e => {
+ if (e.code === 'Space' && document.activeElement === document.body) {
+ e.preventDefault();
+ spaceHeld = true;
+ updateCursor();
+ }
+ // Figma keyboard shortcuts
+ if ((e.metaKey || e.ctrlKey) && !e.shiftKey) {
+ if (e.key === '0') { e.preventDefault(); centerView(); }
+ if (e.key === '1') { e.preventDefault(); zoomTo(1); }
+ if (e.key === '2') { e.preventDefault(); zoomTo(2); }
+ if (e.key === '+' || e.key === '=') { e.preventDefault(); window.zoomIn(); }
+ if (e.key === '-') { e.preventDefault(); window.zoomOut(); }
+ }
+ if (e.key === 'Escape') closeSidebar();
+});
+window.addEventListener('keyup', e => {
+ if (e.code === 'Space') { spaceHeld = false; updateCursor(); }
+});
+
+canvasWrap.addEventListener('mousedown', e => {
+ const isMiddle = e.button === 1;
+ const isSpaceDrag = e.button === 0 && spaceHeld;
+ const isEmptyDrag = e.button === 0 && !spaceHeld &&
+ !e.target.closest('.grp-node') && !e.target.closest('.reg-node');
+
+ if (isMiddle || isSpaceDrag || isEmptyDrag) {
+ e.preventDefault();
+ panning = true;
+ panA = { x: e.clientX, y: e.clientY };
+ panV = { x: vpX, y: vpY };
+ updateCursor();
+ }
+});
+
+window.addEventListener('mousemove', e => {
+ if (!panning) return;
+ vpX = panV.x + (e.clientX - panA.x);
+ vpY = panV.y + (e.clientY - panA.y);
+ applyTransform();
+});
+
+window.addEventListener('mouseup', () => {
+ if (panning) { panning = false; updateCursor(); }
+});
+
+// close sidebar when clicking empty canvas area
+canvasWrap.addEventListener('click', e => {
+ if (!e.target.closest('[onclick]')) closeSidebar();
+});
+
+// ── sidebar ───────────────────────────────────────────────
+window.__openSb = function(cls) {
+ if (!classes.includes(cls)) return;
+ // highlight
+ document.querySelectorAll('.grp-node,.reg-node').forEach(el=>el.classList.remove('selected'));
+ document.querySelectorAll(`[data-cls="${CSS.escape(cls)}"]`).forEach(el=>el.classList.add('selected'));
+ selectedCls=cls;
+ document.querySelectorAll('.nav-item').forEach(el => {
+ el.classList.toggle('active', el.getAttribute('data-nav') === cls);
+ });
+ openSidebar(cls);
+ // Wait for sidebar transition to complete (250ms) before focusing
+ setTimeout(() => focusGroup(cls), 260);
+ // Cloud mode: notify parent frame of selection
+ if (window.parent !== window) {
+ window.parent.postMessage({ type: 'class-selected', className: cls }, '*');
+ }
+};
+
+function openSidebar(cls) {
+ const data=classesData[cls]||{}, refs=refsData[cls]||{};
+ sbTitle.textContent=fmtLabel(cls);
+ sbDiagram.innerHTML = data.diagram ? (renderFlatSVG(data.diagram)||'') : '';
+ const md=t=>t?marked.parse(t):'';
+ const sec=(title,body,ex='')=>body?`<div class="sb-sec ${ex}"><div class="sb-sec-title">${title}</div><div class="sb-sec-body">${body}</div></div>`:'';
+ let html='';
+ if (data.meta) {
+ const t=data.meta.updated?new Date(data.meta.updated).toLocaleString():'';
+ html+=`<div class="sb-sec"><div class="sb-sec-title">Meta</div><div class="sb-meta-text">${t?t+'<br>':''}${data.meta.update_count||0} updates${data.meta.git_branch?` · ${data.meta.git_branch}`:''}${data.meta.git_commit?` · ${data.meta.git_commit}`:''}</div></div>`;
+ }
+ html+=sec('Description',md(data.description));
+ html+=sec('Constraints',md(data.constraint));
+ html+=sec('Concerns',md(data.concern),'sb-concern');
+ html+=sec('Context',md(data.context));
+ html+=sec('Todo',md(data.todo));
+ html+=sec('Notes',md(data.note));
+ const inc=refs.incoming||[], out=refs.outgoing||[];
+ if (inc.length||out.length) {
+ const links=[
+ ...inc.map(r=>{const n=typeof r==='string'?r:r.source_class;return `<span class="sb-ref" onclick="window.__openSb('${esc(n)}')">← ${esc(n)}</span>`;}),
+ ...out.map(r=>{const n=typeof r==='string'?r:r.target_class;return `<span class="sb-ref" onclick="window.__openSb('${esc(n)}')">→ ${esc(n)}</span>`;}),
+ ].join('');
+ html+=`<div class="sb-sec"><div class="sb-sec-title">References</div><div class="sb-refs">${links}</div></div>`;
+ }
+ sbFields.innerHTML=html;
+ sidebar.classList.add('open');
+}
+
+function closeSidebar() {
+ sidebar.classList.remove('open');
+ document.querySelectorAll('.grp-node,.reg-node').forEach(el=>el.classList.remove('selected'));
+ document.querySelectorAll('#canvas [data-cls].focus-exempt').forEach(el => el.classList.remove('focus-exempt'));
+ selectedCls=null;
+ document.querySelectorAll('.nav-item').forEach(el => el.classList.remove('active'));
+}
+function clearFocusExempt() {
+ document.querySelectorAll('#canvas [data-cls].focus-exempt').forEach(el => el.classList.remove('focus-exempt'));
+}
+window.closeSidebar=closeSidebar;
+
+// ── build full canvas SVG ─────────────────────────────────
+function buildCanvas(classes, classesData, refsData) {
+ _expandedGlobal = new Set(); // reset per render
+ // Find top-level classes: those with no incoming @refs from other classes
+ const referenced = new Set();
+ for (const cls of classes) {
+ const diagram = classesData[cls]?.diagram || '';
+ const refs = [...diagram.matchAll(/@([\w-]+)/g)].map(m=>m[1]);
+ refs.forEach(r => { if (classes.includes(r)) referenced.add(r); });
+ }
+ const topLevel = classes.filter(c => !referenced.has(c));
+ // Fallback: if everything is referenced, just show all
+ const roots = topLevel.length ? topLevel : classes;
+
+ // Render each top-level group
+ const groups = [];
+ for (const cls of roots) {
+ const g = renderGroup(cls, classesData, classes, 0);
+ if (g) groups.push({ cls, ...g });
+ }
+ if (!groups.length) return null;
+
+ // Grid layout — ceil(sqrt(N)) columns for balanced aspect ratio
+ const COLS = Math.max(1, Math.ceil(Math.sqrt(groups.length)));
+ const GAP_X = 70, GAP_Y = 90, OUTER_PAD = 60;
+
+ // Assign grid positions
+ groups.forEach((g, i) => { g._col = i % COLS; g._row = Math.floor(i / COLS); });
+ const numRows = Math.ceil(groups.length / COLS);
+
+ // Column widths = max group width in that column
+ const colW = Array.from({length: COLS}, (_, c) =>
+ Math.max(...groups.filter(g => g._col === c).map(g => g.W)));
+ // Row heights = max group height in that row
+ const rowH = Array.from({length: numRows}, (_, r) =>
+ Math.max(...groups.filter(g => g._row === r).map(g => g.H)));
+
+ // Compute offsets
+ const colX = colW.reduce((acc, w, i) => { acc.push(i===0 ? 0 : acc[i-1]+colW[i-1]+GAP_X); return acc; }, []);
+ const rowY = rowH.reduce((acc, h, i) => { acc.push(i===0 ? 0 : acc[i-1]+rowH[i-1]+GAP_Y); return acc; }, []);
+
+ const totalW = colX[COLS-1] + colW[COLS-1];
+ const totalH = rowY[numRows-1] + rowH[numRows-1];
+ const canvasW = r1(totalW + OUTER_PAD*2);
+ const canvasH = r1(totalH + OUTER_PAD*2);
+
+ const th = theme();
+ let innerSVG = '';
+ for (const g of groups) {
+ const tx = r1(OUTER_PAD + colX[g._col]);
+ const ty = r1(OUTER_PAD + rowY[g._row]);
+ innerSVG += `<g class="grp-node" data-cls="${esc(g.cls)}" data-depth="0" transform="translate(${tx},${ty})" onclick="event.stopPropagation();window.__openSb('${esc(g.cls)}')">`;
+ innerSVG += `<rect class="grp-border" width="${g.W}" height="${g.H}" rx="8"
+ fill="${th.groupFill}" stroke="${th.groupStroke}" stroke-width="2"/>`;
+ const _lblW = tw(fmtLabel(g.cls), '600 10px "Plus Jakarta Sans",Inter,system-ui') + 14;
+ innerSVG += `<rect class="grp-label-top grp-label-bg" x="6" y="-10" width="${_lblW}" height="20" rx="2" fill="${th.groupFill}" opacity="1"/>`;
+ innerSVG += `<text class="grp-label-top" x="12" y="3" font-family="&quot;Plus Jakarta Sans&quot;,Inter,system-ui" font-size="10" font-weight="600"
+ fill="${th.grpLabelFill}" letter-spacing="0.05em">${esc(fmtLabel(g.cls))}</text>`;
+ innerSVG += `<g class="grp-inner">${g.svgContent}</g>`;
+ if (g.labelOverlay) innerSVG += `<g class="grp-sub-labels">${g.labelOverlay}</g>`;
+ innerSVG += `<text class="grp-label-center" x="${r1(g.W/2)}" y="${r1(g.H/2)}" text-anchor="middle" dominant-baseline="central"
+ font-family="&quot;Plus Jakarta Sans&quot;,Inter,system-ui" font-size="10" font-weight="600" fill="${th.grpLabelCenterFill}" letter-spacing="0.05em">${esc(fmtLabel(g.cls))}</text>`;
+ innerSVG += `</g>`;
+ }
+
+ return { html: `<svg width="${canvasW}" height="${canvasH}" xmlns="http://www.w3.org/2000/svg" style="overflow:visible">${innerSVG}</svg>`, W: canvasW, H: canvasH };
+}
+
+// ── post-render: glow filter + edge hover delegation ──────
+let _hoverListenerAttached = false;
+function postRender() {
+ // Insert glow filter into the first SVG's <defs> in #canvas
+ const svg = canvasEl.querySelector('svg');
+ if (svg) {
+ let defs = svg.querySelector('defs');
+ if (!defs) { defs = document.createElementNS('http://www.w3.org/2000/svg','defs'); svg.prepend(defs); }
+ // Remove existing glow filter if present (from prior render)
+ const existing = defs.querySelector('#glow');
+ if (existing) existing.remove();
+ defs.insertAdjacentHTML('beforeend',
+ '<filter id="glow"><feGaussianBlur in="SourceAlpha" stdDeviation="3" result="blur"/>' +
+ '<feFlood flood-color="#818cf8" flood-opacity="0.4" result="color"/>' +
+ '<feComposite in="color" in2="blur" operator="in" result="shadow"/>' +
+ '<feMerge><feMergeNode in="shadow"/><feMergeNode in="SourceGraphic"/></feMerge></filter>'
+ );
+ }
+
+ // Attach edge-hover event delegation once (survives innerHTML replacements on canvasEl)
+ if (!_hoverListenerAttached) {
+ _hoverListenerAttached = true;
+ canvasWrap.addEventListener('mouseover', e => {
+ const node = e.target.closest('.reg-node, .grp-node');
+ if (!node) return;
+ const nodeId = node.dataset.cls;
+ if (!nodeId) return;
+ // Only highlight edges in the same parent group (sibling edges)
+ const parentGroup = node.parentElement?.closest('[data-cls]') || node.closest('svg');
+ if (!parentGroup) return;
+ parentGroup.querySelectorAll('.edge-path').forEach(path => {
+ const from = path.dataset.from, to = path.dataset.to;
+ const match = from === nodeId || to === nodeId || from === '@'+nodeId || to === '@'+nodeId;
+ const edgeParentGroup = path.closest('[data-cls]') || path.closest('svg');
+ if (edgeParentGroup !== parentGroup) return;
+ if (match) {
+ path.classList.add('edge-hl');
+ }
+ });
+ });
+ canvasWrap.addEventListener('mouseout', e => {
+ const node = e.target.closest('.reg-node, .grp-node');
+ if (!node) return;
+ document.querySelectorAll('#canvas .edge-path.edge-hl').forEach(path => {
+ path.classList.remove('edge-hl');
+ });
+ });
+ }
+}
+
+// ── rebuild canvas (depth change) ─────────────────────────
+function rebuildCanvas() {
+ const result = buildCanvas(classes, classesData, refsData);
+ if (!result) return;
+ canvasEl.innerHTML = result.html;
+ svgW = result.W; svgH = result.H;
+ applyTransform(); // re-sync label sizes / blur state
+ postRender();
+ // restore selected highlight only (no re-focus — user controls viewport after initial focus)
+ if (selectedCls) {
+ document.querySelectorAll(`[data-cls="${CSS.escape(selectedCls)}"]`)
+ .forEach(el => el.classList.add('selected'));
+ }
+}
+
+// ── nav sidebar tree ─────────────────────────────────────
+function buildNavTree() {
+ navList.innerHTML = '';
+ if (!classes.length) return;
+
+ const referenced = new Set();
+ for (const name of classes) {
+ const out = refsData[name]?.outgoing || [];
+ for (const o of out) {
+ const ref = typeof o === 'string' ? o : (o.target_class || o);
+ if (classes.includes(ref)) referenced.add(ref);
+ }
+ }
+
+ let roots = classes.filter(c => !referenced.has(c));
+ if (roots.length === 0 || roots.length === classes.length) {
+ classes.forEach(c => addNavItem(c, '', true));
+ return;
+ }
+
+ const globalSeen = new Set();
+ function renderNode(name, prefix, isLast) {
+ if (globalSeen.has(name)) return;
+ globalSeen.add(name);
+ addNavItem(name, prefix, isLast);
+ const out = (refsData[name]?.outgoing || [])
+ .map(o => typeof o === 'string' ? o : (o.target_class || o))
+ .filter(ref => classes.includes(ref) && !globalSeen.has(ref));
+ out.forEach((ref, i) => {
+ renderNode(ref, prefix + (isLast ? ' ' : '│ '), i === out.length - 1);
+ });
+ }
+ roots.forEach((r, i) => renderNode(r, '', i === roots.length - 1));
+}
+
+function addNavItem(name, prefix, isLast) {
+ const btn = document.createElement('button');
+ btn.setAttribute('data-nav', name);
+ btn.onclick = () => window.__openSb(name);
+
+ if (prefix === '') {
+ btn.className = 'nav-item nav-root';
+ btn.textContent = name;
+ } else {
+ btn.className = 'nav-item';
+ const pre = document.createElement('span');
+ pre.className = 'nav-pre';
+ // Each slot is 3 chars ("│ " or " ")
+ for (let i = 0; i < prefix.length; i += 3) {
+ const slot = document.createElement('span');
+ slot.className = 'nav-slot' + (prefix[i] === '│' ? ' nav-slot-line' : '');
+ pre.appendChild(slot);
+ }
+ const conn = document.createElement('span');
+ conn.className = 'nav-conn' + (isLast ? ' nav-conn-last' : '');
+ pre.appendChild(conn);
+ btn.appendChild(pre);
+ const label = document.createElement('span');
+ label.className = 'nav-label';
+ label.textContent = name;
+ btn.appendChild(label);
+ }
+
+ navList.appendChild(btn);
+}
+
+// ── init ──────────────────────────────────────────────────
+async function init() {
+ applyTheme();
+ classes = await api('/api/classes');
+ if (!classes.length) {
+ canvasEl.innerHTML=`<div class="empty-state" style="position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)"><p>No classes found.<br>Run <code>/omm-scan</code> in Claude Code.</p></div>`;
+ return;
+ }
+ const [da,ra] = await Promise.all([
+ Promise.all(classes.map(c=>api(`/api/class/${c}`))),
+ Promise.all(classes.map(c=>api(`/api/class/${c}/refs`))),
+ ]);
+ classes.forEach((c,i)=>{classesData[c]=da[i];refsData[c]=ra[i];});
+
+ // Set project name and build nav tree
+ navTitle.textContent = window.__projectName || 'omm';
+ buildNavTree();
+
+ const result = buildCanvas(classes, classesData, refsData);
+ if (result) {
+ canvasEl.innerHTML = result.html;
+ svgW = result.W; svgH = result.H;
+ }
+ postRender();
+ requestAnimationFrame(centerView);
+
+ // Cloud mode: notify parent frame of available classes
+ if (window.parent !== window) {
+ window.parent.postMessage({ type: 'classes-loaded', classes: classes, refs: refsData }, '*');
+ }
+
+ // Cloud mode: listen for parent frame messages
+ window.addEventListener('message', function(e) {
+ if (e.data && e.data.type === 'select-class') {
+ var className = e.data.className;
+ if (typeof window.__openSb === 'function') {
+ window.__openSb(className);
+ }
+ }
+ });
+}
+
+const sse = new EventSource('/events');
+sse.addEventListener('change', async () => {
+ const sel = selectedCls;
+ await init();
+ if (sel && classes.includes(sel)) window.__openSb(sel);
+});
+
+init();
+</script>
+</body>
+</html>
diff --git a/src/server/watcher.ts b/src/server/watcher.ts
new file mode 100644
index 0000000..798eef5
--- /dev/null
+++ b/src/server/watcher.ts
@@ -0,0 +1,55 @@
+import fs from 'node:fs';
+import type { ServerResponse } from 'node:http';
+import { getOmmDir } from '../lib/store.js';
+
+const clients = new Set<ServerResponse>();
+
+export function addSSEClient(res: ServerResponse): void {
+ res.writeHead(200, {
+ 'Content-Type': 'text/event-stream',
+ 'Cache-Control': 'no-cache',
+ 'Connection': 'keep-alive',
+ 'Access-Control-Allow-Origin': '*',
+ });
+ res.write('data: connected\n\n');
+ clients.add(res);
+
+ res.on('close', () => {
+ clients.delete(res);
+ });
+}
+
+function broadcast(event: string, data: string): void {
+ for (const client of clients) {
+ client.write(`event: ${event}\ndata: ${data}\n\n`);
+ }
+}
+
+let watcher: fs.FSWatcher | null = null;
+let debounceTimer: ReturnType<typeof setTimeout> | null = null;
+
+export function startWatcher(): void {
+ if (watcher) return;
+
+ const dir = getOmmDir();
+ if (!fs.existsSync(dir)) return;
+
+ watcher = fs.watch(dir, { recursive: true }, (_event, filename) => {
+ // Debounce rapid changes
+ if (debounceTimer) clearTimeout(debounceTimer);
+ debounceTimer = setTimeout(() => {
+ broadcast('change', JSON.stringify({ file: filename, time: Date.now() }));
+ }, 300);
+ });
+
+ watcher.on('error', () => {
+ // Silently handle watcher errors
+ });
+}
+
+export function stopWatcher(): void {
+ if (watcher) {
+ watcher.close();
+ watcher = null;
+ }
+}
diff --git a/src/types.ts b/src/types.ts
new file mode 100644
index 0000000..f331423
--- /dev/null
+++ b/src/types.ts
@@ -0,0 +1,54 @@
+export const VALID_FIELDS = ['description', 'diagram', 'constraint', 'concern', 'context', 'todo', 'note'] as const;
+export type Field = (typeof VALID_FIELDS)[number];
+
+export const FIELD_FILES: Record<Field, string> = {
+ description: 'description.md',
+ diagram: 'diagram.mmd',
+ constraint: 'constraint.md',
+ concern: 'concern.md',
+ context: 'context.md',
+ todo: 'todo.md',
+ note: 'note.md',
+};
+
+export interface ClassMeta {
+ created: string;
+ updated: string;
+ update_count: number;
+ last_field: Field;
+ git_commit?: string;
+ git_branch?: string;
+ prev_diagram?: string;
+}
+
+export interface ClassData {
+ name: string;
+ description?: string;
+ diagram?: string;
+ constraint?: string;
+ concern?: string;
+ context?: string;
+ todo?: string;
+ note?: string;
+ meta?: ClassMeta;
+}
+
+export interface OmmConfig {
+ version: string;
+ theme?: string;
+}
+
+export interface DiffResult {
+ added_nodes: string[];
+ removed_nodes: string[];
+ added_edges: string[];
+ removed_edges: string[];
+ has_changes: boolean;
+}
+
+export interface RefEntry {
+ source_class: string;
+ target_class: string;
+ node_id: string;
+ node_label?: string;
+}
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..4fe3365
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "strict": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "outDir": "dist",
+ "rootDir": "src",
+ "declaration": true,
+ "sourceMap": true,
+ "resolveJsonModule": true
+ },
+ "include": ["src/**/*"],
+ "exclude": ["node_modules", "dist", "test"]
+}
diff --git a/tsup.config.ts b/tsup.config.ts
new file mode 100644
index 0000000..1a12eaa
--- /dev/null
+++ b/tsup.config.ts
@@ -0,0 +1,14 @@
+import { defineConfig } from 'tsup';
+
+export default defineConfig({
+ entry: {
+ cli: 'src/cli.ts',
+ index: 'src/index.ts',
+ },
+ format: ['esm'],
+ dts: true,
+ clean: true,
+ splitting: false,
+ sourcemap: true,
+ onSuccess: 'cp src/server/viewer.html dist/ 2>/dev/null || true',
+});