mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 06:12:26 +00:00
make /init a default slash command on server side (#3677)
This commit is contained in:
@@ -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
|
||||
})
|
||||
|
||||
|
||||
10
packages/opencode/src/command/template/initialize.txt
Normal file
10
packages/opencode/src/command/template/initialize.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
Please analyze this codebase and create an AGENTS.md file containing:
|
||||
1. Build/lint/test commands - especially for running a single test
|
||||
2. Code style guidelines including imports, formatting, types, naming conventions, error handling, etc.
|
||||
|
||||
The file you create will be given to agentic coding agents (such as yourself) that operate in this repository. Make it about 20 lines long.
|
||||
If there are Cursor rules (in .cursor/rules/ or .cursorrules) or Copilot rules (in .github/copilot-instructions.md), make sure to include them.
|
||||
|
||||
If there's already an AGENTS.md, improve it if it's located in ${path}
|
||||
|
||||
$ARGUMENTS
|
||||
Reference in New Issue
Block a user