musubix2 0.5.51 → 0.5.53

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.
@@ -1 +1 @@
1
- {"generator":"musubix2","version":"0.5.51","timestamp":"2026-07-10T07:05:35.431Z"}
1
+ {"generator":"musubix2","version":"0.5.53","timestamp":"2026-07-10T07:35:11.572Z"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "1.0",
3
- "generatedAt": "2026-07-10T07:05:35.462Z",
3
+ "generatedAt": "2026-07-10T07:35:11.598Z",
4
4
  "entries": [
5
5
  {
6
6
  "platform": "copilot",
package/dist/cli.js CHANGED
@@ -2678,6 +2678,7 @@ var init_design = __esm({
2678
2678
  "before",
2679
2679
  "after",
2680
2680
  "with",
2681
+ "within",
2681
2682
  "of",
2682
2683
  "to",
2683
2684
  "in",
@@ -2694,11 +2695,18 @@ var init_design = __esm({
2694
2695
  "about",
2695
2696
  "over",
2696
2697
  "under",
2698
+ "during",
2699
+ "upon",
2697
2700
  "one",
2698
2701
  "two",
2699
2702
  "three",
2700
2703
  "four",
2701
- "five"
2704
+ "five",
2705
+ "six",
2706
+ "seven",
2707
+ "eight",
2708
+ "nine",
2709
+ "ten"
2702
2710
  ]);
2703
2711
  DesignGenerator = class {
2704
2712
  counter = 0;
@@ -2707,7 +2715,7 @@ var init_design = __esm({
2707
2715
  const docId = `DES-DOC-${String(this.counter).padStart(3, "0")}`;
2708
2716
  const groups = this.groupRequirements(requirements);
2709
2717
  const sections = groups.map((group, idx) => {
2710
- const components = this.deriveComponents(group.requirements);
2718
+ const components = this.deriveComponents(group.requirements, group.domain);
2711
2719
  return {
2712
2720
  id: `${docId}-SEC-${String(idx + 1).padStart(3, "0")}`,
2713
2721
  title: group.title,
@@ -2770,6 +2778,7 @@ var init_design = __esm({
2770
2778
  }
2771
2779
  return Array.from(groups.entries()).map(([prefix, requirements]) => ({
2772
2780
  title: `${prefix} Design Section`,
2781
+ domain: prefix.replace(/^REQ-/, ""),
2773
2782
  requirements
2774
2783
  }));
2775
2784
  }
@@ -2795,17 +2804,32 @@ var init_design = __esm({
2795
2804
  return `${r.id}: ${op}${r.title ? ` \u2014 ${r.title}` : ""}`;
2796
2805
  });
2797
2806
  }
2798
- deriveComponents(reqs) {
2799
- return reqs.map((r) => {
2807
+ deriveComponents(reqs, domain) {
2808
+ if (reqs.length === 1) {
2809
+ const r = reqs[0];
2800
2810
  const sig = deriveMethodSignature(r.text, r.title);
2801
2811
  const compName = this.pascal(r.title || sig.name) + (/(service|manager|controller|repository)$/i.test(r.title) ? "" : "Service");
2802
- return {
2812
+ return [{
2803
2813
  name: compName,
2804
2814
  responsibility: r.title || `Handle ${r.id}`,
2805
2815
  methods: [sig],
2806
2816
  requirementIds: [r.id]
2807
- };
2817
+ }];
2818
+ }
2819
+ const seen = /* @__PURE__ */ new Map();
2820
+ const methods = reqs.map((r) => {
2821
+ const sig = deriveMethodSignature(r.text, r.title);
2822
+ const count = seen.get(sig.name) ?? 0;
2823
+ seen.set(sig.name, count + 1);
2824
+ return count === 0 ? sig : { ...sig, name: `${sig.name}${count + 1}` };
2808
2825
  });
2826
+ return [{
2827
+ // Normalise an all-caps domain code (PAY, LEDGER) to Title case.
2828
+ name: `${this.pascal(domain.toLowerCase())}Service`,
2829
+ responsibility: `${domain} domain \u2014 ${reqs.length} operations`,
2830
+ methods,
2831
+ requirementIds: reqs.map((r) => r.id)
2832
+ }];
2809
2833
  }
2810
2834
  deriveDataEntities(reqs) {
2811
2835
  const entities = /* @__PURE__ */ new Set();
@@ -12432,14 +12456,16 @@ var init_dist14 = __esm({
12432
12456
  };
12433
12457
  }
12434
12458
  const variables = extractVariables(requirement.text);
12459
+ const negated = /\bSHALL\s+NOT\b/i.test(requirement.text);
12460
+ const actionExpr = negated ? `(not ${actionVar})` : actionVar;
12435
12461
  let assertions;
12436
12462
  switch (requirement.pattern) {
12437
12463
  case "ubiquitous":
12438
- assertions = [`(assert (=> true ${actionVar}))`];
12464
+ assertions = [`(assert (=> true ${actionExpr}))`];
12439
12465
  break;
12440
12466
  case "event-driven": {
12441
12467
  const triggerVar = requirement.trigger ? sanitizeName(requirement.trigger) : "trigger";
12442
- assertions = [`(assert (=> ${triggerVar} ${actionVar}))`];
12468
+ assertions = [`(assert (=> ${triggerVar} ${actionExpr}))`];
12443
12469
  if (!requirement.trigger) {
12444
12470
  warnings.push('No trigger specified; using default "trigger"');
12445
12471
  }
@@ -12447,7 +12473,7 @@ var init_dist14 = __esm({
12447
12473
  }
12448
12474
  case "state-driven": {
12449
12475
  const condVar = requirement.condition ? sanitizeName(requirement.condition) : "condition";
12450
- assertions = [`(assert (=> ${condVar} ${actionVar}))`];
12476
+ assertions = [`(assert (=> ${condVar} ${actionExpr}))`];
12451
12477
  if (!requirement.condition) {
12452
12478
  warnings.push('No condition specified; using default "condition"');
12453
12479
  }
@@ -12455,14 +12481,14 @@ var init_dist14 = __esm({
12455
12481
  }
12456
12482
  case "unwanted":
12457
12483
  if (requirement.condition) {
12458
- assertions = [`(assert (=> ${sanitizeName(requirement.condition)} ${actionVar}))`];
12484
+ assertions = [`(assert (=> ${sanitizeName(requirement.condition)} ${actionExpr}))`];
12459
12485
  } else {
12460
- assertions = [`(assert (not ${actionVar}))`];
12486
+ assertions = [`(assert ${actionExpr})`];
12461
12487
  }
12462
12488
  break;
12463
12489
  case "optional": {
12464
12490
  const featureVar = requirement.trigger ? sanitizeName(requirement.trigger) : "feature_enabled";
12465
- assertions = [`(assert (=> ${featureVar} ${actionVar}))`];
12491
+ assertions = [`(assert (=> ${featureVar} ${actionExpr}))`];
12466
12492
  if (!requirement.trigger) {
12467
12493
  warnings.push('No feature trigger specified; using default "feature_enabled"');
12468
12494
  }
@@ -12471,7 +12497,7 @@ var init_dist14 = __esm({
12471
12497
  case "complex": {
12472
12498
  const condVar = requirement.condition ? sanitizeName(requirement.condition) : "condition";
12473
12499
  const triggerVar = requirement.trigger ? sanitizeName(requirement.trigger) : "trigger";
12474
- assertions = [`(assert (=> (and ${condVar} ${triggerVar}) ${actionVar}))`];
12500
+ assertions = [`(assert (=> (and ${condVar} ${triggerVar}) ${actionExpr}))`];
12475
12501
  if (!requirement.condition) {
12476
12502
  warnings.push('No condition specified; using default "condition"');
12477
12503
  }
package/dist/index.js CHANGED
@@ -2678,6 +2678,7 @@ var init_design = __esm({
2678
2678
  "before",
2679
2679
  "after",
2680
2680
  "with",
2681
+ "within",
2681
2682
  "of",
2682
2683
  "to",
2683
2684
  "in",
@@ -2694,11 +2695,18 @@ var init_design = __esm({
2694
2695
  "about",
2695
2696
  "over",
2696
2697
  "under",
2698
+ "during",
2699
+ "upon",
2697
2700
  "one",
2698
2701
  "two",
2699
2702
  "three",
2700
2703
  "four",
2701
- "five"
2704
+ "five",
2705
+ "six",
2706
+ "seven",
2707
+ "eight",
2708
+ "nine",
2709
+ "ten"
2702
2710
  ]);
2703
2711
  DesignGenerator = class {
2704
2712
  counter = 0;
@@ -2707,7 +2715,7 @@ var init_design = __esm({
2707
2715
  const docId = `DES-DOC-${String(this.counter).padStart(3, "0")}`;
2708
2716
  const groups = this.groupRequirements(requirements);
2709
2717
  const sections = groups.map((group, idx) => {
2710
- const components = this.deriveComponents(group.requirements);
2718
+ const components = this.deriveComponents(group.requirements, group.domain);
2711
2719
  return {
2712
2720
  id: `${docId}-SEC-${String(idx + 1).padStart(3, "0")}`,
2713
2721
  title: group.title,
@@ -2770,6 +2778,7 @@ var init_design = __esm({
2770
2778
  }
2771
2779
  return Array.from(groups.entries()).map(([prefix, requirements]) => ({
2772
2780
  title: `${prefix} Design Section`,
2781
+ domain: prefix.replace(/^REQ-/, ""),
2773
2782
  requirements
2774
2783
  }));
2775
2784
  }
@@ -2795,17 +2804,32 @@ var init_design = __esm({
2795
2804
  return `${r.id}: ${op}${r.title ? ` \u2014 ${r.title}` : ""}`;
2796
2805
  });
2797
2806
  }
2798
- deriveComponents(reqs) {
2799
- return reqs.map((r) => {
2807
+ deriveComponents(reqs, domain) {
2808
+ if (reqs.length === 1) {
2809
+ const r = reqs[0];
2800
2810
  const sig = deriveMethodSignature(r.text, r.title);
2801
2811
  const compName = this.pascal(r.title || sig.name) + (/(service|manager|controller|repository)$/i.test(r.title) ? "" : "Service");
2802
- return {
2812
+ return [{
2803
2813
  name: compName,
2804
2814
  responsibility: r.title || `Handle ${r.id}`,
2805
2815
  methods: [sig],
2806
2816
  requirementIds: [r.id]
2807
- };
2817
+ }];
2818
+ }
2819
+ const seen = /* @__PURE__ */ new Map();
2820
+ const methods = reqs.map((r) => {
2821
+ const sig = deriveMethodSignature(r.text, r.title);
2822
+ const count = seen.get(sig.name) ?? 0;
2823
+ seen.set(sig.name, count + 1);
2824
+ return count === 0 ? sig : { ...sig, name: `${sig.name}${count + 1}` };
2808
2825
  });
2826
+ return [{
2827
+ // Normalise an all-caps domain code (PAY, LEDGER) to Title case.
2828
+ name: `${this.pascal(domain.toLowerCase())}Service`,
2829
+ responsibility: `${domain} domain \u2014 ${reqs.length} operations`,
2830
+ methods,
2831
+ requirementIds: reqs.map((r) => r.id)
2832
+ }];
2809
2833
  }
2810
2834
  deriveDataEntities(reqs) {
2811
2835
  const entities = /* @__PURE__ */ new Set();
@@ -12432,14 +12456,16 @@ var init_dist14 = __esm({
12432
12456
  };
12433
12457
  }
12434
12458
  const variables = extractVariables(requirement.text);
12459
+ const negated = /\bSHALL\s+NOT\b/i.test(requirement.text);
12460
+ const actionExpr = negated ? `(not ${actionVar})` : actionVar;
12435
12461
  let assertions;
12436
12462
  switch (requirement.pattern) {
12437
12463
  case "ubiquitous":
12438
- assertions = [`(assert (=> true ${actionVar}))`];
12464
+ assertions = [`(assert (=> true ${actionExpr}))`];
12439
12465
  break;
12440
12466
  case "event-driven": {
12441
12467
  const triggerVar = requirement.trigger ? sanitizeName(requirement.trigger) : "trigger";
12442
- assertions = [`(assert (=> ${triggerVar} ${actionVar}))`];
12468
+ assertions = [`(assert (=> ${triggerVar} ${actionExpr}))`];
12443
12469
  if (!requirement.trigger) {
12444
12470
  warnings.push('No trigger specified; using default "trigger"');
12445
12471
  }
@@ -12447,7 +12473,7 @@ var init_dist14 = __esm({
12447
12473
  }
12448
12474
  case "state-driven": {
12449
12475
  const condVar = requirement.condition ? sanitizeName(requirement.condition) : "condition";
12450
- assertions = [`(assert (=> ${condVar} ${actionVar}))`];
12476
+ assertions = [`(assert (=> ${condVar} ${actionExpr}))`];
12451
12477
  if (!requirement.condition) {
12452
12478
  warnings.push('No condition specified; using default "condition"');
12453
12479
  }
@@ -12455,14 +12481,14 @@ var init_dist14 = __esm({
12455
12481
  }
12456
12482
  case "unwanted":
12457
12483
  if (requirement.condition) {
12458
- assertions = [`(assert (=> ${sanitizeName(requirement.condition)} ${actionVar}))`];
12484
+ assertions = [`(assert (=> ${sanitizeName(requirement.condition)} ${actionExpr}))`];
12459
12485
  } else {
12460
- assertions = [`(assert (not ${actionVar}))`];
12486
+ assertions = [`(assert ${actionExpr})`];
12461
12487
  }
12462
12488
  break;
12463
12489
  case "optional": {
12464
12490
  const featureVar = requirement.trigger ? sanitizeName(requirement.trigger) : "feature_enabled";
12465
- assertions = [`(assert (=> ${featureVar} ${actionVar}))`];
12491
+ assertions = [`(assert (=> ${featureVar} ${actionExpr}))`];
12466
12492
  if (!requirement.trigger) {
12467
12493
  warnings.push('No feature trigger specified; using default "feature_enabled"');
12468
12494
  }
@@ -12471,7 +12497,7 @@ var init_dist14 = __esm({
12471
12497
  case "complex": {
12472
12498
  const condVar = requirement.condition ? sanitizeName(requirement.condition) : "condition";
12473
12499
  const triggerVar = requirement.trigger ? sanitizeName(requirement.trigger) : "trigger";
12474
- assertions = [`(assert (=> (and ${condVar} ${triggerVar}) ${actionVar}))`];
12500
+ assertions = [`(assert (=> (and ${condVar} ${triggerVar}) ${actionExpr}))`];
12475
12501
  if (!requirement.condition) {
12476
12502
  warnings.push('No condition specified; using default "condition"');
12477
12503
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musubix2",
3
- "version": "0.5.51",
3
+ "version": "0.5.53",
4
4
  "description": "MUSUBIX2 — Specification Driven Development System",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",