@craftware/crafty-sdk 0.2.0 → 0.2.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/package.json +1 -1
- package/skills/crafty-cms/SKILL.md +28 -0
package/package.json
CHANGED
|
@@ -89,6 +89,33 @@ const posts = await crafty.entries.list("posts", { per_page: 15 });
|
|
|
89
89
|
|
|
90
90
|
`pages.get()` returns the page enriched with block helpers (`page.block(type)`, `page.blocksOf(type)`, `page.byType`, …). **Full client config, every resource and return shape, block helpers, errors, and an end-to-end example: read `references/sdk-development.md`.**
|
|
91
91
|
|
|
92
|
+
## Phase 3 — Deploy a static site with the CLI
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npm install -D @craftware/crafty-cli
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Add to `.env` (the CLI reads this at deploy time, separate from `VITE_*` vars):
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
CRAFTY_API_URL=https://<your-tenant>.crafty.do/api/v1
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Add `crafty.json` at the project root:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{ "site": "<site-slug>", "environment": "production", "buildDir": "dist" }
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Then build and deploy:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm run build # produces dist/
|
|
114
|
+
crafty deploy # uploads dist/ to the configured environment
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
> `crafty.json` is safe to commit. `.env` (which contains your API key) must be gitignored — use `.env.example` with placeholder values.
|
|
118
|
+
|
|
92
119
|
## Key distinction: MCP auth vs SDK API key
|
|
93
120
|
|
|
94
121
|
These are two different credentials — do not mix them:
|
|
@@ -102,6 +129,7 @@ These are two different credentials — do not mix them:
|
|
|
102
129
|
- **401 from the MCP server** → the Bearer token is missing, invalid, or expired; reconnect or regenerate it.
|
|
103
130
|
- **A tool is missing or fails with "Insufficient OAuth scope"** → the token lacks that tool's scope; re-issue it with `crafty:write` / `crafty:publish` / `crafty:submissions` as needed.
|
|
104
131
|
- **`forms.submit()` throws `BAD_REQUEST`** → `siteSlug` was not set in `createCraftyClient()`. Submissions hit the public endpoint and deliberately omit the API key.
|
|
132
|
+
- **`update_entry` / `update_page` wipe fields you don't send** → both MCP tools do a **full replace**, not a merge. If you send only the new fields, all existing fields are deleted in that revision. Always fetch the current entry first (`get_entry`), merge your changes into the full field map, then call `update_entry` with the complete merged object.
|
|
105
133
|
- **Content not visible via the SDK** → it isn't published. Pages/forms must be published (`publish_page` / `publish_form`).
|
|
106
134
|
- **Confusing the two tokens** → the SDK `apiKey` (X-API-Key) is not an MCP Bearer token.
|
|
107
135
|
|