@saeroon/cli 0.2.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 ADDED
@@ -0,0 +1,283 @@
1
+ <p align="center">
2
+ <img src="https://saeroon.diskn.com/e82ODzSxYY" alt="Saeroon" width="48" height="48" />
3
+ </p>
4
+
5
+ <h1 align="center">Saeroon CLI</h1>
6
+
7
+ <p align="center">
8
+ <strong>Build, preview, and deploy Saeroon sites — from your terminal.</strong>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="#quick-start">Quick Start</a> ·
13
+ <a href="#commands">Commands</a> ·
14
+ <a href="#workflows">Workflows</a> ·
15
+ <a href="https://hosting.saeroon.com/developer/docs">Docs</a>
16
+ </p>
17
+
18
+ ---
19
+
20
+ ## Quick Start
21
+
22
+ ```bash
23
+ # Authenticate
24
+ npx @saeroon/cli login
25
+
26
+ # Create a new project
27
+ npx @saeroon/cli init
28
+
29
+ # Live preview
30
+ npx @saeroon/cli preview
31
+
32
+ # Validate & deploy
33
+ npx @saeroon/cli validate
34
+ npx @saeroon/cli deploy --target production
35
+ ```
36
+
37
+ ## Commands
38
+
39
+ ### Auth
40
+
41
+ | Command | Description |
42
+ |---------|-------------|
43
+ | `login` | API 키 등록 및 연결 확인 |
44
+ | `whoami` | 현재 인증 상태 및 프로젝트 설정 확인 |
45
+
46
+ ### Development
47
+
48
+ | Command | Description |
49
+ |---------|-------------|
50
+ | `init` | 새 프로젝트 생성 (스타터, 마켓플레이스 템플릿, 기존 사이트에서) |
51
+ | `preview` | 스키마 파일 감시 + 실시간 미리보기 (REST / WebSocket) |
52
+ | `validate` | 스키마 검증 + 품질 리포트. `--local`로 오프라인 검증 가능 |
53
+ | `blocks` | 전체 블록 카탈로그 조회 또는 개별 블록 상세 정보 |
54
+ | `add` | schema.json에 블록 추가 (기본 props + 부모 children 자동 연결) |
55
+ | `upload` | 이미지를 Saeroon CDN에 업로드. `--replace-in`으로 경로 자동 교체 |
56
+ | `generate` | AI로 사이트 스키마 생성 (`--ref` URL 분석 / `--prompt` 텍스트) |
57
+ | `compare` | 레퍼런스 ↔ 프리뷰 시각 비교 (Playwright 스크린샷 diff) |
58
+
59
+ ### Deployment
60
+
61
+ | Command | Description |
62
+ |---------|-------------|
63
+ | `deploy` | 에셋 처리 + 스키마 배포 (staging / production) |
64
+ | `diff` | Draft(스테이징)와 Published(프로덕션) 스키마 비교 |
65
+
66
+ ### Templates
67
+
68
+ | Command | Description |
69
+ |---------|-------------|
70
+ | `template register` | 내 사이트를 마켓플레이스 템플릿으로 등록 |
71
+ | `template sync` | 소스 사이트의 최신 스키마를 템플릿에 반영 |
72
+ | `template status` | 내 템플릿 목록·판매·수익 현황 |
73
+ | `template update` | 템플릿 메타데이터 수정 |
74
+
75
+ ## Workflows
76
+
77
+ ### Create → Preview → Deploy
78
+
79
+ ```
80
+ init ──→ preview ──→ validate ──→ deploy --target staging
81
+
82
+
83
+ diff (staging vs production)
84
+
85
+
86
+ deploy --target production
87
+ ```
88
+
89
+ ### AI-Assisted Creation
90
+
91
+ ```
92
+ generate --ref <url> ──→ validate --local ──→ add <블록> ──→ preview
93
+ or │
94
+ generate --prompt <text> upload ./assets/
95
+ --replace-in schema.json
96
+
97
+ compare --ref ──→ deploy
98
+ ```
99
+
100
+ ### Template Marketplace
101
+
102
+ ```
103
+ deploy --target production
104
+
105
+
106
+ template register ──→ template sync ──→ template status
107
+ ```
108
+
109
+ `--sync-template` 플래그로 배포와 동시에 템플릿 동기화도 가능합니다:
110
+
111
+ ```bash
112
+ npx @saeroon/cli deploy --target production --sync-template
113
+ ```
114
+
115
+ ## AI-Powered Development
116
+
117
+ `init` 시 AI 에디터 컨텍스트 파일이 자동 생성됩니다:
118
+
119
+ | File | For |
120
+ |------|-----|
121
+ | `CLAUDE.md` | Claude Code 컨텍스트 |
122
+ | `.cursorrules` | Cursor 컨텍스트 |
123
+ | `.vscode/settings.json` | JSON Schema 자동완성 (`$schema` 연동) |
124
+ | `.claude/settings.json` | MCP 서버 설정 (Claude Code) |
125
+
126
+ 스키마 작성부터 배포까지 AI와 함께 작업할 수 있습니다.
127
+
128
+ ### JSON Schema 자동완성
129
+
130
+ `schema.json`에 `$schema` 필드가 포함되어 VS Code/Cursor에서 **속성 자동완성 + 타입 검증 + 인라인 설명**이 즉시 작동합니다:
131
+
132
+ ```json
133
+ {
134
+ "$schema": "https://hosting.saeroon.com/schema/v1.20.0/site-schema.json",
135
+ "schemaVersion": "1.20.0",
136
+ ...
137
+ }
138
+ ```
139
+
140
+ ### Validate 모드
141
+
142
+ | 모드 | 사용 | 특성 |
143
+ |------|------|------|
144
+ | `--local` | `validate --local` | 오프라인, 구조 검증 3단계 (Schema Structure → Block Properties → Reference Integrity) |
145
+ | 기본 (서버) | `validate` | API 호출, Editor Parity 검증 + SEO·GEO·성능·접근성 품질 점수 |
146
+
147
+ ## Preview Modes
148
+
149
+ | Mode | Latency | How |
150
+ |------|---------|-----|
151
+ | REST (default) | ~500ms | API 폴링, 브라우저 자동 오픈 |
152
+ | WebSocket | ~300ms | 실시간 양방향 통신 |
153
+
154
+ ```bash
155
+ # REST (기본)
156
+ npx @saeroon/cli preview
157
+
158
+ # WebSocket (저지연)
159
+ npx @saeroon/cli preview --mode ws
160
+
161
+ # 디바이스 지정
162
+ npx @saeroon/cli preview --device mobile
163
+ ```
164
+
165
+ ## Asset Handling
166
+
167
+ ### `upload` — 독립 에셋 업로드
168
+
169
+ 개발 중 이미지를 CDN에 업로드하고 schema.json 내 경로를 자동 교체합니다.
170
+
171
+ ```bash
172
+ # 단일 파일 → CDN URL 반환
173
+ npx @saeroon/cli upload ./assets/hero.jpg
174
+
175
+ # 디렉토리 전체 → URL 매핑 테이블 출력
176
+ npx @saeroon/cli upload ./assets/
177
+
178
+ # schema.json 내 로컬 경로를 CDN URL로 자동 교체
179
+ npx @saeroon/cli upload ./assets/ --replace-in schema.json
180
+ ```
181
+
182
+ ### `deploy` — 배포 시 자동 에셋 처리
183
+
184
+ `deploy` 시 로컬 이미지 파일을 자동으로 감지·해시·업로드합니다.
185
+
186
+ - SHA-256 기반 중복 검사 — 이미 업로드된 에셋은 스킵
187
+ - 최대 5개 동시 업로드
188
+ - `--dry-run`으로 에셋 리포트만 확인 가능
189
+
190
+ ```bash
191
+ npx @saeroon/cli deploy --dry-run
192
+ ```
193
+
194
+ ## Configuration
195
+
196
+ ```
197
+ ~/.saeroon/config.json ← API 키, 기본 설정 (login으로 생성)
198
+ ./saeroon.config.json ← 프로젝트별 siteId, templateId (init으로 생성)
199
+ ./schema.json ← 사이트 스키마 정의
200
+ ```
201
+
202
+ ## Block Scaffolding
203
+
204
+ `add` 명령으로 블록을 빠르게 추가합니다. Block Catalog API에서 기본 props를 가져와 부모 children에 자동 연결합니다.
205
+
206
+ ```bash
207
+ # 기본 — 인터랙티브 부모 선택
208
+ npx @saeroon/cli add heading-block
209
+
210
+ # 부모 + 위치 지정
211
+ npx @saeroon/cli add image-block --parent root --after hero-1
212
+
213
+ # ID + 페이지 지정
214
+ npx @saeroon/cli add content-showcase --id insights --parent main --page about
215
+ ```
216
+
217
+ ## AI Generation
218
+
219
+ ```bash
220
+ # 레퍼런스 URL → Playwright 스크린샷 → Claude 분석 → schema.json
221
+ npx @saeroon/cli generate --ref https://example.com
222
+
223
+ # 프롬프트 기반 생성
224
+ npx @saeroon/cli generate --prompt "카페 홈페이지, 모던 스타일, 주황 강조색"
225
+
226
+ # 출력 파일 지정
227
+ npx @saeroon/cli generate --ref https://example.com --output my-site.json
228
+ ```
229
+
230
+ ## Visual Diff
231
+
232
+ 레퍼런스 사이트와 프리뷰 결과를 시각적으로 비교합니다. Playwright + ImageMagick 사용.
233
+
234
+ ```bash
235
+ npx @saeroon/cli compare \
236
+ --ref https://example.com \
237
+ --preview https://preview.hosting.saeroon.com/abc \
238
+ --width 1280 --height 800
239
+
240
+ # 사전 필요: npx playwright install chromium
241
+ ```
242
+
243
+ ## Starters
244
+
245
+ `init`에서 선택할 수 있는 빌트인 스타터:
246
+
247
+ | Starter | Description |
248
+ |---------|-------------|
249
+ | `restaurant` | 음식점·케이터링 |
250
+ | `portfolio` | 포트폴리오·이력서 |
251
+ | `business` | 비즈니스·랜딩 |
252
+ | `saas` | SaaS·서비스 소개 |
253
+
254
+ ```bash
255
+ npx @saeroon/cli init --template restaurant
256
+ ```
257
+
258
+ 마켓플레이스 템플릿에서도 시작할 수 있습니다:
259
+
260
+ ```bash
261
+ npx @saeroon/cli init --from-template <template-id>
262
+ ```
263
+
264
+ ## Security
265
+
266
+ CLI는 다음 보안 조치를 적용합니다:
267
+
268
+ - **API 통신**: HTTPS 전용, SSRF 방어 (Private IP 차단), 30초 타임아웃
269
+ - **JSON 파싱**: Prototype Pollution 방어 (`secure-json-parse`)
270
+ - **파일 접근**: Path Traversal 방어 (CWD 외부 접근 차단)
271
+ - **API Key**: 입력 시 마스킹, 설정 파일 저장 (`~/.saeroon/config.json`)
272
+ - **Rate Limit**: 429 응답 시 `Retry-After` 기반 자동 재시도 (최대 3회)
273
+
274
+ ## Requirements
275
+
276
+ - Node.js 18+
277
+ - Saeroon API Key ([Developer Center](https://hosting.saeroon.com/developer/keys)에서 발급)
278
+ - (선택) Playwright — `compare` 명령용 (`npx playwright install chromium`)
279
+ - (선택) ImageMagick — `compare` 오버레이 diff용
280
+
281
+ ## License
282
+
283
+ MIT
@@ -0,0 +1,2 @@
1
+
2
+ export { }