creght-cli 0.1.19 → 0.2.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
@@ -131,11 +131,17 @@ mysite/
131
131
  profile/settings.ts
132
132
  ```
133
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`.
134
+ Remote site files map to the local workspace with an asymmetric rule:
135
+
136
+ - `frontend/<p>` <-> remote `/<p>`: the `frontend/` root is stripped, so
137
+ `frontend/page/Index.tsx` maps to `/page/Index.tsx`.
138
+ - `backend/<p>` <-> remote `/backend/<p>`: the `backend/` prefix is kept, so
139
+ `backend/func/booking.ts` maps to `/backend/func/booking.ts`.
140
+
141
+ Everything under `frontend/` and `backend/` is an ordinary site file. Func
142
+ backend code is simply the set of site files under `backend/func/`; for example
143
+ `backend/func/booking.ts` is the Func with key `booking`, and
144
+ `backend/func/profile/settings.ts` is `profile/settings`.
139
145
 
140
146
  ## Local Vite Preview
141
147
 
@@ -199,15 +205,18 @@ For local development:
199
205
  CREGHT_API_HOST=http://localhost:8433 creght push --site_id=<project_id>/<site_id> --dir=./mysite
200
206
  ```
201
207
 
202
- The CLI scans the local workspace and diffs both frontend files and Func files:
208
+ The CLI scans the local workspace and diffs every file under `frontend/` and
209
+ `backend/` against the remote site files:
203
210
 
204
- - `frontend/**` is synced to Creght site files.
205
- - `backend/func/**/*.ts` is synced to project Func records.
211
+ - `frontend/**` is synced to Creght site files with the `frontend/` root stripped.
212
+ - `backend/**` is synced to Creght site files keeping the `backend/` prefix, so
213
+ `backend/func/**/*.ts` becomes `/backend/func/**/*.ts`.
206
214
 
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.
215
+ Both trees flow through the same site file mechanism (`file_list` /
216
+ `site_action`). Func code is not a separate resource; creating, editing,
217
+ renaming, or deleting a file under `backend/func/` creates, updates, renames, or
218
+ deletes the corresponding site file, and Func code is versioned and published
219
+ together with the rest of the site.
211
220
 
212
221
  ## Sync Local Changes
213
222
 
@@ -224,9 +233,10 @@ CREGHT_API_HOST=http://localhost:8433 creght sync --site_id=<project_id>/<site_i
224
233
  ```
225
234
 
226
235
  `sync` first pushes the current local snapshot, then keeps running and
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.
236
+ automatically listens for local file changes. When any file under `frontend/`
237
+ or `backend/` (including Func code under `backend/func/`) changes locally, the
238
+ CLI updates the corresponding remote site file in realtime. The command also
239
+ prints the remote preview URL when available.
230
240
 
231
241
  ## Local Web Editor Bidirectional Sync
232
242
 
@@ -430,10 +440,11 @@ and a `null` field value removes that field.
430
440
 
431
441
  Func is for small project-level backend workflows such as bookings, RSVP,
432
442
  availability checks, protected status updates, and JSON-table reads/writes.
433
- Func keys are extensionless project paths like `booking` or
434
- `profile/settings`.
443
+ Func code is stored as ordinary site source files under `backend/func/`; there
444
+ is no separate Func resource. A Func's key is its extensionless path under
445
+ `backend/func/`, for example `booking` or `profile/settings`.
435
446
 
436
- The normal workflow is file-based:
447
+ The workflow is the same as for any site file:
437
448
 
438
449
  1. Run `creght pull --site_id=<project_id>/<site_id> --dir=./mysite`.
439
450
  2. Edit or create files under `./mysite/backend/func/`.
@@ -442,11 +453,13 @@ The normal workflow is file-based:
442
453
 
443
454
  Examples:
444
455
 
445
- - `backend/func/booking.ts` -> Func key `booking`
446
- - `backend/func/profile/settings.ts` -> Func key `profile/settings`
456
+ - `backend/func/booking.ts` <-> remote site file `/backend/func/booking.ts`, Func key `booking`
457
+ - `backend/func/profile/settings.ts` <-> remote `/backend/func/profile/settings.ts`, Func key `profile/settings`
447
458
 
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.
459
+ Because Func code is just a site file, it is versioned and published together
460
+ with the site, and it participates in the same 3-way merge and conflict
461
+ detection as every other file. Deleting a local Func file deletes the remote
462
+ site file on the next push/sync; renaming is treated as delete + create.
450
463
 
451
464
  Func files should use ESM exports and the `(input, ctx)` signature:
452
465
 
@@ -467,14 +480,16 @@ await invoke("booking.create", input)
467
480
  Use `talizen/auth` for login, registration, logout, current-user state, and
468
481
  OAuth. Do not implement passwords, sessions, or OAuth callbacks in Func.
469
482
 
470
- Use `creght func run` to self-test a Func method with sample input:
483
+ `func run` is the only Func command; it posts to a dedicated invocation endpoint
484
+ to self-test a Func method with sample input:
471
485
 
472
486
  ```bash
473
487
  creght func run --site_id=<project_id>/<site_id> --key=booking.create --input=./input.json
474
488
  ```
475
489
 
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.
490
+ There are no `creght func list/get/create/update/delete` commands. Manage Func
491
+ code by editing `backend/func` files and syncing them with pull/push/sync/dev
492
+ like any other site file; `func run` only runs sample input.
478
493
 
479
494
  ## Upload Assets
480
495
 
@@ -560,7 +575,7 @@ Command meanings:
560
575
  - `login`: Authenticate this machine with Creght and save a CLI token for the current API host.
561
576
  - `logout`: Remove the saved CLI login for the current API host.
562
577
  - `project`: List available projects and sites. Use `project_id/site_id` with site commands. Also supports `project create`.
563
- - `pull`: Download frontend files and Func files into a local workspace.
578
+ - `pull`: Download site files (both `frontend/` and `backend/`, including Func code) into a local workspace.
564
579
  - `push`: Push the current local workspace snapshot to the remote site/project.
565
580
  - `sync`: Watch mode; push the current snapshot, then keep listening for local changes.
566
581
  - `dev`: Bidirectionally sync local files with cloud realtime files and the online Web editor.
@@ -570,7 +585,7 @@ Command meanings:
570
585
  - `content`: Manage CMS content entries.
571
586
  - `form`: Manage forms and form submissions.
572
587
  - `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.
588
+ - `func`: Run project Func backend code with sample input. Func code itself is edited as `backend/func` site files and synced with pull/push/sync/dev.
574
589
  - `upload`: Upload a local file as a Creght site asset and print its URL.
575
590
  - `version`: Print the installed CLI version.
576
591
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "creght-cli",
3
- "version": "0.1.19",
3
+ "version": "0.2.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