@wairon/cli 5.0.2-dev.5 → 5.0.2-dev.6

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
@@ -5418,6 +5418,14 @@ var MODEL = __MODEL_JSON__;
5418
5418
  if (!exposes || !openApiAllowed()) return '';
5419
5419
  return '<div class="openbtn"><button class="tbtn" data-openapi-tag="' + esc(tag || '') + '">\\u25A4 View OpenAPI \\u2197</button></div>';
5420
5420
  }
5421
+ // "Open in Specs" \u2014 deep-links the focused spec into the hosted Specs value
5422
+ // editor via a host hook (opts.onOpenSpec). Hidden when no host provides it
5423
+ // (standalone file, shared page): those have no editor to open. kind is the
5424
+ // spec layer, id its qualified spec id.
5425
+ function openSpecButton(kind, id) {
5426
+ if (typeof opts === 'undefined' || !opts || typeof opts.onOpenSpec !== 'function') return '';
5427
+ return '<div class="openbtn"><button class="tbtn" data-openspec-kind="' + kind + '" data-openspec-id="' + esc(id) + '">\\u270E Open in Specs \\u2197</button></div>';
5428
+ }
5421
5429
 
5422
5430
  function renderPanel() {
5423
5431
  var head = '', body = '';
@@ -5440,7 +5448,8 @@ var MODEL = __MODEL_JSON__;
5440
5448
  + (scopeFocus ? staticChip('current view') : '')
5441
5449
  + chip(c.subsystem, 'subsystem', c.subsystem)
5442
5450
  + (scopeFocus ? '' : openViewButton('component', c.id, c.owns.length > 0))
5443
- + openApiButton(componentExposesApi(c), c.apiTag);
5451
+ + openApiButton(componentExposesApi(c), c.apiTag)
5452
+ + openSpecButton('component', c.id);
5444
5453
 
5445
5454
  var linkedTypes = MODEL.types.filter(function (t) { return t.componentClass === c.id; });
5446
5455
  if (linkedTypes.length) {
@@ -5524,7 +5533,8 @@ var MODEL = __MODEL_JSON__;
5524
5533
  MODEL.types.forEach(function (t2) { if (t2.id === focusId) ty = t2; });
5525
5534
  if (ty) {
5526
5535
  head = '<h2>' + esc(ty.name) + '</h2>' + staticChip('\\u00AB' + ty.kind + '\\u00BB')
5527
- + (ty.subsystem ? chip(ty.subsystem, 'subsystem', ty.subsystem) : staticChip('system-level shared'));
5536
+ + (ty.subsystem ? chip(ty.subsystem, 'subsystem', ty.subsystem) : staticChip('system-level shared'))
5537
+ + openSpecButton('type', ty.id);
5528
5538
 
5529
5539
  if (ty.componentClass) {
5530
5540
  head += '<div style="margin-top:6px"><b style="font-size:11px">Class Component:</b> ' + chip(ty.componentClass, 'component', ty.componentClass) + '</div>';
@@ -5600,7 +5610,8 @@ var MODEL = __MODEL_JSON__;
5600
5610
  + (s.status ? staticChip(s.status) : '')
5601
5611
  + (scopeFocus ? staticChip('current view') : '')
5602
5612
  + (scopeFocus ? '' : openViewButton('subsystem', s.id, subKids > 0))
5603
- + openApiButton(subsystemExposesApi(s.id), '');
5613
+ + openApiButton(subsystemExposesApi(s.id), '')
5614
+ + openSpecButton('subsystem', s.id);
5604
5615
  body += '<p class="desc">' + esc(s.description) + '</p>';
5605
5616
  if (s.trustedLinks.length) {
5606
5617
  body += section('Trusted links (fast lanes)', s.trustedLinks.length, s.trustedLinks.map(function (t2) {
@@ -5658,6 +5669,16 @@ var MODEL = __MODEL_JSON__;
5658
5669
  });
5659
5670
  })(oapis[oi]);
5660
5671
  }
5672
+ var ospecs = panel.querySelectorAll('[data-openspec-kind]');
5673
+ for (var si = 0; si < ospecs.length; si++) {
5674
+ (function (b) {
5675
+ b.addEventListener('click', function () {
5676
+ if (typeof opts !== 'undefined' && opts && typeof opts.onOpenSpec === 'function') {
5677
+ opts.onOpenSpec(b.getAttribute('data-openspec-kind'), b.getAttribute('data-openspec-id') || '');
5678
+ }
5679
+ });
5680
+ })(ospecs[si]);
5681
+ }
5661
5682
  var flows = panel.querySelectorAll('[data-flow-comp]');
5662
5683
  for (var j = 0; j < flows.length; j++) {
5663
5684
  (function (b) {
@@ -5670,6 +5691,23 @@ var MODEL = __MODEL_JSON__;
5670
5691
  }
5671
5692
 
5672
5693
  renderPanel();
5694
+ // Stage G: a deep link may focus a component and/or open a method's narrative
5695
+ // modal once the seeded view + DOM + cy graph exist. The host parses the URL hash
5696
+ // into opts.initialSelect / opts.initialFlow \u2014 both carry the component id, so this
5697
+ // works whether the seeded view is the component itself or its parent subsystem
5698
+ // (a leaf component has no meaningful "inside", so Specs deep-links open the parent
5699
+ // and focus the component here).
5700
+ (function () {
5701
+ if (typeof opts === 'undefined' || !opts) return;
5702
+ var f = opts.initialFlow, s = opts.initialSelect;
5703
+ var focusComp = (f && f.comp) || (s && s.comp);
5704
+ if (focusComp && compById[focusComp]) {
5705
+ try { select('component', focusComp, true); } catch (e) { /* ignore */ }
5706
+ }
5707
+ if (f && f.comp && f.method && compById[f.comp]) {
5708
+ try { openFlow(f.comp, f.method, f.mode === 'steps' ? 'steps' : 'flow'); } catch (e) { /* ignore */ }
5709
+ }
5710
+ })();
5673
5711
  })();
5674
5712
  </script>
5675
5713
  </body>
@@ -12117,6 +12155,28 @@ function buildGraphModel(level) {
12117
12155
  ...t.subsystem ? { parentId: t.subsystem } : {}
12118
12156
  });
12119
12157
  }
12158
+ const componentByInterface = /* @__PURE__ */ new Map();
12159
+ for (const c of model.components) {
12160
+ for (const intf of c.interfaces) componentByInterface.set(intf.id, c.id);
12161
+ }
12162
+ for (const impl of loadImplementationSpecs()) {
12163
+ const componentId = componentByInterface.get(impl.contract);
12164
+ if (!componentId) continue;
12165
+ nodes.push({
12166
+ id: impl.id,
12167
+ label: impl.name,
12168
+ kind: "implementation",
12169
+ level: 4,
12170
+ parentId: componentId,
12171
+ ...impl.status ? { status: impl.status } : {}
12172
+ });
12173
+ candidates.push({ from: componentId, to: impl.id, edgeKind: "owns" });
12174
+ }
12175
+ for (const c of model.components) {
12176
+ for (const memberId of c.owns) {
12177
+ candidates.push({ from: c.id, to: memberId, edgeKind: "owns" });
12178
+ }
12179
+ }
12120
12180
  for (const e of model.edges) {
12121
12181
  candidates.push({ from: e.from, to: e.to, edgeKind: "depends_on" });
12122
12182
  }
@@ -15327,7 +15387,7 @@ function defaultTargetConfig(type) {
15327
15387
  enabled: true
15328
15388
  };
15329
15389
  }
15330
- var WAIRON_VERSION = "5.0.2-dev.5";
15390
+ var WAIRON_VERSION = "5.0.2-dev.6";
15331
15391
  var GITHUB_REPO = "SYW-Apps/Waffle-AIron";
15332
15392
  var ARCHITECT_AGENT_ID = "agent-architect";
15333
15393
  var ARCHITECT_TEMPLATE_ID = "architect";