@gpc-cli/cli 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/dist/apps-BBYNHB2H.js +83 -0
  3. package/dist/apps-BBYNHB2H.js.map +1 -0
  4. package/dist/auth-T7IDSMVX.js +129 -0
  5. package/dist/auth-T7IDSMVX.js.map +1 -0
  6. package/dist/bin.d.ts +2 -0
  7. package/dist/bin.js +36 -0
  8. package/dist/bin.js.map +1 -0
  9. package/dist/chunk-4QV4WD3F.js +103 -0
  10. package/dist/chunk-4QV4WD3F.js.map +1 -0
  11. package/dist/chunk-IVVT73IP.js +245 -0
  12. package/dist/chunk-IVVT73IP.js.map +1 -0
  13. package/dist/chunk-QMKZYXDJ.js +24 -0
  14. package/dist/chunk-QMKZYXDJ.js.map +1 -0
  15. package/dist/completion-U44CGHRH.js +145 -0
  16. package/dist/completion-U44CGHRH.js.map +1 -0
  17. package/dist/config-K7UJKIXT.js +44 -0
  18. package/dist/config-K7UJKIXT.js.map +1 -0
  19. package/dist/docs-CVTWIVMS.js +20 -0
  20. package/dist/docs-CVTWIVMS.js.map +1 -0
  21. package/dist/doctor-VDDUPTIM.js +59 -0
  22. package/dist/doctor-VDDUPTIM.js.map +1 -0
  23. package/dist/iap-QIV4CXKZ.js +158 -0
  24. package/dist/iap-QIV4CXKZ.js.map +1 -0
  25. package/dist/index.d.ts +6 -0
  26. package/dist/index.js +8 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/listings-PF5FDXKQ.js +261 -0
  29. package/dist/listings-PF5FDXKQ.js.map +1 -0
  30. package/dist/pricing-S4SB5FXJ.js +52 -0
  31. package/dist/pricing-S4SB5FXJ.js.map +1 -0
  32. package/dist/prompt-VP5LURRP.js +20 -0
  33. package/dist/prompt-VP5LURRP.js.map +1 -0
  34. package/dist/publish-3BAIN4NQ.js +114 -0
  35. package/dist/publish-3BAIN4NQ.js.map +1 -0
  36. package/dist/purchases-E6A2T5WQ.js +231 -0
  37. package/dist/purchases-E6A2T5WQ.js.map +1 -0
  38. package/dist/releases-464IMEEF.js +231 -0
  39. package/dist/releases-464IMEEF.js.map +1 -0
  40. package/dist/reports-3YAD4U4F.js +129 -0
  41. package/dist/reports-3YAD4U4F.js.map +1 -0
  42. package/dist/reviews-2CLM53E3.js +125 -0
  43. package/dist/reviews-2CLM53E3.js.map +1 -0
  44. package/dist/status-M7U3YNMU.js +32 -0
  45. package/dist/status-M7U3YNMU.js.map +1 -0
  46. package/dist/subscriptions-PUHH4FBB.js +376 -0
  47. package/dist/subscriptions-PUHH4FBB.js.map +1 -0
  48. package/dist/testers-WWZMLB7J.js +145 -0
  49. package/dist/testers-WWZMLB7J.js.map +1 -0
  50. package/dist/tracks-427E34S3.js +39 -0
  51. package/dist/tracks-427E34S3.js.map +1 -0
  52. package/dist/users-E5Y5HI6K.js +145 -0
  53. package/dist/users-E5Y5HI6K.js.map +1 -0
  54. package/dist/validate-TPKVSIMR.js +37 -0
  55. package/dist/validate-TPKVSIMR.js.map +1 -0
  56. package/dist/vitals-YMZMUPNA.js +166 -0
  57. package/dist/vitals-YMZMUPNA.js.map +1 -0
  58. package/package.json +48 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GPC Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/commands/apps.ts
