noskills 4.1.39 → 4.1.41

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.
Files changed (41) hide show
  1. package/README.md +41 -13
  2. package/chunks/approve-R5UDYN3P.js +1 -0
  3. package/chunks/block-P7TM5EPZ.js +1 -0
  4. package/chunks/cancel-TU3C6MKE.js +1 -0
  5. package/chunks/{chunk-KJH7Q57A.js → chunk-CIYGCZTM.js} +1 -1
  6. package/chunks/chunk-GBSAQ2FM.js +3 -0
  7. package/chunks/chunk-KDWUWWE5.js +81 -0
  8. package/chunks/chunk-M7KSO4EF.js +1 -0
  9. package/chunks/chunk-RIME26D6.js +144 -0
  10. package/chunks/chunk-U2T4X5EN.js +11 -0
  11. package/chunks/{concern-FGNG32KU.js → concern-E56E2MFL.js} +1 -1
  12. package/chunks/done-NQMUXJYO.js +1 -0
  13. package/chunks/{init-M7SJOVPZ.js → init-3O7FXLIZ.js} +1 -1
  14. package/chunks/{invoke-hook-VXIVDDQG.js → invoke-hook-MPDIOIHR.js} +3 -3
  15. package/chunks/next-5LH223G2.js +8 -0
  16. package/chunks/{purge-6DEK2ZSI.js → purge-6T4L2FXI.js} +1 -1
  17. package/chunks/reopen-JIHLM3KX.js +1 -0
  18. package/chunks/reset-4RHO7MSF.js +1 -0
  19. package/chunks/{rule-OVSBPSYO.js → rule-UDTLRXFA.js} +1 -1
  20. package/chunks/run-77R3ANIQ.js +3 -0
  21. package/chunks/spec-DPDGDRW2.js +1 -0
  22. package/chunks/status-4YV2X73D.js +1 -0
  23. package/chunks/{sync-MWQWXN2C.js → sync-QYUBOAMK.js} +1 -1
  24. package/chunks/watch-XVGIYX6X.js +8 -0
  25. package/chunks/wontfix-VCV45TPJ.js +1 -0
  26. package/noskills.js +1 -1
  27. package/package.json +1 -1
  28. package/chunks/approve-GSSSUQWC.js +0 -1
  29. package/chunks/block-LVQNJU4P.js +0 -1
  30. package/chunks/chunk-4XOSXARZ.js +0 -9
  31. package/chunks/chunk-EMHZF6ZY.js +0 -144
  32. package/chunks/chunk-IAR3DEWR.js +0 -1
  33. package/chunks/chunk-RYQPPQNO.js +0 -3
  34. package/chunks/chunk-XADY6SXR.js +0 -67
  35. package/chunks/done-5IX2F6V7.js +0 -1
  36. package/chunks/next-GGVR6JM2.js +0 -8
  37. package/chunks/reset-JEIUVTWV.js +0 -1
  38. package/chunks/run-7MZATQML.js +0 -3
  39. package/chunks/spec-J7KC4VFM.js +0 -1
  40. package/chunks/status-BISV6DFB.js +0 -1
  41. package/chunks/watch-AP5GGXG6.js +0 -8
