@gpc-cli/cli 0.9.62 → 0.9.64

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 (66) hide show
  1. package/README.md +12 -8
  2. package/dist/{__complete-QFD3SUAO.js → __complete-AZXI2O25.js} +2 -4
  3. package/dist/__complete-AZXI2O25.js.map +1 -0
  4. package/dist/{audit-M7GYID74.js → audit-BDPS5ODN.js} +4 -4
  5. package/dist/bin.js +2 -2
  6. package/dist/changelog-EHQYZP22.js +365 -0
  7. package/dist/changelog-EHQYZP22.js.map +1 -0
  8. package/dist/{chunk-QM5RTQ6R.js → chunk-I3SFXLIY.js} +29 -29
  9. package/dist/{completion-4I3IJK3M.js → completion-ZK7RPPFD.js} +7 -3
  10. package/dist/{completion-4I3IJK3M.js.map → completion-ZK7RPPFD.js.map} +1 -1
  11. package/dist/{config-B76LNM7C.js → config-SK7BOURM.js} +5 -5
  12. package/dist/docs-WVJCDX5X.js +378 -0
  13. package/dist/docs-WVJCDX5X.js.map +1 -0
  14. package/dist/{doctor-6SNZEFME.js → doctor-FSUI44DD.js} +5 -5
  15. package/dist/{enterprise-SIKXDT64.js → enterprise-L7DTIX2O.js} +4 -4
  16. package/dist/{external-transactions-JL3G4IG5.js → external-transactions-BP42CK3H.js} +4 -4
  17. package/dist/{feedback-JRTQBJUP.js → feedback-PDQU5E6S.js} +2 -2
  18. package/dist/generated/docs-bundle.json +1 -0
  19. package/dist/{grants-UHNBPIFD.js → grants-32DED5QL.js} +4 -4
  20. package/dist/{iap-ETOL7OAC.js → iap-EPJ76IAC.js} +4 -4
  21. package/dist/index.js +1 -1
  22. package/dist/{init-6CCSVJC2.js → init-OCBFI4VH.js} +6 -6
  23. package/dist/{listings-2Z6DSO3D.js → listings-QKRIVZG6.js} +6 -6
  24. package/dist/{one-time-products-Y5RNIPV2.js → one-time-products-OIDBVCFE.js} +4 -4
  25. package/dist/{publish-5HZAJEDZ.js → publish-H2IAOKP7.js} +4 -4
  26. package/dist/{purchases-AHWGLW6V.js → purchases-GFLYTKR3.js} +4 -4
  27. package/dist/{recovery-B7DZQ6XG.js → recovery-2VJJLAIQ.js} +4 -4
  28. package/dist/{releases-XY57V22L.js → releases-RTF5NPTD.js} +4 -4
  29. package/dist/{reviews-P4M6BEJI.js → reviews-GZ2VOIRN.js} +4 -4
  30. package/dist/{subscriptions-GTVJB4HX.js → subscriptions-JPHFBREY.js} +4 -4
  31. package/dist/{system-apks-L6M7QYB3.js → system-apks-KWTN5LHO.js} +4 -4
  32. package/dist/{testers-FGLBJAXL.js → testers-7ILUCKYB.js} +4 -4
  33. package/dist/{train-D2NKUW3M.js → train-G44NEK43.js} +4 -4
  34. package/dist/{update-6AGIO5DW.js → update-E4VGHQUR.js} +2 -2
  35. package/dist/{users-FOMAT7DY.js → users-W66YCFDX.js} +4 -4
  36. package/dist/{version-JL66BIVI.js → version-HXUIOHCL.js} +2 -2
  37. package/package.json +5 -3
  38. package/dist/__complete-QFD3SUAO.js.map +0 -1
  39. package/dist/changelog-OHZ4M7D6.js +0 -172
  40. package/dist/changelog-OHZ4M7D6.js.map +0 -1
  41. package/dist/docs-GP6AEX4N.js +0 -115
  42. package/dist/docs-GP6AEX4N.js.map +0 -1
  43. /package/dist/{audit-M7GYID74.js.map → audit-BDPS5ODN.js.map} +0 -0
  44. /package/dist/{chunk-QM5RTQ6R.js.map → chunk-I3SFXLIY.js.map} +0 -0
  45. /package/dist/{config-B76LNM7C.js.map → config-SK7BOURM.js.map} +0 -0
  46. /package/dist/{doctor-6SNZEFME.js.map → doctor-FSUI44DD.js.map} +0 -0
  47. /package/dist/{enterprise-SIKXDT64.js.map → enterprise-L7DTIX2O.js.map} +0 -0
  48. /package/dist/{external-transactions-JL3G4IG5.js.map → external-transactions-BP42CK3H.js.map} +0 -0
  49. /package/dist/{feedback-JRTQBJUP.js.map → feedback-PDQU5E6S.js.map} +0 -0
  50. /package/dist/{grants-UHNBPIFD.js.map → grants-32DED5QL.js.map} +0 -0
  51. /package/dist/{iap-ETOL7OAC.js.map → iap-EPJ76IAC.js.map} +0 -0
  52. /package/dist/{init-6CCSVJC2.js.map → init-OCBFI4VH.js.map} +0 -0
  53. /package/dist/{listings-2Z6DSO3D.js.map → listings-QKRIVZG6.js.map} +0 -0
  54. /package/dist/{one-time-products-Y5RNIPV2.js.map → one-time-products-OIDBVCFE.js.map} +0 -0
  55. /package/dist/{publish-5HZAJEDZ.js.map → publish-H2IAOKP7.js.map} +0 -0
  56. /package/dist/{purchases-AHWGLW6V.js.map → purchases-GFLYTKR3.js.map} +0 -0
  57. /package/dist/{recovery-B7DZQ6XG.js.map → recovery-2VJJLAIQ.js.map} +0 -0
  58. /package/dist/{releases-XY57V22L.js.map → releases-RTF5NPTD.js.map} +0 -0
  59. /package/dist/{reviews-P4M6BEJI.js.map → reviews-GZ2VOIRN.js.map} +0 -0
  60. /package/dist/{subscriptions-GTVJB4HX.js.map → subscriptions-JPHFBREY.js.map} +0 -0
  61. /package/dist/{system-apks-L6M7QYB3.js.map → system-apks-KWTN5LHO.js.map} +0 -0
  62. /package/dist/{testers-FGLBJAXL.js.map → testers-7ILUCKYB.js.map} +0 -0
  63. /package/dist/{train-D2NKUW3M.js.map → train-G44NEK43.js.map} +0 -0
  64. /package/dist/{update-6AGIO5DW.js.map → update-E4VGHQUR.js.map} +0 -0
  65. /package/dist/{users-FOMAT7DY.js.map → users-W66YCFDX.js.map} +0 -0
  66. /package/dist/{version-JL66BIVI.js.map → version-HXUIOHCL.js.map} +0 -0
