noskills 4.1.43 → 4.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +173 -76
  2. package/chunks/{approve-NPG6X7O6.js → approve-D5AONTPF.js} +1 -1
  3. package/chunks/{ask-F4XM2EEC.js → ask-SWMI6GK2.js} +1 -1
  4. package/chunks/{block-LSEXCK45.js → block-MW7CCPRS.js} +1 -1
  5. package/chunks/cancel-3JUX5SPS.js +1 -0
  6. package/chunks/{chunk-3SLKOP72.js → chunk-6FTHIS2Z.js} +1 -1
  7. package/chunks/chunk-7UX6WIXX.js +1 -0
  8. package/chunks/chunk-FEHZCASN.js +3 -0
  9. package/chunks/chunk-FJCXMC2D.js +1 -0
  10. package/chunks/chunk-IZ4J7VRF.js +1 -0
  11. package/chunks/{chunk-ZMVD5IU4.js → chunk-OV7ZXBXC.js} +28 -27
  12. package/chunks/chunk-QMZBEPES.js +16 -0
  13. package/chunks/{chunk-LWCWPXCS.js → chunk-QYMX2GR3.js} +86 -83
  14. package/chunks/chunk-RBLZTQ64.js +3 -0
  15. package/chunks/{chunk-ERX4HONR.js → chunk-TIGKFDKY.js} +1 -1
  16. package/chunks/{chunk-7QFOEK3I.js → chunk-XRKWQJMC.js} +1 -1
  17. package/chunks/{chunk-ALZM4JXG.js → chunk-XYJXQHQN.js} +1 -1
  18. package/chunks/{claude-code-K3SX5D5F.js → claude-code-FZXKRWA5.js} +1 -1
  19. package/chunks/{concern-3K3QUYG4.js → concern-XME2LKJJ.js} +1 -1
  20. package/chunks/{done-OMGLEA32.js → done-5FR2OAXK.js} +1 -1
  21. package/chunks/{free-BO5UA5V2.js → free-KPB37MR3.js} +1 -1
  22. package/chunks/init-HIQXEJDS.js +1 -0
  23. package/chunks/invoke-hook-NXZYKSHD.js +11 -0
  24. package/chunks/{kiro-T5X4D4SC.js → kiro-AC5LYTVB.js} +1 -1
  25. package/chunks/{list-3RK7TPGG.js → list-B5YTFNLR.js} +1 -1
  26. package/chunks/manager-OOJQ6WXI.js +6 -0
  27. package/chunks/mod-RW5J2N5Q.js +1 -0
  28. package/chunks/next-SP7JFPGS.js +8 -0
  29. package/chunks/{ollama-CNKKUTPX.js → ollama-TM4MMP7N.js} +1 -1
  30. package/chunks/{opencode-MJO3K6T4.js → opencode-YGNBYWQL.js} +1 -1
  31. package/chunks/{purge-MDSEQLDQ.js → purge-OAHH3MCY.js} +1 -1
  32. package/chunks/{reopen-EKSLLO54.js → reopen-H6WXM2OQ.js} +1 -1
  33. package/chunks/{reset-WRTVX7TT.js → reset-O4WA2VGI.js} +1 -1
  34. package/chunks/rule-IHME5I6Q.js +6 -0
  35. package/chunks/run-7OEMPUFO.js +3 -0
  36. package/chunks/session-NSWI2Q3S.js +1 -0
  37. package/chunks/spec-2FKI55EV.js +1 -0
  38. package/chunks/status-MOMQ2FRD.js +1 -0
  39. package/chunks/{sync-VS4HROEX.js → sync-YI7WLQP2.js} +1 -1
  40. package/chunks/{watch-4HJMGNF4.js → watch-GMTD4676.js} +1 -1
  41. package/chunks/wontfix-2AKBA54I.js +1 -0
  42. package/noskills.js +1 -1
  43. package/package.json +1 -1
  44. package/chunks/cancel-7NGO246Z.js +0 -1
  45. package/chunks/chunk-73EEM3FY.js +0 -1
  46. package/chunks/chunk-BBKSV2RO.js +0 -3
  47. package/chunks/chunk-SNHYXBHM.js +0 -3
  48. package/chunks/chunk-TMC5H2A5.js +0 -1
  49. package/chunks/chunk-YYCDBPWA.js +0 -16
  50. package/chunks/init-UQLVVP2M.js +0 -1
  51. package/chunks/invoke-hook-THWB24OS.js +0 -10
  52. package/chunks/mod-KTV64DHD.js +0 -1
  53. package/chunks/next-4IJJBQBE.js +0 -8
  54. package/chunks/rule-QP5BSH27.js +0 -2
  55. package/chunks/run-ROKOTYPH.js +0 -3
  56. package/chunks/spec-ZLE74TVR.js +0 -1
  57. package/chunks/status-S2X4ADGF.js +0 -1
  58. package/chunks/wontfix-CDPG2GUG.js +0 -1
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
@@ -128,6 +128,32 @@ builders get a structured workflow that keeps the agent focused. Teams get a
128
128
  shared source of truth that every tool and every teammate inherits
129
129
  automatically.
130
130
 
131
+ ## How noskills differs
132
+
133
+ | | Sequential Thinking | gstack | Skills / Rules | Ralph Loops | noskills |
134
+ | ------------------------- | ----------------------------------------- | ------------------------------------------------ | --------------------------------- | ---------------------------------------- | ------------------------------------------ |
135
+ | What it does | Structures agent's internal thinking | Role-based slash commands (CEO, Eng, QA) | Loads rules into context | Resets session, keeps state in files | Manages workflow via state machine |
136
+ | Metaphor | "Think out loud" | "Virtual team" | "Law book" | "Clean desk every turn" | "Scrum Master" |
137
+ | User role | None — agent self-talks | Chooses which role to invoke | Writes rules, hopes agent follows | Manages context manually | Active decision-maker at every gate |
138
+ | Enforcement | None | None — behavioral | None — behavioral | Context reset only | Mechanical (hooks block actions) |
139
+ | State tracking | Thought history (in-memory) | Learnings (cross-session) | None | File-based (manual) | Full state machine, per-spec |
140
+ | File control | None | None | None | None | Phase-based edit control |
141
+ | Sub-agents | None | None (single agent, multiple roles) | None | None | Executor / verifier / test-writer pipeline |
142
+ | Discovery | None | /office-hours (similar concept) | None | None | 6 structured questions + concerns |
143
+ | Works alongside noskills? | Yes — ST for thinking, noskills for doing | Yes — gstack for roles, noskills for enforcement | Replaced by noskills | Automated by noskills sub-agent pipeline | — |
144
+
145
+ **The core difference:** other tools tell the agent what to do and hope it
146
+ listens. noskills mechanically restricts what the agent _can_ do. When the agent
147
+ is in DISCOVERY, it literally cannot edit files — not because a rule says
148
+ "don't" but because a hook blocks the operation. That is the difference between
149
+ behavioral guidance and mechanical enforcement.
150
+
151
+ noskills is not a replacement for any of these tools. Sequential Thinking helps
152
+ agents reason better. gstack assigns useful roles. Both can run alongside
153
+ noskills. The distinction is that noskills owns the workflow — who does what,
154
+ when, and whether the result was verified — while the others own the thinking or
155
+ the persona.
156
+
131
157
  ## The Mental Model
132
158
 
133
159
  ```
@@ -160,6 +186,31 @@ emerge. If you want to discover those limits together, jump on board.
160
186
  The name mirrors the SQL -> NoSQL shift: skills define everything upfront,
161
187
  noskills determines what's needed at runtime.
162
188
 
189
+ ### The Scrum analogy
190
+
191
+ If you know Agile, you already know noskills:
192
+
193
+ | Agile / Scrum | noskills |
194
+ | ------------------ | --------------------------------------------- |
195
+ | User Story | Spec |
196
+ | Increment | Spec's deliverable |
197
+ | Refinement meeting | Discovery (6 questions + concerns) |
198
+ | Sprint Planning | Spec draft → approval (tasks defined) |
199
+ | Sprint | Execution (runs until spec is done) |
200
+ | Dev team | Sub-agents (executor, verifier, test-writer) |
201
+ | Scrum Master | noskills (state machine, hooks, backpressure) |
202
+ | Definition of Done | Acceptance criteria |
203
+ | Sprint Review | AC status report + verifier validation |
204
+ | Retrospective | Debt tracking + concern reminders |
205
+ | Product Owner | You (every decision is yours) |
206
+
207
+ One key difference: in Scrum, a sprint is time-boxed. In noskills, execution
208
+ runs until the spec is complete — it is a single-story sprint. This is why
209
+ mid-execution checkpoints make no sense: a Scrum Master does not stop a sprint
210
+ halfway through the only story. If the story is too big, you split it _before_
211
+ the sprint starts — not during. That is exactly what noskills does at
212
+ DISCOVERY_REVIEW with the split proposal.
213
+
163
214
  ## Philosophy — A Scrum Master for Agents
164
215
 
165
216
  I used to teach Agile. In those trainings, I'd go all the way back to the Toyota
@@ -218,36 +269,41 @@ for human teams apply directly to AI agents — because the underlying problem i
218
269
  the same: finite attention, drifting focus, and the need for structure to keep
219
270
  work on track.
220
271
 
221
- ## Getting Started with Claude Code
272
+ ## Getting Started
222
273
 
223
- Open Claude Code and paste:
274
+ noskills supports multiple AI coding platforms. Pick yours:
224
275
 
225
- Run `eser noskills init` — it will scaffold your project and guide you through setup.
276
+ ### Claude Code
226
277
 
227
- If `eser` CLI is not installed:
278
+ Open Claude Code and paste:
228
279
 
229
280
  Run `npx eser@latest noskills init` — it will scaffold your project and guide you through setup.
230
281
 
231
- That's it. The init command detects Claude Code, sets up hooks, instructions,
232
- and agent helpers automatically.
282
+ That's it. The init command detects Claude Code, sets up hooks, generates
283
+ `CLAUDE.md`, and presents your next options automatically.
233
284
 
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.
285
+ ### OpenCode / OpenAI Codex CLI / GitHub Copilot CLI / Kiro
236
286
 
237
- ## Getting Started with Kiro
287
+ Open your agent in your project and run in the terminal:
238
288
 
239
- Open a Kiro session and paste:
289
+ Run `npx eser@latest noskills init` — it will scaffold your project and guide you through setup.
240
290
 
241
- Run `eser noskills init` it will scaffold your project and guide you through setup.
291
+ noskills detects your agent, generates multi-file steering files (with `always`,
292
+ `auto`, and `fileMatch` inclusion modes), installs hook configs, and creates
293
+ executor/verifier agents.
242
294
 
243
- If `eser` CLI is not installed:
295
+ ### Other agents
244
296
 
245
- Run `npx eser@latest noskills init` it will scaffold your project and guide you through setup.
297
+ noskills generates a generic `AGENTS.md` at the project root. Any agent that
298
+ reads instruction files can use it. Run `noskills sync` after adding rules to
299
+ regenerate all tool files.
246
300
 
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.
301
+ ### Adding to an existing team project
302
+
303
+ If teammates already use noskills, the `.eser/` directory should be committed to
304
+ your repo. Run `noskills init` to detect your tool and generate tool-specific
305
+ files. The init command won't overwrite existing `.eser/` config — it only
306
+ generates the sync output for your tool.
251
307
 
252
308
  ## Quick Start
253
309
 
@@ -269,9 +325,9 @@ eser noskills free # FREE mode — no enforcement
269
325
  eser noskills free --exit # Back to IDLE
270
326
  ```
271
327
 
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.
328
+ After `init`, your AGENTS.md (or CLAUDE.md, .cursorrules, etc.) tells the agent
329
+ to call `noskills next` at every step. The agent follows the JSON output. You
330
+ never need to prompt-engineer the agent's behavior — noskills handles that.
275
331
 
276
332
  ### Without an agent (agentless CLI mode)
277
333
 
