archctx 0.1.4-beta.0 → 0.1.4

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.1.4-beta.0",
4
+ "productVersion": "0.1.4",
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:19c4fdf4068eaf19f782d92373354cff071947134e76eb6927998d5a9a1146c3"
392
+ "catalogDigest": "sha256:89829151a844ca84c522924c43d7b174ff613b0b50dbbb2c7174a20d9ac3ab47"
393
393
  }
package/bin/archctx.mjs CHANGED
@@ -702,7 +702,7 @@ function productVersionManifest() {
702
702
  }
703
703
  };
704
704
  }
705
- var ARCHCONTEXT_PRODUCT_NAME = "archctx", ARCHCONTEXT_PRODUCT_VERSION = "0.1.4-beta.0", ARCHCONTEXT_PACKAGE_MANAGER = "bun@1.3.10", ARCHCONTEXT_NODE_RANGE = ">=24 <26", LOCAL_RUNTIME_RPC_SCHEMA_VERSION = "archcontext.runtime-rpc/v1", ARCHCONTEXT_SCHEMA_SET_VERSION = "2026-06-25.al0-ledger";
705
+ var ARCHCONTEXT_PRODUCT_NAME = "archctx", ARCHCONTEXT_PRODUCT_VERSION = "0.1.4", ARCHCONTEXT_PACKAGE_MANAGER = "bun@1.3.10", ARCHCONTEXT_NODE_RANGE = ">=24 <26", LOCAL_RUNTIME_RPC_SCHEMA_VERSION = "archcontext.runtime-rpc/v1", ARCHCONTEXT_SCHEMA_SET_VERSION = "2026-06-25.al0-ledger";
706
706
  // packages/contracts/src/index.ts
