shellflow 0.1.0__tar.gz → 0.2.0__tar.gz

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 (49) hide show
  1. {shellflow-0.1.0 → shellflow-0.2.0}/.gitignore +2 -0
  2. shellflow-0.2.0/CHANGELOG.md +8 -0
  3. {shellflow-0.1.0 → shellflow-0.2.0}/PKG-INFO +85 -9
  4. {shellflow-0.1.0 → shellflow-0.2.0}/README.md +84 -8
  5. shellflow-0.2.0/SKILL.md +406 -0
  6. shellflow-0.2.0/features/execution_contract.feature +29 -0
  7. shellflow-0.2.0/features/resilience_and_context.feature +24 -0
  8. shellflow-0.2.0/features/safety_controls.feature +24 -0
  9. shellflow-0.2.0/features/steps/shellflow_steps.py +958 -0
  10. shellflow-0.2.0/playbooks/hello.sh +89 -0
  11. {shellflow-0.1.0 → shellflow-0.2.0}/pyproject.toml +1 -1
  12. shellflow-0.2.0/specs/2026-03-15-01-agent-native-runner/design.md +458 -0
  13. shellflow-0.2.0/specs/2026-03-15-01-agent-native-runner/features/execution_contract.feature +29 -0
  14. shellflow-0.2.0/specs/2026-03-15-01-agent-native-runner/features/resilience_and_context.feature +24 -0
  15. shellflow-0.2.0/specs/2026-03-15-01-agent-native-runner/features/safety_controls.feature +24 -0
  16. shellflow-0.2.0/specs/2026-03-15-01-agent-native-runner/tasks.md +208 -0
  17. shellflow-0.2.0/src/shellflow.py +1524 -0
  18. {shellflow-0.1.0 → shellflow-0.2.0}/tests/test_shellflow.py +592 -0
  19. {shellflow-0.1.0 → shellflow-0.2.0}/uv.lock +1 -1
  20. shellflow-0.1.0/CHANGELOG.md +0 -11
  21. shellflow-0.1.0/features/steps/shellflow_steps.py +0 -237
  22. shellflow-0.1.0/playbooks/hello.sh +0 -8
  23. shellflow-0.1.0/src/shellflow.py +0 -802
  24. {shellflow-0.1.0 → shellflow-0.2.0}/.github/workflows/ci.yml +0 -0
  25. {shellflow-0.1.0 → shellflow-0.2.0}/.github/workflows/release.yml +0 -0
  26. {shellflow-0.1.0 → shellflow-0.2.0}/.python-version +0 -0
  27. {shellflow-0.1.0 → shellflow-0.2.0}/.rumdl.toml +0 -0
  28. {shellflow-0.1.0 → shellflow-0.2.0}/AGENTS.md +0 -0
  29. {shellflow-0.1.0 → shellflow-0.2.0}/CLAUDE.md +0 -0
  30. {shellflow-0.1.0 → shellflow-0.2.0}/Justfile +0 -0
  31. {shellflow-0.1.0 → shellflow-0.2.0}/assets/shellflow-run.png +0 -0
  32. {shellflow-0.1.0 → shellflow-0.2.0}/behave_runner.py +0 -0
  33. {shellflow-0.1.0 → shellflow-0.2.0}/cliff.toml +0 -0
  34. {shellflow-0.1.0 → shellflow-0.2.0}/context7.json +0 -0
  35. {shellflow-0.1.0 → shellflow-0.2.0}/features/__init__.py +0 -0
  36. {shellflow-0.1.0 → shellflow-0.2.0}/features/environment.py +0 -0
  37. {shellflow-0.1.0 → shellflow-0.2.0}/features/parser.feature +0 -0
  38. {shellflow-0.1.0 → shellflow-0.2.0}/features/runner.feature +0 -0
  39. {shellflow-0.1.0 → shellflow-0.2.0}/features/steps/__init__.py +0 -0
  40. {shellflow-0.1.0 → shellflow-0.2.0}/ruff.toml +0 -0
  41. {shellflow-0.1.0 → shellflow-0.2.0}/specs/2026-03-13-01-shellflow-runner/REFINEMENT_SUMMARY.md +0 -0
  42. {shellflow-0.1.0 → shellflow-0.2.0}/specs/2026-03-13-01-shellflow-runner/design.md +0 -0
  43. {shellflow-0.1.0 → shellflow-0.2.0}/specs/2026-03-13-01-shellflow-runner/features/config.feature +0 -0
  44. {shellflow-0.1.0 → shellflow-0.2.0}/specs/2026-03-13-01-shellflow-runner/features/parser.feature +0 -0
  45. {shellflow-0.1.0 → shellflow-0.2.0}/specs/2026-03-13-01-shellflow-runner/features/runner.feature +0 -0
  46. {shellflow-0.1.0 → shellflow-0.2.0}/specs/2026-03-13-01-shellflow-runner/features/steps/shellflow_steps.py +0 -0
  47. {shellflow-0.1.0 → shellflow-0.2.0}/specs/2026-03-13-01-shellflow-runner/tasks.md +0 -0
  48. {shellflow-0.1.0 → shellflow-0.2.0}/tests/__init__.py +0 -0
  49. {shellflow-0.1.0 → shellflow-0.2.0}/tests/fixtures/local_only.sh +0 -0
