@wairon/cli 5.1.1-dev.70 → 5.1.1-dev.71

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/index.js CHANGED
@@ -3542,6 +3542,7 @@ __export(src_exports, {
3542
3542
  deleteComponentSpec: () => deleteComponentSpec,
3543
3543
  deleteImplementationSpec: () => deleteImplementationSpec,
3544
3544
  deleteInterfaceSpec: () => deleteInterfaceSpec,
3545
+ deleteSpec: () => deleteSpec,
3545
3546
  deleteSubsystemSpec: () => deleteSubsystemSpec,
3546
3547
  deleteTypeSpec: () => deleteTypeSpec,
3547
3548
  deregisterPackRef: () => deregisterPackRef,
@@ -3612,6 +3613,7 @@ __export(src_exports, {
3612
3613
  loadProjectConfig: () => loadProjectConfig4,
3613
3614
  loadProjectExtensions: () => loadProjectExtensions,
3614
3615
  loadRegistry: () => loadRegistry,
3616
+ loadSpec: () => loadSpec,
3615
3617
  loadSpecGraph: () => loadSpecGraph,
3616
3618
  loadSubsystemSpec: () => loadSubsystemSpec,
3617
3619
  loadSubsystemSpecs: () => loadSubsystemSpecs,
@@ -3673,6 +3675,7 @@ __export(src_exports, {
3673
3675
  saveComponentSpec: () => saveComponentSpec,
3674
3676
  saveImplementationSpec: () => saveImplementationSpec,
3675
3677
  saveInterfaceSpec: () => saveInterfaceSpec,
3678
+ saveSpec: () => saveSpec,
3676
3679
  saveSubsystemSpec: () => saveSubsystemSpec,
3677
3680
  saveSystemSpec: () => saveSystemSpec,
3678
3681
  saveTopologyConfig: () => saveTopologyConfig,
@@ -11593,7 +11596,7 @@ function defaultTargetConfig(type) {
11593
11596
  enabled: true
11594
11597
  };
11595
11598
  }
11596
- var WAIRON_VERSION = "5.1.1-dev.70";
11599
+ var WAIRON_VERSION = "5.1.1-dev.71";
11597
11600
  var GITHUB_REPO = "SYW-Apps/Waffle-AIron";
11598
11601
  var ARCHITECT_AGENT_ID = "agent-architect";
11599
11602
  var ARCHITECT_TEMPLATE_ID = "architect";
@@ -21663,6 +21666,8 @@ function identityKeyOf(field, item) {
21663
21666
  const o = item;
21664
21667
  const str = (v) => typeof v === "string" && v.length > 0 ? v : null;
21665
21668
  switch (field) {
21669
+ case "publicInterfaces":
21670
+ return publicInterfaceKey(o);
21666
21671
  case "dispatch":
21667
21672
  return str(o.capability);
21668
21673
  // A listener mounts each portal once, so the portal IS the mount's identity.
@@ -21708,6 +21713,13 @@ function identityKeyOf(field, item) {
21708
21713
  return str(o.name) ?? str(o.id);
21709
21714
  }
21710
21715
  }
21716
+ function publicInterfaceKey(o) {
21717
+ const str = (v) => typeof v === "string" && v.length > 0 ? v : null;
21718
+ const component = str(o.component);
21719
+ if (component) return str(o.interface) ? `${component}.${String(o.interface)}` : component;
21720
+ if (typeof o.type === "string" && typeof o.details === "string") return `${o.type} ${o.details}`;
21721
+ return null;
21722
+ }
21711
21723
  function reportIdentityOf(field, item) {
21712
21724
  if (item !== null && typeof item === "object") {
21713
21725
  const step = item.stepNumber;
@@ -21769,6 +21781,9 @@ function identityFieldsOf(field) {
21769
21781
  switch (field) {
21770
21782
  case "dispatch":
21771
21783
  return ["capability"];
21784
+ // Bound: component + interface; not yet bound: type + details.
21785
+ case "publicInterfaces":
21786
+ return ["component", "interface", "type", "details"];
21772
21787
  case "lifecycle":
21773
21788
  return ["phase", "component", "method"];
21774
21789
  case "emits":
@@ -22934,6 +22949,76 @@ var SpecWorkspace = class {
22934
22949
  return true;
22935
22950
  }
22936
22951
  // -------------------------------------------------------------------------
22952
+ // Kind-generic access (spec_index.load, spec_registry.save / delete)
22953
+ //
22954
+ // The one place a kind held as DATA becomes the typed loader, writer or
22955
+ // delete of that kind. Every caller that holds the kind as a value — the
22956
+ // gated whole-spec write, a delete by kind, the delta update, the method
22957
+ // move — used to repeat this switch, and each copy could drift from the
22958
+ // others (one of them forgot that a type's writer takes no status).
22959
+ // -------------------------------------------------------------------------
22960
+ /** One stored spec of the named kind, or null. The L0 is a singleton: its id is informational. */
22961
+ load(kind, id) {
22962
+ switch (kind) {
22963
+ case "system":
22964
+ return this.loadSystemSpec();
22965
+ case "subsystem":
22966
+ return this.loadSubsystemSpec(id);
22967
+ case "component":
22968
+ return this.loadComponentSpec(id);
22969
+ case "interface":
22970
+ return this.loadInterfaceSpec(id);
22971
+ case "implementation":
22972
+ return this.loadImplementationSpec(id);
22973
+ case "type":
22974
+ return this.loadTypeSpec(id);
22975
+ }
22976
+ }
22977
+ /**
22978
+ * Persist one spec through the typed writer of its kind, answering with that
22979
+ * writer's placement notices (none for the L0 and a subsystem). A draft or
22980
+ * status-less save keeps the stored status, exactly as the typed writers do.
22981
+ */
22982
+ save(kind, spec) {
22983
+ return this.saveOfKind(kind, spec);
22984
+ }
22985
+ /** The typed writer of a kind, with the caller's save options — the delta update and the move state a demotion. */
22986
+ saveOfKind(kind, spec, opts) {
22987
+ switch (kind) {
22988
+ case "system":
22989
+ this.saveSystemSpec(spec);
22990
+ return [];
22991
+ case "subsystem":
22992
+ this.saveSubsystemSpec(spec, opts);
22993
+ return [];
22994
+ case "component":
22995
+ return this.saveComponentSpec(spec, opts);
22996
+ case "interface":
22997
+ return this.saveInterfaceSpec(spec, opts);
22998
+ case "implementation":
22999
+ return this.saveImplementationSpec(spec, opts);
23000
+ case "type":
23001
+ return this.saveTypeSpec(spec, opts);
23002
+ }
23003
+ }
23004
+ /** Delete one spec document of the named kind; false when none was stored. The L0 cannot be deleted. */
23005
+ delete(kind, id) {
23006
+ switch (kind) {
23007
+ case "system":
23008
+ throw new Error("The L0 system spec cannot be deleted: it is the root every other spec hangs from.");
23009
+ case "subsystem":
23010
+ return this.deleteSubsystemSpec(id);
23011
+ case "component":
23012
+ return this.deleteComponentSpec(id);
23013
+ case "interface":
23014
+ return this.deleteInterfaceSpec(id);
23015
+ case "implementation":
23016
+ return this.deleteImplementationSpec(id);
23017
+ case "type":
23018
+ return this.deleteTypeSpec(id);
23019
+ }
23020
+ }
23021
+ // -------------------------------------------------------------------------
22937
23022
  // Spec status promotion (draft/design → complete)
22938
23023
  // -------------------------------------------------------------------------
22939
23024
  /** Every spec whose status is not yet 'complete', with its current status captured. */
@@ -23154,23 +23239,7 @@ var SpecWorkspace = class {
23154
23239
  */
23155
23240
  updateSpec(kind, id, delta, hooks, dryRun = false) {
23156
23241
  const notices = [];
23157
- const result = (() => {
23158
- switch (kind) {
23159
- case "system":
23160
- return this.loadSystemSpec();
23161
- // singleton — id is informational
23162
- case "subsystem":
23163
- return this.loadSubsystemSpec(id);
23164
- case "component":
23165
- return this.loadComponentSpec(id);
23166
- case "interface":
23167
- return this.loadInterfaceSpec(id);
23168
- case "implementation":
23169
- return this.loadImplementationSpec(id);
23170
- case "type":
23171
- return this.loadTypeSpec(id);
23172
- }
23173
- })();
23242
+ const result = this.load(kind, id);
23174
23243
  if (!result) {
23175
23244
  throw new Error(`Spec of kind "${kind}" with ID "${id}" does not exist. Define it first.`);
23176
23245
  }
@@ -23502,9 +23571,10 @@ var SpecWorkspace = class {
23502
23571
  const mergePublicInterfaces = (existing, delta2) => {
23503
23572
  const merged = [...existing];
23504
23573
  for (const deltaItem of delta2) {
23505
- const piKey = (i) => `${i?.component}.${i?.interface}`;
23574
+ const piKey = (i) => String(identityKeyOf("publicInterfaces", i));
23506
23575
  assertDeltaMarkers(deltaItem, `publicInterface "${piKey(deltaItem)}"`);
23507
- const idx = merged.findIndex((item) => item.component === deltaItem.component && item.interface === deltaItem.interface);
23576
+ const key = identityKeyOf("publicInterfaces", deltaItem);
23577
+ const idx = key === null ? -1 : merged.findIndex((item) => identityKeyOf("publicInterfaces", item) === key);
23508
23578
  if (idx !== -1) {
23509
23579
  if (deltaItem.remove === true || deltaItem.action === "delete") {
23510
23580
  merged.splice(idx, 1);
@@ -23693,26 +23763,7 @@ var SpecWorkspace = class {
23693
23763
  const opts = {
23694
23764
  allowStatusDemotion: Object.prototype.hasOwnProperty.call(delta, "status")
23695
23765
  };
23696
- switch (kind) {
23697
- case "system":
23698
- this.saveSystemSpec(mergedResult);
23699
- break;
23700
- case "subsystem":
23701
- this.saveSubsystemSpec(mergedResult, opts);
23702
- break;
23703
- case "component":
23704
- notices.push(...this.saveComponentSpec(mergedResult, opts));
23705
- break;
23706
- case "interface":
23707
- notices.push(...this.saveInterfaceSpec(mergedResult, opts));
23708
- break;
23709
- case "implementation":
23710
- notices.push(...this.saveImplementationSpec(mergedResult, opts));
23711
- break;
23712
- case "type":
23713
- notices.push(...this.saveTypeSpec(mergedResult));
23714
- break;
23715
- }
23766
+ notices.push(...this.saveOfKind(kind, mergedResult, opts));
23716
23767
  return {
23717
23768
  kind,
23718
23769
  id,
@@ -24073,23 +24124,7 @@ var SpecWorkspace = class {
24073
24124
  }
24074
24125
  /** Persist one moved spec through the store's own writer, and answer with its placement notices. */
24075
24126
  saveMovedSpec(kind, spec) {
24076
- const opts = { allowStatusDemotion: true };
24077
- switch (kind) {
24078
- case "system":
24079
- this.saveSystemSpec(spec);
24080
- return [];
24081
- case "subsystem":
24082
- this.saveSubsystemSpec(spec, opts);
24083
- return [];
24084
- case "component":
24085
- return this.saveComponentSpec(spec, opts);
24086
- case "interface":
24087
- return this.saveInterfaceSpec(spec, opts);
24088
- case "implementation":
24089
- return this.saveImplementationSpec(spec, opts);
24090
- case "type":
24091
- return this.saveTypeSpec(spec);
24092
- }
24127
+ return this.saveOfKind(kind, spec, { allowStatusDemotion: true });
24093
24128
  }
24094
24129
  };
24095
24130
  var DEFAULT_DEPENDENCY_LIMIT = 8;
@@ -24371,6 +24406,18 @@ function specPathsInScope(scopeSubsystem) {
24371
24406
  function snapshotSpecFiles() {
24372
24407
  return current().snapshotSpecFiles();
24373
24408
  }
24409
+ function loadSpec(kind, id) {
24410
+ const workspace = current();
24411
+ return workspace.load(kind, id);
24412
+ }
24413
+ function saveSpec(kind, spec) {
24414
+ const workspace = current();
24415
+ return workspace.save(kind, spec);
24416
+ }
24417
+ function deleteSpec(kind, id) {
24418
+ const workspace = current();
24419
+ return workspace.delete(kind, id);
24420
+ }
24374
24421
  function updateSpec(kind, id, delta, hooks, dryRun) {
24375
24422
  return current().updateSpec(kind, id, delta, hooks, dryRun);
24376
24423
  }
@@ -27075,6 +27122,7 @@ function loadProjectConfig4() {
27075
27122
  deleteComponentSpec,
27076
27123
  deleteImplementationSpec,
27077
27124
  deleteInterfaceSpec,
27125
+ deleteSpec,
27078
27126
  deleteSubsystemSpec,
27079
27127
  deleteTypeSpec,
27080
27128
  deregisterPackRef,
@@ -27145,6 +27193,7 @@ function loadProjectConfig4() {
27145
27193
  loadProjectConfig,
27146
27194
  loadProjectExtensions,
27147
27195
  loadRegistry,
27196
+ loadSpec,
27148
27197
  loadSpecGraph,
27149
27198
  loadSubsystemSpec,
27150
27199
  loadSubsystemSpecs,
@@ -27206,6 +27255,7 @@ function loadProjectConfig4() {
27206
27255
  saveComponentSpec,
27207
27256
  saveImplementationSpec,
27208
27257
  saveInterfaceSpec,
27258
+ saveSpec,
27209
27259
  saveSubsystemSpec,
27210
27260
  saveSystemSpec,
27211
27261
  saveTopologyConfig,