posthive-cli 0.1.7 → 0.1.8

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/index.js +9 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -133,20 +133,23 @@ if (command === "login") {
133
133
  const loginUrl = (str(flags, "api-url") ?? process.env.POSTHIVE_API_URL ?? DEFAULT_API_URL).replace(/\/$/, "");
134
134
  try {
135
135
  await runLogin(loginUrl);
136
- // Delay exit by a tick so libuv finishes closing the local callback
137
- // server's handles first — calling process.exit() synchronously here
138
- // can race with that cleanup and crash on Windows.
139
- setImmediate(() => process.exit(0));
140
136
  }
141
137
  catch (err) {
142
138
  fail(err instanceof Error ? err.message : String(err));
143
139
  }
140
+ // Delay exit by a tick so libuv finishes closing the local callback
141
+ // server's handles first — calling process.exit() synchronously here
142
+ // can race with that cleanup and crash on Windows. Nothing below this
143
+ // block must run, since API_KEY was resolved before login wrote the
144
+ // new credentials.
145
+ await new Promise(r => setImmediate(r));
146
+ process.exit(0);
144
147
  }
145
- if (command === "logout") {
148
+ else if (command === "logout") {
146
149
  await runLogout();
147
150
  process.exit(0);
148
151
  }
149
- if (!API_KEY) {
152
+ else if (!API_KEY) {
150
153
  fail("Not logged in. Run `posthive login`, or set POSTHIVE_API_KEY for CI/scripts.");
151
154
  }
152
155
  if (command === "whoami") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthive-cli",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Posthive CLI — schedule posts to 11 social platforms from the command line or any AI agent (Claude Code, OpenClaw, Cursor)",
5
5
  "type": "module",
6
6
  "bin": {