[PR #324] [MERGED] collection plugin actions + file read/write #247

Closed
opened 2025-12-29 08:32:17 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mountain-loop/yaak/pull/324
Author: @turchinc
Created: 12/16/2025
Status: Merged
Merged: 12/29/2025
Merged by: @gschier

Base: mainHead: main


📝 Commits (10+)

  • e17aae2 collection plugin actions
  • 218fdf3 Merge main into turchinc/main (PR #324)
  • 6d5ba68 Remove unnecessary ctx.file APIs - plugins can use node:fs directly
  • 07d743d Use workspace from plugin context instead of accepting it as parameter
  • 3855058 Refactor new actions apis
  • 7446d62 Add test actions to copy-curl plugin and add WebSocket request actions to Sidebar
  • 3c45464 Get everything working
  • cdd5ba3 Remove unused
  • 8e1959b Use generated types for FolderActionPlugin and WorkspaceActionPlugin
  • 1c29f4d Merge branch 'main' into main

📊 Changes

21 files changed (+801 additions, -29 deletions)

View changed files

📝 packages/plugin-runtime-types/src/bindings/gen_events.ts (+33 -1)
📝 packages/plugin-runtime-types/src/plugins/Context.ts (+8 -0)
packages/plugin-runtime-types/src/plugins/FolderActionPlugin.ts (+6 -0)
packages/plugin-runtime-types/src/plugins/WebSocketRequestActionPlugin.ts (+6 -0)
packages/plugin-runtime-types/src/plugins/WorkspaceActionPlugin.ts (+6 -0)
📝 packages/plugin-runtime-types/src/plugins/index.ts (+8 -0)
📝 packages/plugin-runtime/src/PluginInstance.ts (+104 -0)
📝 src-tauri/src/http_request.rs (+6 -6)
📝 src-tauri/src/lib.rs (+87 -6)
📝 src-tauri/src/plugin_events.rs (+30 -3)
📝 src-tauri/yaak-models/src/models.rs (+3 -3)
📝 src-tauri/yaak-plugins/bindings/gen_events.ts (+33 -1)
📝 src-tauri/yaak-plugins/src/events.rs (+145 -0)
📝 src-tauri/yaak-plugins/src/manager.rs (+123 -8)
📝 src-web/components/Sidebar.tsx (+23 -0)
📝 src-web/components/WorkspaceActionsDropdown.tsx (+20 -1)
📝 src-web/components/core/Editor/twig/twig.test.ts (+2 -0)
src-web/hooks/useFolderActions.ts (+50 -0)
src-web/hooks/useWebSocketRequestActions.ts (+52 -0)
src-web/hooks/useWorkspaceActions.ts (+50 -0)

...and 1 more files

📄 Description

Plugin Runtime Types — Collection Actions

Primary use case: export actions or similar for all items in a collection, supporting folders, requests and exposing read/write to provide export (and potentially import)

PR should solve or enable solutions for:

httpCollectionActions

Define custom actions that appear in folder/workspace context menus.

  • Field on PluginDefinition:

    • httpCollectionActions?: HttpCollectionActionPlugin[]
  • HttpCollectionActionPlugin shape:

    • label: string — displayed in context menu
    • icon?: Icon — optional icon for the action
    • onSelect(ctx: Context, args: CallHttpCollectionActionArgs) — called when user invokes the action
  • CallHttpCollectionActionArgs shape:

    • folder?: Folder — present when action was invoked on a folder
    • workspace?: Workspace — present when action was invoked on a workspace

Notes:

  • Actions appear in context menu for single folder/workspace selection
  • Plugin may operate on entire collection by using ctx.folder.list() and ctx.httpRequest.list()

New Context APIs

ctx.folder.list(args)

List all folders in a workspace.

args: {
  workspaceId?: string;
}

// Returns: Array<Folder>

ctx.file.writeText(filePath, content)

Write text content to a file.

writeText(filePath: string, content: string): Promise<void>

ctx.file.readText(filePath)

Read text content from a file.

readText(filePath: string): Promise<string>

ctx.httpRequest.list(args)

List all requests in a workspace or folder.

args: {
  workspaceId?: string;
  folderId?: string;
}

// Returns: Array<HttpRequest>

Notes:

  • Backwards compatible: all new fields are optional and do not affect existing plugins

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mountain-loop/yaak/pull/324 **Author:** [@turchinc](https://github.com/turchinc) **Created:** 12/16/2025 **Status:** ✅ Merged **Merged:** 12/29/2025 **Merged by:** [@gschier](https://github.com/gschier) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (10+) - [`e17aae2`](https://github.com/mountain-loop/yaak/commit/e17aae246b90ee072a989d339a9c2b7c9be0b5bf) collection plugin actions - [`218fdf3`](https://github.com/mountain-loop/yaak/commit/218fdf3715f0ba31fd938413ea526e0a1134cfa5) Merge main into turchinc/main (PR #324) - [`6d5ba68`](https://github.com/mountain-loop/yaak/commit/6d5ba685f12fed2e41be6ee58954a4a061f70e6b) Remove unnecessary ctx.file APIs - plugins can use node:fs directly - [`07d743d`](https://github.com/mountain-loop/yaak/commit/07d743db2143fa6a29d57800df5c38c297a5d952) Use workspace from plugin context instead of accepting it as parameter - [`3855058`](https://github.com/mountain-loop/yaak/commit/3855058d8f9df6764ca6e9001a6b388b362d49a3) Refactor new actions apis - [`7446d62`](https://github.com/mountain-loop/yaak/commit/7446d62e3999256cdfdfb022bc3ad5a90e9070e5) Add test actions to copy-curl plugin and add WebSocket request actions to Sidebar - [`3c45464`](https://github.com/mountain-loop/yaak/commit/3c45464e343b4147868a34999a2b598b91a430eb) Get everything working - [`cdd5ba3`](https://github.com/mountain-loop/yaak/commit/cdd5ba3c83196cabb518b6925fc00980598c7a21) Remove unused - [`8e1959b`](https://github.com/mountain-loop/yaak/commit/8e1959b7c390e7a687003d1ed4f328c7732696d7) Use generated types for FolderActionPlugin and WorkspaceActionPlugin - [`1c29f4d`](https://github.com/mountain-loop/yaak/commit/1c29f4d4add4f93ffbb488a233dc5b466388eca5) Merge branch 'main' into main ### 📊 Changes **21 files changed** (+801 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `packages/plugin-runtime-types/src/bindings/gen_events.ts` (+33 -1) 📝 `packages/plugin-runtime-types/src/plugins/Context.ts` (+8 -0) ➕ `packages/plugin-runtime-types/src/plugins/FolderActionPlugin.ts` (+6 -0) ➕ `packages/plugin-runtime-types/src/plugins/WebSocketRequestActionPlugin.ts` (+6 -0) ➕ `packages/plugin-runtime-types/src/plugins/WorkspaceActionPlugin.ts` (+6 -0) 📝 `packages/plugin-runtime-types/src/plugins/index.ts` (+8 -0) 📝 `packages/plugin-runtime/src/PluginInstance.ts` (+104 -0) 📝 `src-tauri/src/http_request.rs` (+6 -6) 📝 `src-tauri/src/lib.rs` (+87 -6) 📝 `src-tauri/src/plugin_events.rs` (+30 -3) 📝 `src-tauri/yaak-models/src/models.rs` (+3 -3) 📝 `src-tauri/yaak-plugins/bindings/gen_events.ts` (+33 -1) 📝 `src-tauri/yaak-plugins/src/events.rs` (+145 -0) 📝 `src-tauri/yaak-plugins/src/manager.rs` (+123 -8) 📝 `src-web/components/Sidebar.tsx` (+23 -0) 📝 `src-web/components/WorkspaceActionsDropdown.tsx` (+20 -1) 📝 `src-web/components/core/Editor/twig/twig.test.ts` (+2 -0) ➕ `src-web/hooks/useFolderActions.ts` (+50 -0) ➕ `src-web/hooks/useWebSocketRequestActions.ts` (+52 -0) ➕ `src-web/hooks/useWorkspaceActions.ts` (+50 -0) _...and 1 more files_ </details> ### 📄 Description # Plugin Runtime Types — Collection Actions Primary use case: export actions or similar for all items in a collection, supporting folders, requests and exposing read/write to provide export (and potentially import) PR should solve or enable solutions for: - <https://feedback.yaak.app/p/folder-level-export> (should be done) - <https://feedback.yaak.app/p/export-as-postman-collection> (my wip. [pushed to own repo waiting for this PR](https://github.com/turchinc/yaak-plugin-export-postman) unless you want it in app repo) - <https://feedback.yaak.app/p/export-to-openapi> (might tackle this, looking for more of a neutral exchange format which postman json kind of _de facto_ is, but this might be promising) ## `httpCollectionActions` Define custom actions that appear in folder/workspace context menus. - Field on `PluginDefinition`: - `httpCollectionActions?: HttpCollectionActionPlugin[]` - `HttpCollectionActionPlugin` shape: - `label: string` — displayed in context menu - `icon?: Icon` — optional icon for the action - `onSelect(ctx: Context, args: CallHttpCollectionActionArgs)` — called when user invokes the action - `CallHttpCollectionActionArgs` shape: - `folder?: Folder` — present when action was invoked on a folder - `workspace?: Workspace` — present when action was invoked on a workspace Notes: - Actions appear in context menu for single folder/workspace selection - Plugin may operate on entire collection by using `ctx.folder.list()` and `ctx.httpRequest.list()` ## New Context APIs ### `ctx.folder.list(args)` List all folders in a workspace. ```typescript args: { workspaceId?: string; } // Returns: Array<Folder> ``` ### `ctx.file.writeText(filePath, content)` Write text content to a file. ```typescript writeText(filePath: string, content: string): Promise<void> ``` ### `ctx.file.readText(filePath)` Read text content from a file. ```typescript readText(filePath: string): Promise<string> ``` ### `ctx.httpRequest.list(args)` List all requests in a workspace or folder. ```typescript args: { workspaceId?: string; folderId?: string; } // Returns: Array<HttpRequest> ``` Notes: - Backwards compatible: all new fields are optional and do not affect existing plugins --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 08:32:17 +01:00
adam closed this issue 2025-12-29 08:32:17 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/yaak-mountain-loop#247