agentpacks 1.7.6 → 1.7.8

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 (133) hide show
  1. package/README.md +69 -742
  2. package/dist/api.d.ts +15 -15
  3. package/dist/api.js +2706 -2706
  4. package/dist/cli/export-cmd.js +364 -364
  5. package/dist/cli/generate.js +1409 -1409
  6. package/dist/cli/import-cmd.js +249 -249
  7. package/dist/cli/info.js +31 -31
  8. package/dist/cli/init.js +6 -6
  9. package/dist/cli/install.js +141 -141
  10. package/dist/cli/login.js +31 -31
  11. package/dist/cli/models-explain.js +514 -514
  12. package/dist/cli/pack/create.js +6 -6
  13. package/dist/cli/pack/enable.js +2 -2
  14. package/dist/cli/pack/list.js +362 -362
  15. package/dist/cli/pack/validate.js +119 -119
  16. package/dist/cli/publish.js +42 -42
  17. package/dist/cli/search.js +31 -31
  18. package/dist/core/config.js +3 -3
  19. package/dist/core/feature-merger.d.ts +5 -5
  20. package/dist/core/feature-merger.js +4 -4
  21. package/dist/core/index.d.ts +4 -4
  22. package/dist/core/index.js +633 -633
  23. package/dist/core/lockfile.js +1 -1
  24. package/dist/core/metarepo.js +3 -3
  25. package/dist/core/pack-loader.d.ts +6 -6
  26. package/dist/core/pack-loader.js +362 -362
  27. package/dist/core/profile-resolver.d.ts +1 -1
  28. package/dist/exporters/cursor-plugin.d.ts +12 -0
  29. package/dist/exporters/cursor-plugin.js +46 -46
  30. package/dist/exporters/index.d.ts +1 -1
  31. package/dist/exporters/index.js +46 -46
  32. package/dist/features/agents.js +4 -4
  33. package/dist/features/commands.js +4 -4
  34. package/dist/features/hooks.js +4 -4
  35. package/dist/features/index.d.ts +8 -8
  36. package/dist/features/index.js +350 -350
  37. package/dist/features/mcp.js +4 -4
  38. package/dist/features/models.js +4 -4
  39. package/dist/features/plugins.js +5 -5
  40. package/dist/features/rules.js +4 -4
  41. package/dist/features/skills.js +5 -5
  42. package/dist/importers/claude-code.js +6 -6
  43. package/dist/importers/cursor.js +7 -7
  44. package/dist/importers/opencode.js +7 -7
  45. package/dist/importers/rulesync.js +7 -7
  46. package/dist/index.js +2674 -2674
  47. package/dist/node/api.js +2706 -2706
  48. package/dist/node/cli/export-cmd.js +364 -364
  49. package/dist/node/cli/generate.js +1409 -1409
  50. package/dist/node/cli/import-cmd.js +249 -249
  51. package/dist/node/cli/info.js +31 -31
  52. package/dist/node/cli/init.js +6 -6
  53. package/dist/node/cli/install.js +141 -141
  54. package/dist/node/cli/login.js +31 -31
  55. package/dist/node/cli/models-explain.js +514 -514
  56. package/dist/node/cli/pack/create.js +6 -6
  57. package/dist/node/cli/pack/enable.js +2 -2
  58. package/dist/node/cli/pack/list.js +362 -362
  59. package/dist/node/cli/pack/validate.js +119 -119
  60. package/dist/node/cli/publish.js +42 -42
  61. package/dist/node/cli/search.js +31 -31
  62. package/dist/node/core/config.js +3 -3
  63. package/dist/node/core/feature-merger.js +4 -4
  64. package/dist/node/core/index.js +633 -633
  65. package/dist/node/core/lockfile.js +1 -1
  66. package/dist/node/core/metarepo.js +3 -3
  67. package/dist/node/core/pack-loader.js +362 -362
  68. package/dist/node/exporters/cursor-plugin.js +46 -46
  69. package/dist/node/exporters/index.js +46 -46
  70. package/dist/node/features/agents.js +4 -4
  71. package/dist/node/features/commands.js +4 -4
  72. package/dist/node/features/hooks.js +4 -4
  73. package/dist/node/features/index.js +350 -350
  74. package/dist/node/features/mcp.js +4 -4
  75. package/dist/node/features/models.js +4 -4
  76. package/dist/node/features/plugins.js +5 -5
  77. package/dist/node/features/rules.js +4 -4
  78. package/dist/node/features/skills.js +5 -5
  79. package/dist/node/importers/claude-code.js +6 -6
  80. package/dist/node/importers/cursor.js +7 -7
  81. package/dist/node/importers/opencode.js +7 -7
  82. package/dist/node/importers/rulesync.js +7 -7
  83. package/dist/node/index.js +2674 -2674
  84. package/dist/node/sources/git.js +2 -2
  85. package/dist/node/sources/index.js +138 -138
  86. package/dist/node/sources/local.js +1 -1
  87. package/dist/node/sources/npm.js +3 -3
  88. package/dist/node/sources/registry.js +35 -35
  89. package/dist/node/targets/additional-targets.js +43 -43
  90. package/dist/node/targets/agents-md.js +4 -4
  91. package/dist/node/targets/claude-code.js +86 -86
  92. package/dist/node/targets/codex-cli.js +6 -6
  93. package/dist/node/targets/copilot.js +46 -46
  94. package/dist/node/targets/cursor.js +68 -68
  95. package/dist/node/targets/gemini-cli.js +25 -25
  96. package/dist/node/targets/generic-md-target.js +43 -43
  97. package/dist/node/targets/index.js +911 -911
  98. package/dist/node/targets/mistral-vibe.js +46 -46
  99. package/dist/node/targets/opencode.js +68 -68
  100. package/dist/node/targets/registry.js +911 -911
  101. package/dist/node/utils/credentials.js +2 -2
  102. package/dist/node/utils/filesystem.js +4 -4
  103. package/dist/node/utils/global.js +1 -1
  104. package/dist/node/utils/tarball.js +2 -2
  105. package/dist/sources/git.js +2 -2
  106. package/dist/sources/index.d.ts +6 -6
  107. package/dist/sources/index.js +138 -138
  108. package/dist/sources/local.js +1 -1
  109. package/dist/sources/npm.d.ts +3 -0
  110. package/dist/sources/npm.js +3 -3
  111. package/dist/sources/registry.js +35 -35
  112. package/dist/targets/additional-targets.js +43 -43
  113. package/dist/targets/agents-md.js +4 -4
  114. package/dist/targets/claude-code.js +86 -86
  115. package/dist/targets/codex-cli.js +6 -6
  116. package/dist/targets/copilot.js +46 -46
  117. package/dist/targets/cursor.js +68 -68
  118. package/dist/targets/gemini-cli.js +25 -25
  119. package/dist/targets/generic-md-target.js +43 -43
  120. package/dist/targets/index.d.ts +6 -6
  121. package/dist/targets/index.js +911 -911
  122. package/dist/targets/mistral-vibe.js +46 -46
  123. package/dist/targets/opencode.js +68 -68
  124. package/dist/targets/registry.js +911 -911
  125. package/dist/utils/credentials.js +2 -2
  126. package/dist/utils/filesystem.js +4 -4
  127. package/dist/utils/global.d.ts +3 -0
  128. package/dist/utils/global.js +1 -1
  129. package/dist/utils/tarball.js +2 -2
  130. package/package.json +5 -5
  131. package/templates/pack/models.json +36 -36
  132. package/templates/pack/pack.json +8 -8
  133. package/templates/workspace/agentpacks.jsonc +24 -24
