mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-23 10:45:33 -04:00
25 lines
916 B
TypeScript
25 lines
916 B
TypeScript
export * as CommandPlugin from "./command"
|
|
|
|
import { define } from "@opencode-ai/plugin/v2/effect/plugin"
|
|
import { Effect } from "effect"
|
|
import { Location } from "../location"
|
|
import PROMPT_INITIALIZE from "./command/initialize.txt"
|
|
import PROMPT_REVIEW from "./command/review.txt"
|
|
|
|
export const Plugin = define({
|
|
id: "opencode.command",
|
|
effect: Effect.fn(function* (ctx) {
|
|
const location = yield* Location.Service
|
|
yield* ctx.command.transform((draft) => {
|
|
draft.update("init", (command) => {
|
|
command.template = PROMPT_INITIALIZE.replace("${path}", location.project.directory)
|
|
command.description = "guided AGENTS.md setup"
|
|
})
|
|
draft.update("review", (command) => {
|
|
command.template = PROMPT_REVIEW.replace("${path}", location.project.directory)
|
|
command.description = "review changes [commit|branch|pr], defaults to uncommitted"
|
|
})
|
|
})
|
|
}),
|
|
})
|