sidecarsync 1.2.0 → 1.3.0

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/dist/cli.js CHANGED
@@ -3705,7 +3705,7 @@ function cmdStatus(args) {
3705
3705
  statusLine("main branch", config.branch);
3706
3706
  statusLine("inbox branch", inbox);
3707
3707
  if (!checkoutPresent) {
3708
- statusLine("checkout", "missing", "bad");
3708
+ statusLine("checkout", "missing — run `sidecar init`", "bad");
3709
3709
  printDaemonLine();
3710
3710
  printLastSyncLine(root);
3711
3711
  return 0;
@@ -3746,6 +3746,7 @@ function cmdStatusJson() {
3746
3746
  branch: config.branch,
3747
3747
  inbox,
3748
3748
  checkout: checkoutPresent ? "present" : "missing",
3749
+ globalInstall: shouldUseGlobalRegistry() || Boolean(findGlobalSidecarExecutable()),
3749
3750
  currentBranch: branch || undefined,
3750
3751
  dirty: checkoutPresent ? Boolean(git(sidecarPath, ["status", "--porcelain"]).stdout.trim()) : undefined,
3751
3752
  daemon: daemonHealth().text,
@@ -3761,8 +3762,12 @@ function pendingStatusInboxBranches(sidecarPath, config) {
3761
3762
  return pendingInboxBranches(sidecarPath, config).filter((remoteBranch) => !isAncestor(sidecarPath, remoteBranch, base));
3762
3763
  }
3763
3764
  function daemonHealth() {
3764
- if (!shouldUseGlobalRegistry())
3765
- return { text: "no global install", role: "quiet" };
3765
+ if (!shouldUseGlobalRegistry()) {
3766
+ if (!findGlobalSidecarExecutable()) {
3767
+ return { text: `no global install — nothing syncs; \`npm install -g ${PACKAGE_SPEC}\``, role: "bad" };
3768
+ }
3769
+ return { text: "owned by the global install", role: "quiet" };
3770
+ }
3766
3771
  const service = daemonServiceStatus();
3767
3772
  if (!service.available)
3768
3773
  return { text: service.message ?? "unavailable", role: "quiet" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sidecarsync",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "A Git-backed sidecar inbox for repo-local development metadata.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -14,8 +14,7 @@ try {
14
14
  enableDaemon(packageRoot);
15
15
  recordInstallSource(packageRoot);
16
16
  } else {
17
- cloneIfMissing(packageRoot);
18
- registerWithGlobalSidecar(packageRoot);
17
+ setUpLocalInstall(packageRoot);
19
18
  }
20
19
  } catch (error) {
21
20
  console.warn(`sidecar: postinstall failed: ${error instanceof Error ? error.message : String(error)}`);
@@ -61,10 +60,36 @@ function recordInstallSource(packageRoot) {
61
60
  });
62
61
  }
63
62
 
64
- function cloneIfMissing(packageRoot) {
63
+ // The global install owns the daemon, so it is what makes a cloned checkout
64
+ // actually sync. Without it a clone here would leave the user with a sidecar
65
+ // directory that silently never updates — worse than no checkout at all.
66
+ function setUpLocalInstall(packageRoot) {
65
67
  const projectRoot = findInstallProjectRoot();
66
68
  if (!projectRoot || !fs.existsSync(path.join(projectRoot, ".sidecar"))) return;
67
69
 
70
+ const globalSidecar = findGlobalSidecar(packageRoot);
71
+ if (!globalSidecar) {
72
+ warnMissingGlobalSidecar();
73
+ return;
74
+ }
75
+
76
+ cloneIfMissing(packageRoot, projectRoot);
77
+ registerWithGlobalSidecar(globalSidecar, projectRoot);
78
+ }
79
+
80
+ function warnMissingGlobalSidecar() {
81
+ console.warn(
82
+ [
83
+ "sidecar: no global install found, so this repo's sidecar checkout was not cloned.",
84
+ "sidecar: without the global install there is no daemon, and nothing would sync.",
85
+ "sidecar: install it, then set this repo up:",
86
+ "sidecar: npm install -g sidecarsync",
87
+ "sidecar: sidecar init",
88
+ ].join("\n"),
89
+ );
90
+ }
91
+
92
+ function cloneIfMissing(packageRoot, projectRoot) {
68
93
  const cliPath = path.join(packageRoot, "dist", "cli.js");
69
94
  if (!fs.existsSync(cliPath)) return;
70
95
 
@@ -80,13 +105,7 @@ function cloneIfMissing(packageRoot) {
80
105
  if (output) console.warn(output);
81
106
  }
82
107
 
83
- function registerWithGlobalSidecar(packageRoot) {
84
- const projectRoot = findInstallProjectRoot();
85
- if (!projectRoot || !fs.existsSync(path.join(projectRoot, ".sidecar"))) return;
86
-
87
- const globalSidecar = findGlobalSidecar(packageRoot);
88
- if (!globalSidecar) return;
89
-
108
+ function registerWithGlobalSidecar(globalSidecar, projectRoot) {
90
109
  const result = spawnSync(globalSidecar, ["register-install"], {
91
110
  cwd: projectRoot,
92
111
  encoding: "utf8",