creght-cli 0.4.0 → 0.5.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
|
@@ -79,7 +79,7 @@ project_id Project Name
|
|
|
79
79
|
project_id/site_id Site Name
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
Use the `project_id/site_id` value with `pull
|
|
82
|
+
Use the `project_id/site_id` value with `pull` and `push`.
|
|
83
83
|
|
|
84
84
|
## Create Project
|
|
85
85
|
|
|
@@ -139,6 +139,25 @@ simply the set of site files under `backend/func/`; for example
|
|
|
139
139
|
`backend/func/booking.ts` is the Func with key `booking`, and
|
|
140
140
|
`backend/func/profile/settings.ts` is `profile/settings`.
|
|
141
141
|
|
|
142
|
+
The first pull requires `--site_id` and usually `--dir`. After that,
|
|
143
|
+
`.creght/state.json` records the site reference. From the workspace root or any
|
|
144
|
+
child directory, `pull`, `diff`, and `push` find that file by walking upward,
|
|
145
|
+
so normal ongoing usage does not repeat either option:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
creght pull
|
|
149
|
+
creght diff
|
|
150
|
+
creght push
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Pass `--dir` and `--site_id` explicitly when operating on another workspace.
|
|
154
|
+
|
|
155
|
+
Single-file `<path>` arguments resolve from the current directory, git-style:
|
|
156
|
+
`creght push Index.tsx` run inside `page/` pushes `/page/Index.tsx`, while
|
|
157
|
+
paths starting with `/` are always workspace-root paths. When the discovered
|
|
158
|
+
workspace root differs from the current directory, commands print
|
|
159
|
+
`workspace: <root>` before doing anything.
|
|
160
|
+
|
|
142
161
|
## Local Vite Preview
|
|
143
162
|
|
|
144
163
|
Creght projects pulled by the CLI usually do not have their own `package.json`
|
|
@@ -192,7 +211,8 @@ module after local file changes without a full page reload.
|
|
|
192
211
|
Push the current local directory snapshot to Creght and exit:
|
|
193
212
|
|
|
194
213
|
```bash
|
|
195
|
-
|
|
214
|
+
cd ./mysite
|
|
215
|
+
creght push
|
|
196
216
|
```
|
|
197
217
|
|
|
198
218
|
For local development:
|
|
@@ -211,25 +231,40 @@ renaming, or deleting a file under `backend/func/` creates, updates, renames, or
|
|
|
211
231
|
deletes the corresponding site file, and Func code is versioned and published
|
|
212
232
|
together with the rest of the site.
|
|
213
233
|
|
|
214
|
-
##
|
|
234
|
+
## Resolve Conflicts
|
|
215
235
|
|
|
216
|
-
|
|
236
|
+
`pull` and `push` compare three versions of every file: the base snapshot
|
|
237
|
+
recorded at the last pull/push (hashes in `.creght/state.json`, contents under
|
|
238
|
+
`.creght/base/`), the current local file, and the current remote file.
|
|
217
239
|
|
|
218
|
-
|
|
219
|
-
creght sync --site_id=<project_id>/<site_id> --dir=./mysite
|
|
220
|
-
```
|
|
240
|
+
When a file changed on both sides, `pull` three-way merges it:
|
|
221
241
|
|
|
222
|
-
|
|
242
|
+
- Non-overlapping edits merge automatically; the file is reported as `merged`
|
|
243
|
+
and the result stays local until the next `push`.
|
|
244
|
+
- Overlapping edits write git-style conflict markers
|
|
245
|
+
(`<<<<<<< local` / `=======` / `>>>>>>> remote`) into the file and `pull`
|
|
246
|
+
exits non-zero.
|
|
247
|
+
|
|
248
|
+
List and resolve marker files:
|
|
223
249
|
|
|
224
250
|
```bash
|
|
225
|
-
|
|
251
|
+
creght resolve --list
|
|
252
|
+
creght resolve page/Index.tsx --ours # keep the local side
|
|
253
|
+
creght resolve page/Index.tsx --theirs # keep the remote side
|
|
226
254
|
```
|
|
227
255
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
256
|
+
Editing the markers by hand works too. `push` refuses to upload any file that
|
|
257
|
+
still contains conflict markers.
|
|
258
|
+
|
|
259
|
+
`push` reports a conflict for files changed on both sides — run `creght pull`
|
|
260
|
+
to merge them first, push the rest with `creght push --skip-conflicts`, or
|
|
261
|
+
overwrite remote with `creght push --force`. Before anything is overwritten
|
|
262
|
+
(local work by `pull`, diverged remote copies by `push --force`), the losing
|
|
263
|
+
content is backed up under `.creght/backup/<timestamp>-*/`.
|
|
264
|
+
|
|
265
|
+
`creght diff --json` marks each conflict with `reason`, `auto_mergeable`, and
|
|
266
|
+
`base_to_local_diff` / `base_to_remote_diff`, so agents can decide how to
|
|
267
|
+
resolve without extra round-trips.
|
|
233
268
|
|
|
234
269
|
## Local Web Editor Bidirectional Sync
|
|
235
270
|
|
|
@@ -442,7 +477,7 @@ The workflow is the same as for any site file:
|
|
|
442
477
|
1. Run `creght pull --site_id=<project_id>/<site_id> --dir=./mysite`.
|
|
443
478
|
2. Edit or create files under `./mysite/backend/func/`.
|
|
444
479
|
3. Run `creght push --site_id=<project_id>/<site_id> --dir=./mysite`, or keep
|
|
445
|
-
`creght
|
|
480
|
+
`creght dev` running.
|
|
446
481
|
|
|
447
482
|
Examples:
|
|
448
483
|
|
|
@@ -452,7 +487,7 @@ Examples:
|
|
|
452
487
|
Because Func code is just a site file, it is versioned and published together
|
|
453
488
|
with the site, and it participates in the same 3-way merge and conflict
|
|
454
489
|
detection as every other file. Deleting a local Func file deletes the remote
|
|
455
|
-
site file on the next push
|
|
490
|
+
site file on the next push (with `--delete`); renaming is treated as delete + create.
|
|
456
491
|
|
|
457
492
|
Func files should use ESM exports and the `(input, ctx)` signature:
|
|
458
493
|
|
|
@@ -480,8 +515,12 @@ to self-test a Func method with sample input:
|
|
|
480
515
|
creght func run --site_id=<project_id>/<site_id> --key=booking.create --input=./input.json
|
|
481
516
|
```
|
|
482
517
|
|
|
518
|
+
The output matches the Func HTTP response protocol: successful runs print
|
|
519
|
+
`{"result": ...}` and thrown Func errors print `{"error": "..."}`. There is no
|
|
520
|
+
top-level `ok` execution wrapper.
|
|
521
|
+
|
|
483
522
|
There are no `creght func list/get/create/update/delete` commands. Manage Func
|
|
484
|
-
code by editing `backend/func` files and syncing them with pull/push/
|
|
523
|
+
code by editing `backend/func` files and syncing them with pull/push/dev
|
|
485
524
|
like any other site file; `func run` only runs sample input.
|
|
486
525
|
|
|
487
526
|
## Upload Assets
|
|
@@ -506,35 +545,30 @@ Optional flags:
|
|
|
506
545
|
creght upload --site_id=<project_id>/<site_id> --file=./image.png --name=hero.png --mimetype=image/png
|
|
507
546
|
```
|
|
508
547
|
|
|
509
|
-
## Push And
|
|
548
|
+
## Push And Pull Boundary
|
|
510
549
|
|
|
511
|
-
|
|
550
|
+
`push` is one-way:
|
|
512
551
|
|
|
513
552
|
```text
|
|
514
553
|
local directory -> Creght remote site
|
|
515
554
|
```
|
|
516
555
|
|
|
517
|
-
`push` fetches the remote file list
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
keeps running and automatically listens for later local changes.
|
|
523
|
-
|
|
524
|
-
Neither command pulls Web editor changes back to the local directory while
|
|
525
|
-
running. If you edit the same site in the Web editor, run `pull` manually or
|
|
526
|
-
restart from a clean local copy before continuing.
|
|
556
|
+
`push` fetches the remote file list, compares base/local/remote, uploads local
|
|
557
|
+
changes, and then exits. It never merges remote edits into local files — that
|
|
558
|
+
is `pull`'s job. If you edit the same site in the Web editor, run `creght pull`
|
|
559
|
+
to merge those edits into the workspace before pushing (see Resolve
|
|
560
|
+
Conflicts above).
|
|
527
561
|
|
|
528
|
-
Use a test project/site while validating the CLI. Do not run `push
|
|
562
|
+
Use a test project/site while validating the CLI. Do not run `push --force`
|
|
529
563
|
against production content unless the local directory is intended to be the
|
|
530
564
|
source of truth.
|
|
531
565
|
|
|
532
566
|
## Commands
|
|
533
567
|
|
|
534
568
|
Creght CLI is a local bridge for Creght site code. It can authenticate with
|
|
535
|
-
Creght, list projects and sites, pull remote site files into a local directory
|
|
536
|
-
push local files back to Creght,
|
|
537
|
-
remote preview, and publish a site.
|
|
569
|
+
Creght, list projects and sites, pull remote site files into a local directory
|
|
570
|
+
with three-way merge, push local files back to Creght, resolve conflicts, open
|
|
571
|
+
the remote preview, and publish a site.
|
|
538
572
|
|
|
539
573
|
The CLI commands still use the Creght backend and web app for the canonical
|
|
540
574
|
preview. The Vite plugin is a local development helper and intentionally does
|
|
@@ -546,7 +580,7 @@ creght logout
|
|
|
546
580
|
creght project list
|
|
547
581
|
creght pull --site_id=<project_id>/<site_id> --dir=./mysite
|
|
548
582
|
creght push --site_id=<project_id>/<site_id> --dir=./mysite
|
|
549
|
-
creght
|
|
583
|
+
creght resolve --list
|
|
550
584
|
creght dev --site_id=<project_id>/<site_id> --dir=./mysite [--web=https://creght.cn]
|
|
551
585
|
creght preview --site_id=<project_id>/<site_id>
|
|
552
586
|
creght publish --site_id=<project_id>/<site_id> [--note=<note>]
|
|
@@ -568,9 +602,9 @@ Command meanings:
|
|
|
568
602
|
- `login`: Authenticate this machine with Creght and save a CLI token for the current API host.
|
|
569
603
|
- `logout`: Remove the saved CLI login for the current API host.
|
|
570
604
|
- `project`: List available projects and sites. Use `project_id/site_id` with site commands. Also supports `project create`.
|
|
571
|
-
- `pull`: Download site files (including Func code under `backend/func/`) into a local workspace.
|
|
572
|
-
- `push`: Push
|
|
573
|
-
- `
|
|
605
|
+
- `pull`: Download site files (including Func code under `backend/func/`) into a local workspace, three-way merging remote and local edits.
|
|
606
|
+
- `push`: Push local workspace changes to the remote site/project after a three-way conflict check.
|
|
607
|
+
- `resolve`: List files with conflict markers, or resolve one by keeping the local (`--ours`) or remote (`--theirs`) side.
|
|
574
608
|
- `dev`: Bidirectionally sync local files with cloud realtime files and the online Web editor.
|
|
575
609
|
- `preview`: Open the remote preview URL for a site in the browser.
|
|
576
610
|
- `publish`: Publish a site to make the current remote site version live.
|
|
@@ -578,7 +612,7 @@ Command meanings:
|
|
|
578
612
|
- `content`: Manage CMS content entries.
|
|
579
613
|
- `form`: Manage forms and form submissions.
|
|
580
614
|
- `table`: Manage project JSON tables and records used by Func.
|
|
581
|
-
- `func`: Run project Func backend code with sample input. Func code itself is edited as `backend/func` site files and synced with pull/push/
|
|
615
|
+
- `func`: Run project Func backend code with sample input. Func code itself is edited as `backend/func` site files and synced with pull/push/dev.
|
|
582
616
|
- `upload`: Upload a local file as a Creght site asset and print its URL.
|
|
583
617
|
- `version`: Print the installed CLI version.
|
|
584
618
|
|
package/package.json
CHANGED
|
Binary file
|
package/vendor/darwin-x64/creght
CHANGED
|
Binary file
|
|
Binary file
|
package/vendor/linux-x64/creght
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|