@swmansion/argent 0.34.1-next.36 → 0.34.1-next.38

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/cli-cmds.mjs CHANGED
@@ -36256,7 +36256,7 @@ function isCi(env = process.env) {
36256
36256
  var SESSION_ID2 = randomUUID5();
36257
36257
  function readCliVersion() {
36258
36258
  if (true) {
36259
- return "0.34.1-next.36";
36259
+ return "0.34.1-next.38";
36260
36260
  }
36261
36261
  return "0.0.0";
36262
36262
  }
@@ -10456,14 +10456,14 @@ var require_parser = __commonJS({
10456
10456
  case "scalar":
10457
10457
  case "single-quoted-scalar":
10458
10458
  case "double-quoted-scalar": {
10459
- const fs24 = this.flowScalar(this.type);
10459
+ const fs25 = this.flowScalar(this.type);
10460
10460
  if (atNextItem || it.value) {
10461
- map.items.push({ start, key: fs24, sep: [] });
10461
+ map.items.push({ start, key: fs25, sep: [] });
10462
10462
  this.onKeyLine = true;
10463
10463
  } else if (it.sep) {
10464
- this.stack.push(fs24);
10464
+ this.stack.push(fs25);
10465
10465
  } else {
10466
- Object.assign(it, { key: fs24, sep: [] });
10466
+ Object.assign(it, { key: fs25, sep: [] });
10467
10467
  this.onKeyLine = true;
10468
10468
  }
10469
10469
  return;
@@ -10591,13 +10591,13 @@ var require_parser = __commonJS({
10591
10591
  case "scalar":
10592
10592
  case "single-quoted-scalar":
10593
10593
  case "double-quoted-scalar": {
10594
- const fs24 = this.flowScalar(this.type);
10594
+ const fs25 = this.flowScalar(this.type);
10595
10595
  if (!it || it.value)
10596
- fc.items.push({ start: [], key: fs24, sep: [] });
10596
+ fc.items.push({ start: [], key: fs25, sep: [] });
10597
10597
  else if (it.sep)
10598
- this.stack.push(fs24);
10598
+ this.stack.push(fs25);
10599
10599
  else
10600
- Object.assign(it, { key: fs24, sep: [] });
10600
+ Object.assign(it, { key: fs25, sep: [] });
10601
10601
  return;
10602
10602
  }
10603
10603
  case "flow-map-end":
@@ -16942,7 +16942,7 @@ function isCi(env = process.env) {
16942
16942
  var SESSION_ID = randomUUID4();
16943
16943
  function readCliVersion() {
16944
16944
  if (true) {
16945
- return "0.34.1-next.36";
16945
+ return "0.34.1-next.38";
16946
16946
  }
16947
16947
  return "0.0.0";
16948
16948
  }
@@ -20015,6 +20015,13 @@ function getRemainingGlobalBinaryPath() {
20015
20015
  function isGloballyInstalled() {
20016
20016
  return getRemainingGlobalBinaryPath() !== null;
20017
20017
  }
20018
+ function getUnshadowedGlobalBinaryPath() {
20019
+ const first = getPermanentBinaryPaths()[0];
20020
+ return first !== void 0 && !isProjectBinPath(first) ? getRemainingGlobalBinaryPath() : null;
20021
+ }
20022
+ function isGlobalInstallFirstOnPath() {
20023
+ return getUnshadowedGlobalBinaryPath() !== null;
20024
+ }
20018
20025
  function getGloballyInstalledPackageRoot() {
20019
20026
  const binaryPath = getRemainingGlobalBinaryPath();
20020
20027
  return binaryPath ? globalPackageRootOf(binaryPath) : null;
@@ -20051,6 +20058,26 @@ function packageRootOf(binaryPath) {
20051
20058
  return null;
20052
20059
  }
20053
20060
  }
20061
+ function cliPathOf(packageRoot) {
20062
+ const binSub = argentBinSubpath(packageRoot);
20063
+ if (!binSub) return null;
20064
+ const cli = path15.join(packageRoot, binSub);
20065
+ return fs14.existsSync(cli) ? cli : null;
20066
+ }
20067
+ function getGloballyInstalledLaunchPaths() {
20068
+ if (process.platform === "win32") return null;
20069
+ const binaryPath = getUnshadowedGlobalBinaryPath();
20070
+ if (!binaryPath) return null;
20071
+ const packageRoot = packageRootOf(binaryPath);
20072
+ const cli = packageRoot ? cliPathOf(packageRoot) : null;
20073
+ if (!cli) return null;
20074
+ try {
20075
+ const node = path15.join(fs14.realpathSync(path15.dirname(binaryPath)), "node");
20076
+ return fs14.existsSync(node) ? { node, cli } : null;
20077
+ } catch {
20078
+ return null;
20079
+ }
20080
+ }
20054
20081
  function getGloballyInstalledVersion() {
20055
20082
  const pkgRoot = getGloballyInstalledPackageRoot();
20056
20083
  if (!pkgRoot) return null;
@@ -20893,6 +20920,8 @@ function buildMcpEntry(mode = { kind: "global" }) {
20893
20920
  return { command: "yarn", args: ["argent", "mcp"] };
20894
20921
  case "local-npx":
20895
20922
  return { command: "npx", args: ["--no-install", "argent", "mcp"] };
20923
+ case "global-pinned":
20924
+ return { command: mode.node, args: [mode.cli, "mcp"] };
20896
20925
  default:
20897
20926
  return { command: MCP_BINARY_NAME, args: ["mcp"] };
20898
20927
  }
@@ -20906,8 +20935,15 @@ function resolveLocalCommandMode(root) {
20906
20935
  if (binRelPath) return { kind: "local-node", binRelPath };
20907
20936
  return { kind: "local-npx" };
20908
20937
  }
20909
- function getMcpEntryForScope(installMode, configScope, localCmdMode) {
20910
- return installMode === "local" && configScope === "local" && localCmdMode ? getMcpEntry(localCmdMode) : getMcpEntry({ kind: "global" });
20938
+ function resolveGlobalCommandMode() {
20939
+ const launch = getGloballyInstalledLaunchPaths();
20940
+ return launch ? { kind: "global-pinned", ...launch } : { kind: "global" };
20941
+ }
20942
+ function getMcpEntryForScope(installMode, configScope, localCmdMode, globalCmdMode) {
20943
+ if (installMode === "local" && configScope === "local" && localCmdMode) {
20944
+ return getMcpEntry(localCmdMode);
20945
+ }
20946
+ return getMcpEntry(configScope === "global" ? globalCmdMode : { kind: "global" });
20911
20947
  }
20912
20948
  function hasEnv(entry) {
20913
20949
  return entry.env != null && Object.keys(entry.env).length > 0;
@@ -20952,6 +20988,7 @@ function normalizeServerEntry(raw) {
20952
20988
  }
20953
20989
  function isArgentManagedEntry(entry) {
20954
20990
  if (entry === null || hasCustomizingEnv(entry)) return false;
20991
+ if (isPinnedGlobalEntry(entry)) return true;
20955
20992
  const { command, args } = entry;
20956
20993
  switch (command) {
20957
20994
  case MCP_BINARY_NAME:
@@ -20970,6 +21007,10 @@ function isArgentManagedEntry(entry) {
20970
21007
  return false;
20971
21008
  }
20972
21009
  }
21010
+ function isPinnedGlobalEntry(entry) {
21011
+ const [cli, subcommand] = entry.args;
21012
+ return path19.isAbsolute(entry.command) && path19.basename(entry.command) === "node" && entry.args.length === 2 && subcommand === "mcp" && path19.isAbsolute(cli) && cli.includes(`/node_modules/${PACKAGE_NAME}/`);
21013
+ }
20973
21014
  function writeTomlOrRemove(filePath, data) {
20974
21015
  if (Object.keys(data).length === 0) {
20975
21016
  fs18.rmSync(filePath, { force: true });
@@ -22383,11 +22424,7 @@ function resolveCliEntry(mode, projectRoot) {
22383
22424
  return relative5 ? path21.resolve(projectRoot, relative5) : null;
22384
22425
  }
22385
22426
  const packageRoot = getGloballyInstalledPackageRoot();
22386
- if (!packageRoot) return null;
22387
- const binSub = argentBinSubpath(packageRoot);
22388
- if (!binSub) return null;
22389
- const entry = path21.join(packageRoot, binSub);
22390
- return fs19.existsSync(entry) ? entry : null;
22427
+ return packageRoot ? cliPathOf(packageRoot) : null;
22391
22428
  }
22392
22429
  function writeCliRecord(input) {
22393
22430
  const cli = resolveCliEntry(input.mode, input.projectRoot);
@@ -23308,7 +23345,8 @@ function writeMcpConfigs(args) {
23308
23345
  );
23309
23346
  }
23310
23347
  }
23311
- const entryFor = (configScope) => getMcpEntryForScope(installMode, configScope, localCmdMode);
23348
+ const globalCmdMode = resolveGlobalCommandMode();
23349
+ const entryFor = (configScope) => getMcpEntryForScope(installMode, configScope, localCmdMode, globalCmdMode);
23312
23350
  const stillLocalMode = (root) => readInstallRecord(root)?.mode === "local" || isDeclaredLocally(root);
23313
23351
  const keepsCommittedLocalEntry = (adapter, configPath, root) => {
23314
23352
  if (installMode !== "global") return false;
@@ -23438,7 +23476,7 @@ async function cleanupStaleMcpConfigs(args) {
23438
23476
  } catch {
23439
23477
  continue;
23440
23478
  }
23441
- if (entry === null) continue;
23479
+ if (entry === null || isPinnedGlobalEntry(entry)) continue;
23442
23480
  if (isProvablyDead(entry)) {
23443
23481
  pending.push({
23444
23482
  adapterName: adapter.name,
@@ -23470,7 +23508,7 @@ async function cleanupStaleMcpConfigs(args) {
23470
23508
  } catch {
23471
23509
  continue;
23472
23510
  }
23473
- if (entry !== null && entry.command !== MCP_BINARY_NAME) {
23511
+ if (entry !== null && entry.command !== MCP_BINARY_NAME && !isPinnedGlobalEntry(entry)) {
23474
23512
  warned(
23475
23513
  adapter.name,
23476
23514
  projectPath,
@@ -24133,6 +24171,7 @@ function printBanner() {
24133
24171
  // ../argent-installer/src/update.ts
24134
24172
  var import_picocolors12 = __toESM(require_picocolors(), 1);
24135
24173
  var import_semver5 = __toESM(require_semver2(), 1);
24174
+ import * as fs23 from "node:fs";
24136
24175
  import * as path30 from "node:path";
24137
24176
 
24138
24177
  // ../argent-installer/src/install-targets.ts
@@ -24417,7 +24456,7 @@ import { spawn as spawn5 } from "node:child_process";
24417
24456
  import { once } from "node:events";
24418
24457
  import { createReadStream, createWriteStream } from "node:fs";
24419
24458
  import { open, rm, readdir as readdir3 } from "node:fs/promises";
24420
- import { basename as basename4, dirname as dirname14, join as join24, resolve as resolve16, sep as sep4 } from "node:path";
24459
+ import { basename as basename5, dirname as dirname14, join as join24, resolve as resolve16, sep as sep4 } from "node:path";
24421
24460
  import { Writable } from "node:stream";
24422
24461
  import { pipeline } from "node:stream/promises";
24423
24462
  import zlib2 from "node:zlib";
@@ -24451,7 +24490,7 @@ import {
24451
24490
  } from "node:fs/promises";
24452
24491
  import { constants as fsConstants } from "node:fs";
24453
24492
  import { tmpdir as tmpdir2 } from "node:os";
24454
- import { basename as basename7, dirname as dirname18, extname as extname2, isAbsolute as isAbsolute8, join as join28, normalize as normalize2, resolve as resolve19, sep as sep7 } from "node:path";
24493
+ import { basename as basename8, dirname as dirname18, extname as extname2, isAbsolute as isAbsolute8, join as join28, normalize as normalize2, resolve as resolve19, sep as sep7 } from "node:path";
24455
24494
  import { createHash as createHash5 } from "node:crypto";
24456
24495
  var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
24457
24496
  var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
@@ -24525,6 +24564,9 @@ function resolveUpdatePackageAction(trigger, installed) {
24525
24564
  if (trigger === "mcp_update") return "mcp_update";
24526
24565
  return installed ? "standalone_update" : "standalone_install";
24527
24566
  }
24567
+ function isLivePinnedEntry(entry) {
24568
+ return entry !== null && isPinnedGlobalEntry(entry) && fs23.existsSync(entry.command) && fs23.existsSync(entry.args[0]);
24569
+ }
24528
24570
  async function update(args) {
24529
24571
  const nonInteractive = args.includes("--yes") || args.includes("-y");
24530
24572
  const noTelemetry = args.includes("--no-telemetry");
@@ -24880,8 +24922,10 @@ async function update(args) {
24880
24922
  spinner2.start("Refreshing workspace configuration...");
24881
24923
  const results = [];
24882
24924
  const localCmdMode = installMode === "local" ? resolveLocalCommandMode(projectRoot) : null;
24925
+ const globalCmdMode = resolveGlobalCommandMode();
24926
+ const globalInstallOnPath = isGlobalInstallFirstOnPath();
24883
24927
  const skipEntryRewrite = localCmdMode?.kind === "local-npx";
24884
- const entryFor = (scope) => getMcpEntryForScope(installMode, scope, localCmdMode);
24928
+ const entryFor = (scope) => getMcpEntryForScope(installMode, scope, localCmdMode, globalCmdMode);
24885
24929
  const configuredScopes = findConfiguredAdapterScopes(ALL_ADAPTERS, projectRoot);
24886
24930
  const adaptersByScope = /* @__PURE__ */ new Map([
24887
24931
  ["local", /* @__PURE__ */ new Set()],
@@ -24904,9 +24948,20 @@ async function update(args) {
24904
24948
  );
24905
24949
  continue;
24906
24950
  }
24951
+ const entry = entryFor(normScope);
24952
+ const replacesLivePin = isLivePinnedEntry(existing) && !isPinnedGlobalEntry(entry);
24953
+ if (replacesLivePin && normScope === "local") continue;
24954
+ if (replacesLivePin && !globalInstallOnPath) {
24955
+ results.push(
24956
+ `${import_picocolors12.default.yellow("!")} ${adapter.name} kept its absolute-path entry (no global install found first on PATH) ${import_picocolors12.default.dim(configPath)}`
24957
+ );
24958
+ continue;
24959
+ }
24907
24960
  try {
24908
- adapter.write(configPath, entryFor(normScope));
24909
- results.push(`${import_picocolors12.default.green("+")} ${adapter.name} ${import_picocolors12.default.dim(configPath)}`);
24961
+ adapter.write(configPath, entry);
24962
+ results.push(
24963
+ replacesLivePin ? `${import_picocolors12.default.yellow("!")} ${adapter.name} now runs the bare argent command (the global install on PATH has no node beside it to pin) ${import_picocolors12.default.dim(configPath)}` : `${import_picocolors12.default.green("+")} ${adapter.name} ${import_picocolors12.default.dim(configPath)}`
24964
+ );
24910
24965
  } catch {
24911
24966
  }
24912
24967
  }
@@ -24999,7 +25054,7 @@ async function update(args) {
24999
25054
  // ../argent-installer/src/uninstall.ts
25000
25055
  var import_picocolors13 = __toESM(require_picocolors(), 1);
25001
25056
  var import_yaml5 = __toESM(require_dist2(), 1);
25002
- import * as fs23 from "node:fs";
25057
+ import * as fs24 from "node:fs";
25003
25058
  import * as path31 from "node:path";
25004
25059
  var UNINSTALL_TOOLSERVER_STOP_FAILED = {
25005
25060
  error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
@@ -25021,10 +25076,10 @@ var UNINSTALL_UNCLASSIFIED_FAILED = {
25021
25076
  };
25022
25077
  function removeDirIfEmpty2(dirPath) {
25023
25078
  try {
25024
- if (!fs23.existsSync(dirPath)) return false;
25025
- if (!fs23.statSync(dirPath).isDirectory()) return false;
25026
- if (fs23.readdirSync(dirPath).length > 0) return false;
25027
- fs23.rmdirSync(dirPath);
25079
+ if (!fs24.existsSync(dirPath)) return false;
25080
+ if (!fs24.statSync(dirPath).isDirectory()) return false;
25081
+ if (fs24.readdirSync(dirPath).length > 0) return false;
25082
+ fs24.rmdirSync(dirPath);
25028
25083
  return true;
25029
25084
  } catch {
25030
25085
  return false;
@@ -25034,7 +25089,7 @@ function collectBundledPaths(sourceDir) {
25034
25089
  const files = [];
25035
25090
  const directories = [];
25036
25091
  function walk(currentDir, relativeDir = "") {
25037
- for (const entry of fs23.readdirSync(currentDir, { withFileTypes: true })) {
25092
+ for (const entry of fs24.readdirSync(currentDir, { withFileTypes: true })) {
25038
25093
  const relativePath = relativeDir ? path31.join(relativeDir, entry.name) : entry.name;
25039
25094
  const absolutePath = path31.join(currentDir, entry.name);
25040
25095
  if (entry.isDirectory()) {
@@ -25049,7 +25104,7 @@ function collectBundledPaths(sourceDir) {
25049
25104
  return { files, directories };
25050
25105
  }
25051
25106
  function removeBundledContent(sourceDir, targetDir) {
25052
- if (!fs23.existsSync(sourceDir) || !fs23.existsSync(targetDir)) {
25107
+ if (!fs24.existsSync(sourceDir) || !fs24.existsSync(targetDir)) {
25053
25108
  return { removedPaths: [], removedRoot: false };
25054
25109
  }
25055
25110
  const { files, directories } = collectBundledPaths(sourceDir);
@@ -25057,7 +25112,7 @@ function removeBundledContent(sourceDir, targetDir) {
25057
25112
  for (const relativePath of files) {
25058
25113
  const targetPath = path31.join(targetDir, relativePath);
25059
25114
  try {
25060
- const entry = fs23.lstatSync(targetPath, { throwIfNoEntry: false });
25115
+ const entry = fs24.lstatSync(targetPath, { throwIfNoEntry: false });
25061
25116
  if (!entry || entry.isDirectory()) continue;
25062
25117
  removePath(targetPath);
25063
25118
  removedPaths.push(relativePath);
@@ -25070,18 +25125,18 @@ function removeBundledContent(sourceDir, targetDir) {
25070
25125
  for (const relativePath of directories) {
25071
25126
  const targetPath = path31.join(targetDir, relativePath);
25072
25127
  try {
25073
- if (!fs23.existsSync(targetPath)) continue;
25074
- if (!fs23.statSync(targetPath).isDirectory()) continue;
25075
- if (fs23.readdirSync(targetPath).length > 0) continue;
25076
- fs23.rmdirSync(targetPath);
25128
+ if (!fs24.existsSync(targetPath)) continue;
25129
+ if (!fs24.statSync(targetPath).isDirectory()) continue;
25130
+ if (fs24.readdirSync(targetPath).length > 0) continue;
25131
+ fs24.rmdirSync(targetPath);
25077
25132
  } catch {
25078
25133
  }
25079
25134
  }
25080
25135
  let removedRoot = false;
25081
25136
  try {
25082
- if (fs23.existsSync(targetDir) && fs23.statSync(targetDir).isDirectory()) {
25083
- if (fs23.readdirSync(targetDir).length === 0) {
25084
- fs23.rmdirSync(targetDir);
25137
+ if (fs24.existsSync(targetDir) && fs24.statSync(targetDir).isDirectory()) {
25138
+ if (fs24.readdirSync(targetDir).length === 0) {
25139
+ fs24.rmdirSync(targetDir);
25085
25140
  removedRoot = true;
25086
25141
  }
25087
25142
  }
@@ -25094,7 +25149,7 @@ function removeBundledContent(sourceDir, targetDir) {
25094
25149
  }
25095
25150
  function readBundledSkillName(skillFilePath, fallbackName) {
25096
25151
  try {
25097
- const content = fs23.readFileSync(skillFilePath, "utf8");
25152
+ const content = fs24.readFileSync(skillFilePath, "utf8");
25098
25153
  const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
25099
25154
  if (!frontmatter) return fallbackName;
25100
25155
  const data = (0, import_yaml5.parse)(frontmatter);
@@ -25105,18 +25160,18 @@ function readBundledSkillName(skillFilePath, fallbackName) {
25105
25160
  }
25106
25161
  }
25107
25162
  function getBundledSkillNames(skillsDir) {
25108
- if (!fs23.existsSync(skillsDir)) return [];
25163
+ if (!fs24.existsSync(skillsDir)) return [];
25109
25164
  const skillNames = [];
25110
- for (const entry of fs23.readdirSync(skillsDir, { withFileTypes: true })) {
25165
+ for (const entry of fs24.readdirSync(skillsDir, { withFileTypes: true })) {
25111
25166
  if (!entry.isDirectory()) continue;
25112
25167
  const skillFilePath = path31.join(skillsDir, entry.name, "SKILL.md");
25113
- if (!fs23.existsSync(skillFilePath)) continue;
25168
+ if (!fs24.existsSync(skillFilePath)) continue;
25114
25169
  skillNames.push(readBundledSkillName(skillFilePath, entry.name));
25115
25170
  }
25116
25171
  return [...new Set(skillNames)].sort();
25117
25172
  }
25118
25173
  function removeBundledSkillInstalls(skillNames, targetDir) {
25119
- if (!fs23.existsSync(targetDir)) {
25174
+ if (!fs24.existsSync(targetDir)) {
25120
25175
  return { removedPaths: [], removedRoot: false };
25121
25176
  }
25122
25177
  const removedPaths = [];
@@ -25134,12 +25189,12 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
25134
25189
  return { removedPaths, removedRoot };
25135
25190
  }
25136
25191
  function cleanupSkillsLockFile(lockPath, skillNames) {
25137
- if (!fs23.existsSync(lockPath)) {
25192
+ if (!fs24.existsSync(lockPath)) {
25138
25193
  return { removedSkills: [], removedFile: false };
25139
25194
  }
25140
25195
  let parsed;
25141
25196
  try {
25142
- parsed = JSON.parse(fs23.readFileSync(lockPath, "utf8"));
25197
+ parsed = JSON.parse(fs24.readFileSync(lockPath, "utf8"));
25143
25198
  } catch {
25144
25199
  return { removedSkills: [], removedFile: false };
25145
25200
  }
@@ -25166,10 +25221,10 @@ function cleanupSkillsLockFile(lockPath, skillNames) {
25166
25221
  parsed.skills && typeof parsed.skills === "object" && Object.keys(parsed.skills).length > 0
25167
25222
  );
25168
25223
  if (!hasSkills && otherKeys.length === 0) {
25169
- fs23.rmSync(lockPath, { force: true });
25224
+ fs24.rmSync(lockPath, { force: true });
25170
25225
  return { removedSkills, removedFile: true };
25171
25226
  }
25172
- fs23.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
25227
+ fs24.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
25173
25228
  return { removedSkills, removedFile: false };
25174
25229
  }
25175
25230
  function cleanupBundledSkills(skillNames, targets) {
@@ -25491,7 +25546,7 @@ async function uninstall(args) {
25491
25546
  try {
25492
25547
  execShellCommandSync(removable.cmd, { cwd: removable.cwd, env: removable.env });
25493
25548
  const leftover = removable.kind === "global" ? getRemainingGlobalBinaryPath() : null;
25494
- const removed = !leftover || removable.installDir !== null && !fs23.existsSync(removable.installDir);
25549
+ const removed = !leftover || removable.installDir !== null && !fs24.existsSync(removable.installDir);
25495
25550
  if (removed) hasUninstalledPackage = true;
25496
25551
  if (removed && removeCliRecordFor(removable.installDir)) {
25497
25552
  log.info(import_picocolors13.default.dim("Removed ~/.argent/cli.json (provider CLI discovery record)."));