tagreeve 0.5.0 → 0.6.0-rc.1

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.
Files changed (3) hide show
  1. package/README.md +16 -14
  2. package/dist/cli.js +955 -282
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  Agent-first testing for tags and consent. Tagreeve plays a visitor in a real browser, records every tracking hit the site sends, and checks the result against what you expect. Tag-firing reports (which tags fired) are planned.
11
11
 
12
- > **Status: 0.5 (`0.5.0`).** Tagreeve plays a visitor in Chromium, records and decodes hits, answers the consent banner, checks YAML expectations and writes a JSONL record. 0.3 adds rules on payload fields and cookies, a `deniedIdentifiers` check, `tagreeve suite`, an HTML report, a Done control for handoff steps, role-based locators and a `select` step. 0.4 adds handoffs that end by themselves, an opt-in test payment step, baselines, a viewport option and fake identities by country. 0.5 adds `--server-container`, which runs your own server container in Docker and records what it sends to each vendor, a Conversions API decoder, several stores in one suite and platform hosts for Shopify. The rest of this README describes where Tagreeve is going, and marks what is not built yet. The design is in [docs/design.md](docs/design.md). Feedback is welcome in issues.
12
+ > **Status: 0.6 (`0.6.0-rc.1`).** Tagreeve plays a visitor in Chromium, records and decodes hits, answers the consent banner, checks YAML expectations and writes a JSONL record. 0.3 adds rules on payload fields and cookies, a `deniedIdentifiers` check, `tagreeve suite`, an HTML report, a Done control for handoff steps, role-based locators and a `select` step. 0.4 adds handoffs that end by themselves, an opt-in test payment step, baselines, a viewport option and fake identities by country. 0.5 adds `--server-container`, which runs your own server container in Docker and records what it sends to each vendor, a Conversions API decoder, several stores in one suite and platform hosts for Shopify. 0.6.0-rc.1 adds path defaults, `tagreeve init`, `tagreeve/config.yml`, `--label`, default baseline paths and `suite --baseline`, exact links between server container calls and browser hits by client ID, and the frame of each `dataLayer` push. The rest of this README describes where Tagreeve is going, and marks what is not built yet. The design is in [docs/design.md](docs/design.md). Feedback is welcome in issues.
13
13
  >
14
14
  > **In 0.1:** `tagreeve run` with `stub` and `live` network modes; consent epochs, with withdrawals labelled apart from first rejects; seeded fake identities, hash checks and leak detection; decoders for GA4, Google Ads, Meta, Stape custom loader and a minimal server-container data client; banner handling through autoconsent; expectations; JSONL output.
15
15
  >
@@ -17,6 +17,8 @@ Agent-first testing for tags and consent. Tagreeve plays a visitor in a real bro
17
17
  >
18
18
  > **In 0.3:** `body.has` and `body.only` rules on the field names of a hit; `cookie` rules; a `deniedIdentifiers` check that fails when an identifier goes out on a denied hit; `tagreeve suite` runs a folder of scenarios against several GTM builds; `tagreeve report` writes an HTML report of one run or a suite; a Done button in the handoff window; `click` and `wait` by role and name or from a list of selectors; a `select` step; the `server` network mode; record schema version 2. `deniedIdentifiers` fails by default, so a run that passed in 0.2 can exit 1. See [CHANGELOG.md](CHANGELOG.md).
19
19
  >
20
+ > **In 0.6.0-rc.1:** `run` and `suite` write to `tagreeve/runs/<date>/` by default; `tagreeve init` makes the folders; `tagreeve/config.yml` holds `site`, `out` and scenario options; `--label` names a run; `baseline save` and `suite --baseline` use `tagreeve/baselines/`; a scenario with `network: live` no longer loads; a `wait` timeout lists the controls that block submission; Shop Pay hosts are platform hosts; and a server container call links exactly by client ID and event name when only one browser hit fits. What is still open is in [CHANGELOG.md](CHANGELOG.md) under "Known in 0.6.0-rc.1".
21
+ >
20
22
  > **In 0.5.0:** a hit rule takes `sentBy: browser` or `sentBy: server`, so a rule on a Google host can ignore the server container's own forwarding; a missing `tagreeve-sgtm` image stops a suite before any scenario starts, and the message lists the local tags; the server container guide shows how to test an unpublished server workspace through its preview environment; and the text and `--json` summaries show query names only and mask value-like path segments, for every form of URL. Records keep the full detail. What is still open is in [CHANGELOG.md](CHANGELOG.md) under "Known in 0.5.0".
21
23
  >
22
24
  > **In 0.5.0-rc.2:** the `payment` step finds Shopify card fields by `name` or `autocomplete` and frame path; a server container call just after a handoff is stored without its body and query values; summaries show query names only; hit and cookie rules take `from: <step label>`; every command has its own `--help`; and `--by-page` masks more value-like path segments.
@@ -27,7 +29,7 @@ Agent-first testing for tags and consent. Tagreeve plays a visitor in a real bro
27
29
  >
