fix: support Windows agent command shims

This commit is contained in:
2026-08-20 17:34:30 +08:00
parent 4387cedf76
commit 7416dfea1a
8 changed files with 43 additions and 16 deletions
Vendored
+5 -5
View File
@@ -5,7 +5,6 @@ import { fileURLToPath } from "node:url";
import { Command } from "commander";
// src/agents.ts
import { spawn } from "node:child_process";
import { randomUUID } from "node:crypto";
import { constants } from "node:fs";
import { copyFile, cp, mkdir as mkdir2, readFile as readFile2, readdir, rename as rename2, rm, stat, writeFile as writeFile2 } from "node:fs/promises";
@@ -13,6 +12,7 @@ import os2 from "node:os";
import path2 from "node:path";
import { createInterface } from "node:readline/promises";
import { applyEdits, modify, parse } from "jsonc-parser";
import spawn from "cross-spawn";
// src/config.ts
import { createHash } from "node:crypto";
@@ -397,10 +397,10 @@ var SpawnCommandRunner = class {
const child = spawn(command, args, { shell: false, windowsHide: true, stdio: ["ignore", "pipe", "pipe"] });
let stdout = "";
let stderr = "";
child.stdout.setEncoding("utf8").on("data", (chunk) => {
child.stdout?.setEncoding("utf8").on("data", (chunk) => {
stdout += String(chunk);
});
child.stderr.setEncoding("utf8").on("data", (chunk) => {
child.stderr?.setEncoding("utf8").on("data", (chunk) => {
stderr += String(chunk);
});
child.once("error", (error) => reject(new Error(`Could not run ${command}: ${errorMessage(error)}`)));
@@ -737,7 +737,7 @@ async function serveBridge(options, tokenStore, discoveryStore, serviceToken = p
}
}
function createProxyServer(upstream) {
const server = new Server({ name: "crafttable-mcp-stdio-bridge", version: "0.1.2" }, {
const server = new Server({ name: "crafttable-mcp-stdio-bridge", version: "0.1.3" }, {
capabilities: {
tools: {},
resources: {}
@@ -880,7 +880,7 @@ function keyringError(error) {
}
// src/cli.ts
var program = new Command().name("crafttable-mcp").description("OAuth client and stdio bridge for CraftTable MCP").version("0.1.2");
var program = new Command().name("crafttable-mcp").description("OAuth client and stdio bridge for CraftTable MCP").version("0.1.3");
withConnection(program.command("login").description("Log in through the system browser")).option("--no-browser", "print the authorization URL instead of opening it").option("--timeout <milliseconds>", "OAuth callback timeout", "600000").action(async (flags) => {
const options = connectionOptions(flags);
const timeoutMs = positiveInteger(flags.timeout, "OAuth callback timeout");