allagents 1.2.0 → 1.3.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/dist/index.js +129 -81
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29246,7 +29246,8 @@ var init_codex_mcp = __esm(() => {
|
|
|
29246
29246
|
});
|
|
29247
29247
|
|
|
29248
29248
|
// src/core/claude-mcp.ts
|
|
29249
|
-
import { existsSync as existsSync13, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "node:fs";
|
|
29249
|
+
import { existsSync as existsSync13, readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "node:fs";
|
|
29250
|
+
import { dirname as dirname9 } from "node:path";
|
|
29250
29251
|
function deepEqual2(a, b) {
|
|
29251
29252
|
if (a === b)
|
|
29252
29253
|
return true;
|
|
@@ -29363,6 +29364,10 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
|
|
|
29363
29364
|
const hasChanges = result.added > 0 || result.overwritten > 0 || result.removed > 0;
|
|
29364
29365
|
if (hasChanges && !dryRun) {
|
|
29365
29366
|
existingConfig.mcpServers = existingServers;
|
|
29367
|
+
const dir = dirname9(configPath);
|
|
29368
|
+
if (!existsSync13(dir)) {
|
|
29369
|
+
mkdirSync3(dir, { recursive: true });
|
|
29370
|
+
}
|
|
29366
29371
|
writeFileSync3(configPath, `${JSON.stringify(existingConfig, null, 2)}
|
|
29367
29372
|
`, "utf-8");
|
|
29368
29373
|
result.configPath = configPath;
|
|
@@ -29377,6 +29382,10 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
|
|
|
29377
29382
|
}
|
|
29378
29383
|
if (result.removed > 0 && !dryRun) {
|
|
29379
29384
|
existingConfig.mcpServers = existingServers;
|
|
29385
|
+
const dir = dirname9(configPath);
|
|
29386
|
+
if (!existsSync13(dir)) {
|
|
29387
|
+
mkdirSync3(dir, { recursive: true });
|
|
29388
|
+
}
|
|
29380
29389
|
writeFileSync3(configPath, `${JSON.stringify(existingConfig, null, 2)}
|
|
29381
29390
|
`, "utf-8");
|
|
29382
29391
|
result.configPath = configPath;
|
|
@@ -29472,6 +29481,15 @@ var init_claude_mcp = __esm(() => {
|
|
|
29472
29481
|
import_json52 = __toESM(require_lib(), 1);
|
|
29473
29482
|
});
|
|
29474
29483
|
|
|
29484
|
+
// src/core/copilot-mcp.ts
|
|
29485
|
+
import { join as join15 } from "node:path";
|
|
29486
|
+
function getCopilotMcpConfigPath() {
|
|
29487
|
+
return join15(getHomeDir(), ".copilot", "mcp-config.json");
|
|
29488
|
+
}
|
|
29489
|
+
var init_copilot_mcp = __esm(() => {
|
|
29490
|
+
init_constants();
|
|
29491
|
+
});
|
|
29492
|
+
|
|
29475
29493
|
// src/core/native/claude.ts
|
|
29476
29494
|
class ClaudeNativeClient {
|
|
29477
29495
|
async isAvailable() {
|
|
@@ -29692,7 +29710,7 @@ var init_native = __esm(() => {
|
|
|
29692
29710
|
// src/core/sync.ts
|
|
29693
29711
|
import { existsSync as existsSync14, readFileSync as readFileSync4, writeFileSync as writeFileSync4, lstatSync } from "node:fs";
|
|
29694
29712
|
import { rm as rm4, unlink as unlink2, rmdir, copyFile } from "node:fs/promises";
|
|
29695
|
-
import { join as
|
|
29713
|
+
import { join as join16, resolve as resolve9, dirname as dirname10, relative as relative4 } from "node:path";
|
|
29696
29714
|
function deduplicateClientsByPath(clients, clientMappings = CLIENT_MAPPINGS) {
|
|
29697
29715
|
const pathToClients = new Map;
|
|
29698
29716
|
for (const client of clients) {
|
|
@@ -29793,7 +29811,7 @@ async function selectivePurgeWorkspace(workspacePath, state, clients) {
|
|
|
29793
29811
|
const previousFiles = getPreviouslySyncedFiles(state, client);
|
|
29794
29812
|
const purgedPaths = [];
|
|
29795
29813
|
for (const filePath of previousFiles) {
|
|
29796
|
-
const fullPath =
|
|
29814
|
+
const fullPath = join16(workspacePath, filePath);
|
|
29797
29815
|
const cleanPath = fullPath.replace(/\/$/, "");
|
|
29798
29816
|
let stats;
|
|
29799
29817
|
try {
|
|
@@ -29820,16 +29838,16 @@ async function selectivePurgeWorkspace(workspacePath, state, clients) {
|
|
|
29820
29838
|
return result;
|
|
29821
29839
|
}
|
|
29822
29840
|
async function cleanupEmptyParents(workspacePath, filePath) {
|
|
29823
|
-
let parentPath =
|
|
29841
|
+
let parentPath = dirname10(filePath);
|
|
29824
29842
|
while (parentPath && parentPath !== "." && parentPath !== "/") {
|
|
29825
|
-
const fullParentPath =
|
|
29843
|
+
const fullParentPath = join16(workspacePath, parentPath);
|
|
29826
29844
|
if (!existsSync14(fullParentPath)) {
|
|
29827
|
-
parentPath =
|
|
29845
|
+
parentPath = dirname10(parentPath);
|
|
29828
29846
|
continue;
|
|
29829
29847
|
}
|
|
29830
29848
|
try {
|
|
29831
29849
|
await rmdir(fullParentPath);
|
|
29832
|
-
parentPath =
|
|
29850
|
+
parentPath = dirname10(parentPath);
|
|
29833
29851
|
} catch {
|
|
29834
29852
|
break;
|
|
29835
29853
|
}
|
|
@@ -29908,7 +29926,7 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
29908
29926
|
errors2.push(`Cannot resolve file '${file}' - no workspace.source configured`);
|
|
29909
29927
|
continue;
|
|
29910
29928
|
}
|
|
29911
|
-
const fullPath =
|
|
29929
|
+
const fullPath = join16(defaultSourcePath, file);
|
|
29912
29930
|
if (!existsSync14(fullPath)) {
|
|
29913
29931
|
errors2.push(`File source not found: ${fullPath}`);
|
|
29914
29932
|
}
|
|
@@ -29927,7 +29945,7 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
29927
29945
|
errors2.push(`GitHub cache not found for ${cacheKey}`);
|
|
29928
29946
|
continue;
|
|
29929
29947
|
}
|
|
29930
|
-
const fullPath =
|
|
29948
|
+
const fullPath = join16(cachePath, parsed.filePath);
|
|
29931
29949
|
if (!existsSync14(fullPath)) {
|
|
29932
29950
|
errors2.push(`Path not found in repository: ${cacheKey}/${parsed.filePath}`);
|
|
29933
29951
|
}
|
|
@@ -29938,7 +29956,7 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
29938
29956
|
} else if (file.source.startsWith("../")) {
|
|
29939
29957
|
fullPath = resolve9(file.source);
|
|
29940
29958
|
} else if (defaultSourcePath) {
|
|
29941
|
-
fullPath =
|
|
29959
|
+
fullPath = join16(defaultSourcePath, file.source);
|
|
29942
29960
|
} else {
|
|
29943
29961
|
fullPath = resolve9(file.source);
|
|
29944
29962
|
}
|
|
@@ -29951,7 +29969,7 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
29951
29969
|
errors2.push(`Cannot resolve file '${file.dest}' - no workspace.source configured and no explicit source provided`);
|
|
29952
29970
|
continue;
|
|
29953
29971
|
}
|
|
29954
|
-
const fullPath =
|
|
29972
|
+
const fullPath = join16(defaultSourcePath, file.dest ?? "");
|
|
29955
29973
|
if (!existsSync14(fullPath)) {
|
|
29956
29974
|
errors2.push(`File source not found: ${fullPath}`);
|
|
29957
29975
|
}
|
|
@@ -30098,7 +30116,7 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
|
|
|
30098
30116
|
...fetchResult.error && { error: fetchResult.error }
|
|
30099
30117
|
};
|
|
30100
30118
|
}
|
|
30101
|
-
const resolvedPath2 = parsed?.subpath ?
|
|
30119
|
+
const resolvedPath2 = parsed?.subpath ? join16(fetchResult.cachePath, parsed.subpath) : fetchResult.cachePath;
|
|
30102
30120
|
return {
|
|
30103
30121
|
plugin: pluginSource,
|
|
30104
30122
|
resolved: resolvedPath2,
|
|
@@ -30269,8 +30287,8 @@ function buildPluginSkillNameMaps(allSkills) {
|
|
|
30269
30287
|
return pluginMaps;
|
|
30270
30288
|
}
|
|
30271
30289
|
function generateVscodeWorkspaceFile(workspacePath, config) {
|
|
30272
|
-
const configDir =
|
|
30273
|
-
const templatePath =
|
|
30290
|
+
const configDir = join16(workspacePath, CONFIG_DIR);
|
|
30291
|
+
const templatePath = join16(configDir, VSCODE_TEMPLATE_FILE);
|
|
30274
30292
|
let template;
|
|
30275
30293
|
if (existsSync14(templatePath)) {
|
|
30276
30294
|
try {
|
|
@@ -30476,8 +30494,8 @@ async function persistSyncState(workspacePath, pluginResults, workspaceFileResul
|
|
|
30476
30494
|
async function syncWorkspace(workspacePath = process.cwd(), options2 = {}) {
|
|
30477
30495
|
await migrateWorkspaceSkillsV1toV2(workspacePath);
|
|
30478
30496
|
const { offline = false, dryRun = false, workspaceSourceBase, skipAgentFiles = false } = options2;
|
|
30479
|
-
const configDir =
|
|
30480
|
-
const configPath =
|
|
30497
|
+
const configDir = join16(workspacePath, CONFIG_DIR);
|
|
30498
|
+
const configPath = join16(configDir, WORKSPACE_CONFIG_FILE);
|
|
30481
30499
|
if (!existsSync14(configPath)) {
|
|
30482
30500
|
return failedSyncResult(`${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
|
|
30483
30501
|
Run 'allagents workspace init <path>' to create a new workspace`);
|
|
@@ -30558,7 +30576,7 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
30558
30576
|
const filesToCopy = [...config.workspace.files];
|
|
30559
30577
|
if (hasRepositories && sourcePath) {
|
|
30560
30578
|
for (const agentFile of AGENT_FILES) {
|
|
30561
|
-
const agentPath =
|
|
30579
|
+
const agentPath = join16(sourcePath, agentFile);
|
|
30562
30580
|
if (existsSync14(agentPath) && !filesToCopy.includes(agentFile)) {
|
|
30563
30581
|
filesToCopy.push(agentFile);
|
|
30564
30582
|
}
|
|
@@ -30583,9 +30601,9 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
30583
30601
|
}
|
|
30584
30602
|
workspaceFileResults = await copyWorkspaceFiles(sourcePath, workspacePath, filesToCopy, { dryRun, githubCache, repositories: config.repositories });
|
|
30585
30603
|
if (hasRepositories && !dryRun && syncClients.includes("claude") && sourcePath) {
|
|
30586
|
-
const claudePath =
|
|
30587
|
-
const agentsPath =
|
|
30588
|
-
const claudeExistsInSource = existsSync14(
|
|
30604
|
+
const claudePath = join16(workspacePath, "CLAUDE.md");
|
|
30605
|
+
const agentsPath = join16(workspacePath, "AGENTS.md");
|
|
30606
|
+
const claudeExistsInSource = existsSync14(join16(sourcePath, "CLAUDE.md"));
|
|
30589
30607
|
if (!claudeExistsInSource && existsSync14(agentsPath) && !existsSync14(claudePath)) {
|
|
30590
30608
|
await copyFile(agentsPath, claudePath);
|
|
30591
30609
|
}
|
|
@@ -30605,7 +30623,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
30605
30623
|
const mcpResults = {};
|
|
30606
30624
|
if (syncClients.includes("vscode")) {
|
|
30607
30625
|
const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "vscode");
|
|
30608
|
-
const projectMcpPath =
|
|
30626
|
+
const projectMcpPath = join16(workspacePath, ".vscode", "mcp.json");
|
|
30609
30627
|
const vscodeMcp = syncVscodeMcpConfig(validPlugins, {
|
|
30610
30628
|
dryRun,
|
|
30611
30629
|
force: false,
|
|
@@ -30619,7 +30637,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
30619
30637
|
}
|
|
30620
30638
|
if (syncClients.includes("claude")) {
|
|
30621
30639
|
const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "claude");
|
|
30622
|
-
const projectMcpJsonPath =
|
|
30640
|
+
const projectMcpJsonPath = join16(workspacePath, ".mcp.json");
|
|
30623
30641
|
const claudeMcp = syncClaudeMcpConfig(validPlugins, {
|
|
30624
30642
|
dryRun,
|
|
30625
30643
|
force: false,
|
|
@@ -30633,7 +30651,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
30633
30651
|
}
|
|
30634
30652
|
if (syncClients.includes("codex")) {
|
|
30635
30653
|
const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "codex");
|
|
30636
|
-
const projectCodexConfigPath =
|
|
30654
|
+
const projectCodexConfigPath = join16(workspacePath, ".codex", "config.toml");
|
|
30637
30655
|
const codexMcp = syncCodexProjectMcpConfig(validPlugins, {
|
|
30638
30656
|
dryRun,
|
|
30639
30657
|
force: false,
|
|
@@ -30645,7 +30663,21 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
30645
30663
|
}
|
|
30646
30664
|
mcpResults.codex = codexMcp;
|
|
30647
30665
|
}
|
|
30648
|
-
|
|
30666
|
+
if (syncClients.includes("copilot")) {
|
|
30667
|
+
const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "copilot");
|
|
30668
|
+
const projectCopilotMcpPath = join16(workspacePath, ".copilot", "mcp-config.json");
|
|
30669
|
+
const copilotMcp = syncClaudeMcpConfig(validPlugins, {
|
|
30670
|
+
dryRun,
|
|
30671
|
+
force: false,
|
|
30672
|
+
configPath: projectCopilotMcpPath,
|
|
30673
|
+
trackedServers: trackedMcpServers
|
|
30674
|
+
});
|
|
30675
|
+
if (copilotMcp.warnings.length > 0) {
|
|
30676
|
+
warnings.push(...copilotMcp.warnings);
|
|
30677
|
+
}
|
|
30678
|
+
mcpResults.copilot = copilotMcp;
|
|
30679
|
+
}
|
|
30680
|
+
const PROJECT_MCP_CLIENTS = new Set(["claude", "codex", "vscode", "copilot", "universal"]);
|
|
30649
30681
|
const { servers: allMcpServers } = collectMcpServers(validPlugins);
|
|
30650
30682
|
if (allMcpServers.size > 0) {
|
|
30651
30683
|
for (const client of syncClients) {
|
|
@@ -30760,7 +30792,21 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
30760
30792
|
}
|
|
30761
30793
|
mcpResults.claude = claudeMcp;
|
|
30762
30794
|
}
|
|
30763
|
-
|
|
30795
|
+
if (syncClients.includes("copilot")) {
|
|
30796
|
+
const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "copilot");
|
|
30797
|
+
const copilotMcpPath = getCopilotMcpConfigPath();
|
|
30798
|
+
const copilotMcp = syncClaudeMcpConfig(validPlugins, {
|
|
30799
|
+
dryRun,
|
|
30800
|
+
force,
|
|
30801
|
+
configPath: copilotMcpPath,
|
|
30802
|
+
trackedServers: trackedMcpServers
|
|
30803
|
+
});
|
|
30804
|
+
if (copilotMcp.warnings.length > 0) {
|
|
30805
|
+
warnings.push(...copilotMcp.warnings);
|
|
30806
|
+
}
|
|
30807
|
+
mcpResults.copilot = copilotMcp;
|
|
30808
|
+
}
|
|
30809
|
+
const USER_MCP_CLIENTS = new Set(["claude", "codex", "vscode", "copilot", "universal"]);
|
|
30764
30810
|
const { servers: allUserMcpServers } = collectMcpServers(validPlugins);
|
|
30765
30811
|
if (allUserMcpServers.size > 0) {
|
|
30766
30812
|
for (const client of syncClients) {
|
|
@@ -30817,15 +30863,16 @@ var init_sync = __esm(() => {
|
|
|
30817
30863
|
init_vscode_mcp();
|
|
30818
30864
|
init_codex_mcp();
|
|
30819
30865
|
init_claude_mcp();
|
|
30866
|
+
init_copilot_mcp();
|
|
30820
30867
|
init_native();
|
|
30821
30868
|
import_json53 = __toESM(require_lib(), 1);
|
|
30822
30869
|
});
|
|
30823
30870
|
|
|
30824
30871
|
// src/core/github-fetch.ts
|
|
30825
30872
|
import { existsSync as existsSync15, readFileSync as readFileSync5 } from "node:fs";
|
|
30826
|
-
import { join as
|
|
30873
|
+
import { join as join17 } from "node:path";
|
|
30827
30874
|
function readFileFromClone(tempDir, filePath) {
|
|
30828
|
-
const fullPath =
|
|
30875
|
+
const fullPath = join17(tempDir, filePath);
|
|
30829
30876
|
if (existsSync15(fullPath)) {
|
|
30830
30877
|
return readFileSync5(fullPath, "utf-8");
|
|
30831
30878
|
}
|
|
@@ -30927,12 +30974,12 @@ var init_github_fetch = __esm(() => {
|
|
|
30927
30974
|
// src/core/workspace.ts
|
|
30928
30975
|
import { mkdir as mkdir8, readFile as readFile10, writeFile as writeFile7, copyFile as copyFile2, unlink as unlink3 } from "node:fs/promises";
|
|
30929
30976
|
import { existsSync as existsSync16 } from "node:fs";
|
|
30930
|
-
import { join as
|
|
30977
|
+
import { join as join18, resolve as resolve10, dirname as dirname11, relative as relative5, sep as sep2, isAbsolute as isAbsolute4 } from "node:path";
|
|
30931
30978
|
import { fileURLToPath } from "node:url";
|
|
30932
30979
|
async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
30933
30980
|
const absoluteTarget = resolve10(targetPath);
|
|
30934
|
-
const configDir =
|
|
30935
|
-
const configPath =
|
|
30981
|
+
const configDir = join18(absoluteTarget, CONFIG_DIR);
|
|
30982
|
+
const configPath = join18(configDir, WORKSPACE_CONFIG_FILE);
|
|
30936
30983
|
if (existsSync16(configPath)) {
|
|
30937
30984
|
if (options2.force) {
|
|
30938
30985
|
await unlink3(configPath);
|
|
@@ -30942,9 +30989,9 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
30942
30989
|
}
|
|
30943
30990
|
}
|
|
30944
30991
|
const currentFilePath = fileURLToPath(import.meta.url);
|
|
30945
|
-
const currentFileDir =
|
|
30992
|
+
const currentFileDir = dirname11(currentFilePath);
|
|
30946
30993
|
const isProduction = currentFilePath.includes(`${sep2}dist${sep2}`);
|
|
30947
|
-
const defaultTemplatePath = isProduction ?
|
|
30994
|
+
const defaultTemplatePath = isProduction ? join18(currentFileDir, "templates", "default") : join18(currentFileDir, "..", "templates", "default");
|
|
30948
30995
|
let githubTempDir;
|
|
30949
30996
|
let parsedFromUrl;
|
|
30950
30997
|
let githubBasePath = "";
|
|
@@ -30990,8 +31037,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
30990
31037
|
const fromStat = await stat2(fromPath);
|
|
30991
31038
|
let sourceYamlPath;
|
|
30992
31039
|
if (fromStat.isDirectory()) {
|
|
30993
|
-
const nestedPath =
|
|
30994
|
-
const rootPath =
|
|
31040
|
+
const nestedPath = join18(fromPath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
31041
|
+
const rootPath = join18(fromPath, WORKSPACE_CONFIG_FILE);
|
|
30995
31042
|
if (existsSync16(nestedPath)) {
|
|
30996
31043
|
sourceYamlPath = nestedPath;
|
|
30997
31044
|
sourceDir = fromPath;
|
|
@@ -31004,9 +31051,9 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
31004
31051
|
}
|
|
31005
31052
|
} else {
|
|
31006
31053
|
sourceYamlPath = fromPath;
|
|
31007
|
-
const parentDir =
|
|
31054
|
+
const parentDir = dirname11(fromPath);
|
|
31008
31055
|
if (parentDir.endsWith(CONFIG_DIR)) {
|
|
31009
|
-
sourceDir =
|
|
31056
|
+
sourceDir = dirname11(parentDir);
|
|
31010
31057
|
} else {
|
|
31011
31058
|
sourceDir = parentDir;
|
|
31012
31059
|
}
|
|
@@ -31026,7 +31073,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
31026
31073
|
console.log(`✓ Using workspace.yaml from: ${sourceYamlPath}`);
|
|
31027
31074
|
}
|
|
31028
31075
|
} else {
|
|
31029
|
-
const defaultYamlPath =
|
|
31076
|
+
const defaultYamlPath = join18(defaultTemplatePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
31030
31077
|
if (!existsSync16(defaultYamlPath)) {
|
|
31031
31078
|
throw new Error(`Default template not found at: ${defaultTemplatePath}`);
|
|
31032
31079
|
}
|
|
@@ -31043,7 +31090,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
31043
31090
|
const clientNames = getClientTypes(clients);
|
|
31044
31091
|
const VSCODE_TEMPLATE_FILE2 = "template.code-workspace";
|
|
31045
31092
|
if (clientNames.includes("vscode") && options2.from) {
|
|
31046
|
-
const targetTemplatePath =
|
|
31093
|
+
const targetTemplatePath = join18(configDir, VSCODE_TEMPLATE_FILE2);
|
|
31047
31094
|
if (!existsSync16(targetTemplatePath)) {
|
|
31048
31095
|
if (isGitHubUrl(options2.from) && githubTempDir) {
|
|
31049
31096
|
if (parsedFromUrl) {
|
|
@@ -31054,7 +31101,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
31054
31101
|
}
|
|
31055
31102
|
}
|
|
31056
31103
|
} else if (sourceDir) {
|
|
31057
|
-
const sourceTemplatePath =
|
|
31104
|
+
const sourceTemplatePath = join18(sourceDir, CONFIG_DIR, VSCODE_TEMPLATE_FILE2);
|
|
31058
31105
|
if (existsSync16(sourceTemplatePath)) {
|
|
31059
31106
|
await copyFile2(sourceTemplatePath, targetTemplatePath);
|
|
31060
31107
|
}
|
|
@@ -31068,7 +31115,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
31068
31115
|
if (options2.from && isGitHubUrl(options2.from) && githubTempDir) {
|
|
31069
31116
|
if (parsedFromUrl) {
|
|
31070
31117
|
for (const agentFile of AGENT_FILES) {
|
|
31071
|
-
const targetFilePath =
|
|
31118
|
+
const targetFilePath = join18(absoluteTarget, agentFile);
|
|
31072
31119
|
if (existsSync16(targetFilePath)) {
|
|
31073
31120
|
copiedAgentFiles.push(agentFile);
|
|
31074
31121
|
continue;
|
|
@@ -31084,12 +31131,12 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
31084
31131
|
} else {
|
|
31085
31132
|
const effectiveSourceDir = sourceDir ?? defaultTemplatePath;
|
|
31086
31133
|
for (const agentFile of AGENT_FILES) {
|
|
31087
|
-
const targetFilePath =
|
|
31134
|
+
const targetFilePath = join18(absoluteTarget, agentFile);
|
|
31088
31135
|
if (existsSync16(targetFilePath)) {
|
|
31089
31136
|
copiedAgentFiles.push(agentFile);
|
|
31090
31137
|
continue;
|
|
31091
31138
|
}
|
|
31092
|
-
const sourcePath =
|
|
31139
|
+
const sourcePath = join18(effectiveSourceDir, agentFile);
|
|
31093
31140
|
if (existsSync16(sourcePath)) {
|
|
31094
31141
|
const content = await readFile10(sourcePath, "utf-8");
|
|
31095
31142
|
await writeFile7(targetFilePath, content, "utf-8");
|
|
@@ -31098,16 +31145,16 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
31098
31145
|
}
|
|
31099
31146
|
}
|
|
31100
31147
|
if (copiedAgentFiles.length === 0) {
|
|
31101
|
-
await ensureWorkspaceRules(
|
|
31148
|
+
await ensureWorkspaceRules(join18(absoluteTarget, "AGENTS.md"), repositories);
|
|
31102
31149
|
copiedAgentFiles.push("AGENTS.md");
|
|
31103
31150
|
} else {
|
|
31104
31151
|
for (const agentFile of copiedAgentFiles) {
|
|
31105
|
-
await ensureWorkspaceRules(
|
|
31152
|
+
await ensureWorkspaceRules(join18(absoluteTarget, agentFile), repositories);
|
|
31106
31153
|
}
|
|
31107
31154
|
}
|
|
31108
31155
|
if (clientNames.includes("claude") && !copiedAgentFiles.includes("CLAUDE.md") && copiedAgentFiles.includes("AGENTS.md")) {
|
|
31109
|
-
const agentsPath =
|
|
31110
|
-
const claudePath =
|
|
31156
|
+
const agentsPath = join18(absoluteTarget, "AGENTS.md");
|
|
31157
|
+
const claudePath = join18(absoluteTarget, "CLAUDE.md");
|
|
31111
31158
|
await copyFile2(agentsPath, claudePath);
|
|
31112
31159
|
}
|
|
31113
31160
|
}
|
|
@@ -31159,9 +31206,9 @@ var init_workspace = __esm(() => {
|
|
|
31159
31206
|
|
|
31160
31207
|
// src/core/status.ts
|
|
31161
31208
|
import { existsSync as existsSync17 } from "node:fs";
|
|
31162
|
-
import { join as
|
|
31209
|
+
import { join as join19 } from "node:path";
|
|
31163
31210
|
async function getWorkspaceStatus(workspacePath = process.cwd()) {
|
|
31164
|
-
const configPath =
|
|
31211
|
+
const configPath = join19(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
31165
31212
|
if (!existsSync17(configPath) || isUserConfigPath(workspacePath)) {
|
|
31166
31213
|
const userPlugins = await getUserPluginStatuses();
|
|
31167
31214
|
return {
|
|
@@ -31421,7 +31468,7 @@ function formatMcpResult(mcpResult, scope) {
|
|
|
31421
31468
|
parts.push(`${removed} removed`);
|
|
31422
31469
|
if (skipped > 0)
|
|
31423
31470
|
parts.push(`${skipped} skipped`);
|
|
31424
|
-
const displayScope = scope
|
|
31471
|
+
const displayScope = scope;
|
|
31425
31472
|
const label = displayScope ? `MCP servers (${displayScope})` : "MCP servers";
|
|
31426
31473
|
lines.push(`${label}: ${parts.join(", ")}`);
|
|
31427
31474
|
for (const name of mcpResult.addedServers) {
|
|
@@ -33308,7 +33355,7 @@ var init_prompt_clients = __esm(() => {
|
|
|
33308
33355
|
// src/core/skills.ts
|
|
33309
33356
|
import { existsSync as existsSync20 } from "node:fs";
|
|
33310
33357
|
import { readFile as readFile12, readdir as readdir4 } from "node:fs/promises";
|
|
33311
|
-
import { join as
|
|
33358
|
+
import { join as join22, basename as basename6, resolve as resolve12 } from "node:path";
|
|
33312
33359
|
async function resolvePluginPath(pluginSource, workspacePath) {
|
|
33313
33360
|
if (isPluginSpec(pluginSource)) {
|
|
33314
33361
|
const resolved2 = await resolvePluginSpecWithAutoRegister(pluginSource, {
|
|
@@ -33329,14 +33376,14 @@ async function resolvePluginPath(pluginSource, workspacePath) {
|
|
|
33329
33376
|
});
|
|
33330
33377
|
if (!result.success)
|
|
33331
33378
|
return null;
|
|
33332
|
-
const path = parsed?.subpath ?
|
|
33379
|
+
const path = parsed?.subpath ? join22(result.cachePath, parsed.subpath) : result.cachePath;
|
|
33333
33380
|
return { path };
|
|
33334
33381
|
}
|
|
33335
33382
|
const resolved = resolve12(workspacePath, pluginSource);
|
|
33336
33383
|
return existsSync20(resolved) ? { path: resolved } : null;
|
|
33337
33384
|
}
|
|
33338
33385
|
async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
|
|
33339
|
-
const configPath =
|
|
33386
|
+
const configPath = join22(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
33340
33387
|
if (!existsSync20(configPath)) {
|
|
33341
33388
|
return [];
|
|
33342
33389
|
}
|
|
@@ -33353,28 +33400,28 @@ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
|
|
|
33353
33400
|
continue;
|
|
33354
33401
|
const pluginPath = resolved.path;
|
|
33355
33402
|
const pluginName = resolved.pluginName ?? getPluginName(pluginPath);
|
|
33356
|
-
const skillsDir =
|
|
33403
|
+
const skillsDir = join22(pluginPath, "skills");
|
|
33357
33404
|
const pluginSkillsConfig = typeof pluginEntry === "string" ? undefined : pluginEntry.skills;
|
|
33358
33405
|
const hasEnabledEntries = !pluginSkillsConfig && enabledSkills && [...enabledSkills].some((s) => s.startsWith(`${pluginName}`));
|
|
33359
33406
|
let skillEntries;
|
|
33360
33407
|
if (existsSync20(skillsDir)) {
|
|
33361
33408
|
const entries = await readdir4(skillsDir, { withFileTypes: true });
|
|
33362
|
-
skillEntries = entries.filter((e) => e.isDirectory()).map((e) => ({ name: e.name, skillPath:
|
|
33409
|
+
skillEntries = entries.filter((e) => e.isDirectory()).map((e) => ({ name: e.name, skillPath: join22(skillsDir, e.name) }));
|
|
33363
33410
|
} else {
|
|
33364
33411
|
const entries = await readdir4(pluginPath, { withFileTypes: true });
|
|
33365
33412
|
const flatSkills = [];
|
|
33366
33413
|
for (const entry of entries) {
|
|
33367
33414
|
if (!entry.isDirectory())
|
|
33368
33415
|
continue;
|
|
33369
|
-
const skillMdPath =
|
|
33416
|
+
const skillMdPath = join22(pluginPath, entry.name, "SKILL.md");
|
|
33370
33417
|
if (existsSync20(skillMdPath)) {
|
|
33371
|
-
flatSkills.push({ name: entry.name, skillPath:
|
|
33418
|
+
flatSkills.push({ name: entry.name, skillPath: join22(pluginPath, entry.name) });
|
|
33372
33419
|
}
|
|
33373
33420
|
}
|
|
33374
33421
|
if (flatSkills.length > 0) {
|
|
33375
33422
|
skillEntries = flatSkills;
|
|
33376
33423
|
} else {
|
|
33377
|
-
const rootSkillMd =
|
|
33424
|
+
const rootSkillMd = join22(pluginPath, "SKILL.md");
|
|
33378
33425
|
if (existsSync20(rootSkillMd)) {
|
|
33379
33426
|
const skillContent = await readFile12(rootSkillMd, "utf-8");
|
|
33380
33427
|
const metadata = parseSkillMetadata(skillContent);
|
|
@@ -33419,7 +33466,7 @@ async function findSkillByName(skillName, workspacePath = process.cwd()) {
|
|
|
33419
33466
|
async function discoverSkillNames(pluginPath) {
|
|
33420
33467
|
if (!existsSync20(pluginPath))
|
|
33421
33468
|
return [];
|
|
33422
|
-
const skillsDir =
|
|
33469
|
+
const skillsDir = join22(pluginPath, "skills");
|
|
33423
33470
|
if (existsSync20(skillsDir)) {
|
|
33424
33471
|
const entries2 = await readdir4(skillsDir, { withFileTypes: true });
|
|
33425
33472
|
return entries2.filter((e) => e.isDirectory()).map((e) => e.name);
|
|
@@ -33429,13 +33476,13 @@ async function discoverSkillNames(pluginPath) {
|
|
|
33429
33476
|
for (const entry of entries) {
|
|
33430
33477
|
if (!entry.isDirectory())
|
|
33431
33478
|
continue;
|
|
33432
|
-
if (existsSync20(
|
|
33479
|
+
if (existsSync20(join22(pluginPath, entry.name, "SKILL.md"))) {
|
|
33433
33480
|
flatSkills.push(entry.name);
|
|
33434
33481
|
}
|
|
33435
33482
|
}
|
|
33436
33483
|
if (flatSkills.length > 0)
|
|
33437
33484
|
return flatSkills;
|
|
33438
|
-
const rootSkillMd =
|
|
33485
|
+
const rootSkillMd = join22(pluginPath, "SKILL.md");
|
|
33439
33486
|
if (existsSync20(rootSkillMd)) {
|
|
33440
33487
|
try {
|
|
33441
33488
|
const content = await readFile12(rootSkillMd, "utf-8");
|
|
@@ -33956,7 +34003,7 @@ var package_default;
|
|
|
33956
34003
|
var init_package = __esm(() => {
|
|
33957
34004
|
package_default = {
|
|
33958
34005
|
name: "allagents",
|
|
33959
|
-
version: "1.
|
|
34006
|
+
version: "1.3.0",
|
|
33960
34007
|
description: "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
|
|
33961
34008
|
type: "module",
|
|
33962
34009
|
bin: {
|
|
@@ -34031,10 +34078,10 @@ var init_package = __esm(() => {
|
|
|
34031
34078
|
|
|
34032
34079
|
// src/cli/update-check.ts
|
|
34033
34080
|
import { readFile as readFile15 } from "node:fs/promises";
|
|
34034
|
-
import { join as
|
|
34081
|
+
import { join as join25 } from "node:path";
|
|
34035
34082
|
import { spawn as spawn3 } from "node:child_process";
|
|
34036
34083
|
async function getCachedUpdateInfo(path3) {
|
|
34037
|
-
const filePath = path3 ??
|
|
34084
|
+
const filePath = path3 ?? join25(getHomeDir(), CONFIG_DIR, CACHE_FILE);
|
|
34038
34085
|
try {
|
|
34039
34086
|
const raw = await readFile15(filePath, "utf-8");
|
|
34040
34087
|
const data = JSON.parse(raw);
|
|
@@ -34072,8 +34119,8 @@ function buildNotice(currentVersion, latestVersion) {
|
|
|
34072
34119
|
Run \`allagents self update\` to upgrade.`);
|
|
34073
34120
|
}
|
|
34074
34121
|
function backgroundUpdateCheck() {
|
|
34075
|
-
const dir =
|
|
34076
|
-
const filePath =
|
|
34122
|
+
const dir = join25(getHomeDir(), CONFIG_DIR);
|
|
34123
|
+
const filePath = join25(dir, CACHE_FILE);
|
|
34077
34124
|
const script = `
|
|
34078
34125
|
const https = require('https');
|
|
34079
34126
|
const fs = require('fs');
|
|
@@ -34161,13 +34208,13 @@ class TuiCache {
|
|
|
34161
34208
|
|
|
34162
34209
|
// src/cli/tui/context.ts
|
|
34163
34210
|
import { existsSync as existsSync23 } from "node:fs";
|
|
34164
|
-
import { join as
|
|
34211
|
+
import { join as join26 } from "node:path";
|
|
34165
34212
|
async function getTuiContext(cwd = process.cwd(), cache2) {
|
|
34166
34213
|
const cachedContext = cache2?.getContext();
|
|
34167
34214
|
if (cachedContext) {
|
|
34168
34215
|
return cachedContext;
|
|
34169
34216
|
}
|
|
34170
|
-
const configPath =
|
|
34217
|
+
const configPath = join26(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
34171
34218
|
const hasWorkspace = existsSync23(configPath) && !isUserConfigPath(cwd);
|
|
34172
34219
|
let projectPluginCount = 0;
|
|
34173
34220
|
if (hasWorkspace) {
|
|
@@ -35557,7 +35604,7 @@ init_sync();
|
|
|
35557
35604
|
init_status2();
|
|
35558
35605
|
var import_cmd_ts2 = __toESM(require_cjs(), 1);
|
|
35559
35606
|
import { existsSync as existsSync19 } from "node:fs";
|
|
35560
|
-
import { join as
|
|
35607
|
+
import { join as join21, resolve as resolve11 } from "node:path";
|
|
35561
35608
|
|
|
35562
35609
|
// src/core/prune.ts
|
|
35563
35610
|
init_js_yaml();
|
|
@@ -35567,7 +35614,7 @@ init_user_workspace();
|
|
|
35567
35614
|
init_workspace_config();
|
|
35568
35615
|
import { readFile as readFile11, writeFile as writeFile8 } from "node:fs/promises";
|
|
35569
35616
|
import { existsSync as existsSync18 } from "node:fs";
|
|
35570
|
-
import { join as
|
|
35617
|
+
import { join as join20 } from "node:path";
|
|
35571
35618
|
async function isOrphanedPlugin(pluginSpec) {
|
|
35572
35619
|
if (!isPluginSpec(pluginSpec))
|
|
35573
35620
|
return false;
|
|
@@ -35594,7 +35641,7 @@ async function prunePlugins(plugins) {
|
|
|
35594
35641
|
}
|
|
35595
35642
|
async function pruneOrphanedPlugins(workspacePath) {
|
|
35596
35643
|
let projectResult = { removed: [], kept: [], keptEntries: [] };
|
|
35597
|
-
const projectConfigPath =
|
|
35644
|
+
const projectConfigPath = join20(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
35598
35645
|
if (existsSync18(projectConfigPath) && !isUserConfigPath(workspacePath)) {
|
|
35599
35646
|
const content = await readFile11(projectConfigPath, "utf-8");
|
|
35600
35647
|
const config = load(content);
|
|
@@ -35872,6 +35919,7 @@ Plugin sync results:`);
|
|
|
35872
35919
|
});
|
|
35873
35920
|
var syncCmd = import_cmd_ts2.command({
|
|
35874
35921
|
name: "sync",
|
|
35922
|
+
aliases: ["update"],
|
|
35875
35923
|
description: buildDescription(syncMeta),
|
|
35876
35924
|
args: {
|
|
35877
35925
|
offline: import_cmd_ts2.flag({ long: "offline", description: "Use cached plugins without fetching latest from remote" }),
|
|
@@ -35886,7 +35934,7 @@ var syncCmd = import_cmd_ts2.command({
|
|
|
35886
35934
|
`);
|
|
35887
35935
|
}
|
|
35888
35936
|
const userConfigExists = !!await getUserWorkspaceConfig();
|
|
35889
|
-
const projectConfigPath =
|
|
35937
|
+
const projectConfigPath = join21(process.cwd(), ".allagents", "workspace.yaml");
|
|
35890
35938
|
const projectConfigExists = existsSync19(projectConfigPath);
|
|
35891
35939
|
if (!userConfigExists && !projectConfigExists) {
|
|
35892
35940
|
await ensureUserWorkspace();
|
|
@@ -36536,7 +36584,7 @@ init_skills();
|
|
|
36536
36584
|
var import_cmd_ts3 = __toESM(require_cjs(), 1);
|
|
36537
36585
|
import { existsSync as existsSync21 } from "node:fs";
|
|
36538
36586
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
36539
|
-
import { join as
|
|
36587
|
+
import { join as join23 } from "node:path";
|
|
36540
36588
|
|
|
36541
36589
|
// src/cli/metadata/plugin-skills.ts
|
|
36542
36590
|
var skillsListMeta = {
|
|
@@ -36627,7 +36675,7 @@ init_skill();
|
|
|
36627
36675
|
init_marketplace();
|
|
36628
36676
|
init_marketplace_manifest_parser();
|
|
36629
36677
|
function hasProjectConfig(dir) {
|
|
36630
|
-
return existsSync21(
|
|
36678
|
+
return existsSync21(join23(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
|
|
36631
36679
|
}
|
|
36632
36680
|
function resolveScope(cwd) {
|
|
36633
36681
|
if (isUserConfigPath(cwd))
|
|
@@ -36658,7 +36706,7 @@ async function resolveSkillNameFromRepo(url, parsed, fallbackName, fetchFn = fet
|
|
|
36658
36706
|
if (!fetchResult.success)
|
|
36659
36707
|
return fallbackName;
|
|
36660
36708
|
try {
|
|
36661
|
-
const skillMd = await readFile13(
|
|
36709
|
+
const skillMd = await readFile13(join23(fetchResult.cachePath, "SKILL.md"), "utf-8");
|
|
36662
36710
|
const metadata = parseSkillMetadata(skillMd);
|
|
36663
36711
|
return metadata?.name ?? fallbackName;
|
|
36664
36712
|
} catch {
|
|
@@ -37217,7 +37265,7 @@ init_constants();
|
|
|
37217
37265
|
init_js_yaml();
|
|
37218
37266
|
import { readFile as readFile14 } from "node:fs/promises";
|
|
37219
37267
|
import { existsSync as existsSync22 } from "node:fs";
|
|
37220
|
-
import { join as
|
|
37268
|
+
import { join as join24 } from "node:path";
|
|
37221
37269
|
async function runSyncAndPrint(options2) {
|
|
37222
37270
|
if (!isJsonMode()) {
|
|
37223
37271
|
console.log(`
|
|
@@ -37462,7 +37510,7 @@ var marketplaceAddCmd = import_cmd_ts4.command({
|
|
|
37462
37510
|
process.exit(1);
|
|
37463
37511
|
}
|
|
37464
37512
|
if (effectiveScope === "project") {
|
|
37465
|
-
if (!existsSync22(
|
|
37513
|
+
if (!existsSync22(join24(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE))) {
|
|
37466
37514
|
const msg = 'No workspace found in current directory. Run "allagents workspace init" first.';
|
|
37467
37515
|
if (isJsonMode()) {
|
|
37468
37516
|
jsonOutput({ success: false, command: "plugin marketplace add", error: msg });
|
|
@@ -37784,8 +37832,8 @@ var pluginListCmd = import_cmd_ts4.command({
|
|
|
37784
37832
|
}
|
|
37785
37833
|
} catch {}
|
|
37786
37834
|
}
|
|
37787
|
-
const userConfigPath =
|
|
37788
|
-
const projectConfigPath =
|
|
37835
|
+
const userConfigPath = join24(getAllagentsDir(), WORKSPACE_CONFIG_FILE);
|
|
37836
|
+
const projectConfigPath = join24(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
37789
37837
|
await loadConfigClients(userConfigPath, "user");
|
|
37790
37838
|
await loadConfigClients(projectConfigPath, "project");
|
|
37791
37839
|
const userPlugins = await getInstalledUserPlugins();
|
|
@@ -37924,7 +37972,7 @@ var pluginInstallCmd = import_cmd_ts4.command({
|
|
|
37924
37972
|
try {
|
|
37925
37973
|
const isUser = scope === "user" || !scope && isUserConfigPath(process.cwd());
|
|
37926
37974
|
if (!isUser) {
|
|
37927
|
-
const configPath =
|
|
37975
|
+
const configPath = join24(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
37928
37976
|
if (!existsSync22(configPath)) {
|
|
37929
37977
|
const { promptForClients: promptForClients2 } = await Promise.resolve().then(() => (init_prompt_clients(), exports_prompt_clients));
|
|
37930
37978
|
const clients = await promptForClients2();
|
|
@@ -38213,10 +38261,10 @@ var pluginUpdateCmd = import_cmd_ts4.command({
|
|
|
38213
38261
|
if (updateProject && !isUserConfigPath(process.cwd())) {
|
|
38214
38262
|
const { existsSync: existsSync23 } = await import("node:fs");
|
|
38215
38263
|
const { readFile: readFile15 } = await import("node:fs/promises");
|
|
38216
|
-
const { join:
|
|
38264
|
+
const { join: join25 } = await import("node:path");
|
|
38217
38265
|
const { load: load2 } = await Promise.resolve().then(() => (init_js_yaml(), exports_js_yaml));
|
|
38218
38266
|
const { CONFIG_DIR: CONFIG_DIR2, WORKSPACE_CONFIG_FILE: WORKSPACE_CONFIG_FILE2 } = await Promise.resolve().then(() => (init_constants(), exports_constants));
|
|
38219
|
-
const configPath =
|
|
38267
|
+
const configPath = join25(process.cwd(), CONFIG_DIR2, WORKSPACE_CONFIG_FILE2);
|
|
38220
38268
|
if (existsSync23(configPath)) {
|
|
38221
38269
|
const content = await readFile15(configPath, "utf-8");
|
|
38222
38270
|
const config = load2(content);
|