agentpacks 1.7.6 → 1.7.8

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 (133) hide show
  1. package/README.md +69 -742
  2. package/dist/api.d.ts +15 -15
  3. package/dist/api.js +2706 -2706
  4. package/dist/cli/export-cmd.js +364 -364
  5. package/dist/cli/generate.js +1409 -1409
  6. package/dist/cli/import-cmd.js +249 -249
  7. package/dist/cli/info.js +31 -31
  8. package/dist/cli/init.js +6 -6
  9. package/dist/cli/install.js +141 -141
  10. package/dist/cli/login.js +31 -31
  11. package/dist/cli/models-explain.js +514 -514
  12. package/dist/cli/pack/create.js +6 -6
  13. package/dist/cli/pack/enable.js +2 -2
  14. package/dist/cli/pack/list.js +362 -362
  15. package/dist/cli/pack/validate.js +119 -119
  16. package/dist/cli/publish.js +42 -42
  17. package/dist/cli/search.js +31 -31
  18. package/dist/core/config.js +3 -3
  19. package/dist/core/feature-merger.d.ts +5 -5
  20. package/dist/core/feature-merger.js +4 -4
  21. package/dist/core/index.d.ts +4 -4
  22. package/dist/core/index.js +633 -633
  23. package/dist/core/lockfile.js +1 -1
  24. package/dist/core/metarepo.js +3 -3
  25. package/dist/core/pack-loader.d.ts +6 -6
  26. package/dist/core/pack-loader.js +362 -362
  27. package/dist/core/profile-resolver.d.ts +1 -1
  28. package/dist/exporters/cursor-plugin.d.ts +12 -0
  29. package/dist/exporters/cursor-plugin.js +46 -46
  30. package/dist/exporters/index.d.ts +1 -1
  31. package/dist/exporters/index.js +46 -46
  32. package/dist/features/agents.js +4 -4
  33. package/dist/features/commands.js +4 -4
  34. package/dist/features/hooks.js +4 -4
  35. package/dist/features/index.d.ts +8 -8
  36. package/dist/features/index.js +350 -350
  37. package/dist/features/mcp.js +4 -4
  38. package/dist/features/models.js +4 -4
  39. package/dist/features/plugins.js +5 -5
  40. package/dist/features/rules.js +4 -4
  41. package/dist/features/skills.js +5 -5
  42. package/dist/importers/claude-code.js +6 -6
  43. package/dist/importers/cursor.js +7 -7
  44. package/dist/importers/opencode.js +7 -7
  45. package/dist/importers/rulesync.js +7 -7
  46. package/dist/index.js +2674 -2674
  47. package/dist/node/api.js +2706 -2706
  48. package/dist/node/cli/export-cmd.js +364 -364
  49. package/dist/node/cli/generate.js +1409 -1409
  50. package/dist/node/cli/import-cmd.js +249 -249
  51. package/dist/node/cli/info.js +31 -31
  52. package/dist/node/cli/init.js +6 -6
  53. package/dist/node/cli/install.js +141 -141
  54. package/dist/node/cli/login.js +31 -31
  55. package/dist/node/cli/models-explain.js +514 -514
  56. package/dist/node/cli/pack/create.js +6 -6
  57. package/dist/node/cli/pack/enable.js +2 -2
  58. package/dist/node/cli/pack/list.js +362 -362
  59. package/dist/node/cli/pack/validate.js +119 -119
  60. package/dist/node/cli/publish.js +42 -42
  61. package/dist/node/cli/search.js +31 -31
  62. package/dist/node/core/config.js +3 -3
  63. package/dist/node/core/feature-merger.js +4 -4
  64. package/dist/node/core/index.js +633 -633
  65. package/dist/node/core/lockfile.js +1 -1
  66. package/dist/node/core/metarepo.js +3 -3
  67. package/dist/node/core/pack-loader.js +362 -362
  68. package/dist/node/exporters/cursor-plugin.js +46 -46
  69. package/dist/node/exporters/index.js +46 -46
  70. package/dist/node/features/agents.js +4 -4
  71. package/dist/node/features/commands.js +4 -4
  72. package/dist/node/features/hooks.js +4 -4
  73. package/dist/node/features/index.js +350 -350
  74. package/dist/node/features/mcp.js +4 -4
  75. package/dist/node/features/models.js +4 -4
  76. package/dist/node/features/plugins.js +5 -5
  77. package/dist/node/features/rules.js +4 -4
  78. package/dist/node/features/skills.js +5 -5
  79. package/dist/node/importers/claude-code.js +6 -6
  80. package/dist/node/importers/cursor.js +7 -7
  81. package/dist/node/importers/opencode.js +7 -7
  82. package/dist/node/importers/rulesync.js +7 -7
  83. package/dist/node/index.js +2674 -2674
  84. package/dist/node/sources/git.js +2 -2
  85. package/dist/node/sources/index.js +138 -138
  86. package/dist/node/sources/local.js +1 -1
  87. package/dist/node/sources/npm.js +3 -3
  88. package/dist/node/sources/registry.js +35 -35
  89. package/dist/node/targets/additional-targets.js +43 -43
  90. package/dist/node/targets/agents-md.js +4 -4
  91. package/dist/node/targets/claude-code.js +86 -86
  92. package/dist/node/targets/codex-cli.js +6 -6
  93. package/dist/node/targets/copilot.js +46 -46
  94. package/dist/node/targets/cursor.js +68 -68
  95. package/dist/node/targets/gemini-cli.js +25 -25
  96. package/dist/node/targets/generic-md-target.js +43 -43
  97. package/dist/node/targets/index.js +911 -911
  98. package/dist/node/targets/mistral-vibe.js +46 -46
  99. package/dist/node/targets/opencode.js +68 -68
  100. package/dist/node/targets/registry.js +911 -911
  101. package/dist/node/utils/credentials.js +2 -2
  102. package/dist/node/utils/filesystem.js +4 -4
  103. package/dist/node/utils/global.js +1 -1
  104. package/dist/node/utils/tarball.js +2 -2
  105. package/dist/sources/git.js +2 -2
  106. package/dist/sources/index.d.ts +6 -6
  107. package/dist/sources/index.js +138 -138
  108. package/dist/sources/local.js +1 -1
  109. package/dist/sources/npm.d.ts +3 -0
  110. package/dist/sources/npm.js +3 -3
  111. package/dist/sources/registry.js +35 -35
  112. package/dist/targets/additional-targets.js +43 -43
  113. package/dist/targets/agents-md.js +4 -4
  114. package/dist/targets/claude-code.js +86 -86
  115. package/dist/targets/codex-cli.js +6 -6
  116. package/dist/targets/copilot.js +46 -46
  117. package/dist/targets/cursor.js +68 -68
  118. package/dist/targets/gemini-cli.js +25 -25
  119. package/dist/targets/generic-md-target.js +43 -43
  120. package/dist/targets/index.d.ts +6 -6
  121. package/dist/targets/index.js +911 -911
  122. package/dist/targets/mistral-vibe.js +46 -46
  123. package/dist/targets/opencode.js +68 -68
  124. package/dist/targets/registry.js +911 -911
  125. package/dist/utils/credentials.js +2 -2
  126. package/dist/utils/filesystem.js +4 -4
  127. package/dist/utils/global.d.ts +3 -0
  128. package/dist/utils/global.js +1 -1
  129. package/dist/utils/tarball.js +2 -2
  130. package/package.json +5 -5
  131. package/templates/pack/models.json +36 -36
  132. package/templates/pack/pack.json +8 -8
  133. package/templates/workspace/agentpacks.jsonc +24 -24
