Files
oh-my-pi/scripts/ci-release-publish.ts
T
can1357 5ecd041bfe fix: patched bash interceptor, LSP shutdown, and concurrent command tracking
- Fixed bash interceptor to check both raw and cwd-normalized commands, catching commands hidden behind leading `cd ... &&` wrappers.
- Fixed LSP client shutdown to await graceful shutdown with a 5s timeout before killing the process, and parallelized `shutdownAll` via `Promise.allSettled`.
- Fixed concurrent bash command tracking by replacing a single abort controller with a Set, preventing premature cancellation of parallel commands.
- Removed `./hooks` and `./hooks/*` export entries from the coding-agent package exports map.
- Updated pinned Rust nightly toolchain from `nightly-2026-03-27` to `nightly-2026-04-29` in `rust-toolchain.toml` and CI workflow.
- Replaced custom already-published detection in `ci-release-publish.ts` with `bun publish --tolerate-republish` flag.
2026-04-30 05:51:01 +02:00

63 lines
1.6 KiB
TypeScript

#!/usr/bin/env bun
import * as path from "node:path";
import { $ } from "bun";
interface PublishPackage {
dir: string;
}
interface PackageJson {
private?: boolean;
}
const repoRoot = path.join(import.meta.dir, "..");
const isDryRun = process.argv.includes("--dry-run");
const packageDirs: PublishPackage[] = [
{ dir: "packages/utils" },
{ dir: "packages/ai" },
{ dir: "packages/natives" },
{ dir: "packages/tui" },
{ dir: "packages/stats" },
{ dir: "packages/agent" },
{ dir: "packages/coding-agent" },
];
async function readPackageJson(packageDir: string): Promise<PackageJson> {
return (await Bun.file(path.join(repoRoot, packageDir, "package.json")).json()) as PackageJson;
}
async function publishPackage(pkg: PublishPackage): Promise<void> {
const packageJson = await readPackageJson(pkg.dir);
const packageName = path.basename(pkg.dir);
if (packageJson.private) {
console.log(`Skipping ${packageName} (private)`);
return;
}
if (isDryRun) {
console.log(`DRY RUN bun publish --access public --tolerate-republish (${pkg.dir})`);
return;
}
console.log(`Publishing ${packageName}...`);
const result = await $`bun publish --access public --tolerate-republish`.cwd(path.join(repoRoot, pkg.dir)).quiet().nothrow();
const output = `${result.stdout.toString()}${result.stderr.toString()}`.trim();
if (result.exitCode === 0) {
if (output) console.log(output);
return;
}
if (output) console.log(output);
process.exit(result.exitCode ?? 1);
}
async function main(): Promise<void> {
for (const pkg of packageDirs) {
await publishPackage(pkg);
}
}
await main();