@agentv/core 4.34.0-next.1 → 4.35.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/dist/index.cjs CHANGED
@@ -27609,20 +27609,20 @@ function fromYaml(raw) {
27609
27609
  addedAt: typeof e.added_at === "string" ? e.added_at : "",
27610
27610
  lastOpenedAt: typeof e.last_opened_at === "string" ? e.last_opened_at : ""
27611
27611
  };
27612
- if (e.source && typeof e.source === "object") {
27613
- const s = e.source;
27614
- if (typeof s.url === "string" && typeof s.ref === "string") {
27615
- entry.source = { url: s.url, ref: s.ref };
27616
- }
27612
+ if (typeof e.repo_url === "string" && e.repo_url.trim().length > 0) {
27613
+ entry.repoUrl = e.repo_url.trim();
27614
+ }
27615
+ if (typeof e.ref === "string" && e.ref.trim().length > 0) {
27616
+ entry.ref = e.ref.trim();
27617
27617
  }
27618
27618
  if (e.results && typeof e.results === "object") {
27619
27619
  const r = e.results;
27620
- if (r.mode === "github" && typeof r.repo === "string" && r.repo.trim().length > 0) {
27620
+ if (typeof r.repo_url === "string" && r.repo_url.trim().length > 0) {
27621
+ const sync = r.sync && typeof r.sync === "object" ? r.sync : void 0;
27621
27622
  entry.results = {
27622
- mode: "github",
27623
- repo: r.repo.trim(),
27623
+ repoUrl: r.repo_url.trim(),
27624
27624
  ...typeof r.path === "string" && r.path.trim().length > 0 ? { path: r.path.trim() } : {},
27625
- ...typeof r.auto_push === "boolean" ? { autoPush: r.auto_push } : {},
27625
+ ...sync && typeof sync.auto_push === "boolean" ? { sync: { autoPush: sync.auto_push } } : {},
27626
27626
  ...typeof r.branch_prefix === "string" && r.branch_prefix.trim().length > 0 ? { branchPrefix: r.branch_prefix.trim() } : {}
27627
27627
  };
27628
27628
  }
@@ -27633,19 +27633,19 @@ function toYaml(entry) {
27633
27633
  const yaml = {
27634
27634
  id: entry.id,
27635
27635
  name: entry.name,
27636
+ ...entry.repoUrl !== void 0 && { repo_url: entry.repoUrl },
27636
27637
  path: entry.path,
27638
+ ...entry.ref !== void 0 && { ref: entry.ref },
27637
27639
  added_at: entry.addedAt,
27638
27640
  last_opened_at: entry.lastOpenedAt
27639
27641
  };
27640
- if (entry.source) {
27641
- yaml.source = { url: entry.source.url, ref: entry.source.ref };
27642
- }
27643
27642
  if (entry.results) {
27644
27643
  yaml.results = {
27645
- mode: entry.results.mode,
27646
- repo: entry.results.repo,
27644
+ repo_url: entry.results.repoUrl,
27647
27645
  ...entry.results.path !== void 0 && { path: entry.results.path },
27648
- ...entry.results.autoPush !== void 0 && { auto_push: entry.results.autoPush },
27646
+ ...entry.results.sync?.autoPush !== void 0 && {
27647
+ sync: { auto_push: entry.results.sync.autoPush }
27648
+ },
27649
27649
  ...entry.results.branchPrefix !== void 0 && {
27650
27650
  branch_prefix: entry.results.branchPrefix
27651
27651
  }
@@ -27786,25 +27786,27 @@ init_cjs_shims();
27786
27786
  var childProcess = __toESM(require("child_process"), 1);
27787
27787
  var import_node_fs21 = require("fs");
27788
27788
  async function syncProject(entry) {
27789
- if (!entry.source) {
27790
- throw new Error(`Project '${entry.id}' has no source defined`);
27789
+ if (!entry.repoUrl) {
27790
+ throw new Error(`Project '${entry.id}' has no repo_url defined`);
27791
+ }
27792
+ if (!entry.ref) {
27793
+ throw new Error(`Project '${entry.id}' has no ref defined`);
27791
27794
  }
27792
- const { url, ref } = entry.source;
27793
27795
  const dest = entry.path;
27794
27796
  if ((0, import_node_fs21.existsSync)(`${dest}/.git`)) {
27795
27797
  childProcess.execFileSync("git", ["-C", dest, "pull", "--ff-only"], { stdio: "inherit" });
27796
27798
  } else {
27797
27799
  childProcess.execFileSync(
27798
27800
  "git",
27799
- ["clone", "--depth", "1", "--filter=blob:none", "--branch", ref, url, dest],
27801
+ ["clone", "--depth", "1", "--filter=blob:none", "--branch", entry.ref, entry.repoUrl, dest],
27800
27802
  { stdio: "inherit" }
27801
27803
  );
27802
27804
  }
27803
27805
  }
27804
27806
  async function syncProjects(entries) {
27805
27807
  for (const entry of entries) {
27806
- if (!entry.source) continue;
27807
- console.log(`Syncing project '${entry.id}' from ${entry.source.url}...`);
27808
+ if (!entry.repoUrl) continue;
27809
+ console.log(`Syncing project '${entry.id}' from ${entry.repoUrl}...`);
27808
27810
  await syncProject(entry);
27809
27811
  console.log(`Project '${entry.id}' synced.`);
27810
27812
  }