aipctl 0.0.0-seed.0 → 2026.6.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.
- package/binary.cjs +39 -0
- package/dispatcher.cjs +17 -0
- package/main.cjs +22 -2
- package/package.json +28 -4
- package/platforms.json +8 -0
package/binary.cjs
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// 플랫폼에 맞는 Go 바이너리 경로를 해석한다.
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
|
|
7
|
+
const platforms = require("./platforms.json");
|
|
8
|
+
|
|
9
|
+
const PLATFORMS = {};
|
|
10
|
+
for (const p of platforms) {
|
|
11
|
+
PLATFORMS[`${p.os}-${p.cpu}`] = p.npm;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function resolveBinaryPackage(platform, arch) {
|
|
15
|
+
const key = `${platform}-${arch}`;
|
|
16
|
+
const pkg = PLATFORMS[key];
|
|
17
|
+
if (!pkg) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
`Unsupported platform: ${key}. Supported: ${Object.keys(PLATFORMS).join(", ")}`,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
return pkg;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function resolveBinaryPath(platform, arch) {
|
|
26
|
+
const pkg = resolveBinaryPackage(platform, arch);
|
|
27
|
+
const binName = platform === "win32" ? "aipctl.exe" : "aipctl";
|
|
28
|
+
const binPath = path.join(
|
|
29
|
+
path.dirname(require.resolve(`${pkg}/package.json`)),
|
|
30
|
+
"bin",
|
|
31
|
+
binName,
|
|
32
|
+
);
|
|
33
|
+
if (!fs.existsSync(binPath)) {
|
|
34
|
+
throw new Error(`Binary not found: ${binPath}. Try reinstalling the package.`);
|
|
35
|
+
}
|
|
36
|
+
return binPath;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = { resolveBinaryPackage, resolveBinaryPath, PLATFORMS };
|
package/dispatcher.cjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// CLI 런타임 분기. 기존 MCP CLI 서브커맨드는 Go 바이너리로 그대로 전달한다.
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const MCP_COMMANDS = new Set(["install", "run", "tunnel", "logs"]);
|
|
5
|
+
|
|
6
|
+
function dispatch({ args, binaryPath, spawn }) {
|
|
7
|
+
if (MCP_COMMANDS.has(args[0])) {
|
|
8
|
+
return spawn(binaryPath, args, {
|
|
9
|
+
stdio: "inherit",
|
|
10
|
+
env: process.env,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
throw new Error("TODO: AIP runtime dispatch is not implemented yet");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = { dispatch, MCP_COMMANDS };
|
package/main.cjs
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
// Go 바이너리를 실행하는 npm wrapper entrypoint.
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const { spawn } = require("child_process");
|
|
6
|
+
const { resolveBinaryPath } = require("./binary.cjs");
|
|
7
|
+
const { dispatch } = require("./dispatcher.cjs");
|
|
8
|
+
|
|
9
|
+
const bin = resolveBinaryPath(process.platform, process.arch);
|
|
10
|
+
const child = dispatch({
|
|
11
|
+
args: process.argv.slice(2),
|
|
12
|
+
binaryPath: bin,
|
|
13
|
+
spawn,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
child.on("error", (err) => {
|
|
17
|
+
console.error(`Failed to start mcp: ${err.message}`);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
child.on("exit", (code) => {
|
|
22
|
+
process.exit(code ?? 1);
|
|
23
|
+
});
|
package/package.json
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
+
"version": "2026.6.1",
|
|
2
3
|
"name": "aipctl",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
4
|
+
"description": "QueryPie MCP CLI tool",
|
|
5
|
+
"author": "QueryPie",
|
|
5
6
|
"license": "UNLICENSED",
|
|
6
7
|
"bin": {
|
|
7
8
|
"aipctl": "main.cjs"
|
|
8
9
|
},
|
|
9
10
|
"files": [
|
|
10
|
-
"main.cjs"
|
|
11
|
-
|
|
11
|
+
"main.cjs",
|
|
12
|
+
"binary.cjs",
|
|
13
|
+
"dispatcher.cjs",
|
|
14
|
+
"platforms.json"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"clean": "node -e \"const fs=require('node:fs'); fs.rmSync('dist',{recursive:true,force:true}); fs.rmSync('src/bin',{recursive:true,force:true});\"",
|
|
18
|
+
"build": "make -C src build",
|
|
19
|
+
"dev": "node ../../scripts/cli-dev.cjs",
|
|
20
|
+
"generate": "make -C src generate",
|
|
21
|
+
"test": "pnpm run test:wrapper && pnpm run test:go",
|
|
22
|
+
"test:go": "make -C src test",
|
|
23
|
+
"test:wrapper": "pnpm dlx tsx --test scripts/publish-lib.test.ts && node --test binary.test.cjs dispatcher.test.cjs"
|
|
24
|
+
},
|
|
25
|
+
"optionalDependencies": {
|
|
26
|
+
"aipctl-darwin-x64": "2026.6.1",
|
|
27
|
+
"aipctl-darwin-arm64": "2026.6.1",
|
|
28
|
+
"aipctl-linux-x64": "2026.6.1",
|
|
29
|
+
"aipctl-linux-arm64": "2026.6.1",
|
|
30
|
+
"aipctl-windows-x64": "2026.6.1",
|
|
31
|
+
"aipctl-windows-arm64": "2026.6.1"
|
|
32
|
+
},
|
|
33
|
+
"metadata": {
|
|
34
|
+
"contentHash": "1e39bb3aeb0932f1880299832d960c6ab5bc8cef6ca9d937d6307ca3c43f2e59"
|
|
35
|
+
}
|
|
12
36
|
}
|
package/platforms.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
[
|
|
2
|
+
{ "npm": "aipctl-darwin-x64", "goos": "darwin", "goarch": "amd64", "os": "darwin", "cpu": "x64" },
|
|
3
|
+
{ "npm": "aipctl-darwin-arm64", "goos": "darwin", "goarch": "arm64", "os": "darwin", "cpu": "arm64" },
|
|
4
|
+
{ "npm": "aipctl-linux-x64", "goos": "linux", "goarch": "amd64", "os": "linux", "cpu": "x64" },
|
|
5
|
+
{ "npm": "aipctl-linux-arm64", "goos": "linux", "goarch": "arm64", "os": "linux", "cpu": "arm64" },
|
|
6
|
+
{ "npm": "aipctl-windows-x64", "goos": "windows", "goarch": "amd64", "os": "win32", "cpu": "x64" },
|
|
7
|
+
{ "npm": "aipctl-windows-arm64", "goos": "windows", "goarch": "arm64", "os": "win32", "cpu": "arm64" }
|
|
8
|
+
]
|