allagents 1.5.0 → 1.6.1

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 (2) hide show
  1. package/dist/index.js +376 -245
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7465,9 +7465,26 @@ __export(exports_constants, {
7465
7465
  function getHomeDir() {
7466
7466
  return process.env.HOME || process.env.USERPROFILE || "~";
7467
7467
  }
7468
- function generateWorkspaceRules(repositories) {
7468
+ function generateWorkspaceRules(repositories, skills = []) {
7469
7469
  const repoList = repositories.map((r) => `- ${r.path}${r.description ? ` - ${r.description}` : ""}`).join(`
7470
7470
  `);
7471
+ let skillsBlock = "";
7472
+ if (skills.length > 0) {
7473
+ const skillEntries = skills.map((s) => `<skill>
7474
+ <name>${s.name}</name>
7475
+ <description>${s.description}</description>
7476
+ <location>${s.location}</location>
7477
+ </skill>`).join(`
7478
+ `);
7479
+ skillsBlock = `
7480
+ ## Repository Skills
7481
+ When a task matches a skill description, fetch the full instructions from its location.
7482
+
7483
+ <available_skills>
7484
+ ${skillEntries}
7485
+ </available_skills>
7486
+ `;
7487
+ }
7471
7488
  return `
7472
7489
  <!-- WORKSPACE-RULES:START -->
7473
7490
  ## Workspace Repositories
@@ -7477,7 +7494,7 @@ ${repoList}
7477
7494
  ## Rule: Use Repository Paths
7478
7495
  TRIGGER: File operations (read, search, modify)
7479
7496
  ACTION: Use the repository paths listed above, not assumptions
7480
- <!-- WORKSPACE-RULES:END -->
7497
+ ${skillsBlock}<!-- WORKSPACE-RULES:END -->
7481
7498
  `;
7482
7499
  }
7483
7500
  var CONFIG_DIR = ".allagents", SYNC_STATE_FILE = "sync-state.json", WORKSPACE_CONFIG_FILE = "workspace.yaml", WORKSPACE_CONFIG_PATH, AGENT_FILES;
@@ -11488,7 +11505,8 @@ var init_workspace_config = __esm(() => {
11488
11505
  name: exports_external.string().optional(),
11489
11506
  source: exports_external.string().optional(),
11490
11507
  repo: exports_external.string().optional(),
11491
- description: exports_external.string().optional()
11508
+ description: exports_external.string().optional(),
11509
+ skills: exports_external.union([exports_external.boolean(), exports_external.array(exports_external.string())]).optional()
11492
11510
  });
11493
11511
  WorkspaceFileSchema = exports_external.union([
11494
11512
  exports_external.string(),
@@ -25482,8 +25500,8 @@ var init_skill = __esm(() => {
25482
25500
  import { readFile as readFile3, writeFile, mkdir as mkdir3, cp, readdir as readdir2 } from "node:fs/promises";
25483
25501
  import { existsSync as existsSync4 } from "node:fs";
25484
25502
  import { join as join7, basename as basename2, dirname as dirname4, relative as relative2 } from "node:path";
25485
- async function ensureWorkspaceRules(filePath, repositories) {
25486
- const rulesContent = generateWorkspaceRules(repositories);
25503
+ async function ensureWorkspaceRules(filePath, repositories, skills = []) {
25504
+ const rulesContent = generateWorkspaceRules(repositories, skills);
25487
25505
  const startMarker = "<!-- WORKSPACE-RULES:START -->";
25488
25506
  const endMarker = "<!-- WORKSPACE-RULES:END -->";
25489
25507
  if (!existsSync4(filePath)) {
@@ -25916,7 +25934,7 @@ function resolveFileSourcePath(source, defaultSourcePath, githubCache) {
25916
25934
  return null;
25917
25935
  }
25918
25936
  async function copyWorkspaceFiles(sourcePath, workspacePath, files, options2 = {}) {
25919
- const { dryRun = false, githubCache, repositories = [] } = options2;
25937
+ const { dryRun = false, githubCache, repositories = [], skills = [] } = options2;
25920
25938
  const results = [];
25921
25939
  const stringPatterns = [];
25922
25940
  const objectEntries = [];
@@ -26069,7 +26087,7 @@ async function copyWorkspaceFiles(sourcePath, workspacePath, files, options2 = {
26069
26087
  for (const agentFile of copiedAgentFiles) {
26070
26088
  const targetPath = join7(workspacePath, agentFile);
26071
26089
  try {
26072
- await ensureWorkspaceRules(targetPath, repositories);
26090
+ await ensureWorkspaceRules(targetPath, repositories, skills);
26073
26091
  } catch (error) {
26074
26092
  results.push({
26075
26093
  source: "WORKSPACE-RULES",
@@ -28347,10 +28365,114 @@ var init_workspace_modify = __esm(() => {
28347
28365
  DEFAULT_PROJECT_CLIENTS = ["universal"];
28348
28366
  });
28349
28367
 
28368
+ // src/core/repo-skills.ts
28369
+ import { existsSync as existsSync9, lstatSync } from "node:fs";
28370
+ import { readdir as readdir4, readFile as readFile8 } from "node:fs/promises";
28371
+ import { join as join12, relative as relative3, resolve as resolve8 } from "node:path";
28372
+ async function discoverRepoSkills(repoPath, options2) {
28373
+ if (options2.disabled)
28374
+ return [];
28375
+ const skillDirs = new Set;
28376
+ if (options2.skillPaths) {
28377
+ for (const p of options2.skillPaths) {
28378
+ skillDirs.add(p);
28379
+ }
28380
+ } else if (options2.clients) {
28381
+ for (const client of options2.clients) {
28382
+ const mapping = CLIENT_MAPPINGS[client];
28383
+ if (mapping?.skillsPath) {
28384
+ skillDirs.add(mapping.skillsPath);
28385
+ }
28386
+ }
28387
+ }
28388
+ const results = [];
28389
+ const seen = new Set;
28390
+ for (const skillDir of skillDirs) {
28391
+ const absDir = join12(repoPath, skillDir);
28392
+ if (!existsSync9(absDir))
28393
+ continue;
28394
+ let entries;
28395
+ try {
28396
+ entries = await readdir4(absDir, { withFileTypes: true });
28397
+ } catch {
28398
+ continue;
28399
+ }
28400
+ for (const entry of entries) {
28401
+ if (!entry.isDirectory())
28402
+ continue;
28403
+ const entryPath = join12(absDir, entry.name);
28404
+ try {
28405
+ const stat2 = lstatSync(entryPath);
28406
+ if (stat2.isSymbolicLink())
28407
+ continue;
28408
+ } catch {
28409
+ continue;
28410
+ }
28411
+ const skillMdPath = join12(entryPath, "SKILL.md");
28412
+ if (!existsSync9(skillMdPath))
28413
+ continue;
28414
+ const relPath = relative3(repoPath, skillMdPath);
28415
+ if (seen.has(relPath))
28416
+ continue;
28417
+ try {
28418
+ const content = await readFile8(skillMdPath, "utf-8");
28419
+ const metadata = parseSkillMetadata(content);
28420
+ if (!metadata)
28421
+ continue;
28422
+ seen.add(relPath);
28423
+ results.push({
28424
+ name: metadata.name,
28425
+ description: metadata.description,
28426
+ relativePath: relPath,
28427
+ fileSize: content.length
28428
+ });
28429
+ } catch {}
28430
+ }
28431
+ }
28432
+ return results;
28433
+ }
28434
+ async function discoverWorkspaceSkills(workspacePath, repositories, clientNames) {
28435
+ const skillsByName = new Map;
28436
+ for (const repo of repositories) {
28437
+ if (repo.skills === false)
28438
+ continue;
28439
+ const repoAbsPath = resolve8(workspacePath, repo.path);
28440
+ const discoverOpts = Array.isArray(repo.skills) ? { skillPaths: repo.skills } : { clients: clientNames };
28441
+ const repoSkills = await discoverRepoSkills(repoAbsPath, discoverOpts);
28442
+ for (const skill of repoSkills) {
28443
+ const location = `${repo.path}/${skill.relativePath}`.replace(/\\/g, "/");
28444
+ const candidate = {
28445
+ repoPath: repo.path,
28446
+ name: skill.name,
28447
+ description: skill.description,
28448
+ location,
28449
+ fileSize: skill.fileSize
28450
+ };
28451
+ const existing = skillsByName.get(skill.name);
28452
+ if (!existing) {
28453
+ skillsByName.set(skill.name, candidate);
28454
+ continue;
28455
+ }
28456
+ const existingIsAgents = existing.location.includes(".agents/");
28457
+ const candidateIsAgents = candidate.location.includes(".agents/");
28458
+ if (candidateIsAgents && !existingIsAgents) {
28459
+ skillsByName.set(skill.name, candidate);
28460
+ } else if (!candidateIsAgents && existingIsAgents) {} else if (candidate.fileSize > existing.fileSize) {
28461
+ skillsByName.set(skill.name, candidate);
28462
+ }
28463
+ }
28464
+ }
28465
+ return [...skillsByName.values()].map(({ fileSize: _, ...entry }) => entry);
28466
+ }
28467
+ var init_repo_skills = __esm(() => {
28468
+ init_skill();
28469
+ init_client_mapping();
28470
+ });
28471
+
28350
28472
  // src/core/workspace-repo.ts
28351
- import { readFile as readFile8, writeFile as writeFile5 } from "node:fs/promises";
28352
- import { existsSync as existsSync9 } from "node:fs";
28353
- import { join as join12 } from "node:path";
28473
+ import { readFile as readFile9, writeFile as writeFile5 } from "node:fs/promises";
28474
+ import { existsSync as existsSync10 } from "node:fs";
28475
+ import { join as join13 } from "node:path";
28354
28476
  async function detectRemote(repoPath) {
28355
28477
  try {
28356
28478
  const env2 = { ...process.env };
@@ -28392,10 +28514,10 @@ function normalizePath(p) {
28392
28514
  }
28393
28515
  async function addRepository(path, options2 = {}, workspacePath = process.cwd()) {
28394
28516
  const normalizedPath = normalizePath(path);
28395
- const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28517
+ const configPath = join13(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28396
28518
  await ensureWorkspace(workspacePath);
28397
28519
  try {
28398
- const content = await readFile8(configPath, "utf-8");
28520
+ const content = await readFile9(configPath, "utf-8");
28399
28521
  const config = load(content);
28400
28522
  if (config.repositories.some((r) => normalizePath(r.path) === normalizedPath)) {
28401
28523
  return { success: false, error: `Repository already exists: ${normalizedPath}` };
@@ -28415,8 +28537,8 @@ async function addRepository(path, options2 = {}, workspacePath = process.cwd())
28415
28537
  }
28416
28538
  }
28417
28539
  async function removeRepository(path, workspacePath = process.cwd()) {
28418
- const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28419
- if (!existsSync9(configPath)) {
28540
+ const configPath = join13(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28541
+ if (!existsSync10(configPath)) {
28420
28542
  return {
28421
28543
  success: false,
28422
28544
  error: `${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
@@ -28424,7 +28546,7 @@ async function removeRepository(path, workspacePath = process.cwd()) {
28424
28546
  };
28425
28547
  }
28426
28548
  try {
28427
- const content = await readFile8(configPath, "utf-8");
28549
+ const content = await readFile9(configPath, "utf-8");
28428
28550
  const config = load(content);
28429
28551
  const normalizedPath = normalizePath(path);
28430
28552
  const index = config.repositories.findIndex((r) => normalizePath(r.path) === normalizedPath);
@@ -28439,34 +28561,40 @@ async function removeRepository(path, workspacePath = process.cwd()) {
28439
28561
  }
28440
28562
  }
28441
28563
  async function listRepositories(workspacePath = process.cwd()) {
28442
- const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28443
- if (!existsSync9(configPath))
28564
+ const configPath = join13(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28565
+ if (!existsSync10(configPath))
28444
28566
  return [];
28445
28567
  try {
28446
- const content = await readFile8(configPath, "utf-8");
28568
+ const content = await readFile9(configPath, "utf-8");
28447
28569
  const config = load(content);
28448
28570
  return config.repositories ?? [];
28449
28571
  } catch {
28450
28572
  return [];
28451
28573
  }
28452
28574
  }
28575
+ function resolveClientNames(clients) {
28576
+ return (clients ?? []).map((c) => typeof c === "string" ? c : c.name);
28577
+ }
28453
28578
  async function updateAgentFiles(workspacePath = process.cwd()) {
28454
- const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28455
- if (!existsSync9(configPath))
28579
+ const configPath = join13(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28580
+ if (!existsSync10(configPath))
28456
28581
  return;
28457
- const content = await readFile8(configPath, "utf-8");
28582
+ const content = await readFile9(configPath, "utf-8");
28458
28583
  const config = load(content);
28459
28584
  if (config.repositories.length === 0)
28460
28585
  return;
28586
+ const clientNames = resolveClientNames(config.clients);
28587
+ const allSkills = await discoverWorkspaceSkills(workspacePath, config.repositories, clientNames);
28461
28588
  const agentFiles = new Set;
28462
28589
  for (const client of config.clients ?? []) {
28463
- const mapping = CLIENT_MAPPINGS[client];
28590
+ const clientName = typeof client === "string" ? client : client.name;
28591
+ const mapping = CLIENT_MAPPINGS[clientName];
28464
28592
  if (mapping?.agentFile)
28465
28593
  agentFiles.add(mapping.agentFile);
28466
28594
  }
28467
28595
  agentFiles.add("AGENTS.md");
28468
28596
  for (const agentFile of agentFiles) {
28469
- await ensureWorkspaceRules(join12(workspacePath, agentFile), config.repositories);
28597
+ await ensureWorkspaceRules(join13(workspacePath, agentFile), config.repositories, allSkills);
28470
28598
  }
28471
28599
  }
28472
28600
  var init_workspace_repo = __esm(() => {
@@ -28475,6 +28603,7 @@ var init_workspace_repo = __esm(() => {
28475
28603
  init_workspace_modify();
28476
28604
  init_transform();
28477
28605
  init_client_mapping();
28606
+ init_repo_skills();
28478
28607
  });
28479
28608
 
28480
28609
  // src/utils/hash.ts
@@ -28641,14 +28770,14 @@ var init_sync_state = __esm(() => {
28641
28770
  });
28642
28771
 
28643
28772
  // src/core/config-gitignore.ts
28644
- import { writeFile as writeFile6, readFile as readFile9 } from "node:fs/promises";
28645
- import { existsSync as existsSync10 } from "node:fs";
28646
- import { join as join13 } from "node:path";
28773
+ import { writeFile as writeFile6, readFile as readFile10 } from "node:fs/promises";
28774
+ import { existsSync as existsSync11 } from "node:fs";
28775
+ import { join as join14 } from "node:path";
28647
28776
  async function ensureConfigGitignore(workspacePath) {
28648
- const gitignorePath = join13(workspacePath, CONFIG_DIR, ".gitignore");
28777
+ const gitignorePath = join14(workspacePath, CONFIG_DIR, ".gitignore");
28649
28778
  let existing = "";
28650
- if (existsSync10(gitignorePath)) {
28651
- existing = await readFile9(gitignorePath, "utf-8");
28779
+ if (existsSync11(gitignorePath)) {
28780
+ existing = await readFile10(gitignorePath, "utf-8");
28652
28781
  }
28653
28782
  const missing = GITIGNORE_ENTRIES.filter((entry) => !existing.split(`
28654
28783
  `).includes(entry));
@@ -28669,19 +28798,19 @@ var init_config_gitignore = __esm(() => {
28669
28798
  });
28670
28799
 
28671
28800
  // src/core/sync-state.ts
28672
- import { readFile as readFile10, writeFile as writeFile7, mkdir as mkdir7 } from "node:fs/promises";
28673
- import { existsSync as existsSync11 } from "node:fs";
28674
- import { join as join14, dirname as dirname6 } from "node:path";
28801
+ import { readFile as readFile11, writeFile as writeFile7, mkdir as mkdir7 } from "node:fs/promises";
28802
+ import { existsSync as existsSync12 } from "node:fs";
28803
+ import { join as join15, dirname as dirname6 } from "node:path";
28675
28804
  function getSyncStatePath(workspacePath) {
28676
- return join14(workspacePath, CONFIG_DIR, SYNC_STATE_FILE);
28805
+ return join15(workspacePath, CONFIG_DIR, SYNC_STATE_FILE);
28677
28806
  }
28678
28807
  async function loadSyncState(workspacePath) {
28679
28808
  const statePath = getSyncStatePath(workspacePath);
28680
- if (!existsSync11(statePath)) {
28809
+ if (!existsSync12(statePath)) {
28681
28810
  return null;
28682
28811
  }
28683
28812
  try {
28684
- const content = await readFile10(statePath, "utf-8");
28813
+ const content = await readFile11(statePath, "utf-8");
28685
28814
  const parsed = JSON.parse(content);
28686
28815
  const result = SyncStateSchema.safeParse(parsed);
28687
28816
  if (!result.success) {
@@ -28733,11 +28862,11 @@ var init_sync_state2 = __esm(() => {
28733
28862
 
28734
28863
  // src/core/vscode-workspace.ts
28735
28864
  import { createHash as createHash2 } from "node:crypto";
28736
- import { resolve as resolve8, basename as basename5, isAbsolute as isAbsolute3, relative as relative3 } from "node:path";
28865
+ import { resolve as resolve9, basename as basename5, isAbsolute as isAbsolute3, relative as relative4 } from "node:path";
28737
28866
  function buildPathPlaceholderMap(repositories, workspacePath) {
28738
28867
  const map2 = new Map;
28739
28868
  for (const repo of repositories) {
28740
- const absolutePath = resolve8(workspacePath, repo.path);
28869
+ const absolutePath = resolve9(workspacePath, repo.path);
28741
28870
  map2.set(repo.path, absolutePath);
28742
28871
  }
28743
28872
  return map2;
@@ -28772,9 +28901,9 @@ function generateVscodeWorkspace(input) {
28772
28901
  const folders = [];
28773
28902
  const seenPaths = new Set;
28774
28903
  folders.push({ path: "." });
28775
- seenPaths.add(resolve8(workspacePath, "."));
28904
+ seenPaths.add(resolve9(workspacePath, "."));
28776
28905
  for (const repo of repositories) {
28777
- const absolutePath = resolve8(workspacePath, repo.path).replace(/\\/g, "/");
28906
+ const absolutePath = resolve9(workspacePath, repo.path).replace(/\\/g, "/");
28778
28907
  const entry = { path: absolutePath };
28779
28908
  if (repo.name)
28780
28909
  entry.name = repo.name;
@@ -28784,7 +28913,7 @@ function generateVscodeWorkspace(input) {
28784
28913
  if (resolvedTemplate && Array.isArray(resolvedTemplate.folders)) {
28785
28914
  for (const folder of resolvedTemplate.folders) {
28786
28915
  const rawPath = folder.path;
28787
- const normalizedPath = (typeof rawPath === "string" && !isAbsolute3(rawPath) ? resolve8(workspacePath, rawPath) : rawPath).replace(/\\/g, "/");
28916
+ const normalizedPath = (typeof rawPath === "string" && !isAbsolute3(rawPath) ? resolve9(workspacePath, rawPath) : rawPath).replace(/\\/g, "/");
28788
28917
  if (!seenPaths.has(normalizedPath)) {
28789
28918
  const entry = { path: normalizedPath };
28790
28919
  if (folder.name)
@@ -28814,22 +28943,22 @@ function getWorkspaceOutputPath(workspacePath, vscodeConfig) {
28814
28943
  const name = vscodeConfig?.output;
28815
28944
  if (name) {
28816
28945
  const filename = name.endsWith(".code-workspace") ? name : `${name}.code-workspace`;
28817
- return resolve8(workspacePath, filename);
28946
+ return resolve9(workspacePath, filename);
28818
28947
  }
28819
- const dirName = basename5(resolve8(workspacePath));
28820
- return resolve8(workspacePath, `${dirName}.code-workspace`);
28948
+ const dirName = basename5(resolve9(workspacePath));
28949
+ return resolve9(workspacePath, `${dirName}.code-workspace`);
28821
28950
  }
28822
28951
  function computeWorkspaceHash(content) {
28823
28952
  return createHash2("sha256").update(content).digest("hex");
28824
28953
  }
28825
28954
  function reconcileVscodeWorkspaceFolders(workspacePath, codeWorkspaceFolders, lastSyncedRepos, currentRepos) {
28826
- const normalizedWorkspacePath = resolve8(workspacePath).replace(/\\/g, "/");
28955
+ const normalizedWorkspacePath = resolve9(workspacePath).replace(/\\/g, "/");
28827
28956
  const codeWorkspaceAbsPaths = new Set;
28828
28957
  const codeWorkspaceNames = new Map;
28829
28958
  for (const folder of codeWorkspaceFolders) {
28830
28959
  if (folder.path === ".")
28831
28960
  continue;
28832
- const absPath = (isAbsolute3(folder.path) ? folder.path : resolve8(workspacePath, folder.path)).replace(/\\/g, "/");
28961
+ const absPath = (isAbsolute3(folder.path) ? folder.path : resolve9(workspacePath, folder.path)).replace(/\\/g, "/");
28833
28962
  codeWorkspaceAbsPaths.add(absPath);
28834
28963
  if (folder.name)
28835
28964
  codeWorkspaceNames.set(absPath, folder.name);
@@ -28837,7 +28966,7 @@ function reconcileVscodeWorkspaceFolders(workspacePath, codeWorkspaceFolders, la
28837
28966
  const lastSyncedSet = new Set(lastSyncedRepos.map((p) => p.replace(/\\/g, "/")));
28838
28967
  const currentReposByAbsPath = new Map;
28839
28968
  for (const repo of currentRepos) {
28840
- const absPath = resolve8(workspacePath, repo.path).replace(/\\/g, "/");
28969
+ const absPath = resolve9(workspacePath, repo.path).replace(/\\/g, "/");
28841
28970
  currentReposByAbsPath.set(absPath, repo);
28842
28971
  }
28843
28972
  const currentAbsPaths = new Set(currentReposByAbsPath.keys());
@@ -28869,7 +28998,7 @@ function reconcileVscodeWorkspaceFolders(workspacePath, codeWorkspaceFolders, la
28869
28998
  const inLastSync = lastSyncedSet.has(absPath);
28870
28999
  const inCurrentRepos = currentAbsPaths.has(absPath);
28871
29000
  if (!inLastSync && !inCurrentRepos) {
28872
- const relPath = relative3(normalizedWorkspacePath, absPath).replace(/\\/g, "/");
29001
+ const relPath = relative4(normalizedWorkspacePath, absPath).replace(/\\/g, "/");
28873
29002
  added.push(relPath);
28874
29003
  const newRepo = { path: relPath };
28875
29004
  const folderName = codeWorkspaceNames.get(absPath);
@@ -28888,8 +29017,8 @@ var init_vscode_workspace = __esm(() => {
28888
29017
  });
28889
29018
 
28890
29019
  // src/core/vscode-mcp.ts
28891
- import { existsSync as existsSync12, readFileSync, writeFileSync, mkdirSync } from "node:fs";
28892
- import { join as join15, dirname as dirname7 } from "node:path";
29020
+ import { existsSync as existsSync13, readFileSync, writeFileSync, mkdirSync } from "node:fs";
29021
+ import { join as join16, dirname as dirname7 } from "node:path";
28893
29022
  function deepEqual(a, b) {
28894
29023
  if (a === b)
28895
29024
  return true;
@@ -28921,17 +29050,17 @@ function getVscodeMcpConfigPath() {
28921
29050
  if (!appData) {
28922
29051
  throw new Error("APPDATA environment variable not set");
28923
29052
  }
28924
- return join15(appData, "Code", "User", "mcp.json");
29053
+ return join16(appData, "Code", "User", "mcp.json");
28925
29054
  }
28926
29055
  const home = getHomeDir();
28927
29056
  if (platform2 === "darwin") {
28928
- return join15(home, "Library", "Application Support", "Code", "User", "mcp.json");
29057
+ return join16(home, "Library", "Application Support", "Code", "User", "mcp.json");
28929
29058
  }
28930
- return join15(home, ".config", "Code", "User", "mcp.json");
29059
+ return join16(home, ".config", "Code", "User", "mcp.json");
28931
29060
  }
28932
29061
  function readPluginMcpConfig(pluginPath) {
28933
- const mcpPath = join15(pluginPath, ".mcp.json");
28934
- if (!existsSync12(mcpPath)) {
29062
+ const mcpPath = join16(pluginPath, ".mcp.json");
29063
+ if (!existsSync13(mcpPath)) {
28935
29064
  return null;
28936
29065
  }
28937
29066
  try {
@@ -28982,7 +29111,7 @@ function syncVscodeMcpConfig(validatedPlugins, options2) {
28982
29111
  trackedServers: []
28983
29112
  };
28984
29113
  let existingConfig = {};
28985
- if (existsSync12(configPath)) {
29114
+ if (existsSync13(configPath)) {
28986
29115
  try {
28987
29116
  const content = readFileSync(configPath, "utf-8");
28988
29117
  existingConfig = import_json5.default.parse(content);
@@ -29033,7 +29162,7 @@ function syncVscodeMcpConfig(validatedPlugins, options2) {
29033
29162
  if (hasChanges && !dryRun) {
29034
29163
  existingConfig.servers = existingServers;
29035
29164
  const dir = dirname7(configPath);
29036
- if (!existsSync12(dir)) {
29165
+ if (!existsSync13(dir)) {
29037
29166
  mkdirSync(dir, { recursive: true });
29038
29167
  }
29039
29168
  writeFileSync(configPath, `${JSON.stringify(existingConfig, null, 2)}
@@ -29051,7 +29180,7 @@ function syncVscodeMcpConfig(validatedPlugins, options2) {
29051
29180
  if (result.removed > 0 && !dryRun) {
29052
29181
  existingConfig.servers = existingServers;
29053
29182
  const dir = dirname7(configPath);
29054
- if (!existsSync12(dir)) {
29183
+ if (!existsSync13(dir)) {
29055
29184
  mkdirSync(dir, { recursive: true });
29056
29185
  }
29057
29186
  writeFileSync(configPath, `${JSON.stringify(existingConfig, null, 2)}
@@ -29070,7 +29199,7 @@ var init_vscode_mcp = __esm(() => {
29070
29199
  // src/core/native/types.ts
29071
29200
  import { spawn as spawn2 } from "node:child_process";
29072
29201
  function executeCommand(binary2, args, options2 = {}) {
29073
- return new Promise((resolve9) => {
29202
+ return new Promise((resolve10) => {
29074
29203
  const proc = spawn2(binary2, args, {
29075
29204
  cwd: options2.cwd,
29076
29205
  stdio: ["ignore", "pipe", "pipe"],
@@ -29091,7 +29220,7 @@ function executeCommand(binary2, args, options2 = {}) {
29091
29220
  return;
29092
29221
  resolved = true;
29093
29222
  const trimmedStderr = stderr.trim();
29094
- resolve9({
29223
+ resolve10({
29095
29224
  success: code === 0,
29096
29225
  output: stdout.trim(),
29097
29226
  ...trimmedStderr && { error: trimmedStderr }
@@ -29101,7 +29230,7 @@ function executeCommand(binary2, args, options2 = {}) {
29101
29230
  if (resolved)
29102
29231
  return;
29103
29232
  resolved = true;
29104
- resolve9({
29233
+ resolve10({
29105
29234
  success: false,
29106
29235
  output: "",
29107
29236
  error: `Failed to execute ${binary2} CLI: ${err.message}`
@@ -29120,7 +29249,7 @@ function mergeNativeSyncResults(results) {
29120
29249
  var init_types2 = () => {};
29121
29250
 
29122
29251
  // src/core/codex-mcp.ts
29123
- import { existsSync as existsSync13, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
29252
+ import { existsSync as existsSync14, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
29124
29253
  import { dirname as dirname8 } from "node:path";
29125
29254
  function buildCodexMcpAddArgs(name, config) {
29126
29255
  if (typeof config.url === "string") {
@@ -29331,7 +29460,7 @@ function syncCodexProjectMcpConfig(validatedPlugins, options2) {
29331
29460
  trackedServers: []
29332
29461
  };
29333
29462
  let existingContent = "";
29334
- if (existsSync13(configPath)) {
29463
+ if (existsSync14(configPath)) {
29335
29464
  try {
29336
29465
  existingContent = readFileSync2(configPath, "utf-8");
29337
29466
  } catch {
@@ -29387,7 +29516,7 @@ function syncCodexProjectMcpConfig(validatedPlugins, options2) {
29387
29516
  `)}
29388
29517
  `;
29389
29518
  const dir = dirname8(configPath);
29390
- if (!existsSync13(dir)) {
29519
+ if (!existsSync14(dir)) {
29391
29520
  mkdirSync2(dir, { recursive: true });
29392
29521
  }
29393
29522
  writeFileSync2(configPath, output, "utf-8");
@@ -29401,7 +29530,7 @@ var init_codex_mcp = __esm(() => {
29401
29530
  });
29402
29531
 
29403
29532
  // src/core/claude-mcp.ts
29404
- import { existsSync as existsSync14, readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "node:fs";
29533
+ import { existsSync as existsSync15, readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "node:fs";
29405
29534
  import { dirname as dirname9 } from "node:path";
29406
29535
  function deepEqual2(a, b) {
29407
29536
  if (a === b)
@@ -29469,7 +29598,7 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
29469
29598
  trackedServers: []
29470
29599
  };
29471
29600
  let existingConfig = {};
29472
- if (existsSync14(configPath)) {
29601
+ if (existsSync15(configPath)) {
29473
29602
  try {
29474
29603
  const content = readFileSync3(configPath, "utf-8");
29475
29604
  existingConfig = import_json52.default.parse(content);
@@ -29520,7 +29649,7 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
29520
29649
  if (hasChanges && !dryRun) {
29521
29650
  existingConfig.mcpServers = existingServers;
29522
29651
  const dir = dirname9(configPath);
29523
- if (!existsSync14(dir)) {
29652
+ if (!existsSync15(dir)) {
29524
29653
  mkdirSync3(dir, { recursive: true });
29525
29654
  }
29526
29655
  writeFileSync3(configPath, `${JSON.stringify(existingConfig, null, 2)}
@@ -29538,7 +29667,7 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
29538
29667
  if (result.removed > 0 && !dryRun) {
29539
29668
  existingConfig.mcpServers = existingServers;
29540
29669
  const dir = dirname9(configPath);
29541
- if (!existsSync14(dir)) {
29670
+ if (!existsSync15(dir)) {
29542
29671
  mkdirSync3(dir, { recursive: true });
29543
29672
  }
29544
29673
  writeFileSync3(configPath, `${JSON.stringify(existingConfig, null, 2)}
@@ -29637,9 +29766,9 @@ var init_claude_mcp = __esm(() => {
29637
29766
  });
29638
29767
 
29639
29768
  // src/core/copilot-mcp.ts
29640
- import { join as join16 } from "node:path";
29769
+ import { join as join17 } from "node:path";
29641
29770
  function getCopilotMcpConfigPath() {
29642
- return join16(getHomeDir(), ".copilot", "mcp-config.json");
29771
+ return join17(getHomeDir(), ".copilot", "mcp-config.json");
29643
29772
  }
29644
29773
  var init_copilot_mcp = __esm(() => {
29645
29774
  init_constants();
@@ -29937,9 +30066,9 @@ function padStart2(str3, len) {
29937
30066
  }
29938
30067
 
29939
30068
  // src/core/sync.ts
29940
- import { existsSync as existsSync15, readFileSync as readFileSync4, writeFileSync as writeFileSync4, lstatSync } from "node:fs";
30069
+ import { existsSync as existsSync16, readFileSync as readFileSync4, writeFileSync as writeFileSync4, lstatSync as lstatSync2 } from "node:fs";
29941
30070
  import { rm as rm4, unlink as unlink2, rmdir, copyFile } from "node:fs/promises";
29942
- import { join as join17, resolve as resolve9, dirname as dirname10, relative as relative4 } from "node:path";
30071
+ import { join as join18, resolve as resolve10, dirname as dirname10, relative as relative5 } from "node:path";
29943
30072
  function deduplicateClientsByPath(clients, clientMappings = CLIENT_MAPPINGS) {
29944
30073
  const pathToClients = new Map;
29945
30074
  for (const client of clients) {
@@ -30053,11 +30182,11 @@ async function selectivePurgeWorkspace(workspacePath, state, clients) {
30053
30182
  const previousFiles = getPreviouslySyncedFiles(state, client);
30054
30183
  const purgedPaths = [];
30055
30184
  for (const filePath of previousFiles) {
30056
- const fullPath = join17(workspacePath, filePath);
30185
+ const fullPath = join18(workspacePath, filePath);
30057
30186
  const cleanPath = fullPath.replace(/\/$/, "");
30058
30187
  let stats;
30059
30188
  try {
30060
- stats = lstatSync(cleanPath);
30189
+ stats = lstatSync2(cleanPath);
30061
30190
  } catch {
30062
30191
  continue;
30063
30192
  }
@@ -30082,8 +30211,8 @@ async function selectivePurgeWorkspace(workspacePath, state, clients) {
30082
30211
  async function cleanupEmptyParents(workspacePath, filePath) {
30083
30212
  let parentPath = dirname10(filePath);
30084
30213
  while (parentPath && parentPath !== "." && parentPath !== "/") {
30085
- const fullParentPath = join17(workspacePath, parentPath);
30086
- if (!existsSync15(fullParentPath)) {
30214
+ const fullParentPath = join18(workspacePath, parentPath);
30215
+ if (!existsSync16(fullParentPath)) {
30087
30216
  parentPath = dirname10(parentPath);
30088
30217
  continue;
30089
30218
  }
@@ -30168,8 +30297,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
30168
30297
  errors2.push(`Cannot resolve file '${file}' - no workspace.source configured`);
30169
30298
  continue;
30170
30299
  }
30171
- const fullPath = join17(defaultSourcePath, file);
30172
- if (!existsSync15(fullPath)) {
30300
+ const fullPath = join18(defaultSourcePath, file);
30301
+ if (!existsSync16(fullPath)) {
30173
30302
  errors2.push(`File source not found: ${fullPath}`);
30174
30303
  }
30175
30304
  continue;
@@ -30187,8 +30316,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
30187
30316
  errors2.push(`GitHub cache not found for ${cacheKey}`);
30188
30317
  continue;
30189
30318
  }
30190
- const fullPath = join17(cachePath, parsed.filePath);
30191
- if (!existsSync15(fullPath)) {
30319
+ const fullPath = join18(cachePath, parsed.filePath);
30320
+ if (!existsSync16(fullPath)) {
30192
30321
  errors2.push(`Path not found in repository: ${cacheKey}/${parsed.filePath}`);
30193
30322
  }
30194
30323
  } else {
@@ -30196,13 +30325,13 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
30196
30325
  if (file.source.startsWith("/")) {
30197
30326
  fullPath = file.source;
30198
30327
  } else if (file.source.startsWith("../")) {
30199
- fullPath = resolve9(file.source);
30328
+ fullPath = resolve10(file.source);
30200
30329
  } else if (defaultSourcePath) {
30201
- fullPath = join17(defaultSourcePath, file.source);
30330
+ fullPath = join18(defaultSourcePath, file.source);
30202
30331
  } else {
30203
- fullPath = resolve9(file.source);
30332
+ fullPath = resolve10(file.source);
30204
30333
  }
30205
- if (!existsSync15(fullPath)) {
30334
+ if (!existsSync16(fullPath)) {
30206
30335
  errors2.push(`File source not found: ${fullPath}`);
30207
30336
  }
30208
30337
  }
@@ -30211,8 +30340,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
30211
30340
  errors2.push(`Cannot resolve file '${file.dest}' - no workspace.source configured and no explicit source provided`);
30212
30341
  continue;
30213
30342
  }
30214
- const fullPath = join17(defaultSourcePath, file.dest ?? "");
30215
- if (!existsSync15(fullPath)) {
30343
+ const fullPath = join18(defaultSourcePath, file.dest ?? "");
30344
+ if (!existsSync16(fullPath)) {
30216
30345
  errors2.push(`File source not found: ${fullPath}`);
30217
30346
  }
30218
30347
  }
@@ -30229,7 +30358,7 @@ function collectSyncedPaths(copyResults, workspacePath, clients, clientMappings)
30229
30358
  if (copyResult.action !== "copied" && copyResult.action !== "generated") {
30230
30359
  continue;
30231
30360
  }
30232
- const relativePath = relative4(workspacePath, copyResult.destination).replace(/\\/g, "/");
30361
+ const relativePath = relative5(workspacePath, copyResult.destination).replace(/\\/g, "/");
30233
30362
  for (const client of clients) {
30234
30363
  const mapping = mappings[client];
30235
30364
  if (mapping.skillsPath && relativePath.startsWith(mapping.skillsPath)) {
@@ -30358,7 +30487,7 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
30358
30487
  ...fetchResult.error && { error: fetchResult.error }
30359
30488
  };
30360
30489
  }
30361
- const resolvedPath2 = parsed?.subpath ? join17(fetchResult.cachePath, parsed.subpath) : fetchResult.cachePath;
30490
+ const resolvedPath2 = parsed?.subpath ? join18(fetchResult.cachePath, parsed.subpath) : fetchResult.cachePath;
30362
30491
  return {
30363
30492
  plugin: pluginSource,
30364
30493
  resolved: resolvedPath2,
@@ -30367,8 +30496,8 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
30367
30496
  nativeClients: []
30368
30497
  };
30369
30498
  }
30370
- const resolvedPath = resolve9(workspacePath, pluginSource);
30371
- if (!existsSync15(resolvedPath)) {
30499
+ const resolvedPath = resolve10(workspacePath, pluginSource);
30500
+ if (!existsSync16(resolvedPath)) {
30372
30501
  return {
30373
30502
  plugin: pluginSource,
30374
30503
  resolved: resolvedPath,
@@ -30529,10 +30658,10 @@ function buildPluginSkillNameMaps(allSkills) {
30529
30658
  return pluginMaps;
30530
30659
  }
30531
30660
  function generateVscodeWorkspaceFile(workspacePath, config) {
30532
- const configDir = join17(workspacePath, CONFIG_DIR);
30533
- const templatePath = join17(configDir, VSCODE_TEMPLATE_FILE);
30661
+ const configDir = join18(workspacePath, CONFIG_DIR);
30662
+ const templatePath = join18(configDir, VSCODE_TEMPLATE_FILE);
30534
30663
  let template;
30535
- if (existsSync15(templatePath)) {
30664
+ if (existsSync16(templatePath)) {
30536
30665
  try {
30537
30666
  template = import_json53.default.parse(readFileSync4(templatePath, "utf-8"));
30538
30667
  } catch (error) {
@@ -30679,7 +30808,7 @@ async function syncVscodeWorkspaceFile(workspacePath, config, configPath, previo
30679
30808
  let updatedConfig = config;
30680
30809
  if (previousState?.vscodeWorkspaceHash && previousState?.vscodeWorkspaceRepos) {
30681
30810
  const outputPath = getWorkspaceOutputPath(workspacePath, config.vscode);
30682
- if (existsSync15(outputPath)) {
30811
+ if (existsSync16(outputPath)) {
30683
30812
  const existingContent = readFileSync4(outputPath, "utf-8");
30684
30813
  const currentHash = computeWorkspaceHash(existingContent);
30685
30814
  if (currentHash !== previousState.vscodeWorkspaceHash) {
@@ -30709,7 +30838,7 @@ async function syncVscodeWorkspaceFile(workspacePath, config, configPath, previo
30709
30838
  }
30710
30839
  const writtenContent = generateVscodeWorkspaceFile(workspacePath, updatedConfig);
30711
30840
  const hash = computeWorkspaceHash(writtenContent);
30712
- const repos = updatedConfig.repositories.map((r) => resolve9(workspacePath, r.path).replace(/\\/g, "/"));
30841
+ const repos = updatedConfig.repositories.map((r) => resolve10(workspacePath, r.path).replace(/\\/g, "/"));
30713
30842
  return { config: updatedConfig, hash, repos };
30714
30843
  }
30715
30844
  async function persistSyncState(workspacePath, pluginResults, workspaceFileResults, syncClients, nativePluginsByClient, nativeResult, extra) {
@@ -30743,9 +30872,9 @@ async function syncWorkspace(workspacePath = process.cwd(), options2 = {}) {
30743
30872
  await migrateWorkspaceSkillsV1toV2(workspacePath);
30744
30873
  const { offline = false, dryRun = false, workspaceSourceBase, skipAgentFiles = false } = options2;
30745
30874
  const sw = new Stopwatch;
30746
- const configDir = join17(workspacePath, CONFIG_DIR);
30747
- const configPath = join17(configDir, WORKSPACE_CONFIG_FILE);
30748
- if (!existsSync15(configPath)) {
30875
+ const configDir = join18(workspacePath, CONFIG_DIR);
30876
+ const configPath = join18(configDir, WORKSPACE_CONFIG_FILE);
30877
+ if (!existsSync16(configPath)) {
30749
30878
  return failedSyncResult(`${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
30750
30879
  Run 'allagents workspace init <path>' to create a new workspace`);
30751
30880
  }
@@ -30834,8 +30963,8 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
30834
30963
  const filesToCopy = [...config.workspace.files];
30835
30964
  if (hasRepositories && sourcePath) {
30836
30965
  for (const agentFile of AGENT_FILES) {
30837
- const agentPath = join17(sourcePath, agentFile);
30838
- if (existsSync15(agentPath) && !filesToCopy.includes(agentFile)) {
30966
+ const agentPath = join18(sourcePath, agentFile);
30967
+ if (existsSync16(agentPath) && !filesToCopy.includes(agentFile)) {
30839
30968
  filesToCopy.push(agentFile);
30840
30969
  }
30841
30970
  }
@@ -30857,12 +30986,13 @@ ${errors2.map((e) => ` - ${e}`).join(`
30857
30986
  ${fileValidationErrors.map((e) => ` - ${e}`).join(`
30858
30987
  `)}`, { pluginResults, totalFailed: fileValidationErrors.length });
30859
30988
  }
30860
- workspaceFileResults = await copyWorkspaceFiles(sourcePath, workspacePath, filesToCopy, { dryRun, githubCache, repositories: config.repositories });
30989
+ const repoSkills = hasRepositories && !dryRun ? await discoverWorkspaceSkills(workspacePath, config.repositories, syncClients) : [];
30990
+ workspaceFileResults = await copyWorkspaceFiles(sourcePath, workspacePath, filesToCopy, { dryRun, githubCache, repositories: config.repositories, skills: repoSkills });
30861
30991
  if (hasRepositories && !dryRun && syncClients.includes("claude") && sourcePath) {
30862
- const claudePath = join17(workspacePath, "CLAUDE.md");
30863
- const agentsPath = join17(workspacePath, "AGENTS.md");
30864
- const claudeExistsInSource = existsSync15(join17(sourcePath, "CLAUDE.md"));
30865
- if (!claudeExistsInSource && existsSync15(agentsPath) && !existsSync15(claudePath)) {
30992
+ const claudePath = join18(workspacePath, "CLAUDE.md");
30993
+ const agentsPath = join18(workspacePath, "AGENTS.md");
30994
+ const claudeExistsInSource = existsSync16(join18(sourcePath, "CLAUDE.md"));
30995
+ if (!claudeExistsInSource && existsSync16(agentsPath) && !existsSync16(claudePath)) {
30866
30996
  await copyFile(agentsPath, claudePath);
30867
30997
  }
30868
30998
  }
@@ -30883,7 +31013,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
30883
31013
  const mcpResults = {};
30884
31014
  if (syncClients.includes("vscode")) {
30885
31015
  const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "vscode");
30886
- const projectMcpPath = join17(workspacePath, ".vscode", "mcp.json");
31016
+ const projectMcpPath = join18(workspacePath, ".vscode", "mcp.json");
30887
31017
  const vscodeMcp = syncVscodeMcpConfig(validPlugins, {
30888
31018
  dryRun,
30889
31019
  force: false,
@@ -30897,7 +31027,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
30897
31027
  }
30898
31028
  if (syncClients.includes("claude")) {
30899
31029
  const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "claude");
30900
- const projectMcpJsonPath = join17(workspacePath, ".mcp.json");
31030
+ const projectMcpJsonPath = join18(workspacePath, ".mcp.json");
30901
31031
  const claudeMcp = syncClaudeMcpConfig(validPlugins, {
30902
31032
  dryRun,
30903
31033
  force: false,
@@ -30911,7 +31041,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
30911
31041
  }
30912
31042
  if (syncClients.includes("codex")) {
30913
31043
  const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "codex");
30914
- const projectCodexConfigPath = join17(workspacePath, ".codex", "config.toml");
31044
+ const projectCodexConfigPath = join18(workspacePath, ".codex", "config.toml");
30915
31045
  const codexMcp = syncCodexProjectMcpConfig(validPlugins, {
30916
31046
  dryRun,
30917
31047
  force: false,
@@ -30925,7 +31055,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
30925
31055
  }
30926
31056
  if (syncClients.includes("copilot")) {
30927
31057
  const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "copilot");
30928
- const projectCopilotMcpPath = join17(workspacePath, ".copilot", "mcp-config.json");
31058
+ const projectCopilotMcpPath = join18(workspacePath, ".copilot", "mcp-config.json");
30929
31059
  const copilotMcp = syncClaudeMcpConfig(validPlugins, {
30930
31060
  dryRun,
30931
31061
  force: false,
@@ -30995,7 +31125,7 @@ async function seedFetchCacheFromMarketplaces(results) {
30995
31125
  }
30996
31126
  function readGitBranch(repoPath) {
30997
31127
  try {
30998
- const head = readFileSync4(join17(repoPath, ".git", "HEAD"), "utf-8").trim();
31128
+ const head = readFileSync4(join18(repoPath, ".git", "HEAD"), "utf-8").trim();
30999
31129
  const prefix = "ref: refs/heads/";
31000
31130
  return head.startsWith(prefix) ? head.slice(prefix.length) : null;
31001
31131
  } catch {
@@ -31005,7 +31135,7 @@ function readGitBranch(repoPath) {
31005
31135
  async function syncUserWorkspace(options2 = {}) {
31006
31136
  await migrateUserWorkspaceSkillsV1toV2();
31007
31137
  const sw = new Stopwatch;
31008
- const homeDir = resolve9(getHomeDir());
31138
+ const homeDir = resolve10(getHomeDir());
31009
31139
  const config = await getUserWorkspaceConfig();
31010
31140
  if (!config) {
31011
31141
  return {
@@ -31143,6 +31273,7 @@ var init_sync = __esm(() => {
31143
31273
  init_plugin();
31144
31274
  init_transform();
31145
31275
  init_workspace_repo();
31276
+ init_repo_skills();
31146
31277
  init_client_mapping();
31147
31278
  init_skill_name_resolver();
31148
31279
  init_marketplace();
@@ -31159,11 +31290,11 @@ var init_sync = __esm(() => {
31159
31290
  });
31160
31291
 
31161
31292
  // src/core/github-fetch.ts
31162
- import { existsSync as existsSync16, readFileSync as readFileSync5 } from "node:fs";
31163
- import { join as join18 } from "node:path";
31293
+ import { existsSync as existsSync17, readFileSync as readFileSync5 } from "node:fs";
31294
+ import { join as join19 } from "node:path";
31164
31295
  function readFileFromClone(tempDir, filePath) {
31165
- const fullPath = join18(tempDir, filePath);
31166
- if (existsSync16(fullPath)) {
31296
+ const fullPath = join19(tempDir, filePath);
31297
+ if (existsSync17(fullPath)) {
31167
31298
  return readFileSync5(fullPath, "utf-8");
31168
31299
  }
31169
31300
  return null;
@@ -31262,15 +31393,15 @@ var init_github_fetch = __esm(() => {
31262
31393
  });
31263
31394
 
31264
31395
  // src/core/workspace.ts
31265
- import { cp as cp2, mkdir as mkdir8, readFile as readFile11, writeFile as writeFile8, copyFile as copyFile2, unlink as unlink3 } from "node:fs/promises";
31266
- import { existsSync as existsSync17 } from "node:fs";
31267
- import { join as join19, resolve as resolve10, dirname as dirname11, relative as relative5, sep as sep2, isAbsolute as isAbsolute4 } from "node:path";
31396
+ import { cp as cp2, mkdir as mkdir8, readFile as readFile12, writeFile as writeFile8, copyFile as copyFile2, unlink as unlink3 } from "node:fs/promises";
31397
+ import { existsSync as existsSync18 } from "node:fs";
31398
+ import { join as join20, resolve as resolve11, dirname as dirname11, relative as relative6, sep as sep2, isAbsolute as isAbsolute4 } from "node:path";
31268
31399
  import { fileURLToPath } from "node:url";
31269
31400
  async function initWorkspace(targetPath = ".", options2 = {}) {
31270
- const absoluteTarget = resolve10(targetPath);
31271
- const configDir = join19(absoluteTarget, CONFIG_DIR);
31272
- const configPath = join19(configDir, WORKSPACE_CONFIG_FILE);
31273
- if (existsSync17(configPath)) {
31401
+ const absoluteTarget = resolve11(targetPath);
31402
+ const configDir = join20(absoluteTarget, CONFIG_DIR);
31403
+ const configPath = join20(configDir, WORKSPACE_CONFIG_FILE);
31404
+ if (existsSync18(configPath)) {
31274
31405
  if (options2.force) {
31275
31406
  await unlink3(configPath);
31276
31407
  } else {
@@ -31281,7 +31412,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31281
31412
  const currentFilePath = fileURLToPath(import.meta.url);
31282
31413
  const currentFileDir = dirname11(currentFilePath);
31283
31414
  const isProduction = currentFilePath.includes(`${sep2}dist${sep2}`);
31284
- const defaultTemplatePath = isProduction ? join19(currentFileDir, "templates", "default") : join19(currentFileDir, "..", "templates", "default");
31415
+ const defaultTemplatePath = isProduction ? join20(currentFileDir, "templates", "default") : join20(currentFileDir, "..", "templates", "default");
31285
31416
  let githubTempDir;
31286
31417
  let parsedFromUrl;
31287
31418
  let githubBasePath = "";
@@ -31320,20 +31451,20 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31320
31451
  }
31321
31452
  console.log(`✓ Using workspace.yaml from: ${options2.from}`);
31322
31453
  } else {
31323
- const fromPath = resolve10(options2.from);
31324
- if (!existsSync17(fromPath)) {
31454
+ const fromPath = resolve11(options2.from);
31455
+ if (!existsSync18(fromPath)) {
31325
31456
  throw new Error(`Template not found: ${fromPath}`);
31326
31457
  }
31327
31458
  const { stat: stat2 } = await import("node:fs/promises");
31328
31459
  const fromStat = await stat2(fromPath);
31329
31460
  let sourceYamlPath;
31330
31461
  if (fromStat.isDirectory()) {
31331
- const nestedPath = join19(fromPath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
31332
- const rootPath = join19(fromPath, WORKSPACE_CONFIG_FILE);
31333
- if (existsSync17(nestedPath)) {
31462
+ const nestedPath = join20(fromPath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
31463
+ const rootPath = join20(fromPath, WORKSPACE_CONFIG_FILE);
31464
+ if (existsSync18(nestedPath)) {
31334
31465
  sourceYamlPath = nestedPath;
31335
31466
  sourceDir = fromPath;
31336
- } else if (existsSync17(rootPath)) {
31467
+ } else if (existsSync18(rootPath)) {
31337
31468
  sourceYamlPath = rootPath;
31338
31469
  sourceDir = fromPath;
31339
31470
  } else {
@@ -31349,14 +31480,14 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31349
31480
  sourceDir = parentDir;
31350
31481
  }
31351
31482
  }
31352
- workspaceYamlContent = await readFile11(sourceYamlPath, "utf-8");
31483
+ workspaceYamlContent = await readFile12(sourceYamlPath, "utf-8");
31353
31484
  if (sourceDir) {
31354
31485
  const parsed2 = load(workspaceYamlContent);
31355
31486
  const workspace = parsed2?.workspace;
31356
31487
  if (workspace?.source) {
31357
31488
  const source = workspace.source;
31358
31489
  if (!isGitHubUrl(source) && !isAbsolute4(source)) {
31359
- workspace.source = resolve10(sourceDir, source);
31490
+ workspace.source = resolve11(sourceDir, source);
31360
31491
  workspaceYamlContent = dump(parsed2, { lineWidth: -1 });
31361
31492
  }
31362
31493
  }
@@ -31364,11 +31495,11 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31364
31495
  console.log(`✓ Using workspace.yaml from: ${sourceYamlPath}`);
31365
31496
  }
31366
31497
  } else {
31367
- const defaultYamlPath = join19(defaultTemplatePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
31368
- if (!existsSync17(defaultYamlPath)) {
31498
+ const defaultYamlPath = join20(defaultTemplatePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
31499
+ if (!existsSync18(defaultYamlPath)) {
31369
31500
  throw new Error(`Default template not found at: ${defaultTemplatePath}`);
31370
31501
  }
31371
- workspaceYamlContent = await readFile11(defaultYamlPath, "utf-8");
31502
+ workspaceYamlContent = await readFile12(defaultYamlPath, "utf-8");
31372
31503
  }
31373
31504
  if (options2.clients && options2.clients.length > 0) {
31374
31505
  const configParsed = load(workspaceYamlContent);
@@ -31381,8 +31512,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31381
31512
  const clientNames = getClientTypes(clients);
31382
31513
  const VSCODE_TEMPLATE_FILE2 = "template.code-workspace";
31383
31514
  if (clientNames.includes("vscode") && options2.from) {
31384
- const targetTemplatePath = join19(configDir, VSCODE_TEMPLATE_FILE2);
31385
- if (!existsSync17(targetTemplatePath)) {
31515
+ const targetTemplatePath = join20(configDir, VSCODE_TEMPLATE_FILE2);
31516
+ if (!existsSync18(targetTemplatePath)) {
31386
31517
  if (isGitHubUrl(options2.from) && githubTempDir) {
31387
31518
  if (parsedFromUrl) {
31388
31519
  const templatePath = githubBasePath ? `${githubBasePath}/${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}` : `${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}`;
@@ -31392,8 +31523,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31392
31523
  }
31393
31524
  }
31394
31525
  } else if (sourceDir) {
31395
- const sourceTemplatePath = join19(sourceDir, CONFIG_DIR, VSCODE_TEMPLATE_FILE2);
31396
- if (existsSync17(sourceTemplatePath)) {
31526
+ const sourceTemplatePath = join20(sourceDir, CONFIG_DIR, VSCODE_TEMPLATE_FILE2);
31527
+ if (existsSync18(sourceTemplatePath)) {
31397
31528
  await copyFile2(sourceTemplatePath, targetTemplatePath);
31398
31529
  }
31399
31530
  }
@@ -31406,8 +31537,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31406
31537
  if (options2.from && isGitHubUrl(options2.from) && githubTempDir) {
31407
31538
  if (parsedFromUrl) {
31408
31539
  for (const agentFile of AGENT_FILES) {
31409
- const targetFilePath = join19(absoluteTarget, agentFile);
31410
- if (existsSync17(targetFilePath)) {
31540
+ const targetFilePath = join20(absoluteTarget, agentFile);
31541
+ if (existsSync18(targetFilePath)) {
31411
31542
  copiedAgentFiles.push(agentFile);
31412
31543
  continue;
31413
31544
  }
@@ -31422,30 +31553,30 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31422
31553
  } else {
31423
31554
  const effectiveSourceDir = sourceDir ?? defaultTemplatePath;
31424
31555
  for (const agentFile of AGENT_FILES) {
31425
- const targetFilePath = join19(absoluteTarget, agentFile);
31426
- if (existsSync17(targetFilePath)) {
31556
+ const targetFilePath = join20(absoluteTarget, agentFile);
31557
+ if (existsSync18(targetFilePath)) {
31427
31558
  copiedAgentFiles.push(agentFile);
31428
31559
  continue;
31429
31560
  }
31430
- const sourcePath = join19(effectiveSourceDir, agentFile);
31431
- if (existsSync17(sourcePath)) {
31432
- const content = await readFile11(sourcePath, "utf-8");
31561
+ const sourcePath = join20(effectiveSourceDir, agentFile);
31562
+ if (existsSync18(sourcePath)) {
31563
+ const content = await readFile12(sourcePath, "utf-8");
31433
31564
  await writeFile8(targetFilePath, content, "utf-8");
31434
31565
  copiedAgentFiles.push(agentFile);
31435
31566
  }
31436
31567
  }
31437
31568
  }
31438
31569
  if (copiedAgentFiles.length === 0) {
31439
- await ensureWorkspaceRules(join19(absoluteTarget, "AGENTS.md"), repositories);
31570
+ await ensureWorkspaceRules(join20(absoluteTarget, "AGENTS.md"), repositories);
31440
31571
  copiedAgentFiles.push("AGENTS.md");
31441
31572
  } else {
31442
31573
  for (const agentFile of copiedAgentFiles) {
31443
- await ensureWorkspaceRules(join19(absoluteTarget, agentFile), repositories);
31574
+ await ensureWorkspaceRules(join20(absoluteTarget, agentFile), repositories);
31444
31575
  }
31445
31576
  }
31446
31577
  if (clientNames.includes("claude") && !copiedAgentFiles.includes("CLAUDE.md") && copiedAgentFiles.includes("AGENTS.md")) {
31447
- const agentsPath = join19(absoluteTarget, "AGENTS.md");
31448
- const claudePath = join19(absoluteTarget, "CLAUDE.md");
31578
+ const agentsPath = join20(absoluteTarget, "AGENTS.md");
31579
+ const claudePath = join20(absoluteTarget, "CLAUDE.md");
31449
31580
  await copyFile2(agentsPath, claudePath);
31450
31581
  }
31451
31582
  }
@@ -31471,7 +31602,7 @@ Syncing plugins...`);
31471
31602
  if (targetPath !== ".") {
31472
31603
  console.log(`
31473
31604
  Next steps:`);
31474
- console.log(` cd ${relative5(process.cwd(), absoluteTarget)}`);
31605
+ console.log(` cd ${relative6(process.cwd(), absoluteTarget)}`);
31475
31606
  }
31476
31607
  return {
31477
31608
  path: absoluteTarget,
@@ -31490,14 +31621,14 @@ Next steps:`);
31490
31621
  async function seedCacheFromClone(tempDir, owner, repo, branch) {
31491
31622
  const cachePaths = [
31492
31623
  getPluginCachePath(owner, repo, branch),
31493
- join19(getMarketplacesDir(), repo)
31624
+ join20(getMarketplacesDir(), repo)
31494
31625
  ];
31495
31626
  for (const cachePath of cachePaths) {
31496
- if (existsSync17(cachePath))
31627
+ if (existsSync18(cachePath))
31497
31628
  continue;
31498
31629
  try {
31499
31630
  const parentDir = dirname11(cachePath);
31500
- if (!existsSync17(parentDir)) {
31631
+ if (!existsSync18(parentDir)) {
31501
31632
  await mkdir8(parentDir, { recursive: true });
31502
31633
  }
31503
31634
  await cp2(tempDir, cachePath, { recursive: true });
@@ -31518,11 +31649,11 @@ var init_workspace = __esm(() => {
31518
31649
  });
31519
31650
 
31520
31651
  // src/core/status.ts
31521
- import { existsSync as existsSync18 } from "node:fs";
31522
- import { join as join20 } from "node:path";
31652
+ import { existsSync as existsSync19 } from "node:fs";
31653
+ import { join as join21 } from "node:path";
31523
31654
  async function getWorkspaceStatus(workspacePath = process.cwd()) {
31524
- const configPath = join20(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
31525
- if (!existsSync18(configPath) || isUserConfigPath(workspacePath)) {
31655
+ const configPath = join21(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
31656
+ if (!existsSync19(configPath) || isUserConfigPath(workspacePath)) {
31526
31657
  const userPlugins = await getUserPluginStatuses();
31527
31658
  return {
31528
31659
  success: true,
@@ -31564,7 +31695,7 @@ async function getWorkspaceStatus(workspacePath = process.cwd()) {
31564
31695
  function getPluginStatus(parsed) {
31565
31696
  if (parsed.type === "github") {
31566
31697
  const cachePath = parsed.owner && parsed.repo ? getPluginCachePath(parsed.owner, parsed.repo) : "";
31567
- const available2 = cachePath ? existsSync18(cachePath) : false;
31698
+ const available2 = cachePath ? existsSync19(cachePath) : false;
31568
31699
  return {
31569
31700
  source: parsed.original,
31570
31701
  type: "github",
@@ -31574,7 +31705,7 @@ function getPluginStatus(parsed) {
31574
31705
  ...parsed.repo && { repo: parsed.repo }
31575
31706
  };
31576
31707
  }
31577
- const available = existsSync18(parsed.normalized);
31708
+ const available = existsSync19(parsed.normalized);
31578
31709
  return {
31579
31710
  source: parsed.original,
31580
31711
  type: "local",
@@ -33711,9 +33842,9 @@ var init_prompt_clients = __esm(() => {
33711
33842
  });
33712
33843
 
33713
33844
  // src/core/skills.ts
33714
- import { existsSync as existsSync21 } from "node:fs";
33715
- import { readFile as readFile13, readdir as readdir4 } from "node:fs/promises";
33716
- import { join as join23, basename as basename6, resolve as resolve12 } from "node:path";
33845
+ import { existsSync as existsSync22 } from "node:fs";
33846
+ import { readFile as readFile14, readdir as readdir5 } from "node:fs/promises";
33847
+ import { join as join24, basename as basename6, resolve as resolve13 } from "node:path";
33717
33848
  async function resolvePluginPath(pluginSource, workspacePath) {
33718
33849
  if (isPluginSpec(pluginSource)) {
33719
33850
  const resolved2 = await resolvePluginSpecWithAutoRegister(pluginSource, {
@@ -33734,18 +33865,18 @@ async function resolvePluginPath(pluginSource, workspacePath) {
33734
33865
  });
33735
33866
  if (!result.success)
33736
33867
  return null;
33737
- const path = parsed?.subpath ? join23(result.cachePath, parsed.subpath) : result.cachePath;
33868
+ const path = parsed?.subpath ? join24(result.cachePath, parsed.subpath) : result.cachePath;
33738
33869
  return { path };
33739
33870
  }
33740
- const resolved = resolve12(workspacePath, pluginSource);
33741
- return existsSync21(resolved) ? { path: resolved } : null;
33871
+ const resolved = resolve13(workspacePath, pluginSource);
33872
+ return existsSync22(resolved) ? { path: resolved } : null;
33742
33873
  }
33743
33874
  async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
33744
- const configPath = join23(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
33745
- if (!existsSync21(configPath)) {
33875
+ const configPath = join24(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
33876
+ if (!existsSync22(configPath)) {
33746
33877
  return [];
33747
33878
  }
33748
- const content = await readFile13(configPath, "utf-8");
33879
+ const content = await readFile14(configPath, "utf-8");
33749
33880
  const config = load(content);
33750
33881
  const isV1Fallback = config.version === undefined || config.version < 2;
33751
33882
  const disabledSkills = isV1Fallback ? new Set(config.disabledSkills ?? []) : new Set;
@@ -33758,30 +33889,30 @@ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
33758
33889
  continue;
33759
33890
  const pluginPath = resolved.path;
33760
33891
  const pluginName = resolved.pluginName ?? getPluginName(pluginPath);
33761
- const skillsDir = join23(pluginPath, "skills");
33892
+ const skillsDir = join24(pluginPath, "skills");
33762
33893
  const pluginSkillsConfig = typeof pluginEntry === "string" ? undefined : pluginEntry.skills;
33763
33894
  const hasEnabledEntries = !pluginSkillsConfig && enabledSkills && [...enabledSkills].some((s) => s.startsWith(`${pluginName}`));
33764
33895
  let skillEntries;
33765
- if (existsSync21(skillsDir)) {
33766
- const entries = await readdir4(skillsDir, { withFileTypes: true });
33767
- skillEntries = entries.filter((e) => e.isDirectory()).map((e) => ({ name: e.name, skillPath: join23(skillsDir, e.name) }));
33896
+ if (existsSync22(skillsDir)) {
33897
+ const entries = await readdir5(skillsDir, { withFileTypes: true });
33898
+ skillEntries = entries.filter((e) => e.isDirectory()).map((e) => ({ name: e.name, skillPath: join24(skillsDir, e.name) }));
33768
33899
  } else {
33769
- const entries = await readdir4(pluginPath, { withFileTypes: true });
33900
+ const entries = await readdir5(pluginPath, { withFileTypes: true });
33770
33901
  const flatSkills = [];
33771
33902
  for (const entry of entries) {
33772
33903
  if (!entry.isDirectory())
33773
33904
  continue;
33774
- const skillMdPath = join23(pluginPath, entry.name, "SKILL.md");
33775
- if (existsSync21(skillMdPath)) {
33776
- flatSkills.push({ name: entry.name, skillPath: join23(pluginPath, entry.name) });
33905
+ const skillMdPath = join24(pluginPath, entry.name, "SKILL.md");
33906
+ if (existsSync22(skillMdPath)) {
33907
+ flatSkills.push({ name: entry.name, skillPath: join24(pluginPath, entry.name) });
33777
33908
  }
33778
33909
  }
33779
33910
  if (flatSkills.length > 0) {
33780
33911
  skillEntries = flatSkills;
33781
33912
  } else {
33782
- const rootSkillMd = join23(pluginPath, "SKILL.md");
33783
- if (existsSync21(rootSkillMd)) {
33784
- const skillContent = await readFile13(rootSkillMd, "utf-8");
33913
+ const rootSkillMd = join24(pluginPath, "SKILL.md");
33914
+ if (existsSync22(rootSkillMd)) {
33915
+ const skillContent = await readFile14(rootSkillMd, "utf-8");
33785
33916
  const metadata = parseSkillMetadata(skillContent);
33786
33917
  const skillName = metadata?.name ?? basename6(pluginPath);
33787
33918
  skillEntries = [{ name: skillName, skillPath: pluginPath }];
@@ -33822,28 +33953,28 @@ async function findSkillByName(skillName, workspacePath = process.cwd()) {
33822
33953
  return allSkills.filter((s) => s.name === skillName);
33823
33954
  }
33824
33955
  async function discoverSkillNames(pluginPath) {
33825
- if (!existsSync21(pluginPath))
33956
+ if (!existsSync22(pluginPath))
33826
33957
  return [];
33827
- const skillsDir = join23(pluginPath, "skills");
33828
- if (existsSync21(skillsDir)) {
33829
- const entries2 = await readdir4(skillsDir, { withFileTypes: true });
33958
+ const skillsDir = join24(pluginPath, "skills");
33959
+ if (existsSync22(skillsDir)) {
33960
+ const entries2 = await readdir5(skillsDir, { withFileTypes: true });
33830
33961
  return entries2.filter((e) => e.isDirectory()).map((e) => e.name);
33831
33962
  }
33832
- const entries = await readdir4(pluginPath, { withFileTypes: true });
33963
+ const entries = await readdir5(pluginPath, { withFileTypes: true });
33833
33964
  const flatSkills = [];
33834
33965
  for (const entry of entries) {
33835
33966
  if (!entry.isDirectory())
33836
33967
  continue;
33837
- if (existsSync21(join23(pluginPath, entry.name, "SKILL.md"))) {
33968
+ if (existsSync22(join24(pluginPath, entry.name, "SKILL.md"))) {
33838
33969
  flatSkills.push(entry.name);
33839
33970
  }
33840
33971
  }
33841
33972
  if (flatSkills.length > 0)
33842
33973
  return flatSkills;
33843
- const rootSkillMd = join23(pluginPath, "SKILL.md");
33844
- if (existsSync21(rootSkillMd)) {
33974
+ const rootSkillMd = join24(pluginPath, "SKILL.md");
33975
+ if (existsSync22(rootSkillMd)) {
33845
33976
  try {
33846
- const content = await readFile13(rootSkillMd, "utf-8");
33977
+ const content = await readFile14(rootSkillMd, "utf-8");
33847
33978
  const { parseSkillMetadata: parseSkillMetadata2 } = await Promise.resolve().then(() => (init_skill(), exports_skill));
33848
33979
  const metadata = parseSkillMetadata2(content);
33849
33980
  return [metadata?.name ?? basename6(pluginPath)];
@@ -33952,12 +34083,12 @@ var require_isexe = __commonJS((exports, module) => {
33952
34083
  if (typeof Promise !== "function") {
33953
34084
  throw new TypeError("callback not provided");
33954
34085
  }
33955
- return new Promise(function(resolve13, reject) {
34086
+ return new Promise(function(resolve14, reject) {
33956
34087
  isexe(path, options2 || {}, function(er, is) {
33957
34088
  if (er) {
33958
34089
  reject(er);
33959
34090
  } else {
33960
- resolve13(is);
34091
+ resolve14(is);
33961
34092
  }
33962
34093
  });
33963
34094
  });
@@ -34019,27 +34150,27 @@ var require_which = __commonJS((exports, module) => {
34019
34150
  opt = {};
34020
34151
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
34021
34152
  const found = [];
34022
- const step = (i2) => new Promise((resolve13, reject) => {
34153
+ const step = (i2) => new Promise((resolve14, reject) => {
34023
34154
  if (i2 === pathEnv.length)
34024
- return opt.all && found.length ? resolve13(found) : reject(getNotFoundError(cmd));
34155
+ return opt.all && found.length ? resolve14(found) : reject(getNotFoundError(cmd));
34025
34156
  const ppRaw = pathEnv[i2];
34026
34157
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
34027
34158
  const pCmd = path.join(pathPart, cmd);
34028
34159
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
34029
- resolve13(subStep(p, i2, 0));
34160
+ resolve14(subStep(p, i2, 0));
34030
34161
  });
34031
- const subStep = (p, i2, ii) => new Promise((resolve13, reject) => {
34162
+ const subStep = (p, i2, ii) => new Promise((resolve14, reject) => {
34032
34163
  if (ii === pathExt.length)
34033
- return resolve13(step(i2 + 1));
34164
+ return resolve14(step(i2 + 1));
34034
34165
  const ext = pathExt[ii];
34035
34166
  isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
34036
34167
  if (!er && is) {
34037
34168
  if (opt.all)
34038
34169
  found.push(p + ext);
34039
34170
  else
34040
- return resolve13(p + ext);
34171
+ return resolve14(p + ext);
34041
34172
  }
34042
- return resolve13(subStep(p, i2, ii + 1));
34173
+ return resolve14(subStep(p, i2, ii + 1));
34043
34174
  });
34044
34175
  });
34045
34176
  return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
@@ -34361,7 +34492,7 @@ var package_default;
34361
34492
  var init_package = __esm(() => {
34362
34493
  package_default = {
34363
34494
  name: "allagents",
34364
- version: "1.5.0",
34495
+ version: "1.6.1",
34365
34496
  description: "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
34366
34497
  type: "module",
34367
34498
  bin: {
@@ -34441,13 +34572,13 @@ var init_package = __esm(() => {
34441
34572
  });
34442
34573
 
34443
34574
  // src/cli/update-check.ts
34444
- import { readFile as readFile16 } from "node:fs/promises";
34445
- import { join as join26 } from "node:path";
34575
+ import { readFile as readFile17 } from "node:fs/promises";
34576
+ import { join as join27 } from "node:path";
34446
34577
  import { spawn as spawn3 } from "node:child_process";
34447
34578
  async function getCachedUpdateInfo(path3) {
34448
- const filePath = path3 ?? join26(getHomeDir(), CONFIG_DIR, CACHE_FILE);
34579
+ const filePath = path3 ?? join27(getHomeDir(), CONFIG_DIR, CACHE_FILE);
34449
34580
  try {
34450
- const raw = await readFile16(filePath, "utf-8");
34581
+ const raw = await readFile17(filePath, "utf-8");
34451
34582
  const data = JSON.parse(raw);
34452
34583
  if (typeof data.latestVersion === "string" && typeof data.lastCheckedAt === "string") {
34453
34584
  return data;
@@ -34483,8 +34614,8 @@ function buildNotice(currentVersion, latestVersion) {
34483
34614
  Run \`allagents self update\` to upgrade.`);
34484
34615
  }
34485
34616
  function backgroundUpdateCheck() {
34486
- const dir = join26(getHomeDir(), CONFIG_DIR);
34487
- const filePath = join26(dir, CACHE_FILE);
34617
+ const dir = join27(getHomeDir(), CONFIG_DIR);
34618
+ const filePath = join27(dir, CACHE_FILE);
34488
34619
  const script = `
34489
34620
  const https = require('https');
34490
34621
  const fs = require('fs');
@@ -34571,15 +34702,15 @@ class TuiCache {
34571
34702
  }
34572
34703
 
34573
34704
  // src/cli/tui/context.ts
34574
- import { existsSync as existsSync24 } from "node:fs";
34575
- import { join as join27 } from "node:path";
34705
+ import { existsSync as existsSync25 } from "node:fs";
34706
+ import { join as join28 } from "node:path";
34576
34707
  async function getTuiContext(cwd = process.cwd(), cache2) {
34577
34708
  const cachedContext = cache2?.getContext();
34578
34709
  if (cachedContext) {
34579
34710
  return cachedContext;
34580
34711
  }
34581
- const configPath = join27(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
34582
- const hasWorkspace = existsSync24(configPath) && !isUserConfigPath(cwd);
34712
+ const configPath = join28(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
34713
+ const hasWorkspace = existsSync25(configPath) && !isUserConfigPath(cwd);
34583
34714
  let projectPluginCount = 0;
34584
34715
  if (hasWorkspace) {
34585
34716
  try {
@@ -35830,7 +35961,7 @@ __export(exports_wizard, {
35830
35961
  runWizard: () => runWizard,
35831
35962
  buildMenuOptions: () => buildMenuOptions
35832
35963
  });
35833
- import { relative as relative6 } from "node:path";
35964
+ import { relative as relative7 } from "node:path";
35834
35965
  function buildMenuOptions(context) {
35835
35966
  const options2 = [];
35836
35967
  if (context.needsSync) {
@@ -35859,7 +35990,7 @@ function buildCompactSummary(context) {
35859
35990
  function buildSummary(context) {
35860
35991
  const lines = [];
35861
35992
  if (context.hasWorkspace && context.workspacePath) {
35862
- const relPath = relative6(process.cwd(), context.workspacePath) || ".";
35993
+ const relPath = relative7(process.cwd(), context.workspacePath) || ".";
35863
35994
  lines.push(`Workspace: ${relPath}`);
35864
35995
  lines.push(`Project plugins: ${context.projectPluginCount}`);
35865
35996
  } else {
@@ -35995,8 +36126,8 @@ init_workspace();
35995
36126
  init_sync();
35996
36127
  init_status2();
35997
36128
  var import_cmd_ts2 = __toESM(require_cjs(), 1);
35998
- import { existsSync as existsSync20 } from "node:fs";
35999
- import { join as join22, resolve as resolve11 } from "node:path";
36129
+ import { existsSync as existsSync21 } from "node:fs";
36130
+ import { join as join23, resolve as resolve12 } from "node:path";
36000
36131
 
36001
36132
  // src/core/prune.ts
36002
36133
  init_js_yaml();
@@ -36004,9 +36135,9 @@ init_constants();
36004
36135
  init_marketplace();
36005
36136
  init_user_workspace();
36006
36137
  init_workspace_config();
36007
- import { readFile as readFile12, writeFile as writeFile9 } from "node:fs/promises";
36008
- import { existsSync as existsSync19 } from "node:fs";
36009
- import { join as join21 } from "node:path";
36138
+ import { readFile as readFile13, writeFile as writeFile9 } from "node:fs/promises";
36139
+ import { existsSync as existsSync20 } from "node:fs";
36140
+ import { join as join22 } from "node:path";
36010
36141
  async function isOrphanedPlugin(pluginSpec) {
36011
36142
  if (!isPluginSpec(pluginSpec))
36012
36143
  return false;
@@ -36033,9 +36164,9 @@ async function prunePlugins(plugins) {
36033
36164
  }
36034
36165
  async function pruneOrphanedPlugins(workspacePath) {
36035
36166
  let projectResult = { removed: [], kept: [], keptEntries: [] };
36036
- const projectConfigPath = join21(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
36037
- if (existsSync19(projectConfigPath) && !isUserConfigPath(workspacePath)) {
36038
- const content = await readFile12(projectConfigPath, "utf-8");
36167
+ const projectConfigPath = join22(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
36168
+ if (existsSync20(projectConfigPath) && !isUserConfigPath(workspacePath)) {
36169
+ const content = await readFile13(projectConfigPath, "utf-8");
36039
36170
  const config = load(content);
36040
36171
  projectResult = await prunePlugins(config.plugins);
36041
36172
  if (projectResult.removed.length > 0) {
@@ -36326,8 +36457,8 @@ var syncCmd = import_cmd_ts2.command({
36326
36457
  `);
36327
36458
  }
36328
36459
  const userConfigExists = !!await getUserWorkspaceConfig();
36329
- const projectConfigPath = join22(process.cwd(), ".allagents", "workspace.yaml");
36330
- const projectConfigExists = existsSync20(projectConfigPath);
36460
+ const projectConfigPath = join23(process.cwd(), ".allagents", "workspace.yaml");
36461
+ const projectConfigExists = existsSync21(projectConfigPath);
36331
36462
  if (!userConfigExists && !projectConfigExists) {
36332
36463
  await ensureUserWorkspace();
36333
36464
  if (isJsonMode()) {
@@ -36615,7 +36746,7 @@ var repoAddCmd = import_cmd_ts2.command({
36615
36746
  },
36616
36747
  handler: async ({ path: repoPath, description }) => {
36617
36748
  try {
36618
- const resolvedPath = resolve11(process.cwd(), repoPath);
36749
+ const resolvedPath = resolve12(process.cwd(), repoPath);
36619
36750
  const remote = await detectRemote(resolvedPath);
36620
36751
  const result = await addRepository(repoPath, {
36621
36752
  source: remote?.source,
@@ -36995,9 +37126,9 @@ init_workspace_modify();
36995
37126
  init_user_workspace();
36996
37127
  init_skills();
36997
37128
  var import_cmd_ts3 = __toESM(require_cjs(), 1);
36998
- import { existsSync as existsSync22 } from "node:fs";
36999
- import { readFile as readFile14 } from "node:fs/promises";
37000
- import { join as join24 } from "node:path";
37129
+ import { existsSync as existsSync23 } from "node:fs";
37130
+ import { readFile as readFile15 } from "node:fs/promises";
37131
+ import { join as join25 } from "node:path";
37001
37132
 
37002
37133
  // src/cli/metadata/plugin-skills.ts
37003
37134
  var skillsListMeta = {
@@ -37088,7 +37219,7 @@ init_skill();
37088
37219
  init_marketplace();
37089
37220
  init_marketplace_manifest_parser();
37090
37221
  function hasProjectConfig(dir) {
37091
- return existsSync22(join24(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
37222
+ return existsSync23(join25(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
37092
37223
  }
37093
37224
  function resolveScope(cwd) {
37094
37225
  if (isUserConfigPath(cwd))
@@ -37119,7 +37250,7 @@ async function resolveSkillNameFromRepo(url, parsed, fallbackName, fetchFn = fet
37119
37250
  if (!fetchResult.success)
37120
37251
  return fallbackName;
37121
37252
  try {
37122
- const skillMd = await readFile14(join24(fetchResult.cachePath, "SKILL.md"), "utf-8");
37253
+ const skillMd = await readFile15(join25(fetchResult.cachePath, "SKILL.md"), "utf-8");
37123
37254
  const metadata = parseSkillMetadata(skillMd);
37124
37255
  return metadata?.name ?? fallbackName;
37125
37256
  } catch {
@@ -37676,9 +37807,9 @@ init_format_sync();
37676
37807
  init_workspace_config();
37677
37808
  init_constants();
37678
37809
  init_js_yaml();
37679
- import { readFile as readFile15 } from "node:fs/promises";
37680
- import { existsSync as existsSync23 } from "node:fs";
37681
- import { join as join25 } from "node:path";
37810
+ import { readFile as readFile16 } from "node:fs/promises";
37811
+ import { existsSync as existsSync24 } from "node:fs";
37812
+ import { join as join26 } from "node:path";
37682
37813
  async function runSyncAndPrint(options2) {
37683
37814
  if (!isJsonMode()) {
37684
37815
  console.log(`
@@ -37923,7 +38054,7 @@ var marketplaceAddCmd = import_cmd_ts4.command({
37923
38054
  process.exit(1);
37924
38055
  }
37925
38056
  if (effectiveScope === "project") {
37926
- if (!existsSync23(join25(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE))) {
38057
+ if (!existsSync24(join26(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE))) {
37927
38058
  const msg = 'No workspace found in current directory. Run "allagents workspace init" first.';
37928
38059
  if (isJsonMode()) {
37929
38060
  jsonOutput({ success: false, command: "plugin marketplace add", error: msg });
@@ -38230,10 +38361,10 @@ var pluginListCmd = import_cmd_ts4.command({
38230
38361
  };
38231
38362
  const pluginClients = new Map;
38232
38363
  async function loadConfigClients(configPath, scope) {
38233
- if (!existsSync23(configPath))
38364
+ if (!existsSync24(configPath))
38234
38365
  return;
38235
38366
  try {
38236
- const content = await readFile15(configPath, "utf-8");
38367
+ const content = await readFile16(configPath, "utf-8");
38237
38368
  const config = load(content);
38238
38369
  if (!config?.plugins || !config?.clients)
38239
38370
  return;
@@ -38245,8 +38376,8 @@ var pluginListCmd = import_cmd_ts4.command({
38245
38376
  }
38246
38377
  } catch {}
38247
38378
  }
38248
- const userConfigPath = join25(getAllagentsDir(), WORKSPACE_CONFIG_FILE);
38249
- const projectConfigPath = join25(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
38379
+ const userConfigPath = join26(getAllagentsDir(), WORKSPACE_CONFIG_FILE);
38380
+ const projectConfigPath = join26(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
38250
38381
  const cwdIsHome = isUserConfigPath(process.cwd());
38251
38382
  await loadConfigClients(userConfigPath, "user");
38252
38383
  if (!cwdIsHome) {
@@ -38388,7 +38519,7 @@ var pluginInstallCmd = import_cmd_ts4.command({
38388
38519
  const isUser = scope === "user" || !scope && isUserConfigPath(process.cwd());
38389
38520
  if (isUser) {
38390
38521
  const userConfigPath = getUserWorkspaceConfigPath();
38391
- if (!existsSync23(userConfigPath)) {
38522
+ if (!existsSync24(userConfigPath)) {
38392
38523
  const { promptForClients: promptForClients2 } = await Promise.resolve().then(() => (init_prompt_clients(), exports_prompt_clients));
38393
38524
  const clients = await promptForClients2();
38394
38525
  if (clients === null) {
@@ -38400,8 +38531,8 @@ var pluginInstallCmd = import_cmd_ts4.command({
38400
38531
  await ensureUserWorkspace(clients);
38401
38532
  }
38402
38533
  } else {
38403
- const configPath = join25(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
38404
- if (!existsSync23(configPath)) {
38534
+ const configPath = join26(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
38535
+ if (!existsSync24(configPath)) {
38405
38536
  const { promptForClients: promptForClients2 } = await Promise.resolve().then(() => (init_prompt_clients(), exports_prompt_clients));
38406
38537
  const clients = await promptForClients2();
38407
38538
  if (clients === null) {
@@ -38678,14 +38809,14 @@ var pluginUpdateCmd = import_cmd_ts4.command({
38678
38809
  }
38679
38810
  }
38680
38811
  if (updateProject && !isUserConfigPath(process.cwd())) {
38681
- const { existsSync: existsSync24 } = await import("node:fs");
38682
- const { readFile: readFile16 } = await import("node:fs/promises");
38683
- const { join: join26 } = await import("node:path");
38812
+ const { existsSync: existsSync25 } = await import("node:fs");
38813
+ const { readFile: readFile17 } = await import("node:fs/promises");
38814
+ const { join: join27 } = await import("node:path");
38684
38815
  const { load: load2 } = await Promise.resolve().then(() => (init_js_yaml(), exports_js_yaml));
38685
38816
  const { CONFIG_DIR: CONFIG_DIR2, WORKSPACE_CONFIG_FILE: WORKSPACE_CONFIG_FILE2 } = await Promise.resolve().then(() => (init_constants(), exports_constants));
38686
- const configPath = join26(process.cwd(), CONFIG_DIR2, WORKSPACE_CONFIG_FILE2);
38687
- if (existsSync24(configPath)) {
38688
- const content = await readFile16(configPath, "utf-8");
38817
+ const configPath = join27(process.cwd(), CONFIG_DIR2, WORKSPACE_CONFIG_FILE2);
38818
+ if (existsSync25(configPath)) {
38819
+ const content = await readFile17(configPath, "utf-8");
38689
38820
  const config = load2(content);
38690
38821
  for (const entry of config.plugins ?? []) {
38691
38822
  const p = getPluginSource(entry);
@@ -39717,7 +39848,7 @@ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise
39717
39848
  return spawnedPromise;
39718
39849
  }
39719
39850
  let timeoutId;
39720
- const timeoutPromise = new Promise((resolve13, reject) => {
39851
+ const timeoutPromise = new Promise((resolve14, reject) => {
39721
39852
  timeoutId = setTimeout(() => {
39722
39853
  timeoutKill(spawned, killSignal, reject);
39723
39854
  }, timeout);
@@ -40081,9 +40212,9 @@ var mergePromise = (spawned, promise) => {
40081
40212
  Reflect.defineProperty(spawned, property, { ...descriptor, value });
40082
40213
  }
40083
40214
  };
40084
- var getSpawnedPromise = (spawned) => new Promise((resolve13, reject) => {
40215
+ var getSpawnedPromise = (spawned) => new Promise((resolve14, reject) => {
40085
40216
  spawned.on("exit", (exitCode, signal) => {
40086
- resolve13({ exitCode, signal });
40217
+ resolve14({ exitCode, signal });
40087
40218
  });
40088
40219
  spawned.on("error", (error) => {
40089
40220
  reject(error);