@@ -1,3 +0,0 @@
1
- import{a as D,b as A,d as F}from"./chunk-73EEM3FY.js";import{d as M}from"./chunk-4XOSXARZ.js";import"./chunk-2WH262CW.js";import{a as W}from"./chunk-XADY6SXR.js";import{b,c as L}from"./chunk-YK6UG66R.js";import{a as X,h as _}from"./chunk-IAR3DEWR.js";import{e as g,f as N,g as U,h as $,m as G,q as V,t as B}from"./chunk-EMHZF6ZY.js";import{c as v,d as o,f as l,g as P,h,k as I,o as R,q as O,r as T}from"./chunk-Y6AFIAJP.js";import{a as S,b as w}from"./chunk-2N4GTHXQ.js";import{b as y}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var le=async t=>{let e=R({renderer:T.ansi(),sink:O.stdout()}),i=y.process.cwd(),n=t?.includes("--unattended")??!1,r=j(t,"--max-turns")??10,p=j(t,"--max-iterations")??50;if(!await B(i))return e.writeln(l(`noskills not initialized. Run: ${L("init")}`)),await e.close(),w({exitCode:1});let x=U(t),c=await N(i,x);if(c.phase!=="EXECUTING"&&c.phase!=="SPEC_APPROVED")return e.writeln(l(`Cannot run from phase: ${c.phase}`)),e.writeln(o("Must be in SPEC_APPROVED or EXECUTING to start.")),await e.close(),w({exitCode:1});if(c.phase==="SPEC_APPROVED"){e.writeln(o("Starting execution from approved spec..."));let s=_(c);await $(i,s)}let d=await G(i);if(d===null)return e.writeln(l("Config not found.")),await e.close(),w({exitCode:1});e.writeln(v(`${b()} run`)),e.writeln(o(`Mode: ${n?"unattended":"interactive"}, max-turns: ${r}, max-iterations: ${p}`)),e.writeln("");let m=0,u=0;for(;m<p;){m++;let s=await g(i);if(s.phase==="DONE"){e.writeln(""),e.writeln(P("\u2714")," Spec completed!"),e.writeln(` Iterations: ${s.execution.iteration}`),e.writeln(` Decisions: ${s.decisions.length}`);break}if(s.phase==="BLOCKED"){let a=s.execution.lastProgress??"Unknown";if(e.writeln(""),e.writeln(h("\u26A0")," Execution blocked: ",o(a)),n){await Q(i,a,m),e.writeln(o("Logged to .eser/.state/blocked.log. Resolve and re-run.")),u=1;break}let C=A(),f=await F(C,{message:"Enter resolution (or leave empty to stop):"});if(D(f)||f===""){e.writeln(o("Stopped by user."));break}let k=X(s,"EXECUTING");await $(i,{...k,execution:{...k.execution,lastProgress:`Resolved: ${f}`}});continue}if(s.phase!=="EXECUTING"){e.writeln(l(`Unexpected phase: ${s.phase}. Stopping.`)),u=1;break}let z=(await V(i)).filter(a=>d.concerns.includes(a.id)),q=await W(i),H=M(s,z,q,d),K=J(H);e.writeln(I(`\u2500\u2500 Iteration ${m}`),o(` (execution: ${s.execution.iteration}, debt: ${s.execution.debt?.items.length??0})`)),s.execution.lastProgress!==null&&e.writeln(o(` Last: ${s.execution.lastProgress}`)),s.execution.lastVerification?.passed===!1&&e.writeln(l(" Verification failed \u2014 agent will fix")),s.execution.debt!==null&&e.writeln(h(` Debt: ${s.execution.debt.items.length} items`)),e.writeln(o(" Spawning agent..."));try{await(await import("./mod-KTV64DHD.js")).exec`claude -p ${K} --max-turns ${String(r)} --output-format json`.noThrow().text()}catch{e.writeln(l(" Failed to spawn claude CLI. Is it installed?")),u=1;break}e.writeln(o(" Agent exited. Stop hook captured state."));let E=await g(i);if(d.autoCommit===!0&&d.allowGit!==!1)try{let a=await import("./mod-KTV64DHD.js");if((await a.exec`git diff --name-only`.noThrow().text()).trim().length>0){await a.exec`git add -A`.noThrow().text();let f=`noskills: iteration ${E.execution.iteration} \u2014 ${E.execution.lastProgress??"progress"}`;await a.exec`git commit -m ${f}`.noThrow().text(),e.writeln(o(" Auto-committed."))}}catch{e.writeln(o(" Auto-commit failed (non-fatal)."))}}return m>=p&&(e.writeln(""),e.writeln(h("\u26A0"),` Max iterations (${p}) reached. Stopping.`),u=2),await e.close(),u!==0?w({exitCode:u}):S(void 0)},J=t=>{let e=[];if(e.push(t.meta.resumeHint),e.push(""),t.meta.spec!==null&&(e.push(`Working on spec: ${t.meta.spec}`),e.push("")),"instruction"in t&&(e.push(t.instruction),e.push("")),"previousIterationDebt"in t){let n=t.previousIterationDebt;if(n!==void 0){e.push(`DEBT from iteration ${n.fromIteration} (address first):`);for(let r of n.items)e.push(`- ${r}`);e.push("")}}if("statusReportRequired"in t){let n=t.statusReport;if(n!==void 0){e.push("Report against these acceptance criteria:");for(let r of n.criteria)e.push(`- ${r}`);e.push("")}}if("verificationFailed"in t&&t.verificationFailed===!0&&(e.push("Test output:"),e.push(("verificationOutput"in t?t.verificationOutput:"")??""),e.push("")),t.behavioral.rules.length>0){e.push("Rules:");for(let n of t.behavioral.rules)e.push(`- ${n}`);e.push("")}if("context"in t){let n=t.context;if(n.concernReminders.length>0){e.push("Reminders:");for(let r of n.concernReminders)e.push(`- ${r}`);e.push("")}}let i=b();return e.push(`When done, report progress: ${i} next --answer="your progress"`),e.push(`If blocked, run: ${i} block "reason"`),e.push(`When all tasks are complete: ${i} done`),e.join(`
2
- `)},j=(t,e)=>{if(t===void 0)return null;let i=`${e}=`;for(let n of t)if(n.startsWith(i)){let r=parseInt(n.slice(i.length),10);if(!isNaN(r)&&r>0)return r}return null},Q=async(t,e,i)=>{let n=`${t}/.eser/.state/blocked.log`,r=`[${new Date().toISOString()}] iteration=${i} reason=${e}
3
- `;try{let{appendFileSync:p,mkdirSync:x}=await import("node:fs"),{dirname:c}=await import("node:path");x(c(n),{recursive:!0}),p(n,r)}catch{}};export{le as main};
@@ -1 +0,0 @@
1
- import{a as O,d as z}from"./chunk-TJZAIUKM.js";import{b,c as k}from"./chunk-YK6UG66R.js";import{b as T,k as U}from"./chunk-IAR3DEWR.js";import{d as g,e as E,h as N,i as P,j as A,k as I,l as R,t as L}from"./chunk-EMHZF6ZY.js";import{c as l,d as c,f as m,g as S,h as x,k as C,o as $,q as y,r as D}from"./chunk-Y6AFIAJP.js";import{a as f,b as h}from"./chunk-2N4GTHXQ.js";import{b as u}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var _=async n=>{let e=n?.[0];if(e==="new")return await G(n?.slice(1));if(e==="list")return await B(n?.slice(1));if(e==="switch")return await q(n?.slice(1));let t=b(),r=$({renderer:D.ansi(),sink:y.stdout()});return r.writeln(`Usage: ${t} spec <new "description" | list | switch <name>>`),await r.close(),f(void 0)},G=async n=>{let e=$({renderer:D.ansi(),sink:y.stdout()}),t=u.process.cwd();if(!await L(t))return e.writeln(m("noskills is not initialized.")," Run: ",l(k("init"))),await e.close(),h({exitCode:1});let r=null,i=[];if(n!==void 0)for(let w of n)w.startsWith("--name=")?r=w.slice(7):w.startsWith("-")||i.push(w);let p=i.join(" ");if(p.length===0)return e.writeln(m("Please provide a description: "),l(`${b()} spec new "photo auto-listing"`)),await e.close(),h({exitCode:1});let o=r??W(p),a=await X(t,o),d=`spec/${a}`,s=await E(t);if(s.phase!=="IDLE"&&s.phase!=="DONE")return e.writeln(m(`Cannot start new spec in phase: ${s.phase}`),c(" \u2014 finish or reset the current spec first.")),await e.close(),h({exitCode:1});let v=T(s.phase==="DONE"?U(s):s,a,d);return await u.fs.mkdir(`${t}/${g.specDir(a)}`,{recursive:!0}),await N(t,v),await I(t,a,v),e.writeln(S("\u2714")," Spec started: ",l(a)),e.writeln(" Directory: ",c(g.specDir(a))),e.writeln(" Branch: ",c(d)),e.writeln(" Phase: ",x("DISCOVERY")),e.writeln(""),e.writeln("Run ",l(k("next"))," to begin discovery questions."),await e.close(),f(void 0)},W=n=>n.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,50).replace(/-$/,""),X=async(n,e)=>{let t=`${n}/${g.specsDir}`,r=async i=>{try{return await u.fs.stat(`${t}/${i}`),!0}catch{return!1}};if(!await r(e))return e;for(let i=2;i<=99;i++){let p=`${e}-${i}`;if(!await r(p))return p}return`${e}-${Date.now()}`},B=async n=>{let e=u.process.cwd(),t=O(n),r=await P(e),i=await R(e),p=`${e}/${g.specsDir}`,o=new Set(i.map(s=>s.name)),a=[];for(let s of i)a.push({name:s.name,phase:s.state.phase,iteration:s.state.execution.iteration,active:s.name===r});try{for await(let s of u.fs.readDir(p))s.isDirectory&&!o.has(s.name)&&a.push({name:s.name,phase:"IDLE",iteration:0,active:s.name===r})}catch{}if(t==="json")return await z(a,"json"),f(void 0);let d=$({renderer:D.ansi(),sink:y.stdout()});if(d.writeln(l("Specs")),d.writeln(""),a.length===0)d.writeln(c(" No specs yet."));else for(let s of a){let v=s.active?S("\u25CF"):c("\u25CB"),w=s.active?l(s.name):c(s.name),j=s.phase==="DONE"?S(s.phase):s.phase==="EXECUTING"?C(s.phase):s.phase==="BLOCKED"?m(s.phase):x(s.phase),F=s.phase==="EXECUTING"?c(` iteration ${s.iteration}`):"";d.writeln(" ",v," ",w," ",j,F)}return await d.close(),f(void 0)},q=async n=>{let e=$({renderer:D.ansi(),sink:y.stdout()}),t=u.process.cwd(),r=n?.[0];if(r===void 0||r.length===0)return e.writeln(m("Please provide a spec name: "),l(`${b()} spec switch my-feature`)),await e.close(),h({exitCode:1});let i=await P(t),p=await E(t);i!==null&&p.spec!==null&&await I(t,i,p);let o=await A(t,r),a=await u.fs.stat(`${t}/${g.specDir(r)}`).then(()=>!0).catch(()=>!1);return o.phase==="IDLE"&&!a?(e.writeln(m(`Spec "${r}" not found.`)),e.writeln(c(`Run \`${k("spec list")}\` to see available specs.`)),await e.close(),h({exitCode:1})):(await N(t,o),e.writeln(S("\u2714")," Switched to: ",l(r)," (",C(o.phase),")"),o.phase==="EXECUTING"&&(e.writeln(c(` Iteration: ${o.execution.iteration}`)),o.execution.lastProgress!==null&&e.writeln(c(` Progress: ${o.execution.lastProgress}`))),await e.close(),f(void 0))};export{_ as main};
@@ -1 +0,0 @@
1
- import{a as f,d as S}from"./chunk-4XOSXARZ.js";import"./chunk-2WH262CW.js";import{a as k}from"./chunk-XADY6SXR.js";import{a as v,d as w}from"./chunk-TJZAIUKM.js";import{c as h}from"./chunk-YK6UG66R.js";import{f as y,g as I,m as D,q as O,t as R}from"./chunk-EMHZF6ZY.js";import{c as i,d as r,f as c,g as b,h as p,k as x,o as d,q as m,r as u}from"./chunk-Y6AFIAJP.js";import{a as l,b as E}from"./chunk-2N4GTHXQ.js";import{b as C}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var L=async g=>{let n=C.process.cwd(),o=v(g);if(!await R(n)){if(o==="json")await w({error:"noskills is not initialized"},o);else{let s=d({renderer:u.ansi(),sink:m.stdout()});s.writeln(c("noskills is not initialized.")," Run: ",i(h("init"))),await s.close()}return E({exitCode:1})}let P=I(g),e=await y(n,P),t=await D(n),V={phase:e.phase,spec:e.spec,branch:e.branch,discovery:e.phase==="DISCOVERY"||e.phase==="DISCOVERY_REVIEW"?{answered:e.discovery.answers.length,total:f.length}:void 0,execution:e.phase==="EXECUTING"||e.phase==="BLOCKED"?{iteration:e.execution.iteration,lastProgress:e.execution.lastProgress,debt:e.execution.debt?.items.length??0,verificationPassed:e.execution.lastVerification?.passed??null}:void 0,concerns:t?.concerns??[],tools:t?.tools??[],decisions:e.decisions.length};if(o==="json"){let a=(await O(n)).filter(F=>t!==null&&t.concerns.includes(F.id)),$=await k(n),j=S(e,a,$,t);return await w({...V,...j},"json"),l(void 0)}{let s=d({renderer:u.ansi(),sink:m.stdout()});s.writeln(i(`${h("status")}`)),s.writeln("");let a=e.phase==="DONE"?b(e.phase):e.phase==="BLOCKED"?c(e.phase):e.phase==="EXECUTING"?x(e.phase):p(e.phase);s.writeln(" Phase: ",a),e.spec!==null&&s.writeln(" Spec: ",i(e.spec)),e.branch!==null&&s.writeln(" Branch: ",e.branch),(e.phase==="DISCOVERY"||e.phase==="DISCOVERY_REVIEW")&&s.writeln(` Discovery: ${e.discovery.answers.length}/${f.length} questions answered`),e.phase==="EXECUTING"&&(s.writeln(` Iteration: ${e.execution.iteration}`),e.execution.lastProgress!==null&&s.writeln(" Progress: ",r(e.execution.lastProgress)),e.execution.debt!==null&&s.writeln(p(` Debt: ${e.execution.debt.items.length} items`))),t!==null&&(s.writeln(""),t.concerns.length>0&&s.writeln(" Concerns: ",r(t.concerns.join(", "))),t.tools.length>0&&s.writeln(" Tools: ",r(t.tools.join(", ")))),e.decisions.length>0&&(s.writeln(""),s.writeln(` Decisions: ${e.decisions.length}`)),await s.close()}return l(void 0)};export{L as main};
@@ -1,8 +0,0 @@
1
- import{a as C,c as E}from"./chunk-TJZAIUKM.js";import{a as M,c as S}from"./chunk-VPXOI7CR.js";import{e as T,m as y,t as b}from"./chunk-EMHZF6ZY.js";import{a as x,b as k}from"./chunk-2N4GTHXQ.js";import{b as m}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var D=async e=>{let s=await T(e),l=await y(e),d=await I(e),o=null,h=null,a=0,c=0;if(s.spec!==null){let i=await M(e,s.spec);if(i!==null){a=i.tasks.length,c=s.execution.completedTasks.length;let n=S(i.tasks,s.execution.completedTasks);n!==null&&(o=n.id,h=n.title)}}let $=null;return s.lastCalledAt!==null&&($=Math.floor((Date.now()-new Date(s.lastCalledAt).getTime())/1e3)),{spec:s.spec,phase:s.phase,iteration:s.execution.iteration,activeTaskId:o,activeTaskTitle:h,totalTasks:a,completedTaskCount:c,lastProgress:s.execution.lastProgress,lastCalledAt:s.lastCalledAt,modifiedFiles:s.execution.modifiedFiles,debt:s.execution.debt,concerns:l?.concerns??[],maxIterations:l?.maxIterationsBeforeRestart??15,awaitingStatusReport:s.execution.awaitingStatusReport,verificationPassed:s.execution.lastVerification?.passed??null,decisionsCount:s.decisions.length,discoveryAnswered:s.discovery.answers.length,discoveryTotal:6,trackedFiles:d,timeSinceUpdate:$}},I=async e=>{let s=`${e}/.eser/.state/files-changed.jsonl`;try{let d=(await m.fs.readTextFile(s)).trim().split(`
2
- `).filter(Boolean),o=[];for(let h of d)try{let a=JSON.parse(h);o.includes(a.file)||o.push(a.file)}catch{}return o}catch{return[]}},L="\x1B[2J\x1B[H",F="\x1B[1m",r="\x1B[2m",t="\x1B[0m",p="\x1B[32m",f="\x1B[33m",w="\x1B[31m",P="\x1B[36m",O=e=>{switch(e){case"DONE":return p;case"BLOCKED":return w;case"EXECUTING":return P;default:return f}},R=(e,s,l)=>{if(s===0)return"\u2591".repeat(l);let d=Math.min(e/s,1),o=Math.round(d*l);return"\u2588".repeat(o)+"\u2591".repeat(l-o)},v=e=>e===null?"never":e<60?`${e}s ago`:e<3600?`${Math.floor(e/60)}m ago`:`${Math.floor(e/3600)}h ago`,A=e=>{let s=[],d="\u2500".repeat(52);s.push(`${r}\u256D${d}\u256E${t}`),s.push(`${r}\u2502${t} ${F}noskills watch${t} \u2014 ${e.spec??"no active spec"}${r}${" ".repeat(Math.max(0,34-(e.spec?.length??15)))}\u2502${t}`);let o=O(e.phase);if(s.push(`${r}\u2502${t} Phase: ${o}${e.phase}${t}${" ".repeat(Math.max(0,42-e.phase.length))}${r}\u2502${t}`),e.phase==="DISCOVERY"||e.phase==="DISCOVERY_REVIEW")s.push(`${r}\u2502${t} Discovery: ${e.discoveryAnswered}/${e.discoveryTotal} questions answered${" ".repeat(Math.max(0,14))}${r}\u2502${t}`);else if(e.phase==="SPEC_DRAFT")s.push(`${r}\u2502${t} ${f}Awaiting approval${t}${" ".repeat(Math.max(0,33))}${r}\u2502${t}`);else if(e.phase==="EXECUTING"||e.phase==="BLOCKED"){let a=R(e.completedTaskCount,e.totalTasks,12),c=e.totalTasks>0?Math.round(e.completedTaskCount/e.totalTasks*100):0,$=`${a} ${e.completedTaskCount}/${e.totalTasks} tasks (${c}%)`;if(s.push(`${r}\u2502${t} Progress: ${p}${$}${t}${" ".repeat(Math.max(0,40-$.length))}${r}\u2502${t}`),s.push(`${r}\u2502${t} Iteration: ${e.iteration}${" ".repeat(Math.max(0,38-String(e.iteration).length))}${r}\u2502${t}`),e.activeTaskId!==null){let n=`${e.activeTaskId}${e.activeTaskTitle!==null?` (${e.activeTaskTitle})`:""}`.slice(0,36);s.push(`${r}\u2502${t} Active task: ${P}${n}${t}${" ".repeat(Math.max(0,36-n.length))}${r}\u2502${t}`)}if(e.phase==="BLOCKED"){let i=(e.lastProgress??"unknown").replace(/^BLOCKED:\s*/,"");s.push(`${r}\u2502${t} ${w}BLOCKED: ${i.slice(0,40)}${t}${" ".repeat(Math.max(0,40-i.slice(0,40).length))}${r}\u2502${t}`),s.push(`${r}\u2502${t} ${f}Human input needed${t}${" ".repeat(Math.max(0,32))}${r}\u2502${t}`)}}else e.phase==="DONE"&&s.push(`${r}\u2502${t} ${p}Complete!${t} ${e.iteration} iterations, ${e.decisionsCount} decisions${" ".repeat(Math.max(0,17-String(e.iteration).length-String(e.decisionsCount).length))}${r}\u2502${t}`);if(s.push(`${r}\u2502${"".padEnd(52)}\u2502${t}`),s.push(`${r}\u2502${t} Last update: ${v(e.timeSinceUpdate)}${" ".repeat(Math.max(0,36-v(e.timeSinceUpdate).length))}${r}\u2502${t}`),e.lastProgress!==null){let a=e.lastProgress.slice(0,48);s.push(`${r}\u2502${t} ${r}${a}${t}${" ".repeat(Math.max(0,50-a.length))}${r}\u2502${t}`)}if(e.awaitingStatusReport&&s.push(`${r}\u2502${t} ${f}Status report pending${t}${" ".repeat(Math.max(0,29))}${r}\u2502${t}`),e.verificationPassed===!1&&s.push(`${r}\u2502${t} ${w}Verification failed${t}${" ".repeat(Math.max(0,31))}${r}\u2502${t}`),s.push(`${r}\u2502${"".padEnd(52)}\u2502${t}`),e.debt!==null&&e.debt.items.length>0){s.push(`${r}\u2502${t} Debt: ${e.debt.items.length} item(s)${" ".repeat(Math.max(0,34))}${r}\u2502${t}`);for(let a of e.debt.items.slice(0,3)){let c=a.text.slice(0,44);s.push(`${r}\u2502${t} \u2514\u2500 ${c}${" ".repeat(Math.max(0,46-c.length))}${r}\u2502${t}`)}e.debt.items.length>3&&s.push(`${r}\u2502${t} \u2514\u2500 ... and ${e.debt.items.length-3} more${" ".repeat(Math.max(0,32))}${r}\u2502${t}`)}if(e.trackedFiles.length>0||e.modifiedFiles.length>0){let a=e.trackedFiles.length>0?e.trackedFiles:e.modifiedFiles;s.push(`${r}\u2502${t} Files changed: ${a.length}${" ".repeat(Math.max(0,34-String(a.length).length))}${r}\u2502${t}`);for(let c of a.slice(0,5)){let $=c.length>44?"..."+c.slice(-41):c;s.push(`${r}\u2502${t} \u2514\u2500 ${$}${" ".repeat(Math.max(0,46-$.length))}${r}\u2502${t}`)}a.length>5&&s.push(`${r}\u2502${t} \u2514\u2500 ... and ${a.length-5} more${" ".repeat(Math.max(0,32))}${r}\u2502${t}`)}if(s.push(`${r}\u2502${"".padEnd(52)}\u2502${t}`),e.concerns.length>0){let a=e.concerns.join(", ").slice(0,38);s.push(`${r}\u2502${t} Concerns: ${a}${" ".repeat(Math.max(0,40-a.length))}${r}\u2502${t}`)}let h=e.iteration>=e.maxIterations?`${w}RESTART RECOMMENDED${t}`:`${p}ok${t} (${e.iteration}/${e.maxIterations})`;return s.push(`${r}\u2502${t} Context: ${h}${" ".repeat(Math.max(0,41-h.replace(/\x1b\[[0-9;]*m/g,"").length))}${r}\u2502${t}`),s.push(`${r}\u2570${d}\u256F${t}`),s.push(` ${r}watching .eser/.state/ for changes... (ctrl+c to stop)${t}`),s.join(`
3
- `)},W=e=>JSON.stringify({ts:new Date().toISOString(),phase:e.phase,spec:e.spec,iteration:e.iteration,activeTask:e.activeTaskId,tasks:{completed:e.completedTaskCount,total:e.totalTasks},progress:e.lastProgress,debt:e.debt?.items.length??0,filesChanged:e.trackedFiles.length>0?e.trackedFiles:e.modifiedFiles,timeSinceUpdate:e.timeSinceUpdate,verificationPassed:e.verificationPassed}),V=async e=>{let s=m.process.cwd(),l=C(e);if(!await b(s)){let i=new TextEncoder,n=m.process.stdout.getWriter();return await n.write(i.encode(`noskills not initialized.
4
- `)),n.releaseLock(),k({exitCode:1})}let d=`${s}/.eser/.state`,o="",h=async()=>{let i=await D(s),n=l==="json"?W(i):l==="markdown"?E(i,"markdown"):A(i);if(l==="json"){let g=new TextEncoder,u=m.process.stdout.getWriter();await u.write(g.encode(n+`
5
- `)),u.releaseLock()}else if(l==="markdown"){let g=new TextEncoder,u=m.process.stdout.getWriter();await u.write(g.encode(n+`
6
- ---
7
- `)),u.releaseLock()}else if(n!==o){let g=new TextEncoder,u=m.process.stdout.getWriter();await u.write(g.encode(L+n+`
8
- `)),u.releaseLock(),o=n}return i.phase==="DONE"};if(await h())return x(void 0);let c=1e3,$=0;for(;;){await new Promise(i=>setTimeout(i,c));try{let n=(await m.fs.stat(`${d}/state.json`)).mtime?.getTime()??0;if(n>$&&($=n,await new Promise(u=>setTimeout(u,100)),await h()))break}catch{}}return x(void 0)};export{D as buildSnapshot,V as main,W as renderJsonLine,A as renderTerminal};