@memberjunction/cli 5.6.0 → 5.7.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.
@@ -320,6 +320,38 @@
320
320
  "upgrade.js"
321
321
  ]
322
322
  },
323
+ "clean": {
324
+ "aliases": [],
325
+ "args": {},
326
+ "description": "Resets the MemberJunction database to a pre-installation state",
327
+ "examples": [
328
+ "<%= config.bin %> <%= command.id %>\n"
329
+ ],
330
+ "flags": {
331
+ "verbose": {
332
+ "char": "v",
333
+ "description": "Enable additional logging",
334
+ "name": "verbose",
335
+ "allowNo": false,
336
+ "type": "boolean"
337
+ }
338
+ },
339
+ "hasDynamicHelp": false,
340
+ "hiddenAliases": [],
341
+ "id": "clean",
342
+ "pluginAlias": "@memberjunction/cli",
343
+ "pluginName": "@memberjunction/cli",
344
+ "pluginType": "core",
345
+ "strict": true,
346
+ "enableJsonFlag": false,
347
+ "isESM": true,
348
+ "relativePath": [
349
+ "dist",
350
+ "commands",
351
+ "clean",
352
+ "index.js"
353
+ ]
354
+ },
323
355
  "bump": {
324
356
  "aliases": [],
325
357
  "args": {},
@@ -392,17 +424,60 @@
392
424
  "index.js"
393
425
  ]
394
426
  },
