@gpc-cli/cli 0.9.33 → 0.9.35
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/README.md +21 -16
- package/dist/anomalies-QZJGQXTZ.js +59 -0
- package/dist/anomalies-QZJGQXTZ.js.map +1 -0
- package/dist/{apps-CVBURB5V.js → apps-J2446UDA.js} +2 -2
- package/dist/{apps-CVBURB5V.js.map → apps-J2446UDA.js.map} +1 -1
- package/dist/{audit-A4BP27DN.js → audit-4UPTLW37.js} +2 -3
- package/dist/{audit-A4BP27DN.js.map → audit-4UPTLW37.js.map} +1 -1
- package/dist/{auth-QSDK7NUO.js → auth-KPVEGAWV.js} +101 -9
- package/dist/auth-KPVEGAWV.js.map +1 -0
- package/dist/bin.js +14 -3
- package/dist/bin.js.map +1 -1
- package/dist/{bundle-7IF5FIB4.js → bundle-7XYHNVNF.js} +27 -2
- package/dist/bundle-7XYHNVNF.js.map +1 -0
- package/dist/{cache-SHWAVON6.js → cache-K23N6GJR.js} +1 -1
- package/dist/cache-K23N6GJR.js.map +1 -0
- package/dist/{chunk-UH3TMIAL.js → chunk-43SH6XEJ.js} +5 -5
- package/dist/{chunk-UH3TMIAL.js.map → chunk-43SH6XEJ.js.map} +1 -1
- package/dist/chunk-7BXCQKJG.js +37 -0
- package/dist/chunk-7BXCQKJG.js.map +1 -0
- package/dist/{chunk-DMMFPBYF.js → chunk-DDTPDKTB.js} +116 -31
- package/dist/chunk-DDTPDKTB.js.map +1 -0
- package/dist/{config-2L7QUYWP.js → config-REB7NINL.js} +14 -4
- package/dist/config-REB7NINL.js.map +1 -0
- package/dist/{data-safety-GDPKV5PN.js → data-safety-GN5VBKAK.js} +1 -1
- package/dist/data-safety-GN5VBKAK.js.map +1 -0
- package/dist/{doctor-UZB2UB5X.js → doctor-QDIFTXNB.js} +54 -6
- package/dist/doctor-QDIFTXNB.js.map +1 -0
- package/dist/enterprise-IH5HXYRB.js +65 -0
- package/dist/enterprise-IH5HXYRB.js.map +1 -0
- package/dist/{feedback-W5MZMRF2.js → feedback-NVGHRU7A.js} +3 -3
- package/dist/feedback-NVGHRU7A.js.map +1 -0
- package/dist/games-X57AGM3E.js +80 -0
- package/dist/games-X57AGM3E.js.map +1 -0
- package/dist/grants-CXTTYKR3.js +123 -0
- package/dist/grants-CXTTYKR3.js.map +1 -0
- package/dist/{iap-BBHF7BLZ.js → iap-MBDD7VWP.js} +6 -38
- package/dist/iap-MBDD7VWP.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/{listings-VSBHQY5H.js → listings-7TWCGGMS.js} +94 -9
- package/dist/listings-7TWCGGMS.js.map +1 -0
- package/dist/{migrate-XQV7P4R7.js → migrate-OHN2FDY6.js} +13 -3
- package/dist/migrate-OHN2FDY6.js.map +1 -0
- package/dist/{publish-I6WJGR4S.js → publish-XM43UA5R.js} +2 -1
- package/dist/publish-XM43UA5R.js.map +1 -0
- package/dist/{purchases-YRO6B7M6.js → purchases-WIDU3FDQ.js} +28 -1
- package/dist/purchases-WIDU3FDQ.js.map +1 -0
- package/dist/quickstart-N7FXM5RQ.js +87 -0
- package/dist/quickstart-N7FXM5RQ.js.map +1 -0
- package/dist/quota-SNUI75NM.js +53 -0
- package/dist/quota-SNUI75NM.js.map +1 -0
- package/dist/{releases-ANC54YWF.js → releases-YRYM7JXC.js} +5 -1
- package/dist/releases-YRYM7JXC.js.map +1 -0
- package/dist/{reports-N5X66IUN.js → reports-YOT4DQGL.js} +1 -1
- package/dist/reports-YOT4DQGL.js.map +1 -0
- package/dist/{reviews-GJAQ5OVC.js → reviews-NN7YQITF.js} +59 -3
- package/dist/reviews-NN7YQITF.js.map +1 -0
- package/dist/{status-6Y2CHHVD.js → status-L5S2FGZ4.js} +45 -5
- package/dist/status-L5S2FGZ4.js.map +1 -0
- package/dist/{subscriptions-Z5ZPVUFM.js → subscriptions-OXAE7SNS.js} +32 -1
- package/dist/subscriptions-OXAE7SNS.js.map +1 -0
- package/dist/{testers-UWSUGGVT.js → testers-SDLVWQ2Z.js} +1 -1
- package/dist/testers-SDLVWQ2Z.js.map +1 -0
- package/dist/{tracks-XFUN7JJX.js → tracks-NERFFEDT.js} +2 -2
- package/dist/tracks-NERFFEDT.js.map +1 -0
- package/dist/train-PX5Z26PQ.js +150 -0
- package/dist/train-PX5Z26PQ.js.map +1 -0
- package/dist/{update-NIVJLUNH.js → update-6XSZRXSU.js} +3 -3
- package/dist/{update-NIVJLUNH.js.map → update-6XSZRXSU.js.map} +1 -1
- package/dist/{validate-MHLPENCM.js → validate-NC4MWKOB.js} +9 -4
- package/dist/validate-NC4MWKOB.js.map +1 -0
- package/dist/{version-7AI5IHVK.js → version-2X32UAAE.js} +3 -3
- package/dist/version-2X32UAAE.js.map +1 -0
- package/dist/{vitals-KSNAVN5F.js → vitals-LFL75LA6.js} +135 -4
- package/dist/vitals-LFL75LA6.js.map +1 -0
- package/package.json +8 -4
- package/dist/auth-QSDK7NUO.js.map +0 -1
- package/dist/bundle-7IF5FIB4.js.map +0 -1
- package/dist/cache-SHWAVON6.js.map +0 -1
- package/dist/chunk-DMMFPBYF.js.map +0 -1
- package/dist/config-2L7QUYWP.js.map +0 -1
- package/dist/data-safety-GDPKV5PN.js.map +0 -1
- package/dist/doctor-UZB2UB5X.js.map +0 -1
- package/dist/feedback-W5MZMRF2.js.map +0 -1
- package/dist/iap-BBHF7BLZ.js.map +0 -1
- package/dist/listings-VSBHQY5H.js.map +0 -1
- package/dist/migrate-XQV7P4R7.js.map +0 -1
- package/dist/publish-I6WJGR4S.js.map +0 -1
- package/dist/purchases-YRO6B7M6.js.map +0 -1
- package/dist/releases-ANC54YWF.js.map +0 -1
- package/dist/reports-N5X66IUN.js.map +0 -1
- package/dist/reviews-GJAQ5OVC.js.map +0 -1
- package/dist/status-6Y2CHHVD.js.map +0 -1
- package/dist/subscriptions-Z5ZPVUFM.js.map +0 -1
- package/dist/testers-UWSUGGVT.js.map +0 -1
- package/dist/tracks-XFUN7JJX.js.map +0 -1
- package/dist/validate-MHLPENCM.js.map +0 -1
- package/dist/version-7AI5IHVK.js.map +0 -1
- package/dist/vitals-KSNAVN5F.js.map +0 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/commands/quickstart.ts
|
|
4
|
+
import { loadConfig } from "@gpc-cli/config";
|
|
5
|
+
import { resolveAuth } from "@gpc-cli/auth";
|
|
6
|
+
function step(n, total, label, status) {
|
|
7
|
+
const padded = `Step ${n}/${total} ${label}`.padEnd(48);
|
|
8
|
+
console.log(`${padded}${status}`);
|
|
9
|
+
}
|
|
10
|
+
function registerQuickstartCommand(program) {
|
|
11
|
+
program.command("quickstart").description("Guided setup: verify credentials, config, and show next steps").action(async () => {
|
|
12
|
+
console.log("\nGPC \u2014 Quick Start Setup");
|
|
13
|
+
console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
14
|
+
const total = 4;
|
|
15
|
+
let allPassed = true;
|
|
16
|
+
let config = null;
|
|
17
|
+
try {
|
|
18
|
+
config = await loadConfig();
|
|
19
|
+
const profileInfo = config.profile ? `profile "${config.profile}"` : "default config";
|
|
20
|
+
step(1, total, "Checking for existing config...", `\u2713 Found ${profileInfo}`);
|
|
21
|
+
} catch {
|
|
22
|
+
step(1, total, "Checking for existing config...", "\u26A0 No config found");
|
|
23
|
+
console.log("\n Run: gpc config init");
|
|
24
|
+
console.log(" Or: gpc auth login (runs interactive setup)");
|
|
25
|
+
allPassed = false;
|
|
26
|
+
}
|
|
27
|
+
if (config) {
|
|
28
|
+
try {
|
|
29
|
+
const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });
|
|
30
|
+
const email = auth.getClientEmail();
|
|
31
|
+
step(2, total, "Verifying credentials...", `\u2713 ${email}`);
|
|
32
|
+
} catch {
|
|
33
|
+
step(2, total, "Verifying credentials...", "\u2717 Auth failed \u2014 run: gpc auth login");
|
|
34
|
+
allPassed = false;
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
step(2, total, "Verifying credentials...", "\u2014 skipped (no config)");
|
|
38
|
+
allPassed = false;
|
|
39
|
+
}
|
|
40
|
+
const packageName = config?.app ?? program.opts()["app"];
|
|
41
|
+
if (packageName) {
|
|
42
|
+
step(3, total, "Checking package name...", `\u2713 ${packageName}`);
|
|
43
|
+
} else {
|
|
44
|
+
step(3, total, "Checking package name...", "\u26A0 Not set \u2014 run: gpc config set app <package>");
|
|
45
|
+
allPassed = false;
|
|
46
|
+
}
|
|
47
|
+
if (allPassed) {
|
|
48
|
+
try {
|
|
49
|
+
const { spawnSync } = await import("child_process");
|
|
50
|
+
const result = spawnSync(process.execPath, [process.argv[1] ?? "gpc", "doctor", "--quiet"], {
|
|
51
|
+
stdio: "pipe",
|
|
52
|
+
encoding: "utf-8"
|
|
53
|
+
});
|
|
54
|
+
if (result.status === 0) {
|
|
55
|
+
step(4, total, "Running doctor...", "\u2713 All checks passed");
|
|
56
|
+
} else {
|
|
57
|
+
step(4, total, "Running doctor...", "\u26A0 Some checks failed \u2014 run: gpc doctor");
|
|
58
|
+
allPassed = false;
|
|
59
|
+
}
|
|
60
|
+
} catch {
|
|
61
|
+
step(4, total, "Running doctor...", "\u2014 run: gpc doctor");
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
step(4, total, "Running doctor...", "\u2014 skipped");
|
|
65
|
+
}
|
|
66
|
+
console.log("");
|
|
67
|
+
if (allPassed) {
|
|
68
|
+
console.log("Ready. Here's what you can do next:");
|
|
69
|
+
console.log("");
|
|
70
|
+
console.log(" gpc status \u2192 app health snapshot");
|
|
71
|
+
console.log(" gpc releases list \u2192 current tracks and versions");
|
|
72
|
+
console.log(" gpc reviews list \u2192 recent user reviews");
|
|
73
|
+
console.log(" gpc vitals overview \u2192 crash and ANR rates");
|
|
74
|
+
console.log(" gpc publish app.aab \u2192 end-to-end upload and release");
|
|
75
|
+
console.log("");
|
|
76
|
+
console.log("Docs: https://yasserstudio.github.io/gpc/");
|
|
77
|
+
} else {
|
|
78
|
+
console.log("Fix the issues above, then run 'gpc quickstart' again.");
|
|
79
|
+
console.log("Need help? Run 'gpc doctor' for detailed diagnostics.");
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
registerQuickstartCommand
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=quickstart-N7FXM5RQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/quickstart.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\n\nfunction step(n: number, total: number, label: string, status: string): void {\n const padded = `Step ${n}/${total} ${label}`.padEnd(48);\n console.log(`${padded}${status}`);\n}\n\nexport function registerQuickstartCommand(program: Command): void {\n program\n .command(\"quickstart\")\n .description(\"Guided setup: verify credentials, config, and show next steps\")\n .action(async () => {\n console.log(\"\\nGPC — Quick Start Setup\");\n console.log(\"══════════════════════════════════════════════════════\");\n\n const total = 4;\n let allPassed = true;\n\n // Step 1: Check for existing config\n let config: Awaited<ReturnType<typeof loadConfig>> | null = null;\n try {\n config = await loadConfig();\n const profileInfo = config.profile ? `profile \"${config.profile}\"` : \"default config\";\n step(1, total, \"Checking for existing config...\", `✓ Found ${profileInfo}`);\n } catch {\n step(1, total, \"Checking for existing config...\", \"⚠ No config found\");\n console.log(\"\\n Run: gpc config init\");\n console.log(\" Or: gpc auth login (runs interactive setup)\");\n allPassed = false;\n }\n\n // Step 2: Verify credentials\n if (config) {\n try {\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n const email = auth.getClientEmail();\n step(2, total, \"Verifying credentials...\", `✓ ${email}`);\n } catch {\n step(2, total, \"Verifying credentials...\", \"✗ Auth failed — run: gpc auth login\");\n allPassed = false;\n }\n } else {\n step(2, total, \"Verifying credentials...\", \"— skipped (no config)\");\n allPassed = false;\n }\n\n // Step 3: Check package name\n const packageName = config?.app ?? (program.opts()[\"app\"] as string | undefined);\n if (packageName) {\n step(3, total, \"Checking package name...\", `✓ ${packageName}`);\n } else {\n step(3, total, \"Checking package name...\", \"⚠ Not set — run: gpc config set app <package>\");\n allPassed = false;\n }\n\n // Step 4: Run doctor inline\n if (allPassed) {\n try {\n const { spawnSync } = await import(\"node:child_process\");\n const result = spawnSync(process.execPath, [process.argv[1] ?? \"gpc\", \"doctor\", \"--quiet\"], {\n stdio: \"pipe\",\n encoding: \"utf-8\",\n });\n if (result.status === 0) {\n step(4, total, \"Running doctor...\", \"✓ All checks passed\");\n } else {\n step(4, total, \"Running doctor...\", \"⚠ Some checks failed — run: gpc doctor\");\n allPassed = false;\n }\n } catch {\n step(4, total, \"Running doctor...\", \"— run: gpc doctor\");\n }\n } else {\n step(4, total, \"Running doctor...\", \"— skipped\");\n }\n\n console.log(\"\");\n\n if (allPassed) {\n console.log(\"Ready. Here's what you can do next:\");\n console.log(\"\");\n console.log(\" gpc status → app health snapshot\");\n console.log(\" gpc releases list → current tracks and versions\");\n console.log(\" gpc reviews list → recent user reviews\");\n console.log(\" gpc vitals overview → crash and ANR rates\");\n console.log(\" gpc publish app.aab → end-to-end upload and release\");\n console.log(\"\");\n console.log(\"Docs: https://yasserstudio.github.io/gpc/\");\n } else {\n console.log(\"Fix the issues above, then run 'gpc quickstart' again.\");\n console.log(\"Need help? Run 'gpc doctor' for detailed diagnostics.\");\n process.exit(1);\n }\n });\n}\n"],"mappings":";;;AACA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAE5B,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AAI;AACF,cAAM,EAAE,UAAU,IAAI,MAAM,OAAO,eAAoB;AACvD,cAAM,SAAS,UAAU,QAAQ,UAAU,CAAC,QAAQ,KAAK,CAAC,KAAK,OAAO,UAAU,SAAS,GAAG;AAAA,UAC1F,OAAO;AAAA,UACP,UAAU;AAAA,QACZ,CAAC;AACD,YAAI,OAAO,WAAW,GAAG;AACvB,eAAK,GAAG,OAAO,qBAAqB,0BAAqB;AAAA,QAC3D,OAAO;AACL,eAAK,GAAG,OAAO,qBAAqB,kDAAwC;AAC5E,sBAAY;AAAA,QACd;AAAA,MACF,QAAQ;AACN,aAAK,GAAG,OAAO,qBAAqB,wBAAmB;AAAA,MACzD;AAAA,IACF,OAAO;AACL,WAAK,GAAG,OAAO,qBAAqB,gBAAW;AAAA,IACjD;AAEA,YAAQ,IAAI,EAAE;AAEd,QAAI,WAAW;AACb,cAAQ,IAAI,qCAAqC;AACjD,cAAQ,IAAI,EAAE;AACd,cAAQ,IAAI,sDAAiD;AAC7D,cAAQ,IAAI,8DAAyD;AACrE,cAAQ,IAAI,sDAAiD;AAC7D,cAAQ,IAAI,sDAAiD;AAC7D,cAAQ,IAAI,gEAA2D;AACvE,cAAQ,IAAI,EAAE;AACd,cAAQ,IAAI,2CAA2C;AAAA,IACzD,OAAO;AACL,cAAQ,IAAI,wDAAwD;AACpE,cAAQ,IAAI,uDAAuD;AACnE,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;","names":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
getOutputFormat
|
|
4
|
+
} from "./chunk-ELXAK7GI.js";
|
|
5
|
+
|
|
6
|
+
// src/commands/quota.ts
|
|
7
|
+
import { getQuotaUsage, formatOutput } from "@gpc-cli/core";
|
|
8
|
+
function registerQuotaCommand(program) {
|
|
9
|
+
const quota = program.command("quota").description("View Google Play API quota usage tracked from local audit log");
|
|
10
|
+
quota.command("status").description("Show daily and per-minute API call counts").action(async () => {
|
|
11
|
+
const format = getOutputFormat(program, {});
|
|
12
|
+
try {
|
|
13
|
+
const usage = await getQuotaUsage();
|
|
14
|
+
if (format === "json") {
|
|
15
|
+
console.log(formatOutput(usage, format));
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const dailyPct = (usage.dailyCallsUsed / usage.dailyCallsLimit * 100).toFixed(1);
|
|
19
|
+
const minPct = (usage.minuteCallsUsed / usage.minuteCallsLimit * 100).toFixed(1);
|
|
20
|
+
console.log(`
|
|
21
|
+
API Quota Usage`);
|
|
22
|
+
console.log(`${"\u2500".repeat(45)}`);
|
|
23
|
+
console.log(`Daily: ${usage.dailyCallsUsed.toLocaleString()} / ${usage.dailyCallsLimit.toLocaleString()} (${dailyPct}%)`);
|
|
24
|
+
console.log(` Remaining: ${usage.dailyCallsRemaining.toLocaleString()}`);
|
|
25
|
+
console.log(`Minute: ${usage.minuteCallsUsed} / ${usage.minuteCallsLimit} (${minPct}%)`);
|
|
26
|
+
console.log(` Remaining: ${usage.minuteCallsRemaining}`);
|
|
27
|
+
if (usage.topCommands.length > 0) {
|
|
28
|
+
console.log(`
|
|
29
|
+
Top commands today:`);
|
|
30
|
+
for (const { command, count } of usage.topCommands) {
|
|
31
|
+
console.log(` ${command.padEnd(30)} ${count}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
quota.command("usage").description("Alias for quota status").action(async () => {
|
|
40
|
+
const format = getOutputFormat(program, {});
|
|
41
|
+
try {
|
|
42
|
+
const usage = await getQuotaUsage();
|
|
43
|
+
console.log(formatOutput(usage, format));
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
registerQuotaCommand
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=quota-SNUI75NM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/quota.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { getQuotaUsage, formatOutput } from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\n\nexport function registerQuotaCommand(program: Command): void {\n const quota = program\n .command(\"quota\")\n .description(\"View Google Play API quota usage tracked from local audit log\");\n\n quota\n .command(\"status\")\n .description(\"Show daily and per-minute API call counts\")\n .action(async () => {\n const format = getOutputFormat(program, {});\n\n try {\n const usage = await getQuotaUsage();\n\n if (format === \"json\") {\n console.log(formatOutput(usage, format));\n return;\n }\n\n const dailyPct = ((usage.dailyCallsUsed / usage.dailyCallsLimit) * 100).toFixed(1);\n const minPct = ((usage.minuteCallsUsed / usage.minuteCallsLimit) * 100).toFixed(1);\n\n console.log(`\\nAPI Quota Usage`);\n console.log(`${\"─\".repeat(45)}`);\n console.log(`Daily: ${usage.dailyCallsUsed.toLocaleString()} / ${usage.dailyCallsLimit.toLocaleString()} (${dailyPct}%)`);\n console.log(` Remaining: ${usage.dailyCallsRemaining.toLocaleString()}`);\n console.log(`Minute: ${usage.minuteCallsUsed} / ${usage.minuteCallsLimit} (${minPct}%)`);\n console.log(` Remaining: ${usage.minuteCallsRemaining}`);\n\n if (usage.topCommands.length > 0) {\n console.log(`\\nTop commands today:`);\n for (const { command, count } of usage.topCommands) {\n console.log(` ${command.padEnd(30)} ${count}`);\n }\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n });\n\n quota\n .command(\"usage\")\n .description(\"Alias for quota status\")\n .action(async () => {\n const format = getOutputFormat(program, {});\n\n try {\n const usage = await getQuotaUsage();\n console.log(formatOutput(usage, format));\n } catch (error) {\n console.error(`Error: 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AC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AAEH,QACG,QAAQ,OAAO,EACf,YAAY,wBAAwB,EACpC,OAAO,YAAY;AAClB,UAAM,SAAS,gBAAgB,SAAS,CAAC,CAAC;AAE1C,QAAI;AACF,YAAM,QAAQ,MAAM,cAAc;AAClC,cAAQ,IAAI,aAAa,OAAO,MAAM,CAAC;AAAA,IACzC,SAAS,OAAO;AACd,cAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;","names":[]}
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
isInteractive,
|
|
11
11
|
promptInput,
|
|
12
12
|
promptSelect,
|
|
13
|
+
requireConfirm,
|
|
13
14
|
requireOption
|
|
14
15
|
} from "./chunk-NV75I5VP.js";
|
|
15
16
|
|
|
@@ -316,6 +317,9 @@ function registerReleasesCommands(program) {
|
|
|
316
317
|
process.exit(2);
|
|
317
318
|
}
|
|
318
319
|
}
|
|
320
|
+
if (action === "halt") {
|
|
321
|
+
await requireConfirm(`Halt rollout on track "${options.track}" for ${packageName}?`, program);
|
|
322
|
+
}
|
|
319
323
|
if (isDryRun(program)) {
|
|
320
324
|
if (action === "increase" && options.vitalsGate) {
|
|
321
325
|
console.error("Warning: --vitals-gate is ignored in --dry-run mode. Gate will run on live execution.");
|
|
@@ -444,4 +448,4 @@ function registerReleasesCommands(program) {
|
|
|
444
448
|
export {
|
|
445
449
|
registerReleasesCommands
|
|
446
450
|
};
|
|
447
|
-
//# sourceMappingURL=releases-
|
|
451
|
+
//# sourceMappingURL=releases-YRYM7JXC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/releases.ts"],"sourcesContent":["import { appendFile, stat } from \"node:fs/promises\";\nimport { basename, extname } from \"node:path\";\nimport type { GpcConfig } from \"@gpc-cli/config\";\nimport type { Command } from \"commander\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createApiClient, createReportingClient } from \"@gpc-cli/api\";\nimport type { RetryLogEntry, ExternallyHostedApk } from \"@gpc-cli/api\";\nimport {\n uploadRelease,\n getReleasesStatus,\n promoteRelease,\n updateRollout,\n readReleaseNotesFromDir,\n generateNotesFromGit,\n writeAuditLog,\n createAuditEntry,\n uploadExternallyHosted,\n diffReleases,\n getVitalsCrashes,\n checkThreshold,\n} from \"@gpc-cli/core\";\nimport { formatOutput, sortResults, createSpinner } from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { isInteractive, promptSelect, promptInput, requireOption, requireConfirm } from \"../prompt.js\";\n\nfunction resolvePackageName(packageArg: string | undefined, config: GpcConfig): string {\n const name = packageArg || config.app;\n if (!name) {\n console.error(\"Error: No package name. Use --app <package> or gpc config set app <package>\");\n process.exit(2);\n }\n return name;\n}\n\nfunction createRetryLogger(retryLogPath?: string): ((entry: RetryLogEntry) => void) | undefined {\n if (!retryLogPath) return undefined;\n return (entry: RetryLogEntry) => {\n const line = JSON.stringify(entry) + \"\\n\";\n appendFile(retryLogPath, line).catch(() => {});\n };\n}\n\nasync function getClient(config: GpcConfig, retryLogPath?: string, uploadTimeout?: number) {\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n return createApiClient({ auth, onRetry: createRetryLogger(retryLogPath), uploadTimeout });\n}\n\nexport function registerReleasesCommands(program: Command): void {\n const releases = program.command(\"releases\").description(\"Manage releases and rollouts\");\n\n // Upload\n releases\n .command(\"upload <file>\")\n .description(\"Upload AAB/APK and assign to a track\")\n .option(\"--track <track>\", \"Target track\", \"internal\")\n .option(\"--rollout <percent>\", \"Staged rollout percentage (1-100)\")\n .option(\"--notes <text>\", \"Release notes (en-US)\")\n .option(\"--name <name>\", \"Release name\")\n .option(\"--mapping <file>\", \"ProGuard/R8 mapping file for deobfuscation\")\n .option(\"--notes-dir <dir>\", \"Read release notes from directory (<dir>/<lang>.txt)\")\n .option(\"--notes-from-git\", \"Generate release notes from git commit history\")\n .option(\"--since <ref>\", \"Git ref to start from (tag, SHA) — used with --notes-from-git\")\n .option(\"--retry-log <path>\", \"Write retry log entries to file (JSONL)\")\n .option(\"--timeout <ms>\", \"Upload timeout in milliseconds (auto-scales with file size by default)\", parseInt)\n .action(async (file: string, options) => {\n try {\n await stat(file);\n } catch {\n console.error(`Error: File not found: ${file}`);\n process.exit(2);\n }\n\n const ext = extname(file).toLowerCase();\n if (ext !== \".aab\" && ext !== \".apk\") {\n console.error(`Error: Expected .aab or .apk file, got \"${ext || \"(no extension)\"}\"`);\n process.exit(2);\n }\n\n const noteSources = [options.notes, options.notesDir, options.notesFromGit].filter(Boolean);\n if (noteSources.length > 1) {\n console.error(\"Error: Cannot combine --notes, --notes-dir, and --notes-from-git. Use only one.\");\n process.exit(2);\n }\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n\n // Interactive mode: prompt for missing options\n if (isInteractive(program)) {\n if (!options.track || options.track === \"internal\") {\n const tracks = [\"internal\", \"alpha\", \"beta\", \"production\"];\n options.track = await promptSelect(\"Select track:\", tracks, \"internal\");\n }\n\n if (!options.rollout && options.track === \"production\") {\n const rolloutStr = await promptInput(\n \"Staged rollout percentage (1-100, blank for full)\",\n \"100\",\n );\n if (rolloutStr && rolloutStr !== \"100\") {\n options.rollout = rolloutStr;\n }\n }\n\n if (!options.notes && !options.notesDir) {\n const notes = await promptInput(\"Release notes (en-US, blank to skip)\");\n if (notes) options.notes = notes;\n }\n }\n\n if (options.rollout !== undefined) {\n const rollout = Number(options.rollout);\n if (!Number.isFinite(rollout) || rollout < 1 || rollout > 100) {\n console.error(`Error: --rollout must be a number between 1 and 100 (got: ${options.rollout})`);\n process.exit(2);\n }\n }\n\n const { size: fileSize } = await stat(file);\n const jsonMode = format === \"json\";\n const client = await getClient(config, options.retryLog, options.timeout);\n\n // The API layer buffers the full file before sending, so byte-level streaming progress\n // isn't available. Use a time-based animation instead.\n const showProgress = !jsonMode && process.stderr.isTTY && !program.opts()[\"quiet\"];\n const sizeMB = (fileSize / (1024 * 1024)).toFixed(1);\n const FRAMES = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n let progressInterval: ReturnType<typeof setInterval> | undefined;\n if (showProgress) {\n let frame = 0;\n const startTime = Date.now();\n progressInterval = setInterval(() => {\n const elapsed = ((Date.now() - startTime) / 1000).toFixed(0);\n process.stderr.write(`\\r ${FRAMES[frame % FRAMES.length]} Uploading ${basename(file)} ${sizeMB} MB (${elapsed}s) `);\n frame++;\n }, 120);\n }\n const onProgress = undefined;\n\n if (isDryRun(program)) {\n try {\n const result = await uploadRelease(client, packageName, file, {\n track: options.track,\n userFraction: options.rollout ? Number(options.rollout) / 100 : undefined,\n dryRun: true,\n });\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n return;\n }\n\n const auditEntry = createAuditEntry(\n \"releases upload\",\n {\n file,\n track: options.track,\n rollout: options.rollout,\n },\n packageName,\n );\n\n const spinner = createSpinner(`Uploading ${basename(file)} (${sizeMB} MB)...`);\n if (!showProgress) spinner.start();\n\n try {\n let releaseNotes: { language: string; text: string }[] | undefined;\n if (options.notesFromGit) {\n const gitNotes = await generateNotesFromGit({ since: options.since });\n releaseNotes = [{ language: gitNotes.language, text: gitNotes.text }];\n } else if (options.notesDir) {\n releaseNotes = await readReleaseNotesFromDir(options.notesDir);\n } else if (options.notes) {\n releaseNotes = [{ language: \"en-US\", text: options.notes }];\n }\n\n const result = await uploadRelease(client, packageName, file, {\n track: options.track,\n userFraction: options.rollout ? Number(options.rollout) / 100 : undefined,\n releaseNotes,\n releaseName: options.name,\n mappingFile: options.mapping,\n onProgress,\n });\n if (progressInterval) { clearInterval(progressInterval); process.stderr.write(`\\r ✓ Uploaded ${basename(file)} ${sizeMB} MB\\n`); }\n spinner.stop(\"Upload complete\");\n console.log(formatOutput(result, format));\n auditEntry.success = true;\n } catch (error) {\n if (progressInterval) { clearInterval(progressInterval); process.stderr.write(\"\\n\"); }\n spinner.fail(\"Upload failed\");\n auditEntry.success = false;\n auditEntry.error = error instanceof Error ? error.message : String(error);\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n } finally {\n auditEntry.durationMs = Date.now() - new Date(auditEntry.timestamp).getTime();\n writeAuditLog(auditEntry).catch(() => {});\n }\n });\n\n // Status\n releases\n .command(\"status\")\n .description(\"Show current release status across tracks\")\n .option(\"--track <track>\", \"Filter by track\")\n .option(\"--sort <field>\", \"Sort by field (prefix with - for descending)\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n try {\n const TRACK_ORDER = [\"production\", \"beta\", \"alpha\", \"internal\"];\n const rawStatuses = await getReleasesStatus(client, packageName, options.track);\n const statuses = options.track\n ? (Array.isArray(rawStatuses) ? rawStatuses.filter((s: any) => s.track === options.track) : rawStatuses)\n : rawStatuses;\n const sorted = Array.isArray(statuses)\n ? options.sort\n ? sortResults(statuses, options.sort)\n : [...statuses].sort((a, b) => {\n const ai = TRACK_ORDER.indexOf(String((a as Record<string, unknown>)[\"track\"] ?? \"\"));\n const bi = TRACK_ORDER.indexOf(String((b as Record<string, unknown>)[\"track\"] ?? \"\"));\n return (ai === -1 ? 99 : ai) - (bi === -1 ? 99 : bi);\n })\n : statuses;\n if (format !== \"json\" && Array.isArray(sorted)) {\n const rows = sorted.map((s: Record<string, unknown>) => ({\n track: s[\"track\"] || \"-\",\n status: s[\"status\"] || \"-\",\n name: s[\"name\"] || \"-\",\n versionCodes: Array.isArray(s[\"versionCodes\"]) ? (s[\"versionCodes\"] as unknown[]).join(\", \") : \"-\",\n userFraction: s[\"userFraction\"] !== undefined\n ? `${Math.round(Number(s[\"userFraction\"]) * 100)}%`\n : \"—\",\n }));\n console.log(formatOutput(rows, format));\n } else {\n console.log(formatOutput(sorted, format));\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n // Promote\n releases\n .command(\"promote\")\n .description(\"Promote a release from one track to another\")\n .option(\"--from <track>\", \"Source track\")\n .option(\"--to <track>\", \"Target track\")\n .option(\"--rollout <percent>\", \"Staged rollout percentage\")\n .option(\"--notes <text>\", \"Release notes\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n const interactive = isInteractive(program);\n const tracks = [\"internal\", \"alpha\", \"beta\", \"production\"];\n\n options.from = await requireOption(\n \"from\",\n options.from,\n {\n message: \"Source track:\",\n choices: tracks,\n },\n interactive,\n );\n\n options.to = await requireOption(\n \"to\",\n options.to,\n {\n message: \"Target track:\",\n choices: tracks.filter((t: string) => t !== options.from),\n },\n interactive,\n );\n\n if (options.from === options.to) {\n console.error(`Error: --from and --to must be different tracks (both are \"${options.from}\")`);\n process.exit(2);\n }\n\n if (options.rollout !== undefined) {\n const rollout = Number(options.rollout);\n if (!Number.isFinite(rollout) || rollout < 1 || rollout > 100) {\n console.error(`Error: --rollout must be a number between 1 and 100 (got: ${options.rollout})`);\n process.exit(2);\n }\n }\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"releases promote\",\n action: \"promote\",\n target: `${options.from} → ${options.to}`,\n details: { rollout: options.rollout },\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const result = await promoteRelease(client, packageName, options.from, options.to, {\n userFraction: options.rollout ? Number(options.rollout) / 100 : undefined,\n releaseNotes: options.notes ? [{ language: \"en-US\", text: options.notes }] : undefined,\n });\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n // Rollout subcommands\n const rollout = releases.command(\"rollout\").description(\"Manage staged rollouts\");\n\n for (const action of [\"increase\", \"halt\", \"resume\", \"complete\"] as const) {\n const cmd = rollout\n .command(action)\n .description(`${action.charAt(0).toUpperCase() + action.slice(1)} a staged rollout`)\n .option(\"--track <track>\", \"Track name\");\n\n if (action === \"increase\") {\n cmd.option(\"--to <percent>\", \"New rollout percentage\");\n cmd.option(\"--vitals-gate\", \"Halt rollout if crash rate exceeds configured threshold\");\n }\n\n cmd.action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n const interactive = isInteractive(program);\n const tracks = [\"internal\", \"alpha\", \"beta\", \"production\"];\n\n options.track = await requireOption(\n \"track\",\n options.track,\n {\n message: \"Track:\",\n choices: tracks,\n },\n interactive,\n );\n\n if (action === \"increase\") {\n options.to = await requireOption(\n \"to\",\n options.to,\n {\n message: \"New rollout percentage (1-100):\",\n },\n interactive,\n );\n }\n\n if (action === \"increase\" && options.to !== undefined) {\n const to = Number(options.to);\n if (!Number.isFinite(to) || to < 1 || to > 100) {\n console.error(`Error: --to must be a number between 1 and 100 (got: ${options.to})`);\n process.exit(2);\n }\n }\n\n // Require confirmation for destructive rollout halt\n if (action === \"halt\") {\n await requireConfirm(`Halt rollout on track \"${options.track}\" for ${packageName}?`, program);\n }\n\n if (isDryRun(program)) {\n if (action === \"increase\" && options.vitalsGate) {\n console.error(\"Warning: --vitals-gate is ignored in --dry-run mode. Gate will run on live execution.\");\n }\n printDryRun(\n {\n command: `releases rollout ${action}`,\n action: action,\n target: options.track,\n details: { percentage: options.to !== undefined ? `${options.to}%` : undefined },\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const result = await updateRollout(\n client,\n packageName,\n options.track,\n action,\n options.to ? Number(options.to) / 100 : undefined,\n );\n\n // Vitals gate: check crash rate after rollout increase\n if (action === \"increase\" && options.vitalsGate) {\n const threshold = (config as any).vitals?.thresholds?.crashRate;\n if (!threshold) {\n console.error(\"Warning: --vitals-gate requires vitals.thresholds.crashRate in config. Skipping gate.\");\n } else {\n try {\n const { auth: authConfig } = config;\n const vitalsAuth = await resolveAuth({ serviceAccountPath: authConfig?.serviceAccount });\n const reportingClient = createReportingClient({ auth: vitalsAuth });\n const vitalsResult = await getVitalsCrashes(reportingClient, packageName, { days: 1 });\n const latest = (vitalsResult as any).data?.[0]?.crashRate;\n const check = checkThreshold(latest, threshold);\n if (check.breached) {\n await updateRollout(client, packageName, options.track, \"halt\");\n console.error(`Vitals gate: crash rate ${String(latest)}% > threshold ${String(threshold)}%. Rollout halted.`);\n process.exit(6);\n }\n } catch (vitalsErr) {\n console.error(`Warning: Vitals gate check failed: ${vitalsErr instanceof Error ? vitalsErr.message : String(vitalsErr)}`);\n }\n }\n }\n\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n }\n\n // Release notes\n releases\n .command(\"notes\")\n .description(\"Get or set release notes\")\n .argument(\"<action>\", \"Action: get|set\")\n .option(\"--track <track>\", \"Track name\")\n .option(\"--lang <language>\", \"Language code\", \"en-US\")\n .option(\"--notes <text>\", \"Release notes text\")\n .option(\"--file <path>\", \"Read notes from file\")\n .action(async (action: string, options) => {\n if (action === \"set\") {\n console.error(\n \"Error: gpc releases notes set is not implemented as a standalone command.\\n\" +\n \"Use --notes, --notes-dir, or --notes-from-git with:\\n\" +\n \" gpc releases upload\\n\" +\n \" gpc publish\"\n );\n process.exit(1);\n }\n\n if (action === \"get\") {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n const track = options.track ?? \"internal\";\n const statuses = await getReleasesStatus(client, packageName, track);\n const notes = Array.isArray(statuses)\n ? statuses.flatMap((s: any) => s.releaseNotes ?? [])\n : (statuses as any).releaseNotes ?? [];\n if (notes.length === 0) {\n console.log(\"No release notes found.\");\n return;\n }\n console.log(formatOutput(notes, format));\n return;\n }\n\n console.error(\"Usage: gpc releases notes <get|set> --track <track>\");\n process.exit(2);\n });\n\n // Upload externally hosted APK\n releases\n .command(\"upload-external\")\n .description(\"Upload an externally hosted APK configuration\")\n .requiredOption(\"--url <url>\", \"External URL where the APK is hosted\")\n .requiredOption(\"--file <config>\", \"Path to JSON config file with APK metadata\")\n .action(async (options: { url: string; file: string }) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n\n try {\n const { readFile } = await import(\"node:fs/promises\");\n const raw = await readFile(options.file, \"utf-8\");\n const apkConfig = JSON.parse(raw) as Record<string, unknown>;\n\n // Override with CLI-provided URL\n apkConfig[\"externallyHostedUrl\"] = options.url;\n\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n const client = createApiClient({ auth });\n const result = await uploadExternallyHosted(\n client,\n packageName,\n apkConfig as ExternallyHostedApk,\n );\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n // Diff\n releases\n .command(\"diff\")\n .description(\"Compare releases between two tracks\")\n .option(\"--from <track>\", \"Source track\", \"internal\")\n .option(\"--to <track>\", \"Target track\", \"production\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n try {\n const result = await diffReleases(client, packageName, options.from, options.to);\n if (result.diffs.length === 0) {\n console.log(`No differences between ${result.fromTrack} and ${result.toTrack}.`);\n } else {\n if (format === \"json\") {\n console.log(formatOutput(result, format));\n } else {\n console.log(`Differences: ${result.fromTrack} vs ${result.toTrack}\\n`);\n console.log(formatOutput(result.diffs, format));\n }\n }\n } catch (error) {\n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SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,mBAAmB,QAAQ,KAAK,EAAE,KAAK,GAAG,MAAM;AACpE,UAAM,SAAS,MAAM,UAAU,MAAM;AACrC,UAAM,SAAS,gBAAgB,SAAS,MAAM;AAE9C,QAAI;AACF,YAAM,SAAS,MAAM,aAAa,QAAQ,aAAa,QAAQ,MAAM,QAAQ,EAAE;AAC/E,UAAI,OAAO,MAAM,WAAW,GAAG;AAC7B,gBAAQ,IAAI,0BAA0B,OAAO,SAAS,QAAQ,OAAO,OAAO,GAAG;AAAA,MACjF,OAAO;AACL,YAAI,WAAW,QAAQ;AACrB,kBAAQ,IAAI,aAAa,QAAQ,MAAM,CAAC;AAAA,QAC1C,OAAO;AACL,kBAAQ,IAAI,gBAAgB,OAAO,SAAS,OAAO,OAAO,OAAO;AAAA,CAAI;AACrE,kBAAQ,IAAI,aAAa,OAAO,OAAO,MAAM,CAAC;AAAA,QAChD;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AACd,cAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;","names":["rollout"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/reports.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport {\n parseMonth,\n isValidReportType,\n isFinancialReportType,\n isStatsReportType,\n} from \"@gpc-cli/core\";\n\nconst FINANCIAL_REPORT_MESSAGE = `Financial reports (earnings, sales, estimated_sales, play_balance) are not available through the Google Play Developer API.\n\nThese reports are delivered as CSV files in Google Cloud Storage buckets.\nTo access them:\n 1. Open Google Play Console → \"Download reports\" → \"Financial\"\n 2. For programmatic access, use the GCS bucket URI shown in Play Console\n with the Google Cloud Storage API or gsutil.\n\nSee: https://support.google.com/googleplay/android-developer/answer/6135870`;\n\nconst STATS_REPORT_MESSAGE = `Stats reports (installs, crashes, ratings, reviews, store_performance, subscriptions) are not available through the Google Play Developer API as downloadable CSVs.\n\nThese reports are delivered as CSV files in Google Cloud Storage buckets.\nTo access them:\n 1. Open Google Play Console → \"Download reports\" → \"Statistics\"\n 2. For programmatic access, use the GCS bucket URI shown in Play Console\n with the Google Cloud Storage API or gsutil.\n\nFor real-time crash and ANR metrics, use:\n gpc vitals crashes\n gpc vitals anr\n gpc vitals overview\n\nSee: https://support.google.com/googleplay/android-developer/answer/6135870`;\n\nexport function registerReportsCommands(program: Command): void {\n const reports = program.command(\"reports\").description(\"Financial and stats reports (via Google Cloud Storage)\");\n\n reports\n .command(\"list <report-type>\")\n .description(\"List available reports\")\n .option(\"--month <YYYY-MM>\", \"Report month (e.g., 2026-03)\")\n .option(\"--limit <n>\", \"Maximum results to return\")\n .option(\"--next-page <token>\", \"Pagination token for next page\")\n .action(async (reportType: string, options) => {\n if (!isValidReportType(reportType)) {\n console.error(\n `Error: Invalid report type \"${reportType}\". Valid types: earnings, sales, estimated_sales, installs, crashes, ratings, reviews, store_performance, subscriptions, play_balance`,\n );\n process.exit(2);\n }\n\n // Validate month format if provided\n if (options.month) {\n parseMonth(options.month);\n }\n\n if (isFinancialReportType(reportType)) {\n console.log(FINANCIAL_REPORT_MESSAGE);\n } else {\n console.log(STATS_REPORT_MESSAGE);\n }\n process.exit(2);\n });\n\n const download = reports.command(\"download\").description(\"Download a report\");\n\n download\n .command(\"financial\")\n .description(\"Download a financial report\")\n .option(\"--month <YYYY-MM>\", \"Report month (e.g., 2026-03)\")\n .option(\"--type <report-type>\", \"Report type\", \"earnings\")\n .option(\"--output-file <path>\", \"Save to file instead of stdout\")\n .action(async (options) => {\n if (options.type && !isFinancialReportType(options.type)) {\n console.error(\n `Error: Invalid financial report type \"${options.type}\". Valid types: earnings, sales, estimated_sales, play_balance`,\n );\n process.exit(2);\n }\n\n console.log(FINANCIAL_REPORT_MESSAGE);\n process.exit(2);\n });\n\n download\n .command(\"stats\")\n .description(\"Download a stats report\")\n .option(\"--month <YYYY-MM>\", \"Report month (e.g., 2026-03)\")\n .option(\n \"--type <report-type>\",\n \"Report type (installs, crashes, ratings, reviews, store_performance, subscriptions)\",\n )\n .option(\"--output-file <path>\", \"Save to file instead of stdout\")\n .action(async (options) => {\n if (options.type && !isStatsReportType(options.type)) {\n console.error(\n `Error: Invalid stats report type \"${options.type}\". Valid types: installs, crashes, ratings, reviews, store_performance, subscriptions`,\n );\n process.exit(2);\n }\n\n console.log(STATS_REPORT_MESSAGE);\n process.exit(2);\n });\n}\n"],"mappings":";;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,IAAM,2BAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUjC,IAAM,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAetB,SAAS,wBAAwB,SAAwB;AAC9D,QAAM,UAAU,QAAQ,QAAQ,SAAS,EAAE,YAAY,wDAAwD;AAE/G,UACG,QAAQ,oBAAoB,EAC5B,YAAY,wBAAwB,EACpC,OAAO,qBAAqB,8BAA8B,EAC1D,OAAO,eAAe,2BAA2B,EACjD,OAAO,uBAAuB,gCAAgC,EAC9D,OAAO,OAAO,YAAoB,YAAY;AAC7C,QAAI,CAAC,kBAAkB,UAAU,GAAG;AAClC,cAAQ;AAAA,QACN,+BAA+B,UAAU;AAAA,MAC3C;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAGA,QAAI,QAAQ,OAAO;AACjB,iBAAW,QAAQ,KAAK;AAAA,IAC1B;AAEA,QAAI,sBAAsB,UAAU,GAAG;AACrC,cAAQ,IAAI,wBAAwB;AAAA,IACtC,OAAO;AACL,cAAQ,IAAI,oBAAoB;AAAA,IAClC;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AAEH,QAAM,WAAW,QAAQ,QAAQ,UAAU,EAAE,YAAY,mBAAmB;AAE5E,WACG,QAAQ,WAAW,EACnB,YAAY,6BAA6B,EACzC,OAAO,qBAAqB,8BAA8B,EAC1D,OAAO,wBAAwB,eAAe,UAAU,EACxD,OAAO,wBAAwB,gCAAgC,EAC/D,OAAO,OAAO,YAAY;AACzB,QAAI,QAAQ,QAAQ,CAAC,sBAAsB,QAAQ,IAAI,GAAG;AACxD,cAAQ;AAAA,QACN,yCAAyC,QAAQ,IAAI;AAAA,MACvD;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,YAAQ,IAAI,wBAAwB;AACpC,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AAEH,WACG,QAAQ,OAAO,EACf,YAAY,yBAAyB,EACrC,OAAO,qBAAqB,8BAA8B,EAC1D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,wBAAwB,gCAAgC,EAC/D,OAAO,OAAO,YAAY;AACzB,QAAI,QAAQ,QAAQ,CAAC,kBAAkB,QAAQ,IAAI,GAAG;AACpD,cAAQ;AAAA,QACN,qCAAqC,QAAQ,IAAI;AAAA,MACnD;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,YAAQ,IAAI,oBAAoB;AAChC,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACL;","names":[]}
|
|
@@ -20,7 +20,9 @@ import {
|
|
|
20
20
|
getReview,
|
|
21
21
|
replyToReview,
|
|
22
22
|
exportReviews,
|
|
23
|
+
analyzeReviews,
|
|
23
24
|
formatOutput,
|
|
25
|
+
maybePaginate,
|
|
24
26
|
sortResults
|
|
25
27
|
} from "@gpc-cli/core";
|
|
26
28
|
function resolvePackageName(packageArg, config) {
|
|
@@ -70,9 +72,9 @@ function registerReviewsCommands(program) {
|
|
|
70
72
|
thumbsUp: userComment?.["thumbsUpCount"] || 0
|
|
71
73
|
};
|
|
72
74
|
});
|
|
73
|
-
|
|
75
|
+
await maybePaginate(formatOutput(rows, format));
|
|
74
76
|
} else {
|
|
75
|
-
|
|
77
|
+
await maybePaginate(formatOutput(sorted, format));
|
|
76
78
|
}
|
|
77
79
|
} catch (error) {
|
|
78
80
|
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -121,12 +123,66 @@ function registerReviewsCommands(program) {
|
|
|
121
123
|
const client = await getClient(config);
|
|
122
124
|
try {
|
|
123
125
|
const result = await replyToReview(client, packageName, reviewId, options.text);
|
|
126
|
+
if (format !== "json") {
|
|
127
|
+
const charCount = options.text.length;
|
|
128
|
+
console.log(`Reply sent (${charCount}/350 chars)`);
|
|
129
|
+
}
|
|
124
130
|
console.log(formatOutput(result, format));
|
|
125
131
|
} catch (error) {
|
|
126
132
|
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
127
133
|
process.exit(4);
|
|
128
134
|
}
|
|
129
135
|
});
|
|
136
|
+
reviews.command("analyze").description("Analyze reviews: sentiment, topics, keywords, rating distribution").option("--stars <n>", "Filter by star rating (1-5)", parseInt).option("--lang <code>", "Filter by reviewer language").option("--since <date>", "Filter reviews after date (ISO 8601)").option("--max <n>", "Maximum number of reviews to analyze", parseInt).action(async (options) => {
|
|
137
|
+
const config = await loadConfig();
|
|
138
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
139
|
+
const client = await getClient(config);
|
|
140
|
+
const format = getOutputFormat(program, config);
|
|
141
|
+
try {
|
|
142
|
+
const result = await analyzeReviews(client, packageName, {
|
|
143
|
+
stars: options.stars,
|
|
144
|
+
language: options.lang,
|
|
145
|
+
since: options.since,
|
|
146
|
+
maxResults: options.max
|
|
147
|
+
});
|
|
148
|
+
if (format === "json") {
|
|
149
|
+
console.log(formatOutput(result, format));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
console.log(`
|
|
153
|
+
Review Analysis \u2014 ${packageName}`);
|
|
154
|
+
console.log(`${"\u2500".repeat(50)}`);
|
|
155
|
+
console.log(`Total reviews: ${result.totalReviews}`);
|
|
156
|
+
console.log(`Average rating: ${result.avgRating > 0 ? result.avgRating.toFixed(2) + " \u2605" : "N/A"}`);
|
|
157
|
+
console.log(`
|
|
158
|
+
Sentiment:`);
|
|
159
|
+
console.log(` Positive: ${result.sentiment.positive} Negative: ${result.sentiment.negative} Neutral: ${result.sentiment.neutral}`);
|
|
160
|
+
console.log(` Avg score: ${result.sentiment.avgScore} (range -1 to +1)`);
|
|
161
|
+
if (result.topics.length > 0) {
|
|
162
|
+
console.log(`
|
|
163
|
+
Top topics:`);
|
|
164
|
+
for (const t of result.topics.slice(0, 8)) {
|
|
165
|
+
const bar = t.avgScore > 0.1 ? "+" : t.avgScore < -0.1 ? "-" : "~";
|
|
166
|
+
console.log(` [${bar}] ${t.topic.padEnd(20)} ${t.count} reviews`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (result.keywords.length > 0) {
|
|
170
|
+
console.log(`
|
|
171
|
+
Top keywords: ${result.keywords.slice(0, 10).map((k) => k.word).join(", ")}`);
|
|
172
|
+
}
|
|
173
|
+
if (Object.keys(result.ratingDistribution).length > 0) {
|
|
174
|
+
console.log(`
|
|
175
|
+
Rating distribution:`);
|
|
176
|
+
for (let star = 5; star >= 1; star--) {
|
|
177
|
+
const count = result.ratingDistribution[star] ?? 0;
|
|
178
|
+
if (count > 0) console.log(` ${star}\u2605 ${count}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
} catch (error) {
|
|
182
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
183
|
+
process.exit(4);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
130
186
|
reviews.command("export").description("Export reviews to JSON or CSV").option("--format <type>", "Output format: json or csv", "json").option("--stars <n>", "Filter by star rating (1-5)", parseInt).option("--lang <code>", "Filter by reviewer language").option("--since <date>", "Filter reviews after date (ISO 8601)").option("--translate-to <lang>", "Translate reviews to language").option("--output <file>", "Write output to file instead of stdout").action(async (options) => {
|
|
131
187
|
const config = await loadConfig();
|
|
132
188
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
@@ -155,4 +211,4 @@ function registerReviewsCommands(program) {
|
|
|
155
211
|
export {
|
|
156
212
|
registerReviewsCommands
|
|
157
213
|
};
|
|
158
|
-
//# sourceMappingURL=reviews-
|
|
214
|
+
//# sourceMappingURL=reviews-NN7YQITF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/reviews.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport type { GpcConfig } from \"@gpc-cli/config\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createApiClient } from \"@gpc-cli/api\";\nimport {\n listReviews,\n getReview,\n replyToReview,\n exportReviews,\n analyzeReviews,\n formatOutput,\n maybePaginate,\n sortResults,\n} from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { isInteractive, requireOption } from \"../prompt.js\";\n\nfunction resolvePackageName(packageArg: string | undefined, config: GpcConfig): string {\n const name = packageArg || config.app;\n if (!name) {\n console.error(\"Error: No package name. Use --app <package> or gpc config set app <package>\");\n process.exit(2);\n }\n return name;\n}\n\nasync function getClient(config: GpcConfig) {\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n return createApiClient({ auth });\n}\n\nexport function registerReviewsCommands(program: Command): void {\n const reviews = program.command(\"reviews\").description(\"Manage user reviews and ratings\");\n\n reviews\n .command(\"list\")\n .description(\"List user reviews\")\n .option(\"--stars <n>\", \"Filter by star rating (1-5)\", parseInt)\n .option(\"--lang <code>\", \"Filter by reviewer language\")\n .option(\"--since <date>\", \"Filter reviews after date (ISO 8601)\")\n .option(\"--translate-to <lang>\", \"Translate reviews to language\")\n .option(\"--max <n>\", \"Maximum number of reviews per page\", parseInt)\n .option(\"--limit <n>\", \"Maximum total results\", parseInt)\n .option(\"--next-page <token>\", \"Resume from page token\")\n .option(\"--sort <field>\", \"Sort by field (prefix with - for descending)\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n try {\n const result = await listReviews(client, packageName, {\n stars: options.stars,\n language: options.lang,\n since: options.since,\n translationLanguage: options.translateTo,\n maxResults: options.max,\n limit: options.limit,\n nextPage: options.nextPage,\n });\n if (Array.isArray(result) && result.length === 0 && format !== \"json\") {\n console.log(\"No reviews found.\");\n return;\n }\n const sorted = sortResults(result, options.sort);\n if (format !== \"json\" && Array.isArray(sorted)) {\n const rows = sorted.map((r: Record<string, unknown>) => {\n const comments = r[\"comments\"] as Record<string, unknown>[] | undefined;\n const userComment = comments?.[0]?.[\"userComment\"] as Record<string, unknown> | undefined;\n return {\n reviewId: r[\"reviewId\"] || \"-\",\n author: r[\"authorName\"] || \"-\",\n stars: userComment?.[\"starRating\"] || \"-\",\n text: String(userComment?.[\"text\"] || \"-\").slice(0, 80),\n lastModified: userComment?.[\"lastModified\"]\n ? String((userComment[\"lastModified\"] as Record<string, unknown>)?.[\"seconds\"] || \"-\")\n : \"-\",\n thumbsUp: userComment?.[\"thumbsUpCount\"] || 0,\n };\n });\n await maybePaginate(formatOutput(rows, format));\n } else {\n await maybePaginate(formatOutput(sorted, format));\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n reviews\n .command(\"get <review-id>\")\n .description(\"Get a single review\")\n .option(\"--translate-to <lang>\", \"Translate review to language\")\n .action(async (reviewId: string, options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n try {\n const result = await getReview(client, packageName, reviewId, options.translateTo);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n reviews\n .command(\"reply <review-id>\")\n .description(\"Reply to a review\")\n .option(\"--text <text>\", \"Reply text (max 350 chars)\")\n .action(async (reviewId: string, options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n const interactive = isInteractive(program);\n\n options.text = await requireOption(\n \"text\",\n options.text,\n {\n message: \"Reply text (max 350 chars):\",\n },\n interactive,\n );\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"reviews reply\",\n action: \"reply to\",\n target: reviewId,\n details: { text: options.text },\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const result = await replyToReview(client, packageName, reviewId, options.text);\n if (format !== \"json\") {\n const charCount = options.text.length;\n console.log(`Reply sent (${charCount}/350 chars)`);\n }\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n reviews\n .command(\"analyze\")\n .description(\"Analyze reviews: sentiment, topics, keywords, rating distribution\")\n .option(\"--stars <n>\", \"Filter by star rating (1-5)\", parseInt)\n .option(\"--lang <code>\", \"Filter by reviewer language\")\n .option(\"--since <date>\", \"Filter reviews after date (ISO 8601)\")\n .option(\"--max <n>\", \"Maximum number of reviews to analyze\", parseInt)\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n try {\n const result = await analyzeReviews(client, packageName, {\n stars: options.stars,\n language: options.lang,\n since: options.since,\n maxResults: options.max,\n });\n\n if (format === \"json\") {\n console.log(formatOutput(result, format));\n return;\n }\n\n console.log(`\\nReview Analysis — ${packageName}`);\n console.log(`${\"─\".repeat(50)}`);\n console.log(`Total reviews: ${result.totalReviews}`);\n console.log(`Average rating: ${result.avgRating > 0 ? result.avgRating.toFixed(2) + \" ★\" : \"N/A\"}`);\n console.log(`\\nSentiment:`);\n console.log(` Positive: ${result.sentiment.positive} Negative: ${result.sentiment.negative} Neutral: ${result.sentiment.neutral}`);\n console.log(` Avg score: ${result.sentiment.avgScore} (range -1 to +1)`);\n\n if (result.topics.length > 0) {\n console.log(`\\nTop topics:`);\n for (const t of result.topics.slice(0, 8)) {\n const bar = t.avgScore > 0.1 ? \"+\" : t.avgScore < -0.1 ? \"-\" : \"~\";\n console.log(` [${bar}] ${t.topic.padEnd(20)} ${t.count} reviews`);\n }\n }\n\n if (result.keywords.length > 0) {\n console.log(`\\nTop keywords: ${result.keywords.slice(0, 10).map((k) => k.word).join(\", \")}`);\n }\n\n if (Object.keys(result.ratingDistribution).length > 0) {\n console.log(`\\nRating distribution:`);\n for (let star = 5; star >= 1; star--) {\n const count = result.ratingDistribution[star] ?? 0;\n if (count > 0) console.log(` ${star}★ ${count}`);\n }\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n reviews\n .command(\"export\")\n .description(\"Export reviews to JSON or CSV\")\n .option(\"--format <type>\", \"Output format: json or csv\", \"json\")\n .option(\"--stars <n>\", \"Filter by star rating (1-5)\", parseInt)\n .option(\"--lang <code>\", \"Filter by reviewer language\")\n .option(\"--since <date>\", \"Filter reviews after date (ISO 8601)\")\n .option(\"--translate-to <lang>\", \"Translate reviews to language\")\n .option(\"--output <file>\", \"Write output to file instead of stdout\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n\n try {\n const result = await exportReviews(client, packageName, {\n format: options.format as \"json\" | \"csv\",\n stars: options.stars,\n language: options.lang,\n since: options.since,\n translationLanguage: options.translateTo,\n });\n\n if (options.output) {\n const { writeFile } = await import(\"node:fs/promises\");\n await writeFile(options.output, result, \"utf-8\");\n console.log(`Reviews exported to ${options.output}`);\n } else {\n console.log(result);\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,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Ac,QAAQ,aAAa;AAAA,QACtD,QAAQ,QAAQ;AAAA,QAChB,OAAO,QAAQ;AAAA,QACf,UAAU,QAAQ;AAAA,QAClB,OAAO,QAAQ;AAAA,QACf,qBAAqB,QAAQ;AAAA,MAC/B,CAAC;AAED,UAAI,QAAQ,QAAQ;AAClB,cAAM,EAAE,UAAU,IAAI,MAAM,OAAO,aAAkB;AACrD,cAAM,UAAU,QAAQ,QAAQ,QAAQ,OAAO;AAC/C,gBAAQ,IAAI,uBAAuB,QAAQ,MAAM,EAAE;AAAA,MACrD,OAAO;AACL,gBAAQ,IAAI,MAAM;AAAA,MACpB;AAAA,IACF,SAAS,OAAO;AACd,cAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;","names":[]}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
dim,
|
|
4
|
+
gray,
|
|
5
|
+
green,
|
|
6
|
+
red
|
|
7
|
+
} from "./chunk-7BXCQKJG.js";
|
|
2
8
|
import {
|
|
3
9
|
getOutputFormat
|
|
4
10
|
} from "./chunk-ELXAK7GI.js";
|
|
@@ -19,7 +25,8 @@ import {
|
|
|
19
25
|
runWatchLoop,
|
|
20
26
|
trackBreachState,
|
|
21
27
|
sendNotification,
|
|
22
|
-
formatOutput
|
|
28
|
+
formatOutput,
|
|
29
|
+
createSpinner
|
|
23
30
|
} from "@gpc-cli/core";
|
|
24
31
|
var VALID_SECTIONS = /* @__PURE__ */ new Set(["releases", "vitals", "reviews"]);
|
|
25
32
|
var VALID_FORMATS = /* @__PURE__ */ new Set(["table", "summary"]);
|
|
@@ -72,6 +79,29 @@ function resolveWatchInterval(watch) {
|
|
|
72
79
|
const n = parseInt(String(watch), 10);
|
|
73
80
|
return isNaN(n) ? 30 : n;
|
|
74
81
|
}
|
|
82
|
+
function colorizeTrackStatus(s) {
|
|
83
|
+
switch (s) {
|
|
84
|
+
case "inProgress":
|
|
85
|
+
case "completed":
|
|
86
|
+
return green(s);
|
|
87
|
+
case "halted":
|
|
88
|
+
return red(s);
|
|
89
|
+
case "draft":
|
|
90
|
+
return dim(s);
|
|
91
|
+
default:
|
|
92
|
+
return gray(s);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function applyStatusColors(status) {
|
|
96
|
+
if (!status.releases || status.releases.length === 0) return status;
|
|
97
|
+
return {
|
|
98
|
+
...status,
|
|
99
|
+
releases: status.releases.map((r) => ({
|
|
100
|
+
...r,
|
|
101
|
+
status: colorizeTrackStatus(r.status)
|
|
102
|
+
}))
|
|
103
|
+
};
|
|
104
|
+
}
|
|
75
105
|
function makeRenderer(format, displayFormat) {
|
|
76
106
|
return (status) => {
|
|
77
107
|
if (format === "json") {
|
|
@@ -87,8 +117,9 @@ function makeRenderer(format, displayFormat) {
|
|
|
87
117
|
if (sectionSet.has("reviews")) filtered["reviews"] = status.reviews;
|
|
88
118
|
return formatOutput(filtered, "json");
|
|
89
119
|
}
|
|
90
|
-
|
|
91
|
-
return
|
|
120
|
+
const colorized = applyStatusColors(status);
|
|
121
|
+
if (displayFormat === "summary") return formatStatusSummary(colorized);
|
|
122
|
+
return formatStatusTable(colorized);
|
|
92
123
|
};
|
|
93
124
|
}
|
|
94
125
|
function registerStatusCommand(program) {
|
|
@@ -211,7 +242,16 @@ async function runStatusForPackage(ctx) {
|
|
|
211
242
|
return statusHasBreach(cached);
|
|
212
243
|
}
|
|
213
244
|
}
|
|
214
|
-
const
|
|
245
|
+
const spinner = createSpinner("Fetching app status...");
|
|
246
|
+
if (ctx.format !== "json") spinner.start();
|
|
247
|
+
let status;
|
|
248
|
+
try {
|
|
249
|
+
status = await fetchLive();
|
|
250
|
+
} catch (err) {
|
|
251
|
+
spinner.fail("Failed to fetch app status");
|
|
252
|
+
throw err;
|
|
253
|
+
}
|
|
254
|
+
spinner.stop("Done");
|
|
215
255
|
await save(status);
|
|
216
256
|
printWithDiff(status, prevStatus, opts.sinceLast, render, ctx.format);
|
|
217
257
|
await handleNotify(packageName, status, opts.notify);
|
|
@@ -249,4 +289,4 @@ async function handleNotify(packageName, status, notify) {
|
|
|
249
289
|
export {
|
|
250
290
|
registerStatusCommand
|
|
251
291
|
};
|
|
252
|
-
//# sourceMappingURL=status-
|
|
292
|
+
//# sourceMappingURL=status-L5S2FGZ4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/status.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createApiClient, createReportingClient } from \"@gpc-cli/api\";\nimport {\n getAppStatus,\n formatStatusTable,\n formatStatusSummary,\n formatStatusDiff,\n computeStatusDiff,\n loadStatusCache,\n saveStatusCache,\n statusHasBreach,\n runWatchLoop,\n trackBreachState,\n sendNotification,\n formatOutput,\n createSpinner,\n} from \"@gpc-cli/core\";\nimport type { AppStatus } from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\nimport { green, red, dim, gray } from \"../colors.js\";\n\nconst VALID_SECTIONS = new Set([\"releases\", \"vitals\", \"reviews\"]);\nconst VALID_FORMATS = new Set([\"table\", \"summary\"]);\n\nfunction parseSections(raw: string): string[] {\n const sections = raw.split(\",\").map((s) => s.trim().toLowerCase());\n for (const s of sections) {\n if (!VALID_SECTIONS.has(s)) {\n console.error(`Error: Unknown section \"${s}\". Valid sections: releases, vitals, reviews`);\n process.exit(2);\n }\n }\n return sections;\n}\n\nfunction resolveVitalThresholds(config: Record<string, unknown>) {\n const vitals = config[\"vitals\"] as Record<string, unknown> | undefined;\n const t = vitals?.[\"thresholds\"] as Record<string, unknown> | undefined;\n if (!t) return undefined;\n const toN = (v: unknown): number | undefined => {\n if (v === undefined || v === null) return undefined;\n const n = Number(v);\n return isNaN(n) ? undefined : n;\n };\n return {\n crashRate: toN(t[\"crashRate\"]),\n anrRate: toN(t[\"anrRate\"]),\n slowStartRate: toN(t[\"slowStartRate\"]),\n slowRenderingRate: toN(t[\"slowRenderingRate\"]),\n };\n}\n\nfunction resolvePackages(\n program: Command,\n config: { app?: string; profiles?: Record<string, { app?: string }> },\n allApps?: boolean,\n): string[] {\n const rootApp = (program.opts()[\"app\"] || config.app) as string | undefined;\n if (!allApps) return rootApp ? [rootApp] : [];\n\n const seen = new Set<string>();\n const result: string[] = [];\n if (rootApp) {\n seen.add(rootApp);\n result.push(rootApp);\n }\n for (const profile of Object.values(config.profiles ?? {})) {\n if (profile.app && !seen.has(profile.app)) {\n seen.add(profile.app);\n result.push(profile.app);\n }\n }\n return result;\n}\n\nfunction resolveWatchInterval(watch: string | boolean | undefined): number | null {\n if (watch === undefined) return null;\n if (watch === true || watch === \"\") return 30;\n const n = parseInt(String(watch), 10);\n return isNaN(n) ? 30 : n;\n}\n\nfunction colorizeTrackStatus(s: string): string {\n switch (s) {\n case \"inProgress\":\n case \"completed\":\n return green(s);\n case \"halted\":\n return red(s);\n case \"draft\":\n return dim(s);\n default:\n return gray(s);\n }\n}\n\nfunction applyStatusColors(status: AppStatus): AppStatus {\n if (!status.releases || status.releases.length === 0) return status;\n return {\n ...status,\n releases: status.releases.map((r) => ({\n ...r,\n status: colorizeTrackStatus(r.status),\n })),\n };\n}\n\nfunction makeRenderer(\n format: string,\n displayFormat: string,\n): (status: AppStatus) => string {\n return (status: AppStatus): string => {\n if (format === \"json\") {\n const sectionSet = new Set(status.sections);\n const filtered: Record<string, unknown> = {\n packageName: status.packageName,\n fetchedAt: status.fetchedAt,\n cached: status.cached,\n sections: status.sections,\n };\n if (sectionSet.has(\"releases\")) filtered[\"releases\"] = status.releases;\n if (sectionSet.has(\"vitals\")) filtered[\"vitals\"] = status.vitals;\n if (sectionSet.has(\"reviews\")) filtered[\"reviews\"] = status.reviews;\n return formatOutput(filtered, \"json\");\n }\n const colorized = applyStatusColors(status);\n if (displayFormat === \"summary\") return formatStatusSummary(colorized);\n return formatStatusTable(colorized);\n };\n}\n\nexport function registerStatusCommand(program: Command): void {\n program\n .command(\"status\")\n .description(\"Unified app health snapshot: releases, vitals, and reviews\")\n .option(\"--days <n>\", \"Vitals window in days\", (v) => parseInt(v, 10), 7)\n .option(\"--cached\", \"Use last fetched data, skip API calls\")\n .option(\"--refresh\", \"Force live fetch, ignore cache TTL\")\n .option(\"--ttl <seconds>\", \"Cache TTL in seconds\", (v) => parseInt(v, 10), 3600)\n .option(\"--format <fmt>\", \"Display style: table (default) or summary\", \"table\")\n .option(\n \"--sections <list>\",\n \"Comma-separated sections: releases,vitals,reviews\",\n \"releases,vitals,reviews\",\n )\n .option(\"--watch [seconds]\", \"Poll every N seconds (min 10, default 30)\")\n .option(\"--since-last\", \"Show diff from last cached status\")\n .option(\"--all-apps\", \"Run status for all configured app profiles (max 5)\")\n .option(\"--notify\", \"Send desktop notification on threshold breach or clear\")\n .action(\n async (opts: {\n days: number;\n cached?: boolean;\n refresh?: boolean;\n ttl: number;\n format: string;\n sections: string;\n watch?: string | boolean;\n sinceLast?: boolean;\n allApps?: boolean;\n notify?: boolean;\n }) => {\n if (!VALID_FORMATS.has(opts.format)) {\n console.error(`Error: Unknown format \"${opts.format}\". Valid: table, summary`);\n process.exit(2);\n }\n\n const sections = parseSections(opts.sections);\n\n if (!Number.isFinite(opts.days) || opts.days < 1) {\n console.error(`Error: --days must be a positive integer (got: ${opts.days})`);\n process.exit(2);\n }\n\n const config = await loadConfig();\n const format = getOutputFormat(program, config);\n const render = makeRenderer(format, opts.format);\n const vitalThresholds = resolveVitalThresholds(\n config as unknown as Record<string, unknown>,\n );\n const watchInterval = resolveWatchInterval(opts.watch);\n const packages = resolvePackages(program, config, opts.allApps);\n\n if (packages.length === 0) {\n console.error(\n \"Error: No package name. Use --app <package> or gpc config set app <package>\",\n );\n process.exit(2);\n }\n if (opts.allApps && packages.length > 5) {\n console.error(\n `Error: --all-apps found ${packages.length} apps (max 5). Use --app to target a specific app.`,\n );\n process.exit(2);\n }\n\n const authConfig = (config as unknown as Record<string, unknown>)[\"auth\"] as\n | Record<string, string>\n | undefined;\n\n const makeClients = async () => {\n const auth = await resolveAuth({ serviceAccountPath: authConfig?.[\"serviceAccount\"] });\n return {\n client: createApiClient({ auth }),\n reporting: createReportingClient({ auth }),\n };\n };\n\n let anyBreach = false;\n\n for (const packageName of packages) {\n if (packages.length > 1) console.log(`\\n=== ${packageName} ===`);\n\n try {\n const breach = await runStatusForPackage({\n packageName,\n opts,\n sections,\n format,\n vitalThresholds,\n watchInterval,\n render,\n makeClients,\n });\n if (breach) anyBreach = true;\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n if (packages.length === 1) process.exit(4);\n // For --all-apps, continue to next app on error\n }\n }\n\n if (anyBreach) process.exit(6);\n },\n );\n}\n\ninterface RunCtx {\n packageName: string;\n opts: {\n days: number;\n cached?: boolean;\n refresh?: boolean;\n ttl: number;\n sinceLast?: boolean;\n notify?: boolean;\n };\n sections: string[];\n format: string;\n vitalThresholds:\n | {\n crashRate?: number;\n anrRate?: number;\n slowStartRate?: number;\n slowRenderingRate?: number;\n }\n | undefined;\n watchInterval: number | null;\n render: (status: AppStatus) => string;\n makeClients: () => Promise<{\n client: ReturnType<typeof createApiClient>;\n reporting: ReturnType<typeof createReportingClient>;\n }>;\n}\n\n/** Override sections on a cached AppStatus with the user-requested sections for display. */\nfunction applyDisplaySections(status: AppStatus, requestedSections: string[]): AppStatus {\n const requested = new Set(requestedSections);\n const filtered = status.sections.filter((s) => requested.has(s));\n if (filtered.length === status.sections.length) return status;\n return { ...status, sections: filtered };\n}\n\n/** Returns true if a breach was detected. */\nasync function runStatusForPackage(ctx: RunCtx): Promise<boolean> {\n const { packageName, opts, sections, vitalThresholds, watchInterval, render } = ctx;\n\n const fetchLive = async (): Promise<AppStatus> => {\n const { client, reporting } = await ctx.makeClients();\n return getAppStatus(client, reporting, packageName, {\n days: opts.days,\n sections,\n vitalThresholds: vitalThresholds ?? undefined,\n });\n };\n\n const save = (status: AppStatus) => saveStatusCache(packageName, status, opts.ttl);\n\n if (watchInterval !== null && opts.sinceLast) {\n process.stderr.write(\"Warning: --since-last is not supported with --watch and will be ignored.\\n\");\n }\n\n // --watch: hand off entirely to runWatchLoop\n if (watchInterval !== null) {\n await runWatchLoop({ intervalSeconds: watchInterval, render, fetch: fetchLive, save });\n return false;\n }\n\n // --cached: serve from cache only\n if (opts.cached) {\n const cached = await loadStatusCache(packageName, opts.ttl);\n if (!cached) {\n console.error(\"Error: No cached status found. Run without --cached to fetch live data.\");\n process.exit(1);\n }\n const display = applyDisplaySections(cached, sections);\n console.log(render(display));\n await handleNotify(packageName, cached, opts.notify);\n return statusHasBreach(cached);\n }\n\n // Capture prev status before fetching (for --since-last)\n const prevStatus = opts.sinceLast ? await loadStatusCache(packageName, Infinity) : null;\n\n // Try cache (unless --refresh)\n if (!opts.refresh) {\n const cached = await loadStatusCache(packageName, opts.ttl);\n if (cached) {\n const display = applyDisplaySections(cached, sections);\n if (ctx.format !== \"json\" && display.sections.length < cached.sections.length) {\n process.stderr.write(\n `Tip: cache contains all sections. Add --refresh to fetch only the requested sections and reduce API calls.\\n`,\n );\n }\n printWithDiff(display, prevStatus, opts.sinceLast, render, ctx.format);\n await handleNotify(packageName, cached, opts.notify);\n return statusHasBreach(cached);\n }\n }\n\n // Live fetch (with spinner in TTY mode)\n const spinner = createSpinner(\"Fetching app status...\");\n if (ctx.format !== \"json\") spinner.start();\n let status: AppStatus;\n try {\n status = await fetchLive();\n } catch (err) {\n spinner.fail(\"Failed to fetch app status\");\n throw err;\n }\n spinner.stop(\"Done\");\n await save(status);\n\n printWithDiff(status, prevStatus, opts.sinceLast, render, ctx.format);\n await handleNotify(packageName, status, opts.notify);\n return statusHasBreach(status);\n}\n\nfunction relativeTime(isoString: string): string {\n const diffMs = Date.now() - new Date(isoString).getTime();\n const diffMin = Math.floor(diffMs / 60000);\n if (diffMin < 1) return \"just now\";\n if (diffMin < 60) return `${diffMin} min ago`;\n const diffHr = Math.floor(diffMin / 60);\n if (diffHr < 24) return `${diffHr}h ago`;\n return `${Math.floor(diffHr / 24)}d ago`;\n}\n\nfunction printWithDiff(\n status: AppStatus,\n prevStatus: AppStatus | null,\n sinceLast: boolean | undefined,\n render: (s: AppStatus) => string,\n format: string,\n): void {\n console.log(render(status));\n\n if (sinceLast && prevStatus) {\n const since = relativeTime(prevStatus.fetchedAt);\n console.log(\"\");\n console.log(formatStatusDiff(computeStatusDiff(prevStatus, status), since));\n } else if (sinceLast && !prevStatus && format !== \"json\") {\n console.log(\"\\n(No prior cached status to diff against)\");\n }\n}\n\nasync function handleNotify(\n packageName: string,\n status: AppStatus,\n notify: boolean | undefined,\n): Promise<void> {\n if (!notify) return;\n const breaching = statusHasBreach(status);\n const changed = await trackBreachState(packageName, breaching);\n if (changed) {\n const title = breaching ? \"GPC Alert\" : \"GPC Status\";\n const body = breaching\n ? `${packageName}: vitals threshold breached`\n : `${packageName}: vitals back to normal`;\n sendNotification(title, body);\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB,6BAA6B;AACvD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKP,IAAM,iBAAiB,oBAAI,IAAI,CAAC,YAAY,UAAU,SAAS,CAAC;AAChE,IAAM,gBAAgB,oBAAI,IAAI,CAAC,SAAS,SAAS,CAAC;AAElD,SAAS,cAAc,KAAuB;AAC5C,QAAM,WAAW,IAAI,MAAM,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC;AACjE,aAAW,KAAK,UAAU;AACxB,QAAI,CAAC,eAAe,IAAI,CAAC,GAAG;A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AAG,WAAW;AAClB,qBAAiB,OAAO,IAAI;AAAA,EAC9B;AACF;","names":["status"]}
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
activateOffer,
|
|
37
37
|
deactivateOffer,
|
|
38
38
|
diffSubscription,
|
|
39
|
+
getSubscriptionAnalytics,
|
|
39
40
|
formatOutput,
|
|
40
41
|
sortResults
|
|
41
42
|
} from "@gpc-cli/core";
|
|
@@ -523,8 +524,38 @@ function registerSubscriptionsCommands(program) {
|
|
|
523
524
|
process.exit(4);
|
|
524
525
|
}
|
|
525
526
|
});
|
|
527
|
+
subs.command("analytics").description("Subscription catalog analytics: active plans, offer counts, state breakdown").action(async () => {
|
|
528
|
+
const config = await loadConfig();
|
|
529
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
530
|
+
const client = await getClient(config);
|
|
531
|
+
const format = getOutputFormat(program, config);
|
|
532
|
+
try {
|
|
533
|
+
const result = await getSubscriptionAnalytics(client, packageName);
|
|
534
|
+
if (format === "json") {
|
|
535
|
+
console.log(formatOutput(result, format));
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
console.log(`
|
|
539
|
+
Subscription Analytics \u2014 ${packageName}`);
|
|
540
|
+
console.log(`${"\u2500".repeat(50)}`);
|
|
541
|
+
console.log(`Total subscriptions: ${result.totalSubscriptions}`);
|
|
542
|
+
console.log(`Active subscriptions: ${result.activeCount}`);
|
|
543
|
+
console.log(`Active base plans: ${result.activeBasePlans}`);
|
|
544
|
+
console.log(`Draft base plans: ${result.trialBasePlans}`);
|
|
545
|
+
console.log(`Inactive base plans: ${result.pausedBasePlans}`);
|
|
546
|
+
console.log(`Total offers: ${result.offerCount}`);
|
|
547
|
+
if (result.byProductId.length > 0) {
|
|
548
|
+
console.log(`
|
|
549
|
+
By product:`);
|
|
550
|
+
console.log(formatOutput(result.byProductId, format));
|
|
551
|
+
}
|
|
552
|
+
} catch (error) {
|
|
553
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
554
|
+
process.exit(4);
|
|
555
|
+
}
|
|
556
|
+
});
|
|
526
557
|
}
|
|
527
558
|
export {
|
|
528
559
|
registerSubscriptionsCommands
|
|
529
560
|
};
|
|
530
|
-
//# sourceMappingURL=subscriptions-
|
|
561
|
+
//# sourceMappingURL=subscriptions-OXAE7SNS.js.map
|