@waelio/cli 0.1.9 โ†’ 0.1.11

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,26 +1,29 @@
1
1
  # @waelio/cli
2
2
 
3
- TypeScript CLI + browser UI toolkit for building [`waelio/siteforge`](https://github.com/waelio/siteforge) from the terminal or a local web interface.
3
+ [![npm version](https://img.shields.io/npm/v/@waelio/cli.svg?style=flat-square&color=cb3837)](https://www.npmjs.com/package/@waelio/cli)
4
+ [![license](https://img.shields.io/npm/l/@waelio/cli.svg?style=flat-square)](./LICENSE)
5
+ [![node](https://img.shields.io/node/v/@waelio/cli.svg?style=flat-square)](https://nodejs.org)
4
6
 
5
- Built with **Vite + TypeScript + Vue**.
7
+ > TypeScript CLI + browser UI toolkit for building [`waelio/siteforge`](https://github.com/waelio/siteforge) from the terminal or a local web interface.
6
8
 
7
- ## What it does
9
+ ๐Ÿ”— **Live demo:** [cli.waelio.workers.dev](https://cli.waelio.workers.dev)
8
10
 
9
- - checks that required local tools are installed
10
- - previews the build plan before running it
11
- - clones `waelio/siteforge` into a working directory
12
- - installs dependencies with `npm ci`
13
- - runs `npm run build`
14
- - shows the full workflow in a browser UI with live logs
11
+ Built with **Vite 8 ยท TypeScript ยท Vue 3 ยท Commander**.
15
12
 
16
- ## Requirements
13
+ ---
17
14
 
18
- - Node.js 20+
19
- - npm
20
- - git
21
- - Go
15
+ ## โœจ Features
22
16
 
23
- ## Install
17
+ - ๐Ÿฉบ **Doctor** โ€” checks that required local tools are installed
18
+ - ๐Ÿ“‹ **Dry-run** โ€” previews the build plan before running it
19
+ - ๐Ÿ”ง **Build** โ€” clones `waelio/siteforge`, installs deps, and runs the build
20
+ - ๐Ÿ—๏ธ **Scaffold** โ€” generates full Next.js + NestJS projects from a blueprint JSON
21
+ - ๐Ÿ–ฅ๏ธ **Browser UI** โ€” a Vue dashboard with live logs, scaffold forms, and public site listings
22
+ - ๐ŸŒ **12 locales** โ€” `ar` `de` `en` `es` `fr` `he` `id` `it` `ru` `sv` `tr` `zh` (RTL-ready)
23
+
24
+ ---
25
+
26
+ ## ๐Ÿ“ฆ Install
24
27
 
25
28
  Run without installing:
26
29
 
@@ -34,15 +37,13 @@ Or install globally:
34
37
  npm install -g @waelio/cli
35
38
  ```
36
39
 
37
- ## CLI commands
40
+ ---
38
41
 
39
- ### `waelio --help`
42
+ ## ๐Ÿš€ CLI Commands
40
43
 
41
- Print the top-level help and list all available commands:
44
+ ### `waelio --help`
42
45
 
43
- ```sh
44
- waelio --help
45
- ```
46
+ Print the top-level help and list all available commands.
46
47
 
47
48
  ### `waelio doctor`
48
49
 
@@ -60,18 +61,17 @@ Clone and build the `waelio/siteforge` website:
60
61
  waelio build
61
62
  ```
62
63
 
63
- **All options:**
64
+ **Options:**
64
65
 
65
- ```sh
66
- waelio build \
67
- --repo https://github.com/waelio/siteforge.git \ # custom repository URL (default: waelio/siteforge)
68
- --ref main \ # branch, tag, or commit to checkout
69
- --source ./my-local-siteforge \ # skip cloning, use an existing checkout
70
- --workdir ./build-tmp \ # directory to clone into
71
- --dry-run # print the plan without running anything
72
- ```
66
+ | Flag | Description | Default |
67
+ |------|-------------|---------|
68
+ | `--repo <url>` | Custom repository URL | `waelio/siteforge` |
69
+ | `--ref <ref>` | Branch, tag, or commit to checkout | `main` |
70
+ | `--source <path>` | Skip cloning, use an existing checkout | โ€” |
71
+ | `--workdir <path>` | Directory to clone into | `./tmp` |
72
+ | `--dry-run` | Print the plan without running anything | `false` |
73
73
 
74
- **Common examples:**
74
+ **Examples:**
75
75
 
76
76
  ```sh
77
77
  # default โ€” clone and build waelio/siteforge
@@ -83,153 +83,204 @@ waelio build --dry-run
83
83
  # build a specific branch
84
84
  waelio build --ref feat/new-homepage
85
85
 
86
- # build from a local checkout you already have
86
+ # build from a local checkout
87
87
  waelio build --source ~/Code/GitHub/waelio/siteforge
88
88
 
89
- # clone into a custom directory
90
- waelio build --workdir /tmp/siteforge-build
91
-
92
89
  # build a fork
93
90
  waelio build --repo https://github.com/yourname/siteforge.git
94
91
  ```
95
92
 
96
93
  ### `waelio ui`
97
94
 
98
- Start the local web UI and API server (browser dashboard with live build logs and a multi-view interface):
95
+ Start the local web UI and API server:
99
96
 
100
97
  ```sh
101
98
  waelio ui
99
+ waelio ui --port 4000 # default: 3000
102
100
  ```
103
101
 
104
- **UI Features:**
105
- - **Scaffold View:** Form-based generator to produce and deploy Siteforge blueprints to webhooks.
106
- - **Public Sites View:** A dedicated dashboard for listing and accessing successfully scaffolded client sites served via the `/api/public-sites` route.
102
+ Open `http://localhost:3000` in your browser.
107
103
 
108
- **Options:**
104
+ **UI Views:**
109
105
 
110
- ```sh
111
- waelio ui --port 4000 # default port is 3000
112
- ```
113
-
114
- Open `http://localhost:3000` in your browser after running this.
106
+ | View | Description |
107
+ |------|-------------|
108
+ | **Scaffold** | Form-based generator to produce and deploy Siteforge blueprints |
109
+ | **Public Sites** | Dashboard listing scaffolded client sites served via `/api/public-sites` |
115
110
 
116
111
  ### `waelio scaffold <blueprint>`
117
112
 
118
- Scaffold a full Next.js (frontend) + NestJS (backend) project from a siteforge blueprint JSON:
113
+ Scaffold a full Next.js (frontend) + NestJS (backend) project from a Siteforge blueprint JSON:
119
114
 
120
115
  ```sh
121
116
  waelio scaffold ./blueprint.json
122
117
  ```
123
118
 
124
- **All options:**
119
+ **Options:**
125
120
 
126
- ```sh
127
- waelio scaffold ./blueprint.json \
128
- --out ./sites \ # output root directory (default: siteforge/sites)
129
- --no-git # skip git init and the initial commit
130
- ```
121
+ | Flag | Description | Default |
122
+ |------|-------------|---------|
123
+ | `--out <dir>` | Output root directory | `siteforge/sites` |
124
+ | `--no-git` | Skip `git init` and the initial commit | `false` |
131
125
 
132
- **Common examples:**
126
+ **Examples:**
133
127
 
134
128
  ```sh
135
129
  # scaffold with defaults
136
130
  waelio scaffold ./blueprint.json
137
131
 
138
- # scaffold into a custom output directory
132
+ # scaffold into a custom directory
139
133
  waelio scaffold ./blueprint.json --out ~/projects/my-site
140
134
 
141
135
  # scaffold without initialising a git repository
142
136
  waelio scaffold ./blueprint.json --no-git
137
+ ```
138
+
139
+ The blueprint JSON describes the project name, slug, pages, features, integrations, locales, roles, brand tones, visual styles, content models, and SEO focuses. The scaffolder generates both workspaces from those selections.
143
140
 
144
- # combine options
145
- waelio scaffold ./blueprint.json --out ./sites --no-git
141
+ ---
142
+
143
+ ## ๐Ÿ›๏ธ Project Structure
144
+
145
+ ```
146
+ @waelio/cli
147
+ โ”œโ”€โ”€ src/
148
+ โ”‚ โ”œโ”€โ”€ index.ts # CLI entry point (Commander)
149
+ โ”‚ โ”œโ”€โ”€ server.ts # Express API server
150
+ โ”‚ โ”œโ”€โ”€ siteforge.ts # Build orchestration
151
+ โ”‚ โ”œโ”€โ”€ scaffold.ts # Blueprint scaffolder
152
+ โ”‚ โ”œโ”€โ”€ localRepos.ts # Local repo discovery
153
+ โ”‚ โ””โ”€โ”€ locals/ # i18n locale files (12 languages)
154
+ โ”œโ”€โ”€ ui/
155
+ โ”‚ โ”œโ”€โ”€ src/
156
+ โ”‚ โ”‚ โ”œโ”€โ”€ App.vue # Root Vue component
157
+ โ”‚ โ”‚ โ””โ”€โ”€ views/ # ScaffoldView, PublicSitesView
158
+ โ”‚ โ””โ”€โ”€ dist/ # Built static assets
159
+ โ”œโ”€โ”€ templates/ # Multi-framework scaffold templates
160
+ โ”œโ”€โ”€ public-sites/ # Scaffolded demo sites (acme-dental, agent-007, e2e-test-site)
161
+ โ”œโ”€โ”€ wrangler.toml # Cloudflare Workers deployment config
162
+ โ”œโ”€โ”€ vite.config.ts # Vite build config
163
+ โ””โ”€โ”€ package.json
146
164
  ```
147
165
 
148
- The blueprint JSON is produced by siteforge and describes the project name, slug,
149
- pages, features, integrations, locales, roles, brand tones, visual styles,
150
- content models, and SEO focuses. The scaffolder generates both workspaces from
151
- those selections.
166
+ ---
152
167
 
153
- ## Development
168
+ ## ๐Ÿ› ๏ธ Development
154
169
 
155
170
  ### Install dependencies
156
171
 
157
172
  ```sh
158
- npm install
173
+ pnpm install
159
174
  ```
160
175
 
161
176
  ### Run in development
162
177
 
163
178
  ```sh
164
- npm run dev
179
+ pnpm dev
165
180
  ```
166
181
 
167
- Starts:
182
+ Starts concurrently:
168
183
 
169
- - API/build server on `http://localhost:3000`
170
- - Vite UI on `http://localhost:5173`
184
+ - **API server** on `http://localhost:3000`
185
+ - **Vite UI** on `http://localhost:5173` (proxies `/api` โ†’ `:3000`)
171
186
 
172
187
  ### Build everything
173
188
 
174
189
  ```sh
175
- npm run build
190
+ pnpm run build
191
+ ```
192
+
193
+ ### Run the production server
194
+
195
+ ```sh
196
+ pnpm start
176
197
  ```
177
198
 
178
- ### Run the built server
199
+ ### Quality checks
179
200
 
180
201
  ```sh
181
- npm start
202
+ pnpm run typecheck # tsc --noEmit + vue-tsc for the UI
203
+ pnpm test # run *.test.ts via tsx --test
204
+ pnpm run check # typecheck + tests
182
205
  ```
183
206
 
184
- ### Other scripts
207
+ ---
208
+
209
+ ## โ˜๏ธ Deployment
210
+
211
+ The UI is deployed to **Cloudflare Workers** as a static site.
212
+
213
+ ### Deploy manually
185
214
 
186
215
  ```sh
187
- npm run typecheck # tsc --noEmit + vue-tsc for the UI
188
- npm test # run *.test.ts via tsx --test
189
- npm run check # typecheck + tests
216
+ pnpm run build
217
+ npx wrangler deploy
190
218
  ```
191
219
 
192
- ## Helper repos surfaced in the UI
220
+ The `wrangler.toml` configuration serves the built Vue app from `ui/dist`:
221
+
222
+ ```toml
223
+ name = "cli"
224
+ compatibility_date = "2024-12-01"
225
+
226
+ [assets]
227
+ directory = "./ui/dist"
228
+ ```
229
+
230
+ **Live URL:** [https://cli.waelio.workers.dev](https://cli.waelio.workers.dev)
231
+
232
+ ---
233
+
234
+ ## ๐Ÿ”Œ API Endpoints
235
+
236
+ ### Build & Scaffold
237
+
238
+ | Method | Endpoint | Description |
239
+ |--------|----------|-------------|
240
+ | `POST` | `/api/build` | Trigger a siteforge build |
241
+ | `POST` | `/api/scaffold` | Scaffold from a blueprint |
242
+ | `GET` | `/api/public-sites` | List scaffolded demo sites |
243
+
244
+ ### Local Repository Discovery
193
245
 
194
- - `waelio/ustore` โ€” storage and state patterns
195
- - `waelio/utils` โ€” shared utilities and UI-friendly helpers
196
- - `waelio/waelio-messaging` โ€” future real-time collaboration ideas
246
+ | Method | Endpoint | Description |
247
+ |--------|----------|-------------|
248
+ | `GET` | `/api/local-repos` | Returns the local repository index |
249
+ | `GET` | `/api/local-repos/tree?repoId=...&path=...` | Browse a repo's file tree |
197
250
 
198
- ## Localization
251
+ **Safety rules:**
199
252
 
200
- UI strings are stored as per-locale JSON files under `src/locals/<lang>/<lang>.json`,
201
- with a top-level `src/locals/manifest.json` summarizing the set. The following
202
- locales ship by default:
253
+ - Repository IDs map to scanned local repos only
254
+ - Folder browsing is restricted to paths inside the selected repository
255
+ - Path traversal (`..`) is rejected
256
+ - `.git` directories are hidden from listings
257
+ - Default scan root: `~/Code/GitHub` (override with `WAELIO_LOCAL_ROOT`)
203
258
 
204
- `ar`, `de`, `en`, `es`, `fr`, `he`, `id`, `it`, `ru`, `sv`, `tr`, `zh`
259
+ ---
205
260
 
206
- RTL locales (`ar`, `he`) should be considered when adding or editing UI copy.
261
+ ## ๐ŸŒ Localization
207
262
 
208
- ## Local repository discovery
263
+ UI strings live in `src/locals/<lang>/<lang>.json` with a top-level `src/locals/manifest.json`.
209
264
 
210
- The UI and API now scan your local GitHub workspace and build a sanitized repository index.
265
+ Supported locales:
211
266
 
212
- - default local root: `/Users/waelio/Code/GitHub`
213
- - override with `WAELIO_LOCAL_ROOT`
214
- - top-level repositories are included
215
- - nested build/checkouts such as `.build`, `node_modules`, `dist`, and `.git` internals are excluded from discovery
267
+ `ar` ยท `de` ยท `en` ยท `es` ยท `fr` ยท `he` ยท `id` ยท `it` ยท `ru` ยท `sv` ยท `tr` ยท `zh`
216
268
 
217
- ### Local repo API
269
+ > RTL locales (`ar`, `he`) are supported โ€” keep them in mind when editing UI copy.
218
270
 
219
- - `GET /api/local-repos` โ€” returns the compiled local repository list
220
- - `GET /api/local-repos/tree?repoId=...&path=...` โ€” returns a sanitized physical folder listing for a selected local repository
271
+ ---
221
272
 
222
- ### Safety rules
273
+ ## ๐Ÿ“š Related Packages
223
274
 
224
- - repository IDs map to scanned local repos only
225
- - folder browsing is restricted to paths inside the selected repository
226
- - path traversal such as `..` is rejected
227
- - `.git` directories are hidden from the served listing
275
+ | Package | Description |
276
+ |---------|-------------|
277
+ | [`@waelio/utils`](https://www.npmjs.com/package/@waelio/utils) | Shared utilities and UI helpers |
278
+ | [`@waelio/ustore`](https://www.npmjs.com/package/@waelio/ustore) | Universal storage and state patterns |
279
+ | [`@waelio/agent`](https://www.npmjs.com/package/@waelio/agent) | AI agent frontend toolkit |
280
+ | [`@waelio/sync`](https://www.npmjs.com/package/@waelio/sync) | Real-time sync utilities |
228
281
 
229
- ## Notes
282
+ ---
230
283
 
231
- - The default repository URL is `https://github.com/waelio/siteforge.git`.
232
- - A custom workdir can be used when you want a persistent local checkout.
233
- - If `source` is provided, cloning is skipped and the existing checkout is built directly.
284
+ ## ๐Ÿ“„ License
234
285
 
235
- - [https://waelio.com/packages/@waelio/cli](https://waelio.com/packages/@waelio/cli)
286
+ [MIT](./LICENSE) ยฉ [Waelio](https://waelio.com)
package/dist/scaffold.js CHANGED
@@ -308,6 +308,58 @@ ${list(sel.selectedLocales)}
308
308
  ${list(sel.selectedRoles)}
309
309
  `;
310
310
  }
311
+ function rootIndexHtml(name, slug) {
312
+ return `<!doctype html>
313
+ <html lang="en">
314
+ <head>
315
+ <meta charset="UTF-8" />
316
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
317
+ <title>${name}</title>
318
+ <style>
319
+ :root { color-scheme: light dark; }
320
+ body {
321
+ font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
322
+ margin: 0;
323
+ min-height: 100vh;
324
+ display: grid;
325
+ place-items: center;
326
+ background: #0b1220;
327
+ color: #e5e7eb;
328
+ }
329
+ main {
330
+ width: min(760px, calc(100% - 2rem));
331
+ background: rgba(17, 24, 39, 0.92);
332
+ border: 1px solid rgba(148, 163, 184, 0.35);
333
+ border-radius: 14px;
334
+ padding: 1.2rem 1.25rem;
335
+ }
336
+ h1 { margin: 0 0 0.4rem; font-size: 1.25rem; }
337
+ p { margin: 0.35rem 0; line-height: 1.45; }
338
+ code {
339
+ background: rgba(148, 163, 184, 0.18);
340
+ padding: 0.12rem 0.4rem;
341
+ border-radius: 0.4rem;
342
+ }
343
+ ul { margin: 0.8rem 0 0; padding-left: 1.1rem; }
344
+ a { color: #93c5fd; }
345
+ </style>
346
+ </head>
347
+ <body>
348
+ <main>
349
+ <h1>${name}</h1>
350
+ <p>This scaffold was generated by <code>@waelio/cli</code>.</p>
351
+ <p>Project slug: <code>${slug}</code></p>
352
+ <p>Run the generated apps locally:</p>
353
+ <ul>
354
+ <li>Frontend source: <code>frontend/</code> (Next.js, port 3001)</li>
355
+ <li>Backend source: <code>backend/</code> (NestJS, port 3002)</li>
356
+ <li>Details: <a href="./README.md">README.md</a></li>
357
+ </ul>
358
+ </main>
359
+ </body>
360
+ </html>
361
+ `;
362
+ }
311
363
  const ROOT_GITIGNORE = `node_modules/
312
364
  dist/
313
365
  .next/
@@ -428,6 +480,7 @@ async function writeScaffold(blueprint, projectName, slug, outDir, initGit) {
428
480
  }
429
481
  // Root
430
482
  await writeFileEnsured(path.join(outDir, "README.md"), rootReadme(projectName, slug, blueprint));
483
+ await writeFileEnsured(path.join(outDir, "index.html"), rootIndexHtml(projectName, slug));
431
484
  await writeFileEnsured(path.join(outDir, ".gitignore"), ROOT_GITIGNORE);
432
485
  await writeFileEnsured(path.join(outDir, "blueprint.json"), JSON.stringify(blueprint, null, 2));
433
486
  if (initGit !== false) {
package/dist/server.d.ts CHANGED
@@ -1,4 +1,18 @@
1
1
  import { type Server as HttpServer } from "node:http";
2
+ import { type Blueprint } from "./scaffold.js";
3
+ interface ResolvedScaffoldRequest {
4
+ blueprint: Blueprint;
5
+ outRoot: string;
6
+ initGit: boolean;
7
+ }
8
+ interface ScaffoldPayloadResolution {
9
+ mode: "none" | "scaffold" | "invalid";
10
+ request?: ResolvedScaffoldRequest;
11
+ error?: string;
12
+ }
13
+ export declare function resolveScaffoldRequestPayload(payload: unknown, defaultOutRoot?: string): ScaffoldPayloadResolution;
2
14
  export declare function startServer(options?: {
3
15
  port?: number;
4
16
  }): Promise<HttpServer>;
17
+ export declare function listPublicSites(rootDirectory?: string): Promise<string[]>;
18
+ export {};