make /init a default slash command on server side (#3677)

This commit is contained in:
Aiden Cline
2025-11-01 01:14:09 -05:00
committed by GitHub
parent c72f8b17c6
commit 041353f4ff
6 changed files with 92 additions and 49 deletions

View File

@@ -1,8 +1,27 @@
import z from "zod"
import { Config } from "../config/config"
import { Instance } from "../project/instance"
import PROMPT_INITIALIZE from "./template/initialize.txt"
import { Bus } from "../bus"
import { Identifier } from "../id/id"
export namespace Command {
export const Default = {
INIT: "init",
} as const
export const Event = {
Executed: Bus.event(
"command.executed",
z.object({
name: z.string(),
sessionID: Identifier.schema("session"),
arguments: z.string(),
messageID: Identifier.schema("message"),
}),
),
}
export const Info = z
.object({
name: z.string(),
@@ -33,6 +52,14 @@ export namespace Command {
}
}
if (result[Default.INIT] === undefined) {
result[Default.INIT] = {
name: Default.INIT,
description: "create/update AGENTS.md",
template: PROMPT_INITIALIZE.replace("${path}", Instance.worktree),
}
}
return result
})