@snapcommit/cli 2.0.1 → 2.0.2
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/dist/repl.js +39 -2
- package/package.json +1 -1
package/dist/repl.js
CHANGED
|
@@ -89,7 +89,7 @@ async function startREPL() {
|
|
|
89
89
|
console.log(chalk_1.default.gray(' GitHub: ') + chalk_1.default.cyan('"create a PR to main"'));
|
|
90
90
|
console.log(chalk_1.default.gray(' ') + chalk_1.default.cyan('"check CI status"'));
|
|
91
91
|
}
|
|
92
|
-
console.log(chalk_1.default.gray(' Other: ') + chalk_1.default.cyan('exit') + chalk_1.default.gray(' • ') + chalk_1.default.cyan('help') + chalk_1.default.gray(' • ') + chalk_1.default.cyan('update\n'));
|
|
92
|
+
console.log(chalk_1.default.gray(' Other: ') + chalk_1.default.cyan('cd <path>') + chalk_1.default.gray(' • ') + chalk_1.default.cyan('exit') + chalk_1.default.gray(' • ') + chalk_1.default.cyan('help') + chalk_1.default.gray(' • ') + chalk_1.default.cyan('update\n'));
|
|
93
93
|
// Show GitHub setup reminder if not connected
|
|
94
94
|
if (!githubConnected) {
|
|
95
95
|
console.log(chalk_1.default.yellow.bold('┌─────────────────────────────────────────┐'));
|
|
@@ -123,7 +123,43 @@ async function startREPL() {
|
|
|
123
123
|
rl.close();
|
|
124
124
|
process.exit(0);
|
|
125
125
|
}
|
|
126
|
-
//
|
|
126
|
+
// CD command - navigate to different repo
|
|
127
|
+
if (line.startsWith('cd ')) {
|
|
128
|
+
const targetPath = line.substring(3).trim();
|
|
129
|
+
try {
|
|
130
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
131
|
+
const path = await Promise.resolve().then(() => __importStar(require('path')));
|
|
132
|
+
// Resolve path (handle ~ and relative paths)
|
|
133
|
+
let resolvedPath = targetPath;
|
|
134
|
+
if (targetPath.startsWith('~')) {
|
|
135
|
+
const os = await Promise.resolve().then(() => __importStar(require('os')));
|
|
136
|
+
resolvedPath = path.join(os.homedir(), targetPath.substring(1));
|
|
137
|
+
}
|
|
138
|
+
else if (!path.isAbsolute(targetPath)) {
|
|
139
|
+
resolvedPath = path.resolve(process.cwd(), targetPath);
|
|
140
|
+
}
|
|
141
|
+
// Check if path exists
|
|
142
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
143
|
+
console.log(chalk_1.default.red(`\n❌ Directory not found: ${resolvedPath}\n`));
|
|
144
|
+
rl.prompt();
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
// Change directory
|
|
148
|
+
process.chdir(resolvedPath);
|
|
149
|
+
console.log(chalk_1.default.green(`\n✅ Changed to: ${process.cwd()}\n`));
|
|
150
|
+
// Check if it's a git repo
|
|
151
|
+
const { isGitRepo } = await Promise.resolve().then(() => __importStar(require('./utils/git')));
|
|
152
|
+
if (!isGitRepo()) {
|
|
153
|
+
console.log(chalk_1.default.yellow('⚠️ Not a git repository'));
|
|
154
|
+
console.log(chalk_1.default.gray(' Run ') + chalk_1.default.cyan('git init') + chalk_1.default.gray(' to create one\n'));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
console.log(chalk_1.default.red(`\n❌ Failed to change directory: ${error.message}\n`));
|
|
159
|
+
}
|
|
160
|
+
rl.prompt();
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
127
163
|
// Update command - update SnapCommit to latest version
|
|
128
164
|
if (line === 'update' || line === 'upgrade') {
|
|
129
165
|
console.log(chalk_1.default.cyan('\n⚡ Updating SnapCommit to latest version...\n'));
|
|
@@ -174,6 +210,7 @@ async function startREPL() {
|
|
|
174
210
|
console.log(chalk_1.default.cyan(' "list my pull requests"'));
|
|
175
211
|
console.log(chalk_1.default.cyan(' "merge PR #123"\n'));
|
|
176
212
|
console.log(chalk_1.default.white.bold('System Commands:\n'));
|
|
213
|
+
console.log(chalk_1.default.gray(' • ') + chalk_1.default.cyan('cd <path>') + chalk_1.default.gray(' - Navigate to different repo'));
|
|
177
214
|
console.log(chalk_1.default.gray(' • ') + chalk_1.default.cyan('update') + chalk_1.default.gray(' - Update to latest version'));
|
|
178
215
|
console.log(chalk_1.default.gray(' • ') + chalk_1.default.cyan('exit/quit') + chalk_1.default.gray(' - Exit SnapCommit\n'));
|
|
179
216
|
console.log(chalk_1.default.gray('💡 I\'ll show you what I\'ll do before executing anything!\n'));
|