@memberjunction/cli 2.117.0 ā 2.119.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 +358 -55
- package/dist/commands/clean/index.js +2 -4
- package/dist/commands/dbdoc/analyze.d.ts +3 -3
- package/dist/commands/dbdoc/analyze.js +25 -48
- package/dist/commands/dbdoc/export.d.ts +11 -4
- package/dist/commands/dbdoc/export.js +72 -75
- package/dist/commands/dbdoc/generate-queries.d.ts +13 -0
- package/dist/commands/dbdoc/generate-queries.js +82 -0
- package/dist/commands/dbdoc/init.d.ts +1 -4
- package/dist/commands/dbdoc/init.js +7 -118
- package/dist/commands/dbdoc/reset.d.ts +9 -0
- package/dist/commands/dbdoc/reset.js +53 -0
- package/dist/commands/dbdoc/status.d.ts +9 -0
- package/dist/commands/dbdoc/status.js +52 -0
- package/dist/commands/migrate/index.js +3 -5
- package/dist/commands/sync/push.d.ts +2 -0
- package/dist/commands/sync/push.js +18 -1
- package/dist/commands/sync/status.d.ts +2 -0
- package/dist/commands/sync/status.js +14 -1
- package/dist/commands/test/compare.d.ts +18 -0
- package/dist/commands/test/compare.js +73 -0
- package/dist/commands/test/history.d.ts +15 -0
- package/dist/commands/test/history.js +66 -0
- package/dist/commands/test/index.d.ts +6 -0
- package/dist/commands/test/index.js +31 -0
- package/dist/commands/test/list.d.ts +16 -0
- package/dist/commands/test/list.js +73 -0
- package/dist/commands/test/run.d.ts +17 -0
- package/dist/commands/test/run.js +69 -0
- package/dist/commands/test/suite.d.ts +15 -0
- package/dist/commands/test/suite.js +58 -0
- package/dist/commands/test/validate.d.ts +17 -0
- package/dist/commands/test/validate.js +70 -0
- package/dist/config.d.ts +16 -12
- package/dist/config.js +45 -9
- package/oclif.manifest.json +791 -85
- package/package.json +12 -9
- package/dist/commands/dbdoc/review.d.ts +0 -10
- package/dist/commands/dbdoc/review.js +0 -81
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @memberjunction/cli
|
|
2
2
|
|
|
3
|
-
The official command-line interface (CLI) for MemberJunction, providing essential tools for installation, database management, code generation, and
|
|
3
|
+
The official command-line interface (CLI) for MemberJunction, providing essential tools for installation, database management, code generation, AI operations, testing, and database documentation.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The MemberJunction CLI (`mj`) is a comprehensive toolset designed to streamline the development and maintenance of MemberJunction applications. It handles everything from initial installation to ongoing database migrations and
|
|
7
|
+
The MemberJunction CLI (`mj`) is a comprehensive toolset designed to streamline the development and maintenance of MemberJunction applications. It handles everything from initial installation to ongoing database migrations, code generation, AI agent execution, testing, and automated database documentation.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -52,7 +52,7 @@ interface MJConfig {
|
|
|
52
52
|
coreSchema?: string; // Core schema name (default: '__mj')
|
|
53
53
|
cleanDisabled?: boolean; // Disable database cleaning (default: true)
|
|
54
54
|
mjRepoUrl?: string; // MemberJunction repository URL
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
// AI-specific settings (optional)
|
|
57
57
|
aiSettings?: {
|
|
58
58
|
defaultTimeout?: number; // Default timeout for AI operations (default: 300000ms)
|
|
@@ -81,7 +81,84 @@ module.exports = {
|
|
|
81
81
|
|
|
82
82
|
## Commands
|
|
83
83
|
|
|
84
|
-
###
|
|
84
|
+
### Core Commands
|
|
85
|
+
|
|
86
|
+
#### `mj install`
|
|
87
|
+
|
|
88
|
+
Performs a complete installation of MemberJunction, including:
|
|
89
|
+
- Database setup
|
|
90
|
+
- Generated entities configuration
|
|
91
|
+
- API server configuration
|
|
92
|
+
- Explorer UI configuration
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
mj install [--verbose]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The install command will:
|
|
99
|
+
1. Verify Node.js version and disk space requirements
|
|
100
|
+
2. Check for required directories (GeneratedEntities, SQL Scripts, MJAPI, MJExplorer)
|
|
101
|
+
3. Prompt for configuration values or read from `install.config.json`
|
|
102
|
+
4. Create `.env` files with database and authentication settings
|
|
103
|
+
5. Run npm installations and link packages
|
|
104
|
+
6. Execute CodeGen to generate initial code
|
|
105
|
+
|
|
106
|
+
#### `mj codegen`
|
|
107
|
+
|
|
108
|
+
Runs the MemberJunction code generation process to create TypeScript entities and metadata from your database schema.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
mj codegen [--skipdb]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Options:
|
|
115
|
+
- `--skipdb`: Skip database migration before running code generation
|
|
116
|
+
|
|
117
|
+
#### `mj migrate`
|
|
118
|
+
|
|
119
|
+
Applies database migrations to update your MemberJunction schema to the latest version.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
mj migrate [--verbose] [--tag <version>]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Options:
|
|
126
|
+
- `--verbose`: Enable detailed logging
|
|
127
|
+
- `--tag <version>`: Specify a version tag for migrations (e.g., 'v2.10.0')
|
|
128
|
+
|
|
129
|
+
#### `mj bump`
|
|
130
|
+
|
|
131
|
+
Updates all @memberjunction/* package dependencies to a specified version.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
mj bump [--recursive] [--dry] [--quiet] [--tag <version>] [--verbose]
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Options:
|
|
138
|
+
- `-r, --recursive`: Update dependencies in all subdirectories
|
|
139
|
+
- `-d, --dry`: Preview changes without writing to files
|
|
140
|
+
- `-q, --quiet`: Only output paths of updated packages
|
|
141
|
+
- `-t, --tag <version>`: Target version (defaults to CLI version)
|
|
142
|
+
- `-v, --verbose`: Enable detailed logging
|
|
143
|
+
|
|
144
|
+
Example - Update all packages recursively and run npm install:
|
|
145
|
+
```bash
|
|
146
|
+
mj bump -rqt v2.10.0 | xargs -n1 -I{} npm install --prefix {}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### `mj clean`
|
|
150
|
+
|
|
151
|
+
Resets the MemberJunction database to a pre-installation state. **Use with caution!**
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
mj clean [--verbose]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Note: This command is disabled by default. Set `cleanDisabled: false` in your configuration to enable it.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
### `mj sync` - Metadata Synchronization
|
|
85
162
|
|
|
86
163
|
Manages MemberJunction metadata synchronization between database and local files. This suite of commands enables version control, IDE-based editing, and CI/CD integration for MJ metadata.
|
|
87
164
|
|
|
@@ -98,7 +175,7 @@ Available sync commands:
|
|
|
98
175
|
- `watch` - Watch for changes and auto-sync
|
|
99
176
|
- `file-reset` - Reset file checksums after manual edits
|
|
100
177
|
|
|
101
|
-
For detailed documentation
|
|
178
|
+
**š For detailed documentation:** See the [MetadataSync README](../MetadataSync/README.md)
|
|
102
179
|
|
|
103
180
|
#### Quick Examples:
|
|
104
181
|
```bash
|
|
@@ -115,7 +192,9 @@ mj sync push
|
|
|
115
192
|
mj sync watch
|
|
116
193
|
```
|
|
117
194
|
|
|
118
|
-
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
### `mj ai` - AI Operations
|
|
119
198
|
|
|
120
199
|
Execute AI agents and actions using MemberJunction's AI framework. This command provides access to 20+ AI agents and 30+ actions for various tasks.
|
|
121
200
|
|
|
@@ -131,6 +210,8 @@ Available AI commands:
|
|
|
131
210
|
- `prompts list` - List available AI models for direct prompt execution
|
|
132
211
|
- `prompts run` - Execute a direct prompt with an AI model
|
|
133
212
|
|
|
213
|
+
**š For detailed documentation:** See the [AI-CLI README](../AI/AICLI/README.md)
|
|
214
|
+
|
|
134
215
|
#### Quick Examples:
|
|
135
216
|
|
|
136
217
|
```bash
|
|
@@ -225,7 +306,7 @@ Add AI-specific settings to your `mj.config.cjs`:
|
|
|
225
306
|
```javascript
|
|
226
307
|
module.exports = {
|
|
227
308
|
// Existing database settings...
|
|
228
|
-
|
|
309
|
+
|
|
229
310
|
aiSettings: {
|
|
230
311
|
defaultTimeout: 300000,
|
|
231
312
|
outputFormat: 'compact',
|
|
@@ -238,80 +319,297 @@ module.exports = {
|
|
|
238
319
|
|
|
239
320
|
Execution logs are stored in `.mj-ai/logs/` for debugging and audit purposes.
|
|
240
321
|
|
|
241
|
-
|
|
322
|
+
---
|
|
242
323
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
-
|
|
246
|
-
- API server configuration
|
|
247
|
-
- Explorer UI configuration
|
|
324
|
+
### `mj test` - Testing Framework
|
|
325
|
+
|
|
326
|
+
Execute and manage tests using MemberJunction's comprehensive testing framework. Run database-driven tests, test suites, and view execution history.
|
|
248
327
|
|
|
249
328
|
```bash
|
|
250
|
-
mj
|
|
329
|
+
mj test [COMMAND] [OPTIONS]
|
|
251
330
|
```
|
|
252
331
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
332
|
+
Available test commands:
|
|
333
|
+
- `run` - Execute a single test by ID or name
|
|
334
|
+
- `suite` - Execute a test suite
|
|
335
|
+
- `list` - List available tests, suites, and types
|
|
336
|
+
- `validate` - Validate test definitions without executing
|
|
337
|
+
- `history` - View test execution history
|
|
338
|
+
- `compare` - Compare test runs for regression detection
|
|
260
339
|
|
|
261
|
-
|
|
340
|
+
**š For detailed documentation:** See the [Testing CLI README](../TestingFramework/CLI/README.md)
|
|
262
341
|
|
|
263
|
-
|
|
342
|
+
#### Quick Examples:
|
|
264
343
|
|
|
265
344
|
```bash
|
|
266
|
-
|
|
267
|
-
|
|
345
|
+
# Run a single test
|
|
346
|
+
mj test run <test-id>
|
|
268
347
|
|
|
269
|
-
|
|
270
|
-
|
|
348
|
+
# Run a test by name
|
|
349
|
+
mj test run --name="Active Members Count"
|
|
271
350
|
|
|
272
|
-
|
|
351
|
+
# Run a test suite
|
|
352
|
+
mj test suite <suite-id>
|
|
273
353
|
|
|
274
|
-
|
|
354
|
+
# Run suite by name
|
|
355
|
+
mj test suite --name="Agent Quality Suite"
|
|
275
356
|
|
|
276
|
-
|
|
277
|
-
mj
|
|
357
|
+
# List all tests
|
|
358
|
+
mj test list
|
|
359
|
+
|
|
360
|
+
# List test suites
|
|
361
|
+
mj test list --suites
|
|
362
|
+
|
|
363
|
+
# List test types
|
|
364
|
+
mj test list --types
|
|
365
|
+
|
|
366
|
+
# Filter by test type
|
|
367
|
+
mj test list --type=agent-eval
|
|
368
|
+
|
|
369
|
+
# Validate all tests
|
|
370
|
+
mj test validate --all
|
|
371
|
+
|
|
372
|
+
# Validate specific test type
|
|
373
|
+
mj test validate --type=agent-eval
|
|
374
|
+
|
|
375
|
+
# View test execution history
|
|
376
|
+
mj test history --test=<test-id>
|
|
377
|
+
|
|
378
|
+
# Compare two test runs
|
|
379
|
+
mj test compare <run-id-1> <run-id-2>
|
|
380
|
+
|
|
381
|
+
# Output formats
|
|
382
|
+
mj test run <test-id> --format=json --output=results.json
|
|
383
|
+
mj test suite <suite-id> --format=markdown --output=report.md
|
|
278
384
|
```
|
|
279
385
|
|
|
280
|
-
Options:
|
|
281
|
-
|
|
282
|
-
|
|
386
|
+
#### Test Command Options:
|
|
387
|
+
|
|
388
|
+
**Run Command:**
|
|
389
|
+
- `<testId>`: Test ID to execute
|
|
390
|
+
- `-n, --name <name>`: Test name to execute
|
|
391
|
+
- `-e, --environment <env>`: Environment context (dev, staging, prod)
|
|
392
|
+
- `-f, --format <format>`: Output format (console, json, markdown)
|
|
393
|
+
- `-o, --output <path>`: Output file path
|
|
394
|
+
- `--dry-run`: Validate without executing
|
|
395
|
+
- `-v, --verbose`: Show detailed execution information
|
|
283
396
|
|
|
284
|
-
|
|
397
|
+
**Suite Command:**
|
|
398
|
+
- `<suiteId>`: Test suite ID to execute
|
|
399
|
+
- `-n, --name <name>`: Test suite name to execute
|
|
400
|
+
- `-f, --format <format>`: Output format (console, json, markdown)
|
|
401
|
+
- `-o, --output <path>`: Output file path
|
|
402
|
+
- `-v, --verbose`: Show detailed execution information
|
|
285
403
|
|
|
286
|
-
|
|
404
|
+
**List Command:**
|
|
405
|
+
- `--suites`: List test suites instead of tests
|
|
406
|
+
- `--types`: List test types
|
|
407
|
+
- `-t, --type <type>`: Filter by test type
|
|
408
|
+
- `--tag <tag>`: Filter by tag
|
|
409
|
+
- `-s, --status <status>`: Filter by status
|
|
410
|
+
- `-f, --format <format>`: Output format (console, json, markdown)
|
|
411
|
+
- `-v, --verbose`: Show detailed information
|
|
412
|
+
|
|
413
|
+
**Validate Command:**
|
|
414
|
+
- `<testId>`: Test ID to validate
|
|
415
|
+
- `-a, --all`: Validate all tests
|
|
416
|
+
- `-t, --type <type>`: Validate tests by type
|
|
417
|
+
- `--save-report`: Save validation report to file
|
|
418
|
+
- `-f, --format <format>`: Output format (console, json, markdown)
|
|
419
|
+
- `-o, --output <path>`: Output file path
|
|
420
|
+
- `-v, --verbose`: Show detailed information
|
|
421
|
+
|
|
422
|
+
**History Command:**
|
|
423
|
+
- `-t, --test <id>`: Filter by test ID
|
|
424
|
+
- `-r, --recent <n>`: Number of recent runs to show
|
|
425
|
+
- `--from <date>`: Show history from date (YYYY-MM-DD)
|
|
426
|
+
- `-s, --status <status>`: Filter by status
|
|
427
|
+
- `-f, --format <format>`: Output format (console, json, markdown)
|
|
428
|
+
- `-o, --output <path>`: Output file path
|
|
429
|
+
- `-v, --verbose`: Show detailed information
|
|
430
|
+
|
|
431
|
+
**Compare Command:**
|
|
432
|
+
- `<runId1>`: First test run ID to compare
|
|
433
|
+
- `<runId2>`: Second test run ID to compare
|
|
434
|
+
- `-v, --version <versions>`: Compare runs by version
|
|
435
|
+
- `-c, --commit <commits>`: Compare runs by git commit
|
|
436
|
+
- `--diff-only`: Show only differences
|
|
437
|
+
- `-f, --format <format>`: Output format (console, json, markdown)
|
|
438
|
+
- `-o, --output <path>`: Output file path
|
|
439
|
+
- `--verbose`: Show detailed information
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
### `mj dbdoc` - Database Documentation
|
|
444
|
+
|
|
445
|
+
AI-powered database documentation generator for SQL Server, MySQL, and PostgreSQL. Analyzes your database structure, uses AI to generate comprehensive descriptions, and saves them as database metadata.
|
|
287
446
|
|
|
288
447
|
```bash
|
|
289
|
-
mj
|
|
448
|
+
mj dbdoc [COMMAND] [OPTIONS]
|
|
290
449
|
```
|
|
291
450
|
|
|
292
|
-
|
|
293
|
-
-
|
|
294
|
-
-
|
|
295
|
-
-
|
|
296
|
-
-
|
|
297
|
-
-
|
|
451
|
+
Available dbdoc commands:
|
|
452
|
+
- `init` - Initialize a new DBAutoDoc project
|
|
453
|
+
- `analyze` - Analyze database and generate documentation
|
|
454
|
+
- `generate-queries` - Generate sample SQL queries from existing analysis state
|
|
455
|
+
- `export` - Export documentation in multiple formats (SQL, Markdown, HTML, CSV, Mermaid)
|
|
456
|
+
- `status` - Show analysis status and progress
|
|
457
|
+
- `reset` - Reset analysis state
|
|
458
|
+
|
|
459
|
+
**š For detailed documentation:** See the [DBAutoDoc README](../DBAutoDoc/README.md)
|
|
460
|
+
|
|
461
|
+
#### Quick Examples:
|
|
298
462
|
|
|
299
|
-
Example - Update all packages recursively and run npm install:
|
|
300
463
|
```bash
|
|
301
|
-
|
|
302
|
-
|
|
464
|
+
# Initialize new project (interactive wizard)
|
|
465
|
+
mj dbdoc init
|
|
303
466
|
|
|
304
|
-
|
|
467
|
+
# Analyze database
|
|
468
|
+
mj dbdoc analyze
|
|
305
469
|
|
|
306
|
-
|
|
470
|
+
# Resume from existing state
|
|
471
|
+
mj dbdoc analyze --resume ./output/run-6/state.json
|
|
307
472
|
|
|
473
|
+
# Use custom config
|
|
474
|
+
mj dbdoc analyze --config ./my-config.json
|
|
475
|
+
|
|
476
|
+
# Generate sample SQL queries from existing state
|
|
477
|
+
mj dbdoc generate-queries --from-state ./output/run-1/state.json
|
|
478
|
+
|
|
479
|
+
# Generate with custom settings
|
|
480
|
+
mj dbdoc generate-queries --from-state ./output/run-1/state.json \
|
|
481
|
+
--queries-per-table 10 \
|
|
482
|
+
--output-dir ./queries
|
|
483
|
+
|
|
484
|
+
# Export all formats
|
|
485
|
+
mj dbdoc export --sql --markdown --html --csv --mermaid
|
|
486
|
+
|
|
487
|
+
# Export specific state file
|
|
488
|
+
mj dbdoc export --state-file ./output/run-6/state.json --sql --markdown
|
|
489
|
+
|
|
490
|
+
# Apply SQL directly to database
|
|
491
|
+
mj dbdoc export --sql --apply
|
|
492
|
+
|
|
493
|
+
# Export with filtering
|
|
494
|
+
mj dbdoc export --approved-only --confidence-threshold 0.8
|
|
495
|
+
|
|
496
|
+
# Check status
|
|
497
|
+
mj dbdoc status
|
|
498
|
+
|
|
499
|
+
# Reset state
|
|
500
|
+
mj dbdoc reset --force
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
#### DBAutoDoc Command Options:
|
|
504
|
+
|
|
505
|
+
**Init Command:**
|
|
506
|
+
- Interactive wizard guides you through:
|
|
507
|
+
- Database connection configuration
|
|
508
|
+
- AI provider setup (OpenAI, Anthropic, Google, Groq)
|
|
509
|
+
- Resource limits and guardrails
|
|
510
|
+
- Optional seed context for better analysis
|
|
511
|
+
|
|
512
|
+
**Analyze Command:**
|
|
513
|
+
- `-r, --resume <path>`: Resume from an existing state file
|
|
514
|
+
- `-c, --config <path>`: Path to config file (default: ./config.json)
|
|
515
|
+
|
|
516
|
+
**Generate Queries Command:**
|
|
517
|
+
- `--from-state <path>`: Path to existing state.json file from previous analysis (required)
|
|
518
|
+
- `--output-dir <path>`: Output directory for generated queries (optional)
|
|
519
|
+
- `-c, --config <path>`: Path to config file for database connection and AI settings (default: ./config.json)
|
|
520
|
+
- `--queries-per-table <number>`: Number of queries to generate per table (optional, overrides config)
|
|
521
|
+
- `--max-execution-time <ms>`: Maximum execution time for query validation in milliseconds (optional, overrides config)
|
|
522
|
+
|
|
523
|
+
**Export Command:**
|
|
524
|
+
- `-s, --state-file <path>`: Path to state JSON file
|
|
525
|
+
- `-o, --output-dir <path>`: Output directory for generated files
|
|
526
|
+
- `--sql`: Generate SQL script with database-specific metadata statements
|
|
527
|
+
- `--markdown`: Generate Markdown documentation with ERD diagrams
|
|
528
|
+
- `--html`: Generate interactive HTML documentation
|
|
529
|
+
- `--csv`: Generate CSV exports (tables.csv and columns.csv)
|
|
530
|
+
- `--mermaid`: Generate Mermaid ERD diagram files (.mmd and .html)
|
|
531
|
+
- `--report`: Generate analysis report with metrics
|
|
532
|
+
- `--apply`: Apply SQL script directly to database
|
|
533
|
+
- `--approved-only`: Only export approved items
|
|
534
|
+
- `--confidence-threshold <value>`: Minimum confidence threshold (default: 0)
|
|
535
|
+
|
|
536
|
+
**Status Command:**
|
|
537
|
+
- `-s, --state-file <path>`: Path to state JSON file
|
|
538
|
+
|
|
539
|
+
**Reset Command:**
|
|
540
|
+
- `-f, --force`: Force reset without confirmation
|
|
541
|
+
|
|
542
|
+
#### DBAutoDoc Features:
|
|
543
|
+
|
|
544
|
+
**Core Capabilities:**
|
|
545
|
+
- š¤ **AI-Powered Analysis** - Uses OpenAI, Anthropic, Google, or Groq
|
|
546
|
+
- š **Iterative Refinement** - Multi-pass analysis with backpropagation
|
|
547
|
+
- š **Topological Processing** - Analyzes tables in dependency order
|
|
548
|
+
- š **Data-Driven** - Leverages cardinality, statistics, and sample data
|
|
549
|
+
- šÆ **Convergence Detection** - Automatically knows when analysis is complete
|
|
550
|
+
- š¾ **State Tracking** - Full audit trail of all iterations
|
|
551
|
+
- š **Standalone** - Works with ANY database, no MemberJunction required
|
|
552
|
+
|
|
553
|
+
**Multi-Database Support:**
|
|
554
|
+
- SQL Server (extended properties)
|
|
555
|
+
- PostgreSQL (COMMENT syntax)
|
|
556
|
+
- MySQL (column/table comments)
|
|
557
|
+
|
|
558
|
+
**Advanced Features:**
|
|
559
|
+
- š **Relationship Discovery** - Detect missing primary and foreign keys
|
|
560
|
+
- šÆ **Sample Query Generation** - Generate reference SQL queries for AI agent training with alignment tracking
|
|
561
|
+
- š”ļø **Granular Guardrails** - Multi-level resource controls
|
|
562
|
+
- āøļø **Resume Capability** - Pause and resume from checkpoint
|
|
563
|
+
- š¦ **Programmatic API** - Use as a library in your applications
|
|
564
|
+
|
|
565
|
+
**Output Formats:**
|
|
566
|
+
- SQL Scripts (database-specific metadata)
|
|
567
|
+
- Markdown Documentation (human-readable with ERD)
|
|
568
|
+
- HTML Documentation (interactive, searchable)
|
|
569
|
+
- CSV Exports (spreadsheet-ready)
|
|
570
|
+
- Mermaid Diagrams (standalone ERD files)
|
|
571
|
+
- Analysis Reports (detailed metrics)
|
|
572
|
+
- Sample Queries (JSON with SQL, metadata, and alignment tracking)
|
|
573
|
+
|
|
574
|
+
**Sample Query Generation:**
|
|
575
|
+
|
|
576
|
+
DBAutoDoc can generate reference SQL queries that solve the **query alignment problem** where multi-query patterns (summary + detail) have inconsistent filtering logic. These "gold standard" queries include:
|
|
577
|
+
- Explicit filtering rules for consistency
|
|
578
|
+
- Alignment tracking via `relatedQueryIds`
|
|
579
|
+
- Query patterns (Summary+Detail, Multi-Entity Drilldown, Time Series)
|
|
580
|
+
- Validated, executable SQL
|
|
581
|
+
- Perfect for few-shot prompting in AI agents like Skip
|
|
582
|
+
|
|
583
|
+
Enable in config:
|
|
584
|
+
```json
|
|
585
|
+
{
|
|
586
|
+
"analysis": {
|
|
587
|
+
"sampleQueryGeneration": {
|
|
588
|
+
"enabled": true,
|
|
589
|
+
"queriesPerTable": 5,
|
|
590
|
+
"includeMultiQueryPatterns": true,
|
|
591
|
+
"validateAlignment": true
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
Or generate separately from existing state:
|
|
308
598
|
```bash
|
|
309
|
-
mj
|
|
599
|
+
mj dbdoc generate-queries --from-state ./output/run-1/state.json
|
|
310
600
|
```
|
|
311
601
|
|
|
312
|
-
|
|
602
|
+
**Use Cases:**
|
|
603
|
+
- Training AI agents to generate consistent multi-query patterns
|
|
604
|
+
- Creating reference examples for few-shot prompting
|
|
605
|
+
- Documenting common query patterns for your database
|
|
606
|
+
- Validating that related queries use consistent filtering logic
|
|
607
|
+
|
|
608
|
+
---
|
|
609
|
+
|
|
610
|
+
### Utility Commands
|
|
313
611
|
|
|
314
|
-
|
|
612
|
+
#### `mj help`
|
|
315
613
|
|
|
316
614
|
Display help information for any command.
|
|
317
615
|
|
|
@@ -319,7 +617,7 @@ Display help information for any command.
|
|
|
319
617
|
mj help [COMMAND]
|
|
320
618
|
```
|
|
321
619
|
|
|
322
|
-
|
|
620
|
+
#### `mj version`
|
|
323
621
|
|
|
324
622
|
Display the CLI version and additional system information.
|
|
325
623
|
|
|
@@ -339,9 +637,11 @@ The CLI respects the following environment variables:
|
|
|
339
637
|
|
|
340
638
|
The CLI integrates seamlessly with other MemberJunction packages:
|
|
341
639
|
|
|
342
|
-
-
|
|
343
|
-
-
|
|
344
|
-
-
|
|
640
|
+
- **[@memberjunction/codegen-lib](../CodeGenLib)**: Powers the code generation functionality
|
|
641
|
+
- **[@memberjunction/metadata-sync](../MetadataSync)**: Provides metadata synchronization capabilities ([README](../MetadataSync/README.md))
|
|
642
|
+
- **[@memberjunction/ai-cli](../AI/AICLI)**: Enables AI agent and action execution ([README](../AI/AICLI/README.md))
|
|
643
|
+
- **[@memberjunction/testing-cli](../TestingFramework/CLI)**: Testing framework for database-driven tests ([README](../TestingFramework/CLI/README.md))
|
|
644
|
+
- **[@memberjunction/db-auto-doc](../DBAutoDoc)**: AI-powered database documentation generator ([README](../DBAutoDoc/README.md))
|
|
345
645
|
- **Generated Entities**: Automatically linked during installation
|
|
346
646
|
- **MJAPI**: Configured and linked during installation
|
|
347
647
|
- **MJExplorer**: UI configuration handled during installation
|
|
@@ -390,6 +690,9 @@ Run any command with the `--verbose` flag for detailed logging:
|
|
|
390
690
|
```bash
|
|
391
691
|
mj install --verbose
|
|
392
692
|
mj codegen --verbose
|
|
693
|
+
mj ai agents run -a "My Agent" -p "My prompt" --verbose
|
|
694
|
+
mj test run <test-id> --verbose
|
|
695
|
+
mj dbdoc analyze --verbose
|
|
393
696
|
```
|
|
394
697
|
|
|
395
698
|
## License
|
|
@@ -20,10 +20,8 @@ class Clean extends core_1.Command {
|
|
|
20
20
|
async run() {
|
|
21
21
|
const parsed = await this.parse(Clean);
|
|
22
22
|
this.flags = parsed.flags;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
const flywayConfig = await (0, config_1.getFlywayConfig)(config_1.config);
|
|
23
|
+
const config = (0, config_1.getValidatedConfig)();
|
|
24
|
+
const flywayConfig = await (0, config_1.getFlywayConfig)(config);
|
|
27
25
|
const flyway = new node_flyway_1.Flyway(flywayConfig);
|
|
28
26
|
this.log('Resetting MJ database to pre-installation state');
|
|
29
27
|
this.log('Note that users and roles have not been dropped');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
-
export default class
|
|
2
|
+
export default class DbDocAnalyze extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
resume: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
config: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
8
|
};
|
|
9
9
|
run(): Promise<void>;
|
|
10
10
|
}
|
|
@@ -22,64 +22,41 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
26
|
const core_1 = require("@oclif/core");
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const db_auto_doc_1 = require("@memberjunction/db-auto-doc");
|
|
33
|
-
dotenv.config();
|
|
34
|
-
class Analyze extends core_1.Command {
|
|
35
|
-
static description = 'Analyze database and generate documentation';
|
|
27
|
+
class DbDocAnalyze extends core_1.Command {
|
|
28
|
+
static description = 'Analyze database and generate documentation (delegates to db-auto-doc analyze)';
|
|
36
29
|
static examples = [
|
|
37
30
|
'<%= config.bin %> <%= command.id %>',
|
|
38
|
-
'<%= config.bin %> <%= command.id %> --
|
|
39
|
-
'<%= config.bin %> <%= command.id %> --
|
|
31
|
+
'<%= config.bin %> <%= command.id %> --resume ./output/run-6/state.json',
|
|
32
|
+
'<%= config.bin %> <%= command.id %> --config ./my-config.json',
|
|
40
33
|
];
|
|
41
34
|
static flags = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
schemas: core_1.Flags.string({
|
|
47
|
-
description: 'Comma-separated schema list',
|
|
35
|
+
resume: core_1.Flags.string({
|
|
36
|
+
char: 'r',
|
|
37
|
+
description: 'Resume from an existing state file',
|
|
38
|
+
required: false
|
|
48
39
|
}),
|
|
40
|
+
config: core_1.Flags.string({
|
|
41
|
+
char: 'c',
|
|
42
|
+
description: 'Path to config file',
|
|
43
|
+
default: './config.json'
|
|
44
|
+
})
|
|
49
45
|
};
|
|
50
46
|
async run() {
|
|
51
|
-
const { flags } = await this.parse(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const connection = db_auto_doc_1.DatabaseConnection.fromEnv();
|
|
59
|
-
const stateManager = new db_auto_doc_1.StateManager();
|
|
60
|
-
// Test connection
|
|
61
|
-
const connected = await connection.test();
|
|
62
|
-
if (!connected) {
|
|
63
|
-
this.error('Cannot connect to database');
|
|
64
|
-
}
|
|
65
|
-
// Load state
|
|
66
|
-
await stateManager.load(process.env.DB_SERVER || 'localhost', process.env.DB_DATABASE || 'master');
|
|
67
|
-
const aiClient = new db_auto_doc_1.SimpleAIClient();
|
|
68
|
-
const analyzer = new db_auto_doc_1.DatabaseAnalyzer(connection, stateManager, aiClient);
|
|
69
|
-
const schemas = flags.schemas ? flags.schemas.split(',') : undefined;
|
|
70
|
-
await analyzer.analyze({
|
|
71
|
-
schemas,
|
|
72
|
-
incremental: flags.incremental,
|
|
73
|
-
});
|
|
74
|
-
await connection.close();
|
|
75
|
-
this.log(chalk_1.default.green('\nā
Analysis complete!'));
|
|
76
|
-
this.log('\nNext steps:');
|
|
77
|
-
this.log(' - Review: mj dbdoc review');
|
|
78
|
-
this.log(' - Export: mj dbdoc export');
|
|
47
|
+
const { flags } = await this.parse(DbDocAnalyze);
|
|
48
|
+
// Load DBAutoDoc command dynamically
|
|
49
|
+
const { default: AnalyzeCommand } = await Promise.resolve().then(() => __importStar(require('@memberjunction/db-auto-doc/dist/commands/analyze')));
|
|
50
|
+
// Build args array for DBAutoDoc command
|
|
51
|
+
const args = [];
|
|
52
|
+
if (flags.resume) {
|
|
53
|
+
args.push('--resume', flags.resume);
|
|
79
54
|
}
|
|
80
|
-
|
|
81
|
-
|
|
55
|
+
if (flags.config) {
|
|
56
|
+
args.push('--config', flags.config);
|
|
82
57
|
}
|
|
58
|
+
// Execute the DBAutoDoc analyze command
|
|
59
|
+
await AnalyzeCommand.run(args);
|
|
83
60
|
}
|
|
84
61
|
}
|
|
85
|
-
exports.default =
|
|
62
|
+
exports.default = DbDocAnalyze;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
-
export default class
|
|
2
|
+
export default class DbDocExport extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
-
|
|
7
|
-
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
|
+
'state-file': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
'output-dir': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
sql: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
markdown: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
html: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
csv: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
mermaid: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
report: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
apply: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
15
|
'approved-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
-
|
|
16
|
+
'confidence-threshold': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
17
|
};
|
|
11
18
|
run(): Promise<void>;
|
|
12
19
|
}
|