@rcrsr/rill-cli 0.15.0 → 0.17.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 (125) hide show
  1. package/dist/check/config.d.ts +0 -1
  2. package/dist/check/config.js +0 -1
  3. package/dist/check/fixer.d.ts +0 -1
  4. package/dist/check/fixer.js +0 -1
  5. package/dist/check/index.d.ts +0 -1
  6. package/dist/check/index.js +0 -1
  7. package/dist/check/rules/anti-patterns.d.ts +0 -1
  8. package/dist/check/rules/anti-patterns.js +0 -1
  9. package/dist/check/rules/closures.d.ts +0 -1
  10. package/dist/check/rules/closures.js +0 -1
  11. package/dist/check/rules/collections.d.ts +0 -1
  12. package/dist/check/rules/collections.js +0 -1
  13. package/dist/check/rules/conditionals.d.ts +0 -1
  14. package/dist/check/rules/conditionals.js +0 -1
  15. package/dist/check/rules/flow.d.ts +0 -1
  16. package/dist/check/rules/flow.js +0 -1
  17. package/dist/check/rules/formatting.d.ts +0 -1
  18. package/dist/check/rules/formatting.js +0 -1
  19. package/dist/check/rules/helpers.d.ts +0 -1
  20. package/dist/check/rules/helpers.js +0 -1
  21. package/dist/check/rules/index.d.ts +0 -1
  22. package/dist/check/rules/index.js +0 -1
  23. package/dist/check/rules/loops.d.ts +0 -1
  24. package/dist/check/rules/loops.js +0 -1
  25. package/dist/check/rules/naming.d.ts +0 -1
  26. package/dist/check/rules/naming.js +0 -1
  27. package/dist/check/rules/strings.d.ts +0 -1
  28. package/dist/check/rules/strings.js +0 -1
  29. package/dist/check/rules/types.d.ts +0 -1
  30. package/dist/check/rules/types.js +0 -1
  31. package/dist/check/rules/use-expressions.d.ts +0 -1
  32. package/dist/check/rules/use-expressions.js +0 -1
  33. package/dist/check/types.d.ts +0 -1
  34. package/dist/check/types.js +0 -1
  35. package/dist/check/validator.d.ts +0 -1
  36. package/dist/check/validator.js +0 -1
  37. package/dist/check/visitor.d.ts +0 -1
  38. package/dist/check/visitor.js +4 -2
  39. package/dist/cli-check.d.ts +0 -1
  40. package/dist/cli-check.js +0 -1
  41. package/dist/cli-error-enrichment.d.ts +0 -1
  42. package/dist/cli-error-enrichment.js +0 -1
  43. package/dist/cli-error-formatter.d.ts +0 -1
  44. package/dist/cli-error-formatter.js +0 -1
  45. package/dist/cli-eval.d.ts +0 -1
  46. package/dist/cli-eval.js +0 -1
  47. package/dist/cli-exec.d.ts +0 -1
  48. package/dist/cli-exec.js +0 -1
  49. package/dist/cli-explain.d.ts +0 -1
  50. package/dist/cli-explain.js +0 -1
  51. package/dist/cli-lsp-diagnostic.d.ts +0 -1
  52. package/dist/cli-lsp-diagnostic.js +0 -1
  53. package/dist/cli-module-loader.d.ts +0 -1
  54. package/dist/cli-module-loader.js +0 -1
  55. package/dist/cli-run.d.ts +0 -1
  56. package/dist/cli-run.js +47 -14
  57. package/dist/cli-shared.d.ts +0 -1
  58. package/dist/cli-shared.js +0 -1
  59. package/dist/run/runner.d.ts +8 -9
  60. package/dist/run/runner.js +22 -69
  61. package/dist/run/types.d.ts +1 -2
  62. package/dist/run/types.js +0 -1
  63. package/package.json +4 -3
  64. package/dist/check/config.d.ts.map +0 -1
  65. package/dist/check/config.js.map +0 -1
  66. package/dist/check/fixer.d.ts.map +0 -1
  67. package/dist/check/fixer.js.map +0 -1
  68. package/dist/check/index.d.ts.map +0 -1
  69. package/dist/check/index.js.map +0 -1
  70. package/dist/check/rules/anti-patterns.d.ts.map +0 -1
  71. package/dist/check/rules/anti-patterns.js.map +0 -1
  72. package/dist/check/rules/closures.d.ts.map +0 -1
  73. package/dist/check/rules/closures.js.map +0 -1
  74. package/dist/check/rules/collections.d.ts.map +0 -1
  75. package/dist/check/rules/collections.js.map +0 -1
  76. package/dist/check/rules/conditionals.d.ts.map +0 -1
  77. package/dist/check/rules/conditionals.js.map +0 -1
  78. package/dist/check/rules/flow.d.ts.map +0 -1
  79. package/dist/check/rules/flow.js.map +0 -1
  80. package/dist/check/rules/formatting.d.ts.map +0 -1
  81. package/dist/check/rules/formatting.js.map +0 -1
  82. package/dist/check/rules/helpers.d.ts.map +0 -1
  83. package/dist/check/rules/helpers.js.map +0 -1
  84. package/dist/check/rules/index.d.ts.map +0 -1
  85. package/dist/check/rules/index.js.map +0 -1
  86. package/dist/check/rules/loops.d.ts.map +0 -1
  87. package/dist/check/rules/loops.js.map +0 -1
  88. package/dist/check/rules/naming.d.ts.map +0 -1
  89. package/dist/check/rules/naming.js.map +0 -1
  90. package/dist/check/rules/strings.d.ts.map +0 -1
  91. package/dist/check/rules/strings.js.map +0 -1
  92. package/dist/check/rules/types.d.ts.map +0 -1
  93. package/dist/check/rules/types.js.map +0 -1
  94. package/dist/check/rules/use-expressions.d.ts.map +0 -1
  95. package/dist/check/rules/use-expressions.js.map +0 -1
  96. package/dist/check/types.d.ts.map +0 -1
  97. package/dist/check/types.js.map +0 -1
  98. package/dist/check/validator.d.ts.map +0 -1
  99. package/dist/check/validator.js.map +0 -1
  100. package/dist/check/visitor.d.ts.map +0 -1
  101. package/dist/check/visitor.js.map +0 -1
  102. package/dist/cli-check.d.ts.map +0 -1
  103. package/dist/cli-check.js.map +0 -1
  104. package/dist/cli-error-enrichment.d.ts.map +0 -1
  105. package/dist/cli-error-enrichment.js.map +0 -1
  106. package/dist/cli-error-formatter.d.ts.map +0 -1
  107. package/dist/cli-error-formatter.js.map +0 -1
  108. package/dist/cli-eval.d.ts.map +0 -1
  109. package/dist/cli-eval.js.map +0 -1
  110. package/dist/cli-exec.d.ts.map +0 -1
  111. package/dist/cli-exec.js.map +0 -1
  112. package/dist/cli-explain.d.ts.map +0 -1
  113. package/dist/cli-explain.js.map +0 -1
  114. package/dist/cli-lsp-diagnostic.d.ts.map +0 -1
  115. package/dist/cli-lsp-diagnostic.js.map +0 -1
  116. package/dist/cli-module-loader.d.ts.map +0 -1
  117. package/dist/cli-module-loader.js.map +0 -1
  118. package/dist/cli-run.d.ts.map +0 -1
  119. package/dist/cli-run.js.map +0 -1
  120. package/dist/cli-shared.d.ts.map +0 -1
  121. package/dist/cli-shared.js.map +0 -1
  122. package/dist/run/runner.d.ts.map +0 -1
  123. package/dist/run/runner.js.map +0 -1
  124. package/dist/run/types.d.ts.map +0 -1
  125. package/dist/run/types.js.map +0 -1
