@42ws/cli 0.0.3 → 0.0.4
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 +54 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ CLI arguments take precedence over the configuration file.
|
|
|
73
73
|
|
|
74
74
|
## JSON output mode
|
|
75
75
|
|
|
76
|
-
Use `--json` for machine-readable output (useful in CI):
|
|
76
|
+
Use `--json` for machine-readable output (useful in CI / AI agents):
|
|
77
77
|
|
|
78
78
|
**Success:**
|
|
79
79
|
```json
|
|
@@ -84,3 +84,56 @@ Use `--json` for machine-readable output (useful in CI):
|
|
|
84
84
|
```json
|
|
85
85
|
{"ok":false,"error":{"code":"NOT_LOGGED_IN","message":"You are not logged in.","suggestedFix":"Run `42ws login --token <your-token>` to authenticate."}}
|
|
86
86
|
```
|
|
87
|
+
|
|
88
|
+
Every error includes a `code`, `message`, and `suggestedFix`. AI agents should read `suggestedFix` and apply the suggested change before retrying.
|
|
89
|
+
|
|
90
|
+
## For AI Agents
|
|
91
|
+
|
|
92
|
+
This CLI is designed to be driven by AI coding agents (Claude Code, Cursor, etc.).
|
|
93
|
+
|
|
94
|
+
### Recommended invocation
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
npx @42ws/cli@latest publish --yes --json
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- `--yes` skips all interactive prompts
|
|
101
|
+
- `--json` makes output machine-readable
|
|
102
|
+
|
|
103
|
+
### Behavior contract
|
|
104
|
+
|
|
105
|
+
- All commands return `{"ok": true, ...}` on success or `{"ok": false, "error": {...}}` on failure.
|
|
106
|
+
- Errors always include `code`, `message`, and `suggestedFix`. Read `suggestedFix` and apply it before retrying.
|
|
107
|
+
- The CLI never opens a browser or asks for input when `--yes` is set.
|
|
108
|
+
- Site names are auto-derived from the directory name when `--yes` is set and no `--site` is given.
|
|
109
|
+
- Frameworks (Vite / Astro / Next static export / SvelteKit static / plain HTML) are auto-detected from `package.json` and the directory contents.
|
|
110
|
+
|
|
111
|
+
### Rules for AI agents
|
|
112
|
+
|
|
113
|
+
- **Do not** ask the user for AWS credentials, S3 buckets, or CloudFront — 42ws abstracts these away.
|
|
114
|
+
- **Do not** publish backend code (API routes, server functions, databases). Only static files.
|
|
115
|
+
- **Do not** publish secret files. The CLI rejects `.env`, `.git/`, `node_modules/`, `*.pem`, `*.key`, `id_rsa`, `id_ed25519` automatically.
|
|
116
|
+
- **Do** read `error.suggestedFix` and apply it before retrying.
|
|
117
|
+
- **Do** return the published URL to the user.
|
|
118
|
+
|
|
119
|
+
### Common error codes
|
|
120
|
+
|
|
121
|
+
| Code | Meaning | Fix |
|
|
122
|
+
|---|---|---|
|
|
123
|
+
| `NOT_LOGGED_IN` | No saved auth | Run `npx @42ws/cli@latest login` (browser auth) |
|
|
124
|
+
| `INVALID_SITE_NAME` | Site name missing or invalid | Add `--site <name>` or pass `--yes` to use directory name |
|
|
125
|
+
| `RESERVED_SITE_NAME` | Subdomain reserved | Pick a different name |
|
|
126
|
+
| `SITE_NAME_TAKEN` | Site already owned by someone | Pick a different name |
|
|
127
|
+
| `OUTPUT_DIR_NOT_FOUND` | `dist/` etc. missing | Run the build command first or pass `--dir <path>` |
|
|
128
|
+
| `NO_FILES_FOUND` | No files to publish | Check `--dir` is correct |
|
|
129
|
+
| `BLOCKED_FILE` | Secret file would be uploaded | Remove the file or add to `.gitignore` |
|
|
130
|
+
| `BUILD_FAILED` | Build command exited non-zero | Fix the build error first |
|
|
131
|
+
| `FORBIDDEN` | License not enabled or not site owner | Ask the account owner |
|
|
132
|
+
|
|
133
|
+
### Suggested user-facing prompt
|
|
134
|
+
|
|
135
|
+
Users can paste this into their AI assistant:
|
|
136
|
+
|
|
137
|
+
> このプロジェクトを 42ws に公開してください。`npx @42ws/cli@latest publish` を使ってください。エラーが出たら `error.suggestedFix` の指示に従ってください。
|
|
138
|
+
|
|
139
|
+
(English: "Publish this project to 42ws using `npx @42ws/cli@latest publish`. If an error occurs, follow `error.suggestedFix`.")
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { open } from './commands/open.js';
|
|
|
7
7
|
import { init } from './commands/init.js';
|
|
8
8
|
import { pull } from './commands/pull.js';
|
|
9
9
|
import { setJsonMode } from './lib/output.js';
|
|
10
|
-
const VERSION = '0.0.
|
|
10
|
+
const VERSION = '0.0.4';
|
|
11
11
|
const HELP = `
|
|
12
12
|
42ws — Publish static sites in one command
|
|
13
13
|
|