noskills 4.1.49 → 4.1.53
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/README.md +345 -890
- package/chunks/{anthropic-UTLWCK66.js → anthropic-LDUWIUPL.js} +1 -1
- package/chunks/approve-ZX62EG5U.js +1 -0
- package/chunks/{ask-KPIHJIJZ.js → ask-VGI3BFZW.js} +1 -1
- package/chunks/block-ERQESYMH.js +1 -0
- package/chunks/cancel-FOVCYBQY.js +1 -0
- package/chunks/{chunk-K223KAUB.js → chunk-2GF5IUQD.js} +1 -1
- package/chunks/chunk-5CNPFLE6.js +1 -0
- package/chunks/chunk-5P46WSNG.js +5 -0
- package/chunks/{chunk-AQWB2PVR.js → chunk-5URW6X3N.js} +93 -92
- package/chunks/{chunk-7OIAMA3E.js → chunk-6YHWLEJ4.js} +26 -26
- package/chunks/chunk-AP3YBNPX.js +1 -0
- package/chunks/{chunk-OCDUS26F.js → chunk-DEIZVYT6.js} +1 -1
- package/chunks/chunk-H77MLIL5.js +4 -0
- package/chunks/{chunk-TI4CLT2V.js → chunk-HNAHPI6V.js} +1 -1
- package/chunks/chunk-JVCVWI3B.js +3 -0
- package/chunks/{chunk-ESTTTPON.js → chunk-KYQ77E7T.js} +1 -1
- package/chunks/{chunk-JCIANZPY.js → chunk-LBPD4EIH.js} +1 -1
- package/chunks/chunk-OKM4FE4G.js +1 -0
- package/chunks/chunk-OVLGUKPG.js +1 -0
- package/chunks/chunk-PKYW3S5P.js +5 -0
- package/chunks/chunk-RGGYSKJY.js +5 -0
- package/chunks/chunk-RJX4ZXQ4.js +2 -0
- package/chunks/{chunk-WWPJMOT3.js → chunk-SVJVJDZR.js} +1 -1
- package/chunks/chunk-UG26APX2.js +3 -0
- package/chunks/{chunk-2X2U2VC5.js → chunk-UT6ZCLRA.js} +1 -1
- package/chunks/chunk-XNGHRJVK.js +1 -0
- package/chunks/{chunk-CLCZ7IO3.js → chunk-YSSDQJTT.js} +1 -1
- package/chunks/chunk-YTNM7A5Y.js +3 -0
- package/chunks/chunk-Z3O5HAIO.js +2 -0
- package/chunks/claude-code-BWCSAVK2.js +1 -0
- package/chunks/{cmd-NWSNAUKC.js → cmd-ZXO6KFK6.js} +1 -1
- package/chunks/concern-2PON4VPG.js +1 -0
- package/chunks/{config-EPT7NOOO.js → config-CZDLCSOC.js} +1 -1
- package/chunks/delegate-VRPCGUT2.js +1 -0
- package/chunks/diagrams-D5CYTTWA.js +1 -0
- package/chunks/diagrams-I2QKL7WR.js +1 -0
- package/chunks/done-WQDGQZ5D.js +1 -0
- package/chunks/followup-Q3RLSNNM.js +1 -0
- package/chunks/free-R4ZTZ76O.js +1 -0
- package/chunks/init-HTCNOWTZ.js +1 -0
- package/chunks/invoke-hook-675IUCLN.js +13 -0
- package/chunks/kiro-RGYUKJAX.js +3 -0
- package/chunks/learn-MWUFAR2G.js +7 -0
- package/chunks/{list-FWRKOILC.js → list-6EQP6VUL.js} +1 -1
- package/chunks/manager-Q7DRXNNO.js +6 -0
- package/chunks/{mod-LORCBZWH.js → mod-A77UWGGG.js} +1 -1
- package/chunks/mod-TYCXSLSH.js +1 -0
- package/chunks/next-7W4YVHSZ.js +7 -0
- package/chunks/{ollama-VSBCL6RB.js → ollama-LTZ43OHQ.js} +1 -1
- package/chunks/opencode-PZDL7VDP.js +1 -0
- package/chunks/pack-DXWS4PMA.js +5 -0
- package/chunks/{purge-573OIQZI.js → purge-XZ5EOCFP.js} +1 -1
- package/chunks/reopen-VATALF56.js +1 -0
- package/chunks/reset-BL73UVLM.js +1 -0
- package/chunks/review-VF6JOTLX.js +1 -0
- package/chunks/rule-ODX4WMCS.js +6 -0
- package/chunks/run-J5Z6R4DP.js +3 -0
- package/chunks/{sdk-LHBUQS75.js → sdk-6IMATOQ3.js} +8 -8
- package/chunks/session-DFMI2GCC.js +1 -0
- package/chunks/spec-3PAUTPIT.js +1 -0
- package/chunks/status-5JHFFTMD.js +1 -0
- package/chunks/sync-CVEZ4FMQ.js +1 -0
- package/chunks/watch-I7Q3AEAQ.js +8 -0
- package/chunks/web-JOWEH622.js +1 -0
- package/chunks/wontfix-CJMNFDCG.js +1 -0
- package/noskills.js +1 -1
- package/package.json +1 -1
- package/chunks/approve-LCVVXAE3.js +0 -1
- package/chunks/block-MNFFAMEP.js +0 -1
- package/chunks/cancel-M3G3XXMU.js +0 -1
- package/chunks/chunk-4N7N37OY.js +0 -1
- package/chunks/chunk-MSJSMJL2.js +0 -1
- package/chunks/chunk-NLLZQP64.js +0 -1
- package/chunks/chunk-NRCHLNQA.js +0 -3
- package/chunks/chunk-ON7NJA2P.js +0 -3
- package/chunks/chunk-RMCTOOQL.js +0 -1
- package/chunks/chunk-RTD42HPS.js +0 -2
- package/chunks/chunk-U3JLX6DY.js +0 -1
- package/chunks/chunk-Y2PH2BTY.js +0 -16
- package/chunks/claude-code-R7PCCNRZ.js +0 -1
- package/chunks/concern-NQODAEHU.js +0 -1
- package/chunks/done-XDWNPZVT.js +0 -1
- package/chunks/free-MXG3ZUQY.js +0 -1
- package/chunks/init-NJ7KI65T.js +0 -1
- package/chunks/invoke-hook-D6BRYBNY.js +0 -11
- package/chunks/kiro-3VFHKARM.js +0 -3
- package/chunks/manager-BIVHW3S7.js +0 -6
- package/chunks/next-LQLZL4LN.js +0 -8
- package/chunks/opencode-YE3RKOY7.js +0 -1
- package/chunks/pack-5U7QBA2H.js +0 -5
- package/chunks/reopen-IR7FAPQE.js +0 -1
- package/chunks/reset-XY2HW67W.js +0 -1
- package/chunks/rule-YI5GBUAS.js +0 -6
- package/chunks/run-B6BBYCQM.js +0 -3
- package/chunks/session-5BLO37XK.js +0 -1
- package/chunks/spec-W52NAT6U.js +0 -1
- package/chunks/status-DJZSCXLA.js +0 -1
- package/chunks/sync-A44KPO5R.js +0 -1
- package/chunks/watch-I7NEY7YJ.js +0 -8
- package/chunks/wontfix-JULEBOGK.js +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{d as j,e as K}from"./chunk-PKYW3S5P.js";import{a as J}from"./chunk-7UX6WIXX.js";import{b as _,c as X}from"./chunk-OVLGUKPG.js";import{a as W,d as F,e as M,g as H}from"./chunk-DEIZVYT6.js";import{c as z}from"./chunk-UT6ZCLRA.js";import{i as Q}from"./chunk-XNGHRJVK.js";var O=e=>z(e),o=(e,t)=>O(t===null?e:`spec ${t} ${e}`),re="NEVER run git write commands (commit, add, push, checkout, stash, reset, merge, rebase, cherry-pick). Git is read-only for agents. The user controls git. You may read: git log, git diff, git status, git show, git blame.",se={hasAskUserTool:!0,optionPresentation:"tool",hasSubAgentDelegation:!0,subAgentMethod:"task"},oe=(e,t,n,s,r=se)=>{let c=e.execution.iteration>=t,m=r.hasAskUserTool?"Use AskUserQuestion for all decision points.":"Present options as a numbered list at every decision point.",a=[];n||a.push(re),a.push("Report progress honestly. Not done = 'not done'. Partial = 'partial: [works]/[doesn't]'. Untested = 'untested'. 4 of 6 = '4 of 6 done, 2 remaining'.",`Never skip steps or infer decisions. ${m} Recommend first, then ask. One noskills call per interaction \u2014 never batch-submit or backfill.`,"Display `roadmap` before other content. Display `gate` prominently.","NEVER suggest bypassing, skipping, or 'breaking out of' noskills. Discovery helps the user \u2014 it is not an obstacle. If scope changes: revise spec, reset and create new, or split.","NEVER ask permission to run the next noskills command. After spec new \u2192 run next immediately. After answering questions \u2192 run next. After approve \u2192 run next. After task completion \u2192 run next. The workflow is sequential \u2014 each step has one next step. Just run it.",'Discovery questions are adaptive. After each answer, generate 1-3 follow-up questions if the answer reveals ambiguity, risk, dependencies, or missing detail. Submit follow-ups via `noskills spec <name> followup <questionId> "question"`. Max 3 per question. Do NOT rush through discovery.',"Confidence scoring: every technical finding needs a confidence score (1-10). 9-10: verified (read code, ran test). 7-8: strong evidence. 5-6: reasonable inference. 3-4: guess. 1-2: speculation. State basis ('read X', 'inferred from Y'). If confidence < 5, prefix with '\u26A0 Unverified:'.");let v=s?.outOfScope??[],w=e.spec;switch(e.phase){case"IDLE":{let d=r.optionPresentation==="tool"?"Pass interactiveOptions DIRECTLY to AskUserQuestion options array (header max 12 chars). Use commandMap to resolve selections. For availableConcerns: AskUserQuestion with multiSelect:true, max 4 per question \u2014 split across questions if needed. Present ALL concerns.":"Present interactiveOptions as numbered list. Use commandMap to resolve selections. Present ALL availableConcerns as numbered list for multiselect.";return{rules:["If the user described a feature/bug/task, create a spec immediately: `noskills spec new \"description\"` \u2014 name is auto-generated. Do NOT present menus or ask 'What would you like to do?' unless the conversation has no prior context.",...a,d,"Encourage full context: 'Tell me what you want to build \u2014 one-liner, detailed requirements, meeting notes, anything.' Slug is auto-generated. Pass full text to `noskills spec new \"...\"`.","After spec new, ask: full discovery, quick discovery, or skip to spec draft. Never skip without asking.","Every task gets a spec. No exceptions. A one-liner fix, a config change, a 'simple' refactor \u2014 all get specs. The spec can be short but it must exist. 'Too simple for a spec' is the anti-pattern."],tone:"Welcoming. Present choices, then wait."}}case"DISCOVERY":{let d=r.hasAskUserTool?"Ask each question via AskUserQuestion. One question per call.":"Ask one question at a time as text.";return{modeOverride:"plan mode. DO NOT create, edit, or write any files. DO NOT run state-modifying commands. MAY read files and run read-only commands (cat, ls, grep, git log, git diff).",rules:[...a,`${d} Never answer questions yourself. Never submit answers without user confirmation. Pre-fill suggested answers from detailed descriptions \u2014 user must confirm each. With a fully formed plan, skip questions but MUST run premise challenge and alternatives.`,"DO NOT create, edit, or write any files.","DO NOT run shell commands that modify state.","You MAY read files and run read-only commands (cat, ls, grep, git log, git diff).","Pre-discovery: (1) pre-discovery codebase scan \u2014 read README, CLAUDE.md, design docs, last 20 commits, TODOs, existing specs, directory structure. Present a brief audit summary. (2) If `preDiscoveryResearch.required`, web-search every `extractedTerms` entry \u2014 report versions, API changes, deprecations. (3) Ask discovery mode: A) Explore scope B) Technical depth C) Validate my plan D) Ship fast. Adapt emphasis accordingly.","Before starting discovery questions, challenge the user's initial spec description against codebase findings. Flag: hidden complexity, conflicts with existing code, scope mismatch, overlapping modules. Ask clarifying follow-ups.","When asking questions, offer concrete options from codebase knowledge alongside the open-ended question (e.g., 'I see three scenarios: A)... B)... C)... D) Something else'). Push back on vague answers. Follow up on short answer with 'Can you be more specific?'","After answers, synthesize CURRENT STATE \u2192 THIS SPEC \u2192 6-MONTH IDEAL vision. Then: (1) expansion opportunities as numbered proposals with effort (S/M/L/XL), risk, completeness delta \u2014 options: Add/Defer/Skip. (2) Architectural decisions that BLOCK implementation \u2014 present with options, RECOMMENDATION, completeness scores. Unresolved = risk flag. (3) Error/rescue map: codepath | failure mode | handling. Flag CRITICAL GAPS as decisions.","Present DISCOVERY SUMMARY for confirmation: intent, scope, dream state, expansions, architectural decisions, error map. Ask for confirmation before generating spec. Submit all answers together in one `noskills next --answer` JSON call."],tone:"Curious interviewer with a stake in the answers. Comes PREPARED \u2014 read the codebase first. Challenge assumptions, think about architecture and failure modes."}}case"DISCOVERY_REVIEW":return{modeOverride:"You are in plan mode. Do not create, edit, or write any files. Present the discovery answers to the user for review and confirmation.",rules:[...a,"DO NOT create, edit, or write any files.","Present ALL discovery answers to the user clearly, one by one.",r.hasAskUserTool?"Use AskUserQuestion to ask: 'Are these answers correct, or would you like to revise any?'":"Ask the user: 'Are these answers correct, or would you like to revise any?' Present approval and revision as numbered options.","If the user approves, run the approve command.","If the user wants to revise, collect their corrections and submit them.","You MUST NOT approve on behalf of the user. The user must explicitly confirm.","If noskills output contains a splitProposal, present it to the user with the exact options shown. Do NOT split or merge specs on your own. Do NOT recommend one option over the other unless the user asks for your opinion. The user decides."],tone:"Careful reviewer. The user must confirm every answer."};case"SPEC_DRAFT":{let d=e.discovery.delegations??[],h=[];if(d.length>0){let l=d.filter(u=>u.status==="pending"),g=d.filter(u=>u.status==="answered"),b=d.map(u=>`- ${u.questionId}: delegated to ${u.delegatedTo} \u2014 ${u.status==="answered"?"ANSWERED \u2713":"PENDING"}`);h.push(`DELEGATION STATUS:
|
|
2
|
+
${b.join(`
|
|
3
|
+
`)}${l.length>0?`
|
|
4
|
+
Approve BLOCKED \u2014 ${l.length} pending delegation(s).`:`
|
|
5
|
+
All ${g.length} delegation(s) answered. Approve is allowed.`}`)}return{modeOverride:"plan mode. DO NOT create, edit, or write any files. DO NOT run state-modifying commands. MAY read files and run read-only commands.",rules:[...a,...h,"DO NOT create, edit, or write any files.","Read the spec and present a summary to the user.","Flag any tasks that are too vague to execute.","Flag any missing acceptance criteria.","No placeholders in specs. If a task has 'TBD', 'TODO', 'to be determined', 'details to follow', or 'implement appropriate X' \u2014 fill in the detail or remove the task and add it as an open question.","Ask the user if they want to refine before approving.",r.hasAskUserTool?"When presenting classification options, use AskUserQuestion with multiSelect:true. Do NOT infer classification yourself.":"When presenting classification options, present them as a numbered list with multiselect (user picks multiple numbers). Do NOT infer classification yourself.","When generating or refining tasks, include a 'Files:' hint listing likely files to create/modify. Format: 'Files: `path/to/file.ts`, `path/to/other.ts`'. Hints, not constraints \u2014 helps sub-agents load right context.","If you identify issues in the spec (vague tasks, irrelevant sections, missing acceptance criteria), submit a refinement via: `"+o(`next --answer='{"refinement":"task-1: Add upload endpoint, task-2: Add validation middleware, task-3: Write integration tests"}'`,w)+"`. The spec will be updated and you can review again."],tone:"Thoughtful reviewer preparing to hand off to an implementer."}}case"SPEC_APPROVED":return{rules:[...a,"The spec is approved but execution has not started.","Do not start coding until the user triggers execution.","If the user wants changes, they must reset and re-spec.",r.hasAskUserTool?"Before starting execution, show the spec summary to the user and ask for final confirmation via AskUserQuestion.":"Before starting execution, show the spec summary to the user and ask for final confirmation. Present 'Start execution' and 'Not yet' as numbered options."],tone:"Patient. Wait for the go signal."};case"EXECUTING":{let d=o(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`,w),h,l,g="Verifier scope: (1) AC verification with evidence. (2) Plan alignment \u2014 does implementation match task description? Flag deviations. (3) Code quality \u2014 follows existing patterns? Flag style breaks, missing error handling. Categorize findings: CRITICAL (blocks completion), IMPORTANT (should fix), SUGGESTION (nice to have).";r.subAgentMethod==="task"?(h=`Spawn noskills-executor via Agent tool. Pass: task title, description, ACs, rules, scope constraints, concern reminders, file paths. Report via \`${d}\`.`,l=`After executor completes, spawn noskills-verifier with changed files + ACs + test commands. Never trust executor self-report alone. ${g}`):r.subAgentMethod==="spawn"?(h=`Use spawn_agent for noskills-executor. Pass: task, ACs, rules, scope, file paths. Use wait_agent to collect. Report via \`${d}\`.`,l=`After executor completes, spawn noskills-verifier with changed files + ACs + test commands. ${g}`):r.subAgentMethod==="fleet"?(h=`Use /fleet for parallel executors. Pass each: task, ACs, rules, scope, file paths. Report via \`${d}\`.`,l=`After fleet completes, run verification pass. ${g}`):r.subAgentMethod==="delegation"?(h=`Use Kiro agent delegation for noskills-executor. Pass: task, ACs, rules, scope, file paths. Report via \`${d}\`.`,l=`After executor completes, delegate to noskills-verifier with changed files + ACs + test commands. ${g}`):(h=`Execute tasks sequentially yourself. Verify (type-check + tests) after each. Report via \`${d}\`.`,l="");let b=r.subAgentMethod!=="none",u=b?`You are the orchestrator. NEVER edit files directly \u2014 delegate ALL edits to noskills-executor. ${h} On sub-agent failure, fall back to direct execution and note it in status.`:h,I=[...a,u,...l?[l]:[],"Do not explore beyond current task. Do not refactor outside scope. Do not add features, tests, or docs not in the spec. timebox context reads \u2014 the deliverable is working code.",...b?["Show a dispatch table: | Step | Agent | Files | Tasks | Est. |. Separate executor for implementation vs tests. Batch tightly-coupled files; parallelize independent modules."]:[],"Edit discipline: (1) Re-read file before editing. (2) Re-read after to confirm. (3) Files >500 LOC: read in chunks. (4) Run type-check + lint after edits \u2014 never mark AC passed if type-check fails. (5) If search returns few results, re-run narrower \u2014 assume truncation.",`On recurring patterns or corrections, ask: 'Permanent rule or just this task?' If permanent: \`${O('rule add "<description>"')}\`. Never write to \`.eser/rules/\` directly.`,"Before structural refactors on files >300 LOC, remove dead code first. Do NOT suggest pausing or stopping mid-spec \u2014 execute to completion. The user decides when to stop.","RATIONALIZATION ALERT: Never use 'should work now', 'looks correct', 'I'm confident', 'seems right', 'probably passes'. Run the command, read the output, report what happened. Evidence, not belief.","TDD: (1) Write test. (2) Run it \u2014 MUST fail. If it passes before implementation, the test is wrong. (3) Implement. (4) Run test \u2014 must pass. Skipping step 2 means the test is unverified.","Parallel vs serial sub-agents: PARALLEL when tasks touch different files with no shared state. SERIAL when tasks modify same files or depend on each other. When unsure, default to serial."];e.execution.lastVerification?.passed===!1&&I.push("Tests are failing. Fix ONLY the failing tests. Do not refactor passing code.");let f={rules:I,tone:"Direct. Orchestrate immediately \u2014 spawn sub-agents.",outOfScope:v.length>0?v:void 0};return c?{...f,urgency:`${e.execution.iteration}+ iterations \u2014 context degrading. Finish current task, recommend fresh session.`}:f}case"BLOCKED":return{rules:[...a,"Present the decision to the user exactly as described.","Do not suggest a preferred option unless the user asks for your opinion.","After the user decides, relay the answer immediately. Do not elaborate."],tone:"Brief. The user is making a decision, not having a discussion."};case"COMPLETED":return{rules:[...a,"Report the completion summary. Do not start new work.","If the user wants to continue, they start a new spec."],tone:"Concise. Celebrate briefly, then stop."};default:return{rules:[...a,`Run \`${o("next",w)}\` to get your instructions.`,"Do not take action without noskills guidance."],tone:"Neutral. Waiting for direction."}}},ie=5*60*1e3,ae=(e,t)=>{let n=e.spec,s;switch(e.phase){case"IDLE":s=`No active spec. Start one with: \`${O('spec new --name=<slug> "description"')}\``;break;case"DISCOVERY":s=`Discovery in progress for "${e.spec}". ${e.discovery.answers.length} questions answered so far.`;break;case"DISCOVERY_REVIEW":s=`Discovery answers ready for review. ${e.discovery.answers.length} answers collected. Waiting for user confirmation.`;break;case"SPEC_DRAFT":s=`Spec draft ready for review at ${e.specState.path}. Waiting for approval.`;break;case"SPEC_APPROVED":s=`Spec "${e.spec}" is approved. Waiting to start execution.`;break;case"EXECUTING":s=e.execution.lastProgress!==null?`Executing "${e.spec}", iteration ${e.execution.iteration}. Last progress: ${e.execution.lastProgress}. Continue with the current task.`:`Executing "${e.spec}", iteration ${e.execution.iteration}. Start the first task.`;break;case"BLOCKED":s=`Execution blocked: ${e.execution.lastProgress}. Ask the user to resolve.`;break;case"COMPLETED":s=`Spec "${e.spec}" completed in ${e.execution.iteration} iterations.`;break;default:s=`Run \`${o("next",n)}\` to get started.`}return{protocol:`Run \`${o('next --answer="..."',n)}\` to submit results and advance`,spec:e.spec,branch:e.branch,iteration:e.execution.iteration,lastProgress:e.execution.lastProgress,activeConcerns:t.map(r=>r.id),resumeHint:s}},le=e=>{let t=e.spec;if(e.lastCalledAt===null)return{what:"noskills orchestrates your work: IDLE \u2192 DISCOVERY \u2192 DISCOVERY_REVIEW \u2192 SPEC_DRAFT \u2192 SPEC_APPROVED \u2192 EXECUTING \u2192 DONE \u2192 IDLE",how:`Run \`${o("next",t)}\` for instructions. Submit results with \`${o('next --answer="..."',t)}\`. Never make architectural decisions without asking.`,currentPhase:e.phase};let n=new Date(e.lastCalledAt).getTime();if(Date.now()-n>ie)return{what:"noskills orchestrates your work: IDLE \u2192 DISCOVERY \u2192 DISCOVERY_REVIEW \u2192 SPEC_DRAFT \u2192 SPEC_APPROVED \u2192 EXECUTING \u2192 DONE \u2192 IDLE",how:`Run \`${o("next",t)}\` for instructions. Submit results with \`${o('next --answer="..."',t)}\`. Never make architectural decisions without asking.`,currentPhase:e.phase}},Z=[{key:"IDLE",label:"IDLE"},{key:"DISCOVERY",label:"DISCOVERY"},{key:"DISCOVERY_REVIEW",label:"REVIEW"},{key:"SPEC_DRAFT",label:"DRAFT"},{key:"SPEC_APPROVED",label:"APPROVED"},{key:"EXECUTING",label:"EXECUTING"},{key:"COMPLETED",label:"DONE"},{key:"IDLE_END",label:"IDLE"}],ce=e=>e==="BLOCKED"?Z.map(t=>t.key==="EXECUTING"?"[ EXECUTING (BLOCKED) ]":t.label).join(" \u2192 "):Z.map(t=>t.key==="IDLE"&&e==="IDLE"?"[ IDLE ]":t.key===e?`[ ${t.label} ]`:t.label).join(" \u2192 "),de=(e,t)=>{switch(e.phase){case"DISCOVERY_REVIEW":return{message:`${e.discovery.answers.length}/6 answers collected.`,action:"Type APPROVE to generate spec, or REVISE to correct answers.",phase:"DISCOVERY_REVIEW"};case"SPEC_APPROVED":return{message:`Spec approved. ${t?.tasks?.length??0} tasks ready.`,action:"Type START to begin execution.",phase:"SPEC_APPROVED"};default:return}},$e=async(e,t,n,s,r,c,m,a,v,w,d)=>{let h=ae(e,t),l=s?.maxIterationsBeforeRestart??15,g=s?.allowGit??!1,b=a??se,u=oe(e,l,g,r,b);if(e.phase==="EXECUTING"){let x=w??0,A=M(t).tier2.length,y=x+A;y>0&&(u={...u,tier2Summary:`${y} file-specific rules delivered via PreToolUse hook when editing matching files.`})}let I=le(e),f;switch(e.phase){case"IDLE":f=ee(t,W,n.length,m);break;case"DISCOVERY":f=await we(e,t,n,v,d);break;case"DISCOVERY_REVIEW":f=be(e,t);break;case"SPEC_DRAFT":f=ke(e);break;case"SPEC_APPROVED":f=xe(e);break;case"EXECUTING":f=Re(e,t,n,l,r,c);break;case"BLOCKED":f=Ie(e);break;case"COMPLETED":f=await Ae(e,d);break;default:f=ee(t,W,n.length,m)}let L=ce(e.phase),S=de(e,r),E={...f,meta:h,behavioral:u,roadmap:L};S!==void 0&&(E={...E,gate:S}),I!==void 0&&(E={...E,protocolGuide:I});let p=ue(e,t,m);if(p.length>0){let x=p.map(({label:T,description:R})=>({label:T,description:R})),A={};for(let T of p)A[T.label]=T.command;let y=b.optionPresentation==="tool"?"AskUserQuestion":"prose-numbered-list",C=b.optionPresentation==="tool"?"Use AskUserQuestion tool to present these options. Do NOT use prose.":"Present options as a numbered list. Ask user to pick a number.";E={...E,interactiveOptions:x,commandMap:A,toolHint:y,toolHintInstruction:C}}return E},ue=(e,t,n)=>{let s=e.spec;switch(e.phase){case"IDLE":{let r=[],m=(n?.existingSpecs??[]).filter(a=>a.phase!=="COMPLETED");t.length===0&&r.push({label:"Add concerns (Recommended)",description:"Shape how discovery and specs work by adding project concerns",command:O("concern add <id> [<id2> ...]")}),r.push({label:"Start a new spec",description:"Tell me what you want to build \u2014 a one-liner, detailed requirements, meeting notes, anything",command:O('spec new "description"')});for(let a of m.slice(0,2))r.push({label:`Continue: ${a.name} (${a.phase})`,description:a.detail??`Iteration ${a.iteration}`,command:o("next",a.name)});return t.length>0&&r.push({label:"Edit concerns",description:`Currently: ${t.map(a=>a.id).join(", ")}`,command:O("concern list")}),r.slice(0,4)}case"DISCOVERY_REVIEW":return e.discovery.approved?[{label:"Keep as one spec",description:"All work in a single spec",command:o('next --answer="keep"',s)},{label:"Split into separate specs",description:"Create one spec per independent area",command:o('next --answer="split"',s)}]:[{label:"Approve all answers",description:"Answers look correct \u2014 generate the spec",command:o('next --answer="approve"',s)},{label:"Revise answers",description:"Correct one or more discovery answers",command:o(`next --answer='{"revise":{...}}'`,s)}];case"SPEC_DRAFT":return[{label:"Approve spec",description:"Review looks good \u2014 approve and move to execution",command:o("approve",s)},{label:"Refine spec",description:"Submit refinements to improve tasks or sections",command:o(`next --answer='{"refinement":"..."}'`,s)},{label:"Save for later",description:"Keep the draft as-is. Others can review, add ACs, notes, or tasks. Come back anytime to approve.",command:o('next --answer="save"',s)},{label:"Start over",description:"Reset the spec and start fresh",command:o("reset",s)}];case"SPEC_APPROVED":return[{label:"Start execution",description:"Begin implementing the tasks",command:o('next --answer="start"',s)},{label:"Save for later",description:"Spec is approved but don't start execution yet. Others can still add ACs or notes.",command:o('next --answer="save"',s)}];case"EXECUTING":return[];case"BLOCKED":return[{label:"Resolve block",description:"Provide a resolution to unblock execution",command:o('next --answer="resolution"',s)},{label:"Reset spec",description:"Abandon this spec and start over",command:o("reset",s)}];case"COMPLETED":return[{label:"New spec",description:"Start a new feature spec",command:O('spec new --name=<slug> "description"')},{label:"Reopen spec",description:"Reopen this spec for revision",command:o("reopen",s)},{label:"Check status",description:"Review completed spec summary",command:O("status")}];default:return[]}},pe="noskills is a state-machine orchestrator that acts as a scrum master for both you and your agent \u2014 keeping work focused, decisions in your hands, and tokens efficient.",ee=(e,t,n,s)=>({phase:"IDLE",instruction:'No active spec. If the user described what they want, run `noskills spec new "description"` immediately \u2014 name is auto-generated. Present ALL available concerns (split across multiple calls if needed).',welcome:pe,existingSpecs:s?.existingSpecs??[],availableConcerns:t.map(r=>({id:r.id,description:r.description})),activeConcerns:e.map(r=>r.id),activeRulesCount:s?.rulesCount??n,behavioralNote:"These options are fallbacks. If the user already described what they want, act on it directly without presenting these options.",hint:e.length===0?"No concerns active. Consider adding concerns first \u2014 they shape discovery questions and specs.":void 0}),me=/\b(Node\.?js|Deno|Bun|Go|Rust|Python|Ruby|Java|Kotlin|Swift|PHP|React|Vue|Angular|Svelte|Next\.?js|Nuxt|Remix|Astro|SolidJS|Qwik|TypeScript|Webpack|Vite|esbuild|Rollup|Terraform|Docker|Kubernetes|PostgreSQL|MySQL|Redis|MongoDB|SQLite|Prisma|Drizzle|gRPC|GraphQL|tRPC)\s+v?(\d+(?:\.\d+)?(?:\.\d+)?\+?)\b/gi,he=e=>{if(e===null||e.length===0)return[];let t=[],n,s=new RegExp(me.source,"gi");for(;(n=s.exec(e))!==null;)t.push(`${n[1]} ${n[2]}`);return t},te=e=>{let t=he(e);if(t.length!==0)return{required:!0,instruction:"Before asking discovery questions, research the current state of all platforms, runtimes, libraries, and APIs mentioned in the spec description. Use web search and Context7 MCP if available. Report findings as a pre-discovery brief to the user. Do NOT assume your training data is current \u2014 versions change, APIs get added, features get deprecated.",extractedTerms:t}},ye=50*1024,ne=async e=>{if(e!==null)try{let t=await Q.fs.readTextFile(e);return t.length>ye?void 0:{provided:!0,content:t,instruction:"A plan document was provided. Read it carefully, extract relevant information for each discovery question, and present pre-filled answers for user review. Do NOT skip any question \u2014 present your extraction and let the user confirm, correct, or expand. IMPORTANT: When extracting answers from the plan, mark each extraction as [STATED] (directly written in the plan) or [INFERRED] (your interpretation). Present extractions individually for confirmation."}}catch{return}},ge=e=>{let t=[],n=e.toLowerCase(),s=["websocket","graphql","grpc","redis","postgres","mongodb","kafka","rabbitmq","docker","kubernetes","lambda","s3"];for(let r of s)n.includes(r)&&t.push(`Answer mentions ${r} \u2014 consider: error handling, versioning, fallback strategy`);return(n.includes("should work")||n.includes("standard approach")||n.includes("probably")||n.includes("i think")||n.includes("not sure"))&&t.push("Answer is vague \u2014 ask for specifics"),(n.includes("and also")||n.includes("we might")||n.includes("could also")||n.includes("maybe we should"))&&t.push("Scope expansion signal \u2014 clarify if in scope or deferred"),(n.includes("tricky")||n.includes("complicated")||n.includes("risky")||n.includes("not sure about"))&&t.push("Risk signal \u2014 dig deeper into what makes it risky"),(n.includes("depends on")||n.includes("after")||n.includes("blocked by")||n.includes("waiting for"))&&t.push("Dependency detected \u2014 clarify what happens if dependency isn't ready"),(n.includes("real-time")||n.includes("scalab")||n.includes("performance")||n.includes("latency")||n.includes("concurrent"))&&t.push("Performance/scale mention \u2014 ask about limits, degradation, monitoring"),t},fe=e=>{switch(e){case"full":return["Ask each discovery question as written. Push for specific, concrete answers.","If the answer is vague, ask follow-up questions before accepting."];case"validate":return["The user has a plan. Your job is to challenge it, not explore it.","For each question, identify assumptions and ask: 'What would prove this wrong?'","If the description already answers a question, present your understanding and ask to confirm.","When pre-filling answers from a rich description, plan, or prior discussion, DISTINGUISH between what the user EXPLICITLY STATED and what you INFERRED. Format each pre-filled item as: '[STATED] GPU skinning in all 3 renderers \u2014 you said this during technical discussion' or '[INFERRED] tangent space is 10-star scope \u2014 I assumed this based on complexity'. The user confirms stated items and corrects inferred items.","Present pre-filled answers ONE ITEM AT A TIME for confirmation, not as a completed block. The user's job is to correct your inferences, not rubber-stamp your summary. If you pre-fill 5 items and 2 are wrong, the user must be able to catch them individually."];case"technical-depth":return["Focus on architecture, data flow, performance, and integration points.","Before each question, scan the codebase for related implementations.","Ask: 'How does this interact with [existing system]?' for each integration point."];case"ship-fast":return["Focus on minimum viable scope.","For each question, also ask: 'What can we defer to a follow-up?'","Push for the smallest version that delivers value."];case"explore":return["Think bigger. What's the 10x version?","For each question, ask about adjacent opportunities.","Suggest possibilities the user might not have considered."]}},ve=(e,t)=>{let n=new Map;for(let s of e){let r="user"in s?s.user:"Unknown User";t!==void 0&&r===t.name||n.set(r,(n.get(r)??0)+1)}return[...n.entries()].map(([s,r])=>({name:s,contributions:`${r} answer${r>1?"s":""}`}))},we=async(e,t,n,s,r)=>{let c=e.spec,m=_(t),a=e.discovery.answers.length,v=X(e.discovery.answers),w=e.discovery.audience==="agent",d=ve(e.discovery.answers,s),h=(e.specNotes??[]).filter(i=>!i.text.startsWith("[TASK] ")).map(i=>({text:i.text,user:i.user})),l={...s!==void 0?{currentUser:s}:{},...d.length>0?{previousContributors:d}:{},...h.length>0?{notes:h}:{}},g=e.specDescription!==null&&e.specDescription.length>0,b=e.discovery.planPath!==null,u=e.discovery.mode;if(u===void 0&&g&&a===0&&!b){let k={phase:"DISCOVERY",instruction:"Before starting discovery, select the discovery mode that best fits this spec.",questions:[],answeredCount:0,context:{rules:n,concernReminders:F(t)},transition:{onComplete:o('next --answer="<mode>"',c)},modeSelection:{required:!0,instruction:"Select the discovery mode.",options:[{id:"full",label:"Full discovery",description:"Standard 6 questions with all concern extras. Default for new features."},{id:"validate",label:"Validate my plan",description:"I already know what I want \u2014 challenge my assumptions, find gaps."},{id:"technical-depth",label:"Technical depth",description:"Focus on architecture, data flow, performance, integration points."},{id:"ship-fast",label:"Ship fast",description:"Minimum viable scope. What can we defer? What's the MVP?"},{id:"explore",label:"Explore scope",description:"Think bigger. 10x version? Adjacent opportunities? What are we missing?"}]}};if(r!==void 0)try{let P=await j(r,e.specDescription??"");P.length>0&&(k={...k,previousLearnings:K(P)})}catch{}return s!==void 0?{...k,currentUser:s}:k}let I=e.discovery.premisesCompleted===!0;if(u!==void 0&&!I&&!v){let i={phase:"DISCOVERY",instruction:"Before asking discovery questions, challenge the premises of this spec.",questions:[],answeredCount:0,context:{rules:n,concernReminders:F(t)},transition:{onComplete:o(`next --answer='{"premises":[...]}'`,c)},premiseChallenge:{required:!0,instruction:"Read the spec description"+(e.discovery.planPath!==null?" and the plan document":"")+'. Identify 2-4 premises the spec assumes. Present each premise and ask the user to agree or disagree. Submit as JSON: {"premises":[{"text":"...","agreed":true/false,"revision":"..."}]}',prompts:["Is this the right problem to solve? Could a different framing yield a simpler solution?","What happens if we do nothing? Is this a real pain point or a hypothetical one?","What existing code already partially solves this? Can we build on it instead?"]}};return s!==void 0?{...i,currentUser:s}:i}let f=u!==void 0?fe(u):[],L=[...n,...f],S=e.specDescription??"",E=S.length>500,p=e.discovery.premises??[],x=p.filter(i=>i.agreed).map(i=>i.text),A=p.filter(i=>!i.agreed&&i.revision!==void 0).map(i=>({original:i.text,revision:i.revision}));if(v){let i=e.revisitHistory??[],k=i.length>0?i[i.length-1]:null,P={phase:"DISCOVERY",instruction:k!==null?"This spec was revisited from EXECUTING. All previous answers are preserved. Review and approve, or revise answers before regenerating the spec.":`All discovery questions answered. Run: \`${o("approve",c)}\``,questions:[],answeredCount:a,context:{rules:n,concernReminders:[]},transition:{onComplete:o("approve",c)},...l};if(k!=null){let $=k;return{...P,revisited:!0,revisitReason:$.reason,previousProgress:{completedTasks:[...$.completedTasks],totalTasks:$.completedTasks.length}}}return P}if(w){let i=e.discovery.currentQuestion,k=m[i];if(k===void 0)return{phase:"DISCOVERY",instruction:`All discovery questions answered. Run: \`${o("approve",c)}\``,questions:[],answeredCount:a,context:{rules:n,concernReminders:[]},transition:{onComplete:o("approve",c)},...l};let P={id:k.id,text:k.text,concerns:[...k.concerns],extras:k.extras.map(N=>N.text)},$={phase:"DISCOVERY",instruction:`Ask this question to the user using AskUserQuestion. Submit the answer with: \`${o('next --agent --answer="<answer>"',c)}\``,questions:[P],answeredCount:a,currentQuestion:i,totalQuestions:m.length,context:{rules:L,concernReminders:F(t)},transition:{onComplete:`${o('next --agent --answer="<answer>"',c)}`},...l},D=$;if((x.length>0||A.length>0)&&(D={...D,...x.length>0?{agreedPremises:x}:{},...A.length>0?{revisedPremises:A}:{}}),i===0){let N=te(e.specDescription??null);N!==void 0&&(D={...D,preDiscoveryResearch:N});let B=await ne(e.discovery.planPath??null);B!==void 0&&(D={...D,planContext:B}),E&&B===void 0&&(D={...D,richDescription:{provided:!0,length:S.length,content:S,instruction:"The user provided a detailed description. For each question, extract relevant info and present as a pre-filled suggestion. IMPORTANT: When extracting answers from the description, mark each extraction as [STATED] (directly written by the user) or [INFERRED] (your interpretation). Present extractions individually for confirmation."}})}let Y=(e.discovery.followUps??[]).filter(N=>N.status==="pending");Y.length>0&&(D={...D,pendingFollowUps:Y});let G=e.discovery.answers.length>0?e.discovery.answers[e.discovery.answers.length-1]:void 0;if(G!==void 0){let N=ge(G.answer);N.length>0&&(D={...D,followUpHints:N})}return D!==$?D:$}let y=new Set(e.discovery.answers.map(i=>i.questionId)),C=m.filter(i=>!y.has(i.id)).map(i=>({id:i.id,text:i.text,concerns:[...i.concerns],extras:i.extras.map(k=>k.text)})),T=e.revisitHistory??[],R=T.length>0?T[T.length-1]:null,q=R!==null,U={phase:"DISCOVERY",instruction:q?"This spec was revisited from EXECUTING. Previous discovery answers are preserved \u2014 review and revise as needed, or approve to regenerate tasks.":"Conduct a thorough discovery conversation. FIRST: perform a pre-discovery codebase scan (README, CLAUDE.md, recent git log, TODOs, directory structure) and present a brief audit summary. THEN: challenge the user's spec description against your findings. THEN: ask the discovery questions one at a time, offering concrete options based on codebase knowledge. AFTER questions: present a dream state table (current \u2192 this spec \u2192 future), scored expansion proposals, architectural decisions, and an error/rescue map. FINALLY: present a complete discovery synthesis for user confirmation before submitting answers as a JSON object.",questions:C,answeredCount:a,context:{rules:L,concernReminders:F(t)},transition:{onComplete:`${o(`next --answer='{"status_quo":"...","ambition":"...",...}'`,c)}`},...l,...x.length>0?{agreedPremises:x}:{},...A.length>0?{revisedPremises:A}:{}};if(q&&R!==void 0)return{...U,revisited:!0,revisitReason:R.reason,previousProgress:{completedTasks:[...R.completedTasks],totalTasks:R.completedTasks.length}};if(a===0){let i=U,k=te(e.specDescription??null);k!==void 0&&(i={...i,preDiscoveryResearch:k});let P=await ne(e.discovery.planPath??null);if(P!==void 0&&(i={...i,planContext:P}),E&&P===void 0&&(i={...i,richDescription:{provided:!0,length:S.length,content:S,instruction:"The user provided a detailed description. For each question, extract relevant info and present as a pre-filled suggestion."}}),i!==U)return i}return U},be=(e,t)=>{let n=e.spec,s=_(t),r=e.discovery.answers.map(a=>{let v=s.find(w=>w.id===a.questionId);return{questionId:a.questionId,question:v?.text??a.questionId,answer:a.answer}}),c=J(e.discovery.answers);if(e.discovery.approved&&c.detected)return{phase:"DISCOVERY_REVIEW",instruction:"Discovery answers are approved. noskills detected multiple independent work areas in this spec. Present the split proposal to the user and let them decide whether to keep as one spec or split into separate specs.",answers:r,transition:{onApprove:o('next --answer="keep"',n),onRevise:o(`next --answer='{"revise":{"status_quo":"corrected answer"}}'`,n)},splitProposal:c};let m=e.discovery.alternativesPresented===!0;return e.discovery.approved&&!m?{phase:"DISCOVERY_REVIEW",subPhase:"alternatives",instruction:"Based on discovery answers, propose 2-3 distinct implementation approaches. Present each with name, summary, effort (S/M/L/XL), risk (Low/Med/High), pros, and cons. Ask the user to choose one, or skip.",answers:r,transition:{onApprove:o(`next --answer='{"approach":"A","name":"...","summary":"...","effort":"M","risk":"Low"}'`,n),onRevise:o('next --answer="skip"',n)},alternatives:{required:!0,instruction:"Generate 2-3 approaches from discovery answers and codebase. Present via AskUserQuestion.",format:{fields:["id","name","summary","effort","risk","pros","cons"]}}}:{phase:"DISCOVERY_REVIEW",instruction:c.detected?"Present ALL discovery answers to the user for review. ALSO present the split proposal \u2014 noskills detected multiple independent areas.":"Present ALL discovery answers to the user for review. The user must confirm or correct each answer before the spec can be generated. Use AskUserQuestion to ask for confirmation.",answers:r,transition:{onApprove:o('next --answer="approve"',n),onRevise:o(`next --answer='{"revise":{"status_quo":"corrected answer"}}'`,n)},splitProposal:c.detected?c:void 0}},ke=e=>{let t=e.spec;return e.classification===null?{phase:"SPEC_DRAFT",instruction:"Before generating the spec, classify what this spec involves. Ask the user to select all that apply.",specPath:e.specState.path??"",transition:{onApprove:`${o(`next --answer='{"involvesWebUI":false,"involvesCLI":false,"involvesPublicAPI":false,"involvesMigration":false,"involvesDataHandling":false}'`,t)}`},classificationRequired:!0,classificationPrompt:{options:[{id:"involvesWebUI",label:"Web/Mobile UI \u2014 layouts, responsive design, visual components"},{id:"involvesCLI",label:"CLI/Terminal UI \u2014 spinners, progress bars, interactive prompts"},{id:"involvesPublicAPI",label:"Public API changes"},{id:"involvesMigration",label:"Data migration or schema changes"},{id:"involvesDataHandling",label:"Data handling or privacy"}],instruction:"Select all that apply. Submit as JSON: `"+o(`next --answer='{"involvesWebUI":true,"involvesCLI":false,"involvesPublicAPI":false,...}'`,t)+"`. If none apply, answer with: `"+o('next --answer="none"',t)+"`"}}:{phase:"SPEC_DRAFT",instruction:"Spec draft is ready. Self-review before presenting to user.",specPath:e.specState.path??"",transition:{onApprove:o("approve",t)},selfReview:{required:!0,checks:["Placeholder scan: no TBD, TODO, vague requirements","Consistency: tasks match discovery, ACs match tasks","Scope: single spec, not multiple independent subsystems","Ambiguity: every AC has one interpretation"],instruction:"Review draft against these checks. Fix issues inline before presenting to user. Do not ask user to fix \u2014 fix it yourself."}}},xe=e=>{let t=e.spec;return{phase:"SPEC_APPROVED",instruction:"Spec is approved and ready. When the user is ready to start, begin execution.",specPath:e.specState.path??"",transition:{onStart:`${o('next --answer="start"',t)}`}}},Ee=(e,t)=>{if(t===null)return!1;let n=e.toLowerCase();return n.includes("mobile")||n.includes("layout")||n.includes("interaction design")?t.involvesWebUI:n.includes("ui state")||n.includes("skeleton ui")?t.involvesWebUI||t.involvesCLI:n.includes("readme")||n.includes("documentation updated")||n.includes("reflected in")&&n.includes("docs")?!0:n.includes("api doc")||n.includes("public api")?t.involvesPublicAPI:n.includes("migration")||n.includes("backward compat")||n.includes("deprecat")?t.involvesMigration:n.includes("audit trail")||n.includes("access control")||n.includes("data handling")||n.includes("data retention")?t.involvesDataHandling:!0},De=(e,t,n,s,r,c,m,a)=>{let v=[],w=new Set(a??[]),d=0,h=()=>`ac-${++d}`;if(s!==null)for(let l of s.items)w.has(l.id)||v.push({id:l.id,text:`[DEBT from iteration ${l.since}] ${l.text}`});if(t&&v.push({id:h(),text:`[FAILED] Tests \u2014 fix this first: ${n.slice(0,200)}`}),c!=null)for(let l of c.verification){let g=h();w.has(g)||v.push({id:g,text:l})}for(let l of e)if(l.acceptanceCriteria!==void 0&&l.acceptanceCriteria.length>0)for(let g of l.acceptanceCriteria){if(!Ee(g,r))continue;let b=h();w.has(b)||v.push({id:b,text:`(${l.id}) ${g}`})}if(m!==void 0)for(let l of m){let g=h();w.has(g)||v.push({id:g,text:`(folder: ${l.folder}) ${l.rule}`})}return v.push({id:"mandatory-tests",text:"Tests written and passing for all new and changed behavior"}),v.push({id:"mandatory-docs",text:"Documentation updated for all public-facing changes"}),v},Re=(e,t,n,s,r,c)=>{let m=e.spec,a=H(t),v=e.execution.iteration>=s,w=e.execution.lastVerification?.passed===!1,d=e.execution.lastVerification?.output??"",h=r?.tasks??[],l=e.execution.completedTasks??[],g=new Set(l),b=h.find(y=>!g.has(y.id))??null,u=b!==null?{id:b.id,title:b.title,totalTasks:h.length,completedTasks:l.length,...b.files!==void 0&&b.files.length>0?{files:b.files}:{}}:void 0;if(e.execution.awaitingStatusReport){let y=De(t,w,d,e.execution.debt,e.classification,r,c,e.execution.naItems),C=[];try{let q=JSON.parse(e.execution.lastProgress??"");Array.isArray(q.completed)&&(C=q.completed.filter(V=>typeof V=="string"&&V.startsWith("task-")))}catch{}let R={phase:"EXECUTING",instruction:C.length>=2?`${C.length} tasks reported complete. Report status against ALL relevant acceptance criteria.`:"Before this task is accepted, report your completion status against these acceptance criteria.",context:{rules:n,concernReminders:M(t).tier1},transition:{onComplete:`${o(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`,m)}`,onBlocked:`${o('block "reason"',m)}`,iteration:e.execution.iteration},statusReportRequired:!0,statusReport:{criteria:y,reportFormat:{completed:"list item IDs you finished (e.g., ['debt-1', 'ac-3']) with evidence",remaining:"list item IDs not yet done",blocked:"list item IDs that need a decision from the user",na:"(optional) list item IDs that are not applicable to this task \u2014 they will be removed from future criteria",newIssues:"(optional) list NEW issues discovered during implementation \u2014 free text, will be assigned debt IDs automatically"}}};return C.length>=2&&(R={...R,batchTasks:C}),w&&(R={...R,verificationFailed:!0,verificationOutput:d.slice(0,2e3)}),R}let I=(e.execution.lastProgress??"").includes("Task not accepted"),f=e.execution.debt?.items??[],L=e.execution.debt?.unaddressedIterations??0,S=u!==void 0?`Execute task ${u.id}: ${u.title} (${u.completedTasks}/${u.totalTasks} completed)`:"All tasks completed. Run `"+o("done",m)+"` to finish.",E;if(w)E="Verification FAILED. Fix the failing tests before continuing.";else if(I&&f.length>0){let y=L>=3?` These items have been outstanding for ${L} iterations.`:"";E=`Task not accepted \u2014 ${f.length} remaining item(s) must be addressed before this task can be completed.${y} Address them, then submit a new status report.`}else E=S;let p={phase:"EXECUTING",instruction:E,task:u,context:{rules:n,concernReminders:M(t).tier1},transition:{onComplete:`${o('next --answer="..."',m)}`,onBlocked:`${o('block "reason"',m)}`,iteration:e.execution.iteration}};if(I&&f.length>0&&(p={...p,taskRejected:!0,rejectionReason:`${f.length} remaining item(s) must be addressed.`,rejectionRemaining:f.map(y=>y.text)}),e.execution.debt!==null&&e.execution.debt.items.length>0){let y=e.execution.debt.unaddressedIterations??0,C=y>=3?`URGENT: These items have been unaddressed for ${y} iterations. Address them IMMEDIATELY before any new work.`:"These were not completed in a previous iteration. Address them BEFORE starting new work.";p={...p,previousIterationDebt:{fromIteration:e.execution.debt.fromIteration,items:e.execution.debt.items,note:C}}}if(w){let y=d.slice(0,2e3);p={...p,verificationFailed:!0,verificationOutput:y}}a.length>0&&(p={...p,concernTensions:a}),v&&(p={...p,restartRecommended:!0,restartInstruction:`Context may be getting large after ${e.execution.iteration} iterations. Consider starting a new conversation and running \`${o("next",m)}\` to resume - your progress is saved.`});let x=[...e.decisions].reverse().find(y=>!y.promoted);return x!==void 0&&e.execution.lastProgress?.startsWith("Resolved:")&&(p={...p,promotePrompt:{decisionId:x.id,question:x.question,choice:x.choice,prompt:`You just resolved a decision: "${x.choice}". Ask the user: "Should this be a permanent rule for future specs too?" If yes, run: \`${O(`rule add "${x.choice}"`)}\``}}),e.execution.iteration===0&&!w&&!I&&(p={...p,preExecutionReview:{instruction:"Re-read spec before starting. Flag: missing info that will block mid-execution, wrong task order, unclear ACs. Better to catch now than mid-execution."}}),t.some(y=>y.id==="beautiful-product")&&(p={...p,designChecklist:{required:!0,instruction:"Before completing any UI task, rate your implementation 0-10 on these dimensions and include the ratings in your AC report:",dimensions:[{id:"hierarchy",label:"Information hierarchy \u2014 what does the user see first, second, third?"},{id:"states",label:"Interaction states \u2014 loading, empty, error, success all specified?"},{id:"edge-cases",label:"Edge cases \u2014 long text, zero results, slow connection handled?"},{id:"intentionality",label:"Overall intentionality \u2014 does this feel designed or generated?"}]}}),p},Ie=e=>{let t=e.spec;return{phase:"BLOCKED",instruction:"A decision is needed. Ask the user.",reason:e.execution.lastProgress??"Unknown",transition:{onResolved:`${o('next --answer="..."',t)}`}}},Ae=async(e,t)=>{let n={phase:"COMPLETED",summary:{spec:e.spec,iterations:e.execution.iteration,decisionsCount:e.decisions.length,completionReason:e.completionReason,completionNote:e.completionNote},learningPrompt:{instruction:`Record learnings. For each insight, decide: one-time learning or permanent rule? One-time ("assumed X, was Y") \u2192 \`learn "text"\`. Permanent ("always/never do X") \u2192 \`learn "text" --rule\`. Run: \`noskills spec ${e.spec??"<name>"} learn "text"\` or \`learn "text" --rule\`.`,examples:[`noskills spec ${e.spec??"upload"} learn "Assumed S3 SDK v2, was v3"`,`noskills spec ${e.spec??"upload"} learn "Always use Result types" --rule`,"noskills learn promote 1"]}};if(t!==void 0)try{let{checkStaleness:s}=await import("./diagrams-I2QKL7WR.js"),r=await s(t,e.execution.modifiedFiles);if(r.length>0)return{...n,staleDiagrams:r.map(c=>({file:c.file,line:c.line,reason:c.reason}))}}catch{}return n};export{$e as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as f}from"./chunk-XNGHRJVK.js";var m=async(n,r)=>{let t=`${n}/.eser/specs/${r}/spec.md`,s;try{s=await f.fs.readTextFile(t)}catch{return null}return g(r,s)},g=(n,r)=>{let t=[],s=[],l=[],i="";for(let p of r.split(`
|
|
2
|
+
`)){let e=p.trim();if(e.startsWith("## ")){i=e.slice(3).trim().toLowerCase();continue}if(i.startsWith("tasks")){let a=e.match(/^-\s*\[[ x]\]\s*(task-\d+):\s*(.+)$/i);a!==null&&t.push({id:a[1],title:a[2].trim()});let c=e.match(/^Files?:\s*(.+)$/i);if(c!==null&&t.length>0){let h=t[t.length-1],d=c[1].split(",").map(o=>o.trim().replace(/^`|`$/g,"")).filter(o=>o.length>0);d.length>0&&(t[t.length-1]={...h,files:d})}}i.startsWith("out of scope")&&e.startsWith("- ")&&s.push(e.slice(2).trim()),i.startsWith("verification")&&e.startsWith("- ")&&l.push(e.slice(2).trim())}return{name:n,tasks:t,outOfScope:s,verification:l}},y=(n,r)=>{let t=new Set(r);for(let s of n)if(!t.has(s.id))return s;return null};export{m as a,g as b,y as c};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as y}from"./chunk-
|
|
1
|
+
import{b as y}from"./chunk-RJX4ZXQ4.js";import{d}from"./chunk-5URW6X3N.js";import{i as h}from"./chunk-XNGHRJVK.js";var S=p=>{let n=p.split(/\n/).flatMap(t=>t.trim().length>0?[t.trim()]:[]);return n.length>1?n:p.split(/\.(?=\s+[A-Z])|;\s+/).map(t=>t.trim()).filter(t=>t.length>5)},A=(p,n=[])=>{let t=[],c=p.find(r=>r.questionId==="ambition");if(c!==void 0){let r=c.answer,a=r.match(/10[- ]?star[:\s]+(.+?)(?:\n|$)/is),l=r.match(/5[- ]?star[:\s]+(.+?)(?:\n|$)/is),o=(a!==null?a[1].trim():l!==null?l[1].trim():r.replace(/1[- ]?star[:\s]+[^.]*\.\s*/i,"").trim()).replace(/^(the|a|an|with|plus|also)\s+/i,"").replace(/^(the\s+)?(target|goal|objective)[:\s]+/i,"").trim();o.length>0&&(o=o.charAt(0).toUpperCase()+o.slice(1)),o=o.replace(/[.\u2026]+$/,"").trim(),o.length>140&&(o=o.slice(0,137)+"..."),o.length>3&&t.push(o)}let i=p.find(r=>r.questionId==="verification");if(i!==void 0){let r=i.answer.split(/\n/).map(a=>a.replace(/^\s*[-\u2022*]\s*/,"").trim()).filter(a=>a.length>0);for(let a of r)t.push(a)}for(let r of n){let a=r.choice.toLowerCase();if(a.includes("accepted")||a.includes("add to scope")){let l=r.question.replace(/^should\s+(we|i)\s+/i,"").replace(/\?+$/,"").trim(),e=l.charAt(0).toUpperCase()+l.slice(1);t.push(e)}}return t.length===0&&t.push("_Tasks need to be defined before execution. Add tasks manually or run discovery with more detail._"),t.push("Write or update tests for all new and changed behavior"),t.push("Update documentation for all public-facing changes (README, API docs, CHANGELOG)"),t},C=(p,n)=>{let t={};if(n===null){for(let c of p.specSections)t[c]=!1;return t}for(let c of p.specSections){let i=c.toLowerCase();i.includes("design")||i.includes("mobile")||i.includes("layout")||i.includes("interaction")?t[c]=n.involvesWebUI:i.includes("contributor")||i.includes("public api")||i.includes("api surface")?t[c]=n.involvesPublicAPI:i.includes("migration")||i.includes("deprecation")||i.includes("backward")||i.includes("compatibility")?t[c]=n.involvesMigration:i.includes("audit")||i.includes("access control")||i.includes("data handling")?t[c]=n.involvesDataHandling:t[c]=!0}return t},b=(p,n,t,c,i,r,a,l)=>{let e=[];e.push(`# Spec: ${p}`),e.push(""),e.push("## Status: draft"),e.push(""),t.length>0&&(e.push(`## Concerns: ${t.map(s=>s.id).join(", ")}`),e.push("")),e.push("## Discovery Answers"),e.push("");for(let s of n){if(e.push(`### ${s.questionId}`),e.push(""),e.push(s.answer),"user"in s&&s.user!=="Unknown User"){let u=s;e.push(""),e.push(`_-- ${u.user}_`)}e.push("")}for(let s of t)if(s.specSections.length>0){let u=C(s,i??null);for(let w of s.specSections)u[w]!==!1&&(e.push(`## ${w} (${s.id})`),e.push(""),e.push("_To be addressed during execution._"),e.push(""))}if(c.length>0){e.push("## Decisions"),e.push(""),e.push("| # | Decision | Choice | Promoted |"),e.push("|---|----------|--------|----------|");for(let s=0;s<c.length;s++){let u=c[s];e.push(`| ${s+1} | ${u.question} | ${u.choice} | ${u.promoted?"yes":"no"} |`)}e.push("")}let o=n.find(s=>s.questionId==="scope_boundary");if(o!==void 0){e.push("## Out of Scope"),e.push("");let s=S(o.answer);for(let u of s)e.push(`- ${u}`);e.push("")}let f=A(n,c);e.push("## Tasks"),e.push("");for(let s=0;s<f.length;s++)e.push(`- [ ] task-${s+1}: ${f[s]}`);e.push("");let m=n.find(s=>s.questionId==="verification");if(e.push("## Verification"),e.push(""),m!==void 0){let s=S(m.answer);for(let u of s)e.push(`- ${u}`)}else e.push("_To be defined._");e.push("");let g=r??[];if(g.length>0){e.push("## Custom Acceptance Criteria"),e.push("");for(let s of g)e.push(`- ${s.text} _-- ${s.user}, ${s.addedInPhase}_`);e.push("")}let $=(a??[]).filter(s=>!s.text.startsWith("[TASK] "));if($.length>0){e.push("## Notes"),e.push("");for(let s of $)e.push(`- ${s.text} _-- ${s.user}, ${s.phase}_`);e.push("")}let v=l??[];if(v.length>0){e.push("## Transition History"),e.push(""),e.push("| From | To | User | Timestamp | Reason |"),e.push("|------|----|------|-----------|--------|");for(let s of v)e.push(`| ${s.from} | ${s.to} | ${s.user} | ${s.timestamp} | ${s.reason??"-"} |`);e.push("")}return e.join(`
|
|
2
2
|
`)};var _=async(p,n,t)=>{if(n.spec===null)throw new Error("No active spec");let c=`${p}/${d.specDir(n.spec)}`,i=`${p}/${d.specFile(n.spec)}`;await h.fs.mkdir(c,{recursive:!0});let r=b(n.spec,n.discovery.answers,t,n.decisions,n.classification,n.customACs,n.specNotes,n.transitionHistory);await h.fs.writeTextFile(i,r);let a=y(n.spec,r),l=`${c}/progress.json`,e={spec:n.spec,status:"draft",tasks:a.tasks.map(o=>({id:o.id,title:o.title,status:"pending"})),decisions:n.decisions.map(o=>({question:o.question,choice:o.choice,promoted:o.promoted})),debt:[],updatedAt:new Date().toISOString()};return await h.fs.writeTextFile(l,JSON.stringify(e,null,2)+`
|
|
3
3
|
`),i};export{_ as a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{b as c,d as u}from"./chunk-JVCVWI3B.js";import{a as d}from"./chunk-OLM5RTFK.js";var y=async(n,t)=>{let e=t.properties?.binPath;if(e!==void 0)return e;try{let r=await u`which ${n}`.noThrow().text();if(r.length>0)return r}catch{}throw new d(`Binary "${n}" not found. Set properties.binPath in config or ensure it is on PATH.`,{provider:n})},f=(n,t,e)=>{let r=e?.stdinData!==void 0,s=new c(n,[...t],{stdin:r?"piped":"null",stdout:"piped",stderr:"piped",cwd:e?.cwd,env:e?.env}).child();if(r&&s.stdin!==null){let i=new TextEncoder,a=s.stdin.getWriter();a.write(i.encode(e.stdinData)).then(()=>{a.close()}).catch(()=>{})}if(e?.signal!==void 0){let i=e.signal;i.aborted?s.kill("SIGTERM"):i.addEventListener("abort",()=>{s.kill("SIGTERM")},{once:!0})}return{stdout:s.stdout,stderr:s.stderr,waitForExit:async()=>{let i=await s.status;return{code:i.code,success:i.success}},kill:i=>{s.kill(i??"SIGTERM")}}},l=new TextDecoder;async function*m(n){let t=n.getReader(),e="";try{let r=await t.read();for(;r.done!==!0;){e+=l.decode(r.value,{stream:!0});let s=e.split(`
|
|
2
|
+
`);e=s.pop()??"";for(let i of s){let a=i.trim();if(a.length!==0)try{yield JSON.parse(a)}catch{}}r=await t.read()}let o=e.trim();if(o.length>0)try{yield JSON.parse(o)}catch{}}finally{t.releaseLock()}}var w=async(n,t)=>{let e=n.getReader(),r=[],o=await e.read();for(;o.done!==!0;)r.push(l.decode(o.value,{stream:!0})),o=await e.read();return e.releaseLock(),{content:[{kind:"text",text:r.join("").trim()}],stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0},modelId:t}},h=async n=>{let t=n.getReader(),e=[],r=await t.read();for(;r.done!==!0;)e.push(l.decode(r.value,{stream:!0})),r=await t.read();return t.releaseLock(),e.join("").trim()},x=(n,t,e)=>{if(t===0)return null;let r=e.length>0?`${n} exited with code ${t}: ${e}`:`${n} exited with code ${t}`;return t===1?new d(r,{provider:n}):t===126||t===127?new d(`${n} binary not found or not executable (exit code ${t})`,{provider:n}):new d(r,{provider:n})},b=(n,t)=>{let e=[];t!==void 0&&(e.push(t),e.push(""));for(let r of n)for(let o of r.content)o.kind==="text"&&e.push(o.text);return e.join(`
|
|
3
|
+
`)};export{y as a,f as b,m as c,w as d,h as e,x as f,b as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{f as e}from"./chunk-XNGHRJVK.js";var n={command:"eser",devCommand:"deno task cli",npmPackage:"eser",jsrPackage:"@eser/cli"},r="npx eser@latest noskills",t=r,i=s=>{t=s},m=()=>t,a=s=>`${t} ${s}`,c=async()=>await e(n,["noskills","nos"])??r;export{i as a,m as b,a as c,c as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as B,c as L}from"./chunk-CKETVOVQ.js";import{a as P,b,c as w,d as O,e as E,f as I,g as a,h as N,i as _,j as W,k as $,l as F,m as p,n as j,o as S,p as A,q as T,y as M}from"./chunk-YSLRAWBK.js";import{d as Q}from"./chunk-OTRBRRIO.js";var U={};Q(U,{AlreadyExistsError:()=>w,NotFoundError:()=>b,ProcessError:()=>O,RuntimeCapabilityError:()=>P,buildCommand:()=>R,clearWorkerdEnv:()=>L,createRuntime:()=>H,detectExecutionContext:()=>y,detectInvoker:()=>h,detectRuntime:()=>a,getArch:()=>j,getCliPrefix:()=>J,getHomedir:()=>S,getPlatform:()=>p,getPlatformInfo:()=>T,getRuntimeVersion:()=>N,getTmpdir:()=>A,isBrowser:()=>W,isCommandInPath:()=>v,isEdge:()=>F,isRuntime:()=>_,isServer:()=>$,matchCliPrefix:()=>D,populateEnvFromContext:()=>B,posixPath:()=>I,resolvePathDirs:()=>g,runtime:()=>i,toPosix:()=>E});var g=(e,n)=>{let t=n==="windows"?";":":";return e.split(t).filter(r=>r.length>0)},l=new Set(["deno","node","bun"]),h=(e,n,t,r,o,s)=>{let d=l.has(e)?e:n;if(!l.has(d))return{invoker:"binary",mode:"installed"};if(d==="bun")return r.BUN_INSTALL!==void 0?{invoker:"bun",mode:"installed"}:{invoker:"bunx",mode:"on-demand"};if(d==="node"){let m=t[1]??"";if(m.includes("_npx")||m.includes("/npx"))return{invoker:"npx",mode:"on-demand"};if(m.includes("pnpm")||m.includes("pnpx"))return{invoker:"pnpx",mode:"on-demand"};let c=r.npm_execpath??"";return c.includes("npx")?{invoker:"npx",mode:"on-demand"}:c.includes("pnpm")?{invoker:"pnpx",mode:"on-demand"}:(r.npm_config_user_agent??"").includes("pnpm")?{invoker:"pnpm",mode:"installed"}:{invoker:"npm",mode:"installed"}}return d==="deno"?o!==void 0&&(o.startsWith("jsr:")||o.startsWith("https:"))?{invoker:"deno",mode:"on-demand"}:s===!0?{invoker:"dev",mode:"dev"}:{invoker:"deno",mode:"installed"}:{invoker:"unknown",mode:"installed"}},R=(e,n,t)=>e==="npx"?`npx ${t.npmPackage}`:e==="pnpx"?`pnpx ${t.npmPackage}`:e==="bunx"?`bunx ${t.npmPackage}`:e==="deno"&&n==="on-demand"?`deno run --allow-all jsr:${t.jsrPackage}`:e==="dev"?t.devCommand:t.command,v=async e=>{let n=p(),t=n==="windows"?`${e}.exe`:e,r=i.env.get("PATH")??"",o=g(r,n);for(let s of o)try{return await i.fs.stat(i.path.join(s,t)),!0}catch{continue}return!1},D=(e,n)=>{for(let t of e){let r=n.indexOf(t);if(r>=0)return n.slice(0,r+1).join(" ");let o=n.findIndex(s=>s.endsWith(`/${t}`)||s.endsWith(`\\${t}`)||s.includes(`:${t}`));if(o>=0)return n.slice(0,o+1).join(" ")}},J=async(e,n)=>{let t=await y(e),r=i.process.argv;for(let o of n){if(r.includes(o))return`${t.command} ${o}`;if(r.some(d=>d.endsWith(`/${o}`)||d.endsWith(`\\${o}`)||d.includes(`:${o}`)))return t.command}},y=async e=>{let n=i.path.basename(i.process.execPath()),t=a(),r=i.process.argv,o=import.meta.url,s=l.has(n)?n:t,d={BUN_INSTALL:i.env.get("BUN_INSTALL"),npm_execpath:i.env.get("npm_execpath"),npm_config_user_agent:i.env.get("npm_config_user_agent")},m=!1;if(s==="deno"&&o.startsWith("file://")){let k=i.process.cwd();try{let x=i.path.join(k,"deno.json"),C=await i.fs.readTextFile(x),u=JSON.parse(C).tasks;u!==void 0&&"cli"in u&&(m=!0)}catch{}if(!m)try{let x=i.path.join(k,"package.json"),C=await i.fs.readTextFile(x),u=JSON.parse(C).scripts;u!==void 0&&"cli"in u&&(m=!0)}catch{}}let{invoker:c,mode:f}=h(n,t,r,d,o,m),K=l.has(s)?s:"compiled",q=R(c,f,e),z=await v(e.command);return{runtime:K,mode:f,invoker:c,command:q,isInPath:z}};var V={deno:async()=>(await import("./deno-QOH6TCLQ.js")).createDenoRuntime(),node:async()=>(await import("./node-BPWE6I45.js")).createNodeRuntime(),bun:async()=>(await import("./bun-5VMFSLLY.js")).createBunRuntime(),workerd:async()=>(await import("./workerd-IIQRIOBX.js")).createWorkerdRuntime(),browser:async()=>(await import("./browser-XLYVEO2J.js")).createBrowserRuntime()},X=["fs","exec","env","path","process"],Y=e=>e!==void 0&&X.some(n=>e[n]!==void 0),Z=(e,n,t)=>({name:e.name,version:e.version,capabilities:t,fs:n.fs??e.fs,path:n.path??e.path,exec:n.exec??e.exec,env:n.env??e.env,process:n.process??e.process}),H=async e=>{let n=a(),t=V[n],r=t!==void 0?await t():M(n),o=e?.capabilities?{...r.capabilities,...e.capabilities}:r.capabilities;return e!==void 0&&Y(e)?Z(r,e,o):e?.capabilities?{...r,capabilities:o}:r},i=await H();export{g as a,h as b,R as c,v as d,D as e,J as f,y as g,H as h,i,U as j};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as M,b as H}from"./chunk-2N4GTHXQ.js";import{
|
|
1
|
+
import{a as M,b as H}from"./chunk-2N4GTHXQ.js";import{i as B}from"./chunk-XNGHRJVK.js";var de=/^(?:-(?:(?<doubleDash>-)(?<negated>no-)?)?)(?<key>.+?)(?:=(?<value>.*))?$/s,ce=/[A-Za-z]/,fe=/-?\d+(\.\d*)?(e-?\d+)?$/,ue=/^(-|--)[^-]/,ge=/=(?<value>.+)/,me=/^--[^=]+$/,pe=/\W/,he=/\S/;function T(n){return he.test(n)&&Number.isFinite(Number(n))}function V(n,e){return e==="constructor"&&typeof n[e]=="function"||e==="__proto__"}function k(n,e,t,o=!1){e=[...e];let s=e.pop();for(let r of e){if(V(n,r))return;n=n[r]??={}}if(!V(n,s)){if(o){let r=n[s];if(Array.isArray(r)){r.push(t);return}t=r?[r,t]:[t]}n[s]=t}}function N(n,e){for(let t of e){let o=n[t];if(!Object.hasOwn(n,t))return!1;n=o}return!0}function X(n,e,t){let o=n.get(t);if(o===void 0)return!1;for(let s of o)if(e.has(s))return!0;return!1}function v(n){return n==="true"||n==="false"}function j(n){return n!=="false"}function L(n,e){let{"--":t=!1,alias:o={},boolean:s=!1,default:r={},stopEarly:i=!1,string:d=[],collect:m=[],negatable:p=[],unknown:S=l=>l}=e??{},h=new Map,$=new Set,C=new Set,x=new Set,b=new Set,g=!1;if(o)for(let[l,a]of Object.entries(o)){if(a===void 0)throw new TypeError("Alias value must be defined");let c=Array.isArray(a)?a:[a];h.set(l,new Set(c)),c.forEach(O=>h.set(O,new Set([l,...c.filter(E=>E!==O)])))}if(s)if(typeof s=="boolean")g=s;else{let l=Array.isArray(s)?s:[s];for(let a of l.filter(Boolean))$.add(a),h.get(a)?.forEach(c=>{$.add(c)})}if(d){let l=Array.isArray(d)?d:[d];for(let a of l.filter(Boolean))C.add(a),h.get(a)?.forEach(c=>C.add(c))}if(m){let l=Array.isArray(m)?m:[m];for(let a of l.filter(Boolean))x.add(a),h.get(a)?.forEach(c=>x.add(c))}if(p){let l=Array.isArray(p)?p:[p];for(let a of l.filter(Boolean))b.add(a),h.get(a)?.forEach(c=>b.add(c))}let u={_:[]};function y(l,a,c,O){if(!$.has(l)&&!C.has(l)&&!h.has(l)&&!x.has(l)&&!(g&&me.test(c))&&S?.(c,l,a)===!1)return;typeof a=="string"&&!C.has(l)&&(a=T(a)?Number(a):a);let E=O&&x.has(l);k(u,l.split("."),a,E),h.get(l)?.forEach(f=>{k(u,f.split("."),a,E)})}let R=[],D=n.indexOf("--");D!==-1&&(R=n.slice(D+1),n=n.slice(0,D));e:for(let l=0;l<n.length;l++){let a=n[l],c=a.match(de)?.groups;if(c){let{doubleDash:O,negated:E}=c,f=c.key,F=c.value;if(O){if(F!=null){$.has(f)&&(F=j(F)),y(f,F,a,!0);continue}if(E){if(b.has(f)){y(f,!1,a,!1);continue}f=`no-${f}`}let _=n[l+1];if(_){if(!$.has(f)&&!g&&!_.startsWith("-")&&(!h.has(f)||!X(h,$,f))){F=_,l++,y(f,F,a,!0);continue}if(v(_)){F=j(_),l++,y(f,F,a,!0);continue}}F=C.has(f)?"":!0,y(f,F,a,!0);continue}let z=a.slice(1,-1).split("");for(let[_,A]of z.entries()){let w=a.slice(_+2);if(w==="-"){y(A,w,a,!0);continue}if(w==="="){y(A,"",a,!0);continue e}if(ce.test(A)){let W=ge.exec(w)?.groups;if(W){y(A,W.value,a,!0);continue e}if(fe.test(w)){y(A,w,a,!0);continue e}}if(z[_+1]?.match(pe)){y(A,a.slice(_+2),a,!0);continue e}y(A,C.has(A)?"":!0,a,!0)}if(f=a.slice(-1),f==="-")continue;let P=n[l+1];if(P){if(!ue.test(P)&&!$.has(f)&&(!h.has(f)||!X(h,$,f))){y(f,P,a,!0),l++;continue}if(v(P)){let _=j(P);y(f,_,a,!0),l++;continue}}y(f,C.has(f)?"":!0,a,!0);continue}if(S?.(a)!==!1&&u._.push(C.has("_")||!T(a)?a:Number(a)),i){u._.push(...n.slice(l+1));break}}for(let[l,a]of Object.entries(r)){let c=l.split(".");N(u,c)||(k(u,c,a),h.get(l)?.forEach(O=>k(u,O.split("."),a)))}for(let l of $.keys()){let a=l.split(".");if(!N(u,a)){let c=x.has(l)?[]:!1;k(u,a,c)}}for(let l of C.keys()){let a=l.split(".");!N(u,a)&&x.has(l)&&k(u,a,[])}return t?u["--"]=R:u._.push(...R),u}var I=n=>{let e=[],t=[],o={},s={};for(let r of n)r.type==="boolean"?e.push(r.name):t.push(r.name),r.short!==void 0&&(o[r.short]=r.name),r.default!==void 0&&(s[r.name]=r.default);return{boolean:e,string:t,alias:o,default:s}},ye=n=>n!=null&&n.constructor===String,$e={boolean:n=>!!n,number:n=>ye(n)?Number(n):n,string:n=>String(n),"string[]":n=>Array.isArray(n)?n.map(String):[String(n)]},Ce=(n,e)=>{if(n!==void 0)return $e[e]?.(n)??n},q=(n,e)=>{let t={};for(let o of e){let s=n[o.name];t[o.name]=Ce(s,o.type)}return t};var Y=(n,e)=>{let t=[];for(let o of e)if(o.required===!0){let s=n[o.name];(s===void 0||s===""||s===!1)&&t.push(`Required flag --${o.name} is missing`)}return t};var Z=(n,e)=>n+" ".repeat(Math.max(0,e-n.length)),be=n=>{let e=n.short!==void 0?`-${n.short}, `:"",t=n.type!=="boolean"?` <${n.type}>`:"";return`${e}--${n.name}${t}`},_e=(n,e)=>[n.description!==void 0?`${e} - ${n.description}`:e,""],Fe=(n,e)=>{if(n.usage!==void 0)return["Usage:",` ${n.usage}`,""];let t=n.children.length>0?" <command>":"",o=n.flags.length>0?" [options]":"";return["Usage:",` ${e}${t}${o}`,""]},xe=n=>{if(n.length===0)return[];let e=s=>s.aliases!==void 0&&s.aliases.length>0?`${s.name}, ${s.aliases.join(", ")}`:s.name,t=Math.max(...n.map(s=>e(s).length));return["Commands:",...n.map(s=>` ${Z(e(s),t+2)}${s.description??""}`),""]},Oe=n=>{if(n.length===0)return[];let e=n.map(s=>({flag:be(s),desc:s.description})),t=Math.max(...e.map(s=>s.flag.length));return["Options:",...e.map(({flag:s,desc:r})=>` ${Z(s,t+2)}${r}`),""]},Ae=n=>n?.length?["Examples:",...n.map(e=>` ${e}`),""]:[],J=(n,e)=>{let t=e.join(" "),o=[..._e(n,t),...Fe(n,t),...xe(n.children),...Oe(n.flags),...Ae(n.examples)];return n.children.length>0&&o.push(`Run '${t} <command> --help' for more information on a command.`),o.join(`
|
|
2
2
|
`)};var K=n=>{let e=[];for(let t of n)e.push(`--${t.name}`),t.short!==void 0&&e.push(`-${t.short}`);return e.join(" ")},Q=(n,e)=>{if(n.children===void 0||n.children.length===0)return"";let t=n.children.map(i=>i.name).join(" "),o=n.flags!==void 0?K(n.flags):"",s=[t,o].filter(i=>i.length>0).join(" "),r=` ${e})
|
|
3
3
|
`;r+=` COMPREPLY=( $(compgen -W "${s}" -- "\${cur}") )
|
|
4
4
|
`,r+=` return 0
|