@@ -17,4 +17,3 @@ export declare function createDefaultConfig(): CheckConfig;
17
17
  * @throws Error with "Invalid configuration: unknown rule {code}" if unknown rule [EC-4]
18
18
  */
19
19
  export declare function loadConfig(cwd: string): CheckConfig | null;
20
- //# sourceMappingURL=config.d.ts.map
@@ -148,4 +148,3 @@ export function loadConfig(cwd) {
148
148
  validateRuleCodes(config);
149
149
  return config;
150
150
  }
151
- //# sourceMappingURL=config.js.map
@@ -36,4 +36,3 @@ export interface ApplyResult {
36
36
  * @throws Error if applied fixes create invalid syntax [EC-6]
37
37
  */
38
38
  export declare function applyFixes(source: string, diagnostics: Diagnostic[], _context: ValidationContext): ApplyResult;
39
- //# sourceMappingURL=fixer.d.ts.map
@@ -116,4 +116,3 @@ function filterCollisions(sortedFixes) {
116
116
  function rangesOverlap(a, b) {
117
117
  return a.start < b.end && a.end > b.start;
118
118
  }
119
- //# sourceMappingURL=fixer.js.map
@@ -7,4 +7,3 @@ export { VALIDATION_RULES } from './rules/index.js';
7
7
  export { loadConfig, createDefaultConfig } from './config.js';
8
8
  export { validateScript } from './validator.js';
9
9
  export { applyFixes, type ApplyResult } from './fixer.js';
10
- //# sourceMappingURL=index.d.ts.map
@@ -18,4 +18,3 @@ export { validateScript } from './validator.js';
18
18
  // FIX APPLICATION
19
19
  // ============================================================
20
20
  export { applyFixes } from './fixer.js';
21
- //# sourceMappingURL=index.js.map
@@ -62,4 +62,3 @@ export declare const COMPLEX_CONDITION: ValidationRule;
62
62
  * - docs/topic-variables.md (Scope Rules)
63
63
  */
64
64
  export declare const LOOP_OUTER_CAPTURE: ValidationRule;
65
- //# sourceMappingURL=anti-patterns.d.ts.map
@@ -478,4 +478,3 @@ function getParenNestingDepth(node) {
478
478
  traverse(node, 0);
479
479
  return maxDepth;
480
480
  }
481
- //# sourceMappingURL=anti-patterns.js.map
@@ -63,4 +63,3 @@ export declare const CLOSURE_BRACES: ValidationRule;
63
63
  * - docs/topic-closures.md: Late binding section
64
64
  */
65
65
  export declare const CLOSURE_LATE_BINDING: ValidationRule;
66
- //# sourceMappingURL=closures.d.ts.map
@@ -367,4 +367,3 @@ function containsExplicitCapture(node) {
367
367
  }
368
368
  return false;
369
369
  }
370
- //# sourceMappingURL=closures.js.map
@@ -87,4 +87,3 @@ export declare const FILTER_NEGATION: ValidationRule;
87
87
  * - docs/guide-conventions.md:90-149
88
88
  */
89
89
  export declare const METHOD_SHORTHAND: ValidationRule;
90
- //# sourceMappingURL=collections.d.ts.map
@@ -370,4 +370,3 @@ export const METHOD_SHORTHAND = {
370
370
  return [];
371
371
  },
372
372
  };
