@githumbi/grabby 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/CHANGELOG.md +11 -0
- package/LICENSE +22 -0
- package/README.md +262 -0
- package/builders.json +14 -0
- package/dist/angular/index.d.ts +279 -0
- package/dist/angular/index.js +5145 -0
- package/dist/angular/index.js.map +1 -0
- package/dist/babel-plugin/index.cjs +95 -0
- package/dist/babel-plugin/index.cjs.map +1 -0
- package/dist/babel-plugin/index.d.cts +28 -0
- package/dist/babel-plugin/index.d.ts +28 -0
- package/dist/babel-plugin/index.js +60 -0
- package/dist/babel-plugin/index.js.map +1 -0
- package/dist/builder/builders/application/index.js +141 -0
- package/dist/builder/builders/application/index.js.map +1 -0
- package/dist/builder/builders/application/schema.json +7 -0
- package/dist/builder/builders/dev-server/index.js +137 -0
- package/dist/builder/builders/dev-server/index.js.map +1 -0
- package/dist/builder/builders/dev-server/schema.json +26 -0
- package/dist/builder/index.js +2 -0
- package/dist/builder/index.js.map +1 -0
- package/dist/builder/package.json +1 -0
- package/dist/chunk-6CBIOKZV.cjs +45 -0
- package/dist/chunk-6CBIOKZV.cjs.map +1 -0
- package/dist/chunk-M3DOFJA7.js +45 -0
- package/dist/chunk-M3DOFJA7.js.map +1 -0
- package/dist/cli/index.js +406 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/index.cjs +5081 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +96 -0
- package/dist/core/index.d.ts +96 -0
- package/dist/core/index.js +5081 -0
- package/dist/core/index.js.map +1 -0
- package/dist/esbuild-plugin/index.cjs +134 -0
- package/dist/esbuild-plugin/index.cjs.map +1 -0
- package/dist/esbuild-plugin/index.d.cts +21 -0
- package/dist/esbuild-plugin/index.d.ts +21 -0
- package/dist/esbuild-plugin/index.js +96 -0
- package/dist/esbuild-plugin/index.js.map +1 -0
- package/dist/export/index.cjs +166 -0
- package/dist/export/index.cjs.map +1 -0
- package/dist/export/index.d.cts +86 -0
- package/dist/export/index.d.ts +86 -0
- package/dist/export/index.js +137 -0
- package/dist/export/index.js.map +1 -0
- package/dist/grabby.global.js +635 -0
- package/dist/live/index.cjs +30 -0
- package/dist/live/index.cjs.map +1 -0
- package/dist/live/index.d.cts +20 -0
- package/dist/live/index.d.ts +20 -0
- package/dist/live/index.js +30 -0
- package/dist/live/index.js.map +1 -0
- package/dist/loader.global.js +1 -0
- package/dist/plugin/index.cjs +229 -0
- package/dist/plugin/index.cjs.map +1 -0
- package/dist/plugin/index.d.cts +76 -0
- package/dist/plugin/index.d.ts +76 -0
- package/dist/plugin/index.js +186 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/react/index.d.ts +290 -0
- package/dist/react/index.js +5110 -0
- package/dist/react/index.js.map +1 -0
- package/dist/types-CMgpkvBz.d.cts +265 -0
- package/dist/types-CMgpkvBz.d.ts +265 -0
- package/package.json +191 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** What kind of UI the comment is about; decides which facts get captured. */
|
|
2
|
+
type TargetKind = 'action' | 'field' | 'text' | 'media' | 'container' | 'section';
|
|
3
|
+
/** How much context the export includes. */
|
|
4
|
+
type DetailLevel = 'compact' | 'standard' | 'detailed';
|
|
5
|
+
interface SourceLocation {
|
|
6
|
+
file: string;
|
|
7
|
+
line: number | null;
|
|
8
|
+
column: number | null;
|
|
9
|
+
}
|
|
10
|
+
interface StackFrame {
|
|
11
|
+
name: string;
|
|
12
|
+
file: string | null;
|
|
13
|
+
line: number | null;
|
|
14
|
+
}
|
|
15
|
+
/** The compact, serialisable description of the element a comment is about. */
|
|
16
|
+
interface GrabbyTarget {
|
|
17
|
+
kind: TargetKind;
|
|
18
|
+
tag: string;
|
|
19
|
+
component: string | null;
|
|
20
|
+
source: SourceLocation | null;
|
|
21
|
+
/** Up to 3 of the app's own component frames, innermost first. */
|
|
22
|
+
stack: StackFrame[];
|
|
23
|
+
/** Unique CSS selector. Exported only when there is no source location. */
|
|
24
|
+
selector: string;
|
|
25
|
+
/** Trimmed opening tag plus a text excerpt, at most ~300 characters. */
|
|
26
|
+
preview: string;
|
|
27
|
+
/** Kind-specific facts for the standard export, in display order. */
|
|
28
|
+
facts: Record<string, string>;
|
|
29
|
+
/** Extra facts only shown at the detailed level. */
|
|
30
|
+
extra: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
interface CommentAuthor {
|
|
33
|
+
name: string | null;
|
|
34
|
+
anonymous: boolean;
|
|
35
|
+
/** Stable random id per browser, so anonymous commenters stay distinguishable. */
|
|
36
|
+
sessionId: string;
|
|
37
|
+
/** The host app's own user id, when it called `identify()`. */
|
|
38
|
+
userId?: string;
|
|
39
|
+
}
|
|
40
|
+
interface PageInfo {
|
|
41
|
+
/** Pathname only; query strings are dropped unless allowlisted. */
|
|
42
|
+
route: string;
|
|
43
|
+
title: string;
|
|
44
|
+
viewport: [number, number];
|
|
45
|
+
}
|
|
46
|
+
interface ScreenshotRef {
|
|
47
|
+
/** Key of the image in this browser's IndexedDB. */
|
|
48
|
+
localId?: string;
|
|
49
|
+
/** Where a server stored it, once uploaded. */
|
|
50
|
+
url?: string;
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
}
|
|
54
|
+
interface GrabbyComment {
|
|
55
|
+
id: string;
|
|
56
|
+
createdAt: number;
|
|
57
|
+
updatedAt: number;
|
|
58
|
+
status: 'open' | 'resolved';
|
|
59
|
+
comment: string;
|
|
60
|
+
author: CommentAuthor;
|
|
61
|
+
page: PageInfo;
|
|
62
|
+
target: GrabbyTarget;
|
|
63
|
+
screenshot: ScreenshotRef | null;
|
|
64
|
+
framework: string;
|
|
65
|
+
/** Delivery to a Grabby server, when one is configured. Browser-only. */
|
|
66
|
+
sync?: 'pending' | 'sent' | 'failed';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface ExportEnv {
|
|
70
|
+
/** Page origin shown in the header, e.g. "localhost:4200". */
|
|
71
|
+
origin?: string;
|
|
72
|
+
now?: Date;
|
|
73
|
+
/** Print each comment's id, so an agent can act on it (e.g. resolve it). */
|
|
74
|
+
showIds?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/** Rough token count (≈4 characters per token), for the Copy dialog. */
|
|
77
|
+
declare function estimateTokens(text: string): number;
|
|
78
|
+
declare function authorLabel(a: CommentAuthor): string;
|
|
79
|
+
/**
|
|
80
|
+
* Turns comments into text for an AI agent. Page-level context is said once
|
|
81
|
+
* in the header, comments are grouped by the file they point at, and only the
|
|
82
|
+
* facts that matter for each element's kind are included.
|
|
83
|
+
*/
|
|
84
|
+
declare function formatExport(comments: GrabbyComment[], level?: DetailLevel, env?: ExportEnv): string;
|
|
85
|
+
|
|
86
|
+
export { type CommentAuthor, type DetailLevel, type ExportEnv, type GrabbyComment, type GrabbyTarget, type PageInfo, type ScreenshotRef, type SourceLocation, type StackFrame, type TargetKind, authorLabel, estimateTokens, formatExport };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// src/core/capture/export.ts
|
|
2
|
+
function estimateTokens(text) {
|
|
3
|
+
return Math.ceil(text.length / 4);
|
|
4
|
+
}
|
|
5
|
+
var STYLE_FACTS = /* @__PURE__ */ new Set(["styles", "layout", "computed"]);
|
|
6
|
+
var PREVIEW_FACTS = /* @__PURE__ */ new Set(["label", "type", "text", "href", "placeholder", "alt", "src", "title"]);
|
|
7
|
+
function inPreview(preview, value) {
|
|
8
|
+
return value.length > 0 && (preview.includes(`>${value}<`) || preview.includes(`"${value}"`) || preview.includes(`>${value}`));
|
|
9
|
+
}
|
|
10
|
+
function authorKey(a) {
|
|
11
|
+
return a.anonymous || !a.name ? `anon:${a.sessionId}` : `name:${a.name}`;
|
|
12
|
+
}
|
|
13
|
+
function authorLabel(a) {
|
|
14
|
+
if (!a.anonymous && a.name) return a.name;
|
|
15
|
+
return `Anonymous ${a.sessionId.replace(/-/g, "").slice(0, 4)}`;
|
|
16
|
+
}
|
|
17
|
+
function basename(path) {
|
|
18
|
+
return path.split(/[\\/]/).pop() ?? path;
|
|
19
|
+
}
|
|
20
|
+
function location(file, line, full) {
|
|
21
|
+
const name = full ? file : basename(file);
|
|
22
|
+
return line != null ? `${name}:${line}` : name;
|
|
23
|
+
}
|
|
24
|
+
function indent(text, pad) {
|
|
25
|
+
return text.split("\n").map((l, i) => i === 0 ? l : `${pad}${l}`).join("\n");
|
|
26
|
+
}
|
|
27
|
+
function uniq(values) {
|
|
28
|
+
return Array.from(new Set(values));
|
|
29
|
+
}
|
|
30
|
+
function header(comments, env, ctx) {
|
|
31
|
+
const n = comments.length;
|
|
32
|
+
const lines = [`# UI feedback \xB7 ${n} comment${n === 1 ? "" : "s"}`];
|
|
33
|
+
const meta = [];
|
|
34
|
+
if (env.origin) meta.push(env.origin);
|
|
35
|
+
const frameworks = uniq(comments.map((c) => c.framework).filter(Boolean));
|
|
36
|
+
if (frameworks.length) meta.push(frameworks.join(", "));
|
|
37
|
+
const routes = uniq(comments.map((c) => c.page.route));
|
|
38
|
+
if (!ctx.showRoutes && routes.length === 1) meta.push(`page ${routes[0]}`);
|
|
39
|
+
const vp = comments[0]?.page.viewport;
|
|
40
|
+
if (vp) meta.push(`${vp[0]}\xD7${vp[1]}`);
|
|
41
|
+
meta.push((env.now ?? /* @__PURE__ */ new Date()).toISOString().slice(0, 10));
|
|
42
|
+
lines.push(meta.join(" \xB7 "));
|
|
43
|
+
if (ctx.showAuthors) {
|
|
44
|
+
const people = uniq(comments.map((c) => authorLabel(c.author)));
|
|
45
|
+
lines.push(`From: ${people.join(", ")}`);
|
|
46
|
+
}
|
|
47
|
+
return lines;
|
|
48
|
+
}
|
|
49
|
+
function compactLine(c, i, ctx) {
|
|
50
|
+
const t = c.target;
|
|
51
|
+
const where = t.source ? location(t.source.file, t.source.line, true) : t.selector;
|
|
52
|
+
const parts = [where, t.component, `<${t.tag}>`].filter(Boolean).join(" ");
|
|
53
|
+
const who = ctx.showAuthors ? ` (${authorLabel(c.author)})` : "";
|
|
54
|
+
const route = ctx.showRoutes ? ` [${c.page.route}]` : "";
|
|
55
|
+
const id = ctx.showIds ? ` [id ${c.id}]` : "";
|
|
56
|
+
return `${i}. ${parts}${route} \u2014 ${indent(c.comment, " ")}${who}${id}`;
|
|
57
|
+
}
|
|
58
|
+
function detailBlock(c, i, ctx, groupHasSource, headedComponent) {
|
|
59
|
+
const t = c.target;
|
|
60
|
+
const full = ctx.level === "detailed";
|
|
61
|
+
const lines = [`${i}. ${indent(c.comment, " ")}`];
|
|
62
|
+
const b = (text) => lines.push(` - ${text}`);
|
|
63
|
+
const where = [`\`${t.preview}\``, `(${t.kind})`];
|
|
64
|
+
if (t.component && t.component !== headedComponent) {
|
|
65
|
+
where.push(t.source?.line != null && groupHasSource ? `${t.component} line ${t.source.line}` : t.component);
|
|
66
|
+
} else if (t.source?.line != null && groupHasSource) {
|
|
67
|
+
where.push(`line ${t.source.line}`);
|
|
68
|
+
}
|
|
69
|
+
b(where.join(" "));
|
|
70
|
+
if (!t.source || full) b(`selector: \`${t.selector}\``);
|
|
71
|
+
const plain = Object.entries(t.facts).filter(([k, v]) => !STYLE_FACTS.has(k) && !(PREVIEW_FACTS.has(k) && !full && inPreview(t.preview, v)));
|
|
72
|
+
if (plain.length) b(plain.map(([k, v]) => `${k}: ${v}`).join(" \xB7 "));
|
|
73
|
+
for (const [k, v] of Object.entries(t.facts)) if (STYLE_FACTS.has(k)) b(`${k}: ${v}`);
|
|
74
|
+
const parents = t.stack.filter((f, i2) => !(i2 === 0 && (t.source || f.name === t.component)));
|
|
75
|
+
if (parents.length) {
|
|
76
|
+
b(`inside: ${parents.map((f) => f.file ? `${f.name} (${location(f.file, f.line, full)})` : f.name).join(" \u203A ")}`);
|
|
77
|
+
}
|
|
78
|
+
if (full) {
|
|
79
|
+
for (const [k, v] of Object.entries(t.extra)) b(`${k}: ${v}`);
|
|
80
|
+
b(`viewport: ${c.page.viewport[0]}\xD7${c.page.viewport[1]}`);
|
|
81
|
+
}
|
|
82
|
+
if (c.screenshot?.url) b(`screenshot: ${c.screenshot.url}`);
|
|
83
|
+
const meta = [];
|
|
84
|
+
if (ctx.showAuthors) meta.push(`by ${authorLabel(c.author)}`);
|
|
85
|
+
if (ctx.showRoutes) meta.push(`on ${c.page.route}`);
|
|
86
|
+
if (meta.length) b(meta.join(" "));
|
|
87
|
+
if (ctx.showIds) b(`id: ${c.id}`);
|
|
88
|
+
return lines;
|
|
89
|
+
}
|
|
90
|
+
function formatExport(comments, level = "standard", env = {}) {
|
|
91
|
+
if (comments.length === 0) return "";
|
|
92
|
+
const ordered = [...comments].sort((a, b) => a.createdAt - b.createdAt);
|
|
93
|
+
const authors = uniq(ordered.map((c) => authorKey(c.author)));
|
|
94
|
+
const ctx = {
|
|
95
|
+
level,
|
|
96
|
+
showIds: env.showIds === true,
|
|
97
|
+
showAuthors: authors.length > 1 || ordered.some((c) => !c.author.anonymous && !!c.author.name),
|
|
98
|
+
showRoutes: uniq(ordered.map((c) => c.page.route)).length > 1
|
|
99
|
+
};
|
|
100
|
+
const out = header(ordered, env, ctx);
|
|
101
|
+
if (level === "compact") {
|
|
102
|
+
out.push("");
|
|
103
|
+
ordered.forEach((c, idx) => out.push(compactLine(c, idx + 1, ctx)));
|
|
104
|
+
return out.join("\n");
|
|
105
|
+
}
|
|
106
|
+
const groups = /* @__PURE__ */ new Map();
|
|
107
|
+
for (const c of ordered) {
|
|
108
|
+
const key = c.target.source?.file ?? "";
|
|
109
|
+
const list = groups.get(key);
|
|
110
|
+
if (list) list.push(c);
|
|
111
|
+
else groups.set(key, [c]);
|
|
112
|
+
}
|
|
113
|
+
let n = 0;
|
|
114
|
+
for (const [file, list] of groups) {
|
|
115
|
+
out.push("");
|
|
116
|
+
const components = uniq(list.map((c) => c.target.component));
|
|
117
|
+
const headed = file && components.length === 1 ? components[0] : null;
|
|
118
|
+
const lines = uniq(list.map((c) => c.target.source?.line ?? null));
|
|
119
|
+
if (file) {
|
|
120
|
+
const loc = lines.length === 1 ? location(file, lines[0], true) : file;
|
|
121
|
+
out.push(`## ${loc}${headed ? ` \xB7 ${headed}` : ""}`);
|
|
122
|
+
} else {
|
|
123
|
+
out.push("## Elements without source info");
|
|
124
|
+
}
|
|
125
|
+
for (const c of list) {
|
|
126
|
+
n += 1;
|
|
127
|
+
out.push(...detailBlock(c, n, ctx, !!file && lines.length > 1, headed));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return out.join("\n");
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
authorLabel,
|
|
134
|
+
estimateTokens,
|
|
135
|
+
formatExport
|
|
136
|
+
};
|
|
137
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/capture/export.ts"],"sourcesContent":["import type { GrabbyComment, DetailLevel, CommentAuthor } from '../types';\n\nexport interface ExportEnv {\n /** Page origin shown in the header, e.g. \"localhost:4200\". */\n origin?: string;\n now?: Date;\n /** Print each comment's id, so an agent can act on it (e.g. resolve it). */\n showIds?: boolean;\n}\n\n/** Rough token count (≈4 characters per token), for the Copy dialog. */\nexport function estimateTokens(text: string): number {\n return Math.ceil(text.length / 4);\n}\n\nconst STYLE_FACTS = new Set(['styles', 'layout', 'computed']);\n/** Facts that are often already visible in the preview; skipped when they are. */\nconst PREVIEW_FACTS = new Set(['label', 'type', 'text', 'href', 'placeholder', 'alt', 'src', 'title']);\n\nfunction inPreview(preview: string, value: string): boolean {\n return value.length > 0 && (preview.includes(`>${value}<`) || preview.includes(`\"${value}\"`) || preview.includes(`>${value}`));\n}\n\nfunction authorKey(a: CommentAuthor): string {\n return a.anonymous || !a.name ? `anon:${a.sessionId}` : `name:${a.name}`;\n}\n\nexport function authorLabel(a: CommentAuthor): string {\n if (!a.anonymous && a.name) return a.name;\n return `Anonymous ${a.sessionId.replace(/-/g, '').slice(0, 4)}`;\n}\n\nfunction basename(path: string): string {\n return path.split(/[\\\\/]/).pop() ?? path;\n}\n\nfunction location(file: string, line: number | null, full: boolean): string {\n const name = full ? file : basename(file);\n return line != null ? `${name}:${line}` : name;\n}\n\nfunction indent(text: string, pad: string): string {\n return text.split('\\n').map((l, i) => (i === 0 ? l : `${pad}${l}`)).join('\\n');\n}\n\nfunction uniq<T>(values: T[]): T[] {\n return Array.from(new Set(values));\n}\n\ninterface Context {\n showAuthors: boolean;\n showRoutes: boolean;\n showIds: boolean;\n level: DetailLevel;\n}\n\nfunction header(comments: GrabbyComment[], env: ExportEnv, ctx: Context): string[] {\n const n = comments.length;\n const lines = [`# UI feedback · ${n} comment${n === 1 ? '' : 's'}`];\n const meta: string[] = [];\n if (env.origin) meta.push(env.origin);\n const frameworks = uniq(comments.map((c) => c.framework).filter(Boolean));\n if (frameworks.length) meta.push(frameworks.join(', '));\n const routes = uniq(comments.map((c) => c.page.route));\n if (!ctx.showRoutes && routes.length === 1) meta.push(`page ${routes[0]}`);\n const vp = comments[0]?.page.viewport;\n if (vp) meta.push(`${vp[0]}×${vp[1]}`);\n meta.push((env.now ?? new Date()).toISOString().slice(0, 10));\n lines.push(meta.join(' · '));\n if (ctx.showAuthors) {\n const people = uniq(comments.map((c) => authorLabel(c.author)));\n lines.push(`From: ${people.join(', ')}`);\n }\n return lines;\n}\n\nfunction compactLine(c: GrabbyComment, i: number, ctx: Context): string {\n const t = c.target;\n const where = t.source ? location(t.source.file, t.source.line, true) : t.selector;\n const parts = [where, t.component, `<${t.tag}>`].filter(Boolean).join(' ');\n const who = ctx.showAuthors ? ` (${authorLabel(c.author)})` : '';\n const route = ctx.showRoutes ? ` [${c.page.route}]` : '';\n const id = ctx.showIds ? ` [id ${c.id}]` : '';\n return `${i}. ${parts}${route} — ${indent(c.comment, ' ')}${who}${id}`;\n}\n\nfunction detailBlock(c: GrabbyComment, i: number, ctx: Context, groupHasSource: boolean, headedComponent: string | null): string[] {\n const t = c.target;\n const full = ctx.level === 'detailed';\n const lines = [`${i}. ${indent(c.comment, ' ')}`];\n const b = (text: string) => lines.push(` - ${text}`);\n\n const where: string[] = [`\\`${t.preview}\\``, `(${t.kind})`];\n if (t.component && t.component !== headedComponent) {\n where.push(t.source?.line != null && groupHasSource ? `${t.component} line ${t.source.line}` : t.component);\n } else if (t.source?.line != null && groupHasSource) {\n where.push(`line ${t.source.line}`);\n }\n b(where.join(' '));\n\n // A selector is only worth tokens when there's no file to point at.\n if (!t.source || full) b(`selector: \\`${t.selector}\\``);\n\n const plain = Object.entries(t.facts)\n .filter(([k, v]) => !STYLE_FACTS.has(k) && !(PREVIEW_FACTS.has(k) && !full && inPreview(t.preview, v)));\n if (plain.length) b(plain.map(([k, v]) => `${k}: ${v}`).join(' · '));\n for (const [k, v] of Object.entries(t.facts)) if (STYLE_FACTS.has(k)) b(`${k}: ${v}`);\n\n // The first frame is the element's own component; it's already named above.\n const parents = t.stack.filter((f, i) => !(i === 0 && (t.source || f.name === t.component)));\n if (parents.length) {\n b(`inside: ${parents.map((f) => (f.file ? `${f.name} (${location(f.file, f.line, full)})` : f.name)).join(' › ')}`);\n }\n\n if (full) {\n for (const [k, v] of Object.entries(t.extra)) b(`${k}: ${v}`);\n b(`viewport: ${c.page.viewport[0]}×${c.page.viewport[1]}`);\n }\n\n if (c.screenshot?.url) b(`screenshot: ${c.screenshot.url}`);\n\n const meta: string[] = [];\n if (ctx.showAuthors) meta.push(`by ${authorLabel(c.author)}`);\n if (ctx.showRoutes) meta.push(`on ${c.page.route}`);\n if (meta.length) b(meta.join(' '));\n if (ctx.showIds) b(`id: ${c.id}`);\n return lines;\n}\n\n/**\n * Turns comments into text for an AI agent. Page-level context is said once\n * in the header, comments are grouped by the file they point at, and only the\n * facts that matter for each element's kind are included.\n */\nexport function formatExport(comments: GrabbyComment[], level: DetailLevel = 'standard', env: ExportEnv = {}): string {\n if (comments.length === 0) return '';\n const ordered = [...comments].sort((a, b) => a.createdAt - b.createdAt);\n const authors = uniq(ordered.map((c) => authorKey(c.author)));\n const ctx: Context = {\n level,\n showIds: env.showIds === true,\n showAuthors: authors.length > 1 || ordered.some((c) => !c.author.anonymous && !!c.author.name),\n showRoutes: uniq(ordered.map((c) => c.page.route)).length > 1,\n };\n\n const out = header(ordered, env, ctx);\n\n if (level === 'compact') {\n out.push('');\n ordered.forEach((c, idx) => out.push(compactLine(c, idx + 1, ctx)));\n return out.join('\\n');\n }\n\n // Group by file so an agent handles each file once; keep first-seen order.\n const groups = new Map<string, GrabbyComment[]>();\n for (const c of ordered) {\n const key = c.target.source?.file ?? '';\n const list = groups.get(key);\n if (list) list.push(c);\n else groups.set(key, [c]);\n }\n\n let n = 0;\n for (const [file, list] of groups) {\n out.push('');\n const components = uniq(list.map((c) => c.target.component));\n const headed = file && components.length === 1 ? components[0] : null;\n const lines = uniq(list.map((c) => c.target.source?.line ?? null));\n if (file) {\n const loc = lines.length === 1 ? location(file, lines[0], true) : file;\n out.push(`## ${loc}${headed ? ` · ${headed}` : ''}`);\n } else {\n out.push('## Elements without source info');\n }\n for (const c of list) {\n n += 1;\n out.push(...detailBlock(c, n, ctx, !!file && lines.length > 1, headed));\n }\n }\n return out.join('\\n');\n}\n"],"mappings":";AAWO,SAAS,eAAe,MAAsB;AACnD,SAAO,KAAK,KAAK,KAAK,SAAS,CAAC;AAClC;AAEA,IAAM,cAAc,oBAAI,IAAI,CAAC,UAAU,UAAU,UAAU,CAAC;AAE5D,IAAM,gBAAgB,oBAAI,IAAI,CAAC,SAAS,QAAQ,QAAQ,QAAQ,eAAe,OAAO,OAAO,OAAO,CAAC;AAErG,SAAS,UAAU,SAAiB,OAAwB;AAC1D,SAAO,MAAM,SAAS,MAAM,QAAQ,SAAS,IAAI,KAAK,GAAG,KAAK,QAAQ,SAAS,IAAI,KAAK,GAAG,KAAK,QAAQ,SAAS,IAAI,KAAK,EAAE;AAC9H;AAEA,SAAS,UAAU,GAA0B;AAC3C,SAAO,EAAE,aAAa,CAAC,EAAE,OAAO,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,IAAI;AACxE;AAEO,SAAS,YAAY,GAA0B;AACpD,MAAI,CAAC,EAA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