@cmssy/cli 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.
Files changed (113) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +649 -0
  3. package/config.d.ts +2 -0
  4. package/config.js +2 -0
  5. package/dist/cli.d.ts +3 -0
  6. package/dist/cli.d.ts.map +1 -0
  7. package/dist/cli.js +236 -0
  8. package/dist/cli.js.map +1 -0
  9. package/dist/commands/add-source.d.ts +7 -0
  10. package/dist/commands/add-source.d.ts.map +1 -0
  11. package/dist/commands/add-source.js +238 -0
  12. package/dist/commands/add-source.js.map +1 -0
  13. package/dist/commands/build.d.ts +7 -0
  14. package/dist/commands/build.d.ts.map +1 -0
  15. package/dist/commands/build.js +105 -0
  16. package/dist/commands/build.js.map +1 -0
  17. package/dist/commands/configure.d.ts +6 -0
  18. package/dist/commands/configure.d.ts.map +1 -0
  19. package/dist/commands/configure.js +42 -0
  20. package/dist/commands/configure.js.map +1 -0
  21. package/dist/commands/create.d.ts +18 -0
  22. package/dist/commands/create.d.ts.map +1 -0
  23. package/dist/commands/create.js +444 -0
  24. package/dist/commands/create.js.map +1 -0
  25. package/dist/commands/dev.d.ts +6 -0
  26. package/dist/commands/dev.d.ts.map +1 -0
  27. package/dist/commands/dev.js +962 -0
  28. package/dist/commands/dev.js.map +1 -0
  29. package/dist/commands/init.d.ts +2 -0
  30. package/dist/commands/init.d.ts.map +1 -0
  31. package/dist/commands/init.js +362 -0
  32. package/dist/commands/init.js.map +1 -0
  33. package/dist/commands/migrate.d.ts +2 -0
  34. package/dist/commands/migrate.d.ts.map +1 -0
  35. package/dist/commands/migrate.js +227 -0
  36. package/dist/commands/migrate.js.map +1 -0
  37. package/dist/commands/package.d.ts +7 -0
  38. package/dist/commands/package.d.ts.map +1 -0
  39. package/dist/commands/package.js +136 -0
  40. package/dist/commands/package.js.map +1 -0
  41. package/dist/commands/publish.d.ts +13 -0
  42. package/dist/commands/publish.d.ts.map +1 -0
  43. package/dist/commands/publish.js +910 -0
  44. package/dist/commands/publish.js.map +1 -0
  45. package/dist/commands/sync.d.ts +6 -0
  46. package/dist/commands/sync.d.ts.map +1 -0
  47. package/dist/commands/sync.js +208 -0
  48. package/dist/commands/sync.js.map +1 -0
  49. package/dist/commands/upload.d.ts +7 -0
  50. package/dist/commands/upload.d.ts.map +1 -0
  51. package/dist/commands/upload.js +126 -0
  52. package/dist/commands/upload.js.map +1 -0
  53. package/dist/commands/workspaces.d.ts +2 -0
  54. package/dist/commands/workspaces.d.ts.map +1 -0
  55. package/dist/commands/workspaces.js +67 -0
  56. package/dist/commands/workspaces.js.map +1 -0
  57. package/dist/dev-ui/app.js +1284 -0
  58. package/dist/dev-ui/index.html +1511 -0
  59. package/dist/dev-ui-react/App.tsx +164 -0
  60. package/dist/dev-ui-react/__tests__/previewData.test.ts +193 -0
  61. package/dist/dev-ui-react/components/BlocksList.tsx +232 -0
  62. package/dist/dev-ui-react/components/Editor.tsx +469 -0
  63. package/dist/dev-ui-react/components/Preview.tsx +146 -0
  64. package/dist/dev-ui-react/hooks/useBlocks.ts +80 -0
  65. package/dist/dev-ui-react/index.html +13 -0
  66. package/dist/dev-ui-react/main.tsx +8 -0
  67. package/dist/dev-ui-react/styles.css +856 -0
  68. package/dist/dev-ui-react/types.ts +45 -0
  69. package/dist/types/block-config.d.ts +315 -0
  70. package/dist/types/block-config.d.ts.map +1 -0
  71. package/dist/types/block-config.js +8 -0
  72. package/dist/types/block-config.js.map +1 -0
  73. package/dist/utils/block-config.d.ts +10 -0
  74. package/dist/utils/block-config.d.ts.map +1 -0
  75. package/dist/utils/block-config.js +199 -0
  76. package/dist/utils/block-config.js.map +1 -0
  77. package/dist/utils/blocks-meta-cache.d.ts +28 -0
  78. package/dist/utils/blocks-meta-cache.d.ts.map +1 -0
  79. package/dist/utils/blocks-meta-cache.js +72 -0
  80. package/dist/utils/blocks-meta-cache.js.map +1 -0
  81. package/dist/utils/builder.d.ts +34 -0
  82. package/dist/utils/builder.d.ts.map +1 -0
  83. package/dist/utils/builder.js +140 -0
  84. package/dist/utils/builder.js.map +1 -0
  85. package/dist/utils/cmssy-config.d.ts +16 -0
  86. package/dist/utils/cmssy-config.d.ts.map +1 -0
  87. package/dist/utils/cmssy-config.js +19 -0
  88. package/dist/utils/cmssy-config.js.map +1 -0
  89. package/dist/utils/config.d.ts +9 -0
  90. package/dist/utils/config.d.ts.map +1 -0
  91. package/dist/utils/config.js +46 -0
  92. package/dist/utils/config.js.map +1 -0
  93. package/dist/utils/field-schema.d.ts +12 -0
  94. package/dist/utils/field-schema.d.ts.map +1 -0
  95. package/dist/utils/field-schema.js +202 -0
  96. package/dist/utils/field-schema.js.map +1 -0
  97. package/dist/utils/graphql.d.ts +8 -0
  98. package/dist/utils/graphql.d.ts.map +1 -0
  99. package/dist/utils/graphql.js +118 -0
  100. package/dist/utils/graphql.js.map +1 -0
  101. package/dist/utils/publish-helpers.d.ts +35 -0
  102. package/dist/utils/publish-helpers.d.ts.map +1 -0
  103. package/dist/utils/publish-helpers.js +141 -0
  104. package/dist/utils/publish-helpers.js.map +1 -0
  105. package/dist/utils/scanner.d.ts +36 -0
  106. package/dist/utils/scanner.d.ts.map +1 -0
  107. package/dist/utils/scanner.js +140 -0
  108. package/dist/utils/scanner.js.map +1 -0
  109. package/dist/utils/type-generator.d.ts +9 -0
  110. package/dist/utils/type-generator.d.ts.map +1 -0
  111. package/dist/utils/type-generator.js +85 -0
  112. package/dist/utils/type-generator.js.map +1 -0
  113. package/package.json +88 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Cmssy Team
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 ADDED
@@ -0,0 +1,649 @@
1
+ # cmssy-cli
2
+
3
+ Unified CLI for building reusable UI blocks and publishing them to Cmssy Marketplace.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g cmssy-cli
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```bash
14
+ # 1. Create a new project
15
+ npx cmssy init my-blocks
16
+
17
+ # 2. Navigate to project
18
+ cd my-blocks
19
+
20
+ # 3. Install dependencies
21
+ npm install
22
+
23
+ # 4. Start development server
24
+ cmssy dev
25
+
26
+ # 5. Create a new block
27
+ cmssy create block my-block
28
+
29
+ # 6. Build for production
30
+ cmssy build
31
+
32
+ # 7. Configure Cmssy API (for publishing)
33
+ cmssy configure
34
+
35
+ # 8. Publish to marketplace or workspace
36
+ cmssy publish --all --marketplace
37
+ ```
38
+
39
+ ## Environment Configuration
40
+
41
+ Create a `.env` file in your project root with the following variables:
42
+
43
+ ```env
44
+ # Required for publishing
45
+ CMSSY_API_URL=https://api.cmssy.io/graphql
46
+ CMSSY_API_TOKEN=your_api_token_here
47
+
48
+ # Optional - default workspace ID for publishing (MongoDB ObjectId)
49
+ CMSSY_WORKSPACE_ID=507f1f77bcf86cd799439011
50
+ ```
51
+
52
+ **How to get API Token:**
53
+ 1. Go to your Cmssy workspace settings
54
+ 2. Navigate to "API Tokens"
55
+ 3. Create a new token with `marketplace:publish` or `workspace:write` scope
56
+ 4. Copy the token to your `.env` file
57
+
58
+ **How to get Workspace ID:**
59
+
60
+ **Option 1: From Cmssy UI (Easiest)**
61
+ 1. Go to your workspace Settings → General
62
+ 2. Find "Workspace Information" section at the top
63
+ 3. Click the copy button next to Workspace ID
64
+ 4. Add to `.env` as `CMSSY_WORKSPACE_ID`
65
+
66
+ **Option 2: Using CLI**
67
+ 1. Run `cmssy workspaces` to list all your workspaces
68
+ 2. Copy the ID (MongoDB ObjectId format: 24-character hex string)
69
+ 3. Add to `.env` as `CMSSY_WORKSPACE_ID`
70
+
71
+ Run `cmssy configure` for interactive setup.
72
+
73
+ ## Commands
74
+
75
+ ### Initialize Project
76
+
77
+ ```bash
78
+ cmssy init [name] [options]
79
+ ```
80
+
81
+ Create a new Cmssy project with example blocks.
82
+
83
+ **Options:**
84
+ - `-f, --framework <framework>` - Framework (react, vue, angular, vanilla). Default: react
85
+
86
+ **Example:**
87
+ ```bash
88
+ cmssy init my-blocks --framework react
89
+ ```
90
+
91
+ **What it creates:**
92
+ - Project structure with `blocks/` and `templates/` directories
93
+ - Example hero block
94
+ - `cmssy.config.js` configuration file
95
+ - `.env.example` with API configuration template
96
+
97
+ ---
98
+
99
+ ### Create Block or Template
100
+
101
+ ```bash
102
+ cmssy create block <name>
103
+ cmssy create template <name>
104
+ ```
105
+
106
+ Create a new block or page template in your project.
107
+
108
+ **Example:**
109
+ ```bash
110
+ cmssy create block hero
111
+ cmssy create template landing-page
112
+ ```
113
+
114
+ **What it creates:**
115
+ - `blocks/<name>/` or `templates/<name>/` directory
116
+ - `package.json` with metadata
117
+ - `preview.json` for dev server
118
+ - `src/` directory with component scaffold
119
+
120
+ ---
121
+
122
+ ### Build
123
+
124
+ ```bash
125
+ cmssy build [options]
126
+ ```
127
+
128
+ Build all blocks and templates for production.
129
+
130
+ **Options:**
131
+ - `--framework <framework>` - Override framework from config
132
+
133
+ **Example:**
134
+ ```bash
135
+ cmssy build
136
+ ```
137
+
138
+ **Output:** Built files are generated in `public/@vendor/package-name/version/` directory.
139
+
140
+ ---
141
+
142
+ ### Development Server
143
+
144
+ ```bash
145
+ cmssy dev [options]
146
+ ```
147
+
148
+ Start development server with hot reload and preview UI.
149
+
150
+ **Options:**
151
+ - `-p, --port <port>` - Port number. Default: 3000
152
+
153
+ **Example:**
154
+ ```bash
155
+ cmssy dev --port 4000
156
+ ```
157
+
158
+ **Features:**
159
+ - Hot reload on file changes
160
+ - Interactive block preview
161
+ - Publish blocks directly from UI
162
+ - Live progress tracking
163
+ - Version badges and status indicators
164
+
165
+ ---
166
+
167
+ ### Configure API
168
+
169
+ ```bash
170
+ cmssy configure [options]
171
+ ```
172
+
173
+ Configure Cmssy API credentials for publishing.
174
+
175
+ **Options:**
176
+ - `--api-url <url>` - Cmssy API URL. Default: https://api.cmssy.io/graphql
177
+
178
+ **Example:**
179
+ ```bash
180
+ cmssy configure
181
+ ```
182
+
183
+ You'll be prompted for:
184
+ - **Cmssy API URL**: `https://api.cmssy.io/graphql` (or your local dev URL)
185
+ - **API Token**: Get this from your Cmssy workspace settings → API Tokens
186
+
187
+ Creates/updates `.env` file with your credentials.
188
+
189
+ ---
190
+
191
+ ### Publish to Marketplace or Workspace
192
+
193
+ ```bash
194
+ cmssy publish [packages...] [options]
195
+ ```
196
+
197
+ Publish blocks/templates to public marketplace (with review) or private workspace (instant).
198
+
199
+ **Options:**
200
+ - `-m, --marketplace` - Publish to public marketplace (requires review)
201
+ - `-w, --workspace [id]` - Publish to workspace (private, no review)
202
+ - `--all` - Publish all blocks and templates
203
+ - `--patch` - Bump patch version (1.0.0 → 1.0.1)
204
+ - `--minor` - Bump minor version (1.0.0 → 1.1.0)
205
+ - `--major` - Bump major version (1.0.0 → 2.0.0)
206
+ - `--dry-run` - Preview what would be published without uploading
207
+
208
+ **Example:**
209
+ ```bash
210
+ # Publish to marketplace (public, requires review)
211
+ cmssy publish hero --marketplace
212
+ cmssy publish --all --marketplace --patch
213
+
214
+ # Publish to workspace (private, instant)
215
+ cmssy publish hero --workspace 507f1f77bcf86cd799439011
216
+ cmssy publish --all --workspace
217
+ cmssy publish pricing --workspace --minor
218
+
219
+ # Specific packages
220
+ cmssy publish hero pricing --marketplace
221
+
222
+ # Dry run
223
+ cmssy publish --all --marketplace --dry-run
224
+ ```
225
+
226
+ **Notes:**
227
+ - Must specify either `--marketplace` OR `--workspace` (not both)
228
+ - Workspace ID can be provided via flag or `CMSSY_WORKSPACE_ID` in `.env`
229
+ - Version bumping updates `package.json` before publishing
230
+ - Marketplace publish requires review, workspace publish is instant
231
+
232
+ ---
233
+
234
+ ### Package into ZIP Files
235
+
236
+ ```bash
237
+ cmssy package [packages...] [options]
238
+ ```
239
+
240
+ Package blocks/templates into ZIP files for distribution or upload.
241
+
242
+ **Options:**
243
+ - `--all` - Package all blocks and templates
244
+ - `-o, --output <dir>` - Output directory. Default: packages
245
+
246
+ **Example:**
247
+ ```bash
248
+ # Package single block
249
+ cmssy package hero
250
+
251
+ # Package multiple blocks
252
+ cmssy package hero pricing
253
+
254
+ # Package all blocks and templates
255
+ cmssy package --all
256
+
257
+ # Custom output directory
258
+ cmssy package --all --output dist/packages
259
+ ```
260
+
261
+ **What gets packaged:**
262
+ - Source files (`src/`)
263
+ - Configuration (`package.json`, `block.config.ts`)
264
+ - Preview data (`preview.json`)
265
+ - Built files (from `public/` if exists)
266
+ - README.md (if exists)
267
+
268
+ **Output:** `packages/<name>-<version>.zip` (e.g., `hero-1.0.0.zip`)
269
+
270
+ ---
271
+
272
+ ### Upload Packages to Workspace
273
+
274
+ ```bash
275
+ cmssy upload [files...] [options]
276
+ ```
277
+
278
+ Upload packaged ZIP files directly to your Cmssy workspace.
279
+
280
+ **Options:**
281
+ - `-w, --workspace <id>` - Workspace ID to upload to
282
+ - `--all` - Upload all packages from packages directory
283
+
284
+ **Example:**
285
+ ```bash
286
+ # Upload single package
287
+ cmssy upload hero-1.0.0.zip
288
+
289
+ # Upload multiple packages (with or without .zip extension)
290
+ cmssy upload hero-1.0.0 pricing-2.1.0
291
+
292
+ # Upload all packages
293
+ cmssy upload --all
294
+
295
+ # Specify workspace ID
296
+ cmssy upload --all --workspace 507f1f77bcf86cd799439011
297
+ ```
298
+
299
+ **Requirements:**
300
+ - Packages must exist in `packages/` directory (run `cmssy package` first)
301
+ - API token must be configured in `.env`
302
+ - Workspace ID via `--workspace` flag or `CMSSY_WORKSPACE_ID` in `.env`
303
+
304
+ **Typical workflow:**
305
+ ```bash
306
+ cmssy package --all
307
+ cmssy upload --all
308
+ ```
309
+
310
+ ---
311
+
312
+ ### Sync from Marketplace
313
+
314
+ ```bash
315
+ cmssy sync [package] [options]
316
+ ```
317
+
318
+ Pull blocks from Cmssy marketplace to local project.
319
+
320
+ **Options:**
321
+ - `--workspace <id>` - Workspace ID to sync from
322
+
323
+ **Example:**
324
+ ```bash
325
+ cmssy sync @vendor/blocks.hero
326
+ cmssy sync @vendor/blocks.hero --workspace 507f1f77bcf86cd799439011
327
+ ```
328
+
329
+ ---
330
+
331
+ ### Migrate to block.config.ts
332
+
333
+ ```bash
334
+ cmssy migrate [block-name]
335
+ ```
336
+
337
+ Migrate from legacy `package.json` cmssy section to new `block.config.ts` format.
338
+
339
+ **Example:**
340
+ ```bash
341
+ # Migrate specific block
342
+ cmssy migrate hero
343
+
344
+ # Migrate all blocks
345
+ cmssy migrate
346
+ ```
347
+
348
+ **What it does:**
349
+ - Converts `package.json` cmssy section to `block.config.ts`
350
+ - Removes cmssy section from `package.json`
351
+ - Generates TypeScript types from schema
352
+
353
+ ---
354
+
355
+ ### List Workspaces
356
+
357
+ ```bash
358
+ cmssy workspaces
359
+ ```
360
+
361
+ List all workspaces you have access to and get their IDs.
362
+
363
+ **Example:**
364
+ ```bash
365
+ cmssy workspaces
366
+ ```
367
+
368
+ **Output:**
369
+ ```
370
+ 📁 Your Workspaces (2):
371
+
372
+ Acme Corporation
373
+ Slug: acme-corp
374
+ ID: 507f1f77bcf86cd799439011
375
+ Role: owner
376
+
377
+ Team Project
378
+ Slug: team-project
379
+ ID: 673e4f3b2e8d9c1a4b5f6e8d
380
+ Role: member
381
+
382
+ 💡 Tip: Copy the ID above and add to .env:
383
+ CMSSY_WORKSPACE_ID=507f1f77bcf86cd799439011
384
+ ```
385
+
386
+ **Use this command to:**
387
+ - Find your workspace IDs for publishing
388
+ - See your role in each workspace
389
+ - Copy workspace ID to `.env` for CLI usage
390
+
391
+ **Requirements:**
392
+ - API token must be configured (run `cmssy configure` first)
393
+
394
+ ---
395
+
396
+ ## Project Structure
397
+
398
+ ```
399
+ my-blocks/
400
+ ├── cmssy.config.js # Project configuration
401
+ ├── .env # API credentials (not committed)
402
+ ├── .env.example # Example environment variables
403
+ ├── blocks/ # Your blocks
404
+ │ └── hero/
405
+ │ ├── package.json # Block metadata
406
+ │ ├── preview.json # Preview data for dev server
407
+ │ └── src/
408
+ │ ├── index.tsx # Block component
409
+ │ └── index.css # Block styles
410
+ ├── templates/ # Your page templates
411
+ ├── packages/ # ZIP packages (created by cmssy package)
412
+ │ ├── hero-1.0.0.zip
413
+ │ └── pricing-2.1.0.zip
414
+ ├── public/ # Build output
415
+ │ └── @vendor/package-name/version/
416
+ │ ├── index.js
417
+ │ ├── index.css
418
+ │ └── package.json
419
+ └── package.json
420
+ ```
421
+
422
+ ## Block Metadata
423
+
424
+ Each block requires a `cmssy` section in its `package.json`:
425
+
426
+ ```json
427
+ {
428
+ "name": "@vendor/blocks.hero",
429
+ "version": "1.0.0",
430
+ "description": "Hero section block",
431
+ "cmssy": {
432
+ "packageType": "block",
433
+ "displayName": "Hero Section",
434
+ "category": "marketing",
435
+ "tags": ["hero", "landing", "cta"],
436
+ "pricing": {
437
+ "licenseType": "free"
438
+ },
439
+ "schemaFields": [
440
+ {
441
+ "name": "title",
442
+ "type": "singleLine",
443
+ "label": "Section Title",
444
+ "defaultValue": "Welcome"
445
+ }
446
+ ],
447
+ "defaultContent": {
448
+ "title": "Welcome to Our Platform"
449
+ }
450
+ }
451
+ }
452
+ ```
453
+
454
+ ## Publishing Workflows
455
+
456
+ ### Marketplace Publishing (Public, Requires Review)
457
+
458
+ For vendors who want to share blocks publicly:
459
+
460
+ ```bash
461
+ # 1. Build your blocks
462
+ cmssy build
463
+
464
+ # 2. Publish to marketplace
465
+ cmssy publish --all --marketplace --patch
466
+
467
+ # 3. Wait for Cmssy team review
468
+ # 4. Once approved, blocks appear in public marketplace
469
+ ```
470
+
471
+ **Use cases:**
472
+ - Public blocks for all Cmssy users
473
+ - Commercial blocks/templates
474
+ - Open-source contributions
475
+
476
+ **Requirements:**
477
+ - API token with `marketplace:publish` scope
478
+ - Blocks undergo review process
479
+ - Must meet marketplace quality standards
480
+
481
+ ---
482
+
483
+ ### Workspace Publishing (Private, Instant)
484
+
485
+ For teams with private block libraries:
486
+
487
+ ```bash
488
+ # 1. Build your blocks
489
+ cmssy build
490
+
491
+ # 2. Publish to workspace
492
+ cmssy publish --all --workspace 507f1f77bcf86cd799439011 --patch
493
+
494
+ # 3. Instantly available in your workspace
495
+ ```
496
+
497
+ **Use cases:**
498
+ - Private company block libraries
499
+ - Internal design systems
500
+ - Client-specific components
501
+
502
+ **Requirements:**
503
+ - API token with `workspace:write` scope
504
+ - Workspace ID
505
+ - No review required, instant publish
506
+
507
+ ---
508
+
509
+ ### ZIP Package Workflow (Manual Upload)
510
+
511
+ For manual distribution or custom upload:
512
+
513
+ ```bash
514
+ # 1. Package blocks into ZIP files
515
+ cmssy package --all
516
+
517
+ # 2. Option A: Upload via CLI
518
+ cmssy upload --all --workspace 507f1f77bcf86cd799439011
519
+
520
+ # 2. Option B: Upload manually
521
+ # - Go to http://localhost:3000/workspace/cmssy/resources/add-external
522
+ # - Upload the ZIP files from packages/ directory
523
+ ```
524
+
525
+ **Use cases:**
526
+ - Manual review before upload
527
+ - Offline distribution
528
+ - Custom deployment pipelines
529
+
530
+ ---
531
+
532
+ ## Environment Variables Reference
533
+
534
+ | Variable | Required | Description | Example |
535
+ |----------|----------|-------------|---------|
536
+ | `CMSSY_API_URL` | Yes (for publish/upload) | Cmssy API GraphQL endpoint | `https://api.cmssy.io/graphql` |
537
+ | `CMSSY_API_TOKEN` | Yes (for publish/upload) | API authentication token | `cmssy_abc123...` |
538
+ | `CMSSY_WORKSPACE_ID` | No | Default workspace ID (MongoDB ObjectId) | `507f1f77bcf86cd799439011` |
539
+
540
+ ## Requirements
541
+
542
+ - Node.js 18+
543
+ - npm or yarn
544
+
545
+ ## Complete Workflow Examples
546
+
547
+ ### Example 1: New Public Block
548
+
549
+ ```bash
550
+ # Initialize project
551
+ cmssy init my-blocks
552
+ cd my-blocks
553
+
554
+ # Create block
555
+ cmssy create block pricing-table
556
+
557
+ # Develop with hot reload
558
+ cmssy dev
559
+
560
+ # Build
561
+ cmssy build
562
+
563
+ # Configure API (one-time)
564
+ cmssy configure
565
+
566
+ # Publish to marketplace
567
+ cmssy publish pricing-table --marketplace --minor
568
+ ```
569
+
570
+ ---
571
+
572
+ ### Example 2: Private Workspace Library
573
+
574
+ ```bash
575
+ # Initialize project
576
+ cmssy init company-blocks
577
+ cd company-blocks
578
+
579
+ # Create multiple blocks
580
+ cmssy create block header
581
+ cmssy create block footer
582
+ cmssy create block cta
583
+
584
+ # Configure API with workspace
585
+ cmssy configure
586
+
587
+ # List workspaces and get workspace ID
588
+ cmssy workspaces
589
+ # Copy workspace ID and add to .env: CMSSY_WORKSPACE_ID=507f1f77bcf86cd799439011
590
+
591
+ # Develop and test
592
+ cmssy dev
593
+
594
+ # Build and publish all to workspace
595
+ cmssy build
596
+ cmssy publish --all --workspace
597
+ ```
598
+
599
+ ---
600
+
601
+ ### Example 3: ZIP Distribution
602
+
603
+ ```bash
604
+ # Package blocks
605
+ cmssy package --all
606
+
607
+ # Distribute ZIP files
608
+ # - Upload manually to Cmssy workspace UI
609
+ # - Or use upload command:
610
+ cmssy upload --all --workspace 507f1f77bcf86cd799439011
611
+
612
+ # Or share packages/hero-1.0.0.zip with team
613
+ ```
614
+
615
+ ---
616
+
617
+ ## Troubleshooting
618
+
619
+ ### "API token not configured"
620
+ Run `cmssy configure` or manually add `CMSSY_API_TOKEN` to `.env`
621
+
622
+ ### "Workspace ID required"
623
+ **Option 1: From UI**
624
+ 1. Go to Workspace Settings → General
625
+ 2. Copy workspace ID using the copy button
626
+ 3. Add to `.env`: `CMSSY_WORKSPACE_ID=507f1f77bcf86cd799439011`
627
+
628
+ **Option 2: From CLI**
629
+ 1. Run `cmssy workspaces` to list your workspaces
630
+ 2. Copy the workspace ID (24-character hex string like `507f1f77bcf86cd799439011`)
631
+ 3. Add to `.env`: `CMSSY_WORKSPACE_ID=507f1f77bcf86cd799439011`
632
+
633
+ **Option 3: Use flag**
634
+ - Use `--workspace 507f1f77bcf86cd799439011` flag in commands
635
+
636
+ ### "Specify publish target"
637
+ Must use either `--marketplace` OR `--workspace` when publishing
638
+
639
+ ### "Not a Cmssy project"
640
+ Make sure you're in a directory with `cmssy.config.js` file
641
+
642
+ ## License
643
+
644
+ MIT
645
+
646
+ ## Support
647
+
648
+ - Documentation: [https://cmssy.io/docs](https://cmssy.io/docs)
649
+ - Issues: [https://github.com/maciekbe1/cmssy-cli/issues](https://github.com/maciekbe1/cmssy-cli/issues)
package/config.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { defineBlock, defineTemplate } from "./dist/utils/block-config.js";
2
+ export type { BlockConfig, FieldConfig, FieldType, BaseFieldConfig, SelectFieldConfig, RepeaterFieldConfig, BlockRequires, LayoutPosition, ShowWhenCondition, FieldValidation, ValidationPattern, WorkspaceModule, FeatureFlag, TemplateConfig, TemplatePageBlueprint, TemplateBlockInstance, TemplateLayoutSlot, TemplateTheme, } from "./dist/types/block-config.js";
package/config.js ADDED
@@ -0,0 +1,2 @@
1
+ // Package exports for block.config.ts authoring
2
+ export { defineBlock, defineTemplate } from "./dist/utils/block-config.js";
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}