@rcrsr/claude-code-runner 0.6.2 → 0.7.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 (40) hide show
  1. package/README.md +45 -113
  2. package/dist/cli/args.d.ts +0 -7
  3. package/dist/cli/args.d.ts.map +1 -1
  4. package/dist/cli/args.js +15 -59
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/index.js +57 -114
  7. package/dist/index.js.map +1 -1
  8. package/dist/parsers/index.d.ts +0 -1
  9. package/dist/parsers/index.d.ts.map +1 -1
  10. package/dist/parsers/index.js +0 -1
  11. package/dist/parsers/index.js.map +1 -1
  12. package/dist/rill/context.d.ts +44 -0
  13. package/dist/rill/context.d.ts.map +1 -0
  14. package/dist/rill/context.js +207 -0
  15. package/dist/rill/context.js.map +1 -0
  16. package/dist/rill/index.d.ts +8 -0
  17. package/dist/rill/index.d.ts.map +1 -0
  18. package/dist/rill/index.js +6 -0
  19. package/dist/rill/index.js.map +1 -0
  20. package/dist/rill/runner.d.ts +62 -0
  21. package/dist/rill/runner.d.ts.map +1 -0
  22. package/dist/rill/runner.js +263 -0
  23. package/dist/rill/runner.js.map +1 -0
  24. package/dist/templates/command.d.ts +9 -0
  25. package/dist/templates/command.d.ts.map +1 -1
  26. package/dist/templates/command.js +43 -9
  27. package/dist/templates/command.js.map +1 -1
  28. package/dist/types/runner.d.ts +2 -28
  29. package/dist/types/runner.d.ts.map +1 -1
  30. package/dist/types/runner.js +2 -9
  31. package/dist/types/runner.js.map +1 -1
  32. package/dist/utils/constants.d.ts +0 -4
  33. package/dist/utils/constants.d.ts.map +1 -1
  34. package/dist/utils/constants.js +0 -4
  35. package/dist/utils/constants.js.map +1 -1
  36. package/dist/utils/formatting.d.ts +5 -0
  37. package/dist/utils/formatting.d.ts.map +1 -1
  38. package/dist/utils/formatting.js +13 -0
  39. package/dist/utils/formatting.js.map +1 -1
  40. package/package.json +2 -1
