@tasksai/install 0.1.6 → 0.1.8
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/package.json +1 -2
- package/src/index.js +23 -16
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import readline from "node:readline/promises";
|
|
|
9
9
|
import { spawnSync } from "node:child_process";
|
|
10
10
|
import { stdin as input, stdout as output } from "node:process";
|
|
11
11
|
|
|
12
|
-
const INSTALLER_VERSION = "0.1.
|
|
12
|
+
const INSTALLER_VERSION = "0.1.8";
|
|
13
13
|
const DEFAULT_SOURCES = {
|
|
14
14
|
lawtasksai: "https://github.com/laudoluxDev/lawtasksai-mcp",
|
|
15
15
|
farmer: "https://github.com/laudoluxDev/farmertasksai-mcp",
|
|
@@ -477,19 +477,23 @@ function formatPermissionRecovery({ operation, failures, options, vertical, sour
|
|
|
477
477
|
}
|
|
478
478
|
|
|
479
479
|
function buildInstallCommand({ options, source }) {
|
|
480
|
-
const
|
|
480
|
+
const cliParts = ["tasksai-install", options.productId];
|
|
481
481
|
const sourceUrl = source?.repoUrl || options.source;
|
|
482
|
-
if (sourceUrl)
|
|
483
|
-
if (options.client)
|
|
484
|
-
if (options.installDir)
|
|
485
|
-
return
|
|
482
|
+
if (sourceUrl) cliParts.push("--source", sourceUrl);
|
|
483
|
+
if (options.client) cliParts.push("--client", options.client);
|
|
484
|
+
if (options.installDir) cliParts.push("--install-dir", resolveUserPath(options.installDir));
|
|
485
|
+
return buildNpmCallCommand(cliParts);
|
|
486
486
|
}
|
|
487
487
|
|
|
488
488
|
function buildDoctorCommand(options) {
|
|
489
|
-
const
|
|
490
|
-
if (options.client)
|
|
491
|
-
if (options.installDir)
|
|
492
|
-
return
|
|
489
|
+
const cliParts = ["tasksai-install", options.productId, "doctor"];
|
|
490
|
+
if (options.client) cliParts.push("--client", options.client);
|
|
491
|
+
if (options.installDir) cliParts.push("--install-dir", resolveUserPath(options.installDir));
|
|
492
|
+
return buildNpmCallCommand(cliParts);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
function buildNpmCallCommand(cliParts) {
|
|
496
|
+
return ["npm", "exec", "--package=@tasksai/install", "--call", cliParts.map(shellToken).join(" ")].map(shellToken).join(" ");
|
|
493
497
|
}
|
|
494
498
|
|
|
495
499
|
function shellToken(value) {
|
|
@@ -663,15 +667,18 @@ function verifySource({ options, source, manifest, vertical }) {
|
|
|
663
667
|
if (!manifest.official_domain || !vertical.website_url?.includes(manifest.official_domain)) {
|
|
664
668
|
throw new Error("Manifest official domain does not match vertical website URL.");
|
|
665
669
|
}
|
|
666
|
-
const
|
|
667
|
-
const command =
|
|
668
|
-
const args =
|
|
669
|
-
|
|
670
|
-
|
|
670
|
+
const installer = getInstaller(manifest);
|
|
671
|
+
const command = installer?.command;
|
|
672
|
+
const args = installer?.args || [];
|
|
673
|
+
const isLegacyNpx = command === "npx" && Array.isArray(args) && args[0] === "@tasksai/install";
|
|
674
|
+
const isNpmExec = command === "npm" && Array.isArray(args) && args.includes("--package=@tasksai/install") && (args.includes("tasksai-install") || args.includes("--call"));
|
|
675
|
+
if (!isLegacyNpx && !isNpmExec) {
|
|
676
|
+
throw new Error("Manifest installer command is not an approved @tasksai/install command.");
|
|
671
677
|
}
|
|
672
678
|
}
|
|
673
679
|
|
|
674
|
-
function
|
|
680
|
+
function getInstaller(manifest) {
|
|
681
|
+
if (manifest.installer?.npm_exec) return manifest.installer.npm_exec;
|
|
675
682
|
if (manifest.installer?.npx) return manifest.installer.npx;
|
|
676
683
|
return manifest.installer;
|
|
677
684
|
}
|