agentpacks 1.7.13 → 1.8.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 (147) hide show
  1. package/dist/api.js +48 -3658
  2. package/dist/cli/export-cmd.js +7 -1027
  3. package/dist/cli/generate.js +39 -2731
  4. package/dist/cli/import-cmd.js +19 -770
  5. package/dist/cli/info.js +4 -231
  6. package/dist/cli/init.js +9 -185
  7. package/dist/cli/install.js +4 -902
  8. package/dist/cli/login.js +6 -201
  9. package/dist/cli/models-explain.js +14 -1266
  10. package/dist/cli/pack/create.js +4 -146
  11. package/dist/cli/pack/enable.js +2 -65
  12. package/dist/cli/pack/list.js +5 -893
  13. package/dist/cli/pack/validate.js +4 -642
  14. package/dist/cli/publish.js +8 -679
  15. package/dist/cli/search.js +4 -209
  16. package/dist/core/config.d.ts +1 -1
  17. package/dist/core/config.js +1 -145
  18. package/dist/core/dependency-resolver.js +1 -126
  19. package/dist/core/feature-merger.js +3 -398
  20. package/dist/core/index.js +5 -1129
  21. package/dist/core/lockfile.js +2 -43
  22. package/dist/core/metarepo.js +1 -183
  23. package/dist/core/pack-loader.js +4 -841
  24. package/dist/core/profile-resolver.js +1 -110
  25. package/dist/exporters/cursor-plugin.js +6 -404
  26. package/dist/exporters/index.js +6 -404
  27. package/dist/features/agents.js +3 -161
  28. package/dist/features/commands.js +3 -161
  29. package/dist/features/hooks.js +3 -153
  30. package/dist/features/ignore.js +2 -43
  31. package/dist/features/index.js +4 -629
  32. package/dist/features/mcp.js +3 -143
  33. package/dist/features/models.js +3 -292
  34. package/dist/features/plugins.js +3 -139
  35. package/dist/features/rules.d.ts +0 -1
  36. package/dist/features/rules.js +3 -169
  37. package/dist/features/skills.js +3 -228
  38. package/dist/importers/claude-code.js +6 -195
  39. package/dist/importers/cursor.js +5 -355
  40. package/dist/importers/opencode.js +6 -346
  41. package/dist/importers/rulesync.js +5 -365
  42. package/dist/index.js +89 -4934
  43. package/dist/node/api.js +48 -3659
  44. package/dist/node/cli/export-cmd.js +7 -1028
  45. package/dist/node/cli/generate.js +39 -2732
  46. package/dist/node/cli/import-cmd.js +19 -771
  47. package/dist/node/cli/info.js +4 -232
  48. package/dist/node/cli/init.js +9 -186
  49. package/dist/node/cli/install.js +4 -903
  50. package/dist/node/cli/login.js +6 -202
  51. package/dist/node/cli/models-explain.js +14 -1267
  52. package/dist/node/cli/pack/create.js +4 -147
  53. package/dist/node/cli/pack/enable.js +2 -66
  54. package/dist/node/cli/pack/list.js +5 -894
  55. package/dist/node/cli/pack/validate.js +4 -643
  56. package/dist/node/cli/publish.js +8 -680
  57. package/dist/node/cli/search.js +4 -210
  58. package/dist/node/core/config.js +1 -146
  59. package/dist/node/core/dependency-resolver.js +1 -127
  60. package/dist/node/core/feature-merger.js +3 -399
  61. package/dist/node/core/index.js +5 -1130
  62. package/dist/node/core/lockfile.js +2 -44
  63. package/dist/node/core/metarepo.js +1 -184
  64. package/dist/node/core/pack-loader.js +4 -842
  65. package/dist/node/core/profile-resolver.js +1 -111
  66. package/dist/node/exporters/cursor-plugin.js +6 -405
  67. package/dist/node/exporters/index.js +6 -405
  68. package/dist/node/features/agents.js +3 -162
  69. package/dist/node/features/commands.js +3 -162
  70. package/dist/node/features/hooks.js +3 -154
  71. package/dist/node/features/ignore.js +2 -44
  72. package/dist/node/features/index.js +4 -630
  73. package/dist/node/features/mcp.js +3 -144
  74. package/dist/node/features/models.js +3 -293
  75. package/dist/node/features/plugins.js +3 -140
  76. package/dist/node/features/rules.js +3 -170
  77. package/dist/node/features/skills.js +3 -229
  78. package/dist/node/importers/claude-code.js +6 -196
  79. package/dist/node/importers/cursor.js +5 -356
  80. package/dist/node/importers/opencode.js +6 -347
  81. package/dist/node/importers/rulesync.js +5 -366
  82. package/dist/node/index.js +89 -4935
  83. package/dist/node/sources/git-ref.js +1 -56
  84. package/dist/node/sources/git.js +2 -222
  85. package/dist/node/sources/index.js +4 -714
  86. package/dist/node/sources/local.js +1 -24
  87. package/dist/node/sources/npm-ref.js +1 -56
  88. package/dist/node/sources/npm.js +2 -184
  89. package/dist/node/sources/registry-ref.js +1 -37
  90. package/dist/node/sources/registry.js +4 -355
  91. package/dist/node/targets/additional-targets.js +6 -587
  92. package/dist/node/targets/base-target.js +1 -23
  93. package/dist/node/targets/claude-code.js +6 -714
  94. package/dist/node/targets/codex-cli.js +3 -324
  95. package/dist/node/targets/copilot.js +5 -603
  96. package/dist/node/targets/cursor.js +6 -700
  97. package/dist/node/targets/gemini-cli.js +10 -319
  98. package/dist/node/targets/generic-md-target.js +6 -478
  99. package/dist/node/targets/index.js +32 -1873
  100. package/dist/node/targets/mistral-vibe.js +7 -661
  101. package/dist/node/targets/opencode.js +13 -723
  102. package/dist/node/targets/registry.js +32 -1864
  103. package/dist/node/utils/credentials.js +3 -38
  104. package/dist/node/utils/diff.js +5 -132
  105. package/dist/node/utils/filesystem.js +3 -124
  106. package/dist/node/utils/frontmatter.js +1 -24
  107. package/dist/node/utils/global.js +1 -53
  108. package/dist/node/utils/markdown.js +3 -30
  109. package/dist/node/utils/model-allowlist.js +1 -126
  110. package/dist/node/utils/model-guidance.js +2 -78
  111. package/dist/node/utils/registry-client.js +1 -142
  112. package/dist/node/utils/tarball.js +1 -49
  113. package/dist/sources/git-ref.js +1 -55
  114. package/dist/sources/git.js +2 -221
  115. package/dist/sources/index.js +4 -713
  116. package/dist/sources/local.js +1 -23
  117. package/dist/sources/npm-ref.js +1 -55
  118. package/dist/sources/npm.js +2 -183
  119. package/dist/sources/registry-ref.js +1 -36
  120. package/dist/sources/registry.js +4 -354
  121. package/dist/targets/additional-targets.js +6 -586
  122. package/dist/targets/base-target.js +1 -22
  123. package/dist/targets/claude-code.js +6 -713
  124. package/dist/targets/codex-cli.js +3 -323
  125. package/dist/targets/copilot.js +5 -602
  126. package/dist/targets/cursor.js +6 -699
  127. package/dist/targets/gemini-cli.js +10 -318
  128. package/dist/targets/generic-md-target.js +6 -477
  129. package/dist/targets/index.d.ts +0 -1
  130. package/dist/targets/index.js +32 -1872
  131. package/dist/targets/mistral-vibe.js +7 -660
  132. package/dist/targets/opencode.js +13 -722
  133. package/dist/targets/registry.js +32 -1863
  134. package/dist/utils/credentials.js +3 -37
  135. package/dist/utils/diff.js +5 -131
  136. package/dist/utils/filesystem.js +3 -123
  137. package/dist/utils/frontmatter.js +1 -23
  138. package/dist/utils/global.js +1 -52
  139. package/dist/utils/markdown.js +3 -29
  140. package/dist/utils/model-allowlist.js +1 -125
  141. package/dist/utils/model-guidance.js +2 -77
  142. package/dist/utils/registry-client.js +1 -141
  143. package/dist/utils/tarball.js +1 -48
  144. package/package.json +4 -16
  145. package/dist/node/targets/agents-md.js +0 -211
  146. package/dist/targets/agents-md.d.ts +0 -13
  147. package/dist/targets/agents-md.js +0 -211
