Compare commits

..

144 Commits

Author SHA1 Message Date
65222b5fc9 v19.13.1 2024-10-21 19:13:36 +00:00
d554658eee Merge pull request #2865 from balena-io/renovate/major-4-chalk
Update dependency chalk to v4
2024-10-21 20:12:31 +01:00
8ded517dd9 Update dependency chalk to v4
Update chalk from 3.0.0 to 4.1.2

Change-type: patch
2024-10-21 18:50:41 +00:00
b0d8b021d5 v19.13.0 2024-10-21 18:14:05 +00:00
2eb5d7f6b3 Merge pull request #2874 from balena-io/envs-add-to-envs-set
Add alias `env set` for command `env add`
2024-10-21 14:13:14 -04:00
f1924bba6b Add alias env set for command env add
Change-type: minor
2024-10-21 12:06:17 -04:00
44082e22e4 git mv env/add to env/set 2024-10-21 12:06:17 -04:00
2d15530f61 v19.12.1 2024-10-21 16:04:19 +00:00
a7c612f7de Merge pull request #2873 from balena-io/bump-oclif-core
Update `@oclif/core`
2024-10-21 16:03:04 +00:00
147ce8067a Update @oclif/core
Change-type: patch
2024-10-21 11:42:30 -04:00
5e7ac09dd0 v19.12.0 2024-10-21 15:07:55 +00:00
4c9fc89a6b Merge pull request #2871 from balena-io/ssh-to-device-ssh
Add alias `device ssh` for `ssh` command
2024-10-21 15:06:26 +00:00
9b1eb57973 Update help.spec per recent help output change 2024-10-21 10:46:08 -04:00
76c08b6c13 Add alias device ssh for ssh command
Change-type: minor
2024-10-21 10:46:08 -04:00
3f82f42652 git mv ssh/index to device/ssh 2024-10-21 10:46:08 -04:00
69d820878a v19.11.1 2024-10-21 13:05:19 +00:00
aaaee47e0c Merge pull request #2869 from balena-io/renovate/major-19-sinon
Update dependency sinon to v19
2024-10-21 14:04:22 +01:00
e7761a616b Update dependency sinon to v19
Update sinon from 18.0.0 to 19.0.2

Change-type: patch
2024-10-21 12:43:26 +00:00
9559d5cba3 v19.11.0 2024-10-21 12:08:59 +00:00
c1649dd828 Merge pull request #2864 from balena-io/logs-to-device-logs
Add alias `device logs` for `logs` command
2024-10-21 12:07:57 +00:00
8e9b992a59 Deduplicate dependencies 2024-10-21 07:45:11 -04:00
b77f266bd7 Add alias device logs for logs
Change-type: minor
2024-10-21 07:35:58 -04:00
3c9ac76982 git mv logs/index to device/logs
Change-type: patch
2024-10-21 07:31:24 -04:00
e483d06d2b v19.10.0 2024-10-21 11:13:10 +00:00
24d2d19d33 Merge pull request #2862 from balena-io/scan-to-device-detect
`scan` to `device detect`
2024-10-21 07:12:05 -04:00
ba5bb7b12c Add alias device detect for scan
Change-type: minor
2024-10-18 10:45:06 -04:00
9082e7b3f7 git mv scan/index to device/detect 2024-10-18 10:39:24 -04:00
0716544042 v19.9.0 2024-10-18 14:25:43 +00:00
e1858aa69d Merge pull request #2861 from balena-io/orgs-to-organization-list
Orgs to organization list
2024-10-18 10:24:49 -04:00
082cce332a Add alias organization list for orgs command
Change-type: minor
2024-10-18 09:33:27 -04:00
218e0a1b6b git mv orgs/ to organization/ 2024-10-18 09:29:01 -04:00
4065c5775c v19.8.0 2024-10-18 13:25:54 +00:00
fd966df1f0 Merge pull request #2860 from balena-io/tags-to-tag-list
`tags` to `tag list`
2024-10-18 13:24:59 +00:00
5eba175bf1 Add alias tag list for tags command
Change-type: minor
2024-10-18 08:49:53 -04:00
bd1b71bf2f git mv tags/index to tag/list 2024-10-18 08:40:05 -04:00
bd7ea3d21a v19.7.0 2024-10-18 12:35:38 +00:00
31662d9175 Merge pull request #2859 from balena-io/envs-to-env-list
`envs` to `env list`
2024-10-18 12:34:15 +00:00
417c75484b Add alias env list for command envs
Change-type: minor
2024-10-18 07:47:46 -04:00
fcd77e97d9 git mv envs/index to env/list 2024-10-18 07:12:39 -04:00
1dd819ae61 v19.6.0 2024-10-18 11:04:31 +00:00
388e02ce85 Merge pull request #2857 from balena-io/key-to-ssh-key
Add `ssh-key` as aliases for all `key` commands
2024-10-18 07:03:26 -04:00
30446605e1 Deduplicate dependencies 2024-10-17 11:46:52 -04:00
e853b15f12 Add ssh-key as aliases for all key commands
Change-type: minor
2024-10-17 11:46:52 -04:00
96cf380f66 git mv key to ssh-key 2024-10-17 11:05:52 -04:00
5d0d02a24d v19.5.0 2024-10-17 14:56:42 +00:00
f5ca07a422 Merge pull request #2856 from balena-io/keys-to-key-list
Add `key list` alias for `keys` command
2024-10-17 10:55:51 -04:00
6b5c6e072b Add key list alias for keys command
Change-type: minor
2024-10-16 15:21:44 -04:00
3615f8e525 git mv keys/index to key/list 2024-10-16 15:15:23 -04:00
ec6cbd120e v19.4.0 2024-10-16 19:12:09 +00:00
65b278e40b Merge pull request #2855 from balena-io/releases-to-release-list
Add `release list` alias for `releases` command
2024-10-16 19:11:21 +00:00
8d1394a77d Add release list alias for releases command
Change-type: minor
2024-10-16 14:50:44 -04:00
ca0a3ee147 git mv releases/index to release/list 2024-10-16 14:25:20 -04:00
019af9e703 v19.3.0 2024-10-16 18:03:21 +00:00
f213940c84 Merge pull request #2854 from balena-io/fleets-to-fleet-list
Add alias `fleet list` for `fleets` command
2024-10-16 14:02:23 -04:00
5243803342 Add alias fleet list for fleets command
Change-type: minor
2024-10-16 12:36:45 -04:00
811e009ba9 git mv fleets/index to fleet/list 2024-10-16 12:31:21 -04:00
45e0f21685 v19.2.0 2024-10-16 16:11:52 +00:00
60f5f47930 Merge pull request #2853 from balena-io/api-keys-to-list
Add alias `api-key list` for command `api-keys`
2024-10-16 12:10:48 -04:00
cad5543863 Add alias api-key list for command api-keys
Change-type: minor
2024-10-16 11:20:30 -04:00
a1e936bb3f git mv api-keys/index to api-key/list 2024-10-16 11:15:23 -04:00
49984c2366 v19.1.3 2024-10-16 14:39:29 +00:00
2a0ab6abbb Merge pull request #2852 from balena-io/remove-custom-os-command-sorting
Remove custom sorting of OS commands in docs in favor of alphabetizing
2024-10-16 14:38:33 +00:00
349bab7702 Deduplicate dependencies 2024-10-16 10:13:38 -04:00
af2c04540f Remove custom sorting of OS commands in docs in favor of alphabetizing
Change-type: patch
2024-10-16 09:58:19 -04:00
cdfabb8f92 v19.1.2 2024-10-16 13:35:41 +00:00
5e058d5158 Merge pull request #2851 from balena-io/command-to-init
Remove custom override of oclif Command class in favor of `prerun` hook
2024-10-16 09:34:36 -04:00
6a81ed2d70 Update expected warnings 2024-10-14 15:56:54 -04:00
d323c0742c Remove no longer needed dependency get-stdin
Change-type: patch
2024-10-14 15:38:21 -04:00
9cdde4f6c2 Remove custom override of oclif Command class in favor of prerun hook
Change-type: patch
2024-10-14 15:38:21 -04:00
ebe10360b3 git mv src/command.ts to src/hooks/init.ts 2024-10-14 11:25:31 -04:00
440c5ad15b v19.1.1 2024-10-14 13:06:42 +00:00
0699278220 Merge pull request #2849 from balena-io/fix-changelog
Fix changelog entry for v19.1.0
2024-10-14 13:05:49 +00:00
0eb5c78e33 Deduplicate dependencies
Change-type: patch
2024-10-14 08:35:32 -04:00
067232b5c4 Fix changelog entry for v19.1.0
Change-type: patch
2024-10-14 07:51:00 -04:00
5716ba29ad v19.1.0 2024-10-11 17:15:09 +00:00
fc2234b0dd Merge pull request #2844 from balena-io/devices-to-device-list
Devices to device list
2024-10-11 17:14:15 +00:00
12cdb14638 Docs: Show aliases for commands
Change-type: patch
2024-10-11 12:54:09 -04:00
b936c51941 Deprecate devices command in favor of device list
Change-type: minor
2024-10-11 12:54:09 -04:00
6c23b06b4c git mv devices/index to device/list 2024-10-11 12:54:09 -04:00
87c52c55ed Deduplicate dependencies
Change-type: patch
2024-10-11 12:54:09 -04:00
f792343180 v19.0.20 2024-10-11 11:48:53 +00:00
680d592af2 Merge pull request #2846 from balena-io/use-default-usage
Use oclif default usage instead of manually filling it out
2024-10-11 11:47:51 +00:00
f52e6bd8b4 Docs: Generate CLI command references from file names instead of usage
Change-type: patch
2024-10-11 07:26:12 -04:00
0847daba1b Use default oclif USAGE message for all commands
Change-type: patch
2024-10-11 07:26:12 -04:00
057b37ae38 v19.0.19 2024-10-11 11:18:26 +00:00
deb7de8951 Merge pull request #2848 from balena-io/update-release-notes-link
Fix update notification release notes link
2024-10-11 11:17:38 +00:00
55dbe42e84 Deduplicate dependencies
Change-type: patch
2024-10-10 15:32:46 -04:00
3e8bc57fdb Fix update notification release notes link
Change-type: patch
2024-10-10 14:05:10 -04:00
d206e7cd66 v19.0.18 2024-10-08 15:25:16 +00:00
7092db8ee8 Merge pull request #2845 from balena-io/contributing-plural-folders
Contributing: No longer request separate folders for plural commands
2024-10-08 15:23:41 +00:00
276d61cf6c Contributing: No longer request separate folders for plural commands
Change-type: patch
2024-10-08 10:54:06 -04:00
77ccd9c39c v19.0.17 2024-10-08 14:04:45 +00:00
9e140eff13 Merge pull request #2842 from balena-io/remove-mixpanel
Remove mixpanel
2024-10-08 10:03:55 -04:00
da95baa70c Remove dev dependency parse-link-header
Change-type: patch
2024-10-08 09:37:37 -04:00
a3ec75c2c7 Remove dev dependency @octokit/rest
Change-type: patch
2024-10-08 09:37:37 -04:00
f6f6be8ee8 Remove dev dependency @octokit/plugin-throttling
Change-type: patch
2024-10-08 09:37:37 -04:00
09e653692b Remove no longer needed references and tests for mixpanel
Change-type: patch
2024-10-08 09:37:37 -04:00
3ac89b236a Remove dev dependency @types/mixpanel
Change-type: patch
2024-10-08 09:37:37 -04:00
bd472f2380 v19.0.16 2024-10-08 13:35:05 +00:00
b5dcf45c40 Merge pull request #2839 from balena-io/compose-reduce-patched-properties
compose: Reduce the properties updated to only the necessary
2024-10-08 16:34:06 +03:00
7e2b5abe60 compose: Reduce the properties updated to only the necessary
Change-type: patch
2024-10-08 16:11:28 +03:00
7b66e0d216 v19.0.15 2024-10-08 13:11:05 +00:00
877c5031a4 Merge pull request #2838 from balena-io/remove-mockery
Remove `mockery` dev dependency
2024-10-08 13:10:17 +00:00
1245b1c99b Remove unused mockery dev dependency
Change-type: patch
2024-10-08 08:47:14 -04:00
8dbe1af551 v19.0.14 2024-10-08 12:44:20 +00:00
aae303202b Merge pull request #2841 from balena-io/temporarily-skip-broken-image-manager-tests
Temporarily skip broken image-manager tests on Windows and Mac
2024-10-08 12:43:19 +00:00
284784505d Deduplicate dependencies 2024-10-08 08:21:07 -04:00
77b9514442 Temporarily skip broken image-manager tests on Windows and Mac
Change-type: patch
2024-10-08 08:21:01 -04:00
ff4afe3ab2 v19.0.13 2024-09-23 11:35:49 +00:00
5ea246f016 Merge pull request #2837 from balena-io/adjust-changelog-message
Remove extra line from recent changelog entry
2024-09-23 11:35:03 +00:00
127bd7ec72 Remove extra line from recent changelog entry
Change-type: patch
2024-09-23 07:12:22 -04:00
fa35877137 v19.0.12 2024-09-20 17:48:43 +00:00
a402dffbc5 Merge pull request #2834 from balena-io/remove-image-manager
Embed balena-image-manager instead of having it as a dependency
2024-09-20 13:47:48 -04:00
c7441b06ac skip
Change-type: patch
2024-09-20 12:05:00 -04:00
251d64eb88 Add image-manager tests
Change-type: patch
2024-09-20 08:38:21 -04:00
ff9bb52a20 Remove balena-image-manager dependency
Change-type: patch
2024-09-20 08:38:21 -04:00
c799c3f10d Embed balena-image-manager instead of having it as a dependency
Change-type: patch
2024-09-20 08:38:21 -04:00
89efe2a2c8 Add mime dependency 2024-09-20 08:38:21 -04:00
f6ff397969 Move mkdirp from devDependency to dependency 2024-09-18 12:56:41 -04:00
aaf709a1d4 v19.0.11 2024-09-18 16:38:59 +00:00
ca6eea4371 Merge pull request #2835 from balena-io/reduce-bluebird
Remove Bluebird as a direct dependency
2024-09-18 19:38:06 +03:00
d39dc5a39a Remove Bluebird as a direct dependency
Change-type: patch
2024-09-18 18:37:39 +03:00
1699419788 v19.0.10 2024-09-12 23:00:18 +00:00
c25591cb4a Merge pull request #2828 from balena-io/remove-package-resin-valid-email
Remove package `@resin.io/valid-email`
2024-09-12 22:59:27 +00:00
a2b4f76c94 Remove package @resin.io/valid-email
Change-type: patch
2024-09-12 18:39:21 -04:00
6a1239bd52 v19.0.9 2024-09-12 16:12:12 +00:00
ddf34326a4 Merge pull request #2830 from balena-io/renovate/actions-download-artifact-4.1.x
Update actions/download-artifact action to v4.1.8
2024-09-12 16:11:15 +00:00
58f480ad7c Update actions/download-artifact action to v4.1.8
Update actions/download-artifact from 4.1.7 to 4.1.8

Change-type: patch
2024-09-12 15:48:40 +00:00
7e6589a7d7 v19.0.8 2024-09-12 15:07:56 +00:00
c699bb1dbc Merge pull request #2829 from balena-io/renovate/actions-upload-artifact-digest
Update actions/upload-artifact digest to 5076954
2024-09-12 15:07:01 +00:00
e101e0f466 Update actions/upload-artifact digest to 5076954
Update actions/upload-artifact

