agentpacks 0.3.0 → 0.4.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 (166) hide show
  1. package/README.md +168 -8
  2. package/dist/api.d.ts +2 -0
  3. package/dist/api.js +929 -409
  4. package/dist/cli/export-cmd.js +281 -149
  5. package/dist/cli/generate.js +740 -247
  6. package/dist/cli/import-cmd.js +57 -85
  7. package/dist/cli/info.d.ts +4 -0
  8. package/dist/cli/info.js +232 -0
  9. package/dist/cli/init.js +8 -36
  10. package/dist/cli/install.js +414 -129
  11. package/dist/cli/login.d.ts +9 -0
  12. package/dist/cli/login.js +202 -0
  13. package/dist/cli/models-explain.d.ts +16 -0
  14. package/dist/cli/models-explain.js +1205 -0
  15. package/dist/cli/pack/create.js +4 -32
  16. package/dist/cli/pack/enable.js +1 -29
  17. package/dist/cli/pack/list.js +266 -134
  18. package/dist/cli/pack/validate.js +274 -127
  19. package/dist/cli/publish.d.ts +8 -0
  20. package/dist/cli/publish.js +672 -0
  21. package/dist/cli/search.d.ts +12 -0
  22. package/dist/cli/search.js +210 -0
  23. package/dist/core/config.d.ts +2 -1
  24. package/dist/core/config.js +74 -117
  25. package/dist/core/dependency-resolver.js +4 -28
  26. package/dist/core/feature-merger.d.ts +7 -0
  27. package/dist/core/feature-merger.js +289 -29
  28. package/dist/core/index.js +283 -140
  29. package/dist/core/lockfile.js +0 -28
  30. package/dist/core/metarepo.js +74 -116
  31. package/dist/core/pack-loader.d.ts +2 -0
  32. package/dist/core/pack-loader.js +266 -133
  33. package/dist/core/profile-resolver.d.ts +75 -0
  34. package/dist/core/profile-resolver.js +111 -0
  35. package/dist/exporters/cursor-plugin.js +4 -32
  36. package/dist/exporters/index.js +4 -32
  37. package/dist/features/agents.d.ts +5 -0
  38. package/dist/features/agents.js +2 -30
  39. package/dist/features/commands.js +2 -30
  40. package/dist/features/hooks.js +2 -30
  41. package/dist/features/ignore.js +0 -28
  42. package/dist/features/index.d.ts +1 -0
  43. package/dist/features/index.js +176 -31
  44. package/dist/features/mcp.js +2 -30
  45. package/dist/features/models.d.ts +167 -0
  46. package/dist/features/models.js +293 -0
  47. package/dist/features/plugins.js +2 -30
  48. package/dist/features/rules.js +2 -30
  49. package/dist/features/skills.js +2 -30
  50. package/dist/importers/claude-code.js +10 -38
  51. package/dist/importers/cursor.js +15 -43
  52. package/dist/importers/opencode.js +16 -44
  53. package/dist/importers/rulesync.js +22 -50
  54. package/dist/index.js +1710 -538
  55. package/dist/node/api.js +929 -409
  56. package/dist/node/cli/export-cmd.js +281 -149
  57. package/dist/node/cli/generate.js +740 -247
  58. package/dist/node/cli/import-cmd.js +57 -85
  59. package/dist/node/cli/info.js +232 -0
  60. package/dist/node/cli/init.js +8 -36
  61. package/dist/node/cli/install.js +414 -129
  62. package/dist/node/cli/login.js +202 -0
  63. package/dist/node/cli/models-explain.js +1205 -0
  64. package/dist/node/cli/pack/create.js +4 -32
  65. package/dist/node/cli/pack/enable.js +1 -29
  66. package/dist/node/cli/pack/list.js +266 -134
  67. package/dist/node/cli/pack/validate.js +274 -127
  68. package/dist/node/cli/publish.js +672 -0
  69. package/dist/node/cli/search.js +210 -0
  70. package/dist/node/core/config.js +74 -117
  71. package/dist/node/core/dependency-resolver.js +4 -28
  72. package/dist/node/core/feature-merger.js +289 -29
  73. package/dist/node/core/index.js +283 -140
  74. package/dist/node/core/lockfile.js +0 -28
  75. package/dist/node/core/metarepo.js +74 -116
  76. package/dist/node/core/pack-loader.js +266 -133
  77. package/dist/node/core/profile-resolver.js +111 -0
  78. package/dist/node/exporters/cursor-plugin.js +4 -32
  79. package/dist/node/exporters/index.js +4 -32
  80. package/dist/node/features/agents.js +2 -30
  81. package/dist/node/features/commands.js +2 -30
  82. package/dist/node/features/hooks.js +2 -30
  83. package/dist/node/features/ignore.js +0 -28
  84. package/dist/node/features/index.js +176 -31
  85. package/dist/node/features/mcp.js +2 -30
  86. package/dist/node/features/models.js +293 -0
  87. package/dist/node/features/plugins.js +2 -30
  88. package/dist/node/features/rules.js +2 -30
  89. package/dist/node/features/skills.js +2 -30
  90. package/dist/node/importers/claude-code.js +10 -38
  91. package/dist/node/importers/cursor.js +15 -43
  92. package/dist/node/importers/opencode.js +16 -44
  93. package/dist/node/importers/rulesync.js +22 -50
  94. package/dist/node/index.js +1710 -538
  95. package/dist/node/sources/git-ref.js +7 -30
  96. package/dist/node/sources/git.js +7 -30
  97. package/dist/node/sources/index.js +337 -39
  98. package/dist/node/sources/local.js +0 -28
  99. package/dist/node/sources/npm-ref.js +0 -28
  100. package/dist/node/sources/npm.js +10 -37
  101. package/dist/node/sources/registry-ref.js +37 -0
  102. package/dist/node/sources/registry.js +355 -0
  103. package/dist/node/targets/additional-targets.js +196 -37
  104. package/dist/node/targets/agents-md.js +5 -33
  105. package/dist/node/targets/base-target.js +0 -28
  106. package/dist/node/targets/claude-code.js +211 -41
  107. package/dist/node/targets/codex-cli.js +7 -35
  108. package/dist/node/targets/copilot.js +202 -41
  109. package/dist/node/targets/cursor.js +188 -40
  110. package/dist/node/targets/gemini-cli.js +10 -38
  111. package/dist/node/targets/generic-md-target.js +196 -37
  112. package/dist/node/targets/index.js +414 -106
  113. package/dist/node/targets/opencode.js +171 -51
  114. package/dist/node/targets/registry.js +414 -106
  115. package/dist/node/utils/credentials.js +38 -0
  116. package/dist/node/utils/diff.js +22 -34
  117. package/dist/node/utils/filesystem.js +2 -30
  118. package/dist/node/utils/frontmatter.js +0 -28
  119. package/dist/node/utils/global.js +3 -31
  120. package/dist/node/utils/markdown.js +0 -28
  121. package/dist/node/utils/model-allowlist.js +110 -0
  122. package/dist/node/utils/model-guidance.js +78 -0
  123. package/dist/node/utils/registry-client.js +142 -0
  124. package/dist/node/utils/tarball.js +49 -0
  125. package/dist/sources/git-ref.js +7 -30
  126. package/dist/sources/git.d.ts +2 -2
  127. package/dist/sources/git.js +7 -30
  128. package/dist/sources/index.d.ts +2 -0
  129. package/dist/sources/index.js +337 -39
  130. package/dist/sources/local.js +0 -28
  131. package/dist/sources/npm-ref.js +0 -28
  132. package/dist/sources/npm.js +10 -37
  133. package/dist/sources/registry-ref.d.ts +30 -0
  134. package/dist/sources/registry-ref.js +37 -0
  135. package/dist/sources/registry.d.ts +18 -0
  136. package/dist/sources/registry.js +355 -0
  137. package/dist/targets/additional-targets.js +196 -37
  138. package/dist/targets/agents-md.js +5 -33
  139. package/dist/targets/base-target.d.ts +2 -0
  140. package/dist/targets/base-target.js +0 -28
  141. package/dist/targets/claude-code.js +211 -41
  142. package/dist/targets/codex-cli.js +7 -35
  143. package/dist/targets/copilot.js +202 -41
  144. package/dist/targets/cursor.js +188 -40
  145. package/dist/targets/gemini-cli.js +10 -38
  146. package/dist/targets/generic-md-target.js +196 -37
  147. package/dist/targets/index.js +414 -106
  148. package/dist/targets/opencode.js +171 -51
  149. package/dist/targets/registry.js +414 -106
  150. package/dist/utils/credentials.d.ts +19 -0
  151. package/dist/utils/credentials.js +38 -0
  152. package/dist/utils/diff.js +22 -34
  153. package/dist/utils/filesystem.js +2 -30
  154. package/dist/utils/frontmatter.js +0 -28
  155. package/dist/utils/global.js +3 -31
  156. package/dist/utils/markdown.js +0 -28
  157. package/dist/utils/model-allowlist.d.ts +39 -0
  158. package/dist/utils/model-allowlist.js +110 -0
  159. package/dist/utils/model-guidance.d.ts +6 -0
  160. package/dist/utils/model-guidance.js +78 -0
  161. package/dist/utils/registry-client.d.ts +141 -0
  162. package/dist/utils/registry-client.js +142 -0
  163. package/dist/utils/tarball.d.ts +13 -0
  164. package/dist/utils/tarball.js +49 -0
  165. package/package.json +171 -5
  166. package/templates/pack/models.json +38 -0