@@ -67,41 +67,41 @@ function registerPluginCommands(program, manager) {
67
67
  import { Command } from "commander";
68
68
  async function createProgram(pluginManager) {
69
69
  const program = new Command();
70
- program.name("gpc").description("GPC \u2014 Google Play Console CLI").version("0.9.62", "-V, --version").option("-o, --output <format>", "Output format: table, json, yaml, markdown, junit").option("-v, --verbose", "Enable debug logging").option("-q, --quiet", "Suppress non-essential output").option("-a, --app <package>", "App package name").option("-p, --profile <name>", "Auth profile name").option("--no-color", "Disable colored output").option("--no-interactive", "Disable interactive prompts").option("-y, --yes", "Skip confirmation prompts").option("--dry-run", "Preview changes without executing").option("--notify [target]", "Send webhook notification on completion (slack, discord, custom)").option("--ci", "Force CI mode (JSON output, no prompts, strict exit codes)").option("-j, --json", "Shorthand for --output json").option("--apps <csv>", "Comma-separated package names for multi-app operations").showSuggestionAfterError(false);
70
+ program.name("gpc").description("GPC \u2014 Google Play Console CLI").version("0.9.64", "-V, --version").option("-o, --output <format>", "Output format: table, json, yaml, markdown, junit").option("-v, --verbose", "Enable debug logging").option("-q, --quiet", "Suppress non-essential output").option("-a, --app <package>", "App package name").option("-p, --profile <name>", "Auth profile name").option("--no-color", "Disable colored output").option("--no-interactive", "Disable interactive prompts").option("-y, --yes", "Skip confirmation prompts").option("--dry-run", "Preview changes without executing").option("--notify [target]", "Send webhook notification on completion (slack, discord, custom)").option("--ci", "Force CI mode (JSON output, no prompts, strict exit codes)").option("-j, --json", "Shorthand for --output json").option("--apps <csv>", "Comma-separated package names for multi-app operations").showSuggestionAfterError(false);
71
71
  const commandLoaders = {
72
72
  auth: async () => {
73
73
  (await import("./auth-4DRT7ZH2.js")).registerAuthCommands(program);
74
74
  },
75
75
  config: async () => {
76
- (await import("./config-B76LNM7C.js")).registerConfigCommands(program);
76
+ (await import("./config-SK7BOURM.js")).registerConfigCommands(program);
77
77
  },
78
78
  doctor: async () => {
79
- (await import("./doctor-6SNZEFME.js")).registerDoctorCommand(program);
79
+ (await import("./doctor-FSUI44DD.js")).registerDoctorCommand(program);
80
80
  },
81
81
  update: async () => {
82
- (await import("./update-6AGIO5DW.js")).registerUpdateCommand(program);
82
+ (await import("./update-E4VGHQUR.js")).registerUpdateCommand(program);
83
83
  },
84
84
  docs: async () => {
85
- (await import("./docs-GP6AEX4N.js")).registerDocsCommand(program);
85
+ (await import("./docs-WVJCDX5X.js")).registerDocsCommand(program);
86
86
  },
87
87
  changelog: async () => {
88
- (await import("./changelog-OHZ4M7D6.js")).registerChangelogCommand(program);
88
+ (await import("./changelog-EHQYZP22.js")).registerChangelogCommand(program);
89
89
  },
90
90
  completion: async () => {
91
- (await import("./completion-4I3IJK3M.js")).registerCompletionCommand(program, async () => {
91
+ (await import("./completion-ZK7RPPFD.js")).registerCompletionCommand(program, async () => {
92
92
  await Promise.all(
93
93
  Object.entries(commandLoaders).filter(([name]) => name !== "completion").map(([, loader2]) => loader2())
94
94
  );
95
95
  });
96
96
  },
97
97
  __complete: async () => {
98
- (await import("./__complete-QFD3SUAO.js")).registerCompleteCommand(program);
98
+ (await import("./__complete-AZXI2O25.js")).registerCompleteCommand(program);
99
99
  },
100
100
  apps: async () => {
101
101
  (await import("./apps-WPUQOQLL.js")).registerAppsCommands(program);
102
102
  },
103
103
  releases: async () => {
104
- (await import("./releases-XY57V22L.js")).registerReleasesCommands(program);
104
+ (await import("./releases-RTF5NPTD.js")).registerReleasesCommands(program);
105
105
  },
106
106
  tracks: async () => {
107
107
  (await import("./tracks-RH3RKVFB.js")).registerTracksCommands(program);
@@ -110,22 +110,22 @@ async function createProgram(pluginManager) {
110
110
  (await import("./status-32AJ7A6O.js")).registerStatusCommand(program);
111
111
  },
112
112
  listings: async () => {
113
- (await import("./listings-2Z6DSO3D.js")).registerListingsCommands(program);
113
+ (await import("./listings-QKRIVZG6.js")).registerListingsCommands(program);
114
114
  },
115
115
  reviews: async () => {
116
- (await import("./reviews-P4M6BEJI.js")).registerReviewsCommands(program);
116
+ (await import("./reviews-GZ2VOIRN.js")).registerReviewsCommands(program);
117
117
  },
118
118
  vitals: async () => {
119
119
  (await import("./vitals-QPHS6QFH.js")).registerVitalsCommands(program);
120
120
  },
121
121
  subscriptions: async () => {
122
- (await import("./subscriptions-GTVJB4HX.js")).registerSubscriptionsCommands(program);
122
+ (await import("./subscriptions-JPHFBREY.js")).registerSubscriptionsCommands(program);
123
123
  },
124
124
  iap: async () => {
125
- (await import("./iap-ETOL7OAC.js")).registerIapCommands(program);
125
+ (await import("./iap-EPJ76IAC.js")).registerIapCommands(program);
126
126
  },
127
127
  purchases: async () => {
128
- (await import("./purchases-AHWGLW6V.js")).registerPurchasesCommands(program);
128
+ (await import("./purchases-GFLYTKR3.js")).registerPurchasesCommands(program);
129
129
  },
130
130
  pricing: async () => {
131
131
  (await import("./pricing-HYQRXKNO.js")).registerPricingCommands(program);
@@ -134,25 +134,25 @@ async function createProgram(pluginManager) {
134
134
  (await import("./reports-CIB2T3XT.js")).registerReportsCommands(program);
135
135
  },
136
136
  users: async () => {
137
- (await import("./users-FOMAT7DY.js")).registerUsersCommands(program);
137
+ (await import("./users-W66YCFDX.js")).registerUsersCommands(program);
138
138
  },
139
139
  testers: async () => {
140
- (await import("./testers-FGLBJAXL.js")).registerTestersCommands(program);
140
+ (await import("./testers-7ILUCKYB.js")).registerTestersCommands(program);
141
141
  },
142
142
  validate: async () => {
143
143
  (await import("./validate-RHWEZYD2.js")).registerValidateCommand(program);
144
144
  },
145
145
  publish: async () => {
146
- (await import("./publish-5HZAJEDZ.js")).registerPublishCommand(program);
146
+ (await import("./publish-H2IAOKP7.js")).registerPublishCommand(program);
147
147
  },
148
148
  recovery: async () => {
149
- (await import("./recovery-B7DZQ6XG.js")).registerRecoveryCommands(program);
149
+ (await import("./recovery-2VJJLAIQ.js")).registerRecoveryCommands(program);
150
150
  },
151
151
  "data-safety": async () => {
152
152
  (await import("./data-safety-46VY64OO.js")).registerDataSafetyCommands(program);
153
153
  },
154
154
  "external-transactions": async () => {
155
- (await import("./external-transactions-JL3G4IG5.js")).registerExternalTransactionsCommands(
155
+ (await import("./external-transactions-BP42CK3H.js")).registerExternalTransactionsCommands(
156
156
  program
157
157
  );
158
158
  },
@@ -160,7 +160,7 @@ async function createProgram(pluginManager) {
160
160
  (await import("./device-tiers-MNZYMG3Y.js")).registerDeviceTiersCommands(program);
161
161
  },
162
162
  "one-time-products": async () => {
163
- (await import("./one-time-products-Y5RNIPV2.js")).registerOneTimeProductsCommands(program);
163
+ (await import("./one-time-products-OIDBVCFE.js")).registerOneTimeProductsCommands(program);
164
164
  },
165
165
  "internal-sharing": async () => {
166
166
  (await import("./internal-sharing-KW6YENDG.js")).registerInternalSharingCommands(program);
@@ -169,7 +169,7 @@ async function createProgram(pluginManager) {
169
169
  (await import("./generated-apks-TC33S2YN.js")).registerGeneratedApksCommands(program);
170
170
  },
171
171
  "system-apks": async () => {
172
- (await import("./system-apks-L6M7QYB3.js")).registerSystemApksCommands(program);
172
+ (await import("./system-apks-KWTN5LHO.js")).registerSystemApksCommands(program);
173
173
  },
174
174
  "purchase-options": async () => {
175
175
  (await import("./purchase-options-KFWW4JW2.js")).registerPurchaseOptionsCommands(program);
@@ -178,7 +178,7 @@ async function createProgram(pluginManager) {
178
178
  (await import("./bundle-PFTE7XMU.js")).registerBundleCommands(program);
179
179
  },
180
180
  audit: async () => {
181
- (await import("./audit-M7GYID74.js")).registerAuditCommands(program);
181
+ (await import("./audit-BDPS5ODN.js")).registerAuditCommands(program);
182
182
  },
183
183
  migrate: async () => {
184
184
  (await import("./migrate-ZQCJGQQS.js")).registerMigrateCommands(program);
@@ -193,22 +193,22 @@ async function createProgram(pluginManager) {
193
193
  (await import("./verify-H4ZUVHMZ.js")).registerVerifyCommand(program);
194
194
  },
195
195
  version: async () => {
196
- (await import("./version-JL66BIVI.js")).registerVersionCommand(program);
196
+ (await import("./version-HXUIOHCL.js")).registerVersionCommand(program);
197
197
  },
198
198
  cache: async () => {
199
199
  (await import("./cache-FGNP7Y37.js")).registerCacheCommand(program);
200
200
  },
201
201
  feedback: async () => {
202
- (await import("./feedback-JRTQBJUP.js")).registerFeedbackCommand(program);
202
+ (await import("./feedback-PDQU5E6S.js")).registerFeedbackCommand(program);
203
203
  },
204
204
  quickstart: async () => {
205
205
  (await import("./quickstart-FOWM3OKT.js")).registerQuickstartCommand(program);
206
206
  },
207
207
  grants: async () => {
208
- (await import("./grants-UHNBPIFD.js")).registerGrantsCommands(program);
208
+ (await import("./grants-32DED5QL.js")).registerGrantsCommands(program);
209
209
  },
210
210
  train: async () => {
211
- (await import("./train-D2NKUW3M.js")).registerTrainCommands(program);
211
+ (await import("./train-G44NEK43.js")).registerTrainCommands(program);
212
212
  },
213
213
  quota: async () => {
214
214
  (await import("./quota-MZRWYJGR.js")).registerQuotaCommand(program);
@@ -217,13 +217,13 @@ async function createProgram(pluginManager) {
217
217
  (await import("./games-SVFN2YIS.js")).registerGamesCommands(program);
218
218
  },
219
219
  enterprise: async () => {
220
- (await import("./enterprise-SIKXDT64.js")).registerEnterpriseCommands(program);
220
+ (await import("./enterprise-L7DTIX2O.js")).registerEnterpriseCommands(program);
221
221
  },
222
222
  diff: async () => {
223
223
  (await import("./diff-OBSHUSTL.js")).registerDiffCommand(program);
224
224
  },
225
225
  init: async () => {
226
- (await import("./init-6CCSVJC2.js")).registerInitCommand(program);
226
+ (await import("./init-OCBFI4VH.js")).registerInitCommand(program);
227
227
  },
228
228
  preflight: async () => {
229
229
  (await import("./preflight-KIWZPFTX.js")).registerPreflightCommand(program);
@@ -467,4 +467,4 @@ export {
467
467
  createProgram,
468
468
  handleCliError
469
469
  };
470
- //# sourceMappingURL=chunk-QM5RTQ6R.js.map
470
+ //# sourceMappingURL=chunk-I3SFXLIY.js.map
@@ -704,10 +704,14 @@ function generateFishCompletions(tree = getCommandTree(), globals = []) {
704
704
  for (const flag of flags) {
705
705
  if (flag.startsWith("--")) {
706
706
  const longName = flag.slice(2);
707
- lines.push(`complete -c gpc -l ${longName} -x -a '(gpc __complete ${context} 2>/dev/null)'`);
707
+ lines.push(
708
+ `complete -c gpc -l ${longName} -x -a '(gpc __complete ${context} 2>/dev/null)'`
709
+ );
708
710
  } else if (flag.startsWith("-")) {
709
711
  const shortName = flag.slice(1);
710
- lines.push(`complete -c gpc -s ${shortName} -x -a '(gpc __complete ${context} 2>/dev/null)'`);
712
+ lines.push(
713
+ `complete -c gpc -s ${shortName} -x -a '(gpc __complete ${context} 2>/dev/null)'`
714
+ );
711
715
  }
712
716
  }
713
717
  }
@@ -799,4 +803,4 @@ export {
799
803
  getCommandTree,
800
804
  registerCompletionCommand
801
805
  };
802
- //# sourceMappingURL=completion-4I3IJK3M.js.map
806
+ //# sourceMappingURL=completion-ZK7RPPFD.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/commands/completion.ts"],"sourcesContent":["import type { Command, Option } from \"commander\";\n\nexport type ShellType = \"bash\" | \"zsh\" | \"fish\" | \"powershell\";\n\nexport const SUPPORTED_SHELLS: readonly ShellType[] = [\n \"bash\",\n \"zsh\",\n \"fish\",\n \"powershell\",\n] as const;\n\nexport interface OptionDef {\n flags: string;\n long?: string;\n short?: string;\n description: string;\n choices?: string[];\n takesValue: boolean;\n}\n\nexport interface CommandDef {\n description: string;\n subcommands?: Record<string, CommandDef>;\n options?: OptionDef[];\n}\n\n/**\n * Hand-maintained fallback tree. Used by unit tests and as a safety net when\n * the walker cannot introspect the program (e.g. when the generator is called\n * without a live Command instance). Runtime `gpc completion <shell>` uses the\n * introspected tree from `buildCommandTreeFromProgram` so new commands and\n * plugins auto-complete without requiring edits here.\n */\nexport function getCommandTree(): Record<string, CommandDef> {\n return {\n auth: {\n description: \"Manage authentication\",\n subcommands: {\n login: { description: \"Authenticate with Google Play Developer API\" },\n status: { description: \"Show current authentication status\" },\n logout: { description: \"Remove stored credentials\" },\n whoami: { description: \"Show the authenticated account\" },\n },\n },\n config: {\n description: \"Manage configuration\",\n subcommands: {\n init: { description: \"Create a configuration file\" },\n show: { description: \"Show current configuration\" },\n set: { description: \"Set a configuration value\" },\n path: { description: \"Show the configuration file path\" },\n },\n },\n apps: {\n description: \"Manage applications\",\n subcommands: {\n info: { description: \"Show app details\" },\n update: { description: \"Update app details\" },\n list: { description: \"List configured applications\" },\n },\n },\n releases: {\n description: \"Manage releases and rollouts\",\n subcommands: {\n upload: { description: \"Upload AAB/APK and assign to a track\" },\n status: { description: \"Show current release status across tracks\" },\n promote: { description: \"Promote a release from one track to another\" },\n rollout: {\n description: \"Manage staged rollouts\",\n subcommands: {\n increase: { description: \"Increase a staged rollout\" },\n halt: { description: \"Halt a staged rollout\" },\n resume: { description: \"Resume a staged rollout\" },\n complete: { description: \"Complete a staged rollout\" },\n },\n },\n notes: { description: \"Set release notes\" },\n },\n },\n tracks: {\n description: \"Manage tracks\",\n subcommands: {\n list: { description: \"List all tracks\" },\n },\n },\n status: { description: \"Cross-track release overview\" },\n listings: {\n description: \"Manage store listings and metadata\",\n subcommands: {\n get: { description: \"Get store listing(s)\" },\n update: { description: \"Update a store listing\" },\n delete: { description: \"Delete a store listing for a language\" },\n pull: { description: \"Download listings to Fastlane-format directory\" },\n push: { description: \"Upload listings from Fastlane-format directory\" },\n images: {\n description: \"Manage listing images\",\n subcommands: {\n list: { description: \"List images for a language and type\" },\n upload: { description: \"Upload an image\" },\n delete: { description: \"Delete an image\" },\n },\n },\n availability: { description: \"Get country availability for a track\" },\n },\n },\n reviews: {\n description: \"Manage user reviews and ratings\",\n subcommands: {\n list: { description: \"List user reviews\" },\n get: { description: \"Get a single review\" },\n reply: { description: \"Reply to a review\" },\n export: { description: \"Export reviews to JSON or CSV\" },\n },\n },\n vitals: {\n description: \"Monitor app vitals and performance metrics\",\n subcommands: {\n overview: { description: \"Dashboard summary of all vital metrics\" },\n crashes: { description: \"Query crash rate metrics\" },\n anr: { description: \"Query ANR rate metrics\" },\n startup: { description: \"Query slow startup metrics\" },\n rendering: { description: \"Query slow rendering metrics\" },\n battery: { description: \"Query excessive wakeup metrics\" },\n memory: { description: \"Query stuck wakelock metrics\" },\n anomalies: { description: \"Detect anomalies in app vitals\" },\n errors: {\n description: \"Search and view error issues\",\n subcommands: {\n search: { description: \"Search error issues\" },\n },\n },\n compare: { description: \"Compare metric trend between periods\" },\n },\n },\n subscriptions: {\n description: \"Manage subscriptions and base plans\",\n subcommands: {\n list: { description: \"List subscriptions\" },\n get: { description: \"Get a subscription\" },\n create: { description: \"Create a subscription from JSON file\" },\n update: { description: \"Update a subscription from JSON file\" },\n delete: { description: \"Delete a subscription\" },\n \"base-plans\": {\n description: \"Manage base plans\",\n subcommands: {\n activate: { description: \"Activate a base plan\" },\n deactivate: { description: \"Deactivate a base plan\" },\n delete: { description: \"Delete a base plan\" },\n \"migrate-prices\": { description: \"Migrate base plan prices\" },\n },\n },\n offers: {\n description: \"Manage subscription offers\",\n subcommands: {\n list: { description: \"List offers for a base plan\" },\n get: { description: \"Get an offer\" },\n create: { description: \"Create an offer from JSON file\" },\n update: { description: \"Update an offer from JSON file\" },\n delete: { description: \"Delete an offer\" },\n activate: { description: \"Activate an offer\" },\n deactivate: { description: \"Deactivate an offer\" },\n },\n },\n },\n },\n iap: {\n description: \"Manage in-app products\",\n subcommands: {\n list: { description: \"List in-app products\" },\n get: { description: \"Get an in-app product\" },\n create: { description: \"Create an in-app product from JSON file\" },\n update: { description: \"Update an in-app product from JSON file\" },\n delete: { description: \"Delete an in-app product\" },\n sync: { description: \"Sync in-app products from a directory\" },\n },\n },\n purchases: {\n description: \"Manage purchases and orders\",\n subcommands: {\n get: { description: \"Get a product purchase\" },\n acknowledge: { description: \"Acknowledge a product purchase\" },\n consume: { description: \"Consume a product purchase\" },\n subscription: {\n description: \"Manage subscription purchases\",\n subcommands: {\n get: { description: \"Get a subscription purchase\" },\n cancel: { description: \"Cancel a subscription\" },\n defer: { description: \"Defer a subscription expiry\" },\n revoke: { description: \"Revoke a subscription\" },\n },\n },\n voided: { description: \"List voided purchases\" },\n orders: {\n description: \"Manage orders\",\n subcommands: {\n refund: { description: \"Refund an order\" },\n },\n },\n },\n },\n pricing: {\n description: \"Pricing and regional price conversion\",\n subcommands: {\n convert: { description: \"Convert a price to all regional prices\" },\n },\n },\n reports: {\n description: \"Download financial and stats reports\",\n subcommands: {\n list: { description: \"List available report buckets\" },\n download: {\n description: \"Download a report\",\n subcommands: {\n financial: { description: \"Download a financial report\" },\n stats: { description: \"Download a stats report\" },\n },\n },\n },\n },\n users: {\n description: \"Manage developer account users and permissions\",\n subcommands: {\n list: { description: \"List all users in the developer account\" },\n get: { description: \"Get user details\" },\n invite: { description: \"Invite a user to the developer account\" },\n update: { description: \"Update user permissions\" },\n remove: { description: \"Remove a user from the developer account\" },\n },\n },\n testers: {\n description: \"Manage testers and tester groups\",\n subcommands: {\n list: { description: \"List testers for a track\" },\n add: { description: \"Add testers to a track\" },\n remove: { description: \"Remove testers from a track\" },\n import: { description: \"Import testers from a CSV file\" },\n },\n },\n recovery: {\n description: \"Manage app recovery actions\",\n subcommands: {\n list: { description: \"List app recovery actions\" },\n cancel: { description: \"Cancel a recovery action\" },\n deploy: { description: \"Deploy a recovery action\" },\n create: { description: \"Create a recovery action\" },\n \"add-targeting\": { description: \"Add targeting to a recovery action\" },\n },\n },\n \"data-safety\": {\n description: \"Manage data safety declarations\",\n subcommands: {\n get: { description: \"Get data safety declaration\" },\n update: { description: \"Update data safety declaration\" },\n export: { description: \"Export data safety declaration\" },\n },\n },\n \"external-transactions\": {\n description: \"Manage external transactions\",\n subcommands: {\n create: { description: \"Create an external transaction\" },\n get: { description: \"Get an external transaction\" },\n refund: { description: \"Refund an external transaction\" },\n },\n },\n \"device-tiers\": {\n description: \"Manage device tier configurations\",\n subcommands: {\n list: { description: \"List device tier configurations\" },\n get: { description: \"Get a device tier configuration\" },\n create: { description: \"Create a device tier configuration\" },\n },\n },\n \"one-time-products\": {\n description: \"Manage one-time products\",\n subcommands: {\n list: { description: \"List one-time products\" },\n get: { description: \"Get a one-time product\" },\n create: { description: \"Create a one-time product\" },\n update: { description: \"Update a one-time product\" },\n delete: { description: \"Delete a one-time product\" },\n offers: {\n description: \"Manage one-time product offers\",\n subcommands: {\n list: { description: \"List offers for a one-time product\" },\n get: { description: \"Get a one-time product offer\" },\n create: { description: \"Create a one-time product offer\" },\n update: { description: \"Update a one-time product offer\" },\n delete: { description: \"Delete a one-time product offer\" },\n },\n },\n },\n },\n \"internal-sharing\": {\n description: \"Manage internal app sharing\",\n subcommands: {\n upload: { description: \"Upload an artifact for internal sharing\" },\n },\n },\n \"generated-apks\": {\n description: \"Manage generated APKs from app bundles\",\n subcommands: {\n list: { description: \"List generated APKs for a version\" },\n download: { description: \"Download a generated APK\" },\n },\n },\n doctor: { description: \"Verify setup and connectivity\" },\n docs: { description: \"Open documentation in browser\" },\n validate: { description: \"Pre-submission validation checks\" },\n publish: { description: \"Validate, upload, and release in one step\" },\n completion: {\n description: \"Generate shell completions\",\n subcommands: {\n bash: { description: \"Generate bash completions\" },\n zsh: { description: \"Generate zsh completions\" },\n fish: { description: \"Generate fish completions\" },\n powershell: { description: \"Generate PowerShell completions\" },\n },\n },\n plugins: {\n description: \"Manage plugins\",\n subcommands: {\n list: { description: \"List loaded plugins\" },\n init: { description: \"Scaffold a new plugin project\" },\n approve: { description: \"Approve a third-party plugin for loading\" },\n revoke: { description: \"Revoke approval for a third-party plugin\" },\n },\n },\n };\n}\n\n/** Map a Commander Option to an OptionDef used by the shell generators. */\nfunction optionToDef(opt: Option): OptionDef {\n const flags = opt.flags;\n // Commander exposes parsed long/short on the Option; fall back to parsing `.flags` if missing.\n const long = opt.long ?? undefined;\n const short = opt.short ?? undefined;\n // `takesValue` is true when the raw flags contain <placeholder> or [placeholder].\n const takesValue = /[<[][^>\\]]+[>\\]]/.test(flags);\n // Commander 14 exposes `.argChoices`; fall back gracefully if absent.\n const rawChoices = (opt as unknown as { argChoices?: readonly string[] }).argChoices;\n const choices = rawChoices && rawChoices.length > 0 ? Array.from(rawChoices) : undefined;\n return {\n flags,\n long: long ?? undefined,\n short: short ?? undefined,\n description: opt.description ?? \"\",\n choices,\n takesValue,\n };\n}\n\n/** Whether a Commander command was registered with `{ hidden: true }`. */\nfunction isHidden(cmd: Command): boolean {\n return (cmd as unknown as { _hidden?: boolean })._hidden === true;\n}\n\n/** Recursively walk a Commander Command into the completion tree shape. */\nfunction commandToDef(cmd: Command): CommandDef {\n const def: CommandDef = {\n description: cmd.description() ?? \"\",\n };\n const options = cmd.options\n .filter((o) => !o.hidden)\n .map(optionToDef)\n .filter((o) => o.long || o.short);\n if (options.length > 0) {\n def.options = options;\n }\n const subs = cmd.commands.filter((c) => c.name() !== \"help\" && !isHidden(c));\n if (subs.length > 0) {\n def.subcommands = {};\n for (const sub of subs) {\n def.subcommands[sub.name()] = commandToDef(sub);\n }\n }\n return def;\n}\n\n/** Build a completion tree by introspecting a fully-loaded Commander program. */\nexport function buildCommandTreeFromProgram(program: Command): Record<string, CommandDef> {\n const tree: Record<string, CommandDef> = {};\n for (const cmd of program.commands) {\n if (cmd.name() === \"help\" || isHidden(cmd)) continue;\n tree[cmd.name()] = commandToDef(cmd);\n }\n return tree;\n}\n\n/** Collect global options declared on the root program. */\nexport function collectGlobalOptions(program: Command): OptionDef[] {\n return program.options\n .filter((o) => !o.hidden)\n .map(optionToDef)\n .filter((o) => o.long || o.short);\n}\n\nexport function registerCompletionCommand(\n program: Command,\n ensureAllCommandsLoaded?: () => Promise<void>,\n): void {\n const completion = program.command(\"completion\").description(\"Generate shell completions\");\n\n const generate = async (\n shell: ShellType,\n gen: (tree: Record<string, CommandDef>, globals: OptionDef[]) => string,\n ): Promise<void> => {\n if (ensureAllCommandsLoaded) {\n await ensureAllCommandsLoaded();\n }\n const tree = ensureAllCommandsLoaded ? buildCommandTreeFromProgram(program) : getCommandTree();\n const globals = collectGlobalOptions(program);\n // Suppress unused-shell warning; shell type reserved for future per-shell tuning.\n void shell;\n console.log(gen(tree, globals));\n };\n\n completion\n .command(\"bash\")\n .description(\"Generate bash completions\")\n .action(async () => {\n await generate(\"bash\", generateBashCompletions);\n });\n\n completion\n .command(\"zsh\")\n .description(\"Generate zsh completions\")\n .action(async () => {\n await generate(\"zsh\", generateZshCompletions);\n });\n\n completion\n .command(\"fish\")\n .description(\"Generate fish completions\")\n .action(async () => {\n await generate(\"fish\", generateFishCompletions);\n });\n\n completion\n .command(\"powershell\")\n .description(\"Generate PowerShell completions\")\n .action(async () => {\n await generate(\"powershell\", generatePowerShellCompletions);\n });\n}\n\n/**\n * Return only options that have choices or long flags useful for completion\n * suggestion. `-V/--version` and `-h/--help` are filtered out to avoid noise.\n */\nfunction completableOptions(options: OptionDef[] | undefined): OptionDef[] {\n if (!options) return [];\n return options.filter((o) => {\n if (!o.long) return false;\n if (o.long === \"--help\" || o.long === \"--version\") return false;\n return true;\n });\n}\n\n/**\n * Shell-completion flag slots that carry dynamic values (profiles, package\n * names, track names). Generated scripts shell out to `gpc __complete <ctx>`\n * to resolve these at TAB time. Shared across bash / zsh / fish generators.\n */\nconst DYNAMIC_FLAG_CONTEXTS: Array<{ flags: string[]; context: string }> = [\n { flags: [\"--profile\", \"-p\"], context: \"profiles\" },\n { flags: [\"--app\", \"-a\"], context: \"packages\" },\n { flags: [\"--apps\"], context: \"packages\" },\n { flags: [\"--track\"], context: \"tracks-for-app\" },\n];\n\nexport function generateBashCompletions(\n tree: Record<string, CommandDef> = getCommandTree(),\n globals: OptionDef[] = [],\n): string {\n const topLevelNames = Object.keys(tree).join(\" \");\n\n const globalFlags = completableOptions(globals)\n .map((o) => o.long ?? \"\")\n .filter(Boolean)\n .join(\" \");\n\n // Build case entries for each command that has subcommands (up to 3 levels)\n // and emit flag completion branches for commands with options.\n const caseEntries: string[] = [];\n const flagCases: string[] = [];\n\n // Dynamic flag-value completion: shell out to `gpc __complete <ctx>`.\n for (const { flags, context } of DYNAMIC_FLAG_CONTEXTS) {\n for (const flag of flags) {\n flagCases.push(\n ` ${flag})\\n COMPREPLY=( $(compgen -W \"$(gpc __complete ${context} 2>/dev/null)\" -- \"\\${cur}\") )\\n return 0\\n ;;`,\n );\n }\n }\n\n const allCommandNames = new Set<string>();\n const collectNames = (defs: Record<string, CommandDef>) => {\n for (const [name, def] of Object.entries(defs)) {\n allCommandNames.add(name);\n if (def.subcommands) collectNames(def.subcommands);\n }\n };\n collectNames(tree);\n\n for (const [cmd, def] of Object.entries(tree)) {\n if (def.subcommands) {\n const subNames = Object.keys(def.subcommands).join(\" \");\n caseEntries.push(\n ` ${cmd})\\n COMPREPLY=( $(compgen -W \"${subNames}\" -- \"\\${cur}\") )\\n return 0\\n ;;`,\n );\n\n for (const [sub, subDef] of Object.entries(def.subcommands)) {\n if (subDef.subcommands) {\n const subSubNames = Object.keys(subDef.subcommands).join(\" \");\n caseEntries.push(\n ` ${sub})\\n COMPREPLY=( $(compgen -W \"${subSubNames}\" -- \"\\${cur}\") )\\n return 0\\n ;;`,\n );\n }\n }\n }\n\n // Collect flags that carry choices from this command + its subtree.\n const walk = (d: CommandDef) => {\n for (const opt of completableOptions(d.options)) {\n if (opt.choices && opt.long) {\n flagCases.push(\n ` ${opt.long})\\n COMPREPLY=( $(compgen -W \"${joinBashChoices(opt.choices)}\" -- \"\\${cur}\") )\\n return 0\\n ;;`,\n );\n }\n }\n if (d.subcommands) for (const s of Object.values(d.subcommands)) walk(s);\n };\n walk(def);\n }\n\n // Global-option choices (e.g. --output table|json|yaml|markdown|junit).\n for (const opt of completableOptions(globals)) {\n if (opt.choices && opt.long) {\n flagCases.push(\n ` ${opt.long})\\n COMPREPLY=( $(compgen -W \"${joinBashChoices(opt.choices)}\" -- \"\\${cur}\") )\\n return 0\\n ;;`,\n );\n }\n }\n\n return `# bash completion for gpc\n# Install: gpc completion bash >> ~/.bashrc\n_gpc() {\n local cur prev commands globals\n COMPREPLY=()\n cur=\"\\${COMP_WORDS[COMP_CWORD]}\"\n prev=\"\\${COMP_WORDS[COMP_CWORD-1]}\"\n\n commands=\"${topLevelNames}\"\n globals=\"${globalFlags}\"\n\n # Flag-value completion (choices)\n case \"\\${prev}\" in\n${flagCases.join(\"\\n\")}\n esac\n\n # When the current word starts with '-', complete known flags\n if [[ \"\\${cur}\" == -* ]]; then\n COMPREPLY=( $(compgen -W \"\\${globals}\" -- \"\\${cur}\") )\n return 0\n fi\n\n case \"\\${prev}\" in\n gpc)\n COMPREPLY=( $(compgen -W \"\\${commands}\" -- \"\\${cur}\") )\n return 0\n ;;\n${caseEntries.join(\"\\n\")}\n esac\n\n COMPREPLY=( $(compgen -W \"\\${commands}\" -- \"\\${cur}\") )\n return 0\n}\n\ncomplete -F _gpc gpc`;\n}\n\nexport function generateZshCompletions(\n tree: Record<string, CommandDef> = getCommandTree(),\n globals: OptionDef[] = [],\n): string {\n const arrayDefs: string[] = [];\n const caseBranches: string[] = [];\n\n const topEntries = Object.entries(tree)\n .map(([name, def]) => ` '${name}:${escapeZsh(def.description)}'`)\n .join(\"\\n\");\n arrayDefs.push(` commands=(\\n${topEntries}\\n )`);\n\n for (const [cmd, def] of Object.entries(tree)) {\n if (def.subcommands) {\n const varName = `${cmd.replace(/-/g, \"_\")}_commands`;\n const entries = Object.entries(def.subcommands)\n .map(([name, sub]) => ` '${name}:${escapeZsh(sub.description)}'`)\n .join(\"\\n\");\n arrayDefs.push(` ${varName}=(\\n${entries}\\n )`);\n caseBranches.push(\n ` ${cmd})\\n _describe -t ${varName} '${cmd} commands' ${varName}\\n ;;`,\n );\n\n for (const [sub, subDef] of Object.entries(def.subcommands)) {\n if (subDef.subcommands) {\n const subVarName = `${cmd.replace(/-/g, \"_\")}_${sub.replace(/-/g, \"_\")}_commands`;\n const subEntries = Object.entries(subDef.subcommands)\n .map(([name, s]) => ` '${name}:${escapeZsh(s.description)}'`)\n .join(\"\\n\");\n arrayDefs.push(` ${subVarName}=(\\n${subEntries}\\n )`);\n }\n }\n }\n }\n\n const level3Cases: string[] = [];\n for (const [cmd, def] of Object.entries(tree)) {\n if (!def.subcommands) continue;\n for (const [sub, subDef] of Object.entries(def.subcommands)) {\n if (subDef.subcommands) {\n const subVarName = `${cmd.replace(/-/g, \"_\")}_${sub.replace(/-/g, \"_\")}_commands`;\n level3Cases.push(\n ` ${sub})\\n _describe -t ${subVarName} '${sub} commands' ${subVarName}\\n ;;`,\n );\n }\n }\n }\n\n const varNames: string[] = [\"commands\"];\n for (const [cmd, def] of Object.entries(tree)) {\n if (def.subcommands) {\n varNames.push(`${cmd.replace(/-/g, \"_\")}_commands`);\n for (const [sub, subDef] of Object.entries(def.subcommands)) {\n if (subDef.subcommands) {\n varNames.push(`${cmd.replace(/-/g, \"_\")}_${sub.replace(/-/g, \"_\")}_commands`);\n }\n }\n }\n }\n\n const localDecls = varNames.map((v) => ` local -a ${v}`).join(\"\\n\");\n\n // Static flag-choice option specs (e.g. --output table|json|yaml) harvested\n // from Commander's `.choices()` across the entire tree. Emitted into the\n // main _arguments call so zsh menu-completes them.\n const choiceSpecs = new Set<string>();\n const walkChoices = (defs: Record<string, CommandDef>) => {\n for (const def of Object.values(defs)) {\n for (const opt of completableOptions(def.options)) {\n if (opt.choices && opt.long) {\n choiceSpecs.add(\n `'${opt.long}[${escapeZsh(opt.description)}]:value:(${opt.choices.join(\" \")})'`,\n );\n }\n }\n if (def.subcommands) walkChoices(def.subcommands);\n }\n };\n walkChoices(tree);\n for (const opt of completableOptions(globals)) {\n if (opt.choices && opt.long) {\n choiceSpecs.add(\n `'${opt.long}[${escapeZsh(opt.description)}]:value:(${opt.choices.join(\" \")})'`,\n );\n }\n }\n\n // Dynamic-value option specs: each dynamic flag gets wired to a helper\n // function that shells out to `gpc __complete <ctx>`.\n const dynamicSpecs: string[] = [];\n for (const { flags, context } of DYNAMIC_FLAG_CONTEXTS) {\n for (const flag of flags) {\n const fn = `_gpc_${context.replace(/-/g, \"_\")}`;\n dynamicSpecs.push(`'${flag}[]:value:${fn}'`);\n }\n }\n\n const helperFns = `\n_gpc_profiles() {\n local -a items\n items=(\\${(f)\"$(gpc __complete profiles 2>/dev/null)\"})\n compadd -a items\n}\n_gpc_packages() {\n local -a items\n items=(\\${(f)\"$(gpc __complete packages 2>/dev/null)\"})\n compadd -a items\n}\n_gpc_tracks_for_app() {\n local -a items\n items=(\\${(f)\"$(gpc __complete tracks-for-app 2>/dev/null)\"})\n compadd -a items\n}`;\n\n const allSpecs = [...choiceSpecs, ...dynamicSpecs];\n const extraArgs = allSpecs.length > 0 ? ` \\\\\\n ${allSpecs.join(\" \\\\\\n \")}` : \"\";\n\n return `#compdef gpc\n# Install: gpc completion zsh > ~/.zsh/completions/_gpc\n${helperFns}\n\n_gpc() {\n${localDecls}\n\n${arrayDefs.join(\"\\n\\n\")}\n\n _arguments -C \\\\\n '1: :->command' \\\\\n '2: :->subcommand' \\\\\n '3: :->subsubcommand' \\\\\n '*::arg:->args'${extraArgs}\n\n case \"$state\" in\n command)\n _describe -t commands 'gpc commands' commands\n ;;\n subcommand)\n case \"$words[2]\" in\n${caseBranches.join(\"\\n\")}\n esac\n ;;\n subsubcommand)\n case \"$words[3]\" in\n${level3Cases.join(\"\\n\")}\n esac\n ;;\n esac\n}\n\n_gpc \"$@\"`;\n}\n\nexport function generateFishCompletions(\n tree: Record<string, CommandDef> = getCommandTree(),\n globals: OptionDef[] = [],\n): string {\n const lines: string[] = [\n \"# fish completions for gpc\",\n \"# Install: gpc completion fish > ~/.config/fish/completions/gpc.fish\",\n \"\",\n \"# Disable file completions by default\",\n \"complete -c gpc -f\",\n \"\",\n \"# Top-level commands\",\n ];\n\n for (const [cmd, def] of Object.entries(tree)) {\n lines.push(\n `complete -c gpc -n '__fish_use_subcommand' -a ${cmd} -d '${escapeFish(def.description)}'`,\n );\n }\n\n // Level 2 subcommands\n for (const [cmd, def] of Object.entries(tree)) {\n if (!def.subcommands) continue;\n lines.push(\"\");\n lines.push(`# ${cmd} subcommands`);\n for (const [sub, subDef] of Object.entries(def.subcommands)) {\n lines.push(\n `complete -c gpc -n '__fish_seen_subcommand_from ${cmd}; and not __fish_seen_subcommand_from ${Object.keys(def.subcommands).join(\" \")}' -a ${sub} -d '${escapeFish(subDef.description)}'`,\n );\n }\n\n // Level 3 subcommands\n for (const [sub, subDef] of Object.entries(def.subcommands)) {\n if (!subDef.subcommands) continue;\n lines.push(\"\");\n lines.push(`# ${cmd} ${sub} subcommands`);\n for (const [subsub, subsubDef] of Object.entries(subDef.subcommands)) {\n lines.push(\n `complete -c gpc -n '__fish_seen_subcommand_from ${sub}; and not __fish_seen_subcommand_from ${Object.keys(subDef.subcommands).join(\" \")}' -a ${subsub} -d '${escapeFish(subsubDef.description)}'`,\n );\n }\n }\n }\n\n // Global + per-command flag completions with choice lists.\n lines.push(\"\");\n lines.push(\"# Global flags\");\n for (const opt of completableOptions(globals)) {\n if (!opt.long) continue;\n const longName = opt.long.replace(/^--/, \"\");\n const shortName = opt.short ? opt.short.replace(/^-/, \"\") : undefined;\n const choiceArg = opt.choices ? ` -a '${opt.choices.join(\" \")}'` : \"\";\n const shortArg = shortName ? ` -s ${shortName}` : \"\";\n lines.push(\n `complete -c gpc -l ${longName}${shortArg} -d '${escapeFish(opt.description)}'${choiceArg}`,\n );\n }\n\n const walkFlags = (defs: Record<string, CommandDef>) => {\n for (const [name, def] of Object.entries(defs)) {\n const flags = completableOptions(def.options);\n if (flags.length > 0) {\n lines.push(\"\");\n lines.push(`# ${name} flags`);\n for (const opt of flags) {\n if (!opt.long) continue;\n const longName = opt.long.replace(/^--/, \"\");\n const shortName = opt.short ? opt.short.replace(/^-/, \"\") : undefined;\n const choiceArg = opt.choices ? ` -a '${opt.choices.join(\" \")}'` : \"\";\n const shortArg = shortName ? ` -s ${shortName}` : \"\";\n lines.push(\n `complete -c gpc -n '__fish_seen_subcommand_from ${name}' -l ${longName}${shortArg} -d '${escapeFish(opt.description)}'${choiceArg}`,\n );\n }\n }\n if (def.subcommands) walkFlags(def.subcommands);\n }\n };\n walkFlags(tree);\n\n // Dynamic flag-value completion: shell out to `gpc __complete <ctx>`.\n // Fish merges multiple `complete` directives for the same flag, so these\n // layer on top of the description-only lines emitted above.\n lines.push(\"\");\n lines.push(\"# Dynamic values (shell out to __complete)\");\n for (const { flags, context } of DYNAMIC_FLAG_CONTEXTS) {\n for (const flag of flags) {\n if (flag.startsWith(\"--\")) {\n const longName = flag.slice(2);\n lines.push(`complete -c gpc -l ${longName} -x -a '(gpc __complete ${context} 2>/dev/null)'`);\n } else if (flag.startsWith(\"-\")) {\n const shortName = flag.slice(1);\n lines.push(`complete -c gpc -s ${shortName} -x -a '(gpc __complete ${context} 2>/dev/null)'`);\n }\n }\n }\n\n return lines.join(\"\\n\");\n}\n\nexport function generatePowerShellCompletions(\n tree: Record<string, CommandDef> = getCommandTree(),\n globals: OptionDef[] = [],\n): string {\n const completionEntries: string[] = [];\n\n // Top-level completions\n for (const [cmd, def] of Object.entries(tree)) {\n completionEntries.push(\n ` [CompletionResult]::new('${cmd}', '${cmd}', [CompletionResultType]::ParameterValue, '${escapePowerShell(def.description)}')`,\n );\n }\n\n // Global flag completions (as parameters available from any state)\n for (const opt of completableOptions(globals)) {\n if (!opt.long) continue;\n completionEntries.push(\n ` [CompletionResult]::new('${opt.long}', '${opt.long}', [CompletionResultType]::ParameterName, '${escapePowerShell(opt.description)}')`,\n );\n }\n\n const subcommandCases: string[] = [];\n const level3Cases: string[] = [];\n\n for (const [cmd, def] of Object.entries(tree)) {\n if (!def.subcommands) continue;\n const subEntries = Object.entries(def.subcommands)\n .map(\n ([sub, subDef]) =>\n ` [CompletionResult]::new('${sub}', '${sub}', [CompletionResultType]::ParameterValue, '${escapePowerShell(subDef.description)}')`,\n )\n .join(\"\\n\");\n subcommandCases.push(` '${cmd}' {\\n${subEntries}\\n }`);\n\n for (const [sub, subDef] of Object.entries(def.subcommands)) {\n if (!subDef.subcommands) continue;\n const subSubEntries = Object.entries(subDef.subcommands)\n .map(\n ([subsub, subsubDef]) =>\n ` [CompletionResult]::new('${subsub}', '${subsub}', [CompletionResultType]::ParameterValue, '${escapePowerShell(subsubDef.description)}')`,\n )\n .join(\"\\n\");\n level3Cases.push(` '${sub}' {\\n${subSubEntries}\\n }`);\n }\n }\n\n return `# PowerShell completions for gpc\n# Install: gpc completion powershell >> $PROFILE\n\nusing namespace System.Management.Automation\n\nRegister-ArgumentCompleter -CommandName gpc -Native -ScriptBlock {\n param($wordToComplete, $commandAst, $cursorPosition)\n\n $tokens = $commandAst.ToString().Substring(0, $cursorPosition).Trim() -split '\\\\s+'\n $tokenCount = $tokens.Count\n\n # Determine context\n if ($tokenCount -le 1 -or ($tokenCount -eq 2 -and $wordToComplete)) {\n # Top-level commands\n${completionEntries.join(\"\\n\")}\n } elseif ($tokenCount -eq 2 -or ($tokenCount -eq 3 -and $wordToComplete)) {\n # Subcommands\n $command = $tokens[1]\n switch ($command) {\n${subcommandCases.join(\"\\n\")}\n }\n } elseif ($tokenCount -eq 3 -or ($tokenCount -eq 4 -and $wordToComplete)) {\n # Sub-subcommands\n $subcommand = $tokens[2]\n switch ($subcommand) {\n${level3Cases.join(\"\\n\")}\n }\n }\n}`;\n}\n\n/**\n * Escape a `.choices()` value for safe inclusion in a bash `compgen -W \"...\"`\n * list. Choices in practice come from CLI source (not user input), but we\n * defend anyway so a future `.choices([\"yes\", \"no thanks\"])` doesn't split on\n * whitespace or interpolate a stray `$var`.\n */\nfunction joinBashChoices(choices: readonly string[]): string {\n return choices\n .map((c) => c.replace(/([\\\\\"$`])/g, \"\\\\$1\").replace(/ /g, \"\\\\ \"))\n .join(\" \");\n}\n\nfunction escapeZsh(str: string): string {\n return str.replace(/'/g, \"'\\\\''\");\n}\n\nfunction escapeFish(str: string): string {\n return str.replace(/'/g, \"\\\\'\");\n}\n\nfunction escapePowerShell(str: string): string {\n return str.replace(/'/g, \"''\");\n}\n"],"mappings":";;;AAIO,IAAM,mBAAyC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAwBO,SAAS,iBAA6C;AAC3D,SAAO;AAAA,IACL,MAAM;AAAA,MACJ,aAAa;AAAA,MACb,aAAa;AAAA,QACX,OAAO,EAAE,aAAa,8CAA8C;AAAA,QACpE,QAAQ,EAAE,aAAa,qCAAqC;AAAA,QAC5D,QAAQ,EAAE,aAAa,4BAA4B;AAAA,QACnD,QAAQ,EAAE,aAAa,iCAAiC;AAAA,MAC1D;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN,aAAa;AAAA,MACb,aAAa;AAAA,QACX,MAAM,EAAE,aAAa,8BAA8B;AAAA,QACnD,MAAM,EAAE,aAAa,6BAA6B;AAAA,QAClD,KAAK,EAAE,aAAa,4BAA4B;AAAA,QAChD,MAAM,E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AAM,EAAE,QAAQ,MAAM,KAAK,CAAC,EAC/D,KAAK,GAAG;AACb;AAEA,SAAS,UAAU,KAAqB;AACtC,SAAO,IAAI,QAAQ,MAAM,OAAO;AAClC;AAEA,SAAS,WAAW,KAAqB;AACvC,SAAO,IAAI,QAAQ,MAAM,KAAK;AAChC;AAEA,SAAS,iBAAiB,KAAqB;AAC7C,SAAO,IAAI,QAAQ,MAAM,IAAI;AAC/B;","names":[]}
1
+ {"version":3,"sources":["../src/commands/completion.ts"],"sourcesContent":["import type { Command, Option } from \"commander\";\n\nexport type ShellType = \"bash\" | \"zsh\" | \"fish\" | \"powershell\";\n\nexport const SUPPORTED_SHELLS: readonly ShellType[] = [\n \"bash\",\n \"zsh\",\n \"fish\",\n \"powershell\",\n] as const;\n\nexport interface OptionDef {\n flags: string;\n long?: string;\n short?: string;\n description: string;\n choices?: string[];\n takesValue: boolean;\n}\n\nexport interface CommandDef {\n description: string;\n subcommands?: Record<string, CommandDef>;\n options?: OptionDef[];\n}\n\n/**\n * Hand-maintained fallback tree. Used by unit tests and as a safety net when\n * the walker cannot introspect the program (e.g. when the generator is called\n * without a live Command instance). Runtime `gpc completion <shell>` uses the\n * introspected tree from `buildCommandTreeFromProgram` so new commands and\n * plugins auto-complete without requiring edits here.\n */\nexport function getCommandTree(): Record<string, CommandDef> {\n return {\n auth: {\n description: \"Manage authentication\",\n subcommands: {\n login: { description: \"Authenticate with Google Play Developer API\" },\n status: { description: \"Show current authentication status\" },\n logout: { description: \"Remove stored credentials\" },\n whoami: { description: \"Show the authenticated account\" },\n },\n },\n config: {\n description: \"Manage configuration\",\n subcommands: {\n init: { description: \"Create a configuration file\" },\n show: { description: \"Show current configuration\" },\n set: { description: \"Set a configuration value\" },\n path: { description: \"Show the configuration file path\" },\n },\n },\n apps: {\n description: \"Manage applications\",\n subcommands: {\n info: { description: \"Show app details\" },\n update: { description: \"Update app details\" },\n list: { description: \"List configured applications\" },\n },\n },\n releases: {\n description: \"Manage releases and rollouts\",\n subcommands: {\n upload: { description: \"Upload AAB/APK and assign to a track\" },\n status: { description: \"Show current release status across tracks\" },\n promote: { description: \"Promote a release from one track to another\" },\n rollout: {\n description: \"Manage staged rollouts\",\n subcommands: {\n increase: { description: \"Increase a staged rollout\" },\n halt: { description: \"Halt a staged rollout\" },\n resume: { description: \"Resume a staged rollout\" },\n complete: { description: \"Complete a staged rollout\" },\n },\n },\n notes: { description: \"Set release notes\" },\n },\n },\n tracks: {\n description: \"Manage tracks\",\n subcommands: {\n list: { description: \"List all tracks\" },\n },\n },\n status: { description: \"Cross-track release overview\" },\n listings: {\n description: \"Manage store listings and metadata\",\n subcommands: {\n get: { description: \"Get store listing(s)\" },\n update: { description: \"Update a store listing\" },\n delete: { description: \"Delete a store listing for a language\" },\n pull: { description: \"Download listings to Fastlane-format directory\" },\n push: { description: \"Upload listings from Fastlane-format directory\" },\n images: {\n description: \"Manage listing images\",\n subcommands: {\n list: { description: \"List images for a language and type\" },\n upload: { description: \"Upload an image\" },\n delete: { description: \"Delete an image\" },\n },\n },\n availability: { description: \"Get country availability for a track\" },\n },\n },\n reviews: {\n description: \"Manage user reviews and ratings\",\n subcommands: {\n list: { description: \"List user reviews\" },\n get: { description: \"Get a single review\" },\n reply: { description: \"Reply to a review\" },\n export: { description: \"Export reviews to JSON or CSV\" },\n },\n },\n vitals: {\n description: \"Monitor app vitals and performance metrics\",\n subcommands: {\n overview: { description: \"Dashboard summary of all vital metrics\" },\n crashes: { description: \"Query crash rate metrics\" },\n anr: { description: \"Query ANR rate metrics\" },\n startup: { description: \"Query slow startup metrics\" },\n rendering: { description: \"Query slow rendering metrics\" },\n battery: { description: \"Query excessive wakeup metrics\" },\n memory: { description: \"Query stuck wakelock metrics\" },\n anomalies: { description: \"Detect anomalies in app vitals\" },\n errors: {\n description: \"Search and view error issues\",\n subcommands: {\n search: { description: \"Search error issues\" },\n },\n },\n compare: { description: \"Compare metric trend between periods\" },\n },\n },\n subscriptions: {\n description: \"Manage subscriptions and base plans\",\n subcommands: {\n list: { description: \"List subscriptions\" },\n get: { description: \"Get a subscription\" },\n create: { description: \"Create a subscription from JSON file\" },\n update: { description: \"Update a subscription from JSON file\" },\n delete: { description: \"Delete a subscription\" },\n \"base-plans\": {\n description: \"Manage base plans\",\n subcommands: {\n activate: { description: \"Activate a base plan\" },\n deactivate: { description: \"Deactivate a base plan\" },\n delete: { description: \"Delete a base plan\" },\n \"migrate-prices\": { description: \"Migrate base plan prices\" },\n },\n },\n offers: {\n description: \"Manage subscription offers\",\n subcommands: {\n list: { description: \"List offers for a base plan\" },\n get: { description: \"Get an offer\" },\n create: { description: \"Create an offer from JSON file\" },\n update: { description: \"Update an offer from JSON file\" },\n delete: { description: \"Delete an offer\" },\n activate: { description: \"Activate an offer\" },\n deactivate: { description: \"Deactivate an offer\" },\n },\n },\n },\n },\n iap: {\n description: \"Manage in-app products\",\n subcommands: {\n list: { description: \"List in-app products\" },\n get: { description: \"Get an in-app product\" },\n create: { description: \"Create an in-app product from JSON file\" },\n update: { description: \"Update an in-app product from JSON file\" },\n delete: { description: \"Delete an in-app product\" },\n sync: { description: \"Sync in-app products from a directory\" },\n },\n },\n purchases: {\n description: \"Manage purchases and orders\",\n subcommands: {\n get: { description: \"Get a product purchase\" },\n acknowledge: { description: \"Acknowledge a product purchase\" },\n consume: { description: \"Consume a product purchase\" },\n subscription: {\n description: \"Manage subscription purchases\",\n subcommands: {\n get: { description: \"Get a subscription purchase\" },\n cancel: { description: \"Cancel a subscription\" },\n defer: { description: \"Defer a subscription expiry\" },\n revoke: { description: \"Revoke a subscription\" },\n },\n },\n voided: { description: \"List voided purchases\" },\n orders: {\n description: \"Manage orders\",\n subcommands: {\n refund: { description: \"Refund an order\" },\n },\n },\n },\n },\n pricing: {\n description: \"Pricing and regional price conversion\",\n subcommands: {\n convert: { description: \"Convert a price to all regional prices\" },\n },\n },\n reports: {\n description: \"Download financial and stats reports\",\n subcommands: {\n list: { description: \"List available report buckets\" },\n download: {\n description: \"Download a report\",\n subcommands: {\n financial: { description: \"Download a financial report\" },\n stats: { description: \"Download a stats report\" },\n },\n },\n },\n },\n users: {\n description: \"Manage developer account users and permissions\",\n subcommands: {\n list: { description: \"List all users in the developer account\" },\n get: { description: \"Get user details\" },\n invite: { description: \"Invite a user to the developer account\" },\n update: { description: \"Update user permissions\" },\n remove: { description: \"Remove a user from the developer account\" },\n },\n },\n testers: {\n description: \"Manage testers and tester groups\",\n subcommands: {\n list: { description: \"List testers for a track\" },\n add: { description: \"Add testers to a track\" },\n remove: { description: \"Remove testers from a track\" },\n import: { description: \"Import testers from a CSV file\" },\n },\n },\n recovery: {\n description: \"Manage app recovery actions\",\n subcommands: {\n list: { description: \"List app recovery actions\" },\n cancel: { description: \"Cancel a recovery action\" },\n deploy: { description: \"Deploy a recovery action\" },\n create: { description: \"Create a recovery action\" },\n \"add-targeting\": { description: \"Add targeting to a recovery action\" },\n },\n },\n \"data-safety\": {\n description: \"Manage data safety declarations\",\n subcommands: {\n get: { description: \"Get data safety declaration\" },\n update: { description: \"Update data safety declaration\" },\n export: { description: \"Export data safety declaration\" },\n },\n },\n \"external-transactions\": {\n description: \"Manage external transactions\",\n subcommands: {\n create: { description: \"Create an external transaction\" },\n get: { description: \"Get an external transaction\" },\n refund: { description: \"Refund an external transaction\" },\n },\n },\n \"device-tiers\": {\n description: \"Manage device tier configurations\",\n subcommands: {\n list: { description: \"List device tier configurations\" },\n get: { description: \"Get a device tier configuration\" },\n create: { description: \"Create a device tier configuration\" },\n },\n },\n \"one-time-products\": {\n description: \"Manage one-time products\",\n subcommands: {\n list: { description: \"List one-time products\" },\n get: { description: \"Get a one-time product\" },\n create: { description: \"Create a one-time product\" },\n update: { description: \"Update a one-time product\" },\n delete: { description: \"Delete a one-time product\" },\n offers: {\n description: \"Manage one-time product offers\",\n subcommands: {\n list: { description: \"List offers for a one-time product\" },\n get: { description: \"Get a one-time product offer\" },\n create: { description: \"Create a one-time product offer\" },\n update: { description: \"Update a one-time product offer\" },\n delete: { description: \"Delete a one-time product offer\" },\n },\n },\n },\n },\n \"internal-sharing\": {\n description: \"Manage internal app sharing\",\n subcommands: {\n upload: { description: \"Upload an artifact for internal sharing\" },\n },\n },\n \"generated-apks\": {\n description: \"Manage generated APKs from app bundles\",\n subcommands: {\n list: { description: \"List generated APKs for a version\" },\n download: { description: \"Download a generated APK\" },\n },\n },\n doctor: { description: \"Verify setup and connectivity\" },\n docs: { description: \"Open documentation in browser\" },\n validate: { description: \"Pre-submission validation checks\" },\n publish: { description: \"Validate, upload, and release in one step\" },\n completion: {\n description: \"Generate shell completions\",\n subcommands: {\n bash: { description: \"Generate bash completions\" },\n zsh: { description: \"Generate zsh completions\" },\n fish: { description: \"Generate fish completions\" },\n powershell: { description: \"Generate PowerShell completions\" },\n },\n },\n plugins: {\n description: \"Manage plugins\",\n subcommands: {\n list: { description: \"List loaded plugins\" },\n init: { description: \"Scaffold a new plugin project\" },\n approve: { description: \"Approve a third-party plugin for loading\" },\n revoke: { description: \"Revoke approval for a third-party plugin\" },\n },\n },\n };\n}\n\n/** Map a Commander Option to an OptionDef used by the shell generators. */\nfunction optionToDef(opt: Option): OptionDef {\n const flags = opt.flags;\n // Commander exposes parsed long/short on the Option; fall back to parsing `.flags` if missing.\n const long = opt.long ?? undefined;\n const short = opt.short ?? undefined;\n // `takesValue` is true when the raw flags contain <placeholder> or [placeholder].\n const takesValue = /[<[][^>\\]]+[>\\]]/.test(flags);\n // Commander 14 exposes `.argChoices`; fall back gracefully if absent.\n const rawChoices = (opt as unknown as { argChoices?: readonly string[] }).argChoices;\n const choices = rawChoices && rawChoices.length > 0 ? Array.from(rawChoices) : undefined;\n return {\n flags,\n long: long ?? undefined,\n short: short ?? undefined,\n description: opt.description ?? \"\",\n choices,\n takesValue,\n };\n}\n\n/** Whether a Commander command was registered with `{ hidden: true }`. */\nfunction isHidden(cmd: Command): boolean {\n return (cmd as unknown as { _hidden?: boolean })._hidden === true;\n}\n\n/** Recursively walk a Commander Command into the completion tree shape. */\nfunction commandToDef(cmd: Command): CommandDef {\n const def: CommandDef = {\n description: cmd.description() ?? \"\",\n };\n const options = cmd.options\n .filter((o) => !o.hidden)\n .map(optionToDef)\n .filter((o) => o.long || o.short);\n if (options.length > 0) {\n def.options = options;\n }\n const subs = cmd.commands.filter((c) => c.name() !== \"help\" && !isHidden(c));\n if (subs.length > 0) {\n def.subcommands = {};\n for (const sub of subs) {\n def.subcommands[sub.name()] = commandToDef(sub);\n }\n }\n return def;\n}\n\n/** Build a completion tree by introspecting a fully-loaded Commander program. */\nexport function buildCommandTreeFromProgram(program: Command): Record<string, CommandDef> {\n const tree: Record<string, CommandDef> = {};\n for (const cmd of program.commands) {\n if (cmd.name() === \"help\" || isHidden(cmd)) continue;\n tree[cmd.name()] = commandToDef(cmd);\n }\n return tree;\n}\n\n/** Collect global options declared on the root program. */\nexport function collectGlobalOptions(program: Command): OptionDef[] {\n return program.options\n .filter((o) => !o.hidden)\n .map(optionToDef)\n .filter((o) => o.long || o.short);\n}\n\nexport function registerCompletionCommand(\n program: Command,\n ensureAllCommandsLoaded?: () => Promise<void>,\n): void {\n const completion = program.command(\"completion\").description(\"Generate shell completions\");\n\n const generate = async (\n shell: ShellType,\n gen: (tree: Record<string, CommandDef>, globals: OptionDef[]) => string,\n ): Promise<void> => {\n if (ensureAllCommandsLoaded) {\n await ensureAllCommandsLoaded();\n }\n const tree = ensureAllCommandsLoaded ? buildCommandTreeFromProgram(program) : getCommandTree();\n const globals = collectGlobalOptions(program);\n // Suppress unused-shell warning; shell type reserved for future per-shell tuning.\n void shell;\n console.log(gen(tree, globals));\n };\n\n completion\n .command(\"bash\")\n .description(\"Generate bash completions\")\n .action(async () => {\n await generate(\"bash\", generateBashCompletions);\n });\n\n completion\n .command(\"zsh\")\n .description(\"Generate zsh completions\")\n .action(async () => {\n await generate(\"zsh\", generateZshCompletions);\n });\n\n completion\n .command(\"fish\")\n .description(\"Generate fish completions\")\n .action(async () => {\n await generate(\"fish\", generateFishCompletions);\n });\n\n completion\n .command(\"powershell\")\n .description(\"Generate PowerShell completions\")\n .action(async () => {\n await generate(\"powershell\", generatePowerShellCompletions);\n });\n}\n\n/**\n * Return only options that have choices or long flags useful for completion\n * suggestion. `-V/--version` and `-h/--help` are filtered out to avoid noise.\n */\nfunction completableOptions(options: OptionDef[] | undefined): OptionDef[] {\n if (!options) return [];\n return options.filter((o) => {\n if (!o.long) return false;\n if (o.long === \"--help\" || o.long === \"--version\") return false;\n return true;\n });\n}\n\n/**\n * Shell-completion flag slots that carry dynamic values (profiles, package\n * names, track names). Generated scripts shell out to `gpc __complete <ctx>`\n * to resolve these at TAB time. Shared across bash / zsh / fish generators.\n */\nconst DYNAMIC_FLAG_CONTEXTS: Array<{ flags: string[]; context: string }> = [\n { flags: [\"--profile\", \"-p\"], context: \"profiles\" },\n { flags: [\"--app\", \"-a\"], context: \"packages\" },\n { flags: [\"--apps\"], context: \"packages\" },\n { flags: [\"--track\"], context: \"tracks-for-app\" },\n];\n\nexport function generateBashCompletions(\n tree: Record<string, CommandDef> = getCommandTree(),\n globals: OptionDef[] = [],\n): string {\n const topLevelNames = Object.keys(tree).join(\" \");\n\n const globalFlags = completableOptions(globals)\n .map((o) => o.long ?? \"\")\n .filter(Boolean)\n .join(\" \");\n\n // Build case entries for each command that has subcommands (up to 3 levels)\n // and emit flag completion branches for commands with options.\n const caseEntries: string[] = [];\n const flagCases: string[] = [];\n\n // Dynamic flag-value completion: shell out to `gpc __complete <ctx>`.\n for (const { flags, context } of DYNAMIC_FLAG_CONTEXTS) {\n for (const flag of flags) {\n flagCases.push(\n ` ${flag})\\n COMPREPLY=( $(compgen -W \"$(gpc __complete ${context} 2>/dev/null)\" -- \"\\${cur}\") )\\n return 0\\n ;;`,\n );\n }\n }\n\n const allCommandNames = new Set<string>();\n const collectNames = (defs: Record<string, CommandDef>) => {\n for (const [name, def] of Object.entries(defs)) {\n allCommandNames.add(name);\n if (def.subcommands) collectNames(def.subcommands);\n }\n };\n collectNames(tree);\n\n for (const [cmd, def] of Object.entries(tree)) {\n if (def.subcommands) {\n const subNames = Object.keys(def.subcommands).join(\" \");\n caseEntries.push(\n ` ${cmd})\\n COMPREPLY=( $(compgen -W \"${subNames}\" -- \"\\${cur}\") )\\n return 0\\n ;;`,\n );\n\n for (const [sub, subDef] of Object.entries(def.subcommands)) {\n if (subDef.subcommands) {\n const subSubNames = Object.keys(subDef.subcommands).join(\" \");\n caseEntries.push(\n ` ${sub})\\n COMPREPLY=( $(compgen -W \"${subSubNames}\" -- \"\\${cur}\") )\\n return 0\\n ;;`,\n );\n }\n }\n }\n\n // Collect flags that carry choices from this command + its subtree.\n const walk = (d: CommandDef) => {\n for (const opt of completableOptions(d.options)) {\n if (opt.choices && opt.long) {\n flagCases.push(\n ` ${opt.long})\\n COMPREPLY=( $(compgen -W \"${joinBashChoices(opt.choices)}\" -- \"\\${cur}\") )\\n return 0\\n ;;`,\n );\n }\n }\n if (d.subcommands) for (const s of Object.values(d.subcommands)) walk(s);\n };\n walk(def);\n }\n\n // Global-option choices (e.g. --output table|json|yaml|markdown|junit).\n for (const opt of completableOptions(globals)) {\n if (opt.choices && opt.long) {\n flagCases.push(\n ` ${opt.long})\\n COMPREPLY=( $(compgen -W \"${joinBashChoices(opt.choices)}\" -- \"\\${cur}\") )\\n return 0\\n ;;`,\n );\n }\n }\n\n return `# bash completion for gpc\n# Install: gpc completion bash >> ~/.bashrc\n_gpc() {\n local cur prev commands globals\n COMPREPLY=()\n cur=\"\\${COMP_WORDS[COMP_CWORD]}\"\n prev=\"\\${COMP_WORDS[COMP_CWORD-1]}\"\n\n commands=\"${topLevelNames}\"\n globals=\"${globalFlags}\"\n\n # Flag-value completion (choices)\n case \"\\${prev}\" in\n${flagCases.join(\"\\n\")}\n esac\n\n # When the current word starts with '-', complete known flags\n if [[ \"\\${cur}\" == -* ]]; then\n COMPREPLY=( $(compgen -W \"\\${globals}\" -- \"\\${cur}\") )\n return 0\n fi\n\n case \"\\${prev}\" in\n gpc)\n COMPREPLY=( $(compgen -W \"\\${commands}\" -- \"\\${cur}\") )\n return 0\n ;;\n${caseEntries.join(\"\\n\")}\n esac\n\n COMPREPLY=( $(compgen -W \"\\${commands}\" -- \"\\${cur}\") )\n return 0\n}\n\ncomplete -F _gpc gpc`;\n}\n\nexport function generateZshCompletions(\n tree: Record<string, CommandDef> = getCommandTree(),\n globals: OptionDef[] = [],\n): string {\n const arrayDefs: string[] = [];\n const caseBranches: string[] = [];\n\n const topEntries = Object.entries(tree)\n .map(([name, def]) => ` '${name}:${escapeZsh(def.description)}'`)\n .join(\"\\n\");\n arrayDefs.push(` commands=(\\n${topEntries}\\n )`);\n\n for (const [cmd, def] of Object.entries(tree)) {\n if (def.subcommands) {\n const varName = `${cmd.replace(/-/g, \"_\")}_commands`;\n const entries = Object.entries(def.subcommands)\n .map(([name, sub]) => ` '${name}:${escapeZsh(sub.description)}'`)\n .join(\"\\n\");\n arrayDefs.push(` ${varName}=(\\n${entries}\\n )`);\n caseBranches.push(\n ` ${cmd})\\n _describe -t ${varName} '${cmd} commands' ${varName}\\n ;;`,\n );\n\n for (const [sub, subDef] of Object.entries(def.subcommands)) {\n if (subDef.subcommands) {\n const subVarName = `${cmd.replace(/-/g, \"_\")}_${sub.replace(/-/g, \"_\")}_commands`;\n const subEntries = Object.entries(subDef.subcommands)\n .map(([name, s]) => ` '${name}:${escapeZsh(s.description)}'`)\n .join(\"\\n\");\n arrayDefs.push(` ${subVarName}=(\\n${subEntries}\\n )`);\n }\n }\n }\n }\n\n const level3Cases: string[] = [];\n for (const [cmd, def] of Object.entries(tree)) {\n if (!def.subcommands) continue;\n for (const [sub, subDef] of Object.entries(def.subcommands)) {\n if (subDef.subcommands) {\n const subVarName = `${cmd.replace(/-/g, \"_\")}_${sub.replace(/-/g, \"_\")}_commands`;\n level3Cases.push(\n ` ${sub})\\n _describe -t ${subVarName} '${sub} commands' ${subVarName}\\n ;;`,\n );\n }\n }\n }\n\n const varNames: string[] = [\"commands\"];\n for (const [cmd, def] of Object.entries(tree)) {\n if (def.subcommands) {\n varNames.push(`${cmd.replace(/-/g, \"_\")}_commands`);\n for (const [sub, subDef] of Object.entries(def.subcommands)) {\n if (subDef.subcommands) {\n varNames.push(`${cmd.replace(/-/g, \"_\")}_${sub.replace(/-/g, \"_\")}_commands`);\n }\n }\n }\n }\n\n const localDecls = varNames.map((v) => ` local -a ${v}`).join(\"\\n\");\n\n // Static flag-choice option specs (e.g. --output table|json|yaml) harvested\n // from Commander's `.choices()` across the entire tree. Emitted into the\n // main _arguments call so zsh menu-completes them.\n const choiceSpecs = new Set<string>();\n const walkChoices = (defs: Record<string, CommandDef>) => {\n for (const def of Object.values(defs)) {\n for (const opt of completableOptions(def.options)) {\n if (opt.choices && opt.long) {\n choiceSpecs.add(\n `'${opt.long}[${escapeZsh(opt.description)}]:value:(${opt.choices.join(\" \")})'`,\n );\n }\n }\n if (def.subcommands) walkChoices(def.subcommands);\n }\n };\n walkChoices(tree);\n for (const opt of completableOptions(globals)) {\n if (opt.choices && opt.long) {\n choiceSpecs.add(\n `'${opt.long}[${escapeZsh(opt.description)}]:value:(${opt.choices.join(\" \")})'`,\n );\n }\n }\n\n // Dynamic-value option specs: each dynamic flag gets wired to a helper\n // function that shells out to `gpc __complete <ctx>`.\n const dynamicSpecs: string[] = [];\n for (const { flags, context } of DYNAMIC_FLAG_CONTEXTS) {\n for (const flag of flags) {\n const fn = `_gpc_${context.replace(/-/g, \"_\")}`;\n dynamicSpecs.push(`'${flag}[]:value:${fn}'`);\n }\n }\n\n const helperFns = `\n_gpc_profiles() {\n local -a items\n items=(\\${(f)\"$(gpc __complete profiles 2>/dev/null)\"})\n compadd -a items\n}\n_gpc_packages() {\n local -a items\n items=(\\${(f)\"$(gpc __complete packages 2>/dev/null)\"})\n compadd -a items\n}\n_gpc_tracks_for_app() {\n local -a items\n items=(\\${(f)\"$(gpc __complete tracks-for-app 2>/dev/null)\"})\n compadd -a items\n}`;\n\n const allSpecs = [...choiceSpecs, ...dynamicSpecs];\n const extraArgs = allSpecs.length > 0 ? ` \\\\\\n ${allSpecs.join(\" \\\\\\n \")}` : \"\";\n\n return `#compdef gpc\n# Install: gpc completion zsh > ~/.zsh/completions/_gpc\n${helperFns}\n\n_gpc() {\n${localDecls}\n\n${arrayDefs.join(\"\\n\\n\")}\n\n _arguments -C \\\\\n '1: :->command' \\\\\n '2: :->subcommand' \\\\\n '3: :->subsubcommand' \\\\\n '*::arg:->args'${extraArgs}\n\n case \"$state\" in\n command)\n _describe -t commands 'gpc commands' commands\n ;;\n subcommand)\n case \"$words[2]\" in\n${caseBranches.join(\"\\n\")}\n esac\n ;;\n subsubcommand)\n case \"$words[3]\" in\n${level3Cases.join(\"\\n\")}\n esac\n ;;\n esac\n}\n\n_gpc \"$@\"`;\n}\n\nexport function generateFishCompletions(\n tree: Record<string, CommandDef> = getCommandTree(),\n globals: OptionDef[] = [],\n): string {\n const lines: string[] = [\n \"# fish completions for gpc\",\n \"# Install: gpc completion fish > ~/.config/fish/completions/gpc.fish\",\n \"\",\n \"# Disable file completions by default\",\n \"complete -c gpc -f\",\n \"\",\n \"# Top-level commands\",\n ];\n\n for (const [cmd, def] of Object.entries(tree)) {\n lines.push(\n `complete -c gpc -n '__fish_use_subcommand' -a ${cmd} -d '${escapeFish(def.description)}'`,\n );\n }\n\n // Level 2 subcommands\n for (const [cmd, def] of Object.entries(tree)) {\n if (!def.subcommands) continue;\n lines.push(\"\");\n lines.push(`# ${cmd} subcommands`);\n for (const [sub, subDef] of Object.entries(def.subcommands)) {\n lines.push(\n `complete -c gpc -n '__fish_seen_subcommand_from ${cmd}; and not __fish_seen_subcommand_from ${Object.keys(def.subcommands).join(\" \")}' -a ${sub} -d '${escapeFish(subDef.description)}'`,\n );\n }\n\n // Level 3 subcommands\n for (const [sub, subDef] of Object.entries(def.subcommands)) {\n if (!subDef.subcommands) continue;\n lines.push(\"\");\n lines.push(`# ${cmd} ${sub} subcommands`);\n for (const [subsub, subsubDef] of Object.entries(subDef.subcommands)) {\n lines.push(\n `complete -c gpc -n '__fish_seen_subcommand_from ${sub}; and not __fish_seen_subcommand_from ${Object.keys(subDef.subcommands).join(\" \")}' -a ${subsub} -d '${escapeFish(subsubDef.description)}'`,\n );\n }\n }\n }\n\n // Global + per-command flag completions with choice lists.\n lines.push(\"\");\n lines.push(\"# Global flags\");\n for (const opt of completableOptions(globals)) {\n if (!opt.long) continue;\n const longName = opt.long.replace(/^--/, \"\");\n const shortName = opt.short ? opt.short.replace(/^-/, \"\") : undefined;\n const choiceArg = opt.choices ? ` -a '${opt.choices.join(\" \")}'` : \"\";\n const shortArg = shortName ? ` -s ${shortName}` : \"\";\n lines.push(\n `complete -c gpc -l ${longName}${shortArg} -d '${escapeFish(opt.description)}'${choiceArg}`,\n );\n }\n\n const walkFlags = (defs: Record<string, CommandDef>) => {\n for (const [name, def] of Object.entries(defs)) {\n const flags = completableOptions(def.options);\n if (flags.length > 0) {\n lines.push(\"\");\n lines.push(`# ${name} flags`);\n for (const opt of flags) {\n if (!opt.long) continue;\n const longName = opt.long.replace(/^--/, \"\");\n const shortName = opt.short ? opt.short.replace(/^-/, \"\") : undefined;\n const choiceArg = opt.choices ? ` -a '${opt.choices.join(\" \")}'` : \"\";\n const shortArg = shortName ? ` -s ${shortName}` : \"\";\n lines.push(\n `complete -c gpc -n '__fish_seen_subcommand_from ${name}' -l ${longName}${shortArg} -d '${escapeFish(opt.description)}'${choiceArg}`,\n );\n }\n }\n if (def.subcommands) walkFlags(def.subcommands);\n }\n };\n walkFlags(tree);\n\n // Dynamic flag-value completion: shell out to `gpc __complete <ctx>`.\n // Fish merges multiple `complete` directives for the same flag, so these\n // layer on top of the description-only lines emitted above.\n lines.push(\"\");\n lines.push(\"# Dynamic values (shell out to __complete)\");\n for (const { flags, context } of DYNAMIC_FLAG_CONTEXTS) {\n for (const flag of flags) {\n if (flag.startsWith(\"--\")) {\n const longName = flag.slice(2);\n lines.push(\n `complete -c gpc -l ${longName} -x -a '(gpc __complete ${context} 2>/dev/null)'`,\n );\n } else if (flag.startsWith(\"-\")) {\n const shortName = flag.slice(1);\n lines.push(\n `complete -c gpc -s ${shortName} -x -a '(gpc __complete ${context} 2>/dev/null)'`,\n );\n }\n }\n }\n\n return lines.join(\"\\n\");\n}\n\nexport function generatePowerShellCompletions(\n tree: Record<string, CommandDef> = getCommandTree(),\n globals: OptionDef[] = [],\n): string {\n const completionEntries: string[] = [];\n\n // Top-level completions\n for (const [cmd, def] of Object.entries(tree)) {\n completionEntries.push(\n ` [CompletionResult]::new('${cmd}', '${cmd}', [CompletionResultType]::ParameterValue, '${escapePowerShell(def.description)}')`,\n );\n }\n\n // Global flag completions (as parameters available from any state)\n for (const opt of completableOptions(globals)) {\n if (!opt.long) continue;\n completionEntries.push(\n ` [CompletionResult]::new('${opt.long}', '${opt.long}', [CompletionResultType]::ParameterName, '${escapePowerShell(opt.description)}')`,\n );\n }\n\n const subcommandCases: string[] = [];\n const level3Cases: string[] = [];\n\n for (const [cmd, def] of Object.entries(tree)) {\n if (!def.subcommands) continue;\n const subEntries = Object.entries(def.subcommands)\n .map(\n ([sub, subDef]) =>\n ` [CompletionResult]::new('${sub}', '${sub}', [CompletionResultType]::ParameterValue, '${escapePowerShell(subDef.description)}')`,\n )\n .join(\"\\n\");\n subcommandCases.push(` '${cmd}' {\\n${subEntries}\\n }`);\n\n for (const [sub, subDef] of Object.entries(def.subcommands)) {\n if (!subDef.subcommands) continue;\n const subSubEntries = Object.entries(subDef.subcommands)\n .map(\n ([subsub, subsubDef]) =>\n ` [CompletionResult]::new('${subsub}', '${subsub}', [CompletionResultType]::ParameterValue, '${escapePowerShell(subsubDef.description)}')`,\n )\n .join(\"\\n\");\n level3Cases.push(` '${sub}' {\\n${subSubEntries}\\n }`);\n }\n }\n\n return `# PowerShell completions for gpc\n# Install: gpc completion powershell >> $PROFILE\n\nusing namespace System.Management.Automation\n\nRegister-ArgumentCompleter -CommandName gpc -Native -ScriptBlock {\n param($wordToComplete, $commandAst, $cursorPosition)\n\n $tokens = $commandAst.ToString().Substring(0, $cursorPosition).Trim() -split '\\\\s+'\n $tokenCount = $tokens.Count\n\n # Determine context\n if ($tokenCount -le 1 -or ($tokenCount -eq 2 -and $wordToComplete)) {\n # Top-level commands\n${completionEntries.join(\"\\n\")}\n } elseif ($tokenCount -eq 2 -or ($tokenCount -eq 3 -and $wordToComplete)) {\n # Subcommands\n $command = $tokens[1]\n switch ($command) {\n${subcommandCases.join(\"\\n\")}\n }\n } elseif ($tokenCount -eq 3 -or ($tokenCount -eq 4 -and $wordToComplete)) {\n # Sub-subcommands\n $subcommand = $tokens[2]\n switch ($subcommand) {\n${level3Cases.join(\"\\n\")}\n }\n }\n}`;\n}\n\n/**\n * Escape a `.choices()` value for safe inclusion in a bash `compgen -W \"...\"`\n * list. Choices in practice come from CLI source (not user input), but we\n * defend anyway so a future `.choices([\"yes\", \"no thanks\"])` doesn't split on\n * whitespace or interpolate a stray `$var`.\n */\nfunction joinBashChoices(choices: readonly string[]): string {\n return choices.map((c) => c.replace(/([\\\\\"$`])/g, \"\\\\$1\").replace(/ /g, \"\\\\ \")).join(\" \");\n}\n\nfunction escapeZsh(str: string): string {\n return str.replace(/'/g, \"'\\\\''\");\n}\n\nfunction escapeFish(str: string): string {\n return str.replace(/'/g, \"\\\\'\");\n}\n\nfunction escapePowerShell(str: string): string {\n return str.replace(/'/g, \"''\");\n}\n"],"mappings":";;;AAIO,IAAM,mBAAyC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAwBO,SAAS,iBAA6C;AAC3D,SAAO;AAAA,IACL,MAAM;AAAA,MACJ,aAAa;AAAA,MACb,aAAa;AAAA,QACX,OAAO,EAAE,aAAa,8CAA8C;AAAA,QACpE,QAAQ,EAAE,aAAa,qCAAqC;AAAA,QAC5D,QAAQ,EAAE,aAAa,4BAA4B;AAAA,QACnD,QAAQ,EAAE,aAAa,iCAAiC;AAAA,MAC1D;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN,aAAa;AA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A;AAAA;AAAA;AAAA,EAM1B,YAAY,KAAK,IAAI,CAAC;AAAA;AAAA;AAAA;AAIxB;AAQA,SAAS,gBAAgB,SAAoC;AAC3D,SAAO,QAAQ,IAAI,CAAC,MAAM,EAAE,QAAQ,cAAc,MAAM,EAAE,QAAQ,MAAM,KAAK,CAAC,EAAE,KAAK,GAAG;AAC1F;AAEA,SAAS,UAAU,KAAqB;AACtC,SAAO,IAAI,QAAQ,MAAM,OAAO;AAClC;AAEA,SAAS,WAAW,KAAqB;AACvC,SAAO,IAAI,QAAQ,MAAM,KAAK;AAChC;AAEA,SAAS,iBAAiB,KAAqB;AAC7C,SAAO,IAAI,QAAQ,MAAM,IAAI;AAC/B;","names":[]}
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- getOutputFormat
4
- } from "./chunk-ELXAK7GI.js";
5
2
  import {
6
3
  isInteractive,
7
4
  promptConfirm,
8
5
  promptInput,
9
6
  promptSelect
10
7
  } from "./chunk-RZQSEDKI.js";
8
+ import {
9
+ getOutputFormat
10
+ } from "./chunk-ELXAK7GI.js";
11
11
 
12
12
  // src/commands/config.ts
13
13
  import { loadConfig, setConfigValue, getUserConfigPath, initConfig } from "@gpc-cli/config";
@@ -78,7 +78,7 @@ Configuration file created: ${path}`);
78
78
  });
79
79
  console.log("\nVerifying setup...");
80
80
  try {
81
- const { registerDoctorCommand } = await import("./doctor-6SNZEFME.js");
81
+ const { registerDoctorCommand } = await import("./doctor-FSUI44DD.js");
82
82
  const { Command } = await import("commander");
83
83
  const doctorProgram = new Command();
84
84
  doctorProgram.option("-o, --output <format>", "Output format").option("-j, --json", "JSON mode");
@@ -107,4 +107,4 @@ Configuration file created: ${path}`);
107
107
  export {
108
108
  registerConfigCommands
109
109
  };
110
- //# sourceMappingURL=config-B76LNM7C.js.map
110
+ //# sourceMappingURL=config-SK7BOURM.js.map