@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.
- package/README.md +16 -8
- package/dist/check/config.d.ts +20 -0
- package/dist/check/config.d.ts.map +1 -0
- package/dist/check/config.js +151 -0
- package/dist/check/config.js.map +1 -0
- package/dist/check/fixer.d.ts +39 -0
- package/dist/check/fixer.d.ts.map +1 -0
- package/dist/check/fixer.js +119 -0
- package/dist/check/fixer.js.map +1 -0
- package/dist/check/index.d.ts +10 -0
- package/dist/check/index.d.ts.map +1 -0
- package/dist/check/index.js +21 -0
- package/dist/check/index.js.map +1 -0
- package/dist/check/rules/anti-patterns.d.ts +65 -0
- package/dist/check/rules/anti-patterns.d.ts.map +1 -0
- package/dist/check/rules/anti-patterns.js +427 -0
- package/dist/check/rules/anti-patterns.js.map +1 -0
- package/dist/check/rules/closures.d.ts +66 -0
- package/dist/check/rules/closures.d.ts.map +1 -0
- package/dist/check/rules/closures.js +373 -0
- package/dist/check/rules/closures.js.map +1 -0
- package/dist/check/rules/collections.d.ts +90 -0
- package/dist/check/rules/collections.d.ts.map +1 -0
- package/dist/check/rules/collections.js +373 -0
- package/dist/check/rules/collections.js.map +1 -0
- package/dist/check/rules/conditionals.d.ts +41 -0
- package/dist/check/rules/conditionals.d.ts.map +1 -0
- package/dist/check/rules/conditionals.js +106 -0
- package/dist/check/rules/conditionals.js.map +1 -0
- package/dist/check/rules/flow.d.ts +46 -0
- package/dist/check/rules/flow.d.ts.map +1 -0
- package/dist/check/rules/flow.js +206 -0
- package/dist/check/rules/flow.js.map +1 -0
- package/dist/check/rules/formatting.d.ts +133 -0
- package/dist/check/rules/formatting.d.ts.map +1 -0
- package/dist/check/rules/formatting.js +639 -0
- package/dist/check/rules/formatting.js.map +1 -0
- package/dist/check/rules/helpers.d.ts +26 -0
- package/dist/check/rules/helpers.d.ts.map +1 -0
- package/dist/check/rules/helpers.js +66 -0
- package/dist/check/rules/helpers.js.map +1 -0
- package/dist/check/rules/index.d.ts +21 -0
- package/dist/check/rules/index.d.ts.map +1 -0
- package/dist/check/rules/index.js +78 -0
- package/dist/check/rules/index.js.map +1 -0
- package/dist/check/rules/loops.d.ts +70 -0
- package/dist/check/rules/loops.d.ts.map +1 -0
- package/dist/check/rules/loops.js +227 -0
- package/dist/check/rules/loops.js.map +1 -0
- package/dist/check/rules/naming.d.ts +21 -0
- package/dist/check/rules/naming.d.ts.map +1 -0
- package/dist/check/rules/naming.js +167 -0
- package/dist/check/rules/naming.js.map +1 -0
- package/dist/check/rules/strings.d.ts +28 -0
- package/dist/check/rules/strings.d.ts.map +1 -0
- package/dist/check/rules/strings.js +80 -0
- package/dist/check/rules/strings.js.map +1 -0
- package/dist/check/rules/types.d.ts +41 -0
- package/dist/check/rules/types.d.ts.map +1 -0
- package/dist/check/rules/types.js +162 -0
- package/dist/check/rules/types.js.map +1 -0
- package/dist/check/types.d.ts +106 -0
- package/dist/check/types.d.ts.map +1 -0
- package/dist/check/types.js +6 -0
- package/dist/check/types.js.map +1 -0
- package/dist/check/validator.d.ts +18 -0
- package/dist/check/validator.d.ts.map +1 -0
- package/dist/check/validator.js +88 -0
- package/dist/check/validator.js.map +1 -0
- package/dist/check/visitor.d.ts +33 -0
- package/dist/check/visitor.d.ts.map +1 -0
- package/dist/check/visitor.js +243 -0
- package/dist/check/visitor.js.map +1 -0
- package/dist/cli-check.d.ts +43 -0
- package/dist/cli-check.d.ts.map +1 -0
- package/dist/cli-check.js +356 -0
- package/dist/cli-check.js.map +1 -0
- package/dist/cli-eval.d.ts +15 -0
- package/dist/cli-eval.d.ts.map +1 -0
- package/dist/cli-eval.js +120 -0
- package/dist/cli-eval.js.map +1 -0
- package/dist/cli-exec.d.ts +49 -0
- package/dist/cli-exec.d.ts.map +1 -0
- package/dist/cli-exec.js +191 -0
- package/dist/cli-exec.js.map +1 -0
- package/dist/cli-module-loader.d.ts +19 -0
- package/dist/cli-module-loader.d.ts.map +1 -0
- package/dist/cli-module-loader.js +83 -0
- package/dist/cli-module-loader.js.map +1 -0
- package/dist/cli-shared.d.ts +36 -0
- package/dist/cli-shared.d.ts.map +1 -0
- package/dist/cli-shared.js +101 -0
- package/dist/cli-shared.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -11
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexer/readers.d.ts +1 -1
- package/dist/lexer/readers.d.ts.map +1 -1
- package/dist/lexer/readers.js +62 -32
- package/dist/lexer/readers.js.map +1 -1
- package/dist/lexer/tokenizer.d.ts.map +1 -1
- package/dist/lexer/tokenizer.js +5 -6
- package/dist/lexer/tokenizer.js.map +1 -1
- package/dist/parser/index.js +1 -1
- package/dist/parser/index.js.map +1 -1
- package/dist/parser/parser-expr.js +23 -5
- package/dist/parser/parser-expr.js.map +1 -1
- package/dist/parser/parser-functions.d.ts +2 -2
- package/dist/parser/parser-functions.d.ts.map +1 -1
- package/dist/parser/parser-functions.js +2 -1
- package/dist/parser/parser-functions.js.map +1 -1
- package/dist/parser/parser-literals.js +2 -2
- package/dist/parser/parser-literals.js.map +1 -1
- package/dist/parser/parser-script.js +9 -7
- package/dist/parser/parser-script.js.map +1 -1
- package/dist/parser/parser-variables.js +4 -3
- package/dist/parser/parser-variables.js.map +1 -1
- package/dist/runtime/core/callable.d.ts +5 -6
- package/dist/runtime/core/callable.d.ts.map +1 -1
- package/dist/runtime/core/callable.js.map +1 -1
- package/dist/runtime/core/context.d.ts.map +1 -1
- package/dist/runtime/core/context.js +19 -32
- package/dist/runtime/core/context.js.map +1 -1
- package/dist/runtime/core/equals.js +1 -1
- package/dist/runtime/core/equals.js.map +1 -1
- package/dist/runtime/core/eval/evaluator.d.ts +78 -0
- package/dist/runtime/core/eval/evaluator.d.ts.map +1 -1
- package/dist/runtime/core/eval/evaluator.js +78 -0
- package/dist/runtime/core/eval/evaluator.js.map +1 -1
- package/dist/runtime/core/eval/mixins/closures.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/closures.js +9 -1
- package/dist/runtime/core/eval/mixins/closures.js.map +1 -1
- package/dist/runtime/core/eval/mixins/variables.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/variables.js +143 -2
- package/dist/runtime/core/eval/mixins/variables.js.map +1 -1
- package/dist/runtime/core/types.d.ts +15 -2
- package/dist/runtime/core/types.d.ts.map +1 -1
- package/dist/runtime/core/types.js.map +1 -1
- package/dist/runtime/ext/extensions.d.ts +51 -0
- package/dist/runtime/ext/extensions.d.ts.map +1 -0
- package/dist/runtime/ext/extensions.js +67 -0
- package/dist/runtime/ext/extensions.js.map +1 -0
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/types.d.ts +8 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +5 -4
- package/dist/types.js.map +1 -1
- package/docs/00_INDEX.md +1 -0
- package/docs/01_guide.md +3 -3
- package/docs/02_types.md +8 -10
- package/docs/03_variables.md +10 -0
- package/docs/04_operators.md +3 -3
- package/docs/05_control-flow.md +21 -0
- package/docs/07_collections.md +2 -0
- package/docs/10_parsing.md +9 -9
- package/docs/11_reference.md +1 -1
- package/docs/12_examples.md +36 -62
- package/docs/14_host-integration.md +116 -111
- package/docs/15_grammar.ebnf +1 -5
- package/docs/16_conventions.md +3 -4
- package/docs/17_cli-tools.md +184 -0
- package/docs/99_llm-reference.txt +46 -5
- package/package.json +13 -4
- package/dist/demo.d.ts +0 -6
- package/dist/demo.d.ts.map +0 -1
- package/dist/demo.js +0 -121
- package/dist/demo.js.map +0 -1
- package/dist/lexer.d.ts +0 -19
- package/dist/lexer.d.ts.map +0 -1
- package/dist/lexer.js +0 -344
- package/dist/lexer.js.map +0 -1
- package/dist/parser/arithmetic.d.ts +0 -16
- package/dist/parser/arithmetic.d.ts.map +0 -1
- package/dist/parser/arithmetic.js +0 -128
- package/dist/parser/arithmetic.js.map +0 -1
- package/dist/parser/boolean.d.ts +0 -15
- package/dist/parser/boolean.d.ts.map +0 -1
- package/dist/parser/boolean.js +0 -20
- package/dist/parser/boolean.js.map +0 -1
- package/dist/parser/control-flow.d.ts +0 -56
- package/dist/parser/control-flow.d.ts.map +0 -1
- package/dist/parser/control-flow.js +0 -167
- package/dist/parser/control-flow.js.map +0 -1
- package/dist/parser/expressions.d.ts +0 -23
- package/dist/parser/expressions.d.ts.map +0 -1
- package/dist/parser/expressions.js +0 -950
- package/dist/parser/expressions.js.map +0 -1
- package/dist/parser/extraction.d.ts +0 -48
- package/dist/parser/extraction.d.ts.map +0 -1
- package/dist/parser/extraction.js +0 -279
- package/dist/parser/extraction.js.map +0 -1
- package/dist/parser/functions.d.ts +0 -20
- package/dist/parser/functions.d.ts.map +0 -1
- package/dist/parser/functions.js +0 -96
- package/dist/parser/functions.js.map +0 -1
- package/dist/parser/literals.d.ts +0 -37
- package/dist/parser/literals.d.ts.map +0 -1
- package/dist/parser/literals.js +0 -373
- package/dist/parser/literals.js.map +0 -1
- package/dist/parser/script.d.ts +0 -14
- package/dist/parser/script.d.ts.map +0 -1
- package/dist/parser/script.js +0 -196
- package/dist/parser/script.js.map +0 -1
- package/dist/parser/variables.d.ts +0 -10
- package/dist/parser/variables.d.ts.map +0 -1
- package/dist/parser/variables.js +0 -215
- package/dist/parser/variables.js.map +0 -1
- package/dist/runtime/ast-equals.d.ts +0 -13
- package/dist/runtime/ast-equals.d.ts.map +0 -1
- package/dist/runtime/ast-equals.js +0 -447
- package/dist/runtime/ast-equals.js.map +0 -1
- package/dist/runtime/builtins.d.ts +0 -13
- package/dist/runtime/builtins.d.ts.map +0 -1
- package/dist/runtime/builtins.js +0 -180
- package/dist/runtime/builtins.js.map +0 -1
- package/dist/runtime/callable.d.ts +0 -88
- package/dist/runtime/callable.d.ts.map +0 -1
- package/dist/runtime/callable.js +0 -98
- package/dist/runtime/callable.js.map +0 -1
- package/dist/runtime/context.d.ts +0 -13
- package/dist/runtime/context.d.ts.map +0 -1
- package/dist/runtime/context.js +0 -73
- package/dist/runtime/context.js.map +0 -1
- package/dist/runtime/core/evaluate.d.ts +0 -42
- package/dist/runtime/core/evaluate.d.ts.map +0 -1
- package/dist/runtime/core/evaluate.debug.js +0 -1251
- package/dist/runtime/core/evaluate.js +0 -1913
- package/dist/runtime/core/evaluate.js.map +0 -1
- package/dist/runtime/evaluate.d.ts +0 -32
- package/dist/runtime/evaluate.d.ts.map +0 -1
- package/dist/runtime/evaluate.js +0 -1111
- package/dist/runtime/evaluate.js.map +0 -1
- package/dist/runtime/execute.d.ts +0 -26
- package/dist/runtime/execute.d.ts.map +0 -1
- package/dist/runtime/execute.js +0 -121
- package/dist/runtime/execute.js.map +0 -1
- package/dist/runtime/signals.d.ts +0 -19
- package/dist/runtime/signals.d.ts.map +0 -1
- package/dist/runtime/signals.js +0 -26
- package/dist/runtime/signals.js.map +0 -1
- package/dist/runtime/types.d.ts +0 -169
- package/dist/runtime/types.d.ts.map +0 -1
- package/dist/runtime/types.js +0 -50
- package/dist/runtime/types.js.map +0 -1
- package/dist/runtime/values.d.ts +0 -50
- package/dist/runtime/values.d.ts.map +0 -1
- package/dist/runtime/values.js +0 -209
- package/dist/runtime/values.js.map +0 -1
- package/dist/runtime.d.ts +0 -254
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -2014
- 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
|
-
###
|
|
56
|
+
### Multiline Strings
|
|
57
57
|
|
|
58
|
-
Multiline strings use
|
|
58
|
+
Multiline strings use triple-quote syntax:
|
|
59
59
|
|
|
60
60
|
```rill
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
{$
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
EOF
|
|
67
|
-
)
|
|
61
|
+
"World" :> $name
|
|
62
|
+
"""
|
|
63
|
+
Hello, {$name}!
|
|
64
|
+
Line two
|
|
65
|
+
"""
|
|
68
66
|
```
|
|
69
67
|
|
|
70
|
-
|
|
68
|
+
Triple-quote strings support interpolation like regular strings.
|
|
71
69
|
|
|
72
70
|
See [Strings](09_strings.md) for string methods.
|
|
73
71
|
|
package/docs/03_variables.md
CHANGED
|
@@ -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
|
package/docs/04_operators.md
CHANGED
|
@@ -421,7 +421,7 @@ $list[1] # "b"
|
|
|
421
421
|
|
|
422
422
|
Use a variable as key:
|
|
423
423
|
|
|
424
|
-
```
|
|
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
|
-
```
|
|
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
|
-
```
|
|
444
|
+
```text
|
|
445
445
|
[nickname: "Al"] :> $user
|
|
446
446
|
$user.(name || nickname) # "Al"
|
|
447
447
|
```
|
package/docs/05_control-flow.md
CHANGED
|
@@ -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
|
package/docs/07_collections.md
CHANGED
|
@@ -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]
|
package/docs/10_parsing.md
CHANGED
|
@@ -130,7 +130,7 @@ $response -> parse_xml
|
|
|
130
130
|
### Chain-of-Thought Pattern
|
|
131
131
|
|
|
132
132
|
```rill
|
|
133
|
-
|
|
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
|
-
|
|
144
|
-
|
|
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
|
-
```
|
|
156
|
-
|
|
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
|
-
|
|
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
|
package/docs/11_reference.md
CHANGED
|
@@ -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]` |
|
package/docs/12_examples.md
CHANGED
|
@@ -15,57 +15,51 @@ args: requirements: string
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
17
|
# Phase 1: Validate requirements
|
|
18
|
-
|
|
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
|
-
|
|
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
|
-
|
|
29
|
+
"""
|
|
31
30
|
Create a technical specification from {$requirements}.
|
|
32
31
|
Include API design, data models, and component structure.
|
|
33
|
-
|
|
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
|
-
|
|
38
|
+
"""
|
|
41
39
|
Review this specification for issues:
|
|
42
40
|
{$}
|
|
43
41
|
|
|
44
42
|
Output APPROVED if ready, or REVISION REQUIRED with feedback.
|
|
45
|
-
|
|
46
|
-
) :> $review
|
|
43
|
+
""" -> prompt() :> $review
|
|
47
44
|
|
|
48
45
|
$review -> ?(.contains("APPROVED")) { break }
|
|
49
46
|
|
|
50
47
|
# Apply feedback and continue
|
|
51
|
-
|
|
48
|
+
"""
|
|
52
49
|
Update the specification based on this feedback:
|
|
53
50
|
{$review}
|
|
54
51
|
|
|
55
52
|
Original spec:
|
|
56
53
|
{$}
|
|
57
|
-
|
|
58
|
-
)
|
|
59
|
-
} :> $approved_spec
|
|
54
|
+
""" -> prompt()} :> $approved_spec
|
|
60
55
|
|
|
61
56
|
# Phase 4: Implementation
|
|
62
|
-
|
|
57
|
+
"""
|
|
63
58
|
Implement the approved specification:
|
|
64
59
|
{$approved_spec}
|
|
65
60
|
|
|
66
61
|
Create the necessary files and tests.
|
|
67
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
117
|
+
"""
|
|
126
118
|
Fix these test failures:
|
|
127
119
|
{$}
|
|
128
120
|
|
|
129
121
|
Make minimal changes. Then run tests again and report results.
|
|
130
|
-
|
|
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
|
-
|
|
144
|
+
"""
|
|
155
145
|
Evaluate for SECURITY issues:
|
|
156
146
|
{$summary}
|
|
157
147
|
|
|
158
148
|
Output PASS, WARN, or FAIL with explanation.
|
|
159
|
-
|
|
160
|
-
) :> $security
|
|
149
|
+
""" -> prompt() :> $security
|
|
161
150
|
|
|
162
151
|
# Performance check
|
|
163
|
-
|
|
152
|
+
"""
|
|
164
153
|
Evaluate for PERFORMANCE issues:
|
|
165
154
|
{$summary}
|
|
166
155
|
|
|
167
156
|
Output PASS, WARN, or FAIL with explanation.
|
|
168
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
216
|
+
"""
|
|
233
217
|
Perform: {$operation}
|
|
234
218
|
|
|
235
219
|
Output SUCCESS, RETRY, or FAILED.
|
|
236
|
-
|
|
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
|
-
|
|
248
|
+
"""
|
|
267
249
|
Compare the original:
|
|
268
250
|
{$raw}
|
|
269
251
|
|
|
270
252
|
With the analysis:
|
|
271
253
|
{$analysis}
|
|
272
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
376
|
+
"""
|
|
397
377
|
Process batch {$batch_num} of {$batches}
|
|
398
378
|
Items {$start} through {$end}
|
|
399
|
-
|
|
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
|
-
|
|
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
|
-
|
|
426
|
-
) :> $result
|
|
403
|
+
""" -> prompt() :> $result
|
|
427
404
|
|
|
428
405
|
$result -> @(!.contains(":::DONE:::")) {
|
|
429
|
-
|
|
406
|
+
"""
|
|
430
407
|
Continue working on: {$task}
|
|
431
408
|
|
|
432
409
|
Previous progress:
|
|
433
410
|
{$}
|
|
434
411
|
|
|
435
412
|
Remember the signal rules.
|
|
436
|
-
|
|
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
|
-
|
|
585
|
+
"""
|
|
611
586
|
What function should I call?
|
|
612
587
|
Return in format: <tool><name>func</name><args>{...}</args></tool>
|
|
613
|
-
|
|
614
|
-
) :> $response
|
|
588
|
+
""" -> prompt() :> $response
|
|
615
589
|
|
|
616
590
|
$response -> parse_xml("tool") :> $tool
|
|
617
591
|
$tool -> parse_xml("name") :> $fn_name
|