creght-cli 0.1.16 → 0.1.17

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
@@ -1,8 +1,8 @@
1
- # Cregh CLI
1
+ # Creght CLI
2
2
 
3
- Cregh CLI is a thin local bridge for syncing site code between a local directory and Cregh.
3
+ Creght CLI is a thin local bridge for syncing site code between a local directory and Creght.
4
4
 
5
- The CLI can also run a local Vite preview for pulled Cregh projects. Cregh remains responsible for cloud rendering, CMS, assets, and the realtime preview environment.
5
+ The CLI can also run a local Vite preview for pulled Creght projects. Creght remains responsible for cloud rendering, CMS, assets, and the realtime preview environment.
6
6
 
7
7
  ## Install
8
8
 
@@ -45,20 +45,20 @@ The command opens a browser authorization page. After authorization succeeds, th
45
45
  ~/Library/Application Support/creght/config.json
46
46
  ```
47
47
 
48
- The config file contains the API host and CLI token.
48
+ The config file contains the current 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.
49
49
 
50
50
  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
51
  For production, the default API host and default web host are both `https://creght.cn`.
52
52
 
53
53
  ## Logout
54
54
 
55
- Remove the saved CLI config:
55
+ Remove the saved CLI login for the current API host:
56
56
 
57
57
  ```bash
58
58
  creght logout
59
59
  ```
60
60
 
61
- This clears the saved token and any saved API host. The next command will use the production default unless you set `CREGHT_API_HOST`.
61
+ 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
62
 
63
63
  ## List Projects
64
64
 
@@ -120,10 +120,10 @@ The command writes remote files such as `/page/...`, `/component/...`, and `creg
120
120
 
121
121
  ## Local Vite Preview
122
122
 
123
- Cregh projects pulled by the CLI usually do not have their own `package.json`
123
+ Creght projects pulled by the CLI usually do not have their own `package.json`
124
124
  or `node_modules`. The local preview plugin therefore uses Vite only for local
125
125
  file serving and TSX transpilation; third-party packages continue to resolve
126
- through the Cregh import map, matching the Web editor preview model. In
126
+ through the Creght import map, matching the Web editor preview model. In
127
127
  `creght dev`, the CLI loads the platform import map from server system info and
128
128
  passes it to the Vite plugin; the plugin's local map is only a fallback.
129
129
 
@@ -167,7 +167,7 @@ module after local file changes without a full page reload.
167
167
 
168
168
  ## Push Local Changes
169
169
 
170
- Push the current local directory snapshot to Cregh and exit:
170
+ Push the current local directory snapshot to Creght and exit:
171
171
 
172
172
  ```bash
173
173
  creght push --site_id=<project_id>/<site_id> --dir=./mysite
@@ -179,7 +179,7 @@ For local development:
179
179
  CREGHT_API_HOST=http://localhost:8433 creght push --site_id=<project_id>/<site_id> --dir=./mysite
180
180
  ```
181
181
 
182
- The CLI scans the local directory and calls the existing Cregh `site_action`
182
+ The CLI scans the local directory and calls the existing Creght `site_action`
183
183
  API to create or update remote files.
184
184
 
185
185
  ## Sync Local Changes
@@ -198,12 +198,12 @@ CREGHT_API_HOST=http://localhost:8433 creght sync --site_id=<project_id>/<site_i
198
198
 
199
199
  `sync` first pushes the current local snapshot, then keeps running and
200
200
  automatically listens for local file changes. When a file is changed locally,
201
- the CLI calls the existing Cregh `site_action` API and updates the remote site
201
+ the CLI calls the existing Creght `site_action` API and updates the remote site
202
202
  in realtime. The command also prints the remote preview URL when available.
203
203
 
204
204
  ## Local Web Editor Bidirectional Sync
205
205
 
206
- Run local files and the online Cregh editor against the same cloud realtime
206
+ Run local files and the online Creght editor against the same cloud realtime
207
207
  files:
208
208
 
209
209
  ```bash
@@ -217,7 +217,7 @@ CREGHT_API_HOST=http://localhost:8433 creght dev --web=http://localhost:5173 --s
217
217
  ```
218
218
 
219
219
  The command prints the online Web editor URL, pushes local file changes to
220
- Cregh, and listens to the existing WebSocket collaboration channel so editor
220
+ Creght, and listens to the existing WebSocket collaboration channel so editor
221
221
  changes are written back to the local directory. MVP conflict handling is last
222
222
  write wins.
223
223
 
@@ -373,7 +373,7 @@ After creating or changing CMS collections or forms, run `creght pull` again to
373
373
 
374
374
  ## Upload Assets
375
375
 
376
- Upload a local file through the Cregh site asset flow:
376
+ Upload a local file through the Creght site asset flow:
377
377
 
378
378
  ```bash
