@walkeros/cli 4.1.0-next-1778668930820 → 4.1.0
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/CHANGELOG.md +33 -5
- package/README.md +21 -712
- package/dist/cli.js +2263 -1811
- package/dist/examples/README.md +6 -8
- package/dist/examples/flow-complete.json +1 -19
- package/dist/examples/flow-complete.md +10 -13
- package/dist/examples/index.js +1 -19
- package/dist/examples/index.js.map +1 -1
- package/dist/examples/server-collect.json +2 -2
- package/dist/index.js +191 -115
- package/dist/index.js.map +1 -1
- package/examples/README.md +6 -8
- package/examples/flow-complete.json +1 -19
- package/examples/flow-complete.md +10 -13
- package/examples/server-collect.json +2 -2
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,45 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## What is this?
|
|
7
|
-
|
|
8
|
-
The walkerOS CLI is a developer tool that:
|
|
1
|
+
<p align="left">
|
|
2
|
+
<a href="https://www.walkeros.io">
|
|
3
|
+
<img alt="walkerOS" title="walkerOS" src="https://www.walkeros.io/img/walkerOS_logo.svg" width="256px"/>
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
- **Simulates** event processing for testing (via `push --simulate`)
|
|
12
|
-
- **Runs** flows locally without Docker daemon
|
|
13
|
-
|
|
14
|
-
Think of it as your development toolchain for walkerOS - from config to running
|
|
15
|
-
production bundles.
|
|
16
|
-
|
|
17
|
-
### When to Use the CLI
|
|
18
|
-
|
|
19
|
-
The CLI is for **Bundled mode** — when you want config-as-code and separate
|
|
20
|
-
deployment:
|
|
7
|
+
# @walkeros/cli
|
|
21
8
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
| Static sites, landing pages | React/Next.js apps |
|
|
25
|
-
| Docker/server deployments | TypeScript projects |
|
|
26
|
-
| CI/CD versioned configs | Programmatic control |
|
|
27
|
-
| Marketing/GTM workflows | Build-time type safety |
|
|
9
|
+
Command-line tool for building, testing, and running walkerOS event collection
|
|
10
|
+
flows, from configuration to deployment.
|
|
28
11
|
|
|
29
|
-
|
|
30
|
-
[
|
|
12
|
+
[Documentation](https://www.walkeros.io/docs/apps/cli) •
|
|
13
|
+
[NPM Package](https://www.npmjs.com/package/@walkeros/cli) •
|
|
14
|
+
[Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/cli)
|
|
31
15
|
|
|
32
16
|
## Installation
|
|
33
17
|
|
|
34
18
|
```bash
|
|
35
|
-
# Global (recommended for CLI usage)
|
|
36
19
|
npm install -g @walkeros/cli
|
|
37
|
-
|
|
38
|
-
# Local (for programmatic usage)
|
|
39
|
-
npm install @walkeros/cli
|
|
40
20
|
```
|
|
41
21
|
|
|
42
|
-
## Quick
|
|
22
|
+
## Quick start
|
|
43
23
|
|
|
44
24
|
```bash
|
|
45
25
|
# Bundle a flow configuration
|
|
@@ -48,693 +28,22 @@ walkeros bundle flow.json
|
|
|
48
28
|
# Test with simulated events (no real API calls)
|
|
49
29
|
walkeros push flow.json --event '{"name":"product view"}' --simulate destination.demo
|
|
50
30
|
|
|
51
|
-
# Push real events to destinations
|
|
52
|
-
walkeros push flow.json --event '{"name":"product view"}'
|
|
53
|
-
|
|
54
31
|
# Run a collection server locally
|
|
55
32
|
walkeros run dist/flow.mjs --port 3000
|
|
56
33
|
```
|
|
57
34
|
|
|
58
|
-
##
|
|
59
|
-
|
|
60
|
-
### bundle
|
|
61
|
-
|
|
62
|
-
Generate optimized JavaScript bundles from flow configurations.
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
walkeros bundle <config-file> [options]
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Config files can be local paths or HTTP(S) URLs:
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
walkeros bundle ./config.json # Local file
|
|
72
|
-
walkeros bundle https://example.com/config.json # Remote URL
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
**Options:**
|
|
76
|
-
|
|
77
|
-
- `--flow <name>` - Flow name for multi-flow configs
|
|
78
|
-
- `--all` - Build all flows for multi-flow configs
|
|
79
|
-
- `--stats` - Show bundle statistics
|
|
80
|
-
- `--json` - Output as JSON (implies --stats)
|
|
81
|
-
- `--no-cache` - Disable package caching
|
|
82
|
-
- `-v, --verbose` - Verbose output
|
|
83
|
-
- `-s, --silent` - Suppress output
|
|
84
|
-
|
|
85
|
-
**Examples:**
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
# Bundle with stats
|
|
89
|
-
walkeros bundle examples/server-collect.json --stats
|
|
90
|
-
|
|
91
|
-
# Bundle to a custom output directory
|
|
92
|
-
walkeros bundle flow.json -o ./build/
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### Server bundles use nft tracing
|
|
96
|
-
|
|
97
|
-
Server flows (`platform: "server"`) are bundled with `@vercel/nft`. The CLI
|
|
98
|
-
externalizes every step package, traces the entry to discover which files are
|
|
99
|
-
actually reachable at runtime, and copies only those files into
|
|
100
|
-
`dist/node_modules/`. Step packages are installed via pacote, driven by the
|
|
101
|
-
`config.bundle.packages` field in `flow.json`. **You do not need to run
|
|
102
|
-
`npm install` for step packages**: only `@walkeros/cli` belongs in your
|
|
103
|
-
`package.json` devDependencies.
|
|
104
|
-
|
|
105
|
-
The output is always a directory:
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
dist/
|
|
109
|
-
├── flow.mjs # ESM entry point
|
|
110
|
-
├── package.json # informational sidecar
|
|
111
|
-
└── node_modules/ # only the files nft traced
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
For web flows the output stays a single self-contained file (default
|
|
115
|
-
`dist/walker.js`).
|
|
116
|
-
|
|
117
|
-
### push
|
|
118
|
-
|
|
119
|
-
Execute your flow with real API calls, or simulate specific steps with
|
|
120
|
-
`--simulate`. Accepts either a config JSON (which gets bundled) or a pre-built
|
|
121
|
-
bundle.
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
walkeros push <input> --event '<json>' [options]
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
**Input types:**
|
|
128
|
-
|
|
129
|
-
- **Config JSON** - Bundled and executed
|
|
130
|
-
- **Pre-built bundle** (`.js`/`.mjs`) - Executed directly
|
|
131
|
-
|
|
132
|
-
The CLI auto-detects the input type by attempting to parse as JSON.
|
|
133
|
-
|
|
134
|
-
**Options:**
|
|
135
|
-
|
|
136
|
-
- `-e, --event <source>` - Event to push (JSON string, file path, or URL)
|
|
137
|
-
**Required** (unless simulating a source)
|
|
138
|
-
- `--flow <name>` - Flow name (for multi-flow configs)
|
|
139
|
-
- `-p, --platform <platform>` - Platform override (`web` or `server`)
|
|
140
|
-
- `--simulate <step>` - Simulate a step (repeatable). Mocks the step's push,
|
|
141
|
-
captures result. Use `destination.NAME` or `source.NAME`.
|
|
142
|
-
- `--mock <step=value>` - Mock a step with a specific return value (repeatable).
|
|
143
|
-
Use `destination.NAME=VALUE`.
|
|
144
|
-
- `--snapshot <source>` - JS file to eval before execution. Sets global state
|
|
145
|
-
(`window.dataLayer`, `process.env`, etc.).
|
|
146
|
-
- `--json` - Output results as JSON
|
|
147
|
-
- `-v, --verbose` - Verbose output
|
|
148
|
-
- `-s, --silent` - Suppress output (for CI/CD)
|
|
149
|
-
|
|
150
|
-
**Event input formats:**
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
# Inline JSON
|
|
154
|
-
walkeros push flow.json --event '{"name":"page view","data":{"title":"Home"}}'
|
|
155
|
-
|
|
156
|
-
# File path
|
|
157
|
-
walkeros push flow.json --event ./events/order.json
|
|
158
|
-
|
|
159
|
-
# URL
|
|
160
|
-
walkeros push flow.json --event https://example.com/sample-event.json
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
**Simulation examples:**
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
# Simulate a destination (mock its push, capture API calls)
|
|
167
|
-
walkeros push flow.json -e event.json --simulate destination.ga4
|
|
168
|
-
|
|
169
|
-
# Simulate a source (capture events, disable all destinations)
|
|
170
|
-
walkeros push flow.json --simulate source.browser
|
|
171
|
-
|
|
172
|
-
# Mock a destination with a specific return value
|
|
173
|
-
walkeros push flow.json -e event.json --mock destination.ga4='{"status":"ok"}'
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
**Bundle input:**
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
# Push with pre-built bundle
|
|
180
|
-
walkeros push dist/flow.mjs --event '{"name":"order complete"}'
|
|
181
|
-
|
|
182
|
-
# Override platform detection
|
|
183
|
-
walkeros push dist/walker.js --platform web --event '{"name":"order complete"}'
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
**Push modes:**
|
|
187
|
-
|
|
188
|
-
| Mode | Flag | API Calls | Use Case |
|
|
189
|
-
| -------- | ------------ | ------------------ | ------------------- |
|
|
190
|
-
| Real | (none) | Real HTTP requests | Integration testing |
|
|
191
|
-
| Simulate | `--simulate` | Mocked (captured) | Safe local testing |
|
|
192
|
-
| Mock | `--mock` | Returns mock value | Controlled testing |
|
|
193
|
-
|
|
194
|
-
Use `--simulate` first to validate safely, then push without flags for real
|
|
195
|
-
integrations.
|
|
196
|
-
|
|
197
|
-
### setup
|
|
198
|
-
|
|
199
|
-
Run the optional `setup()` lifecycle on a single component to provision external
|
|
200
|
-
resources (BigQuery datasets, Pub/Sub topics, SQLite tables, webhook
|
|
201
|
-
registrations).
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
walkeros setup <target> [options]
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
**Target format:** `<kind>.<name>` matching `walkeros push --simulate`. Valid
|
|
208
|
-
kinds: `source`, `destination`, `store`. Transformers are pure functions and
|
|
209
|
-
have no setup.
|
|
210
|
-
|
|
211
|
-
**Options:**
|
|
212
|
-
|
|
213
|
-
- `-c, --config <path>` - Flow config file (default: `./flow.json`)
|
|
214
|
-
- `-f, --flow <name>` - Flow name for multi-flow configs
|
|
215
|
-
- `--json` - Output as JSON
|
|
216
|
-
- `-v, --verbose` - Verbose output
|
|
217
|
-
- `-s, --silent` - Suppress output
|
|
218
|
-
|
|
219
|
-
**Behavior:**
|
|
220
|
-
|
|
221
|
-
- Loads the flow config, resolves the named component, imports its package, and
|
|
222
|
-
calls `setup({ id, config, env, logger })`. No collector boot, no event
|
|
223
|
-
pipeline, no destinations are pushed to.
|
|
224
|
-
- Skips with an explanatory message in three cases: the package has no `setup`
|
|
225
|
-
function, `config.setup === false`, or `config.setup` is unset.
|
|
226
|
-
- When `setup()` returns a non-undefined value, the CLI emits it as JSON on
|
|
227
|
-
stdout for `jq`-style scripting.
|
|
228
|
-
- Exit code `0` on success or skip, non-zero on failure.
|
|
229
|
-
|
|
230
|
-
**Operator-time, never automatic.** Setup is explicit only. It is never
|
|
231
|
-
triggered by `push`, `simulate`, `deploy`, or the long-running runtime.
|
|
232
|
-
Operators run it once when provisioning, and again only when external resources
|
|
233
|
-
need to be re-provisioned.
|
|
234
|
-
|
|
235
|
-
**IAM note:** Setup typically needs higher permissions than runtime push (for
|
|
236
|
-
example, "create dataset" vs "write rows"). Operators commonly run setup with a
|
|
237
|
-
separate service account or different credentials than the runtime uses.
|
|
238
|
-
|
|
239
|
-
**Examples:**
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
# Provision the BigQuery dataset and table for the destination named "bigquery"
|
|
243
|
-
# in the default flow file.
|
|
244
|
-
walkeros setup destination.bigquery
|
|
245
|
-
|
|
246
|
-
# Same but pointing to a specific flow in a multi-flow config.
|
|
247
|
-
walkeros setup destination.bigquery --flow analytics
|
|
248
|
-
|
|
249
|
-
# Custom config path.
|
|
250
|
-
walkeros setup destination.bigquery --config ./flows/prod.json
|
|
251
|
-
|
|
252
|
-
# Pipe the structured result to jq.
|
|
253
|
-
walkeros setup destination.bigquery --json | jq .datasetCreated
|
|
254
|
-
|
|
255
|
-
# Provision a Pub/Sub source's subscription.
|
|
256
|
-
walkeros setup source.events-in
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### run
|
|
260
|
-
|
|
261
|
-
Run flows locally (no Docker daemon required).
|
|
262
|
-
|
|
263
|
-
```bash
|
|
264
|
-
walkeros run <config-file> [options]
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
**Options:**
|
|
268
|
-
|
|
269
|
-
- `-p, --port <number>` - Server port
|
|
270
|
-
- `-h, --host <host>` - Server host
|
|
271
|
-
- `--json` - Output as JSON
|
|
272
|
-
- `-v, --verbose` - Verbose output
|
|
273
|
-
- `-s, --silent` - Suppress output
|
|
274
|
-
|
|
275
|
-
**Examples:**
|
|
276
|
-
|
|
277
|
-
```bash
|
|
278
|
-
# Run collection server (auto-bundles JSON)
|
|
279
|
-
walkeros run examples/server-collect.json --port 3000
|
|
280
|
-
|
|
281
|
-
# Run with a pre-built server bundle
|
|
282
|
-
walkeros run dist/flow.mjs --port 3000
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
**How it works:**
|
|
286
|
-
|
|
287
|
-
1. JSON configs are auto-bundled to temp `.mjs`
|
|
288
|
-
2. `.mjs` bundles are used directly
|
|
289
|
-
3. Runs in current Node.js process
|
|
290
|
-
4. Press Ctrl+C for graceful shutdown
|
|
291
|
-
|
|
292
|
-
### validate
|
|
293
|
-
|
|
294
|
-
Validate flow configurations, events, mappings, or contracts.
|
|
295
|
-
|
|
296
|
-
```bash
|
|
297
|
-
walkeros validate <config-file> [options]
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
By default, validates a Flow.Config file — checking schema, references, and
|
|
301
|
-
cross-step example compatibility.
|
|
302
|
-
|
|
303
|
-
**Options:**
|
|
304
|
-
|
|
305
|
-
- `--type <type>` - Validation type (default: `flow`). Also accepts: `event`,
|
|
306
|
-
`mapping`, `contract`
|
|
307
|
-
- `--path <path>` - Validate a specific entry against its package schema (e.g.,
|
|
308
|
-
`destinations.snowplow`, `sources.browser`)
|
|
309
|
-
- `--flow <name>` - Flow name for multi-flow configs
|
|
310
|
-
- `--strict` - Treat warnings as errors
|
|
311
|
-
- `--json` - Output as JSON
|
|
312
|
-
- `-v, --verbose` - Verbose output
|
|
313
|
-
- `-s, --silent` - Suppress output
|
|
314
|
-
|
|
315
|
-
**Exit codes:** `0` = valid, `1` = errors, `2` = warnings (with --strict), `3` =
|
|
316
|
-
input error
|
|
317
|
-
|
|
318
|
-
**Examples:**
|
|
319
|
-
|
|
320
|
-
```bash
|
|
321
|
-
# Validate flow config (schema + examples)
|
|
322
|
-
walkeros validate flow.json
|
|
323
|
-
|
|
324
|
-
# Validate specific flow
|
|
325
|
-
walkeros validate flow.json --flow analytics
|
|
326
|
-
|
|
327
|
-
# Validate a single event
|
|
328
|
-
walkeros validate event.json --type event
|
|
329
|
-
|
|
330
|
-
# Validate in CI
|
|
331
|
-
walkeros validate flow.json --json --strict || exit 1
|
|
332
|
-
|
|
333
|
-
# Validate entry against package schema
|
|
334
|
-
walkeros validate flow.json --path destinations.snowplow
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
### deploy
|
|
338
|
-
|
|
339
|
-
Deploy flows to walkerOS cloud.
|
|
340
|
-
|
|
341
|
-
```bash
|
|
342
|
-
walkeros deploy start <flowId> [options]
|
|
343
|
-
walkeros deploy status <flowId> [options]
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
**Options:**
|
|
347
|
-
|
|
348
|
-
- `--project <id>` - Project ID (defaults to WALKEROS_PROJECT_ID)
|
|
349
|
-
- `--flow <name>` - Flow name for multi-config flows
|
|
350
|
-
- `--no-wait` - Do not wait for deployment to complete (start only)
|
|
351
|
-
- `--json` - Output as JSON
|
|
352
|
-
- `-v, --verbose` - Verbose output
|
|
353
|
-
- `-s, --silent` - Suppress output
|
|
354
|
-
|
|
355
|
-
**Examples:**
|
|
356
|
-
|
|
357
|
-
```bash
|
|
358
|
-
# Deploy a single-config flow
|
|
359
|
-
walkeros deploy start cfg_abc123
|
|
360
|
-
|
|
361
|
-
# Deploy a specific config from a multi-config flow
|
|
362
|
-
walkeros deploy start cfg_abc123 --flow web
|
|
363
|
-
|
|
364
|
-
# Check deployment status
|
|
365
|
-
walkeros deploy status cfg_abc123 --flow server
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
When a flow has multiple configs, the CLI requires `--flow <name>` to specify
|
|
369
|
-
which one to deploy. If omitted, the error message lists available names.
|
|
370
|
-
|
|
371
|
-
## Caching
|
|
372
|
-
|
|
373
|
-
The CLI implements intelligent caching for faster builds:
|
|
374
|
-
|
|
375
|
-
### Package Cache
|
|
376
|
-
|
|
377
|
-
- NPM packages are cached in `.tmp/cache/packages/`
|
|
378
|
-
- Mutable versions (`latest`, `^`, `~`) are re-checked daily
|
|
379
|
-
- Exact versions (`0.4.1`) are cached indefinitely
|
|
380
|
-
|
|
381
|
-
### Build Cache
|
|
382
|
-
|
|
383
|
-
- Compiled bundles are cached in `.tmp/cache/builds/`
|
|
384
|
-
- Cache key based on flow.json content + current date
|
|
385
|
-
- Identical configs reuse cached build within the same day
|
|
386
|
-
|
|
387
|
-
### Cache Management
|
|
388
|
-
|
|
389
|
-
```bash
|
|
390
|
-
# View cache info
|
|
391
|
-
walkeros cache info
|
|
392
|
-
|
|
393
|
-
# Clear all caches
|
|
394
|
-
walkeros cache clear
|
|
395
|
-
|
|
396
|
-
# Clear only package cache
|
|
397
|
-
walkeros cache clear --packages
|
|
398
|
-
|
|
399
|
-
# Clear only build cache
|
|
400
|
-
walkeros cache clear --builds
|
|
401
|
-
|
|
402
|
-
# Disable caching for a single build
|
|
403
|
-
walkeros bundle flow.json --no-cache
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
## Flow Configuration
|
|
407
|
-
|
|
408
|
-
Flow configs use the `Flow.Json` format with `version` and `flows`:
|
|
409
|
-
|
|
410
|
-
```json
|
|
411
|
-
{
|
|
412
|
-
"version": 4,
|
|
413
|
-
"flows": {
|
|
414
|
-
"default": {
|
|
415
|
-
"config": {
|
|
416
|
-
"platform": "server",
|
|
417
|
-
"bundle": {
|
|
418
|
-
"packages": {
|
|
419
|
-
"@walkeros/collector": { "imports": ["startFlow"] },
|
|
420
|
-
"@walkeros/server-source-express": {},
|
|
421
|
-
"@walkeros/destination-demo": {}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
},
|
|
425
|
-
"sources": {
|
|
426
|
-
"http": {
|
|
427
|
-
"package": "@walkeros/server-source-express",
|
|
428
|
-
"config": {
|
|
429
|
-
"settings": { "path": "/collect", "port": 8080 }
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
},
|
|
433
|
-
"destinations": {
|
|
434
|
-
"demo": {
|
|
435
|
-
"package": "@walkeros/destination-demo",
|
|
436
|
-
"config": {
|
|
437
|
-
"settings": { "name": "Demo" }
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
},
|
|
441
|
-
"collector": { "run": true }
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
Platform is set via `config.platform` (`"web"` or `"server"`). The
|
|
448
|
-
`config.bundle.packages` field declares what pacote should install.
|
|
449
|
-
`config.bundle.overrides` pins transitive dependency versions when needed.
|
|
450
|
-
|
|
451
|
-
### Package Configuration Patterns
|
|
452
|
-
|
|
453
|
-
The CLI automatically resolves imports based on how you configure packages:
|
|
454
|
-
|
|
455
|
-
**1. Default exports (recommended for single-export packages):**
|
|
456
|
-
|
|
457
|
-
```json
|
|
458
|
-
{
|
|
459
|
-
"packages": {
|
|
460
|
-
"@walkeros/server-destination-api": {}
|
|
461
|
-
},
|
|
462
|
-
"destinations": {
|
|
463
|
-
"api": {
|
|
464
|
-
"package": "@walkeros/server-destination-api"
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
```
|
|
469
|
-
|
|
470
|
-
The CLI generates:
|
|
471
|
-
`import _walkerosServerDestinationApi from '@walkeros/server-destination-api';`
|
|
472
|
-
|
|
473
|
-
**2. Named exports (for multi-export packages):**
|
|
474
|
-
|
|
475
|
-
```json
|
|
476
|
-
{
|
|
477
|
-
"packages": {
|
|
478
|
-
"@walkeros/server-destination-gcp": {}
|
|
479
|
-
},
|
|
480
|
-
"destinations": {
|
|
481
|
-
"bigquery": {
|
|
482
|
-
"package": "@walkeros/server-destination-gcp",
|
|
483
|
-
"code": "destinationBigQuery"
|
|
484
|
-
},
|
|
485
|
-
"analytics": {
|
|
486
|
-
"package": "@walkeros/server-destination-gcp",
|
|
487
|
-
"code": "destinationAnalytics"
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
The CLI generates:
|
|
494
|
-
`import { destinationBigQuery, destinationAnalytics } from '@walkeros/server-destination-gcp';`
|
|
495
|
-
|
|
496
|
-
**3. Utility imports (for helper functions):**
|
|
497
|
-
|
|
498
|
-
```json
|
|
499
|
-
{
|
|
500
|
-
"packages": {
|
|
501
|
-
"lodash": { "imports": ["get", "set"] }
|
|
502
|
-
},
|
|
503
|
-
"mappings": {
|
|
504
|
-
"custom": {
|
|
505
|
-
"data": "({ data }) => get(data, 'user.email')"
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
```
|
|
510
|
-
|
|
511
|
-
The CLI generates: `import { get, set } from 'lodash';`
|
|
512
|
-
|
|
513
|
-
**Key points:**
|
|
514
|
-
|
|
515
|
-
- Omit `packages.imports` for destinations/sources - the default export is used
|
|
516
|
-
automatically
|
|
517
|
-
- Only specify `code` when using a specific named export from a multi-export
|
|
518
|
-
package
|
|
519
|
-
- Use `packages.imports` only for utilities needed in mappings or custom code
|
|
520
|
-
|
|
521
|
-
### Local Packages
|
|
522
|
-
|
|
523
|
-
Use local packages instead of npm for development or testing unpublished
|
|
524
|
-
packages:
|
|
525
|
-
|
|
526
|
-
```json
|
|
527
|
-
{
|
|
528
|
-
"packages": {
|
|
529
|
-
"@walkeros/collector": {
|
|
530
|
-
"path": "../packages/collector",
|
|
531
|
-
"imports": ["startFlow"]
|
|
532
|
-
},
|
|
533
|
-
"@my/custom-destination": {
|
|
534
|
-
"path": "./my-destination",
|
|
535
|
-
"imports": ["myDestination"]
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
```
|
|
540
|
-
|
|
541
|
-
**Resolution rules:**
|
|
542
|
-
|
|
543
|
-
- `path` takes precedence over `version`
|
|
544
|
-
- Relative paths are resolved from the config file's directory
|
|
545
|
-
- If `dist/` folder exists, it's used; otherwise package root is used
|
|
546
|
-
|
|
547
|
-
**Dependency resolution:**
|
|
548
|
-
|
|
549
|
-
When a local package has dependencies on other packages that are also specified
|
|
550
|
-
with local paths, the CLI will use the local versions for those dependencies
|
|
551
|
-
too. This prevents npm versions from overwriting your local packages.
|
|
552
|
-
|
|
553
|
-
```json
|
|
554
|
-
{
|
|
555
|
-
"packages": {
|
|
556
|
-
"@walkeros/core": {
|
|
557
|
-
"path": "../packages/core",
|
|
558
|
-
"imports": []
|
|
559
|
-
},
|
|
560
|
-
"@walkeros/collector": {
|
|
561
|
-
"path": "../packages/collector",
|
|
562
|
-
"imports": ["startFlow"]
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
```
|
|
567
|
-
|
|
568
|
-
In this example, even though `@walkeros/collector` depends on `@walkeros/core`,
|
|
569
|
-
the local version of core will be used (not downloaded from npm).
|
|
570
|
-
|
|
571
|
-
See [examples/](./examples/) for complete working configurations.
|
|
572
|
-
|
|
573
|
-
## Programmatic API
|
|
574
|
-
|
|
575
|
-
Use commands programmatically:
|
|
576
|
-
|
|
577
|
-
```typescript
|
|
578
|
-
import { bundle, push, runCommand } from '@walkeros/cli';
|
|
579
|
-
|
|
580
|
-
// Bundle
|
|
581
|
-
await bundle({
|
|
582
|
-
config: './flow.json',
|
|
583
|
-
stats: true,
|
|
584
|
-
});
|
|
585
|
-
|
|
586
|
-
// Push with simulation
|
|
587
|
-
const result = await push(
|
|
588
|
-
'./flow.json',
|
|
589
|
-
{ name: 'page view', data: { title: 'Test' } },
|
|
590
|
-
{ simulate: ['destination.ga4'], json: true },
|
|
591
|
-
);
|
|
592
|
-
// result.usage = API call tracking data
|
|
593
|
-
|
|
594
|
-
// Push for real
|
|
595
|
-
await push('./flow.json', { name: 'page view', data: { title: 'Test' } });
|
|
596
|
-
|
|
597
|
-
// Run
|
|
598
|
-
await runCommand({
|
|
599
|
-
config: './flow.json',
|
|
600
|
-
port: 3000,
|
|
601
|
-
verbose: true,
|
|
602
|
-
});
|
|
603
|
-
```
|
|
604
|
-
|
|
605
|
-
## Examples
|
|
606
|
-
|
|
607
|
-
Working example configs in [examples/](./examples/):
|
|
608
|
-
|
|
609
|
-
- **server-collect.json** - Basic server-side collection
|
|
610
|
-
- **server-collection.json** - Advanced server setup
|
|
611
|
-
- **web-serve.json** - Web demo with API destination
|
|
612
|
-
- **web-tracking.json** - General web tracking
|
|
613
|
-
|
|
614
|
-
Try them:
|
|
615
|
-
|
|
616
|
-
```bash
|
|
617
|
-
# Bundle example
|
|
618
|
-
walkeros bundle examples/server-collect.json --stats
|
|
619
|
-
|
|
620
|
-
# Simulate
|
|
621
|
-
walkeros push \
|
|
622
|
-
examples/web-serve.json \
|
|
623
|
-
--event '{"name":"product view","data":{"id":"P123"}}' \
|
|
624
|
-
--simulate destination.demo
|
|
625
|
-
|
|
626
|
-
# Run server
|
|
627
|
-
walkeros run examples/server-collect.json --port 3000
|
|
628
|
-
```
|
|
629
|
-
|
|
630
|
-
## Development Workflow
|
|
631
|
-
|
|
632
|
-
Typical development cycle:
|
|
633
|
-
|
|
634
|
-
```bash
|
|
635
|
-
# 1. Create/edit config
|
|
636
|
-
vim my-flow.json
|
|
637
|
-
|
|
638
|
-
# 2. Test with simulation (no real API calls)
|
|
639
|
-
walkeros push \
|
|
640
|
-
my-flow.json \
|
|
641
|
-
--event '{"name":"product view"}' \
|
|
642
|
-
--simulate destination.demo \
|
|
643
|
-
--verbose
|
|
644
|
-
|
|
645
|
-
# 3. Bundle and check stats
|
|
646
|
-
walkeros bundle my-flow.json --stats
|
|
647
|
-
|
|
648
|
-
# 4. Run locally
|
|
649
|
-
walkeros run dist/flow.mjs --port 3000
|
|
650
|
-
|
|
651
|
-
# 5. In another terminal, test it
|
|
652
|
-
curl -X POST http://localhost:3000/collect \
|
|
653
|
-
-H "Content-Type: application/json" \
|
|
654
|
-
-d '{"name":"page view","data":{"title":"Home"}}'
|
|
655
|
-
```
|
|
656
|
-
|
|
657
|
-
## Architecture
|
|
658
|
-
|
|
659
|
-
```
|
|
660
|
-
CLI
|
|
661
|
-
├─ Pacote installs flow.json packages (no user-side npm install)
|
|
662
|
-
├─ esbuild externalizes step packages, emits ESM entry
|
|
663
|
-
├─ @vercel/nft traces entry, copies only used files
|
|
664
|
-
└─ Output: dist/{flow.mjs, package.json, node_modules/} (server)
|
|
665
|
-
dist/walker.js (web)
|
|
666
|
-
```
|
|
667
|
-
|
|
668
|
-
**Key principle**: CLI handles both build-time install/trace/bundle and runtime
|
|
669
|
-
execution.
|
|
670
|
-
|
|
671
|
-
## Runner (Docker)
|
|
672
|
-
|
|
673
|
-
The `walkeros/flow` Docker image is a self-bundling runner for production
|
|
674
|
-
deployment. It supports four deployment modes — from fully local to fully
|
|
675
|
-
managed — all using the same image and config format.
|
|
676
|
-
|
|
677
|
-
```bash
|
|
678
|
-
# Mode A: Local only — no signup, no API
|
|
679
|
-
docker run -v ./flow.json:/app/flow.json -e BUNDLE=/app/flow.json walkeros/flow
|
|
680
|
-
|
|
681
|
-
# Mode B: Local config + dashboard visibility
|
|
682
|
-
docker run -v ./flow.json:/app/flow.json \
|
|
683
|
-
-e BUNDLE=/app/flow.json \
|
|
684
|
-
-e WALKEROS_TOKEN=sk-walkeros-xxx \
|
|
685
|
-
-e PROJECT_ID=proj_xxx \
|
|
686
|
-
walkeros/flow
|
|
687
|
-
|
|
688
|
-
# Mode C: Remote config with hot-swap
|
|
689
|
-
docker run \
|
|
690
|
-
-e WALKEROS_TOKEN=sk-walkeros-xxx \
|
|
691
|
-
-e PROJECT_ID=proj_xxx \
|
|
692
|
-
-e FLOW_ID=flow_xxx \
|
|
693
|
-
walkeros/flow
|
|
694
|
-
```
|
|
695
|
-
|
|
696
|
-
Each step adds one env var. Same runner, same config, same bundle pipeline.
|
|
697
|
-
|
|
698
|
-
See the [Runner documentation](https://www.walkeros.io/docs/apps/runner/) for
|
|
699
|
-
the full reference (env vars, pipeline, caching, hot-swap, health checks,
|
|
700
|
-
troubleshooting).
|
|
701
|
-
|
|
702
|
-
### Using Node.js
|
|
703
|
-
|
|
704
|
-
Run the bundle directly with the CLI:
|
|
705
|
-
|
|
706
|
-
```bash
|
|
707
|
-
# Build your flow
|
|
708
|
-
walkeros bundle flow.json
|
|
709
|
-
|
|
710
|
-
# Run in production
|
|
711
|
-
walkeros run dist/flow.mjs --port 8080
|
|
712
|
-
```
|
|
713
|
-
|
|
714
|
-
This runs the flow in the current Node.js process, suitable for deployment on
|
|
715
|
-
platforms like AWS Lambda, Google Cloud Run, or any Node.js hosting.
|
|
716
|
-
|
|
717
|
-
## Requirements
|
|
718
|
-
|
|
719
|
-
- **Node.js**: 18+ or 22+
|
|
720
|
-
- **Docker**: Not required for CLI (only for production deployment)
|
|
721
|
-
|
|
722
|
-
## Type Definitions
|
|
35
|
+
## Documentation
|
|
723
36
|
|
|
724
|
-
|
|
37
|
+
Full configuration, mapping, and examples live in the docs:
|
|
38
|
+
**https://www.walkeros.io/docs/apps/cli**
|
|
725
39
|
|
|
726
|
-
##
|
|
40
|
+
## Contribute
|
|
727
41
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
deployment
|
|
733
|
-
- [Flow Configuration](https://www.walkeros.io/docs/getting-started/flow/)
|
|
734
|
-
- [Collector Package](../collector/) - For Integrated mode (direct imports)
|
|
735
|
-
- [Operating Modes](https://www.walkeros.io/docs/getting-started/modes/) -
|
|
736
|
-
Choosing between Integrated and Bundled
|
|
42
|
+
Feel free to contribute by submitting an
|
|
43
|
+
[issue](https://github.com/elbwalker/walkerOS/issues), starting a
|
|
44
|
+
[discussion](https://github.com/elbwalker/walkerOS/discussions), or getting in
|
|
45
|
+
[contact](https://calendly.com/elb-alexander/30min).
|
|
737
46
|
|
|
738
47
|
## License
|
|
739
48
|
|
|
740
|
-
MIT
|
|
49
|
+
MIT
|