[GH-ISSUE #778] [Feature] Allow resource actions be populated from sidecar file #6308

Open
opened 2026-04-24 19:28:40 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @chrishoage on GitHub (Aug 28, 2025).
Original GitHub issue: https://github.com/moghtech/komodo/issues/778

Problem Statement

I have actions which have dependencies, which when viewed in Komodo look like this

Image

From the TOML file itself, it's obviously worse to try to work on and edit the action.

Suggestion

I propose that actions allow defining them as a sidecar file to the resource

[[action]]
name = "OpSecretSync"
[action.config]
reload_deno_deps = false
file = "./OpSecretSync.ts" 

Solution

In order to get types to work in the same way that they work inside the Komodo editor, we need to make a few modifications to the client code

  1. Introduce a types_namespace.ts which is output alongside types.ts that wraps the content of that file in declare namespace Types {}
  2. Remove the existing export import Types from public/index.d.ts
  3. Add import "./client/types_namespace.d.ts"; to the imports of public/index.d.ts

This works for both the Monaco editor using the built in typescript language sever

"Sidecar" action files would look like this

/// <reference types="http://localhost:9120/index.d.ts" />

// Run actions using the pre initialized 'komodo' client.
const version: Types.GetVersionResponse = await komodo.read("GetVersion", {});
console.log("🦎 Komodo version:", version.version, "🦎\n");

// Access arguments using the 'ARGS' object.
console.log(ARGS);

This works because deno (which we are assuming users will write their actions in if they use sidecar files) can load the types via the /// <reference types="http://localhost:9120/index.d.ts" />. It then recognizes the Types namespace and the rest of the globals.

Image

Implementation notes

  • Ideally [[VARIABLE]] and secret references would still work just like they do for UI / TOML defined actions (I would anticipate a similar temporary file would be used to execute the action, and the original file would not be used)
  • I would imagine these would be handled like "config" files where they can be edited and be a two way resource sync
  • /// <reference types="http://localhost:9120/index.d.ts" /> appears to be harmless to the Monaco editor. You'll get red squiggles under it, but the rest of the types still work
  • It would be on the user to add this to their own action typescript files
  • It would be assumed that Deno would be the LSP used (not only because komodo uses it, but also because it allows loading the reference types via a http url)
Originally created by @chrishoage on GitHub (Aug 28, 2025). Original GitHub issue: https://github.com/moghtech/komodo/issues/778 ## Problem Statement I have actions which have dependencies, which when viewed in Komodo look like this <img width="1193" height="663" alt="Image" src="https://github.com/user-attachments/assets/cc9c1553-a07f-43fe-aab9-af9cd5120794" /> From the TOML file itself, it's obviously worse to try to work on and edit the action. ## Suggestion I propose that actions allow defining them as a sidecar file to the resource ```toml [[action]] name = "OpSecretSync" [action.config] reload_deno_deps = false file = "./OpSecretSync.ts" ``` ## Solution In order to get types to work in the same way that they work inside the Komodo editor, we need to make a few modifications to the client code 1. Introduce a `types_namespace.ts` which is output alongside `types.ts` that wraps the content of that file in `declare namespace Types {}` 2. Remove the existing `export import Types` from `public/index.d.ts` 3. Add `import "./client/types_namespace.d.ts";` to the imports of `public/index.d.ts` This works for both the Monaco editor using the built in typescript language sever "Sidecar" action files would look like this ```ts /// <reference types="http://localhost:9120/index.d.ts" /> // Run actions using the pre initialized 'komodo' client. const version: Types.GetVersionResponse = await komodo.read("GetVersion", {}); console.log("🦎 Komodo version:", version.version, "🦎\n"); // Access arguments using the 'ARGS' object. console.log(ARGS); ``` This works because deno (which we are assuming users will write their actions in if they use sidecar files) can load the types via the `/// <reference types="http://localhost:9120/index.d.ts" />`. It then recognizes the `Types` namespace and the rest of the globals. <img width="865" height="271" alt="Image" src="https://github.com/user-attachments/assets/31653180-f41c-4150-a377-0bfd38bbf939" /> ## Implementation notes - Ideally `[[VARIABLE]]` and secret references would still work just like they do for UI / TOML defined actions (I would anticipate a similar temporary file would be used to execute the action, and the original file would not be used) - I would imagine these would be handled like "config" files where they can be edited and be a two way resource sync - `/// <reference types="http://localhost:9120/index.d.ts" />` appears to be harmless to the Monaco editor. You'll get red squiggles under it, but the rest of the types still work - It would be on the user to add this to their own action typescript files - It would be assumed that Deno would be the LSP used (not only because komodo uses it, but also because it allows loading the reference types via a http url)
GiteaMirror added the enhancement label 2026-04-24 19:28:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/komodo#6308