@famgia/omnify-gui 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # @famgia/omnify-gui
2
+
3
+ Visual schema editor for Omnify with version history tracking.
4
+
5
+ ## Features
6
+
7
+ - Visual schema editor with drag-and-drop
8
+ - Real-time code preview (Laravel, TypeScript, SQL)
9
+ - Relationship diagram visualization
10
+ - **Version History** - Track schema changes over time
11
+ - **Pending Changes Preview** - See what changed before generating
12
+
13
+ ## Usage
14
+
15
+ ```bash
16
+ # From your project directory
17
+ omnify gui
18
+ ```
19
+
20
+ This opens the GUI at `http://localhost:3456/`
21
+
22
+ ## Development
23
+
24
+ ### Architecture
25
+
26
+ In development mode, the GUI runs as two separate processes:
27
+
28
+ | Process | Port | Purpose |
29
+ |---------|------|---------|
30
+ | Vite Dev Server | 5173 | Frontend with Hot Module Replacement (HMR) |
31
+ | Express API | 3456 | Backend API server |
32
+
33
+ **You only need to access `http://localhost:5173/`** - API calls are automatically proxied to port 3456.
34
+
35
+ ### Running Development Server
36
+
37
+ ```bash
38
+ cd packages/gui
39
+ pnpm dev
40
+ ```
41
+
42
+ Then open: `http://localhost:5173/`
43
+
44
+ ### Production Mode
45
+
46
+ In production, Express serves both frontend and API on a single port:
47
+
48
+ ```bash
49
+ pnpm build
50
+ node dist/server/index.js
51
+ # → http://localhost:3456/
52
+ ```
53
+
54
+ ## Version History
55
+
56
+ The GUI tracks schema changes in `.omnify/versions/` directory:
57
+
58
+ ```
59
+ .omnify/
60
+ versions/
61
+ 0001_initial.lock
62
+ 0002_add_users.lock
63
+ 0003_add_posts.lock
64
+ current.lock
65
+ ```
66
+
67
+ ### Version File Format
68
+
69
+ Each version file (YAML) contains:
70
+
71
+ ```yaml
72
+ version: 1
73
+ timestamp: "2025-12-28T10:00:00.000Z"
74
+ driver: mysql
75
+ migration: "create_users_table"
76
+ description: "Initial schema setup"
77
+ changes:
78
+ - action: schema_added
79
+ schema: User
80
+ - action: property_added
81
+ schema: User
82
+ property: email
83
+ snapshot:
84
+ User:
85
+ name: User
86
+ kind: object
87
+ properties:
88
+ email:
89
+ type: Email
90
+ unique: true
91
+ options:
92
+ id: true
93
+ timestamps: true
94
+ ```
95
+
96
+ ### Change Actions
97
+
98
+ | Action | Description |
99
+ |--------|-------------|
100
+ | `schema_added` | New schema created |
101
+ | `schema_removed` | Schema deleted |
102
+ | `schema_modified` | Schema options changed |
103
+ | `property_added` | New property added |
104
+ | `property_removed` | Property deleted |
105
+ | `property_modified` | Property definition changed |
106
+ | `property_renamed` | Property renamed |
107
+ | `index_added` | New index added |
108
+ | `index_removed` | Index deleted |
109
+ | `option_changed` | Schema option changed |
110
+
111
+ ### Viewing History
112
+
113
+ 1. Click **"History"** in the sidebar
114
+ 2. View all versions with timestamps and change counts
115
+ 3. Click the **eye icon** to view version details
116
+ 4. Click the **diff icon** to compare with previous version
117
+
118
+ ### Pending Changes
119
+
120
+ The home page shows a badge with pending changes count:
121
+
122
+ - **"No Changes"** - Current schemas match latest version
123
+ - **"X Changes"** - X changes detected, click to preview
124
+
125
+ Click the button to see detailed diff before generating migrations.
126
+
127
+ ## API Endpoints
128
+
129
+ | Endpoint | Description |
130
+ |----------|-------------|
131
+ | `GET /api/versions` | List all versions |
132
+ | `GET /api/versions/pending` | Get pending changes |
133
+ | `GET /api/versions/latest` | Get latest version |
134
+ | `GET /api/versions/:version` | Get specific version |
135
+ | `GET /api/versions/diff/:from/:to` | Compare two versions |
136
+
137
+ ## CLI Integration
138
+
139
+ When running `omnify generate`, a new version is automatically created:
140
+
141
+ ```bash
142
+ omnify generate
143
+ # → Generates migrations
144
+ # → Creates new version in .omnify/versions/
145
+ # → Updates current.lock
146
+ ```