379
379
  creght upload --site_id=<project_id>/<site_id> --file=./image.png
@@ -381,7 +381,7 @@ creght upload --site_id=<project_id>/<site_id> --file=./image.png
381
381
 
382
382
  The command prints the public file URL by default. Use `--json` to inspect the
383
383
  full upload metadata, including `site_path`, a stable `/_assets/...` path that
384
- can be used from Cregh site code:
384
+ can be used from Creght site code:
385
385
 
386
386
  ```bash
387
387
  creght upload --site_id=<project_id>/<site_id> --file=./image.png --json
@@ -398,7 +398,7 @@ creght upload --site_id=<project_id>/<site_id> --file=./image.png --name=hero.pn
398
398
  The current MVP push/sync mode is one-way:
399
399
 
400
400
  ```text
401
- local directory -> Cregh remote site
401
+ local directory -> Creght remote site
402
402
  ```
403
403
 
404
404
  `push` fetches the remote file list to build the local path to remote file id
@@ -418,12 +418,12 @@ source of truth.
418
418
 
419
419
  ## Commands
420
420
 
421
- Cregh CLI is a local bridge for Cregh site code. It can authenticate with
422
- Cregh, list projects and sites, pull remote site files into a local directory,
423
- push local files back to Cregh, watch local files for realtime sync, open the
421
+ Creght CLI is a local bridge for Creght site code. It can authenticate with
422
+ Creght, list projects and sites, pull remote site files into a local directory,
423
+ push local files back to Creght, watch local files for realtime sync, open the
424
424
  remote preview, and publish a site.
425
425
 
426
- The CLI commands still use the Cregh backend and web app for the canonical
426
+ The CLI commands still use the Creght backend and web app for the canonical
427
427
  preview. The Vite plugin is a local development helper and intentionally does
428
428
  not implement full production SSR.
429
429
 
@@ -449,8 +449,8 @@ creght version
449
449
 
450
450
  Command meanings:
451
451
 
452
- - `login`: Authenticate this machine with Cregh and save a CLI token.
453
- - `logout`: Remove the saved CLI token and API host configuration.
452
+ - `login`: Authenticate this machine with Creght and save a CLI token for the current API host.
453
+ - `logout`: Remove the saved CLI login for the current API host.
454
454
  - `project`: List available projects and sites. Use `project_id/site_id` with site commands. Also supports `project create`.
455
455
  - `pull`: Download the current remote site files into a local directory.
456
456
  - `push`: Push the current local directory snapshot to the remote site.
@@ -461,7 +461,7 @@ Command meanings:
461
461
  - `cms`: Manage CMS collections.
462
462
  - `content`: Manage CMS content entries.
463
463
  - `form`: Manage forms and form submissions.
464
- - `upload`: Upload a local file as a Cregh site asset and print its URL.
464
+ - `upload`: Upload a local file as a Creght site asset and print its URL.
465
465
  - `version`: Print the installed CLI version.
466
466
 
467
467
  ## Release
package/bin/creght.js CHANGED
@@ -15,7 +15,7 @@ const result = spawnSync(binary, process.argv.slice(2), {
15
15
  if (result.error) {
16
16
  if (result.error.code === "ENOENT") {
17
17
  console.error(
18
- "Cregh CLI binary is missing. Reinstall creght-cli and try again.",
18
+ "Creght CLI binary is missing. Reinstall creght-cli and try again.",
19
19
  );
20
20
  } else {
21
21
  console.error(result.error.message);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "creght-cli",
3
- "version": "0.1.16",
4
- "description": "Cregh CLI for syncing local site code with Cregh.",
3
+ "version": "0.1.17",
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",
7
7
  "repository": {
@@ -12,7 +12,7 @@ const checkOnly = process.argv.includes("--check");
12
12
 
13
13
  if (checkOnly) {
14
14
  const exists = fs.existsSync(binary);
15
- console.log(`Cregh CLI binary path for this platform: ${binary}`);
15
+ console.log(`Creght CLI binary path for this platform: ${binary}`);
16
16
  if (!exists) {
17
17
  console.log("Binary is not present in this local checkout. CI adds release binaries before npm publish.");
18
18
  }
@@ -21,7 +21,7 @@ if (checkOnly) {
21
21
 
22
22
  if (!fs.existsSync(binary)) {
23
23
  console.error(
24
- `Cregh CLI binary is missing for ${platform}-${arch}. Reinstall creght-cli and try again.`,
24
+ `Creght CLI binary is missing for ${platform}-${arch}. Reinstall creght-cli and try again.`,
25
25
  );
26
26
  process.exit(1);
27
27
  }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/vite/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import type { Plugin } from 'vite'
2
2
 
3
- export type CreghVitePluginOptions = {
3
+ export type CreghtVitePluginOptions = {
4
4
  /**
5
- * Local Cregh project root. Defaults to Vite's root.
5
+ * Local Creght project root. Defaults to Vite's root.
6
6
  */
7
7
  root?: string
8
8
  /**
9
- * Cregh API host used by the local /api proxy at runtime.
9
+ * Creght API host used by the local /api proxy at runtime.
10
10
  */
11
11
  apiHost?: string
12
12
  /**
@@ -24,5 +24,5 @@ export type CreghVitePluginOptions = {
24
24
  importMap?: Record<string, string>
25
25
  }
26
26
 
27
- export declare function creght(options?: CreghVitePluginOptions): Plugin
27
+ export declare function creght(options?: CreghtVitePluginOptions): Plugin
28
28
  export default creght
package/vite/index.js CHANGED
@@ -77,7 +77,7 @@ const contentTypeForPath = (file) => {
77
77
  const normalizeProjectPath = (value) => {
78
78
  const out = path.posix.normalize('/' + value.replaceAll(path.sep, '/').replace(/^\/+/, ''))
79
79
  if (out.startsWith('/../')) {
80
- throw new Error(`unsafe Cregh path: ${value}`)
80
+ throw new Error(`unsafe Creght path: ${value}`)
81
81
  }
82
82
  return out
83
83
  }
@@ -109,7 +109,7 @@ async function resolveFile(projectRoot, projectPath) {
109
109
  }
110
110
  }
111
111
 
112
- throw new Error(`Cregh module not found: ${projectPath}`)
112
+ throw new Error(`Creght module not found: ${projectPath}`)
113
113
  }
114
114
 
115
115
  async function readSiteConfig(projectRoot) {
@@ -338,7 +338,7 @@ async function renderPage() {
338
338
  let props = {};
339
339
 
340
340
  if (!Page) {
341
- throw new Error('Cregh page has no default export: ${entryFile}');
341
+ throw new Error('Creght page has no default export: ${entryFile}');
342
342
  }
343
343
 
344
344
  if (typeof pageModule.getServerSideProps === 'function') {
@@ -367,7 +367,7 @@ hot.on('creght:update', () => {
367
367
  async function renderHtml(projectRoot, pathname, options) {
368
368
  const routes = await listPages(projectRoot)
369
369
  if (routes.length === 0) {
370
- return `<!doctype html><div style="font:14px system-ui;padding:24px">No Cregh pages found in <code>/page</code>.</div>`
370
+ return `<!doctype html><div style="font:14px system-ui;padding:24px">No Creght pages found in <code>/page</code>.</div>`
371
371
  }
372
372
 
373
373
  const matched = matchRoute(routes, pathname)
@@ -380,7 +380,7 @@ async function renderHtml(projectRoot, pathname, options) {
380
380
  <head>
381
381
  <meta charset="UTF-8">
382
382
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
383
- <title>${escapeHtml(matched.route === '/' ? 'Cregh' : matched.route)}</title>
383
+ <title>${escapeHtml(matched.route === '/' ? 'Creght' : matched.route)}</title>
384
384
  <script type="importmap">${jsonScript({ imports })}</script>
385
385
  <script type="module" src="/@vite/client"></script>
386
386
  <style type="text/tailwindcss">${indexCss}</style>
@@ -408,7 +408,7 @@ export function creght(options = {}) {
408
408
  },
409
409
  configureServer(server) {
410
410
  const hmrTimers = new Map()
411
- const sendCreghUpdate = (file) => {
411
+ const sendCreghtUpdate = (file) => {
412
412
  if (!file.startsWith(projectRoot)) return
413
413
 
414
414
  const projectPath = normalizeProjectPath(path.relative(projectRoot, file))
@@ -429,9 +429,9 @@ export function creght(options = {}) {
429
429
  }
430
430
 
431
431
  server.watcher.add(path.join(projectRoot, '**/*'))
432
- server.watcher.on('change', sendCreghUpdate)
433
- server.watcher.on('add', sendCreghUpdate)
434
- server.watcher.on('unlink', sendCreghUpdate)
432
+ server.watcher.on('change', sendCreghtUpdate)
433
+ server.watcher.on('add', sendCreghtUpdate)
434
+ server.watcher.on('unlink', sendCreghtUpdate)
435
435
 
436
436
  server.middlewares.use(async (req, res, next) => {
437
437
  try {