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,38 +1,4 @@
1
1
  // @bun
2
- var __require = import.meta.require;
3
-
4
- // src/utils/credentials.ts
5
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
6
- import { homedir } from "os";
7
- import { dirname, join } from "path";
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
- export {
35
- saveCredentials,
36
- loadCredentials,
37
- clearCredentials
38
- };
2
+ var P=import.meta.require;import{existsSync as q,mkdirSync as B,readFileSync as H,writeFileSync as u}from"fs";import{homedir as J}from"os";import{dirname as K,join as z}from"path";var M=z(J(),".config","agentpacks"),b=z(M,"credentials.json");function X(){if(!q(b))return{registryUrl:"https://registry.agentpacks.dev"};try{let g=H(b,"utf-8");return JSON.parse(g)}catch{return{registryUrl:"https://registry.agentpacks.dev"}}}function Y(g){B(K(b),{recursive:!0}),u(b,JSON.stringify(g,null,2)+`
3
+ `,{mode:384})}function Z(){if(q(b))u(b,JSON.stringify({registryUrl:"https://registry.agentpacks.dev"})+`
4
+ `)}export{Y as saveCredentials,X as loadCredentials,Z as clearCredentials};
@@ -1,132 +1,6 @@
1
1
  // @bun
2
- var __require = import.meta.require;
3
-
4
- // src/utils/diff.ts
5
- import { existsSync, readFileSync } from "fs";
6
- function diffFile(filepath, newContent) {
7
- if (!existsSync(filepath)) {
8
- return {
9
- filepath,
10
- status: "added",
11
- diffLines: formatAddedDiff(filepath, newContent)
12
- };
13
- }
14
- const existing = readFileSync(filepath, "utf-8");
15
- if (existing === newContent) {
16
- return { filepath, status: "unchanged", diffLines: [] };
17
- }
18
- return {
19
- filepath,
20
- status: "modified",
21
- diffLines: computeUnifiedDiff(filepath, existing, newContent)
22
- };
23
- }
24
- function formatAddedDiff(filepath, content) {
25
- const lines = [
26
- `--- /dev/null`,
27
- `+++ ${filepath}`,
28
- `@@ -0,0 +1,${content.split(`
29
- `).length} @@`
30
- ];
31
- for (const line of content.split(`
32
- `)) {
33
- lines.push(`+${line}`);
34
- }
35
- return lines;
36
- }
37
- function computeUnifiedDiff(filepath, oldContent, newContent) {
38
- const oldLines = oldContent.split(`
39
- `);
40
- const newLines = newContent.split(`
41
- `);
42
- const result = [`--- ${filepath}`, `+++ ${filepath}`];
43
- const hunks = findHunks(oldLines, newLines);
44
- for (const hunk of hunks) {
45
- result.push(`@@ -${hunk.oldStart + 1},${hunk.oldCount} +${hunk.newStart + 1},${hunk.newCount} @@`);
46
- for (const line of hunk.lines) {
47
- result.push(line);
48
- }
49
- }
50
- return result;
51
- }
52
- function findHunks(oldLines, newLines) {
53
- const CONTEXT = 3;
54
- const changes = [];
55
- let oi = 0;
56
- let ni = 0;
57
- while (oi < oldLines.length || ni < newLines.length) {
58
- if (oi < oldLines.length && ni < newLines.length && oldLines[oi] === newLines[ni]) {
59
- changes.push({
60
- type: " ",
61
- line: oldLines[oi] ?? "",
62
- oldIdx: oi,
63
- newIdx: ni
64
- });
65
- oi++;
66
- ni++;
67
- } else if (ni < newLines.length && (oi >= oldLines.length || !newLines.slice(ni).includes(oldLines[oi] ?? ""))) {
68
- changes.push({
69
- type: "+",
70
- line: newLines[ni] ?? "",
71
- oldIdx: oi,
72
- newIdx: ni
73
- });
74
- ni++;
75
- } else {
76
- changes.push({
77
- type: "-",
78
- line: oldLines[oi] ?? "",
79
- oldIdx: oi,
80
- newIdx: oi
81
- });
82
- oi++;
83
- }
84
- }
85
- const hunks = [];
86
- let currentHunk = null;
87
- let unchangedCount = 0;
88
- for (const change of changes) {
89
- if (change.type === " ") {
90
- unchangedCount++;
91
- if (currentHunk && unchangedCount <= CONTEXT) {
92
- currentHunk.lines.push(` ${change.line}`);
93
- currentHunk.oldCount++;
94
- currentHunk.newCount++;
95
- } else if (currentHunk && unchangedCount > CONTEXT * 2) {
96
- hunks.push(currentHunk);
97
- currentHunk = null;
98
- }
99
- } else {
100
- if (!currentHunk) {
101
- const contextStart = Math.max(0, changes.indexOf(change) - CONTEXT);
102
- currentHunk = {
103
- oldStart: change.oldIdx - Math.min(CONTEXT, changes.indexOf(change) - contextStart),
104
- oldCount: 0,
105
- newStart: change.newIdx - Math.min(CONTEXT, changes.indexOf(change) - contextStart),
106
- newCount: 0,
107
- lines: []
108
- };
109
- for (let i = contextStart;i < changes.indexOf(change); i++) {
110
- const entry = changes[i];
111
- if (entry?.type === " ") {
112
- currentHunk.lines.push(` ${entry.line}`);
113
- currentHunk.oldCount++;
114
- currentHunk.newCount++;
115
- }
116
- }
117
- }
118
- unchangedCount = 0;
119
- currentHunk.lines.push(`${change.type}${change.line}`);
120
- if (change.type === "-")
121
- currentHunk.oldCount++;
122
- if (change.type === "+")
123
- currentHunk.newCount++;
124
- }
125
- }
126
- if (currentHunk)
127
- hunks.push(currentHunk);
128
- return hunks;
129
- }
130
- export {
131
- diffFile
132
- };
2
+ var V=import.meta.require;import{existsSync as O,readFileSync as P}from"fs";function Y(j,q){if(!O(j))return{filepath:j,status:"added",diffLines:Q(j,q)};let G=P(j,"utf-8");if(G===q)return{filepath:j,status:"unchanged",diffLines:[]};return{filepath:j,status:"modified",diffLines:R(j,G,q)}}function Q(j,q){let G=["--- /dev/null",`+++ ${j}`,`@@ -0,0 +1,${q.split(`
3
+ `).length} @@`];for(let B of q.split(`
4
+ `))G.push(`+${B}`);return G}function R(j,q,G){let B=q.split(`
5
+ `),v=G.split(`
6
+ `),z=[`--- ${j}`,`+++ ${j}`],J=T(B,v);for(let b of J){z.push(`@@ -${b.oldStart+1},${b.oldCount} +${b.newStart+1},${b.newCount} @@`);for(let I of b.lines)z.push(I)}return z}function T(j,q){let B=[],v=0,z=0;while(v<j.length||z<q.length)if(v<j.length&&z<q.length&&j[v]===q[z])B.push({type:" ",line:j[v]??"",oldIdx:v,newIdx:z}),v++,z++;else if(z<q.length&&(v>=j.length||!q.slice(z).includes(j[v]??"")))B.push({type:"+",line:q[z]??"",oldIdx:v,newIdx:z}),z++;else B.push({type:"-",line:j[v]??"",oldIdx:v,newIdx:v}),v++;let J=[],b=null,I=0;for(let E of B)if(E.type===" "){if(I++,b&&I<=3)b.lines.push(` ${E.line}`),b.oldCount++,b.newCount++;else if(b&&I>6)J.push(b),b=null}else{if(!b){let K=Math.max(0,B.indexOf(E)-3);b={oldStart:E.oldIdx-Math.min(3,B.indexOf(E)-K),oldCount:0,newStart:E.newIdx-Math.min(3,B.indexOf(E)-K),newCount:0,lines:[]};for(let M=K;M<B.indexOf(E);M++){let N=B[M];if(N?.type===" ")b.lines.push(` ${N.line}`),b.oldCount++,b.newCount++}}if(I=0,b.lines.push(`${E.type}${E.line}`),E.type==="-")b.oldCount++;if(E.type==="+")b.newCount++}if(b)J.push(b);return J}export{Y as diffFile};
@@ -1,124 +1,4 @@
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
- export {
114
- writeGeneratedJson,
115
- writeGeneratedFile,
116
- removeIfExists,
117
- relPath,
118
- readJsonOrNull,
119
- readFileOrNull,
120
- listFiles,
121
- listDirs,
122
- isGeneratedFile,
123
- ensureDir
124
- };
2
+ var T=import.meta.require;import{existsSync as U,mkdirSync as M,readdirSync as X,readFileSync as k,rmSync as C,statSync as Y,writeFileSync as J}from"fs";import{dirname as O,join as Z,relative as j}from"path";var $="<!-- Generated by agentpacks. DO NOT EDIT. -->",b="// Generated by agentpacks. DO NOT EDIT.",v="// Generated by agentpacks. DO NOT EDIT.";function g(q,z,B={}){let{header:K=!0,type:L}=B,V=L??G(q);m(O(q));let Q=z;if(K){let I=H(V);if(I)Q=`${I}
3
+ ${z}`}J(q,Q,"utf-8")}function _(q,z,B={}){let K=JSON.stringify(z,null,2);g(q,K+`
4
+ `,{...B,type:"json"})}function w(q){if(!U(q))return null;return k(q,"utf-8")}function R(q){let z=w(q);if(z===null)return null;return JSON.parse(z)}function m(q){if(!U(q))M(q,{recursive:!0})}function D(q){if(U(q))C(q,{recursive:!0,force:!0})}function F(q,z={}){let{extension:B,recursive:K=!1}=z;if(!U(q))return[];let L=[],V=X(q);for(let Q of V){let I=Z(q,Q),W=Y(I);if(W.isDirectory()&&K)L.push(...F(I,z));else if(W.isFile()){if(!B||Q.endsWith(B))L.push(I)}}return L}function u(q){if(!U(q))return[];return X(q).map((z)=>Z(q,z)).filter((z)=>Y(z).isDirectory())}function S(q,z){return j(q,z)}function y(q){let z=w(q);if(!z)return!1;return z.startsWith($)||z.startsWith(b)||z.startsWith(v)}function G(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 H(q){switch(q){case"md":return $;case"json":return b;case"js":case"ts":return v;default:return null}}export{_ as writeGeneratedJson,g as writeGeneratedFile,D as removeIfExists,S as relPath,R as readJsonOrNull,w as readFileOrNull,F as listFiles,u as listDirs,y as isGeneratedFile,m as ensureDir};
@@ -1,24 +1,2 @@
1
1
  // @bun
2
- var __require = import.meta.require;
3
-
4
- // src/utils/frontmatter.ts
5
- import matter from "gray-matter";
6
- function parseFrontmatter(source) {
7
- const { data, content } = matter(source);
8
- return {
9
- data,
10
- content: content.trim(),
11
- raw: source
12
- };
13
- }
14
- function serializeFrontmatter(data, content) {
15
- const filtered = Object.fromEntries(Object.entries(data).filter(([, v]) => v !== undefined));
16
- if (Object.keys(filtered).length === 0) {
17
- return content;
18
- }
19
- return matter.stringify(content, filtered);
20
- }
21
- export {
22
- serializeFrontmatter,
23
- parseFrontmatter
24
- };
2
+ var A=import.meta.require;import q from"gray-matter";function D(h){let{data:j,content:p}=q(h);return{data:j,content:p.trim(),raw:h}}function E(h,j){let p=Object.fromEntries(Object.entries(h).filter(([,x])=>x!==void 0));if(Object.keys(p).length===0)return j;return q.stringify(j,p)}export{E as serializeFrontmatter,D as parseFrontmatter};
@@ -1,53 +1,2 @@
1
1
  // @bun
2
- var __require = import.meta.require;
3
-
4
- // src/utils/global.ts
5
- import { existsSync } from "fs";
6
- import { homedir } from "os";
7
- import { join, resolve } from "path";
8
- function globalConfigDir() {
9
- return resolve(process.env.AGENTPACKS_GLOBAL_DIR ?? join(homedir(), ".agentpacks"));
10
- }
11
- function globalConfigFile() {
12
- return join(globalConfigDir(), "agentpacks.jsonc");
13
- }
14
- function hasGlobalConfig() {
15
- return existsSync(globalConfigFile());
16
- }
17
- function globalTargetDir(targetId, platform = process.platform) {
18
- const home = homedir();
19
- switch (targetId) {
20
- case "opencode":
21
- return join(xdgConfig(platform, home), "opencode");
22
- case "cursor":
23
- return join(home, ".cursor");
24
- case "claudecode":
25
- return join(home, ".claude");
26
- case "codexcli":
27
- return join(xdgConfig(platform, home), "codex");
28
- case "geminicli":
29
- return join(xdgConfig(platform, home), "gemini");
30
- case "copilot":
31
- return join(xdgConfig(platform, home), "github-copilot");
32
- default:
33
- return join(xdgConfig(platform, home), targetId);
34
- }
35
- }
36
- function xdgConfig(platform, home) {
37
- if (platform === "darwin") {
38
- return join(home, "Library", "Application Support");
39
- }
40
- if (platform === "win32") {
41
- return process.env.APPDATA ?? join(home, "AppData", "Roaming");
42
- }
43
- if (process.env.XDG_CONFIG_HOME) {
44
- return process.env.XDG_CONFIG_HOME;
45
- }
46
- return join(home, ".config");
47
- }
48
- export {
49
- hasGlobalConfig,
50
- globalTargetDir,
51
- globalConfigFile,
52
- globalConfigDir
53
- };
2
+ var T=import.meta.require;import{existsSync as K}from"fs";import{homedir as J}from"os";import{join as k,resolve as L}from"path";function P(){return L(process.env.AGENTPACKS_GLOBAL_DIR??k(J(),".agentpacks"))}function Q(){return k(P(),"agentpacks.jsonc")}function Z(){return K(Q())}function $(A,w=process.platform){let z=J();switch(A){case"opencode":return k(B(w,z),"opencode");case"cursor":return k(z,".cursor");case"claudecode":return k(z,".claude");case"codexcli":return k(B(w,z),"codex");case"geminicli":return k(B(w,z),"gemini");case"copilot":return k(B(w,z),"github-copilot");default:return k(B(w,z),A)}}function B(A,w){if(A==="darwin")return k(w,"Library","Application Support");if(A==="win32")return process.env.APPDATA??k(w,"AppData","Roaming");if(process.env.XDG_CONFIG_HOME)return process.env.XDG_CONFIG_HOME;return k(w,".config")}export{Z as hasGlobalConfig,$ as globalTargetDir,Q as globalConfigFile,P as globalConfigDir};
@@ -1,34 +1,8 @@
1
1
  // @bun
2
- var __require = import.meta.require;
3
-
4
- // src/utils/markdown.ts
5
- function stripGeneratedHeader(content) {
6
- return content.replace(/^<!-- Generated by agentpacks.*-->\n/, "").replace(/^\/\/ Generated by agentpacks.*\n/, "");
7
- }
8
- function packNameToIdentifier(packName) {
9
- return packName.split(/[-_.]/).filter((part) => part.length > 0).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
10
- }
11
- function extractFirstHeading(content) {
12
- const match = content.match(/^#{1,6}\s+(.+)$/m);
13
- return match?.[1]?.trim() ?? null;
14
- }
15
- function combineMarkdown(sections, separator = `
2
+ var u=import.meta.require;function y(b){return b.replace(/^<!-- Generated by agentpacks.*-->\n/,"").replace(/^\/\/ Generated by agentpacks.*\n/,"")}function z(b){return b.split(/[-_.]/).filter((f)=>f.length>0).map((f)=>f.charAt(0).toUpperCase()+f.slice(1)).join("")}function A(b){return b.match(/^#{1,6}\s+(.+)$/m)?.[1]?.trim()??null}function B(b,f=`
16
3
 
17
4
  ---
18
5
 
19
- `) {
20
- return sections.filter(Boolean).join(separator);
21
- }
22
- function wrapSection(heading, content, level = 2) {
23
- const prefix = "#".repeat(level);
24
- return `${prefix} ${heading}
6
+ `){return b.filter(Boolean).join(f)}function C(b,f,j=2){return`${"#".repeat(j)} ${b}
25
7
 
26
- ${content}`;
27
- }
28
- export {
29
- wrapSection,
30
- stripGeneratedHeader,
31
- packNameToIdentifier,
32
- extractFirstHeading,
33
- combineMarkdown
34
- };
8
+ ${f}`}export{C as wrapSection,y as stripGeneratedHeader,z as packNameToIdentifier,A as extractFirstHeading,B as combineMarkdown};
@@ -1,126 +1,2 @@
1
1
  // @bun
2
- var __require = import.meta.require;
3
-
4
- // src/utils/model-allowlist.ts
5
- var KNOWN_MODEL_PATTERNS = [
6
- {
7
- provider: "Anthropic",
8
- pattern: /^(anthropic\/)?claude-(opus|sonnet|haiku|instant|3|3\.5|4)[-.\w]*/i,
9
- examples: ["claude-sonnet-4-6", "anthropic/claude-opus-4-6"]
10
- },
11
- {
12
- provider: "OpenAI",
13
- pattern: /^(openai\/)?(gpt-4|gpt-5|gpt-3\.5|o[1-9]|o[1-9]-\w+|chatgpt-4o|gpt-4o)[-.\w]*/i,
14
- examples: [
15
- "gpt-5.4",
16
- "gpt-5-mini",
17
- "gpt-4o",
18
- "openai/gpt-4-turbo",
19
- "o1-preview"
20
- ]
21
- },
22
- {
23
- provider: "Google",
24
- pattern: /^(google\/)?gemini-(pro|ultra|nano|flash|1\.5|2\.0|2\.5|3|3\.1|exp)[-.\w]*/i,
25
- examples: [
26
- "gemini-2.5-flash",
27
- "gemini-3.1-pro-preview",
28
- "google/gemini-pro"
29
- ]
30
- },
31
- {
32
- provider: "Meta",
33
- pattern: /^(meta\/)?(llama|codellama)[-.\w]*/i,
34
- examples: ["llama-3.1-70b", "meta/llama-3-8b"]
35
- },
36
- {
37
- provider: "Mistral",
38
- pattern: /^(mistral(ai)?\/)?(mistral|mixtral|codestral|pixtral|devstral|magistral|voxtral|ministral)[-.\w]*/i,
39
- examples: [
40
- "mistral-large-2512",
41
- "devstral-2512",
42
- "mistral-large-latest",
43
- "codestral-latest",
44
- "devstral-small-latest"
45
- ]
46
- },
47
- {
48
- provider: "Cohere",
49
- pattern: /^(cohere\/)?command[-.\w]*/i,
50
- examples: ["command-r-plus", "cohere/command-r"]
51
- },
52
- {
53
- provider: "DeepSeek",
54
- pattern: /^(deepseek\/)?deepseek[-.\w]*/i,
55
- examples: ["deepseek-coder", "deepseek/deepseek-chat"]
56
- },
57
- {
58
- provider: "Qwen",
59
- pattern: /^(qwen\/)?qwen[-.\w]*/i,
60
- examples: ["qwen-2.5-72b"]
61
- },
62
- {
63
- provider: "xAI",
64
- pattern: /^(xai\/)?grok[-.\w]*/i,
65
- examples: ["grok-2", "xai/grok-3"]
66
- }
67
- ];
68
- function validateModelId(modelId) {
69
- if (!modelId || typeof modelId !== "string") {
70
- return {
71
- modelId: modelId ?? "",
72
- known: false,
73
- warning: "Empty model ID"
74
- };
75
- }
76
- for (const entry of KNOWN_MODEL_PATTERNS) {
77
- if (entry.pattern.test(modelId)) {
78
- return {
79
- modelId,
80
- known: true,
81
- provider: entry.provider
82
- };
83
- }
84
- }
85
- return {
86
- modelId,
87
- known: false,
88
- warning: `Unknown model ID "${modelId}" \u2014 not in any known provider pattern. This may be a new or custom model.`
89
- };
90
- }
91
- function scanModelsForUnknownIds(config) {
92
- const warnings = [];
93
- const checked = new Set;
94
- function check(modelId, context) {
95
- if (!modelId || checked.has(modelId))
96
- return;
97
- checked.add(modelId);
98
- const result = validateModelId(modelId);
99
- if (!result.known) {
100
- warnings.push(`${context}: ${result.warning}`);
101
- }
102
- }
103
- check(config.default, "default model");
104
- check(config.small, "small model");
105
- if (config.agents) {
106
- for (const [name, assignment] of Object.entries(config.agents)) {
107
- check(assignment.model, `agent "${name}"`);
108
- }
109
- }
110
- if (config.profiles) {
111
- for (const [profileName, profile] of Object.entries(config.profiles)) {
112
- check(profile.default, `profile "${profileName}" default`);
113
- check(profile.small, `profile "${profileName}" small`);
114
- if (profile.agents) {
115
- for (const [name, assignment] of Object.entries(profile.agents)) {
116
- check(assignment.model, `profile "${profileName}" agent "${name}"`);
117
- }
118
- }
119
- }
120
- }
121
- return warnings;
122
- }
123
- export {
124
- validateModelId,
125
- scanModelsForUnknownIds
126
- };
2
+ var V=import.meta.require;var Q=[{provider:"Anthropic",pattern:/^(anthropic\/)?claude-(opus|sonnet|haiku|instant|3|3\.5|4)[-.\w]*/i,examples:["claude-sonnet-4-6","anthropic/claude-opus-4-6"]},{provider:"OpenAI",pattern:/^(openai\/)?(gpt-4|gpt-5|gpt-3\.5|o[1-9]|o[1-9]-\w+|chatgpt-4o|gpt-4o)[-.\w]*/i,examples:["gpt-5.4","gpt-5-mini","gpt-4o","openai/gpt-4-turbo","o1-preview"]},{provider:"Google",pattern:/^(google\/)?gemini-(pro|ultra|nano|flash|1\.5|2\.0|2\.5|3|3\.1|exp)[-.\w]*/i,examples:["gemini-2.5-flash","gemini-3.1-pro-preview","google/gemini-pro"]},{provider:"Meta",pattern:/^(meta\/)?(llama|codellama)[-.\w]*/i,examples:["llama-3.1-70b","meta/llama-3-8b"]},{provider:"Mistral",pattern:/^(mistral(ai)?\/)?(mistral|mixtral|codestral|pixtral|devstral|magistral|voxtral|ministral)[-.\w]*/i,examples:["mistral-large-2512","devstral-2512","mistral-large-latest","codestral-latest","devstral-small-latest"]},{provider:"Cohere",pattern:/^(cohere\/)?command[-.\w]*/i,examples:["command-r-plus","cohere/command-r"]},{provider:"DeepSeek",pattern:/^(deepseek\/)?deepseek[-.\w]*/i,examples:["deepseek-coder","deepseek/deepseek-chat"]},{provider:"Qwen",pattern:/^(qwen\/)?qwen[-.\w]*/i,examples:["qwen-2.5-72b"]},{provider:"xAI",pattern:/^(xai\/)?grok[-.\w]*/i,examples:["grok-2","xai/grok-3"]}];function U(j){if(!j||typeof j!=="string")return{modelId:j??"",known:!1,warning:"Empty model ID"};for(let F of Q)if(F.pattern.test(j))return{modelId:j,known:!0,provider:F.provider};return{modelId:j,known:!1,warning:`Unknown model ID "${j}" \u2014 not in any known provider pattern. This may be a new or custom model.`}}function Y(j){let F=[],H=new Set;function B(q,z){if(!q||H.has(q))return;H.add(q);let G=U(q);if(!G.known)F.push(`${z}: ${G.warning}`)}if(B(j.default,"default model"),B(j.small,"small model"),j.agents)for(let[q,z]of Object.entries(j.agents))B(z.model,`agent "${q}"`);if(j.profiles){for(let[q,z]of Object.entries(j.profiles))if(B(z.default,`profile "${q}" default`),B(z.small,`profile "${q}" small`),z.agents)for(let[G,J]of Object.entries(z.agents))B(J.model,`profile "${q}" agent "${G}"`)}return F}export{U as validateModelId,Y as scanModelsForUnknownIds};
@@ -1,78 +1,3 @@
1
1
  // @bun
2
- var __require = import.meta.require;
3
-
4
- // src/utils/model-guidance.ts
5
- function generateModelGuidanceMarkdown(resolved) {
6
- if (!resolved.default && !resolved.small && Object.keys(resolved.agents).length === 0 && Object.keys(resolved.profiles).length === 0) {
7
- return null;
8
- }
9
- const lines = [];
10
- lines.push("# Model Configuration");
11
- lines.push("");
12
- lines.push("Use the following model preferences when working in this project.");
13
- lines.push("");
14
- if (resolved.default || resolved.small) {
15
- lines.push("## Default Models");
16
- lines.push("");
17
- if (resolved.default) {
18
- lines.push(`- **Primary model**: ${resolved.default}`);
19
- }
20
- if (resolved.small) {
21
- lines.push(`- **Lightweight tasks** (titles, summaries): ${resolved.small}`);
22
- }
23
- lines.push("");
24
- }
25
- const agentEntries = Object.entries(resolved.agents);
26
- if (agentEntries.length > 0) {
27
- lines.push("## Agent Model Assignments");
28
- lines.push("");
29
- lines.push("| Agent | Model | Temperature |");
30
- lines.push("| --- | --- | --- |");
31
- for (const [name, assignment] of agentEntries) {
32
- const temp = assignment.temperature !== undefined ? String(assignment.temperature) : "\u2014";
33
- lines.push(`| ${name} | ${assignment.model} | ${temp} |`);
34
- }
35
- lines.push("");
36
- }
37
- if (Object.keys(resolved.profiles).length > 0) {
38
- lines.push("## Available Profiles");
39
- lines.push("");
40
- lines.push("| Profile | Description | Default Model |");
41
- lines.push("| --- | --- | --- |");
42
- for (const [name, profile] of Object.entries(resolved.profiles)) {
43
- lines.push(`| ${name} | ${profile.description ?? "\u2014"} | ${profile.default ?? "\u2014"} |`);
44
- }
45
- lines.push("");
46
- }
47
- if (resolved.activeProfile) {
48
- lines.push(`**Active profile**: \`${resolved.activeProfile}\``);
49
- lines.push("");
50
- }
51
- if (resolved.routing.length > 0) {
52
- lines.push("## Task-Aware Routing");
53
- lines.push("");
54
- lines.push("Select the appropriate profile based on the task context:");
55
- lines.push("");
56
- lines.push("| Condition | Profile | Description |");
57
- lines.push("| --- | --- | --- |");
58
- for (const rule of resolved.routing) {
59
- const conditions = Object.entries(rule.when).map(([k, v]) => `${k}=${v}`).join(", ");
60
- const desc = rule.description ?? "\u2014";
61
- lines.push(`| ${conditions} | ${rule.use} | ${desc} |`);
62
- }
63
- lines.push("");
64
- lines.push("### Condition Reference");
65
- lines.push("");
66
- lines.push("- **complexity**: low | medium | high | critical");
67
- lines.push("- **urgency**: low | normal | high");
68
- lines.push("- **budget**: minimal | standard | premium");
69
- lines.push("- **contextWindowNeed**: small | medium | large | max");
70
- lines.push("- **toolUseIntensity**: none | light | heavy");
71
- lines.push("");
72
- }
73
- return lines.join(`
74
- `);
75
- }
76
- export {
77
- generateModelGuidanceMarkdown
78
- };
2
+ var J=import.meta.require;function L(q){if(!q.default&&!q.small&&Object.keys(q.agents).length===0&&Object.keys(q.profiles).length===0)return null;let j=[];if(j.push("# Model Configuration"),j.push(""),j.push("Use the following model preferences when working in this project."),j.push(""),q.default||q.small){if(j.push("## Default Models"),j.push(""),q.default)j.push(`- **Primary model**: ${q.default}`);if(q.small)j.push(`- **Lightweight tasks** (titles, summaries): ${q.small}`);j.push("")}let F=Object.entries(q.agents);if(F.length>0){j.push("## Agent Model Assignments"),j.push(""),j.push("| Agent | Model | Temperature |"),j.push("| --- | --- | --- |");for(let[z,x]of F){let B=x.temperature!==void 0?String(x.temperature):"\u2014";j.push(`| ${z} | ${x.model} | ${B} |`)}j.push("")}if(Object.keys(q.profiles).length>0){j.push("## Available Profiles"),j.push(""),j.push("| Profile | Description | Default Model |"),j.push("| --- | --- | --- |");for(let[z,x]of Object.entries(q.profiles))j.push(`| ${z} | ${x.description??"\u2014"} | ${x.default??"\u2014"} |`);j.push("")}if(q.activeProfile)j.push(`**Active profile**: \`${q.activeProfile}\``),j.push("");if(q.routing.length>0){j.push("## Task-Aware Routing"),j.push(""),j.push("Select the appropriate profile based on the task context:"),j.push(""),j.push("| Condition | Profile | Description |"),j.push("| --- | --- | --- |");for(let z of q.routing){let x=Object.entries(z.when).map(([H,I])=>`${H}=${I}`).join(", "),B=z.description??"\u2014";j.push(`| ${x} | ${z.use} | ${B} |`)}j.push(""),j.push("### Condition Reference"),j.push(""),j.push("- **complexity**: low | medium | high | critical"),j.push("- **urgency**: low | normal | high"),j.push("- **budget**: minimal | standard | premium"),j.push("- **contextWindowNeed**: small | medium | large | max"),j.push("- **toolUseIntensity**: none | light | heavy"),j.push("")}return j.join(`
3
+ `)}export{L as generateModelGuidanceMarkdown};