395
- "clean": {
427
+ "codegen:5-0-fix-entity-names": {
396
428
  "aliases": [],
397
429
  "args": {},
398
- "description": "Resets the MemberJunction database to a pre-installation state",
430
+ "description": "[v5.0 Migration] Scan TypeScript files for entity names AND class names that need updating.\n\nThree strategies are applied:\n 1. Class name renames (regex) — ActionEntity -> MJActionEntity, ActionSchema -> MJActionSchema,\n ActionEntityExtended -> MJActionEntityExtended (extended subclasses),\n ActionEntityServerEntity -> MJActionEntityServer (server subclass suffix standardization),\n ActionFormComponentExtended -> MJActionFormComponentExtended (Angular form components).\n Explicit subclass mappings (57 entries from subclass-rename-map.json) take priority over\n auto-generated suffix rules, enabling suffix changes (e.g., _Server -> Server, ServerEntity -> Server).\n 2. Multi-word entity name renames (regex) — 'AI Models' -> 'MJ: AI Models'\n 3. Single-word entity name renames (AST) — 'Actions' -> 'MJ: Actions' in GetEntityObject, OpenEntityRecord,\n navigateToEntity, EntityName: assignments, .Name === comparisons, @RegisterClass decorators.\n\nThe rename map (272 entity entries + 57 subclass entries) is built from entity_subclasses.ts @RegisterClass\ndecorators plus embedded rename maps. Runs in dry-run mode by default; use --fix to apply.",
399
431
  "examples": [
400
- "<%= config.bin %> <%= command.id %>\n"
432
+ {
433
+ "description": "Dry-run scan of the packages directory",
434
+ "command": "<%= config.bin %> <%= command.id %> --path packages/"
435
+ },
436
+ {
437
+ "description": "Scan a single file",
438
+ "command": "<%= config.bin %> <%= command.id %> --path packages/Angular/Explorer/dashboards/src/Actions/components/actions-overview.component.ts"
439
+ },
440
+ {
441
+ "description": "Apply fixes across the codebase",
442
+ "command": "<%= config.bin %> <%= command.id %> --path packages/ --fix"
443
+ },
444
+ {
445
+ "description": "Quiet mode (summary only)",
446
+ "command": "<%= config.bin %> <%= command.id %> --path packages/ -q"
447
+ }
401
448
  ],
402
449
  "flags": {
450
+ "path": {
451
+ "char": "p",
452
+ "description": "File or directory to scan. Accepts a single .ts file or a directory (scanned recursively). Defaults to the current working directory.",
453
+ "name": "path",
454
+ "hasDynamicHelp": false,
455
+ "multiple": false,
456
+ "type": "option"
457
+ },
458
+ "fix": {
459
+ "description": "Apply fixes in place. Without this flag, the command runs in dry-run mode and only reports findings.",
460
+ "name": "fix",
461
+ "allowNo": false,
462
+ "type": "boolean"
463
+ },
464
+ "entity-subclasses": {
465
+ "description": "Explicit path to entity_subclasses.ts for building the rename map. If omitted, the tool searches common locations relative to the target path.",
466
+ "name": "entity-subclasses",
467
+ "hasDynamicHelp": false,
468
+ "multiple": false,
469
+ "type": "option"
470
+ },
471
+ "quiet": {
472
+ "char": "q",
473
+ "description": "Suppress detailed per-file output; only show the final summary counts.",
474
+ "name": "quiet",
475
+ "allowNo": false,
476
+ "type": "boolean"
477
+ },
403
478
  "verbose": {
404
479
  "char": "v",
405
- "description": "Enable additional logging",
480
+ "description": "Show detailed progress including each file being scanned.",
406
481
  "name": "verbose",
407
482
  "allowNo": false,
408
483
  "type": "boolean"
@@ -410,7 +485,7 @@
410
485
  },
411
486
  "hasDynamicHelp": false,
412
487
  "hiddenAliases": [],
413
- "id": "clean",
488
+ "id": "codegen:5-0-fix-entity-names",
414
489
  "pluginAlias": "@memberjunction/cli",
415
490
  "pluginName": "@memberjunction/cli",
416
491
  "pluginType": "core",
@@ -420,42 +495,72 @@
420
495
  "relativePath": [
421
496
  "dist",
422
497
  "commands",
423
- "clean",
424
- "index.js"
498
+ "codegen",
499
+ "5-0-fix-entity-names.js"
425
500
  ]
426
501
  },
427
- "dbdoc:analyze": {
502
+ "codegen:5-0-fix-html-entity-names": {
428
503
  "aliases": [],
429
504
  "args": {},
430
- "description": "Analyze database and generate documentation (delegates to db-auto-doc analyze)",
505
+ "description": "[v5.0 Migration] Scan Angular HTML template files for hardcoded entity names that need \"MJ: \" prefix updates.\n\nUses targeted regex patterns to find entity name references in template expressions\nand attribute values. Detects method calls like navigateToEntity('Actions'),\nOpenEntityRecord('Entities', id), and attribute values like RowsEntityName=\"Users\".\nRuns in dry-run mode by default; use --fix to apply.\n\nThe rename map is built dynamically from entity_subclasses.ts by parsing all\n@RegisterClass(BaseEntity, 'MJ: XYZ') decorators (~272 entries).",
431
506
  "examples": [
432
- "<%= config.bin %> <%= command.id %>",
433
- "<%= config.bin %> <%= command.id %> --resume ./output/run-6/state.json",
434
- "<%= config.bin %> <%= command.id %> --config ./my-config.json"
507
+ {
508
+ "description": "Dry-run scan of Angular templates",
509
+ "command": "<%= config.bin %> <%= command.id %> --path packages/Angular/"
510
+ },
511
+ {
512
+ "description": "Apply fixes to HTML templates",
513
+ "command": "<%= config.bin %> <%= command.id %> --path packages/Angular/ --fix"
514
+ },
515
+ {
516
+ "description": "Scan with verbose output",
517
+ "command": "<%= config.bin %> <%= command.id %> --path packages/ -v"
518
+ },
519
+ {
520
+ "description": "Scan a single template file",
521
+ "command": "<%= config.bin %> <%= command.id %> --path packages/Angular/Explorer/dashboards/src/Actions/actions-dashboard.component.html"
522
+ }
435
523
  ],
436
524
  "flags": {
437
- "resume": {
438
- "char": "r",
439
- "description": "Resume from an existing state file",
440
- "name": "resume",
441
- "required": false,
525
+ "path": {
526
+ "char": "p",
527
+ "description": "File or directory to scan. Accepts a single .html file or a directory (scanned recursively). Defaults to the current working directory.",
528
+ "name": "path",
442
529
  "hasDynamicHelp": false,
443
530
  "multiple": false,
444
531
  "type": "option"
445
532
  },
446
- "config": {
447
- "char": "c",
448
- "description": "Path to config file",
449
- "name": "config",
450
- "default": "./config.json",
533
+ "fix": {
534
+ "description": "Apply fixes in place. Without this flag, the command runs in dry-run mode and only reports findings.",
535
+ "name": "fix",
536
+ "allowNo": false,
537
+ "type": "boolean"
538
+ },
539
+ "entity-subclasses": {
540
+ "description": "Explicit path to entity_subclasses.ts for building the rename map. If omitted, the tool searches common locations relative to the target path.",
541
+ "name": "entity-subclasses",
451
542
  "hasDynamicHelp": false,
452
543
  "multiple": false,
453
544
  "type": "option"
545
+ },
546
+ "quiet": {
547
+ "char": "q",
548
+ "description": "Suppress detailed per-file output; only show the final summary counts.",
549
+ "name": "quiet",
550
+ "allowNo": false,
551
+ "type": "boolean"
552
+ },
553
+ "verbose": {
554
+ "char": "v",
555
+ "description": "Show detailed progress including each file being scanned.",
556
+ "name": "verbose",
557
+ "allowNo": false,
558
+ "type": "boolean"
454
559
  }
455
560
  },
456
561
  "hasDynamicHelp": false,
457
562
  "hiddenAliases": [],
458
- "id": "dbdoc:analyze",
563
+ "id": "codegen:5-0-fix-html-entity-names",
459
564
  "pluginAlias": "@memberjunction/cli",
460
565
  "pluginName": "@memberjunction/cli",
461
566
  "pluginType": "core",
@@ -465,105 +570,72 @@
465
570
  "relativePath": [
466
571
  "dist",
467
572
  "commands",
468
- "dbdoc",
469
- "analyze.js"
573
+ "codegen",
574
+ "5-0-fix-html-entity-names.js"
470
575
  ]
471
576
  },
472
- "dbdoc:export-sample-queries": {
577
+ "codegen:5-0-fix-metadata-names": {
473
578
  "aliases": [],
474
579
  "args": {},
475
- "description": "Export sample queries to MemberJunction metadata format (delegates to db-auto-doc export-sample-queries)",
580
+ "description": "[v5.0 Migration] Scan metadata JSON files for entity names that need \"MJ: \" prefix updates.\n\nTargets the metadata/ directory used by \"mj sync\". Detects entity name references in\n@lookup: directives (both the entity name and lookup value), .mj-sync.json and\n.mj-folder.json config files (entity/entityName fields), relatedEntities object keys,\nand fields.Name values in Entities-managing folders. Runs in dry-run mode by default;\nuse --fix to apply.\n\nThe rename map is built dynamically from entity_subclasses.ts by parsing all\n@RegisterClass(BaseEntity, 'MJ: XYZ') decorators (~272 entries).",
476
581
  "examples": [
477
- "<%= config.bin %> <%= command.id %> --input ./output/sample-queries.json --output ./metadata/queries/.queries.json",
478
- "<%= config.bin %> <%= command.id %> --input ./sample-queries.json --output ./metadata/queries/.queries.json --separate-sql-files",
479
- "<%= config.bin %> <%= command.id %> --input ./sample-queries.json --output ./queries/.queries.json --category \"Database Documentation\"",
480
- "<%= config.bin %> <%= command.id %> --input ./sample-queries.json --output ./queries/.queries.json --status Pending --min-confidence 0.8"
582
+ {
583
+ "description": "Dry-run scan of the metadata directory",
584
+ "command": "<%= config.bin %> <%= command.id %> --path metadata/"
585
+ },
586
+ {
587
+ "description": "Apply fixes to metadata files",
588
+ "command": "<%= config.bin %> <%= command.id %> --path metadata/ --fix"
589
+ },
590
+ {
591
+ "description": "Scan a specific subdirectory",
592
+ "command": "<%= config.bin %> <%= command.id %> --path metadata/resource-types"
593
+ },
594
+ {
595
+ "description": "Scan and fix a single metadata file",
596
+ "command": "<%= config.bin %> <%= command.id %> --path metadata/entities/.audit-related-entities.json --fix"
597
+ }
481
598
  ],
482
599
  "flags": {
483
- "input": {
484
- "char": "i",
485
- "description": "Path to sample-queries.json file generated by generate-queries command",
486
- "name": "input",
487
- "required": true,
488
- "hasDynamicHelp": false,
489
- "multiple": false,
490
- "type": "option"
491
- },
492
- "output": {
493
- "char": "o",
494
- "description": "Output path for the .queries.json metadata file",
495
- "name": "output",
496
- "required": true,
600
+ "path": {
601
+ "char": "p",
602
+ "description": "File or directory to scan. Accepts a single .json file or a directory (scanned recursively, including dotfiles like .mj-sync.json). Defaults to the current working directory.",
603
+ "name": "path",
497
604
  "hasDynamicHelp": false,
498
605
  "multiple": false,
499
606
  "type": "option"
500
607
  },
501
- "separate-sql-files": {
502
- "description": "Write SQL to separate files and use @file: references",
503
- "name": "separate-sql-files",
608
+ "fix": {
609
+ "description": "Apply fixes in place. Without this flag, the command runs in dry-run mode and only reports findings.",
610
+ "name": "fix",
504
611
  "allowNo": false,
505
612
  "type": "boolean"
506
613
  },
507
- "sql-dir": {
508
- "description": "Directory for SQL files when using --separate-sql-files (relative to output file)",
509
- "name": "sql-dir",
510
- "default": "SQL",
511
- "hasDynamicHelp": false,
512
- "multiple": false,
513
- "type": "option"
514
- },
515
- "category": {
516
- "description": "Category name for @lookup reference (e.g., \"Database Documentation\")",
517
- "name": "category",
518
- "required": false,
519
- "hasDynamicHelp": false,
520
- "multiple": false,
521
- "type": "option"
522
- },
523
- "status": {
524
- "description": "Status to assign to exported queries",
525
- "name": "status",
526
- "default": "Pending",
527
- "hasDynamicHelp": false,
528
- "multiple": false,
529
- "options": [
530
- "Approved",
531
- "Pending",
532
- "Rejected",
533
- "Expired"
534
- ],
535
- "type": "option"
536
- },
537
- "min-confidence": {
538
- "description": "Minimum confidence threshold to export (0-1)",
539
- "name": "min-confidence",
540
- "default": "0",
614
+ "entity-subclasses": {
615
+ "description": "Explicit path to entity_subclasses.ts for building the rename map. If omitted, the tool searches common locations relative to the target path.",
616
+ "name": "entity-subclasses",
541
617
  "hasDynamicHelp": false,
542
618
  "multiple": false,
543
619
  "type": "option"
544
620
  },
545
- "validated-only": {
546
- "description": "Only export queries that were successfully validated",
547
- "name": "validated-only",
621
+ "quiet": {
622
+ "char": "q",
623
+ "description": "Suppress detailed per-file output; only show the final summary counts.",
624
+ "name": "quiet",
548
625
  "allowNo": false,
549
626
  "type": "boolean"
550
627
  },
551
- "append": {
552
- "description": "Append to existing metadata file instead of overwriting",
553
- "name": "append",
554
- "allowNo": false,
555
- "type": "boolean"
556
- },
557
- "include-primary-key": {
558
- "description": "Include primaryKey and sync fields (for updating existing records)",
559
- "name": "include-primary-key",
628
+ "verbose": {
629
+ "char": "v",
630
+ "description": "Show detailed progress including each file being scanned.",
631
+ "name": "verbose",
560
632
  "allowNo": false,
561
633
  "type": "boolean"
562
634
  }
563
635
  },
564
636
  "hasDynamicHelp": false,
565
637
  "hiddenAliases": [],
566
- "id": "dbdoc:export-sample-queries",
638
+ "id": "codegen:5-0-fix-metadata-names",
567
639
  "pluginAlias": "@memberjunction/cli",
568
640
  "pluginName": "@memberjunction/cli",
569
641
  "pluginType": "core",
@@ -573,100 +645,35 @@
573
645
  "relativePath": [
574
646
  "dist",
575
647
  "commands",
576
- "dbdoc",
577
- "export-sample-queries.js"
648
+ "codegen",
649
+ "5-0-fix-metadata-names.js"
578
650
  ]
579
651
  },
580
- "dbdoc:export": {
652
+ "codegen": {
581
653
  "aliases": [],
582
654
  "args": {},
583
- "description": "Export documentation in multiple formats (delegates to db-auto-doc export)",
655
+ "description": "Run the full MemberJunction code generation pipeline.\n\nAnalyzes your SQL Server database schema, updates MemberJunction metadata, and\ngenerates synchronized code across the entire stack:\n\n - SQL views, stored procedures, indexes, and permissions\n - TypeScript entity classes with Zod validation schemas\n - Angular form components with AI-driven layouts\n - GraphQL resolvers and type definitions\n - Action subclasses and DB schema JSON\n\nConfiguration is loaded from mj.config.cjs in the current directory (or parent\ndirectories). Database connection can also be set via environment variables:\nDB_HOST, DB_DATABASE, CODEGEN_DB_USERNAME, CODEGEN_DB_PASSWORD.\n\nUse --skipdb to skip all database operations (metadata sync, SQL object\ngeneration) and only regenerate TypeScript, Angular, and GraphQL output from\nexisting metadata.",
584
656
  "examples": [
585
- "<%= config.bin %> <%= command.id %> --state-file=./db-doc-state.json",
586
- "<%= config.bin %> <%= command.id %> --sql",
587
- "<%= config.bin %> <%= command.id %> --markdown",
588
- "<%= config.bin %> <%= command.id %> --html",
589
- "<%= config.bin %> <%= command.id %> --csv",
590
- "<%= config.bin %> <%= command.id %> --mermaid",
591
- "<%= config.bin %> <%= command.id %> --sql --markdown --html --csv --mermaid --apply"
657
+ {
658
+ "command": "<%= config.bin %> <%= command.id %>",
659
+ "description": "Run the full code generation pipeline"
660
+ },
661
+ {
662
+ "command": "<%= config.bin %> <%= command.id %> --skipdb",
663
+ "description": "Regenerate code files without touching the database"
664
+ }
592
665
  ],
593
666
  "flags": {
594
- "state-file": {
595
- "char": "s",
596
- "description": "Path to state JSON file",
597
- "name": "state-file",
598
- "hasDynamicHelp": false,
599
- "multiple": false,
600
- "type": "option"
601
- },
602
- "output-dir": {
603
- "char": "o",
604
- "description": "Output directory for generated files",
605
- "name": "output-dir",
606
- "hasDynamicHelp": false,
607
- "multiple": false,
608
- "type": "option"
609
- },
610
- "sql": {
611
- "description": "Generate SQL script",
612
- "name": "sql",
613
- "allowNo": false,
614
- "type": "boolean"
615
- },
616
- "markdown": {
617
- "description": "Generate Markdown documentation",
618
- "name": "markdown",
619
- "allowNo": false,
620
- "type": "boolean"
621
- },
622
- "html": {
623
- "description": "Generate interactive HTML documentation",
624
- "name": "html",
625
- "allowNo": false,
626
- "type": "boolean"
627
- },
628
- "csv": {
629
- "description": "Generate CSV exports (tables and columns)",
630
- "name": "csv",
631
- "allowNo": false,
632
- "type": "boolean"
633
- },
634
- "mermaid": {
635
- "description": "Generate Mermaid ERD diagram files",
636
- "name": "mermaid",
637
- "allowNo": false,
638
- "type": "boolean"
639
- },
640
- "report": {
641
- "description": "Generate analysis report",
642
- "name": "report",
643
- "allowNo": false,
644
- "type": "boolean"
645
- },
646
- "apply": {
647
- "description": "Apply SQL to database",
648
- "name": "apply",
649
- "allowNo": false,
650
- "type": "boolean"
651
- },
652
- "approved-only": {
653
- "description": "Only export approved items",
654
- "name": "approved-only",
667
+ "skipdb": {
668
+ "description": "Skip database operations (metadata sync, SQL generation). Only regenerate TypeScript entities, Angular components, and GraphQL resolvers from existing metadata.",
669
+ "name": "skipdb",
655
670
  "allowNo": false,
656
671
  "type": "boolean"
657
- },
658
- "confidence-threshold": {
659
- "description": "Minimum confidence threshold",
660
- "name": "confidence-threshold",
661
- "default": "0",
662
- "hasDynamicHelp": false,
663
- "multiple": false,
664
- "type": "option"
665
672
  }
666
673
  },
667
674
  "hasDynamicHelp": false,
668
675
  "hiddenAliases": [],
669
- "id": "dbdoc:export",
676
+ "id": "codegen",
670
677
  "pluginAlias": "@memberjunction/cli",
671
678
  "pluginName": "@memberjunction/cli",
672
679
  "pluginType": "core",
@@ -676,87 +683,84 @@
676
683
  "relativePath": [
677
684
  "dist",
678
685
  "commands",
679
- "dbdoc",
680
- "export.js"
686
+ "codegen",
687
+ "index.js"
681
688
  ]
682
689
  },
683
- "dbdoc:generate-queries": {
690
+ "codegen:manifest": {
684
691
  "aliases": [],
685
692
  "args": {},
686
- "description": "Generate sample SQL queries from existing analysis state (delegates to db-auto-doc generate-queries)",
693
+ "description": "Generate a class registration manifest to prevent tree-shaking.\n\nMemberJunction uses @RegisterClass decorators with a dynamic class factory.\nModern bundlers (ESBuild, Vite) cannot detect dynamic instantiation and will\ntree-shake these classes out of production builds. This command scans the\ndependency tree for all @RegisterClass-decorated classes and emits a manifest\nfile with static imports that the bundler cannot eliminate.\n\nTypically used as a prebuild/prestart script for MJAPI and MJExplorer. For\nMJ distribution users, pre-built manifests ship inside @memberjunction/server-bootstrap\nand @memberjunction/ng-bootstrap -- use --exclude-packages @memberjunction to\ngenerate a supplemental manifest covering only your own application classes.",
687
694
  "examples": [
688
- "<%= config.bin %> <%= command.id %> --from-state ./output/run-1/state.json",
689
- "<%= config.bin %> <%= command.id %> --from-state ./output/run-1/state.json --output-dir ./queries",
690
- "<%= config.bin %> <%= command.id %> --from-state ./output/run-1/state.json --queries-per-table 10"
695
+ {
696
+ "command": "<%= config.bin %> <%= command.id %>",
697
+ "description": "Generate manifest with default output path"
698
+ },
699
+ {
700
+ "command": "<%= config.bin %> <%= command.id %> --appDir ./packages/MJAPI --output ./packages/MJAPI/src/generated/class-registrations-manifest.ts",
701
+ "description": "Generate manifest for a specific application directory"
702
+ },
703
+ {
704
+ "command": "<%= config.bin %> <%= command.id %> --exclude-packages @memberjunction",
705
+ "description": "Exclude MJ packages (use pre-built bootstrap manifests instead)"
706
+ },
707
+ {
708
+ "command": "<%= config.bin %> <%= command.id %> --filter BaseEngine --filter BaseAction --verbose",
709
+ "description": "Only include specific base classes with detailed progress"
710
+ }
691
711
  ],
692
712
  "flags": {
693
- "from-state": {
694
- "description": "Path to existing state.json file from previous analysis",
695
- "name": "from-state",
696
- "required": true,
713
+ "output": {
714
+ "char": "o",
715
+ "description": "Output file path for the generated manifest. The file will contain named imports and a CLASS_REGISTRATIONS array.",
716
+ "name": "output",
717
+ "default": "./src/generated/class-registrations-manifest.ts",
697
718
  "hasDynamicHelp": false,
698
719
  "multiple": false,
699
720
  "type": "option"
700
721
  },
701
- "output-dir": {
702
- "description": "Output directory for generated queries",
703
- "name": "output-dir",
704
- "required": false,
722
+ "appDir": {
723
+ "char": "a",
724
+ "description": "Root directory of the application whose package.json dependency tree will be scanned. Defaults to the current working directory.",
725
+ "name": "appDir",
705
726
  "hasDynamicHelp": false,
706
727
  "multiple": false,
707
728
  "type": "option"
708
729
  },
709
- "config": {
710
- "char": "c",
711
- "description": "Path to config file (for database connection and AI settings)",
712
- "name": "config",
713
- "default": "./config.json",
730
+ "filter": {
731
+ "char": "f",
732
+ "description": "Only include classes extending this base class. Can be repeated (e.g., --filter BaseEngine --filter BaseAction).",
733
+ "name": "filter",
714
734
  "hasDynamicHelp": false,
715
- "multiple": false,
735
+ "multiple": true,
716
736
  "type": "option"
717
737
  },
718
- "queries-per-table": {
719
- "description": "Number of queries to generate per table",
720
- "name": "queries-per-table",
721
- "required": false,
738
+ "exclude-packages": {
739
+ "char": "e",
740
+ "description": "Skip packages whose name starts with this prefix. Useful for excluding @memberjunction packages when using pre-built bootstrap manifests. Can be repeated.",
741
+ "name": "exclude-packages",
722
742
  "hasDynamicHelp": false,
723
- "multiple": false,
743
+ "multiple": true,
724
744
  "type": "option"
725
745
  },
726
- "max-execution-time": {
727
- "description": "Maximum execution time for query validation (ms)",
728
- "name": "max-execution-time",
729
- "required": false,
730
- "hasDynamicHelp": false,
731
- "multiple": false,
732
- "type": "option"
746
+ "quiet": {
747
+ "char": "q",
748
+ "description": "Suppress all output except errors.",
749
+ "name": "quiet",
750
+ "allowNo": false,
751
+ "type": "boolean"
752
+ },
753
+ "verbose": {
754
+ "char": "v",
755
+ "description": "Show detailed progress including per-package scanning info and skipped classes.",
756
+ "name": "verbose",
757
+ "allowNo": false,
758
+ "type": "boolean"
733
759
  }
734
760
  },
735
761
  "hasDynamicHelp": false,
736
762
  "hiddenAliases": [],
737
- "id": "dbdoc:generate-queries",
738
- "pluginAlias": "@memberjunction/cli",
739
- "pluginName": "@memberjunction/cli",
740
- "pluginType": "core",
741
- "strict": true,
742
- "enableJsonFlag": false,
743
- "isESM": true,
744
- "relativePath": [
745
- "dist",
746
- "commands",
747
- "dbdoc",
748
- "generate-queries.js"
749
- ]
750
- },
751
- "dbdoc": {
752
- "aliases": [],
753
- "args": {},
754
- "description": "AI-powered database documentation generator",
755
- "flags": {},
756
- "hasDynamicHelp": false,
757
- "hidden": false,
758
- "hiddenAliases": [],
759
- "id": "dbdoc",
763
+ "id": "codegen:manifest",
760
764
  "pluginAlias": "@memberjunction/cli",
761
765
  "pluginName": "@memberjunction/cli",
762
766
  "pluginType": "core",
@@ -766,21 +770,39 @@
766
770
  "relativePath": [
767
771
  "dist",
768
772
  "commands",
769
- "dbdoc",
770
- "index.js"
773
+ "codegen",
774
+ "manifest.js"
771
775
  ]
772
776
  },
773
- "dbdoc:init": {
777
+ "doctor": {
774
778
  "aliases": [],
775
779
  "args": {},
776
- "description": "Initialize DBAutoDoc project (delegates to db-auto-doc init)",
780
+ "description": "Diagnose a MemberJunction installation",
777
781
  "examples": [
778
- "<%= config.bin %> <%= command.id %>"
782
+ "<%= config.bin %> <%= command.id %>",
783
+ "<%= config.bin %> <%= command.id %> --dir ./my-mj-project",
784
+ "<%= config.bin %> <%= command.id %> --verbose"
779
785
  ],
780
- "flags": {},
786
+ "flags": {
787
+ "dir": {
788
+ "description": "Target directory to diagnose",
789
+ "name": "dir",
790
+ "default": ".",
791
+ "hasDynamicHelp": false,
792
+ "multiple": false,
793
+ "type": "option"
794
+ },
795
+ "verbose": {
796
+ "char": "v",
797
+ "description": "Show detailed output including suggested fixes inline",
798
+ "name": "verbose",
799
+ "allowNo": false,
800
+ "type": "boolean"
801
+ }
802
+ },
781
803
  "hasDynamicHelp": false,
782
804
  "hiddenAliases": [],
783
- "id": "dbdoc:init",
805
+ "id": "doctor",
784
806
  "pluginAlias": "@memberjunction/cli",
785
807
  "pluginName": "@memberjunction/cli",
786
808
  "pluginType": "core",
@@ -790,30 +812,42 @@
790
812
  "relativePath": [
791
813
  "dist",
792
814
  "commands",
793
- "dbdoc",
794
- "init.js"
815
+ "doctor",
816
+ "index.js"
795
817
  ]
796
818
  },
797
- "dbdoc:reset": {
819
+ "dbdoc:analyze": {
798
820
  "aliases": [],
799
821
  "args": {},
800
- "description": "Reset analysis state (delegates to db-auto-doc reset)",
822
+ "description": "Analyze database and generate documentation (delegates to db-auto-doc analyze)",
801
823
  "examples": [
802
824
  "<%= config.bin %> <%= command.id %>",
803
- "<%= config.bin %> <%= command.id %> --force"
825
+ "<%= config.bin %> <%= command.id %> --resume ./output/run-6/state.json",
826
+ "<%= config.bin %> <%= command.id %> --config ./my-config.json"
804
827
  ],
805
828
  "flags": {
806
- "force": {
807
- "char": "f",
808
- "description": "Force reset without confirmation",
809
- "name": "force",
810
- "allowNo": false,
811
- "type": "boolean"
829
+ "resume": {
830
+ "char": "r",
831
+ "description": "Resume from an existing state file",
832
+ "name": "resume",
833
+ "required": false,
834
+ "hasDynamicHelp": false,
835
+ "multiple": false,
836
+ "type": "option"
837
+ },
838
+ "config": {
839
+ "char": "c",
840
+ "description": "Path to config file",
841
+ "name": "config",
842
+ "default": "./config.json",
843
+ "hasDynamicHelp": false,
844
+ "multiple": false,
845
+ "type": "option"
812
846
  }
813
847
  },
814
848
  "hasDynamicHelp": false,
815
849
  "hiddenAliases": [],
816
- "id": "dbdoc:reset",
850
+ "id": "dbdoc:analyze",
817
851
  "pluginAlias": "@memberjunction/cli",
818
852
  "pluginName": "@memberjunction/cli",
819
853
  "pluginType": "core",
@@ -824,105 +858,104 @@
824
858
  "dist",
825
859
  "commands",
826
860
  "dbdoc",
827
- "reset.js"
861
+ "analyze.js"
828
862
  ]
829
863
  },
830
- "dbdoc:status": {
864
+ "dbdoc:export-sample-queries": {
831
865
  "aliases": [],
832
866
  "args": {},
833
- "description": "Show analysis status and progress (delegates to db-auto-doc status)",
867
+ "description": "Export sample queries to MemberJunction metadata format (delegates to db-auto-doc export-sample-queries)",
834
868
  "examples": [
835
- "<%= config.bin %> <%= command.id %>",
836
- "<%= config.bin %> <%= command.id %> --state-file ./custom-state.json"
869
+ "<%= config.bin %> <%= command.id %> --input ./output/sample-queries.json --output ./metadata/queries/.queries.json",
870
+ "<%= config.bin %> <%= command.id %> --input ./sample-queries.json --output ./metadata/queries/.queries.json --separate-sql-files",
871
+ "<%= config.bin %> <%= command.id %> --input ./sample-queries.json --output ./queries/.queries.json --category \"Database Documentation\"",
872
+ "<%= config.bin %> <%= command.id %> --input ./sample-queries.json --output ./queries/.queries.json --status Pending --min-confidence 0.8"
837
873
  ],
838
874
  "flags": {
839
- "state-file": {
840
- "char": "s",
841
- "description": "Path to state JSON file",
842
- "name": "state-file",
875
+ "input": {
876
+ "char": "i",
877
+ "description": "Path to sample-queries.json file generated by generate-queries command",
878
+ "name": "input",
879
+ "required": true,
843
880
  "hasDynamicHelp": false,
844
881
  "multiple": false,
845
882
  "type": "option"
846
- }
847
- },
848
- "hasDynamicHelp": false,
849
- "hiddenAliases": [],
850
- "id": "dbdoc:status",
851
- "pluginAlias": "@memberjunction/cli",
852
- "pluginName": "@memberjunction/cli",
853
- "pluginType": "core",
854
- "strict": true,
855
- "enableJsonFlag": false,
856
- "isESM": true,
857
- "relativePath": [
858
- "dist",
859
- "commands",
860
- "dbdoc",
861
- "status.js"
862
- ]
863
- },
864
- "codegen:5-0-fix-entity-names": {
865
- "aliases": [],
866
- "args": {},
867
- "description": "[v5.0 Migration] Scan TypeScript files for entity names AND class names that need updating.\n\nThree strategies are applied:\n 1. Class name renames (regex) — ActionEntity -> MJActionEntity, ActionSchema -> MJActionSchema,\n ActionEntityExtended -> MJActionEntityExtended (extended subclasses),\n ActionEntityServerEntity -> MJActionEntityServer (server subclass suffix standardization),\n ActionFormComponentExtended -> MJActionFormComponentExtended (Angular form components).\n Explicit subclass mappings (57 entries from subclass-rename-map.json) take priority over\n auto-generated suffix rules, enabling suffix changes (e.g., _Server -> Server, ServerEntity -> Server).\n 2. Multi-word entity name renames (regex) — 'AI Models' -> 'MJ: AI Models'\n 3. Single-word entity name renames (AST) — 'Actions' -> 'MJ: Actions' in GetEntityObject, OpenEntityRecord,\n navigateToEntity, EntityName: assignments, .Name === comparisons, @RegisterClass decorators.\n\nThe rename map (272 entity entries + 57 subclass entries) is built from entity_subclasses.ts @RegisterClass\ndecorators plus embedded rename maps. Runs in dry-run mode by default; use --fix to apply.",
868
- "examples": [
869
- {
870
- "description": "Dry-run scan of the packages directory",
871
- "command": "<%= config.bin %> <%= command.id %> --path packages/"
872
883
  },
873
- {
874
- "description": "Scan a single file",
875
- "command": "<%= config.bin %> <%= command.id %> --path packages/Angular/Explorer/dashboards/src/Actions/components/actions-overview.component.ts"
876
- },
877
- {
878
- "description": "Apply fixes across the codebase",
879
- "command": "<%= config.bin %> <%= command.id %> --path packages/ --fix"
880
- },
881
- {
882
- "description": "Quiet mode (summary only)",
883
- "command": "<%= config.bin %> <%= command.id %> --path packages/ -q"
884
- }
885
- ],
886
- "flags": {
887
- "path": {
888
- "char": "p",
889
- "description": "File or directory to scan. Accepts a single .ts file or a directory (scanned recursively). Defaults to the current working directory.",
890
- "name": "path",
884
+ "output": {
885
+ "char": "o",
886
+ "description": "Output path for the .queries.json metadata file",
887
+ "name": "output",
888
+ "required": true,
891
889
  "hasDynamicHelp": false,
892
890
  "multiple": false,
893
891
  "type": "option"
894
892
  },
895
- "fix": {
896
- "description": "Apply fixes in place. Without this flag, the command runs in dry-run mode and only reports findings.",
897
- "name": "fix",
893
+ "separate-sql-files": {
894
+ "description": "Write SQL to separate files and use @file: references",
895
+ "name": "separate-sql-files",
898
896
  "allowNo": false,
899
897
  "type": "boolean"
900
898
  },
901
- "entity-subclasses": {
902
- "description": "Explicit path to entity_subclasses.ts for building the rename map. If omitted, the tool searches common locations relative to the target path.",
903
- "name": "entity-subclasses",
899
+ "sql-dir": {
900
+ "description": "Directory for SQL files when using --separate-sql-files (relative to output file)",
901
+ "name": "sql-dir",
902
+ "default": "SQL",
904
903
  "hasDynamicHelp": false,
905
904
  "multiple": false,
906
905
  "type": "option"
907
906
  },
908
- "quiet": {
909
- "char": "q",
910
- "description": "Suppress detailed per-file output; only show the final summary counts.",
911
- "name": "quiet",
907
+ "category": {
908
+ "description": "Category name for @lookup reference (e.g., \"Database Documentation\")",
909
+ "name": "category",
910
+ "required": false,
911
+ "hasDynamicHelp": false,
912
+ "multiple": false,
913
+ "type": "option"
914
+ },
915
+ "status": {
916
+ "description": "Status to assign to exported queries",
917
+ "name": "status",
918
+ "default": "Pending",
919
+ "hasDynamicHelp": false,
920
+ "multiple": false,
921
+ "options": [
922
+ "Approved",
923
+ "Pending",
924
+ "Rejected",
925
+ "Expired"
926
+ ],
927
+ "type": "option"
928
+ },
929
+ "min-confidence": {
930
+ "description": "Minimum confidence threshold to export (0-1)",
931
+ "name": "min-confidence",
932
+ "default": "0",
933
+ "hasDynamicHelp": false,
934
+ "multiple": false,
935
+ "type": "option"
936
+ },
937
+ "validated-only": {
938
+ "description": "Only export queries that were successfully validated",
939
+ "name": "validated-only",
912
940
  "allowNo": false,
913
941
  "type": "boolean"
914
942
  },
915
- "verbose": {
916
- "char": "v",
917
- "description": "Show detailed progress including each file being scanned.",
918
- "name": "verbose",
943
+ "append": {
944
+ "description": "Append to existing metadata file instead of overwriting",
945
+ "name": "append",
946
+ "allowNo": false,
947
+ "type": "boolean"
948
+ },
949
+ "include-primary-key": {
950
+ "description": "Include primaryKey and sync fields (for updating existing records)",
951
+ "name": "include-primary-key",
919
952
  "allowNo": false,
920
953
  "type": "boolean"
921
954
  }
922
955
  },
923
956
  "hasDynamicHelp": false,
924
957
  "hiddenAliases": [],
925
- "id": "codegen:5-0-fix-entity-names",
958
+ "id": "dbdoc:export-sample-queries",
926
959
  "pluginAlias": "@memberjunction/cli",
927
960
  "pluginName": "@memberjunction/cli",
928
961
  "pluginType": "core",
@@ -932,72 +965,100 @@
932
965
  "relativePath": [
933
966
  "dist",
934
967
  "commands",
935
- "codegen",
936
- "5-0-fix-entity-names.js"
968
+ "dbdoc",
969
+ "export-sample-queries.js"
937
970
  ]
938
971
  },
939
- "codegen:5-0-fix-html-entity-names": {
972
+ "dbdoc:export": {
940
973
  "aliases": [],
941
974
  "args": {},
942
- "description": "[v5.0 Migration] Scan Angular HTML template files for hardcoded entity names that need \"MJ: \" prefix updates.\n\nUses targeted regex patterns to find entity name references in template expressions\nand attribute values. Detects method calls like navigateToEntity('Actions'),\nOpenEntityRecord('Entities', id), and attribute values like RowsEntityName=\"Users\".\nRuns in dry-run mode by default; use --fix to apply.\n\nThe rename map is built dynamically from entity_subclasses.ts by parsing all\n@RegisterClass(BaseEntity, 'MJ: XYZ') decorators (~272 entries).",
975
+ "description": "Export documentation in multiple formats (delegates to db-auto-doc export)",
943
976
  "examples": [
944
- {
945
- "description": "Dry-run scan of Angular templates",
946
- "command": "<%= config.bin %> <%= command.id %> --path packages/Angular/"
947
- },
948
- {
949
- "description": "Apply fixes to HTML templates",
950
- "command": "<%= config.bin %> <%= command.id %> --path packages/Angular/ --fix"
951
- },
952
- {
953
- "description": "Scan with verbose output",
954
- "command": "<%= config.bin %> <%= command.id %> --path packages/ -v"
955
- },
956
- {
957
- "description": "Scan a single template file",
958
- "command": "<%= config.bin %> <%= command.id %> --path packages/Angular/Explorer/dashboards/src/Actions/actions-dashboard.component.html"
959
- }
977
+ "<%= config.bin %> <%= command.id %> --state-file=./db-doc-state.json",
978
+ "<%= config.bin %> <%= command.id %> --sql",
979
+ "<%= config.bin %> <%= command.id %> --markdown",
980
+ "<%= config.bin %> <%= command.id %> --html",
981
+ "<%= config.bin %> <%= command.id %> --csv",
982
+ "<%= config.bin %> <%= command.id %> --mermaid",
983
+ "<%= config.bin %> <%= command.id %> --sql --markdown --html --csv --mermaid --apply"
960
984
  ],
961
985
  "flags": {
962
- "path": {
963
- "char": "p",
964
- "description": "File or directory to scan. Accepts a single .html file or a directory (scanned recursively). Defaults to the current working directory.",
965
- "name": "path",
986
+ "state-file": {
987
+ "char": "s",
988
+ "description": "Path to state JSON file",
989
+ "name": "state-file",
966
990
  "hasDynamicHelp": false,
967
991
  "multiple": false,
968
992
  "type": "option"
969
993
  },
970
- "fix": {
971
- "description": "Apply fixes in place. Without this flag, the command runs in dry-run mode and only reports findings.",
972
- "name": "fix",
973
- "allowNo": false,
974
- "type": "boolean"
975
- },
976
- "entity-subclasses": {
977
- "description": "Explicit path to entity_subclasses.ts for building the rename map. If omitted, the tool searches common locations relative to the target path.",
978
- "name": "entity-subclasses",
994
+ "output-dir": {
995
+ "char": "o",
996
+ "description": "Output directory for generated files",
997
+ "name": "output-dir",
979
998
  "hasDynamicHelp": false,
980
999
  "multiple": false,
981
1000
  "type": "option"
982
1001
  },
983
- "quiet": {
984
- "char": "q",
985
- "description": "Suppress detailed per-file output; only show the final summary counts.",
986
- "name": "quiet",
1002
+ "sql": {
1003
+ "description": "Generate SQL script",
1004
+ "name": "sql",
987
1005
  "allowNo": false,
988
1006
  "type": "boolean"
989
1007
  },
990
- "verbose": {
991
- "char": "v",
992
- "description": "Show detailed progress including each file being scanned.",
993
- "name": "verbose",
1008
+ "markdown": {
1009
+ "description": "Generate Markdown documentation",
1010
+ "name": "markdown",
1011
+ "allowNo": false,
1012
+ "type": "boolean"
1013
+ },
1014
+ "html": {
1015
+ "description": "Generate interactive HTML documentation",
1016
+ "name": "html",
1017
+ "allowNo": false,
1018
+ "type": "boolean"
1019
+ },
1020
+ "csv": {
1021
+ "description": "Generate CSV exports (tables and columns)",
1022
+ "name": "csv",
1023
+ "allowNo": false,
1024
+ "type": "boolean"
1025
+ },
1026
+ "mermaid": {
1027
+ "description": "Generate Mermaid ERD diagram files",
1028
+ "name": "mermaid",
1029
+ "allowNo": false,
1030
+ "type": "boolean"
1031
+ },
1032
+ "report": {
1033
+ "description": "Generate analysis report",
1034
+ "name": "report",
994
1035
  "allowNo": false,
995
1036
  "type": "boolean"
1037
+ },
1038
+ "apply": {
1039
+ "description": "Apply SQL to database",
1040
+ "name": "apply",
1041
+ "allowNo": false,
1042
+ "type": "boolean"
1043
+ },
1044
+ "approved-only": {
1045
+ "description": "Only export approved items",
1046
+ "name": "approved-only",
1047
+ "allowNo": false,
1048
+ "type": "boolean"
1049
+ },
1050
+ "confidence-threshold": {
1051
+ "description": "Minimum confidence threshold",
1052
+ "name": "confidence-threshold",
1053
+ "default": "0",
1054
+ "hasDynamicHelp": false,
1055
+ "multiple": false,
1056
+ "type": "option"
996
1057
  }
997
1058
  },
998
1059
  "hasDynamicHelp": false,
999
1060
  "hiddenAliases": [],
1000
- "id": "codegen:5-0-fix-html-entity-names",
1061
+ "id": "dbdoc:export",
1001
1062
  "pluginAlias": "@memberjunction/cli",
1002
1063
  "pluginName": "@memberjunction/cli",
1003
1064
  "pluginType": "core",
@@ -1007,72 +1068,65 @@
1007
1068
  "relativePath": [
1008
1069
  "dist",
1009
1070
  "commands",
1010
- "codegen",
1011
- "5-0-fix-html-entity-names.js"
1071
+ "dbdoc",
1072
+ "export.js"
1012
1073
  ]
1013
1074
  },
1014
- "codegen:5-0-fix-metadata-names": {
1075
+ "dbdoc:generate-queries": {
1015
1076
  "aliases": [],
1016
1077
  "args": {},
1017
- "description": "[v5.0 Migration] Scan metadata JSON files for entity names that need \"MJ: \" prefix updates.\n\nTargets the metadata/ directory used by \"mj sync\". Detects entity name references in\n@lookup: directives (both the entity name and lookup value), .mj-sync.json and\n.mj-folder.json config files (entity/entityName fields), relatedEntities object keys,\nand fields.Name values in Entities-managing folders. Runs in dry-run mode by default;\nuse --fix to apply.\n\nThe rename map is built dynamically from entity_subclasses.ts by parsing all\n@RegisterClass(BaseEntity, 'MJ: XYZ') decorators (~272 entries).",
1078
+ "description": "Generate sample SQL queries from existing analysis state (delegates to db-auto-doc generate-queries)",
1018
1079
  "examples": [
1019
- {
1020
- "description": "Dry-run scan of the metadata directory",
1021
- "command": "<%= config.bin %> <%= command.id %> --path metadata/"
1022
- },
1023
- {
1024
- "description": "Apply fixes to metadata files",
1025
- "command": "<%= config.bin %> <%= command.id %> --path metadata/ --fix"
1026
- },
1027
- {
1028
- "description": "Scan a specific subdirectory",
1029
- "command": "<%= config.bin %> <%= command.id %> --path metadata/resource-types"
1030
- },
1031
- {
1032
- "description": "Scan and fix a single metadata file",
1033
- "command": "<%= config.bin %> <%= command.id %> --path metadata/entities/.audit-related-entities.json --fix"
1034
- }
1080
+ "<%= config.bin %> <%= command.id %> --from-state ./output/run-1/state.json",
1081
+ "<%= config.bin %> <%= command.id %> --from-state ./output/run-1/state.json --output-dir ./queries",
1082
+ "<%= config.bin %> <%= command.id %> --from-state ./output/run-1/state.json --queries-per-table 10"
1035
1083
  ],
1036
1084
  "flags": {
1037
- "path": {
1038
- "char": "p",
1039
- "description": "File or directory to scan. Accepts a single .json file or a directory (scanned recursively, including dotfiles like .mj-sync.json). Defaults to the current working directory.",
1040
- "name": "path",
1085
+ "from-state": {
1086
+ "description": "Path to existing state.json file from previous analysis",
1087
+ "name": "from-state",
1088
+ "required": true,
1041
1089
  "hasDynamicHelp": false,
1042
1090
  "multiple": false,
1043
1091
  "type": "option"
1044
1092
  },
1045
- "fix": {
1046
- "description": "Apply fixes in place. Without this flag, the command runs in dry-run mode and only reports findings.",
1047
- "name": "fix",
1048
- "allowNo": false,
1049
- "type": "boolean"
1093
+ "output-dir": {
1094
+ "description": "Output directory for generated queries",
1095
+ "name": "output-dir",
1096
+ "required": false,
1097
+ "hasDynamicHelp": false,
1098
+ "multiple": false,
1099
+ "type": "option"
1050
1100
  },
1051
- "entity-subclasses": {
1052
- "description": "Explicit path to entity_subclasses.ts for building the rename map. If omitted, the tool searches common locations relative to the target path.",
1053
- "name": "entity-subclasses",
1101
+ "config": {
1102
+ "char": "c",
1103
+ "description": "Path to config file (for database connection and AI settings)",
1104
+ "name": "config",
1105
+ "default": "./config.json",
1054
1106
  "hasDynamicHelp": false,
1055
1107
  "multiple": false,
1056
1108
  "type": "option"
1057
1109
  },
1058
- "quiet": {
1059
- "char": "q",
1060
- "description": "Suppress detailed per-file output; only show the final summary counts.",
1061
- "name": "quiet",
1062
- "allowNo": false,
1063
- "type": "boolean"
1110
+ "queries-per-table": {
1111
+ "description": "Number of queries to generate per table",
1112
+ "name": "queries-per-table",
1113
+ "required": false,
1114
+ "hasDynamicHelp": false,
1115
+ "multiple": false,
1116
+ "type": "option"
1064
1117
  },
1065
- "verbose": {
1066
- "char": "v",
1067
- "description": "Show detailed progress including each file being scanned.",
1068
- "name": "verbose",
1069
- "allowNo": false,
1070
- "type": "boolean"
1118
+ "max-execution-time": {
1119
+ "description": "Maximum execution time for query validation (ms)",
1120
+ "name": "max-execution-time",
1121
+ "required": false,
1122
+ "hasDynamicHelp": false,
1123
+ "multiple": false,
1124
+ "type": "option"
1071
1125
  }
1072
1126
  },
1073
1127
  "hasDynamicHelp": false,
1074
1128
  "hiddenAliases": [],
1075
- "id": "codegen:5-0-fix-metadata-names",
1129
+ "id": "dbdoc:generate-queries",
1076
1130
  "pluginAlias": "@memberjunction/cli",
1077
1131
  "pluginName": "@memberjunction/cli",
1078
1132
  "pluginType": "core",
@@ -1082,35 +1136,43 @@
1082
1136
  "relativePath": [
1083
1137
  "dist",
1084
1138
  "commands",
1085
- "codegen",
1086
- "5-0-fix-metadata-names.js"
1139
+ "dbdoc",
1140
+ "generate-queries.js"
1087
1141
  ]
1088
1142
  },
1089
- "codegen": {
1143
+ "dbdoc": {
1090
1144
  "aliases": [],
1091
1145
  "args": {},
1092
- "description": "Run the full MemberJunction code generation pipeline.\n\nAnalyzes your SQL Server database schema, updates MemberJunction metadata, and\ngenerates synchronized code across the entire stack:\n\n - SQL views, stored procedures, indexes, and permissions\n - TypeScript entity classes with Zod validation schemas\n - Angular form components with AI-driven layouts\n - GraphQL resolvers and type definitions\n - Action subclasses and DB schema JSON\n\nConfiguration is loaded from mj.config.cjs in the current directory (or parent\ndirectories). Database connection can also be set via environment variables:\nDB_HOST, DB_DATABASE, CODEGEN_DB_USERNAME, CODEGEN_DB_PASSWORD.\n\nUse --skipdb to skip all database operations (metadata sync, SQL object\ngeneration) and only regenerate TypeScript, Angular, and GraphQL output from\nexisting metadata.",
1093
- "examples": [
1094
- {
1095
- "command": "<%= config.bin %> <%= command.id %>",
1096
- "description": "Run the full code generation pipeline"
1097
- },
1098
- {
1099
- "command": "<%= config.bin %> <%= command.id %> --skipdb",
1100
- "description": "Regenerate code files without touching the database"
1101
- }
1146
+ "description": "AI-powered database documentation generator",
1147
+ "flags": {},
1148
+ "hasDynamicHelp": false,
1149
+ "hidden": false,
1150
+ "hiddenAliases": [],
1151
+ "id": "dbdoc",
1152
+ "pluginAlias": "@memberjunction/cli",
1153
+ "pluginName": "@memberjunction/cli",
1154
+ "pluginType": "core",
1155
+ "strict": true,
1156
+ "enableJsonFlag": false,
1157
+ "isESM": true,
1158
+ "relativePath": [
1159
+ "dist",
1160
+ "commands",
1161
+ "dbdoc",
1162
+ "index.js"
1163
+ ]
1164
+ },
1165
+ "dbdoc:init": {
1166
+ "aliases": [],
1167
+ "args": {},
1168
+ "description": "Initialize DBAutoDoc project (delegates to db-auto-doc init)",
1169
+ "examples": [
1170
+ "<%= config.bin %> <%= command.id %>"
1102
1171
  ],
1103
- "flags": {
1104
- "skipdb": {
1105
- "description": "Skip database operations (metadata sync, SQL generation). Only regenerate TypeScript entities, Angular components, and GraphQL resolvers from existing metadata.",
1106
- "name": "skipdb",
1107
- "allowNo": false,
1108
- "type": "boolean"
1109
- }
1110
- },
1172
+ "flags": {},
1111
1173
  "hasDynamicHelp": false,
1112
1174
  "hiddenAliases": [],
1113
- "id": "codegen",
1175
+ "id": "dbdoc:init",
1114
1176
  "pluginAlias": "@memberjunction/cli",
1115
1177
  "pluginName": "@memberjunction/cli",
1116
1178
  "pluginType": "core",
@@ -1120,84 +1182,30 @@
1120
1182
  "relativePath": [
1121
1183
  "dist",
1122
1184
  "commands",
1123
- "codegen",
1124
- "index.js"
1185
+ "dbdoc",
1186
+ "init.js"
1125
1187
  ]
1126
1188
  },
1127
- "codegen:manifest": {
1189
+ "dbdoc:reset": {
1128
1190
  "aliases": [],
1129
1191
  "args": {},
1130
- "description": "Generate a class registration manifest to prevent tree-shaking.\n\nMemberJunction uses @RegisterClass decorators with a dynamic class factory.\nModern bundlers (ESBuild, Vite) cannot detect dynamic instantiation and will\ntree-shake these classes out of production builds. This command scans the\ndependency tree for all @RegisterClass-decorated classes and emits a manifest\nfile with static imports that the bundler cannot eliminate.\n\nTypically used as a prebuild/prestart script for MJAPI and MJExplorer. For\nMJ distribution users, pre-built manifests ship inside @memberjunction/server-bootstrap\nand @memberjunction/ng-bootstrap -- use --exclude-packages @memberjunction to\ngenerate a supplemental manifest covering only your own application classes.",
1192
+ "description": "Reset analysis state (delegates to db-auto-doc reset)",
1131
1193
  "examples": [
1132
- {
1133
- "command": "<%= config.bin %> <%= command.id %>",
1134
- "description": "Generate manifest with default output path"
1135
- },
1136
- {
1137
- "command": "<%= config.bin %> <%= command.id %> --appDir ./packages/MJAPI --output ./packages/MJAPI/src/generated/class-registrations-manifest.ts",
1138
- "description": "Generate manifest for a specific application directory"
1139
- },
1140
- {
1141
- "command": "<%= config.bin %> <%= command.id %> --exclude-packages @memberjunction",
1142
- "description": "Exclude MJ packages (use pre-built bootstrap manifests instead)"
1143
- },
1144
- {
1145
- "command": "<%= config.bin %> <%= command.id %> --filter BaseEngine --filter BaseAction --verbose",
1146
- "description": "Only include specific base classes with detailed progress"
1147
- }
1194
+ "<%= config.bin %> <%= command.id %>",
1195
+ "<%= config.bin %> <%= command.id %> --force"
1148
1196
  ],
1149
1197
  "flags": {
1150
- "output": {
1151
- "char": "o",
1152
- "description": "Output file path for the generated manifest. The file will contain named imports and a CLASS_REGISTRATIONS array.",
1153
- "name": "output",
1154
- "default": "./src/generated/class-registrations-manifest.ts",
1155
- "hasDynamicHelp": false,
1156
- "multiple": false,
1157
- "type": "option"
1158
- },
1159
- "appDir": {
1160
- "char": "a",
1161
- "description": "Root directory of the application whose package.json dependency tree will be scanned. Defaults to the current working directory.",
1162
- "name": "appDir",
1163
- "hasDynamicHelp": false,
1164
- "multiple": false,
1165
- "type": "option"
1166
- },
1167
- "filter": {
1198
+ "force": {
1168
1199
  "char": "f",
1169
- "description": "Only include classes extending this base class. Can be repeated (e.g., --filter BaseEngine --filter BaseAction).",
1170
- "name": "filter",
1171
- "hasDynamicHelp": false,
1172
- "multiple": true,
1173
- "type": "option"
1174
- },
1175
- "exclude-packages": {
1176
- "char": "e",
1177
- "description": "Skip packages whose name starts with this prefix. Useful for excluding @memberjunction packages when using pre-built bootstrap manifests. Can be repeated.",
1178
- "name": "exclude-packages",
1179
- "hasDynamicHelp": false,
1180
- "multiple": true,
1181
- "type": "option"
1182
- },
1183
- "quiet": {
1184
- "char": "q",
1185
- "description": "Suppress all output except errors.",
1186
- "name": "quiet",
1187
- "allowNo": false,
1188
- "type": "boolean"
1189
- },
1190
- "verbose": {
1191
- "char": "v",
1192
- "description": "Show detailed progress including per-package scanning info and skipped classes.",
1193
- "name": "verbose",
1200
+ "description": "Force reset without confirmation",
1201
+ "name": "force",
1194
1202
  "allowNo": false,
1195
1203
  "type": "boolean"
1196
1204
  }
1197
1205
  },
1198
1206
  "hasDynamicHelp": false,
1199
1207
  "hiddenAliases": [],
1200
- "id": "codegen:manifest",
1208
+ "id": "dbdoc:reset",
1201
1209
  "pluginAlias": "@memberjunction/cli",
1202
1210
  "pluginName": "@memberjunction/cli",
1203
1211
  "pluginType": "core",
@@ -1207,39 +1215,31 @@
1207
1215
  "relativePath": [
1208
1216
  "dist",
1209
1217
  "commands",
1210
- "codegen",
1211
- "manifest.js"
1218
+ "dbdoc",
1219
+ "reset.js"
1212
1220
  ]
1213
1221
  },
1214
- "doctor": {
1222
+ "dbdoc:status": {
1215
1223
  "aliases": [],
1216
1224
  "args": {},
1217
- "description": "Diagnose a MemberJunction installation",
1225
+ "description": "Show analysis status and progress (delegates to db-auto-doc status)",
1218
1226
  "examples": [
1219
1227
  "<%= config.bin %> <%= command.id %>",
1220
- "<%= config.bin %> <%= command.id %> --dir ./my-mj-project",
1221
- "<%= config.bin %> <%= command.id %> --verbose"
1228
+ "<%= config.bin %> <%= command.id %> --state-file ./custom-state.json"
1222
1229
  ],
1223
1230
  "flags": {
1224
- "dir": {
1225
- "description": "Target directory to diagnose",
1226
- "name": "dir",
1227
- "default": ".",
1231
+ "state-file": {
1232
+ "char": "s",
1233
+ "description": "Path to state JSON file",
1234
+ "name": "state-file",
1228
1235
  "hasDynamicHelp": false,
1229
1236
  "multiple": false,
1230
1237
  "type": "option"
1231
- },
1232
- "verbose": {
1233
- "char": "v",
1234
- "description": "Show detailed output including suggested fixes inline",
1235
- "name": "verbose",
1236
- "allowNo": false,
1237
- "type": "boolean"
1238
1238
  }
1239
1239
  },
1240
1240
  "hasDynamicHelp": false,
1241
1241
  "hiddenAliases": [],
1242
- "id": "doctor",
1242
+ "id": "dbdoc:status",
1243
1243
  "pluginAlias": "@memberjunction/cli",
1244
1244
  "pluginName": "@memberjunction/cli",
1245
1245
  "pluginType": "core",
@@ -1249,8 +1249,8 @@
1249
1249
  "relativePath": [
1250
1250
  "dist",
1251
1251
  "commands",
1252
- "doctor",
1253
- "index.js"
1252
+ "dbdoc",
1253
+ "status.js"
1254
1254
  ]
1255
1255
  },
1256
1256
  "install": {
@@ -1628,73 +1628,6 @@
1628
1628
  "validate.js"
1629
1629
  ]
1630
1630
  },
1631
- "sql-audit": {
1632
- "aliases": [],
1633
- "args": {},
1634
- "description": "Compare source and target databases for migration verification",
1635
- "examples": [
1636
- "<%= config.bin %> sql-audit --source \"mssql://sa:pass@host/db\" --target \"postgres://user:pass@host:5432/db\"",
1637
- "<%= config.bin %> sql-audit --source \"mssql://sa:pass@host/db\" --target \"postgres://user:pass@host:5432/db\" --output report.txt",
1638
- "<%= config.bin %> sql-audit --source \"mssql://sa:pass@host/db\" --target \"postgres://user:pass@host:5432/db\" --source-schema __mj --target-schema __mj"
1639
- ],
1640
- "flags": {
1641
- "source": {
1642
- "description": "Source database connection string (mssql://... or postgres://...)",
1643
- "name": "source",
1644
- "required": true,
1645
- "hasDynamicHelp": false,
1646
- "multiple": false,
1647
- "type": "option"
1648
- },
1649
- "target": {
1650
- "description": "Target database connection string (mssql://... or postgres://...)",
1651
- "name": "target",
1652
- "required": true,
1653
- "hasDynamicHelp": false,
1654
- "multiple": false,
1655
- "type": "option"
1656
- },
1657
- "source-schema": {
1658
- "description": "Source schema name",
1659
- "name": "source-schema",
1660
- "default": "__mj",
1661
- "hasDynamicHelp": false,
1662
- "multiple": false,
1663
- "type": "option"
1664
- },
1665
- "target-schema": {
1666
- "description": "Target schema name",
1667
- "name": "target-schema",
1668
- "default": "__mj",
1669
- "hasDynamicHelp": false,
1670
- "multiple": false,
1671
- "type": "option"
1672
- },
1673
- "output": {
1674
- "char": "o",
1675
- "description": "Save report to file",
1676
- "name": "output",
1677
- "hasDynamicHelp": false,
1678
- "multiple": false,
1679
- "type": "option"
1680
- }
1681
- },
1682
- "hasDynamicHelp": false,
1683
- "hiddenAliases": [],
1684
- "id": "sql-audit",
1685
- "pluginAlias": "@memberjunction/cli",
1686
- "pluginName": "@memberjunction/cli",
1687
- "pluginType": "core",
1688
- "strict": true,
1689
- "enableJsonFlag": false,
1690
- "isESM": true,
1691
- "relativePath": [
1692
- "dist",
1693
- "commands",
1694
- "sql-audit",
1695
- "index.js"
1696
- ]
1697
- },
1698
1631
  "sql-convert": {
1699
1632
  "aliases": [],
1700
1633
  "args": {
@@ -2896,6 +2829,73 @@
2896
2829
  "index.js"
2897
2830
  ]
2898
2831
  },
2832
+ "sql-audit": {
2833
+ "aliases": [],
2834
+ "args": {},
2835
+ "description": "Compare source and target databases for migration verification",
2836
+ "examples": [
2837
+ "<%= config.bin %> sql-audit --source \"mssql://sa:pass@host/db\" --target \"postgres://user:pass@host:5432/db\"",
2838
+ "<%= config.bin %> sql-audit --source \"mssql://sa:pass@host/db\" --target \"postgres://user:pass@host:5432/db\" --output report.txt",
2839
+ "<%= config.bin %> sql-audit --source \"mssql://sa:pass@host/db\" --target \"postgres://user:pass@host:5432/db\" --source-schema __mj --target-schema __mj"
2840
+ ],
2841
+ "flags": {
2842
+ "source": {
2843
+ "description": "Source database connection string (mssql://... or postgres://...)",
2844
+ "name": "source",
2845
+ "required": true,
2846
+ "hasDynamicHelp": false,
2847
+ "multiple": false,
2848
+ "type": "option"
2849
+ },
2850
+ "target": {
2851
+ "description": "Target database connection string (mssql://... or postgres://...)",
2852
+ "name": "target",
2853
+ "required": true,
2854
+ "hasDynamicHelp": false,
2855
+ "multiple": false,
2856
+ "type": "option"
2857
+ },
2858
+ "source-schema": {
2859
+ "description": "Source schema name",
2860
+ "name": "source-schema",
2861
+ "default": "__mj",
2862
+ "hasDynamicHelp": false,
2863
+ "multiple": false,
2864
+ "type": "option"
2865
+ },
2866
+ "target-schema": {
2867
+ "description": "Target schema name",
2868
+ "name": "target-schema",
2869
+ "default": "__mj",
2870
+ "hasDynamicHelp": false,
2871
+ "multiple": false,
2872
+ "type": "option"
2873
+ },
2874
+ "output": {
2875
+ "char": "o",
2876
+ "description": "Save report to file",
2877
+ "name": "output",
2878
+ "hasDynamicHelp": false,
2879
+ "multiple": false,
2880
+ "type": "option"
2881
+ }
2882
+ },
2883
+ "hasDynamicHelp": false,
2884
+ "hiddenAliases": [],
2885
+ "id": "sql-audit",
2886
+ "pluginAlias": "@memberjunction/cli",
2887
+ "pluginName": "@memberjunction/cli",
2888
+ "pluginType": "core",
2889
+ "strict": true,
2890
+ "enableJsonFlag": false,
2891
+ "isESM": true,
2892
+ "relativePath": [
2893
+ "dist",
2894
+ "commands",
2895
+ "sql-audit",
2896
+ "index.js"
2897
+ ]
2898
+ },
2899
2899
  "ai:actions:list": {
2900
2900
  "aliases": [],
2901
2901
  "args": {},
@@ -3504,5 +3504,5 @@
3504
3504
  ]
3505
3505
  }
3506
3506
  },
3507
- "version": "5.6.0"
3507
+ "version": "5.7.0"
3508
3508
  }