@wairon/cli 5.1.1-dev.11 → 5.1.1-dev.12

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
@@ -1312,7 +1312,7 @@ var init_defaults = __esm({
1312
1312
  copilot: ".github/prompts",
1313
1313
  codex: ".codex/agents"
1314
1314
  };
1315
- WAIRON_VERSION = "5.1.1-dev.11";
1315
+ WAIRON_VERSION = "5.1.1-dev.12";
1316
1316
  GITHUB_REPO = "SYW-Apps/Waffle-AIron";
1317
1317
  ARCHITECT_AGENT_ID = "agent-architect";
1318
1318
  ARCHITECT_TEMPLATE_ID = "architect";
@@ -4729,12 +4729,12 @@ var init_stereotype_deps = __esm({
4729
4729
  }
4730
4730
  }
4731
4731
  if (comp.componentType === "Specialist") {
4732
- const forbiddenTypes = ["Portal", "Observer", "Orchestrator", "Store", "Supervisor"];
4732
+ const forbiddenTypes = ["Portal", "Observer", "Orchestrator", "Store", "Registry", "Supervisor", "Actor"];
4733
4733
  if (forbiddenTypes.includes(depComp.componentType)) {
4734
4734
  ctx.addIssue(
4735
4735
  "error",
4736
4736
  "ARCHITECTURE_VIOLATION_SPECIALIST_DEP",
4737
- `Architectural violation: Specialist component "${comp.id}" cannot depend on "${depComp.componentType}" component "${depComp.id}". Specialists are narrow capabilities \u2014 they may use Repositories, Indexes, and Adapters, but not Orchestrators, Supervisors, Stores, Portals, or Observers.` + (depComp.componentType === "Store" ? storeResolutionHint(comp.componentType, depComp.id) : ""),
4737
+ `Architectural violation: Specialist component "${comp.id}" cannot depend on "${depComp.componentType}" component "${depComp.id}". Specialists are pure capabilities \u2014 they may use Repository facades, Indexes, and Adapters, but never workflow/runtime blocks (Orchestrators, Supervisors, Actors) and never persistence directly (Stores, Registries \u2014 all storage, even in-memory, is reached through a Repository facade), nor Portals or Observers.` + (depComp.componentType === "Store" ? storeResolutionHint(comp.componentType, depComp.id) : ""),
4738
4738
  comp.id,
4739
4739
  isDraftCtx || ctx.isComponentDraft(depComp.id)
4740
4740
  );
@@ -8010,7 +8010,7 @@ function buildRuleContext(opts) {
8010
8010
  for (const i of interfaces) collectAllows(i.id, i.lint);
8011
8011
  for (const im of implementations) collectAllows(im.id, im.lint);
8012
8012
  for (const t of types) collectAllows(t.id, t.lint);
8013
- const knownIssueCodes = /* @__PURE__ */ new Set([
8013
+ const knownIssueCodes2 = /* @__PURE__ */ new Set([
8014
8014
  ...[...SDD_RULES, ...extensions.rules].flatMap((r) => r.codes.map((c) => c.code)),
8015
8015
  // Declarative assertions bring their own namespaced codes — lint.allow
8016
8016
  // and severity overrides treat them exactly like builtins.
@@ -8073,7 +8073,7 @@ function buildRuleContext(opts) {
8073
8073
  mountSurfaceSnapshots: opts.mountSurfaceSnapshots ?? [],
8074
8074
  codeModel: opts.codeModel ?? emptyCodeModel(),
8075
8075
  lintAllows,
8076
- knownIssueCodes,
8076
+ knownIssueCodes: knownIssueCodes2,
8077
8077
  addIssue
8078
8078
  };
8079
8079
  }
@@ -13349,6 +13349,9 @@ var MODEL = __MODEL_JSON__;
13349
13349
  function addRule(rule) {
13350
13350
  ruleSet.push(rule);
13351
13351
  }
13352
+ function listRules() {
13353
+ return ruleSet;
13354
+ }
13352
13355
  function registerBuiltinRules() {
13353
13356
  ruleSet = [];
13354
13357
  for (const rule of SDD_RULES) addRule(rule);
@@ -13360,6 +13363,9 @@ function ruleSequence() {
13360
13363
  const base = ruleSet.filter((r) => r !== lintAllowsRule);
13361
13364
  return ruleSet.includes(lintAllowsRule) ? [...base, lintAllowsRule] : base;
13362
13365
  }
13366
+ function knownIssueCodes() {
13367
+ return listRules().flatMap((r) => r.codes);
13368
+ }
13363
13369
  var ruleSet;
13364
13370
  var init_repository = __esm({
13365
13371
  "src/core/rules/repository.ts"() {
@@ -14291,6 +14297,32 @@ function projectPackSelections() {
14291
14297
  return [];
14292
14298
  }
14293
14299
  }
14300
+ function issueKey(issue2) {
14301
+ return `${issue2.code}|${issue2.specId ?? ""}`;
14302
+ }
14303
+ function worstByKey(issues) {
14304
+ const worst = /* @__PURE__ */ new Map();
14305
+ for (const issue2 of issues) {
14306
+ const key = issueKey(issue2);
14307
+ const seen = worst.get(key);
14308
+ if (!seen || SEVERITY_RANK[issue2.severity] > SEVERITY_RANK[seen]) worst.set(key, issue2.severity);
14309
+ }
14310
+ return worst;
14311
+ }
14312
+ function stricterSeverities(parent, child) {
14313
+ const fromParent = parent?.sddRuleSeverity ?? {};
14314
+ const fromChild = child?.sddRuleSeverity ?? {};
14315
+ const codes = /* @__PURE__ */ new Set([...Object.keys(fromParent), ...Object.keys(fromChild)]);
14316
+ if (codes.size === 0) return parent ?? child;
14317
+ const defaults = new Map(knownIssueCodes().map((rc) => [rc.code, rc.defaultSeverity]));
14318
+ const merged = {};
14319
+ for (const code of codes) {
14320
+ const p = fromParent[code] ?? defaults.get(code);
14321
+ const c = fromChild[code] ?? defaults.get(code);
14322
+ merged[code] = p === void 0 || c === void 0 ? p ?? c : SEVERITY_RANK[p] >= SEVERITY_RANK[c] ? p : c;
14323
+ }
14324
+ return { ...parent ?? child, sddRuleSeverity: merged };
14325
+ }
14294
14326
  function issue(severity, code, message, agentId, specId) {
14295
14327
  return { severity, code, message, agentId, specId };
14296
14328
  }
@@ -14372,7 +14404,7 @@ function validateProjectConfig(config) {
14372
14404
  issues
14373
14405
  };
14374
14406
  }
14375
- function listRules() {
14407
+ function listRules2() {
14376
14408
  const extensions = loadProjectExtensions();
14377
14409
  registerBuiltinRules();
14378
14410
  registerPackRules(extensions.rules);
@@ -14472,21 +14504,22 @@ function validateSddTree(rulesOrOptions, projectType = "backend") {
14472
14504
  for (const rule of ruleSequence()) {
14473
14505
  rule.check(ctx);
14474
14506
  }
14475
- const uncovered = (i) => SUBPROJECT_REFERENCE_CODES.has(i.code) && !i.surfaceResolved;
14476
- const chainingParent = crossTree !== "off" && issues.some(uncovered) ? findChainingParent(getProjectRoot()) : null;
14477
- const resolution = chainingParent ? resolveThroughParent(getProjectRoot(), treatAllAsComplete) : null;
14507
+ const unresolved = (i) => RESOLUTION_FAILURE_CODES.has(i.code) && !i.surfaceResolved;
14508
+ const chainingParent = crossTree !== "off" && issues.some(unresolved) ? findChainingParent(getProjectRoot()) : null;
14509
+ const resolution = chainingParent ? resolveThroughParent(getProjectRoot(), treatAllAsComplete, rules) : null;
14478
14510
  if (resolution) {
14479
- const parentSeverity = /* @__PURE__ */ new Map();
14480
- for (const i of resolution.issues) {
14481
- const key = `${i.code}|${i.specId ?? ""}`;
14482
- if (i.severity === "error" || !parentSeverity.has(key)) parentSeverity.set(key, i.severity);
14483
- }
14484
- const rejudged = (i) => {
14485
- const judged = parentSeverity.get(`${i.code}|${i.specId ?? ""}`);
14486
- return judged === "error" || judged === "warning" && i.severity === "warning";
14487
- };
14488
- const kept = issues.filter((i) => !uncovered(i) && !(i.surfaceResolved && rejudged(i)));
14489
- const merged = dedupeIssues([...kept, ...resolution.issues]);
14511
+ const judgedByParent = worstByKey(resolution.issues);
14512
+ const kept = issues.filter((i) => {
14513
+ const judged = judgedByParent.get(issueKey(i));
14514
+ if (judged !== void 0) return SEVERITY_RANK[judged] < SEVERITY_RANK[i.severity];
14515
+ return !unresolved(i);
14516
+ });
14517
+ const keptByChild = worstByKey(kept);
14518
+ const added = resolution.issues.filter((i) => {
14519
+ const own = keptByChild.get(issueKey(i));
14520
+ return own === void 0 || SEVERITY_RANK[own] <= SEVERITY_RANK[i.severity];
14521
+ });
14522
+ const merged = dedupeIssues([...kept, ...added]);
14490
14523
  return {
14491
14524
  valid: merged.every((i) => i.severity !== "error"),
14492
14525
  issues: merged,
@@ -14503,7 +14536,7 @@ function validateSddTree(rulesOrOptions, projectType = "backend") {
14503
14536
  });
14504
14537
  }
14505
14538
  }
14506
- function resolveThroughParent(boundRoot, treatAllAsComplete) {
14539
+ function resolveThroughParent(boundRoot, treatAllAsComplete, childRules) {
14507
14540
  const reach = getRequestParentReach();
14508
14541
  if (reach && !reach.parentReach) return null;
14509
14542
  const ceiling = reach?.topRoot ? path14.resolve(reach.topRoot) : void 0;
@@ -14521,10 +14554,10 @@ function resolveThroughParent(boundRoot, treatAllAsComplete) {
14521
14554
  const scope = chain.join("::");
14522
14555
  const inner = runWithProjectRoot(top, () => {
14523
14556
  invalidateSpecCache();
14524
- let governing = {};
14557
+ let governing = { rules: stricterSeverities(void 0, childRules) };
14525
14558
  try {
14526
14559
  const config = loadProjectConfig();
14527
- governing = { rules: config.rules, projectType: config.projectType };
14560
+ governing = { rules: stricterSeverities(config.rules, childRules), projectType: config.projectType };
14528
14561
  } catch {
14529
14562
  }
14530
14563
  return validateSddTree({
@@ -14598,7 +14631,7 @@ function settledStatusBearing(loaded) {
14598
14631
  function validateAsComplete(options) {
14599
14632
  return validateSddTree({ ...options ?? {}, treatAllAsComplete: true });
14600
14633
  }
14601
- var path14, SUBPROJECT_REFERENCE_CODES;
14634
+ var path14, RESOLUTION_FAILURE_CODES, SEVERITY_RANK;
14602
14635
  var init_validation = __esm({
14603
14636
  "src/core/validation.ts"() {
14604
14637
  "use strict";
@@ -14614,16 +14647,15 @@ var init_validation = __esm({
14614
14647
  init_fs();
14615
14648
  path14 = __toESM(require("path"));
14616
14649
  init_approval();
14617
- SUBPROJECT_REFERENCE_CODES = /* @__PURE__ */ new Set([
14650
+ RESOLUTION_FAILURE_CODES = /* @__PURE__ */ new Set([
14618
14651
  "UNDEFINED_TYPE_REFERENCE",
14619
14652
  "INVALID_DEPENDENCY_REFERENCE",
14620
14653
  "INVALID_TARGET_COMPONENT_REFERENCE",
14621
14654
  "INVALID_SUBSYSTEM_REFERENCE",
14622
- "UNDECLARED_DEPENDENCY_CALL",
14623
14655
  "INVALID_TRUSTED_LINK",
14624
- "CROSS_SUBSYSTEM_NON_ADAPTER",
14625
14656
  "CROSS_TREE_REF_UNRESOLVED"
14626
14657
  ]);
14658
+ SEVERITY_RANK = { off: 0, warning: 1, error: 2 };
14627
14659
  }
14628
14660
  });
14629
14661
 
@@ -15197,6 +15229,20 @@ function qualifyId(id, prefix, rootSubsystems) {
15197
15229
  }
15198
15230
  return prefix ? `${prefix}::${id}` : id;
15199
15231
  }
15232
+ function qualifyDeclaredId(id, prefix, mountRealization = false) {
15233
+ if (!id || !prefix) return id;
15234
+ if (id.startsWith("::") || id.startsWith("super::")) {
15235
+ return qualifyId(id, prefix, NO_ROOT_SUBSYSTEMS);
15236
+ }
15237
+ if (mountRealization && id === prefix.split("::").pop()) {
15238
+ return prefix;
15239
+ }
15240
+ return `${prefix}::${id}`;
15241
+ }
15242
+ function qualifySubsystemRef(id, prefix, rootSubsystems) {
15243
+ if (prefix && !id.includes("::") && id === prefix.split("::").pop()) return prefix;
15244
+ return qualifyId(id, prefix, rootSubsystems);
15245
+ }
15200
15246
  function splitNamespace(qualifiedId) {
15201
15247
  if (!qualifiedId.includes("::")) {
15202
15248
  return { prefix: "", localId: qualifiedId };
@@ -15597,7 +15643,14 @@ function buildProjectGraph(level) {
15597
15643
  return buildGraphModel(level);
15598
15644
  }
15599
15645
  function resolveChainingParent() {
15600
- return findChainingParent(getProjectRoot());
15646
+ const reach = getRequestParentReach();
15647
+ if (reach && !reach.parentReach) return null;
15648
+ const parent = findChainingParent(getProjectRoot());
15649
+ if (parent && reach?.topRoot) {
15650
+ const fromTop = path15.relative(path15.resolve(reach.topRoot), path15.resolve(parent.parentRoot));
15651
+ if (fromTop === ".." || fromTop.startsWith(`..${path15.sep}`) || path15.isAbsolute(fromTop)) return null;
15652
+ }
15653
+ return parent;
15601
15654
  }
15602
15655
  function computeGateStateId() {
15603
15656
  let gate = {};
@@ -15662,7 +15715,7 @@ function findLegacySpecFiles() {
15662
15715
  function updateSpec(kind, id, delta, hooks) {
15663
15716
  return current().updateSpec(kind, id, delta, hooks);
15664
15717
  }
15665
- var fs9, path15, SIGNATURE_TTL_MS, SpecWorkspace, workspaces;
15718
+ var fs9, path15, NO_ROOT_SUBSYSTEMS, SIGNATURE_TTL_MS, SpecWorkspace, workspaces;
15666
15719
  var init_specs2 = __esm({
15667
15720
  "src/core/specs.ts"() {
15668
15721
  "use strict";
@@ -15677,6 +15730,7 @@ var init_specs2 = __esm({
15677
15730
  init_models();
15678
15731
  init_narrative_labels();
15679
15732
  init_diagram();
15733
+ NO_ROOT_SUBSYSTEMS = /* @__PURE__ */ new Set();
15680
15734
  SIGNATURE_TTL_MS = 2e3;
15681
15735
  SpecWorkspace = class {
15682
15736
  constructor(rootDir) {
@@ -15826,7 +15880,7 @@ var init_specs2 = __esm({
15826
15880
  }
15827
15881
  }
15828
15882
  index.subsystems = index.subsystems.map((sub) => {
15829
- const qualifiedSubId = namespacePrefix ? qualifyId(sub.id, namespacePrefix, this.rootSubsystems) : sub.id;
15883
+ const qualifiedSubId = namespacePrefix ? qualifyDeclaredId(sub.id, namespacePrefix, true) : sub.id;
15830
15884
  const componentPrefix = sub.projectPath ? qualifiedSubId : namespacePrefix;
15831
15885
  return {
15832
15886
  ...sub,
@@ -15845,14 +15899,14 @@ var init_specs2 = __esm({
15845
15899
  const originalSubsystemPaths = index.paths.subsystem;
15846
15900
  index.paths.subsystem = {};
15847
15901
  for (const [k, v] of Object.entries(originalSubsystemPaths)) {
15848
- const qualifiedK = namespacePrefix ? qualifyId(k, namespacePrefix, this.rootSubsystems) : k;
15902
+ const qualifiedK = namespacePrefix ? qualifyDeclaredId(k, namespacePrefix, true) : k;
15849
15903
  index.paths.subsystem[qualifiedK] = v;
15850
15904
  }
15851
15905
  if (namespacePrefix) {
15852
15906
  index.components = index.components.map((comp) => ({
15853
15907
  ...comp,
15854
- id: qualifyId(comp.id, namespacePrefix, this.rootSubsystems),
15855
- subsystem: qualifyId(comp.subsystem, namespacePrefix, this.rootSubsystems),
15908
+ id: qualifyDeclaredId(comp.id, namespacePrefix),
15909
+ subsystem: qualifySubsystemRef(comp.subsystem, namespacePrefix, this.rootSubsystems),
15856
15910
  owns: comp.owns.map((o) => qualifyId(o, namespacePrefix, this.rootSubsystems)),
15857
15911
  dependsOn: comp.dependsOn.map((d) => qualifyId(d, namespacePrefix, this.rootSubsystems)),
15858
15912
  dispatch: comp.dispatch?.map((b) => ({
@@ -15862,12 +15916,12 @@ var init_specs2 = __esm({
15862
15916
  }));
15863
15917
  index.interfaces = index.interfaces.map((intf) => ({
15864
15918
  ...intf,
15865
- id: qualifyId(intf.id, namespacePrefix, this.rootSubsystems),
15919
+ id: qualifyDeclaredId(intf.id, namespacePrefix),
15866
15920
  component: qualifyId(intf.component, namespacePrefix, this.rootSubsystems)
15867
15921
  }));
15868
15922
  index.implementations = index.implementations.map((impl) => ({
15869
15923
  ...impl,
15870
- id: qualifyId(impl.id, namespacePrefix, this.rootSubsystems),
15924
+ id: qualifyDeclaredId(impl.id, namespacePrefix),
15871
15925
  contract: qualifyId(impl.contract, namespacePrefix, this.rootSubsystems),
15872
15926
  methods: impl.methods.map((m) => ({
15873
15927
  ...m,
@@ -15879,13 +15933,13 @@ var init_specs2 = __esm({
15879
15933
  }));
15880
15934
  index.types = index.types.map((t) => ({
15881
15935
  ...t,
15882
- id: qualifyId(t.id, namespacePrefix, this.rootSubsystems),
15883
- subsystem: t.subsystem ? qualifyId(t.subsystem, namespacePrefix, this.rootSubsystems) : void 0,
15936
+ id: qualifyDeclaredId(t.id, namespacePrefix),
15937
+ subsystem: t.subsystem ? qualifySubsystemRef(t.subsystem, namespacePrefix, this.rootSubsystems) : void 0,
15884
15938
  group: t.group ? qualifyId(t.group, namespacePrefix, this.rootSubsystems) : void 0
15885
15939
  }));
15886
15940
  index.groups = index.groups.map((g) => ({
15887
15941
  ...g,
15888
- id: qualifyId(g.id, namespacePrefix, this.rootSubsystems)
15942
+ id: qualifyDeclaredId(g.id, namespacePrefix)
15889
15943
  }));
15890
15944
  const originalPaths = index.paths;
15891
15945
  index.paths = {
@@ -15897,19 +15951,19 @@ var init_specs2 = __esm({
15897
15951
  group: {}
15898
15952
  };
15899
15953
  for (const [k, v] of Object.entries(originalPaths.component)) {
15900
- index.paths.component[qualifyId(k, namespacePrefix, this.rootSubsystems)] = v;
15954
+ index.paths.component[qualifyDeclaredId(k, namespacePrefix)] = v;
15901
15955
  }
15902
15956
  for (const [k, v] of Object.entries(originalPaths.interface)) {
15903
- index.paths.interface[qualifyId(k, namespacePrefix, this.rootSubsystems)] = v;
15957
+ index.paths.interface[qualifyDeclaredId(k, namespacePrefix)] = v;
15904
15958
  }
15905
15959
  for (const [k, v] of Object.entries(originalPaths.implementation)) {
15906
- index.paths.implementation[qualifyId(k, namespacePrefix, this.rootSubsystems)] = v;
15960
+ index.paths.implementation[qualifyDeclaredId(k, namespacePrefix)] = v;
15907
15961
  }
15908
15962
  for (const [k, v] of Object.entries(originalPaths.type)) {
15909
- index.paths.type[qualifyId(k, namespacePrefix, this.rootSubsystems)] = v;
15963
+ index.paths.type[qualifyDeclaredId(k, namespacePrefix)] = v;
15910
15964
  }
15911
15965
  for (const [k, v] of Object.entries(originalPaths.group)) {
15912
- index.paths.group[qualifyId(k, namespacePrefix, this.rootSubsystems)] = v;
15966
+ index.paths.group[qualifyDeclaredId(k, namespacePrefix)] = v;
15913
15967
  }
15914
15968
  }
15915
15969
  if (currentDepth < maxDepth) {
@@ -21556,7 +21610,7 @@ __export(src_exports, {
21556
21610
  listInstalledPacks: () => listInstalledPacks,
21557
21611
  listMountSnapshots: () => listMountSnapshots,
21558
21612
  listResources: () => listResources,
21559
- listRules: () => listRules,
21613
+ listRules: () => listRules2,
21560
21614
  listSkillNames: () => listSkillNames,
21561
21615
  listSkillResources: () => listSkillResources,
21562
21616
  listSnapshots: () => listSnapshots,