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