373
- //# sourceMappingURL=collections.js.map
@@ -38,4 +38,3 @@ export declare const USE_DEFAULT_OPERATOR: ValidationRule;
38
38
  * - docs/guide-conventions.md:199-215
39
39
  */
40
40
  export declare const CONDITION_TYPE: ValidationRule;
41
- //# sourceMappingURL=conditionals.d.ts.map
@@ -131,4 +131,3 @@ export const CONDITION_TYPE = {
131
131
  return [];
132
132
  },
133
133
  };
134
- //# sourceMappingURL=conditionals.js.map
@@ -43,4 +43,3 @@ export declare const CAPTURE_INLINE_CHAIN: ValidationRule;
43
43
  * - docs/guide-conventions.md:76-88
44
44
  */
45
45
  export declare const CAPTURE_BEFORE_BRANCH: ValidationRule;
46
- //# sourceMappingURL=flow.d.ts.map
@@ -203,4 +203,3 @@ export const CAPTURE_BEFORE_BRANCH = {
203
203
  return [];
204
204
  },
205
205
  };
206
- //# sourceMappingURL=flow.js.map
@@ -140,4 +140,3 @@ export declare const THROWAWAY_CAPTURE: ValidationRule;
140
140
  * of edge cases (null spans, invalid coordinates).