@@ -483,12 +539,30 @@ rules. These tell the agent HOW to behave, not just WHAT to do:
483
539
  **Git is read-only** for agents (configurable via `allowGit: true` in manifest).
484
540
  Agents may read (`git log`, `git diff`, `git status`) but never write
485
541
  (`git commit`, `git push`, `git checkout`). This is enforced at three levels:
486
- behavioral rules, CLAUDE.md instruction, and PreToolUse hook.
542
+ behavioral rules, AGENTS.md instruction, and PreToolUse hook.
487
543
 
488
544
  When the agent's iteration count exceeds `maxIterationsBeforeRestart` (default
489
545
  15), an `urgency` message warns that context is degrading and recommends a fresh
490
546
  session.
491
547
 
548
+ ### Platform Support
549
+
550
+ | Platform | Rules | Hooks | Agents | MCP | Enforcement |
551
+ | ----------- | -------------- | ----------- | ----------- | --- | --------------- |
552
+ | Claude Code | CLAUDE.md | full | Task tool | yes | Mechanical |
553
+ | Kiro | steering/ | Run Command | delegation | yes | Mechanical |
554
+ | Codex CLI | AGENTS.md | full | spawn_agent | yes | Mechanical |
555
+ | Copilot CLI | AGENTS.md | full | /fleet | yes | Mechanical |
556
+ | OpenCode | AGENTS.md | plugins | delegation | yes | Mechanical |
557
+ | Cursor | .cursorrules | none | none | yes | Behavioral only |
558
+ | Windsurf | .windsurfrules | none | none | yes | Behavioral only |
559
+
560
+ Platforms with **mechanical enforcement** use hooks to prevent unauthorized file
561
+ edits, block git write commands, and enforce phase transitions. Platforms with
562
+ **behavioral-only enforcement** rely on rules and instructions — the agent is
563
+ asked to follow the protocol but cannot be mechanically prevented from breaking
564
+ it.
565
+
492
566
  **Convention discovery:** When the agent identifies a recurring pattern,
493
567
  receives a correction from the user, or discovers a preference during work, the
494
568
  behavioral rules instruct it to ask: _"Should this be a permanent rule for this
@@ -583,7 +657,7 @@ In monorepos, different packages have different constraints. Drop a
583
657
  `.folder-rules.md` in any directory with markdown bullet rules:
584
658
 
585
659
  ```markdown
586
- - Generated CLAUDE.md must preserve existing content outside noskills:start/end
660
+ - Generated AGENTS.md must preserve existing content outside noskills:start/end
587
661
  markers
588
662
  - All command references must use dynamic noskillsCmd prefix
589
663
  - Sync output must be idempotent
@@ -618,6 +692,11 @@ Six questions, each probing product + engineering + QA at once:
618
692
  Active concerns inject sub-questions. For example, with `open-source` active,
619
693
  question 1 also asks: _"Is this workaround common in the community?"_
620
694
 
695
+ For larger specs, noskills may propose splitting the work into separate specs at
696
+ the end of discovery — for example, separating a bug fix from a feature
697
+ addition. You always decide: keep as one spec or split. noskills never splits on
698
+ its own.
699
+
621
700
  ### Spec Classification
622
701
 
623
702
  After discovery answers are submitted, noskills asks the user to classify the
@@ -680,34 +759,40 @@ noskills generates instruction files for every AI tool your team uses:
680
759
  ```
681
760
  .eser/ (single source of truth)
682
761
  +-- 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)
