siteplane 0.1.67 → 0.2.0-next.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 CHANGED
@@ -1,151 +1,55 @@
1
1
  # siteplane
2
2
 
3
- **Image-policy preparation:** When the scan includes image fields, `withSiteplane` prepares
4
- Next Image and existing Next-config CSP headers for Siteplane's image route and your website's
5
- `/siteplane-assets/` path. Existing image sources stay in place. Local builds require the same public HTTPS
6
- `SITEPLANE_SITE_ORIGIN` supplied by `setup deploy`. The wrapper adds only those exact patterns: existing
7
- sources, custom loaders and redirect settings remain unchanged. Preflight still flags custom loaders and CSP
8
- in middleware, proxy or app source for explicit delivery checks. Keep existing policies and verify Siteplane
9
- images through the website's actual renderer. This preparation does not authorize hosting.
10
-
11
- Public Siteplane CLI for connected-site setup, field synchronization, Analytics
12
- instrumentation and Booking integration.
13
-
14
- ## Controlled guest review
15
-
16
- After a controlled accountless setup reaches `ready_for_review`, run `siteplane setup review`
17
- in the same website repository. Its protected local installation key opens access to that project's
18
- saved review without creating another site or deployment. Give the one-time link to the user;
19
- they choose **Open review** in their own browser. Do not consume the link on their behalf.
20
- Issue a fresh link only when needed. The URL fragment is a short-lived credential, so do not
21
- write it to source, documentation, analytics or shared logs. Guest review can organize and finish
22
- the setup; activation and account ownership require the later claim step. This entry remains
23
- controlled by the existing beta and launch gates.
24
-
25
- ### Controlled claim confirmation
26
-
27
- When the signed-in review supplies a claim code, run `siteplane setup claim inspect --code <code>`
28
- in the original repository. Show the returned account, workspace and website to the user. After
29
- they explicitly approve that concrete request, run `siteplane setup claim confirm --code <code>
30
- --request <requestId>`. Inspection never confirms automatically. A code alone cannot claim a website;
31
- the command also requires the original local installation key.
32
-
33
- Confirmation saves the receipt in the ignored local credentials file before acknowledging it to
34
- the server. If the response is lost, retry the same code and request. Keep the existing project,
35
- connection and deployment. Claim revokes guest access and preserves only the still-open setup rights;
36
- it does not activate modules or reopen a finished setup. The browser Auth/claim flow is still under
37
- development, and the general accountless entry remains closed.
38
-
39
- ## Initial setup
40
-
41
- Copy the setup prompt in Siteplane, then run its exact one-time command in the
42
- website repository:
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.
43
5
 
44
- ```bash
45
- npx -y siteplane@<exact-version> setup preflight
46
- npx -y siteplane@<exact-version> init --setup-token <one-time-setup-grant>
47
- npx siteplane setup context
48
- ```
6
+ ## Connect a website
49
7
 
50
- `init` exchanges the short-lived grant for the run-bound Project Connection and
51
- stores it only in the ignored `.siteplane/credentials.json`. No browser approval
52
- is required. The same connection resumes the open setup and review corrections
53
- until the owner completes or revokes the setup.
54
-
55
- `setup context` returns the single `siteplane.setup-task.v2` task: exact packages, current run,
56
- authorized modules/scopes, separate unchanged user instructions, environment provenance and one next action.
57
- An initial instruction such as `Only prices` does not start a correction workflow. The agent integrates
58
- Siteplane's existing CMS editing layer, preserving the website; it does not build a separate CMS.
59
-
60
- Report observed work with `siteplane setup activity --phase inspecting` (also integrating, deploying,
61
- verifying or repairing). Reports are limited to one per 30 seconds; context polling is not activity.
62
- Optional Analytics preparation uses this same connection with explicit authorization. It grants no
63
- activation, import, reporting, booking or publishing rights. Standalone bootstrap cannot replace an open task.
64
-
65
- `setup prepare` installs the task's exact packages and creates the narrow official runtime integration.
66
- The agent chooses and instruments content, then persists a separate, bounded summary:
67
-
68
- For a direct field ID, put `siteplane.attrs(fieldId, { routeKey })` on the visible
69
- element using the same canonical route pattern as its value call. The value call
70
- does not attach DOM metadata. Missing or mismatched DOM routes block apply and
71
- the Next build; dynamic pages use their pattern, such as `/services/[slug]`.
72
- Direct attrs defaults to `fieldType: "text"`; for longText, link and image,
73
- pass the matching `fieldType` explicitly. The value call does not infer it for attrs.
74
- `setup apply` reports `field_scan.attrs_field_type_mismatch` before any contract write.
75
- This type diagnostic remains a scanner warning for normal website builds.
8
+ Run this in the website's folder, or tell your coding agent "Install Siteplane":
76
9
 
77
10
  ```bash
78
- siteplane setup apply --definition editor-definition.json --selection-summary-file selection.txt
79
- siteplane setup deploy --wait
11
+ npx siteplane@next init
80
12
  ```
81
13
 
