allagents 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +45 -16
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -19441,9 +19441,14 @@ function parsePluginSource(source, baseDir = process.cwd()) {
|
|
|
19441
19441
|
normalized: normalizePluginPath(source, baseDir)
|
|
19442
19442
|
};
|
|
19443
19443
|
}
|
|
19444
|
-
function
|
|
19444
|
+
function sanitizeBranchForPath(branch) {
|
|
19445
|
+
return branch.replace(/[/\\:*?"<>|]/g, "_");
|
|
19446
|
+
}
|
|
19447
|
+
function getPluginCachePath(owner, repo, branch) {
|
|
19445
19448
|
const homeDir = process.env.HOME || process.env.USERPROFILE || "~";
|
|
19446
|
-
|
|
19449
|
+
const basePath = `${owner}-${repo}`;
|
|
19450
|
+
const cacheName = branch ? `${basePath}@${sanitizeBranchForPath(branch)}` : basePath;
|
|
19451
|
+
return resolve(homeDir, ".allagents", "plugins", "marketplaces", cacheName);
|
|
19447
19452
|
}
|
|
19448
19453
|
function validatePluginSource(source) {
|
|
19449
19454
|
if (!source || source.trim() === "") {
|
|
@@ -19557,7 +19562,7 @@ import { mkdir, readdir, stat } from "node:fs/promises";
|
|
|
19557
19562
|
import { existsSync } from "node:fs";
|
|
19558
19563
|
import { dirname, join, resolve as resolve2 } from "node:path";
|
|
19559
19564
|
async function fetchPlugin(url, options2 = {}) {
|
|
19560
|
-
const { force = false } = options2;
|
|
19565
|
+
const { force = false, branch } = options2;
|
|
19561
19566
|
const validation = validatePluginSource(url);
|
|
19562
19567
|
if (!validation.valid) {
|
|
19563
19568
|
return {
|
|
@@ -19577,7 +19582,7 @@ async function fetchPlugin(url, options2 = {}) {
|
|
|
19577
19582
|
};
|
|
19578
19583
|
}
|
|
19579
19584
|
const { owner, repo } = parsed;
|
|
19580
|
-
const cachePath = getPluginCachePath(owner, repo);
|
|
19585
|
+
const cachePath = getPluginCachePath(owner, repo, branch);
|
|
19581
19586
|
try {
|
|
19582
19587
|
await execa("gh", ["--version"]);
|
|
19583
19588
|
} catch {
|
|
@@ -19608,7 +19613,11 @@ async function fetchPlugin(url, options2 = {}) {
|
|
|
19608
19613
|
}
|
|
19609
19614
|
const parentDir = dirname(cachePath);
|
|
19610
19615
|
await mkdir(parentDir, { recursive: true });
|
|
19611
|
-
|
|
19616
|
+
if (branch) {
|
|
19617
|
+
await execa("gh", ["repo", "clone", `${owner}/${repo}`, cachePath, "--", "--branch", branch]);
|
|
19618
|
+
} else {
|
|
19619
|
+
await execa("gh", ["repo", "clone", `${owner}/${repo}`, cachePath]);
|
|
19620
|
+
}
|
|
19612
19621
|
return {
|
|
19613
19622
|
success: true,
|
|
19614
19623
|
action: "fetched",
|
|
@@ -20572,7 +20581,9 @@ async function selectivePurgeWorkspace(workspacePath, state, clients) {
|
|
|
20572
20581
|
return [];
|
|
20573
20582
|
}
|
|
20574
20583
|
const result = [];
|
|
20575
|
-
|
|
20584
|
+
const previousClients = Object.keys(state.files);
|
|
20585
|
+
const clientsToProcess = [...new Set([...clients, ...previousClients])];
|
|
20586
|
+
for (const client of clientsToProcess) {
|
|
20576
20587
|
const previousFiles = getPreviouslySyncedFiles(state, client);
|
|
20577
20588
|
const purgedPaths = [];
|
|
20578
20589
|
for (const filePath of previousFiles) {
|
|
@@ -20781,7 +20792,11 @@ async function validatePlugin(pluginSource, workspacePath, force) {
|
|
|
20781
20792
|
};
|
|
20782
20793
|
}
|
|
20783
20794
|
if (isGitHubUrl(pluginSource)) {
|
|
20784
|
-
const
|
|
20795
|
+
const parsed = parseGitHubUrl(pluginSource);
|
|
20796
|
+
const fetchResult = await fetchPlugin(pluginSource, {
|
|
20797
|
+
force,
|
|
20798
|
+
...parsed?.branch && { branch: parsed.branch }
|
|
20799
|
+
});
|
|
20785
20800
|
if (!fetchResult.success) {
|
|
20786
20801
|
return {
|
|
20787
20802
|
plugin: pluginSource,
|
|
@@ -20790,7 +20805,6 @@ async function validatePlugin(pluginSource, workspacePath, force) {
|
|
|
20790
20805
|
...fetchResult.error && { error: fetchResult.error }
|
|
20791
20806
|
};
|
|
20792
20807
|
}
|
|
20793
|
-
const parsed = parseGitHubUrl(pluginSource);
|
|
20794
20808
|
const resolvedPath2 = parsed?.subpath ? join7(fetchResult.cachePath, parsed.subpath) : fetchResult.cachePath;
|
|
20795
20809
|
return {
|
|
20796
20810
|
plugin: pluginSource,
|
|
@@ -20998,7 +21012,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
20998
21012
|
}
|
|
20999
21013
|
}
|
|
21000
21014
|
const hasFailures = pluginResults.some((r) => !r.success) || totalFailed > 0;
|
|
21001
|
-
if (!
|
|
21015
|
+
if (!dryRun) {
|
|
21002
21016
|
const allCopyResults = [
|
|
21003
21017
|
...pluginResults.flatMap((r) => r.copyResults),
|
|
21004
21018
|
...workspaceFileResults
|
|
@@ -21309,13 +21323,28 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
21309
21323
|
}
|
|
21310
21324
|
await writeFile4(configPath, workspaceYamlContent, "utf-8");
|
|
21311
21325
|
const copiedAgentFiles = [];
|
|
21312
|
-
|
|
21313
|
-
|
|
21314
|
-
|
|
21315
|
-
|
|
21316
|
-
const
|
|
21317
|
-
|
|
21318
|
-
|
|
21326
|
+
if (options2.from && isGitHubUrl(options2.from)) {
|
|
21327
|
+
const parsedUrl = parseGitHubUrl(options2.from);
|
|
21328
|
+
if (parsedUrl) {
|
|
21329
|
+
const basePath = parsedUrl.subpath || "";
|
|
21330
|
+
for (const agentFile of AGENT_FILES) {
|
|
21331
|
+
const filePath = basePath ? `${basePath}/${agentFile}` : agentFile;
|
|
21332
|
+
const content = await fetchFileFromGitHub(parsedUrl.owner, parsedUrl.repo, filePath, parsedUrl.branch);
|
|
21333
|
+
if (content) {
|
|
21334
|
+
await writeFile4(join8(absoluteTarget, agentFile), content, "utf-8");
|
|
21335
|
+
copiedAgentFiles.push(agentFile);
|
|
21336
|
+
}
|
|
21337
|
+
}
|
|
21338
|
+
}
|
|
21339
|
+
} else {
|
|
21340
|
+
const effectiveSourceDir = sourceDir ?? defaultTemplatePath;
|
|
21341
|
+
for (const agentFile of AGENT_FILES) {
|
|
21342
|
+
const sourcePath = join8(effectiveSourceDir, agentFile);
|
|
21343
|
+
if (existsSync7(sourcePath)) {
|
|
21344
|
+
const content = await readFile6(sourcePath, "utf-8");
|
|
21345
|
+
await writeFile4(join8(absoluteTarget, agentFile), content, "utf-8");
|
|
21346
|
+
copiedAgentFiles.push(agentFile);
|
|
21347
|
+
}
|
|
21319
21348
|
}
|
|
21320
21349
|
}
|
|
21321
21350
|
if (copiedAgentFiles.length === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "allagents",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"format": "biome format --write src",
|
|
25
25
|
"check": "biome check src",
|
|
26
26
|
"check:fix": "biome check --write src",
|
|
27
|
-
"prepare": "bun run build && (test -d .git && bunx prek install -t pre-push || true)"
|
|
27
|
+
"prepare": "bun run build && (test -d .git && bunx prek install -t pre-push || true)",
|
|
28
|
+
"release": "bun run scripts/release.ts"
|
|
28
29
|
},
|
|
29
30
|
"keywords": [
|
|
30
31
|
"cli",
|