From 83f312c96b155bda786d4016e4b488a81311099c Mon Sep 17 00:00:00 2001 From: Sleeyax Date: Tue, 10 Nov 2026 00:04:14 +0100 Subject: [PATCH 01/10] feat(task-runner): run a project's own scripts from a sidebar panel Add a Tasks panel in the Explorer that lists package.json scripts, Makefile targets, Nx targets and .vscode/tasks.json tasks. Discovery reads files as text, and only runs the repo's own nx after the user asks for inferred targets. Tasks run in plugin-owned terminals inside an sh wrapper that prints an exit marker, since the SDK cannot report a terminal's status. A trailing exit keeps zsh from exec-ing a single-command task, which lost the terminal and the marker on real daemons. JSONC is read by hand because jsonc-parser's UMD build fails to load in the daemon's bundle. Refs #124 Co-Authored-By: Claude Opus 5.5 --- .release-please-manifest.json | 1 + README.md | 1 + plugins/task-runner/CLAUDE.md | 11 + plugins/task-runner/README.md | 65 +++ plugins/task-runner/client/task-list.test.ts | 44 ++ plugins/task-runner/client/task-list.ts | 18 + plugins/task-runner/client/task-row.tsx | 106 ++++ plugins/task-runner/client/tasks-panel.tsx | 155 ++++++ .../0001-tasks-run-in-their-own-terminals.md | 6 + .../0002-status-comes-from-a-shell-wrapper.md | 7 + ...-discovery-never-runs-repo-code-unasked.md | 6 + plugins/task-runner/index.client.tsx | 29 + plugins/task-runner/index.server.ts | 74 +++ plugins/task-runner/package.json | 25 + plugins/task-runner/paseo-plugin.json | 7 + .../server/discovery/discover.test.ts | 498 ++++++++++++++++++ .../task-runner/server/discovery/discover.ts | 98 ++++ plugins/task-runner/server/discovery/files.ts | 84 +++ .../server/discovery/inferred-targets.ts | 80 +++ .../server/discovery/nx-projects.ts | 48 ++ .../server/discovery/package-manager.ts | 46 ++ .../task-runner/server/discovery/source.ts | 35 ++ .../server/discovery/sources/makefile.ts | 124 +++++ .../server/discovery/sources/nx.ts | 21 + .../discovery/sources/package-scripts.ts | 32 ++ .../server/discovery/sources/vscode-tasks.ts | 51 ++ .../task-runner/server/discovery/test-tree.ts | 13 + .../server/discovery/workspace-packages.ts | 100 ++++ .../task-runner/server/runs/fake-terminals.ts | 34 ++ .../server/runs/paseo-terminals.ts | 23 + .../task-runner/server/runs/shell-wrapper.ts | 46 ++ .../task-runner/server/runs/task-runs.test.ts | 226 ++++++++ plugins/task-runner/server/runs/task-runs.ts | 103 ++++ .../task-runner/server/runs/terminal-port.ts | 18 + plugins/task-runner/server/shell-quote.ts | 5 + plugins/task-runner/shared/contracts.ts | 32 ++ plugins/task-runner/shared/identity.ts | 4 + plugins/task-runner/shared/settings.ts | 12 + plugins/task-runner/shared/task.ts | 46 ++ plugins/task-runner/tsconfig.json | 5 + pnpm-lock.yaml | 34 ++ release-please-config.json | 4 + 42 files changed, 2377 insertions(+) create mode 100644 plugins/task-runner/CLAUDE.md create mode 100644 plugins/task-runner/README.md create mode 100644 plugins/task-runner/client/task-list.test.ts create mode 100644 plugins/task-runner/client/task-list.ts create mode 100644 plugins/task-runner/client/task-row.tsx create mode 100644 plugins/task-runner/client/tasks-panel.tsx create mode 100644 plugins/task-runner/docs/adr/0001-tasks-run-in-their-own-terminals.md create mode 100644 plugins/task-runner/docs/adr/0002-status-comes-from-a-shell-wrapper.md create mode 100644 plugins/task-runner/docs/adr/0003-discovery-never-runs-repo-code-unasked.md create mode 100644 plugins/task-runner/index.client.tsx create mode 100644 plugins/task-runner/index.server.ts create mode 100644 plugins/task-runner/package.json create mode 100644 plugins/task-runner/paseo-plugin.json create mode 100644 plugins/task-runner/server/discovery/discover.test.ts create mode 100644 plugins/task-runner/server/discovery/discover.ts create mode 100644 plugins/task-runner/server/discovery/files.ts create mode 100644 plugins/task-runner/server/discovery/inferred-targets.ts create mode 100644 plugins/task-runner/server/discovery/nx-projects.ts create mode 100644 plugins/task-runner/server/discovery/package-manager.ts create mode 100644 plugins/task-runner/server/discovery/source.ts create mode 100644 plugins/task-runner/server/discovery/sources/makefile.ts create mode 100644 plugins/task-runner/server/discovery/sources/nx.ts create mode 100644 plugins/task-runner/server/discovery/sources/package-scripts.ts create mode 100644 plugins/task-runner/server/discovery/sources/vscode-tasks.ts create mode 100644 plugins/task-runner/server/discovery/test-tree.ts create mode 100644 plugins/task-runner/server/discovery/workspace-packages.ts create mode 100644 plugins/task-runner/server/runs/fake-terminals.ts create mode 100644 plugins/task-runner/server/runs/paseo-terminals.ts create mode 100644 plugins/task-runner/server/runs/shell-wrapper.ts create mode 100644 plugins/task-runner/server/runs/task-runs.test.ts create mode 100644 plugins/task-runner/server/runs/task-runs.ts create mode 100644 plugins/task-runner/server/runs/terminal-port.ts create mode 100644 plugins/task-runner/server/shell-quote.ts create mode 100644 plugins/task-runner/shared/contracts.ts create mode 100644 plugins/task-runner/shared/identity.ts create mode 100644 plugins/task-runner/shared/settings.ts create mode 100644 plugins/task-runner/shared/task.ts create mode 100644 plugins/task-runner/tsconfig.json diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 72aa0132..dce95ba5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -3,5 +3,6 @@ "plugins/claude-tty": "0.5.0", "plugins/discord-rich-presence": "0.2.0", "plugins/guided-review": "0.2.0", + "plugins/task-runner": "0.0.0", "apps/claude-tty-acp": "0.5.0" } diff --git a/README.md b/README.md index 1c408799..f0431a6f 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ My plugins for [Paseo](https://github.com/getpaseo/paseo). | [Catppuccin theme](plugins/catppuccin-theme) | Add all four Catppuccin flavours as app themes. | | [Claude TTY](plugins/claude-tty) | Deprecated: offer the Claude TTY ACP adapter as a Paseo provider, and manage it on the daemon host. | | [Guided Review](plugins/guided-review) | Show a trunk-first guide to a pull request or merge request, and build your draft review alongside it. | +| [Task Runner](plugins/task-runner) | Run a project's own scripts from a sidebar panel. | | ACP | Description | | ------------------------------------- | -------------------------------------------------------------------------------------- | diff --git a/plugins/task-runner/CLAUDE.md b/plugins/task-runner/CLAUDE.md new file mode 100644 index 00000000..2a2f4cf3 --- /dev/null +++ b/plugins/task-runner/CLAUDE.md @@ -0,0 +1,11 @@ +# Working on this plugin + +Run `paseo plugin reload task-runner` after every change, then `paseo plugin logs task-runner`. +The reload is the only compile check of the two bundles the daemon builds. + +## Traps + +- A dependency whose entry is a UMD build fails at load with `Cannot find module`, because the daemon's bundler cannot follow its dynamic `require`, while typecheck and tests pass. + `jsonc-parser` is one, which is why `server/discovery/files.ts` reads JSONC itself. +- A change to `WRAPPER` in `server/runs/shell-wrapper.ts` has to be tried on real terminals with both zsh and bash, with a single-command task and with Ctrl+C. +- `pnpm test` runs `node --test` with Node's type stripping: write only erasable TypeScript and keep the `.ts` extension on relative imports. diff --git a/plugins/task-runner/README.md b/plugins/task-runner/README.md new file mode 100644 index 00000000..cd2bd556 --- /dev/null +++ b/plugins/task-runner/README.md @@ -0,0 +1,65 @@ +# Task Runner + +Run the scripts your project already defines from a **Tasks** panel in the Explorer, without declaring them again in `paseo.json`. +It lists `package.json` scripts, Makefile targets, Nx targets and `.vscode/tasks.json` tasks. + +## Installation + +Requires: + +- Paseo 0.15 or newer +- `pnpm` on the daemon's `PATH` +- A macOS or Linux host + +```sh +paseo plugin add github:sleeyax/paseo-plugins:plugins/task-runner +``` + +Update with `paseo plugin update task-runner`. +To install from source, see the [root README](../../README.md#from-source). + +## Usage + +### Open the panel + +Open **Tasks** in the Explorer, or choose **Run Task...** in the Command Center. +The list is scanned when the panel opens and when you select refresh. + +### Run a task + +Select the play button on a row. +The task runs in its own workspace terminal named `task: