summaryrefslogtreecommitdiffhomepage
path: root/script
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2026-01-30 00:39:23 -0500
committerDax Raad <[email protected]>2026-01-30 00:39:23 -0500
commit9e0747c9b4ec41e7ba5dbe6891770cfa600f768d (patch)
treee26fc54c11a69ae60af3c9371fc47ff6310e8c36 /script
parent66ec378680e420581e2b14a6b6558c61f606dbd6 (diff)
downloadopencode-9e0747c9b4ec41e7ba5dbe6891770cfa600f768d.tar.gz
opencode-9e0747c9b4ec41e7ba5dbe6891770cfa600f768d.zip
ci
Diffstat (limited to 'script')
-rw-r--r--script/changelog-debug.ts85
-rwxr-xr-xscript/publish.ts5
2 files changed, 88 insertions, 2 deletions
diff --git a/script/changelog-debug.ts b/script/changelog-debug.ts
new file mode 100644
index 000000000..1144d3b0c
--- /dev/null
+++ b/script/changelog-debug.ts
@@ -0,0 +1,85 @@
+#!/usr/bin/env bun
+
+import { $ } from "bun"
+import { parseArgs } from "util"
+import { getLatestRelease } from "./changelog"
+
+const paths = [
+ "packages/opencode",
+ "packages/sdk",
+ "packages/plugin",
+ "packages/desktop",
+ "packages/app",
+ "sdks/vscode",
+ "packages/extensions",
+ "github",
+]
+
+const clean = (text: string) => text.split("\n").filter(Boolean)
+
+const ref = (value: string, head = false) => {
+ if (head && value === "HEAD") return value
+ if (value.startsWith("v")) return value
+ return `v${value}`
+}
+
+const { values } = parseArgs({
+ args: Bun.argv.slice(2),
+ options: {
+ from: { type: "string", short: "f" },
+ to: { type: "string", short: "t", default: "HEAD" },
+ base: { type: "string", short: "b", default: "origin/dev" },
+ help: { type: "boolean", short: "h", default: false },
+ },
+})
+
+if (values.help) {
+ console.log(`
+Usage: bun script/changelog-debug.ts [options]
+
+Options:
+ -f, --from <version> Starting version (default: latest GitHub release)
+ -t, --to <ref> Ending ref (default: HEAD)
+ -b, --base <ref> Compare base for ahead/behind (default: origin/dev)
+ -h, --help Show this help message
+
+Examples:
+ bun script/changelog-debug.ts
+ bun script/changelog-debug.ts -f 1.0.200 -t dev
+ bun script/changelog-debug.ts -f 1.0.200 -t HEAD -b origin/dev
+`)
+ process.exit(0)
+}
+
+const to = values.to!
+const from = values.from ?? (await getLatestRelease())
+const fromRef = ref(from)
+const toRef = ref(to, true)
+
+console.log(`Debugging changelog range: ${fromRef} -> ${toRef}\n`)
+
+const [ahead, behind] = await $`git rev-list --left-right --count ${values.base}...HEAD`
+ .text()
+ .then((text) => text.trim().split("\t"))
+
+console.log(`Ahead/behind ${values.base}: ahead=${ahead ?? "0"} behind=${behind ?? "0"}`)
+
+const gh = await $`gh api "/repos/anomalyco/opencode/compare/${fromRef}...${toRef}" --jq '.commits[].sha'`
+ .text()
+ .then(clean)
+
+const localAll = await $`git log ${fromRef}..${toRef} --oneline --format="%H"`.text().then(clean)
+const localFiltered = await $`git log ${fromRef}..${toRef} --oneline --format="%H" -- ${paths}`.text().then(clean)
+
+const ghSet = new Set(gh)
+const missing = localFiltered.filter((hash) => !ghSet.has(hash))
+
+console.log(`GitHub compare commits: ${gh.length}`)
+console.log(`Local commits (all): ${localAll.length}`)
+console.log(`Local commits (filtered paths): ${localFiltered.length}`)
+console.log(`Filtered commits missing from GitHub compare: ${missing.length}`)
+
+if (missing.length > 0) {
+ console.log("\nMissing hashes (first 10):")
+ console.log(missing.slice(0, 10).join("\n"))
+}
diff --git a/script/publish.ts b/script/publish.ts
index 23a6e5c9d..5fa84825b 100755
--- a/script/publish.ts
+++ b/script/publish.ts
@@ -58,8 +58,6 @@ await $`bun install`
await import(`../packages/sdk/js/script/build.ts`)
if (Script.release) {
- const previous = await getLatestRelease()
- const notes = await buildNotes(previous, "HEAD")
// notes.unshift(highlightsTemplate)
await $`git commit -am "release: v${Script.version}"`
await $`git tag v${Script.version}`
@@ -67,6 +65,9 @@ if (Script.release) {
await $`git cherry-pick HEAD..origin/dev`.nothrow()
await $`git push origin HEAD --tags --no-verify --force-with-lease`
await new Promise((resolve) => setTimeout(resolve, 5_000))
+ const previous = await getLatestRelease()
+ console.log("previous", previous)
+ const notes = await buildNotes(previous, "dev")
await $`gh release edit v${Script.version} --draft=false --title "v${Script.version}" --notes ${notes.join("\n") || "No notable changes"}`
}