@dreamdata_io/verify-tracking 0.1.0 → 0.1.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.
- package/README.md +52 -25
- package/dist/cli.js +54 -0
- package/dist/cli.js.map +1 -1
- package/dist/config/env.js.map +1 -1
- package/dist/review/dashboard.js +37 -0
- package/dist/review/dashboard.js.map +1 -0
- package/dist/review/data.js +185 -0
- package/dist/review/data.js.map +1 -0
- package/dist/review/emit.js +66 -0
- package/dist/review/emit.js.map +1 -0
- package/dist/review/open.js +53 -0
- package/dist/review/open.js.map +1 -0
- package/dist/version.js +1 -1
- package/package.json +2 -1
- package/scripts/install.sh +43 -3
- package/verification/review/index.html +1810 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hands the generated dashboard to the operator's browser.
|
|
3
|
+
*
|
|
4
|
+
* macOS only, deliberately. `open` is the one launcher this tool's installed
|
|
5
|
+
* audience has, and a Linux/Windows path would be written blind — those
|
|
6
|
+
* platforms get the printed path instead, which is what a headless machine
|
|
7
|
+
* wants anyway.
|
|
8
|
+
*
|
|
9
|
+
* Never throws, and never prints: it returns what happened and the caller
|
|
10
|
+
* decides what to say. That is also what keeps it safe to import from a
|
|
11
|
+
* module graph the MCP server touches, where stdout belongs to the transport.
|
|
12
|
+
*/
|
|
13
|
+
import { spawn } from "node:child_process";
|
|
14
|
+
import { resolve } from "node:path";
|
|
15
|
+
import { outputRoot } from "../config/user-config.js";
|
|
16
|
+
/**
|
|
17
|
+
* Recognisable in Finder among the report JSONs, and stable across runs so a
|
|
18
|
+
* closed tab is reopened by path. No spaces: the same string is a shell
|
|
19
|
+
* argument, a doc snippet and a file URL.
|
|
20
|
+
*/
|
|
21
|
+
export const DASHBOARD_FILENAME = "dreamdata-tracking-dashboard.html";
|
|
22
|
+
/** Where the dashboard is written, resolved on call — never at module scope. */
|
|
23
|
+
export function dashboardPath() {
|
|
24
|
+
return resolve(outputRoot(), DASHBOARD_FILENAME);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Detached and unref'd, so the CLI's `process.exit` neither kills the child
|
|
28
|
+
* nor waits for it: on POSIX a parent exiting sends no signal, and `open` has
|
|
29
|
+
* already handed off to LaunchServices by then. `stdio: "ignore"` means the
|
|
30
|
+
* child physically cannot write to our stdout.
|
|
31
|
+
*/
|
|
32
|
+
function spawnDetachedReal(command, args) {
|
|
33
|
+
spawn(command, args, { detached: true, stdio: "ignore" }).unref();
|
|
34
|
+
}
|
|
35
|
+
export function openDashboard(options) {
|
|
36
|
+
const platform = options.platform ?? process.platform;
|
|
37
|
+
const env = options.env ?? process.env;
|
|
38
|
+
const launch = options.spawnDetached ?? spawnDetachedReal;
|
|
39
|
+
// A build machine has no one to show it to, and popping a browser in CI is
|
|
40
|
+
// noise at best.
|
|
41
|
+
if (env.CI)
|
|
42
|
+
return { kind: "skipped", reason: "disabled" };
|
|
43
|
+
if (platform !== "darwin")
|
|
44
|
+
return { kind: "skipped", reason: "unsupported-platform" };
|
|
45
|
+
try {
|
|
46
|
+
launch("open", [options.path]);
|
|
47
|
+
return { kind: "opened" };
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
return { kind: "failed", detail: err instanceof Error ? err.message : String(err) };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=open.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../src/review/open.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,mCAAmC,CAAC;AAEtE,gFAAgF;AAChF,MAAM,UAAU,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": "@dreamdata_io/verify-tracking",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Scrapes a live website with Playwright and asks an AI model whether the Dreamdata Analytics Script is correctly installed.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"files": [
|
|
24
24
|
"dist",
|
|
25
25
|
"scripts/install.sh",
|
|
26
|
+
"verification/review/index.html",
|
|
26
27
|
"README.md",
|
|
27
28
|
"LICENSE"
|
|
28
29
|
],
|
package/scripts/install.sh
CHANGED
|
@@ -38,6 +38,12 @@ NODE_DIST="${VERIFY_TRACKING_NODE_DIST:-https://nodejs.org/dist}"
|
|
|
38
38
|
# gets the two shims that are the whole user-facing surface.
|
|
39
39
|
PREFIX="${VERIFY_TRACKING_PREFIX:-$HOME/.local/share/verify-tracking}"
|
|
40
40
|
BIN_DIR="${VERIFY_TRACKING_BIN_DIR:-$HOME/.local/bin}"
|
|
41
|
+
# Where runs save their reports and the dashboard. A globally installed CLI
|
|
42
|
+
# otherwise grows a verification/ tree in whatever directory it was run from,
|
|
43
|
+
# which makes "where is my dashboard" depend on the operator's cwd and lets a
|
|
44
|
+
# `cd` silently start a second, separate set.
|
|
45
|
+
CONFIG_FILE="$HOME/.config/verify-tracking/config.env"
|
|
46
|
+
REPORTS_HOME="${VERIFY_TRACKING_REPORTS_HOME:-$HOME/dreamdata-tracking}"
|
|
41
47
|
|
|
42
48
|
# Kept out of the shared ~/.cache/ms-playwright on purpose: the browser this
|
|
43
49
|
# installer downloaded is then provably the browser the run launches, and an
|
|
@@ -71,6 +77,7 @@ command -v tar >/dev/null 2>&1 || die "tar is required."
|
|
|
71
77
|
printf 'Installing verify-tracking (%s/%s)\n' "$node_os" "$node_arch"
|
|
72
78
|
say "runtime, packages and browser -> $PREFIX"
|
|
73
79
|
say "commands -> $BIN_DIR"
|
|
80
|
+
say "reports and dashboard -> $REPORTS_HOME"
|
|
74
81
|
|
|
75
82
|
# ---------------------------------------------------------------------------
|
|
76
83
|
# 1. A Node the tool can run on
|
|
@@ -247,7 +254,31 @@ write_shim "verify-tracking" "dist/cli.js"
|
|
|
247
254
|
write_shim "verify-tracking-mcp" "dist/mcp/server.js"
|
|
248
255
|
|
|
249
256
|
# ---------------------------------------------------------------------------
|
|
250
|
-
# 5.
|
|
257
|
+
# 5. Where reports are saved
|
|
258
|
+
# ---------------------------------------------------------------------------
|
|
259
|
+
|
|
260
|
+
# The config file rather than the shim, even though the shim already exports
|
|
261
|
+
# PLAYWRIGHT_BROWSERS_PATH: user-config.ts only fills in variables the
|
|
262
|
+
# environment leaves unset, so a value exported by the shim would beat the
|
|
263
|
+
# operator's own config.env entry and make that documented file silently
|
|
264
|
+
# useless. Written here it sits at the same tier as any other setting, and can
|
|
265
|
+
# be edited afterwards.
|
|
266
|
+
#
|
|
267
|
+
# An existing key is never rewritten — including the `export KEY=` form, which
|
|
268
|
+
# the parser also accepts and resolves first-wins, so appending a second line
|
|
269
|
+
# would announce a directory the CLI then ignores.
|
|
270
|
+
step "Reports folder"
|
|
271
|
+
mkdir -p "$(dirname "$CONFIG_FILE")"
|
|
272
|
+
[ -f "$CONFIG_FILE" ] || : > "$CONFIG_FILE"
|
|
273
|
+
if grep -Eq '^[[:space:]]*(export[[:space:]]+)?VERIFY_TRACKING_OUTPUT_DIR=' "$CONFIG_FILE"; then
|
|
274
|
+
say "already set in $CONFIG_FILE — leaving it alone"
|
|
275
|
+
else
|
|
276
|
+
printf 'VERIFY_TRACKING_OUTPUT_DIR=%s\n' "$REPORTS_HOME" >> "$CONFIG_FILE"
|
|
277
|
+
say "reports and the dashboard will be saved in $REPORTS_HOME"
|
|
278
|
+
fi
|
|
279
|
+
|
|
280
|
+
# ---------------------------------------------------------------------------
|
|
281
|
+
# 6. Sign in to Claude — the one step a human has to finish
|
|
251
282
|
# ---------------------------------------------------------------------------
|
|
252
283
|
|
|
253
284
|
# `curl … | sh` leaves this script's own text on stdin, so a child that prompts
|
|
@@ -310,5 +341,14 @@ case ":${PATH}:" in
|
|
|
310
341
|
;;
|
|
311
342
|
esac
|
|
312
343
|
|
|
313
|
-
printf '\n
|
|
314
|
-
printf '\n
|
|
344
|
+
printf '\n Reports and dashboard:\n\n %s\n' "$REPORTS_HOME"
|
|
345
|
+
printf '\n Try it:\n\n verify-tracking --slug dreamdata_io --url https://dreamdata.io/\n'
|
|
346
|
+
# The reports folder is the operator's data and is deliberately left out: an
|
|
347
|
+
# `rm -rf` line someone pastes without reading must not take their work with it.
|
|
348
|
+
printf '\n Uninstall (your reports folder is left in place):\n\n rm -rf %s %s/verify-tracking %s/verify-tracking-mcp\n\n' "$PREFIX" "$BIN_DIR" "$BIN_DIR"
|
|
349
|
+
|
|
350
|
+
# Opening the dashboard is the last thing, and never a reason to fail: it also
|
|
351
|
+
# builds the page, so an operator who is looking at the empty state is reading
|
|
352
|
+
# the instructions for their first check. It prints its own path, and skips the
|
|
353
|
+
# browser on a machine with nobody in front of it.
|
|
354
|
+
"$BIN_DIR/verify-tracking" --dashboard >/dev/null 2>&1 || true
|