|
372 | 372 | "'Yetibot' / user.email 'yetibot@yetibot.com', make a minimal change on a " |
373 | 373 | "new branch, push to origin, and `gh pr create`.\n" |
374 | 374 | "- Question: just answer it; clone only if the answer needs the code.\n\n" |
375 | | - "Tools (shell): `gh` (authenticated), `git`, and `curl` (to query yetibot's runtime commands via the API).\n\n" |
| 375 | + "Tools (shell): `gh` (authenticated), `git`, and `./yetibot` (to run Yetibot commands directly).\n\n" |
376 | 376 | "Introspecting and running Yetibot commands:\n" |
377 | | - "You can query and execute Yetibot commands and aliases via Yetibot's HTTP API at `http://localhost:$YETIBOT_PORT/api`.\n" |
378 | | - "Run the following `curl` command with the appropriate `--data-urlencode command=...` payload:\n\n" |
379 | | - " `curl -s -d \"chat-source={:adapter :agent :room \\\"agent-room\\\"}\" --data-urlencode \"command=agent <subcommand>\" http://localhost:$YETIBOT_PORT/api`\n\n" |
380 | | - "Where `<subcommand>` is one of:\n" |
381 | | - "- `list-commands`: returns all available built-in commands as a JSON map\n" |
382 | | - "- `list-aliases`: returns all configured command aliases as a JSON map\n" |
383 | | - "- `run <cmd>`: runs the given yetibot command `<cmd>` and returns the output\n\n" |
384 | | - "For example, you can list aliases, find a weather/temp alias, run it to get its data, and then pipe that data to a kroki command to generate a graph!\n\n" |
| 377 | + "You have a powerful local tool `./yetibot` in your working directory. You can use it to execute any built-in Yetibot command or alias directly in your shell.\n" |
| 378 | + "Run `./yetibot <command>` with any command or alias to get its output. For example:\n" |
| 379 | + "- `./yetibot agent list-commands`: returns all available built-in commands as a JSON map\n" |
| 380 | + "- `./yetibot agent list-aliases`: returns all configured command aliases as a JSON map\n" |
| 381 | + "- `./yetibot temps`: runs the `temps` alias to get weather/temp data\n" |
| 382 | + "- `./yetibot kroki <payload>`: generates a chart using kroki\n\n" |
| 383 | + "For example, you can run `./yetibot agent list-aliases`, find a weather/temp alias, run it using `./yetibot <alias-name>` to get its data, and then pass that data to another command like `./yetibot \"kroki ...\"` to generate a chart!\n\n" |
385 | 384 | (when-not (string/blank? mentions) (str mentions "\n\n")) |
386 | 385 | (when-not (string/blank? context) |
387 | 386 | (str "This thread's conversation so far, for REFERENCE ONLY — background, " |
|
422 | 421 | (.mkdirs settings-dir) |
423 | 422 | (spit (io/file settings-dir "settings.json") |
424 | 423 | (json/write-str {:maxSessionTurns (agent-max-turns)}))) |
| 424 | + ;; write the yetibot helper script |
| 425 | + (let [yetibot-script (io/file workdir "yetibot")] |
| 426 | + (spit yetibot-script |
| 427 | + (str "#!/bin/bash\n" |
| 428 | + "if [ $# -eq 0 ]; then\n" |
| 429 | + " echo \"Usage: yetibot <command>\"\n" |
| 430 | + " exit 1\n" |
| 431 | + "fi\n" |
| 432 | + "cmd=\"$*\"\n" |
| 433 | + "if [[ \"$cmd\" == agent* ]]; then\n" |
| 434 | + " payload=\"$cmd\"\n" |
| 435 | + "else\n" |
| 436 | + " payload=\"agent run $cmd\"\n" |
| 437 | + "fi\n" |
| 438 | + "curl -s -d \"chat-source={:adapter :agent :room \\\"agent-room\\\"}\" " |
| 439 | + "--data-urlencode \"command=$payload\" \"http://localhost:${YETIBOT_PORT:-3003}/api\"\n")) |
| 440 | + (.setExecutable yetibot-script true)) |
425 | 441 | (let [pb (doto (ProcessBuilder. [(cli-bin) "--yolo" "--output-format" "json" |
426 | 442 | "--model" (model) |
427 | 443 | "--prompt" (build-agent-prompt request context mentions)]) |
|
0 commit comments