@rcrsr/claude-code-runner 0.3.0 → 0.5.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.
Files changed (87) hide show
  1. package/README.md +131 -37
  2. package/dist/cli/args.d.ts +0 -3
  3. package/dist/cli/args.d.ts.map +1 -1
  4. package/dist/cli/args.js +74 -25
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/core/runner.d.ts +6 -2
  7. package/dist/core/runner.d.ts.map +1 -1
  8. package/dist/core/runner.js +31 -23
  9. package/dist/core/runner.js.map +1 -1
  10. package/dist/deaddrop/client.d.ts +23 -0
  11. package/dist/deaddrop/client.d.ts.map +1 -0
  12. package/dist/deaddrop/client.js +47 -0
  13. package/dist/deaddrop/client.js.map +1 -0
  14. package/dist/deaddrop/index.d.ts +2 -0
  15. package/dist/deaddrop/index.d.ts.map +1 -0
  16. package/dist/deaddrop/index.js +2 -0
  17. package/dist/deaddrop/index.js.map +1 -0
  18. package/dist/index.js +115 -44
  19. package/dist/index.js.map +1 -1
  20. package/dist/output/colors.d.ts +25 -5
  21. package/dist/output/colors.d.ts.map +1 -1
  22. package/dist/output/colors.js +33 -14
  23. package/dist/output/colors.js.map +1 -1
  24. package/dist/output/deaddrop-queue.d.ts +45 -0
  25. package/dist/output/deaddrop-queue.d.ts.map +1 -0
  26. package/dist/output/deaddrop-queue.js +82 -0
  27. package/dist/output/deaddrop-queue.js.map +1 -0
  28. package/dist/output/formatter.d.ts +5 -0
  29. package/dist/output/formatter.d.ts.map +1 -1
  30. package/dist/output/formatter.js +24 -22
  31. package/dist/output/formatter.js.map +1 -1
  32. package/dist/process/pty.d.ts.map +1 -1
  33. package/dist/process/pty.js +3 -2
  34. package/dist/process/pty.js.map +1 -1
  35. package/dist/script/index.d.ts +8 -0
  36. package/dist/script/index.d.ts.map +1 -0
  37. package/dist/script/index.js +10 -0
  38. package/dist/script/index.js.map +1 -0
  39. package/dist/script/loader.d.ts +13 -0
  40. package/dist/script/loader.d.ts.map +1 -0
  41. package/dist/script/loader.js +66 -0
  42. package/dist/script/loader.js.map +1 -0
  43. package/dist/script/parser.d.ts +63 -0
  44. package/dist/script/parser.d.ts.map +1 -0
  45. package/dist/script/parser.js +349 -0
  46. package/dist/script/parser.js.map +1 -0
  47. package/dist/script/types.d.ts +49 -0
  48. package/dist/script/types.d.ts.map +1 -0
  49. package/dist/script/types.js +5 -0
  50. package/dist/script/types.js.map +1 -0
  51. package/dist/script/variables.d.ts +27 -0
  52. package/dist/script/variables.d.ts.map +1 -0
  53. package/dist/script/variables.js +74 -0
  54. package/dist/script/variables.js.map +1 -0
  55. package/dist/templates/command.d.ts +38 -9
  56. package/dist/templates/command.d.ts.map +1 -1
  57. package/dist/templates/command.js +81 -27
  58. package/dist/templates/command.js.map +1 -1
  59. package/dist/types/index.d.ts +1 -0
  60. package/dist/types/index.d.ts.map +1 -1
  61. package/dist/types/index.js +1 -0
  62. package/dist/types/index.js.map +1 -1
  63. package/dist/types/runner.d.ts +13 -0
  64. package/dist/types/runner.d.ts.map +1 -1
  65. package/dist/types/runner.js +5 -3
  66. package/dist/types/runner.js.map +1 -1
  67. package/dist/types/tools.d.ts +64 -0
  68. package/dist/types/tools.d.ts.map +1 -0
  69. package/dist/types/tools.js +12 -0
  70. package/dist/types/tools.js.map +1 -0
  71. package/dist/utils/arguments.d.ts +19 -0
  72. package/dist/utils/arguments.d.ts.map +1 -0
  73. package/dist/utils/arguments.js +31 -0
  74. package/dist/utils/arguments.js.map +1 -0
  75. package/dist/utils/constants.d.ts +49 -0
  76. package/dist/utils/constants.d.ts.map +1 -0
  77. package/dist/utils/constants.js +54 -0
  78. package/dist/utils/constants.js.map +1 -0
  79. package/dist/utils/formatting.d.ts +10 -0
  80. package/dist/utils/formatting.d.ts.map +1 -0
  81. package/dist/utils/formatting.js +19 -0
  82. package/dist/utils/formatting.js.map +1 -0
  83. package/dist/utils/index.d.ts +7 -0
  84. package/dist/utils/index.d.ts.map +1 -0
  85. package/dist/utils/index.js +7 -0
  86. package/dist/utils/index.js.map +1 -0
  87. package/package.json +1 -1
