aipeek 0.1.3 → 0.1.4

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.
@@ -516,19 +516,28 @@ curl ${base}/state # registered store snapshots
516
516
  Append \`?full\` for untruncated output. Append \`/{index}\` for a specific item's detail.
517
517
  `;
518
518
  }
519
+ var AIPEEK_HEADING = "# aipeek \u2014 Runtime Browser Inspector";
519
520
  function injectClaudeMd(root, port) {
520
521
  const path = resolve(root, "CLAUDE.md");
521
522
  const snippet = aipeekSnippet(port);
522
523
  try {
523
- if (existsSync(path)) {
524
- const content = readFileSync(path, "utf-8");
525
- if (content.includes("__aipeek"))
526
- return;
524
+ if (!existsSync(path)) {
525
+ writeFileSync(path, snippet.trimStart());
526
+ return;
527
+ }
528
+ const content = readFileSync(path, "utf-8");
529
+ const start = content.indexOf(AIPEEK_HEADING);
530
+ if (start === -1) {
527
531
  writeFileSync(path, `${content.trimEnd()}
528
532
  ${snippet}`);
529
- } else {
530
- writeFileSync(path, snippet.trimStart());
533
+ return;
531
534
  }
535
+ const afterHeading = content.indexOf("\n", start);
536
+ const nextHeading = content.indexOf("\n# ", afterHeading);
537
+ const end = nextHeading === -1 ? content.length : nextHeading;
538
+ const before = content.slice(0, start).trimEnd();
539
+ const after = content.slice(end);
540
+ writeFileSync(path, before + (before ? "\n" : "") + snippet + after);
532
541
  } catch {
533
542
  }
534
543
  }
@@ -516,19 +516,28 @@ curl ${base}/state # registered store snapshots
516
516
  Append \`?full\` for untruncated output. Append \`/{index}\` for a specific item's detail.
517
517
  `;
518
518
  }
