@agility-luhn/cli 1.8.0 → 1.10.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/CHANGELOG.md +4 -0
- package/README.md +561 -0
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +134 -85
- package/dist/commands/list.js.map +1 -1
- package/dist/index.js +35 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## [1.10.0](https://github.com/flaviorafaelo-agility/luhn-workspace/compare/cli-v1.9.0...cli-v1.10.0) (2026-07-08)
|
|
2
|
+
|
|
3
|
+
## [1.9.0](https://github.com/flaviorafaelo-agility/luhn-workspace/compare/cli-v1.8.0...cli-v1.9.0) (2026-07-08)
|
|
4
|
+
|
|
1
5
|
## [1.8.0](https://github.com/flaviorafaelo-agility/luhn-workspace/compare/cli-v1.7.0...cli-v1.8.0) (2026-07-08)
|
|
2
6
|
|
|
3
7
|
## [1.7.0](https://github.com/flaviorafaelo-agility/luhn-workspace/compare/cli-v1.6.0...cli-v1.7.0) (2026-07-08)
|
package/README.md
ADDED
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
# LUHN CLI
|
|
2
|
+
|
|
3
|
+
Official Command-Line Interface for the LUHN Framework - A modern, developer-friendly framework for building scalable applications with type-safe database operations, OData filtering, and automatic code generation.
|
|
4
|
+
|
|
5
|
+
[](https://badge.fury.io/js/%40agility-luhn%2Fcli)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
✨ **Project Initialization** - Bootstrap a new LUHN project with interactive setup
|
|
11
|
+
🏗️ **Compilation** - Transform DSL files into TypeScript, database schemas, and API definitions
|
|
12
|
+
📦 **Module Discovery** - List all modules, entities, and their attributes
|
|
13
|
+
🗄️ **Database Management** - Migrate, sync, and introspect databases
|
|
14
|
+
🚀 **Runtime Server** - Start your application server with hot-reload support
|
|
15
|
+
📝 **Type Safety** - Full TypeScript support with auto-generated types
|
|
16
|
+
🔌 **OData Filtering** - Built-in OData v4 query support
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
Install LUHN CLI globally:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -g @agility-luhn/cli
|
|
24
|
+
# or
|
|
25
|
+
pnpm add -g @agility-luhn/cli
|
|
26
|
+
# or
|
|
27
|
+
yarn global add @agility-luhn/cli
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or use it directly with `npx`:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx @agility-luhn/cli --version
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
### 1. Create a New Project
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
luhn init
|
|
42
|
+
# or
|
|
43
|
+
luhn create
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This will guide you through an interactive setup:
|
|
47
|
+
- Project name
|
|
48
|
+
- Description
|
|
49
|
+
- Package manager selection
|
|
50
|
+
- Initial template selection
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
$ luhn init
|
|
54
|
+
|
|
55
|
+
_ _ _ _ _ _
|
|
56
|
+
| | | | | | | | | | | |
|
|
57
|
+
| | _ _ ___| |_| | | |_| | | |
|
|
58
|
+
| | | | | |/ _ \ _ | | _ | | |
|
|
59
|
+
| |____| |_| | __/| | | | | | | | |_|
|
|
60
|
+
|_____|___/|_|___|_| |_| |_| |_| |_|_|
|
|
61
|
+
|
|
62
|
+
? Project name: my-app
|
|
63
|
+
? Description: My awesome LUHN application
|
|
64
|
+
? Use TypeScript: Yes
|
|
65
|
+
? Install dependencies: Yes
|
|
66
|
+
|
|
67
|
+
✅ Project created successfully!
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. Define Your Business Logic
|
|
71
|
+
|
|
72
|
+
Create `.luhn` files in the `luhn/` directory:
|
|
73
|
+
|
|
74
|
+
```luhn
|
|
75
|
+
# luhn/user/user.luhn
|
|
76
|
+
business "User" "User Management" {
|
|
77
|
+
id: uuid
|
|
78
|
+
name: string
|
|
79
|
+
email: string
|
|
80
|
+
createdAt: timestamp?
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
entity "UserProfile" "Extended user information" {
|
|
84
|
+
userId: uuid
|
|
85
|
+
bio: string
|
|
86
|
+
avatar: string?
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 3. Compile Your Project
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
luhn compile
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
This generates:
|
|
97
|
+
- TypeScript types and interfaces
|
|
98
|
+
- Database migration files
|
|
99
|
+
- OpenAPI/Swagger definitions
|
|
100
|
+
- SQL schemas
|
|
101
|
+
- Runtime handlers
|
|
102
|
+
|
|
103
|
+
### 4. Manage Your Database
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Create or update database
|
|
107
|
+
luhn db migrate
|
|
108
|
+
|
|
109
|
+
# Sync with current schema
|
|
110
|
+
luhn db sync
|
|
111
|
+
|
|
112
|
+
# Introspect existing database
|
|
113
|
+
luhn db introspect
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 5. Start Development Server
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
luhn serve
|
|
120
|
+
# or with watch mode
|
|
121
|
+
luhn serve --watch
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Server runs on `http://localhost:3000` by default.
|
|
125
|
+
|
|
126
|
+
## Commands
|
|
127
|
+
|
|
128
|
+
### `luhn init` / `luhn create`
|
|
129
|
+
|
|
130
|
+
Initialize a new LUHN project with templates and dependencies.
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
luhn init [targetDir]
|
|
134
|
+
luhn create my-project # Create in specific directory
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Options:**
|
|
138
|
+
- `--template <name>` - Use specific template (default, minimal, advanced)
|
|
139
|
+
- `--no-install` - Skip dependency installation
|
|
140
|
+
- `--force` - Overwrite existing directory
|
|
141
|
+
|
|
142
|
+
### `luhn compile`
|
|
143
|
+
|
|
144
|
+
Compile LUHN DSL files to artifacts.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
luhn compile [sourceDir]
|
|
148
|
+
luhn compile ./luhn # Compile from specific directory
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Options:**
|
|
152
|
+
- `--output <dir>` - Output directory (default: `./src/generated`)
|
|
153
|
+
- `--watch` - Watch for changes and recompile
|
|
154
|
+
- `--strict` - Strict validation mode
|
|
155
|
+
|
|
156
|
+
**Generates:**
|
|
157
|
+
- TypeScript interfaces and types
|
|
158
|
+
- Database schemas
|
|
159
|
+
- API routes
|
|
160
|
+
- OpenAPI definitions
|
|
161
|
+
|
|
162
|
+
### `luhn list` / `luhn ls`
|
|
163
|
+
|
|
164
|
+
Discover and list all modules, entities, and their attributes.
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
luhn list
|
|
168
|
+
luhn ls --full # Show all attributes
|
|
169
|
+
luhn list -m auth # Filter by module
|
|
170
|
+
luhn list -e User # Filter by entity
|
|
171
|
+
luhn list --json # JSON output
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Options:**
|
|
175
|
+
- `-m, --module <name>` - Filter by module name
|
|
176
|
+
- `-e, --entity <name>` - Filter by entity/class name
|
|
177
|
+
- `-f, --full` - Show complete attribute details
|
|
178
|
+
- `--json` - Output as JSON (useful for automation)
|
|
179
|
+
|
|
180
|
+
**Examples:**
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# List all modules in project
|
|
184
|
+
$ luhn list
|
|
185
|
+
|
|
186
|
+
_ _ _ _ _ _
|
|
187
|
+
| | | | | | | | | | | |
|
|
188
|
+
| | _ _ ___| |_| | | |_| | | |
|
|
189
|
+
| | | | | |/ _ \ _ | | _ | | |
|
|
190
|
+
| |____| |_| | __/| | | | | | | | |_|
|
|
191
|
+
|_____|___/|_|___|_| |_| |_| |_| |_|_|
|
|
192
|
+
|
|
193
|
+
LUHN CLI: 1.9.0
|
|
194
|
+
Node: v22.14.0
|
|
195
|
+
Package Manager: pnpm 10.20.0
|
|
196
|
+
OS: win32 x64
|
|
197
|
+
|
|
198
|
+
📦 LUHN Project Structure
|
|
199
|
+
|
|
200
|
+
📂 Module: user
|
|
201
|
+
🎯 BUSINESS: User ("User Management")
|
|
202
|
+
└─ 5 attribute(s)
|
|
203
|
+
|
|
204
|
+
📂 Module: auth
|
|
205
|
+
🎯 BUSINESS: Session ("Session Management")
|
|
206
|
+
└─ 3 attribute(s)
|
|
207
|
+
|
|
208
|
+
✅ Summary:
|
|
209
|
+
Modules: 2
|
|
210
|
+
Entities: 2
|
|
211
|
+
Attributes: 8
|
|
212
|
+
|
|
213
|
+
💡 Tip: Use --full flag to see all attributes
|
|
214
|
+
|
|
215
|
+
# Show full details
|
|
216
|
+
$ luhn list --full
|
|
217
|
+
|
|
218
|
+
📂 Module: user
|
|
219
|
+
🎯 BUSINESS: User ("User Management")
|
|
220
|
+
✓ id: uuid
|
|
221
|
+
✓ name: string
|
|
222
|
+
✓ email: string
|
|
223
|
+
○ avatar: string
|
|
224
|
+
✓ createdAt: timestamp
|
|
225
|
+
|
|
226
|
+
# Filter by module
|
|
227
|
+
$ luhn list -m auth
|
|
228
|
+
|
|
229
|
+
# JSON output for scripting
|
|
230
|
+
$ luhn list --json
|
|
231
|
+
[
|
|
232
|
+
{
|
|
233
|
+
"module": "user",
|
|
234
|
+
"entities": [
|
|
235
|
+
{
|
|
236
|
+
"name": "User",
|
|
237
|
+
"type": "business",
|
|
238
|
+
"title": "User Management",
|
|
239
|
+
"attributeCount": 5
|
|
240
|
+
}
|
|
241
|
+
]
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### `luhn db`
|
|
247
|
+
|
|
248
|
+
Database management commands.
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
luhn db migrate # Apply pending migrations
|
|
252
|
+
luhn db sync # Sync schema with database
|
|
253
|
+
luhn db introspect # Inspect existing database
|
|
254
|
+
luhn db create # Create database
|
|
255
|
+
luhn db reset # Reset database (development only)
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Options:**
|
|
259
|
+
- `--connection <string>` - Database connection string
|
|
260
|
+
- `--force` - Force operation without confirmation
|
|
261
|
+
- `--dry-run` - Show what would be done
|
|
262
|
+
|
|
263
|
+
### `luhn serve`
|
|
264
|
+
|
|
265
|
+
Start the development server.
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
luhn serve [options]
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**Options:**
|
|
272
|
+
- `-p, --port <number>` - Server port (default: 3000)
|
|
273
|
+
- `-w, --watch` - Watch for file changes
|
|
274
|
+
- `--debug` - Run with debug logging
|
|
275
|
+
- `--no-reload` - Disable hot-reload
|
|
276
|
+
|
|
277
|
+
## Project Structure
|
|
278
|
+
|
|
279
|
+
A typical LUHN project structure:
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
my-project/
|
|
283
|
+
├── luhn/ # DSL definitions
|
|
284
|
+
│ ├── user/
|
|
285
|
+
│ │ ├── user.luhn
|
|
286
|
+
│ │ └── profile.luhn
|
|
287
|
+
│ └── auth/
|
|
288
|
+
│ └── session.luhn
|
|
289
|
+
├── src/
|
|
290
|
+
│ ├── generated/ # Auto-generated files
|
|
291
|
+
│ │ ├── types/
|
|
292
|
+
│ │ ├── schema/
|
|
293
|
+
│ │ └── routes/
|
|
294
|
+
│ ├── handlers/ # Business logic
|
|
295
|
+
│ ├── middleware/ # Express/Fastify middleware
|
|
296
|
+
│ └── server.ts # Main server entry
|
|
297
|
+
├── db/ # Database files
|
|
298
|
+
│ ├── migrations/
|
|
299
|
+
│ └── seeds/
|
|
300
|
+
├── .env # Environment variables
|
|
301
|
+
├── package.json
|
|
302
|
+
├── tsconfig.json
|
|
303
|
+
└── README.md
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Configuration
|
|
307
|
+
|
|
308
|
+
### `.luhnrc.json` (Optional)
|
|
309
|
+
|
|
310
|
+
Configure LUHN behavior:
|
|
311
|
+
|
|
312
|
+
```json
|
|
313
|
+
{
|
|
314
|
+
"compiler": {
|
|
315
|
+
"outputDir": "src/generated",
|
|
316
|
+
"strict": true,
|
|
317
|
+
"generateOpenAPI": true
|
|
318
|
+
},
|
|
319
|
+
"database": {
|
|
320
|
+
"engine": "postgres",
|
|
321
|
+
"migrations": "db/migrations"
|
|
322
|
+
},
|
|
323
|
+
"server": {
|
|
324
|
+
"port": 3000,
|
|
325
|
+
"host": "localhost"
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Environment Variables
|
|
331
|
+
|
|
332
|
+
Create a `.env` file:
|
|
333
|
+
|
|
334
|
+
```env
|
|
335
|
+
# Database
|
|
336
|
+
DB_CONNECTION=postgresql://user:password@localhost:5432/myapp
|
|
337
|
+
|
|
338
|
+
# Server
|
|
339
|
+
PORT=3000
|
|
340
|
+
NODE_ENV=development
|
|
341
|
+
|
|
342
|
+
# Optional
|
|
343
|
+
DEBUG=luhn:*
|
|
344
|
+
LOG_LEVEL=info
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## DSL Syntax
|
|
348
|
+
|
|
349
|
+
### Business Entity
|
|
350
|
+
|
|
351
|
+
```luhn
|
|
352
|
+
business "EntityName" "Description" {
|
|
353
|
+
fieldName: dataType
|
|
354
|
+
optionalField: dataType?
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### Database Entity
|
|
359
|
+
|
|
360
|
+
```luhn
|
|
361
|
+
entity "EntityName" "Description" {
|
|
362
|
+
fieldName: dataType
|
|
363
|
+
}
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Service (API Handlers)
|
|
367
|
+
|
|
368
|
+
```luhn
|
|
369
|
+
service "ServiceName" "Description" {
|
|
370
|
+
methodName: dataType
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Supported Data Types
|
|
375
|
+
|
|
376
|
+
- `uuid` - UUID identifier
|
|
377
|
+
- `string` - Text
|
|
378
|
+
- `number` - Integer or decimal
|
|
379
|
+
- `boolean` - True/false
|
|
380
|
+
- `timestamp` - Date and time
|
|
381
|
+
- `json` - JSON object
|
|
382
|
+
- `text` - Long text
|
|
383
|
+
|
|
384
|
+
## Examples
|
|
385
|
+
|
|
386
|
+
### Create a User Management Module
|
|
387
|
+
|
|
388
|
+
**Step 1: Define the DSL**
|
|
389
|
+
|
|
390
|
+
```luhn
|
|
391
|
+
# luhn/user/user.luhn
|
|
392
|
+
business "User" "User Management" {
|
|
393
|
+
id: uuid
|
|
394
|
+
email: string
|
|
395
|
+
name: string
|
|
396
|
+
role: string
|
|
397
|
+
isActive: boolean
|
|
398
|
+
createdAt: timestamp?
|
|
399
|
+
updatedAt: timestamp?
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
entity "UserPreferences" "User settings" {
|
|
403
|
+
userId: uuid
|
|
404
|
+
theme: string?
|
|
405
|
+
language: string?
|
|
406
|
+
notifications: boolean
|
|
407
|
+
}
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
**Step 2: Compile**
|
|
411
|
+
|
|
412
|
+
```bash
|
|
413
|
+
luhn compile
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**Step 3: Check generated files**
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
luhn list -m user --full
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
**Step 4: Create database migration**
|
|
423
|
+
|
|
424
|
+
```bash
|
|
425
|
+
luhn db migrate --name "create_user_tables"
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
**Step 5: Start development**
|
|
429
|
+
|
|
430
|
+
```bash
|
|
431
|
+
luhn serve --watch
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### Export Project Structure
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
# Export to JSON file
|
|
438
|
+
luhn list --json > project-structure.json
|
|
439
|
+
|
|
440
|
+
# Filter specific module
|
|
441
|
+
luhn list -m auth --json > auth-module.json
|
|
442
|
+
|
|
443
|
+
# Use in documentation generation
|
|
444
|
+
luhn list --full --json | jq . > docs/structure.json
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
## Troubleshooting
|
|
448
|
+
|
|
449
|
+
### `No LUHN directory found`
|
|
450
|
+
|
|
451
|
+
**Problem:** Getting error when running `luhn list` or `luhn compile`
|
|
452
|
+
|
|
453
|
+
**Solution:** Make sure you're in a LUHN project directory. The CLI looks for:
|
|
454
|
+
- `./luhn` - Main directory
|
|
455
|
+
- `./src/luhn` - Nested structure
|
|
456
|
+
- `../luhn` - Parent directory
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
# Verify directory structure
|
|
460
|
+
ls -la luhn/
|
|
461
|
+
|
|
462
|
+
# Or create one
|
|
463
|
+
mkdir -p luhn
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### `Failed to compile`
|
|
467
|
+
|
|
468
|
+
**Problem:** TypeScript compilation errors
|
|
469
|
+
|
|
470
|
+
**Solution:** Check your DSL syntax and try strict mode:
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
luhn compile --strict
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### `Database connection error`
|
|
477
|
+
|
|
478
|
+
**Problem:** Cannot connect to database
|
|
479
|
+
|
|
480
|
+
**Solution:** Verify `.env` file:
|
|
481
|
+
|
|
482
|
+
```bash
|
|
483
|
+
# Check connection string
|
|
484
|
+
cat .env
|
|
485
|
+
|
|
486
|
+
# Test connection
|
|
487
|
+
luhn db migrate --dry-run
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### Version mismatch
|
|
491
|
+
|
|
492
|
+
**Problem:** CLI version doesn't match package version
|
|
493
|
+
|
|
494
|
+
**Solution:** Update CLI:
|
|
495
|
+
|
|
496
|
+
```bash
|
|
497
|
+
npm install -g @agility-luhn/cli@latest
|
|
498
|
+
# or
|
|
499
|
+
pnpm add -g @agility-luhn/cli@latest
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
## Debugging
|
|
503
|
+
|
|
504
|
+
Enable debug logging:
|
|
505
|
+
|
|
506
|
+
```bash
|
|
507
|
+
DEBUG=luhn:* luhn compile
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
Or set environment variable:
|
|
511
|
+
|
|
512
|
+
```bash
|
|
513
|
+
export DEBUG=luhn:*
|
|
514
|
+
luhn serve
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
## Performance Tips
|
|
518
|
+
|
|
519
|
+
1. **Incremental Compilation** - Use watch mode during development
|
|
520
|
+
```bash
|
|
521
|
+
luhn compile --watch
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
2. **Database Caching** - Cache introspection results
|
|
525
|
+
```bash
|
|
526
|
+
luhn db introspect --cache
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
3. **Parallel Processing** - Enable for large projects
|
|
530
|
+
```bash
|
|
531
|
+
luhn compile --parallel
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
## Release Notes
|
|
535
|
+
|
|
536
|
+
See [CHANGELOG.md](./CHANGELOG.md) for version history and updates.
|
|
537
|
+
|
|
538
|
+
## Contributing
|
|
539
|
+
|
|
540
|
+
We welcome contributions! Please see our [contribution guidelines](https://github.com/flaviorafaelo-agility/luhn-workspace).
|
|
541
|
+
|
|
542
|
+
## Support
|
|
543
|
+
|
|
544
|
+
- 📖 [Documentation](https://github.com/flaviorafaelo-agility/luhn-workspace)
|
|
545
|
+
- 🐛 [Report Issues](https://github.com/flaviorafaelo-agility/luhn-workspace/issues)
|
|
546
|
+
- 💬 [Discussions](https://github.com/flaviorafaelo-agility/luhn-workspace/discussions)
|
|
547
|
+
|
|
548
|
+
## License
|
|
549
|
+
|
|
550
|
+
MIT © [Agility Solutions](https://github.com/flaviorafaelo-agility)
|
|
551
|
+
|
|
552
|
+
## Related Packages
|
|
553
|
+
|
|
554
|
+
- **[@agility-luhn/compiler](https://www.npmjs.com/package/@agility-luhn/compiler)** - LUHN compiler core
|
|
555
|
+
- **[@agility-luhn/runtime](https://www.npmjs.com/package/@agility-luhn/runtime)** - Runtime utilities
|
|
556
|
+
- **[@agility-luhn/database](https://www.npmjs.com/package/@agility-luhn/database)** - Database layer
|
|
557
|
+
- **[@agility-luhn/database-postgres](https://www.npmjs.com/package/@agility-luhn/database-postgres)** - PostgreSQL adapter
|
|
558
|
+
|
|
559
|
+
---
|
|
560
|
+
|
|
561
|
+
**Made with ❤️ by [Agility Solutions](https://agilitysolutions.com.br)**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsLpC,wBAAgB,WAAW,IAAI,OAAO,CA0HrC"}
|
package/dist/commands/list.js
CHANGED
|
@@ -7,104 +7,146 @@ exports.listCommand = listCommand;
|
|
|
7
7
|
const commander_1 = require("commander");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const title = match[3];
|
|
21
|
-
const body = match[4];
|
|
22
|
-
if (!type || !name || body === undefined)
|
|
23
|
-
continue;
|
|
24
|
-
const attributes = parseAttributes(body);
|
|
25
|
-
entities.push({
|
|
26
|
-
type: type,
|
|
27
|
-
name,
|
|
28
|
-
title: title ? title.trim() : undefined,
|
|
29
|
-
attributes,
|
|
30
|
-
description: title ? title.trim() : undefined
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return entities;
|
|
10
|
+
const compiler_1 = require("@agility-luhn/compiler");
|
|
11
|
+
function findLuhnDir() {
|
|
12
|
+
const cwd = process.cwd();
|
|
13
|
+
// Try ./luhn in current directory
|
|
14
|
+
if ((0, fs_1.existsSync)(path_1.default.join(cwd, 'luhn'))) {
|
|
15
|
+
return path_1.default.join(cwd, 'luhn');
|
|
16
|
+
}
|
|
17
|
+
// Try ./src/luhn (common in monorepos)
|
|
18
|
+
if ((0, fs_1.existsSync)(path_1.default.join(cwd, 'src', 'luhn'))) {
|
|
19
|
+
return path_1.default.join(cwd, 'src', 'luhn');
|
|
34
20
|
}
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
// Try parent directory ./luhn
|
|
22
|
+
const parent = path_1.default.dirname(cwd);
|
|
23
|
+
if (parent !== cwd && (0, fs_1.existsSync)(path_1.default.join(parent, 'luhn'))) {
|
|
24
|
+
return path_1.default.join(parent, 'luhn');
|
|
37
25
|
}
|
|
26
|
+
// Try ./luhn in one level up (for nested projects)
|
|
27
|
+
const grandparent = path_1.default.dirname(parent);
|
|
28
|
+
if (grandparent !== parent && (0, fs_1.existsSync)(path_1.default.join(grandparent, 'luhn'))) {
|
|
29
|
+
return path_1.default.join(grandparent, 'luhn');
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
38
32
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
for (const line of lines) {
|
|
43
|
-
const trimmed = line.trim();
|
|
44
|
-
if (!trimmed || trimmed.startsWith('//') || trimmed.startsWith('ui'))
|
|
45
|
-
continue;
|
|
46
|
-
// Match: name: type or name: type?
|
|
47
|
-
const attrRegex = /^\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*:\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*(\?)?/;
|
|
48
|
-
const attrMatch = attrRegex.exec(line);
|
|
49
|
-
if (attrMatch) {
|
|
50
|
-
const name = attrMatch[1];
|
|
51
|
-
const type = attrMatch[2];
|
|
52
|
-
const optional = attrMatch[3];
|
|
53
|
-
if (name && type) {
|
|
54
|
-
attributes.push({
|
|
55
|
-
name,
|
|
56
|
-
type,
|
|
57
|
-
required: !optional
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
33
|
+
function getTypeString(typeRef) {
|
|
34
|
+
if (typeRef.kind === 'PrimitiveTypeRef') {
|
|
35
|
+
return typeRef.name || 'unknown';
|
|
61
36
|
}
|
|
62
|
-
|
|
37
|
+
if (typeRef.kind === 'NamedTypeRef') {
|
|
38
|
+
const name = typeRef.name;
|
|
39
|
+
return Array.isArray(name) ? name.join('.') : String(name || 'unknown');
|
|
40
|
+
}
|
|
41
|
+
return 'unknown';
|
|
63
42
|
}
|
|
64
|
-
function
|
|
43
|
+
function scanLuhnModulesWithAST(luhnDir) {
|
|
65
44
|
const modules = [];
|
|
45
|
+
const moduleMap = {};
|
|
66
46
|
try {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
47
|
+
// Collect all .luhn files
|
|
48
|
+
const luhnFiles = [];
|
|
49
|
+
function scanDirectory(dir, prefix = '') {
|
|
50
|
+
try {
|
|
51
|
+
const entries = (0, fs_1.readdirSync)(dir, { withFileTypes: true });
|
|
52
|
+
for (const entry of entries) {
|
|
53
|
+
if (entry.isDirectory()) {
|
|
54
|
+
scanDirectory(path_1.default.join(dir, entry.name), entry.name);
|
|
55
|
+
}
|
|
56
|
+
else if (entry.name.endsWith('.luhn')) {
|
|
57
|
+
const filePath = path_1.default.join(dir, entry.name);
|
|
58
|
+
const content = (0, fs_1.readFileSync)(filePath, 'utf8');
|
|
59
|
+
const sourceInput = {
|
|
60
|
+
path: filePath,
|
|
61
|
+
text: content
|
|
62
|
+
};
|
|
63
|
+
if (prefix) {
|
|
64
|
+
sourceInput.moduleHint = [prefix];
|
|
80
65
|
}
|
|
66
|
+
luhnFiles.push(sourceInput);
|
|
81
67
|
}
|
|
82
68
|
}
|
|
83
|
-
|
|
84
|
-
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Continue if directory is not readable
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
scanDirectory(luhnDir);
|
|
75
|
+
if (luhnFiles.length === 0) {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
// Parse all files using the compiler's parser
|
|
79
|
+
const parseResult = (0, compiler_1.parseProgram)(luhnFiles);
|
|
80
|
+
if (parseResult.diagnostics.some((d) => d.severity === 'error')) {
|
|
81
|
+
// Log errors but continue
|
|
82
|
+
parseResult.diagnostics.forEach((d) => {
|
|
83
|
+
if (d.severity === 'error') {
|
|
84
|
+
console.error(`Parse error in ${d.span?.filePath}: ${d.message}`);
|
|
85
85
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// Extract entities from AST
|
|
89
|
+
for (const file of parseResult.program.files) {
|
|
90
|
+
for (const decl of file.declarations) {
|
|
91
|
+
const declAny = decl;
|
|
92
|
+
const moduleHint = declAny.module ? declAny.module.join('/') : 'default';
|
|
93
|
+
const moduleName = moduleHint;
|
|
94
|
+
if (!moduleMap[moduleName]) {
|
|
95
|
+
moduleMap[moduleName] = [];
|
|
91
96
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
if (declAny.kind === 'Business') {
|
|
98
|
+
const entity = {
|
|
99
|
+
type: 'business',
|
|
100
|
+
name: declAny.name,
|
|
101
|
+
title: declAny.label,
|
|
102
|
+
description: declAny.label,
|
|
103
|
+
attributes: (declAny.fields || []).map((field) => ({
|
|
104
|
+
name: field.name,
|
|
105
|
+
type: getTypeString(field.typeRef),
|
|
106
|
+
required: !field.optional
|
|
107
|
+
}))
|
|
108
|
+
};
|
|
109
|
+
moduleMap[moduleName].push(entity);
|
|
110
|
+
}
|
|
111
|
+
else if (declAny.kind === 'Record') {
|
|
112
|
+
const entity = {
|
|
113
|
+
type: 'entity',
|
|
114
|
+
name: declAny.name,
|
|
115
|
+
title: declAny.label,
|
|
116
|
+
description: declAny.label,
|
|
117
|
+
attributes: (declAny.fields || []).map((field) => ({
|
|
118
|
+
name: field.name,
|
|
119
|
+
type: getTypeString(field.typeRef),
|
|
120
|
+
required: !field.optional
|
|
121
|
+
}))
|
|
122
|
+
};
|
|
123
|
+
moduleMap[moduleName].push(entity);
|
|
124
|
+
}
|
|
125
|
+
else if (declAny.kind === 'Service') {
|
|
126
|
+
const entity = {
|
|
127
|
+
type: 'service',
|
|
128
|
+
name: declAny.name,
|
|
129
|
+
title: declAny.label,
|
|
130
|
+
description: declAny.label,
|
|
131
|
+
attributes: [] // Services may have parameters
|
|
132
|
+
};
|
|
133
|
+
moduleMap[moduleName].push(entity);
|
|
102
134
|
}
|
|
103
135
|
}
|
|
104
136
|
}
|
|
137
|
+
// Convert map to array
|
|
138
|
+
for (const [moduleName, entities] of Object.entries(moduleMap)) {
|
|
139
|
+
if (entities.length > 0) {
|
|
140
|
+
modules.push({
|
|
141
|
+
name: moduleName,
|
|
142
|
+
entities
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
105
146
|
}
|
|
106
|
-
catch {
|
|
107
|
-
|
|
147
|
+
catch (error) {
|
|
148
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
149
|
+
console.error(`Error scanning LUHN modules: ${message}`);
|
|
108
150
|
}
|
|
109
151
|
return modules;
|
|
110
152
|
}
|
|
@@ -118,10 +160,17 @@ function listCommand() {
|
|
|
118
160
|
.option('--json', 'Output as JSON')
|
|
119
161
|
.action(async (options) => {
|
|
120
162
|
try {
|
|
121
|
-
const luhnDir =
|
|
122
|
-
|
|
163
|
+
const luhnDir = findLuhnDir();
|
|
164
|
+
if (!luhnDir) {
|
|
165
|
+
console.log('❌ No LUHN directory found.');
|
|
166
|
+
console.log(' Searched in: ./luhn, ./src/luhn, ../luhn, ../../luhn');
|
|
167
|
+
console.log(' Make sure you are in a LUHN project directory.\n');
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const modules = scanLuhnModulesWithAST(luhnDir);
|
|
123
171
|
if (modules.length === 0) {
|
|
124
|
-
console.log(
|
|
172
|
+
console.log(`❌ No LUHN modules found in ${luhnDir}`);
|
|
173
|
+
console.log(' Make sure you have .luhn files in your modules.\n');
|
|
125
174
|
return;
|
|
126
175
|
}
|
|
127
176
|
let filteredModules = modules;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":";;;;;AAsLA,kCA0HC;AAhTD,yCAAoC;AACpC,2BAA2D;AAC3D,gDAAwB;AACxB,qDAAuE;AAsBvE,SAAS,WAAW;IAClB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE1B,kCAAkC;IAClC,IAAI,IAAA,eAAU,EAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;QACvC,OAAO,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC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,CAAC,GAAG,CAAC,cAAc,MAAM,CAAC,UAAU,CAAC,MAAM,eAAe,CAAC,CAAC;oBACrE,CAAC;gBACH,CAAC;gBACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAClB,CAAC;YAED,UAAU;YACV,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,oBAAoB,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC;YAC1D,OAAO,CAAC,GAAG,CAAC,oBAAoB,aAAa,EAAE,CAAC,CAAC;YACjD,OAAO,CAAC,GAAG,CAAC,oBAAoB,eAAe,IAAI,CAAC,CAAC;YAErD,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;gBACvC,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,OAAO,CAAC,KAAK,CAAC,4BAA4B,OAAO,EAAE,CAAC,CAAC;YACrD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const commander_1 = require("commander");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const os_1 = __importDefault(require("os"));
|
|
9
10
|
const init_1 = require("./commands/init");
|
|
10
11
|
const compile_1 = require("./commands/compile");
|
|
11
12
|
const db_1 = require("./commands/db");
|
|
@@ -22,19 +23,40 @@ function loadVersion() {
|
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
function showBanner() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
const info = getSystemInfo();
|
|
27
|
+
const banner = `
|
|
28
|
+
_ _ _ _ _ _
|
|
29
|
+
| | | | | | | | | | | |
|
|
30
|
+
| | _ _ ___| |_| | | |_| | | |
|
|
31
|
+
| | | | | |/ _ \\ _ | | _ | | |
|
|
32
|
+
| |____| |_| | __/| | | | | | | | |_|
|
|
33
|
+
|_____|\___/|_|___|_| |_| |_| |_| |_|_|
|
|
34
|
+
|
|
35
|
+
LUHN CLI: ${info.version}
|
|
36
|
+
Node: ${info.node}
|
|
37
|
+
Package Manager: pnpm ${info.pnpm}
|
|
38
|
+
OS: ${info.platform} ${info.arch}
|
|
39
|
+
`;
|
|
40
|
+
console.log(banner);
|
|
41
|
+
}
|
|
42
|
+
function getPnpmVersion() {
|
|
43
|
+
try {
|
|
44
|
+
const result = require('child_process').execSync('pnpm -v', { encoding: 'utf8' });
|
|
45
|
+
return result.trim();
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return 'unknown';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Get all system information for banner display
|
|
52
|
+
function getSystemInfo() {
|
|
53
|
+
return {
|
|
54
|
+
version: loadVersion(),
|
|
55
|
+
node: process.version,
|
|
56
|
+
pnpm: getPnpmVersion(),
|
|
57
|
+
platform: os_1.default.platform(),
|
|
58
|
+
arch: os_1.default.arch()
|
|
59
|
+
};
|
|
38
60
|
}
|
|
39
61
|
const version = loadVersion();
|
|
40
62
|
commander_1.program
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,yCAAoC;AACpC,2B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