creght-cli 0.8.0 → 0.10.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
@@ -274,6 +274,96 @@ For local development:
274
274
  CREGHT_API_HOST=http://localhost:8433 creght publish --site_id=<project_id>/<site_id>
275
275
  ```
276
276
 
277
+ `publish` reports the version it created, so you can publish it again later:
278
+
279
+ ```text
280
+ Published <project_id>/<site_id>
281
+ version 14 (id 458) is live on demo.creght.cn
282
+ ```
283
+
284
+ ## Site Versions
285
+
286
+ A site version is an immutable snapshot of the site's source files — the
287
+ platform equivalent of a git commit. Create one whenever a piece of work is
288
+ done, then publish whichever version you want the live site to serve.
289
+
290
+ Snapshots cover source files only. CMS content and the platform state under
291
+ `/platform/**` (CMS/form/table/auth definitions) are live, so publishing an
292
+ older version does not roll those back.
293
+
294
+ Inside a pulled workspace `--site_id` is optional; the version commands
295
+ discover `.creght/state.json` from the current directory or its parents, like
296
+ `pull`/`push` do.
297
+
298
+ Snapshot the current site source without publishing it:
299
+
300
+ ```bash
301
+ creght version create --note="Add pricing page"
302
+ ```
303
+
304
+ A version records the *remote* files, so local edits that were never pushed
305
+ would be missing from it. `create` therefore compares the workspace against the
306
+ site first and refuses to run while anything is unpushed:
307
+
308
+ ```text
309
+ update /page/Index.tsx
310
+ 1 change is not pushed yet and would be missing from this version; run creght
311
+ push first, or pass --allow-dirty to snapshot the remote site as it is
312
+ ```
313
+
314
+ Run `creght push` first, or pass `--allow-dirty` to snapshot the remote site as
315
+ it is. The platform rejects a snapshot identical to the newest version, so
316
+ repeated `create` calls never pile up duplicates.
317
+
318
+ List versions, newest first:
319
+
320
+ ```bash
321
+ creght version list
322
+ ```
323
+
324
+ ```text
325
+ VERSION ID CREATED FROM NOTE
326
+ 12 456 2026-08-05 14:31 api_generate_version Add pricing page
327
+ * 11 455 2026-08-05 11:02 publish Fix nav
328
+ 10 442 2026-08-04 18:40 agent -
329
+ * live: version 11 (id 455), served by demo.creght.cn
330
+ pinned: www.example.com -> version 12 (id 456)
331
+ 1 change is pending on the site since the newest version; run creght version create to snapshot them
332
+ ```
333
+
334
+ `*` marks the version the live site serves. `VERSION` is the per-site number
335
+ that `version publish` takes; `ID` is the platform-wide version id. Use
336
+ `--limit=<n>` to shorten the list and `--json` to get the raw publish state,
337
+ including every version, the pinned domains, and the exact files that changed
338
+ since the newest version.
339
+
340
+ Make an existing version live, forward to a newer one or back to an older one:
341
+
342
+ ```bash
343
+ creght version publish 12
344
+ creght version publish 12 --note="Roll back nav change"
345
+ ```
346
+
347
+ Every domain follows it except domains pinned to a specific version.
348
+ Publishing the version already being served is a no-op that just refreshes its
349
+ caches.
350
+
351
+ Publishing a version changes only which snapshot the live site serves — it
352
+ restores nothing. The editable site workspace and your local files are
353
+ untouched, and `creght pull` still fetches the current workspace rather than the
354
+ published version's files. So after rolling production back to an older version,
355
+ the workspace still holds the newer source and the next `publish` would ship it
356
+ again; to revert the code itself, edit locally and push.
357
+
358
+ `12` is the per-site number from the `VERSION` column. To reach a version older
359
+ than the window `version list` returns, select it by id instead:
360
+
361
+ ```bash
362
+ creght version publish id:456
363
+ ```
364
+
365
+ Bare `creght version` still prints the installed CLI version.
366
+
277
367
  ## Manage CMS Collections
278
368
 
279
369
  List CMS collections:
@@ -503,6 +593,9 @@ Creght, list projects and sites, pull remote site files into a local directory
503
593
  with three-way merge, push local files back to Creght, resolve conflicts, open
504
594
  the remote preview, and publish a site.
505
595
 
596
+ It can also manage site versions: immutable snapshots of a site's source files,
597
+ created and published like git commits.
598
+
506
599
  The CLI commands still use the Creght backend and web app for the canonical
507
600
  preview. The CLI does not render sites locally.
508
601
 
@@ -526,6 +619,9 @@ creght table record create --site_id=<project_id>/<site_id> --table=<key> --data
526
619
  creght func run --site_id=<project_id>/<site_id> --key=<key.method> --input=./input.json
527
620
  creght upload --site_id=<project_id>/<site_id> --file=./image.png
528
621
  creght version
622
+ creght version create [--note=<note>] [--allow-dirty]
623
+ creght version list [--limit=<n>] [--json]
624
+ creght version publish <version_no> [--note=<note>]
529
625
  ```
530
626
 
531
627
  Command meanings:
@@ -537,14 +633,14 @@ Command meanings:
537
633
  - `push`: Push local workspace changes to the remote site/project after a three-way conflict check.
538
634
  - `resolve`: List files with conflict markers, or resolve one by keeping the local (`--ours`) or remote (`--theirs`) side.
539
635
  - `preview`: Open the remote preview URL for a site in the browser.
540
- - `publish`: Publish a site to make the current remote site version live.
636
+ - `publish`: Snapshot the current remote site source into a new version and make it live in one step.
541
637
  - `cms`: Manage CMS collections.
542
638
  - `content`: Manage CMS content entries.
543
639
  - `form`: Manage forms and form submissions.
544
640
  - `table`: Manage project JSON tables and records used by Func.
545
641
  - `func`: Run project Func backend code with sample input. Func code itself is edited as `backend/func` site files and synced with pull/push.
546
642
  - `upload`: Upload a local file as a Creght site asset and print its URL.
547
- - `version`: Print the installed CLI version.
643
+ - `version`: Print the installed CLI version. Subcommands manage site versions — immutable source snapshots: `version create` records one, `version list` shows them and which is live, `version publish` makes one live.
548
644
 
549
645
  ## Release
550
646
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "creght-cli",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Creght CLI for syncing local site code with Creght.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/creght-dev/creght-cli#readme",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file