@minhluudev/ai-tools 1.0.22 → 1.0.25
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 +5 -31
- package/dist/src/bin/ai-tools.js +1 -2
- package/dist/src/cli.js +1 -221
- package/dist/src/lib/agent-selection.js +60 -0
- package/dist/src/lib/catalog.js +4 -1
- package/dist/src/lib/config.js +0 -2
- package/dist/src/lib/install.js +45 -79
- package/dist/src/lib/selection-catalog.js +6 -2
- package/dist/src/lib/tui-entry-menu.js +0 -24
- package/dist/src/lib/tui-skills.js +4 -2
- package/dist/src/lib/tui-wizard.js +14 -24
- package/package.json +7 -7
- package/selection-catalog.json +31 -66
- package/dist/src/lib/ai-libs.js +0 -417
- package/dist/src/lib/mcp.js +0 -665
- package/dist/src/lib/plugins.js +0 -155
- package/dist/src/lib/project-docs-catalog.js +0 -45
- package/dist/src/lib/tui-ai-libs.js +0 -539
- package/dist/src/lib/tui-mcp.js +0 -514
- package/dist/src/lib/tui-plugins.js +0 -408
- package/dist/src/lib/tui-project-docs.js +0 -303
- package/project-docs-catalog.json +0 -19
package/dist/src/lib/ai-libs.js
DELETED
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
import { mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
2
|
-
import * as os from "node:os";
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import { spawn } from "node:child_process";
|
|
5
|
-
const ICM_INSTALL_COMMAND = "curl -fsSL https://raw.githubusercontent.com/rtk-ai/icm/main/install.sh | sh";
|
|
6
|
-
const RTK_INSTALL_COMMAND = "curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh";
|
|
7
|
-
const ECC_REPO_URL = "https://github.com/affaan-m/ECC.git";
|
|
8
|
-
const CODEGRAPH_REPO_URL = "https://github.com/colbymchenry/codegraph";
|
|
9
|
-
const ECC_TEMP_DIR_PREFIX = "ai-tools-ecc-";
|
|
10
|
-
const ICM_MARKER_START = "<!-- icm:start -->";
|
|
11
|
-
const ICM_MARKER_END = "<!-- icm:end -->";
|
|
12
|
-
export function detectSupportedHostOs(platform = process.platform) {
|
|
13
|
-
if (platform === "darwin") {
|
|
14
|
-
return "mac";
|
|
15
|
-
}
|
|
16
|
-
if (platform === "linux") {
|
|
17
|
-
return "linux";
|
|
18
|
-
}
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
function uniq(items) {
|
|
22
|
-
return [...new Set(items)];
|
|
23
|
-
}
|
|
24
|
-
function quickInstallBinaryPath(binaryName) {
|
|
25
|
-
return path.join(os.homedir(), ".local", "bin", binaryName);
|
|
26
|
-
}
|
|
27
|
-
function buildRtkInstallSteps(agents, scope) {
|
|
28
|
-
const steps = [
|
|
29
|
-
{
|
|
30
|
-
id: "rtk-install",
|
|
31
|
-
library: "rtk",
|
|
32
|
-
phase: "install",
|
|
33
|
-
title: "Install RTK binary",
|
|
34
|
-
description: "Install the upstream RTK binary with the verified quick installer.",
|
|
35
|
-
command: RTK_INSTALL_COMMAND,
|
|
36
|
-
runner: "shell"
|
|
37
|
-
}
|
|
38
|
-
];
|
|
39
|
-
if (agents.includes("claude")) {
|
|
40
|
-
steps.push({
|
|
41
|
-
id: "rtk-configure-claude",
|
|
42
|
-
library: "rtk",
|
|
43
|
-
phase: "configure",
|
|
44
|
-
title: "Configure RTK for Claude",
|
|
45
|
-
description: scope === "global"
|
|
46
|
-
? "Install RTK's Claude-oriented global integration."
|
|
47
|
-
: "Install RTK's Claude-oriented local integration for the current project.",
|
|
48
|
-
command: scope === "global" ? "rtk init -g" : "rtk init",
|
|
49
|
-
runner: "shell"
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
if (agents.includes("codex")) {
|
|
53
|
-
steps.push({
|
|
54
|
-
id: "rtk-configure-codex",
|
|
55
|
-
library: "rtk",
|
|
56
|
-
phase: "configure",
|
|
57
|
-
title: "Configure RTK for Codex",
|
|
58
|
-
description: scope === "global"
|
|
59
|
-
? "Install RTK's Codex hook configuration."
|
|
60
|
-
: "Install RTK's Codex hook configuration for the current project.",
|
|
61
|
-
command: scope === "global" ? "rtk init -g --codex" : "rtk init --codex",
|
|
62
|
-
runner: "shell"
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return steps;
|
|
66
|
-
}
|
|
67
|
-
function buildRtkUninstallSteps(agents, scope) {
|
|
68
|
-
const steps = [];
|
|
69
|
-
if (agents.includes("claude")) {
|
|
70
|
-
steps.push({
|
|
71
|
-
id: "rtk-uninstall-claude",
|
|
72
|
-
library: "rtk",
|
|
73
|
-
phase: "uninstall",
|
|
74
|
-
title: "Remove RTK Claude integration",
|
|
75
|
-
description: scope === "global"
|
|
76
|
-
? "Remove RTK global artifacts for the default Claude mode."
|
|
77
|
-
: "Remove RTK local artifacts for the default Claude mode in the current project.",
|
|
78
|
-
command: scope === "global" ? "rtk init -g --uninstall" : "rtk init --uninstall",
|
|
79
|
-
runner: "shell"
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
if (agents.includes("codex")) {
|
|
83
|
-
steps.push({
|
|
84
|
-
id: "rtk-uninstall-codex",
|
|
85
|
-
library: "rtk",
|
|
86
|
-
phase: "uninstall",
|
|
87
|
-
title: "Remove RTK Codex integration",
|
|
88
|
-
description: scope === "global"
|
|
89
|
-
? "Remove RTK global Codex artifacts."
|
|
90
|
-
: "Remove RTK local Codex artifacts in the current project.",
|
|
91
|
-
command: scope === "global" ? "rtk init -g --codex --uninstall" : "rtk init --codex --uninstall",
|
|
92
|
-
runner: "shell"
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
if (scope === "global") {
|
|
96
|
-
steps.push({
|
|
97
|
-
id: "rtk-remove-binary",
|
|
98
|
-
library: "rtk",
|
|
99
|
-
phase: "cleanup",
|
|
100
|
-
title: "Remove RTK quick-install binary",
|
|
101
|
-
description: "Delete the RTK binary only from the standard quick-install path if it exists there.",
|
|
102
|
-
command: `remove ${quickInstallBinaryPath("rtk")}`,
|
|
103
|
-
runner: "remove-binary",
|
|
104
|
-
path: quickInstallBinaryPath("rtk")
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
return steps;
|
|
108
|
-
}
|
|
109
|
-
function buildGlobalIcmModes(agents) {
|
|
110
|
-
const modes = ["mcp"];
|
|
111
|
-
if (agents.includes("claude")) {
|
|
112
|
-
modes.push("skill", "hook");
|
|
113
|
-
}
|
|
114
|
-
else if (agents.includes("codex")) {
|
|
115
|
-
modes.push("hook");
|
|
116
|
-
}
|
|
117
|
-
return uniq(modes);
|
|
118
|
-
}
|
|
119
|
-
function buildIcmInstallSteps(agents, scope) {
|
|
120
|
-
const selectedAgents = agents.join(" + ");
|
|
121
|
-
const steps = [
|
|
122
|
-
{
|
|
123
|
-
id: "icm-install",
|
|
124
|
-
library: "icm",
|
|
125
|
-
phase: "install",
|
|
126
|
-
title: "Install ICM binary",
|
|
127
|
-
description: "Install the upstream ICM binary with the verified quick installer.",
|
|
128
|
-
command: ICM_INSTALL_COMMAND,
|
|
129
|
-
runner: "shell"
|
|
130
|
-
}
|
|
131
|
-
];
|
|
132
|
-
if (scope === "local") {
|
|
133
|
-
steps.push({
|
|
134
|
-
id: "icm-init-cli-local",
|
|
135
|
-
library: "icm",
|
|
136
|
-
phase: "configure",
|
|
137
|
-
title: "Configure ICM project instructions",
|
|
138
|
-
description: `Inject ICM instructions for the selected agent set (${selectedAgents}) using upstream per-project mode.`,
|
|
139
|
-
command: "icm init --mode cli --per_project",
|
|
140
|
-
runner: "shell"
|
|
141
|
-
});
|
|
142
|
-
return steps;
|
|
143
|
-
}
|
|
144
|
-
for (const mode of buildGlobalIcmModes(agents)) {
|
|
145
|
-
steps.push({
|
|
146
|
-
id: `icm-init-${mode}`,
|
|
147
|
-
library: "icm",
|
|
148
|
-
phase: "configure",
|
|
149
|
-
title: `Configure ICM (${mode})`,
|
|
150
|
-
description: `Run ICM ${mode} setup for the selected agent set (${selectedAgents}).`,
|
|
151
|
-
command: `icm init --mode ${mode}`,
|
|
152
|
-
runner: "shell"
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
return steps;
|
|
156
|
-
}
|
|
157
|
-
function buildIcmUninstallSteps(scope) {
|
|
158
|
-
if (scope === "local") {
|
|
159
|
-
return [{
|
|
160
|
-
id: "icm-local-cleanup",
|
|
161
|
-
library: "icm",
|
|
162
|
-
phase: "cleanup",
|
|
163
|
-
title: "Remove ICM project instructions",
|
|
164
|
-
description: "Remove only ICM-managed instruction blocks from the current project's local files.",
|
|
165
|
-
command: "clean ICM blocks from current project",
|
|
166
|
-
runner: "cleanup-icm-local"
|
|
167
|
-
}];
|
|
168
|
-
}
|
|
169
|
-
return [];
|
|
170
|
-
}
|
|
171
|
-
function buildEccInstallSteps(agents) {
|
|
172
|
-
const steps = [];
|
|
173
|
-
if (agents.includes("claude")) {
|
|
174
|
-
steps.push({
|
|
175
|
-
id: "ecc-install-claude",
|
|
176
|
-
library: "ecc",
|
|
177
|
-
phase: "install",
|
|
178
|
-
title: "Set up ECC for Claude",
|
|
179
|
-
description: "Clone the upstream ECC repo into a temporary directory, install its dependencies, and run the documented full manual Claude setup.",
|
|
180
|
-
command: "temporary clone of affaan-m/ECC -> npm install -> bash ./install.sh --profile full",
|
|
181
|
-
runner: "setup-ecc-claude"
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
if (agents.includes("codex")) {
|
|
185
|
-
steps.push({
|
|
186
|
-
id: "ecc-install-codex",
|
|
187
|
-
library: "ecc",
|
|
188
|
-
phase: "configure",
|
|
189
|
-
title: "Set up ECC for Codex",
|
|
190
|
-
description: "Clone the upstream ECC repo into a temporary directory, install its dependencies, and run the documented Codex sync script.",
|
|
191
|
-
command: "temporary clone of affaan-m/ECC -> npm install -> bash ./scripts/sync-ecc-to-codex.sh",
|
|
192
|
-
runner: "setup-ecc-codex"
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
return steps;
|
|
196
|
-
}
|
|
197
|
-
function buildCodegraphInstallSteps() {
|
|
198
|
-
return [
|
|
199
|
-
{
|
|
200
|
-
id: "codegraph-install",
|
|
201
|
-
library: "codegraph",
|
|
202
|
-
phase: "install",
|
|
203
|
-
title: "Install CodeGraph binary",
|
|
204
|
-
description: `Install the CodeGraph CLI globally from the upstream GitHub repo (${CODEGRAPH_REPO_URL}).`,
|
|
205
|
-
command: `npm install -g ${CODEGRAPH_REPO_URL}`,
|
|
206
|
-
runner: "shell"
|
|
207
|
-
}
|
|
208
|
-
];
|
|
209
|
-
}
|
|
210
|
-
function buildCodegraphUninstallSteps() {
|
|
211
|
-
return [
|
|
212
|
-
{
|
|
213
|
-
id: "codegraph-uninstall",
|
|
214
|
-
library: "codegraph",
|
|
215
|
-
phase: "uninstall",
|
|
216
|
-
title: "Uninstall CodeGraph binary",
|
|
217
|
-
description: "Remove the globally installed CodeGraph CLI.",
|
|
218
|
-
command: "npm uninstall -g codegraph",
|
|
219
|
-
runner: "shell"
|
|
220
|
-
}
|
|
221
|
-
];
|
|
222
|
-
}
|
|
223
|
-
export function buildLibInstallPlan(input) {
|
|
224
|
-
const agents = uniq(input.agents);
|
|
225
|
-
const libraries = uniq(input.libraries);
|
|
226
|
-
const hostOs = detectSupportedHostOs(input.platform);
|
|
227
|
-
const steps = [];
|
|
228
|
-
const notes = [];
|
|
229
|
-
for (const library of libraries) {
|
|
230
|
-
if (library === "rtk") {
|
|
231
|
-
if (input.mode === "install") {
|
|
232
|
-
steps.push(...buildRtkInstallSteps(agents, input.scope));
|
|
233
|
-
notes.push("RTK rewrites Bash commands. Built-in non-shell tools are not auto-rewritten.");
|
|
234
|
-
notes.push("RTK uninstall removes RTK-managed assistant artifacts only; it does not edit unrelated shell or editor settings.");
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
steps.push(...buildRtkUninstallSteps(agents, input.scope));
|
|
238
|
-
if (input.scope === "global") {
|
|
239
|
-
notes.push("RTK binary cleanup only removes the quick-install path ~/.local/bin/rtk. Homebrew or cargo installs still require manual removal.");
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
notes.push("RTK local uninstall leaves the global binary in place to avoid breaking other projects or global hooks.");
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
continue;
|
|
246
|
-
}
|
|
247
|
-
if (library === "icm") {
|
|
248
|
-
if (input.mode === "install") {
|
|
249
|
-
steps.push(...buildIcmInstallSteps(agents, input.scope));
|
|
250
|
-
if (input.scope === "global") {
|
|
251
|
-
notes.push("ICM init auto-detects supported tools on this machine and may update more global configs than the selected agent labels alone imply.");
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
notes.push("ICM local mode uses upstream --per_project CLI injection. Depending on upstream behavior, some global instruction files may still be touched.");
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
steps.push(...buildIcmUninstallSteps(input.scope));
|
|
259
|
-
if (input.scope === "global") {
|
|
260
|
-
notes.push("Automatic global ICM uninstall is intentionally disabled in this CLI because upstream uninstall removes all detected ICM integrations, not only the selected agents.");
|
|
261
|
-
notes.push("For safest cleanup, run `icm uninstall --audit` manually, review the plan, then use upstream uninstall yourself if the detected scope is acceptable.");
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
notes.push("ICM local uninstall only strips ICM-managed blocks from project files in the current directory and leaves global ICM config untouched.");
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
continue;
|
|
268
|
-
}
|
|
269
|
-
if (library === "ecc") {
|
|
270
|
-
if (input.mode === "install") {
|
|
271
|
-
steps.push(...buildEccInstallSteps(agents));
|
|
272
|
-
notes.push("ECC install in this CLI clones the upstream repo into a temporary directory and runs the documented repo-based setup flow for each selected agent. It is user-level and not constrained to the selected scope.");
|
|
273
|
-
notes.push("If ECC is already installed in Claude via the upstream plugin path, do not run the full installer again here. Upstream warns that stacking both methods can duplicate skills, commands, and hooks.");
|
|
274
|
-
notes.push("For Codex, this CLI uses the upstream repo-based sync flow (`npm install && bash scripts/sync-ecc-to-codex.sh`) instead of `npx ecc-install`, because the package name and installer binary are published separately (`ecc-universal` vs `ecc-install`).");
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
notes.push("Automatic ECC uninstall is not supported in this CLI. Upstream documents repo-root lifecycle commands such as `node scripts/uninstall.js --dry-run` followed by `node scripts/uninstall.js` for manual cleanup.");
|
|
278
|
-
notes.push("If ECC was installed through the Claude plugin path, remove the plugin first and then delete only the specific ECC rule folders you copied manually.");
|
|
279
|
-
}
|
|
280
|
-
continue;
|
|
281
|
-
}
|
|
282
|
-
if (library === "codegraph") {
|
|
283
|
-
if (input.mode === "install") {
|
|
284
|
-
steps.push(...buildCodegraphInstallSteps());
|
|
285
|
-
notes.push("CodeGraph is a project-level indexer. After installing the CLI, run `codegraph init` in each project you want to index — indexing is intentionally per-project and not run automatically here.");
|
|
286
|
-
notes.push("The MCP tools (codegraph_explore, codegraph_node) become available only after a project has been indexed with `codegraph init`.");
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
steps.push(...buildCodegraphUninstallSteps());
|
|
290
|
-
notes.push("CodeGraph uninstall removes only the global CLI binary. Existing `.codegraph/` index directories in your projects are not removed and can be deleted manually with `rm -rf .codegraph`.");
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
if (input.mode === "install" && libraries.some((library) => library === "rtk" || library === "icm")) {
|
|
295
|
-
notes.unshift("Binary install still uses the upstream installer and writes to the user's bin directory even when scope is local.");
|
|
296
|
-
}
|
|
297
|
-
if (hostOs && hostOs !== input.os) {
|
|
298
|
-
notes.unshift(`Selected OS is ${input.os}, but the current host is ${hostOs}. The installer always runs against the current machine.`);
|
|
299
|
-
}
|
|
300
|
-
if (!hostOs) {
|
|
301
|
-
notes.unshift("This host OS is not one of the supported Mac/Linux targets. The upstream installers may fail.");
|
|
302
|
-
}
|
|
303
|
-
return {
|
|
304
|
-
mode: input.mode,
|
|
305
|
-
os: input.os,
|
|
306
|
-
hostOs,
|
|
307
|
-
scope: input.scope,
|
|
308
|
-
agents,
|
|
309
|
-
libraries,
|
|
310
|
-
steps,
|
|
311
|
-
notes
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
export async function executeLibInstallPlan(input) {
|
|
315
|
-
for (const step of input.plan.steps) {
|
|
316
|
-
input.onProgress?.(step);
|
|
317
|
-
if (step.runner === "remove-binary") {
|
|
318
|
-
if (!step.path) {
|
|
319
|
-
throw new Error(`Missing path for step "${step.id}".`);
|
|
320
|
-
}
|
|
321
|
-
await removeBinaryAtPath(step.path);
|
|
322
|
-
continue;
|
|
323
|
-
}
|
|
324
|
-
if (step.runner === "cleanup-icm-local") {
|
|
325
|
-
await cleanupIcmLocalBlocks(input.cwd);
|
|
326
|
-
continue;
|
|
327
|
-
}
|
|
328
|
-
if (step.runner === "setup-ecc-claude") {
|
|
329
|
-
await runEccRepoSetup("claude", input.cwd);
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
|
-
if (step.runner === "setup-ecc-codex") {
|
|
333
|
-
await runEccRepoSetup("codex", input.cwd);
|
|
334
|
-
continue;
|
|
335
|
-
}
|
|
336
|
-
await runShellCommand(step.command, input.cwd);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
async function runEccRepoSetup(target, cwd) {
|
|
340
|
-
const tempRoot = await mkdtemp(path.join(os.tmpdir(), ECC_TEMP_DIR_PREFIX));
|
|
341
|
-
try {
|
|
342
|
-
await runShellCommand(`git clone --depth 1 ${ECC_REPO_URL} "${tempRoot}"`, cwd);
|
|
343
|
-
await runShellCommand("npm install", tempRoot);
|
|
344
|
-
if (target === "claude") {
|
|
345
|
-
await runShellCommand("bash ./install.sh --profile full", tempRoot);
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
await runShellCommand("bash ./scripts/sync-ecc-to-codex.sh", tempRoot);
|
|
349
|
-
}
|
|
350
|
-
finally {
|
|
351
|
-
await rm(tempRoot, { recursive: true, force: true });
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
async function removeBinaryAtPath(targetPath) {
|
|
355
|
-
try {
|
|
356
|
-
const info = await stat(targetPath);
|
|
357
|
-
if (!info.isFile()) {
|
|
358
|
-
return;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
catch {
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
await rm(targetPath, { force: true });
|
|
365
|
-
}
|
|
366
|
-
async function cleanupIcmLocalBlocks(cwd) {
|
|
367
|
-
const candidateFiles = [
|
|
368
|
-
"CLAUDE.md",
|
|
369
|
-
"AGENTS.md",
|
|
370
|
-
".github/copilot-instructions.md",
|
|
371
|
-
".windsurfrules",
|
|
372
|
-
".aider.conventions.md"
|
|
373
|
-
];
|
|
374
|
-
for (const relativeFile of candidateFiles) {
|
|
375
|
-
const absoluteFile = path.join(cwd, relativeFile);
|
|
376
|
-
let content;
|
|
377
|
-
try {
|
|
378
|
-
content = await readFile(absoluteFile, "utf8");
|
|
379
|
-
}
|
|
380
|
-
catch {
|
|
381
|
-
continue;
|
|
382
|
-
}
|
|
383
|
-
const cleaned = stripIcmBlocks(content);
|
|
384
|
-
if (cleaned === content) {
|
|
385
|
-
continue;
|
|
386
|
-
}
|
|
387
|
-
if (cleaned.trim().length === 0) {
|
|
388
|
-
await rm(absoluteFile, { force: true });
|
|
389
|
-
continue;
|
|
390
|
-
}
|
|
391
|
-
await writeFile(absoluteFile, cleaned, "utf8");
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
function stripIcmBlocks(content) {
|
|
395
|
-
const blockPattern = new RegExp(`\\n?${escapeRegExp(ICM_MARKER_START)}[\\s\\S]*?${escapeRegExp(ICM_MARKER_END)}\\n?`, "g");
|
|
396
|
-
const stripped = content.replace(blockPattern, "\n");
|
|
397
|
-
return stripped.replace(/\n{3,}/g, "\n\n").trimEnd() + (stripped.endsWith("\n") ? "\n" : "");
|
|
398
|
-
}
|
|
399
|
-
function escapeRegExp(value) {
|
|
400
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
401
|
-
}
|
|
402
|
-
function runShellCommand(command, cwd) {
|
|
403
|
-
return new Promise((resolve, reject) => {
|
|
404
|
-
const child = spawn("/bin/sh", ["-lc", command], {
|
|
405
|
-
cwd,
|
|
406
|
-
stdio: "inherit"
|
|
407
|
-
});
|
|
408
|
-
child.on("error", reject);
|
|
409
|
-
child.on("close", (code) => {
|
|
410
|
-
if (code === 0) {
|
|
411
|
-
resolve();
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
reject(new Error(`Command failed with exit code ${code}: ${command}`));
|
|
415
|
-
});
|
|
416
|
-
});
|
|
417
|
-
}
|