creght-cli 0.1.17 → 0.1.19
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
|
@@ -102,9 +102,9 @@ creght project create --name="My Project" --from_id=<project_id>
|
|
|
102
102
|
creght project create --name="My Project" --tpl_id=<template_id>
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
## Pull Site
|
|
105
|
+
## Pull Site Workspace
|
|
106
106
|
|
|
107
|
-
Download the current remote site
|
|
107
|
+
Download the current remote site workspace into a local directory:
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
110
|
creght pull --site_id=<project_id>/<site_id> --dir=./mysite
|
|
@@ -116,7 +116,26 @@ For local development:
|
|
|
116
116
|
CREGHT_API_HOST=http://localhost:8433 creght pull --site_id=<project_id>/<site_id> --dir=./mysite
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
The command writes
|
|
119
|
+
The command writes a file-based workspace:
|
|
120
|
+
|
|
121
|
+
```text
|
|
122
|
+
mysite/
|
|
123
|
+
AGENTS.md
|
|
124
|
+
frontend/
|
|
125
|
+
page/...
|
|
126
|
+
component/...
|
|
127
|
+
talizen.config.ts
|
|
128
|
+
backend/
|
|
129
|
+
func/
|
|
130
|
+
booking.ts
|
|
131
|
+
profile/settings.ts
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Remote frontend files such as `/page/...`, `/component/...`, and
|
|
135
|
+
`talizen.config.ts` are written under `frontend/`. Project Func code is written
|
|
136
|
+
under `backend/func/`; for example Func key `booking` maps to
|
|
137
|
+
`backend/func/booking.ts`, and `profile/settings` maps to
|
|
138
|
+
`backend/func/profile/settings.ts`.
|
|
120
139
|
|
|
121
140
|
## Local Vite Preview
|
|
122
141
|
|
|
@@ -124,8 +143,9 @@ Creght projects pulled by the CLI usually do not have their own `package.json`
|
|
|
124
143
|
or `node_modules`. The local preview plugin therefore uses Vite only for local
|
|
125
144
|
file serving and TSX transpilation; third-party packages continue to resolve
|
|
126
145
|
through the Creght import map, matching the Web editor preview model. In
|
|
127
|
-
`creght dev`, the CLI
|
|
128
|
-
|
|
146
|
+
`creght dev`, the CLI serves the `frontend/` directory when present, loads the
|
|
147
|
+
platform import map from server system info, and passes it to the Vite plugin;
|
|
148
|
+
the plugin's local map is only a fallback.
|
|
129
149
|
|
|
130
150
|
Install Vite in the local project folder:
|
|
131
151
|
|
|
@@ -179,8 +199,15 @@ For local development:
|
|
|
179
199
|
CREGHT_API_HOST=http://localhost:8433 creght push --site_id=<project_id>/<site_id> --dir=./mysite
|
|
180
200
|
```
|
|
181
201
|
|
|
182
|
-
The CLI scans the local
|
|
183
|
-
|
|
202
|
+
The CLI scans the local workspace and diffs both frontend files and Func files:
|
|
203
|
+
|
|
204
|
+
- `frontend/**` is synced to Creght site files.
|
|
205
|
+
- `backend/func/**/*.ts` is synced to project Func records.
|
|
206
|
+
|
|
207
|
+
Creating, editing, renaming, or deleting files under `backend/func/` creates,
|
|
208
|
+
updates, renames, or deletes Func records through the backend API. Func CRUD is
|
|
209
|
+
intentionally file-based; the CLI does not expose manual Func management
|
|
210
|
+
commands.
|
|
184
211
|
|
|
185
212
|
## Sync Local Changes
|
|
186
213
|
|
|
@@ -197,9 +224,9 @@ CREGHT_API_HOST=http://localhost:8433 creght sync --site_id=<project_id>/<site_i
|
|
|
197
224
|
```
|
|
198
225
|
|
|
199
226
|
`sync` first pushes the current local snapshot, then keeps running and
|
|
200
|
-
automatically listens for local file changes. When a file is
|
|
201
|
-
the CLI
|
|
202
|
-
|
|
227
|
+
automatically listens for local file changes. When a frontend or Func file is
|
|
228
|
+
changed locally, the CLI updates the corresponding remote resource in realtime.
|
|
229
|
+
The command also prints the remote preview URL when available.
|
|
203
230
|
|
|
204
231
|
## Local Web Editor Bidirectional Sync
|
|
205
232
|
|
|
@@ -317,6 +344,7 @@ List, get, create, update, and delete content entries:
|
|
|
317
344
|
```bash
|
|
318
345
|
creght content list --site_id=<project_id>/<site_id> --collection=blogs
|
|
319
346
|
creght content get --site_id=<project_id>/<site_id> --collection=blogs --slug=hello-world
|
|
347
|
+
creght content get --site_id=<project_id>/<site_id> --collection=blogs --slug=hello-world --out=./content.json
|
|
320
348
|
creght content create --site_id=<project_id>/<site_id> --collection=blogs --data=./content.json --slug=hello-world
|
|
321
349
|
creght content update --site_id=<project_id>/<site_id> --collection=blogs --id=<content_id> --data=./content.json
|
|
322
350
|
creght content delete --site_id=<project_id>/<site_id> --collection=blogs --id=<content_id>
|
|
@@ -371,6 +399,83 @@ creght form submit --site_id=<project_id>/<site_id> --key=contact-form --data=./
|
|
|
371
399
|
|
|
372
400
|
After creating or changing CMS collections or forms, run `creght pull` again to refresh generated files such as `/types/cms.d.ts` and `/types/form.d.ts` before writing code that imports those types.
|
|
373
401
|
|
|
402
|
+
## Manage Backend Tables
|
|
403
|
+
|
|
404
|
+
Project JSON tables provide persistent data for Creght/Talizen Func code through
|
|
405
|
+
`ctx.db.*`.
|
|
406
|
+
|
|
407
|
+
```bash
|
|
408
|
+
creght table list --site_id=<project_id>/<site_id>
|
|
409
|
+
creght table create --site_id=<project_id>/<site_id> --key=appointments --name="Appointments" --schema=./appointments.schema.json
|
|
410
|
+
creght table get --site_id=<project_id>/<site_id> --key=appointments
|
|
411
|
+
creght table update --site_id=<project_id>/<site_id> --key=appointments --schema=./appointments.schema.json
|
|
412
|
+
creght table delete --site_id=<project_id>/<site_id> --key=appointments
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
Manage seed or operational records:
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
creght table record list --site_id=<project_id>/<site_id> --table=appointments
|
|
419
|
+
creght table record list --site_id=<project_id>/<site_id> --table=appointments --where=./where.json
|
|
420
|
+
creght table record get --site_id=<project_id>/<site_id> --table=appointments --id=<record_id> --out=./record.json
|
|
421
|
+
creght table record create --site_id=<project_id>/<site_id> --table=appointments --data=./record.json
|
|
422
|
+
creght table record update --site_id=<project_id>/<site_id> --table=appointments --id=<record_id> --data=./patch.json
|
|
423
|
+
creght table record delete --site_id=<project_id>/<site_id> --table=appointments --id=<record_id>
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
`record update` sends a patch body to the backend. Existing fields are merged,
|
|
427
|
+
and a `null` field value removes that field.
|
|
428
|
+
|
|
429
|
+
## Func Backend Code As Files
|
|
430
|
+
|
|
431
|
+
Func is for small project-level backend workflows such as bookings, RSVP,
|
|
432
|
+
availability checks, protected status updates, and JSON-table reads/writes.
|
|
433
|
+
Func keys are extensionless project paths like `booking` or
|
|
434
|
+
`profile/settings`.
|
|
435
|
+
|
|
436
|
+
The normal workflow is file-based:
|
|
437
|
+
|
|
438
|
+
1. Run `creght pull --site_id=<project_id>/<site_id> --dir=./mysite`.
|
|
439
|
+
2. Edit or create files under `./mysite/backend/func/`.
|
|
440
|
+
3. Run `creght push --site_id=<project_id>/<site_id> --dir=./mysite`, or keep
|
|
441
|
+
`creght sync` / `creght dev` running.
|
|
442
|
+
|
|
443
|
+
Examples:
|
|
444
|
+
|
|
445
|
+
- `backend/func/booking.ts` -> Func key `booking`
|
|
446
|
+
- `backend/func/profile/settings.ts` -> Func key `profile/settings`
|
|
447
|
+
|
|
448
|
+
Deleting a local Func file deletes the remote Func on the next push/sync.
|
|
449
|
+
Renaming a local Func file is treated as delete old key + create new key.
|
|
450
|
+
|
|
451
|
+
Func files should use ESM exports and the `(input, ctx)` signature:
|
|
452
|
+
|
|
453
|
+
```ts
|
|
454
|
+
export function create(input, ctx) {
|
|
455
|
+
return ctx.db.insert("appointments", input)
|
|
456
|
+
}
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Page and component code should call Func through the `talizen/func` SDK:
|
|
460
|
+
|
|
461
|
+
```ts
|
|
462
|
+
import { invoke } from "talizen/func"
|
|
463
|
+
|
|
464
|
+
await invoke("booking.create", input)
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
Use `talizen/auth` for login, registration, logout, current-user state, and
|
|
468
|
+
OAuth. Do not implement passwords, sessions, or OAuth callbacks in Func.
|
|
469
|
+
|
|
470
|
+
Use `creght func run` to self-test a Func method with sample input:
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
creght func run --site_id=<project_id>/<site_id> --key=booking.create --input=./input.json
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
The CLI intentionally does not expose `creght func list/get/create/update/delete`.
|
|
477
|
+
Use `backend/func` files for Func CRUD, and `creght func run` only for self-tests.
|
|
478
|
+
|
|
374
479
|
## Upload Assets
|
|
375
480
|
|
|
376
481
|
Upload a local file through the Creght site asset flow:
|
|
@@ -443,6 +548,9 @@ creght content list --site_id=<project_id>/<site_id> --collection=<key>
|
|
|
443
548
|
creght content create --site_id=<project_id>/<site_id> --collection=<key> --data=./content.json
|
|
444
549
|
creght form list --site_id=<project_id>/<site_id>
|
|
445
550
|
creght form create --site_id=<project_id>/<site_id> --key=<key> --name=<name> --schema=./schema.json
|
|
551
|
+
creght table list --site_id=<project_id>/<site_id>
|
|
552
|
+
creght table record create --site_id=<project_id>/<site_id> --table=<key> --data=./record.json
|
|
553
|
+
creght func run --site_id=<project_id>/<site_id> --key=<key.method> --input=./input.json
|
|
446
554
|
creght upload --site_id=<project_id>/<site_id> --file=./image.png
|
|
447
555
|
creght version
|
|
448
556
|
```
|
|
@@ -452,8 +560,8 @@ Command meanings:
|
|
|
452
560
|
- `login`: Authenticate this machine with Creght and save a CLI token for the current API host.
|
|
453
561
|
- `logout`: Remove the saved CLI login for the current API host.
|
|
454
562
|
- `project`: List available projects and sites. Use `project_id/site_id` with site commands. Also supports `project create`.
|
|
455
|
-
- `pull`: Download
|
|
456
|
-
- `push`: Push the current local
|
|
563
|
+
- `pull`: Download frontend files and Func files into a local workspace.
|
|
564
|
+
- `push`: Push the current local workspace snapshot to the remote site/project.
|
|
457
565
|
- `sync`: Watch mode; push the current snapshot, then keep listening for local changes.
|
|
458
566
|
- `dev`: Bidirectionally sync local files with cloud realtime files and the online Web editor.
|
|
459
567
|
- `preview`: Open the remote preview URL for a site in the browser.
|
|
@@ -461,6 +569,8 @@ Command meanings:
|
|
|
461
569
|
- `cms`: Manage CMS collections.
|
|
462
570
|
- `content`: Manage CMS content entries.
|
|
463
571
|
- `form`: Manage forms and form submissions.
|
|
572
|
+
- `table`: Manage project JSON tables and records used by Func.
|
|
573
|
+
- `func`: Run project Func backend code with sample input. Func CRUD is handled through `backend/func` file sync.
|
|
464
574
|
- `upload`: Upload a local file as a Creght site asset and print its URL.
|
|
465
575
|
- `version`: Print the installed CLI version.
|
|
466
576
|
|
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
|