package/README.md CHANGED
@@ -1,755 +1,82 @@
1
1
  # agentpacks
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/agentpacks.svg)](https://www.npmjs.com/package/agentpacks)
4
- [![npm downloads](https://img.shields.io/npm/dm/agentpacks.svg)](https://www.npmjs.com/package/agentpacks)
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
- [![Tests](https://img.shields.io/badge/tests-378%20passing-brightgreen.svg)](https://github.com/lssm-tech/contractspec/tree/main/packages/tools/agentpacks)
3
+ Website: https://github.com/lssm-tech/contractspec/tree/main/packages/tools/agentpacks
7
4
 
8
- **Composable AI agent configuration manager.**
5
+ **Composable AI agent configuration manager that merges packs into target-specific tool configuration, rules, hooks, skills, and AGENTS output.**
9
6
 
10
- Write your rules, commands, skills, hooks, models, and MCP configs once — in a pack — and sync them automatically to OpenCode, Cursor, Claude Code, Codex CLI, Gemini CLI, GitHub Copilot, and 14 more tools. Discover and share packs via the **agentpacks registry**.
7
+ ## What It Provides
11
8
 
12
- ---
9
+ - Loads, merges, and resolves agent packs into Cursor, Claude Code, Codex, Copilot, Gemini, OpenCode, registry, and AGENTS targets.
10
+ - Publishes a CLI plus a broad programmatic API for pack loading, sources, targets, importers, and exporters.
11
+ - Recently expanded around AI-native flows, model guidance, Cursor plugin output, and compatibility hardening.
12
+ - Related ContractSpec packages include `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
13
13
 
14
- ## Why agentpacks?
14
+ ## Installation
15
15
 
16
- AI coding tools are proliferating fast. Every tool has its own config format:
16
+ `npm install agentpacks`
17
17
 
18
- - Cursor wants `.cursor/rules/*.mdc`
19
- - Claude Code wants `CLAUDE.md` and `.claude/rules/*.md`
20
- - OpenCode wants `.opencode/agent/*.md`, `.opencode/skill/*.md`, `opencode.json`
21
- - Codex wants `.codex/memories/*.md`
22
- - And so on for 21+ tools…
18
+ or
23
19
 
24
- **Maintaining all of these by hand means:**
20
+ `bun add agentpacks`
25
21
 
26
- - Rules drift between tools — your Cursor context differs from your Claude context
27
- - Adding a new rule means editing 5+ files in 5+ formats
28
- - Onboarding a new tool means starting from scratch
29
-
30
- **agentpacks solves this with a pack-based architecture:**
31
-
32
- 1. Write your rules/commands/agents/skills once, in plain Markdown with simple frontmatter
33
- 2. Group them into a _pack_ (a folder with a `pack.json` manifest)
34
- 3. Run `agentpacks generate` — all 21 supported tools get their configs, properly formatted
35
-
36
- ### vs rulesync
37
-
38
- [rulesync](https://github.com/dyoshikawa/rulesync) is great inspiration but uses a flat file model. agentpacks goes further:
39
-
40
- | | agentpacks | rulesync |
41
- | -------------------- | --------------------------------------- | ------------- |
42
- | Architecture | Composable packs | Flat files |
43
- | Pack distribution | npm, git, local, **registry** | Local only |
44
- | **Pack registry** | Search, publish, install via CLI | — |
45
- | **Model configs** | Per-tool model/profile management | Not supported |
46
- | OpenCode plugins | Per-pack `.ts` plugin files | Not supported |
47
- | Cursor plugin export | Native plugin format | Not supported |
48
- | Import from tools | Cursor, Claude Code, OpenCode, rulesync | — |
49
- | Dependency resolver | Topological sort + conflict detection | — |
50
- | Monorepo / metarepo | Built-in baseDirs | — |
51
-
52
- ---
53
-
54
- ## Quick Start
22
+ ## Usage
55
23
 
56
24
  ```bash
57
- # Install globally
58
- npm install -g agentpacks
25
+ npx agentpacks --help
59
26
  # or
60
- bun add -g agentpacks
61
-
62
- # Initialize in your project
63
- cd my-project
64
- agentpacks init
65
-
66
- # Generate configs for all your AI tools
67
- agentpacks generate
68
- ```
69
-
70
- After `init`, you'll have:
71
-
72
- ```
73
- my-project/
74
- ├── agentpacks.jsonc # workspace config
75
- └── packs/
76
- └── default/
77
- ├── pack.json # pack manifest
78
- └── rules/
79
- └── overview.md # starter rule
80
- ```
81
-
82
- After `generate`, every supported tool gets its config — no manual formatting needed.
83
-
84
- ### Migrating from rulesync
85
-
86
- Already using rulesync? Import your existing setup in one command:
87
-
88
- ```bash
89
- agentpacks import --from rulesync
90
- ```
91
-
92
- This reads your `.rulesync/` directory and `rulesync.jsonc`, and creates an equivalent agentpacks pack + workspace config.
93
-
94
- ---
95
-
96
- ## Supported Tools
97
-
98
- ### Core targetsfull feature support
99
-
100
- | Target | ID | Rules | Commands | Agents | Skills | Hooks | Plugins | MCP | Ignore |
101
- | -------------- | ------------- | :---: | :------: | :----: | :----: | :---: | :-----: | :-: | :----: |
102
- | OpenCode | `opencode` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
103
- | Cursor | `cursor` | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ |
104
- | Claude Code | `claudecode` | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ |
105
- | Codex CLI | `codexcli` | ✓ | | | ✓ | ✓ | | ✓ | |
106
- | Mistral Vibe | `mistralvibe` | ✓ | ✓ | ✓ | ✓ | | | ✓ | ✓ |
107
- | Gemini CLI | `geminicli` | ✓ | ✓ | | ✓ | ✓ | | ✓ | ✓ |
108
- | GitHub Copilot | `copilot` | ✓ | ✓ | ✓ | ✓ | | | ✓ | ✓ |
109
- | AGENTS.md | `agentsmd` | ✓ | | | | | | | |
110
-
111
- ### Additional targets — rules, MCP, and more
112
-
113
- | Target | ID | Rules | Commands | MCP | Ignore |
114
- | ------------- | -------------- | :---: | :------: | :-: | :----: |
115
- | Cline | `cline` | ✓ | ✓ | ✓ | ✓ |
116
- | Kilo Code | `kilo` | ✓ | ✓ | ✓ | ✓ |
117
- | Roo Code | `roo` | ✓ | ✓ | ✓ | ✓ |
118
- | Qwen Code | `qwencode` | ✓ | | ✓ | ✓ |
119
- | Windsurf | `windsurf` | ✓ | | ✓ | ✓ |
120
- | Kiro | `kiro` | ✓ | | ✓ | |
121
- | Augment Code | `augmentcode` | ✓ | | ✓ | |
122
- | Replit Agent | `replit` | ✓ | | ✓ | |
123
- | Zed | `zed` | ✓ | | ✓ | |
124
- | Junie | `junie` | ✓ | | ✓ | |
125
- | Factory Droid | `factorydroid` | ✓ | | ✓ | |
126
- | AntiGravity | `antigravity` | ✓ | | ✓ | |
127
- | Warp | `warp` | ✓ | | | |
128
-
129
- ---
130
-
131
- ## Features
132
-
133
- agentpacks supports 9 feature types inside a pack:
134
-
135
- | Feature | Description | Example files |
136
- | ------------ | ---------------------------------------------------- | ------------------------------------------- |
137
- | **rules** | Project/coding guidelines injected as context | `rules/security.md`, `rules/style.md` |
138
- | **commands** | Slash commands (e.g. `/lint`, `/review`) | `commands/lint.md`, `commands/deploy.md` |
139
- | **agents** | Named sub-agents with specific personas | `agents/reviewer.md`, `agents/architect.md` |
140
- | **skills** | Step-by-step skill guides (AgentSkills-compatible) | `skills/migrate/SKILL.md` |
141
- | **hooks** | Shell commands triggered by agent events | `hooks.json` |
142
- | **plugins** | Raw TypeScript plugin files (OpenCode) | `plugins/my-plugin.ts` |
143
- | **mcp** | MCP server definitions | `mcp.json` |
144
- | **models** | Model preferences, profiles, and per-agent overrides | `models.json` |
145
- | **ignore** | Patterns the agent should ignore | `ignore` |
146
-
147
- ---
148
-
149
- ## CLI Reference
150
-
151
- ### `agentpacks init`
152
-
153
- Initialize agentpacks in the current project. Creates `agentpacks.jsonc` and a starter pack under `packs/default/`.
154
-
155
- ```bash
156
- agentpacks init
157
- ```
158
-
159
- ---
160
-
161
- ### `agentpacks generate`
162
-
163
- Generate tool configs from all active packs.
164
-
165
- ```bash
166
- agentpacks generate [options]
167
-
168
- Options:
169
- -t, --targets <targets> Comma-separated target IDs, or * for all (default: from config)
170
- -f, --features <features> Comma-separated feature IDs, or * for all (default: from config)
171
- --model-profile <profile> Activate a model profile (e.g. quality, budget, fast)
172
- --dry-run Preview changes without writing files
173
- --diff Show a diff of what would change
174
- -v, --verbose Enable verbose output
175
- ```
176
-
177
- ```bash
178
- # Generate for all configured targets
179
- agentpacks generate
180
-
181
- # Generate only for Cursor and Claude Code
182
- agentpacks generate --targets cursor,claudecode
183
-
184
- # Preview changes without writing
185
- agentpacks generate --dry-run --diff
186
-
187
- # Generate with the "budget" model profile active
188
- agentpacks generate --model-profile budget
189
- ```
190
-
191
- ---
192
-
193
- ### `agentpacks install`
194
-
195
- Install remote packs (npm packages, git repos, or registry packs) into the local pack cache.
196
-
197
- ```bash
198
- agentpacks install [options]
199
-
200
- Options:
201
- --update Re-resolve all refs, ignoring the lockfile
202
- --frozen Fail if the lockfile is missing or incomplete (useful in CI)
203
- -v, --verbose
204
- ```
205
-
206
- ```bash
207
- # Install all remote packs listed in agentpacks.jsonc
208
- agentpacks install
209
-
210
- # Update all remote packs to latest
211
- agentpacks install --update
212
-
213
- # CI: fail fast if lockfile is out of date
214
- agentpacks install --frozen
215
- ```
216
-
217
- ---
218
-
219
- ### `agentpacks import`
220
-
221
- Import from an existing tool configuration into a new pack.
222
-
223
- ```bash
224
- agentpacks import --from <source> [options]
225
-
226
- Sources: rulesync | cursor | claudecode | opencode
227
-
228
- Options:
229
- --from <source> Source format to import from (required)
230
- -o, --output <dir> Output directory for the generated pack
231
- ```
232
-
233
- ```bash
234
- # Import from rulesync (.rulesync/ + rulesync.jsonc)
235
- agentpacks import --from rulesync
236
-
237
- # Import from existing Cursor rules
238
- agentpacks import --from cursor --output ./packs/from-cursor
239
- ```
240
-
241
- ---
242
-
243
- ### `agentpacks export`
244
-
245
- Export a pack to a target-native format (e.g. a Cursor plugin).
246
-
247
- ```bash
248
- agentpacks export --format <format> [options]
249
-
250
- Formats: cursor-plugin
251
-
252
- Options:
253
- --format <format> Export format (required)
254
- -o, --output <dir> Output directory
255
- --pack <name> Export a specific pack only
256
- -v, --verbose
257
- ```
258
-
259
- ```bash
260
- # Export all packs as Cursor plugins
261
- agentpacks export --format cursor-plugin --output ./cursor-plugin-dist
262
- ```
263
-
264
- Each exported plugin follows Cursor's native plugin layout:
265
-
266
- - `.cursor-plugin/plugin.json`
267
- - `rules/*.mdc`, `agents/*.md`, `skills/*/SKILL.md`, `commands/*.md`
268
- - `hooks/hooks.json` (when hooks are defined)
269
- - `.mcp.json` (when MCP servers are defined)
270
-
271
- ---
272
-
273
- ### `agentpacks pack create <name>`
274
-
275
- Scaffold a new pack with the correct directory structure.
276
-
277
- ```bash
278
- agentpacks pack create my-pack
279
- ```
280
-
281
- Creates:
282
-
283
- ```
284
- packs/my-pack/
285
- ├── pack.json
286
- └── rules/
287
- └── overview.md
288
- ```
289
-
290
- ---
291
-
292
- ### `agentpacks pack list`
293
-
294
- List all configured packs and their enabled/disabled status.
295
-
296
- ```bash
297
- agentpacks pack list
298
- ```
299
-
300
- ---
301
-
302
- ### `agentpacks pack validate`
303
-
304
- Validate pack manifests and feature files for schema errors.
305
-
306
- For skills, validation also checks AgentSkills requirements (`name`, `description`, naming rules, and `skills/<name>/SKILL.md` alignment).
307
-
308
- ```bash
309
- agentpacks pack validate
310
- ```
311
-
312
- ---
313
-
314
- ### `agentpacks pack enable <name>` / `agentpacks pack disable <name>`
315
-
316
- Enable or disable a pack without removing it from `agentpacks.jsonc`.
317
-
318
- ```bash
319
- agentpacks pack disable my-pack # adds to "disabled" array
320
- agentpacks pack enable my-pack # removes from "disabled" array
321
- ```
322
-
323
- ---
324
-
325
- ### `agentpacks search <query>`
326
-
327
- Search the pack registry for packs matching a query.
328
-
329
- ```bash
330
- agentpacks search typescript
331
-
332
- # Filter by target
333
- agentpacks search react --target cursor
334
-
335
- # Sort by downloads
336
- agentpacks search monorepo --sort downloads
337
- ```
338
-
339
- ---
340
-
341
- ### `agentpacks info <pack>`
342
-
343
- Show detailed information about a registry pack.
344
-
345
- ```bash
346
- agentpacks info typescript-best-practices
347
- ```
348
-
349
- ---
350
-
351
- ### `agentpacks publish`
352
-
353
- Publish the current pack to the registry. Requires authentication.
354
-
355
- ```bash
356
- agentpacks login # store your registry token
357
- agentpacks publish # validate, bundle, and upload
358
- ```
359
-
360
- The publish command validates the pack, scans for secrets, creates a tarball, and uploads it. Publish will be blocked if the pack contains potential secrets (API keys, tokens, etc.) in `models.json` or other config files.
361
-
362
- ---
363
-
364
- ### `agentpacks login`
365
-
366
- Authenticate with the pack registry.
367
-
368
- ```bash
369
- agentpacks login
370
- ```
371
-
372
- Stores your token in `~/.config/agentpacks/credentials.json`.
373
-
374
- ---
375
-
376
- ## Model Configuration
377
-
378
- agentpacks can manage AI model preferences across all your tools through the `models` feature. Define model assignments, named profiles, and provider options in a single `models.json` — agentpacks generates the right config for each tool.
379
-
380
- ### models.json
381
-
382
- Place `models.json` at the root of a pack:
383
-
384
- ```json
385
- {
386
- "default": "anthropic/claude-sonnet-4-20250514",
387
- "small": "anthropic/claude-haiku-3-5",
388
- "agents": {
389
- "code-reviewer": { "model": "anthropic/claude-opus-4-20250514" },
390
- "quick-fixer": { "model": "anthropic/claude-haiku-3-5" }
391
- },
392
- "profiles": {
393
- "quality": {
394
- "default": "anthropic/claude-opus-4-20250514",
395
- "small": "anthropic/claude-sonnet-4-20250514"
396
- },
397
- "budget": {
398
- "default": "anthropic/claude-haiku-3-5",
399
- "small": "anthropic/claude-haiku-3-5"
400
- },
401
- "fast": {
402
- "default": "anthropic/claude-haiku-3-5"
403
- }
404
- },
405
- "providers": {
406
- "anthropic": {
407
- "models": {
408
- "claude-opus-4-20250514": {
409
- "options": { "budgetTokens": 10000, "reasoningEffort": "high" }
410
- }
411
- }
412
- }
413
- }
414
- }
415
- ```
416
-
417
- ### Activating a profile
418
-
419
- Set `modelProfile` in your workspace config:
420
-
421
- ```jsonc
422
- {
423
- "modelProfile": "quality",
424
- }
425
- ```
426
-
427
- Or override at generate time:
428
-
429
- ```bash
430
- agentpacks generate --model-profile budget
431
- ```
432
-
433
- ### Per-tool output
434
-
435
- | Tool | What agentpacks generates |
436
- | --------------- | ----------------------------------------------------------------------------------------- |
437
- | **OpenCode** | `model`, `small_model`, `provider.*.models.*.options`, `agent.*.model` in `opencode.json` |
438
- | **Cursor** | `.cursor/rules/model-config.mdc` — an always-applied guidance rule |
439
- | **Claude Code** | Model guidance in `CLAUDE.md`, `<!-- model: ... -->` hints in agent files |
440
- | **Copilot** | Model guidance section in `.github/copilot-instructions.md` |
441
- | **Others** | Model guidance in their root rule file |
442
-
443
- ### Security
444
-
445
- `models.json` must **never** contain credentials. agentpacks scans for API keys, tokens, secrets, and private key markers during `pack validate` and `publish`. Publish is blocked if secrets are detected.
446
-
447
- ---
448
-
449
- ## Configuration
450
-
451
- ### Workspace config — `agentpacks.jsonc`
452
-
453
- Created at your project root by `agentpacks init`.
454
-
455
- ```jsonc
456
- {
457
- "$schema": "https://unpkg.com/agentpacks/schema.json",
458
-
459
- // Packs to load — local, npm, git, or registry
460
- "packs": [
461
- "./packs/default",
462
- "agentpacks-typescript-rules", // npm package
463
- "github:myorg/agent-packs#main/python", // git ref
464
- "registry:react-patterns", // registry pack
465
- ],
466
-
467
- // Temporarily disable a pack without removing it
468
- "disabled": [],
469
-
470
- // Which AI tools to generate configs for (* = all 21)
471
- "targets": [
472
- "opencode",
473
- "cursor",
474
- "claudecode",
475
- "geminicli",
476
- "codexcli",
477
- "mistralvibe",
478
- "copilot",
479
- ],
480
-
481
- // Which feature types to generate (* = all 9)
482
- "features": ["*"],
483
-
484
- // Active model profile (from models.json profiles)
485
- "modelProfile": "quality",
486
-
487
- // Repository mode: "repo" | "monorepo" | "metarepo"
488
- "mode": "repo",
489
-
490
- // Base directories to generate into (monorepo mode)
491
- "baseDirs": ["."],
492
-
493
- // Generate user-global configs (XDG-aware, applies to all projects)
494
- "global": false,
495
-
496
- // Delete existing generated files before regenerating
497
- "delete": true,
498
- }
499
- ```
500
-
501
- ### Pack manifest — `pack.json`
502
-
503
- Lives at the root of each pack directory.
504
-
505
- ```json
506
- {
507
- "name": "my-pack",
508
- "version": "1.0.0",
509
- "description": "My custom agent rules and commands",
510
- "author": "Your Name",
511
- "tags": ["typescript", "testing"],
512
- "dependencies": ["base-pack"],
513
- "conflicts": [],
514
- "targets": ["*"],
515
- "features": ["*"]
516
- }
517
- ```
518
-
519
- ---
520
-
521
- ## Authoring a Pack
522
-
523
- A pack is a directory with a `pack.json` and any combination of feature subdirectories:
524
-
525
- ```
526
- my-pack/
527
- ├── pack.json
528
- ├── rules/
529
- │ ├── overview.md # root: true → included in AGENTS.md / CLAUDE.md
530
- │ └── security.md # root: false → detail rule
531
- ├── commands/
532
- │ └── review.md
533
- ├── agents/
534
- │ └── architect.md
535
- ├── skills/
536
- │ └── migrate/
537
- │ └── SKILL.md
538
- ├── hooks.json
539
- ├── mcp.json
540
- ├── models.json
541
- └── ignore
542
- ```
543
-
544
- ### Rule frontmatter
545
-
546
- ```markdown
547
- ---
548
- root: true # true = root context (AGENTS.md, CLAUDE.md); false = detail rule
549
- targets: ['*'] # which tools this rule applies to
550
- description: 'Overview' # shown in Cursor rules UI
551
- globs: ['src/**/*.ts'] # (optional) file-pattern-scoped rule
552
- ---
553
-
554
- Your rule content here.
555
- ```
556
-
557
- ### Command frontmatter
558
-
559
- ```markdown
560
- ---
561
- name: review # command name (becomes /review)
562
- targets: ['*']
563
- description: 'Run a code review'
564
- ---
565
-
566
- Review the selected code for correctness, style, and potential bugs.
567
- ```
568
-
569
- ### Skill frontmatter (AgentSkills-compatible)
570
-
571
- `SKILL.md` follows the [AgentSkills](https://agentskills.io/home.md) metadata model.
572
-
573
- - Required: `name`, `description`
574
- - `name` must match the `skills/<name>/` directory and use lowercase letters, numbers, and single hyphens
575
- - Optional fields like `allowed-tools`, `compatibility`, and other metadata are preserved during generation/export
576
-
577
- ```markdown
578
- ---
579
- name: migrate-component
580
- description: Migrate a component to design-system primitives
581
- allowed-tools:
582
- - read
583
- - edit
584
- compatibility:
585
- cursor: '>=0.50.0'
586
- targets: ['*']
587
- ---
588
-
589
- Step-by-step migration workflow...
590
- ```
591
-
592
- ### MCP config — `mcp.json`
593
-
594
- ```json
595
- {
596
- "mcpServers": {
597
- "my-server": {
598
- "command": "npx",
599
- "args": ["-y", "my-mcp-server"],
600
- "env": { "API_KEY": "$MY_API_KEY" }
601
- },
602
- "remote-server": {
603
- "url": "https://mcp.example.com/sse",
604
- "headers": { "Authorization": "Bearer $TOKEN" }
605
- }
606
- }
607
- }
608
- ```
609
-
610
- ### Hooks — `hooks.json`
611
-
612
- ```json
613
- {
614
- "hooks": {
615
- "sessionStart": [{ "command": "echo 'Session started'" }],
616
- "postToolUse": [
617
- {
618
- "command": "bun run lint",
619
- "matcher": "write_file|edit_file"
620
- }
621
- ]
622
- }
623
- }
624
- ```
625
-
626
- Supported hook events: `sessionStart`, `preToolUse`, `postToolUuse`, `afterFileEdit`, `afterShellExecution`, `stop`
627
-
628
- ---
629
-
630
- ## Monorepo Support
631
-
632
- For monorepo setups, set `mode: "monorepo"` and list your sub-packages in `baseDirs`:
633
-
634
- ```jsonc
635
- {
636
- "mode": "monorepo",
637
- "baseDirs": ["packages/api", "packages/web", "packages/shared"],
638
- }
639
- ```
640
-
641
- `agentpacks generate` will write tool configs into each listed base directory.
642
-
643
- For metarepo setups (a repo of repos), set `mode: "metarepo"` and agentpacks will discover sub-repos that contain their own `agentpacks.jsonc` and process them.
644
-
645
- ---
646
-
647
- ## Pack Distribution
648
-
649
- Packs can be shared via four sources:
650
-
651
- ### agentpacks registry
652
-
653
- The official pack registry at [agentpacks.dev](https://agentpacks.dev) — search, publish, and install community packs.
654
-
655
- ```bash
656
- # Search for packs
657
- agentpacks search typescript
658
-
659
- # View pack details
660
- agentpacks info typescript-best-practices
661
-
662
- # Install from registry
663
- agentpacks install
664
- ```
665
-
666
- ```jsonc
667
- {
668
- "packs": [
669
- "registry:typescript-best-practices",
670
- "registry:react-patterns@1.2.0", // pinned version
671
- ],
672
- }
673
- ```
674
-
675
- ### npm packages
676
-
677
- ```bash
678
- npm install my-agent-pack
679
- ```
680
-
681
- ```jsonc
682
- { "packs": ["my-agent-pack"] }
683
- ```
684
-
685
- ### Git repos
686
-
687
- ```jsonc
688
- {
689
- "packs": [
690
- "github:myorg/agent-packs", // defaults to main branch
691
- "github:myorg/agent-packs#v2.0.0", // specific tag
692
- "github:myorg/agent-packs#main/python", // subdirectory
693
- ],
694
- }
695
- ```
696
-
697
- ### Local directories (monorepo / private)
698
-
699
- ```jsonc
700
- { "packs": ["./packs/default", "../shared/agent-packs"] }
701
- ```
702
-
703
- ---
704
-
705
- ## Global Mode
706
-
707
- Generate user-scope configs that apply to all projects on your machine (useful for personal preferences):
708
-
709
- ```bash
710
- agentpacks generate --global
711
- ```
712
-
713
- agentpacks uses XDG-aware paths:
714
-
715
- - **macOS/Linux**: `~/.config/agentpacks/`
716
- - **Windows**: `%APPDATA%\agentpacks\`
717
-
718
- ---
719
-
720
- ## About
721
-
722
- ### ContractSpec
723
-
724
- [ContractSpec](https://contractspec.io) is the deterministic, spec-first compiler that keeps AI-written software coherent, safe, and regenerable. As AI coding tools generate more and more code, ContractSpec provides the governance layer: canonical contracts, multi-surface consistency, and safe regeneration without lock-in.
725
-
726
- > "You keep your app. We stabilize it, one module at a time. You own the code. It's standard tech. We're the compiler, not the prison."
727
-
728
- ### LSSM
729
-
730
- [LSSM](https://github.com/lssm-tech) is the team behind ContractSpec. We build tools for AI-native software development — infrastructure that makes AI-generated code safe, maintainable, and production-ready.
731
-
732
- agentpacks is built by LSSM as an open-source part of the ContractSpec ecosystem, published independently on npm so any project can adopt it without adopting the full ContractSpec platform.
733
-
734
- ---
735
-
736
- ## Contributing
737
-
738
- We welcome contributions of all kinds — bug reports, feature requests, documentation improvements, and code.
739
-
740
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for setup instructions, code style guidelines, and the pull request process.
741
-
742
- **Quick links:**
743
-
744
- - [Report a bug](https://github.com/lssm-tech/contractspec/issues/new?template=bug_report.md&labels=agentpacks)
745
- - [Request a feature](https://github.com/lssm-tech/contractspec/issues/new?template=feature_request.md&labels=agentpacks)
746
- - [Ask a question](https://github.com/lssm-tech/contractspec/discussions)
747
- - [View the roadmap](https://github.com/lssm-tech/contractspec/issues?q=is%3Aissue+label%3Aagentpacks+label%3Aroadmap)
748
-
749
- ---
750
-
751
- ## License
752
-
753
- MIT — see [LICENSE](../../LICENSE) for details.
754
-
755
- Built with love by [LSSM](https://github.com/lssm-tech) — contributors of [ContractSpec](https://contractspec.io).
27
+ bunx agentpacks --help
28
+ ```
29
+
30
+ ## Architecture
31
+
32
+ - `src/cli/` contains command implementations for init, generate, install, publish, search, and pack subcommands.
33
+ - `src/core/` handles config loading, dependency resolution, pack loading, lockfiles, and feature merging.
34
+ - `src/features/`, `src.sources/`, `src.targets/`, `src.importers/`, and `src.exporters/` implement the pack pipeline.
35
+ - `src.utils/` contains credentials, diffing, markdown, registry, and model-helper utilities.
36
+ - `src/index.ts` is the root public barrel and package entrypoint.
37
+
38
+ ## Public Entry Points
39
+
40
+ - Exports the CLI binary plus API, core, features, targets, sources, importers, exporters, and utility subpaths.
41
+ - Binary `agentpacks` points to `./dist/index.js`.
42
+ - Export `.` resolves through `./src/index.ts`.
43
+ - Export `./api` resolves through `./src/api.ts`.
44
+ - Export `./cli/export-cmd` resolves through `./src/cli/export-cmd.ts`.
45
+ - Export `./cli/generate` resolves through `./src/cli/generate.ts`.
46
+ - Export `./cli/import-cmd` resolves through `./src/cli/import-cmd.ts`.
47
+ - Export `./cli/info` resolves through `./src/cli/info.ts`.
48
+ - Export `./cli/init` resolves through `./src/cli/init.ts`.
49
+ - Export `./cli/install` resolves through `./src/cli/install.ts`.
50
+ - Export `./cli/login` resolves through `./src/cli/login.ts`.
51
+ - Export `./cli/models-explain` resolves through `./src/cli/models-explain.ts`.
52
+
53
+ ## Local Commands
54
+
55
+ - `bun run dev` — contractspec-bun-build dev
56
+ - `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
57
+ - `bun run test` — bun test --pass-with-no-tests
58
+ - `bun run lint` — bun lint:fix
59
+ - `bun run lint:check` biome check .
60
+ - `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
61
+ - `bun run typecheck` — tsc --noEmit
62
+ - `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
63
+ - `bun run publish:pkg:canary` — bun publish:pkg --tag canary
64
+ - `bun run clean` — rimraf dist .turbo
65
+ - `bun run build:bundle` contractspec-bun-build transpile
66
+ - `bun run build:types` — contractspec-bun-build types
67
+ - `bun run prebuild` contractspec-bun-build prebuild
68
+
69
+ ## Recent Updates
70
+
71
+ - Use the Biome-only lint and formatting workflow in pack guidance and generated targets.
72
+ - Vnext ai-native.
73
+ - Add latest models and align defaults.
74
+ - Harden AgentSkills compatibility in agentpacks.
75
+ - Add first-class mistral provider support.
76
+ - Align cursor plugin export and hooks output.
77
+
78
+ ## Notes
79
+
80
+ - Do not modify target output formats without updating the corresponding target writer.
81
+ - Pack schema changes must stay backward-compatible (see `schema.json`).
82
+ - Never hard-code model names; use `utils/model-allowlist` and `utils/model-guidance`.