141
141
  */
142
142
  export declare function isValidSpan(span: SourceSpan | null | undefined): boolean;
143
- //# sourceMappingURL=formatting.d.ts.map
@@ -657,4 +657,3 @@ function extractSpanText(span, source) {
657
657
  function escapeRegex(str) {
658
658
  return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
659
659
  }
660
- //# sourceMappingURL=formatting.js.map
@@ -23,4 +23,3 @@ export declare function extractContextLine(line: number, source: string): string
23
23
  * @returns true if expr is a bare $ reference, false otherwise
24
24
  */
25
25
  export declare function isBareReference(expr: ExpressionNode | null | undefined): boolean;
26
- //# sourceMappingURL=helpers.d.ts.map
@@ -63,4 +63,3 @@ export function isBareReference(expr) {
63
63
  variable.defaultValue === null &&
64
64
  variable.existenceCheck === null);
65
65
  }
66
- //# sourceMappingURL=helpers.js.map
@@ -19,4 +19,3 @@ export { USE_DYNAMIC_IDENTIFIER, USE_UNTYPED_HOST_REF, } from './use-expressions
19
19
  * Rules are applied during AST traversal via the validator.
20
20
  */
21
21
  export declare const VALIDATION_RULES: ValidationRule[];
22
- //# sourceMappingURL=index.d.ts.map
@@ -80,4 +80,3 @@ export const VALIDATION_RULES = [
80
80
  USE_DYNAMIC_IDENTIFIER,
81
81
  USE_UNTYPED_HOST_REF,
82
82
  ];
83
- //# sourceMappingURL=index.js.map
@@ -74,4 +74,3 @@ export declare const PREFER_DO_WHILE: ValidationRule;
74
74
  * - docs/guide-conventions.md:188-196
75
75
  */
76
76
  export declare const USE_EACH: ValidationRule;
77
- //# sourceMappingURL=loops.d.ts.map
@@ -307,4 +307,3 @@ export const USE_EACH = {
307
307
  return [];
308
308
  },
309
309
  };
310
- //# sourceMappingURL=loops.js.map
@@ -18,4 +18,3 @@ import type { ValidationRule } from '../types.js';
18
18
  * - docs/guide-conventions.md:10-53
19
19
  */
20
20
  export declare const NAMING_SNAKE_CASE: ValidationRule;
21
- //# sourceMappingURL=naming.d.ts.map
@@ -171,4 +171,3 @@ export const NAMING_SNAKE_CASE = {
171
171
  };
172
172
  },
173
173
  };
174
- //# sourceMappingURL=naming.js.map
@@ -25,4 +25,3 @@ import type { ValidationRule } from '../types.js';
25
25
  * - docs/guide-conventions.md:333-345
26
26
  */
27
27
  export declare const USE_EMPTY_METHOD: ValidationRule;
28
- //# sourceMappingURL=strings.d.ts.map
@@ -76,4 +76,3 @@ function isEmptyStringLiteral(node) {
76
76
  }
77
77
  return false;
78
78
  }
79
- //# sourceMappingURL=strings.js.map
@@ -38,4 +38,3 @@ export declare const UNNECESSARY_ASSERTION: ValidationRule;
38
38
  * - docs/guide-conventions.md:307-311
39
39
  */
40
40
  export declare const VALIDATE_EXTERNAL: ValidationRule;
41
- //# sourceMappingURL=types.d.ts.map
@@ -190,4 +190,3 @@ export const VALIDATE_EXTERNAL = {
190
190
  ];
191
191
  },
192
192
  };
193
- //# sourceMappingURL=types.js.map
@@ -28,4 +28,3 @@ export declare const USE_DYNAMIC_IDENTIFIER: ValidationRule;
28
28
  * - docs/guide-conventions.md checker modes section
