cmssy-cli 0.4.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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +235 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +71 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/build.d.ts +6 -0
  8. package/dist/commands/build.d.ts.map +1 -0
  9. package/dist/commands/build.js +153 -0
  10. package/dist/commands/build.js.map +1 -0
  11. package/dist/commands/configure.d.ts +6 -0
  12. package/dist/commands/configure.d.ts.map +1 -0
  13. package/dist/commands/configure.js +42 -0
  14. package/dist/commands/configure.js.map +1 -0
  15. package/dist/commands/create.d.ts +8 -0
  16. package/dist/commands/create.d.ts.map +1 -0
  17. package/dist/commands/create.js +314 -0
  18. package/dist/commands/create.js.map +1 -0
  19. package/dist/commands/deploy.d.ts +9 -0
  20. package/dist/commands/deploy.d.ts.map +1 -0
  21. package/dist/commands/deploy.js +226 -0
  22. package/dist/commands/deploy.js.map +1 -0
  23. package/dist/commands/dev.d.ts +6 -0
  24. package/dist/commands/dev.d.ts.map +1 -0
  25. package/dist/commands/dev.js +489 -0
  26. package/dist/commands/dev.js.map +1 -0
  27. package/dist/commands/init.d.ts +6 -0
  28. package/dist/commands/init.d.ts.map +1 -0
  29. package/dist/commands/init.js +517 -0
  30. package/dist/commands/init.js.map +1 -0
  31. package/dist/commands/sync.d.ts +6 -0
  32. package/dist/commands/sync.d.ts.map +1 -0
  33. package/dist/commands/sync.js +208 -0
  34. package/dist/commands/sync.js.map +1 -0
  35. package/dist/utils/blockforge-config.d.ts +19 -0
  36. package/dist/utils/blockforge-config.d.ts.map +1 -0
  37. package/dist/utils/blockforge-config.js +19 -0
  38. package/dist/utils/blockforge-config.js.map +1 -0
  39. package/dist/utils/cmssy-config.d.ts +19 -0
  40. package/dist/utils/cmssy-config.d.ts.map +1 -0
  41. package/dist/utils/cmssy-config.js +19 -0
  42. package/dist/utils/cmssy-config.js.map +1 -0
  43. package/dist/utils/config.d.ts +8 -0
  44. package/dist/utils/config.d.ts.map +1 -0
  45. package/dist/utils/config.js +45 -0
  46. package/dist/utils/config.js.map +1 -0
  47. package/dist/utils/graphql.d.ts +4 -0
  48. package/dist/utils/graphql.d.ts.map +1 -0
  49. package/dist/utils/graphql.js +26 -0
  50. package/dist/utils/graphql.js.map +1 -0
  51. package/package.json +66 -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,235 @@
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
+ npm run dev
25
+
26
+ # 5. Create a new block
27
+ npx cmssy create block my-block
28
+
29
+ # 6. Build for production
30
+ npm run build
31
+
32
+ # 7. Configure Cmssy API (for publishing)
33
+ npx cmssy configure
34
+
35
+ # 8. Deploy to marketplace
36
+ npx cmssy deploy --all
37
+ ```
38
+
39
+ ## Commands
40
+
41
+ ### Initialize Project
42
+
43
+ ```bash
44
+ cmssy init [name] [options]
45
+ ```
46
+
47
+ Create a new Cmssy project with example blocks.
48
+
49
+ **Options:**
50
+ - `-f, --framework <framework>` - Framework (react, vue, angular, vanilla). Default: react
51
+
52
+ **Example:**
53
+ ```bash
54
+ cmssy init my-blocks --framework react
55
+ ```
56
+
57
+ ### Create Block or Template
58
+
59
+ ```bash
60
+ cmssy create block <name>
61
+ cmssy create template <name>
62
+ ```
63
+
64
+ Create a new block or page template in your project.
65
+
66
+ **Example:**
67
+ ```bash
68
+ cmssy create block hero
69
+ cmssy create template landing-page
70
+ ```
71
+
72
+ ### Build
73
+
74
+ ```bash
75
+ cmssy build [options]
76
+ ```
77
+
78
+ Build all blocks and templates for production.
79
+
80
+ **Options:**
81
+ - `--framework <framework>` - Override framework from config
82
+
83
+ **Example:**
84
+ ```bash
85
+ cmssy build
86
+ ```
87
+
88
+ **Output:** Built files are generated in `public/@vendor/package-name/version/` directory.
89
+
90
+ ### Development Server
91
+
92
+ ```bash
93
+ cmssy dev [options]
94
+ ```
95
+
96
+ Start development server with hot reload and preview.
97
+
98
+ **Options:**
99
+ - `-p, --port <port>` - Port number. Default: 3000
100
+
101
+ **Example:**
102
+ ```bash
103
+ cmssy dev --port 4000
104
+ ```
105
+
106
+ ### Configure API
107
+
108
+ ```bash
109
+ cmssy configure [options]
110
+ ```
111
+
112
+ Configure Cmssy API credentials for publishing.
113
+
114
+ **Options:**
115
+ - `--api-url <url>` - Cmssy API URL. Default: https://api.cmssy.io/graphql
116
+
117
+ **Example:**
118
+ ```bash
119
+ cmssy configure
120
+ ```
121
+
122
+ You'll be prompted for:
123
+ - **Cmssy API URL**: `https://api.cmssy.io/graphql` (or your local dev URL)
124
+ - **API Token**: Get this from your Cmssy workspace settings → API Tokens
125
+
126
+ Create an API token with `marketplace:publish` scope.
127
+
128
+ ### Deploy to Marketplace
129
+
130
+ ```bash
131
+ cmssy deploy [options]
132
+ ```
133
+
134
+ Publish blocks/templates to Cmssy marketplace.
135
+
136
+ **Options:**
137
+ - `--all` - Deploy all blocks and templates
138
+ - `--blocks <names...>` - Deploy specific blocks
139
+ - `--templates <names...>` - Deploy specific templates
140
+ - `--dry-run` - Preview without publishing
141
+
142
+ **Example:**
143
+ ```bash
144
+ # Deploy all
145
+ cmssy deploy --all
146
+
147
+ # Deploy specific blocks
148
+ cmssy deploy --blocks hero pricing
149
+
150
+ # Deploy specific templates
151
+ cmssy deploy --templates landing-page
152
+
153
+ # Dry run
154
+ cmssy deploy --all --dry-run
155
+ ```
156
+
157
+ ### Sync from Marketplace
158
+
159
+ ```bash
160
+ cmssy sync [package] [options]
161
+ ```
162
+
163
+ Pull blocks from Cmssy marketplace to local project.
164
+
165
+ **Options:**
166
+ - `--workspace <id>` - Workspace ID to sync from
167
+
168
+ **Example:**
169
+ ```bash
170
+ cmssy sync @vendor/blocks.hero --workspace abc123
171
+ ```
172
+
173
+ ## Project Structure
174
+
175
+ ```
176
+ my-blocks/
177
+ ├── cmssy.config.js # Project configuration
178
+ ├── blocks/ # Your blocks
179
+ │ └── hero/
180
+ │ ├── package.json # Block metadata
181
+ │ ├── preview.json # Preview data for dev server
182
+ │ └── src/
183
+ │ ├── index.tsx # Block component
184
+ │ └── index.css # Block styles
185
+ ├── templates/ # Your page templates
186
+ ├── public/ # Build output
187
+ │ └── @vendor/package-name/version/
188
+ │ ├── index.js
189
+ │ ├── index.css
190
+ │ └── package.json
191
+ ├── package.json
192
+ └── .env # API credentials
193
+ ```
194
+
195
+ ## Block Metadata
196
+
197
+ Each block requires a `blockforge` section in its `package.json`:
198
+
199
+ ```json
200
+ {
201
+ "name": "@vendor/blocks.hero",
202
+ "version": "1.0.0",
203
+ "description": "Hero section block",
204
+ "blockforge": {
205
+ "packageType": "block",
206
+ "displayName": "Hero Section",
207
+ "category": "marketing",
208
+ "tags": ["hero", "landing", "cta"],
209
+ "pricing": {
210
+ "licenseType": "free"
211
+ },
212
+ "schemaFields": [...],
213
+ "defaultContent": {...}
214
+ }
215
+ }
216
+ ```
217
+
218
+ ## Requirements
219
+
220
+ - Node.js 18+
221
+
222
+ ## Complete Workflow
223
+
224
+ 1. **Initialize**: `cmssy init my-blocks`
225
+ 2. **Develop**: `cmssy dev` (hot reload + preview)
226
+ 3. **Create**: `cmssy create block my-block`
227
+ 4. **Build**: `cmssy build`
228
+ 5. **Configure**: `cmssy configure` (one-time)
229
+ 6. **Deploy**: `cmssy deploy --all`
230
+ 7. **Review**: Your packages are submitted for Cmssy review
231
+ 8. **Publish**: Once approved, they're available in the marketplace
232
+
233
+ ## License
234
+
235
+ MIT
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":""}
package/dist/cli.js ADDED
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import { buildCommand } from "./commands/build.js";
4
+ import { configureCommand } from "./commands/configure.js";
5
+ import { createCommand } from "./commands/create.js";
6
+ import { deployCommand } from "./commands/deploy.js";
7
+ import { devCommand } from "./commands/dev.js";
8
+ import { initCommand } from "./commands/init.js";
9
+ import { syncCommand } from "./commands/sync.js";
10
+ const program = new Command();
11
+ program
12
+ .name("cmssy")
13
+ .description("Unified CLI for building and publishing blocks to Cmssy marketplace")
14
+ .version("0.4.0");
15
+ // cmssy init
16
+ program
17
+ .command("init")
18
+ .description("Initialize a new Cmssy project")
19
+ .argument("[name]", "Project name")
20
+ .option("-f, --framework <framework>", "Framework (react, vue, angular, vanilla)", "react")
21
+ .action(initCommand);
22
+ // cmssy create
23
+ const create = program
24
+ .command("create")
25
+ .description("Create a new block or template");
26
+ create
27
+ .command("block")
28
+ .description("Create a new block")
29
+ .argument("<name>", "Block name")
30
+ .action(createCommand.block);
31
+ create
32
+ .command("template")
33
+ .description("Create a new page template")
34
+ .argument("<name>", "Template name")
35
+ .action(createCommand.page);
36
+ // cmssy build
37
+ program
38
+ .command("build")
39
+ .description("Build all blocks and templates")
40
+ .option("--framework <framework>", "Framework to use")
41
+ .action(buildCommand);
42
+ // cmssy dev
43
+ program
44
+ .command("dev")
45
+ .description("Start development server with preview")
46
+ .option("-p, --port <port>", "Port number", "3000")
47
+ .action(devCommand);
48
+ // cmssy configure
49
+ program
50
+ .command("configure")
51
+ .description("Configure Cmssy API credentials")
52
+ .option("--api-url <url>", "Cmssy API URL", "https://api.cmssy.io/graphql")
53
+ .action(configureCommand);
54
+ // cmssy deploy
55
+ program
56
+ .command("deploy")
57
+ .description("Publish blocks/templates to Cmssy marketplace")
58
+ .option("--all", "Deploy all blocks and templates")
59
+ .option("--blocks <names...>", "Deploy specific blocks")
60
+ .option("--templates <names...>", "Deploy specific templates")
61
+ .option("--dry-run", "Preview what would be deployed without publishing")
62
+ .action(deployCommand);
63
+ // cmssy sync
64
+ program
65
+ .command("sync")
66
+ .description("Pull blocks from Cmssy marketplace to local project")
67
+ .argument("[package]", "Package slug to sync (e.g., @vendor/blocks.hero)")
68
+ .option("--workspace <id>", "Workspace ID to sync from")
69
+ .action(syncCommand);
70
+ program.parse();
71
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA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AE9B,cAAc;AACd,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,gCAAgC,CAAC;KAC7C,MAAM,CAAC,yBAAyB,EAAE,kBAAkB,CAAC;KACrD,MAAM,CAAC,YAAY,CAAC,CAAC;AAExB,YAAY;AACZ,OAAO;KACJ,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,uCAAuC,CAAC;KACpD,MAAM,CAAC,mBAAmB,EAAE,aAAa,EAAE,MAAM,CAAC;KAClD,MAAM,CAAC,UAAU,CAAC,CAAC;AAEtB,kBAAkB;AAClB,OAAO;KACJ,OAAO,CAAC,WAAW,CAAC;KACpB,WAAW,CAAC,iCAAiC,CAAC;KAC9C,MAAM,CAAC,iBAAiB,EAAE,eAAe,EAAE,8BAA8B,CAAC;KAC1E,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAE5B,eAAe;AACf,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,+CAA+C,CAAC;KAC5D,MAAM,CAAC,OAAO,EAAE,iCAAiC,CAAC;KAClD,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC;KACvD,MAAM,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;KAC7D,MAAM,CAAC,WAAW,EAAE,mDAAmD,CAAC;KACxE,MAAM,CAAC,aAAa,CAAC,CAAC;AAEzB,aAAa;AACb,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,qDAAqD,CAAC;KAClE,QAAQ,CAAC,WAAW,EAAE,kDAAkD,CAAC;KACzE,MAAM,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;KACvD,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvB,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ interface BuildOptions {
2
+ framework?: string;
3
+ }
4
+ export declare function buildCommand(options: BuildOptions): Promise<void>;
5
+ export {};
6
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAQA,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AASD,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,iBAwDvD"}
@@ -0,0 +1,153 @@
1
+ import chalk from "chalk";
2
+ import { build as esbuild } from "esbuild";
3
+ import { execSync } from "child_process";
4
+ import fs from "fs-extra";
5
+ import ora from "ora";
6
+ import path from "path";
7
+ import { getPackageJson, loadConfig } from "../utils/cmssy-config.js";
8
+ export async function buildCommand(options) {
9
+ const spinner = ora("Starting build...").start();
10
+ try {
11
+ const config = await loadConfig();
12
+ const framework = options.framework || config.framework;
13
+ // Scan for blocks and templates
14
+ const resources = await scanResources();
15
+ if (resources.length === 0) {
16
+ spinner.warn("No blocks or templates found");
17
+ process.exit(0);
18
+ }
19
+ spinner.text = `Building ${resources.length} resources...`;
20
+ const outDir = path.join(process.cwd(), config.build?.outDir || "public");
21
+ // Clean output directory
22
+ if (fs.existsSync(outDir)) {
23
+ fs.removeSync(outDir);
24
+ }
25
+ fs.mkdirSync(outDir, { recursive: true });
26
+ let successCount = 0;
27
+ let errorCount = 0;
28
+ for (const resource of resources) {
29
+ try {
30
+ await buildResource(resource, framework, outDir, config);
31
+ successCount++;
32
+ console.log(chalk.green(` ✓ ${resource.packageJson.name}@${resource.packageJson.version}`));
33
+ }
34
+ catch (error) {
35
+ errorCount++;
36
+ console.error(chalk.red(` ✖ ${resource.name}:`), error);
37
+ }
38
+ }
39
+ if (errorCount === 0) {
40
+ spinner.succeed(`Build complete! ${successCount} resources built`);
41
+ console.log(chalk.cyan(`\nOutput directory: ${outDir}\n`));
42
+ }
43
+ else {
44
+ spinner.warn(`Build completed with errors: ${successCount} succeeded, ${errorCount} failed`);
45
+ }
46
+ }
47
+ catch (error) {
48
+ spinner.fail("Build failed");
49
+ console.error(chalk.red("Error:"), error);
50
+ process.exit(1);
51
+ }
52
+ }
53
+ async function scanResources() {
54
+ const resources = [];
55
+ // Scan blocks
56
+ const blocksDir = path.join(process.cwd(), "blocks");
57
+ if (fs.existsSync(blocksDir)) {
58
+ const blockDirs = fs
59
+ .readdirSync(blocksDir, { withFileTypes: true })
60
+ .filter((dirent) => dirent.isDirectory())
61
+ .map((dirent) => dirent.name);
62
+ for (const blockName of blockDirs) {
63
+ const blockPath = path.join(blocksDir, blockName);
64
+ const pkg = getPackageJson(blockPath);
65
+ if (!pkg || !pkg.blockforge) {
66
+ console.warn(chalk.yellow(`Warning: Skipping ${blockName} - no blockforge metadata`));
67
+ continue;
68
+ }
69
+ resources.push({
70
+ type: "block",
71
+ name: blockName,
72
+ path: blockPath,
73
+ packageJson: pkg,
74
+ });
75
+ }
76
+ }
77
+ // Scan templates
78
+ const templatesDir = path.join(process.cwd(), "templates");
79
+ if (fs.existsSync(templatesDir)) {
80
+ const templateDirs = fs
81
+ .readdirSync(templatesDir, { withFileTypes: true })
82
+ .filter((dirent) => dirent.isDirectory())
83
+ .map((dirent) => dirent.name);
84
+ for (const templateName of templateDirs) {
85
+ const templatePath = path.join(templatesDir, templateName);
86
+ const pkg = getPackageJson(templatePath);
87
+ if (!pkg || !pkg.blockforge) {
88
+ console.warn(chalk.yellow(`Warning: Skipping ${templateName} - no blockforge metadata`));
89
+ continue;
90
+ }
91
+ resources.push({
92
+ type: "template",
93
+ name: templateName,
94
+ path: templatePath,
95
+ packageJson: pkg,
96
+ });
97
+ }
98
+ }
99
+ return resources;
100
+ }
101
+ async function buildResource(resource, framework, outDir, config) {
102
+ const srcPath = path.join(resource.path, "src");
103
+ const entryPoint = framework === "react"
104
+ ? path.join(srcPath, "index.tsx")
105
+ : path.join(srcPath, "index.ts");
106
+ if (!fs.existsSync(entryPoint)) {
107
+ throw new Error(`Entry point not found: ${entryPoint}`);
108
+ }
109
+ // Create versioned output directory
110
+ // Example: public/@vendor/blocks.hero/1.0.0/
111
+ const packageName = resource.packageJson.name;
112
+ const version = resource.packageJson.version;
113
+ const destDir = path.join(outDir, packageName, version);
114
+ fs.mkdirSync(destDir, { recursive: true });
115
+ // Build JavaScript
116
+ const outFile = path.join(destDir, "index.js");
117
+ await esbuild({
118
+ entryPoints: [entryPoint],
119
+ bundle: true,
120
+ format: "esm",
121
+ outfile: outFile,
122
+ jsx: "transform",
123
+ minify: config.build?.minify ?? true,
124
+ sourcemap: config.build?.sourcemap ?? true,
125
+ target: "es2020",
126
+ external: ["*.css"],
127
+ });
128
+ // Process CSS with PostCSS if exists
129
+ const cssPath = path.join(srcPath, "index.css");
130
+ if (fs.existsSync(cssPath)) {
131
+ const outCssFile = path.join(destDir, "index.css");
132
+ // Check if postcss.config.js exists (Tailwind enabled)
133
+ const postcssConfigPath = path.join(process.cwd(), "postcss.config.js");
134
+ if (fs.existsSync(postcssConfigPath)) {
135
+ // Use PostCSS to process CSS (includes Tailwind)
136
+ try {
137
+ execSync(`npx postcss "${cssPath}" -o "${outCssFile}"${config.build?.minify ? " --no-map" : ""}`, { stdio: "pipe", cwd: process.cwd() });
138
+ }
139
+ catch (error) {
140
+ console.warn(chalk.yellow(`Warning: PostCSS processing failed: ${error.message}`));
141
+ console.log(chalk.gray("Copying CSS as-is..."));
142
+ fs.copyFileSync(cssPath, outCssFile);
143
+ }
144
+ }
145
+ else {
146
+ // No PostCSS config - just copy CSS
147
+ fs.copyFileSync(cssPath, outCssFile);
148
+ }
149
+ }
150
+ // Copy package.json for metadata
151
+ fs.copyFileSync(path.join(resource.path, "package.json"), path.join(destDir, "package.json"));
152
+ }
153
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;A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AAC,GAAG,EAAE,EAAE,CACtC,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,uCAAuC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;gBACnF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;gBAChD,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,oCAAoC;YACpC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAED,iCAAiC;IACjC,EAAE,CAAC,YAAY,CACb,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,EACxC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CACnC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ interface ConfigureOptions {
2
+ apiUrl?: string;
3
+ }
4
+ export declare function configureCommand(options: ConfigureOptions): Promise<void>;
5
+ export {};
6
+ //# sourceMappingURL=configure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../src/commands/configure.ts"],"names":[],"mappings":"AAIA,UAAU,gBAAgB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,iBA8C/D"}
@@ -0,0 +1,42 @@
1
+ import chalk from "chalk";
2
+ import inquirer from "inquirer";
3
+ import { loadConfig, saveConfig } from "../utils/config.js";
4
+ export async function configureCommand(options) {
5
+ console.log(chalk.blue.bold("\n🔨 Cmssy - Configure\n"));
6
+ const existingConfig = loadConfig();
7
+ const answers = await inquirer.prompt([
8
+ {
9
+ type: "input",
10
+ name: "apiUrl",
11
+ message: "Cmssy API URL:",
12
+ default: options.apiUrl ||
13
+ existingConfig.apiUrl ||
14
+ "https://api.cmssy.io/graphql",
15
+ },
16
+ {
17
+ type: "password",
18
+ name: "apiToken",
19
+ message: "Cmssy API Token (from /settings/tokens):",
20
+ default: existingConfig.apiToken || undefined,
21
+ validate: (input) => {
22
+ if (!input || input.length < 10) {
23
+ return "Please enter a valid API token";
24
+ }
25
+ if (!input.startsWith("bf_")) {
26
+ return 'Token should start with "bf_"';
27
+ }
28
+ return true;
29
+ },
30
+ },
31
+ ]);
32
+ // Save to .env
33
+ saveConfig({
34
+ apiUrl: answers.apiUrl,
35
+ apiToken: answers.apiToken,
36
+ });
37
+ console.log(chalk.green("\n✓ Configuration saved to .env\n"));
38
+ console.log(chalk.cyan("Next steps:\n"));
39
+ console.log(chalk.white(" cmssy deploy # Publish to marketplace"));
40
+ console.log(chalk.white(" cmssy sync # Pull blocks from Cmssy\n"));
41
+ }
42
+ //# sourceMappingURL=configure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/commands/configure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAM5D,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAyB;IAC9D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC;IAEzD,MAAM,cAAc,GAAG,UAAU,EAAE,CAAC;IAEpC,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACpC;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,gBAAgB;YACzB,OAAO,EACL,OAAO,CAAC,MAAM;gBACd,cAAc,CAAC,MAAM;gBACrB,8BAA8B;SACjC;QACD;YACE,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,0CAA0C;YACnD,OAAO,EAAE,cAAc,CAAC,QAAQ,IAAI,SAAS;YAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;gBAClB,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;oBAChC,OAAO,gCAAgC,CAAC;gBAC1C,CAAC;gBACD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC7B,OAAO,+BAA+B,CAAC;gBACzC,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;SACF;KACF,CAAC,CAAC;IAEH,eAAe;IACf,UAAU,CAAC;QACT,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC3B,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;IACzC,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAC5D,CAAC;IACF,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAC9D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ declare function createBlock(name: string): Promise<void>;
2
+ declare function createPage(name: string): Promise<void>;
3
+ export declare const createCommand: {
4
+ block: typeof createBlock;
5
+ page: typeof createPage;
6
+ };
7
+ export {};
8
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAOA,iBAAe,WAAW,CAAC,IAAI,EAAE,MAAM,iBAoLtC;AAED,iBAAe,UAAU,CAAC,IAAI,EAAE,MAAM,iBAkKrC;AAED,eAAO,MAAM,aAAa;;;CAGzB,CAAC"}