4
+ import { loadConfig } from "@gpc-cli/config";
5
+ import { resolveAuth } from "@gpc-cli/auth";
6
+ import { createApiClient } from "@gpc-cli/api";
7
+ import { getAppInfo, updateAppDetails } from "@gpc-cli/core";
8
+ import { detectOutputFormat, formatOutput } from "@gpc-cli/core";
9
+ function registerAppsCommands(program) {
10
+ const apps = program.command("apps").description("Manage applications");
11
+ apps.command("info [package]").description("Show app details").action(async (packageArg) => {
12
+ const config = await loadConfig();
13
+ const packageName = packageArg || config.app;
14
+ if (!packageName) {
15
+ console.error("Error: No package name provided.");
16
+ console.error("Usage: gpc apps info <package>");
17
+ console.error("Or set a default: gpc config set app com.example.app");
18
+ process.exit(2);
19
+ }
20
+ try {
21
+ const auth = await resolveAuth({
22
+ serviceAccountPath: config.auth?.serviceAccount
23
+ });
24
+ const client = createApiClient({ auth });
25
+ const info = await getAppInfo(client, packageName);
26
+ const format = detectOutputFormat();
27
+ console.log(formatOutput(info, format));
28
+ } catch (error) {
29
+ console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
30
+ process.exit(4);
31
+ }
32
+ });
33
+ apps.command("update").description("Update app details").option("--email <email>", "Contact email").option("--phone <phone>", "Contact phone").option("--website <url>", "Contact website").option("--default-lang <lang>", "Default language").action(async (options) => {
34
+ const config = await loadConfig();
35
+ const packageName = options.app || program.opts().app || config.app;
36
+ if (!packageName) {
37
+ console.error("Error: No package name provided.");
38
+ console.error("Usage: gpc apps update --email user@example.com");
39
+ process.exit(2);
40
+ }
41
+ const data = {};
42
+ if (options.email) data.contactEmail = options.email;
43
+ if (options.phone) data.contactPhone = options.phone;
44
+ if (options.website) data.contactWebsite = options.website;
45
+ if (options.defaultLang) data.defaultLanguage = options.defaultLang;
46
+ if (Object.keys(data).length === 0) {
47
+ console.error("Error: Provide at least one field to update (--email, --phone, --website, --default-lang).");
48
+ process.exit(2);
49
+ }
50
+ try {
51
+ const auth = await resolveAuth({
52
+ serviceAccountPath: config.auth?.serviceAccount
53
+ });
54
+ const client = createApiClient({ auth });
55
+ const result = await updateAppDetails(client, packageName, data);
56
+ const format = detectOutputFormat();
57
+ console.log(formatOutput(result, format));
58
+ } catch (error) {
59
+ console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
60
+ process.exit(4);
61
+ }
62
+ });
63
+ apps.command("list").description("List configured applications").action(async () => {
64
+ const config = await loadConfig();
65
+ const format = detectOutputFormat();
66
+ if (config.app) {
67
+ const apps2 = [{ packageName: config.app, source: "config" }];
68
+ console.log(formatOutput(apps2, format));
69
+ } else {
70
+ console.log("No apps configured.");
71
+ console.log("");
72
+ console.log("Set a default app:");
73
+ console.log(" gpc config set app com.example.myapp");
74
+ console.log("");
75
+ console.log("Or use the --app flag:");
76
+ console.log(" gpc apps info --app com.example.myapp");
77
+ }
78
+ });
79
+ }
80
+ export {
81
+ registerAppsCommands
82
+ };
83
+ //# sourceMappingURL=apps-BBYNHB2H.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/apps.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createApiClient } from \"@gpc-cli/api\";\nimport { getAppInfo, updateAppDetails } from \"@gpc-cli/core\";\nimport { detectOutputFormat, formatOutput } from \"@gpc-cli/core\";\n\nexport function registerAppsCommands(program: Command): void {\n const apps = program\n .command(\"apps\")\n .description(\"Manage applications\");\n\n apps\n .command(\"info [package]\")\n .description(\"Show app details\")\n .action(async (packageArg?: string) => {\n const config = await loadConfig();\n const packageName = packageArg || config.app;\n\n if (!packageName) {\n console.error(\"Error: No package name provided.\");\n console.error(\"Usage: gpc apps info <package>\");\n console.error(\"Or set a default: gpc config set app com.example.app\");\n process.exit(2);\n }\n\n try {\n const auth = await resolveAuth({\n serviceAccountPath: config.auth?.serviceAccount,\n });\n const client = createApiClient({ auth });\n const info = await getAppInfo(client, packageName);\n const format = detectOutputFormat();\n console.log(formatOutput(info, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n apps\n .command(\"update\")\n .description(\"Update app details\")\n .option(\"--email <email>\", \"Contact email\")\n .option(\"--phone <phone>\", \"Contact phone\")\n .option(\"--website <url>\", \"Contact website\")\n .option(\"--default-lang <lang>\", \"Default language\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = options.app || program.opts().app || config.app;\n\n if (!packageName) {\n console.error(\"Error: No package name provided.\");\n console.error(\"Usage: gpc apps update --email user@example.com\");\n process.exit(2);\n }\n\n const data: Record<string, string> = {};\n if (options.email) data.contactEmail = options.email;\n if (options.phone) data.contactPhone = options.phone;\n if (options.website) data.contactWebsite = options.website;\n if (options.defaultLang) data.defaultLanguage = options.defaultLang;\n\n if (Object.keys(data).length === 0) {\n console.error(\"Error: Provide at least one field to update (--email, --phone, --website, --default-lang).\");\n process.exit(2);\n }\n\n try {\n const auth = await resolveAuth({\n serviceAccountPath: config.auth?.serviceAccount,\n });\n const client = createApiClient({ auth });\n const result = await updateAppDetails(client, packageName, data);\n const format = detectOutputFormat();\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 apps\n .command(\"list\")\n .description(\"List configured applications\")\n .action(async () => {\n const config = await loadConfig();\n const format = detectOutputFormat();\n\n if (config.app) {\n const apps = [{ packageName: config.app, source: \"config\" }];\n console.log(formatOutput(apps, format));\n } else {\n console.log(\"No apps configured.\");\n console.log(\"\");\n console.log(\"Set a default app:\");\n console.log(\" gpc config set app com.example.myapp\");\n console.log(\"\");\n console.log(\"Or use the --app flag:\");\n console.log(\" gpc apps info --app com.example.myapp\");\n }\n });\n}\n"],"mappings":";;;AACA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,YAAY,wBAAwB;AAC7C,SAAS,oBAAoB,oBAAoB;AAE1C,SAAS,qBAAqB,SAAwB;AAC3D,QAAM,OAAO,QACV,QAAQ,MAAM,EACd,YAAY,qBAAqB;AAEpC,OACG,QAAQ,gBAAgB,EACxB,YAAY,kBAAkB,EAC9B,OAAO,OAAO,eAAwB;AACrC,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,cAAc,OAAO;AAEzC,QAAI,CAAC,aAAa;AAChB,cAAQ,MAAM,kCAAkC;AAChD,cAAQ,MAAM,gCAAgC;AAC9C,cAAQ,MAAM,sDAAsD;AACpE,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,QAAI;AACF,YAAM,OAAO,MAAM,YAAY;AAAA,QAC7B,oBAAoB,OAAO,MAAM;AAAA,MACnC,CAAC;AACD,YAAM,SAAS,gBAAgB,EAAE,KAAK,CAAC;AACvC,YAAM,OAAO,MAAM,WAAW,QAAQ,WAAW;AACjD,YAAM,SAAS,mBAAmB;AAClC,cAAQ,IAAI,aAAa,MAAM,MAAM,CAAC;AAAA,IACxC,SAAS,OAAO;AACd,cAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AAEH,OACG,QAAQ,QAAQ,EAChB,YAAY,oBAAoB,EAChC,OAAO,mBAAmB,eAAe,EACzC,OAAO,mBAAmB,eAAe,EACzC,OAAO,mBAAmB,iBAAiB,EAC3C,OAAO,yBAAyB,kBAAkB,EAClD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,IACxC,OAAO;AACL,cAAQ,IAAI,qBAAqB;AACjC,cAAQ,IAAI,EAAE;AACd,cAAQ,IAAI,oBAAoB;AAChC,cAAQ,IAAI,wCAAwC;AACpD,cAAQ,IAAI,EAAE;AACd,cAAQ,IAAI,wBAAwB;AACpC,cAAQ,IAAI,yCAAyC;AAAA,IACvD;AAAA,EACF,CAAC;AACL;","names":["apps"]}
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/commands/auth.ts
4
+ import { resolveAuth, loadServiceAccountKey, clearTokenCache, AuthError } from "@gpc-cli/auth";
5
+ import { loadConfig, getCacheDir } from "@gpc-cli/config";
6
+ import { detectOutputFormat, formatOutput } from "@gpc-cli/core";
7
+ function registerAuthCommands(program) {
8
+ const auth = program.command("auth").description("Manage authentication");
9
+ auth.command("login").description("Authenticate with Google Play Developer API").option("--service-account <path>", "Path to service account JSON key file").option("--adc", "Use Application Default Credentials").option("--profile <name>", "Store credentials under a named profile").action(async (options) => {
10
+ try {
11
+ if (options.serviceAccount) {
12
+ const key = await loadServiceAccountKey(options.serviceAccount);
13
+ if (options.profile) {
14
+ const { setProfileConfig } = await import("@gpc-cli/config");
15
+ await setProfileConfig(options.profile, {
16
+ auth: { serviceAccount: options.serviceAccount }
17
+ });
18
+ console.log(`Profile "${options.profile}" configured with ${key.client_email}`);
19
+ } else {
20
+ const { setConfigValue } = await import("@gpc-cli/config");
21
+ await setConfigValue("auth.serviceAccount", options.serviceAccount);
22
+ console.log(`Authenticated as ${key.client_email}`);
23
+ }
24
+ console.log(`Project: ${key.project_id}`);
25
+ } else if (options.adc) {
26
+ const client = await resolveAuth();
27
+ console.log(`Authenticated via Application Default Credentials`);
28
+ console.log(`Account: ${client.getClientEmail()}`);
29
+ } else {
30
+ console.log("Usage: gpc auth login --service-account <path>");
31
+ console.log("");
32
+ console.log("Authentication methods:");
33
+ console.log(" --service-account <path> Service account JSON key file");
34
+ console.log(" --adc Application Default Credentials");
35
+ console.log("");
36
+ console.log("Options:");
37
+ console.log(" --profile <name> Store under a named profile");
38
+ }
39
+ } catch (error) {
40
+ if (error instanceof AuthError) {
41
+ console.error(`Error: ${error.message}`);
42
+ if (error.suggestion) console.error(`Suggestion: ${error.suggestion}`);
43
+ process.exit(3);
44
+ }
45
+ throw error;
46
+ }
47
+ });
48
+ auth.command("status").description("Show current authentication status").action(async () => {
49
+ try {
50
+ const config = await loadConfig();
51
+ const client = await resolveAuth({
52
+ serviceAccountPath: config.auth?.serviceAccount,
53
+ cachePath: getCacheDir()
54
+ });
55
+ const format = detectOutputFormat();
56
+ const data = {
57
+ authenticated: true,
58
+ account: client.getClientEmail(),
59
+ project: client.getProjectId(),
60
+ ...config.profile && { profile: config.profile }
61
+ };
62
+ console.log(formatOutput(data, format));
63
+ } catch (error) {
64
+ if (error instanceof AuthError) {
65
+ const format = detectOutputFormat();
66
+ const data = {
67
+ authenticated: false,
68
+ error: error.message,
69
+ suggestion: error.suggestion
70
+ };
71
+ console.log(formatOutput(data, format));
72
+ process.exit(3);
73
+ }
74
+ throw error;
75
+ }
76
+ });
77
+ auth.command("logout").description("Clear stored credentials and token cache").action(async () => {
78
+ const { setConfigValue } = await import("@gpc-cli/config");
79
+ await setConfigValue("auth.serviceAccount", "");
80
+ await clearTokenCache(getCacheDir());
81
+ console.log("Credentials and token cache cleared.");
82
+ });
83
+ auth.command("whoami").description("Show current authenticated identity").action(async () => {
84
+ try {
85
+ const config = await loadConfig();
86
+ const client = await resolveAuth({
87
+ serviceAccountPath: config.auth?.serviceAccount,
88
+ cachePath: getCacheDir()
89
+ });
90
+ console.log(client.getClientEmail());
91
+ } catch {
92
+ console.error("Not authenticated. Run: gpc auth login");
93
+ process.exit(3);
94
+ }
95
+ });
96
+ auth.command("switch <profile>").description("Switch to a named profile").action(async (profile) => {
97
+ try {
98
+ const config = await loadConfig({ profile });
99
+ const { setConfigValue } = await import("@gpc-cli/config");
100
+ await setConfigValue("profile", profile);
101
+ console.log(`Switched to profile "${profile}"`);
102
+ if (config.auth?.serviceAccount) {
103
+ console.log(`Service account: ${config.auth.serviceAccount}`);
104
+ }
105
+ } catch (error) {
106
+ console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
107
+ process.exit(2);
108
+ }
109
+ });
110
+ auth.command("profiles").description("List configured profiles").action(async () => {
111
+ const { listProfiles } = await import("@gpc-cli/config");
112
+ const config = await loadConfig();
113
+ const profiles = await listProfiles();
114
+ const format = detectOutputFormat();
115
+ if (profiles.length === 0) {
116
+ console.log("No profiles configured. Use: gpc auth login --service-account <path> --profile <name>");
117
+ return;
118
+ }
119
+ const data = profiles.map((name) => ({
120
+ name,
121
+ active: name === config.profile
122
+ }));
123
+ console.log(formatOutput(data, format));
124
+ });
125
+ }
126
+ export {
127
+ registerAuthCommands
128
+ };
129
+ //# sourceMappingURL=auth-T7IDSMVX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/auth.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { resolveAuth, loadServiceAccountKey, clearTokenCache, AuthError } from \"@gpc-cli/auth\";\nimport { loadConfig, getCacheDir } from \"@gpc-cli/config\";\nimport { detectOutputFormat, formatOutput } from \"@gpc-cli/core\";\n\nexport function registerAuthCommands(program: Command): void {\n const auth = program\n .command(\"auth\")\n .description(\"Manage authentication\");\n\n auth\n .command(\"login\")\n .description(\"Authenticate with Google Play Developer API\")\n .option(\"--service-account <path>\", \"Path to service account JSON key file\")\n .option(\"--adc\", \"Use Application Default Credentials\")\n .option(\"--profile <name>\", \"Store credentials under a named profile\")\n .action(async (options: { serviceAccount?: string; adc?: boolean; profile?: string }) => {\n try {\n if (options.serviceAccount) {\n const key = await loadServiceAccountKey(options.serviceAccount);\n\n if (options.profile) {\n const { setProfileConfig } = await import(\"@gpc-cli/config\");\n await setProfileConfig(options.profile, {\n auth: { serviceAccount: options.serviceAccount },\n });\n console.log(`Profile \"${options.profile}\" configured with ${key.client_email}`);\n } else {\n const { setConfigValue } = await import(\"@gpc-cli/config\");\n await setConfigValue(\"auth.serviceAccount\", options.serviceAccount);\n console.log(`Authenticated as ${key.client_email}`);\n }\n console.log(`Project: ${key.project_id}`);\n } else if (options.adc) {\n const client = await resolveAuth();\n console.log(`Authenticated via Application Default Credentials`);\n console.log(`Account: ${client.getClientEmail()}`);\n } else {\n console.log(\"Usage: gpc auth login --service-account <path>\");\n console.log(\"\");\n console.log(\"Authentication methods:\");\n console.log(\" --service-account <path> Service account JSON key file\");\n console.log(\" --adc Application Default Credentials\");\n console.log(\"\");\n console.log(\"Options:\");\n console.log(\" --profile <name> Store under a named profile\");\n }\n } catch (error) {\n if (error instanceof AuthError) {\n console.error(`Error: ${error.message}`);\n if (error.suggestion) console.error(`Suggestion: ${error.suggestion}`);\n process.exit(3);\n }\n throw error;\n }\n });\n\n auth\n .command(\"status\")\n .description(\"Show current authentication status\")\n .action(async () => {\n try {\n const config = await loadConfig();\n const client = await resolveAuth({\n serviceAccountPath: config.auth?.serviceAccount,\n cachePath: getCacheDir(),\n });\n const format = detectOutputFormat();\n const data = {\n authenticated: true,\n account: client.getClientEmail(),\n project: client.getProjectId(),\n ...(config.profile && { profile: config.profile }),\n };\n console.log(formatOutput(data, format));\n } catch (error) {\n if (error instanceof AuthError) {\n const format = detectOutputFormat();\n const data = {\n authenticated: false,\n error: error.message,\n suggestion: error.suggestion,\n };\n console.log(formatOutput(data, format));\n process.exit(3);\n }\n throw error;\n }\n });\n\n auth\n .command(\"logout\")\n .description(\"Clear stored credentials and token cache\")\n .action(async () => {\n const { setConfigValue } = await import(\"@gpc-cli/config\");\n await setConfigValue(\"auth.serviceAccount\", \"\");\n await clearTokenCache(getCacheDir());\n console.log(\"Credentials and token cache cleared.\");\n });\n\n auth\n .command(\"whoami\")\n .description(\"Show current authenticated identity\")\n .action(async () => {\n try {\n const config = await loadConfig();\n const client = await resolveAuth({\n serviceAccountPath: config.auth?.serviceAccount,\n cachePath: getCacheDir(),\n });\n console.log(client.getClientEmail());\n } catch {\n console.error(\"Not authenticated. Run: gpc auth login\");\n process.exit(3);\n }\n });\n\n auth\n .command(\"switch <profile>\")\n .description(\"Switch to a named profile\")\n .action(async (profile: string) => {\n try {\n // Verify profile exists\n const config = await loadConfig({ profile });\n const { setConfigValue } = await import(\"@gpc-cli/config\");\n await setConfigValue(\"profile\", profile);\n console.log(`Switched to profile \"${profile}\"`);\n if (config.auth?.serviceAccount) {\n console.log(`Service account: ${config.auth.serviceAccount}`);\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(2);\n }\n });\n\n auth\n .command(\"profiles\")\n .description(\"List configured profiles\")\n .action(async () => {\n const { listProfiles } = await import(\"@gpc-cli/config\");\n const config = await loadConfig();\n const profiles = await listProfiles();\n const format = detectOutputFormat();\n\n if (profiles.length === 0) {\n console.log(\"No profiles configured. Use: gpc auth login --service-account <path> --profile <name>\");\n return;\n }\n\n const data = profiles.map((name) => ({\n name,\n active: name === config.profile,\n }));\n console.log(formatOutput(data, format));\n });\n}\n"],"mappings":";;;AACA,SAAS,aAAa,uBAAuB,iBAAiB,iBAAiB;AAC/E,SAAS,YAAY,mBAAmB;AACxC,SAAS,oBAAoB,oBAAoB;AAE1C,SAAS,qBAAqB,SAAwB;AAC3D,QAAM,OAAO,QACV,QAAQ,MAAM,EACd,YAAY,uBAAuB;AAEtC,OACG,QAAQ,OAAO,EACf,YAAY,6CAA6C,EACzD,OAAO,4BAA4B,uCAAuC,EAC1E,OAAO,SAAS,qCAAqC,EACrD,OAAO,oBAAoB,yCAAyC,EACpE,OAAO,OAAO,YAA0E;AACvF,QAAI;AACF,UAAI,QAAQ,gBAAgB;AAC1B,cAAM,MAAM,MAAM,sBAAsB,QAAQ,cAAc;AAE9D,YAAI,QAAQ,SAAS;AACnB,gBAAM,EAAE,iBAAiB,IAAI,MAAM,OAAO,iBAAiB;AAC3D,gBAAM,iBAAiB,QAAQ,SAAS;AAAA,YACtC,MAAM,EAAE,gBAAgB,QAAQ,eAAe;AAAA,UACj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O,GAAG;AAC9C,UAAI,OAAO,MAAM,gBAAgB;AAC/B,gBAAQ,IAAI,oBAAoB,OAAO,KAAK,cAAc,EAAE;AAAA,MAC9D;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;AAEH,OACG,QAAQ,UAAU,EAClB,YAAY,0BAA0B,EACtC,OAAO,YAAY;AAClB,UAAM,EAAE,aAAa,IAAI,MAAM,OAAO,iBAAiB;AACvD,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,WAAW,MAAM,aAAa;AACpC,UAAM,SAAS,mBAAmB;AAElC,QAAI,SAAS,WAAW,GAAG;AACzB,cAAQ,IAAI,uFAAuF;AACnG;AAAA,IACF;AAEA,UAAM,OAAO,SAAS,IAAI,CAAC,UAAU;AAAA,MACnC;AAAA,MACA,QAAQ,SAAS,OAAO;AAAA,IAC1B,EAAE;AACF,YAAQ,IAAI,aAAa,MAAM,MAAM,CAAC;AAAA,EACxC,CAAC;AACL;","names":[]}
package/dist/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/bin.js ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ createProgram,
4
+ loadPlugins
5
+ } from "./chunk-IVVT73IP.js";
6
+
7
+ // src/networking.ts
8
+ async function setupNetworking() {
9
+ const caCert = process.env["GPC_CA_CERT"];
10
+ if (caCert && !process.env["NODE_EXTRA_CA_CERTS"]) {
11
+ process.env["NODE_EXTRA_CA_CERTS"] = caCert;
12
+ }
13
+ if (process.env["__GPC_BINARY"] === "1") return;
14
+ const proxyUrl = process.env["HTTPS_PROXY"] || process.env["https_proxy"] || process.env["HTTP_PROXY"] || process.env["http_proxy"];
15
+ if (proxyUrl) {
16
+ try {
17
+ const { ProxyAgent, setGlobalDispatcher } = await import("undici");
18
+ setGlobalDispatcher(new ProxyAgent(proxyUrl));
19
+ } catch {
20
+ console.error("Warning: Proxy support requires Node.js 20+. HTTPS_PROXY will be ignored.");
21
+ }
22
+ }
23
+ }
24
+
25
+ // src/bin.ts
26
+ import { initAudit } from "@gpc-cli/core";
27
+ import { getConfigDir } from "@gpc-cli/config";
28
+ await setupNetworking();
29
+ initAudit(getConfigDir());
30
+ var pluginManager = await loadPlugins();
31
+ var program = await createProgram(pluginManager);
32
+ program.parseAsync(process.argv).catch((error) => {
33
+ console.error(error instanceof Error ? error.message : String(error));
34
+ process.exit(1);
35
+ });
36
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/networking.ts","../src/bin.ts"],"sourcesContent":["/**\n * Set up proxy and custom CA certificate support.\n * Must be called before any fetch() calls.\n */\nexport async function setupNetworking(): Promise<void> {\n // Map GPC_CA_CERT to NODE_EXTRA_CA_CERTS (works in both Node and Bun)\n const caCert = process.env[\"GPC_CA_CERT\"];\n if (caCert && !process.env[\"NODE_EXTRA_CA_CERTS\"]) {\n process.env[\"NODE_EXTRA_CA_CERTS\"] = caCert;\n }\n\n // In standalone binary mode, Bun handles HTTPS_PROXY/HTTP_PROXY natively\n if (process.env[\"__GPC_BINARY\"] === \"1\") return;\n\n const proxyUrl = process.env[\"HTTPS_PROXY\"] || process.env[\"https_proxy\"] || process.env[\"HTTP_PROXY\"] || process.env[\"http_proxy\"];\n if (proxyUrl) {\n try {\n const { ProxyAgent, setGlobalDispatcher } = await import(\"undici\");\n setGlobalDispatcher(new ProxyAgent(proxyUrl));\n } catch {\n console.error(\"Warning: Proxy support requires Node.js 20+. HTTPS_PROXY will be ignored.\");\n }\n }\n}\n","import { setupNetworking } from \"./networking.js\";\nimport { createProgram } from \"./program.js\";\nimport { loadPlugins } from \"./plugins.js\";\nimport { initAudit } from \"@gpc-cli/core\";\nimport { getConfigDir } from \"@gpc-cli/config\";\n\nawait setupNetworking();\ninitAudit(getConfigDir());\nconst pluginManager = await loadPlugins();\nconst program = await createProgram(pluginManager);\nprogram.parseAsync(process.argv).catch((error: unknown) => {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n});\n"],"mappings":";;;;;;;AAIA,eAAsB,kBAAiC;AAErD,QAAM,SAAS,QAAQ,IAAI,aAAa;AACxC,MAAI,UAAU,CAAC,QAAQ,IAAI,qBAAqB,GAAG;AACjD,YAAQ,IAAI,qBAAqB,IAAI;AAAA,EACvC;AAGA,MAAI,QAAQ,IAAI,cAAc,MAAM,IAAK;AAEzC,QAAM,WAAW,QAAQ,IAAI,aAAa,KAAK,QAAQ,IAAI,aAAa,KAAK,QAAQ,IAAI,YAAY,KAAK,QAAQ,IAAI,YAAY;AAClI,MAAI,UAAU;AACZ,QAAI;AACF,YAAM,EAAE,YAAY,oBAAoB,IAAI,MAAM,OAAO,QAAQ;AACjE,0BAAoB,IAAI,WAAW,QAAQ,CAAC;AAAA,IAC9C,QAAQ;AACN,cAAQ,MAAM,2EAA2E;AAAA,IAC3F;AAAA,EACF;AACF;;;ACpBA,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAE7B,MAAM,gBAAgB;AACtB,UAAU,aAAa,CAAC;AACxB,IAAM,gBAAgB,MAAM,YAAY;AACxC,IAAM,UAAU,MAAM,cAAc,aAAa;AACjD,QAAQ,WAAW,QAAQ,IAAI,EAAE,MAAM,CAAC,UAAmB;AACzD,UAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AACpE,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/prompt.ts
4
+ import { createInterface } from "readline";
5
+ function isInteractive(program) {
6
+ if (program) {
7
+ let root = program;
8
+ while (root.parent) root = root.parent;
9
+ if (root.opts().interactive === false) return false;
10
+ }
11
+ if (process.env["GPC_NO_INTERACTIVE"] === "1" || process.env["GPC_NO_INTERACTIVE"] === "true") {
12
+ return false;
13
+ }
14
+ if (process.env["CI"] === "true" || process.env["CI"] === "1") {
15
+ return false;
16
+ }
17
+ return Boolean(process.stdin.isTTY);
18
+ }
19
+ function skipConfirm(program) {
20
+ if (!program) return false;
21
+ let root = program;
22
+ while (root.parent) root = root.parent;
23
+ return root.opts().yes === true;
24
+ }
25
+ async function requireOption(name, value, prompt, interactive) {
26
+ if (value) return value;
27
+ if (interactive) {
28
+ return prompt.choices ? promptSelect(prompt.message, prompt.choices, prompt.default) : promptInput(prompt.message, prompt.default);
29
+ }
30
+ process.stderr.write(`Error: Missing required option --${name}
31
+ `);
32
+ process.stderr.write(`Suggestion: Provide --${name} or run interactively (remove --no-interactive)
33
+ `);
34
+ process.exit(2);
35
+ }
36
+ async function requireConfirm(message, program) {
37
+ if (skipConfirm(program)) return;
38
+ if (!isInteractive(program)) return;
39
+ const confirmed = await promptConfirm(message, false);
40
+ if (!confirmed) {
41
+ console.log("Aborted.");
42
+ process.exit(0);
43
+ }
44
+ }
45
+ async function promptInput(message, defaultValue) {
46
+ const suffix = defaultValue ? ` (${defaultValue})` : "";
47
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
48
+ return new Promise((resolve) => {
49
+ rl.question(`${message}${suffix}: `, (answer) => {
50
+ rl.close();
51
+ resolve(answer.trim() || defaultValue || "");
52
+ });
53
+ });
54
+ }
55
+ async function promptSelect(message, choices, defaultValue) {
56
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
57
+ process.stderr.write(`${message}
58
+ `);
59
+ for (let i = 0; i < choices.length; i++) {
60
+ const marker = choices[i] === defaultValue ? " (default)" : "";
61
+ process.stderr.write(` ${i + 1}) ${choices[i]}${marker}
62
+ `);
63
+ }
64
+ return new Promise((resolve) => {
65
+ rl.question("Choice: ", (answer) => {
66
+ rl.close();
67
+ const trimmed = answer.trim();
68
+ const num = Number(trimmed);
69
+ if (num >= 1 && num <= choices.length) {
70
+ resolve(choices[num - 1]);
71
+ return;
72
+ }
73
+ if (choices.includes(trimmed)) {
74
+ resolve(trimmed);
75
+ return;
76
+ }
77
+ resolve(defaultValue || choices[0]);
78
+ });
79
+ });
80
+ }
81
+ async function promptConfirm(message, defaultValue = true) {
82
+ const hint = defaultValue ? "Y/n" : "y/N";
83
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
84
+ return new Promise((resolve) => {
85
+ rl.question(`${message} [${hint}]: `, (answer) => {
86
+ rl.close();
87
+ const trimmed = answer.trim().toLowerCase();
88
+ if (trimmed === "") resolve(defaultValue);
89
+ else resolve(trimmed === "y" || trimmed === "yes");
90
+ });
91
+ });
92
+ }
93
+
94
+ export {
95
+ isInteractive,
96
+ skipConfirm,
97
+ requireOption,
98
+ requireConfirm,
99
+ promptInput,
100
+ promptSelect,
101
+ promptConfirm
102
+ };
103
+ //# sourceMappingURL=chunk-4QV4WD3F.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/prompt.ts"],"sourcesContent":["import { createInterface } from \"node:readline\";\n\n/**\n * Check if interactive prompts are allowed.\n * Disabled by --no-interactive flag, GPC_NO_INTERACTIVE env, or non-TTY stdin.\n */\nexport function isInteractive(program?: { opts(): Record<string, unknown> }): boolean {\n // Commander's --no-interactive sets interactive = false\n if (program) {\n let root = program as any;\n while (root.parent) root = root.parent;\n if (root.opts().interactive === false) return false;\n }\n\n if (process.env[\"GPC_NO_INTERACTIVE\"] === \"1\" || process.env[\"GPC_NO_INTERACTIVE\"] === \"true\") {\n return false;\n }\n\n if (process.env[\"CI\"] === \"true\" || process.env[\"CI\"] === \"1\") {\n return false;\n }\n\n return Boolean(process.stdin.isTTY);\n}\n\n/**\n * Check if --yes flag is set (skip confirmation prompts).\n */\nexport function skipConfirm(program?: { opts(): Record<string, unknown> }): boolean {\n if (!program) return false;\n let root = program as any;\n while (root.parent) root = root.parent;\n return root.opts().yes === true;\n}\n\n/**\n * Require an option value: return existing value, prompt interactively, or exit with error.\n */\nexport async function requireOption(\n name: string,\n value: string | undefined,\n prompt: { message: string; choices?: string[]; default?: string },\n interactive: boolean,\n): Promise<string> {\n if (value) return value;\n if (interactive) {\n return prompt.choices\n ? promptSelect(prompt.message, prompt.choices, prompt.default)\n : promptInput(prompt.message, prompt.default);\n }\n process.stderr.write(`Error: Missing required option --${name}\\n`);\n process.stderr.write(`Suggestion: Provide --${name} or run interactively (remove --no-interactive)\\n`);\n process.exit(2);\n}\n\n/**\n * Require confirmation for destructive operations.\n * Returns true if confirmed (or --yes flag is set / non-interactive).\n * Exits with code 0 if denied.\n */\nexport async function requireConfirm(\n message: string,\n program?: { opts(): Record<string, unknown> },\n): Promise<void> {\n if (skipConfirm(program)) return;\n if (!isInteractive(program)) return;\n const confirmed = await promptConfirm(message, false);\n if (!confirmed) {\n console.log(\"Aborted.\");\n process.exit(0);\n }\n}\n\n/**\n * Prompt for text input.\n */\nexport async function promptInput(message: string, defaultValue?: string): Promise<string> {\n const suffix = defaultValue ? ` (${defaultValue})` : \"\";\n const rl = createInterface({ input: process.stdin, output: process.stderr });\n\n return new Promise((resolve) => {\n rl.question(`${message}${suffix}: `, (answer) => {\n rl.close();\n resolve(answer.trim() || defaultValue || \"\");\n });\n });\n}\n\n/**\n * Prompt for selection from a list of choices.\n */\nexport async function promptSelect(message: string, choices: string[], defaultValue?: string): Promise<string> {\n const rl = createInterface({ input: process.stdin, output: process.stderr });\n\n process.stderr.write(`${message}\\n`);\n for (let i = 0; i < choices.length; i++) {\n const marker = choices[i] === defaultValue ? \" (default)\" : \"\";\n process.stderr.write(` ${i + 1}) ${choices[i]}${marker}\\n`);\n }\n\n return new Promise((resolve) => {\n rl.question(\"Choice: \", (answer) => {\n rl.close();\n const trimmed = answer.trim();\n\n // Accept number\n const num = Number(trimmed);\n if (num >= 1 && num <= choices.length) {\n resolve(choices[num - 1]!);\n return;\n }\n\n // Accept exact match\n if (choices.includes(trimmed)) {\n resolve(trimmed);\n return;\n }\n\n // Default\n resolve(defaultValue || choices[0]!);\n });\n });\n}\n\n/**\n * Prompt for yes/no confirmation.\n */\nexport async function promptConfirm(message: string, defaultValue = true): Promise<boolean> {\n const hint = defaultValue ? \"Y/n\" : \"y/N\";\n const rl = createInterface({ input: process.stdin, output: process.stderr });\n\n return new Promise((resolve) => {\n rl.question(`${message} [${hint}]: `, (answer) => {\n rl.close();\n const trimmed = answer.trim().toLowerCase();\n if (trimmed === \"\") resolve(defaultValue);\n else resolve(trimmed === \"y\" || trimmed === \"yes\");\n });\n });\n}\n"],"mappings":";;;AAAA,SAAS,uBAAuB;AAMzB,SAAS,cAAc,SAAwD;AAEpF,MAAI,SAAS;AACX,QAAI,OAAO;AACX,WAAO,KAAK,OAAQ,QAAO,KAAK;AAChC,QAAI,KAAK,KAAK,EAAE,gBAAgB,MAAO,QAAO;AAAA,EAChD;AAEA,MAAI,QAAQ,IAAI,oBAAoB,MAAM,OAAO,QAAQ,IAAI,oBAAoB,MAAM,QAAQ;AAC7F,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ,IAAI,IAAI,MAAM,UAAU,QAAQ,IAAI,IAAI,MAAM,KAAK;AAC7D,WAAO;AAAA,EACT;AAEA,SAAO,QAAQ,QAAQ,MAAM,KAAK;AACpC;AAKO,SAAS,YAAY,SAAwD;AAClF,MAAI,CAAC,QAAS,QAAO;AACrB,MAAI,OAAO;AACX,SAAO,KAAK,OAAQ,QAAO,KAAK;AAChC,SAAO,KAAK,KAAK,EAAE,QAAQ;AAC7B;AAKA,eAAsB,cACpB,MACA,OACA,QACA,aACiB;AACjB,MAAI,MAAO,QAAO;AAClB,MAAI,aAAa;AACf,WAAO,OAAO,UACV,aAAa,OAAO,SAAS,OAAO,SAAS,OAAO,OAAO,IAC3D,YAAY,OAAO,SAAS,OAAO,OAAO;AAAA,EAChD;AACA,UAAQ,OAAO,MAAM,oCAAoC,IAAI;AAAA,CAAI;AACjE,UAAQ,OAAO,MAAM,yBAAyB,IAAI;AAAA,CAAmD;AACrG,UAAQ,KAAK,CAAC;AAChB;AAOA,eAAsB,eACpB,SACA,SACe;AACf,MAAI,YA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