thinkncollab-cli 0.0.35 → 0.0.37

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
@@ -8,7 +8,7 @@ A powerful command-line interface for seamless collaboration with **ThinkNCollab
8
8
 
9
9
  ```bash
10
10
  # Install the CLI globally
11
- npm install -g @thinkncollab/tnc-cli
11
+ npm install -g thinkncollab-cli
12
12
 
13
13
  # Login to your ThinkNCollab account
14
14
  tnc-cli login
package/bin/index.js CHANGED
@@ -9,6 +9,7 @@ import FormData from "form-data";
9
9
  import projectInit from "../commands/init.js";
10
10
  import Status from "../commands/status.js";
11
11
  import pull from "../commands/pull.js";
12
+ import whoami from "../commands/whoami.js";
12
13
 
13
14
  const RC_FILE = path.join(os.homedir(), ".tncrc");
14
15
  const VERSION_FILE = path.join(process.cwd(), ".tncversions");
@@ -384,12 +385,18 @@ async function push(roomId, targetPath) {
384
385
  };
385
386
  flattenAndStore(uploadedTree);
386
387
  saveVersions(newVersionMap);
388
+
389
+ // Determine latest version number from uploaded files
390
+ const versionNumbers = Object.values(newVersionMap).map(f => f.version || 1);
391
+ const latestVersion = versionNumbers.length > 0 ? Math.max(...versionNumbers) : 1;
392
+
387
393
  const newPushRecord = {
388
- version: item.version || 1,
389
- pushedAt: new Date().toISOString(),
390
- roomId: roomId,
391
- pushedBy: email,
392
- }
394
+ version: latestVersion,
395
+ pushedAt: new Date().toISOString(),
396
+ roomId: roomId,
397
+ pushedBy: email,
398
+ projectId: projectId
399
+ };
393
400
 
394
401
 
395
402
 
@@ -458,6 +465,10 @@ async function main() {
458
465
  await pull(roomId, version);
459
466
  break;
460
467
  }
468
+
469
+ case "whoami":
470
+ await whoami();
471
+ break;
461
472
 
462
473
  default:
463
474
  console.log("✅ TNC CLI ready!");
@@ -0,0 +1,19 @@
1
+ import fs from "fs";
2
+ import os from "os";
3
+ import path from "path";
4
+
5
+ const RC_FILE = path.join(os.homedir(), ".tncrc");
6
+
7
+ async function whoami() {
8
+ try{
9
+ if(fs.existsSync(RC_FILE)) {
10
+ const rcData = fs.readFileSync(RC_FILE, "utf-8");
11
+ const {email} = JSON.parse(rcData);
12
+ console.log('You are logged in by the email:', email);
13
+ }
14
+ } catch (error) {
15
+ console.error('Error reading .tncrc file:', error);
16
+ }
17
+ }
18
+
19
+ export default whoami;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "thinkncollab-cli",
3
3
  "author": "Raman Singh",
4
- "version": "0.0.35",
4
+ "version": "0.0.37",
5
5
  "description": "CLI tool for ThinkNCollab",
6
6
  "main": "index.js",
7
7
  "bin": {