28
30
  > **In 0.4.0-rc.1:** a `handoff` step can end at a URL or an element (`until`, `settle`, `timeout`); a `payment` step types a provider's test card on a store you allow, with three opt-in checks; `tagreeve baseline save` and `run --baseline` catch drift in the shape of a run; `--viewport <W>x<H>`; `identity.country` picks the format of the fake identity (US, SE, GB, DE); optional `fill` entries; a `possibleRedirectHop` flag; and the rename to Tagreeve. What is still open is in [CHANGELOG.md](CHANGELOG.md) under "Known in 0.4.0-rc.1".
29
31
  >
30
- > **Not built yet:** the tag-firing reporter templates and `expectedTags`, `tagreeve init`, a Shopify bridge, a full Microsoft UET decoder, a `mobile` viewport preset, Firefox and WebKit. There is no MCP server: Tagreeve is a CLI, and agents read `--json`.
32
+ > **Not built yet:** the tag-firing reporter templates and `expectedTags`, a Shopify bridge, a full Microsoft UET decoder, a `mobile` viewport preset, Firefox and WebKit. There is no MCP server: Tagreeve is a CLI, and agents read `--json`.
31
33
 
32
34
  ## Why
33
35
 
@@ -80,16 +82,16 @@ tagreeve run scenarios/undecided-visitor.yml --site https://staging.example.com
80
82
  ## Install
81
83
 
82
84
  ```bash
83
- npm i -g tagreeve
85
+ npm i -g tagreeve@next
84
86
  tagreeve install-browser
85
87
  ```
86
88
 
87
- Node 22.18 or later. `npm i -g tagreeve` installs the newest release. Other ways to install, from a git tag or a tarball, are in [docs/cli.md](docs/cli.md).
89
+ Node 22.18 or later. `npm i -g tagreeve@next` installs the newest release candidate. Other ways to install, from a git tag or a tarball, are in [docs/cli.md](docs/cli.md).
88
90
 
89
91
  ## Quick start
90
92
 
91
- 1. `npm i -g tagreeve`
92
- 2. `tagreeve install-browser`
93
+ 1. `npm i -g tagreeve@next`
94
+ 2. `tagreeve install-browser`. In a project folder, `tagreeve init` makes `tagreeve/scenarios/` and `tagreeve/baselines/` and keeps `tagreeve/runs/` out of git.
93
95
  3. Write `scenario.yml`:
94
96
 
95
97
  ```yaml
@@ -103,11 +105,11 @@ Node 22.18 or later. `npm i -g tagreeve` installs the newest release. Other ways
103
105
  ```
104
106
 
105
107
  4. `tagreeve run scenario.yml --site https://staging.example.com`
106
- 5. Read the summary, and the full record in `runs/run_<id>.jsonl`.
108
+ 5. Read the summary, and the full record in `tagreeve/runs/<date>/run_<id>.jsonl`.
107
109
 
108
110
  `consent: none` needs a banner that autoconsent detects. If none is shown, the run stops with "banner not shown" and exit code 2. Vendor keys are `ga4`, `google-ads`, `meta`, `meta-capi`, `pinterest`, `sgtm`, and every vendor on the tracker list (`linkedin`, `microsoft-uet`, `reddit`) or in a `--tracker-list` file. A scenario that names any other vendor is rejected when it is parsed.
109
111
 
110
- Stub mode is the default: known collection endpoints are recorded and answered locally. Unknown destinations still receive hits and are flagged as `unknownDestination`, which fails the run. The registrable domain of `--site` is first party: for `--site https://www.shop.co.uk`, `shop.co.uk` and every `*.shop.co.uk` host are not unknown. Data-carrying requests to those subdomains that no decoder matches, such as server-side GTM on `sgtm.shop.co.uk/collect`, are listed as `firstPartySubdomain` flags, grouped by host. They do not fail the run. Hosts without a registrable domain, such as IP addresses and `localhost`, are first party only as the exact `--site` host. If a site serves its own assets from another domain, list it under `options: { firstPartyHosts: ['i.example-cdn.com', '*.example-static.com'] }`. To accept specific unknown hosts without calling them first party, use `options: { allowUnknownDestination: ['tracker.example.net'] }`; every other unknown destination still fails. `allowUnknownDestination: true` allows all of them, and the summary still lists them. Requests to Shopify's CDN and telemetry hosts (`cdn.shopify.com`, `monorail-edge.shopifysvc.com`) are flagged `platformHost` instead. They are listed but never fail the run. `options: { platformHosts: false }` flags them as `unknownDestination` again. A request sent while a sandboxed `srcdoc` iframe is loading can escape stubbing and recording (see [design §5.3](docs/design.md)). Use `--network live` to let everything through. Tagreeve decodes GA4, Google Ads, Meta, Meta Conversions API, Pinterest and Stape traffic, and stubs the hosts on the tracker list. Hits to other vendors, such as TikTok, are not stubbed unless you add them with `--tracker-list`: they pass through and can only show up as `unknownDestination` flags.
112
+ Stub mode is the default: known collection endpoints are recorded and answered locally. Unknown destinations still receive hits and are flagged as `unknownDestination`, which fails the run. The registrable domain of `--site` is first party: for `--site https://www.shop.co.uk`, `shop.co.uk` and every `*.shop.co.uk` host are not unknown. Data-carrying requests to those subdomains that no decoder matches, such as server-side GTM on `sgtm.shop.co.uk/collect`, are listed as `firstPartySubdomain` flags, grouped by host. They do not fail the run. Hosts without a registrable domain, such as IP addresses and `localhost`, are first party only as the exact `--site` host. If a site serves its own assets from another domain, list it under `options: { firstPartyHosts: ['i.example-cdn.com', '*.example-static.com'] }`. To accept specific unknown hosts without calling them first party, use `options: { allowUnknownDestination: ['tracker.example.net'] }`; every other unknown destination still fails. `allowUnknownDestination: true` allows all of them, and the summary still lists them. Requests to Shopify's CDN, telemetry and Shop Pay hosts (`cdn.shopify.com`, `cdn.shopifycloud.com`, `monorail-edge.shopifysvc.com`, `*.shopifysvc.com`, `pay.shopify.com`, `shop.app`) are flagged `platformHost` instead. They are listed but never fail the run. `options: { platformHosts: false }` flags them as `unknownDestination` again. A request sent while a sandboxed `srcdoc` iframe is loading can escape stubbing and recording (see [design §5.3](docs/design.md)). Use `--network live` to let everything through. Tagreeve decodes GA4, Google Ads, Meta, Meta Conversions API, Pinterest and Stape traffic, and stubs the hosts on the tracker list. Hits to other vendors, such as TikTok, are not stubbed unless you add them with `--tracker-list`: they pass through and can only show up as `unknownDestination` flags.
111
113
 
