tracetoon 1.0.0-rc.39 → 1.0.0-rc.40

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tracetoon",
3
- "version": "1.0.0-rc.39",
3
+ "version": "1.0.0-rc.40",
4
4
  "description": "Pull request descriptions written from your AI coding agent’s session logs, with every claim checked against the evidence. Better PRs at lower cost. Run: npx tracetoon@latest setup",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://tracetoon.ai",
@@ -30,10 +30,10 @@
30
30
  "node": ">=18"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@tracetoon/cli-linux-x64": "1.0.0-rc.39",
34
- "@tracetoon/cli-linux-arm64": "1.0.0-rc.39",
35
- "@tracetoon/cli-darwin-x64": "1.0.0-rc.39",
36
- "@tracetoon/cli-darwin-arm64": "1.0.0-rc.39",
37
- "@tracetoon/cli-win32-x64": "1.0.0-rc.39"
33
+ "@tracetoon/cli-linux-x64": "1.0.0-rc.40",
34
+ "@tracetoon/cli-linux-arm64": "1.0.0-rc.40",
35
+ "@tracetoon/cli-darwin-x64": "1.0.0-rc.40",
36
+ "@tracetoon/cli-darwin-arm64": "1.0.0-rc.40",
37
+ "@tracetoon/cli-win32-x64": "1.0.0-rc.40"
38
38
  }
39
39
  }
