@rainbow-robotics/muscat-plugin-kit 1.3.6-dev.3 → 1.3.6-dev.5
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/cli/src/devBack.mjs +6 -5
- package/cli/src/ros2.mjs +3 -2
- package/cli/src/uninstall.mjs +3 -20
- package/cli/src/util.mjs +16 -4
- package/cli/storybook-dist/project.json +1 -1
- package/package.json +3 -3
package/cli/src/devBack.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { spawn, spawnSync } from "node:child_process";
|
|
|
11
11
|
import { existsSync, mkdirSync, readFileSync, watch, writeFileSync } from "node:fs";
|
|
12
12
|
import { isIP } from "node:net";
|
|
13
13
|
import { dirname, resolve } from "node:path";
|
|
14
|
-
import { ensureDocker, ensureIdeVenv, findPluginRoot, log, promptRobotConnection, realtimeFlags } from "./util.mjs";
|
|
14
|
+
import { dockerUserFlags, ensureDocker, ensureIdeVenv, findPluginRoot, log, promptRobotConnection, realtimeFlags } from "./util.mjs";
|
|
15
15
|
import { ensureRemoteZenohEnv, usesHostNetwork } from "./zenohDev.mjs";
|
|
16
16
|
import { PLUGIN_ID_RE, assertManifestPorts, assertManifestVariables, manifestRuntime, readManifest, rosNamespace, validateManifest } from "./manifest.mjs";
|
|
17
17
|
import {
|
|
@@ -184,11 +184,12 @@ async function runPython(root, portRanges) {
|
|
|
184
184
|
const docker = (args, opts = {}) =>
|
|
185
185
|
spawnSync("docker", args, { cwd: root, stdio: "inherit", ...opts });
|
|
186
186
|
|
|
187
|
-
// start a warm, long-lived container with the plugin mounted
|
|
187
|
+
// start a warm, long-lived container with the plugin mounted.
|
|
188
|
+
// 호스트 uid 로 돌린다(dockerUserFlags) — root 로 쓴 build/·install/ 은 사용자가 지우지 못한다.
|
|
188
189
|
docker(["rm", "-f", container], { stdio: "ignore" });
|
|
189
190
|
log.step("starting Python dev container…");
|
|
190
191
|
const up = docker(
|
|
191
|
-
["run", "-d", "--name", container, ...net.run, ...standaloneZenohPortFlags, ...realtimeFlags(),
|
|
192
|
+
["run", "-d", "--name", container, ...net.run, ...standaloneZenohPortFlags, ...realtimeFlags(), ...dockerUserFlags(),
|
|
192
193
|
"-e", "PIP_ROOT_USER_ACTION=ignore",
|
|
193
194
|
"-v", `${root}:/plugin`, "-w", "/plugin", PYTHON_DEV_IMAGE, "sleep", "infinity"],
|
|
194
195
|
{ stdio: "inherit" },
|
|
@@ -488,7 +489,7 @@ async function runRos2(root, portRanges) {
|
|
|
488
489
|
docker(["rm", "-f", container], { stdio: "ignore" });
|
|
489
490
|
log.step("starting ROS2 dev container…");
|
|
490
491
|
const up = docker(
|
|
491
|
-
["run", "-d", "--name", container, ...net.run, ...realtimeFlags(), "-e", "PIP_ROOT_USER_ACTION=ignore", "-v", `${root}:/plugin`, "-w", "/plugin", ROS2_DEV_IMAGE, "sleep", "infinity"],
|
|
492
|
+
["run", "-d", "--name", container, ...net.run, ...realtimeFlags(), ...dockerUserFlags(), "-e", "PIP_ROOT_USER_ACTION=ignore", "-v", `${root}:/plugin`, "-w", "/plugin", ROS2_DEV_IMAGE, "sleep", "infinity"],
|
|
492
493
|
{ stdio: "inherit" },
|
|
493
494
|
);
|
|
494
495
|
if (up.status !== 0) throw new Error("failed to start dev container.");
|
|
@@ -581,7 +582,7 @@ async function runCpp(root, portRanges) {
|
|
|
581
582
|
docker(["rm", "-f", container], { stdio: "ignore" });
|
|
582
583
|
log.step("starting C++ dev container…");
|
|
583
584
|
const up = docker(
|
|
584
|
-
["run", "-d", "--name", container, ...net.run, ...realtimeFlags(), "-v", `${root}:/plugin`, "-w", "/plugin", CPP_DEV_IMAGE, "sleep", "infinity"],
|
|
585
|
+
["run", "-d", "--name", container, ...net.run, ...realtimeFlags(), ...dockerUserFlags(), "-v", `${root}:/plugin`, "-w", "/plugin", CPP_DEV_IMAGE, "sleep", "infinity"],
|
|
585
586
|
{ stdio: "inherit" },
|
|
586
587
|
);
|
|
587
588
|
if (up.status !== 0) throw new Error("failed to start dev container.");
|
package/cli/src/ros2.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { spawnSync } from "node:child_process";
|
|
4
4
|
import { existsSync, readdirSync } from "node:fs";
|
|
5
5
|
import { dirname, resolve } from "node:path";
|
|
6
|
-
import { canSkipImageBuild, imageKey, imageKeyLabel, hasBin, log, pruneMuskatImages, resolveDockerfile } from "./util.mjs";
|
|
6
|
+
import { canSkipImageBuild, imageKey, imageKeyLabel, dockerUserFlags, hasBin, log, pruneMuskatImages, resolveDockerfile } from "./util.mjs";
|
|
7
7
|
|
|
8
8
|
export const ROS2_DEV_IMAGE = "muscat-pk-ros2-dev";
|
|
9
9
|
|
|
@@ -94,7 +94,8 @@ export function colconBuild(root, { image = ROS2_DEV_IMAGE, symlink = false, arc
|
|
|
94
94
|
const platformFlags = dockerPlatform ? ["--platform", dockerPlatform] : [];
|
|
95
95
|
const r = spawnSync(
|
|
96
96
|
"docker",
|
|
97
|
-
|
|
97
|
+
// python/cpp 와 같이 호스트 uid 로 돌린다 — root 소유 산출물이 남으면 사용자가 지우지 못한다.
|
|
98
|
+
["run", "--rm", ...platformFlags, ...dockerUserFlags(), "-e", "PIP_ROOT_USER_ACTION=ignore", "-v", `${root}:/plugin`, "-w", "/plugin", actualImage, "bash", "-lc", script],
|
|
98
99
|
{ cwd: root, stdio: "inherit" },
|
|
99
100
|
);
|
|
100
101
|
if (r.status !== 0) throw new Error(`colcon build failed${arch ? ` (${arch})` : ""}.`);
|
package/cli/src/uninstall.mjs
CHANGED
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
// muscat-pk uninstall - remove the installed CLI, whether npm-global or S3 binary.
|
|
2
2
|
import { execSync, spawn, spawnSync } from "node:child_process";
|
|
3
|
-
import { existsSync,
|
|
4
|
-
import { dirname, join
|
|
5
|
-
import { KIT_PUBLISHED_NAME,
|
|
3
|
+
import { existsSync, rmSync } from "node:fs";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { KIT_PUBLISHED_NAME, isNpmGlobalInstall, log, parseArgs } from "./util.mjs";
|
|
6
6
|
|
|
7
7
|
const isBinaryMode = typeof Bun !== "undefined";
|
|
8
8
|
|
|
9
|
-
function isInside(child, parent) {
|
|
10
|
-
const rel = relative(parent, child);
|
|
11
|
-
return rel === "" || (!!rel && !rel.startsWith("..") && !rel.includes(":"));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function npmGlobalRoot() {
|
|
15
|
-
return execSync("npm root -g", { encoding: "utf8" }).trim();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function isNpmGlobalInstall() {
|
|
19
|
-
try {
|
|
20
|
-
return isInside(realpathSync(kitRoot), realpathSync(npmGlobalRoot()));
|
|
21
|
-
} catch {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
9
|
function uninstallNpmGlobal() {
|
|
27
10
|
log.step(`npm uninstall -g ${KIT_PUBLISHED_NAME}`);
|
|
28
11
|
execSync(`npm uninstall -g ${KIT_PUBLISHED_NAME}`, { stdio: "inherit" });
|
package/cli/src/util.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Shared helpers for muscat-pk.
|
|
2
|
-
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { execSync, spawnSync } from "node:child_process";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
|
-
import { dirname, resolve, sep } from "node:path";
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { dirname, relative, resolve, sep } from "node:path";
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { createInterface } from "node:readline/promises";
|
|
@@ -187,9 +187,21 @@ export function resolveLocalCliBin(start = process.cwd()) {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
/** True if the code currently running was installed with `npm install -g`. */
|
|
191
|
+
export function isNpmGlobalInstall() {
|
|
192
|
+
try {
|
|
193
|
+
const globalRoot = realpathSync(execSync("npm root -g", { encoding: "utf8" }).trim());
|
|
194
|
+
const rel = relative(globalRoot, realpathSync(kitRoot));
|
|
195
|
+
return rel === "" || (!rel.startsWith("..") && !rel.includes(":"));
|
|
196
|
+
} catch {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
190
201
|
/** True if the code currently running is a project's local install (not global/binary). */
|
|
191
202
|
export function isLocalKitInstall() {
|
|
192
|
-
|
|
203
|
+
// npm -g 도 node_modules 아래에 놓이므로 global root 는 제외한다.
|
|
204
|
+
return kitRoot.includes(`${sep}node_modules${sep}`) && !isNpmGlobalInstall();
|
|
193
205
|
}
|
|
194
206
|
|
|
195
207
|
const useColor = process.env.NO_COLOR !== "1" && (process.stdout.isTTY || process.env.FORCE_COLOR);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"generatedAt":
|
|
1
|
+
{"generatedAt":1791434545972,"userSince":1750932757926,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"testPackages":{"@vitest/browser":"3.2.4","@vitest/coverage-v8":"3.2.4","playwright":"1.59.1","vitest":"3.2.4"},"hasRouterPackage":false,"monorepo":"Turborepo","packageManager":{"type":"yarn","version":"berry","agent":"yarn@berry"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","portableStoriesFileCount":0,"applicationFileCount":0,"storybookVersion":"8.6.18","storybookVersionSpecifier":"^8.6.4","language":"typescript","storybookPackages":{"@chromatic-com/storybook":{"version":"3.2.7"},"@storybook/addon-essentials":{"version":"8.6.18"},"@storybook/addon-links":{"version":"8.6.18"},"@storybook/addon-onboarding":{"version":"8.6.18"},"@storybook/addon-themes":{"version":"8.6.18"},"@storybook/blocks":{"version":"8.6.18"},"@storybook/experimental-addon-test":{"version":"8.6.18"},"@storybook/react":{"version":"8.6.18"},"@storybook/react-vite":{"version":"8.6.18"},"@storybook/test":{"version":"8.6.18"},"@storybook/theming":{"version":"8.6.18"},"eslint-plugin-storybook":{"version":"0.11.6"},"storybook":{"version":"8.6.18"},"storybook-addon-react-docgen":{"version":"1.2.44"}},"addons":{"$SNIP/node_modules/@storybook/addon-links":{"version":null},"$SNIP/node_modules/@storybook/addon-essentials":{"version":null},"$SNIP/node_modules/@chromatic-com/storybook":{"version":null},"$SNIP/node_modules/@storybook/addon-themes":{"version":null},"$SNIP/node_modules/@storybook/experimental-addon-test":{"version":null}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rainbow-robotics/muscat-plugin-kit",
|
|
3
|
-
"version": "1.3.6-dev.
|
|
3
|
+
"version": "1.3.6-dev.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20"
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
56
|
-
"@rainbow-robotics/plugin-ui": "1.3.6-dev.
|
|
57
|
-
"@rainbow-robotics/preview-host": "1.3.6-dev.
|
|
56
|
+
"@rainbow-robotics/plugin-ui": "1.3.6-dev.5",
|
|
57
|
+
"@rainbow-robotics/preview-host": "1.3.6-dev.5",
|
|
58
58
|
"postcss": "^8.5.8",
|
|
59
59
|
"socket.io": "^4.8.1",
|
|
60
60
|
"typescript": "^5.8.0",
|