noskills 4.1.44 → 4.1.48

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 (70) hide show
  1. package/README.md +74 -22
  2. package/chunks/{approve-NPG6X7O6.js → approve-JDCG5RTO.js} +1 -1
  3. package/chunks/{ask-F4XM2EEC.js → ask-KPIHJIJZ.js} +1 -1
  4. package/chunks/{block-LSEXCK45.js → block-WDK4VFDU.js} +1 -1
  5. package/chunks/{browser-AXSE2CPY.js → browser-XLYVEO2J.js} +1 -1
  6. package/chunks/{bun-LARHC47N.js → bun-5VMFSLLY.js} +1 -1
  7. package/chunks/{cancel-BK6GCIIY.js → cancel-RNUAFYI2.js} +1 -1
  8. package/chunks/{chunk-YK6UG66R.js → chunk-2X2U2VC5.js} +1 -1
  9. package/chunks/{chunk-ZMVD5IU4.js → chunk-4DHIEOZS.js} +28 -27
  10. package/chunks/{chunk-G5OCHQQ2.js → chunk-65A35QPF.js} +1 -1
  11. package/chunks/{chunk-DHMCIRLT.js → chunk-CKETVOVQ.js} +1 -1
  12. package/chunks/{chunk-ALZM4JXG.js → chunk-CLCZ7IO3.js} +2 -2
  13. package/chunks/{chunk-TJZAIUKM.js → chunk-JCIANZPY.js} +1 -1
  14. package/chunks/chunk-JI5AH4G4.js +3 -0
  15. package/chunks/{chunk-Y6AFIAJP.js → chunk-K223KAUB.js} +1 -1
  16. package/chunks/{chunk-VK7L5SMS.js → chunk-MSJSMJL2.js} +1 -1
  17. package/chunks/{chunk-7QFOEK3I.js → chunk-NRCHLNQA.js} +1 -1
  18. package/chunks/chunk-ON7NJA2P.js +3 -0
  19. package/chunks/{chunk-LWCWPXCS.js → chunk-PL7WF7NC.js} +86 -83
  20. package/chunks/{chunk-MNEZ5QGX.js → chunk-RMCTOOQL.js} +1 -1
  21. package/chunks/{chunk-VPXOI7CR.js → chunk-RTD42HPS.js} +1 -1
  22. package/chunks/{chunk-ERX4HONR.js → chunk-U3JLX6DY.js} +1 -1
  23. package/chunks/chunk-VHP7GMUP.js +1 -0
  24. package/chunks/chunk-WFOXOZWW.js +16 -0
  25. package/chunks/{chunk-3SLKOP72.js → chunk-XQJ6LR2O.js} +1 -1
  26. package/chunks/{chunk-4BH6CF3J.js → chunk-YSLRAWBK.js} +1 -1
  27. package/chunks/chunk-ZAOVTFWH.js +1 -0
  28. package/chunks/{claude-code-K3SX5D5F.js → claude-code-R7PCCNRZ.js} +1 -1
  29. package/chunks/cmd-NWSNAUKC.js +1 -0
  30. package/chunks/{concern-3K3QUYG4.js → concern-BFL64SWF.js} +1 -1
  31. package/chunks/{deno-WQJZSBAW.js → deno-QOH6TCLQ.js} +1 -1
  32. package/chunks/{done-OMGLEA32.js → done-ABJB7WCJ.js} +1 -1
  33. package/chunks/{free-BO5UA5V2.js → free-K7J7X57R.js} +1 -1
  34. package/chunks/{init-M4MSHCVJ.js → init-4ULYNWEU.js} +1 -1
  35. package/chunks/invoke-hook-F5SNDW2N.js +11 -0
  36. package/chunks/{kiro-T5X4D4SC.js → kiro-3VFHKARM.js} +1 -1
  37. package/chunks/{list-3RK7TPGG.js → list-FWRKOILC.js} +1 -1
  38. package/chunks/manager-J5QJQK4T.js +6 -0
  39. package/chunks/mod-LORCBZWH.js +1 -0
  40. package/chunks/next-KPZN56DW.js +8 -0
  41. package/chunks/{node-JJN2TSIE.js → node-BPWE6I45.js} +1 -1
  42. package/chunks/{ollama-CNKKUTPX.js → ollama-VSBCL6RB.js} +1 -1
  43. package/chunks/{opencode-MJO3K6T4.js → opencode-YE3RKOY7.js} +1 -1
  44. package/chunks/pack-QZSOS3EC.js +5 -0
  45. package/chunks/{purge-MDSEQLDQ.js → purge-AJ3FYIZU.js} +1 -1
  46. package/chunks/{reopen-EKSLLO54.js → reopen-XQ6QSX33.js} +1 -1
  47. package/chunks/{reset-WRTVX7TT.js → reset-B7JO5N4M.js} +1 -1
  48. package/chunks/rule-SSF5KGII.js +6 -0
  49. package/chunks/run-NCUAJFRJ.js +3 -0
  50. package/chunks/session-TJJDZ3VF.js +1 -0
  51. package/chunks/spec-BYCG4S2R.js +1 -0
  52. package/chunks/{status-63TFVF7Y.js → status-FJCCVQQU.js} +1 -1
  53. package/chunks/{sync-VS4HROEX.js → sync-EDTFSXLO.js} +1 -1
  54. package/chunks/{watch-4HJMGNF4.js → watch-HFPGREOU.js} +1 -1
  55. package/chunks/{wontfix-BOT7HHH2.js → wontfix-342QFPKY.js} +1 -1
  56. package/chunks/{workerd-VA2BYLUO.js → workerd-IIQRIOBX.js} +1 -1
  57. package/noskills.js +1 -1
  58. package/package.json +1 -1
  59. package/chunks/chunk-73EEM3FY.js +0 -1
  60. package/chunks/chunk-7GUYMD3Z.js +0 -16
  61. package/chunks/chunk-BBKSV2RO.js +0 -3
  62. package/chunks/chunk-SNHYXBHM.js +0 -3
  63. package/chunks/chunk-TMC5H2A5.js +0 -1
  64. package/chunks/cmd-RST2ZPA6.js +0 -1
  65. package/chunks/invoke-hook-HB2TBCHD.js +0 -10
  66. package/chunks/mod-KTV64DHD.js +0 -1
  67. package/chunks/next-4DJGEJBW.js +0 -8
  68. package/chunks/rule-QP5BSH27.js +0 -2
  69. package/chunks/run-3VWWQDN2.js +0 -3
  70. package/chunks/spec-HQZVVCBY.js +0 -1