@@ -1 +1 @@
1
- 1.0.0-rc.39
1
+ 1.0.0-rc.40
@@ -1,7 +1,7 @@
1
1
  {
2
- "version": "1.0.0-rc.39",
3
- "buildId": "7f6ce9ec1a7273249e1d982f01d25f1c0ad58c3109898875850111a35eb3a65f",
4
- "revision": "adf1f54f98bba9f969c61e8bd29f0d70e9ee960c",
2
+ "version": "1.0.0-rc.40",
3
+ "buildId": "0c480515d800ce2bfd6e4c7ad403e3b9cb65e123ebd0af1918b81bc93adb741e",
4
+ "revision": "58e758dd1a63afde73aa7c6722bd701a26b1e37f",
5
5
  "protocol": 2,
6
6
  "dependencies": [
7
7
  {
@@ -326,7 +326,7 @@ export default function (amp: any) {
326
326
  }
327
327
  `}function tW(Q){let $=Q.split(/\r?\n/,1)[0]??"";return $.startsWith("// tracetoon:amp-plugin")?$.slice(23).trim():void 0}var QG=(Q,$)=>E6($.XDG_CONFIG_HOME||E6(Q,".config"),"amp"),eW=(Q,$)=>kI(QG(Q,$))||!!$0("amp",$),$G={id:"amp",label:"Amp",status:"partial",supportTier:"community",variants:"CLI",limits:["Amp keeps its threads on Amp's servers, so the PR is written from the diff and git history, not session logs.","Only PR commands run in the shell are redirected to Tracetoon."],traces:[],hook:{file:(Q,$)=>E6(QG(Q,$),"plugins","tracetoon.ts"),present:eW,apply:(Q)=>Q,installedCommand:()=>{return},text:{render:rW,command:tW},parse:(Q)=>w4(Q,"amp"),deny:b4,installNote:()=>'In Amp, run "plugins: reload" from the command palette, or start a new session.'},skill:(Q,$)=>({present:eW(Q,$),dir:E6(Q,".agents","skills","tracetoon")})};import{existsSync as lI}from"node:fs";import{join as dI}from"node:path";import{existsSync as JG}from"node:fs";import{createRequire as yI}from"node:module";import{homedir as xI}from"node:os";import{isAbsolute as wI,join as u4,resolve as tZ,sep as ZG}from"node:path";var _3=(Q)=>typeof Q==="object"&&Q!==null&&!Array.isArray(Q),I5=(Q)=>typeof Q==="string"&&Q.length?Q:void 0;function S6(Q=process.env,$=xI()){if(Q.ZED_DATA_DIR)return Q.ZED_DATA_DIR;if(process.platform==="win32")return u4(Q.LOCALAPPDATA||u4($,"AppData","Local"),"Zed");if(process.platform==="darwin")return u4($,"Library","Application Support","Zed");return u4(Q.XDG_DATA_HOME||u4($,".local","share"),"zed")}var eZ=()=>u4(S6(),"threads","threads.db"),bI=new Set(["read_file","list_directory","grep","find_path","diagnostics","fetch","web_search","thinking","now","open","skill","project_notifications","copy_path","create_directory"]);function vI(){let Q=globalThis.Bun;if(typeof Q?.zstdDecompressSync==="function")return($)=>Q.zstdDecompressSync($);try{let $=yI(import.meta.url)("node:zlib");if(typeof $.zstdDecompressSync==="function")return(Z)=>$.zstdDecompressSync(Z)}catch{}return}function XG(Q,$,Z){try{let X=Q;if($==="zstd"){let z=vI();if(!z){Z.push("Zed threads are zstd-compressed and this runtime cannot read zstd.");return}X=z(Q)}let Y=typeof X==="string"?X:new TextDecoder().decode(X),J=JSON.parse(Y);return _3(J)?J:void 0}catch{Z.push("Skipped a Zed thread that could not be decoded.");return}}function fI(Q,$){let Z=new Map;for(let J of a(Q))Z.set(J,(Z.get(J)??0)+1);let X=[];for(let J of a($)){let z=Z.get(J)??0;if(z>0)Z.set(J,z-1);else X.push(J)}let Y=[];for(let[J,z]of Z)for(let K=0;K<z;K++)Y.push(J);return{added:X,removed:Y}}var gI=(Q)=>typeof Q.output==="string"?Q.output:Array.isArray(Q.content)?Q.content.map(($)=>_3($)&&typeof $.Text==="string"?$.Text:"").join(`
328
328
  `):"";function hI(Q){let $=/failed with exit code (-?\d+)/.exec(Q),Z=/```[^\n]*\n([\s\S]*?)\n?```/.exec(Q);return{exit:$?Number($[1]):void 0,output:(Z?Z[1]:"").trim()}}function mI(Q,$,Z,X){let Y=X??I5(Q.initial_project_snapshot?.timestamp)??I5(Q.updated_at),J=Array.isArray(Q.messages)?Q.messages.filter(_3):[],z={};for(let K of J)if(_3(K.Agent)&&_3(K.Agent.tool_results))Object.assign(z,K.Agent.tool_results);for(let K of J){let V=_3(K.User)?"user":_3(K.Agent)?"agent":void 0;if(!V){let W=Object.keys(K)[0]??"?";$.unknownTypes[W]=($.unknownTypes[W]??0)+1;continue}let G=Array.isArray(K[V==="user"?"User":"Agent"].content)?K[V==="user"?"User":"Agent"].content.filter(_3):[];for(let W of G){if(typeof W.Text==="string"){let N=W.Text.trim();if(!N)continue;if(V==="user"){if(!W0(N))$.records.push({kind:"prompt",text:N,ts:Y,cwd:Z})}else $.records.push({kind:"assistant",text:N,ts:Y,cwd:Z});continue}if(!_3(W.ToolUse))continue;let B=W.ToolUse,H=I5(B.name)??"";N0($);let U=_3(B.input?.value)?B.input.value:(()=>{try{let N=JSON.parse(B.raw_input??"");return _3(N)?N:{}}catch{return{}}})(),M=I5(B.id)?z[B.id]:void 0;if(H==="terminal"&&I5(U.command)){let N={kind:"command",cmd:U.command,ts:Y,cwd:I5(U.cd)??Z};if(!M)N.pending=!0;else{let{exit:D,output:C}=hI(gI(M));if(M.is_error===!0||D!==void 0&&D!==0)N.isError=!0;if(C)N.output=C.slice(0,4000)}$.records.push(N)}else if((H==="edit_file"||H==="streaming_edit_file")&&_3(M?.output)&&typeof M.output.new_text==="string"){let N=M.output,D=I5(N.original_path)??I5(U.path)??"",C=wI(D)?D:tZ(Z??".",D),_=typeof N.old_text==="string"?N.old_text:"",{added:I,removed:F}=fI(_,N.new_text);$.records.push({kind:"edit",file:C,added:I,removed:F,..._===""&&U.mode==="create"?{created:!0}:{},ts:Y,cwd:Z})}else if(!bI.has(H))j0($,H)}}}function rZ(Q,...$){let Z=eZ();if(!JG(Z))return[];try{let X=K3(Z);if(!X)return[];try{return X.all(Q,...$)}finally{X.close()}}catch{return[]}}var YG=(Q,$)=>{let Z=tZ(Q).toLowerCase(),X=tZ($).toLowerCase();return Z===X||Z.startsWith(X.endsWith(ZG)?X:X+ZG)},uI=(Q)=>(Q.folder_paths??"").split(/\r?\n/).map(($)=>$.trim()).filter(Boolean);function cI(Q){let $=[];for(let Z of Array.isArray(Q.messages)?Q.messages:[])for(let X of _3(Z?.Agent)&&Array.isArray(Z.Agent.content)?Z.Agent.content:[])if(_3(X?.ToolUse)&&X.ToolUse.name==="terminal"){let Y=I5(X.ToolUse.input?.value?.cd);if(Y)$.push(Y)}return $}var zG={id:"zed",label:"Zed",home:()=>JG(eZ())?S6():void 0,count:()=>rZ("select id from threads").length,discover(Q){let $=[],Z=new Date(Q.sinceMs).toISOString();for(let X of rZ("select id, summary, updated_at, data_type, data, folder_paths, parent_id from threads where updated_at >= ?",Z)){let Y=uI(X),J=Y.find((z)=>Q.all||Q.roots.some((K)=>YG(z,K)));if(!J&&!Q.all){let z=XG(X.data,X.data_type,[]);J=z?cI(z).find((K)=>Q.roots.some((V)=>YG(K,V))):void 0}if(!J&&!Q.all)continue;$.push({agent:"zed",sessionId:X.id,path:`${eZ()}#${X.id}`,mtimeMs:Date.parse(X.updated_at)||0,cwd:J??Y[0]})}return $},read(Q){let $={agent:"zed",sessionId:Q.sessionId,source:Q.path,records:[],unknownTypes:{},warnings:[]},Z=rZ("select id, summary, updated_at, created_at, data_type, data, folder_paths, parent_id from threads where id = ?",Q.sessionId)[0];if(!Z)return $;if(Z.summary)$.title=Z.summary;if(Z.parent_id)$.parentSessionId=Z.parent_id;let X=XG(Z.data,Z.data_type,$.warnings);if(X)mI(X,$,Q.cwd,Z.created_at??void 0);return $}};var pI=(Q,$)=>lI(S6($,Q))||!!$0("zed",$),KG={id:"zed",label:"Zed",status:"partial",supportTier:"community",variants:"Zed Agent",limits:["Zed has no hook before its agent's tools, so a PR command run by the Zed Agent isn't redirected; the agent can still use the Tracetoon skill.","Claude Code, Codex and Copilot CLI run inside Zed are covered by their own integrations."],traces:[zG],skill:(Q,$)=>({present:pI(Q,$),dir:dI(Q,".agents","skills","tracetoon")})};import{existsSync as rI}from"node:fs";import{dirname as tI,join as eI}from"node:path";import{existsSync as GG}from"node:fs";import{homedir as iI}from"node:os";import{join as J8,resolve as QX,sep as VG}from"node:path";var c2=(Q)=>typeof Q==="string"&&Q.length?Q:void 0;function c4(Q=process.env,$=iI()){if(Q.WARP_DB_PATH)return Q.WARP_DB_PATH;if(process.platform==="win32")return J8(Q.LOCALAPPDATA||J8($,"AppData","Local"),"warp","Warp","data","warp.sqlite");if(process.platform==="darwin")return J8($,"Library","Group Containers","2BBY89MBSN.dev.warp","Library","Application Support","dev.warp.Warp-Stable","warp.sqlite");return J8(Q.XDG_STATE_HOME||J8($,".local","state"),"warp-terminal","warp.sqlite")}var k6=(Q)=>{if(typeof Q!=="string")return;try{return JSON.parse(Q)}catch{return}};function $X(Q){let $=/^(\d{4}-\d\d-\d\d)[ T](\d\d:\d\d:\d\d)(\.\d{1,3})?/.exec(String(Q??""));return $?`${$[1]}T${$[2]}${$[3]??""}Z`:void 0}function ZX(Q){return(typeof Q==="string"?Q:Q instanceof Uint8Array?new TextDecoder().decode(Q):"").replace(/\x1b\][^\x07\x1b]*(\x07|\x1b\\)/g,"").replace(/\x1b\[[0-9;?]*[ -/]*[@-~]/g,"").replace(/\r\n?/g,`
329
- `).trim()}function nI(Q){return c2(k6(Q.ai_metadata)?.conversation_id)??c2(k6(Q.agent_view_visibility)?.Agent?.origin_conversation_id)}function aI(Q,$,Z){for(let X of Q){let Y=k6(X.input);for(let J of Array.isArray(Y)?Y:[]){let z=c2(J?.Query?.text)?.trim();if(!z||W0(z))continue;Z.records.push({kind:"prompt",text:z,ts:$X(X.start_ts),cwd:c2(X.working_directory)})}}for(let X of $){let Y=ZX(X.stylized_command);if(!Y)continue;N0(Z);let J=ZX(X.stylized_output);Z.records.push({kind:"command",cmd:Y,ts:$X(X.start_ts),cwd:c2(X.pwd),...typeof X.exit_code==="number"&&X.exit_code!==0?{isError:!0}:{},...J?{output:J.slice(0,4000)}:{}})}Z.records.sort((X,Y)=>(X.ts??"").localeCompare(Y.ts??""))}function z8(Q,...$){let Z=c4();if(!GG(Z))return[];try{let X=K3(Z);if(!X)return[];try{return X.all(Q,...$)}finally{X.close()}}catch{return[]}}var oI=(Q,$)=>{let Z=QX(Q).toLowerCase(),X=QX($).toLowerCase();return Z===X||Z.startsWith(X.endsWith(VG)?X:X+VG)},sI=`select pwd, exit_code, start_ts, ai_metadata, agent_view_visibility, stylized_command, stylized_output from blocks where ai_metadata is not null or agent_view_visibility like '%"Agent"%' order by start_ts`;function WG(){let Q=new Map;for(let $ of z8(sI)){let Z=nI($);if(Z)Q.set(Z,[...Q.get(Z)??[],$])}return Q}var BG={id:"warp",label:"Warp",home:()=>GG(c4())?c4():void 0,count:()=>Number(z8("select count(*) as n from agent_conversations")[0]?.n??0),discover(Q){let $=WG(),Z=[];for(let X of z8("select conversation_id, last_modified_at from agent_conversations")){let Y=Date.parse($X(X.last_modified_at)??"")||0;if(Y<Q.sinceMs&&!Q.all)continue;let z=($.get(X.conversation_id)??[]).map((K)=>{let V=c2(K.pwd);if(V&&Q.roots.some((W)=>oI(V,W)))return V;let G=ZX(K.stylized_command).toLowerCase();return Q.roots.find((W)=>G.includes(QX(W).toLowerCase()))}).find(Boolean);if(!z&&!Q.all)continue;Z.push({agent:"warp",sessionId:X.conversation_id,path:`${c4()}#${X.conversation_id}`,mtimeMs:Y,cwd:z})}return Z},read(Q){let $={agent:"warp",sessionId:Q.sessionId,source:Q.path,records:[],unknownTypes:{},warnings:[]},Z=k6(z8("select summary from agent_conversations where conversation_id = ?",Q.sessionId)[0]?.summary);if(c2(Z?.title))$.title=Z.title;return aI(z8("select input, start_ts, working_directory from ai_queries where conversation_id = ? order by start_ts",Q.sessionId),WG().get(Q.sessionId)??[],$),$}};var QT=(Q,$)=>rI(tI(c4($,Q)))||!!$0("warp",$),HG={id:"warp",label:"Warp",status:"partial",supportTier:"community",variants:"Warp agent",limits:["Warp keeps its agent's replies and file edits on its servers; Tracetoon reads the prompts and the commands the agent ran, from Warp's local database.","Warp has no hook before its agent's tools, so a PR command run by Warp's agent isn't redirected; the agent can still use the Tracetoon skill."],traces:[BG],skill:(Q,$)=>({present:QT(Q,$),dir:eI(Q,".agents","skills","tracetoon")})};var h0=[aK,YV,MV,IV,fV,cV,aV,sV,XW,qW,jW,OW,bW,cW,sW,$G,KG,HG,NV],UG=["codex","factory","copilot","cursor","kiro","claude"],l4=h0.flatMap((Q)=>Q.traces),g3=h0.filter((Q)=>Q.hook).map((Q)=>Q.id);function e5(Q){return h0.find(($)=>$.id===Q)}function y6(Q){return l4.find(($)=>$.id===Q)?.label??Q}function x6(Q=process.env){let $=[...UG.map(e5).filter((Z)=>!!Z),...h0.filter((Z)=>!UG.includes(Z.id))];for(let Z of $)for(let X of Z.sessionEnv??[])if(Q[X])return Q[X];return}function DG(Q){return Q==="AI_AGENT"||h0.some(($)=>$.hostEnv?.test(Q))}function w6(Q,$){let Z=e5(Q),X=[...Z?[Z]:[],...h0.filter((Y)=>Y!==Z)];for(let Y of X){let J=Y.hook?.parse($);if(J)return{host:Y,payload:J}}return}function d4(Q=MG(),$=process.env){let Z=[];for(let X of h0){let Y=X.skill?.(Q,$);if(!Y?.present)continue;if(X.plugin?.(Q,$))continue;let J=Z.find((z)=>z.dir===Y.dir);if(J)J.labels.push(X.label);else Z.push({labels:[X.label],dir:Y.dir})}return Z}function NG(Q=MG(),$=process.env){let Z=[];for(let X of h0){let Y=X.skill?.(Q,$);if(!Y)continue;if(!Z.find((z)=>z.dir===Y.dir))Z.push({label:X.label,dir:Y.dir})}return Z}var qG=[];function p4(Q=process.env){let $=Q.TRACETOON_LAUNCHER?.trim();if(!$)return{kind:"none"};let Z=/^(npx|npm):(\S+)$/.exec($);if(Z)return{kind:Z[1],version:Z[2]};return{kind:"script",path:$}}function $T(Q=process.env){if(Q.CURSOR_PLUGIN_ROOT||Q.CURSOR_TRACE_ID||Q.CURSOR_AGENT)return"Cursor";if(Q.CLAUDE_PLUGIN_ROOT||Q.CLAUDECODE||Q.CLAUDE_CODE_CHILD_SESSION)return"Claude Code";return}function CG(Q=process.env){switch($T(Q)){case"Claude Code":return"Update the Tracetoon plugin in Claude Code (/plugin, or /plugin marketplace update); the plugin pins the runtime it runs.";case"Cursor":return"Update the Tracetoon plugin from the Cursor Marketplace; the plugin pins the runtime it runs.";default:return"Update the Tracetoon plugin with your agent's plugin manager (it pins the runtime it runs), or run the newest release directly with npx -y tracetoon@latest."}}function K8(Q=KT(),$=process.env){return h0.filter((Z)=>Z.hook).map((Z)=>({agent:Z.id,label:Z.label,file:Z.hook.file(Q,$),present:Z.hook.present(Q,$),plugin:(Z.pluginHooks??Z.plugin)?.(Q,$)??!1}))}var l2=(Q)=>{let $=e5(Q.agent)?.hook;if(!$)throw Error(`no hook integration for ${Q.agent}`);return $};function VT(Q,$){return`${(Array.isArray($)?$:[$]).map((X)=>{let Y=X.replace(/\\/g,"/");return/\s/.test(Y)?`"${Y}"`:Y}).join(" ")} hook pre-pr --agent ${Q}`}function PG(Q,$){let Z=VT(Q,$),X=(Array.isArray($)?$:[$]).map((Y)=>Y.replace(/\\/g,"/"));return{prePr:Z,lifecycle:(Y)=>Z.replace(/hook pre-pr --agent/,"hook lifecycle --agent")+` --event ${Y}`,argv:{prePr:[...X,"hook","pre-pr","--agent",Q],lifecycle:(Y)=>[...X,"hook","lifecycle","--agent",Q,"--event",Y]}}}var _G="the Tracetoon plugin runs this hook",WT="this copy runs from npx, whose cache isn't a stable path and adds a delay to every tool call; install the standalone runtime (https://github.com/Tracetoon/tracetoon/blob/main/docs/agents/install.md) to add the hook";function b6(Q,$=K8(),Z=process.env){let X=p4(Z).kind==="npx";return $.map((Y)=>{let J={agent:Y.agent,label:Y.label,file:Y.file};if(!Y.present)return{...J,result:"skipped",note:"not installed"};if(X&&!Y.plugin)return{...J,result:"skipped",note:WT};if(Y.plugin){let[W]=JX([Y]);return{...J,result:W?.result==="removed"?"removed":"unchanged",note:_G}}let z=l2(Y).text;if(z){let W=PG(Y.agent,Q),B=BT(Y.file,z,W),H=B.map((U)=>zX(U.path));if(B.every((U,M)=>H[M]===U.text))return{...J,result:"unchanged"};if(H.some((U)=>U!==void 0&&!z.command(U)))return{...J,result:"skipped",note:"a file Tracetoon did not write is there; left untouched"};for(let U of B)if(XT(YX(U.path),{recursive:!0}),zT(U.path,U.text,"utf8"),U.executable)ZT(U.path,493);return{...J,result:"installed",note:l2(Y).installNote?.(Y.file,{})}}let K;try{K=f1(Y.file)}catch(W){return{...J,result:"skipped",note:`could not read it (${W.message}); left untouched`}}let V=l2(Y),G=V.apply(K,PG(Y.agent,Q));if(JSON.stringify(G)===JSON.stringify(K))return{...J,result:"unchanged"};return P$(Y.file,G),{...J,result:"installed",note:V.installNote?.(Y.file,G)}})}function JX(Q=K8()){return Q.map(($)=>{let Z={agent:$.agent,label:$.label,file:$.file},X=l2($).text;if(X){let z=!1;for(let K of[$.file,...GT($.file,X)]){let V=zX(K);if(V===void 0||!X.command(V))continue;JT(K,{force:!0}),z=!0}return{...Z,result:z?"removed":"unchanged"}}let Y;try{Y=f1($.file)}catch{return{...Z,result:"skipped",note:"could not read it; left untouched"}}let J=l2($).apply(Y,void 0);if(JSON.stringify(J)===JSON.stringify(Y))return{...Z,result:"unchanged"};return P$($.file,J),{...Z,result:"removed"}})}var XX="PR creation through recognized shell commands and GitHub connectors; existing PR operations, pushes and read-only commands are left alone. Arbitrary network scripts are not intercepted.",GT=(Q,$)=>Object.keys($.siblings??{}).map((Z)=>FG(YX(Q),Z));function BT(Q,$,Z){return[{path:Q,text:$.render(Z),executable:!1},...Object.entries($.siblings??{}).map(([X,Y])=>({path:FG(YX(Q),X),text:Y(Z),executable:$.executable?.includes(X)??!1}))]}function zX(Q){try{return YT(Q,"utf8")}catch{return}}function v6(Q=K8()){return Q.map(($)=>{if($.plugin)return{agent:$.agent,label:$.label,present:$.present,installed:!0,file:$.file,command:`plugin: ${_G}`,coverage:XX};let Z=l2($).text;if(Z){let G=(()=>{let W=zX($.file);return W===void 0?void 0:Z.command(W)})();return{agent:$.agent,label:$.label,present:$.present,installed:!!G,file:$.file,completionInstalled:!1,command:G,coverage:XX}}let X={},Y=!1;try{X=f1($.file)}catch{Y=!0}let J=JSON.stringify(X),z=l2($),K=!Y&&(J.includes("hook pre-pr")&&/tracetoon/i.test(J)||!!z.installedCommand(X)),V={agent:$.agent,label:$.label,present:$.present,installed:K,file:$.file,completionInstalled:J.includes("hook lifecycle")&&J.includes("--event Stop"),command:z.installedCommand(X),coverage:XX};if(Y)V.problem=`${$.file} is not valid JSON`;else if(K)V.problem=z.problem?.($.file,X);if(V.problem===void 0)delete V.problem;return V})}import{existsSync as ET,readFileSync as ST}from"node:fs";import{join as kT}from"node:path";import{spawnSync as HT}from"node:child_process";function X3(Q,$,Z={}){let X=/(?:^|[\\/])git(?:\.exe)?$/i.test(Q)?"git":/(?:^|[\\/])gh(?:\.exe)?$/i.test(Q)?"github":"other";if(X!=="git"||jG($)==="write")VX();c0(`subprocess.${X}`);let Y=Z5(`subprocess.${X}`,()=>HT(Q,$,{cwd:Z.cwd,input:Z.input,env:Z.env??process.env,encoding:"utf8",maxBuffer:268435456,windowsHide:!0,timeout:Z.timeoutMs}));if(Y.error)return{ok:!1,code:-1,stdout:"",stderr:String(Y.error.message)};return{ok:Y.status===0,code:Y.status??-1,stdout:Y.stdout??"",stderr:Y.stderr??""}}var KX=0,f6=new Map;function AG(Q){KX++;let $=!1;try{let Z=Q();if(Z instanceof Promise)return $=!0,Z.finally(LG);return Z}finally{if(!$)LG()}}function LG(){if(--KX===0)f6.clear()}function VX(){f6.clear()}var UT=new Set(["blame","cat-file","check-ignore","describe","diff","for-each-ref","grep","log","ls-files","ls-tree","merge-base","rev-list","rev-parse","show","show-ref","status"]);function MT(Q){let $=0;while($<Q.length&&Q[$].startsWith("-"))$+=Q[$]==="-c"||Q[$]==="-C"?2:1;return Q.slice($)}function jG(Q){let[$,...Z]=MT(Q);if($==="rev-parse")return"cache";if($==="remote")return Z[0]==="get-url"||Z[0]==="-v"&&Z.length===1?"cache":"write";if($==="config")return Z[0]==="--get"&&Z.length===2?"cache":"write";if($==="worktree")return Z[0]==="list"?"read":"write";if($==="notes")return Z.find((X)=>!X.startsWith("-"))==="list"?"read":"write";return $&&UT.has($)?"read":"write"}function p(Q,$,Z,X){let Y=KX>0&&Z===void 0&&!X&&jG($)==="cache",J=Y?JSON.stringify([Q,$]):"",z=Y?f6.get(J):void 0;if(z)return{...z};let K=X3("git",["-c","core.fsmonitor=false","-c","protocol.ext.allow=never","-c","core.quotepath=off",...$],{cwd:Q,input:Z,env:X?{...process.env,...X}:void 0});if(Y)f6.set(J,{...K});return K}function y0(Q,$){let Z=process.env.TRACETOON_GH_SCRIPT,[X,Y]=Z?[process.env.TRACETOON_TEST_RUNNER??process.execPath,[Z,...$]]:["gh",$];return X3(X,Y,{cwd:Q,env:{...process.env,GH_PROMPT_DISABLED:"1",NO_COLOR:"1"}})}import{join as Ii,resolve as HX}from"node:path";var DT=/^[^/\s]+\/[^/\s]+$/;function i4(Q){let $=/github\.com[:/]([^/]+)\/([^/]+?)(?:\.git)?\/?$/.exec(Q.trim());return $?{owner:$[1],name:$[2]}:void 0}var IG=(Q)=>Q?`${Q.owner}/${Q.name}`:void 0;function d2(Q,$={}){let Z=IG(i4(p(Q,["remote","get-url","origin"]).stdout)),X;if(!$.offline){let J=y0(Q,["repo","view","--json","nameWithOwner","-q",".nameWithOwner"]),z=J.ok?J.stdout.trim():"";if(DT.test(z))X=z}let Y=Z;if(X){if(new Set(p(Q,["remote","-v"]).stdout.split(/\r?\n/).map((z)=>IG(i4(z.split(/\s+/)[1]??""))?.toLowerCase()).filter(Boolean)).has(X.toLowerCase())||!Z)Y=X}return Y?{repo:Y,origin:Z,ghDefault:X}:void 0}function Q2(Q){return Q?["--repo",Q]:[]}function V8(Q,$,Z){let X=Z?.split("/")[0];return $&&X&&$.toLowerCase()!==X.toLowerCase()?`${$}:${Q}`:Q}function g6(Q){if(!Q)return"PR target: unknown (no GitHub remote and no gh default repo).";let $=[];if(Q.origin&&Q.origin.toLowerCase()!==Q.repo.toLowerCase())$.push(`branch is pushed to ${Q.origin}, a different repository`);if(Q.ghDefault&&Q.ghDefault.toLowerCase()!==Q.repo.toLowerCase())$.push(`gh's default repo ${Q.ghDefault} is not a remote of this clone, ignored`);return`PR target: ${Q.repo}${$.length?` (${$.join("; ")})`:""}.`}import{lstatSync as NT,readFileSync as qT,readlinkSync as CT,realpathSync as WX}from"node:fs";import{dirname as PT,isAbsolute as FT,relative as _T,resolve as TG}from"node:path";function GX(Q){return Q.replace(/\\/g,"/").split("/").some(($)=>[".git",".showtail"].includes($.toLowerCase()))}function E0(Q){return!!Q&&!FT(Q)&&!Q.includes("\\")&&!/[:\x00-\x1f\x7f]/.test(Q)&&!GX(Q)&&!Q.split("/").some(($)=>!$||$===".."||$===".")}function OG(Q,$){let Z=_T(WX.native(Q),$).replace(/\\/g,"/");if(Z!==""&&!E0(Z))throw Error("Path is outside the repository or private.")}function W8(Q,$){if(!E0($))throw Error(`Unsafe repository source: ${$}`);let Z=WX.native(TG(Q,$));return OG(Q,Z),qT(Z)}function V5(Q,$){if(!E0($))throw Error(`Unsafe submitted path: ${$}`);let Z=TG(Q,$);OG(Q,WX.native(PT(Z)));let X=NT(Z);if(X.isSymbolicLink())return Buffer.from(CT(Z),"utf8");if(!X.isFile())throw Error("Submitted path is not a regular file.");return W8(Q,$)}function BX(Q,$){let Z=p(Q,$);if(!Z.ok)throw Error(`git ${$.join(" ")} failed: ${Z.stderr.trim()||Z.code}`);return Z.stdout.trim()}function LT(Q){let $=p(Q,["worktree","list","--porcelain"]);if(!$.ok)return[];return $.stdout.split(/\r?\n/).filter((Z)=>Z.startsWith("worktree ")).map((Z)=>HX(Z.slice(9)))}var UX=["rev-parse","--show-toplevel","--absolute-git-dir","HEAD","--abbrev-ref","HEAD"];function G8(Q){let $=p(Q,UX),[Z,X,Y,J]=$.stdout.split(/\r?\n/).map((z)=>z.trim());if(!Z||!X)return;return{toplevel:HX(Z),gitDir:HX(X),branch:J||"HEAD",.../^[a-f0-9]{40,64}$/.test(Y??"")?{headSha:Y}:{},ok:$.ok}}var RG=["main","master","trunk","develop"];function EG(Q,$=[]){let Z=["refs/remotes/origin/HEAD",...[...new Set([...RG,...$])].flatMap((J)=>[`refs/heads/${J}`,`refs/remotes/origin/${J}`])],X=p(Q,["for-each-ref","--format=%(refname)%09%(symref)",...Z]),Y=new Map;for(let J of X.stdout.split(/\r?\n/)){let[z,K]=J.split("\t");if(z)Y.set(z,K??"")}return Y}function SG(Q){let $=Q.get("refs/remotes/origin/HEAD");if($?.startsWith("refs/remotes/origin/"))return $.slice(20);return RG.find((Z)=>Q.has(`refs/heads/${Z}`))??"main"}function B8(Q){return SG(EG(Q))}function AT(Q,$){return Q.has(`refs/remotes/origin/${$}`)?`origin/${$}`:$}function MX(Q,$,Z){let X=new Map;for(let B of p(Q,["remote","-v"]).stdout.split(/\r?\n/)){let[H,U]=B.split(/\s+/);if(H&&!X.has(H)){let M=i4(U??"");X.set(H,M?`${M.owner}/${M.name}`.toLowerCase():void 0)}}let Y=new Set(p(Q,["for-each-ref","--format=%(refname)",`refs/remotes/${$}`,`refs/remotes/*/${$}`]).stdout.split(/\r?\n/).filter(Boolean)),J=[...X.keys()].sort((B,H)=>H.length-B.length).find((B)=>$.startsWith(`${B}/`)&&Y.has(`refs/remotes/${$}`));if(J)return{branch:$.slice(J.length+1),ref:$};let z=(B)=>Y.has(`refs/remotes/${B}/${$}`),K=Z?.toLowerCase(),V=K?[...X].find(([,B])=>B===K)?.[0]:void 0,G=[...X.keys()].filter(z),W=z("origin")?"origin":V&&z(V)?V:G.length===1?G[0]:void 0;return{branch:$,ref:W?`${W}/${$}`:$}}function jT(Q,$,Z,X){let Y=y0(Q,["pr","view",V8($,X,Z),...Q2(Z),"--json","number,url,title,body,baseRefName,headRefName,state"]);if(!Y.ok)return;try{let J=JSON.parse(Y.stdout);return J.state==="OPEN"||J.state==="DRAFT"?J:void 0}catch{return}}function IT(Q){let $={};for(let Z of Q.split(/\r?\n/)){let X=/^([A-Za-z][A-Za-z0-9-]*):\s*(.+)$/.exec(Z.trim());if(!X)continue;($[X[1]]??=[]).push(X[2].trim())}return $}function TT(Q,$,Z){let X=p(Q,["log","--reverse","--no-merges","--format=%H%x1f%s%x1f%at%x1f%ct%x1f%(trailers:unfold,only)%x1f%b%x1e",`${$}..${Z}`]);if(!X.ok)return[];return X.stdout.split("\x1E").map((Y)=>Y.replace(/^\s+/,"")).filter(Boolean).map((Y)=>{let[J,z,K,V,G,W]=Y.split("\x1F");return{sha:J,subject:z??"",...W?.trim()?{body:W.trim()}:{},authorTime:Number(K)*1000,commitTime:Number(V)*1000,trailers:IT(G??"")}})}function OT(Q){let $=[],Z,X,Y=!1,J=0,z=(K)=>Number(/\+(\d+)/.exec(K)?.[1]??0);for(let K of Q.split(/\r?\n/)){if(K.startsWith("diff --git ")){Z=void 0,X=void 0,Y=!1;continue}let V=/^Binary files (?:a\/(.+?)|\/dev\/null) and (?:b\/(.+?)|\/dev\/null) differ$/.exec(K);if(V){let G=V[2]??V[1];if(G)$.push({path:G,added:[],removed:[],addedAt:[]});continue}if(!Y){if(K.startsWith("--- ")){let G=K.slice(4).trim();X=G==="/dev/null"?void 0:G.replace(/^a\//,"")}else if(K.startsWith("+++ ")){let G=K.slice(4).trim(),W=G==="/dev/null"?X:G.replace(/^b\//,"");if(W)Z={path:W,added:[],removed:[],addedAt:[]},$.push(Z)}else if(K.startsWith("@@"))Y=!0,J=z(K);continue}if(K.startsWith("@@")){J=z(K);continue}if(!Z)continue;if(K.startsWith("+"))Z.added.push(K.slice(1)),Z.addedAt?.push(J++);else if(K.startsWith("-"))Z.removed.push(K.slice(1));else if(K.startsWith(" "))J++}return $}function RT(Q){let $=p(Q,["ls-files","--others","--exclude-standard","-z"]);if(!$.ok)return[];let Z=[];for(let X of $.stdout.split("\x00").filter(Boolean)){if(!E0(X))continue;try{let Y=V5(Q,X),J=Y.toString("utf8");Z.push({path:X,added:Y.includes(0)||!Buffer.from(J,"utf8").equals(Y)?[]:J.split(/\r?\n/),removed:[]})}catch{}}return Z}function i0(Q,$={}){let Z=G8(Q);if(!Z)BX(Q,["rev-parse","--show-toplevel"]);let{toplevel:X,gitDir:Y}=Z,J=$.head?BX(X,["rev-parse",$.head]):Z.headSha??"HEAD";if(!$.head&&!Z.ok)BX(X,["rev-parse","--abbrev-ref","HEAD"]);let z=$.head??Z.branch,K=$.noGh?void 0:d2(X),V=i4(p(X,["remote","get-url","origin"]).stdout)?.owner,G=$.noGh?void 0:jT(X,z,K?.repo,V),W=$.base??G?.baseRefName,B,H;if(W)({ref:H}=MX(X,B=W,K?.repo));else{let A=EG(X);B=SG(A),H=AT(A,B)}let U=p(X,["merge-base",H,J]).stdout.trim()||H,M=TT(X,U,J),N=p(X,["log","-n","200","--format=%H%x1f%ct%x1f%s",U]).stdout.split(/\r?\n/).filter(Boolean).map((A)=>{let[E,S,...x]=A.split("\x1F");return{sha:E,ct:Number(S),subject:x.join("\x1F")}}),D=N[0]?.ct??NaN,C=Number.isFinite(D)&&D>0?D*1000:void 0,_=N.map(({sha:A,subject:E})=>({sha:A,subject:E})),I=$.head?!1:p(X,["status","--porcelain","--untracked-files=no"]).stdout.trim().length>0,F=M.length===0&&!$.head,L=OT(p(X,F?["diff","-U0","--no-color","--no-ext-diff",U]:["diff","-U0","--no-color","--no-ext-diff",U,J]).stdout);if(F)L=L.concat(RT(X));L=L.filter((A)=>!GX(A.path));let T=[...new Set([X,...LT(X)])],O=p(X,["remote","get-url","origin"]).stdout.trim(),q=O?i4(O):void 0;return{toplevel:X,gitDir:Y,roots:T,head:z,headSha:J,base:B,mergeBase:U,mergeBaseTime:C,baseCommits:_,commits:M,files:L,usedWorkingTree:F,dirty:I,remote:q?{...q,url:O}:void 0,target:K,pr:G}}var kG=/^(0|false|off|no)$/i,yG=/^(1|true|on|yes)$/i;function xG(Q){try{if(!ET(Q))return;let $=JSON.parse(ST(Q,"utf8")).enabled;return typeof $==="boolean"?$:void 0}catch{return}}function n4(Q){return p(Q,UX).stdout.split(/\r?\n/)[0]?.trim()||void 0}function a3(Q,$=process.env){let Z=$.TRACETOON?.trim();if(Z&&kG.test(Z))return{enabled:!1,decidedBy:"env",why:"TRACETOON=0 is set"};let X=$.CI?.trim();if(X&&yG.test(X)&&!(Z&&yG.test(Z)))return{enabled:!1,decidedBy:"ci",why:"running in CI (set TRACETOON=1 to use it there)"};let Y=n4(Q);if(Y){if(xG(j4(Y))===!1)return{enabled:!1,decidedBy:"repo",why:`this repo turns it off in ${kT(".github","tracetoon.json")}`};let J=p(Y,["config","--get","tracetoon.enabled"]);if(J.ok&&kG.test(J.stdout.trim()))return{enabled:!1,decidedBy:"local",why:"turned off for this repo on this machine (git config tracetoon.enabled)"}}if(xG(I0())===!1)return{enabled:!1,decidedBy:"user",why:"turned off in your Tracetoon settings"};return{enabled:!0,decidedBy:"default",why:"default setting"}}var wG={name:"tracetoon",version:"1.0.0-rc.39",description:"Write pull request descriptions from the AI agent session logs already on your machine, plus a one-off comic.",private:!0,mcpName:"io.github.Tracetoon/tracetoon",type:"module",license:"Apache-2.0",homepage:"https://tracetoon.ai",repository:{type:"git",url:"git+https://github.com/Tracetoon/tracetoon.git"},bugs:"https://github.com/Tracetoon/tracetoon/issues",author:"Tracetoon",keywords:["pull-request","pull-request-description","pr-description-generator","ai-pull-request","github","code-review","ai-agents","agent-skills","claude-code","codex","antigravity","factory-droid","copilot","github-copilot","cursor","opencode","kilo","kilo-code","kiro","cline","junie","devin","goose","qwen-code","crush","amp","zed","warp","session-logs","agent-trace","provenance","ai-provenance","mcp","mcp-server","developer-tools","comic"],bin:{tracetoon:"./src/cli.ts"},scripts:{dev:"bun run src/cli.ts",test:"bun run scripts/test-source.ts","test:bundled":"bun run scripts/test-packaged.ts","test:compiled":"bun run scripts/test-packaged.ts --compiled",typecheck:"bun run scripts/typecheck.ts","dependencies:prepare":"bun run scripts/dependencies.ts",format:'bun x prettier --write "src/**/*.ts" "tests/**/*.ts"',bundle:"bun run scripts/bundle.ts",build:"bun run scripts/build.ts","build:check":"bun run scripts/build-info.ts --check","build:reproduce":"bun run scripts/reproduce.ts","agent-surfaces":"bun run scripts/agent-surfaces.ts","site-kit":"bun run scripts/site-kit.ts"},dependencies:{"@resvg/resvg-wasm":"2.6.2",commander:"^14.0.0",marked:"^16.0.0"},devDependencies:{"@types/node":"^22.0.0","bun-types":"^1.1.0",prettier:"^3.3.0",typescript:"^5.5.0","@expo-google-fonts/comic-neue":"^0.4.1"},engines:{bun:">=1.3.14"}};var xT="source",p2={version:"1.0.0-rc.39",buildId:"7f6ce9ec1a7273249e1d982f01d25f1c0ad58c3109898875850111a35eb3a65f",revision:"adf1f54f98bba9f969c61e8bd29f0d70e9ee960c",protocol:2,dependencies:[{name:"@showtail/agent-traces",revision:"dd0b6f40a09e206c1571a0440f2bdc2b78222c18",packageTree:"6eb00aad7a5c9aa7d54b6dbe3bdb1cd4cb17957e",sha256:"93ff323d6a1b62fe571a771facbbb17186c0530d7372b5b68b8763838fad78de"}],compiler:{name:"bun",version:"1.3.14"},recipe:{schema:"tracetoon.build-recipe/v1",bunVersion:"1.3.14",identity:"__TRACETOON_BUILD__",bundle:{target:"node",format:"esm",minify:!0,ascii:!0},native:{minify:!0,targets:["linux-x64","linux-arm64","darwin-x64","darwin-arm64","windows-x64"]}}},A0=wG.version,b0={version:A0,buildId:p2.buildId,revision:p2.revision,protocol:p2.protocol,...p2.dependencies?{dependencies:p2.dependencies}:{},...p2.compiler?{compiler:p2.compiler}:{},capabilities:["task-lifecycle","check-receipts","pr-creation-routing","shared-preparation","batch-evidence","claim-review-v2"]},i2=b0.buildId===xT;import{spawn as gT}from"node:child_process";import{existsSync as hT,mkdirSync as mT,readFileSync as gG,rmSync as uT,writeFileSync as cT}from"node:fs";import{basename as lT,dirname as hG,join as mG}from"node:path";import{existsSync as wT,realpathSync as bT}from"node:fs";import{homedir as vT}from"node:os";import{basename as fT,join as a4}from"node:path";function h6(Q=process.env,$=vT(),Z=process.platform,X=process.arch){let Y=Z==="win32",J=Y?"windows":Z==="darwin"?"darwin":"linux",z=X==="arm64"?"arm64":"x64",K=Y&&Q.LOCALAPPDATA?a4(Q.LOCALAPPDATA,"tracetoon"):a4(Q.XDG_DATA_HOME||a4($,".local","share"),"tracetoon"),V=Y?".exe":"";return{homeRoot:K,stable:a4(K,"bin",`tracetoon${V}`),assets:a4(K,"assets"),receipt:a4(K,"install.json"),asset:`tracetoon-${J}-${z}${V}`}}var bG=(Q)=>{try{return bT(Q)}catch{return Q}};function m6(Q,$=process.execPath,Z=process.env,X=i2){if(Z.TRACETOON_BIN)return{ok:!1,reason:"TRACETOON_BIN points at a runtime you manage yourself. Replace it, or unset it to use the installed one."};if(wT(Q.stable)&&bG($)===bG(Q.stable))return{ok:!0};let Y=p4(Z);if(Y.kind==="npx")return{ok:!1,reason:`This copy runs from npm (npx tracetoon@${Y.version}). ${CG(Z)}`};if(Y.kind==="npm")return{ok:!1,reason:`This copy was installed with npm (tracetoon@${Y.version}). Update it with npm install -g tracetoon@latest.`};if(!/^tracetoon(-[a-z]+-[a-z0-9]+)?(\.exe)?$/i.test(fT($)))return{ok:!1,reason:X?"This copy runs from a source checkout (bun src/cli.ts). Pull the checkout to update it, or install the binary: curl -fsSL https://raw.githubusercontent.com/Tracetoon/tracetoon/main/install.sh | sh":"This copy runs from a bundle (a Claude Code plugin). Update the plugin with /plugin marketplace update, or install the binary: curl -fsSL https://raw.githubusercontent.com/Tracetoon/tracetoon/main/install.sh | sh"};return{ok:!1,reason:`This binary (${$}) is not the installed one (${Q.stable}). Run the installed tracetoon, or re-run the installer.`}}function n2(Q){let $=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(Q.trim());if(!$)return;return{core:[Number($[1]),Number($[2]),Number($[3])],pre:$[4]?$[4].split(".").map((Z)=>/^\d+$/.test(Z)?Number(Z):Z):[]}}function $2(Q,$){let Z=n2(Q),X=n2($);if(!Z||!X)throw Error(`not a version: ${!Z?Q:$}`);for(let Y=0;Y<3;Y++){let J=Z.core[Y]-X.core[Y];if(J)return J}if(!Z.pre.length||!X.pre.length)return X.pre.length-Z.pre.length;for(let Y=0;Y<Math.max(Z.pre.length,X.pre.length);Y++){let J=Z.pre[Y],z=X.pre[Y];if(J===void 0)return-1;if(z===void 0)return 1;if(J===z)continue;if(typeof J==="number"&&typeof z==="number")return J-z;if(typeof J==="number")return-1;if(typeof z==="number")return 1;return J<z?-1:1}return 0}function vG(Q){return(n2(Q)?.pre.length??0)>0}var fG=86400000,dT=3600000,uG=900000,cG=(Q)=>hG(Q.TRACETOON_CONFIG??I0()),lG=(Q=process.env)=>mG(cG(Q),"update-state.json"),dG=(Q)=>mG(cG(Q),"update.lock"),c6=(Q=process.env)=>G0(lG(Q))??{};function u6(Q,$){P0(lG(Q),{...c6(Q),...$})}function pT(Q=process.env,$=Date.now()){try{return $-Number(gG(dG(Q),"utf8"))<uG}catch{return!1}}function pG(Q=process.env,$=Date.now()){let Z=dG(Q);try{if(hT(Z)&&$-Number(gG(Z,"utf8"))<uG)return}catch{}return mT(hG(Z),{recursive:!0}),cT(Z,String($)),()=>uT(Z,{force:!0})}function iT(Q,$){let X=/^tracetoon(-[a-z]+-[a-z0-9]+)?(\.exe)?$/i.test(lT(process.execPath))?Q:[process.argv[1],...Q],Y=gT(process.execPath,X,{detached:!0,stdio:"ignore",windowsHide:!0,env:$});Y.on("error",()=>{}),Y.unref()}function iG(Q,$=process.env,Z={}){if($.TRACETOON_NO_UPDATE_CHECK==="1"||$.TRACETOON_DISABLE_UPDATES==="1")return;let X=L0();if(X.autoUpdate==="off")return;if(!(Z.eligible??m6(h6($),process.execPath,$).ok))return;let J=Z.now??Date.now(),z=Z.spawn??((W)=>iT(W,$)),K=c6($);if((!K.checkedAt||K.channel!==X.updateChannel||J-Date.parse(K.checkedAt)>fG)&&(!K.spawnedAt||J-Date.parse(K.spawnedAt)>dT))u6($,{spawnedAt:new Date(J).toISOString()}),z(["update","--check","--quiet"]);if(!K.latest||K.channel!==X.updateChannel||$2(K.latest,A0)<=0)return;let G;if(X.autoUpdate==="install"){if(!pT($,J))z(["update","--auto","--quiet"]);G=`Tracetoon ${K.latest} is being installed in the background (you have ${A0}). Reload your agent when it finishes.`}else G=`Tracetoon ${K.latest} is available (you have ${A0}). Run: tracetoon update`;if(K.notifiedVersion===K.latest&&K.notifiedAt&&J-Date.parse(K.notifiedAt)<fG)return;if(u6($,{notifiedAt:new Date(J).toISOString(),notifiedVersion:K.latest}),Q!=="claude"&&Q!=="codex")return;return JSON.stringify({systemMessage:G,hookSpecificOutput:{hookEventName:"SessionStart",additionalContext:`${G} If the user asks to update, run \`tracetoon update --check --json\`, summarize what changed, confirm with them, then run \`tracetoon update\`. Do not update on your own.`}})}var nT=[{code:"ERROR",exit:1,meaning:"Any error without a more specific code"},{code:"USAGE",exit:2,meaning:"Unknown command or option, or a missing argument",fix:"tracetoon commands --json"},{code:"NOT_A_GIT_REPO",exit:1,meaning:"The command must run inside a git repository",fix:"cd into the repository, then rerun"},{code:"RUN_NOT_FOUND",exit:1,meaning:"No Tracetoon run, or not the one named by `--run`",fix:"tracetoon prepare --json"},{code:"RUN_OTHER_WORKTREE",exit:1,meaning:"The run belongs to another worktree or branch",fix:"Switch to that checkout, or pass another --run"},{code:"NOTHING_RENDERED",exit:1,meaning:"Publishing needs a render first",fix:"tracetoon render --json"},{code:"BRANCH_NOT_PUSHED",exit:1,meaning:"With `--no-push`: GitHub does not have the rendered revision",fix:"tracetoon publish --push"},{code:"PR_EXISTS",exit:1,meaning:"A PR Tracetoon did not render already exists for this branch and base",fix:"tracetoon context --json, then render and publish again (it updates that PR)"},{code:"GH_MISSING",exit:6,meaning:"The GitHub CLI (`gh`) is not installed",fix:"Install the GitHub CLI: https://cli.github.com",humanRequired:!0},{code:"GH_NOT_AUTHENTICATED",exit:6,meaning:"`gh` is not signed in, or its token was refused",fix:"gh auth login",humanRequired:!0},{code:"GH_FAILED",exit:1,meaning:"A `gh` call failed for another reason (the message has its output)"},{code:"GITHUB_UNREACHABLE",exit:7,meaning:"GitHub could not be reached, timed out or rate-limited the call",fix:"Rerun the same command in a minute",retryable:!0},{code:"CONSENT_REQUIRED",exit:4,meaning:"Sending comic prompts to this image route needs the user\u2019s agreement",fix:"Ask the user; rerun with --consent only after they agree",humanRequired:!0},{code:"NO_IMAGE_ROUTE",exit:5,meaning:"No approved image route can draw the comic",fix:"Offer the printed options, or skip the comic",humanRequired:!0},{code:"COMIC_UNEXPLAINED",exit:1,meaning:"A comic was expected and an image route could draw it, but none was drawn or skipped with a reason",fix:'Draw it (SKILL step 5), or `tracetoon comic skip --reason "<why>"`, then render again'},{code:"UPDATES_DISABLED",exit:1,meaning:"`TRACETOON_DISABLE_UPDATES=1` is set here"},{code:"UPDATE_LOOKUP_FAILED",exit:7,meaning:"The release list could not be fetched",fix:"Rerun the same command in a minute",retryable:!0},{code:"SKILL_SOURCE_NOT_FOUND",exit:1,meaning:"`setup` found no skill folder shipped with this runtime",fix:"Follow docs/agents/install.md"}];function H8(Q){return nT.find(($)=>$.code===Q)}var nG=1;function d(Q,$,Z){if(Q.json){let X=$&&typeof $==="object"&&!Array.isArray($)&&!("schemaVersion"in $)?{...$,schemaVersion:nG}:$;process.stdout.write(JSON.stringify(X,null,2)+`
329
+ `).trim()}function nI(Q){return c2(k6(Q.ai_metadata)?.conversation_id)??c2(k6(Q.agent_view_visibility)?.Agent?.origin_conversation_id)}function aI(Q,$,Z){for(let X of Q){let Y=k6(X.input);for(let J of Array.isArray(Y)?Y:[]){let z=c2(J?.Query?.text)?.trim();if(!z||W0(z))continue;Z.records.push({kind:"prompt",text:z,ts:$X(X.start_ts),cwd:c2(X.working_directory)})}}for(let X of $){let Y=ZX(X.stylized_command);if(!Y)continue;N0(Z);let J=ZX(X.stylized_output);Z.records.push({kind:"command",cmd:Y,ts:$X(X.start_ts),cwd:c2(X.pwd),...typeof X.exit_code==="number"&&X.exit_code!==0?{isError:!0}:{},...J?{output:J.slice(0,4000)}:{}})}Z.records.sort((X,Y)=>(X.ts??"").localeCompare(Y.ts??""))}function z8(Q,...$){let Z=c4();if(!GG(Z))return[];try{let X=K3(Z);if(!X)return[];try{return X.all(Q,...$)}finally{X.close()}}catch{return[]}}var oI=(Q,$)=>{let Z=QX(Q).toLowerCase(),X=QX($).toLowerCase();return Z===X||Z.startsWith(X.endsWith(VG)?X:X+VG)},sI=`select pwd, exit_code, start_ts, ai_metadata, agent_view_visibility, stylized_command, stylized_output from blocks where ai_metadata is not null or agent_view_visibility like '%"Agent"%' order by start_ts`;function WG(){let Q=new Map;for(let $ of z8(sI)){let Z=nI($);if(Z)Q.set(Z,[...Q.get(Z)??[],$])}return Q}var BG={id:"warp",label:"Warp",home:()=>GG(c4())?c4():void 0,count:()=>Number(z8("select count(*) as n from agent_conversations")[0]?.n??0),discover(Q){let $=WG(),Z=[];for(let X of z8("select conversation_id, last_modified_at from agent_conversations")){let Y=Date.parse($X(X.last_modified_at)??"")||0;if(Y<Q.sinceMs&&!Q.all)continue;let z=($.get(X.conversation_id)??[]).map((K)=>{let V=c2(K.pwd);if(V&&Q.roots.some((W)=>oI(V,W)))return V;let G=ZX(K.stylized_command).toLowerCase();return Q.roots.find((W)=>G.includes(QX(W).toLowerCase()))}).find(Boolean);if(!z&&!Q.all)continue;Z.push({agent:"warp",sessionId:X.conversation_id,path:`${c4()}#${X.conversation_id}`,mtimeMs:Y,cwd:z})}return Z},read(Q){let $={agent:"warp",sessionId:Q.sessionId,source:Q.path,records:[],unknownTypes:{},warnings:[]},Z=k6(z8("select summary from agent_conversations where conversation_id = ?",Q.sessionId)[0]?.summary);if(c2(Z?.title))$.title=Z.title;return aI(z8("select input, start_ts, working_directory from ai_queries where conversation_id = ? order by start_ts",Q.sessionId),WG().get(Q.sessionId)??[],$),$}};var QT=(Q,$)=>rI(tI(c4($,Q)))||!!$0("warp",$),HG={id:"warp",label:"Warp",status:"partial",supportTier:"community",variants:"Warp agent",limits:["Warp keeps its agent's replies and file edits on its servers; Tracetoon reads the prompts and the commands the agent ran, from Warp's local database.","Warp has no hook before its agent's tools, so a PR command run by Warp's agent isn't redirected; the agent can still use the Tracetoon skill."],traces:[BG],skill:(Q,$)=>({present:QT(Q,$),dir:eI(Q,".agents","skills","tracetoon")})};var h0=[aK,YV,MV,IV,fV,cV,aV,sV,XW,qW,jW,OW,bW,cW,sW,$G,KG,HG,NV],UG=["codex","factory","copilot","cursor","kiro","claude"],l4=h0.flatMap((Q)=>Q.traces),g3=h0.filter((Q)=>Q.hook).map((Q)=>Q.id);function e5(Q){return h0.find(($)=>$.id===Q)}function y6(Q){return l4.find(($)=>$.id===Q)?.label??Q}function x6(Q=process.env){let $=[...UG.map(e5).filter((Z)=>!!Z),...h0.filter((Z)=>!UG.includes(Z.id))];for(let Z of $)for(let X of Z.sessionEnv??[])if(Q[X])return Q[X];return}function DG(Q){return Q==="AI_AGENT"||h0.some(($)=>$.hostEnv?.test(Q))}function w6(Q,$){let Z=e5(Q),X=[...Z?[Z]:[],...h0.filter((Y)=>Y!==Z)];for(let Y of X){let J=Y.hook?.parse($);if(J)return{host:Y,payload:J}}return}function d4(Q=MG(),$=process.env){let Z=[];for(let X of h0){let Y=X.skill?.(Q,$);if(!Y?.present)continue;if(X.plugin?.(Q,$))continue;let J=Z.find((z)=>z.dir===Y.dir);if(J)J.labels.push(X.label);else Z.push({labels:[X.label],dir:Y.dir})}return Z}function NG(Q=MG(),$=process.env){let Z=[];for(let X of h0){let Y=X.skill?.(Q,$);if(!Y)continue;if(!Z.find((z)=>z.dir===Y.dir))Z.push({label:X.label,dir:Y.dir})}return Z}var qG=[];function p4(Q=process.env){let $=Q.TRACETOON_LAUNCHER?.trim();if(!$)return{kind:"none"};let Z=/^(npx|npm):(\S+)$/.exec($);if(Z)return{kind:Z[1],version:Z[2]};return{kind:"script",path:$}}function $T(Q=process.env){if(Q.CURSOR_PLUGIN_ROOT||Q.CURSOR_TRACE_ID||Q.CURSOR_AGENT)return"Cursor";if(Q.CLAUDE_PLUGIN_ROOT||Q.CLAUDECODE||Q.CLAUDE_CODE_CHILD_SESSION)return"Claude Code";return}function CG(Q=process.env){switch($T(Q)){case"Claude Code":return"Update the Tracetoon plugin in Claude Code (/plugin, or /plugin marketplace update); the plugin pins the runtime it runs.";case"Cursor":return"Update the Tracetoon plugin from the Cursor Marketplace; the plugin pins the runtime it runs.";default:return"Update the Tracetoon plugin with your agent's plugin manager (it pins the runtime it runs), or run the newest release directly with npx -y tracetoon@latest."}}function K8(Q=KT(),$=process.env){return h0.filter((Z)=>Z.hook).map((Z)=>({agent:Z.id,label:Z.label,file:Z.hook.file(Q,$),present:Z.hook.present(Q,$),plugin:(Z.pluginHooks??Z.plugin)?.(Q,$)??!1}))}var l2=(Q)=>{let $=e5(Q.agent)?.hook;if(!$)throw Error(`no hook integration for ${Q.agent}`);return $};function VT(Q,$){return`${(Array.isArray($)?$:[$]).map((X)=>{let Y=X.replace(/\\/g,"/");return/\s/.test(Y)?`"${Y}"`:Y}).join(" ")} hook pre-pr --agent ${Q}`}function PG(Q,$){let Z=VT(Q,$),X=(Array.isArray($)?$:[$]).map((Y)=>Y.replace(/\\/g,"/"));return{prePr:Z,lifecycle:(Y)=>Z.replace(/hook pre-pr --agent/,"hook lifecycle --agent")+` --event ${Y}`,argv:{prePr:[...X,"hook","pre-pr","--agent",Q],lifecycle:(Y)=>[...X,"hook","lifecycle","--agent",Q,"--event",Y]}}}var _G="the Tracetoon plugin runs this hook",WT="this copy runs from npx, whose cache isn't a stable path and adds a delay to every tool call; install the standalone runtime (https://github.com/Tracetoon/tracetoon/blob/main/docs/agents/install.md) to add the hook";function b6(Q,$=K8(),Z=process.env){let X=p4(Z).kind==="npx";return $.map((Y)=>{let J={agent:Y.agent,label:Y.label,file:Y.file};if(!Y.present)return{...J,result:"skipped",note:"not installed"};if(X&&!Y.plugin)return{...J,result:"skipped",note:WT};if(Y.plugin){let[W]=JX([Y]);return{...J,result:W?.result==="removed"?"removed":"unchanged",note:_G}}let z=l2(Y).text;if(z){let W=PG(Y.agent,Q),B=BT(Y.file,z,W),H=B.map((U)=>zX(U.path));if(B.every((U,M)=>H[M]===U.text))return{...J,result:"unchanged"};if(H.some((U)=>U!==void 0&&!z.command(U)))return{...J,result:"skipped",note:"a file Tracetoon did not write is there; left untouched"};for(let U of B)if(XT(YX(U.path),{recursive:!0}),zT(U.path,U.text,"utf8"),U.executable)ZT(U.path,493);return{...J,result:"installed",note:l2(Y).installNote?.(Y.file,{})}}let K;try{K=f1(Y.file)}catch(W){return{...J,result:"skipped",note:`could not read it (${W.message}); left untouched`}}let V=l2(Y),G=V.apply(K,PG(Y.agent,Q));if(JSON.stringify(G)===JSON.stringify(K))return{...J,result:"unchanged"};return P$(Y.file,G),{...J,result:"installed",note:V.installNote?.(Y.file,G)}})}function JX(Q=K8()){return Q.map(($)=>{let Z={agent:$.agent,label:$.label,file:$.file},X=l2($).text;if(X){let z=!1;for(let K of[$.file,...GT($.file,X)]){let V=zX(K);if(V===void 0||!X.command(V))continue;JT(K,{force:!0}),z=!0}return{...Z,result:z?"removed":"unchanged"}}let Y;try{Y=f1($.file)}catch{return{...Z,result:"skipped",note:"could not read it; left untouched"}}let J=l2($).apply(Y,void 0);if(JSON.stringify(J)===JSON.stringify(Y))return{...Z,result:"unchanged"};return P$($.file,J),{...Z,result:"removed"}})}var XX="PR creation through recognized shell commands and GitHub connectors; existing PR operations, pushes and read-only commands are left alone. Arbitrary network scripts are not intercepted.",GT=(Q,$)=>Object.keys($.siblings??{}).map((Z)=>FG(YX(Q),Z));function BT(Q,$,Z){return[{path:Q,text:$.render(Z),executable:!1},...Object.entries($.siblings??{}).map(([X,Y])=>({path:FG(YX(Q),X),text:Y(Z),executable:$.executable?.includes(X)??!1}))]}function zX(Q){try{return YT(Q,"utf8")}catch{return}}function v6(Q=K8()){return Q.map(($)=>{if($.plugin)return{agent:$.agent,label:$.label,present:$.present,installed:!0,file:$.file,command:`plugin: ${_G}`,coverage:XX};let Z=l2($).text;if(Z){let G=(()=>{let W=zX($.file);return W===void 0?void 0:Z.command(W)})();return{agent:$.agent,label:$.label,present:$.present,installed:!!G,file:$.file,completionInstalled:!1,command:G,coverage:XX}}let X={},Y=!1;try{X=f1($.file)}catch{Y=!0}let J=JSON.stringify(X),z=l2($),K=!Y&&(J.includes("hook pre-pr")&&/tracetoon/i.test(J)||!!z.installedCommand(X)),V={agent:$.agent,label:$.label,present:$.present,installed:K,file:$.file,completionInstalled:J.includes("hook lifecycle")&&J.includes("--event Stop"),command:z.installedCommand(X),coverage:XX};if(Y)V.problem=`${$.file} is not valid JSON`;else if(K)V.problem=z.problem?.($.file,X);if(V.problem===void 0)delete V.problem;return V})}import{existsSync as ET,readFileSync as ST}from"node:fs";import{join as kT}from"node:path";import{spawnSync as HT}from"node:child_process";function X3(Q,$,Z={}){let X=/(?:^|[\\/])git(?:\.exe)?$/i.test(Q)?"git":/(?:^|[\\/])gh(?:\.exe)?$/i.test(Q)?"github":"other";if(X!=="git"||jG($)==="write")VX();c0(`subprocess.${X}`);let Y=Z5(`subprocess.${X}`,()=>HT(Q,$,{cwd:Z.cwd,input:Z.input,env:Z.env??process.env,encoding:"utf8",maxBuffer:268435456,windowsHide:!0,timeout:Z.timeoutMs}));if(Y.error)return{ok:!1,code:-1,stdout:"",stderr:String(Y.error.message)};return{ok:Y.status===0,code:Y.status??-1,stdout:Y.stdout??"",stderr:Y.stderr??""}}var KX=0,f6=new Map;function AG(Q){KX++;let $=!1;try{let Z=Q();if(Z instanceof Promise)return $=!0,Z.finally(LG);return Z}finally{if(!$)LG()}}function LG(){if(--KX===0)f6.clear()}function VX(){f6.clear()}var UT=new Set(["blame","cat-file","check-ignore","describe","diff","for-each-ref","grep","log","ls-files","ls-tree","merge-base","rev-list","rev-parse","show","show-ref","status"]);function MT(Q){let $=0;while($<Q.length&&Q[$].startsWith("-"))$+=Q[$]==="-c"||Q[$]==="-C"?2:1;return Q.slice($)}function jG(Q){let[$,...Z]=MT(Q);if($==="rev-parse")return"cache";if($==="remote")return Z[0]==="get-url"||Z[0]==="-v"&&Z.length===1?"cache":"write";if($==="config")return Z[0]==="--get"&&Z.length===2?"cache":"write";if($==="worktree")return Z[0]==="list"?"read":"write";if($==="notes")return Z.find((X)=>!X.startsWith("-"))==="list"?"read":"write";return $&&UT.has($)?"read":"write"}function p(Q,$,Z,X){let Y=KX>0&&Z===void 0&&!X&&jG($)==="cache",J=Y?JSON.stringify([Q,$]):"",z=Y?f6.get(J):void 0;if(z)return{...z};let K=X3("git",["-c","core.fsmonitor=false","-c","protocol.ext.allow=never","-c","core.quotepath=off",...$],{cwd:Q,input:Z,env:X?{...process.env,...X}:void 0});if(Y)f6.set(J,{...K});return K}function y0(Q,$){let Z=process.env.TRACETOON_GH_SCRIPT,[X,Y]=Z?[process.env.TRACETOON_TEST_RUNNER??process.execPath,[Z,...$]]:["gh",$];return X3(X,Y,{cwd:Q,env:{...process.env,GH_PROMPT_DISABLED:"1",NO_COLOR:"1"}})}import{join as Ii,resolve as HX}from"node:path";var DT=/^[^/\s]+\/[^/\s]+$/;function i4(Q){let $=/github\.com[:/]([^/]+)\/([^/]+?)(?:\.git)?\/?$/.exec(Q.trim());return $?{owner:$[1],name:$[2]}:void 0}var IG=(Q)=>Q?`${Q.owner}/${Q.name}`:void 0;function d2(Q,$={}){let Z=IG(i4(p(Q,["remote","get-url","origin"]).stdout)),X;if(!$.offline){let J=y0(Q,["repo","view","--json","nameWithOwner","-q",".nameWithOwner"]),z=J.ok?J.stdout.trim():"";if(DT.test(z))X=z}let Y=Z;if(X){if(new Set(p(Q,["remote","-v"]).stdout.split(/\r?\n/).map((z)=>IG(i4(z.split(/\s+/)[1]??""))?.toLowerCase()).filter(Boolean)).has(X.toLowerCase())||!Z)Y=X}return Y?{repo:Y,origin:Z,ghDefault:X}:void 0}function Q2(Q){return Q?["--repo",Q]:[]}function V8(Q,$,Z){let X=Z?.split("/")[0];return $&&X&&$.toLowerCase()!==X.toLowerCase()?`${$}:${Q}`:Q}function g6(Q){if(!Q)return"PR target: unknown (no GitHub remote and no gh default repo).";let $=[];if(Q.origin&&Q.origin.toLowerCase()!==Q.repo.toLowerCase())$.push(`branch is pushed to ${Q.origin}, a different repository`);if(Q.ghDefault&&Q.ghDefault.toLowerCase()!==Q.repo.toLowerCase())$.push(`gh's default repo ${Q.ghDefault} is not a remote of this clone, ignored`);return`PR target: ${Q.repo}${$.length?` (${$.join("; ")})`:""}.`}import{lstatSync as NT,readFileSync as qT,readlinkSync as CT,realpathSync as WX}from"node:fs";import{dirname as PT,isAbsolute as FT,relative as _T,resolve as TG}from"node:path";function GX(Q){return Q.replace(/\\/g,"/").split("/").some(($)=>[".git",".showtail"].includes($.toLowerCase()))}function E0(Q){return!!Q&&!FT(Q)&&!Q.includes("\\")&&!/[:\x00-\x1f\x7f]/.test(Q)&&!GX(Q)&&!Q.split("/").some(($)=>!$||$===".."||$===".")}function OG(Q,$){let Z=_T(WX.native(Q),$).replace(/\\/g,"/");if(Z!==""&&!E0(Z))throw Error("Path is outside the repository or private.")}function W8(Q,$){if(!E0($))throw Error(`Unsafe repository source: ${$}`);let Z=WX.native(TG(Q,$));return OG(Q,Z),qT(Z)}function V5(Q,$){if(!E0($))throw Error(`Unsafe submitted path: ${$}`);let Z=TG(Q,$);OG(Q,WX.native(PT(Z)));let X=NT(Z);if(X.isSymbolicLink())return Buffer.from(CT(Z),"utf8");if(!X.isFile())throw Error("Submitted path is not a regular file.");return W8(Q,$)}function BX(Q,$){let Z=p(Q,$);if(!Z.ok)throw Error(`git ${$.join(" ")} failed: ${Z.stderr.trim()||Z.code}`);return Z.stdout.trim()}function LT(Q){let $=p(Q,["worktree","list","--porcelain"]);if(!$.ok)return[];return $.stdout.split(/\r?\n/).filter((Z)=>Z.startsWith("worktree ")).map((Z)=>HX(Z.slice(9)))}var UX=["rev-parse","--show-toplevel","--absolute-git-dir","HEAD","--abbrev-ref","HEAD"];function G8(Q){let $=p(Q,UX),[Z,X,Y,J]=$.stdout.split(/\r?\n/).map((z)=>z.trim());if(!Z||!X)return;return{toplevel:HX(Z),gitDir:HX(X),branch:J||"HEAD",.../^[a-f0-9]{40,64}$/.test(Y??"")?{headSha:Y}:{},ok:$.ok}}var RG=["main","master","trunk","develop"];function EG(Q,$=[]){let Z=["refs/remotes/origin/HEAD",...[...new Set([...RG,...$])].flatMap((J)=>[`refs/heads/${J}`,`refs/remotes/origin/${J}`])],X=p(Q,["for-each-ref","--format=%(refname)%09%(symref)",...Z]),Y=new Map;for(let J of X.stdout.split(/\r?\n/)){let[z,K]=J.split("\t");if(z)Y.set(z,K??"")}return Y}function SG(Q){let $=Q.get("refs/remotes/origin/HEAD");if($?.startsWith("refs/remotes/origin/"))return $.slice(20);return RG.find((Z)=>Q.has(`refs/heads/${Z}`))??"main"}function B8(Q){return SG(EG(Q))}function AT(Q,$){return Q.has(`refs/remotes/origin/${$}`)?`origin/${$}`:$}function MX(Q,$,Z){let X=new Map;for(let B of p(Q,["remote","-v"]).stdout.split(/\r?\n/)){let[H,U]=B.split(/\s+/);if(H&&!X.has(H)){let M=i4(U??"");X.set(H,M?`${M.owner}/${M.name}`.toLowerCase():void 0)}}let Y=new Set(p(Q,["for-each-ref","--format=%(refname)",`refs/remotes/${$}`,`refs/remotes/*/${$}`]).stdout.split(/\r?\n/).filter(Boolean)),J=[...X.keys()].sort((B,H)=>H.length-B.length).find((B)=>$.startsWith(`${B}/`)&&Y.has(`refs/remotes/${$}`));if(J)return{branch:$.slice(J.length+1),ref:$};let z=(B)=>Y.has(`refs/remotes/${B}/${$}`),K=Z?.toLowerCase(),V=K?[...X].find(([,B])=>B===K)?.[0]:void 0,G=[...X.keys()].filter(z),W=z("origin")?"origin":V&&z(V)?V:G.length===1?G[0]:void 0;return{branch:$,ref:W?`${W}/${$}`:$}}function jT(Q,$,Z,X){let Y=y0(Q,["pr","view",V8($,X,Z),...Q2(Z),"--json","number,url,title,body,baseRefName,headRefName,state"]);if(!Y.ok)return;try{let J=JSON.parse(Y.stdout);return J.state==="OPEN"||J.state==="DRAFT"?J:void 0}catch{return}}function IT(Q){let $={};for(let Z of Q.split(/\r?\n/)){let X=/^([A-Za-z][A-Za-z0-9-]*):\s*(.+)$/.exec(Z.trim());if(!X)continue;($[X[1]]??=[]).push(X[2].trim())}return $}function TT(Q,$,Z){let X=p(Q,["log","--reverse","--no-merges","--format=%H%x1f%s%x1f%at%x1f%ct%x1f%(trailers:unfold,only)%x1f%b%x1e",`${$}..${Z}`]);if(!X.ok)return[];return X.stdout.split("\x1E").map((Y)=>Y.replace(/^\s+/,"")).filter(Boolean).map((Y)=>{let[J,z,K,V,G,W]=Y.split("\x1F");return{sha:J,subject:z??"",...W?.trim()?{body:W.trim()}:{},authorTime:Number(K)*1000,commitTime:Number(V)*1000,trailers:IT(G??"")}})}function OT(Q){let $=[],Z,X,Y=!1,J=0,z=(K)=>Number(/\+(\d+)/.exec(K)?.[1]??0);for(let K of Q.split(/\r?\n/)){if(K.startsWith("diff --git ")){Z=void 0,X=void 0,Y=!1;continue}let V=/^Binary files (?:a\/(.+?)|\/dev\/null) and (?:b\/(.+?)|\/dev\/null) differ$/.exec(K);if(V){let G=V[2]??V[1];if(G)$.push({path:G,added:[],removed:[],addedAt:[]});continue}if(!Y){if(K.startsWith("--- ")){let G=K.slice(4).trim();X=G==="/dev/null"?void 0:G.replace(/^a\//,"")}else if(K.startsWith("+++ ")){let G=K.slice(4).trim(),W=G==="/dev/null"?X:G.replace(/^b\//,"");if(W)Z={path:W,added:[],removed:[],addedAt:[]},$.push(Z)}else if(K.startsWith("@@"))Y=!0,J=z(K);continue}if(K.startsWith("@@")){J=z(K);continue}if(!Z)continue;if(K.startsWith("+"))Z.added.push(K.slice(1)),Z.addedAt?.push(J++);else if(K.startsWith("-"))Z.removed.push(K.slice(1));else if(K.startsWith(" "))J++}return $}function RT(Q){let $=p(Q,["ls-files","--others","--exclude-standard","-z"]);if(!$.ok)return[];let Z=[];for(let X of $.stdout.split("\x00").filter(Boolean)){if(!E0(X))continue;try{let Y=V5(Q,X),J=Y.toString("utf8");Z.push({path:X,added:Y.includes(0)||!Buffer.from(J,"utf8").equals(Y)?[]:J.split(/\r?\n/),removed:[]})}catch{}}return Z}function i0(Q,$={}){let Z=G8(Q);if(!Z)BX(Q,["rev-parse","--show-toplevel"]);let{toplevel:X,gitDir:Y}=Z,J=$.head?BX(X,["rev-parse",$.head]):Z.headSha??"HEAD";if(!$.head&&!Z.ok)BX(X,["rev-parse","--abbrev-ref","HEAD"]);let z=$.head??Z.branch,K=$.noGh?void 0:d2(X),V=i4(p(X,["remote","get-url","origin"]).stdout)?.owner,G=$.noGh?void 0:jT(X,z,K?.repo,V),W=$.base??G?.baseRefName,B,H;if(W)({ref:H}=MX(X,B=W,K?.repo));else{let A=EG(X);B=SG(A),H=AT(A,B)}let U=p(X,["merge-base",H,J]).stdout.trim()||H,M=TT(X,U,J),N=p(X,["log","-n","200","--format=%H%x1f%ct%x1f%s",U]).stdout.split(/\r?\n/).filter(Boolean).map((A)=>{let[E,S,...x]=A.split("\x1F");return{sha:E,ct:Number(S),subject:x.join("\x1F")}}),D=N[0]?.ct??NaN,C=Number.isFinite(D)&&D>0?D*1000:void 0,_=N.map(({sha:A,subject:E})=>({sha:A,subject:E})),I=$.head?!1:p(X,["status","--porcelain","--untracked-files=no"]).stdout.trim().length>0,F=M.length===0&&!$.head,L=OT(p(X,F?["diff","-U0","--no-color","--no-ext-diff",U]:["diff","-U0","--no-color","--no-ext-diff",U,J]).stdout);if(F)L=L.concat(RT(X));L=L.filter((A)=>!GX(A.path));let T=[...new Set([X,...LT(X)])],O=p(X,["remote","get-url","origin"]).stdout.trim(),q=O?i4(O):void 0;return{toplevel:X,gitDir:Y,roots:T,head:z,headSha:J,base:B,mergeBase:U,mergeBaseTime:C,baseCommits:_,commits:M,files:L,usedWorkingTree:F,dirty:I,remote:q?{...q,url:O}:void 0,target:K,pr:G}}var kG=/^(0|false|off|no)$/i,yG=/^(1|true|on|yes)$/i;function xG(Q){try{if(!ET(Q))return;let $=JSON.parse(ST(Q,"utf8")).enabled;return typeof $==="boolean"?$:void 0}catch{return}}function n4(Q){return p(Q,UX).stdout.split(/\r?\n/)[0]?.trim()||void 0}function a3(Q,$=process.env){let Z=$.TRACETOON?.trim();if(Z&&kG.test(Z))return{enabled:!1,decidedBy:"env",why:"TRACETOON=0 is set"};let X=$.CI?.trim();if(X&&yG.test(X)&&!(Z&&yG.test(Z)))return{enabled:!1,decidedBy:"ci",why:"running in CI (set TRACETOON=1 to use it there)"};let Y=n4(Q);if(Y){if(xG(j4(Y))===!1)return{enabled:!1,decidedBy:"repo",why:`this repo turns it off in ${kT(".github","tracetoon.json")}`};let J=p(Y,["config","--get","tracetoon.enabled"]);if(J.ok&&kG.test(J.stdout.trim()))return{enabled:!1,decidedBy:"local",why:"turned off for this repo on this machine (git config tracetoon.enabled)"}}if(xG(I0())===!1)return{enabled:!1,decidedBy:"user",why:"turned off in your Tracetoon settings"};return{enabled:!0,decidedBy:"default",why:"default setting"}}var wG={name:"tracetoon",version:"1.0.0-rc.40",description:"Write pull request descriptions from the AI agent session logs already on your machine, plus a one-off comic.",private:!0,mcpName:"io.github.Tracetoon/tracetoon",type:"module",license:"Apache-2.0",homepage:"https://tracetoon.ai",repository:{type:"git",url:"git+https://github.com/Tracetoon/tracetoon.git"},bugs:"https://github.com/Tracetoon/tracetoon/issues",author:"Tracetoon",keywords:["pull-request","pull-request-description","pr-description-generator","ai-pull-request","github","code-review","ai-agents","agent-skills","claude-code","codex","antigravity","factory-droid","copilot","github-copilot","cursor","opencode","kilo","kilo-code","kiro","cline","junie","devin","goose","qwen-code","crush","amp","zed","warp","session-logs","agent-trace","provenance","ai-provenance","mcp","mcp-server","developer-tools","comic"],bin:{tracetoon:"./src/cli.ts"},scripts:{dev:"bun run src/cli.ts",test:"bun run scripts/test-source.ts","test:bundled":"bun run scripts/test-packaged.ts","test:compiled":"bun run scripts/test-packaged.ts --compiled",typecheck:"bun run scripts/typecheck.ts","dependencies:prepare":"bun run scripts/dependencies.ts",format:'bun x prettier --write "src/**/*.ts" "tests/**/*.ts"',bundle:"bun run scripts/bundle.ts",build:"bun run scripts/build.ts","build:check":"bun run scripts/build-info.ts --check","build:reproduce":"bun run scripts/reproduce.ts","agent-surfaces":"bun run scripts/agent-surfaces.ts","site-kit":"bun run scripts/site-kit.ts"},dependencies:{"@resvg/resvg-wasm":"2.6.2",commander:"^14.0.0",marked:"^16.0.0"},devDependencies:{"@types/node":"^22.0.0","bun-types":"^1.1.0",prettier:"^3.3.0",typescript:"^5.5.0","@expo-google-fonts/comic-neue":"^0.4.1"},engines:{bun:">=1.3.14"}};var xT="source",p2={version:"1.0.0-rc.40",buildId:"0c480515d800ce2bfd6e4c7ad403e3b9cb65e123ebd0af1918b81bc93adb741e",revision:"58e758dd1a63afde73aa7c6722bd701a26b1e37f",protocol:2,dependencies:[{name:"@showtail/agent-traces",revision:"dd0b6f40a09e206c1571a0440f2bdc2b78222c18",packageTree:"6eb00aad7a5c9aa7d54b6dbe3bdb1cd4cb17957e",sha256:"93ff323d6a1b62fe571a771facbbb17186c0530d7372b5b68b8763838fad78de"}],compiler:{name:"bun",version:"1.3.14"},recipe:{schema:"tracetoon.build-recipe/v1",bunVersion:"1.3.14",identity:"__TRACETOON_BUILD__",bundle:{target:"node",format:"esm",minify:!0,ascii:!0},native:{minify:!0,targets:["linux-x64","linux-arm64","darwin-x64","darwin-arm64","windows-x64"]}}},A0=wG.version,b0={version:A0,buildId:p2.buildId,revision:p2.revision,protocol:p2.protocol,...p2.dependencies?{dependencies:p2.dependencies}:{},...p2.compiler?{compiler:p2.compiler}:{},capabilities:["task-lifecycle","check-receipts","pr-creation-routing","shared-preparation","batch-evidence","claim-review-v2"]},i2=b0.buildId===xT;import{spawn as gT}from"node:child_process";import{existsSync as hT,mkdirSync as mT,readFileSync as gG,rmSync as uT,writeFileSync as cT}from"node:fs";import{basename as lT,dirname as hG,join as mG}from"node:path";import{existsSync as wT,realpathSync as bT}from"node:fs";import{homedir as vT}from"node:os";import{basename as fT,join as a4}from"node:path";function h6(Q=process.env,$=vT(),Z=process.platform,X=process.arch){let Y=Z==="win32",J=Y?"windows":Z==="darwin"?"darwin":"linux",z=X==="arm64"?"arm64":"x64",K=Y&&Q.LOCALAPPDATA?a4(Q.LOCALAPPDATA,"tracetoon"):a4(Q.XDG_DATA_HOME||a4($,".local","share"),"tracetoon"),V=Y?".exe":"";return{homeRoot:K,stable:a4(K,"bin",`tracetoon${V}`),assets:a4(K,"assets"),receipt:a4(K,"install.json"),asset:`tracetoon-${J}-${z}${V}`}}var bG=(Q)=>{try{return bT(Q)}catch{return Q}};function m6(Q,$=process.execPath,Z=process.env,X=i2){if(Z.TRACETOON_BIN)return{ok:!1,reason:"TRACETOON_BIN points at a runtime you manage yourself. Replace it, or unset it to use the installed one."};if(wT(Q.stable)&&bG($)===bG(Q.stable))return{ok:!0};let Y=p4(Z);if(Y.kind==="npx")return{ok:!1,reason:`This copy runs from npm (npx tracetoon@${Y.version}). ${CG(Z)}`};if(Y.kind==="npm")return{ok:!1,reason:`This copy was installed with npm (tracetoon@${Y.version}). Update it with npm install -g tracetoon@latest.`};if(!/^tracetoon(-[a-z]+-[a-z0-9]+)?(\.exe)?$/i.test(fT($)))return{ok:!1,reason:X?"This copy runs from a source checkout (bun src/cli.ts). Pull the checkout to update it, or install the binary: curl -fsSL https://raw.githubusercontent.com/Tracetoon/tracetoon/main/install.sh | sh":"This copy runs from a bundle (a Claude Code plugin). Update the plugin with /plugin marketplace update, or install the binary: curl -fsSL https://raw.githubusercontent.com/Tracetoon/tracetoon/main/install.sh | sh"};return{ok:!1,reason:`This binary (${$}) is not the installed one (${Q.stable}). Run the installed tracetoon, or re-run the installer.`}}function n2(Q){let $=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(Q.trim());if(!$)return;return{core:[Number($[1]),Number($[2]),Number($[3])],pre:$[4]?$[4].split(".").map((Z)=>/^\d+$/.test(Z)?Number(Z):Z):[]}}function $2(Q,$){let Z=n2(Q),X=n2($);if(!Z||!X)throw Error(`not a version: ${!Z?Q:$}`);for(let Y=0;Y<3;Y++){let J=Z.core[Y]-X.core[Y];if(J)return J}if(!Z.pre.length||!X.pre.length)return X.pre.length-Z.pre.length;for(let Y=0;Y<Math.max(Z.pre.length,X.pre.length);Y++){let J=Z.pre[Y],z=X.pre[Y];if(J===void 0)return-1;if(z===void 0)return 1;if(J===z)continue;if(typeof J==="number"&&typeof z==="number")return J-z;if(typeof J==="number")return-1;if(typeof z==="number")return 1;return J<z?-1:1}return 0}function vG(Q){return(n2(Q)?.pre.length??0)>0}var fG=86400000,dT=3600000,uG=900000,cG=(Q)=>hG(Q.TRACETOON_CONFIG??I0()),lG=(Q=process.env)=>mG(cG(Q),"update-state.json"),dG=(Q)=>mG(cG(Q),"update.lock"),c6=(Q=process.env)=>G0(lG(Q))??{};function u6(Q,$){P0(lG(Q),{...c6(Q),...$})}function pT(Q=process.env,$=Date.now()){try{return $-Number(gG(dG(Q),"utf8"))<uG}catch{return!1}}function pG(Q=process.env,$=Date.now()){let Z=dG(Q);try{if(hT(Z)&&$-Number(gG(Z,"utf8"))<uG)return}catch{}return mT(hG(Z),{recursive:!0}),cT(Z,String($)),()=>uT(Z,{force:!0})}function iT(Q,$){let X=/^tracetoon(-[a-z]+-[a-z0-9]+)?(\.exe)?$/i.test(lT(process.execPath))?Q:[process.argv[1],...Q],Y=gT(process.execPath,X,{detached:!0,stdio:"ignore",windowsHide:!0,env:$});Y.on("error",()=>{}),Y.unref()}function iG(Q,$=process.env,Z={}){if($.TRACETOON_NO_UPDATE_CHECK==="1"||$.TRACETOON_DISABLE_UPDATES==="1")return;let X=L0();if(X.autoUpdate==="off")return;if(!(Z.eligible??m6(h6($),process.execPath,$).ok))return;let J=Z.now??Date.now(),z=Z.spawn??((W)=>iT(W,$)),K=c6($);if((!K.checkedAt||K.channel!==X.updateChannel||J-Date.parse(K.checkedAt)>fG)&&(!K.spawnedAt||J-Date.parse(K.spawnedAt)>dT))u6($,{spawnedAt:new Date(J).toISOString()}),z(["update","--check","--quiet"]);if(!K.latest||K.channel!==X.updateChannel||$2(K.latest,A0)<=0)return;let G;if(X.autoUpdate==="install"){if(!pT($,J))z(["update","--auto","--quiet"]);G=`Tracetoon ${K.latest} is being installed in the background (you have ${A0}). Reload your agent when it finishes.`}else G=`Tracetoon ${K.latest} is available (you have ${A0}). Run: tracetoon update`;if(K.notifiedVersion===K.latest&&K.notifiedAt&&J-Date.parse(K.notifiedAt)<fG)return;if(u6($,{notifiedAt:new Date(J).toISOString(),notifiedVersion:K.latest}),Q!=="claude"&&Q!=="codex")return;return JSON.stringify({systemMessage:G,hookSpecificOutput:{hookEventName:"SessionStart",additionalContext:`${G} If the user asks to update, run \`tracetoon update --check --json\`, summarize what changed, confirm with them, then run \`tracetoon update\`. Do not update on your own.`}})}var nT=[{code:"ERROR",exit:1,meaning:"Any error without a more specific code"},{code:"USAGE",exit:2,meaning:"Unknown command or option, or a missing argument",fix:"tracetoon commands --json"},{code:"NOT_A_GIT_REPO",exit:1,meaning:"The command must run inside a git repository",fix:"cd into the repository, then rerun"},{code:"RUN_NOT_FOUND",exit:1,meaning:"No Tracetoon run, or not the one named by `--run`",fix:"tracetoon prepare --json"},{code:"RUN_OTHER_WORKTREE",exit:1,meaning:"The run belongs to another worktree or branch",fix:"Switch to that checkout, or pass another --run"},{code:"NOTHING_RENDERED",exit:1,meaning:"Publishing needs a render first",fix:"tracetoon render --json"},{code:"BRANCH_NOT_PUSHED",exit:1,meaning:"With `--no-push`: GitHub does not have the rendered revision",fix:"tracetoon publish --push"},{code:"PR_EXISTS",exit:1,meaning:"A PR Tracetoon did not render already exists for this branch and base",fix:"tracetoon context --json, then render and publish again (it updates that PR)"},{code:"GH_MISSING",exit:6,meaning:"The GitHub CLI (`gh`) is not installed",fix:"Install the GitHub CLI: https://cli.github.com",humanRequired:!0},{code:"GH_NOT_AUTHENTICATED",exit:6,meaning:"`gh` is not signed in, or its token was refused",fix:"gh auth login",humanRequired:!0},{code:"GH_FAILED",exit:1,meaning:"A `gh` call failed for another reason (the message has its output)"},{code:"GITHUB_UNREACHABLE",exit:7,meaning:"GitHub could not be reached, timed out or rate-limited the call",fix:"Rerun the same command in a minute",retryable:!0},{code:"CONSENT_REQUIRED",exit:4,meaning:"Sending comic prompts to this image route needs the user\u2019s agreement",fix:"Ask the user; rerun with --consent only after they agree",humanRequired:!0},{code:"NO_IMAGE_ROUTE",exit:5,meaning:"No approved image route can draw the comic",fix:"Offer the printed options, or skip the comic",humanRequired:!0},{code:"COMIC_UNEXPLAINED",exit:1,meaning:"A comic was expected and an image route could draw it, but none was drawn or skipped with a reason",fix:'Draw it (SKILL step 5), or `tracetoon comic skip --reason "<why>"`, then render again'},{code:"UPDATES_DISABLED",exit:1,meaning:"`TRACETOON_DISABLE_UPDATES=1` is set here"},{code:"UPDATE_LOOKUP_FAILED",exit:7,meaning:"The release list could not be fetched",fix:"Rerun the same command in a minute",retryable:!0},{code:"SKILL_SOURCE_NOT_FOUND",exit:1,meaning:"`setup` found no skill folder shipped with this runtime",fix:"Follow docs/agents/install.md"}];function H8(Q){return nT.find(($)=>$.code===Q)}var nG=1;function d(Q,$,Z){if(Q.json){let X=$&&typeof $==="object"&&!Array.isArray($)&&!("schemaVersion"in $)?{...$,schemaVersion:nG}:$;process.stdout.write(JSON.stringify(X,null,2)+`
330
330
  `)}else process.stdout.write(Z().replace(/\s*$/,"")+`
331
331
  `)}class g extends Error{exitCode;isUserError=!0;code;fix;retryable;humanRequired;constructor(Q,$=1,Z={}){super(Q);this.exitCode=$;this.code=Z.code,this.fix=Z.fix,this.retryable=Z.retryable,this.humanRequired=Z.humanRequired}}function F0(Q,$,Z){let X=H8(Q);return new g($,X?.exit??1,{code:Q,fix:Z??X?.fix,retryable:X?.retryable??!1,humanRequired:X?.humanRequired??!1})}function DX(Q,$){let Z=$.trim(),X=`${Q} failed: ${Z}`;if(/ENOENT|not recognized as|executable file not found|command not found/i.test(Z))return F0("GH_MISSING",X);if(/not logged in|gh auth login|authentication|HTTP 401|bad credentials/i.test(Z))return F0("GH_NOT_AUTHENTICATED",X);if(/rate limit|HTTP 5\d\d|timed? ?out|ECONNRESET|ETIMEDOUT|could not resolve host|connection (lost|refused|reset)|network/i.test(Z))return F0("GITHUB_UNREACHABLE",X);return F0("GH_FAILED",X)}var aT=[[/not (inside )?a git repository/i,"NOT_A_GIT_REPO"],[/No Tracetoon run found/,"RUN_NOT_FOUND"],[/Invalid Tracetoon run id/,"RUN_NOT_FOUND"],[/belongs to another worktree or branch/,"RUN_OTHER_WORKTREE"]];function NX(Q){let $=Q,Z=String($?.message??Q),X=$?.isUserError?$:void 0,Y=X?.code||aT.find(([K])=>K.test(Z))?.[1],J=Y?H8(Y):void 0,z=X?.fix||J?.fix;return{schemaVersion:nG,error:Z,errorCode:Y??"ERROR",...z?{fix:z}:{},retryable:X?.retryable??J?.retryable??!1,humanRequired:X?.humanRequired??J?.humanRequired??!1}}import{spawn as eT,spawnSync as QO}from"node:child_process";import{existsSync as EX,mkdirSync as $O,mkdtempSync as KB,readdirSync as ZO,readFileSync as s6,statSync as TX,writeFileSync as VB}from"node:fs";import{homedir as WB,tmpdir as GB}from"node:os";import{join as h3}from"node:path";var U8=[{id:"strip",name:"Gag strip",useWhen:"a joke told in beats: setup, build, punchline",layout:"a horizontal row of panels read left to right; the last panel lands the punchline",panels:[3,4],aspect:"16:9"},{id:"tiered-strip",name:"Tiered page",useWhen:"a scene that needs establishing first, then quick beats to the punchline",layout:"a wide establishing panel across the top, then a row of 2 to 4 smaller panels below it; the last one lands the joke",panels:[3,5],aspect:"4:3"},{id:"manga-page",name:"Manga page",useWhen:"escalation or a dramatic overreaction: quick beats into one big reaction",layout:"a manga page with irregular, slanted panels of different sizes; small fast beats lead into one dominant reaction panel",panels:[3,6],aspect:"3:4"},{id:"webtoon",name:"Vertical webtoon",useWhen:"a slow reveal or a pause before the punchline: read top to bottom",layout:"a vertical scroll of 3 to 5 stacked wide panels with space between them for timing; the last panel is the payoff",panels:[3,5],aspect:"3:4"},{id:"4koma",name:"4-koma",useWhen:"a story with a clear twist: setup, development, twist, resolution",layout:"four panels: setup, development, twist, resolution",panels:[4,4],aspect:"4:3"},{id:"before-after",name:"Before / after",useWhen:"only when the contrast itself is the punchline; most changes make a better joke as a story",layout:"split page: BEFORE on the left, AFTER on the right, optionally a narrow FIX panel between them",panels:[2,3],aspect:"16:9"},{id:"splash",name:"Splash page",useWhen:"one big moment says it all: a launch, a rescue, a victory",layout:"one full-page scene with a huge headline; at most one small inset or caption box",panels:[1,2],aspect:"4:3"},{id:"mission-briefing",name:"Mission briefing",useWhen:"a tricky multi-part fix: objectives, obstacles, outcome",layout:"a briefing board: a large hero panel plus 2 to 4 numbered mission cards with short labels",panels:[3,5],aspect:"4:3"},{id:"movie-poster",name:"Movie poster",useWhen:"a big feature or a dramatic rescue that deserves a blockbuster",layout:"a movie poster: the cast posed heroically, a title treatment, a tagline, and a credits block of short labels",panels:[1,1],aspect:"3:4"},{id:"manual-page",name:"Instruction manual",useWhen:"a new workflow or setup: show the steps",layout:"a flat-pack instruction manual page: 3 to 6 numbered steps with simple pictures and tiny labels",panels:[3,6],aspect:"4:3"},{id:"newspaper-sunday",name:"Sunday funnies",useWhen:"an everyday, relatable story with a few beats",layout:"a Sunday comics page: a title banner, then panels of varied widths in two rows",panels:[4,6],aspect:"4:3"},{id:"trading-card",name:"Trading card",useWhen:"a new capability or tool: show its stats and powers",layout:"a collectible trading card: a framed character portrait, a name plate, 2 to 3 ability lines and a stats box",panels:[1,1],aspect:"3:4"},{id:"custom",name:"Custom",useWhen:"none of the above fits: describe the page in `layout`",layout:"",panels:[1,6],aspect:"4:3"}],Z2=(Q)=>U8.find(($)=>$.id===Q);var l6=[{id:"webcomic",name:"Modern webcomic",family:"webcomic",prompt:"modern webcomic, bold clean black ink outlines, bright cel-shaded color, very expressive cartoon faces and big reactions, simple readable backgrounds, crisp panel borders with white gutters",palettes:["full-color"],moods:["gag","relatable","everyday","any"],lettering:"bold hand-lettered comic font in white speech balloons, yellow caption boxes, punchy sound effects"},{id:"superhero",name:"American superhero",family:"american",prompt:"modern American superhero comic book, dynamic foreshortened poses, confident inking with feathered shadows, rich digital coloring, dramatic lighting",palettes:["full-color"],moods:["heroic","rescue","big win","showdown"],lettering:"uppercase comic-book lettering in oval balloons, bold caption boxes, big angular sound effects"},{id:"silver-age",name:"Silver Age comic",family:"american",prompt:"1960s American comic book page, Ben-Day halftone dots, bold primary colors, thick inked outlines, melodramatic poses, slightly yellowed newsprint",palettes:["full-color","limited"],moods:["heroic","melodrama","retro","big claim"],lettering:"classic uppercase comic lettering in white balloons, exclamation-heavy, narration boxes"},{id:"alt-comix",name:"Indie alt-comix",family:"indie",prompt:"indie alternative comic, loose expressive brush ink, slightly wobbly hand-drawn panel borders, flat muted colors, deadpan characters",palettes:["limited","bw-accent"],moods:["deadpan","awkward","dry humor","existential"],lettering:"uneven hand-lettered capitals in simple balloons"},{id:"shonen-action",name:"Shonen manga",family:"manga",prompt:"shonen manga page, energetic black ink, screentone shading, speed lines and impact frames, exaggerated reactions, dynamic camera angles",palettes:["bw-accent","full-color"],moods:["epic","battle","comeback","speed","rivalry"],lettering:"manga balloons with bold lettering, huge hand-drawn sound effects integrated into the art"},{id:"manga-ink",name:"Seinen manga",family:"manga",prompt:"seinen manga page, detailed black ink linework, crosshatching and screentone, cinematic paneling, restrained, tense expressions",palettes:["bw-accent","limited"],moods:["tense","mystery","debugging","serious-as-a-joke"],lettering:"clean manga lettering in balloons, sparse narration boxes"},{id:"shojo",name:"Shojo manga",family:"manga",prompt:"shojo manga page, delicate fine linework, sparkle and flower screentones, big emotive eyes, soft pastel tones, panels that break their borders for emotional beats",palettes:["limited","full-color"],moods:["dramatic feelings","romance parody","wholesome","devotion"],lettering:"elegant manga lettering, floating inner-monologue text, sparkly emphasis"},{id:"chibi-anime",name:"Chibi manga comedy",family:"manga",prompt:"comedic chibi manga, super-deformed characters with big heads, sweat drops, anger marks and comic tears, simple screentone backgrounds, bold ink outlines",palettes:["full-color","limited"],moods:["silly","panic","small fix","cute"],lettering:"rounded bubbly balloons, wobbly panic lettering"},{id:"yonkoma",name:"Yonkoma gag manga",family:"manga",prompt:"yonkoma gag manga, clean simple ink linework, cute deformed characters, flat light tones, tidy rectangular panels",palettes:["bw-accent","limited"],moods:["gag","twist","everyday","deadpan"],lettering:"small neat balloons, a quiet beat before the last-panel punchline"},{id:"ligne-claire",name:"Ligne claire",family:"euro",prompt:"ligne claire European comic, clean uniform ink outlines, flat bright colors, detailed tidy backgrounds, no hatching",palettes:["full-color"],moods:["adventure","investigation","clever","travel"],lettering:"neat hand lettering in clean rounded balloons"},{id:"euro-humor",name:"Franco-Belgian humor",family:"euro",prompt:"Franco-Belgian humor comic, round bouncy cartoon characters with big noses, lively brush ink, bright flat colors, busy funny background details",palettes:["full-color"],moods:["slapstick","chaos","escalation","ensemble"],lettering:"lively hand lettering in rounded balloons, onomatopoeia drawn into the scene"},{id:"sunday-strip",name:"Sunday funnies",family:"newspaper",prompt:"classic Sunday newspaper comic strip, simple expressive cartoon characters, warm flat colors, confident brush outlines, slight newsprint texture",palettes:["full-color","limited"],moods:["gag","everyday","relatable","small fix"],lettering:"friendly hand-lettered balloons"},{id:"editorial-cartoon",name:"Editorial cartoon",family:"newspaper",prompt:"newspaper editorial cartoon, scratchy pen-and-ink crosshatching, exaggerated original figures, words written on the objects that matter, single gray wash",palettes:["bw-accent"],moods:["commentary","irony","big picture","satire"],lettering:"hand-lettered words on objects in the scene, a short caption under the drawing"},{id:"magazine-cartoon",name:"Magazine gag cartoon",family:"newspaper",prompt:"sophisticated magazine gag cartoon, loose confident pen line, light gray wash, understated deadpan characters",palettes:["bw-accent"],moods:["dry wit","understatement","one-liner"],lettering:"a single typeset caption beneath the drawing, set in quotes when someone speaks"},{id:"webtoon",name:"Full-color webtoon",family:"webcomic",prompt:"full-color webtoon, clean digital lineart, soft gradient cel shading, glossy modern characters, big reaction close-ups, generous space between panels",palettes:["full-color"],moods:["drama","reaction","slow reveal","vertical"],lettering:"clean digital balloons, oversized reaction text"},{id:"saturday-cartoon",name:"90s Saturday-morning cartoon",family:"american",prompt:"1990s Saturday-morning TV cartoon look drawn as a comic, thick outlines, angular stylized characters, saturated flat colors, squash-and-stretch expressions",palettes:["full-color"],moods:["zany","chaos","slapstick","villain plan"],lettering:"chunky cartoon lettering in bold balloons, loud sound effects"},{id:"noir",name:"Noir graphic novel",family:"american",prompt:"noir graphic novel, heavy black ink shadows, venetian-blind light, rain, chiaroscuro, trench coats",palettes:["bw-accent","limited"],moods:["mystery","debugging","investigation","confession"],lettering:"typewriter caption boxes with hard-boiled narration, tight balloons"},{id:"pixel-16bit",name:"Pixel comic",family:"webcomic",prompt:"pixel-art comic, crisp 16-bit pixels, clear panel borders, chunky expressive sprites, video-game UI framing",palettes:["limited","full-color"],moods:["quest","level up","boss fight","retro"],lettering:"pixel-font RPG dialogue boxes"}],oT=[["mecha-anime","mecha anime style, detailed robots and cockpits, holographic HUD panels, cinematic lighting","HUD labels and readouts on screens, condensed sci-fi headline",["full-color","bw-accent"]],["rubber-hose","1930s rubber-hose cartoon, bendy limbs, pie-cut eyes, white gloves, sepia film grain, bouncy motion","vintage title card lettering, bouncy balloons",["limited","duotone"]],["storybook-watercolor","children's storybook watercolor illustration, soft washes, pencil linework, gentle light","handwritten storybook captions, whimsical headline",["full-color"]],["claymation","stop-motion claymation diorama, plasticine characters with fingerprints, miniature set, soft studio lighting","cut-paper signs and labels in the set, chunky headline",["full-color"]],["risograph","risograph-printed zine, two overprinted ink colors, grainy texture, slight misregistration, bold shapes","chunky grotesque type, stamped labels",["duotone"]],["pulp-scifi","1950s pulp science fiction magazine art, ray guns, rocket fins, painted gouache, dramatic sky","pulp magazine cover headline, starburst blurbs",["full-color","limited"]],["ukiyo-e","Japanese ukiyo-e woodblock print, flat color areas, carved outlines, stylized waves and clouds, washi paper texture","vertical cartouche labels, brush headline",["limited"]],["atomic-flat","mid-century modern illustration, atomic-age shapes, flat geometric characters, starbursts, cream background","retro display type, small caption labels",["limited","full-color"]],["blueprint","technical blueprint, white linework on cyan blueprint paper, callouts, dimension lines, exploded views","drafting stencil labels and callouts, title block headline",["duotone"]],["vaporwave","vaporwave aesthetic, neon pink and cyan, synthwave sun, chrome text, grid horizon, retro computer windows","chrome and neon headline, window-title labels",["full-color"]]].map(([Q,$,Z,X])=>({id:Q,name:Q,family:"custom",prompt:$,palettes:X,moods:[],lettering:Z})),X2=(Q)=>l6.find(($)=>$.id===Q)??oT.find(($)=>$.id===Q);function oG(Q=[],$){let Z=l6.filter((X)=>X.id!==$);return[...Z.filter((X)=>!Q.includes(X.id)),...Z.filter((X)=>Q.includes(X.id))]}function qX(Q){return X2(Q)?.prompt??Q.trim()}function CX(Q){return X2(Q)?.lettering??"hand-lettered comic text in speech balloons and caption boxes that suits the art, easy to read at phone size"}var aG=/\b(3d|cgi|render(ed)?|clay|claymation|plasticine|diorama|plush|toy|figurine|watercolou?r|gouache|oil paint|painted|picture[- ]book|storybook|photo(graph|real)?|stop[- ]motion|papercraft|paper[- ]cut)/i;function sG(Q,$){return aG.test(qX(Q))||aG.test($??"")}function rG(Q,$){switch(Q){case"bw-accent":return`black and white with a single accent color (${$??"red"}) used sparingly for emphasis`;case"duotone":return`two-color print (${$?`black and ${$}`:"two inks"})`;case"limited":return"limited palette of 3 to 4 colors";default:return"full color"}}import{createHash as ZB}from"node:crypto";var PX=["ki","sho","ten","ketsu"],tG={ki:"setup",sho:"development",ten:"twist",ketsu:"resolution"},FX=["happy","excited","worried","surprised","determined","thinking","sleepy","proud","angry"],M8=["human","creature","object"],_X=["webcomic","american","manga","euro","newspaper","indie","custom"],sT=["ink","flat-color","painted","print","dimensional","pixel","technical"],d6=[..._X,...sT],D8=["single","comparison","sequence","vertical","asymmetric","hero-inset","diagonal","tiered","custom"],LX=["speech","thought","caption","sfx","sign","label"],AX=["4:3","1:1","16:9","3:4"],o4=["full-color","bw-accent","duotone","limited"];function Y2(Q){return Q.aspect??(Q.composition?.family==="vertical"?"3:4":Z2(Q.format)?.aspect??"4:3")}function s4(Q){let[$,Z]=Q.split(":").map(Number);return $/Z}function O5(Q){let $=Q.composition?.title?.mode==="none"?"":Q.headline??Q.title;return typeof $==="string"?$:""}function T5(Q){let $=Q.composition;if(!$)return;if($.frames)return{...$,frames:$.frames};let Z=Q.panels.length,X=$.title.mode==="heading"?0.14:0.025,Y=0.975-X,J=(V,G,W,B)=>({x:V,y:X+G*Y,w:W,h:B*Y}),z=0.025,K;switch($.family){case"single":K=[J(0.025,0,0.95,1)];break;case"comparison":case"sequence":{let V=(0.95-z*(Z-1))/Z;K=Array.from({length:Z},(G,W)=>J(0.025+W*(V+z),0,V,1));break}case"vertical":{let V=(1-z*(Z-1))/Z;K=Array.from({length:Z},(G,W)=>J(0.025,W*(V+z),0.95,V));break}case"asymmetric":{let V=Z-1,G=V<=2?V:2,W=Math.ceil(V/G),B=(0.95-z*(G-1))/G,H=(0.46-z*(W-1))/W;K=Array.from({length:V},(U,M)=>J(0.025+M%G*(B+z),Math.floor(M/G)*(H+z),B,H)),K.push(J(0.025,0.49,0.95,0.51));break}case"tiered":{let V=Z-1,G=(0.95-z*(V-1))/V;K=[J(0.025,0,0.95,0.44)];for(let W=0;W<V;W++)K.push(J(0.025+W*(G+z),0.47,G,0.53));break}case"hero-inset":{K=[{...J(0.025,0,0.95,1),textBox:{x:0.035,y:0.03,w:0.56,h:0.8}}];let V=(0.88-z*(Z-2))/(Z-1);for(let G=0;G<Z-1;G++)K.push(J(0.64,0.045+G*(V+z),0.305,V));break}case"diagonal":K=[{...J(0.025,0,0.95,1),clip:[[0,0],[0.98,0],[0,0.98]],textBox:{x:0.035,y:0.03,w:0.48,h:0.32}},{...J(0.025,0,0.95,1),clip:[[1,0.02],[1,1],[0.02,1]],textBox:{x:0.5,y:0.65,w:0.46,h:0.31}}];break;default:K=[]}return{...$,frames:K}}function o6(Q){let $=Q.composition?.title;if(!$||$.mode==="none")return;return $.box??($.mode==="heading"?{x:0.035,y:0.015,w:0.93,h:0.1}:{x:0.055,y:0.82,w:0.55,h:0.13})}function N8(Q,$){let Z=T5(Q)?.frames[$];if(!Z)return"1:1";let X=Z.w*s4(Y2(Q))/Z.h;return["1:1","4:3","16:9","3:4"].reduce((Y,J)=>Math.abs(Math.log(s4(Y)/X))<Math.abs(Math.log(s4(J)/X))?Y:J)}var p6=(Q)=>`${Math.round(Q*1000)/10}%`;function XB(Q){let $=T5(Q);if(!$)return"";return[`Composition: ${$.family}; exactly ${$.frames.length} scene(s), read left-to-right then top-to-bottom in the numbered story order. Preserve the specified hierarchy, unequal sizes and negative space.`,...$.frames.map((Z,X)=>`Frame ${X+1}: left ${p6(Z.x)}, top ${p6(Z.y)}, width ${p6(Z.w)}, height ${p6(Z.h)}; ${Z.clip?`polygon clipping points ${JSON.stringify(Z.clip)}`:"rectangular"}; ${Z.border==="none"?"borderless":"visible frame border"}.`),$.title.mode==="none"?"No visible title or headline. Start with the art; do not reserve a title banner.":`Title treatment: ${$.title.mode}; place "${O5(Q)}" inside this page area ${JSON.stringify(o6(Q))}. ${$.title.mode==="integrated"?"Integrate it into the scene; no separate top banner.":"Keep it inside that heading area, sized to the composition."}`].join(`
332
332
  `)}function r4(Q,$){let{designReason:Z,anchor:X,altText:Y,synopsis:J,...z}=Q,K=z.panels.map(({drawn:V,...G})=>G);return ZB("sha256").update(JSON.stringify({art:{...z,panels:K},lettering:$})).digest("hex")}function q8(Q,$,Z){if(!Q)return!1;if(Q===r4($,Z))return!0;let{designReason:X,anchor:Y,...J}=$;return Q===ZB("sha256").update(JSON.stringify({art:J,lettering:Z})).digest("hex")}var rT=[["flat-color",["mecha-anime","rubber-hose","atomic-flat","vaporwave"]],["painted",["storybook-watercolor","pulp-scifi"]],["print",["risograph","ukiyo-e"]],["dimensional",["claymation"]],["technical",["blueprint"]]];function eG(Q){return l6.find(($)=>$.id===Q)?.family??rT.find(([,$])=>$.includes(Q))?.[0]}function t4(Q){let $=Array.isArray(Q.characters)&&Q.characters.every((Z)=>Z.kind);return{style:Q.style,...Q.styleFamily||eG(Q.style)?{styleFamily:Q.styleFamily??eG(Q.style)}:{},...Q.composition?{layoutFamily:Q.composition.family,titleTreatment:Q.composition.title.mode}:{},panelCount:Q.panels.length,...$?{castKinds:[...new Set(Q.characters.map((Z)=>Z.kind))].sort()}:{}}}var YB=(Q,$,Z)=>($[0]-Q[0])*(Z[1]-$[1])-($[1]-Q[1])*(Z[0]-$[0]);function jX(Q,$){let Z=$.map((X,Y)=>YB(X,$[(Y+1)%$.length],Q)).filter((X)=>Math.abs(X)>0.00000001);return Z.every((X)=>X>=0)||Z.every((X)=>X<=0)}function i6(Q){return(Q.clip??[[0,0],[1,0],[1,1],[0,1]]).map(([$,Z])=>[Q.x+$*Q.w,Q.y+Z*Q.h])}function QB(Q,$){for(let Z of[Q,$])for(let X=0;X<Z.length;X++){let Y=Z[X],J=Z[(X+1)%Z.length],z=[J[1]-Y[1],Y[0]-J[0]],K=Q.map(([G,W])=>G*z[0]+W*z[1]),V=$.map(([G,W])=>G*z[0]+W*z[1]);if(Math.min(...K)>=Math.max(...V)-0.00000001||Math.min(...V)>=Math.max(...K)-0.00000001)return!1}return!0}function n6(Q){let $=Q;return!!$&&[$.x,$.y,$.w,$.h].every((Z)=>typeof Z==="number"&&Number.isFinite(Z))&&$.x>=0&&$.y>=0&&$.w>0&&$.h>0&&$.x+$.w<=1.00000001&&$.y+$.h<=1.00000001}function IX(Q){let $=Q.composition;if(!$)return[];let Z=[],X=(V,G)=>Z.push({where:`composition.${V}`,problem:G});if(!D8.includes($.family))X("family",`must be ${D8.join(", ")}`);if(!$.title||!["none","integrated","heading"].includes($.title.mode))X("title.mode","must be none, integrated or heading");if($.title?.box!==void 0&&!n6($.title.box))X("title.box","must be positive bounds within the 0\u20131 page");let J={single:[1,1],comparison:[2,3],asymmetric:[3,6],"hero-inset":[2,6],diagonal:[2,2],tiered:[3,5]}[$.family];if(J&&(Q.panels.length<J[0]||Q.panels.length>J[1]))X("family",`${$.family} needs ${J[0]}\u2013${J[1]} panels; choose another family or explicit custom geometry`);if($.family==="custom"&&!Array.isArray($.frames))X("frames","custom composition requires explicit frames");if($.frames!==void 0&&(!Array.isArray($.frames)||$.frames.length!==Q.panels.length))X("frames","must contain one frame per story panel, in reading order");if(Z.length)return Z;let z=T5(Q);if(z.frames.forEach((V,G)=>{let W=`frames[${G}]`;if(!n6(V)){X(W,"must be positive bounds within the 0\u20131 page");return}if(V.border!==void 0&&!["line","none"].includes(V.border))X(`${W}.border`,"must be line or none");if(V.inset!==void 0&&typeof V.inset!=="boolean")X(`${W}.inset`,"must be boolean");if(V.textBox!==void 0&&!n6(V.textBox))X(`${W}.textBox`,"must be positive bounds within the 0\u20131 frame");if(V.clip!==void 0){if(!Array.isArray(V.clip)||V.clip.length<3||V.clip.length>8||V.clip.some((H)=>!Array.isArray(H)||H.length!==2||H.some((U)=>!Number.isFinite(U)||U<0||U>1))){X(`${W}.clip`,"use 3\u20138 polygon points in the frame\u2019s 0\u20131 space");return}let B=V.clip.map((H,U)=>YB(H,V.clip[(U+1)%V.clip.length],V.clip[(U+2)%V.clip.length]));if(B.every((H)=>Math.abs(H)<0.00000001)||!(B.every((H)=>H>=-0.00000001)||B.every((H)=>H<=0.00000001))||!V.clip.every((H)=>jX(H,V.clip)))X(`${W}.clip`,"must be a nonzero convex polygon, with points around its edge");if(Q.panels[G]?.dialogue?.length&&!V.textBox)X(`${W}.textBox`,"polygon panels with dialogue require a safe lettering box");if(V.textBox&&n6(V.textBox)&&i6(V.textBox).some((H)=>!jX(H,V.clip)))X(`${W}.textBox`,"must fit entirely inside the clipping polygon")}}),Z.length)return Z;let K=$.title.mode==="heading"?i6(o6(Q)):void 0;return z.frames.forEach((V,G)=>{let W=i6(V);if(K&&QB(W,K))X(`frames[${G}]`,"overlaps the separate heading; move it or use integrated title treatment");for(let B=0;B<G;B++){let H=i6(z.frames[B]);if(!QB(W,H))continue;if(!(($.family==="hero-inset"||V.inset)&&W.every((M)=>jX(M,H))))X(`frames[${G}]`,`overlaps frame ${B+1}; deliberate insets must be contained and marked inset: true`)}}),Z}var $B=360;function tT(Q){let $=T5(Q);if($)return $.frames;let Z=Q.format==="strip"||Q.format==="before-after"?"sequence":void 0;if(!Z)return;return T5({...Q,composition:{family:Z,title:{mode:"heading"}}})?.frames}function a6(Q){let $=tT(Q);if(!$)return[];let Z=$B/s4(Y2(Q));return $.map((X,Y)=>{let J=Math.round(X.w*$B),z=X.h*Z,K=Math.max(1,Math.floor(J*0.85/6.2)),V=Math.max(1,Math.floor(z*0.5/15)),G=Math.round((Q.panels[Y]?.dialogue??[]).reduce((H,U)=>H+U.text.length*(U.kind==="sign"||U.kind==="label"?1.5:1),0)),W=K*V,B=G<=W&&!(J<120&&G>0);return{panel:Y+1,widthPx:J,chars:G,capacity:W,fits:B}})}function e4(Q){let $=a6(Q);if(!$.length||$.every((J)=>J.fits))return;let X=Q.panels.length>=4?["asymmetric","vertical"]:["vertical","asymmetric"],Y;for(let J of X){if(J===Q.composition?.family)continue;let z={...Q,composition:{family:J,title:{mode:Q.composition?.title.mode??"heading"}},aspect:J==="vertical"?"3:4":"4:3"};if(delete z.layout,IX(z).length)continue;if(Y??=z,a6(z).every((K)=>K.fits))return z}return Y}var W5=["codex","antigravity","openai","gemini"],JB={"4:3":"1536x1024","16:9":"1536x1024","1:1":"1024x1024","3:4":"1024x1536"},XO="fictional characters only (human characters are welcome); original character designs that do not resemble existing cartoon, film or game characters; no identifiable real-person or celebrity likenesses, no logos or brand marks, no watermarks, no signatures",YO="no identifiable real-person or celebrity likenesses, no logos or brand marks, no watermarks, no signatures",JO="It must look like a drawn comic: inked line art with flat or cel coloring, real panel borders and gutters, lettering in balloons and caption boxes. Not a 3D render, CGI, clay, plastic toy, plush or diorama, and not a soft children's picture-book painting.";function BB(Q){return Q.request?.trim()?YO:XO}function HB(Q){return Q.request?.trim()?`The user asked for this; honor it exactly: ${Q.request.trim()}.`:""}function zO(Q,$){let Z=Q.characters?.find((X)=>X.name.toLowerCase()===$.toLowerCase());return Z?`${Z.name}: ${Z.description}`:$}function KO(Q,$){return Q.characters.map((Z)=>`${zO($,Z.name)}, on the ${Z.position}${Z.expression?`, looking ${Z.expression}`:""}${Z.pose?`, ${Z.pose}`:""}`).join("; ")}function UB(Q){let $=Q.palette??X2(Q.style)?.palettes[0];return`${qX(Q.style)}${$?`; ${rG($,Q.accent)}`:""}`}function r6(Q,$,Z){let X=KO(Q,Z),Y=Z.panels.length,J=T5(Z)?.frames[$];return[`${UB(Z)}.`,Q.beat?`Panel ${$+1} of ${Y} (${tG[Q.beat]}) of a comic.`:`Panel ${$+1} of ${Y} of a comic.`,`Scene: ${Q.scene}.`,X?`Characters: ${X}.`:"",Q.camera?`Camera: ${Q.camera} shot.`:"",Q.artPrompt?`${Q.artPrompt}.`:"",Z.composition?`A ${MB[N8(Z,$)]} panel image. Keep this normalized area plain for later lettering: ${JSON.stringify(J?.textBox??{x:0,y:0,w:1,h:0.4})}. Compose the subject outside it. No text, no letters.`:"Square image. Keep the top third as plain, uncluttered background so speech bubbles can be added later. No text, no letters.","If a reference image is given, keep every character and the art style consistent with it.",HB(Z),`Strictly: ${BB(Z)}.`].filter(Boolean).join(" ")}var MB={"4:3":"landscape 4:3","16:9":"wide landscape 16:9","1:1":"square","3:4":"portrait 3:4"};function VO(Q){let $=`"${Q.text}"`;switch(Q.kind){case"thought":return`${Q.speaker} thinks (thought bubble): ${$}`;case"caption":return`caption box: ${$}`;case"sfx":return`big sound-effect lettering: ${$}`;case"sign":case"label":return`written on ${Q.points?.trim()||"a screen, sign or object in the scene"} as a natural part of the scene (no callout tag, no pointer line): ${$}`;default:return Q.speaker==="caption"?`caption box: ${$}`:`${Q.speaker} says (speech balloon): ${$}`}}function t6(Q){let $=Z2(Q.format),Z=Y2(Q),X=O5(Q),Y=(Q.characters??[]).map((z)=>`${z.name}: ${z.description}`),J=Q.panels.map((z,K)=>{let V=z.characters.map((W)=>`${W.name} on the ${W.position}${W.expression?`, looking ${W.expression}`:""}${W.pose?`, ${W.pose}`:""}`),G=(z.dialogue??[]).map(VO);return[`Panel ${K+1}: ${z.scene}.`,V.length?`Characters: ${V.join("; ")}.`:"",z.camera?`${z.camera} shot.`:"",z.artPrompt?`${z.artPrompt}.`:"",G.length?`Text: ${G.join("; ")}.`:"No text in this panel."].filter(Boolean).join(" ")});return[`A finished comic page, ${MB[Z]} image.`,`Art style: ${UB(Q)}.`,HB(Q),sG(Q.style,Q.request)?"":JO,!Q.composition&&$&&$.id!=="custom"?`Format: ${$.name}. ${$.layout}.`:"",Q.layout?`Layout: ${Q.layout}.`:"",XB(Q),Y.length?`Characters (draw each one the same way in every panel): ${Y.join("; ")}.`:"",!Q.composition?`Headline, lettered big and bold as part of the design: "${X}".`:"",`${Q.panels.length===1?"The scene":`The ${Q.panels.length} panels, in reading order`}:`,...J,`Lettering: ${Q.composition?CX(Q.style).split(",").filter((z)=>!/headline|title/i.test(z)).join(",")||"clear comic lettering suited to this art":CX(Q.style)}. Letter every quoted text exactly as written, spelled correctly. It must stay readable when the whole page is shown only 360 pixels wide on a phone: balloon and caption letters at least 1/30 of the page width tall, signs and labels in the scene just as large (draw the object bigger rather than the words smaller), short lines, no tiny print anywhere. Words on screens, signs and objects are part of the drawing, never floating tags or arrows. No words other than the quoted text above: no invented labels, no signatures, no watermarks, no made-up text.`,`Strictly: ${BB(Q)}.`].filter(Boolean).join(`
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schema": "tracetoon.build-output/v1",
3
- "buildId": "7f6ce9ec1a7273249e1d982f01d25f1c0ad58c3109898875850111a35eb3a65f",
3
+ "buildId": "0c480515d800ce2bfd6e4c7ad403e3b9cb65e123ebd0af1918b81bc93adb741e",
4
4
  "target": "node-esm",
5
- "inputManifestSha256": "509823d6ca3196f3b85e1d217551e3e923681f91f501f12e7761341038a937cb",
6
- "sha256": "12e2d3abdcf227175b043b93cf128e8855fcec01d51dd34b18beb76f9f00f3b3",
5
+ "inputManifestSha256": "50372ef5546afb4da68029c19848d8a7514752e0c05912f1e0d832b19e58fe68",
6
+ "sha256": "6f0fc4bbf60c4b5774416f506dbe54c351236b3453d4cc2deaf6d716f0bbcde2",
7
7
  "compiler": {
8
8
  "version": "1.3.14",
9
9
  "sha256": "9fd36f87e4b90b07632b987a2e4ec81ca15a62c81bf983190cea6d715be2ad74",