allagents 1.12.1-next.1 → 1.13.0-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 +8 -1
- package/dist/index.js +481 -163
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -123,11 +123,18 @@ my-plugin/
|
|
|
123
123
|
│ └── SKILL.md
|
|
124
124
|
├── agents/ # Agent definitions
|
|
125
125
|
├── commands/ # Slash commands (Claude, OpenCode)
|
|
126
|
-
├── hooks/ # Lifecycle hooks (Claude, Factory, Copilot)
|
|
126
|
+
├── hooks/ # Lifecycle hooks (Claude, Factory, Copilot, Codex)
|
|
127
|
+
├── .codex-plugin/ # Codex plugin manifest and explicit hook paths
|
|
127
128
|
├── .github/ # Copilot/VSCode overrides
|
|
128
129
|
└── .mcp.json # MCP server configs
|
|
129
130
|
```
|
|
130
131
|
|
|
132
|
+
For Codex project sync, AllAgents copies skills into `.codex/skills/`, merges
|
|
133
|
+
plugin hooks into `.codex/hooks.json`, and preserves user-owned hooks already in
|
|
134
|
+
that file. Codex plugins can declare hooks in `.codex-plugin/plugin.json` with a
|
|
135
|
+
`hooks` path, path array, inline object, or inline object array; otherwise
|
|
136
|
+
AllAgents falls back to `hooks/hooks.json`.
|
|
137
|
+
|
|
131
138
|
## Documentation
|
|
132
139
|
|
|
133
140
|
Full documentation at [allagents.dev](https://allagents.dev):
|
package/dist/index.js
CHANGED
|
@@ -14729,7 +14729,7 @@ function parseGitHubUrl(url) {
|
|
|
14729
14729
|
if (treeMatch) {
|
|
14730
14730
|
const owner = treeMatch[1];
|
|
14731
14731
|
const repo = treeMatch[2]?.replace(/\.git$/, "");
|
|
14732
|
-
const afterTree = treeMatch[3];
|
|
14732
|
+
const afterTree = decodeGitHubPath(treeMatch[3]);
|
|
14733
14733
|
if (owner && repo && afterTree) {
|
|
14734
14734
|
const parts = afterTree.split("/");
|
|
14735
14735
|
if (parts.length === 1) {
|
|
@@ -14775,6 +14775,15 @@ function parseGitHubUrl(url) {
|
|
|
14775
14775
|
}
|
|
14776
14776
|
return null;
|
|
14777
14777
|
}
|
|
14778
|
+
function decodeGitHubPath(path) {
|
|
14779
|
+
if (!path)
|
|
14780
|
+
return path;
|
|
14781
|
+
try {
|
|
14782
|
+
return decodeURIComponent(path);
|
|
14783
|
+
} catch {
|
|
14784
|
+
return path;
|
|
14785
|
+
}
|
|
14786
|
+
}
|
|
14778
14787
|
function normalizePluginPath(source, baseDir = process.cwd()) {
|
|
14779
14788
|
if (isGitHubUrl(source)) {
|
|
14780
14789
|
return source;
|
|
@@ -29354,6 +29363,9 @@ var init_sync_state = __esm(() => {
|
|
|
29354
29363
|
version: exports_external.literal(1),
|
|
29355
29364
|
lastSync: exports_external.string(),
|
|
29356
29365
|
files: exports_external.record(ClientTypeSchema, exports_external.array(exports_external.string())),
|
|
29366
|
+
codexHooks: exports_external.object({
|
|
29367
|
+
hooks: exports_external.record(exports_external.string(), exports_external.array(exports_external.unknown()))
|
|
29368
|
+
}).optional(),
|
|
29357
29369
|
mcpServers: exports_external.record(exports_external.string(), exports_external.array(exports_external.string())).optional(),
|
|
29358
29370
|
nativePlugins: exports_external.record(ClientTypeSchema, exports_external.array(exports_external.string())).optional(),
|
|
29359
29371
|
vscodeWorkspaceHash: exports_external.string().optional(),
|
|
@@ -29422,6 +29434,7 @@ async function saveSyncState(workspacePath, data) {
|
|
|
29422
29434
|
version: 1,
|
|
29423
29435
|
lastSync: new Date().toISOString(),
|
|
29424
29436
|
files: normalizedData.files,
|
|
29437
|
+
...normalizedData.codexHooks && { codexHooks: normalizedData.codexHooks },
|
|
29425
29438
|
...normalizedData.mcpServers && { mcpServers: normalizedData.mcpServers },
|
|
29426
29439
|
...normalizedData.nativePlugins && { nativePlugins: normalizedData.nativePlugins },
|
|
29427
29440
|
...normalizedData.vscodeWorkspaceHash && { vscodeWorkspaceHash: normalizedData.vscodeWorkspaceHash },
|
|
@@ -29455,6 +29468,7 @@ async function upsertSyncStateSource(workspacePath, key, source) {
|
|
|
29455
29468
|
const sources = { ...existing?.sources ?? {}, [key]: source };
|
|
29456
29469
|
await saveSyncState(workspacePath, {
|
|
29457
29470
|
files: existing?.files ?? {},
|
|
29471
|
+
...existing?.codexHooks && { codexHooks: existing.codexHooks },
|
|
29458
29472
|
...existing?.mcpServers && {
|
|
29459
29473
|
mcpServers: existing.mcpServers
|
|
29460
29474
|
},
|
|
@@ -30208,9 +30222,301 @@ var init_codex_mcp = __esm(() => {
|
|
|
30208
30222
|
init_vscode_mcp();
|
|
30209
30223
|
});
|
|
30210
30224
|
|
|
30225
|
+
// src/core/codex-hooks.ts
|
|
30226
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync4, readFileSync as readFileSync3, unlinkSync, writeFileSync as writeFileSync4 } from "node:fs";
|
|
30227
|
+
import { basename as basename8, dirname as dirname9, isAbsolute as isAbsolute4, join as join19, normalize as normalize4 } from "node:path";
|
|
30228
|
+
function isRecord(value) {
|
|
30229
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
30230
|
+
}
|
|
30231
|
+
function cloneJson(value) {
|
|
30232
|
+
return JSON.parse(JSON.stringify(value));
|
|
30233
|
+
}
|
|
30234
|
+
function hasHooks(file) {
|
|
30235
|
+
if (!file)
|
|
30236
|
+
return false;
|
|
30237
|
+
return Object.values(file.hooks).some((groups) => groups.length > 0);
|
|
30238
|
+
}
|
|
30239
|
+
function orderedHooks(hooks) {
|
|
30240
|
+
const ordered = {};
|
|
30241
|
+
const remaining = new Set(Object.keys(hooks));
|
|
30242
|
+
for (const event of CODEX_HOOK_EVENT_ORDER) {
|
|
30243
|
+
if (remaining.has(event)) {
|
|
30244
|
+
ordered[event] = hooks[event] ?? [];
|
|
30245
|
+
remaining.delete(event);
|
|
30246
|
+
}
|
|
30247
|
+
}
|
|
30248
|
+
for (const event of [...remaining].sort()) {
|
|
30249
|
+
ordered[event] = hooks[event] ?? [];
|
|
30250
|
+
}
|
|
30251
|
+
return ordered;
|
|
30252
|
+
}
|
|
30253
|
+
function normalizeHooksObject(value, source, warnings, options2) {
|
|
30254
|
+
if (!isRecord(value) || !isRecord(value.hooks)) {
|
|
30255
|
+
warnings.push(`Codex hooks: ${source} must contain a hooks object`);
|
|
30256
|
+
return null;
|
|
30257
|
+
}
|
|
30258
|
+
const hooks = {};
|
|
30259
|
+
for (const [eventName, groups] of Object.entries(value.hooks)) {
|
|
30260
|
+
if (options2.filterCodexEvents && !CODEX_HOOK_EVENTS.has(eventName)) {
|
|
30261
|
+
warnings.push(`Codex hooks: unsupported event '${eventName}' in ${source} was skipped`);
|
|
30262
|
+
continue;
|
|
30263
|
+
}
|
|
30264
|
+
if (!Array.isArray(groups)) {
|
|
30265
|
+
warnings.push(`Codex hooks: event '${eventName}' in ${source} must be an array`);
|
|
30266
|
+
if (options2.strictEventArrays) {
|
|
30267
|
+
return null;
|
|
30268
|
+
}
|
|
30269
|
+
continue;
|
|
30270
|
+
}
|
|
30271
|
+
hooks[eventName] = cloneJson(groups);
|
|
30272
|
+
}
|
|
30273
|
+
return { hooks: orderedHooks(hooks) };
|
|
30274
|
+
}
|
|
30275
|
+
function parseHooksJson(content, source, warnings, options2) {
|
|
30276
|
+
try {
|
|
30277
|
+
return normalizeHooksObject(JSON.parse(content), source, warnings, options2);
|
|
30278
|
+
} catch (error) {
|
|
30279
|
+
warnings.push(`Codex hooks: failed to parse ${source}: ${error instanceof Error ? error.message : String(error)}`);
|
|
30280
|
+
return null;
|
|
30281
|
+
}
|
|
30282
|
+
}
|
|
30283
|
+
function readHooksJson(path, warnings, options2) {
|
|
30284
|
+
try {
|
|
30285
|
+
return parseHooksJson(readFileSync3(path, "utf-8"), path, warnings, options2);
|
|
30286
|
+
} catch (error) {
|
|
30287
|
+
warnings.push(`Codex hooks: failed to read ${path}: ${error instanceof Error ? error.message : String(error)}`);
|
|
30288
|
+
return null;
|
|
30289
|
+
}
|
|
30290
|
+
}
|
|
30291
|
+
function resolveManifestPath(pluginPath, field, rawPath, warnings) {
|
|
30292
|
+
if (!rawPath.startsWith("./")) {
|
|
30293
|
+
warnings.push(`Codex hooks: ignoring ${field}; path must start with './'`);
|
|
30294
|
+
return null;
|
|
30295
|
+
}
|
|
30296
|
+
const relativePath = rawPath.slice(2);
|
|
30297
|
+
if (!relativePath) {
|
|
30298
|
+
warnings.push(`Codex hooks: ignoring ${field}; path must not be './'`);
|
|
30299
|
+
return null;
|
|
30300
|
+
}
|
|
30301
|
+
if (isAbsolute4(relativePath)) {
|
|
30302
|
+
warnings.push(`Codex hooks: ignoring ${field}; path must stay within the plugin root`);
|
|
30303
|
+
return null;
|
|
30304
|
+
}
|
|
30305
|
+
const normalized = normalize4(relativePath).replace(/\\/g, "/");
|
|
30306
|
+
if (normalized === ".." || normalized.startsWith("../")) {
|
|
30307
|
+
warnings.push(`Codex hooks: ignoring ${field}; path must not contain '..'`);
|
|
30308
|
+
return null;
|
|
30309
|
+
}
|
|
30310
|
+
return join19(pluginPath, normalized);
|
|
30311
|
+
}
|
|
30312
|
+
function substitutePluginEnv(value, env2) {
|
|
30313
|
+
if (typeof value === "string") {
|
|
30314
|
+
return Object.entries(env2).reduce((current, [key, replacement]) => current.replaceAll(`\${${key}}`, replacement), value);
|
|
30315
|
+
}
|
|
30316
|
+
if (Array.isArray(value)) {
|
|
30317
|
+
return value.map((entry) => substitutePluginEnv(entry, env2));
|
|
30318
|
+
}
|
|
30319
|
+
if (isRecord(value)) {
|
|
30320
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, substitutePluginEnv(entry, env2)]));
|
|
30321
|
+
}
|
|
30322
|
+
return value;
|
|
30323
|
+
}
|
|
30324
|
+
function withPluginEnv(hooksFile, pluginPath, pluginDataPath) {
|
|
30325
|
+
const env2 = {
|
|
30326
|
+
PLUGIN_ROOT: pluginPath,
|
|
30327
|
+
CLAUDE_PLUGIN_ROOT: pluginPath,
|
|
30328
|
+
PLUGIN_DATA: pluginDataPath,
|
|
30329
|
+
CLAUDE_PLUGIN_DATA: pluginDataPath
|
|
30330
|
+
};
|
|
30331
|
+
return substitutePluginEnv(hooksFile, env2);
|
|
30332
|
+
}
|
|
30333
|
+
function pluginDataPath(workspacePath, plugin) {
|
|
30334
|
+
const rawName = plugin.pluginName ?? basename8(plugin.resolved) ?? "plugin";
|
|
30335
|
+
const safeName = rawName.replace(/[^a-zA-Z0-9_.-]/g, "-");
|
|
30336
|
+
return join19(workspacePath, ".allagents", "plugin-data", safeName);
|
|
30337
|
+
}
|
|
30338
|
+
function readManifestHookDeclarations(pluginPath, manifestPath, warnings) {
|
|
30339
|
+
let manifest;
|
|
30340
|
+
try {
|
|
30341
|
+
const parsed = JSON.parse(readFileSync3(manifestPath, "utf-8"));
|
|
30342
|
+
if (!isRecord(parsed)) {
|
|
30343
|
+
warnings.push(`Codex hooks: ${manifestPath} must contain a JSON object`);
|
|
30344
|
+
return null;
|
|
30345
|
+
}
|
|
30346
|
+
manifest = parsed;
|
|
30347
|
+
} catch (error) {
|
|
30348
|
+
warnings.push(`Codex hooks: failed to parse ${manifestPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
30349
|
+
return null;
|
|
30350
|
+
}
|
|
30351
|
+
if (!("hooks" in manifest)) {
|
|
30352
|
+
return null;
|
|
30353
|
+
}
|
|
30354
|
+
const hooks = manifest.hooks;
|
|
30355
|
+
if (typeof hooks === "string") {
|
|
30356
|
+
const path = resolveManifestPath(pluginPath, "hooks", hooks, warnings);
|
|
30357
|
+
return path ? [{ path }] : null;
|
|
30358
|
+
}
|
|
30359
|
+
if (Array.isArray(hooks) && hooks.every((entry) => typeof entry === "string")) {
|
|
30360
|
+
const paths = hooks.map((entry) => resolveManifestPath(pluginPath, "hooks", entry, warnings)).filter((entry) => entry !== null);
|
|
30361
|
+
return paths.length > 0 ? paths.map((path) => ({ path })) : null;
|
|
30362
|
+
}
|
|
30363
|
+
if (Array.isArray(hooks) && hooks.every(isRecord)) {
|
|
30364
|
+
const inline = hooks.map((entry, index) => normalizeHooksObject(entry, `${manifestPath}#hooks[${index}]`, warnings, {
|
|
30365
|
+
filterCodexEvents: true
|
|
30366
|
+
})).filter((entry) => entry !== null && hasHooks(entry));
|
|
30367
|
+
return inline.length > 0 ? inline.map((entry) => ({ inline: entry })) : null;
|
|
30368
|
+
}
|
|
30369
|
+
if (isRecord(hooks)) {
|
|
30370
|
+
const inline = normalizeHooksObject(hooks, `${manifestPath}#hooks`, warnings, {
|
|
30371
|
+
filterCodexEvents: true
|
|
30372
|
+
});
|
|
30373
|
+
return inline && hasHooks(inline) ? [{ inline }] : null;
|
|
30374
|
+
}
|
|
30375
|
+
warnings.push(`Codex hooks: ignoring hooks in ${manifestPath}; expected a string, string array, object, or object array`);
|
|
30376
|
+
return null;
|
|
30377
|
+
}
|
|
30378
|
+
function collectPluginCodexHooks(plugin, workspacePath, warnings) {
|
|
30379
|
+
const pluginPath = plugin.resolved;
|
|
30380
|
+
const manifestPath = join19(pluginPath, CODEX_PLUGIN_MANIFEST_RELATIVE_PATH);
|
|
30381
|
+
const declarations = existsSync17(manifestPath) ? readManifestHookDeclarations(pluginPath, manifestPath, warnings) : null;
|
|
30382
|
+
const effectiveDeclarations = declarations ?? (existsSync17(join19(pluginPath, DEFAULT_PLUGIN_HOOKS_RELATIVE_PATH)) ? [{ path: join19(pluginPath, DEFAULT_PLUGIN_HOOKS_RELATIVE_PATH) }] : []);
|
|
30383
|
+
const dataPath = pluginDataPath(workspacePath, plugin);
|
|
30384
|
+
const hooksFiles = [];
|
|
30385
|
+
for (const declaration of effectiveDeclarations) {
|
|
30386
|
+
const hooksFile = declaration.inline ?? (declaration.path ? readHooksJson(declaration.path, warnings, { filterCodexEvents: true }) : null);
|
|
30387
|
+
if (hooksFile && hasHooks(hooksFile)) {
|
|
30388
|
+
hooksFiles.push(withPluginEnv(hooksFile, pluginPath, dataPath));
|
|
30389
|
+
}
|
|
30390
|
+
}
|
|
30391
|
+
return hooksFiles;
|
|
30392
|
+
}
|
|
30393
|
+
function mergeHooks(files) {
|
|
30394
|
+
const merged = {};
|
|
30395
|
+
for (const file of files) {
|
|
30396
|
+
for (const [eventName, groups] of Object.entries(file.hooks)) {
|
|
30397
|
+
if (groups.length === 0)
|
|
30398
|
+
continue;
|
|
30399
|
+
merged[eventName] = [...merged[eventName] ?? [], ...cloneJson(groups)];
|
|
30400
|
+
}
|
|
30401
|
+
}
|
|
30402
|
+
return { hooks: orderedHooks(merged) };
|
|
30403
|
+
}
|
|
30404
|
+
function removeManagedHooks(existing, previousManaged) {
|
|
30405
|
+
if (!hasHooks(previousManaged))
|
|
30406
|
+
return cloneJson(existing);
|
|
30407
|
+
const hooks = cloneJson(existing.hooks);
|
|
30408
|
+
for (const [eventName, previousGroups] of Object.entries(previousManaged.hooks)) {
|
|
30409
|
+
const groups = hooks[eventName];
|
|
30410
|
+
if (!groups || groups.length === 0)
|
|
30411
|
+
continue;
|
|
30412
|
+
for (const previousGroup of previousGroups) {
|
|
30413
|
+
const previousKey = JSON.stringify(previousGroup);
|
|
30414
|
+
const index = groups.findIndex((group) => JSON.stringify(group) === previousKey);
|
|
30415
|
+
if (index !== -1) {
|
|
30416
|
+
groups.splice(index, 1);
|
|
30417
|
+
}
|
|
30418
|
+
}
|
|
30419
|
+
if (groups.length === 0) {
|
|
30420
|
+
delete hooks[eventName];
|
|
30421
|
+
}
|
|
30422
|
+
}
|
|
30423
|
+
return { hooks: orderedHooks(hooks) };
|
|
30424
|
+
}
|
|
30425
|
+
function appendManagedHooks(base, currentManaged) {
|
|
30426
|
+
const hooks = cloneJson(base.hooks);
|
|
30427
|
+
for (const [eventName, groups] of Object.entries(currentManaged.hooks)) {
|
|
30428
|
+
if (groups.length === 0)
|
|
30429
|
+
continue;
|
|
30430
|
+
hooks[eventName] = [...hooks[eventName] ?? [], ...cloneJson(groups)];
|
|
30431
|
+
}
|
|
30432
|
+
return { hooks: orderedHooks(hooks) };
|
|
30433
|
+
}
|
|
30434
|
+
function readExistingProjectHooks(hooksPath, warnings) {
|
|
30435
|
+
if (!existsSync17(hooksPath)) {
|
|
30436
|
+
return { hooks: { hooks: {} }, valid: true };
|
|
30437
|
+
}
|
|
30438
|
+
const parsed = readHooksJson(hooksPath, warnings, {
|
|
30439
|
+
filterCodexEvents: false,
|
|
30440
|
+
strictEventArrays: true
|
|
30441
|
+
});
|
|
30442
|
+
return parsed ? { hooks: parsed, valid: true } : { hooks: { hooks: {} }, valid: false };
|
|
30443
|
+
}
|
|
30444
|
+
function writeProjectHooks(hooksPath, hooksFile) {
|
|
30445
|
+
mkdirSync4(dirname9(hooksPath), { recursive: true });
|
|
30446
|
+
writeFileSync4(hooksPath, `${JSON.stringify(hooksFile, null, 2)}
|
|
30447
|
+
`, "utf-8");
|
|
30448
|
+
}
|
|
30449
|
+
function pluginTargetsCodex(plugin) {
|
|
30450
|
+
return plugin.clients.includes("codex");
|
|
30451
|
+
}
|
|
30452
|
+
function syncCodexProjectHooks(validatedPlugins, workspacePath, previousManagedHooks, options2 = {}) {
|
|
30453
|
+
const warnings = [];
|
|
30454
|
+
const codexPlugins = validatedPlugins.filter((plugin) => plugin.success && pluginTargetsCodex(plugin));
|
|
30455
|
+
const currentManagedHooks = mergeHooks(codexPlugins.flatMap((plugin) => collectPluginCodexHooks(plugin, workspacePath, warnings)));
|
|
30456
|
+
const hasCurrentManagedHooks = hasHooks(currentManagedHooks);
|
|
30457
|
+
const hadPreviousManagedHooks = hasHooks(previousManagedHooks);
|
|
30458
|
+
if (!hasCurrentManagedHooks && !hadPreviousManagedHooks) {
|
|
30459
|
+
return { copyResults: [], warnings };
|
|
30460
|
+
}
|
|
30461
|
+
const hooksPath = join19(workspacePath, CODEX_HOOKS_RELATIVE_PATH);
|
|
30462
|
+
const { hooks: existingHooks, valid } = readExistingProjectHooks(hooksPath, warnings);
|
|
30463
|
+
if (!valid) {
|
|
30464
|
+
warnings.push(`Codex hooks: not updating ${CODEX_HOOKS_RELATIVE_PATH} because the existing file could not be parsed`);
|
|
30465
|
+
return {
|
|
30466
|
+
copyResults: [],
|
|
30467
|
+
warnings,
|
|
30468
|
+
...hadPreviousManagedHooks && { managedHooks: previousManagedHooks }
|
|
30469
|
+
};
|
|
30470
|
+
}
|
|
30471
|
+
const withoutPreviousManaged = removeManagedHooks(existingHooks, previousManagedHooks);
|
|
30472
|
+
const withoutManagedDuplicates = removeManagedHooks(withoutPreviousManaged, currentManagedHooks);
|
|
30473
|
+
const finalHooks = hasCurrentManagedHooks ? appendManagedHooks(withoutManagedDuplicates, currentManagedHooks) : withoutManagedDuplicates;
|
|
30474
|
+
const hasFinalHooks = hasHooks(finalHooks);
|
|
30475
|
+
if (!options2.dryRun) {
|
|
30476
|
+
if (hasFinalHooks) {
|
|
30477
|
+
writeProjectHooks(hooksPath, finalHooks);
|
|
30478
|
+
} else if (existsSync17(hooksPath)) {
|
|
30479
|
+
unlinkSync(hooksPath);
|
|
30480
|
+
}
|
|
30481
|
+
for (const plugin of codexPlugins) {
|
|
30482
|
+
const dataPath = pluginDataPath(workspacePath, plugin);
|
|
30483
|
+
if (hasCurrentManagedHooks) {
|
|
30484
|
+
mkdirSync4(dataPath, { recursive: true });
|
|
30485
|
+
}
|
|
30486
|
+
}
|
|
30487
|
+
}
|
|
30488
|
+
return {
|
|
30489
|
+
copyResults: [
|
|
30490
|
+
{
|
|
30491
|
+
source: "codex-plugin-hooks",
|
|
30492
|
+
destination: hooksPath,
|
|
30493
|
+
action: "generated"
|
|
30494
|
+
}
|
|
30495
|
+
],
|
|
30496
|
+
warnings,
|
|
30497
|
+
...hasCurrentManagedHooks && { managedHooks: currentManagedHooks }
|
|
30498
|
+
};
|
|
30499
|
+
}
|
|
30500
|
+
var CODEX_HOOKS_RELATIVE_PATH = ".codex/hooks.json", CODEX_PLUGIN_MANIFEST_RELATIVE_PATH = ".codex-plugin/plugin.json", DEFAULT_PLUGIN_HOOKS_RELATIVE_PATH = "hooks/hooks.json", CODEX_HOOK_EVENT_ORDER, CODEX_HOOK_EVENTS;
|
|
30501
|
+
var init_codex_hooks = __esm(() => {
|
|
30502
|
+
CODEX_HOOK_EVENT_ORDER = [
|
|
30503
|
+
"PreToolUse",
|
|
30504
|
+
"PermissionRequest",
|
|
30505
|
+
"PostToolUse",
|
|
30506
|
+
"PreCompact",
|
|
30507
|
+
"PostCompact",
|
|
30508
|
+
"SessionStart",
|
|
30509
|
+
"UserPromptSubmit",
|
|
30510
|
+
"SubagentStart",
|
|
30511
|
+
"SubagentStop",
|
|
30512
|
+
"Stop"
|
|
30513
|
+
];
|
|
30514
|
+
CODEX_HOOK_EVENTS = new Set(CODEX_HOOK_EVENT_ORDER);
|
|
30515
|
+
});
|
|
30516
|
+
|
|
30211
30517
|
// src/core/claude-mcp.ts
|
|
30212
|
-
import { existsSync as
|
|
30213
|
-
import { dirname as
|
|
30518
|
+
import { existsSync as existsSync18, readFileSync as readFileSync4, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5 } from "node:fs";
|
|
30519
|
+
import { dirname as dirname10 } from "node:path";
|
|
30214
30520
|
function deepEqual2(a, b) {
|
|
30215
30521
|
if (a === b)
|
|
30216
30522
|
return true;
|
|
@@ -30277,9 +30583,9 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
|
|
|
30277
30583
|
trackedServers: []
|
|
30278
30584
|
};
|
|
30279
30585
|
let existingConfig = {};
|
|
30280
|
-
if (
|
|
30586
|
+
if (existsSync18(configPath)) {
|
|
30281
30587
|
try {
|
|
30282
|
-
const content =
|
|
30588
|
+
const content = readFileSync4(configPath, "utf-8");
|
|
30283
30589
|
existingConfig = import_json52.default.parse(content);
|
|
30284
30590
|
} catch {
|
|
30285
30591
|
result.warnings.push(`Could not parse existing ${configPath}, starting fresh`);
|
|
@@ -30327,11 +30633,11 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
|
|
|
30327
30633
|
const hasChanges = result.added > 0 || result.overwritten > 0 || result.removed > 0;
|
|
30328
30634
|
if (hasChanges && !dryRun) {
|
|
30329
30635
|
existingConfig.mcpServers = existingServers;
|
|
30330
|
-
const dir =
|
|
30331
|
-
if (!
|
|
30332
|
-
|
|
30636
|
+
const dir = dirname10(configPath);
|
|
30637
|
+
if (!existsSync18(dir)) {
|
|
30638
|
+
mkdirSync5(dir, { recursive: true });
|
|
30333
30639
|
}
|
|
30334
|
-
|
|
30640
|
+
writeFileSync5(configPath, `${JSON.stringify(existingConfig, null, 2)}
|
|
30335
30641
|
`, "utf-8");
|
|
30336
30642
|
result.configPath = configPath;
|
|
30337
30643
|
}
|
|
@@ -30345,11 +30651,11 @@ function syncClaudeMcpConfig(validatedPlugins, options2) {
|
|
|
30345
30651
|
}
|
|
30346
30652
|
if (result.removed > 0 && !dryRun) {
|
|
30347
30653
|
existingConfig.mcpServers = existingServers;
|
|
30348
|
-
const dir =
|
|
30349
|
-
if (!
|
|
30350
|
-
|
|
30654
|
+
const dir = dirname10(configPath);
|
|
30655
|
+
if (!existsSync18(dir)) {
|
|
30656
|
+
mkdirSync5(dir, { recursive: true });
|
|
30351
30657
|
}
|
|
30352
|
-
|
|
30658
|
+
writeFileSync5(configPath, `${JSON.stringify(existingConfig, null, 2)}
|
|
30353
30659
|
`, "utf-8");
|
|
30354
30660
|
result.configPath = configPath;
|
|
30355
30661
|
}
|
|
@@ -30445,41 +30751,41 @@ var init_claude_mcp = __esm(() => {
|
|
|
30445
30751
|
});
|
|
30446
30752
|
|
|
30447
30753
|
// src/core/copilot-mcp.ts
|
|
30448
|
-
import { join as
|
|
30754
|
+
import { join as join20 } from "node:path";
|
|
30449
30755
|
function getCopilotMcpConfigPath() {
|
|
30450
|
-
return
|
|
30756
|
+
return join20(getHomeDir(), ".copilot", "mcp-config.json");
|
|
30451
30757
|
}
|
|
30452
30758
|
var init_copilot_mcp = __esm(() => {
|
|
30453
30759
|
init_constants();
|
|
30454
30760
|
});
|
|
30455
30761
|
|
|
30456
30762
|
// src/core/mcp-sync.ts
|
|
30457
|
-
import { existsSync as
|
|
30458
|
-
import { join as
|
|
30763
|
+
import { existsSync as existsSync19 } from "node:fs";
|
|
30764
|
+
import { join as join21 } from "node:path";
|
|
30459
30765
|
function buildSyncSpecs(workspacePath) {
|
|
30460
30766
|
return [
|
|
30461
30767
|
{
|
|
30462
30768
|
client: "vscode",
|
|
30463
30769
|
scope: "vscode",
|
|
30464
|
-
configPath:
|
|
30770
|
+
configPath: join21(workspacePath, ".vscode", "mcp.json"),
|
|
30465
30771
|
syncFn: syncVscodeMcpConfig
|
|
30466
30772
|
},
|
|
30467
30773
|
{
|
|
30468
30774
|
client: "claude",
|
|
30469
30775
|
scope: "claude",
|
|
30470
|
-
configPath:
|
|
30776
|
+
configPath: join21(workspacePath, ".mcp.json"),
|
|
30471
30777
|
syncFn: syncClaudeMcpConfig
|
|
30472
30778
|
},
|
|
30473
30779
|
{
|
|
30474
30780
|
client: "codex",
|
|
30475
30781
|
scope: "codex",
|
|
30476
|
-
configPath:
|
|
30782
|
+
configPath: join21(workspacePath, ".codex", "config.toml"),
|
|
30477
30783
|
syncFn: syncCodexProjectMcpConfig
|
|
30478
30784
|
},
|
|
30479
30785
|
{
|
|
30480
30786
|
client: "copilot",
|
|
30481
30787
|
scope: "copilot",
|
|
30482
|
-
configPath:
|
|
30788
|
+
configPath: join21(workspacePath, ".copilot", "mcp-config.json"),
|
|
30483
30789
|
syncFn: syncClaudeMcpConfig
|
|
30484
30790
|
}
|
|
30485
30791
|
];
|
|
@@ -30534,8 +30840,8 @@ function syncMcpServers(workspacePath, validPlugins, config, previousState, sync
|
|
|
30534
30840
|
async function syncMcpOnly(workspacePath = process.cwd(), options2 = {}) {
|
|
30535
30841
|
const { offline = false, dryRun = false } = options2;
|
|
30536
30842
|
await migrateWorkspaceSkillsV1toV2(workspacePath);
|
|
30537
|
-
const configPath =
|
|
30538
|
-
if (!
|
|
30843
|
+
const configPath = join21(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
30844
|
+
if (!existsSync19(configPath)) {
|
|
30539
30845
|
return {
|
|
30540
30846
|
success: false,
|
|
30541
30847
|
mcpResults: {},
|
|
@@ -30909,9 +31215,9 @@ function padStart2(str3, len) {
|
|
|
30909
31215
|
}
|
|
30910
31216
|
|
|
30911
31217
|
// src/core/managed-repos.ts
|
|
30912
|
-
import { existsSync as
|
|
31218
|
+
import { existsSync as existsSync20 } from "node:fs";
|
|
30913
31219
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
30914
|
-
import { dirname as
|
|
31220
|
+
import { dirname as dirname11, resolve as resolve11 } from "node:path";
|
|
30915
31221
|
function expandHome(p) {
|
|
30916
31222
|
if (p.startsWith("~/") || p === "~") {
|
|
30917
31223
|
return p.replace("~", getHomeDir());
|
|
@@ -30954,7 +31260,7 @@ function buildCloneUrl(source, repo) {
|
|
|
30954
31260
|
}
|
|
30955
31261
|
}
|
|
30956
31262
|
async function cloneRepo(url, dest, branch) {
|
|
30957
|
-
await mkdir8(
|
|
31263
|
+
await mkdir8(dirname11(dest), { recursive: true });
|
|
30958
31264
|
const git = esm_default({ timeout: { block: CLONE_TIMEOUT_MS2 } }).env(createGitEnv());
|
|
30959
31265
|
const cloneOptions = branch ? ["--branch", branch] : [];
|
|
30960
31266
|
await git.clone(url, dest, cloneOptions);
|
|
@@ -30993,7 +31299,7 @@ async function processManagedRepos(repositories, workspacePath, options2 = {}) {
|
|
|
30993
31299
|
}
|
|
30994
31300
|
const expandedPath = expandHome(repo.path);
|
|
30995
31301
|
const absolutePath = resolve11(workspacePath, expandedPath);
|
|
30996
|
-
if (!
|
|
31302
|
+
if (!existsSync20(absolutePath)) {
|
|
30997
31303
|
if (!shouldClone(repo.managed)) {
|
|
30998
31304
|
results.push({ path: repo.path, repo: repo.repo, action: "skipped" });
|
|
30999
31305
|
continue;
|
|
@@ -31045,9 +31351,9 @@ var init_managed_repos = __esm(() => {
|
|
|
31045
31351
|
});
|
|
31046
31352
|
|
|
31047
31353
|
// src/core/sync.ts
|
|
31048
|
-
import { existsSync as
|
|
31354
|
+
import { existsSync as existsSync21, readFileSync as readFileSync5, writeFileSync as writeFileSync6, lstatSync as lstatSync2 } from "node:fs";
|
|
31049
31355
|
import { rm as rm4, unlink as unlink2, rmdir, copyFile } from "node:fs/promises";
|
|
31050
|
-
import { join as
|
|
31356
|
+
import { join as join22, resolve as resolve12, dirname as dirname12, relative as relative6 } from "node:path";
|
|
31051
31357
|
function deduplicateClientsByPath(clients, clientMappings = CLIENT_MAPPINGS) {
|
|
31052
31358
|
const pathToClients = new Map;
|
|
31053
31359
|
for (const client of clients) {
|
|
@@ -31210,7 +31516,7 @@ async function selectivePurgeWorkspace(workspacePath, state, clients) {
|
|
|
31210
31516
|
const previousFiles = getPreviouslySyncedFiles(state, client);
|
|
31211
31517
|
const purgedPaths = [];
|
|
31212
31518
|
for (const filePath of previousFiles) {
|
|
31213
|
-
const fullPath =
|
|
31519
|
+
const fullPath = join22(workspacePath, filePath);
|
|
31214
31520
|
const cleanPath = fullPath.replace(/\/$/, "");
|
|
31215
31521
|
let stats;
|
|
31216
31522
|
try {
|
|
@@ -31237,16 +31543,16 @@ async function selectivePurgeWorkspace(workspacePath, state, clients) {
|
|
|
31237
31543
|
return result;
|
|
31238
31544
|
}
|
|
31239
31545
|
async function cleanupEmptyParents(workspacePath, filePath) {
|
|
31240
|
-
let parentPath =
|
|
31546
|
+
let parentPath = dirname12(filePath);
|
|
31241
31547
|
while (parentPath && parentPath !== "." && parentPath !== "/") {
|
|
31242
|
-
const fullParentPath =
|
|
31243
|
-
if (!
|
|
31244
|
-
parentPath =
|
|
31548
|
+
const fullParentPath = join22(workspacePath, parentPath);
|
|
31549
|
+
if (!existsSync21(fullParentPath)) {
|
|
31550
|
+
parentPath = dirname12(parentPath);
|
|
31245
31551
|
continue;
|
|
31246
31552
|
}
|
|
31247
31553
|
try {
|
|
31248
31554
|
await rmdir(fullParentPath);
|
|
31249
|
-
parentPath =
|
|
31555
|
+
parentPath = dirname12(parentPath);
|
|
31250
31556
|
} catch {
|
|
31251
31557
|
break;
|
|
31252
31558
|
}
|
|
@@ -31325,8 +31631,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
31325
31631
|
errors2.push(`Cannot resolve file '${file}' - no workspace.source configured`);
|
|
31326
31632
|
continue;
|
|
31327
31633
|
}
|
|
31328
|
-
const fullPath =
|
|
31329
|
-
if (!
|
|
31634
|
+
const fullPath = join22(defaultSourcePath, file);
|
|
31635
|
+
if (!existsSync21(fullPath)) {
|
|
31330
31636
|
errors2.push(`File source not found: ${fullPath}`);
|
|
31331
31637
|
}
|
|
31332
31638
|
continue;
|
|
@@ -31344,8 +31650,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
31344
31650
|
errors2.push(`GitHub cache not found for ${cacheKey}`);
|
|
31345
31651
|
continue;
|
|
31346
31652
|
}
|
|
31347
|
-
const fullPath =
|
|
31348
|
-
if (!
|
|
31653
|
+
const fullPath = join22(cachePath, parsed.filePath);
|
|
31654
|
+
if (!existsSync21(fullPath)) {
|
|
31349
31655
|
errors2.push(`Path not found in repository: ${cacheKey}/${parsed.filePath}`);
|
|
31350
31656
|
}
|
|
31351
31657
|
} else {
|
|
@@ -31355,11 +31661,11 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
31355
31661
|
} else if (file.source.startsWith("../")) {
|
|
31356
31662
|
fullPath = resolve12(file.source);
|
|
31357
31663
|
} else if (defaultSourcePath) {
|
|
31358
|
-
fullPath =
|
|
31664
|
+
fullPath = join22(defaultSourcePath, file.source);
|
|
31359
31665
|
} else {
|
|
31360
31666
|
fullPath = resolve12(file.source);
|
|
31361
31667
|
}
|
|
31362
|
-
if (!
|
|
31668
|
+
if (!existsSync21(fullPath)) {
|
|
31363
31669
|
errors2.push(`File source not found: ${fullPath}`);
|
|
31364
31670
|
}
|
|
31365
31671
|
}
|
|
@@ -31368,8 +31674,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
31368
31674
|
errors2.push(`Cannot resolve file '${file.dest}' - no workspace.source configured and no explicit source provided`);
|
|
31369
31675
|
continue;
|
|
31370
31676
|
}
|
|
31371
|
-
const fullPath =
|
|
31372
|
-
if (!
|
|
31677
|
+
const fullPath = join22(defaultSourcePath, file.dest ?? "");
|
|
31678
|
+
if (!existsSync21(fullPath)) {
|
|
31373
31679
|
errors2.push(`File source not found: ${fullPath}`);
|
|
31374
31680
|
}
|
|
31375
31681
|
}
|
|
@@ -31517,7 +31823,7 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
|
|
|
31517
31823
|
...fetchResult.error && { error: fetchResult.error }
|
|
31518
31824
|
};
|
|
31519
31825
|
}
|
|
31520
|
-
const resolvedPath2 = parsed?.subpath ?
|
|
31826
|
+
const resolvedPath2 = parsed?.subpath ? join22(fetchResult.cachePath, parsed.subpath) : fetchResult.cachePath;
|
|
31521
31827
|
return {
|
|
31522
31828
|
plugin: pluginSource,
|
|
31523
31829
|
resolved: resolvedPath2,
|
|
@@ -31527,7 +31833,7 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
|
|
|
31527
31833
|
};
|
|
31528
31834
|
}
|
|
31529
31835
|
const resolvedPath = resolve12(workspacePath, pluginSource);
|
|
31530
|
-
if (!
|
|
31836
|
+
if (!existsSync21(resolvedPath)) {
|
|
31531
31837
|
return {
|
|
31532
31838
|
plugin: pluginSource,
|
|
31533
31839
|
resolved: resolvedPath,
|
|
@@ -31700,12 +32006,12 @@ function buildPluginSkillNameMaps(allSkills) {
|
|
|
31700
32006
|
return pluginMaps;
|
|
31701
32007
|
}
|
|
31702
32008
|
function generateVscodeWorkspaceFile(workspacePath, config) {
|
|
31703
|
-
const configDir =
|
|
31704
|
-
const templatePath =
|
|
32009
|
+
const configDir = join22(workspacePath, CONFIG_DIR);
|
|
32010
|
+
const templatePath = join22(configDir, VSCODE_TEMPLATE_FILE);
|
|
31705
32011
|
let template;
|
|
31706
|
-
if (
|
|
32012
|
+
if (existsSync21(templatePath)) {
|
|
31707
32013
|
try {
|
|
31708
|
-
template = import_json53.default.parse(
|
|
32014
|
+
template = import_json53.default.parse(readFileSync5(templatePath, "utf-8"));
|
|
31709
32015
|
} catch (error) {
|
|
31710
32016
|
throw new Error(`Failed to parse ${templatePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
31711
32017
|
}
|
|
@@ -31718,7 +32024,7 @@ function generateVscodeWorkspaceFile(workspacePath, config) {
|
|
|
31718
32024
|
const outputPath = getWorkspaceOutputPath(workspacePath, config.vscode);
|
|
31719
32025
|
const contentStr = `${JSON.stringify(content, null, "\t")}
|
|
31720
32026
|
`;
|
|
31721
|
-
|
|
32027
|
+
writeFileSync6(outputPath, contentStr, "utf-8");
|
|
31722
32028
|
return contentStr;
|
|
31723
32029
|
}
|
|
31724
32030
|
function failedSyncResult(error, overrides) {
|
|
@@ -31761,6 +32067,9 @@ function countCopyResults(pluginResults, workspaceFileResults) {
|
|
|
31761
32067
|
case "copied":
|
|
31762
32068
|
totalCopied++;
|
|
31763
32069
|
break;
|
|
32070
|
+
case "generated":
|
|
32071
|
+
totalGenerated++;
|
|
32072
|
+
break;
|
|
31764
32073
|
case "failed":
|
|
31765
32074
|
totalFailed++;
|
|
31766
32075
|
break;
|
|
@@ -31855,8 +32164,8 @@ async function syncVscodeWorkspaceFile(workspacePath, config, configPath, previo
|
|
|
31855
32164
|
let updatedConfig = config;
|
|
31856
32165
|
if (previousState?.vscodeWorkspaceHash && previousState?.vscodeWorkspaceRepos) {
|
|
31857
32166
|
const outputPath = getWorkspaceOutputPath(workspacePath, config.vscode);
|
|
31858
|
-
if (
|
|
31859
|
-
const existingContent =
|
|
32167
|
+
if (existsSync21(outputPath)) {
|
|
32168
|
+
const existingContent = readFileSync5(outputPath, "utf-8");
|
|
31860
32169
|
const currentHash = computeWorkspaceHash(existingContent);
|
|
31861
32170
|
if (currentHash !== previousState.vscodeWorkspaceHash) {
|
|
31862
32171
|
try {
|
|
@@ -31946,6 +32255,7 @@ async function persistSyncState(workspacePath, pluginResults, workspaceFileResul
|
|
|
31946
32255
|
}
|
|
31947
32256
|
await saveSyncState(workspacePath, {
|
|
31948
32257
|
files: syncedFiles,
|
|
32258
|
+
...extra?.codexHooks && { codexHooks: extra.codexHooks },
|
|
31949
32259
|
...Object.keys(nativePluginsState).length > 0 && {
|
|
31950
32260
|
nativePlugins: nativePluginsState
|
|
31951
32261
|
},
|
|
@@ -31970,9 +32280,9 @@ async function syncWorkspace(workspacePath = process.cwd(), options2 = {}) {
|
|
|
31970
32280
|
skipManaged = false
|
|
31971
32281
|
} = options2;
|
|
31972
32282
|
const sw = new Stopwatch;
|
|
31973
|
-
const configDir =
|
|
31974
|
-
const configPath =
|
|
31975
|
-
if (!
|
|
32283
|
+
const configDir = join22(workspacePath, CONFIG_DIR);
|
|
32284
|
+
const configPath = join22(configDir, WORKSPACE_CONFIG_FILE);
|
|
32285
|
+
if (!existsSync21(configPath)) {
|
|
31976
32286
|
return failedSyncResult(`${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
|
|
31977
32287
|
Run 'allagents workspace init <path>' to create a new workspace`);
|
|
31978
32288
|
}
|
|
@@ -32060,7 +32370,11 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
32060
32370
|
return { ...result, scope: "project" };
|
|
32061
32371
|
})), `${validPlugins.length} plugin(s)`);
|
|
32062
32372
|
const nativeResult = await sw.measure("native-plugin-sync", () => syncNativePlugins(validPlugins, previousState, "project", workspacePath, dryRun, warnings, messages));
|
|
32063
|
-
|
|
32373
|
+
const codexHookSync = await sw.measure("codex-hooks-sync", async () => syncCodexProjectHooks(validPlugins, workspacePath, previousState?.codexHooks, {
|
|
32374
|
+
dryRun
|
|
32375
|
+
}));
|
|
32376
|
+
warnings.push(...codexHookSync.warnings);
|
|
32377
|
+
const workspaceFileResults = [...codexHookSync.copyResults];
|
|
32064
32378
|
let writtenSkillsIndexFiles = [];
|
|
32065
32379
|
const skipWorkspaceFiles = !!config.workspace?.source && !validatedWorkspaceSource;
|
|
32066
32380
|
if (config.workspace && !skipWorkspaceFiles) {
|
|
@@ -32069,8 +32383,8 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
32069
32383
|
const filesToCopy = [...config.workspace.files];
|
|
32070
32384
|
if (hasRepositories && sourcePath) {
|
|
32071
32385
|
for (const agentFile of AGENT_FILES) {
|
|
32072
|
-
const agentPath =
|
|
32073
|
-
if (
|
|
32386
|
+
const agentPath = join22(sourcePath, agentFile);
|
|
32387
|
+
if (existsSync21(agentPath) && !filesToCopy.includes(agentFile)) {
|
|
32074
32388
|
filesToCopy.push(agentFile);
|
|
32075
32389
|
}
|
|
32076
32390
|
}
|
|
@@ -32103,17 +32417,17 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
32103
32417
|
}
|
|
32104
32418
|
cleanupSkillsIndex(workspacePath, writtenSkillsIndexFiles);
|
|
32105
32419
|
}
|
|
32106
|
-
workspaceFileResults
|
|
32420
|
+
workspaceFileResults.push(...await copyWorkspaceFiles(sourcePath, workspacePath, filesToCopy, {
|
|
32107
32421
|
dryRun,
|
|
32108
32422
|
githubCache,
|
|
32109
32423
|
repositories: config.repositories,
|
|
32110
32424
|
skillsIndexRefs
|
|
32111
|
-
});
|
|
32425
|
+
}));
|
|
32112
32426
|
if (hasRepositories && !dryRun && syncClients.includes("claude") && sourcePath) {
|
|
32113
|
-
const claudePath =
|
|
32114
|
-
const agentsPath =
|
|
32115
|
-
const claudeExistsInSource =
|
|
32116
|
-
if (!claudeExistsInSource &&
|
|
32427
|
+
const claudePath = join22(workspacePath, "CLAUDE.md");
|
|
32428
|
+
const agentsPath = join22(workspacePath, "AGENTS.md");
|
|
32429
|
+
const claudeExistsInSource = existsSync21(join22(sourcePath, "CLAUDE.md"));
|
|
32430
|
+
if (!claudeExistsInSource && existsSync21(agentsPath) && !existsSync21(claudePath)) {
|
|
32117
32431
|
await copyFile(agentsPath, claudePath);
|
|
32118
32432
|
}
|
|
32119
32433
|
}
|
|
@@ -32152,6 +32466,9 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
32152
32466
|
const sources = await buildSourcesProvenance(validPlugins, config.plugins);
|
|
32153
32467
|
await sw.measure("persist-state", () => persistSyncState(workspacePath, pluginResults, workspaceFileResults, syncClients, nativePluginsByClient, nativeResult, {
|
|
32154
32468
|
...vscodeState && { vscodeState },
|
|
32469
|
+
...codexHookSync.managedHooks && {
|
|
32470
|
+
codexHooks: codexHookSync.managedHooks
|
|
32471
|
+
},
|
|
32155
32472
|
...Object.keys(mcpResults).length > 0 && {
|
|
32156
32473
|
mcpTrackedServers: Object.fromEntries(Object.entries(mcpResults).map(([scope, r]) => [
|
|
32157
32474
|
scope,
|
|
@@ -32197,7 +32514,7 @@ async function seedFetchCacheFromMarketplaces(results) {
|
|
|
32197
32514
|
}
|
|
32198
32515
|
function readGitBranch(repoPath) {
|
|
32199
32516
|
try {
|
|
32200
|
-
const head =
|
|
32517
|
+
const head = readFileSync5(join22(repoPath, ".git", "HEAD"), "utf-8").trim();
|
|
32201
32518
|
const prefix = "ref: refs/heads/";
|
|
32202
32519
|
return head.startsWith(prefix) ? head.slice(prefix.length) : null;
|
|
32203
32520
|
} catch {
|
|
@@ -32396,6 +32713,7 @@ var init_sync = __esm(() => {
|
|
|
32396
32713
|
init_workspace_modify();
|
|
32397
32714
|
init_vscode_mcp();
|
|
32398
32715
|
init_codex_mcp();
|
|
32716
|
+
init_codex_hooks();
|
|
32399
32717
|
init_claude_mcp();
|
|
32400
32718
|
init_copilot_mcp();
|
|
32401
32719
|
init_mcp_sync();
|
|
@@ -32405,12 +32723,12 @@ var init_sync = __esm(() => {
|
|
|
32405
32723
|
});
|
|
32406
32724
|
|
|
32407
32725
|
// src/core/github-fetch.ts
|
|
32408
|
-
import { existsSync as
|
|
32409
|
-
import { join as
|
|
32726
|
+
import { existsSync as existsSync22, readFileSync as readFileSync6 } from "node:fs";
|
|
32727
|
+
import { join as join23 } from "node:path";
|
|
32410
32728
|
function readFileFromClone(tempDir, filePath) {
|
|
32411
|
-
const fullPath =
|
|
32412
|
-
if (
|
|
32413
|
-
return
|
|
32729
|
+
const fullPath = join23(tempDir, filePath);
|
|
32730
|
+
if (existsSync22(fullPath)) {
|
|
32731
|
+
return readFileSync6(fullPath, "utf-8");
|
|
32414
32732
|
}
|
|
32415
32733
|
return null;
|
|
32416
32734
|
}
|
|
@@ -32509,14 +32827,14 @@ var init_github_fetch = __esm(() => {
|
|
|
32509
32827
|
|
|
32510
32828
|
// src/core/workspace.ts
|
|
32511
32829
|
import { cp as cp2, mkdir as mkdir9, readFile as readFile13, writeFile as writeFile9, copyFile as copyFile2, unlink as unlink3 } from "node:fs/promises";
|
|
32512
|
-
import { existsSync as
|
|
32513
|
-
import { join as
|
|
32830
|
+
import { existsSync as existsSync23 } from "node:fs";
|
|
32831
|
+
import { join as join24, resolve as resolve13, dirname as dirname13, relative as relative7, sep as sep2, isAbsolute as isAbsolute5 } from "node:path";
|
|
32514
32832
|
import { fileURLToPath } from "node:url";
|
|
32515
32833
|
async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
32516
32834
|
const absoluteTarget = resolve13(targetPath);
|
|
32517
|
-
const configDir =
|
|
32518
|
-
const configPath =
|
|
32519
|
-
if (
|
|
32835
|
+
const configDir = join24(absoluteTarget, CONFIG_DIR);
|
|
32836
|
+
const configPath = join24(configDir, WORKSPACE_CONFIG_FILE);
|
|
32837
|
+
if (existsSync23(configPath)) {
|
|
32520
32838
|
if (options2.force) {
|
|
32521
32839
|
await unlink3(configPath);
|
|
32522
32840
|
} else {
|
|
@@ -32525,9 +32843,9 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32525
32843
|
}
|
|
32526
32844
|
}
|
|
32527
32845
|
const currentFilePath = fileURLToPath(import.meta.url);
|
|
32528
|
-
const currentFileDir =
|
|
32846
|
+
const currentFileDir = dirname13(currentFilePath);
|
|
32529
32847
|
const isProduction = currentFilePath.includes(`${sep2}dist${sep2}`);
|
|
32530
|
-
const defaultTemplatePath = isProduction ?
|
|
32848
|
+
const defaultTemplatePath = isProduction ? join24(currentFileDir, "templates", "default") : join24(currentFileDir, "..", "templates", "default");
|
|
32531
32849
|
let githubTempDir;
|
|
32532
32850
|
let parsedFromUrl;
|
|
32533
32851
|
let githubBasePath = "";
|
|
@@ -32556,7 +32874,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32556
32874
|
const workspace = parsed2?.workspace;
|
|
32557
32875
|
if (workspace?.source) {
|
|
32558
32876
|
const source = workspace.source;
|
|
32559
|
-
if (!isGitHubUrl(source) && !
|
|
32877
|
+
if (!isGitHubUrl(source) && !isAbsolute5(source)) {
|
|
32560
32878
|
if (parsedFromUrl) {
|
|
32561
32879
|
const sourcePath = source === "." ? githubBasePath : githubBasePath ? `${githubBasePath}/${source}` : source;
|
|
32562
32880
|
workspace.source = `https://github.com/${parsedFromUrl.owner}/${parsedFromUrl.repo}/tree/${githubBranch}/${sourcePath}`;
|
|
@@ -32567,19 +32885,19 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32567
32885
|
console.log(`✓ Using workspace.yaml from: ${options2.from}`);
|
|
32568
32886
|
} else {
|
|
32569
32887
|
const fromPath = resolve13(options2.from);
|
|
32570
|
-
if (!
|
|
32888
|
+
if (!existsSync23(fromPath)) {
|
|
32571
32889
|
throw new Error(`Template not found: ${fromPath}`);
|
|
32572
32890
|
}
|
|
32573
32891
|
const { stat: stat2 } = await import("node:fs/promises");
|
|
32574
32892
|
const fromStat = await stat2(fromPath);
|
|
32575
32893
|
let sourceYamlPath;
|
|
32576
32894
|
if (fromStat.isDirectory()) {
|
|
32577
|
-
const nestedPath =
|
|
32578
|
-
const rootPath =
|
|
32579
|
-
if (
|
|
32895
|
+
const nestedPath = join24(fromPath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
32896
|
+
const rootPath = join24(fromPath, WORKSPACE_CONFIG_FILE);
|
|
32897
|
+
if (existsSync23(nestedPath)) {
|
|
32580
32898
|
sourceYamlPath = nestedPath;
|
|
32581
32899
|
sourceDir = fromPath;
|
|
32582
|
-
} else if (
|
|
32900
|
+
} else if (existsSync23(rootPath)) {
|
|
32583
32901
|
sourceYamlPath = rootPath;
|
|
32584
32902
|
sourceDir = fromPath;
|
|
32585
32903
|
} else {
|
|
@@ -32588,9 +32906,9 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32588
32906
|
}
|
|
32589
32907
|
} else {
|
|
32590
32908
|
sourceYamlPath = fromPath;
|
|
32591
|
-
const parentDir =
|
|
32909
|
+
const parentDir = dirname13(fromPath);
|
|
32592
32910
|
if (parentDir.endsWith(CONFIG_DIR)) {
|
|
32593
|
-
sourceDir =
|
|
32911
|
+
sourceDir = dirname13(parentDir);
|
|
32594
32912
|
} else {
|
|
32595
32913
|
sourceDir = parentDir;
|
|
32596
32914
|
}
|
|
@@ -32601,7 +32919,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32601
32919
|
const workspace = parsed2?.workspace;
|
|
32602
32920
|
if (workspace?.source) {
|
|
32603
32921
|
const source = workspace.source;
|
|
32604
|
-
if (!isGitHubUrl(source) && !
|
|
32922
|
+
if (!isGitHubUrl(source) && !isAbsolute5(source)) {
|
|
32605
32923
|
workspace.source = resolve13(sourceDir, source);
|
|
32606
32924
|
workspaceYamlContent = dump(parsed2, { lineWidth: -1 });
|
|
32607
32925
|
}
|
|
@@ -32610,8 +32928,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32610
32928
|
console.log(`✓ Using workspace.yaml from: ${sourceYamlPath}`);
|
|
32611
32929
|
}
|
|
32612
32930
|
} else {
|
|
32613
|
-
const defaultYamlPath =
|
|
32614
|
-
if (!
|
|
32931
|
+
const defaultYamlPath = join24(defaultTemplatePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
32932
|
+
if (!existsSync23(defaultYamlPath)) {
|
|
32615
32933
|
throw new Error(`Default template not found at: ${defaultTemplatePath}`);
|
|
32616
32934
|
}
|
|
32617
32935
|
workspaceYamlContent = await readFile13(defaultYamlPath, "utf-8");
|
|
@@ -32627,8 +32945,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32627
32945
|
const clientNames = getClientTypes(clients);
|
|
32628
32946
|
const VSCODE_TEMPLATE_FILE2 = "template.code-workspace";
|
|
32629
32947
|
if (clientNames.includes("vscode") && options2.from) {
|
|
32630
|
-
const targetTemplatePath =
|
|
32631
|
-
if (!
|
|
32948
|
+
const targetTemplatePath = join24(configDir, VSCODE_TEMPLATE_FILE2);
|
|
32949
|
+
if (!existsSync23(targetTemplatePath)) {
|
|
32632
32950
|
if (isGitHubUrl(options2.from) && githubTempDir) {
|
|
32633
32951
|
if (parsedFromUrl) {
|
|
32634
32952
|
const templatePath = githubBasePath ? `${githubBasePath}/${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}` : `${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}`;
|
|
@@ -32638,8 +32956,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32638
32956
|
}
|
|
32639
32957
|
}
|
|
32640
32958
|
} else if (sourceDir) {
|
|
32641
|
-
const sourceTemplatePath =
|
|
32642
|
-
if (
|
|
32959
|
+
const sourceTemplatePath = join24(sourceDir, CONFIG_DIR, VSCODE_TEMPLATE_FILE2);
|
|
32960
|
+
if (existsSync23(sourceTemplatePath)) {
|
|
32643
32961
|
await copyFile2(sourceTemplatePath, targetTemplatePath);
|
|
32644
32962
|
}
|
|
32645
32963
|
}
|
|
@@ -32652,8 +32970,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32652
32970
|
if (options2.from && isGitHubUrl(options2.from) && githubTempDir) {
|
|
32653
32971
|
if (parsedFromUrl) {
|
|
32654
32972
|
for (const agentFile of AGENT_FILES) {
|
|
32655
|
-
const targetFilePath =
|
|
32656
|
-
if (
|
|
32973
|
+
const targetFilePath = join24(absoluteTarget, agentFile);
|
|
32974
|
+
if (existsSync23(targetFilePath)) {
|
|
32657
32975
|
copiedAgentFiles.push(agentFile);
|
|
32658
32976
|
continue;
|
|
32659
32977
|
}
|
|
@@ -32668,13 +32986,13 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32668
32986
|
} else {
|
|
32669
32987
|
const effectiveSourceDir = sourceDir ?? defaultTemplatePath;
|
|
32670
32988
|
for (const agentFile of AGENT_FILES) {
|
|
32671
|
-
const targetFilePath =
|
|
32672
|
-
if (
|
|
32989
|
+
const targetFilePath = join24(absoluteTarget, agentFile);
|
|
32990
|
+
if (existsSync23(targetFilePath)) {
|
|
32673
32991
|
copiedAgentFiles.push(agentFile);
|
|
32674
32992
|
continue;
|
|
32675
32993
|
}
|
|
32676
|
-
const sourcePath =
|
|
32677
|
-
if (
|
|
32994
|
+
const sourcePath = join24(effectiveSourceDir, agentFile);
|
|
32995
|
+
if (existsSync23(sourcePath)) {
|
|
32678
32996
|
const content = await readFile13(sourcePath, "utf-8");
|
|
32679
32997
|
await writeFile9(targetFilePath, content, "utf-8");
|
|
32680
32998
|
copiedAgentFiles.push(agentFile);
|
|
@@ -32682,16 +33000,16 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
32682
33000
|
}
|
|
32683
33001
|
}
|
|
32684
33002
|
if (copiedAgentFiles.length === 0) {
|
|
32685
|
-
await ensureWorkspaceRules(
|
|
33003
|
+
await ensureWorkspaceRules(join24(absoluteTarget, "AGENTS.md"), repositories);
|
|
32686
33004
|
copiedAgentFiles.push("AGENTS.md");
|
|
32687
33005
|
} else {
|
|
32688
33006
|
for (const agentFile of copiedAgentFiles) {
|
|
32689
|
-
await ensureWorkspaceRules(
|
|
33007
|
+
await ensureWorkspaceRules(join24(absoluteTarget, agentFile), repositories);
|
|
32690
33008
|
}
|
|
32691
33009
|
}
|
|
32692
33010
|
if (clientNames.includes("claude") && !copiedAgentFiles.includes("CLAUDE.md") && copiedAgentFiles.includes("AGENTS.md")) {
|
|
32693
|
-
const agentsPath =
|
|
32694
|
-
const claudePath =
|
|
33011
|
+
const agentsPath = join24(absoluteTarget, "AGENTS.md");
|
|
33012
|
+
const claudePath = join24(absoluteTarget, "CLAUDE.md");
|
|
32695
33013
|
await copyFile2(agentsPath, claudePath);
|
|
32696
33014
|
}
|
|
32697
33015
|
}
|
|
@@ -32736,14 +33054,14 @@ Next steps:`);
|
|
|
32736
33054
|
async function seedCacheFromClone(tempDir, owner, repo, branch) {
|
|
32737
33055
|
const cachePaths = [
|
|
32738
33056
|
getPluginCachePath(owner, repo, branch),
|
|
32739
|
-
|
|
33057
|
+
join24(getMarketplacesDir(), repo)
|
|
32740
33058
|
];
|
|
32741
33059
|
for (const cachePath of cachePaths) {
|
|
32742
|
-
if (
|
|
33060
|
+
if (existsSync23(cachePath))
|
|
32743
33061
|
continue;
|
|
32744
33062
|
try {
|
|
32745
|
-
const parentDir =
|
|
32746
|
-
if (!
|
|
33063
|
+
const parentDir = dirname13(cachePath);
|
|
33064
|
+
if (!existsSync23(parentDir)) {
|
|
32747
33065
|
await mkdir9(parentDir, { recursive: true });
|
|
32748
33066
|
}
|
|
32749
33067
|
await cp2(tempDir, cachePath, { recursive: true });
|
|
@@ -34904,17 +35222,17 @@ function buildSearchQueries(query, owner) {
|
|
|
34904
35222
|
const trimmed2 = query.trim();
|
|
34905
35223
|
const pathTerm = trimmed2.replace(/ /g, "-");
|
|
34906
35224
|
const userClause = owner ? `user:${owner}` : "";
|
|
34907
|
-
const
|
|
35225
|
+
const join26 = (...parts) => parts.filter(Boolean).join(" ");
|
|
34908
35226
|
const queries = [
|
|
34909
|
-
{ priority: 1, label: "path", q:
|
|
35227
|
+
{ priority: 1, label: "path", q: join26("filename:SKILL.md", `path:${pathTerm}`, userClause) }
|
|
34910
35228
|
];
|
|
34911
35229
|
if (pathTerm !== trimmed2) {
|
|
34912
|
-
queries.push({ priority: 2, label: "hyphen", q:
|
|
35230
|
+
queries.push({ priority: 2, label: "hyphen", q: join26("filename:SKILL.md", pathTerm, userClause) });
|
|
34913
35231
|
}
|
|
34914
35232
|
if (!owner && couldBeOwner(trimmed2)) {
|
|
34915
35233
|
queries.push({ priority: 3, label: "owner", q: `filename:SKILL.md user:${trimmed2}` });
|
|
34916
35234
|
}
|
|
34917
|
-
queries.push({ priority: 4, label: "primary", q:
|
|
35235
|
+
queries.push({ priority: 4, label: "primary", q: join26("filename:SKILL.md", trimmed2, userClause) });
|
|
34918
35236
|
return queries;
|
|
34919
35237
|
}
|
|
34920
35238
|
function classifyApiError(status, body) {
|
|
@@ -37433,8 +37751,8 @@ var require_resolve = __commonJS((exports) => {
|
|
|
37433
37751
|
}
|
|
37434
37752
|
return count;
|
|
37435
37753
|
}
|
|
37436
|
-
function getFullPath(resolver, id = "",
|
|
37437
|
-
if (
|
|
37754
|
+
function getFullPath(resolver, id = "", normalize5) {
|
|
37755
|
+
if (normalize5 !== false)
|
|
37438
37756
|
id = normalizeId(id);
|
|
37439
37757
|
const p = resolver.parse(id);
|
|
37440
37758
|
return _getFullPath(resolver, p);
|
|
@@ -38721,7 +39039,7 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
38721
39039
|
var require_fast_uri = __commonJS((exports, module) => {
|
|
38722
39040
|
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils7();
|
|
38723
39041
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
38724
|
-
function
|
|
39042
|
+
function normalize5(uri, options2) {
|
|
38725
39043
|
if (typeof uri === "string") {
|
|
38726
39044
|
uri = serialize(parse6(uri, options2), options2);
|
|
38727
39045
|
} else if (typeof uri === "object") {
|
|
@@ -38956,7 +39274,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
38956
39274
|
}
|
|
38957
39275
|
var fastUri = {
|
|
38958
39276
|
SCHEMES,
|
|
38959
|
-
normalize:
|
|
39277
|
+
normalize: normalize5,
|
|
38960
39278
|
resolve: resolve15,
|
|
38961
39279
|
resolveComponent,
|
|
38962
39280
|
equal,
|
|
@@ -42256,7 +42574,7 @@ var package_default;
|
|
|
42256
42574
|
var init_package = __esm(() => {
|
|
42257
42575
|
package_default = {
|
|
42258
42576
|
name: "allagents",
|
|
42259
|
-
version: "1.
|
|
42577
|
+
version: "1.13.0-next.1",
|
|
42260
42578
|
packageManager: "bun@1.3.12",
|
|
42261
42579
|
description: "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
|
|
42262
42580
|
type: "module",
|
|
@@ -42341,10 +42659,10 @@ var init_package = __esm(() => {
|
|
|
42341
42659
|
|
|
42342
42660
|
// src/cli/update-check.ts
|
|
42343
42661
|
import { readFile as readFile18 } from "node:fs/promises";
|
|
42344
|
-
import { join as
|
|
42662
|
+
import { join as join30 } from "node:path";
|
|
42345
42663
|
import { spawn as spawn4 } from "node:child_process";
|
|
42346
42664
|
async function getCachedUpdateInfo(path3) {
|
|
42347
|
-
const filePath = path3 ??
|
|
42665
|
+
const filePath = path3 ?? join30(getHomeDir(), CONFIG_DIR, CACHE_FILE);
|
|
42348
42666
|
try {
|
|
42349
42667
|
const raw = await readFile18(filePath, "utf-8");
|
|
42350
42668
|
const data = JSON.parse(raw);
|
|
@@ -42382,8 +42700,8 @@ function buildNotice(currentVersion, latestVersion) {
|
|
|
42382
42700
|
Run \`allagents self update\` to upgrade.`);
|
|
42383
42701
|
}
|
|
42384
42702
|
function backgroundUpdateCheck() {
|
|
42385
|
-
const dir =
|
|
42386
|
-
const filePath =
|
|
42703
|
+
const dir = join30(getHomeDir(), CONFIG_DIR);
|
|
42704
|
+
const filePath = join30(dir, CACHE_FILE);
|
|
42387
42705
|
const script = `
|
|
42388
42706
|
const https = require('https');
|
|
42389
42707
|
const fs = require('fs');
|
|
@@ -42470,15 +42788,15 @@ class TuiCache {
|
|
|
42470
42788
|
}
|
|
42471
42789
|
|
|
42472
42790
|
// src/cli/tui/context.ts
|
|
42473
|
-
import { existsSync as
|
|
42474
|
-
import { join as
|
|
42791
|
+
import { existsSync as existsSync28 } from "node:fs";
|
|
42792
|
+
import { join as join31 } from "node:path";
|
|
42475
42793
|
async function getTuiContext(cwd = process.cwd(), cache2) {
|
|
42476
42794
|
const cachedContext = cache2?.getContext();
|
|
42477
42795
|
if (cachedContext) {
|
|
42478
42796
|
return cachedContext;
|
|
42479
42797
|
}
|
|
42480
|
-
const configPath =
|
|
42481
|
-
const hasWorkspace =
|
|
42798
|
+
const configPath = join31(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
42799
|
+
const hasWorkspace = existsSync28(configPath) && !isUserConfigPath(cwd);
|
|
42482
42800
|
let projectPluginCount = 0;
|
|
42483
42801
|
if (hasWorkspace) {
|
|
42484
42802
|
try {
|
|
@@ -43938,8 +44256,8 @@ function conciseSubcommands(config) {
|
|
|
43938
44256
|
|
|
43939
44257
|
// src/cli/commands/workspace.ts
|
|
43940
44258
|
var import_cmd_ts2 = __toESM(require_cjs(), 1);
|
|
43941
|
-
import { existsSync as
|
|
43942
|
-
import { join as
|
|
44259
|
+
import { existsSync as existsSync24 } from "node:fs";
|
|
44260
|
+
import { join as join25, resolve as resolve14 } from "node:path";
|
|
43943
44261
|
|
|
43944
44262
|
// src/core/prune.ts
|
|
43945
44263
|
init_js_yaml();
|
|
@@ -44406,8 +44724,8 @@ var syncCmd = import_cmd_ts2.command({
|
|
|
44406
44724
|
`);
|
|
44407
44725
|
}
|
|
44408
44726
|
const userConfigExists = !!await getUserWorkspaceConfig();
|
|
44409
|
-
const projectConfigPath =
|
|
44410
|
-
const projectConfigExists =
|
|
44727
|
+
const projectConfigPath = join25(process.cwd(), ".allagents", "workspace.yaml");
|
|
44728
|
+
const projectConfigExists = existsSync24(projectConfigPath);
|
|
44411
44729
|
if (!userConfigExists && !projectConfigExists) {
|
|
44412
44730
|
await ensureUserWorkspace();
|
|
44413
44731
|
if (isJsonMode()) {
|
|
@@ -45138,9 +45456,9 @@ init_plugin_path();
|
|
|
45138
45456
|
init_skill();
|
|
45139
45457
|
init_format_sync();
|
|
45140
45458
|
var import_cmd_ts3 = __toESM(require_cjs(), 1);
|
|
45141
|
-
import { existsSync as
|
|
45459
|
+
import { existsSync as existsSync25 } from "node:fs";
|
|
45142
45460
|
import { readFile as readFile14 } from "node:fs/promises";
|
|
45143
|
-
import { join as
|
|
45461
|
+
import { join as join26 } from "node:path";
|
|
45144
45462
|
|
|
45145
45463
|
// src/cli/metadata/plugin-skills.ts
|
|
45146
45464
|
var skillsListMeta = {
|
|
@@ -45331,7 +45649,7 @@ var skillsAddMeta = {
|
|
|
45331
45649
|
// src/cli/commands/plugin-skills.ts
|
|
45332
45650
|
init_skill_removal();
|
|
45333
45651
|
function hasProjectConfig(dir) {
|
|
45334
|
-
return
|
|
45652
|
+
return existsSync25(join26(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
|
|
45335
45653
|
}
|
|
45336
45654
|
function resolveScope(cwd) {
|
|
45337
45655
|
if (isUserConfigPath(cwd))
|
|
@@ -45365,7 +45683,7 @@ function resolveFetchedSourcePath(source, cachePath) {
|
|
|
45365
45683
|
if (!isGitHubUrl(source))
|
|
45366
45684
|
return cachePath;
|
|
45367
45685
|
const parsed = parseGitHubUrl(source);
|
|
45368
|
-
return parsed?.subpath ?
|
|
45686
|
+
return parsed?.subpath ? join26(cachePath, parsed.subpath) : cachePath;
|
|
45369
45687
|
}
|
|
45370
45688
|
function extractInlineRef(spec) {
|
|
45371
45689
|
const slashIdx = spec.indexOf("/");
|
|
@@ -45401,7 +45719,7 @@ async function resolveSkillNameFromRepo(url, parsed, fallbackName, fetchFn = fet
|
|
|
45401
45719
|
if (!fetchResult.success)
|
|
45402
45720
|
return fallbackName;
|
|
45403
45721
|
try {
|
|
45404
|
-
const skillMd = await readFile14(
|
|
45722
|
+
const skillMd = await readFile14(join26(fetchResult.cachePath, "SKILL.md"), "utf-8");
|
|
45405
45723
|
const metadata = parseSkillMetadata(skillMd);
|
|
45406
45724
|
return metadata?.name ?? fallbackName;
|
|
45407
45725
|
} catch {
|
|
@@ -45917,7 +46235,7 @@ async function discoverSkillsWithMetadata(pluginPath, pluginName) {
|
|
|
45917
46235
|
const entries = await discoverSkillEntries(pluginPath);
|
|
45918
46236
|
const results = [];
|
|
45919
46237
|
for (const entry of entries) {
|
|
45920
|
-
const skillMdPath =
|
|
46238
|
+
const skillMdPath = join26(entry.skillPath, "SKILL.md");
|
|
45921
46239
|
let description = "";
|
|
45922
46240
|
try {
|
|
45923
46241
|
const content = await readFile14(skillMdPath, "utf-8");
|
|
@@ -45952,7 +46270,7 @@ async function discoverSkillsFromSource(from) {
|
|
|
45952
46270
|
if (typeof plugin.source === "object")
|
|
45953
46271
|
continue;
|
|
45954
46272
|
const resolved = resolvePluginSourcePath(plugin.source, sourcePath);
|
|
45955
|
-
if (!
|
|
46273
|
+
if (!existsSync25(resolved))
|
|
45956
46274
|
continue;
|
|
45957
46275
|
const skills2 = await discoverSkillsWithMetadata(resolved, plugin.name);
|
|
45958
46276
|
all.push(...skills2);
|
|
@@ -47034,8 +47352,8 @@ init_workspace_config();
|
|
|
47034
47352
|
init_constants();
|
|
47035
47353
|
init_js_yaml();
|
|
47036
47354
|
import { readFile as readFile15 } from "node:fs/promises";
|
|
47037
|
-
import { existsSync as
|
|
47038
|
-
import { join as
|
|
47355
|
+
import { existsSync as existsSync26 } from "node:fs";
|
|
47356
|
+
import { join as join27 } from "node:path";
|
|
47039
47357
|
async function runSyncAndPrint(options2) {
|
|
47040
47358
|
if (!isJsonMode()) {
|
|
47041
47359
|
console.log(`
|
|
@@ -47280,7 +47598,7 @@ var marketplaceAddCmd = import_cmd_ts4.command({
|
|
|
47280
47598
|
process.exit(1);
|
|
47281
47599
|
}
|
|
47282
47600
|
if (effectiveScope === "project") {
|
|
47283
|
-
if (!
|
|
47601
|
+
if (!existsSync26(join27(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE))) {
|
|
47284
47602
|
const msg = 'No workspace found in current directory. Run "allagents workspace init" first.';
|
|
47285
47603
|
if (isJsonMode()) {
|
|
47286
47604
|
jsonOutput({ success: false, command: "plugin marketplace add", error: msg });
|
|
@@ -47587,7 +47905,7 @@ var pluginListCmd = import_cmd_ts4.command({
|
|
|
47587
47905
|
};
|
|
47588
47906
|
const pluginClients = new Map;
|
|
47589
47907
|
async function loadConfigClients(configPath, scope) {
|
|
47590
|
-
if (!
|
|
47908
|
+
if (!existsSync26(configPath))
|
|
47591
47909
|
return;
|
|
47592
47910
|
try {
|
|
47593
47911
|
const content = await readFile15(configPath, "utf-8");
|
|
@@ -47602,8 +47920,8 @@ var pluginListCmd = import_cmd_ts4.command({
|
|
|
47602
47920
|
}
|
|
47603
47921
|
} catch {}
|
|
47604
47922
|
}
|
|
47605
|
-
const userConfigPath =
|
|
47606
|
-
const projectConfigPath =
|
|
47923
|
+
const userConfigPath = join27(getAllagentsDir(), WORKSPACE_CONFIG_FILE);
|
|
47924
|
+
const projectConfigPath = join27(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
47607
47925
|
const cwdIsHome = isUserConfigPath(process.cwd());
|
|
47608
47926
|
await loadConfigClients(userConfigPath, "user");
|
|
47609
47927
|
if (!cwdIsHome) {
|
|
@@ -47766,7 +48084,7 @@ var pluginInstallCmd = import_cmd_ts4.command({
|
|
|
47766
48084
|
const isUser = scope === "user" || !scope && isUserConfigPath(process.cwd());
|
|
47767
48085
|
if (isUser) {
|
|
47768
48086
|
const userConfigPath = getUserWorkspaceConfigPath();
|
|
47769
|
-
if (!
|
|
48087
|
+
if (!existsSync26(userConfigPath)) {
|
|
47770
48088
|
const { promptForClients: promptForClients2 } = await Promise.resolve().then(() => (init_prompt_clients(), exports_prompt_clients));
|
|
47771
48089
|
const clients = await promptForClients2();
|
|
47772
48090
|
if (clients === null) {
|
|
@@ -47778,8 +48096,8 @@ var pluginInstallCmd = import_cmd_ts4.command({
|
|
|
47778
48096
|
await ensureUserWorkspace(clients);
|
|
47779
48097
|
}
|
|
47780
48098
|
} else {
|
|
47781
|
-
const configPath =
|
|
47782
|
-
if (!
|
|
48099
|
+
const configPath = join27(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
48100
|
+
if (!existsSync26(configPath)) {
|
|
47783
48101
|
const { promptForClients: promptForClients2 } = await Promise.resolve().then(() => (init_prompt_clients(), exports_prompt_clients));
|
|
47784
48102
|
const clients = await promptForClients2();
|
|
47785
48103
|
if (clients === null) {
|
|
@@ -48056,13 +48374,13 @@ var pluginUpdateCmd = import_cmd_ts4.command({
|
|
|
48056
48374
|
}
|
|
48057
48375
|
}
|
|
48058
48376
|
if (updateProject && !isUserConfigPath(process.cwd())) {
|
|
48059
|
-
const { existsSync:
|
|
48377
|
+
const { existsSync: existsSync27 } = await import("node:fs");
|
|
48060
48378
|
const { readFile: readFile16 } = await import("node:fs/promises");
|
|
48061
|
-
const { join:
|
|
48379
|
+
const { join: join28 } = await import("node:path");
|
|
48062
48380
|
const { load: load2 } = await Promise.resolve().then(() => (init_js_yaml(), exports_js_yaml));
|
|
48063
48381
|
const { CONFIG_DIR: CONFIG_DIR2, WORKSPACE_CONFIG_FILE: WORKSPACE_CONFIG_FILE2 } = await Promise.resolve().then(() => (init_constants(), exports_constants));
|
|
48064
|
-
const configPath =
|
|
48065
|
-
if (
|
|
48382
|
+
const configPath = join28(process.cwd(), CONFIG_DIR2, WORKSPACE_CONFIG_FILE2);
|
|
48383
|
+
if (existsSync27(configPath)) {
|
|
48066
48384
|
const content = await readFile16(configPath, "utf-8");
|
|
48067
48385
|
const config = load2(content);
|
|
48068
48386
|
for (const entry of config.plugins ?? []) {
|
|
@@ -48228,9 +48546,9 @@ init_js_yaml();
|
|
|
48228
48546
|
init_constants();
|
|
48229
48547
|
init_workspace_config();
|
|
48230
48548
|
init_workspace_modify();
|
|
48231
|
-
import { existsSync as
|
|
48549
|
+
import { existsSync as existsSync27 } from "node:fs";
|
|
48232
48550
|
import { readFile as readFile16, writeFile as writeFile10 } from "node:fs/promises";
|
|
48233
|
-
import { join as
|
|
48551
|
+
import { join as join28 } from "node:path";
|
|
48234
48552
|
var PROJECT_MCP_CLIENTS2 = new Set([
|
|
48235
48553
|
"claude",
|
|
48236
48554
|
"codex",
|
|
@@ -48251,7 +48569,7 @@ function removeServerScopedProxyIntent(workspaceConfig, name) {
|
|
|
48251
48569
|
}
|
|
48252
48570
|
}
|
|
48253
48571
|
function getConfigPath(workspacePath) {
|
|
48254
|
-
return
|
|
48572
|
+
return join28(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
48255
48573
|
}
|
|
48256
48574
|
async function readConfig(configPath) {
|
|
48257
48575
|
const content = await readFile16(configPath, "utf-8");
|
|
@@ -48352,7 +48670,7 @@ async function clearWorkspaceMcpServerProxy(name, workspacePath = process.cwd())
|
|
|
48352
48670
|
}
|
|
48353
48671
|
async function removeWorkspaceMcpServer(name, workspacePath = process.cwd()) {
|
|
48354
48672
|
const configPath = getConfigPath(workspacePath);
|
|
48355
|
-
if (!
|
|
48673
|
+
if (!existsSync27(configPath)) {
|
|
48356
48674
|
return {
|
|
48357
48675
|
success: false,
|
|
48358
48676
|
error: `${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}`
|
|
@@ -48382,14 +48700,14 @@ async function removeWorkspaceMcpServer(name, workspacePath = process.cwd()) {
|
|
|
48382
48700
|
}
|
|
48383
48701
|
async function getWorkspaceMcpServer(name, workspacePath = process.cwd()) {
|
|
48384
48702
|
const configPath = getConfigPath(workspacePath);
|
|
48385
|
-
if (!
|
|
48703
|
+
if (!existsSync27(configPath))
|
|
48386
48704
|
return null;
|
|
48387
48705
|
const workspaceConfig = await readConfig(configPath);
|
|
48388
48706
|
return workspaceConfig.mcpServers?.[name] ?? null;
|
|
48389
48707
|
}
|
|
48390
48708
|
async function listWorkspaceMcpServers(workspacePath = process.cwd()) {
|
|
48391
48709
|
const configPath = getConfigPath(workspacePath);
|
|
48392
|
-
if (!
|
|
48710
|
+
if (!existsSync27(configPath))
|
|
48393
48711
|
return {};
|
|
48394
48712
|
const workspaceConfig = await readConfig(configPath);
|
|
48395
48713
|
return workspaceConfig.mcpServers ?? {};
|
|
@@ -48456,7 +48774,7 @@ import {
|
|
|
48456
48774
|
import { mkdir as mkdir10, readFile as readFile17, rm as rm5, writeFile as writeFile11 } from "node:fs/promises";
|
|
48457
48775
|
import { constants as fsConstants } from "node:fs";
|
|
48458
48776
|
import { access } from "node:fs/promises";
|
|
48459
|
-
import { join as
|
|
48777
|
+
import { join as join29, dirname as dirname14 } from "node:path";
|
|
48460
48778
|
import { spawn as spawn3 } from "node:child_process";
|
|
48461
48779
|
|
|
48462
48780
|
// node_modules/zod/v4/core/core.js
|
|
@@ -56633,7 +56951,7 @@ function hashServerUrl(serverUrl) {
|
|
|
56633
56951
|
return createHash3("sha256").update(serverUrl).digest("hex").slice(0, 16);
|
|
56634
56952
|
}
|
|
56635
56953
|
function getCacheDir(serverUrl) {
|
|
56636
|
-
return
|
|
56954
|
+
return join29(getHomeDir(), ".allagents", "oauth-proxy", hashServerUrl(serverUrl));
|
|
56637
56955
|
}
|
|
56638
56956
|
function getRequestInit(headers) {
|
|
56639
56957
|
if (Object.keys(headers).length === 0) {
|
|
@@ -56656,7 +56974,7 @@ async function readJsonFile(path) {
|
|
|
56656
56974
|
return JSON.parse(await readFile17(path, "utf-8"));
|
|
56657
56975
|
}
|
|
56658
56976
|
async function writePrivateFile(path, content) {
|
|
56659
|
-
await mkdir10(
|
|
56977
|
+
await mkdir10(dirname14(path), { recursive: true });
|
|
56660
56978
|
await writeFile11(path, content, { encoding: "utf-8", mode: 384 });
|
|
56661
56979
|
}
|
|
56662
56980
|
function parseLoopbackPort(clientInfo) {
|
|
@@ -56747,10 +57065,10 @@ class FileOAuthClientProvider {
|
|
|
56747
57065
|
constructor(port, serverUrl) {
|
|
56748
57066
|
this.port = port;
|
|
56749
57067
|
const cacheDir = getCacheDir(serverUrl);
|
|
56750
|
-
this.clientInfoPath =
|
|
56751
|
-
this.tokensPath =
|
|
56752
|
-
this.verifierPath =
|
|
56753
|
-
this.discoveryPath =
|
|
57068
|
+
this.clientInfoPath = join29(cacheDir, "client-info.json");
|
|
57069
|
+
this.tokensPath = join29(cacheDir, "tokens.json");
|
|
57070
|
+
this.verifierPath = join29(cacheDir, "code-verifier.txt");
|
|
57071
|
+
this.discoveryPath = join29(cacheDir, "discovery.json");
|
|
56754
57072
|
this.redirectUriValue = `http://127.0.0.1:${port}/callback`;
|
|
56755
57073
|
}
|
|
56756
57074
|
get redirectUrl() {
|
|
@@ -56884,7 +57202,7 @@ class FileOAuthClientProvider {
|
|
|
56884
57202
|
}
|
|
56885
57203
|
async function buildOAuthProvider(serverUrl) {
|
|
56886
57204
|
const cacheDir = getCacheDir(serverUrl);
|
|
56887
|
-
const cachedClientInfo = await readJsonFile(
|
|
57205
|
+
const cachedClientInfo = await readJsonFile(join29(cacheDir, "client-info.json"));
|
|
56888
57206
|
let port = parseLoopbackPort(cachedClientInfo);
|
|
56889
57207
|
if (!port) {
|
|
56890
57208
|
port = await findFreePort();
|
|
@@ -58379,7 +58697,7 @@ var addPipeMethods = (spawned) => {
|
|
|
58379
58697
|
};
|
|
58380
58698
|
|
|
58381
58699
|
// node_modules/execa/lib/stream.js
|
|
58382
|
-
import { createReadStream, readFileSync as
|
|
58700
|
+
import { createReadStream, readFileSync as readFileSync7 } from "node:fs";
|
|
58383
58701
|
import { setTimeout as setTimeout2 } from "node:timers/promises";
|
|
58384
58702
|
|
|
58385
58703
|
// node_modules/get-stream/source/contents.js
|
|
@@ -58575,7 +58893,7 @@ var getInputSync = ({ input, inputFile }) => {
|
|
|
58575
58893
|
return input;
|
|
58576
58894
|
}
|
|
58577
58895
|
validateInputOptions(input);
|
|
58578
|
-
return
|
|
58896
|
+
return readFileSync7(inputFile);
|
|
58579
58897
|
};
|
|
58580
58898
|
var handleInputSync = (options2) => {
|
|
58581
58899
|
const input = getInputSync(options2);
|
package/package.json
CHANGED