762
+ | Claude Code
763
+ |-- -> CLAUDE.md (instructions)
764
+ |-- -> AGENTS.md (shared: Codex / Copilot / OpenCode)
765
+ |-- -> .claude/settings.json (hooks)
766
+ |-- -> .claude/agents/ (agents)
767
+ | Kiro
768
+ |-- -> .kiro/steering/*.md (steering files)
769
+ |-- -> .kiro/settings/hooks.json (hooks)
770
+ |-- -> .kiro/settings/mcp.json (MCP)
771
+ |-- -> .kiro/agents/*.json (agents)
772
+ |-- -> .kiro/specs/ (spec projection)
773
+ | Codex CLI
774
+ |-- -> .codex/hooks.json (hooks)
775
+ |-- -> .codex/agents/*.toml (agents)
776
+ |-- -> .codex/config.toml (MCP)
777
+ | Copilot CLI
778
+ |-- -> .github/hooks/noskills.json (hooks)
779
+ |-- -> .github/agents/*.agent.md (agents)
780
+ |-- -> .github/copilot-instructions.md (IDE instructions)
781
+ |-- -> .copilot/mcp.json (MCP)
782
+ | OpenCode
783
+ |-- -> .opencode/plugins/noskills.ts (hooks)
784
+ |-- -> .opencode/agents/*.md (agents)
785
+ |-- -> .opencode/skills/*.md (spec projection)
786
+ |-- -> opencode.json (MCP)
787
+ | Cursor / Windsurf / Copilot IDE
788
+ |-- -> .cursorrules (Cursor)
789
+ +-- -> .windsurfrules (Windsurf)
705
790
  ```
706
791
 
707
792
  Write your rules once in `.eser/rules/`, run `noskills sync`, and every tool
708
793
  gets the same instructions in its native format.
709
794
 
710
- Generated CLAUDE.md includes:
795
+ Generated AGENTS.md includes:
711
796
 
712
797
  - Protocol instructions with 5 concrete trigger points
713
798
  - Git read-only section (unless `allowGit: true`)
@@ -803,28 +888,29 @@ eser nos <command>
803
888
 
804
889
  ### Commands
805
890
 
806
- | Command | Description |
807
- | ------------------------------------------ | ------------------------------------------------------------------ |
808
- | `init` | Scaffold `.eser/`, detect project traits, install hooks |
809
- | `status [-o format]` | Show current phase, spec name, progress, debt |
810
- | `spec new "..." [--name=N]` | Start a new spec, enter DISCOVERY |
811
- | `spec list [-o format]` | List all specs with phase info |
812
- | `spec switch <name>` | Switch active spec (preserves state) |
813
- | `next [--spec=name] [-o format]` | Get instruction for current phase |
814
- | `next --answer="..." [--spec=name] [-o f]` | Submit answer and advance state |
815
- | `approve [--spec=name]` | Approve spec draft -> SPEC_APPROVED |
816
- | `done [--spec=name]` | Complete execution -> DONE |
817
- | `block [--spec=name] "reason"` | Mark execution as blocked |
818
- | `reset [--spec=name]` | Reset current spec to IDLE |
819
- | `run [--spec=name] [--unattended]` | Autonomous execution loop (Ralph loop) |
820
- | `watch [-o format]` | Live dashboard monitoring agent progress |
821
- | `concern add/remove/list` | Manage active concerns |
822
- | `rule add/list/promote` | Manage permanent rules |
823
- | `sync` | Regenerate tool-specific instruction files + hooks |
824
- | `purge [--force]` | Remove all noskills content (specs, rules, concerns, hooks, state) |
825
-
826
- The `--spec` flag targets a specific spec by name, enabling parallel work across
827
- multiple terminal sessions. When omitted, commands operate on the active spec.
891
+ | Command | Description |
892
+ | ------------------------------------- | ------------------------------------------------------------------ |
893
+ | `init` | Scaffold `.eser/`, detect project traits, install hooks |
894
+ | `status [-o format]` | Show current phase, spec name, progress, debt |
895
+ | `spec new <name> "description"` | Start a new spec, enter DISCOVERY |
896
+ | `spec list [-o format]` | List all specs with phase info |
897
+ | `spec <name> next [-o format]` | Get instruction for current phase |
898
+ | `spec <name> next --answer="..."` | Submit answer and advance state |
899
+ | `spec <name> approve` | Approve spec draft -> SPEC_APPROVED |
900
+ | `spec <name> done` | Complete execution -> DONE |
901
+ | `spec <name> block "reason"` | Mark execution as blocked |
902
+ | `spec <name> reset` | Reset current spec to IDLE |
903
+ | `spec <name> revisit "reason"` | Return to DISCOVERY from EXECUTING |
904
+ | `spec <name> split --into x --into y` | Split spec into sub-specs |
905
+ | `run [--spec=name] [--unattended]` | Autonomous execution loop (Ralph loop) |
906
+ | `watch [-o format]` | Live dashboard monitoring agent progress |
907
+ | `concern add/remove/list` | Manage active concerns |
908
+ | `rule add/list/promote` | Manage permanent rules |
909
+ | `sync` | Regenerate tool-specific instruction files + hooks |
910
+ | `purge [--force]` | Remove all noskills content (specs, rules, concerns, hooks, state) |
911
+
912
+ All spec commands use the `spec <name> <command>` positional format. The spec
913
+ name always comes before the subcommand. Use `spec list` to see available specs.
828
914
 
829
915
  ### Output Formats
830
916
 
@@ -862,7 +948,7 @@ noskills:
862
948
  ```
863
949
 
864
950
  During `init`, noskills detects how it was invoked (via `@eser/standards`
865
- runtime) and stores it as `command`. All generated output — `CLAUDE.md`
951
+ runtime) and stores it as `command`. All generated output — `AGENTS.md`
866
952
  instructions, hook remediation messages, behavioral rules, transition hints —
867
953
  uses this prefix. Users who invoke via `deno run`, `npx`, homebrew, or global
868
954
  install all get correct command references.
@@ -945,12 +1031,23 @@ noskills can call AI agents for validation via a fallback chain:
945
1031
  package.json)
946
1032
  - **CI** — GitHub Actions, GitLab CI, Jenkins, CircleCI
947
1033
  - **Test runner** — Deno, Vitest, Jest, Playwright
948
- - **Coding tools** — Claude Code, Cursor, Kiro, Copilot, Windsurf (from existing
949
- config files in repo)
1034
+ - **Coding tools:**
1035
+ - **Claude Code** — `CLAUDE.md`, `.claude/` directory
1036
+ - **Kiro** — `.kiro/` directory
1037
+ - **Codex CLI** — `.codex/` directory, `.codex/config.toml`
1038
+ - **Copilot CLI** — `.copilot/` directory, `.github/hooks/`
1039
+ - **Copilot IDE** — `.github/copilot-instructions.md`
1040
+ - **OpenCode** — `.opencode/` directory, `opencode.json`
1041
+ - **Cursor** — `.cursorrules`, `.cursor/` directory
1042
+ - **Windsurf** — `.windsurfrules`
1043
+ - **Kilo Code** — `.kilo/` directory _(detection only — full adapter planned)_
1044
+ - **Cline** — `.clinerules` file _(detection only — full adapter planned)_
1045
+ - **Roo Code** — `.roo/` directory, `.roomodes` file _(detection only — full
1046
+ adapter planned)_
950
1047
 
951
1048
  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.
1049
+ tools that support it. Invocation method is auto-detected and stored in
1050
+ `manifest.yml` as `noskills.command` — all output references use this prefix.
954
1051
 
955
1052
  ## License
956
1053
 
@@ -1 +1 @@
1
- import{a as k}from"./chunk-SNHYXBHM.js";import{a as x,d as F}from"./chunk-3SLKOP72.js";import"./chunk-VPXOI7CR.js";import{c as p}from"./chunk-YK6UG66R.js";import{g as P,i as A}from"./chunk-TMC5H2A5.js";import{d as y,f as C,h as R,i as w,j as u,l as D,p as E}from"./chunk-LWCWPXCS.js";import{c as i,d as l,f as a,g as d,k as m,o as S,q as v,r as g}from"./chunk-Y6AFIAJP.js";import{a as h,b as n}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 M=async _=>{let s=S({renderer:g.ansi(),sink:v.stdout()}),r=c.process.cwd(),o=R(_);if(!o.ok)return s.writeln(a(o.error)),await s.close(),n({exitCode:1});let t;try{t=await C(r,o.spec)}catch(e){let f=e instanceof Error?e.message:String(e);return s.writeln(a(f)),await s.close(),n({exitCode:1})}let $=await D(r);if(t.spec!==null){let e=`${r}/${y.specDir(t.spec)}`;try{await c.fs.stat(e)}catch{return s.writeln(a(`Active spec '${t.spec}' directory not found.`)),s.writeln(l("Run `noskills reset` to return to IDLE.")),await s.close(),n({exitCode:1})}}if(t.phase==="SPEC_DRAFT"){if(t.classification===null&&t.spec!==null){let b=(await E(r)).filter(I=>$?.concerns.includes(I.id)??!1);try{await k(r,t,b)}catch{}}let e=A(t);await w(r,e),e.spec!==null&&await u(r,e.spec,e),e.spec!==null&&(await x(r,e.spec,"approved"),await F(r,e.spec,"approved")),s.writeln(d("\u2714")," Spec approved. Phase: ",m("SPEC_APPROVED")),s.writeln("When ready, run ",i(`${p('next --answer="start"')}`)," to begin execution.")}else if(t.phase==="DISCOVERY_REVIEW"){let e=P(t);await w(r,e),e.spec!==null&&await u(r,e.spec,e),s.writeln(d("\u2714")," Discovery answers approved. Phase: ",m("SPEC_DRAFT")),s.writeln("Review the spec and run ",i(p("approve"))," again to approve.")}else t.phase==="DISCOVERY"&&t.discovery.completed?(s.writeln(l("Discovery complete. Spec draft already generated.")),s.writeln("Review the spec and run ",i(p("approve"))," again when in SPEC_DRAFT phase.")):s.writeln(a(`Cannot approve in phase: ${t.phase}`));return await s.close(),h(void 0)};export{M as main};
1
+ import{a as k}from"./chunk-RBLZTQ64.js";import"./chunk-VPXOI7CR.js";import{a as x,d as F}from"./chunk-6FTHIS2Z.js";import{c as p}from"./chunk-YK6UG66R.js";import{g as P,j as A}from"./chunk-FJCXMC2D.js";import{d as y,f as C,h as R,i as w,j as u,l as D,p as E}from"./chunk-QYMX2GR3.js";import{c as i,d as l,f as a,g as d,k as m,o as S,q as v,r as g}from"./chunk-Y6AFIAJP.js";import{a as h,b as n}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 M=async _=>{let s=S({renderer:g.ansi(),sink:v.stdout()}),r=c.process.cwd(),o=R(_);if(!o.ok)return s.writeln(a(o.error)),await s.close(),n({exitCode:1});let t;try{t=await C(r,o.spec)}catch(e){let f=e instanceof Error?e.message:String(e);return s.writeln(a(f)),await s.close(),n({exitCode:1})}let $=await D(r);if(t.spec!==null){let e=`${r}/${y.specDir(t.spec)}`;try{await c.fs.stat(e)}catch{return s.writeln(a(`Active spec '${t.spec}' directory not found.`)),s.writeln(l("Run `noskills reset` to return to IDLE.")),await s.close(),n({exitCode:1})}}if(t.phase==="SPEC_DRAFT"){if(t.classification===null&&t.spec!==null){let b=(await E(r)).filter(I=>$?.concerns.includes(I.id)??!1);try{await k(r,t,b)}catch{}}let e=A(t);await w(r,e),e.spec!==null&&await u(r,e.spec,e),e.spec!==null&&(await x(r,e.spec,"approved"),await F(r,e.spec,"approved")),s.writeln(d("\u2714")," Spec approved. Phase: ",m("SPEC_APPROVED")),s.writeln("When ready, run ",i(`${p('next --answer="start"')}`)," to begin execution.")}else if(t.phase==="DISCOVERY_REVIEW"){let e=P(t);await w(r,e),e.spec!==null&&await u(r,e.spec,e),s.writeln(d("\u2714")," Discovery answers approved. Phase: ",m("SPEC_DRAFT")),s.writeln("Review the spec and run ",i(p("approve"))," again to approve.")}else t.phase==="DISCOVERY"&&t.discovery.completed?(s.writeln(l("Discovery complete. Spec draft already generated.")),s.writeln("Review the spec and run ",i(p("approve"))," again when in SPEC_DRAFT phase.")):s.writeln(a(`Cannot approve in phase: ${t.phase}`));return await s.close(),h(void 0)};export{M as main};
@@ -1,2 +1,2 @@
1
- import{a as Ee,b as Ie}from"./chunk-AGPCY6XP.js";import{a as te,b as C,c as M,d as G,f as L,g as Ae,h as be,j as ke,k as re,l as Pe,o as ne,p as Re,q as oe,r as _e}from"./chunk-Y6AFIAJP.js";import{a as Fe}from"./chunk-5MN3MWQN.js";import"./chunk-OLM5RTFK.js";import{a as Le,b as D}from"./chunk-2N4GTHXQ.js";import{d as ie}from"./chunk-BBKSV2RO.js";import{b as T}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import{d as ee}from"./chunk-OTRBRRIO.js";var Ne=e=>({rawMessage:e.rawMessage??e.message,args:e.args??[],datetime:e.datetime??new Date,properties:e.properties??{},context:e.context??{},...e});var d=e=>typeof e=="string"?e.split(".").filter(Boolean):e,V=(e,t=".")=>e.join(t),w=e=>e.join("\0");var Oe=(e,t)=>e.length<t.length?!1:t.every((r,n)=>e[n]===r);var De=(e,t)=>{let r=[];for(let n of t.values()){let i=d(n.category);Oe(e,i)&&r.push(n)}return r.sort((n,i)=>{let o=d(n.category).length;return d(i.category).length-o}),r};var j=(e,t)=>{let r=typeof t=="string"?[t]:t;return[...e,...r]};var K={};ee(K,{configure:()=>Tt,configureSync:()=>Ct,getEffectiveConfig:()=>ue,getFilterNames:()=>Rt,getLoggerCategories:()=>_t,getRegistryState:()=>St,getSinkNames:()=>Pt,isConfigured:()=>ht,registerFilter:()=>At,registerLogger:()=>kt,registerLoggerCacheClear:()=>le,registerSink:()=>wt,reset:()=>ze,resetSync:()=>Ke,unregisterFilter:()=>bt,unregisterSink:()=>Lt});var g={Trace:1,Debug:5,Info:9,Notice:10,Warning:13,Error:17,Critical:21,Alert:22,Emergency:23},Me={[g.Trace]:"Trace",[g.Debug]:"Debug",[g.Info]:"Info",[g.Notice]:"Notice",[g.Warning]:"Warning",[g.Error]:"Error",[g.Critical]:"Critical",[g.Alert]:"Alert",[g.Emergency]:"Emergency"};var $,z,pt=()=>{if($===void 0)try{let e=globalThis.AsyncLocalStorage??globalThis.require?.("async_hooks")?.AsyncLocalStorage;e&&($=new e)}catch{}return $},mt=()=>{if(z===void 0)try{let e=globalThis.AsyncLocalStorage??globalThis.require?.("async_hooks")?.AsyncLocalStorage;e&&(z=new e)}catch{}return z},Ge,Ve,R=e=>{Ge=e},se=e=>{Ve=e},ge=()=>{$=void 0,z=void 0},dt=()=>Ge??pt(),yt=()=>Ve??mt();var je=()=>{let e=dt();return e?e.getStore()??{}:{}};var xt=()=>{let e=yt();return e?e.getStore()??[]:[]},$e=e=>{let t=xt();return t.length===0?e:j(t,e)};var ce=null,le=e=>{ce=e},u=null,y=new Map,St=()=>u,ht=()=>u!==null,Tt=async e=>{(e.reset||u===null)&&await ze(),u={sinks:new Map(Object.entries(e.sinks)),filters:new Map(Object.entries(e.filters??{})),loggers:new Map,contextLocalStorage:e.contextLocalStorage};for(let t of e.loggers){let r=d(t.category),n=w(r);u.loggers.set(n,{...t,category:r})}e.contextLocalStorage&&R(e.contextLocalStorage),y.clear()},Ct=e=>{(e.reset||u===null)&&Ke(),u={sinks:new Map(Object.entries(e.sinks)),filters:new Map(Object.entries(e.filters??{})),loggers:new Map,contextLocalStorage:e.contextLocalStorage};for(let t of e.loggers){let r=d(t.category),n=w(r);u.loggers.set(n,{...t,category:r})}e.contextLocalStorage&&R(e.contextLocalStorage),y.clear()},ze=async()=>{if(u)for(let e of u.sinks.values()){let t=e;typeof t.dispose=="function"?await t.dispose():typeof t[Symbol.asyncDispose]=="function"&&await t[Symbol.asyncDispose]()}u=null,y.clear(),ce?.(),R(void 0),se(void 0),ge()},Ke=()=>{if(u)for(let e of u.sinks.values()){let t=e;typeof t.disposeSync=="function"?t.disposeSync():typeof t[Symbol.dispose]=="function"&&t[Symbol.dispose]()}u=null,y.clear(),ce?.(),R(void 0),se(void 0),ge()},ue=e=>{let t=w(e),r=y.get(t);if(r)return r;let n={sinks:[],filters:[],lowestLevel:g.Info};if(!u)return n;let i=De(e,u.loggers),o=new Set,a=new Set,l=!1;for(let s of i){if(s.sinks&&s.sinks.length>0){s.parentSinks==="override"&&o.clear();for(let c of s.sinks)o.add(c)}if(s.filters)for(let c of s.filters)a.add(c);!l&&s.lowestLevel!==void 0&&(n.lowestLevel=s.lowestLevel,l=!0)}for(let s of o){let c=u.sinks.get(s);c&&n.sinks.push(c)}for(let s of a){let c=u.filters.get(s);c&&n.filters.push(c)}return y.set(t,n),n},wt=(e,t)=>{if(!u)throw new Error("Logging not configured. Call configure() first.");u.sinks.set(e,t),y.clear()},Lt=e=>{u&&(u.sinks.delete(e),y.clear())},At=(e,t)=>{if(!u)throw new Error("Logging not configured. Call configure() first.");u.filters.set(e,t),y.clear()},bt=e=>{u&&(u.filters.delete(e),y.clear())},kt=e=>{if(!u)throw new Error("Logging not configured. Call configure() first.");let t=d(e.category),r=w(t);u.loggers.set(r,{...e,category:t}),y.clear()},Pt=()=>u?Array.from(u.sinks.keys()):[],Rt=()=>u?Array.from(u.filters.keys()):[],_t=()=>u?Array.from(u.loggers.values()).map(e=>d(e.category)):[];var W={};ee(W,{DEFAULT_LEVEL:()=>Ft,Logger:()=>_,clearLoggerCache:()=>We,current:()=>It,getLogger:()=>Et});var Ft=g.Info,_=class e{category;parent;#e;#t=null;constructor(t,r=null,n={}){this.category=d(t),this.parent=r,this.#e=n}#r(){return this.#t===null&&(this.#t=ue(this.category)),this.#t}getChild(t){let r=j(this.category,d(t));return new e(r,this,this.#e)}with(t){return new e(this.category,this.parent,{...this.#e,...t})}get loggerName(){return V(this.category)}asString(t,r=!1){return typeof t=="string"?r?`"${t}"`:t:t===null||typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"||typeof t>"u"||typeof t=="symbol"?String(t):t instanceof Error?t.stack:t!==null&&typeof t=="object"?Array.isArray(t)?JSON.stringify(t):`{${Object.entries(t).map(([n,i])=>`"${n}":${this.asString(i,!0)}`).join(",")}}`:"undefined"}async log(t,r,...n){let i=this.#r();if(t<i.lowestLevel)return r instanceof Function?void 0:r;let o,a;r instanceof Function?(o=r(),a=this.asString(o)):a=this.asString(r);let l=je(),s=Ne({message:a,rawMessage:a,args:n,datetime:new Date,severity:t,category:this.category,properties:this.#e,context:l});for(let c of i.filters)if(!c(s))return r instanceof Function?o:r;return i.sinks.length>0&&await Promise.all(i.sinks.map(c=>c(s))),r instanceof Function?o:r}debug(t,...r){return this.log(g.Debug,t,...r)}info(t,...r){return this.log(g.Info,t,...r)}warn(t,...r){return this.log(g.Warning,t,...r)}error(t,...r){return this.log(g.Error,t,...r)}critical(t,...r){return this.log(g.Critical,t,...r)}emergency(t,...r){return this.log(g.Emergency,t,...r)}alert(t,...r){return this.log(g.Alert,t,...r)}notice(t,...r){return this.log(g.Notice,t,...r)}trace(t,...r){return this.log(g.Trace,t,...r)}},fe=new Map,Et=e=>{let t=$e(d(e)),r=w(t),n=fe.get(r);return n||(n=new _(t),fe.set(r,n)),n},We=()=>{fe.clear()};le(We);var It=new _(["default"]);var B={};ee(B,{fingersCrossedSink:()=>Kt,getBufferedSink:()=>zt,getOutputSink:()=>jt,getRecordCollectorSink:()=>Ue,getTestSink:()=>Wt,withFilter:()=>$t});var Nt={[g.Trace]:"TRCE",[g.Debug]:"DBUG",[g.Info]:"INFO",[g.Notice]:"NOTC",[g.Warning]:"WARN",[g.Error]:"ERRO",[g.Critical]:"CRIT",[g.Alert]:"ALRT",[g.Emergency]:"EMRG"};var Ot=(e,t)=>{if(t==="none")return"";if(typeof t=="function")return t(e);let r=e.toISOString(),n=r.slice(0,10),i=r.slice(11,19),o=r.slice(19);switch(t){case"rfc3339":return r;case"date-time-timezone":case void 0:return`${n} ${i}${o}`;case"date-time":return`${n} ${i}`;case"time-timezone":return`${i}${o}`;case"time":return i;case"date":return n}},Dt=e=>{try{return JSON.stringify(e)}catch{return String(e)}},Mt=(e,t)=>{let r={...t,...e},n=Object.entries(r);return n.length===0?"":" "+n.map(([i,o])=>{let a=typeof o=="string"?o:Dt(o);return`${i}=${a}`}).join(" ")};var Gt=(e,t)=>{switch(e){case g.Trace:return G(ke(t));case g.Debug:return Pe(t);case g.Info:return Ae(t);case g.Notice:return re(t);case g.Warning:return be(t);case g.Error:return L(t);case g.Critical:return M(L(t));case g.Alert:return M(L(t));case g.Emergency:return M(L(t));default:return C(t)}},Be=e=>{let t=Ot(e.datetime,"date-time-timezone"),r=Nt[e.severity]??"????",n=e.category.length>0?V(e.category):"",i=Mt(e.properties,e.context),o=[];return t&&o.push(G(t),C(" ")),o.push(Gt(e.severity,r),C(" ")),n&&o.push(re(`[${n}]`),C(" ")),e.severity>=g.Error?o.push(L(e.message)):o.push(C(e.message)),i.trim()&&o.push(C(" "),G(i.trim())),o};var jt=(e,t)=>{let r=t?.formatter??Be;return n=>{let i=r(n);e.writeln(...i)}},$t=(e,t)=>r=>{if(t(r))return e(r)},zt=(e,t={})=>{let{maxSize:r=100,flushIntervalMs:n=5e3}=t,i=[],o=null,a=async()=>{if(i.length===0)return;let c=i;i=[],o&&(clearTimeout(o),o=null),await Promise.all(c.map(p=>e(p)))},l=()=>{o===null&&(o=setTimeout(()=>{o=null,a().catch(()=>{})},n))},s=async c=>{i.push(c),i.length>=r?await a():l()};return s.flush=a,s},Kt=(e,t={})=>{let{triggerLevel:r=17,maxBufferSize:n=1e3}=t,i=[],o=!1,a=async()=>{let c=i;i=[],o=!0,await Promise.all(c.map(p=>e(p)))},l=()=>{i=[],o=!1},s=async c=>{if(o){await e(c);return}if(c.severity>=r){i.push(c),await a();return}i.push(c),i.length>n&&i.shift()};return s.flush=a,s.clear=l,s},Ue=()=>{let e=[];return{sink:r=>{e.push(r)},records:e}},Wt=Ue;var Ye=typeof globalThis=="object"?globalThis:global;var v="1.9.0";var Xe=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Ut(e){var t=new Set([e]),r=new Set,n=e.match(Xe);if(!n)return function(){return!1};var i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(s){return s===e};function o(l){return r.add(l),!1}function a(l){return t.add(l),!0}return function(s){if(t.has(s))return!0;if(r.has(s))return!1;var c=s.match(Xe);if(!c)return o(s);var p={major:+c[1],minor:+c[2],patch:+c[3],prerelease:c[4]};return p.prerelease!=null||i.major!==p.major?o(s):i.major===0?i.minor===p.minor&&i.patch<=p.patch?a(s):o(s):i.minor<=p.minor?a(s):o(s)}}var qe=Ut(v);var Yt=v.split(".")[0],F=Symbol.for("opentelemetry.js.api."+Yt),E=Ye;function A(e,t,r,n){var i;n===void 0&&(n=!1);var o=E[F]=(i=E[F])!==null&&i!==void 0?i:{version:v};if(!n&&o[e]){var a=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(a.stack||a.message),!1}if(o.version!==v){var a=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+e+" does not match previously registered API v"+v);return r.error(a.stack||a.message),!1}return o[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+v+"."),!0}function S(e){var t,r,n=(t=E[F])===null||t===void 0?void 0:t.version;if(!(!n||!qe(n)))return(r=E[F])===null||r===void 0?void 0:r[e]}function b(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+v+".");var r=E[F];r&&delete r[e]}var Xt=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},qt=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},He=function(){function e(t){this._namespace=t.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("debug",this._namespace,t)},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("error",this._namespace,t)},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("info",this._namespace,t)},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("warn",this._namespace,t)},e.prototype.verbose=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("verbose",this._namespace,t)},e}();function I(e,t,r){var n=S("diag");if(n)return r.unshift(t),n[e].apply(n,qt([],Xt(r),!1))}var m;(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(m||(m={}));function Je(e,t){e<m.NONE?e=m.NONE:e>m.ALL&&(e=m.ALL),t=t||{};function r(n,i){var o=t[n];return typeof o=="function"&&e>=i?o.bind(t):function(){}}return{error:r("error",m.ERROR),warn:r("warn",m.WARN),info:r("info",m.INFO),debug:r("debug",m.DEBUG),verbose:r("verbose",m.VERBOSE)}}var Ht=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},Jt=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},Qt="diag",k=function(){function e(){function t(i){return function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var l=S("diag");if(l)return l[i].apply(l,Jt([],Ht(o),!1))}}var r=this,n=function(i,o){var a,l,s;if(o===void 0&&(o={logLevel:m.INFO}),i===r){var c=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((a=c.stack)!==null&&a!==void 0?a:c.message),!1}typeof o=="number"&&(o={logLevel:o});var p=S("diag"),f=Je((l=o.logLevel)!==null&&l!==void 0?l:m.INFO,i);if(p&&!o.suppressOverrideMessage){var x=(s=new Error().stack)!==null&&s!==void 0?s:"<failed to generate stacktrace>";p.warn("Current logger will be overwritten from "+x),f.warn("Current logger will overwrite one already registered from "+x)}return A("diag",f,r,!0)};r.setLogger=n,r.disable=function(){b(Qt,r)},r.createComponentLogger=function(i){return new He(i)},r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e}();function Qe(e){return Symbol.for(e)}var Zt=function(){function e(t){var r=this;r._currentContext=t?new Map(t):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,i){var o=new e(r._currentContext);return o._currentContext.set(n,i),o},r.deleteValue=function(n){var i=new e(r._currentContext);return i._currentContext.delete(n),i}}return e}(),Ze=new Zt;var er=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},tr=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},et=function(){function e(){}return e.prototype.active=function(){return Ze},e.prototype.with=function(t,r,n){for(var i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return r.call.apply(r,tr([n],er(i),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e}();var rr=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},nr=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},pe="context",or=new et,U=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(t){return A(pe,t,k.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(t,r,n){for(var i,o=[],a=3;a<arguments.length;a++)o[a-3]=arguments[a];return(i=this._getContextManager()).with.apply(i,nr([t,r,n],rr(o),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return S(pe)||or},e.prototype.disable=function(){this._getContextManager().disable(),b(pe,k.instance())},e}();var Y;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(Y||(Y={}));var me="0000000000000000",de="00000000000000000000000000000000",tt={traceId:de,spanId:me,traceFlags:Y.NONE};var h=function(){function e(t){t===void 0&&(t=tt),this._spanContext=t}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(t,r){return this},e.prototype.setAttributes=function(t){return this},e.prototype.addEvent=function(t,r){return this},e.prototype.addLink=function(t){return this},e.prototype.addLinks=function(t){return this},e.prototype.setStatus=function(t){return this},e.prototype.updateName=function(t){return this},e.prototype.end=function(t){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(t,r){},e}();var ye=Qe("OpenTelemetry Context Key SPAN");function X(e){return e.getValue(ye)||void 0}function rt(){return X(U.getInstance().active())}function N(e,t){return e.setValue(ye,t)}function nt(e){return e.deleteValue(ye)}function ot(e,t){return N(e,new h(t))}function q(e){var t;return(t=X(e))===null||t===void 0?void 0:t.spanContext()}var ir=/^([0-9a-f]{32})$/i,ar=/^[0-9a-f]{16}$/i;function sr(e){return ir.test(e)&&e!==de}function gr(e){return ar.test(e)&&e!==me}function H(e){return sr(e.traceId)&&gr(e.spanId)}function it(e){return new h(e)}var xe=U.getInstance(),J=function(){function e(){}return e.prototype.startSpan=function(t,r,n){n===void 0&&(n=xe.active());var i=!!r?.root;if(i)return new h;var o=n&&q(n);return cr(o)&&H(o)?new h(o):new h},e.prototype.startActiveSpan=function(t,r,n,i){var o,a,l;if(!(arguments.length<2)){arguments.length===2?l=r:arguments.length===3?(o=r,l=n):(o=r,a=n,l=i);var s=a??xe.active(),c=this.startSpan(t,o,s),p=N(s,c);return xe.with(p,l,void 0,c)}},e}();function cr(e){return typeof e=="object"&&typeof e.spanId=="string"&&typeof e.traceId=="string"&&typeof e.traceFlags=="number"}var lr=new J,at=function(){function e(t,r,n,i){this._provider=t,this.name=r,this.version=n,this.options=i}return e.prototype.startSpan=function(t,r,n){return this._getTracer().startSpan(t,r,n)},e.prototype.startActiveSpan=function(t,r,n,i){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):lr},e}();var st=function(){function e(){}return e.prototype.getTracer=function(t,r,n){return new J},e}();var ur=new st,ve=function(){function e(){}return e.prototype.getTracer=function(t,r,n){var i;return(i=this.getDelegateTracer(t,r,n))!==null&&i!==void 0?i:new at(this,t,r,n)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:ur},e.prototype.setDelegate=function(t){this._delegate=t},e.prototype.getDelegateTracer=function(t,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(t,r,n)},e}();var Se="trace",gt=function(){function e(){this._proxyTracerProvider=new ve,this.wrapSpanContext=it,this.isSpanContextValid=H,this.deleteSpan=nt,this.getSpan=X,this.getActiveSpan=rt,this.getSpanContext=q,this.setSpan=N,this.setSpanContext=ot}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(t){var r=A(Se,this._proxyTracerProvider,k.instance());return r&&this._proxyTracerProvider.setDelegate(t),r},e.prototype.getTracerProvider=function(){return S(Se)||this._proxyTracerProvider},e.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},e.prototype.disable=function(){b(Se,k.instance()),this._proxyTracerProvider=new ve},e}();var he=gt.getInstance();var Yn=he.getTracer("@eser/logging");var Te=(e,t,r)=>{let n=e.streamText(t,r);return{name:`ai-text/${e.provider}/${e.modelId}`,readable:new ReadableStream({async start(i){try{for await(let o of n)o.kind==="content_delta"&&i.enqueue(te(o.textDelta));i.close()}catch(o){i.error(o)}}})}};var dr={cc:"claude-code",ol:"ollama",oc:"opencode",oai:"openai",ant:"anthropic",gem:"gemini",vtx:"vertexai"},yr={"claude-code":"Claude Code",ollama:"Ollama",opencode:"OpenCode",kiro:"Kiro",anthropic:"Anthropic API",openai:"OpenAI API",gemini:"Gemini API",vertexai:"Vertex AI"},xr=e=>dr[e]??e,vr=async e=>{if(e){let t=T.process.stderr.getWriter(),r=ne({renderer:_e.ansi(),sink:oe.writable(new WritableStream({async write(n){await t.write(new TextEncoder().encode(String(n.data)))},close(){t.releaseLock()}}))});await K.configure({sinks:{stderr:B.getOutputSink(r)},loggers:[{category:["ai"],lowestLevel:g.Debug,sinks:["stderr"]}]})}return W.getLogger(["ai","ask"])},Sr=async e=>{await e.info("Auto-detecting AI provider...");try{if(await ie`which claude`.noThrow().code()===0)return await e.info("Claude Code detected."),"claude-code"}catch{}try{if((await fetch("http://localhost:11434/api/version",{signal:AbortSignal.timeout(1e3)})).ok)return await e.info("Ollama detected at localhost:11434."),"ollama"}catch{}try{if(await ie`which opencode`.noThrow().code()===0)return await e.info("OpenCode detected."),"opencode"}catch{}if(T.capabilities.env){if(T.env.has("ANTHROPIC_API_KEY"))return await e.info("Anthropic API key detected."),"anthropic";if(T.env.has("OPENAI_API_KEY"))return await e.info("OpenAI API key detected."),"openai"}throw new Error("No AI provider detected. Install claude, ollama, or set ANTHROPIC_API_KEY / OPENAI_API_KEY.")},hr=async e=>{switch(e){case"claude-code":return(await import("./claude-code-K3SX5D5F.js")).claudeCodeFactory;case"ollama":return(await import("./ollama-CNKKUTPX.js")).ollamaFactory;case"opencode":return(await import("./opencode-MJO3K6T4.js")).openCodeFactory;case"kiro":return(await import("./kiro-T5X4D4SC.js")).kiroFactory;case"anthropic":return(await import("./anthropic-UTLWCK66.js")).anthropicFactory;case"openai":return(await import("./openai-QGEN33SU.js")).openaiFactory;case"gemini":return(await import("./gemini-YR5KT32S.js")).geminiFactory;case"vertexai":return(await import("./vertexai-RUXZ24C2.js")).vertexaiFactory;default:throw new Error(`Unknown provider: ${e}`)}},lo=async e=>{let t=e??[],r=null,n=null,i=null,o=!1,a=!1,l=[],s=0;for(;s<t.length;){let f=t[s];if(f==="-p"||f==="--provider"){r=t[s+1]??null,s+=2;continue}if(f==="-m"||f==="--model"){n=t[s+1]??null,s+=2;continue}if(f==="--max-tokens"){let x=t[s+1];x!==void 0&&(i=Number(x)),s+=2;continue}if(f==="--json"){o=!0,s+=1;continue}if(f==="-v"||f==="--verbose"){a=!0,s+=1;continue}f.startsWith("-")||l.push(f),s+=1}let c=l.join(" ");if(c.length===0)return D({message:'Usage: ai ask "your prompt" [-p provider] [-m model] [--verbose]',exitCode:1});let p=await vr(a);try{let f=r!==null?xr(r):await Sr(p),x=yr[f]??f,Ce=n??Lr(f);await p.info(`Using ${x} (${Ce})`);let lt=await hr(f),Q=new Ie({factories:[lt]});await Q.addModel("default",{provider:f,model:Ce});let Z=Q.getDefault();if(Z===null)return D({message:"Failed to initialize model",exitCode:1});let we=[Fe("user",c)];if(await p.info(`Sending prompt (${c.length} chars)...`),o){let O=await Z.generateText({messages:we,maxTokens:i??void 0});await p.info(`Response received (${Ee(O).length} chars)`);let P=ne({sink:oe.stdout()});P.writeln(JSON.stringify(O,null,2)),await P.close()}else{let O=Te(Z,{messages:we,maxTokens:i??void 0});await Re().from(O).to(wr()).run();let P=T.process.stdout.getWriter();await P.write(new TextEncoder().encode(`
1
+ import{a as Ee,b as Ie}from"./chunk-AGPCY6XP.js";import{a as te,b as C,c as M,d as G,f as L,g as Ae,h as be,j as ke,k as re,l as Pe,o as ne,p as Re,q as oe,r as _e}from"./chunk-Y6AFIAJP.js";import{a as Fe}from"./chunk-5MN3MWQN.js";import"./chunk-OLM5RTFK.js";import{a as Le,b as D}from"./chunk-2N4GTHXQ.js";import{d as ie}from"./chunk-FEHZCASN.js";import{b as T}from"./chunk-MNEZ5QGX.js";import"./chunk-DHMCIRLT.js";import"./chunk-4BH6CF3J.js";import{d as ee}from"./chunk-OTRBRRIO.js";var Ne=e=>({rawMessage:e.rawMessage??e.message,args:e.args??[],datetime:e.datetime??new Date,properties:e.properties??{},context:e.context??{},...e});var d=e=>typeof e=="string"?e.split(".").filter(Boolean):e,V=(e,t=".")=>e.join(t),w=e=>e.join("\0");var Oe=(e,t)=>e.length<t.length?!1:t.every((r,n)=>e[n]===r);var De=(e,t)=>{let r=[];for(let n of t.values()){let i=d(n.category);Oe(e,i)&&r.push(n)}return r.sort((n,i)=>{let o=d(n.category).length;return d(i.category).length-o}),r};var j=(e,t)=>{let r=typeof t=="string"?[t]:t;return[...e,...r]};var K={};ee(K,{configure:()=>Tt,configureSync:()=>Ct,getEffectiveConfig:()=>ue,getFilterNames:()=>Rt,getLoggerCategories:()=>_t,getRegistryState:()=>St,getSinkNames:()=>Pt,isConfigured:()=>ht,registerFilter:()=>At,registerLogger:()=>kt,registerLoggerCacheClear:()=>le,registerSink:()=>wt,reset:()=>ze,resetSync:()=>Ke,unregisterFilter:()=>bt,unregisterSink:()=>Lt});var g={Trace:1,Debug:5,Info:9,Notice:10,Warning:13,Error:17,Critical:21,Alert:22,Emergency:23},Me={[g.Trace]:"Trace",[g.Debug]:"Debug",[g.Info]:"Info",[g.Notice]:"Notice",[g.Warning]:"Warning",[g.Error]:"Error",[g.Critical]:"Critical",[g.Alert]:"Alert",[g.Emergency]:"Emergency"};var $,z,pt=()=>{if($===void 0)try{let e=globalThis.AsyncLocalStorage??globalThis.require?.("async_hooks")?.AsyncLocalStorage;e&&($=new e)}catch{}return $},mt=()=>{if(z===void 0)try{let e=globalThis.AsyncLocalStorage??globalThis.require?.("async_hooks")?.AsyncLocalStorage;e&&(z=new e)}catch{}return z},Ge,Ve,R=e=>{Ge=e},se=e=>{Ve=e},ge=()=>{$=void 0,z=void 0},dt=()=>Ge??pt(),yt=()=>Ve??mt();var je=()=>{let e=dt();return e?e.getStore()??{}:{}};var xt=()=>{let e=yt();return e?e.getStore()??[]:[]},$e=e=>{let t=xt();return t.length===0?e:j(t,e)};var ce=null,le=e=>{ce=e},u=null,y=new Map,St=()=>u,ht=()=>u!==null,Tt=async e=>{(e.reset||u===null)&&await ze(),u={sinks:new Map(Object.entries(e.sinks)),filters:new Map(Object.entries(e.filters??{})),loggers:new Map,contextLocalStorage:e.contextLocalStorage};for(let t of e.loggers){let r=d(t.category),n=w(r);u.loggers.set(n,{...t,category:r})}e.contextLocalStorage&&R(e.contextLocalStorage),y.clear()},Ct=e=>{(e.reset||u===null)&&Ke(),u={sinks:new Map(Object.entries(e.sinks)),filters:new Map(Object.entries(e.filters??{})),loggers:new Map,contextLocalStorage:e.contextLocalStorage};for(let t of e.loggers){let r=d(t.category),n=w(r);u.loggers.set(n,{...t,category:r})}e.contextLocalStorage&&R(e.contextLocalStorage),y.clear()},ze=async()=>{if(u)for(let e of u.sinks.values()){let t=e;typeof t.dispose=="function"?await t.dispose():typeof t[Symbol.asyncDispose]=="function"&&await t[Symbol.asyncDispose]()}u=null,y.clear(),ce?.(),R(void 0),se(void 0),ge()},Ke=()=>{if(u)for(let e of u.sinks.values()){let t=e;typeof t.disposeSync=="function"?t.disposeSync():typeof t[Symbol.dispose]=="function"&&t[Symbol.dispose]()}u=null,y.clear(),ce?.(),R(void 0),se(void 0),ge()},ue=e=>{let t=w(e),r=y.get(t);if(r)return r;let n={sinks:[],filters:[],lowestLevel:g.Info};if(!u)return n;let i=De(e,u.loggers),o=new Set,a=new Set,l=!1;for(let s of i){if(s.sinks&&s.sinks.length>0){s.parentSinks==="override"&&o.clear();for(let c of s.sinks)o.add(c)}if(s.filters)for(let c of s.filters)a.add(c);!l&&s.lowestLevel!==void 0&&(n.lowestLevel=s.lowestLevel,l=!0)}for(let s of o){let c=u.sinks.get(s);c&&n.sinks.push(c)}for(let s of a){let c=u.filters.get(s);c&&n.filters.push(c)}return y.set(t,n),n},wt=(e,t)=>{if(!u)throw new Error("Logging not configured. Call configure() first.");u.sinks.set(e,t),y.clear()},Lt=e=>{u&&(u.sinks.delete(e),y.clear())},At=(e,t)=>{if(!u)throw new Error("Logging not configured. Call configure() first.");u.filters.set(e,t),y.clear()},bt=e=>{u&&(u.filters.delete(e),y.clear())},kt=e=>{if(!u)throw new Error("Logging not configured. Call configure() first.");let t=d(e.category),r=w(t);u.loggers.set(r,{...e,category:t}),y.clear()},Pt=()=>u?Array.from(u.sinks.keys()):[],Rt=()=>u?Array.from(u.filters.keys()):[],_t=()=>u?Array.from(u.loggers.values()).map(e=>d(e.category)):[];var W={};ee(W,{DEFAULT_LEVEL:()=>Ft,Logger:()=>_,clearLoggerCache:()=>We,current:()=>It,getLogger:()=>Et});var Ft=g.Info,_=class e{category;parent;#e;#t=null;constructor(t,r=null,n={}){this.category=d(t),this.parent=r,this.#e=n}#r(){return this.#t===null&&(this.#t=ue(this.category)),this.#t}getChild(t){let r=j(this.category,d(t));return new e(r,this,this.#e)}with(t){return new e(this.category,this.parent,{...this.#e,...t})}get loggerName(){return V(this.category)}asString(t,r=!1){return typeof t=="string"?r?`"${t}"`:t:t===null||typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"||typeof t>"u"||typeof t=="symbol"?String(t):t instanceof Error?t.stack:t!==null&&typeof t=="object"?Array.isArray(t)?JSON.stringify(t):`{${Object.entries(t).map(([n,i])=>`"${n}":${this.asString(i,!0)}`).join(",")}}`:"undefined"}async log(t,r,...n){let i=this.#r();if(t<i.lowestLevel)return r instanceof Function?void 0:r;let o,a;r instanceof Function?(o=r(),a=this.asString(o)):a=this.asString(r);let l=je(),s=Ne({message:a,rawMessage:a,args:n,datetime:new Date,severity:t,category:this.category,properties:this.#e,context:l});for(let c of i.filters)if(!c(s))return r instanceof Function?o:r;return i.sinks.length>0&&await Promise.all(i.sinks.map(c=>c(s))),r instanceof Function?o:r}debug(t,...r){return this.log(g.Debug,t,...r)}info(t,...r){return this.log(g.Info,t,...r)}warn(t,...r){return this.log(g.Warning,t,...r)}error(t,...r){return this.log(g.Error,t,...r)}critical(t,...r){return this.log(g.Critical,t,...r)}emergency(t,...r){return this.log(g.Emergency,t,...r)}alert(t,...r){return this.log(g.Alert,t,...r)}notice(t,...r){return this.log(g.Notice,t,...r)}trace(t,...r){return this.log(g.Trace,t,...r)}},fe=new Map,Et=e=>{let t=$e(d(e)),r=w(t),n=fe.get(r);return n||(n=new _(t),fe.set(r,n)),n},We=()=>{fe.clear()};le(We);var It=new _(["default"]);var B={};ee(B,{fingersCrossedSink:()=>Kt,getBufferedSink:()=>zt,getOutputSink:()=>jt,getRecordCollectorSink:()=>Ue,getTestSink:()=>Wt,withFilter:()=>$t});var Nt={[g.Trace]:"TRCE",[g.Debug]:"DBUG",[g.Info]:"INFO",[g.Notice]:"NOTC",[g.Warning]:"WARN",[g.Error]:"ERRO",[g.Critical]:"CRIT",[g.Alert]:"ALRT",[g.Emergency]:"EMRG"};var Ot=(e,t)=>{if(t==="none")return"";if(typeof t=="function")return t(e);let r=e.toISOString(),n=r.slice(0,10),i=r.slice(11,19),o=r.slice(19);switch(t){case"rfc3339":return r;case"date-time-timezone":case void 0:return`${n} ${i}${o}`;case"date-time":return`${n} ${i}`;case"time-timezone":return`${i}${o}`;case"time":return i;case"date":return n}},Dt=e=>{try{return JSON.stringify(e)}catch{return String(e)}},Mt=(e,t)=>{let r={...t,...e},n=Object.entries(r);return n.length===0?"":" "+n.map(([i,o])=>{let a=typeof o=="string"?o:Dt(o);return`${i}=${a}`}).join(" ")};var Gt=(e,t)=>{switch(e){case g.Trace:return G(ke(t));case g.Debug:return Pe(t);case g.Info:return Ae(t);case g.Notice:return re(t);case g.Warning:return be(t);case g.Error:return L(t);case g.Critical:return M(L(t));case g.Alert:return M(L(t));case g.Emergency:return M(L(t));default:return C(t)}},Be=e=>{let t=Ot(e.datetime,"date-time-timezone"),r=Nt[e.severity]??"????",n=e.category.length>0?V(e.category):"",i=Mt(e.properties,e.context),o=[];return t&&o.push(G(t),C(" ")),o.push(Gt(e.severity,r),C(" ")),n&&o.push(re(`[${n}]`),C(" ")),e.severity>=g.Error?o.push(L(e.message)):o.push(C(e.message)),i.trim()&&o.push(C(" "),G(i.trim())),o};var jt=(e,t)=>{let r=t?.formatter??Be;return n=>{let i=r(n);e.writeln(...i)}},$t=(e,t)=>r=>{if(t(r))return e(r)},zt=(e,t={})=>{let{maxSize:r=100,flushIntervalMs:n=5e3}=t,i=[],o=null,a=async()=>{if(i.length===0)return;let c=i;i=[],o&&(clearTimeout(o),o=null),await Promise.all(c.map(p=>e(p)))},l=()=>{o===null&&(o=setTimeout(()=>{o=null,a().catch(()=>{})},n))},s=async c=>{i.push(c),i.length>=r?await a():l()};return s.flush=a,s},Kt=(e,t={})=>{let{triggerLevel:r=17,maxBufferSize:n=1e3}=t,i=[],o=!1,a=async()=>{let c=i;i=[],o=!0,await Promise.all(c.map(p=>e(p)))},l=()=>{i=[],o=!1},s=async c=>{if(o){await e(c);return}if(c.severity>=r){i.push(c),await a();return}i.push(c),i.length>n&&i.shift()};return s.flush=a,s.clear=l,s},Ue=()=>{let e=[];return{sink:r=>{e.push(r)},records:e}},Wt=Ue;var Ye=typeof globalThis=="object"?globalThis:global;var v="1.9.0";var Xe=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Ut(e){var t=new Set([e]),r=new Set,n=e.match(Xe);if(!n)return function(){return!1};var i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(s){return s===e};function o(l){return r.add(l),!1}function a(l){return t.add(l),!0}return function(s){if(t.has(s))return!0;if(r.has(s))return!1;var c=s.match(Xe);if(!c)return o(s);var p={major:+c[1],minor:+c[2],patch:+c[3],prerelease:c[4]};return p.prerelease!=null||i.major!==p.major?o(s):i.major===0?i.minor===p.minor&&i.patch<=p.patch?a(s):o(s):i.minor<=p.minor?a(s):o(s)}}var qe=Ut(v);var Yt=v.split(".")[0],F=Symbol.for("opentelemetry.js.api."+Yt),E=Ye;function A(e,t,r,n){var i;n===void 0&&(n=!1);var o=E[F]=(i=E[F])!==null&&i!==void 0?i:{version:v};if(!n&&o[e]){var a=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(a.stack||a.message),!1}if(o.version!==v){var a=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+e+" does not match previously registered API v"+v);return r.error(a.stack||a.message),!1}return o[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+v+"."),!0}function S(e){var t,r,n=(t=E[F])===null||t===void 0?void 0:t.version;if(!(!n||!qe(n)))return(r=E[F])===null||r===void 0?void 0:r[e]}function b(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+v+".");var r=E[F];r&&delete r[e]}var Xt=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},qt=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},He=function(){function e(t){this._namespace=t.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("debug",this._namespace,t)},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("error",this._namespace,t)},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("info",this._namespace,t)},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("warn",this._namespace,t)},e.prototype.verbose=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("verbose",this._namespace,t)},e}();function I(e,t,r){var n=S("diag");if(n)return r.unshift(t),n[e].apply(n,qt([],Xt(r),!1))}var m;(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(m||(m={}));function Je(e,t){e<m.NONE?e=m.NONE:e>m.ALL&&(e=m.ALL),t=t||{};function r(n,i){var o=t[n];return typeof o=="function"&&e>=i?o.bind(t):function(){}}return{error:r("error",m.ERROR),warn:r("warn",m.WARN),info:r("info",m.INFO),debug:r("debug",m.DEBUG),verbose:r("verbose",m.VERBOSE)}}var Ht=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},Jt=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},Qt="diag",k=function(){function e(){function t(i){return function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var l=S("diag");if(l)return l[i].apply(l,Jt([],Ht(o),!1))}}var r=this,n=function(i,o){var a,l,s;if(o===void 0&&(o={logLevel:m.INFO}),i===r){var c=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((a=c.stack)!==null&&a!==void 0?a:c.message),!1}typeof o=="number"&&(o={logLevel:o});var p=S("diag"),f=Je((l=o.logLevel)!==null&&l!==void 0?l:m.INFO,i);if(p&&!o.suppressOverrideMessage){var x=(s=new Error().stack)!==null&&s!==void 0?s:"<failed to generate stacktrace>";p.warn("Current logger will be overwritten from "+x),f.warn("Current logger will overwrite one already registered from "+x)}return A("diag",f,r,!0)};r.setLogger=n,r.disable=function(){b(Qt,r)},r.createComponentLogger=function(i){return new He(i)},r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e}();function Qe(e){return Symbol.for(e)}var Zt=function(){function e(t){var r=this;r._currentContext=t?new Map(t):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,i){var o=new e(r._currentContext);return o._currentContext.set(n,i),o},r.deleteValue=function(n){var i=new e(r._currentContext);return i._currentContext.delete(n),i}}return e}(),Ze=new Zt;var er=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},tr=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},et=function(){function e(){}return e.prototype.active=function(){return Ze},e.prototype.with=function(t,r,n){for(var i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return r.call.apply(r,tr([n],er(i),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e}();var rr=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},nr=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},pe="context",or=new et,U=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(t){return A(pe,t,k.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(t,r,n){for(var i,o=[],a=3;a<arguments.length;a++)o[a-3]=arguments[a];return(i=this._getContextManager()).with.apply(i,nr([t,r,n],rr(o),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return S(pe)||or},e.prototype.disable=function(){this._getContextManager().disable(),b(pe,k.instance())},e}();var Y;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(Y||(Y={}));var me="0000000000000000",de="00000000000000000000000000000000",tt={traceId:de,spanId:me,traceFlags:Y.NONE};var h=function(){function e(t){t===void 0&&(t=tt),this._spanContext=t}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(t,r){return this},e.prototype.setAttributes=function(t){return this},e.prototype.addEvent=function(t,r){return this},e.prototype.addLink=function(t){return this},e.prototype.addLinks=function(t){return this},e.prototype.setStatus=function(t){return this},e.prototype.updateName=function(t){return this},e.prototype.end=function(t){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(t,r){},e}();var ye=Qe("OpenTelemetry Context Key SPAN");function X(e){return e.getValue(ye)||void 0}function rt(){return X(U.getInstance().active())}function N(e,t){return e.setValue(ye,t)}function nt(e){return e.deleteValue(ye)}function ot(e,t){return N(e,new h(t))}function q(e){var t;return(t=X(e))===null||t===void 0?void 0:t.spanContext()}var ir=/^([0-9a-f]{32})$/i,ar=/^[0-9a-f]{16}$/i;function sr(e){return ir.test(e)&&e!==de}function gr(e){return ar.test(e)&&e!==me}function H(e){return sr(e.traceId)&&gr(e.spanId)}function it(e){return new h(e)}var xe=U.getInstance(),J=function(){function e(){}return e.prototype.startSpan=function(t,r,n){n===void 0&&(n=xe.active());var i=!!r?.root;if(i)return new h;var o=n&&q(n);return cr(o)&&H(o)?new h(o):new h},e.prototype.startActiveSpan=function(t,r,n,i){var o,a,l;if(!(arguments.length<2)){arguments.length===2?l=r:arguments.length===3?(o=r,l=n):(o=r,a=n,l=i);var s=a??xe.active(),c=this.startSpan(t,o,s),p=N(s,c);return xe.with(p,l,void 0,c)}},e}();function cr(e){return typeof e=="object"&&typeof e.spanId=="string"&&typeof e.traceId=="string"&&typeof e.traceFlags=="number"}var lr=new J,at=function(){function e(t,r,n,i){this._provider=t,this.name=r,this.version=n,this.options=i}return e.prototype.startSpan=function(t,r,n){return this._getTracer().startSpan(t,r,n)},e.prototype.startActiveSpan=function(t,r,n,i){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):lr},e}();var st=function(){function e(){}return e.prototype.getTracer=function(t,r,n){return new J},e}();var ur=new st,ve=function(){function e(){}return e.prototype.getTracer=function(t,r,n){var i;return(i=this.getDelegateTracer(t,r,n))!==null&&i!==void 0?i:new at(this,t,r,n)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:ur},e.prototype.setDelegate=function(t){this._delegate=t},e.prototype.getDelegateTracer=function(t,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(t,r,n)},e}();var Se="trace",gt=function(){function e(){this._proxyTracerProvider=new ve,this.wrapSpanContext=it,this.isSpanContextValid=H,this.deleteSpan=nt,this.getSpan=X,this.getActiveSpan=rt,this.getSpanContext=q,this.setSpan=N,this.setSpanContext=ot}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(t){var r=A(Se,this._proxyTracerProvider,k.instance());return r&&this._proxyTracerProvider.setDelegate(t),r},e.prototype.getTracerProvider=function(){return S(Se)||this._proxyTracerProvider},e.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},e.prototype.disable=function(){b(Se,k.instance()),this._proxyTracerProvider=new ve},e}();var he=gt.getInstance();var Yn=he.getTracer("@eser/logging");var Te=(e,t,r)=>{let n=e.streamText(t,r);return{name:`ai-text/${e.provider}/${e.modelId}`,readable:new ReadableStream({async start(i){try{for await(let o of n)o.kind==="content_delta"&&i.enqueue(te(o.textDelta));i.close()}catch(o){i.error(o)}}})}};var dr={cc:"claude-code",ol:"ollama",oc:"opencode",oai:"openai",ant:"anthropic",gem:"gemini",vtx:"vertexai"},yr={"claude-code":"Claude Code",ollama:"Ollama",opencode:"OpenCode",kiro:"Kiro",anthropic:"Anthropic API",openai:"OpenAI API",gemini:"Gemini API",vertexai:"Vertex AI"},xr=e=>dr[e]??e,vr=async e=>{if(e){let t=T.process.stderr.getWriter(),r=ne({renderer:_e.ansi(),sink:oe.writable(new WritableStream({async write(n){await t.write(new TextEncoder().encode(String(n.data)))},close(){t.releaseLock()}}))});await K.configure({sinks:{stderr:B.getOutputSink(r)},loggers:[{category:["ai"],lowestLevel:g.Debug,sinks:["stderr"]}]})}return W.getLogger(["ai","ask"])},Sr=async e=>{await e.info("Auto-detecting AI provider...");try{if(await ie`which claude`.noThrow().code()===0)return await e.info("Claude Code detected."),"claude-code"}catch{}try{if((await fetch("http://localhost:11434/api/version",{signal:AbortSignal.timeout(1e3)})).ok)return await e.info("Ollama detected at localhost:11434."),"ollama"}catch{}try{if(await ie`which opencode`.noThrow().code()===0)return await e.info("OpenCode detected."),"opencode"}catch{}if(T.capabilities.env){if(T.env.has("ANTHROPIC_API_KEY"))return await e.info("Anthropic API key detected."),"anthropic";if(T.env.has("OPENAI_API_KEY"))return await e.info("OpenAI API key detected."),"openai"}throw new Error("No AI provider detected. Install claude, ollama, or set ANTHROPIC_API_KEY / OPENAI_API_KEY.")},hr=async e=>{switch(e){case"claude-code":return(await import("./claude-code-FZXKRWA5.js")).claudeCodeFactory;case"ollama":return(await import("./ollama-TM4MMP7N.js")).ollamaFactory;case"opencode":return(await import("./opencode-YGNBYWQL.js")).openCodeFactory;case"kiro":return(await import("./kiro-AC5LYTVB.js")).kiroFactory;case"anthropic":return(await import("./anthropic-UTLWCK66.js")).anthropicFactory;case"openai":return(await import("./openai-QGEN33SU.js")).openaiFactory;case"gemini":return(await import("./gemini-YR5KT32S.js")).geminiFactory;case"vertexai":return(await import("./vertexai-RUXZ24C2.js")).vertexaiFactory;default:throw new Error(`Unknown provider: ${e}`)}},lo=async e=>{let t=e??[],r=null,n=null,i=null,o=!1,a=!1,l=[],s=0;for(;s<t.length;){let f=t[s];if(f==="-p"||f==="--provider"){r=t[s+1]??null,s+=2;continue}if(f==="-m"||f==="--model"){n=t[s+1]??null,s+=2;continue}if(f==="--max-tokens"){let x=t[s+1];x!==void 0&&(i=Number(x)),s+=2;continue}if(f==="--json"){o=!0,s+=1;continue}if(f==="-v"||f==="--verbose"){a=!0,s+=1;continue}f.startsWith("-")||l.push(f),s+=1}let c=l.join(" ");if(c.length===0)return D({message:'Usage: ai ask "your prompt" [-p provider] [-m model] [--verbose]',exitCode:1});let p=await vr(a);try{let f=r!==null?xr(r):await Sr(p),x=yr[f]??f,Ce=n??Lr(f);await p.info(`Using ${x} (${Ce})`);let lt=await hr(f),Q=new Ie({factories:[lt]});await Q.addModel("default",{provider:f,model:Ce});let Z=Q.getDefault();if(Z===null)return D({message:"Failed to initialize model",exitCode:1});let we=[Fe("user",c)];if(await p.info(`Sending prompt (${c.length} chars)...`),o){let O=await Z.generateText({messages:we,maxTokens:i??void 0});await p.info(`Response received (${Ee(O).length} chars)`);let P=ne({sink:oe.stdout()});P.writeln(JSON.stringify(O,null,2)),await P.close()}else{let O=Te(Z,{messages:we,maxTokens:i??void 0});await Re().from(O).to(wr()).run();let P=T.process.stdout.getWriter();await P.write(new TextEncoder().encode(`
2
2
  `)),P.releaseLock()}return await Q.close(),Le(void 0)}catch(f){let x=f instanceof Error?f.message:String(f);return await p.error(x),a&&f instanceof Error&&f.cause!==void 0&&await p.debug(`Cause: ${String(f.cause)}`),D({message:x,exitCode:1})}},Tr=12,Cr=e=>new Promise(t=>setTimeout(t,e)),wr=(e=Tr)=>{let t=new TextEncoder;return{name:"typewriter",writable:new WritableStream({async write(r){let n=String(r.data),i=T.process.stdout.getWriter();for(let o of n)await i.write(t.encode(o)),await Cr(e);i.releaseLock()}})}},Lr=e=>{switch(e){case"claude-code":return"claude-sonnet-4-20250514";case"ollama":return"llama3";case"opencode":return"default";case"kiro":return"default";case"anthropic":return"claude-sonnet-4-20250514";case"openai":return"gpt-4o";case"gemini":return"gemini-2.0-flash";case"vertexai":return"gemini-2.0-flash";default:return"default"}};export{lo as main};
@@ -1 +1 @@
1
- import{c as v}from"./chunk-YK6UG66R.js";import{k as A}from"./chunk-TMC5H2A5.js";import{d as k,f as S,h as y,i as x,j as C}from"./chunk-LWCWPXCS.js";import{c as d,d as l,f as i,h as f,o as w,q as h,r as g}from"./chunk-Y6AFIAJP.js";import{a as u,b as r}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 p=>{let e=w({renderer:g.ansi(),sink:h.stdout()}),n=c.process.cwd(),o=y(p);if(!o.ok)return e.writeln(i(o.error)),await e.close(),r({exitCode:1});let m=(p??[]).filter(t=>!t.startsWith("--spec=")).join(" ")||"No reason given",s;try{s=await S(n,o.spec)}catch(t){let E=t instanceof Error?t.message:String(t);return e.writeln(i(E)),await e.close(),r({exitCode:1})}if(s.spec!==null){let t=`${n}/${k.specDir(s.spec)}`;try{await c.fs.stat(t)}catch{return e.writeln(i(`Active spec '${s.spec}' directory not found.`)),e.writeln(l("Run `noskills reset` to return to IDLE.")),await e.close(),r({exitCode:1})}}if(s.phase!=="EXECUTING")return e.writeln(i(`Cannot block in phase: ${s.phase}`)),await e.close(),r({exitCode:1});let a=A(s,m);return await x(n,a),a.spec!==null&&await C(n,a.spec,a),e.writeln(f("\u26A0")," Spec blocked: ",l(m)),e.writeln("Resolve with: ",d(`${v('next --answer="resolution"')}`)),await e.close(),u(void 0)};export{q as main};
1
+ import{c as v}from"./chunk-YK6UG66R.js";import{l as A}from"./chunk-FJCXMC2D.js";import{d as k,f as S,h as y,i as x,j as C}from"./chunk-QYMX2GR3.js";import{c as d,d as l,f as i,h as f,o as w,q as h,r as g}from"./chunk-Y6AFIAJP.js";import{a as u,b as r}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 p=>{let e=w({renderer:g.ansi(),sink:h.stdout()}),n=c.process.cwd(),o=y(p);if(!o.ok)return e.writeln(i(o.error)),await e.close(),r({exitCode:1});let m=(p??[]).filter(t=>!t.startsWith("--spec=")).join(" ")||"No reason given",s;try{s=await S(n,o.spec)}catch(t){let E=t instanceof Error?t.message:String(t);return e.writeln(i(E)),await e.close(),r({exitCode:1})}if(s.spec!==null){let t=`${n}/${k.specDir(s.spec)}`;try{await c.fs.stat(t)}catch{return e.writeln(i(`Active spec '${s.spec}' directory not found.`)),e.writeln(l("Run `noskills reset` to return to IDLE.")),await e.close(),r({exitCode:1})}}if(s.phase!=="EXECUTING")return e.writeln(i(`Cannot block in phase: ${s.phase}`)),await e.close(),r({exitCode:1});let a=A(s,m);return await x(n,a),a.spec!==null&&await C(n,a.spec,a),e.writeln(f("\u26A0")," Spec blocked: ",l(m)),e.writeln("Resolve with: ",d(`${v('next --answer="resolution"')}`)),await e.close(),u(void 0)};export{q as main};
@@ -0,0 +1 @@
1
+ import{a as C,d as k}from"./chunk-6FTHIS2Z.js";import{n as y}from"./chunk-FJCXMC2D.js";import{d as w,f as h,h as S,i as g,j as E}from"./chunk-QYMX2GR3.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};
@@ -1,3 +1,3 @@
1
- import{d as o}from"./chunk-LWCWPXCS.js";import{b as e}from"./chunk-MNEZ5QGX.js";var d=async(r,i,n)=>{let s=`${r}/${o.specFile(i)}`;try{let t=await e.fs.readTextFile(s);t=t.replace(/^## Status: .+$/m,`## Status: ${n}`),await e.fs.writeTextFile(s,t)}catch{}},u=async(r,i,n)=>{let s=`${r}/${o.specFile(i)}`;try{let t=await e.fs.readTextFile(s),a=new RegExp(`^(- )\\[ \\]( ${n}:.*)$`,"m");t=t.replace(a,"$1[x]$2"),await e.fs.writeTextFile(s,t)}catch{}},w=async(r,i,n,s)=>{let t=`${r}/${o.specDir(i)}/progress.json`;try{let a=await e.fs.readTextFile(t),c=JSON.parse(a);for(let p of c.tasks)p.id===n&&(p.status=s);c.updatedAt=new Date().toISOString(),await e.fs.writeTextFile(t,JSON.stringify(c,null,2)+`
1
+ import{d as o}from"./chunk-QYMX2GR3.js";import{b as e}from"./chunk-MNEZ5QGX.js";var d=async(r,i,n)=>{let s=`${r}/${o.specFile(i)}`;try{let t=await e.fs.readTextFile(s);t=t.replace(/^## Status: .+$/m,`## Status: ${n}`),await e.fs.writeTextFile(s,t)}catch{}},u=async(r,i,n)=>{let s=`${r}/${o.specFile(i)}`;try{let t=await e.fs.readTextFile(s),a=new RegExp(`^(- )\\[ \\]( ${n}:.*)$`,"m");t=t.replace(a,"$1[x]$2"),await e.fs.writeTextFile(s,t)}catch{}},w=async(r,i,n,s)=>{let t=`${r}/${o.specDir(i)}/progress.json`;try{let a=await e.fs.readTextFile(t),c=JSON.parse(a);for(let p of c.tasks)p.id===n&&(p.status=s);c.updatedAt=new Date().toISOString(),await e.fs.writeTextFile(t,JSON.stringify(c,null,2)+`
2
2
  `)}catch{}},f=async(r,i,n)=>{let s=`${r}/${o.specDir(i)}/progress.json`;try{let t=await e.fs.readTextFile(s),a=JSON.parse(t);a.status=n,a.updatedAt=new Date().toISOString(),await e.fs.writeTextFile(s,JSON.stringify(a,null,2)+`
3
3
  `)}catch{}};export{d as a,u as b,w as c,f 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,3 @@
1
+ import{c as m}from"./chunk-MNEZ5QGX.js";import{m as v}from"./chunk-4BH6CF3J.js";var p=class extends Error{constructor(e,n,s,i){super(e);this.command=n;this.code=s;this.stderr=i;this.name="CommandError"}};var l=new TextDecoder,h=class r{#t;#r;#e;constructor(t,e=[],n={}){this.#t=t,this.#r=e,this.#e={throwOnError:!0,stdout:"piped",stderr:"piped",...n}}cwd(t){return new r(this.#t,this.#r,{...this.#e,cwd:t})}env(t,e){let n=this.#e.env??{},s;return typeof t=="string"&&e!==void 0?s={...n,[t]:e}:t!==null&&typeof t=="object"?s={...n,...t}:s=n,new r(this.#t,this.#r,{...this.#e,env:s})}stdin(t){return new r(this.#t,this.#r,{...this.#e,stdin:t})}stdout(t){return new r(this.#t,this.#r,{...this.#e,stdout:t})}stderr(t){return new r(this.#t,this.#r,{...this.#e,stderr:t})}timeout(t){return new r(this.#t,this.#r,{...this.#e,timeout:t})}noThrow(){return new r(this.#t,this.#r,{...this.#e,throwOnError:!1})}quiet(){return new r(this.#t,this.#r,{...this.#e,stdout:"null",stderr:"null"})}printCommand(){let t=[this.#t,...this.#r].join(" ");return console.log(`$ ${t}`),this}async spawn(){let{runtime:t}=m,e=await t.exec.spawn(this.#t,this.#r,{cwd:this.#e.cwd,env:this.#e.env,stdin:this.#e.stdin,stdout:this.#e.stdout,stderr:this.#e.stderr});if(!e.success&&this.#e.throwOnError===!0){let n=l.decode(e.stderr);throw new p(`Command failed with exit code ${e.code}: ${this.#t}`,this.#t,e.code,n)}return e}async text(t="stdout"){let e=await this.spawn();switch(t){case"stdout":return l.decode(e.stdout).trim();case"stderr":return l.decode(e.stderr).trim();case"combined":return(l.decode(e.stdout)+l.decode(e.stderr)).trim()}}async json(){let t=await this.text();return JSON.parse(t)}async lines(){let t=await this.text();return t===""?[]:t.split(`
2
+ `)}async bytes(){return(await this.spawn()).stdout}async code(){return(await this.noThrow().spawn()).code}pipe(t){return new f([this,t])}child(){let{runtime:t}=m;return t.exec.spawnChild(this.#t,this.#r,{cwd:this.#e.cwd,env:this.#e.env,stdin:this.#e.stdin??"piped",stdout:this.#e.stdout??"piped",stderr:this.#e.stderr??"piped"})}},f=class r{#t;constructor(t){this.#t=t}pipe(t){return new r([...this.#t,t])}async text(){let t="";for(let e of this.#t){let n=await e.spawn();t=l.decode(n.stdout)}return t.trim()}async lines(){let t=await this.text();return t===""?[]:t.split(`
3
+ `)}};var y=(r,t)=>{let e=[];for(let s=0;s<r.length;s++){let i=r[s];if(i!==void 0&&e.push(i),s<t.length){let d=t[s];Array.isArray(d)?e.push(d.map(c=>S(String(c))).join(" ")):d!=null&&e.push(S(String(d)))}}let n=e.join("").trim();return O(n)},S=r=>/[\s"'\\$`]/.test(r)?`'${r.replace(/'/g,"'\\''")}'`:r,O=r=>{let t=[],e="",n=!1,s=!1,i=!1;for(let c=0;c<r.length;c++){let a=r[c];if(i){e+=a,i=!1;continue}if(a==="\\"){i=!0;continue}if(a==="'"&&!s){n=!n;continue}if(a==='"'&&!n){s=!s;continue}if(a===" "&&!n&&!s){e.length>0&&(t.push(e),e="");continue}e+=a}e.length>0&&t.push(e);let d=t[0];return d===void 0?["",[]]:[d,t.slice(1)]};var E=(r,...t)=>{let[e,n]=y(r,t);return new h(e,n)};var B=/\x04/g,A=/^Script (started|done),? ?(output file is )?[^\n]*\n?/gm,M=r=>r.replace(B,"").replace(A,""),k=(r,t)=>{let e=v();return e==="darwin"?{cmd:"script",args:["-q","/dev/null",r,...t],usesScript:!0}:e==="linux"?{cmd:"script",args:["-qc",t.length>0?`${r} ${t.map(s=>`'${s.replace(/'/g,"'\\''")}'`).join(" ")}`:r,"/dev/null"],usesScript:!0}:{cmd:r,args:t,usesScript:!1}},I=async r=>{let{runtime:t}=m,e=r.args!==void 0?[...r.args]:[],n=k(r.command,e),s={...r.env,TERM:"xterm-256color",COLUMNS:String(r.cols??80),LINES:String(r.rows??24)},i=t.exec.spawnChild(n.cmd,[...n.args],{cwd:r.cwd,env:s,stdin:"piped",stdout:"piped",stderr:"piped"}),d=new TextDecoder,c=new TextEncoder,a=[],C=!1,b=o=>{let u=n.usesScript?M(o):o;if(u.length!==0)for(let g of a)g(u)},x=async o=>{let u=o.getReader();try{for(;;){let{done:g,value:T}=await u.read();if(g)break;b(d.decode(T))}}catch{}finally{u.releaseLock()}},R=()=>{C||(C=!0,i.stdout&&x(i.stdout),i.stderr&&x(i.stderr))},P=null;return i.stdin&&(P=i.stdin.getWriter()),{onData(o){a.push(o),R()},write(o){P?.write(c.encode(o)).catch(()=>{})},resize(o,u){},kill(o){try{i.kill(o==="SIGKILL"?"SIGKILL":"SIGTERM")}catch{}},get pid(){return i.pid},get exitCode(){return i.status.then(o=>o.code)}}};var w=class{#t=new Map;get size(){return this.#t.size}add(t,e){let n={id:t,process:e,active:!0};return this.#t.set(t,n),e.exitCode.then(()=>{n.active=!1}).catch(()=>{n.active=!1}),n}get(t){return this.#t.get(t)}remove(t){let e=this.#t.get(t);return e===void 0?!1:(e.active&&e.process.kill(),this.#t.delete(t),!0)}list(){return[...this.#t.values()]}async killAll(t="SIGTERM"){for(let s of this.#t.values())s.active&&s.process.kill(t);let e=3e3,n=Date.now();for(let s of this.#t.values())if(s.active){let i=e-(Date.now()-n);i>0&&await Promise.race([s.process.exitCode,new Promise(d=>setTimeout(d,i))])}}forceKillAll(){for(let t of this.#t.values())t.active&&(t.process.kill("SIGKILL"),t.active=!1);this.#t.clear()}};export{p as a,h as b,y as c,E as d,I as e,w as f};
@@ -0,0 +1 @@
1
+ import{d as a}from"./chunk-QYMX2GR3.js";var i={UNINITIALIZED:["IDLE"],IDLE:["DISCOVERY","COMPLETED","FREE"],FREE:["IDLE"],DISCOVERY:["DISCOVERY_REVIEW","COMPLETED"],DISCOVERY_REVIEW:["DISCOVERY_REVIEW","SPEC_DRAFT","COMPLETED"],SPEC_DRAFT:["SPEC_DRAFT","SPEC_APPROVED","COMPLETED"],SPEC_APPROVED:["EXECUTING","COMPLETED"],EXECUTING:["COMPLETED","BLOCKED"],BLOCKED:["EXECUTING","COMPLETED"],COMPLETED:["IDLE","DISCOVERY"]},l=(e,s)=>i[e].includes(s),t=(e,s)=>{if(!l(e,s))throw new Error(`Invalid phase transition: ${e} \u2192 ${s}. Allowed: ${i[e].join(", ")}`)},h=(e,s)=>(t(e.phase,s),{...e,phase:s}),E=(e,s,n,o)=>(t(e.phase,"DISCOVERY"),{...e,phase:"DISCOVERY",spec:s,specDescription:o??null,branch:n,discovery:{answers:[],completed:!1,currentQuestion:0,audience:"human",approved:!1},specState:{path:null,status:"none"},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[],debtCounter:0,naItems:[]},decisions:[]}),u=e=>(t(e.phase,"FREE"),{...e,phase:"FREE"}),d=e=>(t(e.phase,"IDLE"),{...e,phase:"IDLE"}),m=(e,s,n)=>{if(e.phase!=="DISCOVERY"&&e.phase!=="DISCOVERY_REVIEW")throw new Error(`Cannot add discovery answer in phase: ${e.phase}`);let r=[...e.discovery.answers.filter(c=>c.questionId!==s),{questionId:s,answer:n}];return{...e,discovery:{...e.discovery,answers:r}}},S=e=>{if(e.phase!=="DISCOVERY")throw new Error(`Cannot complete discovery in phase: ${e.phase}`);return{...e,phase:"DISCOVERY_REVIEW",discovery:{...e.discovery,completed:!0},specState:{path:a.specFile(e.spec),status:"draft"}}},C=e=>(t(e.phase,"SPEC_DRAFT"),{...e,phase:"SPEC_DRAFT"}),D=e=>{if(e.phase!=="DISCOVERY_REVIEW")throw new Error(`Cannot approve discovery answers in phase: ${e.phase}`);return{...e,discovery:{...e.discovery,approved:!0}}},F=e=>{if(e.phase!=="DISCOVERY")throw new Error(`Cannot advance discovery question in phase: ${e.phase}`);return{...e,discovery:{...e.discovery,currentQuestion:e.discovery.currentQuestion+1}}},I=e=>(t(e.phase,"SPEC_APPROVED"),{...e,phase:"SPEC_APPROVED",specState:{...e.specState,status:"approved"}}),v=e=>(t(e.phase,"EXECUTING"),{...e,phase:"EXECUTING",discovery:{...e.discovery,completed:!0,approved:!1},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[],debtCounter:0,naItems:[]}});var R=(e,s)=>(t(e.phase,"BLOCKED"),{...e,phase:"BLOCKED",execution:{...e.execution,lastProgress:`BLOCKED: ${s}`}}),O=(e,s)=>({...e,decisions:[...e.decisions,s]}),P=(e,s,n)=>(t(e.phase,"COMPLETED"),{...e,phase:"COMPLETED",completionReason:s,completedAt:new Date().toISOString(),completionNote:n??null}),w=e=>{if(e.phase!=="COMPLETED")throw new Error(`Cannot reopen in phase: ${e.phase}`);return{...e,phase:"DISCOVERY",reopenedFrom:e.completionReason,completionReason:null,completedAt:null,completionNote:null,discovery:{...e.discovery,completed:!1,currentQuestion:0},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[],debtCounter:0,naItems:[]},classification:null}},x=(e,s)=>{if(e.phase!=="EXECUTING"&&e.phase!=="BLOCKED")throw new Error(`Cannot revisit in phase: ${e.phase}. Only EXECUTING or BLOCKED can revisit.`);let n={from:e.phase,reason:s,completedTasks:[...e.execution.completedTasks],timestamp:new Date().toISOString()};return{...e,phase:"DISCOVERY",discovery:{...e.discovery,completed:!1,currentQuestion:0,approved:!1},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[],debtCounter:0,naItems:[]},classification:null,revisitHistory:[...e.revisitHistory??[],n]}},f=e=>({...e,phase:"IDLE",spec:null,branch:null,discovery:{answers:[],completed:!1,currentQuestion:0,audience:"human",approved:!1},specState:{path:null,status:"none"},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[],debtCounter:0,naItems:[]},decisions:[],classification:null,completionReason:null,completedAt:null,completionNote:null,reopenedFrom:null});export{h as a,E as b,u as c,d,m as e,S as f,C as g,D as h,F as i,I as j,v as k,R as l,O as m,P as n,w as o,x as p,f as q};