82
- Commit only intended source before deploy. The CLI securely transfers its Production environment, adopts or
83
- starts one matching deployment and verifies the actual build and signed runtime. Unchanged resume creates no
84
- new deployment. If the linked project has multiple verified, non-redirecting Production domains, select the
85
- canonical one on the first run with `siteplane setup deploy --wait --production-origin <https-origin>`. The CLI
86
- rejects foreign, redirect, branch and unverified domains, stores the binding and reuses it on resume. A saved
87
- 15-minute provider deadline and operation identity prevent blind retries after response
88
- loss. If that deadline expires after the deploy was requested, rerun the same command: each invocation gets a
89
- bounded 120-second readback of that same operation. A ready result is adopted; a still-running or unreachable
90
- provider remains resumable and never authorizes a second deploy. Uploads use committed source in a temporary
91
- checkout; local credentials are never copied into it.
92
-
93
- For a lost connection, the owner chooses **Replace local connection** in the same open setup. Its new grant
94
- preserves the Site, Run, runtime key, revalidation generation, selected fields and provider admin-session secret.
95
- Completed setup credentials remain closed. Known package/workspace/provider conflicts are diagnosed before
96
- writes; support ranges do not trigger automatic framework or package-manager upgrades.
97
-
98
- ## Accountless start
14
+ Version 0.2 is on the `next` tag until it becomes `latest`.
99
15
 
100
- Use `setup start` for an explicit user request to integrate a website before creating an account.
101
- Save the user's exact editing instructions in a text file and pass `--instructions-file`; inline
102
- `--instructions` is not supported. Omit the file only when the user asks the agent to choose.
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>`.
103
19
 
104
- Before starting, add `.siteplane/credentials.json` to the repository’s `.gitignore`. Start rejects tracked or
105
- unprotected credentials before any provisioning request.
106
-
107
- ```bash
108
- npx -y siteplane@0.1.61 setup start --modules editing --instructions-file instructions.txt
109
- npx -y siteplane@0.1.61 setup context
110
- ```
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.
111
23
 
112
- Start performs read-only preflight and saves the installation key and original request privately before the
113
- first provisioning call. Select `editing,analytics` only when explicitly requested. Retry in the same directory
114
- with the same request after interruption; configuration without credentials produces a diagnosis, never a silent
115
- replacement project. The returned task carries the provisional assignment and deadline. After verification,
116
- `setup review` opens the saved guest review. The user can create an account or sign in from that review;
117
- inspect and confirm only their concrete claim request in this repository. Claim preserves the review and
118
- returns it to the owner's account; it does not activate editing or analytics.
24
+ ## Field API
119
25
 
120
- ## Approved fields
26
+ ```tsx
27
+ import { siteplane } from "siteplane";
121
28
 
122
- Run the exact command from Siteplane's compact apply prompt. It authenticates
123
- with the local Project Connection and reads the approved snapshot without asking
124
- the user to paste its JSON:
29
+ const title = await siteplane.text("home.hero.title", "Fresh rolls since 1920");
125
30
 
126
- ```bash
127
- siteplane setup fields apply-context --plan-id <plan-id> --snapshot-hash <sha256>
128
- siteplane setup fields apply-context --plan-id <plan-id> --snapshot-hash <sha256> --route / --offset 0
31
+ <h1 {...siteplane.attrs("home.hero.title")}>{title}</h1>;
129
32
  ```
130
33
 
131
- The first call returns route counts. Route calls return at most 25 approved fields
132
- and a `nextOffset`; continue until it is `null`.
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.
133
36
 
134
- ## Analytics
37
+ ## Commands
135
38
 
136
39
  ```bash
137
- siteplane analytics init --agent-client codex
138
- siteplane analytics check
139
- siteplane analytics sync
140
- siteplane analytics test --page-url https://example.com
141
- siteplane analytics import --file provider-export.json
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
142
44
  ```
143
45
 
144
- Analytics commands reuse `siteplane.config.json` and the untracked
145
- `.siteplane/credentials.json` Project Connection. Provider import apply requires
146
- `--apply --confirm-hash <hash> --yes` and an active owner-approved grant.
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.
147
51
 
148
- ## Booking without Editor setup
52
+ ## Booking
149
53
 
150
54
  ```ts
151
55
  import { withSiteplane } from "siteplane/next";
@@ -153,7 +57,16 @@ export default withSiteplane(nextConfig, { booking: { site: "<immutable-site-id>
153
57
  ```
154
58
 
155
59
  The wrapper adds `/booking/:path*` as a `beforeFiles` rewrite to Siteplane and preserves existing rewrite sections.
156
- Without `siteplane.config.json`, it skips Editor scanning, headers and build proof. Use `<a href="/booking">`
157
- instead of `next/link`; exclude this path from customer middleware. Configure the public booking address in
158
- Siteplane and permit Siteplane/Stripe assets and connections in the customer CSP. `siteplane booking check`
159
- verifies the Site ID in `next.config.*`. The public API uses Site ID plus allowed Origin; no raw Booking key is needed.
60
+ Use `<a href="/booking">` instead of `next/link`; exclude this path from customer middleware.
61
+
62
+ ```bash
63
+ npx siteplane booking init
64
+ npx siteplane booking check
65
+ npx siteplane booking sync
66
+ npx siteplane booking test
67
+ ```
68
+
69
+ `booking sync` and `booking test` read the Site ID from `siteplane.booking.json` and connect through the same browser
70
+ approval. The agent connection is stored in the user config directory (`$SITEPLANE_CONFIG_DIR`,
71
+ `$XDG_CONFIG_HOME/siteplane`, `%APPDATA%\siteplane` or `~/.config/siteplane`), never in the project; `--no-browser`
72
+ skips opening the browser.