cortex-sync 0.4.8 → 0.4.9

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.
Files changed (2) hide show
  1. package/dist/cli.js +20 -26
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1572,19 +1572,19 @@ async function copySessionsFromRepo(sessionsRoot, projectId, destDir, localCwd,
1572
1572
  }
1573
1573
  return count;
1574
1574
  }
1575
- async function pushSessions(email, cwd, derived) {
1576
- const projectInfo = identifyProject(cwd);
1577
- if (!projectInfo) return 0;
1575
+ async function pushSessions(email, cwd, derived, projectId) {
1576
+ const id = projectId ?? identifyProject(cwd)?.projectId;
1577
+ if (!id) return 0;
1578
1578
  const srcDir = localSessionsDir(cwd);
1579
- const destDir = teamSessionsDir(TEAM_DIR, email, projectInfo.projectId);
1579
+ const destDir = teamSessionsDir(TEAM_DIR, email, id);
1580
1580
  return copySessionsToTeamDir(srcDir, destDir, derived);
1581
1581
  }
1582
- async function pullSessions(cwd, derived) {
1583
- const projectInfo = identifyProject(cwd);
1584
- if (!projectInfo) return 0;
1582
+ async function pullSessions(cwd, derived, projectId) {
1583
+ const id = projectId ?? identifyProject(cwd)?.projectId;
1584
+ if (!id) return 0;
1585
1585
  const sessionsRoot = join16(TEAM_DIR, "sessions");
1586
1586
  const destDir = localSessionsDir(cwd);
1587
- return copySessionsFromRepo(sessionsRoot, projectInfo.projectId, destDir, cwd, derived);
1587
+ return copySessionsFromRepo(sessionsRoot, id, destDir, cwd, derived);
1588
1588
  }
1589
1589
 
1590
1590
  // src/commands/team/init.ts
@@ -1644,10 +1644,7 @@ Cloning ${repoUrl} \u2192 ~/.cortex/team/`);
1644
1644
  });
1645
1645
  derived = deriveKey(teamPassphrase, repoUrl);
1646
1646
  }
1647
- if (!identifyProject(process.cwd())) {
1648
- await writeProjectConfig({ projectId: repoUrl });
1649
- }
1650
- const count = await pushSessions(config.email, process.cwd(), derived);
1647
+ const count = await pushSessions(config.email, process.cwd(), derived, repoUrl);
1651
1648
  if (count > 0) {
1652
1649
  commitAndPush(repoUrl, token, `feat: share ${count} team sessions`);
1653
1650
  console.log(` Uploaded ${count} sessions`);
@@ -1689,9 +1686,6 @@ async function teamPushCommand() {
1689
1686
  "utf-8"
1690
1687
  );
1691
1688
  if (shareSession) {
1692
- if (!identifyProject(process.cwd())) {
1693
- await writeProjectConfig({ projectId: repoUrl });
1694
- }
1695
1689
  let derived;
1696
1690
  if (encryptSessions) {
1697
1691
  const teamPassphrase = await password6({
@@ -1701,7 +1695,7 @@ async function teamPushCommand() {
1701
1695
  });
1702
1696
  derived = deriveKey(teamPassphrase, repoUrl);
1703
1697
  }
1704
- const count = await pushSessions(config.email, process.cwd(), derived);
1698
+ const count = await pushSessions(config.email, process.cwd(), derived, repoUrl);
1705
1699
  if (count > 0) console.log(` Uploaded ${count} sessions`);
1706
1700
  }
1707
1701
  commitAndPush(repoUrl, token, "chore: update team Claude Code context");
@@ -1876,18 +1870,18 @@ async function installCommand(opts) {
1876
1870
  console.warn(` \u26A0 Could not install ${pluginId}: ${e.message}`);
1877
1871
  }
1878
1872
  }
1879
- await writeProjectConfig({ repo: repoUrl, projectId: repoUrl });
1880
- let derived;
1881
- const { encryptSessions } = await readProjectConfig();
1882
- if (encryptSessions) {
1873
+ await writeProjectConfig({ repo: repoUrl });
1874
+ let sessionCount = await pullSessions(process.cwd(), void 0, repoUrl);
1875
+ if (sessionCount === 0) {
1883
1876
  const teamPassphrase = await password8({
1884
- message: "Team passphrase (to decrypt sessions):",
1885
- mask: "*",
1886
- validate: (v) => v.length >= 12 || "Minimum 12 characters"
1887
- });
1888
- derived = deriveKey(teamPassphrase, repoUrl);
1877
+ message: "Team passphrase (leave empty if sessions are not encrypted):",
1878
+ mask: "*"
1879
+ }).catch(() => "");
1880
+ if (teamPassphrase.length >= 12) {
1881
+ const derived = deriveKey(teamPassphrase, repoUrl);
1882
+ sessionCount = await pullSessions(process.cwd(), derived, repoUrl);
1883
+ }
1889
1884
  }
1890
- const sessionCount = await pullSessions(process.cwd(), derived);
1891
1885
  if (sessionCount > 0) {
1892
1886
  console.log(` + ${sessionCount} sessions installed`);
1893
1887
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortex-sync",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "description": "Sync Claude Code sessions between machines with automatic path remapping and skill conversion",
5
5
  "license": "AGPL-3.0",
6
6
  "type": "module",