29
29
  */
30
30
  export declare const USE_UNTYPED_HOST_REF: ValidationRule;
31
- //# sourceMappingURL=use-expressions.d.ts.map
@@ -98,4 +98,3 @@ export const USE_UNTYPED_HOST_REF = {
98
98
  ];
99
99
  },
100
100
  };
101
- //# sourceMappingURL=use-expressions.js.map
@@ -115,4 +115,3 @@ export interface ValidationRule {
115
115
  */
116
116
  fix?(node: ASTNode, context: FixContext): Fix | null;
117
117
  }
118
- //# sourceMappingURL=types.d.ts.map
@@ -3,4 +3,3 @@
3
3
  * Type definitions for the rill-check static analysis tool.
4
4
  */
5
5
  export {};
6
- //# sourceMappingURL=types.js.map
@@ -15,4 +15,3 @@ import type { CheckConfig, Diagnostic } from './types.js';
15
15
  * @returns Array of diagnostics sorted by location
16
16
  */
17
17
  export declare function validateScript(ast: ScriptNode, source: string, config: CheckConfig): Diagnostic[];
18
- //# sourceMappingURL=validator.d.ts.map
@@ -107,4 +107,3 @@ function sortDiagnostics(diagnostics) {
107
107
  return a.location.column - b.location.column;
108
108
  });
109
109
  }
