@peekdev/cli 0.1.0-alpha.2 → 0.1.0-alpha.21

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 (59) hide show
  1. package/README.md +124 -0
  2. package/dist/commands/audit.d.ts.map +1 -1
  3. package/dist/commands/audit.js +10 -0
  4. package/dist/commands/audit.js.map +1 -1
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +154 -5
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/sessions.d.ts.map +1 -1
  9. package/dist/commands/sessions.js +129 -11
  10. package/dist/commands/sessions.js.map +1 -1
  11. package/dist/lib/claude-skill.d.ts +54 -0
  12. package/dist/lib/claude-skill.d.ts.map +1 -0
  13. package/dist/lib/claude-skill.js +88 -0
  14. package/dist/lib/claude-skill.js.map +1 -0
  15. package/dist/lib/db.d.ts +46 -5
  16. package/dist/lib/db.d.ts.map +1 -1
  17. package/dist/lib/db.js +78 -7
  18. package/dist/lib/db.js.map +1 -1
  19. package/dist/lib/extension-id.d.ts +30 -0
  20. package/dist/lib/extension-id.d.ts.map +1 -0
  21. package/dist/lib/extension-id.js +78 -0
  22. package/dist/lib/extension-id.js.map +1 -0
  23. package/dist/lib/format/index.d.ts +11 -1
  24. package/dist/lib/format/index.d.ts.map +1 -1
  25. package/dist/lib/format/index.js +23 -22
  26. package/dist/lib/format/index.js.map +1 -1
  27. package/dist/lib/format/json.d.ts +26 -1
  28. package/dist/lib/format/json.d.ts.map +1 -1
  29. package/dist/lib/format/json.js +39 -2
  30. package/dist/lib/format/json.js.map +1 -1
  31. package/dist/lib/format/markdown.d.ts.map +1 -1
  32. package/dist/lib/format/markdown.js +17 -0
  33. package/dist/lib/format/markdown.js.map +1 -1
  34. package/dist/lib/format/playwright.d.ts +13 -0
  35. package/dist/lib/format/playwright.d.ts.map +1 -0
  36. package/dist/lib/format/playwright.js +37 -0
  37. package/dist/lib/format/playwright.js.map +1 -0
  38. package/dist/lib/init-config.d.ts +12 -2
  39. package/dist/lib/init-config.d.ts.map +1 -1
  40. package/dist/lib/init-config.js +1 -1
  41. package/dist/lib/init-config.js.map +1 -1
  42. package/dist/lib/native-host-wrapper.d.ts +23 -0
  43. package/dist/lib/native-host-wrapper.d.ts.map +1 -0
  44. package/dist/lib/native-host-wrapper.js +45 -0
  45. package/dist/lib/native-host-wrapper.js.map +1 -0
  46. package/dist/lib/peek-home.d.ts +8 -0
  47. package/dist/lib/peek-home.d.ts.map +1 -1
  48. package/dist/lib/peek-home.js +10 -0
  49. package/dist/lib/peek-home.js.map +1 -1
  50. package/dist/lib/prompt.d.ts +13 -0
  51. package/dist/lib/prompt.d.ts.map +1 -1
  52. package/dist/lib/prompt.js +40 -0
  53. package/dist/lib/prompt.js.map +1 -1
  54. package/dist/skills/peek-skill.md +182 -0
  55. package/dist/version.d.ts +1 -1
  56. package/dist/version.d.ts.map +1 -1
  57. package/dist/version.js +14 -5
  58. package/dist/version.js.map +1 -1
  59. package/package.json +24 -4
@@ -8,4 +8,14 @@ export { defaultDbPath, peekHomeDir };
8
8
  export function auditLogPath() {
9
9
  return join(peekHomeDir(), 'audit.log');
10
10
  }
11
+ /**
12
+ * Base directory for gzipped rrweb event chunks (ADR-0007): `~/.peek/rrweb-events/`.
13
+ * Each session has a subdirectory `<sessionId>/` with one `<seq>.json.gz` per
14
+ * append batch. Mirrors `rrwebEventsDir()` in peek-mcp's `mcp/event-blobs.ts`;
15
+ * the path layout is the public contract between writer (native host) and
16
+ * reader/cleaner (this CLI).
17
+ */
18
+ export function rrwebEventsDir() {
19
+ return join(peekHomeDir(), 'rrweb-events');
20
+ }
11
21
  //# sourceMappingURL=peek-home.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"peek-home.js","sourceRoot":"","sources":["../../src/lib/peek-home.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,yEAAyE;AACzE,wDAAwD;AAExD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC;AAEtC,gFAAgF;AAChF,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,WAAW,CAAC,CAAC;AAC1C,CAAC"}
