@walkeros/cli 3.1.1 → 3.2.0-next-1775064795590

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 CHANGED
@@ -1,5 +1,71 @@
1
1
  # @walkeros/cli
2
2
 
3
+ ## 3.2.0-next-1775064795590
4
+
5
+ ### Minor Changes
6
+
7
+ - eb865e1: Add chainPath to ingest metadata and support path-specific mocks via
8
+ --mock destination.ga4.before.redact='...'
9
+ - f007c9f: Wire initConfig.hooks into collector instance. Simulation uses
10
+ prePush/postDestinationPush hooks for event capture. Hooks are wired by
11
+ startFlow before events fire.
12
+ - da0b640: Add include/exclude destination filter to collector.push PushOptions.
13
+ Sources can now control which destinations receive their events. Destination
14
+ simulation uses the full collector pipeline with include filter, giving
15
+ production-identical event enrichment, consent, and mapping.
16
+ - a0b019f: Add --snapshot flag to push command for setting up global state
17
+ before bundle execution
18
+ - 431be04: Refactor bundler to two-step compilation: ESM code compilation +
19
+ platform wrapper. Config changes no longer require full rebuilds. Production
20
+ bundles carry zero dev/simulate code.
21
+ - 884527d: Unify simulation for sources, destinations, and transformers through
22
+ the push command.
23
+ - All step types simulate via `push` with auto-env loading and call tracking
24
+ - Add `--simulate transformer.X` to invoke a transformer directly with an
25
+ event
26
+ - Before chains run as mandatory preparation; next chains are skipped
27
+ - Source simulation captures at the collector.push boundary, preserving the
28
+ full before chain
29
+ - Hooks (prePush/postDestinationPush) capture events instead of manual
30
+ overrides
31
+ - Timer interception flushes setTimeout/setInterval deterministically for
32
+ async patterns (debounced batches, detached Promise chains)
33
+ - MCP migrated to the push-based simulation pipeline
34
+ - Legacy simulate code removed
35
+
36
+ ### Patch Changes
37
+
38
+ - f55fc1d: Unify duplicated CLI patterns for reliability and consistency
39
+ - Add unified event validator with graduated levels (strict/standard/minimal)
40
+ - Fix package resolution in simulate to respect packages.path from flow config
41
+ - Extract shared readStdinToTempFile utility, remove copy-paste dynamic
42
+ imports
43
+ - Standardize duration output to milliseconds (matching MCP schema contract)
44
+ - Fix temp file cleanup in run command (hot-swap accumulation, shutdown
45
+ handler)
46
+ - Fix simulator bare /tmp cleanup bug
47
+ - Unify URL fetching into shared fetchContentString, eliminate temp file
48
+ roundtrip
49
+ - Refactor loadJsonFromSource as thin wrapper around loadJsonConfig
50
+ - Remove unused downloadFromUrl function
51
+
52
+ - bbbeba1: Replace externalServer hack with typed sourceSettings override in
53
+ bundle wrapper
54
+ - 7d1a268: Polyfill fetch and navigator.sendBeacon in JSDOM during web
55
+ simulation to prevent throws and capture network calls
56
+ - 616b9b2: Resolve transitive dependencies from local path packages
57
+ automatically
58
+ - 91159be: Support path-based package: references on flow config components
59
+ - 2cc1b54: Support single .ts files and directories without package.json as
60
+ local packages in flow.json
61
+ - Updated dependencies [eb865e1]
62
+ - Updated dependencies [c0a53f9]
63
+ - Updated dependencies [f007c9f]
64
+ - Updated dependencies [bf2dc5b]
65
+ - Updated dependencies [da0b640]
66
+ - @walkeros/core@3.2.0-next-1775064795590
67
+ - @walkeros/server-core@3.2.0-next-1775064795590
68
+
3
69
  ## 3.1.1
4
70
 
5
71
  ### Patch Changes
package/README.md CHANGED
@@ -8,7 +8,7 @@ flows.
8
8
  The walkerOS CLI is a developer tool that:
9
9
 
10
10
  - **Bundles** flow configurations into optimized JavaScript
