Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T00:29:39.946Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

draft-release-notes

121 lines · 3.5 KB · text
1#!/usr/bin/env node --redirect-warnings=/dev/null
2
3const { execFileSync } = require("child_process");
4
5main();
6
7async function main() {
8  let version = process.argv[2];
9  let channel = process.argv[3];
10  let parts = version.split(".");
11
12  if (
13    process.argv.length != 4 ||
14    parts.length != 3 ||
15    parts.find((part) => isNaN(part)) != null ||
16    (channel != "stable" && channel != "preview")
17  ) {
18    console.log("Usage: draft-release-notes <version> {stable|preview}");
19    process.exit(1);
20  }
21
22  // currently we can only draft notes for patch releases.
23  if (parts[2] === 0) {
24    process.exit(0);
25  }
26
27  let priorVersion = [parts[0], parts[1], parts[2] - 1].join(".");
28  let suffix = channel == "preview" ? "-pre" : "";
29  let [tag, priorTag] = [`v${version}${suffix}`, `v${priorVersion}${suffix}`];
30
31  try {
32    execFileSync("rm", ["-rf", "target/shallow_clone"]);
33    execFileSync("git", [
34      "clone",
35      "https://github.com/zed-industries/zed",
36      "target/shallow_clone",
37      "--filter=tree:0",
38      "--no-checkout",
39      "--branch",
40      tag,
41      "--depth",
42      100,
43    ]);
44    execFileSync("git", ["-C", "target/shallow_clone", "rev-parse", "--verify", tag]);
45    try {
46      execFileSync("git", ["-C", "target/shallow_clone", "rev-parse", "--verify", priorTag]);
47    } catch (e) {
48      console.error(`Prior tag ${priorTag} not found`);
49      process.exit(0);
50    }
51  } catch (e) {
52    console.error(e.stderr.toString());
53    process.exit(1);
54  }
55
56  const newCommits = getCommits(priorTag, tag);
57
58  let releaseNotes = [];
59  let missing = [];
60  let skipped = [];
61
62  for (const commit of newCommits) {
63    let link = "https://github.com/zed-industries/zed/pull/" + commit.pr;
64    let notes = commit.releaseNotes;
65    if (commit.pr == "") {
66      link = "https://github.com/zed-industries/zed/commits/" + commit.hash;
67    } else if (!notes.includes("zed-industries/zed/issues")) {
68      notes = notes + " ([#" + commit.pr + "](" + link + "))";
69    }
70
71    if (commit.releaseNotes == "") {
72      missing.push("- MISSING " + commit.firstLine + " " + link);
73    } else if (commit.releaseNotes.startsWith("- N/A")) {
74      skipped.push("- N/A " + commit.firstLine + " " + link);
75    } else {
76      releaseNotes.push(notes);
77    }
78  }
79
80  if (releaseNotes.length === 0) {
81    const compareUrl = `https://github.com/zed-industries/zed/compare/${priorTag}...${tag}#commits_bucket`;
82    console.log(`No public-facing changes in this release. [View the commits](${compareUrl}).\n`);
83  } else {
84    console.log(releaseNotes.join("\n") + "\n");
85  }
86}
87
88function getCommits(oldTag, newTag) {
89  const pullRequestNumbers = execFileSync(
90    "git",
91    ["-C", "target/shallow_clone", "log", `${oldTag}..${newTag}`, "--format=DIVIDER\n%H|||%B"],
92    { encoding: "utf8" },
93  )
94    .replace(/\r\n/g, "\n")
95    .split("DIVIDER\n")
96    .filter((commit) => commit.length > 0)
97    .map((commit) => {
98      let [hash, firstLine] = commit.split("\n")[0].split("|||");
99      let cherryPick = firstLine.match(/\(cherry-pick #([0-9]+)\)/)?.[1] || "";
100      let pr = firstLine.match(/\(#(\d+)\)$/)?.[1] || "";
101      let releaseNotes = (commit.split(/Release notes:.*\n/i)[1] || "")
102        .split("\n\n")[0]
103        .trim()
104        .replace(/\n(?![\n-])/g, " ");
105
106      if (releaseNotes.includes("<public_issue_number_if_exists>")) {
107        releaseNotes = "";
108      }
109
110      return {
111        hash,
112        pr,
113        cherryPick,
114        releaseNotes,
115        firstLine,
116      };
117    });
118
119  return pullRequestNumbers;
120}
121
Served at tenant.openagents/omega Member data and write actions are omitted.