siteplane 0.1.68 → 0.2.0-next.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 CHANGED
@@ -1,9 +1,60 @@
1
1
  # siteplane
2
2
 
3
- Siteplane for Next.js websites: `withSiteplane` for `next.config` and the `siteplane` command for Booking.
3
+ Siteplane for Next.js websites (App Router, Next 15 and 16): content you can edit in Siteplane with the current
4
+ content as fallback in your code, a Draft Mode preview for the editor, Booking and the `siteplane` CLI.
4
5
 
5
- The website connection for content editing returns with the new agent connection (`npx siteplane@latest init`).
6
- Until then this package serves Booking.
6
+ ## Connect a website
7
+
8
+ Run this in the website's folder, or tell your coding agent "Install Siteplane":
9
+
10
+ ```bash
11
+ npx siteplane@next init
12
+ ```
13
+
14
+ Version 0.2 is on the `next` tag until it becomes `latest`.
15
+
16
+ `init` opens the approval page in the browser. There you sign up or sign in, create the website in Siteplane or pick
17
+ an existing one, and click Connect. If you created the website in Siteplane first, its prompt names the site:
18
+ `npx siteplane@<version> init --site <site ID>`.
19
+
20
+ `init` then writes `siteplane.config.json`, installs this package, wraps `next.config` in `withSiteplane`, adds the
21
+ route `app/api/siteplane/[...siteplane]/route.ts` and `<SiteplaneBridge />`, and prints the task for the agent.
22
+ Siteplane needs no environment variables or secrets in your project.
23
+
24
+ ## Field API
25
+
26
+ ```tsx
27
+ import { siteplane } from "siteplane";
28
+
29
+ const title = await siteplane.text("home.hero.title", "Fresh rolls since 1920");
30
+
31
+ <h1 {...siteplane.attrs("home.hero.title")}>{title}</h1>;
32
+ ```
33
+
34
+ Types: `text`, `longText`, `link` (`{ href, label }`) and `image` (`{ src, alt }`). Values load once per request and
35
+ are cached for 60 seconds; without Siteplane the fallbacks render.
36
+
37
+ ## Commands
38
+
39
+ ```bash
40
+ npx siteplane task # the task for the agent
41
+ npx siteplane check # checks the fields in the code
42
+ npx siteplane sync # checks and reports the fields to Siteplane
43
+ npx siteplane status --url <address> # checks a deployed address
44
+ ```
45
+
46
+ Optional display names for new fields go into `siteplane.labels.json` (`{ "home.hero.title": "Hero headline" }`).
47
+
48
+ A website with `basePath` in `next.config` needs no extra setup. Check it with the base path in the address
49
+ (`npx siteplane status --url https://www.example.com/docs`); Siteplane saves that address as the website URL and
50
+ reaches the website below it.
51
+
52
+ ## Analytics
53
+
54
+ With Analytics on for the site, `init` also adds `<SiteplaneAnalytics siteId="…" />` to the root layout. It counts
55
+ page views, App Router navigations and clicks on elements with `data-siteplane-event="<name>"`, on links to other
56
+ websites, phone numbers and email addresses. It sets no cookies and uses no browser storage; Siteplane counts visitors
57
+ per day on its server. Development builds and the editor's preview send nothing.
7
58
 
8
59
  ## Booking
9
60
 
@@ -13,10 +64,7 @@ export default withSiteplane(nextConfig, { booking: { site: "<immutable-site-id>
13
64
  ```
14
65
 
15
66
  The wrapper adds `/booking/:path*` as a `beforeFiles` rewrite to Siteplane and preserves existing rewrite sections.
16
- Booking never runs the Editor scanner or headers, even when `siteplane.config.json` exists. Use
17
- `<a href="/booking">` instead of `next/link`; exclude this path from customer middleware. Configure the public booking
18
- address in Siteplane and permit Siteplane/Stripe assets and connections in the customer CSP. `siteplane booking check`
19
- verifies the Site ID in `next.config.*`. The public API uses Site ID plus allowed Origin; no raw Booking key is needed.
67
+ Use `<a href="/booking">` instead of `next/link`; exclude this path from customer middleware.
20
68
 
21
69
  ```bash
22
70
  npx siteplane booking init
@@ -25,18 +73,7 @@ npx siteplane booking sync
25
73
  npx siteplane booking test
26
74
  ```
27
75
 
28
- `siteplane booking sync` and `siteplane booking test` read the Site ID from `siteplane.booking.json`. The first run
29
- prints a link and a code and opens the Siteplane approval page, like `gh auth login`; an owner or admin of the website
30
- checks the code and clicks **Connect**. The agent connection is stored in the user config directory
31
- (`$SITEPLANE_CONFIG_DIR`, `$XDG_CONFIG_HOME/siteplane`, `%APPDATA%\siteplane` or `~/.config/siteplane`), never in the
32
- project. Agents without a browser pass the link and code to the user; `--no-browser` skips opening it. A revoked or
33
- expired connection leads through one new approval.
34
-
35
- ## Image policy
36
-
37
- When the scan includes image fields, `withSiteplane` prepares Next Image and existing Next-config CSP headers for
38
- Siteplane's image route and your website's `/siteplane-assets/` path. Existing image sources stay in place. Builds
39
- that serve Siteplane images from the website set `SITEPLANE_SITE_ORIGIN` to the exact public HTTPS website origin;
40
- local fallback-image builds can omit it. The wrapper adds only those exact patterns: existing sources, custom loaders
41
- and redirect settings remain unchanged. Keep existing policies and verify Siteplane images through the website's
42
- actual renderer. This preparation does not authorize hosting.
76
+ `booking sync` and `booking test` read the Site ID from `siteplane.booking.json` and connect through the same browser
77
+ approval. The agent connection is stored in the user config directory (`$SITEPLANE_CONFIG_DIR`,
78
+ `$XDG_CONFIG_HOME/siteplane`, `%APPDATA%\siteplane` or `~/.config/siteplane`), never in the project; `--no-browser`
79
+ skips opening the browser.