archctx 0.11.0 → 0.11.1

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": "archcontext.practice-catalog-manifest/v1",
3
3
  "catalogVersion": "2026.06.0",
4
- "productVersion": "0.11.0",
4
+ "productVersion": "0.11.1",
5
5
  "generatedAt": "1970-01-01T00:00:00.000Z",
6
6
  "entries": [
7
7
  {
@@ -389,5 +389,5 @@
389
389
  "structurizr.dsl",
390
390
  "twelve-factor"
391
391
  ],
392
- "catalogDigest": "sha256:855b3458f393a75cbfd43190be8996ada23b3a96f803df5fe5ed88ad69ba3ef4"
392
+ "catalogDigest": "sha256:3a92b39430c496c74e2c3798505a29d60bc6aa182bbb9c70fc328b977d4086a7"
393
393
  }
package/bin/archctx.mjs CHANGED
@@ -2707,6 +2707,10 @@ function localFactValue(rule, value) {
2707
2707
  return value;
2708
2708
  if (rule === "head" && /^[a-f0-9]{40}$/.test(value))
2709
2709
  return value;
2710
+ if (rule === "repoPath" && isRepoRelativePosixPath(value))
2711
+ return value;
2712
+ if (rule === "exportsSubpath" && value.startsWith("."))
2713
+ return value;
2710
2714
  if (localEnums[rule]?.includes(value))
2711
2715
  return value;
2712
2716
  }
@@ -3041,7 +3045,7 @@ var init_failure = __esm(() => {
3041
3045
  "history-shallow-repository": { code: "AC_PRECONDITION_FAILED", message: "Architecture history requires a complete Git repository.", action: "unshallow-repository" },
3042
3046
  "code-facts-read-not-ready": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "The existing CodeGraph index does not attest to the current source population.", facts: { issues: "codeFactsIssues" }, action: "codegraph-sync", retryable: false },
3043
3047
  "code-facts-snapshot-changed": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "Source or index inputs changed while reading the private snapshot.", action: "retry-read", retryable: true, facts: {} },
3044
- "code-facts-snapshot-limit-exceeded": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "The private CodeGraph snapshot exceeds its 512 MiB or 100000 entry limit.", action: "reduce-snapshot-size", retryable: false, facts: {} },
3048
+ "code-facts-snapshot-limit-exceeded": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "The private CodeGraph snapshot copy exceeds its 512 MiB or 100000 entry limit.", action: "reduce-snapshot-size", retryable: false, facts: { limit: "snapshotLimit", maxBytes: "uint", maxEntries: "uint", sourceBytes: "uint", sourceEntries: "uint", gitBytes: "uint", gitEntries: "uint", gitObjectEntries: "uint", indexBytes: "uint", indexEntries: "uint" } },
3045
3049
  "code-facts-snapshot-layout-unsupported": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "The repository layout cannot be safely isolated for a zero-write CodeGraph read.", action: "inspect-repository-layout", retryable: false, facts: {} },
3046
3050
  "daemon-root-missing": { code: "AC_RUNTIME_UNAVAILABLE", message: "The daemon start worktree no longer exists. Stop this daemon using its workspace state directory.", action: "stop-targeted-daemon", retryable: false, facts: {} },
3047
3051
  "changeset-receipt-journal-unavailable": { code: "AC_PRECONDITION_FAILED", message: "No committed ChangeSet journal exists for this repository and journal id.", action: "select-committed-journal" },