11
- - **Simulates** event processing for testing
11
+ - **Simulates** event processing for testing (via `push --simulate`)
12
12
  - **Runs** flows locally without Docker daemon
13
13
 
14
14
  Think of it as your development toolchain for walkerOS - from config to running
@@ -46,7 +46,7 @@ npm install @walkeros/cli
46
46
  walkeros bundle flow.json
47
47
 
48
48
  # Test with simulated events (no real API calls)
49
- walkeros simulate flow.json --event '{"name":"product view"}'
49
+ walkeros push flow.json --event '{"name":"product view"}' --simulate destination.demo
50
50
 
51
51
  # Push real events to destinations
52
52
  walkeros push flow.json --event '{"name":"product view"}'
@@ -99,41 +99,11 @@ walkeros bundle flow.json --dockerfile Dockerfile.custom
99
99
  The output path uses convention-based defaults: `./dist/bundle.mjs` for server,
100
100
  `./dist/walker.js` for web.
101
101
 
102
- ### simulate
103
-
104
- Test event processing with simulated events. The config JSON gets bundled and
105
- executed with destination mocking.
106
-
107
- ```bash
108
- walkeros simulate <config> --event '{"name":"page view"}' [options]
109
- ```
110
-
111
- **Options:**
112
-
113
- - `-e, --event <json>` - Event to simulate (JSON string, file path, or URL)
114
- - `--flow <name>` - Flow name for multi-flow configs
115
- - `-p, --platform <platform>` - Platform override (`web` or `server`)
116
- - `--json` - Output as JSON
117
- - `-v, --verbose` - Verbose output
118
- - `-s, --silent` - Suppress output
119
-
120
- **Examples:**
121
-
122
- ```bash
123
- # Simulate with config (auto-bundled)
124
- walkeros simulate examples/web-serve.json \
125
- --event '{"name":"page view","data":{"title":"Home"}}' \
126
- --json
127
-
128
- # Simulate specific flow from multi-flow config
129
- walkeros simulate flow.json --flow server --event '{"name":"test"}'
130
- ```
131
-
132
102
  ### push
133
103
 
134
- Execute your flow with real API calls to configured destinations. Unlike
135
- `simulate` which mocks API calls, `push` performs actual HTTP requests. Accepts
136
- either a config JSON (which gets bundled) or a pre-built bundle.
104
+ Execute your flow with real API calls, or simulate specific steps with
105
+ `--simulate`. Accepts either a config JSON (which gets bundled) or a pre-built
106
+ bundle.
137
107
 
138
108
  ```bash
139
109
  walkeros push <input> --event '<json>' [options]
@@ -149,9 +119,15 @@ The CLI auto-detects the input type by attempting to parse as JSON.
149
119
  **Options:**
150
120
 
151
121
  - `-e, --event <source>` - Event to push (JSON string, file path, or URL)
152
- **Required**
122
+ **Required** (unless simulating a source)
153
123
  - `--flow <name>` - Flow name (for multi-flow configs)
154
124
  - `-p, --platform <platform>` - Platform override (`web` or `server`)
125
+ - `--simulate <step>` - Simulate a step (repeatable). Mocks the step's push,
126
+ captures result. Use `destination.NAME` or `source.NAME`.
127
+ - `--mock <step=value>` - Mock a step with a specific return value (repeatable).
128
+ Use `destination.NAME=VALUE`.
129
+ - `--snapshot <source>` - JS file to eval before execution. Sets global state
130
+ (`window.dataLayer`, `process.env`, etc.).
155
131
  - `--json` - Output results as JSON
156
132
  - `-v, --verbose` - Verbose output
157
133
  - `-s, --silent` - Suppress output (for CI/CD)
@@ -169,6 +145,19 @@ walkeros push flow.json --event ./events/order.json
169
145
  walkeros push flow.json --event https://example.com/sample-event.json
170
146
  ```
171
147
 
