@mexty/cli 1.5.0 ā 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GITHUB_OAUTH_SETUP.md +247 -0
- package/dist/commands/github-disconnect.d.ts +2 -0
- package/dist/commands/github-disconnect.d.ts.map +1 -0
- package/dist/commands/github-disconnect.js +73 -0
- package/dist/commands/github-disconnect.js.map +1 -0
- package/dist/commands/github-login.d.ts +2 -0
- package/dist/commands/github-login.d.ts.map +1 -0
- package/dist/commands/github-login.js +100 -0
- package/dist/commands/github-login.js.map +1 -0
- package/dist/commands/update-git-url.d.ts +2 -0
- package/dist/commands/update-git-url.d.ts.map +1 -0
- package/dist/commands/update-git-url.js +153 -0
- package/dist/commands/update-git-url.js.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/api.d.ts +24 -0
- package/dist/utils/api.d.ts.map +1 -1
- package/dist/utils/api.js +24 -0
- package/dist/utils/api.js.map +1 -1
- package/dist/utils/git.d.ts +5 -0
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +55 -2
- package/dist/utils/git.js.map +1 -1
- package/package.json +2 -1
- package/src/commands/github-disconnect.ts +80 -0
- package/src/commands/github-login.ts +107 -0
- package/src/commands/update-git-url.ts +170 -0
- package/src/index.ts +47 -0
- package/src/utils/api.ts +29 -0
- package/src/utils/git.ts +60 -2
- package/dist/commands/fork.d.ts +0 -2
- package/dist/commands/fork.d.ts.map +0 -1
- package/dist/commands/fork.js +0 -57
- package/dist/commands/fork.js.map +0 -1
- package/dist/commands/sync.d.ts +0 -2
- package/dist/commands/sync.d.ts.map +0 -1
- package/dist/commands/sync.js +0 -250
- package/dist/commands/sync.js.map +0 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { apiClient } from "../utils/api";
|
|
3
|
+
import { requireAuthentication, getAuthenticatedUser } from "../utils/auth";
|
|
4
|
+
import { createInterface } from "readline";
|
|
5
|
+
|
|
6
|
+
// Simple prompt function
|
|
7
|
+
async function prompt(
|
|
8
|
+
question: string,
|
|
9
|
+
defaultValue?: string
|
|
10
|
+
): Promise<string> {
|
|
11
|
+
return new Promise((resolve) => {
|
|
12
|
+
const rl = createInterface({
|
|
13
|
+
input: process.stdin,
|
|
14
|
+
output: process.stdout,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const promptText = defaultValue
|
|
18
|
+
? `${question} (${defaultValue}): `
|
|
19
|
+
: `${question}: `;
|
|
20
|
+
|
|
21
|
+
rl.question(promptText, (answer) => {
|
|
22
|
+
rl.close();
|
|
23
|
+
resolve(answer.trim() || defaultValue || "");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Simple yes/no prompt function
|
|
29
|
+
async function promptYesNo(question: string): Promise<boolean> {
|
|
30
|
+
return new Promise((resolve) => {
|
|
31
|
+
const rl = createInterface({
|
|
32
|
+
input: process.stdin,
|
|
33
|
+
output: process.stdout,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
rl.question(`${question} (y/n): `, (answer) => {
|
|
37
|
+
rl.close();
|
|
38
|
+
resolve(answer.toLowerCase().startsWith("y"));
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export async function updateGitUrlCommand(blockId?: string, gitUrl?: string, reset?: boolean) {
|
|
44
|
+
try {
|
|
45
|
+
// Require authentication
|
|
46
|
+
await requireAuthentication();
|
|
47
|
+
const user = getAuthenticatedUser();
|
|
48
|
+
|
|
49
|
+
console.log(chalk.blue("š Update Block Git URL"));
|
|
50
|
+
console.log(chalk.gray("Update the Git repository URL for a block\n"));
|
|
51
|
+
|
|
52
|
+
// Get block ID if not provided
|
|
53
|
+
if (!blockId) {
|
|
54
|
+
blockId = await prompt("Enter block ID");
|
|
55
|
+
if (!blockId) {
|
|
56
|
+
console.error(chalk.red("ā Block ID is required"));
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Validate block ID format
|
|
62
|
+
if (!/^[a-f0-9]{24}$/.test(blockId)) {
|
|
63
|
+
console.error(chalk.red("ā Invalid block ID format"));
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
console.log(chalk.blue(`š¦ Block ID: ${blockId}`));
|
|
68
|
+
|
|
69
|
+
// Get current block information
|
|
70
|
+
try {
|
|
71
|
+
const block = await apiClient.getBlock(blockId);
|
|
72
|
+
console.log(chalk.green(`ā
Found block: ${block.title}`));
|
|
73
|
+
console.log(chalk.gray(`Current Git URL: ${block.gitUrl || "Not set"}`));
|
|
74
|
+
|
|
75
|
+
// Check if current URL is default
|
|
76
|
+
const isDefaultUrl = block.gitUrl?.startsWith("https://github.com/mext-ai/block-");
|
|
77
|
+
if (isDefaultUrl) {
|
|
78
|
+
console.log(chalk.yellow("ā¹ļø Current URL is the default Mext URL"));
|
|
79
|
+
}
|
|
80
|
+
} catch (error: any) {
|
|
81
|
+
console.error(chalk.red(`ā Failed to fetch block: ${error.message}`));
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let newGitUrl: string | undefined;
|
|
86
|
+
let resetToDefault = false;
|
|
87
|
+
|
|
88
|
+
// Handle reset option
|
|
89
|
+
if (reset) {
|
|
90
|
+
resetToDefault = true;
|
|
91
|
+
newGitUrl = `https://github.com/mext-ai/block-${blockId}`;
|
|
92
|
+
console.log(chalk.blue(`š Resetting to default URL: ${newGitUrl}`));
|
|
93
|
+
} else if (gitUrl) {
|
|
94
|
+
// Validate provided URL
|
|
95
|
+
const isValidUrl = /^https:\/\/github\.com\/[\w\-\.]+\/[\w\-\.]+(?:\.git)?$/.test(gitUrl);
|
|
96
|
+
if (!isValidUrl) {
|
|
97
|
+
console.error(chalk.red("ā Invalid Git URL format. Please provide a valid GitHub URL."));
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
newGitUrl = gitUrl;
|
|
101
|
+
console.log(chalk.blue(`š New Git URL: ${newGitUrl}`));
|
|
102
|
+
} else {
|
|
103
|
+
// Interactive mode
|
|
104
|
+
const currentBlock = await apiClient.getBlock(blockId);
|
|
105
|
+
const currentUrl = currentBlock.gitUrl || "";
|
|
106
|
+
|
|
107
|
+
// Ask for new URL
|
|
108
|
+
newGitUrl = await prompt("Enter new Git URL", currentUrl);
|
|
109
|
+
|
|
110
|
+
if (!newGitUrl) {
|
|
111
|
+
console.error(chalk.red("ā Git URL is required"));
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Validate URL format
|
|
116
|
+
const isValidUrl = /^https:\/\/github\.com\/[\w\-\.]+\/[\w\-\.]+(?:\.git)?$/.test(newGitUrl);
|
|
117
|
+
if (!isValidUrl) {
|
|
118
|
+
console.error(chalk.red("ā Invalid Git URL format. Please provide a valid GitHub URL."));
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Check if user wants to reset to default
|
|
123
|
+
if (!newGitUrl.startsWith("https://github.com/mext-ai/block-")) {
|
|
124
|
+
const shouldReset = await promptYesNo("This is not the default Mext URL. Do you want to reset to default instead?");
|
|
125
|
+
if (shouldReset) {
|
|
126
|
+
resetToDefault = true;
|
|
127
|
+
newGitUrl = `https://github.com/mext-ai/block-${blockId}`;
|
|
128
|
+
console.log(chalk.blue(`š Resetting to default URL: ${newGitUrl}`));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Confirm the update
|
|
134
|
+
console.log(chalk.yellow(`\nā ļø About to update Git URL to: ${newGitUrl}`));
|
|
135
|
+
const confirmed = await promptYesNo("Do you want to proceed?");
|
|
136
|
+
|
|
137
|
+
if (!confirmed) {
|
|
138
|
+
console.log(chalk.gray("ā Update cancelled"));
|
|
139
|
+
process.exit(0);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Update the Git URL
|
|
143
|
+
console.log(chalk.blue("š Updating Git URL..."));
|
|
144
|
+
|
|
145
|
+
try {
|
|
146
|
+
const result = await apiClient.updateBlockGitUrl(blockId, newGitUrl, resetToDefault);
|
|
147
|
+
|
|
148
|
+
console.log(chalk.green("ā
Git URL updated successfully!"));
|
|
149
|
+
console.log(chalk.gray(`New URL: ${result.gitUrl}`));
|
|
150
|
+
|
|
151
|
+
if (result.resetToDefault) {
|
|
152
|
+
console.log(chalk.yellow("š URL was reset to default"));
|
|
153
|
+
}
|
|
154
|
+
} catch (error: any) {
|
|
155
|
+
console.error(chalk.red(`ā Failed to update Git URL: ${error.message}`));
|
|
156
|
+
|
|
157
|
+
if (error.response?.status === 403) {
|
|
158
|
+
console.error(chalk.red("Access denied. You can only update blocks you own."));
|
|
159
|
+
} else if (error.response?.status === 404) {
|
|
160
|
+
console.error(chalk.red("Block not found."));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
process.exit(1);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
} catch (error: any) {
|
|
167
|
+
console.error(chalk.red(`ā Error: ${error.message}`));
|
|
168
|
+
process.exit(1);
|
|
169
|
+
}
|
|
170
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,9 @@ import { createCommand } from "./commands/create";
|
|
|
7
7
|
import { deleteCommand } from "./commands/delete";
|
|
8
8
|
import { publishCommand } from "./commands/publish";
|
|
9
9
|
import { saveCommand } from "./commands/save";
|
|
10
|
+
import { updateGitUrlCommand } from "./commands/update-git-url";
|
|
11
|
+
import { githubLoginCommand } from "./commands/github-login";
|
|
12
|
+
import { githubDisconnectCommand } from "./commands/github-disconnect";
|
|
10
13
|
import { apiClient } from "./utils/api";
|
|
11
14
|
|
|
12
15
|
const program = new Command();
|
|
@@ -71,6 +74,50 @@ program
|
|
|
71
74
|
.description("Save current block (git add, commit, push, and trigger build)")
|
|
72
75
|
.action(saveCommand);
|
|
73
76
|
|
|
77
|
+
program
|
|
78
|
+
.command("update-git-url [blockId]")
|
|
79
|
+
.description("Update the Git repository URL for a block")
|
|
80
|
+
.option("-u, --url <url>", "New Git URL")
|
|
81
|
+
.option("-r, --reset", "Reset to default Mext URL")
|
|
82
|
+
.action((blockId, options) => {
|
|
83
|
+
updateGitUrlCommand(blockId, options.url, options.reset);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
program
|
|
87
|
+
.command("github-login")
|
|
88
|
+
.description("Connect your GitHub account for private repository access")
|
|
89
|
+
.action(githubLoginCommand);
|
|
90
|
+
|
|
91
|
+
program
|
|
92
|
+
.command("github-disconnect")
|
|
93
|
+
.description("Disconnect your GitHub account")
|
|
94
|
+
.action(githubDisconnectCommand);
|
|
95
|
+
|
|
96
|
+
program
|
|
97
|
+
.command("github-status")
|
|
98
|
+
.description("Check GitHub connection status")
|
|
99
|
+
.action(async () => {
|
|
100
|
+
try {
|
|
101
|
+
if (!apiClient.isAuthenticated()) {
|
|
102
|
+
console.log(chalk.yellow("ā ļø Please login first: mexty login"));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const status = await apiClient.getGitHubStatus();
|
|
107
|
+
|
|
108
|
+
if (status.connected) {
|
|
109
|
+
console.log(chalk.green("ā
GitHub connected"));
|
|
110
|
+
console.log(chalk.gray(` Username: ${status.githubUsername}`));
|
|
111
|
+
console.log(chalk.gray(` Status: ${status.message}`));
|
|
112
|
+
} else {
|
|
113
|
+
console.log(chalk.yellow("ā GitHub not connected"));
|
|
114
|
+
console.log(chalk.blue(" Connect with: mexty github-login"));
|
|
115
|
+
}
|
|
116
|
+
} catch (error: any) {
|
|
117
|
+
console.error(chalk.red(`ā Failed to check status: ${error.message}`));
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
74
121
|
// Error handling
|
|
75
122
|
program.on("command:*", () => {
|
|
76
123
|
console.error(chalk.red(`Invalid command: ${program.args.join(" ")}`));
|
package/src/utils/api.ts
CHANGED
|
@@ -304,6 +304,35 @@ class ApiClient {
|
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
+
async updateBlockGitUrl(blockId: string, gitUrl?: string, resetToDefault?: boolean): Promise<any> {
|
|
308
|
+
const response = await this.client.patch(`/api/blocks/${blockId}/git-url`, {
|
|
309
|
+
gitUrl,
|
|
310
|
+
resetToDefault,
|
|
311
|
+
});
|
|
312
|
+
return response.data;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// GitHub OAuth methods
|
|
316
|
+
async getGitHubAuthUrl(): Promise<{ success: boolean; url?: string; message: string }> {
|
|
317
|
+
const response = await this.client.get("/api/auth/github/url");
|
|
318
|
+
return response.data;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
async getGitHubStatus(): Promise<{ success: boolean; connected: boolean; githubUsername?: string; message: string }> {
|
|
322
|
+
const response = await this.client.get("/api/auth/github/status");
|
|
323
|
+
return response.data;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
async getGitHubToken(): Promise<{ success: boolean; token?: string; username?: string; expiresAt?: Date; message?: string; expired?: boolean }> {
|
|
327
|
+
const response = await this.client.get("/api/auth/github/token");
|
|
328
|
+
return response.data;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
async disconnectGitHub(): Promise<{ success: boolean; message: string }> {
|
|
332
|
+
const response = await this.client.post("/api/auth/github/disconnect");
|
|
333
|
+
return response.data;
|
|
334
|
+
}
|
|
335
|
+
|
|
307
336
|
setBaseUrl(url: string): void {
|
|
308
337
|
this.baseUrl = url;
|
|
309
338
|
this.client.defaults.baseURL = url;
|
package/src/utils/git.ts
CHANGED
|
@@ -2,6 +2,7 @@ import simpleGit, { SimpleGit } from "simple-git";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import chalk from "chalk";
|
|
5
|
+
import { apiClient } from "./api";
|
|
5
6
|
|
|
6
7
|
// Simple spinner implementation since ora v5 has import issues
|
|
7
8
|
class SimpleSpinner {
|
|
@@ -14,6 +15,11 @@ class SimpleSpinner {
|
|
|
14
15
|
this.message = message;
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
// Add setter for message text
|
|
19
|
+
set text(newMessage: string) {
|
|
20
|
+
this.message = newMessage;
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
start(): this {
|
|
18
24
|
process.stdout.write(this.message);
|
|
19
25
|
this.interval = setInterval(() => {
|
|
@@ -57,6 +63,7 @@ export class GitManager {
|
|
|
57
63
|
|
|
58
64
|
/**
|
|
59
65
|
* Clone a repository to a local directory
|
|
66
|
+
* Supports private repositories if GitHub is connected
|
|
60
67
|
*/
|
|
61
68
|
async cloneRepository(repoUrl: string, targetDir: string): Promise<void> {
|
|
62
69
|
const spinner = ora(`Cloning repository from ${repoUrl}...`).start();
|
|
@@ -68,16 +75,67 @@ export class GitManager {
|
|
|
68
75
|
throw new Error(`Directory ${targetDir} already exists`);
|
|
69
76
|
}
|
|
70
77
|
|
|
78
|
+
// Check if this is a GitHub URL that might need authentication
|
|
79
|
+
const isGitHub = repoUrl.includes('github.com');
|
|
80
|
+
let authenticatedUrl = repoUrl;
|
|
81
|
+
|
|
82
|
+
if (isGitHub) {
|
|
83
|
+
try {
|
|
84
|
+
// Try to get GitHub token for private repo access
|
|
85
|
+
const tokenData = await apiClient.getGitHubToken();
|
|
86
|
+
|
|
87
|
+
if (tokenData.success && tokenData.token) {
|
|
88
|
+
// Inject token into URL for authenticated cloning
|
|
89
|
+
authenticatedUrl = this.injectTokenIntoUrl(repoUrl, tokenData.token);
|
|
90
|
+
spinner.text = `Cloning repository (authenticated)...`;
|
|
91
|
+
}
|
|
92
|
+
} catch (error: any) {
|
|
93
|
+
// If token retrieval fails (e.g., not connected), try without auth
|
|
94
|
+
// This is fine for public repositories
|
|
95
|
+
if (error.response?.status === 404) {
|
|
96
|
+
spinner.text = `Cloning repository (public)...`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
71
101
|
// Clone the repository
|
|
72
|
-
await this.git.clone(
|
|
102
|
+
await this.git.clone(authenticatedUrl, targetDir);
|
|
73
103
|
|
|
74
104
|
spinner.succeed(chalk.green(`Repository cloned to ${targetDir}`));
|
|
75
105
|
} catch (error: any) {
|
|
76
|
-
|
|
106
|
+
// Check if error is due to authentication
|
|
107
|
+
if (error.message.includes('Authentication failed') ||
|
|
108
|
+
error.message.includes('could not read Username') ||
|
|
109
|
+
error.message.includes('Repository not found')) {
|
|
110
|
+
spinner.fail(chalk.red(`Failed to clone repository: Authentication required`));
|
|
111
|
+
console.log(chalk.yellow('\nš” This might be a private repository.'));
|
|
112
|
+
console.log(chalk.blue(' Connect your GitHub account: mexty github-login\n'));
|
|
113
|
+
} else {
|
|
114
|
+
spinner.fail(chalk.red(`Failed to clone repository: ${error.message}`));
|
|
115
|
+
}
|
|
77
116
|
throw error;
|
|
78
117
|
}
|
|
79
118
|
}
|
|
80
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Inject GitHub token into repository URL for authenticated access
|
|
122
|
+
*/
|
|
123
|
+
private injectTokenIntoUrl(repoUrl: string, token: string): string {
|
|
124
|
+
// Handle HTTPS URLs
|
|
125
|
+
if (repoUrl.startsWith('https://github.com/')) {
|
|
126
|
+
return repoUrl.replace('https://github.com/', `https://${token}@github.com/`);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Handle SSH URLs (convert to HTTPS with token)
|
|
130
|
+
if (repoUrl.startsWith('git@github.com:')) {
|
|
131
|
+
const path = repoUrl.replace('git@github.com:', '');
|
|
132
|
+
return `https://${token}@github.com/${path}`;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Return original URL if format not recognized
|
|
136
|
+
return repoUrl;
|
|
137
|
+
}
|
|
138
|
+
|
|
81
139
|
/**
|
|
82
140
|
* Check if current directory is a Git repository
|
|
83
141
|
*/
|
package/dist/commands/fork.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/commands/fork.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fork.js","sourceRoot":"","sources":["../../src/commands/fork.ts"],"names":[],"mappings":";;;;;AAMA,kCAmDC;AAzDD,kDAA0B;AAC1B,gDAAwB;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