@@ -3174,6 +3178,7 @@ var init_failure = __esm(() => {
3174
3178
  "changeset-rollback-conflict": { code: "AC_PRECONDITION_FAILED", message: "ChangeSet rollback is incomplete because the projection manifest changed externally. Preserve the pending journal and backup for manual recovery.", facts: { journalId: "optional:id", changeSetId: "id", manualRecoveryRequired: "boolean" } },
3175
3179
  "deps-input-invalid": { code: "AC_SCHEMA_INVALID", message: "Deps input invalid.", facts: { field: "optional:depsField", issue: "optional:depsIssue" } },
3176
3180
  "deps-workspace-invalid": { code: "AC_SCHEMA_INVALID", message: "Deps workspace invalid.", facts: {} },
3181
+ "workspace-exports-unsupported": { code: "AC_SCHEMA_INVALID", message: "A workspace package.json exports value has an unsupported shape.", facts: { manifestPath: "repoPath", subpath: "exportsSubpath" } },
3177
3182
  "deps-model-unreadable": { code: "AC_MODEL_ADOPTION_REQUIRED", message: "Deps model unreadable.", facts: {} },
3178
3183
  "code-facts-unavailable": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "Code facts unavailable.", facts: {} },
3179
3184
  "projection-check-mode-invalid": { code: "AC_SCHEMA_INVALID", message: "Projection check mode invalid.", facts: {} },
@@ -3321,6 +3326,7 @@ var init_failure = __esm(() => {
3321
3326
  depsField: ["from", "into", "importNodeLimit", "edgeLimit"],
3322
3327
  depsIssue: ["unknown-node", "invalid-limit", "missing-value"],
3323
3328
  snapshotField: ["repositoryId", "workspaceId", "headSha", "worktreeDigest"],
3329
+ snapshotLimit: ["bytes", "entries"],
3324
3330
  jobsField: ["workerId"],
3325
3331
  observedDomain: ["observed"],
3326
3332
  inputAvailability: ["unavailable"],
@@ -4119,7 +4125,7 @@ function compareVersionTriples(left, right) {
4119
4125
  }
4120
4126
  return 0;
4121
4127
  }
4122
- var ARCHCONTEXT_PRODUCT_NAME = "archctx", ARCHCONTEXT_PRODUCT_VERSION = "0.11.0", ARCHCONTEXT_PACKAGE_MANAGER = "bun@1.4.3", ARCHCONTEXT_NODE_RANGE = ">=22.22 <26", LOCAL_RUNTIME_RPC_SCHEMA_VERSION = "archcontext.runtime-rpc/v2", ARCHCONTEXT_SCHEMA_SET_VERSION = "2026-07-11.explorer-view-v2";
4128
+ var ARCHCONTEXT_PRODUCT_NAME = "archctx", ARCHCONTEXT_PRODUCT_VERSION = "0.11.1", ARCHCONTEXT_PACKAGE_MANAGER = "bun@1.4.3", ARCHCONTEXT_NODE_RANGE = ">=22.22 <26", LOCAL_RUNTIME_RPC_SCHEMA_VERSION = "archcontext.runtime-rpc/v2", ARCHCONTEXT_SCHEMA_SET_VERSION = "2026-07-11.explorer-view-v2";
4123
4129
 
4124
4130
  // packages/contracts/src/refactor.ts
4125
4131
  function refactorNamespaceIssues(value, label = "product.id") {
@@ -23616,9 +23622,43 @@ function readWorkspacePackages(root) {
23616
23622
  return (manifest.workspaces ?? []).flatMap((entry) => expandWorkspaceEntry(root, entry)).map((directory) => {
23617
23623
  const path = join2(root, ...directory.split("/"), "package.json");
23618
23624
  const packageManifest = JSON.parse(readFileSync6(path, "utf8"));
23619
- return { name: packageManifest.name, root: directory, exports: packageManifest.exports ?? {} };
23625
+ return { name: packageManifest.name, root: directory, exports: normalizePackageExports(packageManifest.exports, `${directory}/package.json`) };
23620
23626
  }).sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
23621
23627
  }
23628
+ var EXPORT_CONDITIONS = ["types", "import", "default", "require"];
23629
+ function normalizePackageExports(exportsField, manifestPath) {
23630
+ if (exportsField === undefined)
23631
+ return {};
23632
+ const unsupported = (subpath) => new FailureError("AC_SCHEMA_INVALID", "workspace-exports-unsupported", { manifestPath, subpath });
23633
+ const target = (value, subpath) => {
23634
+ if (typeof value === "string")
23635
+ return value;
23636
+ if (value === null)
23637
+ return;
23638
+ if (typeof value !== "object")
23639
+ throw unsupported(subpath);
23640
+ const candidates = Array.isArray(value) ? value : EXPORT_CONDITIONS.filter((condition) => Object.hasOwn(value, condition)).map((condition) => value[condition]);
23641
+ for (const candidate of candidates) {
23642
+ const resolved = target(candidate, subpath);
23643
+ if (resolved !== undefined)
23644
+ return resolved;
23645
+ }
23646
+ return;
23647
+ };
23648
+ const keys = exportsField !== null && typeof exportsField === "object" && !Array.isArray(exportsField) ? Object.keys(exportsField) : [];
23649
+ const subpathKeys = keys.filter((key) => key.startsWith("."));
23650
+ if (subpathKeys.length === 0) {
23651
+ const root = target(exportsField, ".");
23652
+ return root === undefined ? {} : { ".": root };
23653
+ }
23654
+ if (subpathKeys.length !== keys.length)
23655
+ throw unsupported(".");
23656
+ const entries = subpathKeys.flatMap((subpath) => {
23657
+ const resolved = target(exportsField[subpath], subpath);
23658
+ return resolved === undefined ? [] : [[subpath, resolved]];
23659
+ });
23660
+ return Object.fromEntries(entries);
23661
+ }
23622
23662
  function expandWorkspaceEntry(root, entry) {
23623
23663
  if (!entry.includes("*"))
23624
23664
  return [entry];
@@ -25935,9 +25975,6 @@ function withExistingCodeGraphSnapshot(root, queries, callback, options = {}) {
25935
25975
  const gitDir = gitPath("--git-dir");
25936
25976
  const commonDir = gitPath("--git-common-dir");
25937
25977
  assertSnapshotGitReadSafety(originalRoot);
25938
- if (existsSync6(join3(commonDir, "objects/info/alternates"))) {
25939
- throw new FailureError("AC_CODE_FACTS_UNAVAILABLE", "code-facts-snapshot-layout-unsupported");
25940
- }
25941
25978
  const temporaryParent = realpathSync3.native(tmpdir2());
25942
25979
  const temporaryRelative = relative4(originalRoot, temporaryParent);
25943
25980
  if (!temporaryRelative || temporaryRelative !== ".." && !temporaryRelative.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) && !isAbsolute4(temporaryRelative)) {
@@ -26007,28 +26044,50 @@ function assertSnapshotGitReadSafety(root) {
26007
26044
  }
26008
26045
  }
26009
26046
  }
26047
+ function pinSnapshotHooks(snapshotRepository) {
26048
+ const gitDir = join3(snapshotRepository, ".git");
26049
+ const hooks = join3(gitDir, "archctx-empty-hooks");
26050
+ mkdirSync4(hooks);
26051
+ const path = process.platform === "win32" ? hooks.replaceAll("\\", "/") : hooks;
26052
+ const options = { cwd: snapshotRepository, encoding: "utf8", stdio: "pipe", timeout: 5000 };
26053
+ const pinned = spawnSync4("git", ["config", "--file", join3(gitDir, "config"), "--replace-all", "core.hooksPath", path], options);
26054
+ const effective = spawnSync4("git", ["config", "--get", "core.hooksPath"], options);
26055
+ if (pinned.status !== 0 || effective.status !== 0 || effective.stdout.replace(/\r?\n$/, "") !== path) {
26056
+ throw new FailureError("AC_CODE_FACTS_UNAVAILABLE", "code-facts-snapshot-layout-unsupported");
26057
+ }
26058
+ }
26010
26059
  function mirrorCodeGraphInputs(root, gitDir, commonDir, destination) {
26011
26060
  const hash = createHash5("sha256");
26061
+ const measured = { sourceBytes: 0, sourceEntries: 0, gitBytes: 0, gitEntries: 0, gitObjectEntries: 0, indexBytes: 0, indexEntries: 0 };
26012
26062
  let bytes = 0;
26013
26063
  let entries = 0;
26014
- const visit = (source, target, skip = new Set) => {
26064
+ let limit;
26065
+ const fingerprint = (source, target) => {
26015
26066
  const stat = lstatSync4(source, { bigint: true });
26016
26067
  if (++entries > CODEGRAPH_SNAPSHOT_MAX_ENTRIES)
26017
- throw new FailureError("AC_CODE_FACTS_UNAVAILABLE", "code-facts-snapshot-limit-exceeded");
26068
+ limit ??= "entries";
26018
26069
  hash.update(JSON.stringify([source, target, String(stat.ino), String(stat.size), String(stat.mtimeNs), String(stat.ctimeNs)]));
26070
+ return stat;
26071
+ };
26072
+ const visit = (part, source, target, skip = new Set) => {
26073
+ const stat = fingerprint(source, target);
26074
+ measured[`${part}Entries`]++;
26019
26075
  if (stat.isDirectory()) {
26020
- if (destination)
26076
+ if (destination && !limit)
26021
26077
  mkdirSync4(join3(destination, target), { recursive: true });
26022
26078
  for (const name of readdirSync4(source).sort()) {
26023
26079
  if (!skip.has(name))
26024
- visit(join3(source, name), join3(target, name));
26080
+ visit(part, join3(source, name), join3(target, name));
26025
26081
  }
26026
26082
  } else if (stat.isFile()) {
26027
26083
  if (basename3(target) === ".git")
26028
26084
  throw new FailureError("AC_CODE_FACTS_UNAVAILABLE", "code-facts-snapshot-layout-unsupported");
26085
+ measured[`${part}Bytes`] += Number(stat.size);
26029
26086
  bytes += Number(stat.size);
26030
26087
  if (bytes > CODEGRAPH_SNAPSHOT_MAX_BYTES)
26031
- throw new FailureError("AC_CODE_FACTS_UNAVAILABLE", "code-facts-snapshot-limit-exceeded");
26088
+ limit ??= "bytes";
26089
+ if (limit)
26090
+ return;
26032
26091
  const data = Buffer.alloc(Number(stat.size));
26033
26092
  const fd = openSync3(source, "r");
26034
26093
  try {
@@ -26053,6 +26112,33 @@ function mirrorCodeGraphInputs(root, gitDir, commonDir, destination) {
26053
26112
  throw new FailureError("AC_CODE_FACTS_UNAVAILABLE", "code-facts-snapshot-layout-unsupported");
26054
26113
  }
26055
26114
  };
26115
+ const visitObjects = (source, target) => {
26116
+ const stat = fingerprint(source, target);
26117
+ measured.gitObjectEntries++;
26118
+ if (stat.isDirectory()) {
26119
+ for (const name of readdirSync4(source).sort())
26120
+ visitObjects(join3(source, name), join3(target, name));
26121
+ } else if (!stat.isFile()) {
26122
+ throw new FailureError("AC_CODE_FACTS_UNAVAILABLE", "code-facts-snapshot-layout-unsupported");
26123
+ }
26124
+ };
26125
+ const visitRepository = (source, target, skip) => {
26126
+ const objects = join3(source, "objects");
26127
+ if (existsSync6(join3(objects, "info/alternates")))
26128
+ throw new FailureError("AC_CODE_FACTS_UNAVAILABLE", "code-facts-snapshot-layout-unsupported");
26129
+ visit("git", source, target, new Set([...skip, "objects", "hooks", "archctx-empty-hooks"]));
26130
+ visitObjects(objects, join3(target, "objects"));
26131
+ const original = realpathSync3.native(objects);
26132
+ const alternate = process.platform === "win32" ? original.replaceAll("\\", "/") : original;
26133
+ if (/[\r\n]/.test(alternate))
26134
+ throw new FailureError("AC_CODE_FACTS_UNAVAILABLE", "code-facts-snapshot-layout-unsupported");
26135
+ if (destination && !limit) {
26136
+ mkdirSync4(join3(destination, target, "objects/pack"), { recursive: true });
26137
+ mkdirSync4(join3(destination, target, "objects/info"), { recursive: true });
26138
+ writeFileSync3(join3(destination, target, "objects/info/alternates"), `${alternate}
26139
+ `);
26140
+ }
26141
+ };
26056
26142
  const sourceFiles = codeGraphSourceScanner()(root);
26057
26143
  const files = new Set([...sourceFiles, ...listGitVisibleFiles(root)]);
26058
26144
  const directories = new Set(["."]);
@@ -26073,7 +26159,7 @@ function mirrorCodeGraphInputs(root, gitDir, commonDir, destination) {
26073
26159
  files.add(path);
26074
26160
  }
26075
26161
  if (directory !== "." && existsSync6(join3(root, directory, ".git"))) {
26076
- visit(join3(root, directory, ".git"), join3(directory, ".git"));
26162
+ visitRepository(join3(root, directory, ".git"), join3(directory, ".git"), new Set);
26077
26163
  assertSnapshotGitReadSafety(join3(root, directory));
26078
26164
  repositories.add(directory);
26079
26165
  }
@@ -26083,20 +26169,30 @@ function mirrorCodeGraphInputs(root, gitDir, commonDir, destination) {
26083
26169
  if (file.split(/[\\/]/).some((part) => part === ".git" || part === ".codegraph")) {
26084
26170
  throw new FailureError("AC_CODE_FACTS_UNAVAILABLE", "code-facts-snapshot-layout-unsupported");
26085
26171
  }
26086
- visit(join3(root, file), file);
26172
+ visit("source", join3(root, file), file);
26087
26173
  }
26088
- visit(commonDir, ".git", new Set(["worktrees"]));
26174
+ visitRepository(commonDir, ".git", new Set(["worktrees"]));
26089
26175
  if (gitDir !== commonDir)
26090
- visit(gitDir, ".git", new Set(["commondir", "gitdir"]));
26176
+ visit("git", gitDir, ".git", new Set(["commondir", "gitdir"]));
26091
26177
  for (const suffix of ["", "-wal"]) {
26092
26178
  const source = join3(root, ".codegraph", `codegraph.db${suffix}`);
26093
26179
  hash.update(JSON.stringify([suffix, existsSync6(source)]));
26094
26180
  if (existsSync6(source))
26095
- visit(source, join3(".codegraph", `codegraph.db${suffix}`));
26181
+ visit("index", source, join3(".codegraph", `codegraph.db${suffix}`));
26182
+ }
26183
+ if (limit) {
26184
+ throw new FailureError("AC_CODE_FACTS_UNAVAILABLE", "code-facts-snapshot-limit-exceeded", {
26185
+ limit,
26186
+ maxBytes: CODEGRAPH_SNAPSHOT_MAX_BYTES,
26187
+ maxEntries: CODEGRAPH_SNAPSHOT_MAX_ENTRIES,
26188
+ ...measured
26189
+ });
26096
26190
  }
26097
26191
  if (destination)
26098
- for (const repository of repositories)
26192
+ for (const repository of repositories) {
26193
+ pinSnapshotHooks(join3(destination, repository));
26099
26194
  assertSnapshotGitReadSafety(join3(destination, repository));
26195
+ }
26100
26196
  return hash.digest("hex");
26101
26197
  }
26102
26198
  var CODEGRAPH_NO_DOWNLOAD_ENV = { CODEGRAPH_NO_DOWNLOAD: "1" };
@@ -32887,8 +32983,7 @@ function reviewWorkspacePackages(root) {
32887
32983
  const packageManifest = JSON.parse(readFileSync10(join7(root, ...directory.split("/"), "package.json"), "utf8"));
32888
32984
  if (typeof packageManifest.name !== "string")
32889
32985
  return [];
32890
- const exports = typeof packageManifest.exports === "string" ? { ".": packageManifest.exports } : Object.fromEntries(Object.entries(packageManifest.exports ?? {}).filter((entry) => typeof entry[1] === "string"));
32891
- return [{ name: packageManifest.name, root: directory, exports }];
32986
+ return [{ name: packageManifest.name, root: directory, exports: normalizePackageExports(packageManifest.exports, `${directory}/package.json`) }];
32892
32987
  });
32893
32988
  return { packages: packages.sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0), resolved: true };
32894
32989
  } catch {
@@ -54646,6 +54741,8 @@ function readWorkspaces2(root) {
54646
54741
  try {
54647
54742
  return declaredWorkspacePackages(root);
54648
54743
  } catch (error) {
54744
+ if (error instanceof FailureError)
54745
+ throw error;
54649
54746
  throw new CapabilityDependenciesError("AC_SCHEMA_INVALID", `workspace packages are unreadable: ${error instanceof Error ? error.message : String(error)}`, "deps-workspace-invalid");
54650
54747
  }
54651
54748
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archctx",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Local architecture context CLI for agentic coding workflows.",
5
5
  "private": false,
6
6
  "type": "module",