thinkncollab-cli 0.0.59 → 0.0.60

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
@@ -455,8 +455,8 @@ async function main() {
455
455
  case "create":
456
456
  const roomIdx = args.indexOf("--room");
457
457
  if (roomIdx === -1 || !args[roomIdx + 1]) {
458
- console.log("Usage: tnc-cli create-branch --room <roomId>");
459
- console.log("Example: tnc-cli create-branch --room 507f1f77bcf86cd799439011");
458
+ console.log("Usage: tnc-cli create --room <roomId>");
459
+ console.log("Example: tnc-cli create --room 507f1f77bcf86cd799439011");
460
460
  process.exit(1);
461
461
  }
462
462
 
@@ -524,13 +524,17 @@ case "invite": {
524
524
  console.log(" tnc-cli login");
525
525
  console.log(" tnc-cli init");
526
526
  console.log(" tnc-cli push --room <roomId> <path>");
527
+ console.log(" tnc-cli create"); //creating a branch
527
528
  console.log(" tnc-cli pull --room <roomId>");
529
+ console.log(" tnc-cli sync branch --room <roomId>");
530
+ console.log(" tnc-cli merge <roomId>")
528
531
  console.log(" tnc-cli status");
529
532
  console.log(" tnc-cli whoami");
530
533
  console.log(" tnc-cli my-tasks <roomId>");
531
534
  console.log(" tnc-cli logout");
532
535
  console.log(" tnc-cli help");
533
536
  console.log(" tnc-cli version");
537
+
534
538
  }
535
539
  }
536
540
 
@@ -4,6 +4,20 @@ import axios from "axios";
4
4
  import os from "os";
5
5
  import inquirer from "inquirer";
6
6
 
7
+ async function updateBranch(branchName) {
8
+ const currenDir = process.cwd();
9
+ const tncmetaFile = path.join(currenDir, ".tncmeta.json")
10
+
11
+ if(!fs.readFileSync(tncmetaFile)) {
12
+
13
+ }
14
+ const content = ` "currentBranch": "${branchName}",`;
15
+
16
+
17
+ fs.writeFileSync(tncmetaFile, content, "utf-8" );
18
+
19
+ }
20
+
7
21
  async function createBranch(roomId) {
8
22
  try {
9
23
  const branchName = await inquirer.prompt([
@@ -47,10 +61,10 @@ async function createBranch(roomId) {
47
61
 
48
62
  if (res.data.success) {
49
63
  console.log(`✅ Branch '${branchName.branchName}' created successfully!`);
64
+ updateBranch(branchName.branchName);
50
65
  } else {
51
66
  console.log(`❌ Failed to create branch: ${res.data.message}`);
52
67
  }
53
-
54
68
  } catch (error) {
55
69
  if (error.response?.data?.message) {
56
70
  console.error(`❌ Error: ${error.response.data.message}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "thinkncollab-cli",
3
3
  "author": "Raman Singh",
4
- "version": "0.0.59",
4
+ "version": "0.0.60",
5
5
  "description": "CLI tool for ThinkNCollab",
6
6
  "main": "index.js",
7
7
  "bin": {