@grindxp/cli 0.1.1 → 0.1.3
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/index.js
CHANGED
|
@@ -4147,6 +4147,9 @@ function getServiceStatePath() {
|
|
|
4147
4147
|
return join(getGrindHome(), "service-state.json");
|
|
4148
4148
|
}
|
|
4149
4149
|
function getMigrationsPath() {
|
|
4150
|
+
const bundled = join(import.meta.dir, "drizzle");
|
|
4151
|
+
if (existsSync(join(bundled, "meta", "_journal.json")))
|
|
4152
|
+
return bundled;
|
|
4150
4153
|
return join(import.meta.dir, "../drizzle");
|
|
4151
4154
|
}
|
|
4152
4155
|
function ensureGrindHome() {
|
|
@@ -27744,6 +27747,11 @@ function waitForCallback(port, expectedState) {
|
|
|
27744
27747
|
openSockets.add(socket);
|
|
27745
27748
|
socket.once("close", () => openSockets.delete(socket));
|
|
27746
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
|
+
});
|
|
27747
27755
|
const timeoutHandle = setTimeout(() => {
|
|
27748
27756
|
shutdown();
|
|
27749
27757
|
reject(new Error("OAuth callback timed out after 120s"));
|
|
@@ -41704,7 +41712,7 @@ function buildGoogleOAuthConfig(clientId, gmailEnabled, clientSecret) {
|
|
|
41704
41712
|
GOOGLE_SCOPE_CALENDAR,
|
|
41705
41713
|
...gmailEnabled ? [GOOGLE_SCOPE_GMAIL_READONLY, GOOGLE_SCOPE_GMAIL_SEND] : []
|
|
41706
41714
|
].join(" ");
|
|
41707
|
-
const resolvedSecret = clientSecret ??
|
|
41715
|
+
const resolvedSecret = clientSecret ?? "";
|
|
41708
41716
|
return {
|
|
41709
41717
|
method: "callback",
|
|
41710
41718
|
issuer: "https://accounts.google.com",
|
|
@@ -109934,6 +109942,7 @@ async function runGoogleWizard(existingServices, flags) {
|
|
|
109934
109942
|
R2.error("Unexpected OAuth flow type.");
|
|
109935
109943
|
return { services: existingServices ?? {}, cancelled: true };
|
|
109936
109944
|
}
|
|
109945
|
+
const completion = flow.complete();
|
|
109937
109946
|
R2.step("Opening browser for Google authorization...");
|
|
109938
109947
|
R2.message(`If the browser does not open, visit:
|
|
109939
109948
|
${flow.authUrl}`);
|
|
@@ -109945,7 +109954,7 @@ async function runGoogleWizard(existingServices, flags) {
|
|
|
109945
109954
|
spin.start("Waiting for authorization (120s timeout)...");
|
|
109946
109955
|
let token;
|
|
109947
109956
|
try {
|
|
109948
|
-
token = await
|
|
109957
|
+
token = await completion;
|
|
109949
109958
|
} catch (err) {
|
|
109950
109959
|
spin.error("Authorization failed.");
|
|
109951
109960
|
R2.error(err instanceof Error ? err.message : String(err));
|
|
@@ -110926,6 +110935,7 @@ async function initCommand() {
|
|
|
110926
110935
|
process.exit(1);
|
|
110927
110936
|
}
|
|
110928
110937
|
const flow = startOAuthFlow(provider2, oauthConfig);
|
|
110938
|
+
const completion = flow.method === "callback" ? flow.complete() : null;
|
|
110929
110939
|
const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
110930
110940
|
try {
|
|
110931
110941
|
Bun.spawn([openCmd, flow.authUrl], { stdio: ["ignore", "ignore", "ignore"] });
|
|
@@ -110960,7 +110970,7 @@ async function initCommand() {
|
|
|
110960
110970
|
const spin2 = spinner();
|
|
110961
110971
|
spin2.start("Waiting for browser authentication");
|
|
110962
110972
|
try {
|
|
110963
|
-
await
|
|
110973
|
+
await completion;
|
|
110964
110974
|
spin2.stop("Authenticated successfully.");
|
|
110965
110975
|
} catch (err) {
|
|
110966
110976
|
spin2.error("Authentication failed.");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grindxp/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Grind — a gamified productivity CLI. Track quests, earn XP, build streaks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"start": "bun src/index.ts",
|
|
35
|
-
"build": "bun build
|
|
35
|
+
"build": "bun build-npm.ts && chmod +x dist/index.js",
|
|
36
36
|
"build:binary": "bun build-binary.ts",
|
|
37
37
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
38
38
|
"prepublishOnly": "bun run build && bun run typecheck"
|