@@ -41,3 +41,5 @@ Thumbs.db
41
41
  .env
42
42
  .env.local
43
43
  .rumdl_cache/
44
+ .benchmarks/
45
+ .hypothesis/
@@ -0,0 +1,8 @@
1
+ ## [0.2.0] - 2026-03-15
2
+
3
+ ### Features
4
+
5
+ - Introduce agent-native execution contract and resilience features
6
+ - Update SKILL.md with changes to block directives and execution behavior guidelines
7
+
8
+ <!-- generated by git-cliff -->
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shellflow
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: A minimal shell script orchestrator with SSH support
5
5
  Project-URL: Homepage, https://github.com/longcipher/shellflow
6
6
  Project-URL: Repository, https://github.com/longcipher/shellflow
@@ -22,6 +22,8 @@ Description-Content-Type: text/markdown
22
22
 
23
23
  # ShellFlow
24
24
 
25
+ > AI agent native DevOps bash script orchestrator.
26
+
25
27
  [![DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/longcipher/shellflow)
26
28
  [![Context7](https://img.shields.io/badge/Website-context7.com-blue)](https://context7.com/longcipher/shellflow)
27
29
  [![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue.svg)](https://www.python.org/downloads/)
@@ -40,23 +42,43 @@ ShellFlow is a minimal shell script orchestrator for mixed local and remote exec
40
42
  - Run each block fail-fast, in order.
41
43
  - Reuse the shared prelude before the first marker for every block.
42
44
  - Pass the previous block output forward as `SHELLFLOW_LAST_OUTPUT`.
45
+ - Export named scalar values from a block into later block environments.
46
+ - Emit either a final JSON report or streaming JSON Lines events for agents.
47
+ - Support bounded `@TIMEOUT` and `@RETRY` directives without embedding workflow logic.
48
+ - Provide non-interactive, dry-run, and audit-log modes for automated execution.
43
49
  - Resolve remote targets from `~/.ssh/config` or a custom SSH config path.
44
50
 
45
51
  ## Quick Start
46
52
 
47
53
  ```bash
48
- git clone https://github.com/longcipher/shellflow.git
49
- cd shellflow
50
- uv sync --all-groups # uv sync --refresh --reinstall --no-cache
51
- uv tool install --force --reinstall --refresh --no-cache .
54
+ uv tool install shellflow
52
55
 
53
56
  shellflow run playbooks/hello.sh
54
57
  ```
55
58
 
56
- If you do not want a global tool install, use `uv run shellflow run playbooks/hello.sh`.
57
-
58
59
  ## Installation
59
60
 
61
+ ### User installation (from PyPI)
62
+
63
+ ```bash
64
+ uv tool install shellflow
65
+ shellflow --version
66
+ ```
67
+
68
+ ### Install Skill
69
+
70
+ ```bash
71
+ npx skills add longcipher/shellflow
72
+ ```
73
+
74
+ This installs the agent skill from this repository for writing and reviewing Shellflow playbooks.
75
+
76
+ To upgrade to the latest version:
77
+
78
+ ```bash
79
+ uv tool upgrade shellflow
80
+ ```
81
+
60
82
  ### Development checkout
61
83
 
62
84
  ```bash
@@ -65,14 +87,14 @@ cd shellflow
65
87
  uv sync --all-groups # uv sync --refresh --reinstall --no-cache
66
88
  ```
67
89
 
68
- ### Install as a local tool
90
+ ### Install as a local tool (from source)
69
91
 
70
92
  ```bash
71
93
  uv tool install --force .
72
94
  shellflow --version
73
95
  ```
74
96
 
75
- ### Install into the active environment
97
+ ### Install into the active environment (from source)
76
98
 
77
99
  ```bash
78
100
  uv pip install -e .
@@ -86,6 +108,12 @@ Shellflow recognizes two markers:
86
108
  - `# @LOCAL`
87
109
  - `# @REMOTE <ssh-host>`
88
110
 
111
+ Shellflow also recognizes bounded block directives at the top of a block body:
112
+
113
+ - `# @TIMEOUT <seconds>`
114
+ - `# @RETRY <count>`
115
+ - `# @EXPORT NAME=stdout|stderr|output|exit_code`
116
+
89
117
  `<ssh-host>` must match a `Host` entry in your SSH config. Shellflow then connects using that SSH host definition, which means the actual machine can be resolved through the configured `HostName`, `User`, `Port`, and `IdentityFile` values.
90
118
 
91
119
  Example:
@@ -95,6 +123,7 @@ Example:
95
123
  set -euo pipefail
96
124
 
97
125
  # @LOCAL
126
+ # @EXPORT VERSION=stdout
98
127
  echo "runs locally"
99
128
 
100
129
  # @REMOTE sui
@@ -102,6 +131,7 @@ uname -a
102
131
 
103
132
  # @LOCAL
104
133
  echo "remote output: $SHELLFLOW_LAST_OUTPUT"
134
+ echo "version = $VERSION"
105
135
  ```
106
136
 
107
137
  ## SSH Configuration
@@ -147,6 +177,18 @@ echo "build-123"
147
177
  echo "last output = $SHELLFLOW_LAST_OUTPUT"
148
178
  ```
149
179
 
180
+ Named exports are additive to `SHELLFLOW_LAST_OUTPUT`:
181
+
182
+ ```bash
183
+ # @LOCAL
184
+ # @EXPORT VERSION=stdout
185
+ echo "2026.03.15"
186
+
187
+ # @REMOTE sui
188
+ echo "deploying $VERSION"
189
+ echo "last output = $SHELLFLOW_LAST_OUTPUT"
190
+ ```
191
+
150
192
  Lines before the first marker are treated as a shared prelude and prepended to every executable block:
151
193
 
152
194
  ```bash
@@ -160,11 +202,41 @@ echo "prelude is active"
160
202
  echo "prelude is also active here"
161
203
  ```
162
204
 
205
+ ## Agent-Native Usage
206
+
207
+ Shellflow is designed to be the execution substrate for an outer agent, not an embedded planner.
208
+
209
+ - Use `--json` when you want one final machine-readable run report.
210
+ - Use `--jsonl` when you want ordered event records while the script runs.
211
+ - Use `--no-input` for CI or agent runs where interactive prompts must fail deterministically.
212
+ - Use `--dry-run` to preview planned execution without running commands.
213
+ - Use `--audit-log <path>` to mirror the structured event stream into a redacted JSONL file.
214
+
215
+ Recommended agent flow:
216
+
217
+ 1. Generate or select a plain shell script with `@LOCAL` and `@REMOTE` markers.
218
+ 2. Add bounded directives only where needed: `@TIMEOUT`, `@RETRY`, and `@EXPORT`.
219
+ 3. Run with `--json` or `--jsonl`.
220
+ 4. Let the outer agent decide whether to retry, branch, or stop based on Shellflow's structured result.
221
+
222
+ Shellflow intentionally does not provide:
223
+
224
+ - Conditional directives such as `@IF stdout_contains=...`
225
+ - A workflow DSL or embedded ReAct loop
226
+ - Heuristic destructive-command detection
227
+
228
+ Those decisions belong in the outer agent or automation layer.
229
+
163
230
  ## CLI
164
231
 
165
232
  ```text
166
233
  shellflow run <script>
167
234
  shellflow run <script> --verbose
235
+ shellflow run <script> --json
236
+ shellflow run <script> --jsonl
237
+ shellflow run <script> --no-input
238
+ shellflow run <script> --dry-run
239
+ shellflow run <script> --audit-log ./audit.jsonl --jsonl
168
240
  shellflow run <script> --ssh-config ./ssh_config
169
241
  shellflow --version
170
242
  ```
@@ -174,6 +246,10 @@ Examples:
174
246
  ```bash
175
247
  shellflow run playbooks/hello.sh
176
248
  shellflow run playbooks/hello.sh -v
249
+ shellflow run playbooks/hello.sh --json
250
+ shellflow run playbooks/hello.sh --jsonl --no-input
251
+ shellflow run playbooks/hello.sh --dry-run --jsonl
252
+ shellflow run playbooks/hello.sh --audit-log ./audit.jsonl --jsonl
177
253
  shellflow run playbooks/hello.sh --ssh-config ~/.ssh/config.work
178
254
  ```
179
255
 
@@ -1,5 +1,7 @@
1
1
  # ShellFlow
2
2
 
3
+ > AI agent native DevOps bash script orchestrator.
4
+
3
5
  [![DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/longcipher/shellflow)
4
6
  [![Context7](https://img.shields.io/badge/Website-context7.com-blue)](https://context7.com/longcipher/shellflow)
5
7
  [![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue.svg)](https://www.python.org/downloads/)
@@ -18,23 +20,43 @@ ShellFlow is a minimal shell script orchestrator for mixed local and remote exec
18
20
  - Run each block fail-fast, in order.
19
21
  - Reuse the shared prelude before the first marker for every block.
20
22
  - Pass the previous block output forward as `SHELLFLOW_LAST_OUTPUT`.
23
+ - Export named scalar values from a block into later block environments.
24
+ - Emit either a final JSON report or streaming JSON Lines events for agents.
25
+ - Support bounded `@TIMEOUT` and `@RETRY` directives without embedding workflow logic.
26
+ - Provide non-interactive, dry-run, and audit-log modes for automated execution.
21
27
  - Resolve remote targets from `~/.ssh/config` or a custom SSH config path.
22
28
 
23
29
  ## Quick Start
24
30
 
25
31
  ```bash
26
- git clone https://github.com/longcipher/shellflow.git
27
- cd shellflow
28
- uv sync --all-groups # uv sync --refresh --reinstall --no-cache
29
- uv tool install --force --reinstall --refresh --no-cache .
32
+ uv tool install shellflow
30
33
 
31
34
  shellflow run playbooks/hello.sh
32
35
  ```
33
36
 
34
- If you do not want a global tool install, use `uv run shellflow run playbooks/hello.sh`.
35
-
36
37
  ## Installation
37
38
 
39
+ ### User installation (from PyPI)
40
+
41
+ ```bash
42
+ uv tool install shellflow
43
+ shellflow --version
44
+ ```
45
+
46
+ ### Install Skill
47
+
48
+ ```bash
49
+ npx skills add longcipher/shellflow
50
+ ```
51
+
52
+ This installs the agent skill from this repository for writing and reviewing Shellflow playbooks.
53
+
54
+ To upgrade to the latest version:
55
+
56
+ ```bash
57
+ uv tool upgrade shellflow
58
+ ```
59
+
38
60
  ### Development checkout
39
61
 
40
62
  ```bash
@@ -43,14 +65,14 @@ cd shellflow
43
65
  uv sync --all-groups # uv sync --refresh --reinstall --no-cache
44
66
  ```
45
67
 
46
- ### Install as a local tool
68
+ ### Install as a local tool (from source)
47
69
 
48
70
  ```bash
49
71
  uv tool install --force .
50
72
  shellflow --version
51
73
  ```
52
74
 
53
- ### Install into the active environment
75
+ ### Install into the active environment (from source)
54
76
 
55
77
  ```bash
56
78
  uv pip install -e .
@@ -64,6 +86,12 @@ Shellflow recognizes two markers:
64
86
  - `# @LOCAL`
65
87
  - `# @REMOTE <ssh-host>`
66
88
 
89
+ Shellflow also recognizes bounded block directives at the top of a block body:
90
+
91
+ - `# @TIMEOUT <seconds>`
92
+ - `# @RETRY <count>`
93
+ - `# @EXPORT NAME=stdout|stderr|output|exit_code`
94
+
67
95
  `<ssh-host>` must match a `Host` entry in your SSH config. Shellflow then connects using that SSH host definition, which means the actual machine can be resolved through the configured `HostName`, `User`, `Port`, and `IdentityFile` values.
68
96
 
69
97
  Example:
@@ -73,6 +101,7 @@ Example:
73
101
  set -euo pipefail
74
102
 
75
103
  # @LOCAL
104
+ # @EXPORT VERSION=stdout
76
105
  echo "runs locally"
77
106
 
78
107
  # @REMOTE sui
@@ -80,6 +109,7 @@ uname -a
80
109
 
81
110
  # @LOCAL
82
111
  echo "remote output: $SHELLFLOW_LAST_OUTPUT"
112
+ echo "version = $VERSION"
83
113
  ```
84
114
 
85
115
  ## SSH Configuration
@@ -125,6 +155,18 @@ echo "build-123"
125
155
  echo "last output = $SHELLFLOW_LAST_OUTPUT"
126
156
  ```
127
157
 
158
+ Named exports are additive to `SHELLFLOW_LAST_OUTPUT`:
159
+
160
+ ```bash
161
+ # @LOCAL
162
+ # @EXPORT VERSION=stdout
163
+ echo "2026.03.15"
164
+
165
+ # @REMOTE sui
166
+ echo "deploying $VERSION"
167
+ echo "last output = $SHELLFLOW_LAST_OUTPUT"
168
+ ```
169
+
128
170
  Lines before the first marker are treated as a shared prelude and prepended to every executable block:
129
171
 
130
172
  ```bash
@@ -138,11 +180,41 @@ echo "prelude is active"
138
180
  echo "prelude is also active here"
139
181
  ```
140
182
 
183
+ ## Agent-Native Usage
184
+
185
+ Shellflow is designed to be the execution substrate for an outer agent, not an embedded planner.
186
+
187
+ - Use `--json` when you want one final machine-readable run report.
188
+ - Use `--jsonl` when you want ordered event records while the script runs.
189
+ - Use `--no-input` for CI or agent runs where interactive prompts must fail deterministically.
190
+ - Use `--dry-run` to preview planned execution without running commands.
191
+ - Use `--audit-log <path>` to mirror the structured event stream into a redacted JSONL file.
192
+
193
+ Recommended agent flow:
194
+
195
+ 1. Generate or select a plain shell script with `@LOCAL` and `@REMOTE` markers.
196
+ 2. Add bounded directives only where needed: `@TIMEOUT`, `@RETRY`, and `@EXPORT`.
197
+ 3. Run with `--json` or `--jsonl`.
198
+ 4. Let the outer agent decide whether to retry, branch, or stop based on Shellflow's structured result.
199
+
200
+ Shellflow intentionally does not provide:
201
+
202
+ - Conditional directives such as `@IF stdout_contains=...`
203
+ - A workflow DSL or embedded ReAct loop
204
+ - Heuristic destructive-command detection
205
+
206
+ Those decisions belong in the outer agent or automation layer.
207
+
141
208
  ## CLI
142
209
 
143
210
  ```text
144
211
  shellflow run <script>
145
212
  shellflow run <script> --verbose
213
+ shellflow run <script> --json
214
+ shellflow run <script> --jsonl
215
+ shellflow run <script> --no-input
216
+ shellflow run <script> --dry-run
217
+ shellflow run <script> --audit-log ./audit.jsonl --jsonl
146
218
  shellflow run <script> --ssh-config ./ssh_config
147
219
  shellflow --version
148
220
  ```
@@ -152,6 +224,10 @@ Examples:
152
224
  ```bash
153
225
  shellflow run playbooks/hello.sh
154
226
  shellflow run playbooks/hello.sh -v
227
+ shellflow run playbooks/hello.sh --json
228
+ shellflow run playbooks/hello.sh --jsonl --no-input
229
+ shellflow run playbooks/hello.sh --dry-run --jsonl
230
+ shellflow run playbooks/hello.sh --audit-log ./audit.jsonl --jsonl
155
231
  shellflow run playbooks/hello.sh --ssh-config ~/.ssh/config.work
156
232
  ```
157
233