allagents 0.33.1 → 0.33.2

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.
Files changed (2) hide show
  1. package/dist/index.js +33 -34
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26023,13 +26023,18 @@ async function fetchWorkspaceFromGitHub(url) {
26023
26023
  const repoUrl = gitHubUrl(owner, repo);
26024
26024
  let effectiveBranch = branch;
26025
26025
  let effectiveSubpath = subpath;
26026
- if (branch && subpath && !branch.includes("/")) {
26026
+ if (branch && subpath) {
26027
26027
  const resolved = await resolveBranchAndSubpath(repoUrl, `${branch}/${subpath}`);
26028
26028
  if (resolved && resolved.branch !== branch) {
26029
26029
  effectiveBranch = resolved.branch;
26030
26030
  effectiveSubpath = resolved.subpath;
26031
26031
  }
26032
26032
  }
26033
+ if (effectiveSubpath === CONFIG_DIR) {
26034
+ effectiveSubpath = undefined;
26035
+ } else if (effectiveSubpath?.endsWith(`/${CONFIG_DIR}`)) {
26036
+ effectiveSubpath = effectiveSubpath.slice(0, -(CONFIG_DIR.length + 1));
26037
+ }
26033
26038
  let tempDir;
26034
26039
  try {
26035
26040
  tempDir = await cloneToTemp(repoUrl, effectiveBranch);
@@ -26066,11 +26071,12 @@ async function fetchWorkspaceFromGitHub(url) {
26066
26071
  for (const filePath of pathsToTry) {
26067
26072
  const content = readFileFromClone(tempDir, filePath);
26068
26073
  if (content) {
26069
- return {
26070
- success: true,
26071
- content,
26072
- tempDir
26073
- };
26074
+ const result = { success: true, content, tempDir };
26075
+ if (basePath)
26076
+ result.resolvedSubpath = basePath;
26077
+ if (effectiveBranch)
26078
+ result.resolvedBranch = effectiveBranch;
26079
+ return result;
26074
26080
  }
26075
26081
  }
26076
26082
  await cleanupTempDir(tempDir);
@@ -26108,6 +26114,9 @@ async function initWorkspace(targetPath = ".", options = {}) {
26108
26114
  const isProduction = currentFilePath.includes(`${sep2}dist${sep2}`);
26109
26115
  const defaultTemplatePath = isProduction ? join16(currentFileDir, "templates", "default") : join16(currentFileDir, "..", "templates", "default");
26110
26116
  let githubTempDir;
26117
+ let parsedFromUrl;
26118
+ let githubBasePath = "";
26119
+ let githubBranch = "main";
26111
26120
  try {
26112
26121
  await mkdir8(absoluteTarget, { recursive: true });
26113
26122
  await mkdir8(configDir, { recursive: true });
@@ -26124,18 +26133,17 @@ async function initWorkspace(targetPath = ".", options = {}) {
26124
26133
  }
26125
26134
  githubTempDir = fetchResult.tempDir;
26126
26135
  workspaceYamlContent = fetchResult.content;
26136
+ parsedFromUrl = parseGitHubUrl(options.from);
26137
+ githubBasePath = fetchResult.resolvedSubpath || "";
26138
+ githubBranch = fetchResult.resolvedBranch || parsedFromUrl?.branch || "main";
26127
26139
  const parsed2 = load(workspaceYamlContent);
26128
26140
  const workspace = parsed2?.workspace;
26129
26141
  if (workspace?.source) {
26130
26142
  const source = workspace.source;
26131
26143
  if (!isGitHubUrl(source) && !isAbsolute4(source)) {
26132
- const parsedUrl = parseGitHubUrl(options.from);
26133
- if (parsedUrl) {
26134
- const basePath = parsedUrl.subpath || "";
26135
- const baseDir = basePath.replace(/\/?\.allagents\/workspace\.yaml$/, "").replace(/\/?workspace\.yaml$/, "");
26136
- const sourcePath = source === "." ? baseDir : baseDir ? `${baseDir}/${source}` : source;
26137
- const branch = parsedUrl.branch || "main";
26138
- workspace.source = `https://github.com/${parsedUrl.owner}/${parsedUrl.repo}/tree/${branch}/${sourcePath}`;
26144
+ if (parsedFromUrl) {
26145
+ const sourcePath = source === "." ? githubBasePath : githubBasePath ? `${githubBasePath}/${source}` : source;
26146
+ workspace.source = `https://github.com/${parsedFromUrl.owner}/${parsedFromUrl.repo}/tree/${githubBranch}/${sourcePath}`;
26139
26147
  workspaceYamlContent = dump(parsed2, { lineWidth: -1 });
26140
26148
  }
26141
26149
  }
@@ -26206,11 +26214,8 @@ async function initWorkspace(targetPath = ".", options = {}) {
26206
26214
  const targetTemplatePath = join16(configDir, VSCODE_TEMPLATE_FILE2);
26207
26215
  if (!existsSync13(targetTemplatePath)) {
26208
26216
  if (isGitHubUrl(options.from) && githubTempDir) {
26209
- const parsedUrl = parseGitHubUrl(options.from);
26210
- if (parsedUrl) {
26211
- const basePath = parsedUrl.subpath || "";
26212
- const baseDir = basePath.replace(/\/?\.allagents\/workspace\.yaml$/, "").replace(/\/?workspace\.yaml$/, "");
26213
- const templatePath = baseDir ? `${baseDir}/${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}` : `${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}`;
26217
+ if (parsedFromUrl) {
26218
+ const templatePath = githubBasePath ? `${githubBasePath}/${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}` : `${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}`;
26214
26219
  const templateContent = readFileFromClone(githubTempDir, templatePath);
26215
26220
  if (templateContent) {
26216
26221
  await writeFile7(targetTemplatePath, templateContent, "utf-8");
@@ -26229,16 +26234,14 @@ async function initWorkspace(targetPath = ".", options = {}) {
26229
26234
  if (hasRepositories) {
26230
26235
  const copiedAgentFiles = [];
26231
26236
  if (options.from && isGitHubUrl(options.from) && githubTempDir) {
26232
- const parsedUrl = parseGitHubUrl(options.from);
26233
- if (parsedUrl) {
26234
- const basePath = parsedUrl.subpath || "";
26237
+ if (parsedFromUrl) {
26235
26238
  for (const agentFile of AGENT_FILES) {
26236
26239
  const targetFilePath = join16(absoluteTarget, agentFile);
26237
26240
  if (existsSync13(targetFilePath)) {
26238
26241
  copiedAgentFiles.push(agentFile);
26239
26242
  continue;
26240
26243
  }
26241
- const filePath = basePath ? `${basePath}/${agentFile}` : agentFile;
26244
+ const filePath = githubBasePath ? `${githubBasePath}/${agentFile}` : agentFile;
26242
26245
  const content = readFileFromClone(githubTempDir, filePath);
26243
26246
  if (content) {
26244
26247
  await writeFile7(targetFilePath, content, "utf-8");
@@ -29012,7 +29015,7 @@ var package_default;
29012
29015
  var init_package = __esm(() => {
29013
29016
  package_default = {
29014
29017
  name: "allagents",
29015
- version: "0.33.1",
29018
+ version: "0.33.2",
29016
29019
  description: "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
29017
29020
  type: "module",
29018
29021
  bin: {
@@ -29123,8 +29126,8 @@ function buildNotice(currentVersion, latestVersion) {
29123
29126
  return null;
29124
29127
  if (!isNewer(latestVersion, currentVersion))
29125
29128
  return null;
29126
- return ` Update available: ${currentVersion} → ${latestVersion}
29127
- Run \`allagents self update\` to upgrade.`;
29129
+ return source_default.yellow(`Update available: ${currentVersion} → ${latestVersion}
29130
+ Run \`allagents self update\` to upgrade.`);
29128
29131
  }
29129
29132
  function backgroundUpdateCheck() {
29130
29133
  const dir = join23(getHomeDir(), CONFIG_DIR);
@@ -29168,6 +29171,7 @@ async function getUpdateNotice(currentVersion) {
29168
29171
  }
29169
29172
  var CHECK_INTERVAL_MS, CACHE_FILE = "version-check.json", NPM_REGISTRY_URL = "https://registry.npmjs.org/allagents/latest";
29170
29173
  var init_update_check = __esm(() => {
29174
+ init_source();
29171
29175
  init_constants();
29172
29176
  CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
29173
29177
  });
@@ -34668,17 +34672,12 @@ var { args: argsNoJson, json: json2 } = extractJsonFlag(rawArgs);
34668
34672
  var { args: finalArgs, agentHelp } = extractAgentHelpFlag(argsNoJson);
34669
34673
  setJsonMode(json2);
34670
34674
  var isWizard = finalArgs.length === 0 && process.stdout.isTTY && !json2;
34671
- var updateNotice = null;
34672
34675
  if (!agentHelp && !json2 && !isWizard) {
34673
- process.on("exit", () => {
34674
- if (updateNotice)
34675
- process.stderr.write(`
34676
- ${updateNotice}
34676
+ const notice = await getUpdateNotice(package_default.version);
34677
+ if (notice)
34678
+ process.stderr.write(`${notice}
34679
+
34677
34680
  `);
34678
- });
34679
- getUpdateNotice(package_default.version).then((n) => {
34680
- updateNotice = n;
34681
- });
34682
34681
  }
34683
34682
  if (agentHelp) {
34684
34683
  printAgentHelp(finalArgs, package_default.version);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allagents",
3
- "version": "0.33.1",
3
+ "version": "0.33.2",
4
4
  "description": "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
5
5
  "type": "module",
6
6
  "bin": {