create-snipara 1.3.0 → 1.3.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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +51 -23
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -193,7 +193,7 @@ npx create-snipara print-config --json
193
193
  When testing a locally packed tarball, use `npm exec --package` instead of `npx`, for example:
194
194
 
195
195
  ```bash
196
- npm exec --package ./create-snipara-1.3.0.tgz create-snipara -- --help
196
+ npm exec --package ./create-snipara-1.3.1.tgz create-snipara -- --help
197
197
  ```
198
198
 
199
199
  This avoids `npx` resolution issues with unpublished tarballs.
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import fs from "fs";
9
9
  import path from "path";
10
10
  import { execSync, spawn } from "child_process";
11
11
  import { homedir } from "os";
12
- var VERSION = "1.3.0";
12
+ var VERSION = "1.3.1";
13
13
  var BASE_URL = "https://www.snipara.com";
14
14
  var API_URL = "https://api.snipara.com";
15
15
  var COMPANION_PACKAGE_NAME = "snipara-companion";
@@ -507,17 +507,28 @@ async function installPythonPackages(answers, upgrade) {
507
507
  function stripExtras(name) {
508
508
  return name.replace(/\[.*\]$/, "");
509
509
  }
510
- function detectNodePackageManager() {
511
- if (commandExists("pnpm")) return "pnpm";
512
- if (commandExists("npm")) return "npm";
513
- return null;
510
+ function detectNodePackageManagers() {
511
+ const managers = [];
512
+ if (commandExists("pnpm")) {
513
+ managers.push("pnpm");
514
+ }
515
+ if (commandExists("npm")) {
516
+ managers.push("npm");
517
+ }
518
+ return managers;
519
+ }
520
+ function getCompanionInstallCommand(packageManager, upgrade) {
521
+ if (packageManager === "pnpm") {
522
+ return `pnpm add -g ${upgrade ? "--latest " : ""}${COMPANION_PACKAGE_NAME}`;
523
+ }
524
+ return `npm install -g ${upgrade ? COMPANION_PACKAGE_NAME + "@latest" : COMPANION_PACKAGE_NAME}`;
514
525
  }
515
526
  async function installNodeCompanion(upgrade) {
516
527
  console.log(chalk.bold(`
517
528
  \u{1F9F0} ${upgrade ? "Upgrading" : "Installing"} Local Companion CLI
518
529
  `));
519
- const packageManager = detectNodePackageManager();
520
- if (!packageManager) {
530
+ const packageManagers = detectNodePackageManagers();
531
+ if (packageManagers.length === 0) {
521
532
  console.log(chalk.yellow(" \u26A0\uFE0F npm/pnpm not found. Please install manually:\n"));
522
533
  console.log(chalk.gray(` npm install -g ${COMPANION_PACKAGE_NAME}
523
534
  `));
@@ -526,23 +537,40 @@ async function installNodeCompanion(upgrade) {
526
537
  const spinner = ora(
527
538
  `${upgrade ? "Upgrading" : "Installing"} ${COMPANION_PACKAGE_NAME}...`
528
539
  ).start();
529
- try {
530
- const installCmd = packageManager === "pnpm" ? `pnpm add -g ${upgrade ? "--latest " : ""}${COMPANION_PACKAGE_NAME}` : `npm install -g ${upgrade ? COMPANION_PACKAGE_NAME + "@latest" : COMPANION_PACKAGE_NAME}`;
531
- execSync(installCmd, {
532
- stdio: "pipe",
533
- encoding: "utf-8"
534
- });
535
- spinner.succeed(`${upgrade ? "Upgraded" : "Installed"} ${COMPANION_PACKAGE_NAME}`);
536
- } catch {
537
- spinner.fail(`Failed to ${upgrade ? "upgrade" : "install"} ${COMPANION_PACKAGE_NAME}`);
538
- console.log(chalk.yellow("\n Install manually with:"));
539
- console.log(
540
- chalk.gray(
541
- ` npm install -g ${upgrade ? COMPANION_PACKAGE_NAME + "@latest" : COMPANION_PACKAGE_NAME}
542
- `
543
- )
544
- );
540
+ const failures = [];
541
+ for (const packageManager of packageManagers) {
542
+ const installCmd = getCompanionInstallCommand(packageManager, upgrade);
543
+ try {
544
+ execSync(installCmd, {
545
+ stdio: "pipe",
546
+ encoding: "utf-8"
547
+ });
548
+ if (commandExists("rlm-hook")) {
549
+ spinner.succeed(
550
+ `${upgrade ? "Upgraded" : "Installed"} ${COMPANION_PACKAGE_NAME} via ${packageManager}`
551
+ );
552
+ return;
553
+ }
554
+ failures.push(
555
+ `${packageManager}: command completed but rlm-hook is still not available on PATH`
556
+ );
557
+ } catch (error) {
558
+ const detail = error instanceof Error && "message" in error ? error.message.split("\n")[0] : "unknown error";
559
+ failures.push(`${packageManager}: ${detail}`);
560
+ }
561
+ }
562
+ spinner.fail(`Failed to ${upgrade ? "upgrade" : "install"} ${COMPANION_PACKAGE_NAME}`);
563
+ console.log(chalk.yellow("\n Attempt summary:"));
564
+ for (const failure of failures) {
565
+ console.log(chalk.gray(` - ${failure}`));
545
566
  }
567
+ console.log(chalk.yellow("\n Install manually with:"));
568
+ console.log(
569
+ chalk.gray(
570
+ ` npm install -g ${upgrade ? COMPANION_PACKAGE_NAME + "@latest" : COMPANION_PACKAGE_NAME}
571
+ `
572
+ )
573
+ );
546
574
  }
547
575
  async function createMcpConfig(answers) {
548
576
  console.log(chalk.bold("\n\u2699\uFE0F Creating Configuration\n"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-snipara",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Initialize Snipara MCP + RLM-Runtime with a single command - context optimization, semantic memory, and safe code execution",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",