@mexty/cli 1.2.0 → 1.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 (52) hide show
  1. package/BLOCKS_OVERVIEW.md +229 -0
  2. package/dist/commands/create.d.ts +9 -0
  3. package/dist/commands/create.d.ts.map +1 -0
  4. package/dist/commands/create.js +120 -0
  5. package/dist/commands/create.js.map +1 -0
  6. package/dist/commands/delete.d.ts +2 -0
  7. package/dist/commands/delete.d.ts.map +1 -0
  8. package/dist/commands/delete.js +59 -0
  9. package/dist/commands/delete.js.map +1 -0
  10. package/dist/commands/fork.d.ts +2 -0
  11. package/dist/commands/fork.d.ts.map +1 -0
  12. package/dist/commands/fork.js +57 -0
  13. package/dist/commands/fork.js.map +1 -0
  14. package/dist/commands/login.d.ts +2 -0
  15. package/dist/commands/login.d.ts.map +1 -0
  16. package/dist/commands/login.js +90 -0
  17. package/dist/commands/login.js.map +1 -0
  18. package/dist/commands/publish.d.ts +6 -0
  19. package/dist/commands/publish.d.ts.map +1 -0
  20. package/dist/commands/publish.js +173 -0
  21. package/dist/commands/publish.js.map +1 -0
  22. package/dist/commands/save.d.ts +2 -0
  23. package/dist/commands/save.d.ts.map +1 -0
  24. package/dist/commands/save.js +162 -0
  25. package/dist/commands/save.js.map +1 -0
  26. package/dist/commands/sync.d.ts +2 -0
  27. package/dist/commands/sync.d.ts.map +1 -0
  28. package/dist/commands/sync.js +250 -0
  29. package/dist/commands/sync.js.map +1 -0
  30. package/dist/index.d.ts +3 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +76 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/utils/api.d.ts +92 -0
  35. package/dist/utils/api.d.ts.map +1 -0
  36. package/dist/utils/api.js +169 -0
  37. package/dist/utils/api.js.map +1 -0
  38. package/dist/utils/auth.d.ts +4 -0
  39. package/dist/utils/auth.d.ts.map +1 -0
  40. package/dist/utils/auth.js +27 -0
  41. package/dist/utils/auth.js.map +1 -0
  42. package/dist/utils/git.d.ts +42 -0
  43. package/dist/utils/git.d.ts.map +1 -0
  44. package/dist/utils/git.js +171 -0
  45. package/dist/utils/git.js.map +1 -0
  46. package/package.json +1 -1
  47. package/src/commands/create.ts +11 -7
  48. package/src/commands/publish.ts +146 -55
  49. package/src/index.ts +2 -13
  50. package/src/utils/api.ts +27 -0
  51. package/src/commands/fork.ts +0 -58
  52. package/src/commands/sync.ts +0 -350
