@team-agent/installer 0.3.38 → 0.3.39

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/Cargo.lock CHANGED
@@ -566,7 +566,7 @@ dependencies = [
566
566
 
567
567
  [[package]]
568
568
  name = "team-agent"
569
- version = "0.3.38"
569
+ version = "0.3.39"
570
570
  dependencies = [
571
571
  "anyhow",
572
572
  "chrono",
package/Cargo.toml CHANGED
@@ -9,7 +9,7 @@ members = ["crates/team-agent"]
9
9
 
10
10
  [workspace.package]
11
11
  edition = "2021"
12
- version = "0.3.38"
12
+ version = "0.3.39"
13
13
  license = "AGPL-3.0"
14
14
  rust-version = "1.95"
15
15
 
package/npm/install.mjs CHANGED
@@ -157,6 +157,7 @@ function install(argv) {
157
157
  home: os.homedir(),
158
158
  binDir,
159
159
  runtimeBinary,
160
+ log: (line) => console.log(line),
160
161
  });
161
162
  installSkills(runtimeBinary);
162
163
  writeInstallManifest(runtimeRoot, {
@@ -183,9 +184,6 @@ function install(argv) {
183
184
  console.log(`runtime: ${dest}`);
184
185
  console.log(`binary: ${platformBinary.packageName}`);
185
186
  console.log("skill: installed for Codex, Claude and Copilot");
186
- for (const repair of shadowRepairs) {
187
- console.log(`path-shadow: updated ${repair.file} to runtime shim`);
188
- }
189
187
 
190
188
  // 0.3.6 hotfix · C-5 cr verdict — post-install binary smoke 门(走 `--help`
191
189
  // 子命令,因为 0.3.x CLI 现阶段没有 --version)。真跑一次 binary 才能抓住
@@ -329,17 +327,38 @@ export function repairPathShadowingTeamAgentCommands(options = {}) {
329
327
  const home = options.home || os.homedir();
330
328
  const binDir = path.resolve(expandHomeFor(options.binDir || "", home));
331
329
  const runtimeBinary = options.runtimeBinary;
330
+ const log = typeof options.log === "function" ? options.log : null;
332
331
  if (!runtimeBinary) {
333
332
  throw new Error("runtimeBinary is required");
334
333
  }
335
334
  const installedWrapper = path.join(binDir, "team-agent");
336
335
  const repairs = [];
337
- for (const entry of shadowingPathEntries(env.PATH || "", home, binDir)) {
336
+ const candidates = pathShadowRepairCandidates(env.PATH || "", home, binDir);
337
+ log?.(`path-shadow: scanning ${candidates.length} candidate bin dirs before ${binDir}`);
338
+ for (const candidateDir of candidates) {
339
+ const entry = candidateDir.dir;
340
+ const candidate = path.join(entry, "team-agent");
338
341
  if (isVersionManagedPath(entry)) {
342
+ log?.(`path-shadow: skip ${candidate} source=${candidateDir.source} reason=version-managed-path`);
339
343
  continue;
340
344
  }
341
- const candidate = path.join(entry, "team-agent");
342
- if (!isExecutableFile(candidate) || sameFile(candidate, installedWrapper) || sameFile(candidate, runtimeBinary)) {
345
+ if (!fs.existsSync(candidate)) {
346
+ if (candidateDir.source === "home-local-bin") {
347
+ log?.(`path-shadow: checked ${candidate} source=${candidateDir.source} reason=not-found`);
348
+ }
349
+ continue;
350
+ }
351
+ log?.(`path-shadow: found ${candidate} source=${candidateDir.source}`);
352
+ if (!isExecutableFile(candidate)) {
353
+ log?.(`path-shadow: skip ${candidate} source=${candidateDir.source} reason=not-executable-file`);
354
+ continue;
355
+ }
356
+ if (sameFile(candidate, installedWrapper)) {
357
+ log?.(`path-shadow: skip ${candidate} source=${candidateDir.source} reason=installed-wrapper`);
358
+ continue;
359
+ }
360
+ if (sameFile(candidate, runtimeBinary)) {
361
+ log?.(`path-shadow: skip ${candidate} source=${candidateDir.source} reason=runtime-binary`);
343
362
  continue;
344
363
  }
345
364
  try {
@@ -348,7 +367,11 @@ export function repairPathShadowingTeamAgentCommands(options = {}) {
348
367
  const detail = error instanceof Error ? error.message : String(error);
349
368
  throw new Error(`failed to update PATH-shadowing team-agent at ${candidate}: ${detail}`);
350
369
  }
351
- repairs.push({ file: candidate, binDir: entry });
370
+ log?.(`path-shadow: updated ${candidate} source=${candidateDir.source} to runtime shim`);
371
+ repairs.push({ file: candidate, binDir: entry, source: candidateDir.source });
372
+ }
373
+ if (repairs.length === 0) {
374
+ log?.("path-shadow: no stale team-agent command repaired");
352
375
  }
353
376
  return repairs;
354
377
  }
@@ -416,6 +439,28 @@ function shadowingPathEntries(searchPath, home, binDir) {
416
439
  return entries.slice(0, installedIndex);
417
440
  }
418
441
 
442
+ function pathShadowRepairCandidates(searchPath, home, binDir) {
443
+ const candidates = [];
444
+ const seen = new Set();
445
+ const add = (dir, source) => {
446
+ const resolved = path.resolve(expandHomeFor(dir, home));
447
+ if (seen.has(resolved)) {
448
+ return;
449
+ }
450
+ seen.add(resolved);
451
+ candidates.push({ dir: resolved, source });
452
+ };
453
+ for (const entry of shadowingPathEntries(searchPath, home, binDir)) {
454
+ add(entry, "path-before-install");
455
+ }
456
+
457
+ const homeLocalBin = path.join(home, ".local", "bin");
458
+ if (!sameFile(homeLocalBin, binDir)) {
459
+ add(homeLocalBin, "home-local-bin");
460
+ }
461
+ return candidates;
462
+ }
463
+
419
464
  function isExecutableFile(file) {
420
465
  try {
421
466
  fs.accessSync(file, fs.constants.X_OK);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-agent/installer",
3
- "version": "0.3.38",
3
+ "version": "0.3.39",
4
4
  "description": "npx installer for Team Agent",
5
5
  "keywords": [
6
6
  "codex",
@@ -20,9 +20,9 @@
20
20
  "team-agent-installer": "npm/install.mjs"
21
21
  },
22
22
  "optionalDependencies": {
23
- "@team-agent/cli-darwin-arm64": "0.3.38",
24
- "@team-agent/cli-darwin-x64": "0.3.38",
25
- "@team-agent/cli-linux-x64": "0.3.38"
23
+ "@team-agent/cli-darwin-arm64": "0.3.39",
24
+ "@team-agent/cli-darwin-x64": "0.3.39",
25
+ "@team-agent/cli-linux-x64": "0.3.39"
26
26
  },
27
27
  "scripts": {
28
28
  "postinstall": "node npm/bincheck.mjs",