@gpc-cli/cli 0.9.21 → 0.9.23
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/audit-DSTCSU4V.js +104 -0
- package/dist/audit-DSTCSU4V.js.map +1 -0
- package/dist/bin.js +1 -1
- package/dist/bundle-U7RF6HDE.js +122 -0
- package/dist/bundle-U7RF6HDE.js.map +1 -0
- package/dist/{chunk-6DB65GRP.js → chunk-CE2HXEJX.js} +19 -13
- package/dist/chunk-CE2HXEJX.js.map +1 -0
- package/dist/{data-safety-DBA26FHB.js → data-safety-GDPKV5PN.js} +3 -3
- package/dist/{data-safety-DBA26FHB.js.map → data-safety-GDPKV5PN.js.map} +1 -1
- package/dist/{device-tiers-V2R6AEXL.js → device-tiers-GHIYJPMB.js} +24 -3
- package/dist/device-tiers-GHIYJPMB.js.map +1 -0
- package/dist/{iap-VK5TU3Q2.js → iap-BBHF7BLZ.js} +81 -1
- package/dist/iap-BBHF7BLZ.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/{internal-sharing-OS3HVIY5.js → internal-sharing-E7SJYDW3.js} +14 -2
- package/dist/internal-sharing-E7SJYDW3.js.map +1 -0
- package/dist/{purchases-NB5P4FL4.js → purchases-YRO6B7M6.js} +46 -4
- package/dist/purchases-YRO6B7M6.js.map +1 -0
- package/dist/{releases-JIBSHE4F.js → releases-ZKPSAPB2.js} +13 -2
- package/dist/releases-ZKPSAPB2.js.map +1 -0
- package/dist/{reports-Q7GFQ5GG.js → reports-N5X66IUN.js} +4 -4
- package/dist/{reports-Q7GFQ5GG.js.map → reports-N5X66IUN.js.map} +1 -1
- package/dist/{reviews-PMUJVNVC.js → reviews-GJAQ5OVC.js} +18 -2
- package/dist/reviews-GJAQ5OVC.js.map +1 -0
- package/dist/{testers-FXRW6KN3.js → testers-UWSUGGVT.js} +11 -5
- package/dist/testers-UWSUGGVT.js.map +1 -0
- package/dist/{tracks-TP6TDO56.js → tracks-XFUN7JJX.js} +23 -3
- package/dist/tracks-XFUN7JJX.js.map +1 -0
- package/dist/{users-KUVAYRJC.js → users-JASXONRY.js} +18 -2
- package/dist/users-JASXONRY.js.map +1 -0
- package/dist/{vitals-FE2V5OHW.js → vitals-GDIQFWHV.js} +56 -5
- package/dist/vitals-GDIQFWHV.js.map +1 -0
- package/package.json +4 -4
- package/dist/chunk-6DB65GRP.js.map +0 -1
- package/dist/device-tiers-V2R6AEXL.js.map +0 -1
- package/dist/iap-VK5TU3Q2.js.map +0 -1
- package/dist/internal-sharing-OS3HVIY5.js.map +0 -1
- package/dist/purchases-NB5P4FL4.js.map +0 -1
- package/dist/releases-JIBSHE4F.js.map +0 -1
- package/dist/reviews-PMUJVNVC.js.map +0 -1
- package/dist/testers-FXRW6KN3.js.map +0 -1
- package/dist/tracks-TP6TDO56.js.map +0 -1
- package/dist/users-KUVAYRJC.js.map +0 -1
- package/dist/vitals-FE2V5OHW.js.map +0 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
getOutputFormat
|
|
4
|
+
} from "./chunk-ELXAK7GI.js";
|
|
5
|
+
import {
|
|
6
|
+
requireConfirm
|
|
7
|
+
} from "./chunk-NV75I5VP.js";
|
|
8
|
+
|
|
9
|
+
// src/commands/audit.ts
|
|
10
|
+
import { loadConfig } from "@gpc-cli/config";
|
|
11
|
+
import { getConfigDir } from "@gpc-cli/config";
|
|
12
|
+
import {
|
|
13
|
+
initAudit,
|
|
14
|
+
listAuditEvents,
|
|
15
|
+
searchAuditEvents,
|
|
16
|
+
clearAuditLog,
|
|
17
|
+
formatOutput
|
|
18
|
+
} from "@gpc-cli/core";
|
|
19
|
+
function registerAuditCommands(program) {
|
|
20
|
+
const audit = program.command("audit").description("Query and manage audit logs");
|
|
21
|
+
audit.command("list").description("List recent audit events").option("--limit <n>", "Maximum events to show", parseInt, 50).option("--since <date>", "Show events since date (ISO 8601)").option("--command <name>", "Filter by command name").action(async (options) => {
|
|
22
|
+
const config = await loadConfig();
|
|
23
|
+
const format = getOutputFormat(program, config);
|
|
24
|
+
initAudit(getConfigDir());
|
|
25
|
+
try {
|
|
26
|
+
const events = await listAuditEvents({
|
|
27
|
+
limit: options.limit,
|
|
28
|
+
since: options.since,
|
|
29
|
+
command: options.command
|
|
30
|
+
});
|
|
31
|
+
if (events.length === 0 && format !== "json") {
|
|
32
|
+
console.log("No audit events found.");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (format !== "json") {
|
|
36
|
+
const rows = events.map((e) => ({
|
|
37
|
+
timestamp: e.timestamp,
|
|
38
|
+
command: e.command,
|
|
39
|
+
app: e.app || "-",
|
|
40
|
+
success: e.success !== void 0 ? String(e.success) : "-",
|
|
41
|
+
durationMs: e.durationMs ?? "-"
|
|
42
|
+
}));
|
|
43
|
+
console.log(formatOutput(rows, format));
|
|
44
|
+
} else {
|
|
45
|
+
console.log(formatOutput(events, format));
|
|
46
|
+
}
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
audit.command("search <query>").description("Search audit events by keyword").action(async (query) => {
|
|
53
|
+
const config = await loadConfig();
|
|
54
|
+
const format = getOutputFormat(program, config);
|
|
55
|
+
initAudit(getConfigDir());
|
|
56
|
+
try {
|
|
57
|
+
const events = await searchAuditEvents(query);
|
|
58
|
+
if (events.length === 0 && format !== "json") {
|
|
59
|
+
console.log(`No audit events matching "${query}".`);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (format !== "json") {
|
|
63
|
+
const rows = events.map((e) => ({
|
|
64
|
+
timestamp: e.timestamp,
|
|
65
|
+
command: e.command,
|
|
66
|
+
app: e.app || "-",
|
|
67
|
+
success: e.success !== void 0 ? String(e.success) : "-"
|
|
68
|
+
}));
|
|
69
|
+
console.log(formatOutput(rows, format));
|
|
70
|
+
} else {
|
|
71
|
+
console.log(formatOutput(events, format));
|
|
72
|
+
}
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
audit.command("clear").description("Clear audit log entries").option("--before <date>", "Clear entries before date (ISO 8601)").option("--dry-run", "Preview what would be cleared").action(async (options) => {
|
|
79
|
+
const config = await loadConfig();
|
|
80
|
+
const format = getOutputFormat(program, config);
|
|
81
|
+
initAudit(getConfigDir());
|
|
82
|
+
if (!options.dryRun && !options.before) {
|
|
83
|
+
await requireConfirm("Clear all audit log entries?", program);
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
const result = await clearAuditLog({
|
|
87
|
+
before: options.before,
|
|
88
|
+
dryRun: options.dryRun
|
|
89
|
+
});
|
|
90
|
+
if (options.dryRun) {
|
|
91
|
+
console.log(`[dry-run] Would delete ${result.deleted} entries, ${result.remaining} would remain.`);
|
|
92
|
+
} else {
|
|
93
|
+
console.log(`Deleted ${result.deleted} entries. ${result.remaining} remaining.`);
|
|
94
|
+
}
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
registerAuditCommands
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=audit-DSTCSU4V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/audit.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { getConfigDir } from \"@gpc-cli/config\";\nimport {\n initAudit,\n listAuditEvents,\n searchAuditEvents,\n clearAuditLog,\n formatOutput,\n} from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\nimport { requireConfirm } from \"../prompt.js\";\n\nexport function registerAuditCommands(program: Command): void {\n const audit = program.command(\"audit\").description(\"Query and manage audit logs\");\n\n audit\n .command(\"list\")\n .description(\"List recent audit events\")\n .option(\"--limit <n>\", \"Maximum events to show\", parseInt, 50)\n .option(\"--since <date>\", \"Show events since date (ISO 8601)\")\n .option(\"--command <name>\", \"Filter by command name\")\n .action(async (options) => {\n const config = await loadConfig();\n const format = getOutputFormat(program, config);\n initAudit(getConfigDir());\n\n try {\n const events = await listAuditEvents({\n limit: options.limit,\n since: options.since,\n command: options.command,\n });\n if (events.length === 0 && format !== \"json\") {\n console.log(\"No audit events found.\");\n return;\n }\n if (format !== \"json\") {\n const rows = events.map((e) => ({\n timestamp: e.timestamp,\n command: e.command,\n app: e.app || \"-\",\n success: e.success !== undefined ? String(e.success) : \"-\",\n durationMs: e.durationMs ?? \"-\",\n }));\n console.log(formatOutput(rows, format));\n } else {\n console.log(formatOutput(events, format));\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n });\n\n audit\n .command(\"search <query>\")\n .description(\"Search audit events by keyword\")\n .action(async (query: string) => {\n const config = await loadConfig();\n const format = getOutputFormat(program, config);\n initAudit(getConfigDir());\n\n try {\n const events = await searchAuditEvents(query);\n if (events.length === 0 && format !== \"json\") {\n console.log(`No audit events matching \"${query}\".`);\n return;\n }\n if (format !== \"json\") {\n const rows = events.map((e) => ({\n timestamp: e.timestamp,\n command: e.command,\n app: e.app || \"-\",\n success: e.success !== undefined ? String(e.success) : \"-\",\n }));\n console.log(formatOutput(rows, format));\n } else {\n console.log(formatOutput(events, format));\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n });\n\n audit\n .command(\"clear\")\n .description(\"Clear audit log entries\")\n .option(\"--before <date>\", \"Clear entries before date (ISO 8601)\")\n .option(\"--dry-run\", \"Preview what would be cleared\")\n .action(async (options) => {\n const config = await loadConfig();\n const format = getOutputFormat(program, config);\n initAudit(getConfigDir());\n\n if (!options.dryRun && !options.before) {\n await requireConfirm(\"Clear all audit log entries?\", program);\n }\n\n try {\n const result = await clearAuditLog({\n before: options.before,\n dryRun: options.dryRun,\n });\n if (options.dryRun) {\n console.log(`[dry-run] Would delete ${result.deleted} entries, ${result.remaining} would remain.`);\n } else {\n console.log(`Deleted ${result.deleted} entries. ${result.remaining} remaining.`);\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n });\n}\n"],"mappings":";;;;;;;;;AACA,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,SAAS,sBAAsB,SAAwB;AAC5D,QAAM,QAAQ,QAAQ,QAAQ,OAAO,EAAE,YAAY,6BAA6B;AAEhF,QACG,QAAQ,MAAM,EACd,YAAY,0BAA0B,EACtC,OAAO,eAAe,0BAA0B,UAAU,EAAE,EAC5D,OAAO,kBAAkB,mCAAmC,EAC5D,OAAO,oBAAoB,wBAAwB,EACnD,OAAO,OAAO,YAAY;AACzB,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,SAAS,gBAAgB,SAAS,MAAM;AAC9C,cAAU,aAAa,CAAC;AAExB,QAAI;AACF,YAAM,SAAS,MAAM,gBAAgB;AAAA,QACnC,OAAO,QAAQ;AAAA,QACf,OAAO,QAAQ;AAAA,QACf,SAAS,QAAQ;AAAA,MACnB,CAAC;AACD,UAAI,OAAO,WAAW,KAAK,WAAW,QAAQ;AAC5C,gBAAQ,IAAI,wBAAwB;AACpC;AAAA,MACF;AACA,UAAI,WAAW,QAAQ;AACrB,cAAM,OAAO,OAAO,IAAI,CAAC,OAAO;AAAA,UAC9B,WAAW,EAAE;AAAA,UACb,SAAS,EAAE;AAAA,UACX,KAAK,EAAE,OAAO;AAAA,UACd,SAAS,EAAE,YAAY,SAAY,OAAO,EAAE,OAAO,I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AA+B,EACnD,OAAO,OAAO,YAAY;AACzB,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,SAAS,gBAAgB,SAAS,MAAM;AAC9C,cAAU,aAAa,CAAC;AAExB,QAAI,CAAC,QAAQ,UAAU,CAAC,QAAQ,QAAQ;AACtC,YAAM,eAAe,gCAAgC,OAAO;AAAA,IAC9D;AAEA,QAAI;AACF,YAAM,SAAS,MAAM,cAAc;AAAA,QACjC,QAAQ,QAAQ;AAAA,QAChB,QAAQ,QAAQ;AAAA,MAClB,CAAC;AACD,UAAI,QAAQ,QAAQ;AAClB,gBAAQ,IAAI,0BAA0B,OAAO,OAAO,aAAa,OAAO,SAAS,gBAAgB;AAAA,MACnG,OAAO;AACL,gBAAQ,IAAI,WAAW,OAAO,OAAO,aAAa,OAAO,SAAS,aAAa;AAAA,MACjF;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":[]}
|
package/dist/bin.js
CHANGED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
getOutputFormat
|
|
4
|
+
} from "./chunk-ELXAK7GI.js";
|
|
5
|
+
|
|
6
|
+
// src/commands/bundle.ts
|
|
7
|
+
import {
|
|
8
|
+
analyzeBundle,
|
|
9
|
+
compareBundles,
|
|
10
|
+
formatOutput
|
|
11
|
+
} from "@gpc-cli/core";
|
|
12
|
+
function formatSize(bytes) {
|
|
13
|
+
const abs = Math.abs(bytes);
|
|
14
|
+
const sign = bytes < 0 ? "-" : "";
|
|
15
|
+
if (abs < 1024) return `${sign}${abs} B`;
|
|
16
|
+
if (abs < 1024 * 1024) return `${sign}${(abs / 1024).toFixed(1)} KB`;
|
|
17
|
+
return `${sign}${(abs / (1024 * 1024)).toFixed(2)} MB`;
|
|
18
|
+
}
|
|
19
|
+
function formatDelta(delta) {
|
|
20
|
+
const prefix = delta > 0 ? "+" : "";
|
|
21
|
+
return `${prefix}${formatSize(delta)}`;
|
|
22
|
+
}
|
|
23
|
+
function registerBundleCommands(program) {
|
|
24
|
+
const bundle = program.command("bundle").description("Analyze app bundles and APKs");
|
|
25
|
+
bundle.command("analyze <file>").description("Analyze size breakdown of an AAB or APK").option("--threshold <mb>", "Fail if compressed size exceeds threshold (MB)", parseFloat).action(async (file, opts) => {
|
|
26
|
+
const format = getOutputFormat(program, await getConfig());
|
|
27
|
+
try {
|
|
28
|
+
const analysis = await analyzeBundle(file);
|
|
29
|
+
if (format === "json") {
|
|
30
|
+
console.log(formatOutput(analysis, format));
|
|
31
|
+
} else {
|
|
32
|
+
console.log(`
|
|
33
|
+
File: ${analysis.filePath}`);
|
|
34
|
+
console.log(`Type: ${analysis.fileType.toUpperCase()}`);
|
|
35
|
+
console.log(`Total compressed: ${formatSize(analysis.totalCompressed)}`);
|
|
36
|
+
console.log(`Total uncompressed: ${formatSize(analysis.totalUncompressed)}`);
|
|
37
|
+
console.log(`Entries: ${analysis.entryCount}
|
|
38
|
+
`);
|
|
39
|
+
const moduleRows = analysis.modules.map((m) => ({
|
|
40
|
+
module: m.name,
|
|
41
|
+
compressed: formatSize(m.compressedSize),
|
|
42
|
+
uncompressed: formatSize(m.uncompressedSize),
|
|
43
|
+
entries: m.entries
|
|
44
|
+
}));
|
|
45
|
+
console.log("Modules:");
|
|
46
|
+
console.log(formatOutput(moduleRows, "table"));
|
|
47
|
+
const categoryRows = analysis.categories.map((c) => ({
|
|
48
|
+
category: c.name,
|
|
49
|
+
compressed: formatSize(c.compressedSize),
|
|
50
|
+
uncompressed: formatSize(c.uncompressedSize),
|
|
51
|
+
entries: c.entries
|
|
52
|
+
}));
|
|
53
|
+
console.log("\nCategories:");
|
|
54
|
+
console.log(formatOutput(categoryRows, "table"));
|
|
55
|
+
}
|
|
56
|
+
if (opts.threshold !== void 0) {
|
|
57
|
+
const thresholdBytes = opts.threshold * 1024 * 1024;
|
|
58
|
+
if (analysis.totalCompressed > thresholdBytes) {
|
|
59
|
+
console.error(
|
|
60
|
+
`
|
|
61
|
+
Threshold breached: ${formatSize(analysis.totalCompressed)} > ${opts.threshold} MB`
|
|
62
|
+
);
|
|
63
|
+
process.exit(6);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {
|
|
67
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
bundle.command("compare <file1> <file2>").description("Compare size differences between two bundles or APKs").action(async (file1, file2) => {
|
|
72
|
+
const format = getOutputFormat(program, await getConfig());
|
|
73
|
+
try {
|
|
74
|
+
const [before, after] = await Promise.all([
|
|
75
|
+
analyzeBundle(file1),
|
|
76
|
+
analyzeBundle(file2)
|
|
77
|
+
]);
|
|
78
|
+
const comparison = compareBundles(before, after);
|
|
79
|
+
if (format === "json") {
|
|
80
|
+
console.log(formatOutput(comparison, format));
|
|
81
|
+
} else {
|
|
82
|
+
const sign = comparison.sizeDelta >= 0 ? "+" : "";
|
|
83
|
+
console.log(`
|
|
84
|
+
Before: ${comparison.before.path} (${formatSize(comparison.before.totalCompressed)})`);
|
|
85
|
+
console.log(`After: ${comparison.after.path} (${formatSize(comparison.after.totalCompressed)})`);
|
|
86
|
+
console.log(`Delta: ${sign}${formatSize(comparison.sizeDelta)} (${sign}${comparison.sizeDeltaPercent}%)
|
|
87
|
+
`);
|
|
88
|
+
const moduleRows = comparison.moduleDeltas.filter((m) => m.delta !== 0).map((m) => ({
|
|
89
|
+
module: m.module,
|
|
90
|
+
before: formatSize(m.before),
|
|
91
|
+
after: formatSize(m.after),
|
|
92
|
+
delta: formatDelta(m.delta)
|
|
93
|
+
}));
|
|
94
|
+
if (moduleRows.length > 0) {
|
|
95
|
+
console.log("Module changes:");
|
|
96
|
+
console.log(formatOutput(moduleRows, "table"));
|
|
97
|
+
}
|
|
98
|
+
const categoryRows = comparison.categoryDeltas.filter((c) => c.delta !== 0).map((c) => ({
|
|
99
|
+
category: c.category,
|
|
100
|
+
before: formatSize(c.before),
|
|
101
|
+
after: formatSize(c.after),
|
|
102
|
+
delta: formatDelta(c.delta)
|
|
103
|
+
}));
|
|
104
|
+
if (categoryRows.length > 0) {
|
|
105
|
+
console.log("\nCategory changes:");
|
|
106
|
+
console.log(formatOutput(categoryRows, "table"));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} catch (error) {
|
|
110
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
async function getConfig() {
|
|
116
|
+
const { loadConfig } = await import("@gpc-cli/config");
|
|
117
|
+
return loadConfig();
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
registerBundleCommands
|
|
121
|
+
};
|
|
122
|
+
//# sourceMappingURL=bundle-U7RF6HDE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/bundle.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport {\n analyzeBundle,\n compareBundles,\n formatOutput,\n} from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\n\nfunction formatSize(bytes: number): string {\n const abs = Math.abs(bytes);\n const sign = bytes < 0 ? \"-\" : \"\";\n if (abs < 1024) return `${sign}${abs} B`;\n if (abs < 1024 * 1024) return `${sign}${(abs / 1024).toFixed(1)} KB`;\n return `${sign}${(abs / (1024 * 1024)).toFixed(2)} MB`;\n}\n\nfunction formatDelta(delta: number): string {\n const prefix = delta > 0 ? \"+\" : \"\";\n return `${prefix}${formatSize(delta)}`;\n}\n\nexport function registerBundleCommands(program: Command): void {\n const bundle = program.command(\"bundle\").description(\"Analyze app bundles and APKs\");\n\n bundle\n .command(\"analyze <file>\")\n .description(\"Analyze size breakdown of an AAB or APK\")\n .option(\"--threshold <mb>\", \"Fail if compressed size exceeds threshold (MB)\", parseFloat)\n .action(async (file: string, opts: { threshold?: number }) => {\n const format = getOutputFormat(program, await getConfig());\n\n try {\n const analysis = await analyzeBundle(file);\n\n if (format === \"json\") {\n console.log(formatOutput(analysis, format));\n } else {\n console.log(`\\nFile: ${analysis.filePath}`);\n console.log(`Type: ${analysis.fileType.toUpperCase()}`);\n console.log(`Total compressed: ${formatSize(analysis.totalCompressed)}`);\n console.log(`Total uncompressed: ${formatSize(analysis.totalUncompressed)}`);\n console.log(`Entries: ${analysis.entryCount}\\n`);\n\n // Modules table\n const moduleRows = analysis.modules.map((m) => ({\n module: m.name,\n compressed: formatSize(m.compressedSize),\n uncompressed: formatSize(m.uncompressedSize),\n entries: m.entries,\n }));\n console.log(\"Modules:\");\n console.log(formatOutput(moduleRows, \"table\"));\n\n // Categories table\n const categoryRows = analysis.categories.map((c) => ({\n category: c.name,\n compressed: formatSize(c.compressedSize),\n uncompressed: formatSize(c.uncompressedSize),\n entries: c.entries,\n }));\n console.log(\"\\nCategories:\");\n console.log(formatOutput(categoryRows, \"table\"));\n }\n\n // Threshold check\n if (opts.threshold !== undefined) {\n const thresholdBytes = opts.threshold * 1024 * 1024;\n if (analysis.totalCompressed > thresholdBytes) {\n console.error(\n `\\nThreshold breached: ${formatSize(analysis.totalCompressed)} > ${opts.threshold} MB`,\n );\n process.exit(6);\n }\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n });\n\n bundle\n .command(\"compare <file1> <file2>\")\n .description(\"Compare size differences between two bundles or APKs\")\n .action(async (file1: string, file2: string) => {\n const format = getOutputFormat(program, await getConfig());\n\n try {\n const [before, after] = await Promise.all([\n analyzeBundle(file1),\n analyzeBundle(file2),\n ]);\n const comparison = compareBundles(before, after);\n\n if (format === \"json\") {\n console.log(formatOutput(comparison, format));\n } else {\n const sign = comparison.sizeDelta >= 0 ? \"+\" : \"\";\n console.log(`\\nBefore: ${comparison.before.path} (${formatSize(comparison.before.totalCompressed)})`);\n console.log(`After: ${comparison.after.path} (${formatSize(comparison.after.totalCompressed)})`);\n console.log(`Delta: ${sign}${formatSize(comparison.sizeDelta)} (${sign}${comparison.sizeDeltaPercent}%)\\n`);\n\n // Module deltas\n const moduleRows = comparison.moduleDeltas\n .filter((m) => m.delta !== 0)\n .map((m) => ({\n module: m.module,\n before: formatSize(m.before),\n after: formatSize(m.after),\n delta: formatDelta(m.delta),\n }));\n if (moduleRows.length > 0) {\n console.log(\"Module changes:\");\n console.log(formatOutput(moduleRows, \"table\"));\n }\n\n // Category deltas\n const categoryRows = comparison.categoryDeltas\n .filter((c) => c.delta !== 0)\n .map((c) => ({\n category: c.category,\n before: formatSize(c.before),\n after: formatSize(c.after),\n delta: formatDelta(c.delta),\n }));\n if (categoryRows.length > 0) {\n console.log(\"\\nCategory changes:\");\n console.log(formatOutput(categoryRows, \"table\"));\n }\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n });\n}\n\nasync function getConfig() {\n const { loadConfig } = await import(\"@gpc-cli/config\");\n return loadConfig();\n}\n"],"mappings":";;;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,WAAW,OAAuB;AACzC,QAAM,MAAM,KAAK,IAAI,KAAK;AAC1B,QAAM,OAAO,QAAQ,IAAI,MAAM;AAC/B,MAAI,MAAM,KAAM,QAAO,GAAG,IAAI,GAAG,GAAG;AACpC,MAAI,MAAM,OAAO,KAAM,QAAO,GAAG,IAAI,IAAI,MAAM,MAAM,QAAQ,CAAC,CAAC;AAC/D,SAAO,GAAG,IAAI,IAAI,OAAO,OAAO,OAAO,QAAQ,CAAC,CAAC;AACnD;AAEA,SAAS,YAAY,OAAuB;AAC1C,QAAM,SAAS,QAAQ,IAAI,MAAM;AACjC,SAAO,GAAG,MAAM,GAAG,WAAW,KAAK,CAAC;AACtC;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,WAAW,EAAE,MAAM;AAAA,UAC3B,OAAO,WAAW,EAAE,KAAK;AAAA,UACzB,OAAO,YAAY,EAAE,KAAK;AAAA,QAC5B,EAAE;AACJ,YAAI,WAAW,SAAS,GAAG;AACzB,kBAAQ,IAAI,iBAAiB;AAC7B,kBAAQ,IAAI,aAAa,YAAY,OAAO,CAAC;AAAA,QAC/C;AAGA,cAAM,eAAe,WAAW,eAC7B,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,EAC3B,IAAI,CAAC,OAAO;AAAA,UACX,UAAU,EAAE;AAAA,UACZ,QAAQ,WAAW,EAAE,MAAM;AAAA,UAC3B,OAAO,WAAW,EAAE,KAAK;AAAA,UACzB,OAAO,YAAY,EAAE,KAAK;AAAA,QAC5B,EAAE;AACJ,YAAI,aAAa,SAAS,GAAG;AAC3B,kBAAQ,IAAI,qBAAqB;AACjC,kBAAQ,IAAI,aAAa,cAAc,OAAO,CAAC;AAAA,QACjD;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;AAEA,eAAe,YAAY;AACzB,QAAM,EAAE,WAAW,IAAI,MAAM,OAAO,iBAAiB;AACrD,SAAO,WAAW;AACpB;","names":[]}
|
|
@@ -88,10 +88,10 @@ async function createProgram(pluginManager) {
|
|
|
88
88
|
(await import("./apps-CVBURB5V.js")).registerAppsCommands(program);
|
|
89
89
|
},
|
|
90
90
|
releases: async () => {
|
|
91
|
-
(await import("./releases-
|
|
91
|
+
(await import("./releases-ZKPSAPB2.js")).registerReleasesCommands(program);
|
|
92
92
|
},
|
|
93
93
|
tracks: async () => {
|
|
94
|
-
(await import("./tracks-
|
|
94
|
+
(await import("./tracks-XFUN7JJX.js")).registerTracksCommands(program);
|
|
95
95
|
},
|
|
96
96
|
status: async () => {
|
|
97
97
|
(await import("./status-S3FAEXNH.js")).registerStatusCommand(program);
|
|
@@ -100,31 +100,31 @@ async function createProgram(pluginManager) {
|
|
|
100
100
|
(await import("./listings-VSBHQY5H.js")).registerListingsCommands(program);
|
|
101
101
|
},
|
|
102
102
|
reviews: async () => {
|
|
103
|
-
(await import("./reviews-
|
|
103
|
+
(await import("./reviews-GJAQ5OVC.js")).registerReviewsCommands(program);
|
|
104
104
|
},
|
|
105
105
|
vitals: async () => {
|
|
106
|
-
(await import("./vitals-
|
|
106
|
+
(await import("./vitals-GDIQFWHV.js")).registerVitalsCommands(program);
|
|
107
107
|
},
|
|
108
108
|
subscriptions: async () => {
|
|
109
109
|
(await import("./subscriptions-Z5ZPVUFM.js")).registerSubscriptionsCommands(program);
|
|
110
110
|
},
|
|
111
111
|
iap: async () => {
|
|
112
|
-
(await import("./iap-
|
|
112
|
+
(await import("./iap-BBHF7BLZ.js")).registerIapCommands(program);
|
|
113
113
|
},
|
|
114
114
|
purchases: async () => {
|
|
115
|
-
(await import("./purchases-
|
|
115
|
+
(await import("./purchases-YRO6B7M6.js")).registerPurchasesCommands(program);
|
|
116
116
|
},
|
|
117
117
|
pricing: async () => {
|
|
118
118
|
(await import("./pricing-BYZSLN74.js")).registerPricingCommands(program);
|
|
119
119
|
},
|
|
120
120
|
reports: async () => {
|
|
121
|
-
(await import("./reports-
|
|
121
|
+
(await import("./reports-N5X66IUN.js")).registerReportsCommands(program);
|
|
122
122
|
},
|
|
123
123
|
users: async () => {
|
|
124
|
-
(await import("./users-
|
|
124
|
+
(await import("./users-JASXONRY.js")).registerUsersCommands(program);
|
|
125
125
|
},
|
|
126
126
|
testers: async () => {
|
|
127
|
-
(await import("./testers-
|
|
127
|
+
(await import("./testers-UWSUGGVT.js")).registerTestersCommands(program);
|
|
128
128
|
},
|
|
129
129
|
validate: async () => {
|
|
130
130
|
(await import("./validate-UYXICKBO.js")).registerValidateCommand(program);
|
|
@@ -136,7 +136,7 @@ async function createProgram(pluginManager) {
|
|
|
136
136
|
(await import("./recovery-S5UNJDBO.js")).registerRecoveryCommands(program);
|
|
137
137
|
},
|
|
138
138
|
"data-safety": async () => {
|
|
139
|
-
(await import("./data-safety-
|
|
139
|
+
(await import("./data-safety-GDPKV5PN.js")).registerDataSafetyCommands(program);
|
|
140
140
|
},
|
|
141
141
|
"external-transactions": async () => {
|
|
142
142
|
(await import("./external-transactions-HCL7ROMN.js")).registerExternalTransactionsCommands(
|
|
@@ -144,13 +144,13 @@ async function createProgram(pluginManager) {
|
|
|
144
144
|
);
|
|
145
145
|
},
|
|
146
146
|
"device-tiers": async () => {
|
|
147
|
-
(await import("./device-tiers-
|
|
147
|
+
(await import("./device-tiers-GHIYJPMB.js")).registerDeviceTiersCommands(program);
|
|
148
148
|
},
|
|
149
149
|
"one-time-products": async () => {
|
|
150
150
|
(await import("./one-time-products-2PK4QKWE.js")).registerOneTimeProductsCommands(program);
|
|
151
151
|
},
|
|
152
152
|
"internal-sharing": async () => {
|
|
153
|
-
(await import("./internal-sharing-
|
|
153
|
+
(await import("./internal-sharing-E7SJYDW3.js")).registerInternalSharingCommands(program);
|
|
154
154
|
},
|
|
155
155
|
"generated-apks": async () => {
|
|
156
156
|
(await import("./generated-apks-VX7HYZDU.js")).registerGeneratedApksCommands(program);
|
|
@@ -158,6 +158,12 @@ async function createProgram(pluginManager) {
|
|
|
158
158
|
"purchase-options": async () => {
|
|
159
159
|
(await import("./purchase-options-CKRN4VIW.js")).registerPurchaseOptionsCommands(program);
|
|
160
160
|
},
|
|
161
|
+
bundle: async () => {
|
|
162
|
+
(await import("./bundle-U7RF6HDE.js")).registerBundleCommands(program);
|
|
163
|
+
},
|
|
164
|
+
audit: async () => {
|
|
165
|
+
(await import("./audit-DSTCSU4V.js")).registerAuditCommands(program);
|
|
166
|
+
},
|
|
161
167
|
migrate: async () => {
|
|
162
168
|
(await import("./migrate-V6G5YUVH.js")).registerMigrateCommands(program);
|
|
163
169
|
},
|
|
@@ -302,4 +308,4 @@ export {
|
|
|
302
308
|
createProgram,
|
|
303
309
|
handleCliError
|
|
304
310
|
};
|
|
305
|
-
//# sourceMappingURL=chunk-
|
|
311
|
+
//# sourceMappingURL=chunk-CE2HXEJX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugins.ts","../src/program.ts","../src/error-handler.ts"],"sourcesContent":["import { PluginManager, discoverPlugins } from \"@gpc-cli/core\";\nimport type { Command } from \"commander\";\n\n/**\n * Load and initialize all plugins.\n * First-party plugins (@gpc-cli/*) are auto-trusted.\n * Third-party plugins require prior approval stored in config.\n * Plugin loading is disabled in standalone binary mode.\n */\nexport async function loadPlugins(): Promise<PluginManager> {\n const manager = new PluginManager();\n\n // Standalone binary cannot resolve external npm packages at runtime\n if (process.env[\"__GPC_BINARY\"] === \"1\") {\n return manager;\n }\n\n try {\n const { loadConfig } = await import(\"@gpc-cli/config\");\n const config = await loadConfig();\n const plugins = await discoverPlugins({ configPlugins: config.plugins });\n const approved = new Set(config.approvedPlugins ?? []);\n\n for (const plugin of plugins) {\n const isTrusted = plugin.name.startsWith(\"@gpc-cli/\");\n\n if (!isTrusted && !approved.has(plugin.name)) {\n // Skip unapproved third-party plugins silently in non-interactive mode\n // In interactive mode, the user would run `gpc plugins approve <name>` first\n const isQuiet = process.argv.includes(\"--quiet\") || process.argv.includes(\"-q\");\n if (!isQuiet) {\n console.error(\n `Plugin \"${plugin.name}\" is not approved. Run: gpc plugins approve ${plugin.name}`,\n );\n }\n continue;\n }\n\n try {\n await manager.load(plugin);\n } catch {\n // Skip plugins that fail to load — don't block the CLI\n }\n }\n } catch {\n // Config loading failure shouldn't block plugin-free commands\n }\n\n return manager;\n}\n\n/**\n * Register plugin-defined commands with the Commander program.\n */\nexport function registerPluginCommands(program: Command, manager: PluginManager): void {\n for (const def of manager.getRegisteredCommands()) {\n const cmd = program.command(def.name).description(def.description);\n\n if (def.arguments) {\n for (const arg of def.arguments) {\n const syntax = arg.required ? `<${arg.name}>` : `[${arg.name}]`;\n cmd.argument(syntax, arg.description);\n }\n }\n\n if (def.options) {\n for (const opt of def.options) {\n cmd.option(\n opt.flags,\n opt.description,\n opt.defaultValue as string | boolean | string[] | undefined,\n );\n }\n }\n\n cmd.action(async (...rawArgs: unknown[]) => {\n const opts = rawArgs[rawArgs.length - 2] as Record<string, unknown>;\n const args: Record<string, unknown> = {};\n\n if (def.arguments) {\n def.arguments.forEach((argDef, i) => {\n args[argDef.name] = rawArgs[i];\n });\n }\n\n await def.action(args, opts);\n });\n }\n}\n","import { Command } from \"commander\";\nimport type { PluginManager } from \"@gpc-cli/core\";\nimport type { CommandEvent, CommandResult } from \"@gpc-cli/plugin-sdk\";\nimport { registerPluginCommands } from \"./plugins.js\";\n\nexport async function createProgram(pluginManager?: PluginManager): Promise<Command> {\n const program = new Command();\n\n program\n .name(\"gpc\")\n .description(\"The complete Google Play CLI\")\n .version(process.env[\"__GPC_VERSION\"] || \"0.0.0\", \"-V, --version\")\n .option(\"-o, --output <format>\", \"Output format: table, json, yaml, markdown, junit\")\n .option(\"-v, --verbose\", \"Enable debug logging\")\n .option(\"-q, --quiet\", \"Suppress non-essential output\")\n .option(\"-a, --app <package>\", \"App package name\")\n .option(\"-p, --profile <name>\", \"Auth profile name\")\n .option(\"--no-color\", \"Disable colored output\")\n .option(\"--no-interactive\", \"Disable interactive prompts\")\n .option(\"-y, --yes\", \"Skip confirmation prompts\")\n .option(\"--dry-run\", \"Preview changes without executing\")\n .option(\"--notify [target]\", \"Send webhook notification on completion (slack, discord, custom)\")\n .option(\"--ci\", \"Force CI mode (JSON output, no prompts, strict exit codes)\")\n .option(\"-j, --json\", \"Shorthand for --output json\")\n .showSuggestionAfterError(true);\n\n const commandLoaders: Record<string, () => Promise<void>> = {\n auth: async () => {\n (await import(\"./commands/auth.js\")).registerAuthCommands(program);\n },\n config: async () => {\n (await import(\"./commands/config.js\")).registerConfigCommands(program);\n },\n doctor: async () => {\n (await import(\"./commands/doctor.js\")).registerDoctorCommand(program);\n },\n docs: async () => {\n (await import(\"./commands/docs.js\")).registerDocsCommand(program);\n },\n completion: async () => {\n (await import(\"./commands/completion.js\")).registerCompletionCommand(program);\n },\n apps: async () => {\n (await import(\"./commands/apps.js\")).registerAppsCommands(program);\n },\n releases: async () => {\n (await import(\"./commands/releases.js\")).registerReleasesCommands(program);\n },\n tracks: async () => {\n (await import(\"./commands/tracks.js\")).registerTracksCommands(program);\n },\n status: async () => {\n (await import(\"./commands/status.js\")).registerStatusCommand(program);\n },\n listings: async () => {\n (await import(\"./commands/listings.js\")).registerListingsCommands(program);\n },\n reviews: async () => {\n (await import(\"./commands/reviews.js\")).registerReviewsCommands(program);\n },\n vitals: async () => {\n (await import(\"./commands/vitals.js\")).registerVitalsCommands(program);\n },\n subscriptions: async () => {\n (await import(\"./commands/subscriptions.js\")).registerSubscriptionsCommands(program);\n },\n iap: async () => {\n (await import(\"./commands/iap.js\")).registerIapCommands(program);\n },\n purchases: async () => {\n (await import(\"./commands/purchases.js\")).registerPurchasesCommands(program);\n },\n pricing: async () => {\n (await import(\"./commands/pricing.js\")).registerPricingCommands(program);\n },\n reports: async () => {\n (await import(\"./commands/reports.js\")).registerReportsCommands(program);\n },\n users: async () => {\n (await import(\"./commands/users.js\")).registerUsersCommands(program);\n },\n testers: async () => {\n (await import(\"./commands/testers.js\")).registerTestersCommands(program);\n },\n validate: async () => {\n (await import(\"./commands/validate.js\")).registerValidateCommand(program);\n },\n publish: async () => {\n (await import(\"./commands/publish.js\")).registerPublishCommand(program);\n },\n recovery: async () => {\n (await import(\"./commands/recovery.js\")).registerRecoveryCommands(program);\n },\n \"data-safety\": async () => {\n (await import(\"./commands/data-safety.js\")).registerDataSafetyCommands(program);\n },\n \"external-transactions\": async () => {\n (await import(\"./commands/external-transactions.js\")).registerExternalTransactionsCommands(\n program,\n );\n },\n \"device-tiers\": async () => {\n (await import(\"./commands/device-tiers.js\")).registerDeviceTiersCommands(program);\n },\n \"one-time-products\": async () => {\n (await import(\"./commands/one-time-products.js\")).registerOneTimeProductsCommands(program);\n },\n \"internal-sharing\": async () => {\n (await import(\"./commands/internal-sharing.js\")).registerInternalSharingCommands(program);\n },\n \"generated-apks\": async () => {\n (await import(\"./commands/generated-apks.js\")).registerGeneratedApksCommands(program);\n },\n \"purchase-options\": async () => {\n (await import(\"./commands/purchase-options.js\")).registerPurchaseOptionsCommands(program);\n },\n bundle: async () => {\n (await import(\"./commands/bundle.js\")).registerBundleCommands(program);\n },\n audit: async () => {\n (await import(\"./commands/audit.js\")).registerAuditCommands(program);\n },\n migrate: async () => {\n (await import(\"./commands/migrate.js\")).registerMigrateCommands(program);\n },\n \"install-skills\": async () => {\n (await import(\"./commands/install-skills.js\")).registerInstallSkillsCommand(program);\n },\n plugins: async () => {\n registerPluginsCommand(program, pluginManager);\n },\n };\n\n // Resolve command aliases for lazy loading\n const commandAliases: Record<string, string> = {\n \"ext-txn\": \"external-transactions\",\n otp: \"one-time-products\",\n };\n\n const rawTarget = process.argv[2];\n const target = rawTarget ? (commandAliases[rawTarget] ?? rawTarget) : undefined;\n\n const loader = target ? commandLoaders[target] : undefined;\n if (loader) {\n await loader();\n } else {\n await Promise.all(Object.values(commandLoaders).map((loader) => loader()));\n }\n\n // Register plugin-defined commands\n if (pluginManager) {\n registerPluginCommands(program, pluginManager);\n }\n\n // Wire plugin lifecycle hooks around command execution\n if (pluginManager) {\n wrapCommandHooks(program, pluginManager);\n }\n\n return program;\n}\n\n/**\n * `gpc plugins` — manage plugins.\n */\nfunction registerPluginsCommand(program: Command, manager?: PluginManager): void {\n const cmd = program.command(\"plugins\").description(\"Manage plugins\");\n\n cmd\n .command(\"list\")\n .description(\"List loaded plugins\")\n .action(() => {\n const plugins = manager?.getLoadedPlugins() ?? [];\n const opts = program.opts();\n\n if (opts[\"output\"] === \"json\") {\n console.log(JSON.stringify(plugins, null, 2));\n return;\n }\n\n if (plugins.length === 0) {\n console.log(\"No plugins loaded.\");\n console.log('\\nConfigure plugins in .gpcrc.json: { \"plugins\": [\"@gpc-cli/plugin-ci\"] }');\n return;\n }\n\n console.log(\"Loaded plugins:\\n\");\n for (const p of plugins) {\n const trust = p.trusted ? \"trusted\" : \"third-party\";\n console.log(` ${p.name}@${p.version} (${trust})`);\n }\n\n const commands = manager?.getRegisteredCommands() ?? [];\n if (commands.length > 0) {\n console.log(\"\\nPlugin commands:\\n\");\n for (const c of commands) {\n console.log(` gpc ${c.name} — ${c.description}`);\n }\n }\n });\n\n cmd\n .command(\"init <name>\")\n .description(\"Scaffold a new plugin project\")\n .option(\"-d, --dir <path>\", \"Output directory (defaults to ./gpc-plugin-<name>)\")\n .option(\"--description <text>\", \"Plugin description\")\n .action(async (name: string, opts: { dir?: string; description?: string }) => {\n const { scaffoldPlugin } = await import(\"@gpc-cli/core\");\n const pluginName = name.startsWith(\"gpc-plugin-\") ? name : `gpc-plugin-${name}`;\n const dir = opts.dir ?? `./${pluginName}`;\n\n const result = await scaffoldPlugin({ name, dir, description: opts.description });\n\n console.log(`Plugin scaffolded at ${result.dir}/\\n`);\n console.log(\"Files created:\");\n for (const f of result.files) {\n console.log(` ${f}`);\n }\n console.log(`\\nNext steps:`);\n console.log(` cd ${pluginName}`);\n console.log(` npm install`);\n console.log(` npm run build`);\n console.log(` npm test`);\n });\n\n cmd\n .command(\"approve <name>\")\n .description(\"Approve a third-party plugin for loading\")\n .action(async (name: string) => {\n const { approvePlugin } = await import(\"@gpc-cli/config\");\n await approvePlugin(name);\n console.log(`Plugin \"${name}\" approved. It will be loaded on next run.`);\n });\n\n cmd\n .command(\"revoke <name>\")\n .description(\"Revoke approval for a third-party plugin\")\n .action(async (name: string) => {\n const { revokePluginApproval } = await import(\"@gpc-cli/config\");\n const removed = await revokePluginApproval(name);\n if (removed) {\n console.log(`Plugin \"${name}\" approval revoked.`);\n } else {\n console.log(`Plugin \"${name}\" was not in the approved list.`);\n }\n });\n}\n\n/**\n * Wrap all registered commands so plugin hooks fire before/after each command.\n */\nfunction wrapCommandHooks(program: Command, manager: PluginManager): void {\n program.hook(\"preAction\", async (thisCommand) => {\n const event: CommandEvent = {\n command: getFullCommandName(thisCommand),\n args: thisCommand.opts(),\n app: program.opts()[\"app\"] as string | undefined,\n startedAt: new Date(),\n };\n\n // Store on the command for afterCommand/onError\n (thisCommand as unknown as Record<string, unknown>)[\"__pluginEvent\"] = event;\n\n await manager.runBeforeCommand(event);\n });\n\n program.hook(\"postAction\", async (thisCommand) => {\n const event: CommandEvent = (thisCommand as unknown as Record<string, unknown>)[\n \"__pluginEvent\"\n ] as CommandEvent;\n if (!event) return;\n\n const result: CommandResult = {\n success: true,\n durationMs: Date.now() - event.startedAt.getTime(),\n exitCode: 0,\n };\n\n await manager.runAfterCommand(event, result);\n });\n}\n\nfunction getFullCommandName(cmd: Command): string {\n const parts: string[] = [];\n let current: Command | null = cmd;\n while (current && current.name() !== \"gpc\") {\n parts.unshift(current.name());\n current = current.parent;\n }\n return parts.join(\" \");\n}\n","/**\n * Shared error formatting for CLI output.\n * Extracts error code, message, and suggestion from typed errors (GpcError, AuthError, ApiError, ConfigError).\n */\n\ninterface TypedError {\n message: string;\n code?: string;\n suggestion?: string;\n exitCode?: number;\n}\n\nfunction isTypedError(error: unknown): error is Error & TypedError {\n return error instanceof Error && \"code\" in error && typeof (error as TypedError).code === \"string\";\n}\n\n/**\n * Format an error for CLI output. Prints:\n * Error [CODE]: message\n * Suggestion: suggestion (if available)\n *\n * Returns the appropriate exit code.\n */\nexport function handleCliError(error: unknown): number {\n if (isTypedError(error)) {\n console.error(`Error [${error.code}]: ${error.message}`);\n if (error.suggestion) {\n console.error(`Suggestion: ${error.suggestion}`);\n }\n return error.exitCode ?? 1;\n }\n\n const message = error instanceof Error ? error.message : String(error);\n console.error(`Error: ${message}`);\n return 1;\n}\n"],"mappings":";;;AAAA,SAAS,eAAe,uBAAuB;AAS/C,eAAsB,cAAsC;AAC1D,QAAM,UAAU,IAAI,cAAc;AAGlC,MAAI,QAAQ,IAAI,cAAc,MAAM,KAAK;AACvC,WAAO;AAAA,E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AAI,MAAM,MAAM,OAAO,EAAE;AACvD,QAAI,MAAM,YAAY;AACpB,cAAQ,MAAM,eAAe,MAAM,UAAU,EAAE;AAAA,IACjD;AACA,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,QAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,UAAQ,MAAM,UAAU,OAAO,EAAE;AACjC,SAAO;AACT;","names":["loader"]}
|
|
@@ -37,7 +37,7 @@ function registerDataSafetyCommands(program) {
|
|
|
37
37
|
console.error(" https://play.google.com/console \u2192 App content \u2192 Data safety");
|
|
38
38
|
console.error("");
|
|
39
39
|
console.error("To update data safety via the API, use: gpc data-safety update --file <csv-file>");
|
|
40
|
-
process.exit(
|
|
40
|
+
process.exit(2);
|
|
41
41
|
});
|
|
42
42
|
dataSafety.command("update").description("Update data safety declaration from a JSON file").requiredOption("--file <path>", "Path to data safety JSON file").action(async (options) => {
|
|
43
43
|
const config = await loadConfig();
|
|
@@ -70,10 +70,10 @@ function registerDataSafetyCommands(program) {
|
|
|
70
70
|
console.error("");
|
|
71
71
|
console.error("To export your data safety declaration, use the Google Play Console:");
|
|
72
72
|
console.error(" App content \u2192 Data safety \u2192 Export to CSV");
|
|
73
|
-
process.exit(
|
|
73
|
+
process.exit(2);
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
export {
|
|
77
77
|
registerDataSafetyCommands
|
|
78
78
|
};
|
|
79
|
-
//# sourceMappingURL=data-safety-
|
|
79
|
+
//# sourceMappingURL=data-safety-GDPKV5PN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/data-safety.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 getDataSafety,\n updateDataSafety,\n exportDataSafety,\n importDataSafety,\n formatOutput,\n} from \"@gpc-cli/core\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { getOutputFormat } from \"../format.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 registerDataSafetyCommands(program: Command): void {\n const dataSafety = program\n .command(\"data-safety\")\n .description(\"Manage data safety declarations\");\n\n // Get — not supported by Google Play API (no GET endpoint for data safety)\n dataSafety\n .command(\"get\")\n .description(\"Get the current data safety declaration\")\n .action(async () => {\n console.error(\"Error: The Google Play Developer API does not provide a GET endpoint for data safety declarations.\");\n console.error(\"\");\n console.error(\"Data safety labels can only be updated (not read) via the API.\");\n console.error(\"To view your current data safety declaration, use the Google Play Console:\");\n console.error(\" https://play.google.com/console → App content → Data safety\");\n console.error(\"\");\n console.error(\"To update data safety via the API, use: gpc data-safety update --file <csv-file>\");\n process.exit(
|
|
1
|
+
{"version":3,"sources":["../src/commands/data-safety.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 getDataSafety,\n updateDataSafety,\n exportDataSafety,\n importDataSafety,\n formatOutput,\n} from \"@gpc-cli/core\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { getOutputFormat } from \"../format.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 registerDataSafetyCommands(program: Command): void {\n const dataSafety = program\n .command(\"data-safety\")\n .description(\"Manage data safety declarations\");\n\n // Get — not supported by Google Play API (no GET endpoint for data safety)\n dataSafety\n .command(\"get\")\n .description(\"Get the current data safety declaration\")\n .action(async () => {\n console.error(\"Error: The Google Play Developer API does not provide a GET endpoint for data safety declarations.\");\n console.error(\"\");\n console.error(\"Data safety labels can only be updated (not read) via the API.\");\n console.error(\"To view your current data safety declaration, use the Google Play Console:\");\n console.error(\" https://play.google.com/console → App content → Data safety\");\n console.error(\"\");\n console.error(\"To update data safety via the API, use: gpc data-safety update --file <csv-file>\");\n process.exit(2);\n });\n\n // Update\n dataSafety\n .command(\"update\")\n .description(\"Update data safety declaration from a JSON file\")\n .requiredOption(\"--file <path>\", \"Path to data safety JSON file\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"data-safety update\",\n action: \"update data safety from\",\n target: options.file,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const result = await importDataSafety(client, packageName, options.file);\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 // Export — not supported (no GET endpoint)\n dataSafety\n .command(\"export\")\n .description(\"Export data safety declaration to a JSON file\")\n .option(\"--output <path>\", \"Output file path\", \"data-safety.json\")\n .action(async () => {\n console.error(\"Error: The Google Play Developer API does not provide a GET endpoint for data safety declarations.\");\n console.error(\"Data safety labels cannot be exported via the API.\");\n console.error(\"\");\n console.error(\"To export your data safety declaration, use the Google Play Console:\");\n console.error(\" App content → Data safety → Export to CSV\");\n process.exit(2);\n });\n}\n"],"mappings":";;;;;;;;;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAA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BAAiB,QAAQ,aAAa,QAAQ,IAAI;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;AAGH,aACG,QAAQ,QAAQ,EAChB,YAAY,+CAA+C,EAC3D,OAAO,mBAAmB,oBAAoB,kBAAkB,EAChE,OAAO,YAAY;AAClB,YAAQ,MAAM,oGAAoG;AAClH,YAAQ,MAAM,oDAAoD;AAClE,YAAQ,MAAM,EAAE;AAChB,YAAQ,MAAM,sEAAsE;AACpF,YAAQ,MAAM,uDAA6C;AAC3D,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACL;","names":[]}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
isDryRun,
|
|
4
|
+
printDryRun
|
|
5
|
+
} from "./chunk-Y3QZDAKS.js";
|
|
2
6
|
import {
|
|
3
7
|
getOutputFormat
|
|
4
8
|
} from "./chunk-ELXAK7GI.js";
|
|
@@ -40,7 +44,16 @@ function registerDeviceTiersCommands(program) {
|
|
|
40
44
|
console.log("No device tier configs found.");
|
|
41
45
|
return;
|
|
42
46
|
}
|
|
43
|
-
|
|
47
|
+
if (format !== "json" && configs) {
|
|
48
|
+
const rows = configs.map((c) => ({
|
|
49
|
+
deviceTierConfigId: c["deviceTierConfigId"] || "-",
|
|
50
|
+
deviceGroups: Array.isArray(c["deviceGroups"]) ? c["deviceGroups"].length : 0,
|
|
51
|
+
deviceTierSet: c["deviceTierSet"] ? "yes" : "no"
|
|
52
|
+
}));
|
|
53
|
+
console.log(formatOutput(rows, format));
|
|
54
|
+
} else {
|
|
55
|
+
console.log(formatOutput(result, format));
|
|
56
|
+
}
|
|
44
57
|
} catch (error) {
|
|
45
58
|
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
46
59
|
process.exit(4);
|
|
@@ -62,8 +75,16 @@ function registerDeviceTiersCommands(program) {
|
|
|
62
75
|
dt.command("create").description("Create a device tier configuration from a JSON file").requiredOption("--file <path>", "Path to JSON config file").action(async (opts) => {
|
|
63
76
|
const config = await loadConfig();
|
|
64
77
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
65
|
-
const client = await getClient(config);
|
|
66
78
|
const format = getOutputFormat(program, config);
|
|
79
|
+
if (isDryRun(program)) {
|
|
80
|
+
printDryRun(
|
|
81
|
+
{ command: "device-tiers create", action: "create device tier config from", target: opts.file },
|
|
82
|
+
format,
|
|
83
|
+
formatOutput
|
|
84
|
+
);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const client = await getClient(config);
|
|
67
88
|
try {
|
|
68
89
|
const raw = await readFile(opts.file, "utf-8");
|
|
69
90
|
const tierConfig = JSON.parse(raw);
|
|
@@ -78,4 +99,4 @@ function registerDeviceTiersCommands(program) {
|
|
|
78
99
|
export {
|
|
79
100
|
registerDeviceTiersCommands
|
|
80
101
|
};
|
|
81
|
-
//# sourceMappingURL=device-tiers-
|
|
102
|
+
//# sourceMappingURL=device-tiers-GHIYJPMB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/device-tiers.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 listDeviceTiers,\n getDeviceTier,\n createDeviceTier,\n formatOutput,\n} from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { readFile } from \"node:fs/promises\";\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 registerDeviceTiersCommands(program: Command): void {\n const dt = program.command(\"device-tiers\").description(\"Manage device tier configurations\");\n\n dt.command(\"list\")\n .description(\"List device tier configurations\")\n .action(async () => {\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 listDeviceTiers(client, packageName);\n const configs = (result as Record<string, unknown>)[\"deviceTierConfigs\"] as Record<string, unknown>[] | undefined;\n if (format !== \"json\" && (!configs || configs.length === 0)) {\n console.log(\"No device tier configs found.\");\n return;\n }\n if (format !== \"json\" && configs) {\n const rows = configs.map((c) => ({\n deviceTierConfigId: c[\"deviceTierConfigId\"] || \"-\",\n deviceGroups: Array.isArray(c[\"deviceGroups\"]) ? (c[\"deviceGroups\"] as unknown[]).length : 0,\n deviceTierSet: c[\"deviceTierSet\"] ? \"yes\" : \"no\",\n }));\n console.log(formatOutput(rows, format));\n } else {\n console.log(formatOutput(result, format));\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n dt.command(\"get <config-id>\")\n .description(\"Get a device tier configuration\")\n .action(async (configId: string) => {\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 getDeviceTier(client, packageName, configId);\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 dt.command(\"create\")\n .description(\"Create a device tier configuration from a JSON file\")\n .requiredOption(\"--file <path>\", \"Path to JSON config file\")\n .action(async (opts: { file: string }) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n\n if (isDryRun(program)) {\n printDryRun(\n { command: \"device-tiers create\", action: \"create device tier config from\", target: opts.file },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const raw = await readFile(opts.file, \"utf-8\");\n const tierConfig = JSON.parse(raw);\n const result = await createDeviceTier(client, packageName, tierConfig);\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;AAGP,SAAS,gBAAgB;AAEzB,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,4BAA4B,SAAwB;AAClE,QAAM,KAAK,QAAQ,QAAQ,cAAc,EAAE,YAAY,mCAAmC;AAE1F,KAAG,QAAQ,MAAM,EACd,YAAY,iCAAiC,EAC7C,OAAO,YAAY;AAClB,UAAM,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,gBAAgB,QAAQ,WAAW;AACxD,YAAM,UAAW,OAAmC,mBAAmB;AACvE,U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2B;AACxC,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,mBAAmB,QAAQ,KAAK,EAAE,KAAK,GAAG,MAAM;AACpE,UAAM,SAAS,gBAAgB,SAAS,MAAM;AAE9C,QAAI,SAAS,OAAO,GAAG;AACrB;AAAA,QACE,EAAE,SAAS,uBAAuB,QAAQ,kCAAkC,QAAQ,KAAK,KAAK;AAAA,QAC9F;AAAA,QACA;AAAA,MACF;AACA;AAAA,IACF;AAEA,UAAM,SAAS,MAAM,UAAU,MAAM;AAErC,QAAI;AACF,YAAM,MAAM,MAAM,SAAS,KAAK,MAAM,OAAO;AAC7C,YAAM,aAAa,KAAK,MAAM,GAAG;AACjC,YAAM,SAAS,MAAM,iBAAiB,QAAQ,aAAa,UAAU;AACrE,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":[]}
|
|
@@ -176,8 +176,88 @@ function registerIapCommands(program) {
|
|
|
176
176
|
process.exit(4);
|
|
177
177
|
}
|
|
178
178
|
});
|
|
179
|
+
iap.command("batch-get").description("Batch get multiple in-app products").option("--skus <skus>", "Comma-separated list of SKUs").option("--file <path>", "JSON file with array of SKUs").action(async (options) => {
|
|
180
|
+
const config = await loadConfig();
|
|
181
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
182
|
+
const client = await getClient(config);
|
|
183
|
+
const format = getOutputFormat(program, config);
|
|
184
|
+
let skus;
|
|
185
|
+
if (options.file) {
|
|
186
|
+
const data = await readJsonFile(options.file);
|
|
187
|
+
skus = Array.isArray(data) ? data : data["skus"] || [];
|
|
188
|
+
} else if (options.skus) {
|
|
189
|
+
skus = options.skus.split(",").map((s) => s.trim());
|
|
190
|
+
} else {
|
|
191
|
+
console.error("Error: Provide --skus <sku1,sku2,...> or --file <path>");
|
|
192
|
+
process.exit(2);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
console.error("Note: Using inappproducts batch API");
|
|
196
|
+
try {
|
|
197
|
+
const products = await client.inappproducts.batchGet(packageName, skus);
|
|
198
|
+
if (format !== "json") {
|
|
199
|
+
const rows = products.map((p) => ({
|
|
200
|
+
sku: p["sku"] || "-",
|
|
201
|
+
status: p["status"] || "-",
|
|
202
|
+
purchaseType: p["purchaseType"] || "-",
|
|
203
|
+
defaultPrice: (() => {
|
|
204
|
+
const price = p["defaultPrice"];
|
|
205
|
+
return price ? `${price["priceMicros"] ? Number(price["priceMicros"]) / 1e6 : "-"} ${price["currency"] || ""}` : "-";
|
|
206
|
+
})()
|
|
207
|
+
}));
|
|
208
|
+
console.log(formatOutput(rows, format));
|
|
209
|
+
} else {
|
|
210
|
+
console.log(formatOutput(products, format));
|
|
211
|
+
}
|
|
212
|
+
} catch (error) {
|
|
213
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
214
|
+
process.exit(4);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
iap.command("batch-update").description("Batch update multiple in-app products from a JSON file").requiredOption("--file <path>", "JSON file with array of product objects").option("--dry-run", "Preview changes without executing").action(async (options) => {
|
|
218
|
+
const config = await loadConfig();
|
|
219
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
220
|
+
const format = getOutputFormat(program, config);
|
|
221
|
+
if (options.dryRun || isDryRun(program)) {
|
|
222
|
+
const data = await readJsonFile(options.file);
|
|
223
|
+
const products = Array.isArray(data) ? data : [];
|
|
224
|
+
console.log(`[dry-run] Would batch update ${products.length} product(s)`);
|
|
225
|
+
if (format !== "json") {
|
|
226
|
+
const rows = products.map((p) => ({
|
|
227
|
+
sku: p["sku"] || "-",
|
|
228
|
+
action: "update"
|
|
229
|
+
}));
|
|
230
|
+
console.log(formatOutput(rows, format));
|
|
231
|
+
} else {
|
|
232
|
+
console.log(formatOutput(products, format));
|
|
233
|
+
}
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const client = await getClient(config);
|
|
237
|
+
console.error("Note: Using inappproducts batch API");
|
|
238
|
+
const spinner = createSpinner("Batch updating products...");
|
|
239
|
+
if (!program.opts()["quiet"] && process.stderr.isTTY) spinner.start();
|
|
240
|
+
try {
|
|
241
|
+
const data = await readJsonFile(options.file);
|
|
242
|
+
const products = Array.isArray(data) ? data : [];
|
|
243
|
+
const request = {
|
|
244
|
+
requests: products.map((p) => ({
|
|
245
|
+
inappproduct: p,
|
|
246
|
+
packageName,
|
|
247
|
+
sku: p["sku"]
|
|
248
|
+
}))
|
|
249
|
+
};
|
|
250
|
+
const result = await client.inappproducts.batchUpdate(packageName, request);
|
|
251
|
+
spinner.stop("Batch update complete");
|
|
252
|
+
console.log(formatOutput(result, format));
|
|
253
|
+
} catch (error) {
|
|
254
|
+
spinner.fail("Batch update failed");
|
|
255
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
256
|
+
process.exit(4);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
179
259
|
}
|
|
180
260
|
export {
|
|
181
261
|
registerIapCommands
|
|
182
262
|
};
|
|
183
|
-
//# sourceMappingURL=iap-
|
|
263
|
+
//# sourceMappingURL=iap-BBHF7BLZ.js.map
|