@@ -2,10 +2,10 @@
2
2
  var __require = import.meta.require;
3
3
 
4
4
  // src/core/config.ts
5
- import { z } from "zod";
6
- import { readFileSync, existsSync } from "fs";
7
- import { resolve } from "path";
5
+ import { existsSync, readFileSync } from "fs";
8
6
  import { parse as parseJsonc } from "jsonc-parser";
7
+ import { resolve } from "path";
8
+ import { z } from "zod";
9
9
  var TARGET_IDS = [
10
10
  "opencode",
11
11
  "cursor",
@@ -138,13 +138,13 @@ function resolveTargets(config) {
138
138
  import {
139
139
  existsSync as existsSync2,
140
140
  mkdirSync,
141
- readFileSync as readFileSync2,
142
- writeFileSync,
143
141
  readdirSync,
142
+ readFileSync as readFileSync2,
144
143
  rmSync,
145
- statSync
144
+ statSync,
145
+ writeFileSync
146
146
  } from "fs";
147
- import { dirname, relative, join } from "path";
147
+ import { dirname, join, relative } from "path";
148
148
  var GENERATED_HEADER_MD = "<!-- Generated by agentpacks. DO NOT EDIT. -->";
149
149
  var GENERATED_HEADER_JSON = "// Generated by agentpacks. DO NOT EDIT.";
150
150
  var GENERATED_HEADER_JS = "// Generated by agentpacks. DO NOT EDIT.";
@@ -244,116 +244,8 @@ function getHeader(type) {
244
244
  }
245
245
  }
246
246
 
247
- // src/utils/frontmatter.ts
248
- import matter from "gray-matter";
249
- function parseFrontmatter(source) {
250
- const { data, content } = matter(source);
251
- return {
252
- data,
253
- content: content.trim(),
254
- raw: source
255
- };
256
- }
257
- function serializeFrontmatter(data, content) {
258
- const filtered = Object.fromEntries(Object.entries(data).filter(([, v]) => v !== undefined));
259
- if (Object.keys(filtered).length === 0) {
260
- return content;
261
- }
262
- return matter.stringify(content, filtered);
263
- }
264
-
265
- // src/features/skills.ts
266
- import { readFileSync as readFileSync3, existsSync as existsSync3 } from "fs";
267
- import { basename, join as join2 } from "path";
268
- var SKILL_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
269
- var SKILL_NAME_MAX_LENGTH = 64;
270
- function parseSkills(skillsDir, packName) {
271
- const dirs = listDirs(skillsDir);
272
- const skills = [];
273
- for (const dir of dirs) {
274
- const skillMd = join2(dir, "SKILL.md");
275
- if (existsSync3(skillMd)) {
276
- skills.push(parseSkillFile(skillMd, dir, packName));
277
- }
278
- }
279
- return skills;
280
- }
281
- function parseSkillFile(filepath, skillDir, packName) {
282
- const raw = readFileSync3(filepath, "utf-8");
283
- const { data, content } = parseFrontmatter(raw);
284
- return {
285
- name: data.name ?? basename(skillDir),
286
- sourcePath: filepath,
287
- sourceDir: skillDir,
288
- packName,
289
- meta: data,
290
- content
291
- };
292
- }
293
- function buildSkillFrontmatter(skill) {
294
- return {
295
- ...skill.meta,
296
- name: skill.name
297
- };
298
- }
299
- function serializeSkill(skill) {
300
- return serializeFrontmatter(buildSkillFrontmatter(skill), skill.content);
301
- }
302
- function normalizeImportedSkillMarkdown(source, skillName) {
303
- const { data, content } = parseFrontmatter(source);
304
- const normalized = {
305
- ...data,
306
- name: skillName
307
- };
308
- let addedDescription = false;
309
- const description = normalized.description;
310
- if (typeof description !== "string" || description.trim().length === 0) {
311
- normalized.description = `Imported skill: ${skillName}`;
312
- addedDescription = true;
313
- }
314
- return {
315
- content: serializeFrontmatter(normalized, content),
316
- addedDescription
317
- };
318
- }
319
- function validateAgentSkillsFrontmatter(skill) {
320
- const errors = [];
321
- const dirName = basename(skill.sourceDir);
322
- const declaredName = skill.meta.name;
323
- if (typeof declaredName !== "string" || declaredName.trim().length === 0) {
324
- errors.push('Missing required frontmatter field "name".');
325
- } else {
326
- if (declaredName.length > SKILL_NAME_MAX_LENGTH) {
327
- errors.push(`Invalid "name": must be at most ${SKILL_NAME_MAX_LENGTH} characters.`);
328
- }
329
- if (!SKILL_NAME_PATTERN.test(declaredName)) {
330
- errors.push('Invalid "name": use lowercase letters, numbers, and single hyphens only.');
331
- }
332
- if (declaredName !== dirName) {
333
- errors.push(`Invalid "name": must match containing directory "${dirName}".`);
334
- }
335
- }
336
- const description = skill.meta.description;
337
- if (typeof description !== "string" || description.trim().length === 0) {
338
- errors.push('Missing required frontmatter field "description".');
339
- }
340
- const allowedTools = skill.meta["allowed-tools"];
341
- if (allowedTools !== undefined && (!Array.isArray(allowedTools) || allowedTools.some((tool) => typeof tool !== "string" || tool.length === 0))) {
342
- errors.push('Invalid "allowed-tools": expected an array of non-empty strings.');
343
- }
344
- return errors;
345
- }
346
- function skillMatchesTarget(skill, targetId) {
347
- const { targets } = skill.meta;
348
- if (!targets || targets === "*")
349
- return true;
350
- if (Array.isArray(targets) && targets.includes("*"))
351
- return true;
352
- return Array.isArray(targets) && targets.includes(targetId);
353
- }
354
-
355
247
  // src/features/models.ts
356
- import { join as join3 } from "path";
248
+ import { join as join2 } from "path";
357
249
  import { z as z2 } from "zod";
358
250
  var SECRET_PATTERNS = [
359
251
  /["']api[_-]?key["']\s*:/i,
@@ -413,7 +305,7 @@ var ModelsSchema = z2.object({
413
305
  })).optional()
414
306
  });
