noskills 4.1.43 → 4.1.44

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 CHANGED
@@ -109,10 +109,10 @@ contributor-friendliness checks into every review, and permissive-default
109
109
  reminders into every task. Stack concerns to define your project's character.
110
110
 
111
111
  **One source of truth for every tool.** Write rules once in `.eser/rules/`.
112
- noskills generates CLAUDE.md, .cursorrules, Kiro steering files, Copilot
113
- instructions, Windsurf rules, OpenCode AGENTS.md + plugins, Codex CLI hooks +
114
- TOML agents, and Copilot CLI hooks + MCP config. Your teammate on Cursor and
115
- your teammate on Claude Code both get the same conventions, automatically.
112
+ noskills generates AGENTS.md CLAUDE.md, .cursorrules, Kiro steering files,
113
+ Copilot instructions, Windsurf rules, OpenCode AGENTS.md + plugins, Codex CLI
114
+ hooks + TOML agents, and Copilot CLI hooks + MCP config. Your teammate on Cursor
115
+ and your teammate on Claude Code both get the same conventions, automatically.
116
116
 
117
117
  **A human who's always in charge.** noskills never makes decisions silently.
118
118
  Discovery questions -> you answer. Spec approval -> you decide. Architectural
@@ -218,36 +218,41 @@ for human teams apply directly to AI agents — because the underlying problem i
218
218
  the same: finite attention, drifting focus, and the need for structure to keep
219
219
  work on track.
220
220
 
221
- ## Getting Started with Claude Code
221
+ ## Getting Started
222
222
 
223
- Open Claude Code and paste:
223
+ noskills supports multiple AI coding platforms. Pick yours:
224
224
 
225
- Run `eser noskills init` — it will scaffold your project and guide you through setup.
225
+ ### Claude Code
226
226
 
227
- If `eser` CLI is not installed:
227
+ Open Claude Code and paste:
228
228
 
229
229
  Run `npx eser@latest noskills init` — it will scaffold your project and guide you through setup.
230
230
 
231
- That's it. The init command detects Claude Code, sets up hooks, instructions,
232
- and agent helpers automatically.
231
+ That's it. The init command detects Claude Code, sets up hooks, generates
232
+ `CLAUDE.md`, and presents your next options automatically.
233
233
 
234
- If you want to add this to an existing project where teammates also use
235
- noskills, the init scaffolds `.eser/` which should be committed to your repo.
234
+ ### OpenCode / OpenAI Codex CLI / GitHub Copilot CLI / Kiro
236
235
 
237
- ## Getting Started with Kiro
236
+ Open your agent in your project and run in the terminal:
238
237
 
239
- Open a Kiro session and paste:
238
+ Run `npx eser@latest noskills init` — it will scaffold your project and guide you through setup.
240
239
 
241
- Run `eser noskills init` it will scaffold your project and guide you through setup.
240
+ noskills detects your agent, generates multi-file steering files (with `always`,
241
+ `auto`, and `fileMatch` inclusion modes), installs hook configs, and creates
242
+ executor/verifier agents.
242
243
 
243
- If `eser` CLI is not installed:
244
+ ### Other agents
244
245
 
245
- Run `npx eser@latest noskills init` it will scaffold your project and guide you through setup.
246
+ noskills generates a generic `AGENTS.md` at the project root. Any agent that
247
+ reads instruction files can use it. Run `noskills sync` after adding rules to
248
+ regenerate all tool files.
249
+
250
+ ### Adding to an existing team project
246
251
 
247
- noskills detects the `.kiro` directory automatically and generates steering
248
- files, hooks, custom agents, spec projection, and MCP registration all from
249
- the same `.eser/` source of truth. Your teammates on different tools get
250
- identical orchestration quality.
252
+ If teammates already use noskills, the `.eser/` directory should be committed to
253
+ your repo. Run `noskills init` to detect your tool and generate tool-specific
254
+ files. The init command won't overwrite existing `.eser/` config it only
255
+ generates the sync output for your tool.
251
256
 
252
257
  ## Quick Start
253
258
 
@@ -269,9 +274,9 @@ eser noskills free # FREE mode — no enforcement
269
274
  eser noskills free --exit # Back to IDLE
270
275
  ```
271
276
 
272
- After `init`, your CLAUDE.md (or .cursorrules, etc.) tells the agent to call
273
- `noskills next` at every step. The agent follows the JSON output. You never need
274
- to prompt-engineer the agent's behavior — noskills handles that.
277
+ After `init`, your AGENTS.md (or CLAUDE.md, .cursorrules, etc.) tells the agent
278
+ to call `noskills next` at every step. The agent follows the JSON output. You
279
+ never need to prompt-engineer the agent's behavior — noskills handles that.
275
280
 
276
281
  ### Without an agent (agentless CLI mode)
277
282
 
@@ -483,12 +488,30 @@ rules. These tell the agent HOW to behave, not just WHAT to do:
483
488
  **Git is read-only** for agents (configurable via `allowGit: true` in manifest).
484
489
  Agents may read (`git log`, `git diff`, `git status`) but never write
485
490
  (`git commit`, `git push`, `git checkout`). This is enforced at three levels:
486
- behavioral rules, CLAUDE.md instruction, and PreToolUse hook.
491
+ behavioral rules, AGENTS.md instruction, and PreToolUse hook.
487
492
 
488
493
  When the agent's iteration count exceeds `maxIterationsBeforeRestart` (default
489
494
  15), an `urgency` message warns that context is degrading and recommends a fresh
490
495
  session.
491
496
 
497
+ ### Platform Support
498
+
499
+ | Platform | Rules | Hooks | Agents | MCP | Enforcement |
500
+ | ----------- | -------------- | ----------- | ----------- | --- | --------------- |
501
+ | Claude Code | CLAUDE.md | full | Task tool | yes | Mechanical |
502
+ | Kiro | steering/ | Run Command | delegation | yes | Mechanical |
503
+ | Codex CLI | AGENTS.md | full | spawn_agent | yes | Mechanical |
504
+ | Copilot CLI | AGENTS.md | full | /fleet | yes | Mechanical |
505
+ | OpenCode | AGENTS.md | plugins | delegation | yes | Mechanical |
506
+ | Cursor | .cursorrules | none | none | yes | Behavioral only |
507
+ | Windsurf | .windsurfrules | none | none | yes | Behavioral only |
508
+
509
+ Platforms with **mechanical enforcement** use hooks to prevent unauthorized file
510
+ edits, block git write commands, and enforce phase transitions. Platforms with
511
+ **behavioral-only enforcement** rely on rules and instructions — the agent is
512
+ asked to follow the protocol but cannot be mechanically prevented from breaking
513
+ it.
514
+
492
515
  **Convention discovery:** When the agent identifies a recurring pattern,
493
516
  receives a correction from the user, or discovers a preference during work, the
494
517
  behavioral rules instruct it to ask: _"Should this be a permanent rule for this
@@ -583,7 +606,7 @@ In monorepos, different packages have different constraints. Drop a
583
606
  `.folder-rules.md` in any directory with markdown bullet rules:
584
607
 
585
608
  ```markdown
586
- - Generated CLAUDE.md must preserve existing content outside noskills:start/end
609
+ - Generated AGENTS.md must preserve existing content outside noskills:start/end
587
610
  markers
588
611
  - All command references must use dynamic noskillsCmd prefix
589
612
  - Sync output must be idempotent
@@ -618,6 +641,11 @@ Six questions, each probing product + engineering + QA at once:
618
641
  Active concerns inject sub-questions. For example, with `open-source` active,
619
642
  question 1 also asks: _"Is this workaround common in the community?"_
620
643
 
644
+ For larger specs, noskills may propose splitting the work into separate specs at
645
+ the end of discovery — for example, separating a bug fix from a feature
646
+ addition. You always decide: keep as one spec or split. noskills never splits on
647
+ its own.
648
+
621
649
  ### Spec Classification
622
650
 
623
651
  After discovery answers are submitted, noskills asks the user to classify the
@@ -680,34 +708,40 @@ noskills generates instruction files for every AI tool your team uses:
680
708
  ```
681
709
  .eser/ (single source of truth)
682
710
  +-- noskills sync
683
- |-- -> CLAUDE.md (Claude Code)
684
- |-- -> .claude/settings.json (Claude Code hooks)
685
- |-- -> .claude/agents/ (Claude Code agents)
686
- |-- -> .cursorrules (Cursor)
687
- |-- -> .kiro/steering/*.md (Kiro steering files)
688
- |-- -> .kiro/settings/hooks.json (Kiro hooks)
689
- |-- -> .kiro/settings/mcp.json (Kiro MCP registration)
690
- |-- -> .kiro/agents/*.json (Kiro custom agents)
691
- |-- -> .kiro/specs/ (Kiro spec projection)
692
- |-- -> .github/copilot-instructions.md (GitHub Copilot)
693
- |-- -> .windsurfrules (Windsurf)
694
- |-- -> AGENTS.md (OpenCode / Codex / Copilot CLI)
695
- |-- -> .opencode/plugins/noskills.ts (OpenCode hooks)
696
- |-- -> .opencode/agents/*.md (OpenCode agents)
697
- |-- -> .opencode/skills/*.md (OpenCode spec projection)
698
- |-- -> opencode.json (OpenCode MCP registration)
699
- |-- -> .codex/hooks.json (Codex CLI hooks)
700
- |-- -> .codex/agents/*.toml (Codex CLI agents)
701
- |-- -> .codex/config.toml (Codex CLI MCP registration)
702
- |-- -> .github/hooks/noskills.json (Copilot CLI hooks)
703
- |-- -> .github/agents/*.agent.md (Copilot CLI agents)
704
- +-- -> .copilot/mcp.json (Copilot CLI MCP registration)
711
+ | Claude Code
712
+ |-- -> CLAUDE.md (instructions)
713
+ |-- -> AGENTS.md (shared: Codex / Copilot / OpenCode)
714
+ |-- -> .claude/settings.json (hooks)
715
+ |-- -> .claude/agents/ (agents)
716
+ | Kiro
717
+ |-- -> .kiro/steering/*.md (steering files)
718
+ |-- -> .kiro/settings/hooks.json (hooks)
719
+ |-- -> .kiro/settings/mcp.json (MCP)
720
+ |-- -> .kiro/agents/*.json (agents)
721
+ |-- -> .kiro/specs/ (spec projection)
722
+ | Codex CLI
723
+ |-- -> .codex/hooks.json (hooks)
724
+ |-- -> .codex/agents/*.toml (agents)
725
+ |-- -> .codex/config.toml (MCP)
726
+ | Copilot CLI
727
+ |-- -> .github/hooks/noskills.json (hooks)
728
+ |-- -> .github/agents/*.agent.md (agents)
729
+ |-- -> .github/copilot-instructions.md (IDE instructions)
730
+ |-- -> .copilot/mcp.json (MCP)
731
+ | OpenCode
732
+ |-- -> .opencode/plugins/noskills.ts (hooks)
733
+ |-- -> .opencode/agents/*.md (agents)
734
+ |-- -> .opencode/skills/*.md (spec projection)
735
+ |-- -> opencode.json (MCP)
736
+ | Cursor / Windsurf / Copilot IDE
737
+ |-- -> .cursorrules (Cursor)
738
+ +-- -> .windsurfrules (Windsurf)
705
739
  ```
706
740
 
707
741
  Write your rules once in `.eser/rules/`, run `noskills sync`, and every tool
708
742
  gets the same instructions in its native format.
709
743
 
710
- Generated CLAUDE.md includes:
744
+ Generated AGENTS.md includes:
711
745
 
712
746
  - Protocol instructions with 5 concrete trigger points
713
747
  - Git read-only section (unless `allowGit: true`)