1
+ {"version":3,"file":"peek-home.js","sourceRoot":"","sources":["../../src/lib/peek-home.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,yEAAyE;AACzE,wDAAwD;AAExD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC;AAEtC,gFAAgF;AAChF,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,WAAW,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,cAAc,CAAC,CAAC;AAC7C,CAAC"}
@@ -22,4 +22,17 @@ export interface Choice<T> {
22
22
  export declare function multiSelect<T>(message: string, choices: Choice<T>[]): Promise<T[]>;
23
23
  /** Yes/no confirm. `defaultYes` controls the [Y/n] vs [y/N] default on empty input. */
24
24
  export declare function confirm(message: string, defaultYes?: boolean): Promise<boolean>;
25
+ /**
26
+ * Free-form text prompt with optional validation + retry. Returns the trimmed
27
+ * input — or undefined if the user submits an empty line and `allowEmpty` is
28
+ * true (the caller can interpret empty as "skip").
29
+ *
30
+ * `validate` returns `null` for OK or a message string to print as the reason
31
+ * and re-ask. Used by `peek init` to capture the unpacked-extension ID with a
32
+ * Chrome-shape check (P-10 fix, 2026-05-28 QA walk).
33
+ */
34
+ export declare function promptText(message: string, options?: {
35
+ validate?: (raw: string) => string | null;
36
+ allowEmpty?: boolean;
37
+ }): Promise<string | undefined>;
25
38
  //# sourceMappingURL=prompt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/lib/prompt.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACxC,yCAAyC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAMD;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAkCxF;AAED,uFAAuF;AACvF,wBAAsB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,UAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAUlF"}
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/lib/prompt.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACxC,yCAAyC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAMD;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAkCxF;AAED,uFAAuF;AACvF,wBAAsB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,UAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAUlF;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;CACjB,GACL,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA4B7B"}
@@ -59,4 +59,44 @@ export async function confirm(message, defaultYes = true) {
59
59
  rl.close();
60
60
  }
61
61
  }
62
+ /**
63
+ * Free-form text prompt with optional validation + retry. Returns the trimmed
64
+ * input — or undefined if the user submits an empty line and `allowEmpty` is
65
+ * true (the caller can interpret empty as "skip").
66
+ *
67
+ * `validate` returns `null` for OK or a message string to print as the reason
68
+ * and re-ask. Used by `peek init` to capture the unpacked-extension ID with a
69
+ * Chrome-shape check (P-10 fix, 2026-05-28 QA walk).
70
+ */
71
+ export async function promptText(message, options = {}) {
72
+ const { validate, allowEmpty = false } = options;
73
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
74
+ try {
75
+ // Re-ask on validation failure until the user enters a valid value (or an
76
+ // empty line when allowed). Bounded to a small constant so a non-TTY pipe
77
+ // can't lock the wizard if it keeps streaming garbage.
78
+ for (let attempt = 0; attempt < 5; attempt += 1) {
79
+ const raw = (await ask(rl, message)).trim();
80
+ if (raw.length === 0) {
81
+ if (allowEmpty)
82
+ return undefined;
83
+ process.stdout.write(' (empty input not allowed; please try again)\n');
84
+ continue;
85
+ }
86
+ if (validate) {
87
+ const err = validate(raw);
88
+ if (err !== null) {
89
+ process.stdout.write(` ${err}\n`);
90
+ continue;
91
+ }
92
+ }
93
+ return raw;
94
+ }
95
+ process.stdout.write(' (too many invalid attempts; skipping)\n');
96
+ return undefined;
97
+ }
98
+ finally {
99
+ rl.close();
100
+ }
101
+ }
62
102
  //# sourceMappingURL=prompt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/lib/prompt.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,0EAA0E;AAE1E,OAAO,EAAkB,eAAe,EAAE,MAAM,eAAe,CAAC;AAkBhE,SAAS,GAAG,CAAC,EAAa,EAAE,QAAgB;IAC1C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAClE,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAI,OAAe,EAAE,OAAoB;IACxE,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7E,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACtD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAEpF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QACrC,OAAO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,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7E,IAAI,CAAC;QACH,0EAA0E;QAC1E,0EAA0E;QAC1E,uDAAuD;QACvD,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;YAChD,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC5C,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACrB,IAAI,UAAU;oBAAE,OAAO,SAAS,CAAC;gBACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;gBACxE,SAAS;YACX,CAAC;YACD,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAC1B,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;oBACjB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;oBACnC,SAAS;gBACX,CAAC;YACH,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAClE,OAAO,SAAS,CAAC;IACnB,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: peek
3
+ description: Use when the user mentions a recent browser session, an error they just reproduced, "what was the user doing before X", DOM state at some past moment, or wants to turn a manual repro into a Playwright test. Peek exposes 10 MCP tools backed by a local SQLite store of rrweb-captured browser sessions.
4
+ ---
5
+
6
+ # peek — local browser-session inspection
7
+
8
+ Peek is an OSS browser companion for AI coding agents. A Chrome MV3
9
+ extension records masked rrweb sessions to a local SQLite store
10
+ (`~/.peek/sessions.db`); a stdio MCP server exposes 10 tools that let you
11
+ inspect those sessions and (with consent) drive the live browser.
12
+
13
+ Peek runs entirely on the user's machine. No telemetry, no cloud, no
14
+ account. If `~/.peek/sessions.db` is absent, peek isn't installed yet —
15
+ direct the user to `npx @peekdev/cli init` and stop.
16
+
17
+ ## When to invoke
18
+
19
+ Reach for peek when the user mentions any of these:
20
+
21
+ - "what happened in my last session" / "show me my recent sessions"
22
+ - "investigate this error" alongside a manual repro they just performed
23
+ - "what was the user doing when X failed" / "what action triggered X"
24
+ - "what did the DOM look like when Y happened"
25
+ - "turn what I just did into a Playwright test"
26
+ - "click the foo button on this page" (write tools, with consent)
27
+ - "fill in this form on the page open in my browser" (write tools, with
28
+ consent)
29
+
30
+ Don't reach for peek when:
31
+
32
+ - The user is asking about production / remote / non-local data
33
+ - A test-runner integration is already in scope — use
34
+ `@tracelane/wdio` (or the upcoming `@tracelane/playwright-reporter`)
35
+ for test-failure capture instead
36
+ - The user wants live page introspection at the current moment with no
37
+ prior recording — peek is for *replaying* what was already captured,
38
+ not a live debugger
39
+ - The question is about static code, not runtime behavior
40
+
41
+ ## The 10 tools
42
+
43
+ **Read tools (8) — work at permission Level 2+ for the origin:**
44
+
45
+ | Tool | When |
46
+ |---|---|
47
+ | `list_recent_sessions` | Always the first call. Returns `[{ sessionId, origin, startedAt, endedAt, eventCount, ... }]` for the last N sessions. |
48
+ | `get_session_summary` | Narrative summary of one session — what the user did, top-level errors, key navigations. Start here after `list_recent_sessions` picks the target. |
49
+ | `get_session_console_errors` | All `console.error` / uncaught exceptions in the session, with timestamps. |
50
+ | `get_session_network_errors` | All ≥ 400 responses, with request URL, method, status, and (where deep-capture was enabled) redacted body. |
51
+ | `get_user_action_before_error` | Walks rrweb input events backward from a given timestamp; returns the last meaningful user action (click target, form input, navigation). Use right after spotting a console/network error. |
52
+ | `get_dom_snapshot` | Returns the DOM at a given timestamp as a serialized tree. Use to understand what was on screen when something happened. |
53
+ | `query_dom_history` | Given a CSS selector + sessionId, returns every snapshot where that element changed. Good for "when did this element appear/disappear/change text". |
54
+ | `generate_playwright_repro` | Turns a session (or a slice of one) into a runnable Playwright test stub. Selectors are best-effort from rrweb metadata; surface to the user for review before assuming they'll work. |
55
+
56
+ **Write tools (2) — escalating consent required:**
57
+
58
+ | Tool | When |
59
+ |---|---|
60
+ | `request_authorization` | Ask the user to authorize a specific action against a specific origin. Always call this BEFORE `execute_action` if the action is destructive (form submission, navigation away from the current page, anything that mutates state). |
61
+ | `execute_action` | Performs a click / type / navigate in the user's live browser. Gated by the per-origin permission level — Level 3 covers safe reads, Level 4 covers actions with destructive-action consent, Level 5 is full automation. |
62
+
63
+ ## Workflow
64
+
65
+ The shape of almost every peek conversation:
66
+
67
+ ```
68
+ 1. list_recent_sessions
69
+ → pick the sessionId the user means (usually the most recent;
70
+ prompt if ambiguous)
71
+
72
+ 2. get_session_summary(sessionId)
73
+ → understand what happened in plain language
74
+
75
+ 3. Drill down based on the user's question:
76
+ - errors → get_session_console_errors / get_session_network_errors
77
+ - timing → get_user_action_before_error(sessionId, atTimestamp)
78
+ - DOM state → get_dom_snapshot(sessionId, atTimestamp)
79
+ - element history → query_dom_history(sessionId, selector)
80
+ - repro test → generate_playwright_repro(sessionId, fromTs, toTs)
81
+
82
+ 4. (Optional, gated) write tools — only when the user explicitly asks
83
+ peek to *do* something in their browser:
84
+ - destructive? → request_authorization first, surface the prompt,
85
+ only then execute_action
86
+ - safe (read-only-equivalent click)? → execute_action with the
87
+ least-privilege scope
88
+ ```
89
+
90
+ ## Examples
91
+
92
+ ### Investigating a 500 error from a manual repro
93
+
94
+ User: "I just got a 500 on the dashboard, what happened?"
95
+
96
+ ```
97
+ 1. list_recent_sessions
98
+ → grab the most recent session for the dashboard origin
99
+ 2. get_session_network_errors(sessionId)
100
+ → find the 500: POST /api/save, body field "name" was empty
101
+ 3. get_user_action_before_error(sessionId, errorTs)
102
+ → user clicked "Save" with empty form
103
+ 4. (optional) get_dom_snapshot(sessionId, errorTs - 100)
104
+ → confirm the form state right before the click
105
+ 5. Tell the user: "You submitted /api/save with an empty `name` field,
106
+ the server returned 500. The form's required-field validation didn't
107
+ fire. Want me to add a Playwright test for this?"
108
+ ```
109
+
110
+ ### Generating a Playwright test from a manual repro
111
+
112
+ User: "Write a Playwright test for the bug I just reproduced."
113
+
114
+ ```
115
+ 1. list_recent_sessions
116
+ → the most recent session
117
+ 2. get_session_summary(sessionId)
118
+ → confirm with the user: "I see you logged in, opened settings,
119
+ clicked Delete account, saw the confirmation dialog, and the
120
+ test fails when the dialog closes early — is this what you
121
+ want a test for?"
122
+ 3. generate_playwright_repro(sessionId)
123
+ → returns a test file stub
124
+ 4. Show the user the stub; ask which selectors look fragile.
125
+ ```
126
+
127
+ ### Clicking a button on the user's live browser (consent flow)
128
+
129
+ User: "Click the Save button on the page I have open."
130
+
131
+ ```
132
+ 1. Identify the target origin from list_recent_sessions OR from context
133
+ 2. request_authorization({
134
+ tool: 'execute_action',
135
+ origin: 'https://app.example.com',
136
+ action: 'click',
137
+ selector: '#save-button',
138
+ destructive: false,
139
+ })
140
+ → surface the consent prompt to the user
141
+ 3. If approved → execute_action with the same args
142
+ 4. If declined → say so and stop. Do not retry.
143
+ ```
144
+
145
+ ## Permission model
146
+
147
+ Peek uses a five-level per-origin model. The state lives in
148
+ `~/.peek/permissions.json`; the user manages it via the extension's
149
+ side panel and `peek audit` (CLI).
150
+
151
+ - **Level 0** — no access (default for new origins)
152
+ - **Level 1** — list-only (sessionId + origin + timestamps; no event content)
153
+ - **Level 2** — read full session content (all 8 read tools usable)
154
+ - **Level 3** — read + safe actions (clicks, typing in inputs; no
155
+ navigation away, no form submission)
156
+ - **Level 4** — read + actions including destructive (with per-action
157
+ `request_authorization` consent)
158
+ - **Level 5** — automation (Level 4 actions without per-action consent;
159
+ rare, opt-in only)
160
+
161
+ If a tool returns `{ error: 'permission_denied', origin, currentLevel,
162
+ requiredLevel }`, tell the user how to escalate (via the side panel)
163
+ and stop. Don't retry, don't suggest workarounds.
164
+
165
+ ## Safety floor
166
+
167
+ - Never invent sessions. If `list_recent_sessions` returns empty, say so
168
+ and suggest the user record a session via the extension.
169
+ - Never invent tool names. The 10 above are the entire surface.
170
+ - Selector results from `generate_playwright_repro` are derived from
171
+ rrweb event metadata. Surface them for review; don't claim a generated
172
+ test is production-ready without the user confirming.
173
+ - Destructive write actions (form submits, navigation off-page, deletes)
174
+ ALWAYS require a fresh `request_authorization` call. Never reuse a
175
+ prior authorization for a different action.
176
+
177
+ ## See also
178
+
179
+ - npm: <https://www.npmjs.com/package/@peekdev/cli> · <https://www.npmjs.com/package/@peekdev/mcp>
180
+ - Source: <https://github.com/Cubenest/rrweb-stack>
181
+ - Docs: <https://cubenest.in/peek>
182
+ - Privacy policy: <https://github.com/Cubenest/rrweb-stack/blob/main/docs/peek/PRIVACY_POLICY.md>
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const CLI_VERSION = "0.1.0-alpha.0";
1
+ export declare const CLI_VERSION: string;
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,kBAAkB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,WAAW,QAAe,CAAC"}
package/dist/version.js CHANGED
@@ -1,6 +1,15 @@
1
- // CLI version string surfaced by `peek --version` / `peek --help`. Kept as a
2
- // literal (rather than importing package.json — NodeNext + verbatimModuleSyntax
3
- // makes a runtime JSON import awkward, and a stray resolveJsonModule asset in
4
- // dist is avoidable). The release Changeset bumps both this and package.json.
5
- export const CLI_VERSION = '0.1.0-alpha.0';
1
+ // CLI version string surfaced by `peek --version` / `peek --help`.
2
+ //
3
+ // Read at runtime from this package's package.json (via `createRequire` to
4
+ // keep an awkward JSON ESM import out of the source) so the printed version
5
+ // always matches what npm shipped. The previous hardcoded literal drifted
6
+ // out of sync with package.json across the alpha.0 → alpha.2 bumps because
7
+ // Changesets only edits package.json, not source literals (P-8 bug found in
8
+ // the 2026-05-28 QA walk).
9
+ //
10
+ // The relative path is from the compiled dist/version.js → ../package.json.
11
+ import { createRequire } from 'node:module';
12
+ const _require = createRequire(import.meta.url);
13
+ const _pkg = _require('../package.json');
14
+ export const CLI_VERSION = _pkg.version;
6
15
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,gFAAgF;AAChF,8EAA8E;AAC9E,8EAA8E;AAC9E,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,2BAA2B;AAC3B,EAAE;AACF,4EAA4E;AAE5E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAiB,CAAwB,CAAC;AAEhE,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,8 +1,22 @@
1
1
  {
2
2
  "name": "@peekdev/cli",
3
- "version": "0.1.0-alpha.2",
4
- "description": "peek command-line tool. A thin read-mostly client of the native host's ~/.peek/sessions.db (ADR-0007): status, sessions list/show/export/delete, the `peek init` MCP-client wizard, and `peek audit log`.",
3
+ "version": "0.1.0-alpha.21",
4
+ "description": "peek command-line tool. A thin read-mostly client of the native host's ~/.peek/sessions.db: status, sessions list/show/export/delete, the `peek init` MCP-client wizard, and `peek audit log`.",
5
+ "keywords": [
6
+ "peek",
7
+ "mcp",
8
+ "model-context-protocol",
9
+ "browser",
10
+ "claude-code",
11
+ "cursor",
12
+ "ai-coding-agent",
13
+ "session-replay"
14
+ ],
5
15
  "license": "Apache-2.0",
16
+ "funding": {
17
+ "type": "github",
18
+ "url": "https://github.com/sponsors/harry-harish"
19
+ },
6
20
  "type": "module",
7
21
  "bin": {
8
22
  "peek": "./dist/index.js"
@@ -22,7 +36,7 @@
22
36
  ],
23
37
  "dependencies": {
24
38
  "better-sqlite3": "^12.10.0",
25
- "@peekdev/mcp": "0.1.0-alpha.2"
39
+ "@peekdev/mcp": "0.1.0-alpha.15"
26
40
  },
27
41
  "devDependencies": {
28
42
  "@types/better-sqlite3": "^7.6.13",
@@ -37,7 +51,13 @@
37
51
  "url": "https://github.com/Cubenest/rrweb-stack",
38
52
  "directory": "packages/peek-cli"
39
53
  },
40
- "homepage": "https://github.com/Cubenest/rrweb-stack/tree/main/packages/peek-cli#readme",
54
+ "bugs": {
55
+ "url": "https://github.com/Cubenest/rrweb-stack/issues"
56
+ },
57
+ "homepage": "https://peek.cubenest.in",
58
+ "engines": {
59
+ "node": ">=22"
60
+ },
41
61
  "scripts": {
42
62
  "build": "tsc -p tsconfig.json && node ./scripts/postbuild.mjs",
43
63
  "typecheck": "tsc -p tsconfig.json --noEmit",