diff --git a/dsl-reference.md b/dsl-reference.md
index b79d734b..1c628bc0 100644
--- a/dsl-reference.md
+++ b/dsl-reference.md
@@ -981,8 +981,7 @@ Enables the execution of custom scripts or code within a workflow, empowering wo
| language | `string` | `yes` | The language of the script to run.
*Supported values are: [`js`](https://tc39.es/ecma262/2024/) and [`python`](https://www.python.org/downloads/release/python-3131/).* |
| code | `string` | `no` | The script's code.
*Required if `source` has not been set.* |
| source | [externalResource](#external-resource) | `no` | The script's resource.
*Required if `code` has not been set.* |
-| stdin | `string` | `no` | A runtime expression, if any, to the script as standard input (stdin).|
-| arguments | `string[]` | `no` | A list of the arguments, if any, to the script as argv |
+| arguments | `map` | `no` | A key/value mapping of the arguments, if any, to use when running the configured script |
| environment | `map` | `no` | A key/value mapping of the environment variables, if any, to use when running the configured script process |
@@ -999,21 +998,22 @@ Enables the execution of custom scripts or code within a workflow, empowering wo
```yaml
document:
- dsl: 1.0.3
+ dsl: '1.0.3'
namespace: examples
- name: run-script-example
+ name: run-script-with-arguments
version: 1.0.0
do:
- - runScript:
+ - setInput:
+ set:
+ message: Hello World
+ - log:
run:
script:
language: js
arguments:
- - hello
- - world
- code: |
- const [_, __, arg0, arg1] = process.argv;
- console.log('arg > ', arg0, arg1)
+ message: ${ .message }
+ code: >
+ console.log(message)
```
##### Shell Process
@@ -1026,7 +1026,7 @@ Enables the execution of shell commands within a workflow, enabling workflows to
|:--|:---:|:---:|:---|
| command | `string` | `yes` | The shell command to run |
| stdin | `string` | `no` | A runtime expression, if any, to the shell command as standard input (stdin).|
-| arguments | `string[]` | `no` | A list of the arguments, if any, to the shell command as argv |
+| arguments | `string[]` | `no` | A list of the arguments, if any, of the shell command to run |
| environment | `map` | `no` | A key/value mapping of the environment variables, if any, to use when running the configured process |
###### Examples
diff --git a/examples/run-script-with-arguments.yaml b/examples/run-script-with-arguments.yaml
new file mode 100644
index 00000000..e9230ac8
--- /dev/null
+++ b/examples/run-script-with-arguments.yaml
@@ -0,0 +1,17 @@
+document:
+ dsl: '1.0.3'
+ namespace: examples
+ name: run-script-with-arguments
+ version: 1.0.0
+do:
+ - setInput:
+ set:
+ message: Hello World
+ - log:
+ run:
+ script:
+ language: js
+ arguments:
+ message: ${ .message }
+ code: >
+ console.log(message)
diff --git a/examples/run-script-with-stdin-and-arguments.yaml b/examples/run-script-with-stdin-and-arguments.yaml
deleted file mode 100644
index bd5752c8..00000000
--- a/examples/run-script-with-stdin-and-arguments.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
-document:
- dsl: 1.0.3
- namespace: examples
- name: run-script-with-stdin-and-arguments
- version: 1.0.0
-do:
- - runScript:
- run:
- script:
- language: js
- stdin: "Hello Workflow"
- environment:
- foo: bar
- arguments:
- - hello
- code: |
- // Reading Input from STDIN
- import { readFileSync } from 'node:fs';
- const stdin = readFileSync(process.stdin.fd, 'utf8');
- console.log('stdin > ', stdin) // Output: stdin > Hello Workflow
-
- // Reading from argv
- const [_, __, arg] = process.argv;
- console.log('arg > ', arg) // Output: arg > hello
-
- // Reading from env
- const foo = process.env.foo;
- console.log('env > ', foo) // Output: env > bar
diff --git a/examples/run-shell-external-script.yaml b/examples/run-shell-external-script.yaml
new file mode 100644
index 00000000..bfb61ec7
--- /dev/null
+++ b/examples/run-shell-external-script.yaml
@@ -0,0 +1,21 @@
+document:
+ dsl: '1.0.3'
+ namespace: examples
+ name: run-shell-external-script
+ version: 1.0.0
+do:
+ - setInput:
+ set:
+ name: World
+ - greet:
+ input:
+ from: ${ .name }
+ run:
+ shell:
+ command: python3 /path/to/greet.py
+ stdin: ${ . }
+ arguments:
+ - --greeting
+ - Hello
+ environment:
+ LOG_LEVEL: info
diff --git a/schema/workflow.yaml b/schema/workflow.yaml
index 88c92bd1..8f0151e9 100644
--- a/schema/workflow.yaml
+++ b/schema/workflow.yaml
@@ -877,16 +877,11 @@ $defs:
type: string
title: ScriptLanguage
description: The language of the script to run.
- stdin:
- type: string
- title: ScriptStdin
- description: A runtime expression, if any, to the script as standard input (stdin).
arguments:
- type: array
+ type: object
title: ScriptArguments
- description: A list of the arguments, if any, to the script as argv
- items:
- type: string
+ description: A key/value mapping of the arguments, if any, to use when running the configured script.
+ additionalProperties: true
environment:
type: object
title: ScriptEnvironment
@@ -931,7 +926,7 @@ $defs:
arguments:
type: array
title: ShellArguments
- description: A list of the arguments, if any, to the shell command as argv
+ description: A list of the arguments, if any, of the shell command to run.
items:
type: string
environment: