@rcrsr/rill 0.1.0 → 0.2.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 (260) hide show
  1. package/README.md +16 -8
  2. package/dist/check/config.d.ts +20 -0
  3. package/dist/check/config.d.ts.map +1 -0
  4. package/dist/check/config.js +151 -0
  5. package/dist/check/config.js.map +1 -0
  6. package/dist/check/fixer.d.ts +39 -0
  7. package/dist/check/fixer.d.ts.map +1 -0
  8. package/dist/check/fixer.js +119 -0
  9. package/dist/check/fixer.js.map +1 -0
  10. package/dist/check/index.d.ts +10 -0
  11. package/dist/check/index.d.ts.map +1 -0
  12. package/dist/check/index.js +21 -0
  13. package/dist/check/index.js.map +1 -0
  14. package/dist/check/rules/anti-patterns.d.ts +65 -0
  15. package/dist/check/rules/anti-patterns.d.ts.map +1 -0
  16. package/dist/check/rules/anti-patterns.js +427 -0
  17. package/dist/check/rules/anti-patterns.js.map +1 -0
  18. package/dist/check/rules/closures.d.ts +66 -0
  19. package/dist/check/rules/closures.d.ts.map +1 -0
  20. package/dist/check/rules/closures.js +373 -0
  21. package/dist/check/rules/closures.js.map +1 -0
  22. package/dist/check/rules/collections.d.ts +90 -0
  23. package/dist/check/rules/collections.d.ts.map +1 -0
  24. package/dist/check/rules/collections.js +373 -0
  25. package/dist/check/rules/collections.js.map +1 -0
  26. package/dist/check/rules/conditionals.d.ts +41 -0
  27. package/dist/check/rules/conditionals.d.ts.map +1 -0
  28. package/dist/check/rules/conditionals.js +106 -0
  29. package/dist/check/rules/conditionals.js.map +1 -0
  30. package/dist/check/rules/flow.d.ts +46 -0
  31. package/dist/check/rules/flow.d.ts.map +1 -0
  32. package/dist/check/rules/flow.js +206 -0
  33. package/dist/check/rules/flow.js.map +1 -0
  34. package/dist/check/rules/formatting.d.ts +133 -0
  35. package/dist/check/rules/formatting.d.ts.map +1 -0
  36. package/dist/check/rules/formatting.js +639 -0
  37. package/dist/check/rules/formatting.js.map +1 -0
  38. package/dist/check/rules/helpers.d.ts +26 -0
  39. package/dist/check/rules/helpers.d.ts.map +1 -0
  40. package/dist/check/rules/helpers.js +66 -0
  41. package/dist/check/rules/helpers.js.map +1 -0
  42. package/dist/check/rules/index.d.ts +21 -0
  43. package/dist/check/rules/index.d.ts.map +1 -0
  44. package/dist/check/rules/index.js +78 -0
  45. package/dist/check/rules/index.js.map +1 -0
  46. package/dist/check/rules/loops.d.ts +70 -0
  47. package/dist/check/rules/loops.d.ts.map +1 -0
  48. package/dist/check/rules/loops.js +227 -0
  49. package/dist/check/rules/loops.js.map +1 -0
  50. package/dist/check/rules/naming.d.ts +21 -0
  51. package/dist/check/rules/naming.d.ts.map +1 -0
  52. package/dist/check/rules/naming.js +167 -0
  53. package/dist/check/rules/naming.js.map +1 -0
  54. package/dist/check/rules/strings.d.ts +28 -0
  55. package/dist/check/rules/strings.d.ts.map +1 -0
  56. package/dist/check/rules/strings.js +80 -0
  57. package/dist/check/rules/strings.js.map +1 -0
  58. package/dist/check/rules/types.d.ts +41 -0
  59. package/dist/check/rules/types.d.ts.map +1 -0
  60. package/dist/check/rules/types.js +162 -0
  61. package/dist/check/rules/types.js.map +1 -0
  62. package/dist/check/types.d.ts +106 -0
  63. package/dist/check/types.d.ts.map +1 -0
  64. package/dist/check/types.js +6 -0
  65. package/dist/check/types.js.map +1 -0
  66. package/dist/check/validator.d.ts +18 -0
  67. package/dist/check/validator.d.ts.map +1 -0
  68. package/dist/check/validator.js +88 -0
  69. package/dist/check/validator.js.map +1 -0
  70. package/dist/check/visitor.d.ts +33 -0
  71. package/dist/check/visitor.d.ts.map +1 -0
  72. package/dist/check/visitor.js +243 -0
  73. package/dist/check/visitor.js.map +1 -0
  74. package/dist/cli-check.d.ts +43 -0
  75. package/dist/cli-check.d.ts.map +1 -0
  76. package/dist/cli-check.js +356 -0
  77. package/dist/cli-check.js.map +1 -0
  78. package/dist/cli-eval.d.ts +15 -0
  79. package/dist/cli-eval.d.ts.map +1 -0
  80. package/dist/cli-eval.js +120 -0
  81. package/dist/cli-eval.js.map +1 -0
  82. package/dist/cli-exec.d.ts +49 -0
  83. package/dist/cli-exec.d.ts.map +1 -0
  84. package/dist/cli-exec.js +191 -0
  85. package/dist/cli-exec.js.map +1 -0
  86. package/dist/cli-module-loader.d.ts +19 -0
  87. package/dist/cli-module-loader.d.ts.map +1 -0
  88. package/dist/cli-module-loader.js +83 -0
  89. package/dist/cli-module-loader.js.map +1 -0
  90. package/dist/cli-shared.d.ts +36 -0
  91. package/dist/cli-shared.d.ts.map +1 -0
  92. package/dist/cli-shared.js +101 -0
  93. package/dist/cli-shared.js.map +1 -0
  94. package/dist/cli.d.ts +2 -0
  95. package/dist/cli.d.ts.map +1 -1
  96. package/dist/cli.js +4 -11
  97. package/dist/cli.js.map +1 -1
  98. package/dist/index.d.ts +1 -1
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +1 -1
  101. package/dist/index.js.map +1 -1
  102. package/dist/lexer/readers.d.ts +1 -1
  103. package/dist/lexer/readers.d.ts.map +1 -1
  104. package/dist/lexer/readers.js +62 -32
  105. package/dist/lexer/readers.js.map +1 -1
  106. package/dist/lexer/tokenizer.d.ts.map +1 -1
  107. package/dist/lexer/tokenizer.js +5 -6
  108. package/dist/lexer/tokenizer.js.map +1 -1
  109. package/dist/parser/index.js +1 -1
  110. package/dist/parser/index.js.map +1 -1
  111. package/dist/parser/parser-expr.js +23 -5
  112. package/dist/parser/parser-expr.js.map +1 -1
  113. package/dist/parser/parser-functions.d.ts +2 -2
  114. package/dist/parser/parser-functions.d.ts.map +1 -1
  115. package/dist/parser/parser-functions.js +2 -1
  116. package/dist/parser/parser-functions.js.map +1 -1
  117. package/dist/parser/parser-literals.js +2 -2
  118. package/dist/parser/parser-literals.js.map +1 -1
  119. package/dist/parser/parser-script.js +9 -7
  120. package/dist/parser/parser-script.js.map +1 -1
  121. package/dist/parser/parser-variables.js +4 -3
  122. package/dist/parser/parser-variables.js.map +1 -1
  123. package/dist/runtime/core/callable.d.ts +5 -6
  124. package/dist/runtime/core/callable.d.ts.map +1 -1
  125. package/dist/runtime/core/callable.js.map +1 -1
  126. package/dist/runtime/core/context.d.ts.map +1 -1
  127. package/dist/runtime/core/context.js +19 -32
  128. package/dist/runtime/core/context.js.map +1 -1
  129. package/dist/runtime/core/equals.js +1 -1
  130. package/dist/runtime/core/equals.js.map +1 -1
  131. package/dist/runtime/core/eval/evaluator.d.ts +78 -0
  132. package/dist/runtime/core/eval/evaluator.d.ts.map +1 -1
  133. package/dist/runtime/core/eval/evaluator.js +78 -0
  134. package/dist/runtime/core/eval/evaluator.js.map +1 -1
  135. package/dist/runtime/core/eval/mixins/closures.d.ts.map +1 -1
  136. package/dist/runtime/core/eval/mixins/closures.js +9 -1
  137. package/dist/runtime/core/eval/mixins/closures.js.map +1 -1
  138. package/dist/runtime/core/eval/mixins/variables.d.ts.map +1 -1
  139. package/dist/runtime/core/eval/mixins/variables.js +143 -2
  140. package/dist/runtime/core/eval/mixins/variables.js.map +1 -1
  141. package/dist/runtime/core/types.d.ts +15 -2
  142. package/dist/runtime/core/types.d.ts.map +1 -1
  143. package/dist/runtime/core/types.js.map +1 -1
  144. package/dist/runtime/ext/extensions.d.ts +51 -0
  145. package/dist/runtime/ext/extensions.d.ts.map +1 -0
  146. package/dist/runtime/ext/extensions.js +67 -0
  147. package/dist/runtime/ext/extensions.js.map +1 -0
  148. package/dist/runtime/index.d.ts +3 -0
  149. package/dist/runtime/index.d.ts.map +1 -1
  150. package/dist/runtime/index.js +1 -0
  151. package/dist/runtime/index.js.map +1 -1
  152. package/dist/types.d.ts +8 -4
  153. package/dist/types.d.ts.map +1 -1
  154. package/dist/types.js +5 -4
  155. package/dist/types.js.map +1 -1
  156. package/docs/00_INDEX.md +1 -0
  157. package/docs/01_guide.md +3 -3
  158. package/docs/02_types.md +8 -10
  159. package/docs/03_variables.md +10 -0
  160. package/docs/04_operators.md +3 -3
  161. package/docs/05_control-flow.md +21 -0
  162. package/docs/07_collections.md +2 -0
  163. package/docs/10_parsing.md +9 -9
  164. package/docs/11_reference.md +1 -1
  165. package/docs/12_examples.md +36 -62
  166. package/docs/14_host-integration.md +116 -111
  167. package/docs/15_grammar.ebnf +1 -5
  168. package/docs/16_conventions.md +3 -4
  169. package/docs/17_cli-tools.md +184 -0
  170. package/docs/99_llm-reference.txt +46 -5
  171. package/package.json +13 -4
  172. package/dist/demo.d.ts +0 -6
  173. package/dist/demo.d.ts.map +0 -1
  174. package/dist/demo.js +0 -121
  175. package/dist/demo.js.map +0 -1
  176. package/dist/lexer.d.ts +0 -19
  177. package/dist/lexer.d.ts.map +0 -1
  178. package/dist/lexer.js +0 -344
  179. package/dist/lexer.js.map +0 -1
  180. package/dist/parser/arithmetic.d.ts +0 -16
  181. package/dist/parser/arithmetic.d.ts.map +0 -1
  182. package/dist/parser/arithmetic.js +0 -128
  183. package/dist/parser/arithmetic.js.map +0 -1
  184. package/dist/parser/boolean.d.ts +0 -15
  185. package/dist/parser/boolean.d.ts.map +0 -1
  186. package/dist/parser/boolean.js +0 -20
  187. package/dist/parser/boolean.js.map +0 -1
  188. package/dist/parser/control-flow.d.ts +0 -56
  189. package/dist/parser/control-flow.d.ts.map +0 -1
  190. package/dist/parser/control-flow.js +0 -167
  191. package/dist/parser/control-flow.js.map +0 -1
  192. package/dist/parser/expressions.d.ts +0 -23
  193. package/dist/parser/expressions.d.ts.map +0 -1
  194. package/dist/parser/expressions.js +0 -950
  195. package/dist/parser/expressions.js.map +0 -1
  196. package/dist/parser/extraction.d.ts +0 -48
  197. package/dist/parser/extraction.d.ts.map +0 -1
  198. package/dist/parser/extraction.js +0 -279
  199. package/dist/parser/extraction.js.map +0 -1
  200. package/dist/parser/functions.d.ts +0 -20
  201. package/dist/parser/functions.d.ts.map +0 -1
  202. package/dist/parser/functions.js +0 -96
  203. package/dist/parser/functions.js.map +0 -1
  204. package/dist/parser/literals.d.ts +0 -37
  205. package/dist/parser/literals.d.ts.map +0 -1
  206. package/dist/parser/literals.js +0 -373
  207. package/dist/parser/literals.js.map +0 -1
  208. package/dist/parser/script.d.ts +0 -14
  209. package/dist/parser/script.d.ts.map +0 -1
  210. package/dist/parser/script.js +0 -196
  211. package/dist/parser/script.js.map +0 -1
  212. package/dist/parser/variables.d.ts +0 -10
  213. package/dist/parser/variables.d.ts.map +0 -1
  214. package/dist/parser/variables.js +0 -215
  215. package/dist/parser/variables.js.map +0 -1
  216. package/dist/runtime/ast-equals.d.ts +0 -13
  217. package/dist/runtime/ast-equals.d.ts.map +0 -1
  218. package/dist/runtime/ast-equals.js +0 -447
  219. package/dist/runtime/ast-equals.js.map +0 -1
  220. package/dist/runtime/builtins.d.ts +0 -13
  221. package/dist/runtime/builtins.d.ts.map +0 -1
  222. package/dist/runtime/builtins.js +0 -180
  223. package/dist/runtime/builtins.js.map +0 -1
  224. package/dist/runtime/callable.d.ts +0 -88
  225. package/dist/runtime/callable.d.ts.map +0 -1
  226. package/dist/runtime/callable.js +0 -98
  227. package/dist/runtime/callable.js.map +0 -1
  228. package/dist/runtime/context.d.ts +0 -13
  229. package/dist/runtime/context.d.ts.map +0 -1
  230. package/dist/runtime/context.js +0 -73
  231. package/dist/runtime/context.js.map +0 -1
  232. package/dist/runtime/core/evaluate.d.ts +0 -42
  233. package/dist/runtime/core/evaluate.d.ts.map +0 -1
  234. package/dist/runtime/core/evaluate.debug.js +0 -1251
  235. package/dist/runtime/core/evaluate.js +0 -1913
  236. package/dist/runtime/core/evaluate.js.map +0 -1
  237. package/dist/runtime/evaluate.d.ts +0 -32
  238. package/dist/runtime/evaluate.d.ts.map +0 -1
  239. package/dist/runtime/evaluate.js +0 -1111
  240. package/dist/runtime/evaluate.js.map +0 -1
  241. package/dist/runtime/execute.d.ts +0 -26
  242. package/dist/runtime/execute.d.ts.map +0 -1
  243. package/dist/runtime/execute.js +0 -121
  244. package/dist/runtime/execute.js.map +0 -1
  245. package/dist/runtime/signals.d.ts +0 -19
  246. package/dist/runtime/signals.d.ts.map +0 -1
  247. package/dist/runtime/signals.js +0 -26
  248. package/dist/runtime/signals.js.map +0 -1
  249. package/dist/runtime/types.d.ts +0 -169
  250. package/dist/runtime/types.d.ts.map +0 -1
  251. package/dist/runtime/types.js +0 -50
  252. package/dist/runtime/types.js.map +0 -1
  253. package/dist/runtime/values.d.ts +0 -50
  254. package/dist/runtime/values.d.ts.map +0 -1
  255. package/dist/runtime/values.js +0 -209
  256. package/dist/runtime/values.js.map +0 -1
  257. package/dist/runtime.d.ts +0 -254
  258. package/dist/runtime.d.ts.map +0 -1
  259. package/dist/runtime.js +0 -2014
  260. package/dist/runtime.js.map +0 -1