@@ -1,56 +1 @@
1
- import { createRequire } from "node:module";
2
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
3
-
4
- // src/sources/git-ref.ts
5
- function parseGitSourceRef(source) {
6
- let s = source;
7
- if (s.startsWith("github:")) {
8
- s = s.slice(7);
9
- }
10
- let path = "";
11
- const atIdx = s.indexOf("@");
12
- const colonIdx = s.indexOf(":", atIdx > -1 ? atIdx : 0);
13
- if (colonIdx > -1) {
14
- path = s.slice(colonIdx + 1);
15
- s = s.slice(0, colonIdx);
16
- }
17
- let ref = "main";
18
- if (atIdx > -1) {
19
- ref = s.slice(atIdx + 1);
20
- s = s.slice(0, atIdx);
21
- }
22
- const parts = s.split("/");
23
- if (parts.length < 2) {
24
- throw new Error(`Invalid git source reference: "${source}". Expected owner/repo format.`);
25
- }
26
- const owner = parts[0];
27
- const repo = parts[1];
28
- if (!owner || !repo) {
29
- throw new Error(`Invalid git source reference: "${source}". Expected owner/repo format.`);
30
- }
31
- return {
32
- owner,
33
- repo,
34
- ref,
35
- path: path || ""
36
- };
37
- }
38
- function isGitPackRef(packRef) {
39
- if (packRef.startsWith("github:"))
40
- return true;
41
- if (packRef.startsWith("./") || packRef.startsWith("../") || packRef.startsWith("/")) {
42
- return false;
43
- }
44
- if (packRef.startsWith("@") || packRef.startsWith("npm:"))
45
- return false;
46
- const parts = packRef.split("/");
47
- return parts.length === 2 && !packRef.includes("node_modules");
48
- }
49
- function gitSourceKey(parsed) {
50
- return `${parsed.owner}/${parsed.repo}`;
51
- }
52
- export {
53
- parseGitSourceRef,
54
- isGitPackRef,
55
- gitSourceKey
56
- };
1
+ import{createRequire as D}from"node:module";var F=D(import.meta.url);function H(b){let g=b;if(g.startsWith("github:"))g=g.slice(7);let v="",j=g.indexOf("@"),m=g.indexOf(":",j>-1?j:0);if(m>-1)v=g.slice(m+1),g=g.slice(0,m);let z="main";if(j>-1)z=g.slice(j+1),g=g.slice(0,j);let q=g.split("/");if(q.length<2)throw Error(`Invalid git source reference: "${b}". Expected owner/repo format.`);let A=q[0],C=q[1];if(!A||!C)throw Error(`Invalid git source reference: "${b}". Expected owner/repo format.`);return{owner:A,repo:C,ref:z,path:v||""}}function J(b){if(b.startsWith("github:"))return!0;if(b.startsWith("./")||b.startsWith("../")||b.startsWith("/"))return!1;if(b.startsWith("@")||b.startsWith("npm:"))return!1;return b.split("/").length===2&&!b.includes("node_modules")}function K(b){return`${b.owner}/${b.repo}`}export{H as parseGitSourceRef,J as isGitPackRef,K as gitSourceKey};
@@ -1,222 +1,2 @@
1
- import { createRequire } from "node:module";
2
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
3
-
4
- // src/core/lockfile.ts
5
- import { createHash } from "crypto";
6
- import { existsSync, readFileSync, writeFileSync } from "fs";
7
- import { resolve } from "path";
8
- var LOCKFILE_VERSION = 1;
9
- var LOCKFILE_NAME = "agentpacks.lock";
10
- function loadLockfile(projectRoot) {
11
- const filepath = resolve(projectRoot, LOCKFILE_NAME);
12
- if (!existsSync(filepath)) {
13
- return { lockfileVersion: LOCKFILE_VERSION, sources: {} };
14
- }
15
- const raw = readFileSync(filepath, "utf-8");
16
- return JSON.parse(raw);
17
- }
18
- function saveLockfile(projectRoot, lockfile) {
19
- const filepath = resolve(projectRoot, LOCKFILE_NAME);
20
- writeFileSync(filepath, JSON.stringify(lockfile, null, 2) + `
21
- `);
22
- }
23
- function getLockedSource(lockfile, sourceKey) {
24
- return lockfile.sources[sourceKey];
25
- }
26
- function setLockedSource(lockfile, sourceKey, entry) {
27
- lockfile.sources[sourceKey] = entry;
28
- }
29
- function computeIntegrity(content) {
30
- const hash = createHash("sha256").update(content).digest("hex");
31
- return `sha256-${hash}`;
32
- }
33
- function isLockfileFrozenValid(lockfile, sourceKeys) {
34
- const missing = sourceKeys.filter((key) => !(key in lockfile.sources));
35
- return { valid: missing.length === 0, missing };
36
- }
37
-
38
- // src/sources/git-ref.ts
39
- function parseGitSourceRef(source) {
40
- let s = source;
41
- if (s.startsWith("github:")) {
42
- s = s.slice(7);
43
- }
44
- let path = "";
45
- const atIdx = s.indexOf("@");
46
- const colonIdx = s.indexOf(":", atIdx > -1 ? atIdx : 0);
47
- if (colonIdx > -1) {
48
- path = s.slice(colonIdx + 1);
49
- s = s.slice(0, colonIdx);
50
- }
51
- let ref = "main";
52
- if (atIdx > -1) {
53
- ref = s.slice(atIdx + 1);
54
- s = s.slice(0, atIdx);
55
- }
56
- const parts = s.split("/");
57
- if (parts.length < 2) {
58
- throw new Error(`Invalid git source reference: "${source}". Expected owner/repo format.`);
59
- }
60
- const owner = parts[0];
61
- const repo = parts[1];
62
- if (!owner || !repo) {
63
- throw new Error(`Invalid git source reference: "${source}". Expected owner/repo format.`);
64
- }
65
- return {
66
- owner,
67
- repo,
68
- ref,
69
- path: path || ""
70
- };
71
- }
72
- function isGitPackRef(packRef) {
73
- if (packRef.startsWith("github:"))
74
- return true;
75
- if (packRef.startsWith("./") || packRef.startsWith("../") || packRef.startsWith("/")) {
76
- return false;
77
- }
78
- if (packRef.startsWith("@") || packRef.startsWith("npm:"))
79
- return false;
80
- const parts = packRef.split("/");
81
- return parts.length === 2 && !packRef.includes("node_modules");
82
- }
83
- function gitSourceKey(parsed) {
84
- return `${parsed.owner}/${parsed.repo}`;
85
- }
86
-
87
- // src/sources/git.ts
88
- import { mkdirSync, writeFileSync as writeFileSync2 } from "fs";
89
- import { join, resolve as resolve2 } from "path";
90
- var GITHUB_API = "https://api.github.com";
91
- function githubHeaders(token) {
92
- const h = {
93
- Accept: "application/vnd.github.v3+json",
94
- "User-Agent": "agentpacks"
95
- };
96
- if (token)
97
- h.Authorization = `token ${token}`;
98
- return h;
99
- }
100
- async function resolveGitRef(parsed, token) {
101
- const base = `${GITHUB_API}/repos/${parsed.owner}/${parsed.repo}/git/ref`;
102
- const res = await fetch(`${base}/heads/${parsed.ref}`, {
103
- headers: githubHeaders(token)
104
- });
105
- if (!res.ok) {
106
- const tagRes = await fetch(`${base}/tags/${parsed.ref}`, {
107
- headers: githubHeaders(token)
108
- });
109
- if (!tagRes.ok) {
110
- throw new Error(`Could not resolve ref "${parsed.ref}" for ${parsed.owner}/${parsed.repo}: ${res.status}`);
111
- }
112
- const tagData = await tagRes.json();
113
- return tagData.object.sha;
114
- }
115
- const data = await res.json();
116
- return data.object.sha;
117
- }
118
- async function fetchGitDirectory(parsed, sha, subpath, token) {
119
- const path = parsed.path ? `${parsed.path}/${subpath}` : subpath;
120
- const url = `${GITHUB_API}/repos/${parsed.owner}/${parsed.repo}/contents/${path}?ref=${sha}`;
121
- const res = await fetch(url, { headers: githubHeaders(token) });
122
- if (!res.ok)
123
- return [];
124
- return await res.json();
125
- }
126
- async function fetchGitFile(downloadUrl, token) {
127
- const headers = { "User-Agent": "agentpacks" };
128
- if (token)
129
- headers.Authorization = `token ${token}`;
130
- const res = await fetch(downloadUrl, { headers });
131
- if (!res.ok) {
132
- throw new Error(`Failed to fetch ${downloadUrl}: ${res.status}`);
133
- }
134
- return res.text();
135
- }
136
- async function fetchAndWriteSubdir(parsed, sha, remotePath, localDir, installed, token) {
137
- mkdirSync(localDir, { recursive: true });
138
- const entries = await fetchGitDirectory(parsed, sha, remotePath, token);
139
- for (const entry of entries) {
140
- if (entry.type === "file" && entry.download_url) {
141
- const content = await fetchGitFile(entry.download_url, token);
142
- const filepath = join(localDir, entry.name);
143
- writeFileSync2(filepath, content);
144
- installed.push(filepath);
145
- } else if (entry.type === "dir") {
146
- await fetchAndWriteSubdir(parsed, sha, `${remotePath}/${entry.name}`, join(localDir, entry.name), installed, token);
147
- }
148
- }
149
- }
150
- async function installGitSource(projectRoot, source, lockfile, options = {}) {
151
- const parsed = parseGitSourceRef(source);
152
- const sourceKey = gitSourceKey(parsed);
153
- const installed = [];
154
- const warnings = [];
155
- let resolvedSha;
156
- const locked = getLockedSource(lockfile, sourceKey);
157
- if (options.frozen && !locked) {
158
- throw new Error(`Frozen mode: no lockfile entry for source "${sourceKey}".`);
159
- }
160
- if (locked && !options.update) {
161
- resolvedSha = locked.resolvedRef;
162
- } else {
163
- resolvedSha = await resolveGitRef(parsed, options.token);
164
- }
165
- const basePath = parsed.path || "packs";
166
- const entries = await fetchGitDirectory(parsed, resolvedSha, basePath, options.token);
167
- const curatedDir = resolve2(projectRoot, ".agentpacks", ".curated");
168
- mkdirSync(curatedDir, { recursive: true });
169
- const newLockEntry = {
170
- requestedRef: parsed.ref,
171
- resolvedRef: resolvedSha,
172
- resolvedAt: new Date().toISOString(),
173
- skills: {},
174
- packs: {}
175
- };
176
- const packDirs = entries.filter((e) => e.type === "dir");
177
- for (const packEntry of packDirs) {
178
- const packName = packEntry.name;
179
- const packOutDir = resolve2(curatedDir, packName);
180
- const packFiles = await fetchGitDirectory(parsed, resolvedSha, `${basePath}/${packName}`, options.token);
181
- mkdirSync(packOutDir, { recursive: true });
182
- for (const file of packFiles) {
183
- if (file.type === "file" && file.download_url) {
184
- const content = await fetchGitFile(file.download_url, options.token);
185
- writeFileSync2(join(packOutDir, file.name), content);
186
- installed.push(join(packOutDir, file.name));
187
- if (newLockEntry.packs) {
188
- newLockEntry.packs[packName] = {
189
- integrity: computeIntegrity(content)
190
- };
191
- }
192
- } else if (file.type === "dir") {
193
- await fetchAndWriteSubdir(parsed, resolvedSha, `${basePath}/${packName}/${file.name}`, join(packOutDir, file.name), installed, options.token);
194
- }
195
- }
196
- }
197
- if (packDirs.length === 0) {
198
- const fileEntries = entries.filter((e) => e.type === "file");
199
- if (fileEntries.length > 0) {
200
- const packName = parsed.path.split("/").pop() ?? parsed.repo;
201
- const packOutDir = resolve2(curatedDir, packName);
202
- mkdirSync(packOutDir, { recursive: true });
203
- for (const file of entries) {
204
- if (file.type === "file" && file.download_url) {
205
- const content = await fetchGitFile(file.download_url, options.token);
206
- writeFileSync2(join(packOutDir, file.name), content);
207
- installed.push(join(packOutDir, file.name));
208
- } else if (file.type === "dir") {
209
- await fetchAndWriteSubdir(parsed, resolvedSha, `${basePath}/${file.name}`, join(packOutDir, file.name), installed, options.token);
210
- }
211
- }
212
- }
213
- }
214
- setLockedSource(lockfile, sourceKey, newLockEntry);
215
- return { installed, warnings };
216
- }
217
- export {
218
- resolveGitRef,
219
- installGitSource,
220
- fetchGitFile,
221
- fetchGitDirectory
222
- };
1
+ import{createRequire as y}from"node:module";var l=y(import.meta.url);import{createHash as u}from"crypto";import{existsSync as h,readFileSync as f,writeFileSync as k}from"fs";import{resolve as b}from"path";var d=1,j="agentpacks.lock";function t(q){let z=b(q,j);if(!h(z))return{lockfileVersion:d,sources:{}};let Q=f(z,"utf-8");return JSON.parse(Q)}function o(q,z){let Q=b(q,j);k(Q,JSON.stringify(z,null,2)+`
2
+ `)}function m(q,z){return q.sources[z]}function w(q,z,Q){q.sources[z]=Q}function I(q){return`sha256-${u("sha256").update(q).digest("hex")}`}function r(q,z){let Q=z.filter((J)=>!(J in q.sources));return{valid:Q.length===0,missing:Q}}function D(q){let z=q;if(z.startsWith("github:"))z=z.slice(7);let Q="",J=z.indexOf("@"),X=z.indexOf(":",J>-1?J:0);if(X>-1)Q=z.slice(X+1),z=z.slice(0,X);let Y="main";if(J>-1)Y=z.slice(J+1),z=z.slice(0,J);let Z=z.split("/");if(Z.length<2)throw Error(`Invalid git source reference: "${q}". Expected owner/repo format.`);let $=Z[0],V=Z[1];if(!$||!V)throw Error(`Invalid git source reference: "${q}". Expected owner/repo format.`);return{owner:$,repo:V,ref:Y,path:Q||""}}function qq(q){if(q.startsWith("github:"))return!0;if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/"))return!1;if(q.startsWith("@")||q.startsWith("npm:"))return!1;return q.split("/").length===2&&!q.includes("node_modules")}function S(q){return`${q.owner}/${q.repo}`}import{mkdirSync as H,writeFileSync as P}from"fs";import{join as C,resolve as G}from"path";var R="https://api.github.com";function L(q){let z={Accept:"application/vnd.github.v3+json","User-Agent":"agentpacks"};if(q)z.Authorization=`token ${q}`;return z}async function n(q,z){let Q=`${R}/repos/${q.owner}/${q.repo}/git/ref`,J=await fetch(`${Q}/heads/${q.ref}`,{headers:L(z)});if(!J.ok){let Y=await fetch(`${Q}/tags/${q.ref}`,{headers:L(z)});if(!Y.ok)throw Error(`Could not resolve ref "${q.ref}" for ${q.owner}/${q.repo}: ${J.status}`);return(await Y.json()).object.sha}return(await J.json()).object.sha}async function F(q,z,Q,J){let X=q.path?`${q.path}/${Q}`:Q,Y=`${R}/repos/${q.owner}/${q.repo}/contents/${X}?ref=${z}`,Z=await fetch(Y,{headers:L(J)});if(!Z.ok)return[];return await Z.json()}async function O(q,z){let Q={"User-Agent":"agentpacks"};if(z)Q.Authorization=`token ${z}`;let J=await fetch(q,{headers:Q});if(!J.ok)throw Error(`Failed to fetch ${q}: ${J.status}`);return J.text()}async function g(q,z,Q,J,X,Y){H(J,{recursive:!0});let Z=await F(q,z,Q,Y);for(let $ of Z)if($.type==="file"&&$.download_url){let V=await O($.download_url,Y),_=C(J,$.name);P(_,V),X.push(_)}else if($.type==="dir")await g(q,z,`${Q}/${$.name}`,C(J,$.name),X,Y)}async function Zq(q,z,Q,J={}){let X=D(z),Y=S(X),Z=[],$=[],V,_=m(Q,Y);if(J.frozen&&!_)throw Error(`Frozen mode: no lockfile entry for source "${Y}".`);if(_&&!J.update)V=_.resolvedRef;else V=await n(X,J.token);let U=X.path||"packs",N=await F(X,V,U,J.token),x=G(q,".agentpacks",".curated");H(x,{recursive:!0});let E={requestedRef:X.ref,resolvedRef:V,resolvedAt:new Date().toISOString(),skills:{},packs:{}},K=N.filter((A)=>A.type==="dir");for(let A of K){let W=A.name,B=G(x,W),M=await F(X,V,`${U}/${W}`,J.token);H(B,{recursive:!0});for(let T of M)if(T.type==="file"&&T.download_url){let v=await O(T.download_url,J.token);if(P(C(B,T.name),v),Z.push(C(B,T.name)),E.packs)E.packs[W]={integrity:I(v)}}else if(T.type==="dir")await g(X,V,`${U}/${W}/${T.name}`,C(B,T.name),Z,J.token)}if(K.length===0){if(N.filter((W)=>W.type==="file").length>0){let W=X.path.split("/").pop()??X.repo,B=G(x,W);H(B,{recursive:!0});for(let M of N)if(M.type==="file"&&M.download_url){let T=await O(M.download_url,J.token);P(C(B,M.name),T),Z.push(C(B,M.name))}else if(M.type==="dir")await g(X,V,`${U}/${M.name}`,C(B,M.name),Z,J.token)}}return w(Q,Y,E),{installed:Z,warnings:$}}export{n as resolveGitRef,Zq as installGitSource,O as fetchGitFile,F as fetchGitDirectory};