@living-architecture/riviere-cli 0.7.23 → 0.7.25

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.
Files changed (3) hide show
  1. package/dist/bin.js +320 -8
  2. package/dist/index.js +320 -8
  3. package/package.json +6 -6
package/dist/bin.js CHANGED
@@ -25389,6 +25389,241 @@ var extraction_config_schema_default = {
25389
25389
  },
25390
25390
  where: {
25391
25391
  $ref: "#/$defs/predicate"
25392
+ },
25393
+ extract: {
25394
+ $ref: "#/$defs/extractBlock",
25395
+ description: "Extraction rules for metadata fields"
25396
+ }
25397
+ }
25398
+ },
25399
+ extractBlock: {
25400
+ type: "object",
25401
+ description: "Extraction rules mapping field names to extraction rules",
25402
+ additionalProperties: {
25403
+ $ref: "#/$defs/extractionRule"
25404
+ }
25405
+ },
25406
+ extractionRule: {
25407
+ oneOf: [
25408
+ { $ref: "#/$defs/literalExtractionRule" },
25409
+ { $ref: "#/$defs/fromClassNameExtractionRule" },
25410
+ { $ref: "#/$defs/fromMethodNameExtractionRule" },
25411
+ { $ref: "#/$defs/fromFilePathExtractionRule" },
25412
+ { $ref: "#/$defs/fromPropertyExtractionRule" },
25413
+ { $ref: "#/$defs/fromDecoratorArgExtractionRule" },
25414
+ { $ref: "#/$defs/fromDecoratorNameExtractionRule" },
25415
+ { $ref: "#/$defs/fromGenericArgExtractionRule" },
25416
+ { $ref: "#/$defs/fromMethodSignatureExtractionRule" },
25417
+ { $ref: "#/$defs/fromConstructorParamsExtractionRule" },
25418
+ { $ref: "#/$defs/fromParameterTypeExtractionRule" }
25419
+ ]
25420
+ },
25421
+ fromMethodNameExtractionRule: {
25422
+ type: "object",
25423
+ description: "Extracts value from the method name",
25424
+ required: ["fromMethodName"],
25425
+ additionalProperties: false,
25426
+ properties: {
25427
+ fromMethodName: {
25428
+ oneOf: [
25429
+ { type: "boolean", const: true },
25430
+ {
25431
+ type: "object",
25432
+ additionalProperties: false,
25433
+ properties: {
25434
+ transform: { $ref: "#/$defs/transform" }
25435
+ }
25436
+ }
25437
+ ]
25438
+ }
25439
+ }
25440
+ },
25441
+ fromFilePathExtractionRule: {
25442
+ type: "object",
25443
+ description: "Extracts value from the file path using regex capture",
25444
+ required: ["fromFilePath"],
25445
+ additionalProperties: false,
25446
+ properties: {
25447
+ fromFilePath: {
25448
+ type: "object",
25449
+ required: ["pattern", "capture"],
25450
+ additionalProperties: false,
25451
+ properties: {
25452
+ pattern: { type: "string", minLength: 1 },
25453
+ capture: { type: "integer", minimum: 0 },
25454
+ transform: { $ref: "#/$defs/transform" }
25455
+ }
25456
+ }
25457
+ }
25458
+ },
25459
+ fromPropertyExtractionRule: {
25460
+ type: "object",
25461
+ description: "Extracts value from a class property",
25462
+ required: ["fromProperty"],
25463
+ additionalProperties: false,
25464
+ properties: {
25465
+ fromProperty: {
25466
+ type: "object",
25467
+ required: ["name", "kind"],
25468
+ additionalProperties: false,
25469
+ properties: {
25470
+ name: { type: "string", minLength: 1 },
25471
+ kind: { type: "string", enum: ["static", "instance"] },
25472
+ transform: { $ref: "#/$defs/transform" }
25473
+ }
25474
+ }
25475
+ }
25476
+ },
25477
+ fromDecoratorArgExtractionRule: {
25478
+ type: "object",
25479
+ description: "Extracts value from decorator argument",
25480
+ required: ["fromDecoratorArg"],
25481
+ additionalProperties: false,
25482
+ properties: {
25483
+ fromDecoratorArg: {
25484
+ type: "object",
25485
+ additionalProperties: false,
25486
+ minProperties: 1,
25487
+ properties: {
25488
+ position: { type: "integer", minimum: 0 },
25489
+ name: { type: "string", minLength: 1 },
25490
+ transform: { $ref: "#/$defs/transform" }
25491
+ }
25492
+ }
25493
+ }
25494
+ },
25495
+ fromDecoratorNameExtractionRule: {
25496
+ type: "object",
25497
+ description: "Extracts value from the decorator name itself",
25498
+ required: ["fromDecoratorName"],
25499
+ additionalProperties: false,
25500
+ properties: {
25501
+ fromDecoratorName: {
25502
+ oneOf: [
25503
+ { type: "boolean", const: true },
25504
+ {
25505
+ type: "object",
25506
+ additionalProperties: false,
25507
+ properties: {
25508
+ mapping: {
25509
+ type: "object",
25510
+ additionalProperties: { type: "string" },
25511
+ minProperties: 1
25512
+ },
25513
+ transform: { $ref: "#/$defs/transform" }
25514
+ }
25515
+ }
25516
+ ]
25517
+ }
25518
+ }
25519
+ },
25520
+ fromGenericArgExtractionRule: {
25521
+ type: "object",
25522
+ description: "Extracts value from generic type argument",
25523
+ required: ["fromGenericArg"],
25524
+ additionalProperties: false,
25525
+ properties: {
25526
+ fromGenericArg: {
25527
+ type: "object",
25528
+ required: ["interface", "position"],
25529
+ additionalProperties: false,
25530
+ properties: {
25531
+ interface: { type: "string", minLength: 1 },
25532
+ position: { type: "integer", minimum: 0 },
25533
+ transform: { $ref: "#/$defs/transform" }
25534
+ }
25535
+ }
25536
+ }
25537
+ },
25538
+ fromMethodSignatureExtractionRule: {
25539
+ type: "object",
25540
+ description: "Extracts method parameters and return type",
25541
+ required: ["fromMethodSignature"],
25542
+ additionalProperties: false,
25543
+ properties: {
25544
+ fromMethodSignature: {
25545
+ type: "boolean",
25546
+ const: true
25547
+ }
25548
+ }
25549
+ },
25550
+ fromConstructorParamsExtractionRule: {
25551
+ type: "object",
25552
+ description: "Extracts constructor parameter names and types",
25553
+ required: ["fromConstructorParams"],
25554
+ additionalProperties: false,
25555
+ properties: {
25556
+ fromConstructorParams: {
25557
+ type: "boolean",
25558
+ const: true
25559
+ }
25560
+ }
25561
+ },
25562
+ fromParameterTypeExtractionRule: {
25563
+ type: "object",
25564
+ description: "Extracts type name of parameter at position",
25565
+ required: ["fromParameterType"],
25566
+ additionalProperties: false,
25567
+ properties: {
25568
+ fromParameterType: {
25569
+ type: "object",
25570
+ required: ["position"],
25571
+ additionalProperties: false,
25572
+ properties: {
25573
+ position: { type: "integer", minimum: 0 },
25574
+ transform: { $ref: "#/$defs/transform" }
25575
+ }
25576
+ }
25577
+ }
25578
+ },
25579
+ fromClassNameExtractionRule: {
25580
+ type: "object",
25581
+ description: "Extracts value from the class name",
25582
+ required: ["fromClassName"],
25583
+ additionalProperties: false,
25584
+ properties: {
25585
+ fromClassName: {
25586
+ oneOf: [
25587
+ { type: "boolean", const: true },
25588
+ {
25589
+ type: "object",
25590
+ additionalProperties: false,
25591
+ properties: {
25592
+ transform: { $ref: "#/$defs/transform" }
25593
+ }
25594
+ }
25595
+ ],
25596
+ description: "Extract from class name, optionally with transform"
25597
+ }
25598
+ }
25599
+ },
25600
+ transform: {
25601
+ type: "object",
25602
+ description: "Transform operations to apply to extracted value",
25603
+ additionalProperties: false,
25604
+ minProperties: 1,
25605
+ properties: {
25606
+ stripSuffix: { type: "string", minLength: 1 },
25607
+ stripPrefix: { type: "string", minLength: 1 },
25608
+ toLowerCase: { type: "boolean", const: true },
25609
+ toUpperCase: { type: "boolean", const: true },
25610
+ kebabToPascal: { type: "boolean", const: true },
25611
+ pascalToKebab: { type: "boolean", const: true }
25612
+ }
25613
+ },
25614
+ literalExtractionRule: {
25615
+ type: "object",
25616
+ description: "Extracts a hardcoded literal value",
25617
+ required: ["literal"],
25618
+ additionalProperties: false,
25619
+ properties: {
25620
+ literal: {
25621
+ oneOf: [
25622
+ { type: "string", minLength: 1 },
25623
+ { type: "boolean" },
25624
+ { type: "number" }
25625
+ ],
25626
+ description: "Literal value to use for this field"
25392
25627
  }
25393
25628
  }
25394
25629
  },
