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.
- package/README.md +69 -742
- package/dist/api.d.ts +15 -15
- package/dist/api.js +2706 -2706
- package/dist/cli/export-cmd.js +364 -364
- package/dist/cli/generate.js +1409 -1409
- package/dist/cli/import-cmd.js +249 -249
- package/dist/cli/info.js +31 -31
- package/dist/cli/init.js +6 -6
- package/dist/cli/install.js +141 -141
- package/dist/cli/login.js +31 -31
- package/dist/cli/models-explain.js +514 -514
- package/dist/cli/pack/create.js +6 -6
- package/dist/cli/pack/enable.js +2 -2
- package/dist/cli/pack/list.js +362 -362
- package/dist/cli/pack/validate.js +119 -119
- package/dist/cli/publish.js +42 -42
- package/dist/cli/search.js +31 -31
- package/dist/core/config.js +3 -3
- package/dist/core/feature-merger.d.ts +5 -5
- package/dist/core/feature-merger.js +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +633 -633
- package/dist/core/lockfile.js +1 -1
- package/dist/core/metarepo.js +3 -3
- package/dist/core/pack-loader.d.ts +6 -6
- package/dist/core/pack-loader.js +362 -362
- package/dist/core/profile-resolver.d.ts +1 -1
- package/dist/exporters/cursor-plugin.d.ts +12 -0
- package/dist/exporters/cursor-plugin.js +46 -46
- package/dist/exporters/index.d.ts +1 -1
- package/dist/exporters/index.js +46 -46
- package/dist/features/agents.js +4 -4
- package/dist/features/commands.js +4 -4
- package/dist/features/hooks.js +4 -4
- package/dist/features/index.d.ts +8 -8
- package/dist/features/index.js +350 -350
- package/dist/features/mcp.js +4 -4
- package/dist/features/models.js +4 -4
- package/dist/features/plugins.js +5 -5
- package/dist/features/rules.js +4 -4
- package/dist/features/skills.js +5 -5
- package/dist/importers/claude-code.js +6 -6
- package/dist/importers/cursor.js +7 -7
- package/dist/importers/opencode.js +7 -7
- package/dist/importers/rulesync.js +7 -7
- package/dist/index.js +2674 -2674
- package/dist/node/api.js +2706 -2706
- package/dist/node/cli/export-cmd.js +364 -364
- package/dist/node/cli/generate.js +1409 -1409
- package/dist/node/cli/import-cmd.js +249 -249
- package/dist/node/cli/info.js +31 -31
- package/dist/node/cli/init.js +6 -6
- package/dist/node/cli/install.js +141 -141
- package/dist/node/cli/login.js +31 -31
- package/dist/node/cli/models-explain.js +514 -514
- package/dist/node/cli/pack/create.js +6 -6
- package/dist/node/cli/pack/enable.js +2 -2
- package/dist/node/cli/pack/list.js +362 -362
- package/dist/node/cli/pack/validate.js +119 -119
- package/dist/node/cli/publish.js +42 -42
- package/dist/node/cli/search.js +31 -31
- package/dist/node/core/config.js +3 -3
- package/dist/node/core/feature-merger.js +4 -4
- package/dist/node/core/index.js +633 -633
- package/dist/node/core/lockfile.js +1 -1
- package/dist/node/core/metarepo.js +3 -3
- package/dist/node/core/pack-loader.js +362 -362
- package/dist/node/exporters/cursor-plugin.js +46 -46
- package/dist/node/exporters/index.js +46 -46
- package/dist/node/features/agents.js +4 -4
- package/dist/node/features/commands.js +4 -4
- package/dist/node/features/hooks.js +4 -4
- package/dist/node/features/index.js +350 -350
- package/dist/node/features/mcp.js +4 -4
- package/dist/node/features/models.js +4 -4
- package/dist/node/features/plugins.js +5 -5
- package/dist/node/features/rules.js +4 -4
- package/dist/node/features/skills.js +5 -5
- package/dist/node/importers/claude-code.js +6 -6
- package/dist/node/importers/cursor.js +7 -7
- package/dist/node/importers/opencode.js +7 -7
- package/dist/node/importers/rulesync.js +7 -7
- package/dist/node/index.js +2674 -2674
- package/dist/node/sources/git.js +2 -2
- package/dist/node/sources/index.js +138 -138
- package/dist/node/sources/local.js +1 -1
- package/dist/node/sources/npm.js +3 -3
- package/dist/node/sources/registry.js +35 -35
- package/dist/node/targets/additional-targets.js +43 -43
- package/dist/node/targets/agents-md.js +4 -4
- package/dist/node/targets/claude-code.js +86 -86
- package/dist/node/targets/codex-cli.js +6 -6
- package/dist/node/targets/copilot.js +46 -46
- package/dist/node/targets/cursor.js +68 -68
- package/dist/node/targets/gemini-cli.js +25 -25
- package/dist/node/targets/generic-md-target.js +43 -43
- package/dist/node/targets/index.js +911 -911
- package/dist/node/targets/mistral-vibe.js +46 -46
- package/dist/node/targets/opencode.js +68 -68
- package/dist/node/targets/registry.js +911 -911
- package/dist/node/utils/credentials.js +2 -2
- package/dist/node/utils/filesystem.js +4 -4
- package/dist/node/utils/global.js +1 -1
- package/dist/node/utils/tarball.js +2 -2
- package/dist/sources/git.js +2 -2
- package/dist/sources/index.d.ts +6 -6
- package/dist/sources/index.js +138 -138
- package/dist/sources/local.js +1 -1
- package/dist/sources/npm.d.ts +3 -0
- package/dist/sources/npm.js +3 -3
- package/dist/sources/registry.js +35 -35
- package/dist/targets/additional-targets.js +43 -43
- package/dist/targets/agents-md.js +4 -4
- package/dist/targets/claude-code.js +86 -86
- package/dist/targets/codex-cli.js +6 -6
- package/dist/targets/copilot.js +46 -46
- package/dist/targets/cursor.js +68 -68
- package/dist/targets/gemini-cli.js +25 -25
- package/dist/targets/generic-md-target.js +43 -43
- package/dist/targets/index.d.ts +6 -6
- package/dist/targets/index.js +911 -911
- package/dist/targets/mistral-vibe.js +46 -46
- package/dist/targets/opencode.js +68 -68
- package/dist/targets/registry.js +911 -911
- package/dist/utils/credentials.js +2 -2
- package/dist/utils/filesystem.js +4 -4
- package/dist/utils/global.d.ts +3 -0
- package/dist/utils/global.js +1 -1
- package/dist/utils/tarball.js +2 -2
- package/package.json +5 -5
- package/templates/pack/models.json +36 -36
- package/templates/pack/pack.json +8 -8
- package/templates/workspace/agentpacks.jsonc +24 -24
package/dist/node/sources/git.js
CHANGED
|
@@ -2,9 +2,9 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
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
|
|
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 = {
|
|
@@ -2,9 +2,9 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
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
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 {
|
|
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 = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
3
3
|
|
|
4
4
|
// src/sources/local.ts
|
|
5
5
|
import { existsSync } from "fs";
|
|
6
|
-
import {
|
|
6
|
+
import { isAbsolute, resolve } from "path";
|
|
7
7
|
function resolveLocalPack(packRef, projectRoot) {
|
|
8
8
|
let resolved;
|
|
9
9
|
if (isAbsolute(packRef)) {
|
package/dist/node/sources/npm.js
CHANGED
|
@@ -2,9 +2,9 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
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 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
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 {
|
|
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);
|
|
@@ -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,
|
|
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.";
|
|
@@ -129,14 +129,14 @@ function serializeFrontmatter(data, content) {
|
|
|
129
129
|
return matter.stringify(content, filtered);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
// src/features/
|
|
132
|
+
// src/features/commands.ts
|
|
133
133
|
import { readFileSync as readFileSync2 } from "fs";
|
|
134
134
|
import { basename } from "path";
|
|
135
|
-
function
|
|
136
|
-
const files = listFiles(
|
|
137
|
-
return files.map((filepath) =>
|
|
135
|
+
function parseCommands(commandsDir, packName) {
|
|
136
|
+
const files = listFiles(commandsDir, { extension: ".md" });
|
|
137
|
+
return files.map((filepath) => parseCommandFile(filepath, packName));
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function parseCommandFile(filepath, packName) {
|
|
140
140
|
const raw = readFileSync2(filepath, "utf-8");
|
|
141
141
|
const { data, content } = parseFrontmatter(raw);
|
|
142
142
|
return {
|
|
@@ -147,29 +147,23 @@ function parseRuleFile(filepath, packName) {
|
|
|
147
147
|
content
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
const { targets } =
|
|
150
|
+
function commandMatchesTarget(cmd, targetId) {
|
|
151
|
+
const { targets } = cmd.meta;
|
|
152
152
|
if (!targets || targets === "*")
|
|
153
153
|
return true;
|
|
154
154
|
if (Array.isArray(targets) && targets.includes("*"))
|
|
155
155
|
return true;
|
|
156
156
|
return Array.isArray(targets) && targets.includes(targetId);
|
|
157
157
|
}
|
|
158
|
-
function getRootRules(rules) {
|
|
159
|
-
return rules.filter((r) => r.meta.root === true);
|
|
160
|
-
}
|
|
161
|
-
function getDetailRules(rules) {
|
|
162
|
-
return rules.filter((r) => r.meta.root !== true);
|
|
163
|
-
}
|
|
164
158
|
|
|
165
|
-
// src/features/
|
|
159
|
+
// src/features/rules.ts
|
|
166
160
|
import { readFileSync as readFileSync3 } from "fs";
|
|
167
161
|
import { basename as basename2 } from "path";
|
|
168
|
-
function
|
|
169
|
-
const files = listFiles(
|
|
170
|
-
return files.map((filepath) =>
|
|
162
|
+
function parseRules(rulesDir, packName) {
|
|
163
|
+
const files = listFiles(rulesDir, { extension: ".md" });
|
|
164
|
+
return files.map((filepath) => parseRuleFile(filepath, packName));
|
|
171
165
|
}
|
|
172
|
-
function
|
|
166
|
+
function parseRuleFile(filepath, packName) {
|
|
173
167
|
const raw = readFileSync3(filepath, "utf-8");
|
|
174
168
|
const { data, content } = parseFrontmatter(raw);
|
|
175
169
|
return {
|
|
@@ -180,14 +174,20 @@ function parseCommandFile(filepath, packName) {
|
|
|
180
174
|
content
|
|
181
175
|
};
|
|
182
176
|
}
|
|
183
|
-
function
|
|
184
|
-
const { targets } =
|
|
177
|
+
function ruleMatchesTarget(rule, targetId) {
|
|
178
|
+
const { targets } = rule.meta;
|
|
185
179
|
if (!targets || targets === "*")
|
|
186
180
|
return true;
|
|
187
181
|
if (Array.isArray(targets) && targets.includes("*"))
|
|
188
182
|
return true;
|
|
189
183
|
return Array.isArray(targets) && targets.includes(targetId);
|
|
190
184
|
}
|
|
185
|
+
function getRootRules(rules) {
|
|
186
|
+
return rules.filter((r) => r.meta.root === true);
|
|
187
|
+
}
|
|
188
|
+
function getDetailRules(rules) {
|
|
189
|
+
return rules.filter((r) => r.meta.root !== true);
|
|
190
|
+
}
|
|
191
191
|
|
|
192
192
|
// src/core/profile-resolver.ts
|
|
193
193
|
function resolveModels(merged, modelProfile, targetId) {
|
|
@@ -293,24 +293,6 @@ function resolveProfileChain(name, profiles, visited, depth) {
|
|
|
293
293
|
};
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
// src/targets/base-target.ts
|
|
297
|
-
class BaseTarget {
|
|
298
|
-
supportsFeature(feature) {
|
|
299
|
-
return this.supportedFeatures.includes(feature);
|
|
300
|
-
}
|
|
301
|
-
getEffectiveFeatures(enabledFeatures) {
|
|
302
|
-
return enabledFeatures.filter((f) => this.supportsFeature(f));
|
|
303
|
-
}
|
|
304
|
-
createResult(filesWritten = [], filesDeleted = [], warnings = []) {
|
|
305
|
-
return {
|
|
306
|
-
targetId: this.id,
|
|
307
|
-
filesWritten,
|
|
308
|
-
filesDeleted,
|
|
309
|
-
warnings
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
296
|
// src/utils/model-guidance.ts
|
|
315
297
|
function generateModelGuidanceMarkdown(resolved) {
|
|
316
298
|
if (!resolved.default && !resolved.small && Object.keys(resolved.agents).length === 0 && Object.keys(resolved.profiles).length === 0) {
|
|
@@ -384,8 +366,26 @@ function generateModelGuidanceMarkdown(resolved) {
|
|
|
384
366
|
`);
|
|
385
367
|
}
|
|
386
368
|
|
|
369
|
+
// src/targets/base-target.ts
|
|
370
|
+
class BaseTarget {
|
|
371
|
+
supportsFeature(feature) {
|
|
372
|
+
return this.supportedFeatures.includes(feature);
|
|
373
|
+
}
|
|
374
|
+
getEffectiveFeatures(enabledFeatures) {
|
|
375
|
+
return enabledFeatures.filter((f) => this.supportsFeature(f));
|
|
376
|
+
}
|
|
377
|
+
createResult(filesWritten = [], filesDeleted = [], warnings = []) {
|
|
378
|
+
return {
|
|
379
|
+
targetId: this.id,
|
|
380
|
+
filesWritten,
|
|
381
|
+
filesDeleted,
|
|
382
|
+
warnings
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
387
|
// src/targets/generic-md-target.ts
|
|
388
|
-
import {
|
|
388
|
+
import { join as join2, resolve } from "path";
|
|
389
389
|
function createGenericMdTarget(config) {
|
|
390
390
|
return new GenericMdTarget(config);
|
|
391
391
|
}
|
|
@@ -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,
|
|
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.";
|