@inerrata-corporation/errata 2.0.6-dev.2250 → 2.0.6-dev.2266

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.
Files changed (2) hide show
  1. package/errata.mjs +142 -17
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -16488,6 +16488,66 @@ function parseGemspec(path2, text) {
16488
16488
  }
16489
16489
  return deps;
16490
16490
  }
16491
+ function tomlTable(text, header) {
16492
+ const escaped = header.replace(/[.[\]]/g, "\\$&");
16493
+ return new RegExp(`^\\s*\\[${escaped}\\]([\\s\\S]*?)(?=^\\s*\\[|(?![\\s\\S]))`, "m").exec(text)?.[1] ?? null;
16494
+ }
16495
+ function tomlName(table) {
16496
+ return table && /^\s*name\s*=\s*["']([^"']+)["']/m.exec(table)?.[1]?.trim() || null;
16497
+ }
16498
+ function pomSelf(text) {
16499
+ const parentGroup = /<groupId>([^<]+)<\/groupId>/.exec(/<parent>([\s\S]*?)<\/parent>/.exec(text)?.[1] ?? "")?.[1];
16500
+ const own = text.replace(POM_FOREIGN_BLOCKS, "");
16501
+ const group = (/<groupId>([^<]+)<\/groupId>/.exec(own)?.[1] ?? parentGroup)?.trim();
16502
+ const artifact = /<artifactId>([^<]+)<\/artifactId>/.exec(own)?.[1]?.trim();
16503
+ if (!group) return [];
16504
+ const self = [{ ecosystem: "maven", kind: "namespace", value: group }];
16505
+ if (artifact) self.push({ ecosystem: "maven", kind: "name", value: mavenName(group, artifact) });
16506
+ return self;
16507
+ }
16508
+ function parseManifestSelf(path2, text) {
16509
+ const file2 = basename(path2);
16510
+ if (file2 === "package.json") {
16511
+ let obj;
16512
+ try {
16513
+ obj = JSON.parse(text);
16514
+ } catch {
16515
+ return [];
16516
+ }
16517
+ const name2 = obj && typeof obj === "object" ? obj["name"] : null;
16518
+ if (typeof name2 !== "string" || !name2.trim()) return [];
16519
+ const self = [{ ecosystem: "npm", kind: "name", value: name2.trim() }];
16520
+ const scope = /^(@[^/]+)\//.exec(name2.trim())?.[1];
16521
+ if (scope) self.push({ ecosystem: "npm", kind: "namespace", value: scope });
16522
+ return self;
16523
+ }
16524
+ if (file2 === "pom.xml") return pomSelf(text);
16525
+ if (file2 === "build.gradle" || file2 === "build.gradle.kts") {
16526
+ const group = /^\s*group\s*(?:=\s*)?["']([^"']+)["']/m.exec(text)?.[1]?.trim();
16527
+ return group ? [{ ecosystem: "maven", kind: "namespace", value: group }] : [];
16528
+ }
16529
+ if (file2 === "Cargo.toml") {
16530
+ const name2 = tomlName(tomlTable(text, "package"));
16531
+ return name2 ? [{ ecosystem: "cargo", kind: "name", value: name2 }] : [];
16532
+ }
16533
+ if (file2 === "pyproject.toml") {
16534
+ const name2 = tomlName(tomlTable(text, "project")) ?? tomlName(tomlTable(text, "tool.poetry"));
16535
+ return name2 ? [{ ecosystem: "pypi", kind: "name", value: name2 }] : [];
16536
+ }
16537
+ if (file2 === "go.mod") {
16538
+ const module2 = /^\s*module\s+(\S+)/m.exec(text)?.[1];
16539
+ return module2 ? [{ ecosystem: "golang", kind: "namespace", value: module2 }] : [];
16540
+ }
16541
+ if (file2.endsWith(".gemspec")) {
16542
+ const name2 = /\.name\s*=\s*["']([^"']+)["']/.exec(text)?.[1]?.trim();
16543
+ return name2 ? [{ ecosystem: "gem", kind: "name", value: name2 }] : [];
16544
+ }
16545
+ if (file2.endsWith(".csproj") || file2.endsWith(".fsproj")) {
16546
+ const id = /<PackageId>([^<]+)<\/PackageId>/.exec(text)?.[1]?.trim() ?? file2.replace(/\.(cs|fs)proj$/, "");
16547
+ return id ? [{ ecosystem: "nuget", kind: "name", value: id }] : [];
16548
+ }
16549
+ return [];
16550
+ }
16491
16551
  function parseManifest(path2, text) {
16492
16552
  const name2 = basename(path2);
16493
16553
  if (name2.endsWith(".csproj") || name2.endsWith(".fsproj")) return parseCsproj(path2, text);
@@ -16554,7 +16614,7 @@ function depsForUnit(spine, touched, readParentText) {
16554
16614
  for (const purl of declared.keys()) context.delete(purl);
16555
16615
  return { declared: [...declared.values()], context: [...context.values()] };
16556
16616
  }
16557
- var ECOSYSTEM_SYSTEM, ECOSYSTEM_LANGUAGE, TOOL_KINDS, MANIFEST_PATH_RE, LOCAL_IMAGE_RE, PACKAGE_JSON_SECTIONS, GRADLE_CONFIGS;
16617
+ var ECOSYSTEM_SYSTEM, ECOSYSTEM_LANGUAGE, TOOL_KINDS, MANIFEST_PATH_RE, LOCAL_IMAGE_RE, PACKAGE_JSON_SECTIONS, GRADLE_CONFIGS, POM_FOREIGN_BLOCKS;
16558
16618
  var init_manifests = __esm({
16559
16619
  "../../packages/shared/src/manifests.ts"() {
16560
16620
  "use strict";
@@ -16586,6 +16646,7 @@ var init_manifests = __esm({
16586
16646
  LOCAL_IMAGE_RE = /^(openbane|local)[/-]|:local$/;
16587
16647
  PACKAGE_JSON_SECTIONS = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
16588
16648
  GRADLE_CONFIGS = "implementation|api|compileOnly|compileOnlyApi|runtimeOnly|testImplementation|testCompileOnly|testRuntimeOnly|annotationProcessor|kapt|ksp|classpath|developmentOnly";
16649
+ POM_FOREIGN_BLOCKS = /<(parent|dependencies|dependencyManagement|build|profiles|reporting|distributionManagement|modules)>[\s\S]*?<\/\1>/g;
16589
16650
  }
16590
16651
  });
16591
16652
 
@@ -16737,6 +16798,7 @@ __export(src_exports, {
16737
16798
  pagerankEdgeTypes: () => pagerankEdgeTypes,
16738
16799
  parseGemfileLock: () => parseGemfileLock,
16739
16800
  parseManifest: () => parseManifest,
16801
+ parseManifestSelf: () => parseManifestSelf,
16740
16802
  parsePackageLockJson: () => parsePackageLockJson,
16741
16803
  parsePackageRef: () => parsePackageRef,
16742
16804
  parsePnpmLock: () => parsePnpmLock,
@@ -76063,8 +76125,42 @@ var PUBLIC_REGISTRY_POLICY = {
76063
76125
  npmPrivateScopes: /* @__PURE__ */ new Set(),
76064
76126
  goPrivatePatterns: [],
76065
76127
  privateGemNames: /* @__PURE__ */ new Set(),
76066
- selfTokens: []
76128
+ selfTokens: [],
76129
+ selfNames: /* @__PURE__ */ new Set(),
76130
+ selfNamespaces: /* @__PURE__ */ new Set(),
76131
+ selfComplete: true
76067
76132
  };
76133
+ function ecoKey(ecosystem, name2) {
76134
+ return `${ecosystem.toLowerCase()}\0${name2.toLowerCase()}`;
76135
+ }
76136
+ function selfIdentityFrom(selves) {
76137
+ const selfNames = /* @__PURE__ */ new Set();
76138
+ const selfNamespaces = /* @__PURE__ */ new Set();
76139
+ for (const s of selves) {
76140
+ (s.kind === "name" ? selfNames : selfNamespaces).add(ecoKey(s.ecosystem, s.value));
76141
+ }
76142
+ return { selfNames, selfNamespaces };
76143
+ }
76144
+ function namespacesOf(ecosystem, name2) {
76145
+ switch (ecosystem) {
76146
+ case "npm": {
76147
+ const scope = npmScopeOf(name2);
76148
+ return scope ? [scope] : [];
76149
+ }
76150
+ case "maven":
76151
+ return [name2.split(":")[0] ?? ""].filter(Boolean);
76152
+ case "golang": {
76153
+ const parts2 = name2.split("/");
76154
+ return parts2.map((_, i2) => parts2.slice(0, i2 + 1).join("/"));
76155
+ }
76156
+ default:
76157
+ return [];
76158
+ }
76159
+ }
76160
+ function isWorkspaceSelf(ecosystem, name2, policy) {
76161
+ if (policy.selfNames.has(ecoKey(ecosystem, name2))) return true;
76162
+ return namespacesOf(ecosystem, name2).some((ns) => policy.selfNamespaces.has(ecoKey(ecosystem, ns)));
76163
+ }
76068
76164
  function hostOf(value) {
76069
76165
  try {
76070
76166
  return new URL(value.trim()).hostname.toLowerCase();
@@ -76327,12 +76423,15 @@ function loadRegistryPolicy(root, env2 = process.env, repoLocator) {
76327
76423
  )) {
76328
76424
  blocked.add("maven");
76329
76425
  }
76426
+ const scan2 = scanManifests(root);
76330
76427
  return {
76331
76428
  blockedEcosystems: blocked,
76332
76429
  npmPrivateScopes: npm.privateScopes,
76333
76430
  goPrivatePatterns,
76334
76431
  privateGemNames: privateGemNamesIn(gemfiles),
76335
- selfTokens: selfTokensFromLocator(repoLocator)
76432
+ selfTokens: selfTokensFromLocator(repoLocator),
76433
+ ...selfIdentityFrom(scan2.self),
76434
+ selfComplete: scan2.complete
76336
76435
  };
76337
76436
  }
76338
76437
  function npmScopeOf(name2) {
@@ -76343,6 +76442,7 @@ function npmScopeOf(name2) {
76343
76442
  function isPublicDep(dep, policy) {
76344
76443
  const ecosystem = dep.ecosystem.toLowerCase();
76345
76444
  if (policy.blockedEcosystems.has(ecosystem)) return false;
76445
+ if (isWorkspaceSelf(ecosystem, dep.name, policy)) return false;
76346
76446
  switch (ecosystem) {
76347
76447
  case "npm": {
76348
76448
  const scope = npmScopeOf(dep.name);
@@ -76423,7 +76523,6 @@ function retrievalStackTokens(input) {
76423
76523
  let fromLockfile = 0;
76424
76524
  let fromManifest = 0;
76425
76525
  const lockfileKeys = /* @__PURE__ */ new Set();
76426
- const ecoKey = (ecosystem, name2) => `${ecosystem.toLowerCase()}\0${name2.toLowerCase()}`;
76427
76526
  if (packagesAllowed) {
76428
76527
  for (const d of input.direct ?? []) {
76429
76528
  lockfileKeys.add(ecoKey(d.ecosystem, d.name));
@@ -76431,7 +76530,7 @@ function retrievalStackTokens(input) {
76431
76530
  add({ ecosystem: d.ecosystem.toLowerCase(), name: d.name, weight: d.importers });
76432
76531
  }
76433
76532
  const counted = /* @__PURE__ */ new Map();
76434
- for (const d of manifestDeps) {
76533
+ for (const d of registry2.selfComplete ? manifestDeps : []) {
76435
76534
  if (RUNTIME_KINDS.has(d.kind)) continue;
76436
76535
  const ecosystem = d.ecosystem.toLowerCase();
76437
76536
  if (lockfileKeys.has(ecoKey(ecosystem, d.name))) continue;
@@ -76521,7 +76620,13 @@ function manifestPaths(root) {
76521
76620
  stdio: ["ignore", "pipe", "ignore"]
76522
76621
  });
76523
76622
  const paths = out2.split("\0").filter((f) => f && isManifestPath(f));
76524
- if (paths.length > 0) return paths.slice(0, MANIFEST_SCAN_CAP);
76623
+ if (paths.length > 0) {
76624
+ return {
76625
+ paths: paths.slice(0, MANIFEST_SCAN_CAP),
76626
+ tracked: true,
76627
+ truncated: paths.length > MANIFEST_SCAN_CAP
76628
+ };
76629
+ }
76525
76630
  } catch {
76526
76631
  }
76527
76632
  const ROOT_MANIFESTS = [
@@ -76541,14 +76646,24 @@ function manifestPaths(root) {
76541
76646
  "Dockerfile",
76542
76647
  "project.godot"
76543
76648
  ];
76544
- return ROOT_MANIFESTS.filter((f) => existsSync19(join23(root, f)));
76649
+ return {
76650
+ paths: ROOT_MANIFESTS.filter((f) => existsSync19(join23(root, f))),
76651
+ tracked: false,
76652
+ truncated: false
76653
+ };
76545
76654
  }
76655
+ var WORKSPACE_MARKERS = ["pnpm-workspace.yaml", "lerna.json", "go.work", "settings.gradle", "settings.gradle.kts"];
76656
+ function rootDeclaresWorkspace(root, texts) {
76657
+ if (WORKSPACE_MARKERS.some((f) => existsSync19(join23(root, f)))) return true;
76658
+ return /"workspaces"\s*:/.test(texts.get("package.json") ?? "") || /<modules>/.test(texts.get("pom.xml") ?? "") || /^\s*\[workspace\]/m.test(texts.get("Cargo.toml") ?? "");
76659
+ }
76660
+ var EMPTY_SCAN = { deps: [], self: [], complete: true };
76546
76661
  var manifestCache = /* @__PURE__ */ new Map();
76547
- function readManifestDependencies(root) {
76548
- const paths = manifestPaths(root);
76662
+ function scanManifests(root) {
76663
+ const { paths, tracked, truncated } = manifestPaths(root);
76549
76664
  if (paths.length === 0) {
76550
76665
  manifestCache.delete(root);
76551
- return [];
76666
+ return EMPTY_SCAN;
76552
76667
  }
76553
76668
  const texts = /* @__PURE__ */ new Map();
76554
76669
  const stamps = [];
@@ -76563,16 +76678,26 @@ function readManifestDependencies(root) {
76563
76678
  }
76564
76679
  const key = stamps.join("|");
76565
76680
  const hit = manifestCache.get(root);
76566
- if (hit && hit.key === key) return hit.deps;
76567
- let deps = [];
76681
+ if (hit && hit.key === key) return hit.scan;
76682
+ const scan2 = {
76683
+ deps: [],
76684
+ self: [],
76685
+ complete: !truncated && (tracked || !rootDeclaresWorkspace(root, texts))
76686
+ };
76568
76687
  try {
76569
76688
  const spine = buildSpine("workspace", [...texts.keys()], (p) => texts.get(p) ?? "");
76570
- deps = Object.values(spine.manifests).flat();
76689
+ scan2.deps = Object.values(spine.manifests).flat();
76690
+ for (const [path2, text] of texts) scan2.self.push(...parseManifestSelf(path2, text));
76571
76691
  } catch {
76572
- deps = [];
76692
+ scan2.deps = [];
76693
+ scan2.self = [];
76694
+ scan2.complete = false;
76573
76695
  }
76574
- manifestCache.set(root, { key, deps });
76575
- return deps;
76696
+ manifestCache.set(root, { key, scan: scan2 });
76697
+ return scan2;
76698
+ }
76699
+ function readManifestDependencies(root) {
76700
+ return scanManifests(root).deps;
76576
76701
  }
76577
76702
 
76578
76703
  // src/git-sensor.ts
@@ -77921,7 +78046,7 @@ function createWatchBreaker(deps) {
77921
78046
  }
77922
78047
 
77923
78048
  // src/engine.ts
77924
- var DAEMON_VERSION = true ? "2.0.6-dev.2250" : "2.0.0-alpha.0";
78049
+ var DAEMON_VERSION = true ? "2.0.6-dev.2266" : "2.0.0-alpha.0";
77925
78050
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
77926
78051
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
77927
78052
  var GIT_OP_MUTE_MS = 4e3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.6-dev.2250",
3
+ "version": "2.0.6-dev.2266",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {