noskills 4.1.42 → 4.1.43

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 (34) hide show
  1. package/README.md +44 -16
  2. package/chunks/{approve-CC43I73M.js → approve-NPG6X7O6.js} +1 -1
  3. package/chunks/{block-5KC7PUH6.js → block-LSEXCK45.js} +1 -1
  4. package/chunks/{cancel-EQVD54M2.js → cancel-7NGO246Z.js} +1 -1
  5. package/chunks/chunk-MRZT23BL.js +1 -0
  6. package/chunks/chunk-TMC5H2A5.js +1 -0
  7. package/chunks/chunk-YYCDBPWA.js +16 -0
  8. package/chunks/chunk-ZMVD5IU4.js +109 -0
  9. package/chunks/{concern-FBYT4WPA.js → concern-3K3QUYG4.js} +1 -1
  10. package/chunks/done-OMGLEA32.js +1 -0
  11. package/chunks/free-BO5UA5V2.js +1 -0
  12. package/chunks/init-UQLVVP2M.js +1 -0
  13. package/chunks/invoke-hook-THWB24OS.js +10 -0
  14. package/chunks/next-4IJJBQBE.js +8 -0
  15. package/chunks/{reopen-TND2EX3W.js → reopen-EKSLLO54.js} +1 -1
  16. package/chunks/{reset-XSYKZNUI.js → reset-WRTVX7TT.js} +1 -1
  17. package/chunks/{rule-ZM34AO4G.js → rule-QP5BSH27.js} +1 -1
  18. package/chunks/run-ROKOTYPH.js +3 -0
  19. package/chunks/{spec-CTUSUGWH.js → spec-ZLE74TVR.js} +1 -1
  20. package/chunks/{status-4D5HFW4V.js → status-S2X4ADGF.js} +1 -1
  21. package/chunks/{sync-DQYR4ZLK.js → sync-VS4HROEX.js} +1 -1
  22. package/chunks/{watch-CAD4JSTU.js → watch-4HJMGNF4.js} +6 -6
  23. package/chunks/{wontfix-6KJQNEEV.js → wontfix-CDPG2GUG.js} +1 -1
  24. package/noskills.js +1 -1
  25. package/package.json +1 -1
  26. package/chunks/chunk-2WH262CW.js +0 -1
  27. package/chunks/chunk-6AAKOXIS.js +0 -81
  28. package/chunks/chunk-ERUA3YBQ.js +0 -1
  29. package/chunks/chunk-XANYQUGJ.js +0 -16
  30. package/chunks/done-UNXXLE3Y.js +0 -1
  31. package/chunks/init-IFI75I3F.js +0 -1
  32. package/chunks/invoke-hook-227DMMXJ.js +0 -10
  33. package/chunks/next-6UT77PDL.js +0 -8
  34. package/chunks/run-UVYXW33C.js +0 -3
