@joshualelon/clawdbot-skill-flow 0.2.3 → 0.3.1

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/index.ts CHANGED
@@ -3,6 +3,9 @@
3
3
  */
4
4
 
5
5
  import type { ClawdbotPluginApi } from "clawdbot/plugin-sdk";
6
+ import { readFileSync } from "node:fs";
7
+ import { fileURLToPath } from "node:url";
8
+ import { dirname, join } from "node:path";
6
9
  import { parseSkillFlowConfig } from "./src/config.js";
7
10
  import { initSessionStore, createSession, getSessionKey } from "./src/state/session-store.js";
8
11
  import { createFlowStartCommand } from "./src/commands/flow-start.js";
@@ -15,12 +18,17 @@ import { startFlow } from "./src/engine/executor.js";
15
18
  import { FlowMetadataSchema } from "./src/validation.js";
16
19
  import type { FlowMetadata } from "./src/types.js";
17
20
 
21
+ // Read metadata from package.json
22
+ const __dirname = dirname(fileURLToPath(import.meta.url));
23
+ const packageJson = JSON.parse(
24
+ readFileSync(join(__dirname, "package.json"), "utf-8")
25
+ ) as { version: string; description: string };
26
+
18
27
  const plugin = {
19
28
  id: "skill-flow",
20
29
  name: "Skill Flow",
21
- description:
22
- "Multi-step workflow orchestration for deterministic command execution",
23
- version: "0.1.0",
30
+ description: packageJson.description,
31
+ version: packageJson.version,
24
32
 
25
33
  register(api: ClawdbotPluginApi) {
26
34
  // Parse and validate config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joshualelon/clawdbot-skill-flow",
3
- "version": "0.2.3",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "Multi-step workflow orchestration plugin for Clawdbot",
6
6
  "keywords": [
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import type { ClawdbotPluginApi } from "clawdbot/plugin-sdk";
6
- import { loadFlow } from "../state/flow-store.js";
6
+ import { loadFlow, listFlows } from "../state/flow-store.js";
7
7
  import { createSession, getSessionKey } from "../state/session-store.js";
8
8
  import { startFlow } from "../engine/executor.js";
9
9
 
@@ -15,8 +15,34 @@ export function createFlowStartCommand(api: ClawdbotPluginApi) {
15
15
  }) => {
16
16
  const flowName = args.args?.trim();
17
17
 
18
- // Validate input
18
+ // Show flow selection buttons when no flow name provided (Telegram)
19
19
  if (!flowName) {
20
+ const flows = await listFlows(api);
21
+
22
+ if (flows.length === 0) {
23
+ return {
24
+ text: "No flows available.\n\nCreate one with /flow_create",
25
+ };
26
+ }
27
+
28
+ // Show buttons on Telegram, text list on other channels
29
+ if (args.channel === "telegram") {
30
+ const buttons = flows.map((flow) => [
31
+ {
32
+ text: `${flow.name}${flow.description ? ` - ${flow.description}` : ""}`,
33
+ callback_data: `/flow_start ${flow.name}`,
34
+ },
35
+ ]);
36
+
37
+ return {
38
+ text: "Choose a flow to start:",
39
+ channelData: {
40
+ telegram: { buttons },
41
+ },
42
+ };
43
+ }
44
+
45
+ // Fallback for non-Telegram channels
20
46
  return {
21
47
  text: "Usage: /flow_start <flow-name>\n\nExample: /flow_start pushups\n\nUse /flow_list to see available flows.",
22
48
  };