110
- //# sourceMappingURL=validator.js.map
@@ -30,4 +30,3 @@ export interface RuleVisitor {
30
30
  * 3. visitor.exit(node)
31
31
  */
32
32
  export declare function visitNode(node: ASTNode, context: ValidationContext, visitor: RuleVisitor): void;
33
- //# sourceMappingURL=visitor.d.ts.map
@@ -280,7 +280,10 @@ export function visitNode(node, context, visitor) {
280
280
  break;
281
281
  case 'TypeConstructor':
282
282
  for (const arg of node.args) {
283
- visitNode(arg.value, context, visitor);
283
+ // arg.value is a TypeRef (not an ASTNode) — skip it
284
+ if (arg.defaultValue) {
285
+ visitNode(arg.defaultValue, context, visitor);
286
+ }
284
287
  }
285
288
  break;
286
289
  case 'ClosureSigLiteral':
@@ -304,4 +307,3 @@ export function visitNode(node, context, visitor) {
304
307
  // Exit callback after children
305
308
  visitor.exit(node, context);
306
309
  }
307
- //# sourceMappingURL=visitor.js.map
@@ -40,4 +40,3 @@ export declare function parseCheckArgs(argv: string[]): ParsedCheckArgs;
40
40
  * @returns Formatted output string
41
41
  */
42
42
  export declare function formatDiagnostics(file: string, diagnostics: Diagnostic[], format: 'text' | 'json', verbose: boolean): string;
43
- //# sourceMappingURL=cli-check.d.ts.map
package/dist/cli-check.js CHANGED
@@ -363,4 +363,3 @@ const shouldRunMain = process.env['NODE_ENV'] !== 'test' &&
363
363
  if (shouldRunMain) {
364
364
  main();
365
365
  }
366
- //# sourceMappingURL=cli-check.js.map
@@ -70,4 +70,3 @@ export declare function suggestSimilarNames(target: string, candidates: string[]
70
70
  * @throws {TypeError} When source is not a string or error is null
71
71
  */
72
72
  export declare function enrichError(error: RillError, source: string, scope?: ScopeInfo): EnrichedError;
73
- //# sourceMappingURL=cli-error-enrichment.d.ts.map
@@ -195,4 +195,3 @@ export function enrichError(error, source, scope) {
195
195
  helpUrl: error.helpUrl,
196
196
  };
197
197
  }
198
- //# sourceMappingURL=cli-error-enrichment.js.map
@@ -42,4 +42,3 @@ export declare function formatError(error: EnrichedError, options: FormatOptions
42
42
  * @throws {RangeError} Invalid span (start after end)
43
43
  */
44
44
  export declare function renderCaretUnderline(span: SourceSpan, lineContent: string): string;
45
- //# sourceMappingURL=cli-error-formatter.d.ts.map
@@ -215,4 +215,3 @@ export function renderCaretUnderline(span, lineContent) {
215
215
  const carets = '^'.repeat(caretCount);
216
216
  return padding + carets;
217
217
  }
218
- //# sourceMappingURL=cli-error-formatter.js.map
@@ -12,4 +12,3 @@ import { type ExecutionResult } from '@rcrsr/rill';
12
12
  * Evaluate a Rill expression without file context
13
13
  */
14
14
  export declare function evaluateExpression(expression: string): Promise<ExecutionResult>;
15
- //# sourceMappingURL=cli-eval.d.ts.map
package/dist/cli-eval.js CHANGED
@@ -114,4 +114,3 @@ const shouldRunMain = process.env['NODE_ENV'] !== 'test' &&
114
114
  if (shouldRunMain) {
115
115
  main();
116
116
  }
117
- //# sourceMappingURL=cli-eval.js.map
@@ -55,4 +55,3 @@ export declare function executeScript(file: string, args: string[], options?: {
55
55
  * Sets process.exit(1) on any error.
56
56
  */
57
57
  export declare function main(): Promise<void>;
58
- //# sourceMappingURL=cli-exec.d.ts.map
package/dist/cli-exec.js CHANGED
@@ -298,4 +298,3 @@ const shouldRunMain = process.env['NODE_ENV'] !== 'test' &&
298
298
  if (shouldRunMain) {
299
299
  main();
300
300
  }
301
- //# sourceMappingURL=cli-exec.js.map
@@ -21,4 +21,3 @@
21
21
  * // Returns: null
22
22
  */
23
23
  export declare function explainError(errorId: string): string | null;
24
- //# sourceMappingURL=cli-explain.d.ts.map
@@ -65,4 +65,3 @@ export function explainError(errorId) {
65
65
  }
66
66
  return sections.join('\n').trimEnd();
67
67
  }
68
- //# sourceMappingURL=cli-explain.js.map
@@ -32,4 +32,3 @@ export interface LspPosition {
32
32
  * @returns LSP Diagnostic
33
33
  */
34
34
  export declare function toLspDiagnostic(error: RillError): LspDiagnostic;
35
- //# sourceMappingURL=cli-lsp-diagnostic.d.ts.map
@@ -95,4 +95,3 @@ function mapSeverityToLsp(severity) {
95
95
  return 1;
96
96
  }
97
97
  }
98
- //# sourceMappingURL=cli-lsp-diagnostic.js.map
@@ -16,4 +16,3 @@ import type { RillValue } from '@rcrsr/rill';
16
16
  * @throws Error if module not found or circular dependency detected
17
17
  */
18
18
  export declare function loadModule(specifier: string, fromPath: string, cache: Map<string, Record<string, RillValue>>, chain?: Set<string>): Promise<Record<string, RillValue>>;
19
- //# sourceMappingURL=cli-module-loader.d.ts.map
@@ -56,4 +56,3 @@ export async function loadModule(specifier, fromPath, cache, chain = new Set())
56
56
  chain.delete(absolutePath);
57
57
  }
58
58
  }
59
- //# sourceMappingURL=cli-module-loader.js.map
package/dist/cli-run.d.ts CHANGED
@@ -8,4 +8,3 @@ export declare function parseCliArgs(argv?: string[]): RunCliOptions & {
8
8
  rootDir?: string | undefined;
9
9
  };
10
10
  export declare function main(): Promise<void>;
11
- //# sourceMappingURL=cli-run.d.ts.map
package/dist/cli-run.js CHANGED
@@ -26,7 +26,7 @@ Options:
26
26
  --format <mode> Output format: human, json, compact (default: human)
27
27
  --verbose Show full error details (default: false)
28
28
  --max-stack-depth <n> Error stack frame limit (default: 10)
29
- --create-bindings Write bindings source to config-defined file and exit
29
+ --create-bindings [dir] Write bindings source to dir and exit (default: ./bindings)
30
30
  --explain <code> Print error code documentation
31
31
  --help Print this help message and exit
32
32
  --version Print version and exit`.trimEnd();
@@ -38,17 +38,42 @@ const BASE_OPTIONS = {
38
38
  format: { type: 'string' },
39
39
  verbose: { type: 'boolean' },
40
40
  'max-stack-depth': { type: 'string' },
41
- 'create-bindings': { type: 'boolean' },
42
41
  help: { type: 'boolean' },
43
42
  version: { type: 'boolean' },
44
43
  explain: { type: 'string' },
45
44
  };
46
45
  // ============================================================
46
+ // CREATE-BINDINGS EXTRACTION
47
+ // ============================================================
48
+ /**
49
+ * Extract --create-bindings [dir] from argv before parseArgs.
50
+ * Handles the optional dir argument that parseArgs cannot natively support.
51
+ * Returns the filtered argv (with --create-bindings removed) and the resolved dir.
52
+ */
53
+ function extractCreateBindings(argv) {
54
+ const idx = argv.indexOf('--create-bindings');
55
+ if (idx === -1) {
56
+ return { filteredArgv: argv, createBindings: undefined };
57
+ }
58
+ const next = argv[idx + 1];
59
+ if (next !== undefined && !next.startsWith('-')) {
60
+ return {
61
+ filteredArgv: [...argv.slice(0, idx), ...argv.slice(idx + 2)],
62
+ createBindings: next,
63
+ };
64
+ }
65
+ return {
66
+ filteredArgv: [...argv.slice(0, idx), ...argv.slice(idx + 1)],
67
+ createBindings: './bindings',
68
+ };
69
+ }
70
+ // ============================================================
47
71
  // PARSE ARGS
48
72
  // ============================================================
49
73
  export function parseCliArgs(argv = process.argv.slice(2)) {
74
+ const { filteredArgv, createBindings } = extractCreateBindings(argv);
50
75
  const { values, positionals } = parseArgs({
51
- args: argv,
76
+ args: filteredArgv,
52
77
  options: BASE_OPTIONS,
53
78
  allowPositionals: true,
54
79
  strict: false,
@@ -77,7 +102,7 @@ export function parseCliArgs(argv = process.argv.slice(2)) {
77
102
  verbose: values['verbose'] === true,
78
103
  maxStackDepth,
79
104
  explain: values['explain'],
80
- createBindings: values['create-bindings'] === true,
105
+ createBindings,
81
106
  };
82
107
  }
83
108
  // ============================================================
@@ -96,8 +121,9 @@ function extractHandlerArgs(argv, params) {
96
121
  type: param.type === 'bool' ? 'boolean' : 'string',
97
122
  };
98
123
  }
124
+ const { filteredArgv } = extractCreateBindings(argv);
99
125
  const { values } = parseArgs({
100
- args: argv,
126
+ args: filteredArgv,
101
127
  options: handlerOptions,
102
128
  allowPositionals: true,
103
129
  strict: false,
@@ -165,14 +191,20 @@ export async function main() {
165
191
  throw err;
166
192
  }
167
193
  // Create bindings and exit early if --create-bindings was set
168
- if (opts.createBindings === true) {
169
- const extBindingsPath = resolve(process.cwd(), project.config.extensions?.bindings ?? 'bindings/ext.rill');
170
- mkdirSync(dirname(extBindingsPath), { recursive: true });
171
- writeFileSync(extBindingsPath, project.extensionBindings + '\n');
194
+ if (opts.createBindings !== undefined) {
195
+ const bindingsDir = resolve(dirname(configPath), opts.createBindings);
196
+ mkdirSync(bindingsDir, { recursive: true });
197
+ writeFileSync(resolve(bindingsDir, 'ext.rill'), project.extensionBindings + '\n');
172
198
  if (project.config.context !== undefined) {
173
- const ctxBindingsPath = resolve(process.cwd(), project.config.context.bindings ?? 'bindings/context.rill');
174
- mkdirSync(dirname(ctxBindingsPath), { recursive: true });
175
- writeFileSync(ctxBindingsPath, project.contextBindings + '\n');
199
+ writeFileSync(resolve(bindingsDir, 'context.rill'), project.contextBindings + '\n');
200
+ }
201
+ for (const dispose of project.disposes) {
202
+ try {
203
+ await dispose();
204
+ }
205
+ catch {
206
+ // Ignore dispose errors during cleanup
207
+ }
176
208
  }
177
209
  process.exit(0);
178
210
  }
@@ -272,7 +304,9 @@ export async function main() {
272
304
  ...opts,
273
305
  scriptPath,
274
306
  };
275
- const runResult = await runScript(runOpts, project.config, project.extTree, project.extensionBindings, [...project.disposes]);
307
+ const runResult = await runScript(runOpts, project.config, project.extTree, [
308
+ ...project.disposes,
309
+ ]);
276
310
  if (runResult.output !== undefined) {
277
311
  process.stdout.write(runResult.output + '\n');
278
312
  }
@@ -294,4 +328,3 @@ if (shouldRunMain) {
294
328
  process.exit(1);
295
329
  });
296
330
  }
297
- //# sourceMappingURL=cli-run.js.map
@@ -53,4 +53,3 @@ export declare function detectHelpVersionFlag(argv: string[]): {
53
53
  * The version is now generated at build time by packages/core/scripts/generate-version.ts.
54
54
  */
55
55
  export { VERSION, CLI_VERSION };
56
- //# sourceMappingURL=cli-shared.d.ts.map
@@ -140,4 +140,3 @@ export function detectHelpVersionFlag(argv) {
140
140
  * The version is now generated at build time by packages/core/scripts/generate-version.ts.
141
141
  */
142
142
  export { VERSION, CLI_VERSION };
143
- //# sourceMappingURL=cli-shared.js.map
@@ -2,8 +2,8 @@
2
2
  * Script runner for rill-run.
3
3
  * Builds runtime options, executes rill scripts, and maps results to exit codes.
4
4
  */
5
- import { type SchemeResolver } from '@rcrsr/rill';
6
- import type { NestedExtConfig, RillConfigFile } from '@rcrsr/rill-config';
5
+ import { type RillValue, type SchemeResolver } from '@rcrsr/rill';
6
+ import type { RillConfigFile } from '@rcrsr/rill-config';
7
7
  import type { RunCliOptions } from './types.js';
8
8
  export interface RunResult {
9
9
  readonly exitCode: number;
@@ -11,14 +11,13 @@ export interface RunResult {
11
11
  readonly errorOutput?: string | undefined;
12
12
  }
13
13
  /**
14
- * Build a custom module scheme resolver.
15
- * - ID 'ext' returns generated bindings source
16
- * - ID 'ext.*' drills into extTree subtree and returns bindings for that node
17
- * - All other IDs delegates to moduleResolver with the modules config
14
+ * Build a custom module scheme resolver using folder aliasing.
15
+ * Each config key maps to a directory. Dot-paths resolve to files within:
16
+ * - `module:alias.sub.path``{dir}/sub/path.rill`
17
+ * - `module:alias``{dir}/index.rill`
18
18
  */
19
- export declare function buildModuleResolver(bindingsSource: string, modulesConfig: Record<string, string>, extTree: NestedExtConfig, configDir: string): SchemeResolver;
19
+ export declare function buildModuleResolver(modulesConfig: Record<string, string>, configDir: string): SchemeResolver;
20
20
  /**
21
21
  * Run a rill script file with the given extension tree and config.
22
22
  */
23
- export declare function runScript(opts: RunCliOptions, config: RillConfigFile, extTree: NestedExtConfig, bindingsSrc: string, disposes: Array<() => void | Promise<void>>): Promise<RunResult>;
24
- //# sourceMappingURL=runner.d.ts.map
23
+ export declare function runScript(opts: RunCliOptions, config: RillConfigFile, extTree: Record<string, RillValue>, disposes: Array<() => void | Promise<void>>): Promise<RunResult>;