@@ -25613,6 +25848,22 @@ var extraction_config_schema_default = {
25613
25848
  };
25614
25849
 
25615
25850
  // ../riviere-extract-config/dist/validation.js
25851
+ var REQUIRED_FIELDS = {
25852
+ api: ["apiType"],
25853
+ event: ["eventName"],
25854
+ eventHandler: ["subscribedEvents"],
25855
+ domainOp: ["operationName"],
25856
+ ui: ["route"],
25857
+ useCase: []
25858
+ };
25859
+ var COMPONENT_TYPES = [
25860
+ "api",
25861
+ "useCase",
25862
+ "domainOp",
25863
+ "event",
25864
+ "eventHandler",
25865
+ "ui"
25866
+ ];
25616
25867
  var ajv2 = new import_ajv2.default({ allErrors: true });
25617
25868
  (0, import_ajv_formats2.default)(ajv2);
25618
25869
  var validate2 = ajv2.compile(extraction_config_schema_default);
@@ -25644,17 +25895,78 @@ function mapAjvErrors(errors) {
25644
25895
  message: e.message ?? "unknown error"
25645
25896
  }));
25646
25897
  }
25898
+ function isNotUsed(rule) {
25899
+ return rule !== void 0 && "notUsed" in rule && rule.notUsed === true;
25900
+ }
25901
+ function hasDetectionRule(rule) {
25902
+ return rule !== void 0 && "find" in rule && "where" in rule;
25903
+ }
25904
+ function getExtractedFields(rule) {
25905
+ if (!rule || !("extract" in rule) || !rule.extract) {
25906
+ return [];
25907
+ }
25908
+ return Object.keys(rule.extract);
25909
+ }
25910
+ function validateModuleExtractionRules(module, moduleIndex) {
25911
+ const errors = [];
25912
+ for (const componentType of COMPONENT_TYPES) {
25913
+ const rule = module[componentType];
25914
+ if (isNotUsed(rule)) {
25915
+ continue;
25916
+ }
25917
+ if (!hasDetectionRule(rule)) {
25918
+ continue;
25919
+ }
25920
+ const requiredFields = REQUIRED_FIELDS[componentType];
25921
+ if (requiredFields.length === 0) {
25922
+ continue;
25923
+ }
25924
+ const extractedFields = getExtractedFields(rule);
25925
+ const missingFields = requiredFields.filter((field) => !extractedFields.includes(field));
25926
+ if (missingFields.length > 0) {
25927
+ errors.push({
25928
+ path: `/modules/${moduleIndex}/${componentType}`,
25929
+ message: `Missing required extraction rules: ${missingFields.join(", ")}. Add extraction rules to the 'extract' block or use 'notUsed: true' if not extracting ${componentType} components.`
25930
+ });
25931
+ }
25932
+ }
25933
+ return errors;
25934
+ }
25935
+ function validateAllExtractionRules(config2) {
25936
+ return config2.modules.flatMap((module, index) => {
25937
+ if ("$ref" in module) {
25938
+ return [];
25939
+ }
25940
+ return validateModuleExtractionRules(module, index);
25941
+ });
25942
+ }
25943
+ function validateExtractionConfigSchema(data) {
25944
+ const schemaValid = validate2(data) === true;
25945
+ if (!schemaValid) {
25946
+ return {
25947
+ valid: false,
25948
+ errors: mapAjvErrors(validate2.errors)
25949
+ };
25950
+ }
25951
+ return {
25952
+ valid: true,
25953
+ errors: []
25954
+ };
25955
+ }
25647
25956
  function validateExtractionConfig(data) {
25648
- const valid = validate2(data) === true;
25649
- if (valid) {
25957
+ if (!isValidExtractionConfig(data)) {
25958
+ return validateExtractionConfigSchema(data);
25959
+ }
25960
+ const semanticErrors = validateAllExtractionRules(data);
25961
+ if (semanticErrors.length > 0) {
25650
25962
  return {
25651
- valid: true,
25652
- errors: []
25963
+ valid: false,
25964
+ errors: semanticErrors
25653
25965
  };
25654
25966
  }
25655
25967
  return {
25656
- valid: false,
25657
- errors: mapAjvErrors(validate2.errors)
25968
+ valid: true,
25969
+ errors: []
25658
25970
  };
25659
25971
  }
25660
25972
  function formatValidationErrors2(errors) {
@@ -27346,7 +27658,7 @@ function evaluateInClassWith(node, predicate) {
27346
27658
  }
27347
27659
 
27348
27660
  // ../riviere-extract-ts/dist/extractor.js
27349
- var COMPONENT_TYPES = [
27661
+ var COMPONENT_TYPES2 = [
27350
27662
  "api",
27351
27663
  "useCase",
27352
27664
  "domainOp",
@@ -27382,7 +27694,7 @@ function extractFromFile(project, filePath, config2, configDir) {
27382
27694
  return extractFromModule(sourceFile, filePath, matchingModule);
27383
27695
  }
27384
27696
  function extractFromModule(sourceFile, filePath, module) {
27385
- const builtInComponents = COMPONENT_TYPES.flatMap((componentType) => extractComponentType(sourceFile, filePath, module, componentType));
27697
+ const builtInComponents = COMPONENT_TYPES2.flatMap((componentType) => extractComponentType(sourceFile, filePath, module, componentType));
27386
27698
  const customComponents = extractCustomTypes(sourceFile, filePath, module);
27387
27699
  return [...builtInComponents, ...customComponents];
27388
27700
  }
package/dist/index.js CHANGED
@@ -25406,6 +25406,241 @@ var extraction_config_schema_default = {
25406
25406
  },
25407
25407
  where: {
25408
25408
  $ref: "#/$defs/predicate"
25409
+ },
25410
+ extract: {
25411
+ $ref: "#/$defs/extractBlock",
25412
+ description: "Extraction rules for metadata fields"
25413
+ }
25414
+ }
25415
+ },
25416
+ extractBlock: {
25417
+ type: "object",
25418
+ description: "Extraction rules mapping field names to extraction rules",
25419
+ additionalProperties: {
25420
+ $ref: "#/$defs/extractionRule"
25421
+ }
25422
+ },
25423
+ extractionRule: {
25424
+ oneOf: [
25425
+ { $ref: "#/$defs/literalExtractionRule" },
25426
+ { $ref: "#/$defs/fromClassNameExtractionRule" },
25427
+ { $ref: "#/$defs/fromMethodNameExtractionRule" },
25428
+ { $ref: "#/$defs/fromFilePathExtractionRule" },
25429
+ { $ref: "#/$defs/fromPropertyExtractionRule" },
25430
+ { $ref: "#/$defs/fromDecoratorArgExtractionRule" },
25431
+ { $ref: "#/$defs/fromDecoratorNameExtractionRule" },
25432
+ { $ref: "#/$defs/fromGenericArgExtractionRule" },
25433
+ { $ref: "#/$defs/fromMethodSignatureExtractionRule" },
25434
+ { $ref: "#/$defs/fromConstructorParamsExtractionRule" },
25435
+ { $ref: "#/$defs/fromParameterTypeExtractionRule" }
25436
+ ]
25437
+ },
25438
+ fromMethodNameExtractionRule: {
25439
+ type: "object",
25440
+ description: "Extracts value from the method name",
25441
+ required: ["fromMethodName"],
25442
+ additionalProperties: false,
25443
+ properties: {
25444
+ fromMethodName: {
25445
+ oneOf: [
25446
+ { type: "boolean", const: true },
25447
+ {
25448
+ type: "object",
25449
+ additionalProperties: false,
25450
+ properties: {
25451
+ transform: { $ref: "#/$defs/transform" }
25452
+ }
25453
+ }
25454
+ ]
25455
+ }
25456
+ }
25457
+ },
25458
+ fromFilePathExtractionRule: {
25459
+ type: "object",
25460
+ description: "Extracts value from the file path using regex capture",
25461
+ required: ["fromFilePath"],
25462
+ additionalProperties: false,
25463
+ properties: {
25464
+ fromFilePath: {
25465
+ type: "object",
25466
+ required: ["pattern", "capture"],
25467
+ additionalProperties: false,
25468
+ properties: {
25469
+ pattern: { type: "string", minLength: 1 },
25470
+ capture: { type: "integer", minimum: 0 },
25471
+ transform: { $ref: "#/$defs/transform" }
25472
+ }
25473
+ }
25474
+ }
25475
+ },
25476
+ fromPropertyExtractionRule: {
25477
+ type: "object",
25478
+ description: "Extracts value from a class property",
25479
+ required: ["fromProperty"],
25480
+ additionalProperties: false,
25481
+ properties: {
25482
+ fromProperty: {
25483
+ type: "object",
25484
+ required: ["name", "kind"],
25485
+ additionalProperties: false,
25486
+ properties: {
25487
+ name: { type: "string", minLength: 1 },
25488
+ kind: { type: "string", enum: ["static", "instance"] },
25489
+ transform: { $ref: "#/$defs/transform" }
25490
+ }
25491
+ }
25492
+ }
25493
+ },
25494
+ fromDecoratorArgExtractionRule: {
25495
+ type: "object",
25496
+ description: "Extracts value from decorator argument",
25497
+ required: ["fromDecoratorArg"],
25498
+ additionalProperties: false,
25499
+ properties: {
25500
+ fromDecoratorArg: {
25501
+ type: "object",
25502
+ additionalProperties: false,
25503
+ minProperties: 1,
25504
+ properties: {
25505
+ position: { type: "integer", minimum: 0 },
25506
+ name: { type: "string", minLength: 1 },
25507
+ transform: { $ref: "#/$defs/transform" }
25508
+ }
25509
+ }
25510
+ }
25511
+ },
25512
+ fromDecoratorNameExtractionRule: {
25513
+ type: "object",
25514
+ description: "Extracts value from the decorator name itself",
25515
+ required: ["fromDecoratorName"],
25516
+ additionalProperties: false,
25517
+ properties: {
25518
+ fromDecoratorName: {
25519
+ oneOf: [
25520
+ { type: "boolean", const: true },
25521
+ {
25522
+ type: "object",
25523
+ additionalProperties: false,
25524
+ properties: {
25525
+ mapping: {
25526
+ type: "object",
25527
+ additionalProperties: { type: "string" },
25528
+ minProperties: 1
25529
+ },
25530
+ transform: { $ref: "#/$defs/transform" }
25531
+ }
25532
+ }
25533
+ ]
25534
+ }
25535
+ }
25536
+ },
25537
+ fromGenericArgExtractionRule: {
25538
+ type: "object",
25539
+ description: "Extracts value from generic type argument",
25540
+ required: ["fromGenericArg"],
25541
+ additionalProperties: false,
25542
+ properties: {
25543
+ fromGenericArg: {
25544
+ type: "object",
25545
+ required: ["interface", "position"],
25546
+ additionalProperties: false,
25547
+ properties: {
25548
+ interface: { type: "string", minLength: 1 },
25549
+ position: { type: "integer", minimum: 0 },
25550
+ transform: { $ref: "#/$defs/transform" }
25551
+ }
25552
+ }
25553
+ }
25554
+ },
25555
+ fromMethodSignatureExtractionRule: {
25556
+ type: "object",
25557
+ description: "Extracts method parameters and return type",
25558
+ required: ["fromMethodSignature"],
25559
+ additionalProperties: false,
25560
+ properties: {
25561
+ fromMethodSignature: {
25562
+ type: "boolean",
25563
+ const: true
25564
+ }
25565
+ }
25566
+ },
25567
+ fromConstructorParamsExtractionRule: {
25568
+ type: "object",
25569
+ description: "Extracts constructor parameter names and types",
25570
+ required: ["fromConstructorParams"],
25571
+ additionalProperties: false,
25572
+ properties: {
25573
+ fromConstructorParams: {
25574
+ type: "boolean",
25575
+ const: true
25576
+ }
25577
+ }
25578
+ },
25579
+ fromParameterTypeExtractionRule: {
25580
+ type: "object",
25581
+ description: "Extracts type name of parameter at position",
25582
+ required: ["fromParameterType"],
25583
+ additionalProperties: false,
25584
+ properties: {
25585
+ fromParameterType: {
25586
+ type: "object",
25587
+ required: ["position"],
25588
+ additionalProperties: false,
25589
+ properties: {
25590
+ position: { type: "integer", minimum: 0 },
25591
+ transform: { $ref: "#/$defs/transform" }
25592
+ }
25593
+ }
25594
+ }
25595
+ },
25596
+ fromClassNameExtractionRule: {
25597
+ type: "object",
25598
+ description: "Extracts value from the class name",
25599
+ required: ["fromClassName"],
25600
+ additionalProperties: false,
25601
+ properties: {
25602
+ fromClassName: {
25603
+ oneOf: [
25604
+ { type: "boolean", const: true },
25605
+ {
25606
+ type: "object",
25607
+ additionalProperties: false,
25608
+ properties: {
25609
+ transform: { $ref: "#/$defs/transform" }
25610
+ }
25611
+ }
25612
+ ],
25613
+ description: "Extract from class name, optionally with transform"
25614
+ }
25615
+ }
25616
+ },
25617
+ transform: {
25618
+ type: "object",
25619
+ description: "Transform operations to apply to extracted value",
25620
+ additionalProperties: false,
25621
+ minProperties: 1,
25622
+ properties: {
25623
+ stripSuffix: { type: "string", minLength: 1 },
25624
+ stripPrefix: { type: "string", minLength: 1 },
25625
+ toLowerCase: { type: "boolean", const: true },
25626
+ toUpperCase: { type: "boolean", const: true },
25627
+ kebabToPascal: { type: "boolean", const: true },
25628
+ pascalToKebab: { type: "boolean", const: true }
25629
+ }
25630
+ },
25631
+ literalExtractionRule: {
25632
+ type: "object",
25633
+ description: "Extracts a hardcoded literal value",
25634
+ required: ["literal"],
25635
+ additionalProperties: false,
25636
+ properties: {
25637
+ literal: {
25638
+ oneOf: [
25639
+ { type: "string", minLength: 1 },
25640
+ { type: "boolean" },
25641
+ { type: "number" }
25642
+ ],
25643
+ description: "Literal value to use for this field"
25409
25644
  }
25410
25645
  }
25411
25646
  },
@@ -25630,6 +25865,22 @@ var extraction_config_schema_default = {
25630
25865
  };
25631
25866
 
25632
25867
  // ../riviere-extract-config/dist/validation.js
25868
+ var REQUIRED_FIELDS = {
25869
+ api: ["apiType"],
25870
+ event: ["eventName"],
25871
+ eventHandler: ["subscribedEvents"],
25872
+ domainOp: ["operationName"],
25873
+ ui: ["route"],
25874
+ useCase: []
25875
+ };
25876
+ var COMPONENT_TYPES = [
25877
+ "api",
25878
+ "useCase",
25879
+ "domainOp",
25880
+ "event",
25881
+ "eventHandler",
25882
+ "ui"
25883
+ ];
25633
25884
  var ajv2 = new import_ajv2.default({ allErrors: true });
25634
25885
  (0, import_ajv_formats2.default)(ajv2);
25635
25886
  var validate2 = ajv2.compile(extraction_config_schema_default);
@@ -25661,17 +25912,78 @@ function mapAjvErrors(errors) {
25661
25912
  message: e.message ?? "unknown error"
25662
25913
  }));
