create-jant 0.3.46 → 0.3.48
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/dist/index.js +1 -1
- package/package.json +1 -1
- package/template/.agents/skills/building-jant-site/SKILL.md +2 -2
- package/template/.agents/skills/jant-http-api/SKILL.md +4 -25
- package/template/.agents/skills/jant-site-ops/SKILL.md +6 -6
- package/template/AGENTS.md +8 -12
- package/template/README.md +6 -6
- package/template/examples/agent-content-automation/README.md +31 -7
- package/template/examples/agent-content-automation/note.json +1 -1
- package/template/examples/agent-content-automation/site-settings.json +1 -1
- package/template/wrangler.toml +2 -2
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import path from "path";
|
|
|
9
9
|
import { fileURLToPath } from "url";
|
|
10
10
|
var __filename = fileURLToPath(import.meta.url);
|
|
11
11
|
var __dirname = path.dirname(__filename);
|
|
12
|
-
var CORE_VERSION = "0.3.
|
|
12
|
+
var CORE_VERSION = "0.3.48";
|
|
13
13
|
var WRANGLER_VERSION = "^4.76.0";
|
|
14
14
|
var TEMPLATE_DIR = fs.existsSync(path.resolve(__dirname, "../template")) ? path.resolve(__dirname, "../template") : path.resolve(__dirname, "../../../sites/demo");
|
|
15
15
|
function isValidProjectName(name) {
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ Do not patch `node_modules/@jant/core`.
|
|
|
23
23
|
|
|
24
24
|
If the change is product behavior that should apply to all Jant sites, make it in the Jant monorepo. If the change is site-specific, keep it in:
|
|
25
25
|
|
|
26
|
-
-
|
|
26
|
+
- the Settings page
|
|
27
27
|
- custom CSS
|
|
28
28
|
- site docs or helper scripts
|
|
29
29
|
- `wrangler.toml`
|
|
@@ -50,7 +50,7 @@ This already runs local migrations before starting Wrangler dev.
|
|
|
50
50
|
|
|
51
51
|
### 2. Pick the right customization layer
|
|
52
52
|
|
|
53
|
-
- Content or editorial defaults: use the
|
|
53
|
+
- Content or editorial defaults: use the Settings page or the HTTP API
|
|
54
54
|
- Theme and layout changes: use Settings plus custom CSS
|
|
55
55
|
- Deployment and runtime config: edit `wrangler.toml`
|
|
56
56
|
- One-off site behavior at the server edge: wrap `createApp()` in `index.js`
|
|
@@ -15,22 +15,6 @@ Use one of these:
|
|
|
15
15
|
- `Authorization: Bearer jnt_...` API token
|
|
16
16
|
- local `DEV_API_TOKEN` on localhost-style hosts
|
|
17
17
|
|
|
18
|
-
## Prefer Local CLI First
|
|
19
|
-
|
|
20
|
-
When you already have shell access to the site directory, prefer the built-in `jant` CLI for common automation:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npx jant posts list --limit 20
|
|
24
|
-
npx jant posts create --input ./post.json
|
|
25
|
-
npx jant media upload ./photo.webp --alt "Cover image"
|
|
26
|
-
npx jant media list --mimePrefix image/
|
|
27
|
-
npx jant collections add-post col_... pst_...
|
|
28
|
-
npx jant settings get
|
|
29
|
-
npx jant search "quiet design"
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
The CLI uses the same site URL and token model as the HTTP API.
|
|
33
|
-
|
|
34
18
|
## Built-in MCP
|
|
35
19
|
|
|
36
20
|
Jant also exposes a built-in MCP endpoint at `/api/mcp`.
|
|
@@ -39,7 +23,7 @@ Jant also exposes a built-in MCP endpoint at `/api/mcp`.
|
|
|
39
23
|
- tools: posts, media, collections, settings, and search
|
|
40
24
|
- protocol: streamable HTTP request/response shape with `initialize`, `tools/list`, and `tools/call`
|
|
41
25
|
|
|
42
|
-
Use MCP when the caller already speaks MCP. Use
|
|
26
|
+
Use MCP when the caller already speaks MCP. Use plain HTTP when you just need a direct script.
|
|
43
27
|
|
|
44
28
|
Generated sites also include worked examples in `examples/agent-content-automation/`.
|
|
45
29
|
|
|
@@ -104,24 +88,19 @@ curl -X PUT "$JANT_URL/api/posts/pst_..." \
|
|
|
104
88
|
|
|
105
89
|
## Uploads
|
|
106
90
|
|
|
107
|
-
For scripted clients, prefer the local CLI:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
npx jant media upload ./photo.webp --alt "Cover image"
|
|
111
|
-
```
|
|
112
|
-
|
|
113
91
|
For raw HTTP clients, use the recommended upload session flow:
|
|
114
92
|
|
|
115
93
|
1. `POST /api/uploads/init`
|
|
116
94
|
2. upload bytes to the returned transport
|
|
117
95
|
3. `POST /api/uploads/:id/complete`
|
|
118
96
|
|
|
119
|
-
For simple agent scripts, the legacy one-shot endpoint
|
|
97
|
+
For simple agent scripts, the legacy one-shot endpoint is easier:
|
|
120
98
|
|
|
121
99
|
```bash
|
|
122
100
|
curl -X POST "$JANT_URL/api/upload" \
|
|
123
101
|
-H "Authorization: Bearer $JANT_API_TOKEN" \
|
|
124
|
-
-F "file=@./photo.jpg"
|
|
102
|
+
-F "file=@./photo.jpg" \
|
|
103
|
+
-F "alt=Cover image"
|
|
125
104
|
```
|
|
126
105
|
|
|
127
106
|
Use the returned `med_*` ID inside a post attachment:
|
|
@@ -32,8 +32,8 @@ What they do:
|
|
|
32
32
|
```bash
|
|
33
33
|
npx jant migrate --local
|
|
34
34
|
npx jant migrate --remote --config ./wrangler.toml
|
|
35
|
-
npx jant site export --output ./jant-site-export.zip
|
|
36
|
-
npx jant site import --path ./jant-site-export.zip --dry-run
|
|
35
|
+
npx jant site export https://your-site.example --output ./jant-site-export.zip
|
|
36
|
+
npx jant site import https://your-site.example --path ./jant-site-export.zip --dry-run
|
|
37
37
|
npx jant site snapshot export --output ./jant-site-snapshot.zip
|
|
38
38
|
npx jant site snapshot import --path ./jant-site-snapshot.zip --replace
|
|
39
39
|
npx jant db export --output ./jant-export.sql
|
|
@@ -69,16 +69,16 @@ npx jant uploads cleanup --help
|
|
|
69
69
|
|
|
70
70
|
Use `assets prepare` when you need the publishable asset directory assembled locally.
|
|
71
71
|
|
|
72
|
-
##
|
|
72
|
+
## Authentication
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
`site export` and `site import` always target a deployed site URL and require an API token:
|
|
75
75
|
|
|
76
76
|
```bash
|
|
77
77
|
export JANT_API_TOKEN=jnt_your_token
|
|
78
|
-
npx jant site export
|
|
78
|
+
npx jant site export https://your-site.example --output ./jant-site-export.zip
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
For
|
|
81
|
+
For D1-oriented commands like snapshot export and `db export`, pass `--remote` and your Wrangler config when needed.
|
|
82
82
|
|
|
83
83
|
## Gotchas
|
|
84
84
|
|
package/template/AGENTS.md
CHANGED
|
@@ -11,11 +11,11 @@ This is a standalone Jant site created with `create-jant`.
|
|
|
11
11
|
|
|
12
12
|
Most customization happens through:
|
|
13
13
|
|
|
14
|
-
- site settings
|
|
14
|
+
- site settings from the Settings page
|
|
15
15
|
- custom CSS and theme variables
|
|
16
|
-
- HTTP API calls
|
|
17
|
-
- `jant` CLI commands for posts, collections, settings, search, export, import, migrate, and deploy
|
|
16
|
+
- HTTP API calls for content (posts, media, collections, settings, search)
|
|
18
17
|
- the built-in MCP endpoint at `/api/mcp` for remote agent tooling
|
|
18
|
+
- `jant` CLI commands for local-only ops: export, import, migrate, deploy, snapshot, reset-password
|
|
19
19
|
- examples in `examples/agent-content-automation/`
|
|
20
20
|
|
|
21
21
|
Do not edit `node_modules/@jant/core`. If you need reusable product changes, make them in the Jant monorepo instead.
|
|
@@ -29,16 +29,13 @@ npm run export
|
|
|
29
29
|
npm run reset-password
|
|
30
30
|
|
|
31
31
|
npx jant migrate --local
|
|
32
|
-
npx jant
|
|
33
|
-
npx jant
|
|
34
|
-
npx jant collections list
|
|
35
|
-
npx jant settings get
|
|
36
|
-
npx jant search "quiet design"
|
|
37
|
-
npx jant site export --output ./jant-site-export.zip
|
|
38
|
-
npx jant site import --path ./jant-site-export.zip --dry-run
|
|
32
|
+
npx jant site export https://your-site.example --output ./jant-site-export.zip
|
|
33
|
+
npx jant site import https://your-site.example --path ./jant-site-export.zip --dry-run
|
|
39
34
|
npx jant db export --output ./jant-export.sql
|
|
40
35
|
```
|
|
41
36
|
|
|
37
|
+
Content automation (posts, media, collections, settings, search) goes through the HTTP API or `/api/mcp`. See `.agents/skills/jant-http-api/SKILL.md` and `examples/agent-content-automation/`.
|
|
38
|
+
|
|
42
39
|
Use `npm run deploy` for normal Cloudflare deploys. It applies remote migrations and prepares assets before calling Wrangler.
|
|
43
40
|
|
|
44
41
|
## Skills
|
|
@@ -53,8 +50,7 @@ Load the matching skill before making substantive changes:
|
|
|
53
50
|
|
|
54
51
|
- Keep `index.js` minimal unless the site truly needs custom server behavior.
|
|
55
52
|
- Prefer settings, custom CSS, and documented extension points before changing runtime code.
|
|
56
|
-
-
|
|
57
|
-
- Use `npx jant media` for file uploads, media listing, text attachment reads, alt updates, and deletes.
|
|
53
|
+
- Use the HTTP API (`/api/posts`, `/api/upload`, `/api/collections`, `/api/settings`, `/api/search`) for scripted content automation. The CLI no longer covers content — those commands were removed because they were thin HTTP wrappers.
|
|
58
54
|
- Use `/api/mcp` when an MCP client is available and you need the site to expose posts, collections, settings, or search as tools.
|
|
59
55
|
- Start from `examples/agent-content-automation/README.md` if the task is content automation rather than app development.
|
|
60
56
|
- Use `bodyMarkdown` in API scripts instead of raw TipTap JSON unless you already have trusted editor output.
|
package/template/README.md
CHANGED
|
@@ -105,12 +105,12 @@ Open `http://localhost:3000`.
|
|
|
105
105
|
|
|
106
106
|
## Common Commands
|
|
107
107
|
|
|
108
|
-
| Command
|
|
109
|
-
|
|
|
110
|
-
| `npm run dev`
|
|
111
|
-
| `npm run deploy`
|
|
112
|
-
| `npm run reset-password`
|
|
113
|
-
| `npx jant site export --output ./jant-site-export.zip` | Export the site as a portable archive |
|
|
108
|
+
| Command | Description |
|
|
109
|
+
| -------------------------------------------------------------------------------- | ------------------------------------- |
|
|
110
|
+
| `npm run dev` | Start local development |
|
|
111
|
+
| `npm run deploy` | Apply remote migrations and deploy |
|
|
112
|
+
| `npm run reset-password` | Generate a password reset token |
|
|
113
|
+
| `npx jant site export https://your-site.example --output ./jant-site-export.zip` | Export the site as a portable archive |
|
|
114
114
|
|
|
115
115
|
## Configuration
|
|
116
116
|
|
|
@@ -2,24 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
This folder shows the shortest path for content automation in a generated Jant site.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
All content operations go through the HTTP API. Use MCP (`/api/mcp`) only when the caller already speaks MCP.
|
|
6
|
+
|
|
7
|
+
Set these once:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
export JANT_URL="https://your-site.example"
|
|
11
|
+
export JANT_API_TOKEN="jnt_..."
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
For local development, `JANT_URL=http://localhost:8787` and `JANT_API_TOKEN=$DEV_API_TOKEN`.
|
|
6
15
|
|
|
7
16
|
## Publish a note from JSON
|
|
8
17
|
|
|
9
18
|
```bash
|
|
10
|
-
|
|
19
|
+
curl -X POST "$JANT_URL/api/posts" \
|
|
20
|
+
-H "Authorization: Bearer $JANT_API_TOKEN" \
|
|
21
|
+
-H "Content-Type: application/json" \
|
|
22
|
+
-d @./examples/agent-content-automation/note.json
|
|
11
23
|
```
|
|
12
24
|
|
|
13
25
|
## Publish a quote from JSON
|
|
14
26
|
|
|
15
27
|
```bash
|
|
16
|
-
|
|
28
|
+
curl -X POST "$JANT_URL/api/posts" \
|
|
29
|
+
-H "Authorization: Bearer $JANT_API_TOKEN" \
|
|
30
|
+
-H "Content-Type: application/json" \
|
|
31
|
+
-d @./examples/agent-content-automation/quote.json
|
|
17
32
|
```
|
|
18
33
|
|
|
19
34
|
## Update site settings from JSON
|
|
20
35
|
|
|
21
36
|
```bash
|
|
22
|
-
|
|
37
|
+
curl -X PUT "$JANT_URL/api/settings" \
|
|
38
|
+
-H "Authorization: Bearer $JANT_API_TOKEN" \
|
|
39
|
+
-H "Content-Type: application/json" \
|
|
40
|
+
-d @./examples/agent-content-automation/site-settings.json
|
|
23
41
|
```
|
|
24
42
|
|
|
25
43
|
## Upload an image, then attach it to a post
|
|
@@ -27,7 +45,10 @@ npx jant settings update --input ./examples/agent-content-automation/site-settin
|
|
|
27
45
|
Upload the file:
|
|
28
46
|
|
|
29
47
|
```bash
|
|
30
|
-
|
|
48
|
+
curl -X POST "$JANT_URL/api/upload" \
|
|
49
|
+
-H "Authorization: Bearer $JANT_API_TOKEN" \
|
|
50
|
+
-F "file=@./path/to/photo.webp" \
|
|
51
|
+
-F "alt=Cover image"
|
|
31
52
|
```
|
|
32
53
|
|
|
33
54
|
That returns a `med_*` ID. Use it in a post payload:
|
|
@@ -36,7 +57,7 @@ That returns a `med_*` ID. Use it in a post payload:
|
|
|
36
57
|
{
|
|
37
58
|
"format": "note",
|
|
38
59
|
"title": "A post with media",
|
|
39
|
-
"bodyMarkdown": "Uploaded through the
|
|
60
|
+
"bodyMarkdown": "Uploaded through the HTTP API.",
|
|
40
61
|
"status": "published",
|
|
41
62
|
"visibility": "public",
|
|
42
63
|
"attachments": [{ "type": "media", "mediaId": "med_..." }]
|
|
@@ -46,7 +67,10 @@ That returns a `med_*` ID. Use it in a post payload:
|
|
|
46
67
|
Then publish it:
|
|
47
68
|
|
|
48
69
|
```bash
|
|
49
|
-
|
|
70
|
+
curl -X POST "$JANT_URL/api/posts" \
|
|
71
|
+
-H "Authorization: Bearer $JANT_API_TOKEN" \
|
|
72
|
+
-H "Content-Type: application/json" \
|
|
73
|
+
-d '{"format":"note","title":"A post with media","bodyMarkdown":"Uploaded through the HTTP API.","status":"published","visibility":"public","attachments":[{"type":"media","mediaId":"med_..."}]}'
|
|
50
74
|
```
|
|
51
75
|
|
|
52
76
|
## Inline text attachments stay in the post payload
|
package/template/wrangler.toml
CHANGED
|
@@ -29,8 +29,8 @@ SITE_ORIGIN = "https://demo.jant.me" # @create-jant: @remove
|
|
|
29
29
|
# SITE_PATH_PREFIX = "/blog"
|
|
30
30
|
|
|
31
31
|
# Optional: Site configuration
|
|
32
|
-
# You can also set these
|
|
33
|
-
# https://github.com/jant-me/jant/blob/main/docs/configuration.md#
|
|
32
|
+
# You can also set these from the Settings page at /settings
|
|
33
|
+
# https://github.com/jant-me/jant/blob/main/docs/configuration.md#settings-page
|
|
34
34
|
# SITE_NAME = "My Blog"
|
|
35
35
|
# SITE_DESCRIPTION = "A personal blog powered by Jant"
|
|
36
36
|
# SITE_LANGUAGE = "en"
|