@leynier/ccst 0.5.0 → 0.5.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leynier/ccst",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Claude Code Switch Tools for managing contexts",
5
5
  "keywords": [
6
6
  "claude",
@@ -56,4 +56,4 @@
56
56
  "publishConfig": {
57
57
  "access": "public"
58
58
  }
59
- }
59
+ }
@@ -44,23 +44,45 @@ export const ccsStartCommand = async (
44
44
  ensureDaemonDir();
45
45
  const logPath = getLogPath();
46
46
  const ccsPath = getCcsExecutable();
47
- // Open log file for writing (append mode)
48
- const logFd = openSync(logPath, "a");
49
- // Spawn detached process
50
- const child = spawn(ccsPath, ["config"], {
51
- detached: true,
52
- stdio: ["ignore", logFd, logFd],
53
- // On Windows, need shell: true for proper detachment and windowsHide to hide console
54
- ...(process.platform === "win32" ? { shell: true, windowsHide: true } : {}),
55
- });
56
- if (!child.pid) {
57
- console.log(pc.red("Failed to start CCS config daemon"));
58
- return;
47
+ let pid: number | undefined;
48
+ if (process.platform === "win32") {
49
+ // On Windows, use PowerShell with Start-Process -WindowStyle Hidden
50
+ // This is the only way to completely hide a console app that creates its own window
51
+ const ps = spawn(
52
+ "powershell",
53
+ [
54
+ "-WindowStyle",
55
+ "Hidden",
56
+ "-Command",
57
+ `$p = Start-Process -FilePath '${ccsPath}' -ArgumentList 'config' -WindowStyle Hidden -PassThru; $p.Id`,
58
+ ],
59
+ {
60
+ stdio: ["ignore", "pipe", "ignore"],
61
+ windowsHide: true,
62
+ },
63
+ );
64
+ const output = await new Response(ps.stdout).text();
65
+ pid = Number.parseInt(output.trim(), 10);
66
+ if (!Number.isFinite(pid)) {
67
+ console.log(pc.red("Failed to start CCS config daemon"));
68
+ return;
69
+ }
70
+ } else {
71
+ // On Unix, use regular spawn with detached mode
72
+ const logFd = openSync(logPath, "a");
73
+ const child = spawn(ccsPath, ["config"], {
74
+ detached: true,
75
+ stdio: ["ignore", logFd, logFd],
76
+ });
77
+ if (!child.pid) {
78
+ console.log(pc.red("Failed to start CCS config daemon"));
79
+ return;
80
+ }
81
+ pid = child.pid;
82
+ child.unref();
59
83
  }
60
- await writePid(child.pid);
61
- // Unref to allow parent to exit independently
62
- child.unref();
63
- console.log(pc.green(`CCS config daemon started (PID: ${child.pid})`));
84
+ await writePid(pid);
85
+ console.log(pc.green(`CCS config daemon started (PID: ${pid})`));
64
86
  console.log(pc.dim(`Logs: ${logPath}`));
65
87
  console.log(pc.dim("Run 'ccst ccs status' to check status"));
66
88
  console.log(pc.dim("Run 'ccst ccs logs' to view logs"));