25663
25914
  }
25915
+ function isNotUsed(rule) {
25916
+ return rule !== void 0 && "notUsed" in rule && rule.notUsed === true;
25917
+ }
25918
+ function hasDetectionRule(rule) {
25919
+ return rule !== void 0 && "find" in rule && "where" in rule;
25920
+ }
25921
+ function getExtractedFields(rule) {
25922
+ if (!rule || !("extract" in rule) || !rule.extract) {
25923
+ return [];
25924
+ }
25925
+ return Object.keys(rule.extract);
25926
+ }
25927
+ function validateModuleExtractionRules(module, moduleIndex) {
25928
+ const errors = [];
25929
+ for (const componentType of COMPONENT_TYPES) {
25930
+ const rule = module[componentType];
25931
+ if (isNotUsed(rule)) {
25932
+ continue;
25933
+ }
25934
+ if (!hasDetectionRule(rule)) {
25935
+ continue;
25936
+ }
25937
+ const requiredFields = REQUIRED_FIELDS[componentType];
25938
+ if (requiredFields.length === 0) {
25939
+ continue;
25940
+ }
25941
+ const extractedFields = getExtractedFields(rule);
25942
+ const missingFields = requiredFields.filter((field) => !extractedFields.includes(field));
25943
+ if (missingFields.length > 0) {
25944
+ errors.push({
25945
+ path: `/modules/${moduleIndex}/${componentType}`,
25946
+ message: `Missing required extraction rules: ${missingFields.join(", ")}. Add extraction rules to the 'extract' block or use 'notUsed: true' if not extracting ${componentType} components.`
25947
+ });
25948
+ }
25949
+ }
25950
+ return errors;
25951
+ }
25952
+ function validateAllExtractionRules(config2) {
25953
+ return config2.modules.flatMap((module, index) => {
25954
+ if ("$ref" in module) {
25955
+ return [];
25956
+ }
25957
+ return validateModuleExtractionRules(module, index);
25958
+ });
25959
+ }
25960
+ function validateExtractionConfigSchema(data) {
25961
+ const schemaValid = validate2(data) === true;
25962
+ if (!schemaValid) {
25963
+ return {
25964
+ valid: false,
25965
+ errors: mapAjvErrors(validate2.errors)
25966
+ };
25967
+ }
25968
+ return {
25969
+ valid: true,
25970
+ errors: []
25971
+ };
25972
+ }
25664
25973
  function validateExtractionConfig(data) {
25665
- const valid = validate2(data) === true;
25666
- if (valid) {
25974
+ if (!isValidExtractionConfig(data)) {
25975
+ return validateExtractionConfigSchema(data);
25976
+ }
25977
+ const semanticErrors = validateAllExtractionRules(data);
25978
+ if (semanticErrors.length > 0) {
25667
25979
  return {
25668
- valid: true,
25669
- errors: []
25980
+ valid: false,
25981
+ errors: semanticErrors
25670
25982
  };
25671
25983
  }
25672
25984
  return {
25673
- valid: false,
25674
- errors: mapAjvErrors(validate2.errors)
25985
+ valid: true,
25986
+ errors: []
25675
25987
  };
25676
25988
  }
25677
25989
  function formatValidationErrors2(errors) {
@@ -27363,7 +27675,7 @@ function evaluateInClassWith(node, predicate) {
27363
27675
  }
27364
27676
 
27365
27677
  // ../riviere-extract-ts/dist/extractor.js
27366
- var COMPONENT_TYPES = [
27678
+ var COMPONENT_TYPES2 = [
27367
27679
  "api",
27368
27680
  "useCase",
27369
27681
  "domainOp",
@@ -27399,7 +27711,7 @@ function extractFromFile(project, filePath, config2, configDir) {
27399
27711
  return extractFromModule(sourceFile, filePath, matchingModule);
27400
27712
  }
27401
27713
  function extractFromModule(sourceFile, filePath, module) {
27402
- const builtInComponents = COMPONENT_TYPES.flatMap((componentType) => extractComponentType(sourceFile, filePath, module, componentType));
27714
+ const builtInComponents = COMPONENT_TYPES2.flatMap((componentType) => extractComponentType(sourceFile, filePath, module, componentType));
27403
27715
  const customComponents = extractCustomTypes(sourceFile, filePath, module);
27404
27716
  return [...builtInComponents, ...customComponents];
27405
27717
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@living-architecture/riviere-cli",
3
- "version": "0.7.23",
3
+ "version": "0.7.25",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,10 +32,10 @@
32
32
  "glob": "^11.0.2",
33
33
  "ts-morph": "^24.0.0",
34
34
  "yaml": "^2.7.0",
35
- "@living-architecture/riviere-builder": "0.5.22",
36
- "@living-architecture/riviere-extract-config": "0.3.3",
37
- "@living-architecture/riviere-extract-ts": "0.1.26",
38
- "@living-architecture/riviere-query": "0.4.22",
39
- "@living-architecture/riviere-schema": "0.4.22"
35
+ "@living-architecture/riviere-extract-config": "0.3.5",
36
+ "@living-architecture/riviere-builder": "0.5.23",
37
+ "@living-architecture/riviere-extract-ts": "0.1.28",
38
+ "@living-architecture/riviere-schema": "0.4.23",
39
+ "@living-architecture/riviere-query": "0.4.23"
40
40
  }
41
41
  }