@walkeros/cli 4.0.0-next-1773967844643 → 4.0.0-next-1776095573328

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,6 +1,179 @@
1
1
  # @walkeros/cli
2
2
 
3
- ## 4.0.0-next-1773967844643
3
+ ## 4.0.0-next-1776095573328
4
+
5
+ ### Minor Changes
6
+
7
+ - 2849acb: **BREAKING CHANGE:** The `packages` block has moved from
8
+ `flow.<name>.packages` to `flow.<name>.bundle.packages`. Flow files using the
9
+ old shape fail fast with a migration error pointing to the new location.
10
+
11
+ Also adds `flow.<name>.bundle.overrides` — a `Record<string, string>` for
12
+ pinning transitive dependency versions, matching npm's `overrides` semantics.
13
+ Use this to resolve version conflicts when a transitive dependency's declared
14
+ range conflicts with another required version in the same tree (the original
15
+ motivating case: `@amplitude/engagement-browser` pins
16
+ `@amplitude/analytics-types@^1.0.0` while `@amplitude/analytics-browser`
17
+ transitively requires `analytics-types@2.11.1` exact — previously an
18
+ unresolvable bundler conflict).
19
+
20
+ **Migration:** move the existing `packages` block one level deeper into a new
21
+ `bundle` wrapper.
22
+
23
+ ```diff
24
+ {
25
+ "version": 3,
26
+ "flows": {
27
+ "default": {
28
+ "web": {},
29
+ - "packages": {
30
+ - "@walkeros/collector": {}
31
+ - },
32
+ + "bundle": {
33
+ + "packages": {
34
+ + "@walkeros/collector": {}
35
+ + }
36
+ + },
37
+ "sources": { },
38
+ "destinations": { }
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ **Overrides example:**
45
+
46
+ ```json
47
+ {
48
+ "flows": {
49
+ "default": {
50
+ "web": {},
51
+ "bundle": {
52
+ "packages": {
53
+ "@walkeros/web-destination-amplitude": {}
54
+ },
55
+ "overrides": {
56
+ "@amplitude/analytics-types": "2.11.1"
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ Overrides only substitute **transitive** dependencies during resolution —
65
+ direct package specs declared in `bundle.packages` always win. Overrides
66
+ targeting a direct local-path package emit a warning and are ignored. Peer
67
+ constraint mismatches against the chosen override emit a warning but do not
68
+ error (the override is an explicit user directive).
69
+
70
+ - 08c365a: Add preview mode preflight to web bundles
71
+ - `WrapSkeletonOptions` accepts optional `previewOrigin` and `previewScope`
72
+ fields
73
+ - `generateWrapEntry` injects a preflight snippet before `startFlow` when both
74
+ are set: checks `?elbPreview` param / cookie, loads preview bundle from
75
+ `{previewOrigin}/preview/{previewScope}/walker.{token}.js`, skips production
76
+ flow. Zero overhead when preview options are absent.
77
+ - Input validation rejects path-traversal in `previewScope` and special
78
+ characters in `previewOrigin`.
79
+
80
+ - 08c365a: Bundle /dev exports into stage 1 skeleton for environment-agnostic
81
+ simulation
82
+ - `/dev` exports from packages are included in the skipWrapper bundle as
83
+ `__devExports`
84
+ - Stage 2 production bundles tree-shake dev exports (no size impact)
85
+ - `prepareFlow()` accepts `Flow.Config` object or pre-built `bundlePath`
86
+ - Simulate functions read env/createTrigger from bundle instead of filesystem
87
+
88
+ ### Patch Changes
89
+
90
+ - ae02457: Fix bare filename resolution in bundle command —
91
+ `walkeros bundle flow.json` now resolves relative to cwd instead of CLI
92
+ examples directory. Add TTY hint when writing to stdout
93
+ - Updated dependencies [2849acb]
94
+ - Updated dependencies [08c365a]
95
+ - Updated dependencies [08c365a]
96
+ - Updated dependencies [08c365a]
97
+ - Updated dependencies [08c365a]
98
+ - @walkeros/core@4.0.0-next-1776095573328
99
+ - @walkeros/server-core@4.0.0-next-1776095573328
100
+
101
+ ## 3.2.0
102
+
103
+ ### Minor Changes
104
+
105
+ - eb865e1: Add chainPath to ingest metadata and support path-specific mocks via
106
+ --mock destination.ga4.before.redact='...'
107
+ - f007c9f: Wire initConfig.hooks into collector instance. Simulation uses
108
+ prePush/postDestinationPush hooks for event capture. Hooks are wired by
109
+ startFlow before events fire.
110
+ - da0b640: Add include/exclude destination filter to collector.push PushOptions.
111
+ Sources can now control which destinations receive their events. Destination
112
+ simulation uses the full collector pipeline with include filter, giving
113
+ production-identical event enrichment, consent, and mapping.
114
+ - a0b019f: Add --snapshot flag to push command for setting up global state
115
+ before bundle execution
116
+ - 431be04: Refactor bundler to two-step compilation: ESM code compilation +
117
+ platform wrapper. Config changes no longer require full rebuilds. Production
118
+ bundles carry zero dev/simulate code.
119
+ - 884527d: Unify simulation for sources, destinations, and transformers through
120
+ the push command.
121
+ - All step types simulate via `push` with auto-env loading and call tracking
122
+ - Add `--simulate transformer.X` to invoke a transformer directly with an
123
+ event
124
+ - Before chains run as mandatory preparation; next chains are skipped
125
+ - Source simulation captures at the collector.push boundary, preserving the
126
+ full before chain
127
+ - Hooks (prePush/postDestinationPush) capture events instead of manual
128
+ overrides
129
+ - Timer interception flushes setTimeout/setInterval deterministically for
130
+ async patterns (debounced batches, detached Promise chains)
131
+ - MCP migrated to the push-based simulation pipeline
132
+ - Legacy simulate code removed
133
+
134
+ ### Patch Changes
135
+
136
+ - f55fc1d: Unify duplicated CLI patterns for reliability and consistency
137
+ - Add unified event validator with graduated levels (strict/standard/minimal)
138
+ - Fix package resolution in simulate to respect packages.path from flow config
139
+ - Extract shared readStdinToTempFile utility, remove copy-paste dynamic
140
+ imports
141
+ - Standardize duration output to milliseconds (matching MCP schema contract)
142
+ - Fix temp file cleanup in run command (hot-swap accumulation, shutdown
143
+ handler)
144
+ - Fix simulator bare /tmp cleanup bug
145
+ - Unify URL fetching into shared fetchContentString, eliminate temp file
146
+ roundtrip
147
+ - Refactor loadJsonFromSource as thin wrapper around loadJsonConfig
148
+ - Remove unused downloadFromUrl function
149
+
150
+ - bbbeba1: Replace externalServer hack with typed sourceSettings override in
151
+ bundle wrapper
152
+ - 7d1a268: Polyfill fetch and navigator.sendBeacon in JSDOM during web
153
+ simulation to prevent throws and capture network calls
154
+ - 616b9b2: Resolve transitive dependencies from local path packages
155
+ automatically
156
+ - 91159be: Support path-based package: references on flow config components
157
+ - 2cc1b54: Support single .ts files and directories without package.json as
158
+ local packages in flow.json
159
+ - Updated dependencies [eb865e1]
160
+ - Updated dependencies [c0a53f9]
161
+ - Updated dependencies [f007c9f]
162
+ - Updated dependencies [bf2dc5b]
163
+ - Updated dependencies [da0b640]
164
+ - @walkeros/core@3.2.0
165
+ - @walkeros/server-core@3.2.0
166
+
167
+ ## 3.1.1
168
+
169
+ ### Patch Changes
170
+
171
+ - a5d98d2: Fix inline JSON config support in detectInput for MCP tools
172
+ (flow_simulate, flow_push)
173
+ - @walkeros/core@3.1.1
174
+ - @walkeros/server-core@3.1.1
175
+
176
+ ## 3.1.0
4
177
 
5
178
  ### Minor Changes
6
179
 
@@ -35,8 +208,8 @@
35
208
  - Updated dependencies [bee8ba7]
36
209
  - Updated dependencies [966342b]
37
210
  - Updated dependencies [df990d4]
38
- - @walkeros/core@4.0.0-next-1773967844643
39
- - @walkeros/server-core@4.0.0-next-1773967844643
211
+ - @walkeros/core@3.1.0
212
+ - @walkeros/server-core@3.1.0
40
213
 
41
214
  ## 3.0.2
42
215
 
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