112
114
  ## Override and diff quick start
113
115
 
@@ -122,14 +124,14 @@ Run one scenario against the published container and against an unpublished work
122
124
  2. Run the scenario twice:
123
125
 
124
126
  ```bash
125
- tagreeve run scenario.yml --site https://staging.example.com --out runs/published
126
- tagreeve run scenario.yml --site https://staging.example.com --out runs/workspace --gtm-override override.json
127
+ tagreeve run scenario.yml --site https://staging.example.com --out tagreeve/runs/published
128
+ tagreeve run scenario.yml --site https://staging.example.com --out tagreeve/runs/workspace --gtm-override override.json
127
129
  ```
128
130
 
129
131
  3. Compare the two records:
130
132
 
131
133
  ```bash
132
- tagreeve diff runs/published/run_<id>.jsonl runs/workspace/run_<id>.jsonl
134
+ tagreeve diff tagreeve/runs/published/run_<id>.jsonl tagreeve/runs/workspace/run_<id>.jsonl
133
135
  ```
134
136
 
135
137
  `diff` lists added, removed and changed hits per consent epoch, vendor and event, and changed flag counts per host. Add `--by-page` to pair hits page by page, or `--json` for the full result. It exits 0 whether or not the runs differ; the exit code of each `run` tells you whether its rules passed.
@@ -142,11 +144,11 @@ Run a folder of scenarios against the published container and an unpublished wor
142
144
 
143
145
  ```bash
144
146
  tagreeve suite scenarios/ --site https://staging.example.com \
145
- --variant published --variant workspace=override.json --out runs
146
- tagreeve report runs/suite_<id> --html suite-report.html
147
+ --variant published --variant workspace=override.json
148
+ tagreeve report tagreeve/runs/<date>/suite_<id> --html suite-report.html
147
149
  ```
148
150
 
149
- `suite` runs every `*.yml` file in the folder once per variant, and prints a table with the result of each run and the diff between the variants. The runs and a `suite.json` manifest go to `runs/suite_<id>/`. The exit code is 2 if a run did not finish, 1 if an expectation failed, else 0. A scenario with a `handoff` step is skipped unless you add `--with-handoff`. To cover several storefronts, give `--stores stores.json` instead of `--site`. Every scenario then runs once per store. `report` writes one HTML file with a timeline per vendor and consent state, the expectations, the flags and the diff. It has names and counts only, no script and no network request. `tagreeve report runs/run_<id>.jsonl --html report.html` makes the report for one run. Details are in [docs/cli.md](docs/cli.md).
151
+ `suite` runs every `*.yml` file in the folder once per variant, and prints a table with the result of each run and the diff between the variants. The runs and a `suite.json` manifest go to `tagreeve/runs/<date>/suite_<id>/`. The exit code is 2 if a run did not finish, 1 if an expectation failed, else 0. A scenario with a `handoff` step is skipped unless you add `--with-handoff`. To cover several storefronts, give `--stores stores.json` instead of `--site`. Every scenario then runs once per store. `report` writes one HTML file with a timeline per vendor and consent state, the expectations, the flags and the diff. It has names and counts only, no script and no network request. `tagreeve report tagreeve/runs/<date>/run_<id>.jsonl --html report.html` makes the report for one run. Details are in [docs/cli.md](docs/cli.md).
150
152
 
151
153
  ## Rules and steps added in 0.3
152
154