@living-architecture/riviere-cli 0.3.2 → 0.3.4

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/dist/bin.js CHANGED
@@ -7098,7 +7098,7 @@ var riviere_schema_default = {
7098
7098
  sourceLocation: { $ref: "#/definitions/sourceLocation" },
7099
7099
  customTypeName: { type: "string", description: "Name of the custom type (must match a key in metadata.customTypes)", minLength: 1 }
7100
7100
  },
7101
- additionalProperties: false
7101
+ additionalProperties: true
7102
7102
  },
7103
7103
  link: {
7104
7104
  type: "object",
@@ -22384,6 +22384,26 @@ function createSourceNotFoundError(components, id) {
22384
22384
  return new ComponentNotFoundError2(id.toString(), suggestions);
22385
22385
  }
22386
22386
 
22387
+ // ../riviere-builder/dist/merge-behavior.js
22388
+ function mergeBehavior(existing, incoming) {
22389
+ const base = existing ?? {};
22390
+ return {
22391
+ ...base,
22392
+ ...incoming.reads !== void 0 && {
22393
+ reads: [...base.reads ?? [], ...incoming.reads]
22394
+ },
22395
+ ...incoming.validates !== void 0 && {
22396
+ validates: [...base.validates ?? [], ...incoming.validates]
22397
+ },
22398
+ ...incoming.modifies !== void 0 && {
22399
+ modifies: [...base.modifies ?? [], ...incoming.modifies]
22400
+ },
22401
+ ...incoming.emits !== void 0 && {
22402
+ emits: [...base.emits ?? [], ...incoming.emits]
22403
+ }
22404
+ };
22405
+ }
22406
+
22387
22407
  // ../riviere-builder/dist/builder.js
22388
22408
  var RiviereBuilder = class _RiviereBuilder {
22389
22409
  graph;
@@ -22786,7 +22806,7 @@ var RiviereBuilder = class _RiviereBuilder {
22786
22806
  module: input.module,
22787
22807
  sourceLocation: input.sourceLocation,
22788
22808
  ...input.description !== void 0 && { description: input.description },
22789
- ...input.metadata !== void 0 && { metadata: input.metadata }
22809
+ ...input.metadata
22790
22810
  };
22791
22811
  return this.registerComponent(component);
22792
22812
  }
@@ -22827,6 +22847,9 @@ var RiviereBuilder = class _RiviereBuilder {
22827
22847
  if (enrichment.businessRules !== void 0) {
22828
22848
  component.businessRules = [...component.businessRules ?? [], ...enrichment.businessRules];
22829
22849
  }
22850
+ if (enrichment.behavior !== void 0) {
22851
+ component.behavior = mergeBehavior(component.behavior, enrichment.behavior);
22852
+ }
22830
22853
  }
22831
22854
  componentNotFoundError(id) {
22832
22855
  return createSourceNotFoundError(this.graph.components, ComponentId.parse(id));
@@ -23992,6 +24015,20 @@ function parseStateChanges(inputs) {
23992
24015
  }
23993
24016
  return { success: true, stateChanges };
23994
24017
  }
24018
+ function buildBehavior(options) {
24019
+ const hasBehavior = options.reads.length > 0 || options.validates.length > 0 || options.modifies.length > 0 || options.emits.length > 0;
24020
+ if (!hasBehavior) {
24021
+ return {};
24022
+ }
24023
+ return {
24024
+ behavior: {
24025
+ ...options.reads.length > 0 && { reads: options.reads },
24026
+ ...options.validates.length > 0 && { validates: options.validates },
24027
+ ...options.modifies.length > 0 && { modifies: options.modifies },
24028
+ ...options.emits.length > 0 && { emits: options.emits }
24029
+ }
24030
+ };
24031
+ }
23995
24032
  function handleEnrichmentError(error46) {
23996
24033
  if (error46 instanceof InvalidEnrichmentTargetError) {
23997
24034
  console.log(JSON.stringify(formatError2("INVALID_COMPONENT_TYPE" /* InvalidComponentType */, error46.message, [])));
@@ -24000,7 +24037,7 @@ function handleEnrichmentError(error46) {
24000
24037
  handleComponentNotFoundError(error46);
24001
24038
  }
24002
24039
  function createEnrichCommand() {
24003
- return new Command10("enrich").description("Enrich a DomainOp component with entity, state changes, and business rules").addHelpText(
24040
+ return new Command10("enrich").description("Enrich a DomainOp component with semantic information").addHelpText(
24004
24041
  "after",
24005
24042
  `
24006
24043
  Examples:
@@ -24008,16 +24045,20 @@ Examples:
24008
24045
  --id "orders:checkout:domainop:orderbegin" \\
24009
24046
  --entity Order \\
24010
24047
  --state-change "Draft:Placed" \\
24011
- --business-rule "Order must have at least one item"
24048
+ --business-rule "Order must have at least one item" \\
24049
+ --reads "this.items" \\
24050
+ --validates "items.length > 0" \\
24051
+ --modifies "this.state <- Placed" \\
24052
+ --emits "OrderPlaced event"
24012
24053
 
24013
24054
  $ riviere builder enrich \\
24014
24055
  --id "payments:gateway:domainop:paymentprocess" \\
24015
24056
  --state-change "Pending:Processing" \\
24016
- --state-change "Processing:Completed" \\
24017
- --business-rule "Amount must be positive" \\
24018
- --business-rule "Currency must be valid"
24057
+ --reads "amount parameter" \\
24058
+ --validates "amount > 0" \\
24059
+ --modifies "this.status <- Processing"
24019
24060
  `
24020
- ).requiredOption("--id <component-id>", "Component ID to enrich").option("--entity <name>", "Entity name").option("--state-change <from:to>", "State transition (repeatable)", collectOption, []).option("--business-rule <rule>", "Business rule (repeatable)", collectOption, []).option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (options) => {
24061
+ ).requiredOption("--id <component-id>", "Component ID to enrich").option("--entity <name>", "Entity name").option("--state-change <from:to>", "State transition (repeatable)", collectOption, []).option("--business-rule <rule>", "Business rule (repeatable)", collectOption, []).option("--reads <value>", "What the operation reads (repeatable)", collectOption, []).option("--validates <value>", "What the operation validates (repeatable)", collectOption, []).option("--modifies <value>", "What the operation modifies (repeatable)", collectOption, []).option("--emits <value>", "What the operation emits (repeatable)", collectOption, []).option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (options) => {
24021
24062
  const parseResult = parseStateChanges(options.stateChange);
24022
24063
  if (!parseResult.success) {
24023
24064
  const msg = `Invalid state-change format: '${parseResult.invalidInput}'. Expected 'from:to'.`;
@@ -24029,7 +24070,8 @@ Examples:
24029
24070
  builder.enrichComponent(options.id, {
24030
24071
  ...options.entity !== void 0 && { entity: options.entity },
24031
24072
  ...parseResult.stateChanges.length > 0 && { stateChanges: parseResult.stateChanges },
24032
- ...options.businessRule.length > 0 && { businessRules: options.businessRule }
24073
+ ...options.businessRule.length > 0 && { businessRules: options.businessRule },
24074
+ ...buildBehavior(options)
24033
24075
  });
24034
24076
  } catch (error46) {
24035
24077
  handleEnrichmentError(error46);
package/dist/index.js CHANGED
@@ -7097,7 +7097,7 @@ var riviere_schema_default = {
7097
7097
  sourceLocation: { $ref: "#/definitions/sourceLocation" },
7098
7098
  customTypeName: { type: "string", description: "Name of the custom type (must match a key in metadata.customTypes)", minLength: 1 }
7099
7099
  },
7100
- additionalProperties: false
7100
+ additionalProperties: true
7101
7101
  },
7102
7102
  link: {
7103
7103
  type: "object",
@@ -22383,6 +22383,26 @@ function createSourceNotFoundError(components, id) {
22383
22383
  return new ComponentNotFoundError2(id.toString(), suggestions);
22384
22384
  }
22385
22385
 
22386
+ // ../riviere-builder/dist/merge-behavior.js
22387
+ function mergeBehavior(existing, incoming) {
22388
+ const base = existing ?? {};
22389
+ return {
22390
+ ...base,
22391
+ ...incoming.reads !== void 0 && {
22392
+ reads: [...base.reads ?? [], ...incoming.reads]
22393
+ },
22394
+ ...incoming.validates !== void 0 && {
22395
+ validates: [...base.validates ?? [], ...incoming.validates]
22396
+ },
22397
+ ...incoming.modifies !== void 0 && {
22398
+ modifies: [...base.modifies ?? [], ...incoming.modifies]
22399
+ },
22400
+ ...incoming.emits !== void 0 && {
22401
+ emits: [...base.emits ?? [], ...incoming.emits]
22402
+ }
22403
+ };
22404
+ }
22405
+
22386
22406
  // ../riviere-builder/dist/builder.js
22387
22407
  var RiviereBuilder = class _RiviereBuilder {
22388
22408
  graph;
@@ -22785,7 +22805,7 @@ var RiviereBuilder = class _RiviereBuilder {
22785
22805
  module: input.module,
22786
22806
  sourceLocation: input.sourceLocation,
22787
22807
  ...input.description !== void 0 && { description: input.description },
22788
- ...input.metadata !== void 0 && { metadata: input.metadata }
22808
+ ...input.metadata
22789
22809
  };
22790
22810
  return this.registerComponent(component);
22791
22811
  }
@@ -22826,6 +22846,9 @@ var RiviereBuilder = class _RiviereBuilder {
22826
22846
  if (enrichment.businessRules !== void 0) {
22827
22847
  component.businessRules = [...component.businessRules ?? [], ...enrichment.businessRules];
22828
22848
  }
22849
+ if (enrichment.behavior !== void 0) {
22850
+ component.behavior = mergeBehavior(component.behavior, enrichment.behavior);
22851
+ }
22829
22852
  }
22830
22853
  componentNotFoundError(id) {
22831
22854
  return createSourceNotFoundError(this.graph.components, ComponentId.parse(id));
@@ -24008,6 +24031,20 @@ function parseStateChanges(inputs) {
24008
24031
  }
24009
24032
  return { success: true, stateChanges };
24010
24033
  }
24034
+ function buildBehavior(options) {
24035
+ const hasBehavior = options.reads.length > 0 || options.validates.length > 0 || options.modifies.length > 0 || options.emits.length > 0;
24036
+ if (!hasBehavior) {
24037
+ return {};
24038
+ }
24039
+ return {
24040
+ behavior: {
24041
+ ...options.reads.length > 0 && { reads: options.reads },
24042
+ ...options.validates.length > 0 && { validates: options.validates },
24043
+ ...options.modifies.length > 0 && { modifies: options.modifies },
24044
+ ...options.emits.length > 0 && { emits: options.emits }
24045
+ }
24046
+ };
24047
+ }
24011
24048
  function handleEnrichmentError(error46) {
24012
24049
  if (error46 instanceof InvalidEnrichmentTargetError) {
24013
24050
  console.log(JSON.stringify(formatError2("INVALID_COMPONENT_TYPE" /* InvalidComponentType */, error46.message, [])));
@@ -24016,7 +24053,7 @@ function handleEnrichmentError(error46) {
24016
24053
  handleComponentNotFoundError(error46);
24017
24054
  }
24018
24055
  function createEnrichCommand() {
24019
- return new Command10("enrich").description("Enrich a DomainOp component with entity, state changes, and business rules").addHelpText(
24056
+ return new Command10("enrich").description("Enrich a DomainOp component with semantic information").addHelpText(
24020
24057
  "after",
24021
24058
  `
24022
24059
  Examples:
@@ -24024,16 +24061,20 @@ Examples:
24024
24061
  --id "orders:checkout:domainop:orderbegin" \\
24025
24062
  --entity Order \\
24026
24063
  --state-change "Draft:Placed" \\
24027
- --business-rule "Order must have at least one item"
24064
+ --business-rule "Order must have at least one item" \\
24065
+ --reads "this.items" \\
24066
+ --validates "items.length > 0" \\
24067
+ --modifies "this.state <- Placed" \\
24068
+ --emits "OrderPlaced event"
24028
24069
 
24029
24070
  $ riviere builder enrich \\
24030
24071
  --id "payments:gateway:domainop:paymentprocess" \\
24031
24072
  --state-change "Pending:Processing" \\
24032
- --state-change "Processing:Completed" \\
24033
- --business-rule "Amount must be positive" \\
24034
- --business-rule "Currency must be valid"
24073
+ --reads "amount parameter" \\
24074
+ --validates "amount > 0" \\
24075
+ --modifies "this.status <- Processing"
24035
24076
  `
24036
- ).requiredOption("--id <component-id>", "Component ID to enrich").option("--entity <name>", "Entity name").option("--state-change <from:to>", "State transition (repeatable)", collectOption, []).option("--business-rule <rule>", "Business rule (repeatable)", collectOption, []).option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (options) => {
24077
+ ).requiredOption("--id <component-id>", "Component ID to enrich").option("--entity <name>", "Entity name").option("--state-change <from:to>", "State transition (repeatable)", collectOption, []).option("--business-rule <rule>", "Business rule (repeatable)", collectOption, []).option("--reads <value>", "What the operation reads (repeatable)", collectOption, []).option("--validates <value>", "What the operation validates (repeatable)", collectOption, []).option("--modifies <value>", "What the operation modifies (repeatable)", collectOption, []).option("--emits <value>", "What the operation emits (repeatable)", collectOption, []).option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (options) => {
24037
24078
  const parseResult = parseStateChanges(options.stateChange);
24038
24079
  if (!parseResult.success) {
24039
24080
  const msg = `Invalid state-change format: '${parseResult.invalidInput}'. Expected 'from:to'.`;
@@ -24045,7 +24086,8 @@ Examples:
24045
24086
  builder.enrichComponent(options.id, {
24046
24087
  ...options.entity !== void 0 && { entity: options.entity },
24047
24088
  ...parseResult.stateChanges.length > 0 && { stateChanges: parseResult.stateChanges },
24048
- ...options.businessRule.length > 0 && { businessRules: options.businessRule }
24089
+ ...options.businessRule.length > 0 && { businessRules: options.businessRule },
24090
+ ...buildBehavior(options)
24049
24091
  });
24050
24092
  } catch (error46) {
24051
24093
  handleEnrichmentError(error46);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@living-architecture/riviere-cli",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -27,8 +27,8 @@
27
27
  "dependencies": {
28
28
  "commander": "^14.0.2",
29
29
  "tslib": "^2.3.0",
30
- "@living-architecture/riviere-builder": "0.2.6",
31
- "@living-architecture/riviere-schema": "0.2.4",
32
- "@living-architecture/riviere-query": "0.2.6"
30
+ "@living-architecture/riviere-builder": "0.2.8",
31
+ "@living-architecture/riviere-query": "0.2.7",
32
+ "@living-architecture/riviere-schema": "0.2.5"
33
33
  }
34
34
  }