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,147 +1,5 @@
1
1
  // @bun
2
- var __require = import.meta.require;
3
-
4
- // src/utils/filesystem.ts
5
- import {
6
- existsSync,
7
- mkdirSync,
8
- readdirSync,
9
- readFileSync,
10
- rmSync,
11
- statSync,
12
- writeFileSync
13
- } from "fs";
14
- import { dirname, join, relative } from "path";
15
- var GENERATED_HEADER_MD = "<!-- Generated by agentpacks. DO NOT EDIT. -->";
16
- var GENERATED_HEADER_JSON = "// Generated by agentpacks. DO NOT EDIT.";
17
- var GENERATED_HEADER_JS = "// Generated by agentpacks. DO NOT EDIT.";
18
- function writeGeneratedFile(filepath, content, options = {}) {
19
- const { header = true, type } = options;
20
- const ext = type ?? inferFileType(filepath);
21
- ensureDir(dirname(filepath));
22
- let output = content;
23
- if (header) {
24
- const headerComment = getHeader(ext);
25
- if (headerComment) {
26
- output = `${headerComment}
27
- ${content}`;
28
- }
29
- }
30
- writeFileSync(filepath, output, "utf-8");
31
- }
32
- function writeGeneratedJson(filepath, data, options = {}) {
33
- const json = JSON.stringify(data, null, 2);
34
- writeGeneratedFile(filepath, json + `
35
- `, { ...options, type: "json" });
36
- }
37
- function readFileOrNull(filepath) {
38
- if (!existsSync(filepath))
39
- return null;
40
- return readFileSync(filepath, "utf-8");
41
- }
42
- function readJsonOrNull(filepath) {
43
- const content = readFileOrNull(filepath);
44
- if (content === null)
45
- return null;
46
- return JSON.parse(content);
47
- }
48
- function ensureDir(dirPath) {
49
- if (!existsSync(dirPath)) {
50
- mkdirSync(dirPath, { recursive: true });
51
- }
52
- }
53
- function removeIfExists(targetPath) {
54
- if (existsSync(targetPath)) {
55
- rmSync(targetPath, { recursive: true, force: true });
56
- }
57
- }
58
- function listFiles(dirPath, options = {}) {
59
- const { extension, recursive = false } = options;
60
- if (!existsSync(dirPath))
61
- return [];
62
- const results = [];
63
- const entries = readdirSync(dirPath);
64
- for (const entry of entries) {
65
- const fullPath = join(dirPath, entry);
66
- const stat = statSync(fullPath);
67
- if (stat.isDirectory() && recursive) {
68
- results.push(...listFiles(fullPath, options));
69
- } else if (stat.isFile()) {
70
- if (!extension || entry.endsWith(extension)) {
71
- results.push(fullPath);
72
- }
73
- }
74
- }
75
- return results;
76
- }
77
- function listDirs(dirPath) {
78
- if (!existsSync(dirPath))
79
- return [];
80
- return readdirSync(dirPath).map((entry) => join(dirPath, entry)).filter((fullPath) => statSync(fullPath).isDirectory());
81
- }
82
- function relPath(projectRoot, filepath) {
83
- return relative(projectRoot, filepath);
84
- }
85
- function isGeneratedFile(filepath) {
86
- const content = readFileOrNull(filepath);
87
- if (!content)
88
- return false;
89
- return content.startsWith(GENERATED_HEADER_MD) || content.startsWith(GENERATED_HEADER_JSON) || content.startsWith(GENERATED_HEADER_JS);
90
- }
91
- function inferFileType(filepath) {
92
- if (filepath.endsWith(".json") || filepath.endsWith(".jsonc"))
93
- return "json";
94
- if (filepath.endsWith(".ts") || filepath.endsWith(".mts"))
95
- return "ts";
96
- if (filepath.endsWith(".js") || filepath.endsWith(".mjs"))
97
- return "js";
98
- return "md";
99
- }
100
- function getHeader(type) {
101
- switch (type) {
102
- case "md":
103
- return GENERATED_HEADER_MD;
104
- case "json":
105
- return GENERATED_HEADER_JSON;
106
- case "js":
107
- case "ts":
108
- return GENERATED_HEADER_JS;
109
- default:
110
- return null;
111
- }
112
- }
113
-
114
- // src/cli/pack/create.ts
115
- import chalk from "chalk";
116
- import { existsSync as existsSync2, writeFileSync as writeFileSync2 } from "fs";
117
- import { join as join2, resolve } from "path";
118
- function runPackCreate(projectRoot, name) {
119
- const packDir = resolve(projectRoot, "packs", name);
120
- if (existsSync2(packDir)) {
121
- console.log(chalk.red(`Pack "${name}" already exists at packs/${name}/`));
122
- return;
123
- }
124
- ensureDir(packDir);
125
- ensureDir(join2(packDir, "rules"));
126
- ensureDir(join2(packDir, "commands"));
127
- ensureDir(join2(packDir, "agents"));
128
- ensureDir(join2(packDir, "skills"));
129
- const packJson = {
130
- name,
131
- version: "1.0.0",
132
- description: "",
133
- tags: [],
134
- dependencies: [],
135
- conflicts: [],
136
- targets: "*",
137
- features: "*"
138
- };
139
- writeFileSync2(join2(packDir, "pack.json"), JSON.stringify(packJson, null, 2) + `
140
- `);
141
- console.log(chalk.green(`Created pack "${name}" at packs/${name}/`));
142
- console.log(chalk.dim(" Add rules, commands, agents, skills, hooks, plugins, mcp.json, or ignore files."));
143
- console.log(chalk.dim(` Then add "${join2("./packs", name)}" to packs[] in agentpacks.jsonc.`));
144
- }
145
- export {
146
- runPackCreate
147
- };
2
+ var S=import.meta.require;import{existsSync as W,mkdirSync as J,readdirSync as $,readFileSync as g,rmSync as G,statSync as b,writeFileSync as H}from"fs";import{dirname as T,join as M,relative as F}from"path";var v="<!-- Generated by agentpacks. DO NOT EDIT. -->",w="// Generated by agentpacks. DO NOT EDIT.",C="// Generated by agentpacks. DO NOT EDIT.";function x(q,z,B={}){let{header:I=!0,type:U}=B,Y=U??A(q);K(T(q));let V=z;if(I){let L=_(Y);if(L)V=`${L}
3
+ ${z}`}H(q,V,"utf-8")}function P(q,z,B={}){let I=JSON.stringify(z,null,2);x(q,I+`
4
+ `,{...B,type:"json"})}function O(q){if(!W(q))return null;return g(q,"utf-8")}function D(q){let z=O(q);if(z===null)return null;return JSON.parse(z)}function K(q){if(!W(q))J(q,{recursive:!0})}function E(q){if(W(q))G(q,{recursive:!0,force:!0})}function N(q,z={}){let{extension:B,recursive:I=!1}=z;if(!W(q))return[];let U=[],Y=$(q);for(let V of Y){let L=M(q,V),Z=b(L);if(Z.isDirectory()&&I)U.push(...N(L,z));else if(Z.isFile()){if(!B||V.endsWith(B))U.push(L)}}return U}function d(q){if(!W(q))return[];return $(q).map((z)=>M(q,z)).filter((z)=>b(z).isDirectory())}function f(q,z){return F(q,z)}function c(q){let z=O(q);if(!z)return!1;return z.startsWith(v)||z.startsWith(w)||z.startsWith(C)}function A(q){if(q.endsWith(".json")||q.endsWith(".jsonc"))return"json";if(q.endsWith(".ts")||q.endsWith(".mts"))return"ts";if(q.endsWith(".js")||q.endsWith(".mjs"))return"js";return"md"}function _(q){switch(q){case"md":return v;case"json":return w;case"js":case"ts":return C;default:return null}}import X from"chalk";import{existsSync as j,writeFileSync as R}from"fs";import{join as Q,resolve as k}from"path";function r(q,z){let B=k(q,"packs",z);if(j(B)){console.log(X.red(`Pack "${z}" already exists at packs/${z}/`));return}K(B),K(Q(B,"rules")),K(Q(B,"commands")),K(Q(B,"agents")),K(Q(B,"skills"));let I={name:z,version:"1.0.0",description:"",tags:[],dependencies:[],conflicts:[],targets:"*",features:"*"};R(Q(B,"pack.json"),JSON.stringify(I,null,2)+`
5
+ `),console.log(X.green(`Created pack "${z}" at packs/${z}/`)),console.log(X.dim(" Add rules, commands, agents, skills, hooks, plugins, mcp.json, or ignore files.")),console.log(X.dim(` Then add "${Q("./packs",z)}" to packs[] in agentpacks.jsonc.`))}export{r as runPackCreate};
@@ -1,68 +1,5 @@
1
1
  // @bun
