agentspec-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.
Files changed (3) hide show
  1. package/README.md +343 -0
  2. package/dist/index.js +1786 -0
  3. package/package.json +59 -0
package/README.md ADDED
@@ -0,0 +1,343 @@
1
+ # @agentspec/cli
2
+
3
+ The official CLI for [AgentSpec](https://agentspec.sh) — install, manage, and switch between AI agent configurations (configs, skills, rules, and specs) from the command line.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # Install globally
9
+ npm install -g @agentspec/cli
10
+
11
+ # Or run without installing
12
+ npx @agentspec/cli install <id>
13
+ ```
14
+
15
+ **Requirements:** Node.js 18 or later.
16
+
17
+ ## Quick Start
18
+
19
+ ```bash
20
+ # Browse and install a Claude Code config
21
+ agentspec list configs --framework ClaudeCode
22
+ agentspec install my-claude-config
23
+
24
+ # Install a skill for Codex
25
+ agentspec install my-skill --framework Codex
26
+
27
+ # Activate a full spec (installs all configs + skills + rules at once)
28
+ agentspec use my-team-spec
29
+
30
+ # Check what's installed
31
+ agentspec status
32
+
33
+ # Update everything to the latest version
34
+ agentspec update --all
35
+ ```
36
+
37
+ ## Commands
38
+
39
+ ### `agentspec install <id>`
40
+
41
+ Install a config, skill, rule, or spec by ID or slug.
42
+
43
+ ```bash
44
+ agentspec install <id|slug> [options]
45
+ ```
46
+
47
+ | Option | Description |
48
+ | -------------------- | --------------------------------------------- |
49
+ | `--type <type>` | Skip auto-detect: `config\|skill\|rule\|spec` |
50
+ | `--framework <name>` | Target framework for skills (skips prompt) |
51
+ | `--file-type <type>` | Target file type for rules (skips prompt) |
52
+ | `--global` | Install globally as a symlink |
53
+ | `--project` | Install to current project as a file copy |
54
+ | `--dry-run` | Preview without writing any files |
55
+
56
+ **Scope behavior:**
57
+
58
+ - **Project** (`--project`): Writes a real file copy to your project directory. The file can be edited and committed to git. After `agentspec update`, re-install to refresh the copy.
59
+ - **Global** (`--global`): Creates a symlink from the standard tool location (e.g. `~/.claude/settings.json`) to `~/.agentspec/store/<slug>/content`. Updating the store automatically updates the symlinked file everywhere.
60
+ - If the content type does not support global installation, defaults to `--project`.
61
+ - If neither flag is set, you are prompted interactively.
62
+
63
+ **Examples:**
64
+
65
+ ```bash
66
+ # Install a config (prompts for scope)
67
+ agentspec install my-claude-config
68
+
69
+ # Install globally without prompt
70
+ agentspec install my-claude-config --global
71
+
72
+ # Install a skill for a specific framework
73
+ agentspec install code-review-skill --framework ClaudeCode --project
74
+
75
+ # Install a rule as a specific file type
76
+ agentspec install no-todos-rule --file-type claude-md
77
+
78
+ # Preview what would happen
79
+ agentspec install my-team-spec --dry-run
80
+ ```
81
+
82
+ ---
83
+
84
+ ### `agentspec uninstall <id>`
85
+
86
+ Remove an installed config, skill, or rule.
87
+
88
+ ```bash
89
+ agentspec uninstall <id|slug> [options]
90
+ ```
91
+
92
+ | Option | Description |
93
+ | ----------- | --------------------------- |
94
+ | `--global` | Uninstall from global scope |
95
+ | `--project` | Uninstall from this project |
96
+
97
+ For **global** installs: removes the symlink and restores the original file from backup (if one was saved).
98
+
99
+ For **project** installs: prompts whether to `keep` the file (just stop tracking) or `delete` it from disk.
100
+
101
+ ```bash
102
+ agentspec uninstall my-claude-config
103
+ agentspec uninstall my-claude-config --global
104
+ ```
105
+
106
+ ---
107
+
108
+ ### `agentspec update [slug]`
109
+
110
+ Update installed items to their latest version from agentspec.sh.
111
+
112
+ ```bash
113
+ agentspec update [slug] [options]
114
+ ```
115
+
116
+ | Option | Description |
117
+ | ----------- | ------------------------------------------------------------ |
118
+ | `--all` | Update all items in the store |
119
+ | `--check` | Only check for updates, do not apply |
120
+ | `--force` | Overwrite even if the local store copy was manually modified |
121
+ | `--dry-run` | Preview without writing anything |
122
+
123
+ Update detection uses SHA-256 content hashes. If your local store copy was manually edited, the update is skipped unless `--force` is passed.
124
+
125
+ > **Note:** Global installs (symlinks) automatically reflect store updates. Project installs (file copies) need to be re-installed after an update.
126
+
127
+ ```bash
128
+ # Check if any updates are available
129
+ agentspec update --check
130
+
131
+ # Update a single item
132
+ agentspec update my-claude-config
133
+
134
+ # Update everything, overwriting local edits
135
+ agentspec update --all --force
136
+ ```
137
+
138
+ ---
139
+
140
+ ### `agentspec use <spec>`
141
+
142
+ Activate a spec — installs all its configs, skills, and rules in one shot.
143
+
144
+ ```bash
145
+ agentspec use <spec-id|spec-slug> [options]
146
+ ```
147
+
148
+ | Option | Description |
149
+ | ----------- | ------------------------------------ |
150
+ | `--global` | Activate globally |
151
+ | `--project` | Activate for this project only |
152
+ | `--none` | Deactivate the currently active spec |
153
+ | `--dry-run` | Preview without writing files |
154
+
155
+ Activating a new spec automatically deactivates the previously active one first. All items installed by the spec are tracked — `agentspec use --none` cleanly removes them all.
156
+
157
+ ```bash
158
+ # Activate a spec for this project
159
+ agentspec use my-team-spec --project
160
+
161
+ # Activate globally
162
+ agentspec use my-team-spec --global
163
+
164
+ # Deactivate the current spec
165
+ agentspec use --none
166
+ ```
167
+
168
+ ---
169
+
170
+ ### `agentspec status`
171
+
172
+ Show currently installed items and the active spec.
173
+
174
+ ```bash
175
+ agentspec status [options]
176
+ ```
177
+
178
+ | Option | Description |
179
+ | ---------- | --------------------------------------------------------- |
180
+ | `--global` | Show global installation state |
181
+ | `--store` | List all items in the local store (`~/.agentspec/store/`) |
182
+
183
+ ```bash
184
+ # Show what's installed in the current project
185
+ agentspec status
186
+
187
+ # Show globally installed items
188
+ agentspec status --global
189
+
190
+ # List everything in the local store
191
+ agentspec status --store
192
+ ```
193
+
194
+ ---
195
+
196
+ ### `agentspec search <query>`
197
+
198
+ Search for configs, skills, rules, specs, and plugins on agentspec.sh.
199
+
200
+ ```bash
201
+ agentspec search <query> [options]
202
+ ```
203
+
204
+ | Option | Description |
205
+ | --------------- | ------------------------------------------------------------------------- |
206
+ | `--type <type>` | Filter by type: `all\|config\|skill\|rule\|spec\|plugin` (default: `all`) |
207
+ | `--limit <n>` | Max results (default: `10`, max: `50`) |
208
+
209
+ ```bash
210
+ agentspec search "code review"
211
+ agentspec search "strict typescript" --type config
212
+ agentspec search "refactoring" --type skill --limit 5
213
+ ```
214
+
215
+ ---
216
+
217
+ ### `agentspec list <type>`
218
+
219
+ Browse configs, skills, rules, or specs on agentspec.sh.
220
+
221
+ ```bash
222
+ agentspec list <configs|skills|rules|specs> [options]
223
+ ```
224
+
225
+ | Option | Description |
226
+ | -------------------- | ------------------------------------------------ |
227
+ | `--sort <sort>` | Sort: `hot\|new\|top\|installs` (default: `hot`) |
228
+ | `--framework <name>` | Filter by framework |
229
+ | `--file-type <type>` | Filter rules by file type |
230
+ | `--limit <n>` | Number of results (default: `20`, max: `100`) |
231
+ | `--offset <n>` | Pagination offset (default: `0`) |
232
+
233
+ ```bash
234
+ # List top Claude Code configs
235
+ agentspec list configs --framework ClaudeCode --sort top
236
+
237
+ # Latest skills for Codex
238
+ agentspec list skills --framework Codex --sort new
239
+
240
+ # Browse CLAUDE.md rules
241
+ agentspec list rules --file-type claude-md
242
+
243
+ # Next page
244
+ agentspec list specs --limit 20 --offset 20
245
+ ```
246
+
247
+ ---
248
+
249
+ ### `agentspec info <id>`
250
+
251
+ Show details for a config, skill, rule, spec, or plugin.
252
+
253
+ ```bash
254
+ agentspec info <id|slug> [options]
255
+ ```
256
+
257
+ | Option | Description |
258
+ | --------------- | ----------------------------------------------------- |
259
+ | `--type <type>` | Skip auto-detect: `config\|skill\|rule\|spec\|plugin` |
260
+
261
+ Displays title, slug, author, vote count, install count, description, supported frameworks/file types, install paths, and a content preview.
262
+
263
+ ```bash
264
+ agentspec info my-claude-config
265
+ agentspec info abc123 --type skill
266
+ ```
267
+
268
+ ---
269
+
270
+ ## Global Store
271
+
272
+ The CLI stores all content in `~/.agentspec/` (override with `$AGENTSPEC_HOME`):
273
+
274
+ ```
275
+ ~/.agentspec/
276
+ ├── global-state.json # Active spec + globally installed items
277
+ ├── store/
278
+ │ └── <slug>/
279
+ │ ├── content # Raw file content
280
+ │ └── meta.json # ID, type, title, framework, fetched date, content hash
281
+ ├── backups/ # Originals replaced by global symlinks
282
+ └── projects/
283
+ └── <project-hash>/
284
+ └── state.json # Per-project active spec + installed items
285
+ ```
286
+
287
+ Items are always saved to the store regardless of install scope. This means:
288
+
289
+ - **Global symlinks** automatically pick up `agentspec update` changes.
290
+ - **Project copies** need to be re-installed after an update.
291
+
292
+ ---
293
+
294
+ ## Supported Frameworks & Install Paths
295
+
296
+ ### Configs
297
+
298
+ | Framework | Project path | Global path |
299
+ | ------------ | ----------------------- | ---------------------------------- |
300
+ | `ClaudeCode` | `.claude/settings.json` | `~/.claude/settings.json` |
301
+ | `Codex` | `codex.toml` | `~/.codex/codex.toml` |
302
+ | `OpenCode` | `opencode.json` | `~/.config/opencode/opencode.json` |
303
+
304
+ ### Skills
305
+
306
+ | Framework | Project directory | Global directory |
307
+ | ------------ | ------------------- | --------------------- |
308
+ | `ClaudeCode` | `.claude/skills/` | `~/.claude/skills/` |
309
+ | `Codex` | `.codex/skills/` | `~/.codex/skills/` |
310
+ | `OpenCode` | `.opencode/skills/` | `~/.opencode/skills/` |
311
+ | `Windsurf` | `.windsurf/skills/` | _(no global)_ |
312
+ | `Universal` | `skills/` | _(no global)_ |
313
+
314
+ ### Rules
315
+
316
+ Rules are always installed as project files (no global scope).
317
+
318
+ | File Type | Install Path | Agent |
319
+ | ---------------------- | --------------------------------- | -------------------- |
320
+ | `claude-md` | `CLAUDE.md` | Claude Code |
321
+ | `agents-md` | `AGENTS.md` | Claude Code / Codex |
322
+ | `cursorrules` | `.cursorrules` | Cursor |
323
+ | `cursor-rules` | `.cursor/rules/<title>.md` | Cursor (directory) |
324
+ | `copilot-instructions` | `.github/copilot-instructions.md` | GitHub Copilot |
325
+ | `windsurfrules` | `.windsurfrules` | Windsurf |
326
+ | `windsurf-rules` | `.windsurf/rules/<title>.md` | Windsurf (directory) |
327
+ | `clinerules` | `.clinerules` | Cline |
328
+ | `gemini-md` | `GEMINI.md` | Gemini |
329
+
330
+ ---
331
+
332
+ ## Environment Variables
333
+
334
+ | Variable | Default | Description |
335
+ | ------------------- | -------------------------- | --------------------------------------------------- |
336
+ | `AGENTSPEC_HOME` | `~/.agentspec` | Override the global store location |
337
+ | `AGENTSPEC_API_URL` | `https://api.agentspec.sh` | Override the API base URL (useful for self-hosting) |
338
+
339
+ ---
340
+
341
+ ## License
342
+
343
+ MIT