@the-smithy/hearth 0.13.0 → 0.13.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/README.md +20 -5
- package/llms.md +15 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,12 +9,15 @@ nothing without a Hearth account. Developer access is by invitation: request it
|
|
|
9
9
|
|
|
10
10
|
## Getting started
|
|
11
11
|
|
|
12
|
-
Most sites start from the starter template, which has this package set up already
|
|
12
|
+
Most sites start from the starter template, which has this package set up already. For example, for a site
|
|
13
|
+
whose address in Hearth is `acme` (the part after `/admin/sites/` in Hearth's address bar):
|
|
13
14
|
|
|
14
15
|
```sh
|
|
15
|
-
pnpm create @the-smithy/hearth-site
|
|
16
|
+
pnpm create @the-smithy/hearth-site@latest acme-website --site acme
|
|
16
17
|
```
|
|
17
18
|
|
|
19
|
+
`acme-website` is the folder it creates. Keep `@latest`: pnpm otherwise skips a release in its first day.
|
|
20
|
+
|
|
18
21
|
To add it to an existing project instead:
|
|
19
22
|
|
|
20
23
|
```sh
|
|
@@ -22,9 +25,9 @@ pnpm add @the-smithy/hearth
|
|
|
22
25
|
```
|
|
23
26
|
|
|
24
27
|
```dotenv
|
|
25
|
-
# .env.local
|
|
26
|
-
HEARTH_SITE
|
|
27
|
-
HEARTH_API_KEY
|
|
28
|
+
# .env.local (never committed)
|
|
29
|
+
HEARTH_SITE=acme
|
|
30
|
+
HEARTH_API_KEY=hk_… # Hearth → the site → Settings → Developers → API keys
|
|
28
31
|
```
|
|
29
32
|
|
|
30
33
|
```ts
|
|
@@ -37,6 +40,18 @@ export const hearth = createHearthClient({
|
|
|
37
40
|
});
|
|
38
41
|
```
|
|
39
42
|
|
|
43
|
+
## With an AI coding assistant
|
|
44
|
+
|
|
45
|
+
The package ships `llms.md`, a short reference written for coding agents: point yours at
|
|
46
|
+
`node_modules/@the-smithy/hearth/llms.md`. Once the key is in `.env.local`, the full API guide can be saved for
|
|
47
|
+
the agent too (sites made from the starter have `pnpm hearth:docs` for this):
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
curl -H "Authorization: Bearer $HEARTH_API_KEY" https://hearth.thesmithy.io/admin/docs/api.md -o hearth-api.md
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Keep `hearth-api.md` out of git, and the key out of chat: the agent only needs it in `.env.local`.
|
|
54
|
+
|
|
40
55
|
## Documentation
|
|
41
56
|
|
|
42
57
|
Once you have developer access, the full documentation (every method, Next.js helpers, rendering blocks,
|
package/llms.md
CHANGED
|
@@ -11,6 +11,21 @@ client components: the API key is secret.
|
|
|
11
11
|
`export const hearth = createHearthClient({ site: process.env.HEARTH_SITE!, apiKey: process.env.HEARTH_API_KEY! })`
|
|
12
12
|
`export const hearthNext = createHearthNext(hearth)` (from `@the-smithy/hearth/next`)
|
|
13
13
|
|
|
14
|
+
## Working with the developer (read first)
|
|
15
|
+
- Start by confirming the setup, and say what you found. In a site made from the starter: `pnpm hearth:check`
|
|
16
|
+
(connection, published pages, block types in use and any without a component). Elsewhere: call
|
|
17
|
+
`hearth.site.get()` and `hearth.pages.list()` from a server-side script.
|
|
18
|
+
- Full guide (every block's fields, events, forms, previews, SEO): `pnpm hearth:docs` in the starter, or
|
|
19
|
+
`GET https://hearth.thesmithy.io/admin/docs/api.md` with `Authorization: Bearer $HEARTH_API_KEY`. Save it to
|
|
20
|
+
a gitignored file and read the parts you need.
|
|
21
|
+
- Never print, log or commit the API key, and don't ask the developer to paste it into chat. Read it only from
|
|
22
|
+
env. If it's missing or rejected (`HearthError` code `unauthorized`), ask them to create one in Hearth → the
|
|
23
|
+
site → Settings → Developers → API keys and put it in `.env.local`.
|
|
24
|
+
- Only published content comes back. A new site whose pages are drafts returns no pages, so every route 404s:
|
|
25
|
+
that's expected. Tell the developer to publish in Hearth; never add placeholder content to the code.
|
|
26
|
+
- Content (text, menus, contact details, SEO) is edited in Hearth. The code owns design: tokens, layout and one
|
|
27
|
+
component per block type.
|
|
28
|
+
|
|
14
29
|
## Client (`@the-smithy/hearth`)
|
|
15
30
|
- `site.get(): Site`
|
|
16
31
|
- `pages.list(): PageSummary[]`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@the-smithy/hearth",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "Typed client for the Hearth Delivery API: content, SEO, forms and publish webhooks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"llms.md"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@the-smithy/hearth-schema": "^0.13.
|
|
48
|
+
"@the-smithy/hearth-schema": "^0.13.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"next": ">=15",
|