thinkncollab-cli 0.0.74 → 0.0.76

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
@@ -15,6 +15,7 @@ import version from "../commands/version.js";
15
15
  import createBranch from "../commands/branch.js"
16
16
  import myTask from "../commands/myTask.js"
17
17
  import sendInvite from '../commands/sendInvite.js'
18
+ import connect from '../commands/connect.js'
18
19
 
19
20
 
20
21
 
@@ -324,6 +325,16 @@ async function push(roomId, targetPath) {
324
325
  const meta = JSON.parse(fs.readFileSync(tncMetaPath, "utf-8"));
325
326
  const projectId = meta.projectId;
326
327
 
328
+
329
+ const tncPushInfo = path.join(process.cwd(), ".tnc", ".tncpush.json");
330
+ if (!fs.existsSync(tncMetaPath)) {
331
+ console.error("❌ Project not initialized. Run 'tnc init' first.");
332
+ process.exit(1);
333
+ }
334
+ const lastFolderId = JSON.parse(fs.readFileSync(tncPushInfo, "utf-8")).folderId;
335
+
336
+
337
+
327
338
  const stats = fs.statSync(targetPath);
328
339
  const rootFolder = stats.isDirectory() ? targetPath : path.dirname(targetPath);
329
340
  const ignoreList = loadIgnore(rootFolder);
@@ -370,7 +381,7 @@ async function push(roomId, targetPath) {
370
381
  console.log("🗂️ Sending metadata...");
371
382
  const res = await axios.post(
372
383
  `${BASE_URL}/${roomId}/upload`,
373
- { folderId: folderHex, content: uploadedTree, uploadedBy: email, projectId},
384
+ { folderId: folderHex, content: uploadedTree, uploadedBy: email, projectId, latestFolderId: lastFolderId},
374
385
  { headers: { authorization: `Bearer ${token}`, email } }
375
386
  );
376
387
 
@@ -403,7 +414,7 @@ async function push(roomId, targetPath) {
403
414
  roomId: roomId,
404
415
  pushedBy: email,
405
416
  projectId: projectId,
406
- folderId: res.folderId
417
+ folderId: res.data.folderId
407
418
  };
408
419
 
409
420
 
@@ -472,6 +483,17 @@ async function main() {
472
483
  await createBranch(roomId);
473
484
  break;
474
485
 
486
+ case "connect": {
487
+ const idx = args.indexOf("connect");
488
+ const link = args[idx+1];
489
+
490
+ await connect(link);
491
+ break;
492
+
493
+
494
+
495
+ }
496
+
475
497
  case "pull": {
476
498
  const roomIndex = args.indexOf("--room");
477
499
  if (roomIndex === -1 || !args[roomIndex + 1]) {
@@ -0,0 +1,13 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import axios from "axios";
4
+ import os from "os";
5
+ import inquirer from "inquirer";
6
+
7
+
8
+ export async function connect(link) {
9
+
10
+ const res = await axios.get("http://localhost:12/cli/connect/roomId");
11
+
12
+ console.log(res.data);
13
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "thinkncollab-cli",
3
3
  "author": "Raman Singh",
4
- "version": "0.0.74",
4
+ "version": "0.0.76",
5
5
  "description": "CLI tool for ThinkNCollab",
6
6
  "main": "index.js",
7
7
  "bin": {