@@ -1 +0,0 @@
1
- import{a,b,c,d}from"./chunk-YK6UG66R.js";import"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";export{c as cmd,b as cmdPrefix,d as extractPrefix,a as setCommandPrefix};
@@ -1,10 +0,0 @@
1
- import{d as T}from"./chunk-7GUYMD3Z.js";import{a as $,b as C}from"./chunk-ZMVD5IU4.js";import"./chunk-MRZT23BL.js";import"./chunk-7UX6WIXX.js";import{c as w}from"./chunk-YK6UG66R.js";import{d as f,e as E,l as R,p as D,s as b}from"./chunk-LWCWPXCS.js";import{a as c}from"./chunk-2N4GTHXQ.js";import{b as r}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var O=new Set(["log","diff","status","show","blame","rev-parse","ls-files","ls-tree","cat-file","describe","shortlog","name-rev","for-each-ref","rev-list","help","version"]),v=new Map([["branch",new Set(["","--list","-l","-a","--all","-r","--remotes","-v","--verbose","--contains","--no-contains","--merged","--no-merged"])],["tag",new Set(["","-l","--list","-v","--verify","-n"])],["stash",new Set(["list","show"])],["remote",new Set(["","-v","--verbose","show","get-url"])],["config",new Set(["--get","--get-all","--get-regexp","--list","-l","--global","--local","--system"])],["reflog",new Set(["","show"])]]),y=t=>{let n=t.trim();if(!n.startsWith("git"))return!0;let e=n.slice(3).trim();if(e.length===0)return!0;let a=e.split(/\s+/),o=a[0]??"";if(O.has(o))return!0;let s=v.get(o);if(s!==void 0){let i=a[1]??"";if(s.has(i))return!0}return!1};var I=t=>{let n=[/(?:bash|sh|\/bin\/bash|\/bin\/sh)\s+-c\s+["'](.+?)["']/g,/(?:bash|sh|\/bin\/bash|\/bin\/sh)\s+-c\s+(\S+)/g,/eval\s+["'](.+?)["']/g];for(let o of n){let s;for(;(s=o.exec(t))!==null;){let i=s[1]??"";if(i.includes("git")&&!y(i))return!0}}let e=t.split(/\s*\|\s*/);for(let o of e){let s=o.trim();if(s.startsWith("git")&&!y(s))return!0}let a=t.matchAll(/\bgit\s+([\w-]+)/g);for(let o of a){let s=o[1]??"";if(!O.has(s)&&!v.has(s))return!0;if(v.has(s)){let i=o.index??0,g=t.slice(i);if(!y(g.split(/[;&|$)`]/)[0]??""))return!0}}return!1};var x=async()=>{let t=r.process.stdin.getReader(),n=[];try{for(;;){let{done:s,value:i}=await t.read();if(s||i===void 0)break;n.push(i)}}finally{t.releaseLock()}let e=0,a=new Uint8Array(n.reduce((s,i)=>s+i.length,0));for(let s of n)a.set(s,e),e+=s.length;let o=new TextDecoder().decode(a);try{return JSON.parse(o)}catch{return{}}},P=async t=>{let n=new TextEncoder,e=r.process.stdout.getWriter();await e.write(n.encode(JSON.stringify(t))),e.releaseLock()},V=async t=>{switch(t?.[0]){case"pre-tool-use":return await N();case"stop":return await A();case"post-file-write":return await _();case"post-bash":return await W();case"session-start":return await G();default:return c(void 0)}},N=async()=>{let t=await x(),n=t.tool_name??"unknown",e=t.tool_input??{},a=t.cwd??r.process.cwd(),o=await R(a),s={};try{s=await E(a)}catch{return c(void 0)}let i=async d=>{await P({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`noskills: ${d}`}})};if(n==="Bash"){let d=(e.command??"").trim();if(!(o?.allowGit??!1)&&d.includes("git")){let p=d.split(/\s*(?:&&|;)\s*/);for(let m of p){let k=m.trim();if(k.startsWith("git")&&!y(k))return await i("Git write operations are not allowed. Only read commands (log, diff, status, show, blame, branch, tag) are permitted. The user controls git, the agent controls files."),c(void 0)}if(I(d))return await i("Git write operations detected in subshell or pipe. Only read commands are permitted. The user controls git, the agent controls files."),c(void 0)}return c(void 0)}let g=["Write","Edit","MultiEdit"];if(!g.includes(n))return c(void 0);let h=e.file_path??e.path??"";if(h.includes(".eser/")||h.includes(".claude/"))return c(void 0);let l=s.phase??"UNKNOWN";if(l==="EXECUTING"||l==="IDLE"||l==="FREE"||l==="COMPLETED"||l==="UNKNOWN"){if(l==="EXECUTING"&&g.includes(n)){let d=`${a}/${f.stateDir}/executor-warned.flag`;try{await r.fs.readTextFile(d)}catch{try{await r.fs.mkdir(`${a}/${f.stateDir}`,{recursive:!0}),await r.fs.writeTextFile(d,new Date().toISOString());let u=new TextEncoder,p=r.process.stderr.getWriter();await p.write(u.encode(`noskills: REMINDER \u2014 You should be spawning a noskills-executor sub-agent for implementation work. If you're the main orchestrator agent, delegate to a sub-agent instead of editing directly. If you ARE a sub-agent, ignore this message and continue.
2
- `)),p.releaseLock()}catch{}}}return c(void 0)}let S={DISCOVERY:`You are in DISCOVERY \u2014 this is a thinking phase, not an implementation phase. Read and discuss only. To write code, complete discovery and get the spec approved first. Run \`${w("next")}\` to continue.`,DISCOVERY_REVIEW:`You are in DISCOVERY_REVIEW \u2014 this is a thinking phase, not an implementation phase. Read and discuss only. To write code, complete discovery and get the spec approved first. Run \`${w('next --answer="approve"')}\` or revise answers.`,SPEC_DRAFT:`You are in SPEC_DRAFT \u2014 this is a thinking phase, not an implementation phase. Read and discuss only. To write code, approve the spec first. Run \`${w("approve")}\``,SPEC_APPROVED:`You are in SPEC_APPROVED \u2014 start execution first: \`${w('next --answer="start"')}\``,BLOCKED:`Execution blocked. Resolve with \`${w('next --answer="resolution"')}\``};return await i(S[l]??`Run \`${w("next")}\` first.`),c(void 0)},A=async()=>{let t=await x();if(t.stop_hook_active===!0)return c(void 0);let n=t.cwd??r.process.cwd(),e;try{let u=await r.fs.readTextFile(`${n}/${f.stateFile}`);e=JSON.parse(u)}catch{return c(void 0)}if(e.phase!=="EXECUTING")return c(void 0);let a=e.execution??{},o=`${n}/${f.stateDir}/files-changed.jsonl`,s=[];try{let p=(await r.fs.readTextFile(o)).trim().split(`
3
- `).filter(Boolean);s=[...new Set(p.map(m=>{try{return JSON.parse(m).file}catch{return null}}).filter(m=>m!==null))]}catch{}let i=[],g="no changes";try{let{execSync:u}=await import("node:child_process");i=u("git diff --name-only",{cwd:n,encoding:"utf-8",timeout:5e3}).trim().split(`
4
- `).filter(Boolean);let k=u("git diff --stat",{cwd:n,encoding:"utf-8",timeout:5e3}).trim().split(`
5
- `);g=k[k.length-1]??"no changes"}catch{}let h=[...new Set([...s,...i])],l=(a.iteration??0)+1,S=`${n}/${f.stateDir}/iterations`;try{await r.fs.mkdir(S,{recursive:!0}),await r.fs.writeTextFile(`${S}/iteration-${l}.json`,JSON.stringify({iteration:l,files:h,gitStat:g.trim(),timestamp:new Date().toISOString()},null,2)+`
6
- `)}catch{}let d=15;try{let u=await R(n);u!==null&&(d=u.maxIterationsBeforeRestart)}catch{}e.execution={...a,iteration:l,modifiedFiles:h,lastProgress:g.trim()||a.lastProgress||null},e.lastCalledAt=new Date().toISOString();try{await r.fs.writeTextFile(`${n}/${f.stateFile}`,JSON.stringify(e,null,2)+`
7
- `)}catch{}try{await r.fs.writeTextFile(o,"")}catch{}try{await r.fs.remove(`${n}/${f.stateDir}/executor-warned.flag`)}catch{}if(l>=d){let u=new TextEncoder,p=r.process.stderr.getWriter();await p.write(u.encode(`noskills: iteration ${l} reached threshold (${d}). Consider starting a fresh conversation.
8
- `)),p.releaseLock()}return c(void 0)},_=async()=>{let t=await x(),n=t.tool_input??{},e=n.file_path??n.path??"";if(!e||e.includes(".eser/")||e.includes(".claude/"))return c(void 0);let a=t.cwd??r.process.cwd(),o=`${a}/${f.stateDir}/files-changed.jsonl`,s=JSON.stringify({file:e,tool:t.tool_name,ts:new Date().toISOString()});try{await r.fs.mkdir(`${a}/${f.stateDir}`,{recursive:!0});let i="";try{i=await r.fs.readTextFile(o)}catch{}await r.fs.writeTextFile(o,i+s+`
9
- `)}catch{}return c(void 0)},W=async()=>{let t=await x(),e=(t.tool_input??{}).command??"";if(!e.includes("noskills"))return c(void 0);let a=t.cwd??r.process.cwd(),o=`${a}/${f.stateDir}/noskills-calls.jsonl`,s=JSON.stringify({command:e,ts:new Date().toISOString()});try{await r.fs.mkdir(`${a}/${f.stateDir}`,{recursive:!0});let i="";try{i=await r.fs.readTextFile(o)}catch{}await r.fs.writeTextFile(o,i+s+`
10
- `)}catch{}return c(void 0)},G=async()=>{let t=r.process.cwd();if(!await b(t))return c(void 0);let n=await E(t),e=await R(t),o=(await D(t)).filter(h=>e!==null&&e.concerns.includes(h.id)),s=await $(t),i=C(e?.tools??[]),g=T(n,o,s,e,void 0,void 0,void 0,i);return await P(g),c(void 0)};export{V as main};
@@ -1 +0,0 @@
1
- import{a,b,c,d}from"./chunk-BBKSV2RO.js";import"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";export{b as CommandBuilder,a as CommandError,d as exec,c as parseCommand};
@@ -1,8 +0,0 @@
1
- import{b as ae}from"./chunk-VK7L5SMS.js";import{a as te,b as se,c as ne,d as M}from"./chunk-7GUYMD3Z.js";import{a as W,b as J}from"./chunk-ZMVD5IU4.js";import"./chunk-MRZT23BL.js";import{a as ie}from"./chunk-7UX6WIXX.js";import{a as re,b as oe,d as S}from"./chunk-TJZAIUKM.js";import{a as ge}from"./chunk-SNHYXBHM.js";import{a as he,b as we,c as Se,d as ve}from"./chunk-3SLKOP72.js";import{a as q}from"./chunk-VPXOI7CR.js";import{c as N}from"./chunk-YK6UG66R.js";import{a as ce,b as le,e as R,f as H,g as de,h as ue,j as pe,l as me,m as fe}from"./chunk-TMC5H2A5.js";import{a as G,d as F,f as z,g as B,j as X,k as Y,l as K,p as Z,r as U,s as ee}from"./chunk-LWCWPXCS.js";import{a as V,b as C}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 Ie=a=>a.split(`
2
- `).map(e=>e.replace(/^[-*]\s+/,"").trim()).filter(e=>e.length>0&&!e.startsWith("#")),Ce=async(a,e)=>{let r=[],i=(e.startsWith(a)?e.slice(a.length+1):e).split("/");i.pop();for(let t=i.length;t>=0;t--){let n=`${t===0?a:`${a}/${i.slice(0,t).join("/")}`}/.folder-rules.md`,o=t===0?".":i.slice(0,t).join("/");try{let p=await h.fs.readTextFile(n),l=Ie(p);for(let m of l)r.push({folder:o,rule:m})}catch{}}return r},Q=async(a,e)=>{let r=new Set,c=[];for(let i of e){let t=await Ce(a,i);for(let s of t){let n=`${s.folder}::${s.rule}`;r.has(n)||(r.add(n),c.push(s))}}return c};var Ge=async a=>{let e=h.process.cwd(),r=re(a),c=oe(a);if(!await ee(e))return await S({error:`noskills not initialized. Run: ${N("init")}`},r),C({exitCode:1});let i=null;for(let d of c)d.startsWith("--answer=")&&(i=d.slice(9));let t=B(c),s;try{s=await z(e,t)}catch(d){let u=d instanceof Error?d.message:String(d);return await S({error:u},r),C({exitCode:1})}if(t===null&&s.phase!=="IDLE"&&s.phase!=="FREE"&&s.phase!=="COMPLETED")return await S({error:"Error: --spec=<name> is required. Use `noskills spec list` to see available specs."},r),C({exitCode:1});let n=await K(e);if(n?.command!==void 0){let{setCommandPrefix:d}=await import("./cmd-RST2ZPA6.js");d(n.command)}if(n===null)return await S({error:"No config found"},r),C({exitCode:1});if(s.spec!==null&&s.phase!=="IDLE"&&s.phase!=="COMPLETED"){let d=`${e}/${F.specDir(s.spec)}`;try{await h.fs.stat(d)}catch{return await S({error:!0,message:`Active spec '${s.spec}' directory not found. Files may have been deleted manually.`,suggestion:`Run \`${N("reset")}\` to return to IDLE, or \`${N("cancel")}\` to mark as cancelled.`},r),C({exitCode:1})}}let o=ae(c,n);s.phase==="DISCOVERY"&&s.discovery.audience!==o&&(s={...s,discovery:{...s.discovery,audience:o}});let l=(await Z(e)).filter(d=>n.concerns.includes(d.id));if(i!==null){let d=await be(e,s,n,l,i);await U(e,d);let u={...d,lastCalledAt:new Date().toISOString()};await U(e,u);let x=await W(e),b=u.spec!==null?await q(e,u.spec):null,j=await ye(e,u),A=await Q(e,j),T=J(n?.tools??[]),g=M(u,l,x,n,b,A,void 0,T);return await S(g,r),V(void 0)}let m={...s,lastCalledAt:new Date().toISOString()};await U(e,m);let y=await W(e),D=m.spec!==null?await q(e,m.spec):null,k=await ye(e,m),E=await Q(e,k),P;m.phase==="IDLE"&&(P={existingSpecs:(await Y(e)).map(u=>({name:u.name,phase:u.state.phase,iteration:u.state.execution.iteration,detail:u.state.phase==="EXECUTING"?`${u.state.execution.completedTasks.length} tasks done, iteration ${u.state.execution.iteration}`:u.state.phase==="SPEC_DRAFT"?"awaiting approval":u.state.phase==="COMPLETED"?"completed":void 0})),rulesCount:y.length});let $=J(n?.tools??[]),_=M(m,l,y,n,D,E,P,$);return await S(_,r),V(void 0)},be=async(a,e,r,c,i)=>{switch(e.phase){case"DISCOVERY":{let t=e.discovery.audience==="agent",s=null;try{let o=JSON.parse(i);typeof o=="object"&&o!==null&&!Array.isArray(o)&&(t?te.map(m=>m.id).every(m=>m in o)&&(s=o):s=o)}catch{}let n=e;if(s!==null)for(let[o,p]of Object.entries(s))typeof p=="string"&&p.length>0&&(n=R(n,o,p));else{let o=se(c),p=n.discovery.currentQuestion,l=o[p];if(l===void 0)return e;n=R(n,l.id,i),n=ue(n)}return ne(n.discovery.answers)&&(n=H(n)),n}case"DISCOVERY_REVIEW":{if(i.trim().toLowerCase()==="approve")return de(e);if(i.trim().toLowerCase()==="split")return await Fe(a,e);try{let t=JSON.parse(i);if(typeof t.revise=="object"&&t.revise!==null){let s=e;for(let[n,o]of Object.entries(t.revise))typeof o=="string"&&o.length>0&&(s=R(s,n,o));return s}}catch{}return e}case"SPEC_DRAFT":{if(e.classification===null){let t,s=i.trim().toLowerCase();if(s==="none"||s==="skip")t={involvesWebUI:!1,involvesCLI:!1,involvesPublicAPI:!1,involvesMigration:!1,involvesDataHandling:!1};else try{let o=JSON.parse(i);t={involvesWebUI:o.involvesWebUI===!0||o.involvesUI===!0,involvesCLI:o.involvesCLI===!0||o.involvesUI===!0,involvesPublicAPI:o.involvesPublicAPI===!0,involvesMigration:o.involvesMigration===!0,involvesDataHandling:o.involvesDataHandling===!0}}catch{t={involvesWebUI:!1,involvesCLI:!1,involvesPublicAPI:!1,involvesMigration:!1,involvesDataHandling:!1}}let n={...e,classification:t};try{await ge(a,n,c)}catch{}return n}try{let t=JSON.parse(i);if(typeof t.refinement=="string"&&t.refinement.length>0){let s=t.refinement;if(e.spec!==null){let n=`${a}/${F.specFile(e.spec)}`,o=await h.fs.readTextFile(n);if(s.includes("task-")){let l=Re(s).map(D=>`- [ ] ${D}`).join(`
3
- `),m=/## Tasks\n\n([\s\S]*?)(?=\n## |\n*$)/,y=o.replace(m,`## Tasks
4
-
5
- ${l}
6
- `);await h.fs.writeTextFile(n,y)}}return e}}catch{}return e}case"SPEC_APPROVED":{let t=pe(e);return t.spec!==null&&(await he(a,t.spec,"executing"),await ve(a,t.spec,"executing")),t}case"EXECUTING":{if(!e.execution.awaitingStatusReport){let t={...e,execution:{...e.execution,lastProgress:i}};if(r.verifyCommand!==null&&r.verifyCommand!==void 0&&r.verifyCommand.length>0){let s=await Ee(a,r.verifyCommand);if(t={...t,execution:{...t.execution,lastVerification:s}},!s.passed)return t}return t={...t,execution:{...t.execution,awaitingStatusReport:!0}},t}return await ke(a,e,i,c)}case"BLOCKED":{let t=e.execution.lastProgress??"Unknown",s={id:`d${e.decisions.length+1}`,question:t.replace(/^BLOCKED:\s*/,""),choice:i,promoted:!1,timestamp:new Date().toISOString()},n=me(e,s);return n=ce(n,"EXECUTING"),n={...n,execution:{...n.execution,lastProgress:`Resolved: ${i}`}},n}default:return e}},Fe=async(a,e)=>{let r=ie(e.discovery.answers);if(!r.detected||r.proposals.length===0)return e;let c=[];for(let t of r.proposals){let s=`${a}/${F.specDir(t.name)}`;await h.fs.mkdir(s,{recursive:!0});let n=e.discovery.answers.filter(l=>t.relevantAnswers.includes(l.questionId)),p=le(G(),t.name,`spec/${t.name}`);for(let l of n)p=R(p,l.questionId,l.answer);p=H(p),await X(a,t.name,p),c.push(t.name)}return fe(e,"cancelled",`Split into: ${c.join(", ")}`)},Re=a=>a.split(/(?=task-\d+:)/).map(e=>e.replace(/[,;\n\s]+$/,"").trim()).filter(e=>/^task-\d+:/.test(e)),ke=async(a,e,r,c)=>{let i;try{i=JSON.parse(r)}catch{return{...e,execution:{...e.execution,lastProgress:r,awaitingStatusReport:!1}}}let t=e;if(e.execution.debt!==null&&e.execution.debt.items.length>0&&typeof e.execution.debt.items[0]=="string"){let I=e.execution.debt.items.map((w,f)=>({id:`legacy-${f+1}`,text:w,since:e.execution.debt.fromIteration}));t={...e,execution:{...e.execution,debt:{...e.execution.debt,items:I}}};let O=new TextEncoder,v=h.process.stderr.getWriter();await v.write(O.encode(`noskills: migrated legacy string[] debt to DebtItem[] format
7
- `)),v.releaseLock()}let s=i.completed??[],n=new Set(s),o=i.na??[],p=new Set(o),l=i.newIssues??[],m=i.remaining??[],y=i.blocked??[],D=t.execution.debt?.unaddressedIterations??0,k=t.execution.debt!==null?t.execution.debt.items.filter(g=>!n.has(g.id)&&!p.has(g.id)):[],E=t.execution.debtCounter??0,P=l.map((g,I)=>({id:`debt-${E+I+1}`,text:g,since:t.execution.iteration})),$=[...k,...P],d=m.length===0&&y.length===0&&l.length===0||$.length===0?null:{items:$,fromIteration:t.execution.debt?.fromIteration??t.execution.iteration,unaddressedIterations:k.length>0?D+1:1},u=[...new Set([...t.execution.naItems??[],...o])],x=[];s.length>0&&x.push(`Completed: ${s.join(", ")}`),o.length>0&&x.push(`N/A: ${o.join(", ")}`);let b=x.length>0?x.join("; "):"Status report submitted",j=t.execution.lastVerification===null||t.execution.lastVerification.passed===!0,A=d===null&&j,T=E+l.length;if(A&&t.spec!==null){let g=await q(a,t.spec);if(g!==null){let I=t.execution.completedTasks??[],O=new Set(I),v=[];try{let f=JSON.parse(t.execution.lastProgress??"");Array.isArray(f.completed)&&(v=f.completed.filter(L=>!O.has(L)&&g.tasks.some(xe=>xe.id===L)))}catch{}if(v.length===0){let f=g.tasks.find(L=>!O.has(L.id));f!==void 0&&(v=[f.id])}let w=[];for(let f of v)await we(a,t.spec,f),await Se(a,t.spec,f,"done"),w.push(f);if(w.length>0){let f=w.length===1?`Task ${w[0]} accepted`:`Tasks ${w.join(", ")} accepted`;return{...t,execution:{...t.execution,lastProgress:`${f}: ${b}`,awaitingStatusReport:!1,debt:d,completedTasks:[...I,...w],debtCounter:T,naItems:u}}}}}return{...t,execution:{...t.execution,lastProgress:A?b:`Task not accepted \u2014 remaining items must be addressed first. ${b}`,awaitingStatusReport:!1,debt:d,debtCounter:T,naItems:u}}},Ee=async(a,e)=>{try{let{execSync:r}=await import("node:child_process"),c=r(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(r){let c=r,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: ${r instanceof Error?r.message:String(r)}`,timestamp:new Date().toISOString()}}},ye=async(a,e)=>{let r=[...e.execution.modifiedFiles??[]],c=await Pe(a);return[...new Set([...r,...c])]},Pe=async a=>{let e=`${a}/${F.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 s=JSON.parse(t);i.includes(s.file)||i.push(s.file)}catch{}return i}catch{return[]}};export{be as handleAnswer,Ge as main,Re as parseRefinementTasks};
@@ -1,2 +0,0 @@
1
- import{a as k,c as x}from"./chunk-ZMVD5IU4.js";import{b as y,c as w}from"./chunk-YK6UG66R.js";import{d as f,l as h}from"./chunk-LWCWPXCS.js";import{c as m,d as i,f as p,g,o,q as l,r as a}from"./chunk-Y6AFIAJP.js";import{a as u,b as c}from"./chunk-2N4GTHXQ.js";import{b as n}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var U=async s=>{let e=s?.[0];if(e==="add")return await $(s?.slice(1));if(e==="list")return await v();if(e==="promote")return await C(s?.slice(1));let t=y(),r=o({renderer:a.ansi(),sink:l.stdout()});return r.writeln(`Usage: ${t} rule <add "rule text" | list | promote "decision">`),await r.close(),u(void 0)},$=async s=>{let e=o({renderer:a.ansi(),sink:l.stdout()}),t=n.process.cwd(),r=s?.join(" "),d=await h(t);if(r===void 0||r.length===0)return e.writeln(p("Please provide a rule: "),m(`${w('rule add "Use Deno Tests for all tests"')}`)),await e.close(),c({exitCode:1});let P=r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,50),A=`${t}/${f.rulesDir}/${P}.md`;return await n.fs.mkdir(`${t}/${f.rulesDir}`,{recursive:!0}),await n.fs.writeTextFile(A,r+`
2
- `),e.writeln(g("\u2714")," Rule added: ",i(r)),d!==null&&d.tools.length>0&&(await x(t,d.tools,d),e.writeln(i(" Tool files synced."))),await e.close(),u(void 0)},v=async()=>{let s=o({renderer:a.ansi(),sink:l.stdout()}),e=n.process.cwd(),t=await k(e);if(s.writeln(m("Rules")),s.writeln(""),t.length===0)s.writeln(i(` No rules yet. Add one with: ${w('rule add "..."')}`));else for(let r of t)s.writeln(" ",i("\u2022"),` ${r}`);return await s.close(),u(void 0)},C=async s=>{let e=o({renderer:a.ansi(),sink:l.stdout()}),t=s?.join(" ");return t===void 0||t.length===0?(e.writeln(p("Please provide the decision text to promote.")),await e.close(),c({exitCode:1})):(await e.close(),await $(s))};export{U as main};
@@ -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-7GUYMD3Z.js";import{a as W,b as X}from"./chunk-ZMVD5IU4.js";import"./chunk-MRZT23BL.js";import"./chunk-7UX6WIXX.js";import{b as E,c as V}from"./chunk-YK6UG66R.js";import{a as _,j}from"./chunk-TMC5H2A5.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};
@@ -1 +0,0 @@
1
- import{a as M}from"./chunk-7UX6WIXX.js";import{a as Y,d as L}from"./chunk-TJZAIUKM.js";import{b as $,c as R}from"./chunk-YK6UG66R.js";import{b as z,e as N,f as O,m as q}from"./chunk-TMC5H2A5.js";import{a as x,d as h,f as V,g as W,j as g,k as j,s as P}from"./chunk-LWCWPXCS.js";import{c as p,d as o,f as d,g as C,h as A,k as F,o as D,q as I,r as k}from"./chunk-Y6AFIAJP.js";import{a as f,b as m}from"./chunk-2N4GTHXQ.js";import{b as w}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var ie=async r=>{let e=r?.[0];if(e==="new")return await G(r?.slice(1));if(e==="list")return await T(r?.slice(1));if(e==="split")return await _(r?.slice(1));let n=$(),s=D({renderer:k.ansi(),sink:I.stdout()});return s.writeln(`Usage: ${n} spec <new --name=<slug> "description" | list | split --spec=<name> --into name1 "desc1" --into name2 "desc2">`),await s.close(),f(void 0)},G=async r=>{let e=D({renderer:k.ansi(),sink:I.stdout()}),n=w.process.cwd();if(!await P(n))return e.writeln(d("noskills is not initialized.")," Run: ",p(R("init"))),await e.close(),m({exitCode:1});let s=null,a=[];if(r!==void 0)for(let i of r)i.startsWith("--name=")?s=i.slice(7):i.startsWith("-")||a.push(i);let S=a.join(" ");if(s===null||s.length===0)return e.writeln(d("Error: --name is required.")),e.writeln(o("Example: "),p(`${$()} spec new --name=photo-upload "photo upload feature"`)),await e.close(),m({exitCode:1});let c=/^[a-z0-9][a-z0-9-]*[a-z0-9]$/;if(s.length>50||s.length>1&&!c.test(s)||s.length===1&&!/^[a-z0-9]$/.test(s))return e.writeln(d("Invalid spec name: "),p(s)),e.writeln(o("Must be lowercase, hyphens, numbers only. Max 50 chars. Regex: /^[a-z0-9][a-z0-9-]*[a-z0-9]$/")),await e.close(),m({exitCode:1});if(S.length===0)return e.writeln(d("Please provide a description: "),p(`${$()} spec new --name=${s} "photo upload feature"`)),await e.close(),m({exitCode:1});let u=`spec/${s}`,t=`${n}/${h.specDir(s)}`;try{return await w.fs.stat(t),e.writeln(d(`Spec "${s}" already exists.`),o(` Use a different --name or run \`${$()} reset --spec=${s}\` first.`)),await e.close(),m({exitCode:1})}catch{}let l=x(),y=z(l,s,u);return await w.fs.mkdir(`${n}/${h.specDir(s)}`,{recursive:!0}),await g(n,s,y),e.writeln(C("\u2714")," Spec started: ",p(s)),e.writeln(" Directory: ",o(h.specDir(s))),e.writeln(" Branch: ",o(u)),e.writeln(" Phase: ",A("DISCOVERY")),e.writeln(""),e.writeln("Run ",p(R(`next --spec=${s}`))," to begin discovery questions."),await e.close(),f(void 0)},T=async r=>{let e=w.process.cwd(),n=Y(r),s=await j(e),a=`${e}/${h.specsDir}`,S=new Set(s.map(t=>t.name)),c=[];for(let t of s)c.push({name:t.name,phase:t.state.phase,iteration:t.state.execution.iteration});try{for await(let t of w.fs.readDir(a))t.isDirectory&&!S.has(t.name)&&c.push({name:t.name,phase:"IDLE",iteration:0})}catch{}if(n==="json")return await L(c,"json"),f(void 0);let u=D({renderer:k.ansi(),sink:I.stdout()});if(u.writeln(p("Specs")),u.writeln(""),c.length===0)u.writeln(o(" No specs yet."));else for(let t of c){let l=t.phase==="COMPLETED"?C(t.phase):t.phase==="EXECUTING"?F(t.phase):t.phase==="BLOCKED"?d(t.phase):A(t.phase),y=t.phase==="EXECUTING"?o(` iteration ${t.iteration}`):"";u.writeln(" ",o("\u25CB")," ",t.name," ",l,y)}return await u.close(),f(void 0)},X=r=>{let e=[],n=0;for(;n<r.length;)if(r[n]==="--into"&&n+1<r.length){let s=r[n+1],a=s;n+2<r.length&&!r[n+2].startsWith("-")?(a=r[n+2],n+=3):n+=2,e.push({name:s,description:a})}else n+=1;return e},_=async r=>{let e=D({renderer:k.ansi(),sink:I.stdout()}),n=w.process.cwd();if(!await P(n))return e.writeln(d("noskills is not initialized.")," Run: ",p(R("init"))),await e.close(),m({exitCode:1});let s=W(r??[]);if(s===null)return e.writeln(d("Error: --spec=<name> is required.")),e.writeln(o("Example: "),p(`${$()} spec split --spec=parent --into name1 "desc1" --into name2 "desc2"`)),await e.close(),m({exitCode:1});let a;try{a=await V(n,s)}catch(t){let l=t instanceof Error?t.message:String(t);return e.writeln(d(`Error: ${l}`)),await e.close(),m({exitCode:1})}if(a.phase!=="DISCOVERY"&&a.phase!=="DISCOVERY_REVIEW")return e.writeln(d(`Cannot split spec in phase ${a.phase}. Must be in DISCOVERY or DISCOVERY_REVIEW.`)),await e.close(),m({exitCode:1});let S=X(r??[]);if(S.length<2){let t=M(a.discovery.answers);if(!t.detected||t.proposals.length<2)return e.writeln(d("Error: at least 2 --into entries required, or discovery answers must contain 2+ independent areas.")),await e.close(),m({exitCode:1});let l=[];for(let i of t.proposals){let v=`${n}/${h.specDir(i.name)}`;await w.fs.mkdir(v,{recursive:!0});let U=a.discovery.answers.filter(b=>i.relevantAnswers.includes(b.questionId)),E=z(x(),i.name,`spec/${i.name}`);for(let b of U)E=N(E,b.questionId,b.answer);E=O(E),await g(n,i.name,E),l.push(i.name)}let y=q(a,"cancelled",`Split into: ${l.join(", ")}`);await g(n,s,y),e.writeln(C("Split complete."),` Created ${l.length} sub-specs:`);for(let i of l)e.writeln(" ",o("\u25CB")," ",p(i));return e.writeln("",o(`Parent spec "${s}" cancelled.`)),await e.close(),f(void 0)}let c=[];for(let t of S){let l=`${n}/${h.specDir(t.name)}`;await w.fs.mkdir(l,{recursive:!0});let i=z(x(),t.name,`spec/${t.name}`);for(let v of a.discovery.answers)i=N(i,v.questionId,v.answer);i=O(i),await g(n,t.name,i),c.push(t.name)}let u=q(a,"cancelled",`Split into: ${c.join(", ")}`);await g(n,s,u),e.writeln(C("Split complete."),` Created ${c.length} sub-specs:`);for(let t of c)e.writeln(" ",o("\u25CB")," ",p(t));return e.writeln("",o(`Parent spec "${s}" cancelled.`)),await e.close(),f(void 0)};export{ie as main};