anyt-cli 0.1.0

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 ADDED
@@ -0,0 +1,519 @@
1
+ # anyt-skill — Package manager for AI agent skills
2
+
3
+ Version control. Dependencies. Private registries. Inspired by pnpm.
4
+
5
+ Supports **Claude Code**, **Cursor**, **Codex**, **Gemini CLI**, **Windsurf**, and [30+ more agents](#supported-agents).
6
+
7
+ **Website:** [anyt.io](https://anyt.io)
8
+
9
+ ## Install a Skill
10
+
11
+ ```bash
12
+ npx anyt-skill-cli add @user/anyt/youtube-downloader
13
+ ```
14
+
15
+ ### Source Formats
16
+
17
+ ```bash
18
+ # GitHub shorthand (owner/repo)
19
+ anyt-skill add vercel-labs/agent-skills
20
+
21
+ # Full GitHub URL
22
+ anyt-skill add https://github.com/vercel-labs/agent-skills
23
+
24
+ # Direct path to a skill in a repo
25
+ anyt-skill add https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design
26
+
27
+ # GitHub with prefix (explicit format)
28
+ anyt-skill add github:owner/repo
29
+ anyt-skill add github:owner/repo/path/to/skill@v1.0.0
30
+
31
+ # Registry (with semver versioning)
32
+ anyt-skill add @user/username/skill-name
33
+ anyt-skill add @user/username/skill-name@^2.0.0
34
+
35
+ # Well-known URL (RFC 8615 discovery)
36
+ anyt-skill add https://acme.com
37
+
38
+ # Local path (for development)
39
+ anyt-skill add ./my-local-skills
40
+ anyt-skill add ../shared-skills
41
+ anyt-skill add file:../my-local-skills
42
+ ```
43
+
44
+ ### Options
45
+
46
+ | Option | Description |
47
+ |--------|-------------|
48
+ | `-g, --global` | Install to user home directory instead of project |
49
+ | `--agent <agents>` | Comma-separated agents for symlinks (e.g., `claude-code,cursor`) |
50
+ | `-y, --yes` | Skip agent selection prompt and use defaults |
51
+
52
+ ### Examples
53
+
54
+ ```bash
55
+ # Add multiple skills at once
56
+ anyt-skill add @user/alice/skill1 @user/bob/skill2
57
+
58
+ # Add from GitHub URL (copy-paste from browser)
59
+ anyt-skill add https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design
60
+
61
+ # Add from GitHub shorthand
62
+ anyt-skill add vercel-labs/agent-skills/skills/web-design
63
+
64
+ # Install to specific agents only
65
+ anyt-skill add @user/alice/my-skill --agent claude-code,cursor
66
+
67
+ # Install globally (available across all projects)
68
+ anyt-skill add vercel-labs/agent-skills -g
69
+
70
+ # Skip prompts (CI-friendly)
71
+ anyt-skill add @user/alice/my-skill -y --agent claude-code
72
+
73
+ # Add from well-known endpoint
74
+ anyt-skill add https://acme.com
75
+ ```
76
+
77
+ ### Installation Scope
78
+
79
+ | Scope | Flag | Skills Location | Symlink Location |
80
+ |-------|------|-----------------|------------------|
81
+ | **Project** | (default) | `.anyt/skills/` | `./<agent>/skills/` |
82
+ | **Global** | `-g` | `~/.anyt/skills/` | `~/<agent>/skills/` |
83
+
84
+ ## Installation
85
+
86
+ ```bash
87
+ npm install -g anyt-skill-cli
88
+ ```
89
+
90
+ Or use with npx (no install needed):
91
+
92
+ ```bash
93
+ npx anyt-skill-cli <command>
94
+ ```
95
+
96
+ ## Quick Start
97
+
98
+ ```bash
99
+ # Initialize a new skill project
100
+ anyt-skill init
101
+
102
+ # Add a skill from the registry
103
+ anyt-skill add @user/username/skill-name
104
+
105
+ # Add a skill from GitHub
106
+ anyt-skill add github:owner/repo/path@main
107
+
108
+ # List installed skills
109
+ anyt-skill list
110
+
111
+ # Install all skills from lockfile
112
+ anyt-skill install
113
+ ```
114
+
115
+ ## Commands
116
+
117
+ | Command | Description |
118
+ |---------|-------------|
119
+ | `anyt-skill add <specifiers...>` | Add skills from registry, GitHub, local paths, or well-known URLs |
120
+ | `anyt-skill install [specifiers...]` | Install from lockfile, or add specific packages (alias: `i`) |
121
+ | `anyt-skill remove <name>` | Remove an installed skill (alias: `rm`) |
122
+ | `anyt-skill list` | List installed skills (alias: `ls`) |
123
+ | `anyt-skill update` | Update skills to latest compatible versions |
124
+ | `anyt-skill outdated [packages...]` | Check for outdated skills |
125
+ | `anyt-skill search [query]` | Search and discover skills from the registry (alias: `find`) |
126
+ | `anyt-skill audit` | Verify integrity of installed skills |
127
+ | `anyt-skill link` | Recreate agent symlinks without reinstalling |
128
+ | `anyt-skill init` | Create anyt.json manifest |
129
+ | `anyt-skill publish` | Publish skill to registry |
130
+ | `anyt-skill login` | Authenticate via browser or API key |
131
+ | `anyt-skill skill-list <subcommand>` | Manage skill lists (list, create, show, delete, update, add-skill, remove-skill, install) |
132
+ | `anyt-skill notebook <subcommand>` | Manage notebooks (upload, list, download, delete) |
133
+ | `anyt-skill config <subcommand>` | Manage configuration and per-scope encryption keys (show, init, set/get/remove-encryption-key) |
134
+ | `anyt-skill migrate` | Migrate from older on-disk skill directory layouts |
135
+ | `anyt-skill upgrade` | Update anyt-skill itself to the latest version |
136
+
137
+ ### `anyt-skill install`
138
+
139
+ Install all skills from the lockfile, or add and install specific packages.
140
+
141
+ ```bash
142
+ # Install all from lockfile
143
+ anyt-skill install
144
+
145
+ # Install with frozen lockfile (CI/CD - fails if lockfile is outdated)
146
+ anyt-skill install --frozen-lockfile
147
+
148
+ # Install to a custom directory
149
+ anyt-skill install --dir ./custom-path
150
+
151
+ # Install specific packages
152
+ anyt-skill install @user/alice/skill1 github:org/repo
153
+
154
+ # Install all skills from a skill list
155
+ anyt-skill install --list @user/alice/my-favorites
156
+ anyt-skill install --list @org/myorg/team-skills
157
+ ```
158
+
159
+ ### `anyt-skill search`
160
+
161
+ Search and discover skills from the registry.
162
+
163
+ ```bash
164
+ # Search by keyword
165
+ anyt-skill search typescript
166
+
167
+ # Output as JSON
168
+ anyt-skill search react --json
169
+
170
+ # Sort by recent or name
171
+ anyt-skill search --sort recent --limit 10
172
+ ```
173
+
174
+ ### `anyt-skill audit`
175
+
176
+ Verify integrity of installed skills and check for issues.
177
+
178
+ ```bash
179
+ # Run audit
180
+ anyt-skill audit
181
+
182
+ # Output as JSON (for CI)
183
+ anyt-skill audit --json
184
+ ```
185
+
186
+ Checks for: missing packages, deprecated versions, corrupted installations (missing SKILL.md).
187
+
188
+ ### `anyt-skill list`
189
+
190
+ ```bash
191
+ # List all installed skills
192
+ anyt-skill list
193
+
194
+ # Output as JSON
195
+ anyt-skill list --json
196
+ ```
197
+
198
+ ### `anyt-skill outdated`
199
+
200
+ ```bash
201
+ # Check for outdated skills
202
+ anyt-skill outdated
203
+
204
+ # Include up-to-date packages
205
+ anyt-skill outdated --all
206
+
207
+ # Check specific packages
208
+ anyt-skill outdated @user/alice/skill1
209
+
210
+ # Output as JSON
211
+ anyt-skill outdated --json
212
+ ```
213
+
214
+ ### `anyt-skill update`
215
+
216
+ ```bash
217
+ # Update all skills to latest compatible versions
218
+ anyt-skill update
219
+
220
+ # Preview what would change
221
+ anyt-skill update --dry-run
222
+ ```
223
+
224
+ ## Source Formats
225
+
226
+ ### Registry Specifiers
227
+
228
+ anyt has a built-in registry with full semver support, just like npm.
229
+
230
+ ```bash
231
+ @user/username/skillname # Latest version
232
+ @user/username/skillname@2.0.0 # Exact version
233
+ @user/username/skillname@^2.0.0 # Compatible range (>=2.0.0 <3.0.0)
234
+ @user/username/skillname@~2.1.0 # Patch range (>=2.1.0 <2.2.0)
235
+ ```
236
+
237
+ ### GitHub Specifiers
238
+
239
+ All of these formats are supported:
240
+
241
+ ```bash
242
+ # Shorthand (most common)
243
+ owner/repo # Entire repo (default branch)
244
+ owner/repo/path/to/skill # Subdirectory within repo
245
+
246
+ # Full GitHub URL (copy-paste from browser)
247
+ https://github.com/owner/repo
248
+ https://github.com/owner/repo/tree/main/path/to/skill
249
+
250
+ # Explicit prefix (with version/ref support)
251
+ github:owner/repo # Entire repo (default branch)
252
+ github:owner/repo@main # Specific branch or tag
253
+ github:owner/repo/path/to/skill # Subdirectory within repo
254
+ github:owner/repo/path/to/skill@v1.0.0 # Subdirectory with tag
255
+ ```
256
+
257
+ ### Local Specifiers
258
+
259
+ ```bash
260
+ ./my-local-skills # Relative path (no prefix needed)
261
+ ../shared-skills # Parent directory
262
+ file:../path/to/skill # Explicit file: prefix (also supported)
263
+ ```
264
+
265
+ ### Well-Known URLs
266
+
267
+ Any HTTPS URL serving a `/.well-known/skills/index.json` endpoint. See [Well-Known Skills Discovery](../../docs/well-known-skills-discovery.md).
268
+
269
+ ```bash
270
+ https://acme.com # Discovers skills at acme.com/.well-known/skills/
271
+ ```
272
+
273
+ ## Agent Symlinks
274
+
275
+ anyt installs skills to a central `.anyt/skills/` directory and creates symlinks in each agent's expected location.
276
+
277
+ ```bash
278
+ # Install for specific agents
279
+ anyt-skill add <specifier> --agent claude-code,cursor
280
+
281
+ # Skip symlink creation
282
+ anyt-skill install --agent none
283
+
284
+ # Recreate symlinks for a specific agent
285
+ anyt-skill link --agent codex
286
+
287
+ # Interactive agent selection (default without -y)
288
+ anyt-skill add <specifier>
289
+ ```
290
+
291
+ ## Supported Agents
292
+
293
+ | Agent | `--agent` value | Skills Directory |
294
+ |-------|----------------|------------------|
295
+ | AdaL | `adal` | `.adal/skills/` |
296
+ | Amp | `amp` | `.agents/skills/` |
297
+ | Antigravity | `antigravity` | `.agent/skills/` |
298
+ | Augment | `augment` | `.augment/skills/` |
299
+ | Claude Code | `claude-code` | `.claude/skills/` |
300
+ | Cline | `cline` | `.agents/skills/` |
301
+ | CodeBuddy | `codebuddy` | `.codebuddy/skills/` |
302
+ | Codex | `codex` | `.agents/skills/` |
303
+ | Command Code | `command-code` | `.commandcode/skills/` |
304
+ | Continue | `continue` | `.continue/skills/` |
305
+ | Cortex Code | `cortex` | `.cortex/skills/` |
306
+ | Crush | `crush` | `.crush/skills/` |
307
+ | Cursor | `cursor` | `.agents/skills/` |
308
+ | Droid | `droid` | `.factory/skills/` |
309
+ | Gemini CLI | `gemini-cli` | `.agents/skills/` |
310
+ | GitHub Copilot | `github-copilot` | `.agents/skills/` |
311
+ | Goose | `goose` | `.goose/skills/` |
312
+ | iFlow CLI | `iflow-cli` | `.iflow/skills/` |
313
+ | Junie | `junie` | `.junie/skills/` |
314
+ | Kilo Code | `kilo` | `.kilocode/skills/` |
315
+ | Kimi Code CLI | `kimi-cli` | `.agents/skills/` |
316
+ | Kiro CLI | `kiro-cli` | `.kiro/skills/` |
317
+ | Kode | `kode` | `.kode/skills/` |
318
+ | MCPJam | `mcpjam` | `.mcpjam/skills/` |
319
+ | Mistral Vibe | `mistral-vibe` | `.vibe/skills/` |
320
+ | Mux | `mux` | `.mux/skills/` |
321
+ | Neovate | `neovate` | `.neovate/skills/` |
322
+ | OpenClaw | `openclaw` | `skills/` |
323
+ | OpenCode | `opencode` | `.agents/skills/` |
324
+ | OpenHands | `openhands` | `.openhands/skills/` |
325
+ | Pi | `pi` | `.pi/skills/` |
326
+ | Pochi | `pochi` | `.pochi/skills/` |
327
+ | Qoder | `qoder` | `.qoder/skills/` |
328
+ | Qwen Code | `qwen-code` | `.qwen/skills/` |
329
+ | Replit | `replit` | `.agents/skills/` |
330
+ | Roo Code | `roo` | `.roo/skills/` |
331
+ | Trae | `trae` | `.trae/skills/` |
332
+ | Trae CN | `trae-cn` | `.trae/skills/` |
333
+ | Universal | `universal` | `.agents/skills/` |
334
+ | Windsurf | `windsurf` | `.windsurf/skills/` |
335
+ | Zencoder | `zencoder` | `.zencoder/skills/` |
336
+
337
+ ## Publishing Skills
338
+
339
+ ### Authentication
340
+
341
+ ```bash
342
+ anyt-skill login # Authenticate via browser
343
+ anyt-skill login --api-key <key> # Authenticate with API key
344
+ anyt-skill logout # Clear stored credentials
345
+ anyt-skill whoami # Show current user info
346
+ ```
347
+
348
+ ### Versioning
349
+
350
+ ```bash
351
+ anyt-skill version major # 1.0.0 -> 2.0.0
352
+ anyt-skill version minor # 1.0.0 -> 1.1.0
353
+ anyt-skill version patch # 1.0.0 -> 1.0.1
354
+ anyt-skill version patch --dry-run # Preview without writing
355
+ ```
356
+
357
+ ### Publishing
358
+
359
+ ```bash
360
+ anyt-skill publish --access public # Publish as public (irreversible)
361
+ anyt-skill publish --access private # Publish as private (requires Pro)
362
+ anyt-skill publish --access team --org myorg # Publish under org (team-only)
363
+ anyt-skill publish --access private --bump patch # Bump and publish
364
+ ```
365
+
366
+ `--access` is required (`public`, `private`, or `team`). Use `--org <orgname>` to publish under an organization namespace. `--access team` requires `--org`. Before uploading, `anyt-skill publish` shows a preview of included files and package size. Max package size is **10MB**.
367
+
368
+ ### Managing Published Skills
369
+
370
+ ```bash
371
+ anyt-skill unpublish <spec> --force # Remove a version (within 72 hours)
372
+ anyt-skill deprecate <spec> [message] # Mark as deprecated
373
+ anyt-skill deprecate <spec> --undo # Remove deprecation
374
+ anyt-skill access --public # Make package public (irreversible)
375
+ anyt-skill access <spec> --private # Make package private
376
+ ```
377
+
378
+ ## Creating a Skill
379
+
380
+ A skill is a directory containing at minimum a `SKILL.md`:
381
+
382
+ ```markdown
383
+ ---
384
+ name: my-skill
385
+ description: A helpful skill that does X
386
+ ---
387
+
388
+ # My Skill
389
+
390
+ Instructions for the agent to follow when this skill is activated.
391
+
392
+ ## When to Use
393
+
394
+ Describe when this skill applies.
395
+
396
+ ## Steps
397
+
398
+ 1. First, do this
399
+ 2. Then, do that
400
+ ```
401
+
402
+ For publishing to the registry, also include `anyt.json` (created with `anyt-skill init`):
403
+
404
+ ```json
405
+ {
406
+ "name": "@user/myusername/my-skill",
407
+ "version": "1.0.0",
408
+ "description": "A helpful skill for...",
409
+ "files": ["anyt.json", "SKILL.md"]
410
+ }
411
+ ```
412
+
413
+ ## Ignoring Files (.anytignore)
414
+
415
+ Control which files are excluded when publishing:
416
+
417
+ ```
418
+ # .anytignore
419
+ *.test.ts
420
+ __tests__/
421
+ .env*
422
+ *.log
423
+ ```
424
+
425
+ - If `.anytignore` exists, use it for ignore patterns
426
+ - Otherwise, fall back to `.gitignore` if present
427
+ - Always ignores `node_modules`, `.git`, and `.anyt-publish`
428
+
429
+ ## Directory Structure
430
+
431
+ ```
432
+ project/
433
+ +-- anyt.json # Manifest with dependencies
434
+ +-- anyt-lock.json # Lockfile (version pinning + integrity)
435
+ +-- .anytrc # Project config (optional)
436
+ +-- .anyt/
437
+ | +-- skills/ # Installed skills (central store)
438
+ | | +-- username/ # Registry skills
439
+ | | | +-- skillname/
440
+ | | | +-- SKILL.md
441
+ | | +-- _github/ # GitHub skills
442
+ | | | +-- owner/
443
+ | | | +-- repo/
444
+ | | +-- _wellknown/ # Well-known skills
445
+ | | | +-- acme.com/
446
+ | | | +-- skill-name/
447
+ | | +-- _local/ # Local skill symlinks
448
+ | +-- cache/ # Tarball cache
449
+ +-- .claude/
450
+ | +-- skills/ # Symlinks for Claude Code (and other agents)
451
+ +-- .cursor/
452
+ +-- skills/ # Symlinks for Cursor (if configured)
453
+ ```
454
+
455
+ ## CI/CD Integration
456
+
457
+ ```bash
458
+ # Set API key via environment variable
459
+ export ANYT_API_KEY=sk_ci_key
460
+
461
+ # Install with frozen lockfile (fails if lockfile is outdated)
462
+ anyt-skill install --frozen-lockfile
463
+
464
+ # Audit installed skills
465
+ anyt-skill audit --json
466
+ ```
467
+
468
+ ## Configuration
469
+
470
+ ### User Config (`~/.anytrc`)
471
+
472
+ ```ini
473
+ registry = https://registry.anyt.io
474
+ authToken = sk_...
475
+ username = myuser
476
+ ```
477
+
478
+ ### Project Config (`.anytrc`)
479
+
480
+ ```ini
481
+ registry = https://custom-registry.example.com
482
+ ```
483
+
484
+ ### Lockfile (`anyt-lock.json`)
485
+
486
+ Tracks exact versions, resolved URLs, and integrity hashes for reproducible installs:
487
+
488
+ ```json
489
+ {
490
+ "lockfileVersion": 5,
491
+ "registryUrl": "https://registry.anyt.io",
492
+ "packages": { ... },
493
+ "githubPackages": { ... },
494
+ "localPackages": { ... },
495
+ "wellKnownPackages": { ... }
496
+ }
497
+ ```
498
+
499
+ ## Environment Variables
500
+
501
+ | Variable | Description |
502
+ |----------|-------------|
503
+ | `ANYT_API_KEY` | Override API key for authentication |
504
+ | `ANYT_DEBUG` | Enable debug logging |
505
+ | `GITHUB_TOKEN` | GitHub token for private repos and higher rate limits |
506
+
507
+ ## Self-Update
508
+
509
+ ```bash
510
+ anyt-skill upgrade
511
+ ```
512
+
513
+ Auto-detects your package manager (pnpm, npm, yarn, bun). The CLI also checks for updates every 24 hours and notifies you when a newer version is available.
514
+
515
+ ## License
516
+
517
+ This project is licensed under [The Artistic License 2.0](LICENSE), the same license used by npm.
518
+
519
+ <!-- @doc-sync: 1cca096 | 2026-04-23 16:00 -->
package/bin/anyt.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import "../dist/index.js";
@@ -0,0 +1 @@
1
+ import{t as e}from"./add-DxcDPvGU.js";export{e as add};
@@ -0,0 +1,5 @@
1
+ import{S as e,_ as t,b as n,s as r,y as i}from"./api-client-AcwLRhZ3.js";import{_ as a,c as o,d as s,s as c,u as l,w as u}from"./config-D5S7I3VP.js";import{$ as d,B as f,C as p,D as m,E as h,G as g,H as _,J as v,K as y,L as b,M as x,O as S,R as C,S as w,T as ee,U as T,V as E,W as D,X as O,Y as k,Z as te,a as ne,at as A,c as re,d as ie,f as ae,i as oe,l as se,n as j,o as M,q as N,t as P,tt as F,w as I}from"./symlinks-BoGYQyAH.js";import{basename as L,dirname as R,join as z,relative as B,resolve as V}from"node:path";import{mkdir as H,rm as U,stat as W,symlink as G,writeFile as K}from"node:fs/promises";import{homedir as ce}from"node:os";const q=`.well-known/skills`,J=`index.json`,le=/^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/,ue=[`github.com`,`gitlab.com`,`raw.githubusercontent.com`];function de(e){if(!e.startsWith(`http://`)&&!e.startsWith(`https://`))return!1;try{let t=new URL(e);return!(ue.includes(t.hostname)||e.endsWith(`.git`))}catch{return!1}}function Y(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}}function fe(e){if(!e||typeof e!=`object`)return!1;let t=e;if(typeof t.name!=`string`||t.name.length===0||typeof t.description!=`string`||t.description.length===0||!le.test(t.name)||!Array.isArray(t.files)||t.files.length===0)return!1;let n=!1;for(let e of t.files){if(typeof e!=`string`||e.startsWith(`/`)||e.startsWith(`\\`)||e.includes(`..`))return!1;e.toLowerCase()===`skill.md`&&(n=!0)}return!!n}function X(e){if(!e||typeof e!=`object`)return!1;let t=e;return Array.isArray(t.skills)?t.skills.every(fe):!1}async function pe(e){let t=new URL(e),n=`${e.replace(/\/$/,``)}/${q}/${J}`,r=`${e.replace(/\/$/,``)}/${q}`;try{let e=await fetch(n,{signal:AbortSignal.timeout(1e4)});if(e.ok){let t=await e.json();if(X(t))return{index:t,resolvedBaseUrl:r}}}catch{}let i=`${t.protocol}//${t.host}/${q}/${J}`,a=`${t.protocol}//${t.host}/${q}`;if(i!==n)try{let e=await fetch(i,{signal:AbortSignal.timeout(1e4)});if(e.ok){let t=await e.json();if(X(t))return{index:t,resolvedBaseUrl:a}}}catch{}return null}async function me(e,t){let n=`${e}/${t.name}`,r=new Map,i=``,a=await Promise.allSettled(t.files.map(async e=>{let t=`${n}/${e}`,r=await fetch(t,{signal:AbortSignal.timeout(1e4)});if(!r.ok)throw Error(`Failed to fetch ${t}: ${r.status}`);return{filePath:e,content:await r.text()}}));for(let e of a)e.status===`fulfilled`&&(r.set(e.value.filePath,e.value.content),e.value.filePath.toLowerCase()===`skill.md`&&(i=e.value.content));return i?{name:t.name,description:t.description,content:i,files:r,sourceUrl:`${n}/SKILL.md`,indexEntry:t}:null}async function he(e){let t=await pe(e);if(!t)return null;let{index:n,resolvedBaseUrl:r}=t,i=Y(e),a=await Promise.allSettled(n.skills.map(e=>me(r,e))),o=[];for(let e of a)e.status===`fulfilled`&&e.value&&o.push(e.value);return o.length===0?null:{skills:o,resolvedBaseUrl:r,hostname:i}}async function ge(e,t,n){let r=z(n,`_wellknown`,t,e.name);await U(r,{recursive:!0,force:!0}),await H(r,{recursive:!0});for(let[t,n]of e.files){let e=z(r,t);if(!e.startsWith(r))continue;let{dirname:i}=await import(`node:path`);await H(i(e),{recursive:!0}),await K(e,n,`utf-8`)}return`.anyt/skills/_wellknown/${t}/${e.name}`}function _e(e){let t=[...e.files.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${e}:${t}`).join(`
2
+ `);return A(Buffer.from(t,`utf-8`))}function Z(e,t){return`${e}/${t} (well-known)`}function ve(e){return e.startsWith(`file:`)||e.startsWith(`./`)||e.startsWith(`../`)}function ye(e){return e.startsWith(`file:`)?e.slice(5):e}function be(e){return e.startsWith(`file:`)?e:`file:${e}`}function Q(){return o()?ce():process.cwd()}function xe(e){return D(e)?v(e):g(e)?k(e):T(e)?N(e):null}async function Se(e){let t=xe(e);if(!t)throw Error(`Invalid GitHub specifier "${e}". Supported formats:\n github:owner/repo[/path][@ref]\n https://github.com/owner/repo[/tree/branch/path]\n owner/repo[/path]`);let n=t.ref||`HEAD`;console.log(`Resolving ${I(t)}...`);let r=await w(t);return console.log(`Resolved ${e} (${n}@${r.commit.slice(0,7)})`),{type:`github`,specifier:e,parsed:t,ref:n,downloadResult:r}}async function Ce(e,t){let{specifier:n,parsed:r,ref:i,downloadResult:a}=e;console.log(`Installing ${n} (${i}@${a.commit.slice(0,7)})...`);let s=c(),l=await p(r,a.buffer,s),u=f({owner:r.owner,repo:r.repo,path:r.path});await re(u,{version:a.commit.slice(0,7),resolved:`https://github.com/${r.owner}/${r.repo}`,integrity:a.integrity,gitCommit:a.commit,gitRef:i}),await h(u,i);let d=t.resolvedAgents;if(d[0]!==`none`){let e=await x();await P([{name:_(r),sourcePath:j(r.owner,r.repo,r.path)}],{agents:d,projectRoot:Q(),agentConfigs:e?.agents,global:o()})}console.log(`Installed ${n} (${i}@${a.commit.slice(0,7)})`),console.log(`Location: ${l}`)}async function we(e){let t=ye(e),n=V(process.cwd(),t),r=be(t);console.log(`Resolving ${e}...`);try{if(!(await W(n)).isDirectory())throw Error(`Path is not a directory: ${n}`)}catch(e){throw e.code===`ENOENT`?Error(`Directory not found: ${n}\n Check that the path exists and is accessible.`):e}let i=!1,a=!1;try{await W(z(n,`SKILL.md`)),i=!0}catch{}try{await W(z(n,`anyt.json`)),a=!0}catch{}if(!i&&!a)throw Error(`Not a valid skill directory: ${n}\n Missing both SKILL.md and anyt.json. At least one is required.`);let o=L(n);return console.log(`Resolved ${e} -> ${n}`),{type:`local`,specifier:e,normalizedSpecifier:r,path:t,resolvedPath:n,name:o}}async function Te(e,t){let{specifier:n,normalizedSpecifier:r,path:i,resolvedPath:a,name:s}=e;console.log(`Installing ${n}...`);let l=z(c(),`_local`);await H(l,{recursive:!0});let u=z(l,s),d=B(R(u),a);try{await U(u,{force:!0})}catch{}await G(d,u),await se(r,{version:`local`,path:i,resolvedPath:a,name:s}),await m(r);let f=t.resolvedAgents;if(f[0]!==`none`){let e=await x();await P([{name:s,sourcePath:oe(s)}],{agents:f,projectRoot:Q(),agentConfigs:e?.agents,global:o()})}console.log(`Installed ${n} (local)`),console.log(`Location: ${u} -> ${a}`)}async function Ee(e){let t=await l(),n=t.registryUrl,i=a(t,n),o=O(e);if(!o)throw Error(`Invalid skill specifier "${e}". Use format: @user/{username}/{name}[@{version}] or @org/{orgname}/{name}[@{version}]`);let{namespace:s,owner:c,name:u,subname:f,versionRange:p}=o,m=E({namespace:s,owner:c,name:u,subname:f});r({registryUrl:n,apiKey:i}),console.log(`Resolving ${e}...`);let h=(await De(s,c,u,f,m,i)).map(e=>e.version),g=d(p||`*`,h);if(!g)throw Error(`No version matching "${p||`latest`}" found for ${m}. Available versions: ${h.join(`, `)}`);let{downloadUrl:_,checksum:v}=await $(s,c,u,f,g,m);return console.log(`Resolved ${m}@${g}`),{type:`registry`,specifier:e,namespace:s,owner:c,name:u,subname:f,versionRange:p,resolvedVersion:g,versionInfo:{downloadUrl:_,checksum:v}}}async function De(t,r,i,a,o,s){if(t===`github`&&a){let e=await n(r,i,a);if(e.status!==200||!e.data)throw e.status===401?Error(s?`Access denied to ${o}. You may not have permission to access this private package.`:`Package ${o} requires authentication. Please run 'anyt login' to authenticate`):Error(e.error||`Skill ${o} not found`);return e.data}let c=await e(r,i);if(c.status!==200||!c.data){if(c.status===401)throw Error(s?`Access denied to ${o}. You may not have permission to access this private package.`:`Package ${o} requires authentication. Please run 'anyt login' to authenticate`);let e=u(c,`Skill ${o} not found`);throw Error(e)}if(c.data.length===0)throw Error(`Skill ${o} not found`);return c.data}async function $(e,n,r,a,o,s){if(e===`github`&&a){let e=await t(n,r,a,o);if(e.status!==200||!e.data)throw Error(`Version ${o} not found for ${s}`);return{downloadUrl:e.data.downloadUrl,checksum:e.data.checksum}}let c=await i(n,r,o);if(c.status!==200||!c.data){let e=u(c,`Version ${o} not found`);throw Error(e)}return{downloadUrl:c.data.downloadUrl,checksum:c.data.checksum}}async function Oe(e,t){let n=O(e.name);if(!n)throw Error(`Invalid package name: ${e.name}`);let{namespace:r,owner:i,name:s,subname:u}=n;console.log(`Installing ${e.name}@${e.version}...`);let d=await l(),f=await ke(e,a(d,d.registryUrl)),p=A(f);if(p!==e.integrity)throw Error(`Checksum verification failed`);let m=c(),h=u??s,g=Ae(r,i,s,u,h,m);await je(g,f);let _={};for(let[t,n]of Object.entries(e.dependencies))_[t]=n;if(await ie(e.name,{version:e.version,resolved:e.downloadUrl,integrity:p,deprecated:e.deprecated},Object.keys(_).length>0?_:void 0),t.isDirect){let t=e.versionRange||`^${e.version}`;await ee(e.name,t)}let v=t.resolvedAgents;if(v[0]!==`none`){let e=await x();await P([{name:h,sourcePath:ne(r,i,r===`github`&&u?`${s}/${u}`:s)}],{agents:v,projectRoot:Q(),agentConfigs:e?.agents,global:o()})}console.log(`Installed ${e.name}@${e.version}`),console.log(`Location: ${g}`)}async function ke(e,t){let n=e.downloadUrl.includes(`.r2.cloudflarestorage.com`)||e.downloadUrl.includes(`X-Amz-Signature`),r={};!n&&t&&(r.Authorization=`Bearer ${t}`);let i=await fetch(e.downloadUrl,{headers:r,redirect:`follow`});if(!i.ok)throw Error(`Failed to download tarball (${i.status})`);return Buffer.from(await i.arrayBuffer())}function Ae(e,t,n,r,i,a){return e===`org`?z(a,`_org`,t,i):e===`github`&&r?z(a,`_github-registry`,t,n,r):z(a,t,i)}async function je(e,t){await U(e,{recursive:!0,force:!0}),await H(e,{recursive:!0});let{writeFile:n}=await import(`node:fs/promises`),r=z(e,`.temp.tgz`);await n(r,t);let{exec:i}=await import(`node:child_process`),{promisify:a}=await import(`node:util`),o=a(i);try{await o(`tar -xzf "${r}" -C "${e}" --strip-components=1`)}finally{await U(r,{force:!0})}}async function Me(e){let t=Y(e);console.log(`Discovering skills from ${t}...`);let n=await he(e);if(!n)throw Error(`No well-known skills found at ${e}\n Expected: ${e}/.well-known/skills/index.json`);return console.log(`Found ${n.skills.length} skill(s) from ${t}: ${n.skills.map(e=>e.name).join(`, `)}`),{type:`wellknown`,specifier:e,hostname:n.hostname,skills:n.skills,resolvedBaseUrl:n.resolvedBaseUrl}}async function Ne(e,t){let{specifier:n,hostname:r,skills:i}=e,a=c();for(let e of i){console.log(`Installing ${Z(r,e.name)}...`);let i=await ge(e,r,a),o=_e(e);await ae(`${n}#${e.name}`,{version:`well-known`,resolved:e.sourceUrl,integrity:o,hostname:r,name:e.name,files:[...e.files.keys()]}),await S(n,[e.name]);let s=t.resolvedAgents;if(s[0]!==`none`){let t=await x();await P([{name:e.name,sourcePath:M(r,e.name)}],{agents:s,projectRoot:process.cwd(),agentConfigs:t?.agents})}console.log(`Installed ${Z(r,e.name)}`),console.log(`Location: ${i}`)}}async function Pe(e,t){t.global&&(s(!0),console.log(`Installing globally to ~/.anyt/
3
+ `)),console.log(`Resolving packages...
4
+ `);let{resolvedPackages:n,validationErrors:r}=await Fe(e);n.length===0&&(console.error(`No packages could be resolved.`),process.exit(1)),r.length>0&&console.log(`Resolved ${n.length} of ${e.length} packages.\n`);let i=await l(),o=a(i,i.registryUrl),c=n.filter(e=>e.type===`registry`),u=n.filter(e=>e.type===`github`),d=n.filter(e=>e.type===`local`),f=n.filter(e=>e.type===`wellknown`),p=null;if(c.length>0){let e={};for(let t of c){let n=E({namespace:t.namespace,owner:t.owner,name:t.name,subname:t.subname});e[n]=t.versionRange||`^${t.resolvedVersion}`}console.log(`Resolving dependencies...`),p=await te(e,{maxDepth:5,registryUrl:i.registryUrl,apiKey:o}),p.success||(F(p.graph.errors,p.graph.conflicts),process.exit(1));let t=p.installOrder.filter(t=>!e[t]);t.length>0?console.log(`Resolved ${t.length} transitive dependencies.\n`):console.log()}let m=await Ie(t),h=[];if(p)for(let e of p.installOrder){let n=p.graph.nodes.get(e);if(n)try{await Oe(n,{...t,resolvedAgents:m,isDirect:n.isDirect}),h.push({specifier:e,success:!0})}catch(t){let n=t instanceof Error?t.message:`Unknown error`;h.push({specifier:e,success:!1,error:n}),console.error(`Failed to install ${e}: ${n}\n`)}}for(let e of u)try{await Ce(e,{...t,resolvedAgents:m}),h.push({specifier:e.specifier,success:!0})}catch(t){let n=t instanceof Error?t.message:`Unknown error`;h.push({specifier:e.specifier,success:!1,error:n}),console.error(`Failed to install ${e.specifier}: ${n}\n`)}for(let e of d)try{await Te(e,{...t,resolvedAgents:m}),h.push({specifier:e.specifier,success:!0})}catch(t){let n=t instanceof Error?t.message:`Unknown error`;h.push({specifier:e.specifier,success:!1,error:n}),console.error(`Failed to install ${e.specifier}: ${n}\n`)}for(let e of f)try{await Ne(e,{...t,resolvedAgents:m}),h.push({specifier:e.specifier,success:!0})}catch(t){let n=t instanceof Error?t.message:`Unknown error`;h.push({specifier:e.specifier,success:!1,error:n}),console.error(`Failed to install ${e.specifier}: ${n}\n`)}if(e.length>1){let e=h.filter(e=>e.success).length,t=h.filter(e=>!e.success).length+r.length;console.log(`\nSummary: ${e} added, ${t} failed`),t>0&&process.exit(1)}}async function Fe(e){let t=[],n=[];for(let r of e)try{if(ve(r))t.push(await we(r));else if(D(r)||g(r)||T(r))t.push(await Se(r));else if(de(r))t.push(await Me(r));else if(y(r))t.push(await Ee(r));else throw Error(`Unknown specifier format "${r}". Supported formats:\n @user/{username}/{name}[@version] (registry)\n @org/{orgname}/{name}[@version] (organization)\n github:owner/repo[/path][@ref] (github)\n file:./path/to/skill (local)\n owner/repo (github shorthand)`)}catch(e){let t=e instanceof Error?e.message:`Unknown error`;n.push({specifier:r,error:t}),console.error(`Failed to resolve ${r}: ${t}\n`)}return{resolvedPackages:t,validationErrors:n}}async function Ie(e){let t=await x();if(e.agent)return b(e.agent);if(t||e.yes)return b(void 0);console.log(`No anyt.json found. Let's set up your project.
5
+ `);let n=await C();return console.log(),n}export{Pe as t};
@@ -0,0 +1 @@
1
+ let e=null;function t(t){e=t}function n(){if(!e)throw Error(`SDK not configured. Call configure() first.`);return e}async function r(e,t){let{baseUrl:r,apiKey:i}=n(),a=`${r}${e}`,o={...t.headers??{},"Content-Type":`application/json`};i&&(o.Authorization=`Bearer ${i}`);let s=await fetch(a,{...t,headers:o}),c=await s.text(),l=null;if(c)try{l=JSON.parse(c)}catch{l=c}return{data:l,status:s.status,headers:s.headers}}const i=()=>`/api/admin/stats`,a=async e=>r(i(),{...e,method:`GET`}),o=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([e,n])=>{n!==void 0&&t.append(e,n===null?`null`:n.toString())});let n=t.toString();return n.length>0?`/api/admin/users?${n}`:`/api/admin/users`},s=async(e,t)=>r(o(e),{...t,method:`GET`}),c=e=>`/api/admin/users/${e}/role`,l=async(e,t,n)=>r(c(e),{...n,method:`PATCH`,headers:{"Content-Type":`application/json`,...n?.headers},body:JSON.stringify(t)}),ee=()=>`/api/agents/`,te=async(e,t)=>r(ee(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),ne=()=>`/api/agents/`,re=async e=>r(ne(),{...e,method:`GET`}),ie=e=>`/api/agents/${e}`,ae=async(e,t)=>r(ie(e),{...t,method:`DELETE`}),oe=e=>`/api/agents/${e}`,u=async(e,t)=>r(oe(e),{...t,method:`GET`}),d=e=>`/api/agents/${e}`,f=async(e,t,n)=>r(d(e),{...n,method:`PATCH`,headers:{"Content-Type":`application/json`,...n?.headers},body:JSON.stringify(t)}),p=()=>`/api/billing/checkout`,m=async(e,t)=>r(p(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),h=()=>`/api/billing/portal`,g=async(e,t)=>r(h(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),_=()=>`/api/billing/subscription`,v=async e=>r(_(),{...e,method:`GET`}),y=e=>`/api/contact-messages/messages/${e}`,b=async(e,t)=>r(y(e),{...t,method:`DELETE`}),x=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([e,n])=>{n!==void 0&&t.append(e,n===null?`null`:n.toString())});let n=t.toString();return n.length>0?`/api/contact-messages/messages?${n}`:`/api/contact-messages/messages`},S=async(e,t)=>r(x(e),{...t,method:`GET`}),C=e=>`/api/contact-messages/messages/${e}/read`,w=async(e,t)=>r(C(e),{...t,method:`PATCH`}),T=()=>`/api/contact-messages/`,E=async(e,t)=>r(T(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),D=()=>`/api/credit/balance`,O=async e=>r(D(),{...e,method:`GET`}),k=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([e,n])=>{n!==void 0&&t.append(e,n===null?`null`:n.toString())});let n=t.toString();return n.length>0?`/api/credit/history?${n}`:`/api/credit/history`},A=async(e,t)=>r(k(e),{...t,method:`GET`}),j=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([e,n])=>{n!==void 0&&t.append(e,n===null?`null`:n.toString())});let n=t.toString();return n.length>0?`/api/credit/usage?${n}`:`/api/credit/usage`},M=async(e,t)=>r(j(e),{...t,method:`GET`}),N=()=>`/api/drive/upload/confirm`,P=async(e,t)=>r(N(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),F=()=>`/api/drive/folders`,I=async(e,t)=>r(F(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),L=()=>`/api/drive/folders`,R=async(e,t)=>r(L(),{...t,method:`DELETE`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),z=()=>`/api/drive/folders`,B=async e=>r(z(),{...e,method:`GET`}),V=()=>`/api/drive/folders`,H=async(e,t)=>r(V(),{...t,method:`PUT`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),U=()=>`/api/drive/files`,W=async(e,t)=>r(U(),{...t,method:`DELETE`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),G=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([e,n])=>{n!==void 0&&t.append(e,n===null?`null`:n.toString())});let n=t.toString();return n.length>0?`/api/drive/files?${n}`:`/api/drive/files`},K=async(e,t)=>r(G(e),{...t,method:`GET`}),q=e=>`/api/drive/download/${e}`,se=async(e,t)=>r(q(e),{...t,method:`GET`}),ce=()=>`/api/drive/upload/init`,le=async(e,t)=>r(ce(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),ue=()=>`/v1/apiKey.list`,de=async e=>r(ue(),{...e,method:`GET`}),fe=()=>`/v1/apiKey.create`,pe=async(e,t)=>r(fe(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),me=()=>`/v1/apiKey.update`,he=async(e,t)=>r(me(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),ge=()=>`/v1/apiKey.delete`,_e=async(e,t)=>r(ge(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),ve=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([e,n])=>{n!==void 0&&t.append(e,n===null?`null`:n.toString())});let n=t.toString();return n.length>0?`/v1/artifact.list?${n}`:`/v1/artifact.list`},ye=async(e,t)=>r(ve(e),{...t,method:`GET`}),be=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([e,n])=>{n!==void 0&&t.append(e,n===null?`null`:n.toString())});let n=t.toString();return n.length>0?`/v1/artifact.get?${n}`:`/v1/artifact.get`},xe=async(e,t)=>r(be(e),{...t,method:`GET`}),Se=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([e,n])=>{n!==void 0&&t.append(e,n===null?`null`:n.toString())});let n=t.toString();return n.length>0?`/v1/artifact.payload?${n}`:`/v1/artifact.payload`},Ce=async(e,t)=>r(Se(e),{...t,method:`GET`}),we=()=>`/v1/artifact.sessionTitle`,Te=async(e,t)=>r(we(),{...t,method:`PATCH`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),Ee=()=>`/v1/media.image.generate`,De=async(e,t)=>r(Ee(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),Oe=()=>`/v1/media.image.edit`,ke=async(e,t)=>r(Oe(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),Ae=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([e,n])=>{n!==void 0&&t.append(e,n===null?`null`:n.toString())});let n=t.toString();return n.length>0?`/v1/media.job.get?${n}`:`/v1/media.job.get`},je=async(e,t)=>r(Ae(e),{...t,method:`GET`}),Me=()=>`/v1/favorite.list`,Ne=async e=>r(Me(),{...e,method:`GET`}),Pe=()=>`/v1/favorite.add`,Fe=async(e,t)=>r(Pe(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),Ie=()=>`/v1/favorite.remove`,Le=async(e,t)=>r(Ie(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),Re=()=>`/v1/favorite.batchCheck`,ze=async(e,t)=>r(Re(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),Be=()=>`/v1/skillList.get`,Ve=async(e,t)=>r(Be(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),He=()=>`/v1/me`,Ue=async e=>r(He(),{...e,method:`GET`}),We=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([e,n])=>{n!==void 0&&t.append(e,n===null?`null`:n.toString())});let n=t.toString();return n.length>0?`/v1/skill.explore?${n}`:`/v1/skill.explore`},Ge=async(e,t)=>r(We(e),{...t,method:`GET`}),Ke=()=>`/v1/skill.listVersions`,qe=async(e,t)=>r(Ke(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),Je=()=>`/v1/skill.getVersion`,Ye=async(e,t)=>r(Je(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),Xe=()=>`/v1/skill.publish`,Ze=async(e,t)=>r(Xe(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),Qe=()=>`/v1/skill.delete`,$e=async(e,t)=>r(Qe(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),et=()=>`/v1/skill.deleteVersion`,tt=async(e,t)=>r(et(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),nt=()=>`/v1/skill.deprecate`,rt=async(e,t)=>r(nt(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),it=()=>`/v1/skill.undeprecate`,at=async(e,t)=>r(it(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),ot=()=>`/v1/skill.changeAccess`,st=async(e,t)=>r(ot(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),ct=()=>`/v1/skill.github.listVersions`,lt=async(e,t)=>r(ct(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)}),ut=()=>`/v1/skill.github.getVersion`,dt=async(e,t)=>r(ut(),{...t,method:`POST`,headers:{"Content-Type":`application/json`,...t?.headers},body:JSON.stringify(e)});function ft(e){return e.replace(/\/api\/skills\/?$/,``)}function J(e){t({baseUrl:ft(e.registryUrl),apiKey:e.apiKey})}async function pt(){let{resolveConfig:e,requireApiKey:t,getRegistryUrl:n}=await import(`./config-BBDgQnzq.js`);await e();let r=await t();J({registryUrl:await n(),apiKey:r})}function mt(e){return Y(e)}function Y(e){if(e.status>=200&&e.status<300)return{status:e.status,data:e.data,headers:e.headers};let t=e.data;return{status:e.status,data:void 0,error:t?.message??`HTTP ${e.status}`,headers:e.headers}}function X(e){return Promise.resolve({status:501,data:void 0,error:e})}async function Z(){return Y(await Ue())}async function ht(e,t){try{J({registryUrl:e,apiKey:t});let n=await Z();return n.status!==200||!n.data?null:{username:n.data.username,userId:n.data.userId}}catch{return null}}async function gt(){return Y(await de())}async function _t(e){return Y(await pe(e))}async function vt(e){return Y(await he(e))}async function yt(e){return Y(await _e(e))}async function bt(e,t){return Y(await qe({username:e,name:t}))}async function xt(e,t,n){return Y(await Ye({username:e,name:t,version:n}))}async function St(e){return Y(await Ze(e))}async function Ct(e,t){return Y(await $e({username:e,name:t}))}async function wt(e,t,n){return Y(await tt({username:e,name:t,version:n}))}async function Tt(e,t,n,r){return Y(await rt({username:e,name:t,version:n,message:r}))}async function Et(e,t,n){return Y(await at({username:e,name:t,version:n}))}async function Dt(e,t,n){return Y(await st({username:e,name:t,visibility:n.visibility}))}async function Q(e,t,n){return Y(await lt({owner:e,repo:t,name:n}))}async function Ot(e,t,n,r){return Y(await dt({owner:e,repo:t,name:n,version:r}))}async function kt(e,t,n){if(e!==`user`)return{status:501,error:`@org skill lists are not yet available on /v1`};let r=Y(await Ve({username:t,listName:n}));return r.status!==200||!r.data?{status:r.status,error:r.error}:{status:r.status,data:{...r.data,ownerType:e}}}async function At(){return Y(await Ne())}async function jt(e){return Y(await Fe({skillId:e}))}async function Mt(e){return Y(await Le({skillId:e}))}async function Nt(e){return Y(await ze(e))}const $=`@org skills are not yet available on /v1. Republish under @user/{username}/{name} or use a @github source.`;function Pt(e,t){return X($)}function Ft(e,t){return X($)}function It(e,t,n){return X($)}function Lt(e,t){return X($)}export{E as $,s as A,R as B,Z as C,Et as D,pt as E,I as F,se as G,O as H,g as I,re as J,v as K,ae as L,P as M,te as N,ht as O,m as P,w as Q,b as R,bt as S,St as T,A as U,u as V,M as W,K as X,S as Y,B as Z,Ot as _,vt as a,Te as at,Q as b,Ft as c,je as ct,Tt as d,f as et,jt as f,kt as g,Mt as h,gt as i,Ce as it,l as j,a as k,Ct as l,Ge as lt,At as m,_t as n,xe as nt,Dt as o,ke as ot,Nt as p,le as q,yt as r,ye as rt,J as s,De as st,mt as t,H as tt,wt as u,n as ut,It as v,Pt as w,Lt as x,xt as y,W as z};
@@ -0,0 +1 @@
1
+ import{g as e}from"./api-client-AcwLRhZ3.js";export{e as fetchSkillList};
@@ -0,0 +1 @@
1
+ import{S as e,b as t,d as n,g as r,m as i,u as a,y as o}from"./config-D5S7I3VP.js";export{i as getEncryptionKey,r as getRegistryUrl,o as removeEncryptionKey,t as requireApiKey,a as resolveConfig,e as setEncryptionKey,n as setGlobalMode};
@@ -0,0 +1,3 @@
1
+ import{dirname as e,join as t}from"node:path";import{mkdir as n,readFile as r,stat as i,writeFile as a}from"node:fs/promises";import{homedir as o}from"node:os";import*as s from"ini";const c={400:`Bad Request`,401:`Unauthorized`,403:`Forbidden`,404:`Not Found`,409:`Conflict`,422:`Validation Error`,429:`Too Many Requests`,500:`Internal Server Error`,502:`Bad Gateway`,503:`Service Unavailable`};function l(e,t){return t?.[e]??c[e]??`HTTP ${e}`}function u(e,t,n={}){let r=e.data,i=n.statusDescriptions;if(n.debug){let t=n.debugLogger??console.log;t(`[debug] API response status: ${e.status}`),t(`[debug] API response data:`,r)}if(typeof r==`string`)return e.status===404?`${t}: ${l(404,i)}`:`${t}: ${r} (HTTP ${e.status})`;if(!r||typeof r!=`object`)return`${t}: ${l(e.status,i)}`;let a=r.message||t;if(r.code===`VALIDATION_ERROR`&&r.details){let e=r.details.issues;e&&Array.isArray(e)&&(a=`Validation failed:\n${e.map(e=>` - ${e.path?.join(`.`)||`input`}: ${e.message||`invalid value`}`).join(`
2
+ `)}`)}return r.code&&!a.includes(r.code)&&(a=`[${r.code}] ${a}`),e.status>=400&&(a+=` (HTTP ${e.status})`),r.requestId&&(a+=`\n(Request ID: ${r.requestId})`),a}var d=class extends Error{constructor(e){super(e),this.name=`ConfigError`}},f=class extends d{constructor(){super(`Not logged in. Run 'anyt login --api-key <key>' first, or set ANYT_API_KEY env var.`),this.name=`NotLoggedInError`}},p=class extends Error{exitCode;constructor(e,t=1){super(e),this.name=`CliExitError`,this.exitCode=t}};function m(e,t=1){throw new p(e,t)}const h={400:`Bad Request - The request was malformed`,401:`Unauthorized - Please run 'anyt login' first`,403:`Forbidden - You don't have permission for this action`,404:`Not Found - The endpoint or resource doesn't exist`,409:`Conflict - The resource already exists or there's a version conflict`,422:`Validation Error - The request data is invalid`,429:`Too Many Requests - Please slow down and try again`,500:`Internal Server Error - Something went wrong on the server`,502:`Bad Gateway - The server is temporarily unavailable`,503:`Service Unavailable - The server is temporarily unavailable`};function g(e,t){return u(e,t,{statusDescriptions:h,debug:!!process.env.ANYT_DEBUG,debugLogger:(e,t)=>t===void 0?console.log(e):console.log(e,JSON.stringify(t,null,2))})}function _(e,t){try{let n=new URL(t).host;return e.registryTokens[n]?e.registryTokens[n]:e.apiKey}catch{return e.apiKey}}async function v(e,t,n){let r=await I();r.authToken=e,t&&(r.username=t),n&&n!==`https://registry.anyt.io`&&(r.registry=n),await L(r)}async function y(){let e=await I();e.authToken=void 0,e.username=void 0,await L(e)}async function b(){try{return!!(await z()).apiKey}catch{return!1}}async function x(){let e=await z();if(!e.apiKey)throw process.env.ANYT_DEBUG&&console.log(`[config] requireApiKey: No API key found`),new f;return process.env.ANYT_DEBUG&&console.log(`[config] requireApiKey: Got API key (${e.apiKey.substring(0,10)}...)`),e.apiKey}async function S(){return(await z()).registryUrl}async function C(e){let t=e.replace(/^@/,``).replace(/\//g,`_`).toUpperCase();return process.env[`ANYT_ENCRYPTION_KEY_${t}`]||(await I()).encryptionKeys?.[e]}async function w(e,t){let n=await I();n.encryptionKeys||={},n.encryptionKeys[e]=t,await L(n)}async function T(e){let t=await I();t.encryptionKeys&&(delete t.encryptionKeys[e],Object.keys(t.encryptionKeys).length===0&&(t.encryptionKeys=void 0)),await L(t)}function E(e,t){return`@${e}/${t}`}const D=`https://registry.anyt.io`;function O(){return t(o(),`.anytrc`)}let k=!1;function A(e){k=e}function j(){return k}function M(){return t(k?o():process.cwd(),`.anyt`)}function N(){return t(M(),`skills`)}function P(){return t(M(),`cache`)}function F(){return k?t(o(),`.anyt`,`anyt-lock.json`):t(process.cwd(),`anyt-lock.json`)}async function I(){let e=O();process.env.ANYT_DEBUG&&console.log(`[config] Reading config from: ${e}`);try{let t=await r(e,`utf-8`),n=s.parse(t);process.env.ANYT_DEBUG&&console.log(`[config] Parsed config:`,JSON.stringify(n,null,2));let i={};for(let e of Object.keys(n)){let t=e.match(/^(@[^:]+):registry$/);if(t){let r=t[1];i[r]=n[e]}}let a={};for(let e of Object.keys(n)){let t=e.match(/^\/\/([^:]+):authToken$/);if(t){let r=t[1];a[r]=n[e]}if(e.startsWith(`//`)&&typeof n[e]==`object`){let t=e.slice(2),r=n[e];r.authToken&&(a[t]=r.authToken)}}let o={};for(let e of Object.keys(n)){let t=e.match(/^encryption-key:(.+)$/);if(t){let r=t[1];o[r]=n[e]}}return{registry:n.registry,authToken:n.authToken,username:n.username,scopedRegistries:Object.keys(i).length>0?i:void 0,registryTokens:Object.keys(a).length>0?a:void 0,encryptionKeys:Object.keys(o).length>0?o:void 0}}catch(e){return process.env.ANYT_DEBUG&&console.log(`[config] Error reading config: ${e instanceof Error?e.message:String(e)}`),{}}}async function L(t){let r=O(),i=[`; anyt Configuration`,``];if(t.registry&&i.push(`registry = ${t.registry}`),t.authToken&&i.push(`authToken = ${t.authToken}`),t.username&&i.push(`username = ${t.username}`),t.encryptionKeys&&Object.keys(t.encryptionKeys).length>0){i.push(`; Encryption keys (scope -> passphrase)`);for(let[e,n]of Object.entries(t.encryptionKeys))i.push(`encryption-key:${e} = ${n}`)}i.push(``),await n(e(r),{recursive:!0}),await a(r,i.join(`
3
+ `)),process.env.ANYT_DEBUG&&console.log(`[config] Wrote config to: ${r}`)}async function R(){let n=process.cwd(),a=e(n);for(;n!==a;){let a=t(n,`.anytrc`);try{if((await i(a)).isFile()){let e=await r(a,`utf-8`);try{let t=s.parse(e);return process.env.ANYT_DEBUG&&console.log(`[config] Found project config at ${a}:`,JSON.stringify(t,null,2)),{registry:t.registry}}catch{try{return{registry:JSON.parse(e).registryUrl}}catch{}}}}catch{}n=e(n)}return null}async function z(){let e=await I(),t=await R(),n=D,r=e.authToken,i=e.username,a=e.scopedRegistries??{},o=e.registryTokens??{};return e.registry&&(n=e.registry),t?.registry&&(n=t.registry),process.env.ANYT_REGISTRY_URL&&(n=process.env.ANYT_REGISTRY_URL),process.env.ANYT_API_KEY&&(r=process.env.ANYT_API_KEY),process.env.ANYT_DEBUG&&(console.log(`[config] Resolved config:`),console.log(`[config] registryUrl: ${n}`),console.log(`[config] apiKey: ${r?`***`:`(not set)`}`),console.log(`[config] username: ${i||`(not set)`}`),console.log(`[config] scopedRegistries: ${JSON.stringify(a)}`),console.log(`[config] registryTokens: ${Object.keys(o).length} configured`)),{registryUrl:n,apiKey:r,username:i,scopedRegistries:a,registryTokens:o}}export{p as C,w as S,m as T,_,O as a,x as b,j as c,A as d,L as f,S as g,E as h,P as i,I as l,C as m,R as n,F as o,y as p,M as r,N as s,D as t,z as u,b as v,g as w,v as x,T as y};