eser 4.1.55 → 4.1.56
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/chunks/{ajan-HYDPJF3Z.js → ajan-RZNLBRWL.js} +1 -1
- package/chunks/approve-CSNHLN74.js +2 -0
- package/chunks/{block-4ISSYCGQ.js → block-RYXM4VQQ.js} +1 -1
- package/chunks/{cancel-ZRTVX5AT.js → cancel-KVUNVJJ2.js} +1 -1
- package/chunks/chunk-E4WXXNF6.js +2 -0
- package/chunks/{chunk-MLC6JFJF.js → chunk-IHHITZU2.js} +1 -1
- package/chunks/chunk-P4SPHY3G.js +6 -0
- package/chunks/{chunk-IXO5V52Y.js → chunk-YTLTR452.js} +1 -1
- package/chunks/{delegate-EBL5HMGD.js → delegate-JVA57PQG.js} +1 -1
- package/chunks/{done-QSQ7AMLP.js → done-MQGWNNZO.js} +1 -1
- package/chunks/{followup-EMQ3ZNNS.js → followup-H2CVZVOP.js} +1 -1
- package/chunks/{init-OQ4CKFY7.js → init-4Q4HAHND.js} +1 -1
- package/chunks/invoke-hook-NMA2CDWK.js +14 -0
- package/chunks/manager-QK6D3SA2.js +7 -0
- package/chunks/{mod-FSAQBB7E.js → mod-EQ33JILZ.js} +1 -1
- package/chunks/mod-KPAF2K4Q.js +23 -0
- package/chunks/next-S6SRRGZ4.js +8 -0
- package/chunks/{reopen-KFHUPFTT.js → reopen-SJU63UEG.js} +1 -1
- package/chunks/{reset-F25OLGX7.js → reset-ELKH7QV3.js} +1 -1
- package/chunks/{review-ITFNV2TI.js → review-GYD3HGFK.js} +1 -1
- package/chunks/{run-7HOUSACQ.js → run-H3PSKRPV.js} +1 -1
- package/chunks/spec-QQW7427P.js +2 -0
- package/chunks/status-MZRTOMES.js +2 -0
- package/chunks/{sync-7FA2HPX7.js → sync-JYEN3MZS.js} +1 -1
- package/chunks/{system-I6RBRBRL.js → system-TEBXYSPT.js} +1 -1
- package/chunks/{watch-XTRRIRTM.js → watch-SAPVNSL6.js} +5 -5
- package/chunks/{wontfix-SLHYAWS7.js → wontfix-LL6NHECR.js} +1 -1
- package/eser.js +1 -1
- package/package.json +2 -1
- package/chunks/approve-7QQFUQ2C.js +0 -2
- package/chunks/chunk-BAVRVBBX.js +0 -2
- package/chunks/chunk-KI6473LF.js +0 -6
- package/chunks/invoke-hook-U3LDMMLY.js +0 -14
- package/chunks/manager-R2Q4FOHO.js +0 -7
- package/chunks/mod-ZCIGCCW4.js +0 -23
- package/chunks/next-ZR6B35KN.js +0 -8
- package/chunks/spec-XFXHNULK.js +0 -2
- package/chunks/status-KEARGELM.js +0 -2
package/chunks/next-ZR6B35KN.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as ie}from"./chunk-5YBG2HOI.js";import{a as ye}from"./chunk-NTY267SI.js";import"./chunk-L5OC7F24.js";import{a as z}from"./chunk-KI6473LF.js";import{a as he,b as ge,c as ve}from"./chunk-4KDDHQVL.js";import"./chunk-PPB6ACBB.js";import{a as K,c as Y,e as X}from"./chunk-4JICYXYK.js";import"./chunk-KFVUFHJB.js";import{a as G}from"./chunk-NY4W44PI.js";import{a as we,b as Se,d as k}from"./chunk-2ZYCRMUT.js";import{a as Ee}from"./chunk-LEG3PWOU.js";import{a as H}from"./chunk-ODBJ5KMQ.js";import{a as Re,b as Oe,c as Fe,d as Te}from"./chunk-DI7OHJ53.js";import{h as W}from"./chunk-L32KHQVT.js";import{a as xe,b as Ce,c as Z,d as Ie,e as De,f as ee,g as F,h as te,i as J,j as se,k as ke,m as Pe,o as ne,p as be,v as Ae}from"./chunk-BAVRVBBX.js";import{A as me,B as fe,a as ae,c as O,e as oe,f as ce,j as le,k as de,l as pe,p as ue,r as V,w as B}from"./chunk-LOZLXP5G.js";import{c as _}from"./chunk-UEMWZOIU.js";import"./chunk-2XNFZXHY.js";import{a as q,b as E}from"./chunk-FFWPJP7A.js";import{i as D}from"./chunk-6DBKPC2O.js";import"./chunk-ALFFE37K.js";import"./chunk-6G6UVWJN.js";import"./chunk-5WJ6AUNY.js";var ot=async l=>{let{root:e}=await fe(),r=we(l),u=Se(l);if(!await me(e))return await k({error:`noskills not initialized. Run: ${_("init")}`},r),E({exitCode:1});let n=null;for(let f of u)f.startsWith("--answer=")&&(n=f.slice(9));let s=ce(u),t;try{t=await oe(e,s)}catch(f){let h=f instanceof Error?f.message:String(f);return await k({error:h},r),E({exitCode:1})}if(s===null&&t.phase!=="IDLE"&&t.phase!=="COMPLETED")return await k({error:"Error: --spec=<name> is required. Use `noskills spec list` to see available specs."},r),E({exitCode:1});let a=await pe(e);if(a?.command!==void 0){let{setCommandPrefix:f}=await import("./cmd-QE4P4DS4.js");f(a.command)}if(a===null)return await k({error:"No config found"},r),E({exitCode:1});if(t.spec!==null&&t.phase!=="IDLE"&&t.phase!=="COMPLETED"){let f=`${e}/${O.specDir(t.spec)}`;try{await D.fs.stat(f)}catch{return await k({error:!0,message:`Active spec '${t.spec}' directory not found. Files may have been deleted manually.`,suggestion:`Run \`${_("reset")}\` to return to idle, or \`${_("cancel")}\` to mark as cancelled.`},r),E({exitCode:1})}}let i=ye(u,a);t.phase==="DISCOVERY"&&t.discovery.audience!==i&&(t={...t,discovery:{...t.discovery,audience:i}});let d=(await ue(e)).filter(f=>a.concerns.includes(f.id));if(n!==null){let f=await W(e),h=await Me(e,t,a,d,n,f);await V(e,h);let g={...h,lastCalledAt:new Date().toISOString()};await V(e,g);let N=D.env.get("NOSKILLS_SESSION")??null;N!==null&&await B(e,N,g.phase);let M=await K(e),{tier1:j,tier2Count:S}=Y(M,g.phase),P=g.spec!==null?await H(e,g.spec):null,A=await $e(e,g),I=await ie(e,A),C=X(a?.tools??[]),v=await W(e),b=await z(g,d,j,a,P,I,void 0,C,v,S,e),Q=n.trim().toLowerCase()==="save",Ue=g.phase===t.phase;if(Q&&Ue&&(g.phase==="SPEC_DRAFT"||g.phase==="SPEC_APPROVED")){let Le=g.phase==="SPEC_DRAFT"?"Spec draft saved. The spec stays in DRAFT and can be reviewed by anyone. Other users can add ACs (`ac add`), notes (`note add`), or tasks (`task add`) while in draft. When ready, any user can approve with `noskills spec <name> approve`.":'Spec is approved and parked. Others can still add ACs or notes. When ready, run `noskills next --answer="start"` to begin execution.',Ne={...b,instruction:Le,saved:!0};return await k(Ne,r),q(void 0)}return await k(b,r),q(void 0)}let c={...t,lastCalledAt:new Date().toISOString()};await V(e,c);let m=D.env.get("NOSKILLS_SESSION")??null;m!==null&&await B(e,m,c.phase);let p=await K(e),{tier1:w,tier2Count:x}=Y(p,c.phase),y=c.spec!==null?await H(e,c.spec):null,T=await $e(e,c),$=await ie(e,T),U;c.phase==="IDLE"&&(U={existingSpecs:(await de(e)).map(h=>({name:h.name,phase:h.state.phase,iteration:h.state.execution.iteration,detail:h.state.phase==="EXECUTING"?`${h.state.execution.completedTasks.length} tasks done, iteration ${h.state.execution.iteration}`:h.state.phase==="SPEC_DRAFT"?"awaiting approval":h.state.phase==="COMPLETED"?"completed":void 0})),rulesCount:w.length});let L=X(a?.tools??[]),re=await W(e),R=await z(c,d,w,a,y,$,U,L,re,x,e);return await k(R,r),q(void 0)},Me=async(l,e,r,u,n,s)=>{switch(e.phase){case"DISCOVERY":{let t=e.discovery.userContext!==void 0&&e.discovery.userContext.length>0,a=e.specDescription!==null&&e.specDescription.length>0,i=e.discovery.mode;if(!t&&i===void 0&&a)return Ae(e,n);if(i===void 0&&a)return["full","validate","technical-depth","ship-fast","explore"].includes(n)?Z(e,n):Z(e,"full");let o=e.discovery.premisesCompleted===!0;if(i!==void 0&&!o){try{let p=JSON.parse(n);if(p!==null&&typeof p=="object"&&"premises"in p){let x=p.premises.map(y=>({text:y.text??"",agreed:y.agreed??!0,revision:y.revision,user:s?.name??"Unknown User",timestamp:new Date().toISOString()}));if(x.length===0)throw new Error("Premise challenge requires at least one premise. Empty array rejected.");return Ie(e,x)}}catch{throw new Error("Premise challenge requires valid JSON with premises array. Re-prompt the user.")}throw new Error("Premise challenge requires a premises array. Cannot skip with empty input.")}let d=e.discovery.audience==="agent",c=null;try{let p=JSON.parse(n);typeof p=="object"&&p!==null&&!Array.isArray(p)&&(d?he.map(y=>y.id).every(y=>y in p)&&(c=p):c=p)}catch{}let m=e;if(c!==null){for(let[p,w]of Object.entries(c))typeof w=="string"&&w.length>0&&(m=F(m,p,w,s));m={...m,discovery:{...m.discovery,batchSubmitted:!0}}}else{let p=ge(u),w=m.discovery.currentQuestion,x=p[w];if(x===void 0)return e;m=F(m,x.id,n,s),m=ke(m)}return ve(m.discovery.answers)&&(m=te(m)),m}case"DISCOVERY_REVIEW":{let t=n.trim().toLowerCase();if(t==="approve"){let i=G(e.discovery.answers);return i.detected&&i.proposals.length>=2?se(e):e.discovery.mode!==void 0?se(e):J(e)}if(t==="split")return await je(l,e);if(t==="keep"){let i=ne(e,{id:`decision-split-keep-${Date.now()}`,question:"Split spec into separate areas?",choice:"Chose to keep as single spec despite multiple areas detected",promoted:!1,timestamp:new Date().toISOString()});return J(i)}let a=e.discovery.alternativesPresented===!0;if(e.discovery.approved&&!a){let i;if(t==="skip"||t==="none")i=ee(e);else{let o=!1;try{let d=JSON.parse(n);if(d!==null&&typeof d=="object"&&"approach"in d){let c={id:String(d.approach),name:String(d.name??d.approach),summary:String(d.summary??""),effort:String(d.effort??""),risk:String(d.risk??""),user:s?.name??"Unknown User",timestamp:new Date().toISOString()};i=De(e,c),o=!0}}catch{}o||(i=ee(e))}return J(i)}try{let i=JSON.parse(n);if(typeof i.revise=="object"&&i.revise!==null){let o=e;for(let[d,c]of Object.entries(i.revise))typeof c=="string"&&c.length>0&&(o=F(o,d,c,s));return o}}catch{}return e}case"SPEC_DRAFT":{if(n.trim().toLowerCase()==="save")return e;if(e.classification===null){let t,a=n.trim().toLowerCase();if(a==="none"||a==="skip")t={involvesWebUI:!1,involvesCLI:!1,involvesPublicAPI:!1,involvesMigration:!1,involvesDataHandling:!1};else try{let o=JSON.parse(n);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 i={...e,classification:t};try{await Ee(l,i,u)}catch{}return i}try{let t=JSON.parse(n);if(typeof t.refinement=="string"&&t.refinement.length>0){let a=t.refinement;if(e.spec!==null){let i=`${l}/${O.specFile(e.spec)}`,o=await D.fs.readTextFile(i);if(a.includes("task-")){let c=qe(a).map(w=>`- [ ] ${w}`).join(`
|
|
3
|
-
`),m=/## Tasks\n\n([\s\S]*?)(?=\n## |\n*$)/,p=o.replace(m,`## Tasks
|
|
4
|
-
|
|
5
|
-
${c}
|
|
6
|
-
`);await D.fs.writeTextFile(i,p)}}return e}}catch{}return e}case"SPEC_APPROVED":{if(n.trim().toLowerCase()==="save")return e;let t=Pe(e);return t.spec!==null&&(await Re(l,t.spec,"executing"),await Te(l,t.spec,"executing")),t}case"EXECUTING":{if(!e.execution.awaitingStatusReport){let t={...e,execution:{...e.execution,lastProgress:n}};if(r.verifyCommand!==null&&r.verifyCommand!==void 0&&r.verifyCommand.length>0){let a=await _e(l,r.verifyCommand);if(t={...t,execution:{...t.execution,lastVerification:a}},!a.passed)return t}return t={...t,execution:{...t.execution,awaitingStatusReport:!0}},t}return await Ve(l,e,n,u)}case"BLOCKED":{let t=e.execution.lastProgress??"Unknown",a={id:`d${e.decisions.length+1}`,question:t.replace(/^BLOCKED:\s*/,""),choice:n,promoted:!1,timestamp:new Date().toISOString()},i=ne(e,a);return i=xe(i,"EXECUTING"),i={...i,execution:{...i.execution,lastProgress:`Resolved: ${n}`}},i}default:return e}},je=async(l,e)=>{let r=G(e.discovery.answers);if(!r.detected||r.proposals.length===0)return e;let u=[];for(let s of r.proposals){let t=`${l}/${O.specDir(s.name)}`;await D.fs.mkdir(t,{recursive:!0});let a=e.discovery.answers.filter(d=>s.relevantAnswers.includes(d.questionId)),o=Ce(ae(),s.name,`spec/${s.name}`);for(let d of a)o=F(o,d.questionId,d.answer);o=te(o),await le(l,s.name,o),u.push(s.name)}return be(e,"cancelled",`Split into: ${u.join(", ")}`)},qe=l=>l.split(/(?=task-\d+:)/).map(e=>e.replace(/[,;\n\s]+$/,"").trim()).filter(e=>/^task-\d+:/.test(e)),Ve=async(l,e,r,u)=>{let n;try{n=JSON.parse(r)}catch{return{...e,execution:{...e.execution,lastProgress:r,awaitingStatusReport:!1}}}let s=e;if(e.execution.debt!==null&&e.execution.debt.items.length>0&&typeof e.execution.debt.items[0]=="string"){let P=e.execution.debt.items.map((C,v)=>({id:`legacy-${v+1}`,text:C,since:e.execution.debt.fromIteration}));s={...e,execution:{...e.execution,debt:{...e.execution.debt,items:P}}};let A=new TextEncoder,I=D.process.stderr.getWriter();await I.write(A.encode(`noskills: migrated legacy string[] debt to DebtItem[] format
|
|
7
|
-
`)),I.releaseLock()}let t=new Set(["mandatory-tests","mandatory-docs"]),i=(n.na??[]).filter(S=>t.has(S));if(i.length>0)return{...s,execution:{...s.execution,lastProgress:`REJECTED: Tests and documentation ACs require explicit justification to mark as N/A. Explain why tests or docs are not needed for this spec. Rejected IDs: ${i.join(", ")}`,awaitingStatusReport:!0}};let o=n.completed??[],d=new Set(o),c=n.na??[],m=new Set(c),p=n.newIssues??[],w=n.remaining??[],x=n.blocked??[],y=s.execution.debt?.unaddressedIterations??0,T=s.execution.debt!==null?s.execution.debt.items.filter(S=>!d.has(S.id)&&!m.has(S.id)):[],$=s.execution.debtCounter??0,U=p.map((S,P)=>({id:`debt-${$+P+1}`,text:S,since:s.execution.iteration})),L=[...T,...U],R=w.length===0&&x.length===0&&p.length===0||L.length===0?null:{items:L,fromIteration:s.execution.debt?.fromIteration??s.execution.iteration,unaddressedIterations:T.length>0?y+1:1},f=[...new Set([...s.execution.naItems??[],...c])],h=[];o.length>0&&h.push(`Completed: ${o.join(", ")}`),c.length>0&&h.push(`N/A: ${c.join(", ")}`);let g=h.length>0?h.join("; "):"Status report submitted",N=s.execution.lastVerification===null||s.execution.lastVerification.passed===!0,M=R===null&&N,j=$+p.length;if(M&&s.spec!==null){let S=await H(l,s.spec);if(S!==null){let P=s.execution.completedTasks??[],A=new Set(P),I=[];try{let v=JSON.parse(s.execution.lastProgress??"");Array.isArray(v.completed)&&(I=v.completed.filter(b=>!A.has(b)&&S.tasks.some(Q=>Q.id===b)))}catch{}if(I.length===0){let v=S.tasks.find(b=>!A.has(b.id));v!==void 0&&(I=[v.id])}let C=[];for(let v of I)await Oe(l,s.spec,v),await Fe(l,s.spec,v,"done"),C.push(v);if(C.length>0){let v=C.length===1?`Task ${C[0]} accepted`:`Tasks ${C.join(", ")} accepted`;return{...s,execution:{...s.execution,lastProgress:`${v}: ${g}`,awaitingStatusReport:!1,debt:R,completedTasks:[...P,...C],debtCounter:j,naItems:f}}}}}return{...s,execution:{...s.execution,lastProgress:M?g:`Task not accepted \u2014 remaining items must be addressed first. ${g}`,awaitingStatusReport:!1,debt:R,debtCounter:j,naItems:f}}},_e=async(l,e)=>{try{let{execSync:r}=await import("node:child_process"),u=r(e,{cwd:l,encoding:"utf-8",timeout:6e4,stdio:["pipe","pipe","pipe"]});return{passed:!0,output:String(u).slice(0,4e3),timestamp:new Date().toISOString()}}catch(r){let u=r,n=((u.stdout??"")+(u.stderr??"")).slice(0,4e3);return u.status!==void 0?{passed:!1,output:n||"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()}}},$e=async(l,e)=>{let r=[...e.execution.modifiedFiles??[]],u=await Je(l);return[...new Set([...r,...u])]},Je=async l=>{let e=`${l}/${O.stateDir}/files-changed.jsonl`;try{let u=(await D.fs.readTextFile(e)).trim().split(`
|
|
8
|
-
`).filter(Boolean),n=[];for(let s of u)try{let t=JSON.parse(s);n.includes(t.file)||n.push(t.file)}catch{}return n}catch{return[]}};export{Me as handleAnswer,ot as main,qe as parseRefinementTasks};
|
package/chunks/spec-XFXHNULK.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as G}from"./chunk-NY4W44PI.js";import{a as X,d as B}from"./chunk-2ZYCRMUT.js";import{a as Z}from"./chunk-YWSOQJ7G.js";import{g as W,h as U}from"./chunk-L32KHQVT.js";import{b as z,g as N,h as F,p as L,r as H,s as J,t as Q,u as _}from"./chunk-BAVRVBBX.js";import{A as j,B as R,a as T,c as b,e as E,f as M,j as C,k as K}from"./chunk-LOZLXP5G.js";import{b as S,c as I}from"./chunk-UEMWZOIU.js";import"./chunk-2XNFZXHY.js";import{f as $,h as v,k as y}from"./chunk-SHN5MT56.js";import{c as m,d as c,f as p,g as x,h as O,k as Y}from"./chunk-YVN2NZL4.js";import{a as w,b as d}from"./chunk-FFWPJP7A.js";import{i as D}from"./chunk-6DBKPC2O.js";import"./chunk-ALFFE37K.js";import"./chunk-6G6UVWJN.js";import"./chunk-5WJ6AUNY.js";var ee=new Set(["new","list","help","next","approve","done","block","reset","cancel","wontfix","reopen","revisit","split","ac","task","note","review","delegate","followup"]),te=new Set(["a","an","the","and","or","but","in","on","at","to","for","of","with","by","from","is","it","its","this","that","as","be","are","was","were","been","being","have","has","had","do","does","did","will","would","could","should","may","might","shall","can","i","we","you","they","our","my","so","if","not","no","all"]),se=n=>n.replace(/(?:~|\.{1,2})?\/(?:[\w@.-]+\/)*[\w@.-]+/g," ").replace(/(?:[\w@.-]+\/){2,}[\w@.-]+/g," ").replace(/\s+/g," ").trim(),ne=n=>{let a=se(n).toLowerCase().replace(/[^a-z0-9\s-]/g,"").split(/\s+/).filter(o=>o.length>0&&!te.has(o)).slice(0,6).join("-");return a.length>50&&(a=a.slice(0,50).replace(/-[^-]*$/,"")),a=a.replace(/^-+|-+$/g,""),a||"spec"},ie=n=>n.includes(" ")||n.length>50,re=new Map([["next",()=>import("./next-ZR6B35KN.js")],["approve",()=>import("./approve-7QQFUQ2C.js")],["done",()=>import("./done-QSQ7AMLP.js")],["block",()=>import("./block-4ISSYCGQ.js")],["reset",()=>import("./reset-F25OLGX7.js")],["cancel",()=>import("./cancel-ZRTVX5AT.js")],["wontfix",()=>import("./wontfix-SLHYAWS7.js")],["reopen",()=>import("./reopen-KFHUPFTT.js")],["review",()=>import("./review-ITFNV2TI.js")],["delegate",()=>import("./delegate-EBL5HMGD.js")],["followup",()=>import("./followup-EMQ3ZNNS.js")],["learn",()=>import("./learn-6MIAYVOR.js")]]);var De=async n=>{let e=n?.[0];if(e==="new")return await ae(n?.slice(1));if(e==="list")return await oe(n?.slice(1));if(e==="help"||e===void 0){let l=S(),r=$({renderer:y.ansi(),sink:v.stdout()});return r.writeln(`Usage: ${l} spec <new "description" | list | <name> <command>>`),r.writeln(""),r.writeln(c(" Commands for a spec:")),r.writeln(c(" next, approve, done, block, reset, cancel, wontfix, reopen, revisit, split, ac, task, note")),r.writeln(""),r.writeln(c(" Examples:")),r.writeln(c(` ${l} spec new "Add photo upload support" # name auto-generated`)),r.writeln(c(` ${l} spec new my-feature "Add upload support" # explicit name`)),r.writeln(c(` ${l} spec my-feature next`)),r.writeln(c(` ${l} spec my-feature next --answer="approve"`)),await r.close(),w(void 0)}let t=e,s=n?.[1];if(s===void 0)return await(await import("./status-KEARGELM.js")).main([`--spec=${t}`]);if(s==="split")return await ce([`--spec=${t}`,...n?.slice(2)??[]]);if(s==="revisit")return await pe([`--spec=${t}`,...n?.slice(2)??[]]);if(s==="ac")return await de(t,n?.slice(2));if(s==="task")return await ue(t,n?.slice(2));if(s==="note")return await we(t,n?.slice(2));let a=re.get(s);if(a!==void 0)return await(await a()).main([`--spec=${t}`,...n?.slice(2)??[]]);let o=$({renderer:y.ansi(),sink:v.stdout()});return o.writeln(p(`Unknown command: spec ${t} ${s}`)),o.writeln(c(" Valid: next, approve, done, block, reset, cancel, wontfix, reopen, revisit, split, ac, task, note")),await o.close(),d({exitCode:1})},ae=async n=>{let e=$({renderer:y.ansi(),sink:v.stdout()}),{root:t}=await R();if(!await j(t))return e.writeln(p("noskills is not initialized.")," Run: ",m(I("init"))),await e.close(),d({exitCode:1});let s=null,a=[];if(n!==void 0){let h=!1,g=[];for(let k of n)k.startsWith("--name=")?(s=k.slice(7),h=!0):k.startsWith("-")||g.push(k);if(h)a.push(...g);else if(g.length>=1){let k=g[0];ie(k)?a.push(...g):(s=k,a.push(...g.slice(1)))}}let o=null;if(n!==void 0)for(let h of n)h.startsWith("--from-plan=")&&(o=h.slice(12));let l=a.join(" ");if((s===null||s.length===0)&&l.length>0){s=ne(l);let h=s,g=2;for(;;){if(ee.has(h)){h=`${s}-${g}`,g++;continue}let k=`${t}/${b.specDir(h)}`;try{await D.fs.stat(k),h=`${s}-${g}`,g++}catch{break}}s=h}if(s===null||s.length===0)return e.writeln(p("Error: description is required.")),e.writeln(c("Example: "),m(`${S()} spec new "Add photo upload support"`)),await e.close(),d({exitCode:1});if(ee.has(s))return e.writeln(p(`"${s}" is a reserved name.`),c(" Choose a different spec name.")),await e.close(),d({exitCode:1});let r=/^[a-z0-9][a-z0-9-]*[a-z0-9]$/;if(s.length>50||s.length>1&&!r.test(s)||s.length===1&&!/^[a-z0-9]$/.test(s))return e.writeln(p("Invalid spec name: "),m(s)),e.writeln(c("Must be lowercase, hyphens, numbers only. Max 50 chars. Regex: /^[a-z0-9][a-z0-9-]*[a-z0-9]$/")),await e.close(),d({exitCode:1});if(l.length===0)return e.writeln(p("Please provide a description: "),m(`${S()} spec new "Add photo upload support"`)),await e.close(),d({exitCode:1});if(o!==null)try{if((await D.fs.stat(o)).size>50*1024)return e.writeln(p("Plan file too large. Maximum 50KB.")),await e.close(),d({exitCode:1})}catch{return e.writeln(p(`Plan file not found: ${o}`)),await e.close(),d({exitCode:1})}let i=`spec/${s}`,u=`${t}/${b.specDir(s)}`;try{return await D.fs.stat(u),e.writeln(p(`Spec "${s}" already exists.`),c(` Use a different --name or run \`${S()} reset --spec=${s}\` first.`)),await e.close(),d({exitCode:1})}catch{}let A=T(),f=z(A,s,i,l),P=await U(t),V=J(f,"IDLE","DISCOVERY",P);return o!==null&&(V={...f,discovery:{...f.discovery,planPath:o}}),await D.fs.mkdir(`${t}/${b.specDir(s)}`,{recursive:!0}),await C(t,s,V),await Z(t,{ts:new Date().toISOString(),type:"spec-created",spec:s,user:P?.name??"unknown",description:l??""}),e.writeln(x("\u2714")," Spec started: ",m(s)),e.writeln(" Directory: ",c(b.specDir(s))),e.writeln(" Branch: ",c(i)),e.writeln(" Phase: ",O("DISCOVERY")),o!==null&&e.writeln(" Plan: ",c(o)),e.writeln(""),e.writeln("Run ",m(I(`next --spec=${s}`))," to begin discovery questions."),await e.close(),w(void 0)},oe=async n=>{let{root:e}=await R(),t=X(n),s=await K(e),a=`${e}/${b.specsDir}`,o=new Set(s.map(i=>i.name)),l=[];for(let i of s)l.push({name:i.name,phase:i.state.phase,iteration:i.state.execution.iteration});try{for await(let i of D.fs.readDir(a))i.isDirectory&&!o.has(i.name)&&l.push({name:i.name,phase:"IDLE",iteration:0})}catch{}if(t==="json")return await B(l,"json"),w(void 0);let r=$({renderer:y.ansi(),sink:v.stdout()});if(r.writeln(m("Specs")),r.writeln(""),l.length===0)r.writeln(c(" No specs yet."));else for(let i of l){let u=i.phase==="COMPLETED"?x(i.phase):i.phase==="EXECUTING"?Y(i.phase):i.phase==="BLOCKED"?p(i.phase):O(i.phase),A=i.phase==="EXECUTING"?c(` iteration ${i.iteration}`):"";r.writeln(" ",c("\u25CB")," ",i.name," ",u,A)}return await r.close(),w(void 0)},le=n=>{let e=[],t=0;for(;t<n.length;)if(n[t]==="--into"&&t+1<n.length){let s=n[t+1],a=s;t+2<n.length&&!n[t+2].startsWith("-")?(a=n[t+2],t+=3):t+=2,e.push({name:s,description:a})}else t+=1;return e},ce=async n=>{let e=$({renderer:y.ansi(),sink:v.stdout()}),{root:t}=await R();if(!await j(t))return e.writeln(p("noskills is not initialized.")," Run: ",m(I("init"))),await e.close(),d({exitCode:1});let s=M(n??[]);if(s===null)return e.writeln(p("Error: --spec=<name> is required.")),e.writeln(c("Example: "),m(`${S()} spec split --spec=parent --into name1 "desc1" --into name2 "desc2"`)),await e.close(),d({exitCode:1});let a;try{a=await E(t,s)}catch(i){let u=i instanceof Error?i.message:String(i);return e.writeln(p(`Error: ${u}`)),await e.close(),d({exitCode:1})}if(a.phase!=="DISCOVERY"&&a.phase!=="DISCOVERY_REVIEW")return e.writeln(p(`Cannot split spec in phase ${a.phase}. Must be in DISCOVERY or DISCOVERY_REVIEW.`)),await e.close(),d({exitCode:1});let o=le(n??[]);if(o.length<2){let i=G(a.discovery.answers);if(!i.detected||i.proposals.length<2)return e.writeln(p("Error: at least 2 --into entries required, or discovery answers must contain 2+ independent areas.")),await e.close(),d({exitCode:1});let u=[];for(let f of i.proposals){let P=`${t}/${b.specDir(f.name)}`;await D.fs.mkdir(P,{recursive:!0});let q=a.discovery.answers.filter(g=>f.relevantAnswers.includes(g.questionId)),h=z(T(),f.name,`spec/${f.name}`);for(let g of q)h=N(h,g.questionId,g.answer);h=F(h),await C(t,f.name,h),u.push(f.name)}let A=L(a,"cancelled",`Split into: ${u.join(", ")}`);await C(t,s,A),e.writeln(x("Split complete."),` Created ${u.length} sub-specs:`);for(let f of u)e.writeln(" ",c("\u25CB")," ",m(f));return e.writeln("",c(`Parent spec "${s}" cancelled.`)),await e.close(),w(void 0)}let l=[];for(let i of o){let u=`${t}/${b.specDir(i.name)}`;await D.fs.mkdir(u,{recursive:!0});let f=z(T(),i.name,`spec/${i.name}`);for(let P of a.discovery.answers)f=N(f,P.questionId,P.answer);f=F(f),await C(t,i.name,f),l.push(i.name)}let r=L(a,"cancelled",`Split into: ${l.join(", ")}`);await C(t,s,r),e.writeln(x("Split complete."),` Created ${l.length} sub-specs:`);for(let i of l)e.writeln(" ",c("\u25CB")," ",m(i));return e.writeln("",c(`Parent spec "${s}" cancelled.`)),await e.close(),w(void 0)},pe=async n=>{let e=$({renderer:y.ansi(),sink:v.stdout()}),{root:t}=await R();if(!await j(t))return e.writeln(p("noskills is not initialized.")," Run: ",m(I("init"))),await e.close(),d({exitCode:1});let s=M(n??[]);if(s===null)return e.writeln(p("Error: --spec=<name> is required.")),e.writeln(c("Example: "),m(`${S()} spec revisit --spec=my-spec "reason for revisit"`)),await e.close(),d({exitCode:1});let a=(n??[]).find(i=>!i.startsWith("--")&&i!==s);if(a===void 0||a.trim().length===0)return e.writeln(p('Error: Reason is required: noskills spec revisit --spec=X "reason"')),await e.close(),d({exitCode:1});let o;try{o=await E(t,s)}catch(i){let u=i instanceof Error?i.message:String(i);return e.writeln(p(`Error: ${u}`)),await e.close(),d({exitCode:1})}if(o.phase==="DISCOVERY"||o.phase==="DISCOVERY_REVIEW"||o.phase==="SPEC_DRAFT"||o.phase==="SPEC_APPROVED")return e.writeln(p("Already in planning phase, no need to revisit.")),await e.close(),d({exitCode:1});if(o.phase==="COMPLETED")return e.writeln(p(`Spec is completed. Use \`${S()} reopen --spec=${s}\` instead.`)),await e.close(),d({exitCode:1});if(o.phase==="IDLE")return e.writeln(p("No active spec to revisit.")),await e.close(),d({exitCode:1});let l=o.execution.completedTasks.length,r=H(o,a.trim());return await C(t,s,r),e.writeln(x("Revisit complete.")),e.writeln(" Phase: ",m("DISCOVERY"),c(` (revisited from ${o.phase})`)),l>0&&e.writeln(" Previous progress: ",m(`${l} tasks completed`)),e.writeln(" Reason: ",c(`"${a.trim()}"`)),e.writeln(" Discovery answers preserved \u2014 revise or re-approve."),await e.close(),w(void 0)},de=async(n,e)=>{let t=$({renderer:y.ansi(),sink:v.stdout()}),{root:s}=await R(),a=e?.[0];if(n===void 0||a===void 0)return t.writeln(`Usage: ${S()} spec <name> ac <add "text" | list>`),await t.close(),w(void 0);if(a==="add"){let o=(e?.slice(1)??[]).filter(u=>!u.startsWith("-")).join(" ");if(o.length===0)return t.writeln(p("Please provide AC text.")),await t.close(),d({exitCode:1});let l=await E(s,n),r=await U(s);l.phase==="EXECUTING"&&t.writeln(O("Warning: Adding ACs during execution is scope creep."));let i=Q(l,o,r);return await C(s,n,i),t.writeln(x("AC added: "),`"${o}"`,c(` (by ${W(r)})`)),await t.close(),w(void 0)}if(a==="list"){let l=(await E(s,n)).customACs??[];if(t.writeln(m(`Custom ACs for ${n}`)),t.writeln(""),l.length===0)t.writeln(c(" No custom ACs."));else for(let r of l)t.writeln(` - ${r.text}`,c(` -- ${r.user}, ${r.addedInPhase}`));return await t.close(),w(void 0)}return t.writeln(`Usage: ${S()} spec <name> ac <add "text" | list>`),await t.close(),w(void 0)},ue=async(n,e)=>{let t=$({renderer:y.ansi(),sink:v.stdout()}),{root:s}=await R(),a=e?.[0];if(n===void 0||a===void 0)return t.writeln(`Usage: ${S()} spec <name> task <add "text" | list>`),await t.close(),w(void 0);if(a==="add"){let o=(e?.slice(1)??[]).filter(u=>!u.startsWith("-")).join(" ");if(o.length===0)return t.writeln(p("Please provide task text.")),await t.close(),d({exitCode:1});let l=await E(s,n);if(l.phase==="EXECUTING"||l.phase==="BLOCKED")return t.writeln(p("Cannot add tasks during execution. Use `spec revisit` to go back to discovery.")),await t.close(),d({exitCode:1});let r=await U(s),i=_(l,`[TASK] ${o}`,r);return await C(s,n,i),t.writeln(x("Task added: "),`"${o}"`,c(` (by ${W(r)})`)),await t.close(),w(void 0)}if(a==="list"){let l=((await E(s,n)).specNotes??[]).filter(r=>r.text.startsWith("[TASK] "));if(t.writeln(m(`Custom tasks for ${n}`)),t.writeln(""),l.length===0)t.writeln(c(" No custom tasks."));else for(let r of l)t.writeln(` - ${r.text.replace("[TASK] ","")}`,c(` -- ${r.user}, ${r.phase}`));return await t.close(),w(void 0)}return t.writeln(`Usage: ${S()} spec <name> task <add "text" | list>`),await t.close(),w(void 0)},we=async(n,e)=>{let t=$({renderer:y.ansi(),sink:v.stdout()}),{root:s}=await R(),a=e?.[0];if(n===void 0||a===void 0)return t.writeln(`Usage: ${S()} spec <name> note <add "text" | list>`),await t.close(),w(void 0);if(a==="add"){let o=(e?.slice(1)??[]).filter(u=>!u.startsWith("-")).join(" ");if(o.length===0)return t.writeln(p("Please provide note text.")),await t.close(),d({exitCode:1});let l=await E(s,n),r=await U(s),i=_(l,o,r);return await C(s,n,i),t.writeln(x("Note added: "),`"${o}"`,c(` (by ${W(r)})`)),await t.close(),w(void 0)}if(a==="list"){let l=((await E(s,n)).specNotes??[]).filter(r=>!r.text.startsWith("[TASK] "));if(t.writeln(m(`Notes for ${n}`)),t.writeln(""),l.length===0)t.writeln(c(" No notes."));else for(let r of l)t.writeln(` - ${r.text}`,c(` -- ${r.user}, ${r.phase}`));return await t.close(),w(void 0)}return t.writeln(`Usage: ${S()} spec <name> note <add "text" | list>`),await t.close(),w(void 0)};export{ee as RESERVED_NAMES,ie as looksLikeDescription,De as main,ne as slugFromDescription};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as R}from"./chunk-KI6473LF.js";import{a as f}from"./chunk-4KDDHQVL.js";import"./chunk-PPB6ACBB.js";import{b as O,e as S}from"./chunk-4JICYXYK.js";import"./chunk-KFVUFHJB.js";import"./chunk-NY4W44PI.js";import{a as k,d as w}from"./chunk-2ZYCRMUT.js";import{A as v,B as P,e as I,f as b,l as x,p as D}from"./chunk-LOZLXP5G.js";import{c as h}from"./chunk-UEMWZOIU.js";import"./chunk-2XNFZXHY.js";import{f as d,h as u,k as m}from"./chunk-SHN5MT56.js";import{c as i,d as r,f as c,g as C,h as p,k as y}from"./chunk-YVN2NZL4.js";import{a as l,b as E}from"./chunk-FFWPJP7A.js";import"./chunk-6DBKPC2O.js";import"./chunk-ALFFE37K.js";import"./chunk-6G6UVWJN.js";import"./chunk-5WJ6AUNY.js";var M=async g=>{let{root:n}=await P(),o=k(g);if(!await v(n)){if(o==="json")await w({error:"noskills is not initialized"},o);else{let s=d({renderer:m.ansi(),sink:u.stdout()});s.writeln(c("noskills is not initialized.")," Run: ",i(h("init"))),await s.close()}return E({exitCode:1})}let V=b(g),e=await I(n,V),t=await x(n),j={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 D(n)).filter(N=>t!==null&&t.concerns.includes(N.id)),T=await O(n),$=S(t?.tools??[]),F=await R(e,a,T,t,void 0,void 0,void 0,$);return await w({...j,...F},"json"),l(void 0)}{let s=d({renderer:m.ansi(),sink:u.stdout()});s.writeln(i(`${h("status")}`)),s.writeln("");let a=e.phase==="COMPLETED"?C(e.phase):e.phase==="BLOCKED"?c(e.phase):e.phase==="EXECUTING"?y(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{M as main};
|