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 = {}) {
@@ -317,6 +289,110 @@ function resolveHooksForTarget(hooks, targetId) {
317
289
  return merged;
318
290
  }
319
291
 
292
+ // src/core/profile-resolver.ts
293
+ function resolveModels(merged, modelProfile, targetId) {
294
+ let defaultModel = merged.default;
295
+ let smallModel = merged.small;
296
+ let agents = { ...merged.agents };
297
+ if (modelProfile && merged.profiles?.[modelProfile]) {
298
+ const resolvedProfile = resolveProfileInheritance(modelProfile, merged.profiles);
299
+ if (resolvedProfile.default)
300
+ defaultModel = resolvedProfile.default;
301
+ if (resolvedProfile.small)
302
+ smallModel = resolvedProfile.small;
303
+ if (resolvedProfile.agents) {
304
+ agents = { ...agents, ...resolvedProfile.agents };
305
+ }
306
+ }
307
+ if (targetId) {
308
+ const targetOverride = merged.overrides?.[targetId];
309
+ if (targetOverride) {
310
+ if (targetOverride.default)
311
+ defaultModel = targetOverride.default;
312
+ if (targetOverride.small)
313
+ smallModel = targetOverride.small;
314
+ if (targetOverride.agents) {
315
+ agents = { ...agents, ...targetOverride.agents };
316
+ }
317
+ }
318
+ }
319
+ const providers = {};
320
+ if (merged.providers) {
321
+ for (const [name, config] of Object.entries(merged.providers)) {
322
+ providers[name] = {
323
+ ...config.options ? { options: config.options } : {},
324
+ ...config.models ? { models: config.models } : {}
325
+ };
326
+ }
327
+ }
328
+ const profileNames = Object.keys(merged.profiles ?? {});
329
+ const profiles = {};
330
+ if (merged.profiles) {
331
+ for (const [name, profile] of Object.entries(merged.profiles)) {
332
+ profiles[name] = {
333
+ description: profile.description,
334
+ default: profile.default,
335
+ small: profile.small
336
+ };
337
+ }
338
+ }
339
+ return {
340
+ default: defaultModel,
341
+ small: smallModel,
342
+ agents,
343
+ providers,
344
+ routing: merged.routing ?? [],
345
+ profileNames,
346
+ activeProfile: modelProfile,
347
+ profiles
348
+ };
349
+ }
350
+ function resolveAgentModel(resolved, agentName, frontmatterModel) {
351
+ const fromModels = resolved.agents[agentName];
352
+ if (fromModels) {
353
+ return {
354
+ model: fromModels.model,
355
+ temperature: fromModels.temperature,
356
+ top_p: fromModels.top_p
357
+ };
358
+ }
359
+ if (frontmatterModel) {
360
+ return { model: frontmatterModel };
361
+ }
362
+ return {};
363
+ }
364
+ function resolveProfileInheritance(profileName, profiles) {
365
+ const visited = new Set;
366
+ return resolveProfileChain(profileName, profiles, visited, 0);
367
+ }
368
+ var MAX_INHERITANCE_DEPTH = 10;
369
+ function resolveProfileChain(name, profiles, visited, depth) {
370
+ if (depth > MAX_INHERITANCE_DEPTH) {
371
+ throw new Error(`Profile inheritance too deep (max ${MAX_INHERITANCE_DEPTH}): ${name}`);
372
+ }
373
+ if (visited.has(name)) {
374
+ throw new Error(`Circular profile inheritance detected: ${[...visited, name].join(" \u2192 ")}`);
375
+ }
376
+ const profile = profiles[name];
377
+ if (!profile) {
378
+ throw new Error(`Profile "${name}" not found`);
379
+ }
380
+ visited.add(name);
381
+ if (!profile.extends) {
382
+ return { ...profile };
383
+ }
384
+ const parent = resolveProfileChain(profile.extends, profiles, visited, depth + 1);
385
+ return {
386
+ description: profile.description ?? parent.description,
387
+ default: profile.default ?? parent.default,
388
+ small: profile.small ?? parent.small,
389
+ agents: {
390
+ ...parent.agents,
391
+ ...profile.agents
392
+ }
393
+ };
394
+ }
395
+
320
396
  // src/targets/base-target.ts
321
397
  class BaseTarget {
322
398
  supportsFeature(feature) {
@@ -335,8 +411,81 @@ class BaseTarget {
335
411
  }
336
412
  }
337
413
 
414
+ // src/utils/model-guidance.ts
415
+ function generateModelGuidanceMarkdown(resolved) {
416
+ if (!resolved.default && !resolved.small && Object.keys(resolved.agents).length === 0 && Object.keys(resolved.profiles).length === 0) {
417
+ return null;
418
+ }
419
+ const lines = [];
420
+ lines.push("# Model Configuration");
421
+ lines.push("");
422
+ lines.push("Use the following model preferences when working in this project.");
423
+ lines.push("");
424
+ if (resolved.default || resolved.small) {
425
+ lines.push("## Default Models");
426
+ lines.push("");
427
+ if (resolved.default) {
428
+ lines.push(`- **Primary model**: ${resolved.default}`);
429
+ }
430
+ if (resolved.small) {
431
+ lines.push(`- **Lightweight tasks** (titles, summaries): ${resolved.small}`);
432
+ }
433
+ lines.push("");
434
+ }
435
+ const agentEntries = Object.entries(resolved.agents);
436
+ if (agentEntries.length > 0) {
437
+ lines.push("## Agent Model Assignments");
438
+ lines.push("");
439
+ lines.push("| Agent | Model | Temperature |");
440
+ lines.push("| --- | --- | --- |");
441
+ for (const [name, assignment] of agentEntries) {
442
+ const temp = assignment.temperature !== undefined ? String(assignment.temperature) : "\u2014";
443
+ lines.push(`| ${name} | ${assignment.model} | ${temp} |`);
444
+ }
445
+ lines.push("");
446
+ }
447
+ if (Object.keys(resolved.profiles).length > 0) {
448
+ lines.push("## Available Profiles");
449
+ lines.push("");
450
+ lines.push("| Profile | Description | Default Model |");
451
+ lines.push("| --- | --- | --- |");
452
+ for (const [name, profile] of Object.entries(resolved.profiles)) {
453
+ lines.push(`| ${name} | ${profile.description ?? "\u2014"} | ${profile.default ?? "\u2014"} |`);
454
+ }
455
+ lines.push("");
456
+ }
457
+ if (resolved.activeProfile) {
458
+ lines.push(`**Active profile**: \`${resolved.activeProfile}\``);
459
+ lines.push("");
460
+ }
461
+ if (resolved.routing.length > 0) {
462
+ lines.push("## Task-Aware Routing");
463
+ lines.push("");
464
+ lines.push("Select the appropriate profile based on the task context:");
465
+ lines.push("");
466
+ lines.push("| Condition | Profile | Description |");
467
+ lines.push("| --- | --- | --- |");
468
+ for (const rule of resolved.routing) {
469
+ const conditions = Object.entries(rule.when).map(([k, v]) => `${k}=${v}`).join(", ");
470
+ const desc = rule.description ?? "\u2014";
471
+ lines.push(`| ${conditions} | ${rule.use} | ${desc} |`);
472
+ }
473
+ lines.push("");
474
+ lines.push("### Condition Reference");
475
+ lines.push("");
476
+ lines.push("- **complexity**: low | medium | high | critical");
477
+ lines.push("- **urgency**: low | normal | high");
478
+ lines.push("- **budget**: minimal | standard | premium");
479
+ lines.push("- **contextWindowNeed**: small | medium | large | max");
480
+ lines.push("- **toolUseIntensity**: none | light | heavy");
481
+ lines.push("");
482
+ }
483
+ return lines.join(`
484
+ `);
485
+ }
486
+
338
487
  // src/targets/claude-code.ts
339
- import { resolve as resolve2, join as join4 } from "path";
488
+ import { resolve, join as join4 } from "path";
340
489
  var TARGET_ID = "claudecode";
341
490
 
342
491
  class ClaudeCodeTarget extends BaseTarget {
@@ -349,18 +498,19 @@ class ClaudeCodeTarget extends BaseTarget {
349
498
  "skills",
350
499
  "hooks",
351
500
  "mcp",
352
- "ignore"
501
+ "ignore",
502
+ "models"
353
503
  ];
354
504
  generate(options) {
355
505
  const { projectRoot, baseDir, features, enabledFeatures, deleteExisting } = options;
356
- const root = resolve2(projectRoot, baseDir);
506
+ const root = resolve(projectRoot, baseDir);
357
507
  const effective = this.getEffectiveFeatures(enabledFeatures);
358
508
  const filesWritten = [];
359
509
  const filesDeleted = [];
360
510
  const warnings = [];
361
- const claudeDir = resolve2(root, ".claude");
511
+ const claudeDir = resolve(root, ".claude");
362
512
  if (effective.includes("rules")) {
363
- const rulesDir = resolve2(claudeDir, "rules");
513
+ const rulesDir = resolve(claudeDir, "rules");
364
514
  if (deleteExisting) {
365
515
  removeIfExists(rulesDir);
366
516
  filesDeleted.push(rulesDir);
@@ -373,7 +523,7 @@ class ClaudeCodeTarget extends BaseTarget {
373
523
  const claudeMd = rootRules.map((r) => r.content).join(`
374
524
 
375
525
  `);
376
- const filepath = resolve2(claudeDir, "CLAUDE.md");
526
+ const filepath = resolve(claudeDir, "CLAUDE.md");
377
527
  writeGeneratedFile(filepath, claudeMd);
378
528
  filesWritten.push(filepath);
379
529
  }
@@ -384,21 +534,30 @@ class ClaudeCodeTarget extends BaseTarget {
384
534
  }
385
535
  }
386
536
  if (effective.includes("agents")) {
387
- const agentsDir = resolve2(claudeDir, "agents");
537
+ const agentsDir = resolve(claudeDir, "agents");
388
538
  if (deleteExisting) {
389
539
  removeIfExists(agentsDir);
390
540
  filesDeleted.push(agentsDir);
391
541
  }
392
542
  ensureDir(agentsDir);
543
+ const resolvedModels = features.models ? resolveModels(features.models, options.modelProfile, TARGET_ID) : null;
393
544
  const agents = features.agents.filter((a) => agentMatchesTarget(a, TARGET_ID));
394
545
  for (const agent of agents) {
395
546
  const filepath = join4(agentsDir, `${agent.name}.md`);
396
- writeGeneratedFile(filepath, agent.content);
547
+ const cc = agent.meta.claudecode ?? {};
548
+ const modelsAgent = resolvedModels?.agents[agent.name];
549
+ const agentModel = modelsAgent?.model ?? cc.model;
550
+ let content = agent.content;
551
+ if (agentModel) {
552
+ content = `<!-- model: ${agentModel} -->
553
+ ${content}`;
554
+ }
555
+ writeGeneratedFile(filepath, content);
397
556
  filesWritten.push(filepath);
398
557
  }
399
558
  }
400
559
  if (effective.includes("skills")) {
401
- const skillsDir = resolve2(claudeDir, "skills");
560
+ const skillsDir = resolve(claudeDir, "skills");
402
561
  if (deleteExisting) {
403
562
  removeIfExists(skillsDir);
404
563
  filesDeleted.push(skillsDir);
@@ -414,7 +573,7 @@ class ClaudeCodeTarget extends BaseTarget {
414
573
  }
415
574
  }
416
575
  if (effective.includes("commands")) {
417
- const commandsDir = resolve2(claudeDir, "commands");
576
+ const commandsDir = resolve(claudeDir, "commands");
418
577
  if (deleteExisting) {
419
578
  removeIfExists(commandsDir);
420
579
  filesDeleted.push(commandsDir);
@@ -427,10 +586,21 @@ class ClaudeCodeTarget extends BaseTarget {
427
586
  filesWritten.push(filepath);
428
587
  }
429
588
  }
589
+ if (effective.includes("models") && features.models) {
590
+ const resolved = resolveModels(features.models, options.modelProfile, TARGET_ID);
591
+ const guidance = generateModelGuidanceMarkdown(resolved);
592
+ if (guidance) {
593
+ const rulesDir = resolve(claudeDir, "rules");
594
+ ensureDir(rulesDir);
595
+ const filepath = join4(rulesDir, "model-config.md");
596
+ writeGeneratedFile(filepath, guidance);
597
+ filesWritten.push(filepath);
598
+ }
599
+ }
430
600
  if (effective.includes("hooks") || effective.includes("mcp") || effective.includes("ignore")) {
431
601
  const settings = buildClaudeSettings(options, effective);
432
602
  if (Object.keys(settings).length > 0) {
433
- const filepath = resolve2(claudeDir, "settings.json");
603
+ const filepath = resolve(claudeDir, "settings.json");
434
604
  const existing = readJsonOrNull(filepath) ?? {};
435
605
  const merged = { ...existing, ...settings };
436
606
  writeGeneratedJson(filepath, merged, { header: false });
@@ -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 = {}) {
@@ -244,7 +216,7 @@ class BaseTarget {
244
216
  }
245
217
 
246
218
  // src/targets/codex-cli.ts
247
- import { resolve as resolve2, join as join3 } from "path";
219
+ import { resolve, join as join3 } from "path";
248
220
  var TARGET_ID = "codexcli";
249
221
 
250
222
  class CodexCliTarget extends BaseTarget {
@@ -253,14 +225,14 @@ class CodexCliTarget extends BaseTarget {
253
225
  supportedFeatures = ["rules", "skills", "mcp", "hooks"];
254
226
  generate(options) {
255
227
  const { projectRoot, baseDir, features, enabledFeatures, deleteExisting } = options;
256
- const root = resolve2(projectRoot, baseDir);
228
+ const root = resolve(projectRoot, baseDir);
257
229
  const effective = this.getEffectiveFeatures(enabledFeatures);
258
230
  const filesWritten = [];
259
231
  const filesDeleted = [];
260
232
  const warnings = [];
261
- const codexDir = resolve2(root, ".codex");
233
+ const codexDir = resolve(root, ".codex");
262
234
  if (effective.includes("rules")) {
263
- const memoriesDir = resolve2(codexDir, "memories");
235
+ const memoriesDir = resolve(codexDir, "memories");
264
236
  if (deleteExisting) {
265
237
  removeIfExists(memoriesDir);
266
238
  filesDeleted.push(memoriesDir);
@@ -274,7 +246,7 @@ class CodexCliTarget extends BaseTarget {
274
246
  }
275
247
  }
276
248
  if (effective.includes("skills")) {
277
- const skillsDir = resolve2(codexDir, "skills");
249
+ const skillsDir = resolve(codexDir, "skills");
278
250
  if (deleteExisting) {
279
251
  removeIfExists(skillsDir);
280
252
  filesDeleted.push(skillsDir);