command.ts 912 B

12345678910111213141516171819202122232425
  1. export * as CommandPlugin from "./command"
  2. import { define } from "./internal"
  3. import { Effect } from "effect"
  4. import { Location } from "../location"
  5. import PROMPT_INITIALIZE from "./command/initialize.txt"
  6. import PROMPT_REVIEW from "./command/review.txt"
  7. export const Plugin = define({
  8. id: "command",
  9. effect: Effect.fn(function* (ctx) {
  10. const location = yield* Location.Service
  11. yield* ctx.command.transform((draft) => {
  12. draft.update("init", (command) => {
  13. command.template = PROMPT_INITIALIZE.replace("${path}", location.project.directory)
  14. command.description = "guided AGENTS.md setup"
  15. })
  16. draft.update("review", (command) => {
  17. command.template = PROMPT_REVIEW.replace("${path}", location.project.directory)
  18. command.description = "review changes [commit|branch|pr], defaults to uncommitted"
  19. command.subtask = true
  20. })
  21. })
  22. }),
  23. })