create-snipara 3.1.3 → 3.1.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/dist/index.js +57 -6
- package/dist/managed-toolchain.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { homedir as homedir2 } from "os";
|
|
|
14
14
|
// package.json
|
|
15
15
|
var package_default = {
|
|
16
16
|
name: "create-snipara",
|
|
17
|
-
version: "3.1.
|
|
17
|
+
version: "3.1.5",
|
|
18
18
|
description: "Onboard Snipara Cloud or self-hosted MCP with an automatic project-grounded proof of value",
|
|
19
19
|
main: "dist/index.js",
|
|
20
20
|
type: "module",
|
|
@@ -225,8 +225,8 @@ function parseManagedToolchainManifest(value) {
|
|
|
225
225
|
|
|
226
226
|
// src/managed-versions.json
|
|
227
227
|
var managed_versions_default = {
|
|
228
|
-
companion: "9.
|
|
229
|
-
sandbox: "3.
|
|
228
|
+
companion: "9.3.0",
|
|
229
|
+
sandbox: "3.6.0"
|
|
230
230
|
};
|
|
231
231
|
|
|
232
232
|
// src/managed-toolchain.ts
|
|
@@ -974,6 +974,10 @@ var MIN_COMPANION_VERSION = "3.8.0";
|
|
|
974
974
|
var GITHUB_ANSWER_PACKS_LABEL = "GitHub PR Answer Packs";
|
|
975
975
|
var MCP_PACKAGE_NAME = "snipara-mcp";
|
|
976
976
|
var SANDBOX_PACKAGE_NAME = "snipara-sandbox[all]";
|
|
977
|
+
var FIRST_ON_MCP_2 = {
|
|
978
|
+
[MCP_PACKAGE_NAME]: "5.0.0",
|
|
979
|
+
[SANDBOX_PACKAGE_NAME]: "3.6.0"
|
|
980
|
+
};
|
|
977
981
|
var SANDBOX_SERVER_NAME = "snipara-sandbox";
|
|
978
982
|
var LEGACY_RUNTIME_SERVER_NAME = "rlm-runtime";
|
|
979
983
|
var SANDBOX_COMMAND_NAME = "snipara-sandbox";
|
|
@@ -3683,6 +3687,39 @@ function detectSandboxCommand() {
|
|
|
3683
3687
|
}
|
|
3684
3688
|
return null;
|
|
3685
3689
|
}
|
|
3690
|
+
function findMcpSide(pipCmd, packages) {
|
|
3691
|
+
const pip = pipCmd === "uv" ? "uv pip" : pipCmd;
|
|
3692
|
+
const run = (command) => execSync(`${pip} ${command}`, {
|
|
3693
|
+
encoding: "utf-8",
|
|
3694
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
3695
|
+
timeout: 3e4
|
|
3696
|
+
});
|
|
3697
|
+
const sandboxName = stripExtras(SANDBOX_PACKAGE_NAME);
|
|
3698
|
+
const own = [MCP_PACKAGE_NAME, sandboxName];
|
|
3699
|
+
const field = (record, name) => record?.match(new RegExp(`^${name}:[ \\t]*(.*)$`, "m"))?.[1].trim() ?? "";
|
|
3700
|
+
try {
|
|
3701
|
+
const installed = new Map(
|
|
3702
|
+
run(`show mcp ${own.join(" ")}`).split(/^---\s*$/m).map((record) => [field(record, "Name").toLowerCase(), record])
|
|
3703
|
+
);
|
|
3704
|
+
const version = field(installed.get("mcp"), "Version");
|
|
3705
|
+
if (!version) return { bound: "", users: [] };
|
|
3706
|
+
if (Number.parseInt(version, 10) >= 2) return { bound: ">=", users: [] };
|
|
3707
|
+
let users = field(installed.get("mcp"), "Required-by").split(/,\s*/).filter((name) => name && !own.includes(name));
|
|
3708
|
+
if (users.length > 0) {
|
|
3709
|
+
const broken = run("check 2>&1 || true");
|
|
3710
|
+
users = users.filter((name) => !new RegExp(`\\b${name}\\b.*\\bmcp\\b.* but `).test(broken));
|
|
3711
|
+
} else if (!own.some((name) => installed.has(name))) {
|
|
3712
|
+
users = ["this environment"];
|
|
3713
|
+
}
|
|
3714
|
+
const sandbox = normalizeSemver(field(installed.get(sandboxName), "Version"));
|
|
3715
|
+
if (sandbox && !packages.includes(SANDBOX_PACKAGE_NAME) && compareSemver(sandbox, FIRST_ON_MCP_2[SANDBOX_PACKAGE_NAME]) < 0) {
|
|
3716
|
+
users.push(sandboxName);
|
|
3717
|
+
}
|
|
3718
|
+
return { bound: users.length > 0 ? "<" : "", users };
|
|
3719
|
+
} catch {
|
|
3720
|
+
return { bound: "", users: [] };
|
|
3721
|
+
}
|
|
3722
|
+
}
|
|
3686
3723
|
async function installPythonPackages(answers, upgrade) {
|
|
3687
3724
|
console.log(chalk.bold(`
|
|
3688
3725
|
\u{1F4E6} ${upgrade ? "Upgrading" : "Installing"} Python Packages
|
|
@@ -3707,10 +3744,24 @@ async function installPythonPackages(answers, upgrade) {
|
|
|
3707
3744
|
packages.push(SANDBOX_PACKAGE_NAME);
|
|
3708
3745
|
}
|
|
3709
3746
|
if (packages.length === 0) return;
|
|
3747
|
+
const { bound, users } = findMcpSide(pipCmd, packages);
|
|
3748
|
+
const specs = packages.map((name) => `"${name}${bound && bound + FIRST_ON_MCP_2[name]}"`);
|
|
3749
|
+
if (users.length > 0) {
|
|
3750
|
+
console.log(
|
|
3751
|
+
chalk.yellow(
|
|
3752
|
+
` \u26A0\uFE0F mcp stays below 2 for ${users.join(", ")}: installing the last Snipara versions that run on it.`
|
|
3753
|
+
)
|
|
3754
|
+
);
|
|
3755
|
+
console.log(
|
|
3756
|
+
chalk.gray(
|
|
3757
|
+
" For the current ones, upgrade what uses mcp here, or use --profile local-work or a separate environment.\n"
|
|
3758
|
+
)
|
|
3759
|
+
);
|
|
3760
|
+
}
|
|
3710
3761
|
const spinner = ora(
|
|
3711
3762
|
`${upgrade ? "Upgrading" : "Installing"} ${packages.map(stripExtras).join(", ")}...`
|
|
3712
3763
|
).start();
|
|
3713
|
-
const attempts = [
|
|
3764
|
+
const attempts = [specs];
|
|
3714
3765
|
const failures = [];
|
|
3715
3766
|
for (const attemptPackages of attempts) {
|
|
3716
3767
|
try {
|
|
@@ -3720,7 +3771,7 @@ async function installPythonPackages(answers, upgrade) {
|
|
|
3720
3771
|
encoding: "utf-8"
|
|
3721
3772
|
});
|
|
3722
3773
|
spinner.succeed(
|
|
3723
|
-
`${upgrade ? "Upgraded" : "Installed"} ${
|
|
3774
|
+
`${upgrade ? "Upgraded" : "Installed"} ${packages.map(stripExtras).join(", ")}`
|
|
3724
3775
|
);
|
|
3725
3776
|
return;
|
|
3726
3777
|
} catch (error) {
|
|
@@ -3736,7 +3787,7 @@ async function installPythonPackages(answers, upgrade) {
|
|
|
3736
3787
|
}
|
|
3737
3788
|
}
|
|
3738
3789
|
console.log(chalk.yellow("\n Install manually with:"));
|
|
3739
|
-
console.log(chalk.gray(` pip install ${upgrade ? "--upgrade " : ""}${
|
|
3790
|
+
console.log(chalk.gray(` pip install ${upgrade ? "--upgrade " : ""}${specs.join(" ")}
|
|
3740
3791
|
`));
|
|
3741
3792
|
}
|
|
3742
3793
|
function stripExtras(name) {
|
|
@@ -133,8 +133,8 @@ function parseManagedToolchainManifest(value) {
|
|
|
133
133
|
|
|
134
134
|
// src/managed-versions.json
|
|
135
135
|
var managed_versions_default = {
|
|
136
|
-
companion: "9.
|
|
137
|
-
sandbox: "3.
|
|
136
|
+
companion: "9.3.0",
|
|
137
|
+
sandbox: "3.6.0"
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
// src/managed-toolchain.ts
|