148
+ **Simulation examples:**
149
+
150
+ ```bash
151
+ # Simulate a destination (mock its push, capture API calls)
152
+ walkeros push flow.json -e event.json --simulate destination.ga4
153
+
154
+ # Simulate a source (capture events, disable all destinations)
155
+ walkeros push flow.json --simulate source.browser
156
+
157
+ # Mock a destination with a specific return value
158
+ walkeros push flow.json -e event.json --mock destination.ga4='{"status":"ok"}'
159
+ ```
160
+
172
161
  **Bundle input:**
173
162
 
174
163
  ```bash
@@ -179,16 +168,16 @@ walkeros push dist/bundle.mjs --event '{"name":"order complete"}'
179
168
  walkeros push dist/bundle.js --platform server --event '{"name":"order complete"}'
180
169
  ```
181
170
 
182
- **Push vs Simulate:**
171
+ **Push modes:**
183
172
 
184
- | Feature | `push` | `simulate` |
185
- | ------------ | ----------------------------------- | ------------------ |
186
- | API Calls | Real HTTP requests | Mocked (captured) |
187
- | Use Case | Integration testing | Safe local testing |
188
- | Side Effects | Full (writes to DBs, sends to APIs) | None |
173
+ | Mode | Flag | API Calls | Use Case |
174
+ | ---- | ---- | --------- | -------- |
175
+ | Real | (none) | Real HTTP requests | Integration testing |
176
+ | Simulate | `--simulate` | Mocked (captured) | Safe local testing |
177
+ | Mock | `--mock` | Returns mock value | Controlled testing |
189
178
 
190
- Use `simulate` first to validate configuration safely, then `push` to verify
191
- real integrations.
179
+ Use `--simulate` first to validate safely, then push without flags for real
180
+ integrations.
192
181
 
193
182
  ### run
194
183
 
@@ -503,7 +492,7 @@ See [examples/](./examples/) for complete working configurations.
503
492
  Use commands programmatically:
504
493
 
505
494
  ```typescript
506
- import { bundle, simulate, runCommand } from '@walkeros/cli';
495
+ import { bundle, push, runCommand } from '@walkeros/cli';
507
496
 
508
497
  // Bundle
509
498
  await bundle({
@@ -511,11 +500,18 @@ await bundle({
511
500
  stats: true,
512
501
  });
513
502
 
514
- // Simulate
515
- const result = await simulate(
503
+ // Push with simulation
504
+ const result = await push(
505
+ './flow.json',
506
+ { name: 'page view', data: { title: 'Test' } },
507
+ { simulate: ['destination.ga4'], json: true },
508
+ );
509
+ // result.usage = API call tracking data
510
+
511
+ // Push for real
512
+ await push(
516
513
  './flow.json',
517
514
  { name: 'page view', data: { title: 'Test' } },
518
- { json: true },
519
515
  );
520
516
 
521
517
  // Run
@@ -542,9 +538,10 @@ Try them:
542
538
  walkeros bundle examples/server-collect.json --stats
543
539
 
544
540
  # Simulate
545
- walkeros simulate \
541
+ walkeros push \
546
542
  examples/web-serve.json \
547
- --event '{"name":"product view","data":{"id":"P123"}}'
543
+ --event '{"name":"product view","data":{"id":"P123"}}' \
544
+ --simulate destination.demo
548
545
 
549
546
  # Run server
550
547
  walkeros run examples/server-collect.json --port 3000
@@ -559,9 +556,10 @@ Typical development cycle:
559
556
  vim my-flow.json
560
557
 
561
558
  # 2. Test with simulation (no real API calls)
562
- walkeros simulate \
559
+ walkeros push \
563
560
  my-flow.json \
564
561
  --event '{"name":"product view"}' \
562
+ --simulate destination.demo \
565
563
  --verbose
566
564
 
567
565
  # 3. Bundle and check stats
@@ -581,7 +579,7 @@ curl -X POST http://localhost:3000/collect \
581
579
  ```
582
580
  CLI (downloads packages + bundles with esbuild)
583
581
  ├─ Bundle → optimized .mjs file
584
- ├─ Simulatetest bundle with events
582
+ ├─ Pushexecute bundle (with optional --simulate for testing)
585
583
  └─ Run → execute bundle with built-in runtime
586
584
  ```
587
585