@@ -1,8 +0,0 @@
1
- import{b as te}from"./chunk-VK7L5SMS.js";import{a as Y,b as z,c as K,d as V}from"./chunk-XANYQUGJ.js";import"./chunk-2WH262CW.js";import{a as j,b as M}from"./chunk-6AAKOXIS.js";import{a as Z,b as ee,d as v}from"./chunk-TJZAIUKM.js";import{a as ce}from"./chunk-SNHYXBHM.js";import{a as le,b as de,c as ue,d as pe}from"./chunk-3SLKOP72.js";import{a as A}from"./chunk-VPXOI7CR.js";import{c as $}from"./chunk-YK6UG66R.js";import{a as se,c as T,d as ne,e as ie,f as re,h as oe,j as ae}from"./chunk-ERUA3YBQ.js";import{d as E,f as J,h as Q,k as _,l as G,p as B,r as P,s as X}from"./chunk-LWCWPXCS.js";import{a as q,b as x}from"./chunk-2N4GTHXQ.js";import{b as h}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var ge=a=>a.split(`
2
- `).map(e=>e.replace(/^[-*]\s+/,"").trim()).filter(e=>e.length>0&&!e.startsWith("#")),he=async(a,e)=>{let o=[],i=(e.startsWith(a)?e.slice(a.length+1):e).split("/");i.pop();for(let t=i.length;t>=0;t--){let s=`${t===0?a:`${a}/${i.slice(0,t).join("/")}`}/.folder-rules.md`,n=t===0?".":i.slice(0,t).join("/");try{let u=await h.fs.readTextFile(s),m=ge(u);for(let p of m)o.push({folder:n,rule:p})}catch{}}return o},W=async(a,e)=>{let o=new Set,c=[];for(let i of e){let t=await he(a,i);for(let r of t){let s=`${r.folder}::${r.rule}`;o.has(s)||(o.add(s),c.push(r))}}return c};var Ne=async a=>{let e=h.process.cwd(),o=Z(a),c=ee(a);if(!await X(e))return await v({error:`noskills not initialized. Run: ${$("init")}`},o),x({exitCode:1});let i=null;for(let d of c)d.startsWith("--answer=")&&(i=d.slice(9));let t=Q(c);if(!t.ok)return await v({error:t.error},o),x({exitCode:1});let r=t.spec,s;try{s=await J(e,r)}catch(d){let l=d instanceof Error?d.message:String(d);return await v({error:l},o),x({exitCode:1})}let n=await G(e);if(n?.command!==void 0){let{setCommandPrefix:d}=await import("./cmd-RST2ZPA6.js");d(n.command)}if(n===null)return await v({error:"No config found"},o),x({exitCode:1});if(s.spec!==null&&s.phase!=="IDLE"&&s.phase!=="COMPLETED"){let d=`${e}/${E.specDir(s.spec)}`;try{await h.fs.stat(d)}catch{return await v({error:!0,message:`Active spec '${s.spec}' directory not found. Files may have been deleted manually.`,suggestion:`Run \`${$("reset")}\` to return to IDLE, or \`${$("cancel")}\` to mark as cancelled.`},o),x({exitCode:1})}}let u=te(c,n);s.phase==="DISCOVERY"&&s.discovery.audience!==u&&(s={...s,discovery:{...s.discovery,audience:u}});let p=(await B(e)).filter(d=>n.concerns.includes(d.id));if(i!==null){let d=await Se(e,s,n,p,i);await P(e,d);let l={...d,lastCalledAt:new Date().toISOString()};await P(e,l);let b=await j(e),L=l.spec!==null?await A(e,l.spec):null,F=await me(e,l),k=await W(e,F),g=M(n?.tools??[]),w=V(l,p,b,n,L,k,void 0,g);return await v(w,o),q(void 0)}let f={...s,lastCalledAt:new Date().toISOString()};await P(e,f);let y=await j(e),D=f.spec!==null?await A(e,f.spec):null,R=await me(e,f),O=await W(e,R),I;f.phase==="IDLE"&&(I={existingSpecs:(await _(e)).map(l=>({name:l.name,phase:l.state.phase,iteration:l.state.execution.iteration,detail:l.state.phase==="EXECUTING"?`${l.state.execution.completedTasks.length} tasks done, iteration ${l.state.execution.iteration}`:l.state.phase==="SPEC_DRAFT"?"awaiting approval":l.state.phase==="COMPLETED"?"completed":void 0})),rulesCount:y.length});let H=M(n?.tools??[]),C=V(f,p,y,n,D,O,I,H);return await v(C,o),q(void 0)},Se=async(a,e,o,c,i)=>{switch(e.phase){case"DISCOVERY":{let t=e.discovery.audience==="agent",r=null;try{let n=JSON.parse(i);typeof n=="object"&&n!==null&&!Array.isArray(n)&&(t?Y.map(p=>p.id).every(p=>p in n)&&(r=n):r=n)}catch{}let s=e;if(r!==null)for(let[n,u]of Object.entries(r))typeof u=="string"&&u.length>0&&(s=T(s,n,u));else{let n=z(c),u=s.discovery.currentQuestion,m=n[u];if(m===void 0)return e;s=T(s,m.id,i),s=re(s)}return K(s.discovery.answers)&&(s=ne(s)),s}case"DISCOVERY_REVIEW":{if(i.trim().toLowerCase()==="approve")return ie(e);try{let t=JSON.parse(i);if(typeof t.revise=="object"&&t.revise!==null){let r=e;for(let[s,n]of Object.entries(t.revise))typeof n=="string"&&n.length>0&&(r=T(r,s,n));return r}}catch{}return e}case"SPEC_DRAFT":{if(e.classification===null){let t,r=i.trim().toLowerCase();if(r==="none"||r==="skip")t={involvesWebUI:!1,involvesCLI:!1,involvesPublicAPI:!1,involvesMigration:!1,involvesDataHandling:!1};else try{let n=JSON.parse(i);t={involvesWebUI:n.involvesWebUI===!0||n.involvesUI===!0,involvesCLI:n.involvesCLI===!0||n.involvesUI===!0,involvesPublicAPI:n.involvesPublicAPI===!0,involvesMigration:n.involvesMigration===!0,involvesDataHandling:n.involvesDataHandling===!0}}catch{t={involvesWebUI:!1,involvesCLI:!1,involvesPublicAPI:!1,involvesMigration:!1,involvesDataHandling:!1}}let s={...e,classification:t};try{await ce(a,s,c)}catch{}return s}try{let t=JSON.parse(i);if(typeof t.refinement=="string"&&t.refinement.length>0){let r=t.refinement;if(e.spec!==null){let s=`${a}/${E.specFile(e.spec)}`,n=await h.fs.readTextFile(s);if(r.includes("task-")){let m=ve(r).map(y=>`- [ ] ${y}`).join(`
3
- `),p=/## Tasks\n\n([\s\S]*?)(?=\n## |\n*$)/,f=n.replace(p,`## Tasks
4
-
5
- ${m}
6
- `);await h.fs.writeTextFile(s,f)}}return e}}catch{}return e}case"SPEC_APPROVED":{let t=oe(e);return t.spec!==null&&(await le(a,t.spec,"executing"),await pe(a,t.spec,"executing")),t}case"EXECUTING":{if(!e.execution.awaitingStatusReport){let t={...e,execution:{...e.execution,lastProgress:i}};if(o.verifyCommand!==null&&o.verifyCommand!==void 0&&o.verifyCommand.length>0){let r=await xe(a,o.verifyCommand);if(t={...t,execution:{...t.execution,lastVerification:r}},!r.passed)return t}return t={...t,execution:{...t.execution,awaitingStatusReport:!0}},t}return await ye(a,e,i,c)}case"BLOCKED":{let t=e.execution.lastProgress??"Unknown",r={id:`d${e.decisions.length+1}`,question:t.replace(/^BLOCKED:\s*/,""),choice:i,promoted:!1,timestamp:new Date().toISOString()},s=ae(e,r);return s=se(s,"EXECUTING"),s={...s,execution:{...s.execution,lastProgress:`Resolved: ${i}`}},s}default:return e}},ve=a=>a.split(/(?=task-\d+:)/).map(e=>e.replace(/[,;\n\s]+$/,"").trim()).filter(e=>/^task-\d+:/.test(e)),ye=async(a,e,o,c)=>{let i;try{i=JSON.parse(o)}catch{return{...e,execution:{...e.execution,lastProgress:o,awaitingStatusReport:!1}}}let t=e;if(e.execution.debt!==null&&e.execution.debt.items.length>0&&typeof e.execution.debt.items[0]=="string"){let w=e.execution.debt.items.map((N,fe)=>({id:`legacy-${fe+1}`,text:N,since:e.execution.debt.fromIteration}));t={...e,execution:{...e.execution,debt:{...e.execution.debt,items:w}}};let U=new TextEncoder,S=h.process.stderr.getWriter();await S.write(U.encode(`noskills: migrated legacy string[] debt to DebtItem[] format
7
- `)),S.releaseLock()}let r=i.completed??[],s=new Set(r),n=i.na??[],u=new Set(n),m=i.newIssues??[],p=i.remaining??[],f=i.blocked??[],y=t.execution.debt?.unaddressedIterations??0,D=t.execution.debt!==null?t.execution.debt.items.filter(g=>!s.has(g.id)&&!u.has(g.id)):[],R=t.execution.debtCounter??0,O=m.map((g,w)=>({id:`debt-${R+w+1}`,text:g,since:t.execution.iteration})),I=[...D,...O],C=p.length===0&&f.length===0&&m.length===0||I.length===0?null:{items:I,fromIteration:t.execution.debt?.fromIteration??t.execution.iteration,unaddressedIterations:D.length>0?y+1:1},d=[...new Set([...t.execution.naItems??[],...n])],l=[];r.length>0&&l.push(`Completed: ${r.join(", ")}`),n.length>0&&l.push(`N/A: ${n.join(", ")}`);let b=l.length>0?l.join("; "):"Status report submitted",L=t.execution.lastVerification===null||t.execution.lastVerification.passed===!0,F=C===null&&L,k=R+m.length;if(F&&t.spec!==null){let g=await A(a,t.spec);if(g!==null){let w=t.execution.completedTasks??[],U=new Set(w),S=g.tasks.find(N=>!U.has(N.id));if(S!==void 0)return await de(a,t.spec,S.id),await ue(a,t.spec,S.id,"done"),{...t,execution:{...t.execution,lastProgress:`Task ${S.id} accepted: ${b}`,awaitingStatusReport:!1,debt:C,completedTasks:[...w,S.id],debtCounter:k,naItems:d}}}}return{...t,execution:{...t.execution,lastProgress:F?b:`Task not accepted \u2014 remaining items must be addressed first. ${b}`,awaitingStatusReport:!1,debt:C,debtCounter:k,naItems:d}}},xe=async(a,e)=>{try{let{execSync:o}=await import("node:child_process"),c=o(e,{cwd:a,encoding:"utf-8",timeout:6e4,stdio:["pipe","pipe","pipe"]});return{passed:!0,output:String(c).slice(0,4e3),timestamp:new Date().toISOString()}}catch(o){let c=o,i=((c.stdout??"")+(c.stderr??"")).slice(0,4e3);return c.status!==void 0?{passed:!1,output:i||"Verification failed with no output",timestamp:new Date().toISOString()}:{passed:!1,output:`Verification command failed to execute: ${o instanceof Error?o.message:String(o)}`,timestamp:new Date().toISOString()}}},me=async(a,e)=>{let o=[...e.execution.modifiedFiles??[]],c=await Ie(a);return[...new Set([...o,...c])]},Ie=async a=>{let e=`${a}/${E.stateDir}/files-changed.jsonl`;try{let c=(await h.fs.readTextFile(e)).trim().split(`
8
- `).filter(Boolean),i=[];for(let t of c)try{let r=JSON.parse(t);i.includes(r.file)||i.push(r.file)}catch{}return i}catch{return[]}};export{Se as handleAnswer,Ne as main,ve as parseRefinementTasks};
@@ -1,3 +0,0 @@
1
- import{a as D,b as A,d as F}from"./chunk-73EEM3FY.js";import{d as B}from"./chunk-XANYQUGJ.js";import"./chunk-2WH262CW.js";import{a as W,b as X}from"./chunk-6AAKOXIS.js";import{b as E,c as V}from"./chunk-YK6UG66R.js";import{a as _,h as j}from"./chunk-ERUA3YBQ.js";import{e as g,f as N,g as U,i as $,l as G,p as L,s as M}from"./chunk-LWCWPXCS.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 ue=async t=>{let e=R({renderer:T.ansi(),sink:O.stdout()}),i=y.process.cwd(),n=t?.includes("--unattended")??!1,r=z(t,"--max-turns")??10,p=z(t,"--max-iterations")??50;if(!await M(i))return e.writeln(l(`noskills not initialized. Run: ${V("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=j(c);await $(i,s)}let u=await G(i);if(u===null)return e.writeln(l("Config not found.")),await e.close(),w({exitCode:1});e.writeln(v(`${E()} run`)),e.writeln(o(`Mode: ${n?"unattended":"interactive"}, max-turns: ${r}, max-iterations: ${p}`)),e.writeln("");let m=0,d=0;for(;m<p;){m++;let s=await g(i);if(s.phase==="COMPLETED"){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 Z(i,a,m),e.writeln(o("Logged to .eser/.state/blocked.log. Resolve and re-run.")),d=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=_(s,"EXECUTING");await $(i,{...k,execution:{...k.execution,lastProgress:`Resolved: ${f}`}});continue}if(s.phase!=="EXECUTING"){e.writeln(l(`Unexpected phase: ${s.phase}. Stopping.`)),d=1;break}let H=(await L(i)).filter(a=>u.concerns.includes(a.id)),q=await W(i),K=X(u.tools),J=B(s,H,q,u,void 0,void 0,void 0,K),Q=Y(J);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 ${Q} --max-turns ${String(r)} --output-format json`.noThrow().text()}catch{e.writeln(l(" Failed to spawn claude CLI. Is it installed?")),d=1;break}e.writeln(o(" Agent exited. Stop hook captured state."));let b=await g(i);if(u.autoCommit===!0&&u.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 ${b.execution.iteration} \u2014 ${b.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.`),d=2),await e.close(),d!==0?w({exitCode:d}):S(void 0)},Y=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=E();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
- `)},z=(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},Z=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{ue as main};