allagents 1.13.3 → 1.13.4-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -1
- package/dist/index.js +575 -248
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14358,7 +14358,19 @@ var init_zod = __esm(() => {
|
|
|
14358
14358
|
});
|
|
14359
14359
|
|
|
14360
14360
|
// src/models/marketplace-manifest.ts
|
|
14361
|
-
|
|
14361
|
+
function getMarketplaceFileArtifacts(entry) {
|
|
14362
|
+
if (entry.strict !== false)
|
|
14363
|
+
return;
|
|
14364
|
+
return {
|
|
14365
|
+
commands: entry.commands !== undefined,
|
|
14366
|
+
skills: entry.skills !== undefined,
|
|
14367
|
+
hooks: entry.hooks !== undefined,
|
|
14368
|
+
agents: entry.agents !== undefined,
|
|
14369
|
+
mcpServers: entry.mcpServers !== undefined,
|
|
14370
|
+
github: false
|
|
14371
|
+
};
|
|
14372
|
+
}
|
|
14373
|
+
var UrlSourceSchema, GitHubSourceSchema, PluginSourceRefSchema, ComponentPathSchema, ContactSchema, LspServerSchema, MarketplacePluginEntrySchema, MarketplaceManifestSchema, MarketplaceManifestLenientSchema;
|
|
14362
14374
|
var init_marketplace_manifest = __esm(() => {
|
|
14363
14375
|
init_zod();
|
|
14364
14376
|
UrlSourceSchema = exports_external.object({
|
|
@@ -14373,6 +14385,10 @@ var init_marketplace_manifest = __esm(() => {
|
|
|
14373
14385
|
url: `https://github.com/${val.repo}`
|
|
14374
14386
|
}));
|
|
14375
14387
|
PluginSourceRefSchema = exports_external.union([exports_external.string(), UrlSourceSchema, GitHubSourceSchema]);
|
|
14388
|
+
ComponentPathSchema = exports_external.union([
|
|
14389
|
+
exports_external.string(),
|
|
14390
|
+
exports_external.array(exports_external.string())
|
|
14391
|
+
]);
|
|
14376
14392
|
ContactSchema = exports_external.object({
|
|
14377
14393
|
name: exports_external.string(),
|
|
14378
14394
|
email: exports_external.string().optional()
|
|
@@ -14393,7 +14409,11 @@ var init_marketplace_manifest = __esm(() => {
|
|
|
14393
14409
|
homepage: exports_external.string().optional(),
|
|
14394
14410
|
strict: exports_external.boolean().optional(),
|
|
14395
14411
|
tags: exports_external.array(exports_external.string()).optional(),
|
|
14396
|
-
skills:
|
|
14412
|
+
skills: ComponentPathSchema.optional(),
|
|
14413
|
+
commands: ComponentPathSchema.optional(),
|
|
14414
|
+
agents: ComponentPathSchema.optional(),
|
|
14415
|
+
hooks: exports_external.union([exports_external.string(), exports_external.record(exports_external.unknown())]).optional(),
|
|
14416
|
+
mcpServers: exports_external.union([exports_external.string(), exports_external.record(exports_external.unknown())]).optional(),
|
|
14397
14417
|
lspServers: exports_external.record(LspServerSchema).optional()
|
|
14398
14418
|
});
|
|
14399
14419
|
MarketplaceManifestSchema = exports_external.object({
|
|
@@ -14411,15 +14431,15 @@ var init_marketplace_manifest = __esm(() => {
|
|
|
14411
14431
|
});
|
|
14412
14432
|
|
|
14413
14433
|
// src/utils/marketplace-manifest-parser.ts
|
|
14414
|
-
import { readFile } from "node:fs/promises";
|
|
14415
14434
|
import { existsSync } from "node:fs";
|
|
14435
|
+
import { readFile } from "node:fs/promises";
|
|
14416
14436
|
import { join, resolve } from "node:path";
|
|
14417
14437
|
async function parseMarketplaceManifest(marketplacePath) {
|
|
14418
|
-
const manifestPath = join(marketplacePath,
|
|
14419
|
-
if (!
|
|
14438
|
+
const manifestPath = MANIFEST_PATHS.map((path) => join(marketplacePath, path)).find((path) => existsSync(path));
|
|
14439
|
+
if (!manifestPath) {
|
|
14420
14440
|
return {
|
|
14421
14441
|
success: false,
|
|
14422
|
-
error: `Marketplace manifest not found
|
|
14442
|
+
error: `Marketplace manifest not found (checked ${MANIFEST_PATHS.join(", ")})`
|
|
14423
14443
|
};
|
|
14424
14444
|
}
|
|
14425
14445
|
let raw;
|
|
@@ -14446,6 +14466,15 @@ async function parseMarketplaceManifest(marketplacePath) {
|
|
|
14446
14466
|
}
|
|
14447
14467
|
return parseLeniently(json2);
|
|
14448
14468
|
}
|
|
14469
|
+
async function getEmbeddedMarketplaceFileArtifacts(pluginPath, preferredName) {
|
|
14470
|
+
const manifestResult = await parseMarketplaceManifest(pluginPath);
|
|
14471
|
+
if (!manifestResult.success)
|
|
14472
|
+
return;
|
|
14473
|
+
const pluginRoot = resolve(pluginPath);
|
|
14474
|
+
const rootEntries = manifestResult.data.plugins.filter((entry2) => typeof entry2.source === "string" && resolve(pluginPath, entry2.source) === pluginRoot);
|
|
14475
|
+
const entry = rootEntries.find((candidate) => candidate.name === preferredName) ?? (rootEntries.length === 1 ? rootEntries[0] : undefined);
|
|
14476
|
+
return entry ? getMarketplaceFileArtifacts(entry) : undefined;
|
|
14477
|
+
}
|
|
14449
14478
|
function parseLeniently(json2) {
|
|
14450
14479
|
const lenientResult = MarketplaceManifestLenientSchema.safeParse(json2);
|
|
14451
14480
|
if (!lenientResult.success) {
|
|
@@ -14511,18 +14540,37 @@ function extractPluginEntry(entry, index, warnings) {
|
|
|
14511
14540
|
...typeof obj.version === "string" && { version: obj.version },
|
|
14512
14541
|
...typeof obj.category === "string" && { category: obj.category },
|
|
14513
14542
|
...typeof obj.homepage === "string" && { homepage: obj.homepage },
|
|
14514
|
-
...
|
|
14543
|
+
...isComponentPath(obj.skills) && { skills: obj.skills },
|
|
14544
|
+
...isComponentPath(obj.commands) && { commands: obj.commands },
|
|
14545
|
+
...isComponentPath(obj.agents) && { agents: obj.agents },
|
|
14546
|
+
...(typeof obj.hooks === "string" || isRecord(obj.hooks)) && {
|
|
14547
|
+
hooks: obj.hooks
|
|
14548
|
+
},
|
|
14549
|
+
...(typeof obj.mcpServers === "string" || isRecord(obj.mcpServers)) && {
|
|
14550
|
+
mcpServers: obj.mcpServers
|
|
14551
|
+
},
|
|
14552
|
+
...typeof obj.strict === "boolean" && { strict: obj.strict }
|
|
14515
14553
|
};
|
|
14516
14554
|
}
|
|
14555
|
+
function isComponentPath(value) {
|
|
14556
|
+
return typeof value === "string" || Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
14557
|
+
}
|
|
14558
|
+
function isRecord(value) {
|
|
14559
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
14560
|
+
}
|
|
14517
14561
|
function resolvePluginSourcePath(source, marketplacePath) {
|
|
14518
14562
|
if (typeof source === "object") {
|
|
14519
14563
|
return source.url;
|
|
14520
14564
|
}
|
|
14521
14565
|
return resolve(marketplacePath, source);
|
|
14522
14566
|
}
|
|
14523
|
-
var
|
|
14567
|
+
var MANIFEST_PATHS;
|
|
14524
14568
|
var init_marketplace_manifest_parser = __esm(() => {
|
|
14525
14569
|
init_marketplace_manifest();
|
|
14570
|
+
MANIFEST_PATHS = [
|
|
14571
|
+
".github/plugin/marketplace.json",
|
|
14572
|
+
".claude-plugin/marketplace.json"
|
|
14573
|
+
];
|
|
14526
14574
|
});
|
|
14527
14575
|
|
|
14528
14576
|
// src/core/git-errors.ts
|
|
@@ -17259,6 +17307,11 @@ async function updateMarketplace(name, workspacePath) {
|
|
|
17259
17307
|
}
|
|
17260
17308
|
return results;
|
|
17261
17309
|
}
|
|
17310
|
+
function normalizeComponentPaths(paths) {
|
|
17311
|
+
if (paths === undefined)
|
|
17312
|
+
return;
|
|
17313
|
+
return Array.isArray(paths) ? paths : [paths];
|
|
17314
|
+
}
|
|
17262
17315
|
async function getMarketplacePluginsFromManifest(marketplacePath) {
|
|
17263
17316
|
const result = await parseMarketplaceManifest(marketplacePath);
|
|
17264
17317
|
if (!result.success) {
|
|
@@ -17276,8 +17329,9 @@ async function getMarketplacePluginsFromManifest(marketplacePath) {
|
|
|
17276
17329
|
info.category = plugin.category;
|
|
17277
17330
|
if (plugin.homepage)
|
|
17278
17331
|
info.homepage = plugin.homepage;
|
|
17279
|
-
|
|
17280
|
-
|
|
17332
|
+
const skills = normalizeComponentPaths(plugin.skills);
|
|
17333
|
+
if (skills)
|
|
17334
|
+
info.skills = skills;
|
|
17281
17335
|
return info;
|
|
17282
17336
|
});
|
|
17283
17337
|
return { plugins, warnings: result.warnings };
|
|
@@ -17354,13 +17408,17 @@ async function resolvePluginSpec(spec, options2 = {}) {
|
|
|
17354
17408
|
if (manifestResult.success) {
|
|
17355
17409
|
const pluginEntry = manifestResult.data.plugins.find((p) => p.name === parsed.plugin);
|
|
17356
17410
|
if (pluginEntry) {
|
|
17411
|
+
const declaredFileArtifacts = getMarketplaceFileArtifacts(pluginEntry);
|
|
17357
17412
|
if (typeof pluginEntry.source === "string") {
|
|
17358
17413
|
const resolvedPath = resolve6(marketplacePath, pluginEntry.source);
|
|
17359
17414
|
if (existsSync6(resolvedPath)) {
|
|
17360
17415
|
return {
|
|
17361
17416
|
path: resolvedPath,
|
|
17362
17417
|
marketplace: marketplaceName,
|
|
17363
|
-
plugin: parsed.plugin
|
|
17418
|
+
plugin: parsed.plugin,
|
|
17419
|
+
...declaredFileArtifacts && {
|
|
17420
|
+
fileArtifacts: declaredFileArtifacts
|
|
17421
|
+
}
|
|
17364
17422
|
};
|
|
17365
17423
|
}
|
|
17366
17424
|
} else {
|
|
@@ -17369,10 +17427,12 @@ async function resolvePluginSpec(spec, options2 = {}) {
|
|
|
17369
17427
|
if (parsedUrl) {
|
|
17370
17428
|
const cachePath = getPluginCachePath(parsedUrl.owner, parsedUrl.repo);
|
|
17371
17429
|
if (existsSync6(cachePath)) {
|
|
17430
|
+
const fileArtifacts = declaredFileArtifacts ?? await getEmbeddedMarketplaceFileArtifacts(cachePath, parsed.plugin);
|
|
17372
17431
|
return {
|
|
17373
17432
|
path: cachePath,
|
|
17374
17433
|
marketplace: marketplaceName,
|
|
17375
|
-
plugin: parsed.plugin
|
|
17434
|
+
plugin: parsed.plugin,
|
|
17435
|
+
...fileArtifacts && { fileArtifacts }
|
|
17376
17436
|
};
|
|
17377
17437
|
}
|
|
17378
17438
|
}
|
|
@@ -17381,10 +17441,12 @@ async function resolvePluginSpec(spec, options2 = {}) {
|
|
|
17381
17441
|
const fetchFn = options2.fetchFn ?? fetchPlugin;
|
|
17382
17442
|
const fetchResult = await fetchFn(pluginEntry.source.url);
|
|
17383
17443
|
if (fetchResult.success && fetchResult.cachePath) {
|
|
17444
|
+
const fileArtifacts = declaredFileArtifacts ?? await getEmbeddedMarketplaceFileArtifacts(fetchResult.cachePath, parsed.plugin);
|
|
17384
17445
|
return {
|
|
17385
17446
|
path: fetchResult.cachePath,
|
|
17386
17447
|
marketplace: marketplaceName,
|
|
17387
|
-
plugin: parsed.plugin
|
|
17448
|
+
plugin: parsed.plugin,
|
|
17449
|
+
...fileArtifacts && { fileArtifacts }
|
|
17388
17450
|
};
|
|
17389
17451
|
}
|
|
17390
17452
|
}
|
|
@@ -17492,7 +17554,8 @@ async function resolvePluginSpecWithAutoRegister(spec, options2 = {}) {
|
|
|
17492
17554
|
path: resolved.path,
|
|
17493
17555
|
pluginName: resolved.plugin,
|
|
17494
17556
|
...shouldReturnRegisteredAs && { registeredAs: marketplace.name },
|
|
17495
|
-
...marketplaceSource && { marketplaceSource }
|
|
17557
|
+
...marketplaceSource && { marketplaceSource },
|
|
17558
|
+
...resolved.fileArtifacts && { fileArtifacts: resolved.fileArtifacts }
|
|
17496
17559
|
};
|
|
17497
17560
|
}
|
|
17498
17561
|
async function autoRegisterMarketplace(source) {
|
|
@@ -17640,6 +17703,7 @@ var registeredSourceCache, updatedMarketplaceCache;
|
|
|
17640
17703
|
var init_marketplace = __esm(() => {
|
|
17641
17704
|
init_esm();
|
|
17642
17705
|
init_constants();
|
|
17706
|
+
init_marketplace_manifest();
|
|
17643
17707
|
init_marketplace_manifest_parser();
|
|
17644
17708
|
init_plugin_path();
|
|
17645
17709
|
init_git();
|
|
@@ -28261,7 +28325,14 @@ var init_skills = __esm(() => {
|
|
|
28261
28325
|
|
|
28262
28326
|
// src/core/transform.ts
|
|
28263
28327
|
import { existsSync as existsSync10 } from "node:fs";
|
|
28264
|
-
import {
|
|
28328
|
+
import {
|
|
28329
|
+
access,
|
|
28330
|
+
cp,
|
|
28331
|
+
mkdir as mkdir6,
|
|
28332
|
+
readFile as readFile8,
|
|
28333
|
+
readdir as readdir4,
|
|
28334
|
+
writeFile as writeFile5
|
|
28335
|
+
} from "node:fs/promises";
|
|
28265
28336
|
import { basename as basename5, dirname as dirname5, join as join13, relative as relative3 } from "node:path";
|
|
28266
28337
|
async function ensureWorkspaceRules(filePath, repositories, skillsIndexRefs = []) {
|
|
28267
28338
|
const rulesContent = generateWorkspaceRules(repositories, skillsIndexRefs);
|
|
@@ -28528,14 +28599,15 @@ async function copyHooks(pluginPath, workspacePath, client, options2 = {}) {
|
|
|
28528
28599
|
return results;
|
|
28529
28600
|
}
|
|
28530
28601
|
const destDir = join13(workspacePath, mapping.hooksPath);
|
|
28602
|
+
const effectiveExclude = mapping.hooksPath === ".github/hooks/" && existsSync10(join13(sourceDir, "hooks.json")) ? [...options2.exclude ?? [], "hooks/hooks.json"] : options2.exclude;
|
|
28531
28603
|
if (dryRun) {
|
|
28532
28604
|
results.push({ source: sourceDir, destination: destDir, action: "copied" });
|
|
28533
28605
|
return results;
|
|
28534
28606
|
}
|
|
28535
28607
|
await mkdir6(destDir, { recursive: true });
|
|
28536
28608
|
try {
|
|
28537
|
-
if (
|
|
28538
|
-
await copyDirectoryWithExclusions(sourceDir, destDir, pluginPath,
|
|
28609
|
+
if (effectiveExclude && effectiveExclude.length > 0) {
|
|
28610
|
+
await copyDirectoryWithExclusions(sourceDir, destDir, pluginPath, effectiveExclude);
|
|
28539
28611
|
} else {
|
|
28540
28612
|
await cp(sourceDir, destDir, { recursive: true });
|
|
28541
28613
|
}
|
|
@@ -28588,6 +28660,64 @@ async function copyAgents(pluginPath, workspacePath, client, options2 = {}) {
|
|
|
28588
28660
|
});
|
|
28589
28661
|
return Promise.all(copyPromises);
|
|
28590
28662
|
}
|
|
28663
|
+
function relocatesGitHubContent(mapping) {
|
|
28664
|
+
return mapping.githubPath !== ".github/";
|
|
28665
|
+
}
|
|
28666
|
+
function githubContentExcludes(mapping, exclude) {
|
|
28667
|
+
const effectiveExclude = [...exclude ?? []];
|
|
28668
|
+
if (!relocatesGitHubContent(mapping)) {
|
|
28669
|
+
effectiveExclude.push(".github/plugin");
|
|
28670
|
+
}
|
|
28671
|
+
if (relocatesGitHubContent(mapping)) {
|
|
28672
|
+
effectiveExclude.push(".github/hooks");
|
|
28673
|
+
}
|
|
28674
|
+
return effectiveExclude.length > 0 ? effectiveExclude : undefined;
|
|
28675
|
+
}
|
|
28676
|
+
function isNotFoundError(error) {
|
|
28677
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
28678
|
+
}
|
|
28679
|
+
async function findRelocatedGitHubHooks(sources, workspacePath, client, options2 = {}) {
|
|
28680
|
+
const emptyResult = { found: [] };
|
|
28681
|
+
const mapping = getMapping(client, options2);
|
|
28682
|
+
if (options2.dryRun || !mapping.githubPath || !relocatesGitHubContent(mapping)) {
|
|
28683
|
+
return emptyResult;
|
|
28684
|
+
}
|
|
28685
|
+
const destDir = join13(workspacePath, mapping.githubPath, "hooks");
|
|
28686
|
+
const candidates = new Set;
|
|
28687
|
+
await Promise.all(sources.map(async ({ pluginPath, exclude }) => {
|
|
28688
|
+
const sourceRoot = join13(pluginPath, ".github", "hooks");
|
|
28689
|
+
async function collect(sourceDir) {
|
|
28690
|
+
let entries;
|
|
28691
|
+
try {
|
|
28692
|
+
entries = await readdir4(sourceDir, { withFileTypes: true });
|
|
28693
|
+
} catch (error) {
|
|
28694
|
+
if (isNotFoundError(error))
|
|
28695
|
+
return;
|
|
28696
|
+
throw error;
|
|
28697
|
+
}
|
|
28698
|
+
await Promise.all(entries.map(async (entry) => {
|
|
28699
|
+
const sourcePath = join13(sourceDir, entry.name);
|
|
28700
|
+
if (isExcluded(pluginPath, sourcePath, exclude))
|
|
28701
|
+
return;
|
|
28702
|
+
if (entry.isDirectory())
|
|
28703
|
+
return collect(sourcePath);
|
|
28704
|
+
const relativePath = relative3(sourceRoot, sourcePath);
|
|
28705
|
+
candidates.add(relativePath);
|
|
28706
|
+
}));
|
|
28707
|
+
}
|
|
28708
|
+
await collect(sourceRoot);
|
|
28709
|
+
}));
|
|
28710
|
+
const found = await Promise.all([...candidates].sort().map(async (relativePath) => {
|
|
28711
|
+
const destPath = join13(destDir, relativePath);
|
|
28712
|
+
try {
|
|
28713
|
+
await access(destPath);
|
|
28714
|
+
return destPath;
|
|
28715
|
+
} catch (error) {
|
|
28716
|
+
return isNotFoundError(error) ? undefined : destPath;
|
|
28717
|
+
}
|
|
28718
|
+
}));
|
|
28719
|
+
return { found: found.filter((path) => path !== undefined) };
|
|
28720
|
+
}
|
|
28591
28721
|
async function copyAndAdjustDirectory(sourceDir, destDir, sourceBase, pluginPath, skillsPath, skillNameMap, exclude) {
|
|
28592
28722
|
await mkdir6(destDir, { recursive: true });
|
|
28593
28723
|
const entries = await readdir4(sourceDir, { withFileTypes: true });
|
|
@@ -28627,13 +28757,14 @@ async function copyGitHubContent(pluginPath, workspacePath, client, options2 = {
|
|
|
28627
28757
|
return results;
|
|
28628
28758
|
}
|
|
28629
28759
|
const destDir = join13(workspacePath, mapping.githubPath);
|
|
28760
|
+
const effectiveExclude = githubContentExcludes(mapping, options2.exclude);
|
|
28630
28761
|
if (dryRun) {
|
|
28631
28762
|
results.push({ source: sourceDir, destination: destDir, action: "copied" });
|
|
28632
28763
|
return results;
|
|
28633
28764
|
}
|
|
28634
28765
|
try {
|
|
28635
|
-
if (mapping.skillsPath ||
|
|
28636
|
-
await copyAndAdjustDirectory(sourceDir, destDir, sourceDir, pluginPath, mapping.skillsPath ?? "", skillNameMap,
|
|
28766
|
+
if (mapping.skillsPath || effectiveExclude && effectiveExclude.length > 0) {
|
|
28767
|
+
await copyAndAdjustDirectory(sourceDir, destDir, sourceDir, pluginPath, mapping.skillsPath ?? "", skillNameMap, effectiveExclude);
|
|
28637
28768
|
} else {
|
|
28638
28769
|
await cp(sourceDir, destDir, { recursive: true });
|
|
28639
28770
|
}
|
|
@@ -28649,22 +28780,29 @@ async function copyGitHubContent(pluginPath, workspacePath, client, options2 = {
|
|
|
28649
28780
|
return results;
|
|
28650
28781
|
}
|
|
28651
28782
|
async function copyPluginToWorkspace(pluginPath, workspacePath, client, options2 = {}) {
|
|
28652
|
-
const {
|
|
28783
|
+
const {
|
|
28784
|
+
skillNameMap,
|
|
28785
|
+
syncMode,
|
|
28786
|
+
canonicalSkillsPath,
|
|
28787
|
+
fileArtifacts,
|
|
28788
|
+
...baseOptions
|
|
28789
|
+
} = options2;
|
|
28790
|
+
const shouldCopy = (artifact) => fileArtifacts?.[artifact] ?? true;
|
|
28653
28791
|
const [commandResults, skillResults, hookResults, agentResults] = await Promise.all([
|
|
28654
|
-
copyCommands(pluginPath, workspacePath, client, baseOptions),
|
|
28655
|
-
copySkills(pluginPath, workspacePath, client, {
|
|
28792
|
+
shouldCopy("commands") ? copyCommands(pluginPath, workspacePath, client, baseOptions) : [],
|
|
28793
|
+
shouldCopy("skills") ? copySkills(pluginPath, workspacePath, client, {
|
|
28656
28794
|
...baseOptions,
|
|
28657
28795
|
...skillNameMap && { skillNameMap },
|
|
28658
28796
|
...syncMode && { syncMode },
|
|
28659
28797
|
...canonicalSkillsPath && { canonicalSkillsPath }
|
|
28660
|
-
}),
|
|
28661
|
-
copyHooks(pluginPath, workspacePath, client, baseOptions),
|
|
28662
|
-
copyAgents(pluginPath, workspacePath, client, baseOptions)
|
|
28798
|
+
}) : [],
|
|
28799
|
+
shouldCopy("hooks") ? copyHooks(pluginPath, workspacePath, client, baseOptions) : [],
|
|
28800
|
+
shouldCopy("agents") ? copyAgents(pluginPath, workspacePath, client, baseOptions) : []
|
|
28663
28801
|
]);
|
|
28664
|
-
const githubResults = await copyGitHubContent(pluginPath, workspacePath, client, {
|
|
28802
|
+
const githubResults = shouldCopy("github") ? await copyGitHubContent(pluginPath, workspacePath, client, {
|
|
28665
28803
|
...baseOptions,
|
|
28666
28804
|
...skillNameMap && { skillNameMap }
|
|
28667
|
-
});
|
|
28805
|
+
}) : [];
|
|
28668
28806
|
return [
|
|
28669
28807
|
...commandResults,
|
|
28670
28808
|
...skillResults,
|
|
@@ -29756,6 +29894,8 @@ function collectMcpServers(validatedPlugins, workspaceServers, targetClient) {
|
|
|
29756
29894
|
const servers = new Map;
|
|
29757
29895
|
const warnings = [];
|
|
29758
29896
|
for (const plugin of validatedPlugins) {
|
|
29897
|
+
if (plugin.fileArtifacts?.mcpServers === false)
|
|
29898
|
+
continue;
|
|
29759
29899
|
const mcpServers = readPluginMcpConfig(plugin.resolved);
|
|
29760
29900
|
if (!mcpServers)
|
|
29761
29901
|
continue;
|
|
@@ -30259,7 +30399,7 @@ var init_codex_mcp = __esm(() => {
|
|
|
30259
30399
|
// src/core/codex-hooks.ts
|
|
30260
30400
|
import { existsSync as existsSync17, mkdirSync as mkdirSync4, readFileSync as readFileSync3, unlinkSync, writeFileSync as writeFileSync4 } from "node:fs";
|
|
30261
30401
|
import { basename as basename8, dirname as dirname9, isAbsolute as isAbsolute4, join as join19, normalize as normalize4 } from "node:path";
|
|
30262
|
-
function
|
|
30402
|
+
function isRecord2(value) {
|
|
30263
30403
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
30264
30404
|
}
|
|
30265
30405
|
function cloneJson(value) {
|
|
@@ -30285,7 +30425,7 @@ function orderedHooks(hooks) {
|
|
|
30285
30425
|
return ordered;
|
|
30286
30426
|
}
|
|
30287
30427
|
function normalizeHooksObject(value, source, warnings, options2) {
|
|
30288
|
-
if (!
|
|
30428
|
+
if (!isRecord2(value) || !isRecord2(value.hooks)) {
|
|
30289
30429
|
warnings.push(`Codex hooks: ${source} must contain a hooks object`);
|
|
30290
30430
|
return null;
|
|
30291
30431
|
}
|
|
@@ -30350,7 +30490,7 @@ function substitutePluginEnv(value, env2) {
|
|
|
30350
30490
|
if (Array.isArray(value)) {
|
|
30351
30491
|
return value.map((entry) => substitutePluginEnv(entry, env2));
|
|
30352
30492
|
}
|
|
30353
|
-
if (
|
|
30493
|
+
if (isRecord2(value)) {
|
|
30354
30494
|
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, substitutePluginEnv(entry, env2)]));
|
|
30355
30495
|
}
|
|
30356
30496
|
return value;
|
|
@@ -30373,7 +30513,7 @@ function readManifestHookDeclarations(pluginPath, manifestPath, warnings) {
|
|
|
30373
30513
|
let manifest;
|
|
30374
30514
|
try {
|
|
30375
30515
|
const parsed = JSON.parse(readFileSync3(manifestPath, "utf-8"));
|
|
30376
|
-
if (!
|
|
30516
|
+
if (!isRecord2(parsed)) {
|
|
30377
30517
|
warnings.push(`Codex hooks: ${manifestPath} must contain a JSON object`);
|
|
30378
30518
|
return null;
|
|
30379
30519
|
}
|
|
@@ -30394,13 +30534,13 @@ function readManifestHookDeclarations(pluginPath, manifestPath, warnings) {
|
|
|
30394
30534
|
const paths = hooks.map((entry) => resolveManifestPath(pluginPath, "hooks", entry, warnings)).filter((entry) => entry !== null);
|
|
30395
30535
|
return paths.length > 0 ? paths.map((path) => ({ path })) : null;
|
|
30396
30536
|
}
|
|
30397
|
-
if (Array.isArray(hooks) && hooks.every(
|
|
30537
|
+
if (Array.isArray(hooks) && hooks.every(isRecord2)) {
|
|
30398
30538
|
const inline = hooks.map((entry, index) => normalizeHooksObject(entry, `${manifestPath}#hooks[${index}]`, warnings, {
|
|
30399
30539
|
filterCodexEvents: true
|
|
30400
30540
|
})).filter((entry) => entry !== null && hasHooks(entry));
|
|
30401
30541
|
return inline.length > 0 ? inline.map((entry) => ({ inline: entry })) : null;
|
|
30402
30542
|
}
|
|
30403
|
-
if (
|
|
30543
|
+
if (isRecord2(hooks)) {
|
|
30404
30544
|
const inline = normalizeHooksObject(hooks, `${manifestPath}#hooks`, warnings, {
|
|
30405
30545
|
filterCodexEvents: true
|
|
30406
30546
|
});
|
|
@@ -30481,7 +30621,7 @@ function writeProjectHooks(hooksPath, hooksFile) {
|
|
|
30481
30621
|
`, "utf-8");
|
|
30482
30622
|
}
|
|
30483
30623
|
function pluginTargetsCodex(plugin) {
|
|
30484
|
-
return plugin.clients.includes("codex");
|
|
30624
|
+
return plugin.clients.includes("codex") && plugin.fileArtifacts?.hooks !== false;
|
|
30485
30625
|
}
|
|
30486
30626
|
function syncCodexProjectHooks(validatedPlugins, workspacePath, previousManagedHooks, options2 = {}) {
|
|
30487
30627
|
const warnings = [];
|
|
@@ -30548,9 +30688,146 @@ var init_codex_hooks = __esm(() => {
|
|
|
30548
30688
|
CODEX_HOOK_EVENTS = new Set(CODEX_HOOK_EVENT_ORDER);
|
|
30549
30689
|
});
|
|
30550
30690
|
|
|
30691
|
+
// src/core/copilot-hooks.ts
|
|
30692
|
+
import { existsSync as existsSync18 } from "node:fs";
|
|
30693
|
+
import { mkdir as mkdir8, readFile as readFile13, readdir as readdir6, writeFile as writeFile9 } from "node:fs/promises";
|
|
30694
|
+
import { dirname as dirname10, join as join20 } from "node:path";
|
|
30695
|
+
function isRecord3(value) {
|
|
30696
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
30697
|
+
}
|
|
30698
|
+
function parseHooksFile(content, source, warnings) {
|
|
30699
|
+
let parsed;
|
|
30700
|
+
try {
|
|
30701
|
+
parsed = JSON.parse(content);
|
|
30702
|
+
} catch (error) {
|
|
30703
|
+
warnings.push(`Copilot hooks: failed to parse ${source}: ${error instanceof Error ? error.message : String(error)}`);
|
|
30704
|
+
return null;
|
|
30705
|
+
}
|
|
30706
|
+
if (!isRecord3(parsed) || parsed.version !== 1 || !isRecord3(parsed.hooks)) {
|
|
30707
|
+
warnings.push(`Copilot hooks: ${source} must contain version 1 and a hooks object`);
|
|
30708
|
+
return null;
|
|
30709
|
+
}
|
|
30710
|
+
if (parsed.disableAllHooks === true) {
|
|
30711
|
+
return { version: 1, hooks: {} };
|
|
30712
|
+
}
|
|
30713
|
+
const hooks = {};
|
|
30714
|
+
for (const [eventName, entries] of Object.entries(parsed.hooks)) {
|
|
30715
|
+
if (!Array.isArray(entries)) {
|
|
30716
|
+
warnings.push(`Copilot hooks: event '${eventName}' in ${source} must be an array`);
|
|
30717
|
+
return null;
|
|
30718
|
+
}
|
|
30719
|
+
hooks[eventName] = entries;
|
|
30720
|
+
}
|
|
30721
|
+
return { version: 1, hooks };
|
|
30722
|
+
}
|
|
30723
|
+
function withPluginRoot(hooksFile, pluginRoot) {
|
|
30724
|
+
const hooks = Object.fromEntries(Object.entries(hooksFile.hooks).map(([eventName, entries]) => [
|
|
30725
|
+
eventName,
|
|
30726
|
+
entries.map((entry) => {
|
|
30727
|
+
if (!isRecord3(entry))
|
|
30728
|
+
return entry;
|
|
30729
|
+
const existingEnv = isRecord3(entry.env) ? entry.env : {};
|
|
30730
|
+
return {
|
|
30731
|
+
...entry,
|
|
30732
|
+
env: {
|
|
30733
|
+
...existingEnv,
|
|
30734
|
+
COPILOT_PLUGIN_ROOT: pluginRoot
|
|
30735
|
+
}
|
|
30736
|
+
};
|
|
30737
|
+
})
|
|
30738
|
+
]));
|
|
30739
|
+
return { version: 1, hooks };
|
|
30740
|
+
}
|
|
30741
|
+
async function collectPluginHooks(plugin, warnings) {
|
|
30742
|
+
const relativePath = PLUGIN_HOOK_PATHS.find((candidate) => existsSync18(join20(plugin.resolved, candidate)));
|
|
30743
|
+
if (!relativePath)
|
|
30744
|
+
return null;
|
|
30745
|
+
const hooksPath = join20(plugin.resolved, relativePath);
|
|
30746
|
+
if (isExcluded(plugin.resolved, hooksPath, plugin.exclude))
|
|
30747
|
+
return null;
|
|
30748
|
+
let hooksFile;
|
|
30749
|
+
try {
|
|
30750
|
+
hooksFile = parseHooksFile(await readFile13(hooksPath, "utf-8"), hooksPath, warnings);
|
|
30751
|
+
} catch (error) {
|
|
30752
|
+
warnings.push(`Copilot hooks: failed to read ${hooksPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
30753
|
+
return null;
|
|
30754
|
+
}
|
|
30755
|
+
if (!hooksFile)
|
|
30756
|
+
return null;
|
|
30757
|
+
if (await hasExcludedHookPayload(plugin))
|
|
30758
|
+
return null;
|
|
30759
|
+
return withPluginRoot(hooksFile, plugin.resolved);
|
|
30760
|
+
}
|
|
30761
|
+
async function hasExcludedHookPayload(plugin) {
|
|
30762
|
+
if (!plugin.exclude || plugin.exclude.length === 0)
|
|
30763
|
+
return false;
|
|
30764
|
+
const hooksDir = join20(plugin.resolved, "hooks");
|
|
30765
|
+
if (!existsSync18(hooksDir))
|
|
30766
|
+
return false;
|
|
30767
|
+
async function visit(directory) {
|
|
30768
|
+
const entries = await readdir6(directory, { withFileTypes: true });
|
|
30769
|
+
for (const entry of entries) {
|
|
30770
|
+
const sourcePath = join20(directory, entry.name);
|
|
30771
|
+
if (isExcluded(plugin.resolved, sourcePath, plugin.exclude))
|
|
30772
|
+
return true;
|
|
30773
|
+
if (entry.isDirectory() && await visit(sourcePath))
|
|
30774
|
+
return true;
|
|
30775
|
+
}
|
|
30776
|
+
return false;
|
|
30777
|
+
}
|
|
30778
|
+
return visit(hooksDir);
|
|
30779
|
+
}
|
|
30780
|
+
function pluginTargetsCopilot(plugin) {
|
|
30781
|
+
return plugin.success && plugin.clients.includes("copilot") && plugin.fileArtifacts?.hooks !== false;
|
|
30782
|
+
}
|
|
30783
|
+
function mergeHooks2(files) {
|
|
30784
|
+
const hooks = {};
|
|
30785
|
+
for (const file of files) {
|
|
30786
|
+
for (const [eventName, entries] of Object.entries(file.hooks)) {
|
|
30787
|
+
if (entries.length === 0)
|
|
30788
|
+
continue;
|
|
30789
|
+
hooks[eventName] = [...hooks[eventName] ?? [], ...entries];
|
|
30790
|
+
}
|
|
30791
|
+
}
|
|
30792
|
+
return { version: 1, hooks };
|
|
30793
|
+
}
|
|
30794
|
+
async function syncCopilotProjectHooks(validatedPlugins, workspacePath, options2 = {}) {
|
|
30795
|
+
const warnings = [];
|
|
30796
|
+
const hookFiles = await Promise.all(validatedPlugins.filter(pluginTargetsCopilot).map((plugin) => collectPluginHooks(plugin, warnings)));
|
|
30797
|
+
const merged = mergeHooks2(hookFiles.filter((file) => file !== null));
|
|
30798
|
+
if (Object.keys(merged.hooks).length === 0) {
|
|
30799
|
+
return { copyResults: [], warnings };
|
|
30800
|
+
}
|
|
30801
|
+
const hooksPath = join20(workspacePath, COPILOT_MANAGED_HOOKS_RELATIVE_PATH);
|
|
30802
|
+
if (existsSync18(hooksPath) && !options2.previouslyManaged) {
|
|
30803
|
+
warnings.push(`Copilot hooks: not updating ${COPILOT_MANAGED_HOOKS_RELATIVE_PATH} because the existing file is not owned by AllAgents`);
|
|
30804
|
+
return { copyResults: [], warnings };
|
|
30805
|
+
}
|
|
30806
|
+
if (!options2.dryRun) {
|
|
30807
|
+
await mkdir8(dirname10(hooksPath), { recursive: true });
|
|
30808
|
+
await writeFile9(hooksPath, `${JSON.stringify(merged, null, 2)}
|
|
30809
|
+
`, "utf-8");
|
|
30810
|
+
}
|
|
30811
|
+
return {
|
|
30812
|
+
copyResults: [
|
|
30813
|
+
{
|
|
30814
|
+
source: "copilot-plugin-hooks",
|
|
30815
|
+
destination: hooksPath,
|
|
30816
|
+
action: "generated"
|
|
30817
|
+
}
|
|
30818
|
+
],
|
|
30819
|
+
warnings
|
|
30820
|
+
};
|
|
30821
|
+
}
|
|
30822
|
+
var COPILOT_MANAGED_HOOKS_RELATIVE_PATH = ".github/hooks/allagents.json", PLUGIN_HOOK_PATHS;
|
|
30823
|
+
var init_copilot_hooks = __esm(() => {
|
|
30824
|
+
init_transform();
|
|
30825
|
+
PLUGIN_HOOK_PATHS = ["hooks.json", "hooks/hooks.json"];
|
|
30826
|
+
});
|
|
30827
|
+
|
|
30551
30828
|
// src/core/claude-mcp.ts
|
|
30552
|
-
import { existsSync as
|
|
30553
|
-
import { dirname as
|
|
30829
|
+
import { existsSync as existsSync19, readFileSync as readFileSync4, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5 } from "node:fs";
|
|
30830
|
+
import { dirname as dirname11 } from "node:path";
|
|
30554
30831
|
function deepEqual2(a, b) {
|
|
30555
30832
|
if (a === b)
|
|
30556
30833
|
return true;
|
|
@@ -30617,7 +30894,7 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
|
|
|
30617
30894
|
trackedServers: []
|
|
30618
30895
|
};
|
|
30619
30896
|
let existingConfig = {};
|
|
30620
|
-
if (
|
|
30897
|
+
if (existsSync19(configPath)) {
|
|
30621
30898
|
try {
|
|
30622
30899
|
const content = readFileSync4(configPath, "utf-8");
|
|
30623
30900
|
existingConfig = import_json52.default.parse(content);
|
|
@@ -30667,8 +30944,8 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
|
|
|
30667
30944
|
const hasChanges = result.added > 0 || result.overwritten > 0 || result.removed > 0;
|
|
30668
30945
|
if (hasChanges && !dryRun) {
|
|
30669
30946
|
existingConfig.mcpServers = existingServers;
|
|
30670
|
-
const dir =
|
|
30671
|
-
if (!
|
|
30947
|
+
const dir = dirname11(configPath);
|
|
30948
|
+
if (!existsSync19(dir)) {
|
|
30672
30949
|
mkdirSync5(dir, { recursive: true });
|
|
30673
30950
|
}
|
|
30674
30951
|
writeFileSync5(configPath, `${JSON.stringify(existingConfig, null, 2)}
|
|
@@ -30685,8 +30962,8 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
|
|
|
30685
30962
|
}
|
|
30686
30963
|
if (result.removed > 0 && !dryRun) {
|
|
30687
30964
|
existingConfig.mcpServers = existingServers;
|
|
30688
|
-
const dir =
|
|
30689
|
-
if (!
|
|
30965
|
+
const dir = dirname11(configPath);
|
|
30966
|
+
if (!existsSync19(dir)) {
|
|
30690
30967
|
mkdirSync5(dir, { recursive: true });
|
|
30691
30968
|
}
|
|
30692
30969
|
writeFileSync5(configPath, `${JSON.stringify(existingConfig, null, 2)}
|
|
@@ -30785,41 +31062,41 @@ var init_claude_mcp = __esm(() => {
|
|
|
30785
31062
|
});
|
|
30786
31063
|
|
|
30787
31064
|
// src/core/copilot-mcp.ts
|
|
30788
|
-
import { join as
|
|
31065
|
+
import { join as join21 } from "node:path";
|
|
30789
31066
|
function getCopilotMcpConfigPath() {
|
|
30790
|
-
return
|
|
31067
|
+
return join21(getHomeDir(), ".copilot", "mcp-config.json");
|
|
30791
31068
|
}
|
|
30792
31069
|
var init_copilot_mcp = __esm(() => {
|
|
30793
31070
|
init_constants();
|
|
30794
31071
|
});
|
|
30795
31072
|
|
|
30796
31073
|
// src/core/mcp-sync.ts
|
|
30797
|
-
import { existsSync as
|
|
30798
|
-
import { join as
|
|
31074
|
+
import { existsSync as existsSync20 } from "node:fs";
|
|
31075
|
+
import { join as join22 } from "node:path";
|
|
30799
31076
|
function buildSyncSpecs(workspacePath) {
|
|
30800
31077
|
return [
|
|
30801
31078
|
{
|
|
30802
31079
|
client: "vscode",
|
|
30803
31080
|
scope: "vscode",
|
|
30804
|
-
configPath:
|
|
31081
|
+
configPath: join22(workspacePath, ".vscode", "mcp.json"),
|
|
30805
31082
|
syncFn: syncVscodeMcpConfig
|
|
30806
31083
|
},
|
|
30807
31084
|
{
|
|
30808
31085
|
client: "claude",
|
|
30809
31086
|
scope: "claude",
|
|
30810
|
-
configPath:
|
|
31087
|
+
configPath: join22(workspacePath, ".mcp.json"),
|
|
30811
31088
|
syncFn: syncClaudeMcpConfig
|
|
30812
31089
|
},
|
|
30813
31090
|
{
|
|
30814
31091
|
client: "codex",
|
|
30815
31092
|
scope: "codex",
|
|
30816
|
-
configPath:
|
|
31093
|
+
configPath: join22(workspacePath, ".codex", "config.toml"),
|
|
30817
31094
|
syncFn: syncCodexProjectMcpConfig
|
|
30818
31095
|
},
|
|
30819
31096
|
{
|
|
30820
31097
|
client: "copilot",
|
|
30821
31098
|
scope: "copilot",
|
|
30822
|
-
configPath:
|
|
31099
|
+
configPath: join22(workspacePath, ".copilot", "mcp-config.json"),
|
|
30823
31100
|
syncFn: syncClaudeMcpConfig
|
|
30824
31101
|
}
|
|
30825
31102
|
];
|
|
@@ -30874,8 +31151,8 @@ function syncMcpServers(workspacePath, validPlugins, config, previousState, sync
|
|
|
30874
31151
|
async function syncMcpOnly(workspacePath = process.cwd(), options2 = {}) {
|
|
30875
31152
|
const { offline = false, dryRun = false } = options2;
|
|
30876
31153
|
await migrateWorkspaceSkillsV1toV2(workspacePath);
|
|
30877
|
-
const configPath =
|
|
30878
|
-
if (!
|
|
31154
|
+
const configPath = join22(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
31155
|
+
if (!existsSync20(configPath)) {
|
|
30879
31156
|
return {
|
|
30880
31157
|
success: false,
|
|
30881
31158
|
mcpResults: {},
|
|
@@ -31249,9 +31526,9 @@ function padStart2(str3, len) {
|
|
|
31249
31526
|
}
|
|
31250
31527
|
|
|
31251
31528
|
// src/core/managed-repos.ts
|
|
31252
|
-
import { existsSync as
|
|
31253
|
-
import { mkdir as
|
|
31254
|
-
import { dirname as
|
|
31529
|
+
import { existsSync as existsSync21 } from "node:fs";
|
|
31530
|
+
import { mkdir as mkdir9 } from "node:fs/promises";
|
|
31531
|
+
import { dirname as dirname12, resolve as resolve11 } from "node:path";
|
|
31255
31532
|
function expandHome(p) {
|
|
31256
31533
|
if (p.startsWith("~/") || p === "~") {
|
|
31257
31534
|
return p.replace("~", getHomeDir());
|
|
@@ -31294,7 +31571,7 @@ function buildCloneUrl(source, repo) {
|
|
|
31294
31571
|
}
|
|
31295
31572
|
}
|
|
31296
31573
|
async function cloneRepo(url, dest, branch) {
|
|
31297
|
-
await
|
|
31574
|
+
await mkdir9(dirname12(dest), { recursive: true });
|
|
31298
31575
|
const git = esm_default({ timeout: { block: CLONE_TIMEOUT_MS2 } }).env(createGitEnv());
|
|
31299
31576
|
const cloneOptions = branch ? ["--branch", branch] : [];
|
|
31300
31577
|
await git.clone(url, dest, cloneOptions);
|
|
@@ -31333,7 +31610,7 @@ async function processManagedRepos(repositories, workspacePath, options2 = {}) {
|
|
|
31333
31610
|
}
|
|
31334
31611
|
const expandedPath = expandHome(repo.path);
|
|
31335
31612
|
const absolutePath = resolve11(workspacePath, expandedPath);
|
|
31336
|
-
if (!
|
|
31613
|
+
if (!existsSync21(absolutePath)) {
|
|
31337
31614
|
if (!shouldClone(repo.managed)) {
|
|
31338
31615
|
results.push({ path: repo.path, repo: repo.repo, action: "skipped" });
|
|
31339
31616
|
continue;
|
|
@@ -31385,9 +31662,9 @@ var init_managed_repos = __esm(() => {
|
|
|
31385
31662
|
});
|
|
31386
31663
|
|
|
31387
31664
|
// src/core/sync.ts
|
|
31388
|
-
import { existsSync as
|
|
31665
|
+
import { existsSync as existsSync22, readFileSync as readFileSync5, writeFileSync as writeFileSync6, lstatSync as lstatSync3 } from "node:fs";
|
|
31389
31666
|
import { rm as rm4, unlink as unlink2, rmdir, copyFile } from "node:fs/promises";
|
|
31390
|
-
import { join as
|
|
31667
|
+
import { join as join23, resolve as resolve12, dirname as dirname13, relative as relative6 } from "node:path";
|
|
31391
31668
|
function deduplicateClientsByPath(clients, clientMappings = CLIENT_MAPPINGS) {
|
|
31392
31669
|
const pathToClients = new Map;
|
|
31393
31670
|
for (const client of clients) {
|
|
@@ -31550,7 +31827,7 @@ async function selectivePurgeWorkspace(workspacePath, state, clients) {
|
|
|
31550
31827
|
const previousFiles = getPreviouslySyncedFiles(state, client);
|
|
31551
31828
|
const purgedPaths = [];
|
|
31552
31829
|
for (const filePath of previousFiles) {
|
|
31553
|
-
const fullPath =
|
|
31830
|
+
const fullPath = join23(workspacePath, filePath);
|
|
31554
31831
|
const cleanPath = fullPath.replace(/\/$/, "");
|
|
31555
31832
|
let stats;
|
|
31556
31833
|
try {
|
|
@@ -31577,16 +31854,16 @@ async function selectivePurgeWorkspace(workspacePath, state, clients) {
|
|
|
31577
31854
|
return result;
|
|
31578
31855
|
}
|
|
31579
31856
|
async function cleanupEmptyParents(workspacePath, filePath) {
|
|
31580
|
-
let parentPath =
|
|
31857
|
+
let parentPath = dirname13(filePath);
|
|
31581
31858
|
while (parentPath && parentPath !== "." && parentPath !== "/") {
|
|
31582
|
-
const fullParentPath =
|
|
31583
|
-
if (!
|
|
31584
|
-
parentPath =
|
|
31859
|
+
const fullParentPath = join23(workspacePath, parentPath);
|
|
31860
|
+
if (!existsSync22(fullParentPath)) {
|
|
31861
|
+
parentPath = dirname13(parentPath);
|
|
31585
31862
|
continue;
|
|
31586
31863
|
}
|
|
31587
31864
|
try {
|
|
31588
31865
|
await rmdir(fullParentPath);
|
|
31589
|
-
parentPath =
|
|
31866
|
+
parentPath = dirname13(parentPath);
|
|
31590
31867
|
} catch {
|
|
31591
31868
|
break;
|
|
31592
31869
|
}
|
|
@@ -31665,8 +31942,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
31665
31942
|
errors2.push(`Cannot resolve file '${file}' - no workspace.source configured`);
|
|
31666
31943
|
continue;
|
|
31667
31944
|
}
|
|
31668
|
-
const fullPath =
|
|
31669
|
-
if (!
|
|
31945
|
+
const fullPath = join23(defaultSourcePath, file);
|
|
31946
|
+
if (!existsSync22(fullPath)) {
|
|
31670
31947
|
errors2.push(`File source not found: ${fullPath}`);
|
|
31671
31948
|
}
|
|
31672
31949
|
continue;
|
|
@@ -31684,8 +31961,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
31684
31961
|
errors2.push(`GitHub cache not found for ${cacheKey}`);
|
|
31685
31962
|
continue;
|
|
31686
31963
|
}
|
|
31687
|
-
const fullPath =
|
|
31688
|
-
if (!
|
|
31964
|
+
const fullPath = join23(cachePath, parsed.filePath);
|
|
31965
|
+
if (!existsSync22(fullPath)) {
|
|
31689
31966
|
errors2.push(`Path not found in repository: ${cacheKey}/${parsed.filePath}`);
|
|
31690
31967
|
}
|
|
31691
31968
|
} else {
|
|
@@ -31695,11 +31972,11 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
31695
31972
|
} else if (file.source.startsWith("../")) {
|
|
31696
31973
|
fullPath = resolve12(file.source);
|
|
31697
31974
|
} else if (defaultSourcePath) {
|
|
31698
|
-
fullPath =
|
|
31975
|
+
fullPath = join23(defaultSourcePath, file.source);
|
|
31699
31976
|
} else {
|
|
31700
31977
|
fullPath = resolve12(file.source);
|
|
31701
31978
|
}
|
|
31702
|
-
if (!
|
|
31979
|
+
if (!existsSync22(fullPath)) {
|
|
31703
31980
|
errors2.push(`File source not found: ${fullPath}`);
|
|
31704
31981
|
}
|
|
31705
31982
|
}
|
|
@@ -31708,8 +31985,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
31708
31985
|
errors2.push(`Cannot resolve file '${file.dest}' - no workspace.source configured and no explicit source provided`);
|
|
31709
31986
|
continue;
|
|
31710
31987
|
}
|
|
31711
|
-
const fullPath =
|
|
31712
|
-
if (!
|
|
31988
|
+
const fullPath = join23(defaultSourcePath, file.dest ?? "");
|
|
31989
|
+
if (!existsSync22(fullPath)) {
|
|
31713
31990
|
errors2.push(`File source not found: ${fullPath}`);
|
|
31714
31991
|
}
|
|
31715
31992
|
}
|
|
@@ -31805,6 +32082,8 @@ function computeDeletedArtifacts(previousState, newStatePaths, clients, clientMa
|
|
|
31805
32082
|
async function collectAvailableSkillNames(validPlugins, warnings) {
|
|
31806
32083
|
const names = new Set;
|
|
31807
32084
|
for (const plugin of validPlugins) {
|
|
32085
|
+
if (plugin.fileArtifacts && !plugin.fileArtifacts.skills)
|
|
32086
|
+
continue;
|
|
31808
32087
|
const skills = await collectPluginSkills(plugin.resolved, plugin.plugin, undefined, undefined, undefined, undefined, warnings);
|
|
31809
32088
|
for (const skill of skills) {
|
|
31810
32089
|
names.add(skill.folderName);
|
|
@@ -31838,6 +32117,9 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
|
|
|
31838
32117
|
...resolved.registeredAs && { registeredAs: resolved.registeredAs },
|
|
31839
32118
|
...resolved.marketplaceSource && {
|
|
31840
32119
|
marketplaceSource: resolved.marketplaceSource
|
|
32120
|
+
},
|
|
32121
|
+
...resolved.fileArtifacts && {
|
|
32122
|
+
fileArtifacts: resolved.fileArtifacts
|
|
31841
32123
|
}
|
|
31842
32124
|
};
|
|
31843
32125
|
}
|
|
@@ -31857,17 +32139,19 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
|
|
|
31857
32139
|
...fetchResult.error && { error: fetchResult.error }
|
|
31858
32140
|
};
|
|
31859
32141
|
}
|
|
31860
|
-
const resolvedPath2 = parsed?.subpath ?
|
|
32142
|
+
const resolvedPath2 = parsed?.subpath ? join23(fetchResult.cachePath, parsed.subpath) : fetchResult.cachePath;
|
|
32143
|
+
const fileArtifacts2 = await getEmbeddedMarketplaceFileArtifacts(resolvedPath2, parsed?.repo);
|
|
31861
32144
|
return {
|
|
31862
32145
|
plugin: pluginSource,
|
|
31863
32146
|
resolved: resolvedPath2,
|
|
31864
32147
|
success: true,
|
|
31865
32148
|
clients: [],
|
|
31866
|
-
nativeClients: []
|
|
32149
|
+
nativeClients: [],
|
|
32150
|
+
...fileArtifacts2 && { fileArtifacts: fileArtifacts2 }
|
|
31867
32151
|
};
|
|
31868
32152
|
}
|
|
31869
32153
|
const resolvedPath = resolve12(workspacePath, pluginSource);
|
|
31870
|
-
if (!
|
|
32154
|
+
if (!existsSync22(resolvedPath)) {
|
|
31871
32155
|
return {
|
|
31872
32156
|
plugin: pluginSource,
|
|
31873
32157
|
resolved: resolvedPath,
|
|
@@ -31877,12 +32161,14 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
|
|
|
31877
32161
|
error: `Plugin not found at ${resolvedPath}`
|
|
31878
32162
|
};
|
|
31879
32163
|
}
|
|
32164
|
+
const fileArtifacts = await getEmbeddedMarketplaceFileArtifacts(resolvedPath, getPluginName(resolvedPath));
|
|
31880
32165
|
return {
|
|
31881
32166
|
plugin: pluginSource,
|
|
31882
32167
|
resolved: resolvedPath,
|
|
31883
32168
|
success: true,
|
|
31884
32169
|
clients: [],
|
|
31885
|
-
nativeClients: []
|
|
32170
|
+
nativeClients: [],
|
|
32171
|
+
...fileArtifacts && { fileArtifacts }
|
|
31886
32172
|
};
|
|
31887
32173
|
}
|
|
31888
32174
|
function buildPluginSyncPlans(plugins, clientEntries, scope) {
|
|
@@ -31962,7 +32248,10 @@ async function copyValidatedPlugin(validatedPlugin, workspacePath, clients, dryR
|
|
|
31962
32248
|
...skillNameMap && { skillNameMap },
|
|
31963
32249
|
clientMappings: mappings,
|
|
31964
32250
|
syncMode: "copy",
|
|
31965
|
-
...exclude && { exclude }
|
|
32251
|
+
...exclude && { exclude },
|
|
32252
|
+
...validatedPlugin.fileArtifacts && {
|
|
32253
|
+
fileArtifacts: validatedPlugin.fileArtifacts
|
|
32254
|
+
}
|
|
31966
32255
|
});
|
|
31967
32256
|
copyResults.push(...results);
|
|
31968
32257
|
} else {
|
|
@@ -31972,7 +32261,10 @@ async function copyValidatedPlugin(validatedPlugin, workspacePath, clients, dryR
|
|
|
31972
32261
|
clientMappings: mappings,
|
|
31973
32262
|
syncMode: "symlink",
|
|
31974
32263
|
canonicalSkillsPath: CANONICAL_SKILLS_PATH,
|
|
31975
|
-
...exclude && { exclude }
|
|
32264
|
+
...exclude && { exclude },
|
|
32265
|
+
...validatedPlugin.fileArtifacts && {
|
|
32266
|
+
fileArtifacts: validatedPlugin.fileArtifacts
|
|
32267
|
+
}
|
|
31976
32268
|
});
|
|
31977
32269
|
copyResults.push(...results);
|
|
31978
32270
|
}
|
|
@@ -31985,7 +32277,10 @@ async function copyValidatedPlugin(validatedPlugin, workspacePath, clients, dryR
|
|
|
31985
32277
|
...skillNameMap && { skillNameMap },
|
|
31986
32278
|
clientMappings: mappings,
|
|
31987
32279
|
syncMode: "copy",
|
|
31988
|
-
...exclude && { exclude }
|
|
32280
|
+
...exclude && { exclude },
|
|
32281
|
+
...validatedPlugin.fileArtifacts && {
|
|
32282
|
+
fileArtifacts: validatedPlugin.fileArtifacts
|
|
32283
|
+
}
|
|
31989
32284
|
});
|
|
31990
32285
|
copyResults.push(...results);
|
|
31991
32286
|
}
|
|
@@ -32001,6 +32296,8 @@ async function copyValidatedPlugin(validatedPlugin, workspacePath, clients, dryR
|
|
|
32001
32296
|
async function collectAllSkills(validatedPlugins, disabledSkills, enabledSkills, warnings) {
|
|
32002
32297
|
const allSkills = [];
|
|
32003
32298
|
for (const plugin of validatedPlugins) {
|
|
32299
|
+
if (plugin.fileArtifacts && !plugin.fileArtifacts.skills)
|
|
32300
|
+
continue;
|
|
32004
32301
|
const pluginName = plugin.pluginName ?? getPluginName(plugin.resolved);
|
|
32005
32302
|
const skills = await collectPluginSkills(plugin.resolved, plugin.plugin, disabledSkills, pluginName, enabledSkills, plugin.pluginSkillsConfig, warnings);
|
|
32006
32303
|
for (const skill of skills) {
|
|
@@ -32040,10 +32337,10 @@ function buildPluginSkillNameMaps(allSkills) {
|
|
|
32040
32337
|
return pluginMaps;
|
|
32041
32338
|
}
|
|
32042
32339
|
function generateVscodeWorkspaceFile(workspacePath, config) {
|
|
32043
|
-
const configDir =
|
|
32044
|
-
const templatePath =
|
|
32340
|
+
const configDir = join23(workspacePath, CONFIG_DIR);
|
|
32341
|
+
const templatePath = join23(configDir, VSCODE_TEMPLATE_FILE);
|
|
32045
32342
|
let template;
|
|
32046
|
-
if (
|
|
32343
|
+
if (existsSync22(templatePath)) {
|
|
32047
32344
|
try {
|
|
32048
32345
|
template = import_json53.default.parse(readFileSync5(templatePath, "utf-8"));
|
|
32049
32346
|
} catch (error) {
|
|
@@ -32198,7 +32495,7 @@ async function syncVscodeWorkspaceFile(workspacePath, config, configPath, previo
|
|
|
32198
32495
|
let updatedConfig = config;
|
|
32199
32496
|
if (previousState?.vscodeWorkspaceHash && previousState?.vscodeWorkspaceRepos) {
|
|
32200
32497
|
const outputPath = getWorkspaceOutputPath(workspacePath, config.vscode);
|
|
32201
|
-
if (
|
|
32498
|
+
if (existsSync22(outputPath)) {
|
|
32202
32499
|
const existingContent = readFileSync5(outputPath, "utf-8");
|
|
32203
32500
|
const currentHash = computeWorkspaceHash(existingContent);
|
|
32204
32501
|
if (currentHash !== previousState.vscodeWorkspaceHash) {
|
|
@@ -32314,9 +32611,9 @@ async function syncWorkspace(workspacePath = process.cwd(), options2 = {}) {
|
|
|
32314
32611
|
skipManaged = false
|
|
32315
32612
|
} = options2;
|
|
32316
32613
|
const sw = new Stopwatch;
|
|
32317
|
-
const configDir =
|
|
32318
|
-
const configPath =
|
|
32319
|
-
if (!
|
|
32614
|
+
const configDir = join23(workspacePath, CONFIG_DIR);
|
|
32615
|
+
const configPath = join23(configDir, WORKSPACE_CONFIG_FILE);
|
|
32616
|
+
if (!existsSync22(configPath)) {
|
|
32320
32617
|
return failedSyncResult(`${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
|
|
32321
32618
|
Run 'allagents workspace init <path>' to create a new workspace`);
|
|
32322
32619
|
}
|
|
@@ -32408,7 +32705,15 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
32408
32705
|
dryRun
|
|
32409
32706
|
}));
|
|
32410
32707
|
warnings.push(...codexHookSync.warnings);
|
|
32411
|
-
const
|
|
32708
|
+
const copilotHookSync = await sw.measure("copilot-hooks-sync", () => syncCopilotProjectHooks(validPlugins, workspacePath, {
|
|
32709
|
+
dryRun,
|
|
32710
|
+
previouslyManaged: getPreviouslySyncedFiles(previousState, "copilot").includes(COPILOT_MANAGED_HOOKS_RELATIVE_PATH)
|
|
32711
|
+
}));
|
|
32712
|
+
warnings.push(...copilotHookSync.warnings);
|
|
32713
|
+
const workspaceFileResults = [
|
|
32714
|
+
...codexHookSync.copyResults,
|
|
32715
|
+
...copilotHookSync.copyResults
|
|
32716
|
+
];
|
|
32412
32717
|
let writtenSkillsIndexFiles = [];
|
|
32413
32718
|
const skipWorkspaceFiles = !!config.workspace?.source && !validatedWorkspaceSource;
|
|
32414
32719
|
if (config.workspace && !skipWorkspaceFiles) {
|
|
@@ -32417,8 +32722,8 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
32417
32722
|
const filesToCopy = [...config.workspace.files];
|
|
32418
32723
|
if (hasRepositories && sourcePath) {
|
|
32419
32724
|
for (const agentFile of AGENT_FILES) {
|
|
32420
|
-
const agentPath =
|
|
32421
|
-
if (
|
|
32725
|
+
const agentPath = join23(sourcePath, agentFile);
|
|
32726
|
+
if (existsSync22(agentPath) && !filesToCopy.includes(agentFile)) {
|
|
32422
32727
|
filesToCopy.push(agentFile);
|
|
32423
32728
|
}
|
|
32424
32729
|
}
|
|
@@ -32458,10 +32763,10 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
32458
32763
|
skillsIndexRefs
|
|
32459
32764
|
}));
|
|
32460
32765
|
if (hasRepositories && !dryRun && syncClients.includes("claude") && sourcePath) {
|
|
32461
|
-
const claudePath =
|
|
32462
|
-
const agentsPath =
|
|
32463
|
-
const claudeExistsInSource =
|
|
32464
|
-
if (!claudeExistsInSource &&
|
|
32766
|
+
const claudePath = join23(workspacePath, "CLAUDE.md");
|
|
32767
|
+
const agentsPath = join23(workspacePath, "AGENTS.md");
|
|
32768
|
+
const claudeExistsInSource = existsSync22(join23(sourcePath, "CLAUDE.md"));
|
|
32769
|
+
if (!claudeExistsInSource && existsSync22(agentsPath) && !existsSync22(claudePath)) {
|
|
32465
32770
|
await copyFile(agentsPath, claudePath);
|
|
32466
32771
|
}
|
|
32467
32772
|
}
|
|
@@ -32549,7 +32854,7 @@ async function seedFetchCacheFromMarketplaces(results) {
|
|
|
32549
32854
|
}
|
|
32550
32855
|
function readGitBranch(repoPath) {
|
|
32551
32856
|
try {
|
|
32552
|
-
const head = readFileSync5(
|
|
32857
|
+
const head = readFileSync5(join23(repoPath, ".git", "HEAD"), "utf-8").trim();
|
|
32553
32858
|
const prefix = "ref: refs/heads/";
|
|
32554
32859
|
return head.startsWith(prefix) ? head.slice(prefix.length) : null;
|
|
32555
32860
|
} catch {
|
|
@@ -32594,6 +32899,14 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
32594
32899
|
const previousState = await loadSyncState(homeDir);
|
|
32595
32900
|
if (!dryRun) {
|
|
32596
32901
|
await sw.measure("selective-purge", () => selectivePurgeWorkspace(homeDir, previousState, syncClients));
|
|
32902
|
+
const relocatedHooks = await sw.measure("legacy-copilot-hook-scan", () => findRelocatedGitHubHooks(validPlugins.filter((plugin) => plugin.clients.includes("copilot") && plugin.fileArtifacts?.github !== false).map((plugin) => ({
|
|
32903
|
+
pluginPath: plugin.resolved,
|
|
32904
|
+
...plugin.exclude && { exclude: plugin.exclude }
|
|
32905
|
+
})), homeDir, "copilot", { clientMappings: USER_CLIENT_MAPPINGS }));
|
|
32906
|
+
for (const filePath of relocatedHooks.found) {
|
|
32907
|
+
const displayPath = relative6(homeDir, filePath).replace(/\\/g, "/");
|
|
32908
|
+
warnings.push(`Copilot user hook '${displayPath}' shares a path with a repository .github/hooks artifact. Repository hooks are no longer synced at user scope; review this file manually if an older AllAgents version installed it. A root hooks/ artifact may still manage the same path.`);
|
|
32909
|
+
}
|
|
32597
32910
|
}
|
|
32598
32911
|
const isV1FallbackUser = config.version === undefined || config.version < 2;
|
|
32599
32912
|
const disabledSkillsSet = isV1FallbackUser ? new Set(config.disabledSkills ?? []) : undefined;
|
|
@@ -32741,6 +33054,7 @@ var init_sync = __esm(() => {
|
|
|
32741
33054
|
init_workspace_repo();
|
|
32742
33055
|
init_repo_skills();
|
|
32743
33056
|
init_client_mapping();
|
|
33057
|
+
init_marketplace_manifest_parser();
|
|
32744
33058
|
init_skill_name_resolver();
|
|
32745
33059
|
init_marketplace();
|
|
32746
33060
|
init_sync_state2();
|
|
@@ -32750,6 +33064,7 @@ var init_sync = __esm(() => {
|
|
|
32750
33064
|
init_vscode_mcp();
|
|
32751
33065
|
init_codex_mcp();
|
|
32752
33066
|
init_codex_hooks();
|
|
33067
|
+
init_copilot_hooks();
|
|
32753
33068
|
init_claude_mcp();
|
|
32754
33069
|
init_copilot_mcp();
|
|
32755
33070
|
init_mcp_sync();
|
|
@@ -32759,11 +33074,11 @@ var init_sync = __esm(() => {
|
|
|
32759
33074
|
});
|
|
32760
33075
|
|
|
32761
33076
|
// src/core/github-fetch.ts
|
|
32762
|
-
import { existsSync as
|
|
32763
|
-
import { join as
|
|
33077
|
+
import { existsSync as existsSync23, readFileSync as readFileSync6 } from "node:fs";
|
|
33078
|
+
import { join as join24 } from "node:path";
|
|
32764
33079
|
function readFileFromClone(tempDir, filePath) {
|
|
32765
|
-
const fullPath =
|
|
32766
|
-
if (
|
|
33080
|
+
const fullPath = join24(tempDir, filePath);
|
|
33081
|
+
if (existsSync23(fullPath)) {
|
|
32767
33082
|
return readFileSync6(fullPath, "utf-8");
|
|
32768
33083
|
}
|
|
32769
33084
|
return null;
|
|
@@ -32862,15 +33177,15 @@ var init_github_fetch = __esm(() => {
|
|
|
32862
33177
|
});
|
|
32863
33178
|
|
|
32864
33179
|
// src/core/workspace.ts
|
|
32865
|
-
import { cp as cp2, mkdir as
|
|
32866
|
-
import { existsSync as
|
|
32867
|
-
import { join as
|
|
33180
|
+
import { cp as cp2, mkdir as mkdir10, readFile as readFile14, writeFile as writeFile10, copyFile as copyFile2, unlink as unlink3 } from "node:fs/promises";
|
|
33181
|
+
import { existsSync as existsSync24 } from "node:fs";
|
|
33182
|
+
import { join as join25, resolve as resolve13, dirname as dirname14, relative as relative7, sep as sep2, isAbsolute as isAbsolute5 } from "node:path";
|
|
32868
33183
|
import { fileURLToPath } from "node:url";
|
|
32869
33184
|
async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
32870
33185
|
const absoluteTarget = resolve13(targetPath);
|
|
32871
|
-
const configDir =
|
|
32872
|
-
const configPath =
|
|
32873
|
-
if (
|
|
33186
|
+
const configDir = join25(absoluteTarget, CONFIG_DIR);
|
|
33187
|
+
const configPath = join25(configDir, WORKSPACE_CONFIG_FILE);
|
|
33188
|
+
if (existsSync24(configPath)) {
|
|
32874
33189
|
if (options2.force) {
|
|
32875
33190
|
await unlink3(configPath);
|
|
32876
33191
|
} else {
|
|
@@ -32879,16 +33194,16 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32879
33194
|
}
|
|
32880
33195
|
}
|
|
32881
33196
|
const currentFilePath = fileURLToPath(import.meta.url);
|
|
32882
|
-
const currentFileDir =
|
|
33197
|
+
const currentFileDir = dirname14(currentFilePath);
|
|
32883
33198
|
const isProduction = currentFilePath.includes(`${sep2}dist${sep2}`);
|
|
32884
|
-
const defaultTemplatePath = isProduction ?
|
|
33199
|
+
const defaultTemplatePath = isProduction ? join25(currentFileDir, "templates", "default") : join25(currentFileDir, "..", "templates", "default");
|
|
32885
33200
|
let githubTempDir;
|
|
32886
33201
|
let parsedFromUrl;
|
|
32887
33202
|
let githubBasePath = "";
|
|
32888
33203
|
let githubBranch = "main";
|
|
32889
33204
|
try {
|
|
32890
|
-
await
|
|
32891
|
-
await
|
|
33205
|
+
await mkdir10(absoluteTarget, { recursive: true });
|
|
33206
|
+
await mkdir10(configDir, { recursive: true });
|
|
32892
33207
|
await ensureConfigGitignore(absoluteTarget);
|
|
32893
33208
|
let workspaceYamlContent;
|
|
32894
33209
|
let sourceDir;
|
|
@@ -32921,19 +33236,19 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32921
33236
|
console.log(`✓ Using workspace.yaml from: ${options2.from}`);
|
|
32922
33237
|
} else {
|
|
32923
33238
|
const fromPath = resolve13(options2.from);
|
|
32924
|
-
if (!
|
|
33239
|
+
if (!existsSync24(fromPath)) {
|
|
32925
33240
|
throw new Error(`Template not found: ${fromPath}`);
|
|
32926
33241
|
}
|
|
32927
33242
|
const { stat: stat2 } = await import("node:fs/promises");
|
|
32928
33243
|
const fromStat = await stat2(fromPath);
|
|
32929
33244
|
let sourceYamlPath;
|
|
32930
33245
|
if (fromStat.isDirectory()) {
|
|
32931
|
-
const nestedPath =
|
|
32932
|
-
const rootPath =
|
|
32933
|
-
if (
|
|
33246
|
+
const nestedPath = join25(fromPath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
33247
|
+
const rootPath = join25(fromPath, WORKSPACE_CONFIG_FILE);
|
|
33248
|
+
if (existsSync24(nestedPath)) {
|
|
32934
33249
|
sourceYamlPath = nestedPath;
|
|
32935
33250
|
sourceDir = fromPath;
|
|
32936
|
-
} else if (
|
|
33251
|
+
} else if (existsSync24(rootPath)) {
|
|
32937
33252
|
sourceYamlPath = rootPath;
|
|
32938
33253
|
sourceDir = fromPath;
|
|
32939
33254
|
} else {
|
|
@@ -32942,14 +33257,14 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32942
33257
|
}
|
|
32943
33258
|
} else {
|
|
32944
33259
|
sourceYamlPath = fromPath;
|
|
32945
|
-
const parentDir =
|
|
33260
|
+
const parentDir = dirname14(fromPath);
|
|
32946
33261
|
if (parentDir.endsWith(CONFIG_DIR)) {
|
|
32947
|
-
sourceDir =
|
|
33262
|
+
sourceDir = dirname14(parentDir);
|
|
32948
33263
|
} else {
|
|
32949
33264
|
sourceDir = parentDir;
|
|
32950
33265
|
}
|
|
32951
33266
|
}
|
|
32952
|
-
workspaceYamlContent = await
|
|
33267
|
+
workspaceYamlContent = await readFile14(sourceYamlPath, "utf-8");
|
|
32953
33268
|
if (sourceDir) {
|
|
32954
33269
|
const parsed2 = load(workspaceYamlContent);
|
|
32955
33270
|
const workspace = parsed2?.workspace;
|
|
@@ -32964,36 +33279,36 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32964
33279
|
console.log(`✓ Using workspace.yaml from: ${sourceYamlPath}`);
|
|
32965
33280
|
}
|
|
32966
33281
|
} else {
|
|
32967
|
-
const defaultYamlPath =
|
|
32968
|
-
if (!
|
|
33282
|
+
const defaultYamlPath = join25(defaultTemplatePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
33283
|
+
if (!existsSync24(defaultYamlPath)) {
|
|
32969
33284
|
throw new Error(`Default template not found at: ${defaultTemplatePath}`);
|
|
32970
33285
|
}
|
|
32971
|
-
workspaceYamlContent = await
|
|
33286
|
+
workspaceYamlContent = await readFile14(defaultYamlPath, "utf-8");
|
|
32972
33287
|
}
|
|
32973
33288
|
if (options2.clients && options2.clients.length > 0) {
|
|
32974
33289
|
const configParsed = load(workspaceYamlContent);
|
|
32975
33290
|
configParsed.clients = options2.clients;
|
|
32976
33291
|
workspaceYamlContent = dump(configParsed, { lineWidth: -1 });
|
|
32977
33292
|
}
|
|
32978
|
-
await
|
|
33293
|
+
await writeFile10(configPath, workspaceYamlContent, "utf-8");
|
|
32979
33294
|
const parsed = load(workspaceYamlContent);
|
|
32980
33295
|
const clients = parsed?.clients ?? [];
|
|
32981
33296
|
const clientNames = getClientTypes(clients);
|
|
32982
33297
|
const VSCODE_TEMPLATE_FILE2 = "template.code-workspace";
|
|
32983
33298
|
if (clientNames.includes("vscode") && options2.from) {
|
|
32984
|
-
const targetTemplatePath =
|
|
32985
|
-
if (!
|
|
33299
|
+
const targetTemplatePath = join25(configDir, VSCODE_TEMPLATE_FILE2);
|
|
33300
|
+
if (!existsSync24(targetTemplatePath)) {
|
|
32986
33301
|
if (isGitHubUrl(options2.from) && githubTempDir) {
|
|
32987
33302
|
if (parsedFromUrl) {
|
|
32988
33303
|
const templatePath = githubBasePath ? `${githubBasePath}/${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}` : `${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}`;
|
|
32989
33304
|
const templateContent = readFileFromClone(githubTempDir, templatePath);
|
|
32990
33305
|
if (templateContent) {
|
|
32991
|
-
await
|
|
33306
|
+
await writeFile10(targetTemplatePath, templateContent, "utf-8");
|
|
32992
33307
|
}
|
|
32993
33308
|
}
|
|
32994
33309
|
} else if (sourceDir) {
|
|
32995
|
-
const sourceTemplatePath =
|
|
32996
|
-
if (
|
|
33310
|
+
const sourceTemplatePath = join25(sourceDir, CONFIG_DIR, VSCODE_TEMPLATE_FILE2);
|
|
33311
|
+
if (existsSync24(sourceTemplatePath)) {
|
|
32997
33312
|
await copyFile2(sourceTemplatePath, targetTemplatePath);
|
|
32998
33313
|
}
|
|
32999
33314
|
}
|
|
@@ -33006,15 +33321,15 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
33006
33321
|
if (options2.from && isGitHubUrl(options2.from) && githubTempDir) {
|
|
33007
33322
|
if (parsedFromUrl) {
|
|
33008
33323
|
for (const agentFile of AGENT_FILES) {
|
|
33009
|
-
const targetFilePath =
|
|
33010
|
-
if (
|
|
33324
|
+
const targetFilePath = join25(absoluteTarget, agentFile);
|
|
33325
|
+
if (existsSync24(targetFilePath)) {
|
|
33011
33326
|
copiedAgentFiles.push(agentFile);
|
|
33012
33327
|
continue;
|
|
33013
33328
|
}
|
|
33014
33329
|
const filePath = githubBasePath ? `${githubBasePath}/${agentFile}` : agentFile;
|
|
33015
33330
|
const content = readFileFromClone(githubTempDir, filePath);
|
|
33016
33331
|
if (content) {
|
|
33017
|
-
await
|
|
33332
|
+
await writeFile10(targetFilePath, content, "utf-8");
|
|
33018
33333
|
copiedAgentFiles.push(agentFile);
|
|
33019
33334
|
}
|
|
33020
33335
|
}
|
|
@@ -33022,30 +33337,30 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
33022
33337
|
} else {
|
|
33023
33338
|
const effectiveSourceDir = sourceDir ?? defaultTemplatePath;
|
|
33024
33339
|
for (const agentFile of AGENT_FILES) {
|
|
33025
|
-
const targetFilePath =
|
|
33026
|
-
if (
|
|
33340
|
+
const targetFilePath = join25(absoluteTarget, agentFile);
|
|
33341
|
+
if (existsSync24(targetFilePath)) {
|
|
33027
33342
|
copiedAgentFiles.push(agentFile);
|
|
33028
33343
|
continue;
|
|
33029
33344
|
}
|
|
33030
|
-
const sourcePath =
|
|
33031
|
-
if (
|
|
33032
|
-
const content = await
|
|
33033
|
-
await
|
|
33345
|
+
const sourcePath = join25(effectiveSourceDir, agentFile);
|
|
33346
|
+
if (existsSync24(sourcePath)) {
|
|
33347
|
+
const content = await readFile14(sourcePath, "utf-8");
|
|
33348
|
+
await writeFile10(targetFilePath, content, "utf-8");
|
|
33034
33349
|
copiedAgentFiles.push(agentFile);
|
|
33035
33350
|
}
|
|
33036
33351
|
}
|
|
33037
33352
|
}
|
|
33038
33353
|
if (copiedAgentFiles.length === 0) {
|
|
33039
|
-
await ensureWorkspaceRules(
|
|
33354
|
+
await ensureWorkspaceRules(join25(absoluteTarget, "AGENTS.md"), repositories);
|
|
33040
33355
|
copiedAgentFiles.push("AGENTS.md");
|
|
33041
33356
|
} else {
|
|
33042
33357
|
for (const agentFile of copiedAgentFiles) {
|
|
33043
|
-
await ensureWorkspaceRules(
|
|
33358
|
+
await ensureWorkspaceRules(join25(absoluteTarget, agentFile), repositories);
|
|
33044
33359
|
}
|
|
33045
33360
|
}
|
|
33046
33361
|
if (clientNames.includes("claude") && !copiedAgentFiles.includes("CLAUDE.md") && copiedAgentFiles.includes("AGENTS.md")) {
|
|
33047
|
-
const agentsPath =
|
|
33048
|
-
const claudePath =
|
|
33362
|
+
const agentsPath = join25(absoluteTarget, "AGENTS.md");
|
|
33363
|
+
const claudePath = join25(absoluteTarget, "CLAUDE.md");
|
|
33049
33364
|
await copyFile2(agentsPath, claudePath);
|
|
33050
33365
|
}
|
|
33051
33366
|
}
|
|
@@ -33090,15 +33405,15 @@ Next steps:`);
|
|
|
33090
33405
|
async function seedCacheFromClone(tempDir, owner, repo, branch) {
|
|
33091
33406
|
const cachePaths = [
|
|
33092
33407
|
getPluginCachePath(owner, repo, branch),
|
|
33093
|
-
|
|
33408
|
+
join25(getMarketplacesDir(), repo)
|
|
33094
33409
|
];
|
|
33095
33410
|
for (const cachePath of cachePaths) {
|
|
33096
|
-
if (
|
|
33411
|
+
if (existsSync24(cachePath))
|
|
33097
33412
|
continue;
|
|
33098
33413
|
try {
|
|
33099
|
-
const parentDir =
|
|
33100
|
-
if (!
|
|
33101
|
-
await
|
|
33414
|
+
const parentDir = dirname14(cachePath);
|
|
33415
|
+
if (!existsSync24(parentDir)) {
|
|
33416
|
+
await mkdir10(parentDir, { recursive: true });
|
|
33102
33417
|
}
|
|
33103
33418
|
await cp2(tempDir, cachePath, { recursive: true });
|
|
33104
33419
|
} catch {}
|
|
@@ -35258,17 +35573,17 @@ function buildSearchQueries(query, owner) {
|
|
|
35258
35573
|
const trimmed2 = query.trim();
|
|
35259
35574
|
const pathTerm = trimmed2.replace(/ /g, "-");
|
|
35260
35575
|
const userClause = owner ? `user:${owner}` : "";
|
|
35261
|
-
const
|
|
35576
|
+
const join27 = (...parts) => parts.filter(Boolean).join(" ");
|
|
35262
35577
|
const queries = [
|
|
35263
|
-
{ priority: 1, label: "path", q:
|
|
35578
|
+
{ priority: 1, label: "path", q: join27("filename:SKILL.md", `path:${pathTerm}`, userClause) }
|
|
35264
35579
|
];
|
|
35265
35580
|
if (pathTerm !== trimmed2) {
|
|
35266
|
-
queries.push({ priority: 2, label: "hyphen", q:
|
|
35581
|
+
queries.push({ priority: 2, label: "hyphen", q: join27("filename:SKILL.md", pathTerm, userClause) });
|
|
35267
35582
|
}
|
|
35268
35583
|
if (!owner && couldBeOwner(trimmed2)) {
|
|
35269
35584
|
queries.push({ priority: 3, label: "owner", q: `filename:SKILL.md user:${trimmed2}` });
|
|
35270
35585
|
}
|
|
35271
|
-
queries.push({ priority: 4, label: "primary", q:
|
|
35586
|
+
queries.push({ priority: 4, label: "primary", q: join27("filename:SKILL.md", trimmed2, userClause) });
|
|
35272
35587
|
return queries;
|
|
35273
35588
|
}
|
|
35274
35589
|
function classifyApiError(status, body) {
|
|
@@ -42610,7 +42925,7 @@ var package_default;
|
|
|
42610
42925
|
var init_package = __esm(() => {
|
|
42611
42926
|
package_default = {
|
|
42612
42927
|
name: "allagents",
|
|
42613
|
-
version: "1.13.
|
|
42928
|
+
version: "1.13.4-next.1",
|
|
42614
42929
|
packageManager: "bun@1.3.12",
|
|
42615
42930
|
description: "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
|
|
42616
42931
|
type: "module",
|
|
@@ -42693,13 +43008,13 @@ var init_package = __esm(() => {
|
|
|
42693
43008
|
});
|
|
42694
43009
|
|
|
42695
43010
|
// src/cli/update-check.ts
|
|
42696
|
-
import { readFile as
|
|
42697
|
-
import { join as
|
|
43011
|
+
import { readFile as readFile19 } from "node:fs/promises";
|
|
43012
|
+
import { join as join31 } from "node:path";
|
|
42698
43013
|
import { spawn as spawn4 } from "node:child_process";
|
|
42699
43014
|
async function getCachedUpdateInfo(path3) {
|
|
42700
|
-
const filePath = path3 ??
|
|
43015
|
+
const filePath = path3 ?? join31(getHomeDir(), CONFIG_DIR, CACHE_FILE);
|
|
42701
43016
|
try {
|
|
42702
|
-
const raw = await
|
|
43017
|
+
const raw = await readFile19(filePath, "utf-8");
|
|
42703
43018
|
const data = JSON.parse(raw);
|
|
42704
43019
|
if (typeof data.latestVersion === "string" && typeof data.lastCheckedAt === "string") {
|
|
42705
43020
|
return data;
|
|
@@ -42735,8 +43050,8 @@ function buildNotice(currentVersion, latestVersion) {
|
|
|
42735
43050
|
Run \`allagents self update\` to upgrade.`);
|
|
42736
43051
|
}
|
|
42737
43052
|
function backgroundUpdateCheck() {
|
|
42738
|
-
const dir =
|
|
42739
|
-
const filePath =
|
|
43053
|
+
const dir = join31(getHomeDir(), CONFIG_DIR);
|
|
43054
|
+
const filePath = join31(dir, CACHE_FILE);
|
|
42740
43055
|
const script = `
|
|
42741
43056
|
const https = require('https');
|
|
42742
43057
|
const fs = require('fs');
|
|
@@ -42823,15 +43138,15 @@ class TuiCache {
|
|
|
42823
43138
|
}
|
|
42824
43139
|
|
|
42825
43140
|
// src/cli/tui/context.ts
|
|
42826
|
-
import { existsSync as
|
|
42827
|
-
import { join as
|
|
43141
|
+
import { existsSync as existsSync29 } from "node:fs";
|
|
43142
|
+
import { join as join32 } from "node:path";
|
|
42828
43143
|
async function getTuiContext(cwd = process.cwd(), cache2) {
|
|
42829
43144
|
const cachedContext = cache2?.getContext();
|
|
42830
43145
|
if (cachedContext) {
|
|
42831
43146
|
return cachedContext;
|
|
42832
43147
|
}
|
|
42833
|
-
const configPath =
|
|
42834
|
-
const hasWorkspace =
|
|
43148
|
+
const configPath = join32(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
43149
|
+
const hasWorkspace = existsSync29(configPath) && !isUserConfigPath(cwd);
|
|
42835
43150
|
let projectPluginCount = 0;
|
|
42836
43151
|
if (hasWorkspace) {
|
|
42837
43152
|
try {
|
|
@@ -43018,17 +43333,17 @@ var init_init2 = __esm(() => {
|
|
|
43018
43333
|
});
|
|
43019
43334
|
|
|
43020
43335
|
// src/cli/tui/actions/plugins.ts
|
|
43021
|
-
function createUpdateDeps() {
|
|
43336
|
+
function createUpdateDeps(workspacePath) {
|
|
43022
43337
|
const updatedMarketplaces = new Set;
|
|
43023
43338
|
return {
|
|
43024
43339
|
parsePluginSpec,
|
|
43025
|
-
getMarketplace: (name, sourceLocation) => findMarketplace(name, sourceLocation),
|
|
43340
|
+
getMarketplace: (name, sourceLocation) => findMarketplace(name, sourceLocation, workspacePath),
|
|
43026
43341
|
parseMarketplaceManifest,
|
|
43027
43342
|
updateMarketplace: async (name) => {
|
|
43028
43343
|
if (updatedMarketplaces.has(name)) {
|
|
43029
43344
|
return [{ name, success: true }];
|
|
43030
43345
|
}
|
|
43031
|
-
const result = await updateMarketplace(name);
|
|
43346
|
+
const result = await updateMarketplace(name, workspacePath);
|
|
43032
43347
|
if (result[0]?.success) {
|
|
43033
43348
|
updatedMarketplaces.add(name);
|
|
43034
43349
|
}
|
|
@@ -43098,7 +43413,8 @@ async function installSelectedPlugin(pluginRef, context, cache2) {
|
|
|
43098
43413
|
async function runUpdatePlugin(pluginSource, scope, context, cache2) {
|
|
43099
43414
|
const s = Ie();
|
|
43100
43415
|
s.start("Updating plugin...");
|
|
43101
|
-
const
|
|
43416
|
+
const workspacePath = scope === "project" ? context.workspacePath ?? undefined : undefined;
|
|
43417
|
+
const result = await updatePlugin(pluginSource, createUpdateDeps(workspacePath));
|
|
43102
43418
|
if (!result.success) {
|
|
43103
43419
|
s.stop("Update failed");
|
|
43104
43420
|
kt2(result.error ?? "Unknown error", "Error");
|
|
@@ -43131,7 +43447,7 @@ async function runUpdateAllPlugins(context, cache2) {
|
|
|
43131
43447
|
}
|
|
43132
43448
|
const userPlugins = await getInstalledUserPlugins();
|
|
43133
43449
|
for (const plugin of userPlugins) {
|
|
43134
|
-
if (!pluginsToUpdate.some((existing) => existing.spec === plugin.spec)) {
|
|
43450
|
+
if (!pluginsToUpdate.some((existing) => existing.spec === plugin.spec && existing.scope === "user")) {
|
|
43135
43451
|
pluginsToUpdate.push({ spec: plugin.spec, scope: "user" });
|
|
43136
43452
|
}
|
|
43137
43453
|
}
|
|
@@ -43140,12 +43456,13 @@ async function runUpdateAllPlugins(context, cache2) {
|
|
|
43140
43456
|
return;
|
|
43141
43457
|
}
|
|
43142
43458
|
s.message(`Updating ${pluginsToUpdate.length} plugin(s)...`);
|
|
43143
|
-
const
|
|
43459
|
+
const projectDeps = createUpdateDeps(context.workspacePath ?? undefined);
|
|
43460
|
+
const userDeps = createUpdateDeps();
|
|
43144
43461
|
const results = [];
|
|
43145
43462
|
let needsProjectSync = false;
|
|
43146
43463
|
let needsUserSync = false;
|
|
43147
43464
|
for (const { spec, scope } of pluginsToUpdate) {
|
|
43148
|
-
const result = await updatePlugin(spec,
|
|
43465
|
+
const result = await updatePlugin(spec, scope === "project" ? projectDeps : userDeps);
|
|
43149
43466
|
const entry = {
|
|
43150
43467
|
plugin: spec,
|
|
43151
43468
|
action: result.action
|
|
@@ -44291,8 +44608,8 @@ function conciseSubcommands(config) {
|
|
|
44291
44608
|
|
|
44292
44609
|
// src/cli/commands/workspace.ts
|
|
44293
44610
|
var import_cmd_ts2 = __toESM(require_cjs(), 1);
|
|
44294
|
-
import { existsSync as
|
|
44295
|
-
import { join as
|
|
44611
|
+
import { existsSync as existsSync25 } from "node:fs";
|
|
44612
|
+
import { join as join26, resolve as resolve14 } from "node:path";
|
|
44296
44613
|
|
|
44297
44614
|
// src/core/prune.ts
|
|
44298
44615
|
init_js_yaml();
|
|
@@ -44759,8 +45076,8 @@ var syncCmd = import_cmd_ts2.command({
|
|
|
44759
45076
|
`);
|
|
44760
45077
|
}
|
|
44761
45078
|
const userConfigExists = !!await getUserWorkspaceConfig();
|
|
44762
|
-
const projectConfigPath =
|
|
44763
|
-
const projectConfigExists =
|
|
45079
|
+
const projectConfigPath = join26(process.cwd(), ".allagents", "workspace.yaml");
|
|
45080
|
+
const projectConfigExists = existsSync25(projectConfigPath);
|
|
44764
45081
|
if (!userConfigExists && !projectConfigExists) {
|
|
44765
45082
|
await ensureUserWorkspace();
|
|
44766
45083
|
if (isJsonMode()) {
|
|
@@ -45491,9 +45808,9 @@ init_plugin_path();
|
|
|
45491
45808
|
init_skill();
|
|
45492
45809
|
init_format_sync();
|
|
45493
45810
|
var import_cmd_ts3 = __toESM(require_cjs(), 1);
|
|
45494
|
-
import { existsSync as
|
|
45495
|
-
import { readFile as
|
|
45496
|
-
import { join as
|
|
45811
|
+
import { existsSync as existsSync26 } from "node:fs";
|
|
45812
|
+
import { readFile as readFile15 } from "node:fs/promises";
|
|
45813
|
+
import { join as join27 } from "node:path";
|
|
45497
45814
|
|
|
45498
45815
|
// src/cli/metadata/plugin-skills.ts
|
|
45499
45816
|
var skillsListMeta = {
|
|
@@ -45684,7 +46001,7 @@ var skillsAddMeta = {
|
|
|
45684
46001
|
// src/cli/commands/plugin-skills.ts
|
|
45685
46002
|
init_skill_removal();
|
|
45686
46003
|
function hasProjectConfig(dir) {
|
|
45687
|
-
return
|
|
46004
|
+
return existsSync26(join27(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
|
|
45688
46005
|
}
|
|
45689
46006
|
function resolveScope(cwd) {
|
|
45690
46007
|
if (isUserConfigPath(cwd))
|
|
@@ -45718,7 +46035,7 @@ function resolveFetchedSourcePath(source, cachePath) {
|
|
|
45718
46035
|
if (!isGitHubUrl(source))
|
|
45719
46036
|
return cachePath;
|
|
45720
46037
|
const parsed = parseGitHubUrl(source);
|
|
45721
|
-
return parsed?.subpath ?
|
|
46038
|
+
return parsed?.subpath ? join27(cachePath, parsed.subpath) : cachePath;
|
|
45722
46039
|
}
|
|
45723
46040
|
function extractInlineRef(spec) {
|
|
45724
46041
|
const slashIdx = spec.indexOf("/");
|
|
@@ -45754,7 +46071,7 @@ async function resolveSkillNameFromRepo(url, parsed, fallbackName, fetchFn = fet
|
|
|
45754
46071
|
if (!fetchResult.success)
|
|
45755
46072
|
return fallbackName;
|
|
45756
46073
|
try {
|
|
45757
|
-
const skillMd = await
|
|
46074
|
+
const skillMd = await readFile15(join27(fetchResult.cachePath, "SKILL.md"), "utf-8");
|
|
45758
46075
|
const metadata = parseSkillMetadata(skillMd);
|
|
45759
46076
|
return metadata?.name ?? fallbackName;
|
|
45760
46077
|
} catch {
|
|
@@ -46270,10 +46587,10 @@ async function discoverSkillsWithMetadata(pluginPath, pluginName) {
|
|
|
46270
46587
|
const entries = await discoverSkillEntries(pluginPath);
|
|
46271
46588
|
const results = [];
|
|
46272
46589
|
for (const entry of entries) {
|
|
46273
|
-
const skillMdPath =
|
|
46590
|
+
const skillMdPath = join27(entry.skillPath, "SKILL.md");
|
|
46274
46591
|
let description = "";
|
|
46275
46592
|
try {
|
|
46276
|
-
const content = await
|
|
46593
|
+
const content = await readFile15(skillMdPath, "utf-8");
|
|
46277
46594
|
const metadata = parseSkillMetadata(content);
|
|
46278
46595
|
description = metadata?.description ?? "";
|
|
46279
46596
|
} catch {}
|
|
@@ -46305,7 +46622,7 @@ async function discoverSkillsFromSource(from) {
|
|
|
46305
46622
|
if (typeof plugin.source === "object")
|
|
46306
46623
|
continue;
|
|
46307
46624
|
const resolved = resolvePluginSourcePath(plugin.source, sourcePath);
|
|
46308
|
-
if (!
|
|
46625
|
+
if (!existsSync26(resolved))
|
|
46309
46626
|
continue;
|
|
46310
46627
|
const skills2 = await discoverSkillsWithMetadata(resolved, plugin.name);
|
|
46311
46628
|
all.push(...skills2);
|
|
@@ -47386,9 +47703,9 @@ init_format_sync();
|
|
|
47386
47703
|
init_workspace_config();
|
|
47387
47704
|
init_constants();
|
|
47388
47705
|
init_js_yaml();
|
|
47389
|
-
import { readFile as
|
|
47390
|
-
import { existsSync as
|
|
47391
|
-
import { join as
|
|
47706
|
+
import { readFile as readFile16 } from "node:fs/promises";
|
|
47707
|
+
import { existsSync as existsSync27 } from "node:fs";
|
|
47708
|
+
import { join as join28 } from "node:path";
|
|
47392
47709
|
async function runSyncAndPrint(options2) {
|
|
47393
47710
|
if (!isJsonMode()) {
|
|
47394
47711
|
console.log(`
|
|
@@ -47640,7 +47957,7 @@ var marketplaceAddCmd = import_cmd_ts4.command({
|
|
|
47640
47957
|
process.exit(1);
|
|
47641
47958
|
}
|
|
47642
47959
|
if (effectiveScope === "project") {
|
|
47643
|
-
if (!
|
|
47960
|
+
if (!existsSync27(join28(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE))) {
|
|
47644
47961
|
const msg = 'No workspace found in current directory. Run "allagents workspace init" first.';
|
|
47645
47962
|
if (isJsonMode()) {
|
|
47646
47963
|
jsonOutput({ success: false, command: "plugin marketplace add", error: msg });
|
|
@@ -47947,10 +48264,10 @@ var pluginListCmd = import_cmd_ts4.command({
|
|
|
47947
48264
|
};
|
|
47948
48265
|
const pluginClients = new Map;
|
|
47949
48266
|
async function loadConfigClients(configPath, scope) {
|
|
47950
|
-
if (!
|
|
48267
|
+
if (!existsSync27(configPath))
|
|
47951
48268
|
return;
|
|
47952
48269
|
try {
|
|
47953
|
-
const content = await
|
|
48270
|
+
const content = await readFile16(configPath, "utf-8");
|
|
47954
48271
|
const config = load(content);
|
|
47955
48272
|
if (!config?.plugins || !config?.clients)
|
|
47956
48273
|
return;
|
|
@@ -47962,8 +48279,8 @@ var pluginListCmd = import_cmd_ts4.command({
|
|
|
47962
48279
|
}
|
|
47963
48280
|
} catch {}
|
|
47964
48281
|
}
|
|
47965
|
-
const userConfigPath =
|
|
47966
|
-
const projectConfigPath =
|
|
48282
|
+
const userConfigPath = join28(getAllagentsDir(), WORKSPACE_CONFIG_FILE);
|
|
48283
|
+
const projectConfigPath = join28(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
47967
48284
|
const cwdIsHome = isUserConfigPath(process.cwd());
|
|
47968
48285
|
await loadConfigClients(userConfigPath, "user");
|
|
47969
48286
|
if (!cwdIsHome) {
|
|
@@ -48126,7 +48443,7 @@ var pluginInstallCmd = import_cmd_ts4.command({
|
|
|
48126
48443
|
const isUser = scope === "user" || !scope && isUserConfigPath(process.cwd());
|
|
48127
48444
|
if (isUser) {
|
|
48128
48445
|
const userConfigPath = getUserWorkspaceConfigPath();
|
|
48129
|
-
if (!
|
|
48446
|
+
if (!existsSync27(userConfigPath)) {
|
|
48130
48447
|
const { promptForClients: promptForClients2 } = await Promise.resolve().then(() => (init_prompt_clients(), exports_prompt_clients));
|
|
48131
48448
|
const clients = await promptForClients2();
|
|
48132
48449
|
if (clients === null) {
|
|
@@ -48138,8 +48455,8 @@ var pluginInstallCmd = import_cmd_ts4.command({
|
|
|
48138
48455
|
await ensureUserWorkspace(clients);
|
|
48139
48456
|
}
|
|
48140
48457
|
} else {
|
|
48141
|
-
const configPath =
|
|
48142
|
-
if (!
|
|
48458
|
+
const configPath = join28(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
48459
|
+
if (!existsSync27(configPath)) {
|
|
48143
48460
|
const { promptForClients: promptForClients2 } = await Promise.resolve().then(() => (init_prompt_clients(), exports_prompt_clients));
|
|
48144
48461
|
const clients = await promptForClients2();
|
|
48145
48462
|
if (clients === null) {
|
|
@@ -48401,35 +48718,36 @@ var pluginUpdateCmd = import_cmd_ts4.command({
|
|
|
48401
48718
|
const updateUser = scope === "user" || updateAll;
|
|
48402
48719
|
const updateProject = scope === "project" || !scope && !updateAll || updateAll;
|
|
48403
48720
|
const pluginsToUpdate = [];
|
|
48721
|
+
const addPluginToUpdate = (spec, pluginScope) => {
|
|
48722
|
+
if (!pluginsToUpdate.some((entry) => entry.spec === spec && entry.scope === pluginScope)) {
|
|
48723
|
+
pluginsToUpdate.push({ spec, scope: pluginScope });
|
|
48724
|
+
}
|
|
48725
|
+
};
|
|
48404
48726
|
if (updateProject && !isUserConfigPath(process.cwd())) {
|
|
48405
48727
|
const projectPlugins = await getInstalledProjectPlugins(process.cwd());
|
|
48406
48728
|
for (const p of projectPlugins) {
|
|
48407
|
-
|
|
48729
|
+
addPluginToUpdate(p.spec, "project");
|
|
48408
48730
|
}
|
|
48409
48731
|
}
|
|
48410
48732
|
if (updateUser) {
|
|
48411
48733
|
const userPlugins = await getInstalledUserPlugins();
|
|
48412
48734
|
for (const p of userPlugins) {
|
|
48413
|
-
|
|
48414
|
-
pluginsToUpdate.push(p.spec);
|
|
48415
|
-
}
|
|
48735
|
+
addPluginToUpdate(p.spec, "user");
|
|
48416
48736
|
}
|
|
48417
48737
|
}
|
|
48418
48738
|
if (updateProject && !isUserConfigPath(process.cwd())) {
|
|
48419
|
-
const { existsSync:
|
|
48420
|
-
const { readFile:
|
|
48421
|
-
const { join:
|
|
48739
|
+
const { existsSync: existsSync28 } = await import("node:fs");
|
|
48740
|
+
const { readFile: readFile17 } = await import("node:fs/promises");
|
|
48741
|
+
const { join: join29 } = await import("node:path");
|
|
48422
48742
|
const { load: load2 } = await Promise.resolve().then(() => (init_js_yaml(), exports_js_yaml));
|
|
48423
48743
|
const { CONFIG_DIR: CONFIG_DIR2, WORKSPACE_CONFIG_FILE: WORKSPACE_CONFIG_FILE2 } = await Promise.resolve().then(() => (init_constants(), exports_constants));
|
|
48424
|
-
const configPath =
|
|
48425
|
-
if (
|
|
48426
|
-
const content = await
|
|
48744
|
+
const configPath = join29(process.cwd(), CONFIG_DIR2, WORKSPACE_CONFIG_FILE2);
|
|
48745
|
+
if (existsSync28(configPath)) {
|
|
48746
|
+
const content = await readFile17(configPath, "utf-8");
|
|
48427
48747
|
const config = load2(content);
|
|
48428
48748
|
for (const entry of config.plugins ?? []) {
|
|
48429
48749
|
const p = getPluginSource(entry);
|
|
48430
|
-
|
|
48431
|
-
pluginsToUpdate.push(p);
|
|
48432
|
-
}
|
|
48750
|
+
addPluginToUpdate(p, "project");
|
|
48433
48751
|
}
|
|
48434
48752
|
}
|
|
48435
48753
|
}
|
|
@@ -48438,17 +48756,15 @@ var pluginUpdateCmd = import_cmd_ts4.command({
|
|
|
48438
48756
|
if (userConfig) {
|
|
48439
48757
|
for (const entry of userConfig.plugins ?? []) {
|
|
48440
48758
|
const p = getPluginSource(entry);
|
|
48441
|
-
|
|
48442
|
-
pluginsToUpdate.push(p);
|
|
48443
|
-
}
|
|
48759
|
+
addPluginToUpdate(p, "user");
|
|
48444
48760
|
}
|
|
48445
48761
|
}
|
|
48446
48762
|
}
|
|
48447
|
-
const toUpdate = plugin ? pluginsToUpdate.filter((
|
|
48448
|
-
if (
|
|
48763
|
+
const toUpdate = plugin ? pluginsToUpdate.filter(({ spec }) => {
|
|
48764
|
+
if (spec === plugin)
|
|
48449
48765
|
return true;
|
|
48450
|
-
const parsed = parsePluginSpec(
|
|
48451
|
-
return parsed?.plugin === plugin ||
|
|
48766
|
+
const parsed = parsePluginSpec(spec);
|
|
48767
|
+
return parsed?.plugin === plugin || spec.endsWith(`/${plugin}`);
|
|
48452
48768
|
}) : pluginsToUpdate;
|
|
48453
48769
|
if (plugin && toUpdate.length === 0) {
|
|
48454
48770
|
const error = `Plugin not found: ${plugin}`;
|
|
@@ -48476,24 +48792,35 @@ var pluginUpdateCmd = import_cmd_ts4.command({
|
|
|
48476
48792
|
console.log();
|
|
48477
48793
|
}
|
|
48478
48794
|
const results = [];
|
|
48479
|
-
const updatedMarketplaces =
|
|
48480
|
-
|
|
48481
|
-
|
|
48482
|
-
|
|
48483
|
-
|
|
48484
|
-
|
|
48485
|
-
|
|
48486
|
-
|
|
48487
|
-
|
|
48488
|
-
|
|
48489
|
-
|
|
48490
|
-
|
|
48795
|
+
const updatedMarketplaces = {
|
|
48796
|
+
project: new Set,
|
|
48797
|
+
user: new Set
|
|
48798
|
+
};
|
|
48799
|
+
const createUpdateDeps = (pluginScope) => {
|
|
48800
|
+
const workspacePath = pluginScope === "project" ? process.cwd() : undefined;
|
|
48801
|
+
const updatedForScope = updatedMarketplaces[pluginScope];
|
|
48802
|
+
return {
|
|
48803
|
+
parsePluginSpec,
|
|
48804
|
+
getMarketplace: (name, sourceLocation) => findMarketplace(name, sourceLocation, workspacePath),
|
|
48805
|
+
parseMarketplaceManifest,
|
|
48806
|
+
updateMarketplace: async (name) => {
|
|
48807
|
+
if (updatedForScope.has(name)) {
|
|
48808
|
+
return [{ name, success: true }];
|
|
48809
|
+
}
|
|
48810
|
+
const result = await updateMarketplace(name, workspacePath);
|
|
48811
|
+
if (result[0]?.success) {
|
|
48812
|
+
updatedForScope.add(name);
|
|
48813
|
+
}
|
|
48814
|
+
return result;
|
|
48491
48815
|
}
|
|
48492
|
-
|
|
48493
|
-
|
|
48816
|
+
};
|
|
48817
|
+
};
|
|
48818
|
+
const depsByScope = {
|
|
48819
|
+
project: createUpdateDeps("project"),
|
|
48820
|
+
user: createUpdateDeps("user")
|
|
48494
48821
|
};
|
|
48495
|
-
for (const pluginSpec of toUpdate) {
|
|
48496
|
-
const result = await updatePlugin(pluginSpec,
|
|
48822
|
+
for (const { spec: pluginSpec, scope: pluginScope } of toUpdate) {
|
|
48823
|
+
const result = await updatePlugin(pluginSpec, depsByScope[pluginScope]);
|
|
48497
48824
|
results.push(result);
|
|
48498
48825
|
if (!isJsonMode()) {
|
|
48499
48826
|
const icon = result.success ? result.action === "updated" ? "✓" : "-" : "✗";
|
|
@@ -48588,9 +48915,9 @@ init_js_yaml();
|
|
|
48588
48915
|
init_constants();
|
|
48589
48916
|
init_workspace_config();
|
|
48590
48917
|
init_workspace_modify();
|
|
48591
|
-
import { existsSync as
|
|
48592
|
-
import { readFile as
|
|
48593
|
-
import { join as
|
|
48918
|
+
import { existsSync as existsSync28 } from "node:fs";
|
|
48919
|
+
import { readFile as readFile17, writeFile as writeFile11 } from "node:fs/promises";
|
|
48920
|
+
import { join as join29 } from "node:path";
|
|
48594
48921
|
var PROJECT_MCP_CLIENTS2 = new Set([
|
|
48595
48922
|
"claude",
|
|
48596
48923
|
"codex",
|
|
@@ -48611,14 +48938,14 @@ function removeServerScopedProxyIntent(workspaceConfig, name) {
|
|
|
48611
48938
|
}
|
|
48612
48939
|
}
|
|
48613
48940
|
function getConfigPath(workspacePath) {
|
|
48614
|
-
return
|
|
48941
|
+
return join29(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
48615
48942
|
}
|
|
48616
48943
|
async function readConfig(configPath) {
|
|
48617
|
-
const content = await
|
|
48944
|
+
const content = await readFile17(configPath, "utf-8");
|
|
48618
48945
|
return load(content);
|
|
48619
48946
|
}
|
|
48620
48947
|
async function writeConfig(configPath, config) {
|
|
48621
|
-
await
|
|
48948
|
+
await writeFile11(configPath, dump(config, { lineWidth: -1 }), "utf-8");
|
|
48622
48949
|
}
|
|
48623
48950
|
function getProjectMcpClients(entries) {
|
|
48624
48951
|
return getClientTypes(entries).filter((client) => PROJECT_MCP_CLIENTS2.has(client));
|
|
@@ -48712,7 +49039,7 @@ async function clearWorkspaceMcpServerProxy(name, workspacePath = process.cwd())
|
|
|
48712
49039
|
}
|
|
48713
49040
|
async function removeWorkspaceMcpServer(name, workspacePath = process.cwd()) {
|
|
48714
49041
|
const configPath = getConfigPath(workspacePath);
|
|
48715
|
-
if (!
|
|
49042
|
+
if (!existsSync28(configPath)) {
|
|
48716
49043
|
return {
|
|
48717
49044
|
success: false,
|
|
48718
49045
|
error: `${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}`
|
|
@@ -48742,14 +49069,14 @@ async function removeWorkspaceMcpServer(name, workspacePath = process.cwd()) {
|
|
|
48742
49069
|
}
|
|
48743
49070
|
async function getWorkspaceMcpServer(name, workspacePath = process.cwd()) {
|
|
48744
49071
|
const configPath = getConfigPath(workspacePath);
|
|
48745
|
-
if (!
|
|
49072
|
+
if (!existsSync28(configPath))
|
|
48746
49073
|
return null;
|
|
48747
49074
|
const workspaceConfig = await readConfig(configPath);
|
|
48748
49075
|
return workspaceConfig.mcpServers?.[name] ?? null;
|
|
48749
49076
|
}
|
|
48750
49077
|
async function listWorkspaceMcpServers(workspacePath = process.cwd()) {
|
|
48751
49078
|
const configPath = getConfigPath(workspacePath);
|
|
48752
|
-
if (!
|
|
49079
|
+
if (!existsSync28(configPath))
|
|
48753
49080
|
return {};
|
|
48754
49081
|
const workspaceConfig = await readConfig(configPath);
|
|
48755
49082
|
return workspaceConfig.mcpServers ?? {};
|
|
@@ -48813,10 +49140,10 @@ import { createHash as createHash3, randomUUID } from "node:crypto";
|
|
|
48813
49140
|
import {
|
|
48814
49141
|
createServer
|
|
48815
49142
|
} from "node:http";
|
|
48816
|
-
import { mkdir as
|
|
49143
|
+
import { mkdir as mkdir11, readFile as readFile18, rm as rm5, writeFile as writeFile12 } from "node:fs/promises";
|
|
48817
49144
|
import { constants as fsConstants } from "node:fs";
|
|
48818
|
-
import { access } from "node:fs/promises";
|
|
48819
|
-
import { join as
|
|
49145
|
+
import { access as access2 } from "node:fs/promises";
|
|
49146
|
+
import { join as join30, dirname as dirname15 } from "node:path";
|
|
48820
49147
|
import { spawn as spawn3 } from "node:child_process";
|
|
48821
49148
|
|
|
48822
49149
|
// node_modules/zod/v4/core/core.js
|
|
@@ -56993,7 +57320,7 @@ function hashServerUrl(serverUrl) {
|
|
|
56993
57320
|
return createHash3("sha256").update(serverUrl).digest("hex").slice(0, 16);
|
|
56994
57321
|
}
|
|
56995
57322
|
function getCacheDir(serverUrl) {
|
|
56996
|
-
return
|
|
57323
|
+
return join30(getHomeDir(), ".allagents", "oauth-proxy", hashServerUrl(serverUrl));
|
|
56997
57324
|
}
|
|
56998
57325
|
function getRequestInit(headers) {
|
|
56999
57326
|
if (Object.keys(headers).length === 0) {
|
|
@@ -57003,7 +57330,7 @@ function getRequestInit(headers) {
|
|
|
57003
57330
|
}
|
|
57004
57331
|
async function pathExists(path) {
|
|
57005
57332
|
try {
|
|
57006
|
-
await
|
|
57333
|
+
await access2(path, fsConstants.F_OK);
|
|
57007
57334
|
return true;
|
|
57008
57335
|
} catch {
|
|
57009
57336
|
return false;
|
|
@@ -57013,11 +57340,11 @@ async function readJsonFile(path) {
|
|
|
57013
57340
|
if (!await pathExists(path)) {
|
|
57014
57341
|
return;
|
|
57015
57342
|
}
|
|
57016
|
-
return JSON.parse(await
|
|
57343
|
+
return JSON.parse(await readFile18(path, "utf-8"));
|
|
57017
57344
|
}
|
|
57018
57345
|
async function writePrivateFile(path, content) {
|
|
57019
|
-
await
|
|
57020
|
-
await
|
|
57346
|
+
await mkdir11(dirname15(path), { recursive: true });
|
|
57347
|
+
await writeFile12(path, content, { encoding: "utf-8", mode: 384 });
|
|
57021
57348
|
}
|
|
57022
57349
|
function parseLoopbackPort(clientInfo) {
|
|
57023
57350
|
const redirectUri = clientInfo && "redirect_uris" in clientInfo ? clientInfo.redirect_uris?.[0] : undefined;
|
|
@@ -57107,10 +57434,10 @@ class FileOAuthClientProvider {
|
|
|
57107
57434
|
constructor(port, serverUrl) {
|
|
57108
57435
|
this.port = port;
|
|
57109
57436
|
const cacheDir = getCacheDir(serverUrl);
|
|
57110
|
-
this.clientInfoPath =
|
|
57111
|
-
this.tokensPath =
|
|
57112
|
-
this.verifierPath =
|
|
57113
|
-
this.discoveryPath =
|
|
57437
|
+
this.clientInfoPath = join30(cacheDir, "client-info.json");
|
|
57438
|
+
this.tokensPath = join30(cacheDir, "tokens.json");
|
|
57439
|
+
this.verifierPath = join30(cacheDir, "code-verifier.txt");
|
|
57440
|
+
this.discoveryPath = join30(cacheDir, "discovery.json");
|
|
57114
57441
|
this.redirectUriValue = `http://127.0.0.1:${port}/callback`;
|
|
57115
57442
|
}
|
|
57116
57443
|
get redirectUrl() {
|
|
@@ -57133,7 +57460,7 @@ class FileOAuthClientProvider {
|
|
|
57133
57460
|
this.tokenSet = await readJsonFile(this.tokensPath);
|
|
57134
57461
|
this.discovery = await readJsonFile(this.discoveryPath);
|
|
57135
57462
|
if (await pathExists(this.verifierPath)) {
|
|
57136
|
-
this.codeVerifierValue = await
|
|
57463
|
+
this.codeVerifierValue = await readFile18(this.verifierPath, "utf-8");
|
|
57137
57464
|
}
|
|
57138
57465
|
}
|
|
57139
57466
|
clientInformation() {
|
|
@@ -57244,7 +57571,7 @@ class FileOAuthClientProvider {
|
|
|
57244
57571
|
}
|
|
57245
57572
|
async function buildOAuthProvider(serverUrl) {
|
|
57246
57573
|
const cacheDir = getCacheDir(serverUrl);
|
|
57247
|
-
const cachedClientInfo = await readJsonFile(
|
|
57574
|
+
const cachedClientInfo = await readJsonFile(join30(cacheDir, "client-info.json"));
|
|
57248
57575
|
let port = parseLoopbackPort(cachedClientInfo);
|
|
57249
57576
|
if (!port) {
|
|
57250
57577
|
port = await findFreePort();
|