retouche-dev 0.0.0-stage → 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/LICENSE +21 -0
- package/PROMPT.md +89 -0
- package/README.md +26 -2
- package/THIRD-PARTY-NOTICES.md +19 -0
- package/dist/class-groups-DKpPgmHx.js +269 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +601 -0
- package/dist/clock-DPQ0w5RJ.js +305 -0
- package/dist/config.d.ts +44 -0
- package/dist/config.js +1 -0
- package/dist/define-config-CepEvVVV.js +17 -0
- package/dist/follow-files-VmBxVLp-.js +271 -0
- package/dist/hand-arrow-Dc5fTEjK.js +72 -0
- package/dist/hand-arrow.d.ts +5 -0
- package/dist/hand-arrow.js +1 -0
- package/dist/handler-O-I_szZX.js +2762 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +31 -0
- package/dist/instrument.d.ts +1 -0
- package/dist/instrument.js +3 -0
- package/dist/layer-DVJN6vRD.js +27239 -0
- package/dist/next.d.ts +9 -0
- package/dist/next.js +16 -0
- package/dist/options-BFTQdEZa.d.ts +32 -0
- package/dist/rdt-hook-D5CYLcRL.js +144 -0
- package/dist/snapdom-BVQMFNaf.js +12663 -0
- package/dist/spoken-timeline-1xtFghWv.js +72 -0
- package/dist/theme-T9ScDE2Z.js +97 -0
- package/dist/theme.d.ts +4 -0
- package/dist/theme.js +1 -0
- package/dist/vite.d.ts +4 -0
- package/dist/vite.js +104 -0
- package/dist/voice-markdown-DhG3jnuj.js +227 -0
- package/package.json +103 -4
- package/templates/retouche.config.ts +5 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// src/voice/spoken-timeline.ts
|
|
2
|
+
const WORD = /\S+/g;
|
|
3
|
+
const FULL_HOLD_MS = 2e3;
|
|
4
|
+
const HOLD_HEAD_START_MS = 400;
|
|
5
|
+
const SAID_BEFORE_MS = 400;
|
|
6
|
+
const SAID_AFTER_MS = 1200;
|
|
7
|
+
const KIND_WEIGHTS = {
|
|
8
|
+
click: 1,
|
|
9
|
+
point: .7
|
|
10
|
+
};
|
|
11
|
+
function spokenWords(text) {
|
|
12
|
+
return text.match(WORD) ?? [];
|
|
13
|
+
}
|
|
14
|
+
function momentWeight(moment) {
|
|
15
|
+
const hold = Math.min(1, (moment.durationMs + HOLD_HEAD_START_MS) / FULL_HOLD_MS);
|
|
16
|
+
return KIND_WEIGHTS[moment.kind] * hold;
|
|
17
|
+
}
|
|
18
|
+
function spread(words, passage) {
|
|
19
|
+
const total = words.reduce((sum, word) => sum + word.length, 0);
|
|
20
|
+
const span = passage.endMs - passage.startMs;
|
|
21
|
+
let said = 0;
|
|
22
|
+
return words.map((word) => {
|
|
23
|
+
const atMs = passage.startMs + span * said / total;
|
|
24
|
+
said += word.length;
|
|
25
|
+
return atMs;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function wordTimes(passage) {
|
|
29
|
+
const words = spokenWords(passage.text);
|
|
30
|
+
const { endMs, startMs, wordMs = [] } = passage;
|
|
31
|
+
if (wordMs.length !== words.length) return spread(words, passage);
|
|
32
|
+
let earliest = startMs;
|
|
33
|
+
return wordMs.map((atMs) => {
|
|
34
|
+
earliest = Math.min(endMs, Math.max(earliest, atMs));
|
|
35
|
+
return earliest;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function nearness(moment, atMs) {
|
|
39
|
+
const endMs = moment.atMs + moment.durationMs;
|
|
40
|
+
if (atMs < moment.atMs) return 1 - (moment.atMs - atMs) / SAID_BEFORE_MS;
|
|
41
|
+
if (atMs > endMs) return 1 - (atMs - endMs) / SAID_AFTER_MS;
|
|
42
|
+
return 1;
|
|
43
|
+
}
|
|
44
|
+
function wordOwners(moments, times) {
|
|
45
|
+
return times.map((atMs) => {
|
|
46
|
+
let owner = null;
|
|
47
|
+
let best = 0;
|
|
48
|
+
for (const moment of moments) {
|
|
49
|
+
const score = momentWeight(moment) * nearness(moment, atMs);
|
|
50
|
+
if (score > best) {
|
|
51
|
+
best = score;
|
|
52
|
+
owner = moment.id;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return owner;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function passageRuns(passage, moments) {
|
|
59
|
+
const owners = wordOwners(moments.filter(({ id }) => passage.momentIds.includes(id)), wordTimes(passage));
|
|
60
|
+
const runs = [];
|
|
61
|
+
for (const [index, word] of spokenWords(passage.text).entries()) {
|
|
62
|
+
const momentId = owners[index] ?? null;
|
|
63
|
+
const last = runs.at(-1);
|
|
64
|
+
if (last?.momentId === momentId) last.text = `${last.text} ${word}`;
|
|
65
|
+
else runs.push({
|
|
66
|
+
momentId,
|
|
67
|
+
text: word
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return runs;
|
|
71
|
+
}
|
|
72
|
+
export { wordTimes as a, wordOwners as i, passageRuns as n, spokenWords as r, momentWeight as t };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// src/theme.ts
|
|
2
|
+
const EASE_MORPH = "cubic-bezier(0.32, 0.72, 0, 1)";
|
|
3
|
+
const THEMES = ["light", "dark"];
|
|
4
|
+
const LIGHT_TOKENS = `
|
|
5
|
+
color-scheme: light;
|
|
6
|
+
--rt-bg: #ffffff;
|
|
7
|
+
--rt-bg-subtle: rgb(0 0 0 / 3%);
|
|
8
|
+
--rt-bg-hover: rgb(0 0 0 / 4.5%);
|
|
9
|
+
--rt-bg-pressed: rgb(0 0 0 / 7%);
|
|
10
|
+
--rt-card: rgb(0 0 0 / 2.5%);
|
|
11
|
+
--rt-card-ring: 0 0 0 1px rgb(0 0 0 / 4%);
|
|
12
|
+
--rt-border: rgb(0 0 0 / 7%);
|
|
13
|
+
--rt-text: #191919;
|
|
14
|
+
--rt-text-muted: #6b6b6b;
|
|
15
|
+
--rt-text-faint: #8f8f8f;
|
|
16
|
+
--rt-primary: #191919;
|
|
17
|
+
--rt-primary-text: #ffffff;
|
|
18
|
+
--rt-accent: #ff6900;
|
|
19
|
+
--rt-accent-ink: #b64600;
|
|
20
|
+
--rt-accent-solid: #c14900;
|
|
21
|
+
--rt-accent-text: #ffffff;
|
|
22
|
+
--rt-error: #e5484d;
|
|
23
|
+
--rt-error-ink: #ce2c31;
|
|
24
|
+
--rt-added: #2b9a5f;
|
|
25
|
+
--rt-flash: #6e56cf;
|
|
26
|
+
--rt-flash-ink: #5746af;
|
|
27
|
+
--rt-syntax-keyword: #b5306b;
|
|
28
|
+
--rt-syntax-string: #2d7a4f;
|
|
29
|
+
--rt-syntax-type: #7f53ac;
|
|
30
|
+
--rt-tooltip: #1c1c1c;
|
|
31
|
+
--rt-tooltip-text: #ffffff;
|
|
32
|
+
--rt-tooltip-muted: rgb(255 255 255 / 62%);
|
|
33
|
+
--rt-canvas: #f4f4f3;
|
|
34
|
+
--rt-glass: rgb(255 255 255 / 80%);
|
|
35
|
+
--rt-glass-highlight: rgb(255 255 255 / 90%);
|
|
36
|
+
--rt-glass-rim: rgb(255 255 255 / 55%);
|
|
37
|
+
--rt-glass-stroke: rgb(0 0 0 / 9%);
|
|
38
|
+
--rt-pill: 999px;
|
|
39
|
+
--rt-radius-surface: 16px;
|
|
40
|
+
--rt-radius-card: 12px;
|
|
41
|
+
--rt-radius-row: 10px;
|
|
42
|
+
--rt-radius-tiny: 5px;
|
|
43
|
+
--rt-shadow-low: 0 0 0 1px rgb(0 0 0 / 6%), 0 1px 2px rgb(0 0 0 / 6%), 0 2px 6px -2px rgb(0 0 0 / 8%);
|
|
44
|
+
--rt-shadow: 0 1px 1px rgb(0 0 0 / 3%), 0 2px 4px -1px rgb(0 0 0 / 4%), 0 6px 12px -4px rgb(0 0 0 / 5%), 0 16px 32px -8px rgb(0 0 0 / 7%), 0 32px 64px -12px rgb(0 0 0 / 9%);
|
|
45
|
+
--rt-shadow-lifted: 0 2px 2px rgb(0 0 0 / 3%), 0 4px 8px -2px rgb(0 0 0 / 5%), 0 12px 24px -6px rgb(0 0 0 / 7%), 0 28px 48px -12px rgb(0 0 0 / 10%), 0 48px 96px -16px rgb(0 0 0 / 13%);
|
|
46
|
+
--rt-shadow-popover: 0 1px 2px rgb(0 0 0 / 14%), 0 6px 18px -4px rgb(0 0 0 / 26%);
|
|
47
|
+
--rt-ease: cubic-bezier(0.22, 1, 0.36, 1);
|
|
48
|
+
--rt-ease-morph: ${EASE_MORPH};
|
|
49
|
+
--rt-ease-exit: cubic-bezier(0.4, 0, 0.7, 1);
|
|
50
|
+
--rt-ease-spring: linear(0, 0.067 5%, 0.206 10%, 0.36 15%, 0.502 20%, 0.622 25%, 0.718 30%, 0.793 35%, 0.85 40%, 0.893 45%, 0.924 50%, 0.947 55%, 0.963 60%, 0.975 65%, 0.983 70%, 0.989 75%, 0.993 80%, 0.996 85%, 0.998 90%, 0.999 95%, 1);
|
|
51
|
+
--rt-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
52
|
+
--rt-font-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
|
|
53
|
+
`;
|
|
54
|
+
const DARK_TOKENS = `
|
|
55
|
+
color-scheme: dark;
|
|
56
|
+
--rt-bg: #1d1d1d;
|
|
57
|
+
--rt-bg-subtle: rgb(255 255 255 / 4%);
|
|
58
|
+
--rt-bg-hover: rgb(255 255 255 / 6.5%);
|
|
59
|
+
--rt-bg-pressed: rgb(255 255 255 / 10%);
|
|
60
|
+
--rt-card: rgb(255 255 255 / 3.5%);
|
|
61
|
+
--rt-card-ring: 0 0 0 1px rgb(255 255 255 / 5%);
|
|
62
|
+
--rt-border: rgb(255 255 255 / 8%);
|
|
63
|
+
--rt-text: #ededed;
|
|
64
|
+
--rt-text-muted: #a0a0a0;
|
|
65
|
+
--rt-text-faint: #6e6e6e;
|
|
66
|
+
--rt-primary: #ededed;
|
|
67
|
+
--rt-primary-text: #141414;
|
|
68
|
+
--rt-accent-ink: #ff8904;
|
|
69
|
+
--rt-error: #e5484d;
|
|
70
|
+
--rt-error-ink: #ff8f8d;
|
|
71
|
+
--rt-added: #3dd68c;
|
|
72
|
+
--rt-flash: #8e7cf0;
|
|
73
|
+
--rt-flash-ink: #baa7ff;
|
|
74
|
+
--rt-syntax-keyword: #f294b6;
|
|
75
|
+
--rt-syntax-string: #93d3a2;
|
|
76
|
+
--rt-syntax-type: #c9aaee;
|
|
77
|
+
--rt-tooltip: #2e2e2e;
|
|
78
|
+
--rt-canvas: #121212;
|
|
79
|
+
--rt-glass: rgb(29 29 29 / 86%);
|
|
80
|
+
--rt-glass-highlight: rgb(255 255 255 / 10%);
|
|
81
|
+
--rt-glass-rim: rgb(255 255 255 / 7%);
|
|
82
|
+
--rt-glass-stroke: rgb(0 0 0 / 55%);
|
|
83
|
+
--rt-shadow-low: 0 0 0 1px rgb(255 255 255 / 8%), 0 1px 2px rgb(0 0 0 / 40%), 0 2px 6px -2px rgb(0 0 0 / 50%);
|
|
84
|
+
--rt-shadow: 0 1px 1px rgb(0 0 0 / 18%), 0 2px 4px -1px rgb(0 0 0 / 22%), 0 6px 12px -4px rgb(0 0 0 / 26%), 0 16px 32px -8px rgb(0 0 0 / 34%), 0 32px 64px -12px rgb(0 0 0 / 42%);
|
|
85
|
+
--rt-shadow-lifted: 0 2px 2px rgb(0 0 0 / 18%), 0 4px 8px -2px rgb(0 0 0 / 24%), 0 12px 24px -6px rgb(0 0 0 / 30%), 0 28px 48px -12px rgb(0 0 0 / 40%), 0 48px 96px -16px rgb(0 0 0 / 50%);
|
|
86
|
+
--rt-shadow-popover: 0 0 0 1px rgb(255 255 255 / 10%), 0 6px 18px -4px rgb(0 0 0 / 60%);
|
|
87
|
+
`;
|
|
88
|
+
function themeTokens(selector) {
|
|
89
|
+
return `
|
|
90
|
+
${selector} {${LIGHT_TOKENS}}
|
|
91
|
+
@media (prefers-color-scheme: dark) {
|
|
92
|
+
${selector}:not([data-theme="light"]) {${DARK_TOKENS}}
|
|
93
|
+
}
|
|
94
|
+
${selector}[data-theme="dark"] {${DARK_TOKENS}}
|
|
95
|
+
`;
|
|
96
|
+
}
|
|
97
|
+
export { THEMES as n, themeTokens as r, EASE_MORPH as t };
|
package/dist/theme.d.ts
ADDED
package/dist/theme.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as EASE_MORPH, n as THEMES, r as themeTokens } from "./theme-T9ScDE2Z.js";
|
package/dist/vite.d.ts
ADDED
package/dist/vite.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { d as ROUTE_BASE } from "./clock-DPQ0w5RJ.js";
|
|
2
|
+
import { a as withEnvFiles, i as isLoopbackAddress, n as BODY_LIMIT_ERROR, t as createRouteHandler } from "./handler-O-I_szZX.js";
|
|
3
|
+
import { h as errorResponse } from "./follow-files-VmBxVLp-.js";
|
|
4
|
+
import { loadEnv } from "vite";
|
|
5
|
+
// src/server/node-http.ts
|
|
6
|
+
async function readBody(request) {
|
|
7
|
+
const { promise, reject, resolve } = Promise.withResolvers();
|
|
8
|
+
const chunks = [];
|
|
9
|
+
let size = 0;
|
|
10
|
+
const onData = (chunk) => {
|
|
11
|
+
size += chunk.length;
|
|
12
|
+
if (size <= 26214400) {
|
|
13
|
+
chunks.push(chunk);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
request.off("data", onData);
|
|
17
|
+
request.resume();
|
|
18
|
+
resolve(null);
|
|
19
|
+
};
|
|
20
|
+
request.on("data", onData);
|
|
21
|
+
request.once("end", () => {
|
|
22
|
+
resolve(Buffer.concat(chunks));
|
|
23
|
+
});
|
|
24
|
+
request.once("error", reject);
|
|
25
|
+
return await promise;
|
|
26
|
+
}
|
|
27
|
+
function closeSignal(response) {
|
|
28
|
+
const controller = new AbortController();
|
|
29
|
+
response.once("close", () => {
|
|
30
|
+
if (!response.writableFinished) controller.abort();
|
|
31
|
+
});
|
|
32
|
+
return controller.signal;
|
|
33
|
+
}
|
|
34
|
+
function webHeaders(request) {
|
|
35
|
+
const headers = new Headers();
|
|
36
|
+
for (const [name, value] of Object.entries(request.headers)) {
|
|
37
|
+
if (name.startsWith(":") || value === void 0) continue;
|
|
38
|
+
for (const item of Array.isArray(value) ? value : [value]) headers.append(name, item);
|
|
39
|
+
}
|
|
40
|
+
return headers;
|
|
41
|
+
}
|
|
42
|
+
async function toWebRequest(request, response) {
|
|
43
|
+
const origin = `${"encrypted" in request.socket && request.socket.encrypted === true ? "https" : "http"}://${request.headers.host ?? "localhost"}`;
|
|
44
|
+
const url = new URL(request.originalUrl ?? request.url ?? "/", origin);
|
|
45
|
+
const method = request.method ?? "GET";
|
|
46
|
+
const init = {
|
|
47
|
+
headers: webHeaders(request),
|
|
48
|
+
method,
|
|
49
|
+
signal: closeSignal(response)
|
|
50
|
+
};
|
|
51
|
+
if (method === "GET" || method === "HEAD") return new Request(url, init);
|
|
52
|
+
const body = await readBody(request);
|
|
53
|
+
if (body === null) return errorResponse(BODY_LIMIT_ERROR, 413);
|
|
54
|
+
return new Request(url, {
|
|
55
|
+
...init,
|
|
56
|
+
body
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
async function sendWebResponse(response, serverResponse) {
|
|
60
|
+
serverResponse.statusCode = response.status;
|
|
61
|
+
for (const [name, value] of response.headers) serverResponse.setHeader(name, value);
|
|
62
|
+
serverResponse.end(Buffer.from(await response.arrayBuffer()));
|
|
63
|
+
}
|
|
64
|
+
// src/server/vite.ts
|
|
65
|
+
async function answer(handler, exchange) {
|
|
66
|
+
const { request, response } = exchange;
|
|
67
|
+
if (!isLoopbackAddress(request.socket.remoteAddress)) return errorResponse("Retouche only answers this machine.", 403);
|
|
68
|
+
const webRequest = await toWebRequest(request, response);
|
|
69
|
+
return webRequest instanceof Request ? await handler(webRequest) : webRequest;
|
|
70
|
+
}
|
|
71
|
+
async function serveRequest(handler, exchange) {
|
|
72
|
+
try {
|
|
73
|
+
await sendWebResponse(await answer(handler, exchange), exchange.response);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
exchange.next(error);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function retouche(options = {}) {
|
|
79
|
+
let handler = null;
|
|
80
|
+
return {
|
|
81
|
+
apply: "serve",
|
|
82
|
+
configResolved(config) {
|
|
83
|
+
handler = createRouteHandler({
|
|
84
|
+
...options,
|
|
85
|
+
root: options.root ?? config.root
|
|
86
|
+
}, withEnvFiles(loadEnv(config.mode, config.envDir, ""), options));
|
|
87
|
+
},
|
|
88
|
+
configureServer(server) {
|
|
89
|
+
server.middlewares.use(ROUTE_BASE, (request, response, next) => {
|
|
90
|
+
if (handler === null) {
|
|
91
|
+
next();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
serveRequest(handler, {
|
|
95
|
+
next,
|
|
96
|
+
request,
|
|
97
|
+
response
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
name: "retouche"
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export { retouche };
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { n as recordedMs, r as pendingPassages, t as clock } from "./clock-DPQ0w5RJ.js";
|
|
2
|
+
// src/voice/follow-prompt.ts
|
|
3
|
+
const FOLLOW_TOOL = "next_feedback";
|
|
4
|
+
const FOLLOW_PROMPT = "follow";
|
|
5
|
+
const GOAL = "Follow my Retouche voice session and make each change I ask for while I talk.";
|
|
6
|
+
const UNTIL_ENDED = "Each card says what it needs: a new change to make, a revised one to adjust, or one I took back to undo. Make only that change, nothing beyond it. Keep going until it says the session ended.";
|
|
7
|
+
function followCommand(setup, verb) {
|
|
8
|
+
return `${setup.command} ${verb} --project ${setup.project}`;
|
|
9
|
+
}
|
|
10
|
+
function shellFollowPrompt(next) {
|
|
11
|
+
return [
|
|
12
|
+
GOAL,
|
|
13
|
+
`1. Run \`${next}\` and let it run for up to a minute. It waits for the next feedback card from the session I'm recording and prints it: my words, the element I pointed at, its call site and a screenshot.`,
|
|
14
|
+
"2. Make the change the card asks for.",
|
|
15
|
+
`3. Run \`${next} --applied <id> --note "<what you changed>"\` to report it and wait for the next card. Use \`--skipped\` with the reason when it needs a decision from me, and \`--reverted\` once you've undone a change I took back.`,
|
|
16
|
+
UNTIL_ENDED
|
|
17
|
+
].join("\n\n");
|
|
18
|
+
}
|
|
19
|
+
function mcpFollowPrompt() {
|
|
20
|
+
return [
|
|
21
|
+
GOAL,
|
|
22
|
+
`1. Call the \`${FOLLOW_TOOL}\` tool. It waits for the next feedback card from the session I'm recording and returns it: my words, the element I pointed at, its call site and a screenshot.`,
|
|
23
|
+
"2. Make the change the card asks for.",
|
|
24
|
+
`3. Call \`${FOLLOW_TOOL}\` again with \`report: { id, outcome: "applied", note: "<what you changed>" }\` to report it and wait for the next card. Use the outcome "skipped" with the reason when it needs a decision from me, and "reverted" once you've undone a change I took back.`,
|
|
25
|
+
UNTIL_ENDED
|
|
26
|
+
].join("\n\n");
|
|
27
|
+
}
|
|
28
|
+
// src/voice/review-items.ts
|
|
29
|
+
function pointedAt(session, momentId) {
|
|
30
|
+
const moment = session.moments.find(({ id }) => id === momentId) ?? null;
|
|
31
|
+
return {
|
|
32
|
+
moment,
|
|
33
|
+
screenshot: session.shots.find(({ id }) => id === moment?.shotId)?.path ?? null
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function feedbackItems(session) {
|
|
37
|
+
return session.feedback.map((feedback) => {
|
|
38
|
+
const passages = session.passages.filter((passage) => feedback.passageIds.includes(passage.id));
|
|
39
|
+
const pointed = pointedAt(session, feedback.momentId);
|
|
40
|
+
const { moment } = pointed;
|
|
41
|
+
const starts = passages.map((passage) => passage.startMs);
|
|
42
|
+
return {
|
|
43
|
+
...pointed,
|
|
44
|
+
detail: feedback.detail,
|
|
45
|
+
figure: feedback.figure,
|
|
46
|
+
id: feedback.id,
|
|
47
|
+
kind: "feedback",
|
|
48
|
+
page: moment?.page ?? passages[0]?.page ?? "",
|
|
49
|
+
quote: feedback.quote,
|
|
50
|
+
saidAtMs: starts.length > 0 ? Math.min(...starts) : moment?.atMs ?? 0,
|
|
51
|
+
title: feedback.title
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function reviewItems(session) {
|
|
56
|
+
const passages = pendingPassages(session).map((passage) => ({
|
|
57
|
+
...pointedAt(session, passage.momentIds[0]),
|
|
58
|
+
id: passage.id,
|
|
59
|
+
kind: "passage",
|
|
60
|
+
page: passage.page,
|
|
61
|
+
quote: passage.text,
|
|
62
|
+
saidAtMs: passage.startMs
|
|
63
|
+
}));
|
|
64
|
+
return [...feedbackItems(session), ...passages].toSorted((first, second) => first.saidAtMs - second.saidAtMs);
|
|
65
|
+
}
|
|
66
|
+
// src/client/renders/render-facts.ts
|
|
67
|
+
const STRING_LENGTH = 24;
|
|
68
|
+
const SHOWN_TEXT = {
|
|
69
|
+
array: ({ length }) => `[${length} ${length === 1 ? "item" : "items"}]`,
|
|
70
|
+
element: ({ name }) => name === null ? "<element>" : `<${name}>`,
|
|
71
|
+
function: ({ name }) => name === null ? "ƒ" : `ƒ ${name}`,
|
|
72
|
+
object: () => "{…}",
|
|
73
|
+
primitive: ({ text }) => text,
|
|
74
|
+
string: ({ text }) => text.length > STRING_LENGTH ? `"${text.slice(0, 23)}…"` : `"${text}"`
|
|
75
|
+
};
|
|
76
|
+
function shownText(kind, value) {
|
|
77
|
+
return SHOWN_TEXT[kind](value);
|
|
78
|
+
}
|
|
79
|
+
function describeChange(change) {
|
|
80
|
+
if (change.kind === "new-function") return change.isSameCode ? "new function, same code" : "new function";
|
|
81
|
+
if (change.kind === "same-contents") return `new ${change.container}, same contents`;
|
|
82
|
+
const { from, to } = change;
|
|
83
|
+
return `${shownText(from.kind, from)} → ${shownText(to.kind, to)}`;
|
|
84
|
+
}
|
|
85
|
+
function lastFacts(last) {
|
|
86
|
+
if (last.kind === "mount") return [{
|
|
87
|
+
description: "mount",
|
|
88
|
+
name: null
|
|
89
|
+
}];
|
|
90
|
+
const facts = [
|
|
91
|
+
...last.props.map(({ change, name }) => ({
|
|
92
|
+
change,
|
|
93
|
+
name
|
|
94
|
+
})),
|
|
95
|
+
...last.state.map((state) => ({
|
|
96
|
+
change: state.change,
|
|
97
|
+
name: state.kind === "hook" ? `state ${state.index}` : `state.${state.key}`
|
|
98
|
+
})),
|
|
99
|
+
...last.contexts.map(({ change, name }) => ({
|
|
100
|
+
change,
|
|
101
|
+
name: name ?? "context"
|
|
102
|
+
}))
|
|
103
|
+
].map(({ change, name }) => ({
|
|
104
|
+
description: describeChange(change),
|
|
105
|
+
name
|
|
106
|
+
}));
|
|
107
|
+
if (facts.length > 0) return facts;
|
|
108
|
+
return [{
|
|
109
|
+
description: last.owner === null ? "nothing it receives changed" : `its owner <${last.owner}> rendered it again`,
|
|
110
|
+
name: null
|
|
111
|
+
}];
|
|
112
|
+
}
|
|
113
|
+
function renderFacts(report) {
|
|
114
|
+
return {
|
|
115
|
+
count: `${report.count} since highlighting started`,
|
|
116
|
+
last: report.last === null ? [] : lastFacts(report.last)
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function factText({ description, name }) {
|
|
120
|
+
return name === null ? description : `${name}: ${description}`;
|
|
121
|
+
}
|
|
122
|
+
// src/client/picker/notes/note-format.ts
|
|
123
|
+
function code(tokens) {
|
|
124
|
+
return tokens.map((token) => `\`${token}\``).join(" ");
|
|
125
|
+
}
|
|
126
|
+
function locationText(site) {
|
|
127
|
+
if (!site) return null;
|
|
128
|
+
return site.line === null ? site.path : `${site.path}:${site.line}`;
|
|
129
|
+
}
|
|
130
|
+
function headingOf({ component, tag, text }) {
|
|
131
|
+
const element = component === null ? `<${tag}>` : `<${component}> (${tag})`;
|
|
132
|
+
return text ? `${element} "${text}"` : element;
|
|
133
|
+
}
|
|
134
|
+
function typographyLines(readings) {
|
|
135
|
+
const classed = readings.filter(({ classes }) => classes.length > 0);
|
|
136
|
+
if (classed.length > 0) return classed.map(({ classes, group, value }) => value ? `${group}: ${code(classes)} (${value})` : `${group}: ${code(classes)}`);
|
|
137
|
+
const measured = readings.filter(({ value }) => value).map(({ group, value }) => `${group} ${value}`);
|
|
138
|
+
return measured.length > 0 ? [`Measured: ${measured.join(", ")}`] : [];
|
|
139
|
+
}
|
|
140
|
+
function renderLines(report) {
|
|
141
|
+
if (report === null) return [];
|
|
142
|
+
const { count, last } = renderFacts(report);
|
|
143
|
+
return last.length > 0 ? [`Renders: ${count}`, `Last render: ${last.map(factText).join("; ")}`] : [`Renders: ${count}`];
|
|
144
|
+
}
|
|
145
|
+
function factLines$1({ context, note, sites }) {
|
|
146
|
+
const callSite = locationText(sites?.callSite ?? null);
|
|
147
|
+
const component = locationText(sites?.component ?? null);
|
|
148
|
+
const { classes, override } = context;
|
|
149
|
+
return [
|
|
150
|
+
`Page: ${context.page}`,
|
|
151
|
+
callSite !== null && `Call site: ${callSite}`,
|
|
152
|
+
component !== null && `Component: ${component}`,
|
|
153
|
+
classes.length > 0 && `Classes: ${code(classes)}`,
|
|
154
|
+
...typographyLines(context.typography),
|
|
155
|
+
override && `Override on <${override.component}>: ${code(override.labels)}`,
|
|
156
|
+
...renderLines(context.renders),
|
|
157
|
+
note && `Note: ${note}`
|
|
158
|
+
].filter((line) => Boolean(line));
|
|
159
|
+
}
|
|
160
|
+
function formatNote(facts, number) {
|
|
161
|
+
const marker = number === void 0 ? "" : `${number}. `;
|
|
162
|
+
const indent = " ".repeat(marker.length);
|
|
163
|
+
const bullets = factLines$1(facts).map((line) => `${indent}- ${line}`.replaceAll("\n", `\n${indent} `));
|
|
164
|
+
return [`${marker}${headingOf(facts.context)}`, ...bullets].join("\n");
|
|
165
|
+
}
|
|
166
|
+
function formatNotes(notes) {
|
|
167
|
+
return notes.map((facts, index) => formatNote(facts, index + 1)).join("\n\n");
|
|
168
|
+
}
|
|
169
|
+
// src/voice/voice-markdown.ts
|
|
170
|
+
const SESSION_DATE = new Intl.DateTimeFormat(void 0, {
|
|
171
|
+
dateStyle: "medium",
|
|
172
|
+
timeStyle: "short"
|
|
173
|
+
});
|
|
174
|
+
const OPENING = "Feedback the developer spoke while pointing at their running app. Make each change in the code. A quoted heading is the developer's own words; Element and Call site name what they pointed at, and each Screenshot file shows it.";
|
|
175
|
+
function siteText(site) {
|
|
176
|
+
return locationText(site && {
|
|
177
|
+
file: null,
|
|
178
|
+
line: site.line,
|
|
179
|
+
path: site.path
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function itemHeading(item) {
|
|
183
|
+
return item.kind === "feedback" ? item.title : `"${item.quote}"`;
|
|
184
|
+
}
|
|
185
|
+
function factLines(item) {
|
|
186
|
+
const element = item.moment?.element ?? null;
|
|
187
|
+
const said = `Said at ${clock(item.saidAtMs)}`;
|
|
188
|
+
const callSite = siteText(element?.callSite ?? null);
|
|
189
|
+
const component = siteText(element?.componentSite ?? null);
|
|
190
|
+
const isFeedback = item.kind === "feedback";
|
|
191
|
+
const screenshot = isFeedback && item.figure !== null ? item.figure : item.screenshot;
|
|
192
|
+
return [
|
|
193
|
+
isFeedback && item.detail && `Change: ${item.detail}`,
|
|
194
|
+
isFeedback ? `${said}: "${item.quote}"` : said,
|
|
195
|
+
element && `Element: ${headingOf(element)}`,
|
|
196
|
+
callSite !== null && `Call site: ${callSite}`,
|
|
197
|
+
component !== null && `Component: ${component}`,
|
|
198
|
+
item.page && `Page: ${item.page}`,
|
|
199
|
+
screenshot !== null && `Screenshot: ${screenshot}`
|
|
200
|
+
].filter((line) => Boolean(line));
|
|
201
|
+
}
|
|
202
|
+
function itemMarkdown(item, number) {
|
|
203
|
+
const marker = `${number}. `;
|
|
204
|
+
const indent = " ".repeat(marker.length);
|
|
205
|
+
const bullets = factLines(item).map((line) => `${indent}- ${line}`);
|
|
206
|
+
return [`${marker}${itemHeading(item)}`, ...bullets].join("\n");
|
|
207
|
+
}
|
|
208
|
+
function cardMarkdown(item) {
|
|
209
|
+
const bullets = factLines(item).map((line) => `- ${line}`);
|
|
210
|
+
return [`### ${itemHeading(item)}`, ...bullets].join("\n");
|
|
211
|
+
}
|
|
212
|
+
function sessionHeading(session) {
|
|
213
|
+
const pages = /* @__PURE__ */ new Set([...session.passages.map(({ page }) => page), ...session.moments.map(({ page }) => page)]);
|
|
214
|
+
return [
|
|
215
|
+
`# Voice session, ${SESSION_DATE.format(session.startedAt)}`,
|
|
216
|
+
clock(recordedMs(session)),
|
|
217
|
+
[...pages].filter(Boolean).join(", ")
|
|
218
|
+
].filter(Boolean).join(" · ");
|
|
219
|
+
}
|
|
220
|
+
function sessionMarkdown(session, items) {
|
|
221
|
+
return [
|
|
222
|
+
sessionHeading(session),
|
|
223
|
+
OPENING,
|
|
224
|
+
...items.map((item, index) => itemMarkdown(item, index + 1))
|
|
225
|
+
].join("\n\n");
|
|
226
|
+
}
|
|
227
|
+
export { formatNote as a, renderFacts as c, FOLLOW_TOOL as d, followCommand as f, siteText as i, reviewItems as l, shellFollowPrompt as m, itemMarkdown as n, formatNotes as o, mcpFollowPrompt as p, sessionMarkdown as r, factText as s, cardMarkdown as t, FOLLOW_PROMPT as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,105 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "retouche-dev",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Dots on every element whose call site overrides your design system's typography.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"design-system",
|
|
7
|
+
"devtools",
|
|
8
|
+
"nextjs",
|
|
9
|
+
"overlay",
|
|
10
|
+
"react",
|
|
11
|
+
"typography",
|
|
12
|
+
"vite"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://retouche.dev",
|
|
15
|
+
"bugs": "https://github.com/damien-schneider/retouche/issues",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "Damien Schneider",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/damien-schneider/retouche.git",
|
|
21
|
+
"directory": "packages/retouche"
|
|
22
|
+
},
|
|
23
|
+
"bin": {
|
|
24
|
+
"retouche": "dist/cli.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"templates",
|
|
29
|
+
"PROMPT.md",
|
|
30
|
+
"THIRD-PARTY-NOTICES.md"
|
|
31
|
+
],
|
|
32
|
+
"type": "module",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./config": {
|
|
39
|
+
"types": "./dist/config.d.ts",
|
|
40
|
+
"default": "./dist/config.js"
|
|
41
|
+
},
|
|
42
|
+
"./hand-arrow": {
|
|
43
|
+
"types": "./dist/hand-arrow.d.ts",
|
|
44
|
+
"default": "./dist/hand-arrow.js"
|
|
45
|
+
},
|
|
46
|
+
"./instrument": {
|
|
47
|
+
"types": "./dist/instrument.d.ts",
|
|
48
|
+
"default": "./dist/instrument.js"
|
|
49
|
+
},
|
|
50
|
+
"./next": {
|
|
51
|
+
"types": "./dist/next.d.ts",
|
|
52
|
+
"default": "./dist/next.js"
|
|
53
|
+
},
|
|
54
|
+
"./theme": {
|
|
55
|
+
"types": "./dist/theme.d.ts",
|
|
56
|
+
"default": "./dist/theme.js"
|
|
57
|
+
},
|
|
58
|
+
"./vite": {
|
|
59
|
+
"types": "./dist/vite.d.ts",
|
|
60
|
+
"default": "./dist/vite.js"
|
|
61
|
+
},
|
|
62
|
+
"./package.json": "./package.json"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsdown",
|
|
66
|
+
"dev": "tsdown --watch",
|
|
67
|
+
"pack": "tsdown && bun pm pack --filename retouche.tgz --quiet",
|
|
68
|
+
"prepublishOnly": "tsdown",
|
|
69
|
+
"test": "vitest run",
|
|
70
|
+
"typecheck": "tsc --noEmit"
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"@agentclientprotocol/sdk": "^2.12.0",
|
|
74
|
+
"zod": "^4.6.5"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"@babel/core": "^7.29.0",
|
|
78
|
+
"@rolldown/plugin-babel": "^0.3.1",
|
|
79
|
+
"@testing-library/dom": "^10.4.2",
|
|
80
|
+
"@testing-library/react": "^16.3.3",
|
|
81
|
+
"@types/babel__core": "^7.20.5",
|
|
82
|
+
"@types/react": "^19.3.0",
|
|
83
|
+
"@types/react-dom": "^19.3.0",
|
|
84
|
+
"@zumer/snapdom": "^3.8.3",
|
|
85
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
86
|
+
"bippy": "^0.7.3",
|
|
87
|
+
"jsdom": "^30.1.0",
|
|
88
|
+
"react": "^19.3.0",
|
|
89
|
+
"react-dom": "^19.3.0",
|
|
90
|
+
"sugar-high": "^2.7.0",
|
|
91
|
+
"tsdown": "^0.23.0",
|
|
92
|
+
"vite": "^8.3.0",
|
|
93
|
+
"vitest": "^5.0.1"
|
|
94
|
+
},
|
|
95
|
+
"peerDependencies": {
|
|
96
|
+
"react": "^19.0.0",
|
|
97
|
+
"react-dom": "^19.0.0",
|
|
98
|
+
"vite": ">=5.0.0"
|
|
99
|
+
},
|
|
100
|
+
"peerDependenciesMeta": {
|
|
101
|
+
"vite": {
|
|
102
|
+
"optional": true
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|