@litfamily/litclaude 1.0.43 → 1.0.45
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 +80 -0
- package/README.md +8 -8
- package/README_ko-KR.md +8 -8
- package/bin/litclaude-ai.js +201 -5
- package/docs/assets/readme/badge-version.svg +1 -1
- package/package.json +1 -1
- package/plugins/litclaude/.claude-plugin/plugin.json +1 -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-ai +1 -0
- package/plugins/litclaude/bin/litclaude-hook.js +31 -12
- package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
- package/plugins/litclaude/commands/litgoal.md +3 -1
- package/plugins/litclaude/hooks/hooks.json +1 -1
- package/plugins/litclaude/lib/agent-file/apply.mjs +150 -0
- package/plugins/litclaude/lib/agent-file/attribution.mjs +62 -0
- package/plugins/litclaude/lib/agent-file/block.md +12 -0
- package/plugins/litclaude/lib/agent-file/cli.mjs +71 -0
- package/plugins/litclaude/lib/agent-file/managed-block.mjs +82 -0
- package/plugins/litclaude/lib/agent-file/project-block.md +9 -0
- package/plugins/litclaude/lib/canonical-runtime-commitments.mjs +6 -6
- package/plugins/litclaude/lib/canonical-skill-resources.mjs +51 -48
- 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 +392 -0
- package/plugins/litclaude/lib/official-build.mjs +22 -0
- package/plugins/litclaude/lib/output_mark.py +132 -0
- package/plugins/litclaude/lib/render_pages.py +16 -0
- package/plugins/litclaude/lib/rewind/brief.mjs +12 -2
- package/plugins/litclaude/lib/rewind/collect.mjs +83 -12
- package/plugins/litclaude/lib/rewind/next-step.mjs +21 -3
- package/plugins/litclaude/lib/start-work-lifecycle.mjs +6 -4
- 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 +8 -4
- 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 +14 -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 +33 -8
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/init.js +13 -0
- 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/hyperframes-cover/package-lock.json +4 -4
- 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 +2 -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
|
@@ -5,6 +5,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
5
5
|
import { buildBlockRegistry } from './block-registry.mjs';
|
|
6
6
|
import { decodeXmlCharacterReferences, officeCssUrlsAreSafe, officeHrefRefsAreSafe } from './office-safety.mjs';
|
|
7
7
|
import { probeRenderer, runAgentBrowser } from './renderer.mjs';
|
|
8
|
+
import { WORDMARK, markInk, markLogoBox, markLogoDataUri, markLogoSvg, markPlan, svgWithMetadata, tagFile } from '../../../lib/mark.mjs';
|
|
8
9
|
|
|
9
10
|
const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..');
|
|
10
11
|
const args=process.argv.slice(2);
|
|
@@ -70,12 +71,38 @@ function run(commandArgs, env={}) {
|
|
|
70
71
|
return (r.stdout||'').trim();
|
|
71
72
|
}
|
|
72
73
|
fs.mkdirSync(output,{recursive:true});
|
|
74
|
+
// The visible LitClaude mark (mark setting `on`): added by the exporter, never by the diagram source, at the clear
|
|
75
|
+
// spot nearest the bottom-right corner that no drawn element's box touches, in the ground's own ink.
|
|
76
|
+
const mark=markPlan().visible;
|
|
77
|
+
const markScript='(()=>{const s=document.querySelector("svg"),vb=s.viewBox.baseVal,short=Math.min(vb.width,vb.height),fs='+'Math.max('+WORDMARK.minPx+','+WORDMARK.cornerShare+'*short),inset=Math.max(12,'+WORDMARK.insetShare+'*short),pad=0.6*fs;'
|
|
78
|
+
+'const r=s.getBoundingClientRect(),k=vb.width/r.width,boxes=[];let ground=null,groundArea=0;'
|
|
79
|
+
+'for(const e of s.querySelectorAll("rect,circle,ellipse,line,path,polygon,polyline,text,image,use,foreignObject")){if(e.closest("defs,clipPath,mask,marker,pattern,symbol"))continue;const b=e.getBoundingClientRect();if(!b.width&&!b.height)continue;const x=vb.x+(b.left-r.left)*k,y=vb.y+(b.top-r.top)*k,w=b.width*k,h=b.height*k;'
|
|
80
|
+
+'if(e.tagName==="rect"&&w*h>=0.9*vb.width*vb.height){if(w*h>groundArea){groundArea=w*h;ground=getComputedStyle(e).fill;}continue;}boxes.push([x,y,x+w,y+h]);}'
|
|
81
|
+
+'const rgb=(c)=>{const m=/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/.exec(c||"");return m?[+m[1],+m[2],+m[3]]:null;};'
|
|
82
|
+
+'const g=rgb(ground)||rgb(getComputedStyle(document.body).backgroundColor)||[255,255,255];'
|
|
83
|
+
+'const t=document.createElementNS("http://www.w3.org/2000/svg","text");t.textContent='+JSON.stringify(WORDMARK.text)+';t.setAttribute("data-litclaude-mark","1");t.setAttribute("font-family","Pretendard, Arial, sans-serif");t.setAttribute("font-weight","'+WORDMARK.weight+'");t.setAttribute("font-size",fs.toFixed(2));t.setAttribute("letter-spacing",('+WORDMARK.tracking+'*fs).toFixed(3));t.setAttribute("text-anchor","end");t.setAttribute("fill-opacity","'+WORDMARK.cornerOpacity+'");s.appendChild(t);'
|
|
84
|
+
+'const tl=t.getComputedTextLength(),tw=tl+'+WORDMARK.tracking+'*fs*'+WORDMARK.text.length+',L='+WORDMARK.logoScale+'*fs,w=tw+'+WORDMARK.logoGap+'*fs+L,h=Math.max(fs*1.25,L);let best=null;'
|
|
85
|
+
+'for(let y=vb.y+vb.height-inset;y-h>=vb.y+0.72*vb.height;y-=fs/3){for(let x=vb.x+vb.width-inset;x-w>=vb.x+inset;x-=fs/2){const box=[x-w-pad,y-h-pad,x+pad,y+pad];if(boxes.some((b)=>b[0]<box[2]&&b[2]>box[0]&&b[1]<box[3]&&b[3]>box[1]))continue;const d=Math.hypot(vb.x+vb.width-inset-x,(vb.y+vb.height-inset-y)*2);if(!best||d<best.d)best={x,y,d};}}'
|
|
86
|
+
+'if(!best){t.remove();return JSON.stringify({placed:false});}'
|
|
87
|
+
+'t.setAttribute("x",best.x.toFixed(2));t.setAttribute("y",(best.y-0.22*fs).toFixed(2));'
|
|
88
|
+
+'const i=document.createElementNS("http://www.w3.org/2000/svg","image"),ly=best.y-0.22*fs-0.36*fs-L/2;i.setAttribute("data-litclaude-mark-logo","1");i.setAttribute("x",(best.x-tl-'+WORDMARK.logoGap+'*fs-L).toFixed(2));i.setAttribute("y",ly.toFixed(2));i.setAttribute("width",L.toFixed(2));i.setAttribute("height",L.toFixed(2));i.setAttribute("opacity","'+WORDMARK.cornerOpacity+'");i.setAttribute("href",'+JSON.stringify(markLogoDataUri())+');s.appendChild(i);'
|
|
89
|
+
+'return JSON.stringify({placed:true,x:+best.x.toFixed(2),y:+(best.y-0.22*fs).toFixed(2),fs:+fs.toFixed(2),tw:+tl.toFixed(2),ground:g});})()';
|
|
90
|
+
let markPlaced=null;
|
|
73
91
|
const session='lit-diagram-export-'+process.pid+'-'+Date.now();
|
|
74
92
|
const url=resolved.endsWith('.svg')?'file://'+resolved:'file://'+resolved;
|
|
75
93
|
let opened=false;
|
|
76
94
|
try{
|
|
77
95
|
run(['--session',session,'open',url]);opened=true;
|
|
78
96
|
run(['--session',session,'set','media','light','reduced-motion']);
|
|
97
|
+
if(mark){
|
|
98
|
+
run(['--session',session,'eval','document.fonts.ready.then(()=>true)']);
|
|
99
|
+
const raw=run(['--session',session,'eval',markScript]);
|
|
100
|
+
let parsed;try{const outer=JSON.parse(raw);parsed=typeof outer==='string'?JSON.parse(outer):outer;}catch{throw new Error('MARK_PLACEMENT_INVALID '+raw);}
|
|
101
|
+
if(parsed.placed){
|
|
102
|
+
markPlaced={...parsed,ink:markInk(parsed.ground)};
|
|
103
|
+
run(['--session',session,'eval','document.querySelector("[data-litclaude-mark]").setAttribute("fill","rgb('+markPlaced.ink.join(',')+')")']);
|
|
104
|
+
} else console.log('MARK_SKIPPED no clear spot in the bottom quarter; the export carries the invisible tag only');
|
|
105
|
+
}
|
|
79
106
|
const outputs=[];
|
|
80
107
|
const scales=all?[1,2,3]:[selected];
|
|
81
108
|
for(const scale of scales){
|
|
@@ -92,9 +119,11 @@ try{
|
|
|
92
119
|
const filename=path.join(output,path.basename(resolved).replace(/\.(?:html|svg)$/i,'')+'-'+scale+'x.png');
|
|
93
120
|
run(['--session',session,'screenshot','svg',filename]);
|
|
94
121
|
if(!fs.existsSync(filename)||fs.statSync(filename).size===0) throw new Error('PNG_WRITE_FAILED '+filename+' '+dimensions);
|
|
122
|
+
tagFile(filename);
|
|
95
123
|
outputs.push({file:filename,bytes:fs.statSync(filename).size,scale,dimensions});
|
|
96
124
|
}
|
|
97
125
|
for(const out of outputs) console.log('PNG '+out.scale+'x '+out.bytes+' bytes '+out.file+' '+out.dimensions);
|
|
126
|
+
if(markPlaced) console.log('MARK '+JSON.stringify({x:markPlaced.x,y:markPlaced.y,fontSize:markPlaced.fs,ink:markPlaced.ink}));
|
|
98
127
|
} catch(e) {
|
|
99
128
|
console.error('EXPORT_FAILED '+e.message);
|
|
100
129
|
process.exitCode=1;
|
|
@@ -106,7 +135,12 @@ try{
|
|
|
106
135
|
}
|
|
107
136
|
if(officeSvg){
|
|
108
137
|
const target=path.join(output,path.basename(resolved).replace(/\.(?:html|svg)$/i,'')+'-office.svg');
|
|
109
|
-
|
|
138
|
+
const {generator}=markPlan();
|
|
139
|
+
if(markPlaced){
|
|
140
|
+
const m=markPlaced;
|
|
141
|
+
officeSvg=officeSvg.replace(/<\/svg>\s*$/i,'<text data-litclaude-mark="1" x="'+m.x+'" y="'+m.y+'" font-family="Pretendard, Arial, sans-serif" font-weight="'+WORDMARK.weight+'" font-size="'+m.fs+'" letter-spacing="'+(WORDMARK.tracking*m.fs).toFixed(3)+'" text-anchor="end" fill="#'+m.ink.map((v)=>v.toString(16).padStart(2,'0')).join('')+'" fill-opacity="'+WORDMARK.cornerOpacity+'">'+WORDMARK.text+'</text>'+markLogoSvg(markLogoBox({x:m.x,y:m.y,fontSize:m.fs,textWidth:m.tw}))+'</svg>');
|
|
142
|
+
}
|
|
143
|
+
fs.writeFileSync(target,'<?xml version="1.0" encoding="UTF-8"?>\n'+(generator?svgWithMetadata(officeSvg,generator):officeSvg));
|
|
110
144
|
console.log('OFFICE_SVG '+fs.statSync(target).size+' bytes '+target+' text=live font=embedded-woff2');
|
|
111
145
|
}
|
|
112
146
|
if(registry) {
|
|
@@ -204,3 +204,5 @@ A Markdown or chat answer when a Word file was asked for; stopping to ask for fa
|
|
|
204
204
|
| Markdown quality after conversion | `references/markdown_quality_checklist.md` |
|
|
205
205
|
| LaTeX templates for the PDF path | `templates/latex/<profile>/` |
|
|
206
206
|
| Authorship and licence | `NOTICE` |
|
|
207
|
+
|
|
208
|
+
<!-- LitClaude © 2026 wjgoarxiv · MIT · github.com/wjgoarxiv/litclaude · fp:0b57a89dd9d6 -->
|
|
@@ -32,6 +32,7 @@ _sys.dont_write_bytecode = True # the installed skill directory stays read-only
|
|
|
32
32
|
_sys.path.insert(0, _os.path.join(_os.path.dirname(_os.path.abspath(__file__)), "..", "..", "..", "lib"))
|
|
33
33
|
from office_runtime_bootstrap import ensure_runtime # noqa: E402
|
|
34
34
|
from office_data import DataError, resolve_text # noqa: E402
|
|
35
|
+
import output_mark # noqa: E402
|
|
35
36
|
|
|
36
37
|
ensure_runtime(["docx", "markdown", "bs4", "yaml"])
|
|
37
38
|
|
|
@@ -1216,7 +1217,8 @@ def convert_md_to_docx(
|
|
|
1216
1217
|
except docx_design.DesignError as exc:
|
|
1217
1218
|
raise SystemExit(f"Error: {exc}") from exc
|
|
1218
1219
|
doc.save(str(docx_path))
|
|
1219
|
-
|
|
1220
|
+
output_mark.tag_ooxml(docx_path)
|
|
1221
|
+
label =f"tonality={T.name}, density={T.density}, variance={T.variance}" if not T.neutral else "plain profile"
|
|
1220
1222
|
print(f"Successfully converted {md_path} to {docx_path} [{label}, locale={lang}]")
|
|
1221
1223
|
return
|
|
1222
1224
|
|
|
@@ -1318,6 +1320,7 @@ def convert_md_to_docx(
|
|
|
1318
1320
|
drop_shadowed_theme_fonts(doc)
|
|
1319
1321
|
|
|
1320
1322
|
doc.save(str(docx_path))
|
|
1323
|
+
output_mark.tag_ooxml(docx_path)
|
|
1321
1324
|
print(
|
|
1322
1325
|
f"Successfully converted {md_path} to {docx_path} "
|
|
1323
1326
|
f"[publisher={publisher_name}, locale={detected_locale}]"
|
|
@@ -7,6 +7,7 @@ import sys as _sys
|
|
|
7
7
|
_sys.dont_write_bytecode = True # the installed skill directory stays read-only
|
|
8
8
|
_sys.path.insert(0, _os.path.join(_os.path.dirname(_os.path.abspath(__file__)), "..", "..", "..", "lib"))
|
|
9
9
|
from office_runtime_bootstrap import ensure_runtime # noqa: E402
|
|
10
|
+
import output_mark # noqa: E402
|
|
10
11
|
|
|
11
12
|
ensure_runtime(["docx", "markdown", "bs4", "yaml"])
|
|
12
13
|
|
|
@@ -269,6 +270,7 @@ def convert_md_to_pdf(
|
|
|
269
270
|
draft_tex.parent.mkdir(parents=True, exist_ok=True)
|
|
270
271
|
draft_tex.write_text(tmp_tex.read_text(encoding="utf-8"), encoding="utf-8")
|
|
271
272
|
preflight_pdf_compile(publisher_name, publisher, detected_locale)
|
|
273
|
+
tmp_tex.write_text(output_mark.tag_latex(tmp_tex.read_text(encoding="utf-8"), output_mark.meta_generator()), encoding="utf-8")
|
|
272
274
|
log = compile_latex_to_pdf(tmp_tex, pdf_path)
|
|
273
275
|
return log
|
|
274
276
|
|
|
@@ -88,3 +88,5 @@ do not forward the handoff body verbatim merely because it exists.
|
|
|
88
88
|
- Do not store transcript dumps, secrets, access tokens, cookies, or unrelated local state in the continuation packet.
|
|
89
89
|
- Do not invent completion, publication, installation, process, or Git claims.
|
|
90
90
|
- Do not treat the example handoff as a workspace template with reusable facts.
|
|
91
|
+
|
|
92
|
+
<!-- LitClaude © 2026 wjgoarxiv · MIT · github.com/wjgoarxiv/litclaude · fp:38911d6b326c -->
|
|
@@ -549,3 +549,5 @@ existing folder, and the spec adds the new skill's enrollment surfaces.
|
|
|
549
549
|
- [ ] Visual outputs shown side by side when the target makes them
|
|
550
550
|
- [ ] `REPORT.md` with Taken, Left, Provenance, exposure note, credit and review-by date
|
|
551
551
|
- [ ] `hijack.mjs check --phase report` passes; nothing committed or published without approval
|
|
552
|
+
|
|
553
|
+
<!-- LitClaude © 2026 wjgoarxiv · MIT · github.com/wjgoarxiv/litclaude · fp:ab7adac984ba -->
|
|
@@ -166,3 +166,5 @@ Review comments, README text, changelogs, commits, and pull-request prose as pro
|
|
|
166
166
|
- DOCX/PPTX and PDFs are read only after creation through bounded local extractors. If an extractor is missing, a file is unreadable, or the check times out, the guard allows the operation and shows one short note that the check did not run.
|
|
167
167
|
|
|
168
168
|
When a pattern would remove a correct fact, meaningful scope, required attribution, or the user's voice, keep the text and explain the decision only if the user needs it.
|
|
169
|
+
|
|
170
|
+
<!-- LitClaude © 2026 wjgoarxiv · MIT · github.com/wjgoarxiv/litclaude · fp:aafb10aee9f8 -->
|
|
@@ -268,6 +268,17 @@ ANTI-PATTERNS). Wait for all. Mark "generate" completed.
|
|
|
268
268
|
Mark "review" in_progress. For each generated file: remove generic advice, remove parent duplicates,
|
|
269
269
|
trim to the size limits, verify telegraphic style. Mark "review" completed.
|
|
270
270
|
|
|
271
|
+
## Phase 5 — LitFamily project block
|
|
272
|
+
|
|
273
|
+
After the review, run `litclaude-ai agent-file project --dir <repo root>` once. It adds the short
|
|
274
|
+
LitFamily project block (plans, handoff, approval and evidence conventions) between
|
|
275
|
+
`<!-- litfamily:litclaude:start … -->` and `<!-- litfamily:litclaude:end -->` markers at the end of
|
|
276
|
+
the root `AGENTS.md`, so the hand-written knowledge base above stays yours and the block is refreshed
|
|
277
|
+
in place on the next run. When the repo has no `CLAUDE.md`, it writes one containing `@AGENTS.md` so
|
|
278
|
+
Claude Code loads the same file; an existing `CLAUDE.md` is left alone, and the command prints the
|
|
279
|
+
line to add. Never edit text between the markers by hand, and never copy the block into subdirectory
|
|
280
|
+
files. Report the `AGENT_FILE:` lines it prints in the final report.
|
|
281
|
+
|
|
271
282
|
## Final report
|
|
272
283
|
|
|
273
284
|
```
|
|
@@ -276,6 +287,7 @@ Mode: {update | create-new}
|
|
|
276
287
|
Files: [OK] ./AGENTS.md (root, {N} lines) · [OK] ./src/hooks/AGENTS.md ({N} lines)
|
|
277
288
|
Dirs analyzed: {N} · Created: {N} · Updated: {N}
|
|
278
289
|
Hierarchy: ./AGENTS.md └── src/hooks/AGENTS.md
|
|
290
|
+
LitFamily block: {AGENT_FILE lines from `agent-file project`}
|
|
279
291
|
```
|
|
280
292
|
|
|
281
293
|
## Anti-patterns
|
|
@@ -287,3 +299,5 @@ Hierarchy: ./AGENTS.md └── src/hooks/AGENTS.md
|
|
|
287
299
|
- **Redundancy** — a child file never repeats its parent.
|
|
288
300
|
- **Generic content** — remove anything that applies to all projects.
|
|
289
301
|
- **Verbose style** — telegraphic or die.
|
|
302
|
+
|
|
303
|
+
<!-- LitClaude © 2026 wjgoarxiv · MIT · github.com/wjgoarxiv/litclaude · fp:3aa53c83a5d0 -->
|
|
@@ -403,3 +403,5 @@ internal fields. Avoid the vague phrase "all good". Prefer claims that can be re
|
|
|
403
403
|
skill corpus measured by whitespace tokens across `plugins/litclaude/skills/*/SKILL.md`,
|
|
404
404
|
and no package publish, commit, tag, or version bump occurred. If any check was
|
|
405
405
|
not run, say why and name the next command.
|
|
406
|
+
|
|
407
|
+
<!-- LitClaude © 2026 wjgoarxiv · MIT · github.com/wjgoarxiv/litclaude · fp:7feda2cd42b1 -->
|
|
@@ -659,3 +659,5 @@ branch or final verdict recorded, scope/non-goals preserved, temporary
|
|
|
659
659
|
resources cleaned, and release/remote mutations either explicitly approved and
|
|
660
660
|
receipted or not performed. A list of completed actions without these outcomes
|
|
661
661
|
is not a DoneClaim.
|
|
662
|
+
|
|
663
|
+
<!-- LitClaude © 2026 wjgoarxiv · MIT · github.com/wjgoarxiv/litclaude · fp:2c88c7d44185 -->
|
|
@@ -282,3 +282,5 @@ A deck that restates the request instead of answering it; stopping to ask for da
|
|
|
282
282
|
| 정/반/합 and review roles | `references/agents/*.md` |
|
|
283
283
|
| Font files and licences | `fonts/provenance.json`, `fonts/pretendard/OFL.txt`, `fonts/a2z/OFL.txt` |
|
|
284
284
|
| Engine authorship and licence | `NOTICE` |
|
|
285
|
+
|
|
286
|
+
<!-- LitClaude © 2026 wjgoarxiv · MIT · github.com/wjgoarxiv/litclaude · fp:bd05fc922eb1 -->
|
|
@@ -2207,7 +2207,10 @@ function tagLanguages(name, xml) {
|
|
|
2207
2207
|
return xml;
|
|
2208
2208
|
}
|
|
2209
2209
|
|
|
2210
|
-
/**
|
|
2210
|
+
/**
|
|
2211
|
+
* Write a deck with its Korean runs and charts tagged (see tagLanguages); `edit` may rewrite a part first.
|
|
2212
|
+
* The package also carries LitClaude's generator in docProps unless the `mark` setting is off (lib/mark.mjs).
|
|
2213
|
+
*/
|
|
2211
2214
|
async function writeTagged(pptx, outputPath, edit = (name, xml) => xml) {
|
|
2212
2215
|
const JSZip = runtimeRequire("jszip");
|
|
2213
2216
|
const zip = await JSZip.loadAsync(await pptx.write({ outputType: "nodebuffer" }));
|
|
@@ -2215,6 +2218,8 @@ async function writeTagged(pptx, outputPath, edit = (name, xml) => xml) {
|
|
|
2215
2218
|
const xml = await zip.file(name).async("string");
|
|
2216
2219
|
zip.file(name, tagLanguages(name, edit(name, xml)));
|
|
2217
2220
|
}
|
|
2221
|
+
const { tagOoxmlZip } = await import(require("url").pathToFileURL(path.resolve(TOOLKIT_ROOT, "../../lib/mark.mjs")).href);
|
|
2222
|
+
await tagOoxmlZip(zip);
|
|
2218
2223
|
fs.writeFileSync(outputPath, await zip.generateAsync({ type: "nodebuffer", compression: "DEFLATE" }));
|
|
2219
2224
|
}
|
|
2220
2225
|
|
|
@@ -171,3 +171,5 @@ with a single `- 없음` line.
|
|
|
171
171
|
- Keep the recap honest about uncertainty: unverified claims are labeled as
|
|
172
172
|
such, never upgraded to 완료.
|
|
173
173
|
- The recap itself creates no files; deliver it in the reply only.
|
|
174
|
+
|
|
175
|
+
<!-- LitClaude © 2026 wjgoarxiv · MIT · github.com/wjgoarxiv/litclaude · fp:6602ba7b9f70 -->
|
|
@@ -39,7 +39,7 @@ Claude Code lists this directory as a plugin skill, so `/litclaude:lit-schematic
|
|
|
39
39
|
|
|
40
40
|
| Mode | Trigger | Sheet and checks |
|
|
41
41
|
| --- | --- | --- |
|
|
42
|
-
| `pid` | P&ID, piping and instrumentation, 계장도, 배관계장도 | ISO A-series sheet with zone frame, title block, legend built from what is drawn, equipment header, notes; ISA-5.1 tags; QA with `TITLEBLOCK.FIELDS` and `LEGEND.COVERAGE
|
|
42
|
+
| `pid` | P&ID, piping and instrumentation, 계장도, 배관계장도 | ISO A-series sheet with zone frame, title block, legend built from what is drawn, equipment header, notes; ISA-5.1 tags; QA with `TITLEBLOCK.FIELDS` and `LEGEND.COVERAGE`; the kit prints LitClaude's small credit, the flame logo and "made with LitClaude", in the title block's OWNER cell when the user's LitClaude mark setting is on |
|
|
43
43
|
| `pfd` | PFD, BFD, process flow, 공정흐름도, equipment layout | The same sheet; major equipment and streams with stream numbers and a stream table; instruments only for control loops that define the process |
|
|
44
44
|
| `journal` | paper figure, experimental setup, apparatus, 실험 장치도, 모식도 | Exact column width (85 / 120 / 178 mm), panels (a), (b) at top left, 7 pt type (6 pt floor), stream colours from the colour-vision-safe set with a key, no title inside the art |
|
|
45
45
|
| `iso` | isometric, cutaway, 3D view, 단면 사시도, equipment illustration | Solid shaded parts in full material colour (painted steel, stainless, copper, brass, cast iron, concrete, glass; grey only when the user asks for a quiet or monochrome figure) painted far to near, window cutaway for internals, callouts in columns beside the art with leaders ending on dots on the named part; output static by default, an interactive page or a motion loop on request (below) |
|
|
@@ -121,3 +121,5 @@ A PASS needs `QA PASS` on the final SVG, a rendered PNG that was opened and read
|
|
|
121
121
|
## #contract.anti_patterns
|
|
122
122
|
|
|
123
123
|
Lines drawn through symbols or along other lines; branches leaving a bend; labels sitting on lines or on the drawn object; leaders that end in the air or on the wrong part; an instrument without a process connection or a loop without a final element; a PSV with no discharge destination; tags that break ISA-5.1 letter order; a legend that misses a symbol the sheet uses; colour as the only carrier of meaning in a journal figure; text under 6 pt at print size; a cutaway whose window removes the shell under a nozzle; a curved body shaded in steps; two callout dots so close their leaders read as one; pipe classes that look alike; a page that fetches anything from the network; an explode that moves inner parts before the parts around them; a loop whose last frame jumps to the first; and "PASS" reported from QA without opening the image.
|
|
124
|
+
|
|
125
|
+
<!-- LitClaude © 2026 wjgoarxiv · MIT · github.com/wjgoarxiv/litclaude · fp:a435673e729d -->
|
|
@@ -13,6 +13,7 @@ import * as pid from "./pid.mjs";
|
|
|
13
13
|
import { orthogonal, routeOrthogonal } from "./route.mjs";
|
|
14
14
|
import { el, esc, n, pathOf, svgDocument, textBox, textWidthEm } from "./svg.mjs";
|
|
15
15
|
import { FONT_LATIN, PID, STREAM, fontFor } from "./theme.mjs";
|
|
16
|
+
import { WORDMARK, markLogoBox, markLogoDataUri, markPlan } from "../../../../lib/mark.mjs";
|
|
16
17
|
|
|
17
18
|
const W = PID.weight;
|
|
18
19
|
|
|
@@ -830,6 +831,15 @@ export function createSheet({
|
|
|
830
831
|
cell("sheet", [x1 - 46, y0 + 10, x1, y0 + 18], "SHEET", sheet, 2.6);
|
|
831
832
|
cell("project", [x0, y0 + 18, x0 + 90, y0 + 28], "PROJECT", project || "-", 2.5);
|
|
832
833
|
cell("owner", [x0 + 90, y0 + 28 - 10, x1, y0 + 28], "OWNER", owner || "-", 2.5);
|
|
834
|
+
// The visible LitClaude mark sits in the OWNER cell, right-aligned under the owner's name, never on the drawing,
|
|
835
|
+
// with the flame logo left of the text.
|
|
836
|
+
if (markPlan().visible) {
|
|
837
|
+
cells.push(textEl(x1 - 1.5, y0 + 28 - 1.4, WORDMARK.text, 2.0, {
|
|
838
|
+
"text-anchor": "end", "data-label": "litclaude-mark", "data-within": [x0 + 90, y0 + 18, x1, y0 + 28].map(n).join(" "), fill: "#444444",
|
|
839
|
+
}));
|
|
840
|
+
const logo = markLogoBox({ x: x1 - 1.5, y: y0 + 28 - 1.4, fontSize: 2.0, textWidth: textWidthEm(WORDMARK.text) * 2.0 });
|
|
841
|
+
cells.push(el("image", { "data-litclaude-mark-logo": "1", x: n(logo.x), y: n(logo.y), width: n(logo.size), height: n(logo.size), href: markLogoDataUri() }));
|
|
842
|
+
}
|
|
833
843
|
const w5 = 180 / 5;
|
|
834
844
|
[["drawn", "DRAWN", drawn], ["checked", "CHECKED", checked], ["approved", "APPROVED", approved], ["date", "DATE", date || "-"], ["scale", "SCALE", scale]].forEach(([field, caption, value], i) => {
|
|
835
845
|
cell(field, [x0 + i * w5, y0 + 28, x0 + (i + 1) * w5, y1], caption, value || "-", 2.4);
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// viewBox unit is 1 mm at final print size, so stroke widths and font sizes are physical
|
|
3
3
|
// and the QA gate can check them without knowing the page.
|
|
4
4
|
|
|
5
|
+
import { markPlan } from "../../../../lib/mark.mjs";
|
|
6
|
+
|
|
5
7
|
export const MM_PER_PT = 25.4 / 72;
|
|
6
8
|
export const PT_PER_MM = 72 / 25.4;
|
|
7
9
|
export const ptToMm = (pt) => pt * MM_PER_PT;
|
|
@@ -63,9 +65,11 @@ export function textBox(x, y, text, size, anchor = "start") {
|
|
|
63
65
|
|
|
64
66
|
export function svgDocument({ width, height, title, desc = "", mode, lang = "en", body, defs = "", style = "", extra = {} }) {
|
|
65
67
|
if (!title) throw new Error("lit-schematic: a drawing needs a title (accessible name)");
|
|
68
|
+
const { generator } = markPlan();
|
|
66
69
|
const head = [
|
|
67
70
|
`<title id="schematic-title">${esc(title)}</title>`,
|
|
68
71
|
desc ? `<desc id="schematic-desc">${esc(desc)}</desc>` : "",
|
|
72
|
+
generator ? `<metadata id="litclaude-generator">${esc(generator)}</metadata>` : "",
|
|
69
73
|
style ? `<style>${style}</style>` : "",
|
|
70
74
|
defs ? `<defs>${defs}</defs>` : "",
|
|
71
75
|
].join("");
|
|
@@ -17,6 +17,7 @@ import { tmpdir } from "node:os";
|
|
|
17
17
|
import { join, resolve } from "node:path";
|
|
18
18
|
import { pathToFileURL } from "node:url";
|
|
19
19
|
import { findChrome, renderPng, svgSize } from "./render.mjs";
|
|
20
|
+
import { ffmpegMetadataArgs, tagFile } from "../../../lib/mark.mjs";
|
|
20
21
|
|
|
21
22
|
export function findTool(name, env = process.env) {
|
|
22
23
|
const dirs = (env.PATH ?? "").split(process.platform === "win32" ? ";" : ":").filter(Boolean);
|
|
@@ -58,7 +59,7 @@ export function renderMotion({ frame, out, name = "loop", seconds = 4, fps = 24,
|
|
|
58
59
|
const svg = frame(i / count);
|
|
59
60
|
size ??= svgSize(svg);
|
|
60
61
|
const dpi = (width / size.width) * 25.4;
|
|
61
|
-
renderPng({ chrome, svg, out: join(frames, `f${String(i).padStart(4, "0")}.png`), dpi, verify: false });
|
|
62
|
+
renderPng({ chrome, svg, out: join(frames, `f${String(i).padStart(4, "0")}.png`), dpi, verify: false, tag: false });
|
|
62
63
|
onFrame?.(i + 1, count);
|
|
63
64
|
}
|
|
64
65
|
const even = "scale=trunc(iw/2)*2:trunc(ih/2)*2";
|
|
@@ -66,12 +67,13 @@ export function renderMotion({ frame, out, name = "loop", seconds = 4, fps = 24,
|
|
|
66
67
|
const input = ["-y", "-loglevel", "error", "-framerate", String(fps), "-i", join(frames, "f%04d.png")];
|
|
67
68
|
if (formats.includes("mp4")) {
|
|
68
69
|
const file = join(out, `${name}.mp4`);
|
|
69
|
-
run(tools.ffmpeg, [...input, "-vf", `${even},format=yuv420p`, "-c:v", "libx264", "-crf", "18", "-preset", "slow", "-movflags", "+faststart", file]);
|
|
70
|
+
run(tools.ffmpeg, [...input, "-vf", `${even},format=yuv420p`, "-c:v", "libx264", "-crf", "18", "-preset", "slow", "-movflags", "+faststart", ...ffmpegMetadataArgs(), file]);
|
|
70
71
|
results.mp4 = file;
|
|
71
72
|
}
|
|
72
73
|
if (formats.includes("gif")) {
|
|
73
74
|
const file = join(out, `${name}.gif`);
|
|
74
75
|
run(tools.ffmpeg, [...input, "-vf", `scale=${small}:-1:flags=lanczos,split[a][b];[a]palettegen=max_colors=128:stats_mode=diff[p];[b][p]paletteuse=dither=bayer:bayer_scale=4`, "-loop", "0", file]);
|
|
76
|
+
tagFile(file);
|
|
75
77
|
results.gif = file;
|
|
76
78
|
}
|
|
77
79
|
if (formats.includes("webp")) {
|
|
@@ -82,6 +84,7 @@ export function renderMotion({ frame, out, name = "loop", seconds = 4, fps = 24,
|
|
|
82
84
|
const delay = String(Math.round(1000 / fps));
|
|
83
85
|
const list = readdirSync(smallDir).filter((f) => f.endsWith(".png")).sort();
|
|
84
86
|
run(tools.img2webp, ["-loop", "0", "-lossy", "-q", "78", "-m", "4", ...list.flatMap((f) => ["-d", delay, join(smallDir, f)]), "-o", file]);
|
|
87
|
+
tagFile(file);
|
|
85
88
|
results.webp = file;
|
|
86
89
|
}
|
|
87
90
|
return { frames: count, fps, seconds, width, files: Object.fromEntries(Object.entries(results).map(([k, f]) => [k, { file: f, bytes: statSync(f).size }])) };
|
|
@@ -17,11 +17,23 @@ import { basename, join, resolve } from "node:path";
|
|
|
17
17
|
import { pathToFileURL } from "node:url";
|
|
18
18
|
import { findPretendard } from "./lib/fonts.mjs";
|
|
19
19
|
import { inkGrid, missingInk, pngInfo, withDpi } from "./lib/png.mjs";
|
|
20
|
+
import { tagFile } from "../../../lib/mark.mjs";
|
|
20
21
|
|
|
21
22
|
export const CHROME_FLAGS = Object.freeze([
|
|
22
23
|
"--headless=new", "--use-mock-keychain", "--password-store=basic", "--no-first-run",
|
|
23
24
|
"--no-default-browser-check", "--disable-gpu", "--hide-scrollbars", "--disable-extensions",
|
|
24
25
|
]);
|
|
26
|
+
// On POSIX Chrome runs in its own process group behind a shell that execs it (so it keeps the
|
|
27
|
+
// shell's PID) after starting a watcher. The watcher polls this process and Chrome, and when either
|
|
28
|
+
// is gone it kills the group, so a render killed mid-run never leaves Chrome alive under PID 1.
|
|
29
|
+
const TETHER = [
|
|
30
|
+
'parent=$1; group=$$; shift',
|
|
31
|
+
'( trap "" TERM INT HUP',
|
|
32
|
+
' while kill -0 "$parent" 2>/dev/null && kill -0 "$group" 2>/dev/null; do sleep 0.1; done',
|
|
33
|
+
' kill -TERM -"$group" 2>/dev/null; sleep 0.2; kill -KILL -"$group" 2>/dev/null',
|
|
34
|
+
') </dev/null >/dev/null 2>&1 &',
|
|
35
|
+
'exec "$@"',
|
|
36
|
+
].join("\n");
|
|
25
37
|
const PX_PER_MM = 96 / 25.4;
|
|
26
38
|
const MAX_SIDE = 16000;
|
|
27
39
|
// Headless Chrome returns a screenshot larger than about 100 million pixels with only its first
|
|
@@ -84,7 +96,10 @@ function runChrome(chrome, args, html, work) {
|
|
|
84
96
|
writeFileSync(file, html);
|
|
85
97
|
const profile = mkdtempSync(join(work, "profile-"));
|
|
86
98
|
try {
|
|
87
|
-
const
|
|
99
|
+
const argv = [...CHROME_FLAGS, `--user-data-dir=${profile}`, ...args, pathToFileURL(file).href];
|
|
100
|
+
const result = process.platform === "win32"
|
|
101
|
+
? spawnSync(chrome, argv, { encoding: "utf8", timeout: 180_000 })
|
|
102
|
+
: spawnSync("/bin/sh", ["-c", TETHER, "litclaude-chrome", String(process.pid), chrome, ...argv], { encoding: "utf8", timeout: 180_000, detached: true });
|
|
88
103
|
if (result.error) throw new Error(`RENDER_FAILED ${result.error.message}`);
|
|
89
104
|
if (result.status !== 0) throw new Error(`RENDER_FAILED chrome exited ${result.status}: ${(result.stderr || "").split("\n").slice(-3).join(" ")}`);
|
|
90
105
|
} finally {
|
|
@@ -93,7 +108,8 @@ function runChrome(chrome, args, html, work) {
|
|
|
93
108
|
}
|
|
94
109
|
|
|
95
110
|
// `verify: false` skips the reference render, for film frames far below the size that can fail.
|
|
96
|
-
|
|
111
|
+
// `tag: false` leaves the generator tag off, for working frames that never leave the run.
|
|
112
|
+
export function renderPng({ chrome, svg, out, dpi = 600, crop = null, verify = true, tag = true }) {
|
|
97
113
|
const size = svgSize(svg);
|
|
98
114
|
let source = svg;
|
|
99
115
|
let widthMm = size.width;
|
|
@@ -130,6 +146,7 @@ export function renderPng({ chrome, svg, out, dpi = 600, crop = null, verify = t
|
|
|
130
146
|
}
|
|
131
147
|
const png = withDpi(readFileSync(raw), used);
|
|
132
148
|
writeFileSync(out, png);
|
|
149
|
+
if (tag) tagFile(out);
|
|
133
150
|
return { out, ...pngInfo(png), requestedDpi: dpi };
|
|
134
151
|
} finally {
|
|
135
152
|
rmSync(work, { recursive: true, force: true });
|
|
@@ -141,6 +158,7 @@ export function renderPdf({ chrome, svg, out }) {
|
|
|
141
158
|
const work = mkdtempSync(join(tmpdir(), "lit-schematic-render-"));
|
|
142
159
|
try {
|
|
143
160
|
runChrome(chrome, ["--no-pdf-header-footer", `--print-to-pdf=${resolve(out)}`], page({ svg, widthMm: size.width, heightMm: size.height }), work);
|
|
161
|
+
tagFile(out);
|
|
144
162
|
return { out, widthMm: size.width, heightMm: size.height };
|
|
145
163
|
} finally {
|
|
146
164
|
rmSync(work, { recursive: true, force: true });
|
|
@@ -102,3 +102,5 @@ always remains visible; protected structured or audit artifacts retain their sch
|
|
|
102
102
|
- Do not treat a green unit test as proof that a produced figure is visually correct.
|
|
103
103
|
- Do not use the source-checkout placeholder `<skill-path>` literally; resolve the installed vendor source root.
|
|
104
104
|
- Do not make optional dependency absence fail all of LitClaude; report the affected capability as DEGRADED.
|
|
105
|
+
|
|
106
|
+
<!-- LitClaude © 2026 wjgoarxiv · MIT · github.com/wjgoarxiv/litclaude · fp:df87d26bdbf3 -->
|
|
@@ -179,3 +179,5 @@ an unrecorded cleanup item, and the next session will not know the team ever exi
|
|
|
179
179
|
|
|
180
180
|
If fewer than two genuinely distinct slices exist, say so and use a single subagent. Splitting
|
|
181
181
|
work that does not divide is slower than not splitting it.
|
|
182
|
+
|
|
183
|
+
<!-- LitClaude © 2026 wjgoarxiv · MIT · github.com/wjgoarxiv/litclaude · fp:2353642f72ff -->
|
|
@@ -147,3 +147,5 @@ Never raise a gate number, never weaken the flash audit, never ship a withheld e
|
|
|
147
147
|
- Quoting song lyrics or other text the user does not own as the film's content.
|
|
148
148
|
|
|
149
149
|
Every reference is named at its step above. Type engine credit: portions adapted from mexicat/pdoom-video (MIT), commit `ca251e3`; see `engine/NOTICE`.
|
|
150
|
+
|
|
151
|
+
<!-- LitClaude © 2026 wjgoarxiv · MIT · github.com/wjgoarxiv/litclaude · fp:10c6f3985f09 -->
|
|
@@ -162,13 +162,33 @@ export function launchArgs(profileDir, flags) {
|
|
|
162
162
|
];
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
// Chrome is tied to this process on POSIX: a shell becomes the leader of a new process group,
|
|
166
|
+
// starts a watcher that leaves the group's descriptors and signals alone, and then execs Chrome,
|
|
167
|
+
// so Chrome keeps the shell's PID. The watcher polls this process and Chrome; once either is gone
|
|
168
|
+
// it sends TERM, then KILL, to the whole group. A launcher killed mid-run, even by SIGKILL, so
|
|
169
|
+
// never leaves Chrome or its helpers alive under PID 1.
|
|
170
|
+
const TETHER = [
|
|
171
|
+
'parent=$1; group=$$; shift',
|
|
172
|
+
'( trap "" TERM INT HUP',
|
|
173
|
+
' while kill -0 "$parent" 2>/dev/null && kill -0 "$group" 2>/dev/null; do sleep 0.1; done',
|
|
174
|
+
' kill -TERM -"$group" 2>/dev/null; sleep 0.2; kill -KILL -"$group" 2>/dev/null',
|
|
175
|
+
') </dev/null >/dev/null 2>&1 3>&- 4>&- &',
|
|
176
|
+
'exec "$@"',
|
|
177
|
+
].join("\n");
|
|
178
|
+
|
|
179
|
+
/** `spawn` for Chrome: tethered in its own process group on POSIX, a plain child on Windows. */
|
|
180
|
+
function spawnTethered(chrome, args, options) {
|
|
181
|
+
if (process.platform === "win32") return spawn(chrome, args, options);
|
|
182
|
+
return spawn("/bin/sh", ["-c", TETHER, "litclaude-chrome", String(process.pid), chrome, ...args], { ...options, detached: true });
|
|
183
|
+
}
|
|
184
|
+
|
|
165
185
|
export class ChromeSession {
|
|
166
186
|
static async launch({ chrome, flags, profileDir, routes, timeoutMs = 30000 }) {
|
|
167
187
|
mkdirSync(profileDir, { recursive: true });
|
|
168
188
|
const args = launchArgs(profileDir, flags);
|
|
169
189
|
let child;
|
|
170
190
|
try {
|
|
171
|
-
child =
|
|
191
|
+
child = spawnTethered(chrome, args, { stdio: ["ignore", "ignore", "pipe", "pipe", "pipe"] });
|
|
172
192
|
} catch (error) {
|
|
173
193
|
throw new BlockedError(EXIT.BLOCKED_NO_CHROME, `BLOCKED_NO_CHROME: Chrome failed to launch: ${error.message}`);
|
|
174
194
|
}
|
|
@@ -266,7 +286,8 @@ export class ChromeSession {
|
|
|
266
286
|
|
|
267
287
|
kill() {
|
|
268
288
|
try {
|
|
269
|
-
this.child.kill("SIGKILL");
|
|
289
|
+
if (process.platform === "win32") this.child.kill("SIGKILL");
|
|
290
|
+
else process.kill(-this.child.pid, "SIGKILL");
|
|
270
291
|
} catch {
|
|
271
292
|
// already gone
|
|
272
293
|
}
|
|
@@ -127,10 +127,23 @@ export class CoverBrowser {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
/**
|
|
131
|
+
* LitClaude's visible mark as a fixed overlay outside the page's own tree, the same on every frame so the loop
|
|
132
|
+
* stays seamless. `mark` is { x, y, w, h, fontSize, ink, opacity, text, weight, tracking } in page pixels; with
|
|
133
|
+
* `measure: true` it is laid out hidden and its rendered width is returned. Mask captures hide it.
|
|
134
|
+
*/
|
|
135
|
+
async setMark(mark, { measure = false } = {}) {
|
|
136
|
+
this.mark = mark;
|
|
137
|
+
const css = { position: "fixed", left: `${measure ? -9999 : mark.x}px`, top: `${measure ? -9999 : mark.y}px`, height: `${mark.h}px`, display: "flex", alignItems: "center", justifyContent: "flex-end", whiteSpace: "nowrap", pointerEvents: "none", zIndex: "2147483647", font: `${mark.weight} ${mark.fontSize}px/1 Pretendard, sans-serif`, letterSpacing: `${mark.tracking}em`, color: `rgb(${mark.ink.join(",")})`, opacity: String(mark.opacity), visibility: measure ? "hidden" : "visible" };
|
|
138
|
+
if (!measure) css.width = `${mark.w}px`;
|
|
139
|
+
return this.evaluate(`(async () => { let d = document.getElementById("__litclaude_mark"); if (!d) { d = document.createElement("div"); d.id = "__litclaude_mark"; document.documentElement.appendChild(d); } d.textContent = ""; const logo = ${JSON.stringify(mark.logo ?? null)}; if (logo) { const i = new Image(); i.src = logo.src; Object.assign(i.style, { height: logo.scale + "em", marginRight: logo.gap + "em", display: "block" }); d.appendChild(i); await i.decode(); } d.appendChild(document.createTextNode(${JSON.stringify(mark.text)})); d.removeAttribute("style"); Object.assign(d.style, ${JSON.stringify(css)}); if (document.fonts) await document.fonts.ready; return d.getBoundingClientRect().width; })()`);
|
|
140
|
+
}
|
|
141
|
+
|
|
130
142
|
/** Draw loop time t (and the mask variant) and wait for the frame to settle. */
|
|
131
143
|
async frame(t, { mask = false } = {}) {
|
|
132
144
|
try {
|
|
133
|
-
|
|
145
|
+
const markToggle = this.mark ? `const m = document.getElementById("__litclaude_mark"); if (m) m.style.visibility = ${mask ? '"hidden"' : '"visible"'};` : "";
|
|
146
|
+
await this.evaluate(`(async () => { await window.renderFrame(${t}, ${JSON.stringify({ mask })}); ${markToggle} if (document.fonts) await document.fonts.ready; return true; })()`);
|
|
134
147
|
} catch (error) {
|
|
135
148
|
await this.check(`at t = ${t.toFixed(4)}`);
|
|
136
149
|
throw new BlockedError(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: renderFrame(${t.toFixed(4)}${mask ? ", { mask: true }" : ""}) threw: ${error.message}`);
|
|
@@ -23,6 +23,8 @@ import { lumaGrid } from "./cover-image.mjs";
|
|
|
23
23
|
import { renderSheet } from "./cover-sheet.mjs";
|
|
24
24
|
import { loadCoverTreatment } from "./cover-treatment.mjs";
|
|
25
25
|
import { findFfmpeg, findImg2webp, which } from "./encode.mjs";
|
|
26
|
+
import { WORDMARK, findClearSpot, markLogoDataUri, markPlan, tagFile } from "../../../../lib/mark.mjs";
|
|
27
|
+
import { decodePng } from "./png.mjs";
|
|
26
28
|
import { asBlocked } from "./pipeline.mjs";
|
|
27
29
|
import { encodePng, rgbaToRgb } from "./png.mjs";
|
|
28
30
|
import { rasterInfo, scanStage, stageFonts } from "./stage-serve.mjs";
|
|
@@ -182,6 +184,33 @@ function readRaster(file, env) {
|
|
|
182
184
|
}
|
|
183
185
|
}
|
|
184
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Place LitClaude's visible corner mark (mark setting `on`) on a cover: sized from the output's short side, put at
|
|
189
|
+
* the clear spot nearest the bottom-right of frame 0, outside the title box and every art check box, in the
|
|
190
|
+
* ground's own ink. Returns the overlay spec in page pixels, or null with a notice when no clear spot exists.
|
|
191
|
+
*/
|
|
192
|
+
async function placeCoverMark(browser, { treatment, assets, notices }) {
|
|
193
|
+
const [pw] = treatment.page;
|
|
194
|
+
const [w] = treatment.out;
|
|
195
|
+
const toPage = pw / w;
|
|
196
|
+
const fontSize = Math.max(WORDMARK.minPx, WORDMARK.cornerShare * Math.min(...treatment.out)) * toPage;
|
|
197
|
+
const h = Math.ceil(fontSize * 1.4);
|
|
198
|
+
const base = { fontSize, h, ink: [0, 0, 0], opacity: WORDMARK.cornerOpacity, text: WORDMARK.text, weight: WORDMARK.weight, tracking: WORDMARK.tracking, logo: { src: markLogoDataUri(), scale: WORDMARK.logoScale, gap: WORDMARK.logoGap } };
|
|
199
|
+
const textW = Math.ceil(await browser.setMark(base, { measure: true }));
|
|
200
|
+
await browser.frame(0);
|
|
201
|
+
const image = decodePng(await browser.capture());
|
|
202
|
+
const k = image.width / pw;
|
|
203
|
+
const frac = ([x, y, bw, bh]) => [x * image.width, y * image.height, (x + bw) * image.width, (y + bh) * image.height];
|
|
204
|
+
const exclude = [frac(treatment.title.box), ...assets.filter((a) => a.checkBox ?? a.box).map((a) => frac(a.checkBox ?? a.box))];
|
|
205
|
+
const spot = findClearSpot(image, { boxW: textW * k, boxH: h * k, inset: WORDMARK.insetShare * Math.min(image.width, image.height), pad: 0.6 * fontSize * k, exclude });
|
|
206
|
+
if (!spot) {
|
|
207
|
+
notices.push("the LitClaude mark found no clear spot in the bottom quarter outside the title and art boxes; this cover carries the invisible tag only");
|
|
208
|
+
browser.mark = null;
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
return { ...base, x: spot.x / k, y: spot.y / k, w: textW, ink: spot.ink };
|
|
212
|
+
}
|
|
213
|
+
|
|
185
214
|
/** Everything a cover round checks before the first capture: treatment, page, scan, assets, fonts. */
|
|
186
215
|
function prepare({ out, env, log }) {
|
|
187
216
|
const treatment = asBlocked(() => loadCoverTreatment(out));
|
|
@@ -215,6 +244,7 @@ export async function renderCover({ out, round = 1, env = process.env, log = ()
|
|
|
215
244
|
const order = seekOrder(times.length, treatment.seed || 20261020);
|
|
216
245
|
let rung = treatment.recipe === "hero-3d" ? "gpu" : "software";
|
|
217
246
|
const notices = [];
|
|
247
|
+
let coverMark = null;
|
|
218
248
|
try {
|
|
219
249
|
const open = (label) => CoverBrowser.open({ stageDir, faces, width: pw, height: ph, scale: COVER.captureScale, profileDir: path.join(runDir, `chrome-${label}`), rung, env, log });
|
|
220
250
|
let a;
|
|
@@ -229,6 +259,17 @@ export async function renderCover({ out, round = 1, env = process.env, log = ()
|
|
|
229
259
|
a = await open("master");
|
|
230
260
|
}
|
|
231
261
|
try {
|
|
262
|
+
// The mark is placed from frame 0 in a browser of its own, so the capture passes start from the same page
|
|
263
|
+
// state as without it (a page that keeps state between frames is still caught by the seek check).
|
|
264
|
+
if (markPlan({ env }).visible) {
|
|
265
|
+
const m = await open("mark");
|
|
266
|
+
try {
|
|
267
|
+
coverMark = await placeCoverMark(m, { treatment, assets, notices });
|
|
268
|
+
} finally {
|
|
269
|
+
await m.close();
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (coverMark) await a.setMark(coverMark);
|
|
232
273
|
master = await capturePass({ browser: a, pool, times, dir: dirs.frames, prefix: "f", width: w, height: h });
|
|
233
274
|
await capturePass({ browser: a, pool, times, dir: dirs.masks, prefix: "m", mask: true, width: w, height: h });
|
|
234
275
|
} finally {
|
|
@@ -236,13 +277,15 @@ export async function renderCover({ out, round = 1, env = process.env, log = ()
|
|
|
236
277
|
}
|
|
237
278
|
const b = await open("replay");
|
|
238
279
|
try {
|
|
239
|
-
|
|
280
|
+
if (coverMark) await b.setMark(coverMark);
|
|
281
|
+
replay =await capturePass({ browser: b, pool, times, dir: dirs.frames2, prefix: "f", width: w, height: h });
|
|
240
282
|
} finally {
|
|
241
283
|
await b.close();
|
|
242
284
|
}
|
|
243
285
|
const c = await open("seek");
|
|
244
286
|
try {
|
|
245
|
-
|
|
287
|
+
if (coverMark) await c.setMark(coverMark);
|
|
288
|
+
sought =await capturePass({ browser: c, pool, times: order.map((i) => times[i]), dir: dirs.seek, prefix: "s", width: w, height: h });
|
|
246
289
|
} finally {
|
|
247
290
|
await c.close();
|
|
248
291
|
}
|
|
@@ -271,6 +314,7 @@ export async function renderCover({ out, round = 1, env = process.env, log = ()
|
|
|
271
314
|
const files = pngFrames(dirs.frames, "f");
|
|
272
315
|
const flash = flashAudit(files, treatment.fps);
|
|
273
316
|
const encoded = encodeCover({ files, fps: treatment.fps, encode: treatment.encode, out, env });
|
|
317
|
+
tagFile(encoded.file, { env });
|
|
274
318
|
for (const stale of COVER_OUTPUTS.filter((f) => path.join(out, f) !== encoded.file)) rmSync(path.join(out, stale), { force: true });
|
|
275
319
|
const planned = times.length * ms;
|
|
276
320
|
const wanted = new Set([0, ...Array.from({ length: SHEET_TILES }, (_, k) => (k / SHEET_TILES) * planned)]);
|
|
@@ -302,6 +346,7 @@ export async function renderCover({ out, round = 1, env = process.env, log = ()
|
|
|
302
346
|
});
|
|
303
347
|
const indexed = stills.finish(sheetFile);
|
|
304
348
|
writeFileSync(path.join(out, "poster.png"), readFileSync(path.join(stills.dir, "poster.png")));
|
|
349
|
+
tagFile(path.join(out, "poster.png"), { env });
|
|
305
350
|
const report = `${formatCoverReport(gate, { strict: true })}${notices.map((n) => `warning: ${n}\n`).join("")}`;
|
|
306
351
|
writeFileSync(path.join(out, "gate-report.txt"), report);
|
|
307
352
|
const manifest = {
|
|
@@ -309,6 +354,7 @@ export async function renderCover({ out, round = 1, env = process.env, log = ()
|
|
|
309
354
|
treatmentSha256: sha256(readFileSync(path.join(out, "treatment.json"))), stillsSha256: indexed.sha256,
|
|
310
355
|
page: treatment.page, size: treatment.out, scale: COVER.captureScale, rung, warnings: notices, fps: treatment.fps, frames: times.length, frameMs: ms,
|
|
311
356
|
encoder: encoded.encoder, encode: treatment.encode, file: path.basename(encoded.file), bytes: statSync(encoded.file).size, captureSec,
|
|
357
|
+
mark: coverMark ? { text: coverMark.text, x: +coverMark.x.toFixed(1), y: +coverMark.y.toFixed(1), w: coverMark.w, fontSize: +coverMark.fontSize.toFixed(2), ink: coverMark.ink } : null,
|
|
312
358
|
gate: { pass: gate.pass, target: gate.target, medianD: gate.medianD, movingFrac: gate.movingFrac, longestStillSec: gate.longestStillSec, spike: gate.spike, seamLocal: gate.seamLocal, gates: gate.gates },
|
|
313
359
|
};
|
|
314
360
|
writeJson(path.join(out, "manifest.json"), manifest);
|