deictic 0.3.0 → 0.4.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/API.md +31 -19
- package/README.md +6 -26
- package/dist/annotations/client.d.ts +1 -1
- package/dist/annotations/client.js +1 -1
- package/dist/annotations/index.d.ts +2 -101
- package/dist/annotations/index.js +1 -22
- package/dist/astro.d.ts +1 -1
- package/dist/astro.js +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +37 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.js +1 -10
- package/dist/logs/client.d.ts +1 -1
- package/dist/logs/client.js +1 -1
- package/dist/logs/index.d.ts +2 -18
- package/dist/logs/index.js +1 -21
- package/dist/network/client.d.ts +1 -1
- package/dist/network/client.js +1 -1
- package/dist/network/index.d.ts +1 -1
- package/dist/network/index.js +1 -37
- package/dist/recommended/index.d.ts +7 -7
- package/dist/recommended/index.js +1 -26
- package/dist/recordings/client.d.ts +1 -1
- package/dist/recordings/client.js +1 -1
- package/dist/recordings/index.d.ts +1 -1
- package/dist/screenshots/client.d.ts +1 -1
- package/dist/screenshots/client.js +1 -108
- package/dist/screenshots/dom.d.ts +1 -1
- package/dist/screenshots/dom.js +1 -1
- package/dist/screenshots/index.d.ts +1 -1
- package/dist/screenshots/index.js +1 -98
- package/dist/screenshots/rrweb.d.ts +2 -1
- package/dist/screenshots/rrweb.d.ts.map +1 -1
- package/dist/screenshots/rrweb.js +6 -2
- package/dist/screenshots/rrweb.js.map +1 -1
- package/dist/shared/annotations.js +22 -0
- package/dist/shared/annotations.js.map +1 -0
- package/dist/shared/board.js +190 -0
- package/dist/shared/board.js.map +1 -0
- package/dist/shared/client.js +108 -0
- package/dist/{screenshots → shared}/client.js.map +1 -1
- package/dist/shared/endpoints.js +4 -1
- package/dist/shared/endpoints.js.map +1 -1
- package/dist/shared/find.js +156 -0
- package/dist/shared/find.js.map +1 -0
- package/dist/shared/frame.js +75 -0
- package/dist/shared/frame.js.map +1 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index2.d.ts +85 -84
- package/dist/shared/index2.d.ts.map +1 -1
- package/dist/shared/index3.d.ts +83 -89
- package/dist/shared/index3.d.ts.map +1 -1
- package/dist/shared/index4.d.ts +98 -50
- package/dist/shared/index4.d.ts.map +1 -1
- package/dist/shared/index5.d.ts +13 -215
- package/dist/shared/index5.d.ts.map +1 -1
- package/dist/shared/index6.d.ts +55 -61
- package/dist/shared/index6.d.ts.map +1 -1
- package/dist/shared/index7.d.ts +224 -0
- package/dist/shared/index7.d.ts.map +1 -0
- package/dist/shared/index8.d.ts +52 -0
- package/dist/shared/index8.d.ts.map +1 -0
- package/dist/shared/index9.d.ts +70 -0
- package/dist/shared/index9.d.ts.map +1 -0
- package/dist/shared/init.js +472 -0
- package/dist/shared/init.js.map +1 -0
- package/dist/shared/local.js +165 -0
- package/dist/shared/local.js.map +1 -0
- package/dist/shared/logs.js +22 -0
- package/dist/shared/logs.js.map +1 -0
- package/dist/shared/network.js +39 -0
- package/dist/shared/network.js.map +1 -0
- package/dist/shared/packages.js +125 -0
- package/dist/shared/packages.js.map +1 -0
- package/dist/shared/playwright.js +36 -9
- package/dist/shared/playwright.js.map +1 -1
- package/dist/shared/recommended.js +26 -0
- package/dist/shared/recommended.js.map +1 -0
- package/dist/shared/recording.js +316 -0
- package/dist/shared/recording.js.map +1 -0
- package/dist/shared/recordings.js +2 -1
- package/dist/shared/recordings.js.map +1 -1
- package/dist/shared/screenshots.js +108 -0
- package/dist/shared/screenshots.js.map +1 -0
- package/dist/shared/src.js +10 -0
- package/dist/shared/src.js.map +1 -0
- package/dist/shared/task.js +108 -0
- package/dist/shared/task.js.map +1 -0
- package/dist/shared/tasks.js +33 -191
- package/dist/shared/tasks.js.map +1 -1
- package/dist/shared/transcribe.js +128 -0
- package/dist/shared/transcribe.js.map +1 -0
- package/dist/shared/vb.js +13 -0
- package/dist/shared/vb.js.map +1 -0
- package/dist/shared/vite.d.ts +16 -0
- package/dist/shared/vite.d.ts.map +1 -0
- package/dist/shared/vite.js +61 -0
- package/dist/shared/vite.js.map +1 -0
- package/dist/shared/voice.js +84 -0
- package/dist/{voice/index.js.map → shared/voice.js.map} +1 -1
- package/dist/shared/voice2.js +90 -0
- package/dist/shared/voice2.js.map +1 -0
- package/dist/shared/watch.js +209 -0
- package/dist/shared/watch.js.map +1 -0
- package/dist/shared/watchers.js +62 -0
- package/dist/shared/watchers.js.map +1 -0
- package/dist/tailwind/client.d.ts +1 -1
- package/dist/tailwind/client.js +1 -1
- package/dist/tailwind/index.d.ts +1 -1
- package/dist/tailwind/index.js +1 -1
- package/dist/tasks/client.d.ts +1 -1
- package/dist/tasks/client.d.ts.map +1 -1
- package/dist/tasks/client.js +45 -8
- package/dist/tasks/client.js.map +1 -1
- package/dist/tasks/index.d.ts +1 -1
- package/dist/tasks/index.js +3 -1
- package/dist/vite.d.ts +2 -15
- package/dist/vite.js +2 -60
- package/dist/voice/client.d.ts +1 -1
- package/dist/voice/client.js +1 -1
- package/dist/voice/index.d.ts +2 -52
- package/dist/voice/index.js +1 -84
- package/package.json +6 -9
- package/skills/deictic/SKILL.md +27 -42
- package/skills/deictic/references/recordings.md +9 -108
- package/skills/deictic/references/tasks.md +21 -107
- package/skills/deictic/references/watch.md +13 -66
- package/src/cli/board.ts +204 -0
- package/src/cli/bun.ts +133 -0
- package/src/cli/edit.ts +56 -0
- package/src/cli/find.ts +147 -0
- package/src/cli/frame.ts +90 -0
- package/src/cli/init.ts +388 -0
- package/src/cli/recording.ts +383 -0
- package/src/cli/task.ts +126 -0
- package/src/cli/transcribe.ts +129 -0
- package/src/cli/vb.ts +11 -0
- package/src/cli/voice.ts +59 -0
- package/src/cli/watch.ts +221 -0
- package/src/cli.ts +37 -0
- package/src/index.ts +5 -0
- package/src/plugins/logs/index.ts +1 -0
- package/src/plugins/network/index.ts +1 -0
- package/src/plugins/recordings/index.ts +1 -0
- package/src/plugins/screenshots/client.ts +3 -2
- package/src/plugins/screenshots/index.ts +10 -3
- package/src/plugins/screenshots/playwright.ts +34 -7
- package/src/plugins/screenshots/rrweb.ts +5 -1
- package/src/plugins/tasks/client.ts +62 -7
- package/src/plugins/tasks/index.ts +41 -20
- package/src/plugins/tasks/local.ts +19 -6
- package/src/plugins/tasks/watchers.ts +41 -6
- package/src/tools/endpoints.ts +3 -0
- package/src/tools/packages.ts +107 -0
- package/dist/annotations/index.d.ts.map +0 -1
- package/dist/annotations/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logs/index.d.ts.map +0 -1
- package/dist/logs/index.js.map +0 -1
- package/dist/network/index.js.map +0 -1
- package/dist/recommended/index.js.map +0 -1
- package/dist/screenshots/index.js.map +0 -1
- package/dist/vite.d.ts.map +0 -1
- package/dist/vite.js.map +0 -1
- package/dist/voice/index.d.ts.map +0 -1
- package/skills/deictic/references/install.md +0 -103
- package/skills/deictic/scripts/frame.mjs +0 -62
- package/skills/deictic/scripts/lib.mjs +0 -277
- package/skills/deictic/scripts/recording.mjs +0 -266
- package/skills/deictic/scripts/task.mjs +0 -113
- package/skills/deictic/scripts/transcribe.mjs +0 -93
- package/skills/deictic/scripts/vb.mjs +0 -12
- package/skills/deictic/scripts/voice.mjs +0 -50
- package/skills/deictic/scripts/watch.mjs +0 -115
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { w as Shortcut } from "./index.js";
|
|
2
|
+
/** A class as the panel shows it. */
|
|
3
|
+
interface ClassInfo {
|
|
4
|
+
name: string;
|
|
5
|
+
/** Whether Tailwind makes anything of it: a class of the project's own isn't known. */
|
|
6
|
+
known: boolean;
|
|
7
|
+
/** The colour it sets, as CSS. */
|
|
8
|
+
color?: string;
|
|
9
|
+
/** What it sets its main property to, theme values resolved: `0.875rem`. */
|
|
10
|
+
value?: string;
|
|
11
|
+
/** A variant to go on typing after (`hover:`), not a class. */
|
|
12
|
+
variant?: true;
|
|
13
|
+
}
|
|
14
|
+
/** The classes of one kind, and how to write one with a value of the user's own. */
|
|
15
|
+
interface Alternatives {
|
|
16
|
+
/** The property the kind sets: `font-size`. */
|
|
17
|
+
label: string;
|
|
18
|
+
/** Whether the kind is a colour's, shown as swatches. */
|
|
19
|
+
colors: boolean;
|
|
20
|
+
items: ClassInfo[];
|
|
21
|
+
/** A custom value goes between these: `md:text-[` and `]`. None for a kind that takes no value (`flex`). */
|
|
22
|
+
custom?: {
|
|
23
|
+
before: string;
|
|
24
|
+
after: string;
|
|
25
|
+
value?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface TailwindOptions {
|
|
29
|
+
/** Calls whose first argument is a class list: `cn`, `clsx`, `cx`, `twMerge`, `classNames` by default. */
|
|
30
|
+
helpers?: string[];
|
|
31
|
+
/** The attribute an element without one gets: `className`, or `class` for Solid and Preact. */
|
|
32
|
+
attribute?: 'className' | 'class';
|
|
33
|
+
/**
|
|
34
|
+
* The stylesheet that imports Tailwind and holds the theme, from the project's root: `src/index.css`. What
|
|
35
|
+
* the panel completes and shows comes from it. Tailwind's default theme without one.
|
|
36
|
+
*/
|
|
37
|
+
css?: string;
|
|
38
|
+
/** What opens its tab directly, beside deictic's own shortcut, which opens any: none by default. */
|
|
39
|
+
shortcut?: Shortcut;
|
|
40
|
+
}
|
|
41
|
+
type Model = {
|
|
42
|
+
editable: true;
|
|
43
|
+
classes: string;
|
|
44
|
+
/** The helper's other arguments, which add classes at runtime, each read as far as the source says. */
|
|
45
|
+
others?: Extra[];
|
|
46
|
+
} | {
|
|
47
|
+
editable: false;
|
|
48
|
+
source: string;
|
|
49
|
+
};
|
|
50
|
+
/** Classes a helper's argument adds: `active && 'ring'` is `ring` when `active`. */
|
|
51
|
+
interface Extra {
|
|
52
|
+
/** The argument, or the part of it these classes come from, as written. */
|
|
53
|
+
source: string;
|
|
54
|
+
/** The classes, where the source spells them out: there, or in a `const` of the file it names. */
|
|
55
|
+
classes?: string;
|
|
56
|
+
/** What must hold for them to be added, as written: `active === 'h3'`. None where they always are. */
|
|
57
|
+
when?: string;
|
|
58
|
+
/** Set where the classes are a string in this file, which an op with `at` can write. */
|
|
59
|
+
editable?: true;
|
|
60
|
+
/** The `const` the string is in, where it isn't the argument itself: other elements may use it too. */
|
|
61
|
+
shared?: string;
|
|
62
|
+
}
|
|
63
|
+
interface Op {
|
|
64
|
+
classes: string;
|
|
65
|
+
/** Which of the model's `others` the classes are for, by its place there. The element's own list without. */
|
|
66
|
+
at?: number;
|
|
67
|
+
}
|
|
68
|
+
declare function tailwind(options?: TailwindOptions): import("deictic").ServerPlugin<Model, Op, unknown, unknown>;
|
|
69
|
+
export { tailwind as a, TailwindOptions as i, Model as n, Alternatives as o, Op as r, ClassInfo as s, Extra as t };
|
|
70
|
+
//# sourceMappingURL=index9.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index9.d.ts","names":[],"sources":["../../src/plugins/tailwind/catalog.ts","../../src/plugins/tailwind/index.ts"],"mappings":";;UAeiB;EACf;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIe;;EAEf;;EAEA;EACA,OAAO;;EAEP;IAAW;IAAgB;IAAe;;;UCf3B;;EAEf;;EAEA;;;;;EAKA;;EAEA,WAAW;;KAGD;EAEN;EACA;;EAEA,SAAS;;EAET;EAAiB;;;UAGN;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;UAGe;EACf;;EAEA;;iBASc,SAAS,UAAS,oCAAoB,aAAA,OAAA"}
|
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join, relative } from "node:path";
|
|
4
|
+
import { createInterface } from "node:readline/promises";
|
|
5
|
+
import MagicString from "magic-string";
|
|
6
|
+
import { Visitor, parseSync } from "oxc-parser";
|
|
7
|
+
import { t as recommended } from "./recommended.js";
|
|
8
|
+
import { a as runnerOf, i as readJson, r as packageManager, t as installCommand } from "./packages.js";
|
|
9
|
+
import { l as fail, u as parseArgs } from "./board.js";
|
|
10
|
+
// src/cli/edit.ts
|
|
11
|
+
/** The file's line ending. */
|
|
12
|
+
const eolOf = (code) => code.includes("\r\n") ? "\r\n" : "\n";
|
|
13
|
+
/** The whitespace a line starts with, for the line `offset` is on. */
|
|
14
|
+
function indentAt(code, offset) {
|
|
15
|
+
const start = code.lastIndexOf("\n", offset - 1) + 1;
|
|
16
|
+
return /^[ \t]*/.exec(code.slice(start))[0];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Adds import lines after the module's last import (or `require`, in CommonJS), or at its top: written in the quotes
|
|
20
|
+
* and semicolons of its first import. Each line is `[what, from]`: `import ${what} from '${from}'`, or as a `require`.
|
|
21
|
+
*/
|
|
22
|
+
function addImports(out, program, code, lines, commonjs = false) {
|
|
23
|
+
const eol = eolOf(code);
|
|
24
|
+
const imports = program.body.filter((s) => s.type === "ImportDeclaration");
|
|
25
|
+
const first = imports[0];
|
|
26
|
+
const quote = first === void 0 ? "'" : code[first.source.start];
|
|
27
|
+
const semi = first === void 0 || code.slice(first.start, first.end).trimEnd().endsWith(";") ? ";" : "";
|
|
28
|
+
const q = (s) => `${quote}${s}${quote}`;
|
|
29
|
+
const text = lines.map(([what, from]) => commonjs ? `const ${what} = require(${q(from)})${semi}` : `import ${what} from ${q(from)}${semi}`).join(eol);
|
|
30
|
+
const after = imports.at(-1) ?? requiresOf(program).at(-1);
|
|
31
|
+
if (after === void 0) out.prepend(`${text}${eol}${eol}`);
|
|
32
|
+
else out.appendLeft(after.end, `${eol}${text}`);
|
|
33
|
+
}
|
|
34
|
+
/** The top-level `const … = require(…)` statements of a CommonJS module, to put new ones after. */
|
|
35
|
+
function requiresOf(program) {
|
|
36
|
+
return program.body.filter((s) => s.type === "VariableDeclaration" && s.declarations.some((d) => d.init?.type === "CallExpression" && d.init.callee.type === "Identifier" && d.init.callee.name === "require"));
|
|
37
|
+
}
|
|
38
|
+
/** Inserts `text` as the first property of the object literal that starts at `open` (its `{`), as the object is laid out. */
|
|
39
|
+
function addFirst(out, code, open, first, text) {
|
|
40
|
+
const eol = eolOf(code);
|
|
41
|
+
if (first === void 0) {
|
|
42
|
+
out.appendLeft(open + 1, ` ${text} `);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const multiline = code.slice(open, first.start).includes("\n");
|
|
46
|
+
out.appendLeft(first.start, multiline ? `${text},${eol}${indentAt(code, first.start)}` : `${text}, `);
|
|
47
|
+
}
|
|
48
|
+
// src/cli/bun.ts
|
|
49
|
+
/**
|
|
50
|
+
* `init` for Bun's own dev server: `Bun.serve` with HTML imports, which bundles the page with the plugins bunfig.toml
|
|
51
|
+
* names. Only that: a Bun project that runs Vite, Next.js or another bundler is that bundler's, and one with no HTML
|
|
52
|
+
* imports has no page of Bun's for deictic to be in. Three steps, as the API has them: the plugin's module, bunfig's
|
|
53
|
+
* `[serve.static] plugins`, and its routes spread into `Bun.serve`'s.
|
|
54
|
+
*/
|
|
55
|
+
/** The plugin's module, from the root, which bunfig names and the server imports. */
|
|
56
|
+
const MODULE = "deictic.plugin.ts";
|
|
57
|
+
const PLUGIN = `import { deictic } from 'deictic/bun';
|
|
58
|
+
import { recommended } from 'deictic/recommended';
|
|
59
|
+
|
|
60
|
+
// One module for both: bunfig.toml names it as the dev server's bundler plugin, and the server spreads its routes,
|
|
61
|
+
// deictic's endpoints, into its own.
|
|
62
|
+
export default deictic({ plugins: recommended() });
|
|
63
|
+
`;
|
|
64
|
+
const SOURCE = /\.[cm]?[jt]sx?$/;
|
|
65
|
+
const SKIP = /* @__PURE__ */ new Set([
|
|
66
|
+
"node_modules",
|
|
67
|
+
"dist",
|
|
68
|
+
"build",
|
|
69
|
+
"out"
|
|
70
|
+
]);
|
|
71
|
+
const SERVE = /\bBun\.serve\s*\(/;
|
|
72
|
+
const HTML = /\bfrom\s*['"][^'"]+\.html['"]/;
|
|
73
|
+
/**
|
|
74
|
+
* The module that serves the page with Bun's bundler: it calls `Bun.serve` and imports an HTML file. Looked for under
|
|
75
|
+
* the root, not in dependencies, builds or dot folders, a few folders deep.
|
|
76
|
+
*/
|
|
77
|
+
function serverOf(root) {
|
|
78
|
+
const walk = (dir, depth) => {
|
|
79
|
+
let entries;
|
|
80
|
+
try {
|
|
81
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
82
|
+
} catch {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
for (const e of entries) {
|
|
86
|
+
if (!e.isFile() || !SOURCE.test(e.name)) continue;
|
|
87
|
+
const path = join(dir, e.name);
|
|
88
|
+
const code = readFileSync(path, "utf8");
|
|
89
|
+
if (SERVE.test(code) && HTML.test(code)) return path;
|
|
90
|
+
}
|
|
91
|
+
if (depth === 0) return void 0;
|
|
92
|
+
for (const e of entries) {
|
|
93
|
+
if (!e.isDirectory() || e.name.startsWith(".") || SKIP.has(e.name)) continue;
|
|
94
|
+
const found = walk(join(dir, e.name), depth - 1);
|
|
95
|
+
if (found !== void 0) return found;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
return walk(root, 3);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* bunfig.toml with the plugin's module first in `[serve.static] plugins` (first, so it sees the source as written),
|
|
102
|
+
* made where there's none; unchanged where it's there already, and nothing where bunfig says it another way (a dotted
|
|
103
|
+
* key, an inline table) and it can't tell where.
|
|
104
|
+
*/
|
|
105
|
+
function addToBunfig(text, entry = `./${MODULE}`) {
|
|
106
|
+
const quoted = JSON.stringify(entry);
|
|
107
|
+
if (text === void 0) return `[serve.static]\nplugins = [${quoted}]\n`;
|
|
108
|
+
if (text.includes(entry)) return text;
|
|
109
|
+
if (/serve\.static\.|static\s*=\s*\{/.test(text)) return void 0;
|
|
110
|
+
const eol = eolOf(text);
|
|
111
|
+
const header = /^[ \t]*\[serve\.static\][ \t]*(#.*)?$/m.exec(text);
|
|
112
|
+
if (header === null) return `${text}${text === "" || text.endsWith("\n") ? "" : eol}${eol}[serve.static]${eol}plugins = [${quoted}]${eol}`;
|
|
113
|
+
const bodyStart = header.index + header[0].length;
|
|
114
|
+
const next = /^[ \t]*\[/m.exec(text.slice(bodyStart));
|
|
115
|
+
const body = text.slice(bodyStart, next === null ? text.length : bodyStart + next.index);
|
|
116
|
+
const list = /^[ \t]*plugins[ \t]*=[ \t]*\[/m.exec(body);
|
|
117
|
+
if (list === null) return `${text.slice(0, bodyStart)}${eol}plugins = [${quoted}]${text.slice(bodyStart)}`;
|
|
118
|
+
const open = bodyStart + list.index + list[0].length;
|
|
119
|
+
const rest = text.slice(open);
|
|
120
|
+
const empty = /^\s*\]/.test(rest);
|
|
121
|
+
const lineBreak = /^[ \t]*\r?\n([ \t]*)/.exec(rest);
|
|
122
|
+
if (empty) return `${text.slice(0, open)}${quoted}${rest.trimStart()}`;
|
|
123
|
+
if (lineBreak !== null) return `${text.slice(0, open)}${eol}${lineBreak[1]}${quoted},${rest}`;
|
|
124
|
+
return `${text.slice(0, open)}${quoted}, ${rest.trimStart()}`;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The server with the plugin's routes first in `Bun.serve`'s `routes`, or `routes` with them where it has none, and
|
|
128
|
+
* the module imported: nothing where `Bun.serve` isn't given an object it can see, or its routes aren't one.
|
|
129
|
+
*/
|
|
130
|
+
function addToServer(file, code, root) {
|
|
131
|
+
const { program, errors } = parseSync(file, code, { preserveParens: false });
|
|
132
|
+
if (errors.length > 0) return void 0;
|
|
133
|
+
const calls = [];
|
|
134
|
+
new Visitor({ CallExpression(node) {
|
|
135
|
+
const { callee } = node;
|
|
136
|
+
if (callee.type === "MemberExpression" && callee.object.type === "Identifier" && callee.object.name === "Bun" && callee.property.type === "Identifier" && callee.property.name === "serve") calls.push(node);
|
|
137
|
+
} }).visit(program);
|
|
138
|
+
const options = calls.length === 1 ? calls[0].arguments[0] : void 0;
|
|
139
|
+
if (options?.type !== "ObjectExpression") return void 0;
|
|
140
|
+
const name = /\btools\b/.test(code) ? "deicticTools" : "tools";
|
|
141
|
+
const out = new MagicString(code);
|
|
142
|
+
const routes = options.properties.find((p) => p.type === "Property" && !p.computed && p.key.type === "Identifier" && p.key.name === "routes");
|
|
143
|
+
if (routes === void 0) addFirst(out, code, options.start, options.properties[0], `routes: { ...${name}.routes }`);
|
|
144
|
+
else {
|
|
145
|
+
if (routes.type !== "Property" || routes.value.type !== "ObjectExpression") return void 0;
|
|
146
|
+
addFirst(out, code, routes.value.start, routes.value.properties[0], `...${name}.routes`);
|
|
147
|
+
}
|
|
148
|
+
const from = relative(dirname(file), join(root, MODULE)).replaceAll("\\", "/");
|
|
149
|
+
addImports(out, program, code, [[name, from.startsWith(".") ? from : `./${from}`]]);
|
|
150
|
+
return out.toString();
|
|
151
|
+
}
|
|
152
|
+
/** What to add by hand, for a server or a bunfig it can't edit. */
|
|
153
|
+
const BY_HAND = {
|
|
154
|
+
bunfig: `[serve.static]\nplugins = ["./${MODULE}"]`,
|
|
155
|
+
server: `import tools from './${MODULE}';\nBun.serve({ routes: { ...tools.routes, '/*': index } });`
|
|
156
|
+
};
|
|
157
|
+
// src/cli/init.ts
|
|
158
|
+
/**
|
|
159
|
+
* `deictic init`: the recommended setup in a project, in one step. It installs deictic and what the recommended
|
|
160
|
+
* plugins import, with the project's package manager and as the project's own dev dependencies (deictic, the
|
|
161
|
+
* page's bundle and the skill all find them from the project, so they can't come in through another package), adds
|
|
162
|
+
* deictic to the bundler's config where it can find the place, and offers the agent skill.
|
|
163
|
+
*/
|
|
164
|
+
const extensions = (base) => [
|
|
165
|
+
"ts",
|
|
166
|
+
"mts",
|
|
167
|
+
"js",
|
|
168
|
+
"mjs",
|
|
169
|
+
"cts",
|
|
170
|
+
"cjs"
|
|
171
|
+
].map((e) => `${base}.${e}`);
|
|
172
|
+
const PLUGINS = "{ plugins: recommended() }";
|
|
173
|
+
const SETUPS = {
|
|
174
|
+
next: {
|
|
175
|
+
files: extensions("next.config"),
|
|
176
|
+
from: "deictic/next",
|
|
177
|
+
name: "withDeictic",
|
|
178
|
+
value: PLUGINS,
|
|
179
|
+
wrap: true,
|
|
180
|
+
snippet: `export default withDeictic(nextConfig, ${PLUGINS});`
|
|
181
|
+
},
|
|
182
|
+
astro: {
|
|
183
|
+
files: extensions("astro.config"),
|
|
184
|
+
from: "deictic/astro",
|
|
185
|
+
name: "deictic",
|
|
186
|
+
list: "integrations",
|
|
187
|
+
value: `deictic(${PLUGINS})`,
|
|
188
|
+
snippet: `export default defineConfig({ integrations: [deictic(${PLUGINS})] });`
|
|
189
|
+
},
|
|
190
|
+
vite: {
|
|
191
|
+
files: extensions("vite.config"),
|
|
192
|
+
from: "deictic/vite",
|
|
193
|
+
name: "deictic",
|
|
194
|
+
list: "plugins",
|
|
195
|
+
value: `deictic(${PLUGINS})`,
|
|
196
|
+
snippet: `export default defineConfig({ plugins: [react(), deictic(${PLUGINS})] });`
|
|
197
|
+
},
|
|
198
|
+
rspack: {
|
|
199
|
+
files: extensions("rspack.config"),
|
|
200
|
+
from: "deictic/webpack",
|
|
201
|
+
name: "DeicticPlugin",
|
|
202
|
+
list: "plugins",
|
|
203
|
+
value: `new DeicticPlugin(${PLUGINS})`,
|
|
204
|
+
snippet: `export default { plugins: [new DeicticPlugin(${PLUGINS})] };`
|
|
205
|
+
},
|
|
206
|
+
webpack: {
|
|
207
|
+
files: extensions("webpack.config"),
|
|
208
|
+
from: "deictic/webpack",
|
|
209
|
+
name: "DeicticPlugin",
|
|
210
|
+
list: "plugins",
|
|
211
|
+
value: `new DeicticPlugin(${PLUGINS})`,
|
|
212
|
+
snippet: `export default { plugins: [new DeicticPlugin(${PLUGINS})] };`
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
/** The project's root: the nearest folder with a package.json, from `dir` up. */
|
|
216
|
+
function rootOf(dir) {
|
|
217
|
+
for (let at = dir;; at = dirname(at)) {
|
|
218
|
+
if (existsSync(join(at, "package.json"))) return at;
|
|
219
|
+
if (dirname(at) === at) return void 0;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/** The project's dependencies and dev dependencies, by name. */
|
|
223
|
+
function dependenciesOf(root) {
|
|
224
|
+
const manifest = readJson(join(root, "package.json")) ?? {};
|
|
225
|
+
return new Set([manifest.dependencies, manifest.devDependencies].flatMap((d) => Object.keys(d ?? {})));
|
|
226
|
+
}
|
|
227
|
+
/** The bundler the project runs its dev server with, from its dependencies, or none deictic knows. */
|
|
228
|
+
function bundlerOf(root) {
|
|
229
|
+
const has = dependenciesOf(root);
|
|
230
|
+
if (has.has("next")) return "next";
|
|
231
|
+
if (has.has("astro")) return "astro";
|
|
232
|
+
if (has.has("vite") || SETUPS.vite.files.some((f) => existsSync(join(root, f)))) return "vite";
|
|
233
|
+
if (has.has("@rspack/core") || has.has("@rspack/cli")) return "rspack";
|
|
234
|
+
if (has.has("webpack")) return "webpack";
|
|
235
|
+
if (serverOf(root) !== void 0) return "bun";
|
|
236
|
+
}
|
|
237
|
+
/** What the recommended setup imports, for the bundler: launch-editor opens files under webpack, which has no launcher. */
|
|
238
|
+
function packagesFor(bundler) {
|
|
239
|
+
return [
|
|
240
|
+
"deictic",
|
|
241
|
+
...recommended().flatMap((p) => p.packages ?? []),
|
|
242
|
+
...bundler === "webpack" || bundler === "rspack" ? ["launch-editor"] : []
|
|
243
|
+
];
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The object an expression comes to: through `defineConfig(…)`, `(…)`, `satisfies`, a function's return and a top-level
|
|
247
|
+
* `const`. Not through another call: in `mergeConfig(base, {…})` or webpack-merge's `merge(common, {…})` the first
|
|
248
|
+
* argument is a base the project may build with too, and the plugin isn't the base's.
|
|
249
|
+
*/
|
|
250
|
+
function objectOf(node, program, depth = 0) {
|
|
251
|
+
if (node == null || depth > 8) return void 0;
|
|
252
|
+
const next = (n) => objectOf(n, program, depth + 1);
|
|
253
|
+
if (node.type === "ObjectExpression") return node;
|
|
254
|
+
if (node.type === "ParenthesizedExpression" || node.type === "TSAsExpression" || node.type === "TSSatisfiesExpression") return next(node.expression);
|
|
255
|
+
if (node.type === "CallExpression") {
|
|
256
|
+
const { callee } = node;
|
|
257
|
+
const named = callee.type === "Identifier" ? callee : callee.type === "MemberExpression" ? callee.property : void 0;
|
|
258
|
+
const [first] = node.arguments;
|
|
259
|
+
if (named?.name !== "defineConfig" || first === void 0 || first.type === "SpreadElement") return void 0;
|
|
260
|
+
return next(first);
|
|
261
|
+
}
|
|
262
|
+
if (node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression") {
|
|
263
|
+
const body = node.body;
|
|
264
|
+
if (body === null) return void 0;
|
|
265
|
+
if (body.type !== "BlockStatement") return next(body);
|
|
266
|
+
const returned = body.body.findLast((s) => s.type === "ReturnStatement");
|
|
267
|
+
return returned?.type === "ReturnStatement" ? next(returned.argument) : void 0;
|
|
268
|
+
}
|
|
269
|
+
if (node.type !== "Identifier") return void 0;
|
|
270
|
+
for (const statement of program.body) {
|
|
271
|
+
const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : statement;
|
|
272
|
+
if (declaration?.type !== "VariableDeclaration") continue;
|
|
273
|
+
const found = declaration.declarations.find((d) => d.id.type === "Identifier" && d.id.name === node.name);
|
|
274
|
+
if (found !== void 0) return next(found.init);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/** The config's exported value: `export default …` or `module.exports = …`, and whether it's CommonJS. */
|
|
278
|
+
function exportedOf(program) {
|
|
279
|
+
for (const statement of program.body) {
|
|
280
|
+
if (statement.type === "ExportDefaultDeclaration") {
|
|
281
|
+
const value = statement.declaration;
|
|
282
|
+
return value.type.endsWith("Declaration") && value.type !== "FunctionDeclaration" ? void 0 : {
|
|
283
|
+
value,
|
|
284
|
+
commonjs: false
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
if (statement.type !== "ExpressionStatement" || statement.expression.type !== "AssignmentExpression") continue;
|
|
288
|
+
const { left, right } = statement.expression;
|
|
289
|
+
if (left.type === "MemberExpression" && left.object.type === "Identifier" && left.object.name === "module" && left.property.type === "Identifier" && left.property.name === "exports") return {
|
|
290
|
+
value: right,
|
|
291
|
+
commonjs: true
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* The config with deictic added, or nothing where it can't tell where: deictic's import beside the config's, and its
|
|
297
|
+
* plugin last in the list (`plugins`, `integrations`), or the config wrapped (Next's). Written in the config's quotes,
|
|
298
|
+
* semicolons and line endings.
|
|
299
|
+
*/
|
|
300
|
+
function addToConfig(bundler, file, code) {
|
|
301
|
+
const setup = SETUPS[bundler];
|
|
302
|
+
const { program, errors } = parseSync(file, code, { preserveParens: false });
|
|
303
|
+
if (errors.length > 0) return void 0;
|
|
304
|
+
const exported = exportedOf(program);
|
|
305
|
+
if (exported === void 0) return void 0;
|
|
306
|
+
const eol = eolOf(code);
|
|
307
|
+
const out = new MagicString(code);
|
|
308
|
+
if (setup.wrap) {
|
|
309
|
+
out.appendLeft(exported.value.start, `${setup.name}(`);
|
|
310
|
+
out.appendRight(exported.value.end, `, ${setup.value})`);
|
|
311
|
+
} else {
|
|
312
|
+
const object = objectOf(exported.value, program);
|
|
313
|
+
if (object === void 0 || !addTo(out, code, object, setup.list, setup.value, eol)) return void 0;
|
|
314
|
+
}
|
|
315
|
+
addImports(out, program, code, [["{ recommended }", "deictic/recommended"], [`{ ${setup.name} }`, setup.from]], exported.commonjs);
|
|
316
|
+
return out.toString();
|
|
317
|
+
}
|
|
318
|
+
/** Adds `value` last in the object's array `list`, or the list with it, as the object is laid out. False where `list` isn't an array. */
|
|
319
|
+
function addTo(out, code, object, list, value, eol) {
|
|
320
|
+
const property = object.properties.find((p) => p.type === "Property" && !p.computed && (p.key.type === "Identifier" && p.key.name === list || p.key.type === "Literal" && p.key.value === list));
|
|
321
|
+
if (property !== void 0) {
|
|
322
|
+
if (property.type !== "Property") return false;
|
|
323
|
+
let array = property.value;
|
|
324
|
+
while (array.type === "TSAsExpression" || array.type === "TSSatisfiesExpression") array = array.expression;
|
|
325
|
+
if (array.type !== "ArrayExpression") return false;
|
|
326
|
+
const last = array.elements.findLast((e) => e !== null);
|
|
327
|
+
if (last == null) {
|
|
328
|
+
out.appendLeft(array.start + 1, value);
|
|
329
|
+
return true;
|
|
330
|
+
}
|
|
331
|
+
const multiline = code.slice(array.start, array.end).includes("\n");
|
|
332
|
+
out.appendLeft(last.end, multiline ? `,${eol}${indentAt(code, last.start)}${value}` : `, ${value}`);
|
|
333
|
+
return true;
|
|
334
|
+
}
|
|
335
|
+
addFirst(out, code, object.start, object.properties[0], `${list}: [${value}]`);
|
|
336
|
+
return true;
|
|
337
|
+
}
|
|
338
|
+
const runIn = (command, cwd) => spawnSync(command, {
|
|
339
|
+
cwd,
|
|
340
|
+
stdio: "inherit",
|
|
341
|
+
shell: true
|
|
342
|
+
}).status === 0;
|
|
343
|
+
/** Sets the project up; throws what to do where it can't. */
|
|
344
|
+
async function init(options) {
|
|
345
|
+
const { install = true, dryRun = false, log = console.log, run = runIn } = options;
|
|
346
|
+
const root = rootOf(options.cwd);
|
|
347
|
+
if (root === void 0) throw new Error("deictic: no package.json here or above: run it in your project");
|
|
348
|
+
const manager = packageManager(root);
|
|
349
|
+
const bundler = bundlerOf(root);
|
|
350
|
+
const has = dependenciesOf(root);
|
|
351
|
+
const wanted = packagesFor(bundler).filter((p) => !has.has(p));
|
|
352
|
+
const command = installCommand(manager, wanted, root);
|
|
353
|
+
if (wanted.length === 0) log("deictic: its packages are installed");
|
|
354
|
+
else if (!install || dryRun) log(`deictic: install them with ${command}`);
|
|
355
|
+
else {
|
|
356
|
+
log(`deictic: ${command}`);
|
|
357
|
+
if (!run(command, root)) throw new Error(`deictic: the install failed: run ${command} yourself, then this again`);
|
|
358
|
+
}
|
|
359
|
+
configure(root, bundler, dryRun, log);
|
|
360
|
+
const skill = `${runnerOf(manager)} skills add ${existsSync(join(root, "node_modules", "deictic")) ? "./node_modules/deictic" : "gkurt/deictic"}`;
|
|
361
|
+
if (!(options.skill ?? (options.ask === void 0 ? false : await options.ask("deictic: add the skill, so your agent works the tasks?"))) || dryRun) log(`deictic: to have your agent work the tasks, add the skill: ${skill}`);
|
|
362
|
+
else {
|
|
363
|
+
log(`deictic: ${skill}`);
|
|
364
|
+
if (!run(skill, root)) log(`deictic: adding the skill failed: run ${skill} yourself`);
|
|
365
|
+
}
|
|
366
|
+
log(`deictic: screenshots render in Playwright's Chromium (${runnerOf(manager)} playwright install chromium), else Chrome or Edge`);
|
|
367
|
+
log("deictic: start your dev server and Alt-click an element");
|
|
368
|
+
}
|
|
369
|
+
/** Adds deictic to the bundler's config, or says what to add where it can't. */
|
|
370
|
+
function configure(root, bundler, dryRun, log) {
|
|
371
|
+
if (bundler === void 0) {
|
|
372
|
+
log("deictic: no bundler it knows in package.json (Vite, Next.js, Astro, webpack, Rspack, Bun): see API.md#bundlers to add it");
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
if (bundler === "bun") {
|
|
376
|
+
configureBun(root, dryRun, log);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
const setup = SETUPS[bundler];
|
|
380
|
+
const file = setup.files.map((f) => join(root, f)).find((f) => existsSync(f));
|
|
381
|
+
const imports = `import { recommended } from 'deictic/recommended';\nimport { ${setup.name} } from '${setup.from}';`;
|
|
382
|
+
if (file === void 0) {
|
|
383
|
+
log(`deictic: no ${setup.files[0]} here: add deictic to your ${bundler} config:\n\n${imports}\n${setup.snippet}\n`);
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
const name = relative(root, file).replaceAll("\\", "/");
|
|
387
|
+
const code = readFileSync(file, "utf8");
|
|
388
|
+
if (/['"]deictic\//.test(code)) {
|
|
389
|
+
log(`deictic: ${name} has it already`);
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const added = addToConfig(bundler, file, code);
|
|
393
|
+
if (added === void 0) {
|
|
394
|
+
log(`deictic: couldn't tell where it goes in ${name}: add it yourself:\n\n${imports}\n${setup.snippet}\n`);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
if (!dryRun) writeFileSync(file, added);
|
|
398
|
+
log(`deictic: ${dryRun ? "would add" : "added"} it to ${name}`);
|
|
399
|
+
}
|
|
400
|
+
/** Bun's three steps: the plugin's module, bunfig.toml, and its routes in the server. Each says what to add where it can't. */
|
|
401
|
+
function configureBun(root, dryRun, log) {
|
|
402
|
+
const write = (file, text) => !dryRun && writeFileSync(file, text);
|
|
403
|
+
const did = dryRun ? "would add" : "added";
|
|
404
|
+
const plugin = join(root, MODULE);
|
|
405
|
+
if (!existsSync(plugin)) {
|
|
406
|
+
write(plugin, PLUGIN);
|
|
407
|
+
log(`deictic: ${dryRun ? "would write" : "wrote"} ${MODULE}`);
|
|
408
|
+
} else if (!readFileSync(plugin, "utf8").includes("deictic/bun")) {
|
|
409
|
+
log(`deictic: ${MODULE} is a module of yours: add deictic by hand, as API.md#bundlers says for Bun`);
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
const bunfig = join(root, "bunfig.toml");
|
|
413
|
+
const before = existsSync(bunfig) ? readFileSync(bunfig, "utf8") : void 0;
|
|
414
|
+
const after = addToBunfig(before);
|
|
415
|
+
if (after === void 0) log(`deictic: couldn't tell where it goes in bunfig.toml: add it yourself:\n\n${BY_HAND.bunfig}\n`);
|
|
416
|
+
else if (after === before) log("deictic: bunfig.toml has it already");
|
|
417
|
+
else {
|
|
418
|
+
write(bunfig, after);
|
|
419
|
+
log(`deictic: ${did} it to bunfig.toml`);
|
|
420
|
+
}
|
|
421
|
+
const server = serverOf(root);
|
|
422
|
+
const name = relative(root, server).replaceAll("\\", "/");
|
|
423
|
+
const code = readFileSync(server, "utf8");
|
|
424
|
+
if (code.includes("deictic.plugin.ts".replace(/\.ts$/, ""))) {
|
|
425
|
+
log(`deictic: ${name} has its routes already`);
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
const added = addToServer(server, code, root);
|
|
429
|
+
if (added === void 0) {
|
|
430
|
+
log(`deictic: couldn't tell where its routes go in ${name}: add them yourself:\n\n${BY_HAND.server}\n`);
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
write(server, added);
|
|
434
|
+
log(`deictic: ${did} its routes to ${name}`);
|
|
435
|
+
}
|
|
436
|
+
const usage = `init [--dry-run] [--no-install] [--skill | --no-skill] sets deictic up in this project
|
|
437
|
+
--dry-run says what it would do, and does none of it
|
|
438
|
+
--no-install doesn't install: says the command instead
|
|
439
|
+
--skill adds the agent skill without asking; --no-skill says the command instead`;
|
|
440
|
+
/** Asks a yes-or-no question on the terminal, yes by default. */
|
|
441
|
+
async function ask(question) {
|
|
442
|
+
const lines = createInterface({
|
|
443
|
+
input: process.stdin,
|
|
444
|
+
output: process.stdout
|
|
445
|
+
});
|
|
446
|
+
try {
|
|
447
|
+
return !/^n/i.test((await lines.question(`${question} (Y/n) `)).trim());
|
|
448
|
+
} finally {
|
|
449
|
+
lines.close();
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
async function run(args) {
|
|
453
|
+
const { values } = parseArgs(args, {
|
|
454
|
+
"dry-run": { type: "boolean" },
|
|
455
|
+
install: { type: "boolean" },
|
|
456
|
+
skill: { type: "boolean" }
|
|
457
|
+
});
|
|
458
|
+
try {
|
|
459
|
+
await init({
|
|
460
|
+
cwd: process.cwd(),
|
|
461
|
+
install: values.install,
|
|
462
|
+
skill: values.skill,
|
|
463
|
+
dryRun: values["dry-run"],
|
|
464
|
+
ask: process.stdin.isTTY && process.stdout.isTTY ? ask : void 0
|
|
465
|
+
});
|
|
466
|
+
} catch (e) {
|
|
467
|
+
fail(e instanceof Error ? e.message : String(e));
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
export { addToConfig, bundlerOf, init, packagesFor, rootOf, run, usage };
|
|
471
|
+
|
|
472
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","names":[],"sources":["../../src/cli/edit.ts","../../src/cli/bun.ts","../../src/cli/init.ts"],"sourcesContent":["/**\n * Editing a project's own source the way it's written: its quotes, semicolons, line endings and indentation. What\n * `init` adds to a bundler's config and to a Bun server goes through here.\n */\nimport type MagicString from 'magic-string';\nimport type { Program } from 'oxc-parser';\n\n/** The file's line ending. */\nexport const eolOf = (code: string) => (code.includes('\\r\\n') ? '\\r\\n' : '\\n');\n\n/** The whitespace a line starts with, for the line `offset` is on. */\nexport function indentAt(code: string, offset: number): string {\n const start = code.lastIndexOf('\\n', offset - 1) + 1;\n return /^[ \\t]*/.exec(code.slice(start))![0];\n}\n\n/**\n * Adds import lines after the module's last import (or `require`, in CommonJS), or at its top: written in the quotes\n * and semicolons of its first import. Each line is `[what, from]`: `import ${what} from '${from}'`, or as a `require`.\n */\nexport function addImports(out: MagicString, program: Program, code: string, lines: [string, string][], commonjs = false): void {\n const eol = eolOf(code);\n const imports = program.body.filter((s) => s.type === 'ImportDeclaration');\n const first = imports[0];\n const quote = first === undefined ? \"'\" : code[first.source.start]!;\n const semi = first === undefined || code.slice(first.start, first.end).trimEnd().endsWith(';') ? ';' : '';\n const q = (s: string) => `${quote}${s}${quote}`;\n const text = lines\n .map(([what, from]) => (commonjs ? `const ${what} = require(${q(from)})${semi}` : `import ${what} from ${q(from)}${semi}`))\n .join(eol);\n const after = imports.at(-1) ?? requiresOf(program).at(-1);\n if (after === undefined) out.prepend(`${text}${eol}${eol}`);\n else out.appendLeft(after.end, `${eol}${text}`);\n}\n\n/** The top-level `const … = require(…)` statements of a CommonJS module, to put new ones after. */\nfunction requiresOf(program: Program) {\n return program.body.filter(\n (s) =>\n s.type === 'VariableDeclaration' &&\n s.declarations.some(\n (d) => d.init?.type === 'CallExpression' && d.init.callee.type === 'Identifier' && d.init.callee.name === 'require',\n ),\n );\n}\n\n/** Inserts `text` as the first property of the object literal that starts at `open` (its `{`), as the object is laid out. */\nexport function addFirst(out: MagicString, code: string, open: number, first: { start: number } | undefined, text: string): void {\n const eol = eolOf(code);\n if (first === undefined) {\n out.appendLeft(open + 1, ` ${text} `);\n return;\n }\n const multiline = code.slice(open, first.start).includes('\\n');\n out.appendLeft(first.start, multiline ? `${text},${eol}${indentAt(code, first.start)}` : `${text}, `);\n}\n","/**\n * `init` for Bun's own dev server: `Bun.serve` with HTML imports, which bundles the page with the plugins bunfig.toml\n * names. Only that: a Bun project that runs Vite, Next.js or another bundler is that bundler's, and one with no HTML\n * imports has no page of Bun's for deictic to be in. Three steps, as the API has them: the plugin's module, bunfig's\n * `[serve.static] plugins`, and its routes spread into `Bun.serve`'s.\n */\nimport { readdirSync, readFileSync } from 'node:fs';\nimport { dirname, join, relative } from 'node:path';\n\nimport MagicString from 'magic-string';\nimport { type CallExpression, parseSync, Visitor } from 'oxc-parser';\n\nimport { addFirst, addImports, eolOf } from './edit.ts';\n\n/** The plugin's module, from the root, which bunfig names and the server imports. */\nexport const MODULE = 'deictic.plugin.ts';\n\nexport const PLUGIN = `import { deictic } from 'deictic/bun';\nimport { recommended } from 'deictic/recommended';\n\n// One module for both: bunfig.toml names it as the dev server's bundler plugin, and the server spreads its routes,\n// deictic's endpoints, into its own.\nexport default deictic({ plugins: recommended() });\n`;\n\nconst SOURCE = /\\.[cm]?[jt]sx?$/;\nconst SKIP = new Set(['node_modules', 'dist', 'build', 'out']);\nconst SERVE = /\\bBun\\.serve\\s*\\(/;\nconst HTML = /\\bfrom\\s*['\"][^'\"]+\\.html['\"]/;\n\n/**\n * The module that serves the page with Bun's bundler: it calls `Bun.serve` and imports an HTML file. Looked for under\n * the root, not in dependencies, builds or dot folders, a few folders deep.\n */\nexport function serverOf(root: string): string | undefined {\n const walk = (dir: string, depth: number): string | undefined => {\n let entries;\n try {\n entries = readdirSync(dir, { withFileTypes: true });\n } catch {\n return undefined;\n }\n for (const e of entries) {\n if (!e.isFile() || !SOURCE.test(e.name)) continue;\n const path = join(dir, e.name);\n const code = readFileSync(path, 'utf8');\n if (SERVE.test(code) && HTML.test(code)) return path;\n }\n if (depth === 0) return undefined;\n for (const e of entries) {\n if (!e.isDirectory() || e.name.startsWith('.') || SKIP.has(e.name)) continue;\n const found = walk(join(dir, e.name), depth - 1);\n if (found !== undefined) return found;\n }\n return undefined;\n };\n return walk(root, 3);\n}\n\n/**\n * bunfig.toml with the plugin's module first in `[serve.static] plugins` (first, so it sees the source as written),\n * made where there's none; unchanged where it's there already, and nothing where bunfig says it another way (a dotted\n * key, an inline table) and it can't tell where.\n */\nexport function addToBunfig(text: string | undefined, entry = `./${MODULE}`): string | undefined {\n const quoted = JSON.stringify(entry);\n if (text === undefined) return `[serve.static]\\nplugins = [${quoted}]\\n`;\n if (text.includes(entry)) return text;\n if (/serve\\.static\\.|static\\s*=\\s*\\{/.test(text)) return undefined;\n const eol = eolOf(text);\n const header = /^[ \\t]*\\[serve\\.static\\][ \\t]*(#.*)?$/m.exec(text);\n if (header === null)\n return `${text}${text === '' || text.endsWith('\\n') ? '' : eol}${eol}[serve.static]${eol}plugins = [${quoted}]${eol}`;\n const bodyStart = header.index + header[0].length;\n const next = /^[ \\t]*\\[/m.exec(text.slice(bodyStart));\n const body = text.slice(bodyStart, next === null ? text.length : bodyStart + next.index);\n const list = /^[ \\t]*plugins[ \\t]*=[ \\t]*\\[/m.exec(body);\n if (list === null) return `${text.slice(0, bodyStart)}${eol}plugins = [${quoted}]${text.slice(bodyStart)}`;\n const open = bodyStart + list.index + list[0].length;\n const rest = text.slice(open);\n const empty = /^\\s*\\]/.test(rest);\n const lineBreak = /^[ \\t]*\\r?\\n([ \\t]*)/.exec(rest);\n if (empty) return `${text.slice(0, open)}${quoted}${rest.trimStart()}`;\n if (lineBreak !== null) return `${text.slice(0, open)}${eol}${lineBreak[1]}${quoted},${rest}`;\n return `${text.slice(0, open)}${quoted}, ${rest.trimStart()}`;\n}\n\n/**\n * The server with the plugin's routes first in `Bun.serve`'s `routes`, or `routes` with them where it has none, and\n * the module imported: nothing where `Bun.serve` isn't given an object it can see, or its routes aren't one.\n */\nexport function addToServer(file: string, code: string, root: string): string | undefined {\n const { program, errors } = parseSync(file, code, { preserveParens: false });\n if (errors.length > 0) return undefined;\n const calls: CallExpression[] = [];\n new Visitor({\n CallExpression(node) {\n const { callee } = node;\n if (\n callee.type === 'MemberExpression' &&\n callee.object.type === 'Identifier' &&\n callee.object.name === 'Bun' &&\n callee.property.type === 'Identifier' &&\n callee.property.name === 'serve'\n )\n calls.push(node);\n },\n }).visit(program);\n const options = calls.length === 1 ? calls[0]!.arguments[0] : undefined;\n if (options?.type !== 'ObjectExpression') return undefined;\n\n // `tools`, as the API names it, unless the module has a `tools` of its own.\n const name = /\\btools\\b/.test(code) ? 'deicticTools' : 'tools';\n const out = new MagicString(code);\n const routes = options.properties.find(\n (p) => p.type === 'Property' && !p.computed && p.key.type === 'Identifier' && p.key.name === 'routes',\n );\n if (routes === undefined) {\n addFirst(out, code, options.start, options.properties[0], `routes: { ...${name}.routes }`);\n } else {\n if (routes.type !== 'Property' || routes.value.type !== 'ObjectExpression') return undefined;\n addFirst(out, code, routes.value.start, routes.value.properties[0], `...${name}.routes`);\n }\n const from = relative(dirname(file), join(root, MODULE)).replaceAll('\\\\', '/');\n addImports(out, program, code, [[name, from.startsWith('.') ? from : `./${from}`]]);\n return out.toString();\n}\n\n/** What to add by hand, for a server or a bunfig it can't edit. */\nexport const BY_HAND = {\n bunfig: `[serve.static]\\nplugins = [\"./${MODULE}\"]`,\n server: `import tools from './${MODULE}';\\nBun.serve({ routes: { ...tools.routes, '/*': index } });`,\n};\n","/**\n * `deictic init`: the recommended setup in a project, in one step. It installs deictic and what the recommended\n * plugins import, with the project's package manager and as the project's own dev dependencies (deictic, the\n * page's bundle and the skill all find them from the project, so they can't come in through another package), adds\n * deictic to the bundler's config where it can find the place, and offers the agent skill.\n */\nimport { spawnSync } from 'node:child_process';\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, join, relative } from 'node:path';\nimport { createInterface } from 'node:readline/promises';\n\nimport MagicString from 'magic-string';\nimport { type Expression, type ObjectExpression, parseSync, type Program } from 'oxc-parser';\n\nimport { recommended } from '#src/plugins/recommended/index.ts';\n\nimport { installCommand, packageManager, readJson, runnerOf } from '#src/tools/packages.ts';\n\nimport { fail, parseArgs } from './board.ts';\nimport { addToBunfig, addToServer, BY_HAND, MODULE, PLUGIN, serverOf } from './bun.ts';\nimport { addFirst, addImports, eolOf, indentAt } from './edit.ts';\n\nexport type Bundler = 'next' | 'astro' | 'vite' | 'rspack' | 'webpack' | 'bun';\n\ninterface Setup {\n /** The config files it looks for, in order. */\n files: string[];\n /** The module deictic's integration comes from, and its name there. */\n from: string;\n name: string;\n /** What goes in the config: in its `list`, or wrapped around the whole of it with `wrap`. */\n list?: string;\n value: string;\n wrap?: boolean;\n /** The snippet for a config it can't edit. */\n snippet: string;\n}\n\nconst extensions = (base: string) => ['ts', 'mts', 'js', 'mjs', 'cts', 'cjs'].map((e) => `${base}.${e}`);\nconst PLUGINS = '{ plugins: recommended() }';\n\nconst SETUPS: Record<Exclude<Bundler, 'bun'>, Setup> = {\n next: {\n files: extensions('next.config'),\n from: 'deictic/next',\n name: 'withDeictic',\n value: PLUGINS,\n wrap: true,\n snippet: `export default withDeictic(nextConfig, ${PLUGINS});`,\n },\n astro: {\n files: extensions('astro.config'),\n from: 'deictic/astro',\n name: 'deictic',\n list: 'integrations',\n value: `deictic(${PLUGINS})`,\n snippet: `export default defineConfig({ integrations: [deictic(${PLUGINS})] });`,\n },\n vite: {\n files: extensions('vite.config'),\n from: 'deictic/vite',\n name: 'deictic',\n list: 'plugins',\n value: `deictic(${PLUGINS})`,\n snippet: `export default defineConfig({ plugins: [react(), deictic(${PLUGINS})] });`,\n },\n rspack: {\n files: extensions('rspack.config'),\n from: 'deictic/webpack',\n name: 'DeicticPlugin',\n list: 'plugins',\n value: `new DeicticPlugin(${PLUGINS})`,\n snippet: `export default { plugins: [new DeicticPlugin(${PLUGINS})] };`,\n },\n webpack: {\n files: extensions('webpack.config'),\n from: 'deictic/webpack',\n name: 'DeicticPlugin',\n list: 'plugins',\n value: `new DeicticPlugin(${PLUGINS})`,\n snippet: `export default { plugins: [new DeicticPlugin(${PLUGINS})] };`,\n },\n};\n\n/** The project's root: the nearest folder with a package.json, from `dir` up. */\nexport function rootOf(dir: string): string | undefined {\n for (let at = dir; ; at = dirname(at)) {\n if (existsSync(join(at, 'package.json'))) return at;\n if (dirname(at) === at) return undefined;\n }\n}\n\n/** The project's dependencies and dev dependencies, by name. */\nfunction dependenciesOf(root: string): Set<string> {\n const manifest = readJson(join(root, 'package.json')) ?? {};\n return new Set([manifest.dependencies, manifest.devDependencies].flatMap((d) => Object.keys((d as object | undefined) ?? {})));\n}\n\n/** The bundler the project runs its dev server with, from its dependencies, or none deictic knows. */\nexport function bundlerOf(root: string): Bundler | undefined {\n const has = dependenciesOf(root);\n if (has.has('next')) return 'next';\n if (has.has('astro')) return 'astro';\n if (has.has('vite') || SETUPS.vite.files.some((f) => existsSync(join(root, f)))) return 'vite';\n if (has.has('@rspack/core') || has.has('@rspack/cli')) return 'rspack';\n if (has.has('webpack')) return 'webpack';\n // Bun's own bundler only where a server of the project's has it bundle a page: not every project Bun runs.\n if (serverOf(root) !== undefined) return 'bun';\n return undefined;\n}\n\n/** What the recommended setup imports, for the bundler: launch-editor opens files under webpack, which has no launcher. */\nexport function packagesFor(bundler: Bundler | undefined): string[] {\n const plugins = recommended().flatMap((p) => p.packages ?? []);\n return ['deictic', ...plugins, ...(bundler === 'webpack' || bundler === 'rspack' ? ['launch-editor'] : [])];\n}\n\ntype Node = Expression | ObjectExpression;\n\n/**\n * The object an expression comes to: through `defineConfig(…)`, `(…)`, `satisfies`, a function's return and a top-level\n * `const`. Not through another call: in `mergeConfig(base, {…})` or webpack-merge's `merge(common, {…})` the first\n * argument is a base the project may build with too, and the plugin isn't the base's.\n */\nfunction objectOf(node: Node | null | undefined, program: Program, depth = 0): ObjectExpression | undefined {\n if (node == null || depth > 8) return undefined;\n const next = (n: Node | null | undefined) => objectOf(n, program, depth + 1);\n if (node.type === 'ObjectExpression') return node;\n if (node.type === 'ParenthesizedExpression' || node.type === 'TSAsExpression' || node.type === 'TSSatisfiesExpression')\n return next(node.expression);\n if (node.type === 'CallExpression') {\n const { callee } = node;\n const named = (callee.type === 'Identifier' ? callee : callee.type === 'MemberExpression' ? callee.property : undefined) as\n { type: string; name?: string } | undefined;\n const [first] = node.arguments;\n if (named?.name !== 'defineConfig' || first === undefined || first.type === 'SpreadElement') return undefined;\n return next(first);\n }\n if (node.type === 'ArrowFunctionExpression' || node.type === 'FunctionExpression') {\n const body = node.body;\n if (body === null) return undefined;\n if (body.type !== 'BlockStatement') return next(body);\n const returned = body.body.findLast((s) => s.type === 'ReturnStatement');\n return returned?.type === 'ReturnStatement' ? next(returned.argument) : undefined;\n }\n if (node.type !== 'Identifier') return undefined;\n for (const statement of program.body) {\n const declaration = statement.type === 'ExportNamedDeclaration' ? statement.declaration : statement;\n if (declaration?.type !== 'VariableDeclaration') continue;\n const found = declaration.declarations.find((d) => d.id.type === 'Identifier' && d.id.name === node.name);\n if (found !== undefined) return next(found.init);\n }\n return undefined;\n}\n\n/** The config's exported value: `export default …` or `module.exports = …`, and whether it's CommonJS. */\nfunction exportedOf(program: Program): { value: Expression; commonjs: boolean } | undefined {\n for (const statement of program.body) {\n if (statement.type === 'ExportDefaultDeclaration') {\n const value = statement.declaration;\n return value.type.endsWith('Declaration') && value.type !== 'FunctionDeclaration'\n ? undefined\n : { value: value as Expression, commonjs: false };\n }\n if (statement.type !== 'ExpressionStatement' || statement.expression.type !== 'AssignmentExpression') continue;\n const { left, right } = statement.expression;\n const exports =\n left.type === 'MemberExpression' &&\n left.object.type === 'Identifier' &&\n left.object.name === 'module' &&\n left.property.type === 'Identifier' &&\n left.property.name === 'exports';\n if (exports) return { value: right, commonjs: true };\n }\n return undefined;\n}\n\n/**\n * The config with deictic added, or nothing where it can't tell where: deictic's import beside the config's, and its\n * plugin last in the list (`plugins`, `integrations`), or the config wrapped (Next's). Written in the config's quotes,\n * semicolons and line endings.\n */\nexport function addToConfig(bundler: Exclude<Bundler, 'bun'>, file: string, code: string): string | undefined {\n const setup = SETUPS[bundler];\n const { program, errors } = parseSync(file, code, { preserveParens: false });\n if (errors.length > 0) return undefined;\n const exported = exportedOf(program);\n if (exported === undefined) return undefined;\n const eol = eolOf(code);\n const out = new MagicString(code);\n\n if (setup.wrap) {\n out.appendLeft(exported.value.start, `${setup.name}(`);\n out.appendRight(exported.value.end, `, ${setup.value})`);\n } else {\n const object = objectOf(exported.value, program);\n if (object === undefined || !addTo(out, code, object, setup.list!, setup.value, eol)) return undefined;\n }\n\n const lines: [string, string][] = [\n ['{ recommended }', 'deictic/recommended'],\n [`{ ${setup.name} }`, setup.from],\n ];\n addImports(out, program, code, lines, exported.commonjs);\n return out.toString();\n}\n\n/** Adds `value` last in the object's array `list`, or the list with it, as the object is laid out. False where `list` isn't an array. */\nfunction addTo(out: MagicString, code: string, object: ObjectExpression, list: string, value: string, eol: string): boolean {\n const property = object.properties.find(\n (p) =>\n p.type === 'Property' &&\n !p.computed &&\n ((p.key.type === 'Identifier' && p.key.name === list) || (p.key.type === 'Literal' && p.key.value === list)),\n );\n if (property !== undefined) {\n if (property.type !== 'Property') return false;\n let array = property.value;\n while (array.type === 'TSAsExpression' || array.type === 'TSSatisfiesExpression') array = array.expression;\n if (array.type !== 'ArrayExpression') return false;\n const last = array.elements.findLast((e) => e !== null);\n if (last == null) {\n out.appendLeft(array.start + 1, value);\n return true;\n }\n const multiline = code.slice(array.start, array.end).includes('\\n');\n out.appendLeft(last.end, multiline ? `,${eol}${indentAt(code, last.start)}${value}` : `, ${value}`);\n return true;\n }\n addFirst(out, code, object.start, object.properties[0], `${list}: [${value}]`);\n return true;\n}\n\nexport interface InitOptions {\n /** Where it runs: the project is the nearest folder with a package.json. */\n cwd: string;\n /** Installs the packages; false only says the command. */\n install?: boolean;\n /** Adds the skill (true), says how (false), or asks (undefined, on a terminal; says how elsewhere). */\n skill?: boolean;\n /** Says what it would do, and does none of it. */\n dryRun?: boolean;\n log?: (line: string) => void;\n /** Runs a command in the project, and answers whether it succeeded. */\n run?: (command: string, cwd: string) => boolean;\n ask?: (question: string) => Promise<boolean>;\n}\n\nconst runIn = (command: string, cwd: string) => spawnSync(command, { cwd, stdio: 'inherit', shell: true }).status === 0;\n\n/** Sets the project up; throws what to do where it can't. */\nexport async function init(options: InitOptions): Promise<void> {\n const { install = true, dryRun = false, log = console.log, run = runIn } = options;\n const root = rootOf(options.cwd);\n if (root === undefined) throw new Error('deictic: no package.json here or above: run it in your project');\n const manager = packageManager(root);\n const bundler = bundlerOf(root);\n const has = dependenciesOf(root);\n\n const wanted = packagesFor(bundler).filter((p) => !has.has(p));\n const command = installCommand(manager, wanted, root);\n if (wanted.length === 0) {\n log('deictic: its packages are installed');\n } else if (!install || dryRun) {\n log(`deictic: install them with ${command}`);\n } else {\n log(`deictic: ${command}`);\n if (!run(command, root)) throw new Error(`deictic: the install failed: run ${command} yourself, then this again`);\n }\n\n configure(root, bundler, dryRun, log);\n\n const skill = `${runnerOf(manager)} skills add ${existsSync(join(root, 'node_modules', 'deictic')) ? './node_modules/deictic' : 'gkurt/deictic'}`;\n const add =\n options.skill ?? (options.ask === undefined ? false : await options.ask('deictic: add the skill, so your agent works the tasks?'));\n if (!add || dryRun) {\n log(`deictic: to have your agent work the tasks, add the skill: ${skill}`);\n } else {\n log(`deictic: ${skill}`);\n if (!run(skill, root)) log(`deictic: adding the skill failed: run ${skill} yourself`);\n }\n\n log(`deictic: screenshots render in Playwright's Chromium (${runnerOf(manager)} playwright install chromium), else Chrome or Edge`);\n log('deictic: start your dev server and Alt-click an element');\n}\n\n/** Adds deictic to the bundler's config, or says what to add where it can't. */\nfunction configure(root: string, bundler: Bundler | undefined, dryRun: boolean, log: (line: string) => void): void {\n if (bundler === undefined) {\n log('deictic: no bundler it knows in package.json (Vite, Next.js, Astro, webpack, Rspack, Bun): see API.md#bundlers to add it');\n return;\n }\n if (bundler === 'bun') {\n configureBun(root, dryRun, log);\n return;\n }\n const setup = SETUPS[bundler];\n const file = setup.files.map((f) => join(root, f)).find((f) => existsSync(f));\n const imports = `import { recommended } from 'deictic/recommended';\\nimport { ${setup.name} } from '${setup.from}';`;\n if (file === undefined) {\n log(`deictic: no ${setup.files[0]} here: add deictic to your ${bundler} config:\\n\\n${imports}\\n${setup.snippet}\\n`);\n return;\n }\n const name = relative(root, file).replaceAll('\\\\', '/');\n const code = readFileSync(file, 'utf8');\n if (/['\"]deictic\\//.test(code)) {\n log(`deictic: ${name} has it already`);\n return;\n }\n const added = addToConfig(bundler, file, code);\n if (added === undefined) {\n log(`deictic: couldn't tell where it goes in ${name}: add it yourself:\\n\\n${imports}\\n${setup.snippet}\\n`);\n return;\n }\n if (!dryRun) writeFileSync(file, added);\n log(`deictic: ${dryRun ? 'would add' : 'added'} it to ${name}`);\n}\n\n/** Bun's three steps: the plugin's module, bunfig.toml, and its routes in the server. Each says what to add where it can't. */\nfunction configureBun(root: string, dryRun: boolean, log: (line: string) => void): void {\n const write = (file: string, text: string) => !dryRun && writeFileSync(file, text);\n const did = dryRun ? 'would add' : 'added';\n const plugin = join(root, MODULE);\n if (!existsSync(plugin)) {\n write(plugin, PLUGIN);\n log(`deictic: ${dryRun ? 'would write' : 'wrote'} ${MODULE}`);\n } else if (!readFileSync(plugin, 'utf8').includes('deictic/bun')) {\n log(`deictic: ${MODULE} is a module of yours: add deictic by hand, as API.md#bundlers says for Bun`);\n return;\n }\n\n const bunfig = join(root, 'bunfig.toml');\n const before = existsSync(bunfig) ? readFileSync(bunfig, 'utf8') : undefined;\n const after = addToBunfig(before);\n if (after === undefined) {\n log(`deictic: couldn't tell where it goes in bunfig.toml: add it yourself:\\n\\n${BY_HAND.bunfig}\\n`);\n } else if (after === before) {\n log('deictic: bunfig.toml has it already');\n } else {\n write(bunfig, after);\n log(`deictic: ${did} it to bunfig.toml`);\n }\n\n const server = serverOf(root)!;\n const name = relative(root, server).replaceAll('\\\\', '/');\n const code = readFileSync(server, 'utf8');\n if (code.includes(MODULE.replace(/\\.ts$/, ''))) {\n log(`deictic: ${name} has its routes already`);\n return;\n }\n const added = addToServer(server, code, root);\n if (added === undefined) {\n log(`deictic: couldn't tell where its routes go in ${name}: add them yourself:\\n\\n${BY_HAND.server}\\n`);\n return;\n }\n write(server, added);\n log(`deictic: ${did} its routes to ${name}`);\n}\n\nexport const usage = `init [--dry-run] [--no-install] [--skill | --no-skill] sets deictic up in this project\n --dry-run says what it would do, and does none of it\n --no-install doesn't install: says the command instead\n --skill adds the agent skill without asking; --no-skill says the command instead`;\n\n/** Asks a yes-or-no question on the terminal, yes by default. */\nasync function ask(question: string): Promise<boolean> {\n const lines = createInterface({ input: process.stdin, output: process.stdout });\n try {\n return !/^n/i.test((await lines.question(`${question} (Y/n) `)).trim());\n } finally {\n lines.close();\n }\n}\n\nexport async function run(args: string[]): Promise<void> {\n const { values } = parseArgs(args, { 'dry-run': { type: 'boolean' }, install: { type: 'boolean' }, skill: { type: 'boolean' } });\n try {\n await init({\n cwd: process.cwd(),\n install: values.install,\n skill: values.skill,\n dryRun: values['dry-run'],\n ask: process.stdin.isTTY && process.stdout.isTTY ? ask : undefined,\n });\n } catch (e) {\n fail(e instanceof Error ? e.message : String(e));\n }\n}\n"],"mappings":";;;;;;;;;;;AAQA,MAAa,SAAS,SAAkB,KAAK,SAAS,MAAM,IAAI,SAAS;;AAGzE,SAAgB,SAAS,MAAc,QAAwB;CAC7D,MAAM,QAAQ,KAAK,YAAY,MAAM,SAAS,CAAC,IAAI;CACnD,OAAO,UAAU,KAAK,KAAK,MAAM,KAAK,CAAC,CAAC,CAAE;AAC5C;;;;;AAMA,SAAgB,WAAW,KAAkB,SAAkB,MAAc,OAA2B,WAAW,OAAa;CAC9H,MAAM,MAAM,MAAM,IAAI;CACtB,MAAM,UAAU,QAAQ,KAAK,QAAQ,MAAM,EAAE,SAAS,mBAAmB;CACzE,MAAM,QAAQ,QAAQ;CACtB,MAAM,QAAQ,UAAU,KA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