claude-yes 1.31.2 → 1.32.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.
Files changed (44) hide show
  1. package/README.md +225 -21
  2. package/dist/agent-yes.js +2 -0
  3. package/dist/amp-yes.js +2 -0
  4. package/dist/auggie-yes.js +2 -0
  5. package/dist/claude-yes.js +2 -20432
  6. package/dist/cli.js +18341 -10955
  7. package/dist/cli.js.map +141 -150
  8. package/dist/codex-yes.js +2 -20432
  9. package/dist/copilot-yes.js +2 -20432
  10. package/dist/cursor-yes.js +2 -20432
  11. package/dist/gemini-yes.js +2 -20432
  12. package/dist/grok-yes.js +2 -20432
  13. package/dist/index.js +16258 -13586
  14. package/dist/index.js.map +176 -191
  15. package/dist/qwen-yes.js +2 -20432
  16. package/package.json +95 -84
  17. package/ts/ReadyManager.spec.ts +10 -10
  18. package/ts/ReadyManager.ts +1 -1
  19. package/ts/SUPPORTED_CLIS.ts +4 -0
  20. package/ts/catcher.spec.ts +69 -70
  21. package/ts/cli-idle.spec.ts +8 -8
  22. package/ts/cli.ts +18 -26
  23. package/ts/defineConfig.ts +4 -4
  24. package/ts/idleWaiter.spec.ts +9 -9
  25. package/ts/index.ts +474 -233
  26. package/ts/logger.ts +22 -0
  27. package/ts/parseCliArgs.spec.ts +146 -147
  28. package/ts/parseCliArgs.ts +127 -59
  29. package/ts/postbuild.ts +29 -15
  30. package/ts/pty-fix.ts +155 -0
  31. package/ts/pty.ts +19 -0
  32. package/ts/removeControlCharacters.spec.ts +37 -38
  33. package/ts/removeControlCharacters.ts +2 -1
  34. package/ts/runningLock.spec.ts +119 -125
  35. package/ts/runningLock.ts +44 -55
  36. package/ts/session-integration.spec.ts +34 -42
  37. package/ts/utils.spec.ts +35 -35
  38. package/ts/utils.ts +7 -7
  39. package/ts/codex-resume.spec.ts +0 -239
  40. package/ts/codexSessionManager.spec.ts +0 -51
  41. package/ts/codexSessionManager.test.ts +0 -259
  42. package/ts/codexSessionManager.ts +0 -312
  43. package/ts/yesLog.spec.ts +0 -74
  44. package/ts/yesLog.ts +0 -27
package/ts/cli.ts CHANGED
@@ -1,40 +1,32 @@
1
- #!/usr/bin/env node
2
- import DIE from 'phpdie';
3
- import cliYesConfig from '../cli-yes.config';
4
-
5
- // if node-pty is not installed, re-run with bun
6
- const hasNodePty = !!(await import('node-pty').catch(() => null));
7
- if (!globalThis.Bun && !hasNodePty) {
8
- // run with same arguments in Bun if not already
9
- console.log('No node-pty installed. Re-running with Bun...', process.argv);
10
- (await import('child_process')).spawnSync(
11
- 'node_modules/.bin/bun',
12
- [process.argv[1]!, '--', ...process.argv.slice(2)],
13
- { stdio: 'inherit' },
14
- );
15
- process.exit(0);
16
- }
17
- // check and fix bun-pty on some systems
18
- if (globalThis.Bun) console.log('Bun detected, using bun-pty');
19
- // await import("./fix-pty.js")
20
-
21
- // console.log('Running', process.argv);
1
+ #!/usr/bin/env bun
2
+ import { argv } from "process";
3
+ import cliYesConfig from "../agent-yes.config.ts";
4
+ import { parseCliArgs } from "./parseCliArgs.ts";
5
+ import { logger } from "./logger.ts";
22
6
 
23
7
  // Import the CLI module
24
- const { default: cliYes, parseCliArgs } = await import('./');
25
8
 
26
9
  // Parse CLI arguments
27
10
  const config = parseCliArgs(process.argv);
28
11
 
29
12
  // Validate CLI name
