@grindxp/cli 0.1.2 → 0.1.4

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 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -27747,6 +27747,11 @@ function waitForCallback(port, expectedState) {
27747
27747
  openSockets.add(socket);
27748
27748
  socket.once("close", () => openSockets.delete(socket));
27749
27749
  });
27750
+ server.on("error", (err) => {
27751
+ shutdown();
27752
+ const msg = err.code === "EADDRINUSE" ? `Port ${port} is already in use. Close any other grind processes and try again.` : `Callback server error: ${err.message}`;
27753
+ reject(new Error(msg));
27754
+ });
27750
27755
  const timeoutHandle = setTimeout(() => {
27751
27756
  shutdown();
27752
27757
  reject(new Error("OAuth callback timed out after 120s"));
@@ -109937,6 +109942,7 @@ async function runGoogleWizard(existingServices, flags) {
109937
109942
  R2.error("Unexpected OAuth flow type.");
109938
109943
  return { services: existingServices ?? {}, cancelled: true };
109939
109944
  }
109945
+ const completion = flow.complete();
109940
109946
  R2.step("Opening browser for Google authorization...");
109941
109947
  R2.message(`If the browser does not open, visit:
109942
109948
  ${flow.authUrl}`);
@@ -109948,7 +109954,7 @@ async function runGoogleWizard(existingServices, flags) {
109948
109954
  spin.start("Waiting for authorization (120s timeout)...");
109949
109955
  let token;
109950
109956
  try {
109951
- token = await flow.complete();
109957
+ token = await completion;
109952
109958
  } catch (err) {
109953
109959
  spin.error("Authorization failed.");
109954
109960
  R2.error(err instanceof Error ? err.message : String(err));
@@ -110929,6 +110935,7 @@ async function initCommand() {
110929
110935
  process.exit(1);
110930
110936
  }
110931
110937
  const flow = startOAuthFlow(provider2, oauthConfig);
110938
+ const completion = flow.method === "callback" ? flow.complete() : null;
110932
110939
  const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
110933
110940
  try {
110934
110941
  Bun.spawn([openCmd, flow.authUrl], { stdio: ["ignore", "ignore", "ignore"] });
@@ -110963,7 +110970,7 @@ async function initCommand() {
110963
110970
  const spin2 = spinner();
110964
110971
  spin2.start("Waiting for browser authentication");
110965
110972
  try {
110966
- await flow.complete();
110973
+ await completion;
110967
110974
  spin2.stop("Authenticated successfully.");
110968
110975
  } catch (err) {
110969
110976
  spin2.error("Authentication failed.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grindxp/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Grind — a gamified productivity CLI. Track quests, earn XP, build streaks.",
5
5
  "keywords": [
6
6
  "cli",