agentpacks 0.3.0 → 0.4.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 (166) hide show
  1. package/README.md +168 -8
  2. package/dist/api.d.ts +2 -0
  3. package/dist/api.js +929 -409
  4. package/dist/cli/export-cmd.js +281 -149
  5. package/dist/cli/generate.js +740 -247
  6. package/dist/cli/import-cmd.js +57 -85
  7. package/dist/cli/info.d.ts +4 -0
  8. package/dist/cli/info.js +232 -0
  9. package/dist/cli/init.js +8 -36
  10. package/dist/cli/install.js +414 -129
  11. package/dist/cli/login.d.ts +9 -0
  12. package/dist/cli/login.js +202 -0
  13. package/dist/cli/models-explain.d.ts +16 -0
  14. package/dist/cli/models-explain.js +1205 -0
  15. package/dist/cli/pack/create.js +4 -32
  16. package/dist/cli/pack/enable.js +1 -29
  17. package/dist/cli/pack/list.js +266 -134
  18. package/dist/cli/pack/validate.js +274 -127
  19. package/dist/cli/publish.d.ts +8 -0
  20. package/dist/cli/publish.js +672 -0
  21. package/dist/cli/search.d.ts +12 -0
  22. package/dist/cli/search.js +210 -0
  23. package/dist/core/config.d.ts +2 -1
  24. package/dist/core/config.js +74 -117
  25. package/dist/core/dependency-resolver.js +4 -28
  26. package/dist/core/feature-merger.d.ts +7 -0
  27. package/dist/core/feature-merger.js +289 -29
  28. package/dist/core/index.js +283 -140
  29. package/dist/core/lockfile.js +0 -28
  30. package/dist/core/metarepo.js +74 -116
  31. package/dist/core/pack-loader.d.ts +2 -0
  32. package/dist/core/pack-loader.js +266 -133
  33. package/dist/core/profile-resolver.d.ts +75 -0
  34. package/dist/core/profile-resolver.js +111 -0
  35. package/dist/exporters/cursor-plugin.js +4 -32
  36. package/dist/exporters/index.js +4 -32
  37. package/dist/features/agents.d.ts +5 -0
  38. package/dist/features/agents.js +2 -30
  39. package/dist/features/commands.js +2 -30
  40. package/dist/features/hooks.js +2 -30
  41. package/dist/features/ignore.js +0 -28
  42. package/dist/features/index.d.ts +1 -0
  43. package/dist/features/index.js +176 -31
  44. package/dist/features/mcp.js +2 -30
  45. package/dist/features/models.d.ts +167 -0
  46. package/dist/features/models.js +293 -0
  47. package/dist/features/plugins.js +2 -30
  48. package/dist/features/rules.js +2 -30
  49. package/dist/features/skills.js +2 -30
  50. package/dist/importers/claude-code.js +10 -38
  51. package/dist/importers/cursor.js +15 -43
  52. package/dist/importers/opencode.js +16 -44
  53. package/dist/importers/rulesync.js +22 -50
  54. package/dist/index.js +1710 -538
  55. package/dist/node/api.js +929 -409
  56. package/dist/node/cli/export-cmd.js +281 -149
  57. package/dist/node/cli/generate.js +740 -247
  58. package/dist/node/cli/import-cmd.js +57 -85
  59. package/dist/node/cli/info.js +232 -0
  60. package/dist/node/cli/init.js +8 -36
  61. package/dist/node/cli/install.js +414 -129
  62. package/dist/node/cli/login.js +202 -0
  63. package/dist/node/cli/models-explain.js +1205 -0
  64. package/dist/node/cli/pack/create.js +4 -32
  65. package/dist/node/cli/pack/enable.js +1 -29
  66. package/dist/node/cli/pack/list.js +266 -134
  67. package/dist/node/cli/pack/validate.js +274 -127
  68. package/dist/node/cli/publish.js +672 -0
  69. package/dist/node/cli/search.js +210 -0
  70. package/dist/node/core/config.js +74 -117
  71. package/dist/node/core/dependency-resolver.js +4 -28
  72. package/dist/node/core/feature-merger.js +289 -29
  73. package/dist/node/core/index.js +283 -140
  74. package/dist/node/core/lockfile.js +0 -28
  75. package/dist/node/core/metarepo.js +74 -116
  76. package/dist/node/core/pack-loader.js +266 -133
  77. package/dist/node/core/profile-resolver.js +111 -0
  78. package/dist/node/exporters/cursor-plugin.js +4 -32
  79. package/dist/node/exporters/index.js +4 -32
  80. package/dist/node/features/agents.js +2 -30
  81. package/dist/node/features/commands.js +2 -30
  82. package/dist/node/features/hooks.js +2 -30
  83. package/dist/node/features/ignore.js +0 -28
  84. package/dist/node/features/index.js +176 -31
  85. package/dist/node/features/mcp.js +2 -30
  86. package/dist/node/features/models.js +293 -0
  87. package/dist/node/features/plugins.js +2 -30
  88. package/dist/node/features/rules.js +2 -30
  89. package/dist/node/features/skills.js +2 -30
  90. package/dist/node/importers/claude-code.js +10 -38
  91. package/dist/node/importers/cursor.js +15 -43
  92. package/dist/node/importers/opencode.js +16 -44
  93. package/dist/node/importers/rulesync.js +22 -50
  94. package/dist/node/index.js +1710 -538
  95. package/dist/node/sources/git-ref.js +7 -30
  96. package/dist/node/sources/git.js +7 -30
  97. package/dist/node/sources/index.js +337 -39
  98. package/dist/node/sources/local.js +0 -28
  99. package/dist/node/sources/npm-ref.js +0 -28
  100. package/dist/node/sources/npm.js +10 -37
  101. package/dist/node/sources/registry-ref.js +37 -0
  102. package/dist/node/sources/registry.js +355 -0
  103. package/dist/node/targets/additional-targets.js +196 -37
  104. package/dist/node/targets/agents-md.js +5 -33
  105. package/dist/node/targets/base-target.js +0 -28
  106. package/dist/node/targets/claude-code.js +211 -41
  107. package/dist/node/targets/codex-cli.js +7 -35
  108. package/dist/node/targets/copilot.js +202 -41
  109. package/dist/node/targets/cursor.js +188 -40
  110. package/dist/node/targets/gemini-cli.js +10 -38
  111. package/dist/node/targets/generic-md-target.js +196 -37
  112. package/dist/node/targets/index.js +414 -106
  113. package/dist/node/targets/opencode.js +171 -51
  114. package/dist/node/targets/registry.js +414 -106
  115. package/dist/node/utils/credentials.js +38 -0
  116. package/dist/node/utils/diff.js +22 -34
  117. package/dist/node/utils/filesystem.js +2 -30
  118. package/dist/node/utils/frontmatter.js +0 -28
  119. package/dist/node/utils/global.js +3 -31
  120. package/dist/node/utils/markdown.js +0 -28
  121. package/dist/node/utils/model-allowlist.js +110 -0
  122. package/dist/node/utils/model-guidance.js +78 -0
  123. package/dist/node/utils/registry-client.js +142 -0
  124. package/dist/node/utils/tarball.js +49 -0
  125. package/dist/sources/git-ref.js +7 -30
  126. package/dist/sources/git.d.ts +2 -2
  127. package/dist/sources/git.js +7 -30
  128. package/dist/sources/index.d.ts +2 -0
  129. package/dist/sources/index.js +337 -39
  130. package/dist/sources/local.js +0 -28
  131. package/dist/sources/npm-ref.js +0 -28
  132. package/dist/sources/npm.js +10 -37
  133. package/dist/sources/registry-ref.d.ts +30 -0
  134. package/dist/sources/registry-ref.js +37 -0
  135. package/dist/sources/registry.d.ts +18 -0
  136. package/dist/sources/registry.js +355 -0
  137. package/dist/targets/additional-targets.js +196 -37
  138. package/dist/targets/agents-md.js +5 -33
  139. package/dist/targets/base-target.d.ts +2 -0
  140. package/dist/targets/base-target.js +0 -28
  141. package/dist/targets/claude-code.js +211 -41
  142. package/dist/targets/codex-cli.js +7 -35
  143. package/dist/targets/copilot.js +202 -41
  144. package/dist/targets/cursor.js +188 -40
  145. package/dist/targets/gemini-cli.js +10 -38
  146. package/dist/targets/generic-md-target.js +196 -37
  147. package/dist/targets/index.js +414 -106
  148. package/dist/targets/opencode.js +171 -51
  149. package/dist/targets/registry.js +414 -106
  150. package/dist/utils/credentials.d.ts +19 -0
  151. package/dist/utils/credentials.js +38 -0
  152. package/dist/utils/diff.js +22 -34
  153. package/dist/utils/filesystem.js +2 -30
  154. package/dist/utils/frontmatter.js +0 -28
  155. package/dist/utils/global.js +3 -31
  156. package/dist/utils/markdown.js +0 -28
  157. package/dist/utils/model-allowlist.d.ts +39 -0
  158. package/dist/utils/model-allowlist.js +110 -0
  159. package/dist/utils/model-guidance.d.ts +6 -0
  160. package/dist/utils/model-guidance.js +78 -0
  161. package/dist/utils/registry-client.d.ts +141 -0
  162. package/dist/utils/registry-client.js +142 -0
  163. package/dist/utils/tarball.d.ts +13 -0
  164. package/dist/utils/tarball.js +49 -0
  165. package/package.json +171 -5
  166. package/templates/pack/models.json +38 -0