415
307
  function parseModels(packDir, packName) {
416
- const modelsPath = join3(packDir, "models.json");
308
+ const modelsPath = join2(packDir, "models.json");
417
309
  const raw = readJsonOrNull(modelsPath);
418
310
  if (!raw)
419
311
  return null;
@@ -521,10 +413,118 @@ function scanModelsForSecrets(config) {
521
413
  return warnings;
522
414
  }
523
415
 
416
+ // src/utils/frontmatter.ts
417
+ import matter from "gray-matter";
418
+ function parseFrontmatter(source) {
419
+ const { data, content } = matter(source);
420
+ return {
421
+ data,
422
+ content: content.trim(),
423
+ raw: source
424
+ };
425
+ }
426
+ function serializeFrontmatter(data, content) {
427
+ const filtered = Object.fromEntries(Object.entries(data).filter(([, v]) => v !== undefined));
428
+ if (Object.keys(filtered).length === 0) {
429
+ return content;
430
+ }
431
+ return matter.stringify(content, filtered);
432
+ }
433
+
434
+ // src/features/skills.ts
435
+ import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
436
+ import { basename, join as join3 } from "path";
437
+ var SKILL_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
438
+ var SKILL_NAME_MAX_LENGTH = 64;
439
+ function parseSkills(skillsDir, packName) {
440
+ const dirs = listDirs(skillsDir);
441
+ const skills = [];
442
+ for (const dir of dirs) {
443
+ const skillMd = join3(dir, "SKILL.md");
444
+ if (existsSync3(skillMd)) {
445
+ skills.push(parseSkillFile(skillMd, dir, packName));
446
+ }
447
+ }
448
+ return skills;
449
+ }
450
+ function parseSkillFile(filepath, skillDir, packName) {
451
+ const raw = readFileSync3(filepath, "utf-8");
452
+ const { data, content } = parseFrontmatter(raw);
453
+ return {
454
+ name: data.name ?? basename(skillDir),
455
+ sourcePath: filepath,
456
+ sourceDir: skillDir,
457
+ packName,
458
+ meta: data,
459
+ content
460
+ };
461
+ }
462
+ function buildSkillFrontmatter(skill) {
463
+ return {
464
+ ...skill.meta,
465
+ name: skill.name
466
+ };
467
+ }
468
+ function serializeSkill(skill) {
469
+ return serializeFrontmatter(buildSkillFrontmatter(skill), skill.content);
470
+ }
471
+ function normalizeImportedSkillMarkdown(source, skillName) {
472
+ const { data, content } = parseFrontmatter(source);
473
+ const normalized = {
474
+ ...data,
475
+ name: skillName
476
+ };
477
+ let addedDescription = false;
478
+ const description = normalized.description;
479
+ if (typeof description !== "string" || description.trim().length === 0) {
480
+ normalized.description = `Imported skill: ${skillName}`;
481
+ addedDescription = true;
482
+ }
483
+ return {
484
+ content: serializeFrontmatter(normalized, content),
485
+ addedDescription
486
+ };
487
+ }
488
+ function validateAgentSkillsFrontmatter(skill) {
489
+ const errors = [];
490
+ const dirName = basename(skill.sourceDir);
491
+ const declaredName = skill.meta.name;
492
+ if (typeof declaredName !== "string" || declaredName.trim().length === 0) {
493
+ errors.push('Missing required frontmatter field "name".');
494
+ } else {
495
+ if (declaredName.length > SKILL_NAME_MAX_LENGTH) {
496
+ errors.push(`Invalid "name": must be at most ${SKILL_NAME_MAX_LENGTH} characters.`);
497
+ }
498
+ if (!SKILL_NAME_PATTERN.test(declaredName)) {
499
+ errors.push('Invalid "name": use lowercase letters, numbers, and single hyphens only.');
500
+ }
501
+ if (declaredName !== dirName) {
502
+ errors.push(`Invalid "name": must match containing directory "${dirName}".`);
503
+ }
504
+ }
505
+ const description = skill.meta.description;
506
+ if (typeof description !== "string" || description.trim().length === 0) {
507
+ errors.push('Missing required frontmatter field "description".');
508
+ }
509
+ const allowedTools = skill.meta["allowed-tools"];
510
+ if (allowedTools !== undefined && (!Array.isArray(allowedTools) || allowedTools.some((tool) => typeof tool !== "string" || tool.length === 0))) {
511
+ errors.push('Invalid "allowed-tools": expected an array of non-empty strings.');
512
+ }
513
+ return errors;
514
+ }
515
+ function skillMatchesTarget(skill, targetId) {
516
+ const { targets } = skill.meta;
517
+ if (!targets || targets === "*")
518
+ return true;
519
+ if (Array.isArray(targets) && targets.includes("*"))
520
+ return true;
521
+ return Array.isArray(targets) && targets.includes(targetId);
522
+ }
523
+
524
524
  // src/cli/pack/validate.ts
525
- import { existsSync as existsSync4 } from "fs";
526
- import { resolve as resolve2, join as join4, basename as basename2 } from "path";
527
525
  import chalk from "chalk";
526
+ import { existsSync as existsSync4 } from "fs";
527
+ import { basename as basename2, join as join4, resolve as resolve2 } from "path";
528
528
  function runPackValidate(projectRoot) {
529
529
  const config = loadWorkspaceConfig(projectRoot);
530
530
  let hasErrors = false;
@@ -2,10 +2,10 @@
2
2
  var __require = import.meta.require;
3
3
 
4
4
  // src/core/config.ts
5
- import { z } from "zod";
6
- import { readFileSync, existsSync } from "fs";
7
- import { resolve } from "path";
5
+ import { existsSync, readFileSync } from "fs";
8
6
  import { parse as parseJsonc } from "jsonc-parser";
7
+ import { resolve } from "path";
8
+ import { z } from "zod";
9
9
  var TARGET_IDS = [
10
10
  "opencode",
11
11
  "cursor",
@@ -138,13 +138,13 @@ function resolveTargets(config) {
138
138
  import {
139
139
  existsSync as existsSync2,
140
140
  mkdirSync,
141
- readFileSync as readFileSync2,
142
- writeFileSync,
143
141
  readdirSync,
142
+ readFileSync as readFileSync2,
144
143
  rmSync,
145
- statSync
144
+ statSync,
145
+ writeFileSync
146
146
  } from "fs";
147
- import { dirname, relative, join } from "path";
147
+ import { dirname, join, relative } from "path";
148
148
  var GENERATED_HEADER_MD = "<!-- Generated by agentpacks. DO NOT EDIT. -->";
149
149
  var GENERATED_HEADER_JSON = "// Generated by agentpacks. DO NOT EDIT.";
150
150
  var GENERATED_HEADER_JS = "// Generated by agentpacks. DO NOT EDIT.";
@@ -413,6 +413,37 @@ function scanModelsForSecrets(config) {
413
413
  return warnings;
414
414
  }
415
415
 
416
+ // src/utils/credentials.ts
417
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
418
+ import { homedir } from "os";
419
+ import { dirname as dirname2, join as join3 } from "path";
420
+ var CONFIG_DIR = join3(homedir(), ".config", "agentpacks");
421
+ var CREDENTIALS_FILE = join3(CONFIG_DIR, "credentials.json");
422
+ function loadCredentials() {
423
+ if (!existsSync3(CREDENTIALS_FILE)) {
424
+ return { registryUrl: "https://registry.agentpacks.dev" };
425
+ }
426
+ try {
427
+ const raw = readFileSync3(CREDENTIALS_FILE, "utf-8");
428
+ return JSON.parse(raw);
429
+ } catch {
430
+ return { registryUrl: "https://registry.agentpacks.dev" };
431
+ }
432
+ }
433
+ function saveCredentials(credentials) {
434
+ mkdirSync2(dirname2(CREDENTIALS_FILE), { recursive: true });
435
+ writeFileSync2(CREDENTIALS_FILE, JSON.stringify(credentials, null, 2) + `
436
+ `, {
437
+ mode: 384
438
+ });
439
+ }
440
+ function clearCredentials() {
441
+ if (existsSync3(CREDENTIALS_FILE)) {
442
+ writeFileSync2(CREDENTIALS_FILE, JSON.stringify({ registryUrl: "https://registry.agentpacks.dev" }) + `
443
+ `);
444
+ }
445
+ }
446
+
416
447
  // src/utils/registry-client.ts
417
448
  var DEFAULT_REGISTRY_URL = "https://registry.agentpacks.dev";
418
449
  function createRegistryClient(config) {
@@ -548,43 +579,12 @@ class RegistryApiError extends Error {
548
579
  }
549
580
  }
550
581
 
551
- // src/utils/credentials.ts
552
- import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "fs";
553
- import { join as join3, dirname as dirname2 } from "path";
554
- import { homedir } from "os";
555
- var CONFIG_DIR = join3(homedir(), ".config", "agentpacks");
556
- var CREDENTIALS_FILE = join3(CONFIG_DIR, "credentials.json");
557
- function loadCredentials() {
558
- if (!existsSync3(CREDENTIALS_FILE)) {
559
- return { registryUrl: "https://registry.agentpacks.dev" };
560
- }
561
- try {
562
- const raw = readFileSync3(CREDENTIALS_FILE, "utf-8");
563
- return JSON.parse(raw);
564
- } catch {
565
- return { registryUrl: "https://registry.agentpacks.dev" };
566
- }
567
- }
568
- function saveCredentials(credentials) {
569
- mkdirSync2(dirname2(CREDENTIALS_FILE), { recursive: true });
570
- writeFileSync2(CREDENTIALS_FILE, JSON.stringify(credentials, null, 2) + `
571
- `, {
572
- mode: 384
573
- });
574
- }
575
- function clearCredentials() {
576
- if (existsSync3(CREDENTIALS_FILE)) {
577
- writeFileSync2(CREDENTIALS_FILE, JSON.stringify({ registryUrl: "https://registry.agentpacks.dev" }) + `
578
- `);
579
- }
580
- }
581
-
582
582
  // src/utils/tarball.ts
583
583
  import { execSync } from "child_process";
584
- import { readFileSync as readFileSync4, existsSync as existsSync4, mkdirSync as mkdirSync3, rmSync as rmSync2 } from "fs";
585
- import { join as join4, resolve as resolve2 } from "path";
586
584
  import { createHash } from "crypto";
585
+ import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync4, rmSync as rmSync2 } from "fs";
587
586
  import { tmpdir } from "os";
587
+ import { join as join4, resolve as resolve2 } from "path";
588
588
  async function createTarball(packDir) {
589
589
  const absDir = resolve2(packDir);
590
590
  const tmpFile = join4(tmpdir(), `agentpacks-${Date.now()}.tgz`);
@@ -622,9 +622,9 @@ function computeTarballIntegrity(data) {
622
622
  }
623
623
 
624
624
  // src/cli/publish.ts
625
- import { resolve as resolve3 } from "path";
626
- import { existsSync as existsSync5 } from "fs";
627
625
  import chalk from "chalk";
626
+ import { existsSync as existsSync5 } from "fs";
627
+ import { resolve as resolve3 } from "path";
628
628
  async function runPublish(projectRoot, options) {
629
629
  const credentials = loadCredentials();
630
630
  if (!credentials.token) {
@@ -1,6 +1,37 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
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
+
4
35
  // src/utils/registry-client.ts
5
36
  var DEFAULT_REGISTRY_URL = "https://registry.agentpacks.dev";
6
37
  function createRegistryClient(config) {
@@ -136,37 +167,6 @@ class RegistryApiError extends Error {
136
167
  }
137
168
  }
138
169
 
139
- // src/utils/credentials.ts
140
- import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
141
- import { join, dirname } from "path";
142
- import { homedir } from "os";
143
- var CONFIG_DIR = join(homedir(), ".config", "agentpacks");
144
- var CREDENTIALS_FILE = join(CONFIG_DIR, "credentials.json");
145
- function loadCredentials() {
146
- if (!existsSync(CREDENTIALS_FILE)) {
147
- return { registryUrl: "https://registry.agentpacks.dev" };
148
- }
149
- try {
150
- const raw = readFileSync(CREDENTIALS_FILE, "utf-8");
151
- return JSON.parse(raw);
152
- } catch {
153
- return { registryUrl: "https://registry.agentpacks.dev" };
154
- }
155
- }
156
- function saveCredentials(credentials) {
157
- mkdirSync(dirname(CREDENTIALS_FILE), { recursive: true });
158
- writeFileSync(CREDENTIALS_FILE, JSON.stringify(credentials, null, 2) + `
159
- `, {
160
- mode: 384
161
- });
162
- }
163
- function clearCredentials() {
164
- if (existsSync(CREDENTIALS_FILE)) {
165
- writeFileSync(CREDENTIALS_FILE, JSON.stringify({ registryUrl: "https://registry.agentpacks.dev" }) + `
166
- `);
167
- }
168
- }
169
-
170
170
  // src/cli/search.ts
171
171
  import chalk from "chalk";
172
172
  async function runSearch(query, options) {
@@ -2,10 +2,10 @@
2
2
  var __require = import.meta.require;
3
3
 
4
4
  // src/core/config.ts
5
- import { z } from "zod";
6
- import { readFileSync, existsSync } from "fs";
7
- import { resolve } from "path";
5
+ import { existsSync, readFileSync } from "fs";
8
6
  import { parse as parseJsonc } from "jsonc-parser";
7
+ import { resolve } from "path";
8
+ import { z } from "zod";
9
9
  var TARGET_IDS = [
10
10
  "opencode",
11
11
  "cursor",
@@ -1,12 +1,12 @@
1
- import type { LoadedPack } from './pack-loader.js';
2
- import type { ParsedRule } from '../features/rules.js';
3
- import type { ParsedCommand } from '../features/commands.js';
4
1
  import type { ParsedAgent } from '../features/agents.js';
5
- import type { ParsedSkill } from '../features/skills.js';
2
+ import type { ParsedCommand } from '../features/commands.js';
6
3
  import type { ParsedHooks } from '../features/hooks.js';
7
- import type { ParsedPlugin } from '../features/plugins.js';
8
4
  import type { McpServerEntry } from '../features/mcp.js';
9
5
  import { type ModelsConfig } from '../features/models.js';
6
+ import type { ParsedPlugin } from '../features/plugins.js';
7
+ import type { ParsedRule } from '../features/rules.js';
8
+ import type { ParsedSkill } from '../features/skills.js';
9
+ import type { LoadedPack } from './pack-loader.js';
10
10
  /**
11
11
  * Merged features from all active packs.
12
12
  */
@@ -5,13 +5,13 @@ var __require = import.meta.require;
5
5
  import {
6
6
  existsSync,
7
7
  mkdirSync,
8
- readFileSync,
9
- writeFileSync,
10
8
  readdirSync,
9
+ readFileSync,
11
10
  rmSync,
12
- statSync
11
+ statSync,
12
+ writeFileSync
13
13
  } from "fs";
14
- import { dirname, relative, join } from "path";
14
+ import { dirname, join, relative } from "path";
15
15
  var GENERATED_HEADER_MD = "<!-- Generated by agentpacks. DO NOT EDIT. -->";
16
16
  var GENERATED_HEADER_JSON = "// Generated by agentpacks. DO NOT EDIT.";
17
17
  var GENERATED_HEADER_JS = "// Generated by agentpacks. DO NOT EDIT.";
@@ -1,5 +1,5 @@
1
- export { type TargetId, type FeatureId, type RepoMode, type PackManifest, type WorkspaceConfig, TARGET_IDS, FEATURE_IDS, REPO_MODES, PackManifestSchema, WorkspaceConfigSchema, loadWorkspaceConfig, loadPackManifest, resolveFeatures, resolveTargets, } from './config.js';
2
- export { PackLoader } from './pack-loader.js';
1
+ export { FEATURE_IDS, type FeatureId, loadPackManifest, loadWorkspaceConfig, type PackManifest, PackManifestSchema, REPO_MODES, type RepoMode, resolveFeatures, resolveTargets, TARGET_IDS, type TargetId, type WorkspaceConfig, WorkspaceConfigSchema, } from './config.js';
2
+ export { buildDependencyGraph, type DependencyNode, type DependencyResolution, resolveDependencies, } from './dependency-resolver.js';
3
3
  export { FeatureMerger } from './feature-merger.js';
4
- export { type Lockfile, type LockfileSourceEntry, type LockfileSkillEntry, loadLockfile, saveLockfile, getLockedSource, setLockedSource, computeIntegrity, isLockfileFrozenValid, } from './lockfile.js';
5
- export { type DependencyNode, type DependencyResolution, buildDependencyGraph, resolveDependencies, } from './dependency-resolver.js';
4
+ export { computeIntegrity, getLockedSource, isLockfileFrozenValid, type Lockfile, type LockfileSkillEntry, type LockfileSourceEntry, loadLockfile, saveLockfile, setLockedSource, } from './lockfile.js';
5
+ export { PackLoader } from './pack-loader.js';