Change-type: patch
2024-09-12 14:47:50 +00:00
e29273142e v19.0.7 2024-09-12 14:13:22 +00:00
519395cfcd Merge pull request #2825 from balena-io/renovate/actions-setup-node-digest
Update actions/setup-node digest to 1e60f62
2024-09-12 14:12:33 +00:00
314e8800d0 Update actions/setup-node digest to 1e60f62
Update actions/setup-node

Change-type: patch
2024-09-12 13:48:25 +00:00
0bb1c892e8 v19.0.6 2024-09-12 13:47:30 +00:00
5eb79f5cf0 Merge pull request #2802 from balena-io/remove-moment-library
Remove moment and moment-duration-format in favor of native time parsing
2024-09-12 10:46:29 -03:00
707b249e97 Remove moment and moment-duration-format in favor of native time parsing
Change-type: patch
2024-09-12 10:05:13 -03:00
2a725cd1f0 v19.0.5 2024-09-10 15:13:27 +00:00
83f274cc62 Merge pull request #2789 from balena-io/renovate/apple-actions-import-codesign-certs-2.x
Update apple-actions/import-codesign-certs action to v2
2024-09-10 12:12:42 -03:00
9242a3493a Update apple-actions/import-codesign-certs action to v2
Update apple-actions/import-codesign-certs from 1 to 2

Change-type: patch
2024-09-10 14:47:56 +00:00
aa46d314b4 v19.0.4 2024-09-10 14:44:44 +00:00
58f7dfc894 Merge pull request #2824 from balena-io/bump-ts-5_6_2
Bump TypeScript to 5.6.2
2024-09-10 14:43:53 +00:00
39e1c02648 Deduplicate dependencies
Resolves: #
Change-type:
2024-09-10 11:53:09 +03:00
5f92bbc846 Update TypeScript to 5.6.2
Change-type: patch
2024-09-10 11:49:41 +03:00
167 changed files with 3979 additions and 3454 deletions

View File

@ -28,7 +28,7 @@ runs:
using: 'composite'
steps:
- name: Download custom source artifact
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: custom-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ runner.os }}-${{ runner.arch }}
path: ${{ runner.temp }}
@ -39,7 +39,7 @@ runs:
run: tar -xf ${{ runner.temp }}/custom.tgz
- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version: ${{ inputs.NODE_VERSION }}
cache: npm
@ -66,7 +66,7 @@ runs:
# https://github.com/Apple-Actions/import-codesign-certs
- name: Import Apple code signing certificate
if: runner.os == 'macOS'
uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071 # v1
uses: apple-actions/import-codesign-certs@8f3fb608891dd2244cdab3d69cd68c0d37a7fe93 # v2
with:
p12-file-base64: ${{ fromJSON(inputs.secrets).APPLE_SIGNING }}
p12-password: ${{ fromJSON(inputs.secrets).APPLE_SIGNING_PASSWORD }}
@ -135,7 +135,7 @@ runs:
XCODE_APP_LOADER_TEAM_ID: ${{ inputs.XCODE_APP_LOADER_TEAM_ID }}
- name: Upload artifacts
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
with:
name: gh-release-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ strategy.job-index }}
path: dist

View File

@ -26,7 +26,7 @@ runs:
steps:
# https://github.com/actions/setup-node#caching-global-packages-data
- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version: ${{ inputs.NODE_VERSION }}
cache: npm
@ -58,7 +58,7 @@ runs:
run: tar --exclude-vcs -acf ${{ runner.temp }}/custom.tgz .
- name: Upload custom artifact
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
with:
name: custom-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ runner.os }}-${{ runner.arch }}
path: ${{ runner.temp }}/custom.tgz

View File

@ -1,3 +1,553 @@
- commits:
- subject: Update dependency chalk to v4
hash: 8ded517dd96fe6237cb356ebc5c3a6263ba8edee
body: |
Update chalk from 3.0.0 to 4.1.2
footer:
Change-type: patch
change-type: patch
author: Self-hosted Renovate Bot
nested: []
version: 19.13.1
title: ""
date: 2024-10-21T19:13:31.221Z
- commits:
- subject: Add alias `env set` for command `env add`
hash: f1924bba6b1c4fe4ba57f3a63ddc98f4fa5290ba
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.13.0
title: ""
date: 2024-10-21T18:14:01.461Z
- commits:
- subject: Update `@oclif/core`
hash: 147ce8067a679d320fc8ef741266b8a5d6008a7e
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.12.1
title: ""
date: 2024-10-21T16:04:14.283Z
- commits:
- subject: Add alias `device ssh` for `ssh` command
hash: 76c08b6c13bd07f657ff5774863425e629d11f0a
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.12.0
title: ""
date: 2024-10-21T15:07:43.707Z
- commits:
- subject: Update dependency sinon to v19
hash: e7761a616bfdfb193f8617b3ba023fb3fce4ed05
body: |
Update sinon from 18.0.0 to 19.0.2
footer:
Change-type: patch
change-type: patch
author: Self-hosted Renovate Bot
nested: []
version: 19.11.1
title: ""
date: 2024-10-21T13:05:14.018Z
- commits:
- subject: Add alias `device logs` for `logs`
hash: b77f266bd757d62f110d4fc61128b5aa592f7a4e
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
- subject: git mv `logs/index` to `device/logs`
hash: 3c9ac769827da50d7c3617cba13aeaa01bccbba7
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.11.0
title: ""
date: 2024-10-21T12:08:55.576Z
- commits:
- subject: Add alias `device detect` for `scan`
hash: ba5bb7b12c797e024b82232a323afecf1659de19
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.10.0
title: ""
date: 2024-10-21T11:13:04.550Z
- commits:
- subject: Add alias `organization list` for `orgs` command
hash: 082cce332a497c15b34467f9ed22514ebaafaec9
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.9.0
title: ""
date: 2024-10-18T14:25:39.691Z
- commits:
- subject: Add alias `tag list` for `tags` command
hash: 5eba175bf1a0e016b98757848e0c345489f686c1
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.8.0
title: ""
date: 2024-10-18T13:25:50.462Z
- commits:
- subject: Add alias `env list` for command `envs`
hash: 417c75484b1ac6c216323248b50ba00fc3fe5a7f
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.7.0
title: ""
date: 2024-10-18T12:35:31.416Z
- commits:
- subject: Add `ssh-key` as aliases for all `key` commands
hash: e853b15f12af429265b1e9e20ce60db19438df4b
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.6.0
title: ""
date: 2024-10-18T11:04:26.745Z
- commits:
- subject: Add `key list` alias for `keys` command
hash: 6b5c6e072b426a1e9517376ee756afa31ed96cfa
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.5.0
title: ""
date: 2024-10-17T14:56:38.422Z
- commits:
- subject: Add `release list` alias for `releases` command
hash: 8d1394a77d8cca4f18d162a3f522e80e8092ffa7
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.4.0
title: ""
date: 2024-10-16T19:12:05.274Z
- commits:
- subject: Add alias `fleet list` for `fleets` command
hash: 5243803342203ebac2a04c2fcfe1e9aa4a126a21
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.3.0
title: ""
date: 2024-10-16T18:03:16.667Z
- commits:
- subject: Add alias `api-key list` for command `api-keys`
hash: cad5543863b9f3e2b9c5883083dc3051b9e50ecf
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.2.0
title: ""
date: 2024-10-16T16:11:48.485Z
- commits:
- subject: Remove custom sorting of OS commands in docs in favor of alphabetizing
hash: af2c04540f41428b668ab0890dd498dfd28a4f11
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.1.3
title: ""
date: 2024-10-16T14:39:24.641Z
- commits:
- subject: Remove no longer needed dependency `get-stdin`
hash: d323c0742cfbbcc017f11f9fd30a9539b1c46f84
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Remove custom override of oclif Command class in favor of `prerun` hook
hash: 9cdde4f6c21ea1593de83107794a5b7323ed4cfe
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.1.2
title: ""
date: 2024-10-16T13:35:36.846Z
- commits:
- subject: Deduplicate dependencies
hash: 0eb5c78e33979e7fbe7beb4e407949d53af6004b
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Fix changelog entry for v19.1.0
hash: 067232b5c4d757913d4fb1c8f9611ed8eb394124
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.1.1
title: ""
date: 2024-10-14T13:06:38.383Z
- commits:
- subject: "Docs: Show aliases for commands"
hash: 12cdb1463860a1ffef4e8ad44dde32f00369e3b5
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Deprecate `devices` command in favor of `device list`
hash: b936c51941808db8c832678e11af86e2136cfea6
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
- subject: Deduplicate dependencies
hash: 87c52c55eda0c7b6f9fa72e20b2298fa9ffefef2
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.1.0
title: ""
date: 2024-10-11T17:15:02.716Z
- commits:
- subject: "Docs: Generate CLI command references from file names instead of usage"
hash: f52e6bd8b436d4243e39c9069b8ee885bb6401ff
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Use default oclif `USAGE` message for all commands
hash: 0847daba1b58f807a222c5163b8383cc44cd13fc
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.20
title: ""
date: 2024-10-11T11:48:49.138Z
- commits:
- subject: Deduplicate dependencies
hash: 55dbe42e84ebb14dac9c1da189594e345f69d7cd
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Fix update notification release notes link
hash: 3e8bc57fdba35f7cbd4e357c5b8f0395c7bb0eef
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.19
title: ""
date: 2024-10-11T11:18:22.541Z
- commits:
- subject: "Contributing: No longer request separate folders for plural commands"
hash: 276d61cf6c3dfac44796736ff4570f2aeaec971e
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.18
title: ""
date: 2024-10-08T15:25:03.766Z
- commits:
- subject: Remove dev dependency `parse-link-header`
hash: da95baa70cc2dc72e6d529fa25c42cd2e1739c10
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Remove dev dependency @octokit/rest
hash: a3ec75c2c752f734f07e84e9213887b4aec4e7fd
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Remove dev dependency @octokit/plugin-throttling
hash: f6f6be8ee8be80048e621a4e75d2fbecacce47e4
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Remove no longer needed references and tests for mixpanel
hash: 09e653692b00777aa56625751110305223bc5917
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Remove dev dependency `@types/mixpanel`
hash: 3ac89b236abe3392c185010c3b3851a6923d083a
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.17
title: ""
date: 2024-10-08T14:04:42.011Z
- commits:
- subject: "compose: Reduce the properties updated to only the necessary"
hash: 7e2b5abe600ab13f5f55fc86f0850b54a66debe5
body: ""
footer:
Change-type: patch
change-type: patch
author: Thodoris Greasidis
nested: []
version: 19.0.16
title: ""
date: 2024-10-08T13:35:01.015Z
- commits:
- subject: Remove unused `mockery` dev dependency
hash: 1245b1c99bab2d504a025f489451710cc140bc55
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.15
title: ""
date: 2024-10-08T13:11:01.319Z
- commits:
- subject: Temporarily skip broken image-manager tests on Windows and Mac
hash: 77b9514442ab81ef1375a2517eb3e9aab7e724da
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.14
title: ""
date: 2024-10-08T12:44:14.300Z
- commits:
- subject: Remove extra line from recent changelog entry
hash: 127bd7ec722133d81cd94a5e028d9f2e5219df7c
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.13
title: ""
date: 2024-09-23T11:35:45.475Z
- commits:
- subject: skip
hash: c7441b06ac97a50d8ffefebff3af55e1d12d4035
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Add `image-manager` tests
hash: 251d64eb8831555e2cfc8a54c73701eadb8c4f06
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Remove `balena-image-manager` dependency
hash: ff9bb52a20b3f21281189ddfbbe1b800e104be1d
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Embed `balena-image-manager` instead of having it as a dependency
hash: c799c3f10d1491227fe770ceace46b26ae209b19
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.12
title: ""
date: 2024-09-20T17:48:39.881Z
- commits:
- subject: Remove Bluebird as a direct dependency
hash: d39dc5a39ad0ec25e0a690b881c8212699f64162
body: ""
footer:
Change-type: patch
change-type: patch
author: Thodoris Greasidis
nested: []
version: 19.0.11
title: ""
date: 2024-09-18T16:38:55.929Z
- commits:
- subject: Remove package `@resin.io/valid-email`
hash: a2b4f76c94e7fda3f122adf721e0a12d9a0e9164
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.10
title: ""
date: 2024-09-12T23:00:13.119Z
- commits:
- subject: Update actions/download-artifact action to v4.1.8
hash: 58f480ad7c097952b3ff4e0a5daebc163f2ce7c1
body: |
Update actions/download-artifact from 4.1.7 to 4.1.8
footer:
Change-type: patch
change-type: patch
author: Self-hosted Renovate Bot
nested: []
version: 19.0.9
title: ""
date: 2024-09-12T16:12:08.049Z
- commits:
- subject: Update actions/upload-artifact digest to 5076954
hash: e101e0f46663585d2999c1bd59c5335a2d012ae4
body: |
Update actions/upload-artifact
footer:
Change-type: patch
change-type: patch
author: Self-hosted Renovate Bot
nested: []
version: 19.0.8
title: ""
date: 2024-09-12T15:07:51.366Z
- commits:
- subject: Update actions/setup-node digest to 1e60f62
hash: 314e8800d0c6dfeade2140125cb3dd996713713e
body: |
Update actions/setup-node
footer:
Change-type: patch
change-type: patch
author: Self-hosted Renovate Bot
nested: []
version: 19.0.7
title: ""
date: 2024-09-12T14:13:18.381Z
- commits:
- subject: Remove moment and moment-duration-format in favor of native time parsing
hash: 707b249e972a6943d75014f487285c0dd8085b15
body: ""
footer:
Change-type: patch
change-type: patch
author: Otavio Jacobi
nested: []
version: 19.0.6
title: ""
date: 2024-09-12T13:47:25.357Z
- commits:
- subject: Update apple-actions/import-codesign-certs action to v2
hash: 9242a3493af4c518c4d1328f19ddf2d95c182af7
body: |
Update apple-actions/import-codesign-certs from 1 to 2
footer:
Change-type: patch
change-type: patch
author: Self-hosted Renovate Bot
nested: []
version: 19.0.5
title: ""
date: 2024-09-10T15:13:23.938Z
- commits:
- subject: Update TypeScript to 5.6.2
hash: 5f92bbc846fe93cc03ebe7717baafe24f17d4e0d
body: ""
footer:
Change-type: patch
change-type: patch
author: Thodoris Greasidis
nested: []
version: 19.0.4
title: ""
date: 2024-09-10T14:44:39.949Z
- commits:
- subject: Reduce use of CJS require() on automation files
hash: facc66e9f97d075610d4383efa92dceb5b4f7acf

View File

@ -4,6 +4,163 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).
## 19.13.1 - 2024-10-21
* Update dependency chalk to v4 [Self-hosted Renovate Bot]
## 19.13.0 - 2024-10-21
* Add alias `env set` for command `env add` [myarmolinsky]
## 19.12.1 - 2024-10-21
* Update `@oclif/core` [myarmolinsky]
## 19.12.0 - 2024-10-21
* Add alias `device ssh` for `ssh` command [myarmolinsky]
## 19.11.1 - 2024-10-21
* Update dependency sinon to v19 [Self-hosted Renovate Bot]
## 19.11.0 - 2024-10-21
* Add alias `device logs` for `logs` [myarmolinsky]
* git mv `logs/index` to `device/logs` [myarmolinsky]
## 19.10.0 - 2024-10-21
* Add alias `device detect` for `scan` [myarmolinsky]
## 19.9.0 - 2024-10-18
* Add alias `organization list` for `orgs` command [myarmolinsky]
## 19.8.0 - 2024-10-18
* Add alias `tag list` for `tags` command [myarmolinsky]
## 19.7.0 - 2024-10-18
* Add alias `env list` for command `envs` [myarmolinsky]
## 19.6.0 - 2024-10-18
* Add `ssh-key` as aliases for all `key` commands [myarmolinsky]
## 19.5.0 - 2024-10-17
* Add `key list` alias for `keys` command [myarmolinsky]
## 19.4.0 - 2024-10-16
* Add `release list` alias for `releases` command [myarmolinsky]
## 19.3.0 - 2024-10-16
* Add alias `fleet list` for `fleets` command [myarmolinsky]
## 19.2.0 - 2024-10-16
* Add alias `api-key list` for command `api-keys` [myarmolinsky]
## 19.1.3 - 2024-10-16
* Remove custom sorting of OS commands in docs in favor of alphabetizing [myarmolinsky]
## 19.1.2 - 2024-10-16
* Remove no longer needed dependency `get-stdin` [myarmolinsky]
* Remove custom override of oclif Command class in favor of `prerun` hook [myarmolinsky]
## 19.1.1 - 2024-10-14
* Deduplicate dependencies [myarmolinsky]
* Fix changelog entry for v19.1.0 [myarmolinsky]
## 19.1.0 - 2024-10-11
* Docs: Show aliases for commands [myarmolinsky]
* Add alias `device list` for `devices` command [myarmolinsky]
* Deduplicate dependencies [myarmolinsky]
## 19.0.20 - 2024-10-11
* Docs: Generate CLI command references from file names instead of usage [myarmolinsky]
* Use default oclif `USAGE` message for all commands [myarmolinsky]
## 19.0.19 - 2024-10-11
* Deduplicate dependencies [myarmolinsky]
* Fix update notification release notes link [myarmolinsky]
## 19.0.18 - 2024-10-08
* Contributing: No longer request separate folders for plural commands [myarmolinsky]
## 19.0.17 - 2024-10-08
* Remove dev dependency `parse-link-header` [myarmolinsky]
* Remove dev dependency @octokit/rest [myarmolinsky]
* Remove dev dependency @octokit/plugin-throttling [myarmolinsky]
* Remove no longer needed references and tests for mixpanel [myarmolinsky]
* Remove dev dependency `@types/mixpanel` [myarmolinsky]
## 19.0.16 - 2024-10-08
* compose: Reduce the properties updated to only the necessary [Thodoris Greasidis]
## 19.0.15 - 2024-10-08
* Remove unused `mockery` dev dependency [myarmolinsky]
## 19.0.14 - 2024-10-08
* Temporarily skip broken image-manager tests on Windows and Mac [myarmolinsky]
## 19.0.13 - 2024-09-23
* Remove extra line from recent changelog entry [myarmolinsky]
## 19.0.12 - 2024-09-20
* Add `image-manager` tests [myarmolinsky]
* Remove `balena-image-manager` dependency [myarmolinsky]
* Embed `balena-image-manager` instead of having it as a dependency [myarmolinsky]
## 19.0.11 - 2024-09-18
* Remove Bluebird as a direct dependency [Thodoris Greasidis]
## 19.0.10 - 2024-09-12
* Remove package `@resin.io/valid-email` [myarmolinsky]
## 19.0.9 - 2024-09-12
* Update actions/download-artifact action to v4.1.8 [Self-hosted Renovate Bot]
## 19.0.8 - 2024-09-12
* Update actions/upload-artifact digest to 5076954 [Self-hosted Renovate Bot]
## 19.0.7 - 2024-09-12
* Update actions/setup-node digest to 1e60f62 [Self-hosted Renovate Bot]
## 19.0.6 - 2024-09-12
* Remove moment and moment-duration-format in favor of native time parsing [Otavio Jacobi]
## 19.0.5 - 2024-09-10
* Update apple-actions/import-codesign-certs action to v2 [Self-hosted Renovate Bot]
## 19.0.4 - 2024-09-10
* Update TypeScript to 5.6.2 [Thodoris Greasidis]
## 19.0.3 - 2024-09-05
* Reduce use of CJS require() on automation files [Otavio Jacobi]

View File

@ -133,7 +133,6 @@ To add a new command to be documented,
1. Find the resource which it is part of or create a new one.
2. List the location of the build file
3. Make sure to add your files in alphabetical order
4. Resources with plural names needs to have 2 sections if they have commands like: "fleet, fleets" or "device, devices" or "tag, tags"
Once added, run the command `npm run build` to generate the documentation

View File

@ -145,7 +145,7 @@ container) in order to allow npm scripts like `postinstall` to be executed.
## Additional Dependencies
The `balena ssh`, `scan`, `build`, `deploy` and `preload` commands may require
The `balena device ssh`, `device detect`, `build`, `deploy` and `preload` commands may require
additional software to be installed. Check the Additional Dependencies sections for each operating
system:

View File

