@foresthubai/workflow-cli 0.4.3 → 0.4.5
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/LICENSE +661 -661
- package/NOTICE +23 -23
- package/README.md +137 -137
- package/dist/assets/index-C4Hm2Pud.js +75 -0
- package/dist/assets/index-CiLOHdeR.css +1 -0
- package/dist/index.html +14 -14
- package/dist-cli/cli.js +1325 -503
- package/dist-cli/deployment.yaml +105 -0
- package/dist-cli/llmproxy.yaml +303 -300
- package/dist-cli/workflow.yaml +913 -895
- package/package.json +2 -3
- package/dist/assets/index-CnM-MQ9w.css +0 -1
- package/dist/assets/index-LJpK2FES.js +0 -75
package/NOTICE
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
edge-agents/workflow-cli (@foresthubai/workflow-cli)
|
|
2
|
-
Copyright (c) 2026 ForestHub. All rights reserved.
|
|
3
|
-
|
|
4
|
-
This product includes software developed by ForestHub
|
|
5
|
-
(https://foresthub.ai). Source: https://github.com/ForestHubAI/edge-agents
|
|
6
|
-
|
|
7
|
-
The @foresthubai/workflow-cli package is the `fh-workflow` command-line
|
|
8
|
-
tool plus a bundled copy of the visual workflow builder. It is licensed
|
|
9
|
-
under the GNU Affero General Public License Version 3.0 (AGPL-3.0-only)
|
|
10
|
-
or a separate commercial license.
|
|
11
|
-
|
|
12
|
-
Because the published package bundles @foresthubai/workflow-builder
|
|
13
|
-
(AGPL-3.0-only) into its SPA assets, the package as a whole is
|
|
14
|
-
AGPL-3.0-only. The AGPL network clause applies: `fh-workflow open`
|
|
15
|
-
serves the builder over a local HTTP server, so the corresponding
|
|
16
|
-
source must be made available to users of that service — it is the
|
|
17
|
-
repository linked above.
|
|
18
|
-
|
|
19
|
-
It also bundles @foresthubai/workflow-core (Apache-2.0) and the
|
|
20
|
-
third-party libraries ajv, ajv-formats, js-yaml, jsep, and zod, each
|
|
21
|
-
under its own license. See THIRD_PARTY_NOTICES in the repository.
|
|
22
|
-
|
|
23
|
-
For commercial licensing inquiries: root@foresthub.ai
|
|
1
|
+
edge-agents/workflow-cli (@foresthubai/workflow-cli)
|
|
2
|
+
Copyright (c) 2026 ForestHub. All rights reserved.
|
|
3
|
+
|
|
4
|
+
This product includes software developed by ForestHub
|
|
5
|
+
(https://foresthub.ai). Source: https://github.com/ForestHubAI/edge-agents
|
|
6
|
+
|
|
7
|
+
The @foresthubai/workflow-cli package is the `fh-workflow` command-line
|
|
8
|
+
tool plus a bundled copy of the visual workflow builder. It is licensed
|
|
9
|
+
under the GNU Affero General Public License Version 3.0 (AGPL-3.0-only)
|
|
10
|
+
or a separate commercial license.
|
|
11
|
+
|
|
12
|
+
Because the published package bundles @foresthubai/workflow-builder
|
|
13
|
+
(AGPL-3.0-only) into its SPA assets, the package as a whole is
|
|
14
|
+
AGPL-3.0-only. The AGPL network clause applies: `fh-workflow open`
|
|
15
|
+
serves the builder over a local HTTP server, so the corresponding
|
|
16
|
+
source must be made available to users of that service — it is the
|
|
17
|
+
repository linked above.
|
|
18
|
+
|
|
19
|
+
It also bundles @foresthubai/workflow-core (Apache-2.0) and the
|
|
20
|
+
third-party libraries ajv, ajv-formats, js-yaml, jsep, and zod, each
|
|
21
|
+
under its own license. See THIRD_PARTY_NOTICES in the repository.
|
|
22
|
+
|
|
23
|
+
For commercial licensing inquiries: root@foresthub.ai
|
package/README.md
CHANGED
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
# @foresthubai/workflow-cli
|
|
2
|
-
|
|
3
|
-
`fh-workflow` — a self-contained CLI for authoring [
|
|
4
|
-
workflow JSON. Validate workflows headlessly, or open them in the **visual builder**
|
|
5
|
-
(bundled into this package — no other install, no account, no network). Backed by
|
|
6
|
-
[`@foresthubai/workflow-core`](../workflow-core) and the
|
|
7
|
-
[`@foresthubai/workflow-builder`](../workflow-builder) canvas.
|
|
8
|
-
|
|
9
|
-
> This package doubles as the in-repo reference SPA + dev CLI (its directory is
|
|
10
|
-
> `ts/workflow-cli/`). Published builds bundle core + builder, so an installed copy has no
|
|
11
|
-
> runtime `@foresthubai/*` dependency.
|
|
12
|
-
|
|
13
|
-
## Install
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npx @foresthubai/workflow-cli open my.workflow.json # no install
|
|
17
|
-
# or
|
|
18
|
-
npm i -g @foresthubai/workflow-cli # then: fh-workflow …
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Requires Node ≥ 20.
|
|
22
|
-
|
|
23
|
-
## Commands
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
fh-workflow open [file.json] [--static|--dev] Open the visual builder; optionally pre-load a workflow.
|
|
27
|
-
fh-workflow check-schema <file.json> Structural schema check against the contract. Non-zero on mismatch.
|
|
28
|
-
fh-workflow validate <file.json> Semantic validation (references, wiring, types). Non-zero on errors.
|
|
29
|
-
fh-workflow update <file.json> [out.json] Migrate a workflow to the current schema version.
|
|
30
|
-
fh-workflow deploy <file.json> [flags] Generate a self-contained deployment bundle. --help for flags.
|
|
31
|
-
fh-workflow help | -h | --help Print usage.
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### `open [file.json]`
|
|
35
|
-
|
|
36
|
-
Serves the builder and opens it in your browser.
|
|
37
|
-
|
|
38
|
-
- **With a file:** pre-loads that workflow and binds it so **Save writes back to the
|
|
39
|
-
same file on disk** (round-trip through the `/api/file` bridge). An unknown path
|
|
40
|
-
opens a blank canvas; the first Save creates it.
|
|
41
|
-
- **Without a file:** blank canvas in *standalone* mode. Save uses the browser File
|
|
42
|
-
System Access API (Chrome/Edge/Opera) to pick a location; browsers without it
|
|
43
|
-
(Firefox/Safari) fall back to a download.
|
|
44
|
-
|
|
45
|
-
The bound file's directory is the only path the bridge will read or write; anything
|
|
46
|
-
outside returns 403. The server binds `127.0.0.1` only.
|
|
47
|
-
|
|
48
|
-
**Two modes** (see [How it works](#how-it-works)): the installed CLI serves the
|
|
49
|
-
prebuilt SPA from a plain HTTP server on an ephemeral port (**STATIC**); in-repo it
|
|
50
|
-
spawns the Vite dev server with HMR (**DEV**). The build picks the default; override
|
|
51
|
-
with `--static` / `--dev` or `FH_BUILDER_MODE`.
|
|
52
|
-
|
|
53
|
-
### `check-schema <file.json>`
|
|
54
|
-
|
|
55
|
-
Structural gate — checks the raw JSON against the contract (`workflow.yaml`, shipped
|
|
56
|
-
with the package) using Ajv, **before** semantics. Reports shape errors (wrong
|
|
57
|
-
`type`, missing required field, bad enum) with a JSON-pointer path, and **exits `1`**
|
|
58
|
-
on any mismatch. Run it before `validate`.
|
|
59
|
-
|
|
60
|
-
### `validate <file.json>`
|
|
61
|
-
|
|
62
|
-
Semantic validation — no browser. Runs `workflow-core`'s pure validator (references,
|
|
63
|
-
wiring, types), prints `✗` errors / `⚠` warnings, and **exits `1` on any error**.
|
|
64
|
-
Suitable for CI / pre-commit.
|
|
65
|
-
|
|
66
|
-
### `update <file.json> [out.json]`
|
|
67
|
-
|
|
68
|
-
Migrates a workflow document up to the current schema version, in place or to a
|
|
69
|
-
second path.
|
|
70
|
-
|
|
71
|
-
### `deploy <file.json> [flags]`
|
|
72
|
-
|
|
73
|
-
Generates a self-contained, **standalone** deployment bundle for an edge controller —
|
|
74
|
-
a directory the engine boots from directly, with no backend and no account. It always
|
|
75
|
-
holds `workflow.json`, `docker-compose.yml`, `.env` (operator config, written `0600`),
|
|
76
|
-
and a `README.md` with the build/transfer/run steps. Workflows that declare hardware,
|
|
77
|
-
MQTT, or custom models additionally get `device_manifest.json`, `external_resources.json`
|
|
78
|
-
(`0600`), and `deployment_mapping.json`.
|
|
79
|
-
|
|
80
|
-
Missing values are filled in **interactively** at a terminal. Without a terminal (a
|
|
81
|
-
Claude Code skill, CI), supply them through `--values <file.json>` — a partial deploy
|
|
82
|
-
config as JSON; any still-missing required value exits non-zero. LLM provider keys can
|
|
83
|
-
also be passed as flags (`--anthropic-key`, …). Run `fh-workflow deploy --help` for the
|
|
84
|
-
full flag list.
|
|
85
|
-
|
|
86
|
-
## In-repo development
|
|
87
|
-
|
|
88
|
-
From `ts/workflow-cli` (resolves the libraries to **source**, so editing core/builder
|
|
89
|
-
hot-reloads with no rebuild):
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
npm run dev # blank canvas, HMR
|
|
93
|
-
npm run open -- sample.json # DEV: Vite dev server; Save writes back
|
|
94
|
-
npm run check-schema -- sample.json
|
|
95
|
-
npm run validate -- sample.json
|
|
96
|
-
node cli/fh-workflow.mjs open sample.json # dev launcher direct (tsx/source); the published bin is fh-workflow
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
`-- ` before the argument is required with `npm run` so the path reaches the CLI.
|
|
100
|
-
|
|
101
|
-
Exercise the installed (STATIC) path locally:
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
npm run build:all # SPA (vite) + CLI bundle (esbuild)
|
|
105
|
-
FH_BUILDER_MODE=static npm run open -- sample.json
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## npm scripts
|
|
109
|
-
|
|
110
|
-
| Script | Does |
|
|
111
|
-
| --- | --- |
|
|
112
|
-
| `dev` | `vite` — dev server, blank canvas, HMR |
|
|
113
|
-
| `open` / `check-schema` / `validate` / `deploy` / `cli` | the dev CLI via `tsx` (`cli` = no preset subcommand) |
|
|
114
|
-
| `build` | `vite build` — the SPA bundle → `dist/` |
|
|
115
|
-
| `build:cli` | esbuild — the CLI bundle → `dist-cli/cli.js` (+ `workflow.yaml`) |
|
|
116
|
-
| `build:all` | both of the above; the publishable artifacts |
|
|
117
|
-
| `preview` | serve the built SPA |
|
|
118
|
-
|
|
119
|
-
## How it works
|
|
120
|
-
|
|
121
|
-
- **Published bin** is the esbuild bundle `dist-cli/cli.js`: one Node ESM file with
|
|
122
|
-
`workflow-core`, `ajv`, `js-yaml`, `jsep` inlined — zero runtime deps, no `tsx`.
|
|
123
|
-
- **In-repo bin** is `cli/fh-workflow.mjs`, which loads the TypeScript CLI through
|
|
124
|
-
[`tsx`](https://github.com/privatenumber/tsx) at runtime — no build step.
|
|
125
|
-
- **`open` (STATIC):** `server/staticServer.ts` serves the prebuilt SPA (`dist/`) +
|
|
126
|
-
the `/api/file` bridge from a plain `http` server on an ephemeral port.
|
|
127
|
-
- **`open` (DEV):** spawns **Vite as a child process** (so Vite's config loader
|
|
128
|
-
doesn't fight the tsx loader), polls the port, opens the browser.
|
|
129
|
-
- **The `/api/file` bridge** lives in `server/fileBridge.ts` — one handler shared by
|
|
130
|
-
the Vite dev plugin (`plugins/filebridge.ts`) and the static server, so the
|
|
131
|
-
read/write path-traversal guard exists in exactly one place.
|
|
132
|
-
|
|
133
|
-
## License
|
|
134
|
-
|
|
135
|
-
AGPL-3.0-only (or commercial). The package bundles the AGPL `workflow-builder` into
|
|
136
|
-
its SPA; `open` serves it over local HTTP, so the AGPL network clause applies — see
|
|
137
|
-
[NOTICE](./NOTICE). For commercial licensing: root@foresthub.ai.
|
|
1
|
+
# @foresthubai/workflow-cli
|
|
2
|
+
|
|
3
|
+
`fh-workflow` — a self-contained CLI for authoring [Edge Agents](https://foresthub.ai)
|
|
4
|
+
workflow JSON. Validate workflows headlessly, or open them in the **visual builder**
|
|
5
|
+
(bundled into this package — no other install, no account, no network). Backed by
|
|
6
|
+
[`@foresthubai/workflow-core`](../workflow-core) and the
|
|
7
|
+
[`@foresthubai/workflow-builder`](../workflow-builder) canvas.
|
|
8
|
+
|
|
9
|
+
> This package doubles as the in-repo reference SPA + dev CLI (its directory is
|
|
10
|
+
> `ts/workflow-cli/`). Published builds bundle core + builder, so an installed copy has no
|
|
11
|
+
> runtime `@foresthubai/*` dependency.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @foresthubai/workflow-cli open my.workflow.json # no install
|
|
17
|
+
# or
|
|
18
|
+
npm i -g @foresthubai/workflow-cli # then: fh-workflow …
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Requires Node ≥ 20.
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
fh-workflow open [file.json] [--static|--dev] Open the visual builder; optionally pre-load a workflow.
|
|
27
|
+
fh-workflow check-schema <file.json> Structural schema check against the contract. Non-zero on mismatch.
|
|
28
|
+
fh-workflow validate <file.json> Semantic validation (references, wiring, types). Non-zero on errors.
|
|
29
|
+
fh-workflow update <file.json> [out.json] Migrate a workflow to the current schema version.
|
|
30
|
+
fh-workflow deploy <file.json> [flags] Generate a self-contained deployment bundle. --help for flags.
|
|
31
|
+
fh-workflow help | -h | --help Print usage.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### `open [file.json]`
|
|
35
|
+
|
|
36
|
+
Serves the builder and opens it in your browser.
|
|
37
|
+
|
|
38
|
+
- **With a file:** pre-loads that workflow and binds it so **Save writes back to the
|
|
39
|
+
same file on disk** (round-trip through the `/api/file` bridge). An unknown path
|
|
40
|
+
opens a blank canvas; the first Save creates it.
|
|
41
|
+
- **Without a file:** blank canvas in *standalone* mode. Save uses the browser File
|
|
42
|
+
System Access API (Chrome/Edge/Opera) to pick a location; browsers without it
|
|
43
|
+
(Firefox/Safari) fall back to a download.
|
|
44
|
+
|
|
45
|
+
The bound file's directory is the only path the bridge will read or write; anything
|
|
46
|
+
outside returns 403. The server binds `127.0.0.1` only.
|
|
47
|
+
|
|
48
|
+
**Two modes** (see [How it works](#how-it-works)): the installed CLI serves the
|
|
49
|
+
prebuilt SPA from a plain HTTP server on an ephemeral port (**STATIC**); in-repo it
|
|
50
|
+
spawns the Vite dev server with HMR (**DEV**). The build picks the default; override
|
|
51
|
+
with `--static` / `--dev` or `FH_BUILDER_MODE`.
|
|
52
|
+
|
|
53
|
+
### `check-schema <file.json>`
|
|
54
|
+
|
|
55
|
+
Structural gate — checks the raw JSON against the contract (`workflow.yaml`, shipped
|
|
56
|
+
with the package) using Ajv, **before** semantics. Reports shape errors (wrong
|
|
57
|
+
`type`, missing required field, bad enum) with a JSON-pointer path, and **exits `1`**
|
|
58
|
+
on any mismatch. Run it before `validate`.
|
|
59
|
+
|
|
60
|
+
### `validate <file.json>`
|
|
61
|
+
|
|
62
|
+
Semantic validation — no browser. Runs `workflow-core`'s pure validator (references,
|
|
63
|
+
wiring, types), prints `✗` errors / `⚠` warnings, and **exits `1` on any error**.
|
|
64
|
+
Suitable for CI / pre-commit.
|
|
65
|
+
|
|
66
|
+
### `update <file.json> [out.json]`
|
|
67
|
+
|
|
68
|
+
Migrates a workflow document up to the current schema version, in place or to a
|
|
69
|
+
second path.
|
|
70
|
+
|
|
71
|
+
### `deploy <file.json> [flags]`
|
|
72
|
+
|
|
73
|
+
Generates a self-contained, **standalone** deployment bundle for an edge controller —
|
|
74
|
+
a directory the engine boots from directly, with no backend and no account. It always
|
|
75
|
+
holds `workflow.json`, `docker-compose.yml`, `.env` (operator config, written `0600`),
|
|
76
|
+
and a `README.md` with the build/transfer/run steps. Workflows that declare hardware,
|
|
77
|
+
MQTT, or custom models additionally get `device_manifest.json`, `external_resources.json`
|
|
78
|
+
(`0600`), and `deployment_mapping.json`.
|
|
79
|
+
|
|
80
|
+
Missing values are filled in **interactively** at a terminal. Without a terminal (a
|
|
81
|
+
Claude Code skill, CI), supply them through `--values <file.json>` — a partial deploy
|
|
82
|
+
config as JSON; any still-missing required value exits non-zero. LLM provider keys can
|
|
83
|
+
also be passed as flags (`--anthropic-key`, …). Run `fh-workflow deploy --help` for the
|
|
84
|
+
full flag list.
|
|
85
|
+
|
|
86
|
+
## In-repo development
|
|
87
|
+
|
|
88
|
+
From `ts/workflow-cli` (resolves the libraries to **source**, so editing core/builder
|
|
89
|
+
hot-reloads with no rebuild):
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm run dev # blank canvas, HMR
|
|
93
|
+
npm run open -- sample.json # DEV: Vite dev server; Save writes back
|
|
94
|
+
npm run check-schema -- sample.json
|
|
95
|
+
npm run validate -- sample.json
|
|
96
|
+
node cli/fh-workflow.mjs open sample.json # dev launcher direct (tsx/source); the published bin is fh-workflow
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`-- ` before the argument is required with `npm run` so the path reaches the CLI.
|
|
100
|
+
|
|
101
|
+
Exercise the installed (STATIC) path locally:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm run build:all # SPA (vite) + CLI bundle (esbuild)
|
|
105
|
+
FH_BUILDER_MODE=static npm run open -- sample.json
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## npm scripts
|
|
109
|
+
|
|
110
|
+
| Script | Does |
|
|
111
|
+
| --- | --- |
|
|
112
|
+
| `dev` | `vite` — dev server, blank canvas, HMR |
|
|
113
|
+
| `open` / `check-schema` / `validate` / `deploy` / `cli` | the dev CLI via `tsx` (`cli` = no preset subcommand) |
|
|
114
|
+
| `build` | `vite build` — the SPA bundle → `dist/` |
|
|
115
|
+
| `build:cli` | esbuild — the CLI bundle → `dist-cli/cli.js` (+ `workflow.yaml`) |
|
|
116
|
+
| `build:all` | both of the above; the publishable artifacts |
|
|
117
|
+
| `preview` | serve the built SPA |
|
|
118
|
+
|
|
119
|
+
## How it works
|
|
120
|
+
|
|
121
|
+
- **Published bin** is the esbuild bundle `dist-cli/cli.js`: one Node ESM file with
|
|
122
|
+
`workflow-core`, `ajv`, `js-yaml`, `jsep` inlined — zero runtime deps, no `tsx`.
|
|
123
|
+
- **In-repo bin** is `cli/fh-workflow.mjs`, which loads the TypeScript CLI through
|
|
124
|
+
[`tsx`](https://github.com/privatenumber/tsx) at runtime — no build step.
|
|
125
|
+
- **`open` (STATIC):** `server/staticServer.ts` serves the prebuilt SPA (`dist/`) +
|
|
126
|
+
the `/api/file` bridge from a plain `http` server on an ephemeral port.
|
|
127
|
+
- **`open` (DEV):** spawns **Vite as a child process** (so Vite's config loader
|
|
128
|
+
doesn't fight the tsx loader), polls the port, opens the browser.
|
|
129
|
+
- **The `/api/file` bridge** lives in `server/fileBridge.ts` — one handler shared by
|
|
130
|
+
the Vite dev plugin (`plugins/filebridge.ts`) and the static server, so the
|
|
131
|
+
read/write path-traversal guard exists in exactly one place.
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
AGPL-3.0-only (or commercial). The package bundles the AGPL `workflow-builder` into
|
|
136
|
+
its SPA; `open` serves it over local HTTP, so the AGPL network clause applies — see
|
|
137
|
+
[NOTICE](./NOTICE). For commercial licensing: root@foresthub.ai.
|