@@ -1,3 +1,2 @@
1
- export * from './signals.js';
2
1
  export * from './stream.js';
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parsers/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parsers/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Claude Code Runner - Rill Runtime Context
3
+ * Provides prompt, command, and utility functions for orchestrating Claude workflows
4
+ */
5
+ import { type ObservabilityCallbacks, type RillValue, type RuntimeCallbacks, type RuntimeContext } from '@rcrsr/rill';
6
+ /** Result of executing a prompt or command */
7
+ export interface ExecutionResult {
8
+ /** Output text from Claude */
9
+ output: string;
10
+ /** Exit code from Claude CLI */
11
+ exitCode: number;
12
+ }
13
+ /** Function to execute Claude CLI */
14
+ export type ClaudeExecutor = (prompt: string, model?: string) => Promise<ExecutionResult>;
15
+ /** Options for creating runner context */
16
+ export interface RunnerContextOptions {
17
+ /** Execute Claude CLI */
18
+ executeClause: ClaudeExecutor;
19
+ /** Named variables (mapped from CLI args by caller) */
20
+ namedArgs?: Record<string, RillValue> | undefined;
21
+ /** Raw CLI args tuple ($ARGS) */
22
+ rawArgs?: string[] | undefined;
23
+ /** Environment variables ($ENV) */
24
+ env?: Record<string, string> | undefined;
25
+ /** Commands directory (for command() function) */
26
+ commandsDir?: string | undefined;
27
+ /** Default model for prompts */
28
+ defaultModel?: string | undefined;
29
+ /** Logging callbacks */
30
+ callbacks?: Partial<RuntimeCallbacks> | undefined;
31
+ /** Observability callbacks for execution monitoring */
32
+ observability?: ObservabilityCallbacks | undefined;
33
+ /** Timeout in milliseconds for async functions */
34
+ timeout?: number | undefined;
35
+ /** AbortSignal for cancellation support */
36
+ signal?: AbortSignal | undefined;
37
+ /** Regex patterns that halt execution when output matches */
38
+ autoExceptions?: string[] | undefined;
39
+ }
40
+ /**
41
+ * Create a Rill runtime context for Claude Code Runner workflows
42
+ */
43
+ export declare function createRunnerContext(options: RunnerContextOptions): RuntimeContext;
44
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/rill/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIL,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAerB,8CAA8C;AAC9C,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qCAAqC;AACrC,MAAM,MAAM,cAAc,GAAG,CAC3B,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,KACX,OAAO,CAAC,eAAe,CAAC,CAAC;AAE9B,0CAA0C;AAC1C,MAAM,WAAW,oBAAoB;IACnC,yBAAyB;IACzB,aAAa,EAAE,cAAc,CAAC;IAC9B,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,SAAS,CAAC;IAClD,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC/B,mCAAmC;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACzC,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,gCAAgC;IAChC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,wBAAwB;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC;IAClD,uDAAuD;IACvD,aAAa,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;IACnD,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,2CAA2C;IAC3C,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACjC,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACvC;AAoDD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,oBAAoB,GAC5B,cAAc,CAyMhB"}
@@ -0,0 +1,207 @@
1
+ /**
2
+ * Claude Code Runner - Rill Runtime Context
3
+ * Provides prompt, command, and utility functions for orchestrating Claude workflows
4
+ */
5
+ import { createRuntimeContext, } from '@rcrsr/rill';
6
+ import * as fs from 'fs';
7
+ import * as path from 'path';
8
+ import { printRunner } from '../output/colors.js';
9
+ import { parseFrontmatter, parseGenericFrontmatter, } from '../templates/command.js';
10
+ import { formatRillValue } from '../utils/formatting.js';
11
+ function loadCommandTemplate(name, commandsDir) {
12
+ const filePath = path.join(commandsDir, `${name}.md`);
13
+ if (!fs.existsSync(filePath)) {
14
+ throw new Error(`Command not found: ${name} (looked in ${filePath})`);
15
+ }
16
+ const content = fs.readFileSync(filePath, 'utf-8');
17
+ const { frontmatter, body } = parseFrontmatter(content);
18
+ return {
19
+ content: body,
20
+ model: frontmatter.model,
21
+ };
22
+ }
23
+ function substituteArgs(template, args) {
24
+ let result = template;
25
+ // Substitute positional args: $1, $2, etc.
26
+ for (let i = 0; i < args.length; i++) {
27
+ const value = formatRillValue(args[i] ?? null);
28
+ result = result.replace(new RegExp(`\\$${i + 1}`, 'g'), value);
29
+ }
30
+ // Substitute $ARGUMENTS with all args joined
31
+ result = result.replace(/\$ARGUMENTS/g, args.map(formatRillValue).join(' '));
32
+ // Remove unmatched $N placeholders
33
+ result = result.replace(/\$\d+/g, '');
34
+ return result;
35
+ }
36
+ // ============================================================
37
+ // RUNTIME CONTEXT FACTORY
38
+ // ============================================================
39
+ /**
40
+ * Create a Rill runtime context for Claude Code Runner workflows
41
+ */
42
+ export function createRunnerContext(options) {
43
+ const { executeClause, namedArgs = {}, rawArgs = [], env = process.env, commandsDir = '.claude/commands', defaultModel, callbacks = {}, observability, timeout, signal, autoExceptions, } = options;
44
+ // Create ccr:: namespaced functions
45
+ const functions = {
46
+ /**
47
+ * Execute a prompt with Claude
48
+ * Usage: ccr::prompt("analyze this code", "haiku")
49
+ */
50
+ 'ccr::prompt': {
51
+ params: [
52
+ { name: 'text', type: 'string' },
53
+ { name: 'model', type: 'string', defaultValue: '' },
54
+ ],
55
+ fn: async (args) => {
56
+ const text = args[0];
57
+ const model = args[1] || defaultModel;
58
+ const result = await executeClause(text, model);
59
+ return result.output;
60
+ },
61
+ },
62
+ /**
63
+ * Execute a command template
64
+ * Usage: ccr::command("create-spec", ["arg1", "arg2"])
65
+ */
66
+ 'ccr::command': {
67
+ params: [
68
+ { name: 'name', type: 'string' },
69
+ { name: 'args', type: 'list', defaultValue: [] },
70
+ ],
71
+ fn: async (args, ctx) => {
72
+ const name = args[0];
73
+ const cmdArgs = args[1];
74
+ const template = loadCommandTemplate(name, commandsDir);
75
+ const promptText = substituteArgs(template.content, cmdArgs);
76
+ const model = template.model ?? defaultModel;
77
+ const result = await executeClause(promptText, model);
78
+ ctx.pipeValue = result.output;
79
+ return result.output;
80
+ },
81
+ },
82
+ /**
83
+ * Execute a skill (slash command) directly
84
+ * Usage: ccr::skill("commit", ["--amend"])
85
+ */
86
+ 'ccr::skill': {
87
+ params: [
88
+ { name: 'name', type: 'string' },
89
+ { name: 'args', type: 'list', defaultValue: [] },
90
+ ],
91
+ fn: async (args, ctx) => {
92
+ const name = args[0];
93
+ const skillArgs = args[1].map((a) => formatRillValue(a ?? null));
94
+ const promptText = skillArgs.length > 0 ? `/${name} ${skillArgs.join(' ')}` : `/${name}`;
95
+ const result = await executeClause(promptText, defaultModel);
96
+ ctx.pipeValue = result.output;
97
+ return result.output;
98
+ },
99
+ },
100
+ /**
101
+ * Check if a file exists
102
+ * Usage: ccr::file_exists("path/to/file") -> boolean
103
+ */
104
+ 'ccr::file_exists': {
105
+ params: [{ name: 'path', type: 'string' }],
106
+ fn: (args) => fs.existsSync(args[0]),
107
+ },
108
+ /**
109
+ * Extract result from text
110
+ * Usage: ccr::get_result($text) -> { type: "...", ...attrs } | null
111
+ * Parses <ccr:result type="..." .../> or <ccr:result ...>content</ccr:result>
112
+ */
113
+ 'ccr::get_result': {
114
+ params: [{ name: 'text', type: 'string' }],
115
+ fn: (args) => {
116
+ const text = args[0];
117
+ // Match self-closing: <ccr:result ... />
118
+ // Match with content: <ccr:result ...>content</ccr:result>
119
+ const selfClosingPattern = /<ccr:result\s+([^>]*?)\/>/;
120
+ const withContentPattern = /<ccr:result\s+([^>]*)>([\s\S]*?)<\/ccr:result>/;
121
+ let attrs;
122
+ let content;
123
+ const withContentMatch = withContentPattern.exec(text);
124
+ if (withContentMatch?.[1] && withContentMatch[2]) {
125
+ attrs = withContentMatch[1];
126
+ content = withContentMatch[2].trim();
127
+ }
128
+ else {
129
+ const selfClosingMatch = selfClosingPattern.exec(text);
130
+ if (selfClosingMatch?.[1]) {
131
+ attrs = selfClosingMatch[1];
132
+ }
133
+ else {
134
+ return null;
135
+ }
136
+ }
137
+ // Parse attributes: key="value" or key='value'
138
+ const result = {};
139
+ const attrPattern = /(\w+)=["']([^"']*)["']/g;
140
+ let match;
141
+ while ((match = attrPattern.exec(attrs)) !== null) {
142
+ const key = match[1];
143
+ const value = match[2];
144
+ if (key && value !== undefined) {
145
+ result[key] = value;
146
+ }
147
+ }
148
+ if (content !== undefined) {
149
+ result['content'] = content;
150
+ }
151
+ return result;
152
+ },
153
+ },
154
+ /**
155
+ * Stop execution with error
156
+ * Usage: ccr::error("validation failed")
157
+ */
158
+ 'ccr::error': {
159
+ params: [{ name: 'message', type: 'string', defaultValue: 'Error' }],
160
+ fn: (args) => {
161
+ throw new Error(args[0]);
162
+ },
163
+ },
164
+ /**
165
+ * Read frontmatter from a file
166
+ * Usage: ccr::read_frontmatter("path/to/file.md")
167
+ * ccr::read_frontmatter("path/to/file.md", [key: "default"])
168
+ */
169
+ 'ccr::read_frontmatter': {
170
+ params: [
171
+ { name: 'path', type: 'string' },
172
+ { name: 'defaults', type: 'dict', defaultValue: {} },
173
+ ],
174
+ fn: (args) => {
175
+ const filePath = args[0];
176
+ const defaults = args[1];
177
+ if (!fs.existsSync(filePath)) {
178
+ throw new Error(`File not found: ${filePath}`);
179
+ }
180
+ const content = fs.readFileSync(filePath, 'utf-8');
181
+ const { frontmatter } = parseGenericFrontmatter(content);
182
+ return { ...defaults, ...frontmatter };
183
+ },
184
+ },
185
+ };
186
+ // Create initial variables
187
+ const variables = {
188
+ ARGS: rawArgs,
189
+ ENV: env,
190
+ ...namedArgs,
191
+ };
192
+ return createRuntimeContext({
193
+ variables,
194
+ functions,
195
+ callbacks: {
196
+ onLog: callbacks.onLog ??
197
+ ((v) => {
198
+ printRunner(formatRillValue(v));
199
+ }),
200
+ },
201
+ ...(observability && { observability }),
202
+ ...(timeout !== undefined && { timeout }),
203
+ ...(signal && { signal }),
204
+ ...(autoExceptions && { autoExceptions }),
205
+ });
206
+ }
207
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/rill/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,oBAAoB,GAMrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EACL,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAuDzD,SAAS,mBAAmB,CAC1B,IAAY,EACZ,WAAmB;IAEnB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC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AAQ,EAAE,CAAC,CAAC;gBACjD,CAAC;gBAED,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBACnD,MAAM,EAAE,WAAW,EAAE,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;gBAEzD,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,WAAW,EAAE,CAAC;YACzC,CAAC;SACF;KACF,CAAC;IAEF,2BAA2B;IAC3B,MAAM,SAAS,GAA8B;QAC3C,IAAI,EAAE,OAAO;QACb,GAAG,EAAE,GAAG;QACR,GAAG,SAAS;KACb,CAAC;IAEF,OAAO,oBAAoB,CAAC;QAC1B,SAAS;QACT,SAAS;QACT,SAAS,EAAE;YACT,KAAK,EACH,SAAS,CAAC,KAAK;gBACf,CAAC,CAAC,CAAC,EAAE,EAAE;oBACL,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;gBAClC,CAAC,CAAC;SACL;QACD,GAAG,CAAC,aAAa,IAAI,EAAE,aAAa,EAAE,CAAC;QACvC,GAAG,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,CAAC;QACzC,GAAG,CAAC,MAAM,IAAI,EAAE,MAAM,EAAE,CAAC;QACzB,GAAG,CAAC,cAAc,IAAI,EAAE,cAAc,EAAE,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Rill integration for Claude Code Runner
3
+ */
4
+ export type { ClaudeExecutor, ExecutionResult, RunnerContextOptions, } from './context.js';
5
+ export { createRunnerContext } from './context.js';
6
+ export type { RillRunnerOptions, RillRunResult, RillScriptMeta, } from './runner.js';
7
+ export { isRillScript, loadRillScript, runRillScript } from './runner.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rill/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACV,cAAc,EACd,eAAe,EACf,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Rill integration for Claude Code Runner
3
+ */
4
+ export { createRunnerContext } from './context.js';
5
+ export { isRillScript, loadRillScript, runRillScript } from './runner.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rill/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMnD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Rill Script Runner
3
+ *
4
+ * Executes .rill scripts using the Rill parser and runtime,
5
+ * integrated with the existing Claude runner infrastructure.
6
+ */
7
+ import { type FormatterState } from '../output/formatter.js';
8
+ import type { Logger } from '../output/logger.js';
9
+ import type { RunnerConfig } from '../types/runner.js';
10
+ export interface RillRunnerOptions {
11
+ /** Path to .rill script file */
12
+ scriptFile: string;
13
+ /** Script arguments */
14
+ args: string[];
15
+ /** Runner configuration */
16
+ config: RunnerConfig;
17
+ /** Logger instance */
18
+ logger: Logger;
19
+ /** Formatter state for output */
20
+ formatterState: FormatterState;
21
+ /** Working directory */
22
+ cwd: string;
23
+ /** Run ID for logging */
24
+ runId: string;
25
+ }
26
+ export interface RillRunResult {
27
+ /** Whether the script completed successfully */
28
+ success: boolean;
29
+ /** Last output from Claude (for capture) */
30
+ lastOutput: string;
31
+ }
32
+ /** Parsed argument definition from frontmatter */
33
+ export interface RillArgDef {
34
+ name: string;
35
+ type: 'string' | 'number' | 'bool';
36
+ required: boolean;
37
+ defaultValue?: string | number | boolean | undefined;
38
+ }
39
+ export interface RillScriptMeta {
40
+ /** Model from frontmatter */
41
+ model?: string | undefined;
42
+ /** Description from frontmatter */
43
+ description?: string | undefined;
44
+ /** Named argument definitions */
45
+ args?: RillArgDef[] | undefined;
46
+ }
47
+ /**
48
+ * Load a .rill script file, extracting frontmatter and body
49
+ */
50
+ export declare function loadRillScript(scriptFile: string): {
51
+ source: string;
52
+ meta: RillScriptMeta;
53
+ };
54
+ /**
55
+ * Execute a Rill script
56
+ */
57
+ export declare function runRillScript(options: RillRunnerOptions): Promise<RillRunResult>;
58
+ /**
59
+ * Check if a file is a Rill script
60
+ */
61
+ export declare function isRillScript(filename: string): boolean;
62
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/rill/runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQvD,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,2BAA2B;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,cAAc,EAAE,cAAc,CAAC;IAC/B,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,kDAAkD;AAClD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,WAAW,cAAc;IAC7B,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,iCAAiC;IACjC,IAAI,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;CACjC;AAwDD;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,cAAc,CAAC;CACtB,CAsBA;AAMD;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,aAAa,CAAC,CAwLxB;AAMD;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEtD"}
@@ -0,0 +1,263 @@
1
+ /**
2
+ * Rill Script Runner
3
+ *
4
+ * Executes .rill scripts using the Rill parser and runtime,
5
+ * integrated with the existing Claude runner infrastructure.
6
+ */
7
+ import { AbortError, execute, parse, ParseError, RuntimeError, TimeoutError, } from '@rcrsr/rill';
8
+ import * as fs from 'fs';
9
+ import { colors, printRunner } from '../output/colors.js';
10
+ import { finalizeStepStats } from '../output/formatter.js';
11
+ import { spawnClaude } from '../process/pty.js';
12
+ import { parseFrontmatter } from '../templates/command.js';
13
+ import { formatRillValue } from '../utils/formatting.js';
14
+ import { createRunnerContext } from './context.js';
15
+ // ============================================================
16
+ // SCRIPT LOADING
17
+ // ============================================================
18
+ /**
19
+ * Parse args definition from frontmatter
20
+ * Format: "file: string, retries: number = 3"
21
+ */
22
+ function parseArgsDefinition(argsStr) {
23
+ if (!argsStr.trim())
24
+ return [];
25
+ const defs = [];
26
+ // Split by comma, but handle potential commas in default values
27
+ const parts = argsStr.split(/,(?![^[]*])/).map((s) => s.trim());
28
+ for (const part of parts) {
29
+ if (!part)
30
+ continue;
31
+ // Pattern: name: type or name: type = default
32
+ const match = /^(\w+)\s*:\s*(string|number|bool)(?:\s*=\s*(.+))?$/.exec(part);
33
+ if (!match) {
34
+ throw new Error(`Invalid arg definition: ${part}`);
35
+ }
36
+ const [, name, type, defaultStr] = match;
37
+ if (!name || !type)
38
+ continue;
39
+ const def = {
40
+ name,
41
+ type: type,
42
+ required: defaultStr === undefined,
43
+ };
44
+ // Parse default value
45
+ if (defaultStr !== undefined) {
46
+ const trimmed = defaultStr.trim();
47
+ if (type === 'number') {
48
+ def.defaultValue = Number(trimmed);
49
+ }
50
+ else if (type === 'bool') {
51
+ def.defaultValue = trimmed === 'true';
52
+ }
53
+ else {
54
+ // String - remove quotes if present
55
+ def.defaultValue = trimmed.replace(/^["']|["']$/g, '');
56
+ }
57
+ }
58
+ defs.push(def);
59
+ }
60
+ return defs;
61
+ }
62
+ /**
63
+ * Load a .rill script file, extracting frontmatter and body
64
+ */
65
+ export function loadRillScript(scriptFile) {
66
+ if (!fs.existsSync(scriptFile)) {
67
+ throw new Error(`Script not found: ${scriptFile}`);
68
+ }
69
+ const content = fs.readFileSync(scriptFile, 'utf-8');
70
+ const { frontmatter, body } = parseFrontmatter(content);
71
+ // Parse args definition if present
72
+ let argsDefs;
73
+ if (frontmatter.args) {
74
+ argsDefs = parseArgsDefinition(frontmatter.args);
75
+ }
76
+ return {
77
+ source: body,
78
+ meta: {
79
+ model: frontmatter.model,
80
+ description: frontmatter.description,
81
+ args: argsDefs,
82
+ },
83
+ };
84
+ }
85
+ // ============================================================
86
+ // RUNNER
87
+ // ============================================================
88
+ /**
89
+ * Execute a Rill script
90
+ */
91
+ export async function runRillScript(options) {
92
+ const { scriptFile, args, config, logger, formatterState, cwd, runId } = options;
93
+ // Load and parse script
94
+ const { source, meta } = loadRillScript(scriptFile);
95
+ // Use frontmatter model if no CLI override
96
+ const effectiveModel = config.model ?? meta.model ?? null;
97
+ // Map CLI args to named variables based on frontmatter definition
98
+ const namedArgs = {};
99
+ if (meta.args) {
100
+ for (let i = 0; i < meta.args.length; i++) {
101
+ const argDef = meta.args[i];
102
+ if (!argDef)
103
+ continue;
104
+ const cliValue = args[i];
105
+ if (cliValue !== undefined) {
106
+ // Convert CLI string to appropriate type
107
+ if (argDef.type === 'number') {
108
+ namedArgs[argDef.name] = Number(cliValue);
109
+ }
110
+ else if (argDef.type === 'bool') {
111
+ namedArgs[argDef.name] = cliValue === 'true';
112
+ }
113
+ else {
114
+ namedArgs[argDef.name] = cliValue;
115
+ }
116
+ }
117
+ else if (argDef.defaultValue !== undefined) {
118
+ namedArgs[argDef.name] = argDef.defaultValue;
119
+ }
120
+ else if (argDef.required) {
121
+ throw new Error(`Missing required argument: ${argDef.name}`);
122
+ }
123
+ }
124
+ }
125
+ // Parse the Rill script
126
+ const ast = parse(source);
127
+ // Track execution state (use object to allow mutation in closures)
128
+ const state = {
129
+ lastOutput: '',
130
+ stepNum: 0,
131
+ };
132
+ // Create Claude executor that uses the existing infrastructure
133
+ const executeClause = async (prompt, model) => {
134
+ state.stepNum++;
135
+ formatterState.currentStep = state.stepNum;
136
+ formatterState.stepStartTime = Date.now();
137
+ // Log step start
138
+ const preview = prompt.length > 50 ? prompt.slice(0, 50) + '...' : prompt;
139
+ logger.logEvent({
140
+ event: 'step_start',
141
+ step: state.stepNum,
142
+ prompt: preview,
143
+ });
144
+ if (config.verbosity !== 'quiet') {
145
+ printRunner(`Running step ${state.stepNum}: "${preview}"`);
146
+ }
147
+ // Execute via existing PTY infrastructure
148
+ const result = await spawnClaude({
149
+ prompt,
150
+ cwd,
151
+ verbosity: config.verbosity,
152
+ logger,
153
+ formatterState,
154
+ parallelThresholdMs: config.parallelThresholdMs,
155
+ model: model ?? effectiveModel,
156
+ });
157
+ // Finalize step stats (merge into runStats for final summary)
158
+ const stepDurationMs = formatterState.stepStartTime
159
+ ? Date.now() - formatterState.stepStartTime
160
+ : 0;
161
+ finalizeStepStats(formatterState, stepDurationMs);
162
+ // Log completion
163
+ logger.logEvent({
164
+ event: 'step_complete',
165
+ step: state.stepNum,
166
+ exit: result.exitCode,
167
+ });
168
+ return {
169
+ output: result.claudeText,
170
+ exitCode: result.exitCode,
171
+ };
172
+ };
173
+ // Logging callback
174
+ const callbacks = {
175
+ onLog: (value) => {
176
+ const text = formatRillValue(value);
177
+ printRunner(text);
178
+ logger.log(`[LOG] ${text}`);
179
+ },
180
+ };
181
+ // Create Rill runtime context
182
+ const ctx = createRunnerContext({
183
+ executeClause,
184
+ namedArgs,
185
+ rawArgs: args,
186
+ env: process.env,
187
+ commandsDir: '.claude/commands',
188
+ defaultModel: effectiveModel ?? undefined,
189
+ callbacks,
190
+ });
191
+ // Execute the script
192
+ try {
193
+ logger.logEvent({ event: 'rill_script_start', runId, file: scriptFile });
194
+ const result = await execute(ast, ctx);
195
+ // Update last output from final result
196
+ if (result.value !== null) {
197
+ state.lastOutput = formatRillValue(result.value);
198
+ }
199
+ logger.logEvent({
200
+ event: 'rill_script_complete',
201
+ runId,
202
+ success: true,
203
+ });
204
+ return {
205
+ success: true,
206
+ lastOutput: state.lastOutput,
207
+ };
208
+ }
209
+ catch (error) {
210
+ // Handle specific Rill error types
211
+ if (error instanceof AbortError) {
212
+ printRunner(`${colors.yellow}Script cancelled${colors.reset}`);
213
+ logger.logEvent({ event: 'rill_script_cancelled', runId });
214
+ return {
215
+ success: false,
216
+ lastOutput: state.lastOutput,
217
+ };
218
+ }
219
+ if (error instanceof TimeoutError) {
220
+ const msg = `Timeout: ${error.message}`;
221
+ printRunner(`${colors.red}${msg}${colors.reset}`);
222
+ logger.logEvent({ event: 'rill_script_timeout', runId, error: msg });
223
+ return { success: false, lastOutput: state.lastOutput };
224
+ }
225
+ if (error instanceof ParseError) {
226
+ const location = error.location
227
+ ? ` at line ${error.location.line}:${error.location.column}`
228
+ : '';
229
+ const msg = `Parse error${location}: ${error.message}`;
230
+ printRunner(`${colors.red}${msg}${colors.reset}`);
231
+ logger.logEvent({ event: 'rill_script_parse_error', runId, error: msg });
232
+ return { success: false, lastOutput: state.lastOutput };
233
+ }
234
+ if (error instanceof RuntimeError) {
235
+ const location = error.location
236
+ ? ` at line ${error.location.line}:${error.location.column}`
237
+ : '';
238
+ const msg = `Runtime error${location}: ${error.message}`;
239
+ printRunner(`${colors.red}${msg}${colors.reset}`);
240
+ logger.logEvent({
241
+ event: 'rill_script_runtime_error',
242
+ runId,
243
+ error: msg,
244
+ });
245
+ return { success: false, lastOutput: state.lastOutput };
246
+ }
247
+ // Generic error fallback
248
+ const msg = error instanceof Error ? error.message : String(error);
249
+ printRunner(`${colors.red}Script error:${colors.reset} ${msg}`);
250
+ logger.logEvent({ event: 'rill_script_error', runId, error: msg });
251
+ return { success: false, lastOutput: state.lastOutput };
252
+ }
253
+ }
254
+ // ============================================================
255
+ // DETECTION
256
+ // ============================================================
257
+ /**
258
+ * Check if a file is a Rill script
259
+ */
260
+ export function isRillScript(filename) {
261
+ return filename.endsWith('.rill');
262
+ }
263
+ //# sourceMappingURL=runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/rill/runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,UAAU,EACV,OAAO,EACP,KAAK,EACL,UAAU,EACV,YAAY,EACZ,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAuB,MAAM,wBAAwB,CAAC;AAEhF,OAAO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