package/README.md CHANGED
@@ -3,11 +3,11 @@
3
3
  [![npm version](https://img.shields.io/npm/v/agentpacks.svg)](https://www.npmjs.com/package/agentpacks)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/agentpacks.svg)](https://www.npmjs.com/package/agentpacks)
5
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-247%20passing-brightgreen.svg)](https://github.com/lssm-tech/contractspec/tree/main/packages/tools/agentpacks)
6
+ [![Tests](https://img.shields.io/badge/tests-378%20passing-brightgreen.svg)](https://github.com/lssm-tech/contractspec/tree/main/packages/tools/agentpacks)
7
7
 
8
8
  **Composable AI agent configuration manager.**
9
9
 
10
- Write your rules, commands, skills, hooks, and MCP configs once — in a pack — and sync them automatically to OpenCode, Cursor, Claude Code, Codex CLI, Gemini CLI, GitHub Copilot, and 13 more tools.
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 13 more tools. Discover and share packs via the **agentpacks registry**.
11
11
 
12
12
  ---
13
13
 
@@ -40,7 +40,9 @@ AI coding tools are proliferating fast. Every tool has its own config format:
40
40
  | | agentpacks | rulesync |
41
41
  | -------------------- | --------------------------------------- | ------------- |
42
42
  | Architecture | Composable packs | Flat files |
43
- | Pack distribution | npm, git, local | Local only |
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 |
44
46
  | OpenCode plugins | Per-pack `.ts` plugin files | Not supported |
45
47
  | Cursor plugin export | Native plugin format | Not supported |
46
48
  | Import from tools | Cursor, Claude Code, OpenCode, rulesync | — |
@@ -127,7 +129,7 @@ This reads your `.rulesync/` directory and `rulesync.jsonc`, and creates an equi
127
129
 
128
130
  ## Features
129
131
 
130
- agentpacks supports 8 feature types inside a pack:
132
+ agentpacks supports 9 feature types inside a pack:
131
133
 
132
134
  | Feature | Description | Example files |
133
135
  | ------------ | ---------------------------------------------------- | ------------------------------------------- |
@@ -138,6 +140,7 @@ agentpacks supports 8 feature types inside a pack:
138
140
  | **hooks** | Shell commands triggered by agent events | `hooks.json` |
139
141
  | **plugins** | Raw TypeScript plugin files (OpenCode) | `plugins/my-plugin.ts` |
140
142
  | **mcp** | MCP server definitions | `mcp.json` |
143
+ | **models** | Model preferences, profiles, and per-agent overrides | `models.json` |
141
144
  | **ignore** | Patterns the agent should ignore | `ignore` |
142
145
 
143
146
  ---
@@ -164,6 +167,7 @@ agentpacks generate [options]
164
167
  Options:
165
168
  -t, --targets <targets> Comma-separated target IDs, or * for all (default: from config)
166
169
  -f, --features <features> Comma-separated feature IDs, or * for all (default: from config)
170
+ --model-profile <profile> Activate a model profile (e.g. quality, budget, fast)
167
171
  --dry-run Preview changes without writing files
168
172
  --diff Show a diff of what would change
169
173
  -v, --verbose Enable verbose output
@@ -178,13 +182,16 @@ agentpacks generate --targets cursor,claudecode
178
182
 
179
183
  # Preview changes without writing
180
184
  agentpacks generate --dry-run --diff
185
+
186
+ # Generate with the "budget" model profile active
187
+ agentpacks generate --model-profile budget
181
188
  ```
182
189
 
183
190
  ---
184
191
 
185
192
  ### `agentpacks install`
186
193
 
187
- Install remote packs (npm packages or git repos) into the local pack cache.
194
+ Install remote packs (npm packages, git repos, or registry packs) into the local pack cache.
188
195
 
189
196
  ```bash
190
197
  agentpacks install [options]
@@ -305,6 +312,130 @@ agentpacks pack enable my-pack # removes from "disabled" array
305
312
 
306
313
  ---
307
314
 
315
+ ### `agentpacks search <query>`
316
+
317
+ Search the pack registry for packs matching a query.
318
+
319
+ ```bash
320
+ agentpacks search typescript
321
+
322
+ # Filter by target
323
+ agentpacks search react --target cursor
324
+
325
+ # Sort by downloads
326
+ agentpacks search monorepo --sort downloads
327
+ ```
328
+
329
+ ---
330
+
331
+ ### `agentpacks info <pack>`
332
+
333
+ Show detailed information about a registry pack.
334
+
335
+ ```bash
336
+ agentpacks info typescript-best-practices
337
+ ```
338
+
339
+ ---
340
+
341
+ ### `agentpacks publish`
342
+
343
+ Publish the current pack to the registry. Requires authentication.
344
+
345
+ ```bash
346
+ agentpacks login # store your registry token
347
+ agentpacks publish # validate, bundle, and upload
348
+ ```
349
+
350
+ 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.
351
+
352
+ ---
353
+
354
+ ### `agentpacks login`
355
+
356
+ Authenticate with the pack registry.
357
+
358
+ ```bash
359
+ agentpacks login
360
+ ```
361
+
362
+ Stores your token in `~/.config/agentpacks/credentials.json`.
363
+
364
+ ---
365
+
366
+ ## Model Configuration
367
+
368
+ 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.
369
+
370
+ ### models.json
371
+
372
+ Place `models.json` at the root of a pack:
373
+
374
+ ```json
375
+ {
376
+ "default": "anthropic/claude-sonnet-4-20250514",
377
+ "small": "anthropic/claude-haiku-3-5",
378
+ "agents": {
379
+ "code-reviewer": { "model": "anthropic/claude-opus-4-20250514" },
380
+ "quick-fixer": { "model": "anthropic/claude-haiku-3-5" }
381
+ },
382
+ "profiles": {
383
+ "quality": {
384
+ "default": "anthropic/claude-opus-4-20250514",
385
+ "small": "anthropic/claude-sonnet-4-20250514"
386
+ },
387
+ "budget": {
388
+ "default": "anthropic/claude-haiku-3-5",
389
+ "small": "anthropic/claude-haiku-3-5"
390
+ },
391
+ "fast": {
392
+ "default": "anthropic/claude-haiku-3-5"
393
+ }
394
+ },
395
+ "providers": {
396
+ "anthropic": {
397
+ "models": {
398
+ "claude-opus-4-20250514": {
399
+ "options": { "budgetTokens": 10000, "reasoningEffort": "high" }
400
+ }
401
+ }
402
+ }
403
+ }
404
+ }
405
+ ```
406
+
407
+ ### Activating a profile
408
+
409
+ Set `modelProfile` in your workspace config:
410
+
411
+ ```jsonc
412
+ {
413
+ "modelProfile": "quality",
414
+ }
415
+ ```
416
+
417
+ Or override at generate time:
418
+
419
+ ```bash
420
+ agentpacks generate --model-profile budget
421
+ ```
422
+
423
+ ### Per-tool output
424
+
425
+ | Tool | What agentpacks generates |
426
+ | --------------- | ----------------------------------------------------------------------------------------- |
427
+ | **OpenCode** | `model`, `small_model`, `provider.*.models.*.options`, `agent.*.model` in `opencode.json` |
428
+ | **Cursor** | `.cursor/rules/model-config.mdc` — an always-applied guidance rule |
429
+ | **Claude Code** | Model guidance in `CLAUDE.md`, `<!-- model: ... -->` hints in agent files |
430
+ | **Copilot** | Model guidance section in `.github/copilot-instructions.md` |
431
+ | **Others** | Model guidance in their root rule file |
432
+
433
+ ### Security
434
+
435
+ `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.
436
+
437
+ ---
438
+
308
439
  ## Configuration
309
440
 
310
441
  ### Workspace config — `agentpacks.jsonc`
@@ -315,11 +446,12 @@ Created at your project root by `agentpacks init`.
315
446
  {
316
447
  "$schema": "https://unpkg.com/agentpacks/schema.json",
317
448
 
318
- // Packs to load — local paths, npm packages, or git repos
449
+ // Packs to load — local, npm, git, or registry
319
450
  "packs": [
320
451
  "./packs/default",
321
452
  "agentpacks-typescript-rules", // npm package
322
453
  "github:myorg/agent-packs#main/python", // git ref
454
+ "registry:react-patterns", // registry pack
323
455
  ],
324
456
 
325
457
  // Temporarily disable a pack without removing it
@@ -335,9 +467,12 @@ Created at your project root by `agentpacks init`.
335
467
  "copilot",
336
468
  ],
337
469
 
338
- // Which feature types to generate (* = all 8)
470
+ // Which feature types to generate (* = all 9)
339
471
  "features": ["*"],
340
472
 
473
+ // Active model profile (from models.json profiles)
474
+ "modelProfile": "quality",
475
+
341
476
  // Repository mode: "repo" | "monorepo" | "metarepo"
342
477
  "mode": "repo",
343
478
 
@@ -391,6 +526,7 @@ my-pack/
391
526
  │ └── SKILL.md
392
527
  ├── hooks.json
393
528
  ├── mcp.json
529
+ ├── models.json
394
530
  └── ignore
395
531
  ```
396
532
 
@@ -476,7 +612,31 @@ For metarepo setups (a repo of repos), set `mode: "metarepo"` and agentpacks wil
476
612
 
477
613
  ## Pack Distribution
478
614
 
479
- Packs can be shared as:
615
+ Packs can be shared via four sources:
616
+
617
+ ### agentpacks registry
618
+
619
+ The official pack registry at [agentpacks.dev](https://agentpacks.dev) — search, publish, and install community packs.
620
+
621
+ ```bash
622
+ # Search for packs
623
+ agentpacks search typescript
624
+
625
+ # View pack details
626
+ agentpacks info typescript-best-practices
627
+
628
+ # Install from registry
629
+ agentpacks install
630
+ ```
631
+
632
+ ```jsonc
633
+ {
634
+ "packs": [
635
+ "registry:typescript-best-practices",
636
+ "registry:react-patterns@1.2.0", // pinned version
637
+ ],
638
+ }
639
+ ```
480
640
 
481
641
  ### npm packages
482
642
 
package/dist/api.d.ts CHANGED
@@ -18,9 +18,11 @@ export { PackLoader, type LoadedPack } from './core/pack-loader.js';
18
18
  export { FeatureMerger, type MergedFeatures } from './core/feature-merger.js';
19
19
  export { type Lockfile, loadLockfile, saveLockfile, computeIntegrity, } from './core/lockfile.js';
20
20
  export { type DependencyResolution, resolveDependencies, } from './core/dependency-resolver.js';
21
+ export { type ResolvedModels, resolveModels, resolveAgentModel, } from './core/profile-resolver.js';
21
22
  export { isLocalPackRef, resolveLocalPack } from './sources/local.js';
22
23
  export { isGitPackRef, parseGitSourceRef, type GitSourceRef, } from './sources/git-ref.js';
23
24
  export { isNpmPackRef, parseNpmSourceRef, type NpmSourceRef, } from './sources/npm-ref.js';
25
+ export { isRegistryPackRef, parseRegistrySourceRef, registrySourceKey, type RegistrySourceRef, } from './sources/registry-ref.js';
24
26
  export { installGitSource } from './sources/git.js';
25
27
  export { installNpmSource } from './sources/npm.js';
26
28
  export { type BaseTarget } from './targets/base-target.js';