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
@@ -2,9 +2,9 @@ import { createRequire } from "node:module";
2
2
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
3
3
 
4
4
  // src/utils/credentials.ts
5
- import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
6
- import { join, dirname } from "path";
5
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
7
6
  import { homedir } from "os";
7
+ import { dirname, join } from "path";
8
8
  var CONFIG_DIR = join(homedir(), ".config", "agentpacks");
9
9
  var CREDENTIALS_FILE = join(CONFIG_DIR, "credentials.json");
10
10
  function loadCredentials() {
@@ -5,13 +5,13 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
5
  import {
6
6
  existsSync,
7
7
  mkdirSync,
8
- readFileSync,
9
- writeFileSync,
10
8
  readdirSync,
9
+ readFileSync,
11
10
  rmSync,
12
- statSync
11
+ statSync,
12
+ writeFileSync
13
13
  } from "fs";
14
- import { dirname, relative, join } from "path";
14
+ import { dirname, join, relative } from "path";
15
15
  var GENERATED_HEADER_MD = "<!-- Generated by agentpacks. DO NOT EDIT. -->";
16
16
  var GENERATED_HEADER_JSON = "// Generated by agentpacks. DO NOT EDIT.";
17
17
  var GENERATED_HEADER_JS = "// Generated by agentpacks. DO NOT EDIT.";
@@ -2,9 +2,9 @@ import { createRequire } from "node:module";
2
2
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
3
3
 
4
4
  // src/utils/global.ts
5
+ import { existsSync } from "fs";
5
6
  import { homedir } from "os";
6
7
  import { join, resolve } from "path";
7
- import { existsSync } from "fs";
8
8
  function globalConfigDir() {
9
9
  return resolve(process.env.AGENTPACKS_GLOBAL_DIR ?? join(homedir(), ".agentpacks"));
10
10
  }
@@ -3,10 +3,10 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
3
3
 
4
4
  // src/utils/tarball.ts
5
5
  import { execSync } from "child_process";
6
- import { readFileSync, existsSync, mkdirSync, rmSync } from "fs";
7
- import { join, resolve } from "path";
8
6
  import { createHash } from "crypto";
7
+ import { existsSync, mkdirSync, readFileSync, rmSync } from "fs";
9
8
  import { tmpdir } from "os";
9
+ import { join, resolve } from "path";
10
10
  async function createTarball(packDir) {
11
11
  const absDir = resolve(packDir);
12
12
  const tmpFile = join(tmpdir(), `agentpacks-${Date.now()}.tgz`);
@@ -2,9 +2,9 @@
2
2
  var __require = import.meta.require;
3
3
 
4
4
  // src/core/lockfile.ts
5
+ import { createHash } from "crypto";
5
6
  import { existsSync, readFileSync, writeFileSync } from "fs";
6
7
  import { resolve } from "path";
7
- import { createHash } from "crypto";
8
8
  var LOCKFILE_VERSION = 1;
9
9
  var LOCKFILE_NAME = "agentpacks.lock";
10
10
  function loadLockfile(projectRoot) {
@@ -86,7 +86,7 @@ function gitSourceKey(parsed) {
86
86
 
87
87
  // src/sources/git.ts
88
88
  import { mkdirSync, writeFileSync as writeFileSync2 } from "fs";
89
- import { resolve as resolve2, join } from "path";
89
+ import { join, resolve as resolve2 } from "path";
90
90
  var GITHUB_API = "https://api.github.com";
91
91
  function githubHeaders(token) {
92
92
  const h = {
@@ -1,7 +1,7 @@
1
- export { resolveLocalPack, isLocalPackRef } from './local.js';
2
- export { type GitSourceRef, parseGitSourceRef, isGitPackRef, gitSourceKey, } from './git-ref.js';
3
- export { resolveGitRef, fetchGitDirectory, fetchGitFile, installGitSource, } from './git.js';
4
- export { type NpmSourceRef, parseNpmSourceRef, isNpmPackRef, npmSourceKey, } from './npm-ref.js';
5
- export { resolveNpmVersion, installNpmSource } from './npm.js';
6
- export { type RegistrySourceRef, parseRegistrySourceRef, isRegistryPackRef, registrySourceKey, } from './registry-ref.js';
1
+ export { fetchGitDirectory, fetchGitFile, installGitSource, resolveGitRef, } from './git.js';
2
+ export { type GitSourceRef, gitSourceKey, isGitPackRef, parseGitSourceRef, } from './git-ref.js';
3
+ export { isLocalPackRef, resolveLocalPack } from './local.js';
4
+ export { installNpmSource, resolveNpmVersion } from './npm.js';
5
+ export { isNpmPackRef, type NpmSourceRef, npmSourceKey, parseNpmSourceRef, } from './npm-ref.js';
7
6
  export { installRegistrySource } from './registry.js';
7
+ export { isRegistryPackRef, parseRegistrySourceRef, type RegistrySourceRef, registrySourceKey, } from './registry-ref.js';
@@ -2,9 +2,9 @@
2
2
  var __require = import.meta.require;
3
3
 
4
4
  // src/core/lockfile.ts
5
+ import { createHash } from "crypto";
5
6
  import { existsSync, readFileSync, writeFileSync } from "fs";
6
7
  import { resolve } from "path";
7
- import { createHash } from "crypto";
8
8
  var LOCKFILE_VERSION = 1;
9
9
  var LOCKFILE_NAME = "agentpacks.lock";
10
10
  function loadLockfile(projectRoot) {
@@ -35,24 +35,6 @@ function isLockfileFrozenValid(lockfile, sourceKeys) {
35
35
  return { valid: missing.length === 0, missing };
36
36
  }
37
37
 
38
- // src/sources/local.ts
39
- import { existsSync as existsSync2 } from "fs";
40
- import { resolve as resolve2, isAbsolute } from "path";
41
- function resolveLocalPack(packRef, projectRoot) {
42
- let resolved;
43
- if (isAbsolute(packRef)) {
44
- resolved = packRef;
45
- } else {
46
- resolved = resolve2(projectRoot, packRef);
47
- }
48
- if (!existsSync2(resolved))
49
- return null;
50
- return resolved;
51
- }
52
- function isLocalPackRef(packRef) {
53
- return packRef.startsWith("./") || packRef.startsWith("../") || isAbsolute(packRef);
54
- }
55
-
56
38
  // src/sources/git-ref.ts
57
39
  function parseGitSourceRef(source) {
58
40
  let s = source;
@@ -102,88 +84,9 @@ function gitSourceKey(parsed) {
102
84
  return `${parsed.owner}/${parsed.repo}`;
103
85
  }
104
86
 
105
- // src/sources/npm-ref.ts
106
- function parseNpmSourceRef(source) {
107
- let s = source;
108
- if (s.startsWith("npm:")) {
109
- s = s.slice(4);
110
- }
111
- let path = "";
112
- const pathColonIdx = findPathColon(s);
113
- if (pathColonIdx > -1) {
114
- path = s.slice(pathColonIdx + 1);
115
- s = s.slice(0, pathColonIdx);
116
- }
117
- let version = "latest";
118
- const versionAtIdx = findVersionAt(s);
119
- if (versionAtIdx > -1) {
120
- version = s.slice(versionAtIdx + 1);
121
- s = s.slice(0, versionAtIdx);
122
- }
123
- if (!s) {
124
- throw new Error(`Invalid npm source reference: "${source}". Expected package name.`);
125
- }
126
- return { packageName: s, version, path };
127
- }
128
- function findPathColon(s) {
129
- const startAfter = s.startsWith("@") ? s.indexOf("/") + 1 : 0;
130
- const vAt = findVersionAt(s);
131
- const searchFrom = vAt > -1 ? vAt : startAfter;
132
- return s.indexOf(":", searchFrom);
133
- }
134
- function findVersionAt(s) {
135
- if (s.startsWith("@")) {
136
- const slashIdx = s.indexOf("/");
137
- if (slashIdx === -1)
138
- return -1;
139
- return s.indexOf("@", slashIdx + 1);
140
- }
141
- return s.indexOf("@");
142
- }
143
- function isNpmPackRef(packRef) {
144
- if (packRef.startsWith("npm:"))
145
- return true;
146
- if (packRef.startsWith("@") && packRef.includes("/"))
147
- return true;
148
- return false;
149
- }
150
- function npmSourceKey(parsed) {
151
- return `npm:${parsed.packageName}`;
152
- }
153
-
154
- // src/sources/registry-ref.ts
155
- function parseRegistrySourceRef(source) {
156
- let s = source;
157
- if (s.startsWith("registry:")) {
158
- s = s.slice(9);
159
- }
160
- if (!s) {
161
- throw new Error(`Invalid registry source reference: "${source}". Expected pack name.`);
162
- }
163
- let version = "latest";
164
- const atIdx = s.indexOf("@");
165
- if (atIdx > 0) {
166
- version = s.slice(atIdx + 1);
167
- s = s.slice(0, atIdx);
168
- }
169
- if (!s) {
170
- throw new Error(`Invalid registry source reference: "${source}". Pack name is empty.`);
171
- }
172
- if (!/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(s)) {
173
- throw new Error(`Invalid registry pack name: "${s}". Must be lowercase alphanumeric with hyphens.`);
174
- }
175
- return { packName: s, version };
176
- }
177
- function isRegistryPackRef(packRef) {
178
- return packRef.startsWith("registry:");
179
- }
180
- function registrySourceKey(parsed) {
181
- return `registry:${parsed.packName}`;
182
- }
183
-
184
87
  // src/sources/git.ts
185
88
  import { mkdirSync, writeFileSync as writeFileSync2 } from "fs";
186
- import { resolve as resolve3, join } from "path";
89
+ import { join, resolve as resolve2 } from "path";
187
90
  var GITHUB_API = "https://api.github.com";
188
91
  function githubHeaders(token) {
189
92
  const h = {
@@ -261,7 +164,7 @@ async function installGitSource(projectRoot, source, lockfile, options = {}) {
261
164
  }
262
165
  const basePath = parsed.path || "packs";
263
166
  const entries = await fetchGitDirectory(parsed, resolvedSha, basePath, options.token);
264
- const curatedDir = resolve3(projectRoot, ".agentpacks", ".curated");
167
+ const curatedDir = resolve2(projectRoot, ".agentpacks", ".curated");
265
168
  mkdirSync(curatedDir, { recursive: true });
266
169
  const newLockEntry = {
267
170
  requestedRef: parsed.ref,
@@ -273,7 +176,7 @@ async function installGitSource(projectRoot, source, lockfile, options = {}) {
273
176
  const packDirs = entries.filter((e) => e.type === "dir");
274
177
  for (const packEntry of packDirs) {
275
178
  const packName = packEntry.name;
276
- const packOutDir = resolve3(curatedDir, packName);
179
+ const packOutDir = resolve2(curatedDir, packName);
277
180
  const packFiles = await fetchGitDirectory(parsed, resolvedSha, `${basePath}/${packName}`, options.token);
278
181
  mkdirSync(packOutDir, { recursive: true });
279
182
  for (const file of packFiles) {
@@ -295,7 +198,7 @@ async function installGitSource(projectRoot, source, lockfile, options = {}) {
295
198
  const fileEntries = entries.filter((e) => e.type === "file");
296
199
  if (fileEntries.length > 0) {
297
200
  const packName = parsed.path.split("/").pop() ?? parsed.repo;
298
- const packOutDir = resolve3(curatedDir, packName);
201
+ const packOutDir = resolve2(curatedDir, packName);
299
202
  mkdirSync(packOutDir, { recursive: true });
300
203
  for (const file of entries) {
301
204
  if (file.type === "file" && file.download_url) {
@@ -312,10 +215,77 @@ async function installGitSource(projectRoot, source, lockfile, options = {}) {
312
215
  return { installed, warnings };
313
216
  }
314
217
 
218
+ // src/sources/local.ts
219
+ import { existsSync as existsSync2 } from "fs";
220
+ import { isAbsolute, resolve as resolve3 } from "path";
221
+ function resolveLocalPack(packRef, projectRoot) {
222
+ let resolved;
223
+ if (isAbsolute(packRef)) {
224
+ resolved = packRef;
225
+ } else {
226
+ resolved = resolve3(projectRoot, packRef);
227
+ }
228
+ if (!existsSync2(resolved))
229
+ return null;
230
+ return resolved;
231
+ }
232
+ function isLocalPackRef(packRef) {
233
+ return packRef.startsWith("./") || packRef.startsWith("../") || isAbsolute(packRef);
234
+ }
235
+
236
+ // src/sources/npm-ref.ts
237
+ function parseNpmSourceRef(source) {
238
+ let s = source;
239
+ if (s.startsWith("npm:")) {
240
+ s = s.slice(4);
241
+ }
242
+ let path = "";
243
+ const pathColonIdx = findPathColon(s);
244
+ if (pathColonIdx > -1) {
245
+ path = s.slice(pathColonIdx + 1);
246
+ s = s.slice(0, pathColonIdx);
247
+ }
248
+ let version = "latest";
249
+ const versionAtIdx = findVersionAt(s);
250
+ if (versionAtIdx > -1) {
251
+ version = s.slice(versionAtIdx + 1);
252
+ s = s.slice(0, versionAtIdx);
253
+ }
254
+ if (!s) {
255
+ throw new Error(`Invalid npm source reference: "${source}". Expected package name.`);
256
+ }
257
+ return { packageName: s, version, path };
258
+ }
259
+ function findPathColon(s) {
260
+ const startAfter = s.startsWith("@") ? s.indexOf("/") + 1 : 0;
261
+ const vAt = findVersionAt(s);
262
+ const searchFrom = vAt > -1 ? vAt : startAfter;
263
+ return s.indexOf(":", searchFrom);
264
+ }
265
+ function findVersionAt(s) {
266
+ if (s.startsWith("@")) {
267
+ const slashIdx = s.indexOf("/");
268
+ if (slashIdx === -1)
269
+ return -1;
270
+ return s.indexOf("@", slashIdx + 1);
271
+ }
272
+ return s.indexOf("@");
273
+ }
274
+ function isNpmPackRef(packRef) {
275
+ if (packRef.startsWith("npm:"))
276
+ return true;
277
+ if (packRef.startsWith("@") && packRef.includes("/"))
278
+ return true;
279
+ return false;
280
+ }
281
+ function npmSourceKey(parsed) {
282
+ return `npm:${parsed.packageName}`;
283
+ }
284
+
315
285
  // src/sources/npm.ts
316
- import { mkdirSync as mkdirSync2, existsSync as existsSync3, readdirSync } from "fs";
317
- import { resolve as resolve4, join as join2 } from "path";
318
286
  import { execSync } from "child_process";
287
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readdirSync } from "fs";
288
+ import { join as join2, resolve as resolve4 } from "path";
319
289
  var NPM_REGISTRY = "https://registry.npmjs.org";
320
290
  async function resolveNpmVersion(parsed) {
321
291
  const url = `${NPM_REGISTRY}/${encodeURIComponent(parsed.packageName)}/${parsed.version}`;
@@ -407,6 +377,67 @@ function collectFiles(dir, out) {
407
377
  }
408
378
  }
409
379
 
380
+ // src/sources/registry-ref.ts
381
+ function parseRegistrySourceRef(source) {
382
+ let s = source;
383
+ if (s.startsWith("registry:")) {
384
+ s = s.slice(9);
385
+ }
386
+ if (!s) {
387
+ throw new Error(`Invalid registry source reference: "${source}". Expected pack name.`);
388
+ }
389
+ let version = "latest";
390
+ const atIdx = s.indexOf("@");
391
+ if (atIdx > 0) {
392
+ version = s.slice(atIdx + 1);
393
+ s = s.slice(0, atIdx);
394
+ }
395
+ if (!s) {
396
+ throw new Error(`Invalid registry source reference: "${source}". Pack name is empty.`);
397
+ }
398
+ if (!/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(s)) {
399
+ throw new Error(`Invalid registry pack name: "${s}". Must be lowercase alphanumeric with hyphens.`);
400
+ }
401
+ return { packName: s, version };
402
+ }
403
+ function isRegistryPackRef(packRef) {
404
+ return packRef.startsWith("registry:");
405
+ }
406
+ function registrySourceKey(parsed) {
407
+ return `registry:${parsed.packName}`;
408
+ }
409
+
410
+ // src/utils/credentials.ts
411
+ import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync3 } from "fs";
412
+ import { homedir } from "os";
413
+ import { dirname, join as join3 } from "path";
414
+ var CONFIG_DIR = join3(homedir(), ".config", "agentpacks");
415
+ var CREDENTIALS_FILE = join3(CONFIG_DIR, "credentials.json");
416
+ function loadCredentials() {
417
+ if (!existsSync4(CREDENTIALS_FILE)) {
418
+ return { registryUrl: "https://registry.agentpacks.dev" };
419
+ }
420
+ try {
421
+ const raw = readFileSync2(CREDENTIALS_FILE, "utf-8");
422
+ return JSON.parse(raw);
423
+ } catch {
424
+ return { registryUrl: "https://registry.agentpacks.dev" };
425
+ }
426
+ }
427
+ function saveCredentials(credentials) {
428
+ mkdirSync3(dirname(CREDENTIALS_FILE), { recursive: true });
429
+ writeFileSync3(CREDENTIALS_FILE, JSON.stringify(credentials, null, 2) + `
430
+ `, {
431
+ mode: 384
432
+ });
433
+ }
434
+ function clearCredentials() {
435
+ if (existsSync4(CREDENTIALS_FILE)) {
436
+ writeFileSync3(CREDENTIALS_FILE, JSON.stringify({ registryUrl: "https://registry.agentpacks.dev" }) + `
437
+ `);
438
+ }
439
+ }
440
+
410
441
  // src/utils/registry-client.ts
411
442
  var DEFAULT_REGISTRY_URL = "https://registry.agentpacks.dev";
412
443
  function createRegistryClient(config) {
@@ -542,43 +573,12 @@ class RegistryApiError extends Error {
542
573
  }
543
574
  }
544
575
 
545
- // src/utils/credentials.ts
546
- import { existsSync as existsSync4, readFileSync as readFileSync2, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "fs";
547
- import { join as join3, dirname } from "path";
548
- import { homedir } from "os";
549
- var CONFIG_DIR = join3(homedir(), ".config", "agentpacks");
550
- var CREDENTIALS_FILE = join3(CONFIG_DIR, "credentials.json");
551
- function loadCredentials() {
552
- if (!existsSync4(CREDENTIALS_FILE)) {
553
- return { registryUrl: "https://registry.agentpacks.dev" };
554
- }
555
- try {
556
- const raw = readFileSync2(CREDENTIALS_FILE, "utf-8");
557
- return JSON.parse(raw);
558
- } catch {
559
- return { registryUrl: "https://registry.agentpacks.dev" };
560
- }
561
- }
562
- function saveCredentials(credentials) {
563
- mkdirSync3(dirname(CREDENTIALS_FILE), { recursive: true });
564
- writeFileSync3(CREDENTIALS_FILE, JSON.stringify(credentials, null, 2) + `
565
- `, {
566
- mode: 384
567
- });
568
- }
569
- function clearCredentials() {
570
- if (existsSync4(CREDENTIALS_FILE)) {
571
- writeFileSync3(CREDENTIALS_FILE, JSON.stringify({ registryUrl: "https://registry.agentpacks.dev" }) + `
572
- `);
573
- }
574
- }
575
-
576
576
  // src/utils/tarball.ts
577
577
  import { execSync as execSync2 } from "child_process";
578
- import { readFileSync as readFileSync3, existsSync as existsSync5, mkdirSync as mkdirSync4, rmSync } from "fs";
579
- import { join as join4, resolve as resolve5 } from "path";
580
578
  import { createHash as createHash2 } from "crypto";
579
+ import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync3, rmSync } from "fs";
581
580
  import { tmpdir } from "os";
581
+ import { join as join4, resolve as resolve5 } from "path";
582
582
  async function createTarball(packDir) {
583
583
  const absDir = resolve5(packDir);
584
584
  const tmpFile = join4(tmpdir(), `agentpacks-${Date.now()}.tgz`);
@@ -617,7 +617,7 @@ function computeTarballIntegrity(data) {
617
617
 
618
618
  // src/sources/registry.ts
619
619
  import { existsSync as existsSync6, mkdirSync as mkdirSync5, readdirSync as readdirSync2, rmSync as rmSync2 } from "fs";
620
- import { resolve as resolve6, join as join5 } from "path";
620
+ import { join as join5, resolve as resolve6 } from "path";
621
621
  async function installRegistrySource(projectRoot, source, lockfile, options = {}) {
622
622
  const parsed = parseRegistrySourceRef(source);
623
623
  const sourceKey = registrySourceKey(parsed);
@@ -3,7 +3,7 @@ var __require = import.meta.require;
3
3
 
4
4
  // src/sources/local.ts
5
5
  import { existsSync } from "fs";
6
- import { resolve, isAbsolute } from "path";
6
+ import { isAbsolute, resolve } from "path";
7
7
  function resolveLocalPack(packRef, projectRoot) {
8
8
  let resolved;
9
9
  if (isAbsolute(packRef)) {
@@ -1,3 +1,6 @@
1
+ /**
2
+ * npm pack source — registry fetching and local installation.
3
+ */
1
4
  import { type Lockfile } from '../core/lockfile.js';
2
5
  import { type NpmSourceRef } from './npm-ref.js';
3
6
  /**
@@ -2,9 +2,9 @@
2
2
  var __require = import.meta.require;
3
3
 
4
4
  // src/core/lockfile.ts
5
+ import { createHash } from "crypto";
5
6
  import { existsSync, readFileSync, writeFileSync } from "fs";
6
7
  import { resolve } from "path";
7
- import { createHash } from "crypto";
8
8
  var LOCKFILE_VERSION = 1;
9
9
  var LOCKFILE_NAME = "agentpacks.lock";
10
10
  function loadLockfile(projectRoot) {
@@ -85,9 +85,9 @@ function npmSourceKey(parsed) {
85
85
  }
86
86
 
87
87
  // src/sources/npm.ts
88
- import { mkdirSync, existsSync as existsSync2, readdirSync } from "fs";
89
- import { resolve as resolve2, join } from "path";
90
88
  import { execSync } from "child_process";
89
+ import { existsSync as existsSync2, mkdirSync, readdirSync } from "fs";
90
+ import { join, resolve as resolve2 } from "path";
91
91
  var NPM_REGISTRY = "https://registry.npmjs.org";
92
92
  async function resolveNpmVersion(parsed) {
93
93
  const url = `${NPM_REGISTRY}/${encodeURIComponent(parsed.packageName)}/${parsed.version}`;
@@ -2,9 +2,9 @@
2
2
  var __require = import.meta.require;
3
3
 
4
4
  // src/core/lockfile.ts
5
+ import { createHash } from "crypto";
5
6
  import { existsSync, readFileSync, writeFileSync } from "fs";
6
7
  import { resolve } from "path";
7
- import { createHash } from "crypto";
8
8
  var LOCKFILE_VERSION = 1;
9
9
  var LOCKFILE_NAME = "agentpacks.lock";
10
10
  function loadLockfile(projectRoot) {
@@ -65,6 +65,37 @@ function registrySourceKey(parsed) {
65
65
  return `registry:${parsed.packName}`;
66
66
  }
67
67
 
68
+ // src/utils/credentials.ts
69
+ import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
70
+ import { homedir } from "os";
71
+ import { dirname, join } from "path";
72
+ var CONFIG_DIR = join(homedir(), ".config", "agentpacks");
73
+ var CREDENTIALS_FILE = join(CONFIG_DIR, "credentials.json");
74
+ function loadCredentials() {
75
+ if (!existsSync2(CREDENTIALS_FILE)) {
76
+ return { registryUrl: "https://registry.agentpacks.dev" };
77
+ }
78
+ try {
79
+ const raw = readFileSync2(CREDENTIALS_FILE, "utf-8");
80
+ return JSON.parse(raw);
81
+ } catch {
82
+ return { registryUrl: "https://registry.agentpacks.dev" };
83
+ }
84
+ }
85
+ function saveCredentials(credentials) {
86
+ mkdirSync(dirname(CREDENTIALS_FILE), { recursive: true });
87
+ writeFileSync2(CREDENTIALS_FILE, JSON.stringify(credentials, null, 2) + `
88
+ `, {
89
+ mode: 384
90
+ });
91
+ }
92
+ function clearCredentials() {
93
+ if (existsSync2(CREDENTIALS_FILE)) {
94
+ writeFileSync2(CREDENTIALS_FILE, JSON.stringify({ registryUrl: "https://registry.agentpacks.dev" }) + `
95
+ `);
96
+ }
97
+ }
98
+
68
99
  // src/utils/registry-client.ts
69
100
  var DEFAULT_REGISTRY_URL = "https://registry.agentpacks.dev";
70
101
  function createRegistryClient(config) {
@@ -200,43 +231,12 @@ class RegistryApiError extends Error {
200
231
  }
201
232
  }
202
233
 
203
- // src/utils/credentials.ts
204
- import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync } from "fs";
205
- import { join, dirname } from "path";
206
- import { homedir } from "os";
207
- var CONFIG_DIR = join(homedir(), ".config", "agentpacks");
208
- var CREDENTIALS_FILE = join(CONFIG_DIR, "credentials.json");
209
- function loadCredentials() {
210
- if (!existsSync2(CREDENTIALS_FILE)) {
211
- return { registryUrl: "https://registry.agentpacks.dev" };
212
- }
213
- try {
214
- const raw = readFileSync2(CREDENTIALS_FILE, "utf-8");
215
- return JSON.parse(raw);
216
- } catch {
217
- return { registryUrl: "https://registry.agentpacks.dev" };
218
- }
219
- }
220
- function saveCredentials(credentials) {
221
- mkdirSync(dirname(CREDENTIALS_FILE), { recursive: true });
222
- writeFileSync2(CREDENTIALS_FILE, JSON.stringify(credentials, null, 2) + `
223
- `, {
224
- mode: 384
225
- });
226
- }
227
- function clearCredentials() {
228
- if (existsSync2(CREDENTIALS_FILE)) {
229
- writeFileSync2(CREDENTIALS_FILE, JSON.stringify({ registryUrl: "https://registry.agentpacks.dev" }) + `
230
- `);
231
- }
232
- }
233
-
234
234
  // src/utils/tarball.ts
235
235
  import { execSync } from "child_process";
236
- import { readFileSync as readFileSync3, existsSync as existsSync3, mkdirSync as mkdirSync2, rmSync } from "fs";
237
- import { join as join2, resolve as resolve2 } from "path";
238
236
  import { createHash as createHash2 } from "crypto";
237
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, rmSync } from "fs";
239
238
  import { tmpdir } from "os";
239
+ import { join as join2, resolve as resolve2 } from "path";
240
240
  async function createTarball(packDir) {
241
241
  const absDir = resolve2(packDir);
242
242
  const tmpFile = join2(tmpdir(), `agentpacks-${Date.now()}.tgz`);
@@ -275,7 +275,7 @@ function computeTarballIntegrity(data) {
275
275
 
276
276
  // src/sources/registry.ts
277
277
  import { existsSync as existsSync4, mkdirSync as mkdirSync3, readdirSync, rmSync as rmSync2 } from "fs";
278
- import { resolve as resolve3, join as join3 } from "path";
278
+ import { join as join3, resolve as resolve3 } from "path";
279
279
  async function installRegistrySource(projectRoot, source, lockfile, options = {}) {
280
280
  const parsed = parseRegistrySourceRef(source);
281
281
  const sourceKey = registrySourceKey(parsed);