allagents 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +362 -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
+ ## Workspace 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,100 @@ 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
+ });
28428
+ } catch {}
28429
+ }
28430
+ }
28431
+ return results;
28432
+ }
28433
+ async function discoverWorkspaceSkills(workspacePath, repositories, clientNames) {
28434
+ const allSkills = [];
28435
+ for (const repo of repositories) {
28436
+ if (repo.skills === false)
28437
+ continue;
28438
+ const repoAbsPath = resolve8(workspacePath, repo.path);
28439
+ const discoverOpts = Array.isArray(repo.skills) ? { skillPaths: repo.skills } : { clients: clientNames };
28440
+ const repoSkills = await discoverRepoSkills(repoAbsPath, discoverOpts);
28441
+ for (const skill of repoSkills) {
28442
+ const location = `${repo.path}/${skill.relativePath}`.replace(/\\/g, "/");
28443
+ allSkills.push({
28444
+ repoPath: repo.path,
28445
+ name: skill.name,
28446
+ description: skill.description,
28447
+ location
28448
+ });
28449
+ }
28450
+ }
28451
+ return allSkills;
28452
+ }
28453
+ var init_repo_skills = __esm(() => {
28454
+ init_skill();
28455
+ init_client_mapping();
28456
+ });
28457
+
28350
28458
  // 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";