707
707
  var init_src = __esm(() => {
708
708
  init_control_plane_routes();
@@ -25904,8 +25904,14 @@ var ARCHITECTURE_BOOK_RESOURCES = [
25904
25904
  class McpLocalServer {
25905
25905
  resources = new Map;
25906
25906
  runtimeInstance;
25907
- constructor(runtime) {
25908
- this.runtimeInstance = runtime;
25907
+ runtimeResolver;
25908
+ constructor(runtimeOrOptions) {
25909
+ if (isMcpLocalServerOptions(runtimeOrOptions)) {
25910
+ this.runtimeInstance = runtimeOrOptions.runtime;
25911
+ this.runtimeResolver = runtimeOrOptions.runtimeResolver;
25912
+ } else {
25913
+ this.runtimeInstance = runtimeOrOptions;
25914
+ }
25909
25915
  }
25910
25916
  listTools() {
25911
25917
  return LOCAL_MCP_TOOLS;
@@ -26027,7 +26033,7 @@ class McpLocalServer {
26027
26033
  }))
26028
26034
  ];
26029
26035
  try {
26030
- const status = await (await this.runtime(root)).docs(root, { command: "status", provider: "context7" });
26036
+ const status = await (await this.runtime(root, { allowResolver: false })).docs(root, { command: "status", provider: "context7" });
26031
26037
  if (!status.ok)
26032
26038
  return localResources;
26033
26039
  const cacheEntries = status.data?.cacheEntries ?? [];
@@ -26090,7 +26096,7 @@ class McpLocalServer {
26090
26096
  dataClassification: "local-architecture"
26091
26097
  };
26092
26098
  }
26093
- async runtime(root = process.cwd()) {
26099
+ async runtime(root = process.cwd(), options = { allowResolver: true }) {
26094
26100
  if (this.runtimeInstance)
26095
26101
  return this.runtimeInstance;
26096
26102
  const client = createRuntimeRpcClientFromConnectionFile2(root);
@@ -26103,9 +26109,16 @@ class McpLocalServer {
26103
26109
  return this.runtimeInstance;
26104
26110
  }
26105
26111
  }
26112
+ if (options.allowResolver !== false && this.runtimeResolver) {
26113
+ this.runtimeInstance = await this.runtimeResolver(root);
26114
+ return this.runtimeInstance;
26115
+ }
26106
26116
  throw new Error("archctxd RPC is unavailable; run `archctx daemon start` before using the local MCP surface");
26107
26117
  }
26108
26118
  }
26119
+ function isMcpLocalServerOptions(value) {
26120
+ return Boolean(value && typeof value === "object" && (("runtime" in value) || ("runtimeResolver" in value)));
26121
+ }
26109
26122
  function requiredArg(args, key) {
26110
26123
  const value = args[key];
26111
26124
  if (typeof value !== "string" || value.length === 0)
@@ -26119,8 +26132,8 @@ function runtimeUnavailable(requestId, error) {
26119
26132
  };
26120
26133
  }
26121
26134
  async function runStdioMcpLoop(input, output, log = (line) => process.stderr.write(`${line}
26122
- `)) {
26123
- const server = new McpLocalServer;
26135
+ `), options = {}) {
26136
+ const server = new McpLocalServer(options);
26124
26137
  log("[archctx-mcp] started");
26125
26138
  for await (const line of input) {
26126
26139
  const message = JSON.parse(line);
@@ -26173,7 +26186,8 @@ class RuntimeVersionUnsupportedError extends Error {
26173
26186
  if (__require.main == __require.module) {
26174
26187
  if (command === "mcp" && args.length === 0) {
26175
26188
  await runStdioMcpLoop(stdinLines(), (line) => process.stdout.write(`${line}
26176
- `));
26189
+ `), (line) => process.stderr.write(`${line}
26190
+ `), { runtimeResolver: (root) => createOrStartRuntimeRpcClient(root) });
26177
26191
  } else if (command === "daemon" && args[0] === "start" && args.includes("--foreground")) {
26178
26192
  await runForegroundDaemon(process.cwd(), args).catch((error) => {
26179
26193
  process.stderr.write(`${error instanceof Error ? error.message : String(error)}
@@ -28241,39 +28255,9 @@ async function createCliRuntime(cwd, deps) {
28241
28255
  return;
28242
28256
  } };
28243
28257
  if (!deps.disableRpcDiscovery && !hasEmbeddedRuntimeDeps(deps)) {
28244
- const fileIssue = runtimeRpcCompatibilityIssue(cwd);
28245
- if (fileIssue?.pidAlive)
28246
- throw new RuntimeVersionUnsupportedError(fileIssue);
28247
- const client = createRuntimeRpcClientFromConnectionFile(cwd);
28248
- if (client) {
28249
- const health = await client.health().catch(() => {
28250
- return;
28251
- });
28252
- const healthIssue = runtimeRpcCompatibilityIssueFromHealth(cwd, client, health);
28253
- if (healthIssue)
28254
- throw new RuntimeVersionUnsupportedError(healthIssue);
28255
- if (health?.ok === true)
28256
- return { client, close: async () => {
28257
- return;
28258
- } };
28259
- recoverStaleDaemonControlFiles(cwd, { removeUnhealthyConnection: true });
28260
- } else {
28261
- recoverStaleDaemonControlFiles(cwd);
28262
- }
28263
- const started = await startBackgroundDaemon([], cwd);
28264
- if (!started.ok)
28265
- throw new Error(started.error?.message ?? "archctxd did not start");
28266
- const startedClient = createRuntimeRpcClientFromConnectionFile(cwd);
28267
- if (startedClient) {
28268
- const health = await startedClient.health().catch(() => {
28269
- return;
28270
- });
28271
- if (health?.ok === true)
28272
- return { client: startedClient, close: async () => {
28273
- return;
28274
- } };
28275
- }
28276
- throw new Error("archctxd started but no healthy runtime RPC connection was available");
28258
+ return { client: await createOrStartRuntimeRpcClient(cwd), close: async () => {
28259
+ return;
28260
+ } };
28277
28261
  }
28278
28262
  const {
28279
28263
  runtimeClient: _runtimeClient,
@@ -28294,6 +28278,40 @@ async function createCliRuntime(cwd, deps) {
28294
28278
  });
28295
28279
  return { client: daemon, close: () => daemon.stop() };
28296
28280
  }
28281
+ async function createOrStartRuntimeRpcClient(cwd) {
28282
+ const fileIssue = runtimeRpcCompatibilityIssue(cwd);
28283
+ if (fileIssue?.pidAlive)
28284
+ throw new RuntimeVersionUnsupportedError(fileIssue);
28285
+ const client = createRuntimeRpcClientFromConnectionFile(cwd);
28286
+ if (client) {
28287
+ const health = await client.health().catch(() => {
28288
+ return;
28289
+ });
28290
+ const healthIssue = runtimeRpcCompatibilityIssueFromHealth(cwd, client, health);
28291
+ if (healthIssue)
28292
+ throw new RuntimeVersionUnsupportedError(healthIssue);
28293
+ if (health?.ok === true)
28294
+ return client;
28295
+ recoverStaleDaemonControlFiles(cwd, { removeUnhealthyConnection: true });
28296
+ } else {
28297
+ recoverStaleDaemonControlFiles(cwd);
28298
+ }
28299
+ const started = await startBackgroundDaemon([], cwd);
28300
+ if (!started.ok)
28301
+ throw new Error(mcpDaemonStartRecoveryMessage(started.error?.message ?? "archctxd did not start"));
28302
+ const startedClient = createRuntimeRpcClientFromConnectionFile(cwd);
28303
+ if (startedClient) {
28304
+ const health = await startedClient.health().catch(() => {
28305
+ return;
28306
+ });
28307
+ if (health?.ok === true)
28308
+ return startedClient;
28309
+ }
28310
+ throw new Error(mcpDaemonStartRecoveryMessage("archctxd started but no healthy runtime RPC connection was available"));
28311
+ }
28312
+ function mcpDaemonStartRecoveryMessage(message) {
28313
+ return message.includes("archctx daemon") ? message : `${message}; run \`archctx daemon start\` before using the local MCP surface`;
28314
+ }
28297
28315
  function hasEmbeddedRuntimeDeps(deps) {
28298
28316
  return [
28299
28317
  "codeFacts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archctx",
3
- "version": "0.1.4-beta.0",
3
+ "version": "0.1.4",
4
4
  "description": "Local architecture context CLI for agentic coding workflows.",
5
5
  "private": false,
6
6
  "type": "module",