@litfamily/litclaude 1.0.42 → 1.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -0
- package/README.md +8 -8
- package/README_ko-KR.md +8 -8
- package/TRADEMARK.md +12 -0
- package/bin/litclaude-ai.js +58 -5
- package/docs/assets/readme/badge-version.svg +1 -1
- package/docs/hooks.md +35 -6
- package/package.json +2 -1
- package/plugins/litclaude/.claude-plugin/plugin.json +7 -1
- package/plugins/litclaude/agents/korean-prose-editor.md +2 -0
- package/plugins/litclaude/agents/korean-style-analyzer.md +2 -0
- package/plugins/litclaude/agents/librarian-researcher.md +2 -0
- package/plugins/litclaude/agents/lit-executor.md +2 -0
- package/plugins/litclaude/agents/lit-planner.md +2 -0
- package/plugins/litclaude/agents/lit-verifier.md +2 -0
- package/plugins/litclaude/agents/meaning-preservation-auditor.md +2 -0
- package/plugins/litclaude/agents/native-flow-reviewer.md +2 -0
- package/plugins/litclaude/agents/polish-orchestrator.md +2 -0
- package/plugins/litclaude/agents/qa-runner.md +2 -0
- package/plugins/litclaude/agents/quality-reviewer.md +2 -0
- package/plugins/litclaude/bin/litclaude-hook.js +24 -5
- package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
- package/plugins/litclaude/commands/litgoal.md +3 -1
- package/plugins/litclaude/hooks/lit-band-client.mjs +9 -4
- package/plugins/litclaude/hooks/lit-mod.mjs +9 -1
- package/plugins/litclaude/lib/canonical-runtime-commitments.mjs +6 -6
- package/plugins/litclaude/lib/canonical-skill-resources.mjs +49 -46
- package/plugins/litclaude/lib/invite.mjs +131 -0
- package/plugins/litclaude/lib/litgoal/autoloop.mjs +57 -8
- package/plugins/litclaude/lib/litgoal/cli.mjs +62 -1
- package/plugins/litclaude/lib/litgoal/freshness.mjs +55 -0
- package/plugins/litclaude/lib/litgoal/ledger.mjs +1 -1
- package/plugins/litclaude/lib/litgoal/state.mjs +1 -1
- package/plugins/litclaude/lib/litgoal/unknowns.mjs +44 -0
- package/plugins/litclaude/lib/mark-logo.png +0 -0
- package/plugins/litclaude/lib/mark.mjs +375 -0
- package/plugins/litclaude/lib/mod/frame.mjs +88 -19
- package/plugins/litclaude/lib/mod/looks.mjs +13 -0
- package/plugins/litclaude/lib/mod/motion.mjs +5 -0
- package/plugins/litclaude/lib/mod/settings.mjs +5 -2
- package/plugins/litclaude/lib/mod/state.mjs +18 -0
- package/plugins/litclaude/lib/mod/svg-card.mjs +61 -16
- package/plugins/litclaude/lib/mod/timeline.mjs +32 -0
- package/plugins/litclaude/lib/mod/view.mjs +8 -3
- package/plugins/litclaude/lib/official-build.mjs +22 -0
- package/plugins/litclaude/lib/output_mark.py +132 -0
- package/plugins/litclaude/lib/owner-lock.mjs +11 -1
- package/plugins/litclaude/lib/plan-task-rows.mjs +17 -4
- package/plugins/litclaude/lib/render_pages.py +16 -0
- package/plugins/litclaude/lib/rewind/collect.mjs +58 -5
- package/plugins/litclaude/lib/start-work-lifecycle.mjs +45 -10
- package/plugins/litclaude/skills/autoconference/SKILL.md +2 -0
- package/plugins/litclaude/skills/autoresearch/SKILL.md +2 -0
- package/plugins/litclaude/skills/browser-drive/SKILL.md +2 -0
- package/plugins/litclaude/skills/comment-checker/SKILL.md +2 -0
- package/plugins/litclaude/skills/debugging/SKILL.md +2 -0
- package/plugins/litclaude/skills/deep-interview/SKILL.md +2 -0
- package/plugins/litclaude/skills/frontend-ui-ux/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-adhd/SKILL.md +3 -0
- package/plugins/litclaude/skills/lit-brainstorm/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-burnoff/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-burnoff-file/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-code/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-commit/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-comprehend/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-crucible/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-diagram-drawer/SKILL.md +3 -1
- package/plugins/litclaude/skills/lit-diagram-drawer/scripts/export.mjs +35 -1
- package/plugins/litclaude/skills/lit-docx/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-docx/scripts/convert_md_to_docx.py +4 -1
- package/plugins/litclaude/skills/lit-docx/scripts/convert_md_to_pdf.py +2 -0
- package/plugins/litclaude/skills/lit-handoff/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-hijack/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-humanizer/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-init/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-loop/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-plan/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-pptx/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/render-adapter-pptx.js +6 -1
- package/plugins/litclaude/skills/lit-recap/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-schematic/SKILL.md +3 -1
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/sheet.mjs +10 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/svg.mjs +4 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/motion.mjs +5 -2
- package/plugins/litclaude/skills/lit-schematic/scripts/render.mjs +20 -2
- package/plugins/litclaude/skills/lit-scientific-visualization/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-team/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-typographic-motion/SKILL.md +2 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/chrome.mjs +23 -2
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover-capture.mjs +14 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover.mjs +48 -2
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/encode.mjs +8 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/end-card.mjs +128 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/pipeline.mjs +59 -14
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-gate.mjs +7 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage.mjs +29 -7
- package/plugins/litclaude/skills/lit-typographic-motion/references/studio.md +11 -0
- package/plugins/litclaude/skills/litgoal/SKILL.md +53 -1
- package/plugins/litclaude/skills/litresearch/SKILL.md +2 -0
- package/plugins/litclaude/skills/litwork/SKILL.md +2 -0
- package/plugins/litclaude/skills/lsp/SKILL.md +2 -0
- package/plugins/litclaude/skills/lsp-setup/SKILL.md +2 -0
- package/plugins/litclaude/skills/readme-studio/SKILL.md +3 -1
- package/plugins/litclaude/skills/readme-studio/templates/cover-source.json +1 -0
- package/plugins/litclaude/skills/readme-studio/templates/hyperframes-cover/index.html +3 -2
- package/plugins/litclaude/skills/readme-studio/templates/remotion-cover/package-lock.json +3 -3
- package/plugins/litclaude/skills/readme-studio/templates/remotion-cover/package.json +2 -1
- package/plugins/litclaude/skills/readme-studio/templates/remotion-cover/src/index.tsx +4 -3
- package/plugins/litclaude/skills/refactor/SKILL.md +2 -0
- package/plugins/litclaude/skills/review-work/SKILL.md +2 -0
- package/plugins/litclaude/skills/rules/SKILL.md +2 -0
- package/plugins/litclaude/skills/start-work/SKILL.md +7 -0
- package/plugins/litclaude/skills/structural-search/SKILL.md +2 -0
- package/plugins/litclaude/skills/visual-qa/SKILL.md +2 -0
- package/plugins/litclaude/skills/wikify/SKILL.md +2 -0
- package/scripts/doctor.mjs +3 -1
- package/scripts/prepublish-test-gate.mjs +75 -22
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
// The `mark` setting: whether LitClaude's engines tag the files they make. `on` puts an invisible
|
|
2
|
+
// generator tag in every output and a small visible mark on showcase outputs (films, README covers,
|
|
3
|
+
// diagrams, schematics); `meta` keeps only the invisible tag; `off` leaves outputs unmarked.
|
|
4
|
+
// The value lives in LitClaude's own `<litHome>/config.json`, never in Claude Code's settings;
|
|
5
|
+
// LITCLAUDE_MARK overrides it for one run. Anything unreadable reads as `on`. No network, no clock.
|
|
6
|
+
// output_mark.py is the Python engines' copy of the same rules.
|
|
7
|
+
|
|
8
|
+
import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, readSync, renameSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { homedir } from "node:os";
|
|
10
|
+
import { dirname, extname, join, resolve } from "node:path";
|
|
11
|
+
import { fileURLToPath } from "node:url";
|
|
12
|
+
import { crc32 } from "node:zlib";
|
|
13
|
+
|
|
14
|
+
import { STATE_WRITE_FLAG } from "./project-state-root.mjs";
|
|
15
|
+
|
|
16
|
+
export const MARK_MODES = Object.freeze(["on", "meta", "off"]);
|
|
17
|
+
const MAX_CONFIG_BYTES = 64 * 1024;
|
|
18
|
+
const manifestPath = join(dirname(fileURLToPath(import.meta.url)), "..", ".claude-plugin", "plugin.json");
|
|
19
|
+
|
|
20
|
+
export const markLitHome = (env = process.env) => resolve(env.LITCLAUDE_HOME || join(homedir(), ".litclaude"));
|
|
21
|
+
export const markConfigPath = (litHome = markLitHome()) => join(litHome, "config.json");
|
|
22
|
+
|
|
23
|
+
const readConfig = (path) => {
|
|
24
|
+
let fd;
|
|
25
|
+
try {
|
|
26
|
+
if (!lstatSync(path).isFile()) return null;
|
|
27
|
+
fd = openSync(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
28
|
+
const { size } = fstatSync(fd);
|
|
29
|
+
if (size > MAX_CONFIG_BYTES) return null;
|
|
30
|
+
const buffer = Buffer.alloc(size);
|
|
31
|
+
readSync(fd, buffer, 0, size, 0);
|
|
32
|
+
const parsed = JSON.parse(buffer.toString("utf8"));
|
|
33
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
34
|
+
} catch {
|
|
35
|
+
return null;
|
|
36
|
+
} finally {
|
|
37
|
+
if (fd !== undefined) closeSync(fd);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** The mode for this run: LITCLAUDE_MARK when valid, else the stored value, else `on`. */
|
|
42
|
+
export const readMarkMode = ({ env = process.env, litHome = markLitHome(env) } = {}) => {
|
|
43
|
+
const override = String(env.LITCLAUDE_MARK ?? "").trim().toLowerCase();
|
|
44
|
+
if (MARK_MODES.includes(override)) return override;
|
|
45
|
+
const stored = readConfig(markConfigPath(litHome))?.mark;
|
|
46
|
+
return MARK_MODES.includes(stored) ? stored : "on";
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** Stores the mode, keeping the file's other keys; a symlinked config or home is refused, not followed. */
|
|
50
|
+
export const writeMarkMode = (litHome, mode) => {
|
|
51
|
+
if (!MARK_MODES.includes(mode)) throw new Error(`mark takes one of: ${MARK_MODES.join(", ")}`);
|
|
52
|
+
const path = markConfigPath(litHome);
|
|
53
|
+
for (const p of [litHome, path]) {
|
|
54
|
+
try {
|
|
55
|
+
if (lstatSync(p).isSymbolicLink()) throw new Error(`refusing to write the mark setting through a symlink: ${p}`);
|
|
56
|
+
} catch (error) {
|
|
57
|
+
if (error.code !== "ENOENT") throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
mkdirSync(litHome, { recursive: true, mode: 0o700 });
|
|
61
|
+
const next = { ...(readConfig(path) ?? {}), mark: mode };
|
|
62
|
+
const staging = `${path}.${process.pid}.tmp`;
|
|
63
|
+
writeFileSync(staging, `${JSON.stringify(next, null, 2)}\n`, { flag: STATE_WRITE_FLAG, mode: 0o600 });
|
|
64
|
+
renameSync(staging, path);
|
|
65
|
+
return mode;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** `LitClaude <version> · github.com/wjgoarxiv/litclaude`, the version taken from the plugin manifest. */
|
|
69
|
+
export const generatorString = () => {
|
|
70
|
+
const { version } = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
71
|
+
return `LitClaude ${version} · github.com/wjgoarxiv/litclaude`;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const CUSTOM_PART = "docProps/custom.xml";
|
|
75
|
+
const CUSTOM_TYPE = "application/vnd.openxmlformats-officedocument.custom-properties+xml";
|
|
76
|
+
const CUSTOM_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties";
|
|
77
|
+
const FMTID = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}";
|
|
78
|
+
const xmlText = (value) => value.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">");
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The changed package parts that name `generator`: app.xml <Application> and a custom `Generator` property,
|
|
82
|
+
* with the content type and package relationship custom.xml needs. Same rules as output_mark.tag_ooxml_parts.
|
|
83
|
+
*/
|
|
84
|
+
export const tagOoxmlParts = (parts, generator) => {
|
|
85
|
+
const text = xmlText(generator);
|
|
86
|
+
const out = {};
|
|
87
|
+
const app = parts["docProps/app.xml"];
|
|
88
|
+
if (app !== undefined) {
|
|
89
|
+
const tag = `<Application>${text}</Application>`;
|
|
90
|
+
out["docProps/app.xml"] = /<Application[>/]/u.test(app)
|
|
91
|
+
? app.replace(/<Application>[^<]*<\/Application>|<Application\/>/u, tag)
|
|
92
|
+
: app.replace("</Properties>", `${tag}</Properties>`);
|
|
93
|
+
}
|
|
94
|
+
const prop = `<vt:lpwstr>${text}</vt:lpwstr></property>`;
|
|
95
|
+
const custom = parts[CUSTOM_PART];
|
|
96
|
+
if (custom === undefined) {
|
|
97
|
+
out[CUSTOM_PART] = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n'
|
|
98
|
+
+ '<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties" '
|
|
99
|
+
+ 'xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">'
|
|
100
|
+
+ `<property fmtid="${FMTID}" pid="2" name="Generator">${prop}</Properties>`;
|
|
101
|
+
} else {
|
|
102
|
+
const existing = custom.match(/(<property [^>]*name="Generator"[^>]*>)[\s\S]*?<\/property>/u);
|
|
103
|
+
if (existing) out[CUSTOM_PART] = custom.replace(existing[0], existing[1] + prop);
|
|
104
|
+
else {
|
|
105
|
+
const pid = Math.max(1, ...[...custom.matchAll(/\bpid="(\d+)"/gu)].map((m) => Number(m[1]))) + 1;
|
|
106
|
+
out[CUSTOM_PART] = custom.replace("</Properties>", `<property fmtid="${FMTID}" pid="${pid}" name="Generator">${prop}</Properties>`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const types = parts["[Content_Types].xml"];
|
|
110
|
+
if (!types.includes(`PartName="/${CUSTOM_PART}"`)) {
|
|
111
|
+
out["[Content_Types].xml"] = types.replace("</Types>", `<Override PartName="/${CUSTOM_PART}" ContentType="${CUSTOM_TYPE}"/></Types>`);
|
|
112
|
+
}
|
|
113
|
+
const rels = parts["_rels/.rels"];
|
|
114
|
+
if (!rels.includes(`Target="${CUSTOM_PART}"`) && !rels.includes(`Target="/${CUSTOM_PART}"`)) {
|
|
115
|
+
const rid = `rId${Math.max(0, ...[...rels.matchAll(/Id="rId(\d+)"/gu)].map((m) => Number(m[1]))) + 1}`;
|
|
116
|
+
out["_rels/.rels"] = rels.replace("</Relationships>", `<Relationship Id="${rid}" Type="${CUSTOM_REL}" Target="${CUSTOM_PART}"/></Relationships>`);
|
|
117
|
+
}
|
|
118
|
+
return out;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/** Tags an OOXML package held in a JSZip instance when this run's mode is `on` or `meta`. */
|
|
122
|
+
export const tagOoxmlZip = async (zip, options) => {
|
|
123
|
+
const { generator } = markPlan(options);
|
|
124
|
+
if (!generator) return;
|
|
125
|
+
const parts = {};
|
|
126
|
+
for (const name of ["docProps/app.xml", CUSTOM_PART, "[Content_Types].xml", "_rels/.rels"]) {
|
|
127
|
+
if (zip.file(name)) parts[name] = await zip.file(name).async("string");
|
|
128
|
+
}
|
|
129
|
+
for (const [name, xml] of Object.entries(tagOoxmlParts(parts, generator))) zip.file(name, xml);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The visible mark every showcase engine draws (approved by the user on 2026-10-28 from task-6-mock): the text,
|
|
134
|
+
* Pretendard 500 with 0.02 em tracking, a corner size of 1.6 % of the short side (never under 11 px) at 60 %
|
|
135
|
+
* opacity, a film end card of about 0.5 s after the last beat, and ink taken from the output's own ground,
|
|
136
|
+
* pushed 72 % toward black on a light ground or white on a dark one. The flame logo (lib/mark-logo.png, the plugin
|
|
137
|
+
* icon at 96 px; chosen by the user on 2026-10-30) sits left of the text at 1.3 x the font size, 0.35 em away,
|
|
138
|
+
* in its own colours at the same opacity.
|
|
139
|
+
*/
|
|
140
|
+
export const WORDMARK = Object.freeze({
|
|
141
|
+
text: "made with LitClaude",
|
|
142
|
+
font: "Pretendard",
|
|
143
|
+
weight: 500,
|
|
144
|
+
tracking: 0.02,
|
|
145
|
+
cornerShare: 0.016,
|
|
146
|
+
minPx: 11,
|
|
147
|
+
insetShare: 0.025,
|
|
148
|
+
cornerOpacity: 0.6,
|
|
149
|
+
endCardSec: 0.5,
|
|
150
|
+
endCardFadeSec: 0.12,
|
|
151
|
+
endCardShare: 0.022,
|
|
152
|
+
inkPush: 0.72,
|
|
153
|
+
logoScale: 1.3,
|
|
154
|
+
logoGap: 0.35,
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
const logoPath = join(dirname(fileURLToPath(import.meta.url)), "mark-logo.png");
|
|
158
|
+
/** The flame logo as a `data:image/png` URI, so an SVG or a page carries it without a sibling file. */
|
|
159
|
+
export const markLogoDataUri = () => `data:image/png;base64,${readFileSync(logoPath).toString("base64")}`;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* The logo's box for a mark whose text ends at `x` on baseline `y` with `fontSize` and `textWidth`:
|
|
163
|
+
* left of the text, centred on its x-height band.
|
|
164
|
+
*/
|
|
165
|
+
export const markLogoBox = ({ x, y, fontSize, textWidth }) => {
|
|
166
|
+
const size = WORDMARK.logoScale * fontSize;
|
|
167
|
+
return { x: x - textWidth - WORDMARK.logoGap * fontSize - size, y: y - 0.36 * fontSize - size / 2, size };
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/** An SVG <image> element for the logo box, at the mark's opacity. */
|
|
171
|
+
export const markLogoSvg = ({ x, y, size }) =>
|
|
172
|
+
`<image data-litclaude-mark-logo="1" x="${x.toFixed(2)}" y="${y.toFixed(2)}" width="${size.toFixed(2)}" height="${size.toFixed(2)}" opacity="${WORDMARK.cornerOpacity}" href="${markLogoDataUri()}"/>`;
|
|
173
|
+
|
|
174
|
+
/** The mark's ink for a ground colour [r, g, b] (0-255): the ground pushed toward black or white. */
|
|
175
|
+
export const markInk = ([r, g, b]) => {
|
|
176
|
+
const target = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255 > 0.5 ? 0 : 255;
|
|
177
|
+
return [r, g, b].map((v) => Math.round(v + (target - v) * WORDMARK.inkPush));
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Where a corner mark of `boxW` x `boxH` pixels fits on a raster without touching anything drawn: the clear box
|
|
182
|
+
* (no pixel within `pad` that departs from the box's median luminance by more than 0.08) nearest the anchor
|
|
183
|
+
* (`bottom-right` or `bottom-centre`), searched over the bottom quarter and kept out of every `exclude` box.
|
|
184
|
+
* Returns { x, y (top-left of the text box), ground [r, g, b], ink } or null when no clear spot exists.
|
|
185
|
+
* `image` is { width, height, channels (3 or 4), pixels }.
|
|
186
|
+
*/
|
|
187
|
+
// How far (in luminance, 0-1) a pixel may stray from the box's median and still count as ground: a quiet
|
|
188
|
+
// pattern such as soft stripes or a gradient stays under it; type and drawn art (0.3 and more) do not.
|
|
189
|
+
const GROUND_TOLERANCE = 0.2;
|
|
190
|
+
export const findClearSpot = (image, { boxW, boxH, inset, pad = 0, anchor = "bottom-right", exclude = [] }) => {
|
|
191
|
+
const { width, height, channels, pixels } = image;
|
|
192
|
+
const stats = (x0, y0, x1, y1) => {
|
|
193
|
+
const lums = [];
|
|
194
|
+
let r = 0, g = 0, b = 0;
|
|
195
|
+
for (let y = Math.max(0, Math.floor(y0)); y < Math.min(height, y1); y += 2) {
|
|
196
|
+
for (let x = Math.max(0, Math.floor(x0)); x < Math.min(width, x1); x += 2) {
|
|
197
|
+
const o = (y * width + x) * channels;
|
|
198
|
+
r += pixels[o]; g += pixels[o + 1]; b += pixels[o + 2];
|
|
199
|
+
lums.push((0.2126 * pixels[o] + 0.7152 * pixels[o + 1] + 0.0722 * pixels[o + 2]) / 255);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const median = [...lums].sort((p, q) => p - q)[lums.length >> 1];
|
|
203
|
+
return { ink: lums.filter((l) => Math.abs(l - median) > GROUND_TOLERANCE).length / lums.length, ground: [r, g, b].map((v) => Math.round(v / lums.length)) };
|
|
204
|
+
};
|
|
205
|
+
const ax = anchor === "bottom-right" ? width - inset - boxW / 2 : width / 2;
|
|
206
|
+
const ay = height - inset - boxH / 2;
|
|
207
|
+
let best = null;
|
|
208
|
+
const step = Math.max(2, Math.round(boxH / 4));
|
|
209
|
+
for (let y = height - inset - boxH; y >= height * 0.72; y -= step) {
|
|
210
|
+
for (let x = inset; x <= width - inset - boxW; x += step) {
|
|
211
|
+
const box = [x - pad, y - pad, x + boxW + pad, y + boxH + pad];
|
|
212
|
+
if (exclude.some((e) => e[0] < box[2] && e[2] > box[0] && e[1] < box[3] && e[3] > box[1])) continue;
|
|
213
|
+
const d = Math.hypot(x + boxW / 2 - ax, (y + boxH / 2 - ay) * 2);
|
|
214
|
+
if (best && d >= best.d) continue;
|
|
215
|
+
const s = stats(...box);
|
|
216
|
+
if (s.ink < 0.004) best = { x, y, d, ground: s.ground };
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return best ? { x: best.x, y: best.y, ground: best.ground, ink: markInk(best.ground) } : null;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/** What an engine should do for this run: `meta` (invisible tag) and `visible` (showcase mark). */
|
|
223
|
+
export const markPlan = (options) => {
|
|
224
|
+
const mode = readMarkMode(options);
|
|
225
|
+
return { mode, meta: mode !== "off", visible: mode === "on", generator: mode === "off" ? null : generatorString() };
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
// ── Media outputs ───────────────────────────────────────────────────────────
|
|
229
|
+
// Every tag is a fixed string: no time, no random value, so deterministic renders stay deterministic.
|
|
230
|
+
|
|
231
|
+
const PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
232
|
+
const pngChunk = (type, data) => {
|
|
233
|
+
const head = Buffer.alloc(8);
|
|
234
|
+
head.writeUInt32BE(data.length, 0);
|
|
235
|
+
head.write(type, 4, "latin1");
|
|
236
|
+
const crc = Buffer.alloc(4);
|
|
237
|
+
crc.writeUInt32BE(crc32(Buffer.concat([head.subarray(4), data])) >>> 0, 0);
|
|
238
|
+
return Buffer.concat([head, data, crc]);
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
/** A PNG with one `tEXt` `Software` chunk naming `generator`, just before IEND (an earlier one is replaced). */
|
|
242
|
+
export const tagPngBuffer = (buf, generator) => {
|
|
243
|
+
if (buf.length < 8 || !buf.subarray(0, 8).equals(PNG_SIGNATURE)) throw new Error("not a PNG file");
|
|
244
|
+
const kept = [];
|
|
245
|
+
let end = null;
|
|
246
|
+
for (let o = 8; o + 12 <= buf.length;) {
|
|
247
|
+
const len = buf.readUInt32BE(o);
|
|
248
|
+
if (o + 12 + len > buf.length) throw new Error("not a PNG file (a chunk runs past the end)");
|
|
249
|
+
const type = buf.toString("latin1", o + 4, o + 8);
|
|
250
|
+
const whole = buf.subarray(o, o + 12 + len);
|
|
251
|
+
if (type === "IEND") { end = whole; break; }
|
|
252
|
+
const software = type === "tEXt" && buf.toString("latin1", o + 8, o + 17) === "Software\0";
|
|
253
|
+
if (!software) kept.push(whole);
|
|
254
|
+
o += 12 + len;
|
|
255
|
+
}
|
|
256
|
+
if (!end) throw new Error("not a PNG file (no IEND)");
|
|
257
|
+
return Buffer.concat([PNG_SIGNATURE, ...kept, pngChunk("tEXt", Buffer.from(`Software\0${generator}`, "latin1")), end]);
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
/** A GIF with one comment extension naming `generator`, right after the header and global colour table. */
|
|
261
|
+
export const tagGifBuffer = (buf, generator) => {
|
|
262
|
+
if (buf.length < 13 || !/^GIF8[79]a$/u.test(buf.toString("latin1", 0, 6))) throw new Error("not a GIF file");
|
|
263
|
+
const flags = buf[10];
|
|
264
|
+
const head = 13 + (flags & 0x80 ? 3 * 2 ** ((flags & 0x07) + 1) : 0);
|
|
265
|
+
const text = Buffer.from(generator, "utf8");
|
|
266
|
+
const blocks = [];
|
|
267
|
+
for (let o = 0; o < text.length; o += 255) {
|
|
268
|
+
const part = text.subarray(o, o + 255);
|
|
269
|
+
blocks.push(Buffer.from([part.length]), part);
|
|
270
|
+
}
|
|
271
|
+
const comment = Buffer.concat([Buffer.from([0x21, 0xfe]), ...blocks, Buffer.from([0])]);
|
|
272
|
+
const rest = buf.subarray(head);
|
|
273
|
+
if (rest.subarray(0, comment.length).equals(comment)) return buf;
|
|
274
|
+
return Buffer.concat([buf.subarray(0, head), comment, rest]);
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const xmpPacket = (generator) => Buffer.from(
|
|
278
|
+
`<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?><x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">`
|
|
279
|
+
+ `<rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/"><xmp:CreatorTool>${xmlText(generator)}</xmp:CreatorTool></rdf:Description>`
|
|
280
|
+
+ "</rdf:RDF></x:xmpmeta><?xpacket end=\"r\"?>", "utf8");
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* An extended (VP8X) WebP — every animated WebP the engines write — with an `XMP ` chunk naming `generator`
|
|
284
|
+
* and the XMP flag set; an earlier XMP chunk is replaced. A simple-format still has no room for metadata
|
|
285
|
+
* without re-encoding its header, so it is returned unchanged.
|
|
286
|
+
*/
|
|
287
|
+
export const tagWebpBuffer = (buf, generator) => {
|
|
288
|
+
if (buf.length < 20 || buf.toString("latin1", 0, 4) !== "RIFF" || buf.toString("latin1", 8, 12) !== "WEBP") throw new Error("not a WebP file");
|
|
289
|
+
if (buf.toString("latin1", 12, 16) !== "VP8X") return buf;
|
|
290
|
+
const chunks = [];
|
|
291
|
+
for (let o = 12; o + 8 <= buf.length;) {
|
|
292
|
+
const size = buf.readUInt32LE(o + 4);
|
|
293
|
+
const type = buf.toString("latin1", o, o + 4);
|
|
294
|
+
if (type !== "XMP ") chunks.push(Buffer.from(buf.subarray(o, o + 8 + size + (size & 1))));
|
|
295
|
+
o += 8 + size + (size & 1);
|
|
296
|
+
}
|
|
297
|
+
chunks[0][8] |= 0x04;
|
|
298
|
+
const xmp = xmpPacket(generator);
|
|
299
|
+
const head = Buffer.alloc(8);
|
|
300
|
+
head.write("XMP ", 0, "latin1");
|
|
301
|
+
head.writeUInt32LE(xmp.length, 4);
|
|
302
|
+
chunks.push(head, xmp, xmp.length & 1 ? Buffer.alloc(1) : Buffer.alloc(0));
|
|
303
|
+
const body = Buffer.concat(chunks);
|
|
304
|
+
const riff = Buffer.alloc(12);
|
|
305
|
+
riff.write("RIFF", 0, "latin1");
|
|
306
|
+
riff.writeUInt32LE(4 + body.length, 4);
|
|
307
|
+
riff.write("WEBP", 8, "latin1");
|
|
308
|
+
const out = Buffer.concat([riff, body]);
|
|
309
|
+
return out.equals(buf) ? buf : out;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
/** An SVG with one `<metadata id="litclaude-generator">` right after its root element (an earlier one is replaced). */
|
|
313
|
+
export const svgWithMetadata = (svg, generator) => {
|
|
314
|
+
const tag = `<metadata id="litclaude-generator">${xmlText(generator)}</metadata>`;
|
|
315
|
+
const cleaned = svg.replace(/<metadata id="litclaude-generator">[^<]*<\/metadata>/u, "");
|
|
316
|
+
return cleaned.replace(/<svg\b[^>]*>/u, (root) => root + tag);
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
/** ffmpeg arguments that name the generator in a video container's `comment`; none when the mode is off. */
|
|
320
|
+
export const ffmpegMetadataArgs = (options) => {
|
|
321
|
+
const { generator } = markPlan(options);
|
|
322
|
+
return generator ? ["-metadata", `comment=${generator}`] : [];
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
const pdfText = (value) => `<FEFF${Buffer.from(value, "utf16le").swap16().toString("hex").toUpperCase()}>`;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* A PDF whose Info dictionary names `generator` as Creator and Producer, added as a standard incremental
|
|
329
|
+
* update (new Info object, xref section, trailer with /Prev); the original bytes stay in front unchanged.
|
|
330
|
+
* Only a file whose last cross-reference is a classic `xref` table is updated: one that ends in a
|
|
331
|
+
* cross-reference stream is returned unchanged. A file already carrying this generator is returned as it is.
|
|
332
|
+
*/
|
|
333
|
+
export const tagPdfBuffer = (buf, generator) => {
|
|
334
|
+
if (buf.toString("latin1", 0, 5) !== "%PDF-") throw new Error("not a PDF file");
|
|
335
|
+
const tail = buf.toString("latin1", Math.max(0, buf.length - 4096));
|
|
336
|
+
const prev = Number(tail.match(/startxref\s+(\d+)\s+%%EOF\s*$/u)?.[1]);
|
|
337
|
+
if (!Number.isInteger(prev) || buf.toString("latin1", prev, prev + 4) !== "xref") return buf;
|
|
338
|
+
const value = pdfText(generator);
|
|
339
|
+
const trailer = buf.toString("latin1", prev).match(/trailer\s*<<([\s\S]*?)>>\s*startxref/u)?.[1];
|
|
340
|
+
if (!trailer) return buf;
|
|
341
|
+
const size = Number(trailer.match(/\/Size\s+(\d+)/u)?.[1]);
|
|
342
|
+
const root = trailer.match(/\/Root\s+(\d+\s+\d+\s+R)/u)?.[1];
|
|
343
|
+
if (!size || !root) return buf;
|
|
344
|
+
const info = trailer.match(/\/Info\s+(\d+)\s+0\s+R/u)?.[1];
|
|
345
|
+
if (info && buf.toString("latin1").includes(`${info} 0 obj\n<</Creator ${value} /Producer ${value}>>`)) return buf;
|
|
346
|
+
const id = trailer.match(/\/ID\s*(\[[^\]]*\])/u)?.[1];
|
|
347
|
+
const sep = buf.at(-1) === 0x0a ? "" : "\n";
|
|
348
|
+
const object = `${sep}${size} 0 obj\n<</Creator ${value} /Producer ${value}>>\nendobj\n`;
|
|
349
|
+
const objectAt = buf.length + Buffer.byteLength(sep);
|
|
350
|
+
const xrefAt = buf.length + Buffer.byteLength(object);
|
|
351
|
+
const update = `${object}xref\n${size} 1\n${String(objectAt).padStart(10, "0")} 00000 n \ntrailer\n<</Size ${size + 1} /Root ${root} /Info ${size} 0 R${id ? ` /ID ${id}` : ""} /Prev ${prev}>>\nstartxref\n${xrefAt}\n%%EOF\n`;
|
|
352
|
+
return Buffer.concat([buf, Buffer.from(update, "latin1")]);
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
const TAGGERS = { ".png": tagPngBuffer, ".gif": tagGifBuffer, ".webp": tagWebpBuffer, ".pdf": tagPdfBuffer };
|
|
356
|
+
|
|
357
|
+
// `node lib/mark.mjs` prints this run's plan as JSON, for skills whose outputs are assembled outside an engine
|
|
358
|
+
// (readme-studio covers): { mode, visible, generator, text, logo, logoScale, logoGap }, where `logo` is the flame
|
|
359
|
+
// PNG's path. It reads only the setting; it writes nothing.
|
|
360
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
361
|
+
const { mode, visible, generator } = markPlan();
|
|
362
|
+
process.stdout.write(`${JSON.stringify({ mode, visible, generator, text: WORDMARK.text, logo: logoPath, logoScale: WORDMARK.logoScale, logoGap: WORDMARK.logoGap })}\n`);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/** Tags a file the engine just wrote (png, gif, webp, svg) in place; returns whether the mode asked for it. */
|
|
366
|
+
export const tagFile = (file, options) => {
|
|
367
|
+
const { generator } = markPlan(options);
|
|
368
|
+
if (!generator) return false;
|
|
369
|
+
const ext = extname(file).toLowerCase();
|
|
370
|
+
const before = readFileSync(file);
|
|
371
|
+
const after = ext === ".svg" ? Buffer.from(svgWithMetadata(before.toString("utf8"), generator), "utf8") : TAGGERS[ext]?.(before, generator);
|
|
372
|
+
if (!after) return false;
|
|
373
|
+
if (!after.equals(before)) writeFileSync(file, after);
|
|
374
|
+
return true;
|
|
375
|
+
};
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
import { gauge, knownFacts } from "../rewind/gauge.mjs";
|
|
36
36
|
import { textWidth, truncateToWidth } from "./layout.mjs";
|
|
37
|
-
import { LOOKS, laneColor, lookOf } from "./looks.mjs";
|
|
37
|
+
import { CLUB_GLINT, CLUB_GOLD, CLUB_PILL, CLUB_STOPS, LOOKS, laneColor, lookOf } from "./looks.mjs";
|
|
38
38
|
import { barCells, gradientAt, lerpColor, rainbowAt } from "./motion.mjs";
|
|
39
39
|
import { glyphSet } from "./settings.mjs";
|
|
40
40
|
import { formatDuration } from "./view.mjs";
|
|
@@ -142,6 +142,17 @@ const rainbowPill = (text, rainbow, from, glyphs, bold = true) => {
|
|
|
142
142
|
: [span(" ", { bg: rainbowCell(rainbow, at(0)) }), ...body, span(" ", { bg: rainbowCell(rainbow, at(chars.length - 1)) })];
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
+
// The club look's `CLUB ✦`: dark ink on a fill graded gold to rose, a cell at a time, each cap in
|
|
146
|
+
// the colour of the cell beside it.
|
|
147
|
+
const clubPill = (text, glyphs) => {
|
|
148
|
+
const chars = [...text];
|
|
149
|
+
const fill = (i) => gradientAt(CLUB_PILL, chars.length <= 1 ? 0 : i / (chars.length - 1));
|
|
150
|
+
const body = chars.map((ch, i) => span(ch, { fg: PILL.ink, bg: fill(i), bold: true }));
|
|
151
|
+
return glyphs.capLeft
|
|
152
|
+
? [span(glyphs.capLeft, { fg: fill(0) }), ...body, span(glyphs.capRight, { fg: fill(chars.length - 1) })]
|
|
153
|
+
: [span(" ", { bg: fill(0) }), ...body, span(" ", { bg: fill(chars.length - 1) })];
|
|
154
|
+
};
|
|
155
|
+
|
|
145
156
|
const inkOf = (accent) => ({ done: lerpColor(accent, PALETTE.dim, 0.45), now: accent, todo: PALETTE.dim, warn: PALETTE.amber });
|
|
146
157
|
|
|
147
158
|
// Colour of one phase in this frame: the crossfade from its previous state, then the amber mix for
|
|
@@ -220,12 +231,12 @@ const cometOn = (sample, edge, width, look = null) => {
|
|
|
220
231
|
|
|
221
232
|
// While LitClaude works the brand pill breathes from its pink toward the flame orange and back.
|
|
222
233
|
// The rewind look turns it through the rainbow instead, lightened so its dark ink stays readable;
|
|
223
|
-
// YOUR TURN holds it amber.
|
|
234
|
+
// YOUR TURN holds it amber, the club look gold.
|
|
224
235
|
const brandSpans = (sample, glyphs, rainbow = null, look = null) => {
|
|
225
236
|
const reveal = revealText("🔥 LIT", sample.pills[0]);
|
|
226
237
|
if (reveal === null) return [];
|
|
227
238
|
if (rainbow) return rainbowPill(reveal, rainbow, 0, glyphs);
|
|
228
|
-
const fill = look === "turn" ? PALETTE.amber : sample.ambient ? lerpColor(PILL.brand, PALETTE.orange, 0.85 * sample.ambient.breath) : PILL.brand;
|
|
239
|
+
const fill = look === "turn" ? PALETTE.amber : look === "club" ? CLUB_GOLD : sample.ambient ? lerpColor(PILL.brand, PALETTE.orange, 0.85 * sample.ambient.breath) : PILL.brand;
|
|
229
240
|
return pill(litText(reveal, { fg: PILL.ink, bg: fill, bold: true }, sample.completion?.shimmer ?? null), fill, glyphs);
|
|
230
241
|
};
|
|
231
242
|
// `REWIND <<` while the rewind look is on, each letter a step further round the hue wheel, lightened
|
|
@@ -240,6 +251,7 @@ const indicatorSpans = (model, sample, glyphs, accent, rainbow = null, look = nu
|
|
|
240
251
|
const lanes = model.workflow.verdicts;
|
|
241
252
|
return [span(`${LOOKS.review.label} ${lanes.filter(({ state }) => state === "pass" || state === "fail").length}/${lanes.length}`, { fg: accent, bold: true })];
|
|
242
253
|
}
|
|
254
|
+
if (look === "club") return clubPill(`${LOOKS.club.label} ✦`, glyphs);
|
|
243
255
|
if (model.idle) return [span("idle", { fg: PALETTE.dim })];
|
|
244
256
|
const flow = model.workflow;
|
|
245
257
|
if (flow && flow.current >= 0) {
|
|
@@ -258,12 +270,14 @@ const indicatorSpans = (model, sample, glyphs, accent, rainbow = null, look = nu
|
|
|
258
270
|
// then the discipline shortens, then it goes too.
|
|
259
271
|
// A newer LitClaude installed than the one loaded adds `restart to <version>` before the
|
|
260
272
|
// indicator, dropped first when the edge has no room for it.
|
|
273
|
+
// The club look sets a sparkle at each corner of the title: `✧` before the brand, `✦` after the name.
|
|
261
274
|
const topEdge = (model, sample, { width, glyphs, accent, edge, look, paint, rainbow }) => {
|
|
262
|
-
const
|
|
275
|
+
const sparkle = look === "club";
|
|
276
|
+
const brand = [...(sparkle ? [span("✧ ", { fg: CLUB_STOPS[1] })] : []), ...brandSpans(sample, glyphs, rainbow, look)];
|
|
263
277
|
const indicator = indicatorSpans(model, sample, glyphs, accent, rainbow, look);
|
|
264
278
|
const name = model.title ?? "ready";
|
|
265
|
-
const nameStyle = model.idle && !rainbow ? { fg: PALETTE.dim } : { fg: accent, bold: true };
|
|
266
|
-
const title = (text) => (text ? [span(" · ", { fg: PALETTE.dim }), span(text, nameStyle)] : []);
|
|
279
|
+
const nameStyle = look === "club" ? { fg: CLUB_STOPS[1] } : model.idle && !rainbow ? { fg: PALETTE.dim } : { fg: accent, bold: true };
|
|
280
|
+
const title = (text) => (text ? [span(" · ", { fg: PALETTE.dim }), span(text, nameStyle), ...(sparkle ? [span(" ✦", { fg: CLUB_GOLD })] : [])] : []);
|
|
267
281
|
const fixed = textWidth("╭─ ") + rowWidth(brand) + 1 + 1;
|
|
268
282
|
const fits = (spans) => fixed + rowWidth(title(name)) + 1 + rowWidth(spans) + textWidth(" ─╮") <= width;
|
|
269
283
|
const chip = model.restart ? [span(`restart to ${model.restart}`, { fg: PALETTE.amber }), span(" · ", { fg: PALETTE.dim }), ...indicator] : null;
|
|
@@ -701,8 +715,18 @@ const awayHint = (room, accent) => {
|
|
|
701
715
|
return hint ? [span(hint[0], { fg: PALETTE.dim }), span(hint[1], { fg: accent }), ...(hint[2] ? [span(hint[2], { fg: PALETTE.dim })] : [])] : [];
|
|
702
716
|
};
|
|
703
717
|
|
|
718
|
+
// The club card's quiet `invited by @<id>` chip, on the muted pill.
|
|
719
|
+
const inviteChip = (model, glyphs) => (model.invitedBy
|
|
720
|
+
? pill([span("invited by ", { fg: PILL.mutedText, bg: PILL.muted }), span(`@${model.invitedBy}`, { fg: CLUB_STOPS[1], bg: PILL.muted, bold: true })], PILL.muted, glyphs)
|
|
721
|
+
: null);
|
|
722
|
+
// `row` with the chip at its right end, two cells apart at least, or null when they do not both fit.
|
|
723
|
+
const withChip = (row, chip, inner) => (chip && rowWidth(row) + 2 + rowWidth(chip) <= inner
|
|
724
|
+
? fitRow([...row, span(" ".repeat(inner - rowWidth(row) - rowWidth(chip))), ...chip], inner)
|
|
725
|
+
: null);
|
|
726
|
+
|
|
704
727
|
const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
|
|
705
728
|
const chips = model.skills;
|
|
729
|
+
const invite = inviteChip(model, glyphs);
|
|
706
730
|
if (chips.length === 0) {
|
|
707
731
|
if (!model.idle && model.next && !model.workflow?.next) return fitRow([span("▸ ", { fg: accent }), span(truncateToWidth(model.next, inner - 2), { fg: PALETTE.white })], inner);
|
|
708
732
|
if (!model.idle) return fitRow([span("no LitFamily skill yet in this request", { fg: PALETTE.dim })], inner);
|
|
@@ -711,6 +735,10 @@ const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
|
|
|
711
735
|
[span("no skill yet · type ", { fg: PALETTE.dim }), span("lit <task>", { fg: accent })],
|
|
712
736
|
[span("type ", { fg: PALETTE.dim }), span("lit <task>", { fg: accent })],
|
|
713
737
|
];
|
|
738
|
+
for (const hint of hints) {
|
|
739
|
+
const shown = withChip(hint, invite, inner);
|
|
740
|
+
if (shown) return shown;
|
|
741
|
+
}
|
|
714
742
|
return fitRow(hints.find((hint) => rowWidth(hint) <= inner) ?? hints.at(-1), inner);
|
|
715
743
|
}
|
|
716
744
|
const row = inner >= 30 ? [span("skills", { fg: PALETTE.dim })] : [];
|
|
@@ -729,7 +757,7 @@ const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
|
|
|
729
757
|
}
|
|
730
758
|
if (shown < chips.length) row.push(...(row.length ? [span(" ")] : []), ...mutedPill(`+${chips.length - shown}`, glyphs));
|
|
731
759
|
if (model.away) return fitRow([...row, ...awayHint(inner - rowWidth(row), accent)], inner);
|
|
732
|
-
return sparkled(row, inner, sample, rainbow);
|
|
760
|
+
return withChip(row, invite, inner) ?? sparkled(row, inner, sample, rainbow);
|
|
733
761
|
};
|
|
734
762
|
|
|
735
763
|
const noticeRow = (sample, inner) => {
|
|
@@ -800,15 +828,41 @@ const bottomEdge = (model, sample, { width, glyphs, accent, edge, look, paint, r
|
|
|
800
828
|
|
|
801
829
|
// The border: red or amber under a warning, otherwise the accent. Idle it is a calm, dim accent;
|
|
802
830
|
// while LitClaude works it sits a step above the accent and breathes brighter toward white with the
|
|
803
|
-
// brand pill. YOUR TURN breathes amber over TIMINGS.breath, and holds it with motion off.
|
|
831
|
+
// brand pill. YOUR TURN breathes amber over TIMINGS.breath, and holds it with motion off. The club
|
|
832
|
+
// look's border is gold (its rules and sides are painted with CLUB_STOPS).
|
|
804
833
|
const edgeColor = (model, sample, accent, look) => {
|
|
805
834
|
if (model.warnings.some(({ tone }) => tone === "red")) return PALETTE.red;
|
|
806
835
|
if (look === "turn") return sample.ambient ? lerpColor(lerpColor(PALETTE.amber, PALETTE.faint, 0.5), PALETTE.amber, sample.ambient.breath) : PALETTE.amber;
|
|
807
836
|
if (model.warnings.length) return PALETTE.amber;
|
|
837
|
+
if (look === "club") return CLUB_GOLD;
|
|
808
838
|
if (model.idle) return lerpColor(PALETTE.faint, accent, 0.35);
|
|
809
839
|
return lerpColor(accent, "#ffffff", 0.15 + 0.3 * (sample.ambient?.breath ?? 0));
|
|
810
840
|
};
|
|
811
841
|
|
|
842
|
+
// How far the glint's light reaches either side of its centre, in cells.
|
|
843
|
+
const GLINT_REACH = 8;
|
|
844
|
+
|
|
845
|
+
// The club ring's colour at a border cell (`col`, `y`) of a card `width` by `height`: CLUB_STOPS laid
|
|
846
|
+
// clockwise from the top-left corner, so the ring closes gold on gold. `glint` (0 to 1 across its
|
|
847
|
+
// pass, or null) lays a warm white light over the top edge, entering and leaving off the card.
|
|
848
|
+
const clubRing = (width, height, glint) => {
|
|
849
|
+
const right = width - 1;
|
|
850
|
+
const bottom = height - 1;
|
|
851
|
+
const perimeter = 2 * right + 2 * bottom;
|
|
852
|
+
const along = (col, y) => {
|
|
853
|
+
if (y === 0) return col;
|
|
854
|
+
if (y === bottom) return right + bottom + (right - col);
|
|
855
|
+
return col === right ? right + y : 2 * right + bottom + (bottom - y);
|
|
856
|
+
};
|
|
857
|
+
const center = glint === null ? null : glint * (width + 2 * GLINT_REACH) - GLINT_REACH;
|
|
858
|
+
return (col, y) => {
|
|
859
|
+
const base = gradientAt(CLUB_STOPS, along(col, y) / perimeter);
|
|
860
|
+
if (center === null || y !== 0) return base;
|
|
861
|
+
const k = Math.max(0, 1 - Math.abs(col - center) / GLINT_REACH);
|
|
862
|
+
return k > 0 ? lerpColor(base, CLUB_GLINT, 0.8 * k) : base;
|
|
863
|
+
};
|
|
864
|
+
};
|
|
865
|
+
|
|
812
866
|
/**
|
|
813
867
|
* The card for one frame: `{ mode: "card", border, width, rows }`, five rows (top edge, workflow
|
|
814
868
|
* map or phase track, detail line, chips row, bottom edge), with the thread rows between the detail
|
|
@@ -832,19 +886,34 @@ export const composeBand = (model, sample, { columns, glyphs: glyphMode = "basic
|
|
|
832
886
|
const lanes = look === "review" ? model.workflow.verdicts : null;
|
|
833
887
|
const laneAt = (col) => Math.min(lanes.length - 1, Math.floor((col * lanes.length) / width));
|
|
834
888
|
const lanePaint = lanes ? (col) => laneColor(laneAt(col), lanes[laneAt(col)].state) : null;
|
|
835
|
-
const
|
|
836
|
-
const side = (row, r) => (paint[r]
|
|
837
|
-
? [span("│", { fg: paint[r](0) }), span(" "), ...row, span(" "), span("│", { fg: paint[r](width - 1) })]
|
|
838
|
-
: [span("│ ", { fg: edge }), ...row, span(" │", { fg: edge })]);
|
|
839
|
-
const options = { width, inner, glyphs, accent, edge, look, rainbow, paint };
|
|
889
|
+
const options = { width, inner, glyphs, accent, edge, look, rainbow };
|
|
840
890
|
const middle = sample.completion ? completionRow(sample, inner) : sample.notice ? noticeRow(sample, inner) : chipsRow(model, sample, options);
|
|
891
|
+
// The rows between the edges, each with the paint slot its sides take (thread rows share the detail line's).
|
|
892
|
+
const body = [
|
|
893
|
+
[model.workflow ? mapRow(model, sample, options) : phaseRow(model, sample, options), 1],
|
|
894
|
+
[detailRow(model, sample, options), 2],
|
|
895
|
+
...(model.threads ? threadRows(model, sample, options).map((row) => [row, 2]) : []),
|
|
896
|
+
[middle, 3],
|
|
897
|
+
];
|
|
898
|
+
// The club look's ring: its velvet laid clockwise round the whole border, with the glint's light
|
|
899
|
+
// crossing the top edge while a pass runs. Without warnings only; it never touches the body.
|
|
900
|
+
const ring = look === "club" && model.warnings.length === 0 ? clubRing(width, body.length + 2, sample.glint ?? null) : null;
|
|
901
|
+
const paint = [0, 1, 2, 3, 4].map((r) => {
|
|
902
|
+
if (painted) return (col) => rainbow(col / width + r * 0.04);
|
|
903
|
+
if (ring) return r === 0 ? (col) => ring(col, 0) : r === 4 ? (col) => ring(col, body.length + 1) : null;
|
|
904
|
+
return r === 0 || r === 4 ? lanePaint : null;
|
|
905
|
+
});
|
|
906
|
+
const side = (row, r, y) => {
|
|
907
|
+
const at = ring ? (col) => ring(col, y) : paint[r];
|
|
908
|
+
return at
|
|
909
|
+
? [span("│", { fg: at(0) }), span(" "), ...row, span(" "), span("│", { fg: at(width - 1) })]
|
|
910
|
+
: [span("│ ", { fg: edge }), ...row, span(" │", { fg: edge })];
|
|
911
|
+
};
|
|
912
|
+
const edges = { ...options, paint };
|
|
841
913
|
const rows = [
|
|
842
|
-
topEdge(model, sample,
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
...(model.threads ? threadRows(model, sample, options).map((row) => side(row, 2)) : []),
|
|
846
|
-
side(middle, 3),
|
|
847
|
-
bottomEdge(model, sample, options),
|
|
914
|
+
topEdge(model, sample, edges),
|
|
915
|
+
...body.map(([row, r], index) => side(row, r, index + 1)),
|
|
916
|
+
bottomEdge(model, sample, edges),
|
|
848
917
|
];
|
|
849
918
|
return {
|
|
850
919
|
mode: "card",
|
|
@@ -7,14 +7,27 @@
|
|
|
7
7
|
// review review-work: the top and bottom rules split into the five review lanes
|
|
8
8
|
// turn waiting on the user: an amber border breathing over TIMINGS.breath, `YOUR TURN`
|
|
9
9
|
// done a plan, goal, review or release finished: one rainbow spray of embers
|
|
10
|
+
// club the idle card once `lit invite` recorded an inviter (plans/invite-pilot.md): a gold →
|
|
11
|
+
// rose → violet ring round all four borders with a slow gold glint along the top (full
|
|
12
|
+
// motion only), a gold LIT pill, `CLUB ✦` on a gold-gradient pill, sparkles at the
|
|
13
|
+
// title's corners and an `invited by @<id>` chip; below every other look
|
|
10
14
|
|
|
11
15
|
export const LOOKS = Object.freeze({
|
|
12
16
|
rewind: Object.freeze({ label: "REWIND <<", palette: "rainbow", comet: "bottom-leftward", pill: "rainbow" }),
|
|
13
17
|
review: Object.freeze({ label: "REVIEW", palette: "lanes", comet: "none", pill: "accent" }),
|
|
14
18
|
turn: Object.freeze({ label: "YOUR TURN", palette: "amber", comet: "none", pill: "amber" }),
|
|
15
19
|
done: Object.freeze({ label: "DONE", palette: "rainbow", comet: "none", pill: "brand" }),
|
|
20
|
+
club: Object.freeze({ label: "CLUB", palette: "velvet", comet: "none", pill: "gold" }),
|
|
16
21
|
});
|
|
17
22
|
|
|
23
|
+
// The club look's velvet: gold through rose to violet and back to gold, laid round the border so
|
|
24
|
+
// the ring closes in the same colour it starts with. CLUB_GOLD fills its LIT pill under dark ink,
|
|
25
|
+
// CLUB_PILL grades the `CLUB ✦` pill and CLUB_GLINT is the light that runs along the top.
|
|
26
|
+
export const CLUB_STOPS = Object.freeze(["#ffd75f", "#ff8fbf", "#b48cff", "#ff8fbf", "#ffd75f"]);
|
|
27
|
+
export const CLUB_GOLD = "#ffd75f";
|
|
28
|
+
export const CLUB_PILL = Object.freeze(["#ffd75f", "#ffb38a", "#ff8fbf"]);
|
|
29
|
+
export const CLUB_GLINT = "#fff6d6";
|
|
30
|
+
|
|
18
31
|
export const LOOK_BY_SKILL = Object.freeze({ "lit-adhd": "rewind", "lit-rewind": "rewind", "review-work": "review" });
|
|
19
32
|
const BY_SKILL = new Map(Object.entries(LOOK_BY_SKILL));
|
|
20
33
|
|
|
@@ -36,6 +36,11 @@ export const TIMINGS = Object.freeze({
|
|
|
36
36
|
clock: 1000,
|
|
37
37
|
hue: 4800,
|
|
38
38
|
sparks: 3600,
|
|
39
|
+
// The club look's glint along the top border (full motion only): the first pass waits
|
|
40
|
+
// `clubGlintRest`, each pass lasts `clubGlint`, and passes start `clubGlintPeriod` apart.
|
|
41
|
+
clubGlint: 1400,
|
|
42
|
+
clubGlintRest: 1200,
|
|
43
|
+
clubGlintPeriod: 3600,
|
|
39
44
|
});
|
|
40
45
|
|
|
41
46
|
// full: the approved motion, and while LitClaude works the brand breathes, a light sweeps the active
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
// The LIT band's
|
|
1
|
+
// The LIT band's five userConfig options. The manifest declares them as plain strings without an
|
|
2
2
|
// `options` list, because Claude Code 2.1.270 and older refuse a whole plugin whose userConfig has
|
|
3
3
|
// one; the values are checked here instead, and anything unknown falls back to the default (the
|
|
4
4
|
// first choice). `notify` raises a notification through the person's own channel when LIT work
|
|
5
5
|
// completes or a LIT turn longer than three minutes ends; `finish+sound` adds a sound only where
|
|
6
|
-
// the plugin ships one, and none ships yet, so it notifies like `finish`.
|
|
6
|
+
// the plugin ships one, and none ships yet, so it notifies like `finish`. `club` lets an invited
|
|
7
|
+
// card wear the club look while idle (plans/invite-pilot.md).
|
|
7
8
|
|
|
8
9
|
export const MOD_CHOICES = Object.freeze({
|
|
9
10
|
motion: ["full", "subtle", "off"],
|
|
10
11
|
glyphs: ["auto", "nerd", "basic"],
|
|
11
12
|
band: ["always", "auto", "off"],
|
|
12
13
|
notify: ["off", "finish", "finish+sound"],
|
|
14
|
+
club: ["on", "off"],
|
|
13
15
|
});
|
|
14
16
|
|
|
15
17
|
const pick = (value, choices) => {
|
|
@@ -22,6 +24,7 @@ export const normalizeModSettings = (options) => ({
|
|
|
22
24
|
glyphs: pick(options?.glyphs, MOD_CHOICES.glyphs),
|
|
23
25
|
band: pick(options?.band, MOD_CHOICES.band),
|
|
24
26
|
notify: pick(options?.notify, MOD_CHOICES.notify),
|
|
27
|
+
club: pick(options?.club, MOD_CHOICES.club),
|
|
25
28
|
});
|
|
26
29
|
|
|
27
30
|
// Claude Code's own `prefersReducedMotion` setting (/config "Reduce motion") turns the band's motion
|