@@ -1,48 +1,102 @@
1
1
  /**
2
- * Command template loading and variable substitution
2
+ * Template loading and variable substitution for commands and scripts
3
3
  */
4
4
  import * as fs from 'fs';
5
5
  import * as path from 'path';
6
+ import { parseArgumentHint } from '../utils/arguments.js';
6
7
  /**
7
- * Strip YAML frontmatter from markdown content
8
- * Frontmatter can cause CLI parsing issues
8
+ * Parse YAML frontmatter from markdown content
9
9
  */
10
- export function stripFrontmatter(content) {
10
+ export function parseFrontmatter(content) {
11
11
  if (!content.startsWith('---')) {
12
- return content;
12
+ return { frontmatter: {}, body: content };
13
13
  }
14
14
  const endIndex = content.indexOf('\n---', 3);
15
15
  if (endIndex === -1) {
16
- return content;
16
+ return { frontmatter: {}, body: content };
17
+ }
18
+ const yamlContent = content.slice(4, endIndex);
19
+ const body = content.slice(endIndex + 4).trimStart();
20
+ const frontmatter = {};
21
+ const keyValueRegex = /^(\S+):\s*(.*)$/;
22
+ for (const line of yamlContent.split('\n')) {
23
+ const match = keyValueRegex.exec(line);
24
+ if (match) {
25
+ const [, key, value] = match;
26
+ const trimmedValue = value?.trim().replace(/^["']|["']$/g, '') ?? '';
27
+ if (key === 'model' && trimmedValue) {
28
+ frontmatter.model = trimmedValue;
29
+ }
30
+ else if (key === 'description' && trimmedValue) {
31
+ frontmatter.description = trimmedValue;
32
+ }
33
+ else if (key === 'argument-hint' && trimmedValue) {
34
+ frontmatter.argumentHint = trimmedValue;
35
+ }
36
+ }
17
37
  }
18
- return content.slice(endIndex + 4).trimStart();
38
+ return { frontmatter, body };
39
+ }
40
+ /**
41
+ * Strip YAML frontmatter from markdown content (legacy helper)
42
+ */
43
+ export function stripFrontmatter(content) {
44
+ return parseFrontmatter(content).body;
19
45
  }
20
46
  /**
21
- * Load a command template and substitute positional arguments
22
- * Templates are loaded from .claude/commands/<name>.md
23
- *
24
- * @param commandName - Name of the command (without .md extension)
25
- * @param cmdArgs - Positional arguments to substitute ($1, $2, etc.)
47
+ * Process template content: parse frontmatter, validate and substitute arguments
48
+ */
49
+ function processTemplate(content, args) {
50
+ const { frontmatter, body } = parseFrontmatter(content);
51
+ // Validate required arguments
52
+ const { requiredCount, optionalPositions } = parseArgumentHint(frontmatter.argumentHint);
53
+ if (args.length < requiredCount) {
54
+ const missing = [];
55
+ for (let i = args.length + 1; i <= requiredCount; i++) {
56
+ if (!optionalPositions.has(i)) {
57
+ missing.push(`$${i}`);
58
+ }
59
+ }
60
+ if (missing.length > 0) {
61
+ const hint = frontmatter.argumentHint
62
+ ? ` (usage: ${frontmatter.argumentHint})`
63
+ : '';
64
+ throw new Error(`Missing required arguments: ${missing.join(', ')}${hint}`);
65
+ }
66
+ }
67
+ // Substitute arguments
68
+ let result = body.replace(/\$ARGUMENTS/g, args.join(' '));
69
+ for (const [i, arg] of args.entries()) {
70
+ result = result.replace(new RegExp(`\\$${i + 1}`, 'g'), arg);
71
+ }
72
+ result = result.replace(/\$\d+/g, '');
73
+ return { body: result, frontmatter };
74
+ }
75
+ /**
76
+ * Load a command template from .claude/commands/<name>.md
26
77
  */
27
78
  export function loadCommandTemplate(commandName, cmdArgs) {
28
79
  const commandFile = path.join(process.cwd(), '.claude', 'commands', `${commandName}.md`);
29
80
  if (!fs.existsSync(commandFile)) {
30
- console.error(`Error: command not found: ${commandFile}`);
31
- process.exit(1);
32
- }
33
- let template = fs.readFileSync(commandFile, 'utf-8');
34
- // Strip YAML frontmatter
35
- template = stripFrontmatter(template);
36
- // Substitute $1, $2, $3, ... with positional args
37
- for (const [i, arg] of cmdArgs.entries()) {
38
- template = template.replace(new RegExp(`\\$${i + 1}`, 'g'), arg);
81
+ throw new Error(`Command not found: ${commandFile}`);
39
82
  }
40
- // Warn about unsubstituted variables
41
- const unsubstituted = template.match(/\$\d+/g);
42
- if (unsubstituted) {
43
- const unique = [...new Set(unsubstituted)];
44
- console.error(`Warning: unsubstituted variables: ${unique.join(', ')}`);
83
+ const content = fs.readFileSync(commandFile, 'utf-8');
84
+ const { body, frontmatter } = processTemplate(content, cmdArgs);
85
+ return { prompt: body, frontmatter };
86
+ }
87
+ /**
88
+ * Load a script template and substitute arguments
89
+ */
90
+ export function loadScriptTemplate(scriptFile, scriptArgs) {
91
+ if (!fs.existsSync(scriptFile)) {
92
+ throw new Error(`Script not found: ${scriptFile}`);
45
93
  }
46
- return template;
94
+ const content = fs.readFileSync(scriptFile, 'utf-8');
95
+ const { body, frontmatter } = processTemplate(content, scriptArgs);
96
+ const lines = body
97
+ .split('\n')
98
+ .map((l) => l.trim())
99
+ .filter((l) => l && !l.startsWith('#'));
100
+ return { lines, frontmatter };
47
101
  }
48
102
  //# sourceMappingURL=command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/templates/command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC7C,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;QACpB,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;AACjD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,WAAmB,EACnB,OAAiB;IAEjB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAC3B,OAAO,CAAC,GAAG,EAAE,EACb,SAAS,EACT,UAAU,EACV,GAAG,WAAW,KAAK,CACp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AE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACrD,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAEnE,MAAM,KAAK,GAAG,IAAI;SACf,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAE1C,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAChC,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from './claude.js';
2
2
  export * from './runner.js';
3
+ export * from './tools.js';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from './claude.js';
2
2
  export * from './runner.js';
3
+ export * from './tools.js';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -25,6 +25,13 @@ export interface RunResult {
25
25
  * Result of running with signal support (may involve multiple iterations)
26
26
  */
27
27
  export type SignalResult = 'ok' | 'blocked' | 'error';
28
+ /**
29
+ * Extended result from runWithSignals including output text
30
+ */
31
+ export interface SignalRunResult {
32
+ status: SignalResult;
33
+ claudeText: string;
34
+ }
28
35
  /**
29
36
  * Runner configuration
30
37
  */
@@ -36,6 +43,7 @@ export interface RunnerConfig {
36
43
  parallelThresholdMs: number;
37
44
  iterationPauseMs: number;
38
45
  model: string | null;
46
+ deaddrop: boolean;
39
47
  }
40
48
  /**
41
49
  * Default runner configuration
@@ -48,9 +56,14 @@ export interface ParsedArgs {
48
56
  subcommand: Subcommand;
49
57
  prompt: string;
50
58
  displayCommand: string;
59
+ /** Display strings for script lines (for logging) */
51
60
  scriptLines: string[];
52
61
  scriptMode: boolean;
53
62
  config: Partial<RunnerConfig>;
63
+ /** Script file path (when scriptMode is true) */
64
+ scriptFile: string | null;
65
+ /** Script arguments (passed to script file for variable substitution) */
66
+ scriptArgs: string[];
54
67
  }
55
68
  /**
56
69
  * Tool call tracking
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/types/runner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEvD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC;AAE/D,eAAO,MAAM,cAAc;;;;CAIjB,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC;AAE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C;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,EAMlC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Runner configuration and state types
3
3
  */
4
+ import { DEFAULT_ITERATION_PAUSE_MS, DEFAULT_MAX_ITERATIONS, DEFAULT_PARALLEL_THRESHOLD_MS, } from '../utils/constants.js';
4
5
  export const RUNNER_SIGNALS = {
5
6
  REPEAT_STEP: ':::RUNNER::REPEAT_STEP:::',
6
7
  BLOCKED: ':::RUNNER::BLOCKED:::',
@@ -13,10 +14,11 @@ export const DEFAULT_CONFIG = {
13
14
  verbosity: 'normal',
14
15
  enableLog: true,
15
16
  logDir: 'logs',
16
- maxIterations: 10,
17
- parallelThresholdMs: 100,
18
- iterationPauseMs: 2000,
17
+ maxIterations: DEFAULT_MAX_ITERATIONS,
18
+ parallelThresholdMs: DEFAULT_PARALLEL_THRESHOLD_MS,
19
+ iterationPauseMs: DEFAULT_ITERATION_PAUSE_MS,
19
20
  model: null,
21
+ deaddrop: false,
20
22
  };
21
23
  /**
22
24
  * Noise patterns to filter from output
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/types/runner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,WAAW,EAAE,2BAA2B;IACxC,OAAO,EAAE,uBAAuB;IAChC,KAAK,EAAE,qBAAqB;CACpB,CAAC;AA6BX;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC1C,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,IAAI;IACf,MAAM,EAAE,MAAM;IACd,aAAa,EAAE,EAAE;IACjB,mBAAmB,EAAE,GAAG;IACxB,gBAAgB,EAAE,IAAI;IACtB,KAAK,EAAE,IAAI;CACZ,CAAC;AAgCF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAa;IACtC,UAAU;IACV,gBAAgB;IAChB,UAAU;IACV,eAAe;IACf,QAAQ;CACT,CAAC"}
1
+ {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/types/runner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAY/B,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,WAAW,EAAE,2BAA2B;IACxC,OAAO,EAAE,uBAAuB;IAChC,KAAK,EAAE,qBAAqB;CACpB,CAAC;AAsCX;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC1C,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,IAAI;IACf,MAAM,EAAE,MAAM;IACd,aAAa,EAAE,sBAAsB;IACrC,mBAAmB,EAAE,6BAA6B;IAClD,gBAAgB,EAAE,0BAA0B;IAC5C,KAAK,EAAE,IAAI;IACX,QAAQ,EAAE,KAAK;CAChB,CAAC;AAqCF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAa;IACtC,UAAU;IACV,gBAAgB;IAChB,UAAU;IACV,eAAe;IACf,QAAQ;CACT,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Type-safe tool input handling
3
+ * Provides discriminated union types for tool inputs
4
+ */
5
+ /**
6
+ * Read tool input
7
+ */
8
+ export interface ReadToolInput {
9
+ file_path: string;
10
+ offset?: number;
11
+ limit?: number;
12
+ }
13
+ /**
14
+ * Glob tool input
15
+ */
16
+ export interface GlobToolInput {
17
+ pattern: string;
18
+ path?: string;
19
+ }
20
+ /**
21
+ * Grep tool input
22
+ */
23
+ export interface GrepToolInput {
24
+ pattern: string;
25
+ path?: string;
26
+ glob?: string;
27
+ type?: string;
28
+ }
29
+ /**
30
+ * Bash tool input
31
+ */
32
+ export interface BashToolInput {
33
+ command: string;
34
+ description?: string;
35
+ timeout?: number;
36
+ }
37
+ /**
38
+ * Task tool input
39
+ */
40
+ export interface TaskToolInput {
41
+ description?: string;
42
+ prompt?: string;
43
+ subagent_type?: string;
44
+ }
45
+ /**
46
+ * Write tool input
47
+ */
48
+ export interface WriteToolInput {
49
+ file_path: string;
50
+ content: string;
51
+ }
52
+ /**
53
+ * Edit tool input
54
+ */
55
+ export interface EditToolInput {
56
+ file_path: string;
57
+ old_string: string;
58
+ new_string: string;
59
+ }
60
+ /**
61
+ * Get a string field from tool input with safe fallback
62
+ */
63
+ export declare function getToolInputString(input: Record<string, unknown>, field: string, defaultValue?: string): string;
64
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/types/tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,KAAK,EAAE,MAAM,EACb,YAAY,SAAK,GAChB,MAAM,CAGR"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Type-safe tool input handling
3
+ * Provides discriminated union types for tool inputs
4
+ */
5
+ /**
6
+ * Get a string field from tool input with safe fallback
7
+ */
8
+ export function getToolInputString(input, field, defaultValue = '') {
9
+ const value = input[field];
10
+ return typeof value === 'string' ? value : defaultValue;
11
+ }
12
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/types/tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgEH;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAA8B,EAC9B,KAAa,EACb,YAAY,GAAG,EAAE;IAEjB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Shared argument parsing utilities
3
+ */
4
+ /**
5
+ * Parsed argument hint result
6
+ */
7
+ export interface ArgumentHintResult {
8
+ requiredCount: number;
9
+ optionalPositions: Set<number>;
10
+ }
11
+ /**
12
+ * Parse argument-hint to determine required vs optional args
13
+ * Convention: <arg> = required, [arg] = optional
14
+ *
15
+ * @param hint - Argument hint string like "<file> [options]"
16
+ * @returns Object with requiredCount and set of optional positions
17
+ */
18
+ export declare function parseArgumentHint(hint: string | undefined): ArgumentHintResult;
19
+ //# sourceMappingURL=arguments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arguments.d.ts","sourceRoot":"","sources":["../../src/utils/arguments.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,kBAAkB,CAqBpB"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Shared argument parsing utilities
3
+ */
4
+ /**
5
+ * Parse argument-hint to determine required vs optional args
6
+ * Convention: <arg> = required, [arg] = optional
7
+ *
8
+ * @param hint - Argument hint string like "<file> [options]"
9
+ * @returns Object with requiredCount and set of optional positions
10
+ */
11
+ export function parseArgumentHint(hint) {
12
+ if (!hint) {
13
+ return { requiredCount: 0, optionalPositions: new Set() };
14
+ }
15
+ const optionalPositions = new Set();
16
+ let position = 0;
17
+ let requiredCount = 0;
18
+ const argPattern = /<[^>]+>|\[[^\]]+\]/g;
19
+ let match;
20
+ while ((match = argPattern.exec(hint)) !== null) {
21
+ position++;
22
+ if (match[0].startsWith('[')) {
23
+ optionalPositions.add(position);
24
+ }
25
+ else {
26
+ requiredCount = position;
27
+ }
28
+ }
29
+ return { requiredCount, optionalPositions };
30
+ }
31
+ //# sourceMappingURL=arguments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arguments.js","sourceRoot":"","sources":["../../src/utils/arguments.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAwB;IAExB,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,EAAE,aAAa,EAAE,CAAC,EAAE,iBAAiB,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;IAC5D,CAAC;IAED,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC5C,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,IAAI,aAAa,GAAG,CAAC,CAAC;IAEtB,MAAM,UAAU,GAAG,qBAAqB,CAAC;IACzC,IAAI,KAAK,CAAC;IACV,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAChD,QAAQ,EAAE,CAAC;QACX,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;aAAM,CAAC;YACN,aAAa,GAAG,QAAQ,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Centralized constants for the runner codebase
3
+ * Replaces magic numbers with descriptive names
4
+ */
5
+ /** Threshold for displaying size in K (1000 chars) */
6
+ export declare const SIZE_THRESHOLD_K = 1000;
7
+ /** Threshold for displaying size in M (1000000 chars) */
8
+ export declare const SIZE_THRESHOLD_M = 1000000;
9
+ /** Maximum lines shown in tool result output */
10
+ export declare const MAX_RESULT_LINES = 10;
11
+ /** Truncation length for Grep pattern display */
12
+ export declare const TRUNCATE_GREP_PATTERN = 30;
13
+ /** Truncation length for Task description */
14
+ export declare const TRUNCATE_TASK_DESC = 40;
15
+ /** Truncation length for Bash command display */
16
+ export declare const TRUNCATE_BASH_CMD = 50;
17
+ /** Truncation length for preview text */
18
+ export declare const TRUNCATE_PREVIEW = 50;
19
+ /** Truncation length for unknown tool JSON */
20
+ export declare const TRUNCATE_TOOL_JSON = 60;
21
+ /** Truncation length for error messages */
22
+ export declare const TRUNCATE_ERROR = 100;
23
+ /** Truncation length for generic messages */
24
+ export declare const TRUNCATE_MESSAGE = 100;
25
+ /** Truncation length for verbose tool result lines */
26
+ export declare const TRUNCATE_VERBOSE_LINE = 150;
27
+ /** Truncation length for normal task result summary */
28
+ export declare const TRUNCATE_TASK_SUMMARY = 200;
29
+ /** Truncation length for quiet mode answer display */
30
+ export declare const TRUNCATE_ANSWER = 500;
31
+ /** Truncation length for verbose task result summary */
32
+ export declare const TRUNCATE_TASK_VERBOSE = 500;
33
+ /** Terminal column width */
34
+ export declare const PTY_COLS = 200;
35
+ /** Terminal row count */
36
+ export declare const PTY_ROWS = 50;
37
+ /** Milliseconds per second */
38
+ export declare const MS_PER_SECOND = 1000;
39
+ /** Seconds per minute */
40
+ export declare const SECONDS_PER_MINUTE = 60;
41
+ /** Seconds per hour */
42
+ export declare const SECONDS_PER_HOUR = 3600;
43
+ /** Default max iterations before stopping */
44
+ export declare const DEFAULT_MAX_ITERATIONS = 10;
45
+ /** Default parallel tool detection threshold in ms */
46
+ export declare const DEFAULT_PARALLEL_THRESHOLD_MS = 100;
47
+ /** Default pause between iterations in ms */
48
+ export declare const DEFAULT_ITERATION_PAUSE_MS = 2000;
49
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,OAAO,CAAC;AACrC,yDAAyD;AACzD,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAGxC,gDAAgD;AAChD,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,iDAAiD;AACjD,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,6CAA6C;AAC7C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,iDAAiD;AACjD,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,yCAAyC;AACzC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,8CAA8C;AAC9C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,2CAA2C;AAC3C,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,6CAA6C;AAC7C,eAAO,MAAM,gBAAgB,MAAM,CAAC;AACpC,sDAAsD;AACtD,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,uDAAuD;AACvD,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,sDAAsD;AACtD,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,wDAAwD;AACxD,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAGzC,4BAA4B;AAC5B,eAAO,MAAM,QAAQ,MAAM,CAAC;AAC5B,yBAAyB;AACzB,eAAO,MAAM,QAAQ,KAAK,CAAC;AAG3B,8BAA8B;AAC9B,eAAO,MAAM,aAAa,OAAO,CAAC;AAClC,yBAAyB;AACzB,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,uBAAuB;AACvB,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAGrC,6CAA6C;AAC7C,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,sDAAsD;AACtD,eAAO,MAAM,6BAA6B,MAAM,CAAC;AACjD,6CAA6C;AAC7C,eAAO,MAAM,0BAA0B,OAAO,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Centralized constants for the runner codebase
3
+ * Replaces magic numbers with descriptive names
4
+ */
5
+ // === Size Thresholds ===
6
+ /** Threshold for displaying size in K (1000 chars) */
7
+ export const SIZE_THRESHOLD_K = 1000;
8
+ /** Threshold for displaying size in M (1000000 chars) */
9
+ export const SIZE_THRESHOLD_M = 1000000;
10
+ // === Display Limits ===
11
+ /** Maximum lines shown in tool result output */
12
+ export const MAX_RESULT_LINES = 10;
13
+ /** Truncation length for Grep pattern display */
14
+ export const TRUNCATE_GREP_PATTERN = 30;
15
+ /** Truncation length for Task description */
16
+ export const TRUNCATE_TASK_DESC = 40;
17
+ /** Truncation length for Bash command display */
18
+ export const TRUNCATE_BASH_CMD = 50;
19
+ /** Truncation length for preview text */
20
+ export const TRUNCATE_PREVIEW = 50;
21
+ /** Truncation length for unknown tool JSON */
22
+ export const TRUNCATE_TOOL_JSON = 60;
23
+ /** Truncation length for error messages */
24
+ export const TRUNCATE_ERROR = 100;
25
+ /** Truncation length for generic messages */
26
+ export const TRUNCATE_MESSAGE = 100;
27
+ /** Truncation length for verbose tool result lines */
28
+ export const TRUNCATE_VERBOSE_LINE = 150;
29
+ /** Truncation length for normal task result summary */
30
+ export const TRUNCATE_TASK_SUMMARY = 200;
31
+ /** Truncation length for quiet mode answer display */
32
+ export const TRUNCATE_ANSWER = 500;
33
+ /** Truncation length for verbose task result summary */
34
+ export const TRUNCATE_TASK_VERBOSE = 500;
35
+ // === PTY Configuration ===
36
+ /** Terminal column width */
37
+ export const PTY_COLS = 200;
38
+ /** Terminal row count */
39
+ export const PTY_ROWS = 50;
40
+ // === Time Constants ===
41
+ /** Milliseconds per second */
42
+ export const MS_PER_SECOND = 1000;
43
+ /** Seconds per minute */
44
+ export const SECONDS_PER_MINUTE = 60;
45
+ /** Seconds per hour */
46
+ export const SECONDS_PER_HOUR = 3600;
47
+ // === Default Configuration ===
48
+ /** Default max iterations before stopping */
49
+ export const DEFAULT_MAX_ITERATIONS = 10;
50
+ /** Default parallel tool detection threshold in ms */
51
+ export const DEFAULT_PARALLEL_THRESHOLD_MS = 100;
52
+ /** Default pause between iterations in ms */
53
+ export const DEFAULT_ITERATION_PAUSE_MS = 2000;
54
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0BAA0B;AAC1B,sDAAsD;AACtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;A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C,6CAA6C;AAC7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AACzC,sDAAsD;AACtD,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,CAAC;AACjD,6CAA6C;AAC7C,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Shared formatting utilities
3
+ */
4
+ /**
5
+ * Format character count for display
6
+ * @param chars - Number of characters
7
+ * @returns Formatted string: "N chars", "N.NK chars", or "N.NM chars"
8
+ */
9
+ export declare function formatSize(chars: number): string;
10
+ //# sourceMappingURL=formatting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src/utils/formatting.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOhD"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Shared formatting utilities
3
+ */
4
+ import { SIZE_THRESHOLD_K, SIZE_THRESHOLD_M } from './constants.js';
5
+ /**
6
+ * Format character count for display
7
+ * @param chars - Number of characters
8
+ * @returns Formatted string: "N chars", "N.NK chars", or "N.NM chars"
9
+ */
10
+ export function formatSize(chars) {
11
+ if (chars < SIZE_THRESHOLD_K) {
12
+ return `${chars} chars`;
13
+ }
14
+ else if (chars < SIZE_THRESHOLD_M) {
15
+ return `${(chars / SIZE_THRESHOLD_K).toFixed(1)}K chars`;
16
+ }
17
+ return `${(chars / SIZE_THRESHOLD_M).toFixed(1)}M chars`;
18
+ }
19
+ //# sourceMappingURL=formatting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatting.js","sourceRoot":"","sources":["../../src/utils/formatting.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,IAAI,KAAK,GAAG,gBAAgB,EAAE,CAAC;QAC7B,OAAO,GAAG,KAAK,QAAQ,CAAC;IAC1B,CAAC;SAAM,IAAI,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACpC,OAAO,GAAG,CAAC,KAAK,GAAG,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3D,CAAC;IACD,OAAO,GAAG,CAAC,KAAK,GAAG,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Shared utilities
3
+ */
4
+ export * from './arguments.js';
5
+ export * from './constants.js';
6
+ export * from './formatting.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Shared utilities
3
+ */
4
+ export * from './arguments.js';
5
+ export * from './constants.js';
6
+ export * from './formatting.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rcrsr/claude-code-runner",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Execute Claude CLI with PTY handling, real-time tool visualization, and iterative execution support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",