mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 06:02:42 +00:00
Rename /clear to /new, update hook events to before_new/new
Closes #305 - took direct rename approach instead of alias system Thanks @mitsuhiko for the nudge!
This commit is contained in:
parent
0427445242
commit
454ea1d36a
11 changed files with 56 additions and 35 deletions
|
|
@ -10,7 +10,7 @@ import type { HookAPI } from "@mariozechner/pi-coding-agent/hooks";
|
|||
export default function (pi: HookAPI) {
|
||||
pi.on("session", async (event, ctx) => {
|
||||
// Only handle before_* events (the ones that can be cancelled)
|
||||
if (event.reason === "before_clear") {
|
||||
if (event.reason === "before_new") {
|
||||
if (!ctx.hasUI) return;
|
||||
|
||||
const confirmed = await ctx.ui.confirm(
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import type { HookAPI } from "@mariozechner/pi-coding-agent/hooks";
|
|||
export default function (pi: HookAPI) {
|
||||
pi.on("session", async (event, ctx) => {
|
||||
// Only guard destructive actions
|
||||
if (event.reason !== "before_clear" && event.reason !== "before_switch" && event.reason !== "before_branch") {
|
||||
if (event.reason !== "before_new" && event.reason !== "before_switch" && event.reason !== "before_branch") {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -36,11 +36,7 @@ export default function (pi: HookAPI) {
|
|||
const changedFiles = stdout.trim().split("\n").filter(Boolean).length;
|
||||
|
||||
const action =
|
||||
event.reason === "before_clear"
|
||||
? "clear session"
|
||||
: event.reason === "before_switch"
|
||||
? "switch session"
|
||||
: "branch";
|
||||
event.reason === "before_new" ? "new session" : event.reason === "before_switch" ? "switch session" : "branch";
|
||||
|
||||
const choice = await ctx.ui.select(`You have ${changedFiles} uncommitted file(s). ${action} anyway?`, [
|
||||
"Yes, proceed anyway",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue