heroku 8.1.9 → 8.2.0-beta.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 (315) hide show
  1. package/README.md +5 -6
  2. package/autocomplete-scripts/README.md +7 -0
  3. package/autocomplete-scripts/bash/heroku.bash +59 -0
  4. package/autocomplete-scripts/brew/bash +4 -0
  5. package/autocomplete-scripts/brew/zsh/_heroku +59 -0
  6. package/autocomplete-scripts/zsh/_heroku +53 -0
  7. package/bin/bats-test-runner.js +7 -0
  8. package/bin/dev +17 -0
  9. package/bin/dev.cmd +3 -0
  10. package/bin/run +36 -1
  11. package/lib/analytics.d.ts +2 -2
  12. package/lib/analytics.js +3 -4
  13. package/lib/commands/auth/2fa/disable.d.ts +7 -0
  14. package/lib/commands/auth/2fa/disable.js +16 -0
  15. package/lib/commands/auth/2fa/index.d.ts +6 -0
  16. package/lib/commands/auth/2fa/index.js +18 -0
  17. package/lib/commands/auth/login.d.ts +8 -0
  18. package/lib/commands/auth/login.js +25 -0
  19. package/lib/commands/auth/logout.d.ts +6 -0
  20. package/lib/commands/auth/logout.js +14 -0
  21. package/lib/commands/auth/token.d.ts +7 -0
  22. package/lib/commands/auth/token.js +31 -0
  23. package/lib/commands/auth/whoami.d.ts +7 -0
  24. package/lib/commands/auth/whoami.js +26 -0
  25. package/lib/commands/authorizations/create.d.ts +13 -0
  26. package/lib/commands/authorizations/create.js +41 -0
  27. package/lib/commands/authorizations/index.d.ts +9 -0
  28. package/lib/commands/authorizations/index.js +35 -0
  29. package/lib/commands/authorizations/info.d.ts +11 -0
  30. package/lib/commands/authorizations/info.js +25 -0
  31. package/lib/commands/authorizations/revoke.d.ts +10 -0
  32. package/lib/commands/authorizations/revoke.js +22 -0
  33. package/lib/commands/authorizations/rotate.d.ts +8 -0
  34. package/lib/commands/authorizations/rotate.js +19 -0
  35. package/lib/commands/authorizations/update.d.ts +13 -0
  36. package/lib/commands/authorizations/update.js +36 -0
  37. package/lib/commands/autocomplete/create.d.ts +29 -0
  38. package/lib/commands/autocomplete/create.js +213 -0
  39. package/lib/commands/autocomplete/doctor.d.ts +12 -0
  40. package/lib/commands/autocomplete/doctor.js +97 -0
  41. package/lib/commands/autocomplete/index.d.ts +12 -0
  42. package/lib/commands/autocomplete/index.js +67 -0
  43. package/lib/commands/autocomplete/options.d.ts +25 -0
  44. package/lib/commands/autocomplete/options.js +210 -0
  45. package/lib/commands/autocomplete/script.d.ts +10 -0
  46. package/lib/commands/autocomplete/script.js +23 -0
  47. package/lib/commands/buildpacks/add.d.ts +13 -0
  48. package/lib/commands/buildpacks/add.js +43 -0
  49. package/lib/commands/buildpacks/clear.d.ts +9 -0
  50. package/lib/commands/buildpacks/clear.js +17 -0
  51. package/lib/commands/buildpacks/index.d.ts +9 -0
  52. package/lib/commands/buildpacks/index.js +25 -0
  53. package/lib/commands/buildpacks/info.d.ts +8 -0
  54. package/lib/commands/buildpacks/info.js +41 -0
  55. package/lib/commands/buildpacks/remove.d.ts +13 -0
  56. package/lib/commands/buildpacks/remove.js +55 -0
  57. package/lib/commands/buildpacks/search.d.ts +13 -0
  58. package/lib/commands/buildpacks/search.js +69 -0
  59. package/lib/commands/buildpacks/set.d.ts +13 -0
  60. package/lib/commands/buildpacks/set.js +42 -0
  61. package/lib/commands/buildpacks/versions.d.ts +8 -0
  62. package/lib/commands/buildpacks/versions.js +56 -0
  63. package/lib/commands/certs/auto/wait.d.ts +9 -0
  64. package/lib/commands/certs/auto/wait.js +14 -0
  65. package/lib/commands/ci/index.d.ts +12 -0
  66. package/lib/commands/ci/index.js +25 -0
  67. package/lib/commands/ci/info.d.ts +14 -0
  68. package/lib/commands/ci/info.js +29 -0
  69. package/lib/commands/ci/last.d.ts +11 -0
  70. package/lib/commands/ci/last.js +31 -0
  71. package/lib/commands/ci/rerun.d.ts +13 -0
  72. package/lib/commands/ci/rerun.js +53 -0
  73. package/lib/commands/ci/run.d.ts +10 -0
  74. package/lib/commands/ci/run.js +42 -0
  75. package/lib/commands/clients/create.d.ts +14 -0
  76. package/lib/commands/clients/create.js +37 -0
  77. package/lib/commands/clients/destroy.d.ts +8 -0
  78. package/lib/commands/clients/destroy.js +18 -0
  79. package/lib/commands/clients/index.d.ts +8 -0
  80. package/lib/commands/clients/index.js +32 -0
  81. package/lib/commands/clients/info.d.ts +13 -0
  82. package/lib/commands/clients/info.js +33 -0
  83. package/lib/commands/clients/rotate.d.ts +12 -0
  84. package/lib/commands/clients/rotate.js +33 -0
  85. package/lib/commands/clients/update.d.ts +13 -0
  86. package/lib/commands/clients/update.js +38 -0
  87. package/lib/commands/config/edit.d.ts +23 -0
  88. package/lib/commands/config/edit.js +132 -0
  89. package/lib/commands/config/get.d.ts +16 -0
  90. package/lib/commands/config/get.js +35 -0
  91. package/lib/commands/config/index.d.ts +11 -0
  92. package/lib/commands/config/index.js +33 -0
  93. package/lib/commands/config/unset.d.ts +12 -0
  94. package/lib/commands/config/unset.js +51 -0
  95. package/lib/commands/console.d.ts +11 -0
  96. package/lib/commands/console.js +30 -0
  97. package/lib/commands/domains/add.d.ts +19 -0
  98. package/lib/commands/domains/add.js +117 -0
  99. package/lib/commands/domains/clear.d.ts +11 -0
  100. package/lib/commands/domains/clear.js +26 -0
  101. package/lib/commands/domains/index.d.ts +40 -0
  102. package/lib/commands/domains/index.js +79 -0
  103. package/lib/commands/domains/info.d.ts +14 -0
  104. package/lib/commands/domains/info.js +25 -0
  105. package/lib/commands/domains/remove.d.ts +14 -0
  106. package/lib/commands/domains/remove.js +26 -0
  107. package/lib/commands/domains/update.d.ts +15 -0
  108. package/lib/commands/domains/update.js +40 -0
  109. package/lib/commands/domains/wait.d.ts +13 -0
  110. package/lib/commands/domains/wait.js +32 -0
  111. package/lib/commands/git/clone.d.ts +13 -0
  112. package/lib/commands/git/clone.js +29 -0
  113. package/lib/commands/git/credentials.d.ts +9 -0
  114. package/lib/commands/git/credentials.js +32 -0
  115. package/lib/commands/git/remote.d.ts +11 -0
  116. package/lib/commands/git/remote.js +44 -0
  117. package/lib/commands/labs/disable.d.ts +11 -0
  118. package/lib/commands/labs/disable.js +65 -0
  119. package/lib/commands/local/index.d.ts +17 -0
  120. package/lib/commands/local/index.js +75 -0
  121. package/lib/commands/local/run.d.ts +11 -0
  122. package/lib/commands/local/run.js +38 -0
  123. package/lib/commands/local/version.d.ts +5 -0
  124. package/lib/commands/local/version.js +13 -0
  125. package/lib/commands/logs.d.ts +16 -0
  126. package/lib/commands/logs.js +45 -0
  127. package/lib/commands/pipelines/add.d.ts +14 -0
  128. package/lib/commands/pipelines/add.js +61 -0
  129. package/lib/commands/pipelines/connect.d.ts +12 -0
  130. package/lib/commands/pipelines/connect.js +52 -0
  131. package/lib/commands/pipelines/create.d.ts +15 -0
  132. package/lib/commands/pipelines/create.js +91 -0
  133. package/lib/commands/pipelines/destroy.d.ts +9 -0
  134. package/lib/commands/pipelines/destroy.js +27 -0
  135. package/lib/commands/pipelines/diff.d.ts +19 -0
  136. package/lib/commands/pipelines/diff.js +152 -0
  137. package/lib/commands/pipelines/index.d.ts +9 -0
  138. package/lib/commands/pipelines/index.js +27 -0
  139. package/lib/commands/pipelines/info.d.ts +13 -0
  140. package/lib/commands/pipelines/info.js +43 -0
  141. package/lib/commands/pipelines/open.d.ts +9 -0
  142. package/lib/commands/pipelines/open.js +19 -0
  143. package/lib/commands/pipelines/promote.d.ts +12 -0
  144. package/lib/commands/pipelines/promote.js +216 -0
  145. package/lib/commands/pipelines/remove.d.ts +10 -0
  146. package/lib/commands/pipelines/remove.js +23 -0
  147. package/lib/commands/pipelines/rename.d.ts +10 -0
  148. package/lib/commands/pipelines/rename.js +33 -0
  149. package/lib/commands/pipelines/setup.d.ts +14 -0
  150. package/lib/commands/pipelines/setup.js +91 -0
  151. package/lib/commands/pipelines/transfer.d.ts +13 -0
  152. package/lib/commands/pipelines/transfer.js +65 -0
  153. package/lib/commands/pipelines/update.d.ts +11 -0
  154. package/lib/commands/pipelines/update.js +32 -0
  155. package/lib/commands/ps/autoscale/disable.d.ts +9 -0
  156. package/lib/commands/ps/autoscale/disable.js +35 -0
  157. package/lib/commands/ps/autoscale/enable.d.ts +13 -0
  158. package/lib/commands/ps/autoscale/enable.js +65 -0
  159. package/lib/commands/ps/wait.d.ts +12 -0
  160. package/lib/commands/ps/wait.js +78 -0
  161. package/lib/commands/rake.d.ts +14 -0
  162. package/lib/commands/rake.js +46 -0
  163. package/lib/commands/regions.d.ts +11 -0
  164. package/lib/commands/regions.js +45 -0
  165. package/lib/commands/reviewapps/disable.d.ts +17 -0
  166. package/lib/commands/reviewapps/disable.js +102 -0
  167. package/lib/commands/reviewapps/enable.d.ts +14 -0
  168. package/lib/commands/reviewapps/enable.js +89 -0
  169. package/lib/commands/run/detached.d.ts +15 -0
  170. package/lib/commands/run/detached.js +56 -0
  171. package/lib/commands/run/index.d.ts +18 -0
  172. package/lib/commands/run/index.js +64 -0
  173. package/lib/commands/run/inside.d.ts +15 -0
  174. package/lib/commands/run/inside.js +55 -0
  175. package/lib/commands/sessions/destroy.d.ts +8 -0
  176. package/lib/commands/sessions/destroy.js +18 -0
  177. package/lib/commands/sessions/index.d.ts +8 -0
  178. package/lib/commands/sessions/index.js +31 -0
  179. package/lib/commands/status.d.ts +8 -0
  180. package/lib/commands/status.js +46 -0
  181. package/lib/commands/webhooks/add.d.ts +16 -0
  182. package/lib/commands/webhooks/add.js +47 -0
  183. package/lib/commands/webhooks/deliveries/index.d.ts +12 -0
  184. package/lib/commands/webhooks/deliveries/index.js +80 -0
  185. package/lib/commands/webhooks/deliveries/info.d.ts +14 -0
  186. package/lib/commands/webhooks/deliveries/info.js +42 -0
  187. package/lib/commands/webhooks/events/index.d.ts +11 -0
  188. package/lib/commands/webhooks/events/index.js +46 -0
  189. package/lib/commands/webhooks/events/info.d.ts +14 -0
  190. package/lib/commands/webhooks/events/info.js +31 -0
  191. package/lib/commands/webhooks/index.d.ts +11 -0
  192. package/lib/commands/webhooks/index.js +45 -0
  193. package/lib/commands/webhooks/info.d.ts +14 -0
  194. package/lib/commands/webhooks/info.js +31 -0
  195. package/lib/commands/webhooks/remove.d.ts +14 -0
  196. package/lib/commands/webhooks/remove.js +29 -0
  197. package/lib/commands/webhooks/update.d.ts +19 -0
  198. package/lib/commands/webhooks/update.js +41 -0
  199. package/lib/file.js +2 -3
  200. package/lib/global_telemetry.d.ts +53 -0
  201. package/lib/global_telemetry.js +82 -0
  202. package/lib/hooks/command_not_found/performance_analytics.d.ts +3 -0
  203. package/lib/hooks/command_not_found/performance_analytics.js +7 -0
  204. package/lib/hooks/init/terms-of-service.js +3 -4
  205. package/lib/hooks/init/version.d.ts +2 -1
  206. package/lib/hooks/init/version.js +1 -2
  207. package/lib/hooks/postrun/performance_analytics.d.ts +3 -0
  208. package/lib/hooks/postrun/performance_analytics.js +11 -0
  209. package/lib/hooks/prerun/analytics.d.ts +2 -1
  210. package/lib/hooks/prerun/analytics.js +4 -4
  211. package/lib/hooks/recache.d.ts +3 -0
  212. package/lib/hooks/recache.js +56 -0
  213. package/lib/hooks/update/brew.d.ts +2 -1
  214. package/lib/hooks/update/brew.js +3 -5
  215. package/lib/hooks/update/completions.d.ts +2 -1
  216. package/lib/hooks/update/completions.js +2 -3
  217. package/lib/hooks/update/plugin-migrate.d.ts +2 -1
  218. package/lib/hooks/update/plugin-migrate.js +3 -5
  219. package/lib/hooks/update/tidy.d.ts +2 -1
  220. package/lib/hooks/update/tidy.js +3 -5
  221. package/lib/lib/authorizations/authorizations.d.ts +2 -0
  222. package/lib/lib/authorizations/authorizations.js +39 -0
  223. package/lib/lib/autocomplete/base.d.ts +11 -0
  224. package/lib/lib/autocomplete/base.js +44 -0
  225. package/lib/lib/autocomplete/cache.d.ts +2 -0
  226. package/lib/lib/autocomplete/cache.js +28 -0
  227. package/lib/lib/autocomplete/completions.d.ts +37 -0
  228. package/lib/lib/autocomplete/completions.js +261 -0
  229. package/lib/lib/buildpacks/buildpacks.d.ts +32 -0
  230. package/lib/lib/buildpacks/buildpacks.js +161 -0
  231. package/lib/lib/buildpacks/push.d.ts +0 -0
  232. package/lib/lib/buildpacks/push.js +4 -0
  233. package/lib/lib/ci/git.d.ts +8 -0
  234. package/lib/lib/ci/git.js +71 -0
  235. package/lib/lib/ci/interfaces/kolkrabbi.d.ts +311 -0
  236. package/lib/lib/ci/interfaces/kolkrabbi.js +7 -0
  237. package/lib/lib/ci/pipelines.d.ts +3 -0
  238. package/lib/lib/ci/pipelines.js +57 -0
  239. package/lib/lib/ci/source.d.ts +2 -0
  240. package/lib/lib/ci/source.js +42 -0
  241. package/lib/lib/ci/test-run.d.ts +5 -0
  242. package/lib/lib/ci/test-run.js +232 -0
  243. package/lib/lib/clients/clients.d.ts +1 -0
  244. package/lib/lib/clients/clients.js +25 -0
  245. package/lib/lib/config/quote.d.ts +2 -0
  246. package/lib/lib/config/quote.js +33 -0
  247. package/lib/lib/config/util.d.ts +3 -0
  248. package/lib/lib/config/util.js +12 -0
  249. package/lib/lib/domains/wait-for-domain.d.ts +3 -0
  250. package/lib/lib/domains/wait-for-domain.js +19 -0
  251. package/lib/lib/git/git.d.ts +8 -0
  252. package/lib/lib/git/git.js +56 -0
  253. package/lib/lib/local/fork-foreman.d.ts +1 -0
  254. package/lib/lib/local/fork-foreman.js +33 -0
  255. package/lib/lib/local/load-foreman-procfile.d.ts +0 -0
  256. package/lib/lib/local/load-foreman-procfile.js +2 -0
  257. package/lib/lib/local/run-foreman.d.ts +0 -0
  258. package/lib/lib/local/run-foreman.js +2 -0
  259. package/lib/lib/pipelines/api.d.ts +25 -0
  260. package/lib/lib/pipelines/api.js +130 -0
  261. package/lib/lib/pipelines/disambiguate.d.ts +3 -0
  262. package/lib/lib/pipelines/disambiguate.js +49 -0
  263. package/lib/lib/pipelines/github-api.d.ts +8 -0
  264. package/lib/lib/pipelines/github-api.js +18 -0
  265. package/lib/lib/pipelines/infer.d.ts +1 -0
  266. package/lib/lib/pipelines/infer.js +11 -0
  267. package/lib/lib/pipelines/key-by.d.ts +1 -0
  268. package/lib/lib/pipelines/key-by.js +11 -0
  269. package/lib/lib/pipelines/kolkrabbi-api.d.ts +14 -0
  270. package/lib/lib/pipelines/kolkrabbi-api.js +62 -0
  271. package/lib/lib/pipelines/ownership.d.ts +4 -0
  272. package/lib/lib/pipelines/ownership.js +40 -0
  273. package/lib/lib/pipelines/render-pipeline.d.ts +6 -0
  274. package/lib/lib/pipelines/render-pipeline.js +52 -0
  275. package/lib/lib/pipelines/setup/create-apps.d.ts +1 -0
  276. package/lib/lib/pipelines/setup/create-apps.js +44 -0
  277. package/lib/lib/pipelines/setup/get-ci-settings.d.ts +4 -0
  278. package/lib/lib/pipelines/setup/get-ci-settings.js +19 -0
  279. package/lib/lib/pipelines/setup/get-github-token.d.ts +1 -0
  280. package/lib/lib/pipelines/setup/get-github-token.js +10 -0
  281. package/lib/lib/pipelines/setup/get-name-and-repo.d.ts +1 -0
  282. package/lib/lib/pipelines/setup/get-name-and-repo.js +47 -0
  283. package/lib/lib/pipelines/setup/get-repo.d.ts +1 -0
  284. package/lib/lib/pipelines/setup/get-repo.js +8 -0
  285. package/lib/lib/pipelines/setup/get-settings.d.ts +9 -0
  286. package/lib/lib/pipelines/setup/get-settings.js +39 -0
  287. package/lib/lib/pipelines/setup/poll-app-setups.d.ts +1 -0
  288. package/lib/lib/pipelines/setup/poll-app-setups.js +25 -0
  289. package/lib/lib/pipelines/setup/setup-pipeline.d.ts +1 -0
  290. package/lib/lib/pipelines/setup/setup-pipeline.js +15 -0
  291. package/lib/lib/pipelines/setup/validate.d.ts +9 -0
  292. package/lib/lib/pipelines/setup/validate.js +31 -0
  293. package/lib/lib/pipelines/stages.d.ts +7 -0
  294. package/lib/lib/pipelines/stages.js +22 -0
  295. package/lib/lib/run/colorize.d.ts +2 -0
  296. package/lib/lib/run/colorize.js +300 -0
  297. package/lib/lib/run/dyno.d.ts +72 -0
  298. package/lib/lib/run/dyno.js +397 -0
  299. package/lib/lib/run/helpers.d.ts +2 -0
  300. package/lib/lib/run/helpers.js +34 -0
  301. package/lib/lib/run/line-transform.d.ts +4 -0
  302. package/lib/lib/run/line-transform.js +26 -0
  303. package/lib/lib/run/log-displayer.d.ts +10 -0
  304. package/lib/lib/run/log-displayer.js +79 -0
  305. package/lib/lib/sessions/sessions.d.ts +7 -0
  306. package/lib/lib/sessions/sessions.js +2 -0
  307. package/lib/lib/status/util.d.ts +1 -0
  308. package/lib/lib/status/util.js +14 -0
  309. package/lib/lib/webhooks/base.d.ts +13 -0
  310. package/lib/lib/webhooks/base.js +28 -0
  311. package/lib/user-config.js +2 -3
  312. package/oclif.manifest.json +3376 -2
  313. package/package.json +80 -43
  314. package/lib/hooks/update/b.d.ts +0 -2
  315. package/lib/hooks/update/b.js +0 -48
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@heroku-cli/command");
4
+ const core_1 = require("@oclif/core");
5
+ const authorizations_1 = require("../../lib/authorizations/authorizations");
6
+ class AuthorizationsInfo extends command_1.Command {
7
+ async run() {
8
+ const { args, flags } = await this.parse(AuthorizationsInfo);
9
+ const { body: authentication } = await this.heroku.get(`/oauth/authorizations/${args.id}`);
10
+ if (flags.json) {
11
+ core_1.ux.styledJSON(authentication);
12
+ }
13
+ else {
14
+ (0, authorizations_1.display)(authentication);
15
+ }
16
+ }
17
+ }
18
+ exports.default = AuthorizationsInfo;
19
+ AuthorizationsInfo.description = 'show an existing OAuth authorization';
20
+ AuthorizationsInfo.flags = {
21
+ json: command_1.flags.boolean({ char: 'j', description: 'output in json format' }),
22
+ };
23
+ AuthorizationsInfo.args = {
24
+ id: core_1.Args.string({ required: true }),
25
+ };
@@ -0,0 +1,10 @@
1
+ import { Command } from '@heroku-cli/command';
2
+ export default class AuthorizationsRevoke extends Command {
3
+ static description: string;
4
+ static aliases: string[];
5
+ static examples: string[];
6
+ static args: {
7
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
8
+ };
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const color_1 = require("@heroku-cli/color");
4
+ const command_1 = require("@heroku-cli/command");
5
+ const core_1 = require("@oclif/core");
6
+ class AuthorizationsRevoke extends command_1.Command {
7
+ async run() {
8
+ const { args } = await this.parse(AuthorizationsRevoke);
9
+ core_1.ux.action.start('Revoking OAuth Authorization');
10
+ const { body: auth } = await this.heroku.delete(`/oauth/authorizations/${encodeURIComponent(args.id)}`);
11
+ core_1.ux.action.stop(`done, revoked authorization from ${color_1.default.cyan(auth.description)}`);
12
+ }
13
+ }
14
+ exports.default = AuthorizationsRevoke;
15
+ AuthorizationsRevoke.description = 'revoke OAuth authorization';
16
+ AuthorizationsRevoke.aliases = ['authorizations:revoke', 'authorizations:destroy'];
17
+ AuthorizationsRevoke.examples = [
18
+ '$ heroku authorizations:revoke 105a7bfa-34c3-476e-873a-b1ac3fdc12fb',
19
+ ];
20
+ AuthorizationsRevoke.args = {
21
+ id: core_1.Args.string({ required: true }),
22
+ };
@@ -0,0 +1,8 @@
1
+ import { Command } from '@heroku-cli/command';
2
+ export default class AuthorizationsRotate extends Command {
3
+ static description: string;
4
+ static args: {
5
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
6
+ };
7
+ run(): Promise<void>;
8
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@heroku-cli/command");
4
+ const core_1 = require("@oclif/core");
5
+ const authorizations_1 = require("../../lib/authorizations/authorizations");
6
+ class AuthorizationsRotate extends command_1.Command {
7
+ async run() {
8
+ const { args } = await this.parse(AuthorizationsRotate);
9
+ core_1.ux.action.start('Rotating OAuth Authorization');
10
+ const { body: authorization } = await this.heroku.post(`/oauth/authorizations/${encodeURIComponent(args.id)}/actions/regenerate-tokens`);
11
+ core_1.ux.action.stop();
12
+ (0, authorizations_1.display)(authorization);
13
+ }
14
+ }
15
+ exports.default = AuthorizationsRotate;
16
+ AuthorizationsRotate.description = 'updates an OAuth authorization token';
17
+ AuthorizationsRotate.args = {
18
+ id: core_1.Args.string({ required: true }),
19
+ };
@@ -0,0 +1,13 @@
1
+ import { Command } from '@heroku-cli/command';
2
+ export default class AuthorizationsUpdate extends Command {
3
+ static description: string;
4
+ static flags: {
5
+ description: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
6
+ 'client-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ 'client-secret': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ };
9
+ static args: {
10
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@heroku-cli/command");
4
+ const core_1 = require("@oclif/core");
5
+ const authorizations_1 = require("../../lib/authorizations/authorizations");
6
+ class AuthorizationsUpdate extends command_1.Command {
7
+ async run() {
8
+ const { args, flags } = await this.parse(AuthorizationsUpdate);
9
+ core_1.ux.action.start('Updating OAuth Authorization');
10
+ let client;
11
+ if (flags['client-id']) {
12
+ client = {
13
+ id: flags['client-id'],
14
+ secret: flags['client-secret'],
15
+ };
16
+ }
17
+ const { body: authentication } = await this.heroku.patch(`/oauth/authorizations/${args.id}`, {
18
+ body: {
19
+ description: flags.description,
20
+ client,
21
+ },
22
+ });
23
+ core_1.ux.action.stop();
24
+ (0, authorizations_1.display)(authentication);
25
+ }
26
+ }
27
+ exports.default = AuthorizationsUpdate;
28
+ AuthorizationsUpdate.description = 'updates an OAuth authorization';
29
+ AuthorizationsUpdate.flags = {
30
+ description: command_1.flags.string({ char: 'd', description: 'set a custom authorization description' }),
31
+ 'client-id': command_1.flags.string({ description: 'identifier of OAuth client to set', dependsOn: ['client-secret'] }),
32
+ 'client-secret': command_1.flags.string({ description: 'secret of OAuth client to set', dependsOn: ['client-id'] }),
33
+ };
34
+ AuthorizationsUpdate.args = {
35
+ id: core_1.Args.string({ required: true }),
36
+ };
@@ -0,0 +1,29 @@
1
+ import { AutocompleteBase } from '../../lib/autocomplete/base';
2
+ export default class Create extends AutocompleteBase {
3
+ static hidden: boolean;
4
+ static description: string;
5
+ private _commands?;
6
+ run(): Promise<void>;
7
+ private ensureDirs;
8
+ private createFiles;
9
+ private get bashSetupScriptPath();
10
+ private get bashCommandsListPath();
11
+ private get zshSetupScriptPath();
12
+ private get zshCompletionSettersPath();
13
+ private get skipEllipsis();
14
+ private get commands();
15
+ private get bashCommandsList();
16
+ private get zshCompletionSetters();
17
+ private get zshCommandsSetter();
18
+ private get zshCommandsFlagsSetters();
19
+ private genCmdPublicFlags;
20
+ private genCmdWithDescription;
21
+ private genZshCmdFlagsSetter;
22
+ private genZshAllCmdsListSetter;
23
+ private get envAnalyticsDir();
24
+ private get envCommandsPath();
25
+ private get bashSetupScript();
26
+ private get zshSetupScript();
27
+ private get completionDotsFunc();
28
+ private wantsLocalFiles;
29
+ }
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fs = require("fs-extra");
4
+ const path = require("path");
5
+ const base_1 = require("../../lib/autocomplete/base");
6
+ const debug = require('debug')('autocomplete:create');
7
+ const AC_LIB_PATH = path.resolve(__dirname, '..', '..', '..', 'autocomplete-scripts');
8
+ class Create extends base_1.AutocompleteBase {
9
+ async run() {
10
+ this.errorIfWindows();
11
+ // 1. ensure needed dirs
12
+ await this.ensureDirs();
13
+ // 2. save (generated) autocomplete files
14
+ await this.createFiles();
15
+ }
16
+ async ensureDirs() {
17
+ // ensure autocomplete cache dir
18
+ await fs.ensureDir(this.autocompleteCacheDir);
19
+ // ensure autocomplete completions dir
20
+ await fs.ensureDir(this.completionsCacheDir);
21
+ }
22
+ async createFiles() {
23
+ await fs.writeFile(this.bashSetupScriptPath, this.bashSetupScript);
24
+ await fs.writeFile(this.zshSetupScriptPath, this.zshSetupScript);
25
+ await fs.writeFile(this.bashCommandsListPath, this.bashCommandsList);
26
+ await fs.writeFile(this.zshCompletionSettersPath, this.zshCompletionSetters);
27
+ }
28
+ get bashSetupScriptPath() {
29
+ // <cacheDir>/autocomplete/bash_setup
30
+ return path.join(this.autocompleteCacheDir, 'bash_setup');
31
+ }
32
+ get bashCommandsListPath() {
33
+ // <cacheDir>/autocomplete/commands
34
+ return path.join(this.autocompleteCacheDir, 'commands');
35
+ }
36
+ get zshSetupScriptPath() {
37
+ // <cacheDir>/autocomplete/zsh_setup
38
+ return path.join(this.autocompleteCacheDir, 'zsh_setup');
39
+ }
40
+ get zshCompletionSettersPath() {
41
+ // <cacheDir>/autocomplete/commands_setters
42
+ return path.join(this.autocompleteCacheDir, 'commands_setters');
43
+ }
44
+ get skipEllipsis() {
45
+ return process.env.HEROKU_AC_ZSH_SKIP_ELLIPSIS === '1';
46
+ }
47
+ get commands() {
48
+ if (this._commands)
49
+ return this._commands;
50
+ const plugins = this.config.plugins;
51
+ const commands = [];
52
+ plugins.forEach(p => {
53
+ p.commands.forEach(c => {
54
+ if (c.hidden)
55
+ return;
56
+ try {
57
+ commands.push(c);
58
+ }
59
+ catch (error) {
60
+ debug(`Error creating completions for command ${c.id}`);
61
+ debug(error.message);
62
+ this.writeLogFile(error.message);
63
+ }
64
+ });
65
+ });
66
+ this._commands = commands;
67
+ return this._commands;
68
+ }
69
+ get bashCommandsList() {
70
+ return this.commands.map(c => {
71
+ try {
72
+ const publicFlags = this.genCmdPublicFlags(c).trim();
73
+ return `${c.id} ${publicFlags}`;
74
+ }
75
+ catch (error) {
76
+ debug(`Error creating bash completion for command ${c.id}, moving on...`);
77
+ debug(error.message);
78
+ this.writeLogFile(error.message);
79
+ return '';
80
+ }
81
+ }).join('\n');
82
+ }
83
+ get zshCompletionSetters() {
84
+ const cmdsSetter = this.zshCommandsSetter;
85
+ const flagSetters = this.zshCommandsFlagsSetters;
86
+ return `${cmdsSetter}\n${flagSetters}`;
87
+ }
88
+ get zshCommandsSetter() {
89
+ const cmdsWithDescriptions = this.commands.map(c => {
90
+ try {
91
+ return this.genCmdWithDescription(c);
92
+ }
93
+ catch (error) {
94
+ debug(`Error creating zsh autocomplete for command ${c.id}, moving on...`);
95
+ debug(error.message);
96
+ this.writeLogFile(error.message);
97
+ return '';
98
+ }
99
+ });
100
+ return this.genZshAllCmdsListSetter(cmdsWithDescriptions);
101
+ }
102
+ get zshCommandsFlagsSetters() {
103
+ return this.commands.map(c => {
104
+ try {
105
+ return this.genZshCmdFlagsSetter(c);
106
+ }
107
+ catch (error) {
108
+ debug(`Error creating zsh autocomplete for command ${c.id}, moving on...`);
109
+ debug(error.message);
110
+ this.writeLogFile(error.message);
111
+ return '';
112
+ }
113
+ }).join('\n');
114
+ }
115
+ genCmdPublicFlags(command) {
116
+ const Flags = command.flags || {};
117
+ return Object.keys(Flags)
118
+ .filter(flag => !Flags[flag].hidden)
119
+ .map(flag => `--${flag}`)
120
+ .join(' ');
121
+ }
122
+ genCmdWithDescription(command) {
123
+ let description = '';
124
+ if (command.description) {
125
+ const text = command.description.split('\n')[0];
126
+ description = `:"${text}"`;
127
+ }
128
+ return `"${command.id.replace(/:/g, '\\:')}"${description}`;
129
+ }
130
+ genZshCmdFlagsSetter(command) {
131
+ const id = command.id;
132
+ const flagscompletions = Object.keys(command.flags || {})
133
+ .filter(flag => command.flags && !command.flags[flag].hidden)
134
+ .map(flag => {
135
+ const f = (command.flags && command.flags[flag]) || { description: '' };
136
+ const isBoolean = f.type === 'boolean';
137
+ const hasCompletion = 'completion' in f || this.findCompletion(id, flag, f.description);
138
+ const name = isBoolean ? flag : `${flag}=-`;
139
+ let cachecompl = '';
140
+ if (hasCompletion) {
141
+ cachecompl = ': :_compadd_flag_options';
142
+ }
143
+ if (this.wantsLocalFiles(flag)) {
144
+ cachecompl = ': :_files';
145
+ }
146
+ const help = isBoolean ? '(switch) ' : (hasCompletion ? '(autocomplete) ' : '');
147
+ const completion = `--${name}[${help}${f.description}]${cachecompl}`;
148
+ return `"${completion}"`;
149
+ })
150
+ .join('\n');
151
+ if (flagscompletions) {
152
+ return `_set_${id.replace(/:/g, '_')}_flags () {
153
+ _flags=(
154
+ ${flagscompletions}
155
+ )
156
+ }
157
+ `;
158
+ }
159
+ return `# no flags for ${id}`;
160
+ }
161
+ genZshAllCmdsListSetter(cmdsWithDesc) {
162
+ return `
163
+ _set_all_commands_list () {
164
+ _all_commands_list=(
165
+ ${cmdsWithDesc.join('\n')}
166
+ )
167
+ }
168
+ `;
169
+ }
170
+ get envAnalyticsDir() {
171
+ return `HEROKU_AC_ANALYTICS_DIR=${path.join(this.autocompleteCacheDir, 'completion_analytics')};`;
172
+ }
173
+ get envCommandsPath() {
174
+ return `HEROKU_AC_COMMANDS_PATH=${path.join(this.autocompleteCacheDir, 'commands')};`;
175
+ }
176
+ get bashSetupScript() {
177
+ return `${this.envAnalyticsDir}
178
+ ${this.envCommandsPath}
179
+ HEROKU_AC_BASH_COMPFUNC_PATH=${path.join(AC_LIB_PATH, 'bash', 'heroku.bash')} && test -f $HEROKU_AC_BASH_COMPFUNC_PATH && source $HEROKU_AC_BASH_COMPFUNC_PATH;
180
+ `;
181
+ }
182
+ get zshSetupScript() {
183
+ return `${this.skipEllipsis ? '' : this.completionDotsFunc}
184
+ ${this.envAnalyticsDir}
185
+ ${this.envCommandsPath}
186
+ HEROKU_AC_ZSH_SETTERS_PATH=\${HEROKU_AC_COMMANDS_PATH}_setters && test -f $HEROKU_AC_ZSH_SETTERS_PATH && source $HEROKU_AC_ZSH_SETTERS_PATH;
187
+ fpath=(
188
+ ${path.join(AC_LIB_PATH, 'zsh')}
189
+ $fpath
190
+ );
191
+ autoload -Uz compinit;
192
+ compinit;
193
+ `;
194
+ }
195
+ get completionDotsFunc() {
196
+ return `expand-or-complete-with-dots() {
197
+ echo -n "..."
198
+ zle expand-or-complete
199
+ zle redisplay
200
+ }
201
+ zle -N expand-or-complete-with-dots
202
+ bindkey "^I" expand-or-complete-with-dots`;
203
+ }
204
+ wantsLocalFiles(flag) {
205
+ return [
206
+ 'file',
207
+ 'procfile',
208
+ ].includes(flag);
209
+ }
210
+ }
211
+ exports.default = Create;
212
+ Create.hidden = true;
213
+ Create.description = 'create autocomplete setup scripts and completion functions';
@@ -0,0 +1,12 @@
1
+ import { FlagInput } from '@oclif/core/lib/interfaces/parser';
2
+ import { AutocompleteBase } from '../../lib/autocomplete/base';
3
+ export default class Doctor extends AutocompleteBase {
4
+ static hidden: boolean;
5
+ static description: string;
6
+ static args: {
7
+ shell: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
8
+ };
9
+ static flags: FlagInput;
10
+ run(): Promise<void>;
11
+ private printList;
12
+ }
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@heroku-cli/command");
4
+ const core_1 = require("@oclif/core");
5
+ const fs = require("fs-extra");
6
+ const path = require("path");
7
+ const base_1 = require("../../lib/autocomplete/base");
8
+ class Doctor extends base_1.AutocompleteBase {
9
+ async run() {
10
+ const { args, flags } = await this.parse(Doctor);
11
+ const shell = args.shell || this.config.shell;
12
+ const printLine = (...args) => this.log(...args);
13
+ this.errorIfNotSupportedShell(shell);
14
+ const data = [];
15
+ // cli version
16
+ data.push({ name: 'cli version', value: this.config.version });
17
+ // plugin version
18
+ const pjson = require(path.resolve(__dirname, '..', '..', '..', 'package.json'));
19
+ data.push({ name: 'plugin version', value: pjson.version });
20
+ // check shell shim source env var
21
+ // i.e. HEROKU_AC_<shell>_SETUP_PATH
22
+ const shellProfilePath = path.join(process.env.HOME || '', shell === 'zsh' ? '.zshrc' : '.bashrc');
23
+ const shellProfile = fs.readFileSync(shellProfilePath);
24
+ const regex = /AC_\w+_SETUP_PATH/;
25
+ const shimVlaue = regex.exec(shellProfile.toString()) ? 'present' : 'missing';
26
+ data.push({ name: `~/${shell === 'zsh' ? '.zshrc' : '.bashrc'} shimmed`, value: shimVlaue });
27
+ // check shell shim
28
+ const shellCompletion = path.join(this.autocompleteCacheDir, `${shell}_setup`);
29
+ const shellCompletionValue = fs.existsSync(shellCompletion) ? 'present' : 'missing';
30
+ data.push({ name: `${shell} shim file`, value: shellCompletionValue });
31
+ // check shell command cache
32
+ const shellCmdCache = path.join(this.autocompleteCacheDir, shell === 'zsh' ? 'commands_setters' : 'commands');
33
+ const shellCmdCacheValue = fs.existsSync(shellCmdCache) ? 'present' : 'missing';
34
+ data.push({ name: `${shell} commands cache`, value: shellCmdCacheValue });
35
+ // check app completion cache
36
+ const appsCache = path.join(this.completionsCacheDir, 'app');
37
+ let appsCacheValue;
38
+ if (fs.existsSync(appsCache)) {
39
+ const length = fs.readJSONSync(appsCache).length;
40
+ appsCacheValue = length || 'empty';
41
+ }
42
+ else {
43
+ appsCacheValue = 'missing';
44
+ }
45
+ data.push({ name: 'apps completion cache', value: appsCacheValue });
46
+ core_1.ux.table(data, {
47
+ name: {},
48
+ value: {},
49
+ }, { 'no-header': true, printLine });
50
+ if (flags.verbose)
51
+ this.printList();
52
+ }
53
+ printList() {
54
+ this.log();
55
+ const header = 'Completable Commands';
56
+ this.log(header);
57
+ this.log('='.repeat(header.length));
58
+ this.config.plugins.forEach(p => {
59
+ p.commands.forEach(c => {
60
+ try {
61
+ if (c.hidden) {
62
+ this.log(`${c.id} (hidden)`);
63
+ }
64
+ else {
65
+ const results = Object.keys(c.flags).map((f) => {
66
+ let out = `--${f}`;
67
+ const flag = c.flags[f];
68
+ if (flag.type === 'option')
69
+ out += '=';
70
+ const hasCompletion = 'completion' in flag || this.findCompletion(c.id, f, flag.description);
71
+ if (hasCompletion) {
72
+ out += '(c)';
73
+ }
74
+ if (flag.hidden)
75
+ out += '(h)';
76
+ return out;
77
+ });
78
+ if (results.length > 0)
79
+ this.log(`${c.id} -> ${results}`);
80
+ }
81
+ }
82
+ catch (_a) {
83
+ this.log(`Error creating autocomplete for command ${c.id}`);
84
+ }
85
+ });
86
+ });
87
+ }
88
+ }
89
+ exports.default = Doctor;
90
+ Doctor.hidden = true;
91
+ Doctor.description = 'autocomplete diagnostic';
92
+ Doctor.args = {
93
+ shell: core_1.Args.string({ description: 'shell type', required: false }),
94
+ };
95
+ Doctor.flags = {
96
+ verbose: command_1.flags.boolean({ description: 'list completable commands' }),
97
+ };
@@ -0,0 +1,12 @@
1
+ import { FlagInput } from '@oclif/core/lib/interfaces/parser';
2
+ import { AutocompleteBase } from '../../lib/autocomplete/base';
3
+ export default class Index extends AutocompleteBase {
4
+ static description: string;
5
+ static args: {
6
+ shell: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
7
+ };
8
+ static flags: FlagInput;
9
+ static examples: string[];
10
+ run(): Promise<void>;
11
+ private updateCache;
12
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@heroku-cli/command");
4
+ const completions_1 = require("@heroku-cli/command/lib/completions");
5
+ const chalk_1 = require("chalk");
6
+ const core_1 = require("@oclif/core");
7
+ const path = require("path");
8
+ const base_1 = require("../../lib/autocomplete/base");
9
+ const cache_1 = require("../../lib/autocomplete/cache");
10
+ const create_1 = require("./create");
11
+ class Index extends base_1.AutocompleteBase {
12
+ async run() {
13
+ const { args, flags } = await this.parse(Index);
14
+ const shell = args.shell || this.config.shell;
15
+ this.errorIfNotSupportedShell(shell);
16
+ core_1.ux.action.start(`${chalk_1.default.bold('Building the autocomplete cache')}`);
17
+ await create_1.default.run([], this.config);
18
+ await this.updateCache(completions_1.AppCompletion, 'app');
19
+ await this.updateCache(completions_1.PipelineCompletion, 'pipeline');
20
+ await this.updateCache(completions_1.SpaceCompletion, 'space');
21
+ await this.updateCache(completions_1.TeamCompletion, 'team');
22
+ core_1.ux.action.stop();
23
+ if (!flags['refresh-cache']) {
24
+ const bin = this.config.bin;
25
+ const bashNote = 'If your terminal starts as a login shell you may need to print the init script into ~/.bash_profile or ~/.profile.';
26
+ const zshNote = `After sourcing, you can run \`${chalk_1.default.cyan('$ compaudit -D')}\` to ensure no permissions conflicts are present`;
27
+ const note = shell === 'zsh' ? zshNote : bashNote;
28
+ const tabStr = shell === 'bash' ? '<TAB><TAB>' : '<TAB>';
29
+ this.log(`
30
+ ${chalk_1.default.bold(`Setup Instructions for ${bin.toUpperCase()} CLI Autocomplete ---`)}
31
+
32
+ 1) Add the autocomplete env var to your ${shell} profile and source it
33
+ ${chalk_1.default.cyan(`$ printf "$(${bin} autocomplete:script ${shell})" >> ~/.${shell}rc; source ~/.${shell}rc`)}
34
+
35
+ NOTE: ${note}
36
+
37
+ 2) Test it out, e.g.:
38
+ ${chalk_1.default.cyan(`$ ${bin} ${tabStr}`)} # Command completion
39
+ ${chalk_1.default.cyan(`$ ${bin} apps:info --${tabStr}`)} # Flag completion
40
+ ${chalk_1.default.cyan(`$ ${bin} apps:info --app=${tabStr}`)} # Flag option completion
41
+
42
+ Visit the autocomplete Dev Center doc at https://devcenter.heroku.com/articles/heroku-cli-autocomplete
43
+
44
+ Enjoy!
45
+ `);
46
+ }
47
+ }
48
+ async updateCache(completion, cacheKey) {
49
+ const cachePath = path.join(this.completionsCacheDir, cacheKey);
50
+ const options = await completion.options({ config: this.config });
51
+ await (0, cache_1.updateCache)(cachePath, options);
52
+ }
53
+ }
54
+ exports.default = Index;
55
+ Index.description = 'display autocomplete installation instructions';
56
+ Index.args = {
57
+ shell: core_1.Args.string({ description: 'shell type', required: false }),
58
+ };
59
+ Index.flags = {
60
+ 'refresh-cache': command_1.flags.boolean({ description: 'refresh cache only (ignores displaying instructions)', char: 'r' }),
61
+ };
62
+ Index.examples = [
63
+ '$ heroku autocomplete',
64
+ '$ heroku autocomplete bash',
65
+ '$ heroku autocomplete zsh',
66
+ '$ heroku autocomplete --refresh-cache',
67
+ ];
@@ -0,0 +1,25 @@
1
+ import { AutocompleteBase } from '../../lib/autocomplete/base';
2
+ export default class Options extends AutocompleteBase {
3
+ static hidden: boolean;
4
+ static description: string;
5
+ static flags: {
6
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ };
8
+ static args: {
9
+ completion: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
10
+ };
11
+ parsedArgs: {
12
+ [name: string]: string;
13
+ };
14
+ parsedFlags: {
15
+ [name: string]: string;
16
+ };
17
+ run(): Promise<void>;
18
+ private processCommandLine;
19
+ private determineCompletion;
20
+ private fetchOptions;
21
+ private parsedFlagsWithEnvVars;
22
+ private throwError;
23
+ private findFlagFromWildArg;
24
+ private determineCmdState;
25
+ }