@litfamily/litclaude 1.0.45 → 1.0.47
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 +26 -0
- package/README.md +8 -8
- package/README_ko-KR.md +8 -8
- package/bin/litclaude-ai.js +10 -4
- package/docs/assets/readme/badge-version.svg +1 -1
- package/package.json +5 -2
- package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
- package/plugins/litclaude/.lsp.json +5 -2
- package/plugins/litclaude/agents/korean-prose-editor.md +0 -1
- package/plugins/litclaude/agents/korean-style-analyzer.md +0 -1
- package/plugins/litclaude/agents/librarian-researcher.md +0 -1
- package/plugins/litclaude/agents/lit-executor.md +0 -1
- package/plugins/litclaude/agents/lit-planner.md +0 -1
- package/plugins/litclaude/agents/lit-verifier.md +0 -1
- package/plugins/litclaude/agents/meaning-preservation-auditor.md +0 -1
- package/plugins/litclaude/agents/native-flow-reviewer.md +0 -1
- package/plugins/litclaude/agents/polish-orchestrator.md +0 -1
- package/plugins/litclaude/agents/qa-runner.md +0 -1
- package/plugins/litclaude/agents/quality-reviewer.md +0 -1
- package/plugins/litclaude/bin/litclaude-lsp-doctor.js +2 -1
- package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
- package/plugins/litclaude/lib/canonical-skill-resources.mjs +8 -8
- package/plugins/litclaude/lib/mod/state.mjs +12 -0
- package/plugins/litclaude/lib/mod/view.mjs +9 -3
- package/plugins/litclaude/lib/rewind/collect.mjs +6 -2
- package/plugins/litclaude/skills/lit-typographic-motion/SKILL.md +1 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover.mjs +1 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-gate.mjs +1 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-serve.mjs +126 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage.mjs +1 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/stage-kit.js +40 -1
- package/plugins/litclaude/skills/lit-typographic-motion/references/stage.md +43 -2
- package/plugins/litclaude/skills/lsp-setup/SKILL.md +8 -5
- package/plugins/litclaude/skills/lsp-setup/references/bash/README.md +2 -1
- package/plugins/litclaude/skills/lsp-setup/references/c-cpp/README.md +5 -4
- package/plugins/litclaude/skills/lsp-setup/references/csharp/README.md +3 -2
- package/plugins/litclaude/skills/lsp-setup/references/dart/README.md +2 -1
- package/plugins/litclaude/skills/lsp-setup/references/elixir/README.md +3 -3
- package/plugins/litclaude/skills/lsp-setup/references/go/README.md +1 -1
- package/plugins/litclaude/skills/lsp-setup/references/haskell/README.md +2 -1
- package/plugins/litclaude/skills/lsp-setup/references/java/README.md +1 -1
- package/plugins/litclaude/skills/lsp-setup/references/julia/README.md +2 -1
- package/plugins/litclaude/skills/lsp-setup/references/kotlin/README.md +1 -1
- package/plugins/litclaude/skills/lsp-setup/references/lua/README.md +1 -1
- package/plugins/litclaude/skills/lsp-setup/references/php/README.md +3 -2
- package/plugins/litclaude/skills/lsp-setup/references/python/README.md +9 -8
- package/plugins/litclaude/skills/lsp-setup/references/ruby/README.md +4 -3
- package/plugins/litclaude/skills/lsp-setup/references/rust/README.md +1 -1
- package/plugins/litclaude/skills/lsp-setup/references/swift/README.md +1 -1
- package/plugins/litclaude/skills/lsp-setup/references/terraform/README.md +2 -1
- package/plugins/litclaude/skills/lsp-setup/references/typescript/README.md +24 -21
- package/plugins/litclaude/skills/lsp-setup/references/yaml/README.md +2 -1
- package/plugins/litclaude/skills/lsp-setup/references/zig/README.md +1 -1
- package/plugins/litclaude/skills/lsp-setup/scripts/detect-lsp.ts +1 -1
- package/plugins/litclaude/skills/lsp-setup/scripts/lsp-server-table.ts +4 -3
- package/plugins/litclaude/skills/lsp-setup/scripts/verify-lsp.ts +3 -2
- package/scripts/prepublish-test-gate.mjs +22 -11
- package/tools/check-model-routing.mjs +15 -15
|
@@ -9,6 +9,7 @@ import { fileURLToPath } from "node:url";
|
|
|
9
9
|
import { EXIT } from "../core/constants.mjs";
|
|
10
10
|
import { readPlate } from "./blender.mjs";
|
|
11
11
|
import { BlockedError } from "./chrome.mjs";
|
|
12
|
+
import { decodePng } from "./png.mjs";
|
|
12
13
|
import { checkFont, fontLocation, fontsDir, loadFontManifest } from "./runtime.mjs";
|
|
13
14
|
|
|
14
15
|
export const STAGE_ORIGIN = "http://lit.stage";
|
|
@@ -28,6 +29,13 @@ export const CONTENT_TYPES = Object.freeze({
|
|
|
28
29
|
});
|
|
29
30
|
export const RASTER = Object.freeze([".png", ".jpg", ".jpeg", ".webp", ".gif"]);
|
|
30
31
|
export const RASTER_LIMITS = Object.freeze({ count: 24, bytes: 8 * 1024 * 1024, flipbook: 10 });
|
|
32
|
+
// Keyed overlay clips (references/stage.md, Clips): frame sequences declared in stage/clips/clips.json
|
|
33
|
+
// are held to these caps instead of RASTER_LIMITS. A clip is a sticker on the film, never the film:
|
|
34
|
+
// 8-bit RGBA PNG frames with real transparency, at most `side` px on the long side, at most 30 fps.
|
|
35
|
+
export const CLIP_LIMITS = Object.freeze({
|
|
36
|
+
clips: 12, framesPerClip: 360, framesTotal: 1500, bytesPerClip: 40 * 1024 * 1024, bytesTotal: 128 * 1024 * 1024, side: 720, fps: 30,
|
|
37
|
+
});
|
|
38
|
+
export const CLIPS_DIR = "clips";
|
|
31
39
|
|
|
32
40
|
// The product's verified faces as CSS families. Archivo's widths are one family at three stretches.
|
|
33
41
|
const FAMILIES = [
|
|
@@ -107,7 +115,7 @@ function pngInfo(b) {
|
|
|
107
115
|
if (type === "IDAT" || type === "IEND") break;
|
|
108
116
|
o += 12 + len;
|
|
109
117
|
}
|
|
110
|
-
return { width: b.readUInt32BE(16), height: b.readUInt32BE(20), animated };
|
|
118
|
+
return { width: b.readUInt32BE(16), height: b.readUInt32BE(20), animated, bitDepth: b[24], colorType: b[25] };
|
|
111
119
|
}
|
|
112
120
|
function jpegInfo(b) {
|
|
113
121
|
if (b[0] !== 0xff || b[1] !== 0xd8) return null;
|
|
@@ -165,6 +173,97 @@ export function rasterInfo(file) {
|
|
|
165
173
|
return null;
|
|
166
174
|
}
|
|
167
175
|
|
|
176
|
+
// ---- declared clips: stage/clips/clips.json and the frame folders it names ----
|
|
177
|
+
const clipFail = (message) => new BlockedError(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${message}`);
|
|
178
|
+
const clipFrame = (i) => `frame_${String(i).padStart(4, "0")}.png`;
|
|
179
|
+
const CLIP_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,39}$/u;
|
|
180
|
+
const CLIP_DIR = /^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/u;
|
|
181
|
+
|
|
182
|
+
/** The clips stage/clips/clips.json declares ([] without the file), checked for shape only. Throws exit 17. */
|
|
183
|
+
export function declaredClips(stageDir, limits = CLIP_LIMITS) {
|
|
184
|
+
const file = path.join(stageDir, CLIPS_DIR, "clips.json");
|
|
185
|
+
if (!existsSync(file)) return [];
|
|
186
|
+
let doc;
|
|
187
|
+
try {
|
|
188
|
+
doc = JSON.parse(readFileSync(file, "utf8"));
|
|
189
|
+
} catch (error) {
|
|
190
|
+
throw clipFail(`${CLIPS_DIR}/clips.json is not valid JSON (${error.message})`);
|
|
191
|
+
}
|
|
192
|
+
if (!doc || !Array.isArray(doc.clips)) throw clipFail(`${CLIPS_DIR}/clips.json needs { "clips": [ { "id", "dir", "count", "fps" } ] }`);
|
|
193
|
+
if (doc.clips.length > limits.clips) throw clipFail(`${doc.clips.length} clips declared (at most ${limits.clips} clips)`);
|
|
194
|
+
const ids = new Set();
|
|
195
|
+
const dirs = new Set();
|
|
196
|
+
return doc.clips.map((c, n) => {
|
|
197
|
+
const at = `${CLIPS_DIR}/clips.json clip #${n + 1}`;
|
|
198
|
+
if (!c || typeof c !== "object") throw clipFail(`${at} is not an object`);
|
|
199
|
+
if (typeof c.id !== "string" || !CLIP_ID.test(c.id)) throw clipFail(`${at}: id must be a plain token of letters, digits, - and _ (got ${JSON.stringify(c.id)})`);
|
|
200
|
+
if (ids.has(c.id)) throw clipFail(`${at}: duplicate id ${c.id}`);
|
|
201
|
+
ids.add(c.id);
|
|
202
|
+
if (typeof c.dir !== "string" || !CLIP_DIR.test(c.dir) || c.dir.includes("..")) throw clipFail(`clip "${c.id}": dir must be a folder name directly under ${CLIPS_DIR}/ (got ${JSON.stringify(c.dir)})`);
|
|
203
|
+
if (dirs.has(c.dir)) throw clipFail(`clip "${c.id}": dir ${c.dir} is already declared by another clip`);
|
|
204
|
+
dirs.add(c.dir);
|
|
205
|
+
if (!Number.isInteger(c.count) || c.count < 1) throw clipFail(`clip "${c.id}": count must be a whole number of frames (got ${JSON.stringify(c.count)})`);
|
|
206
|
+
if (!Number.isInteger(c.fps) || c.fps < 1 || c.fps > limits.fps) throw clipFail(`clip "${c.id}": fps must be a whole number from 1 to ${limits.fps} (got ${JSON.stringify(c.fps)})`);
|
|
207
|
+
return { id: c.id, dir: c.dir, count: c.count, fps: c.fps };
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Check every declared clip against its bytes: exactly frame_0001.png..frame_<count>.png in
|
|
213
|
+
* clips/<dir>/, each an 8-bit non-animated RGBA PNG of one size within the overlay cap, with real
|
|
214
|
+
* transparency in the first, middle and last frame, and the per-clip and total caps. Returns
|
|
215
|
+
* [{ id, dir, count, fps, width, height, bytes, frames }] where `frames` are stage-relative paths.
|
|
216
|
+
*/
|
|
217
|
+
export function scanClips(stageDir, { limits = CLIP_LIMITS, files = listStage(stageDir) } = {}) {
|
|
218
|
+
const decls = declaredClips(stageDir, limits);
|
|
219
|
+
let totalFrames = 0;
|
|
220
|
+
let totalBytes = 0;
|
|
221
|
+
const clips = decls.map((d) => {
|
|
222
|
+
const prefix = `${CLIPS_DIR}${path.sep}${d.dir}${path.sep}`;
|
|
223
|
+
if (d.count > limits.framesPerClip) throw clipFail(`clip "${d.id}": ${d.count} frames (at most ${limits.framesPerClip} per clip)`);
|
|
224
|
+
const have = new Map(files.filter((f) => f.rel.startsWith(prefix) && RASTER.includes(path.extname(f.rel).toLowerCase())).map((f) => [f.rel.slice(prefix.length), f]));
|
|
225
|
+
const frames = [];
|
|
226
|
+
for (let i = 1; i <= d.count; i++) {
|
|
227
|
+
const f = have.get(clipFrame(i));
|
|
228
|
+
if (!f) throw clipFail(`clip "${d.id}": ${CLIPS_DIR}/${d.dir}/${clipFrame(i)} is missing (declared ${d.count} frames, named frame_0001.png onward)`);
|
|
229
|
+
frames.push(f);
|
|
230
|
+
}
|
|
231
|
+
if (have.size !== d.count) {
|
|
232
|
+
const stray = [...have.keys()].find((name) => !frames.some((f) => f.rel.endsWith(`${path.sep}${name}`)));
|
|
233
|
+
throw clipFail(`clip "${d.id}": ${CLIPS_DIR}/${d.dir}/${stray} is not one of the ${d.count} declared frames; raise count or remove it`);
|
|
234
|
+
}
|
|
235
|
+
let size = null;
|
|
236
|
+
for (const f of frames) {
|
|
237
|
+
const info = rasterInfo(f.real);
|
|
238
|
+
if (path.extname(f.rel).toLowerCase() !== ".png" || !info) throw clipFail(`clip "${d.id}": ${f.rel} is not a readable PNG`);
|
|
239
|
+
if (info.animated) throw clipFail(`clip "${d.id}": ${f.rel} is an animated image; a clip is a folder of still frames`);
|
|
240
|
+
if (info.colorType !== 6 || info.bitDepth !== 8) throw clipFail(`clip "${d.id}": ${f.rel} must be an 8-bit RGBA PNG with an alpha channel (a keyed frame), not an opaque image`);
|
|
241
|
+
if (Math.max(info.width, info.height) > limits.side) throw clipFail(`clip "${d.id}": ${f.rel} is ${info.width}x${info.height}; a clip is an overlay of at most ${limits.side} px on the long side`);
|
|
242
|
+
if (size && (size.width !== info.width || size.height !== info.height)) throw clipFail(`clip "${d.id}": ${f.rel} is ${info.width}x${info.height} but frame_0001.png is ${size.width}x${size.height}; one size per clip`);
|
|
243
|
+
size = { width: info.width, height: info.height };
|
|
244
|
+
}
|
|
245
|
+
const bytes = frames.reduce((s, f) => s + f.bytes, 0);
|
|
246
|
+
if (bytes > limits.bytesPerClip) throw clipFail(`clip "${d.id}": ${(bytes / 1048576).toFixed(1)} MB (at most ${(limits.bytesPerClip / 1048576).toFixed(0)} MB per clip)`);
|
|
247
|
+
for (const f of [frames[0], frames[Math.floor((frames.length - 1) / 2)], frames[frames.length - 1]]) {
|
|
248
|
+
let pixels;
|
|
249
|
+
try {
|
|
250
|
+
({ pixels } = decodePng(readFileSync(f.real)));
|
|
251
|
+
} catch (error) {
|
|
252
|
+
throw clipFail(`clip "${d.id}": ${f.rel} cannot be decoded (${error.message}); use a non-interlaced 8-bit RGBA PNG`);
|
|
253
|
+
}
|
|
254
|
+
let keyed = false;
|
|
255
|
+
for (let i = 3; i < pixels.length && !keyed; i += 4) keyed = pixels[i] < 255;
|
|
256
|
+
if (!keyed) throw clipFail(`clip "${d.id}": ${f.rel} has no transparent pixel; a clip is keyed, not a full-frame video`);
|
|
257
|
+
}
|
|
258
|
+
totalFrames += d.count;
|
|
259
|
+
totalBytes += bytes;
|
|
260
|
+
return { ...d, ...size, bytes, frames: frames.map((f) => f.rel) };
|
|
261
|
+
});
|
|
262
|
+
if (totalFrames > limits.framesTotal) throw clipFail(`${totalFrames} clip frames in all (at most ${limits.framesTotal})`);
|
|
263
|
+
if (totalBytes > limits.bytesTotal) throw clipFail(`${(totalBytes / 1048576).toFixed(1)} MB of clip frames in all (at most ${(limits.bytesTotal / 1048576).toFixed(0)} MB)`);
|
|
264
|
+
return clips;
|
|
265
|
+
}
|
|
266
|
+
|
|
168
267
|
// ---- the static pre-flight scan ----
|
|
169
268
|
const TEXT = new Set([".html", ".js", ".mjs", ".css", ".svg", ".json"]);
|
|
170
269
|
const NAMESPACES = /^http:\/\/www\.w3\.org\/(?:2000\/svg|1999\/xlink|1999\/xhtml|XML\/1998\/namespace|2000\/xmlns\/?)$/u;
|
|
@@ -183,9 +282,11 @@ const NETWORK_API = /\bnew\s+(WebSocket|WebTransport|RTCPeerConnection|EventSour
|
|
|
183
282
|
|
|
184
283
|
/**
|
|
185
284
|
* Scan the stage dir before launch. Throws exit 17 (contract) or 19 (network) naming the file and
|
|
186
|
-
* the thing found; returns { files, rasters, warnings, plate } otherwise (plate: the Blender plate,
|
|
285
|
+
* the thing found; returns { files, rasters, warnings, plate, clips } otherwise (plate: the Blender plate,
|
|
286
|
+
* or null; clips: the declared keyed clips, checked by scanClips, whose frames are not page rasters).
|
|
287
|
+
* `clips: false` (cover mode) ignores clips.json, so a declared folder is held to the raster limits.
|
|
187
288
|
*/
|
|
188
|
-
export function scanStage(stageDir) {
|
|
289
|
+
export function scanStage(stageDir, { clips: allowClips = true } = {}) {
|
|
189
290
|
if (!existsSync(path.join(stageDir, "index.html"))) throw new BlockedError(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${path.join(stageDir, "index.html")} is missing; write the stage page first (references/stage.md)`);
|
|
190
291
|
const files = listStage(stageDir);
|
|
191
292
|
const warnings = [];
|
|
@@ -195,6 +296,8 @@ export function scanStage(stageDir) {
|
|
|
195
296
|
const plate = readPlate(stageDir, "plate");
|
|
196
297
|
const preview = readPlate(stageDir, "plate-preview");
|
|
197
298
|
const listed = new Set([plate, preview].filter(Boolean).flatMap((p) => p.frames.map((f) => path.join(p.dir, f.name))));
|
|
299
|
+
const clips = allowClips ? scanClips(stageDir, { files }) : [];
|
|
300
|
+
for (const c of clips) for (const rel of c.frames) listed.add(rel);
|
|
198
301
|
for (const f of files) {
|
|
199
302
|
const ext = path.extname(f.rel).toLowerCase();
|
|
200
303
|
if (!CONTENT_TYPES[ext] && f.rel !== "scene.py") warnings.push(`${f.rel}: not a servable type; the page cannot load it`);
|
|
@@ -234,7 +337,24 @@ export function scanStage(stageDir) {
|
|
|
234
337
|
for (const [size, names] of bySize) {
|
|
235
338
|
if (names.length >= RASTER_LIMITS.flipbook) throw new BlockedError(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${names.length} rasters of ${size} look like a flipbook; animate the page, not a frame sequence`);
|
|
236
339
|
}
|
|
237
|
-
return { files, rasters, warnings, plate };
|
|
340
|
+
return { files, rasters, warnings, plate, clips };
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* window.LitClips for LitStage.clip: id -> { src, count, fps, width, height }, written from clips.json and
|
|
345
|
+
* the first frame's header. null when the stage declares no clips (or one the scan would refuse).
|
|
346
|
+
*/
|
|
347
|
+
function clipsScript(stageDir) {
|
|
348
|
+
let table;
|
|
349
|
+
try {
|
|
350
|
+
table = Object.fromEntries(declaredClips(stageDir).map((c) => {
|
|
351
|
+
const info = rasterInfo(path.join(stageDir, CLIPS_DIR, c.dir, clipFrame(1)));
|
|
352
|
+
return [c.id, { src: `${CLIPS_DIR}/${c.dir}`, count: c.count, fps: c.fps, width: info.width, height: info.height }];
|
|
353
|
+
}));
|
|
354
|
+
} catch {
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
return Object.keys(table).length ? `window.LitClips = ${JSON.stringify(table)};\n` : null;
|
|
238
358
|
}
|
|
239
359
|
|
|
240
360
|
/**
|
|
@@ -242,6 +362,7 @@ export function scanStage(stageDir) {
|
|
|
242
362
|
* type } | { kind: "blocked", reason } | { kind: "missing" }, and records every refusal.
|
|
243
363
|
*/
|
|
244
364
|
export function stageRouter({ stageDir, faces, style = null, threeDir = THREE_DIR }) {
|
|
365
|
+
const clipsJs = clipsScript(stageDir);
|
|
245
366
|
const root = realpathSync(stageDir);
|
|
246
367
|
const css = fontsCss(faces);
|
|
247
368
|
const byRoute = new Map(faces.map((f) => [f.route, f.file]));
|
|
@@ -265,6 +386,7 @@ export function stageRouter({ stageDir, faces, style = null, threeDir = THREE_DI
|
|
|
265
386
|
if (pathname === "/lit/stage-kit.js") return { kind: "file", file: KIT_FILE, type: CONTENT_TYPES[".js"] };
|
|
266
387
|
if (pathname === "/lit/loop-kit.js") return { kind: "file", file: LOOP_KIT_FILE, type: CONTENT_TYPES[".js"] };
|
|
267
388
|
if (pathname === "/lit/fonts.css") return { kind: "body", body: css, type: CONTENT_TYPES[".css"] };
|
|
389
|
+
if (clipsJs && pathname === "/lit/clips.js") return { kind: "body", body: clipsJs, type: CONTENT_TYPES[".js"] };
|
|
268
390
|
if (pathname.startsWith("/lit/three/")) {
|
|
269
391
|
// A backslash is a separator on Windows, so it is refused with `..`; the realpath must stay inside
|
|
270
392
|
// the vendored folder, so a link out of it is refused too.
|
|
@@ -505,6 +505,7 @@ export async function renderStage({ out, round = 1, stillsOnly = false, env = pr
|
|
|
505
505
|
frameCount, seed: treatment.seed, renderer: finalState.webglRenderer ?? "no WebGL", rung: ctx.rung, chromeFlags: master.flags, usesWebGL: finalState.usesWebGL,
|
|
506
506
|
cuts, stills: { sha256: stills.sha256, poster: plan.poster, reduced: plan.reduced }, posterEncoding: poster,
|
|
507
507
|
geometry: geometryFor(width, height),
|
|
508
|
+
clips: scan.clips.map((c) => ({ id: c.id, frames: c.count, fps: c.fps, width: c.width, height: c.height, bytes: c.bytes })),
|
|
508
509
|
plate: scan.plate ? { blender: scan.plate.blender, engine: scan.plate.engine, device: scan.plate.device, samples: scan.plate.samples, fps: scan.plate.fps, frames: scan.plate.frames.length } : null,
|
|
509
510
|
sound: { mode: sound.mode, label: sound.label, file: sound.file ? path.relative(out, sound.file) : null, sha256: sound.file ? sha256(readFileSync(sound.file)) : null, lufs: sound.bed?.lufs ?? null },
|
|
510
511
|
preview: { encoder: preview.encoder, rung: preview.rung, attempts: preview.attempts },
|
|
@@ -759,6 +759,45 @@
|
|
|
759
759
|
};
|
|
760
760
|
}
|
|
761
761
|
|
|
762
|
+
// A declared keyed clip (stage/clips/clips.json, served as window.LitClips by /lit/clips.js): one
|
|
763
|
+
// wrapper at `box` over the film, holding the clip's frame for t. The frame is a pure function of
|
|
764
|
+
// film time, floor((t - start) * fps) + 1 within from..to, so no <video> and no real clock is
|
|
765
|
+
// involved. Before `start` and after `to` the wrapper is hidden (null) unless `hold` keeps the last
|
|
766
|
+
// frame or `loop` wraps by frame index. The wrapper is the element a page scales or fades; the
|
|
767
|
+
// <img> inside is replaced on a frame change, so the renderer waits for its decode before capture.
|
|
768
|
+
function clip({ parent, id, box } = {}) {
|
|
769
|
+
const all = root.LitClips;
|
|
770
|
+
if (!all) throw new Error('LitStage.clip: load <script src="/lit/clips.js"></script> before the kit helpers; the stage declares no clips (clips/clips.json)');
|
|
771
|
+
const c = all[id];
|
|
772
|
+
if (!c) throw new Error(`LitStage.clip: no clip "${id}" in clips/clips.json (declared: ${Object.keys(all).join(", ")})`);
|
|
773
|
+
if (!parent || !box || !(box.w > 0) || !(box.h > 0)) throw new Error("LitStage.clip: needs { parent, id, box: { x, y, w, h } }");
|
|
774
|
+
const wrap = document.createElement("div");
|
|
775
|
+
wrap.setAttribute("data-lit-clip", id);
|
|
776
|
+
Object.assign(wrap.style, { position: "absolute", left: `${box.x}px`, top: `${box.y}px`, width: `${box.w}px`, height: `${box.h}px`, display: "none", pointerEvents: "none" });
|
|
777
|
+
parent.append(wrap);
|
|
778
|
+
let shown = 0;
|
|
779
|
+
let img = null;
|
|
780
|
+
return (t, { start = 0, from = 1, to = c.count, loop = false, hold = false } = {}) => {
|
|
781
|
+
if (!(from >= 1 && to <= c.count && from <= to)) throw new Error(`LitStage.clip: from..to must lie within 1..${c.count} (got ${from}..${to})`);
|
|
782
|
+
const n = to - from + 1;
|
|
783
|
+
const k = Math.floor((t - start) * c.fps + 1e-6);
|
|
784
|
+
const i = k < 0 ? 0 : k < n ? from + k : loop ? from + (k % n) : hold ? to : 0;
|
|
785
|
+
wrap.style.display = i ? "block" : "none";
|
|
786
|
+
if (!i) return null;
|
|
787
|
+
if (i !== shown) {
|
|
788
|
+
const next = document.createElement("img");
|
|
789
|
+
next.src = `${c.src}/frame_${String(i).padStart(4, "0")}.png`;
|
|
790
|
+
next.alt = "";
|
|
791
|
+
Object.assign(next.style, { display: "block", width: "100%", height: "100%", objectFit: "contain" });
|
|
792
|
+
if (img) img.replaceWith(next);
|
|
793
|
+
else wrap.append(next);
|
|
794
|
+
img = next;
|
|
795
|
+
shown = i;
|
|
796
|
+
}
|
|
797
|
+
return wrap;
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
|
|
762
801
|
// ---- the page contract ----
|
|
763
802
|
const FORMATS = [[1920, 1080], [1080, 1920]];
|
|
764
803
|
function define(spec) {
|
|
@@ -779,6 +818,6 @@
|
|
|
779
818
|
clipRect, clipCircle, maskLinear, wipe,
|
|
780
819
|
mix, rgba,
|
|
781
820
|
clamp, lerp, invLerp, remap, smoothstep,
|
|
782
|
-
shot, zone, place, tokens, plate,
|
|
821
|
+
shot, zone, place, tokens, plate, clip,
|
|
783
822
|
});
|
|
784
823
|
})(typeof window !== "undefined" ? window : globalThis);
|
|
@@ -12,7 +12,8 @@ Start every page from `motion.mjs scaffold --out <dir>`, which writes the struct
|
|
|
12
12
|
SVG, PNG, JPG, WebP, JS, CSS and WAV files beside it. Nothing else is served.
|
|
13
13
|
- The page loads the fonts, the style and the kit from the renderer's own routes:
|
|
14
14
|
`<link rel="stylesheet" href="/lit/fonts.css">`, `<link rel="stylesheet" href="/lit/style.css">`,
|
|
15
|
-
`<script src="/lit/style.js"></script>` and `<script src="/lit/stage-kit.js"></script
|
|
15
|
+
`<script src="/lit/style.js"></script>` and `<script src="/lit/stage-kit.js"></script>`; a page
|
|
16
|
+
with clips also loads `<script src="/lit/clips.js"></script>` (Clips).
|
|
16
17
|
- Each shot's copy sits in its layout's type zone, in a type-role class and a colour class of the style;
|
|
17
18
|
the gate's style rules check the result (`studio.md`).
|
|
18
19
|
- The page calls `LitStage.define({ width, height, fps, duration, render })`, or sets
|
|
@@ -92,6 +93,8 @@ Every primitive is a pure function of its inputs. `LitStage` holds them all.
|
|
|
92
93
|
- `clamp`, `lerp`, `invLerp`, `remap(x, a, b, c, d)` and `smoothstep(a, b, x)` for arithmetic.
|
|
93
94
|
- `text(el, { decor })` marks a text run; `text({ content, x, y, w, h })` registers canvas text
|
|
94
95
|
(see Text).
|
|
96
|
+
- `clip({ parent, id, box })` shows a declared keyed clip (Clips): `const boom = clip({ parent, id: "boom",
|
|
97
|
+
box: { x: 1200, y: 300, w: 520, h: 511 } }); boom(t, { start: 2.1 });`.
|
|
95
98
|
- The style and the timeline (`studio.md`): `shot(t)` (the shot at `t`, with `p`, `local`,
|
|
96
99
|
`enter(delay, dur)`, `exit(dur)`), `zone(layout, part)` and `place(el, layout, part)` (a layout zone in
|
|
97
100
|
pixels), `tokens()` (the style's eases, durations, staggers and springs per object class).
|
|
@@ -115,6 +118,44 @@ Any other family falls back to a system face. The QA replay reports that, and fa
|
|
|
115
118
|
text. Set Korean copy in Pretendard. Never ask for a weight the family does not have (the browser
|
|
116
119
|
would synthesize a fake bold), and never animate tracking or width on Hangul.
|
|
117
120
|
|
|
121
|
+
## Clips
|
|
122
|
+
|
|
123
|
+
Real keyed footage (a reaction clip, a spinning-cat loop shot on green screen) joins the film as a
|
|
124
|
+
layer inside the page: the video is keyed outside the renderer into an 8-bit RGBA PNG per frame, the
|
|
125
|
+
frames are declared, and the page picks the frame from film time. A declared clip is exempt from the
|
|
126
|
+
flipbook and count rule; every other raster keeps its limits. Nothing is encoded by hand: the
|
|
127
|
+
frames are captured with the page, so the flash audit, the determinism replay and the text checks
|
|
128
|
+
run on the final pixels as for any other film.
|
|
129
|
+
|
|
130
|
+
1. Copy each clip's frames into the run's stage folder as `stage/clips/<dir>/frame_0001.png`,
|
|
131
|
+
`frame_0002.png`, and so on, with no gaps and no other image in the folder.
|
|
132
|
+
2. Declare them in `stage/clips/clips.json`:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{ "clips": [ { "id": "boom", "dir": "01-vine-boom", "count": 122, "fps": 30 } ] }
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
`id` is the name the page uses; `dir` is a folder directly under `clips/`; `count` is the number of
|
|
139
|
+
frames; `fps` is the clip's own rate, 1 to 30. A clip used twice is declared once.
|
|
140
|
+
3. The page loads `<script src="/lit/clips.js"></script>` after the kit, registers each use with
|
|
141
|
+
`LitStage.clip({ parent, id, box })` once, and calls the returned `show(t, opts)` from `render(t)`.
|
|
142
|
+
`parent` is the element the clip sits in; `box` is its place in pixels, the frame fitted inside
|
|
143
|
+
it. `show` returns the clip's wrapper element, or `null` while hidden; scale, fade or move that
|
|
144
|
+
wrapper from `t` like any other layer. The frame is `floor((t - start) * fps) + 1`, counted
|
|
145
|
+
from `from`, so the cue is plain arithmetic: a clip whose own sound starts at frame 85 and must
|
|
146
|
+
land on a cue at 0.12 s has `start = 0.12 - 84 / 30`. Options: `start` (film seconds, default 0),
|
|
147
|
+
`from` and `to` (the frame range, default the whole clip), `loop` (wrap by frame index), `hold`
|
|
148
|
+
(keep the last frame). Before `start` and past `to`, without `loop` or `hold`, the clip is hidden.
|
|
149
|
+
|
|
150
|
+
The scan refuses, with exit 17 and the clip named: more than 12 clips, 360 frames in a clip or 1500
|
|
151
|
+
in all, 40 MB in a clip or 128 MB in all, a frame whose long side is above 720 px (a clip is an
|
|
152
|
+
overlay, not the film), a frame rate above 30, frames of mixed sizes, a missing or extra frame, a
|
|
153
|
+
frame that is not an 8-bit RGBA PNG or has no transparent pixel in the first, middle and last frame
|
|
154
|
+
(an opaque video is not keyed), an animated image, and a duplicate `id`. A folder that is not
|
|
155
|
+
declared, or any frame sequence beside a declared clip, is a flipbook as before. Cover mode takes
|
|
156
|
+
no clips. Keep clips clear of copy: the text checks look at DOM text, so a clip laid over a line is
|
|
157
|
+
yours to catch on the stills. The manifest and report list each clip.
|
|
158
|
+
|
|
118
159
|
## Clock
|
|
119
160
|
|
|
120
161
|
The renderer owns time. It steps a virtual clock frame by frame from 0 and captures the frames in
|
|
@@ -143,7 +184,7 @@ region. For variation, use `LitStage.rand(<seed>)`.
|
|
|
143
184
|
CDN.
|
|
144
185
|
- Rasters: at most 24 raster images and 8 MB in total. Ten or more rasters of the same size (a
|
|
145
186
|
flipbook), or any animated GIF, APNG or WebP, is exit 17. Rasters are textures and stills, never a
|
|
146
|
-
frame sequence.
|
|
187
|
+
frame sequence. The one frame sequence a page may carry is a declared keyed clip (Clips).
|
|
147
188
|
- Hand-encoded films are not the deliverable: no frame loop encoded by hand, no screen recording,
|
|
148
189
|
no raster flipbook. Every frame passes through the renderer.
|
|
149
190
|
|
|
@@ -162,14 +162,15 @@ command -v <server-executable> # e.g. typescript-language-server, gopls, rust-
|
|
|
162
162
|
### 3. Configure (LitClaude `.lsp.json`)
|
|
163
163
|
|
|
164
164
|
LitClaude declares servers in `plugins/litclaude/.lsp.json`. The schema is keyed
|
|
165
|
-
by **language name**; each entry holds a `command`
|
|
166
|
-
`extensionToLanguage` map that tells Claude Code which file
|
|
167
|
-
that server:
|
|
165
|
+
by **language name**; each entry holds a `command` string (the executable), an
|
|
166
|
+
`args` array and an `extensionToLanguage` map that tells Claude Code which file
|
|
167
|
+
extensions route to that server:
|
|
168
168
|
|
|
169
169
|
```json
|
|
170
170
|
{
|
|
171
171
|
"<language>": {
|
|
172
|
-
"command":
|
|
172
|
+
"command": "<bin>",
|
|
173
|
+
"args": ["<arg>"],
|
|
173
174
|
"extensionToLanguage": {
|
|
174
175
|
".ext": "<languageId>"
|
|
175
176
|
}
|
|
@@ -179,7 +180,9 @@ that server:
|
|
|
179
180
|
|
|
180
181
|
Rules:
|
|
181
182
|
|
|
182
|
-
- One entry per server, keyed by language name.
|
|
183
|
+
- One entry per server, keyed by language name. `command` is the executable as a
|
|
184
|
+
single string and `args` holds its arguments; Claude Code rejects an argv array
|
|
185
|
+
in `command` and loads no server from the file.
|
|
183
186
|
- `extensionToLanguage` maps each owned extension to the LSP `languageId`. Claude
|
|
184
187
|
Code resolves the server for an edited file by matching its extension here.
|
|
185
188
|
- The shipped default declares only `typescript`. Add a language by copying the
|
|
@@ -30,7 +30,8 @@ Add a `bash` entry to `plugins/litclaude/.lsp.json`:
|
|
|
30
30
|
```json
|
|
31
31
|
{
|
|
32
32
|
"bash": {
|
|
33
|
-
"command":
|
|
33
|
+
"command": "bash-language-server",
|
|
34
|
+
"args": ["start"],
|
|
34
35
|
"extensionToLanguage": {
|
|
35
36
|
".sh": "shellscript",
|
|
36
37
|
".bash": "shellscript",
|
|
@@ -25,7 +25,8 @@ Add a `c-cpp` entry to `plugins/litclaude/.lsp.json`:
|
|
|
25
25
|
```json
|
|
26
26
|
{
|
|
27
27
|
"c-cpp": {
|
|
28
|
-
"command":
|
|
28
|
+
"command": "clangd",
|
|
29
|
+
"args": ["--background-index", "--clang-tidy"],
|
|
29
30
|
"extensionToLanguage": {
|
|
30
31
|
".c": "c",
|
|
31
32
|
".h": "c",
|
|
@@ -41,8 +42,8 @@ Add a `c-cpp` entry to `plugins/litclaude/.lsp.json`:
|
|
|
41
42
|
```
|
|
42
43
|
|
|
43
44
|
Claude Code routes these extensions to `clangd` via the map. clangd reads
|
|
44
|
-
build flags from a project `.clangd` file, not from `.lsp.json`; the `
|
|
45
|
-
above already
|
|
45
|
+
build flags from a project `.clangd` file, not from `.lsp.json`; the `args`
|
|
46
|
+
above already pass `--background-index --clang-tidy`.
|
|
46
47
|
|
|
47
48
|
## Compile commands
|
|
48
49
|
|
|
@@ -56,7 +57,7 @@ Without it, clangd falls back to heuristic flags and reports spurious errors.
|
|
|
56
57
|
|
|
57
58
|
## Alternatives
|
|
58
59
|
|
|
59
|
-
`ccls` exists as a third-party server — set the `command` to `
|
|
60
|
+
`ccls` exists as a third-party server — set the `command` to `"ccls"` in the
|
|
60
61
|
`c-cpp` entry if you prefer it.
|
|
61
62
|
|
|
62
63
|
## Troubleshooting
|
|
@@ -27,7 +27,7 @@ Add a `csharp` entry to `plugins/litclaude/.lsp.json`:
|
|
|
27
27
|
```json
|
|
28
28
|
{
|
|
29
29
|
"csharp": {
|
|
30
|
-
"command":
|
|
30
|
+
"command": "csharp-ls",
|
|
31
31
|
"extensionToLanguage": {
|
|
32
32
|
".cs": "csharp"
|
|
33
33
|
}
|
|
@@ -45,7 +45,8 @@ Razor and Blazor files use a separate server. Add a second entry:
|
|
|
45
45
|
```json
|
|
46
46
|
{
|
|
47
47
|
"razor": {
|
|
48
|
-
"command":
|
|
48
|
+
"command": "roslyn-language-server",
|
|
49
|
+
"args": ["--stdio"],
|
|
49
50
|
"extensionToLanguage": {
|
|
50
51
|
".razor": "razor",
|
|
51
52
|
".cshtml": "razor"
|
|
@@ -26,7 +26,7 @@ Add an `elixir` entry to `plugins/litclaude/.lsp.json`:
|
|
|
26
26
|
```json
|
|
27
27
|
{
|
|
28
28
|
"elixir": {
|
|
29
|
-
"command":
|
|
29
|
+
"command": "elixir-ls",
|
|
30
30
|
"extensionToLanguage": {
|
|
31
31
|
".ex": "elixir",
|
|
32
32
|
".exs": "elixir"
|
|
@@ -40,8 +40,8 @@ configuration is normally required.
|
|
|
40
40
|
|
|
41
41
|
## Alternatives
|
|
42
42
|
|
|
43
|
-
- **lexical**: set the `command` to `
|
|
44
|
-
- **next-ls**: set the `command` to `
|
|
43
|
+
- **lexical**: set the `command` to `"lexical"` — fast, modern alternative LSP.
|
|
44
|
+
- **next-ls**: set the `command` to `"nextls"` and `args` to `["--stdio"]` — from the elixir-tools project.
|
|
45
45
|
|
|
46
46
|
## Troubleshooting
|
|
47
47
|
- **PATH:** `elixir-ls` must be on PATH; reopen the shell after install.
|
|
@@ -32,7 +32,8 @@ Add a `haskell` entry to `plugins/litclaude/.lsp.json`:
|
|
|
32
32
|
```json
|
|
33
33
|
{
|
|
34
34
|
"haskell": {
|
|
35
|
-
"command":
|
|
35
|
+
"command": "haskell-language-server-wrapper",
|
|
36
|
+
"args": ["--lsp"],
|
|
36
37
|
"extensionToLanguage": {
|
|
37
38
|
".hs": "haskell",
|
|
38
39
|
".lhs": "haskell"
|
|
@@ -33,7 +33,8 @@ Add a `julia` entry to `plugins/litclaude/.lsp.json`:
|
|
|
33
33
|
```json
|
|
34
34
|
{
|
|
35
35
|
"julia": {
|
|
36
|
-
"command":
|
|
36
|
+
"command": "julia",
|
|
37
|
+
"args": ["--startup-file=no", "--history-file=no", "-e", "using LanguageServer; runserver()"],
|
|
37
38
|
"extensionToLanguage": {
|
|
38
39
|
".jl": "julia"
|
|
39
40
|
}
|
|
@@ -25,7 +25,8 @@ Add a `php` entry to `plugins/litclaude/.lsp.json`:
|
|
|
25
25
|
```json
|
|
26
26
|
{
|
|
27
27
|
"php": {
|
|
28
|
-
"command":
|
|
28
|
+
"command": "intelephense",
|
|
29
|
+
"args": ["--stdio"],
|
|
29
30
|
"extensionToLanguage": {
|
|
30
31
|
".php": "php"
|
|
31
32
|
}
|
|
@@ -41,7 +42,7 @@ which is passed through the editor's LSP `initializationOptions` rather than
|
|
|
41
42
|
## Alternatives
|
|
42
43
|
|
|
43
44
|
**phpactor** — pure-PHP, no Node dependency. Set the `command` to
|
|
44
|
-
`
|
|
45
|
+
`"phpactor"` and `args` to `["language-server"]`.
|
|
45
46
|
|
|
46
47
|
## Troubleshooting
|
|
47
48
|
- **PATH:** `intelephense` must be on PATH; reopen the shell after a global npm install. If missing, check `npm bin -g` is on PATH.
|
|
@@ -22,12 +22,13 @@ command -v basedpyright-langserver
|
|
|
22
22
|
## Configure
|
|
23
23
|
|
|
24
24
|
Add a `python` entry to `plugins/litclaude/.lsp.json`. LitClaude keys each entry
|
|
25
|
-
by language name with a `command` array and an `extensionToLanguage` map:
|
|
25
|
+
by language name with a `command` string, an `args` array and an `extensionToLanguage` map:
|
|
26
26
|
|
|
27
27
|
```json
|
|
28
28
|
{
|
|
29
29
|
"python": {
|
|
30
|
-
"command":
|
|
30
|
+
"command": "basedpyright-langserver",
|
|
31
|
+
"args": ["--stdio"],
|
|
31
32
|
"extensionToLanguage": {
|
|
32
33
|
".py": "python",
|
|
33
34
|
".pyi": "python"
|
|
@@ -43,14 +44,14 @@ Type-check strictness lives in `pyrightconfig.json` or `[tool.basedpyright]` in
|
|
|
43
44
|
## Choosing a server
|
|
44
45
|
|
|
45
46
|
Type checkers and the linter serve different roles. Run a type server, and
|
|
46
|
-
optionally `ruff` ALONGSIDE it (not instead). Set
|
|
47
|
+
optionally `ruff` ALONGSIDE it (not instead). Set `command` and `args` accordingly:
|
|
47
48
|
|
|
48
|
-
| command
|
|
49
|
+
| `command` + `args` | install | role |
|
|
49
50
|
| ------------------------------------ | ---------------------- | --------------------------------------- |
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
51
|
+
| `"basedpyright-langserver"` + `["--stdio"]` | `pip install basedpyright` | strictest types, **default** |
|
|
52
|
+
| `"pyright-langserver"` + `["--stdio"]` | `pip install pyright` | upstream Microsoft type checker |
|
|
53
|
+
| `"ty"` + `["server"]` | `pip install ty` | Astral, very fast, pre-1.0/experimental |
|
|
54
|
+
| `"ruff"` + `["server"]` | `pip install ruff` | lint + format only, complements a type server |
|
|
54
55
|
|
|
55
56
|
Recommended: keep `basedpyright` as the `python` entry. `ruff` does not
|
|
56
57
|
type-check, so if you want lint diagnostics too run it as a separate tool rather
|
|
@@ -27,7 +27,8 @@ Add a `ruby` entry to `plugins/litclaude/.lsp.json`:
|
|
|
27
27
|
```json
|
|
28
28
|
{
|
|
29
29
|
"ruby": {
|
|
30
|
-
"command":
|
|
30
|
+
"command": "rubocop",
|
|
31
|
+
"args": ["--lsp"],
|
|
31
32
|
"extensionToLanguage": {
|
|
32
33
|
".rb": "ruby",
|
|
33
34
|
".rake": "ruby",
|
|
@@ -44,8 +45,8 @@ formatting, and code actions over LSP.
|
|
|
44
45
|
|
|
45
46
|
## Alternatives
|
|
46
47
|
|
|
47
|
-
- **Shopify `ruby-lsp`** — the standalone `ruby-lsp` executable, richer navigation than RuboCop alone. Set the `command` to `
|
|
48
|
-
- **`solargraph`** — older completion/type server; install with `gem install solargraph`, set the `command` to `
|
|
48
|
+
- **Shopify `ruby-lsp`** — the standalone `ruby-lsp` executable, richer navigation than RuboCop alone. Set the `command` to `"ruby-lsp"`.
|
|
49
|
+
- **`solargraph`** — older completion/type server; install with `gem install solargraph`, set the `command` to `"solargraph"` and `args` to `["stdio"]`.
|
|
49
50
|
|
|
50
51
|
## Troubleshooting
|
|
51
52
|
|
|
@@ -26,7 +26,8 @@ Add a `terraform` entry to `plugins/litclaude/.lsp.json`:
|
|
|
26
26
|
```json
|
|
27
27
|
{
|
|
28
28
|
"terraform": {
|
|
29
|
-
"command":
|
|
29
|
+
"command": "terraform-ls",
|
|
30
|
+
"args": ["serve"],
|
|
30
31
|
"extensionToLanguage": {
|
|
31
32
|
".tf": "terraform",
|
|
32
33
|
".tfvars": "terraform-vars"
|