@kvasar/openclaw-storyblok-plugin 0.1.4 → 0.1.6

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
@@ -10,7 +10,7 @@
10
10
  import { Type } from "@sinclair/typebox";
11
11
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
12
12
 
13
- import { StoryblokClient } from "./src/client.js";
13
+ import { StoryblokClient, type StoryblokConfig } from "./src/client.js";
14
14
  import { validateConfig, redactTokens } from "./src/config.js";
15
15
 
16
16
  interface StoryblokPluginConfig {
@@ -20,6 +20,39 @@ interface StoryblokPluginConfig {
20
20
  previewToken?: string;
21
21
  }
22
22
 
23
+ interface OpenClawPluginApi {
24
+ pluginConfig?: unknown;
25
+ config?: unknown;
26
+ registerTool(tool: {
27
+ name: string;
28
+ description: string;
29
+ parameters: unknown;
30
+ execute: (_id?: string, params?: any) => Promise<unknown> | unknown;
31
+ }): void;
32
+ }
33
+
34
+ interface CreateStoryParams {
35
+ title: string;
36
+ slug?: string;
37
+ folder_id?: number;
38
+ parent_id?: number;
39
+ content?: Record<string, any>;
40
+ tags?: string[];
41
+ is_folder?: boolean;
42
+ language?: string;
43
+ }
44
+
45
+ interface UpdateStoryParams {
46
+ story_id: string;
47
+ title?: string;
48
+ slug?: string;
49
+ content?: Record<string, any>;
50
+ parent_id?: number;
51
+ tags?: string[];
52
+ language?: string;
53
+ version?: string;
54
+ }
55
+
23
56
  function ok(data: unknown) {
24
57
  return {
25
58
  content: [
@@ -56,10 +89,10 @@ export default definePluginEntry({
56
89
  description:
57
90
  "Interact with Storyblok CMS: manage stories, components, and space information.",
58
91
 
59
- register(api) {
92
+ register(api: OpenClawPluginApi) {
60
93
  const rawCfg = (
61
- (api as { pluginConfig?: unknown; config?: unknown }).pluginConfig ??
62
- (api as { pluginConfig?: unknown; config?: unknown }).config ??
94
+ api.pluginConfig ??
95
+ api.config ??
63
96
  {}
64
97
  ) as StoryblokPluginConfig;
65
98
 
@@ -79,7 +112,14 @@ export default definePluginEntry({
79
112
  );
80
113
  }
81
114
 
82
- const client = new StoryblokClient(cfg);
115
+ const clientCfg: StoryblokConfig = {
116
+ baseUrl: cfg.baseUrl ?? "https://api.storyblok.com",
117
+ spaceId: cfg.spaceId ?? "",
118
+ managementToken: cfg.managementToken ?? "",
119
+ previewToken: cfg.previewToken,
120
+ };
121
+
122
+ const client = new StoryblokClient(clientCfg);
83
123
 
84
124
  api.registerTool({
85
125
  name: "storyblok_get_space",
@@ -111,7 +151,7 @@ export default definePluginEntry({
111
151
  svg_render: Type.Optional(Type.Boolean()),
112
152
  }),
113
153
  async execute(
114
- _id: string,
154
+ _id: string | undefined,
115
155
  params: {
116
156
  identifier: string;
117
157
  version?: string;
@@ -146,7 +186,7 @@ export default definePluginEntry({
146
186
  sort_by: Type.Optional(Type.String()),
147
187
  direction: Type.Optional(Type.String()),
148
188
  }),
149
- async execute(_id: string, params: Record<string, any>) {
189
+ async execute(_id: string | undefined, params: Record<string, any>) {
150
190
  try {
151
191
  return ok(await client.listStories(params));
152
192
  } catch (error) {
@@ -170,7 +210,7 @@ export default definePluginEntry({
170
210
  is_folder: Type.Optional(Type.Boolean()),
171
211
  language: Type.Optional(Type.String()),
172
212
  }),
173
- async execute(_id: string, params: Record<string, any>) {
213
+ async execute(_id: string | undefined, params: CreateStoryParams) {
174
214
  try {
175
215
  return ok(await client.createStory(params));
176
216
  } catch (error) {
@@ -194,12 +234,13 @@ export default definePluginEntry({
194
234
  language: Type.Optional(Type.String()),
195
235
  version: Type.Optional(Type.String()),
196
236
  }),
197
- async execute(_id: string, params: Record<string, any>) {
237
+ async execute(_id: string | undefined, params: UpdateStoryParams) {
198
238
  try {
239
+ const { story_id, ...update } = params;
199
240
  return ok(
200
241
  await client.updateStory(
201
- params.story_id,
202
- params
242
+ story_id,
243
+ update
203
244
  )
204
245
  );
205
246
  } catch (error) {
@@ -217,7 +258,7 @@ export default definePluginEntry({
217
258
  language: Type.Optional(Type.String()),
218
259
  publish_notes: Type.Optional(Type.String()),
219
260
  }),
220
- async execute(_id: string, params: Record<string, any>) {
261
+ async execute(_id: string | undefined, params: Record<string, any>) {
221
262
  try {
222
263
  return ok(
223
264
  await client.publishStory(params.story_id, {
@@ -239,7 +280,7 @@ export default definePluginEntry({
239
280
  story_id: Type.String(),
240
281
  language: Type.Optional(Type.String()),
241
282
  }),
242
- async execute(_id: string, params: Record<string, any>) {
283
+ async execute(_id: string | undefined, params: Record<string, any>) {
243
284
  try {
244
285
  return ok(
245
286
  await client.unpublishStory(
@@ -260,7 +301,7 @@ export default definePluginEntry({
260
301
  version: Type.Optional(Type.String()),
261
302
  language: Type.Optional(Type.String()),
262
303
  }),
263
- async execute(_id: string, params: Record<string, any>) {
304
+ async execute(_id: string | undefined, params: Record<string, any>) {
264
305
  try {
265
306
  return ok(
266
307
  await client.getComponents(
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "id": "openclaw-storyblok",
3
3
  "name": "Storyblok Integration",
4
- "version": "0.1.4",
4
+ "version": "0.1.6",
5
5
  "description": "Provides tools to interact with Storyblok CMS via Management API and Delivery API. Supports stories, components, and space management.",
6
6
  "skills": ["skills"],
7
- "configSchema": {
7
+ "configSchema": {
8
8
  "type": "object",
9
9
  "additionalProperties": false,
10
10
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvasar/openclaw-storyblok-plugin",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "OpenClaw plugin — interact with Storyblok CMS via Management API and Delivery API",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
@@ -24,12 +24,12 @@
24
24
  "./index.ts"
25
25
  ],
26
26
  "compat": {
27
- "pluginApi": ">=2026.3.24-beta.2",
28
- "minGatewayVersion": "2026.3.24-beta.2"
27
+ "pluginApi": ">=2026.3.13",
28
+ "minGatewayVersion": "2026.3.13"
29
29
  },
30
30
  "build": {
31
- "openclawVersion": "2026.3.24-beta.2",
32
- "pluginSdkVersion": "2026.3.24-beta.2"
31
+ "openclawVersion": "2026.3.13",
32
+ "pluginSdkVersion": "2026.3.13"
33
33
  }
34
34
  },
35
35
  "dependencies": {
package/skills/SKILL.md CHANGED
@@ -29,17 +29,6 @@ This skill package provides agents with the ability to work with **Storyblok CMS
29
29
  3. **Page Generation** – Use AI-assisted reasoning to create new landing pages.
30
30
  4. **Sync Workflow** – Synchronize content or schemas between Storyblok and a frontend repository.
31
31
 
32
- ## Prerequisites
33
-
34
- The Storyblok plugin must be configured with valid credentials:
35
-
36
- - `baseUrl` (default: https://api.storyblok.com)
37
- - `spaceId`
38
- - `managementToken` (required for write operations)
39
- - `previewToken` (optional for read-only operations)
40
-
41
- These are set when installing the plugin. Inside a session, the plugin config will be used automatically.
42
-
43
32
  ## Core Concepts
44
33
 
45
34
  ### Tools
@@ -64,14 +53,6 @@ All tools are provided by the `openclaw-storyblok` plugin:
64
53
  - For `storyblok_list_stories`, you can filter by `folder_id`, `parent_id`, `status`, `tag`, `per_page`, `page`, `sort_by`, `direction`.
65
54
  - For management tools, `story_id` can be numeric ID or UUID.
66
55
 
67
- ### Error Handling
68
-
69
- All tools return a standardized response:
70
- - Success: `{ content: [{type: "text", text: JSON}], metadata: {...} }`
71
- - Error: `{ content: [{type: "text", text: "❌ Storyblok: ..."}], isError: true }`
72
-
73
- Agents should check `isError` and display the error message to the user.
74
-
75
56
  ## Workflow Guides
76
57
 
77
58
  ### 1. Content Query
@@ -0,0 +1,3 @@
1
+ declare module "openclaw/plugin-sdk/plugin-entry" {
2
+ export function definePluginEntry(entry: unknown): unknown;
3
+ }
package/tsconfig.json CHANGED
@@ -13,6 +13,6 @@
13
13
  "declarationMap": true,
14
14
  "sourceMap": true
15
15
  },
16
- "include": ["index.ts", "src/**/*.ts"],
17
- "exclude": ["node_modules", "dist"]
16
+ "include": ["index.ts", "src/**/*.ts", "src/**/*.d.ts"],
17
+ "exclude": ["node_modules", "dist", "src/__tests__/**"]
18
18
  }