package/docs/02_types.md CHANGED
@@ -53,21 +53,19 @@ true :> $ok
53
53
  "upper: {$name -> .upper}" # Method chain
54
54
  ```
55
55
 
56
- ### Heredocs
56
+ ### Multiline Strings
57
57
 
58
- Multiline strings use heredoc syntax:
58
+ Multiline strings use triple-quote syntax:
59
59
 
60
60
  ```rill
61
- prompt(<<EOF
62
- Review this code:
63
- {$code}
64
-
65
- Check for security issues.
66
- EOF
67
- )
61
+ "World" :> $name
62
+ """
63
+ Hello, {$name}!
64
+ Line two
65
+ """
68
66
  ```
69
67
 
70
- The delimiter (e.g., `EOF`) must not appear on its own line within the content.
68
+ Triple-quote strings support interpolation like regular strings.
71
69
 
72
70
  See [Strings](09_strings.md) for string methods.
73
71
 
@@ -191,6 +191,16 @@ While loops use `$` as the accumulator since named variables in the body don't p
191
191
  # $temp not accessible here
192
192
  ```
193
193
 
194
+ > **Common Mistake:** Attempting to modify outer-scope variables from inside loops. This pattern NEVER works:
195
+ >
196
+ > ```text
197
+ > 0 :> $count
198
+ > [1, 2, 3] -> each { $count + 1 :> $count } # Creates LOCAL $count!
199
+ > $count # Still 0!
200
+ > ```
201
+ >
202
+ > Use `fold` for reductions, or pack multiple values into `$` as a dict. See [Collections](07_collections.md) for accumulator patterns.
203
+
194
204
  ### Reading Outer Variables