28459
+ import { readFile as readFile9, writeFile as writeFile5 } from "node:fs/promises";
28460
+ import { existsSync as existsSync10 } from "node:fs";
28461
+ import { join as join13 } from "node:path";
28354
28462
  async function detectRemote(repoPath) {
28355
28463
  try {
28356
28464
  const env2 = { ...process.env };
@@ -28392,10 +28500,10 @@ function normalizePath(p) {
28392
28500
  }
28393
28501
  async function addRepository(path, options2 = {}, workspacePath = process.cwd()) {
28394
28502
  const normalizedPath = normalizePath(path);
28395
- const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28503
+ const configPath = join13(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28396
28504
  await ensureWorkspace(workspacePath);
28397
28505
  try {
28398
- const content = await readFile8(configPath, "utf-8");
28506
+ const content = await readFile9(configPath, "utf-8");
28399
28507
  const config = load(content);
28400
28508
  if (config.repositories.some((r) => normalizePath(r.path) === normalizedPath)) {
28401
28509
  return { success: false, error: `Repository already exists: ${normalizedPath}` };
@@ -28415,8 +28523,8 @@ async function addRepository(path, options2 = {}, workspacePath = process.cwd())
28415
28523
  }
28416
28524
  }
28417
28525
  async function removeRepository(path, workspacePath = process.cwd()) {
28418
- const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28419
- if (!existsSync9(configPath)) {
28526
+ const configPath = join13(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28527
+ if (!existsSync10(configPath)) {
28420
28528
  return {
28421
28529
  success: false,
28422
28530
  error: `${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
@@ -28424,7 +28532,7 @@ async function removeRepository(path, workspacePath = process.cwd()) {
28424
28532
  };
28425
28533
  }
28426
28534
  try {
28427
- const content = await readFile8(configPath, "utf-8");
28535
+ const content = await readFile9(configPath, "utf-8");
28428
28536
  const config = load(content);
28429
28537
  const normalizedPath = normalizePath(path);
28430
28538
  const index = config.repositories.findIndex((r) => normalizePath(r.path) === normalizedPath);
@@ -28439,34 +28547,40 @@ async function removeRepository(path, workspacePath = process.cwd()) {
28439
28547
  }
28440
28548
  }
28441
28549
  async function listRepositories(workspacePath = process.cwd()) {
28442
- const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28443
- if (!existsSync9(configPath))
28550
+ const configPath = join13(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28551
+ if (!existsSync10(configPath))
28444
28552
  return [];
28445
28553
  try {
28446
- const content = await readFile8(configPath, "utf-8");
28554
+ const content = await readFile9(configPath, "utf-8");
28447
28555
  const config = load(content);
28448
28556
  return config.repositories ?? [];
28449
28557
  } catch {
28450
28558
  return [];
28451
28559
  }
28452
28560
  }
28561
+ function resolveClientNames(clients) {
28562
+ return (clients ?? []).map((c) => typeof c === "string" ? c : c.name);
28563
+ }
28453
28564
  async function updateAgentFiles(workspacePath = process.cwd()) {
28454
- const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28455
- if (!existsSync9(configPath))
28565
+ const configPath = join13(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28566
+ if (!existsSync10(configPath))
28456
28567
  return;
28457
- const content = await readFile8(configPath, "utf-8");
28568
+ const content = await readFile9(configPath, "utf-8");
28458
28569
  const config = load(content);
28459
28570
  if (config.repositories.length === 0)
28460
28571
  return;
28572
+ const clientNames = resolveClientNames(config.clients);
28573
+ const allSkills = await discoverWorkspaceSkills(workspacePath, config.repositories, clientNames);
28461
28574
  const agentFiles = new Set;
28462
28575
  for (const client of config.clients ?? []) {
28463
- const mapping = CLIENT_MAPPINGS[client];
28576
+ const clientName = typeof client === "string" ? client : client.name;
28577
+ const mapping = CLIENT_MAPPINGS[clientName];
28464
28578
  if (mapping?.agentFile)
28465
28579
  agentFiles.add(mapping.agentFile);
28466
28580
  }
28467
28581
  agentFiles.add("AGENTS.md");
28468
28582
  for (const agentFile of agentFiles) {
28469
- await ensureWorkspaceRules(join12(workspacePath, agentFile), config.repositories);
28583
+ await ensureWorkspaceRules(join13(workspacePath, agentFile), config.repositories, allSkills);
28470
28584
  }
28471
28585
  }
28472
28586
  var init_workspace_repo = __esm(() => {
@@ -28475,6 +28589,7 @@ var init_workspace_repo = __esm(() => {
28475
28589
  init_workspace_modify();
28476
28590
  init_transform();
28477
28591
  init_client_mapping();
28592
+ init_repo_skills();
28478
28593
  });
28479
28594
 
28480
28595
  // src/utils/hash.ts
@@ -28641,14 +28756,14 @@ var init_sync_state = __esm(() => {
28641
28756
  });
28642
28757
 
28643
28758
  // 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";
28759
+ import { writeFile as writeFile6, readFile as readFile10 } from "node:fs/promises";
28760
+ import { existsSync as existsSync11 } from "node:fs";
28761
+ import { join as join14 } from "node:path";
28647
28762
  async function ensureConfigGitignore(workspacePath) {
28648
- const gitignorePath = join13(workspacePath, CONFIG_DIR, ".gitignore");
28763
+ const gitignorePath = join14(workspacePath, CONFIG_DIR, ".gitignore");
28649
28764
  let existing = "";
28650
- if (existsSync10(gitignorePath)) {
28651
- existing = await readFile9(gitignorePath, "utf-8");
28765
+ if (existsSync11(gitignorePath)) {
28766
+ existing = await readFile10(gitignorePath, "utf-8");
28652
28767
  }
28653
28768
  const missing = GITIGNORE_ENTRIES.filter((entry) => !existing.split(`
28654
28769
  `).includes(entry));
@@ -28669,19 +28784,19 @@ var init_config_gitignore = __esm(() => {
28669
28784
  });
28670
28785
 
28671
28786
  // 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";
28787
+ import { readFile as readFile11, writeFile as writeFile7, mkdir as mkdir7 } from "node:fs/promises";
28788
+ import { existsSync as existsSync12 } from "node:fs";
28789
+ import { join as join15, dirname as dirname6 } from "node:path";
28675
28790
  function getSyncStatePath(workspacePath) {
28676
- return join14(workspacePath, CONFIG_DIR, SYNC_STATE_FILE);
28791
+ return join15(workspacePath, CONFIG_DIR, SYNC_STATE_FILE);
28677
28792
  }
28678
28793
  async function loadSyncState(workspacePath) {
28679
28794
  const statePath = getSyncStatePath(workspacePath);
28680
- if (!existsSync11(statePath)) {
28795
+ if (!existsSync12(statePath)) {
28681
28796
  return null;
28682
28797
  }
28683
28798
  try {
28684
- const content = await readFile10(statePath, "utf-8");
28799
+ const content = await readFile11(statePath, "utf-8");
28685
28800
  const parsed = JSON.parse(content);
28686
28801
  const result = SyncStateSchema.safeParse(parsed);
28687
28802
  if (!result.success) {
@@ -28733,11 +28848,11 @@ var init_sync_state2 = __esm(() => {
28733
28848
 
28734
28849
  // src/core/vscode-workspace.ts
28735
28850
  import { createHash as createHash2 } from "node:crypto";
28736
- import { resolve as resolve8, basename as basename5, isAbsolute as isAbsolute3, relative as relative3 } from "node:path";
28851
+ import { resolve as resolve9, basename as basename5, isAbsolute as isAbsolute3, relative as relative4 } from "node:path";
28737
28852
  function buildPathPlaceholderMap(repositories, workspacePath) {
28738
28853
  const map2 = new Map;
28739
28854
  for (const repo of repositories) {
28740
- const absolutePath = resolve8(workspacePath, repo.path);
28855
+ const absolutePath = resolve9(workspacePath, repo.path);
28741
28856
  map2.set(repo.path, absolutePath);
28742
28857
  }
28743
28858
  return map2;
@@ -28772,9 +28887,9 @@ function generateVscodeWorkspace(input) {
28772
28887
  const folders = [];
28773
28888
  const seenPaths = new Set;
28774
28889
  folders.push({ path: "." });
28775
- seenPaths.add(resolve8(workspacePath, "."));
28890
+ seenPaths.add(resolve9(workspacePath, "."));
28776
28891
  for (const repo of repositories) {
28777
- const absolutePath = resolve8(workspacePath, repo.path).replace(/\\/g, "/");
28892
+ const absolutePath = resolve9(workspacePath, repo.path).replace(/\\/g, "/");
28778
28893
  const entry = { path: absolutePath };
28779
28894
  if (repo.name)
28780
28895
  entry.name = repo.name;
@@ -28784,7 +28899,7 @@ function generateVscodeWorkspace(input) {
28784
28899
  if (resolvedTemplate && Array.isArray(resolvedTemplate.folders)) {
28785
28900
  for (const folder of resolvedTemplate.folders) {
28786
28901
  const rawPath = folder.path;
28787
- const normalizedPath = (typeof rawPath === "string" && !isAbsolute3(rawPath) ? resolve8(workspacePath, rawPath) : rawPath).replace(/\\/g, "/");
28902
+ const normalizedPath = (typeof rawPath === "string" && !isAbsolute3(rawPath) ? resolve9(workspacePath, rawPath) : rawPath).replace(/\\/g, "/");
28788
28903
  if (!seenPaths.has(normalizedPath)) {
28789
28904
  const entry = { path: normalizedPath };
28790
28905
  if (folder.name)
@@ -28814,22 +28929,22 @@ function getWorkspaceOutputPath(workspacePath, vscodeConfig) {
28814
28929
  const name = vscodeConfig?.output;
28815
28930
  if (name) {
28816
28931
  const filename = name.endsWith(".code-workspace") ? name : `${name}.code-workspace`;
28817
- return resolve8(workspacePath, filename);
28932
+ return resolve9(workspacePath, filename);
28818
28933
  }
28819
- const dirName = basename5(resolve8(workspacePath));
28820
- return resolve8(workspacePath, `${dirName}.code-workspace`);
28934
+ const dirName = basename5(resolve9(workspacePath));
28935
+ return resolve9(workspacePath, `${dirName}.code-workspace`);
28821
28936
  }
28822
28937
  function computeWorkspaceHash(content) {
28823
28938
  return createHash2("sha256").update(content).digest("hex");
28824
28939
  }
28825
28940
  function reconcileVscodeWorkspaceFolders(workspacePath, codeWorkspaceFolders, lastSyncedRepos, currentRepos) {
28826
- const normalizedWorkspacePath = resolve8(workspacePath).replace(/\\/g, "/");
28941
+ const normalizedWorkspacePath = resolve9(workspacePath).replace(/\\/g, "/");
28827
28942
  const codeWorkspaceAbsPaths = new Set;
28828
28943
  const codeWorkspaceNames = new Map;
28829
28944
  for (const folder of codeWorkspaceFolders) {
28830
28945
  if (folder.path === ".")
28831
28946
  continue;
28832
- const absPath = (isAbsolute3(folder.path) ? folder.path : resolve8(workspacePath, folder.path)).replace(/\\/g, "/");
28947
+ const absPath = (isAbsolute3(folder.path) ? folder.path : resolve9(workspacePath, folder.path)).replace(/\\/g, "/");
28833
28948
  codeWorkspaceAbsPaths.add(absPath);
28834
28949
  if (folder.name)
28835
28950
  codeWorkspaceNames.set(absPath, folder.name);
@@ -28837,7 +28952,7 @@ function reconcileVscodeWorkspaceFolders(workspacePath, codeWorkspaceFolders, la
28837
28952
  const lastSyncedSet = new Set(lastSyncedRepos.map((p) => p.replace(/\\/g, "/")));
28838
28953
  const currentReposByAbsPath = new Map;
28839
28954
  for (const repo of currentRepos) {
28840
- const absPath = resolve8(workspacePath, repo.path).replace(/\\/g, "/");
28955
+ const absPath = resolve9(workspacePath, repo.path).replace(/\\/g, "/");
28841
28956
  currentReposByAbsPath.set(absPath, repo);
28842
28957
  }
28843
28958
  const currentAbsPaths = new Set(currentReposByAbsPath.keys());
@@ -28869,7 +28984,7 @@ function reconcileVscodeWorkspaceFolders(workspacePath, codeWorkspaceFolders, la
28869
28984
  const inLastSync = lastSyncedSet.has(absPath);
28870
28985
  const inCurrentRepos = currentAbsPaths.has(absPath);
28871
28986
  if (!inLastSync && !inCurrentRepos) {
28872
- const relPath = relative3(normalizedWorkspacePath, absPath).replace(/\\/g, "/");
28987
+ const relPath = relative4(normalizedWorkspacePath, absPath).replace(/\\/g, "/");
28873
28988
  added.push(relPath);
28874
28989
  const newRepo = { path: relPath };
28875
28990
  const folderName = codeWorkspaceNames.get(absPath);
@@ -28888,8 +29003,8 @@ var init_vscode_workspace = __esm(() => {
28888
29003
  });
28889
29004
 
28890
29005
  // 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";
29006
+ import { existsSync as existsSync13, readFileSync, writeFileSync, mkdirSync } from "node:fs";
29007
+ import { join as join16, dirname as dirname7 } from "node:path";
28893
29008
  function deepEqual(a, b) {
28894
29009
  if (a === b)
28895
29010
  return true;
@@ -28921,17 +29036,17 @@ function getVscodeMcpConfigPath() {
28921
29036
  if (!appData) {
28922
29037
  throw new Error("APPDATA environment variable not set");
28923
29038
  }
28924
- return join15(appData, "Code", "User", "mcp.json");
29039
+ return join16(appData, "Code", "User", "mcp.json");
28925
29040
  }
28926
29041
  const home = getHomeDir();
28927
29042
  if (platform2 === "darwin") {
28928
- return join15(home, "Library", "Application Support", "Code", "User", "mcp.json");
29043
+ return join16(home, "Library", "Application Support", "Code", "User", "mcp.json");
28929
29044
  }
28930
- return join15(home, ".config", "Code", "User", "mcp.json");
29045
+ return join16(home, ".config", "Code", "User", "mcp.json");
28931
29046
  }
28932
29047
  function readPluginMcpConfig(pluginPath) {
28933
- const mcpPath = join15(pluginPath, ".mcp.json");
28934
- if (!existsSync12(mcpPath)) {
29048
+ const mcpPath = join16(pluginPath, ".mcp.json");
29049
+ if (!existsSync13(mcpPath)) {
28935
29050
  return null;
28936
29051
  }
28937
29052
  try {
@@ -28982,7 +29097,7 @@ function syncVscodeMcpConfig(validatedPlugins, options2) {
28982
29097
  trackedServers: []
28983
29098
  };
28984
29099
  let existingConfig = {};
28985
- if (existsSync12(configPath)) {
29100
+ if (existsSync13(configPath)) {
28986
29101
  try {
28987
29102
  const content = readFileSync(configPath, "utf-8");
28988
29103
  existingConfig = import_json5.default.parse(content);
@@ -29033,7 +29148,7 @@ function syncVscodeMcpConfig(validatedPlugins, options2) {
29033
29148
  if (hasChanges && !dryRun) {
29034
29149
  existingConfig.servers = existingServers;
29035
29150
  const dir = dirname7(configPath);
29036
- if (!existsSync12(dir)) {
29151
+ if (!existsSync13(dir)) {
29037
29152
  mkdirSync(dir, { recursive: true });
29038
29153
  }
29039
29154
  writeFileSync(configPath, `${JSON.stringify(existingConfig, null, 2)}
@@ -29051,7 +29166,7 @@ function syncVscodeMcpConfig(validatedPlugins, options2) {
29051
29166
  if (result.removed > 0 && !dryRun) {
29052
29167
  existingConfig.servers = existingServers;
29053
29168
  const dir = dirname7(configPath);
29054
- if (!existsSync12(dir)) {
29169
+ if (!existsSync13(dir)) {
29055
29170
  mkdirSync(dir, { recursive: true });
29056
29171
  }
29057
29172
  writeFileSync(configPath, `${JSON.stringify(existingConfig, null, 2)}
@@ -29070,7 +29185,7 @@ var init_vscode_mcp = __esm(() => {
29070
29185
  // src/core/native/types.ts
29071
29186
  import { spawn as spawn2 } from "node:child_process";
29072
29187
  function executeCommand(binary2, args, options2 = {}) {
29073
- return new Promise((resolve9) => {
29188
+ return new Promise((resolve10) => {
29074
29189
  const proc = spawn2(binary2, args, {
29075
29190
  cwd: options2.cwd,
29076
29191
  stdio: ["ignore", "pipe", "pipe"],
@@ -29091,7 +29206,7 @@ function executeCommand(binary2, args, options2 = {}) {
29091
29206
  return;
29092
29207
  resolved = true;
29093
29208
  const trimmedStderr = stderr.trim();
29094
- resolve9({
29209
+ resolve10({
29095
29210
  success: code === 0,
29096
29211
  output: stdout.trim(),
29097
29212
  ...trimmedStderr && { error: trimmedStderr }
@@ -29101,7 +29216,7 @@ function executeCommand(binary2, args, options2 = {}) {
29101
29216
  if (resolved)
29102
29217
  return;
29103
29218
  resolved = true;
29104
- resolve9({
29219
+ resolve10({
29105
29220
  success: false,
29106
29221
  output: "",
29107
29222
  error: `Failed to execute ${binary2} CLI: ${err.message}`
@@ -29120,7 +29235,7 @@ function mergeNativeSyncResults(results) {
29120
29235
  var init_types2 = () => {};
29121
29236
 
29122
29237
  // src/core/codex-mcp.ts
29123
- import { existsSync as existsSync13, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
29238
+ import { existsSync as existsSync14, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
29124
29239
  import { dirname as dirname8 } from "node:path";
29125
29240
  function buildCodexMcpAddArgs(name, config) {
29126
29241
  if (typeof config.url === "string") {
@@ -29331,7 +29446,7 @@ function syncCodexProjectMcpConfig(validatedPlugins, options2) {
29331
29446
  trackedServers: []
29332
29447
  };
29333
29448
  let existingContent = "";
29334
- if (existsSync13(configPath)) {
29449
+ if (existsSync14(configPath)) {
29335
29450
  try {
29336
29451
  existingContent = readFileSync2(configPath, "utf-8");
29337
29452
  } catch {
@@ -29387,7 +29502,7 @@ function syncCodexProjectMcpConfig(validatedPlugins, options2) {
29387
29502
  `)}
29388
29503
  `;
29389
29504
  const dir = dirname8(configPath);
29390
- if (!existsSync13(dir)) {
29505
+ if (!existsSync14(dir)) {
29391
29506
  mkdirSync2(dir, { recursive: true });
29392
29507
  }
29393
29508
  writeFileSync2(configPath, output, "utf-8");
@@ -29401,7 +29516,7 @@ var init_codex_mcp = __esm(() => {
29401
29516
  });
29402
29517
 
29403
29518
  // src/core/claude-mcp.ts
29404
- import { existsSync as existsSync14, readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "node:fs";
29519
+ import { existsSync as existsSync15, readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "node:fs";
29405
29520
  import { dirname as dirname9 } from "node:path";
29406
29521
  function deepEqual2(a, b) {
29407
29522
  if (a === b)
@@ -29469,7 +29584,7 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
29469
29584
  trackedServers: []
29470
29585
  };
29471
29586
  let existingConfig = {};
29472
- if (existsSync14(configPath)) {
29587
+ if (existsSync15(configPath)) {
29473
29588
  try {
29474
29589
  const content = readFileSync3(configPath, "utf-8");
29475
29590
  existingConfig = import_json52.default.parse(content);
@@ -29520,7 +29635,7 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
29520
29635
  if (hasChanges && !dryRun) {
29521
29636
  existingConfig.mcpServers = existingServers;
29522
29637
  const dir = dirname9(configPath);
29523
- if (!existsSync14(dir)) {
29638
+ if (!existsSync15(dir)) {
29524
29639
  mkdirSync3(dir, { recursive: true });
29525
29640
  }
29526
29641
  writeFileSync3(configPath, `${JSON.stringify(existingConfig, null, 2)}
@@ -29538,7 +29653,7 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
29538
29653
  if (result.removed > 0 && !dryRun) {
29539
29654
  existingConfig.mcpServers = existingServers;
29540
29655
  const dir = dirname9(configPath);
29541
- if (!existsSync14(dir)) {
29656
+ if (!existsSync15(dir)) {
29542
29657
  mkdirSync3(dir, { recursive: true });
29543
29658
  }
29544
29659
  writeFileSync3(configPath, `${JSON.stringify(existingConfig, null, 2)}
@@ -29637,9 +29752,9 @@ var init_claude_mcp = __esm(() => {
29637
29752
  });
29638
29753
 
29639
29754
  // src/core/copilot-mcp.ts
29640
- import { join as join16 } from "node:path";
29755
+ import { join as join17 } from "node:path";
29641
29756
  function getCopilotMcpConfigPath() {
29642
- return join16(getHomeDir(), ".copilot", "mcp-config.json");
29757
+ return join17(getHomeDir(), ".copilot", "mcp-config.json");
29643
29758
  }
29644
29759
  var init_copilot_mcp = __esm(() => {
29645
29760
  init_constants();
@@ -29937,9 +30052,9 @@ function padStart2(str3, len) {
29937
30052
  }
29938
30053
 
29939
30054
  // src/core/sync.ts
29940
- import { existsSync as existsSync15, readFileSync as readFileSync4, writeFileSync as writeFileSync4, lstatSync } from "node:fs";
30055
+ import { existsSync as existsSync16, readFileSync as readFileSync4, writeFileSync as writeFileSync4, lstatSync as lstatSync2 } from "node:fs";
29941
30056
  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";
30057
+ import { join as join18, resolve as resolve10, dirname as dirname10, relative as relative5 } from "node:path";
29943
30058
  function deduplicateClientsByPath(clients, clientMappings = CLIENT_MAPPINGS) {
29944
30059
  const pathToClients = new Map;
29945
30060
  for (const client of clients) {
@@ -30053,11 +30168,11 @@ async function selectivePurgeWorkspace(workspacePath, state, clients) {
30053
30168
  const previousFiles = getPreviouslySyncedFiles(state, client);
30054
30169
  const purgedPaths = [];
30055
30170
  for (const filePath of previousFiles) {
30056
- const fullPath = join17(workspacePath, filePath);
30171
+ const fullPath = join18(workspacePath, filePath);
30057
30172
  const cleanPath = fullPath.replace(/\/$/, "");
30058
30173
  let stats;
30059
30174
  try {
30060
- stats = lstatSync(cleanPath);
30175
+ stats = lstatSync2(cleanPath);
30061
30176
  } catch {
30062
30177
  continue;
30063
30178
  }
@@ -30082,8 +30197,8 @@ async function selectivePurgeWorkspace(workspacePath, state, clients) {
30082
30197
  async function cleanupEmptyParents(workspacePath, filePath) {
30083
30198
  let parentPath = dirname10(filePath);
30084
30199
  while (parentPath && parentPath !== "." && parentPath !== "/") {
30085
- const fullParentPath = join17(workspacePath, parentPath);
30086
- if (!existsSync15(fullParentPath)) {
30200
+ const fullParentPath = join18(workspacePath, parentPath);
30201
+ if (!existsSync16(fullParentPath)) {
30087
30202
  parentPath = dirname10(parentPath);
30088
30203
  continue;
30089
30204
  }
@@ -30168,8 +30283,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
30168
30283
  errors2.push(`Cannot resolve file '${file}' - no workspace.source configured`);
30169
30284
  continue;
30170
30285
  }
30171
- const fullPath = join17(defaultSourcePath, file);
30172
- if (!existsSync15(fullPath)) {
30286
+ const fullPath = join18(defaultSourcePath, file);
30287
+ if (!existsSync16(fullPath)) {
30173
30288
  errors2.push(`File source not found: ${fullPath}`);
30174
30289
  }
30175
30290
  continue;
@@ -30187,8 +30302,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
30187
30302
  errors2.push(`GitHub cache not found for ${cacheKey}`);
30188
30303
  continue;
30189
30304
  }
30190
- const fullPath = join17(cachePath, parsed.filePath);
30191
- if (!existsSync15(fullPath)) {
30305
+ const fullPath = join18(cachePath, parsed.filePath);
30306
+ if (!existsSync16(fullPath)) {
30192
30307
  errors2.push(`Path not found in repository: ${cacheKey}/${parsed.filePath}`);
30193
30308
  }
30194
30309
  } else {
@@ -30196,13 +30311,13 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
30196
30311
  if (file.source.startsWith("/")) {
30197
30312
  fullPath = file.source;
30198
30313
  } else if (file.source.startsWith("../")) {
30199
- fullPath = resolve9(file.source);
30314
+ fullPath = resolve10(file.source);
30200
30315
  } else if (defaultSourcePath) {
30201
- fullPath = join17(defaultSourcePath, file.source);
30316
+ fullPath = join18(defaultSourcePath, file.source);
30202
30317
  } else {
30203
- fullPath = resolve9(file.source);
30318
+ fullPath = resolve10(file.source);
30204
30319
  }
30205
- if (!existsSync15(fullPath)) {
30320
+ if (!existsSync16(fullPath)) {
30206
30321
  errors2.push(`File source not found: ${fullPath}`);
30207
30322
  }
30208
30323
  }
@@ -30211,8 +30326,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
30211
30326
  errors2.push(`Cannot resolve file '${file.dest}' - no workspace.source configured and no explicit source provided`);
30212
30327
  continue;
30213
30328
  }
30214
- const fullPath = join17(defaultSourcePath, file.dest ?? "");
30215
- if (!existsSync15(fullPath)) {
30329
+ const fullPath = join18(defaultSourcePath, file.dest ?? "");
30330
+ if (!existsSync16(fullPath)) {
30216
30331
  errors2.push(`File source not found: ${fullPath}`);
30217
30332
  }
30218
30333
  }
@@ -30229,7 +30344,7 @@ function collectSyncedPaths(copyResults, workspacePath, clients, clientMappings)
30229
30344
  if (copyResult.action !== "copied" && copyResult.action !== "generated") {
30230
30345
  continue;
30231
30346
  }
30232
- const relativePath = relative4(workspacePath, copyResult.destination).replace(/\\/g, "/");
30347
+ const relativePath = relative5(workspacePath, copyResult.destination).replace(/\\/g, "/");
30233
30348
  for (const client of clients) {
30234
30349
  const mapping = mappings[client];
30235
30350
  if (mapping.skillsPath && relativePath.startsWith(mapping.skillsPath)) {
@@ -30358,7 +30473,7 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
30358
30473
  ...fetchResult.error && { error: fetchResult.error }
30359
30474
  };
30360
30475
  }
30361
- const resolvedPath2 = parsed?.subpath ? join17(fetchResult.cachePath, parsed.subpath) : fetchResult.cachePath;
30476
+ const resolvedPath2 = parsed?.subpath ? join18(fetchResult.cachePath, parsed.subpath) : fetchResult.cachePath;
30362
30477
  return {
30363
30478
  plugin: pluginSource,
30364
30479
  resolved: resolvedPath2,
@@ -30367,8 +30482,8 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
30367
30482
  nativeClients: []
30368
30483
  };
30369
30484
  }
30370
- const resolvedPath = resolve9(workspacePath, pluginSource);
30371
- if (!existsSync15(resolvedPath)) {
30485
+ const resolvedPath = resolve10(workspacePath, pluginSource);
30486
+ if (!existsSync16(resolvedPath)) {
30372
30487
  return {
30373
30488
  plugin: pluginSource,
30374
30489
  resolved: resolvedPath,
@@ -30529,10 +30644,10 @@ function buildPluginSkillNameMaps(allSkills) {
30529
30644
  return pluginMaps;
30530
30645
  }
30531
30646
  function generateVscodeWorkspaceFile(workspacePath, config) {
30532
- const configDir = join17(workspacePath, CONFIG_DIR);
30533
- const templatePath = join17(configDir, VSCODE_TEMPLATE_FILE);
30647
+ const configDir = join18(workspacePath, CONFIG_DIR);
30648
+ const templatePath = join18(configDir, VSCODE_TEMPLATE_FILE);
30534
30649
  let template;
30535
- if (existsSync15(templatePath)) {
30650
+ if (existsSync16(templatePath)) {
30536
30651
  try {
30537
30652
  template = import_json53.default.parse(readFileSync4(templatePath, "utf-8"));
30538
30653
  } catch (error) {
@@ -30679,7 +30794,7 @@ async function syncVscodeWorkspaceFile(workspacePath, config, configPath, previo
30679
30794
  let updatedConfig = config;
30680
30795
  if (previousState?.vscodeWorkspaceHash && previousState?.vscodeWorkspaceRepos) {
30681
30796
  const outputPath = getWorkspaceOutputPath(workspacePath, config.vscode);
30682
- if (existsSync15(outputPath)) {
30797
+ if (existsSync16(outputPath)) {
30683
30798
  const existingContent = readFileSync4(outputPath, "utf-8");
30684
30799
  const currentHash = computeWorkspaceHash(existingContent);
30685
30800
  if (currentHash !== previousState.vscodeWorkspaceHash) {
@@ -30709,7 +30824,7 @@ async function syncVscodeWorkspaceFile(workspacePath, config, configPath, previo
30709
30824
  }
30710
30825
  const writtenContent = generateVscodeWorkspaceFile(workspacePath, updatedConfig);
30711
30826
  const hash = computeWorkspaceHash(writtenContent);
30712
- const repos = updatedConfig.repositories.map((r) => resolve9(workspacePath, r.path).replace(/\\/g, "/"));
30827
+ const repos = updatedConfig.repositories.map((r) => resolve10(workspacePath, r.path).replace(/\\/g, "/"));
30713
30828
  return { config: updatedConfig, hash, repos };
30714
30829
  }
30715
30830
  async function persistSyncState(workspacePath, pluginResults, workspaceFileResults, syncClients, nativePluginsByClient, nativeResult, extra) {
@@ -30743,9 +30858,9 @@ async function syncWorkspace(workspacePath = process.cwd(), options2 = {}) {
30743
30858
  await migrateWorkspaceSkillsV1toV2(workspacePath);
30744
30859
  const { offline = false, dryRun = false, workspaceSourceBase, skipAgentFiles = false } = options2;
30745
30860
  const sw = new Stopwatch;
30746
- const configDir = join17(workspacePath, CONFIG_DIR);
30747
- const configPath = join17(configDir, WORKSPACE_CONFIG_FILE);
30748
- if (!existsSync15(configPath)) {
30861
+ const configDir = join18(workspacePath, CONFIG_DIR);
30862
+ const configPath = join18(configDir, WORKSPACE_CONFIG_FILE);
30863
+ if (!existsSync16(configPath)) {
30749
30864
  return failedSyncResult(`${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
30750
30865
  Run 'allagents workspace init <path>' to create a new workspace`);
30751
30866
  }
@@ -30834,8 +30949,8 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
30834
30949
  const filesToCopy = [...config.workspace.files];
30835
30950
  if (hasRepositories && sourcePath) {
30836
30951
  for (const agentFile of AGENT_FILES) {
30837
- const agentPath = join17(sourcePath, agentFile);
30838
- if (existsSync15(agentPath) && !filesToCopy.includes(agentFile)) {
30952
+ const agentPath = join18(sourcePath, agentFile);
30953
+ if (existsSync16(agentPath) && !filesToCopy.includes(agentFile)) {
30839
30954
  filesToCopy.push(agentFile);
30840
30955
  }
30841
30956
  }
@@ -30857,12 +30972,13 @@ ${errors2.map((e) => ` - ${e}`).join(`
30857
30972
  ${fileValidationErrors.map((e) => ` - ${e}`).join(`
30858
30973
  `)}`, { pluginResults, totalFailed: fileValidationErrors.length });
30859
30974
  }
30860
- workspaceFileResults = await copyWorkspaceFiles(sourcePath, workspacePath, filesToCopy, { dryRun, githubCache, repositories: config.repositories });
30975
+ const repoSkills = hasRepositories && !dryRun ? await discoverWorkspaceSkills(workspacePath, config.repositories, syncClients) : [];
30976
+ workspaceFileResults = await copyWorkspaceFiles(sourcePath, workspacePath, filesToCopy, { dryRun, githubCache, repositories: config.repositories, skills: repoSkills });
30861
30977
  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)) {
30978
+ const claudePath = join18(workspacePath, "CLAUDE.md");
30979
+ const agentsPath = join18(workspacePath, "AGENTS.md");
30980
+ const claudeExistsInSource = existsSync16(join18(sourcePath, "CLAUDE.md"));
30981
+ if (!claudeExistsInSource && existsSync16(agentsPath) && !existsSync16(claudePath)) {
30866
30982
  await copyFile(agentsPath, claudePath);
30867
30983
  }
30868
30984
  }
@@ -30883,7 +30999,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
30883
30999
  const mcpResults = {};
30884
31000
  if (syncClients.includes("vscode")) {
30885
31001
  const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "vscode");
30886
- const projectMcpPath = join17(workspacePath, ".vscode", "mcp.json");
31002
+ const projectMcpPath = join18(workspacePath, ".vscode", "mcp.json");
30887
31003
  const vscodeMcp = syncVscodeMcpConfig(validPlugins, {
30888
31004
  dryRun,
30889
31005
  force: false,
@@ -30897,7 +31013,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
30897
31013
  }
30898
31014
  if (syncClients.includes("claude")) {
30899
31015
  const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "claude");
30900
- const projectMcpJsonPath = join17(workspacePath, ".mcp.json");
31016
+ const projectMcpJsonPath = join18(workspacePath, ".mcp.json");
30901
31017
  const claudeMcp = syncClaudeMcpConfig(validPlugins, {
30902
31018
  dryRun,
30903
31019
  force: false,
@@ -30911,7 +31027,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
30911
31027
  }
30912
31028
  if (syncClients.includes("codex")) {
30913
31029
  const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "codex");
30914
- const projectCodexConfigPath = join17(workspacePath, ".codex", "config.toml");
31030
+ const projectCodexConfigPath = join18(workspacePath, ".codex", "config.toml");
30915
31031
  const codexMcp = syncCodexProjectMcpConfig(validPlugins, {
30916
31032
  dryRun,
30917
31033
  force: false,
@@ -30925,7 +31041,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
30925
31041
  }
30926
31042
  if (syncClients.includes("copilot")) {
30927
31043
  const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "copilot");
30928
- const projectCopilotMcpPath = join17(workspacePath, ".copilot", "mcp-config.json");
31044
+ const projectCopilotMcpPath = join18(workspacePath, ".copilot", "mcp-config.json");
30929
31045
  const copilotMcp = syncClaudeMcpConfig(validPlugins, {
30930
31046
  dryRun,
30931
31047
  force: false,
@@ -30995,7 +31111,7 @@ async function seedFetchCacheFromMarketplaces(results) {
30995
31111
  }
30996
31112
  function readGitBranch(repoPath) {
30997
31113
  try {
30998
- const head = readFileSync4(join17(repoPath, ".git", "HEAD"), "utf-8").trim();
31114
+ const head = readFileSync4(join18(repoPath, ".git", "HEAD"), "utf-8").trim();
30999
31115
  const prefix = "ref: refs/heads/";
31000
31116
  return head.startsWith(prefix) ? head.slice(prefix.length) : null;
31001
31117
  } catch {
@@ -31005,7 +31121,7 @@ function readGitBranch(repoPath) {
31005
31121
  async function syncUserWorkspace(options2 = {}) {
31006
31122
  await migrateUserWorkspaceSkillsV1toV2();
31007
31123
  const sw = new Stopwatch;
31008
- const homeDir = resolve9(getHomeDir());
31124
+ const homeDir = resolve10(getHomeDir());
31009
31125
  const config = await getUserWorkspaceConfig();
31010
31126
  if (!config) {
31011
31127
  return {
@@ -31143,6 +31259,7 @@ var init_sync = __esm(() => {
31143
31259
  init_plugin();
31144
31260
  init_transform();
31145
31261
  init_workspace_repo();
31262
+ init_repo_skills();
31146
31263
  init_client_mapping();
31147
31264
  init_skill_name_resolver();
31148
31265
  init_marketplace();
@@ -31159,11 +31276,11 @@ var init_sync = __esm(() => {
31159
31276
  });
31160
31277
 
31161
31278
  // src/core/github-fetch.ts
31162
- import { existsSync as existsSync16, readFileSync as readFileSync5 } from "node:fs";
31163
- import { join as join18 } from "node:path";
31279
+ import { existsSync as existsSync17, readFileSync as readFileSync5 } from "node:fs";
31280
+ import { join as join19 } from "node:path";
31164
31281
  function readFileFromClone(tempDir, filePath) {
31165
- const fullPath = join18(tempDir, filePath);
31166
- if (existsSync16(fullPath)) {
31282
+ const fullPath = join19(tempDir, filePath);
31283
+ if (existsSync17(fullPath)) {
31167
31284
  return readFileSync5(fullPath, "utf-8");
31168
31285
  }
31169
31286
  return null;
@@ -31262,15 +31379,15 @@ var init_github_fetch = __esm(() => {
31262
31379
  });
31263
31380
 
31264
31381
  // 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";
31382
+ import { cp as cp2, mkdir as mkdir8, readFile as readFile12, writeFile as writeFile8, copyFile as copyFile2, unlink as unlink3 } from "node:fs/promises";
31383
+ import { existsSync as existsSync18 } from "node:fs";
31384
+ import { join as join20, resolve as resolve11, dirname as dirname11, relative as relative6, sep as sep2, isAbsolute as isAbsolute4 } from "node:path";
31268
31385
  import { fileURLToPath } from "node:url";
31269
31386
  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)) {
31387
+ const absoluteTarget = resolve11(targetPath);
31388
+ const configDir = join20(absoluteTarget, CONFIG_DIR);
31389
+ const configPath = join20(configDir, WORKSPACE_CONFIG_FILE);
31390
+ if (existsSync18(configPath)) {
31274
31391
  if (options2.force) {
31275
31392
  await unlink3(configPath);
31276
31393
  } else {
@@ -31281,7 +31398,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31281
31398
  const currentFilePath = fileURLToPath(import.meta.url);
31282
31399
  const currentFileDir = dirname11(currentFilePath);
31283
31400
  const isProduction = currentFilePath.includes(`${sep2}dist${sep2}`);
31284
- const defaultTemplatePath = isProduction ? join19(currentFileDir, "templates", "default") : join19(currentFileDir, "..", "templates", "default");
31401
+ const defaultTemplatePath = isProduction ? join20(currentFileDir, "templates", "default") : join20(currentFileDir, "..", "templates", "default");
31285
31402
  let githubTempDir;
31286
31403
  let parsedFromUrl;
31287
31404
  let githubBasePath = "";
@@ -31320,20 +31437,20 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31320
31437
  }
31321
31438
  console.log(`✓ Using workspace.yaml from: ${options2.from}`);
31322
31439
  } else {
31323
- const fromPath = resolve10(options2.from);
31324
- if (!existsSync17(fromPath)) {
31440
+ const fromPath = resolve11(options2.from);
31441
+ if (!existsSync18(fromPath)) {
31325
31442
  throw new Error(`Template not found: ${fromPath}`);
31326
31443
  }
31327
31444
  const { stat: stat2 } = await import("node:fs/promises");
31328
31445
  const fromStat = await stat2(fromPath);
31329
31446
  let sourceYamlPath;
31330
31447
  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)) {
31448
+ const nestedPath = join20(fromPath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
31449
+ const rootPath = join20(fromPath, WORKSPACE_CONFIG_FILE);
31450
+ if (existsSync18(nestedPath)) {
31334
31451
  sourceYamlPath = nestedPath;
31335
31452
  sourceDir = fromPath;
31336
- } else if (existsSync17(rootPath)) {
31453
+ } else if (existsSync18(rootPath)) {
31337
31454
  sourceYamlPath = rootPath;
31338
31455
  sourceDir = fromPath;
31339
31456
  } else {
@@ -31349,14 +31466,14 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31349
31466
  sourceDir = parentDir;
31350
31467
  }
31351
31468
  }
31352
- workspaceYamlContent = await readFile11(sourceYamlPath, "utf-8");
31469
+ workspaceYamlContent = await readFile12(sourceYamlPath, "utf-8");
31353
31470
  if (sourceDir) {
31354
31471
  const parsed2 = load(workspaceYamlContent);
31355
31472
  const workspace = parsed2?.workspace;
31356
31473
  if (workspace?.source) {
31357
31474
  const source = workspace.source;
31358
31475
  if (!isGitHubUrl(source) && !isAbsolute4(source)) {
31359
- workspace.source = resolve10(sourceDir, source);
31476
+ workspace.source = resolve11(sourceDir, source);
31360
31477
  workspaceYamlContent = dump(parsed2, { lineWidth: -1 });
31361
31478
  }
31362
31479
  }
@@ -31364,11 +31481,11 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31364
31481
  console.log(`✓ Using workspace.yaml from: ${sourceYamlPath}`);
31365
31482
  }
31366
31483
  } else {
31367
- const defaultYamlPath = join19(defaultTemplatePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
31368
- if (!existsSync17(defaultYamlPath)) {
31484
+ const defaultYamlPath = join20(defaultTemplatePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
31485
+ if (!existsSync18(defaultYamlPath)) {
31369
31486
  throw new Error(`Default template not found at: ${defaultTemplatePath}`);
31370
31487
  }
31371
- workspaceYamlContent = await readFile11(defaultYamlPath, "utf-8");
31488
+ workspaceYamlContent = await readFile12(defaultYamlPath, "utf-8");
31372
31489
  }
31373
31490
  if (options2.clients && options2.clients.length > 0) {
31374
31491
  const configParsed = load(workspaceYamlContent);
@@ -31381,8 +31498,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31381
31498
  const clientNames = getClientTypes(clients);
31382
31499
  const VSCODE_TEMPLATE_FILE2 = "template.code-workspace";
31383
31500
  if (clientNames.includes("vscode") && options2.from) {
31384
- const targetTemplatePath = join19(configDir, VSCODE_TEMPLATE_FILE2);
31385
- if (!existsSync17(targetTemplatePath)) {
31501
+ const targetTemplatePath = join20(configDir, VSCODE_TEMPLATE_FILE2);
31502
+ if (!existsSync18(targetTemplatePath)) {
31386
31503
  if (isGitHubUrl(options2.from) && githubTempDir) {
31387
31504
  if (parsedFromUrl) {
31388
31505
  const templatePath = githubBasePath ? `${githubBasePath}/${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}` : `${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}`;
@@ -31392,8 +31509,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31392
31509
  }
31393
31510
  }
31394
31511
  } else if (sourceDir) {
31395
- const sourceTemplatePath = join19(sourceDir, CONFIG_DIR, VSCODE_TEMPLATE_FILE2);
31396
- if (existsSync17(sourceTemplatePath)) {
31512
+ const sourceTemplatePath = join20(sourceDir, CONFIG_DIR, VSCODE_TEMPLATE_FILE2);
31513
+ if (existsSync18(sourceTemplatePath)) {
31397
31514
  await copyFile2(sourceTemplatePath, targetTemplatePath);
31398
31515
  }
31399
31516
  }
@@ -31406,8 +31523,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31406
31523
  if (options2.from && isGitHubUrl(options2.from) && githubTempDir) {
31407
31524
  if (parsedFromUrl) {
31408
31525
  for (const agentFile of AGENT_FILES) {
31409
- const targetFilePath = join19(absoluteTarget, agentFile);
31410
- if (existsSync17(targetFilePath)) {
31526
+ const targetFilePath = join20(absoluteTarget, agentFile);
31527
+ if (existsSync18(targetFilePath)) {
31411
31528
  copiedAgentFiles.push(agentFile);
31412
31529
  continue;
31413
31530
  }
@@ -31422,30 +31539,30 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
31422
31539
  } else {
31423
31540
  const effectiveSourceDir = sourceDir ?? defaultTemplatePath;
31424
31541
  for (const agentFile of AGENT_FILES) {
31425
- const targetFilePath = join19(absoluteTarget, agentFile);
31426
- if (existsSync17(targetFilePath)) {
31542
+ const targetFilePath = join20(absoluteTarget, agentFile);
31543
+ if (existsSync18(targetFilePath)) {
31427
31544
  copiedAgentFiles.push(agentFile);
31428
31545
  continue;
31429
31546
  }
31430
- const sourcePath = join19(effectiveSourceDir, agentFile);
31431
- if (existsSync17(sourcePath)) {
31432
- const content = await readFile11(sourcePath, "utf-8");
31547
+ const sourcePath = join20(effectiveSourceDir, agentFile);
31548
+ if (existsSync18(sourcePath)) {
31549
+ const content = await readFile12(sourcePath, "utf-8");
31433
31550
  await writeFile8(targetFilePath, content, "utf-8");
31434
31551
  copiedAgentFiles.push(agentFile);
31435
31552
  }
31436
31553
  }
31437
31554
  }
31438
31555
  if (copiedAgentFiles.length === 0) {
31439
- await ensureWorkspaceRules(join19(absoluteTarget, "AGENTS.md"), repositories);
31556
+ await ensureWorkspaceRules(join20(absoluteTarget, "AGENTS.md"), repositories);
31440
31557
  copiedAgentFiles.push("AGENTS.md");
31441
31558
  } else {
31442
31559
  for (const agentFile of copiedAgentFiles) {
31443
- await ensureWorkspaceRules(join19(absoluteTarget, agentFile), repositories);
31560
+ await ensureWorkspaceRules(join20(absoluteTarget, agentFile), repositories);
31444
31561
  }
31445
31562
  }
31446
31563
  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");
31564
+ const agentsPath = join20(absoluteTarget, "AGENTS.md");
31565
+ const claudePath = join20(absoluteTarget, "CLAUDE.md");
31449
31566
  await copyFile2(agentsPath, claudePath);
31450
31567
  }
31451
31568
  }
@@ -31471,7 +31588,7 @@ Syncing plugins...`);
31471
31588
  if (targetPath !== ".") {
31472
31589
  console.log(`
31473
31590
  Next steps:`);
31474
- console.log(` cd ${relative5(process.cwd(), absoluteTarget)}`);
31591
+ console.log(` cd ${relative6(process.cwd(), absoluteTarget)}`);
31475
31592
  }
31476
31593
  return {
31477
31594
  path: absoluteTarget,
@@ -31490,14 +31607,14 @@ Next steps:`);
31490
31607
  async function seedCacheFromClone(tempDir, owner, repo, branch) {
31491
31608
  const cachePaths = [
31492
31609
  getPluginCachePath(owner, repo, branch),
31493
- join19(getMarketplacesDir(), repo)
31610
+ join20(getMarketplacesDir(), repo)
31494
31611
  ];
31495
31612
  for (const cachePath of cachePaths) {
31496
- if (existsSync17(cachePath))
31613
+ if (existsSync18(cachePath))
31497
31614
  continue;
31498
31615
  try {
31499
31616
  const parentDir = dirname11(cachePath);
31500
- if (!existsSync17(parentDir)) {
31617
+ if (!existsSync18(parentDir)) {
31501
31618
  await mkdir8(parentDir, { recursive: true });
31502
31619
  }
31503
31620
  await cp2(tempDir, cachePath, { recursive: true });
@@ -31518,11 +31635,11 @@ var init_workspace = __esm(() => {
31518
31635
  });
31519
31636
 
31520
31637
  // src/core/status.ts
31521
- import { existsSync as existsSync18 } from "node:fs";
31522
- import { join as join20 } from "node:path";
31638
+ import { existsSync as existsSync19 } from "node:fs";
31639
+ import { join as join21 } from "node:path";
31523
31640
  async function getWorkspaceStatus(workspacePath = process.cwd()) {
31524
- const configPath = join20(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
31525
- if (!existsSync18(configPath) || isUserConfigPath(workspacePath)) {
31641
+ const configPath = join21(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
31642
+ if (!existsSync19(configPath) || isUserConfigPath(workspacePath)) {
31526
31643
  const userPlugins = await getUserPluginStatuses();
31527
31644
  return {
31528
31645
  success: true,
@@ -31564,7 +31681,7 @@ async function getWorkspaceStatus(workspacePath = process.cwd()) {
31564
31681
  function getPluginStatus(parsed) {
31565
31682
  if (parsed.type === "github") {
31566
31683
  const cachePath = parsed.owner && parsed.repo ? getPluginCachePath(parsed.owner, parsed.repo) : "";
31567
- const available2 = cachePath ? existsSync18(cachePath) : false;
31684
+ const available2 = cachePath ? existsSync19(cachePath) : false;
31568
31685
  return {
31569
31686
  source: parsed.original,
31570
31687
  type: "github",
@@ -31574,7 +31691,7 @@ function getPluginStatus(parsed) {
31574
31691
  ...parsed.repo && { repo: parsed.repo }
31575
31692
  };
31576
31693
  }
31577
- const available = existsSync18(parsed.normalized);
31694
+ const available = existsSync19(parsed.normalized);
31578
31695
  return {
31579
31696
  source: parsed.original,
31580
31697
  type: "local",
@@ -33711,9 +33828,9 @@ var init_prompt_clients = __esm(() => {
33711
33828
  });
33712
33829
 
33713
33830
  // 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";
33831
+ import { existsSync as existsSync22 } from "node:fs";
33832
+ import { readFile as readFile14, readdir as readdir5 } from "node:fs/promises";
33833
+ import { join as join24, basename as basename6, resolve as resolve13 } from "node:path";
33717
33834
  async function resolvePluginPath(pluginSource, workspacePath) {
33718
33835
  if (isPluginSpec(pluginSource)) {
33719
33836
  const resolved2 = await resolvePluginSpecWithAutoRegister(pluginSource, {
@@ -33734,18 +33851,18 @@ async function resolvePluginPath(pluginSource, workspacePath) {
33734
33851
  });
33735
33852
  if (!result.success)
33736
33853
  return null;
33737
- const path = parsed?.subpath ? join23(result.cachePath, parsed.subpath) : result.cachePath;
33854
+ const path = parsed?.subpath ? join24(result.cachePath, parsed.subpath) : result.cachePath;
33738
33855
  return { path };
33739
33856
  }
33740
- const resolved = resolve12(workspacePath, pluginSource);
33741
- return existsSync21(resolved) ? { path: resolved } : null;
33857
+ const resolved = resolve13(workspacePath, pluginSource);
33858
+ return existsSync22(resolved) ? { path: resolved } : null;
33742
33859
  }
33743
33860
  async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
33744
- const configPath = join23(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
33745
- if (!existsSync21(configPath)) {
33861
+ const configPath = join24(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
33862
+ if (!existsSync22(configPath)) {
33746
33863
  return [];
33747
33864
  }
33748
- const content = await readFile13(configPath, "utf-8");
33865
+ const content = await readFile14(configPath, "utf-8");
33749
33866
  const config = load(content);
33750
33867
  const isV1Fallback = config.version === undefined || config.version < 2;
33751
33868
  const disabledSkills = isV1Fallback ? new Set(config.disabledSkills ?? []) : new Set;
@@ -33758,30 +33875,30 @@ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
33758
33875
  continue;
33759
33876
  const pluginPath = resolved.path;
33760
33877
  const pluginName = resolved.pluginName ?? getPluginName(pluginPath);
33761
- const skillsDir = join23(pluginPath, "skills");
33878
+ const skillsDir = join24(pluginPath, "skills");
33762
33879
  const pluginSkillsConfig = typeof pluginEntry === "string" ? undefined : pluginEntry.skills;
33763
33880
  const hasEnabledEntries = !pluginSkillsConfig && enabledSkills && [...enabledSkills].some((s) => s.startsWith(`${pluginName}`));
33764
33881
  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) }));
33882
+ if (existsSync22(skillsDir)) {
33883
+ const entries = await readdir5(skillsDir, { withFileTypes: true });
33884
+ skillEntries = entries.filter((e) => e.isDirectory()).map((e) => ({ name: e.name, skillPath: join24(skillsDir, e.name) }));
33768
33885
  } else {
33769
- const entries = await readdir4(pluginPath, { withFileTypes: true });
33886
+ const entries = await readdir5(pluginPath, { withFileTypes: true });
33770
33887
  const flatSkills = [];
33771
33888
  for (const entry of entries) {
33772
33889
  if (!entry.isDirectory())
33773
33890
  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) });
33891
+ const skillMdPath = join24(pluginPath, entry.name, "SKILL.md");
33892
+ if (existsSync22(skillMdPath)) {
33893
+ flatSkills.push({ name: entry.name, skillPath: join24(pluginPath, entry.name) });
33777
33894
  }
33778
33895
  }
33779
33896
  if (flatSkills.length > 0) {
33780
33897
  skillEntries = flatSkills;
33781
33898
  } else {
33782
- const rootSkillMd = join23(pluginPath, "SKILL.md");
33783
- if (existsSync21(rootSkillMd)) {
33784
- const skillContent = await readFile13(rootSkillMd, "utf-8");
33899
+ const rootSkillMd = join24(pluginPath, "SKILL.md");
33900
+ if (existsSync22(rootSkillMd)) {
33901
+ const skillContent = await readFile14(rootSkillMd, "utf-8");
33785
33902
  const metadata = parseSkillMetadata(skillContent);
33786
33903
  const skillName = metadata?.name ?? basename6(pluginPath);
33787
33904
  skillEntries = [{ name: skillName, skillPath: pluginPath }];
@@ -33822,28 +33939,28 @@ async function findSkillByName(skillName, workspacePath = process.cwd()) {
33822
33939
  return allSkills.filter((s) => s.name === skillName);
33823
33940
  }
33824
33941
  async function discoverSkillNames(pluginPath) {
33825
- if (!existsSync21(pluginPath))
33942
+ if (!existsSync22(pluginPath))
33826
33943
  return [];
33827
- const skillsDir = join23(pluginPath, "skills");
33828
- if (existsSync21(skillsDir)) {
33829
- const entries2 = await readdir4(skillsDir, { withFileTypes: true });
33944
+ const skillsDir = join24(pluginPath, "skills");
33945
+ if (existsSync22(skillsDir)) {
33946
+ const entries2 = await readdir5(skillsDir, { withFileTypes: true });
33830
33947
  return entries2.filter((e) => e.isDirectory()).map((e) => e.name);
33831
33948
  }
33832
- const entries = await readdir4(pluginPath, { withFileTypes: true });
33949
+ const entries = await readdir5(pluginPath, { withFileTypes: true });
33833
33950
  const flatSkills = [];
33834
33951
  for (const entry of entries) {
33835
33952
  if (!entry.isDirectory())
33836
33953
  continue;
33837
- if (existsSync21(join23(pluginPath, entry.name, "SKILL.md"))) {
33954
+ if (existsSync22(join24(pluginPath, entry.name, "SKILL.md"))) {
33838
33955
  flatSkills.push(entry.name);
33839
33956
  }
33840
33957
  }
33841
33958
  if (flatSkills.length > 0)
33842
33959
  return flatSkills;
33843
- const rootSkillMd = join23(pluginPath, "SKILL.md");
33844
- if (existsSync21(rootSkillMd)) {
33960
+ const rootSkillMd = join24(pluginPath, "SKILL.md");
33961
+ if (existsSync22(rootSkillMd)) {
33845
33962
  try {
33846
- const content = await readFile13(rootSkillMd, "utf-8");
33963
+ const content = await readFile14(rootSkillMd, "utf-8");
33847
33964
  const { parseSkillMetadata: parseSkillMetadata2 } = await Promise.resolve().then(() => (init_skill(), exports_skill));
33848
33965
  const metadata = parseSkillMetadata2(content);
33849
33966
  return [metadata?.name ?? basename6(pluginPath)];
@@ -33952,12 +34069,12 @@ var require_isexe = __commonJS((exports, module) => {
33952
34069
  if (typeof Promise !== "function") {
33953
34070
  throw new TypeError("callback not provided");
33954
34071
  }
33955
- return new Promise(function(resolve13, reject) {
34072
+ return new Promise(function(resolve14, reject) {
33956
34073
  isexe(path, options2 || {}, function(er, is) {
33957
34074
  if (er) {
33958
34075
  reject(er);
33959
34076
  } else {
33960
- resolve13(is);
34077
+ resolve14(is);
33961
34078
  }
33962
34079
  });
33963
34080
  });
@@ -34019,27 +34136,27 @@ var require_which = __commonJS((exports, module) => {
34019
34136
  opt = {};
34020
34137
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
34021
34138
  const found = [];
34022
- const step = (i2) => new Promise((resolve13, reject) => {
34139
+ const step = (i2) => new Promise((resolve14, reject) => {
34023
34140
  if (i2 === pathEnv.length)
34024
- return opt.all && found.length ? resolve13(found) : reject(getNotFoundError(cmd));
34141
+ return opt.all && found.length ? resolve14(found) : reject(getNotFoundError(cmd));
34025
34142
  const ppRaw = pathEnv[i2];
34026
34143
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
34027
34144
  const pCmd = path.join(pathPart, cmd);
34028
34145
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
34029
- resolve13(subStep(p, i2, 0));
34146
+ resolve14(subStep(p, i2, 0));
34030
34147
  });
34031
- const subStep = (p, i2, ii) => new Promise((resolve13, reject) => {
34148
+ const subStep = (p, i2, ii) => new Promise((resolve14, reject) => {
34032
34149
  if (ii === pathExt.length)
34033
- return resolve13(step(i2 + 1));
34150
+ return resolve14(step(i2 + 1));
34034
34151
  const ext = pathExt[ii];
34035
34152
  isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
34036
34153
  if (!er && is) {
34037
34154
  if (opt.all)
34038
34155
  found.push(p + ext);
34039
34156
  else
34040
- return resolve13(p + ext);
34157
+ return resolve14(p + ext);
34041
34158
  }
34042
- return resolve13(subStep(p, i2, ii + 1));
34159
+ return resolve14(subStep(p, i2, ii + 1));
34043
34160
  });
34044
34161
  });
34045
34162
  return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
@@ -34361,7 +34478,7 @@ var package_default;
34361
34478
  var init_package = __esm(() => {
34362
34479
  package_default = {
34363
34480
  name: "allagents",
34364
- version: "1.5.0",
34481
+ version: "1.6.0",
34365
34482
  description: "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
34366
34483
  type: "module",
34367
34484
  bin: {
@@ -34441,13 +34558,13 @@ var init_package = __esm(() => {
34441
34558
  });
34442
34559
 
34443
34560
  // src/cli/update-check.ts
34444
- import { readFile as readFile16 } from "node:fs/promises";
34445
- import { join as join26 } from "node:path";
34561
+ import { readFile as readFile17 } from "node:fs/promises";
34562
+ import { join as join27 } from "node:path";
34446
34563
  import { spawn as spawn3 } from "node:child_process";
34447
34564
  async function getCachedUpdateInfo(path3) {
34448
- const filePath = path3 ?? join26(getHomeDir(), CONFIG_DIR, CACHE_FILE);
34565
+ const filePath = path3 ?? join27(getHomeDir(), CONFIG_DIR, CACHE_FILE);
34449
34566
  try {
34450
- const raw = await readFile16(filePath, "utf-8");
34567
+ const raw = await readFile17(filePath, "utf-8");
34451
34568
  const data = JSON.parse(raw);
34452
34569
  if (typeof data.latestVersion === "string" && typeof data.lastCheckedAt === "string") {
34453
34570
  return data;
@@ -34483,8 +34600,8 @@ function buildNotice(currentVersion, latestVersion) {
34483
34600
  Run \`allagents self update\` to upgrade.`);
34484
34601
  }
34485
34602
  function backgroundUpdateCheck() {
34486
- const dir = join26(getHomeDir(), CONFIG_DIR);
34487
- const filePath = join26(dir, CACHE_FILE);
34603
+ const dir = join27(getHomeDir(), CONFIG_DIR);
34604
+ const filePath = join27(dir, CACHE_FILE);
34488
34605
  const script = `
34489
34606
  const https = require('https');
34490
34607
  const fs = require('fs');
@@ -34571,15 +34688,15 @@ class TuiCache {
34571
34688
  }
34572
34689
 
34573
34690
  // src/cli/tui/context.ts
34574
- import { existsSync as existsSync24 } from "node:fs";
34575
- import { join as join27 } from "node:path";
34691
+ import { existsSync as existsSync25 } from "node:fs";
34692
+ import { join as join28 } from "node:path";
34576
34693
  async function getTuiContext(cwd = process.cwd(), cache2) {
34577
34694
  const cachedContext = cache2?.getContext();
34578
34695
  if (cachedContext) {
34579
34696
  return cachedContext;
34580
34697
  }
34581
- const configPath = join27(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
34582
- const hasWorkspace = existsSync24(configPath) && !isUserConfigPath(cwd);
34698
+ const configPath = join28(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
34699
+ const hasWorkspace = existsSync25(configPath) && !isUserConfigPath(cwd);
34583
34700
  let projectPluginCount = 0;
34584
34701
  if (hasWorkspace) {
34585
34702
  try {
@@ -35830,7 +35947,7 @@ __export(exports_wizard, {
35830
35947
  runWizard: () => runWizard,
35831
35948
  buildMenuOptions: () => buildMenuOptions
35832
35949
  });
35833
- import { relative as relative6 } from "node:path";
35950
+ import { relative as relative7 } from "node:path";
35834
35951
  function buildMenuOptions(context) {
35835
35952
  const options2 = [];
35836
35953
  if (context.needsSync) {
@@ -35859,7 +35976,7 @@ function buildCompactSummary(context) {
35859
35976
  function buildSummary(context) {
35860
35977
  const lines = [];
35861
35978
  if (context.hasWorkspace && context.workspacePath) {
35862
- const relPath = relative6(process.cwd(), context.workspacePath) || ".";
35979
+ const relPath = relative7(process.cwd(), context.workspacePath) || ".";
35863
35980
  lines.push(`Workspace: ${relPath}`);
35864
35981
  lines.push(`Project plugins: ${context.projectPluginCount}`);
35865
35982
  } else {
@@ -35995,8 +36112,8 @@ init_workspace();
35995
36112
  init_sync();
35996
36113
  init_status2();
35997
36114
  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";
36115
+ import { existsSync as existsSync21 } from "node:fs";
36116
+ import { join as join23, resolve as resolve12 } from "node:path";
36000
36117
 
36001
36118
  // src/core/prune.ts
36002
36119
  init_js_yaml();
@@ -36004,9 +36121,9 @@ init_constants();
36004
36121
  init_marketplace();
36005
36122
  init_user_workspace();
36006
36123
  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";
36124
+ import { readFile as readFile13, writeFile as writeFile9 } from "node:fs/promises";
36125
+ import { existsSync as existsSync20 } from "node:fs";
36126
+ import { join as join22 } from "node:path";
36010
36127
  async function isOrphanedPlugin(pluginSpec) {
36011
36128
  if (!isPluginSpec(pluginSpec))
36012
36129
  return false;
@@ -36033,9 +36150,9 @@ async function prunePlugins(plugins) {
36033
36150
  }
36034
36151
  async function pruneOrphanedPlugins(workspacePath) {
36035
36152
  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");
36153
+ const projectConfigPath = join22(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
36154
+ if (existsSync20(projectConfigPath) && !isUserConfigPath(workspacePath)) {
36155
+ const content = await readFile13(projectConfigPath, "utf-8");
36039
36156
  const config = load(content);
36040
36157
  projectResult = await prunePlugins(config.plugins);
36041
36158
  if (projectResult.removed.length > 0) {
@@ -36326,8 +36443,8 @@ var syncCmd = import_cmd_ts2.command({
36326
36443
  `);
36327
36444
  }
36328
36445
  const userConfigExists = !!await getUserWorkspaceConfig();
36329
- const projectConfigPath = join22(process.cwd(), ".allagents", "workspace.yaml");
36330
- const projectConfigExists = existsSync20(projectConfigPath);
36446
+ const projectConfigPath = join23(process.cwd(), ".allagents", "workspace.yaml");
36447
+ const projectConfigExists = existsSync21(projectConfigPath);
36331
36448
  if (!userConfigExists && !projectConfigExists) {
36332
36449
  await ensureUserWorkspace();
36333
36450
  if (isJsonMode()) {
@@ -36615,7 +36732,7 @@ var repoAddCmd = import_cmd_ts2.command({
36615
36732
  },
36616
36733
  handler: async ({ path: repoPath, description }) => {
36617
36734
  try {
36618
- const resolvedPath = resolve11(process.cwd(), repoPath);
36735
+ const resolvedPath = resolve12(process.cwd(), repoPath);
36619
36736
  const remote = await detectRemote(resolvedPath);
36620
36737
  const result = await addRepository(repoPath, {
36621
36738
  source: remote?.source,
@@ -36995,9 +37112,9 @@ init_workspace_modify();
36995
37112
  init_user_workspace();
36996
37113
  init_skills();
36997
37114
  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";
37115
+ import { existsSync as existsSync23 } from "node:fs";
37116
+ import { readFile as readFile15 } from "node:fs/promises";
37117
+ import { join as join25 } from "node:path";
37001
37118
 
37002
37119
  // src/cli/metadata/plugin-skills.ts
37003
37120
  var skillsListMeta = {
@@ -37088,7 +37205,7 @@ init_skill();
37088
37205
  init_marketplace();
37089
37206
  init_marketplace_manifest_parser();
37090
37207
  function hasProjectConfig(dir) {
37091
- return existsSync22(join24(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
37208
+ return existsSync23(join25(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
37092
37209
  }
37093
37210
  function resolveScope(cwd) {
37094
37211
  if (isUserConfigPath(cwd))
@@ -37119,7 +37236,7 @@ async function resolveSkillNameFromRepo(url, parsed, fallbackName, fetchFn = fet
37119
37236
  if (!fetchResult.success)
37120
37237
  return fallbackName;
37121
37238
  try {
37122
- const skillMd = await readFile14(join24(fetchResult.cachePath, "SKILL.md"), "utf-8");
37239
+ const skillMd = await readFile15(join25(fetchResult.cachePath, "SKILL.md"), "utf-8");
37123
37240
  const metadata = parseSkillMetadata(skillMd);
37124
37241
  return metadata?.name ?? fallbackName;
37125
37242
  } catch {
@@ -37676,9 +37793,9 @@ init_format_sync();
37676
37793
  init_workspace_config();
37677
37794
  init_constants();
37678
37795
  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";
37796
+ import { readFile as readFile16 } from "node:fs/promises";
37797
+ import { existsSync as existsSync24 } from "node:fs";
37798
+ import { join as join26 } from "node:path";
37682
37799
  async function runSyncAndPrint(options2) {
37683
37800
  if (!isJsonMode()) {
37684
37801
  console.log(`
@@ -37923,7 +38040,7 @@ var marketplaceAddCmd = import_cmd_ts4.command({
37923
38040
  process.exit(1);
37924
38041
  }
37925
38042
  if (effectiveScope === "project") {
37926
- if (!existsSync23(join25(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE))) {
38043
+ if (!existsSync24(join26(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE))) {
37927
38044
  const msg = 'No workspace found in current directory. Run "allagents workspace init" first.';
37928
38045
  if (isJsonMode()) {
37929
38046
  jsonOutput({ success: false, command: "plugin marketplace add", error: msg });
@@ -38230,10 +38347,10 @@ var pluginListCmd = import_cmd_ts4.command({
38230
38347
  };
38231
38348
  const pluginClients = new Map;
38232
38349
  async function loadConfigClients(configPath, scope) {
38233
- if (!existsSync23(configPath))
38350
+ if (!existsSync24(configPath))
38234
38351
  return;
38235
38352
  try {
38236
- const content = await readFile15(configPath, "utf-8");
38353
+ const content = await readFile16(configPath, "utf-8");
38237
38354
  const config = load(content);
38238
38355
  if (!config?.plugins || !config?.clients)
38239
38356
  return;
@@ -38245,8 +38362,8 @@ var pluginListCmd = import_cmd_ts4.command({
38245
38362
  }
38246
38363
  } catch {}
38247
38364
  }
38248
- const userConfigPath = join25(getAllagentsDir(), WORKSPACE_CONFIG_FILE);
38249
- const projectConfigPath = join25(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
38365
+ const userConfigPath = join26(getAllagentsDir(), WORKSPACE_CONFIG_FILE);
38366
+ const projectConfigPath = join26(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
38250
38367
  const cwdIsHome = isUserConfigPath(process.cwd());
38251
38368
  await loadConfigClients(userConfigPath, "user");
38252
38369
  if (!cwdIsHome) {
@@ -38388,7 +38505,7 @@ var pluginInstallCmd = import_cmd_ts4.command({
38388
38505
  const isUser = scope === "user" || !scope && isUserConfigPath(process.cwd());
38389
38506
  if (isUser) {
38390
38507
  const userConfigPath = getUserWorkspaceConfigPath();
38391
- if (!existsSync23(userConfigPath)) {
38508
+ if (!existsSync24(userConfigPath)) {
38392
38509
  const { promptForClients: promptForClients2 } = await Promise.resolve().then(() => (init_prompt_clients(), exports_prompt_clients));
38393
38510
  const clients = await promptForClients2();
38394
38511
  if (clients === null) {
@@ -38400,8 +38517,8 @@ var pluginInstallCmd = import_cmd_ts4.command({
38400
38517
  await ensureUserWorkspace(clients);
38401
38518
  }
38402
38519
  } else {
38403
- const configPath = join25(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
38404
- if (!existsSync23(configPath)) {
38520
+ const configPath = join26(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
38521
+ if (!existsSync24(configPath)) {
38405
38522
  const { promptForClients: promptForClients2 } = await Promise.resolve().then(() => (init_prompt_clients(), exports_prompt_clients));
38406
38523
  const clients = await promptForClients2();
38407
38524
  if (clients === null) {
@@ -38678,14 +38795,14 @@ var pluginUpdateCmd = import_cmd_ts4.command({
38678
38795
  }
38679
38796
  }
38680
38797
  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");
38798
+ const { existsSync: existsSync25 } = await import("node:fs");
38799
+ const { readFile: readFile17 } = await import("node:fs/promises");
38800
+ const { join: join27 } = await import("node:path");
38684
38801
  const { load: load2 } = await Promise.resolve().then(() => (init_js_yaml(), exports_js_yaml));
38685
38802
  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");
38803
+ const configPath = join27(process.cwd(), CONFIG_DIR2, WORKSPACE_CONFIG_FILE2);
38804
+ if (existsSync25(configPath)) {
38805
+ const content = await readFile17(configPath, "utf-8");
38689
38806
  const config = load2(content);
38690
38807
  for (const entry of config.plugins ?? []) {
38691
38808
  const p = getPluginSource(entry);
@@ -39717,7 +39834,7 @@ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise
39717
39834
  return spawnedPromise;
39718
39835
  }
39719
39836
  let timeoutId;
39720
- const timeoutPromise = new Promise((resolve13, reject) => {
39837
+ const timeoutPromise = new Promise((resolve14, reject) => {
39721
39838
  timeoutId = setTimeout(() => {
39722
39839
  timeoutKill(spawned, killSignal, reject);
39723
39840
  }, timeout);
@@ -40081,9 +40198,9 @@ var mergePromise = (spawned, promise) => {
40081
40198
  Reflect.defineProperty(spawned, property, { ...descriptor, value });
40082
40199
  }
40083
40200
  };
40084
- var getSpawnedPromise = (spawned) => new Promise((resolve13, reject) => {
40201
+ var getSpawnedPromise = (spawned) => new Promise((resolve14, reject) => {
40085
40202
  spawned.on("exit", (exitCode, signal) => {
40086
- resolve13({ exitCode, signal });
40203
+ resolve14({ exitCode, signal });
40087
40204
  });
40088
40205
  spawned.on("error", (error) => {
40089
40206
  reject(error);