Files
oh-my-pi/packages/coding-agent/src/commands/commit.ts
T
can1357 ebae144ad9 refactor(ai): removed HTTP/2 fetch patching bootstrap
- Deleted the `packages/ai/src/utils/h2-fetch.ts` HTTP/2 retry wrapper and removed its public export from `packages/ai/src/index.ts`.
- Removed the `installH2Fetch` import and invocation from `packages/coding-agent/src/cli.ts`, so the CLI no longer patches `fetch` for HTTP/2 negotiation.
- Updated `packages/coding-agent/CHANGELOG.md` to align the vim-mode removal notes with the code changes.
2026-05-26 13:16:59 +02:00

47 lines
1.8 KiB
TypeScript

/**
* Generate and optionally push a commit with changelog updates.
*/
import { postmortem } from "@oh-my-pi/pi-utils";
import { Command, Flags } from "@oh-my-pi/pi-utils/cli";
import { runCommitCommand } from "../commit";
import type { CommitCommandArgs } from "../commit/types";
import { initTheme } from "../modes/theme/theme";
export default class Commit extends Command {
static description = "Generate a commit message and update changelogs";
static flags = {
push: Flags.boolean({ description: "Push after committing" }),
"dry-run": Flags.boolean({ description: "Preview without committing" }),
"no-changelog": Flags.boolean({ description: "Skip changelog updates" }),
legacy: Flags.boolean({ description: "Use legacy deterministic pipeline" }),
context: Flags.string({ char: "c", description: "Additional context for the model" }),
model: Flags.string({ char: "m", description: "Override model selection" }),
};
async run(): Promise<void> {
const { flags } = await this.parse(Commit);
const cmd: CommitCommandArgs = {
push: flags.push ?? false,
dryRun: flags["dry-run"] ?? false,
noChangelog: flags["no-changelog"] ?? false,
legacy: flags.legacy,
context: flags.context,
model: flags.model,
};
await initTheme();
// The agentic commit flow opens keep-alive sockets to the model provider
// and spins up an AgentSession with background async-job + extension
// machinery. `session.dispose()` releases what it can, but Bun's fetch
// keeps idle connections warm and a few timers (Settings autosave, OAuth
// refresh) stay armed long enough to pin the event loop after the commit
// is already written. Mirror the `runPrintMode` exit pattern from
// `main.ts` so the CLI returns to the shell instead of stranding the user
// on Ctrl+C (issue #1041).
await runCommitCommand(cmd);
await postmortem.quit(0);
}
}