Skip to content

Commit b832c19

Browse files
author
Tom Brandenburg
committed
feat: use Typer for flowsh CLI
1 parent fa872b7 commit b832c19

12 files changed

Lines changed: 753 additions & 490 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ venv/
1616
.env.*
1717

1818
.harness/
19+
.flowsh/
1920
dev/

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ help:
55
'flowsh - minimal workflow-to-harness generator' \
66
'' \
77
'Commands:' \
8-
' make install Create/update the uv environment' \
9-
' make lint Compile-check Python files' \
8+
' make install Install flowsh into the user PATH with uv tool' \
9+
' make lint Run Ruff and compile-check Python files' \
1010
' make test Run tests' \
1111
' make qa Run lint and tests' \
1212
' make clean Remove local test/build artifacts'
1313

1414
install:
15-
uv sync
15+
uv tool install --force .
1616

1717
lint:
18-
uv run python -m py_compile scripts/workflow_to_harness.py tests/test_workflow_to_harness.py
18+
uv run ruff check .
19+
uv run ruff format --check .
20+
uv run python -m py_compile src/flowsh/*.py scripts/workflow_to_harness.py tests/test_workflow_to_harness.py
1921

2022
test:
2123
uv run pytest
@@ -24,4 +26,4 @@ qa: lint test
2426
@printf '%s\n' 'QA passed'
2527

2628
clean:
27-
rm -rf .pytest_cache .harness scripts/__pycache__ tests/__pycache__ dist build
29+
rm -rf .pytest_cache .ruff_cache .harness .flowsh src/flowsh/__pycache__ scripts/__pycache__ tests/__pycache__ dist build

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# flowsh
22

3-
`flowsh` is now deliberately reduced to one tool:
3+
`flowsh` is a small `uv` Python CLI deliberately reduced to one tool:
44

55
```bash
6-
uv run flowsh .made/workflows.yml --output-root .
6+
uv run flowsh .made/workflows.yml
77
```
88

99
It reads MADE workflow YAML and writes executable Bash harness scripts for OpenCode.
@@ -16,9 +16,6 @@ Only this top-level shape is supported:
1616
workflows:
1717
- id: wf_example
1818
name: Example
19-
enabled: true
20-
schedule: manual
21-
shellScriptPath: .harness/example.sh
2219
steps:
2320
- type: vars
2421
name: Capture date
@@ -37,30 +34,34 @@ workflows:
3734
3835
Supported step types are only `vars`, `bash`, and `agent`.
3936

37+
Harness paths are derived from workflow ids. `wf_example` writes `.harness/example.sh`.
38+
4039
## Commands
4140

4241
```bash
4342
# Generate every workflow harness
44-
uv run flowsh .made/workflows.yml --output-root .
43+
uv run flowsh .made/workflows.yml
4544
46-
# Generate one workflow by id or name
45+
# Generate one workflow by id
4746
uv run flowsh .made/workflows.yml --workflow wf_example
4847
4948
# Show planned outputs without writing files
5049
uv run flowsh .made/workflows.yml --dry-run
5150
5251
# Overwrite existing harness files
5352
uv run flowsh .made/workflows.yml --force
54-
55-
# Print JSON Schema for the supported workflow file
56-
uv run flowsh .made/workflows.yml --print-schema
5753
```
5854

55+
Generated harness logs go to `.flowsh/logs` by default. Set `FLOWSH_LOG_DIR` when running a harness to use another local log directory.
56+
5957
## Development
6058

6159
```bash
60+
uv sync
6261
make install
6362
make qa
6463
```
6564

66-
`make qa` only validates the Python blueprint and its tests. There is no TypeScript compiler, template system, DSL explorer, or legacy node registry.
65+
`make install` installs `flowsh` into the user PATH with `uv tool install --force .`.
66+
67+
`make qa` runs Ruff, Python compile checks, and pytest. There is no TypeScript compiler, template system, DSL explorer, or legacy node registry.

pyproject.toml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
2-
requires = ["hatchling>=1.27"]
3-
build-backend = "hatchling.build"
2+
requires = ["uv_build>=0.9.9,<0.10.0"]
3+
build-backend = "uv_build"
44

55
[project]
66
name = "flowsh"
@@ -11,18 +11,24 @@ requires-python = ">=3.11"
1111
dependencies = [
1212
"PyYAML>=6,<7",
1313
"pydantic>=2,<3",
14+
"typer>=0.20,<0.21",
1415
]
1516

1617
[project.scripts]
17-
flowsh = "scripts.workflow_to_harness:main"
18+
flowsh = "flowsh.cli:main"
1819

1920
[dependency-groups]
2021
dev = [
2122
"pytest>=8,<9",
23+
"ruff>=0.14,<0.15",
2224
]
2325

2426
[tool.pytest.ini_options]
2527
testpaths = ["tests"]
2628

27-
[tool.hatch.build.targets.wheel]
28-
packages = ["scripts"]
29+
[tool.ruff]
30+
line-length = 100
31+
target-version = "py311"
32+
33+
[tool.ruff.lint]
34+
select = ["E", "F", "I", "UP", "B", "SIM"]

0 commit comments

Comments
 (0)