db4ai 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 +438 -0
- package/dist/cli/bin.d.ts +50 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +418 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/dashboard/App.d.ts +16 -0
- package/dist/cli/dashboard/App.d.ts.map +1 -0
- package/dist/cli/dashboard/App.js +116 -0
- package/dist/cli/dashboard/App.js.map +1 -0
- package/dist/cli/dashboard/components/index.d.ts +70 -0
- package/dist/cli/dashboard/components/index.d.ts.map +1 -0
- package/dist/cli/dashboard/components/index.js +192 -0
- package/dist/cli/dashboard/components/index.js.map +1 -0
- package/dist/cli/dashboard/hooks/index.d.ts +76 -0
- package/dist/cli/dashboard/hooks/index.d.ts.map +1 -0
- package/dist/cli/dashboard/hooks/index.js +201 -0
- package/dist/cli/dashboard/hooks/index.js.map +1 -0
- package/dist/cli/dashboard/index.d.ts +17 -0
- package/dist/cli/dashboard/index.d.ts.map +1 -0
- package/dist/cli/dashboard/index.js +16 -0
- package/dist/cli/dashboard/index.js.map +1 -0
- package/dist/cli/dashboard/types.d.ts +84 -0
- package/dist/cli/dashboard/types.d.ts.map +1 -0
- package/dist/cli/dashboard/types.js +5 -0
- package/dist/cli/dashboard/types.js.map +1 -0
- package/dist/cli/dashboard/views/index.d.ts +51 -0
- package/dist/cli/dashboard/views/index.d.ts.map +1 -0
- package/dist/cli/dashboard/views/index.js +72 -0
- package/dist/cli/dashboard/views/index.js.map +1 -0
- package/dist/cli/index.d.ts +16 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +48 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/runtime/index.d.ts +236 -0
- package/dist/cli/runtime/index.d.ts.map +1 -0
- package/dist/cli/runtime/index.js +705 -0
- package/dist/cli/runtime/index.js.map +1 -0
- package/dist/cli/scanner/index.d.ts +90 -0
- package/dist/cli/scanner/index.d.ts.map +1 -0
- package/dist/cli/scanner/index.js +640 -0
- package/dist/cli/scanner/index.js.map +1 -0
- package/dist/cli/seed/index.d.ts +160 -0
- package/dist/cli/seed/index.d.ts.map +1 -0
- package/dist/cli/seed/index.js +774 -0
- package/dist/cli/seed/index.js.map +1 -0
- package/dist/cli/sync/index.d.ts +197 -0
- package/dist/cli/sync/index.d.ts.map +1 -0
- package/dist/cli/sync/index.js +706 -0
- package/dist/cli/sync/index.js.map +1 -0
- package/dist/cli/terminal.d.ts +60 -0
- package/dist/cli/terminal.d.ts.map +1 -0
- package/dist/cli/terminal.js +210 -0
- package/dist/cli/terminal.js.map +1 -0
- package/dist/cli/workflow/index.d.ts +152 -0
- package/dist/cli/workflow/index.d.ts.map +1 -0
- package/dist/cli/workflow/index.js +308 -0
- package/dist/cli/workflow/index.js.map +1 -0
- package/dist/errors.d.ts +43 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +47 -0
- package/dist/errors.js.map +1 -0
- package/dist/handlers.d.ts +147 -0
- package/dist/handlers.d.ts.map +1 -0
- package/dist/handlers.js +39 -0
- package/dist/handlers.js.map +1 -0
- package/dist/index.d.ts +1281 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3164 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +215 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/docs/api-reference.mdx +3 -0
- package/docs/examples.mdx +3 -0
- package/docs/getting-started.mdx +3 -0
- package/docs/index.mdx +3 -0
- package/docs/schema-dsl.mdx +3 -0
- package/package.json +121 -0
package/README.md
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
# db4ai
|
|
2
|
+
|
|
3
|
+
A declarative schema DSL for AI-powered databases. Define your data model and let AI generate structured content on-demand.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install db4ai
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { DB } from 'db4ai'
|
|
15
|
+
|
|
16
|
+
const db = DB({
|
|
17
|
+
$id: 'my-blog-app', // Required: namespace for your schema
|
|
18
|
+
Blog: {
|
|
19
|
+
title: 'Short memorable blog name',
|
|
20
|
+
description: 'Brief tagline for SEO meta tags',
|
|
21
|
+
purpose: 'Core mission and value proposition',
|
|
22
|
+
audience: 'Target reader persona',
|
|
23
|
+
style: 'Tone and writing style',
|
|
24
|
+
topics: ['List 5 PascalCase topics covered ->Topic'],
|
|
25
|
+
posts: ['<-Post'],
|
|
26
|
+
},
|
|
27
|
+
Topic: {
|
|
28
|
+
name: '1-2 word PascalCase name',
|
|
29
|
+
description: '1 sentence description',
|
|
30
|
+
titles: ['List 3 blog post titles ->Post'],
|
|
31
|
+
},
|
|
32
|
+
Post: {
|
|
33
|
+
title: 'SEO-optimized title without punctuation',
|
|
34
|
+
synopsis: '1 sentence overview',
|
|
35
|
+
content: 'Markdown content (title prepended automatically)',
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// Generate a complete blog with topics and posts
|
|
40
|
+
const blog = await db.Blog('mystartup.ai/blog', {
|
|
41
|
+
audience: 'Early stage startup founders',
|
|
42
|
+
style: 'provocative',
|
|
43
|
+
})
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Namespace Configuration
|
|
47
|
+
|
|
48
|
+
Every schema requires a namespace via `$id` or `$context`. This determines where your data is stored and enables composition of multiple schemas.
|
|
49
|
+
|
|
50
|
+
### Using `$id`
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// Simple namespace (uses https://db4ai.dev by default)
|
|
54
|
+
const db = DB({
|
|
55
|
+
$id: 'my-app',
|
|
56
|
+
User: { name: 'User name' },
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
// Full URL for custom backends
|
|
60
|
+
const db = DB({
|
|
61
|
+
$id: 'https://db.sb/my-app',
|
|
62
|
+
User: { name: 'User name' },
|
|
63
|
+
})
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Using `$context` for Composable Schemas
|
|
67
|
+
|
|
68
|
+
`$context` is ideal when you have multiple `DB()` definitions that should share a namespace:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// StartupBuilder.ts
|
|
72
|
+
export const StartupBuilder = DB({
|
|
73
|
+
$context: 'startups',
|
|
74
|
+
Startup: {
|
|
75
|
+
name: 'Startup name',
|
|
76
|
+
idea: '->Idea',
|
|
77
|
+
founders: '->Founder[]',
|
|
78
|
+
},
|
|
79
|
+
Idea: { concept: 'Business concept' },
|
|
80
|
+
Founder: { name: 'Founder name', background: 'Background' },
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
// SalesBuilder.ts
|
|
84
|
+
export const SalesBuilder = DB({
|
|
85
|
+
$context: 'startups', // Same context - shares namespace!
|
|
86
|
+
Lead: {
|
|
87
|
+
name: 'Lead name',
|
|
88
|
+
startup: '->Startup', // Can reference StartupBuilder types
|
|
89
|
+
},
|
|
90
|
+
Deal: { value: 'Deal value', lead: '->Lead' },
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
// ServiceBuilder.ts
|
|
94
|
+
export const ServiceBuilder = DB({
|
|
95
|
+
$context: 'startups', // Same context
|
|
96
|
+
Service: { name: 'Service name' },
|
|
97
|
+
Client: { name: 'Client name', services: '->Service[]' },
|
|
98
|
+
})
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
All three schemas share the `startups` namespace at `https://db4ai.dev/startups`, allowing cross-references between types.
|
|
102
|
+
|
|
103
|
+
### Result Properties
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
const db = DB({ $context: 'my-app', User: { name: '' } })
|
|
107
|
+
|
|
108
|
+
db.namespace // 'my-app' - the resolved namespace
|
|
109
|
+
db.baseUrl // 'https://db4ai.dev' - API base URL
|
|
110
|
+
db.context // 'my-app' - from $context (if used)
|
|
111
|
+
db.id // undefined - from $id (if used)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Schema DSL
|
|
115
|
+
|
|
116
|
+
### Field Descriptions
|
|
117
|
+
|
|
118
|
+
Every field value is a generation prompt. Empty strings infer the prompt from context:
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
DB({
|
|
122
|
+
Product: {
|
|
123
|
+
name: '', // Infer from context
|
|
124
|
+
tagline: '< 10 words', // Short constraint
|
|
125
|
+
description: 'Detailed product description for landing page',
|
|
126
|
+
},
|
|
127
|
+
})
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### References (`->`)
|
|
131
|
+
|
|
132
|
+
Link to other types. Referenced objects are generated recursively:
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
DB({
|
|
136
|
+
Post: {
|
|
137
|
+
author: '->User', // Single reference
|
|
138
|
+
tags: '->Tag[]', // Array of references
|
|
139
|
+
reviewer: '->User?', // Optional reference
|
|
140
|
+
},
|
|
141
|
+
})
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Fuzzy References (`~>`)
|
|
145
|
+
|
|
146
|
+
Match existing objects by semantic similarity, generate if no match:
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
DB({
|
|
150
|
+
Article: {
|
|
151
|
+
industry: '~>Industry', // Match to taxonomy
|
|
152
|
+
topic: '~>Category?', // Optional fuzzy match
|
|
153
|
+
},
|
|
154
|
+
})
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Inline References (`['... ->Type']`)
|
|
158
|
+
|
|
159
|
+
Generate array items that are also references:
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
DB({
|
|
163
|
+
Blog: {
|
|
164
|
+
// Generate 5 topic names AND create Topic objects for each
|
|
165
|
+
topics: ['List 5 PascalCase topics ->Topic'],
|
|
166
|
+
},
|
|
167
|
+
Topic: {
|
|
168
|
+
name: '1-2 word PascalCase name',
|
|
169
|
+
},
|
|
170
|
+
})
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Back References (`['<-Type']`)
|
|
174
|
+
|
|
175
|
+
Collect objects that reference this one:
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
DB({
|
|
179
|
+
Blog: {
|
|
180
|
+
posts: ['<-Post'], // All Posts referencing this Blog
|
|
181
|
+
},
|
|
182
|
+
Post: {
|
|
183
|
+
blog: '->Blog', // Post belongs to Blog
|
|
184
|
+
title: 'Post title',
|
|
185
|
+
},
|
|
186
|
+
})
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Union Types (`|`)
|
|
190
|
+
|
|
191
|
+
Reference multiple possible types:
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
DB({
|
|
195
|
+
Comment: {
|
|
196
|
+
target: '->Post|Product', // Reference Post OR Product
|
|
197
|
+
},
|
|
198
|
+
})
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Arrays
|
|
202
|
+
|
|
203
|
+
String arrays with generation prompts:
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
DB({
|
|
207
|
+
Post: {
|
|
208
|
+
tags: ['List 3-5 relevant tags'],
|
|
209
|
+
keyPoints: ['Main takeaways from the content'],
|
|
210
|
+
},
|
|
211
|
+
})
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Nested Objects
|
|
215
|
+
|
|
216
|
+
Inline object structures:
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
DB({
|
|
220
|
+
User: {
|
|
221
|
+
profile: {
|
|
222
|
+
bio: 'Short biography',
|
|
223
|
+
links: ['Social media URLs'],
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
})
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Optional Fields (`?`)
|
|
230
|
+
|
|
231
|
+
Fields not required in output:
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
DB({
|
|
235
|
+
User: {
|
|
236
|
+
name: 'Full name',
|
|
237
|
+
nickname: '?', // Optional, infer if provided
|
|
238
|
+
avatar: '->Image?', // Optional reference
|
|
239
|
+
},
|
|
240
|
+
})
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## API
|
|
244
|
+
|
|
245
|
+
### `DB(schema)`
|
|
246
|
+
|
|
247
|
+
Create a schema and get typed accessors:
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
const db = DB({
|
|
251
|
+
User: { name: '', email: '' },
|
|
252
|
+
Post: { title: '', author: '->User' },
|
|
253
|
+
})
|
|
254
|
+
|
|
255
|
+
db.schema // Original definition
|
|
256
|
+
db.types // Parsed type metadata
|
|
257
|
+
db.hash // Deterministic schema hash
|
|
258
|
+
db.toJSONSchema('User') // JSON Schema for validation
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### `db.Type(id, args?)`
|
|
262
|
+
|
|
263
|
+
Generate or retrieve an object:
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
// Generate with context
|
|
267
|
+
const blog = await db.Blog('my-blog', {
|
|
268
|
+
audience: 'developers',
|
|
269
|
+
style: 'technical',
|
|
270
|
+
})
|
|
271
|
+
|
|
272
|
+
// Retrieve cached (same args = same result)
|
|
273
|
+
const sameBlog = await db.Blog('my-blog', {
|
|
274
|
+
audience: 'developers',
|
|
275
|
+
style: 'technical',
|
|
276
|
+
})
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Low-level Functions
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
import { parseSchema, parseFieldType, toJSONSchema } from 'db4ai'
|
|
283
|
+
|
|
284
|
+
// Parse entire schema
|
|
285
|
+
const { types, hash } = parseSchema({ User: { name: '' } })
|
|
286
|
+
|
|
287
|
+
// Parse single field
|
|
288
|
+
parseFieldType('->User[]')
|
|
289
|
+
// { type: 'reference', ref: 'User', isArray: true }
|
|
290
|
+
|
|
291
|
+
parseFieldType(['List 3 items ->Tag'])
|
|
292
|
+
// { type: 'array', items: { type: 'string' }, description: '...', refs: ['Tag'] }
|
|
293
|
+
|
|
294
|
+
// Generate JSON Schema
|
|
295
|
+
const jsonSchema = toJSONSchema(types.User)
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Field Reference
|
|
299
|
+
|
|
300
|
+
| Pattern | Description | Example |
|
|
301
|
+
|---------|-------------|---------|
|
|
302
|
+
| `''` | Infer from context | `name: ''` |
|
|
303
|
+
| `'prompt'` | Generate with prompt | `bio: 'Short bio'` |
|
|
304
|
+
| `'->Type'` | Reference | `author: '->User'` |
|
|
305
|
+
| `'~>Type'` | Fuzzy reference | `category: '~>Topic'` |
|
|
306
|
+
| `'->Type[]'` | Reference array | `tags: '->Tag[]'` |
|
|
307
|
+
| `'->Type?'` | Optional reference | `image: '->Image?'` |
|
|
308
|
+
| `'->A\|B'` | Union reference | `owner: '->User\|Org'` |
|
|
309
|
+
| `['prompt']` | String array | `tags: ['Keywords']` |
|
|
310
|
+
| `['... ->Type']` | Inline refs | `items: ['List 3 ->Item']` |
|
|
311
|
+
| `['<-Type']` | Back refs | `posts: ['<-Post']` |
|
|
312
|
+
| `{ k: 'v' }` | Nested object | `meta: { title: '' }` |
|
|
313
|
+
| `'?'` | Optional infer | `nickname: '?'` |
|
|
314
|
+
|
|
315
|
+
## CLI
|
|
316
|
+
|
|
317
|
+
The db4ai package includes a command-line interface for local development and data management.
|
|
318
|
+
|
|
319
|
+
### Installation
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
npm install -g db4ai
|
|
323
|
+
# or use with npx
|
|
324
|
+
npx db4ai
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### Available Commands
|
|
328
|
+
|
|
329
|
+
#### scan
|
|
330
|
+
Scan your project for schema definitions, seed files, and workflows.
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
db4ai scan
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Options:
|
|
337
|
+
- `--root <path>` - Root directory to scan
|
|
338
|
+
- `--include <glob>` - Glob pattern for files to include
|
|
339
|
+
- `--exclude <glob>` - Glob pattern for files to exclude
|
|
340
|
+
- `--json` - Output as JSON
|
|
341
|
+
|
|
342
|
+
Discovers:
|
|
343
|
+
- Schema files (`.schema.ts`, `.db.ts`)
|
|
344
|
+
- Seed files (`.seed.ts`, `.seed.mdx`)
|
|
345
|
+
- Workflow files (`.workflow.ts`)
|
|
346
|
+
- Project configuration (`db4.config.ts`)
|
|
347
|
+
|
|
348
|
+
#### seed
|
|
349
|
+
Execute static and generated seed operations with progress tracking.
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
db4ai seed <seed-name>
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Supports:
|
|
356
|
+
- **Static seeds**: Load data from inline JSON or external APIs
|
|
357
|
+
- **Generated seeds**: Use LLM to generate test data
|
|
358
|
+
- Cascading entity generation
|
|
359
|
+
- Resume tokens for interrupted operations
|
|
360
|
+
- Concurrency control and field mapping
|
|
361
|
+
|
|
362
|
+
#### workflow
|
|
363
|
+
Execute event-triggered and manual workflows with integration support.
|
|
364
|
+
|
|
365
|
+
```bash
|
|
366
|
+
db4ai workflow <workflow-name>
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
Features:
|
|
370
|
+
- Event-triggered and scheduled workflows
|
|
371
|
+
- Concurrency control and retry logic
|
|
372
|
+
- Database context and relationship management
|
|
373
|
+
- Logging and error handling
|
|
374
|
+
|
|
375
|
+
#### sync
|
|
376
|
+
Synchronize data between local runtime and cloud backend.
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
db4ai sync
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
Enables:
|
|
383
|
+
- Bidirectional data sync
|
|
384
|
+
- Conflict resolution
|
|
385
|
+
- Transaction support
|
|
386
|
+
|
|
387
|
+
#### dashboard
|
|
388
|
+
Interactive terminal UI for monitoring seeds, workflows, and data generation.
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
db4ai dashboard
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Displays:
|
|
395
|
+
- Real-time progress tracking
|
|
396
|
+
- Type and entity statistics
|
|
397
|
+
- Activity feed and event logs
|
|
398
|
+
- Cascade tree visualization
|
|
399
|
+
- Search and filtering
|
|
400
|
+
|
|
401
|
+
### Project Configuration
|
|
402
|
+
|
|
403
|
+
Create a `db4.config.ts` file in your project root to configure defaults:
|
|
404
|
+
|
|
405
|
+
```typescript
|
|
406
|
+
export default {
|
|
407
|
+
namespace: 'my-app',
|
|
408
|
+
ai: {
|
|
409
|
+
model: 'claude-3-5-sonnet-20241022',
|
|
410
|
+
temperature: 0.7,
|
|
411
|
+
maxTokens: 4096,
|
|
412
|
+
},
|
|
413
|
+
scan: {
|
|
414
|
+
include: ['src/**/*.ts'],
|
|
415
|
+
exclude: ['**/*.test.ts'],
|
|
416
|
+
},
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
## TypeScript
|
|
421
|
+
|
|
422
|
+
```typescript
|
|
423
|
+
import type {
|
|
424
|
+
SchemaDefinition,
|
|
425
|
+
ParsedSchema,
|
|
426
|
+
ParsedType,
|
|
427
|
+
ParsedField,
|
|
428
|
+
StringField,
|
|
429
|
+
ReferenceField,
|
|
430
|
+
ArrayField,
|
|
431
|
+
ObjectField,
|
|
432
|
+
JSONSchema,
|
|
433
|
+
} from 'db4ai'
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
## License
|
|
437
|
+
|
|
438
|
+
MIT
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* db4ai CLI - Command Line Interface
|
|
4
|
+
*
|
|
5
|
+
* Entry point for the db4ai CLI tool.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CLI_VERSION = "0.1.0";
|
|
8
|
+
/** Available CLI commands */
|
|
9
|
+
export type Command = 'scan' | 'seed' | 'workflow' | 'sync' | 'dashboard';
|
|
10
|
+
/** Parsed CLI arguments */
|
|
11
|
+
export interface ParsedArgs {
|
|
12
|
+
version: boolean;
|
|
13
|
+
help: boolean;
|
|
14
|
+
command?: Command;
|
|
15
|
+
subcommand?: string;
|
|
16
|
+
args: string[];
|
|
17
|
+
config?: string;
|
|
18
|
+
verbose: boolean;
|
|
19
|
+
quiet: boolean;
|
|
20
|
+
noColor: boolean;
|
|
21
|
+
json: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** Output streams for CLI (allows injection for testing) */
|
|
24
|
+
export interface OutputStreams {
|
|
25
|
+
stdout: {
|
|
26
|
+
write: (s: string) => void;
|
|
27
|
+
};
|
|
28
|
+
stderr: {
|
|
29
|
+
write: (s: string) => void;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parse CLI arguments into a structured format
|
|
34
|
+
* @param args - Raw command line arguments (process.argv.slice(2))
|
|
35
|
+
* @returns Parsed arguments with flags, command, and remaining args
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseArgs(args: string[]): ParsedArgs;
|
|
38
|
+
export declare function handleScan(args: string[], streams: OutputStreams): Promise<number>;
|
|
39
|
+
export declare function handleSeed(args: string[], streams: OutputStreams): Promise<number>;
|
|
40
|
+
export declare function handleWorkflow(args: string[], streams: OutputStreams): Promise<number>;
|
|
41
|
+
export declare function handleSync(args: string[], subcommand: string | undefined, streams: OutputStreams): Promise<number>;
|
|
42
|
+
export declare function handleDashboard(args: string[], streams: OutputStreams): Promise<number>;
|
|
43
|
+
/**
|
|
44
|
+
* Main CLI entry point
|
|
45
|
+
* @param args - Command line arguments
|
|
46
|
+
* @param options - Optional output streams for testing
|
|
47
|
+
* @returns Exit code (0 = success, 1 = error, 2 = invalid args)
|
|
48
|
+
*/
|
|
49
|
+
export declare function run(args: string[], options?: Partial<OutputStreams>): Promise<number>;
|
|
50
|
+
//# sourceMappingURL=bin.d.ts.map
|
|
@@ -0,0 +1 @@
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