stablyai / stablyai/orca

feat: global startup command automations

Open
#4,473 1 comment 1 reaction 1 assignee Claimed by @brennanb2025 View on GitHub
enhancement size/m
Dominant language
TypeScript
Stars
71.3k
Forks
4.7k
Avg merge
14h 54m
Merged PRs (30d)
520

Description

## Problem / Use Case

Users need terminal commands to run automatically when Orca launches — for example, starting `agentmemory`, tailing logs, or booting a dev server — without being tied to a specific project worktree. Currently, automations only support project-scoped terminal commands that require a project and worktree target.

A global scope lets users define commands that run independently of any project, with an explicit working directory, in Orca's floating workspace. Additionally, global commands should offer the choice of running in the **floating workspace** (with a custom cwd) or in a **selected worktree** (like project-scoped commands).

## Proposed Solution

Add a `scope` field (`'project' | 'global'`) to automations, along with a new `launchTarget` option `'floating'` for global commands:

1. **Types** — Add `AutomationScope`, `AutomationAction`, `AutomationLaunchTarget` with `'floating'` value to shared types
2. **UI** — Add scope selector (Global/Project), launch target selector (Floating workspace / Selected worktree), and directory picker for the global cwd
3. **Dispatch** — Route global+floating commands to `FLOATING_TERMINAL_WORKTREE_ID` with the configured cwd, auto-open floating workspace panel on first dispatch
4. **Backward compat** — Existing global automations (previously stored with empty `projectId`) continue to route to the floating workspace

Key files changed:
- `src/shared/automations-types.ts`
- `src/renderer/src/components/automations/AutomationEditorDialog.tsx`
- `src/renderer/src/components/automations/AutomationsPage.tsx`
- `src/renderer/src/components/automations/AutomationDetail.tsx`
- `src/renderer/src/hooks/useAutomationDispatchEvents.ts`
- `src/renderer/src/lib/automation-startup-command-targets.ts`
- `src/main/automations/service.ts`
- `src/main/persistence.ts`

## Alternatives Considered

- **Rely on project-scoped commands only** — doesn't cover use cases where no project exists or the command needs a specific working directory outside any repo
- **Auto-create Orca-managed directories** — explicit cwd picker gives the user full control without magic paths
- **Only floating workspace** — adding "selected worktree" as an option covers users who want global-triggered commands in their normal terminal workflow

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.