519
+ var AIPEEK_HEADING = "# aipeek \u2014 Runtime Browser Inspector";
519
520
  function injectClaudeMd(root, port) {
520
521
  const path = _path.resolve.call(void 0, root, "CLAUDE.md");
521
522
  const snippet = aipeekSnippet(port);
522
523
  try {
523
- if (_fs.existsSync.call(void 0, path)) {
524
- const content = _fs.readFileSync.call(void 0, path, "utf-8");
525
- if (content.includes("__aipeek"))
526
- return;
524
+ if (!_fs.existsSync.call(void 0, path)) {
525
+ _fs.writeFileSync.call(void 0, path, snippet.trimStart());
526
+ return;
527
+ }
528
+ const content = _fs.readFileSync.call(void 0, path, "utf-8");
529
+ const start = content.indexOf(AIPEEK_HEADING);
530
+ if (start === -1) {
527
531
  _fs.writeFileSync.call(void 0, path, `${content.trimEnd()}
528
532
  ${snippet}`);
529
- } else {
530
- _fs.writeFileSync.call(void 0, path, snippet.trimStart());
533
+ return;
531
534
  }
535
+ const afterHeading = content.indexOf("\n", start);
536
+ const nextHeading = content.indexOf("\n# ", afterHeading);
537
+ const end = nextHeading === -1 ? content.length : nextHeading;
538
+ const before = content.slice(0, start).trimEnd();
539
+ const after = content.slice(end);
540
+ _fs.writeFileSync.call(void 0, path, before + (before ? "\n" : "") + snippet + after);
532
541
  } catch (e6) {
533
542
  }
534
543
  }
package/dist/cli.cjs CHANGED
@@ -13,11 +13,11 @@ async function main() {
13
13
  ${_picocolors2.default.bold("aipeek")} \u2014 runtime snapshot from Vite dev server
14
14
 
15
15
  ${_picocolors2.default.dim("Usage:")}
16
- aipeek Fetch from localhost:5195
16
+ aipeek Fetch from localhost:5173
17
17
  aipeek --port=3000 Fetch from localhost:3000
18
18
 
19
19
  ${_picocolors2.default.dim("Options:")}
20
- --port=<port> Dev server port (default: 5195)
20
+ --port=<port> Dev server port (default: 5173)
21
21
  --help Show this help
22
22
 
23
23
  ${_picocolors2.default.dim("Setup:")}
@@ -25,7 +25,7 @@ ${_picocolors2.default.dim("Setup:")}
25
25
  `);
26
26
  process.exit(0);
27
27
  }
28
- const port = flags.port || "5195";
28
+ const port = flags.port || "5173";
29
29
  const endpoint = `http://localhost:${port}/__aipeek`;
30
30
  const resp = await fetch(endpoint);
31
31
  if (!resp.ok) {
package/dist/cli.js CHANGED
@@ -13,11 +13,11 @@ async function main() {
13
13
  ${pc.bold("aipeek")} \u2014 runtime snapshot from Vite dev server
14
14
 
15
15
  ${pc.dim("Usage:")}
16
- aipeek Fetch from localhost:5195
16
+ aipeek Fetch from localhost:5173
17
17
  aipeek --port=3000 Fetch from localhost:3000
18
18
 
19
19
  ${pc.dim("Options:")}
20
- --port=<port> Dev server port (default: 5195)
20
+ --port=<port> Dev server port (default: 5173)
21
21
  --help Show this help
22
22
 
23
23
  ${pc.dim("Setup:")}
@@ -25,7 +25,7 @@ ${pc.dim("Setup:")}
25
25
  `);
26
26
  process.exit(0);
27
27
  }
28
- const port = flags.port || "5195";
28
+ const port = flags.port || "5173";
29
29
  const endpoint = `http://localhost:${port}/__aipeek`;
30
30
  const resp = await fetch(endpoint);
31
31
  if (!resp.ok) {
package/dist/index.cjs CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkKW232XW7cjs = require('./chunk-KW232XW7.cjs');
11
+ var _chunkHNRFA6MNcjs = require('./chunk-HNRFA6MN.cjs');
12
12
 
13
13
 
14
14
 
@@ -19,4 +19,4 @@ var _chunkKW232XW7cjs = require('./chunk-KW232XW7.cjs');
19
19
 
20
20
 
21
21
 
22
- exports.aipeekPlugin = _chunkKW232XW7cjs.aipeekPlugin; exports.compact = _chunkKW232XW7cjs.compact; exports.compactConsole = _chunkKW232XW7cjs.compactConsole; exports.compactErrors = _chunkKW232XW7cjs.compactErrors; exports.compactNetwork = _chunkKW232XW7cjs.compactNetwork; exports.compactState = _chunkKW232XW7cjs.compactState; exports.compactUI = _chunkKW232XW7cjs.compactUI; exports.detail = _chunkKW232XW7cjs.detail; exports.emit = _chunkKW232XW7cjs.emit;
22
+ exports.aipeekPlugin = _chunkHNRFA6MNcjs.aipeekPlugin; exports.compact = _chunkHNRFA6MNcjs.compact; exports.compactConsole = _chunkHNRFA6MNcjs.compactConsole; exports.compactErrors = _chunkHNRFA6MNcjs.compactErrors; exports.compactNetwork = _chunkHNRFA6MNcjs.compactNetwork; exports.compactState = _chunkHNRFA6MNcjs.compactState; exports.compactUI = _chunkHNRFA6MNcjs.compactUI; exports.detail = _chunkHNRFA6MNcjs.detail; exports.emit = _chunkHNRFA6MNcjs.emit;
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  compactUI,
9
9
  detail,
10
10
  emit
11
- } from "./chunk-FI6MF54L.js";
11
+ } from "./chunk-AFSKSPDG.js";
12
12
  export {
13
13
  aipeekPlugin,
14
14
  compact,
package/dist/plugin.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkKW232XW7cjs = require('./chunk-KW232XW7.cjs');
3
+ var _chunkHNRFA6MNcjs = require('./chunk-HNRFA6MN.cjs');
4
4
 
5
5
 
6
- exports.aipeekPlugin = _chunkKW232XW7cjs.aipeekPlugin;
6
+ exports.aipeekPlugin = _chunkHNRFA6MNcjs.aipeekPlugin;
package/dist/plugin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  aipeekPlugin
3
- } from "./chunk-FI6MF54L.js";
3
+ } from "./chunk-AFSKSPDG.js";
4
4
  export {
5
5
  aipeekPlugin
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aipeek",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Gives AI a peek into your running browser app — UI tree, console, network, errors, state",
5
5
  "license": "MIT",
6
6
  "repository": {