creght-cli 0.11.0 → 0.13.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
|
@@ -25,6 +25,17 @@ Optional:
|
|
|
25
25
|
mv ./creght /usr/local/bin/creght
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
## Update
|
|
29
|
+
|
|
30
|
+
Update the CLI in place to the newest published release:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
creght update
|
|
34
|
+
creght update --check # report versions, install nothing
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The install method is detected, not assumed. A binary vendored by the npm package is updated by running `npm install -g creght-cli@<version>`, so the package's own metadata stays consistent with the binary; a standalone binary is replaced directly with the release archive for the running platform, after its SHA-256 is verified against the release checksums. A local `go build` reports `dev` and is never overwritten.
|
|
38
|
+
|
|
28
39
|
## Login
|
|
29
40
|
|
|
30
41
|
For production:
|
|
@@ -45,7 +56,9 @@ The command opens a browser authorization page. After authorization succeeds, th
|
|
|
45
56
|
~/Library/Application Support/creght/config.json
|
|
46
57
|
```
|
|
47
58
|
|
|
48
|
-
The config file contains the
|
|
59
|
+
The config file contains the default API host and CLI tokens. Tokens are stored per API host, so logging in to `https://creght.cn`, `https://creght.com`, or a local backend does not overwrite the other hosts' login state.
|
|
60
|
+
|
|
61
|
+
`CREGHT_API_HOST` applies to the single command it is set on and never changes the saved default or a workspace's recorded host. A login prefixed with it saves a token for that host and leaves the default alone, so a later bare `creght project list` still talks to the default host. A login run inside a pulled workspace behaves the same way. See [API Host](#api-host) for the full resolution order.
|
|
49
62
|
|
|
50
63
|
When `--web` is omitted, the CLI uses `CREGHT_WEB_HOST` if set. For local API hosts such as `localhost` or `127.0.0.1`, it defaults to `http://localhost:5173`.
|
|
51
64
|
For production, the default API host and default web host are both `https://creght.cn`.
|
|
@@ -60,6 +73,58 @@ creght logout
|
|
|
60
73
|
|
|
61
74
|
When `CREGHT_API_HOST` is set, `logout` removes only that host's token. Other saved hosts remain logged in. If the last saved token is removed, the config file is deleted.
|
|
62
75
|
|
|
76
|
+
Logging out does not move the default API host either, unless the default is the host being logged out of.
|
|
77
|
+
|
|
78
|
+
## API Host
|
|
79
|
+
|
|
80
|
+
The host a command talks to is resolved most-specific-first:
|
|
81
|
+
|
|
82
|
+
| Order | Source | Scope |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| 1 | `CREGHT_API_HOST` environment variable | the one command it prefixes |
|
|
85
|
+
| 2 | `api_host` in `.creght/state.json`, discovered from the working directory or its parents | that workspace |
|
|
86
|
+
| 3 | the saved default (`creght config set api_host`) | this machine |
|
|
87
|
+
| 4 | the built-in default, `https://creght.cn` | — |
|
|
88
|
+
|
|
89
|
+
`creght -h` prints the host in effect and names which of the four it came from, giving the directory when it was auto-discovered:
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
Current API host: https://talizen.com
|
|
93
|
+
source: auto-discovered from workspace /Users/me/sites/talizen (.creght/state.json)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Workspace auto-discovery
|
|
97
|
+
|
|
98
|
+
`creght pull` records the host it pulled from in `.creght/state.json`, so every later command inside that directory — or any subdirectory of it — reaches the same deployment with no prefix, even when the saved default names another:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
CREGHT_API_HOST=https://talizen.com creght pull --site_id=<pid>/<sid> --dir=./mysite
|
|
102
|
+
cd ./mysite
|
|
103
|
+
creght diff # talks to https://talizen.com, no prefix needed
|
|
104
|
+
creght push
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The recorded host is written once, on the first state write, and never rewritten afterwards. That is what keeps a one-off `CREGHT_API_HOST` override from silently repointing a workspace at another deployment. When an override disagrees with the recorded host, `pull`, `diff`, and `push` print a warning on stderr and then honor the override.
|
|
108
|
+
|
|
109
|
+
Workspaces pulled by CLI versions before auto-discovery have no recorded host and fall through to the saved default, exactly as before. Pulling once records it.
|
|
110
|
+
|
|
111
|
+
### Saved default
|
|
112
|
+
|
|
113
|
+
Commands outside any workspace, and with no environment override, use the saved default — `https://creght.cn` until it is changed. Show it, along with any override or auto-discovery in effect:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
creght config get
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Change it:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
creght config set api_host=https://creght.com
|
|
123
|
+
creght config set api_host=http://localhost:8433
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
This is the only thing that moves the default. Neither `login` nor `logout` does, whether the host came from `CREGHT_API_HOST` or from a workspace. Tokens are kept per API host, so switching to a host already logged in to needs no new login.
|
|
127
|
+
|
|
63
128
|
## List Projects
|
|
64
129
|
|
|
65
130
|
```bash
|
|
@@ -602,6 +667,8 @@ preview. The CLI does not render sites locally.
|
|
|
602
667
|
```bash
|
|
603
668
|
creght login [--web=https://creght.cn]
|
|
604
669
|
creght logout
|
|
670
|
+
creght config get
|
|
671
|
+
creght config set api_host=https://creght.cn
|
|
605
672
|
creght project list
|
|
606
673
|
creght pull --site_id=<project_id>/<site_id> --dir=./mysite
|
|
607
674
|
creght push --site_id=<project_id>/<site_id> --dir=./mysite
|
|
@@ -628,6 +695,7 @@ Command meanings:
|
|
|
628
695
|
|
|
629
696
|
- `login`: Authenticate this machine with Creght and save a CLI token for the current API host.
|
|
630
697
|
- `logout`: Remove the saved CLI login for the current API host.
|
|
698
|
+
- `config`: Show (`config get`) or change (`config set api_host=<url>`) the saved default API host, used when neither `CREGHT_API_HOST` nor a workspace's recorded host applies.
|
|
631
699
|
- `project`: List available projects and sites. Use `project_id/site_id` with site commands. Also supports `project create`.
|
|
632
700
|
- `pull`: Download site files (including Func code under `backend/func/`) into a local workspace, three-way merging remote and local edits.
|
|
633
701
|
- `push`: Push local workspace changes to the remote site/project after a three-way conflict check.
|
|
@@ -640,6 +708,7 @@ Command meanings:
|
|
|
640
708
|
- `table`: Manage project JSON tables and records used by Func.
|
|
641
709
|
- `func`: Run project Func backend code with sample input. Func code itself is edited as `backend/func` site files and synced with pull/push.
|
|
642
710
|
- `upload`: Upload a local file as a Creght site asset and print its URL.
|
|
711
|
+
- `update`: Update the CLI to the latest published release, or report versions with `--check`.
|
|
643
712
|
- `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.
|
|
644
713
|
|
|
645
714
|
## Release
|
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
|