@gpc-cli/cli 0.9.9 → 0.9.10
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/bin.js +1 -1
- package/dist/{chunk-ZXEA4KAA.js → chunk-ENBQPSKO.js} +5 -5
- package/dist/doctor-7IO43Y4R.js +236 -0
- package/dist/doctor-7IO43Y4R.js.map +1 -0
- package/dist/{external-transactions-YRK5CI2D.js → external-transactions-5U3PMAAG.js} +2 -2
- package/dist/external-transactions-5U3PMAAG.js.map +1 -0
- package/dist/{generated-apks-SUPM3NS3.js → generated-apks-HF7VYA54.js} +2 -2
- package/dist/generated-apks-HF7VYA54.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/{internal-sharing-TWMHLQLN.js → internal-sharing-FEZFTPWE.js} +2 -2
- package/dist/internal-sharing-FEZFTPWE.js.map +1 -0
- package/package.json +3 -3
- package/dist/doctor-KVP7PGZU.js +0 -61
- package/dist/doctor-KVP7PGZU.js.map +0 -1
- package/dist/external-transactions-YRK5CI2D.js.map +0 -1
- package/dist/generated-apks-SUPM3NS3.js.map +0 -1
- package/dist/internal-sharing-TWMHLQLN.js.map +0 -1
- /package/dist/{chunk-ZXEA4KAA.js.map → chunk-ENBQPSKO.js.map} +0 -0
package/dist/bin.js
CHANGED
|
@@ -76,7 +76,7 @@ async function createProgram(pluginManager) {
|
|
|
76
76
|
(await import("./config-VLIIRPDQ.js")).registerConfigCommands(program);
|
|
77
77
|
},
|
|
78
78
|
doctor: async () => {
|
|
79
|
-
(await import("./doctor-
|
|
79
|
+
(await import("./doctor-7IO43Y4R.js")).registerDoctorCommand(program);
|
|
80
80
|
},
|
|
81
81
|
docs: async () => {
|
|
82
82
|
(await import("./docs-CVTWIVMS.js")).registerDocsCommand(program);
|
|
@@ -139,7 +139,7 @@ async function createProgram(pluginManager) {
|
|
|
139
139
|
(await import("./data-safety-M2SFKQ3U.js")).registerDataSafetyCommands(program);
|
|
140
140
|
},
|
|
141
141
|
"external-transactions": async () => {
|
|
142
|
-
(await import("./external-transactions-
|
|
142
|
+
(await import("./external-transactions-5U3PMAAG.js")).registerExternalTransactionsCommands(
|
|
143
143
|
program
|
|
144
144
|
);
|
|
145
145
|
},
|
|
@@ -150,10 +150,10 @@ async function createProgram(pluginManager) {
|
|
|
150
150
|
(await import("./one-time-products-BHE6WPZI.js")).registerOneTimeProductsCommands(program);
|
|
151
151
|
},
|
|
152
152
|
"internal-sharing": async () => {
|
|
153
|
-
(await import("./internal-sharing-
|
|
153
|
+
(await import("./internal-sharing-FEZFTPWE.js")).registerInternalSharingCommands(program);
|
|
154
154
|
},
|
|
155
155
|
"generated-apks": async () => {
|
|
156
|
-
(await import("./generated-apks-
|
|
156
|
+
(await import("./generated-apks-HF7VYA54.js")).registerGeneratedApksCommands(program);
|
|
157
157
|
},
|
|
158
158
|
"purchase-options": async () => {
|
|
159
159
|
(await import("./purchase-options-2NUBLODI.js")).registerPurchaseOptionsCommands(program);
|
|
@@ -299,4 +299,4 @@ export {
|
|
|
299
299
|
createProgram,
|
|
300
300
|
handleCliError
|
|
301
301
|
};
|
|
302
|
-
//# sourceMappingURL=chunk-
|
|
302
|
+
//# sourceMappingURL=chunk-ENBQPSKO.js.map
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/commands/doctor.ts
|
|
4
|
+
import { loadConfig, getCacheDir, getConfigDir } from "@gpc-cli/config";
|
|
5
|
+
import { resolveAuth, AuthError } from "@gpc-cli/auth";
|
|
6
|
+
import { existsSync, accessSync, constants } from "fs";
|
|
7
|
+
import { lookup } from "dns/promises";
|
|
8
|
+
var PASS = "\u2713";
|
|
9
|
+
var FAIL = "\u2717";
|
|
10
|
+
var WARN = "\u26A0";
|
|
11
|
+
var INFO = "-";
|
|
12
|
+
function icon(status) {
|
|
13
|
+
switch (status) {
|
|
14
|
+
case "pass":
|
|
15
|
+
return PASS;
|
|
16
|
+
case "fail":
|
|
17
|
+
return FAIL;
|
|
18
|
+
case "warn":
|
|
19
|
+
return WARN;
|
|
20
|
+
case "info":
|
|
21
|
+
return INFO;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function registerDoctorCommand(program) {
|
|
25
|
+
program.command("doctor").description("Verify setup and connectivity").option("--json", "Output results as JSON").action(async (opts) => {
|
|
26
|
+
const results = [];
|
|
27
|
+
const jsonMode = opts.json ?? false;
|
|
28
|
+
const nodeVersion = process.versions.node;
|
|
29
|
+
const major = parseInt(nodeVersion.split(".")[0] ?? "0", 10);
|
|
30
|
+
results.push(
|
|
31
|
+
major >= 20 ? { name: "node", status: "pass", message: `Node.js ${nodeVersion}` } : {
|
|
32
|
+
name: "node",
|
|
33
|
+
status: "fail",
|
|
34
|
+
message: `Node.js ${nodeVersion} (requires >=20)`,
|
|
35
|
+
suggestion: "Upgrade Node.js to v20 or later: https://nodejs.org"
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
let config;
|
|
39
|
+
try {
|
|
40
|
+
config = await loadConfig();
|
|
41
|
+
results.push({ name: "config", status: "pass", message: "Configuration loaded" });
|
|
42
|
+
if (config.app) {
|
|
43
|
+
results.push({
|
|
44
|
+
name: "default-app",
|
|
45
|
+
status: "pass",
|
|
46
|
+
message: `Default app: ${config.app}`
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
results.push({
|
|
50
|
+
name: "default-app",
|
|
51
|
+
status: "info",
|
|
52
|
+
message: "No default app configured",
|
|
53
|
+
suggestion: "Use --app flag or run: gpc config set app <package>"
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
} catch {
|
|
57
|
+
results.push({
|
|
58
|
+
name: "config",
|
|
59
|
+
status: "fail",
|
|
60
|
+
message: "Configuration error",
|
|
61
|
+
suggestion: "Check your .gpcrc.json or config file for syntax errors"
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const configDir = getConfigDir();
|
|
65
|
+
try {
|
|
66
|
+
if (existsSync(configDir)) {
|
|
67
|
+
accessSync(configDir, constants.R_OK | constants.W_OK);
|
|
68
|
+
results.push({
|
|
69
|
+
name: "config-dir",
|
|
70
|
+
status: "pass",
|
|
71
|
+
message: `Config directory: ${configDir}`
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
results.push({
|
|
75
|
+
name: "config-dir",
|
|
76
|
+
status: "info",
|
|
77
|
+
message: `Config directory does not exist yet: ${configDir}`
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
} catch {
|
|
81
|
+
results.push({
|
|
82
|
+
name: "config-dir",
|
|
83
|
+
status: "warn",
|
|
84
|
+
message: `Config directory not writable: ${configDir}`,
|
|
85
|
+
suggestion: `Fix permissions: chmod 755 ${configDir}`
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const cacheDir = getCacheDir();
|
|
89
|
+
try {
|
|
90
|
+
if (existsSync(cacheDir)) {
|
|
91
|
+
accessSync(cacheDir, constants.R_OK | constants.W_OK);
|
|
92
|
+
results.push({
|
|
93
|
+
name: "cache-dir",
|
|
94
|
+
status: "pass",
|
|
95
|
+
message: `Cache directory: ${cacheDir}`
|
|
96
|
+
});
|
|
97
|
+
} else {
|
|
98
|
+
results.push({
|
|
99
|
+
name: "cache-dir",
|
|
100
|
+
status: "info",
|
|
101
|
+
message: `Cache directory does not exist yet: ${cacheDir}`
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
} catch {
|
|
105
|
+
results.push({
|
|
106
|
+
name: "cache-dir",
|
|
107
|
+
status: "warn",
|
|
108
|
+
message: `Cache directory not writable: ${cacheDir}`,
|
|
109
|
+
suggestion: `Fix permissions: chmod 700 ${cacheDir}`
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
const proxyUrl = process.env["HTTPS_PROXY"] || process.env["https_proxy"] || process.env["HTTP_PROXY"] || process.env["http_proxy"];
|
|
113
|
+
if (proxyUrl) {
|
|
114
|
+
try {
|
|
115
|
+
new URL(proxyUrl);
|
|
116
|
+
results.push({
|
|
117
|
+
name: "proxy",
|
|
118
|
+
status: "pass",
|
|
119
|
+
message: `Proxy configured: ${proxyUrl}`
|
|
120
|
+
});
|
|
121
|
+
} catch {
|
|
122
|
+
results.push({
|
|
123
|
+
name: "proxy",
|
|
124
|
+
status: "warn",
|
|
125
|
+
message: `Invalid proxy URL: ${proxyUrl}`,
|
|
126
|
+
suggestion: "Set HTTPS_PROXY to a valid URL (e.g., http://proxy.example.com:8080)"
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const caCert = process.env["GPC_CA_CERT"] || process.env["NODE_EXTRA_CA_CERTS"];
|
|
131
|
+
if (caCert) {
|
|
132
|
+
if (existsSync(caCert)) {
|
|
133
|
+
results.push({
|
|
134
|
+
name: "ca-cert",
|
|
135
|
+
status: "pass",
|
|
136
|
+
message: `CA certificate: ${caCert}`
|
|
137
|
+
});
|
|
138
|
+
} else {
|
|
139
|
+
results.push({
|
|
140
|
+
name: "ca-cert",
|
|
141
|
+
status: "warn",
|
|
142
|
+
message: `CA certificate file not found: ${caCert}`,
|
|
143
|
+
suggestion: "Check that GPC_CA_CERT points to an existing PEM file"
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
await lookup("androidpublisher.googleapis.com");
|
|
149
|
+
results.push({
|
|
150
|
+
name: "dns",
|
|
151
|
+
status: "pass",
|
|
152
|
+
message: "DNS resolution: androidpublisher.googleapis.com"
|
|
153
|
+
});
|
|
154
|
+
} catch {
|
|
155
|
+
results.push({
|
|
156
|
+
name: "dns",
|
|
157
|
+
status: "fail",
|
|
158
|
+
message: "Cannot resolve androidpublisher.googleapis.com",
|
|
159
|
+
suggestion: "Check your DNS settings and network connection"
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
const authConfig = config ?? await loadConfig();
|
|
164
|
+
const client = await resolveAuth({
|
|
165
|
+
serviceAccountPath: authConfig.auth?.serviceAccount
|
|
166
|
+
});
|
|
167
|
+
results.push({
|
|
168
|
+
name: "auth",
|
|
169
|
+
status: "pass",
|
|
170
|
+
message: `Authenticated as ${client.getClientEmail()}`
|
|
171
|
+
});
|
|
172
|
+
await client.getAccessToken();
|
|
173
|
+
results.push({
|
|
174
|
+
name: "api-connectivity",
|
|
175
|
+
status: "pass",
|
|
176
|
+
message: "API connectivity verified"
|
|
177
|
+
});
|
|
178
|
+
} catch (error) {
|
|
179
|
+
if (error instanceof AuthError) {
|
|
180
|
+
results.push({
|
|
181
|
+
name: "auth",
|
|
182
|
+
status: "fail",
|
|
183
|
+
message: `Authentication: ${error.message}`,
|
|
184
|
+
suggestion: error.suggestion
|
|
185
|
+
});
|
|
186
|
+
} else {
|
|
187
|
+
results.push({
|
|
188
|
+
name: "api-connectivity",
|
|
189
|
+
status: "fail",
|
|
190
|
+
message: "API connectivity failed",
|
|
191
|
+
suggestion: "Check your network connection and credentials"
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (jsonMode) {
|
|
196
|
+
const errors2 = results.filter((r) => r.status === "fail").length;
|
|
197
|
+
const warnings2 = results.filter((r) => r.status === "warn").length;
|
|
198
|
+
console.log(
|
|
199
|
+
JSON.stringify(
|
|
200
|
+
{
|
|
201
|
+
success: errors2 === 0,
|
|
202
|
+
errors: errors2,
|
|
203
|
+
warnings: warnings2,
|
|
204
|
+
checks: results
|
|
205
|
+
},
|
|
206
|
+
null,
|
|
207
|
+
2
|
|
208
|
+
)
|
|
209
|
+
);
|
|
210
|
+
if (errors2 > 0) process.exit(1);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
console.log("GPC Doctor\n");
|
|
214
|
+
for (const r of results) {
|
|
215
|
+
console.log(` ${icon(r.status)} ${r.message}`);
|
|
216
|
+
if (r.suggestion && r.status !== "pass") {
|
|
217
|
+
console.log(` ${r.suggestion}`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
const errors = results.filter((r) => r.status === "fail").length;
|
|
221
|
+
const warnings = results.filter((r) => r.status === "warn").length;
|
|
222
|
+
console.log("");
|
|
223
|
+
if (errors > 0) {
|
|
224
|
+
console.log("Some checks failed. Fix the issues above and run again.");
|
|
225
|
+
process.exit(1);
|
|
226
|
+
} else if (warnings > 0) {
|
|
227
|
+
console.log("All checks passed with warnings.");
|
|
228
|
+
} else {
|
|
229
|
+
console.log("All checks passed!");
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
export {
|
|
234
|
+
registerDoctorCommand
|
|
235
|
+
};
|
|
236
|
+
//# sourceMappingURL=doctor-7IO43Y4R.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/doctor.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { loadConfig, getCacheDir, getConfigDir } from \"@gpc-cli/config\";\nimport { resolveAuth, AuthError } from \"@gpc-cli/auth\";\nimport { existsSync, accessSync, constants } from \"node:fs\";\nimport { lookup } from \"node:dns/promises\";\n\ninterface CheckResult {\n name: string;\n status: \"pass\" | \"fail\" | \"warn\" | \"info\";\n message: string;\n suggestion?: string;\n}\n\nconst PASS = \"\\u2713\";\nconst FAIL = \"\\u2717\";\nconst WARN = \"\\u26A0\";\nconst INFO = \"-\";\n\nfunction icon(status: CheckResult[\"status\"]): string {\n switch (status) {\n case \"pass\":\n return PASS;\n case \"fail\":\n return FAIL;\n case \"warn\":\n return WARN;\n case \"info\":\n return INFO;\n }\n}\n\nexport function registerDoctorCommand(program: Command): void {\n program\n .command(\"doctor\")\n .description(\"Verify setup and connectivity\")\n .option(\"--json\", \"Output results as JSON\")\n .action(async (opts: { json?: boolean }) => {\n const results: CheckResult[] = [];\n const jsonMode = opts.json ?? false;\n\n // 1. Node.js version\n const nodeVersion = process.versions.node;\n const major = parseInt(nodeVersion.split(\".\")[0] ?? \"0\", 10);\n results.push(\n major >= 20\n ? { name: \"node\", status: \"pass\", message: `Node.js ${nodeVersion}` }\n : {\n name: \"node\",\n status: \"fail\",\n message: `Node.js ${nodeVersion} (requires >=20)`,\n suggestion: \"Upgrade Node.js to v20 or later: https://nodejs.org\",\n },\n );\n\n // 2. Config file\n let config;\n try {\n config = await loadConfig();\n results.push({ name: \"config\", status: \"pass\", message: \"Configuration loaded\" });\n if (config.app) {\n results.push({\n name: \"default-app\",\n status: \"pass\",\n message: `Default app: ${config.app}`,\n });\n } else {\n results.push({\n name: \"default-app\",\n status: \"info\",\n message: \"No default app configured\",\n suggestion: \"Use --app flag or run: gpc config set app <package>\",\n });\n }\n } catch {\n results.push({\n name: \"config\",\n status: \"fail\",\n message: \"Configuration error\",\n suggestion: \"Check your .gpcrc.json or config file for syntax errors\",\n });\n }\n\n // 3. Config directory permissions\n const configDir = getConfigDir();\n try {\n if (existsSync(configDir)) {\n accessSync(configDir, constants.R_OK | constants.W_OK);\n results.push({\n name: \"config-dir\",\n status: \"pass\",\n message: `Config directory: ${configDir}`,\n });\n } else {\n results.push({\n name: \"config-dir\",\n status: \"info\",\n message: `Config directory does not exist yet: ${configDir}`,\n });\n }\n } catch {\n results.push({\n name: \"config-dir\",\n status: \"warn\",\n message: `Config directory not writable: ${configDir}`,\n suggestion: `Fix permissions: chmod 755 ${configDir}`,\n });\n }\n\n // 4. Cache directory permissions\n const cacheDir = getCacheDir();\n try {\n if (existsSync(cacheDir)) {\n accessSync(cacheDir, constants.R_OK | constants.W_OK);\n results.push({\n name: \"cache-dir\",\n status: \"pass\",\n message: `Cache directory: ${cacheDir}`,\n });\n } else {\n results.push({\n name: \"cache-dir\",\n status: \"info\",\n message: `Cache directory does not exist yet: ${cacheDir}`,\n });\n }\n } catch {\n results.push({\n name: \"cache-dir\",\n status: \"warn\",\n message: `Cache directory not writable: ${cacheDir}`,\n suggestion: `Fix permissions: chmod 700 ${cacheDir}`,\n });\n }\n\n // 5. Proxy configuration\n const proxyUrl =\n process.env[\"HTTPS_PROXY\"] ||\n process.env[\"https_proxy\"] ||\n process.env[\"HTTP_PROXY\"] ||\n process.env[\"http_proxy\"];\n if (proxyUrl) {\n try {\n new URL(proxyUrl);\n results.push({\n name: \"proxy\",\n status: \"pass\",\n message: `Proxy configured: ${proxyUrl}`,\n });\n } catch {\n results.push({\n name: \"proxy\",\n status: \"warn\",\n message: `Invalid proxy URL: ${proxyUrl}`,\n suggestion: \"Set HTTPS_PROXY to a valid URL (e.g., http://proxy.example.com:8080)\",\n });\n }\n }\n\n // 6. CA certificate\n const caCert = process.env[\"GPC_CA_CERT\"] || process.env[\"NODE_EXTRA_CA_CERTS\"];\n if (caCert) {\n if (existsSync(caCert)) {\n results.push({\n name: \"ca-cert\",\n status: \"pass\",\n message: `CA certificate: ${caCert}`,\n });\n } else {\n results.push({\n name: \"ca-cert\",\n status: \"warn\",\n message: `CA certificate file not found: ${caCert}`,\n suggestion: \"Check that GPC_CA_CERT points to an existing PEM file\",\n });\n }\n }\n\n // 7. DNS resolution\n try {\n await lookup(\"androidpublisher.googleapis.com\");\n results.push({\n name: \"dns\",\n status: \"pass\",\n message: \"DNS resolution: androidpublisher.googleapis.com\",\n });\n } catch {\n results.push({\n name: \"dns\",\n status: \"fail\",\n message: \"Cannot resolve androidpublisher.googleapis.com\",\n suggestion: \"Check your DNS settings and network connection\",\n });\n }\n\n // 8. Authentication + API connectivity\n try {\n const authConfig = config ?? (await loadConfig());\n const client = await resolveAuth({\n serviceAccountPath: authConfig.auth?.serviceAccount,\n });\n results.push({\n name: \"auth\",\n status: \"pass\",\n message: `Authenticated as ${client.getClientEmail()}`,\n });\n\n await client.getAccessToken();\n results.push({\n name: \"api-connectivity\",\n status: \"pass\",\n message: \"API connectivity verified\",\n });\n } catch (error) {\n if (error instanceof AuthError) {\n results.push({\n name: \"auth\",\n status: \"fail\",\n message: `Authentication: ${error.message}`,\n suggestion: error.suggestion,\n });\n } else {\n results.push({\n name: \"api-connectivity\",\n status: \"fail\",\n message: \"API connectivity failed\",\n suggestion: \"Check your network connection and credentials\",\n });\n }\n }\n\n // Output\n if (jsonMode) {\n const errors = results.filter((r) => r.status === \"fail\").length;\n const warnings = results.filter((r) => r.status === \"warn\").length;\n console.log(\n JSON.stringify(\n {\n success: errors === 0,\n errors,\n warnings,\n checks: results,\n },\n null,\n 2,\n ),\n );\n if (errors > 0) process.exit(1);\n return;\n }\n\n console.log(\"GPC Doctor\\n\");\n for (const r of results) {\n console.log(` ${icon(r.status)} ${r.message}`);\n if (r.suggestion && r.status !== \"pass\") {\n console.log(` ${r.suggestion}`);\n }\n }\n\n const errors = results.filter((r) => r.status === \"fail\").length;\n const warnings = results.filter((r) => r.status === \"warn\").length;\n\n console.log(\"\");\n if (errors > 0) {\n console.log(\"Some checks failed. Fix the issues above and run again.\");\n process.exit(1);\n } else if (warnings > 0) {\n console.log(\"All checks passed with warnings.\");\n } else {\n console.log(\"All checks passed!\");\n }\n });\n}\n"],"mappings":";;;AACA,SAAS,YAAY,aAAa,oBAAoB;AACtD,SAAS,aAAa,iBAAiB;AACvC,SAAS,YAAY,YAAY,iBAAiB;AAClD,SAAS,cAAc;AASvB,IAAM,OAAO;AACb,IAAM,OAAO;AACb,IAAM,OAAO;AACb,IAAM,OAAO;AAEb,SAAS,KAAK,QAAuC;AACnD,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,EACX;AACF;AAEO,SAAS,sBAAsB,SAAwB;AAC5D,UACG,QAAQ,QAAQ,EAChB,YAAY,+BAA+B,EAC3C,OAAO,UAAU,wBAAwB,EACzC,OAAO,OAAO,SAA6B;AAC1C,UAAM,UAAyB,CAAC;AAChC,UAAM,WAAW,KAAK,QAAQ;AAG9B,UAAM,cAAc,QAAQ,SAAS;AACrC,UAAM,QAAQ,SAAS,YAAY,MAAM,GAAG,EAAE,CAAC,KAAK,KAAK,EAAE;AAC3D,YAAQ;AAAA,MACN,SAAS,KAC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A,YACpB,QAAAA;AAAA,YACA,UAAAC;AAAA,YACA,QAAQ;AAAA,UACV;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AACA,UAAID,UAAS,EAAG,SAAQ,KAAK,CAAC;AAC9B;AAAA,IACF;AAEA,YAAQ,IAAI,cAAc;AAC1B,eAAW,KAAK,SAAS;AACvB,cAAQ,IAAI,KAAK,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE;AAC9C,UAAI,EAAE,cAAc,EAAE,WAAW,QAAQ;AACvC,gBAAQ,IAAI,OAAO,EAAE,UAAU,EAAE;AAAA,MACnC;AAAA,IACF;AAEA,UAAM,SAAS,QAAQ,OAAO,CAAC,MAAM,EAAE,WAAW,MAAM,EAAE;AAC1D,UAAM,WAAW,QAAQ,OAAO,CAAC,MAAM,EAAE,WAAW,MAAM,EAAE;AAE5D,YAAQ,IAAI,EAAE;AACd,QAAI,SAAS,GAAG;AACd,cAAQ,IAAI,yDAAyD;AACrE,cAAQ,KAAK,CAAC;AAAA,IAChB,WAAW,WAAW,GAAG;AACvB,cAAQ,IAAI,kCAAkC;AAAA,IAChD,OAAO;AACL,cAAQ,IAAI,oBAAoB;AAAA,IAClC;AAAA,EACF,CAAC;AACL;","names":["errors","warnings"]}
|
|
@@ -83,7 +83,7 @@ function registerExternalTransactionsCommands(program) {
|
|
|
83
83
|
});
|
|
84
84
|
extTxn.command("refund <id>").description("Refund an external transaction").option("--full", "Full refund").option(
|
|
85
85
|
"--partial-amount <micros>",
|
|
86
|
-
"Partial refund pre-tax amount in micros (e.g
|
|
86
|
+
"Partial refund pre-tax amount in micros (e.g., 1990000)"
|
|
87
87
|
).option("--currency <code>", "Currency code for partial refund (e.g. USD)").action(async (id, options) => {
|
|
88
88
|
const config = await loadConfig();
|
|
89
89
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
@@ -128,4 +128,4 @@ function registerExternalTransactionsCommands(program) {
|
|
|
128
128
|
export {
|
|
129
129
|
registerExternalTransactionsCommands
|
|
130
130
|
};
|
|
131
|
-
//# sourceMappingURL=external-transactions-
|
|
131
|
+
//# sourceMappingURL=external-transactions-5U3PMAAG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/external-transactions.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 createExternalTransaction,\n getExternalTransaction,\n refundExternalTransaction,\n detectOutputFormat,\n formatOutput,\n} from \"@gpc-cli/core\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { requireConfirm } from \"../prompt.js\";\nimport { readFileSync } from \"node:fs\";\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 registerExternalTransactionsCommands(program: Command): void {\n const extTxn = program\n .command(\"external-transactions\")\n .alias(\"ext-txn\")\n .description(\"Manage external transactions (alternative billing)\");\n\n extTxn\n .command(\"create\")\n .description(\"Create a new external transaction\")\n .requiredOption(\"--file <path>\", \"Path to JSON file with transaction data\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = detectOutputFormat();\n\n let data: Record<string, unknown>;\n try {\n data = JSON.parse(readFileSync(options.file, \"utf-8\"));\n } catch (err) {\n console.error(\n `Error: Could not read transaction data from ${options.file}: ${err instanceof Error ? err.message : String(err)}`,\n );\n process.exit(2);\n }\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"external-transactions create\",\n action: \"create external transaction\",\n target: packageName,\n details: data,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const result = await createExternalTransaction(client, packageName, data);\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 extTxn\n .command(\"get <id>\")\n .description(\"Get an external transaction by ID\")\n .action(async (id: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n try {\n const result = await getExternalTransaction(client, packageName, id);\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 extTxn\n .command(\"refund <id>\")\n .description(\"Refund an external transaction\")\n .option(\"--full\", \"Full refund\")\n .option(\n \"--partial-amount <micros>\",\n \"Partial refund pre-tax amount in micros (e.g., 1990000)\",\n )\n .option(\"--currency <code>\", \"Currency code for partial refund (e.g. USD)\")\n .action(async (id: string, options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = detectOutputFormat();\n\n const refundData: Record<string, unknown> = {};\n if (options.full) {\n refundData.fullRefund = {};\n } else if (options.partialAmount) {\n refundData.partialRefund = {\n refundPreTaxAmount: {\n priceMicros: options.partialAmount,\n currency: options.currency,\n },\n };\n } else {\n refundData.fullRefund = {};\n }\n\n await requireConfirm(`Refund external transaction \"${id}\"?`, program);\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"external-transactions refund\",\n action: \"refund external transaction\",\n target: id,\n details: refundData,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const result = await refundExternalTransaction(client, packageName, id, refundData);\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"],"mappings":";;;;;;;;;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB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AAAA,MACF;AAAA,IACF,OAAO;AACL,iBAAW,aAAa,CAAC;AAAA,IAC3B;AAEA,UAAM,eAAe,gCAAgC,EAAE,MAAM,OAAO;AAEpE,QAAI,SAAS,OAAO,GAAG;AACrB;AAAA,QACE;AAAA,UACE,SAAS;AAAA,UACT,QAAQ;AAAA,UACR,QAAQ;AAAA,UACR,SAAS;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACA;AAAA,IACF;AAEA,UAAM,SAAS,MAAM,UAAU,MAAM;AAErC,QAAI;AACF,YAAM,SAAS,MAAM,0BAA0B,QAAQ,aAAa,IAAI,UAAU;AAClF,cAAQ,IAAI,aAAa,QAAQ,MAAM,CAAC;AAAA,IAC1C,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":[]}
|
|
@@ -23,7 +23,7 @@ async function getClient(config) {
|
|
|
23
23
|
return createApiClient({ auth });
|
|
24
24
|
}
|
|
25
25
|
function registerGeneratedApksCommands(program) {
|
|
26
|
-
const cmd = program.command("generated-apks").description("Manage
|
|
26
|
+
const cmd = program.command("generated-apks").description("Manage device-specific APKs generated by Google Play");
|
|
27
27
|
cmd.command("list <version-code>").description("List generated APKs for a version code").action(async (versionCodeStr) => {
|
|
28
28
|
const config = await loadConfig();
|
|
29
29
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
@@ -70,4 +70,4 @@ function registerGeneratedApksCommands(program) {
|
|
|
70
70
|
export {
|
|
71
71
|
registerGeneratedApksCommands
|
|
72
72
|
};
|
|
73
|
-
//# sourceMappingURL=generated-apks-
|
|
73
|
+
//# sourceMappingURL=generated-apks-HF7VYA54.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/generated-apks.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 listGeneratedApks,\n downloadGeneratedApk,\n detectOutputFormat,\n formatOutput,\n} from \"@gpc-cli/core\";\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 registerGeneratedApksCommands(program: Command): void {\n const cmd = program\n .command(\"generated-apks\")\n .description(\"Manage device-specific APKs generated by Google Play\");\n\n cmd\n .command(\"list <version-code>\")\n .description(\"List generated APKs for a version code\")\n .action(async (versionCodeStr: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n const versionCode = parseInt(versionCodeStr, 10);\n if (isNaN(versionCode)) {\n console.error(\"Error: version-code must be a number\");\n process.exit(2);\n }\n\n try {\n const result = await listGeneratedApks(client, packageName, versionCode);\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 cmd\n .command(\"download <version-code> <apk-id>\")\n .description(\"Download a generated APK\")\n .requiredOption(\"--output <path>\", \"Output file path\")\n .action(async (versionCodeStr: string, apkId: string, opts: { output: string }) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n const versionCode = parseInt(versionCodeStr, 10);\n if (isNaN(versionCode)) {\n console.error(\"Error: version-code must be a number\");\n process.exit(2);\n }\n\n try {\n const result = await downloadGeneratedApk(\n client,\n packageName,\n versionCode,\n apkId,\n opts.output,\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"],"mappings":";;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,mBAAmB,YAAgC,QAA2B;AACrF,QAAM,OAAO,cAAc,OAAO;AAClC,MAAI,CAAC,MAAM;AACT,YAAQ,MAAM,6EAA6E;AAC3F,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,SAAO;AACT;AAEA,eAAe,UAAU,QAAmB;AAC1C,QAAM,OAAO,MAAM,YAAY,EAAE,oBAAoB,OAAO,MAAM,eAAe,CAAC;AAClF,SAAO,gBAAgB,EAAE,KAAK,CAAC;AACjC;AAEO,SAAS,8BAA8B,SAAwB;AACpE,QAAM,MAAM,QACT,QAAQ,gBAAgB,EACxB,YAAY,sDAAsD;AAErE,MACG,QAAQ,qBAAqB,EAC7B,YAAY,wCAAwC,EACpD,OAAO,OAAO,mBAA2B;AACxC,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,mBAAmB,QAAQ,KAAK,EAAE,KAAK,GAAG,MAAM;AACpE,UAAM,SAAS,MAAM,UAAU,MAAM;AACrC,UAAM,SAAS,mBAAmB;AAElC,UAAM,cAAc,SAAS,gBAAgB,EAAE;AAC/C,QAAI,MAAM,WAAW,GAAG;AACtB,cAAQ,MAAM,sCAAsC;AACpD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,QAAI;AACF,YAAM,SAAS,MAAM,kBAAkB,QAAQ,aAAa,WAAW;AACvE,cAAQ,IAAI,aAAa,QAAQ,MAAM,CAAC;AAAA,IAC1C,SAAS,OAAO;AACd,cAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AAEH,MACG,QAAQ,kCAAkC,EAC1C,YAAY,0BAA0B,EACtC,eAAe,mBAAmB,kBAAkB,EACpD,OAAO,OAAO,gBAAwB,OAAe,SAA6B;AACjF,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,mBAAmB,QAAQ,KAAK,EAAE,KAAK,GAAG,MAAM;AACpE,UAAM,SAAS,MAAM,UAAU,MAAM;AACrC,UAAM,SAAS,mBAAmB;AAElC,UAAM,cAAc,SAAS,gBAAgB,EAAE;AAC/C,QAAI,MAAM,WAAW,GAAG;AACtB,cAAQ,MAAM,sCAAsC;AACpD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,QAAI;AACF,YAAM,SAAS,MAAM;AAAA,QACnB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,KAAK;AAAA,MACP;AACA,cAAQ,IAAI,aAAa,QAAQ,MAAM,CAAC;AAAA,IAC1C,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":[]}
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ async function getClient(config) {
|
|
|
23
23
|
return createApiClient({ auth });
|
|
24
24
|
}
|
|
25
25
|
function registerInternalSharingCommands(program) {
|
|
26
|
-
const cmd = program.command("internal-sharing").description("
|
|
26
|
+
const cmd = program.command("internal-sharing").description("Upload bundles or APKs for instant internal sharing");
|
|
27
27
|
cmd.command("upload <file>").description("Upload a bundle or APK for internal app sharing").option("--type <type>", "File type: bundle or apk (auto-detected from extension)").action(async (file, opts) => {
|
|
28
28
|
const config = await loadConfig();
|
|
29
29
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
@@ -46,4 +46,4 @@ function registerInternalSharingCommands(program) {
|
|
|
46
46
|
export {
|
|
47
47
|
registerInternalSharingCommands
|
|
48
48
|
};
|
|
49
|
-
//# sourceMappingURL=internal-sharing-
|
|
49
|
+
//# sourceMappingURL=internal-sharing-FEZFTPWE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/internal-sharing.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 uploadInternalSharing,\n detectOutputFormat,\n formatOutput,\n createSpinner,\n} from \"@gpc-cli/core\";\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 registerInternalSharingCommands(program: Command): void {\n const cmd = program\n .command(\"internal-sharing\")\n .description(\"Upload bundles or APKs for instant internal sharing\");\n\n cmd\n .command(\"upload <file>\")\n .description(\"Upload a bundle or APK for internal app sharing\")\n .option(\"--type <type>\", \"File type: bundle or apk (auto-detected from extension)\")\n .action(async (file: string, opts: { type?: string }) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n const fileType = opts.type as \"bundle\" | \"apk\" | undefined;\n\n const spinner = createSpinner(\"Uploading for internal sharing...\");\n if (!program.opts()[\"quiet\"] && process.stderr.isTTY) spinner.start();\n\n try {\n const result = await uploadInternalSharing(client, packageName, file, fileType);\n spinner.stop(\"Upload complete\");\n console.log(formatOutput(result, format));\n } catch (error) {\n spinner.fail(\"Upload failed\");\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n}\n"],"mappings":";;;AAEA,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A,EACF,CAAC;AACL;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gpc-cli/cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.10",
|
|
4
4
|
"description": "The complete Google Play CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"commander": "^14.0.3",
|
|
22
|
-
"@gpc-cli/api": "1.0.
|
|
22
|
+
"@gpc-cli/api": "1.0.9",
|
|
23
23
|
"@gpc-cli/auth": "^0.9.7",
|
|
24
24
|
"@gpc-cli/config": "0.9.7",
|
|
25
25
|
"@gpc-cli/plugin-sdk": "0.9.5",
|
|
26
|
-
"@gpc-cli/core": "0.9.
|
|
26
|
+
"@gpc-cli/core": "0.9.10"
|
|
27
27
|
},
|
|
28
28
|
"keywords": [
|
|
29
29
|
"google-play",
|
package/dist/doctor-KVP7PGZU.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/commands/doctor.ts
|
|
4
|
-
import { loadConfig } from "@gpc-cli/config";
|
|
5
|
-
import { resolveAuth, AuthError } from "@gpc-cli/auth";
|
|
6
|
-
function registerDoctorCommand(program) {
|
|
7
|
-
program.command("doctor").description("Verify setup and connectivity").action(async () => {
|
|
8
|
-
console.log("GPC Doctor\n");
|
|
9
|
-
let allGood = true;
|
|
10
|
-
const nodeVersion = process.versions.node;
|
|
11
|
-
const major = parseInt(nodeVersion.split(".")[0] ?? "0", 10);
|
|
12
|
-
if (major >= 20) {
|
|
13
|
-
console.log(` \u2713 Node.js ${nodeVersion}`);
|
|
14
|
-
} else {
|
|
15
|
-
console.log(` \u2717 Node.js ${nodeVersion} (requires >=20)`);
|
|
16
|
-
allGood = false;
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
const config = await loadConfig();
|
|
20
|
-
console.log(` \u2713 Configuration loaded`);
|
|
21
|
-
if (config.app) {
|
|
22
|
-
console.log(` \u2713 Default app: ${config.app}`);
|
|
23
|
-
} else {
|
|
24
|
-
console.log(
|
|
25
|
-
` - No default app configured (use --app flag or gpc config set app <package>)`
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
} catch {
|
|
29
|
-
console.log(" \u2717 Configuration error");
|
|
30
|
-
allGood = false;
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
const config = await loadConfig();
|
|
34
|
-
const client = await resolveAuth({
|
|
35
|
-
serviceAccountPath: config.auth?.serviceAccount
|
|
36
|
-
});
|
|
37
|
-
console.log(` \u2713 Authenticated as ${client.getClientEmail()}`);
|
|
38
|
-
await client.getAccessToken();
|
|
39
|
-
console.log(" \u2713 API connectivity verified");
|
|
40
|
-
} catch (error) {
|
|
41
|
-
if (error instanceof AuthError) {
|
|
42
|
-
console.log(` \u2717 Authentication: ${error.message}`);
|
|
43
|
-
if (error.suggestion) console.log(` ${error.suggestion}`);
|
|
44
|
-
} else {
|
|
45
|
-
console.log(" \u2717 API connectivity failed");
|
|
46
|
-
}
|
|
47
|
-
allGood = false;
|
|
48
|
-
}
|
|
49
|
-
console.log("");
|
|
50
|
-
if (allGood) {
|
|
51
|
-
console.log("All checks passed!");
|
|
52
|
-
} else {
|
|
53
|
-
console.log("Some checks failed. Fix the issues above and run again.");
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
export {
|
|
59
|
-
registerDoctorCommand
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=doctor-KVP7PGZU.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/doctor.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth, AuthError } from \"@gpc-cli/auth\";\n\nexport function registerDoctorCommand(program: Command): void {\n program\n .command(\"doctor\")\n .description(\"Verify setup and connectivity\")\n .action(async () => {\n console.log(\"GPC Doctor\\n\");\n let allGood = true;\n\n // Check Node.js version\n const nodeVersion = process.versions.node;\n const major = parseInt(nodeVersion.split(\".\")[0] ?? \"0\", 10);\n if (major >= 20) {\n console.log(` \\u2713 Node.js ${nodeVersion}`);\n } else {\n console.log(` \\u2717 Node.js ${nodeVersion} (requires >=20)`);\n allGood = false;\n }\n\n // Check config\n try {\n const config = await loadConfig();\n console.log(` \\u2713 Configuration loaded`);\n if (config.app) {\n console.log(` \\u2713 Default app: ${config.app}`);\n } else {\n console.log(\n ` - No default app configured (use --app flag or gpc config set app <package>)`,\n );\n }\n } catch {\n console.log(\" \\u2717 Configuration error\");\n allGood = false;\n }\n\n // Check auth\n try {\n const config = await loadConfig();\n const client = await resolveAuth({\n serviceAccountPath: config.auth?.serviceAccount,\n });\n console.log(` \\u2713 Authenticated as ${client.getClientEmail()}`);\n\n // Try to get a token to verify connectivity\n await client.getAccessToken();\n console.log(\" \\u2713 API connectivity verified\");\n } catch (error) {\n if (error instanceof AuthError) {\n console.log(` \\u2717 Authentication: ${error.message}`);\n if (error.suggestion) console.log(` ${error.suggestion}`);\n } else {\n console.log(\" \\u2717 API connectivity failed\");\n }\n allGood = false;\n }\n\n console.log(\"\");\n if (allGood) {\n console.log(\"All checks passed!\");\n } else {\n console.log(\"Some checks failed. Fix the issues above and run again.\");\n process.exit(1);\n }\n });\n}\n"],"mappings":";;;AACA,SAAS,kBAAkB;AAC3B,SAAS,aAAa,iBAAiB;AAEhC,SAAS,sBAAsB,SAAwB;AAC5D,UACG,QAAQ,QAAQ,EAChB,YAAY,+BAA+B,EAC3C,OAAO,YAAY;AAClB,YAAQ,IAAI,cAAc;AAC1B,QAAI,UAAU;AAGd,UAAM,cAAc,QAAQ,SAAS;AACrC,UAAM,QAAQ,SAAS,YAAY,MAAM,GAAG,EAAE,CAAC,KAAK,KAAK,EAAE;AAC3D,QAAI,SAAS,IAAI;AACf,cAAQ,IAAI,oBAAoB,WAAW,EAAE;AAAA,IAC/C,OAAO;AACL,cAAQ,IAAI,oBAAoB,WAAW,kBAAkB;AAC7D,gBAAU;AAAA,IACZ;AAGA,QAAI;AACF,YAAM,SAAS,MAAM,WAAW;AAChC,cAAQ,IAAI,+BAA+B;AAC3C,UAAI,OAAO,KAAK;AACd,gBAAQ,IAAI,yBAAyB,OAAO,GAAG,EAAE;AAAA,MACnD,OAAO;AACL,gBAAQ;AAAA,UACN;AAAA,QACF;AAAA,MACF;AAAA,IACF,QAAQ;AACN,cAAQ,IAAI,8BAA8B;AAC1C,gBAAU;AAAA,IACZ;AAGA,QAAI;AACF,YAAM,SAAS,MAAM,WAAW;AAChC,YAAM,SAAS,MAAM,YAAY;AAAA,QAC/B,oBAAoB,OAAO,MAAM;AAAA,MACnC,CAAC;AACD,cAAQ,IAAI,6BAA6B,OAAO,eAAe,CAAC,EAAE;AAGlE,YAAM,OAAO,eAAe;AAC5B,cAAQ,IAAI,oCAAoC;AAAA,IAClD,SAAS,OAAO;AACd,UAAI,iBAAiB,WAAW;AAC9B,gBAAQ,IAAI,4BAA4B,MAAM,OAAO,EAAE;AACvD,YAAI,MAAM,WAAY,SAAQ,IAAI,OAAO,MAAM,UAAU,EAAE;AAAA,MAC7D,OAAO;AACL,gBAAQ,IAAI,kCAAkC;AAAA,MAChD;AACA,gBAAU;AAAA,IACZ;AAEA,YAAQ,IAAI,EAAE;AACd,QAAI,SAAS;AACX,cAAQ,IAAI,oBAAoB;AAAA,IAClC,OAAO;AACL,cAAQ,IAAI,yDAAyD;AACrE,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/external-transactions.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 createExternalTransaction,\n getExternalTransaction,\n refundExternalTransaction,\n detectOutputFormat,\n formatOutput,\n} from \"@gpc-cli/core\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { requireConfirm } from \"../prompt.js\";\nimport { readFileSync } from \"node:fs\";\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 registerExternalTransactionsCommands(program: Command): void {\n const extTxn = program\n .command(\"external-transactions\")\n .alias(\"ext-txn\")\n .description(\"Manage external transactions (alternative billing)\");\n\n extTxn\n .command(\"create\")\n .description(\"Create a new external transaction\")\n .requiredOption(\"--file <path>\", \"Path to JSON file with transaction data\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = detectOutputFormat();\n\n let data: Record<string, unknown>;\n try {\n data = JSON.parse(readFileSync(options.file, \"utf-8\"));\n } catch (err) {\n console.error(\n `Error: Could not read transaction data from ${options.file}: ${err instanceof Error ? err.message : String(err)}`,\n );\n process.exit(2);\n }\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"external-transactions create\",\n action: \"create external transaction\",\n target: packageName,\n details: data,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const result = await createExternalTransaction(client, packageName, data);\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 extTxn\n .command(\"get <id>\")\n .description(\"Get an external transaction by ID\")\n .action(async (id: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n try {\n const result = await getExternalTransaction(client, packageName, id);\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 extTxn\n .command(\"refund <id>\")\n .description(\"Refund an external transaction\")\n .option(\"--full\", \"Full refund\")\n .option(\n \"--partial-amount <micros>\",\n \"Partial refund pre-tax amount in micros (e.g. 1990000)\",\n )\n .option(\"--currency <code>\", \"Currency code for partial refund (e.g. USD)\")\n .action(async (id: string, options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = detectOutputFormat();\n\n const refundData: Record<string, unknown> = {};\n if (options.full) {\n refundData.fullRefund = {};\n } else if (options.partialAmount) {\n refundData.partialRefund = {\n refundPreTaxAmount: {\n priceMicros: options.partialAmount,\n currency: options.currency,\n },\n };\n } else {\n refundData.fullRefund = {};\n }\n\n await requireConfirm(`Refund external transaction \"${id}\"?`, program);\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"external-transactions refund\",\n action: \"refund external transaction\",\n target: id,\n details: refundData,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const result = await refundExternalTransaction(client, packageName, id, refundData);\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"],"mappings":";;;;;;;;;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,oBAAoB;AAE7B,SAAS,mBAAmB,YAAgC,QAA2B;AACrF,QAAM,OAAO,cAAc,OAAO;AAClC,MAAI,CAAC,MAAM;AACT,YAAQ,MAAM,6EAA6E;AAC3F,YAAQ,KAAK,CAAC;AAAA,EACh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ACF;AACA;AAAA,IACF;AAEA,UAAM,SAAS,MAAM,UAAU,MAAM;AAErC,QAAI;AACF,YAAM,SAAS,MAAM,0BAA0B,QAAQ,aAAa,IAAI,UAAU;AAClF,cAAQ,IAAI,aAAa,QAAQ,MAAM,CAAC;AAAA,IAC1C,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/generated-apks.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 listGeneratedApks,\n downloadGeneratedApk,\n detectOutputFormat,\n formatOutput,\n} from \"@gpc-cli/core\";\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 registerGeneratedApksCommands(program: Command): void {\n const cmd = program\n .command(\"generated-apks\")\n .description(\"Manage generated (device-specific) APKs\");\n\n cmd\n .command(\"list <version-code>\")\n .description(\"List generated APKs for a version code\")\n .action(async (versionCodeStr: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n const versionCode = parseInt(versionCodeStr, 10);\n if (isNaN(versionCode)) {\n console.error(\"Error: version-code must be a number\");\n process.exit(2);\n }\n\n try {\n const result = await listGeneratedApks(client, packageName, versionCode);\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 cmd\n .command(\"download <version-code> <apk-id>\")\n .description(\"Download a generated APK\")\n .requiredOption(\"--output <path>\", \"Output file path\")\n .action(async (versionCodeStr: string, apkId: string, opts: { output: string }) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n const versionCode = parseInt(versionCodeStr, 10);\n if (isNaN(versionCode)) {\n console.error(\"Error: version-code must be a number\");\n process.exit(2);\n }\n\n try {\n const result = await downloadGeneratedApk(\n client,\n packageName,\n versionCode,\n apkId,\n opts.output,\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"],"mappings":";;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,mBAAmB,YAAgC,QAA2B;AACrF,QAAM,OAAO,cAAc,OAAO;AAClC,MAAI,CAAC,MAAM;AACT,YAAQ,MAAM,6EAA6E;AAC3F,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,SAAO;AACT;AAEA,eAAe,UAAU,QAAmB;AAC1C,QAAM,OAAO,MAAM,YAAY,EAAE,oBAAoB,OAAO,MAAM,eAAe,CAAC;AAClF,SAAO,gBAAgB,EAAE,KAAK,CAAC;AACjC;AAEO,SAAS,8BAA8B,SAAwB;AACpE,QAAM,MAAM,QACT,QAAQ,gBAAgB,EACxB,YAAY,yCAAyC;AAExD,MACG,QAAQ,qBAAqB,EAC7B,YAAY,wCAAwC,EACpD,OAAO,OAAO,mBAA2B;AACxC,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,mBAAmB,QAAQ,KAAK,EAAE,KAAK,GAAG,M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3,"sources":["../src/commands/internal-sharing.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 uploadInternalSharing,\n detectOutputFormat,\n formatOutput,\n createSpinner,\n} from \"@gpc-cli/core\";\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 registerInternalSharingCommands(program: Command): void {\n const cmd = program\n .command(\"internal-sharing\")\n .description(\"Internal app sharing (upload bundles/APKs for instant sharing)\");\n\n cmd\n .command(\"upload <file>\")\n .description(\"Upload a bundle or APK for internal app sharing\")\n .option(\"--type <type>\", \"File type: bundle or apk (auto-detected from extension)\")\n .action(async (file: string, opts: { type?: string }) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n const fileType = opts.type as \"bundle\" | \"apk\" | undefined;\n\n const spinner = createSpinner(\"Uploading for internal sharing...\");\n if (!program.opts()[\"quiet\"] && process.stderr.isTTY) spinner.start();\n\n try {\n const result = await uploadInternalSharing(client, packageName, file, fileType);\n spinner.stop(\"Upload complete\");\n console.log(formatOutput(result, format));\n } catch (error) {\n spinner.fail(\"Upload failed\");\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,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,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