gent-cli 2.0.0 → 2.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gent-cli",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
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": {
@@ -20,6 +20,14 @@ function buildUrl(template, params = {}) {
20
20
  return url;
21
21
  }
22
22
 
23
+ /**
24
+ * Create a new repository
25
+ * @param {string} name - Repository name
26
+ * @param {string} description - Repository description
27
+ * @param {boolean} isPrivate - Whether the repository is private
28
+ * @param {string} defaultBranch - Default branch name
29
+ * @returns {Promise<Object>} Created repository data
30
+ */
23
31
  /**
24
32
  * Create a new repository
25
33
  * @param {string} name - Repository name
@@ -32,7 +40,6 @@ async function createRepository(name, description = '', isPrivate = false, defau
32
40
  try {
33
41
  const response = await apiClient.post(API_ENDPOINTS.REPOS_CREATE, {
34
42
  name,
35
- project_name: name, // Add project_name as well for consistency
36
43
  description,
37
44
  is_private: isPrivate,
38
45
  default_branch: defaultBranch
@@ -59,12 +66,12 @@ async function listRepositories() {
59
66
  /**
60
67
  * Get repository details
61
68
  * @param {number} ownerId - Owner user ID
62
- * @param {string} projectName - Project name
69
+ * @param {string} name - Repository name
63
70
  * @returns {Promise<Object>} Repository data
64
71
  */