30
- if (!config.cli)
31
- DIE`missing cli def, available clis: ${Object.keys((await cliYesConfig).clis).join(', ')}`;
13
+ if (!config.cli) {
14
+ logger.error(process.argv);
15
+ logger.error("Error: No CLI name provided.");
16
+ throw new Error(
17
+ `missing cli def, available clis: ${Object.keys((await cliYesConfig).clis).join(", ")}`,
18
+ );
19
+ }
20
+
21
+ // console.log(`Using CLI: ${config.cli}`);
32
22
 
33
23
  if (config.verbose) {
34
- process.env.VERBOSE = 'true'; // enable verbose logging in yesLog.ts
24
+ process.env.VERBOSE = "true"; // enable verbose logging in yesLog.ts
35
25
  console.log(config);
26
+ console.log(argv);
36
27
  }
37
28
 
29
+ const { default: cliYes } = await import("./index.ts");
38
30
  const { exitCode } = await cliYes(config);
39
-
31
+ console.log("exiting process");
40
32
  process.exit(exitCode ?? 1);
@@ -1,12 +1,12 @@
1
- import type { AgentCliConfig, CliYesConfig } from '.';
1
+ import type { AgentCliConfig, AgentYesConfig } from "./index.ts";
2
2
 
3
3
  type Awaitable<T> = T | Promise<T>;
4
- export async function defineCliYesConfig<T extends CliYesConfig>(
4
+ export async function defineCliYesConfig<T extends AgentYesConfig>(
5
5
  cfg: Awaitable<T> | ((original: T) => Awaitable<T>),
6
6
  ) {
7
- if (typeof cfg === 'function') cfg = await cfg({ clis: {} } as T);
7
+ if (typeof cfg === "function") cfg = await cfg({ clis: {} } as T);
8
8
 
9
- return cfg as unknown as {
9
+ return cfg as unknown as Omit<AgentYesConfig, "clis"> & {
10
10
  clis: Record<string, AgentCliConfig>;
11
11
  };
12
12
  }
@@ -1,13 +1,13 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { IdleWaiter } from './idleWaiter';
1
+ import { describe, expect, it } from "vitest";
2
+ import { IdleWaiter } from "./idleWaiter";
3
3
 
4
- describe('IdleWaiter', () => {
5
- it('should initialize with current time', () => {
4
+ describe("IdleWaiter", () => {
5
+ it("should initialize with current time", () => {
6
6
  const waiter = new IdleWaiter();
7
7
  expect(waiter.lastActivityTime).toBeCloseTo(Date.now(), -2);
8
8
  });
9
9
 
10
- it('should update lastActivityTime when ping is called', () => {
10
+ it("should update lastActivityTime when ping is called", () => {
11
11
  const waiter = new IdleWaiter();
12
12
  const initialTime = waiter.lastActivityTime;
13
13
 
@@ -21,12 +21,12 @@ describe('IdleWaiter', () => {
21
21
  expect(waiter.lastActivityTime).toBeGreaterThan(initialTime);
22
22
  });
23
23
 
24
- it('should return this when ping is called for chaining', () => {
24
+ it("should return this when ping is called for chaining", () => {
25
25
  const waiter = new IdleWaiter();
26
26
  expect(waiter.ping()).toBe(waiter);
27
27
  });
28
28
 
29
- it('should resolve wait immediately when already idle', async () => {
29
+ it("should resolve wait immediately when already idle", async () => {
30
30
  const waiter = new IdleWaiter();
31
31
 
32
32
  // Wait enough time to be considered idle
@@ -40,14 +40,14 @@ describe('IdleWaiter', () => {
40
40
  await expect(waitPromise).resolves.toBeUndefined();
41
41
  });
42
42
 
43
- it('should respect custom check interval', () => {
43
+ it("should respect custom check interval", () => {
44
44
  const waiter = new IdleWaiter();
45
45
  waiter.checkInterval = 200;
46
46
 
47
47
  expect(waiter.checkInterval).toBe(200);
48
48
  });
49
49
 
50
- it('should have ping method that chains', () => {
50
+ it("should have ping method that chains", () => {
51
51
  const waiter = new IdleWaiter();
52
52
  const result = waiter.ping().ping().ping();
53
53
  expect(result).toBe(waiter);