195
205
 
196
206
  ```rill
@@ -421,7 +421,7 @@ $list[1] # "b"
421
421
 
422
422
  Use a variable as key:
423
423
 
424
- ```rill
424
+ ```text
425
425
  "name" :> $key
426
426
  [name: "alice"] :> $data
427
427
  $data.$key # "alice"
@@ -431,7 +431,7 @@ $data.$key # "alice"
431
431
 
432
432
  Use an expression as key:
433
433
 
434
- ```rill
434
+ ```text
435
435
  0 :> $i
436
436
  ["a", "b", "c"] :> $list
437
437
  $list.($i + 1) # "b"
@@ -441,7 +441,7 @@ $list.($i + 1) # "b"
441
441
 
442
442
  Try keys left-to-right:
443
443
 
444
- ```rill
444
+ ```text
445
445
  [nickname: "Al"] :> $user
446
446
  $user.(name || nickname) # "Al"
447
447
  ```
@@ -110,6 +110,8 @@ true -> ? {
110
110
 
111
111
  Pre-condition loop. Condition is evaluated before each iteration. The body result becomes the next iteration's `$`.
112
112
 
113
+ > **Note:** There is no `while` keyword. Use `(condition) @ { body }` syntax. Loop bodies cannot modify outer-scope variables—use `$` to carry all state. For multiple values, pack them in a dict.
114
+
113
115
  ### Syntax
114
116
 
115
117
  ```text
@@ -151,6 +153,25 @@ Use `^(limit: N)` annotation to set maximum iterations (default: 10,000):
151
153
 
152
154
  Exceeding the limit throws `RuntimeError` with code `RUNTIME_LIMIT_EXCEEDED`.
153
155
 
156
+ ### Multiple State Values
157
+
158
+ When you need to track multiple values across iterations, use `$` as a state dict:
159
+
160
+ ```text
161
+ # Track iteration count, text, and done flag
162
+ [iter: 0, text: $input, done: false]
163
+ -> (!$.done && $.iter < 3) @ {
164
+ $.iter + 1 :> $i
165
+ app::process($.text) :> $result
166
+ $result.finished
167
+ ? [iter: $i, text: $.text, done: true]
168
+ ! [iter: $i, text: $result.text, done: false]
169
+ }
170
+ # Access final state: $.text, $.iter
171
+ ```
172
+
173
+ This pattern replaces the common (but invalid) approach of trying to modify outer variables from inside the loop.
174
+
154
175
  ---
155
176
 
156
177
  ## Do-While Loop
@@ -15,6 +15,8 @@ rill provides four collection operators for transforming, filtering, and reducin
15
15
 
16
16
  All three operators share similar syntax but differ in execution model and output.
17
17
 
18
+ > **Important:** Loop bodies cannot modify outer-scope variables (see [Variables](03_variables.md)). Use `fold` or `each(init)` with accumulators instead.
19
+
18
20
  ```rill
19
21
  # Sequential: results in order, one at a time
20
22
  [1, 2, 3] -> each { $ * 2 } # [2, 4, 6]
@@ -130,7 +130,7 @@ $response -> parse_xml
130
130
  ### Chain-of-Thought Pattern
131
131
 
132
132
  ```rill
133
- prompt(<<EOF
133
+ """
134
134
  Analyze this problem step by step.
135
135
 
136
136
  <thinking>
@@ -140,8 +140,9 @@ Show your reasoning here
140
140
  <answer>
141
141
  Return your final answer as JSON
142
142
  </answer>
143
- EOF
144
- ) :> $response
143
+ """ :> $prompt_text
144
+
145
+ app::prompt($prompt_text) :> $response
145
146
 
146
147
  # Log reasoning for debugging
147
148
  $response -> parse_xml("thinking") -> log
@@ -152,22 +153,21 @@ $response -> parse_xml("answer") -> parse_json :> $result
152
153
 
153
154
  ### Tool Calling Pattern
154
155
 
155
- ```rill
156
- prompt(<<EOF
156
+ ```text
157
+ """
157
158
  You have access to tools. To call a tool, use:
158
159
  <tool>
159
160
  <name>tool_name</name>
160
161
  <args>{"param": "value"}</args>
161
162
  </tool>
162
- EOF
163
- ) :> $response
163
+ """ -> app::prompt() :> $response
164
164
 
165
165
  $response -> parse_xml("tool") :> $tool
166
166
  $tool -> parse_xml("name") :> $fn_name
167
167
  $tool -> parse_xml("args") -> parse_json :> $fn_args
168
168
 
169
- # Call the function dynamically
170
- call($fn_name, $fn_args)
169
+ # Call the function dynamically (host-provided)
170
+ app::call($fn_name, $fn_args)
171
171
  ```
172
172
 
173
173
  ## Fenced Code Blocks
@@ -72,7 +72,7 @@ See [Collections](07_collections.md) for detailed documentation.
72
72
 
73
73
  | Type | Syntax | Example |
74
74
  |------|--------|---------|
75
- | String | `"text"` | `"hello"` |
75
+ | String | `"text"`, `"""text"""` | `"hello"`, `"""line 1\nline 2"""` |
76
76
  | Number | `123`, `0.5` | `42`, `0.9` |
77
77
  | Bool | `true`, `false` | `true` |
78
78
  | List | `[a, b]` | `["file.ts", 42]` |
@@ -15,57 +15,51 @@ args: requirements: string
15
15
  ---
16
16
 
17
17
  # Phase 1: Validate requirements
18
- prompt(<<EOF
18
+ """
19
19
  Review the requirements document at {$requirements}.
20
20
  Check for completeness and clarity.
21
21
  Output READY if complete, or list missing elements.
22
- EOF
23
- ) :> $validation
22
+ """ -> prompt() :> $validation
24
23
 
25
24
  $validation -> ?(!.contains("READY")) {
26
25
  error("Requirements incomplete: {$validation}")
27
26
  }
28
27
 
29
28
  # Phase 2: Create specification
30
- prompt(<<EOF
29
+ """
31
30
  Create a technical specification from {$requirements}.
32
31
  Include API design, data models, and component structure.
33
- EOF
34
- ) :> $spec
32
+ """ -> prompt() :> $spec
35
33
 
36
34
  "Specification created" -> log
37
35
 
38
36
  # Phase 3: Review loop - iterate until approved
39
37
  ($spec -> .contains("REVISION")) @ {
40
- prompt(<<EOF
38
+ """
41
39
  Review this specification for issues:
42
40
  {$}
43
41
 
44
42
  Output APPROVED if ready, or REVISION REQUIRED with feedback.
45
- EOF
46
- ) :> $review
43
+ """ -> prompt() :> $review
47
44
 
48
45
  $review -> ?(.contains("APPROVED")) { break }
49
46
 
50
47
  # Apply feedback and continue
51
- prompt(<<EOF
48
+ """
52
49
  Update the specification based on this feedback:
53
50
  {$review}
54
51
 
55
52
  Original spec:
56
53
  {$}
57
- EOF
58
- )
59
- } :> $approved_spec
54
+ """ -> prompt()} :> $approved_spec
60
55
 
61
56
  # Phase 4: Implementation
62
- prompt(<<EOF
57
+ """
63
58
  Implement the approved specification:
64
59
  {$approved_spec}
65
60
 
66
61
  Create the necessary files and tests.
67
- EOF
68
- ) :> $implementation
62
+ """ -> prompt() :> $implementation
69
63
 
70
64
  # Phase 5: Verify
71
65
  prompt("Run tests and verify implementation") :> $verification
@@ -91,7 +85,7 @@ prompt("Read {$plan} and find the first unchecked item (- [ ])") :> $status
91
85
 
92
86
  # Work loop
93
87
  $status -> @(!.contains("ALL COMPLETE")) {
94
- prompt(<<EOF
88
+ """
95
89
  Based on this status:
96
90
  {$}
97
91
 
@@ -99,9 +93,7 @@ Based on this status:
99
93
  2. Mark it complete in {$plan}
100
94
  3. Check if any unchecked items remain
101
95
  4. Output ALL COMPLETE if done, or describe next item
102
- EOF
103
- )
104
- } :> $final
96
+ """ -> prompt()} :> $final
105
97
 
106
98
  "Plan complete: {$final}" -> log
107
99
  ```
@@ -122,14 +114,12 @@ prompt("Run tests for {$target} and report results") :> $result
122
114
  $result -> @(.contains("FAIL")) {
123
115
  "Fixing failures..." -> log
124
116
 
125
- prompt(<<EOF
117
+ """
126
118
  Fix these test failures:
127
119
  {$}
128
120
 
129
121
  Make minimal changes. Then run tests again and report results.
130
- EOF
131
- )
132
- } :> $final
122
+ """ -> prompt()} :> $final
133
123
 
134
124
  $final -> ?(.contains("PASS")) {
135
125
  "All tests passing"
@@ -151,22 +141,20 @@ args: file: string
151
141
  prompt("Read and summarize {$file}") :> $summary
152
142
 
153
143
  # Security check
154
- prompt(<<EOF
144
+ """
155
145
  Evaluate for SECURITY issues:
156
146
  {$summary}
157
147
 
158
148
  Output PASS, WARN, or FAIL with explanation.
159
- EOF
160
- ) :> $security
149
+ """ -> prompt() :> $security
161
150
 
162
151
  # Performance check
163
- prompt(<<EOF
152
+ """
164
153
  Evaluate for PERFORMANCE issues:
165
154
  {$summary}
166
155
 
167
156
  Output PASS, WARN, or FAIL with explanation.
168
- EOF
169
- ) :> $performance
157
+ """ -> prompt() :> $performance
170
158
 
171
159
  # Check results
172
160
  $security -> ?(.contains("FAIL")) {
@@ -196,21 +184,17 @@ $ENV.DEPLOY_ENV -> ?(.empty()) {
196
184
 
197
185
  # Environment-specific deployment
198
186
  ($ENV.DEPLOY_ENV == "production") ? {
199
- prompt(<<EOF
187
+ """
200
188
  Deploy {$service} to production.
201
189
  - Run full test suite first
202
190
  - Enable monitoring
203
191
  - Use blue-green deployment
204
- EOF
205
- )
206
- } ! ($ENV.DEPLOY_ENV == "staging") ? {
207
- prompt(<<EOF
192
+ """ -> prompt()} ! ($ENV.DEPLOY_ENV == "staging") ? {
193
+ """
208
194
  Deploy {$service} to staging.
209
195
  - Run smoke tests
210
196
  - Enable debug logging
211
- EOF
212
- )
213
- } ! {
197
+ """ -> prompt()} ! {
214
198
  prompt("Deploy {$service} to development environment")
215
199
  } :> $result
216
200
 
@@ -229,13 +213,11 @@ args: operation: string
229
213
 
230
214
  # Do-while: body runs first, then condition checked
231
215
  ^(limit: 5) @ {
232
- prompt(<<EOF
216
+ """
233
217
  Perform: {$operation}
234
218
 
235
219
  Output SUCCESS, RETRY, or FAILED.
236
- EOF
237
- )
238
- } ? (.contains("RETRY"))
220
+ """ -> prompt()} ? (.contains("RETRY"))
239
221
 
240
222
  # Loop exits when result doesn't contain RETRY
241
223
  .contains("SUCCESS") ? [0, "Succeeded"] ! [1, "Failed: {$}"]
@@ -263,14 +245,13 @@ prompt("Analyze this content:\n{$raw}") :> $analysis -> log -> ?(.empty()) {
263
245
  }
264
246
 
265
247
  # Both $raw and $analysis available
266
- prompt(<<EOF
248
+ """
267
249
  Compare the original:
268
250
  {$raw}
269
251
 
270
252
  With the analysis:
271
253
  {$analysis}
272
- EOF
273
- )
254
+ """ -> prompt()
274
255
  ```
275
256
 
276
257
  Semantically, `:> $var ->` is `:> $var.set($) ->` — the capture acts like `log`, storing the value while passing it through unchanged.
@@ -326,13 +307,12 @@ prompt("Read {$logfile} and find all ERROR lines") :> $errors
326
307
  $errors -> ?(.empty()) {
327
308
  "No errors found"
328
309
  } ! {
329
- prompt(<<EOF
310
+ """
330
311
  Analyze these errors and categorize them:
331
312
  {$errors}
332
313
 
333
314
  For each unique error type, suggest a fix.
334
- EOF
335
- ) :> $analysis
315
+ """ -> prompt() :> $analysis
336
316
 
337
317
  "Error analysis complete" -> log
338
318
  $analysis
@@ -393,12 +373,10 @@ range(1, $batches + 1) -> each {
393
373
  (($batch_num - 1) * 10) :> $start
394
374
  ($start + 10) :> $end
395
375
 
396
- prompt(<<EOF
376
+ """
397
377
  Process batch {$batch_num} of {$batches}
398
378
  Items {$start} through {$end}
399
- EOF
400
- )
401
- }
379
+ """ -> prompt()}
402
380
 
403
381
  [0, "Processed all batches"]
404
382
  ```
@@ -415,27 +393,24 @@ exceptions:
415
393
  - ":::NEEDS_HUMAN:::"
416
394
  ---
417
395
 
418
- prompt(<<EOF
396
+ """
419
397
  Work on this task: {$task}
420
398
 
421
399
  Rules:
422
400
  - Output :::BLOCKED::: if you need information you don't have
423
401
  - Output :::NEEDS_HUMAN::: if human judgment is required
424
402
  - Output :::DONE::: when complete
425
- EOF
426
- ) :> $result
403
+ """ -> prompt() :> $result
427
404
 
428
405
  $result -> @(!.contains(":::DONE:::")) {
429
- prompt(<<EOF
406
+ """
430
407
  Continue working on: {$task}
431
408
 
432
409
  Previous progress:
433
410
  {$}
434
411
 
435
412
  Remember the signal rules.
436
- EOF
437
- )
438
- } :> $final
413
+ """ -> prompt()} :> $final
439
414
 
440
415
  "Task complete: {$final}" -> log
441
416
  ```
@@ -607,11 +582,10 @@ $response -> parse_xml("answer") -> parse_json :> $answer
607
582
  ### Parse Tool Calls
608
583
 
609
584
  ```rill
610
- prompt(<<EOF
585
+ """
611
586
  What function should I call?
612
587
  Return in format: <tool><name>func</name><args>{...}</args></tool>
613
- EOF
614
- ) :> $response
588
+ """ -> prompt() :> $response
615
589
 
616
590
  $response -> parse_xml("tool") :> $tool
617
591
  $tool -> parse_xml("name") :> $fn_name