codewhale 0.9.5 → 0.9.7

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "codewhale",
3
- "version": "0.9.5",
4
- "codewhaleBinaryVersion": "0.9.5",
3
+ "version": "0.9.7",
4
+ "codewhaleBinaryVersion": "0.9.7",
5
5
  "description": "Terminal coding agent for supported hosted and local models. One runtime on your machine. Rust, MIT.",
6
6
  "author": "Hmbown",
7
7
  "license": "MIT",
@@ -143,7 +143,7 @@ function releaseBaseUrl(version, repo = "Hmbown/CodeWhale") {
143
143
  // mirror that already builds and publishes binary release assets.
144
144
  if (usesCnbMirror()) {
145
145
  assertCnbMirrorSupportedPlatform();
146
- return `https://cnb.cool/codewhale.net/codewhale/-/releases/v${version}/`;
146
+ return `https://cnb.cool/codewhale.net/codewhale/-/releases/download/v${version}/`;
147
147
  }
148
148
  return `https://github.com/${repo}/releases/download/v${version}/`;
149
149
  }
@@ -208,22 +208,41 @@ async function resolveTagCommitSha(repo, tag) {
208
208
  return tagObject.object.sha;
209
209
  }
210
210
 
211
- async function findReleaseWorkflowRun(repo, tag, tagSha) {
212
- const runs = await githubApi(repo, "/actions/workflows/release.yml/runs?per_page=100");
213
- const matches = (runs.workflow_runs || [])
211
+ async function findReleaseWorkflowRun(repo, tag, tagSha, api = githubApi) {
212
+ const runs = await api(repo, "/actions/workflows/release.yml/runs?per_page=100");
213
+ const candidates = (runs.workflow_runs || [])
214
214
  .filter((run) => run.head_sha === tagSha)
215
- .filter((run) => run.conclusion === "success")
216
215
  .filter((run) => run.event === "push" || run.event === "workflow_dispatch")
217
216
  .sort((a, b) => String(b.updated_at).localeCompare(String(a.updated_at)));
218
- const tagBranchMatch = matches.find((run) => run.head_branch === tag);
219
- const match = tagBranchMatch || matches[0];
220
- if (!match) {
217
+
218
+ const orderedCandidates = [
219
+ ...candidates.filter((run) => run.head_branch === tag),
220
+ ...candidates.filter((run) => run.head_branch !== tag),
221
+ ];
222
+ for (const candidate of orderedCandidates) {
223
+ const runId = candidate.database_id || candidate.id;
224
+ if (!runId) {
225
+ continue;
226
+ }
227
+ const jobs = await api(repo, `/actions/runs/${runId}/jobs?per_page=100`);
228
+ const releaseJob = (jobs.jobs || []).find(
229
+ (job) => job.name === "release" && job.conclusion === "success",
230
+ );
231
+ if (releaseJob) {
232
+ return candidate;
233
+ }
234
+ }
235
+
236
+ if (orderedCandidates.length === 0) {
221
237
  throw new Error(
222
- `No successful release.yml workflow run found for ${tag} at ${tagSha}. ` +
238
+ `No release.yml workflow run found for ${tag} at ${tagSha}. ` +
223
239
  "Rerun the Release workflow before publishing npm, or increase the verifier's last-100-runs search window.",
224
240
  );
225
241
  }
226
- return match;
242
+ throw new Error(
243
+ `No successful asset-publishing job found in release.yml workflow runs for ${tag} at ${tagSha}. ` +
244
+ "Repair the Release workflow before publishing npm.",
245
+ );
227
246
  }
228
247
 
229
248
  function parseGitHubTime(value, label) {
@@ -347,6 +366,7 @@ module.exports = {
347
366
  assertChecksumManifestIncludes,
348
367
  assertPackageVersionMatchesBinaryVersion,
349
368
  assertReleaseAssetsFresh,
369
+ findReleaseWorkflowRun,
350
370
  hasReleaseBaseOverride,
351
371
  parseChecksumManifest,
352
372
  };
@@ -172,15 +172,15 @@ test("CNB mirror URLs use the repository that publishes release assets", () => {
172
172
  ]);
173
173
  assert.equal(
174
174
  releaseBaseUrl("0.8.68"),
175
- "https://cnb.cool/codewhale.net/codewhale/-/releases/v0.8.68/",
175
+ "https://cnb.cool/codewhale.net/codewhale/-/releases/download/v0.8.68/",
176
176
  );
177
177
  assert.equal(
178
178
  releaseAssetUrl("codewhale-linux-x64", "0.8.68"),
179
- "https://cnb.cool/codewhale.net/codewhale/-/releases/v0.8.68/codewhale-linux-x64",
179
+ "https://cnb.cool/codewhale.net/codewhale/-/releases/download/v0.8.68/codewhale-linux-x64",
180
180
  );
181
181
  assert.equal(
182
182
  checksumManifestUrl("0.8.68"),
183
- "https://cnb.cool/codewhale.net/codewhale/-/releases/v0.8.68/codewhale-artifacts-sha256.txt",
183
+ "https://cnb.cool/codewhale.net/codewhale/-/releases/download/v0.8.68/codewhale-artifacts-sha256.txt",
184
184
  );
185
185
  } finally {
186
186
  for (const key of keys) {
@@ -19,6 +19,7 @@ const {
19
19
  assertChecksumManifestIncludes,
20
20
  assertPackageVersionMatchesBinaryVersion,
21
21
  assertReleaseAssetsFresh,
22
+ findReleaseWorkflowRun,
22
23
  parseChecksumManifest,
23
24
  } = require("../scripts/verify-release-assets");
24
25
 
@@ -119,6 +120,56 @@ test("assertReleaseAssetsFresh accepts assets updated by the release workflow ru
119
120
  );
120
121
  });
121
122
 
123
+ test("findReleaseWorkflowRun accepts a successful release job when a downstream job failed", async () => {
124
+ const run = {
125
+ id: 123,
126
+ head_sha: "abc123",
127
+ head_branch: "v0.9.6",
128
+ event: "push",
129
+ conclusion: "failure",
130
+ updated_at: "2026-08-12T08:48:00Z",
131
+ };
132
+ const api = async (_repo, endpoint) => {
133
+ if (endpoint.includes("/workflows/release.yml/runs")) {
134
+ return { workflow_runs: [run] };
135
+ }
136
+ assert.equal(endpoint, "/actions/runs/123/jobs?per_page=100");
137
+ return {
138
+ jobs: [
139
+ { name: "release", conclusion: "success" },
140
+ { name: "npm", conclusion: "failure" },
141
+ ],
142
+ };
143
+ };
144
+
145
+ assert.equal(await findReleaseWorkflowRun("owner/repo", "v0.9.6", "abc123", api), run);
146
+ });
147
+
148
+ test("findReleaseWorkflowRun rejects runs without a successful release job", async () => {
149
+ const api = async (_repo, endpoint) => {
150
+ if (endpoint.includes("/workflows/release.yml/runs")) {
151
+ return {
152
+ workflow_runs: [
153
+ {
154
+ id: 123,
155
+ head_sha: "abc123",
156
+ head_branch: "v0.9.6",
157
+ event: "push",
158
+ conclusion: "failure",
159
+ updated_at: "2026-08-12T08:48:00Z",
160
+ },
161
+ ],
162
+ };
163
+ }
164
+ return { jobs: [{ name: "release", conclusion: "failure" }] };
165
+ };
166
+
167
+ await assert.rejects(
168
+ findReleaseWorkflowRun("owner/repo", "v0.9.6", "abc123", api),
169
+ /No successful asset-publishing job found/,
170
+ );
171
+ });
172
+
122
173
  test("assertPackageVersionMatchesBinaryVersion allows packaging-only releases only with an explicit override", () => {
123
174
  assert.doesNotThrow(() => assertPackageVersionMatchesBinaryVersion(pkg.version));
124
175
  assert.throws(
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const { runCodeWhale } = require("../scripts/run");
4
-
5
- process.stderr.write("codewhale-tui: deprecated alias to `codewhale` (single binary since v0.9.5). Use `codewhale` instead.\n");
6
- runCodeWhale().catch((error) => {
7
- console.error("Failed to start codewhale:", error.message);
8
- process.exit(1);
9
- });