@snapcommit/cli 2.0.0 → 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.
Files changed (2) hide show
  1. package/dist/repl.js +42 -4
  2. package/package.json +1 -1
package/dist/repl.js CHANGED
@@ -67,8 +67,9 @@ async function startREPL() {
67
67
  console.log(chalk_1.default.yellow.bold('ā•‘ šŸš€ UPDATE AVAILABLE! ā•‘'));
68
68
  console.log(chalk_1.default.yellow.bold('ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•'));
69
69
  console.log(chalk_1.default.white(` Current: ${chalk_1.default.red(updateInfo.currentVersion)} → Latest: ${chalk_1.default.green(updateInfo.latestVersion)}\n`));
70
- console.log(chalk_1.default.cyan.bold(' Update now: ') + chalk_1.default.white('Type ') + chalk_1.default.cyan.bold('update') + chalk_1.default.white(' to upgrade'));
71
- console.log(chalk_1.default.gray(' (Faster AI, better UX, bug fixes!)\n'));
70
+ console.log(chalk_1.default.cyan.bold(' To update: ') + chalk_1.default.white('Just type ') + chalk_1.default.cyan.bold('update') + chalk_1.default.white(' in the CLI below'));
71
+ console.log(chalk_1.default.gray(' (Faster AI, Cursor-style UX, better experience!)\n'));
72
+ console.log(chalk_1.default.white(' Example: ') + chalk_1.default.cyan('snap> update\n'));
72
73
  }
73
74
  }).catch((err) => {
74
75
  // Silent fail - don't interrupt user experience
@@ -88,7 +89,7 @@ async function startREPL() {
88
89
  console.log(chalk_1.default.gray(' GitHub: ') + chalk_1.default.cyan('"create a PR to main"'));
89
90
  console.log(chalk_1.default.gray(' ') + chalk_1.default.cyan('"check CI status"'));
90
91
  }
91
- 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'));
92
93
  // Show GitHub setup reminder if not connected
93
94
  if (!githubConnected) {
94
95
  console.log(chalk_1.default.yellow.bold('ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”'));
@@ -122,7 +123,43 @@ async function startREPL() {
122
123
  rl.close();
123
124
  process.exit(0);
124
125
  }
125
- // All commands are now natural language - removed special commands!
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
+ }
126
163
  // Update command - update SnapCommit to latest version
127
164
  if (line === 'update' || line === 'upgrade') {
128
165
  console.log(chalk_1.default.cyan('\n⚔ Updating SnapCommit to latest version...\n'));
@@ -173,6 +210,7 @@ async function startREPL() {
173
210
  console.log(chalk_1.default.cyan(' "list my pull requests"'));
174
211
  console.log(chalk_1.default.cyan(' "merge PR #123"\n'));
175
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'));
176
214
  console.log(chalk_1.default.gray(' • ') + chalk_1.default.cyan('update') + chalk_1.default.gray(' - Update to latest version'));
177
215
  console.log(chalk_1.default.gray(' • ') + chalk_1.default.cyan('exit/quit') + chalk_1.default.gray(' - Exit SnapCommit\n'));
178
216
  console.log(chalk_1.default.gray('šŸ’” I\'ll show you what I\'ll do before executing anything!\n'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapcommit/cli",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Instant AI commits. Beautiful progress tracking. Never write commit messages again.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {