@42ws/cli 0.1.14 → 0.1.15
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 +9 -225
- package/cli.js +39 -0
- package/package.json +5 -21
- package/bin/cli.js +0 -10
- package/dist/commands/chatlog.d.ts +0 -10
- package/dist/commands/chatlog.d.ts.map +0 -1
- package/dist/commands/chatlog.js +0 -103
- package/dist/commands/chatlog.js.map +0 -1
- package/dist/commands/collections.d.ts +0 -39
- package/dist/commands/collections.d.ts.map +0 -1
- package/dist/commands/collections.js +0 -1186
- package/dist/commands/collections.js.map +0 -1
- package/dist/commands/context.d.ts +0 -12
- package/dist/commands/context.d.ts.map +0 -1
- package/dist/commands/context.js +0 -271
- package/dist/commands/context.js.map +0 -1
- package/dist/commands/dev.d.ts +0 -13
- package/dist/commands/dev.d.ts.map +0 -1
- package/dist/commands/dev.js +0 -372
- package/dist/commands/dev.js.map +0 -1
- package/dist/commands/domains.d.ts +0 -10
- package/dist/commands/domains.d.ts.map +0 -1
- package/dist/commands/domains.js +0 -179
- package/dist/commands/domains.js.map +0 -1
- package/dist/commands/editlog.d.ts +0 -12
- package/dist/commands/editlog.d.ts.map +0 -1
- package/dist/commands/editlog.js +0 -188
- package/dist/commands/editlog.js.map +0 -1
- package/dist/commands/forms.d.ts +0 -23
- package/dist/commands/forms.d.ts.map +0 -1
- package/dist/commands/forms.js +0 -558
- package/dist/commands/forms.js.map +0 -1
- package/dist/commands/init.d.ts +0 -18
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -197
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/login.d.ts +0 -7
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -110
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts +0 -2
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js +0 -31
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/open.d.ts +0 -6
- package/dist/commands/open.d.ts.map +0 -1
- package/dist/commands/open.js +0 -54
- package/dist/commands/open.js.map +0 -1
- package/dist/commands/prompts.d.ts +0 -7
- package/dist/commands/prompts.d.ts.map +0 -1
- package/dist/commands/prompts.js +0 -55
- package/dist/commands/prompts.js.map +0 -1
- package/dist/commands/publish.d.ts +0 -19
- package/dist/commands/publish.d.ts.map +0 -1
- package/dist/commands/publish.js +0 -437
- package/dist/commands/publish.js.map +0 -1
- package/dist/commands/pull.d.ts +0 -7
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js +0 -157
- package/dist/commands/pull.js.map +0 -1
- package/dist/commands/sites.d.ts +0 -13
- package/dist/commands/sites.d.ts.map +0 -1
- package/dist/commands/sites.js +0 -316
- package/dist/commands/sites.js.map +0 -1
- package/dist/commands/upgrade.d.ts +0 -2
- package/dist/commands/upgrade.d.ts.map +0 -1
- package/dist/commands/upgrade.js +0 -15
- package/dist/commands/upgrade.js.map +0 -1
- package/dist/commands/whoami.d.ts +0 -4
- package/dist/commands/whoami.d.ts.map +0 -1
- package/dist/commands/whoami.js +0 -98
- package/dist/commands/whoami.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -428
- package/dist/index.js.map +0 -1
- package/dist/lib/api.d.ts +0 -12
- package/dist/lib/api.d.ts.map +0 -1
- package/dist/lib/api.js +0 -121
- package/dist/lib/api.js.map +0 -1
- package/dist/lib/config.d.ts +0 -27
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js +0 -65
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/detect.d.ts +0 -9
- package/dist/lib/detect.d.ts.map +0 -1
- package/dist/lib/detect.js +0 -112
- package/dist/lib/detect.js.map +0 -1
- package/dist/lib/files.d.ts +0 -16
- package/dist/lib/files.d.ts.map +0 -1
- package/dist/lib/files.js +0 -200
- package/dist/lib/files.js.map +0 -1
- package/dist/lib/html.d.ts +0 -8
- package/dist/lib/html.d.ts.map +0 -1
- package/dist/lib/html.js +0 -63
- package/dist/lib/html.js.map +0 -1
- package/dist/lib/i18n.d.ts +0 -6
- package/dist/lib/i18n.d.ts.map +0 -1
- package/dist/lib/i18n.js +0 -256
- package/dist/lib/i18n.js.map +0 -1
- package/dist/lib/import-prompts.d.ts +0 -46
- package/dist/lib/import-prompts.d.ts.map +0 -1
- package/dist/lib/import-prompts.js +0 -279
- package/dist/lib/import-prompts.js.map +0 -1
- package/dist/lib/inspector-client.d.ts +0 -3
- package/dist/lib/inspector-client.d.ts.map +0 -1
- package/dist/lib/inspector-client.js +0 -253
- package/dist/lib/inspector-client.js.map +0 -1
- package/dist/lib/output.d.ts +0 -11
- package/dist/lib/output.d.ts.map +0 -1
- package/dist/lib/output.js +0 -49
- package/dist/lib/output.js.map +0 -1
- package/dist/lib/project.d.ts +0 -25
- package/dist/lib/project.d.ts.map +0 -1
- package/dist/lib/project.js +0 -62
- package/dist/lib/project.js.map +0 -1
- package/dist/lib/suggest.d.ts +0 -12
- package/dist/lib/suggest.d.ts.map +0 -1
- package/dist/lib/suggest.js +0 -36
- package/dist/lib/suggest.js.map +0 -1
- package/dist/lib/update-check.d.ts +0 -22
- package/dist/lib/update-check.d.ts.map +0 -1
- package/dist/lib/update-check.js +0 -182
- package/dist/lib/update-check.js.map +0 -1
- package/dist/run.d.ts +0 -2
- package/dist/run.d.ts.map +0 -1
- package/dist/run.js +0 -17
- package/dist/run.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -3
- package/dist/version.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,235 +1,19 @@
|
|
|
1
1
|
# @42ws/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**npm 経由でのこのパッケージの配布は終了しました。**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`@42ws/cli` は現在、npm/npx ではなくシングルバイナリで配布しています。以下でインストールしてください。
|
|
6
6
|
|
|
7
|
+
```bash
|
|
8
|
+
curl -fsSL https://get.42ws.com | sh
|
|
7
9
|
```
|
|
8
|
-
npx @42ws/cli@latest login --token ws_xxx
|
|
9
|
-
npx @42ws/cli@latest publish --site my-site --dir dist
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Commands
|
|
13
|
-
|
|
14
|
-
### `42ws login`
|
|
15
|
-
|
|
16
|
-
Authenticate with your 42ws token.
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
42ws login --token ws_xxx
|
|
20
|
-
42ws login # no token → browser-based device login
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
If `--token` is omitted, a browser-based login flow starts (device code). The CLI talks to `https://api.42ws.com` by default; set `FORTYTWO_WS_API_URL` only if you need a different environment.
|
|
24
|
-
|
|
25
|
-
### `42ws publish`
|
|
26
|
-
|
|
27
|
-
Publish a static site.
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
42ws publish --site my-site --dir dist
|
|
31
|
-
42ws publish --site my-site --build "npm run build"
|
|
32
|
-
42ws publish --site my-site --message "Release v1.0"
|
|
33
|
-
42ws publish --site my-site --json
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Options:
|
|
37
|
-
- `--site <name>` — Site name (required, or set in `42ws.json`)
|
|
38
|
-
- `--dir <path>` — Output directory (default: `dist`)
|
|
39
|
-
- `--build <cmd>` — Build command to run before publishing
|
|
40
|
-
- `--no-build` — Skip the build step
|
|
41
|
-
- `--message <text>` — Deployment message
|
|
42
|
-
- `--yes` — Skip non-destructive confirmation prompts
|
|
43
|
-
- `--allow-detach` — Allow publish even when it would remove an embedded form
|
|
44
|
-
- `--json` — Output results as JSON
|
|
45
|
-
|
|
46
|
-
Embed protection: if any AI-imported form is linked to this site (`linkedSite`), the CLI refuses to publish when the local source no longer contains the embed snippet (looking for `data-api-key="<form-key>"`). Use `--allow-detach` to override.
|
|
47
|
-
|
|
48
|
-
### `42ws pull`
|
|
49
|
-
|
|
50
|
-
Download the live published files of a site to a local directory. Useful before re-publishing a site that has linked forms — pull, merge your changes, then publish.
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
42ws pull --site my-site --dir ./live
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### `42ws sites`
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
42ws sites list
|
|
60
|
-
42ws sites create <name>
|
|
61
|
-
42ws sites delete <name> --force
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
`sites delete` is destructive and requires `--force` (not just `--yes`). If the site has linked forms, the CLI prints them and asks whether to also delete them. Use `--delete-forms` / `--keep-forms` for non-interactive control.
|
|
65
|
-
|
|
66
|
-
### `42ws forms import`
|
|
67
|
-
|
|
68
|
-
Extract a form from existing HTML and create a 42ws form (Claude Haiku is used to identify fields, theme color, and CSS).
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
42ws forms import --site my-site --page contact.html --notify you@example.com --inject
|
|
72
|
-
42ws forms import --url https://example.com/contact --notify you@example.com
|
|
73
|
-
42ws forms import --file ./contact.html --notify you@example.com --inject
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Source (one required):
|
|
77
|
-
- `--site <name> --page <html>` — Pull from a 42ws-hosted site page
|
|
78
|
-
- `--url <url>` — Fetch from any URL
|
|
79
|
-
- `--file <path>` — Read from a local HTML file
|
|
80
|
-
|
|
81
|
-
Options:
|
|
82
|
-
- `--notify <email>` — Notification email (required)
|
|
83
|
-
- `--name <name>` — Override the AI-extracted form name
|
|
84
|
-
- `--inject` — Replace the source `<form>` with the embed snippet
|
|
85
|
-
- `--site` mode: re-publishes the page
|
|
86
|
-
- `--file` mode: overwrites the local file
|
|
87
|
-
|
|
88
|
-
### `42ws collections import`
|
|
89
|
-
|
|
90
|
-
Turn a list/blog/works page into a CMS collection (Claude generates the index/detail templates). Entries are then added with `42ws collections entries add`.
|
|
91
|
-
|
|
92
|
-
```
|
|
93
|
-
42ws collections import --site my-site --page news.html --inject
|
|
94
|
-
42ws collections entries add coll_xxx --title "新着" --main-image ./hero.jpg --tags お知らせ --status published
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
- `--inject` replaces the list area with the embed and re-publishes
|
|
98
|
-
- Entry fields are fixed: `title / slug / body / mainImage / subImages / publishedAt / status / tags`. Categories are expressed as a tag.
|
|
99
|
-
|
|
100
|
-
### `42ws dev`
|
|
101
|
-
|
|
102
|
-
Local preview server with an AI page inspector. Serves your site at `localhost:4242` and injects a "検証する" toolbar; clicking an element copies a diagnostic pack (selector / outerHTML / recent errors) for pasting into your AI.
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
42ws dev # serve current dir at localhost:4242
|
|
106
|
-
42ws dev errors [site] # show recent client JS/HTTP errors
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### `42ws domains`
|
|
110
10
|
|
|
111
|
-
|
|
11
|
+
インストール後、既存プロジェクトのディレクトリで一度だけ再実行してください:
|
|
112
12
|
|
|
13
|
+
```bash
|
|
14
|
+
42ws init
|
|
113
15
|
```
|
|
114
|
-
42ws domains add example.com --site my-site # おまかせ DNS (recommended): point NS to 42ws, everything automatic
|
|
115
|
-
42ws domains add www.example.com --site my-site --cname # manual CNAME: keep your NS, add records yourself
|
|
116
|
-
42ws domains verify example.com --site my-site # check status / show next steps
|
|
117
|
-
42ws domains list --site my-site
|
|
118
|
-
42ws domains rm example.com --site my-site
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
- **おまかせ DNS (default):** set your registrar's nameservers to the 4 returned by `add`; the cert and DNS records (apex included) are then managed automatically.
|
|
122
|
-
- **manual CNAME (`--cname`):** for domains already using email etc. — you add the validation CNAME and final CNAME yourself.
|
|
123
|
-
|
|
124
|
-
### `42ws prompts get <name>`
|
|
125
|
-
|
|
126
|
-
Print an AI-facing guide. `cli` (overall), `context` (site build conventions), `sitecard`, `inspector` (page diagnostics), `migrate` (move an existing site to 42ws).
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
42ws prompts get migrate
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### `42ws whoami`
|
|
133
|
-
|
|
134
|
-
Show the logged-in user, the target environment, and the plan features available on the account.
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
42ws whoami
|
|
138
|
-
42ws whoami --json
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Output includes the API endpoint (so you can tell which environment you're on) and which features your plan enables (hosting / contact form / collection / custom domains). AI agents should check this before proposing features so they don't suggest something the plan can't use.
|
|
142
|
-
|
|
143
|
-
## Localization
|
|
144
|
-
|
|
145
|
-
The CLI auto-detects locale from `LANG` / `LC_ALL` env vars and falls back to the OS locale via `Intl`. Override explicitly with `--lang ja` or `--lang en`. Currently supports English and Japanese.
|
|
146
|
-
|
|
147
|
-
## Configuration file
|
|
148
|
-
|
|
149
|
-
Place a `42ws.json` in your project root:
|
|
150
|
-
|
|
151
|
-
```json
|
|
152
|
-
{
|
|
153
|
-
"site": "my-site",
|
|
154
|
-
"build": "npm run build",
|
|
155
|
-
"output": "dist"
|
|
156
|
-
}
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
CLI arguments take precedence over the configuration file.
|
|
160
|
-
|
|
161
|
-
## Environment variables
|
|
162
|
-
|
|
163
|
-
| Variable | Description |
|
|
164
|
-
|---|---|
|
|
165
|
-
| `FORTYTWO_WS_TOKEN` | Override the stored auth token |
|
|
166
|
-
| `FORTYTWO_WS_API_URL` | Override the API URL |
|
|
167
|
-
|
|
168
|
-
## JSON output mode
|
|
169
|
-
|
|
170
|
-
Use `--json` for machine-readable output (useful in CI / AI agents):
|
|
171
|
-
|
|
172
|
-
**Success:**
|
|
173
|
-
```json
|
|
174
|
-
{"ok":true,"status":"published","url":"https://my-site.42ws.com","site":"my-site","version":"pub_xxx"}
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
**Failure:**
|
|
178
|
-
```json
|
|
179
|
-
{"ok":false,"error":{"code":"NOT_LOGGED_IN","message":"You are not logged in.","suggestedFix":"Run `42ws login --token <your-token>` to authenticate."}}
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
Every error includes a `code`, `message`, and `suggestedFix`. AI agents should read `suggestedFix` and apply the suggested change before retrying.
|
|
183
|
-
|
|
184
|
-
## For AI Agents
|
|
185
|
-
|
|
186
|
-
This CLI is designed to be driven by AI coding agents (Claude Code, Cursor, etc.).
|
|
187
|
-
|
|
188
|
-
### Recommended invocation
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
npx @42ws/cli@latest publish --yes --json
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
- `--yes` skips all interactive prompts
|
|
195
|
-
- `--json` makes output machine-readable
|
|
196
|
-
|
|
197
|
-
### Behavior contract
|
|
198
|
-
|
|
199
|
-
- All commands return `{"ok": true, ...}` on success or `{"ok": false, "error": {...}}` on failure.
|
|
200
|
-
- Errors always include `code`, `message`, and `suggestedFix`. Read `suggestedFix` and apply it before retrying.
|
|
201
|
-
- The CLI never opens a browser or asks for input when `--yes` is set.
|
|
202
|
-
- Site names are auto-derived from the directory name when `--yes` is set and no `--site` is given.
|
|
203
|
-
- Frameworks (Vite / Astro / Next static export / SvelteKit static / plain HTML) are auto-detected from `package.json` and the directory contents.
|
|
204
|
-
|
|
205
|
-
### Rules for AI agents
|
|
206
|
-
|
|
207
|
-
- **Do not** ask the user for AWS credentials, S3 buckets, or CloudFront — 42ws abstracts these away.
|
|
208
|
-
- **Do not** publish backend code (API routes, server functions, databases). Only static files.
|
|
209
|
-
- **Do not** publish secret files. The CLI rejects `.env`, `.git/`, `node_modules/`, `*.pem`, `*.key`, `id_rsa`, `id_ed25519` automatically.
|
|
210
|
-
- **Do** read `error.suggestedFix` and apply it before retrying.
|
|
211
|
-
- **Do** return the published URL to the user.
|
|
212
|
-
|
|
213
|
-
### Common error codes
|
|
214
|
-
|
|
215
|
-
| Code | Meaning | Fix |
|
|
216
|
-
|---|---|---|
|
|
217
|
-
| `NOT_LOGGED_IN` | No saved auth | Run `npx @42ws/cli@latest login` (browser auth) |
|
|
218
|
-
| `INVALID_SITE_NAME` | Site name missing or invalid | Add `--site <name>` or pass `--yes` to use directory name |
|
|
219
|
-
| `RESERVED_SITE_NAME` | Subdomain reserved | Pick a different name |
|
|
220
|
-
| `SITE_NAME_TAKEN` | Site already owned by someone | Pick a different name |
|
|
221
|
-
| `OUTPUT_DIR_NOT_FOUND` | `dist/` etc. missing | Run the build command first or pass `--dir <path>` |
|
|
222
|
-
| `NO_FILES_FOUND` | No files to publish | Check `--dir` is correct |
|
|
223
|
-
| `BLOCKED_FILE` | Secret file would be uploaded | Remove the file or add to `.gitignore` |
|
|
224
|
-
| `BUILD_FAILED` | Build command exited non-zero | Fix the build error first |
|
|
225
|
-
| `FORBIDDEN` | License not enabled or not site owner | Ask the account owner |
|
|
226
|
-
| `EMBED_DETACH_BLOCKED` | Publish would remove an embedded form | Pull the live first (`42ws pull`) and merge, or pass `--allow-detach` |
|
|
227
|
-
| `CONFIRMATION_REQUIRED` | Destructive op needs explicit confirmation | Add `--force` |
|
|
228
|
-
|
|
229
|
-
### Suggested user-facing prompt
|
|
230
|
-
|
|
231
|
-
Users can paste this into their AI assistant:
|
|
232
16
|
|
|
233
|
-
|
|
17
|
+
`CLAUDE.md` / `AGENTS.md` が、`npx @42ws/cli ...` ではなく `42ws` コマンドを直接呼び出す最新の使い方に更新されます。
|
|
234
18
|
|
|
235
|
-
|
|
19
|
+
詳細: https://42ws.com
|
package/cli.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const args = process.argv.slice(2);
|
|
4
|
+
const isJson = args.includes('--json');
|
|
5
|
+
|
|
6
|
+
const INSTALL_CMD = 'curl -fsSL https://get.42ws.com | sh';
|
|
7
|
+
|
|
8
|
+
if (isJson) {
|
|
9
|
+
process.stdout.write(
|
|
10
|
+
JSON.stringify({
|
|
11
|
+
ok: false,
|
|
12
|
+
error: {
|
|
13
|
+
code: 'NPM_DISTRIBUTION_ENDED',
|
|
14
|
+
message:
|
|
15
|
+
'npm 経由での @42ws/cli 配布は終了しました。最新版はシングルバイナリ配布です。以下を実行してインストールし直してください。',
|
|
16
|
+
install: INSTALL_CMD,
|
|
17
|
+
},
|
|
18
|
+
}) + '\n'
|
|
19
|
+
);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
process.stderr.write(
|
|
24
|
+
[
|
|
25
|
+
'',
|
|
26
|
+
'❌ @42ws/cli の npm 配布は終了しました(このパッケージは古いままです)。',
|
|
27
|
+
'',
|
|
28
|
+
'次の手順でシングルバイナリ版に切り替えてください:',
|
|
29
|
+
'',
|
|
30
|
+
` 1. インストール: ${INSTALL_CMD}`,
|
|
31
|
+
' 2. 現在のプロジェクトディレクトリで再実行: 42ws init',
|
|
32
|
+
' → CLAUDE.md / AGENTS.md が「npx @42ws/cli ...」ではなく',
|
|
33
|
+
' 「42ws ...」コマンドを直接呼ぶ最新の使い方に更新されます。',
|
|
34
|
+
'',
|
|
35
|
+
'詳細: https://42ws.com',
|
|
36
|
+
'',
|
|
37
|
+
].join('\n') + '\n'
|
|
38
|
+
);
|
|
39
|
+
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,37 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@42ws/cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.15",
|
|
4
|
+
"description": "npm 経由の配布は終了しました。最新版はシングルバイナリ配布です: curl -fsSL https://get.42ws.com | sh",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
9
|
"bin": {
|
|
10
|
-
"42ws": "
|
|
10
|
+
"42ws": "cli.js"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
|
-
"
|
|
14
|
-
"
|
|
13
|
+
"cli.js",
|
|
14
|
+
"README.md"
|
|
15
15
|
],
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"homepage": "https://42ws.com",
|
|
18
|
-
"keywords": [
|
|
19
|
-
"static-site",
|
|
20
|
-
"hosting",
|
|
21
|
-
"deploy",
|
|
22
|
-
"publish",
|
|
23
|
-
"cli"
|
|
24
|
-
],
|
|
25
|
-
"scripts": {
|
|
26
|
-
"gen-version": "node ../../scripts/gen-version.mjs",
|
|
27
|
-
"build": "npm run gen-version && tsc -p tsconfig.json",
|
|
28
|
-
"prepublishOnly": "npm run build"
|
|
29
|
-
},
|
|
30
18
|
"engines": {
|
|
31
19
|
"node": ">=18"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"typescript": "^5.7.0",
|
|
35
|
-
"@types/node": "^22.0.0"
|
|
36
20
|
}
|
|
37
21
|
}
|
package/bin/cli.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import('../dist/index.js').then(m => m.main()).catch(e => {
|
|
3
|
-
if (e && e.name === 'ApiError') {
|
|
4
|
-
process.stderr.write(`Error [${e.code}]: ${e.message}\n`);
|
|
5
|
-
if (e.suggestedFix) process.stderr.write(` Fix: ${e.suggestedFix}\n`);
|
|
6
|
-
} else {
|
|
7
|
-
console.error(e?.message || e);
|
|
8
|
-
}
|
|
9
|
-
process.exit(1);
|
|
10
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface ChatLogOpts {
|
|
2
|
-
subcommand?: string;
|
|
3
|
-
positional: string[];
|
|
4
|
-
json?: boolean;
|
|
5
|
-
session?: string;
|
|
6
|
-
limit?: string;
|
|
7
|
-
help?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare function chatlog(opts: ChatLogOpts): Promise<void>;
|
|
10
|
-
//# sourceMappingURL=chatlog.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chatlog.d.ts","sourceRoot":"","sources":["../../src/commands/chatlog.ts"],"names":[],"mappings":"AAmDA,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA6D9D"}
|
package/dist/commands/chatlog.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { loadConfig } from '../lib/config.js';
|
|
2
|
-
import { apiRequest, ApiError } from '../lib/api.js';
|
|
3
|
-
import { info, error, isJsonMode } from '../lib/output.js';
|
|
4
|
-
const HELP = `
|
|
5
|
-
42ws chatlog — Inspect AI chat history
|
|
6
|
-
|
|
7
|
-
Usage:
|
|
8
|
-
42ws chatlog list <site> [--session <sessionId>] [--limit N]
|
|
9
|
-
|
|
10
|
-
Options:
|
|
11
|
-
--session <id> Show messages for a specific session (default: latest across all)
|
|
12
|
-
--limit N Max entries to show (default 100, max 500)
|
|
13
|
-
--json Output as JSON
|
|
14
|
-
|
|
15
|
-
Notes:
|
|
16
|
-
- Each editor visit creates a fresh session. Messages within a session are time-ordered.
|
|
17
|
-
- Failed AI attempts and system errors are also recorded.
|
|
18
|
-
|
|
19
|
-
Examples:
|
|
20
|
-
42ws chatlog list my-site
|
|
21
|
-
42ws chatlog list my-site --session 8f2c... --json
|
|
22
|
-
`.trim();
|
|
23
|
-
function formatRelativeTime(iso) {
|
|
24
|
-
const d = new Date(iso);
|
|
25
|
-
const diff = Date.now() - d.getTime();
|
|
26
|
-
const min = Math.floor(diff / 60_000);
|
|
27
|
-
if (min < 1)
|
|
28
|
-
return 'たった今';
|
|
29
|
-
if (min < 60)
|
|
30
|
-
return `${min}分前`;
|
|
31
|
-
const hr = Math.floor(min / 60);
|
|
32
|
-
if (hr < 24)
|
|
33
|
-
return `${hr}時間前`;
|
|
34
|
-
const day = Math.floor(hr / 24);
|
|
35
|
-
if (day < 30)
|
|
36
|
-
return `${day}日前`;
|
|
37
|
-
return d.toLocaleDateString('ja-JP');
|
|
38
|
-
}
|
|
39
|
-
export async function chatlog(opts) {
|
|
40
|
-
if (opts.help || opts.positional.includes('--help')) {
|
|
41
|
-
process.stdout.write(HELP + '\n');
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const sub = opts.subcommand;
|
|
45
|
-
if (!sub) {
|
|
46
|
-
process.stdout.write(HELP + '\n');
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const cfg = loadConfig();
|
|
50
|
-
if (!cfg.token || !cfg.apiUrl) {
|
|
51
|
-
error('NOT_LOGGED_IN', 'ログインしてください: 42ws login --token <api-token>');
|
|
52
|
-
process.exit(1);
|
|
53
|
-
}
|
|
54
|
-
if (sub === 'list') {
|
|
55
|
-
const site = opts.positional[0];
|
|
56
|
-
if (!site) {
|
|
57
|
-
error('INVALID_ARGS', 'Usage: 42ws chatlog list <site> [--session <id>]');
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
const qs = new URLSearchParams();
|
|
61
|
-
if (opts.session)
|
|
62
|
-
qs.set('session', opts.session);
|
|
63
|
-
if (opts.limit)
|
|
64
|
-
qs.set('limit', opts.limit);
|
|
65
|
-
try {
|
|
66
|
-
const res = await apiRequest(cfg, 'GET', `/v1/sites/${encodeURIComponent(site)}/chatlog${qs.size ? '?' + qs.toString() : ''}`);
|
|
67
|
-
if (isJsonMode()) {
|
|
68
|
-
process.stdout.write(JSON.stringify(res.entries, null, 2) + '\n');
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (res.entries.length === 0) {
|
|
72
|
-
info('チャット履歴なし');
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
// session ごとにグループ化(指定なし時の見やすさのため)
|
|
76
|
-
let lastSession = null;
|
|
77
|
-
for (const e of res.entries) {
|
|
78
|
-
if (e.sessionId !== lastSession) {
|
|
79
|
-
if (lastSession !== null)
|
|
80
|
-
process.stdout.write('\n');
|
|
81
|
-
process.stdout.write(`-- session ${e.sessionId.slice(0, 8)}…\n`);
|
|
82
|
-
lastSession = e.sessionId;
|
|
83
|
-
}
|
|
84
|
-
const time = formatRelativeTime(e.createdAt);
|
|
85
|
-
const roleLabel = e.role === 'user' ? 'U' : e.role === 'assistant' ? 'A' : 'S';
|
|
86
|
-
const link = e.associatedEditId ? ` -> edit:${e.associatedEditId.slice(0, 12)}` : '';
|
|
87
|
-
process.stdout.write(` [${roleLabel}] ${time.padEnd(8)} ${e.text}${link}\n`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
catch (err) {
|
|
91
|
-
if (err instanceof ApiError)
|
|
92
|
-
error(err.code, err.message, err.suggestedFix);
|
|
93
|
-
else
|
|
94
|
-
error('UNKNOWN', err instanceof Error ? err.message : String(err));
|
|
95
|
-
process.exit(1);
|
|
96
|
-
}
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
error('UNKNOWN_SUBCOMMAND', `Unknown subcommand: ${sub}`);
|
|
100
|
-
process.stdout.write(HELP + '\n');
|
|
101
|
-
process.exit(1);
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=chatlog.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chatlog.js","sourceRoot":"","sources":["../../src/commands/chatlog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAgB3D,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;CAkBZ,CAAC,IAAI,EAAE,CAAC;AAET,SAA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K,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO;IACT,CAAC;IAED,KAAK,CAAC,oBAAoB,EAAE,uBAAuB,GAAG,EAAE,CAAC,CAAC;IAC1D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
interface CollectionsArgs {
|
|
2
|
-
subcommand?: string;
|
|
3
|
-
positional: string[];
|
|
4
|
-
help?: boolean;
|
|
5
|
-
json?: boolean;
|
|
6
|
-
site?: string;
|
|
7
|
-
page?: string;
|
|
8
|
-
url?: string;
|
|
9
|
-
file?: string;
|
|
10
|
-
name?: string;
|
|
11
|
-
slug?: string;
|
|
12
|
-
inject?: boolean;
|
|
13
|
-
force?: boolean;
|
|
14
|
-
title?: string;
|
|
15
|
-
body?: string;
|
|
16
|
-
bodyFile?: string;
|
|
17
|
-
mainImage?: string;
|
|
18
|
-
subImages?: string;
|
|
19
|
-
status?: 'draft' | 'published';
|
|
20
|
-
publishedAt?: string;
|
|
21
|
-
tags?: string;
|
|
22
|
-
data?: string;
|
|
23
|
-
dataFile?: string;
|
|
24
|
-
fromJson?: string;
|
|
25
|
-
upsert?: boolean;
|
|
26
|
-
field?: string;
|
|
27
|
-
out?: string;
|
|
28
|
-
pageShellFile?: string;
|
|
29
|
-
pageShellInline?: string;
|
|
30
|
-
indexTemplateFile?: string;
|
|
31
|
-
indexTemplateInline?: string;
|
|
32
|
-
detailTemplateFile?: string;
|
|
33
|
-
detailTemplateInline?: string;
|
|
34
|
-
themeColor?: string;
|
|
35
|
-
republish?: boolean;
|
|
36
|
-
}
|
|
37
|
-
export declare function collections(args: CollectionsArgs): Promise<void>;
|
|
38
|
-
export {};
|
|
39
|
-
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../src/commands/collections.ts"],"names":[],"mappings":"AA0FA,UAAU,eAAe;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,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