2
- var __require = import.meta.require;
3
-
4
- // src/cli/pack/enable.ts
5
- import chalk from "chalk";
6
- import { existsSync, readFileSync, writeFileSync } from "fs";
7
- import { resolve } from "path";
8
- var CONFIG_FILENAME = "agentpacks.jsonc";
9
- function readConfigRaw(projectRoot) {
10
- const filepath = resolve(projectRoot, CONFIG_FILENAME);
11
- if (!existsSync(filepath)) {
12
- throw new Error(`No ${CONFIG_FILENAME} found. Run 'agentpacks init' first.`);
13
- }
14
- return readFileSync(filepath, "utf-8");
15
- }
16
- function parseDisabledFromRaw(raw) {
17
- const regex = /"disabled"\s*:\s*\[([^\]]*)\]/;
18
- const match = regex.exec(raw);
19
- if (!match)
20
- return { list: [], match: null };
21
- const inner = (match[1] ?? "").trim();
22
- if (!inner)
23
- return { list: [], match };
24
- const list = inner.split(",").map((s) => s.trim().replace(/^["']|["']$/g, "")).filter(Boolean);
25
- return { list, match };
26
- }
27
- function writeDisabled(raw, newList, match) {
28
- const formatted = newList.length === 0 ? '"disabled": []' : `"disabled": [${newList.map((n) => `"${n}"`).join(", ")}]`;
29
- if (!match) {
30
- return raw.replace(/("packs"\s*:\s*\[[^\]]*\],?)/, `$1
2
+ var g=import.meta.require;import K from"chalk";import{existsSync as x,readFileSync as u,writeFileSync as V}from"fs";import{resolve as U}from"path";var Q="agentpacks.jsonc";function W(B){let q=U(B,Q);if(!x(q))throw Error(`No ${Q} found. Run 'agentpacks init' first.`);return u(q,"utf-8")}function X(B){let z=/"disabled"\s*:\s*\[([^\]]*)\]/.exec(B);if(!z)return{list:[],match:null};let H=(z[1]??"").trim();if(!H)return{list:[],match:z};return{list:H.split(",").map((P)=>P.trim().replace(/^["']|["']$/g,"")).filter(Boolean),match:z}}function Y(B,q,z){let H=q.length===0?'"disabled": []':`"disabled": [${q.map((J)=>`"${J}"`).join(", ")}]`;if(!z)return B.replace(/("packs"\s*:\s*\[[^\]]*\],?)/,`$1
31
3
 
32
4
  // Packs to disable (override)
33
- ${formatted},`);
34
- }
35
- return raw.slice(0, match.index) + formatted + raw.slice(match.index + match[0].length);
36
- }
37
- function runPackDisable(projectRoot, packName) {
38
- const raw = readConfigRaw(projectRoot);
39
- const { list, match } = parseDisabledFromRaw(raw);
40
- if (list.includes(packName)) {
41
- console.log(chalk.dim(`Pack "${packName}" is already disabled.`));
42
- return;
43
- }
44
- list.push(packName);
45
- const updated = writeDisabled(raw, list, match);
46
- const filepath = resolve(projectRoot, CONFIG_FILENAME);
47
- writeFileSync(filepath, updated);
48
- console.log(chalk.green(`Disabled pack "${packName}".`));
49
- console.log(chalk.dim("Run 'agentpacks generate' to regenerate configs."));
50
- }
51
- function runPackEnable(projectRoot, packName) {
52
- const raw = readConfigRaw(projectRoot);
53
- const { list, match } = parseDisabledFromRaw(raw);
54
- if (!list.includes(packName)) {
55
- console.log(chalk.dim(`Pack "${packName}" is not disabled.`));
56
- return;
57
- }
58
- const newList = list.filter((n) => n !== packName);
59
- const updated = writeDisabled(raw, newList, match);
60
- const filepath = resolve(projectRoot, CONFIG_FILENAME);
61
- writeFileSync(filepath, updated);
62
- console.log(chalk.green(`Enabled pack "${packName}".`));
63
- console.log(chalk.dim("Run 'agentpacks generate' to regenerate configs."));
64
- }
65
- export {
66
- runPackEnable,
67
- runPackDisable
68
- };
5
+ ${H},`);return B.slice(0,z.index)+H+B.slice(z.index+z[0].length)}function M(B,q){let z=W(B),{list:H,match:J}=X(z);if(H.includes(q)){console.log(K.dim(`Pack "${q}" is already disabled.`));return}H.push(q);let P=Y(z,H,J),T=U(B,Q);V(T,P),console.log(K.green(`Disabled pack "${q}".`)),console.log(K.dim("Run 'agentpacks generate' to regenerate configs."))}function O(B,q){let z=W(B),{list:H,match:J}=X(z);if(!H.includes(q)){console.log(K.dim(`Pack "${q}" is not disabled.`));return}let P=H.filter(($)=>$!==q),T=Y(z,P,J),Z=U(B,Q);V(Z,T),console.log(K.green(`Enabled pack "${q}".`)),console.log(K.dim("Run 'agentpacks generate' to regenerate configs."))}export{O as runPackEnable,M as runPackDisable};