sealmetrics 0.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/PROTOCOL.md +85 -0
- package/README.md +63 -0
- package/package.json +55 -0
package/PROTOCOL.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# `sealmetrics init --agent` — NDJSON protocol v1
|
|
2
|
+
|
|
3
|
+
When invoked with `--agent`, **every** stdout line is a single, complete JSON
|
|
4
|
+
object terminated by `\n` (never multiline). Debug logs go to **stderr** only.
|
|
5
|
+
An orchestrating agent parses the stream line by line and renders progress,
|
|
6
|
+
diffs and the claim URL to its user.
|
|
7
|
+
|
|
8
|
+
## Envelope
|
|
9
|
+
|
|
10
|
+
```json
|
|
11
|
+
{ "v": 1, "type": "lifecycle", "level": "info", "data": { } }
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| Field | Meaning |
|
|
15
|
+
|---------|---------|
|
|
16
|
+
| `v` | Protocol version (currently `1`). Bumped on breaking changes so parsers can branch. |
|
|
17
|
+
| `type` | `lifecycle` \| `file_change` \| `needs_input` \| `result` \| `error` |
|
|
18
|
+
| `level` | `info` \| `warn` \| `error` |
|
|
19
|
+
| `data` | Type-specific payload (below). |
|
|
20
|
+
|
|
21
|
+
## Event types
|
|
22
|
+
|
|
23
|
+
### `lifecycle`
|
|
24
|
+
Milestones. `data.stage` is the milestone id; extra fields vary.
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
start · detected:<framework|platform> · provisioned · reused
|
|
28
|
+
handoff:inject · handoff:plugin · handoff:already-installed · handoff:manual
|
|
29
|
+
verified:local · verify:local-pending
|
|
30
|
+
mcp:configured · mcp:handoff
|
|
31
|
+
instrumentation_guide · verified:pixel · verify:pending
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Notable payloads:
|
|
35
|
+
- `detected:*` → `{ framework, platform, strategy, recommended_location, provision_only }`
|
|
36
|
+
- `provisioned` → `{ account_id, dashboard_url, claim_url, free_quota_events }` (**never** the api_key)
|
|
37
|
+
- `handoff:inject` → `{ snippet, recommended_location, placement_hint, install_md }` — the **agent** places the snippet
|
|
38
|
+
- `instrumentation_guide` → `{ guide_path }`
|
|
39
|
+
|
|
40
|
+
### `file_change`
|
|
41
|
+
One per file the CLI plans/writes. The CLI only ever writes **its own**
|
|
42
|
+
artefacts (`.env`, `seal.config.json`, `.sealmetrics/*`, MCP config, `.gitignore`)
|
|
43
|
+
— never app source.
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{ "v":1, "type":"file_change", "level":"info",
|
|
47
|
+
"data": { "path": ".env", "action": "plan", "diff": "+ SEALMETRICS_API_KEY=…", "bytes": 42 } }
|
|
48
|
+
```
|
|
49
|
+
`action` is `plan` (with `diff`) before the write and `applied` after.
|
|
50
|
+
|
|
51
|
+
### `needs_input`
|
|
52
|
+
In `--agent` every prompt is **auto-resolved** (from flags or a safe default)
|
|
53
|
+
and the resolution is reported — the stream never blocks on stdin.
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{ "v":1, "type":"needs_input", "level":"info",
|
|
57
|
+
"data": { "id":"…", "prompt":"…", "default":"…", "resolved":"…" } }
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### `result`
|
|
61
|
+
The final structured payload.
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{ "v":1, "type":"result", "level":"info",
|
|
65
|
+
"data": { "account_id":"…", "dashboard_url":"…", "claim_url":"…",
|
|
66
|
+
"framework":"next-app", "mcp_configured": true, "verified": true,
|
|
67
|
+
"next_steps": ["…"] } }
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### `error`
|
|
71
|
+
```json
|
|
72
|
+
{ "v":1, "type":"error", "level":"error",
|
|
73
|
+
"data": { "code":"AUTH_REQUIRED", "message":"…", "hint":"…", "command":"npx sealmetrics init --provision-key <KEY> …" } }
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Exit codes
|
|
77
|
+
|
|
78
|
+
| Code | Meaning |
|
|
79
|
+
|------|---------|
|
|
80
|
+
| `0` | OK |
|
|
81
|
+
| `2` | Invalid args |
|
|
82
|
+
| `3` | `AUTH_REQUIRED` — provision key invalid/revoked (`error.data.command` carries the re-invocation) |
|
|
83
|
+
| `4` | Network / backend unavailable / rate-limited / kill-switch (503) |
|
|
84
|
+
| `5` | Verify-failed — snippet placed but pixel did not confirm within the timeout |
|
|
85
|
+
| `130`| Cancelled (SIGINT) |
|
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# sealmetrics
|
|
2
|
+
|
|
3
|
+
Set up [SealMetrics](https://sealmetrics.com) analytics in one command: provision
|
|
4
|
+
a free account, get the tracker snippet placed, and auto-configure the SealMetrics
|
|
5
|
+
MCP server in your editor so you can read your analytics in natural language.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx sealmetrics init
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Privacy-first, cookieless, GDPR-compliant by design — no card required for the
|
|
12
|
+
free tier.
|
|
13
|
+
|
|
14
|
+
## What it does
|
|
15
|
+
|
|
16
|
+
1. **Detects** your framework (Next.js, Astro, Remix, Nuxt, SvelteKit, Vite,
|
|
17
|
+
plain HTML) or CMS (WordPress, WooCommerce, PrestaShop, …).
|
|
18
|
+
2. **Provisions** a free account headless (`POST /provision`) and stores the
|
|
19
|
+
read-only API key in `.env` (gitignored — never printed).
|
|
20
|
+
3. **Hands off the snippet** — the CLI **never edits your source**. It tells you
|
|
21
|
+
exactly where the snippet goes and writes `.sealmetrics/INSTALL.md`; you (or
|
|
22
|
+
your agent) paste it.
|
|
23
|
+
4. **Auto-configures the MCP server** for Claude Code, Cursor, Windsurf or
|
|
24
|
+
VS Code (unknown clients get the standard block to paste).
|
|
25
|
+
5. **Verifies** the install by polling pixel status.
|
|
26
|
+
|
|
27
|
+
## Agent mode
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx sealmetrics init --agent --email you@example.com --accept-tos \
|
|
31
|
+
--site-name "My Shop" --domain myshop.com --install-source claude-code
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
In `--agent` mode all stdout is versioned NDJSON with structured exit codes — see
|
|
35
|
+
[PROTOCOL.md](./PROTOCOL.md). Built for AI orchestrators (Claude Code, Cursor,
|
|
36
|
+
Codex) to drive in one turn.
|
|
37
|
+
|
|
38
|
+
## Common flags
|
|
39
|
+
|
|
40
|
+
| Flag | Purpose |
|
|
41
|
+
|------|---------|
|
|
42
|
+
| `--agent` | Machine mode (NDJSON + auto-approve, no prompts) |
|
|
43
|
+
| `-y, --yes` | Non-interactive (use flags/defaults) |
|
|
44
|
+
| `--dry-run` | Detect only — no provisioning, no writes |
|
|
45
|
+
| `--resume` | Resume from the last checkpoint (no re-provision) |
|
|
46
|
+
| `--no-inject` | Provision only — don't emit placement guidance |
|
|
47
|
+
| `--no-mcp` | Skip MCP auto-config |
|
|
48
|
+
| `--region <prod\|pre\|local>` / `--base-url <url>` | Target a backend |
|
|
49
|
+
| `--editor <id>` | Force an MCP client |
|
|
50
|
+
| `--verify-timeout <secs>` | Pixel verify timeout (0 = skip) |
|
|
51
|
+
|
|
52
|
+
Run `npx sealmetrics init --help` for the full list.
|
|
53
|
+
|
|
54
|
+
## What it writes
|
|
55
|
+
|
|
56
|
+
Only its **own** artefacts, always atomically and idempotently:
|
|
57
|
+
`.env`, `seal.config.json`, `.sealmetrics/INSTALL.md`,
|
|
58
|
+
`.sealmetrics/INSTRUMENTATION.md`, `.sealmetrics/checkpoint.json`, the MCP config
|
|
59
|
+
file, and `.gitignore` entries. It never touches your application source.
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sealmetrics",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "SealMetrics setup CLI — provision a free analytics account, place the tracker, and auto-configure the MCP server in one turn",
|
|
5
|
+
"author": "SealMetrics <dev@sealmetrics.com> (https://sealmetrics.com)",
|
|
6
|
+
"homepage": "https://github.com/adinton/sealmetrics2/tree/main/cli#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/adinton/sealmetrics2.git",
|
|
10
|
+
"directory": "cli"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/adinton/sealmetrics2/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"bin": {
|
|
17
|
+
"sealmetrics": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"PROTOCOL.md",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=20"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"sync-guide": "node scripts/sync-guide.mjs",
|
|
29
|
+
"prebuild": "node scripts/sync-guide.mjs",
|
|
30
|
+
"build": "tsc",
|
|
31
|
+
"dev": "tsx src/index.ts",
|
|
32
|
+
"pretest": "node scripts/sync-guide.mjs",
|
|
33
|
+
"test": "vitest run",
|
|
34
|
+
"test:watch": "vitest",
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"prepublishOnly": "npm run build && chmod +x dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^22.0.0",
|
|
40
|
+
"tsx": "^4.0.0",
|
|
41
|
+
"typescript": "^5.7.0",
|
|
42
|
+
"vitest": "4.1.5"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"sealmetrics",
|
|
46
|
+
"analytics",
|
|
47
|
+
"cli",
|
|
48
|
+
"setup",
|
|
49
|
+
"wizard",
|
|
50
|
+
"mcp",
|
|
51
|
+
"privacy-first",
|
|
52
|
+
"cookieless"
|
|
53
|
+
],
|
|
54
|
+
"license": "MIT"
|
|
55
|
+
}
|