@eigenpal/cli 0.4.10 → 0.4.11

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.
@@ -26,7 +26,7 @@ init
26
26
  | Command | Description |
27
27
  | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
28
28
  | `eigenpal init workflow [options] <name>` | Alias of `eigenpal init <name>`. Kept so the `init {workflow,agent}` namespace stays visible — once the agent surface lights up, both kinds will live as siblings here. |
29
- | `eigenpal init agent [options] <name>` | Scaffold a new agent (agentic process) project — coming soon. The namespace is reserved so the workflow / agent split is visible from day one. |
29
+ | `eigenpal init agent [options] <name>` | Scaffold a new agent project — coming soon. Use `eigenpal agent push` with an existing agent project for now. |
30
30
 
31
31
  ## Details
32
32
 
@@ -50,7 +50,7 @@ Alias of `eigenpal init <name>`. Kept so the `init {workflow,agent}` namespace s
50
50
 
51
51
  ### `eigenpal init agent [options] <name>`
52
52
 
53
- Scaffold a new agent (agentic process) project — coming soon. The namespace is reserved so the workflow / agent split is visible from day one.
53
+ Scaffold a new agent project — coming soon. Use `eigenpal agent push` with an existing agent project for now.
54
54
 
55
55
  ### Arguments
56
56
 
@@ -70,21 +70,10 @@ the catalog tells you what fields it takes.
70
70
  - Real JS — `Array.prototype.reduce`, `JSON.parse`, etc.
71
71
  - Sandbox limits prevent infinite loops from blowing up an execution
72
72
 
73
- > **Common gotcha — TDZ on shadowed input names.** Each entry in `inputs`
74
- > becomes a top-level `const` binding inside your script. Re-declaring the
75
- > same name in the body shadows the binding and triggers a `ReferenceError:
76
- > Cannot access 'X' before initialization` (Temporal Dead Zone). For example:
77
- >
78
- > ```js
79
- > // ✗ TDZ — `located` is the input AND the inner const
80
- > const located = located || [];
81
- >
82
- > // ✓ Rename the inner variable
83
- > const safeLocated = located ?? [];
84
- > ```
85
- >
86
- > If you need a default, use `??` / `||` against the binding directly without
87
- > redeclaring, or rename the local. The same applies to `let` redeclarations.
73
+ > Each entry in `inputs:` becomes a parameter of `function script(...)`
74
+ > in declaration order. `inputs: { items, taxRate }` ⇒
75
+ > `function script(items, taxRate) { … }`. The function must `return`
76
+ > (or `throw`) a value.
88
77
 
89
78
  ## Reference / output paths
90
79
 
@@ -329,14 +318,14 @@ Convert XLSX spreadsheet to JSON array of row objects for use in scripts or down
329
318
 
330
319
  #### `transform.script` — Script
331
320
 
332
- Execute JavaScript code in a secure sandbox. Input keys become TOP-LEVEL variables (use "items" not "inputs.items"). Must return a value.
321
+ Execute a JavaScript function in a QuickJS sandbox. Input keys become the function's parameter list, in declaration order: `inputs: { items, taxRate }` ⇒ `function script(items, taxRate) { … }`. Must `return` (or `throw`) a value.
333
322
 
334
323
  **Config** (in `step.with`):
335
324
 
336
325
  | Field | Type | Required | Default | Description |
337
326
  | --- | --- | --- | --- | --- |
338
- | `inputs` | record<string, string> | no | | Named inputs mapped from template expressions. IMPORTANT: Keys become TOP-LEVEL variables in code (e.g., if key is "items", use "items" not "inputs.items"). |
339
- | `code` | string | yes | | JavaScript code. Input keys are available as top-level variables (NOT as inputs.key). Must return a value. |
327
+ | `inputs` | record<string, string> | no | | Named inputs mapped from template expressions. Keys become the function parameter list in declaration order: `inputs: { items, taxRate }` ⇒ `function script(items, taxRate) { … }`. |
328
+ | `function` | string | no | | JavaScript function declaration. Must be `function script(arg1, arg2, …) { … }` where the parameter list equals `Object.keys(inputs)` in declaration order. Must `return` (or `throw`) a value. |
340
329
  | `outputSchema` | record<string, unknown> | no | | JSON Schema describing the expected return value. Used for validation and type hints. |
341
330
  | `timeout` | number | no | `5000` | Max execution time in milliseconds (default: 5000) |
342
331
  | `memoryLimit` | number | no | `10485760` | Max memory in bytes (default: 10MB) |
@@ -158,10 +158,12 @@ arithmetic, regex) goes in `transform.script`:
158
158
  inputs: # explicit data deps — visible to the validator
159
159
  lineItems: '{{ steps.extract.output.lineItems }}'
160
160
  taxRate: '{{ input.taxRate }}'
161
- code: |
162
- const subtotal = lineItems.reduce((s, i) => s + i.price * i.qty, 0);
163
- const tax = subtotal * taxRate;
164
- return { subtotal, tax, total: subtotal + tax };
161
+ function: |
162
+ function script(lineItems, taxRate) {
163
+ const subtotal = lineItems.reduce((s, i) => s + i.price * i.qty, 0);
164
+ const tax = subtotal * taxRate;
165
+ return { subtotal, tax, total: subtotal + tax };
166
+ }
165
167
  outputSchema: # optional but recommended — runtime-validated
166
168
  type: object
167
169
  properties:
@@ -25,8 +25,10 @@ steps:
25
25
  with:
26
26
  inputs:
27
27
  text: '{{ input.text }}'
28
- code: |
29
- return { length: text.length, original: text };
28
+ function: |
29
+ function script(text) {
30
+ return { length: text.length, original: text };
31
+ }
30
32
  outputSchema:
31
33
  type: object
32
34
  properties:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eigenpal/cli",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "description": "Eigenpal CLI — author and run document workflows from your terminal. Agent-ready.",
5
5
  "keywords": [
6
6
  "eigenpal",