@ -33,7 +33,7 @@ as described above.
## sudo configuration
A few CLI commands require execution through sudo, e.g. `sudo balena scan`.
A few CLI commands require execution through sudo, e.g. `sudo balena device detect`.
If your Linux distribution has an `/etc/sudoers` file that defines a `secure_path`
setting, run `sudo visudo` to edit it and add the balena CLI's installation folder to
the ***pre-existing*** `secure_path` setting, for example:
@ -61,19 +61,19 @@ instructions](https://docs.docker.com/install/overview/) to install Docker on th
workstation as the balena CLI. The [advanced installation
options](./INSTALL-ADVANCED.md#additional-dependencies) document describes other possibilities.
### balena ssh
### balena device ssh
The `balena ssh` command requires the `ssh` command-line tool to be available. Most Linux
The `balena device ssh` command requires the `ssh` command-line tool to be available. Most Linux
distributions will already have it installed. Otherwise, `sudo apt-get install openssh-client`
should do the trick on Debian or Ubuntu.
The `balena ssh` command also requires an SSH key to be added to your balena account: see [SSH
The `balena device ssh` command also requires an SSH key to be added to your balena account: see [SSH
Access documentation](https://www.balena.io/docs/learn/manage/ssh-access/). The `balena key*`
command set can also be used to list and manage SSH keys: see `balena help -v`.
### balena scan
### balena device detect
The `balena scan` command requires a multicast DNS (mDNS) service like
The `balena device detect` command requires a multicast DNS (mDNS) service like
[Avahi](https://en.wikipedia.org/wiki/Avahi_(software)), which is installed by default on most
desktop Linux distributions. Otherwise, on Debian or Ubuntu, the installation command would be
`sudo apt-get install avahi-daemon`.

View File

@ -19,7 +19,7 @@ Selected operating system: **macOS**
- On the terminal prompt, type `balena version` and hit Enter. It should display
the version of the balena CLI that you have installed.
No further steps are required to run most CLI commands. The `balena ssh`, `build`, `deploy`
No further steps are required to run most CLI commands. The `balena device ssh`, `build`, `deploy`
and `preload` commands may require additional software to be installed, as described
in the next section.
@ -41,9 +41,9 @@ instructions](https://docs.docker.com/install/overview/) to install Docker on th
workstation as the balena CLI. The [advanced installation
options](./INSTALL-ADVANCED.md#additional-dependencies) document describes other possibilities.
### balena ssh
### balena device ssh
The `balena ssh` command requires the `ssh` command-line tool to be available. To check whether
The `balena device ssh` command requires the `ssh` command-line tool to be available. To check whether
it is already installed, run `ssh` on a Terminal window. If it is not yet installed, the options
include:
@ -52,7 +52,7 @@ include:
Components → Command Line Tools → Install.
* Or, install [Homebrew](https://brew.sh/), then `brew install openssh`
The `balena ssh` command also requires an SSH key to be added to your balena account: see [SSH
The `balena device ssh` command also requires an SSH key to be added to your balena account: see [SSH
Access documentation](https://www.balena.io/docs/learn/manage/ssh-access/). The `balena key*`
command set can also be used to list and manage SSH keys: see `balena help -v`.

View File

@ -19,7 +19,7 @@ Selected operating system: **Windows**
- On the command prompt, type `balena version` and hit Enter. It should display
the version of the balena CLI that you have installed.
No further steps are required to run most CLI commands. The `balena ssh`, `scan`, `build`,
No further steps are required to run most CLI commands. The `balena device ssh`, `device detect`, `build`,
`deploy` and `preload` commands may require additional software to be installed, as
described below.
@ -34,9 +34,9 @@ instructions](https://docs.docker.com/install/overview/) to install Docker on th
workstation as the balena CLI. The [advanced installation
options](./INSTALL-ADVANCED.md#additional-dependencies) document describes other possibilities.
### balena ssh
### balena device ssh
The `balena ssh` command requires the `ssh` command-line tool to be available. Microsoft started
The `balena device ssh` command requires the `ssh` command-line tool to be available. Microsoft started
distributing an SSH client with Windows 10, which is automatically installed through Windows
Update. To check whether it is installed, run `ssh` on a Windows Command Prompt or PowerShell. It
can also be [manually
@ -44,13 +44,13 @@ installed](https://docs.microsoft.com/en-us/windows-server/administration/openss
if needed. For older versions of Windows, there are several ssh/OpenSSH clients provided by 3rd
parties.
The `balena ssh` command also requires an SSH key to be added to your balena account: see [SSH
The `balena device ssh` command also requires an SSH key to be added to your balena account: see [SSH
Access documentation](https://www.balena.io/docs/learn/manage/ssh-access/). The `balena key*`
command set can also be used to list and manage SSH keys: see `balena help -v`.
### balena scan
### balena device detect
The `balena scan` command requires a multicast DNS (mDNS) service like Apple's Bonjour.
The `balena device detect` command requires a multicast DNS (mDNS) service like Apple's Bonjour.
Many Windows machines will already have this service installed, as it is bundled in popular
applications such as Skype (Wikipedia lists [several others](https://en.wikipedia.org/wiki/Bonjour_(software))).
Otherwise, Bonjour for Windows can be downloaded and installed from: https://support.apple.com/kb/DL999

View File

@ -88,9 +88,9 @@ HTTP(S) proxies can be configured through any of the following methods, in prece
* The `HTTPS_PROXY` and/or `HTTP_PROXY` environment variables, in the same URL format as
`BALENARC_PROXY`.
### Proxy setup for balena ssh
### Proxy setup for balena device ssh
In order to work behind a proxy server, the `balena ssh` command requires the
In order to work behind a proxy server, the `balena device ssh` command requires the
[`proxytunnel`](http://proxytunnel.sourceforge.net/) package (command-line tool) to be installed.
`proxytunnel` is available for Linux distributions like Ubuntu/Debian (`apt install proxytunnel`),
and for macOS through [Homebrew](https://brew.sh/). Windows support is limited to the [Windows
@ -110,7 +110,7 @@ The `BALENARC_NO_PROXY` variable may be used to exclude specified destinations f
> * This feature requires CLI version 11.30.8 or later. In the case of the npm [installation
> option](https://github.com/balena-io/balena-cli/blob/master/INSTALL.md), it also requires
> Node.js version 10.16.0 or later.
> * To exclude a `balena ssh` target from proxying (IP address or `.local` hostname), the
> * To exclude a `balena device ssh` target from proxying (IP address or `.local` hostname), the
> `--noproxy` option should be specified in addition to the `BALENARC_NO_PROXY` variable.
By default (if `BALENARC_NO_PROXY` is not defined), all [private IPv4

View File

@ -79,10 +79,10 @@ Try resetting the ownership by running:
$ sudo chown -R <user> $HOME/.balena
```
## Broken line wrapping / cursor behavior with `balena ssh`
## Broken line wrapping / cursor behavior with `balena device ssh`
Users sometimes come across broken line wrapping or cursor behavior in text terminals, for example
when long command lines are typed in a `balena ssh` session, or when using text editors like `vim`
when long command lines are typed in a `balena device ssh` session, or when using text editors like `vim`
or `nano`. This is not something specific to the balena CLI, being also a commonly reported issue
with standard remote terminal tools like `ssh` or `telnet`. It is often a remote shell
configuration issue (files like `/etc/profile`, `~/.bash_profile`, `~/.bash_login`, `~/.profile`

View File

@ -19,7 +19,6 @@ import type { JsonVersions } from '../src/commands/version/index';
import { run as oclifRun } from '@oclif/core';
import * as archiver from 'archiver';
import * as Bluebird from 'bluebird';
import { exec, execFile } from 'child_process';
import * as filehound from 'filehound';
import type { Stats } from 'fs';
@ -42,6 +41,7 @@ import {
const execFileAsync = promisify(execFile);
const execAsync = promisify(exec);
const rimrafAsync = promisify(rimraf);
export const packageJSON = loadPackageJson();
export const version = 'v' + packageJSON.version;
@ -517,7 +517,7 @@ export async function buildOclifInstaller() {
}
for (const dir of dirs) {
console.log(`rimraf(${dir})`);
await Bluebird.fromCallback((cb) => rimraf(dir, cb));
await rimrafAsync(dir);
}
console.log('=======================================================');
console.log(`oclif ${packCmd} ${packOpts.join(' ')}`);

View File

@ -36,9 +36,6 @@ import { GlobSync } from 'glob';
* This dictionary is the source of truth that creates the docs config which is used
* to generate the CLI documentation. By default, the folder name will be used.
*
* Resources with plural names needs to have 2 sections if they have commands like:
* "fleet, fleets" or "device, devices" or "tag, tags"
*
*/
interface Category {
@ -55,20 +52,15 @@ interface Documentation {
// Mapping folders names to custom headings in the docs
const commandHeadings: { [key: string]: string } = {
'api-key': 'API Keys',
'api-keys': 'API Keys',
login: 'Authentication',
whoami: 'Authentication',
logout: 'Authentication',
env: 'Environment Variables',
envs: 'Environment Variables',
help: 'Help and Version',
key: 'SSH Keys',
keys: 'SSH Keys',
orgs: 'Organizations',
'ssh-key': 'SSH Keys',
organization: 'Organizations',
os: 'OS',
util: 'Utilities',
ssh: 'Network',
scan: 'Network',
tunnel: 'Network',
build: 'Deploy',
join: 'Platform',

View File

@ -26,7 +26,7 @@ export interface Document {
export interface Category {
title: string;
commands: OclifCommand[];
commands: Array<OclifCommand & { name: string }>;
}
export { OclifCommand };

View File

@ -18,7 +18,6 @@ import * as path from 'path';
import { getCapitanoDoc } from './capitanodoc';
import type { Category, Document, OclifCommand } from './doc-types';
import * as markdown from './markdown';
import { stripIndent } from '../../src/utils/lazy';
/**
* Generates the markdown document (as a string) for the CLI documentation
@ -39,7 +38,7 @@ export async function renderMarkdown(): Promise<string> {
};
for (const jsFilename of commandCategory.files) {
category.commands.push(...(await importOclifCommands(jsFilename)));
category.commands.push(await importOclifCommands(jsFilename));
}
result.categories.push(category);
}
@ -47,51 +46,23 @@ export async function renderMarkdown(): Promise<string> {
return markdown.render(result);
}
// Help is now managed via a plugin
// This fake command allows capitanodoc to include help in docs
class FakeHelpCommand {
description = stripIndent`
List balena commands, or get detailed help for a specific command.
async function importOclifCommands(jsFilename: string) {
const command = (await import(path.join(process.cwd(), jsFilename)))
.default as OclifCommand;
List balena commands, or get detailed help for a specific command.
`;
examples = [
'$ balena help',
'$ balena help login',
'$ balena help os download',
];
args = {
command: {
description: 'command to show help for',
},
};
usage = 'help [command]';
flags = {
verbose: {
description: 'show additional commands',
char: '-v',
},
};
}
async function importOclifCommands(
jsFilename: string,
): Promise<OclifCommand[]> {
// TODO: Currently oclif commands with no `usage` overridden will cause
// an error when parsed. This should be improved so that `usage` does not have
// to be overridden if not necessary.
const command: OclifCommand =
jsFilename === 'help'
? (new FakeHelpCommand() as unknown as OclifCommand)
: ((await import(path.join(process.cwd(), jsFilename)))
.default as OclifCommand);
return [command];
return {
...command,
// build/commands/device/index.js -> device
// build/commands/device/list.js -> device list
name: jsFilename
.split('/')
.slice(2)
.join(' ')
.split('.')
.slice(0, 1)
.join(' ')
.split(' index')[0],
} as Category['commands'][0];
}
/**

View File

@ -18,12 +18,20 @@ import { Parser } from '@oclif/core';
import * as ent from 'ent';
import * as _ from 'lodash';
import { getManualSortCompareFunction } from '../../src/utils/helpers';
import { capitanoizeOclifUsage } from '../../src/utils/oclif-utils';
import type { Category, Document, OclifCommand } from './doc-types';
import type { Category, Document } from './doc-types';
function renderOclifCommand(command: OclifCommand): string[] {
const result = [`## ${ent.encode(command.usage || '')}`];
function renderOclifCommand(command: Category['commands'][0]): string[] {
const result = [`## ${ent.encode(command.name || '')}`];
if (command.aliases?.length) {
result.push('### Aliases');
result.push(command.aliases.map((alias) => `- \`${alias}\``).join('\n'));
result.push(
`\nTo use one of the aliases, replace \`${command.name}\` with the alias.`,
);
}
result.push('### Description');
const description = (command.description || '')
.split('\n')
.slice(1) // remove the first line, which oclif uses as help header
@ -80,7 +88,7 @@ function renderToc(categories: Category[]): string[] {
result.push(
category.commands
.map((command) => {
const signature = capitanoizeOclifUsage(command.usage);
const signature = capitanoizeOclifUsage(command.name);
return `\t- [${ent.encode(signature)}](${getAnchor(signature)})`;
})
.join('\n'),
@ -89,33 +97,7 @@ function renderToc(categories: Category[]): string[] {
return result;
}
const manualCategorySorting: { [category: string]: string[] } = {
'Environment Variables': ['envs', 'env rm', 'env add', 'env rename'],
OS: [
'os versions',
'os download',
'os build config',
'os configure',
'os initialize',
],
};
function sortCommands(doc: Document): void {
for (const category of doc.categories) {
if (category.title in manualCategorySorting) {
category.commands = category.commands.sort(
getManualSortCompareFunction<OclifCommand, string>(
manualCategorySorting[category.title],
(cmd: OclifCommand, x: string) =>
(cmd.usage || '').toString().replace(/\W+/g, ' ').includes(x),
),
);
}
}
}
export function render(doc: Document) {
sortCommands(doc);
const result = [
`# ${doc.title}`,
doc.introduction,

View File

@ -1,215 +0,0 @@
/**
* @license
* Copyright 2019 Balena Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as _ from 'lodash';
import * as semver from 'semver';
import { Octokit } from '@octokit/rest';
import { throttling } from '@octokit/plugin-throttling';
const { GITHUB_TOKEN } = process.env;
/** Return a cached Octokit instance, creating a new one as needed. */
const getOctokit = _.once(function () {
const OctokitConstructor = Octokit.plugin(throttling);
return new OctokitConstructor({
auth: GITHUB_TOKEN,
throttle: {
onRateLimit: (retryAfter: number, options: any) => {
console.warn(
`Request quota exhausted for request ${options.method} ${options.url}`,
);
// retries 3 times
if (options.request.retryCount < 3) {
console.log(`Retrying after ${retryAfter} seconds!`);
return true;
}
},
onAbuseLimit: (_retryAfter: number, options: any) => {
// does not retry, only logs a warning
console.warn(
`Abuse detected for request ${options.method} ${options.url}`,
);
},
},
});
});
/**
* Extract pagination information (current page, total pages, ordinal number)
* from the 'link' response header (example below), using the parse-link-header
* npm package:
* "link": "<https://api.github.com/repositories/187370853/releases?per_page=2&page=2>; rel=\"next\",
* <https://api.github.com/repositories/187370853/releases?per_page=2&page=3>; rel=\"last\""
*
* @param response Octokit response object (including response.headers.link)
* @param perPageDefault Default per_page pagination value if missing in URL
* @return Object where 'page' is the current page number (1-based),
* 'pages' is the total number of pages, and 'ordinal' is the ordinal number
* (3rd, 4th, 5th...) of the first item in the current page.
*/
async function getPageNumbers(
response: any,
perPageDefault: number,
): Promise<{ page: number; pages: number; ordinal: number }> {
const res = { page: 1, pages: 1, ordinal: 1 };
if (!response.headers.link) {
return res;
}
const parse = await import('parse-link-header');
const parsed = parse(response.headers.link);
if (parsed == null) {
throw new Error(`Failed to parse link header: '${response.headers.link}'`);
}
let perPage = perPageDefault;
if (parsed.next) {
if (parsed.next.per_page) {
perPage = parseInt(parsed.next.per_page, 10);
}
res.page = parseInt(parsed.next.page!, 10) - 1;
res.pages = parseInt(parsed.last!.page!, 10);
} else {
if (parsed.prev!.per_page) {
perPage = parseInt(parsed.prev!.per_page, 10);
}
res.page = res.pages = parseInt(parsed.prev!.page!, 10) + 1;
}
res.ordinal = (res.page - 1) * perPage + 1;
return res;
}
/**
* Iterate over every GitHub release in the given owner/repo, check whether
* its tag_name matches against the affectedVersions semver spec, and if so
* replace its release description (body) with the given newDescription value.
* @param owner GitHub repo owner, e.g. 'balena-io' or 'pdcastro'
* @param repo GitHub repo, e.g. 'balena-cli'
* @param affectedVersions Semver spec, e.g. '2.6.1 - 7.10.9 || 8.0.0'
* @param newDescription New release description (body)
* @param editID Short string present in newDescription, e.g. '[AA101]', that
* can be searched to determine whether that release has already been updated.
*/
async function updateGitHubReleaseDescriptions(
owner: string,
repo: string,
affectedVersions: string,
newDescription: string,
editID: string,
) {
const perPage = 30;
const octokit = getOctokit();
const options = octokit.repos.listReleases.endpoint.merge({
owner,
repo,
per_page: perPage,
});
let errCount = 0;
type Release =
import('@octokit/rest').RestEndpointMethodTypes['repos']['listReleases']['response']['data'][0];
for await (const response of octokit.paginate.iterator<Release>(options)) {
const {
page: thisPage,
pages: totalPages,
ordinal,
} = await getPageNumbers(response, perPage);
let i = 0;
for (const cliRelease of response.data) {
const prefix = `[#${ordinal + i++} pg ${thisPage}/${totalPages}]`;
if (!cliRelease.id) {
console.error(
`${prefix} Error: missing release ID (errCount=${++errCount})`,
);
continue;
}
const skipMsg = `${prefix} skipping release "${cliRelease.tag_name}" (${cliRelease.id})`;
if (cliRelease.draft === true) {
console.info(`${skipMsg}: draft release`);
continue;
} else if (cliRelease.body && cliRelease.body.includes(editID)) {
console.info(`${skipMsg}: already updated`);
continue;
} else if (!semver.satisfies(cliRelease.tag_name, affectedVersions)) {
console.info(`${skipMsg}: outside version range`);
continue;
} else {
const updatedRelease = {
owner,
repo,
release_id: cliRelease.id,
body: newDescription,
};
let oldBodyPreview = cliRelease.body;
if (oldBodyPreview) {
oldBodyPreview = oldBodyPreview.replace(/\s+/g, ' ').trim();
if (oldBodyPreview.length > 12) {
oldBodyPreview = oldBodyPreview.substring(0, 9) + '...';
}
}
console.info(
`${prefix} updating release "${cliRelease.tag_name}" (${cliRelease.id}) old body="${oldBodyPreview}"`,
);
try {
await octokit.repos.updateRelease(updatedRelease);
} catch (err) {
console.error(
`${skipMsg}: Error: ${err.message} (count=${++errCount})`,
);
continue;
}
}
}
}
}
/**
* Add a warning description to CLI releases affected by a mixpanel tracking
* security issue (#1359). This function can be executed "manually" with the
* following command line:
*
* npx ts-node --type-check -P automation/tsconfig.json automation/run.ts fix1359
*/
export async function updateDescriptionOfReleasesAffectedByIssue1359() {
// Run only on Linux/Node10, instead of all platform/Node combinations.
// (It could have been any other platform, as long as it only runs once.)
if (process.platform !== 'linux' || semver.major(process.version) !== 10) {
return;
}
const owner = 'balena-io';
const repo = 'balena-cli';
const affectedVersions =
'2.6.1 - 7.10.9 || 8.0.0 - 8.1.0 || 9.0.0 - 9.15.6 || 10.0.0 - 10.17.5 || 11.0.0 - 11.7.2';
const editID = '[AA100]';
let newDescription = `
Please note: the "login" command in this release is affected by a
security issue fixed in versions
[7.10.10](https://github.com/balena-io/balena-cli/releases/tag/v7.10.10),
[8.1.1](https://github.com/balena-io/balena-cli/releases/tag/v8.1.1),
[9.15.7](https://github.com/balena-io/balena-cli/releases/tag/v9.15.7),
[10.17.6](https://github.com/balena-io/balena-cli/releases/tag/v10.17.6),
[11.7.3](https://github.com/balena-io/balena-cli/releases/tag/v11.7.3)
and later. If you need to use this version, avoid passing your password,
keys or tokens as command-line arguments. ${editID}`;
// remove line breaks and collapse white space
newDescription = newDescription.replace(/\s+/g, ' ').trim();
await updateGitHubReleaseDescriptions(
owner,
repo,
affectedVersions,
newDescription,
editID,
);
}

View File

@ -24,7 +24,6 @@ import {
signFilesForNotarization,
testShrinkwrap,
} from './build-bin';
import { updateDescriptionOfReleasesAffectedByIssue1359 } from './deploy-bin';
// DEBUG set to falsy for negative values else is truthy
process.env.DEBUG = ['0', 'no', 'false', '', undefined].includes(
@ -54,7 +53,6 @@ async function parse(args?: string[]) {
'sign:binaries': signFilesForNotarization,
'catch-uncommitted': catchUncommitted,
'test-shrinkwrap': testShrinkwrap,
fix1359: updateDescriptionOfReleasesAffectedByIssue1359,
};
for (const arg of args) {
if (!Object.hasOwn(commands, arg)) {

View File

@ -8,22 +8,23 @@ _balena() {
local context state line curcontext="$curcontext"
# Valid top-level completions
main_commands=( api-key api-keys app block build config deploy device devices env envs fleet fleets internal join key keys leave local login logout logs notes orgs os preload push release releases scan settings ssh support tag tags tunnel util version whoami )
main_commands=( api-key app block build config deploy device devices env fleet internal join leave local login logout notes organization os preload push release settings ssh-key support tag tunnel util version whoami )
# Sub-completions
api_key_cmds=( generate revoke )
api_key_cmds=( generate list revoke )
app_cmds=( create )
block_cmds=( create )
config_cmds=( generate inject read reconfigure write )
device_cmds=( deactivate identify init local-mode move os-update pin public-url purge reboot register rename restart rm shutdown start-service stop-service track-fleet )
device_cmds=( deactivate detect identify init list local-mode logs move os-update pin public-url purge reboot register rename restart rm shutdown ssh start-service stop-service track-fleet )
devices_cmds=( supported )
env_cmds=( add rename rm )
fleet_cmds=( create pin purge rename restart rm track-latest )
env_cmds=( list rename rm set )
fleet_cmds=( create list pin purge rename restart rm track-latest )
internal_cmds=( osinit )
key_cmds=( add rm )
local_cmds=( configure flash )
organization_cmds=( list )
os_cmds=( build-config configure download initialize versions )
release_cmds=( export finalize import invalidate validate )
tag_cmds=( rm set )
release_cmds=( finalize invalidate list validate )
ssh_key_cmds=( add list rm )
tag_cmds=( list rm set )
_arguments -C \
@ -69,18 +70,21 @@ _balena_sec_cmds() {
"internal")
_describe -t internal_cmds 'internal_cmd' internal_cmds "$@" && ret=0
;;
"key")
_describe -t key_cmds 'key_cmd' key_cmds "$@" && ret=0
;;
"local")
_describe -t local_cmds 'local_cmd' local_cmds "$@" && ret=0
;;
"organization")
_describe -t organization_cmds 'organization_cmd' organization_cmds "$@" && ret=0
;;
"os")
_describe -t os_cmds 'os_cmd' os_cmds "$@" && ret=0
;;
"release")
_describe -t release_cmds 'release_cmd' release_cmds "$@" && ret=0
;;
"ssh-key")
_describe -t ssh_key_cmds 'ssh-key_cmd' ssh_key_cmds "$@" && ret=0
;;
"tag")
_describe -t tag_cmds 'tag_cmd' tag_cmds "$@" && ret=0
;;

View File

@ -7,22 +7,23 @@ _balena_complete()
local cur prev
# Valid top-level completions
main_commands="api-key api-keys app block build config deploy device devices env envs fleet fleets internal join key keys leave local login logout logs notes orgs os preload push release releases scan settings ssh support tag tags tunnel util version whoami"
main_commands="api-key app block build config deploy device devices env fleet internal join leave local login logout notes organization os preload push release settings ssh-key support tag tunnel util version whoami"
# Sub-completions
api_key_cmds="generate revoke"
api_key_cmds="generate list revoke"
app_cmds="create"
block_cmds="create"
config_cmds="generate inject read reconfigure write"
device_cmds="deactivate identify init local-mode move os-update pin public-url purge reboot register rename restart rm shutdown start-service stop-service track-fleet"
device_cmds="deactivate detect identify init list local-mode logs move os-update pin public-url purge reboot register rename restart rm shutdown ssh start-service stop-service track-fleet"
devices_cmds="supported"
env_cmds="add rename rm"
fleet_cmds="create pin purge rename restart rm track-latest"
env_cmds="list rename rm set"
fleet_cmds="create list pin purge rename restart rm track-latest"
internal_cmds="osinit"
key_cmds="add rm"
local_cmds="configure flash"
organization_cmds="list"
os_cmds="build-config configure download initialize versions"
release_cmds="export finalize import invalidate validate"
tag_cmds="rm set"
release_cmds="finalize invalidate list validate"
ssh_key_cmds="add list rm"
tag_cmds="list rm set"
@ -63,18 +64,21 @@ _balena_complete()
internal)
COMPREPLY=( $(compgen -W "$internal_cmds" -- $cur) )
;;
key)
COMPREPLY=( $(compgen -W "$key_cmds" -- $cur) )
;;
local)
COMPREPLY=( $(compgen -W "$local_cmds" -- $cur) )
;;
organization)
COMPREPLY=( $(compgen -W "$organization_cmds" -- $cur) )
;;
os)
COMPREPLY=( $(compgen -W "$os_cmds" -- $cur) )
;;
release)
COMPREPLY=( $(compgen -W "$release_cmds" -- $cur) )
;;
ssh-key)
COMPREPLY=( $(compgen -W "$ssh_key_cmds" -- $cur) )
;;
tag)
COMPREPLY=( $(compgen -W "$tag_cmds" -- $cur) )
;;

File diff suppressed because it is too large Load Diff

1293
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "balena-cli",
"version": "19.0.3",
"version": "19.13.1",
"description": "The official balena Command Line Interface",
"main": "./build/app.js",
"homepage": "https://github.com/balena-io/balena-cli",
@ -99,7 +99,7 @@
"helpClass": "./build/help",
"topicSeparator": " ",
"hooks": {
"prerun": "./build/hooks/prerun/track",
"prerun": "./build/hooks/prerun",
"command_not_found": "./build/hooks/command-not-found/suggest"
},
"additionalHelpFlags": [
@ -113,8 +113,6 @@
"devDependencies": {
"@balena/lint": "^8.0.0",
"@electron/notarize": "^2.0.0",
"@octokit/plugin-throttling": "^3.5.1",
"@octokit/rest": "^18.6.7",
"@types/archiver": "^6.0.2",
"@types/bluebird": "^3.5.36",
"@types/body-parser": "^1.19.2",
@ -138,14 +136,13 @@
"@types/jsonwebtoken": "^9.0.6",
"@types/klaw": "^3.0.6",
"@types/lodash": "^4.14.178",
"@types/mixpanel": "^2.14.3",
"@types/mime": "^3.0.4",
"@types/mocha": "^10.0.7",
"@types/mock-fs": "^4.13.4",
"@types/mock-require": "^2.0.1",
"@types/moment-duration-format": "^2.2.3",
"@types/ndjson": "^2.0.1",
"@types/node": "^20.0.0",
"@types/node-cleanup": "^2.1.2",
"@types/parse-link-header": "^2.0.3",
"@types/prettyjson": "^0.0.33",
"@types/progress-stream": "^2.0.2",
"@types/request": "^2.48.7",
@ -179,41 +176,37 @@
"intercept-stdout": "^0.1.2",
"jsonwebtoken": "^9.0.0",
"klaw": "^4.1.0",
"mkdirp": "^3.0.1",
"mocha": "^10.6.0",
"mock-fs": "^5.2.0",
"mock-require": "^3.0.3",
"nock": "^13.2.1",
"oclif": "^4.14.0",
"parse-link-header": "^2.0.0",
"rewire": "^7.0.0",
"simple-git": "^3.14.1",
"sinon": "^18.0.0",
"sinon": "^19.0.0",
"string-to-stream": "^3.0.1",
"ts-node": "^10.4.0",
"typescript": "^5.5.2"
"typescript": "^5.6.2"
},
"dependencies": {
"@balena/compose": "^4.0.1",
"@balena/dockerignore": "^1.0.2",
"@balena/env-parsing": "^1.1.8",
"@balena/es-version": "^1.0.1",
"@balena/release-bundle": "^0.5.2",
"@oclif/core": "^4.0.8",
"@resin.io/valid-email": "^0.1.0",
"@oclif/core": "^4.0.25",
"@sentry/node": "^6.16.1",
"balena-config-json": "^4.2.0",
"balena-device-init": "^7.0.1",
"balena-errors": "^4.7.3",
"balena-image-fs": "^7.0.6",
"balena-image-manager": "^10.0.1",
"balena-preload": "^15.0.6",
"balena-sdk": "^19.7.3",
"balena-semver": "^2.3.0",
"balena-settings-client": "^5.0.2",
"balena-settings-storage": "^8.1.0",
"bluebird": "^3.7.2",
"body-parser": "^1.19.1",
"bonjour-service": "^1.2.1",
"chalk": "^3.0.0",
"chalk": "^4.0.0",
"chokidar": "^3.5.2",
"cli-truncate": "^2.1.0",
"color-hash": "^1.1.1",
@ -228,7 +221,6 @@
"fast-boot2": "^1.1.0",
"fast-levenshtein": "^3.0.0",
"filenamify": "^4.3.0",
"get-stdin": "^8.0.0",
"glob": "^7.2.0",
"global-agent": "^2.2.0",
"global-tunnel-ng": "^2.1.1",
@ -241,8 +233,8 @@
"JSONStream": "^1.0.3",
"livepush": "^3.5.1",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"moment-duration-format": "^2.3.2",
"mime": "^2.4.6",
"mkdirp": "^3.0.1",
"ndjson": "^2.0.0",
"node-cleanup": "^2.1.2",
"node-unzip-2": "^0.2.8",
@ -253,7 +245,7 @@
"reconfix": "^1.0.0-v0-1-0-fork-46760acff4d165f5238bfac5e464256ef1944476",
"request": "^2.88.2",
"resin-cli-form": "^3.0.0",
"resin-cli-visuals": "^2.0.0",
"resin-cli-visuals": "^2.0.1",
"resin-doodles": "^0.2.0",
"resin-stream-logger": "^0.1.2",
"rimraf": "^3.0.2",
@ -281,6 +273,6 @@
}
},
"versionist": {
"publishedAt": "2024-09-05T12:34:09.871Z"
"publishedAt": "2024-10-21T19:13:32.213Z"
}
}

View File

@ -153,7 +153,7 @@ async function oclifRun(command: string[], options: AppOptions) {
}
})(!options.noFlush);
const { trackPromise } = await import('./hooks/prerun/track');
const { trackPromise } = await import('./hooks/prerun');
await Promise.all([trackPromise, deprecationPromise, runPromise]);
}

View File

@ -1,170 +0,0 @@
/**
* @license
* Copyright 2020 Balena Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Command } from '@oclif/core';
import {
InsufficientPrivilegesError,
NotAvailableInOfflineModeError,
} from './errors';
import { stripIndent } from './utils/lazy';
export default abstract class BalenaCommand extends Command {
/**
* When set to true, command will be listed in `help`,
* otherwise listed in `help --verbose` with secondary commands.
*/
public static primary = false;
/**
* Require elevated privileges to run.
* When set to true, command will exit with an error
* if executed without root on Mac/Linux
* or if executed by non-Administrator on Windows.
*/
public static root = false;
/**
* Require authentication to run.
* When set to true, command will exit with an error
* if user is not already logged in.
*/
public static authenticated = false;
/**
* Require an internet connection to run.
* When set to true, command will exit with an error
* if user is running in offline mode (BALENARC_OFFLINE_MODE).
*/
public static offlineCompatible = false;
/**
* Accept piped input.
* When set to true, command will read from stdin during init
* and make contents available on member `stdin`.
*/
public static readStdin = false;
public stdin: string;
/**
* Throw InsufficientPrivilegesError if not root on Mac/Linux
* or non-Administrator on Windows.
*
* Called automatically if `root=true`.
* Can be called explicitly by command implementation, if e.g.:
* - check should only be done conditionally
* - other code needs to execute before check
*/
protected static async checkElevatedPrivileges() {
const isElevated = await (await import('is-elevated'))();
if (!isElevated) {
throw new InsufficientPrivilegesError(
'You need root/admin privileges to run this command',
);
}
}
/**
* Throw NotLoggedInError if not logged in.
*
* Called automatically if `authenticated=true`.
* Can be called explicitly by command implementation, if e.g.:
* - check should only be done conditionally
* - other code needs to execute before check
*
* Note, currently public to allow use outside of derived commands
* (as some command implementations require this. Can be made protected
* if this changes).
*
* @throws {NotLoggedInError}
*/
public static async checkLoggedIn() {
await (await import('./utils/patterns')).checkLoggedIn();
}
/**
* Throw NotLoggedInError if not logged in when condition true.
*
* @param {boolean} doCheck - will check if true.
* @throws {NotLoggedInError}
*/
public static async checkLoggedInIf(doCheck: boolean) {
if (doCheck) {
await this.checkLoggedIn();
}
}
/**
* Throw NotAvailableInOfflineModeError if in offline mode.
*
* Called automatically if `onlineOnly=true`.
* Can be called explicitly by command implementation, if e.g.:
* - check should only be done conditionally
* - other code needs to execute before check
*
* Note, currently public to allow use outside of derived commands
* (as some command implementations require this. Can be made protected
* if this changes).
*
* @throws {NotAvailableInOfflineModeError}
*/
public static checkNotUsingOfflineMode() {
if (process.env.BALENARC_OFFLINE_MODE) {
throw new NotAvailableInOfflineModeError(stripIndent`
This command requires an internet connection, and cannot be used in offline mode.
To leave offline mode, unset the BALENARC_OFFLINE_MODE environment variable.
`);
}
}
/**
* Read stdin contents and make available to command.
*
* This approach could be improved in the future to automatically set argument
* values from stdin based in configuration, minimising command implementation.
*/
protected async getStdin() {
this.stdin = await (await import('get-stdin'))();
}
/**
* Get a logger instance.
*/
protected static async getLogger() {
return (await import('./utils/logger')).getLogger();
}
protected async init() {
const ctr = this.constructor as typeof BalenaCommand;
if (ctr.root) {
await BalenaCommand.checkElevatedPrivileges();
}
if (ctr.authenticated) {
await BalenaCommand.checkLoggedIn();
}
if (!ctr.offlineCompatible) {
BalenaCommand.checkNotUsingOfflineMode();
}
if (ctr.readStdin) {
await this.getStdin();
}
}
}

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -40,8 +39,6 @@ export default class GenerateCmd extends Command {
}),
};
public static usage = 'api-key generate <name>';
public static flags = {
help: cf.help,
};

View File

@ -15,12 +15,13 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import Command from '../../command';
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
export default class ApiKeysCmd extends Command {
export default class APIKeyListCmd extends Command {
public static aliases = ['api-keys'];
public static description = stripIndent`
Print a list of balenaCloud API keys.
@ -28,9 +29,7 @@ export default class ApiKeysCmd extends Command {
Print a list of balenaCloud API keys for the current user or for a specific fleet with the \`--fleet\` option.
`;
public static examples = ['$ balena api-keys'];
public static usage = 'api-keys';
public static examples = ['$ balena api-key list'];
public static flags = {
help: cf.help,
@ -44,7 +43,7 @@ export default class ApiKeysCmd extends Command {
public static authenticated = true;
public async run() {
const { flags: options } = await this.parse(ApiKeysCmd);
const { flags: options } = await this.parse(APIKeyListCmd);
const { getApplication } = await import('../../utils/sdk');
const actorId = options.fleet

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -41,8 +40,6 @@ export default class RevokeCmd extends Command {
}),
};
public static usage = 'api-key revoke <ids>';
public static flags = {
help: cf.help,
};

View File

@ -15,9 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { stripIndent } from '../../utils/lazy';
@ -30,7 +28,7 @@ export default class AppCreateCmd extends Command {
You can specify the organization the app should belong to using
the \`--organization\` option. The organization's handle, not its name,
should be provided. Organization handles can be listed with the
\`balena orgs\` command.
\`balena organization list\` command.
The app's default device type is specified with the \`--type\` option.
The \`balena devices supported\` command can be used to list the available
@ -56,8 +54,6 @@ export default class AppCreateCmd extends Command {
}),
};
public static usage = 'app create <name>';
public static flags = {
organization: Flags.string({
char: 'o',

View File

@ -15,9 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { stripIndent } from '../../utils/lazy';
@ -30,7 +28,7 @@ export default class BlockCreateCmd extends Command {
You can specify the organization the block should belong to using
the \`--organization\` option. The organization's handle, not its name,
should be provided. Organization handles can be listed with the
\`balena orgs\` command.
\`balena organization list\` command.
The block's default device type is specified with the \`--type\` option.
The \`balena devices supported\` command can be used to list the available
@ -56,8 +54,6 @@ export default class BlockCreateCmd extends Command {
}),
};
public static usage = 'block create <name>';
public static flags = {
organization: Flags.string({
char: 'o',

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args, Flags } from '@oclif/core';
import Command from '../../command';
import { Args, Flags, Command } from '@oclif/core';
import { getBalenaSdk } from '../../utils/lazy';
import * as cf from '../../utils/common-flags';
import * as compose from '../../utils/compose';
@ -84,8 +83,6 @@ ${dockerignoreHelp}
source: Args.string({ description: 'path of project source directory' }),
};
public static usage = 'build [source]';
public static flags = {
arch: Flags.string({
description: 'the architecture to build for',
@ -108,13 +105,16 @@ ${dockerignoreHelp}
public async run() {
const { args: params, flags: options } = await this.parse(BuildCmd);
await Command.checkLoggedInIf(!!options.fleet);
const Logger = await import('../../utils/logger');
const { checkLoggedInIf } = await import('../../utils/patterns');
await checkLoggedInIf(!!options.fleet);
(await import('events')).defaultMaxListeners = 1000;
const sdk = getBalenaSdk();
const logger = await Command.getLogger();
const logger = Logger.getLogger();
logger.logDebug('Parsing input...');
// `build` accepts `source` as a parameter, but compose expects it as an option

View File

@ -15,9 +15,8 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import { Flags, Command } from '@oclif/core';
import type { Interfaces } from '@oclif/core';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getCliForm, stripIndent } from '../../utils/lazy';
import {
@ -60,8 +59,6 @@ export default class ConfigGenerateCmd extends Command {
'$ balena config generate --fleet myorg/fleet --version 2.12.7 --network wifi --wifiSsid mySsid --wifiKey abcdefgh --appUpdatePollInterval 15',
];
public static usage = 'config generate';
public static flags = {
version: Flags.string({
description: 'a balenaOS version',

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getVisuals, stripIndent } from '../../utils/lazy';
@ -43,8 +42,6 @@ export default class ConfigInjectCmd extends Command {
}),
};
public static usage = 'config inject <file>';
public static flags = {
drive: cf.driveOrImg,
help: cf.help,

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getVisuals, stripIndent } from '../../utils/lazy';
@ -36,8 +36,6 @@ export default class ConfigReadCmd extends Command {
'$ balena config read --drive balena.img',
];
public static usage = 'config read';
public static flags = {
drive: cf.driveOrImg,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import Command from '../../command';
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getVisuals, stripIndent } from '../../utils/lazy';
@ -39,8 +38,6 @@ export default class ConfigReconfigureCmd extends Command {
'$ balena config reconfigure --drive balena.img --advanced',
];
public static usage = 'config reconfigure';
public static flags = {
drive: cf.driveOrImg,
advanced: Flags.boolean({

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getVisuals, stripIndent } from '../../utils/lazy';
@ -48,8 +47,6 @@ export default class ConfigWriteCmd extends Command {
}),
};
public static usage = 'config write <key> <value>';
public static flags = {
drive: cf.driveOrImg,
help: cf.help,

View File

@ -15,10 +15,8 @@
* limitations under the License.
*/
import { Args, Flags } from '@oclif/core';
import { Args, Flags, Command } from '@oclif/core';
import type { ImageDescriptor } from '@balena/compose/dist/parse';
import Command from '../../command';
import { ExpectedError } from '../../errors';
import { getBalenaSdk, getChalk, stripIndent } from '../../utils/lazy';
import {
@ -108,8 +106,6 @@ ${dockerignoreHelp}
image: Args.string({ description: 'the image to deploy' }),
};
public static usage = 'deploy <fleet> [image]';
public static flags = {
source: Flags.string({
description:
@ -157,7 +153,9 @@ ${dockerignoreHelp}
(await import('events')).defaultMaxListeners = 1000;
const logger = await Command.getLogger();
const Logger = await import('../../utils/logger');
const logger = Logger.getLogger();
logger.logDebug('Parsing input...');
const { fleet, image } = params;

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -41,8 +40,6 @@ export default class DeviceDeactivateCmd extends Command {
}),
};
public static usage = 'device deactivate <uuid>';
public static flags = {
yes: cf.yes,
help: cf.help,

View File

@ -15,12 +15,13 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import Command from '../../command';
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getCliUx, stripIndent } from '../../utils/lazy';
export default class ScanCmd extends Command {
export default class DeviceDetectCmd extends Command {
public static aliases = ['scan'];
public static description = stripIndent`
Scan for balenaOS devices on your local network.
@ -33,13 +34,11 @@ export default class ScanCmd extends Command {
`;
public static examples = [
'$ balena scan',
'$ balena scan --timeout 120',
'$ balena scan --verbose',
'$ balena device detect',
'$ balena device detect --timeout 120',
'$ balena device detect --verbose',
];
public static usage = 'scan';
public static flags = {
verbose: Flags.boolean({
default: false,
@ -73,7 +72,7 @@ export default class ScanCmd extends Command {
const dockerPort = 2375;
const dockerTimeout = 2000;
const { flags: options } = await this.parse(ScanCmd);
const { flags: options } = await this.parse(DeviceDetectCmd);
const discoverTimeout =
options.timeout != null ? options.timeout * 1000 : undefined;
@ -147,10 +146,10 @@ export default class ScanCmd extends Command {
if (!options.verbose) {
devicesInfo.forEach((d: any) => {
d.dockerInfo = _.isObject(d.dockerInfo)
? _.pick(d.dockerInfo, ScanCmd.dockerInfoProperties)
? _.pick(d.dockerInfo, DeviceDetectCmd.dockerInfoProperties)
: d.dockerInfo;
d.dockerVersion = _.isObject(d.dockerVersion)
? _.pick(d.dockerVersion, ScanCmd.dockerVersionProperties)
? _.pick(d.dockerVersion, DeviceDetectCmd.dockerVersionProperties)
: d.dockerVersion;
});
}
@ -167,8 +166,9 @@ export default class ScanCmd extends Command {
if (!options.json && cmdOutput.length === 0) {
console.error(
process.platform === 'win32'
? ScanCmd.noDevicesFoundMessage + ScanCmd.windowsTipMessage
: ScanCmd.noDevicesFoundMessage,
? DeviceDetectCmd.noDevicesFoundMessage +
DeviceDetectCmd.windowsTipMessage
: DeviceDetectCmd.noDevicesFoundMessage,
);
return;
}
@ -200,11 +200,11 @@ export default class ScanCmd extends Command {
protected static windowsTipMessage = `
Note for Windows users:
The 'scan' command relies on the Bonjour service. Check whether Bonjour is
The 'device detect' command relies on the Bonjour service. Check whether Bonjour is
installed (Control Panel > Programs and Features). If not, you can download
Bonjour for Windows (included with Bonjour Print Services) from here:
https://support.apple.com/kb/DL999
After installing Bonjour, restart your PC and run the 'balena scan' command
After installing Bonjour, restart your PC and run the 'balena device detect' command
again.`;
}

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { ExpectedError } from '../../errors';
@ -36,8 +35,6 @@ export default class DeviceIdentifyCmd extends Command {
}),
};
public static usage = 'device identify <uuid>';
public static flags = {
help: cf.help,
};

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { expandForAppName } from '../../utils/helpers';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
@ -62,8 +61,6 @@ export default class DeviceCmd extends Command {
}),
};
public static usage = 'device <uuid>';
public static flags = {
json: cf.json,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import Command from '../../command';
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
@ -43,17 +42,17 @@ export default class DeviceInitCmd extends Command {
This command effectively combines several other balena CLI commands in one,
namely:
'balena device register'
'balena os download'
'balena os build-config' or 'balena config generate'
'balena os configure'
'balena device register'
'balena os download'
'balena os build-config' or 'balena config generate'
'balena os configure'
'balena os local flash'
Possible arguments for the '--fleet', '--os-version' and '--drive' options can
be listed respectively with the commands:
'balena fleets'
'balena os versions'
'balena fleet list'
'balena os versions'
'balena util available-drives'
If the '--fleet' or '--drive' options are omitted, interactive menus will be
@ -74,8 +73,6 @@ export default class DeviceInitCmd extends Command {
'$ balena device init --fleet myFleet --os-version 2.83.21+rev1.prod --drive /dev/disk5 --config config.json --yes',
];
public static usage = 'device init';
public static flags = {
fleet: cf.fleet,
yes: cf.yes,
@ -119,8 +116,9 @@ export default class DeviceInitCmd extends Command {
tmp.setGracefulCleanup();
const { downloadOSImage } = await import('../../utils/cloud');
const { getApplication } = await import('../../utils/sdk');
const Logger = await import('../../utils/logger');
const logger = await Command.getLogger();
const logger = Logger.getLogger();
const balena = getBalenaSdk();
// Get application and

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { expandForAppName } from '../../utils/helpers';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
@ -35,7 +35,9 @@ const devicesSelectFields = {
],
} satisfies PineOptions<Device>;
export default class DevicesCmd extends Command {
export default class DeviceListCmd extends Command {
public static aliases = ['devices'];
public static description = stripIndent`
List all devices.
@ -48,13 +50,11 @@ export default class DevicesCmd extends Command {
${jsonInfo.split('\n').join('\n\t\t')}
`;
public static examples = [
'$ balena devices',
'$ balena devices --fleet MyFleet',
'$ balena devices -f myorg/myfleet',
'$ balena device list',
'$ balena device list --fleet MyFleet',
'$ balena device list -f myorg/myfleet',
];
public static usage = 'devices';
public static flags = {
fleet: cf.fleet,
json: cf.json,
@ -66,7 +66,7 @@ export default class DevicesCmd extends Command {
public static authenticated = true;
public async run() {
const { flags: options } = await this.parse(DevicesCmd);
const { flags: options } = await this.parse(DeviceListCmd);
const balena = getBalenaSdk();
const devicesOptions = {

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -42,8 +41,6 @@ export default class DeviceLocalModeCmd extends Command {
}),
};
public static usage = 'device local-mode <uuid>';
public static flags = {
enable: Flags.boolean({
description: 'enable local mode',

View File

@ -15,15 +15,16 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import type { LogMessage } from 'balena-sdk';
const MAX_RETRY = 1000;
export default class LogsCmd extends Command {
export default class DeviceLogsCmd extends Command {
public static aliases = ['logs'];
public static description = stripIndent`
Show device logs.
@ -43,15 +44,15 @@ export default class LogsCmd extends Command {
Note: --service and --system flags must come after the device parameter, as per examples.
`;
public static examples = [
'$ balena logs 23c73a1',
'$ balena logs 23c73a1 --tail',
'$ balena device logs 23c73a1',
'$ balena device logs 23c73a1 --tail',
'',
'$ balena logs 192.168.0.31',
'$ balena logs 192.168.0.31 --service my-service',
'$ balena logs 192.168.0.31 --service my-service-1 --service my-service-2',
'$ balena device logs 192.168.0.31',
'$ balena device logs 192.168.0.31 --service my-service',
'$ balena device logs 192.168.0.31 --service my-service-1 --service my-service-2',
'',
'$ balena logs 23c73a1.local --system',
'$ balena logs 23c73a1.local --system --service my-service',
'$ balena device logs 23c73a1.local --system',
'$ balena device logs 23c73a1.local --system --service my-service',
];
public static args = {
@ -61,8 +62,6 @@ export default class LogsCmd extends Command {
}),
};
public static usage = 'logs <device>';
public static flags = {
'max-retry': Flags.integer({
description: stripIndent`
@ -93,7 +92,7 @@ export default class LogsCmd extends Command {
public static primary = true;
public async run() {
const { args: params, flags: options } = await this.parse(LogsCmd);
const { args: params, flags: options } = await this.parse(DeviceLogsCmd);
const balena = getBalenaSdk();
const { serviceIdToName } = await import('../../utils/cloud');
@ -153,8 +152,9 @@ export default class LogsCmd extends Command {
maxAttempts: 1 + (options['max-retry'] ?? MAX_RETRY),
});
} else {
const { checkLoggedIn } = await import('../../utils/patterns');
// Logs from cloud
await Command.checkLoggedIn();
await checkLoggedIn();
if (options.tail) {
const logStream = await balena.logs.subscribe(params.device, {
count: 100,

View File

@ -15,14 +15,13 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import { Args, Command } from '@oclif/core';
import type {
BalenaSDK,
Device,
PineOptions,
PineTypedResult,
} from 'balena-sdk';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { ExpectedError } from '../../errors';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -54,8 +53,6 @@ export default class DeviceMoveCmd extends Command {
}),
};
public static usage = 'device move <uuid(s)>';
public static flags = {
fleet: cf.fleet,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
import type { Device } from 'balena-sdk';
@ -47,8 +46,6 @@ export default class DeviceOsUpdateCmd extends Command {
}),
};
public static usage = 'device os-update <uuid>';
public static flags = {
version: Flags.string({
description: 'a balenaOS version',

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getExpandedProp } from '../../utils/pine';
@ -44,8 +43,6 @@ export default class DevicePinCmd extends Command {
}),
};
public static usage = 'device pin <uuid> [releaseToPinTo]';
public static flags = {
help: cf.help,
};
@ -82,7 +79,7 @@ export default class DevicePinCmd extends Command {
pinnedRelease
? `This device is currently pinned to ${pinnedRelease}.`
: 'This device is not currently pinned to any release.'
} \n\nTo see a list of all releases this device can be pinned to, run \`balena releases ${appSlug}\`.`,
} \n\nTo see a list of all releases this device can be pinned to, run \`balena release list ${appSlug}\`.`,
);
} else {
await balena.models.device.pinToRelease(params.uuid, releaseToPinTo);

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -44,8 +43,6 @@ export default class DevicePublicUrlCmd extends Command {
}),
};
public static usage = 'device public-url <uuid>';
public static flags = {
enable: Flags.boolean({
description: 'enable the public URL',

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy';
@ -35,8 +34,6 @@ export default class DevicePurgeCmd extends Command {
'$ balena device purge 55d43b3,23c73a1',
];
public static usage = 'device purge <uuid>';
public static args = {
uuid: Args.string({
description: 'comma-separated list (no blank spaces) of device UUIDs',

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -35,8 +34,6 @@ export default class DeviceRebootCmd extends Command {
}),
};
public static usage = 'device reboot <uuid>';
public static flags = {
force: cf.force,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import Command from '../../command';
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -44,8 +43,6 @@ export default class DeviceRegisterCmd extends Command {
fleet: ca.fleetRequired,
};
public static usage = 'device register <fleet>';
public static flags = {
uuid: Flags.string({
description: 'custom uuid',

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
@ -43,8 +42,6 @@ export default class DeviceRenameCmd extends Command {
}),
};
public static usage = 'device rename <uuid> [newName]';
public static flags = {
help: cf.help,
};

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy';
import type {
@ -53,8 +52,6 @@ export default class DeviceRestartCmd extends Command {
}),
};
public static usage = 'device restart <uuid>';
public static flags = {
service: Flags.string({
description:

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -43,8 +42,6 @@ export default class DeviceRmCmd extends Command {
}),
};
public static usage = 'device rm <uuid(s)>';
public static flags = {
yes: cf.yes,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { ExpectedError } from '../../errors';
@ -36,8 +35,6 @@ export default class DeviceShutdownCmd extends Command {
}),
};
public static usage = 'device shutdown <uuid>';
public static flags = {
force: cf.force,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import {
@ -24,7 +23,9 @@ import {
validateLocalHostnameOrIp,
} from '../../utils/validation';
export default class SshCmd extends Command {
export default class DeviceSSHCmd extends Command {
public static aliases = ['ssh'];
public static description = stripIndent`
Open a SSH prompt on a device's host OS or service container.
@ -53,14 +54,14 @@ export default class SshCmd extends Command {
`;
public static examples = [
'$ balena ssh MyFleet',
'$ balena ssh f49cefd',
'$ balena ssh f49cefd my-service',
'$ balena ssh f49cefd --port <port>',
'$ balena ssh 192.168.0.1 --verbose',
'$ balena ssh f49cefd.local my-service',
'$ echo "uptime; exit;" | balena ssh f49cefd',
'$ echo "uptime; exit;" | balena ssh 192.168.0.1 myService',
'$ balena device ssh MyFleet',
'$ balena device ssh f49cefd',
'$ balena device ssh f49cefd my-service',
'$ balena device ssh f49cefd --port <port>',
'$ balena device ssh 192.168.0.1 --verbose',
'$ balena device ssh f49cefd.local my-service',
'$ echo "uptime; exit;" | balena device ssh f49cefd',
'$ echo "uptime; exit;" | balena device ssh 192.168.0.1 myService',
];
public static args = {
@ -75,8 +76,6 @@ export default class SshCmd extends Command {
}),
};
public static usage = 'ssh <fleetOrDevice> [service]';
public static flags = {
port: Flags.integer({
description: stripIndent`
@ -107,7 +106,7 @@ export default class SshCmd extends Command {
public static offlineCompatible = true;
public async run() {
const { args: params, flags: options } = await this.parse(SshCmd);
const { args: params, flags: options } = await this.parse(DeviceSSHCmd);
// Local connection
if (validateLocalHostnameOrIp(params.fleetOrDevice)) {
@ -123,15 +122,19 @@ export default class SshCmd extends Command {
// Remote connection
const { getProxyConfig } = await import('../../utils/helpers');
const { getOnlineTargetDeviceUuid } = await import('../../utils/patterns');
const {
getOnlineTargetDeviceUuid,
checkLoggedIn,
checkNotUsingOfflineMode,
} = await import('../../utils/patterns');
const sdk = getBalenaSdk();
const proxyConfig = getProxyConfig();
const useProxy = !!proxyConfig && !options.noproxy;
// this will be a tunnelled SSH connection...
await Command.checkNotUsingOfflineMode();
await Command.checkLoggedIn();
await checkNotUsingOfflineMode();
await checkLoggedIn();
const deviceUuid = await getOnlineTargetDeviceUuid(
sdk,
params.fleetOrDevice,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy';
import type { BalenaSDK } from 'balena-sdk';
@ -46,8 +45,6 @@ export default class DeviceStartServiceCmd extends Command {
}),
};
public static usage = 'device start-service <uuid>';
public static flags = {
help: cf.help,
};

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy';
import type { BalenaSDK } from 'balena-sdk';
@ -46,8 +45,6 @@ export default class DeviceStopServiceCmd extends Command {
}),
};
public static usage = 'device stop-service <uuid>';
public static flags = {
help: cf.help,
};

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -35,8 +34,6 @@ export default class DeviceTrackFleetCmd extends Command {
}),
};
public static usage = 'device track-fleet <uuid>';
public static flags = {
help: cf.help,
};

View File

@ -14,14 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import { Flags, Command } from '@oclif/core';
import type * as BalenaSdk from 'balena-sdk';
import * as _ from 'lodash';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { CommandHelp } from '../../utils/oclif-utils';
export default class DevicesSupportedCmd extends Command {
public static description = stripIndent`
@ -40,11 +37,6 @@ export default class DevicesSupportedCmd extends Command {
'$ balena devices supported --json',
];
public static usage = (
'devices supported ' +
new CommandHelp({ args: DevicesSupportedCmd.args }).defaultUsage()
).trim();
public static flags = {
help: cf.help,
json: Flags.boolean({

View File

@ -14,17 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import { Flags, Command } from '@oclif/core';
import type { Interfaces } from '@oclif/core';
import type * as SDK from 'balena-sdk';
import * as _ from 'lodash';
import Command from '../../command';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
type FlagsDef = Interfaces.InferredFlags<typeof EnvsCmd.flags>;
type FlagsDef = Interfaces.InferredFlags<typeof EnvListCmd.flags>;
interface EnvironmentVariableInfo extends SDK.EnvironmentVariableBase {
fleet?: string | null; // fleet slug
@ -46,7 +45,9 @@ interface ServiceEnvironmentVariableInfo
serviceName?: string; // service name
}
export default class EnvsCmd extends Command {
export default class EnvListCmd extends Command {
public static aliases = ['envs'];
public static description = stripIndent`
List the environment or config variables of a fleet, device or service.
@ -84,18 +85,16 @@ export default class EnvsCmd extends Command {
`;
public static examples = [
'$ balena envs --fleet myorg/myfleet',
'$ balena envs --fleet MyFleet --json',
'$ balena envs --fleet MyFleet --service MyService',
'$ balena envs --fleet MyFleet --config',
'$ balena envs --device 7cf02a6',
'$ balena envs --device 7cf02a6 --json',
'$ balena envs --device 7cf02a6 --config --json',
'$ balena envs --device 7cf02a6 --service MyService',
'$ balena env list --fleet myorg/myfleet',
'$ balena env list --fleet MyFleet --json',
'$ balena env list --fleet MyFleet --service MyService',
'$ balena env list --fleet MyFleet --config',
'$ balena env list --device 7cf02a6',
'$ balena env list --device 7cf02a6 --json',
'$ balena env list --device 7cf02a6 --config --json',
'$ balena env list --device 7cf02a6 --service MyService',
];
public static usage = 'envs';
public static flags = {
fleet: { ...cf.fleet, exclusive: ['device'] },
config: Flags.boolean({
@ -111,11 +110,13 @@ export default class EnvsCmd extends Command {
};
public async run() {
const { flags: options } = await this.parse(EnvsCmd);
const { flags: options } = await this.parse(EnvListCmd);
const variables: EnvironmentVariableInfo[] = [];
await Command.checkLoggedIn();
const { checkLoggedIn } = await import('../../utils/patterns');
await checkLoggedIn();
if (!options.fleet && !options.device) {
throw new ExpectedError('Missing --fleet or --device option');

View File

@ -14,9 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import * as ec from '../../utils/env-common';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -53,8 +51,6 @@ export default class EnvRenameCmd extends Command {
}),
};
public static usage = 'env rename <id> <value>';
public static flags = {
config: ec.booleanConfig,
device: ec.booleanDevice,
@ -65,7 +61,9 @@ export default class EnvRenameCmd extends Command {
public async run() {
const { args: params, flags: opt } = await this.parse(EnvRenameCmd);
await Command.checkLoggedIn();
const { checkLoggedIn } = await import('../../utils/patterns');
await checkLoggedIn();
await getBalenaSdk().pine.patch({
resource: ec.getVarResourceName(opt.config, opt.device, opt.service),

View File

@ -15,9 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as ec from '../../utils/env-common';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { parseAsInteger } from '../../utils/validation';
@ -52,8 +50,6 @@ export default class EnvRmCmd extends Command {
}),
};
public static usage = 'env rm <id>';
public static flags = {
config: ec.booleanConfig,
device: ec.booleanDevice,
@ -69,7 +65,9 @@ export default class EnvRmCmd extends Command {
public async run() {
const { args: params, flags: opt } = await this.parse(EnvRmCmd);
await Command.checkLoggedIn();
const { checkLoggedIn } = await import('../../utils/patterns');
await checkLoggedIn();
const { confirm } = await import('../../utils/patterns');
await confirm(

View File

@ -15,9 +15,8 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import { Args, Command } from '@oclif/core';
import type * as BalenaSdk from 'balena-sdk';
import Command from '../../command';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -36,11 +35,13 @@ interface ArgsDef {
value?: string;
}
export default class EnvAddCmd extends Command {
public static description = stripIndent`
Add env or config variable to fleets, devices or services.
export default class EnvSetCmd extends Command {
public static aliases = ['env add'];
Add an environment or config variable to one or more fleets, devices or
public static description = stripIndent`
Add or update env or config variable to fleets, devices or services.
Add or update an environment or config variable to one or more fleets, devices or
services, as selected by the respective command-line options. Either the
--fleet or the --device option must be provided, and either may be be
used alongside the --service option to define a service-specific variable.
@ -67,15 +68,15 @@ export default class EnvAddCmd extends Command {
`;
public static examples = [
'$ balena env add TERM --fleet MyFleet',
'$ balena env add EDITOR vim -f myorg/myfleet',
'$ balena env add EDITOR vim --fleet MyFleet,MyFleet2',
'$ balena env add EDITOR vim --fleet MyFleet --service MyService',
'$ balena env add EDITOR vim --fleet MyFleet,MyFleet2 --service MyService,MyService2',
'$ balena env add EDITOR vim --device 7cf02a6',
'$ balena env add EDITOR vim --device 7cf02a6,d6f1433',
'$ balena env add EDITOR vim --device 7cf02a6 --service MyService',
'$ balena env add EDITOR vim --device 7cf02a6,d6f1433 --service MyService,MyService2',
'$ balena env set TERM --fleet MyFleet',
'$ balena env set EDITOR vim -f myorg/myfleet',
'$ balena env set EDITOR vim --fleet MyFleet,MyFleet2',
'$ balena env set EDITOR vim --fleet MyFleet --service MyService',
'$ balena env set EDITOR vim --fleet MyFleet,MyFleet2 --service MyService,MyService2',
'$ balena env set EDITOR vim --device 7cf02a6',
'$ balena env set EDITOR vim --device 7cf02a6,d6f1433',
'$ balena env set EDITOR vim --device 7cf02a6 --service MyService',
'$ balena env set EDITOR vim --device 7cf02a6,d6f1433 --service MyService,MyService2',
];
public static args = {
@ -92,7 +93,6 @@ export default class EnvAddCmd extends Command {
// Required for supporting empty string ('') `value` args.
public static strict = false;
public static usage = 'env add <name> [value]';
public static flags = {
fleet: { ...cf.fleet, exclusive: ['device'] },
@ -103,7 +103,7 @@ export default class EnvAddCmd extends Command {
};
public async run() {
const { args: params, flags: options } = await this.parse(EnvAddCmd);
const { args: params, flags: options } = await this.parse(EnvSetCmd);
const cmd = this;
if (!options.fleet && !options.device) {
@ -112,7 +112,9 @@ export default class EnvAddCmd extends Command {
);
}
await Command.checkLoggedIn();
const { checkLoggedIn } = await import('../../utils/patterns');
await checkLoggedIn();
if (params.value == null) {
params.value = process.env[params.name];

View File

@ -15,9 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { stripIndent } from '../../utils/lazy';
@ -30,7 +28,7 @@ export default class FleetCreateCmd extends Command {
You can specify the organization the fleet should belong to using
the \`--organization\` option. The organization's handle, not its name,
should be provided. Organization handles can be listed with the
\`balena orgs\` command.
\`balena organization list\` command.
The fleet's default device type is specified with the \`--type\` option.
The \`balena devices supported\` command can be used to list the available
@ -56,8 +54,6 @@ export default class FleetCreateCmd extends Command {
}),
};
public static usage = 'fleet create <name>';
public static flags = {
organization: Flags.string({
char: 'o',

View File

@ -15,9 +15,7 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import Command from '../../command';
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
@ -41,8 +39,6 @@ export default class FleetCmd extends Command {
fleet: ca.fleetRequired,
};
public static usage = 'fleet <fleet>';
public static flags = {
help: cf.help,
view: Flags.boolean({

View File

@ -16,10 +16,9 @@
*/
import type * as BalenaSdk from 'balena-sdk';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { Command } from '@oclif/core';
interface ExtendedApplication extends ApplicationWithDeviceTypeSlug {
device_count: number;
@ -27,7 +26,9 @@ interface ExtendedApplication extends ApplicationWithDeviceTypeSlug {
device_type?: string;
}
export default class FleetsCmd extends Command {
export default class FleetListCmd extends Command {
public static aliases = ['fleets'];
public static description = stripIndent`
List all fleets.
@ -37,9 +38,7 @@ export default class FleetsCmd extends Command {
\`balena fleet <fleet>\`
`;
public static examples = ['$ balena fleets'];
public static usage = 'fleets';
public static examples = ['$ balena fleet list'];
public static flags = {
help: cf.help,
@ -50,7 +49,7 @@ export default class FleetsCmd extends Command {
public static primary = true;
public async run() {
const { flags: options } = await this.parse(FleetsCmd);
const { flags: options } = await this.parse(FleetListCmd);
const balena = getBalenaSdk();

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getExpandedProp } from '../../utils/pine';
@ -44,8 +43,6 @@ export default class FleetPinCmd extends Command {
}),
};
public static usage = 'fleet pin <slug> [releaseToPinTo]';
public static flags = {
help: cf.help,
};
@ -79,7 +76,7 @@ export default class FleetPinCmd extends Command {
pinnedRelease
? `This fleet is currently pinned to ${pinnedRelease}.`
: 'This fleet is not currently pinned to any release.'
} \n\nTo see a list of all releases this fleet can be pinned to, run \`balena releases ${slug}\`.`,
} \n\nTo see a list of all releases this fleet can be pinned to, run \`balena release list ${slug}\`.`,
);
} else {
await balena.models.application.pinToRelease(slug, releaseToPinTo);

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -40,8 +40,6 @@ export default class FleetPurgeCmd extends Command {
fleet: ca.fleetRequired,
};
public static usage = 'fleet purge <fleet>';
public static flags = {
help: cf.help,
};

View File

@ -15,9 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
@ -48,8 +46,6 @@ export default class FleetRenameCmd extends Command {
}),
};
public static usage = 'fleet rename <fleet> [newName]';
public static flags = {
help: cf.help,
};

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -39,8 +39,6 @@ export default class FleetRestartCmd extends Command {
fleet: ca.fleetRequired,
};
public static usage = 'fleet restart <fleet>';
public static flags = {
help: cf.help,
};

View File

@ -15,11 +15,11 @@
* limitations under the License.
*/
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
import { Command } from '@oclif/core';
export default class FleetRmCmd extends Command {
public static description = stripIndent`
@ -42,8 +42,6 @@ export default class FleetRmCmd extends Command {
fleet: ca.fleetRequired,
};
public static usage = 'fleet rm <fleet>';
public static flags = {
yes: cf.yes,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -38,8 +37,6 @@ export default class FleetTrackLatestCmd extends Command {
}),
};
public static usage = 'fleet track-latest <slug>';
public static flags = {
help: cf.help,
};

View File

@ -15,10 +15,8 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import { stripIndent } from '../../utils/lazy';
import { CommandHelp } from '../../utils/oclif-utils';
// 'Internal' commands are called during the execution of other commands.
// `osinit` is called during `os initialize`
@ -48,11 +46,6 @@ export default class OsinitCmd extends Command {
}),
};
public static usage = (
'internal osinit ' +
new CommandHelp({ args: OsinitCmd.args }).defaultUsage()
).trim();
public static hidden = true;
public static root = true;
public static offlineCompatible = true;

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args, Flags } from '@oclif/core';
import Command from '../../command';
import { Args, Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
@ -60,9 +59,6 @@ export default class JoinCmd extends Command {
}),
};
// Hardcoded to preserve camelcase
public static usage = 'join [deviceIpOrHostname]';
public static flags = {
fleet: cf.fleet,
pollInterval: Flags.integer({
@ -80,7 +76,8 @@ export default class JoinCmd extends Command {
const promote = await import('../../utils/promote');
const sdk = getBalenaSdk();
const logger = await Command.getLogger();
const Logger = await import('../../utils/logger');
const logger = Logger.getLogger();
return promote.join(
logger,
sdk,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { stripIndent } from '../../utils/lazy';
import { parseAsLocalHostnameOrIp } from '../../utils/validation';
@ -50,8 +49,6 @@ export default class LeaveCmd extends Command {
}),
};
public static usage = 'leave [deviceIpOrHostname]';
public static flags = {
help: cf.help,
};
@ -63,7 +60,8 @@ export default class LeaveCmd extends Command {
const { args: params } = await this.parse(LeaveCmd);
const promote = await import('../../utils/promote');
const logger = await Command.getLogger();
const Logger = await import('../../utils/logger');
const logger = Logger.getLogger();
return promote.leave(logger, params.deviceIpOrHostname);
}
}

View File

@ -15,9 +15,8 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import { Args, Command } from '@oclif/core';
import { promisify } from 'util';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { stripIndent } from '../../utils/lazy';
@ -40,8 +39,6 @@ export default class LocalConfigureCmd extends Command {
}),
};
public static usage = 'local configure <target>';
public static flags = {
help: cf.help,
};

View File

@ -15,9 +15,8 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import { Args, Command } from '@oclif/core';
import type { BlockDevice } from 'etcher-sdk/build/source-destination';
import Command from '../../command';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getChalk, getVisuals, stripIndent } from '../../utils/lazy';
@ -46,8 +45,6 @@ export default class LocalFlashCmd extends Command {
}),
};
public static usage = 'local flash <image>';
public static flags = {
drive: cf.drive,
yes: cf.yes,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
import { ExpectedError } from '../../errors';
@ -63,8 +62,6 @@ export default class LoginCmd extends Command {
}),
};
public static usage = 'login';
public static flags = {
web: Flags.boolean({
default: false,

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
export default class LogoutCmd extends Command {
@ -26,8 +26,6 @@ export default class LogoutCmd extends Command {
`;
public static examples = ['$ balena logout'];
public static usage = 'logout';
public async run() {
await this.parse(LogoutCmd);
await getBalenaSdk().auth.logout();

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -42,8 +41,6 @@ export default class NoteCmd extends Command {
}),
};
public static usage = 'note <|note>';
public static flags = {
device: { exclusive: ['dev'], ...cf.device },
dev: Flags.string({
@ -55,14 +52,10 @@ export default class NoteCmd extends Command {
public static authenticated = true;
public static readStdin = true;
public async run() {
const { args: params, flags: options } = await this.parse(NoteCmd);
params.note = params.note || this.stdin;
if (params.note.length === 0) {
if (params.note?.length === 0) {
throw new ExpectedError('Missing note content');
}
@ -75,6 +68,6 @@ export default class NoteCmd extends Command {
const balena = getBalenaSdk();
return balena.models.device.setNote(options.device, params.note);
return balena.models.device.setNote(options.device, params.note ?? '');
}
}

View File

@ -15,19 +15,19 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
export default class OrgsCmd extends Command {
export default class OrganizationListCmd extends Command {
public static aliases = ['orgs'];
public static description = stripIndent`
List all organizations.
list all the organizations that you are a member of.
`;
public static examples = ['$ balena orgs'];
public static usage = 'orgs';
public static examples = ['$ balena organization list'];
public static flags = {
help: cf.help,
@ -36,7 +36,7 @@ export default class OrgsCmd extends Command {
public static authenticated = true;
public async run() {
await this.parse(OrgsCmd);
await this.parse(OrganizationListCmd);
const { getOwnOrganizations } = await import('../../utils/sdk');

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getCliForm, stripIndent } from '../../utils/lazy';
import * as _ from 'lodash';
@ -46,8 +45,6 @@ export default class OsBuildConfigCmd extends Command {
}),
};
public static usage = 'os build-config <image> <device-type>';
public static flags = {
advanced: Flags.boolean({
description: 'show advanced configuration options',

View File

@ -15,12 +15,11 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import { Flags, Args, Command } from '@oclif/core';
import type { Interfaces } from '@oclif/core';
import type * as BalenaSdk from 'balena-sdk';
import { promisify } from 'util';
import * as _ from 'lodash';
import Command from '../../command';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
@ -92,8 +91,6 @@ export default class OsConfigureCmd extends Command {
}),
};
public static usage = 'os configure <image>';
public static flags = {
advanced: Flags.boolean({
char: 'v',
@ -321,7 +318,9 @@ async function validateOptions(options: FlagsDef) {
);
}
await Command.checkLoggedIn();
const { checkLoggedIn } = await import('../../utils/patterns');
await checkLoggedIn();
}
/**

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { stripIndent } from '../../utils/lazy';
@ -62,8 +61,6 @@ export default class OsDownloadCmd extends Command {
}),
};
public static usage = 'os download <type>';
public static flags = {
output: Flags.string({
description: 'output path',
@ -89,10 +86,11 @@ export default class OsDownloadCmd extends Command {
// balenaOS ESR versions require user authentication
if (options.version) {
const { isESR } = await import('balena-image-manager');
const { isESR } = await import('../../utils/image-manager');
if (options.version === 'menu-esr' || isESR(options.version)) {
try {
await OsDownloadCmd.checkLoggedIn();
const { checkLoggedIn } = await import('../../utils/patterns');
await checkLoggedIn();
} catch (e) {
const { ExpectedError, NotLoggedInError } = await import(
'../../errors'

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getCliForm, stripIndent } from '../../utils/lazy';
@ -48,8 +47,6 @@ export default class OsInitializeCmd extends Command {
}),
};
public static usage = 'os initialize <image>';
public static flags = {
type: cf.deviceType,
drive: cf.drive,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { stripIndent } from '../../utils/lazy';
@ -40,8 +39,6 @@ export default class OsVersionsCmd extends Command {
}),
};
public static usage = 'os versions <type>';
public static flags = {
help: cf.help,
esr: Flags.boolean({

View File

@ -15,7 +15,6 @@
* limitations under the License.
*/
import Command from '../../command';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import {
@ -27,8 +26,7 @@ import {
import { applicationIdInfo } from '../../utils/messages';
import { dockerConnectionCliFlags } from '../../utils/docker';
import { parseAsInteger } from '../../utils/validation';
import { Flags, Args } from '@oclif/core';
import { Flags, Args, Command } from '@oclif/core';
import * as _ from 'lodash';
import type {
Application,
@ -80,8 +78,6 @@ export default class PreloadCmd extends Command {
}),
};
public static usage = 'preload <image>';
public static flags = {
fleet: cf.fleet,
commit: Flags.string({

View File

@ -15,9 +15,8 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import { Flags, Args, Command } from '@oclif/core';
import type { Interfaces } from '@oclif/core';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { dockerignoreHelp, registrySecretsHelp } from '../../utils/messages';
@ -99,8 +98,6 @@ export default class PushCmd extends Command {
}),
};
public static usage = 'push <fleetOrDevice>';
public static flags = {
source: Flags.string({
description: stripIndent`
@ -229,7 +226,9 @@ export default class PushCmd extends Command {
public async run() {
const { args: params, flags: options } = await this.parse(PushCmd);
const logger = await Command.getLogger();
const Logger = await import('../../utils/logger');
const logger = Logger.getLogger();
logger.logDebug(`Using build source directory: ${options.source} `);
const sdk = getBalenaSdk();
@ -296,7 +295,9 @@ export default class PushCmd extends Command {
options['release-tag'] ?? [],
);
await Command.checkLoggedIn();
const { checkLoggedIn } = await import('../../utils/patterns');
await checkLoggedIn();
const [token, baseUrl] = await Promise.all([
sdk.auth.getToken(),
sdk.settings.get('balenaUrl'),

View File

@ -1,116 +0,0 @@
/**
* @license
* Copyright 2016-2024 Balena Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { commitOrIdArg } from '.';
import { Flags } from '@oclif/core';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { create } from '@balena/release-bundle';
import * as fs from 'fs/promises';
import * as semver from 'balena-semver';
import { ExpectedError } from '../../errors';
export default class ReleaseExportCmd extends Command {
public static description = stripIndent`
Exports a release into a file.
Exporting a release to a file allows you to import an exact
copy of the original release into another app.
If the SemVer of a release is provided using the --version option,
the first argument is assumed to be the fleet's slug.
Only successful releases can be exported.
`;
public static examples = [
'$ balena release export a777f7345fe3d655c1c981aa642e5555 -o ../path/to/release.tar',
'$ balena release export myOrg/myFleet --version 1.2.3 -o ../path/to/release.tar',
];
public static usage = 'release export <commitOrId>';
public static flags = {
output: Flags.string({
description: 'output path',
char: 'o',
required: true,
}),
version: Flags.string({
description: 'version of the release to export from the specified fleet',
}),
help: cf.help,
};
public static args = {
commitOrId: commitOrIdArg({
description: 'commit, ID, or version of the release to export',
required: true,
}),
};
public static authenticated = true;
public async run() {
const { args: params, flags: options } = await this.parse(ReleaseExportCmd);
const balena = getBalenaSdk();
let release: balenaSdk.Release;
if (typeof options.version === 'string') {
const application = params.commitOrId;
const parsedVersion = semver.parse(options.version);
if (parsedVersion == null) {
throw new ExpectedError(
`Release of ${application} with version ${options.version} could not be exported; version must be valid SemVer.`,
);
} else {
const rawVersion =
parsedVersion.build.length === 0
? parsedVersion.version
: `${parsedVersion.version}+${parsedVersion.build[0]}`;
release = await balena.models.release.get(
{ application, rawVersion },
{ $select: ['id'] },
);
}
} else {
release = await balena.models.release.get(params.commitOrId, {
$select: ['id'],
});
}
try {
const releaseBundle = await create({
sdk: balena,
releaseId: release.id,
});
await fs.writeFile(options.output, releaseBundle);
const versionInfo =
typeof options.version === 'string'
? ` version ${options.version}`
: '';
console.log(
`Release ${params.commitOrId}${versionInfo} has been exported to ${options.output}.`,
);
} catch (error) {
throw new ExpectedError(
`Release ${params.commitOrId} could not be exported: ${error.message}`,
);
}
}
}

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
import { Command } from '@oclif/core';
import { commitOrIdArg } from '.';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -40,8 +40,6 @@ export default class ReleaseFinalizeCmd extends Command {
'$ balena release finalize 1234567',
];
public static usage = 'release finalize <commitOrId>';
public static flags = {
help: cf.help,
};

View File

@ -1,103 +0,0 @@
/**
* @license
* Copyright 2016-2024 Balena Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { apply } from '@balena/release-bundle';
import { createReadStream } from 'fs';
import { ExpectedError } from '../../errors';
export default class ReleaseImportCmd extends Command {
public static description = stripIndent`
Imports a release from a file to an app or fleet. The revision field of the release
is automatically omitted when importing a release. The backend will auto-increment
the revision field of the imported release if a release exists with the same semver.
A release will not be imported if a successful release with the same commit already
exists.
To export a release to a file, use 'balena release export'.
Use the --override-version option to specify the version
of the imported release, overriding the one saved in the file.
`;
public static examples = [
'$ balena release import ../path/to/release.tar myFleet',
'$ balena release import ../path/to/release.tar myOrg/myFleet',
'$ balena release import ../path/to/release.tar myOrg/myFleet --override-version 1.2.3',
];
public static usage = 'release import <file> <fleet>';
public static flags = {
'override-version': Flags.string({
description:
'Imports this release with the specified version overriding the version in the file.',
required: false,
}),
help: cf.help,
};
public static args = {
bundle: Args.string({
required: true,
description: 'path to a file, e.g. "./release.tar"',
}),
fleet: Args.string({
required: true,
description:
'fleet that the release will be imported to, e.g. "myOrg/myFleet"',
}),
};
public static authenticated = true;
public async run() {
const { args: params, flags: options } = await this.parse(ReleaseImportCmd);
const balena = getBalenaSdk();
const bundle = createReadStream(params.bundle).on('error', () => {
throw new ExpectedError(
`Release bundle ${params.bundle} does not exist or is not accessible.`,
);
});
try {
const application = await balena.models.application.get(params.fleet, {
$select: ['id'],
});
if (application == null) {
throw new ExpectedError(`Fleet ${params.fleet} not found.`);
}
await apply({
sdk: balena,
application: application.id,
stream: bundle,
version: options['override-version'],
});
console.log(
`Release bundle ${params.bundle} has been imported to ${params.fleet}.`,
);
} catch (error) {
throw new ExpectedError(
`Could not import release bundle ${params.bundle} to fleet ${params.fleet}: ${error.message}`,
);
}
}
}

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args, type Interfaces } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, type Interfaces, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import type * as BalenaSdk from 'balena-sdk';
@ -42,8 +41,6 @@ export default class ReleaseCmd extends Command {
'$ balena release d3f3151f5ad25ca6b070aa4d08296aca --json',
];
public static usage = 'release <commitOrId>';
public static flags = {
json: cf.json,
help: cf.help,

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
import { Command } from '@oclif/core';
import { commitOrIdArg } from '.';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -35,8 +35,6 @@ export default class ReleaseInvalidateCmd extends Command {
'$ balena release invalidate 1234567',
];
public static usage = 'release invalidate <commitOrId>';
public static flags = {
help: cf.help,
};

View File

@ -15,15 +15,16 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { applicationNameNote } from '../../utils/messages';
import type * as BalenaSdk from 'balena-sdk';
import { jsonInfo } from '../../utils/messages';
export default class ReleasesCmd extends Command {
export default class ReleaseListCmd extends Command {
public static aliases = ['releases'];
public static description = stripIndent`
List all releases of a fleet.
@ -34,12 +35,10 @@ export default class ReleasesCmd extends Command {
${jsonInfo.split('\n').join('\n\t\t')}
`;
public static examples = [
'$ balena releases myorg/myfleet',
'$ balena releases myorg/myfleet --json',
'$ balena release list myorg/myfleet',
'$ balena release list myorg/myfleet --json',
];
public static usage = 'releases <fleet>';
public static flags = {
json: cf.json,
help: cf.help,
@ -55,7 +54,7 @@ export default class ReleasesCmd extends Command {
public static authenticated = true;
public async run() {
const { args: params, flags: options } = await this.parse(ReleasesCmd);
const { args: params, flags: options } = await this.parse(ReleaseListCmd);
const fields: Array<keyof BalenaSdk.Release> = [
'id',

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
import { Command } from '@oclif/core';
import { commitOrIdArg } from '.';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -34,8 +34,6 @@ export default class ReleaseValidateCmd extends Command {
'$ balena release validate 1234567',
];
public static usage = 'release validate <commitOrId>';
public static flags = {
help: cf.help,
};

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -27,8 +27,6 @@ export default class SettingsCmd extends Command {
`;
public static examples = ['$ balena settings'];
public static usage = 'settings';
public static flags = {
help: cf.help,
};

View File

@ -15,13 +15,14 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
export default class KeyAddCmd extends Command {
export default class SSHKeyAddCmd extends Command {
public static aliases = ['key add'];
public static description = stripIndent`
Add an SSH key to balenaCloud.
@ -29,7 +30,7 @@ export default class KeyAddCmd extends Command {
If \`path\` is omitted, the command will attempt to read the SSH key from stdin.
About SSH keys
About SSH keys
An "SSH key" actually consists of a public/private key pair. A typical name
for the private key file is "id_rsa", and a typical name for the public key
file is "id_rsa.pub". Both key files are saved to your computer (with the
@ -37,7 +38,7 @@ export default class KeyAddCmd extends Command {
saved to your balena account. This means that if you change computers or
otherwise lose the private key, you cannot recover the private key through
your balena account. You can however add new keys, and delete the old ones.
To generate a new SSH key pair, a nice guide can be found in GitHub's docs:
https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
Skip the step about adding the key to a GitHub account, and instead add it to
@ -45,10 +46,10 @@ export default class KeyAddCmd extends Command {
`;
public static examples = [
'$ balena key add Main ~/.ssh/id_rsa.pub',
'$ cat ~/.ssh/id_rsa.pub | balena key add Main',
'$ balena ssh-key add Main ~/.ssh/id_rsa.pub',
'$ cat ~/.ssh/id_rsa.pub | balena ssh-key add Main',
'# Windows 10 (cmd.exe prompt) example',
'$ balena key add Main %userprofile%.sshid_rsa.pub',
'$ balena ssh-key add Main %userprofile%.sshid_rsa.pub',
];
public static args = {
@ -61,25 +62,19 @@ export default class KeyAddCmd extends Command {
}),
};
public static usage = 'key add <name> [path]';
public static flags = {
help: cf.help,
};
public static authenticated = true;
public static readStdin = true;
public async run() {
const { args: params } = await this.parse(KeyAddCmd);
const { args: params } = await this.parse(SSHKeyAddCmd);
let key: string;
if (params.path != null) {
const { readFile } = (await import('fs')).promises;
key = await readFile(params.path, 'utf8');
} else if (this.stdin.length > 0) {
key = this.stdin;
} else {
throw new ExpectedError('No public key file or path provided.');
}

View File

@ -15,20 +15,21 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { parseAsInteger } from '../../utils/validation';
export default class KeyCmd extends Command {
export default class SSHKeyCmd extends Command {
public static aliases = ['key'];
public static description = stripIndent`
Display an SSH key.
Display a single SSH key registered in balenaCloud for the logged in user.
`;
public static examples = ['$ balena key 17'];
public static examples = ['$ balena ssh-key 17'];
public static args = {
id: Args.integer({
@ -38,8 +39,6 @@ export default class KeyCmd extends Command {
}),
};
public static usage = 'key <id>';
public static flags = {
help: cf.help,
};
@ -47,7 +46,7 @@ export default class KeyCmd extends Command {
public static authenticated = true;
public async run() {
const { args: params } = await this.parse(KeyCmd);
const { args: params } = await this.parse(SSHKeyCmd);
const key = await getBalenaSdk().models.key.get(params.id);

Some files were not shown because too many files have changed in this diff Show More