allagents 1.4.11 → 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.
- package/README.md +4 -4
- package/dist/index.js +415 -277
- 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",
|
|
@@ -27013,7 +27031,7 @@ function parseMarketplaceSource(source) {
|
|
|
27013
27031
|
name
|
|
27014
27032
|
};
|
|
27015
27033
|
}
|
|
27016
|
-
async function addMarketplace(source, customName, branch,
|
|
27034
|
+
async function addMarketplace(source, customName, branch, _force, scopeOptions) {
|
|
27017
27035
|
const parsed = parseMarketplaceSource(source);
|
|
27018
27036
|
if (!parsed) {
|
|
27019
27037
|
return {
|
|
@@ -27050,9 +27068,7 @@ async function addMarketplace(source, customName, branch, force, scopeOptions) {
|
|
|
27050
27068
|
return parsed.location;
|
|
27051
27069
|
})();
|
|
27052
27070
|
const existingBySource = findBySourceLocation(registry, sourceLocation);
|
|
27053
|
-
|
|
27054
|
-
return { success: true, marketplace: existingBySource, alreadyRegistered: true };
|
|
27055
|
-
}
|
|
27071
|
+
let alreadyRegistered = !!existingBySource;
|
|
27056
27072
|
let marketplacePath;
|
|
27057
27073
|
if (parsed.type === "github" || parsed.type === "git") {
|
|
27058
27074
|
marketplacePath = join10(getMarketplacesDir(), name);
|
|
@@ -27104,24 +27120,15 @@ async function addMarketplace(source, customName, branch, force, scopeOptions) {
|
|
|
27104
27120
|
if (manifestResult.success && manifestResult.data.name) {
|
|
27105
27121
|
const manifestName = manifestResult.data.name;
|
|
27106
27122
|
if (manifestName !== name) {
|
|
27107
|
-
|
|
27108
|
-
|
|
27109
|
-
return {
|
|
27110
|
-
success: true,
|
|
27111
|
-
marketplace: existing,
|
|
27112
|
-
alreadyRegistered: true
|
|
27113
|
-
};
|
|
27123
|
+
if (registry.marketplaces[manifestName]) {
|
|
27124
|
+
alreadyRegistered = true;
|
|
27114
27125
|
}
|
|
27115
27126
|
name = manifestName;
|
|
27116
27127
|
}
|
|
27117
27128
|
}
|
|
27118
27129
|
}
|
|
27119
|
-
|
|
27120
|
-
|
|
27121
|
-
return {
|
|
27122
|
-
success: false,
|
|
27123
|
-
error: `Marketplace '${name}' already exists. Use 'update' to refresh it.`
|
|
27124
|
-
};
|
|
27130
|
+
if (registry.marketplaces[name]) {
|
|
27131
|
+
alreadyRegistered = true;
|
|
27125
27132
|
}
|
|
27126
27133
|
let entryLocation;
|
|
27127
27134
|
if (parsed.type === "github") {
|
|
@@ -27144,7 +27151,7 @@ async function addMarketplace(source, customName, branch, force, scopeOptions) {
|
|
|
27144
27151
|
return {
|
|
27145
27152
|
success: true,
|
|
27146
27153
|
marketplace: entry,
|
|
27147
|
-
...
|
|
27154
|
+
...alreadyRegistered && { replaced: true }
|
|
27148
27155
|
};
|
|
27149
27156
|
}
|
|
27150
27157
|
async function removeMarketplace(name, options2 = {}) {
|
|
@@ -27584,7 +27591,7 @@ async function autoRegisterMarketplace(source) {
|
|
|
27584
27591
|
return { success: false, error: result.error || "Unknown error" };
|
|
27585
27592
|
}
|
|
27586
27593
|
const name = result.marketplace?.name ?? parts[1];
|
|
27587
|
-
if (!result.
|
|
27594
|
+
if (!result.replaced) {
|
|
27588
27595
|
console.log(`Auto-registered GitHub marketplace: ${source}`);
|
|
27589
27596
|
}
|
|
27590
27597
|
registeredSourceCache.set(source, name);
|
|
@@ -28358,10 +28365,100 @@ var init_workspace_modify = __esm(() => {
|
|
|
28358
28365
|
DEFAULT_PROJECT_CLIENTS = ["universal"];
|
|
28359
28366
|
});
|
|
28360
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
|
+
|
|
28361
28458
|
// src/core/workspace-repo.ts
|
|
28362
|
-
import { readFile as
|
|
28363
|
-
import { existsSync as
|
|
28364
|
-
import { join as
|
|
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";
|
|
28365
28462
|
async function detectRemote(repoPath) {
|
|
28366
28463
|
try {
|
|
28367
28464
|
const env2 = { ...process.env };
|
|
@@ -28403,10 +28500,10 @@ function normalizePath(p) {
|
|
|
28403
28500
|
}
|
|
28404
28501
|
async function addRepository(path, options2 = {}, workspacePath = process.cwd()) {
|
|
28405
28502
|
const normalizedPath = normalizePath(path);
|
|
28406
|
-
const configPath =
|
|
28503
|
+
const configPath = join13(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
28407
28504
|
await ensureWorkspace(workspacePath);
|
|
28408
28505
|
try {
|
|
28409
|
-
const content = await
|
|
28506
|
+
const content = await readFile9(configPath, "utf-8");
|
|
28410
28507
|
const config = load(content);
|
|
28411
28508
|
if (config.repositories.some((r) => normalizePath(r.path) === normalizedPath)) {
|
|
28412
28509
|
return { success: false, error: `Repository already exists: ${normalizedPath}` };
|
|
@@ -28426,8 +28523,8 @@ async function addRepository(path, options2 = {}, workspacePath = process.cwd())
|
|
|
28426
28523
|
}
|
|
28427
28524
|
}
|
|
28428
28525
|
async function removeRepository(path, workspacePath = process.cwd()) {
|
|
28429
|
-
const configPath =
|
|
28430
|
-
if (!
|
|
28526
|
+
const configPath = join13(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
28527
|
+
if (!existsSync10(configPath)) {
|
|
28431
28528
|
return {
|
|
28432
28529
|
success: false,
|
|
28433
28530
|
error: `${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
|
|
@@ -28435,7 +28532,7 @@ async function removeRepository(path, workspacePath = process.cwd()) {
|
|
|
28435
28532
|
};
|
|
28436
28533
|
}
|
|
28437
28534
|
try {
|
|
28438
|
-
const content = await
|
|
28535
|
+
const content = await readFile9(configPath, "utf-8");
|
|
28439
28536
|
const config = load(content);
|
|
28440
28537
|
const normalizedPath = normalizePath(path);
|
|
28441
28538
|
const index = config.repositories.findIndex((r) => normalizePath(r.path) === normalizedPath);
|
|
@@ -28450,34 +28547,40 @@ async function removeRepository(path, workspacePath = process.cwd()) {
|
|
|
28450
28547
|
}
|
|
28451
28548
|
}
|
|
28452
28549
|
async function listRepositories(workspacePath = process.cwd()) {
|
|
28453
|
-
const configPath =
|
|
28454
|
-
if (!
|
|
28550
|
+
const configPath = join13(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
28551
|
+
if (!existsSync10(configPath))
|
|
28455
28552
|
return [];
|
|
28456
28553
|
try {
|
|
28457
|
-
const content = await
|
|
28554
|
+
const content = await readFile9(configPath, "utf-8");
|
|
28458
28555
|
const config = load(content);
|
|
28459
28556
|
return config.repositories ?? [];
|
|
28460
28557
|
} catch {
|
|
28461
28558
|
return [];
|
|
28462
28559
|
}
|
|
28463
28560
|
}
|
|
28561
|
+
function resolveClientNames(clients) {
|
|
28562
|
+
return (clients ?? []).map((c) => typeof c === "string" ? c : c.name);
|
|
28563
|
+
}
|
|
28464
28564
|
async function updateAgentFiles(workspacePath = process.cwd()) {
|
|
28465
|
-
const configPath =
|
|
28466
|
-
if (!
|
|
28565
|
+
const configPath = join13(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
28566
|
+
if (!existsSync10(configPath))
|
|
28467
28567
|
return;
|
|
28468
|
-
const content = await
|
|
28568
|
+
const content = await readFile9(configPath, "utf-8");
|
|
28469
28569
|
const config = load(content);
|
|
28470
28570
|
if (config.repositories.length === 0)
|
|
28471
28571
|
return;
|
|
28572
|
+
const clientNames = resolveClientNames(config.clients);
|
|
28573
|
+
const allSkills = await discoverWorkspaceSkills(workspacePath, config.repositories, clientNames);
|
|
28472
28574
|
const agentFiles = new Set;
|
|
28473
28575
|
for (const client of config.clients ?? []) {
|
|
28474
|
-
const
|
|
28576
|
+
const clientName = typeof client === "string" ? client : client.name;
|
|
28577
|
+
const mapping = CLIENT_MAPPINGS[clientName];
|
|
28475
28578
|
if (mapping?.agentFile)
|
|
28476
28579
|
agentFiles.add(mapping.agentFile);
|
|
28477
28580
|
}
|
|
28478
28581
|
agentFiles.add("AGENTS.md");
|
|
28479
28582
|
for (const agentFile of agentFiles) {
|
|
28480
|
-
await ensureWorkspaceRules(
|
|
28583
|
+
await ensureWorkspaceRules(join13(workspacePath, agentFile), config.repositories, allSkills);
|
|
28481
28584
|
}
|
|
28482
28585
|
}
|
|
28483
28586
|
var init_workspace_repo = __esm(() => {
|
|
@@ -28486,6 +28589,7 @@ var init_workspace_repo = __esm(() => {
|
|
|
28486
28589
|
init_workspace_modify();
|
|
28487
28590
|
init_transform();
|
|
28488
28591
|
init_client_mapping();
|
|
28592
|
+
init_repo_skills();
|
|
28489
28593
|
});
|
|
28490
28594
|
|
|
28491
28595
|
// src/utils/hash.ts
|
|
@@ -28651,20 +28755,48 @@ var init_sync_state = __esm(() => {
|
|
|
28651
28755
|
});
|
|
28652
28756
|
});
|
|
28653
28757
|
|
|
28758
|
+
// src/core/config-gitignore.ts
|
|
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";
|
|
28762
|
+
async function ensureConfigGitignore(workspacePath) {
|
|
28763
|
+
const gitignorePath = join14(workspacePath, CONFIG_DIR, ".gitignore");
|
|
28764
|
+
let existing = "";
|
|
28765
|
+
if (existsSync11(gitignorePath)) {
|
|
28766
|
+
existing = await readFile10(gitignorePath, "utf-8");
|
|
28767
|
+
}
|
|
28768
|
+
const missing = GITIGNORE_ENTRIES.filter((entry) => !existing.split(`
|
|
28769
|
+
`).includes(entry));
|
|
28770
|
+
if (missing.length === 0)
|
|
28771
|
+
return;
|
|
28772
|
+
const content = existing ? `${existing.trimEnd()}
|
|
28773
|
+
${missing.join(`
|
|
28774
|
+
`)}
|
|
28775
|
+
` : `${missing.join(`
|
|
28776
|
+
`)}
|
|
28777
|
+
`;
|
|
28778
|
+
await writeFile6(gitignorePath, content, "utf-8");
|
|
28779
|
+
}
|
|
28780
|
+
var GITIGNORE_ENTRIES;
|
|
28781
|
+
var init_config_gitignore = __esm(() => {
|
|
28782
|
+
init_constants();
|
|
28783
|
+
GITIGNORE_ENTRIES = [SYNC_STATE_FILE];
|
|
28784
|
+
});
|
|
28785
|
+
|
|
28654
28786
|
// src/core/sync-state.ts
|
|
28655
|
-
import { readFile as
|
|
28656
|
-
import { existsSync as
|
|
28657
|
-
import { join as
|
|
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";
|
|
28658
28790
|
function getSyncStatePath(workspacePath) {
|
|
28659
|
-
return
|
|
28791
|
+
return join15(workspacePath, CONFIG_DIR, SYNC_STATE_FILE);
|
|
28660
28792
|
}
|
|
28661
28793
|
async function loadSyncState(workspacePath) {
|
|
28662
28794
|
const statePath = getSyncStatePath(workspacePath);
|
|
28663
|
-
if (!
|
|
28795
|
+
if (!existsSync12(statePath)) {
|
|
28664
28796
|
return null;
|
|
28665
28797
|
}
|
|
28666
28798
|
try {
|
|
28667
|
-
const content = await
|
|
28799
|
+
const content = await readFile11(statePath, "utf-8");
|
|
28668
28800
|
const parsed = JSON.parse(content);
|
|
28669
28801
|
const result = SyncStateSchema.safeParse(parsed);
|
|
28670
28802
|
if (!result.success) {
|
|
@@ -28688,7 +28820,8 @@ async function saveSyncState(workspacePath, data) {
|
|
|
28688
28820
|
...normalizedData.vscodeWorkspaceRepos && { vscodeWorkspaceRepos: normalizedData.vscodeWorkspaceRepos }
|
|
28689
28821
|
};
|
|
28690
28822
|
await mkdir7(dirname6(statePath), { recursive: true });
|
|
28691
|
-
await
|
|
28823
|
+
await ensureConfigGitignore(workspacePath);
|
|
28824
|
+
await writeFile7(statePath, JSON.stringify(state, null, 2), "utf-8");
|
|
28692
28825
|
}
|
|
28693
28826
|
function getPreviouslySyncedFiles(state, client) {
|
|
28694
28827
|
if (!state) {
|
|
@@ -28710,15 +28843,16 @@ function getPreviouslySyncedNativePlugins(state, client) {
|
|
|
28710
28843
|
var init_sync_state2 = __esm(() => {
|
|
28711
28844
|
init_constants();
|
|
28712
28845
|
init_sync_state();
|
|
28846
|
+
init_config_gitignore();
|
|
28713
28847
|
});
|
|
28714
28848
|
|
|
28715
28849
|
// src/core/vscode-workspace.ts
|
|
28716
28850
|
import { createHash as createHash2 } from "node:crypto";
|
|
28717
|
-
import { resolve as
|
|
28851
|
+
import { resolve as resolve9, basename as basename5, isAbsolute as isAbsolute3, relative as relative4 } from "node:path";
|
|
28718
28852
|
function buildPathPlaceholderMap(repositories, workspacePath) {
|
|
28719
28853
|
const map2 = new Map;
|
|
28720
28854
|
for (const repo of repositories) {
|
|
28721
|
-
const absolutePath =
|
|
28855
|
+
const absolutePath = resolve9(workspacePath, repo.path);
|
|
28722
28856
|
map2.set(repo.path, absolutePath);
|
|
28723
28857
|
}
|
|
28724
28858
|
return map2;
|
|
@@ -28753,9 +28887,9 @@ function generateVscodeWorkspace(input) {
|
|
|
28753
28887
|
const folders = [];
|
|
28754
28888
|
const seenPaths = new Set;
|
|
28755
28889
|
folders.push({ path: "." });
|
|
28756
|
-
seenPaths.add(
|
|
28890
|
+
seenPaths.add(resolve9(workspacePath, "."));
|
|
28757
28891
|
for (const repo of repositories) {
|
|
28758
|
-
const absolutePath =
|
|
28892
|
+
const absolutePath = resolve9(workspacePath, repo.path).replace(/\\/g, "/");
|
|
28759
28893
|
const entry = { path: absolutePath };
|
|
28760
28894
|
if (repo.name)
|
|
28761
28895
|
entry.name = repo.name;
|
|
@@ -28765,7 +28899,7 @@ function generateVscodeWorkspace(input) {
|
|
|
28765
28899
|
if (resolvedTemplate && Array.isArray(resolvedTemplate.folders)) {
|
|
28766
28900
|
for (const folder of resolvedTemplate.folders) {
|
|
28767
28901
|
const rawPath = folder.path;
|
|
28768
|
-
const normalizedPath = (typeof rawPath === "string" && !isAbsolute3(rawPath) ?
|
|
28902
|
+
const normalizedPath = (typeof rawPath === "string" && !isAbsolute3(rawPath) ? resolve9(workspacePath, rawPath) : rawPath).replace(/\\/g, "/");
|
|
28769
28903
|
if (!seenPaths.has(normalizedPath)) {
|
|
28770
28904
|
const entry = { path: normalizedPath };
|
|
28771
28905
|
if (folder.name)
|
|
@@ -28795,22 +28929,22 @@ function getWorkspaceOutputPath(workspacePath, vscodeConfig) {
|
|
|
28795
28929
|
const name = vscodeConfig?.output;
|
|
28796
28930
|
if (name) {
|
|
28797
28931
|
const filename = name.endsWith(".code-workspace") ? name : `${name}.code-workspace`;
|
|
28798
|
-
return
|
|
28932
|
+
return resolve9(workspacePath, filename);
|
|
28799
28933
|
}
|
|
28800
|
-
const dirName = basename5(
|
|
28801
|
-
return
|
|
28934
|
+
const dirName = basename5(resolve9(workspacePath));
|
|
28935
|
+
return resolve9(workspacePath, `${dirName}.code-workspace`);
|
|
28802
28936
|
}
|
|
28803
28937
|
function computeWorkspaceHash(content) {
|
|
28804
28938
|
return createHash2("sha256").update(content).digest("hex");
|
|
28805
28939
|
}
|
|
28806
28940
|
function reconcileVscodeWorkspaceFolders(workspacePath, codeWorkspaceFolders, lastSyncedRepos, currentRepos) {
|
|
28807
|
-
const normalizedWorkspacePath =
|
|
28941
|
+
const normalizedWorkspacePath = resolve9(workspacePath).replace(/\\/g, "/");
|
|
28808
28942
|
const codeWorkspaceAbsPaths = new Set;
|
|
28809
28943
|
const codeWorkspaceNames = new Map;
|
|
28810
28944
|
for (const folder of codeWorkspaceFolders) {
|
|
28811
28945
|
if (folder.path === ".")
|
|
28812
28946
|
continue;
|
|
28813
|
-
const absPath = (isAbsolute3(folder.path) ? folder.path :
|
|
28947
|
+
const absPath = (isAbsolute3(folder.path) ? folder.path : resolve9(workspacePath, folder.path)).replace(/\\/g, "/");
|
|
28814
28948
|
codeWorkspaceAbsPaths.add(absPath);
|
|
28815
28949
|
if (folder.name)
|
|
28816
28950
|
codeWorkspaceNames.set(absPath, folder.name);
|
|
@@ -28818,7 +28952,7 @@ function reconcileVscodeWorkspaceFolders(workspacePath, codeWorkspaceFolders, la
|
|
|
28818
28952
|
const lastSyncedSet = new Set(lastSyncedRepos.map((p) => p.replace(/\\/g, "/")));
|
|
28819
28953
|
const currentReposByAbsPath = new Map;
|
|
28820
28954
|
for (const repo of currentRepos) {
|
|
28821
|
-
const absPath =
|
|
28955
|
+
const absPath = resolve9(workspacePath, repo.path).replace(/\\/g, "/");
|
|
28822
28956
|
currentReposByAbsPath.set(absPath, repo);
|
|
28823
28957
|
}
|
|
28824
28958
|
const currentAbsPaths = new Set(currentReposByAbsPath.keys());
|
|
@@ -28834,10 +28968,9 @@ function reconcileVscodeWorkspaceFolders(workspacePath, codeWorkspaceFolders, la
|
|
|
28834
28968
|
} else {
|
|
28835
28969
|
const folderName = codeWorkspaceNames.get(absPath);
|
|
28836
28970
|
if (folderName !== repo.name) {
|
|
28837
|
-
const
|
|
28838
|
-
|
|
28839
|
-
|
|
28840
|
-
} else {
|
|
28971
|
+
const { name: _name, ...repoWithoutName } = repo;
|
|
28972
|
+
const updatedRepo = folderName === undefined ? { ...repoWithoutName } : { ...repo };
|
|
28973
|
+
if (folderName !== undefined) {
|
|
28841
28974
|
updatedRepo.name = folderName;
|
|
28842
28975
|
}
|
|
28843
28976
|
updatedRepos.push(updatedRepo);
|
|
@@ -28851,7 +28984,7 @@ function reconcileVscodeWorkspaceFolders(workspacePath, codeWorkspaceFolders, la
|
|
|
28851
28984
|
const inLastSync = lastSyncedSet.has(absPath);
|
|
28852
28985
|
const inCurrentRepos = currentAbsPaths.has(absPath);
|
|
28853
28986
|
if (!inLastSync && !inCurrentRepos) {
|
|
28854
|
-
const relPath =
|
|
28987
|
+
const relPath = relative4(normalizedWorkspacePath, absPath).replace(/\\/g, "/");
|
|
28855
28988
|
added.push(relPath);
|
|
28856
28989
|
const newRepo = { path: relPath };
|
|
28857
28990
|
const folderName = codeWorkspaceNames.get(absPath);
|
|
@@ -28870,8 +29003,8 @@ var init_vscode_workspace = __esm(() => {
|
|
|
28870
29003
|
});
|
|
28871
29004
|
|
|
28872
29005
|
// src/core/vscode-mcp.ts
|
|
28873
|
-
import { existsSync as
|
|
28874
|
-
import { join as
|
|
29006
|
+
import { existsSync as existsSync13, readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
29007
|
+
import { join as join16, dirname as dirname7 } from "node:path";
|
|
28875
29008
|
function deepEqual(a, b) {
|
|
28876
29009
|
if (a === b)
|
|
28877
29010
|
return true;
|
|
@@ -28903,17 +29036,17 @@ function getVscodeMcpConfigPath() {
|
|
|
28903
29036
|
if (!appData) {
|
|
28904
29037
|
throw new Error("APPDATA environment variable not set");
|
|
28905
29038
|
}
|
|
28906
|
-
return
|
|
29039
|
+
return join16(appData, "Code", "User", "mcp.json");
|
|
28907
29040
|
}
|
|
28908
29041
|
const home = getHomeDir();
|
|
28909
29042
|
if (platform2 === "darwin") {
|
|
28910
|
-
return
|
|
29043
|
+
return join16(home, "Library", "Application Support", "Code", "User", "mcp.json");
|
|
28911
29044
|
}
|
|
28912
|
-
return
|
|
29045
|
+
return join16(home, ".config", "Code", "User", "mcp.json");
|
|
28913
29046
|
}
|
|
28914
29047
|
function readPluginMcpConfig(pluginPath) {
|
|
28915
|
-
const mcpPath =
|
|
28916
|
-
if (!
|
|
29048
|
+
const mcpPath = join16(pluginPath, ".mcp.json");
|
|
29049
|
+
if (!existsSync13(mcpPath)) {
|
|
28917
29050
|
return null;
|
|
28918
29051
|
}
|
|
28919
29052
|
try {
|
|
@@ -28964,7 +29097,7 @@ function syncVscodeMcpConfig(validatedPlugins, options2) {
|
|
|
28964
29097
|
trackedServers: []
|
|
28965
29098
|
};
|
|
28966
29099
|
let existingConfig = {};
|
|
28967
|
-
if (
|
|
29100
|
+
if (existsSync13(configPath)) {
|
|
28968
29101
|
try {
|
|
28969
29102
|
const content = readFileSync(configPath, "utf-8");
|
|
28970
29103
|
existingConfig = import_json5.default.parse(content);
|
|
@@ -29015,7 +29148,7 @@ function syncVscodeMcpConfig(validatedPlugins, options2) {
|
|
|
29015
29148
|
if (hasChanges && !dryRun) {
|
|
29016
29149
|
existingConfig.servers = existingServers;
|
|
29017
29150
|
const dir = dirname7(configPath);
|
|
29018
|
-
if (!
|
|
29151
|
+
if (!existsSync13(dir)) {
|
|
29019
29152
|
mkdirSync(dir, { recursive: true });
|
|
29020
29153
|
}
|
|
29021
29154
|
writeFileSync(configPath, `${JSON.stringify(existingConfig, null, 2)}
|
|
@@ -29033,7 +29166,7 @@ function syncVscodeMcpConfig(validatedPlugins, options2) {
|
|
|
29033
29166
|
if (result.removed > 0 && !dryRun) {
|
|
29034
29167
|
existingConfig.servers = existingServers;
|
|
29035
29168
|
const dir = dirname7(configPath);
|
|
29036
|
-
if (!
|
|
29169
|
+
if (!existsSync13(dir)) {
|
|
29037
29170
|
mkdirSync(dir, { recursive: true });
|
|
29038
29171
|
}
|
|
29039
29172
|
writeFileSync(configPath, `${JSON.stringify(existingConfig, null, 2)}
|
|
@@ -29052,7 +29185,7 @@ var init_vscode_mcp = __esm(() => {
|
|
|
29052
29185
|
// src/core/native/types.ts
|
|
29053
29186
|
import { spawn as spawn2 } from "node:child_process";
|
|
29054
29187
|
function executeCommand(binary2, args, options2 = {}) {
|
|
29055
|
-
return new Promise((
|
|
29188
|
+
return new Promise((resolve10) => {
|
|
29056
29189
|
const proc = spawn2(binary2, args, {
|
|
29057
29190
|
cwd: options2.cwd,
|
|
29058
29191
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -29073,7 +29206,7 @@ function executeCommand(binary2, args, options2 = {}) {
|
|
|
29073
29206
|
return;
|
|
29074
29207
|
resolved = true;
|
|
29075
29208
|
const trimmedStderr = stderr.trim();
|
|
29076
|
-
|
|
29209
|
+
resolve10({
|
|
29077
29210
|
success: code === 0,
|
|
29078
29211
|
output: stdout.trim(),
|
|
29079
29212
|
...trimmedStderr && { error: trimmedStderr }
|
|
@@ -29083,7 +29216,7 @@ function executeCommand(binary2, args, options2 = {}) {
|
|
|
29083
29216
|
if (resolved)
|
|
29084
29217
|
return;
|
|
29085
29218
|
resolved = true;
|
|
29086
|
-
|
|
29219
|
+
resolve10({
|
|
29087
29220
|
success: false,
|
|
29088
29221
|
output: "",
|
|
29089
29222
|
error: `Failed to execute ${binary2} CLI: ${err.message}`
|
|
@@ -29102,7 +29235,7 @@ function mergeNativeSyncResults(results) {
|
|
|
29102
29235
|
var init_types2 = () => {};
|
|
29103
29236
|
|
|
29104
29237
|
// src/core/codex-mcp.ts
|
|
29105
|
-
import { existsSync as
|
|
29238
|
+
import { existsSync as existsSync14, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
29106
29239
|
import { dirname as dirname8 } from "node:path";
|
|
29107
29240
|
function buildCodexMcpAddArgs(name, config) {
|
|
29108
29241
|
if (typeof config.url === "string") {
|
|
@@ -29313,7 +29446,7 @@ function syncCodexProjectMcpConfig(validatedPlugins, options2) {
|
|
|
29313
29446
|
trackedServers: []
|
|
29314
29447
|
};
|
|
29315
29448
|
let existingContent = "";
|
|
29316
|
-
if (
|
|
29449
|
+
if (existsSync14(configPath)) {
|
|
29317
29450
|
try {
|
|
29318
29451
|
existingContent = readFileSync2(configPath, "utf-8");
|
|
29319
29452
|
} catch {
|
|
@@ -29369,7 +29502,7 @@ function syncCodexProjectMcpConfig(validatedPlugins, options2) {
|
|
|
29369
29502
|
`)}
|
|
29370
29503
|
`;
|
|
29371
29504
|
const dir = dirname8(configPath);
|
|
29372
|
-
if (!
|
|
29505
|
+
if (!existsSync14(dir)) {
|
|
29373
29506
|
mkdirSync2(dir, { recursive: true });
|
|
29374
29507
|
}
|
|
29375
29508
|
writeFileSync2(configPath, output, "utf-8");
|
|
@@ -29383,7 +29516,7 @@ var init_codex_mcp = __esm(() => {
|
|
|
29383
29516
|
});
|
|
29384
29517
|
|
|
29385
29518
|
// src/core/claude-mcp.ts
|
|
29386
|
-
import { existsSync as
|
|
29519
|
+
import { existsSync as existsSync15, readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "node:fs";
|
|
29387
29520
|
import { dirname as dirname9 } from "node:path";
|
|
29388
29521
|
function deepEqual2(a, b) {
|
|
29389
29522
|
if (a === b)
|
|
@@ -29451,7 +29584,7 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
|
|
|
29451
29584
|
trackedServers: []
|
|
29452
29585
|
};
|
|
29453
29586
|
let existingConfig = {};
|
|
29454
|
-
if (
|
|
29587
|
+
if (existsSync15(configPath)) {
|
|
29455
29588
|
try {
|
|
29456
29589
|
const content = readFileSync3(configPath, "utf-8");
|
|
29457
29590
|
existingConfig = import_json52.default.parse(content);
|
|
@@ -29502,7 +29635,7 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
|
|
|
29502
29635
|
if (hasChanges && !dryRun) {
|
|
29503
29636
|
existingConfig.mcpServers = existingServers;
|
|
29504
29637
|
const dir = dirname9(configPath);
|
|
29505
|
-
if (!
|
|
29638
|
+
if (!existsSync15(dir)) {
|
|
29506
29639
|
mkdirSync3(dir, { recursive: true });
|
|
29507
29640
|
}
|
|
29508
29641
|
writeFileSync3(configPath, `${JSON.stringify(existingConfig, null, 2)}
|
|
@@ -29520,7 +29653,7 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
|
|
|
29520
29653
|
if (result.removed > 0 && !dryRun) {
|
|
29521
29654
|
existingConfig.mcpServers = existingServers;
|
|
29522
29655
|
const dir = dirname9(configPath);
|
|
29523
|
-
if (!
|
|
29656
|
+
if (!existsSync15(dir)) {
|
|
29524
29657
|
mkdirSync3(dir, { recursive: true });
|
|
29525
29658
|
}
|
|
29526
29659
|
writeFileSync3(configPath, `${JSON.stringify(existingConfig, null, 2)}
|
|
@@ -29619,9 +29752,9 @@ var init_claude_mcp = __esm(() => {
|
|
|
29619
29752
|
});
|
|
29620
29753
|
|
|
29621
29754
|
// src/core/copilot-mcp.ts
|
|
29622
|
-
import { join as
|
|
29755
|
+
import { join as join17 } from "node:path";
|
|
29623
29756
|
function getCopilotMcpConfigPath() {
|
|
29624
|
-
return
|
|
29757
|
+
return join17(getHomeDir(), ".copilot", "mcp-config.json");
|
|
29625
29758
|
}
|
|
29626
29759
|
var init_copilot_mcp = __esm(() => {
|
|
29627
29760
|
init_constants();
|
|
@@ -29919,9 +30052,9 @@ function padStart2(str3, len) {
|
|
|
29919
30052
|
}
|
|
29920
30053
|
|
|
29921
30054
|
// src/core/sync.ts
|
|
29922
|
-
import { existsSync as
|
|
30055
|
+
import { existsSync as existsSync16, readFileSync as readFileSync4, writeFileSync as writeFileSync4, lstatSync as lstatSync2 } from "node:fs";
|
|
29923
30056
|
import { rm as rm4, unlink as unlink2, rmdir, copyFile } from "node:fs/promises";
|
|
29924
|
-
import { join as
|
|
30057
|
+
import { join as join18, resolve as resolve10, dirname as dirname10, relative as relative5 } from "node:path";
|
|
29925
30058
|
function deduplicateClientsByPath(clients, clientMappings = CLIENT_MAPPINGS) {
|
|
29926
30059
|
const pathToClients = new Map;
|
|
29927
30060
|
for (const client of clients) {
|
|
@@ -30035,11 +30168,11 @@ async function selectivePurgeWorkspace(workspacePath, state, clients) {
|
|
|
30035
30168
|
const previousFiles = getPreviouslySyncedFiles(state, client);
|
|
30036
30169
|
const purgedPaths = [];
|
|
30037
30170
|
for (const filePath of previousFiles) {
|
|
30038
|
-
const fullPath =
|
|
30171
|
+
const fullPath = join18(workspacePath, filePath);
|
|
30039
30172
|
const cleanPath = fullPath.replace(/\/$/, "");
|
|
30040
30173
|
let stats;
|
|
30041
30174
|
try {
|
|
30042
|
-
stats =
|
|
30175
|
+
stats = lstatSync2(cleanPath);
|
|
30043
30176
|
} catch {
|
|
30044
30177
|
continue;
|
|
30045
30178
|
}
|
|
@@ -30064,8 +30197,8 @@ async function selectivePurgeWorkspace(workspacePath, state, clients) {
|
|
|
30064
30197
|
async function cleanupEmptyParents(workspacePath, filePath) {
|
|
30065
30198
|
let parentPath = dirname10(filePath);
|
|
30066
30199
|
while (parentPath && parentPath !== "." && parentPath !== "/") {
|
|
30067
|
-
const fullParentPath =
|
|
30068
|
-
if (!
|
|
30200
|
+
const fullParentPath = join18(workspacePath, parentPath);
|
|
30201
|
+
if (!existsSync16(fullParentPath)) {
|
|
30069
30202
|
parentPath = dirname10(parentPath);
|
|
30070
30203
|
continue;
|
|
30071
30204
|
}
|
|
@@ -30150,8 +30283,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
30150
30283
|
errors2.push(`Cannot resolve file '${file}' - no workspace.source configured`);
|
|
30151
30284
|
continue;
|
|
30152
30285
|
}
|
|
30153
|
-
const fullPath =
|
|
30154
|
-
if (!
|
|
30286
|
+
const fullPath = join18(defaultSourcePath, file);
|
|
30287
|
+
if (!existsSync16(fullPath)) {
|
|
30155
30288
|
errors2.push(`File source not found: ${fullPath}`);
|
|
30156
30289
|
}
|
|
30157
30290
|
continue;
|
|
@@ -30169,8 +30302,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
30169
30302
|
errors2.push(`GitHub cache not found for ${cacheKey}`);
|
|
30170
30303
|
continue;
|
|
30171
30304
|
}
|
|
30172
|
-
const fullPath =
|
|
30173
|
-
if (!
|
|
30305
|
+
const fullPath = join18(cachePath, parsed.filePath);
|
|
30306
|
+
if (!existsSync16(fullPath)) {
|
|
30174
30307
|
errors2.push(`Path not found in repository: ${cacheKey}/${parsed.filePath}`);
|
|
30175
30308
|
}
|
|
30176
30309
|
} else {
|
|
@@ -30178,13 +30311,13 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
30178
30311
|
if (file.source.startsWith("/")) {
|
|
30179
30312
|
fullPath = file.source;
|
|
30180
30313
|
} else if (file.source.startsWith("../")) {
|
|
30181
|
-
fullPath =
|
|
30314
|
+
fullPath = resolve10(file.source);
|
|
30182
30315
|
} else if (defaultSourcePath) {
|
|
30183
|
-
fullPath =
|
|
30316
|
+
fullPath = join18(defaultSourcePath, file.source);
|
|
30184
30317
|
} else {
|
|
30185
|
-
fullPath =
|
|
30318
|
+
fullPath = resolve10(file.source);
|
|
30186
30319
|
}
|
|
30187
|
-
if (!
|
|
30320
|
+
if (!existsSync16(fullPath)) {
|
|
30188
30321
|
errors2.push(`File source not found: ${fullPath}`);
|
|
30189
30322
|
}
|
|
30190
30323
|
}
|
|
@@ -30193,8 +30326,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
30193
30326
|
errors2.push(`Cannot resolve file '${file.dest}' - no workspace.source configured and no explicit source provided`);
|
|
30194
30327
|
continue;
|
|
30195
30328
|
}
|
|
30196
|
-
const fullPath =
|
|
30197
|
-
if (!
|
|
30329
|
+
const fullPath = join18(defaultSourcePath, file.dest ?? "");
|
|
30330
|
+
if (!existsSync16(fullPath)) {
|
|
30198
30331
|
errors2.push(`File source not found: ${fullPath}`);
|
|
30199
30332
|
}
|
|
30200
30333
|
}
|
|
@@ -30211,7 +30344,7 @@ function collectSyncedPaths(copyResults, workspacePath, clients, clientMappings)
|
|
|
30211
30344
|
if (copyResult.action !== "copied" && copyResult.action !== "generated") {
|
|
30212
30345
|
continue;
|
|
30213
30346
|
}
|
|
30214
|
-
const relativePath =
|
|
30347
|
+
const relativePath = relative5(workspacePath, copyResult.destination).replace(/\\/g, "/");
|
|
30215
30348
|
for (const client of clients) {
|
|
30216
30349
|
const mapping = mappings[client];
|
|
30217
30350
|
if (mapping.skillsPath && relativePath.startsWith(mapping.skillsPath)) {
|
|
@@ -30340,7 +30473,7 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
|
|
|
30340
30473
|
...fetchResult.error && { error: fetchResult.error }
|
|
30341
30474
|
};
|
|
30342
30475
|
}
|
|
30343
|
-
const resolvedPath2 = parsed?.subpath ?
|
|
30476
|
+
const resolvedPath2 = parsed?.subpath ? join18(fetchResult.cachePath, parsed.subpath) : fetchResult.cachePath;
|
|
30344
30477
|
return {
|
|
30345
30478
|
plugin: pluginSource,
|
|
30346
30479
|
resolved: resolvedPath2,
|
|
@@ -30349,8 +30482,8 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
|
|
|
30349
30482
|
nativeClients: []
|
|
30350
30483
|
};
|
|
30351
30484
|
}
|
|
30352
|
-
const resolvedPath =
|
|
30353
|
-
if (!
|
|
30485
|
+
const resolvedPath = resolve10(workspacePath, pluginSource);
|
|
30486
|
+
if (!existsSync16(resolvedPath)) {
|
|
30354
30487
|
return {
|
|
30355
30488
|
plugin: pluginSource,
|
|
30356
30489
|
resolved: resolvedPath,
|
|
@@ -30511,10 +30644,10 @@ function buildPluginSkillNameMaps(allSkills) {
|
|
|
30511
30644
|
return pluginMaps;
|
|
30512
30645
|
}
|
|
30513
30646
|
function generateVscodeWorkspaceFile(workspacePath, config) {
|
|
30514
|
-
const configDir =
|
|
30515
|
-
const templatePath =
|
|
30647
|
+
const configDir = join18(workspacePath, CONFIG_DIR);
|
|
30648
|
+
const templatePath = join18(configDir, VSCODE_TEMPLATE_FILE);
|
|
30516
30649
|
let template;
|
|
30517
|
-
if (
|
|
30650
|
+
if (existsSync16(templatePath)) {
|
|
30518
30651
|
try {
|
|
30519
30652
|
template = import_json53.default.parse(readFileSync4(templatePath, "utf-8"));
|
|
30520
30653
|
} catch (error) {
|
|
@@ -30661,7 +30794,7 @@ async function syncVscodeWorkspaceFile(workspacePath, config, configPath, previo
|
|
|
30661
30794
|
let updatedConfig = config;
|
|
30662
30795
|
if (previousState?.vscodeWorkspaceHash && previousState?.vscodeWorkspaceRepos) {
|
|
30663
30796
|
const outputPath = getWorkspaceOutputPath(workspacePath, config.vscode);
|
|
30664
|
-
if (
|
|
30797
|
+
if (existsSync16(outputPath)) {
|
|
30665
30798
|
const existingContent = readFileSync4(outputPath, "utf-8");
|
|
30666
30799
|
const currentHash = computeWorkspaceHash(existingContent);
|
|
30667
30800
|
if (currentHash !== previousState.vscodeWorkspaceHash) {
|
|
@@ -30691,7 +30824,7 @@ async function syncVscodeWorkspaceFile(workspacePath, config, configPath, previo
|
|
|
30691
30824
|
}
|
|
30692
30825
|
const writtenContent = generateVscodeWorkspaceFile(workspacePath, updatedConfig);
|
|
30693
30826
|
const hash = computeWorkspaceHash(writtenContent);
|
|
30694
|
-
const repos = updatedConfig.repositories.map((r) =>
|
|
30827
|
+
const repos = updatedConfig.repositories.map((r) => resolve10(workspacePath, r.path).replace(/\\/g, "/"));
|
|
30695
30828
|
return { config: updatedConfig, hash, repos };
|
|
30696
30829
|
}
|
|
30697
30830
|
async function persistSyncState(workspacePath, pluginResults, workspaceFileResults, syncClients, nativePluginsByClient, nativeResult, extra) {
|
|
@@ -30725,9 +30858,9 @@ async function syncWorkspace(workspacePath = process.cwd(), options2 = {}) {
|
|
|
30725
30858
|
await migrateWorkspaceSkillsV1toV2(workspacePath);
|
|
30726
30859
|
const { offline = false, dryRun = false, workspaceSourceBase, skipAgentFiles = false } = options2;
|
|
30727
30860
|
const sw = new Stopwatch;
|
|
30728
|
-
const configDir =
|
|
30729
|
-
const configPath =
|
|
30730
|
-
if (!
|
|
30861
|
+
const configDir = join18(workspacePath, CONFIG_DIR);
|
|
30862
|
+
const configPath = join18(configDir, WORKSPACE_CONFIG_FILE);
|
|
30863
|
+
if (!existsSync16(configPath)) {
|
|
30731
30864
|
return failedSyncResult(`${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
|
|
30732
30865
|
Run 'allagents workspace init <path>' to create a new workspace`);
|
|
30733
30866
|
}
|
|
@@ -30816,8 +30949,8 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
30816
30949
|
const filesToCopy = [...config.workspace.files];
|
|
30817
30950
|
if (hasRepositories && sourcePath) {
|
|
30818
30951
|
for (const agentFile of AGENT_FILES) {
|
|
30819
|
-
const agentPath =
|
|
30820
|
-
if (
|
|
30952
|
+
const agentPath = join18(sourcePath, agentFile);
|
|
30953
|
+
if (existsSync16(agentPath) && !filesToCopy.includes(agentFile)) {
|
|
30821
30954
|
filesToCopy.push(agentFile);
|
|
30822
30955
|
}
|
|
30823
30956
|
}
|
|
@@ -30839,12 +30972,13 @@ ${errors2.map((e) => ` - ${e}`).join(`
|
|
|
30839
30972
|
${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
30840
30973
|
`)}`, { pluginResults, totalFailed: fileValidationErrors.length });
|
|
30841
30974
|
}
|
|
30842
|
-
|
|
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 });
|
|
30843
30977
|
if (hasRepositories && !dryRun && syncClients.includes("claude") && sourcePath) {
|
|
30844
|
-
const claudePath =
|
|
30845
|
-
const agentsPath =
|
|
30846
|
-
const claudeExistsInSource =
|
|
30847
|
-
if (!claudeExistsInSource &&
|
|
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)) {
|
|
30848
30982
|
await copyFile(agentsPath, claudePath);
|
|
30849
30983
|
}
|
|
30850
30984
|
}
|
|
@@ -30865,7 +30999,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
30865
30999
|
const mcpResults = {};
|
|
30866
31000
|
if (syncClients.includes("vscode")) {
|
|
30867
31001
|
const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "vscode");
|
|
30868
|
-
const projectMcpPath =
|
|
31002
|
+
const projectMcpPath = join18(workspacePath, ".vscode", "mcp.json");
|
|
30869
31003
|
const vscodeMcp = syncVscodeMcpConfig(validPlugins, {
|
|
30870
31004
|
dryRun,
|
|
30871
31005
|
force: false,
|
|
@@ -30879,7 +31013,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
30879
31013
|
}
|
|
30880
31014
|
if (syncClients.includes("claude")) {
|
|
30881
31015
|
const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "claude");
|
|
30882
|
-
const projectMcpJsonPath =
|
|
31016
|
+
const projectMcpJsonPath = join18(workspacePath, ".mcp.json");
|
|
30883
31017
|
const claudeMcp = syncClaudeMcpConfig(validPlugins, {
|
|
30884
31018
|
dryRun,
|
|
30885
31019
|
force: false,
|
|
@@ -30893,7 +31027,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
30893
31027
|
}
|
|
30894
31028
|
if (syncClients.includes("codex")) {
|
|
30895
31029
|
const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "codex");
|
|
30896
|
-
const projectCodexConfigPath =
|
|
31030
|
+
const projectCodexConfigPath = join18(workspacePath, ".codex", "config.toml");
|
|
30897
31031
|
const codexMcp = syncCodexProjectMcpConfig(validPlugins, {
|
|
30898
31032
|
dryRun,
|
|
30899
31033
|
force: false,
|
|
@@ -30907,7 +31041,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
30907
31041
|
}
|
|
30908
31042
|
if (syncClients.includes("copilot")) {
|
|
30909
31043
|
const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "copilot");
|
|
30910
|
-
const projectCopilotMcpPath =
|
|
31044
|
+
const projectCopilotMcpPath = join18(workspacePath, ".copilot", "mcp-config.json");
|
|
30911
31045
|
const copilotMcp = syncClaudeMcpConfig(validPlugins, {
|
|
30912
31046
|
dryRun,
|
|
30913
31047
|
force: false,
|
|
@@ -30977,7 +31111,7 @@ async function seedFetchCacheFromMarketplaces(results) {
|
|
|
30977
31111
|
}
|
|
30978
31112
|
function readGitBranch(repoPath) {
|
|
30979
31113
|
try {
|
|
30980
|
-
const head = readFileSync4(
|
|
31114
|
+
const head = readFileSync4(join18(repoPath, ".git", "HEAD"), "utf-8").trim();
|
|
30981
31115
|
const prefix = "ref: refs/heads/";
|
|
30982
31116
|
return head.startsWith(prefix) ? head.slice(prefix.length) : null;
|
|
30983
31117
|
} catch {
|
|
@@ -30987,7 +31121,7 @@ function readGitBranch(repoPath) {
|
|
|
30987
31121
|
async function syncUserWorkspace(options2 = {}) {
|
|
30988
31122
|
await migrateUserWorkspaceSkillsV1toV2();
|
|
30989
31123
|
const sw = new Stopwatch;
|
|
30990
|
-
const homeDir =
|
|
31124
|
+
const homeDir = resolve10(getHomeDir());
|
|
30991
31125
|
const config = await getUserWorkspaceConfig();
|
|
30992
31126
|
if (!config) {
|
|
30993
31127
|
return {
|
|
@@ -31125,6 +31259,7 @@ var init_sync = __esm(() => {
|
|
|
31125
31259
|
init_plugin();
|
|
31126
31260
|
init_transform();
|
|
31127
31261
|
init_workspace_repo();
|
|
31262
|
+
init_repo_skills();
|
|
31128
31263
|
init_client_mapping();
|
|
31129
31264
|
init_skill_name_resolver();
|
|
31130
31265
|
init_marketplace();
|
|
@@ -31141,11 +31276,11 @@ var init_sync = __esm(() => {
|
|
|
31141
31276
|
});
|
|
31142
31277
|
|
|
31143
31278
|
// src/core/github-fetch.ts
|
|
31144
|
-
import { existsSync as
|
|
31145
|
-
import { join as
|
|
31279
|
+
import { existsSync as existsSync17, readFileSync as readFileSync5 } from "node:fs";
|
|
31280
|
+
import { join as join19 } from "node:path";
|
|
31146
31281
|
function readFileFromClone(tempDir, filePath) {
|
|
31147
|
-
const fullPath =
|
|
31148
|
-
if (
|
|
31282
|
+
const fullPath = join19(tempDir, filePath);
|
|
31283
|
+
if (existsSync17(fullPath)) {
|
|
31149
31284
|
return readFileSync5(fullPath, "utf-8");
|
|
31150
31285
|
}
|
|
31151
31286
|
return null;
|
|
@@ -31244,15 +31379,15 @@ var init_github_fetch = __esm(() => {
|
|
|
31244
31379
|
});
|
|
31245
31380
|
|
|
31246
31381
|
// src/core/workspace.ts
|
|
31247
|
-
import { cp as cp2, mkdir as mkdir8, readFile as
|
|
31248
|
-
import { existsSync as
|
|
31249
|
-
import { join as
|
|
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";
|
|
31250
31385
|
import { fileURLToPath } from "node:url";
|
|
31251
31386
|
async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
31252
|
-
const absoluteTarget =
|
|
31253
|
-
const configDir =
|
|
31254
|
-
const configPath =
|
|
31255
|
-
if (
|
|
31387
|
+
const absoluteTarget = resolve11(targetPath);
|
|
31388
|
+
const configDir = join20(absoluteTarget, CONFIG_DIR);
|
|
31389
|
+
const configPath = join20(configDir, WORKSPACE_CONFIG_FILE);
|
|
31390
|
+
if (existsSync18(configPath)) {
|
|
31256
31391
|
if (options2.force) {
|
|
31257
31392
|
await unlink3(configPath);
|
|
31258
31393
|
} else {
|
|
@@ -31263,7 +31398,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
31263
31398
|
const currentFilePath = fileURLToPath(import.meta.url);
|
|
31264
31399
|
const currentFileDir = dirname11(currentFilePath);
|
|
31265
31400
|
const isProduction = currentFilePath.includes(`${sep2}dist${sep2}`);
|
|
31266
|
-
const defaultTemplatePath = isProduction ?
|
|
31401
|
+
const defaultTemplatePath = isProduction ? join20(currentFileDir, "templates", "default") : join20(currentFileDir, "..", "templates", "default");
|
|
31267
31402
|
let githubTempDir;
|
|
31268
31403
|
let parsedFromUrl;
|
|
31269
31404
|
let githubBasePath = "";
|
|
@@ -31271,6 +31406,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
31271
31406
|
try {
|
|
31272
31407
|
await mkdir8(absoluteTarget, { recursive: true });
|
|
31273
31408
|
await mkdir8(configDir, { recursive: true });
|
|
31409
|
+
await ensureConfigGitignore(absoluteTarget);
|
|
31274
31410
|
let workspaceYamlContent;
|
|
31275
31411
|
let sourceDir;
|
|
31276
31412
|
if (options2.from) {
|
|
@@ -31301,20 +31437,20 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
31301
31437
|
}
|
|
31302
31438
|
console.log(`✓ Using workspace.yaml from: ${options2.from}`);
|
|
31303
31439
|
} else {
|
|
31304
|
-
const fromPath =
|
|
31305
|
-
if (!
|
|
31440
|
+
const fromPath = resolve11(options2.from);
|
|
31441
|
+
if (!existsSync18(fromPath)) {
|
|
31306
31442
|
throw new Error(`Template not found: ${fromPath}`);
|
|
31307
31443
|
}
|
|
31308
31444
|
const { stat: stat2 } = await import("node:fs/promises");
|
|
31309
31445
|
const fromStat = await stat2(fromPath);
|
|
31310
31446
|
let sourceYamlPath;
|
|
31311
31447
|
if (fromStat.isDirectory()) {
|
|
31312
|
-
const nestedPath =
|
|
31313
|
-
const rootPath =
|
|
31314
|
-
if (
|
|
31448
|
+
const nestedPath = join20(fromPath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
31449
|
+
const rootPath = join20(fromPath, WORKSPACE_CONFIG_FILE);
|
|
31450
|
+
if (existsSync18(nestedPath)) {
|
|
31315
31451
|
sourceYamlPath = nestedPath;
|
|
31316
31452
|
sourceDir = fromPath;
|
|
31317
|
-
} else if (
|
|
31453
|
+
} else if (existsSync18(rootPath)) {
|
|
31318
31454
|
sourceYamlPath = rootPath;
|
|
31319
31455
|
sourceDir = fromPath;
|
|
31320
31456
|
} else {
|
|
@@ -31330,14 +31466,14 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
31330
31466
|
sourceDir = parentDir;
|
|
31331
31467
|
}
|
|
31332
31468
|
}
|
|
31333
|
-
workspaceYamlContent = await
|
|
31469
|
+
workspaceYamlContent = await readFile12(sourceYamlPath, "utf-8");
|
|
31334
31470
|
if (sourceDir) {
|
|
31335
31471
|
const parsed2 = load(workspaceYamlContent);
|
|
31336
31472
|
const workspace = parsed2?.workspace;
|
|
31337
31473
|
if (workspace?.source) {
|
|
31338
31474
|
const source = workspace.source;
|
|
31339
31475
|
if (!isGitHubUrl(source) && !isAbsolute4(source)) {
|
|
31340
|
-
workspace.source =
|
|
31476
|
+
workspace.source = resolve11(sourceDir, source);
|
|
31341
31477
|
workspaceYamlContent = dump(parsed2, { lineWidth: -1 });
|
|
31342
31478
|
}
|
|
31343
31479
|
}
|
|
@@ -31345,36 +31481,36 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
31345
31481
|
console.log(`✓ Using workspace.yaml from: ${sourceYamlPath}`);
|
|
31346
31482
|
}
|
|
31347
31483
|
} else {
|
|
31348
|
-
const defaultYamlPath =
|
|
31349
|
-
if (!
|
|
31484
|
+
const defaultYamlPath = join20(defaultTemplatePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
31485
|
+
if (!existsSync18(defaultYamlPath)) {
|
|
31350
31486
|
throw new Error(`Default template not found at: ${defaultTemplatePath}`);
|
|
31351
31487
|
}
|
|
31352
|
-
workspaceYamlContent = await
|
|
31488
|
+
workspaceYamlContent = await readFile12(defaultYamlPath, "utf-8");
|
|
31353
31489
|
}
|
|
31354
31490
|
if (options2.clients && options2.clients.length > 0) {
|
|
31355
31491
|
const configParsed = load(workspaceYamlContent);
|
|
31356
31492
|
configParsed.clients = options2.clients;
|
|
31357
31493
|
workspaceYamlContent = dump(configParsed, { lineWidth: -1 });
|
|
31358
31494
|
}
|
|
31359
|
-
await
|
|
31495
|
+
await writeFile8(configPath, workspaceYamlContent, "utf-8");
|
|
31360
31496
|
const parsed = load(workspaceYamlContent);
|
|
31361
31497
|
const clients = parsed?.clients ?? [];
|
|
31362
31498
|
const clientNames = getClientTypes(clients);
|
|
31363
31499
|
const VSCODE_TEMPLATE_FILE2 = "template.code-workspace";
|
|
31364
31500
|
if (clientNames.includes("vscode") && options2.from) {
|
|
31365
|
-
const targetTemplatePath =
|
|
31366
|
-
if (!
|
|
31501
|
+
const targetTemplatePath = join20(configDir, VSCODE_TEMPLATE_FILE2);
|
|
31502
|
+
if (!existsSync18(targetTemplatePath)) {
|
|
31367
31503
|
if (isGitHubUrl(options2.from) && githubTempDir) {
|
|
31368
31504
|
if (parsedFromUrl) {
|
|
31369
31505
|
const templatePath = githubBasePath ? `${githubBasePath}/${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}` : `${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}`;
|
|
31370
31506
|
const templateContent = readFileFromClone(githubTempDir, templatePath);
|
|
31371
31507
|
if (templateContent) {
|
|
31372
|
-
await
|
|
31508
|
+
await writeFile8(targetTemplatePath, templateContent, "utf-8");
|
|
31373
31509
|
}
|
|
31374
31510
|
}
|
|
31375
31511
|
} else if (sourceDir) {
|
|
31376
|
-
const sourceTemplatePath =
|
|
31377
|
-
if (
|
|
31512
|
+
const sourceTemplatePath = join20(sourceDir, CONFIG_DIR, VSCODE_TEMPLATE_FILE2);
|
|
31513
|
+
if (existsSync18(sourceTemplatePath)) {
|
|
31378
31514
|
await copyFile2(sourceTemplatePath, targetTemplatePath);
|
|
31379
31515
|
}
|
|
31380
31516
|
}
|
|
@@ -31387,15 +31523,15 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
31387
31523
|
if (options2.from && isGitHubUrl(options2.from) && githubTempDir) {
|
|
31388
31524
|
if (parsedFromUrl) {
|
|
31389
31525
|
for (const agentFile of AGENT_FILES) {
|
|
31390
|
-
const targetFilePath =
|
|
31391
|
-
if (
|
|
31526
|
+
const targetFilePath = join20(absoluteTarget, agentFile);
|
|
31527
|
+
if (existsSync18(targetFilePath)) {
|
|
31392
31528
|
copiedAgentFiles.push(agentFile);
|
|
31393
31529
|
continue;
|
|
31394
31530
|
}
|
|
31395
31531
|
const filePath = githubBasePath ? `${githubBasePath}/${agentFile}` : agentFile;
|
|
31396
31532
|
const content = readFileFromClone(githubTempDir, filePath);
|
|
31397
31533
|
if (content) {
|
|
31398
|
-
await
|
|
31534
|
+
await writeFile8(targetFilePath, content, "utf-8");
|
|
31399
31535
|
copiedAgentFiles.push(agentFile);
|
|
31400
31536
|
}
|
|
31401
31537
|
}
|
|
@@ -31403,30 +31539,30 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
31403
31539
|
} else {
|
|
31404
31540
|
const effectiveSourceDir = sourceDir ?? defaultTemplatePath;
|
|
31405
31541
|
for (const agentFile of AGENT_FILES) {
|
|
31406
|
-
const targetFilePath =
|
|
31407
|
-
if (
|
|
31542
|
+
const targetFilePath = join20(absoluteTarget, agentFile);
|
|
31543
|
+
if (existsSync18(targetFilePath)) {
|
|
31408
31544
|
copiedAgentFiles.push(agentFile);
|
|
31409
31545
|
continue;
|
|
31410
31546
|
}
|
|
31411
|
-
const sourcePath =
|
|
31412
|
-
if (
|
|
31413
|
-
const content = await
|
|
31414
|
-
await
|
|
31547
|
+
const sourcePath = join20(effectiveSourceDir, agentFile);
|
|
31548
|
+
if (existsSync18(sourcePath)) {
|
|
31549
|
+
const content = await readFile12(sourcePath, "utf-8");
|
|
31550
|
+
await writeFile8(targetFilePath, content, "utf-8");
|
|
31415
31551
|
copiedAgentFiles.push(agentFile);
|
|
31416
31552
|
}
|
|
31417
31553
|
}
|
|
31418
31554
|
}
|
|
31419
31555
|
if (copiedAgentFiles.length === 0) {
|
|
31420
|
-
await ensureWorkspaceRules(
|
|
31556
|
+
await ensureWorkspaceRules(join20(absoluteTarget, "AGENTS.md"), repositories);
|
|
31421
31557
|
copiedAgentFiles.push("AGENTS.md");
|
|
31422
31558
|
} else {
|
|
31423
31559
|
for (const agentFile of copiedAgentFiles) {
|
|
31424
|
-
await ensureWorkspaceRules(
|
|
31560
|
+
await ensureWorkspaceRules(join20(absoluteTarget, agentFile), repositories);
|
|
31425
31561
|
}
|
|
31426
31562
|
}
|
|
31427
31563
|
if (clientNames.includes("claude") && !copiedAgentFiles.includes("CLAUDE.md") && copiedAgentFiles.includes("AGENTS.md")) {
|
|
31428
|
-
const agentsPath =
|
|
31429
|
-
const claudePath =
|
|
31564
|
+
const agentsPath = join20(absoluteTarget, "AGENTS.md");
|
|
31565
|
+
const claudePath = join20(absoluteTarget, "CLAUDE.md");
|
|
31430
31566
|
await copyFile2(agentsPath, claudePath);
|
|
31431
31567
|
}
|
|
31432
31568
|
}
|
|
@@ -31452,7 +31588,7 @@ Syncing plugins...`);
|
|
|
31452
31588
|
if (targetPath !== ".") {
|
|
31453
31589
|
console.log(`
|
|
31454
31590
|
Next steps:`);
|
|
31455
|
-
console.log(` cd ${
|
|
31591
|
+
console.log(` cd ${relative6(process.cwd(), absoluteTarget)}`);
|
|
31456
31592
|
}
|
|
31457
31593
|
return {
|
|
31458
31594
|
path: absoluteTarget,
|
|
@@ -31471,14 +31607,14 @@ Next steps:`);
|
|
|
31471
31607
|
async function seedCacheFromClone(tempDir, owner, repo, branch) {
|
|
31472
31608
|
const cachePaths = [
|
|
31473
31609
|
getPluginCachePath(owner, repo, branch),
|
|
31474
|
-
|
|
31610
|
+
join20(getMarketplacesDir(), repo)
|
|
31475
31611
|
];
|
|
31476
31612
|
for (const cachePath of cachePaths) {
|
|
31477
|
-
if (
|
|
31613
|
+
if (existsSync18(cachePath))
|
|
31478
31614
|
continue;
|
|
31479
31615
|
try {
|
|
31480
31616
|
const parentDir = dirname11(cachePath);
|
|
31481
|
-
if (!
|
|
31617
|
+
if (!existsSync18(parentDir)) {
|
|
31482
31618
|
await mkdir8(parentDir, { recursive: true });
|
|
31483
31619
|
}
|
|
31484
31620
|
await cp2(tempDir, cachePath, { recursive: true });
|
|
@@ -31495,14 +31631,15 @@ var init_workspace = __esm(() => {
|
|
|
31495
31631
|
init_github_fetch();
|
|
31496
31632
|
init_git();
|
|
31497
31633
|
init_marketplace();
|
|
31634
|
+
init_config_gitignore();
|
|
31498
31635
|
});
|
|
31499
31636
|
|
|
31500
31637
|
// src/core/status.ts
|
|
31501
|
-
import { existsSync as
|
|
31502
|
-
import { join as
|
|
31638
|
+
import { existsSync as existsSync19 } from "node:fs";
|
|
31639
|
+
import { join as join21 } from "node:path";
|
|
31503
31640
|
async function getWorkspaceStatus(workspacePath = process.cwd()) {
|
|
31504
|
-
const configPath =
|
|
31505
|
-
if (!
|
|
31641
|
+
const configPath = join21(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
31642
|
+
if (!existsSync19(configPath) || isUserConfigPath(workspacePath)) {
|
|
31506
31643
|
const userPlugins = await getUserPluginStatuses();
|
|
31507
31644
|
return {
|
|
31508
31645
|
success: true,
|
|
@@ -31544,7 +31681,7 @@ async function getWorkspaceStatus(workspacePath = process.cwd()) {
|
|
|
31544
31681
|
function getPluginStatus(parsed) {
|
|
31545
31682
|
if (parsed.type === "github") {
|
|
31546
31683
|
const cachePath = parsed.owner && parsed.repo ? getPluginCachePath(parsed.owner, parsed.repo) : "";
|
|
31547
|
-
const available2 = cachePath ?
|
|
31684
|
+
const available2 = cachePath ? existsSync19(cachePath) : false;
|
|
31548
31685
|
return {
|
|
31549
31686
|
source: parsed.original,
|
|
31550
31687
|
type: "github",
|
|
@@ -31554,7 +31691,7 @@ function getPluginStatus(parsed) {
|
|
|
31554
31691
|
...parsed.repo && { repo: parsed.repo }
|
|
31555
31692
|
};
|
|
31556
31693
|
}
|
|
31557
|
-
const available =
|
|
31694
|
+
const available = existsSync19(parsed.normalized);
|
|
31558
31695
|
return {
|
|
31559
31696
|
source: parsed.original,
|
|
31560
31697
|
type: "local",
|
|
@@ -33691,9 +33828,9 @@ var init_prompt_clients = __esm(() => {
|
|
|
33691
33828
|
});
|
|
33692
33829
|
|
|
33693
33830
|
// src/core/skills.ts
|
|
33694
|
-
import { existsSync as
|
|
33695
|
-
import { readFile as
|
|
33696
|
-
import { join as
|
|
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";
|
|
33697
33834
|
async function resolvePluginPath(pluginSource, workspacePath) {
|
|
33698
33835
|
if (isPluginSpec(pluginSource)) {
|
|
33699
33836
|
const resolved2 = await resolvePluginSpecWithAutoRegister(pluginSource, {
|
|
@@ -33714,18 +33851,18 @@ async function resolvePluginPath(pluginSource, workspacePath) {
|
|
|
33714
33851
|
});
|
|
33715
33852
|
if (!result.success)
|
|
33716
33853
|
return null;
|
|
33717
|
-
const path = parsed?.subpath ?
|
|
33854
|
+
const path = parsed?.subpath ? join24(result.cachePath, parsed.subpath) : result.cachePath;
|
|
33718
33855
|
return { path };
|
|
33719
33856
|
}
|
|
33720
|
-
const resolved =
|
|
33721
|
-
return
|
|
33857
|
+
const resolved = resolve13(workspacePath, pluginSource);
|
|
33858
|
+
return existsSync22(resolved) ? { path: resolved } : null;
|
|
33722
33859
|
}
|
|
33723
33860
|
async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
|
|
33724
|
-
const configPath =
|
|
33725
|
-
if (!
|
|
33861
|
+
const configPath = join24(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
33862
|
+
if (!existsSync22(configPath)) {
|
|
33726
33863
|
return [];
|
|
33727
33864
|
}
|
|
33728
|
-
const content = await
|
|
33865
|
+
const content = await readFile14(configPath, "utf-8");
|
|
33729
33866
|
const config = load(content);
|
|
33730
33867
|
const isV1Fallback = config.version === undefined || config.version < 2;
|
|
33731
33868
|
const disabledSkills = isV1Fallback ? new Set(config.disabledSkills ?? []) : new Set;
|
|
@@ -33738,30 +33875,30 @@ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
|
|
|
33738
33875
|
continue;
|
|
33739
33876
|
const pluginPath = resolved.path;
|
|
33740
33877
|
const pluginName = resolved.pluginName ?? getPluginName(pluginPath);
|
|
33741
|
-
const skillsDir =
|
|
33878
|
+
const skillsDir = join24(pluginPath, "skills");
|
|
33742
33879
|
const pluginSkillsConfig = typeof pluginEntry === "string" ? undefined : pluginEntry.skills;
|
|
33743
33880
|
const hasEnabledEntries = !pluginSkillsConfig && enabledSkills && [...enabledSkills].some((s) => s.startsWith(`${pluginName}`));
|
|
33744
33881
|
let skillEntries;
|
|
33745
|
-
if (
|
|
33746
|
-
const entries = await
|
|
33747
|
-
skillEntries = entries.filter((e) => e.isDirectory()).map((e) => ({ name: e.name, skillPath:
|
|
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) }));
|
|
33748
33885
|
} else {
|
|
33749
|
-
const entries = await
|
|
33886
|
+
const entries = await readdir5(pluginPath, { withFileTypes: true });
|
|
33750
33887
|
const flatSkills = [];
|
|
33751
33888
|
for (const entry of entries) {
|
|
33752
33889
|
if (!entry.isDirectory())
|
|
33753
33890
|
continue;
|
|
33754
|
-
const skillMdPath =
|
|
33755
|
-
if (
|
|
33756
|
-
flatSkills.push({ name: entry.name, skillPath:
|
|
33891
|
+
const skillMdPath = join24(pluginPath, entry.name, "SKILL.md");
|
|
33892
|
+
if (existsSync22(skillMdPath)) {
|
|
33893
|
+
flatSkills.push({ name: entry.name, skillPath: join24(pluginPath, entry.name) });
|
|
33757
33894
|
}
|
|
33758
33895
|
}
|
|
33759
33896
|
if (flatSkills.length > 0) {
|
|
33760
33897
|
skillEntries = flatSkills;
|
|
33761
33898
|
} else {
|
|
33762
|
-
const rootSkillMd =
|
|
33763
|
-
if (
|
|
33764
|
-
const skillContent = await
|
|
33899
|
+
const rootSkillMd = join24(pluginPath, "SKILL.md");
|
|
33900
|
+
if (existsSync22(rootSkillMd)) {
|
|
33901
|
+
const skillContent = await readFile14(rootSkillMd, "utf-8");
|
|
33765
33902
|
const metadata = parseSkillMetadata(skillContent);
|
|
33766
33903
|
const skillName = metadata?.name ?? basename6(pluginPath);
|
|
33767
33904
|
skillEntries = [{ name: skillName, skillPath: pluginPath }];
|
|
@@ -33802,28 +33939,28 @@ async function findSkillByName(skillName, workspacePath = process.cwd()) {
|
|
|
33802
33939
|
return allSkills.filter((s) => s.name === skillName);
|
|
33803
33940
|
}
|
|
33804
33941
|
async function discoverSkillNames(pluginPath) {
|
|
33805
|
-
if (!
|
|
33942
|
+
if (!existsSync22(pluginPath))
|
|
33806
33943
|
return [];
|
|
33807
|
-
const skillsDir =
|
|
33808
|
-
if (
|
|
33809
|
-
const entries2 = await
|
|
33944
|
+
const skillsDir = join24(pluginPath, "skills");
|
|
33945
|
+
if (existsSync22(skillsDir)) {
|
|
33946
|
+
const entries2 = await readdir5(skillsDir, { withFileTypes: true });
|
|
33810
33947
|
return entries2.filter((e) => e.isDirectory()).map((e) => e.name);
|
|
33811
33948
|
}
|
|
33812
|
-
const entries = await
|
|
33949
|
+
const entries = await readdir5(pluginPath, { withFileTypes: true });
|
|
33813
33950
|
const flatSkills = [];
|
|
33814
33951
|
for (const entry of entries) {
|
|
33815
33952
|
if (!entry.isDirectory())
|
|
33816
33953
|
continue;
|
|
33817
|
-
if (
|
|
33954
|
+
if (existsSync22(join24(pluginPath, entry.name, "SKILL.md"))) {
|
|
33818
33955
|
flatSkills.push(entry.name);
|
|
33819
33956
|
}
|
|
33820
33957
|
}
|
|
33821
33958
|
if (flatSkills.length > 0)
|
|
33822
33959
|
return flatSkills;
|
|
33823
|
-
const rootSkillMd =
|
|
33824
|
-
if (
|
|
33960
|
+
const rootSkillMd = join24(pluginPath, "SKILL.md");
|
|
33961
|
+
if (existsSync22(rootSkillMd)) {
|
|
33825
33962
|
try {
|
|
33826
|
-
const content = await
|
|
33963
|
+
const content = await readFile14(rootSkillMd, "utf-8");
|
|
33827
33964
|
const { parseSkillMetadata: parseSkillMetadata2 } = await Promise.resolve().then(() => (init_skill(), exports_skill));
|
|
33828
33965
|
const metadata = parseSkillMetadata2(content);
|
|
33829
33966
|
return [metadata?.name ?? basename6(pluginPath)];
|
|
@@ -33932,12 +34069,12 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
33932
34069
|
if (typeof Promise !== "function") {
|
|
33933
34070
|
throw new TypeError("callback not provided");
|
|
33934
34071
|
}
|
|
33935
|
-
return new Promise(function(
|
|
34072
|
+
return new Promise(function(resolve14, reject) {
|
|
33936
34073
|
isexe(path, options2 || {}, function(er, is) {
|
|
33937
34074
|
if (er) {
|
|
33938
34075
|
reject(er);
|
|
33939
34076
|
} else {
|
|
33940
|
-
|
|
34077
|
+
resolve14(is);
|
|
33941
34078
|
}
|
|
33942
34079
|
});
|
|
33943
34080
|
});
|
|
@@ -33999,27 +34136,27 @@ var require_which = __commonJS((exports, module) => {
|
|
|
33999
34136
|
opt = {};
|
|
34000
34137
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
34001
34138
|
const found = [];
|
|
34002
|
-
const step = (i2) => new Promise((
|
|
34139
|
+
const step = (i2) => new Promise((resolve14, reject) => {
|
|
34003
34140
|
if (i2 === pathEnv.length)
|
|
34004
|
-
return opt.all && found.length ?
|
|
34141
|
+
return opt.all && found.length ? resolve14(found) : reject(getNotFoundError(cmd));
|
|
34005
34142
|
const ppRaw = pathEnv[i2];
|
|
34006
34143
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
34007
34144
|
const pCmd = path.join(pathPart, cmd);
|
|
34008
34145
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
34009
|
-
|
|
34146
|
+
resolve14(subStep(p, i2, 0));
|
|
34010
34147
|
});
|
|
34011
|
-
const subStep = (p, i2, ii) => new Promise((
|
|
34148
|
+
const subStep = (p, i2, ii) => new Promise((resolve14, reject) => {
|
|
34012
34149
|
if (ii === pathExt.length)
|
|
34013
|
-
return
|
|
34150
|
+
return resolve14(step(i2 + 1));
|
|
34014
34151
|
const ext = pathExt[ii];
|
|
34015
34152
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
34016
34153
|
if (!er && is) {
|
|
34017
34154
|
if (opt.all)
|
|
34018
34155
|
found.push(p + ext);
|
|
34019
34156
|
else
|
|
34020
|
-
return
|
|
34157
|
+
return resolve14(p + ext);
|
|
34021
34158
|
}
|
|
34022
|
-
return
|
|
34159
|
+
return resolve14(subStep(p, i2, ii + 1));
|
|
34023
34160
|
});
|
|
34024
34161
|
});
|
|
34025
34162
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -34341,7 +34478,7 @@ var package_default;
|
|
|
34341
34478
|
var init_package = __esm(() => {
|
|
34342
34479
|
package_default = {
|
|
34343
34480
|
name: "allagents",
|
|
34344
|
-
version: "1.
|
|
34481
|
+
version: "1.6.0",
|
|
34345
34482
|
description: "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
|
|
34346
34483
|
type: "module",
|
|
34347
34484
|
bin: {
|
|
@@ -34421,13 +34558,13 @@ var init_package = __esm(() => {
|
|
|
34421
34558
|
});
|
|
34422
34559
|
|
|
34423
34560
|
// src/cli/update-check.ts
|
|
34424
|
-
import { readFile as
|
|
34425
|
-
import { join as
|
|
34561
|
+
import { readFile as readFile17 } from "node:fs/promises";
|
|
34562
|
+
import { join as join27 } from "node:path";
|
|
34426
34563
|
import { spawn as spawn3 } from "node:child_process";
|
|
34427
34564
|
async function getCachedUpdateInfo(path3) {
|
|
34428
|
-
const filePath = path3 ??
|
|
34565
|
+
const filePath = path3 ?? join27(getHomeDir(), CONFIG_DIR, CACHE_FILE);
|
|
34429
34566
|
try {
|
|
34430
|
-
const raw = await
|
|
34567
|
+
const raw = await readFile17(filePath, "utf-8");
|
|
34431
34568
|
const data = JSON.parse(raw);
|
|
34432
34569
|
if (typeof data.latestVersion === "string" && typeof data.lastCheckedAt === "string") {
|
|
34433
34570
|
return data;
|
|
@@ -34463,8 +34600,8 @@ function buildNotice(currentVersion, latestVersion) {
|
|
|
34463
34600
|
Run \`allagents self update\` to upgrade.`);
|
|
34464
34601
|
}
|
|
34465
34602
|
function backgroundUpdateCheck() {
|
|
34466
|
-
const dir =
|
|
34467
|
-
const filePath =
|
|
34603
|
+
const dir = join27(getHomeDir(), CONFIG_DIR);
|
|
34604
|
+
const filePath = join27(dir, CACHE_FILE);
|
|
34468
34605
|
const script = `
|
|
34469
34606
|
const https = require('https');
|
|
34470
34607
|
const fs = require('fs');
|
|
@@ -34551,15 +34688,15 @@ class TuiCache {
|
|
|
34551
34688
|
}
|
|
34552
34689
|
|
|
34553
34690
|
// src/cli/tui/context.ts
|
|
34554
|
-
import { existsSync as
|
|
34555
|
-
import { join as
|
|
34691
|
+
import { existsSync as existsSync25 } from "node:fs";
|
|
34692
|
+
import { join as join28 } from "node:path";
|
|
34556
34693
|
async function getTuiContext(cwd = process.cwd(), cache2) {
|
|
34557
34694
|
const cachedContext = cache2?.getContext();
|
|
34558
34695
|
if (cachedContext) {
|
|
34559
34696
|
return cachedContext;
|
|
34560
34697
|
}
|
|
34561
|
-
const configPath =
|
|
34562
|
-
const hasWorkspace =
|
|
34698
|
+
const configPath = join28(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
34699
|
+
const hasWorkspace = existsSync25(configPath) && !isUserConfigPath(cwd);
|
|
34563
34700
|
let projectPluginCount = 0;
|
|
34564
34701
|
if (hasWorkspace) {
|
|
34565
34702
|
try {
|
|
@@ -35810,7 +35947,7 @@ __export(exports_wizard, {
|
|
|
35810
35947
|
runWizard: () => runWizard,
|
|
35811
35948
|
buildMenuOptions: () => buildMenuOptions
|
|
35812
35949
|
});
|
|
35813
|
-
import { relative as
|
|
35950
|
+
import { relative as relative7 } from "node:path";
|
|
35814
35951
|
function buildMenuOptions(context) {
|
|
35815
35952
|
const options2 = [];
|
|
35816
35953
|
if (context.needsSync) {
|
|
@@ -35839,7 +35976,7 @@ function buildCompactSummary(context) {
|
|
|
35839
35976
|
function buildSummary(context) {
|
|
35840
35977
|
const lines = [];
|
|
35841
35978
|
if (context.hasWorkspace && context.workspacePath) {
|
|
35842
|
-
const relPath =
|
|
35979
|
+
const relPath = relative7(process.cwd(), context.workspacePath) || ".";
|
|
35843
35980
|
lines.push(`Workspace: ${relPath}`);
|
|
35844
35981
|
lines.push(`Project plugins: ${context.projectPluginCount}`);
|
|
35845
35982
|
} else {
|
|
@@ -35975,8 +36112,8 @@ init_workspace();
|
|
|
35975
36112
|
init_sync();
|
|
35976
36113
|
init_status2();
|
|
35977
36114
|
var import_cmd_ts2 = __toESM(require_cjs(), 1);
|
|
35978
|
-
import { existsSync as
|
|
35979
|
-
import { join as
|
|
36115
|
+
import { existsSync as existsSync21 } from "node:fs";
|
|
36116
|
+
import { join as join23, resolve as resolve12 } from "node:path";
|
|
35980
36117
|
|
|
35981
36118
|
// src/core/prune.ts
|
|
35982
36119
|
init_js_yaml();
|
|
@@ -35984,9 +36121,9 @@ init_constants();
|
|
|
35984
36121
|
init_marketplace();
|
|
35985
36122
|
init_user_workspace();
|
|
35986
36123
|
init_workspace_config();
|
|
35987
|
-
import { readFile as
|
|
35988
|
-
import { existsSync as
|
|
35989
|
-
import { join as
|
|
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";
|
|
35990
36127
|
async function isOrphanedPlugin(pluginSpec) {
|
|
35991
36128
|
if (!isPluginSpec(pluginSpec))
|
|
35992
36129
|
return false;
|
|
@@ -36013,14 +36150,14 @@ async function prunePlugins(plugins) {
|
|
|
36013
36150
|
}
|
|
36014
36151
|
async function pruneOrphanedPlugins(workspacePath) {
|
|
36015
36152
|
let projectResult = { removed: [], kept: [], keptEntries: [] };
|
|
36016
|
-
const projectConfigPath =
|
|
36017
|
-
if (
|
|
36018
|
-
const content = await
|
|
36153
|
+
const projectConfigPath = join22(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
36154
|
+
if (existsSync20(projectConfigPath) && !isUserConfigPath(workspacePath)) {
|
|
36155
|
+
const content = await readFile13(projectConfigPath, "utf-8");
|
|
36019
36156
|
const config = load(content);
|
|
36020
36157
|
projectResult = await prunePlugins(config.plugins);
|
|
36021
36158
|
if (projectResult.removed.length > 0) {
|
|
36022
36159
|
config.plugins = projectResult.keptEntries;
|
|
36023
|
-
await
|
|
36160
|
+
await writeFile9(projectConfigPath, dump(config, { lineWidth: -1 }), "utf-8");
|
|
36024
36161
|
}
|
|
36025
36162
|
}
|
|
36026
36163
|
let userResult = { removed: [], kept: [], keptEntries: [] };
|
|
@@ -36030,7 +36167,7 @@ async function pruneOrphanedPlugins(workspacePath) {
|
|
|
36030
36167
|
if (userResult.removed.length > 0) {
|
|
36031
36168
|
userConfig.plugins = userResult.keptEntries;
|
|
36032
36169
|
const userConfigPath = getUserWorkspaceConfigPath();
|
|
36033
|
-
await
|
|
36170
|
+
await writeFile9(userConfigPath, dump(userConfig, { lineWidth: -1 }), "utf-8");
|
|
36034
36171
|
}
|
|
36035
36172
|
}
|
|
36036
36173
|
return {
|
|
@@ -36092,14 +36229,14 @@ var initMeta = {
|
|
|
36092
36229
|
}
|
|
36093
36230
|
};
|
|
36094
36231
|
var syncMeta = {
|
|
36095
|
-
command: "
|
|
36096
|
-
description: "
|
|
36232
|
+
command: "update",
|
|
36233
|
+
description: "Update plugins in workspace",
|
|
36097
36234
|
whenToUse: "After modifying workspace.yaml or pulling shared config changes",
|
|
36098
36235
|
examples: [
|
|
36099
|
-
"allagents
|
|
36100
|
-
"allagents
|
|
36101
|
-
"allagents
|
|
36102
|
-
"allagents
|
|
36236
|
+
"allagents update",
|
|
36237
|
+
"allagents update --dry-run",
|
|
36238
|
+
"allagents update --offline",
|
|
36239
|
+
"allagents update --verbose"
|
|
36103
36240
|
],
|
|
36104
36241
|
expectedOutput: "Lists synced files with status per plugin. Exit 0 on success, exit 1 if any files failed.",
|
|
36105
36242
|
options: [
|
|
@@ -36290,8 +36427,8 @@ Plugin sync results:`);
|
|
|
36290
36427
|
}
|
|
36291
36428
|
});
|
|
36292
36429
|
var syncCmd = import_cmd_ts2.command({
|
|
36293
|
-
name: "
|
|
36294
|
-
aliases: ["
|
|
36430
|
+
name: "update",
|
|
36431
|
+
aliases: ["sync"],
|
|
36295
36432
|
description: buildDescription(syncMeta),
|
|
36296
36433
|
args: {
|
|
36297
36434
|
offline: import_cmd_ts2.flag({ long: "offline", description: "Use cached plugins without fetching latest from remote" }),
|
|
@@ -36306,8 +36443,8 @@ var syncCmd = import_cmd_ts2.command({
|
|
|
36306
36443
|
`);
|
|
36307
36444
|
}
|
|
36308
36445
|
const userConfigExists = !!await getUserWorkspaceConfig();
|
|
36309
|
-
const projectConfigPath =
|
|
36310
|
-
const projectConfigExists =
|
|
36446
|
+
const projectConfigPath = join23(process.cwd(), ".allagents", "workspace.yaml");
|
|
36447
|
+
const projectConfigExists = existsSync21(projectConfigPath);
|
|
36311
36448
|
if (!userConfigExists && !projectConfigExists) {
|
|
36312
36449
|
await ensureUserWorkspace();
|
|
36313
36450
|
if (isJsonMode()) {
|
|
@@ -36595,7 +36732,7 @@ var repoAddCmd = import_cmd_ts2.command({
|
|
|
36595
36732
|
},
|
|
36596
36733
|
handler: async ({ path: repoPath, description }) => {
|
|
36597
36734
|
try {
|
|
36598
|
-
const resolvedPath =
|
|
36735
|
+
const resolvedPath = resolve12(process.cwd(), repoPath);
|
|
36599
36736
|
const remote = await detectRemote(resolvedPath);
|
|
36600
36737
|
const result = await addRepository(repoPath, {
|
|
36601
36738
|
source: remote?.source,
|
|
@@ -36975,9 +37112,9 @@ init_workspace_modify();
|
|
|
36975
37112
|
init_user_workspace();
|
|
36976
37113
|
init_skills();
|
|
36977
37114
|
var import_cmd_ts3 = __toESM(require_cjs(), 1);
|
|
36978
|
-
import { existsSync as
|
|
36979
|
-
import { readFile as
|
|
36980
|
-
import { join as
|
|
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";
|
|
36981
37118
|
|
|
36982
37119
|
// src/cli/metadata/plugin-skills.ts
|
|
36983
37120
|
var skillsListMeta = {
|
|
@@ -37068,7 +37205,7 @@ init_skill();
|
|
|
37068
37205
|
init_marketplace();
|
|
37069
37206
|
init_marketplace_manifest_parser();
|
|
37070
37207
|
function hasProjectConfig(dir) {
|
|
37071
|
-
return
|
|
37208
|
+
return existsSync23(join25(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
|
|
37072
37209
|
}
|
|
37073
37210
|
function resolveScope(cwd) {
|
|
37074
37211
|
if (isUserConfigPath(cwd))
|
|
@@ -37099,7 +37236,7 @@ async function resolveSkillNameFromRepo(url, parsed, fallbackName, fetchFn = fet
|
|
|
37099
37236
|
if (!fetchResult.success)
|
|
37100
37237
|
return fallbackName;
|
|
37101
37238
|
try {
|
|
37102
|
-
const skillMd = await
|
|
37239
|
+
const skillMd = await readFile15(join25(fetchResult.cachePath, "SKILL.md"), "utf-8");
|
|
37103
37240
|
const metadata = parseSkillMetadata(skillMd);
|
|
37104
37241
|
return metadata?.name ?? fallbackName;
|
|
37105
37242
|
} catch {
|
|
@@ -37656,9 +37793,9 @@ init_format_sync();
|
|
|
37656
37793
|
init_workspace_config();
|
|
37657
37794
|
init_constants();
|
|
37658
37795
|
init_js_yaml();
|
|
37659
|
-
import { readFile as
|
|
37660
|
-
import { existsSync as
|
|
37661
|
-
import { join as
|
|
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";
|
|
37662
37799
|
async function runSyncAndPrint(options2) {
|
|
37663
37800
|
if (!isJsonMode()) {
|
|
37664
37801
|
console.log(`
|
|
@@ -37903,7 +38040,7 @@ var marketplaceAddCmd = import_cmd_ts4.command({
|
|
|
37903
38040
|
process.exit(1);
|
|
37904
38041
|
}
|
|
37905
38042
|
if (effectiveScope === "project") {
|
|
37906
|
-
if (!
|
|
38043
|
+
if (!existsSync24(join26(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE))) {
|
|
37907
38044
|
const msg = 'No workspace found in current directory. Run "allagents workspace init" first.';
|
|
37908
38045
|
if (isJsonMode()) {
|
|
37909
38046
|
jsonOutput({ success: false, command: "plugin marketplace add", error: msg });
|
|
@@ -38210,10 +38347,10 @@ var pluginListCmd = import_cmd_ts4.command({
|
|
|
38210
38347
|
};
|
|
38211
38348
|
const pluginClients = new Map;
|
|
38212
38349
|
async function loadConfigClients(configPath, scope) {
|
|
38213
|
-
if (!
|
|
38350
|
+
if (!existsSync24(configPath))
|
|
38214
38351
|
return;
|
|
38215
38352
|
try {
|
|
38216
|
-
const content = await
|
|
38353
|
+
const content = await readFile16(configPath, "utf-8");
|
|
38217
38354
|
const config = load(content);
|
|
38218
38355
|
if (!config?.plugins || !config?.clients)
|
|
38219
38356
|
return;
|
|
@@ -38225,8 +38362,8 @@ var pluginListCmd = import_cmd_ts4.command({
|
|
|
38225
38362
|
}
|
|
38226
38363
|
} catch {}
|
|
38227
38364
|
}
|
|
38228
|
-
const userConfigPath =
|
|
38229
|
-
const projectConfigPath =
|
|
38365
|
+
const userConfigPath = join26(getAllagentsDir(), WORKSPACE_CONFIG_FILE);
|
|
38366
|
+
const projectConfigPath = join26(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
38230
38367
|
const cwdIsHome = isUserConfigPath(process.cwd());
|
|
38231
38368
|
await loadConfigClients(userConfigPath, "user");
|
|
38232
38369
|
if (!cwdIsHome) {
|
|
@@ -38368,7 +38505,7 @@ var pluginInstallCmd = import_cmd_ts4.command({
|
|
|
38368
38505
|
const isUser = scope === "user" || !scope && isUserConfigPath(process.cwd());
|
|
38369
38506
|
if (isUser) {
|
|
38370
38507
|
const userConfigPath = getUserWorkspaceConfigPath();
|
|
38371
|
-
if (!
|
|
38508
|
+
if (!existsSync24(userConfigPath)) {
|
|
38372
38509
|
const { promptForClients: promptForClients2 } = await Promise.resolve().then(() => (init_prompt_clients(), exports_prompt_clients));
|
|
38373
38510
|
const clients = await promptForClients2();
|
|
38374
38511
|
if (clients === null) {
|
|
@@ -38380,8 +38517,8 @@ var pluginInstallCmd = import_cmd_ts4.command({
|
|
|
38380
38517
|
await ensureUserWorkspace(clients);
|
|
38381
38518
|
}
|
|
38382
38519
|
} else {
|
|
38383
|
-
const configPath =
|
|
38384
|
-
if (!
|
|
38520
|
+
const configPath = join26(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
38521
|
+
if (!existsSync24(configPath)) {
|
|
38385
38522
|
const { promptForClients: promptForClients2 } = await Promise.resolve().then(() => (init_prompt_clients(), exports_prompt_clients));
|
|
38386
38523
|
const clients = await promptForClients2();
|
|
38387
38524
|
if (clients === null) {
|
|
@@ -38658,14 +38795,14 @@ var pluginUpdateCmd = import_cmd_ts4.command({
|
|
|
38658
38795
|
}
|
|
38659
38796
|
}
|
|
38660
38797
|
if (updateProject && !isUserConfigPath(process.cwd())) {
|
|
38661
|
-
const { existsSync:
|
|
38662
|
-
const { readFile:
|
|
38663
|
-
const { join:
|
|
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");
|
|
38664
38801
|
const { load: load2 } = await Promise.resolve().then(() => (init_js_yaml(), exports_js_yaml));
|
|
38665
38802
|
const { CONFIG_DIR: CONFIG_DIR2, WORKSPACE_CONFIG_FILE: WORKSPACE_CONFIG_FILE2 } = await Promise.resolve().then(() => (init_constants(), exports_constants));
|
|
38666
|
-
const configPath =
|
|
38667
|
-
if (
|
|
38668
|
-
const content = await
|
|
38803
|
+
const configPath = join27(process.cwd(), CONFIG_DIR2, WORKSPACE_CONFIG_FILE2);
|
|
38804
|
+
if (existsSync25(configPath)) {
|
|
38805
|
+
const content = await readFile17(configPath, "utf-8");
|
|
38669
38806
|
const config = load2(content);
|
|
38670
38807
|
for (const entry of config.plugins ?? []) {
|
|
38671
38808
|
const p = getPluginSource(entry);
|
|
@@ -39697,7 +39834,7 @@ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise
|
|
|
39697
39834
|
return spawnedPromise;
|
|
39698
39835
|
}
|
|
39699
39836
|
let timeoutId;
|
|
39700
|
-
const timeoutPromise = new Promise((
|
|
39837
|
+
const timeoutPromise = new Promise((resolve14, reject) => {
|
|
39701
39838
|
timeoutId = setTimeout(() => {
|
|
39702
39839
|
timeoutKill(spawned, killSignal, reject);
|
|
39703
39840
|
}, timeout);
|
|
@@ -40061,9 +40198,9 @@ var mergePromise = (spawned, promise) => {
|
|
|
40061
40198
|
Reflect.defineProperty(spawned, property, { ...descriptor, value });
|
|
40062
40199
|
}
|
|
40063
40200
|
};
|
|
40064
|
-
var getSpawnedPromise = (spawned) => new Promise((
|
|
40201
|
+
var getSpawnedPromise = (spawned) => new Promise((resolve14, reject) => {
|
|
40065
40202
|
spawned.on("exit", (exitCode, signal) => {
|
|
40066
|
-
|
|
40203
|
+
resolve14({ exitCode, signal });
|
|
40067
40204
|
});
|
|
40068
40205
|
spawned.on("error", (error) => {
|
|
40069
40206
|
reject(error);
|
|
@@ -40581,6 +40718,7 @@ var app = conciseSubcommands({
|
|
|
40581
40718
|
` + "For AI agents: use --agent-help for machine-readable help, or --json for structured output",
|
|
40582
40719
|
version: package_default.version,
|
|
40583
40720
|
cmds: {
|
|
40721
|
+
update: syncCmd,
|
|
40584
40722
|
workspace: workspaceCmd,
|
|
40585
40723
|
plugin: pluginCmd,
|
|
40586
40724
|
self: selfCmd,
|