claude-yes 1.74.0 → 1.75.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.
@@ -0,0 +1,11 @@
1
+ import { t as CLIS_CONFIG } from "./ts-DfT_yx7e.js";
2
+ import "./logger-B9h0djqx.js";
3
+ import "./pidStore-CYmzzaQQ.js";
4
+ import "./globalPidIndex-BHCkWll6.js";
5
+
6
+ //#region ts/SUPPORTED_CLIS.ts
7
+ const SUPPORTED_CLIS = Object.keys(CLIS_CONFIG);
8
+
9
+ //#endregion
10
+ export { SUPPORTED_CLIS };
11
+ //# sourceMappingURL=SUPPORTED_CLIS-CqAT1Zud.js.map
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  import { n as logger } from "./logger-B9h0djqx.js";
3
- import { n as version, t as name } from "./package-Bn0B_jWZ.js";
3
+ import { n as version, t as name } from "./package-DRIilF5m.js";
4
4
  import { argv } from "process";
5
5
  import { execFileSync, spawn } from "child_process";
6
6
  import ms from "ms";
@@ -635,7 +635,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
635
635
  }
636
636
  }
637
637
  {
638
- const { isSubcommand, runSubcommand } = await import("./subcommands-CR1i1sjy.js");
638
+ const { isSubcommand, runSubcommand } = await import("./subcommands-NWIZy8od.js");
639
639
  if (isSubcommand(process.argv[2])) {
640
640
  const code = await runSubcommand(process.argv);
641
641
  process.exit(code ?? 0);
@@ -664,7 +664,7 @@ if (config.useRust) {
664
664
  }
665
665
  }
666
666
  if (rustBinary) {
667
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-BCn8YIi2.js");
667
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-CqAT1Zud.js");
668
668
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
669
669
  if (config.verbose) {
670
670
  console.log(`[rust] Using binary: ${rustBinary}`);
@@ -694,7 +694,7 @@ if (config.showVersion) {
694
694
  process.exit(0);
695
695
  }
696
696
  if (config.appendPrompt) {
697
- const { PidStore } = await import("./pidStore-DR1yPY3t.js");
697
+ const { PidStore } = await import("./pidStore-CF54dFqr.js");
698
698
  const ipcPath = await PidStore.findActiveFifo(process.cwd());
699
699
  if (!ipcPath) {
700
700
  console.error("No active agent with IPC found in current directory.");
@@ -5,17 +5,28 @@ import path from "path";
5
5
  import { lock } from "proper-lockfile";
6
6
 
7
7
  //#region ts/globalPidIndex.ts
8
- const GLOBAL_DIR = path.join(homedir(), ".agent-yes");
9
- const GLOBAL_FILE = path.join(GLOBAL_DIR, "pids.jsonl");
8
+ /**
9
+ * Resolved at call time (not module load time) so tests and other callers
10
+ * can override via $AGENT_YES_HOME without juggling module-cache resets.
11
+ * Falls back to `~/.agent-yes` for normal user runs.
12
+ */
13
+ function resolveGlobalDir() {
14
+ return process.env.AGENT_YES_HOME ?? path.join(homedir(), ".agent-yes");
15
+ }
16
+ function resolveGlobalFile() {
17
+ return path.join(resolveGlobalDir(), "pids.jsonl");
18
+ }
10
19
  async function ensureDir() {
11
- await mkdir(GLOBAL_DIR, { recursive: true });
20
+ await mkdir(resolveGlobalDir(), { recursive: true });
12
21
  }
13
22
  async function withLock(fn) {
14
23
  await ensureDir();
24
+ const file = resolveGlobalFile();
25
+ const dir = resolveGlobalDir();
15
26
  let release;
16
27
  try {
17
- release = await lock(GLOBAL_DIR, {
18
- lockfilePath: GLOBAL_FILE + ".lock",
28
+ release = await lock(dir, {
29
+ lockfilePath: file + ".lock",
19
30
  retries: {
20
31
  retries: 5,
21
32
  minTimeout: 50,
@@ -31,7 +42,7 @@ async function withLock(fn) {
31
42
  async function appendGlobalPid(record) {
32
43
  try {
33
44
  await withLock(async () => {
34
- await appendFile(GLOBAL_FILE, JSON.stringify(record) + "\n");
45
+ await appendFile(resolveGlobalFile(), JSON.stringify(record) + "\n");
35
46
  });
36
47
  } catch (error) {
37
48
  logger.debug("[globalPidIndex] append failed:", error);
@@ -47,7 +58,7 @@ async function updateGlobalPidStatus(pid, patch) {
47
58
  ...existing,
48
59
  ...patch
49
60
  };
50
- await appendFile(GLOBAL_FILE, JSON.stringify(merged) + "\n");
61
+ await appendFile(resolveGlobalFile(), JSON.stringify(merged) + "\n");
51
62
  });
52
63
  } catch (error) {
53
64
  logger.debug("[globalPidIndex] updateStatus failed:", error);
@@ -59,7 +70,7 @@ async function updateGlobalPidStatus(pid, patch) {
59
70
  async function readGlobalPidsRaw() {
60
71
  let raw;
61
72
  try {
62
- raw = await readFile(GLOBAL_FILE, "utf-8");
73
+ raw = await readFile(resolveGlobalFile(), "utf-8");
63
74
  } catch (err) {
64
75
  if (err.code === "ENOENT") return [];
65
76
  throw err;
@@ -100,4 +111,4 @@ function isProcessAlive(pid) {
100
111
 
101
112
  //#endregion
102
113
  export { readGlobalPids as n, updateGlobalPidStatus as r, appendGlobalPid as t };
103
- //# sourceMappingURL=globalPidIndex-DNEh8a_O.js.map
114
+ //# sourceMappingURL=globalPidIndex-BHCkWll6.js.map
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-C8vuG5y-.js";
1
+ import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-DfT_yx7e.js";
2
2
  import "./logger-B9h0djqx.js";
3
- import "./pidStore-CHLHMBEM.js";
4
- import "./globalPidIndex-DNEh8a_O.js";
3
+ import "./pidStore-CYmzzaQQ.js";
4
+ import "./globalPidIndex-BHCkWll6.js";
5
5
 
6
6
  export { AgentContext, CLIS_CONFIG, config, agentYes as default, removeControlCharacters };
@@ -1,7 +1,7 @@
1
1
  //#region package.json
2
2
  var name = "agent-yes";
3
- var version = "1.73.2";
3
+ var version = "1.75.0";
4
4
 
5
5
  //#endregion
6
6
  export { version as n, name as t };
7
- //# sourceMappingURL=package-Bn0B_jWZ.js.map
7
+ //# sourceMappingURL=package-DRIilF5m.js.map
@@ -0,0 +1,5 @@
1
+ import "./logger-B9h0djqx.js";
2
+ import { t as PidStore } from "./pidStore-CYmzzaQQ.js";
3
+ import "./globalPidIndex-BHCkWll6.js";
4
+
5
+ export { PidStore };
@@ -1,5 +1,5 @@
1
1
  import { n as logger } from "./logger-B9h0djqx.js";
2
- import { r as updateGlobalPidStatus, t as appendGlobalPid } from "./globalPidIndex-DNEh8a_O.js";
2
+ import { r as updateGlobalPidStatus, t as appendGlobalPid } from "./globalPidIndex-BHCkWll6.js";
3
3
  import { closeSync, existsSync, fsyncSync, openSync } from "fs";
4
4
  import { appendFile, mkdir, readFile, rename, writeFile } from "fs/promises";
5
5
  import path from "path";
@@ -337,4 +337,4 @@ pid-db/
337
337
 
338
338
  //#endregion
339
339
  export { PidStore as t };
340
- //# sourceMappingURL=pidStore-CHLHMBEM.js.map
340
+ //# sourceMappingURL=pidStore-CYmzzaQQ.js.map
@@ -1,5 +1,5 @@
1
1
  import "./logger-B9h0djqx.js";
2
- import { n as readGlobalPids } from "./globalPidIndex-DNEh8a_O.js";
2
+ import { n as readGlobalPids } from "./globalPidIndex-BHCkWll6.js";
3
3
  import { readFile, stat } from "fs/promises";
4
4
  import { homedir } from "os";
5
5
  import path from "path";
@@ -202,21 +202,25 @@ async function cmdLs(rest) {
202
202
  process.stderr.write(keyword ? `no running agents matched "${keyword}"\n` : "no running agents\n");
203
203
  return 0;
204
204
  }
205
+ const termWidth = process.stdout.columns ?? 120;
206
+ const rawCwds = records.map((r) => shortenPath(r.cwd));
207
+ const widths = {
208
+ pid: Math.max(3, ...records.map((r) => String(r.pid).length)),
209
+ cli: Math.max(3, ...records.map((r) => r.cli.length)),
210
+ status: Math.max(6, ...records.map((r) => r.status.length)),
211
+ age: Math.max(3, ...records.map((r) => humanizeAge(Date.now() - r.started_at).length)),
212
+ cwd: Math.max(3, ...rawCwds.map((c) => c.length))
213
+ };
214
+ const fixedWidth = widths.pid + widths.cli + widths.status + widths.age + widths.cwd + 10;
215
+ const promptBudget = Math.max(20, termWidth - fixedWidth - 1);
205
216
  const rows = records.map((r) => ({
206
217
  pid: String(r.pid),
207
218
  cli: r.cli,
208
219
  status: r.status,
209
220
  age: humanizeAge(Date.now() - r.started_at),
210
221
  cwd: shortenPath(r.cwd),
211
- prompt: truncate(r.prompt ?? "", 60)
222
+ prompt: truncate(r.prompt ?? "", promptBudget)
212
223
  }));
213
- const widths = {
214
- pid: Math.max(3, ...rows.map((r) => r.pid.length)),
215
- cli: Math.max(3, ...rows.map((r) => r.cli.length)),
216
- status: Math.max(6, ...rows.map((r) => r.status.length)),
217
- age: Math.max(3, ...rows.map((r) => r.age.length)),
218
- cwd: Math.max(3, ...rows.map((r) => r.cwd.length))
219
- };
220
224
  const header = [
221
225
  "PID".padEnd(widths.pid),
222
226
  "CLI".padEnd(widths.cli),
@@ -384,4 +388,4 @@ async function writeToIpc(ipcPath, payload) {
384
388
 
385
389
  //#endregion
386
390
  export { isSubcommand, runSubcommand };
387
- //# sourceMappingURL=subcommands-CR1i1sjy.js.map
391
+ //# sourceMappingURL=subcommands-NWIZy8od.js.map
@@ -1,7 +1,7 @@
1
1
  import { n as logger, t as addTransport } from "./logger-B9h0djqx.js";
2
- import { n as version } from "./package-Bn0B_jWZ.js";
2
+ import { n as version } from "./package-DRIilF5m.js";
3
3
  import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-DQWJSptq.js";
4
- import { t as PidStore } from "./pidStore-CHLHMBEM.js";
4
+ import { t as PidStore } from "./pidStore-CYmzzaQQ.js";
5
5
  import { arch, platform } from "process";
6
6
  import { execSync } from "child_process";
7
7
  import { closeSync, constants, createReadStream, existsSync, mkdirSync, openSync } from "fs";
@@ -1679,4 +1679,4 @@ function sleep(ms) {
1679
1679
 
1680
1680
  //#endregion
1681
1681
  export { removeControlCharacters as a, AgentContext as i, agentYes as n, config as r, CLIS_CONFIG as t };
1682
- //# sourceMappingURL=ts-C8vuG5y-.js.map
1682
+ //# sourceMappingURL=ts-DfT_yx7e.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-yes",
3
- "version": "1.74.0",
3
+ "version": "1.75.1",
4
4
  "description": "A wrapper tool that automates interactions with various AI CLI tools by automatically handling common prompts and responses.",
5
5
  "keywords": [
6
6
  "ai",
@@ -38,23 +38,35 @@ export interface GlobalPidRecord {
38
38
  started_at: number;
39
39
  }
40
40
 
41
- const GLOBAL_DIR = path.join(homedir(), ".agent-yes");
42
- const GLOBAL_FILE = path.join(GLOBAL_DIR, "pids.jsonl");
41
+ /**
42
+ * Resolved at call time (not module load time) so tests and other callers
43
+ * can override via $AGENT_YES_HOME without juggling module-cache resets.
44
+ * Falls back to `~/.agent-yes` for normal user runs.
45
+ */
46
+ function resolveGlobalDir(): string {
47
+ return process.env.AGENT_YES_HOME ?? path.join(homedir(), ".agent-yes");
48
+ }
49
+
50
+ function resolveGlobalFile(): string {
51
+ return path.join(resolveGlobalDir(), "pids.jsonl");
52
+ }
43
53
 
44
54
  export function getGlobalPidIndexPath(): string {
45
- return GLOBAL_FILE;
55
+ return resolveGlobalFile();
46
56
  }
47
57
 
48
58
  async function ensureDir() {
49
- await mkdir(GLOBAL_DIR, { recursive: true });
59
+ await mkdir(resolveGlobalDir(), { recursive: true });
50
60
  }
51
61
 
52
62
  async function withLock<R>(fn: () => Promise<R>): Promise<R> {
53
63
  await ensureDir();
64
+ const file = resolveGlobalFile();
65
+ const dir = resolveGlobalDir();
54
66
  let release: (() => Promise<void>) | undefined;
55
67
  try {
56
- release = await lock(GLOBAL_DIR, {
57
- lockfilePath: GLOBAL_FILE + ".lock",
68
+ release = await lock(dir, {
69
+ lockfilePath: file + ".lock",
58
70
  retries: { retries: 5, minTimeout: 50, maxTimeout: 500 },
59
71
  });
60
72
  return await fn();
@@ -67,7 +79,7 @@ async function withLock<R>(fn: () => Promise<R>): Promise<R> {
67
79
  export async function appendGlobalPid(record: GlobalPidRecord): Promise<void> {
68
80
  try {
69
81
  await withLock(async () => {
70
- await appendFile(GLOBAL_FILE, JSON.stringify(record) + "\n");
82
+ await appendFile(resolveGlobalFile(), JSON.stringify(record) + "\n");
71
83
  });
72
84
  } catch (error) {
73
85
  logger.debug("[globalPidIndex] append failed:", error);
@@ -85,7 +97,7 @@ export async function updateGlobalPidStatus(
85
97
  const existing = current.find((r) => r.pid === pid);
86
98
  if (!existing) return; // unknown pid — nothing to update
87
99
  const merged: GlobalPidRecord = { ...existing, ...patch };
88
- await appendFile(GLOBAL_FILE, JSON.stringify(merged) + "\n");
100
+ await appendFile(resolveGlobalFile(), JSON.stringify(merged) + "\n");
89
101
  });
90
102
  } catch (error) {
91
103
  logger.debug("[globalPidIndex] updateStatus failed:", error);
@@ -98,7 +110,7 @@ export async function updateGlobalPidStatus(
98
110
  async function readGlobalPidsRaw(): Promise<GlobalPidRecord[]> {
99
111
  let raw: string;
100
112
  try {
101
- raw = await readFile(GLOBAL_FILE, "utf-8");
113
+ raw = await readFile(resolveGlobalFile(), "utf-8");
102
114
  } catch (err: any) {
103
115
  if (err.code === "ENOENT") return [];
104
116
  throw err;
@@ -10,6 +10,11 @@ const TEST_DIR = isWindows
10
10
 
11
11
  describe("PidStore", () => {
12
12
  let store: PidStore;
13
+ // Isolate the cross-runtime global pid index too — without this, the
14
+ // synthetic pid=12345 records leak into the user's real
15
+ // ~/.agent-yes/pids.jsonl via the mirror writer wired into PidStore.
16
+ const GLOBAL_TEST_DIR = path.join(TEST_DIR, "global");
17
+ let originalAgentYesHome: string | undefined;
13
18
 
14
19
  beforeEach(async () => {
15
20
  try {
@@ -17,12 +22,19 @@ describe("PidStore", () => {
17
22
  } catch {
18
23
  // ignore cleanup failures (e.g. Windows lock files from previous test)
19
24
  }
25
+ originalAgentYesHome = process.env.AGENT_YES_HOME;
26
+ process.env.AGENT_YES_HOME = GLOBAL_TEST_DIR;
20
27
  store = new PidStore(TEST_DIR);
21
28
  await store.init();
22
29
  });
23
30
 
24
31
  afterEach(async () => {
25
32
  await store.close();
33
+ if (originalAgentYesHome === undefined) {
34
+ delete process.env.AGENT_YES_HOME;
35
+ } else {
36
+ process.env.AGENT_YES_HOME = originalAgentYesHome;
37
+ }
26
38
  try {
27
39
  await rm(TEST_DIR, { recursive: true, force: true });
28
40
  } catch {
package/ts/subcommands.ts CHANGED
@@ -272,23 +272,31 @@ async function cmdLs(rest: string[]): Promise<number> {
272
272
  return 0;
273
273
  }
274
274
 
275
+ // Budget the trailing PROMPT column to whatever space is left in the
276
+ // terminal after the fixed columns, so users on wide terminals see more
277
+ // context and users on narrow ones don't get an awkwardly-wrapped table.
278
+ const termWidth = (process.stdout as any).columns ?? 120;
279
+
280
+ const rawCwds = records.map((r) => shortenPath(r.cwd));
281
+ const widths = {
282
+ pid: Math.max(3, ...records.map((r) => String(r.pid).length)),
283
+ cli: Math.max(3, ...records.map((r) => r.cli.length)),
284
+ status: Math.max(6, ...records.map((r) => r.status.length)),
285
+ age: Math.max(3, ...records.map((r) => humanizeAge(Date.now() - r.started_at).length)),
286
+ cwd: Math.max(3, ...rawCwds.map((c) => c.length)),
287
+ };
288
+ const fixedWidth = widths.pid + widths.cli + widths.status + widths.age + widths.cwd + 5 * 2; // 5 separators of " "
289
+ const promptBudget = Math.max(20, termWidth - fixedWidth - 1);
290
+
275
291
  const rows = records.map((r) => ({
276
292
  pid: String(r.pid),
277
293
  cli: r.cli,
278
294
  status: r.status,
279
295
  age: humanizeAge(Date.now() - r.started_at),
280
296
  cwd: shortenPath(r.cwd),
281
- prompt: truncate(r.prompt ?? "", 60),
297
+ prompt: truncate(r.prompt ?? "", promptBudget),
282
298
  }));
283
299
 
284
- const widths = {
285
- pid: Math.max(3, ...rows.map((r) => r.pid.length)),
286
- cli: Math.max(3, ...rows.map((r) => r.cli.length)),
287
- status: Math.max(6, ...rows.map((r) => r.status.length)),
288
- age: Math.max(3, ...rows.map((r) => r.age.length)),
289
- cwd: Math.max(3, ...rows.map((r) => r.cwd.length)),
290
- };
291
-
292
300
  const header =
293
301
  [
294
302
  "PID".padEnd(widths.pid),
@@ -1,11 +0,0 @@
1
- import { t as CLIS_CONFIG } from "./ts-C8vuG5y-.js";
2
- import "./logger-B9h0djqx.js";
3
- import "./pidStore-CHLHMBEM.js";
4
- import "./globalPidIndex-DNEh8a_O.js";
5
-
6
- //#region ts/SUPPORTED_CLIS.ts
7
- const SUPPORTED_CLIS = Object.keys(CLIS_CONFIG);
8
-
9
- //#endregion
10
- export { SUPPORTED_CLIS };
11
- //# sourceMappingURL=SUPPORTED_CLIS-BCn8YIi2.js.map
@@ -1,5 +0,0 @@
1
- import "./logger-B9h0djqx.js";
2
- import { t as PidStore } from "./pidStore-CHLHMBEM.js";
3
- import "./globalPidIndex-DNEh8a_O.js";
4
-
5
- export { PidStore };