@@ -862,7 +896,7 @@ noskills:
862
896
  ```
863
897
 
864
898
  During `init`, noskills detects how it was invoked (via `@eser/standards`
865
- runtime) and stores it as `command`. All generated output — `CLAUDE.md`
899
+ runtime) and stores it as `command`. All generated output — `AGENTS.md`
866
900
  instructions, hook remediation messages, behavioral rules, transition hints —
867
901
  uses this prefix. Users who invoke via `deno run`, `npx`, homebrew, or global
868
902
  install all get correct command references.
@@ -945,12 +979,23 @@ noskills can call AI agents for validation via a fallback chain:
945
979
  package.json)
946
980
  - **CI** — GitHub Actions, GitLab CI, Jenkins, CircleCI
947
981
  - **Test runner** — Deno, Vitest, Jest, Playwright
948
- - **Coding tools** — Claude Code, Cursor, Kiro, Copilot, Windsurf (from existing
949
- config files in repo)
982
+ - **Coding tools:**
983
+ - **Claude Code** — `CLAUDE.md`, `.claude/` directory
984
+ - **Kiro** — `.kiro/` directory
985
+ - **Codex CLI** — `.codex/` directory, `.codex/config.toml`
986
+ - **Copilot CLI** — `.copilot/` directory, `.github/hooks/`
987
+ - **Copilot IDE** — `.github/copilot-instructions.md`
988
+ - **OpenCode** — `.opencode/` directory, `opencode.json`
989
+ - **Cursor** — `.cursorrules`, `.cursor/` directory
990
+ - **Windsurf** — `.windsurfrules`
991
+ - **Kilo Code** — `.kilo/` directory _(detection only — full adapter planned)_
992
+ - **Cline** — `.clinerules` file _(detection only — full adapter planned)_
993
+ - **Roo Code** — `.roo/` directory, `.roomodes` file _(detection only — full
994
+ adapter planned)_
950
995
 
951
996
  Detected coding tools are auto-synced on init, including hook installation for
952
- Claude Code. Invocation method is auto-detected and stored in `manifest.yml` as
953
- `noskills.command` — all output references use this prefix.
997
+ tools that support it. Invocation method is auto-detected and stored in
998
+ `manifest.yml` as `noskills.command` — all output references use this prefix.
954
999
 
955
1000
  ## License
956
1001
 
@@ -0,0 +1 @@
1
+ import{a as C,d as k}from"./chunk-3SLKOP72.js";import{m as y}from"./chunk-TMC5H2A5.js";import{d as w,f as h,h as S,i as g,j as E}from"./chunk-LWCWPXCS.js";import{d as l,f as n,g as m,o as u,q as d,r as f}from"./chunk-Y6AFIAJP.js";import{a as o,b as i}from"./chunk-2N4GTHXQ.js";import{b as p}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var F=async D=>{let e=u({renderer:f.ansi(),sink:d.stdout()}),r=p.process.cwd(),c=S(D);if(!c.ok)return e.writeln(n(c.error)),await e.close(),i({exitCode:1});let s;try{s=await h(r,c.spec)}catch(a){let I=a instanceof Error?a.message:String(a);return e.writeln(n(I)),await e.close(),i({exitCode:1})}if(s.phase==="IDLE"||s.phase==="FREE"||s.phase==="UNINITIALIZED"||s.phase==="COMPLETED")return e.writeln(n(`Cannot cancel in phase: ${s.phase}`)),await e.close(),i({exitCode:1});if(s.spec!==null){let a=`${r}/${w.specDir(s.spec)}`;try{await p.fs.stat(a)}catch{return e.writeln(n(`Active spec '${s.spec}' directory not found.`)),e.writeln(l("Run `noskills reset` to return to IDLE.")),await e.close(),i({exitCode:1})}}let t=y(s,"cancelled");return await g(r,t),t.spec!==null&&await E(r,t.spec,t),t.spec!==null&&(await C(r,t.spec,"cancelled"),await k(r,t.spec,"cancelled")),e.writeln(m("\u2714")," Spec cancelled."),await e.close(),o(void 0)};export{F as main};
@@ -0,0 +1,16 @@
1
+ import{a as R,c as O,d as S,e as T}from"./chunk-MRZT23BL.js";import{a as P}from"./chunk-7UX6WIXX.js";import{c as N}from"./chunk-YK6UG66R.js";var q=[{id:"status_quo",text:"What does the user do today without this feature?",concerns:["product:status_quo","eng:replace_scope","qa:regression_risk"]},{id:"ambition",text:"Describe the 1-star and 10-star versions.",concerns:["product:scope_direction","eng:complexity_tier","qa:test_depth"]},{id:"reversibility",text:"Does this change involve an irreversible decision?",concerns:["product:one_way_door","eng:migration_strategy","qa:verification_stringency"]},{id:"user_impact",text:"Does this change affect existing users' behavior?",concerns:["product:breaking_change","eng:backward_compat","qa:regression_tests"]},{id:"verification",text:"How do you verify this works correctly?",concerns:["product:success_metric","eng:test_strategy","qa:acceptance_criteria"]},{id:"scope_boundary",text:"What should this feature NOT do?",concerns:["product:focus","eng:out_of_scope","qa:negative_tests"]}],C=e=>q.map(t=>({...t,extras:O(e,t.id)}));var L=e=>{let t=new Set(e.map(n=>n.questionId));return q.every(n=>t.has(n.id))};var w=e=>N(e),o=(e,t)=>{if(t===null)return w(e);let n=e.indexOf(" ");if(n===-1)return w(`${e} --spec=${t}`);let s=e.slice(0,n),r=e.slice(n);return w(`${s} --spec=${t}${r}`)},Y="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.",F={hasAskUserTool:!0,optionPresentation:"tool",hasSubAgentDelegation:!0,subAgentMethod:"task"},M=(e,t,n,s,r=F)=>{let h=e.execution.iteration>=t,c="You are a senior engineer and a scrum master who takes pride in honest reporting. Your reputation depends on accuracy, not speed. You are responsible for others' toil, and you are a perfect example of a servant leader. When reporting progress: if something is NOT implemented, say so \u2014 don't hide it. If partially done, say 'partially done: [what works] / [what doesn't]'. If untested, say 'implemented but untested'. NEVER say 'done' for something you haven't verified yourself. Underpromise \u2014 4 of 6 done means '4 of 6 done, 2 remaining', not 'almost done'.",d="Never skip steps or make decisions without asking the user. If you think something can be skipped or inferred, ask first. Explicit > Clever.",f=r.hasAskUserTool?"At every decision point (discovery questions, classification, spec approval, expansion proposals, architectural decisions, rule promotion), you MUST use AskUserQuestion to get the user's input. You MUST NOT make decisions, infer preferences, or assume the user's intent. If you're unsure whether something is a decision point, it is \u2014 ask.":"At every decision point (discovery questions, classification, spec approval, expansion proposals, architectural decisions, rule promotion), you MUST ask the user. Present options as a numbered list and ask the user to pick a number. You MUST NOT make decisions, infer preferences, or assume the user's intent. If you're unsure whether something is a decision point, it is \u2014 ask.",g="At every decision point where you present options to the user, share your recommendation BEFORE asking. Say what you think and why, then ask if the user agrees. Format: 'I'd recommend X because [reason]. Agree, or would you prefer Y?' The user always has the final word, but you save them cognitive load by proposing first.",u="noskills is a live state machine the user watches in real-time. Call noskills ONCE per interaction. Ask ONE question, wait for the user's answer, submit it. Never batch-submit, never backfill, never answer questions yourself.",i=n?[c,d,f,g,u]:[Y,c,d,f,g,u],l=s?.outOfScope??[],p=e.spec;switch(e.phase){case"FREE":return{rules:[],tone:"Quiet. No enforcement."};case"IDLE":{let a=r.optionPresentation==="tool"?["When interactiveOptions are present, pass them DIRECTLY as the `options` array in AskUserQuestion \u2014 they are already in the correct {label, description} format. You MUST also provide a `header` field (max 12 chars, e.g. 'Action') and a `question` field. When the user picks an option, look up its label in the `commandMap` object to find the command to execute.","For availableConcerns: use AskUserQuestion with multiSelect:true. AskUserQuestion supports max 4 options per question and max 4 questions per call. If there are more than 4 concerns, split them across two questions within the same AskUserQuestion call (e.g., first 3 in question 1, remaining in question 2). NEVER silently drop concerns \u2014 present ALL available concerns to the user, even if it requires multiple questions."]:[`When interactiveOptions are present, present them as a numbered list. For each option show the number, label, and description. Ask the user to pick a number. When the user picks an option, look up its label in the \`commandMap\` object to find the command to execute. Example format:
2
+
3
+ 1. Start a new spec \u2014 Begin discovery questions for a new feature
4
+ 2. Add concerns \u2014 Shape how discovery and specs work
5
+
6
+ Pick a number:`,"For availableConcerns: present ALL available concerns as a numbered list. NEVER silently drop concerns \u2014 present ALL available concerns to the user. Ask the user to enter the numbers of the concerns they want to activate (comma-separated)."],m=r.hasAskUserTool?"For availableConcerns: use AskUserQuestion with multiSelect:true. AskUserQuestion supports max 4 options per question and max 4 questions per call. If there are more than 4 concerns, split them across two questions within the same AskUserQuestion call (e.g., first 3 in question 1, remaining in question 2). NEVER silently drop concerns \u2014 present ALL available concerns to the user, even if it requires multiple questions.":void 0,k=m!==void 0?[a[0],m]:a;return{rules:["You MUST NOT create, edit, or delete any project file until you have either entered free mode or created and approved a spec. No exceptions. No 'quick fixes'. Choose: `noskills free` for unstructured work, or `noskills spec new` for structured work.",...i,...k,"Do not take action without the user choosing an option first.","When the user wants to create a new spec, they can provide anything: a one-line description, a full task list, meeting notes, a kanban card, a customer email, or a detailed requirements document. Accept whatever format they provide. If it's long, summarize it into a spec title for the slug but preserve the full text as context for discovery.","After running spec new, ask the user if they want full discovery, quick discovery, or skip to spec draft. Full discovery: pre-scan, premise challenge, 6 questions, expansions, architecture, error map, synthesis. Quick discovery: only questions relevant to active concerns, skip expansions and error map. Skip to spec draft: classification \u2192 approve \u2192 execute. Never skip discovery without asking."],tone:"Welcoming. Present choices, then wait."}}case"DISCOVERY":{let a=r.hasAskUserTool?"You MUST ask each discovery question using AskUserQuestion tool. You MUST NOT answer questions yourself or infer answers from the spec description. You MUST NOT submit discovery answers without the user explicitly providing each answer through AskUserQuestion. Each question \u2192 one AskUserQuestion call \u2192 user answers \u2192 next question. If the user already gave a detailed description in spec new, you may PRE-FILL suggested answers as option descriptions in AskUserQuestion \u2014 but the user must still confirm or override each one. If the user provided a fully formed plan, you may skip Phase 2 (questions) but you MUST still run premise challenge and alternatives. Never skip premise challenge.":"You MUST ask each discovery question by presenting it to the user as text. You MUST NOT answer questions yourself or infer answers from the spec description. You MUST NOT submit discovery answers without the user explicitly providing each answer. Each question \u2192 present it \u2192 user answers \u2192 next question. If the user already gave a detailed description in spec new, you may PRE-FILL suggested answers \u2014 but the user must still confirm or override each one. If the user provided a fully formed plan, you may skip Phase 2 (questions) but you MUST still run premise challenge and alternatives. Never skip premise challenge.";return{modeOverride:"You are in plan mode. Do not attempt to create, edit, or write any files. Do not run any shell commands that modify state. You can read files and run read-only commands to understand the codebase. Your ONLY job right now is to think and talk. Read code to understand. Ask questions to discover. Challenge assumptions. Propose ideas. Debate tradeoffs. But NEVER create, edit, or delete project files. Discovery exists to catch what you don't yet know you don't know.",rules:[...i,a,"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).","BEFORE asking any discovery questions, conduct a pre-discovery codebase scan: read the project README, CLAUDE.md, and any design docs; check the last 20 git commits (git log --oneline -20); look for TODO files, open issue references, and existing specs; scan the directory structure to understand the project shape. Then present a brief 'Pre-discovery audit' summary: stack detected, recent work themes, open TODOs, existing specs. This gives you CONTEXT to ask INFORMED questions, not blind ones.","After the pre-discovery codebase scan and BEFORE starting questions, ask the user: 'What kind of discovery do you need? A) Explore scope \u2014 I'll help expand, find opportunities, think bigger. B) Technical depth \u2014 I'll focus on architecture, error handling, implementation strategy. C) Validate my plan \u2014 I already know what I want, challenge my assumptions. D) Ship fast \u2014 minimal scope, cut the fat, get to tasks quickly.' Adapt your discovery emphasis accordingly: Explore \u2192 heavy on expansion proposals and dream state; Technical \u2192 heavy on architectural decisions and error/rescue map; Validate \u2192 heavy on premise challenge and pushback; Ship fast \u2192 minimal questions, skip expansions, go direct to classification and tasks.","Before starting discovery questions, challenge the user's initial spec description against what you learned from the codebase scan. Look for: hidden complexity they haven't mentioned, conflicts with existing code, scope that's bigger or smaller than they think, existing modules that overlap with what they're asking for. Share your observations and ask clarifying follow-ups, then proceed to questions.","When asking discovery questions, use your codebase knowledge to offer concrete options alongside the open-ended question. For example, instead of just 'What does the user do today?' present: 'Based on the codebase, I see three likely scenarios: A) ... B) ... C) ... D) Something else \u2014 describe it. Which is closest?' The user can always pick 'something else' but concrete options speed up the conversation and force specificity.",r.hasAskUserTool?"Ask one question at a time using AskUserQuestion tool.":"Ask one question at a time. Present it as text and wait for the user's response.","Push back on vague answers \u2014 you will be the one executing this spec, vague answers make your job harder.","When the user gives a short answer, follow up: 'Can you be more specific?'","After collecting discovery answers, synthesize a CURRENT STATE \u2192 THIS SPEC \u2192 6-MONTH IDEAL vision before generating the spec. Show three columns: where the project is now, what this spec achieves, and where it could go in 6 months. Note: 'This spec moves you from column 1 to column 2. Column 3 is out of scope but worth knowing \u2014 every decision in this spec should keep column 3 possible.' This helps the user see if the scope is right.","When you spot expansion opportunities during discovery (from codebase scan, TODOs, concern requirements, synergies with the current plan), present each as a numbered proposal (1/N, 2/N...). Every proposal MUST include: clear description of WHAT and WHY (how it connects to the current plan); effort estimate as S/M/L/XL with human time and CC time estimates (e.g., 'S (human: ~1 day / CC: ~15 min)' \u2014 not just 'small'); risk assessment as Low/Low-Med/Med/Med-High/High naming the specific risk factor; completeness delta showing X/10 without this and Y/10 with this. Every proposal gets three options: A) Add to scope B) Defer to future spec C) Skip \u2014 not interested, plus 'Chat about this' and 'Skip remaining proposals' escape hatches.","After discovery questions and expansion proposals, identify architectural decisions that must be resolved before implementation. These are decisions where choosing A vs B changes the shape of multiple tasks, the data model, the API surface, or system boundaries. Present each as a concrete technical question with options, a RECOMMENDATION with reasoning, and completeness scores. Show how each option affects downstream work (e.g., 'If you choose B, tasks 3 and 4 need a job queue setup step added'). Only surface decisions that BLOCK implementation \u2014 not preferences or nice-to-haves. If the user says 'I don't know yet', mark it as a risk: 'UNRESOLVED: [decision] TBD. Tasks X-Y may change.' Never allow implementation to start with unresolved architectural decisions \u2014 flag them prominently in the spec.","Before finalizing, map error and rescue paths for every significant codepath in the planned work. Create a table: codepath | what can go wrong | how it's handled. Identify CRITICAL GAPS \u2014 failure modes that the plan doesn't address. Present each critical gap as a decision with options, a recommendation, and completeness scores, just like architectural decisions. Resolved gaps become tasks or acceptance criteria. Unresolved gaps become risk flags. Think like an SRE reviewing a design doc \u2014 what fails at 3am?","After all discovery questions, expansion proposals, architectural decisions, and error mapping are complete, present a DISCOVERY SUMMARY for the user to review: intent, ambition, reversibility, impact, verification, out of scope, the dream state table (current \u2192 this spec \u2192 future), accepted/deferred/skipped expansions, resolved architectural decisions, and the error/rescue map. Ask for confirmation before generating the spec. This is the last chance to catch misunderstandings.","Once you have a substantive answer for each question, collect all answers and submit them together in a single `noskills next --answer` call as a JSON object."],tone:"Curious interviewer who has a stake in the answers and comes PREPARED. You've read the codebase before asking. Challenge assumptions, offer concrete options, think about architecture and failure modes. Think deeply before asking each question."}}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:[...i,"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":return{modeOverride:"You are in plan mode. Do not attempt to create, edit, or write any files. Do not run any shell commands that modify state. You can read files and run read-only commands to understand the codebase. Your ONLY job right now is to think and talk. Read code to understand. Ask questions to discover. Challenge assumptions. Propose ideas. Debate tradeoffs. But NEVER create, edit, or delete project files. Discovery exists to catch what you don't yet know you don't know.",rules:[...i,"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.","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.","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"}'`,p)+"`. 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:[...i,"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 a=[];r.subAgentMethod==="task"?a.push(`When you receive a task from noskills next, do NOT execute it yourself. Spawn the noskills-executor sub-agent using the Agent tool. Pass it: the task title, description, acceptance criteria (with IDs), behavioral rules, out-of-scope constraints, concern reminders, and relevant file paths. When the sub-agent completes, review its results briefly, then report to noskills via \`${o(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`,p)}\`. You are the orchestrator \u2014 the sub-agent is the implementer.`,"If the sub-agent fails, errors out, or returns no results, fall back to executing the task directly yourself. Report the sub-agent failure in your next status report so it can be investigated.","After the noskills-executor sub-agent completes a task, spawn a noskills-verifier sub-agent to independently verify the work. Pass it: the list of changed files, the acceptance criteria, and the test commands. The verifier reports PASS/FAIL per criterion with evidence. Use the verifier's report as your status report to noskills. Do NOT submit status reports based solely on the executor's self-report.",`After spawning sub-agents, ALWAYS present a dispatch table showing the FULL pipeline \u2014 not just executors, but also verification and test steps:
7
+
8
+ | Step | Agent | Files | Tasks | Est. Time |
9
+ |------|-------|-------|-------|-----------|
10
+ | 1. Implement | noskills-executor | purge.ts | Tasks 1-6 | ~3 min |
11
+ | 2. Verify | noskills-verifier | purge.ts (read-only) | Validate ACs | ~1 min |
12
+ | 3. Write tests | noskills-executor | purge.test.ts | Task 7 | ~2 min |
13
+
14
+ When agents complete, update with actual time and status (Done / Failed / Found N issues). The user should see the complete plan upfront.
15
+
16
+ Estimate: S ~1min, M ~2min, L ~5min, XL ~10min.`,"The agent that writes implementation code must NOT write tests for that code. Spawn a SEPARATE sub-agent for test writing. This prevents the implementer from writing tests that only confirm what it already knows. The test writer reads the code fresh and tests what it actually does, not what the implementer intended.","When deciding how to split work across sub-agents: if all tasks touch the same file or tightly coupled files, batch them into one executor. If tasks touch independent files or modules, spawn parallel executors. Always err toward smaller, focused sub-agents over large batched ones \u2014 fresh context per task is better than accumulated context across tasks."):r.subAgentMethod==="delegation"?a.push(`When you receive a task from noskills next, use Kiro's agent delegation to spawn the noskills-executor agent. Pass it: the task title, description, acceptance criteria (with IDs), behavioral rules, out-of-scope constraints, concern reminders, and relevant file paths. When the agent completes, review its results briefly, then report to noskills via \`${o(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`,p)}\`. You are the orchestrator \u2014 the delegated agent is the implementer.`,"If the delegated agent fails, errors out, or returns no results, fall back to executing the task directly yourself. Report the agent failure in your next status report so it can be investigated.","After the noskills-executor agent completes a task, delegate to the noskills-verifier agent to independently verify the work. Pass it: the list of changed files, the acceptance criteria, and the test commands. The verifier reports PASS/FAIL per criterion with evidence. Use the verifier's report as your status report to noskills. Do NOT submit status reports based solely on the executor's self-report.","When deciding how to split work across delegated agents: if all tasks touch the same file or tightly coupled files, batch them into one executor. If tasks touch independent files or modules, spawn parallel executors. Always err toward smaller, focused agents over large batched ones \u2014 fresh context per task is better than accumulated context across tasks."):a.push("Execute tasks sequentially in this context. Do not attempt to spawn sub-agents \u2014 this tool does not support agent delegation. Complete each task yourself, verify your work (run type checks and tests), then report progress.",`After completing a task, report to noskills via \`${o(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`,p)}\`.`);let m=[...i,"You are the orchestrator, not the implementer. NEVER create, edit, or delete project files directly. ALWAYS delegate to noskills-executor sub-agent, even for single-line changes. There is no 'minor change' \u2014 every edit goes through the executor\u2192verifier pipeline. Your job: read noskills output, spawn sub-agents, report status.","Do not explore the codebase beyond what the current task requires.","Do not refactor, improve, or modify code outside this task's scope.","Do not add features, tests, or documentation not specified in the spec.","If you need to read files to understand context, timebox it \u2014 then write code.","The deliverable is working code, not a plan or analysis.","Complete the task, then report progress. The user handles git.",...a,`When you discover a pattern, receive a correction, or identify a recurring preference from the user, ask: 'Should this be a permanent rule for this project, or just for this task?' If permanent, run: \`${w('rule add "<description>"')}\`. If just this task, note it and move on. Never write to \`.eser/rules/\` directly.`];e.execution.lastVerification?.passed===!1&&m.push("Tests are failing. Fix ONLY the failing tests. Do not refactor passing code.");let k={rules:m,tone:"Direct. Orchestrate immediately \u2014 spawn sub-agents.",outOfScope:l.length>0?l:void 0};return h?{...k,urgency:`You have been in this session for ${e.execution.iteration}+ iterations. Your context is degrading. Finish the current task and recommend the user start a fresh session. Do not start new tasks.`}:k}case"BLOCKED":return{rules:[...i,"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:[...i,"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:[...i,`Run \`${o("next",p)}\` to get your instructions.`,"Do not take action without noskills guidance."],tone:"Neutral. Waiting for direction."}}},W=5*60*1e3,B=(e,t)=>{let n=e.spec,s;switch(e.phase){case"IDLE":s=`No active spec. Start one with: \`${w('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}},V=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 COMPLETED",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>W)return{what:"noskills orchestrates your work: IDLE \u2192 DISCOVERY \u2192 DISCOVERY_REVIEW \u2192 SPEC_DRAFT \u2192 SPEC_APPROVED \u2192 EXECUTING \u2192 COMPLETED",how:`Run \`${o("next",t)}\` for instructions. Submit results with \`${o('next --answer="..."',t)}\`. Never make architectural decisions without asking.`,currentPhase:e.phase}},re=(e,t,n,s,r,h,c,d)=>{let f=B(e,t),g=s?.maxIterationsBeforeRestart??15,u=s?.allowGit??!1,i=d??F,l=M(e,g,u,r,i),p=V(e),a;switch(e.phase){case"IDLE":a=U(t,R,n.length,c);break;case"DISCOVERY":a=H(e,t,n);break;case"DISCOVERY_REVIEW":a=G(e,t);break;case"SPEC_DRAFT":a=X(e);break;case"SPEC_APPROVED":a=K(e);break;case"EXECUTING":a=Z(e,t,n,g,r,h);break;case"BLOCKED":a=ee(e);break;case"COMPLETED":a=te(e);break;case"FREE":a={phase:"FREE",instruction:"Free mode \u2014 no enforcement active. Work as you wish."};break;default:a=U(t,R,n.length,c)}let m={...a,meta:f,behavioral:l};p!==void 0&&(m={...m,protocolGuide:p});let k=Q(e,t,c);if(k.length>0){let x=k.map(({label:y,description:b})=>({label:y,description:b})),I={};for(let y of k)I[y.label]=y.command;let D=i.optionPresentation==="tool"?"AskUserQuestion":"prose-numbered-list",E=i.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.";m={...m,interactiveOptions:x,commandMap:I,toolHint:D,toolHintInstruction:E}}return m},Q=(e,t,n)=>{let s=e.spec;switch(e.phase){case"IDLE":{let r=[],c=(n?.existingSpecs??[]).filter(d=>d.phase!=="COMPLETED");t.length===0&&r.push({label:"Add concerns (Recommended)",description:"Shape how discovery and specs work by adding project concerns",command:w("concern add <id> [<id2> ...]")}),r.push({label:"Start a new spec",description:"Begin discovery questions for a new feature",command:w('spec new --name=<slug> "description"')}),r.push({label:"Free mode",description:"No enforcement \u2014 work freely until you want structure",command:w("free")});for(let d of c.slice(0,2))r.push({label:`Continue: ${d.name} (${d.phase})`,description:d.detail??`Iteration ${d.iteration}`,command:o("next",d.name)});return t.length>0&&r.push({label:"Edit concerns",description:`Currently: ${t.map(d=>d.id).join(", ")}`,command:w("concern list")}),r.slice(0,4)}case"DISCOVERY_REVIEW":return[{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)},{label:"Split into separate specs",description:"Create one spec per independent area (if split proposed)",command:o('next --answer="split"',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:"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:"Not yet",description:'Save for later \u2014 resume with noskills next --answer="start"',command:""}];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:w('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:w("status")}];default:return[]}},j="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.",U=(e,t,n,s)=>({phase:"IDLE",instruction:"Present the welcome dashboard and interactive options to the user. Show existing specs if any, then present choices. IMPORTANT: Present ALL available concerns to the user \u2014 never truncate the list. Split across multiple AskUserQuestion calls if needed.",welcome:j,existingSpecs:s?.existingSpecs??[],availableConcerns:t.map(r=>({id:r.id,description:r.description})),activeConcerns:e.map(r=>r.id),activeRulesCount:s?.rulesCount??n,hint:e.length===0?"No concerns active. Consider adding concerns first \u2014 they shape discovery questions and specs.":void 0}),H=(e,t,n)=>{let s=e.spec,r=C(t),h=e.discovery.answers.length,c=L(e.discovery.answers),d=e.discovery.audience==="agent";if(c)return{phase:"DISCOVERY",instruction:`All discovery questions answered. Run: \`${o("approve",s)}\``,questions:[],answeredCount:h,context:{rules:n,concernReminders:[]},transition:{onComplete:o("approve",s)}};if(d){let u=e.discovery.currentQuestion,i=r[u];if(i===void 0)return{phase:"DISCOVERY",instruction:`All discovery questions answered. Run: \`${o("approve",s)}\``,questions:[],answeredCount:h,context:{rules:n,concernReminders:[]},transition:{onComplete:o("approve",s)}};let l={id:i.id,text:i.text,concerns:[...i.concerns],extras:i.extras.map(p=>p.text)};return{phase:"DISCOVERY",instruction:`Ask this question to the user using AskUserQuestion. Submit the answer with: \`${o('next --agent --answer="<answer>"',s)}\``,questions:[l],answeredCount:h,currentQuestion:u,totalQuestions:r.length,context:{rules:n,concernReminders:S(t)},transition:{onComplete:`${o('next --agent --answer="<answer>"',s)}`}}}let f=new Set(e.discovery.answers.map(u=>u.questionId));return{phase:"DISCOVERY",instruction:"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:r.filter(u=>!f.has(u.id)).map(u=>({id:u.id,text:u.text,concerns:[...u.concerns],extras:u.extras.map(i=>i.text)})),answeredCount:h,context:{rules:n,concernReminders:S(t)},transition:{onComplete:`${o(`next --answer='{"status_quo":"...","ambition":"...",...}'`,s)}`}}},G=(e,t)=>{let n=e.spec,s=C(t),r=e.discovery.answers.map(c=>{let d=s.find(f=>f.id===c.questionId);return{questionId:c.questionId,question:d?.text??c.questionId,answer:c.answer}}),h=P(e.discovery.answers);return{phase:"DISCOVERY_REVIEW",instruction:h.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:h.detected?h:void 0}},X=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 for review. Ask the user to review and approve.",specPath:e.specState.path??"",transition:{onApprove:o("approve",t)}}},K=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)}`}}},z=(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},J=(e,t,n,s,r,h,c,d)=>{let f=[],g=new Set(d??[]),u=0,i=()=>`ac-${++u}`;if(s!==null)for(let l of s.items)g.has(l.id)||f.push({id:l.id,text:`[DEBT from iteration ${l.since}] ${l.text}`});if(t&&f.push({id:i(),text:`[FAILED] Tests \u2014 fix this first: ${n.slice(0,200)}`}),h!=null)for(let l of h.verification){let p=i();g.has(p)||f.push({id:p,text:l})}for(let l of e)if(l.acceptanceCriteria!==void 0&&l.acceptanceCriteria.length>0)for(let p of l.acceptanceCriteria){if(!z(p,r))continue;let a=i();g.has(a)||f.push({id:a,text:`(${l.id}) ${p}`})}if(c!==void 0)for(let l of c){let p=i();g.has(p)||f.push({id:p,text:`(folder: ${l.folder}) ${l.rule}`})}return f},Z=(e,t,n,s,r,h)=>{let c=e.spec,d=T(t),f=e.execution.iteration>=s,g=e.execution.lastVerification?.passed===!1,u=e.execution.lastVerification?.output??"",i=r?.tasks??[],l=e.execution.completedTasks??[],p=new Set(l),a=i.find(v=>!p.has(v.id))??null,m=a!==null?{id:a.id,title:a.title,totalTasks:i.length,completedTasks:l.length}:void 0;if(e.execution.awaitingStatusReport){let v=J(t,g,u,e.execution.debt,e.classification,r,h,e.execution.naItems),A={phase:"EXECUTING",instruction:"Before this task is accepted, report your completion status against these acceptance criteria.",context:{rules:n,concernReminders:S(t)},transition:{onComplete:`${o(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`,c)}`,onBlocked:`${o('block "reason"',c)}`,iteration:e.execution.iteration},statusReportRequired:!0,statusReport:{criteria:v,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 g&&(A={...A,verificationFailed:!0,verificationOutput:u.slice(0,2e3)}),A}let k=(e.execution.lastProgress??"").includes("Task not accepted"),x=e.execution.debt?.items??[],I=e.execution.debt?.unaddressedIterations??0,D=m!==void 0?`Execute task ${m.id}: ${m.title} (${m.completedTasks}/${m.totalTasks} completed)`:"All tasks completed. Run `"+o("done",c)+"` to finish.",E;if(g)E="Verification FAILED. Fix the failing tests before continuing.";else if(k&&x.length>0){let v=I>=3?` These items have been outstanding for ${I} iterations.`:"";E=`Task not accepted \u2014 ${x.length} remaining item(s) must be addressed before this task can be completed.${v} Address them, then submit a new status report.`}else E=D;let y={phase:"EXECUTING",instruction:E,task:m,context:{rules:n,concernReminders:S(t)},transition:{onComplete:`${o('next --answer="..."',c)}`,onBlocked:`${o('block "reason"',c)}`,iteration:e.execution.iteration}};if(k&&x.length>0&&(y={...y,taskRejected:!0,rejectionReason:`${x.length} remaining item(s) must be addressed.`,rejectionRemaining:x.map(v=>v.text)}),e.execution.debt!==null&&e.execution.debt.items.length>0){let v=e.execution.debt.unaddressedIterations??0,A=v>=3?`URGENT: These items have been unaddressed for ${v} iterations. Address them IMMEDIATELY before any new work.`:"These were not completed in a previous iteration. Address them BEFORE starting new work.";y={...y,previousIterationDebt:{fromIteration:e.execution.debt.fromIteration,items:e.execution.debt.items,note:A}}}if(g){let v=u.slice(0,2e3);y={...y,verificationFailed:!0,verificationOutput:v}}d.length>0&&(y={...y,concernTensions:d}),f&&(y={...y,restartRecommended:!0,restartInstruction:`Context may be getting large after ${e.execution.iteration} iterations. Consider starting a new conversation and running \`${o("next",c)}\` to resume - your progress is saved.`});let b=[...e.decisions].reverse().find(v=>!v.promoted);return b!==void 0&&e.execution.lastProgress?.startsWith("Resolved:")&&(y={...y,promotePrompt:{decisionId:b.id,question:b.question,choice:b.choice,prompt:`You just resolved a decision: "${b.choice}". Ask the user: "Should this be a permanent rule for future specs too?" If yes, run: \`${w(`rule add "${b.choice}"`)}\``}}),y},ee=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)}`}}},te=e=>({phase:"COMPLETED",summary:{spec:e.spec,iterations:e.execution.iteration,decisionsCount:e.decisions.length,completionReason:e.completionReason,completionNote:e.completionNote}});export{q as a,C as b,L as c,re as d};
@@ -0,0 +1 @@
1
+ var d={detected:!1,reason:"",proposals:[]},g=[/\badditionally\b/i,/\bseparately\b/i,/\band also\b/i,/\banother issue\b/i,/\bsecond problem\b/i,/\bon the other hand\b/i,/\bplus\b/i],p=/(?:^|[.!?]\s+)also[,\s]/im,h=/(?:^|\n|\.\s+)\s*(?:\(\d+\)|\d+\.\s|(?:first|second|third|fourth|fifth)[:;,])/im,b=/\b(fix|add|restore|update|remove|refactor|rewrite|implement|create|migrate|convert)\s+\S+(?:\s+\S+){0,4}\s+AND\s+(fix|add|restore|update|remove|refactor|rewrite|implement|create|migrate|convert)\s+/i,y=[/\buse\s+(?:the\s+)?(?:new\s+)?(\w+)\s+(?:type|interface|class|module|function)\b/i,/\bafter\s+(?:adding|creating|implementing)\b/i,/\bdepends\s+on\b/i,/\bprerequisite\b/i,/\brequires\s+(?:the\s+)?(?:above|previous|first)\b/i,/\bthen\s+use\b/i],E=(e,n)=>{if(n==="ship-fast")return d;let t=new Map;for(let l of e)t.set(l.questionId,l.answer);let r=t.get("status_quo")??"",s=t.get("ambition")??"",o=t.get("scope_boundary")??"",i=t.get("verification")??"",a=w(r,s,o,i);return a.length<2||a.reduce((l,m)=>l+m.estimatedTasks,0)<=3||R(a)?d:{detected:!0,reason:`Discovery answers cover ${a.length} independent areas that could be separate specs.`,proposals:a}},w=(e,n,t,r)=>{let s=A(e,n);if(s.length>=2)return s.map(u);let o=x(e,n);if(o.length>=2)return o.map(u);let i=P(e,n);return i.length>=2?i.map(u):[]},A=(e,n)=>{for(let[t,r]of[[e,"status_quo"],[n,"ambition"]]){if(!h.test(t))continue;let s=S(t);if(s.length>=2)return s.map(o=>({text:o.trim(),sourceQuestions:[r]}))}return[]},S=e=>{let t=e.split(/\(\d+\)\s*/).slice(1).map(c=>c.trim()).filter(c=>c.length>0);if(t.length>=2)return t;let r=e.split(/(?:^|\n|(?<=\.)\s+)\s*\d+\.\s+/),s=r.length>1?r.slice(1).map(c=>c.trim()).filter(c=>c.length>0):[];if(s.length>=2)return s;let o=/(?:^|\n|(?<=\.)\s+)\s*(?:first|second|third|fourth|fifth)[:;,]\s*/i,i=e.split(o),a=i.length>1?i.slice(1).map(c=>c.trim()).filter(c=>c.length>0):[];return a.length>=2?a:[]},x=(e,n)=>{for(let[t,r]of[[e,"status_quo"],[n,"ambition"]]){if(p.test(t)){let s=v(t,p);if(s.length>=2)return s.map(o=>({text:o.trim(),sourceQuestions:[r]}))}for(let s of g)if(s.test(t)){let o=t.split(s).map(i=>i.trim()).filter(i=>i.length>0);if(o.length>=2)return o.map(i=>({text:i,sourceQuestions:[r]}))}}return[]},v=(e,n)=>{let t=e.match(n);if(t===null||t.index===void 0)return[];let r=e.slice(0,t.index).trim(),s=e.slice(t.index+t[0].length).trim();return r.length>0&&s.length>0?[r,s]:[]},P=(e,n)=>{for(let[t,r]of[[e,"status_quo"],[n,"ambition"]]){let s=b.exec(t);if(s!==null&&s.index!==void 0){let o=t.toUpperCase().indexOf(" AND ",s.index);if(o>=0){let i=t.slice(0,o).trim(),a=t.slice(o+5).trim();if(i.length>0&&a.length>0)return[{text:i,sourceQuestions:[r]},{text:a,sourceQuestions:[r]}]}}}return[]},u=e=>{let n=T(e.text),t=N(e.text);return{name:n,description:e.text,estimatedTasks:t,relevantAnswers:[...e.sourceQuestions]}},T=e=>{let n=new Set(["the","a","an","is","are","was","were","be","been","being","have","has","had","do","does","did","will","would","shall","should","may","might","must","can","could","to","of","in","for","on","with","at","by","from","that","this","it","its","and","or","but","not","no","so","if","then","too","very","just"]),s=e.toLowerCase().replace(/[^a-z0-9\s-]/g,"").split(/\s+/).filter(o=>o.length>0&&!n.has(o)).slice(0,4).join("-").replace(/--+/g,"-").replace(/^-|-$/g,"").slice(0,50);return s.length>0?s:"area"},N=e=>{let n=/\b(fix|add|restore|update|remove|refactor|rewrite|implement|create|migrate|convert|replace|extract|move|rename|split|merge|test|verify|validate|configure|setup|install|deploy)\b/gi,r=e.match(n)?.length??0;return Math.max(2,Math.min(r+1,5))},R=e=>{for(let n=0;n<e.length;n++)for(let t=n+1;t<e.length;t++){let r=e[n],s=e[t],o=`${r.description} ${s.description}`;for(let l of y)if(l.test(o))return!0;let i=f(r.description),a=f(s.description);if([...i].filter(l=>a.has(l)).some(l=>/^[A-Z]/.test(l)||l.includes(".")))return!0}return!1},f=e=>{let n=new Set,t=e.match(/\b[A-Z][a-zA-Z0-9]+\b/g);if(t!==null)for(let s of t)n.add(s);let r=e.match(/\b[\w-]+\.\w{1,4}\b/g);if(r!==null)for(let s of r)n.add(s);return n};export{E as a};
@@ -0,0 +1 @@
1
+ import{a as T,b as J,e as B,f as N,g as q,h as G,i as U,j as h,k as r,l as y}from"./chunk-73EEM3FY.js";import{a as ie,b as ne,c as re}from"./chunk-VK7L5SMS.js";import{d as Z}from"./chunk-7GUYMD3Z.js";import{a as ee,b as te,c as oe}from"./chunk-ZMVD5IU4.js";import{b as I}from"./chunk-MRZT23BL.js";import"./chunk-7UX6WIXX.js";import{d as se}from"./chunk-TJZAIUKM.js";import{a as X,c as A,d as Y}from"./chunk-YK6UG66R.js";import{a as W,b as z,i as H,m as _,o as K,q as V,s as Q}from"./chunk-LWCWPXCS.js";import"./chunk-AGPCY6XP.js";import{a as k}from"./chunk-ERX4HONR.js";import"./chunk-Y6AFIAJP.js";import"./chunk-5MN3MWQN.js";import"./chunk-OLM5RTFK.js";import{a as F}from"./chunk-ALZM4JXG.js";import{a as S}from"./chunk-2N4GTHXQ.js";import"./chunk-BBKSV2RO.js";import{b as g}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var he=new F({description:"AI provider interface \u2014 ask questions, generate content",modules:{ask:{description:"Send a prompt to an AI provider",load:()=>import("./ask-F4XM2EEC.js")},list:{description:"List available AI providers",load:()=>import("./list-3RK7TPGG.js")}}});var ae=k;var ve=async t=>{try{return await g.fs.stat(t),!0}catch{return!1}},we=[{id:"claude-code",paths:["CLAUDE.md",".claude"]},{id:"cursor",paths:[".cursorrules",".cursor"]},{id:"kiro",paths:[".kiro"]},{id:"copilot",paths:[".github/copilot-instructions.md"]},{id:"windsurf",paths:[".windsurfrules"]},{id:"codex",paths:[".codex",".codex/config.toml"]},{id:"copilot-cli",paths:[".copilot",".github/hooks"]}],le=async t=>{let e=[];for(let i of we)for(let o of i.paths)if(await ve(`${t}/${o}`)){e.push(i.id);break}return e};var a=async t=>{try{return await g.fs.stat(t),!0}catch{return!1}},ce=async(t,e)=>{try{let i=await g.fs.readTextFile(t);return JSON.parse(i)[e]??null}catch{return null}},xe=async t=>{let e=[];return(await a(`${t}/package.json`)||await a(`${t}/deno.json`))&&e.push("typescript"),await a(`${t}/go.mod`)&&e.push("go"),await a(`${t}/Cargo.toml`)&&e.push("rust"),(await a(`${t}/pyproject.toml`)||await a(`${t}/setup.py`))&&e.push("python"),e},Pe=async t=>{let e=[],i=await ce(`${t}/package.json`,"dependencies");return i!==null&&("react"in i&&e.push("react"),"vue"in i&&e.push("vue"),"svelte"in i&&e.push("svelte"),"next"in i&&e.push("nextjs"),"express"in i&&e.push("express"),"hono"in i&&e.push("hono")),e},Se=async t=>{let e=[];return await a(`${t}/.github/workflows`)&&e.push("github-actions"),await a(`${t}/.gitlab-ci.yml`)&&e.push("gitlab-ci"),await a(`${t}/Jenkinsfile`)&&e.push("jenkins"),await a(`${t}/.circleci`)&&e.push("circleci"),e},Te=async t=>{if(await a(`${t}/deno.json`))return"deno";let e=await ce(`${t}/package.json`,"devDependencies");if(e!==null){if("vitest"in e)return"vitest";if("jest"in e)return"jest";if("playwright"in e)return"playwright"}return null},de=async t=>{let[e,i,o,d]=await Promise.all([xe(t),Pe(t),Se(t),Te(t)]);return{languages:e,frameworks:i,ci:o,testRunner:d}};var It=async t=>{let e=g.process.cwd(),i=ne(t),o=J({target:i==="agent"?"non-interactive":"interactive"}),d=re(t),b=pe(d,"--concerns"),f=pe(d,"--tools"),p=d.includes("--non-interactive")||i==="agent";if(await Q(e))return r.warn(o,"noskills is already initialized in this project."),r.info(o,`Run \`${A("sync")}\` to regenerate tool files.`),S(void 0);N(o,"noskills init");let D=y(o,"Scanning project...");D.start();let m=await de(e);D.succeed("Project scanned");for(let s of m.languages)r.step(o,` ${s}`);for(let s of m.frameworks)r.step(o,` ${s}`);for(let s of m.ci)r.step(o,` ${s}`);m.testRunner!==null&&r.step(o,` test runner: ${m.testRunner}`),h(o);let R=y(o,"Detecting coding tools...");R.start();let $=await le(e),v=ie(),E=v!==null&&!$.includes(v)?[v]:[],w=[...new Set([...E,...$])];R.succeed(`${w.length} coding tool(s) detected`);for(let s of w){let n=s===v?" (current)":"";r.step(o,` ${s}${n}`)}let u;if(f!==null){let s=["claude-code","cursor","kiro","copilot","windsurf","opencode","codex","copilot-cli"],n=f.filter(c=>s.includes(c));u=[...new Set([...E,...n])]}else p?u=[...w]:(h(o),u=await Ie(o,w,v));h(o);let M=y(o,"Detecting AI providers...");M.start();let x=(await ae()).filter(s=>s.available).map(s=>s.name);M.succeed(`${x.length} provider(s) detected`),h(o);let P=await I(),l;if(b!==null){let s=P.map(n=>n.id);l=b.filter(n=>s.includes(n)).sort((n,c)=>s.indexOf(n)-s.indexOf(c))}else if(p)l=[];else{let s=P.map(c=>({value:c.id,label:c.name,hint:c.description.slice(0,60)})),n=await B(o,{message:"What kind of project is this? (space to toggle, enter to confirm)",options:s});l=T(n)?[]:[...n]}l.length>0?r.success(o,` Concerns: ${l.join(", ")}`):r.info(o,"No concerns selected. Add later with `concern add <id> [<id2> ...]`."),h(o);let j=y(o,"Initializing...");j.start(),await V(e);let ue=P.filter(s=>l.includes(s.id));for(let s of ue)await K(e,s);let L=await Y();X(L);let C={...z(l,u,x,m),command:L};await _(e,C);let O=W();if(await H(e,O),j.succeed("Scaffolded `.eser/`"),u.length>0){let s=y(o,"Syncing tool files...");s.start();let n=await oe(e,u,C);s.succeed(`Synced ${n.length} tool(s)`)}else r.warn(o,"No tools selected. noskills will work in agentless CLI mode only."),r.info(o,"Add tools later with `noskills sync`.");if(q(o,`Done. ${u.length} tool(s), ${x.length} provider(s), ${l.length} concern(s).`),i==="agent"){let n=(await I()).filter(me=>l.includes(me.id)),c=await ee(e),ge=te(C?.tools??[]),fe=Z(O,n,c,C,void 0,void 0,void 0,ge);await se(fe,"json")}else G(o),U(o,`Start a spec with: ${A('spec new "..."')}`);return S(void 0)},ke=[{value:"claude-code",label:"Claude Code"},{value:"cursor",label:"Cursor"},{value:"kiro",label:"Kiro"},{value:"copilot",label:"GitHub Copilot"},{value:"windsurf",label:"Windsurf"},{value:"opencode",label:"OpenCode"},{value:"codex",label:"Codex CLI"},{value:"copilot-cli",label:"Copilot CLI"}],Ie=async(t,e,i)=>{let o=e.length===0?"No coding tools detected. Which tools do you use? (space to toggle)":"Any additional tools? (space to toggle, enter to skip)",d=new Set(e),b=await B(t,{message:o,options:ke.map(p=>({...p,hint:p.value===i?"you're running inside it":d.has(p.value)?"detected":void 0,disabled:p.value===i})),initialValues:[...e],required:!1});if(T(b))return[...e];let f=[...b];return i!==null&&!f.includes(i)&&f.unshift(i),f},pe=(t,e)=>{if(t===void 0)return null;for(let i of t)if(i.startsWith(`${e}=`))return i.slice(e.length+1).split(",").map(o=>o.trim()).filter(Boolean);return null};export{It as main};
@@ -0,0 +1,10 @@
1
+ import{d as T}from"./chunk-7GUYMD3Z.js";import{a as $,b as C}from"./chunk-ZMVD5IU4.js";import"./chunk-MRZT23BL.js";import"./chunk-7UX6WIXX.js";import{c as w}from"./chunk-YK6UG66R.js";import{d as f,e as E,l as R,p as D,s as b}from"./chunk-LWCWPXCS.js";import{a as c}from"./chunk-2N4GTHXQ.js";import{b as r}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var O=new Set(["log","diff","status","show","blame","rev-parse","ls-files","ls-tree","cat-file","describe","shortlog","name-rev","for-each-ref","rev-list","help","version"]),v=new Map([["branch",new Set(["","--list","-l","-a","--all","-r","--remotes","-v","--verbose","--contains","--no-contains","--merged","--no-merged"])],["tag",new Set(["","-l","--list","-v","--verify","-n"])],["stash",new Set(["list","show"])],["remote",new Set(["","-v","--verbose","show","get-url"])],["config",new Set(["--get","--get-all","--get-regexp","--list","-l","--global","--local","--system"])],["reflog",new Set(["","show"])]]),y=t=>{let n=t.trim();if(!n.startsWith("git"))return!0;let e=n.slice(3).trim();if(e.length===0)return!0;let a=e.split(/\s+/),o=a[0]??"";if(O.has(o))return!0;let s=v.get(o);if(s!==void 0){let i=a[1]??"";if(s.has(i))return!0}return!1};var I=t=>{let n=[/(?:bash|sh|\/bin\/bash|\/bin\/sh)\s+-c\s+["'](.+?)["']/g,/(?:bash|sh|\/bin\/bash|\/bin\/sh)\s+-c\s+(\S+)/g,/eval\s+["'](.+?)["']/g];for(let o of n){let s;for(;(s=o.exec(t))!==null;){let i=s[1]??"";if(i.includes("git")&&!y(i))return!0}}let e=t.split(/\s*\|\s*/);for(let o of e){let s=o.trim();if(s.startsWith("git")&&!y(s))return!0}let a=t.matchAll(/\bgit\s+([\w-]+)/g);for(let o of a){let s=o[1]??"";if(!O.has(s)&&!v.has(s))return!0;if(v.has(s)){let i=o.index??0,g=t.slice(i);if(!y(g.split(/[;&|$)`]/)[0]??""))return!0}}return!1};var x=async()=>{let t=r.process.stdin.getReader(),n=[];try{for(;;){let{done:s,value:i}=await t.read();if(s||i===void 0)break;n.push(i)}}finally{t.releaseLock()}let e=0,a=new Uint8Array(n.reduce((s,i)=>s+i.length,0));for(let s of n)a.set(s,e),e+=s.length;let o=new TextDecoder().decode(a);try{return JSON.parse(o)}catch{return{}}},P=async t=>{let n=new TextEncoder,e=r.process.stdout.getWriter();await e.write(n.encode(JSON.stringify(t))),e.releaseLock()},V=async t=>{switch(t?.[0]){case"pre-tool-use":return await N();case"stop":return await A();case"post-file-write":return await _();case"post-bash":return await W();case"session-start":return await G();default:return c(void 0)}},N=async()=>{let t=await x(),n=t.tool_name??"unknown",e=t.tool_input??{},a=t.cwd??r.process.cwd(),o=await R(a),s={};try{s=await E(a)}catch{return c(void 0)}let i=async d=>{await P({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`noskills: ${d}`}})};if(n==="Bash"){let d=(e.command??"").trim();if(!(o?.allowGit??!1)&&d.includes("git")){let p=d.split(/\s*(?:&&|;)\s*/);for(let m of p){let k=m.trim();if(k.startsWith("git")&&!y(k))return await i("Git write operations are not allowed. Only read commands (log, diff, status, show, blame, branch, tag) are permitted. The user controls git, the agent controls files."),c(void 0)}if(I(d))return await i("Git write operations detected in subshell or pipe. Only read commands are permitted. The user controls git, the agent controls files."),c(void 0)}return c(void 0)}let g=["Write","Edit","MultiEdit"];if(!g.includes(n))return c(void 0);let h=e.file_path??e.path??"";if(h.includes(".eser/")||h.includes(".claude/"))return c(void 0);let l=s.phase??"UNKNOWN";if(l==="EXECUTING"||l==="IDLE"||l==="FREE"||l==="COMPLETED"||l==="UNKNOWN"){if(l==="EXECUTING"&&g.includes(n)){let d=`${a}/${f.stateDir}/executor-warned.flag`;try{await r.fs.readTextFile(d)}catch{try{await r.fs.mkdir(`${a}/${f.stateDir}`,{recursive:!0}),await r.fs.writeTextFile(d,new Date().toISOString());let u=new TextEncoder,p=r.process.stderr.getWriter();await p.write(u.encode(`noskills: REMINDER \u2014 You should be spawning a noskills-executor sub-agent for implementation work. If you're the main orchestrator agent, delegate to a sub-agent instead of editing directly. If you ARE a sub-agent, ignore this message and continue.
2
+ `)),p.releaseLock()}catch{}}}return c(void 0)}let S={DISCOVERY:`You are in DISCOVERY \u2014 this is a thinking phase, not an implementation phase. Read and discuss only. To write code, complete discovery and get the spec approved first. Run \`${w("next")}\` to continue.`,DISCOVERY_REVIEW:`You are in DISCOVERY_REVIEW \u2014 this is a thinking phase, not an implementation phase. Read and discuss only. To write code, complete discovery and get the spec approved first. Run \`${w('next --answer="approve"')}\` or revise answers.`,SPEC_DRAFT:`You are in SPEC_DRAFT \u2014 this is a thinking phase, not an implementation phase. Read and discuss only. To write code, approve the spec first. Run \`${w("approve")}\``,SPEC_APPROVED:`You are in SPEC_APPROVED \u2014 start execution first: \`${w('next --answer="start"')}\``,BLOCKED:`Execution blocked. Resolve with \`${w('next --answer="resolution"')}\``};return await i(S[l]??`Run \`${w("next")}\` first.`),c(void 0)},A=async()=>{let t=await x();if(t.stop_hook_active===!0)return c(void 0);let n=t.cwd??r.process.cwd(),e;try{let u=await r.fs.readTextFile(`${n}/${f.stateFile}`);e=JSON.parse(u)}catch{return c(void 0)}if(e.phase!=="EXECUTING")return c(void 0);let a=e.execution??{},o=`${n}/${f.stateDir}/files-changed.jsonl`,s=[];try{let p=(await r.fs.readTextFile(o)).trim().split(`
3
+ `).filter(Boolean);s=[...new Set(p.map(m=>{try{return JSON.parse(m).file}catch{return null}}).filter(m=>m!==null))]}catch{}let i=[],g="no changes";try{let{execSync:u}=await import("node:child_process");i=u("git diff --name-only",{cwd:n,encoding:"utf-8",timeout:5e3}).trim().split(`
4
+ `).filter(Boolean);let k=u("git diff --stat",{cwd:n,encoding:"utf-8",timeout:5e3}).trim().split(`
5
+ `);g=k[k.length-1]??"no changes"}catch{}let h=[...new Set([...s,...i])],l=(a.iteration??0)+1,S=`${n}/${f.stateDir}/iterations`;try{await r.fs.mkdir(S,{recursive:!0}),await r.fs.writeTextFile(`${S}/iteration-${l}.json`,JSON.stringify({iteration:l,files:h,gitStat:g.trim(),timestamp:new Date().toISOString()},null,2)+`
6
+ `)}catch{}let d=15;try{let u=await R(n);u!==null&&(d=u.maxIterationsBeforeRestart)}catch{}e.execution={...a,iteration:l,modifiedFiles:h,lastProgress:g.trim()||a.lastProgress||null},e.lastCalledAt=new Date().toISOString();try{await r.fs.writeTextFile(`${n}/${f.stateFile}`,JSON.stringify(e,null,2)+`
7
+ `)}catch{}try{await r.fs.writeTextFile(o,"")}catch{}try{await r.fs.remove(`${n}/${f.stateDir}/executor-warned.flag`)}catch{}if(l>=d){let u=new TextEncoder,p=r.process.stderr.getWriter();await p.write(u.encode(`noskills: iteration ${l} reached threshold (${d}). Consider starting a fresh conversation.
8
+ `)),p.releaseLock()}return c(void 0)},_=async()=>{let t=await x(),n=t.tool_input??{},e=n.file_path??n.path??"";if(!e||e.includes(".eser/")||e.includes(".claude/"))return c(void 0);let a=t.cwd??r.process.cwd(),o=`${a}/${f.stateDir}/files-changed.jsonl`,s=JSON.stringify({file:e,tool:t.tool_name,ts:new Date().toISOString()});try{await r.fs.mkdir(`${a}/${f.stateDir}`,{recursive:!0});let i="";try{i=await r.fs.readTextFile(o)}catch{}await r.fs.writeTextFile(o,i+s+`
9
+ `)}catch{}return c(void 0)},W=async()=>{let t=await x(),e=(t.tool_input??{}).command??"";if(!e.includes("noskills"))return c(void 0);let a=t.cwd??r.process.cwd(),o=`${a}/${f.stateDir}/noskills-calls.jsonl`,s=JSON.stringify({command:e,ts:new Date().toISOString()});try{await r.fs.mkdir(`${a}/${f.stateDir}`,{recursive:!0});let i="";try{i=await r.fs.readTextFile(o)}catch{}await r.fs.writeTextFile(o,i+s+`
10
+ `)}catch{}return c(void 0)},G=async()=>{let t=r.process.cwd();if(!await b(t))return c(void 0);let n=await E(t),e=await R(t),o=(await D(t)).filter(h=>e!==null&&e.concerns.includes(h.id)),s=await $(t),i=C(e?.tools??[]),g=T(n,o,s,e,void 0,void 0,void 0,i);return await P(g),c(void 0)};export{V as main};
@@ -0,0 +1,8 @@
1
+ import{b as ae}from"./chunk-VK7L5SMS.js";import{a as te,b as se,c as ne,d as M}from"./chunk-7GUYMD3Z.js";import{a as W,b as J}from"./chunk-ZMVD5IU4.js";import"./chunk-MRZT23BL.js";import{a as ie}from"./chunk-7UX6WIXX.js";import{a as re,b as oe,d as S}from"./chunk-TJZAIUKM.js";import{a as ge}from"./chunk-SNHYXBHM.js";import{a as he,b as we,c as Se,d as ve}from"./chunk-3SLKOP72.js";import{a as q}from"./chunk-VPXOI7CR.js";import{c as N}from"./chunk-YK6UG66R.js";import{a as ce,b as le,e as R,f as H,g as de,h as ue,j as pe,l as me,m as fe}from"./chunk-TMC5H2A5.js";import{a as G,d as F,f as z,g as B,j as X,k as Y,l as K,p as Z,r as U,s as ee}from"./chunk-LWCWPXCS.js";import{a as V,b as C}from"./chunk-2N4GTHXQ.js";import{b as h}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var Ie=a=>a.split(`
2
+ `).map(e=>e.replace(/^[-*]\s+/,"").trim()).filter(e=>e.length>0&&!e.startsWith("#")),Ce=async(a,e)=>{let r=[],i=(e.startsWith(a)?e.slice(a.length+1):e).split("/");i.pop();for(let t=i.length;t>=0;t--){let n=`${t===0?a:`${a}/${i.slice(0,t).join("/")}`}/.folder-rules.md`,o=t===0?".":i.slice(0,t).join("/");try{let p=await h.fs.readTextFile(n),l=Ie(p);for(let m of l)r.push({folder:o,rule:m})}catch{}}return r},Q=async(a,e)=>{let r=new Set,c=[];for(let i of e){let t=await Ce(a,i);for(let s of t){let n=`${s.folder}::${s.rule}`;r.has(n)||(r.add(n),c.push(s))}}return c};var Ge=async a=>{let e=h.process.cwd(),r=re(a),c=oe(a);if(!await ee(e))return await S({error:`noskills not initialized. Run: ${N("init")}`},r),C({exitCode:1});let i=null;for(let d of c)d.startsWith("--answer=")&&(i=d.slice(9));let t=B(c),s;try{s=await z(e,t)}catch(d){let u=d instanceof Error?d.message:String(d);return await S({error:u},r),C({exitCode:1})}if(t===null&&s.phase!=="IDLE"&&s.phase!=="FREE"&&s.phase!=="COMPLETED")return await S({error:"Error: --spec=<name> is required. Use `noskills spec list` to see available specs."},r),C({exitCode:1});let n=await K(e);if(n?.command!==void 0){let{setCommandPrefix:d}=await import("./cmd-RST2ZPA6.js");d(n.command)}if(n===null)return await S({error:"No config found"},r),C({exitCode:1});if(s.spec!==null&&s.phase!=="IDLE"&&s.phase!=="COMPLETED"){let d=`${e}/${F.specDir(s.spec)}`;try{await h.fs.stat(d)}catch{return await S({error:!0,message:`Active spec '${s.spec}' directory not found. Files may have been deleted manually.`,suggestion:`Run \`${N("reset")}\` to return to IDLE, or \`${N("cancel")}\` to mark as cancelled.`},r),C({exitCode:1})}}let o=ae(c,n);s.phase==="DISCOVERY"&&s.discovery.audience!==o&&(s={...s,discovery:{...s.discovery,audience:o}});let l=(await Z(e)).filter(d=>n.concerns.includes(d.id));if(i!==null){let d=await be(e,s,n,l,i);await U(e,d);let u={...d,lastCalledAt:new Date().toISOString()};await U(e,u);let x=await W(e),b=u.spec!==null?await q(e,u.spec):null,j=await ye(e,u),A=await Q(e,j),T=J(n?.tools??[]),g=M(u,l,x,n,b,A,void 0,T);return await S(g,r),V(void 0)}let m={...s,lastCalledAt:new Date().toISOString()};await U(e,m);let y=await W(e),D=m.spec!==null?await q(e,m.spec):null,k=await ye(e,m),E=await Q(e,k),P;m.phase==="IDLE"&&(P={existingSpecs:(await Y(e)).map(u=>({name:u.name,phase:u.state.phase,iteration:u.state.execution.iteration,detail:u.state.phase==="EXECUTING"?`${u.state.execution.completedTasks.length} tasks done, iteration ${u.state.execution.iteration}`:u.state.phase==="SPEC_DRAFT"?"awaiting approval":u.state.phase==="COMPLETED"?"completed":void 0})),rulesCount:y.length});let $=J(n?.tools??[]),_=M(m,l,y,n,D,E,P,$);return await S(_,r),V(void 0)},be=async(a,e,r,c,i)=>{switch(e.phase){case"DISCOVERY":{let t=e.discovery.audience==="agent",s=null;try{let o=JSON.parse(i);typeof o=="object"&&o!==null&&!Array.isArray(o)&&(t?te.map(m=>m.id).every(m=>m in o)&&(s=o):s=o)}catch{}let n=e;if(s!==null)for(let[o,p]of Object.entries(s))typeof p=="string"&&p.length>0&&(n=R(n,o,p));else{let o=se(c),p=n.discovery.currentQuestion,l=o[p];if(l===void 0)return e;n=R(n,l.id,i),n=ue(n)}return ne(n.discovery.answers)&&(n=H(n)),n}case"DISCOVERY_REVIEW":{if(i.trim().toLowerCase()==="approve")return de(e);if(i.trim().toLowerCase()==="split")return await Fe(a,e);try{let t=JSON.parse(i);if(typeof t.revise=="object"&&t.revise!==null){let s=e;for(let[n,o]of Object.entries(t.revise))typeof o=="string"&&o.length>0&&(s=R(s,n,o));return s}}catch{}return e}case"SPEC_DRAFT":{if(e.classification===null){let t,s=i.trim().toLowerCase();if(s==="none"||s==="skip")t={involvesWebUI:!1,involvesCLI:!1,involvesPublicAPI:!1,involvesMigration:!1,involvesDataHandling:!1};else try{let o=JSON.parse(i);t={involvesWebUI:o.involvesWebUI===!0||o.involvesUI===!0,involvesCLI:o.involvesCLI===!0||o.involvesUI===!0,involvesPublicAPI:o.involvesPublicAPI===!0,involvesMigration:o.involvesMigration===!0,involvesDataHandling:o.involvesDataHandling===!0}}catch{t={involvesWebUI:!1,involvesCLI:!1,involvesPublicAPI:!1,involvesMigration:!1,involvesDataHandling:!1}}let n={...e,classification:t};try{await ge(a,n,c)}catch{}return n}try{let t=JSON.parse(i);if(typeof t.refinement=="string"&&t.refinement.length>0){let s=t.refinement;if(e.spec!==null){let n=`${a}/${F.specFile(e.spec)}`,o=await h.fs.readTextFile(n);if(s.includes("task-")){let l=Re(s).map(D=>`- [ ] ${D}`).join(`
3
+ `),m=/## Tasks\n\n([\s\S]*?)(?=\n## |\n*$)/,y=o.replace(m,`## Tasks
4
+
5
+ ${l}
6
+ `);await h.fs.writeTextFile(n,y)}}return e}}catch{}return e}case"SPEC_APPROVED":{let t=pe(e);return t.spec!==null&&(await he(a,t.spec,"executing"),await ve(a,t.spec,"executing")),t}case"EXECUTING":{if(!e.execution.awaitingStatusReport){let t={...e,execution:{...e.execution,lastProgress:i}};if(r.verifyCommand!==null&&r.verifyCommand!==void 0&&r.verifyCommand.length>0){let s=await Ee(a,r.verifyCommand);if(t={...t,execution:{...t.execution,lastVerification:s}},!s.passed)return t}return t={...t,execution:{...t.execution,awaitingStatusReport:!0}},t}return await ke(a,e,i,c)}case"BLOCKED":{let t=e.execution.lastProgress??"Unknown",s={id:`d${e.decisions.length+1}`,question:t.replace(/^BLOCKED:\s*/,""),choice:i,promoted:!1,timestamp:new Date().toISOString()},n=me(e,s);return n=ce(n,"EXECUTING"),n={...n,execution:{...n.execution,lastProgress:`Resolved: ${i}`}},n}default:return e}},Fe=async(a,e)=>{let r=ie(e.discovery.answers);if(!r.detected||r.proposals.length===0)return e;let c=[];for(let t of r.proposals){let s=`${a}/${F.specDir(t.name)}`;await h.fs.mkdir(s,{recursive:!0});let n=e.discovery.answers.filter(l=>t.relevantAnswers.includes(l.questionId)),p=le(G(),t.name,`spec/${t.name}`);for(let l of n)p=R(p,l.questionId,l.answer);p=H(p),await X(a,t.name,p),c.push(t.name)}return fe(e,"cancelled",`Split into: ${c.join(", ")}`)},Re=a=>a.split(/(?=task-\d+:)/).map(e=>e.replace(/[,;\n\s]+$/,"").trim()).filter(e=>/^task-\d+:/.test(e)),ke=async(a,e,r,c)=>{let i;try{i=JSON.parse(r)}catch{return{...e,execution:{...e.execution,lastProgress:r,awaitingStatusReport:!1}}}let t=e;if(e.execution.debt!==null&&e.execution.debt.items.length>0&&typeof e.execution.debt.items[0]=="string"){let I=e.execution.debt.items.map((w,f)=>({id:`legacy-${f+1}`,text:w,since:e.execution.debt.fromIteration}));t={...e,execution:{...e.execution,debt:{...e.execution.debt,items:I}}};let O=new TextEncoder,v=h.process.stderr.getWriter();await v.write(O.encode(`noskills: migrated legacy string[] debt to DebtItem[] format
7
+ `)),v.releaseLock()}let s=i.completed??[],n=new Set(s),o=i.na??[],p=new Set(o),l=i.newIssues??[],m=i.remaining??[],y=i.blocked??[],D=t.execution.debt?.unaddressedIterations??0,k=t.execution.debt!==null?t.execution.debt.items.filter(g=>!n.has(g.id)&&!p.has(g.id)):[],E=t.execution.debtCounter??0,P=l.map((g,I)=>({id:`debt-${E+I+1}`,text:g,since:t.execution.iteration})),$=[...k,...P],d=m.length===0&&y.length===0&&l.length===0||$.length===0?null:{items:$,fromIteration:t.execution.debt?.fromIteration??t.execution.iteration,unaddressedIterations:k.length>0?D+1:1},u=[...new Set([...t.execution.naItems??[],...o])],x=[];s.length>0&&x.push(`Completed: ${s.join(", ")}`),o.length>0&&x.push(`N/A: ${o.join(", ")}`);let b=x.length>0?x.join("; "):"Status report submitted",j=t.execution.lastVerification===null||t.execution.lastVerification.passed===!0,A=d===null&&j,T=E+l.length;if(A&&t.spec!==null){let g=await q(a,t.spec);if(g!==null){let I=t.execution.completedTasks??[],O=new Set(I),v=[];try{let f=JSON.parse(t.execution.lastProgress??"");Array.isArray(f.completed)&&(v=f.completed.filter(L=>!O.has(L)&&g.tasks.some(xe=>xe.id===L)))}catch{}if(v.length===0){let f=g.tasks.find(L=>!O.has(L.id));f!==void 0&&(v=[f.id])}let w=[];for(let f of v)await we(a,t.spec,f),await Se(a,t.spec,f,"done"),w.push(f);if(w.length>0){let f=w.length===1?`Task ${w[0]} accepted`:`Tasks ${w.join(", ")} accepted`;return{...t,execution:{...t.execution,lastProgress:`${f}: ${b}`,awaitingStatusReport:!1,debt:d,completedTasks:[...I,...w],debtCounter:T,naItems:u}}}}}return{...t,execution:{...t.execution,lastProgress:A?b:`Task not accepted \u2014 remaining items must be addressed first. ${b}`,awaitingStatusReport:!1,debt:d,debtCounter:T,naItems:u}}},Ee=async(a,e)=>{try{let{execSync:r}=await import("node:child_process"),c=r(e,{cwd:a,encoding:"utf-8",timeout:6e4,stdio:["pipe","pipe","pipe"]});return{passed:!0,output:String(c).slice(0,4e3),timestamp:new Date().toISOString()}}catch(r){let c=r,i=((c.stdout??"")+(c.stderr??"")).slice(0,4e3);return c.status!==void 0?{passed:!1,output:i||"Verification failed with no output",timestamp:new Date().toISOString()}:{passed:!1,output:`Verification command failed to execute: ${r instanceof Error?r.message:String(r)}`,timestamp:new Date().toISOString()}}},ye=async(a,e)=>{let r=[...e.execution.modifiedFiles??[]],c=await Pe(a);return[...new Set([...r,...c])]},Pe=async a=>{let e=`${a}/${F.stateDir}/files-changed.jsonl`;try{let c=(await h.fs.readTextFile(e)).trim().split(`
8
+ `).filter(Boolean),i=[];for(let t of c)try{let s=JSON.parse(t);i.includes(s.file)||i.push(s.file)}catch{}return i}catch{return[]}};export{be as handleAnswer,Ge as main,Re as parseRefinementTasks};
@@ -0,0 +1,3 @@
1
+ import{a as D,b as A,d as F}from"./chunk-73EEM3FY.js";import{d as B}from"./chunk-7GUYMD3Z.js";import{a as W,b as X}from"./chunk-ZMVD5IU4.js";import"./chunk-MRZT23BL.js";import"./chunk-7UX6WIXX.js";import{b as E,c as V}from"./chunk-YK6UG66R.js";import{a as _,j}from"./chunk-TMC5H2A5.js";import{e as g,f as N,g as U,i as $,l as G,p as L,s as M}from"./chunk-LWCWPXCS.js";import{c as v,d as o,f as l,g as P,h,k as I,o as R,q as O,r as T}from"./chunk-Y6AFIAJP.js";import{a as S,b as w}from"./chunk-2N4GTHXQ.js";import{b as y}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var ue=async t=>{let e=R({renderer:T.ansi(),sink:O.stdout()}),i=y.process.cwd(),n=t?.includes("--unattended")??!1,r=z(t,"--max-turns")??10,p=z(t,"--max-iterations")??50;if(!await M(i))return e.writeln(l(`noskills not initialized. Run: ${V("init")}`)),await e.close(),w({exitCode:1});let x=U(t),c=await N(i,x);if(c.phase!=="EXECUTING"&&c.phase!=="SPEC_APPROVED")return e.writeln(l(`Cannot run from phase: ${c.phase}`)),e.writeln(o("Must be in SPEC_APPROVED or EXECUTING to start.")),await e.close(),w({exitCode:1});if(c.phase==="SPEC_APPROVED"){e.writeln(o("Starting execution from approved spec..."));let s=j(c);await $(i,s)}let u=await G(i);if(u===null)return e.writeln(l("Config not found.")),await e.close(),w({exitCode:1});e.writeln(v(`${E()} run`)),e.writeln(o(`Mode: ${n?"unattended":"interactive"}, max-turns: ${r}, max-iterations: ${p}`)),e.writeln("");let m=0,d=0;for(;m<p;){m++;let s=await g(i);if(s.phase==="COMPLETED"){e.writeln(""),e.writeln(P("\u2714")," Spec completed!"),e.writeln(` Iterations: ${s.execution.iteration}`),e.writeln(` Decisions: ${s.decisions.length}`);break}if(s.phase==="BLOCKED"){let a=s.execution.lastProgress??"Unknown";if(e.writeln(""),e.writeln(h("\u26A0")," Execution blocked: ",o(a)),n){await Z(i,a,m),e.writeln(o("Logged to .eser/.state/blocked.log. Resolve and re-run.")),d=1;break}let C=A(),f=await F(C,{message:"Enter resolution (or leave empty to stop):"});if(D(f)||f===""){e.writeln(o("Stopped by user."));break}let k=_(s,"EXECUTING");await $(i,{...k,execution:{...k.execution,lastProgress:`Resolved: ${f}`}});continue}if(s.phase!=="EXECUTING"){e.writeln(l(`Unexpected phase: ${s.phase}. Stopping.`)),d=1;break}let H=(await L(i)).filter(a=>u.concerns.includes(a.id)),q=await W(i),K=X(u.tools),J=B(s,H,q,u,void 0,void 0,void 0,K),Q=Y(J);e.writeln(I(`\u2500\u2500 Iteration ${m}`),o(` (execution: ${s.execution.iteration}, debt: ${s.execution.debt?.items.length??0})`)),s.execution.lastProgress!==null&&e.writeln(o(` Last: ${s.execution.lastProgress}`)),s.execution.lastVerification?.passed===!1&&e.writeln(l(" Verification failed \u2014 agent will fix")),s.execution.debt!==null&&e.writeln(h(` Debt: ${s.execution.debt.items.length} items`)),e.writeln(o(" Spawning agent..."));try{await(await import("./mod-KTV64DHD.js")).exec`claude -p ${Q} --max-turns ${String(r)} --output-format json`.noThrow().text()}catch{e.writeln(l(" Failed to spawn claude CLI. Is it installed?")),d=1;break}e.writeln(o(" Agent exited. Stop hook captured state."));let b=await g(i);if(u.autoCommit===!0&&u.allowGit!==!1)try{let a=await import("./mod-KTV64DHD.js");if((await a.exec`git diff --name-only`.noThrow().text()).trim().length>0){await a.exec`git add -A`.noThrow().text();let f=`noskills: iteration ${b.execution.iteration} \u2014 ${b.execution.lastProgress??"progress"}`;await a.exec`git commit -m ${f}`.noThrow().text(),e.writeln(o(" Auto-committed."))}}catch{e.writeln(o(" Auto-commit failed (non-fatal)."))}}return m>=p&&(e.writeln(""),e.writeln(h("\u26A0"),` Max iterations (${p}) reached. Stopping.`),d=2),await e.close(),d!==0?w({exitCode:d}):S(void 0)},Y=t=>{let e=[];if(e.push(t.meta.resumeHint),e.push(""),t.meta.spec!==null&&(e.push(`Working on spec: ${t.meta.spec}`),e.push("")),"instruction"in t&&(e.push(t.instruction),e.push("")),"previousIterationDebt"in t){let n=t.previousIterationDebt;if(n!==void 0){e.push(`DEBT from iteration ${n.fromIteration} (address first):`);for(let r of n.items)e.push(`- ${r}`);e.push("")}}if("statusReportRequired"in t){let n=t.statusReport;if(n!==void 0){e.push("Report against these acceptance criteria:");for(let r of n.criteria)e.push(`- ${r}`);e.push("")}}if("verificationFailed"in t&&t.verificationFailed===!0&&(e.push("Test output:"),e.push(("verificationOutput"in t?t.verificationOutput:"")??""),e.push("")),t.behavioral.rules.length>0){e.push("Rules:");for(let n of t.behavioral.rules)e.push(`- ${n}`);e.push("")}if("context"in t){let n=t.context;if(n.concernReminders.length>0){e.push("Reminders:");for(let r of n.concernReminders)e.push(`- ${r}`);e.push("")}}let i=E();return e.push(`When done, report progress: ${i} next --answer="your progress"`),e.push(`If blocked, run: ${i} block "reason"`),e.push(`When all tasks are complete: ${i} done`),e.join(`
2
+ `)},z=(t,e)=>{if(t===void 0)return null;let i=`${e}=`;for(let n of t)if(n.startsWith(i)){let r=parseInt(n.slice(i.length),10);if(!isNaN(r)&&r>0)return r}return null},Z=async(t,e,i)=>{let n=`${t}/.eser/.state/blocked.log`,r=`[${new Date().toISOString()}] iteration=${i} reason=${e}
3
+ `;try{let{appendFileSync:p,mkdirSync:x}=await import("node:fs"),{dirname:c}=await import("node:path");x(c(n),{recursive:!0}),p(n,r)}catch{}};export{ue as main};
@@ -0,0 +1 @@
1
+ import{a as M}from"./chunk-7UX6WIXX.js";import{a as Y,d as L}from"./chunk-TJZAIUKM.js";import{b as $,c as R}from"./chunk-YK6UG66R.js";import{b as z,e as N,f as O,m as q}from"./chunk-TMC5H2A5.js";import{a as x,d as h,f as V,g as W,j as g,k as j,s as P}from"./chunk-LWCWPXCS.js";import{c as p,d as o,f as d,g as C,h as A,k as F,o as D,q as I,r as k}from"./chunk-Y6AFIAJP.js";import{a as f,b as m}from"./chunk-2N4GTHXQ.js";import{b as w}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var ie=async r=>{let e=r?.[0];if(e==="new")return await G(r?.slice(1));if(e==="list")return await T(r?.slice(1));if(e==="split")return await _(r?.slice(1));let n=$(),s=D({renderer:k.ansi(),sink:I.stdout()});return s.writeln(`Usage: ${n} spec <new --name=<slug> "description" | list | split --spec=<name> --into name1 "desc1" --into name2 "desc2">`),await s.close(),f(void 0)},G=async r=>{let e=D({renderer:k.ansi(),sink:I.stdout()}),n=w.process.cwd();if(!await P(n))return e.writeln(d("noskills is not initialized.")," Run: ",p(R("init"))),await e.close(),m({exitCode:1});let s=null,a=[];if(r!==void 0)for(let i of r)i.startsWith("--name=")?s=i.slice(7):i.startsWith("-")||a.push(i);let S=a.join(" ");if(s===null||s.length===0)return e.writeln(d("Error: --name is required.")),e.writeln(o("Example: "),p(`${$()} spec new --name=photo-upload "photo upload feature"`)),await e.close(),m({exitCode:1});let c=/^[a-z0-9][a-z0-9-]*[a-z0-9]$/;if(s.length>50||s.length>1&&!c.test(s)||s.length===1&&!/^[a-z0-9]$/.test(s))return e.writeln(d("Invalid spec name: "),p(s)),e.writeln(o("Must be lowercase, hyphens, numbers only. Max 50 chars. Regex: /^[a-z0-9][a-z0-9-]*[a-z0-9]$/")),await e.close(),m({exitCode:1});if(S.length===0)return e.writeln(d("Please provide a description: "),p(`${$()} spec new --name=${s} "photo upload feature"`)),await e.close(),m({exitCode:1});let u=`spec/${s}`,t=`${n}/${h.specDir(s)}`;try{return await w.fs.stat(t),e.writeln(d(`Spec "${s}" already exists.`),o(` Use a different --name or run \`${$()} reset --spec=${s}\` first.`)),await e.close(),m({exitCode:1})}catch{}let l=x(),y=z(l,s,u);return await w.fs.mkdir(`${n}/${h.specDir(s)}`,{recursive:!0}),await g(n,s,y),e.writeln(C("\u2714")," Spec started: ",p(s)),e.writeln(" Directory: ",o(h.specDir(s))),e.writeln(" Branch: ",o(u)),e.writeln(" Phase: ",A("DISCOVERY")),e.writeln(""),e.writeln("Run ",p(R(`next --spec=${s}`))," to begin discovery questions."),await e.close(),f(void 0)},T=async r=>{let e=w.process.cwd(),n=Y(r),s=await j(e),a=`${e}/${h.specsDir}`,S=new Set(s.map(t=>t.name)),c=[];for(let t of s)c.push({name:t.name,phase:t.state.phase,iteration:t.state.execution.iteration});try{for await(let t of w.fs.readDir(a))t.isDirectory&&!S.has(t.name)&&c.push({name:t.name,phase:"IDLE",iteration:0})}catch{}if(n==="json")return await L(c,"json"),f(void 0);let u=D({renderer:k.ansi(),sink:I.stdout()});if(u.writeln(p("Specs")),u.writeln(""),c.length===0)u.writeln(o(" No specs yet."));else for(let t of c){let l=t.phase==="COMPLETED"?C(t.phase):t.phase==="EXECUTING"?F(t.phase):t.phase==="BLOCKED"?d(t.phase):A(t.phase),y=t.phase==="EXECUTING"?o(` iteration ${t.iteration}`):"";u.writeln(" ",o("\u25CB")," ",t.name," ",l,y)}return await u.close(),f(void 0)},X=r=>{let e=[],n=0;for(;n<r.length;)if(r[n]==="--into"&&n+1<r.length){let s=r[n+1],a=s;n+2<r.length&&!r[n+2].startsWith("-")?(a=r[n+2],n+=3):n+=2,e.push({name:s,description:a})}else n+=1;return e},_=async r=>{let e=D({renderer:k.ansi(),sink:I.stdout()}),n=w.process.cwd();if(!await P(n))return e.writeln(d("noskills is not initialized.")," Run: ",p(R("init"))),await e.close(),m({exitCode:1});let s=W(r??[]);if(s===null)return e.writeln(d("Error: --spec=<name> is required.")),e.writeln(o("Example: "),p(`${$()} spec split --spec=parent --into name1 "desc1" --into name2 "desc2"`)),await e.close(),m({exitCode:1});let a;try{a=await V(n,s)}catch(t){let l=t instanceof Error?t.message:String(t);return e.writeln(d(`Error: ${l}`)),await e.close(),m({exitCode:1})}if(a.phase!=="DISCOVERY"&&a.phase!=="DISCOVERY_REVIEW")return e.writeln(d(`Cannot split spec in phase ${a.phase}. Must be in DISCOVERY or DISCOVERY_REVIEW.`)),await e.close(),m({exitCode:1});let S=X(r??[]);if(S.length<2){let t=M(a.discovery.answers);if(!t.detected||t.proposals.length<2)return e.writeln(d("Error: at least 2 --into entries required, or discovery answers must contain 2+ independent areas.")),await e.close(),m({exitCode:1});let l=[];for(let i of t.proposals){let v=`${n}/${h.specDir(i.name)}`;await w.fs.mkdir(v,{recursive:!0});let U=a.discovery.answers.filter(b=>i.relevantAnswers.includes(b.questionId)),E=z(x(),i.name,`spec/${i.name}`);for(let b of U)E=N(E,b.questionId,b.answer);E=O(E),await g(n,i.name,E),l.push(i.name)}let y=q(a,"cancelled",`Split into: ${l.join(", ")}`);await g(n,s,y),e.writeln(C("Split complete."),` Created ${l.length} sub-specs:`);for(let i of l)e.writeln(" ",o("\u25CB")," ",p(i));return e.writeln("",o(`Parent spec "${s}" cancelled.`)),await e.close(),f(void 0)}let c=[];for(let t of S){let l=`${n}/${h.specDir(t.name)}`;await w.fs.mkdir(l,{recursive:!0});let i=z(x(),t.name,`spec/${t.name}`);for(let v of a.discovery.answers)i=N(i,v.questionId,v.answer);i=O(i),await g(n,t.name,i),c.push(t.name)}let u=q(a,"cancelled",`Split into: ${c.join(", ")}`);await g(n,s,u),e.writeln(C("Split complete."),` Created ${c.length} sub-specs:`);for(let t of c)e.writeln(" ",o("\u25CB")," ",p(t));return e.writeln("",o(`Parent spec "${s}" cancelled.`)),await e.close(),f(void 0)};export{ie as main};
@@ -0,0 +1 @@
1
+ import{a as f,d as P}from"./chunk-7GUYMD3Z.js";import{a as R,b as S}from"./chunk-ZMVD5IU4.js";import"./chunk-MRZT23BL.js";import"./chunk-7UX6WIXX.js";import{a as k,d as w}from"./chunk-TJZAIUKM.js";import{c as h}from"./chunk-YK6UG66R.js";import{f as b,g as x,l as D,p as v,s as O}from"./chunk-LWCWPXCS.js";import{c as i,d as r,f as c,g as y,h as p,k as I,o as d,q as u,r as m}from"./chunk-Y6AFIAJP.js";import{a as l,b as E}from"./chunk-2N4GTHXQ.js";import{b as C}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var W=async g=>{let t=C.process.cwd(),o=k(g);if(!await O(t)){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=x(g),e=await b(t,V),n=await D(t),T={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:n?.concerns??[],tools:n?.tools??[],decisions:e.decisions.length};if(o==="json"){let a=(await v(t)).filter(N=>n!==null&&n.concerns.includes(N.id)),$=await R(t),j=S(n?.tools??[]),F=P(e,a,$,n,void 0,void 0,void 0,j);return await w({...T,...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"?y(e.phase):e.phase==="BLOCKED"?c(e.phase):e.phase==="EXECUTING"?I(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`))),n!==null&&(s.writeln(""),n.concerns.length>0&&s.writeln(" Concerns: ",r(n.concerns.join(", "))),n.tools.length>0&&s.writeln(" Tools: ",r(n.tools.join(", ")))),e.decisions.length>0&&(s.writeln(""),s.writeln(` Decisions: ${e.decisions.length}`)),await s.close()}return l(void 0)};export{W as main};
@@ -0,0 +1 @@
1
+ import{a as y,d as A}from"./chunk-3SLKOP72.js";import{m as E}from"./chunk-TMC5H2A5.js";import{d as x,f as S,h as g,i as k,j as C}from"./chunk-LWCWPXCS.js";import{d as u,f as n,g as f,o as d,q as w,r as h}from"./chunk-Y6AFIAJP.js";import{a as m,b as i}from"./chunk-2N4GTHXQ.js";import{b as c}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var q=async l=>{let e=d({renderer:h.ansi(),sink:w.stdout()}),a=c.process.cwd(),o=g(l);if(!o.ok)return e.writeln(n(o.error)),await e.close(),i({exitCode:1});let p=(l??[]).filter(r=>!r.startsWith("--spec=")).join(" ");if(p.length===0)return e.writeln(n('A reason is required: noskills wontfix "reason text"')),await e.close(),i({exitCode:1});let s;try{s=await S(a,o.spec)}catch(r){let D=r instanceof Error?r.message:String(r);return e.writeln(n(D)),await e.close(),i({exitCode:1})}if(s.phase==="IDLE"||s.phase==="FREE"||s.phase==="UNINITIALIZED"||s.phase==="COMPLETED")return e.writeln(n(`Cannot mark as won't fix in phase: ${s.phase}`)),await e.close(),i({exitCode:1});if(s.spec!==null){let r=`${a}/${x.specDir(s.spec)}`;try{await c.fs.stat(r)}catch{return e.writeln(n(`Active spec '${s.spec}' directory not found.`)),e.writeln(u("Run `noskills reset` to return to IDLE.")),await e.close(),i({exitCode:1})}}let t=E(s,"wontfix",p);return await k(a,t),t.spec!==null&&await C(a,t.spec,t),t.spec!==null&&(await y(a,t.spec,"wontfix"),await A(a,t.spec,"wontfix")),e.writeln(f("\u2714"),` Spec marked as won't fix: ${p}`),await e.close(),m(void 0)};export{q as main};
package/noskills.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as t}from"./chunks/chunk-ALZM4JXG.js";import{c as o}from"./chunks/chunk-2N4GTHXQ.js";import{b as s}from"./chunks/chunk-MNEZ5QGX.js";import"./chunks/chunk-DHMCIRLT.js";import"./chunks/chunk-4BH6CF3J.js";import"./chunks/chunk-OTRBRRIO.js";var r=new t({description:"noskills \u2014 state-machine orchestrator for AI agents",modules:{init:{description:"Initialize noskills in project",load:()=>import("./chunks/init-UQLVVP2M.js")},status:{description:"Show current state",load:()=>import("./chunks/status-S2X4ADGF.js")},spec:{description:"Manage specs (new, list)",load:()=>import("./chunks/spec-ZLE74TVR.js")},next:{description:"Get next instruction for agent",load:()=>import("./chunks/next-4IJJBQBE.js")},approve:{description:"Approve phase transition",load:()=>import("./chunks/approve-NPG6X7O6.js")},block:{description:"Mark spec as blocked",load:()=>import("./chunks/block-LSEXCK45.js")},reset:{description:"Reset current spec state",load:()=>import("./chunks/reset-WRTVX7TT.js")},done:{description:"Mark spec execution as complete",load:()=>import("./chunks/done-OMGLEA32.js")},free:{description:"Enter or exit free mode (no enforcement)",load:()=>import("./chunks/free-BO5UA5V2.js")},cancel:{description:"Cancel current spec",load:()=>import("./chunks/cancel-7NGO246Z.js")},wontfix:{description:"Mark spec as won't fix (requires reason)",load:()=>import("./chunks/wontfix-CDPG2GUG.js")},reopen:{description:"Reopen a completed spec for revision",load:()=>import("./chunks/reopen-EKSLLO54.js")},concern:{description:"Manage concerns (add, remove, list)",load:()=>import("./chunks/concern-3K3QUYG4.js")},run:{description:"Autonomous execution loop (Ralph loop)",load:()=>import("./chunks/run-ROKOTYPH.js")},watch:{description:"Live dashboard for monitoring agent progress",load:()=>import("./chunks/watch-4HJMGNF4.js")},sync:{description:"Regenerate tool-specific files",load:()=>import("./chunks/sync-VS4HROEX.js")},purge:{description:"Remove all noskills content (specs, rules, concerns, hooks)",load:()=>import("./chunks/purge-MDSEQLDQ.js")},"invoke-hook":{description:"Internal hook handlers (called by agents)",load:()=>import("./chunks/invoke-hook-THWB24OS.js")},rule:{description:"Manage rules (add, list, promote)",load:()=>import("./chunks/rule-QP5BSH27.js")}}});var i={name:"@eser/noskills",version:"4.1.43",type:"module",exports:{".":"./main.ts","./mod":"./mod.ts","./module":"./module.ts"},dependencies:{"@eser/ai":"workspace:*","@eser/primitives":"workspace:*","@eser/shell":"workspace:*","@eser/standards":"workspace:*","@eser/streams":"workspace:*",yaml:"^2"},devDependencies:{"@std/assert":"npm:@jsr/std__assert@^1.0.16","@std/testing":"npm:@jsr/std__testing@^1.0.16"}};var p=r.toCommand("noskills",i.version),d=async()=>await p.parse();if(import.meta.main){let n=await d();o(n,{ok:()=>{},fail:e=>{e.message!==void 0&&console.error(e.message),s.process.setExitCode(e.exitCode)}})}export{d as main};
2
+ import{a as t}from"./chunks/chunk-ALZM4JXG.js";import{c as o}from"./chunks/chunk-2N4GTHXQ.js";import{b as s}from"./chunks/chunk-MNEZ5QGX.js";import"./chunks/chunk-DHMCIRLT.js";import"./chunks/chunk-4BH6CF3J.js";import"./chunks/chunk-OTRBRRIO.js";var r=new t({description:"noskills \u2014 state-machine orchestrator for AI agents",modules:{init:{description:"Initialize noskills in project",load:()=>import("./chunks/init-M4MSHCVJ.js")},status:{description:"Show current state",load:()=>import("./chunks/status-63TFVF7Y.js")},spec:{description:"Manage specs (new, list)",load:()=>import("./chunks/spec-HQZVVCBY.js")},next:{description:"Get next instruction for agent",load:()=>import("./chunks/next-4DJGEJBW.js")},approve:{description:"Approve phase transition",load:()=>import("./chunks/approve-NPG6X7O6.js")},block:{description:"Mark spec as blocked",load:()=>import("./chunks/block-LSEXCK45.js")},reset:{description:"Reset current spec state",load:()=>import("./chunks/reset-WRTVX7TT.js")},done:{description:"Mark spec execution as complete",load:()=>import("./chunks/done-OMGLEA32.js")},free:{description:"Enter or exit free mode (no enforcement)",load:()=>import("./chunks/free-BO5UA5V2.js")},cancel:{description:"Cancel current spec",load:()=>import("./chunks/cancel-BK6GCIIY.js")},wontfix:{description:"Mark spec as won't fix (requires reason)",load:()=>import("./chunks/wontfix-BOT7HHH2.js")},reopen:{description:"Reopen a completed spec for revision",load:()=>import("./chunks/reopen-EKSLLO54.js")},concern:{description:"Manage concerns (add, remove, list)",load:()=>import("./chunks/concern-3K3QUYG4.js")},run:{description:"Autonomous execution loop (Ralph loop)",load:()=>import("./chunks/run-3VWWQDN2.js")},watch:{description:"Live dashboard for monitoring agent progress",load:()=>import("./chunks/watch-4HJMGNF4.js")},sync:{description:"Regenerate tool-specific files",load:()=>import("./chunks/sync-VS4HROEX.js")},purge:{description:"Remove all noskills content (specs, rules, concerns, hooks)",load:()=>import("./chunks/purge-MDSEQLDQ.js")},"invoke-hook":{description:"Internal hook handlers (called by agents)",load:()=>import("./chunks/invoke-hook-HB2TBCHD.js")},rule:{description:"Manage rules (add, list, promote)",load:()=>import("./chunks/rule-QP5BSH27.js")}}});var i={name:"@eser/noskills",version:"4.1.44",type:"module",exports:{".":"./main.ts","./mod":"./mod.ts","./module":"./module.ts"},dependencies:{"@eser/ai":"workspace:*","@eser/primitives":"workspace:*","@eser/shell":"workspace:*","@eser/standards":"workspace:*","@eser/streams":"workspace:*",yaml:"^2"},devDependencies:{"@std/assert":"npm:@jsr/std__assert@^1.0.16","@std/testing":"npm:@jsr/std__testing@^1.0.16"}};var p=r.toCommand("noskills",i.version),d=async()=>await p.parse();if(import.meta.main){let n=await d();o(n,{ok:()=>{},fail:e=>{e.message!==void 0&&console.error(e.message),s.process.setExitCode(e.exitCode)}})}export{d as main};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noskills",
3
- "version": "4.1.43",
3
+ "version": "4.1.44",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "noskills": "./noskills.js"
@@ -1 +0,0 @@
1
- import{a as k,d as D}from"./chunk-3SLKOP72.js";import{m as C}from"./chunk-TMC5H2A5.js";import{d as w,f as h,h as S,i as g,j as y}from"./chunk-LWCWPXCS.js";import{d as l,f as n,g as m,o as u,q as d,r as f}from"./chunk-Y6AFIAJP.js";import{a as p,b as i}from"./chunk-2N4GTHXQ.js";import{b as o}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var R=async E=>{let e=u({renderer:f.ansi(),sink:d.stdout()}),r=o.process.cwd(),c=S(E);if(!c.ok)return e.writeln(n(c.error)),await e.close(),i({exitCode:1});let s;try{s=await h(r,c.spec)}catch(a){let I=a instanceof Error?a.message:String(a);return e.writeln(n(I)),await e.close(),i({exitCode:1})}if(s.phase==="IDLE"||s.phase==="UNINITIALIZED"||s.phase==="COMPLETED")return e.writeln(n(`Cannot cancel in phase: ${s.phase}`)),await e.close(),i({exitCode:1});if(s.spec!==null){let a=`${r}/${w.specDir(s.spec)}`;try{await o.fs.stat(a)}catch{return e.writeln(n(`Active spec '${s.spec}' directory not found.`)),e.writeln(l("Run `noskills reset` to return to IDLE.")),await e.close(),i({exitCode:1})}}let t=C(s,"cancelled");return await g(r,t),t.spec!==null&&await y(r,t.spec,t),t.spec!==null&&(await k(r,t.spec,"cancelled"),await D(r,t.spec,"cancelled")),e.writeln(m("\u2714")," Spec cancelled."),await e.close(),p(void 0)};export{R as main};
@@ -1,16 +0,0 @@
1
- import{a as C,c as O,d as R,e as T}from"./chunk-MRZT23BL.js";import{c as P}from"./chunk-YK6UG66R.js";var N=[{id:"status_quo",text:"What does the user do today without this feature?",concerns:["product:status_quo","eng:replace_scope","qa:regression_risk"]},{id:"ambition",text:"Describe the 1-star and 10-star versions.",concerns:["product:scope_direction","eng:complexity_tier","qa:test_depth"]},{id:"reversibility",text:"Does this change involve an irreversible decision?",concerns:["product:one_way_door","eng:migration_strategy","qa:verification_stringency"]},{id:"user_impact",text:"Does this change affect existing users' behavior?",concerns:["product:breaking_change","eng:backward_compat","qa:regression_tests"]},{id:"verification",text:"How do you verify this works correctly?",concerns:["product:success_metric","eng:test_strategy","qa:acceptance_criteria"]},{id:"scope_boundary",text:"What should this feature NOT do?",concerns:["product:focus","eng:out_of_scope","qa:negative_tests"]}],D=e=>N.map(t=>({...t,extras:O(e,t.id)}));var q=e=>{let t=new Set(e.map(n=>n.questionId));return N.every(n=>t.has(n.id))};var w=e=>P(e),o=(e,t)=>{if(t===null)return w(e);let n=e.indexOf(" ");if(n===-1)return w(`${e} --spec=${t}`);let s=e.slice(0,n),r=e.slice(n);return w(`${s} --spec=${t}${r}`)},_="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.",U={hasAskUserTool:!0,optionPresentation:"tool",hasSubAgentDelegation:!0,subAgentMethod:"task"},Y=(e,t,n,s,r=U)=>{let h=e.execution.iteration>=t,u="You are a senior engineer and a scrum master who takes pride in honest reporting. Your reputation depends on accuracy, not speed. You are responsible for others' toil, and you are a perfect example of a servant leader. When reporting progress: if something is NOT implemented, say so \u2014 don't hide it. If partially done, say 'partially done: [what works] / [what doesn't]'. If untested, say 'implemented but untested'. NEVER say 'done' for something you haven't verified yourself. Underpromise \u2014 4 of 6 done means '4 of 6 done, 2 remaining', not 'almost done'.",l="Never skip steps or make decisions without asking the user. If you think something can be skipped or inferred, ask first. Explicit > Clever.",g=r.hasAskUserTool?"At every decision point (discovery questions, classification, spec approval, expansion proposals, architectural decisions, rule promotion), you MUST use AskUserQuestion to get the user's input. You MUST NOT make decisions, infer preferences, or assume the user's intent. If you're unsure whether something is a decision point, it is \u2014 ask.":"At every decision point (discovery questions, classification, spec approval, expansion proposals, architectural decisions, rule promotion), you MUST ask the user. Present options as a numbered list and ask the user to pick a number. You MUST NOT make decisions, infer preferences, or assume the user's intent. If you're unsure whether something is a decision point, it is \u2014 ask.",f="At every decision point where you present options to the user, share your recommendation BEFORE asking. Say what you think and why, then ask if the user agrees. Format: 'I'd recommend X because [reason]. Agree, or would you prefer Y?' The user always has the final word, but you save them cognitive load by proposing first.",d="noskills is a live state machine the user watches in real-time. Call noskills ONCE per interaction. Ask ONE question, wait for the user's answer, submit it. Never batch-submit, never backfill, never answer questions yourself.",i=n?[u,l,g,f,d]:[_,u,l,g,f,d],c=s?.outOfScope??[],p=e.spec;switch(e.phase){case"FREE":return{rules:[],tone:"Quiet. No enforcement."};case"IDLE":{let a=r.optionPresentation==="tool"?["When interactiveOptions are present, pass them DIRECTLY as the `options` array in AskUserQuestion \u2014 they are already in the correct {label, description} format. You MUST also provide a `header` field (max 12 chars, e.g. 'Action') and a `question` field. When the user picks an option, look up its label in the `commandMap` object to find the command to execute.","For availableConcerns: use AskUserQuestion with multiSelect:true. AskUserQuestion supports max 4 options per question and max 4 questions per call. If there are more than 4 concerns, split them across two questions within the same AskUserQuestion call (e.g., first 3 in question 1, remaining in question 2). NEVER silently drop concerns \u2014 present ALL available concerns to the user, even if it requires multiple questions."]:[`When interactiveOptions are present, present them as a numbered list. For each option show the number, label, and description. Ask the user to pick a number. When the user picks an option, look up its label in the \`commandMap\` object to find the command to execute. Example format:
2
-
3
- 1. Start a new spec \u2014 Begin discovery questions for a new feature
4
- 2. Add concerns \u2014 Shape how discovery and specs work
5
-
6
- Pick a number:`,"For availableConcerns: present ALL available concerns as a numbered list. NEVER silently drop concerns \u2014 present ALL available concerns to the user. Ask the user to enter the numbers of the concerns they want to activate (comma-separated)."],m=r.hasAskUserTool?"For availableConcerns: use AskUserQuestion with multiSelect:true. AskUserQuestion supports max 4 options per question and max 4 questions per call. If there are more than 4 concerns, split them across two questions within the same AskUserQuestion call (e.g., first 3 in question 1, remaining in question 2). NEVER silently drop concerns \u2014 present ALL available concerns to the user, even if it requires multiple questions.":void 0,k=m!==void 0?[a[0],m]:a;return{rules:["You MUST NOT create, edit, or delete any project file until you have either entered free mode or created and approved a spec. No exceptions. No 'quick fixes'. Choose: `noskills free` for unstructured work, or `noskills spec new` for structured work.",...i,...k,"Do not take action without the user choosing an option first.","When the user wants to create a new spec, they can provide anything: a one-line description, a full task list, meeting notes, a kanban card, a customer email, or a detailed requirements document. Accept whatever format they provide. If it's long, summarize it into a spec title for the slug but preserve the full text as context for discovery.","After running spec new, ask the user if they want full discovery, quick discovery, or skip to spec draft. Full discovery: pre-scan, premise challenge, 6 questions, expansions, architecture, error map, synthesis. Quick discovery: only questions relevant to active concerns, skip expansions and error map. Skip to spec draft: classification \u2192 approve \u2192 execute. Never skip discovery without asking."],tone:"Welcoming. Present choices, then wait."}}case"DISCOVERY":{let a=r.hasAskUserTool?"You MUST ask each discovery question using AskUserQuestion tool. You MUST NOT answer questions yourself or infer answers from the spec description. You MUST NOT submit discovery answers without the user explicitly providing each answer through AskUserQuestion. Each question \u2192 one AskUserQuestion call \u2192 user answers \u2192 next question. If the user already gave a detailed description in spec new, you may PRE-FILL suggested answers as option descriptions in AskUserQuestion \u2014 but the user must still confirm or override each one. If the user provided a fully formed plan, you may skip Phase 2 (questions) but you MUST still run premise challenge and alternatives. Never skip premise challenge.":"You MUST ask each discovery question by presenting it to the user as text. You MUST NOT answer questions yourself or infer answers from the spec description. You MUST NOT submit discovery answers without the user explicitly providing each answer. Each question \u2192 present it \u2192 user answers \u2192 next question. If the user already gave a detailed description in spec new, you may PRE-FILL suggested answers \u2014 but the user must still confirm or override each one. If the user provided a fully formed plan, you may skip Phase 2 (questions) but you MUST still run premise challenge and alternatives. Never skip premise challenge.";return{modeOverride:"You are in plan mode. Do not attempt to create, edit, or write any files. Do not run any shell commands that modify state. You can read files and run read-only commands to understand the codebase. Your ONLY job right now is to think and talk. Read code to understand. Ask questions to discover. Challenge assumptions. Propose ideas. Debate tradeoffs. But NEVER create, edit, or delete project files. Discovery exists to catch what you don't yet know you don't know.",rules:[...i,a,"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).","BEFORE asking any discovery questions, conduct a pre-discovery codebase scan: read the project README, CLAUDE.md, and any design docs; check the last 20 git commits (git log --oneline -20); look for TODO files, open issue references, and existing specs; scan the directory structure to understand the project shape. Then present a brief 'Pre-discovery audit' summary: stack detected, recent work themes, open TODOs, existing specs. This gives you CONTEXT to ask INFORMED questions, not blind ones.","After the pre-discovery codebase scan and BEFORE starting questions, ask the user: 'What kind of discovery do you need? A) Explore scope \u2014 I'll help expand, find opportunities, think bigger. B) Technical depth \u2014 I'll focus on architecture, error handling, implementation strategy. C) Validate my plan \u2014 I already know what I want, challenge my assumptions. D) Ship fast \u2014 minimal scope, cut the fat, get to tasks quickly.' Adapt your discovery emphasis accordingly: Explore \u2192 heavy on expansion proposals and dream state; Technical \u2192 heavy on architectural decisions and error/rescue map; Validate \u2192 heavy on premise challenge and pushback; Ship fast \u2192 minimal questions, skip expansions, go direct to classification and tasks.","Before starting discovery questions, challenge the user's initial spec description against what you learned from the codebase scan. Look for: hidden complexity they haven't mentioned, conflicts with existing code, scope that's bigger or smaller than they think, existing modules that overlap with what they're asking for. Share your observations and ask clarifying follow-ups, then proceed to questions.","When asking discovery questions, use your codebase knowledge to offer concrete options alongside the open-ended question. For example, instead of just 'What does the user do today?' present: 'Based on the codebase, I see three likely scenarios: A) ... B) ... C) ... D) Something else \u2014 describe it. Which is closest?' The user can always pick 'something else' but concrete options speed up the conversation and force specificity.",r.hasAskUserTool?"Ask one question at a time using AskUserQuestion tool.":"Ask one question at a time. Present it as text and wait for the user's response.","Push back on vague answers \u2014 you will be the one executing this spec, vague answers make your job harder.","When the user gives a short answer, follow up: 'Can you be more specific?'","After collecting discovery answers, synthesize a CURRENT STATE \u2192 THIS SPEC \u2192 6-MONTH IDEAL vision before generating the spec. Show three columns: where the project is now, what this spec achieves, and where it could go in 6 months. Note: 'This spec moves you from column 1 to column 2. Column 3 is out of scope but worth knowing \u2014 every decision in this spec should keep column 3 possible.' This helps the user see if the scope is right.","When you spot expansion opportunities during discovery (from codebase scan, TODOs, concern requirements, synergies with the current plan), present each as a numbered proposal (1/N, 2/N...). Every proposal MUST include: clear description of WHAT and WHY (how it connects to the current plan); effort estimate as S/M/L/XL with human time and CC time estimates (e.g., 'S (human: ~1 day / CC: ~15 min)' \u2014 not just 'small'); risk assessment as Low/Low-Med/Med/Med-High/High naming the specific risk factor; completeness delta showing X/10 without this and Y/10 with this. Every proposal gets three options: A) Add to scope B) Defer to future spec C) Skip \u2014 not interested, plus 'Chat about this' and 'Skip remaining proposals' escape hatches.","After discovery questions and expansion proposals, identify architectural decisions that must be resolved before implementation. These are decisions where choosing A vs B changes the shape of multiple tasks, the data model, the API surface, or system boundaries. Present each as a concrete technical question with options, a RECOMMENDATION with reasoning, and completeness scores. Show how each option affects downstream work (e.g., 'If you choose B, tasks 3 and 4 need a job queue setup step added'). Only surface decisions that BLOCK implementation \u2014 not preferences or nice-to-haves. If the user says 'I don't know yet', mark it as a risk: 'UNRESOLVED: [decision] TBD. Tasks X-Y may change.' Never allow implementation to start with unresolved architectural decisions \u2014 flag them prominently in the spec.","Before finalizing, map error and rescue paths for every significant codepath in the planned work. Create a table: codepath | what can go wrong | how it's handled. Identify CRITICAL GAPS \u2014 failure modes that the plan doesn't address. Present each critical gap as a decision with options, a recommendation, and completeness scores, just like architectural decisions. Resolved gaps become tasks or acceptance criteria. Unresolved gaps become risk flags. Think like an SRE reviewing a design doc \u2014 what fails at 3am?","After all discovery questions, expansion proposals, architectural decisions, and error mapping are complete, present a DISCOVERY SUMMARY for the user to review: intent, ambition, reversibility, impact, verification, out of scope, the dream state table (current \u2192 this spec \u2192 future), accepted/deferred/skipped expansions, resolved architectural decisions, and the error/rescue map. Ask for confirmation before generating the spec. This is the last chance to catch misunderstandings.","Once you have a substantive answer for each question, collect all answers and submit them together in a single `noskills next --answer` call as a JSON object."],tone:"Curious interviewer who has a stake in the answers and comes PREPARED. You've read the codebase before asking. Challenge assumptions, offer concrete options, think about architecture and failure modes. Think deeply before asking each question."}}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:[...i,"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."],tone:"Careful reviewer. The user must confirm every answer."};case"SPEC_DRAFT":return{modeOverride:"You are in plan mode. Do not attempt to create, edit, or write any files. Do not run any shell commands that modify state. You can read files and run read-only commands to understand the codebase. Your ONLY job right now is to think and talk. Read code to understand. Ask questions to discover. Challenge assumptions. Propose ideas. Debate tradeoffs. But NEVER create, edit, or delete project files. Discovery exists to catch what you don't yet know you don't know.",rules:[...i,"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.","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.","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"}'`,p)+"`. 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:[...i,"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 a=[];r.subAgentMethod==="task"?a.push(`When you receive a task from noskills next, do NOT execute it yourself. Spawn the noskills-executor sub-agent using the Agent tool. Pass it: the task title, description, acceptance criteria (with IDs), behavioral rules, out-of-scope constraints, concern reminders, and relevant file paths. When the sub-agent completes, review its results briefly, then report to noskills via \`${o(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`,p)}\`. You are the orchestrator \u2014 the sub-agent is the implementer.`,"If the sub-agent fails, errors out, or returns no results, fall back to executing the task directly yourself. Report the sub-agent failure in your next status report so it can be investigated.","After the noskills-executor sub-agent completes a task, spawn a noskills-verifier sub-agent to independently verify the work. Pass it: the list of changed files, the acceptance criteria, and the test commands. The verifier reports PASS/FAIL per criterion with evidence. Use the verifier's report as your status report to noskills. Do NOT submit status reports based solely on the executor's self-report.",`After spawning sub-agents, ALWAYS present a dispatch table showing the FULL pipeline \u2014 not just executors, but also verification and test steps:
7
-
8
- | Step | Agent | Files | Tasks | Est. Time |
9
- |------|-------|-------|-------|-----------|
10
- | 1. Implement | noskills-executor | purge.ts | Tasks 1-6 | ~3 min |
11
- | 2. Verify | noskills-verifier | purge.ts (read-only) | Validate ACs | ~1 min |
12
- | 3. Write tests | noskills-executor | purge.test.ts | Task 7 | ~2 min |
13
-
14
- When agents complete, update with actual time and status (Done / Failed / Found N issues). The user should see the complete plan upfront.
15
-
16
- Estimate: S ~1min, M ~2min, L ~5min, XL ~10min.`,"The agent that writes implementation code must NOT write tests for that code. Spawn a SEPARATE sub-agent for test writing. This prevents the implementer from writing tests that only confirm what it already knows. The test writer reads the code fresh and tests what it actually does, not what the implementer intended.","When deciding how to split work across sub-agents: if all tasks touch the same file or tightly coupled files, batch them into one executor. If tasks touch independent files or modules, spawn parallel executors. Always err toward smaller, focused sub-agents over large batched ones \u2014 fresh context per task is better than accumulated context across tasks."):r.subAgentMethod==="delegation"?a.push(`When you receive a task from noskills next, use Kiro's agent delegation to spawn the noskills-executor agent. Pass it: the task title, description, acceptance criteria (with IDs), behavioral rules, out-of-scope constraints, concern reminders, and relevant file paths. When the agent completes, review its results briefly, then report to noskills via \`${o(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`,p)}\`. You are the orchestrator \u2014 the delegated agent is the implementer.`,"If the delegated agent fails, errors out, or returns no results, fall back to executing the task directly yourself. Report the agent failure in your next status report so it can be investigated.","After the noskills-executor agent completes a task, delegate to the noskills-verifier agent to independently verify the work. Pass it: the list of changed files, the acceptance criteria, and the test commands. The verifier reports PASS/FAIL per criterion with evidence. Use the verifier's report as your status report to noskills. Do NOT submit status reports based solely on the executor's self-report.","When deciding how to split work across delegated agents: if all tasks touch the same file or tightly coupled files, batch them into one executor. If tasks touch independent files or modules, spawn parallel executors. Always err toward smaller, focused agents over large batched ones \u2014 fresh context per task is better than accumulated context across tasks."):a.push("Execute tasks sequentially in this context. Do not attempt to spawn sub-agents \u2014 this tool does not support agent delegation. Complete each task yourself, verify your work (run type checks and tests), then report progress.",`After completing a task, report to noskills via \`${o(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`,p)}\`.`);let m=[...i,"You are the orchestrator, not the implementer. NEVER create, edit, or delete project files directly. ALWAYS delegate to noskills-executor sub-agent, even for single-line changes. There is no 'minor change' \u2014 every edit goes through the executor\u2192verifier pipeline. Your job: read noskills output, spawn sub-agents, report status.","Do not explore the codebase beyond what the current task requires.","Do not refactor, improve, or modify code outside this task's scope.","Do not add features, tests, or documentation not specified in the spec.","If you need to read files to understand context, timebox it \u2014 then write code.","The deliverable is working code, not a plan or analysis.","Complete the task, then report progress. The user handles git.",...a,`When you discover a pattern, receive a correction, or identify a recurring preference from the user, ask: 'Should this be a permanent rule for this project, or just for this task?' If permanent, run: \`${w('rule add "<description>"')}\`. If just this task, note it and move on. Never write to \`.eser/rules/\` directly.`];e.execution.lastVerification?.passed===!1&&m.push("Tests are failing. Fix ONLY the failing tests. Do not refactor passing code.");let k={rules:m,tone:"Direct. Orchestrate immediately \u2014 spawn sub-agents.",outOfScope:c.length>0?c:void 0};return h?{...k,urgency:`You have been in this session for ${e.execution.iteration}+ iterations. Your context is degrading. Finish the current task and recommend the user start a fresh session. Do not start new tasks.`}:k}case"BLOCKED":return{rules:[...i,"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:[...i,"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:[...i,`Run \`${o("next",p)}\` to get your instructions.`,"Do not take action without noskills guidance."],tone:"Neutral. Waiting for direction."}}},M=5*60*1e3,W=(e,t)=>{let n=e.spec,s;switch(e.phase){case"IDLE":s=`No active spec. Start one with: \`${w('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}},B=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 COMPLETED",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>M)return{what:"noskills orchestrates your work: IDLE \u2192 DISCOVERY \u2192 DISCOVERY_REVIEW \u2192 SPEC_DRAFT \u2192 SPEC_APPROVED \u2192 EXECUTING \u2192 COMPLETED",how:`Run \`${o("next",t)}\` for instructions. Submit results with \`${o('next --answer="..."',t)}\`. Never make architectural decisions without asking.`,currentPhase:e.phase}},se=(e,t,n,s,r,h,u,l)=>{let g=W(e,t),f=s?.maxIterationsBeforeRestart??15,d=s?.allowGit??!1,i=l??U,c=Y(e,f,d,r,i),p=B(e),a;switch(e.phase){case"IDLE":a=L(t,C,n.length,u);break;case"DISCOVERY":a=j(e,t,n);break;case"DISCOVERY_REVIEW":a=H(e,t);break;case"SPEC_DRAFT":a=G(e);break;case"SPEC_APPROVED":a=X(e);break;case"EXECUTING":a=J(e,t,n,f,r,h);break;case"BLOCKED":a=Z(e);break;case"COMPLETED":a=ee(e);break;case"FREE":a={phase:"FREE",instruction:"Free mode \u2014 no enforcement active. Work as you wish."};break;default:a=L(t,C,n.length,u)}let m={...a,meta:g,behavioral:c};p!==void 0&&(m={...m,protocolGuide:p});let k=V(e,t,u);if(k.length>0){let x=k.map(({label:y,description:b})=>({label:y,description:b})),I={};for(let y of k)I[y.label]=y.command;let S=i.optionPresentation==="tool"?"AskUserQuestion":"prose-numbered-list",E=i.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.";m={...m,interactiveOptions:x,commandMap:I,toolHint:S,toolHintInstruction:E}}return m},V=(e,t,n)=>{let s=e.spec;switch(e.phase){case"IDLE":{let r=[],u=(n?.existingSpecs??[]).filter(l=>l.phase!=="COMPLETED");t.length===0&&r.push({label:"Add concerns (Recommended)",description:"Shape how discovery and specs work by adding project concerns",command:w("concern add <id> [<id2> ...]")}),r.push({label:"Start a new spec",description:"Begin discovery questions for a new feature",command:w('spec new --name=<slug> "description"')}),r.push({label:"Free mode",description:"No enforcement \u2014 work freely until you want structure",command:w("free")});for(let l of u.slice(0,2))r.push({label:`Continue: ${l.name} (${l.phase})`,description:l.detail??`Iteration ${l.iteration}`,command:o("next",l.name)});return t.length>0&&r.push({label:"Edit concerns",description:`Currently: ${t.map(l=>l.id).join(", ")}`,command:w("concern list")}),r.slice(0,4)}case"DISCOVERY_REVIEW":return[{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:"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:"Not yet",description:'Save for later \u2014 resume with noskills next --answer="start"',command:""}];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:w('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:w("status")}];default:return[]}},Q="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.",L=(e,t,n,s)=>({phase:"IDLE",instruction:"Present the welcome dashboard and interactive options to the user. Show existing specs if any, then present choices. IMPORTANT: Present ALL available concerns to the user \u2014 never truncate the list. Split across multiple AskUserQuestion calls if needed.",welcome:Q,existingSpecs:s?.existingSpecs??[],availableConcerns:t.map(r=>({id:r.id,description:r.description})),activeConcerns:e.map(r=>r.id),activeRulesCount:s?.rulesCount??n,hint:e.length===0?"No concerns active. Consider adding concerns first \u2014 they shape discovery questions and specs.":void 0}),j=(e,t,n)=>{let s=e.spec,r=D(t),h=e.discovery.answers.length,u=q(e.discovery.answers),l=e.discovery.audience==="agent";if(u)return{phase:"DISCOVERY",instruction:`All discovery questions answered. Run: \`${o("approve",s)}\``,questions:[],answeredCount:h,context:{rules:n,concernReminders:[]},transition:{onComplete:o("approve",s)}};if(l){let d=e.discovery.currentQuestion,i=r[d];if(i===void 0)return{phase:"DISCOVERY",instruction:`All discovery questions answered. Run: \`${o("approve",s)}\``,questions:[],answeredCount:h,context:{rules:n,concernReminders:[]},transition:{onComplete:o("approve",s)}};let c={id:i.id,text:i.text,concerns:[...i.concerns],extras:i.extras.map(p=>p.text)};return{phase:"DISCOVERY",instruction:`Ask this question to the user using AskUserQuestion. Submit the answer with: \`${o('next --agent --answer="<answer>"',s)}\``,questions:[c],answeredCount:h,currentQuestion:d,totalQuestions:r.length,context:{rules:n,concernReminders:R(t)},transition:{onComplete:`${o('next --agent --answer="<answer>"',s)}`}}}let g=new Set(e.discovery.answers.map(d=>d.questionId));return{phase:"DISCOVERY",instruction:"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:r.filter(d=>!g.has(d.id)).map(d=>({id:d.id,text:d.text,concerns:[...d.concerns],extras:d.extras.map(i=>i.text)})),answeredCount:h,context:{rules:n,concernReminders:R(t)},transition:{onComplete:`${o(`next --answer='{"status_quo":"...","ambition":"...",...}'`,s)}`}}},H=(e,t)=>{let n=e.spec,s=D(t);return{phase:"DISCOVERY_REVIEW",instruction:"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:e.discovery.answers.map(h=>{let u=s.find(l=>l.id===h.questionId);return{questionId:h.questionId,question:u?.text??h.questionId,answer:h.answer}}),transition:{onApprove:o('next --answer="approve"',n),onRevise:o(`next --answer='{"revise":{"status_quo":"corrected answer"}}'`,n)}}},G=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 for review. Ask the user to review and approve.",specPath:e.specState.path??"",transition:{onApprove:o("approve",t)}}},X=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)}`}}},K=(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},z=(e,t,n,s,r,h,u,l)=>{let g=[],f=new Set(l??[]),d=0,i=()=>`ac-${++d}`;if(s!==null)for(let c of s.items)f.has(c.id)||g.push({id:c.id,text:`[DEBT from iteration ${c.since}] ${c.text}`});if(t&&g.push({id:i(),text:`[FAILED] Tests \u2014 fix this first: ${n.slice(0,200)}`}),h!=null)for(let c of h.verification){let p=i();f.has(p)||g.push({id:p,text:c})}for(let c of e)if(c.acceptanceCriteria!==void 0&&c.acceptanceCriteria.length>0)for(let p of c.acceptanceCriteria){if(!K(p,r))continue;let a=i();f.has(a)||g.push({id:a,text:`(${c.id}) ${p}`})}if(u!==void 0)for(let c of u){let p=i();f.has(p)||g.push({id:p,text:`(folder: ${c.folder}) ${c.rule}`})}return g},J=(e,t,n,s,r,h)=>{let u=e.spec,l=T(t),g=e.execution.iteration>=s,f=e.execution.lastVerification?.passed===!1,d=e.execution.lastVerification?.output??"",i=r?.tasks??[],c=e.execution.completedTasks??[],p=new Set(c),a=i.find(v=>!p.has(v.id))??null,m=a!==null?{id:a.id,title:a.title,totalTasks:i.length,completedTasks:c.length}:void 0;if(e.execution.awaitingStatusReport){let v=z(t,f,d,e.execution.debt,e.classification,r,h,e.execution.naItems),A={phase:"EXECUTING",instruction:"Before this task is accepted, report your completion status against these acceptance criteria.",context:{rules:n,concernReminders:R(t)},transition:{onComplete:`${o(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`,u)}`,onBlocked:`${o('block "reason"',u)}`,iteration:e.execution.iteration},statusReportRequired:!0,statusReport:{criteria:v,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 f&&(A={...A,verificationFailed:!0,verificationOutput:d.slice(0,2e3)}),A}let k=(e.execution.lastProgress??"").includes("Task not accepted"),x=e.execution.debt?.items??[],I=e.execution.debt?.unaddressedIterations??0,S=m!==void 0?`Execute task ${m.id}: ${m.title} (${m.completedTasks}/${m.totalTasks} completed)`:"All tasks completed. Run `"+o("done",u)+"` to finish.",E;if(f)E="Verification FAILED. Fix the failing tests before continuing.";else if(k&&x.length>0){let v=I>=3?` These items have been outstanding for ${I} iterations.`:"";E=`Task not accepted \u2014 ${x.length} remaining item(s) must be addressed before this task can be completed.${v} Address them, then submit a new status report.`}else E=S;let y={phase:"EXECUTING",instruction:E,task:m,context:{rules:n,concernReminders:R(t)},transition:{onComplete:`${o('next --answer="..."',u)}`,onBlocked:`${o('block "reason"',u)}`,iteration:e.execution.iteration}};if(k&&x.length>0&&(y={...y,taskRejected:!0,rejectionReason:`${x.length} remaining item(s) must be addressed.`,rejectionRemaining:x.map(v=>v.text)}),e.execution.debt!==null&&e.execution.debt.items.length>0){let v=e.execution.debt.unaddressedIterations??0,A=v>=3?`URGENT: These items have been unaddressed for ${v} iterations. Address them IMMEDIATELY before any new work.`:"These were not completed in a previous iteration. Address them BEFORE starting new work.";y={...y,previousIterationDebt:{fromIteration:e.execution.debt.fromIteration,items:e.execution.debt.items,note:A}}}if(f){let v=d.slice(0,2e3);y={...y,verificationFailed:!0,verificationOutput:v}}l.length>0&&(y={...y,concernTensions:l}),g&&(y={...y,restartRecommended:!0,restartInstruction:`Context may be getting large after ${e.execution.iteration} iterations. Consider starting a new conversation and running \`${o("next",u)}\` to resume - your progress is saved.`});let b=[...e.decisions].reverse().find(v=>!v.promoted);return b!==void 0&&e.execution.lastProgress?.startsWith("Resolved:")&&(y={...y,promotePrompt:{decisionId:b.id,question:b.question,choice:b.choice,prompt:`You just resolved a decision: "${b.choice}". Ask the user: "Should this be a permanent rule for future specs too?" If yes, run: \`${w(`rule add "${b.choice}"`)}\``}}),y},Z=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)}`}}},ee=e=>({phase:"COMPLETED",summary:{spec:e.spec,iterations:e.execution.iteration,decisionsCount:e.decisions.length,completionReason:e.completionReason,completionNote:e.completionNote}});export{N as a,D as b,q as c,se as d};
@@ -1 +0,0 @@
1
- import{a as T,b as J,e as B,f as N,g as q,h as G,i as U,j as h,k as r,l as y}from"./chunk-73EEM3FY.js";import{a as ie,b as ne,c as re}from"./chunk-VK7L5SMS.js";import{d as Z}from"./chunk-YYCDBPWA.js";import{a as ee,b as te,c as oe}from"./chunk-ZMVD5IU4.js";import{b as I}from"./chunk-MRZT23BL.js";import{d as se}from"./chunk-TJZAIUKM.js";import{a as X,c as A,d as Y}from"./chunk-YK6UG66R.js";import{a as W,b as z,i as H,m as _,o as K,q as V,s as Q}from"./chunk-LWCWPXCS.js";import"./chunk-AGPCY6XP.js";import{a as k}from"./chunk-ERX4HONR.js";import"./chunk-Y6AFIAJP.js";import"./chunk-5MN3MWQN.js";import"./chunk-OLM5RTFK.js";import{a as F}from"./chunk-ALZM4JXG.js";import{a as S}from"./chunk-2N4GTHXQ.js";import"./chunk-BBKSV2RO.js";import{b as g}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var he=new F({description:"AI provider interface \u2014 ask questions, generate content",modules:{ask:{description:"Send a prompt to an AI provider",load:()=>import("./ask-F4XM2EEC.js")},list:{description:"List available AI providers",load:()=>import("./list-3RK7TPGG.js")}}});var ae=k;var ve=async t=>{try{return await g.fs.stat(t),!0}catch{return!1}},we=[{id:"claude-code",paths:["CLAUDE.md",".claude"]},{id:"cursor",paths:[".cursorrules",".cursor"]},{id:"kiro",paths:[".kiro"]},{id:"copilot",paths:[".github/copilot-instructions.md"]},{id:"windsurf",paths:[".windsurfrules"]},{id:"codex",paths:[".codex",".codex/config.toml"]},{id:"copilot-cli",paths:[".copilot",".github/hooks"]}],le=async t=>{let e=[];for(let i of we)for(let o of i.paths)if(await ve(`${t}/${o}`)){e.push(i.id);break}return e};var a=async t=>{try{return await g.fs.stat(t),!0}catch{return!1}},ce=async(t,e)=>{try{let i=await g.fs.readTextFile(t);return JSON.parse(i)[e]??null}catch{return null}},xe=async t=>{let e=[];return(await a(`${t}/package.json`)||await a(`${t}/deno.json`))&&e.push("typescript"),await a(`${t}/go.mod`)&&e.push("go"),await a(`${t}/Cargo.toml`)&&e.push("rust"),(await a(`${t}/pyproject.toml`)||await a(`${t}/setup.py`))&&e.push("python"),e},Pe=async t=>{let e=[],i=await ce(`${t}/package.json`,"dependencies");return i!==null&&("react"in i&&e.push("react"),"vue"in i&&e.push("vue"),"svelte"in i&&e.push("svelte"),"next"in i&&e.push("nextjs"),"express"in i&&e.push("express"),"hono"in i&&e.push("hono")),e},Se=async t=>{let e=[];return await a(`${t}/.github/workflows`)&&e.push("github-actions"),await a(`${t}/.gitlab-ci.yml`)&&e.push("gitlab-ci"),await a(`${t}/Jenkinsfile`)&&e.push("jenkins"),await a(`${t}/.circleci`)&&e.push("circleci"),e},Te=async t=>{if(await a(`${t}/deno.json`))return"deno";let e=await ce(`${t}/package.json`,"devDependencies");if(e!==null){if("vitest"in e)return"vitest";if("jest"in e)return"jest";if("playwright"in e)return"playwright"}return null},de=async t=>{let[e,i,o,d]=await Promise.all([xe(t),Pe(t),Se(t),Te(t)]);return{languages:e,frameworks:i,ci:o,testRunner:d}};var It=async t=>{let e=g.process.cwd(),i=ne(t),o=J({target:i==="agent"?"non-interactive":"interactive"}),d=re(t),b=pe(d,"--concerns"),f=pe(d,"--tools"),p=d.includes("--non-interactive")||i==="agent";if(await Q(e))return r.warn(o,"noskills is already initialized in this project."),r.info(o,`Run \`${A("sync")}\` to regenerate tool files.`),S(void 0);N(o,"noskills init");let D=y(o,"Scanning project...");D.start();let m=await de(e);D.succeed("Project scanned");for(let s of m.languages)r.step(o,` ${s}`);for(let s of m.frameworks)r.step(o,` ${s}`);for(let s of m.ci)r.step(o,` ${s}`);m.testRunner!==null&&r.step(o,` test runner: ${m.testRunner}`),h(o);let R=y(o,"Detecting coding tools...");R.start();let $=await le(e),v=ie(),E=v!==null&&!$.includes(v)?[v]:[],w=[...new Set([...E,...$])];R.succeed(`${w.length} coding tool(s) detected`);for(let s of w){let n=s===v?" (current)":"";r.step(o,` ${s}${n}`)}let u;if(f!==null){let s=["claude-code","cursor","kiro","copilot","windsurf","opencode","codex","copilot-cli"],n=f.filter(c=>s.includes(c));u=[...new Set([...E,...n])]}else p?u=[...w]:(h(o),u=await Ie(o,w,v));h(o);let M=y(o,"Detecting AI providers...");M.start();let x=(await ae()).filter(s=>s.available).map(s=>s.name);M.succeed(`${x.length} provider(s) detected`),h(o);let P=await I(),l;if(b!==null){let s=P.map(n=>n.id);l=b.filter(n=>s.includes(n)).sort((n,c)=>s.indexOf(n)-s.indexOf(c))}else if(p)l=[];else{let s=P.map(c=>({value:c.id,label:c.name,hint:c.description.slice(0,60)})),n=await B(o,{message:"What kind of project is this? (space to toggle, enter to confirm)",options:s});l=T(n)?[]:[...n]}l.length>0?r.success(o,` Concerns: ${l.join(", ")}`):r.info(o,"No concerns selected. Add later with `concern add <id> [<id2> ...]`."),h(o);let j=y(o,"Initializing...");j.start(),await V(e);let ue=P.filter(s=>l.includes(s.id));for(let s of ue)await K(e,s);let L=await Y();X(L);let C={...z(l,u,x,m),command:L};await _(e,C);let O=W();if(await H(e,O),j.succeed("Scaffolded `.eser/`"),u.length>0){let s=y(o,"Syncing tool files...");s.start();let n=await oe(e,u,C);s.succeed(`Synced ${n.length} tool(s)`)}else r.warn(o,"No tools selected. noskills will work in agentless CLI mode only."),r.info(o,"Add tools later with `noskills sync`.");if(q(o,`Done. ${u.length} tool(s), ${x.length} provider(s), ${l.length} concern(s).`),i==="agent"){let n=(await I()).filter(me=>l.includes(me.id)),c=await ee(e),ge=te(C?.tools??[]),fe=Z(O,n,c,C,void 0,void 0,void 0,ge);await se(fe,"json")}else G(o),U(o,`Start a spec with: ${A('spec new "..."')}`);return S(void 0)},ke=[{value:"claude-code",label:"Claude Code"},{value:"cursor",label:"Cursor"},{value:"kiro",label:"Kiro"},{value:"copilot",label:"GitHub Copilot"},{value:"windsurf",label:"Windsurf"},{value:"opencode",label:"OpenCode"},{value:"codex",label:"Codex CLI"},{value:"copilot-cli",label:"Copilot CLI"}],Ie=async(t,e,i)=>{let o=e.length===0?"No coding tools detected. Which tools do you use? (space to toggle)":"Any additional tools? (space to toggle, enter to skip)",d=new Set(e),b=await B(t,{message:o,options:ke.map(p=>({...p,hint:p.value===i?"you're running inside it":d.has(p.value)?"detected":void 0,disabled:p.value===i})),initialValues:[...e],required:!1});if(T(b))return[...e];let f=[...b];return i!==null&&!f.includes(i)&&f.unshift(i),f},pe=(t,e)=>{if(t===void 0)return null;for(let i of t)if(i.startsWith(`${e}=`))return i.slice(e.length+1).split(",").map(o=>o.trim()).filter(Boolean);return null};export{It as main};
@@ -1,10 +0,0 @@
1
- import{d as v}from"./chunk-YYCDBPWA.js";import{a as C,b as T}from"./chunk-ZMVD5IU4.js";import"./chunk-MRZT23BL.js";import{c as k}from"./chunk-YK6UG66R.js";import{d as g,e as x,l as R,p as D,s as $}from"./chunk-LWCWPXCS.js";import{a as o}from"./chunk-2N4GTHXQ.js";import{b as n}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var P=new Map([["git stash",["list","show"]],["git tag",["-l","--list","-v","--verify"]],["git branch",["--list","-l","-a","--all","-r","--remotes","-v","--verbose","--contains","--no-contains","--merged","--no-merged"]]]),O=e=>{let s=e.trim();for(let[t,i]of P)if(s.startsWith(t)){let r=s.slice(t.length).trim().split(/\s+/)[0]??"";if(i.includes(r))return!0}return!1};var S=async()=>{let e=n.process.stdin.getReader(),s=[];try{for(;;){let{done:r,value:a}=await e.read();if(r||a===void 0)break;s.push(a)}}finally{e.releaseLock()}let t=0,i=new Uint8Array(s.reduce((r,a)=>r+a.length,0));for(let r of s)i.set(r,t),t+=r.length;let l=new TextDecoder().decode(i);try{return JSON.parse(l)}catch{return{}}},I=async e=>{let s=new TextEncoder,t=n.process.stdout.getWriter();await t.write(s.encode(JSON.stringify(e))),t.releaseLock()},B=async e=>{switch(e?.[0]){case"pre-tool-use":return await N();case"stop":return await b();case"post-file-write":return await A();case"post-bash":return await _();case"session-start":return await W();default:return o(void 0)}},N=async()=>{let e=await S(),s=e.tool_name??"unknown",t=e.tool_input??{},i=e.cwd??n.process.cwd(),l=await R(i),r={};try{r=await x(i)}catch{return o(void 0)}let a=async c=>{await I({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`noskills: ${c}`}})};if(s==="Bash"){let c=(t.command??"").trim();if(!(l?.allowGit??!1)){let f=["git add","git commit","git push","git merge","git rebase","git checkout","git stash","git reset","git cherry-pick","git tag","git branch -d","git branch -D","git branch -m","git revert","git am","git mv","git rm"];for(let p of f){let m="";if(c.startsWith(p))m=c.split(/\s*&&\s*|\s*;\s*/)[0]??c;else if(c.includes(` && ${p}`))m=c.split(/\s*&&\s*/).find(E=>E.trim().startsWith(p))??"";else if(c.includes(`; ${p}`))m=c.split(/\s*;\s*/).find(E=>E.trim().startsWith(p))??"";else continue;if(!O(m.trim()))return await a("git is read-only for agents. The user controls git. You may use `git log`, `git diff`, `git status`, `git show`, `git blame`."),o(void 0)}}return o(void 0)}let h=["Write","Edit","MultiEdit"];if(!h.includes(s))return o(void 0);let w=t.file_path??t.path??"";if(w.includes(".eser/")||w.includes(".claude/"))return o(void 0);let d=r.phase??"UNKNOWN";if(d==="EXECUTING"||d==="IDLE"||d==="FREE"||d==="COMPLETED"||d==="UNKNOWN"){if(d==="EXECUTING"&&h.includes(s)){let c=`${i}/${g.stateDir}/executor-warned.flag`;try{await n.fs.readTextFile(c)}catch{try{await n.fs.mkdir(`${i}/${g.stateDir}`,{recursive:!0}),await n.fs.writeTextFile(c,new Date().toISOString());let u=new TextEncoder,f=n.process.stderr.getWriter();await f.write(u.encode(`noskills: REMINDER \u2014 You should be spawning a noskills-executor sub-agent for implementation work. If you're the main orchestrator agent, delegate to a sub-agent instead of editing directly. If you ARE a sub-agent, ignore this message and continue.
2
- `)),f.releaseLock()}catch{}}}return o(void 0)}let y={DISCOVERY:`You are in DISCOVERY \u2014 this is a thinking phase, not an implementation phase. Read and discuss only. To write code, complete discovery and get the spec approved first. Run \`${k("next")}\` to continue.`,DISCOVERY_REVIEW:`You are in DISCOVERY_REVIEW \u2014 this is a thinking phase, not an implementation phase. Read and discuss only. To write code, complete discovery and get the spec approved first. Run \`${k('next --answer="approve"')}\` or revise answers.`,SPEC_DRAFT:`You are in SPEC_DRAFT \u2014 this is a thinking phase, not an implementation phase. Read and discuss only. To write code, approve the spec first. Run \`${k("approve")}\``,SPEC_APPROVED:`You are in SPEC_APPROVED \u2014 start execution first: \`${k('next --answer="start"')}\``,BLOCKED:`Execution blocked. Resolve with \`${k('next --answer="resolution"')}\``};return await a(y[d]??`Run \`${k("next")}\` first.`),o(void 0)},b=async()=>{let e=await S();if(e.stop_hook_active===!0)return o(void 0);let s=e.cwd??n.process.cwd(),t;try{let u=await n.fs.readTextFile(`${s}/${g.stateFile}`);t=JSON.parse(u)}catch{return o(void 0)}if(t.phase!=="EXECUTING")return o(void 0);let i=t.execution??{},l=`${s}/${g.stateDir}/files-changed.jsonl`,r=[];try{let f=(await n.fs.readTextFile(l)).trim().split(`
3
- `).filter(Boolean);r=[...new Set(f.map(p=>{try{return JSON.parse(p).file}catch{return null}}).filter(p=>p!==null))]}catch{}let a=[],h="no changes";try{let{execSync:u}=await import("node:child_process");a=u("git diff --name-only",{cwd:s,encoding:"utf-8",timeout:5e3}).trim().split(`
4
- `).filter(Boolean);let m=u("git diff --stat",{cwd:s,encoding:"utf-8",timeout:5e3}).trim().split(`
5
- `);h=m[m.length-1]??"no changes"}catch{}let w=[...new Set([...r,...a])],d=(i.iteration??0)+1,y=`${s}/${g.stateDir}/iterations`;try{await n.fs.mkdir(y,{recursive:!0}),await n.fs.writeTextFile(`${y}/iteration-${d}.json`,JSON.stringify({iteration:d,files:w,gitStat:h.trim(),timestamp:new Date().toISOString()},null,2)+`
6
- `)}catch{}let c=15;try{let u=await R(s);u!==null&&(c=u.maxIterationsBeforeRestart)}catch{}t.execution={...i,iteration:d,modifiedFiles:w,lastProgress:h.trim()||i.lastProgress||null},t.lastCalledAt=new Date().toISOString();try{await n.fs.writeTextFile(`${s}/${g.stateFile}`,JSON.stringify(t,null,2)+`
7
- `)}catch{}try{await n.fs.writeTextFile(l,"")}catch{}try{await n.fs.remove(`${s}/${g.stateDir}/executor-warned.flag`)}catch{}if(d>=c){let u=new TextEncoder,f=n.process.stderr.getWriter();await f.write(u.encode(`noskills: iteration ${d} reached threshold (${c}). Consider starting a fresh conversation.
8
- `)),f.releaseLock()}return o(void 0)},A=async()=>{let e=await S(),s=e.tool_input??{},t=s.file_path??s.path??"";if(!t||t.includes(".eser/")||t.includes(".claude/"))return o(void 0);let i=e.cwd??n.process.cwd(),l=`${i}/${g.stateDir}/files-changed.jsonl`,r=JSON.stringify({file:t,tool:e.tool_name,ts:new Date().toISOString()});try{await n.fs.mkdir(`${i}/${g.stateDir}`,{recursive:!0});let a="";try{a=await n.fs.readTextFile(l)}catch{}await n.fs.writeTextFile(l,a+r+`
9
- `)}catch{}return o(void 0)},_=async()=>{let e=await S(),t=(e.tool_input??{}).command??"";if(!t.includes("noskills"))return o(void 0);let i=e.cwd??n.process.cwd(),l=`${i}/${g.stateDir}/noskills-calls.jsonl`,r=JSON.stringify({command:t,ts:new Date().toISOString()});try{await n.fs.mkdir(`${i}/${g.stateDir}`,{recursive:!0});let a="";try{a=await n.fs.readTextFile(l)}catch{}await n.fs.writeTextFile(l,a+r+`
10
- `)}catch{}return o(void 0)},W=async()=>{let e=n.process.cwd();if(!await $(e))return o(void 0);let s=await x(e),t=await R(e),l=(await D(e)).filter(w=>t!==null&&t.concerns.includes(w.id)),r=await C(e),a=T(t?.tools??[]),h=v(s,l,r,t,void 0,void 0,void 0,a);return await I(h),o(void 0)};export{B as main};
@@ -1,8 +0,0 @@
1
- import{b as te}from"./chunk-VK7L5SMS.js";import{a as Y,b as z,c as K,d as V}from"./chunk-YYCDBPWA.js";import{a as j,b as M}from"./chunk-ZMVD5IU4.js";import"./chunk-MRZT23BL.js";import{a as Z,b as ee,d as w}from"./chunk-TJZAIUKM.js";import{a as ce}from"./chunk-SNHYXBHM.js";import{a as le,b as de,c as ue,d as pe}from"./chunk-3SLKOP72.js";import{a as O}from"./chunk-VPXOI7CR.js";import{c as T}from"./chunk-YK6UG66R.js";import{a as se,e as A,f as ne,g as ie,h as re,j as oe,l as ae}from"./chunk-TMC5H2A5.js";import{d as P,f as J,g as Q,k as _,l as G,p as B,r as $,s as X}from"./chunk-LWCWPXCS.js";import{a as q,b as x}from"./chunk-2N4GTHXQ.js";import{b as g}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var ge=a=>a.split(`
2
- `).map(e=>e.replace(/^[-*]\s+/,"").trim()).filter(e=>e.length>0&&!e.startsWith("#")),he=async(a,e)=>{let o=[],i=(e.startsWith(a)?e.slice(a.length+1):e).split("/");i.pop();for(let t=i.length;t>=0;t--){let n=`${t===0?a:`${a}/${i.slice(0,t).join("/")}`}/.folder-rules.md`,r=t===0?".":i.slice(0,t).join("/");try{let m=await g.fs.readTextFile(n),p=ge(m);for(let u of p)o.push({folder:r,rule:u})}catch{}}return o},W=async(a,e)=>{let o=new Set,c=[];for(let i of e){let t=await he(a,i);for(let s of t){let n=`${s.folder}::${s.rule}`;o.has(n)||(o.add(n),c.push(s))}}return c};var Ne=async a=>{let e=g.process.cwd(),o=Z(a),c=ee(a);if(!await X(e))return await w({error:`noskills not initialized. Run: ${T("init")}`},o),x({exitCode:1});let i=null;for(let l of c)l.startsWith("--answer=")&&(i=l.slice(9));let t=Q(c),s;try{s=await J(e,t)}catch(l){let d=l instanceof Error?l.message:String(l);return await w({error:d},o),x({exitCode:1})}if(t===null&&s.phase!=="IDLE"&&s.phase!=="FREE"&&s.phase!=="COMPLETED")return await w({error:"Error: --spec=<name> is required. Use `noskills spec list` to see available specs."},o),x({exitCode:1});let n=await G(e);if(n?.command!==void 0){let{setCommandPrefix:l}=await import("./cmd-RST2ZPA6.js");l(n.command)}if(n===null)return await w({error:"No config found"},o),x({exitCode:1});if(s.spec!==null&&s.phase!=="IDLE"&&s.phase!=="COMPLETED"){let l=`${e}/${P.specDir(s.spec)}`;try{await g.fs.stat(l)}catch{return await w({error:!0,message:`Active spec '${s.spec}' directory not found. Files may have been deleted manually.`,suggestion:`Run \`${T("reset")}\` to return to IDLE, or \`${T("cancel")}\` to mark as cancelled.`},o),x({exitCode:1})}}let r=te(c,n);s.phase==="DISCOVERY"&&s.discovery.audience!==r&&(s={...s,discovery:{...s.discovery,audience:r}});let p=(await B(e)).filter(l=>n.concerns.includes(l.id));if(i!==null){let l=await Se(e,s,n,p,i);await $(e,l);let d={...l,lastCalledAt:new Date().toISOString()};await $(e,d);let v=await j(e),C=d.spec!==null?await O(e,d.spec):null,L=await me(e,d),E=await W(e,L),k=M(n?.tools??[]),f=V(d,p,v,n,C,E,void 0,k);return await w(f,o),q(void 0)}let u={...s,lastCalledAt:new Date().toISOString()};await $(e,u);let S=await j(e),I=u.spec!==null?await O(e,u.spec):null,b=await me(e,u),D=await W(e,b),F;u.phase==="IDLE"&&(F={existingSpecs:(await _(e)).map(d=>({name:d.name,phase:d.state.phase,iteration:d.state.execution.iteration,detail:d.state.phase==="EXECUTING"?`${d.state.execution.completedTasks.length} tasks done, iteration ${d.state.execution.iteration}`:d.state.phase==="SPEC_DRAFT"?"awaiting approval":d.state.phase==="COMPLETED"?"completed":void 0})),rulesCount:S.length});let R=M(n?.tools??[]),H=V(u,p,S,n,I,D,F,R);return await w(H,o),q(void 0)},Se=async(a,e,o,c,i)=>{switch(e.phase){case"DISCOVERY":{let t=e.discovery.audience==="agent",s=null;try{let r=JSON.parse(i);typeof r=="object"&&r!==null&&!Array.isArray(r)&&(t?Y.map(u=>u.id).every(u=>u in r)&&(s=r):s=r)}catch{}let n=e;if(s!==null)for(let[r,m]of Object.entries(s))typeof m=="string"&&m.length>0&&(n=A(n,r,m));else{let r=z(c),m=n.discovery.currentQuestion,p=r[m];if(p===void 0)return e;n=A(n,p.id,i),n=re(n)}return K(n.discovery.answers)&&(n=ne(n)),n}case"DISCOVERY_REVIEW":{if(i.trim().toLowerCase()==="approve")return ie(e);try{let t=JSON.parse(i);if(typeof t.revise=="object"&&t.revise!==null){let s=e;for(let[n,r]of Object.entries(t.revise))typeof r=="string"&&r.length>0&&(s=A(s,n,r));return s}}catch{}return e}case"SPEC_DRAFT":{if(e.classification===null){let t,s=i.trim().toLowerCase();if(s==="none"||s==="skip")t={involvesWebUI:!1,involvesCLI:!1,involvesPublicAPI:!1,involvesMigration:!1,involvesDataHandling:!1};else try{let r=JSON.parse(i);t={involvesWebUI:r.involvesWebUI===!0||r.involvesUI===!0,involvesCLI:r.involvesCLI===!0||r.involvesUI===!0,involvesPublicAPI:r.involvesPublicAPI===!0,involvesMigration:r.involvesMigration===!0,involvesDataHandling:r.involvesDataHandling===!0}}catch{t={involvesWebUI:!1,involvesCLI:!1,involvesPublicAPI:!1,involvesMigration:!1,involvesDataHandling:!1}}let n={...e,classification:t};try{await ce(a,n,c)}catch{}return n}try{let t=JSON.parse(i);if(typeof t.refinement=="string"&&t.refinement.length>0){let s=t.refinement;if(e.spec!==null){let n=`${a}/${P.specFile(e.spec)}`,r=await g.fs.readTextFile(n);if(s.includes("task-")){let p=ve(s).map(I=>`- [ ] ${I}`).join(`
3
- `),u=/## Tasks\n\n([\s\S]*?)(?=\n## |\n*$)/,S=r.replace(u,`## Tasks
4
-
5
- ${p}
6
- `);await g.fs.writeTextFile(n,S)}}return e}}catch{}return e}case"SPEC_APPROVED":{let t=oe(e);return t.spec!==null&&(await le(a,t.spec,"executing"),await pe(a,t.spec,"executing")),t}case"EXECUTING":{if(!e.execution.awaitingStatusReport){let t={...e,execution:{...e.execution,lastProgress:i}};if(o.verifyCommand!==null&&o.verifyCommand!==void 0&&o.verifyCommand.length>0){let s=await xe(a,o.verifyCommand);if(t={...t,execution:{...t.execution,lastVerification:s}},!s.passed)return t}return t={...t,execution:{...t.execution,awaitingStatusReport:!0}},t}return await ye(a,e,i,c)}case"BLOCKED":{let t=e.execution.lastProgress??"Unknown",s={id:`d${e.decisions.length+1}`,question:t.replace(/^BLOCKED:\s*/,""),choice:i,promoted:!1,timestamp:new Date().toISOString()},n=ae(e,s);return n=se(n,"EXECUTING"),n={...n,execution:{...n.execution,lastProgress:`Resolved: ${i}`}},n}default:return e}},ve=a=>a.split(/(?=task-\d+:)/).map(e=>e.replace(/[,;\n\s]+$/,"").trim()).filter(e=>/^task-\d+:/.test(e)),ye=async(a,e,o,c)=>{let i;try{i=JSON.parse(o)}catch{return{...e,execution:{...e.execution,lastProgress:o,awaitingStatusReport:!1}}}let t=e;if(e.execution.debt!==null&&e.execution.debt.items.length>0&&typeof e.execution.debt.items[0]=="string"){let y=e.execution.debt.items.map((N,fe)=>({id:`legacy-${fe+1}`,text:N,since:e.execution.debt.fromIteration}));t={...e,execution:{...e.execution,debt:{...e.execution.debt,items:y}}};let U=new TextEncoder,h=g.process.stderr.getWriter();await h.write(U.encode(`noskills: migrated legacy string[] debt to DebtItem[] format
7
- `)),h.releaseLock()}let s=i.completed??[],n=new Set(s),r=i.na??[],m=new Set(r),p=i.newIssues??[],u=i.remaining??[],S=i.blocked??[],I=t.execution.debt?.unaddressedIterations??0,b=t.execution.debt!==null?t.execution.debt.items.filter(f=>!n.has(f.id)&&!m.has(f.id)):[],D=t.execution.debtCounter??0,F=p.map((f,y)=>({id:`debt-${D+y+1}`,text:f,since:t.execution.iteration})),R=[...b,...F],l=u.length===0&&S.length===0&&p.length===0||R.length===0?null:{items:R,fromIteration:t.execution.debt?.fromIteration??t.execution.iteration,unaddressedIterations:b.length>0?I+1:1},d=[...new Set([...t.execution.naItems??[],...r])],v=[];s.length>0&&v.push(`Completed: ${s.join(", ")}`),r.length>0&&v.push(`N/A: ${r.join(", ")}`);let C=v.length>0?v.join("; "):"Status report submitted",L=t.execution.lastVerification===null||t.execution.lastVerification.passed===!0,E=l===null&&L,k=D+p.length;if(E&&t.spec!==null){let f=await O(a,t.spec);if(f!==null){let y=t.execution.completedTasks??[],U=new Set(y),h=f.tasks.find(N=>!U.has(N.id));if(h!==void 0)return await de(a,t.spec,h.id),await ue(a,t.spec,h.id,"done"),{...t,execution:{...t.execution,lastProgress:`Task ${h.id} accepted: ${C}`,awaitingStatusReport:!1,debt:l,completedTasks:[...y,h.id],debtCounter:k,naItems:d}}}}return{...t,execution:{...t.execution,lastProgress:E?C:`Task not accepted \u2014 remaining items must be addressed first. ${C}`,awaitingStatusReport:!1,debt:l,debtCounter:k,naItems:d}}},xe=async(a,e)=>{try{let{execSync:o}=await import("node:child_process"),c=o(e,{cwd:a,encoding:"utf-8",timeout:6e4,stdio:["pipe","pipe","pipe"]});return{passed:!0,output:String(c).slice(0,4e3),timestamp:new Date().toISOString()}}catch(o){let c=o,i=((c.stdout??"")+(c.stderr??"")).slice(0,4e3);return c.status!==void 0?{passed:!1,output:i||"Verification failed with no output",timestamp:new Date().toISOString()}:{passed:!1,output:`Verification command failed to execute: ${o instanceof Error?o.message:String(o)}`,timestamp:new Date().toISOString()}}},me=async(a,e)=>{let o=[...e.execution.modifiedFiles??[]],c=await Ie(a);return[...new Set([...o,...c])]},Ie=async a=>{let e=`${a}/${P.stateDir}/files-changed.jsonl`;try{let c=(await g.fs.readTextFile(e)).trim().split(`
8
- `).filter(Boolean),i=[];for(let t of c)try{let s=JSON.parse(t);i.includes(s.file)||i.push(s.file)}catch{}return i}catch{return[]}};export{Se as handleAnswer,Ne as main,ve as parseRefinementTasks};
@@ -1,3 +0,0 @@
1
- import{a as D,b as A,d as F}from"./chunk-73EEM3FY.js";import{d as B}from"./chunk-YYCDBPWA.js";import{a as W,b as X}from"./chunk-ZMVD5IU4.js";import"./chunk-MRZT23BL.js";import{b as E,c as V}from"./chunk-YK6UG66R.js";import{a as _,j}from"./chunk-TMC5H2A5.js";import{e as g,f as N,g as U,i as $,l as G,p as L,s as M}from"./chunk-LWCWPXCS.js";import{c as v,d as o,f as l,g as P,h,k as I,o as R,q as O,r as T}from"./chunk-Y6AFIAJP.js";import{a as S,b as w}from"./chunk-2N4GTHXQ.js";import{b as y}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var ue=async t=>{let e=R({renderer:T.ansi(),sink:O.stdout()}),i=y.process.cwd(),n=t?.includes("--unattended")??!1,r=z(t,"--max-turns")??10,p=z(t,"--max-iterations")??50;if(!await M(i))return e.writeln(l(`noskills not initialized. Run: ${V("init")}`)),await e.close(),w({exitCode:1});let x=U(t),c=await N(i,x);if(c.phase!=="EXECUTING"&&c.phase!=="SPEC_APPROVED")return e.writeln(l(`Cannot run from phase: ${c.phase}`)),e.writeln(o("Must be in SPEC_APPROVED or EXECUTING to start.")),await e.close(),w({exitCode:1});if(c.phase==="SPEC_APPROVED"){e.writeln(o("Starting execution from approved spec..."));let s=j(c);await $(i,s)}let u=await G(i);if(u===null)return e.writeln(l("Config not found.")),await e.close(),w({exitCode:1});e.writeln(v(`${E()} run`)),e.writeln(o(`Mode: ${n?"unattended":"interactive"}, max-turns: ${r}, max-iterations: ${p}`)),e.writeln("");let m=0,d=0;for(;m<p;){m++;let s=await g(i);if(s.phase==="COMPLETED"){e.writeln(""),e.writeln(P("\u2714")," Spec completed!"),e.writeln(` Iterations: ${s.execution.iteration}`),e.writeln(` Decisions: ${s.decisions.length}`);break}if(s.phase==="BLOCKED"){let a=s.execution.lastProgress??"Unknown";if(e.writeln(""),e.writeln(h("\u26A0")," Execution blocked: ",o(a)),n){await Z(i,a,m),e.writeln(o("Logged to .eser/.state/blocked.log. Resolve and re-run.")),d=1;break}let C=A(),f=await F(C,{message:"Enter resolution (or leave empty to stop):"});if(D(f)||f===""){e.writeln(o("Stopped by user."));break}let k=_(s,"EXECUTING");await $(i,{...k,execution:{...k.execution,lastProgress:`Resolved: ${f}`}});continue}if(s.phase!=="EXECUTING"){e.writeln(l(`Unexpected phase: ${s.phase}. Stopping.`)),d=1;break}let H=(await L(i)).filter(a=>u.concerns.includes(a.id)),q=await W(i),K=X(u.tools),J=B(s,H,q,u,void 0,void 0,void 0,K),Q=Y(J);e.writeln(I(`\u2500\u2500 Iteration ${m}`),o(` (execution: ${s.execution.iteration}, debt: ${s.execution.debt?.items.length??0})`)),s.execution.lastProgress!==null&&e.writeln(o(` Last: ${s.execution.lastProgress}`)),s.execution.lastVerification?.passed===!1&&e.writeln(l(" Verification failed \u2014 agent will fix")),s.execution.debt!==null&&e.writeln(h(` Debt: ${s.execution.debt.items.length} items`)),e.writeln(o(" Spawning agent..."));try{await(await import("./mod-KTV64DHD.js")).exec`claude -p ${Q} --max-turns ${String(r)} --output-format json`.noThrow().text()}catch{e.writeln(l(" Failed to spawn claude CLI. Is it installed?")),d=1;break}e.writeln(o(" Agent exited. Stop hook captured state."));let b=await g(i);if(u.autoCommit===!0&&u.allowGit!==!1)try{let a=await import("./mod-KTV64DHD.js");if((await a.exec`git diff --name-only`.noThrow().text()).trim().length>0){await a.exec`git add -A`.noThrow().text();let f=`noskills: iteration ${b.execution.iteration} \u2014 ${b.execution.lastProgress??"progress"}`;await a.exec`git commit -m ${f}`.noThrow().text(),e.writeln(o(" Auto-committed."))}}catch{e.writeln(o(" Auto-commit failed (non-fatal)."))}}return m>=p&&(e.writeln(""),e.writeln(h("\u26A0"),` Max iterations (${p}) reached. Stopping.`),d=2),await e.close(),d!==0?w({exitCode:d}):S(void 0)},Y=t=>{let e=[];if(e.push(t.meta.resumeHint),e.push(""),t.meta.spec!==null&&(e.push(`Working on spec: ${t.meta.spec}`),e.push("")),"instruction"in t&&(e.push(t.instruction),e.push("")),"previousIterationDebt"in t){let n=t.previousIterationDebt;if(n!==void 0){e.push(`DEBT from iteration ${n.fromIteration} (address first):`);for(let r of n.items)e.push(`- ${r}`);e.push("")}}if("statusReportRequired"in t){let n=t.statusReport;if(n!==void 0){e.push("Report against these acceptance criteria:");for(let r of n.criteria)e.push(`- ${r}`);e.push("")}}if("verificationFailed"in t&&t.verificationFailed===!0&&(e.push("Test output:"),e.push(("verificationOutput"in t?t.verificationOutput:"")??""),e.push("")),t.behavioral.rules.length>0){e.push("Rules:");for(let n of t.behavioral.rules)e.push(`- ${n}`);e.push("")}if("context"in t){let n=t.context;if(n.concernReminders.length>0){e.push("Reminders:");for(let r of n.concernReminders)e.push(`- ${r}`);e.push("")}}let i=E();return e.push(`When done, report progress: ${i} next --answer="your progress"`),e.push(`If blocked, run: ${i} block "reason"`),e.push(`When all tasks are complete: ${i} done`),e.join(`
2
- `)},z=(t,e)=>{if(t===void 0)return null;let i=`${e}=`;for(let n of t)if(n.startsWith(i)){let r=parseInt(n.slice(i.length),10);if(!isNaN(r)&&r>0)return r}return null},Z=async(t,e,i)=>{let n=`${t}/.eser/.state/blocked.log`,r=`[${new Date().toISOString()}] iteration=${i} reason=${e}
3
- `;try{let{appendFileSync:p,mkdirSync:x}=await import("node:fs"),{dirname:c}=await import("node:path");x(c(n),{recursive:!0}),p(n,r)}catch{}};export{ue as main};
@@ -1 +0,0 @@
1
- import{a as N,d as P}from"./chunk-TJZAIUKM.js";import{b as f,c as C}from"./chunk-YK6UG66R.js";import{b as A}from"./chunk-TMC5H2A5.js";import{a as z,d as u,j as R,k as v,s as I}from"./chunk-LWCWPXCS.js";import{c as o,d as r,f as l,g as b,h as k,k as D,o as g,q as y,r as $}from"./chunk-Y6AFIAJP.js";import{a as d,b as c}from"./chunk-2N4GTHXQ.js";import{b as m}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var F=async n=>{let s=n?.[0];if(s==="new")return await L(n?.slice(1));if(s==="list")return await M(n?.slice(1));let a=f(),e=g({renderer:$.ansi(),sink:y.stdout()});return e.writeln(`Usage: ${a} spec <new --name=<slug> "description" | list>`),await e.close(),d(void 0)},L=async n=>{let s=g({renderer:$.ansi(),sink:y.stdout()}),a=m.process.cwd();if(!await I(a))return s.writeln(l("noskills is not initialized.")," Run: ",o(C("init"))),await s.close(),c({exitCode:1});let e=null,h=[];if(n!==void 0)for(let w of n)w.startsWith("--name=")?e=w.slice(7):w.startsWith("-")||h.push(w);let S=h.join(" ");if(e===null||e.length===0)return s.writeln(l("Error: --name is required.")),s.writeln(r("Example: "),o(`${f()} spec new --name=photo-upload "photo upload feature"`)),await s.close(),c({exitCode:1});let p=/^[a-z0-9][a-z0-9-]*[a-z0-9]$/;if(e.length>50||e.length>1&&!p.test(e)||e.length===1&&!/^[a-z0-9]$/.test(e))return s.writeln(l("Invalid spec name: "),o(e)),s.writeln(r("Must be lowercase, hyphens, numbers only. Max 50 chars. Regex: /^[a-z0-9][a-z0-9-]*[a-z0-9]$/")),await s.close(),c({exitCode:1});if(S.length===0)return s.writeln(l("Please provide a description: "),o(`${f()} spec new --name=${e} "photo upload feature"`)),await s.close(),c({exitCode:1});let i=`spec/${e}`,t=`${a}/${u.specDir(e)}`;try{return await m.fs.stat(t),s.writeln(l(`Spec "${e}" already exists.`),r(` Use a different --name or run \`${f()} reset --spec=${e}\` first.`)),await s.close(),c({exitCode:1})}catch{}let x=z(),E=A(x,e,i);return await m.fs.mkdir(`${a}/${u.specDir(e)}`,{recursive:!0}),await R(a,e,E),s.writeln(b("\u2714")," Spec started: ",o(e)),s.writeln(" Directory: ",r(u.specDir(e))),s.writeln(" Branch: ",r(i)),s.writeln(" Phase: ",k("DISCOVERY")),s.writeln(""),s.writeln("Run ",o(C(`next --spec=${e}`))," to begin discovery questions."),await s.close(),d(void 0)},M=async n=>{let s=m.process.cwd(),a=N(n),e=await v(s),h=`${s}/${u.specsDir}`,S=new Set(e.map(t=>t.name)),p=[];for(let t of e)p.push({name:t.name,phase:t.state.phase,iteration:t.state.execution.iteration});try{for await(let t of m.fs.readDir(h))t.isDirectory&&!S.has(t.name)&&p.push({name:t.name,phase:"IDLE",iteration:0})}catch{}if(a==="json")return await P(p,"json"),d(void 0);let i=g({renderer:$.ansi(),sink:y.stdout()});if(i.writeln(o("Specs")),i.writeln(""),p.length===0)i.writeln(r(" No specs yet."));else for(let t of p){let x=t.phase==="COMPLETED"?b(t.phase):t.phase==="EXECUTING"?D(t.phase):t.phase==="BLOCKED"?l(t.phase):k(t.phase),E=t.phase==="EXECUTING"?r(` iteration ${t.iteration}`):"";i.writeln(" ",r("\u25CB")," ",t.name," ",x,E)}return await i.close(),d(void 0)};export{F as main};
@@ -1 +0,0 @@
1
- import{a as f,d as P}from"./chunk-YYCDBPWA.js";import{a as R,b as S}from"./chunk-ZMVD5IU4.js";import"./chunk-MRZT23BL.js";import{a as k,d as w}from"./chunk-TJZAIUKM.js";import{c as h}from"./chunk-YK6UG66R.js";import{f as b,g as x,l as D,p as v,s as O}from"./chunk-LWCWPXCS.js";import{c as i,d as r,f as c,g as y,h as p,k as I,o as d,q as u,r as m}from"./chunk-Y6AFIAJP.js";import{a as l,b as E}from"./chunk-2N4GTHXQ.js";import{b as C}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var W=async g=>{let t=C.process.cwd(),o=k(g);if(!await O(t)){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=x(g),e=await b(t,V),n=await D(t),T={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:n?.concerns??[],tools:n?.tools??[],decisions:e.decisions.length};if(o==="json"){let a=(await v(t)).filter(N=>n!==null&&n.concerns.includes(N.id)),$=await R(t),j=S(n?.tools??[]),F=P(e,a,$,n,void 0,void 0,void 0,j);return await w({...T,...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"?y(e.phase):e.phase==="BLOCKED"?c(e.phase):e.phase==="EXECUTING"?I(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`))),n!==null&&(s.writeln(""),n.concerns.length>0&&s.writeln(" Concerns: ",r(n.concerns.join(", "))),n.tools.length>0&&s.writeln(" Tools: ",r(n.tools.join(", ")))),e.decisions.length>0&&(s.writeln(""),s.writeln(` Decisions: ${e.decisions.length}`)),await s.close()}return l(void 0)};export{W as main};
@@ -1 +0,0 @@
1
- import{a as A,d as D}from"./chunk-3SLKOP72.js";import{m as y}from"./chunk-TMC5H2A5.js";import{d as x,f as S,h as g,i as k,j as C}from"./chunk-LWCWPXCS.js";import{d as u,f as n,g as f,o as d,q as w,r as h}from"./chunk-Y6AFIAJP.js";import{a as m,b as i}from"./chunk-2N4GTHXQ.js";import{b as c}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import"./chunk-OTRBRRIO.js";var F=async l=>{let e=d({renderer:h.ansi(),sink:w.stdout()}),a=c.process.cwd(),o=g(l);if(!o.ok)return e.writeln(n(o.error)),await e.close(),i({exitCode:1});let p=(l??[]).filter(r=>!r.startsWith("--spec=")).join(" ");if(p.length===0)return e.writeln(n('A reason is required: noskills wontfix "reason text"')),await e.close(),i({exitCode:1});let s;try{s=await S(a,o.spec)}catch(r){let E=r instanceof Error?r.message:String(r);return e.writeln(n(E)),await e.close(),i({exitCode:1})}if(s.phase==="IDLE"||s.phase==="UNINITIALIZED"||s.phase==="COMPLETED")return e.writeln(n(`Cannot mark as won't fix in phase: ${s.phase}`)),await e.close(),i({exitCode:1});if(s.spec!==null){let r=`${a}/${x.specDir(s.spec)}`;try{await c.fs.stat(r)}catch{return e.writeln(n(`Active spec '${s.spec}' directory not found.`)),e.writeln(u("Run `noskills reset` to return to IDLE.")),await e.close(),i({exitCode:1})}}let t=y(s,"wontfix",p);return await k(a,t),t.spec!==null&&await C(a,t.spec,t),t.spec!==null&&(await A(a,t.spec,"wontfix"),await D(a,t.spec,"wontfix")),e.writeln(f("\u2714"),` Spec marked as won't fix: ${p}`),await e.close(),m(void 0)};export{F as main};