@rcrsr/claude-code-runner 0.4.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.
- package/README.md +103 -30
- package/dist/cli/args.d.ts +0 -3
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +51 -20
- package/dist/cli/args.js.map +1 -1
- package/dist/core/runner.d.ts +5 -2
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +27 -24
- package/dist/core/runner.js.map +1 -1
- package/dist/index.js +83 -41
- package/dist/index.js.map +1 -1
- package/dist/output/colors.d.ts +5 -11
- package/dist/output/colors.d.ts.map +1 -1
- package/dist/output/colors.js +7 -59
- package/dist/output/colors.js.map +1 -1
- package/dist/output/deaddrop-queue.d.ts +45 -0
- package/dist/output/deaddrop-queue.d.ts.map +1 -0
- package/dist/output/deaddrop-queue.js +82 -0
- package/dist/output/deaddrop-queue.js.map +1 -0
- package/dist/output/formatter.d.ts +4 -0
- package/dist/output/formatter.d.ts.map +1 -1
- package/dist/output/formatter.js +20 -17
- package/dist/output/formatter.js.map +1 -1
- package/dist/process/pty.d.ts.map +1 -1
- package/dist/process/pty.js +3 -2
- package/dist/process/pty.js.map +1 -1
- package/dist/script/index.d.ts +8 -0
- package/dist/script/index.d.ts.map +1 -0
- package/dist/script/index.js +10 -0
- package/dist/script/index.js.map +1 -0
- package/dist/script/loader.d.ts +13 -0
- package/dist/script/loader.d.ts.map +1 -0
- package/dist/script/loader.js +66 -0
- package/dist/script/loader.js.map +1 -0
- package/dist/script/parser.d.ts +63 -0
- package/dist/script/parser.d.ts.map +1 -0
- package/dist/script/parser.js +349 -0
- package/dist/script/parser.js.map +1 -0
- package/dist/script/types.d.ts +49 -0
- package/dist/script/types.d.ts.map +1 -0
- package/dist/script/types.js +5 -0
- package/dist/script/types.js.map +1 -0
- package/dist/script/variables.d.ts +27 -0
- package/dist/script/variables.d.ts.map +1 -0
- package/dist/script/variables.js +74 -0
- package/dist/script/variables.js.map +1 -0
- package/dist/templates/command.d.ts +18 -20
- package/dist/templates/command.d.ts.map +1 -1
- package/dist/templates/command.js +40 -61
- package/dist/templates/command.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/runner.d.ts +12 -0
- package/dist/types/runner.d.ts.map +1 -1
- package/dist/types/runner.js +4 -3
- package/dist/types/runner.js.map +1 -1
- package/dist/types/tools.d.ts +64 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +12 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/utils/arguments.d.ts +19 -0
- package/dist/utils/arguments.d.ts.map +1 -0
- package/dist/utils/arguments.js +31 -0
- package/dist/utils/arguments.js.map +1 -0
- package/dist/utils/constants.d.ts +49 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +54 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/formatting.d.ts +10 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/formatting.js +19 -0
- package/dist/utils/formatting.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for parsed script lines
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* A prompt line: prompt("text") -> $var
|
|
6
|
+
*/
|
|
7
|
+
export interface PromptLine {
|
|
8
|
+
type: 'prompt';
|
|
9
|
+
text: string;
|
|
10
|
+
capture?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A command line: command("name", ["arg1", "arg2"]) -> $var
|
|
14
|
+
*/
|
|
15
|
+
export interface CommandLine {
|
|
16
|
+
type: 'command';
|
|
17
|
+
name: string;
|
|
18
|
+
args: string[];
|
|
19
|
+
capture?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Union of all script line types
|
|
23
|
+
*/
|
|
24
|
+
export type ScriptLine = PromptLine | CommandLine;
|
|
25
|
+
/**
|
|
26
|
+
* Result of parsing a script file
|
|
27
|
+
*/
|
|
28
|
+
export interface ParsedScript {
|
|
29
|
+
lines: ScriptLine[];
|
|
30
|
+
frontmatter: ScriptFrontmatter;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Frontmatter metadata from script files
|
|
34
|
+
*/
|
|
35
|
+
export interface ScriptFrontmatter {
|
|
36
|
+
model?: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
argumentHint?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Variable store for captured outputs
|
|
42
|
+
*/
|
|
43
|
+
export interface VariableStore {
|
|
44
|
+
/** Named captures: $name -> value */
|
|
45
|
+
named: Map<string, string>;
|
|
46
|
+
/** Last output: $_ */
|
|
47
|
+
last: string;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/script/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,WAAW,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,WAAW,EAAE,iBAAiB,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/script/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Variable store and substitution for script execution
|
|
3
|
+
*/
|
|
4
|
+
import type { VariableStore } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Create an empty variable store
|
|
7
|
+
*/
|
|
8
|
+
export declare function createVariableStore(): VariableStore;
|
|
9
|
+
/**
|
|
10
|
+
* Capture output into the variable store
|
|
11
|
+
* Updates both the named variable (if provided) and $_
|
|
12
|
+
*/
|
|
13
|
+
export declare function captureOutput(store: VariableStore, output: string, varName?: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Get capture log message for [RUNNER] output
|
|
16
|
+
*/
|
|
17
|
+
export declare function getCaptureLogMessage(output: string, varName?: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Substitute variables in a string
|
|
20
|
+
* Handles: $_, $varname, $1, $2, etc.
|
|
21
|
+
*/
|
|
22
|
+
export declare function substituteVariables(text: string, store: VariableStore, scriptArgs?: string[]): string;
|
|
23
|
+
/**
|
|
24
|
+
* Get list of variables being substituted (for logging)
|
|
25
|
+
*/
|
|
26
|
+
export declare function getSubstitutionList(text: string, store: VariableStore): string[];
|
|
27
|
+
//# sourceMappingURL=variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/script/variables.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAKnD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAQN;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAM7E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,aAAa,EACpB,UAAU,GAAE,MAAM,EAAO,GACxB,MAAM,CAyBR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,aAAa,GACnB,MAAM,EAAE,CAgBV"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Variable store and substitution for script execution
|
|
3
|
+
*/
|
|
4
|
+
import { formatSize } from '../utils/formatting.js';
|
|
5
|
+
/**
|
|
6
|
+
* Create an empty variable store
|
|
7
|
+
*/
|
|
8
|
+
export function createVariableStore() {
|
|
9
|
+
return {
|
|
10
|
+
named: new Map(),
|
|
11
|
+
last: '',
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Capture output into the variable store
|
|
16
|
+
* Updates both the named variable (if provided) and $_
|
|
17
|
+
*/
|
|
18
|
+
export function captureOutput(store, output, varName) {
|
|
19
|
+
// Always update $_
|
|
20
|
+
store.last = output;
|
|
21
|
+
// Update named variable if provided
|
|
22
|
+
if (varName) {
|
|
23
|
+
store.named.set(varName, output);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get capture log message for [RUNNER] output
|
|
28
|
+
*/
|
|
29
|
+
export function getCaptureLogMessage(output, varName) {
|
|
30
|
+
const size = formatSize(output.length);
|
|
31
|
+
if (varName) {
|
|
32
|
+
return `$${varName} captured (${size})`;
|
|
33
|
+
}
|
|
34
|
+
return `$_ captured (${size})`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Substitute variables in a string
|
|
38
|
+
* Handles: $_, $varname, $1, $2, etc.
|
|
39
|
+
*/
|
|
40
|
+
export function substituteVariables(text, store, scriptArgs = []) {
|
|
41
|
+
let result = text;
|
|
42
|
+
// Substitute $_ (last output)
|
|
43
|
+
result = result.replace(/\$_/g, store.last);
|
|
44
|
+
// Substitute $ARGUMENTS BEFORE named variables (otherwise regex catches it)
|
|
45
|
+
result = result.replace(/\$ARGUMENTS/g, scriptArgs.join(' '));
|
|
46
|
+
// Substitute positional args ($1, $2, etc.) BEFORE named variables
|
|
47
|
+
for (const [i, arg] of scriptArgs.entries()) {
|
|
48
|
+
result = result.replace(new RegExp(`\\$${i + 1}`, 'g'), arg);
|
|
49
|
+
}
|
|
50
|
+
// Remove any remaining unmatched $N placeholders
|
|
51
|
+
result = result.replace(/\$\d+/g, '');
|
|
52
|
+
// Substitute named variables ($varname) LAST
|
|
53
|
+
// Match $word but not $1, $2, etc. (already handled above)
|
|
54
|
+
result = result.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g, (_match, name) => store.named.get(name) ?? '');
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get list of variables being substituted (for logging)
|
|
59
|
+
*/
|
|
60
|
+
export function getSubstitutionList(text, store) {
|
|
61
|
+
const vars = [];
|
|
62
|
+
// Check for $_
|
|
63
|
+
if (text.includes('$_') && store.last) {
|
|
64
|
+
vars.push('$_');
|
|
65
|
+
}
|
|
66
|
+
// Check for named variables
|
|
67
|
+
for (const name of store.named.keys()) {
|
|
68
|
+
if (text.includes(`$${name}`)) {
|
|
69
|
+
vars.push(`$${name}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return vars;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=variables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variables.js","sourceRoot":"","sources":["../../src/script/variables.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,KAAK,EAAE,IAAI,GAAG,EAAE;QAChB,IAAI,EAAE,EAAE;KACT,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAoB,EACpB,MAAc,EACd,OAAgB;IAEhB,mBAAmB;IACnB,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC;IAEpB,oCAAoC;IACpC,IAAI,OAAO,EAAE,CAAC;QACZ,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc,EAAE,OAAgB;IACnE,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACvC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,IAAI,OAAO,cAAc,IAAI,GAAG,CAAC;IAC1C,CAAC;IACD,OAAO,gBAAgB,IAAI,GAAG,CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAY,EACZ,KAAoB,EACpB,aAAuB,EAAE;IAEzB,IAAI,MAAM,GAAG,IAAI,CAAC;IAElB,8BAA8B;IAC9B,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,IAA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IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Template loading and variable substitution for commands and scripts
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* Frontmatter metadata from
|
|
5
|
+
* Frontmatter metadata from template files
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface TemplateFrontmatter {
|
|
8
8
|
model?: string;
|
|
9
9
|
description?: string;
|
|
10
10
|
argumentHint?: string;
|
|
@@ -14,14 +14,21 @@ export interface CommandFrontmatter {
|
|
|
14
14
|
*/
|
|
15
15
|
export interface CommandTemplate {
|
|
16
16
|
prompt: string;
|
|
17
|
-
frontmatter:
|
|
17
|
+
frontmatter: TemplateFrontmatter;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Result of loading a script template
|
|
21
|
+
*/
|
|
22
|
+
export interface ScriptTemplate {
|
|
23
|
+
lines: string[];
|
|
24
|
+
frontmatter: TemplateFrontmatter;
|
|
25
|
+
}
|
|
26
|
+
export type CommandFrontmatter = TemplateFrontmatter;
|
|
19
27
|
/**
|
|
20
28
|
* Parse YAML frontmatter from markdown content
|
|
21
|
-
* Returns the frontmatter object and remaining content
|
|
22
29
|
*/
|
|
23
30
|
export declare function parseFrontmatter(content: string): {
|
|
24
|
-
frontmatter:
|
|
31
|
+
frontmatter: TemplateFrontmatter;
|
|
25
32
|
body: string;
|
|
26
33
|
};
|
|
27
34
|
/**
|
|
@@ -29,20 +36,11 @@ export declare function parseFrontmatter(content: string): {
|
|
|
29
36
|
*/
|
|
30
37
|
export declare function stripFrontmatter(content: string): string;
|
|
31
38
|
/**
|
|
32
|
-
* Load a command template
|
|
33
|
-
* Templates are loaded from .claude/commands/<name>.md
|
|
34
|
-
*
|
|
35
|
-
* Supports:
|
|
36
|
-
* - $ARGUMENTS: all arguments joined with spaces
|
|
37
|
-
* - $1, $2, $3...: positional arguments
|
|
38
|
-
*
|
|
39
|
-
* Frontmatter fields:
|
|
40
|
-
* - model: default model for this command (CLI arg takes precedence)
|
|
41
|
-
* - description: command description
|
|
42
|
-
* - argument-hint: defines required <arg> and optional [arg] arguments
|
|
43
|
-
*
|
|
44
|
-
* @param commandName - Name of the command (without .md extension)
|
|
45
|
-
* @param cmdArgs - Positional arguments to substitute
|
|
39
|
+
* Load a command template from .claude/commands/<name>.md
|
|
46
40
|
*/
|
|
47
41
|
export declare function loadCommandTemplate(commandName: string, cmdArgs: string[]): CommandTemplate;
|
|
42
|
+
/**
|
|
43
|
+
* Load a script template and substitute arguments
|
|
44
|
+
*/
|
|
45
|
+
export declare function loadScriptTemplate(scriptFile: string, scriptArgs: string[]): ScriptTemplate;
|
|
48
46
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/templates/command.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/templates/command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAUD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAGD,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAErD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG;IACjD,WAAW,EAAE,mBAAmB,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;CACd,CA8BA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAwCD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EAAE,GAChB,eAAe,CAgBjB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAAE,GACnB,cAAc,CAchB"}
|
|
@@ -1,37 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
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
|
-
|
|
7
|
-
* Parse argument-hint to determine required vs optional args
|
|
8
|
-
* Convention: <arg> = required, [arg] = optional
|
|
9
|
-
* Returns set of optional argument positions (1-indexed)
|
|
10
|
-
*/
|
|
11
|
-
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
|
-
// Match <required> or [optional] patterns
|
|
19
|
-
const argPattern = /<[^>]+>|\[[^\]]+\]/g;
|
|
20
|
-
let match;
|
|
21
|
-
while ((match = argPattern.exec(hint)) !== null) {
|
|
22
|
-
position++;
|
|
23
|
-
if (match[0].startsWith('[')) {
|
|
24
|
-
optionalPositions.add(position);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
requiredCount = position;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return { requiredCount, optionalPositions };
|
|
31
|
-
}
|
|
6
|
+
import { parseArgumentHint } from '../utils/arguments.js';
|
|
32
7
|
/**
|
|
33
8
|
* Parse YAML frontmatter from markdown content
|
|
34
|
-
* Returns the frontmatter object and remaining content
|
|
35
9
|
*/
|
|
36
10
|
export function parseFrontmatter(content) {
|
|
37
11
|
if (!content.startsWith('---')) {
|
|
@@ -43,7 +17,6 @@ export function parseFrontmatter(content) {
|
|
|
43
17
|
}
|
|
44
18
|
const yamlContent = content.slice(4, endIndex);
|
|
45
19
|
const body = content.slice(endIndex + 4).trimStart();
|
|
46
|
-
// Simple YAML parsing for known fields
|
|
47
20
|
const frontmatter = {};
|
|
48
21
|
const keyValueRegex = /^(\S+):\s*(.*)$/;
|
|
49
22
|
for (const line of yamlContent.split('\n')) {
|
|
@@ -71,34 +44,15 @@ export function stripFrontmatter(content) {
|
|
|
71
44
|
return parseFrontmatter(content).body;
|
|
72
45
|
}
|
|
73
46
|
/**
|
|
74
|
-
*
|
|
75
|
-
* Templates are loaded from .claude/commands/<name>.md
|
|
76
|
-
*
|
|
77
|
-
* Supports:
|
|
78
|
-
* - $ARGUMENTS: all arguments joined with spaces
|
|
79
|
-
* - $1, $2, $3...: positional arguments
|
|
80
|
-
*
|
|
81
|
-
* Frontmatter fields:
|
|
82
|
-
* - model: default model for this command (CLI arg takes precedence)
|
|
83
|
-
* - description: command description
|
|
84
|
-
* - argument-hint: defines required <arg> and optional [arg] arguments
|
|
85
|
-
*
|
|
86
|
-
* @param commandName - Name of the command (without .md extension)
|
|
87
|
-
* @param cmdArgs - Positional arguments to substitute
|
|
47
|
+
* Process template content: parse frontmatter, validate and substitute arguments
|
|
88
48
|
*/
|
|
89
|
-
|
|
90
|
-
const commandFile = path.join(process.cwd(), '.claude', 'commands', `${commandName}.md`);
|
|
91
|
-
if (!fs.existsSync(commandFile)) {
|
|
92
|
-
throw new Error(`Command not found: ${commandFile}`);
|
|
93
|
-
}
|
|
94
|
-
const content = fs.readFileSync(commandFile, 'utf-8');
|
|
49
|
+
function processTemplate(content, args) {
|
|
95
50
|
const { frontmatter, body } = parseFrontmatter(content);
|
|
96
|
-
//
|
|
51
|
+
// Validate required arguments
|
|
97
52
|
const { requiredCount, optionalPositions } = parseArgumentHint(frontmatter.argumentHint);
|
|
98
|
-
|
|
99
|
-
if (cmdArgs.length < requiredCount) {
|
|
53
|
+
if (args.length < requiredCount) {
|
|
100
54
|
const missing = [];
|
|
101
|
-
for (let i =
|
|
55
|
+
for (let i = args.length + 1; i <= requiredCount; i++) {
|
|
102
56
|
if (!optionalPositions.has(i)) {
|
|
103
57
|
missing.push(`$${i}`);
|
|
104
58
|
}
|
|
@@ -110,14 +64,39 @@ export function loadCommandTemplate(commandName, cmdArgs) {
|
|
|
110
64
|
throw new Error(`Missing required arguments: ${missing.join(', ')}${hint}`);
|
|
111
65
|
}
|
|
112
66
|
}
|
|
113
|
-
// Substitute
|
|
114
|
-
let
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
|
77
|
+
*/
|
|
78
|
+
export function loadCommandTemplate(commandName, cmdArgs) {
|
|
79
|
+
const commandFile = path.join(process.cwd(), '.claude', 'commands', `${commandName}.md`);
|
|
80
|
+
if (!fs.existsSync(commandFile)) {
|
|
81
|
+
throw new Error(`Command not found: ${commandFile}`);
|
|
82
|
+
}
|
|
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}`);
|
|
118
93
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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 };
|
|
122
101
|
}
|
|
123
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;
|
|
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,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAsC1D;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAI9C,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC5C,CAAC;IACD,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC7C,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;QACpB,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC5C,CAAC;IAED,MAAM,WAAW,GAAG,OAAO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,GAAG,CAAC,CAAC,CAAC;IAE1C,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAChC,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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"}
|
package/dist/types/index.js
CHANGED
package/dist/types/index.js.map
CHANGED
|
@@ -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"}
|
package/dist/types/runner.d.ts
CHANGED
|
@@ -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
|
*/
|
|
@@ -49,9 +56,14 @@ export interface ParsedArgs {
|
|
|
49
56
|
subcommand: Subcommand;
|
|
50
57
|
prompt: string;
|
|
51
58
|
displayCommand: string;
|
|
59
|
+
/** Display strings for script lines (for logging) */
|
|
52
60
|
scriptLines: string[];
|
|
53
61
|
scriptMode: boolean;
|
|
54
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[];
|
|
55
67
|
}
|
|
56
68
|
/**
|
|
57
69
|
* Tool call tracking
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/types/runner.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/types/runner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,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;AAEtD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,YAS5B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,qDAAqD;IACrD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9B,iDAAiD;IACjD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,yEAAyE;IACzE,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,EAAE,EAAE,MAAM,CAAC;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"}
|
package/dist/types/runner.js
CHANGED
|
@@ -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,9 +14,9 @@ export const DEFAULT_CONFIG = {
|
|
|
13
14
|
verbosity: 'normal',
|
|
14
15
|
enableLog: true,
|
|
15
16
|
logDir: 'logs',
|
|
16
|
-
maxIterations:
|
|
17
|
-
parallelThresholdMs:
|
|
18
|
-
iterationPauseMs:
|
|
17
|
+
maxIterations: DEFAULT_MAX_ITERATIONS,
|
|
18
|
+
parallelThresholdMs: DEFAULT_PARALLEL_THRESHOLD_MS,
|
|
19
|
+
iterationPauseMs: DEFAULT_ITERATION_PAUSE_MS,
|
|
19
20
|
model: null,
|
|
20
21
|
deaddrop: false,
|
|
21
22
|
};
|
package/dist/types/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/types/runner.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
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"}
|