noskills 4.1.34 → 4.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -17
- package/chunks/{approve-5N5LJ2WQ.js → approve-YXRIBZVV.js} +1 -1
- package/chunks/{ask-TR4ZPBU5.js → ask-4XOYE32R.js} +1 -1
- package/chunks/block-D67USBJS.js +1 -0
- package/chunks/{chunk-AT7V3AKV.js → chunk-24SANXOZ.js} +1 -1
- package/chunks/{chunk-6C2MLMD6.js → chunk-3AZBET4N.js} +1 -1
- package/chunks/{chunk-5ORUHRWF.js → chunk-3HRRWTVF.js} +1 -1
- package/chunks/{chunk-TGA7MX5P.js → chunk-42EQ3GZJ.js} +1 -1
- package/chunks/{chunk-HLQNHWXS.js → chunk-4ODVKO5Y.js} +1 -1
- package/chunks/{chunk-4IFPLK7L.js → chunk-EZH232V7.js} +1 -1
- package/chunks/{chunk-LZSLKXJE.js → chunk-GSYCN7EG.js} +2 -2
- package/chunks/{chunk-RVIPYZ7F.js → chunk-IR75X4G7.js} +1 -1
- package/chunks/{chunk-7ADGJB4H.js → chunk-IVSTITPL.js} +1 -1
- package/chunks/{chunk-AB4ZUDV6.js → chunk-LG5R766Y.js} +1 -1
- package/chunks/{chunk-ZS6ZJ4YL.js → chunk-O5KQZHIN.js} +1 -1
- package/chunks/chunk-UA3VIHYO.js +1 -0
- package/chunks/{chunk-OJUA2UZK.js → chunk-WUVVLUU5.js} +1 -1
- package/chunks/{chunk-KBNVVXFC.js → chunk-XCVAHUBM.js} +1 -1
- package/chunks/{chunk-LICLZJKZ.js → chunk-ZQ77HAFD.js} +1 -1
- package/chunks/{claude-code-3XV3QOZJ.js → claude-code-6AAAJZKK.js} +1 -1
- package/chunks/{concern-NGOU3XMP.js → concern-RHWJ53OJ.js} +1 -1
- package/chunks/{done-IBA3FUE5.js → done-PTJRZ26W.js} +1 -1
- package/chunks/init-FPQ6OYIO.js +1 -0
- package/chunks/{invoke-hook-AWHCXLLQ.js → invoke-hook-MLGEIW5H.js} +1 -1
- package/chunks/{kiro-IXVNKPRT.js → kiro-MHP573OZ.js} +1 -1
- package/chunks/{list-UT3MSC6R.js → list-GRXQ2DIM.js} +1 -1
- package/chunks/{mod-LUIKS5KC.js → mod-V2Z6HGL6.js} +1 -1
- package/chunks/{next-EO3BYTU5.js → next-ZNQ3ICRE.js} +1 -1
- package/chunks/{ollama-K4QCYLVL.js → ollama-24ACY3UB.js} +1 -1
- package/chunks/{opencode-QBVD5FAD.js → opencode-LFWHRZPL.js} +1 -1
- package/chunks/{purge-RKZ7SY3Z.js → purge-JSAHNTXI.js} +1 -1
- package/chunks/{reset-VZO7YXM6.js → reset-CWI7K6GC.js} +1 -1
- package/chunks/{rule-YVHDEVR2.js → rule-GP665FCC.js} +1 -1
- package/chunks/{run-O6SYZE7T.js → run-5XHWASUP.js} +1 -1
- package/chunks/{spec-RTBL43T7.js → spec-JET4WJSV.js} +1 -1
- package/chunks/{status-GQYCHJ2W.js → status-2POWAIVV.js} +1 -1
- package/chunks/{sync-JDMWRRGH.js → sync-RWNLL4VW.js} +1 -1
- package/chunks/{watch-7DNXJAAQ.js → watch-5OC7T473.js} +1 -1
- package/noskills.js +1 -1
- package/package.json +1 -1
- package/chunks/block-WWW3MXHP.js +0 -1
- package/chunks/chunk-HS6FTDDW.js +0 -1
- package/chunks/init-XVNWKPT7.js +0 -1
package/README.md
CHANGED
|
@@ -57,17 +57,74 @@ emerge. If you want to discover those limits together, jump on board.
|
|
|
57
57
|
The name mirrors the SQL -> NoSQL shift: skills define everything upfront,
|
|
58
58
|
noskills determines what's needed at runtime.
|
|
59
59
|
|
|
60
|
+
## Philosophy — A Scrum Master for Agents
|
|
61
|
+
|
|
62
|
+
I used to teach Agile. In those trainings, I'd go all the way back to the Toyota
|
|
63
|
+
Production System to explain why we do what we do.
|
|
64
|
+
|
|
65
|
+
I'd talk about WIP limits — not as a process rule, but as acknowledgment that
|
|
66
|
+
human attention is finite. I'd explain how story points emerged from the need to
|
|
67
|
+
break work into pieces small enough for a single person's working memory. I'd
|
|
68
|
+
walk through why we have daily standups (people lose track), why we have
|
|
69
|
+
Definition of Done (everyone's "done" is different), why we have acceptance
|
|
70
|
+
criteria (without them, work drifts from intent). I'd talk about cognitive load
|
|
71
|
+
— how the brain starts dropping things when you pile on too much context.
|
|
72
|
+
|
|
73
|
+
When I first encountered context rot in AI agents, it felt familiar. The agent
|
|
74
|
+
starts strong, makes a great plan, then gradually loses the plot — forgets
|
|
75
|
+
instructions, gets sloppy, declares things "done" that aren't. I'd seen this in
|
|
76
|
+
humans. The practices we built around human limitations applied directly.
|
|
77
|
+
|
|
78
|
+
When I saw Ralph loops, I got excited — they felt like sprints. Each iteration
|
|
79
|
+
starts clean: fresh context, clear goal, defined scope. Just like a sprint
|
|
80
|
+
protects the team from mid-sprint chaos, a Ralph loop protects the agent from
|
|
81
|
+
context accumulation. But just as sprint quality depends on what goes INTO the
|
|
82
|
+
sprint, loop quality depends on what context the agent receives.
|
|
83
|
+
|
|
84
|
+
I'd also teach Jidoka — one of the pillars of the Toyota Production System.
|
|
85
|
+
Jidoka means "automation with a human touch." The machine runs autonomously, but
|
|
86
|
+
when it detects an anomaly, it stops and calls a human. The human doesn't watch
|
|
87
|
+
every step — they intervene at the right moments. Production quality comes from
|
|
88
|
+
human and machine working together, each doing what they're best at.
|
|
89
|
+
|
|
90
|
+
noskills is Jidoka for AI coding. The agent runs autonomously through tasks, but
|
|
91
|
+
at every phase transition — discovery, spec approval, blocked decisions — it
|
|
92
|
+
stops and the human decides. The human doesn't watch every line of code. They
|
|
93
|
+
intervene at the moments that matter: what to build, whether the plan is right,
|
|
94
|
+
which tradeoffs to accept. The agent handles execution; the human handles
|
|
95
|
+
judgment.
|
|
96
|
+
|
|
97
|
+
That's why I stopped using skills and built a scrum master instead:
|
|
98
|
+
|
|
99
|
+
- **Ralph loops are sprints** — fresh context, clear scope, no carryover rot.
|
|
100
|
+
- **Discovery is sprint planning** — the same questions a good PM asks before
|
|
101
|
+
work starts.
|
|
102
|
+
- **Backpressure is Definition of Done** — "done" requires evidence, not
|
|
103
|
+
declaration.
|
|
104
|
+
- **Debt tracking is the sprint board** — unfinished items don't vanish, they
|
|
105
|
+
carry forward with increasing urgency.
|
|
106
|
+
- **Concerns are team values** — "we care about open source" shapes every
|
|
107
|
+
decision, just like team values shape how a team works.
|
|
108
|
+
- **Phase transitions are Jidoka stops** — the machine pauses, the human
|
|
109
|
+
decides, then the machine continues.
|
|
110
|
+
|
|
111
|
+
The insight isn't technical. It's that the practices we spent decades developing
|
|
112
|
+
for human teams apply directly to AI agents — because the underlying problem is
|
|
113
|
+
the same: finite attention, drifting focus, and the need for structure to keep
|
|
114
|
+
work on track.
|
|
115
|
+
|
|
60
116
|
## Getting Started with Claude Code
|
|
61
117
|
|
|
62
118
|
Open Claude Code and paste:
|
|
63
119
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
120
|
+
Run `eser noskills init`
|
|
121
|
+
|
|
122
|
+
If `eser` CLI is not installed:
|
|
67
123
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
noskills
|
|
124
|
+
Run `npx eser@latest noskills init`
|
|
125
|
+
|
|
126
|
+
That's it. noskills will detect Claude Code, set up hooks, generate `CLAUDE.md`,
|
|
127
|
+
and present your next options automatically.
|
|
71
128
|
|
|
72
129
|
If you want to add this to an existing project where teammates also use
|
|
73
130
|
noskills, the init scaffolds `.eser/` which should be committed to your repo.
|
|
@@ -94,10 +151,10 @@ to prompt-engineer the agent's behavior — noskills handles that.
|
|
|
94
151
|
eser noskills init
|
|
95
152
|
eser noskills concern add beautiful-product
|
|
96
153
|
eser noskills spec new "photo upload"
|
|
97
|
-
eser noskills next -o text # Shows
|
|
98
|
-
eser noskills next --answer="
|
|
99
|
-
|
|
100
|
-
|
|
154
|
+
eser noskills next -o text # Shows all 6 questions at once
|
|
155
|
+
eser noskills next --answer='{"status_quo":"...","ambition":"...","reversibility":"...","user_impact":"...","verification":"...","scope_boundary":"..."}' -o text
|
|
156
|
+
# Classification: what does this spec involve?
|
|
157
|
+
eser noskills next --answer='{"involvesUI":true,"involvesPublicAPI":false,"involvesMigration":false,"involvesDataHandling":false}' -o text
|
|
101
158
|
eser noskills approve
|
|
102
159
|
eser noskills next --answer="start" -o text # Begin execution
|
|
103
160
|
eser noskills next --answer="task-1 done" -o text
|
|
@@ -107,6 +164,10 @@ eser noskills next --answer='{"completed":["endpoint works"],"remaining":["error
|
|
|
107
164
|
eser noskills status -o markdown
|
|
108
165
|
```
|
|
109
166
|
|
|
167
|
+
After discovery, noskills asks you to classify the spec (UI, API, migration,
|
|
168
|
+
data handling). If you skip this by running `approve` directly, all concern
|
|
169
|
+
sections default to N/A — the spec stays clean.
|
|
170
|
+
|
|
110
171
|
The entire lifecycle works without any agent. noskills is the orchestrator —
|
|
111
172
|
agents and humans are both consumers.
|
|
112
173
|
|
|
@@ -125,7 +186,13 @@ eser noskills run --max-iterations=20 # Safety valve
|
|
|
125
186
|
eser noskills run --max-turns=15 # Turns per agent process
|
|
126
187
|
```
|
|
127
188
|
|
|
128
|
-
Each iteration is a fresh `claude -p` process with zero context accumulation
|
|
189
|
+
Each iteration is a fresh `claude -p` process with zero context accumulation —
|
|
190
|
+
this is the Ralph loop pattern (originated by Geoff Huntley). AI agents suffer
|
|
191
|
+
from context rot: the longer they work, the more stale instructions accumulate
|
|
192
|
+
and performance degrades. The Ralph loop solves this by restarting the agent
|
|
193
|
+
every iteration with fresh context while persisting state in files. noskills IS
|
|
194
|
+
the Ralph loop — no separate bash script needed.
|
|
195
|
+
|
|
129
196
|
State persists in `.eser/.state/state.json` between iterations. The Stop hook
|
|
130
197
|
snapshots git state automatically. Verification backpressure prevents advancing
|
|
131
198
|
past broken tests. When `autoCommit: true` in `manifest.yml`, the `noskills run`
|
|
@@ -442,12 +509,13 @@ noskills next --answer='{"involvesUI":true,"involvesPublicAPI":false,"involvesMi
|
|
|
442
509
|
noskills installs Claude Code hooks that handle state bookkeeping without
|
|
443
510
|
spending LLM tokens:
|
|
444
511
|
|
|
445
|
-
| Hook | Event
|
|
446
|
-
| ------------------- |
|
|
447
|
-
| **pre-tool-use** | PreToolUse
|
|
448
|
-
| **stop** | Stop
|
|
449
|
-
| **post-file-write** | PostToolUse
|
|
450
|
-
| **post-bash** | PostToolUse
|
|
512
|
+
| Hook | Event | What it does |
|
|
513
|
+
| ------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
514
|
+
| **pre-tool-use** | PreToolUse | Blocks file edits outside EXECUTING phase. Blocks git write commands. Blocks edits when pendingClear is set. |
|
|
515
|
+
| **stop** | Stop | Increments iteration counter, snapshots `git diff` into state, checks restart threshold. The Ralph loop's heartbeat. |
|
|
516
|
+
| **post-file-write** | PostToolUse | Logs modified file paths to `.eser/.state/files-changed.jsonl` |
|
|
517
|
+
| **post-bash** | PostToolUse | Logs noskills CLI invocations for observability |
|
|
518
|
+
| **session-start** | SessionStart | Runs `noskills next` at session start so the agent is immediately oriented. No CLAUDE.md reading needed — the hook delivers the current instruction. |
|
|
451
519
|
|
|
452
520
|
Hooks are CLI subcommands (`noskills invoke-hook <name>`), not generated script
|
|
453
521
|
files. This avoids ESM/CJS issues — the same Deno entry point handles
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C}from"./chunk-
|
|
1
|
+
import{a as C}from"./chunk-3HRRWTVF.js";import"./chunk-IVSTITPL.js";import{a as P,d as R}from"./chunk-XCVAHUBM.js";import{e as y}from"./chunk-4ODVKO5Y.js";import{a as p}from"./chunk-UXRWSNVZ.js";import{e as h,f as S,k as g,o as v}from"./chunk-WUVVLUU5.js";import{c as n,d as c,f as l,g as m,k as d,o as f,q as u,r as w}from"./chunk-EZH232V7.js";import{a as i}from"./chunk-2N4GTHXQ.js";import{b as o}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var $=async E=>{let r=f({renderer:w.ansi(),sink:u.stdout()}),s=o.process.cwd(),e=await h(s),a=await g(s);if(e.phase==="SPEC_DRAFT"){if(e.classification===null&&e.spec!==null){let A=(await v(s)).filter(D=>a?.concerns.includes(D.id)??!1);try{await C(s,e,A)}catch{}}let t=y(e);await S(s,t),t.spec!==null&&(await P(s,t.spec,"approved"),await R(s,t.spec,"approved")),r.writeln(m("\u2714")," Spec approved. Phase: ",d("SPEC_APPROVED")),r.writeln("When ready, run ",n(`${p('next --answer="start"',a)}`)," to begin execution.")}else e.phase==="DISCOVERY"&&e.discovery.completed?(r.writeln(c("Discovery complete. Spec draft already generated.")),r.writeln("Review the spec and run ",n(p("approve",a))," again when in SPEC_DRAFT phase.")):r.writeln(l(`Cannot approve in phase: ${e.phase}`));return await r.close(),i(void 0)};export{$ 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-4IFPLK7L.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-6C2MLMD6.js";import{a as T}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import{d as ee}from"./chunk-DXB73IDG.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-3XV3QOZJ.js")).claudeCodeFactory;case"ollama":return(await import("./ollama-K4QCYLVL.js")).ollamaFactory;case"opencode":return(await import("./opencode-QBVD5FAD.js")).openCodeFactory;case"kiro":return(await import("./kiro-IXVNKPRT.js")).kiroFactory;case"anthropic":return(await import("./anthropic-GKH6HH6J.js")).anthropicFactory;case"openai":return(await import("./openai-ZNKOR4CD.js")).openaiFactory;case"gemini":return(await import("./gemini-Z57NY6WY.js")).geminiFactory;case"vertexai":return(await import("./vertexai-WVENJL2F.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-EZH232V7.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-3AZBET4N.js";import{b as T}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import{d as ee}from"./chunk-DXB73IDG.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-6AAAJZKK.js")).claudeCodeFactory;case"ollama":return(await import("./ollama-24ACY3UB.js")).ollamaFactory;case"opencode":return(await import("./opencode-LFWHRZPL.js")).openCodeFactory;case"kiro":return(await import("./kiro-MHP573OZ.js")).kiroFactory;case"anthropic":return(await import("./anthropic-GKH6HH6J.js")).anthropicFactory;case"openai":return(await import("./openai-ZNKOR4CD.js")).openaiFactory;case"gemini":return(await import("./gemini-Z57NY6WY.js")).geminiFactory;case"vertexai":return(await import("./vertexai-WVENJL2F.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as k}from"./chunk-4ODVKO5Y.js";import{a as g}from"./chunk-UXRWSNVZ.js";import{e as w,f,k as h}from"./chunk-WUVVLUU5.js";import{c as i,d as m,f as l,h as c,o as p,q as d,r as u}from"./chunk-EZH232V7.js";import{a as o,b as n}from"./chunk-2N4GTHXQ.js";import{b as a}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var $=async b=>{let e=p({renderer:u.ansi(),sink:d.stdout()}),s=a.process.cwd(),r=b?.join(" ")??"No reason given",t=await w(s),x=await h(s);if(t.phase!=="EXECUTING")return e.writeln(l(`Cannot block in phase: ${t.phase}`)),await e.close(),n({exitCode:1});let y=k(t,r);return await f(s,y),e.writeln(c("\u26A0")," Spec blocked: ",m(r)),e.writeln("Resolve with: ",i(`${g('next --answer="resolution"',x)}`)),await e.close(),o(void 0)};export{$ as main};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as i}from"./chunk-OLM5RTFK.js";import{b as d,d as c}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-OLM5RTFK.js";import{b as d,d as c}from"./chunk-3AZBET4N.js";var y=async(r,t)=>{let e=t.properties?.binPath;if(e!==void 0)return e;try{let n=await c`which ${r}`.noThrow().text();if(n.length>0)return n}catch{}throw new i(`Binary "${r}" not found. Set properties.binPath in config or ensure it is on PATH.`,{provider:r})},f=(r,t,e)=>{let s=new d(r,[...t],{stdin:"null",stdout:"piped",stderr:"piped",cwd:e?.cwd,env:e?.env}).child();if(e?.signal!==void 0){let o=e.signal;o.aborted?s.kill("SIGTERM"):o.addEventListener("abort",()=>{s.kill("SIGTERM")},{once:!0})}return{stdout:s.stdout,stderr:s.stderr,waitForExit:async()=>{let o=await s.status;return{code:o.code,success:o.success}},kill:o=>{s.kill(o??"SIGTERM")}}},a=new TextDecoder;async function*m(r){let t=r.getReader(),e="";try{let n=await t.read();for(;n.done!==!0;){e+=a.decode(n.value,{stream:!0});let o=e.split(`
|
|
2
2
|
`);e=o.pop()??"";for(let u of o){let l=u.trim();if(l.length!==0)try{yield JSON.parse(l)}catch{}}n=await t.read()}let s=e.trim();if(s.length>0)try{yield JSON.parse(s)}catch{}}finally{t.releaseLock()}}var h=async(r,t)=>{let e=r.getReader(),n=[],s=await e.read();for(;s.done!==!0;)n.push(a.decode(s.value,{stream:!0})),s=await e.read();return e.releaseLock(),{content:[{kind:"text",text:n.join("").trim()}],stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0},modelId:t}},w=async r=>{let t=r.getReader(),e=[],n=await t.read();for(;n.done!==!0;)e.push(a.decode(n.value,{stream:!0})),n=await t.read();return t.releaseLock(),e.join("").trim()},x=(r,t,e)=>{if(t===0)return null;let n=e.length>0?`${r} exited with code ${t}: ${e}`:`${r} exited with code ${t}`;return t===1?new i(n,{provider:r}):t===126||t===127?new i(`${r} binary not found or not executable (exit code ${t})`,{provider:r}):new i(n,{provider:r})},b=(r,t)=>{let e=[];t!==void 0&&(e.push(t),e.push(""));for(let n of r)for(let s of n.content)s.kind==="text"&&e.push(s.text);return e.join(`
|
|
3
3
|
`)};export{y as a,f as b,m as c,h as d,w as e,x as f,b as g};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as l}from"./chunk-UA3VIHYO.js";var a=class extends Error{constructor(e,n,s,o){super(e);this.command=n;this.code=s;this.stderr=o;this.name="CommandError"}};var u=new TextDecoder,c=class r{#e;#r;#t;constructor(t,e=[],n={}){this.#e=t,this.#r=e,this.#t={throwOnError:!0,stdout:"piped",stderr:"piped",...n}}cwd(t){return new r(this.#e,this.#r,{...this.#t,cwd:t})}env(t,e){let n=this.#t.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.#e,this.#r,{...this.#t,env:s})}stdin(t){return new r(this.#e,this.#r,{...this.#t,stdin:t})}stdout(t){return new r(this.#e,this.#r,{...this.#t,stdout:t})}stderr(t){return new r(this.#e,this.#r,{...this.#t,stderr:t})}timeout(t){return new r(this.#e,this.#r,{...this.#t,timeout:t})}noThrow(){return new r(this.#e,this.#r,{...this.#t,throwOnError:!1})}quiet(){return new r(this.#e,this.#r,{...this.#t,stdout:"null",stderr:"null"})}printCommand(){let t=[this.#e,...this.#r].join(" ");return console.log(`$ ${t}`),this}async spawn(){let{runtime:t}=l,e=await t.exec.spawn(this.#e,this.#r,{cwd:this.#t.cwd,env:this.#t.env,stdin:this.#t.stdin,stdout:this.#t.stdout,stderr:this.#t.stderr});if(!e.success&&this.#t.throwOnError===!0){let n=u.decode(e.stderr);throw new a(`Command failed with exit code ${e.code}: ${this.#e}`,this.#e,e.code,n)}return e}async text(t="stdout"){let e=await this.spawn();switch(t){case"stdout":return u.decode(e.stdout).trim();case"stderr":return u.decode(e.stderr).trim();case"combined":return(u.decode(e.stdout)+u.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
2
|
`)}async bytes(){return(await this.spawn()).stdout}async code(){return(await this.noThrow().spawn()).code}pipe(t){return new p([this,t])}child(){let{runtime:t}=l;return t.exec.spawnChild(this.#e,this.#r,{cwd:this.#t.cwd,env:this.#t.env,stdin:this.#t.stdin??"piped",stdout:this.#t.stdout??"piped",stderr:this.#t.stderr??"piped"})}},p=class r{#e;constructor(t){this.#e=t}pipe(t){return new r([...this.#e,t])}async text(){let t="";for(let e of this.#e){let n=await e.spawn();t=u.decode(n.stdout)}return t.trim()}async lines(){let t=await this.text();return t===""?[]:t.split(`
|
|
3
3
|
`)}};var h=(r,t)=>{let e=[];for(let s=0;s<r.length;s++){let o=r[s];if(o!==void 0&&e.push(o),s<t.length){let i=t[s];Array.isArray(i)?e.push(i.map(m=>w(String(m))).join(" ")):i!=null&&e.push(w(String(i)))}}let n=e.join("").trim();return f(n)},w=r=>/[\s"'\\$`]/.test(r)?`'${r.replace(/'/g,"'\\''")}'`:r,f=r=>{let t=[],e="",n=!1,s=!1,o=!1;for(let m=0;m<r.length;m++){let d=r[m];if(o){e+=d,o=!1;continue}if(d==="\\"){o=!0;continue}if(d==="'"&&!s){n=!n;continue}if(d==='"'&&!n){s=!s;continue}if(d===" "&&!n&&!s){e.length>0&&(t.push(e),e="");continue}e+=d}e.length>0&&t.push(e);let i=t[0];return i===void 0?["",[]]:[i,t.slice(1)]};var g=(r,...t)=>{let[e,n]=h(r,t);return new c(e,n)};export{a,c as b,h as c,g as d};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as m}from"./chunk-
|
|
1
|
+
import{b as m}from"./chunk-IVSTITPL.js";import{d}from"./chunk-WUVVLUU5.js";import{b as l}from"./chunk-UA3VIHYO.js";var h=c=>{let n=c.split(/\n/).flatMap(i=>i.trim().length>0?[i.trim()]:[]);return n.length>1?n:c.split(/\.\s+|;\s+/).map(i=>i.trim()).filter(i=>i.length>5)},v=c=>{let n=[],i=c.find(t=>t.questionId==="ambition");if(i!==void 0){let t=i.answer,e=t.match(/10[- ]?star[:\s]+(.+)/i),r=e!==null?e[1].trim():t.length>120?t.slice(0,120)+"...":t,p=r.charAt(0).toUpperCase()+r.slice(1);n.push(p)}let o=c.find(t=>t.questionId==="verification");if(o!==void 0){let t=h(o.answer);for(let e of t){let r=e.toLowerCase();r.startsWith("run ")||r.startsWith("check ")?n.push(`Test: ${e}`):n.push(e)}}return n.length===0&&n.push("_Tasks need to be defined before execution. Add tasks manually or run discovery with more detail._"),n},w=(c,n)=>{let i={};if(n===null){for(let o of c.specSections)i[o]=!1;return i}for(let o of c.specSections){let t=o.toLowerCase();t.includes("design")||t.includes("mobile")||t.includes("layout")||t.includes("interaction")?i[o]=n.involvesUI:t.includes("contributor")||t.includes("public api")||t.includes("api surface")?i[o]=n.involvesPublicAPI:t.includes("migration")||t.includes("deprecation")||t.includes("backward")||t.includes("compatibility")?i[o]=n.involvesMigration:t.includes("audit")||t.includes("access control")||t.includes("data handling")?i[o]=n.involvesDataHandling:i[o]=!0}return i},g=(c,n,i,o,t)=>{let e=[];e.push(`# Spec: ${c}`),e.push(""),e.push("## Status: draft"),e.push(""),i.length>0&&(e.push(`## Concerns: ${i.map(s=>s.id).join(", ")}`),e.push("")),e.push("## Discovery Answers"),e.push("");for(let s of n)e.push(`### ${s.questionId}`),e.push(""),e.push(s.answer),e.push("");for(let s of i)if(s.specSections.length>0){let a=w(s,t??null);for(let f of s.specSections)a[f]!==!1&&(e.push(`## ${f} (${s.id})`),e.push(""),e.push("_To be addressed during execution._"),e.push(""))}if(o.length>0){e.push("## Decisions"),e.push(""),e.push("| # | Decision | Choice | Promoted |"),e.push("|---|----------|--------|----------|");for(let s=0;s<o.length;s++){let a=o[s];e.push(`| ${s+1} | ${a.question} | ${a.choice} | ${a.promoted?"yes":"no"} |`)}e.push("")}let r=n.find(s=>s.questionId==="scope_boundary");if(r!==void 0){e.push("## Out of Scope"),e.push("");let s=h(r.answer);for(let a of s)e.push(`- ${a}`);e.push("")}let p=v(n);e.push("## Tasks"),e.push("");for(let s=0;s<p.length;s++)e.push(`- [ ] task-${s+1}: ${p[s]}`);e.push("");let u=n.find(s=>s.questionId==="verification");if(e.push("## Verification"),e.push(""),u!==void 0){let s=h(u.answer);for(let a of s)e.push(`- ${a}`)}else e.push("_To be defined._");return e.push(""),e.join(`
|
|
2
2
|
`)};var k=async(c,n,i)=>{if(n.spec===null)throw new Error("No active spec");let o=`${c}/${d.specDir(n.spec)}`,t=`${c}/${d.specFile(n.spec)}`;await l.fs.mkdir(o,{recursive:!0});let e=g(n.spec,n.discovery.answers,i,n.decisions,n.classification);await l.fs.writeTextFile(t,e);let r=m(n.spec,e),p=`${o}/progress.json`,u={spec:n.spec,status:"draft",tasks:r.tasks.map(s=>({id:s.id,title:s.title,status:"pending"})),decisions:n.decisions.map(s=>({question:s.question,choice:s.choice,promoted:s.promoted})),debt:[],updatedAt:new Date().toISOString()};return await l.fs.writeTextFile(p,JSON.stringify(u,null,2)+`
|
|
3
3
|
`),t};export{k as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as l}from"./chunk-UA3VIHYO.js";var F=s=>{if(s===void 0)return"json";for(let n of s)if(n==="-o"||n.startsWith("--output")){let t=s.indexOf(n);if(n.includes("="))return x(n.split("=")[1]??"json");let i=s[t+1];if(i!==void 0&&!i.startsWith("-"))return x(i)}return"json"},O=s=>{if(s===void 0)return[];let n=[],t=!1;for(let i=0;i<s.length;i++){if(t){t=!1;continue}let o=s[i];if(!o.startsWith("--output=")){if(o==="-o"||o==="--output"){t=!0;continue}n.push(o)}}return n},x=s=>{let n=s.toLowerCase();return n==="md"||n==="markdown"?"markdown":n==="text"||n==="txt"||n==="plain"?"text":"json"},e=(s,n)=>s[n],$=s=>JSON.stringify(s,null,2),w=s=>{let n=s,t=[],i=e(n,"phase");i!==void 0&&(t.push(`# noskills \u2014 ${i}`),t.push(""));let o=e(n,"instruction");o!==void 0&&(t.push("## Instruction"),t.push(""),t.push(o),t.push(""));let a=e(n,"questions");if(a!==void 0&&a.length>0)for(let r of a){if(t.push(`## Question: ${r.id}`),t.push(""),t.push(`> ${r.text}`),r.extras!==void 0&&r.extras.length>0){t.push(""),t.push("Also consider:");for(let m of r.extras)t.push(`- ${m}`)}t.push("")}let h=e(n,"statusReport");if(h!==void 0){t.push("## Acceptance Criteria"),t.push("");for(let r of h.criteria)t.push(`- [ ] ${r}`);t.push("")}let p=e(n,"previousIterationDebt");if(p!==void 0){t.push(`## Debt (from iteration ${p.fromIteration})`),t.push(""),t.push(`> ${p.note}`),t.push("");for(let r of p.items)t.push(`- ${r}`);t.push("")}e(n,"verificationFailed")===!0&&(t.push("## Verification FAILED"),t.push(""),t.push("```"),t.push(String(e(n,"verificationOutput")??"")),t.push("```"),t.push(""));let c=e(n,"behavioral");if(c!==void 0){t.push("## Behavioral"),t.push(""),t.push(`**Tone:** ${c.tone}`),t.push("");for(let r of c.rules)t.push(`- ${r}`);c.urgency!==void 0&&(t.push(""),t.push(`**Urgency:** ${c.urgency}`)),t.push("")}let f=e(n,"meta");f!==void 0&&(t.push("---"),t.push(""),t.push(`*${f.resumeHint}*`),t.push(""));let d=e(n,"transition");if(d!==void 0){t.push("## Next Steps"),t.push("");for(let[r,m]of Object.entries(d))r!=="iteration"&&t.push(`- **${r}:** \`${m}\``);t.push("")}let u=e(n,"summary");u!==void 0&&(t.push("## Summary"),t.push(""),t.push(`- Spec: ${u.spec}`),t.push(`- Iterations: ${u.iterations}`),t.push(`- Decisions: ${u.decisionsCount}`),t.push(""));let g=e(n,"clearContext");return g!==void 0&&(t.push("---"),t.push(""),t.push(`**Action required:** ${g.reason}`),t.push("")),t.join(`
|
|
2
2
|
`)},k=s=>{let n=s,t=[],i=e(n,"phase");i!==void 0&&t.push(`[${i}]`);let o=e(n,"instruction");o!==void 0&&t.push(o);let a=e(n,"questions");if(a!==void 0&&a.length>0){for(let u of a)if(t.push(""),t.push(`Question [${u.id}]: ${u.text}`),u.extras!==void 0)for(let g of u.extras)t.push(` - ${g}`)}let h=e(n,"statusReport");if(h!==void 0){t.push(""),t.push("Criteria:");for(let u of h.criteria)t.push(` - ${u}`)}let p=e(n,"previousIterationDebt");if(p!==void 0){t.push(""),t.push(p.note);for(let u of p.items)t.push(` - ${u}`)}e(n,"verificationFailed")===!0&&(t.push(""),t.push(`Verification failed: ${String(e(n,"verificationOutput")??"").slice(0,200)}`));let c=e(n,"meta");c!==void 0&&(t.push(""),t.push(c.resumeHint));let f=e(n,"summary");f!==void 0&&t.push(`Spec: ${f.spec}, Iterations: ${f.iterations}, Decisions: ${f.decisionsCount}`);let d=e(n,"clearContext");return d!==void 0&&(t.push(""),t.push(d.reason)),t.join(`
|
|
3
3
|
`)},b=(s,n)=>{switch(n){case"markdown":return w(s);case"text":return k(s);default:return $(s)}},v=async(s,n)=>{let t=b(s,n),i=new TextEncoder,o=l.process.stdout.getWriter();await o.write(i.encode(t+`
|
|
4
4
|
`)),o.releaseLock()};export{F as a,O as b,b as c,v as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as i}from"./chunk-
|
|
1
|
+
import{d as i}from"./chunk-WUVVLUU5.js";var n={UNINITIALIZED:["IDLE"],IDLE:["DISCOVERY"],DISCOVERY:["SPEC_DRAFT"],SPEC_DRAFT:["SPEC_APPROVED"],SPEC_APPROVED:["EXECUTING"],EXECUTING:["DONE","BLOCKED"],BLOCKED:["EXECUTING"],DONE:["IDLE"]},c=(e,s)=>n[e].includes(s),t=(e,s)=>{if(!c(e,s))throw new Error(`Invalid phase transition: ${e} \u2192 ${s}. Allowed: ${n[e].join(", ")}`)},h=(e,s)=>(t(e.phase,s),{...e,phase:s}),d=(e,s,a)=>(t(e.phase,"DISCOVERY"),{...e,phase:"DISCOVERY",spec:s,branch:a,discovery:{answers:[],completed:!1},specState:{path:null,status:"none"},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[]},decisions:[]}),E=(e,s,a)=>{if(e.phase!=="DISCOVERY")throw new Error(`Cannot add discovery answer in phase: ${e.phase}`);let o=[...e.discovery.answers.filter(r=>r.questionId!==s),{questionId:s,answer:a}];return{...e,discovery:{answers:o,completed:e.discovery.completed}}},u=e=>{if(e.phase!=="DISCOVERY")throw new Error(`Cannot complete discovery in phase: ${e.phase}`);return{...e,phase:"SPEC_DRAFT",discovery:{...e.discovery,completed:!0},specState:{path:i.specFile(e.spec),status:"draft"}}},m=e=>(t(e.phase,"SPEC_APPROVED"),{...e,phase:"SPEC_APPROVED",specState:{...e.specState,status:"approved"}}),S=e=>(t(e.phase,"EXECUTING"),{...e,phase:"EXECUTING",discovery:{answers:[],completed:!0},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[]}});var D=(e,s)=>(t(e.phase,"BLOCKED"),{...e,phase:"BLOCKED",execution:{...e.execution,lastProgress:`BLOCKED: ${s}`}}),C=(e,s)=>({...e,decisions:[...e.decisions,s]}),F=e=>({...e,phase:"IDLE",spec:null,branch:null,discovery:{answers:[],completed:!1},specState:{path:null,status:"none"},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[]},decisions:[],pendingClear:!1,classification:null});export{h as a,d as b,E as c,u as d,m as e,S as f,D as g,C as h,F as i};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as v}from"./chunk-UA3VIHYO.js";import{d as G}from"./chunk-DXB73IDG.js";var y=e=>e.map(n=>typeof n=="string"?X(n):n),X=e=>({kind:"text",value:e}),se=(...e)=>({kind:"bold",children:y(e)}),le=(...e)=>({kind:"dim",children:y(e)});var pe=(...e)=>({kind:"group",children:y(e)});var g=(e,...n)=>({kind:"color",color:e,children:y(n)}),ue=(...e)=>g("red",...e),de=(...e)=>g("green",...e),ce=(...e)=>g("yellow",...e),me=(...e)=>g("blue",...e),ye=(...e)=>g("magenta",...e),he=(...e)=>g("cyan",...e),fe=(...e)=>g("gray",...e);var ke=(e,n)=>({kind:"table",headers:y(e),rows:n.map(r=>y(r))});var Se=(e,...n)=>({kind:"alert",level:e,children:y(n)}),h=e=>{switch(e.kind){case"text":return e.value.length;case"newline":return 1;case"bold":case"dim":case"italic":case"underline":case"strikethrough":case"color":case"group":return e.children.reduce((n,r)=>n+h(r),0);case"code-block":return e.value.length;case"table":case"list":return 0;case"gauge":{let n=e.width??20,r=e.label?` ${e.label}`:"";return n+` ${e.percent}%`.length+r.length}case"separator":return 0;case"alert":return 2+e.children.reduce((n,r)=>n+h(r),0)}};var w=(e,n)=>{let r=typeof e=="string"?"text":e instanceof Uint8Array?"bytes":"structured";return{data:e,meta:{timestamp:Date.now(),kind:r,channel:"stdout",...n}}};var E=e=>{switch(e.kind){case"text":return e.value;case"newline":return`
|
|
2
2
|
`;case"bold":case"dim":case"italic":case"underline":case"strikethrough":case"color":case"group":return e.children.map(E).join("");case"code-block":return e.value.split(`
|
|
3
3
|
`).map(n=>` ${n}`).join(`
|
|
4
4
|
`)+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as M,b as H}from"./chunk-2N4GTHXQ.js";import{
|
|
1
|
+
import{a as M,b as H}from"./chunk-2N4GTHXQ.js";import{b as B}from"./chunk-UA3VIHYO.js";var de=/^(?:-(?:(?<doubleDash>-)(?<negated>no-)?)?)(?<key>.+?)(?:=(?<value>.*))?$/s,ce=/[A-Za-z]/,fe=/-?\d+(\.\d*)?(e-?\d+)?$/,ue=/^(-|--)[^-]/,ge=/=(?<value>.+)/,me=/^--[^=]+$/,pe=/\W/,he=/\S/;function T(n){return he.test(n)&&Number.isFinite(Number(n))}function V(n,e){return e==="constructor"&&typeof n[e]=="function"||e==="__proto__"}function k(n,e,t,o=!1){e=[...e];let s=e.pop();for(let r of e){if(V(n,r))return;n=n[r]??={}}if(!V(n,s)){if(o){let r=n[s];if(Array.isArray(r)){r.push(t);return}t=r?[r,t]:[t]}n[s]=t}}function N(n,e){for(let t of e){let o=n[t];if(!Object.hasOwn(n,t))return!1;n=o}return!0}function X(n,e,t){let o=n.get(t);if(o===void 0)return!1;for(let s of o)if(e.has(s))return!0;return!1}function v(n){return n==="true"||n==="false"}function j(n){return n!=="false"}function L(n,e){let{"--":t=!1,alias:o={},boolean:s=!1,default:r={},stopEarly:i=!1,string:d=[],collect:m=[],negatable:p=[],unknown:S=l=>l}=e??{},h=new Map,$=new Set,C=new Set,x=new Set,b=new Set,g=!1;if(o)for(let[l,a]of Object.entries(o)){if(a===void 0)throw new TypeError("Alias value must be defined");let c=Array.isArray(a)?a:[a];h.set(l,new Set(c)),c.forEach(O=>h.set(O,new Set([l,...c.filter(E=>E!==O)])))}if(s)if(typeof s=="boolean")g=s;else{let l=Array.isArray(s)?s:[s];for(let a of l.filter(Boolean))$.add(a),h.get(a)?.forEach(c=>{$.add(c)})}if(d){let l=Array.isArray(d)?d:[d];for(let a of l.filter(Boolean))C.add(a),h.get(a)?.forEach(c=>C.add(c))}if(m){let l=Array.isArray(m)?m:[m];for(let a of l.filter(Boolean))x.add(a),h.get(a)?.forEach(c=>x.add(c))}if(p){let l=Array.isArray(p)?p:[p];for(let a of l.filter(Boolean))b.add(a),h.get(a)?.forEach(c=>b.add(c))}let u={_:[]};function y(l,a,c,O){if(!$.has(l)&&!C.has(l)&&!h.has(l)&&!x.has(l)&&!(g&&me.test(c))&&S?.(c,l,a)===!1)return;typeof a=="string"&&!C.has(l)&&(a=T(a)?Number(a):a);let E=O&&x.has(l);k(u,l.split("."),a,E),h.get(l)?.forEach(f=>{k(u,f.split("."),a,E)})}let R=[],D=n.indexOf("--");D!==-1&&(R=n.slice(D+1),n=n.slice(0,D));e:for(let l=0;l<n.length;l++){let a=n[l],c=a.match(de)?.groups;if(c){let{doubleDash:O,negated:E}=c,f=c.key,F=c.value;if(O){if(F!=null){$.has(f)&&(F=j(F)),y(f,F,a,!0);continue}if(E){if(b.has(f)){y(f,!1,a,!1);continue}f=`no-${f}`}let _=n[l+1];if(_){if(!$.has(f)&&!g&&!_.startsWith("-")&&(!h.has(f)||!X(h,$,f))){F=_,l++,y(f,F,a,!0);continue}if(v(_)){F=j(_),l++,y(f,F,a,!0);continue}}F=C.has(f)?"":!0,y(f,F,a,!0);continue}let z=a.slice(1,-1).split("");for(let[_,A]of z.entries()){let w=a.slice(_+2);if(w==="-"){y(A,w,a,!0);continue}if(w==="="){y(A,"",a,!0);continue e}if(ce.test(A)){let W=ge.exec(w)?.groups;if(W){y(A,W.value,a,!0);continue e}if(fe.test(w)){y(A,w,a,!0);continue e}}if(z[_+1]?.match(pe)){y(A,a.slice(_+2),a,!0);continue e}y(A,C.has(A)?"":!0,a,!0)}if(f=a.slice(-1),f==="-")continue;let P=n[l+1];if(P){if(!ue.test(P)&&!$.has(f)&&(!h.has(f)||!X(h,$,f))){y(f,P,a,!0),l++;continue}if(v(P)){let _=j(P);y(f,_,a,!0),l++;continue}}y(f,C.has(f)?"":!0,a,!0);continue}if(S?.(a)!==!1&&u._.push(C.has("_")||!T(a)?a:Number(a)),i){u._.push(...n.slice(l+1));break}}for(let[l,a]of Object.entries(r)){let c=l.split(".");N(u,c)||(k(u,c,a),h.get(l)?.forEach(O=>k(u,O.split("."),a)))}for(let l of $.keys()){let a=l.split(".");if(!N(u,a)){let c=x.has(l)?[]:!1;k(u,a,c)}}for(let l of C.keys()){let a=l.split(".");!N(u,a)&&x.has(l)&&k(u,a,[])}return t?u["--"]=R:u._.push(...R),u}var I=n=>{let e=[],t=[],o={},s={};for(let r of n)r.type==="boolean"?e.push(r.name):t.push(r.name),r.short!==void 0&&(o[r.short]=r.name),r.default!==void 0&&(s[r.name]=r.default);return{boolean:e,string:t,alias:o,default:s}},ye=n=>n!=null&&n.constructor===String,$e={boolean:n=>!!n,number:n=>ye(n)?Number(n):n,string:n=>String(n),"string[]":n=>Array.isArray(n)?n.map(String):[String(n)]},Ce=(n,e)=>{if(n!==void 0)return $e[e]?.(n)??n},q=(n,e)=>{let t={};for(let o of e){let s=n[o.name];t[o.name]=Ce(s,o.type)}return t};var Y=(n,e)=>{let t=[];for(let o of e)if(o.required===!0){let s=n[o.name];(s===void 0||s===""||s===!1)&&t.push(`Required flag --${o.name} is missing`)}return t};var Z=(n,e)=>n+" ".repeat(Math.max(0,e-n.length)),be=n=>{let e=n.short!==void 0?`-${n.short}, `:"",t=n.type!=="boolean"?` <${n.type}>`:"";return`${e}--${n.name}${t}`},_e=(n,e)=>[n.description!==void 0?`${e} - ${n.description}`:e,""],Fe=(n,e)=>{if(n.usage!==void 0)return["Usage:",` ${n.usage}`,""];let t=n.children.length>0?" <command>":"",o=n.flags.length>0?" [options]":"";return["Usage:",` ${e}${t}${o}`,""]},xe=n=>{if(n.length===0)return[];let e=s=>s.aliases!==void 0&&s.aliases.length>0?`${s.name}, ${s.aliases.join(", ")}`:s.name,t=Math.max(...n.map(s=>e(s).length));return["Commands:",...n.map(s=>` ${Z(e(s),t+2)}${s.description??""}`),""]},Oe=n=>{if(n.length===0)return[];let e=n.map(s=>({flag:be(s),desc:s.description})),t=Math.max(...e.map(s=>s.flag.length));return["Options:",...e.map(({flag:s,desc:r})=>` ${Z(s,t+2)}${r}`),""]},Ae=n=>n?.length?["Examples:",...n.map(e=>` ${e}`),""]:[],J=(n,e)=>{let t=e.join(" "),o=[..._e(n,t),...Fe(n,t),...xe(n.children),...Oe(n.flags),...Ae(n.examples)];return n.children.length>0&&o.push(`Run '${t} <command> --help' for more information on a command.`),o.join(`
|
|
2
2
|
`)};var K=n=>{let e=[];for(let t of n)e.push(`--${t.name}`),t.short!==void 0&&e.push(`-${t.short}`);return e.join(" ")},Q=(n,e)=>{if(n.children===void 0||n.children.length===0)return"";let t=n.children.map(i=>i.name).join(" "),o=n.flags!==void 0?K(n.flags):"",s=[t,o].filter(i=>i.length>0).join(" "),r=` ${e})
|
|
3
3
|
`;r+=` COMPREPLY=( $(compgen -W "${s}" -- "\${cur}") )
|
|
4
4
|
`,r+=` return 0
|
|
@@ -76,7 +76,7 @@ complete -F _${n}_completions ${n}
|
|
|
76
76
|
`;return t+=`# ${n} zsh completion
|
|
77
77
|
`,t+=`# Generated by @eser/shell/completions
|
|
78
78
|
|
|
79
|
-
`,t+=te(n,e,[]),t};var oe=n=>n.replace(
|
|
79
|
+
`,t+=te(n,e,[]),t};var oe=n=>n.replace(/[\\'\$`()]/g,"\\$&"),ke=(n,e,t)=>{let o="";for(let s of e){let r=oe(s.description??`${s.name} flag`),i=`complete -c ${n} ${t}`;i+=` -l ${s.name}`,s.short!==void 0&&(i+=` -s ${s.short}`),s.takesValue===!0&&(i+=" -r"),i+=` -d '${r}'`,o+=i+`
|
|
80
80
|
`}return o},re=(n,e,t)=>{let o="",s;if(t.length===0?s="-n __fish_use_subcommand":s=`-n "${t.map(i=>`__fish_seen_subcommand_from ${i}`).join("; and ")}"`,e.children!==void 0&&e.children.length>0){for(let r of e.children){let i=oe(r.description??r.name);if(t.length===0)o+=`complete -c ${n} -f ${s} `,o+=`-a "${r.name}" -d '${i}'
|
|
81
81
|
`;else{let d=`-n "__fish_seen_subcommand_from ${t[t.length-1]}"`;o+=`complete -c ${n} -f ${d} `,o+=`-a "${r.name}" -d '${i}'
|
|
82
82
|
`}}for(let r of e.children)o+=re(n,r,[...t,r.name])}return e.flags!==void 0&&e.flags.length>0&&(o+=ke(n,e.flags,s)),o},ie=(n,e)=>{let t=`# ${n} fish completion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as r}from"./chunk-
|
|
1
|
+
import{d as r}from"./chunk-3AZBET4N.js";import{b as i}from"./chunk-UA3VIHYO.js";var t=async e=>{try{return await r`which ${e}`.noThrow().code()===0}catch{return!1}},s=async()=>{try{return(await fetch("http://localhost:11434/api/version",{signal:AbortSignal.timeout(1e3)})).ok}catch{return!1}},a=e=>i.env.has(e),d=async()=>{let[e,o,l,n]=await Promise.all([t("claude"),s(),t("opencode"),t("kiro")]);return[{name:"claude-code",alias:"cc",type:"CLI",available:e,detail:e?"claude binary found":"claude not on PATH"},{name:"ollama",alias:"ol",type:"HTTP",available:o,detail:o?"localhost:11434 reachable":"localhost:11434 not reachable"},{name:"opencode",alias:"oc",type:"CLI",available:l,detail:l?"opencode binary found":"opencode not on PATH"},{name:"kiro",alias:"kr",type:"CLI",available:n,detail:n?"kiro binary found":"kiro not on PATH"},{name:"anthropic",alias:"ant",type:"API",available:a("ANTHROPIC_API_KEY"),detail:a("ANTHROPIC_API_KEY")?"ANTHROPIC_API_KEY set":"ANTHROPIC_API_KEY not set"},{name:"openai",alias:"oai",type:"API",available:a("OPENAI_API_KEY"),detail:a("OPENAI_API_KEY")?"OPENAI_API_KEY set":"OPENAI_API_KEY not set"},{name:"gemini",alias:"gem",type:"API",available:a("GEMINI_API_KEY")||a("GOOGLE_API_KEY"),detail:a("GEMINI_API_KEY")||a("GOOGLE_API_KEY")?"API key set":"GEMINI_API_KEY not set"},{name:"vertexai",alias:"vtx",type:"API",available:a("GOOGLE_CLOUD_PROJECT"),detail:a("GOOGLE_CLOUD_PROJECT")?"GOOGLE_CLOUD_PROJECT set":"GOOGLE_CLOUD_PROJECT not set"}]};export{d as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as c}from"./chunk-UA3VIHYO.js";var f=async(n,r)=>{let e=`${n}/.eser/specs/${r}/spec.md`,t;try{t=await c.fs.readTextFile(e)}catch{return null}return d(r,t)},d=(n,r)=>{let e=[],t=[],o=[],i="";for(let l of r.split(`
|
|
2
2
|
`)){let s=l.trim();if(s.startsWith("## ")){i=s.slice(3).trim().toLowerCase();continue}if(i.startsWith("tasks")){let a=s.match(/^-\s*\[[ x]\]\s*(task-\d+):\s*(.+)$/i);a!==null&&e.push({id:a[1],title:a[2].trim()})}i.startsWith("out of scope")&&s.startsWith("- ")&&t.push(s.slice(2).trim()),i.startsWith("verification")&&s.startsWith("- ")&&o.push(s.slice(2).trim())}return{name:n,tasks:e,outOfScope:t,verification:o}},u=(n,r)=>{let e=new Set(r);for(let t of n)if(!e.has(t.id))return t;return null};export{f as a,d as b,u as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a,c as W,d as l,e as M,f as w,g as c,h as x,i as X,k as T,l as $,n as D,o as j,q as K,r as F}from"./chunk-
|
|
1
|
+
import{b as a,c as W,d as l,e as M,f as w,g as c,h as x,i as X,k as T,l as $,n as D,o as j,q as K,r as F}from"./chunk-EZH232V7.js";import{b as A}from"./chunk-UA3VIHYO.js";var f=Symbol("tui.cancel"),ae=e=>e===f,ie=()=>{try{return A.process.stdin}catch{return new ReadableStream}},oe=e=>{let t=e?.interaction??(e?.target==="non-interactive"?"non-interactive":"interactive"),n=e?.audience??"human",s=t==="non-interactive"?"non-interactive":"interactive",r=t==="interactive";return{output:e?.output??j({renderer:r?F.ansi():F.plain(),sink:r?K.stdout():K.stderr()}),input:e?.input??ie(),target:s,interaction:t,audience:n,stderr:e?.stderr??j({renderer:F.plain(),sink:K.stderr()})}};var g="\u2502",G="\u250C",h="\u2514";var H="\u25CF",q="\u25CB",z="\u25FC",J="\u25FB",P="\u25C6",C="\u25C7",b="\u25A0",Q="\u25CF";var N="\u25B2";var Z="\u25C7";var v=async e=>{let t=!1;if(A.capabilities.stdin&&A.process.isTerminal("stdin"))try{A.process.setStdinRaw(!0),t=!0}catch{}try{return await e()}finally{if(t)try{A.process.setStdinRaw(!1)}catch{}}},R=e=>{e.write(a("\x1B[?25l"))},E=e=>{e.write(a("\x1B[?25h"))},m=(e,t)=>{t>0&&e.write(a(`\x1B[${t}A\x1B[J`))};var le=e=>{if(e.length===1&&e[0]===3)return{name:"c",ctrl:!0,meta:!1,shift:!1};if(e.length===1&&e[0]===27)return{name:"escape",ctrl:!1,meta:!1,shift:!1};if(e.length===1&&(e[0]===13||e[0]===10))return{name:"return",ctrl:!1,meta:!1,shift:!1};if(e.length===1&&e[0]===9)return{name:"tab",ctrl:!1,meta:!1,shift:!1};if(e.length===1&&e[0]===127)return{name:"backspace",ctrl:!1,meta:!1,shift:!1};if(e.length>=3&&e[0]===27&&e[1]===91)switch(e[2]){case 65:return{name:"up",ctrl:!1,meta:!1,shift:!1};case 66:return{name:"down",ctrl:!1,meta:!1,shift:!1};case 67:return{name:"right",ctrl:!1,meta:!1,shift:!1};case 68:return{name:"left",ctrl:!1,meta:!1,shift:!1};case 72:return{name:"home",ctrl:!1,meta:!1,shift:!1};case 70:return{name:"end",ctrl:!1,meta:!1,shift:!1}}if(e.length===1&&e[0]>=1&&e[0]<=26)return{name:String.fromCharCode(e[0]+96),ctrl:!0,meta:!1,shift:!1};if(e.length===1&&e[0]===32)return{name:"space",char:" ",ctrl:!1,meta:!1,shift:!1};if(e.length===1&&e[0]>=33&&e[0]<=126){let t=String.fromCharCode(e[0]);return{name:t,char:t,ctrl:!1,meta:!1,shift:!1}}if(e.length>0&&e[0]>=192){let t=new TextDecoder().decode(e);return{name:t,char:t,ctrl:!1,meta:!1,shift:!1}}return{name:"unknown",ctrl:!1,meta:!1,shift:!1}};async function*k(e,t){let n=e.getReader();try{for(;!t?.aborted;){let{done:s,value:r}=await n.read();if(s||r===void 0)break;yield le(r)}}finally{n.releaseLock()}}var U=(e,t,n,s)=>{if(s==="done"){let o=n?"Yes":"No";return e.output.writeln(c(C),a(` ${t}`),l(` \xB7 ${o}`)),1}if(s==="cancel")return e.output.writeln(w(b),a(` ${t}`)),1;let r=n?M(c(H),a(" Yes")):M(l(q),l(" Yes")),i=n?M(l(q),l(" No")):M(c(H),a(" No"));return e.output.writeln(T(P),a(` ${t}`)),e.output.writeln(l(g),a(" "),r,l(" / "),i),e.output.writeln(l(h)),3},pe=async(e,t)=>{let n=t.initialValue??!0,s=0;R(e.output);try{return await v(async()=>{s=U(e,t.message,n,"active"),await e.output.flush();for await(let r of k(e.input)){if(r.name==="c"&&r.ctrl)return m(e.output,s),U(e,t.message,n,"cancel"),await e.output.flush(),f;if(r.name==="escape")return m(e.output,s),U(e,t.message,n,"cancel"),await e.output.flush(),f;if(r.name==="return")return m(e.output,s),U(e,t.message,n,"done"),await e.output.flush(),n;let i=!1;(r.name==="left"||r.name==="right")&&(n=!n,i=!0),(r.name==="y"||r.name==="Y")&&(n=!0,i=!0),(r.name==="n"||r.name==="N")&&(n=!1,i=!0),i&&(m(e.output,s),s=U(e,t.message,n,"active"),await e.output.flush())}return f})}finally{E(e.output),await e.output.flush()}};var _=(e,t,n,s,r,i)=>{if(i==="done")return e.output.writeln(c(C),a(` ${t}`),l(` \xB7 ${n}`)),1;if(i==="cancel")return e.output.writeln(w(b),a(` ${t}`)),1;let o=n.length>0?a(n):s!==void 0?l(s):a(""),d=r!==void 0?x(N):T(P);e.output.writeln(d,a(` ${t}`)),e.output.writeln(l(g),a(" "),o);let y=2;return r!==void 0?(e.output.writeln(l(h),a(" "),x(r)),y=3):(e.output.writeln(l(h)),y=3),y},ue=async(e,t)=>{let n=t.initialValue??"",s=n.length,r,i=0;R(e.output);try{return await v(async()=>{i=_(e,t.message,n,t.placeholder,r,"active"),await e.output.flush();for await(let o of k(e.input)){if(o.name==="c"&&o.ctrl)return m(e.output,i),_(e,t.message,n,t.placeholder,void 0,"cancel"),await e.output.flush(),f;if(o.name==="escape")return m(e.output,i),_(e,t.message,n,t.placeholder,void 0,"cancel"),await e.output.flush(),f;if(o.name==="return"){if(t.validate!==void 0){let d=t.validate(n);if(d!==void 0){r=d,m(e.output,i),i=_(e,t.message,n,t.placeholder,r,"active"),await e.output.flush();continue}}return m(e.output,i),_(e,t.message,n,t.placeholder,void 0,"done"),await e.output.flush(),n}if(r=void 0,o.name==="backspace")s>0&&(n=n.slice(0,s-1)+n.slice(s),s--);else if(o.name==="left")s>0&&s--;else if(o.name==="right")s<n.length&&s++;else if(o.name==="home")s=0;else if(o.name==="end")s=n.length;else if(o.char!==void 0)n=n.slice(0,s)+o.char+n.slice(s),s++;else continue;m(e.output,i),i=_(e,t.message,n,t.placeholder,r,"active"),await e.output.flush()}return f})}finally{E(e.output),await e.output.flush()}};var L=(e,t,n,s,r,i,o)=>{if(o==="done"){let u=[...r].sort((p,I)=>p-I).map(p=>n[p]?.label??"").join(", ");return e.output.writeln(c(C),a(` ${t}`),l(` \xB7 ${u}`)),1}if(o==="cancel")return e.output.writeln(w(b),a(` ${t}`)),1;let d=i!==void 0?x(N):T(P);e.output.writeln(d,a(` ${t}`));for(let u=0;u<n.length;u++){let p=n[u],I=u===s,ee=r.has(u),te=p.disabled===!0,ne=ee?c(z):l(J),se=te?l(` ${p.label}`):I?a(` ${p.label}`):l(` ${p.label}`),re=p.hint!==void 0?l(` (${p.hint})`):a("");e.output.writeln(l(g),a(" "),ne,se,re)}let y=n.length+2;return i!==void 0?e.output.writeln(l(h),a(" "),x(i)):e.output.writeln(l(h)),y},Y=(e,t,n)=>{let s=e.length,r=t;for(let i=0;i<s;i++)if(r=(r+n+s)%s,e[r]?.disabled!==!0)return r;return t},de=async(e,t)=>{let n=0,s=new Set;if(t.initialValues!==void 0)for(let o of t.initialValues){let d=t.options.findIndex(y=>y.value===o);d>=0&&s.add(d)}t.options[n]?.disabled===!0&&(n=Y(t.options,n,1));let r=0,i;R(e.output);try{return await v(async()=>{r=L(e,t.message,t.options,n,s,i,"active"),await e.output.flush();for await(let o of k(e.input)){if(o.name==="c"&&o.ctrl)return m(e.output,r),L(e,t.message,t.options,n,s,void 0,"cancel"),await e.output.flush(),f;if(o.name==="escape")return m(e.output,r),L(e,t.message,t.options,n,s,void 0,"cancel"),await e.output.flush(),f;if(o.name==="return"){if(t.required!==!1&&s.size===0){i="Please select at least one option.",m(e.output,r),r=L(e,t.message,t.options,n,s,i,"active"),await e.output.flush();continue}return m(e.output,r),L(e,t.message,t.options,n,s,void 0,"done"),await e.output.flush(),[...s].sort((y,u)=>y-u).map(y=>t.options[y].value)}i=void 0;let d=!1;if((o.name==="up"||o.name==="k")&&(n=Y(t.options,n,-1),d=!0),(o.name==="down"||o.name==="j")&&(n=Y(t.options,n,1),d=!0),o.name==="space"&&t.options[n]?.disabled!==!0&&(s.has(n)?s.delete(n):s.add(n),d=!0),o.name==="a"){let y=t.options.every((u,p)=>u.disabled===!0||s.has(p));for(let u=0;u<t.options.length;u++)t.options[u]?.disabled!==!0&&(y?s.delete(u):s.add(u));d=!0}d&&(m(e.output,r),r=L(e,t.message,t.options,n,s,i,"active"),await e.output.flush())}return f})}finally{E(e.output),await e.output.flush()}};var me=(e,t)=>{e.output.writeln($(G),a(" "),W(t)),e.output.writeln($(g))},fe=(e,t)=>{e.output.writeln($(g)),e.output.writeln($(h),a(" "),a(t))},ye={info:(e,t)=>{e.output.writeln(D("info",t))},success:(e,t)=>{e.output.writeln(D("success",t))},warn:(e,t)=>{e.output.writeln(D("warning",t))},error:(e,t)=>{e.output.writeln(D("error",t))},step:(e,t)=>{e.output.writeln(l(Z),a(" "),l(t))},message:(e,t,n)=>{e.output.writeln(l(n??g),a(" "),a(t))}};var ce=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],ge=80,he=(e,t,n)=>{let s=n?.frames??ce,r=n?.interval??ge,i=t,o=0,d,y=()=>{e.output.write(a(`\r${" ".repeat(i.length+4)}\r`))},u=()=>{d!==void 0&&(clearInterval(d),d=void 0,y())};return{start:p=>{p!==void 0&&(i=p),d=setInterval(()=>{let I=s[o%s.length];e.output.write(a("\r"),T(I??""),a(` ${i}`)),o++},r)},stop:p=>{u(),p!==void 0&&(i=p)},update:p=>{i=p},succeed:p=>{u(),e.output.writeln(c(C),a(` ${p??i}`))},fail:p=>{u(),e.output.writeln(w(b),a(` ${p??i}`))},warn:p=>{u(),e.output.writeln(x(N),a(` ${p??i}`))},info:p=>{u(),e.output.writeln(X(Q),a(` ${p??i}`))}}};export{ae as a,oe as b,pe as c,ue as d,de as e,me as f,fe as g,ye as h,he as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as i}from"./chunk-UA3VIHYO.js";var l=[{envVars:["CLAUDE_CODE","CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_SESSION_ID"],tool:"claude-code"},{envVars:["CURSOR_SESSION","CURSOR"],tool:"cursor"},{envVars:["KIRO_SESSION","KIRO"],tool:"kiro"},{envVars:["WINDSURF_SESSION"],tool:"windsurf"},{envVars:["GITHUB_COPILOT"],tool:"copilot"}],s=()=>{for(let e of l)for(let t of e.envVars){let n=i.env.get(t);if(n!==void 0&&n!=="")return e.tool}return null},o=()=>s()!==null?"agent":"human";var I=(e,t)=>{if(e!==void 0)for(let r of e){if(r==="--agent")return"agent";if(r==="--human")return"human"}let n=t?.agentMode;return n===!0?"agent":n===!1?"human":o()};var y=e=>e===void 0?[]:e.filter(t=>t!=="--agent"&&t!=="--human"&&t!=="--non-interactive");export{s as a,I as b,y as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as I,c as D}from"./chunk-WV3HK5WR.js";import{a as N,b as f}from"./chunk-FDZP7B5Y.js";import{a as m,b as T,c as A,d as S}from"./chunk-ACQUINWH.js";import{d as Y}from"./chunk-DXB73IDG.js";var i=globalThis,Z=()=>typeof i.caches<"u"&&typeof i.Request<"u"&&typeof i.Response<"u"&&typeof i.window>"u"&&typeof i.document>"u",ee=()=>typeof i.window<"u"||typeof i.document<"u",a=()=>{if(typeof globalThis>"u")return"unknown";if(typeof i.Bun<"u")return"bun";if(typeof i.Deno<"u")return"deno";let e=i.process;return e?.versions?.node&&!e?.versions?.bun?"node":Z()?"workerd":ee()?"browser":"unknown"},ne={deno:()=>i.Deno?.version?.deno??"unknown",bun:()=>i.Bun?.version??"unknown",node:()=>i.process?.versions?.node??"unknown",workerd:()=>"unknown",browser:()=>i.navigator?.userAgent??"unknown",unknown:()=>"unknown"},M=()=>ne[a()](),_=e=>a()===e,W=()=>a()==="browser",te=new Set(["deno","node","bun"]),j=()=>te.has(a()),B=()=>a()==="workerd";var oe=e=>{if(typeof Deno<"u"&&Deno.env?.get)return Deno.env.get(e);let n=globalThis.process;if(n?.env)return n.env[e]},x=(...e)=>{for(let n of e){let t=oe(n);if(t!==void 0)return t}},g=e=>{try{let n=globalThis.require;if(n instanceof Function)return n(e)}catch{}},w=()=>globalThis.process,h=()=>globalThis.navigator;var H={darwin:"darwin",linux:"linux",windows:"windows",win32:"windows"},u=()=>{if(typeof Deno<"u"&&Deno.build?.os)return H[Deno.build.os]??"linux";let e=w();if(e?.platform)return H[e.platform]??"linux";let n=h();if(n?.userAgent){let t=n.userAgent.toLowerCase();if(t.includes("mac"))return"darwin";if(t.includes("win"))return"windows";if(t.includes("linux"))return"linux"}return"linux"},L={x86_64:"amd64",x64:"amd64",aarch64:"arm64",arm64:"arm64"},y=()=>{if(typeof Deno<"u"&&Deno.build?.arch)return L[Deno.build.arch]??"amd64";let e=w();if(e?.arch)return L[e.arch]??"amd64";let n=h();if(n?.userAgent){let t=n.userAgent.toLowerCase();if(t.includes("arm64")||t.includes("aarch64"))return"arm64"}return"amd64"},R=()=>{let e=x("HOME","USERPROFILE");if(e)return e;let n=g("os");return n?.homedir?n.homedir():u()==="windows"?"C:\\Users\\Default":"/home"},v=()=>{let e=x("TMPDIR","TMP","TEMP");if(e)return e;let n=g("os");return n?.tmpdir?n.tmpdir():u()==="windows"?"C:\\Windows\\Temp":"/tmp"},U=()=>({platform:u(),arch:y(),homedir:R(),tmpdir:v()});var G={};Y(G,{AlreadyExistsError:()=>A,NotFoundError:()=>T,ProcessError:()=>S,RuntimeCapabilityError:()=>m,buildCommand:()=>P,clearWorkerdEnv:()=>D,createRuntime:()=>J,current:()=>xe,detectExecutionContext:()=>V,detectInvoker:()=>C,detectRuntime:()=>a,getArch:()=>y,getCliCommand:()=>q,getHomedir:()=>R,getPlatform:()=>u,getPlatformInfo:()=>U,getRuntimeVersion:()=>M,getTmpdir:()=>v,isBrowser:()=>W,isCommandInPath:()=>c,isEdge:()=>B,isRuntime:()=>_,isServer:()=>j,populateEnvFromContext:()=>I,posixPath:()=>f,resolvePathDirs:()=>b,runtime:()=>o,searchFileHierarchy:()=>$,toPosix:()=>N});var $=async(e,n,t={})=>{let{searchParents:r=!1}=t,s=e;for(;;){for(let l of n){let p=o.path.join(s,l);if(await o.fs.exists(p)&&(await o.fs.stat(p)).isFile)return p}if(!r)break;let d=o.path.dirname(s);if(d===s)break;s=d}};var k=(e,n)=>()=>{throw new m(e,n)},se=e=>{let n=k("fs",e);return{readFile:n,readTextFile:n,writeFile:n,writeTextFile:n,exists:n,stat:n,lstat:n,mkdir:n,ensureDir:n,remove:n,readDir:n,copyFile:n,rename:n,makeTempDir:n,realPath:n,watch:n,walk:n,chmod:n}},ae=e=>{let n=k("exec",e);return{spawn:n,exec:n,execJson:n,spawnChild:n}},de=e=>{let n=k("process",e);return{exit:n,setExitCode:n,cwd:n,chdir:n,hostname:n,execPath:n,get args(){throw new m("process",e)},get pid(){throw new m("process",e)},get stdin(){throw new m("process",e)},get stdout(){throw new m("process",e)},get stderr(){throw new m("process",e)},isTerminal(){return!1},setStdinRaw(){throw new m("process",e)}}},me=()=>({get:()=>{},set:()=>{},delete:()=>{},has:()=>!1,toObject:()=>({})}),ce=e=>({name:e,version:"unknown",capabilities:{fs:!1,fsSync:!1,exec:!1,process:!1,env:!1,stdin:!1,stdout:!1,kv:!1},fs:se(e),path:f,exec:ae(e),env:me(),process:de(e)}),ue={deno:async()=>(await import("./deno-5VR3ZY4Z.js")).createDenoRuntime(),node:async()=>(await import("./node-MZTU6BAB.js")).createNodeRuntime(),bun:async()=>(await import("./bun-KVGAHBUF.js")).createBunRuntime(),workerd:async()=>(await import("./workerd-QUMEG65S.js")).createWorkerdRuntime(),browser:async()=>(await import("./browser-JYFQKVFU.js")).createBrowserRuntime()},pe=["fs","exec","env","path","process"],le=e=>e!==void 0&&pe.some(n=>e[n]!==void 0),fe=(e,n,t)=>({name:e.name,version:e.version,capabilities:t,fs:n.fs??e.fs,path:n.path??e.path,exec:n.exec??e.exec,env:n.env??e.env,process:n.process??e.process}),J=async e=>{let n=a(),t=ue[n],r=t!==void 0?await t():ce(n),s=e?.capabilities?{...r.capabilities,...e.capabilities}:r.capabilities;return e!==void 0&&le(e)?fe(r,e,s):e?.capabilities?{...r,capabilities:s}:r},o=await J(),xe=o;var b=(e,n)=>{let t=n==="windows"?";":":";return e.split(t).filter(r=>r.length>0)},C=(e,n,t,r,s)=>{if(t)return{invoker:"binary",mode:"installed"};if(n==="bun")return e.BUN_INSTALL!==void 0?{invoker:"bun",mode:"installed"}:{invoker:"bunx",mode:"on-demand"};if(n==="node"){let d=e.npm_execpath??"";return d.includes("npx")?{invoker:"npx",mode:"on-demand"}:d.includes("pnpm")?{invoker:"pnpx",mode:"on-demand"}:(e.npm_config_user_agent??"").includes("pnpm")?{invoker:"pnpm",mode:"installed"}:{invoker:"npm",mode:"installed"}}return n==="deno"?r!==void 0&&(r.startsWith("jsr:")||r.startsWith("https:"))?{invoker:"deno",mode:"on-demand"}:s===!0?{invoker:"dev",mode:"dev"}:{invoker:"deno",mode:"installed"}:{invoker:"unknown",mode:"installed"}},P=(e,n,t)=>e==="npx"?`npx ${t.npmPackage}`:e==="pnpx"?`pnpx ${t.npmPackage}`:e==="bunx"?`bunx ${t.npmPackage}`:e==="deno"&&n==="on-demand"?`deno run --allow-all jsr:${t.jsrPackage}`:e==="dev"?t.devCommand:t.command,c=async e=>{let n=u(),t=n==="windows"?`${e}.exe`:e,r=o.env.get("PATH")??"",s=b(r,n);for(let d of s)try{return await o.fs.stat(o.path.join(d,t)),!0}catch{continue}return!1},q=async e=>await c(e.command)?e.command:await c("npx")?`npx ${e.npmPackage}`:await c("pnpx")?`pnpx ${e.npmPackage}`:await c("bunx")?`bunx ${e.npmPackage}`:await c("deno")?`deno run --allow-all jsr:${e.jsrPackage}`:e.command,V=async e=>{let n=import.meta.filename===void 0,t=a(),r=import.meta.url,s={BUN_INSTALL:o.env.get("BUN_INSTALL"),npm_execpath:o.env.get("npm_execpath"),npm_config_user_agent:o.env.get("npm_config_user_agent")},d=!1;if(t==="deno"&&r.startsWith("file://"))try{let z=o.process.cwd(),Q=o.path.join(z,"deno.json"),X=await o.fs.readTextFile(Q),F=JSON.parse(X).tasks;F!==void 0&&"cli"in F&&(d=!0)}catch{}let{invoker:l,mode:p}=C(s,t,n,r,d),E=n?"compiled":["deno","node","bun"].includes(t)?t:"deno",O=P(l,p,e),K=await c(e.command);return{runtime:E,mode:p,invoker:l,command:O,isInPath:K}};export{q as a,o as b,G as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as T}from"./chunk-UA3VIHYO.js";import{a as tt,c as y,e as Ta}from"./chunk-DXB73IDG.js";var q=y($=>{"use strict";var ts=Symbol.for("yaml.alias"),Bi=Symbol.for("yaml.document"),st=Symbol.for("yaml.map"),Fi=Symbol.for("yaml.pair"),ss=Symbol.for("yaml.scalar"),it=Symbol.for("yaml.seq"),R=Symbol.for("yaml.node.type"),Ca=s=>!!s&&typeof s=="object"&&s[R]===ts,Ia=s=>!!s&&typeof s=="object"&&s[R]===Bi,Pa=s=>!!s&&typeof s=="object"&&s[R]===st,$a=s=>!!s&&typeof s=="object"&&s[R]===Fi,Ki=s=>!!s&&typeof s=="object"&&s[R]===ss,Ma=s=>!!s&&typeof s=="object"&&s[R]===it;function ji(s){if(s&&typeof s=="object")switch(s[R]){case st:case it:return!0}return!1}function Da(s){if(s&&typeof s=="object")switch(s[R]){case ts:case st:case ss:case it:return!0}return!1}var _a=s=>(Ki(s)||ji(s))&&!!s.anchor;$.ALIAS=ts;$.DOC=Bi;$.MAP=st;$.NODE_TYPE=R;$.PAIR=Fi;$.SCALAR=ss;$.SEQ=it;$.hasAnchor=_a;$.isAlias=Ca;$.isCollection=ji;$.isDocument=Ia;$.isMap=Pa;$.isNode=Da;$.isPair=$a;$.isScalar=Ki;$.isSeq=Ma});var ve=y(is=>{"use strict";var P=q(),M=Symbol("break visit"),Ri=Symbol("skip children"),K=Symbol("remove node");function nt(s,e){let t=Ui(e);P.isDocument(s)?ce(null,s.contents,t,Object.freeze([s]))===K&&(s.contents=null):ce(null,s,t,Object.freeze([]))}nt.BREAK=M;nt.SKIP=Ri;nt.REMOVE=K;function ce(s,e,t,i){let n=Yi(s,e,t,i);if(P.isNode(n)||P.isPair(n))return xi(s,i,n),ce(s,n,t,i);if(typeof n!="symbol"){if(P.isCollection(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let a=ce(r,e.items[r],t,i);if(typeof a=="number")r=a-1;else{if(a===M)return M;a===K&&(e.items.splice(r,1),r-=1)}}}else if(P.isPair(e)){i=Object.freeze(i.concat(e));let r=ce("key",e.key,t,i);if(r===M)return M;r===K&&(e.key=null);let a=ce("value",e.value,t,i);if(a===M)return M;a===K&&(e.value=null)}}return n}async function rt(s,e){let t=Ui(e);P.isDocument(s)?await fe(null,s.contents,t,Object.freeze([s]))===K&&(s.contents=null):await fe(null,s,t,Object.freeze([]))}rt.BREAK=M;rt.SKIP=Ri;rt.REMOVE=K;async function fe(s,e,t,i){let n=await Yi(s,e,t,i);if(P.isNode(n)||P.isPair(n))return xi(s,i,n),fe(s,n,t,i);if(typeof n!="symbol"){if(P.isCollection(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let a=await fe(r,e.items[r],t,i);if(typeof a=="number")r=a-1;else{if(a===M)return M;a===K&&(e.items.splice(r,1),r-=1)}}}else if(P.isPair(e)){i=Object.freeze(i.concat(e));let r=await fe("key",e.key,t,i);if(r===M)return M;r===K&&(e.key=null);let a=await fe("value",e.value,t,i);if(a===M)return M;a===K&&(e.value=null)}}return n}function Ui(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Yi(s,e,t,i){if(typeof t=="function")return t(s,e,i);if(P.isMap(e))return t.Map?.(s,e,i);if(P.isSeq(e))return t.Seq?.(s,e,i);if(P.isPair(e))return t.Pair?.(s,e,i);if(P.isScalar(e))return t.Scalar?.(s,e,i);if(P.isAlias(e))return t.Alias?.(s,e,i)}function xi(s,e,t){let i=e[e.length-1];if(P.isCollection(i))i.items[s]=t;else if(P.isPair(i))s==="key"?i.key=t:i.value=t;else if(P.isDocument(i))i.contents=t;else{let n=P.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}is.visit=nt;is.visitAsync=rt});var ns=y(Vi=>{"use strict";var Ji=q(),Ba=ve(),Fa={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Ka=s=>s.replace(/[!,[\]{}]/g,e=>Fa[e]),ke=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let i=e.trim().split(/[ \t]+/),n=i.shift();switch(n){case"%TAG":{if(i.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[r,a]=i;return this.tags[r]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=i;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let a=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,a),!1}}default:return t(0,`Unknown directive ${n}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let a=e.slice(2,-1);return a==="!"||a==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),a)}let[,i,n]=e.match(/^(.*!)([^!]*)$/s);n||t(`The ${e} tag has no suffix`);let r=this.tags[i];if(r)try{return r+decodeURIComponent(n)}catch(a){return t(String(a)),null}return i==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,i]of Object.entries(this.tags))if(e.startsWith(i))return t+Ka(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),n;if(e&&i.length>0&&Ji.isNode(e.contents)){let r={};Ba.visit(e.contents,(a,o)=>{Ji.isNode(o)&&o.tag&&(r[o.tag]=!0)}),n=Object.keys(r)}else n=[];for(let[r,a]of i)r==="!!"&&a==="tag:yaml.org,2002:"||(!e||n.some(o=>o.startsWith(a)))&&t.push(`%TAG ${r} ${a}`);return t.join(`
|
|
2
2
|
`)}};ke.defaultYaml={explicit:!1,version:"1.2"};ke.defaultTags={"!!":"tag:yaml.org,2002:"};Vi.Directives=ke});var at=y(Ne=>{"use strict";var Gi=q(),ja=ve();function Ra(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Wi(s){let e=new Set;return ja.visit(s,{Value(t,i){i.anchor&&e.add(i.anchor)}}),e}function Qi(s,e){for(let t=1;;++t){let i=`${s}${t}`;if(!e.has(i))return i}}function Ua(s,e){let t=[],i=new Map,n=null;return{onAnchor:r=>{t.push(r),n??(n=Wi(s));let a=Qi(e,n);return n.add(a),a},setAnchors:()=>{for(let r of t){let a=i.get(r);if(typeof a=="object"&&a.anchor&&(Gi.isScalar(a.node)||Gi.isCollection(a.node)))a.node.anchor=a.anchor;else{let o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=r,o}}},sourceObjects:i}}Ne.anchorIsValid=Ra;Ne.anchorNames=Wi;Ne.createNodeAnchors=Ua;Ne.findNewAnchor=Qi});var rs=y(Hi=>{"use strict";function Ae(s,e,t,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let n=0,r=i.length;n<r;++n){let a=i[n],o=Ae(s,i,String(n),a);o===void 0?delete i[n]:o!==a&&(i[n]=o)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let r=i.get(n),a=Ae(s,i,n,r);a===void 0?i.delete(n):a!==r&&i.set(n,a)}else if(i instanceof Set)for(let n of Array.from(i)){let r=Ae(s,i,n,n);r===void 0?i.delete(n):r!==n&&(i.delete(n),i.add(r))}else for(let[n,r]of Object.entries(i)){let a=Ae(s,i,n,r);a===void 0?delete i[n]:a!==r&&(i[n]=a)}return s.call(e,t,i)}Hi.applyReviver=Ae});var J=y(zi=>{"use strict";var Ya=q();function Xi(s,e,t){if(Array.isArray(s))return s.map((i,n)=>Xi(i,String(n),t));if(s&&typeof s.toJSON=="function"){if(!t||!Ya.hasAnchor(s))return s.toJSON(e,t);let i={aliasCount:0,count:1,res:void 0};t.anchors.set(s,i),t.onCreate=r=>{i.res=r,delete t.onCreate};let n=s.toJSON(e,t);return t.onCreate&&t.onCreate(n),n}return typeof s=="bigint"&&!t?.keep?Number(s):s}zi.toJS=Xi});var ot=y(en=>{"use strict";var xa=rs(),Zi=q(),Ja=J(),as=class{constructor(e){Object.defineProperty(this,Zi.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:i,onAnchor:n,reviver:r}={}){if(!Zi.isDocument(e))throw new TypeError("A document argument is required");let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},o=Ja.toJS(this,"",a);if(typeof n=="function")for(let{count:l,res:c}of a.anchors.values())n(c,l);return typeof r=="function"?xa.applyReviver(r,{"":o},"",o):o}};en.NodeBase=as});var qe=y(tn=>{"use strict";var Va=at(),Ga=ve(),ue=q(),Wa=ot(),Qa=J(),os=class extends Wa.NodeBase{constructor(e){super(ue.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],Ga.visit(e,{Node:(r,a)=>{(ue.isAlias(a)||ue.hasAnchor(a))&&i.push(a)}}),t&&(t.aliasResolveCache=i));let n;for(let r of i){if(r===this)break;r.anchor===this.source&&(n=r)}return n}toJSON(e,t){if(!t)return{source:this.source};let{anchors:i,doc:n,maxAliasCount:r}=t,a=this.resolve(n,t);if(!a){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let o=i.get(a);if(o||(Qa.toJS(a,null,t),o=i.get(a)),o?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=lt(n,a,i)),o.count*o.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return o.res}toString(e,t,i){let n=`*${this.source}`;if(e){if(Va.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${n} `}return n}};function lt(s,e,t){if(ue.isAlias(e)){let i=e.resolve(s),n=t&&i&&t.get(i);return n?n.count*n.aliasCount:0}else if(ue.isCollection(e)){let i=0;for(let n of e.items){let r=lt(s,n,t);r>i&&(i=r)}return i}else if(ue.isPair(e)){let i=lt(s,e.key,t),n=lt(s,e.value,t);return Math.max(i,n)}return 1}tn.Alias=os});var L=y(ls=>{"use strict";var Ha=q(),Xa=ot(),za=J(),Za=s=>!s||typeof s!="function"&&typeof s!="object",V=class extends Xa.NodeBase{constructor(e){super(Ha.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:za.toJS(this.value,e,t)}toString(){return String(this.value)}};V.BLOCK_FOLDED="BLOCK_FOLDED";V.BLOCK_LITERAL="BLOCK_LITERAL";V.PLAIN="PLAIN";V.QUOTE_DOUBLE="QUOTE_DOUBLE";V.QUOTE_SINGLE="QUOTE_SINGLE";ls.Scalar=V;ls.isScalarValue=Za});var Oe=y(nn=>{"use strict";var eo=qe(),te=q(),sn=L(),to="tag:yaml.org,2002:";function so(s,e,t){if(e){let i=t.filter(r=>r.tag===e),n=i.find(r=>!r.format)??i[0];if(!n)throw new Error(`Tag ${e} not found`);return n}return t.find(i=>i.identify?.(s)&&!i.format)}function io(s,e,t){if(te.isDocument(s)&&(s=s.contents),te.isNode(s))return s;if(te.isPair(s)){let f=t.schema[te.MAP].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:i,onAnchor:n,onTagObj:r,schema:a,sourceObjects:o}=t,l;if(i&&s&&typeof s=="object"){if(l=o.get(s),l)return l.anchor??(l.anchor=n(s)),new eo.Alias(l.anchor);l={anchor:null,node:null},o.set(s,l)}e?.startsWith("!!")&&(e=to+e.slice(2));let c=so(s,e,a.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let f=new sn.Scalar(s);return l&&(l.node=f),f}c=s instanceof Map?a[te.MAP]:Symbol.iterator in Object(s)?a[te.SEQ]:a[te.MAP]}r&&(r(c),delete t.onTagObj);let d=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,s,t):new sn.Scalar(s);return e?d.tag=e:c.default||(d.tag=c.tag),l&&(l.node=d),d}nn.createNode=io});var ft=y(ct=>{"use strict";var no=Oe(),j=q(),ro=ot();function cs(s,e,t){let i=t;for(let n=e.length-1;n>=0;--n){let r=e[n];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let a=[];a[r]=i,i=a}else i=new Map([[r,i]])}return no.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var rn=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,fs=class extends ro.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(i=>j.isNode(i)||j.isPair(i)?i.clone(e):i),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(rn(e))this.add(t);else{let[i,...n]=e,r=this.get(i,!0);if(j.isCollection(r))r.addIn(n,t);else if(r===void 0&&this.schema)this.set(i,cs(this.schema,n,t));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}deleteIn(e){let[t,...i]=e;if(i.length===0)return this.delete(t);let n=this.get(t,!0);if(j.isCollection(n))return n.deleteIn(i);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${i}`)}getIn(e,t){let[i,...n]=e,r=this.get(i,!0);return n.length===0?!t&&j.isScalar(r)?r.value:r:j.isCollection(r)?r.getIn(n,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!j.isPair(t))return!1;let i=t.value;return i==null||e&&j.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[t,...i]=e;if(i.length===0)return this.has(t);let n=this.get(t,!0);return j.isCollection(n)?n.hasIn(i):!1}setIn(e,t){let[i,...n]=e;if(n.length===0)this.set(i,t);else{let r=this.get(i,!0);if(j.isCollection(r))r.setIn(n,t);else if(r===void 0&&this.schema)this.set(i,cs(this.schema,n,t));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};ct.Collection=fs;ct.collectionFromPath=cs;ct.isEmptyPath=rn});var Ee=y(ut=>{"use strict";var ao=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function us(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var oo=(s,e,t)=>s.endsWith(`
|
|
3
3
|
`)?us(t,e):t.includes(`
|
|
4
4
|
`)?`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{d as o}from"./chunk-
|
|
1
|
+
import{d as o}from"./chunk-WUVVLUU5.js";import{b as e}from"./chunk-UA3VIHYO.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as h}from"./chunk-
|
|
1
|
+
import{d as h}from"./chunk-WUVVLUU5.js";import{b as i}from"./chunk-UA3VIHYO.js";var d="<!-- noskills:start -->",u="<!-- noskills:end -->",w=(t,s,o="npx eser noskills")=>{let e=[d,"## noskills orchestrator","","This project uses noskills for state-driven orchestration.","Do NOT read `.eser/rules/`, `.eser/specs/`, or concern files directly.","noskills gives you exactly what you need via JSON output.","","### Protocol","",` ${o} next # get current instruction`,` ${o} next --answer="your response" # submit result and advance`,"","### When to call noskills next","",`You MUST call \`${o} next\` in these situations:`,"","1. At the **START** of every conversation (first thing you do)","2. **BEFORE** creating or modifying any file (to verify you have an active task)","3. **AFTER** completing a logical unit of work (to report progress)","4. When you encounter a **DECISION** that affects architecture or scope","5. When you are **UNSURE** what to do next","","NEVER proceed with implementation without checking noskills first.","NEVER make architectural decisions independently \u2014 noskills routes them to the user."];if((s?.allowGit??!1)||e.push("","### Git is read-only","","You MUST NOT run git write commands: commit, add, push, checkout, stash,","reset, merge, rebase, cherry-pick. The user controls git. You control files.","You MAY read from git: log, diff, status, show, blame."),e.push("","### Convention discovery","","When you discover a pattern, receive a correction, or identify a recurring",'preference from the user, ask: "Should this be a permanent rule for this',`project, or just for this task?" If permanent, run: \`${o} rule add`,'"<description>"`. If just this task, note it and move on.',"Never write to `.eser/rules/` directly.","","### JSON output","","noskills returns JSON with a `phase` field and phase-specific instructions.","The `meta` block contains resume context - use it to orient yourself,","especially after compaction or at the start of a new session.","Follow the `instruction` field. Use `transition` commands to advance state."),t.length>0){e.push("","### Active Rules","");for(let n of t)e.push(`- ${n}`)}return e.push(u),e.join(`
|
|
2
2
|
`)},m=async(t,s,o,e="npx eser noskills")=>{let n=`${t}/CLAUDE.md`,a=w(s,o,e),r;try{r=await i.fs.readTextFile(n);let l=r.indexOf(d),c=r.indexOf(u);l!==-1&&c!==-1?r=r.slice(0,l)+a+r.slice(c+u.length):r=r.trimEnd()+`
|
|
3
3
|
|
|
4
4
|
`+a+`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k,b as p,c as h,e as m,f as u,g as f}from"./chunk-
|
|
1
|
+
import{a as k,b as p,c as h,e as m,f as u,g as f}from"./chunk-24SANXOZ.js";import{a as c}from"./chunk-OLM5RTFK.js";import"./chunk-3AZBET4N.js";import"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var y=class{capabilities=["text_generation","streaming","tool_calling"];provider="claude-code";modelId;binary;config;constructor(e,n){this.binary=e,this.config=n,this.modelId=n.model}async generateText(e,n){let r=w(this.config,e,"json"),s=f(e.messages,e.system);r.push("-p",s);let o=p(this.binary,r,{signal:n}),l=m(o.stderr),i=o.stdout.getReader(),a=[],d=new TextDecoder,g=await i.read();for(;g.done!==!0;)a.push(d.decode(g.value,{stream:!0})),g=await i.read();i.releaseLock();let T=await o.waitForExit(),_=await l,x=u("claude-code",T.code,_);if(x!==null)throw x;let S=a.join("");return v(S,this.modelId)}async*streamText(e,n){let r=this.config.properties?.streamFormat??"text",s=w(this.config,e,r),o=f(e.messages,e.system);s.push("-p",o);let l=p(this.binary,s,{signal:n}),i=m(l.stderr);try{r==="stream-json"?yield*this.#t(l,i):yield*this.#e(l,i)}catch(a){a instanceof c?yield{kind:"error",error:a}:yield{kind:"error",error:new c(a instanceof Error?a.message:String(a),{provider:"claude-code",cause:a instanceof Error?a:void 0})}}}async*#e(e,n){let r=new TextDecoder,s=e.stdout.getReader(),o=await s.read();for(;o.done!==!0;){let d=r.decode(o.value,{stream:!0});d.length>0&&(yield{kind:"content_delta",textDelta:d}),o=await s.read()}s.releaseLock();let l=await e.waitForExit(),i=await n,a=u("claude-code",l.code,i);a!==null?yield{kind:"error",error:a}:yield{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0}}}async*#t(e,n){for await(let l of h(e.stdout)){let i=E(l);i!==null&&(yield i)}let r=await e.waitForExit(),s=await n,o=u("claude-code",r.code,s);o!==null&&(yield{kind:"error",error:o})}close(){return Promise.resolve()}getRawClient(){return null}},P={provider:"claude-code",async createModel(t){let e=await k("claude",t);return new y(e,t)}},w=(t,e,n)=>{let r=[];n!=="text"&&r.push("--output-format",n),n==="stream-json"&&r.push("--verbose"),r.push("--model",t.model);let s=t.properties?.maxTurns;s!==void 0&&r.push("--max-turns",String(s));let o=t.properties?.allowedTools;if(o!==void 0)for(let i of o)r.push("--allowedTools",i);let l=t.properties?.args;return l!==void 0&&r.push(...l),r},v=(t,e)=>{try{let n=JSON.parse(t);return b(n,e)}catch{return{content:[{kind:"text",text:t.trim()}],stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0},modelId:e}}},b=(t,e)=>{let n=[];if(t.result!==void 0)n.push({kind:"text",text:String(t.result)});else if(t.message?.content!==void 0)for(let r of t.message.content)r.type==="text"?n.push({kind:"text",text:r.text}):r.type==="tool_use"&&n.push({kind:"tool_call",toolCall:{id:r.id??r.name,name:r.name,arguments:r.input??{}}});else typeof t=="string"&&n.push({kind:"text",text:t});return n.length===0&&n.push({kind:"text",text:JSON.stringify(t)}),{content:n,stopReason:t.stop_reason==="tool_use"?"tool_use":"end_turn",usage:{inputTokens:t.usage?.input_tokens??0,outputTokens:t.usage?.output_tokens??0,totalTokens:(t.usage?.input_tokens??0)+(t.usage?.output_tokens??0)},modelId:e,rawResponse:t}},E=t=>{if(t===null||typeof t!="object")return null;let e=t;if(e.type==="assistant"){if(e.message?.content!==void 0){for(let n of e.message.content)if(n.type==="text")return{kind:"content_delta",textDelta:n.text}}return null}return e.type==="content_block_delta"?e.delta?.type==="text_delta"?{kind:"content_delta",textDelta:e.delta.text}:null:e.type==="result"?{kind:"message_done",stopReason:e.subtype==="tool_use"?"tool_use":"end_turn",usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)}}:e.type==="error"?{kind:"error",error:new c(e.error?.message??"Unknown Claude Code error",{provider:"claude-code"})}:e.content!==void 0&&typeof e.content=="string"?{kind:"content_delta",textDelta:e.content}:null};export{y as ClaudeCodeModel,P as claudeCodeFactory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C}from"./chunk-PSXXTDLU.js";import{a as y,b as P}from"./chunk-UXRWSNVZ.js";import{k as g,l as b,m as A,n as x}from"./chunk-
|
|
1
|
+
import{a as C}from"./chunk-PSXXTDLU.js";import{a as y,b as P}from"./chunk-UXRWSNVZ.js";import{k as g,l as b,m as A,n as x}from"./chunk-WUVVLUU5.js";import{c,d as o,f as u,g as v,o as p,q as m,r as w}from"./chunk-EZH232V7.js";import{a,b as d}from"./chunk-2N4GTHXQ.js";import{b as f}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var q=async r=>{let e=r?.[0];if(e==="add")return await $(r?.slice(1));if(e==="remove")return await M(r?.slice(1));if(e==="list")return await I();let i=await g(f.process.cwd()),n=P(i),s=p({renderer:w.ansi(),sink:m.stdout()});return s.writeln(`Usage: ${n} concern <add <id> | remove <id> | list>`),await s.close(),a(void 0)},$=async r=>{let e=p({renderer:w.ansi(),sink:m.stdout()}),i=f.process.cwd(),n=r?.[0],s=await g(i);if(n===void 0||n.length===0)return e.writeln(u("Please provide a concern ID: "),c(y("concern add open-source",s))),await e.close(),d({exitCode:1});let t=await A(i,n);if(t===null&&(t=(await C()).find(h=>h.id===n)??null,t!==null&&await x(i,t)),t===null){let k=await C();return e.writeln(u(`Unknown concern: ${n}`)),k.length>0&&e.writeln(o(` Available: ${k.map(h=>h.id).join(", ")}`)),await e.close(),d({exitCode:1})}if(s===null)return e.writeln(u("noskills not initialized.")),await e.close(),d({exitCode:1});if(s.concerns.includes(n))return e.writeln(o(`Concern "${n}" is already active.`)),await e.close(),a(void 0);let l={...s,concerns:[...s.concerns,n]};return await b(i,l),e.writeln(v("\u2714")," Activated concern: ",c(n)),e.writeln(o(` ${t.description}`)),await e.close(),a(void 0)},M=async r=>{let e=p({renderer:w.ansi(),sink:m.stdout()}),i=f.process.cwd(),n=r?.[0],s=await g(i);if(n===void 0||n.length===0)return e.writeln(u("Please provide a concern ID: "),c(y("concern remove move-fast",s))),await e.close(),d({exitCode:1});if(s===null)return e.writeln(u("noskills not initialized.")),await e.close(),d({exitCode:1});if(!s.concerns.includes(n))return e.writeln(o(`Concern "${n}" is not active.`)),await e.close(),a(void 0);let t={...s,concerns:s.concerns.filter(l=>l!==n)};return await b(i,t),e.writeln(v("\u2714")," Deactivated concern: ",c(n)),await e.close(),a(void 0)},I=async()=>{let r=p({renderer:w.ansi(),sink:m.stdout()}),e=f.process.cwd(),i=await g(e),n=await C(),s=i?.concerns??[];if(r.writeln(c("Concerns")),r.writeln(""),n.length===0)r.writeln(o(" No concerns defined."));else for(let t of n){let l=s.includes(t.id);r.writeln(" ",l?v("\u25CF"):o("\u25CB")," ",l?c(t.id):o(t.id),o(` ${t.description.slice(0,60)}...`))}return await r.close(),a(void 0)};export{q as main};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,d as U}from"./chunk-
|
|
1
|
+
import{a as C,d as U}from"./chunk-XCVAHUBM.js";import{a as E}from"./chunk-4ODVKO5Y.js";import{a as S}from"./chunk-UXRWSNVZ.js";import{e as f,f as h,k as g}from"./chunk-WUVVLUU5.js";import{c as n,d as i,f as l,g as m,o as d,q as w,r as u}from"./chunk-EZH232V7.js";import{a as o,b as p}from"./chunk-2N4GTHXQ.js";import{b as c}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var G=async y=>{let e=d({renderer:u.ansi(),sink:w.stdout()}),s=c.process.cwd(),t=await f(s),$=await g(s);if(t.phase!=="EXECUTING")return e.writeln(l(`Cannot complete in phase: ${t.phase}`)),e.writeln(i("Only EXECUTING phase can transition to DONE.")),await e.close(),p({exitCode:1});let r=E(t,"DONE");if(await h(s,r),r.spec!==null&&(await C(s,r.spec,"done"),await U(s,r.spec,"done")),e.writeln(m("\u2714")," Spec completed!"),e.writeln(""),e.writeln(" Spec: ",n(t.spec??"unknown")),e.writeln(` Iterations: ${t.execution.iteration}`),e.writeln(` Decisions: ${t.decisions.length}`),t.decisions.length>0){let a=t.decisions.filter(k=>k.promoted);a.length>0&&e.writeln(i(` Promoted to rules: ${a.length}`))}return e.writeln(""),e.writeln("Start a new spec with: ",n(`${S('spec new "..."',$)}`)),await e.close(),o(void 0)};export{G as main};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as ee,b as te,c as oe}from"./chunk-O5KQZHIN.js";import{a as S,b as J,e as T,f as N,g as q,h as r,i as h}from"./chunk-LG5R766Y.js";import{a as Q}from"./chunk-ZJVSE2FP.js";import{a as X,b as Y}from"./chunk-ZQ77HAFD.js";import"./chunk-AGPCY6XP.js";import{a as k}from"./chunk-IR75X4G7.js";import{d as Z}from"./chunk-42EQ3GZJ.js";import"./chunk-BLHOTPRB.js";import{a as B}from"./chunk-PSXXTDLU.js";import{a as I}from"./chunk-UXRWSNVZ.js";import{a as G,b as U,f as W,k as z,l as _,n as H,p as K,r as V}from"./chunk-WUVVLUU5.js";import"./chunk-EZH232V7.js";import"./chunk-5MN3MWQN.js";import"./chunk-OLM5RTFK.js";import{a as F}from"./chunk-GSYCN7EG.js";import{a as P}from"./chunk-2N4GTHXQ.js";import"./chunk-3AZBET4N.js";import{a as O,b as g}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var pe=new F({description:"AI provider interface \u2014 ask questions, generate content",modules:{ask:{description:"Send a prompt to an AI provider",load:()=>import("./ask-4XOYE32R.js")},list:{description:"List available AI providers",load:()=>import("./list-GRXQ2DIM.js")}}});var se=k;var me=async t=>{try{return await g.fs.stat(t),!0}catch{return!1}},fe=[{id:"claude-code",paths:["CLAUDE.md",".claude"]},{id:"cursor",paths:[".cursorrules",".cursor"]},{id:"kiro",paths:[".kiro"]},{id:"copilot",paths:[".github/copilot-instructions.md"]},{id:"windsurf",paths:[".windsurfrules"]}],ne=async t=>{let e=[];for(let n of fe)for(let o of n.paths)if(await me(`${t}/${o}`)){e.push(n.id);break}return e};var a=async t=>{try{return await g.fs.stat(t),!0}catch{return!1}},ie=async(t,e)=>{try{let n=await g.fs.readTextFile(t);return JSON.parse(n)[e]??null}catch{return null}},ye=async t=>{let e=[];return(await a(`${t}/package.json`)||await a(`${t}/deno.json`))&&e.push("typescript"),await a(`${t}/go.mod`)&&e.push("go"),await a(`${t}/Cargo.toml`)&&e.push("rust"),(await a(`${t}/pyproject.toml`)||await a(`${t}/setup.py`))&&e.push("python"),e},we=async t=>{let e=[],n=await ie(`${t}/package.json`,"dependencies");return n!==null&&("react"in n&&e.push("react"),"vue"in n&&e.push("vue"),"svelte"in n&&e.push("svelte"),"next"in n&&e.push("nextjs"),"express"in n&&e.push("express"),"hono"in n&&e.push("hono")),e},be=async t=>{let e=[];return await a(`${t}/.github/workflows`)&&e.push("github-actions"),await a(`${t}/.gitlab-ci.yml`)&&e.push("gitlab-ci"),await a(`${t}/Jenkinsfile`)&&e.push("jenkins"),await a(`${t}/.circleci`)&&e.push("circleci"),e},ve=async t=>{if(await a(`${t}/deno.json`))return"deno";let e=await ie(`${t}/package.json`,"devDependencies");if(e!==null){if("vitest"in e)return"vitest";if("jest"in e)return"jest";if("playwright"in e)return"playwright"}return null},re=async t=>{let[e,n,o,d]=await Promise.all([ye(t),we(t),be(t),ve(t)]);return{languages:e,frameworks:n,ci:o,testRunner:d}};var St=async t=>{let e=g.process.cwd(),n=te(t),o=J({target:n==="agent"?"non-interactive":"interactive"}),d=oe(t),y=ae(d,"--concerns"),m=ae(d,"--tools"),p=d.includes("--non-interactive")||n==="agent";if(await V(e)){let s=await z(e);return r.warn(o,"noskills is already initialized in this project."),r.info(o,`Run \`${I("sync",s)}\` to regenerate tool files.`),P(void 0)}N(o,"noskills init");let $=h(o,"Scanning project...");$.start();let f=await re(e);$.succeed("Project scanned");for(let s of f.languages)r.step(o,` ${s}`);for(let s of f.frameworks)r.step(o,` ${s}`);for(let s of f.ci)r.step(o,` ${s}`);f.testRunner!==null&&r.step(o,` test runner: ${f.testRunner}`);let A=h(o,"Detecting coding tools...");A.start();let R=await ne(e),w=ee(),D=w!==null&&!R.includes(w)?[w]:[],b=[...new Set([...D,...R])];A.succeed(`${b.length} coding tool(s) detected`);for(let s of b){let i=s===w?" (current)":"";r.step(o,` ${s}${i}`)}let u;if(m!==null){let s=["claude-code","cursor","kiro","copilot","windsurf"],i=m.filter(c=>s.includes(c));u=[...new Set([...D,...i])]}else p?u=[...b]:u=await Pe(o,b,w);let M=h(o,"Detecting AI providers...");M.start();let C=(await se()).filter(s=>s.available).map(s=>s.name);M.succeed(`${C.length} provider(s) detected`);let x=await B(),l;if(y!==null){let s=x.map(i=>i.id);l=y.filter(i=>s.includes(i)).sort((i,c)=>s.indexOf(i)-s.indexOf(c))}else if(p)l=[];else{let s=x.map(c=>({value:c.id,label:c.name,hint:c.description.slice(0,60)})),i=await T(o,{message:"What kind of project is this? (space to toggle, enter to confirm)",options:s});l=S(i)?[]:[...i]}l.length>0?r.success(o,`Concerns: ${l.join(", ")}`):r.info(o,"No concerns selected. Add later with `concern add <id>`.");let E=await Se(),j=h(o,"Initializing...");j.start(),await K(e);let le=x.filter(s=>l.includes(s.id));for(let s of le)await H(e,s);let v={...U(l,u,C,f),command:E};await _(e,v);let L=G();if(await W(e,L),j.succeed("Scaffolded `.eser/`"),u.length>0){let s=h(o,"Syncing tool files...");s.start();let i=await Y(e,u,v);s.succeed(`Synced ${i.length} tool(s)`)}else r.warn(o,"No tools selected. noskills will work in agentless CLI mode only."),r.info(o,"Add tools later with `noskills sync`.");if(r.success(o,`Done. ${u.length} tool(s), ${C.length} provider(s), ${l.length} concern(s).`),r.info(o,`Command prefix: ${E}`),n==="agent"){let i=(await B()).filter(de=>l.includes(de.id)),c=await X(e),ce=Q(L,i,c,v);await Z(ce,"json")}else q(o,`Start a spec with: ${I('spec new "..."',v)}`);return P(void 0)},xe=[{value:"claude-code",label:"Claude Code"},{value:"cursor",label:"Cursor"},{value:"kiro",label:"Kiro"},{value:"copilot",label:"GitHub Copilot"},{value:"windsurf",label:"Windsurf"}],Pe=async(t,e,n)=>{let o=e.length===0?"No coding tools detected. Which tools do you use? (space to toggle)":"Any additional tools? (space to toggle, enter to skip)",d=new Set(e),y=await T(t,{message:o,options:xe.map(p=>({...p,hint:p.value===n?"you're running inside it":d.has(p.value)?"detected":void 0,disabled:p.value===n})),initialValues:[...e],required:!1});if(S(y))return[...e];let m=[...y];return n!==null&&!m.includes(n)&&m.unshift(n),m},ae=(t,e)=>{if(t===void 0)return null;for(let n of t)if(n.startsWith(`${e}=`))return n.slice(e.length+1).split(",").map(o=>o.trim()).filter(Boolean);return null},Se=async()=>{try{return`${await O({command:"eser",devCommand:"deno task cli",npmPackage:"eser@latest",jsrPackage:"@eser/cli"})} noskills`}catch{return"npx eser@latest noskills"}};export{St as main};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as D}from"./chunk-ZJVSE2FP.js";import{a as C}from"./chunk-
|
|
1
|
+
import{a as D}from"./chunk-ZJVSE2FP.js";import{a as C}from"./chunk-ZQ77HAFD.js";import"./chunk-BLHOTPRB.js";import"./chunk-PSXXTDLU.js";import{a as d}from"./chunk-UXRWSNVZ.js";import{d as g,e as $,k as y,o as x,r as v}from"./chunk-WUVVLUU5.js";import{a as r}from"./chunk-2N4GTHXQ.js";import{b as i}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var S=async()=>{let e=i.process.stdin.getReader(),s=[];try{for(;;){let{done:o,value:a}=await e.read();if(o||a===void 0)break;s.push(a)}}finally{e.releaseLock()}let t=0,c=new Uint8Array(s.reduce((o,a)=>o+a.length,0));for(let o of s)c.set(o,t),t+=o.length;let n=new TextDecoder().decode(c);try{return JSON.parse(n)}catch{return{}}},P=async e=>{let s=new TextEncoder,t=i.process.stdout.getWriter();await t.write(s.encode(JSON.stringify(e))),t.releaseLock()},W=async e=>{switch(e?.[0]){case"pre-tool-use":return await T();case"stop":return await F();case"post-file-write":return await E();case"post-bash":return await I();case"session-start":return await N();default:return r(void 0)}},T=async()=>{let e=await S(),s=e.tool_name??"unknown",t=e.tool_input??{},c=e.cwd??i.process.cwd(),n=await y(c),o={};try{o=await $(c)}catch{return r(void 0)}let a=async u=>{await P({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`noskills: ${u}`}})};if(o.pendingClear===!0)return await a(`Task accepted. You must run \`/clear\` and then \`${d("next",n)}\` before continuing.`),r(void 0);if(s==="Bash"){let u=(t.command??"").trim();if(!(n?.allowGit??!1)){let w=["git add","git commit","git push","git merge","git rebase","git checkout","git stash","git reset","git cherry-pick","git tag","git branch -d","git branch -D","git branch -m","git revert","git am","git mv","git rm"];for(let p of w)if(u.startsWith(p)||u.includes(` && ${p}`)||u.includes(`; ${p}`))return await a("git is read-only for agents. The user controls git. You may use `git log`, `git diff`, `git status`, `git show`, `git blame`."),r(void 0)}return r(void 0)}if(!["Write","Edit","MultiEdit"].includes(s))return r(void 0);let m=t.file_path??t.path??"";if(m.includes(".eser/")||m.includes(".claude/"))return r(void 0);let f=o.phase??"UNKNOWN";if(f==="EXECUTING")return r(void 0);let k={IDLE:`No active spec. Run \`${d("spec new",n)}\``,UNINITIALIZED:`noskills not initialized. Run \`${d("init",n)}\``,DISCOVERY:`Discovery in progress. Run \`${d("next",n)}\` to continue.`,SPEC_DRAFT:`Spec needs review. Run \`${d("approve",n)}\``,SPEC_APPROVED:`Start execution first: \`${d('next --answer="start"',n)}\``,BLOCKED:`Execution blocked. Resolve with \`${d('next --answer="resolution"',n)}\``,DONE:`Spec complete. Start a new one or run \`${d("reset",n)}\``};return await a(k[f]??`Run \`${d("next",n)}\` first.`),r(void 0)},F=async()=>{let e=await S();if(e.stop_hook_active===!0)return r(void 0);let s=e.cwd??i.process.cwd(),t;try{let l=await i.fs.readTextFile(`${s}/${g.stateFile}`);t=JSON.parse(l)}catch{return r(void 0)}if(t.phase!=="EXECUTING")return r(void 0);let c=t.execution??{},n=`${s}/${g.stateDir}/files-changed.jsonl`,o=[];try{let w=(await i.fs.readTextFile(n)).trim().split(`
|
|
2
2
|
`).filter(Boolean);o=[...new Set(w.map(p=>{try{return JSON.parse(p).file}catch{return null}}).filter(p=>p!==null))]}catch{}let a=[],h="no changes";try{let{execSync:l}=await import("node:child_process");a=l("git diff --name-only",{cwd:s,encoding:"utf-8",timeout:5e3}).trim().split(`
|
|
3
3
|
`).filter(Boolean);let R=l("git diff --stat",{cwd:s,encoding:"utf-8",timeout:5e3}).trim().split(`
|
|
4
4
|
`);h=R[R.length-1]??"no changes"}catch{}let m=[...new Set([...o,...a])],f=(c.iteration??0)+1,k=`${s}/${g.stateDir}/iterations`;try{await i.fs.mkdir(k,{recursive:!0}),await i.fs.writeTextFile(`${k}/iteration-${f}.json`,JSON.stringify({iteration:f,files:m,gitStat:h.trim(),timestamp:new Date().toISOString()},null,2)+`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as S,b as g,d as T,e as m,f,g as y}from"./chunk-
|
|
1
|
+
import{a as S,b as g,d as T,e as m,f,g as y}from"./chunk-24SANXOZ.js";import{a as l}from"./chunk-OLM5RTFK.js";import"./chunk-3AZBET4N.js";import"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var k=class{capabilities=["text_generation","streaming"];provider="kiro";modelId;binary;config;constructor(e,r){this.binary=e,this.config=r,this.modelId=r.model}async generateText(e,r){let o=v(this.config,e),c=y(e.messages,e.system);o.push("--prompt",c);let s=g(this.binary,o,{signal:r}),u=m(s.stderr),t=await T(s.stdout,this.modelId),d=await s.waitForExit(),i=await u,a=f("kiro",d.code,i);if(a!==null)throw a;return t}async*streamText(e,r){let o=v(this.config,e),c=y(e.messages,e.system);o.push("--prompt",c);let s=g(this.binary,o,{signal:r}),u=m(s.stderr);try{let t=new TextDecoder,d=s.stdout.getReader(),i="",a=await d.read();for(;a.done!==!0;){i+=t.decode(a.value,{stream:!0});let x=i.split(`
|
|
2
2
|
`);i=x.pop()??"";for(let _ of x){let p=_.trim();if(p.length!==0){try{let A=JSON.parse(p),w=C(A);if(w!==null){yield w;continue}}catch{}yield{kind:"content_delta",textDelta:p+`
|
|
3
3
|
`}}}a=await d.read()}d.releaseLock(),i.trim().length>0&&(yield{kind:"content_delta",textDelta:i.trim()});let E=await s.waitForExit(),b=await u,h=f("kiro",E.code,b);h!==null?yield{kind:"error",error:h}:yield{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0}}}catch(t){t instanceof l?yield{kind:"error",error:t}:yield{kind:"error",error:new l(t instanceof Error?t.message:String(t),{provider:"kiro",cause:t instanceof Error?t:void 0})}}}close(){return Promise.resolve()}getRawClient(){return null}},O={provider:"kiro",async createModel(n){let e=await S("kiro",n);return new k(e,n)}},v=(n,e)=>{let r=[];r.push("--output","json"),r.push("--model",n.model),e.maxTokens!==void 0&&r.push("--max-tokens",String(e.maxTokens));let o=n.properties?.args;return o!==void 0&&r.push(...o),r},C=n=>{if(n===null||typeof n!="object")return null;let e=n;if(e.type==="content"||e.type==="text"){let r=e.text??e.content;return r!==void 0?{kind:"content_delta",textDelta:String(r)}:null}return e.type==="done"||e.type==="result"||e.done===!0?{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)}}:e.type==="error"?{kind:"error",error:new l(e.error?.message??e.message??"Unknown Kiro error",{provider:"kiro"})}:null};export{k as KiroModel,O as kiroFactory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p}from"./chunk-
|
|
1
|
+
import{a as p}from"./chunk-IR75X4G7.js";import{c as t,d as a,g as l,m as n,o,q as m,r as d}from"./chunk-EZH232V7.js";import{a as i}from"./chunk-2N4GTHXQ.js";import"./chunk-3AZBET4N.js";import"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var $=async b=>{let e=o({renderer:d.ansi(),sink:m.stdout()});e.writeln(t("AI Providers")),e.writeln("");let r=await p(),v=r.map(s=>[s.available?l("\u25CF"):a("\u25CB"),s.available?t(`${s.name} (${s.alias})`):a(`${s.name} (${s.alias})`),a(s.type),s.available?s.detail:a(s.detail)]);e.writeln(n(["","Provider","Type","Status"],v));let u=r.filter(s=>s.available).length;return e.writeln(a(`${u}/${r.length} providers available`)),await e.close(),i(void 0)};export{$ as main};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"./chunk-
|
|
1
|
+
import{a,b,c,d}from"./chunk-3AZBET4N.js";import"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{b as CommandBuilder,a as CommandError,d as exec,c as parseCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as _}from"./chunk-
|
|
1
|
+
import{a as _}from"./chunk-3HRRWTVF.js";import{a as v}from"./chunk-IVSTITPL.js";import{a as B,b as H,c as Q,d as z}from"./chunk-XCVAHUBM.js";import{a as j,c as A,d as G,f as J,h as W}from"./chunk-4ODVKO5Y.js";import{a as P}from"./chunk-ZJVSE2FP.js";import{a as b}from"./chunk-ZQ77HAFD.js";import{a as q,b as M,d as x}from"./chunk-42EQ3GZJ.js";import{b as U,c as L,d as N}from"./chunk-BLHOTPRB.js";import"./chunk-PSXXTDLU.js";import{a as V}from"./chunk-UXRWSNVZ.js";import{d as O,e as E,k as I,o as $,q as y,r as T}from"./chunk-WUVVLUU5.js";import{a as F,b as D}from"./chunk-2N4GTHXQ.js";import{b as h}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var Z=o=>o.split(`
|
|
2
2
|
`).map(e=>e.replace(/^[-*]\s+/,"").trim()).filter(e=>e.length>0&&!e.startsWith("#")),ee=async(o,e)=>{let i=[],n=(e.startsWith(o)?e.slice(o.length+1):e).split("/");n.pop();for(let t=n.length;t>=0;t--){let r=`${t===0?o:`${o}/${n.slice(0,t).join("/")}`}/.folder-rules.md`,c=t===0?".":n.slice(0,t).join("/");try{let p=await h.fs.readTextFile(r),g=Z(p);for(let f of g)i.push({folder:c,rule:f})}catch{}}return i},k=async(o,e)=>{let i=new Set,a=[];for(let n of e){let t=await ee(o,n);for(let s of t){let r=`${s.folder}::${s.rule}`;i.has(r)||(i.add(r),a.push(s))}}return a};var ye=async o=>{let e=h.process.cwd(),i=q(o),a=M(o);if(!await T(e)){let l=await I(e);return await x({error:`noskills not initialized. Run: ${V("init",l)}`},i),D({exitCode:1})}let n=null;for(let l of a)l.startsWith("--answer=")&&(n=l.slice(9));let t=await E(e),s=await I(e);if(t.pendingClear&&(t={...t,pendingClear:!1},await y(e,t)),s===null)return await x({error:"No config found"},i),D({exitCode:1});let c=(await $(e)).filter(l=>s.concerns.includes(l.id));if(n!==null){let l=await se(e,t,s,c,n);await y(e,l);let u={...l,lastCalledAt:new Date().toISOString()};await y(e,u);let m=await b(e),d=u.spec!==null?await v(e,u.spec):null,R=await K(e,u),X=await k(e,R),Y=P(u,c,m,s,d,X);return await x(Y,i),F(void 0)}let p={...t,lastCalledAt:new Date().toISOString()};await y(e,p);let g=await b(e),f=p.spec!==null?await v(e,p.spec):null,w=await K(e,p),C=await k(e,w),S=P(p,c,g,s,f,C);return await x(S,i),F(void 0)},se=async(o,e,i,a,n)=>{switch(e.phase){case"DISCOVERY":{let t=null;try{let r=JSON.parse(n);typeof r=="object"&&r!==null&&!Array.isArray(r)&&(t=r)}catch{}let s=e;if(t!==null)for(let[r,c]of Object.entries(t))typeof c=="string"&&c.length>0&&(s=A(s,r,c));else{let r=U(a),c=L(r,s.discovery.answers);if(c===null)return e;s=A(s,c.id,n)}return N(s.discovery.answers)&&(s=G(s)),s}case"SPEC_DRAFT":{if(e.classification===null){let t;try{let r=JSON.parse(n);t={involvesUI:r.involvesUI===!0,involvesPublicAPI:r.involvesPublicAPI===!0,involvesMigration:r.involvesMigration===!0,involvesDataHandling:r.involvesDataHandling===!0}}catch{t={involvesUI:!1,involvesPublicAPI:!1,involvesMigration:!1,involvesDataHandling:!1}}let s={...e,classification:t};try{await _(o,s,a)}catch{}return s}return e}case"SPEC_APPROVED":{let t=J(e);return t.spec!==null&&(await B(o,t.spec,"executing"),await z(o,t.spec,"executing")),t}case"EXECUTING":{if(!e.execution.awaitingStatusReport){let t={...e,execution:{...e.execution,lastProgress:n}};if(i.verifyCommand!==null&&i.verifyCommand!==void 0&&i.verifyCommand.length>0){let s=await ie(o,i.verifyCommand);if(t={...t,execution:{...t.execution,lastVerification:s}},!s.passed)return t}return t={...t,execution:{...t.execution,awaitingStatusReport:!0}},t}return await ne(o,e,n,a)}case"BLOCKED":{let t=e.execution.lastProgress??"Unknown",s={id:`d${e.decisions.length+1}`,question:t.replace(/^BLOCKED:\s*/,""),choice:n,promoted:!1,timestamp:new Date().toISOString()},r=W(e,s);return r=j(r,"EXECUTING"),r={...r,execution:{...r.execution,lastProgress:`Resolved: ${n}`}},r}default:return e}},ne=async(o,e,i,a)=>{let n;try{n=JSON.parse(i)}catch{return{...e,execution:{...e.execution,lastProgress:i,awaitingStatusReport:!1}}}let t=n.completed??[],s=n.remaining??[],r=n.blocked??[],c=[...s,...r],p=e.execution.debt?.unaddressedIterations??0,g=c.length>0?{items:c,fromIteration:e.execution.iteration,unaddressedIterations:1}:null,f=g;if(e.execution.debt!==null&&g!==null){let l=new Set(t.map(d=>d.toLowerCase().trim())),u=e.execution.debt.items.filter(d=>!l.has(d.toLowerCase().trim())),m=[...new Set([...u,...c])];f=m.length>0?{items:m,fromIteration:e.execution.debt.fromIteration,unaddressedIterations:u.length>0?p+1:1}:null}else if(e.execution.debt!==null&&g===null){let l=new Set(t.map(m=>m.toLowerCase().trim())),u=e.execution.debt.items.filter(m=>!l.has(m.toLowerCase().trim()));f=u.length>0?{items:u,fromIteration:e.execution.debt.fromIteration,unaddressedIterations:p+1}:null}let w=t.length>0?`Completed: ${t.join(", ")}`:"Status report submitted",C=e.execution.lastVerification===null||e.execution.lastVerification.passed===!0,S=f===null&&C;if(S&&e.spec!==null){let l=await v(o,e.spec);if(l!==null){let u=e.execution.completedTasks??[],m=new Set(u),d=l.tasks.find(R=>!m.has(R.id));if(d!==void 0)return await H(o,e.spec,d.id),await Q(o,e.spec,d.id,"done"),{...e,pendingClear:!0,execution:{...e.execution,lastProgress:`Task ${d.id} accepted: ${w}`,awaitingStatusReport:!1,debt:f,completedTasks:[...u,d.id]}}}}return{...e,pendingClear:S,execution:{...e.execution,lastProgress:S?w:`Task not accepted \u2014 remaining items must be addressed first. ${w}`,awaitingStatusReport:!1,debt:f}}},ie=async(o,e)=>{try{let{execSync:i}=await import("node:child_process"),a=i(e,{cwd:o,encoding:"utf-8",timeout:6e4,stdio:["pipe","pipe","pipe"]});return{passed:!0,output:String(a).slice(0,4e3),timestamp:new Date().toISOString()}}catch(i){let a=i,n=((a.stdout??"")+(a.stderr??"")).slice(0,4e3);return a.status!==void 0?{passed:!1,output:n||"Verification failed with no output",timestamp:new Date().toISOString()}:{passed:!1,output:`Verification command failed to execute: ${i instanceof Error?i.message:String(i)}`,timestamp:new Date().toISOString()}}},K=async(o,e)=>{let i=[...e.execution.modifiedFiles??[]],a=await re(o);return[...new Set([...i,...a])]},re=async o=>{let e=`${o}/${O.stateDir}/files-changed.jsonl`;try{let a=(await h.fs.readTextFile(e)).trim().split(`
|
|
3
3
|
`).filter(Boolean),n=[];for(let t of a)try{let s=JSON.parse(t);n.includes(s.file)||n.push(s.file)}catch{}return n}catch{return[]}};export{ye as main};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{c as u}from"./chunk-
|
|
1
|
+
import{c as u}from"./chunk-24SANXOZ.js";import{a as i,e as m}from"./chunk-OLM5RTFK.js";import"./chunk-3AZBET4N.js";import"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var p="http://localhost:11434",d=class{capabilities=["text_generation","streaming","vision"];provider="ollama";modelId;baseUrl;config;constructor(e,o){this.baseUrl=e,this.config=o,this.modelId=o.model}async generateText(e,o){let s=g(this.config,e,!1);try{let t=await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),signal:o});if(!t.ok)throw await f(t);let r=await t.json();return h(r,this.modelId)}catch(t){throw t instanceof i?t:new i(t instanceof Error?t.message:String(t),{provider:"ollama",cause:t instanceof Error?t:void 0})}}async*streamText(e,o){let s=g(this.config,e,!0);try{let t=await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),signal:o});if(!t.ok){yield{kind:"error",error:await f(t)};return}if(t.body===null){yield{kind:"error",error:new i("No response body",{provider:"ollama"})};return}for await(let r of u(t.body)){let l=k(r);l!==null&&(yield l)}}catch(t){t instanceof i?yield{kind:"error",error:t}:yield{kind:"error",error:new i(t instanceof Error?t.message:String(t),{provider:"ollama",cause:t instanceof Error?t:void 0})}}}close(){return Promise.resolve()}getRawClient(){return null}},v={provider:"ollama",createModel(n){let e=n.properties?.baseUrl??p;return Promise.resolve(new d(e,n))}},g=(n,e,o)=>{let s=y(e.messages,e.system),t={model:n.model,messages:s,stream:o},r={};return e.temperature!==void 0&&(r.temperature=e.temperature),e.maxTokens!==void 0&&(r.num_predict=e.maxTokens),e.topP!==void 0&&(r.top_p=e.topP),e.stopWords!==void 0&&(r.stop=e.stopWords),Object.keys(r).length>0&&(t.options=r),e.responseFormat!==void 0&&(e.responseFormat.type==="json_schema"?t.format=e.responseFormat.jsonSchema:e.responseFormat.type==="json_object"&&(t.format="json")),t},y=(n,e)=>{let o=[];e!==void 0&&o.push({role:"system",content:e});for(let s of n){if(s.role==="system"){let a=[];for(let c of s.content)c.kind==="text"&&a.push(c.text);o.push({role:"system",content:a.join(`
|
|
2
2
|
`)});continue}let t=[],r=[];for(let a of s.content)a.kind==="text"?t.push(a.text):a.kind==="image"&&a.image.url!==void 0&&r.push(a.image.url);let l={role:s.role==="tool"?"user":s.role,content:t.join(`
|
|
3
3
|
`)};r.length>0&&(l.images=r),o.push(l)}return o},h=(n,e)=>{let o=[];return n.message?.content!==void 0&&o.push({kind:"text",text:n.message.content}),{content:o,stopReason:n.done_reason==="length"?"max_tokens":"end_turn",usage:{inputTokens:n.prompt_eval_count??0,outputTokens:n.eval_count??0,totalTokens:(n.prompt_eval_count??0)+(n.eval_count??0)},modelId:e,rawResponse:n}},k=n=>{if(n===null||typeof n!="object")return null;let e=n;return e.done===!0?{kind:"message_done",stopReason:e.done_reason==="length"?"max_tokens":"end_turn",usage:{inputTokens:e.prompt_eval_count??0,outputTokens:e.eval_count??0,totalTokens:(e.prompt_eval_count??0)+(e.eval_count??0)}}:e.message?.content!==void 0&&e.message.content.length>0?{kind:"content_delta",textDelta:e.message.content}:e.response!==void 0&&e.response.length>0?{kind:"content_delta",textDelta:e.response}:null},f=async n=>{let e;try{e=(await n.json()).error??`Ollama HTTP ${n.status}`}catch{e=`Ollama HTTP ${n.status}: ${n.statusText}`}return m("ollama",n.status,new Error(e))};export{d as OllamaModel,v as ollamaFactory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h,b as u,c as S,d as k,e as g,f as m,g as f}from"./chunk-
|
|
1
|
+
import{a as h,b as u,c as S,d as k,e as g,f as m,g as f}from"./chunk-24SANXOZ.js";import{a as c}from"./chunk-OLM5RTFK.js";import"./chunk-3AZBET4N.js";import"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var y=class{capabilities=["text_generation","streaming"];provider="opencode";modelId;binary;config;constructor(e,r){this.binary=e,this.config=r,this.modelId=r.model}async generateText(e,r){let o=w(this.config,e,"json"),i=f(e.messages,e.system);o.push("-p",i);let s=u(this.binary,o,{signal:r}),l=g(s.stderr),t=await k(s.stdout,this.modelId),p=await s.waitForExit(),a=await l,d=m("opencode",p.code,a);if(d!==null)throw d;return t}async*streamText(e,r){let o=w(this.config,e,"stream-json"),i=f(e.messages,e.system);o.push("-p",i);let s=u(this.binary,o,{signal:r}),l=g(s.stderr);try{for await(let d of S(s.stdout)){let x=v(d);x!==null&&(yield x)}let t=await s.waitForExit(),p=await l,a=m("opencode",t.code,p);a!==null&&(yield{kind:"error",error:a})}catch(t){t instanceof c?yield{kind:"error",error:t}:yield{kind:"error",error:new c(t instanceof Error?t.message:String(t),{provider:"opencode",cause:t instanceof Error?t:void 0})}}}close(){return Promise.resolve()}getRawClient(){return null}},b={provider:"opencode",async createModel(n){let e=await h("opencode",n);return new y(e,n)}},w=(n,e,r)=>{let o=["--output-format",r];o.push("--model",n.model),e.maxTokens!==void 0&&o.push("--max-tokens",String(e.maxTokens));let i=n.properties?.args;return i!==void 0&&o.push(...i),o},v=n=>{if(n===null||typeof n!="object")return null;let e=n;if(e.type==="content_block_delta"||e.type==="assistant"){let r=e.delta?.text??e.message?.content?.[0]?.text;return r!==void 0?{kind:"content_delta",textDelta:r}:null}return e.type==="result"||e.done===!0?{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)}}:e.type==="error"?{kind:"error",error:new c(e.error?.message??"Unknown OpenCode error",{provider:"opencode"})}:e.content!==void 0&&typeof e.content=="string"?{kind:"content_delta",textDelta:e.content}:null};export{y as OpenCodeModel,b as openCodeFactory};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as v,c as k}from"./chunk-
|
|
1
|
+
import{b as v,c as k}from"./chunk-O5KQZHIN.js";import{a as p,b as w,c as h,h as r}from"./chunk-LG5R766Y.js";import{c as $,d as c}from"./chunk-WUVVLUU5.js";import"./chunk-EZH232V7.js";import{a as d,b as g}from"./chunk-2N4GTHXQ.js";import{b as n}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import{e as y}from"./chunk-DXB73IDG.js";var x=y($(),1);var M=async i=>{let e=n.process.cwd(),s=v(i),t=w({target:s==="agent"?"non-interactive":"interactive"});if(!k(i).includes("--force")){if(s==="agent")return r.error(t,"Purge requires `--force` flag in agent mode."),g({exitCode:1});let l=await h(t,{message:"This will remove all noskills specs, rules, concerns, and hooks. Continue?"});if(p(l)||l!==!0)return r.info(t,"Aborted."),d(void 0)}return r.step(t,"Purging noskills content..."),await u(`${e}/${c.concernsDir}`,t,"`.eser/concerns/`"),await u(`${e}/${c.specsDir}`,t,"`.eser/specs/`"),await u(`${e}/${c.rulesDir}`,t,"`.eser/rules/`"),await u(`${e}/${c.stateDir}`,t,"`.eser/.state/`"),await C(e,t),await T(e,t),await m(`${e}/.cursorrules`,t,"`.cursorrules`"),await m(`${e}/.windsurfrules`,t,"`.windsurfrules`"),await m(`${e}/.kiro/steering/conventions.md`,t,"`.kiro/steering/conventions.md`"),await m(`${e}/.github/copilot-instructions.md`,t,"`.github/copilot-instructions.md`"),await F(e,t),r.success(t,"Purge complete."),d(void 0)},u=async(i,e,s)=>{try{await n.fs.stat(i);let{rmSync:t}=await import("node:fs");t(i,{recursive:!0,force:!0}),r.step(e,` Removed ${s}`)}catch{}},m=async(i,e,s)=>{try{await n.fs.stat(i);let{unlinkSync:t}=await import("node:fs");t(i),r.step(e,` Removed ${s}`)}catch{}},C=async(i,e)=>{let s=`${i}/${c.manifestFile}`;try{let t=await n.fs.readTextFile(s),o=x.parseDocument(t);o.has("noskills")&&(o.delete("noskills"),await n.fs.writeTextFile(s,o.toString()),r.step(e," Removed noskills section from `manifest.yml`"))}catch{}},T=async(i,e)=>{let s=`${i}/CLAUDE.md`,t="<!-- noskills:start -->",o="<!-- noskills:end -->";try{let a=await n.fs.readTextFile(s),l=a.indexOf(t),f=a.indexOf(o);l!==-1&&f!==-1&&(a=a.slice(0,l).trimEnd()+`
|
|
2
2
|
`+a.slice(f+o.length).trimStart(),await n.fs.writeTextFile(s,a.trimEnd()+`
|
|
3
3
|
`),r.step(e," Removed noskills section from `CLAUDE.md`"))}catch{}},F=async(i,e)=>{let s=`${i}/.claude/settings.json`;try{let t=await n.fs.readTextFile(s),o=JSON.parse(t);o.hooks!==void 0&&(delete o.hooks,await n.fs.writeTextFile(s,JSON.stringify(o,null,2)+`
|
|
4
4
|
`),r.step(e," Removed hooks from `.claude/settings.json`"))}catch{}};export{M as main};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as u}from"./chunk-
|
|
1
|
+
import{i as u}from"./chunk-4ODVKO5Y.js";import{e as c,f as d}from"./chunk-WUVVLUU5.js";import{d as a,g as o,o as m,q as p,r as l}from"./chunk-EZH232V7.js";import{a as r}from"./chunk-2N4GTHXQ.js";import{b as n}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var N=async w=>{let e=m({renderer:l.ansi(),sink:p.stdout()}),i=n.process.cwd(),s=await c(i);if(s.phase==="IDLE"||s.phase==="UNINITIALIZED")return e.writeln(a("Already idle. Nothing to reset.")),await e.close(),r(void 0);let t=s.spec,f=u(s);return await d(i,f),e.writeln(o("\u2714")," Reset to IDLE."),t!==null&&e.writeln(a(`Spec "${t}" state cleared. Files in .eser/specs/${t}/ preserved.`)),await e.close(),r(void 0)};export{N as main};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as k,b as x}from"./chunk-
|
|
1
|
+
import{a as k,b as x}from"./chunk-ZQ77HAFD.js";import{a as g,b as y}from"./chunk-UXRWSNVZ.js";import{d as w,k as c}from"./chunk-WUVVLUU5.js";import{c as p,d as o,f,g as h,o as a,q as l,r as d}from"./chunk-EZH232V7.js";import{a as u,b as m}from"./chunk-2N4GTHXQ.js";import{b as i}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var L=async s=>{let e=s?.[0];if(e==="add")return await $(s?.slice(1));if(e==="list")return await v();if(e==="promote")return await C(s?.slice(1));let t=await c(i.process.cwd()),n=y(t),r=a({renderer:d.ansi(),sink:l.stdout()});return r.writeln(`Usage: ${n} rule <add "rule text" | list | promote "decision">`),await r.close(),u(void 0)},$=async s=>{let e=a({renderer:d.ansi(),sink:l.stdout()}),t=i.process.cwd(),n=s?.join(" "),r=await c(t);if(n===void 0||n.length===0)return e.writeln(f("Please provide a rule: "),p(`${g('rule add "Use Deno Tests for all tests"',r)}`)),await e.close(),m({exitCode:1});let P=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,50),A=`${t}/${w.rulesDir}/${P}.md`;return await i.fs.mkdir(`${t}/${w.rulesDir}`,{recursive:!0}),await i.fs.writeTextFile(A,n+`
|
|
2
2
|
`),e.writeln(h("\u2714")," Rule added: ",o(n)),r!==null&&r.tools.length>0&&(await x(t,r.tools,r),e.writeln(o(" Tool files synced."))),await e.close(),u(void 0)},v=async()=>{let s=a({renderer:d.ansi(),sink:l.stdout()}),e=i.process.cwd(),t=await k(e);s.writeln(p("Rules")),s.writeln("");let n=await c(e);if(t.length===0)s.writeln(o(` No rules yet. Add one with: ${g('rule add "..."',n)}`));else for(let r of t)s.writeln(" ",o("\u2022"),` ${r}`);return await s.close(),u(void 0)},C=async s=>{let e=a({renderer:d.ansi(),sink:l.stdout()}),t=s?.join(" ");return t===void 0||t.length===0?(e.writeln(f("Please provide the decision text to promote.")),await e.close(),m({exitCode:1})):(await e.close(),await $(s))};export{L as main};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as B,f as L}from"./chunk-
|
|
1
|
+
import{a as B,f as L}from"./chunk-4ODVKO5Y.js";import{a as D,b as A,d as N}from"./chunk-LG5R766Y.js";import{a as M}from"./chunk-ZJVSE2FP.js";import{a as V}from"./chunk-ZQ77HAFD.js";import"./chunk-BLHOTPRB.js";import"./chunk-PSXXTDLU.js";import{a as G,b as C}from"./chunk-UXRWSNVZ.js";import{e as x,f as g,k as $,o as F,r as U}from"./chunk-WUVVLUU5.js";import{c as P,d as r,f as u,g as v,h,k as I,o as R,q as O,r as T}from"./chunk-EZH232V7.js";import{a as S,b as w}from"./chunk-2N4GTHXQ.js";import{b as y}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var ae=async n=>{let t=R({renderer:T.ansi(),sink:O.stdout()}),e=y.process.cwd(),a=n?.includes("--unattended")??!1,s=W(n,"--max-turns")??10,o=W(n,"--max-iterations")??50;if(!await U(e)){let i=await $(e);return t.writeln(u(`noskills not initialized. Run: ${G("init",i)}`)),await t.close(),w({exitCode:1})}let p=await x(e);if(p.phase!=="EXECUTING"&&p.phase!=="SPEC_APPROVED")return t.writeln(u(`Cannot run from phase: ${p.phase}`)),t.writeln(r("Must be in SPEC_APPROVED or EXECUTING to start.")),await t.close(),w({exitCode:1});if(p.phase==="SPEC_APPROVED"){t.writeln(r("Starting execution from approved spec..."));let i=L(p);await g(e,i)}let c=await $(e);if(c===null)return t.writeln(u("Config not found.")),await t.close(),w({exitCode:1});t.writeln(P(`${C(c)} run`)),t.writeln(r(`Mode: ${a?"unattended":"interactive"}, max-turns: ${s}, max-iterations: ${o}`)),t.writeln("");let m=0,d=0;for(;m<o;){m++;let i=await x(e);if(i.phase==="DONE"){t.writeln(""),t.writeln(v("\u2714")," Spec completed!"),t.writeln(` Iterations: ${i.execution.iteration}`),t.writeln(` Decisions: ${i.decisions.length}`);break}if(i.phase==="BLOCKED"){let l=i.execution.lastProgress??"Unknown";if(t.writeln(""),t.writeln(h("\u26A0")," Execution blocked: ",r(l)),a){await H(e,l,m),t.writeln(r("Logged to .eser/.state/blocked.log. Resolve and re-run.")),d=1;break}let E=A(),f=await N(E,{message:"Enter resolution (or leave empty to stop):"});if(D(f)||f===""){t.writeln(r("Stopped by user."));break}let k=B(i,"EXECUTING");await g(e,{...k,execution:{...k.execution,lastProgress:`Resolved: ${f}`}});continue}if(i.phase!=="EXECUTING"){t.writeln(u(`Unexpected phase: ${i.phase}. Stopping.`)),d=1;break}i.pendingClear&&await g(e,{...i,pendingClear:!1});let X=(await F(e)).filter(l=>c.concerns.includes(l.id)),_=await V(e),j=M(i,X,_,c),z=q(j,c);t.writeln(I(`\u2500\u2500 Iteration ${m}`),r(` (execution: ${i.execution.iteration}, debt: ${i.execution.debt?.items.length??0})`)),i.execution.lastProgress!==null&&t.writeln(r(` Last: ${i.execution.lastProgress}`)),i.execution.lastVerification?.passed===!1&&t.writeln(u(" Verification failed \u2014 agent will fix")),i.execution.debt!==null&&t.writeln(h(` Debt: ${i.execution.debt.items.length} items`)),t.writeln(r(" Spawning agent..."));try{await(await import("./mod-V2Z6HGL6.js")).exec`claude -p ${z} --max-turns ${String(s)} --output-format json`.noThrow().text()}catch{t.writeln(u(" Failed to spawn claude CLI. Is it installed?")),d=1;break}t.writeln(r(" Agent exited. Stop hook captured state."));let b=await x(e);if(c.autoCommit===!0&&c.allowGit!==!1)try{let l=await import("./mod-V2Z6HGL6.js");if((await l.exec`git diff --name-only`.noThrow().text()).trim().length>0){await l.exec`git add -A`.noThrow().text();let f=`noskills: iteration ${b.execution.iteration} \u2014 ${b.execution.lastProgress??"progress"}`;await l.exec`git commit -m ${f}`.noThrow().text(),t.writeln(r(" Auto-committed."))}}catch{t.writeln(r(" Auto-commit failed (non-fatal)."))}}return m>=o&&(t.writeln(""),t.writeln(h("\u26A0"),` Max iterations (${o}) reached. Stopping.`),d=2),await t.close(),d!==0?w({exitCode:d}):S(void 0)},q=(n,t)=>{let e=[];if(e.push(n.meta.resumeHint),e.push(""),n.meta.spec!==null&&(e.push(`Working on spec: ${n.meta.spec}`),e.push("")),"instruction"in n&&(e.push(n.instruction),e.push("")),"previousIterationDebt"in n){let s=n.previousIterationDebt;if(s!==void 0){e.push(`DEBT from iteration ${s.fromIteration} (address first):`);for(let o of s.items)e.push(`- ${o}`);e.push("")}}if("statusReportRequired"in n){let s=n.statusReport;if(s!==void 0){e.push("Report against these acceptance criteria:");for(let o of s.criteria)e.push(`- ${o}`);e.push("")}}if("verificationFailed"in n&&n.verificationFailed===!0&&(e.push("Test output:"),e.push(("verificationOutput"in n?n.verificationOutput:"")??""),e.push("")),n.behavioral.rules.length>0){e.push("Rules:");for(let s of n.behavioral.rules)e.push(`- ${s}`);e.push("")}if("context"in n){let s=n.context;if(s.concernReminders.length>0){e.push("Reminders:");for(let o of s.concernReminders)e.push(`- ${o}`);e.push("")}}let a=C(t);return e.push(`When done, report progress: ${a} next --answer="your progress"`),e.push(`If blocked, run: ${a} block "reason"`),e.push(`When all tasks are complete: ${a} done`),e.join(`
|
|
2
2
|
`)},W=(n,t)=>{if(n===void 0)return null;let e=`${t}=`;for(let a of n)if(a.startsWith(e)){let s=parseInt(a.slice(e.length),10);if(!isNaN(s)&&s>0)return s}return null},H=async(n,t,e)=>{let a=`${n}/.eser/.state/blocked.log`,s=`[${new Date().toISOString()}] iteration=${e} reason=${t}
|
|
3
3
|
`;try{let{appendFileSync:o,mkdirSync:p}=await import("node:fs"),{dirname:c}=await import("node:path");p(c(a),{recursive:!0}),o(a,s)}catch{}};export{ae as main};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as j,i as F}from"./chunk-
|
|
1
|
+
import{b as j,i as F}from"./chunk-4ODVKO5Y.js";import{a as T,d as U}from"./chunk-42EQ3GZJ.js";import{a as x,b as C}from"./chunk-UXRWSNVZ.js";import{d as S,e as P,f as I,g as A,h as L,i as R,j as O,k,r as z}from"./chunk-WUVVLUU5.js";import{c as d,d as c,f as w,g as $,h as E,k as N,o as y,q as D,r as v}from"./chunk-EZH232V7.js";import{a as h,b as g}from"./chunk-2N4GTHXQ.js";import{b as l}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var ee=async i=>{let e=i?.[0];if(e==="new")return await M(i?.slice(1));if(e==="list")return await B(i?.slice(1));if(e==="switch")return await q(i?.slice(1));let t=await k(l.process.cwd()),n=C(t),r=y({renderer:v.ansi(),sink:D.stdout()});return r.writeln(`Usage: ${n} spec <new "description" | list | switch <name>>`),await r.close(),h(void 0)},M=async i=>{let e=y({renderer:v.ansi(),sink:D.stdout()}),t=l.process.cwd(),n=await k(t);if(!await z(t))return e.writeln(w("noskills is not initialized.")," Run: ",d(x("init",n))),await e.close(),g({exitCode:1});let r=null,p=[];if(i!==void 0)for(let f of i)f.startsWith("--name=")?r=f.slice(7):f.startsWith("-")||p.push(f);let m=p.join(" ");if(m.length===0)return e.writeln(w("Please provide a description: "),d(`${C(n)} spec new "photo auto-listing"`)),await e.close(),g({exitCode:1});let a=r??W(m),o=await X(t,a),s=`spec/${o}`,u=await P(t);if(u.phase!=="IDLE"&&u.phase!=="DONE")return e.writeln(w(`Cannot start new spec in phase: ${u.phase}`),c(" \u2014 finish or reset the current spec first.")),await e.close(),g({exitCode:1});let b=j(u.phase==="DONE"?F(u):u,o,s);return await l.fs.mkdir(`${t}/${S.specDir(o)}`,{recursive:!0}),await I(t,b),await R(t,o,b),e.writeln($("\u2714")," Spec started: ",d(o)),e.writeln(" Directory: ",c(S.specDir(o))),e.writeln(" Branch: ",c(s)),e.writeln(" Phase: ",E("DISCOVERY")),e.writeln(""),e.writeln("Run ",d(x("next",n))," to begin discovery questions."),await e.close(),h(void 0)},W=i=>i.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,50).replace(/-$/,""),X=async(i,e)=>{let t=`${i}/${S.specsDir}`,n=async r=>{try{return await l.fs.stat(`${t}/${r}`),!0}catch{return!1}};if(!await n(e))return e;for(let r=2;r<=99;r++){let p=`${e}-${r}`;if(!await n(p))return p}return`${e}-${Date.now()}`},B=async i=>{let e=l.process.cwd(),t=T(i),n=await A(e),r=await O(e),p=`${e}/${S.specsDir}`,m=new Set(r.map(s=>s.name)),a=[];for(let s of r)a.push({name:s.name,phase:s.state.phase,iteration:s.state.execution.iteration,active:s.name===n});try{for await(let s of l.fs.readDir(p))s.isDirectory&&!m.has(s.name)&&a.push({name:s.name,phase:"IDLE",iteration:0,active:s.name===n})}catch{}if(t==="json")return await U(a,"json"),h(void 0);let o=y({renderer:v.ansi(),sink:D.stdout()});if(o.writeln(d("Specs")),o.writeln(""),a.length===0)o.writeln(c(" No specs yet."));else for(let s of a){let u=s.active?$("\u25CF"):c("\u25CB"),b=s.active?d(s.name):c(s.name),f=s.phase==="DONE"?$(s.phase):s.phase==="EXECUTING"?N(s.phase):s.phase==="BLOCKED"?w(s.phase):E(s.phase),G=s.phase==="EXECUTING"?c(` iteration ${s.iteration}`):"";o.writeln(" ",u," ",b," ",f,G)}return await o.close(),h(void 0)},q=async i=>{let e=y({renderer:v.ansi(),sink:D.stdout()}),t=l.process.cwd(),n=i?.[0],r=await k(t);if(n===void 0||n.length===0)return e.writeln(w("Please provide a spec name: "),d(`${C(r)} spec switch my-feature`)),await e.close(),g({exitCode:1});let p=await A(t),m=await P(t);p!==null&&m.spec!==null&&await R(t,p,m);let a=await L(t,n),o=await l.fs.stat(`${t}/${S.specDir(n)}`).then(()=>!0).catch(()=>!1);return a.phase==="IDLE"&&!o?(e.writeln(w(`Spec "${n}" not found.`)),e.writeln(c(`Run \`${x("spec list",r)}\` to see available specs.`)),await e.close(),g({exitCode:1})):(await I(t,a),e.writeln($("\u2714")," Switched to: ",d(n)," (",N(a.phase),")"),a.phase==="EXECUTING"&&(e.writeln(c(` Iteration: ${a.execution.iteration}`)),a.execution.lastProgress!==null&&e.writeln(c(` Progress: ${a.execution.lastProgress}`))),await e.close(),h(void 0))};export{ee as main};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as I,d as w}from"./chunk-
|
|
1
|
+
import{a as I,d as w}from"./chunk-42EQ3GZJ.js";import{a as f}from"./chunk-BLHOTPRB.js";import"./chunk-PSXXTDLU.js";import{a as h}from"./chunk-UXRWSNVZ.js";import{e as y,k as u,r as D}from"./chunk-WUVVLUU5.js";import{c as i,d as r,f as c,g as b,h as o,k as E,o as p,q as d,r as m}from"./chunk-EZH232V7.js";import{a as g,b as C}from"./chunk-2N4GTHXQ.js";import{b as x}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var U=async P=>{let n=x.process.cwd(),a=I(P);if(!await D(n)){if(a==="json")await w({error:"noskills is not initialized"},a);else{let s=p({renderer:m.ansi(),sink:d.stdout()}),l=await u(n);s.writeln(c("noskills is not initialized.")," Run: ",i(h("init",l))),await s.close()}return C({exitCode:1})}let e=await y(n),t=await u(n),k={phase:e.phase,spec:e.spec,branch:e.branch,discovery:e.phase==="DISCOVERY"?{answered:e.discovery.answers.length,total:f.length}:void 0,execution:e.phase==="EXECUTING"||e.phase==="BLOCKED"?{iteration:e.execution.iteration,lastProgress:e.execution.lastProgress,debt:e.execution.debt?.items.length??0,verificationPassed:e.execution.lastVerification?.passed??null}:void 0,concerns:t?.concerns??[],tools:t?.tools??[],decisions:e.decisions.length,pendingClear:e.pendingClear};if(a!=="json"){let s=p({renderer:m.ansi(),sink:d.stdout()});s.writeln(i(`${h("status",t)}`)),s.writeln("");let l=e.phase==="DONE"?b(e.phase):e.phase==="BLOCKED"?c(e.phase):e.phase==="EXECUTING"?E(e.phase):o(e.phase);s.writeln(" Phase: ",l),e.spec!==null&&s.writeln(" Spec: ",i(e.spec)),e.branch!==null&&s.writeln(" Branch: ",e.branch),e.phase==="DISCOVERY"&&s.writeln(` Discovery: ${e.discovery.answers.length}/${f.length} questions answered`),e.phase==="EXECUTING"&&(s.writeln(` Iteration: ${e.execution.iteration}`),e.execution.lastProgress!==null&&s.writeln(" Progress: ",r(e.execution.lastProgress)),e.execution.debt!==null&&s.writeln(o(` Debt: ${e.execution.debt.items.length} items`))),t!==null&&(s.writeln(""),t.concerns.length>0&&s.writeln(" Concerns: ",r(t.concerns.join(", "))),t.tools.length>0&&s.writeln(" Tools: ",r(t.tools.join(", ")))),e.decisions.length>0&&(s.writeln(""),s.writeln(` Decisions: ${e.decisions.length}`)),e.pendingClear&&(s.writeln(""),s.writeln(o(" \u26A0 Context clear pending \u2014 run `/clear`"))),await s.close()}else await w(k,"json");return g(void 0)};export{U as main};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as w}from"./chunk-
|
|
1
|
+
import{b as w}from"./chunk-ZQ77HAFD.js";import{a as g}from"./chunk-UXRWSNVZ.js";import{k as u}from"./chunk-WUVVLUU5.js";import{c as m,d as r,f as c,g as n,o as p,q as d,r as f}from"./chunk-EZH232V7.js";import{a as o,b as a}from"./chunk-2N4GTHXQ.js";import{b as l}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var v=async h=>{let s=p({renderer:f.ansi(),sink:d.stdout()}),t=l.process.cwd(),e=await u(t);if(e===null)return s.writeln(c("noskills is not initialized.")," Run: ",m(g("init",e))),await s.close(),a({exitCode:1});s.writeln(r("Syncing tool files..."));let i=await w(t,e.tools,e);for(let y of i)s.writeln(" ",n("\u2714"),` ${y}`);return i.length===0&&s.writeln(r(" No tools configured.")),s.writeln(""),s.writeln(n("Done.")),await s.close(),o(void 0)};export{v as main};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as S,c as E}from"./chunk-
|
|
1
|
+
import{a as S,c as E}from"./chunk-IVSTITPL.js";import{a as C,c as M}from"./chunk-42EQ3GZJ.js";import{e as T,k as y,r as b}from"./chunk-WUVVLUU5.js";import{a as x,b as k}from"./chunk-2N4GTHXQ.js";import{b as m}from"./chunk-UA3VIHYO.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var D=async e=>{let s=await T(e),l=await y(e),d=await L(e),o=null,u=null,n=0,c=0;if(s.spec!==null){let i=await S(e,s.spec);if(i!==null){n=i.tasks.length,c=s.execution.completedTasks.length;let a=E(i.tasks,s.execution.completedTasks);a!==null&&(o=a.id,u=a.title)}}let $=null;return s.lastCalledAt!==null&&($=Math.floor((Date.now()-new Date(s.lastCalledAt).getTime())/1e3)),{spec:s.spec,phase:s.phase,iteration:s.execution.iteration,activeTaskId:o,activeTaskTitle:u,totalTasks:n,completedTaskCount:c,lastProgress:s.execution.lastProgress,lastCalledAt:s.lastCalledAt,modifiedFiles:s.execution.modifiedFiles,debt:s.execution.debt,concerns:l?.concerns??[],maxIterations:l?.maxIterationsBeforeRestart??15,awaitingStatusReport:s.execution.awaitingStatusReport,pendingClear:s.pendingClear,verificationPassed:s.execution.lastVerification?.passed??null,decisionsCount:s.decisions.length,discoveryAnswered:s.discovery.answers.length,discoveryTotal:6,trackedFiles:d,timeSinceUpdate:$}},L=async e=>{let s=`${e}/.eser/.state/files-changed.jsonl`;try{let d=(await m.fs.readTextFile(s)).trim().split(`
|
|
2
2
|
`).filter(Boolean),o=[];for(let u of d)try{let n=JSON.parse(u);o.includes(n.file)||o.push(n.file)}catch{}return o}catch{return[]}},F="\x1B[2J\x1B[H",I="\x1B[1m",r="\x1B[2m",t="\x1B[0m",f="\x1B[32m",p="\x1B[33m",w="\x1B[31m",P="\x1B[36m",O=e=>{switch(e){case"DONE":return f;case"BLOCKED":return w;case"EXECUTING":return P;default:return p}},A=(e,s,l)=>{if(s===0)return"\u2591".repeat(l);let d=Math.min(e/s,1),o=Math.round(d*l);return"\u2588".repeat(o)+"\u2591".repeat(l-o)},v=e=>e===null?"never":e<60?`${e}s ago`:e<3600?`${Math.floor(e/60)}m ago`:`${Math.floor(e/3600)}h ago`,R=e=>{let s=[],d="\u2500".repeat(52);s.push(`${r}\u256D${d}\u256E${t}`),s.push(`${r}\u2502${t} ${I}noskills watch${t} \u2014 ${e.spec??"no active spec"}${r}${" ".repeat(Math.max(0,34-(e.spec?.length??15)))}\u2502${t}`);let o=O(e.phase);if(s.push(`${r}\u2502${t} Phase: ${o}${e.phase}${t}${" ".repeat(Math.max(0,42-e.phase.length))}${r}\u2502${t}`),e.phase==="DISCOVERY")s.push(`${r}\u2502${t} Discovery: ${e.discoveryAnswered}/${e.discoveryTotal} questions answered${" ".repeat(Math.max(0,14))}${r}\u2502${t}`);else if(e.phase==="SPEC_DRAFT")s.push(`${r}\u2502${t} ${p}Awaiting approval${t}${" ".repeat(Math.max(0,33))}${r}\u2502${t}`);else if(e.phase==="EXECUTING"||e.phase==="BLOCKED"){let n=A(e.completedTaskCount,e.totalTasks,12),c=e.totalTasks>0?Math.round(e.completedTaskCount/e.totalTasks*100):0,$=`${n} ${e.completedTaskCount}/${e.totalTasks} tasks (${c}%)`;if(s.push(`${r}\u2502${t} Progress: ${f}${$}${t}${" ".repeat(Math.max(0,40-$.length))}${r}\u2502${t}`),s.push(`${r}\u2502${t} Iteration: ${e.iteration}${" ".repeat(Math.max(0,38-String(e.iteration).length))}${r}\u2502${t}`),e.activeTaskId!==null){let a=`${e.activeTaskId}${e.activeTaskTitle!==null?` (${e.activeTaskTitle})`:""}`.slice(0,36);s.push(`${r}\u2502${t} Active task: ${P}${a}${t}${" ".repeat(Math.max(0,36-a.length))}${r}\u2502${t}`)}if(e.phase==="BLOCKED"){let i=(e.lastProgress??"unknown").replace(/^BLOCKED:\s*/,"");s.push(`${r}\u2502${t} ${w}BLOCKED: ${i.slice(0,40)}${t}${" ".repeat(Math.max(0,40-i.slice(0,40).length))}${r}\u2502${t}`),s.push(`${r}\u2502${t} ${p}Human input needed${t}${" ".repeat(Math.max(0,32))}${r}\u2502${t}`)}}else e.phase==="DONE"&&s.push(`${r}\u2502${t} ${f}Complete!${t} ${e.iteration} iterations, ${e.decisionsCount} decisions${" ".repeat(Math.max(0,17-String(e.iteration).length-String(e.decisionsCount).length))}${r}\u2502${t}`);if(s.push(`${r}\u2502${"".padEnd(52)}\u2502${t}`),s.push(`${r}\u2502${t} Last update: ${v(e.timeSinceUpdate)}${" ".repeat(Math.max(0,36-v(e.timeSinceUpdate).length))}${r}\u2502${t}`),e.lastProgress!==null){let n=e.lastProgress.slice(0,48);s.push(`${r}\u2502${t} ${r}${n}${t}${" ".repeat(Math.max(0,50-n.length))}${r}\u2502${t}`)}if(e.awaitingStatusReport&&s.push(`${r}\u2502${t} ${p}Status report pending${t}${" ".repeat(Math.max(0,29))}${r}\u2502${t}`),e.pendingClear&&s.push(`${r}\u2502${t} ${p}/clear pending${t}${" ".repeat(Math.max(0,36))}${r}\u2502${t}`),e.verificationPassed===!1&&s.push(`${r}\u2502${t} ${w}Verification failed${t}${" ".repeat(Math.max(0,31))}${r}\u2502${t}`),s.push(`${r}\u2502${"".padEnd(52)}\u2502${t}`),e.debt!==null&&e.debt.items.length>0){s.push(`${r}\u2502${t} Debt: ${e.debt.items.length} item(s)${" ".repeat(Math.max(0,34))}${r}\u2502${t}`);for(let n of e.debt.items.slice(0,3)){let c=n.slice(0,44);s.push(`${r}\u2502${t} \u2514\u2500 ${c}${" ".repeat(Math.max(0,46-c.length))}${r}\u2502${t}`)}e.debt.items.length>3&&s.push(`${r}\u2502${t} \u2514\u2500 ... and ${e.debt.items.length-3} more${" ".repeat(Math.max(0,32))}${r}\u2502${t}`)}if(e.trackedFiles.length>0||e.modifiedFiles.length>0){let n=e.trackedFiles.length>0?e.trackedFiles:e.modifiedFiles;s.push(`${r}\u2502${t} Files changed: ${n.length}${" ".repeat(Math.max(0,34-String(n.length).length))}${r}\u2502${t}`);for(let c of n.slice(0,5)){let $=c.length>44?"..."+c.slice(-41):c;s.push(`${r}\u2502${t} \u2514\u2500 ${$}${" ".repeat(Math.max(0,46-$.length))}${r}\u2502${t}`)}n.length>5&&s.push(`${r}\u2502${t} \u2514\u2500 ... and ${n.length-5} more${" ".repeat(Math.max(0,32))}${r}\u2502${t}`)}if(s.push(`${r}\u2502${"".padEnd(52)}\u2502${t}`),e.concerns.length>0){let n=e.concerns.join(", ").slice(0,38);s.push(`${r}\u2502${t} Concerns: ${n}${" ".repeat(Math.max(0,40-n.length))}${r}\u2502${t}`)}let u=e.iteration>=e.maxIterations?`${w}RESTART RECOMMENDED${t}`:`${f}ok${t} (${e.iteration}/${e.maxIterations})`;return s.push(`${r}\u2502${t} Context: ${u}${" ".repeat(Math.max(0,41-u.replace(/\x1b\[[0-9;]*m/g,"").length))}${r}\u2502${t}`),s.push(`${r}\u2570${d}\u256F${t}`),s.push(` ${r}watching .eser/.state/ for changes... (ctrl+c to stop)${t}`),s.join(`
|
|
3
3
|
`)},W=e=>JSON.stringify({ts:new Date().toISOString(),phase:e.phase,spec:e.spec,iteration:e.iteration,activeTask:e.activeTaskId,tasks:{completed:e.completedTaskCount,total:e.totalTasks},progress:e.lastProgress,debt:e.debt?.items.length??0,filesChanged:e.trackedFiles.length>0?e.trackedFiles:e.modifiedFiles,timeSinceUpdate:e.timeSinceUpdate,pendingClear:e.pendingClear,verificationPassed:e.verificationPassed}),J=async e=>{let s=m.process.cwd(),l=C(e);if(!await b(s)){let i=new TextEncoder,a=m.process.stdout.getWriter();return await a.write(i.encode(`noskills not initialized.
|
|
4
4
|
`)),a.releaseLock(),k({exitCode:1})}let d=`${s}/.eser/.state`,o="",u=async()=>{let i=await D(s),a=l==="json"?W(i):l==="markdown"?M(i,"markdown"):R(i);if(l==="json"){let g=new TextEncoder,h=m.process.stdout.getWriter();await h.write(g.encode(a+`
|
package/noskills.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as t}from"./chunks/chunk-
|
|
2
|
+
import{a as t}from"./chunks/chunk-GSYCN7EG.js";import{c as o}from"./chunks/chunk-2N4GTHXQ.js";import{b as s}from"./chunks/chunk-UA3VIHYO.js";import"./chunks/chunk-WV3HK5WR.js";import"./chunks/chunk-FDZP7B5Y.js";import"./chunks/chunk-ACQUINWH.js";import"./chunks/chunk-DXB73IDG.js";var i=new t({description:"noskills \u2014 state-machine orchestrator for AI agents",modules:{init:{description:"Initialize noskills in project",load:()=>import("./chunks/init-FPQ6OYIO.js")},status:{description:"Show current state",load:()=>import("./chunks/status-2POWAIVV.js")},spec:{description:"Manage specs (new, list)",load:()=>import("./chunks/spec-JET4WJSV.js")},next:{description:"Get next instruction for agent",load:()=>import("./chunks/next-ZNQ3ICRE.js")},approve:{description:"Approve phase transition",load:()=>import("./chunks/approve-YXRIBZVV.js")},block:{description:"Mark spec as blocked",load:()=>import("./chunks/block-D67USBJS.js")},reset:{description:"Reset current spec state",load:()=>import("./chunks/reset-CWI7K6GC.js")},done:{description:"Mark spec execution as complete",load:()=>import("./chunks/done-PTJRZ26W.js")},concern:{description:"Manage concerns (add, remove, list)",load:()=>import("./chunks/concern-RHWJ53OJ.js")},run:{description:"Autonomous execution loop (Ralph loop)",load:()=>import("./chunks/run-5XHWASUP.js")},watch:{description:"Live dashboard for monitoring agent progress",load:()=>import("./chunks/watch-5OC7T473.js")},sync:{description:"Regenerate tool-specific files",load:()=>import("./chunks/sync-RWNLL4VW.js")},purge:{description:"Remove all noskills content (specs, rules, concerns, hooks)",load:()=>import("./chunks/purge-JSAHNTXI.js")},"invoke-hook":{description:"Internal hook handlers (called by agents)",load:()=>import("./chunks/invoke-hook-MLGEIW5H.js")},rule:{description:"Manage rules (add, list, promote)",load:()=>import("./chunks/rule-GP665FCC.js")}}});var r={name:"@eser/noskills",version:"4.1.35",type:"module",exports:{".":"./main.ts","./mod":"./mod.ts","./module":"./module.ts"},dependencies:{"@eser/ai":"workspace:*","@eser/primitives":"workspace:*","@eser/shell":"workspace:*","@eser/standards":"workspace:*","@eser/streams":"workspace:*",yaml:"^2"},devDependencies:{"@std/assert":"npm:@jsr/std__assert@^1.0.16","@std/testing":"npm:@jsr/std__testing@^1.0.16"}};var p=i.toCommand("noskills",r.version),d=async()=>await p.parse();if(import.meta.main){let n=await d();o(n,{ok:()=>{},fail:e=>{e.message!==void 0&&console.error(e.message),s.process.setExitCode(e.exitCode)}})}export{d as main};
|
package/package.json
CHANGED
package/chunks/block-WWW3MXHP.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as k}from"./chunk-HLQNHWXS.js";import{a as g}from"./chunk-UXRWSNVZ.js";import{e as w,f,k as h}from"./chunk-OJUA2UZK.js";import{c as i,d as m,f as l,h as c,o as p,q as d,r as u}from"./chunk-4IFPLK7L.js";import{a as o,b as n}from"./chunk-2N4GTHXQ.js";import{a}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var $=async b=>{let e=p({renderer:u.ansi(),sink:d.stdout()}),s=a.process.cwd(),r=b?.join(" ")??"No reason given",t=await w(s),x=await h(s);if(t.phase!=="EXECUTING")return e.writeln(l(`Cannot block in phase: ${t.phase}`)),await e.close(),n({exitCode:1});let y=k(t,r);return await f(s,y),e.writeln(c("\u26A0")," Spec blocked: ",m(r)),e.writeln("Resolve with: ",i(`${g('next --answer="resolution"',x)}`)),await e.close(),o(void 0)};export{$ as main};
|
package/chunks/chunk-HS6FTDDW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as I,c as D}from"./chunk-WV3HK5WR.js";import{a as N,b as f}from"./chunk-FDZP7B5Y.js";import{a as m,b as T,c as A,d as S}from"./chunk-ACQUINWH.js";import{d as Y}from"./chunk-DXB73IDG.js";var J={};Y(J,{AlreadyExistsError:()=>A,NotFoundError:()=>T,ProcessError:()=>S,RuntimeCapabilityError:()=>m,buildCommand:()=>P,clearWorkerdEnv:()=>D,createRuntime:()=>G,current:()=>xe,detectExecutionContext:()=>V,detectInvoker:()=>C,detectRuntime:()=>a,getArch:()=>y,getCliCommand:()=>q,getHomedir:()=>R,getPlatform:()=>u,getPlatformInfo:()=>U,getRuntimeVersion:()=>M,getTmpdir:()=>v,isBrowser:()=>W,isCommandInPath:()=>c,isEdge:()=>B,isRuntime:()=>_,isServer:()=>j,populateEnvFromContext:()=>I,posixPath:()=>f,resolvePathDirs:()=>b,runtime:()=>o,searchFileHierarchy:()=>$,toPosix:()=>N});var i=globalThis,Z=()=>typeof i.caches<"u"&&typeof i.Request<"u"&&typeof i.Response<"u"&&typeof i.window>"u"&&typeof i.document>"u",ee=()=>typeof i.window<"u"||typeof i.document<"u",a=()=>{if(typeof globalThis>"u")return"unknown";if(typeof i.Bun<"u")return"bun";if(typeof i.Deno<"u")return"deno";let e=i.process;return e?.versions?.node&&!e?.versions?.bun?"node":Z()?"workerd":ee()?"browser":"unknown"},ne={deno:()=>i.Deno?.version?.deno??"unknown",bun:()=>i.Bun?.version??"unknown",node:()=>i.process?.versions?.node??"unknown",workerd:()=>"unknown",browser:()=>i.navigator?.userAgent??"unknown",unknown:()=>"unknown"},M=()=>ne[a()](),_=e=>a()===e,W=()=>a()==="browser",te=new Set(["deno","node","bun"]),j=()=>te.has(a()),B=()=>a()==="workerd";var oe=e=>{if(typeof Deno<"u"&&Deno.env?.get)return Deno.env.get(e);let n=globalThis.process;if(n?.env)return n.env[e]},x=(...e)=>{for(let n of e){let t=oe(n);if(t!==void 0)return t}},g=e=>{try{let n=globalThis.require;if(n instanceof Function)return n(e)}catch{}},w=()=>globalThis.process,h=()=>globalThis.navigator;var H={darwin:"darwin",linux:"linux",windows:"windows",win32:"windows"},u=()=>{if(typeof Deno<"u"&&Deno.build?.os)return H[Deno.build.os]??"linux";let e=w();if(e?.platform)return H[e.platform]??"linux";let n=h();if(n?.userAgent){let t=n.userAgent.toLowerCase();if(t.includes("mac"))return"darwin";if(t.includes("win"))return"windows";if(t.includes("linux"))return"linux"}return"linux"},L={x86_64:"amd64",x64:"amd64",aarch64:"arm64",arm64:"arm64"},y=()=>{if(typeof Deno<"u"&&Deno.build?.arch)return L[Deno.build.arch]??"amd64";let e=w();if(e?.arch)return L[e.arch]??"amd64";let n=h();if(n?.userAgent){let t=n.userAgent.toLowerCase();if(t.includes("arm64")||t.includes("aarch64"))return"arm64"}return"amd64"},R=()=>{let e=x("HOME","USERPROFILE");if(e)return e;let n=g("os");return n?.homedir?n.homedir():u()==="windows"?"C:\\Users\\Default":"/home"},v=()=>{let e=x("TMPDIR","TMP","TEMP");if(e)return e;let n=g("os");return n?.tmpdir?n.tmpdir():u()==="windows"?"C:\\Windows\\Temp":"/tmp"},U=()=>({platform:u(),arch:y(),homedir:R(),tmpdir:v()});var $=async(e,n,t={})=>{let{searchParents:r=!1}=t,s=e;for(;;){for(let l of n){let p=o.path.join(s,l);if(await o.fs.exists(p)&&(await o.fs.stat(p)).isFile)return p}if(!r)break;let d=o.path.dirname(s);if(d===s)break;s=d}};var b=(e,n)=>{let t=n==="windows"?";":":";return e.split(t).filter(r=>r.length>0)},C=(e,n,t,r,s)=>{if(t)return{invoker:"binary",mode:"installed"};if(n==="bun")return e.BUN_INSTALL!==void 0?{invoker:"bun",mode:"installed"}:{invoker:"bunx",mode:"on-demand"};if(n==="node"){let d=e.npm_execpath??"";return d.includes("npx")?{invoker:"npx",mode:"on-demand"}:d.includes("pnpm")?{invoker:"pnpx",mode:"on-demand"}:(e.npm_config_user_agent??"").includes("pnpm")?{invoker:"pnpm",mode:"installed"}:{invoker:"npm",mode:"installed"}}return n==="deno"?r!==void 0&&(r.startsWith("jsr:")||r.startsWith("https:"))?{invoker:"deno",mode:"on-demand"}:s===!0?{invoker:"dev",mode:"dev"}:{invoker:"deno",mode:"installed"}:{invoker:"unknown",mode:"installed"}},P=(e,n,t)=>e==="npx"?`npx ${t.npmPackage}`:e==="pnpx"?`pnpx ${t.npmPackage}`:e==="bunx"?`bunx ${t.npmPackage}`:e==="deno"&&n==="on-demand"?`deno run --allow-all jsr:${t.jsrPackage}`:e==="dev"?t.devCommand:t.command,c=async e=>{let n=u(),t=n==="windows"?`${e}.exe`:e,r=o.env.get("PATH")??"",s=b(r,n);for(let d of s)try{return await o.fs.stat(o.path.join(d,t)),!0}catch{continue}return!1},q=async e=>await c(e.command)?e.command:await c("npx")?`npx ${e.npmPackage}`:await c("pnpx")?`pnpx ${e.npmPackage}`:await c("bunx")?`bunx ${e.npmPackage}`:await c("deno")?`deno run --allow-all jsr:${e.jsrPackage}`:e.command,V=async e=>{let n=import.meta.filename===void 0,t=a(),r=import.meta.url,s={BUN_INSTALL:o.env.get("BUN_INSTALL"),npm_execpath:o.env.get("npm_execpath"),npm_config_user_agent:o.env.get("npm_config_user_agent")},d=!1;if(t==="deno"&&r.startsWith("file://"))try{let z=o.process.cwd(),Q=o.path.join(z,"deno.json"),X=await o.fs.readTextFile(Q),F=JSON.parse(X).tasks;F!==void 0&&"cli"in F&&(d=!0)}catch{}let{invoker:l,mode:p}=C(s,t,n,r,d),E=n?"compiled":["deno","node","bun"].includes(t)?t:"deno",O=P(l,p,e),K=await c(e.command);return{runtime:E,mode:p,invoker:l,command:O,isInPath:K}};var k=(e,n)=>()=>{throw new m(e,n)},se=e=>{let n=k("fs",e);return{readFile:n,readTextFile:n,writeFile:n,writeTextFile:n,exists:n,stat:n,lstat:n,mkdir:n,ensureDir:n,remove:n,readDir:n,copyFile:n,rename:n,makeTempDir:n,realPath:n,watch:n,walk:n,chmod:n}},ae=e=>{let n=k("exec",e);return{spawn:n,exec:n,execJson:n,spawnChild:n}},de=e=>{let n=k("process",e);return{exit:n,setExitCode:n,cwd:n,chdir:n,hostname:n,execPath:n,get args(){throw new m("process",e)},get pid(){throw new m("process",e)},get stdin(){throw new m("process",e)},get stdout(){throw new m("process",e)},get stderr(){throw new m("process",e)},isTerminal(){return!1},setStdinRaw(){throw new m("process",e)}}},me=()=>({get:()=>{},set:()=>{},delete:()=>{},has:()=>!1,toObject:()=>({})}),ce=e=>({name:e,version:"unknown",capabilities:{fs:!1,fsSync:!1,exec:!1,process:!1,env:!1,stdin:!1,stdout:!1,kv:!1},fs:se(e),path:f,exec:ae(e),env:me(),process:de(e)}),ue={deno:async()=>(await import("./deno-5VR3ZY4Z.js")).createDenoRuntime(),node:async()=>(await import("./node-MZTU6BAB.js")).createNodeRuntime(),bun:async()=>(await import("./bun-KVGAHBUF.js")).createBunRuntime(),workerd:async()=>(await import("./workerd-QUMEG65S.js")).createWorkerdRuntime(),browser:async()=>(await import("./browser-JYFQKVFU.js")).createBrowserRuntime()},pe=["fs","exec","env","path","process"],le=e=>e!==void 0&&pe.some(n=>e[n]!==void 0),fe=(e,n,t)=>({name:e.name,version:e.version,capabilities:t,fs:n.fs??e.fs,path:n.path??e.path,exec:n.exec??e.exec,env:n.env??e.env,process:n.process??e.process}),G=async e=>{let n=a(),t=ue[n],r=t!==void 0?await t():ce(n),s=e?.capabilities?{...r.capabilities,...e.capabilities}:r.capabilities;return e!==void 0&&le(e)?fe(r,e,s):e?.capabilities?{...r,capabilities:s}:r},o=await G(),xe=o;export{o as a,J as b};
|
package/chunks/init-XVNWKPT7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Z,b as ee,c as te}from"./chunk-ZS6ZJ4YL.js";import{a as S,b as F,e as T,f as J,g as N,h as r,i as h}from"./chunk-AB4ZUDV6.js";import{a as V}from"./chunk-ZJVSE2FP.js";import{a as Q,b as X}from"./chunk-LICLZJKZ.js";import"./chunk-AGPCY6XP.js";import{a as P}from"./chunk-RVIPYZ7F.js";import{d as Y}from"./chunk-TGA7MX5P.js";import"./chunk-BLHOTPRB.js";import{a as B}from"./chunk-PSXXTDLU.js";import{a as I}from"./chunk-UXRWSNVZ.js";import{a as q,b as G,f as U,k as W,l as z,n as _,p as H,r as K}from"./chunk-OJUA2UZK.js";import"./chunk-4IFPLK7L.js";import"./chunk-5MN3MWQN.js";import"./chunk-OLM5RTFK.js";import{a as O}from"./chunk-LZSLKXJE.js";import{a as k}from"./chunk-2N4GTHXQ.js";import"./chunk-6C2MLMD6.js";import{a as d}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var de=new O({description:"AI provider interface \u2014 ask questions, generate content",modules:{ask:{description:"Send a prompt to an AI provider",load:()=>import("./ask-TR4ZPBU5.js")},list:{description:"List available AI providers",load:()=>import("./list-UT3MSC6R.js")}}});var oe=P;var ge=async t=>{try{return await d.fs.stat(t),!0}catch{return!1}},fe=[{id:"claude-code",paths:["CLAUDE.md",".claude"]},{id:"cursor",paths:[".cursorrules",".cursor"]},{id:"kiro",paths:[".kiro"]},{id:"copilot",paths:[".github/copilot-instructions.md"]},{id:"windsurf",paths:[".windsurfrules"]}],se=async t=>{let e=[];for(let n of fe)for(let o of n.paths)if(await ge(`${t}/${o}`)){e.push(n.id);break}return e};var a=async t=>{try{return await d.fs.stat(t),!0}catch{return!1}},ne=async(t,e)=>{try{let n=await d.fs.readTextFile(t);return JSON.parse(n)[e]??null}catch{return null}},he=async t=>{let e=[];return(await a(`${t}/package.json`)||await a(`${t}/deno.json`))&&e.push("typescript"),await a(`${t}/go.mod`)&&e.push("go"),await a(`${t}/Cargo.toml`)&&e.push("rust"),(await a(`${t}/pyproject.toml`)||await a(`${t}/setup.py`))&&e.push("python"),e},ye=async t=>{let e=[],n=await ne(`${t}/package.json`,"dependencies");return n!==null&&("react"in n&&e.push("react"),"vue"in n&&e.push("vue"),"svelte"in n&&e.push("svelte"),"next"in n&&e.push("nextjs"),"express"in n&&e.push("express"),"hono"in n&&e.push("hono")),e},we=async t=>{let e=[];return await a(`${t}/.github/workflows`)&&e.push("github-actions"),await a(`${t}/.gitlab-ci.yml`)&&e.push("gitlab-ci"),await a(`${t}/Jenkinsfile`)&&e.push("jenkins"),await a(`${t}/.circleci`)&&e.push("circleci"),e},be=async t=>{if(await a(`${t}/deno.json`))return"deno";let e=await ne(`${t}/package.json`,"devDependencies");if(e!==null){if("vitest"in e)return"vitest";if("jest"in e)return"jest";if("playwright"in e)return"playwright"}return null},ie=async t=>{let[e,n,o,u]=await Promise.all([he(t),ye(t),we(t),be(t)]);return{languages:e,frameworks:n,ci:o,testRunner:u}};var kt=async t=>{let e=d.process.cwd(),n=ee(t),o=F({target:n==="agent"?"non-interactive":"interactive"}),u=te(t),y=re(u,"--concerns"),f=re(u,"--tools"),p=u.includes("--non-interactive")||n==="agent";if(await K(e)){let s=await W(e);return r.warn(o,"noskills is already initialized in this project."),r.info(o,`Run \`${I("sync",s)}\` to regenerate tool files.`),k(void 0)}J(o,"noskills init");let A=h(o,"Scanning project...");A.start();let m=await ie(e);A.succeed("Project scanned");for(let s of m.languages)r.step(o,` ${s}`);for(let s of m.frameworks)r.step(o,` ${s}`);for(let s of m.ci)r.step(o,` ${s}`);m.testRunner!==null&&r.step(o,` test runner: ${m.testRunner}`);let $=h(o,"Detecting coding tools...");$.start();let R=await se(e),w=Z(),D=w!==null&&!R.includes(w)?[w]:[],b=[...new Set([...D,...R])];$.succeed(`${b.length} coding tool(s) detected`);for(let s of b){let i=s===w?" (current)":"";r.step(o,` ${s}${i}`)}let g;if(f!==null){let s=["claude-code","cursor","kiro","copilot","windsurf"],i=f.filter(c=>s.includes(c));g=[...new Set([...D,...i])]}else p?g=[...b]:g=await xe(o,b,w);let j=h(o,"Detecting AI providers...");j.start();let C=(await oe()).filter(s=>s.available).map(s=>s.name);j.succeed(`${C.length} provider(s) detected`);let x=await B(),l;if(y!==null){let s=x.map(i=>i.id);l=y.filter(i=>s.includes(i)).sort((i,c)=>s.indexOf(i)-s.indexOf(c))}else if(p)l=[];else{let s=x.map(c=>({value:c.id,label:c.name,hint:c.description.slice(0,60)})),i=await T(o,{message:"What kind of project is this? (space to toggle, enter to confirm)",options:s});l=S(i)?[]:[...i]}l.length>0?r.success(o,`Concerns: ${l.join(", ")}`):r.info(o,"No concerns selected. Add later with `concern add <id>`.");let M=ke(),E=h(o,"Initializing...");E.start(),await H(e);let ae=x.filter(s=>l.includes(s.id));for(let s of ae)await _(e,s);let v={...G(l,g,C,m),command:M};await z(e,v);let L=q();if(await U(e,L),E.succeed("Scaffolded `.eser/`"),g.length>0){let s=h(o,"Syncing tool files...");s.start();let i=await X(e,g,v);s.succeed(`Synced ${i.length} tool(s)`)}else r.warn(o,"No tools selected. noskills will work in agentless CLI mode only."),r.info(o,"Add tools later with `noskills sync`.");if(r.success(o,`Done. ${g.length} tool(s), ${C.length} provider(s), ${l.length} concern(s).`),r.info(o,`Command prefix: ${M}`),n==="agent"){let i=(await B()).filter(ce=>l.includes(ce.id)),c=await Q(e),le=V(L,i,c,v);await Y(le,"json")}else N(o,`Start a spec with: ${I('spec new "..."',v)}`);return k(void 0)},Ce=[{value:"claude-code",label:"Claude Code"},{value:"cursor",label:"Cursor"},{value:"kiro",label:"Kiro"},{value:"copilot",label:"GitHub Copilot"},{value:"windsurf",label:"Windsurf"}],xe=async(t,e,n)=>{let o=e.length===0?"No coding tools detected. Which tools do you use? (space to toggle)":"Any additional tools? (space to toggle, enter to skip)",u=new Set(e),y=await T(t,{message:o,options:Ce.map(p=>({...p,hint:p.value===n?"you're running inside it":u.has(p.value)?"detected":void 0,disabled:p.value===n})),initialValues:[...e],required:!1});if(S(y))return[...e];let f=[...y];return n!==null&&!f.includes(n)&&f.unshift(n),f},re=(t,e)=>{if(t===void 0)return null;for(let n of t)if(n.startsWith(`${e}=`))return n.slice(e.length+1).split(",").map(o=>o.trim()).filter(Boolean);return null},ke=()=>{try{let e=d.process.args.join(" ");if(e.includes("jsr:@eser/noskills"))return"deno run jsr:@eser/noskills";if(e.includes("noskills/main.ts"))return"deno run --allow-all ./pkg/@eser/noskills/main.ts";if(e.includes("eser")&&e.includes("nos")&&!e.includes("noskills"))return"eser nos";if(e.includes("eser")&&e.includes("noskills"))return"eser noskills"}catch{}return"npx eser noskills"};export{kt as main};
|