@@ -1,32 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __moduleCache = /* @__PURE__ */ new WeakMap;
7
- var __toCommonJS = (from) => {
8
- var entry = __moduleCache.get(from), desc;
9
- if (entry)
10
- return entry;
11
- entry = __defProp({}, "__esModule", { value: true });
12
- if (from && typeof from === "object" || typeof from === "function")
13
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- }));
17
- __moduleCache.set(from, entry);
18
- return entry;
19
- };
20
- var __export = (target, all) => {
21
- for (var name in all)
22
- __defProp(target, name, {
23
- get: all[name],
24
- enumerable: true,
25
- configurable: true,
26
- set: (newValue) => all[name] = () => newValue
27
- });
28
- };
29
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
30
2
  var __require = import.meta.require;
31
3
 
32
4
  // src/utils/filesystem.ts
@@ -36,10 +8,10 @@ import {
36
8
  readFileSync,
37
9
  writeFileSync,
38
10
  readdirSync,
11
+ rmSync,
39
12
  statSync
40
13
  } from "fs";
41
14
  import { dirname, relative, join } from "path";
42
- import { removeSync } from "fs-extra";
43
15
  var GENERATED_HEADER_MD = "<!-- Generated by agentpacks. DO NOT EDIT. -->";
44
16
  var GENERATED_HEADER_JSON = "// Generated by agentpacks. DO NOT EDIT.";
