thinkncollab-cli 0.0.64 → 0.0.66

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/bin/index.js CHANGED
@@ -314,7 +314,7 @@ async function uploadTree(fileTree, folderHex, roomId, token, email, previousVer
314
314
  }
315
315
 
316
316
  /** ------------------ PUSH FUNCTION ------------------ **/
317
- async function push(roomId, targetPath) {
317
+ async function push(roomId, targetPath, pushBranch) {
318
318
  const { token, email } = readToken();
319
319
  const tncMetaPath = path.join(process.cwd(), ".tnc", ".tncmeta.json");
320
320
  if (!fs.existsSync(tncMetaPath)) {
@@ -370,7 +370,7 @@ async function push(roomId, targetPath) {
370
370
  console.log("🗂️ Sending metadata...");
371
371
  const res = await axios.post(
372
372
  `${BASE_URL}/${roomId}/upload`,
373
- { folderId: folderHex, content: uploadedTree, uploadedBy: email, projectId },
373
+ { folderId: folderHex, content: uploadedTree, uploadedBy: email, projectId , pushBranch},
374
374
  { headers: { authorization: `Bearer ${token}`, email } }
375
375
  );
376
376
 
@@ -435,14 +435,15 @@ async function main() {
435
435
  break;
436
436
 
437
437
  case "push": {
438
- const roomIndex = args.indexOf("--room");
439
- if (roomIndex === -1 || !args[roomIndex + 1] || !args[roomIndex + 2]) {
438
+ const roomIndex = args.indexOf("push");
439
+ if (roomIndex === -1 || !args[roomIndex + 2] || !args[roomIndex + 2]) {
440
440
  console.error("Usage: tnc push --room <roomId> <file-or-folder-path>");
441
441
  process.exit(1);
442
442
  }
443
- const roomId = args[roomIndex + 1];
444
- const targetPath = args[roomIndex + 2];
445
- await push(roomId, targetPath);
443
+ const roomId = args[roomIndex + 2];
444
+ const branch = args[roomIndex+1];
445
+ const targetPath = args[roomIndex + 3];
446
+ await push(roomId, targetPath, branch);
446
447
  break;
447
448
  }
448
449
  case "status":
@@ -4,8 +4,8 @@ import axios from "axios";
4
4
  import os from "os";
5
5
  import inquirer from "inquirer";
6
6
 
7
- // Updates the current branch name in .tnc/.tncmeta.json
8
- async function updateBranch(branchName) {
7
+
8
+ async function updateBranch(branchName, branchId) {
9
9
  const currentDir = process.cwd();
10
10
  const tncFolder = path.join(currentDir, ".tnc");
11
11
  const tncmetaFile = path.join(tncFolder, ".tncmeta.json");
@@ -30,6 +30,7 @@ async function updateBranch(branchName) {
30
30
 
31
31
  // Update the current branch
32
32
  meta.currentBranch = branchName;
33
+ Object.assign(meta, {branchId: `${branchId}`});
33
34
 
34
35
  // Write updated data
35
36
  fs.writeFileSync(tncmetaFile, JSON.stringify(meta, null, 2), "utf-8");
@@ -80,7 +81,7 @@ async function createBranch(roomId) {
80
81
 
81
82
  if (res.data.success) {
82
83
  console.log(`✅ Branch '${branchName}' created successfully!`);
83
- await updateBranch(branchName);
84
+ await updateBranch(branchName, res.branch.id);
84
85
  } else {
85
86
  console.log(`❌ Failed to create branch: ${res.data.message}`);
86
87
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "thinkncollab-cli",
3
3
  "author": "Raman Singh",
4
- "version": "0.0.64",
4
+ "version": "0.0.66",
5
5
  "description": "CLI tool for ThinkNCollab",
6
6
  "main": "index.js",
7
7
  "bin": {