claude-yes 1.14.1 → 1.15.0
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/cli.ts +49 -39
- package/dist/cli.js +5354 -244
- package/dist/index.js +7 -4
- package/index.ts +12 -3
- package/package.json +4 -4
package/cli.ts
CHANGED
|
@@ -1,47 +1,57 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import ms from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import ms from 'enhanced-ms';
|
|
3
|
+
import yargs from 'yargs';
|
|
4
|
+
import { hideBin } from 'yargs/helpers';
|
|
5
|
+
import claudeYes from '.';
|
|
5
6
|
|
|
6
7
|
// cli entry point
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
default:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
8
|
+
const argv = yargs(hideBin(process.argv))
|
|
9
|
+
.usage('Usage: $0 [options] [claude args]')
|
|
10
|
+
.option('exit-on-idle', {
|
|
11
|
+
type: 'string',
|
|
12
|
+
default: '60s',
|
|
13
|
+
description: 'Exit after being idle for specified duration',
|
|
14
|
+
})
|
|
15
|
+
.option('continue-on-crash', {
|
|
16
|
+
type: 'boolean',
|
|
17
|
+
default: true,
|
|
18
|
+
description: 'Continue running even if Claude crashes',
|
|
19
|
+
})
|
|
20
|
+
.option('log-file', {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Path to log file for output logging',
|
|
23
|
+
})
|
|
24
|
+
.option('verbose', {
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
default: false,
|
|
27
|
+
description: 'Enable verbose logging',
|
|
28
|
+
})
|
|
29
|
+
.parserConfiguration({
|
|
30
|
+
'unknown-options-as-args': true,
|
|
31
|
+
'halt-at-non-option': true,
|
|
32
|
+
})
|
|
33
|
+
.parseSync();
|
|
23
34
|
|
|
35
|
+
const {
|
|
36
|
+
exitOnIdle: exitOnIdleArg,
|
|
37
|
+
continueOnCrash: continueOnCrashArg,
|
|
38
|
+
logFile,
|
|
39
|
+
...rest
|
|
40
|
+
} = argv;
|
|
24
41
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (exitOnIdleArg === '') {
|
|
28
|
-
exitOnIdle = true; // default timeout will be used
|
|
29
|
-
} else {
|
|
30
|
-
exitOnIdle = ms(exitOnIdleArg); // parse duration string like "5s", "30s", "1m"
|
|
31
|
-
}
|
|
32
|
-
} else {
|
|
33
|
-
exitOnIdle = undefined;
|
|
34
|
-
}
|
|
42
|
+
const claudeArgs = argv._.map((e) => String(e));
|
|
43
|
+
const exitOnIdle = argv.exitOnIdle != null ? ms(argv.exitOnIdle) : undefined;
|
|
35
44
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// exitOnIdle,
|
|
39
|
-
// continueOnCrash: continueOnCrashArg,
|
|
40
|
-
// claudeArgs,
|
|
41
|
-
// });
|
|
42
|
-
|
|
43
|
-
await claudeYes({
|
|
45
|
+
argv.verbose &&
|
|
46
|
+
console.debug('[claude-yes] Parsed args:', {
|
|
44
47
|
exitOnIdle,
|
|
45
|
-
claudeArgs,
|
|
46
48
|
continueOnCrash: continueOnCrashArg,
|
|
47
|
-
|
|
49
|
+
claudeArgs,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
await claudeYes({
|
|
53
|
+
exitOnIdle,
|
|
54
|
+
claudeArgs,
|
|
55
|
+
continueOnCrash: continueOnCrashArg,
|
|
56
|
+
logFile,
|
|
57
|
+
});
|