@kvasar/openclaw-storyblok-plugin 0.1.0
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/README.md +58 -0
- package/openclaw.plugin.json +50 -0
- package/package.json +44 -0
- package/src/__tests__/README.md +115 -0
- package/src/__tests__/openclaw.plugin.json +30 -0
- package/src/__tests__/package-lock.json +1555 -0
- package/src/__tests__/package.json +22 -0
- package/src/__tests__/storyblok.test.ts +55 -0
- package/src/__tests__/tsconfig.json +19 -0
- package/src/client.ts +176 -0
- package/src/config.ts +35 -0
- package/src/index.ts +228 -0
- package/tsconfig.json +18 -0
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# OpenClaw Storyblok Plugin
|
|
2
|
+
|
|
3
|
+
This plugin integrates OpenClaw with Storyblok CMS, exposing tools to manage stories, components, and space information.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Retrieve story by ID or UUID
|
|
8
|
+
- List stories with filters (folder, status, etc.)
|
|
9
|
+
- Create new stories
|
|
10
|
+
- Update existing stories
|
|
11
|
+
- Publish/unpublish stories
|
|
12
|
+
- Get component definitions (schema)
|
|
13
|
+
- Get space details
|
|
14
|
+
|
|
15
|
+
## Configuration
|
|
16
|
+
|
|
17
|
+
When adding this plugin to an OpenClaw agent, provide the following configuration:
|
|
18
|
+
|
|
19
|
+
| Parameter | Description |
|
|
20
|
+
|-----------|-------------|
|
|
21
|
+
| `baseUrl` | Storyblok API base URL (default: `https://api.storyblok.com`) |
|
|
22
|
+
| `spaceId` | Your Storyblok space ID (numeric) |
|
|
23
|
+
| `managementToken` | Management API token for write operations |
|
|
24
|
+
| `previewToken` | (Optional) Preview/Delivery token for read-only access |
|
|
25
|
+
|
|
26
|
+
Tokens can be generated in your Storyblok dashboard under **Settings > API**.
|
|
27
|
+
|
|
28
|
+
## Tools
|
|
29
|
+
|
|
30
|
+
All tools are namespaced with `storyblok_`. See tool descriptions in the agent for detailed parameters.
|
|
31
|
+
|
|
32
|
+
### Story operations
|
|
33
|
+
- `storyblok_get_story` – Retrieve a story by ID or UUID
|
|
34
|
+
- `storyblok_list_stories` – List stories with optional filters
|
|
35
|
+
- `storyblok_create_story` – Create a new story draft
|
|
36
|
+
- `storyblok_update_story` – Update a story (draft or published)
|
|
37
|
+
- `storyblok_publish_story` – Publish a story (optionally with version note)
|
|
38
|
+
- `storyblok_unpublish_story` – Unpublish a story
|
|
39
|
+
|
|
40
|
+
### Components & Space
|
|
41
|
+
- `storyblok_get_components` – List component definitions (schema)
|
|
42
|
+
- `storyblok_get_space` – Retrieve space information
|
|
43
|
+
|
|
44
|
+
## Development
|
|
45
|
+
|
|
46
|
+
This plugin is written in TypeScript. Build and test:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm install
|
|
50
|
+
npm run check
|
|
51
|
+
npm run build
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Notes
|
|
55
|
+
|
|
56
|
+
- Management token is required for write operations and can also be used for reads if preview token is omitted.
|
|
57
|
+
- Use preview token for read-only scenarios to limit exposure.
|
|
58
|
+
- The plugin supports both Management API (v1) and Delivery API (v2) as appropriate.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "openclaw-storyblok",
|
|
3
|
+
"kind": "tool",
|
|
4
|
+
"name": "Storyblok Integration",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"description": "Provides tools to interact with Storyblok CMS via Management API and Delivery API. Supports stories, components, and space management.",
|
|
7
|
+
"configSchema": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"properties": {
|
|
11
|
+
"baseUrl": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "Storyblok API base URL (e.g., https://api.storyblok.com or your custom domain). Usually https://api.storyblok.com for Management API."
|
|
14
|
+
},
|
|
15
|
+
"spaceId": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "Storyblok space ID (numeric)."
|
|
18
|
+
},
|
|
19
|
+
"managementToken": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Storyblok Management API token (for write operations)."
|
|
22
|
+
},
|
|
23
|
+
"previewToken": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "Storyblok Preview/Delivery token (for read-only operations). Optional if only using management token for reads."
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": ["baseUrl", "spaceId", "managementToken"]
|
|
29
|
+
},
|
|
30
|
+
"uiHints": {
|
|
31
|
+
"baseUrl": {
|
|
32
|
+
"label": "API Base URL",
|
|
33
|
+
"placeholder": "https://api.storyblok.com"
|
|
34
|
+
},
|
|
35
|
+
"spaceId": {
|
|
36
|
+
"label": "Space ID",
|
|
37
|
+
"placeholder": "12345"
|
|
38
|
+
},
|
|
39
|
+
"managementToken": {
|
|
40
|
+
"label": "Management Token",
|
|
41
|
+
"placeholder": "your_management_token",
|
|
42
|
+
"sensitive": true
|
|
43
|
+
},
|
|
44
|
+
"previewToken": {
|
|
45
|
+
"label": "Preview Token",
|
|
46
|
+
"placeholder": "your_preview_token",
|
|
47
|
+
"sensitive": true
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kvasar/openclaw-storyblok-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OpenClaw plugin — interact with Storyblok CMS via Management API and Delivery API",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"index.ts",
|
|
9
|
+
"src/",
|
|
10
|
+
"openclaw.plugin.json",
|
|
11
|
+
"tsconfig.json",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"typecheck": "tsc --noEmit",
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"test:watch": "vitest",
|
|
19
|
+
"check": "tsc --noEmit && vitest run"
|
|
20
|
+
},
|
|
21
|
+
"openclaw": {
|
|
22
|
+
"extensions": ["./index.ts"],
|
|
23
|
+
"tools": [
|
|
24
|
+
"storyblok_get_space",
|
|
25
|
+
"storyblok_get_story",
|
|
26
|
+
"storyblok_list_stories",
|
|
27
|
+
"storyblok_create_story",
|
|
28
|
+
"storyblok_update_story",
|
|
29
|
+
"storyblok_publish_story",
|
|
30
|
+
"storyblok_unpublish_story",
|
|
31
|
+
"storyblok_get_components"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@sinclair/typebox": "^0.32.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"typescript": "^5.4.0",
|
|
39
|
+
"@types/node": "^22.0.0",
|
|
40
|
+
"vitest": "^1.6.0"
|
|
41
|
+
},
|
|
42
|
+
"keywords": ["openclaw", "plugin", "storyblok", "cms"],
|
|
43
|
+
"license": "MIT"
|
|
44
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Storyblok Plugin (thin client) — OpenClaw
|
|
2
|
+
|
|
3
|
+
Thin‑client OpenClaw plugin that calls an external REST service to generate Storyblok pages via AI.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### 1. Clone the plugin repository
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
git clone git@bitbucket.org:scaledagilequa/openclaw-storyblok-plugin.git
|
|
11
|
+
cd openclaw-storyblok-plugin
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### 2. Install dependencies
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 3. Build the plugin
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm run build
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 4. Configure OpenClaw
|
|
27
|
+
|
|
28
|
+
Add the plugin to your OpenClaw configuration (`~/.openclaw/config.yaml` or equivalent):
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
plugins:
|
|
32
|
+
- id: storyblok
|
|
33
|
+
config:
|
|
34
|
+
serviceUrl: "http://localhost:8000" # base URL of your Storyblok AI service
|
|
35
|
+
apiKey: "optional-key" # optional API key for the service
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 5. Restart OpenClaw
|
|
39
|
+
|
|
40
|
+
Restart OpenClaw (or reload plugins) to activate the new plugin.
|
|
41
|
+
|
|
42
|
+
## Plugin Configuration
|
|
43
|
+
|
|
44
|
+
| Key | Type | Required | Default | Description |
|
|
45
|
+
|-----|------|----------|---------|-------------|
|
|
46
|
+
| `serviceUrl` | string | Yes | `http://localhost:8000` | Base URL of the Storyblok AI service (must be reachable from OpenClaw). |
|
|
47
|
+
| `apiKey` | string | No | – | Optional API key if the service requires authentication. |
|
|
48
|
+
|
|
49
|
+
## Tool
|
|
50
|
+
|
|
51
|
+
### `storyblok_generate_page`
|
|
52
|
+
|
|
53
|
+
Generates a Storyblok page by sending a prompt to the external AI service.
|
|
54
|
+
|
|
55
|
+
**Parameters:**
|
|
56
|
+
|
|
57
|
+
| Parameter | Type | Description |
|
|
58
|
+
|-----------|------|-------------|
|
|
59
|
+
| `prompt` | string | Description of the page you want to generate. |
|
|
60
|
+
|
|
61
|
+
**Example usage (in OpenClaw chat):**
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
@assistant storyblok_generate_page prompt="Landing page for an AI consulting company"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Response:**
|
|
68
|
+
|
|
69
|
+
Returns the JSON response from the external service (typically containing the created story details).
|
|
70
|
+
|
|
71
|
+
## Development
|
|
72
|
+
|
|
73
|
+
### Prerequisites
|
|
74
|
+
|
|
75
|
+
- Node.js 18+
|
|
76
|
+
- npm or yarn
|
|
77
|
+
|
|
78
|
+
### Building
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npm run build
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Testing
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm test
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Type Checking
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npm run typecheck
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Architecture
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
openclaw-storyblok-plugin/
|
|
100
|
+
├── src/
|
|
101
|
+
│ └── index.ts # Plugin entry point (registers the tool)
|
|
102
|
+
├── openclaw.plugin.json # Plugin manifest
|
|
103
|
+
├── package.json # Dependencies and scripts
|
|
104
|
+
└── tsconfig.json # TypeScript configuration
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The plugin uses `node-fetch` to call the external REST service. It is designed to be a thin client—all business logic resides in the separate Storyblok AI service.
|
|
108
|
+
|
|
109
|
+
## Related Projects
|
|
110
|
+
|
|
111
|
+
- **Storyblok AI Service**: Python FastAPI service that does the actual LLM generation and Storyblok integration. Available at `git@bitbucket.org:scaledagilequa/openclaw-storyblok.git`.
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
MIT
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://openclaw.ai/schema/openclaw.plugin.v1.json",
|
|
3
|
+
"id": "storyblok",
|
|
4
|
+
"name": "Storyblok",
|
|
5
|
+
"description": "Thin‑client plugin for Storyblok AI page generation (calls external REST service)",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"config": {
|
|
8
|
+
"serviceUrl": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "Base URL of the Storyblok AI service (e.g., http://localhost:8000)",
|
|
11
|
+
"required": true,
|
|
12
|
+
"default": "http://localhost:8000"
|
|
13
|
+
},
|
|
14
|
+
"apiKey": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "Optional API key for the service (if required)",
|
|
17
|
+
"secret": true,
|
|
18
|
+
"required": false
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"tools": [
|
|
22
|
+
{
|
|
23
|
+
"name": "storyblok_generate_page",
|
|
24
|
+
"description": "Generate a Storyblok page via AI using the external service",
|
|
25
|
+
"parameters": {
|
|
26
|
+
"prompt": { "type": "string", "description": "Description of the page you want to generate" }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|