Skip to content

Commit d91f9ae

Browse files
snomiaoampagent
andcommitted
fix: address codex review round 2
- Fix bugcop sflow type narrowing: use undefined + non-null assertion to avoid tsc error with sflow's filter - Fix getActivatedShell: use /bin/sh -c wrapper so source and shell syntax work correctly (Bun $ escapes interpolated values as single arguments) - Revert contributor API sort+limit: collection is small and admin-only, sorting by updatedAt misses errorAt-only updates Amp-Thread-ID: https://ampcode.com/threads/T-019da183-14cd-7179-bb7c-9178dc8494d1 Co-authored-by: Amp <amp@ampcode.com>
1 parent 88babd2 commit d91f9ae

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

app/api/router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export const router = t.router({
8787
.query(async () => {
8888
const { GithubContributorAnalyzeTask } =
8989
await import("../tasks/github-contributor-analyze/GithubContributorAnalyzeTask");
90-
return await GithubContributorAnalyzeTask.find({}).sort({ updatedAt: -1 }).limit(500).toArray();
90+
return await GithubContributorAnalyzeTask.find({}).toArray();
9191
}),
9292

9393
githubContributorAnalyze: t.procedure

run/gh-bugcop/gh-bugcop.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,13 +413,13 @@ export default async function runGithubBugcopTask() {
413413
} catch (e) {
414414
if ((e as { status?: number }).status === 404) {
415415
tlog(chalk.yellow(`Issue not found (deleted/transferred?): ${issueUrl}`));
416-
return null;
416+
return undefined;
417417
}
418418
throw e;
419419
}
420420
})
421-
.filter((issue): issue is NonNullable<typeof issue> => issue !== null)
422-
.forEach(processIssue)
421+
.filter((issue) => issue !== undefined)
422+
.forEach((issue) => processIssue(issue!))
423423
.toArray();
424424

425425
tlog(

src/getActivatedShell.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import { getActivateCMD } from "./cli/getActivateCMD";
33

44
if (import.meta.main) {
55
const activate = getActivateCMD();
6-
const p = await $`${activate} && comfy-cli --version`;
6+
// Use .nothrow() + raw shell string to allow `source` on POSIX
7+
const p = await $`/bin/sh -c ${`${activate} && comfy-cli --version`}`;
78
console.log(p.stdout.toString());
89
}
910

1011
export function getActivatedShell() {
1112
const activate = getActivateCMD();
1213
return (strings: TemplateStringsArray, ...values: unknown[]) => {
1314
const cmd = strings.reduce((acc, str, i) => acc + str + (values[i] ?? ""), "");
14-
return $`${activate} && ${cmd}`;
15+
return $`/bin/sh -c ${`${activate} && ${cmd}`}`;
1516
};
1617
}

0 commit comments

Comments
 (0)