@hayatosc/sites 0.0.0-stage → 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,38 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2026-11-09
9
+
10
+ First published package shape for `@hayatosc/sites` (not yet on the npm registry at the time this file was added).
11
+
12
+ ### Added
13
+
14
+ - CLI for creating, deploying, and operating ChatGPT Sites (`sites` binary).
15
+ - Authentication via `SITES_ACCESS_TOKEN` or shared Codex credentials in `~/.codex/auth.json`.
16
+ - Site lifecycle: `create`, `list`, `info`, `open`, `delete`.
17
+ - Deploy pipeline: build/normalize, source sync, upload, deploy, `status`, `logs`.
18
+ - Versions: `create`, `list`, `get`/`show`, `rollback`.
19
+ - Environment: `list`, `get`, `set`, `unset`, `pull`, `push`, plus deploy-time `--env-file` / `--secrets-file`.
20
+ - Access, custom domains, and analytics commands.
21
+ - Diagnostics: `doctor`, `auth whoami [--check]`.
22
+ - Discovery: `cli search`, `docs search` (manual bundled into the CLI), `schema` / `schema --list`.
23
+ - Shell completion via `complete`.
24
+ - Wrangler project conversion and Worker bundling with Rolldown.
25
+ - Framework detection and build-output normalization aligned with Cloudflare's `cf` CLI conventions.
26
+ - Global flags: `--human`, `--quiet`, `--no-color`, `--dry-run`, `--help`, `--version`.
27
+ - Exit codes `0` / `1` / `130`.
28
+
29
+ ### Changed
30
+
31
+ - Migrated CLI parsing, help, and dispatch to Gunshi.
32
+ - Aligned command output with bare JSON success data (no `{ok,data,meta}` envelope).
33
+ - Agent help decoration now uses Gunshi's built-in agent detection.
34
+
35
+ ### Removed
36
+
37
+ - Project tooling commands previously used for scaffolding / local workflows (use your project's own tools instead).
38
+ - `--json` envelope mode and `--yes`/`-y` confirmation aliases (use `--force` where supported).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 hayatosc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,171 @@
1
- # Temporary Holding Version
1
+ # @hayatosc/sites
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm version](https://img.shields.io/npm/v/@hayatosc/sites.svg)](https://www.npmjs.com/package/@hayatosc/sites)
4
+ [![Node.js](https://img.shields.io/node/v/@hayatosc/sites.svg)](https://nodejs.org)
5
+ [![GitHub](https://img.shields.io/badge/github-hayatosc%2Fsites--cli-181717?logo=github)](https://github.com/hayatosc/sites-cli)
6
+
7
+ Deploy ChatGPT Sites projects from the command line.
8
+
9
+ `sites` creates, deploys, and operates ChatGPT Sites using shared Codex CLI credentials. There is no separate login or token store.
10
+
11
+ Requires **Node.js 22.13** or newer.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ # one-off
17
+ npx @hayatosc/sites --help
18
+
19
+ # or install globally
20
+ npm install -g @hayatosc/sites
21
+ sites --help
22
+ ```
23
+
24
+ pnpm and bun work the same way (`pnpm dlx`, `bunx`).
25
+
26
+ The published package keeps [Rolldown](https://rolldown.rs) as a normal runtime dependency (including its platform-specific native binding). Gunshi and tinyexec are bundled into `dist/cli.mjs`. Run the CLI with the package's installed dependencies; Worker projects do not need their own Rolldown install.
27
+
28
+ ## Quick start
29
+
30
+ Use an existing application project. Prepare `.openai/hosting.json` (static example):
31
+
32
+ ```json
33
+ {
34
+ "project_id": null,
35
+ "static": { "directory": "dist" }
36
+ }
37
+ ```
38
+
39
+ ```sh
40
+ npx @hayatosc/sites create my-site
41
+ npx @hayatosc/sites deploy
42
+ npx @hayatosc/sites open
43
+ ```
44
+
45
+ `create` creates the remote site and writes `project_id` into the manifest. `deploy` builds, syncs source, uploads the archive, and deploys. Scaffolding, local development, and type generation stay with your project's own tools. Worker manifests and Wrangler conversion are covered in the [configuration manual](docs/configuration.md).
46
+
47
+ ## Authentication
48
+
49
+ Credentials are resolved in this order:
50
+
51
+ 1. `SITES_ACCESS_TOKEN` (if set)
52
+ 2. `tokens.access_token` in `~/.codex/auth.json` (Codex CLI)
53
+
54
+ ```sh
55
+ npx @hayatosc/sites auth whoami
56
+ npx @hayatosc/sites auth whoami --check # connect to MCP and verify
57
+ ```
58
+
59
+ `auth whoami` reports `authenticated`, `authSource`, `tokenValid`, `accountId`, `expiresAt`, and `refreshTokenPresent`. Without credentials it succeeds with `authenticated: false` so scripts can inspect the result; `--check` requires working credentials.
60
+
61
+ ## Commands
62
+
63
+ | Command | Description |
64
+ | --- | --- |
65
+ | `sites create <slug>` | Create a site and save `project_id` |
66
+ | `sites list` | List sites |
67
+ | `sites info [project\|slug]` | Show site details |
68
+ | `sites complete [shell]` | Print shell completion setup |
69
+ | `sites deploy` | Build and deploy (`--prebuilt` skips the build) |
70
+ | `sites status [deployment_id]` | Show deployment status (`--watch` to wait) |
71
+ | `sites logs` | Fetch Worker logs (`--follow` to stream) |
72
+ | `sites versions create\|list\|get\|show\|rollback` | Manage versions |
73
+ | `sites env list\|get\|set\|unset\|pull\|push` | Manage environment variables |
74
+ | `sites access show\|set` | Manage access mode |
75
+ | `sites domains add\|get\|list\|refresh\|remove` | Manage custom domains |
76
+ | `sites analytics summary\|events` | Read analytics |
77
+ | `sites open` | Open in a browser (`--print` for the URL only) |
78
+ | `sites delete --force` | Delete a site |
79
+ | `sites doctor` | Diagnose the local environment and connection |
80
+ | `sites auth whoami [--check]` | Show identity status |
81
+ | `sites cli search <query>` | Rank up to five commands by intent |
82
+ | `sites docs search <query>` | Search the bundled manual |
83
+ | `sites schema <tool\|command..>` / `sites schema --list` | Print MCP tool input schemas |
84
+
85
+ Run `sites <command> --help` for command-specific flags. Agents should prefer `sites cli search` and `sites docs search` over chaining nested `--help` calls.
86
+
87
+ ### Manual
88
+
89
+ - [Projects](docs/projects.md) — setup, creation, listing, deletion, completion
90
+ - [Deployment](docs/deploy.md) — build, source sync, upload, status, logs
91
+ - [Operations](docs/operations.md) — versions, env, access, domains, analytics, doctor
92
+ - [Configuration](docs/configuration.md) — `hosting.json`, bindings, Wrangler conversion
93
+ - [Reference](docs/reference.md) — flags, environment variables, output shapes
94
+
95
+ ## Output and exit codes
96
+
97
+ Success data is bare JSON on stdout. Errors are human-readable on stderr. Search results are bare arrays. `logs --follow` streams NDJSON (human lines with `--human`).
98
+
99
+ | Code | Meaning |
100
+ | --- | --- |
101
+ | 0 | Success |
102
+ | 1 | Any failure (including a failed deployment build) |
103
+ | 130 | Interrupted or declined confirmation |
104
+
105
+ `--quiet` / `-q` suppresses results and progress, not errors (`--quiet=false` restores output). `--human` prints human-readable tables/text. There is no `--json` envelope mode and no `--yes`/`-y`; use `--force` (`-f`) where confirmation must be skipped.
106
+
107
+ Every command accepts `--dry-run`. Most commands preview parsed arguments only (no auth, network, or filesystem side effects). Deploy and version creation may still build locally; create and env push validate local inputs.
108
+
109
+ ## Configuration and environment
110
+
111
+ Site settings live in `.openai/hosting.json`. Common keys: `project_id`, `static.directory`, `static.not_found_handling`, `d1`, `r2`, `capabilities`. See [Configuration](docs/configuration.md).
112
+
113
+ | Variable | Description |
114
+ | --- | --- |
115
+ | `SITES_ACCESS_TOKEN` | Access token (overrides Codex auth file) |
116
+ | `SITES_AUTH_PATH` | Path to the Codex auth file |
117
+ | `SITES_AUTH_URL` | Token refresh endpoint |
118
+ | `SITES_MCP_URL` | MCP server URL |
119
+ | `SITES_API_BASE` | File API base URL |
120
+ | `SITES_RETRY_BASE_MS` | Base delay for rate-limit retries |
121
+ | `SITES_UPLOAD_POLL_MS` | Upload completion polling interval |
122
+ | `SITES_LOG_INTERVAL_MS` | `logs --follow` polling interval |
123
+ | `NO_COLOR` | Disable color |
124
+
125
+ Normal usage does not require any of these variables.
126
+
127
+ When `.openai/hosting.json` is absent and a Wrangler config is present, `deploy` can convert `wrangler.jsonc` / `wrangler.json` / `wrangler.toml` and bundle the Worker with Rolldown. Unsupported bindings stop the conversion unless you pass `--allow-unsupported <kind>`.
128
+
129
+ ## Examples
130
+
131
+ ```sh
132
+ # Deploy with a message; skip confirmation when making a site public
133
+ npx @hayatosc/sites deploy --message "Update pricing" --public --force
134
+
135
+ # Deploy an already-built dist/
136
+ npx @hayatosc/sites deploy --prebuilt --allow-dirty
137
+
138
+ # Apply env and secrets during deploy
139
+ npx @hayatosc/sites deploy --env-file .env.production --secrets-file .env.secrets
140
+
141
+ # Watch a deployment finish
142
+ npx @hayatosc/sites status --watch
143
+
144
+ # Roll back to the previous successful version
145
+ npx @hayatosc/sites versions rollback --previous --force
146
+
147
+ # Find a command or a manual section
148
+ npx @hayatosc/sites cli search "custom domain"
149
+ npx @hayatosc/sites docs search "not_found_handling"
150
+ ```
151
+
152
+ ## Development
153
+
154
+ ```sh
155
+ npm install
156
+ npm run typecheck # vp check
157
+ npm test # vp test
158
+ npm run build # vp pack → dist/cli.mjs
159
+ ```
160
+
161
+ Build, test, lint, formatting, and type checking use [Vite+](https://viteplus.dev) (`vp`). The user manual in `docs/` is embedded into the CLI at build time, so `sites docs search` does not need a local `docs/` directory after install.
162
+
163
+ `dist/` is produced by the build and is gitignored; `prepack` rebuilds before `npm pack` / publish.
164
+
165
+ ## Contributing
166
+
167
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
168
+
169
+ ## License
170
+
171
+ [MIT](LICENSE) © 2026 hayatosc