runline 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/actions.d.ts +1 -0
- package/dist/commands/actions.js +17 -4
- package/dist/main.js +3 -2
- package/package.json +1 -1
package/dist/commands/actions.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
+
import { loadConfig } from "../config/loader.js";
|
|
2
3
|
import { loadAllPlugins } from "../plugin/loader.js";
|
|
3
4
|
import { registry } from "../plugin/registry.js";
|
|
4
5
|
import { printJson } from "../utils/output.js";
|
|
5
6
|
export async function actions(options) {
|
|
6
7
|
await loadAllPlugins();
|
|
7
8
|
const all = registry.getAllActions();
|
|
9
|
+
const connectedPlugins = options.connected
|
|
10
|
+
? new Set(loadConfig().connections.map((c) => c.plugin))
|
|
11
|
+
: null;
|
|
12
|
+
const filtered = connectedPlugins
|
|
13
|
+
? all.filter(({ plugin }) => connectedPlugins.has(plugin))
|
|
14
|
+
: all;
|
|
8
15
|
if (options.json) {
|
|
9
|
-
printJson(
|
|
16
|
+
printJson(filtered.map(({ plugin, action }) => ({
|
|
10
17
|
plugin,
|
|
11
18
|
action: action.name,
|
|
12
19
|
description: action.description,
|
|
@@ -14,12 +21,18 @@ export async function actions(options) {
|
|
|
14
21
|
})));
|
|
15
22
|
return;
|
|
16
23
|
}
|
|
17
|
-
if (
|
|
18
|
-
|
|
24
|
+
if (filtered.length === 0) {
|
|
25
|
+
if (options.connected) {
|
|
26
|
+
console.log("No actions found for connected services.");
|
|
27
|
+
console.log("Add a connection first: runline connection add <name> -p <plugin>");
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
console.log("No actions registered. Install a plugin first.");
|
|
31
|
+
}
|
|
19
32
|
return;
|
|
20
33
|
}
|
|
21
34
|
const grouped = new Map();
|
|
22
|
-
for (const entry of
|
|
35
|
+
for (const entry of filtered) {
|
|
23
36
|
const list = grouped.get(entry.plugin) ?? [];
|
|
24
37
|
list.push(entry);
|
|
25
38
|
grouped.set(entry.plugin, list);
|
package/dist/main.js
CHANGED
|
@@ -55,9 +55,10 @@ Examples:
|
|
|
55
55
|
program
|
|
56
56
|
.command("actions")
|
|
57
57
|
.description("List all available actions and their schemas")
|
|
58
|
-
.
|
|
58
|
+
.option("-c, --connected", "Only show actions for plugins with configured connections")
|
|
59
|
+
.action(async (opts, cmd) => {
|
|
59
60
|
const globals = cmd.optsWithGlobals();
|
|
60
|
-
await actions({ json: globals.json });
|
|
61
|
+
await actions({ json: globals.json, connected: opts.connected });
|
|
61
62
|
});
|
|
62
63
|
// ── connection ──────────────────────────────────────────
|
|
63
64
|
const connCmd = program
|