@@ -0,0 +1,229 @@
1
+ # MEXTY Blocks: Interactive Reusable Components
2
+
3
+ ## What are Blocks?
4
+
5
+ Blocks are **interactive, reusable, and customizable React components** that can be embedded anywhere. They are the core building blocks of the MEXTY platform, designed to create rich, engaging experiences that can be easily shared and integrated.
6
+
7
+ ## Key Characteristics
8
+
9
+ ### 1. **Interactive**
10
+
11
+ - Blocks are fully functional React components with state management
12
+ - Support user interactions like clicks, form inputs, animations, and real-time updates
13
+ - Can include complex UI elements like charts, games, quizzes, media players, etc.
14
+
15
+ ### 2. **Reusable**
16
+
17
+ - Once created, blocks can be used multiple times across different contexts
18
+ - Published blocks can be discovered and used by other users
19
+ - Blocks maintain their functionality regardless of where they're embedded
20
+
21
+ ### 3. **Customizable via Props**
22
+
23
+ - Blocks accept **props** (properties) that allow customization without code changes
24
+ - Props can be of various types: strings, numbers, booleans, colors, URLs, arrays, objects
25
+ - Users can modify block behavior and appearance through a visual props editor
26
+
27
+ ## Props System
28
+
29
+ The props system is the heart of block customization:
30
+
31
+ ### Supported Prop Types
32
+
33
+ - **String**: Text content, labels, descriptions
34
+ - **Number**: Quantities, dimensions, durations
35
+ - **Boolean**: Toggle features on/off
36
+ - **Color**: Theme colors, backgrounds, text colors
37
+ - **Image URL**: Pictures, icons, backgrounds
38
+ - **Video URL**: Video content, tutorials
39
+ - **Audio URL**: Sound effects, music, narration
40
+ - **3D Model URL**: GLB/GLTF files for 3D content
41
+ - **Array**: Lists of items, datasets
42
+ - **Object**: Complex nested configurations
43
+ - **Enum**: Predefined choices (dropdown selections)
44
+
45
+ ### Props Editor Features
46
+
47
+ - **Visual Interface**: No code required to customize blocks
48
+ - **Real-time Preview**: See changes instantly as you edit props
49
+ - **Media Integration**: Upload files, select from workspace, or use AI generation
50
+ - **Nested Objects**: Support for complex data structures
51
+ - **Array Management**: Add/remove items dynamically
52
+ - **Type Validation**: Ensures props match expected types
53
+
54
+ ## Block Structure
55
+
56
+ ### Core Files
57
+
58
+ ```
59
+ block-repository/
60
+ ├── src/
61
+ │ ├── block.tsx # Main component (receives props)
62
+ │ ├── App.tsx # Wrapper component
63
+ │ └── index.tsx # Entry point
64
+ ├── package.json # Dependencies and metadata
65
+ ├── webpack.config.js # Build configuration
66
+ └── index.html # Development preview
67
+ ```
68
+
69
+ ### Example Block Component
70
+
71
+ ```tsx
72
+ interface BlockProps {
73
+ title: string;
74
+ color: string;
75
+ items: Array<{
76
+ name: string;
77
+ value: number;
78
+ }>;
79
+ showAnimation: boolean;
80
+ }
81
+
82
+ export default function MyBlock(props: BlockProps) {
83
+ const { title, color, items, showAnimation } = props;
84
+
85
+ return (
86
+ <div style={{ backgroundColor: color }}>
87
+ <h1>{title}</h1>
88
+ {items.map((item, index) => (
89
+ <div key={index} className={showAnimation ? "animate" : ""}>
90
+ {item.name}: {item.value}
91
+ </div>
92
+ ))}
93
+ </div>
94
+ );
95
+ }
96
+ ```
97
+
98
+ ## Block Lifecycle
99
+
100
+ ### 1. **Creation**
101
+
102
+ - Use `mexty create block --name "Block Name" --description "Description" --category "category"`
103
+ - Automatically creates GitHub repository with template
104
+ - Sets up development environment
105
+
106
+ ### 2. **Development**
107
+
108
+ - Edit `src/block.tsx` to implement functionality
109
+ - Define TypeScript interfaces for props
110
+ - Test locally with `npm start`
111
+
112
+ ### 3. **Publishing**
113
+
114
+ - Use `mexty save` to commit changes and trigger build
115
+ - System automatically parses props schema from TypeScript interfaces
116
+ - Generates federation bundle for embedding
117
+
118
+ ### 4. **Distribution**
119
+
120
+ - Blocks can be shared privately or published to marketplace
121
+ - Published blocks become available as named components
122
+ - Can be made insertable by AI agents for automated content creation
123
+
124
+ ## Props Schema Auto-Detection
125
+
126
+ The system automatically analyzes your block's TypeScript interface to generate a props schema:
127
+
128
+ ```tsx
129
+ interface BlockProps {
130
+ title: string; // → String input
131
+ count: number; // → Number input
132
+ enabled: boolean; // → Toggle switch
133
+ color: string; // → Color picker (if name contains 'color')
134
+ imageUrl: string; // → Image selector (if name contains 'image')
135
+ options: string[]; // → Array of strings
136
+ config: {
137
+ // → Nested object
138
+ theme: "light" | "dark"; // → Enum dropdown
139
+ size: number;
140
+ };
141
+ }
142
+ ```
143
+
144
+ ## Use Cases
145
+
146
+ ### Educational Content
147
+
148
+ - Interactive quizzes and assessments
149
+ - Data visualizations and charts
150
+ - Simulations and experiments
151
+ - Progress trackers
152
+
153
+ ### Business Applications
154
+
155
+ - Product showcases
156
+ - Pricing calculators
157
+ - Contact forms
158
+ - Dashboard widgets
159
+
160
+ ### Entertainment
161
+
162
+ - Mini-games
163
+ - Interactive stories
164
+ - Media players
165
+ - Social widgets
166
+
167
+ ### Marketing
168
+
169
+ - Call-to-action buttons
170
+ - Lead generation forms
171
+ - Product demos
172
+ - Testimonial carousels
173
+
174
+ ## Integration Methods
175
+
176
+ ### 1. **Direct Embedding**
177
+
178
+ ```html
179
+ <iframe src="https://mexty.ai/preview.html?blockId=BLOCK_ID"></iframe>
180
+ ```
181
+
182
+ ### 2. **React Integration**
183
+
184
+ ```tsx
185
+ import { WeatherWidget } from "@mexty/block";
186
+
187
+ <WeatherWidget location="Paris" showForecast={true} theme="dark" />;
188
+ ```
189
+
190
+ ### 3. **Federation Module**
191
+
192
+ ```javascript
193
+ const RemoteComponent = React.lazy(() => import("FEDERATION_URL"));
194
+ ```
195
+
196
+ ## AI Agent Integration
197
+
198
+ Blocks can be marked as "insertable by agent" which allows AI systems to:
199
+
200
+ - Automatically select appropriate blocks for content
201
+ - Generate suitable props based on context
202
+ - Insert blocks into courses and pages
203
+ - Customize block behavior for specific use cases
204
+
205
+ ## Best Practices
206
+
207
+ ### Props Design
208
+
209
+ - Use descriptive prop names that indicate their purpose
210
+ - Provide sensible default values
211
+ - Group related props into objects
212
+ - Use enums for predefined choices
213
+
214
+ ### Component Structure
215
+
216
+ - Keep components focused and single-purpose
217
+ - Handle loading and error states gracefully
218
+ - Make components responsive and accessible
219
+ - Optimize for performance
220
+
221
+ ### Development Workflow
222
+
223
+ 1. Define props interface first
224
+ 2. Implement component logic
225
+ 3. Test with various prop combinations
226
+ 4. Commit and publish with `mexty save`
227
+ 5. Share or publish to marketplace
228
+
229
+ This system enables rapid creation of interactive content while maintaining consistency, reusability, and ease of customization for end users.
@@ -0,0 +1,9 @@
1
+ interface CreateOptions {
2
+ description?: string;
3
+ type?: string;
4
+ name?: string;
5
+ category?: string;
6
+ }
7
+ export declare function createCommand(subcommand?: string, options?: CreateOptions): Promise<void>;
8
+ export {};
9
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAOA,UAAU,aAAa;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAwBD,wBAAsB,aAAa,CACjC,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAiIf"}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createCommand = createCommand;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const api_1 = require("../utils/api");
10
+ const git_1 = require("../utils/git");
11
+ const readline_1 = require("readline");
12
+ const auth_1 = require("../utils/auth");
13
+ // Simple prompt function to replace inquirer
14
+ async function prompt(question, defaultValue) {
15
+ return new Promise((resolve) => {
16
+ const rl = (0, readline_1.createInterface)({
17
+ input: process.stdin,
18
+ output: process.stdout,
19
+ });
20
+ const promptText = defaultValue
21
+ ? `${question} (${defaultValue}): `
22
+ : `${question}: `;
23
+ rl.question(promptText, (answer) => {
24
+ rl.close();
25
+ resolve(answer.trim() || defaultValue || "");
26
+ });
27
+ });
28
+ }
29
+ async function createCommand(subcommand, options = {}) {
30
+ try {
31
+ // Check authentication first
32
+ (0, auth_1.requireAuthentication)();
33
+ const user = (0, auth_1.getAuthenticatedUser)();
34
+ // Handle both old and new syntax
35
+ let blockName;
36
+ let blockDescription;
37
+ let blockType;
38
+ if (subcommand === "block") {
39
+ // New syntax: mexty create block --name "..." --description "..." --category "..."
40
+ if (!options.name) {
41
+ console.error(chalk_1.default.red('❌ --name is required when using "mexty create block"'));
42
+ console.log(chalk_1.default.yellow(' Usage: mexty create block --name "Block Name" --description "Description" --category "category"'));
43
+ process.exit(1);
44
+ }
45
+ blockName = options.name;
46
+ blockDescription = options.description || `Custom block: ${blockName}`;
47
+ blockType = options.category || options.type || "custom";
48
+ }
49
+ else {
50
+ // Old syntax: mexty create "Block Name" --description "..." --type "..."
51
+ if (!subcommand) {
52
+ console.error(chalk_1.default.red("❌ Block name is required"));
53
+ console.log(chalk_1.default.yellow(' Usage: mexty create "Block Name" [options]'));
54
+ console.log(chalk_1.default.yellow(' Or: mexty create block --name "Block Name" [options]'));
55
+ process.exit(1);
56
+ }
57
+ blockName = subcommand;
58
+ blockDescription = options.description || `Custom block: ${blockName}`;
59
+ blockType = options.type || "custom";
60
+ }
61
+ console.log(chalk_1.default.blue(`🚀 Creating new block: ${blockName}`));
62
+ console.log(chalk_1.default.gray(` User: ${user?.fullName || user?.email || "Unknown"}`));
63
+ console.log(chalk_1.default.gray(` Category: ${blockType}`));
64
+ // Prepare block data
65
+ const blockData = {
66
+ blockType: blockType,
67
+ title: blockName,
68
+ description: blockDescription,
69
+ allowedBrickTypes: ["text", "image", "video", "code", "quiz"], // Default allowed types
70
+ scope: ["user-store"], // Default scope for CLI-created blocks
71
+ content: [],
72
+ };
73
+ console.log(chalk_1.default.yellow("📡 Creating block on server..."));
74
+ // Create the block
75
+ const block = await api_1.apiClient.createBlock(blockData);
76
+ console.log(chalk_1.default.green(`✅ Block created successfully!`));
77
+ console.log(chalk_1.default.gray(` Block ID: ${block.id || block._id}`));
78
+ console.log(chalk_1.default.gray(` Block Type: ${block.blockType || block._doc?.blockType}`));
79
+ // Handle both plain objects and Mongoose documents
80
+ const gitUrl = block.gitUrl || block._doc?.gitUrl;
81
+ if (gitUrl) {
82
+ console.log(chalk_1.default.gray(` GitHub URL: ${gitUrl}`));
83
+ // Clone the repository
84
+ const repoName = git_1.GitManager.extractRepoName(gitUrl);
85
+ const targetDir = path_1.default.join(process.cwd(), repoName);
86
+ console.log(chalk_1.default.yellow(`📦 Cloning repository to ./${repoName}...`));
87
+ try {
88
+ const gitManager = new git_1.GitManager();
89
+ await gitManager.cloneRepository(gitUrl, targetDir);
90
+ console.log(chalk_1.default.green(`🎉 Block created and repository cloned successfully!`));
91
+ console.log(chalk_1.default.blue(`\nNext steps:`));
92
+ console.log(chalk_1.default.gray(` 1. cd ${repoName}`));
93
+ console.log(chalk_1.default.gray(` 2. Make your changes`));
94
+ console.log(chalk_1.default.gray(` 3. mexty save`));
95
+ // Change to the cloned directory
96
+ try {
97
+ process.chdir(targetDir);
98
+ console.log(chalk_1.default.green(`📁 Changed to directory: ${repoName}`));
99
+ }
100
+ catch (chdirError) {
101
+ console.warn(chalk_1.default.yellow(`⚠️ Could not change to directory: ${chdirError.message}`));
102
+ console.log(chalk_1.default.gray(` Please manually run: cd ${repoName}`));
103
+ }
104
+ }
105
+ catch (cloneError) {
106
+ console.error(chalk_1.default.red(`❌ Failed to clone repository: ${cloneError.message}`));
107
+ console.log(chalk_1.default.yellow(`You can manually clone it later:`));
108
+ console.log(chalk_1.default.gray(` git clone ${gitUrl}`));
109
+ }
110
+ }
111
+ else {
112
+ console.log(chalk_1.default.yellow("⚠️ No GitHub repository was created (GitHub not configured)"));
113
+ }
114
+ }
115
+ catch (error) {
116
+ console.error(chalk_1.default.red(`❌ Failed to create block: ${error.message}`));
117
+ process.exit(1);
118
+ }
119
+ }
120
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":";;;;;AAoCA,sCAoIC;AAxKD,kDAA0B;AAC1B,gDAAwB;AACxB,sCAA6D;AAC7D,sCAA0C;AAC1C,uCAA2C;AAC3C,wCAA4E;AAS5E,6CAA6C;AAC7C,KAAK,UAAU,MAAM,CACnB,QAAgB,EAChB,YAAqB;IAErB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,EAAE,GAAG,IAAA,0BAAe,EAAC;YACzB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,YAAY;YAC7B,CAAC,CAAC,GAAG,QAAQ,KAAK,YAAY,KAAK;YACnC,CAAC,CAAC,GAAG,QAAQ,IAAI,CAAC;QAEpB,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE;YACjC,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,YAAY,IAAI,EAAE,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,aAAa,CACjC,UAAmB,EACnB,UAAyB,EAAE;IAE3B,IAAI,CAAC;QACH,6BAA6B;QAC7B,IAAA,4BAAqB,GAAE,CAAC;QAExB,MAAM,IAAI,GA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CACF,CAAC;oBACF,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,8BAA8B,QAAQ,EAAE,CAAC,CAAC,CAAC;gBACpE,CAAC;YACH,CAAC;YAAC,OAAO,UAAe,EAAE,CAAC;gBACzB,OAAO,CAAC,KAAK,CACX,eAAK,CAAC,GAAG,CAAC,iCAAiC,UAAU,CAAC,OAAO,EAAE,CAAC,CACjE,CAAC;gBACF,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,kCAAkC,CAAC,CAAC,CAAC;gBAC9D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,eAAe,MAAM,EAAE,CAAC,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,MAAM,CACV,8DAA8D,CAC/D,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,6BAA6B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function deleteCommand(blockId: string): Promise<void>;
2
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":"AAoBA,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0ClE"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.deleteCommand = deleteCommand;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const api_1 = require("../utils/api");
9
+ const readline_1 = require("readline");
10
+ const auth_1 = require("../utils/auth");
11
+ // Simple confirmation function
12
+ async function confirm(question) {
13
+ return new Promise((resolve) => {
14
+ const rl = (0, readline_1.createInterface)({
15
+ input: process.stdin,
16
+ output: process.stdout
17
+ });
18
+ rl.question(`${question} (y/N): `, (answer) => {
19
+ rl.close();
20
+ resolve(answer.toLowerCase().trim() === 'y' || answer.toLowerCase().trim() === 'yes');
21
+ });
22
+ });
23
+ }
24
+ async function deleteCommand(blockId) {
25
+ try {
26
+ // Check authentication first
27
+ (0, auth_1.requireAuthentication)();
28
+ const user = (0, auth_1.getAuthenticatedUser)();
29
+ console.log(chalk_1.default.blue(`🗑️ Deleting block: ${blockId}`));
30
+ console.log(chalk_1.default.gray(` User: ${user?.fullName || user?.email || 'Unknown'}`));
31
+ // Get block info first
32
+ console.log(chalk_1.default.yellow('📡 Fetching block information...'));
33
+ const block = await api_1.apiClient.getBlock(blockId);
34
+ console.log(chalk_1.default.gray(` Title: ${block.title}`));
35
+ console.log(chalk_1.default.gray(` Description: ${block.description}`));
36
+ if (block.gitUrl) {
37
+ console.log(chalk_1.default.gray(` GitHub URL: ${block.gitUrl}`));
38
+ }
39
+ // Confirm deletion
40
+ const confirmed = await confirm(chalk_1.default.red('Are you sure you want to delete this block? This action cannot be undone.'));
41
+ if (!confirmed) {
42
+ console.log(chalk_1.default.yellow('🚫 Deletion cancelled.'));
43
+ return;
44
+ }
45
+ // Delete the block
46
+ console.log(chalk_1.default.yellow('📡 Deleting block on server...'));
47
+ await api_1.apiClient.deleteBlock(blockId);
48
+ console.log(chalk_1.default.green(`✅ Block deleted successfully!`));
49
+ if (block.gitUrl) {
50
+ console.log(chalk_1.default.yellow('⚠️ Note: The GitHub repository still exists and needs to be deleted manually if desired.'));
51
+ console.log(chalk_1.default.gray(` Repository: ${block.gitUrl}`));
52
+ }
53
+ }
54
+ catch (error) {
55
+ console.error(chalk_1.default.red(`❌ Failed to delete block: ${error.message}`));
56
+ process.exit(1);
57
+ }
58
+ }
59
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":";;;;;AAoBA,sCA0CC;AA9DD,kDAA0B;AAC1B,sCAAyC;AACzC,uCAA2C;AAC3C,wCAA4E;AAE5E,+BAA+B;AAC/B,KAAK,UAAU,OAAO,CAAC,QAAgB;IACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,EAAE,GAAG,IAAA,0BAAe,EAAC;YACzB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;QAEH,EAAE,CAAC,QAAQ,CAAC,GAAG,QAAQ,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE;YAC5C,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC;QACxF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,aAAa,CAAC,OAAe;IACjD,IAAI,CAAC;QACH,6BAA6B;QAC7B,IAAA,4BAAqB,GAAE,CAAC;QAExB,MAAM,IAAI,GAAG,IAAA,2BAAoB,GAAE,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC,CAAC;QAC3D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE,QAAQ,IAAI,IAAI,EAAE,KAAK,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC;QAElF,uBAAuB;QACvB,OAAO,CAAC,GAAG,CAAC,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,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,6BAA6B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function forkCommand(blockId: string): Promise<void>;
2
+ //# sourceMappingURL=fork.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fork.d.ts","sourceRoot":"","sources":["../../src/commands/fork.ts"],"names":[],"mappings":"AAMA,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmDhE"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.forkCommand = forkCommand;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const api_1 = require("../utils/api");
10
+ const git_1 = require("../utils/git");
11
+ const auth_1 = require("../utils/auth");
12
+ async function forkCommand(blockId) {
13
+ try {
14
+ // Check authentication first
15
+ (0, auth_1.requireAuthentication)();
16
+ const user = (0, auth_1.getAuthenticatedUser)();
17
+ console.log(chalk_1.default.blue(`🍴 Forking block: ${blockId}`));
18
+ console.log(chalk_1.default.gray(` User: ${user?.fullName || user?.email || 'Unknown'}`));
19
+ // Fork the block
20
+ console.log(chalk_1.default.yellow('📡 Forking block on server...'));
21
+ const forkedBlock = await api_1.apiClient.forkBlock({ blockId });
22
+ console.log(chalk_1.default.green(`✅ Block forked successfully!`));
23
+ console.log(chalk_1.default.gray(` New Block ID: ${forkedBlock._id}`));
24
+ console.log(chalk_1.default.gray(` Title: ${forkedBlock.title}`));
25
+ console.log(chalk_1.default.gray(` Description: ${forkedBlock.description}`));
26
+ if (forkedBlock.gitUrl) {
27
+ console.log(chalk_1.default.gray(` GitHub URL: ${forkedBlock.gitUrl}`));
28
+ // Clone the forked repository
29
+ const repoName = git_1.GitManager.extractRepoName(forkedBlock.gitUrl);
30
+ const targetDir = path_1.default.join(process.cwd(), repoName);
31
+ console.log(chalk_1.default.yellow(`📦 Cloning forked repository to ./${repoName}...`));
32
+ try {
33
+ const gitManager = new git_1.GitManager();
34
+ await gitManager.cloneRepository(forkedBlock.gitUrl, targetDir);
35
+ console.log(chalk_1.default.green(`🎉 Block forked and repository cloned successfully!`));
36
+ console.log(chalk_1.default.blue(`\nNext steps:`));
37
+ console.log(chalk_1.default.gray(` 1. cd ${repoName}`));
38
+ console.log(chalk_1.default.gray(` 2. Make your changes`));
39
+ console.log(chalk_1.default.gray(` 3. git add . && git commit -m "Your changes"`));
40
+ console.log(chalk_1.default.gray(` 4. mexty publish`));
41
+ }
42
+ catch (cloneError) {
43
+ console.error(chalk_1.default.red(`❌ Failed to clone repository: ${cloneError.message}`));
44
+ console.log(chalk_1.default.yellow(`You can manually clone it later:`));
45
+ console.log(chalk_1.default.gray(` git clone ${forkedBlock.gitUrl}`));
46
+ }
47
+ }
48
+ else {
49
+ console.log(chalk_1.default.yellow('⚠️ No GitHub repository available for this block'));
50
+ }
51
+ }
52
+ catch (error) {
53
+ console.error(chalk_1.default.red(`❌ Failed to fork block: ${error.message}`));
54
+ process.exit(1);
55
+ }
56
+ }
57
+ //# sourceMappingURL=fork.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fork.js","sourceRoot":"","sources":["../../src/commands/fork.ts"],"names":[],"mappings":";;;;;AAMA,kCAmDC;AAzDD,kDAA0B;AAC1B,gDAAwB;AACxB,sCAAyC;AACzC,sCAA0C;AAC1C,wCAA4E;AAErE,KAAK,UAAU,WAAW,CAAC,OAAe;IAC/C,IAAI,CAAC;QACH,6BAA6B;QAC7B,IAAA,4BAAqB,GAAE,CAAC;QAExB,MAAM,IAAI,GAAG,IAAA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,GAAG,CAAC,2BAA2B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function loginCommand(): Promise<void>;
2
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAwBA,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CA+ElD"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.loginCommand = loginCommand;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const readline_1 = require("readline");
9
+ const api_1 = require("../utils/api");
10
+ // Simple prompt function
11
+ async function prompt(question) {
12
+ return new Promise((resolve) => {
13
+ const rl = (0, readline_1.createInterface)({
14
+ input: process.stdin,
15
+ output: process.stdout
16
+ });
17
+ rl.question(question, (answer) => {
18
+ rl.close();
19
+ resolve(answer.trim());
20
+ });
21
+ });
22
+ }
23
+ // Wait function for countdown
24
+ async function wait(seconds) {
25
+ return new Promise(resolve => setTimeout(resolve, seconds * 1000));
26
+ }
27
+ async function loginCommand() {
28
+ try {
29
+ console.log(chalk_1.default.blue('🔐 Login to MEXT'));
30
+ // Check if already authenticated
31
+ if (api_1.apiClient.isAuthenticated()) {
32
+ const user = api_1.apiClient.getStoredUser();
33
+ console.log(chalk_1.default.green('✅ You are already logged in!'));
34
+ console.log(chalk_1.default.gray(` Email: ${user?.email || 'Unknown'}`));
35
+ console.log(chalk_1.default.gray(` Name: ${user?.fullName || 'Not set'}`));
36
+ const logout = await prompt('Do you want to logout and login as a different user? (y/N): ');
37
+ if (logout.toLowerCase() !== 'y' && logout.toLowerCase() !== 'yes') {
38
+ return;
39
+ }
40
+ await api_1.apiClient.logout();
41
+ console.log(chalk_1.default.yellow('📤 Logged out successfully'));
42
+ }
43
+ // Request email
44
+ const email = await prompt('Enter your email address: ');
45
+ if (!email || !email.includes('@')) {
46
+ console.error(chalk_1.default.red('❌ Please provide a valid email address'));
47
+ process.exit(1);
48
+ }
49
+ console.log(chalk_1.default.yellow('📧 Requesting verification code...'));
50
+ // Request OTP
51
+ try {
52
+ const otpResponse = await api_1.apiClient.requestOTP(email);
53
+ if (!otpResponse.success) {
54
+ console.error(chalk_1.default.red(`❌ ${otpResponse.message}`));
55
+ process.exit(1);
56
+ }
57
+ console.log(chalk_1.default.green('✅ Verification code sent to your email'));
58
+ console.log(chalk_1.default.gray(' Please check your inbox (and spam folder)'));
59
+ // Wait a moment for the user to check email
60
+ await wait(2);
61
+ // Request OTP code
62
+ const otp = await prompt('Enter the 6-digit verification code: ');
63
+ if (!otp || otp.length !== 6 || !/^\d{6}$/.test(otp)) {
64
+ console.error(chalk_1.default.red('❌ Please provide a valid 6-digit code'));
65
+ process.exit(1);
66
+ }
67
+ console.log(chalk_1.default.yellow('🔓 Verifying code...'));
68
+ // Verify OTP
69
+ const verifyResponse = await api_1.apiClient.verifyOTP(email, otp);
70
+ if (!verifyResponse.success) {
71
+ console.error(chalk_1.default.red(`❌ ${verifyResponse.message}`));
72
+ process.exit(1);
73
+ }
74
+ console.log(chalk_1.default.green('🎉 Login successful!'));
75
+ console.log(chalk_1.default.gray(` Welcome, ${verifyResponse.user?.fullName || verifyResponse.user?.email || 'User'}!`));
76
+ if (!verifyResponse.user?.isProfileComplete) {
77
+ console.log(chalk_1.default.yellow('⚠️ Your profile is incomplete. Please complete it in the web interface.'));
78
+ }
79
+ }
80
+ catch (error) {
81
+ console.error(chalk_1.default.red(`❌ Login failed: ${error.message}`));
82
+ process.exit(1);
83
+ }
84
+ }
85
+ catch (error) {
86
+ console.error(chalk_1.default.red(`❌ Login error: ${error.message}`));
87
+ process.exit(1);
88
+ }
89
+ }
90
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":";;;;;AAwBA,oCA+EC;AAvGD,kDAA0B;AAC1B,uCAA2C;AAC3C,sCAAyC;AAEzC,yBAAyB;AACzB,KAAK,UAAU,MAAM,CAAC,QAAgB;IACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,EAAE,GAAG,IAAA,0BAAe,EAAC;YACzB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;QAEH,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;YAC/B,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,8BAA8B;AAC9B,KAAK,UAAU,IAAI,CAAC,OAAe;IACjC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC;AACrE,CAAC;AAEM,KAAK,UAAU,YAAY;IAChC,IAAI,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAE5C,iCAAiC;QACjC,IAAI,eAAS,CAAC,eAAe,EAAE,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,eAAS,CAAC,aAAa,EAAE,CAAC;YACvC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC,CAAC;YACzD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,aAAa,IAAI,EAAE,KA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C,eAAK,CAAC,MAAM,CAAC,0EAA0E,CAAC,CAAC,CAAC;YACxG,CAAC;QAEH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,mBAAmB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IAEH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ interface PublishOptions {
2
+ agent?: boolean;
3
+ }
4
+ export declare function publishCommand(options?: PublishOptions): Promise<void>;
5
+ export {};
6
+ //# sourceMappingURL=publish.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAmEA,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,cAAc,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6HhF"}