gent-cli 6.0.0 → 6.0.1

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/README.md CHANGED
@@ -137,6 +137,8 @@ Use the `/api/repos/<owner_id>/<repo_name>` path from the previous command:
137
137
  gent remote add origin /api/repos/2/my-project
138
138
  ```
139
139
 
140
+ If the current folder is not initialized yet, `gent remote add` initializes `.gent` first, then adds the remote. You can still run `gent init` yourself before this step if you prefer the explicit flow.
141
+
140
142
  Check it:
141
143
 
142
144
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gent-cli",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "A modern, Git-like version control CLI with built-in cloud authentication and global user identity management.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -30,6 +30,7 @@ const path = require('path');
30
30
  const chalk = require('chalk');
31
31
  const { getGentPath, readJSON, writeJSON } = require('../utils/fileSystem');
32
32
  const { CONFIG_FILE, parseRemoteUrl } = require('../utils/constants');
33
+ const initCommand = require('./init');
33
34
 
34
35
  /**
35
36
  * Manage remotes
@@ -39,7 +40,19 @@ const { CONFIG_FILE, parseRemoteUrl } = require('../utils/constants');
39
40
  */
40
41
  async function remote(subcommand, args, options) {
41
42
  try {
42
- const gentPath = await getGentPath();
43
+ let gentPath;
44
+ try {
45
+ gentPath = await getGentPath();
46
+ } catch (error) {
47
+ if (subcommand !== 'add' || error.code !== 'ENOENT') {
48
+ throw error;
49
+ }
50
+
51
+ console.log(chalk.yellow('Not a Gent repository yet. Initializing first...'));
52
+ await initCommand({});
53
+ gentPath = await getGentPath();
54
+ }
55
+
43
56
  const configPath = path.join(gentPath, CONFIG_FILE);
44
57
  const config = await readJSON(configPath);
45
58
  config.remotes = config.remotes || {};
@@ -120,6 +133,7 @@ async function remote(subcommand, args, options) {
120
133
  } catch (error) {
121
134
  if (error.code === 'ENOENT' && error.message.includes('.gent')) {
122
135
  console.error(chalk.red('Error: Not a gent repository'));
136
+ console.log(chalk.yellow('Run "gent init" first, then retry this command'));
123
137
  } else {
124
138
  console.error(chalk.red('Error:'), error.message);
125
139
  }