@wairon/cli 5.1.1-dev.46 → 5.1.1-dev.48

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
@@ -1222,7 +1222,7 @@ var init_defaults = __esm({
1222
1222
  copilot: ".github/prompts",
1223
1223
  codex: ".codex/agents"
1224
1224
  };
1225
- WAIRON_VERSION = "5.1.1-dev.46";
1225
+ WAIRON_VERSION = "5.1.1-dev.48";
1226
1226
  GITHUB_REPO = "SYW-Apps/Waffle-AIron";
1227
1227
  ARCHITECT_AGENT_ID = "agent-architect";
1228
1228
  ARCHITECT_TEMPLATE_ID = "architect";
@@ -2965,7 +2965,10 @@ function importBindingOf(facts, name) {
2965
2965
  return ownEntry(facts.importBindings, name);
2966
2966
  }
2967
2967
  function fieldTypesOf(facts, field) {
2968
- return ownEntry(facts.fieldTypes, field) ?? NO_FIELD_TYPES;
2968
+ return ownEntry(facts.fieldTypes, field) ?? NO_DECLARED_TYPES;
2969
+ }
2970
+ function localTypesOf(facts, name) {
2971
+ return ownEntry(facts.localTypes, name) ?? NO_DECLARED_TYPES;
2969
2972
  }
2970
2973
  function typeBindingOf(facts, name) {
2971
2974
  return ownEntry(facts.typeOnlyBindings, name) ?? ownEntry(facts.importBindings, name)?.from;
@@ -2994,12 +2997,12 @@ function resolveImport(fromFile, specifier, knownPaths) {
2994
2997
  }
2995
2998
  return void 0;
2996
2999
  }
2997
- var path5, NO_FIELD_TYPES;
3000
+ var path5, NO_DECLARED_TYPES;
2998
3001
  var init_code_model = __esm({
2999
3002
  "src/models/code-model.ts"() {
3000
3003
  "use strict";
3001
3004
  path5 = __toESM(require("path"));
3002
- NO_FIELD_TYPES = [];
3005
+ NO_DECLARED_TYPES = [];
3003
3006
  }
3004
3007
  });
3005
3008
 
@@ -9101,7 +9104,7 @@ function buildCodeIndex(model) {
9101
9104
  };
9102
9105
  const possibleOriginsOf = (site, from) => {
9103
9106
  const proven = originOf(site, from);
9104
- if (!site.field && !site.constructed) return proven;
9107
+ if (!site.field && !site.constructed && !site.via) return proven;
9105
9108
  const resolved = scopeOf(site, from);
9106
9109
  if (!resolved) return proven;
9107
9110
  const { path: scope, facts: f } = resolved;
@@ -9110,10 +9113,10 @@ function buildCodeIndex(model) {
9110
9113
  const landings = specifier !== void 0 ? landingFrom(scope, specifier) : declarationsAt(scope).has(name) ? republishedFrom(scope) : NO_ORIGIN;
9111
9114
  for (const candidate of landings) out.add(candidate);
9112
9115
  };
9113
- if (site.field) {
9114
- for (const typeName of fieldTypesOf(f, site.field)) widenThrough(typeName, typeBindingOf(f, typeName));
9115
- }
9116
+ const widenThroughType = (typeName) => widenThrough(typeName, typeBindingOf(f, typeName));
9117
+ if (site.field) for (const typeName of fieldTypesOf(f, site.field)) widenThroughType(typeName);
9116
9118
  if (site.constructed) widenThrough(site.constructed, importBindingOf(f, site.constructed)?.from);
9119
+ if (site.via) for (const typeName of localTypesOf(f, site.via)) widenThroughType(typeName);
9117
9120
  return out;
9118
9121
  };
9119
9122
  const declarationsAt = (path27) => namesAt(declarations, pathKey(path27), (f) => /* @__PURE__ */ new Set([...f.declaredNames, ...f.exportedNames]));
@@ -13598,7 +13601,7 @@ var init_call_conformance = __esm({
13598
13601
  claimNoun = (implMethod) => implMethod.narrative.length ? "narrative call step(s)" : "declared call(s)";
13599
13602
  callConformanceRule = {
13600
13603
  name: "call-conformance",
13601
- description: "Code\u2194spec Level 3: the CLAIMED call \u2194 realized call relation, judged both ways against the method's own source file (its sourcePath, else the implementation's), at exact analysis grade only. A method claims a call two ways and they face one check: a narrative `call` step, and an entry of the declared `calls` a narrative-less method reaches its collaborators through. They assert the same thing, and the step number is no part of the claim \u2014 this check never reads order, so it is only how a finding points at one. Forward: every claim must be realized by a call whose callee RESOLVES TO one of the target method's own source files \u2014 the target's contract name or a per-method `symbol` override, closed transitively over the named helpers the realized function calls, and resolved against every file the call CAN have reached: a `this.<field>.<method>()` receiver followed through the field's DECLARED TYPE, a `new Class(...).<method>()` receiver through the module its CLASS NAME came from. A matching call whose origin a pure model cannot resolve is reported apart as CALL_ORIGIN_UNRESOLVED, which NAMES the shape it could not follow and asks for nothing \u2014 a coverage hole in the reader, reported for the reason CONFORMANCE_DEGRADED is: a silently degraded gate is worse than a degraded one. A finding names a landing only from the PROVEN tier so that widening what a call reached can accept a claim but never accuse one, and a target that names no file of its own falls back to name membership. Converse: a call that resolves to a modelled method of ANOTHER component in the SAME file crosses a component boundary while looking local, so the method must claim it \u2014 in a step or in `calls` (UNDECLARED_COLOCATED_CALL) \u2014 judged on the proven tier alone, and a same-file private helper is no modelled method and is never reported. A method that claims nothing at all is judged in neither direction: what it leaves unsaid is UNUSED_*'s subject. Order, arguments and conditions stay unverified, dispatch steps (runtime-table routed) are no claim about a call site, a malformed declared reference is MALFORMED_DECLARED_CALL's finding and names no target here, the conformance dial (off) skips, and weaker analysis grades never guess.",
13604
+ description: "Code\u2194spec Level 3: the CLAIMED call \u2194 realized call relation, judged both ways against the method's own source file (its sourcePath, else the implementation's), at exact analysis grade only. A method claims a call two ways and they face one check: a narrative `call` step, and an entry of the declared `calls` a narrative-less method reaches its collaborators through. They assert the same thing, and the step number is no part of the claim \u2014 this check never reads order, so it is only how a finding points at one. Forward: every claim must be realized by a call whose callee RESOLVES TO one of the target method's own source files \u2014 the target's contract name or a per-method `symbol` override, closed transitively over the named helpers the realized function calls, and resolved against every file the call CAN have reached: a `this.<field>.<method>()` receiver followed through the field's DECLARED TYPE, a `new Class(...).<method>()` receiver through the module its CLASS NAME came from, and a plain `<name>.<method>()` receiver through the type the file ANNOTATES that name with \u2014 a parameter's, or an annotated variable's, which is how a module that wires its collaborators as closures writes every one of its calls. A matching call whose origin a pure model cannot resolve is reported apart as CALL_ORIGIN_UNRESOLVED, which NAMES the shape it could not follow and asks for nothing \u2014 a coverage hole in the reader, reported for the reason CONFORMANCE_DEGRADED is: a silently degraded gate is worse than a degraded one. A finding names a landing only from the PROVEN tier so that widening what a call reached can accept a claim but never accuse one, and a target that names no file of its own falls back to name membership. Converse: a call that resolves to a modelled method of ANOTHER component in the SAME file crosses a component boundary while looking local, so the method must claim it \u2014 in a step or in `calls` (UNDECLARED_COLOCATED_CALL) \u2014 judged on the proven tier alone, and a same-file private helper is no modelled method and is never reported. A method that claims nothing at all is judged in neither direction: what it leaves unsaid is UNUSED_*'s subject. Order, arguments and conditions stay unverified, dispatch steps (runtime-table routed) are no claim about a call site, a malformed declared reference is MALFORMED_DECLARED_CALL's finding and names no target here, the conformance dial (off) skips, and weaker analysis grades never guess.",
13602
13605
  codes: [
13603
13606
  { code: "CALL_STEP_UNREALIZED", defaultSeverity: "warning", summary: "Narrative call step or declared call realized by no call that resolves to the target method's own source file \u2014 the call is absent, or it lands in another module", carryable: true },
13604
13607
  { code: "CALL_ORIGIN_UNRESOLVED", defaultSeverity: "warning", summary: "Narrative call step or declared call whose target name IS called, but only from call sites written in a shape this analysis cannot resolve to a file \u2014 the claim was not checked, and is neither proven realized nor accused", carryable: true },
@@ -13674,7 +13677,7 @@ var init_call_conformance = __esm({
13674
13677
  ctx.addIssue(
13675
13678
  "warning",
13676
13679
  "CALL_ORIGIN_UNRESOLVED",
13677
- `Method "${implMethod.name}" in implementation "${impl.id}": ${unresolved.length} ${claimNoun(implMethod)} ARE called by name inside the function "${fnSymbol}" in "${file}", but every site calling them is written in a shape this analysis cannot resolve to a file \u2014 ${unresolved.map(describeMiss).join("; ")}. What resolves is a name bound to a module of THIS project: a bare or namespaced call through such an import binding, a \`this.<field>\` receiver whose declared type names one, a \`new Class(\u2026)\` receiver whose class does. What does not: an import from a PACKAGE specifier, a receiver holding a value the module assembled, a receiver this model records no name for. This reports what was not checked, not what is wrong \u2014 the claim is neither proven realized nor accused of being missing, and no working call is asked to be rewritten to suit the reader.`,
13680
+ `Method "${implMethod.name}" in implementation "${impl.id}": ${unresolved.length} ${claimNoun(implMethod)} ARE called by name inside the function "${fnSymbol}" in "${file}", but every site calling them is written in a shape this analysis cannot resolve to a file \u2014 ${unresolved.map(describeMiss).join("; ")}. What resolves is a name bound to a module of THIS project: a bare or namespaced call through such an import binding, a \`this.<field>\` receiver whose declared type names one, a \`new Class(\u2026)\` receiver whose class does, and a receiver NAME the file annotates with a type that does. What does not: an import from a PACKAGE specifier, a receiver holding a value the module assembled, a receiver this model records no name for, and one the file annotates with nothing. This reports what was not checked, not what is wrong \u2014 the claim is neither proven realized nor accused of being missing, and no working call is asked to be rewritten to suit the reader.`,
13678
13681
  impl.id,
13679
13682
  entry.draftContext,
13680
13683
  void 0,
@@ -15866,6 +15869,7 @@ function walkExact(ts, sourceText, fileName) {
15866
15869
  const importBindings = /* @__PURE__ */ new Map();
15867
15870
  const typeOnlyBindings = /* @__PURE__ */ new Map();
15868
15871
  const fieldTypes = /* @__PURE__ */ new Map();
15872
+ const localTypes = /* @__PURE__ */ new Map();
15869
15873
  const mutableBindings = /* @__PURE__ */ new Set();
15870
15874
  const receiverKey = (site) => site.via ?? (site.field ? `this.${site.field}` : site.constructed ? `new ${site.constructed}` : "");
15871
15875
  const siteKey = (site) => `${site.member ? "m" : "b"}:${receiverKey(site)}:${site.name}`;
@@ -15893,6 +15897,13 @@ function walkExact(ts, sourceText, fileName) {
15893
15897
  named.add(typeName);
15894
15898
  fieldTypes.set(field, named);
15895
15899
  };
15900
+ const recordLocalType = (name, type) => {
15901
+ const typeName = typeReferenceName(type);
15902
+ if (!typeName || !ts.isIdentifier(name)) return;
15903
+ const named = localTypes.get(name.text) ?? /* @__PURE__ */ new Set();
15904
+ named.add(typeName);
15905
+ localTypes.set(name.text, named);
15906
+ };
15896
15907
  const hasExportModifier = (node) => {
15897
15908
  const mods = node.modifiers;
15898
15909
  return !!mods?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
@@ -15960,6 +15971,7 @@ function walkExact(ts, sourceText, fileName) {
15960
15971
  else if (ts.isParameter(node) && node.parent && ts.isConstructorDeclaration(node.parent) && isParameterProperty(node)) {
15961
15972
  recordFieldType(node.name, node.type);
15962
15973
  }
15974
+ if (ts.isParameter(node) || ts.isVariableDeclaration(node)) recordLocalType(node.name, node.type);
15963
15975
  if (ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node) || ts.isEnumDeclaration(node) || ts.isModuleDeclaration(node)) {
15964
15976
  const name = node.name && ts.isIdentifier(node.name) ? node.name.text : void 0;
15965
15977
  if (name) {
@@ -16036,7 +16048,7 @@ function walkExact(ts, sourceText, fileName) {
16036
16048
  };
16037
16049
  visit(sf);
16038
16050
  const reexportOnly = sf.statements.length > 0 && sf.statements.every((st) => ts.isExportDeclaration(st) && !!st.moduleSpecifier);
16039
- return { declared, anchors, exported, imports, reexports, starExports, namedReexports, complexity, calls, importBindings, typeOnlyBindings, fieldTypes, mutableBindings, reexportOnly };
16051
+ return { declared, anchors, exported, imports, reexports, starExports, namedReexports, complexity, calls, importBindings, typeOnlyBindings, fieldTypes, localTypes, mutableBindings, reexportOnly };
16040
16052
  }
16041
16053
  function resolveRelativeModule(fromFile, specifier) {
16042
16054
  if (!specifier.startsWith(".")) return null;
@@ -16217,6 +16229,7 @@ function buildCodeModel(implementations, types, projectRoot, sourceRoots = [], e
16217
16229
  importBindings: Object.fromEntries(facts.importBindings),
16218
16230
  typeOnlyBindings: Object.fromEntries(facts.typeOnlyBindings),
16219
16231
  fieldTypes: Object.fromEntries([...facts.fieldTypes].map(([k, v]) => [k, [...v]])),
16232
+ localTypes: Object.fromEntries([...facts.localTypes].map(([k, v]) => [k, [...v]])),
16220
16233
  topLevelMutableBindings: [...facts.mutableBindings],
16221
16234
  reexportOnly: facts.reexportOnly
16222
16235
  };
@@ -27441,6 +27454,7 @@ __export(src_exports, {
27441
27454
  loadTypeSpec: () => loadTypeSpec,
27442
27455
  loadTypeSpecs: () => loadTypeSpecs,
27443
27456
  localApprover: () => localApprover,
27457
+ localTypesOf: () => localTypesOf,
27444
27458
  logger: () => logger,
27445
27459
  makeScopeFilter: () => makeScopeFilter,
27446
27460
  markSelectionsBundled: () => markSelectionsBundled,
@@ -28180,6 +28194,7 @@ function loadProjectConfig4() {
28180
28194
  loadTypeSpec,
28181
28195
  loadTypeSpecs,
28182
28196
  localApprover,
28197
+ localTypesOf,
28183
28198
  logger,
28184
28199
  makeScopeFilter,
28185
28200
  markSelectionsBundled,