ozmoz 0.1.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 +230 -0
- package/dist/cli.cjs +475 -0
- package/dist/index.js +319 -0
- package/dist/ozmoz-mcp.js +197 -0
- package/dist/ozmoz.iife.js +319 -0
- package/index.d.ts +131 -0
- package/package.json +39 -0
- package/scripts/setup-lib.cjs +748 -0
package/README.md
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# ozmoZ
|
|
2
|
+
|
|
3
|
+
### The Client-Side Data OS for Modern Web Apps & AI Vibe-Coding
|
|
4
|
+
|
|
5
|
+
ozmoZ manages the complete application data lifecycle: from AI-assisted schema modeling (Alex AI DBA) to deterministic Edge enforcement and seamless client-side execution.
|
|
6
|
+
|
|
7
|
+
Like an architect drafting blueprints before construction begins, Alex AI models your business domain and spins up an instant, production-ready backend. ozmoZ delivers relational integrity, strict typing, and Edge security to MongoDB Atlas without writing backend boilerplate.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<!-- STREAMING_CHUNK:Documenting core value propositions... -->
|
|
12
|
+
|
|
13
|
+
## Why ozmoZ?
|
|
14
|
+
|
|
15
|
+
- **100% Frontend Focus**: Zero servers, zero custom REST APIs, and zero SQL migrations. Build full-stack applications purely from the client.
|
|
16
|
+
- **AI Agent Accelerator**: Eliminates hallucinations and cuts token usage by 90% via deterministic contracts (`svro.schema.json`, `svro.workflow.json`). Agents (Claude Code, Cursor, Windsurf) focus 100% of their reasoning on UX.
|
|
17
|
+
- **Deterministic Edge Gatekeeper**: Sub-millisecond $O(1)$ schema validation at the cloud edge before writes hit the database.
|
|
18
|
+
- **Zero-Crash Native Web Components**: 7 built-in, framework-agnostic Custom Elements (`<oz-*>`) preventing white-screen crashes on missing or partial data.
|
|
19
|
+
- **Zero-Rewrite Philosophy**: Write the exact same frontend code in trial mode (`OZ_PROTOTYPE=true`) and production (`OZ_PROTOTYPE=false`).
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<!-- STREAMING_CHUNK:Documenting installation and setup commands... -->
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
### 1. New Project with an AI Agent
|
|
28
|
+
|
|
29
|
+
Let your terminal AI agent build the project for you:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx ozmoz start claude "Your application idea"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or configure your environment and MCP server:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx ozmoz login # Authenticate once in your browser
|
|
39
|
+
npx ozmoz mcp # Generates AGENTS.md, CLAUDE.md, GEMINI.md and MCP settings
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2. Integration into an Existing Frontend
|
|
43
|
+
|
|
44
|
+
Install the package in your Vite project:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install ozmoz
|
|
48
|
+
npx ozmoz init --keyApp=<APP_KEY> --token=<BOOTSTRAP_TOKEN>
|
|
49
|
+
npx ozmoz sync
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
<!-- STREAMING_CHUNK:Documenting execution modes and environment configuration... -->
|
|
55
|
+
|
|
56
|
+
## Execution Modes (`.env`)
|
|
57
|
+
|
|
58
|
+
Configure your operational mode in `.env`:
|
|
59
|
+
|
|
60
|
+
```env
|
|
61
|
+
# Trial / Sandbox mode: all operations are simulated locally with demo data (oz.seed).
|
|
62
|
+
# Test code for authentication is always: 0000
|
|
63
|
+
OZ_PROTOTYPE=true
|
|
64
|
+
|
|
65
|
+
# Live mode: enforced physical schema, Edge security, and real database persistence.
|
|
66
|
+
OZ_PROTOTYPE=false
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
<!-- STREAMING_CHUNK:Documenting CRUD operations and strict governance rules... -->
|
|
72
|
+
|
|
73
|
+
## SDK Usage & Strict Governance
|
|
74
|
+
|
|
75
|
+
Every write operation requires literal governance metadata `{ desc, role, guard }` to ensure contract validation.
|
|
76
|
+
|
|
77
|
+
### Writing Data
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
// 1. Insert a document with mandatory governance
|
|
81
|
+
const res = await oz.add('orders', {
|
|
82
|
+
product: 'Desk Pro',
|
|
83
|
+
price: 299
|
|
84
|
+
}, {
|
|
85
|
+
desc: 'Create customer order',
|
|
86
|
+
role: 'AUTHENTICATED',
|
|
87
|
+
guard: 'price > 0'
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
if (!res.success) {
|
|
91
|
+
console.error('Order creation failed:', res.error);
|
|
92
|
+
} else {
|
|
93
|
+
console.log('Created document ID:', res.documentId);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// 2. Update a document
|
|
97
|
+
const updateRes = await oz.update('orders', doc._id, {
|
|
98
|
+
price: 249
|
|
99
|
+
}, {
|
|
100
|
+
desc: 'Apply discount on order',
|
|
101
|
+
role: 'MANAGER'
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// 3. Delete a document
|
|
105
|
+
const delRes = await oz.delete('orders', doc._id, {
|
|
106
|
+
desc: 'Cancel and delete order',
|
|
107
|
+
role: 'ADMIN'
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
<!-- STREAMING_CHUNK:Documenting read operations and authentication... -->
|
|
112
|
+
|
|
113
|
+
### Reading Data
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
// Read all global documents in a collection
|
|
117
|
+
const orders = await oz.getDocsG('orders');
|
|
118
|
+
|
|
119
|
+
// Read documents owned by the authenticated user
|
|
120
|
+
const userOrders = await oz.getDocsU('orders');
|
|
121
|
+
|
|
122
|
+
// Read a single document by its _id
|
|
123
|
+
const order = await oz.getDoc('orders', 'order_123');
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Authentication (Passwordless OTP)
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
// Step 1: Send OTP code (In trial mode, code is always 0000)
|
|
130
|
+
const otpRes = await oz.sendotpsvro('user@example.com');
|
|
131
|
+
|
|
132
|
+
// Step 2: Verify OTP code and establish session
|
|
133
|
+
const authRes = await oz.verifyotpsvro('user@example.com', '0000');
|
|
134
|
+
if (authRes.success) {
|
|
135
|
+
console.log('Logged in user:', authRes.user);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Check session status
|
|
139
|
+
const loggedIn = await oz.isAuthenticated();
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
<!-- STREAMING_CHUNK:Documenting defensive UI web components... -->
|
|
145
|
+
|
|
146
|
+
## Zero-Crash UI Components
|
|
147
|
+
|
|
148
|
+
Render data safely without risk of runtime null-pointer exceptions:
|
|
149
|
+
|
|
150
|
+
```html
|
|
151
|
+
<!-- Text with fallback -->
|
|
152
|
+
<oz-text value={item.name} fallback="No name" />
|
|
153
|
+
|
|
154
|
+
<!-- Currency formatting with strict fallback -->
|
|
155
|
+
<oz-number value={item.price} currency="EUR" invalid-fallback="0" />
|
|
156
|
+
|
|
157
|
+
<!-- Boolean toggle representation -->
|
|
158
|
+
<oz-toggle value={item.isActive} label-true="Active" label-false="Inactive" />
|
|
159
|
+
|
|
160
|
+
<!-- Formatted date display -->
|
|
161
|
+
<oz-date value={item.createdAt} locale="en-US" invalid-fallback="Invalid date" />
|
|
162
|
+
|
|
163
|
+
<!-- Enum status validator -->
|
|
164
|
+
<oz-enum value={item.status} allowed="PENDING,CONFIRMED,DELIVERED" invalid-fallback="Unknown status" />
|
|
165
|
+
|
|
166
|
+
<!-- Relational reference resolution -->
|
|
167
|
+
<oz-reference table="users" id={item.userId} field="fullName" orphan-fallback="Deleted user" />
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## CLI Reference
|
|
173
|
+
|
|
174
|
+
| Command | Description |
|
|
175
|
+
| :--- | :--- |
|
|
176
|
+
| `npx ozmoz login` | Authenticate your workstation via browser OAuth. |
|
|
177
|
+
| `npx ozmoz mcp` | Configure AI agent directives and register MCP tools. |
|
|
178
|
+
| `npx ozmoz init` | Initialize local `.env` and bootstrap configurations. |
|
|
179
|
+
| `npx ozmoz sync` | Seal contract on Cloud Edge and compile TypeScript definitions. |
|
|
180
|
+
| `npx ozmoz sync --check-only` | Offline contract and type validation (no network requests). |
|
|
181
|
+
```
|
|
182
|
+
eof
|
|
183
|
+
|
|
184
|
+
### Résumé des éléments générés
|
|
185
|
+
|
|
186
|
+
1. **`checklist_deploiement.md`** : Fournit le diagnostic complet, les points de vigilance sur les bundles et Cloud Functions, ainsi que les 3 commandes de smoke test à exécuter avant le déploiement.
|
|
187
|
+
2. **`README.md`** : Totalement unifié sous la marque **ozmoZ**, avec des exemples d'écriture conformes aux règles d'intégrité (gouvernance `{ desc, role }` et vérification de `res.success`).
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
# ozmoz
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
npx ozmoz
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
ozmoZ is the SDK and CLI behind the `oz.*` API and the `<oz-*>` tags.
|
|
197
|
+
|
|
198
|
+
## Quick start
|
|
199
|
+
|
|
200
|
+
Let an AI agent build for you (Claude Code, Gemini CLI, Codex CLI):
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
npx ozmoz start claude "your app idea"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Or connect your agent once, then work as usual:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
npx ozmoz login # approve once in the browser
|
|
210
|
+
npx ozmoz mcp # writes AGENTS.md / CLAUDE.md / GEMINI.md and configures the MCP server
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## In an existing project
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
npm install ozmoz
|
|
217
|
+
npx ozmoz init --keyApp=<KEY> --token=<TOKEN>
|
|
218
|
+
npx ozmoz sync # seals the schema and generates the contract + IDE types
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Use `npx ozmoz sync --check-only` for an offline check.
|
|
222
|
+
|
|
223
|
+
## Modes
|
|
224
|
+
|
|
225
|
+
Set in `.env`:
|
|
226
|
+
|
|
227
|
+
- `OZ_PROTOTYPE=true`: trial mode, everything is simulated locally (no backend call).
|
|
228
|
+
- `OZ_PROTOTYPE=false`: live mode, the data contract is enforced.
|
|
229
|
+
|
|
230
|
+
Run `npx ozmoz --help` for all commands.
|