65
- async function getRepository(ownerId, projectName) {
72
+ async function getRepository(ownerId, name) {
66
73
  try {
67
- const url = buildUrl(API_ENDPOINTS.REPOS_GET, { owner_id: ownerId, project_name: projectName });
74
+ const url = buildUrl(API_ENDPOINTS.REPOS_GET, { owner_id: ownerId, name: name });
68
75
  const response = await apiClient.get(url);
69
76
  return response;
70
77
  } catch (error) {
@@ -75,12 +82,12 @@ async function getRepository(ownerId, projectName) {
75
82
  /**
76
83
  * Delete a repository
77
84
  * @param {number} ownerId - Owner user ID
78
- * @param {string} projectName - Project name
85
+ * @param {string} name - Repository name
79
86
  * @returns {Promise<Object>} Delete response
80
87
  */
81
- async function deleteRepository(ownerId, projectName) {
88
+ async function deleteRepository(ownerId, name) {
82
89
  try {
83
- const url = buildUrl(API_ENDPOINTS.REPOS_DELETE, { owner_id: ownerId, project_name: projectName });
90
+ const url = buildUrl(API_ENDPOINTS.REPOS_DELETE, { owner_id: ownerId, name: name });
84
91
  const response = await apiClient.delete(url);
85
92
  return response;
86
93
  } catch (error) {
@@ -91,14 +98,14 @@ async function deleteRepository(ownerId, projectName) {
91
98
  /**
92
99
  * Create a blob (file content) in the repository
93
100
  * @param {number} ownerId - Owner user ID
94
- * @param {string} projectName - Project name
101
+ * @param {string} name - Repository name
95
102
  * @param {string} content - File content
96
103
  * @param {string} encoding - Encoding type (utf-8 or base64)
97
104
  * @returns {Promise<Object>} Created blob data
98
105
  */
99
- async function createBlob(ownerId, projectName, content, encoding = 'utf-8') {
106
+ async function createBlob(ownerId, name, content, encoding = 'utf-8') {
100
107
  try {
101
- const url = buildUrl(API_ENDPOINTS.BLOB_CREATE, { owner_id: ownerId, project_name: projectName });
108
+ const url = buildUrl(API_ENDPOINTS.BLOB_CREATE, { owner_id: ownerId, name: name });
102
109
  const response = await apiClient.post(url, {
103
110
  content,
104
111
  encoding
@@ -112,13 +119,13 @@ async function createBlob(ownerId, projectName, content, encoding = 'utf-8') {
112
119
  /**
113
120
  * Get a blob by SHA
114
121
  * @param {number} ownerId - Owner user ID
115
- * @param {string} projectName - Project name
122
+ * @param {string} name - Repository name
116
123
  * @param {string} sha - Blob SHA
117
124
  * @returns {Promise<Object>} Blob data
118
125
  */
119
- async function getBlob(ownerId, projectName, sha) {
126
+ async function getBlob(ownerId, name, sha) {
120
127
  try {
121
- const url = buildUrl(API_ENDPOINTS.BLOB_GET, { owner_id: ownerId, project_name: projectName, sha });
128
+ const url = buildUrl(API_ENDPOINTS.BLOB_GET, { owner_id: ownerId, name: name, sha });
122
129
  const response = await apiClient.get(url);
123
130
  return response;
124
131
  } catch (error) {
@@ -129,13 +136,13 @@ async function getBlob(ownerId, projectName, sha) {
129
136
  /**
130
137
  * Create a tree (directory structure) in the repository
131
138
  * @param {number} ownerId - Owner user ID
132
- * @param {string} projectName - Project name
139
+ * @param {string} name - Repository name
133
140
  * @param {Array} entries - Tree entries
134
141
  * @returns {Promise<Object>} Created tree data
135
142
  */
136
- async function createTree(ownerId, projectName, entries) {
143
+ async function createTree(ownerId, name, entries) {
137
144
  try {
138
- const url = buildUrl(API_ENDPOINTS.TREE_CREATE, { owner_id: ownerId, project_name: projectName });
145
+ const url = buildUrl(API_ENDPOINTS.TREE_CREATE, { owner_id: ownerId, name: name });
139
146
  const response = await apiClient.post(url, {
140
147
  entries
141
148
  });
@@ -148,13 +155,13 @@ async function createTree(ownerId, projectName, entries) {
148
155
  /**
149
156
  * Get a tree by SHA
150
157
  * @param {number} ownerId - Owner user ID
151
- * @param {string} projectName - Project name
158
+ * @param {string} name - Repository name
152
159
  * @param {string} sha - Tree SHA
153
160
  * @returns {Promise<Object>} Tree data
154
161
  */
155
- async function getTree(ownerId, projectName, sha) {
162
+ async function getTree(ownerId, name, sha) {
156
163
  try {
157
- const url = buildUrl(API_ENDPOINTS.TREE_GET, { owner_id: ownerId, project_name: projectName, sha });
164
+ const url = buildUrl(API_ENDPOINTS.TREE_GET, { owner_id: ownerId, name: name, sha });
158
165
  const response = await apiClient.get(url);
159
166
  return response;
160
167
  } catch (error) {
@@ -165,13 +172,13 @@ async function getTree(ownerId, projectName, sha) {
165
172
  /**
166
173
  * Create a commit in the repository
167
174
  * @param {number} ownerId - Owner user ID
168
- * @param {string} projectName - Project name
175
+ * @param {string} name - Repository name
169
176
  * @param {Object} commitData - Commit data (message, tree_sha, parent_shas, author_name, author_email, branch)
170
177
  * @returns {Promise<Object>} Created commit data
171
178
  */
172
- async function createCommit(ownerId, projectName, commitData) {
179
+ async function createCommit(ownerId, name, commitData) {
173
180
  try {
174
- const url = buildUrl(API_ENDPOINTS.COMMITS_CREATE, { owner_id: ownerId, project_name: projectName });
181
+ const url = buildUrl(API_ENDPOINTS.COMMITS_CREATE, { owner_id: ownerId, name: name });
175
182
  const response = await apiClient.post(url, commitData);
176
183
  return response;
177
184
  } catch (error) {
@@ -182,12 +189,12 @@ async function createCommit(ownerId, projectName, commitData) {
182
189
  /**
183
190
  * List all commits in a repository
184
191
  * @param {number} ownerId - Owner user ID
185
- * @param {string} projectName - Project name
192
+ * @param {string} name - Repository name
186
193
  * @returns {Promise<Array>} List of commits
187
194
  */
188
- async function listCommits(ownerId, projectName) {
195
+ async function listCommits(ownerId, name) {
189
196
  try {
190
- const url = buildUrl(API_ENDPOINTS.COMMITS_LIST, { owner_id: ownerId, project_name: projectName });
197
+ const url = buildUrl(API_ENDPOINTS.COMMITS_LIST, { owner_id: ownerId, name: name });
191
198
  const response = await apiClient.get(url);
192
199
  return response;
193
200
  } catch (error) {
@@ -198,13 +205,13 @@ async function listCommits(ownerId, projectName) {
198
205
  /**
199
206
  * Get a commit by SHA
200
207
  * @param {number} ownerId - Owner user ID
201
- * @param {string} projectName - Project name
208
+ * @param {string} name - Repository name
202
209
  * @param {string} sha - Commit SHA
203
210
  * @returns {Promise<Object>} Commit data
204
211
  */
205
- async function getCommit(ownerId, projectName, sha) {
212
+ async function getCommit(ownerId, name, sha) {
206
213
  try {
207
- const url = buildUrl(API_ENDPOINTS.COMMITS_GET, { owner_id: ownerId, project_name: projectName, sha });
214
+ const url = buildUrl(API_ENDPOINTS.COMMITS_GET, { owner_id: ownerId, name: name, sha });
208
215
  const response = await apiClient.get(url);
209
216
  return response;
210
217
  } catch (error) {
@@ -215,14 +222,14 @@ async function getCommit(ownerId, projectName, sha) {
215
222
  /**
216
223
  * Create a branch in the repository
217
224
  * @param {number} ownerId - Owner user ID
218
- * @param {string} projectName - Project name
225
+ * @param {string} name - Repository name
219
226
  * @param {string} branchName - Branch name
220
227
  * @param {string} commitSha - Commit SHA to point the branch to
221
228
  * @returns {Promise<Object>} Created branch data
222
229
  */
223
- async function createBranch(ownerId, projectName, branchName, commitSha) {
230
+ async function createBranch(ownerId, name, branchName, commitSha) {
224
231
  try {
225
- const url = buildUrl(API_ENDPOINTS.BRANCHES_CREATE, { owner_id: ownerId, project_name: projectName });
232
+ const url = buildUrl(API_ENDPOINTS.BRANCHES_CREATE, { owner_id: ownerId, name: name });
226
233
  const response = await apiClient.post(url, {
227
234
  name: branchName,
228
235
  commit_sha: commitSha
@@ -236,12 +243,12 @@ async function createBranch(ownerId, projectName, branchName, commitSha) {
236
243
  /**
237
244
  * List all branches in a repository
238
245
  * @param {number} ownerId - Owner user ID
239
- * @param {string} projectName - Project name
246
+ * @param {string} name - Repository name
240
247
  * @returns {Promise<Array>} List of branches
241
248
  */
242
- async function listBranches(ownerId, projectName) {
249
+ async function listBranches(ownerId, name) {
243
250
  try {
244
- const url = buildUrl(API_ENDPOINTS.BRANCHES_LIST, { owner_id: ownerId, project_name: projectName });
251
+ const url = buildUrl(API_ENDPOINTS.BRANCHES_LIST, { owner_id: ownerId, name: name });
245
252
  const response = await apiClient.get(url);
246
253
  return response;
247
254
  } catch (error) {
@@ -252,13 +259,13 @@ async function listBranches(ownerId, projectName) {
252
259
  /**
253
260
  * Get a branch by name
254
261
  * @param {number} ownerId - Owner user ID
255
- * @param {string} projectName - Project name
262
+ * @param {string} name - Repository name
256
263
  * @param {string} branchName - Branch name
257
264
  * @returns {Promise<Object>} Branch data
258
265
  */
259
- async function getBranch(ownerId, projectName, branchName) {
266
+ async function getBranch(ownerId, name, branchName) {
260
267
  try {
261
- const url = buildUrl(API_ENDPOINTS.BRANCHES_GET, { owner_id: ownerId, project_name: projectName, branch_name: branchName });
268
+ const url = buildUrl(API_ENDPOINTS.BRANCHES_GET, { owner_id: ownerId, name: name, branch_name: branchName });
262
269
  const response = await apiClient.get(url);
263
270
  return response;
264
271
  } catch (error) {
@@ -27,26 +27,26 @@ module.exports = {
27
27
  // Repository endpoints
28
28
  REPOS_LIST: '/api/repos/',
29
29
  REPOS_CREATE: '/api/repos/create/',
30
- REPOS_GET: '/api/repos/{owner_id}/{project_name}/',
31
- REPOS_DELETE: '/api/repos/{owner_id}/{project_name}/delete/',
30
+ REPOS_GET: '/api/repos/{owner_id}/{name}/',
31
+ REPOS_DELETE: '/api/repos/{owner_id}/{name}/delete/',
32
32
 
33
33
  // Blob endpoints
34
- BLOB_GET: '/api/repos/{owner_id}/{project_name}/blob/{sha}/',
35
- BLOB_CREATE: '/api/repos/{owner_id}/{project_name}/blob/create/',
34
+ BLOB_GET: '/api/repos/{owner_id}/{name}/blob/{sha}/',
35
+ BLOB_CREATE: '/api/repos/{owner_id}/{name}/blob/create/',
36
36
 
37
37
  // Tree endpoints
38
- TREE_GET: '/api/repos/{owner_id}/{project_name}/tree/{sha}/',
39
- TREE_CREATE: '/api/repos/{owner_id}/{project_name}/tree/create/',
38
+ TREE_GET: '/api/repos/{owner_id}/{name}/tree/{sha}/',
39
+ TREE_CREATE: '/api/repos/{owner_id}/{name}/tree/create/',
40
40
 
41
41
  // Commit endpoints
42
- COMMITS_LIST: '/api/repos/{owner_id}/{project_name}/commits/',
43
- COMMITS_GET: '/api/repos/{owner_id}/{project_name}/commits/{sha}/',
44
- COMMITS_CREATE: '/api/repos/{owner_id}/{project_name}/commits/create/',
42
+ COMMITS_LIST: '/api/repos/{owner_id}/{name}/commits/',
43
+ COMMITS_GET: '/api/repos/{owner_id}/{name}/commits/{sha}/',
44
+ COMMITS_CREATE: '/api/repos/{owner_id}/{name}/commits/create/',
45
45
 
46
46
  // Branch endpoints
47
- BRANCHES_LIST: '/api/repos/{owner_id}/{project_name}/branches/',
48
- BRANCHES_GET: '/api/repos/{owner_id}/{project_name}/branches/{branch_name}/',
49
- BRANCHES_CREATE: '/api/repos/{owner_id}/{project_name}/branches/create/'
47
+ BRANCHES_LIST: '/api/repos/{owner_id}/{name}/branches/',
48
+ BRANCHES_GET: '/api/repos/{owner_id}/{name}/branches/{branch_name}/',
49
+ BRANCHES_CREATE: '/api/repos/{owner_id}/{name}/branches/create/'
50
50
  },
51
51
 
52
52
  // Default ignore patterns