@tasksai/install 0.1.18 → 0.1.20

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +22 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tasksai/install",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "Shared TasksAI MCP installer CLI",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -85,13 +85,23 @@ const CLIENTS = {
85
85
  }
86
86
  };
87
87
 
88
- if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
88
+ if (isMainModule()) {
89
89
  main().catch((error) => {
90
90
  console.error(formatError(error));
91
91
  process.exit(1);
92
92
  });
93
93
  }
94
94
 
95
+ function isMainModule() {
96
+ if (!process.argv[1]) return false;
97
+ const modulePath = fileURLToPath(import.meta.url);
98
+ try {
99
+ return fs.realpathSync(process.argv[1]) === fs.realpathSync(modulePath);
100
+ } catch {
101
+ return path.resolve(process.argv[1]) === modulePath;
102
+ }
103
+ }
104
+
95
105
  async function main() {
96
106
  const options = parseArgs(process.argv.slice(2));
97
107
 
@@ -305,11 +315,11 @@ async function doctor(options, {
305
315
  }
306
316
 
307
317
  const productId = String(vertical.product_id || options.productId || "").trim().toLowerCase();
308
- if (productId !== String(options.productId || "").trim().toLowerCase()) {
318
+ if (!sameProductId(productId, options.productId)) {
309
319
  problems.push(`Installed product ${vertical.product_id} does not match requested product ${options.productId}`);
310
320
  }
311
321
  const configuredProductId = firstValue(process.env.TASKSAI_PRODUCT_ID, env.TASKSAI_PRODUCT_ID);
312
- if (configuredProductId && configuredProductId.trim().toLowerCase() !== productId) {
322
+ if (configuredProductId && !sameProductId(configuredProductId, productId)) {
313
323
  problems.push(`Runtime product ${configuredProductId} does not match installed product ${productId}`);
314
324
  }
315
325
 
@@ -357,7 +367,7 @@ async function doctor(options, {
357
367
  const licensedProduct = String(account?.product_id || account?.product?.product_id || "").trim().toLowerCase();
358
368
  if (!licensedProduct) {
359
369
  problems.push("License health response did not identify a product");
360
- } else if (licensedProduct !== productId) {
370
+ } else if (!sameProductId(licensedProduct, productId)) {
361
371
  problems.push(`License is for ${licensedProduct}, not ${productId}`);
362
372
  }
363
373
  } catch (error) {
@@ -925,6 +935,14 @@ function sameRepository(left, right) {
925
935
  === String(right || "").replace(/\.git$/i, "").replace(/\/$/, "").toLowerCase();
926
936
  }
927
937
 
938
+ function sameProductId(left, right) {
939
+ const normalize = (value) => {
940
+ const productId = String(value || "").trim().toLowerCase();
941
+ return productId === "lawtasksai" ? "law" : productId;
942
+ };
943
+ return normalize(left) === normalize(right);
944
+ }
945
+
928
946
  function getInstaller(manifest) {
929
947
  if (manifest.installer?.npm_exec) return manifest.installer.npm_exec;
930
948
  if (manifest.installer?.npx) return manifest.installer.npx;