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.
- package/dist/api.js +48 -3658
- package/dist/cli/export-cmd.js +7 -1027
- package/dist/cli/generate.js +39 -2731
- package/dist/cli/import-cmd.js +19 -770
- package/dist/cli/info.js +4 -231
- package/dist/cli/init.js +9 -185
- package/dist/cli/install.js +4 -902
- package/dist/cli/login.js +6 -201
- package/dist/cli/models-explain.js +14 -1266
- package/dist/cli/pack/create.js +4 -146
- package/dist/cli/pack/enable.js +2 -65
- package/dist/cli/pack/list.js +5 -893
- package/dist/cli/pack/validate.js +4 -642
- package/dist/cli/publish.js +8 -679
- package/dist/cli/search.js +4 -209
- package/dist/core/config.d.ts +1 -1
- package/dist/core/config.js +1 -145
- package/dist/core/dependency-resolver.js +1 -126
- package/dist/core/feature-merger.js +3 -398
- package/dist/core/index.js +5 -1129
- package/dist/core/lockfile.js +2 -43
- package/dist/core/metarepo.js +1 -183
- package/dist/core/pack-loader.js +4 -841
- package/dist/core/profile-resolver.js +1 -110
- package/dist/exporters/cursor-plugin.js +6 -404
- package/dist/exporters/index.js +6 -404
- package/dist/features/agents.js +3 -161
- package/dist/features/commands.js +3 -161
- package/dist/features/hooks.js +3 -153
- package/dist/features/ignore.js +2 -43
- package/dist/features/index.js +4 -629
- package/dist/features/mcp.js +3 -143
- package/dist/features/models.js +3 -292
- package/dist/features/plugins.js +3 -139
- package/dist/features/rules.d.ts +0 -1
- package/dist/features/rules.js +3 -169
- package/dist/features/skills.js +3 -228
- package/dist/importers/claude-code.js +6 -195
- package/dist/importers/cursor.js +5 -355
- package/dist/importers/opencode.js +6 -346
- package/dist/importers/rulesync.js +5 -365
- package/dist/index.js +89 -4934
- package/dist/node/api.js +48 -3659
- package/dist/node/cli/export-cmd.js +7 -1028
- package/dist/node/cli/generate.js +39 -2732
- package/dist/node/cli/import-cmd.js +19 -771
- package/dist/node/cli/info.js +4 -232
- package/dist/node/cli/init.js +9 -186
- package/dist/node/cli/install.js +4 -903
- package/dist/node/cli/login.js +6 -202
- package/dist/node/cli/models-explain.js +14 -1267
- package/dist/node/cli/pack/create.js +4 -147
- package/dist/node/cli/pack/enable.js +2 -66
- package/dist/node/cli/pack/list.js +5 -894
- package/dist/node/cli/pack/validate.js +4 -643
- package/dist/node/cli/publish.js +8 -680
- package/dist/node/cli/search.js +4 -210
- package/dist/node/core/config.js +1 -146
- package/dist/node/core/dependency-resolver.js +1 -127
- package/dist/node/core/feature-merger.js +3 -399
- package/dist/node/core/index.js +5 -1130
- package/dist/node/core/lockfile.js +2 -44
- package/dist/node/core/metarepo.js +1 -184
- package/dist/node/core/pack-loader.js +4 -842
- package/dist/node/core/profile-resolver.js +1 -111
- package/dist/node/exporters/cursor-plugin.js +6 -405
- package/dist/node/exporters/index.js +6 -405
- package/dist/node/features/agents.js +3 -162
- package/dist/node/features/commands.js +3 -162
- package/dist/node/features/hooks.js +3 -154
- package/dist/node/features/ignore.js +2 -44
- package/dist/node/features/index.js +4 -630
- package/dist/node/features/mcp.js +3 -144
- package/dist/node/features/models.js +3 -293
- package/dist/node/features/plugins.js +3 -140
- package/dist/node/features/rules.js +3 -170
- package/dist/node/features/skills.js +3 -229
- package/dist/node/importers/claude-code.js +6 -196
- package/dist/node/importers/cursor.js +5 -356
- package/dist/node/importers/opencode.js +6 -347
- package/dist/node/importers/rulesync.js +5 -366
- package/dist/node/index.js +89 -4935
- package/dist/node/sources/git-ref.js +1 -56
- package/dist/node/sources/git.js +2 -222
- package/dist/node/sources/index.js +4 -714
- package/dist/node/sources/local.js +1 -24
- package/dist/node/sources/npm-ref.js +1 -56
- package/dist/node/sources/npm.js +2 -184
- package/dist/node/sources/registry-ref.js +1 -37
- package/dist/node/sources/registry.js +4 -355
- package/dist/node/targets/additional-targets.js +6 -587
- package/dist/node/targets/base-target.js +1 -23
- package/dist/node/targets/claude-code.js +6 -714
- package/dist/node/targets/codex-cli.js +3 -324
- package/dist/node/targets/copilot.js +5 -603
- package/dist/node/targets/cursor.js +6 -700
- package/dist/node/targets/gemini-cli.js +10 -319
- package/dist/node/targets/generic-md-target.js +6 -478
- package/dist/node/targets/index.js +32 -1873
- package/dist/node/targets/mistral-vibe.js +7 -661
- package/dist/node/targets/opencode.js +13 -723
- package/dist/node/targets/registry.js +32 -1864
- package/dist/node/utils/credentials.js +3 -38
- package/dist/node/utils/diff.js +5 -132
- package/dist/node/utils/filesystem.js +3 -124
- package/dist/node/utils/frontmatter.js +1 -24
- package/dist/node/utils/global.js +1 -53
- package/dist/node/utils/markdown.js +3 -30
- package/dist/node/utils/model-allowlist.js +1 -126
- package/dist/node/utils/model-guidance.js +2 -78
- package/dist/node/utils/registry-client.js +1 -142
- package/dist/node/utils/tarball.js +1 -49
- package/dist/sources/git-ref.js +1 -55
- package/dist/sources/git.js +2 -221
- package/dist/sources/index.js +4 -713
- package/dist/sources/local.js +1 -23
- package/dist/sources/npm-ref.js +1 -55
- package/dist/sources/npm.js +2 -183
- package/dist/sources/registry-ref.js +1 -36
- package/dist/sources/registry.js +4 -354
- package/dist/targets/additional-targets.js +6 -586
- package/dist/targets/base-target.js +1 -22
- package/dist/targets/claude-code.js +6 -713
- package/dist/targets/codex-cli.js +3 -323
- package/dist/targets/copilot.js +5 -602
- package/dist/targets/cursor.js +6 -699
- package/dist/targets/gemini-cli.js +10 -318
- package/dist/targets/generic-md-target.js +6 -477
- package/dist/targets/index.d.ts +0 -1
- package/dist/targets/index.js +32 -1872
- package/dist/targets/mistral-vibe.js +7 -660
- package/dist/targets/opencode.js +13 -722
- package/dist/targets/registry.js +32 -1863
- package/dist/utils/credentials.js +3 -37
- package/dist/utils/diff.js +5 -131
- package/dist/utils/filesystem.js +3 -123
- package/dist/utils/frontmatter.js +1 -23
- package/dist/utils/global.js +1 -52
- package/dist/utils/markdown.js +3 -29
- package/dist/utils/model-allowlist.js +1 -125
- package/dist/utils/model-guidance.js +2 -77
- package/dist/utils/registry-client.js +1 -141
- package/dist/utils/tarball.js +1 -48
- package/package.json +4 -16
- package/dist/node/targets/agents-md.js +0 -211
- package/dist/targets/agents-md.d.ts +0 -13
- package/dist/targets/agents-md.js +0 -211
package/dist/cli/login.js
CHANGED
|
@@ -1,202 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var CONFIG_DIR = join(homedir(), ".config", "agentpacks");
|
|
9
|
-
var CREDENTIALS_FILE = join(CONFIG_DIR, "credentials.json");
|
|
10
|
-
function loadCredentials() {
|
|
11
|
-
if (!existsSync(CREDENTIALS_FILE)) {
|
|
12
|
-
return { registryUrl: "https://registry.agentpacks.dev" };
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
const raw = readFileSync(CREDENTIALS_FILE, "utf-8");
|
|
16
|
-
return JSON.parse(raw);
|
|
17
|
-
} catch {
|
|
18
|
-
return { registryUrl: "https://registry.agentpacks.dev" };
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function saveCredentials(credentials) {
|
|
22
|
-
mkdirSync(dirname(CREDENTIALS_FILE), { recursive: true });
|
|
23
|
-
writeFileSync(CREDENTIALS_FILE, JSON.stringify(credentials, null, 2) + `
|
|
24
|
-
`, {
|
|
25
|
-
mode: 384
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
function clearCredentials() {
|
|
29
|
-
if (existsSync(CREDENTIALS_FILE)) {
|
|
30
|
-
writeFileSync(CREDENTIALS_FILE, JSON.stringify({ registryUrl: "https://registry.agentpacks.dev" }) + `
|
|
31
|
-
`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// src/utils/registry-client.ts
|
|
36
|
-
var DEFAULT_REGISTRY_URL = "https://registry.agentpacks.dev";
|
|
37
|
-
function createRegistryClient(config) {
|
|
38
|
-
return new RegistryClient({
|
|
39
|
-
registryUrl: config?.registryUrl ?? DEFAULT_REGISTRY_URL,
|
|
40
|
-
authToken: config?.authToken,
|
|
41
|
-
timeout: config?.timeout ?? 30000
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
class RegistryClient {
|
|
46
|
-
config;
|
|
47
|
-
constructor(config) {
|
|
48
|
-
this.config = {
|
|
49
|
-
registryUrl: config.registryUrl.replace(/\/+$/, ""),
|
|
50
|
-
authToken: config.authToken,
|
|
51
|
-
timeout: config.timeout ?? 30000
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
async search(params) {
|
|
55
|
-
const searchParams = new URLSearchParams;
|
|
56
|
-
if (params.query)
|
|
57
|
-
searchParams.set("q", params.query);
|
|
58
|
-
if (params.tags?.length)
|
|
59
|
-
searchParams.set("tags", params.tags.join(","));
|
|
60
|
-
if (params.targets?.length)
|
|
61
|
-
searchParams.set("targets", params.targets.join(","));
|
|
62
|
-
if (params.features?.length)
|
|
63
|
-
searchParams.set("features", params.features.join(","));
|
|
64
|
-
if (params.author)
|
|
65
|
-
searchParams.set("author", params.author);
|
|
66
|
-
if (params.sort)
|
|
67
|
-
searchParams.set("sort", params.sort);
|
|
68
|
-
if (params.limit)
|
|
69
|
-
searchParams.set("limit", String(params.limit));
|
|
70
|
-
if (params.offset)
|
|
71
|
-
searchParams.set("offset", String(params.offset));
|
|
72
|
-
const url = `${this.config.registryUrl}/packs?${searchParams.toString()}`;
|
|
73
|
-
const res = await this.fetch(url);
|
|
74
|
-
return res;
|
|
75
|
-
}
|
|
76
|
-
async info(packName) {
|
|
77
|
-
const url = `${this.config.registryUrl}/packs/${encodeURIComponent(packName)}`;
|
|
78
|
-
const res = await this.fetch(url);
|
|
79
|
-
return res;
|
|
80
|
-
}
|
|
81
|
-
async download(packName, version = "latest") {
|
|
82
|
-
const url = `${this.config.registryUrl}/packs/${encodeURIComponent(packName)}/versions/${encodeURIComponent(version)}/download`;
|
|
83
|
-
const response = await fetch(url, {
|
|
84
|
-
headers: this.headers(),
|
|
85
|
-
signal: AbortSignal.timeout(this.config.timeout)
|
|
86
|
-
});
|
|
87
|
-
if (!response.ok) {
|
|
88
|
-
throw new RegistryApiError(response.status, `Failed to download ${packName}@${version}: ${response.statusText}`);
|
|
89
|
-
}
|
|
90
|
-
const integrity = response.headers.get("x-integrity") ?? "";
|
|
91
|
-
const data = await response.arrayBuffer();
|
|
92
|
-
return { data, integrity };
|
|
93
|
-
}
|
|
94
|
-
async publish(tarball, metadata) {
|
|
95
|
-
if (!this.config.authToken) {
|
|
96
|
-
throw new Error("Authentication required. Run `agentpacks login` first.");
|
|
97
|
-
}
|
|
98
|
-
const formData = new FormData;
|
|
99
|
-
formData.append("tarball", new Blob([tarball], { type: "application/gzip" }), `${metadata.name}-${metadata.version}.tgz`);
|
|
100
|
-
formData.append("metadata", JSON.stringify(metadata));
|
|
101
|
-
const url = `${this.config.registryUrl}/packs`;
|
|
102
|
-
const response = await fetch(url, {
|
|
103
|
-
method: "POST",
|
|
104
|
-
headers: {
|
|
105
|
-
Authorization: `Bearer ${this.config.authToken}`
|
|
106
|
-
},
|
|
107
|
-
body: formData,
|
|
108
|
-
signal: AbortSignal.timeout(this.config.timeout)
|
|
109
|
-
});
|
|
110
|
-
if (!response.ok) {
|
|
111
|
-
const body = await response.text();
|
|
112
|
-
throw new RegistryApiError(response.status, `Publish failed: ${body || response.statusText}`);
|
|
113
|
-
}
|
|
114
|
-
return await response.json();
|
|
115
|
-
}
|
|
116
|
-
async featured(limit) {
|
|
117
|
-
const url = limit ? `${this.config.registryUrl}/featured?limit=${limit}` : `${this.config.registryUrl}/featured`;
|
|
118
|
-
const res = await this.fetch(url);
|
|
119
|
-
return res.packs;
|
|
120
|
-
}
|
|
121
|
-
async tags() {
|
|
122
|
-
const url = `${this.config.registryUrl}/tags`;
|
|
123
|
-
const res = await this.fetch(url);
|
|
124
|
-
return res.tags;
|
|
125
|
-
}
|
|
126
|
-
async stats() {
|
|
127
|
-
const url = `${this.config.registryUrl}/stats`;
|
|
128
|
-
return await this.fetch(url);
|
|
129
|
-
}
|
|
130
|
-
async health() {
|
|
131
|
-
try {
|
|
132
|
-
const url = `${this.config.registryUrl}/health`;
|
|
133
|
-
await this.fetch(url);
|
|
134
|
-
return true;
|
|
135
|
-
} catch {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
async fetch(url) {
|
|
140
|
-
const response = await fetch(url, {
|
|
141
|
-
headers: this.headers(),
|
|
142
|
-
signal: AbortSignal.timeout(this.config.timeout)
|
|
143
|
-
});
|
|
144
|
-
if (!response.ok) {
|
|
145
|
-
const body = await response.text();
|
|
146
|
-
throw new RegistryApiError(response.status, body || response.statusText);
|
|
147
|
-
}
|
|
148
|
-
return response.json();
|
|
149
|
-
}
|
|
150
|
-
headers() {
|
|
151
|
-
const h = {
|
|
152
|
-
Accept: "application/json"
|
|
153
|
-
};
|
|
154
|
-
if (this.config.authToken) {
|
|
155
|
-
h["Authorization"] = `Bearer ${this.config.authToken}`;
|
|
156
|
-
}
|
|
157
|
-
return h;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
class RegistryApiError extends Error {
|
|
162
|
-
status;
|
|
163
|
-
constructor(status, message) {
|
|
164
|
-
super(message);
|
|
165
|
-
this.name = "RegistryApiError";
|
|
166
|
-
this.status = status;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// src/cli/login.ts
|
|
171
|
-
import chalk from "chalk";
|
|
172
|
-
async function runLogin(options) {
|
|
173
|
-
const registryUrl = options.registry ?? "https://registry.agentpacks.dev";
|
|
174
|
-
if (!options.token) {
|
|
175
|
-
console.log(chalk.bold(`agentpacks login
|
|
176
|
-
`));
|
|
177
|
-
console.log("To authenticate, you need an API token.");
|
|
178
|
-
console.log(`Get one at: ${chalk.cyan(`${registryUrl}/account/tokens`)}
|
|
179
|
-
`);
|
|
180
|
-
console.log("Then run:");
|
|
181
|
-
console.log(chalk.dim(` agentpacks login --token <your-token>
|
|
182
|
-
`));
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
const client = createRegistryClient({
|
|
186
|
-
registryUrl,
|
|
187
|
-
authToken: options.token
|
|
188
|
-
});
|
|
189
|
-
const healthy = await client.health();
|
|
190
|
-
if (!healthy) {
|
|
191
|
-
console.log(chalk.yellow(`Warning: Could not reach registry at ${registryUrl}`));
|
|
192
|
-
}
|
|
193
|
-
saveCredentials({
|
|
194
|
-
registryUrl,
|
|
195
|
-
token: options.token
|
|
196
|
-
});
|
|
197
|
-
console.log(chalk.green(`Authenticated with ${registryUrl}`));
|
|
198
|
-
console.log(chalk.dim("Credentials saved to ~/.config/agentpacks/credentials.json"));
|
|
199
|
-
}
|
|
200
|
-
export {
|
|
201
|
-
runLogin
|
|
202
|
-
};
|
|
2
|
+
var w=import.meta.require;import{existsSync as Y,mkdirSync as V,readFileSync as x,writeFileSync as Z}from"fs";import{homedir as b}from"os";import{dirname as j,join as $}from"path";var U=$(b(),".config","agentpacks"),M=$(U,"credentials.json");function F(){if(!Y(M))return{registryUrl:"https://registry.agentpacks.dev"};try{let q=x(M,"utf-8");return JSON.parse(q)}catch{return{registryUrl:"https://registry.agentpacks.dev"}}}function G(q){V(j(M),{recursive:!0}),Z(M,JSON.stringify(q,null,2)+`
|
|
3
|
+
`,{mode:384})}function P(){if(Y(M))Z(M,JSON.stringify({registryUrl:"https://registry.agentpacks.dev"})+`
|
|
4
|
+
`)}function H(q){return new O({registryUrl:q?.registryUrl??"https://registry.agentpacks.dev",authToken:q?.authToken,timeout:q?.timeout??30000})}class O{config;constructor(q){this.config={registryUrl:q.registryUrl.replace(/\/+$/,""),authToken:q.authToken,timeout:q.timeout??30000}}async search(q){let z=new URLSearchParams;if(q.query)z.set("q",q.query);if(q.tags?.length)z.set("tags",q.tags.join(","));if(q.targets?.length)z.set("targets",q.targets.join(","));if(q.features?.length)z.set("features",q.features.join(","));if(q.author)z.set("author",q.author);if(q.sort)z.set("sort",q.sort);if(q.limit)z.set("limit",String(q.limit));if(q.offset)z.set("offset",String(q.offset));let B=`${this.config.registryUrl}/packs?${z.toString()}`;return await this.fetch(B)}async info(q){let z=`${this.config.registryUrl}/packs/${encodeURIComponent(q)}`;return await this.fetch(z)}async download(q,z="latest"){let B=`${this.config.registryUrl}/packs/${encodeURIComponent(q)}/versions/${encodeURIComponent(z)}/download`,J=await fetch(B,{headers:this.headers(),signal:AbortSignal.timeout(this.config.timeout)});if(!J.ok)throw new W(J.status,`Failed to download ${q}@${z}: ${J.statusText}`);let K=J.headers.get("x-integrity")??"";return{data:await J.arrayBuffer(),integrity:K}}async publish(q,z){if(!this.config.authToken)throw Error("Authentication required. Run `agentpacks login` first.");let B=new FormData;B.append("tarball",new Blob([q],{type:"application/gzip"}),`${z.name}-${z.version}.tgz`),B.append("metadata",JSON.stringify(z));let J=`${this.config.registryUrl}/packs`,K=await fetch(J,{method:"POST",headers:{Authorization:`Bearer ${this.config.authToken}`},body:B,signal:AbortSignal.timeout(this.config.timeout)});if(!K.ok){let X=await K.text();throw new W(K.status,`Publish failed: ${X||K.statusText}`)}return await K.json()}async featured(q){let z=q?`${this.config.registryUrl}/featured?limit=${q}`:`${this.config.registryUrl}/featured`;return(await this.fetch(z)).packs}async tags(){let q=`${this.config.registryUrl}/tags`;return(await this.fetch(q)).tags}async stats(){let q=`${this.config.registryUrl}/stats`;return await this.fetch(q)}async health(){try{let q=`${this.config.registryUrl}/health`;return await this.fetch(q),!0}catch{return!1}}async fetch(q){let z=await fetch(q,{headers:this.headers(),signal:AbortSignal.timeout(this.config.timeout)});if(!z.ok){let B=await z.text();throw new W(z.status,B||z.statusText)}return z.json()}headers(){let q={Accept:"application/json"};if(this.config.authToken)q.Authorization=`Bearer ${this.config.authToken}`;return q}}class W extends Error{status;constructor(q,z){super(z);this.name="RegistryApiError",this.status=q}}import Q from"chalk";async function I(q){let z=q.registry??"https://registry.agentpacks.dev";if(!q.token){console.log(Q.bold(`agentpacks login
|
|
5
|
+
`)),console.log("To authenticate, you need an API token."),console.log(`Get one at: ${Q.cyan(`${z}/account/tokens`)}
|
|
6
|
+
`),console.log("Then run:"),console.log(Q.dim(` agentpacks login --token <your-token>
|
|
7
|
+
`));return}if(!await H({registryUrl:z,authToken:q.token}).health())console.log(Q.yellow(`Warning: Could not reach registry at ${z}`));G({registryUrl:z,token:q.token}),console.log(Q.green(`Authenticated with ${z}`)),console.log(Q.dim("Credentials saved to ~/.config/agentpacks/credentials.json"))}export{I as runLogin};
|