holycodex 0.5.2 → 0.6.1-dev.29547206710.2
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/README.md +6 -89
- package/THIRD-PARTY-NOTICES.md +6 -2
- package/bin/holycodex.js +1 -1
- package/dist/cli.js +834 -0
- package/package.json +15 -27
- package/marketplace.json +0 -12
- package/plugin/.codex-plugin/plugin.json +0 -23
- package/plugin/.mcp.json +0 -7
- package/plugin/agents/explorer.toml +0 -6
- package/plugin/agents/librarian.toml +0 -6
- package/plugin/agents/worker.toml +0 -6
- package/plugin/hooks/hooks.json +0 -62
- package/plugin/runtime/bootstrap.js +0 -31
- package/plugin/runtime/cli.js +0 -235
- package/plugin/runtime/core-instructions.js +0 -4
- package/plugin/runtime/git-bash.js +0 -355
- package/plugin/runtime/lsp.js +0 -3665
- package/plugin/runtime/mcp-stdio-core.js +0 -209
- package/plugin/runtime/rules.js +0 -171
- package/plugin/skills/ast-grep/LICENSE +0 -21
- package/plugin/skills/ast-grep/SKILL.md +0 -20
- package/plugin/skills/ast-grep/references/cli.md +0 -3
- package/plugin/skills/ast-grep/references/install.md +0 -3
- package/plugin/skills/ast-grep/references/patterns.md +0 -3
- package/plugin/skills/ast-grep/references/pitfalls.md +0 -3
- package/plugin/skills/ast-grep/references/recipes.md +0 -9
- package/plugin/skills/ast-grep/references/sgconfig.md +0 -3
- package/plugin/skills/ast-grep/references/yaml-rules.md +0 -3
- package/plugin/skills/caveman/LICENSE +0 -21
- package/plugin/skills/caveman/SKILL.md +0 -31
- package/plugin/skills/compress/SKILL.md +0 -18
- package/plugin/skills/debugging/SKILL.md +0 -22
- package/plugin/skills/debugging/references/runtimes/README.md +0 -9
- package/plugin/skills/debugging/references/tools/README.md +0 -8
- package/plugin/skills/define-goal/LICENSE.txt +0 -201
- package/plugin/skills/define-goal/SKILL.md +0 -37
- package/plugin/skills/frontend/ATTRIBUTION.md +0 -218
- package/plugin/skills/frontend/LICENSE-Apache-2.0.txt +0 -201
- package/plugin/skills/frontend/SKILL.md +0 -50
- package/plugin/skills/frontend/references/perfection/README.md +0 -5
- package/plugin/skills/frontend/references/perfection/react-perf-tooling.md +0 -3
- package/plugin/skills/frontend/references/ui-ux-db/README.md +0 -5
- package/plugin/skills/frontend/references/ui-ux-db/data/charts.csv +0 -26
- package/plugin/skills/frontend/references/ui-ux-db/data/colors.csv +0 -162
- package/plugin/skills/frontend/references/ui-ux-db/data/icons.csv +0 -106
- package/plugin/skills/frontend/references/ui-ux-db/data/landing.csv +0 -35
- package/plugin/skills/frontend/references/ui-ux-db/data/products.csv +0 -162
- package/plugin/skills/frontend/references/ui-ux-db/data/react-performance.csv +0 -45
- package/plugin/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +0 -54
- package/plugin/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +0 -53
- package/plugin/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +0 -56
- package/plugin/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +0 -53
- package/plugin/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +0 -53
- package/plugin/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +0 -51
- package/plugin/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +0 -59
- package/plugin/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +0 -52
- package/plugin/skills/frontend/references/ui-ux-db/data/stacks/react.csv +0 -54
- package/plugin/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +0 -61
- package/plugin/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +0 -54
- package/plugin/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +0 -51
- package/plugin/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +0 -50
- package/plugin/skills/frontend/references/ui-ux-db/data/styles.csv +0 -85
- package/plugin/skills/frontend/references/ui-ux-db/data/typography.csv +0 -74
- package/plugin/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +0 -162
- package/plugin/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +0 -100
- package/plugin/skills/frontend/references/ui-ux-db/data/web-interface.csv +0 -31
- package/plugin/skills/frontend/references/ui-ux-db/scripts/core.py +0 -262
- package/plugin/skills/frontend/references/ui-ux-db/scripts/design_system.py +0 -1148
- package/plugin/skills/frontend/references/ui-ux-db/scripts/search.py +0 -114
- package/plugin/skills/handoff/SKILL.md +0 -10
- package/plugin/skills/lsp/SKILL.md +0 -35
- package/plugin/skills/lsp-setup/SKILL.md +0 -18
- package/plugin/skills/lsp-setup/scripts/detect-lsp.ts +0 -233
- package/plugin/skills/lsp-setup/scripts/lsp-server-table.ts +0 -188
- package/plugin/skills/lsp-setup/scripts/tsconfig.json +0 -17
- package/plugin/skills/lsp-setup/scripts/verify-lsp.ts +0 -166
- package/plugin/skills/plan/SKILL.md +0 -24
- package/plugin/skills/plan-review/SKILL.md +0 -22
- package/plugin/skills/programming/SKILL.md +0 -33
- package/plugin/skills/programming/references/code-smells.md +0 -3
- package/plugin/skills/programming/references/go/README.md +0 -3
- package/plugin/skills/programming/references/logging.md +0 -3
- package/plugin/skills/programming/references/python/README.md +0 -3
- package/plugin/skills/programming/references/rust/README.md +0 -3
- package/plugin/skills/programming/references/rust-ub/README.md +0 -3
- package/plugin/skills/programming/references/typescript/README.md +0 -3
- package/plugin/skills/refactor/SKILL.md +0 -21
- package/plugin/skills/remove-ai-slops/SKILL.md +0 -20
- package/plugin/skills/rules/SKILL.md +0 -16
- package/plugin/skills/security-research/SKILL.md +0 -38
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { a as successResponse, n as errorResponse, o as isPlainRecord, r as jsonRpcId, t as runJsonRpcStdioServer } from "./mcp-stdio-core.js";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { argv, stderr } from "node:process";
|
|
5
|
-
import { tmpdir } from "node:os";
|
|
6
|
-
import { execFileSync, spawn } from "node:child_process";
|
|
7
|
-
import { closeSync, existsSync, mkdtempSync, openSync, readFileSync, rmSync } from "node:fs";
|
|
8
|
-
//#region packages/git-bash-mcp/src/git-bash-resolver.ts
|
|
9
|
-
var GIT_BASH_ENV_KEY = "HOLYCODEX_GIT_BASH_PATH";
|
|
10
|
-
var PROGRAM_FILES = "C:\\Program Files\\Git\\bin\\bash.exe";
|
|
11
|
-
var PROGRAM_FILES_X86 = "C:\\Program Files (x86)\\Git\\bin\\bash.exe";
|
|
12
|
-
var INVALID_LAUNCHERS = ["\\windows\\system32\\", "\\microsoft\\windowsapps\\"];
|
|
13
|
-
function resolveGitBash(input) {
|
|
14
|
-
if (input.platform !== "win32") return {
|
|
15
|
-
found: true,
|
|
16
|
-
path: null,
|
|
17
|
-
source: "not-required",
|
|
18
|
-
checkedPaths: []
|
|
19
|
-
};
|
|
20
|
-
const checkedPaths = [];
|
|
21
|
-
const configured = input.env[GIT_BASH_ENV_KEY]?.trim();
|
|
22
|
-
if (configured) {
|
|
23
|
-
checkedPaths.push(configured);
|
|
24
|
-
return isBash(configured) && input.exists(configured) ? {
|
|
25
|
-
found: true,
|
|
26
|
-
path: configured,
|
|
27
|
-
source: "env",
|
|
28
|
-
checkedPaths
|
|
29
|
-
} : missing(checkedPaths);
|
|
30
|
-
}
|
|
31
|
-
for (const candidate of [{
|
|
32
|
-
path: PROGRAM_FILES,
|
|
33
|
-
source: "program-files"
|
|
34
|
-
}, {
|
|
35
|
-
path: PROGRAM_FILES_X86,
|
|
36
|
-
source: "program-files-x86"
|
|
37
|
-
}]) {
|
|
38
|
-
checkedPaths.push(candidate.path);
|
|
39
|
-
if (input.exists(candidate.path)) return {
|
|
40
|
-
found: true,
|
|
41
|
-
path: candidate.path,
|
|
42
|
-
source: candidate.source,
|
|
43
|
-
checkedPaths
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
for (const raw of input.where("bash")) {
|
|
47
|
-
const candidate = raw.trim();
|
|
48
|
-
if (!candidate) continue;
|
|
49
|
-
checkedPaths.push(candidate);
|
|
50
|
-
const normalized = candidate.replaceAll("/", "\\").toLowerCase();
|
|
51
|
-
if (INVALID_LAUNCHERS.some((part) => normalized.includes(part))) continue;
|
|
52
|
-
if (isBash(candidate) && input.exists(candidate)) return {
|
|
53
|
-
found: true,
|
|
54
|
-
path: candidate,
|
|
55
|
-
source: "path",
|
|
56
|
-
checkedPaths
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
return missing(checkedPaths);
|
|
60
|
-
}
|
|
61
|
-
function resolveGitBashForCurrentProcess(input = {}) {
|
|
62
|
-
return resolveGitBash({
|
|
63
|
-
platform: input.platform ?? process.platform,
|
|
64
|
-
env: input.env ?? process.env,
|
|
65
|
-
exists: existsSync,
|
|
66
|
-
where: (command) => {
|
|
67
|
-
try {
|
|
68
|
-
return execFileSync("where", [command], { encoding: "utf8" }).split(/\r?\n/).filter(Boolean);
|
|
69
|
-
} catch (error) {
|
|
70
|
-
if (error instanceof Error) return [];
|
|
71
|
-
throw error;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
function isBash(path) {
|
|
77
|
-
return path.toLowerCase().endsWith("bash.exe");
|
|
78
|
-
}
|
|
79
|
-
function missing(checkedPaths) {
|
|
80
|
-
return {
|
|
81
|
-
found: false,
|
|
82
|
-
checkedPaths,
|
|
83
|
-
installHint: `Git Bash required. Install: winget install --id Git.Git -e --source winget\nCustom path: set ${GIT_BASH_ENV_KEY}=C:\\path\\to\\bash.exe`
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
//#endregion
|
|
87
|
-
//#region packages/git-bash-mcp/src/runner.ts
|
|
88
|
-
async function runGitBashCommand(input) {
|
|
89
|
-
return await new Promise((resolve, reject) => {
|
|
90
|
-
const outputDirectory = mkdtempSync(join(tmpdir(), "holycodex-git-bash-run-"));
|
|
91
|
-
const stdoutPath = join(outputDirectory, "stdout");
|
|
92
|
-
const stderrPath = join(outputDirectory, "stderr");
|
|
93
|
-
const stdoutFd = openSync(stdoutPath, "w+");
|
|
94
|
-
const stderrFd = openSync(stderrPath, "w+");
|
|
95
|
-
let outputClosed = false;
|
|
96
|
-
function closeOutputFiles() {
|
|
97
|
-
if (outputClosed) return;
|
|
98
|
-
closeSync(stdoutFd);
|
|
99
|
-
closeSync(stderrFd);
|
|
100
|
-
outputClosed = true;
|
|
101
|
-
}
|
|
102
|
-
function readAndRemoveOutput() {
|
|
103
|
-
closeOutputFiles();
|
|
104
|
-
const stdout = readFileSync(stdoutPath, "utf8");
|
|
105
|
-
const stderr = readFileSync(stderrPath, "utf8");
|
|
106
|
-
rmSync(outputDirectory, {
|
|
107
|
-
recursive: true,
|
|
108
|
-
force: true
|
|
109
|
-
});
|
|
110
|
-
return {
|
|
111
|
-
stdout,
|
|
112
|
-
stderr
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
const env = input.env === void 0 ? void 0 : Object.fromEntries(Object.entries(input.env).filter(([key]) => key.toLowerCase() !== "original_path"));
|
|
116
|
-
const child = spawn(input.bashPath, ["-lc", input.command], {
|
|
117
|
-
cwd: input.cwd,
|
|
118
|
-
env,
|
|
119
|
-
windowsHide: true,
|
|
120
|
-
stdio: [
|
|
121
|
-
"ignore",
|
|
122
|
-
stdoutFd,
|
|
123
|
-
stderrFd
|
|
124
|
-
]
|
|
125
|
-
});
|
|
126
|
-
let timedOut = false;
|
|
127
|
-
const timeout = setTimeout(() => {
|
|
128
|
-
timedOut = true;
|
|
129
|
-
child.kill();
|
|
130
|
-
}, input.timeoutMs);
|
|
131
|
-
timeout.unref();
|
|
132
|
-
child.on("error", (error) => {
|
|
133
|
-
clearTimeout(timeout);
|
|
134
|
-
closeOutputFiles();
|
|
135
|
-
rmSync(outputDirectory, {
|
|
136
|
-
recursive: true,
|
|
137
|
-
force: true
|
|
138
|
-
});
|
|
139
|
-
reject(error);
|
|
140
|
-
});
|
|
141
|
-
child.on("close", (exitCode) => {
|
|
142
|
-
clearTimeout(timeout);
|
|
143
|
-
resolve({
|
|
144
|
-
exitCode,
|
|
145
|
-
...readAndRemoveOutput(),
|
|
146
|
-
timedOut
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
//#endregion
|
|
152
|
-
//#region packages/git-bash-mcp/src/mcp.ts
|
|
153
|
-
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
154
|
-
var MAX_TIMEOUT_MS = 30 * 6e4;
|
|
155
|
-
var EXEC_COMMAND_TIMEOUT_ENV_KEYS = [
|
|
156
|
-
"HOLYCODEX_GIT_BASH_TIMEOUT_MS",
|
|
157
|
-
"HOLYCODEX_EXEC_COMMAND_TIMEOUT_MS",
|
|
158
|
-
"CODEX_EXEC_COMMAND_TIMEOUT_MS",
|
|
159
|
-
"EXEC_COMMAND_TIMEOUT_MS"
|
|
160
|
-
];
|
|
161
|
-
async function handleGitBashMcpRequest(input, options = {}) {
|
|
162
|
-
if (!isPlainRecord(input)) return errorResponse(null, -32600, "Invalid Request");
|
|
163
|
-
const id = jsonRpcId(input["id"]);
|
|
164
|
-
const method = typeof input["method"] === "string" ? input["method"] : null;
|
|
165
|
-
if (method === "initialize") return successResponse(id, {
|
|
166
|
-
capabilities: { tools: { listChanged: false } },
|
|
167
|
-
serverInfo: {
|
|
168
|
-
name: "git_bash",
|
|
169
|
-
version: "0.5.2"
|
|
170
|
-
},
|
|
171
|
-
protocolVersion: protocolVersionFromInput(input) ?? "2024-11-05"
|
|
172
|
-
});
|
|
173
|
-
if (method === "tools/list") return successResponse(id, { tools: toolsForOptions(options) });
|
|
174
|
-
if (method === "tools/call") {
|
|
175
|
-
const params = isPlainRecord(input["params"]) ? input["params"] : {};
|
|
176
|
-
return await callTool(id, typeof params["name"] === "string" ? params["name"] : "", isPlainRecord(params["arguments"]) ? params["arguments"] : {}, options);
|
|
177
|
-
}
|
|
178
|
-
if (method === "notifications/initialized") return void 0;
|
|
179
|
-
return errorResponse(id, -32601, "Method not found");
|
|
180
|
-
}
|
|
181
|
-
async function runMcpStdioServer(input, output, options = {}) {
|
|
182
|
-
if (!canRunGitBash(options)) return;
|
|
183
|
-
await runJsonRpcStdioServer({
|
|
184
|
-
input,
|
|
185
|
-
output,
|
|
186
|
-
handler: handleGitBashMcpRequest,
|
|
187
|
-
handlerOptions: options,
|
|
188
|
-
idleTimeoutMs: 0,
|
|
189
|
-
...options.lifecycleLog === void 0 ? {} : { log: options.lifecycleLog },
|
|
190
|
-
parseErrorResponse: () => errorResponse(null, -32601, "Method not found")
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
async function callTool(id, name, args, options) {
|
|
194
|
-
if (name === "which_bash") return toolResponse(id, JSON.stringify(resolve$1(options), null, 2));
|
|
195
|
-
if (name === "diagnose") return toolResponse(id, diagnosePayload(resolve$1(options), platformFromOptions(options)));
|
|
196
|
-
if (name === "run") return await runToolResponse(id, args, options);
|
|
197
|
-
return toolResponse(id, `Unknown git_bash tool: ${name}`, true);
|
|
198
|
-
}
|
|
199
|
-
async function runToolResponse(id, args, options) {
|
|
200
|
-
if (platformFromOptions(options) !== "win32") return toolResponse(id, "git_bash run is only available on native Windows.", true);
|
|
201
|
-
const command = typeof args.command === "string" ? args.command.trim() : "";
|
|
202
|
-
if (command.length === 0) return toolResponse(id, "run.command must be a non-empty string.", true);
|
|
203
|
-
const cwd = parseWorkdir(args);
|
|
204
|
-
if (cwd === null) return toolResponse(id, "run.workdir must be a non-empty string when provided.", true);
|
|
205
|
-
const timeoutMs = parseTimeoutMs(args.timeout ?? args.timeout_ms, options);
|
|
206
|
-
if (timeoutMs === null) return toolResponse(id, `run.timeout must be an integer between 1 and ${MAX_TIMEOUT_MS}.`, true);
|
|
207
|
-
const resolution = resolve$1(options);
|
|
208
|
-
if (!resolution.found || resolution.path === null) return toolResponse(id, JSON.stringify(resolution, null, 2), true);
|
|
209
|
-
try {
|
|
210
|
-
const result = await (options.runGitBash ?? runGitBashCommand)({
|
|
211
|
-
bashPath: resolution.path,
|
|
212
|
-
command,
|
|
213
|
-
...cwd === void 0 ? {} : { cwd },
|
|
214
|
-
timeoutMs,
|
|
215
|
-
env: options.env ?? process.env
|
|
216
|
-
});
|
|
217
|
-
return toolResponse(id, JSON.stringify(result, null, 2));
|
|
218
|
-
} catch (error) {
|
|
219
|
-
return toolResponse(id, error instanceof Error ? error.message : String(error), true);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
function toolsForOptions(options) {
|
|
223
|
-
const sharedTools = [{
|
|
224
|
-
name: "which_bash",
|
|
225
|
-
description: "Use to find Git Bash on Windows.",
|
|
226
|
-
inputSchema: {
|
|
227
|
-
type: "object",
|
|
228
|
-
properties: {},
|
|
229
|
-
additionalProperties: false
|
|
230
|
-
}
|
|
231
|
-
}, {
|
|
232
|
-
name: "diagnose",
|
|
233
|
-
description: "Use to diagnose Git Bash readiness.",
|
|
234
|
-
inputSchema: {
|
|
235
|
-
type: "object",
|
|
236
|
-
properties: {},
|
|
237
|
-
additionalProperties: false
|
|
238
|
-
}
|
|
239
|
-
}];
|
|
240
|
-
if (!canRunGitBash(options)) return sharedTools;
|
|
241
|
-
return [{
|
|
242
|
-
name: "run",
|
|
243
|
-
description: "Use to run Bash, Git, POSIX, or Unix commands on Windows; use exec_command only if unavailable or nonshell.",
|
|
244
|
-
inputSchema: {
|
|
245
|
-
type: "object",
|
|
246
|
-
properties: {
|
|
247
|
-
command: {
|
|
248
|
-
type: "string",
|
|
249
|
-
description: "Command to run."
|
|
250
|
-
},
|
|
251
|
-
timeout: {
|
|
252
|
-
type: "integer",
|
|
253
|
-
minimum: 1,
|
|
254
|
-
maximum: MAX_TIMEOUT_MS,
|
|
255
|
-
description: `Timeout in milliseconds; defaults to inherited exec_command timeout or ${defaultTimeoutMs(options)}ms.`
|
|
256
|
-
},
|
|
257
|
-
workdir: {
|
|
258
|
-
type: "string",
|
|
259
|
-
description: "Working directory. Use this instead of 'cd'. Defaults to current directory."
|
|
260
|
-
},
|
|
261
|
-
description: {
|
|
262
|
-
type: "string",
|
|
263
|
-
description: "Command purpose in 5-10 words."
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
required: ["command"],
|
|
267
|
-
additionalProperties: false
|
|
268
|
-
}
|
|
269
|
-
}, ...sharedTools];
|
|
270
|
-
}
|
|
271
|
-
function canRunGitBash(options) {
|
|
272
|
-
if (platformFromOptions(options) !== "win32") return false;
|
|
273
|
-
const resolution = resolve$1(options);
|
|
274
|
-
return resolution.found && resolution.path !== null;
|
|
275
|
-
}
|
|
276
|
-
function resolve$1(options) {
|
|
277
|
-
if (options.exists === void 0 && options.where === void 0) return resolveGitBashForCurrentProcess({
|
|
278
|
-
...options.platform === void 0 ? {} : { platform: options.platform },
|
|
279
|
-
...options.env === void 0 ? {} : { env: options.env }
|
|
280
|
-
});
|
|
281
|
-
return resolveGitBash({
|
|
282
|
-
platform: platformFromOptions(options),
|
|
283
|
-
env: options.env ?? process.env,
|
|
284
|
-
exists: options.exists ?? (() => false),
|
|
285
|
-
where: options.where ?? (() => [])
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
function platformFromOptions(options) {
|
|
289
|
-
return options.platform ?? process.platform;
|
|
290
|
-
}
|
|
291
|
-
function diagnosePayload(resolution, platform) {
|
|
292
|
-
const enabled = platform === "win32" && resolution.found && resolution.path !== null;
|
|
293
|
-
return JSON.stringify({
|
|
294
|
-
platform,
|
|
295
|
-
enabled,
|
|
296
|
-
status: platform === "win32" ? enabled ? "ready" : "missing-git-bash" : "disabled: git_bash command execution is only exposed on native Windows",
|
|
297
|
-
resolution
|
|
298
|
-
}, null, 2);
|
|
299
|
-
}
|
|
300
|
-
function toolResponse(id, text, isError = false) {
|
|
301
|
-
return successResponse(id, {
|
|
302
|
-
content: [{
|
|
303
|
-
type: "text",
|
|
304
|
-
text
|
|
305
|
-
}],
|
|
306
|
-
isError
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
function parseWorkdir(args) {
|
|
310
|
-
const value = args.workdir ?? args.cwd;
|
|
311
|
-
if (value === void 0) return void 0;
|
|
312
|
-
return typeof value === "string" && value.trim().length > 0 ? value : null;
|
|
313
|
-
}
|
|
314
|
-
function parseTimeoutMs(value, options) {
|
|
315
|
-
if (value === void 0) return defaultTimeoutMs(options);
|
|
316
|
-
return normalizeTimeoutMs(value);
|
|
317
|
-
}
|
|
318
|
-
function defaultTimeoutMs(options) {
|
|
319
|
-
const configured = normalizeTimeoutMs(options.defaultTimeoutMs);
|
|
320
|
-
if (configured !== null) return configured;
|
|
321
|
-
const env = options.env ?? process.env;
|
|
322
|
-
for (const key of EXEC_COMMAND_TIMEOUT_ENV_KEYS) {
|
|
323
|
-
const timeoutMs = normalizeTimeoutMs(env[key]);
|
|
324
|
-
if (timeoutMs !== null) return timeoutMs;
|
|
325
|
-
}
|
|
326
|
-
return DEFAULT_TIMEOUT_MS;
|
|
327
|
-
}
|
|
328
|
-
function normalizeTimeoutMs(value) {
|
|
329
|
-
const parsed = typeof value === "string" && value.trim().length > 0 ? Number(value) : value;
|
|
330
|
-
if (!Number.isInteger(parsed)) return null;
|
|
331
|
-
const timeoutMs = Number(parsed);
|
|
332
|
-
if (timeoutMs < 1 || timeoutMs > MAX_TIMEOUT_MS) return null;
|
|
333
|
-
return timeoutMs;
|
|
334
|
-
}
|
|
335
|
-
function protocolVersionFromInput(input) {
|
|
336
|
-
if (!isPlainRecord(input["params"])) return null;
|
|
337
|
-
const params = input["params"];
|
|
338
|
-
return typeof params["protocolVersion"] === "string" ? params["protocolVersion"] : null;
|
|
339
|
-
}
|
|
340
|
-
//#endregion
|
|
341
|
-
//#region packages/git-bash-mcp/src/cli.ts
|
|
342
|
-
async function main() {
|
|
343
|
-
const [command = "mcp"] = argv.slice(2);
|
|
344
|
-
if (command === "mcp") {
|
|
345
|
-
await runMcpStdioServer(process.stdin, process.stdout);
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
stderr.write("Usage: holycodex-git-bash [mcp]\n");
|
|
349
|
-
process.exitCode = 2;
|
|
350
|
-
}
|
|
351
|
-
main().catch((error) => {
|
|
352
|
-
stderr.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}\n`);
|
|
353
|
-
process.exitCode = 1;
|
|
354
|
-
});
|
|
355
|
-
//#endregion
|