Skip to content

feat: introduce automations across server, app, and TUI#12417

Open
GriffinBoris wants to merge 16 commits intoanomalyco:devfrom
GriffinBoris:feature/automations
Open

feat: introduce automations across server, app, and TUI#12417
GriffinBoris wants to merge 16 commits intoanomalyco:devfrom
GriffinBoris:feature/automations

Conversation

@GriffinBoris
Copy link

@GriffinBoris GriffinBoris commented Feb 6, 2026

What does this PR do?

Adds Automations. You can create a scheduled or manual automation that runs a prompt across one or more projects, spins up sessions, and records history. The server/domain, the API + SDK, the CLI/TUI, and the web app UI are all wired. The prompt editor was moved into a shared component so the automation dialog can reuse it, and added a shared import/export format.

This partially some automation related tickets:

Fixes #5891

Somewhat Related:

How did you verify your code works?

  • bun run typecheck in packages/util, packages/app, packages/opencode, packages/ui
  • bun test
  • manual tests with videos

Desktop

desktop.mov

TUI

tui.mov

AI generated details

Feature added

  • Automations: scheduled or on‑demand prompts that run across one or more projects, creating sessions and logging run history.

How it works

  • Create/update: An automation stores name, projects, prompt, schedule, enabled plus timestamps and last run/session.
  • Schedule: The server registers a global scheduler tick; due automations are executed in the background.
  • Execution:
  • For each target project, the server bootstraps the instance, renders the prompt (supports {{date}}, {{project.name}}, {{session.latest}}, {{session.query:...}}), and creates a session.
  • If the prompt starts with /, it runs as a command; otherwise it’s a normal prompt.
  • History + events: Each run creates AutomationRun entries and emits global events for UI/TUI live updates.
  • Manual run: POST /automation/:id/run returns immediately (async execution).

Systems changed

  • Server domain & scheduler
    • New automation domain (packages/opencode/src/automation/index.ts)
    • Scheduler registration on server start (packages/opencode/src/server/server.ts)
  • API + SDK
    • New automation routes (packages/opencode/src/server/routes/automation.ts)
    • OpenAPI + JS SDK regeneration (packages/sdk/openapi.json, packages/sdk/js/src/v2/gen/*)
  • CLI/TUI
    • CLI commands (packages/opencode/src/cli/cmd/automation.ts)
    • TUI dialogs + keybinds + sync (packages/opencode/src/cli/cmd/tui/*)
  • Web app
    • Automations page + dialogs (packages/app/src/pages/automations.tsx, packages/app/src/components/dialog-automation*.tsx)
    • Prompt editor refactor reused for automation prompt authoring (packages/app/src/components/prompt-editor.tsx)
  • Shared utilities
    • Import/export contract (packages/util/src/automation-transfer.ts)
    • Slug helper (packages/util/src/slugify.ts)
  • UI primitives
    • Icons + select behavior adjustments (packages/ui/src/components/icon.tsx, packages/ui/src/components/select.tsx)

Where data lives

  • Automations + history stored under the server storage:
    • ~/.local/share/opencode/storage/automation/*.json
    • ~/.local/share/opencode/storage/automation//run/*.json
  • Project list used in the automation dialog is from the server project registry:
    • ~/.local/share/opencode/storage/project/*.json

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Full automation support

1 participant