From c397d6e2662633de9c3c036fc80499237d834366 Mon Sep 17 00:00:00 2001 From: Aman Mehtar Date: Sun, 25 Oct 2026 17:19:16 +0530 Subject: [PATCH] Add Script Commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Executable scripts with @raycast.* headers in ~/.config/oma-cast/script-commands (plus config.json scriptCommandDirectories) become root-search commands, per SPEC §9.9 and ref 03 §5. - Modes: compact (running toast with Cancel, then the last line), silent (HUD), fullOutput (streamed output view: copy, run again, stop) and inline (first line as the subtitle, refreshed on refreshTime >= 10 s). - Up to three text/password/dropdown arguments as pills; needsConfirmation uses the alert. - Search / Create / Reload Script Commands built-ins; invalid headers are listed with the reason. - RPC: scriptCommands.getScripts|reload|runScript|cancelScript|getRun. Co-Authored-By: Claude Opus 5.5 (1M context) --- CLAUDE.md | 8 +- README.md | 35 +- plugin/Backend.qml | 156 ++++++++- plugin/core/RootSearch.js | 99 +++++- plugin/core/Schema.js | 6 +- plugin/core/ScriptCommands.js | 413 +++++++++++++++++++++++ plugin/services/ScriptCommandsSource.qml | 245 ++++++++++++++ plugin/ui/LauncherWindow.qml | 211 ++++++++++-- tests/agent-lifecycle.test.js | 9 +- tests/migrate.test.js | 7 + tests/script-commands.test.js | 225 ++++++++++++ 11 files changed, 1379 insertions(+), 35 deletions(-) create mode 100644 plugin/core/ScriptCommands.js create mode 100644 plugin/services/ScriptCommandsSource.qml create mode 100644 tests/script-commands.test.js diff --git a/CLAUDE.md b/CLAUDE.md index c2ea441..cc67581 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -142,8 +142,14 @@ Works: config.json sets `remToPxRate` (16), `workHoursPerDay` (8) and `clockFormat` (`auto` follows the Qt locale, or `12h` / `24h`). ↵ copies the answer (HUD), Ctrl+↵ pastes it through `omarchy-clipboard-paste-text`, Ctrl+Shift+C copies "question = answer". Each one saves to **Calculator History** (`db/calculator.json`, 4096 rows / 90 days): a built-in command and pushed view, searchable, Ctrl+D deletes an entry, Ctrl+Shift+D deletes all. RPC: `calculator.calculate|historyGetAll|historyDelete|historyDeleteAll|refreshCurrencies|getCurrencies`. A bare number, word or quantity (`42`, `firefox`, `5 kg`) never produces a row, because the section takes ↵. +- **Script Commands** (SPEC §9.9, ref 03 §5): `core/ScriptCommands.js` (header parsing, arguments, output handling) and `services/ScriptCommandsSource.qml` (scan, runs, inline refresh). + - Folders: `~/.config/oma-cast/script-commands` plus config.json `scriptCommandDirectories` (absolute or `~/`). A bash scan skips dirs, non-executables, empty files, `.template.` files, files over 2 MB and files with no `@raycast.` line. It runs on every open and on Reload Script Commands. Files whose header is broken are listed under "Invalid Scripts" in Search Script Commands. + - Scripts run as `bash -lc 'cd ; exec