45
17
  var GENERATED_HEADER_JS = "// Generated by agentpacks. DO NOT EDIT.";
@@ -80,7 +52,7 @@ function ensureDir(dirPath) {
80
52
  }
81
53
  function removeIfExists(targetPath) {
82
54
  if (existsSync(targetPath)) {
83
- removeSync(targetPath);
55
+ rmSync(targetPath, { recursive: true, force: true });
84
56
  }
85
57
  }
86
58
  function listFiles(dirPath, options = {}) {
@@ -141,12 +113,12 @@ function getHeader(type) {
141
113
 
142
114
  // src/importers/claude-code.ts
143
115
  import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, copyFileSync } from "fs";
144
- import { resolve as resolve2, join as join2, basename } from "path";
116
+ import { resolve, join as join2, basename } from "path";
145
117
  function importFromClaudeCode(projectRoot, outputPackDir) {
146
118
  const warnings = [];
147
119
  const filesImported = [];
148
- const claudeDir = resolve2(projectRoot, ".claude");
149
- const hasClaudeMd = existsSync2(resolve2(projectRoot, "CLAUDE.md"));
120
+ const claudeDir = resolve(projectRoot, ".claude");
121
+ const hasClaudeMd = existsSync2(resolve(projectRoot, "CLAUDE.md"));
150
122
  const hasClaudeDir = existsSync2(claudeDir);
151
123
  if (!hasClaudeMd && !hasClaudeDir) {
152
124
  return {
@@ -156,12 +128,12 @@ function importFromClaudeCode(projectRoot, outputPackDir) {
156
128
  configGenerated: false
157
129
  };
158
130
  }
159
- const packDir = outputPackDir ?? resolve2(projectRoot, "packs", "claude-import");
131
+ const packDir = outputPackDir ?? resolve(projectRoot, "packs", "claude-import");
160
132
  ensureDir(packDir);
161
- const rulesDir = resolve2(packDir, "rules");
133
+ const rulesDir = resolve(packDir, "rules");
162
134
  ensureDir(rulesDir);
163
135
  if (hasClaudeMd) {
164
- const raw = readFileSync2(resolve2(projectRoot, "CLAUDE.md"), "utf-8");
136
+ const raw = readFileSync2(resolve(projectRoot, "CLAUDE.md"), "utf-8");
165
137
  const ruleContent = [
166
138
  "---",
167
139
  "root: true",
@@ -176,7 +148,7 @@ function importFromClaudeCode(projectRoot, outputPackDir) {
176
148
  filesImported.push(dest);
177
149
  }
178
150
  if (hasClaudeDir) {
179
- const claudeRulesDir = resolve2(claudeDir, "rules");
151
+ const claudeRulesDir = resolve(claudeDir, "rules");
180
152
  if (existsSync2(claudeRulesDir)) {
181
153
  const files = listFiles(claudeRulesDir, { extension: ".md" });
182
154
  for (const file of files) {
@@ -185,7 +157,7 @@ function importFromClaudeCode(projectRoot, outputPackDir) {
185
157
  filesImported.push(dest);
186
158
  }
187
159
  }
188
- const settingsPath = resolve2(claudeDir, "settings.json");
160
+ const settingsPath = resolve(claudeDir, "settings.json");
189
161
  if (existsSync2(settingsPath)) {
190
162
  try {
191
163
  const raw = readFileSync2(settingsPath, "utf-8");
@@ -1,32 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __moduleCache = /* @__PURE__ */ new WeakMap;
7
- var __toCommonJS = (from) => {
8
- var entry = __moduleCache.get(from), desc;
9
- if (entry)
10
- return entry;
11
- entry = __defProp({}, "__esModule", { value: true });
12
- if (from && typeof from === "object" || typeof from === "function")
13
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- }));
17
- __moduleCache.set(from, entry);
18
- return entry;
19
- };
20
- var __export = (target, all) => {
21
- for (var name in all)
22
- __defProp(target, name, {
23
- get: all[name],
24
- enumerable: true,
25
- configurable: true,
26
- set: (newValue) => all[name] = () => newValue
27
- });
28
- };
29
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
30
2
  var __require = import.meta.require;
31
3
 
32
4
  // src/utils/filesystem.ts
@@ -36,10 +8,10 @@ import {
36
8
  readFileSync,
37
9
  writeFileSync,
38
10
  readdirSync,
11
+ rmSync,
39
12
  statSync
40
13
  } from "fs";
41
14
  import { dirname, relative, join } from "path";
42
- import { removeSync } from "fs-extra";
43
15
  var GENERATED_HEADER_MD = "<!-- Generated by agentpacks. DO NOT EDIT. -->";
44
16
  var GENERATED_HEADER_JSON = "// Generated by agentpacks. DO NOT EDIT.";
45
17
  var GENERATED_HEADER_JS = "// Generated by agentpacks. DO NOT EDIT.";
@@ -80,7 +52,7 @@ function ensureDir(dirPath) {
80
52
  }
81
53
  function removeIfExists(targetPath) {
82
54
  if (existsSync(targetPath)) {
83
- removeSync(targetPath);
55
+ rmSync(targetPath, { recursive: true, force: true });
84
56
  }
85
57
  }
86
58
  function listFiles(dirPath, options = {}) {
@@ -159,9 +131,9 @@ function serializeFrontmatter(data, content) {
159
131
 
160
132
  // src/importers/cursor.ts
161
133
  import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, copyFileSync } from "fs";
162
- import { resolve as resolve2, join as join2, basename } from "path";
134
+ import { resolve, join as join2, basename } from "path";
163
135
  function importFromCursor(projectRoot, outputPackDir) {
164
- const cursorDir = resolve2(projectRoot, ".cursor");
136
+ const cursorDir = resolve(projectRoot, ".cursor");
165
137
  const warnings = [];
166
138
  const filesImported = [];
167
139
  if (!existsSync2(cursorDir)) {
@@ -172,11 +144,11 @@ function importFromCursor(projectRoot, outputPackDir) {
172
144
  configGenerated: false
173
145
  };
174
146
  }
175
- const packDir = outputPackDir ?? resolve2(projectRoot, "packs", "cursor-import");
147
+ const packDir = outputPackDir ?? resolve(projectRoot, "packs", "cursor-import");
176
148
  ensureDir(packDir);
177
- const rulesDir = resolve2(cursorDir, "rules");
149
+ const rulesDir = resolve(cursorDir, "rules");
178
150
  if (existsSync2(rulesDir)) {
179
- const outRulesDir = resolve2(packDir, "rules");
151
+ const outRulesDir = resolve(packDir, "rules");
180
152
  ensureDir(outRulesDir);
181
153
  const files = listFiles(rulesDir, { extension: ".mdc" });
182
154
  for (const file of files) {
@@ -203,9 +175,9 @@ function importFromCursor(projectRoot, outputPackDir) {
203
175
  filesImported.push(dest);
204
176
  }
205
177
  }
206
- const agentsDir = resolve2(cursorDir, "agents");
178
+ const agentsDir = resolve(cursorDir, "agents");
207
179
  if (existsSync2(agentsDir)) {
208
- const outDir = resolve2(packDir, "agents");
180
+ const outDir = resolve(packDir, "agents");
209
181
  ensureDir(outDir);
210
182
  const files = listFiles(agentsDir, { extension: ".md" });
211
183
  for (const file of files) {
@@ -214,9 +186,9 @@ function importFromCursor(projectRoot, outputPackDir) {
214
186
  filesImported.push(dest);
215
187
  }
216
188
  }
217
- const skillsDir = resolve2(cursorDir, "skills");
189
+ const skillsDir = resolve(cursorDir, "skills");
218
190
  if (existsSync2(skillsDir)) {
219
- const outDir = resolve2(packDir, "skills");
191
+ const outDir = resolve(packDir, "skills");
220
192
  ensureDir(outDir);
221
193
  const dirs = listDirs(skillsDir);
222
194
  for (const dir of dirs) {
@@ -230,9 +202,9 @@ function importFromCursor(projectRoot, outputPackDir) {
230
202
  }
231
203
  }
232
204
  }
233
- const commandsDir = resolve2(cursorDir, "commands");
205
+ const commandsDir = resolve(cursorDir, "commands");
234
206
  if (existsSync2(commandsDir)) {
235
- const outDir = resolve2(packDir, "commands");
207
+ const outDir = resolve(packDir, "commands");
236
208
  ensureDir(outDir);
237
209
  const files = listFiles(commandsDir, { extension: ".md" });
238
210
  for (const file of files) {
@@ -241,12 +213,12 @@ function importFromCursor(projectRoot, outputPackDir) {
241
213
  filesImported.push(dest);
242
214
  }
243
215
  }
244
- const mcpJson = resolve2(cursorDir, "mcp.json");
216
+ const mcpJson = resolve(cursorDir, "mcp.json");
245
217
  if (existsSync2(mcpJson)) {
246
218
  copyFileSync(mcpJson, join2(packDir, "mcp.json"));
247
219
  filesImported.push(join2(packDir, "mcp.json"));
248
220
  }
249
- const cursorIgnore = resolve2(projectRoot, ".cursorignore");
221
+ const cursorIgnore = resolve(projectRoot, ".cursorignore");
250
222
  if (existsSync2(cursorIgnore)) {
251
223
  copyFileSync(cursorIgnore, join2(packDir, "ignore"));
252
224
  filesImported.push(join2(packDir, "ignore"));
@@ -1,32 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __moduleCache = /* @__PURE__ */ new WeakMap;
7
- var __toCommonJS = (from) => {
8
- var entry = __moduleCache.get(from), desc;
9
- if (entry)
10
- return entry;
11
- entry = __defProp({}, "__esModule", { value: true });
12
- if (from && typeof from === "object" || typeof from === "function")
13
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- }));
17
- __moduleCache.set(from, entry);
18
- return entry;
19
- };
20
- var __export = (target, all) => {
21
- for (var name in all)
22
- __defProp(target, name, {
23
- get: all[name],
24
- enumerable: true,
25
- configurable: true,
26
- set: (newValue) => all[name] = () => newValue
27
- });
28
- };
29
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
30
2
  var __require = import.meta.require;
31
3
 
32
4
  // src/utils/filesystem.ts
@@ -36,10 +8,10 @@ import {
36
8
  readFileSync,
37
9
  writeFileSync,
38
10
  readdirSync,
11
+ rmSync,
39
12
  statSync
40
13
  } from "fs";
41
14
  import { dirname, relative, join } from "path";
42
- import { removeSync } from "fs-extra";
43
15
  var GENERATED_HEADER_MD = "<!-- Generated by agentpacks. DO NOT EDIT. -->";
44
16
  var GENERATED_HEADER_JSON = "// Generated by agentpacks. DO NOT EDIT.";
45
17
  var GENERATED_HEADER_JS = "// Generated by agentpacks. DO NOT EDIT.";
@@ -80,7 +52,7 @@ function ensureDir(dirPath) {
80
52
  }
81
53
  function removeIfExists(targetPath) {
82
54
  if (existsSync(targetPath)) {
83
- removeSync(targetPath);
55
+ rmSync(targetPath, { recursive: true, force: true });
84
56
  }
85
57
  }
86
58
  function listFiles(dirPath, options = {}) {
@@ -141,11 +113,11 @@ function getHeader(type) {
141
113
 
142
114
  // src/importers/opencode.ts
143
115
  import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, copyFileSync } from "fs";
144
- import { resolve as resolve2, join as join2, basename } from "path";
116
+ import { resolve, join as join2, basename } from "path";
145
117
  function importFromOpenCode(projectRoot, outputPackDir) {
146
118
  const warnings = [];
147
119
  const filesImported = [];
148
- const ocDir = resolve2(projectRoot, ".opencode");
120
+ const ocDir = resolve(projectRoot, ".opencode");
149
121
  if (!existsSync2(ocDir)) {
150
122
  return {
151
123
  packDir: "",
@@ -154,14 +126,14 @@ function importFromOpenCode(projectRoot, outputPackDir) {
154
126
  configGenerated: false
155
127
  };
156
128
  }
157
- const packDir = outputPackDir ?? resolve2(projectRoot, "packs", "opencode-import");
129
+ const packDir = outputPackDir ?? resolve(projectRoot, "packs", "opencode-import");
158
130
  ensureDir(packDir);
159
- importDirMd(resolve2(ocDir, "rules"), resolve2(packDir, "rules"), filesImported);
160
- importDirMd(resolve2(ocDir, "commands"), resolve2(packDir, "commands"), filesImported);
161
- importDirMd(resolve2(ocDir, "agents"), resolve2(packDir, "agents"), filesImported);
162
- const skillDir = resolve2(ocDir, "skill");
131
+ importDirMd(resolve(ocDir, "rules"), resolve(packDir, "rules"), filesImported);
132
+ importDirMd(resolve(ocDir, "commands"), resolve(packDir, "commands"), filesImported);
133
+ importDirMd(resolve(ocDir, "agents"), resolve(packDir, "agents"), filesImported);
134
+ const skillDir = resolve(ocDir, "skill");
163
135
  if (existsSync2(skillDir)) {
164
- const outSkillDir = resolve2(packDir, "skills");
136
+ const outSkillDir = resolve(packDir, "skills");
165
137
  ensureDir(outSkillDir);
166
138
  const dirs = listDirs(skillDir);
167
139
  for (const dir of dirs) {
@@ -177,9 +149,9 @@ function importFromOpenCode(projectRoot, outputPackDir) {
177
149
  }
178
150
  }
179
151
  }
180
- const pluginsDir = resolve2(ocDir, "plugins");
152
+ const pluginsDir = resolve(ocDir, "plugins");
181
153
  if (existsSync2(pluginsDir)) {
182
- const outPluginsDir = resolve2(packDir, "plugins");
154
+ const outPluginsDir = resolve(packDir, "plugins");
183
155
  ensureDir(outPluginsDir);
184
156
  const files = listFiles(pluginsDir);
185
157
  for (const file of files) {
@@ -190,9 +162,9 @@ function importFromOpenCode(projectRoot, outputPackDir) {
190
162
  }
191
163
  }
192
164
  }
193
- const agentsMd = resolve2(projectRoot, "AGENTS.md");
165
+ const agentsMd = resolve(projectRoot, "AGENTS.md");
194
166
  if (existsSync2(agentsMd)) {
195
- const outRulesDir = resolve2(packDir, "rules");
167
+ const outRulesDir = resolve(packDir, "rules");
196
168
  ensureDir(outRulesDir);
197
169
  const raw = readFileSync2(agentsMd, "utf-8");
198
170
  const ruleContent = [
@@ -208,7 +180,7 @@ function importFromOpenCode(projectRoot, outputPackDir) {
208
180
  writeFileSync2(dest2, ruleContent);
209
181
  filesImported.push(dest2);
210
182
  }
211
- const ocJson = resolve2(projectRoot, "opencode.json");
183
+ const ocJson = resolve(projectRoot, "opencode.json");
212
184
  if (existsSync2(ocJson)) {
213
185
  try {
214
186
  const raw = readFileSync2(ocJson, "utf-8");
@@ -224,7 +196,7 @@ function importFromOpenCode(projectRoot, outputPackDir) {
224
196
  warnings.push("Failed to parse opencode.json");
225
197
  }
226
198
  }
227
- const ocIgnore = resolve2(projectRoot, ".opencodeignore");
199
+ const ocIgnore = resolve(projectRoot, ".opencodeignore");
228
200
  if (existsSync2(ocIgnore)) {
229
201
  copyFileSync(ocIgnore, join2(packDir, "ignore"));
230
202
  filesImported.push(join2(packDir, "ignore"));
@@ -1,32 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __moduleCache = /* @__PURE__ */ new WeakMap;
7
- var __toCommonJS = (from) => {
8
- var entry = __moduleCache.get(from), desc;
9
- if (entry)
10
- return entry;
11
- entry = __defProp({}, "__esModule", { value: true });
12
- if (from && typeof from === "object" || typeof from === "function")
13
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- }));
17
- __moduleCache.set(from, entry);
18
- return entry;
19
- };
20
- var __export = (target, all) => {
21
- for (var name in all)
22
- __defProp(target, name, {
23
- get: all[name],
24
- enumerable: true,
25
- configurable: true,
26
- set: (newValue) => all[name] = () => newValue
27
- });
28
- };
29
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
30
2
  var __require = import.meta.require;
31
3
 
32
4
  // src/utils/filesystem.ts
@@ -36,10 +8,10 @@ import {
36
8
  readFileSync,
37
9
  writeFileSync,
38
10
  readdirSync,
11
+ rmSync,
39
12
  statSync
40
13
  } from "fs";
41
14
  import { dirname, relative, join } from "path";
42
- import { removeSync } from "fs-extra";
43
15
  var GENERATED_HEADER_MD = "<!-- Generated by agentpacks. DO NOT EDIT. -->";
44
16
  var GENERATED_HEADER_JSON = "// Generated by agentpacks. DO NOT EDIT.";
45
17
  var GENERATED_HEADER_JS = "// Generated by agentpacks. DO NOT EDIT.";
@@ -80,7 +52,7 @@ function ensureDir(dirPath) {
80
52
  }
81
53
  function removeIfExists(targetPath) {
82
54
  if (existsSync(targetPath)) {
83
- removeSync(targetPath);
55
+ rmSync(targetPath, { recursive: true, force: true });
84
56
  }
85
57
  }
86
58
  function listFiles(dirPath, options = {}) {
@@ -141,10 +113,10 @@ function getHeader(type) {
141
113
 
142
114
  // src/importers/rulesync.ts
143
115
  import { existsSync as existsSync2, readFileSync as readFileSync2, copyFileSync, writeFileSync as writeFileSync2 } from "fs";
144
- import { resolve as resolve2, join as join2, basename } from "path";
116
+ import { resolve, join as join2, basename } from "path";
145
117
  import { parse as parseJsonc } from "jsonc-parser";
146
118
  function importFromRulesync(projectRoot, outputPackDir) {
147
- const rulesyncDir = resolve2(projectRoot, ".rulesync");
119
+ const rulesyncDir = resolve(projectRoot, ".rulesync");
148
120
  const warnings = [];
149
121
  const filesImported = [];
150
122
  if (!existsSync2(rulesyncDir)) {
@@ -155,11 +127,11 @@ function importFromRulesync(projectRoot, outputPackDir) {
155
127
  configGenerated: false
156
128
  };
157
129
  }
158
- const packDir = outputPackDir ?? resolve2(projectRoot, "packs", "default");
130
+ const packDir = outputPackDir ?? resolve(projectRoot, "packs", "default");
159
131
  ensureDir(packDir);
160
- const rulesDir = resolve2(rulesyncDir, "rules");
132
+ const rulesDir = resolve(rulesyncDir, "rules");
161
133
  if (existsSync2(rulesDir)) {
162
- const outRulesDir = resolve2(packDir, "rules");
134
+ const outRulesDir = resolve(packDir, "rules");
163
135
  ensureDir(outRulesDir);
164
136
  const files = listFiles(rulesDir, { extension: ".md" });
165
137
  for (const file of files) {
@@ -168,9 +140,9 @@ function importFromRulesync(projectRoot, outputPackDir) {
168
140
  filesImported.push(dest);
169
141
  }
170
142
  }
171
- const commandsDir = resolve2(rulesyncDir, "commands");
143
+ const commandsDir = resolve(rulesyncDir, "commands");
172
144
  if (existsSync2(commandsDir)) {
173
- const outCommandsDir = resolve2(packDir, "commands");
145
+ const outCommandsDir = resolve(packDir, "commands");
174
146
  ensureDir(outCommandsDir);
175
147
  const files = listFiles(commandsDir, { extension: ".md" });
176
148
  for (const file of files) {
@@ -179,9 +151,9 @@ function importFromRulesync(projectRoot, outputPackDir) {
179
151
  filesImported.push(dest);
180
152
  }
181
153
  }
182
- const subagentsDir = resolve2(rulesyncDir, "subagents");
154
+ const subagentsDir = resolve(rulesyncDir, "subagents");
183
155
  if (existsSync2(subagentsDir)) {
184
- const outAgentsDir = resolve2(packDir, "agents");
156
+ const outAgentsDir = resolve(packDir, "agents");
185
157
  ensureDir(outAgentsDir);
186
158
  const files = listFiles(subagentsDir, { extension: ".md" });
187
159
  for (const file of files) {
@@ -190,9 +162,9 @@ function importFromRulesync(projectRoot, outputPackDir) {
190
162
  filesImported.push(dest);
191
163
  }
192
164
  }
193
- const skillsDir = resolve2(rulesyncDir, "skills");
165
+ const skillsDir = resolve(rulesyncDir, "skills");
194
166
  if (existsSync2(skillsDir)) {
195
- const outSkillsDir = resolve2(packDir, "skills");
167
+ const outSkillsDir = resolve(packDir, "skills");
196
168
  ensureDir(outSkillsDir);
197
169
  const skillDirs = listDirs(skillsDir);
198
170
  for (const skillDir of skillDirs) {
@@ -208,20 +180,20 @@ function importFromRulesync(projectRoot, outputPackDir) {
208
180
  }
209
181
  }
210
182
  }
211
- const hooksJson = resolve2(rulesyncDir, "hooks.json");
183
+ const hooksJson = resolve(rulesyncDir, "hooks.json");
212
184
  if (existsSync2(hooksJson)) {
213
- const outHooksDir = resolve2(packDir, "hooks");
185
+ const outHooksDir = resolve(packDir, "hooks");
214
186
  ensureDir(outHooksDir);
215
187
  copyFileSync(hooksJson, join2(outHooksDir, "hooks.json"));
216
188
  filesImported.push(join2(outHooksDir, "hooks.json"));
217
189
  }
218
- const mcpJson = resolve2(rulesyncDir, "mcp.json");
190
+ const mcpJson = resolve(rulesyncDir, "mcp.json");
219
191
  if (existsSync2(mcpJson)) {
220
192
  copyFileSync(mcpJson, join2(packDir, "mcp.json"));
221
193
  filesImported.push(join2(packDir, "mcp.json"));
222
194
  }
223
- const aiIgnore = resolve2(rulesyncDir, ".aiignore");
224
- const rulesyncIgnore = resolve2(projectRoot, ".rulesyncignore");
195
+ const aiIgnore = resolve(rulesyncDir, ".aiignore");
196
+ const rulesyncIgnore = resolve(projectRoot, ".rulesyncignore");
225
197
  if (existsSync2(aiIgnore)) {
226
198
  copyFileSync(aiIgnore, join2(packDir, "ignore"));
227
199
  filesImported.push(join2(packDir, "ignore"));
@@ -243,16 +215,16 @@ function importFromRulesync(projectRoot, outputPackDir) {
243
215
  `);
244
216
  filesImported.push(join2(packDir, "pack.json"));
245
217
  let configGenerated = false;
246
- const rulesyncConfig = resolve2(projectRoot, "rulesync.jsonc");
218
+ const rulesyncConfig = resolve(projectRoot, "rulesync.jsonc");
247
219
  if (existsSync2(rulesyncConfig)) {
248
- const agentpacksConfig = convertRulesyncConfig(rulesyncConfig, packDir, projectRoot);
249
- const configPath = resolve2(projectRoot, "agentpacks.jsonc");
220
+ const agentpacksConfig = convertRulesyncConfig(rulesyncConfig, packDir);
221
+ const configPath = resolve(projectRoot, "agentpacks.jsonc");
250
222
  writeFileSync2(configPath, agentpacksConfig);
251
223
  configGenerated = true;
252
224
  }
253
225
  return { packDir, filesImported, warnings, configGenerated };
254
226
  }
255
- function convertRulesyncConfig(rulesyncPath, packDir, projectRoot) {
227
+ function convertRulesyncConfig(rulesyncPath, _packDir) {
256
228
  const raw = readFileSync2(rulesyncPath, "utf-8");
257
229
  const parsed = parseJsonc(raw);
258
230
  const targets = parsed.targets ?? ["opencode", "cursor", "claudecode"];