bdy 1.23.7-dev-target-commands → 1.23.7-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. package/distTs/README.md +181 -0
  2. package/distTs/package.json +10 -4
  3. package/distTs/src/agent/linux.js +53 -3
  4. package/distTs/src/agent/manager.js +3 -6
  5. package/distTs/src/agent/osx.js +51 -3
  6. package/distTs/src/agent/system.js +400 -21
  7. package/distTs/src/agent/windows.js +4 -7
  8. package/distTs/src/api/client.js +0 -156
  9. package/distTs/src/cliIndex.js +0 -4
  10. package/distTs/src/command/agent/debug.js +2 -2
  11. package/distTs/src/command/agent/install.js +37 -10
  12. package/distTs/src/command/agent/restart.js +2 -2
  13. package/distTs/src/command/agent/run.js +3 -0
  14. package/distTs/src/command/agent/start.js +2 -2
  15. package/distTs/src/command/agent/status.js +19 -0
  16. package/distTs/src/command/agent/stop.js +2 -2
  17. package/distTs/src/command/agent/uninstall.js +5 -8
  18. package/distTs/src/command/agent/update.js +2 -2
  19. package/distTs/src/command/artifact/list.js +6 -1
  20. package/distTs/src/command/artifact/publish.js +3 -1
  21. package/distTs/src/command/distro/route/update.js +1 -1
  22. package/distTs/src/command/distro/update.js +9 -9
  23. package/distTs/src/command/project/get.js +18 -0
  24. package/distTs/src/command/project/set.js +31 -0
  25. package/distTs/src/command/sandbox/get/yaml.js +30 -0
  26. package/distTs/src/command/version.js +13 -5
  27. package/distTs/src/command/vt/scrape.js +193 -0
  28. package/distTs/src/input.js +0 -54
  29. package/distTs/src/logger.js +40 -4
  30. package/distTs/src/texts.js +36 -210
  31. package/distTs/src/utils.js +99 -18
  32. package/node_modules/asn1/Jenkinsfile +65 -0
  33. package/node_modules/asn1/LICENSE +19 -0
  34. package/node_modules/asn1/README.md +50 -0
  35. package/node_modules/asn1/lib/ber/errors.js +13 -0
  36. package/node_modules/asn1/lib/ber/index.js +27 -0
  37. package/node_modules/asn1/lib/ber/reader.js +262 -0
  38. package/node_modules/asn1/lib/ber/types.js +36 -0
  39. package/node_modules/asn1/lib/ber/writer.js +317 -0
  40. package/node_modules/asn1/lib/index.js +20 -0
  41. package/node_modules/asn1/package.json +31 -0
  42. package/node_modules/bcrypt-pbkdf/CONTRIBUTING.md +13 -0
  43. package/node_modules/bcrypt-pbkdf/LICENSE +66 -0
  44. package/node_modules/bcrypt-pbkdf/README.md +45 -0
  45. package/node_modules/bcrypt-pbkdf/index.js +556 -0
  46. package/node_modules/bcrypt-pbkdf/package.json +15 -0
  47. package/node_modules/safer-buffer/LICENSE +21 -0
  48. package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
  49. package/node_modules/safer-buffer/Readme.md +156 -0
  50. package/node_modules/safer-buffer/dangerous.js +58 -0
  51. package/node_modules/safer-buffer/package.json +34 -0
  52. package/node_modules/safer-buffer/safer.js +77 -0
  53. package/node_modules/safer-buffer/tests.js +406 -0
  54. package/node_modules/ssh2/.eslintignore +4 -0
  55. package/node_modules/ssh2/.eslintrc.js +5 -0
  56. package/node_modules/ssh2/.github/workflows/ci.yml +110 -0
  57. package/node_modules/ssh2/.github/workflows/lint.yml +27 -0
  58. package/node_modules/ssh2/LICENSE +19 -0
  59. package/node_modules/ssh2/README.md +1529 -0
  60. package/node_modules/ssh2/SFTP.md +413 -0
  61. package/node_modules/ssh2/examples/server-chat.js +238 -0
  62. package/node_modules/ssh2/examples/sftp-server-download-only.js +134 -0
  63. package/node_modules/ssh2/install.js +27 -0
  64. package/node_modules/ssh2/lib/Channel.js +295 -0
  65. package/node_modules/ssh2/lib/agent.js +1123 -0
  66. package/node_modules/ssh2/lib/client.js +2176 -0
  67. package/node_modules/ssh2/lib/http-agents.js +84 -0
  68. package/node_modules/ssh2/lib/index.js +44 -0
  69. package/node_modules/ssh2/lib/keygen.js +582 -0
  70. package/node_modules/ssh2/lib/protocol/Protocol.js +2136 -0
  71. package/node_modules/ssh2/lib/protocol/SFTP.js +4052 -0
  72. package/node_modules/ssh2/lib/protocol/constants.js +356 -0
  73. package/node_modules/ssh2/lib/protocol/crypto/binding.gyp +23 -0
  74. package/node_modules/ssh2/lib/protocol/crypto/poly1305.js +43 -0
  75. package/node_modules/ssh2/lib/protocol/crypto/src/binding.cc +2300 -0
  76. package/node_modules/ssh2/lib/protocol/crypto.js +1602 -0
  77. package/node_modules/ssh2/lib/protocol/handlers.js +16 -0
  78. package/node_modules/ssh2/lib/protocol/handlers.misc.js +1285 -0
  79. package/node_modules/ssh2/lib/protocol/kex.js +1908 -0
  80. package/node_modules/ssh2/lib/protocol/keyParser.js +1484 -0
  81. package/node_modules/ssh2/lib/protocol/node-fs-compat.js +115 -0
  82. package/node_modules/ssh2/lib/protocol/utils.js +356 -0
  83. package/node_modules/ssh2/lib/protocol/zlib.js +255 -0
  84. package/node_modules/ssh2/lib/server.js +1380 -0
  85. package/node_modules/ssh2/lib/utils.js +336 -0
  86. package/node_modules/ssh2/package.json +49 -0
  87. package/node_modules/ssh2/test/common.js +316 -0
  88. package/node_modules/ssh2/test/fixtures/bad_rsa_private_key +26 -0
  89. package/node_modules/ssh2/test/fixtures/https_cert.pem +33 -0
  90. package/node_modules/ssh2/test/fixtures/https_key.pem +52 -0
  91. package/node_modules/ssh2/test/fixtures/id_dsa +12 -0
  92. package/node_modules/ssh2/test/fixtures/id_ecdsa +5 -0
  93. package/node_modules/ssh2/test/fixtures/id_rsa +15 -0
  94. package/node_modules/ssh2/test/fixtures/id_rsa.ppk +26 -0
  95. package/node_modules/ssh2/test/fixtures/id_rsa_enc +30 -0
  96. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa +21 -0
  97. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub +1 -0
  98. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub.result +7 -0
  99. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.result +7 -0
  100. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc +22 -0
  101. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub +1 -0
  102. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub.result +7 -0
  103. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.result +7 -0
  104. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm +23 -0
  105. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub +1 -0
  106. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub.result +7 -0
  107. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.result +7 -0
  108. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa +9 -0
  109. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub +1 -0
  110. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub.result +7 -0
  111. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.result +7 -0
  112. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc +10 -0
  113. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub +1 -0
  114. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub.result +8 -0
  115. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.result +7 -0
  116. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm +10 -0
  117. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub +1 -0
  118. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub.result +8 -0
  119. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.result +7 -0
  120. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519 +7 -0
  121. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub +1 -0
  122. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub.result +7 -0
  123. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.result +7 -0
  124. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa +27 -0
  125. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub +1 -0
  126. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub.result +7 -0
  127. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.result +7 -0
  128. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc +28 -0
  129. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub +1 -0
  130. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub.result +8 -0
  131. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.result +7 -0
  132. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm +29 -0
  133. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub +1 -0
  134. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub.result +8 -0
  135. package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.result +7 -0
  136. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa +12 -0
  137. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub +1 -0
  138. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub.result +7 -0
  139. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.result +7 -0
  140. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc +15 -0
  141. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub +1 -0
  142. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub.result +8 -0
  143. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.result +7 -0
  144. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa +5 -0
  145. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub +1 -0
  146. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub.result +7 -0
  147. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.result +7 -0
  148. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc +8 -0
  149. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub +1 -0
  150. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub.result +8 -0
  151. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.result +7 -0
  152. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa +27 -0
  153. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub +1 -0
  154. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub.result +7 -0
  155. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.result +7 -0
  156. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc +30 -0
  157. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub +1 -0
  158. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub.result +8 -0
  159. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.result +7 -0
  160. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256 +54 -0
  161. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub +1 -0
  162. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub.result +6 -0
  163. package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.result +6 -0
  164. package/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc +17 -0
  165. package/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc.result +7 -0
  166. package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa +26 -0
  167. package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa.result +7 -0
  168. package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc +18 -0
  169. package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc.result +7 -0
  170. package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub +9 -0
  171. package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub.result +7 -0
  172. package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub +10 -0
  173. package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub.result +7 -0
  174. package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub +11 -0
  175. package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub.result +7 -0
  176. package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub +11 -0
  177. package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub.result +7 -0
  178. package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub +8 -0
  179. package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub.result +7 -0
  180. package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub +13 -0
  181. package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub.result +7 -0
  182. package/node_modules/ssh2/test/fixtures/openssh_new_rsa +27 -0
  183. package/node_modules/ssh2/test/fixtures/ssh_host_dsa_key +12 -0
  184. package/node_modules/ssh2/test/fixtures/ssh_host_ecdsa_key +5 -0
  185. package/node_modules/ssh2/test/fixtures/ssh_host_rsa_key +15 -0
  186. package/node_modules/ssh2/test/test-exec.js +578 -0
  187. package/node_modules/ssh2/test/test-integration-openssh.js +486 -0
  188. package/node_modules/ssh2/test/test-keygen.js +60 -0
  189. package/node_modules/ssh2/test/test-misc-client-server.js +1460 -0
  190. package/node_modules/ssh2/test/test-openssh.js +261 -0
  191. package/node_modules/ssh2/test/test-protocol-crypto.js +631 -0
  192. package/node_modules/ssh2/test/test-protocol-keyparser.js +177 -0
  193. package/node_modules/ssh2/test/test-server-hostkeys.js +138 -0
  194. package/node_modules/ssh2/test/test-sftp.js +842 -0
  195. package/node_modules/ssh2/test/test-shell.js +109 -0
  196. package/node_modules/ssh2/test/test-userauth-agent-openssh.js +110 -0
  197. package/node_modules/ssh2/test/test-userauth-agent.js +171 -0
  198. package/node_modules/ssh2/test/test-userauth.js +611 -0
  199. package/node_modules/ssh2/test/test-worker-imports.js +25 -0
  200. package/node_modules/ssh2/test/test.js +20 -0
  201. package/node_modules/ssh2/util/build_pagent.bat +2 -0
  202. package/node_modules/ssh2/util/pagent.c +88 -0
  203. package/node_modules/ssh2/util/pagent.exe +0 -0
  204. package/node_modules/tweetnacl/.npmignore +4 -0
  205. package/node_modules/tweetnacl/AUTHORS.md +28 -0
  206. package/node_modules/tweetnacl/CHANGELOG.md +221 -0
  207. package/node_modules/tweetnacl/LICENSE +24 -0
  208. package/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md +20 -0
  209. package/node_modules/tweetnacl/README.md +459 -0
  210. package/node_modules/tweetnacl/nacl-fast.js +2388 -0
  211. package/node_modules/tweetnacl/nacl-fast.min.js +2 -0
  212. package/node_modules/tweetnacl/nacl.d.ts +98 -0
  213. package/node_modules/tweetnacl/nacl.js +1175 -0
  214. package/node_modules/tweetnacl/nacl.min.js +1 -0
  215. package/node_modules/tweetnacl/package.json +58 -0
  216. package/package.json +10 -4
  217. package/distTs/detect-rules.json +0 -351
  218. package/distTs/src/command/environment/create.js +0 -70
  219. package/distTs/src/command/environment/delete.js +0 -29
  220. package/distTs/src/command/environment/get.js +0 -48
  221. package/distTs/src/command/environment/list.js +0 -44
  222. package/distTs/src/command/environment/resolve.js +0 -22
  223. package/distTs/src/command/environment/update.js +0 -59
  224. package/distTs/src/command/environment.js +0 -20
  225. package/distTs/src/command/pipeline/run/apply.js +0 -62
  226. package/distTs/src/command/target/create.js +0 -33
  227. package/distTs/src/command/target/delete.js +0 -30
  228. package/distTs/src/command/target/exec/command.js +0 -65
  229. package/distTs/src/command/target/exec/kill.js +0 -25
  230. package/distTs/src/command/target/exec/list.js +0 -54
  231. package/distTs/src/command/target/exec/logs.js +0 -25
  232. package/distTs/src/command/target/exec/status.js +0 -41
  233. package/distTs/src/command/target/exec.js +0 -24
  234. package/distTs/src/command/target/get.js +0 -62
  235. package/distTs/src/command/target/list.js +0 -48
  236. package/distTs/src/command/target/scope.js +0 -60
  237. package/distTs/src/command/target/update.js +0 -31
  238. package/distTs/src/command/target.js +0 -22
  239. package/distTs/src/command/yaml/actions/detect.js +0 -268
  240. package/distTs/src/command/yaml/actions/info.js +0 -56
  241. package/distTs/src/command/yaml/actions/list.js +0 -70
  242. package/distTs/src/command/yaml/actions/schema.js +0 -104
  243. package/distTs/src/command/yaml/actions.js +0 -13
  244. package/distTs/src/command/yaml/agents.js +0 -88
  245. package/distTs/src/command/yaml/cache.js +0 -98
  246. package/distTs/src/command/yaml/init.js +0 -110
  247. package/distTs/src/command/yaml/pipeline.js +0 -42
  248. package/distTs/src/command/yaml/render.js +0 -83
  249. package/distTs/src/command/yaml/schemaUtils.js +0 -139
  250. package/distTs/src/command/yaml/validate.js +0 -259
  251. package/distTs/src/command/yaml.js +0 -18
  252. package/distTs/src/diskCache.js +0 -82
@@ -563,162 +563,6 @@ class ApiClient {
563
563
  q.project = project;
564
564
  return await this.getResourceByIdentifier(workspace, q);
565
565
  }
566
- // Target methods
567
- targetScopeQuery(scope) {
568
- const query = {};
569
- if (scope.project)
570
- query.project_name = scope.project;
571
- if (scope.pipelineId)
572
- query.pipeline_id = scope.pipelineId.toString();
573
- if (scope.environmentId)
574
- query.environment_id = scope.environmentId;
575
- return query;
576
- }
577
- async getTargets(workspace, filters = {}) {
578
- return await this.request({
579
- method: 'GET',
580
- path: `/workspaces/${encodeURIComponent(workspace)}/targets`,
581
- query: this.targetScopeQuery(filters),
582
- parseResponseBody: true,
583
- });
584
- }
585
- async getTarget(workspace, targetId) {
586
- return await this.request({
587
- method: 'GET',
588
- path: `/workspaces/${encodeURIComponent(workspace)}/targets/${encodeURIComponent(targetId)}`,
589
- parseResponseBody: true,
590
- });
591
- }
592
- async createTargetByYaml(workspace, scope, body) {
593
- return await this.request({
594
- method: 'POST',
595
- path: `/workspaces/${encodeURIComponent(workspace)}/targets/yaml`,
596
- query: this.targetScopeQuery(scope),
597
- body,
598
- parseResponseBody: true,
599
- });
600
- }
601
- async updateTargetByYaml(workspace, targetId, body) {
602
- return await this.request({
603
- method: 'PATCH',
604
- path: `/workspaces/${encodeURIComponent(workspace)}/targets/${encodeURIComponent(targetId)}/yaml`,
605
- body,
606
- parseResponseBody: true,
607
- });
608
- }
609
- async deleteTarget(workspace, targetId) {
610
- return await this.request({
611
- method: 'DELETE',
612
- path: `/workspaces/${encodeURIComponent(workspace)}/targets/${encodeURIComponent(targetId)}`,
613
- parseResponseBody: false,
614
- });
615
- }
616
- async executeTargetCommand(workspace, targetId, body) {
617
- return await this.request({
618
- method: 'POST',
619
- path: `/workspaces/${encodeURIComponent(workspace)}/targets/${encodeURIComponent(targetId)}/execs`,
620
- body,
621
- parseResponseBody: true,
622
- });
623
- }
624
- async getTargetExecs(workspace, targetId, limit) {
625
- const query = {};
626
- if (limit)
627
- query.limit = limit.toString();
628
- return await this.request({
629
- method: 'GET',
630
- path: `/workspaces/${encodeURIComponent(workspace)}/targets/${encodeURIComponent(targetId)}/execs`,
631
- query,
632
- parseResponseBody: true,
633
- });
634
- }
635
- async getTargetExec(workspace, execId, wait) {
636
- const query = {};
637
- if (wait)
638
- query.wait = wait.toString();
639
- return await this.request({
640
- method: 'GET',
641
- path: `/workspaces/${encodeURIComponent(workspace)}/targets/execs/${encodeURIComponent(execId)}`,
642
- query,
643
- parseResponseBody: true,
644
- });
645
- }
646
- async cancelTargetExec(workspace, execId) {
647
- return await this.request({
648
- method: 'DELETE',
649
- path: `/workspaces/${encodeURIComponent(workspace)}/targets/execs/${encodeURIComponent(execId)}`,
650
- parseResponseBody: false,
651
- });
652
- }
653
- async getTargetExecLog(workspace, execId, offset, limit) {
654
- const query = {};
655
- if (offset)
656
- query.offset = offset.toString();
657
- if (limit)
658
- query.limit = limit.toString();
659
- return await this.request({
660
- method: 'GET',
661
- path: `/workspaces/${encodeURIComponent(workspace)}/targets/execs/${encodeURIComponent(execId)}/log`,
662
- query,
663
- parseResponseBody: true,
664
- });
665
- }
666
- async getTargetByIdentifier(workspace, identifier, line = {}) {
667
- return await this.getResourceByIdentifier(workspace, {
668
- target: identifier,
669
- ...line,
670
- });
671
- }
672
- // Environment methods
673
- async getEnvironments(workspace, project) {
674
- const query = {};
675
- if (project)
676
- query.project_name = project;
677
- return await this.request({
678
- method: 'GET',
679
- path: `/workspaces/${encodeURIComponent(workspace)}/environments`,
680
- query,
681
- parseResponseBody: true,
682
- });
683
- }
684
- async getEnvironment(workspace, environmentId) {
685
- return await this.request({
686
- method: 'GET',
687
- path: `/workspaces/${encodeURIComponent(workspace)}/environments/${encodeURIComponent(environmentId)}`,
688
- parseResponseBody: true,
689
- });
690
- }
691
- async createEnvironment(workspace, body) {
692
- return await this.request({
693
- method: 'POST',
694
- path: `/workspaces/${encodeURIComponent(workspace)}/environments`,
695
- body,
696
- parseResponseBody: true,
697
- });
698
- }
699
- async updateEnvironment(workspace, environmentId, body) {
700
- return await this.request({
701
- method: 'PATCH',
702
- path: `/workspaces/${encodeURIComponent(workspace)}/environments/${encodeURIComponent(environmentId)}`,
703
- body,
704
- parseResponseBody: true,
705
- });
706
- }
707
- async deleteEnvironment(workspace, environmentId) {
708
- return await this.request({
709
- method: 'DELETE',
710
- path: `/workspaces/${encodeURIComponent(workspace)}/environments/${encodeURIComponent(environmentId)}`,
711
- parseResponseBody: false,
712
- });
713
- }
714
- async getEnvironmentByIdentifier(workspace, identifier, project) {
715
- const q = {
716
- environment: identifier,
717
- };
718
- if (project)
719
- q.project = project;
720
- return await this.getResourceByIdentifier(workspace, q);
721
- }
722
566
  // Sandbox methods
723
567
  async createSandbox(workspace, project, body) {
724
568
  return await this.request({
@@ -24,8 +24,6 @@ const artifact_1 = __importDefault(require("./command/artifact"));
24
24
  const api_1 = __importDefault(require("./command/api"));
25
25
  const domain_1 = __importDefault(require("./command/domain"));
26
26
  const distro_1 = __importDefault(require("./command/distro"));
27
- const target_1 = __importDefault(require("./command/target"));
28
- const environment_1 = __importDefault(require("./command/environment"));
29
27
  const register_1 = __importDefault(require("./command/register"));
30
28
  const mcp_1 = __importDefault(require("./command/mcp"));
31
29
  function cliIndex() {
@@ -49,8 +47,6 @@ function cliIndex() {
49
47
  program.addCommand(sandbox_1.default);
50
48
  program.addCommand(domain_1.default);
51
49
  program.addCommand(distro_1.default);
52
- program.addCommand(target_1.default);
53
- program.addCommand(environment_1.default);
54
50
  program.addCommand(login_1.default);
55
51
  program.addCommand(register_1.default);
56
52
  program.addCommand(whoami_1.default);
@@ -11,8 +11,8 @@ commandAgentDebug.argument('<on/off>');
11
11
  commandAgentDebug.action(async (debug) => {
12
12
  const AgentManager = require('../../agent/manager').default;
13
13
  const ApiAgent = require('../../tunnel/api/agent').default;
14
- const hasAdminRights = await AgentManager.system.hasAdminRights();
15
- if (!hasAdminRights) {
14
+ const hasRights = await AgentManager.system.hasRightsToManage();
15
+ if (!hasRights) {
16
16
  output_1.default.exitError(texts_1.ERR_AGENT_ADMIN_RIGHTS);
17
17
  }
18
18
  if (!commandAgentDebug.agentInstalled) {
@@ -9,6 +9,7 @@ const texts_1 = require("../../texts");
9
9
  const cfg_1 = __importDefault(require("../../tunnel/cfg"));
10
10
  const utils_1 = require("../../utils");
11
11
  const logger_1 = __importDefault(require("../../logger"));
12
+ const node_net_1 = require("node:net");
12
13
  const removeAllAndExit = async (txt, id, host, token) => {
13
14
  const AgentManager = require('../../agent/manager').default;
14
15
  const ApiBuddy = require('../../tunnel/api/buddy').default;
@@ -25,7 +26,9 @@ const removeAllAndExit = async (txt, id, host, token) => {
25
26
  // do nothing
26
27
  }
27
28
  try {
28
- AgentManager.system.clearSystemFiles();
29
+ // Named rather than resolved: this only ever unmakes the service install started above, and
30
+ // the account running it can have an `--app` install of its own that a resolver would pick
31
+ AgentManager.system.clearServiceFiles();
29
32
  }
30
33
  catch {
31
34
  // do nothing
@@ -36,14 +39,19 @@ const removeAllAndExit = async (txt, id, host, token) => {
36
39
  catch {
37
40
  // do nothing
38
41
  }
39
- try {
40
- AgentManager.system.clearNewAgentFiles();
41
- }
42
- catch {
43
- // do nothing
44
- }
45
42
  output_1.default.exitError(txt);
46
43
  };
44
+ // A standalone install in another user's directory cannot be seen from here, so the config
45
+ // check below no longer proves the machine is free - see agent/system.ts isUserOwnedInstall.
46
+ // The port is what two agents actually compete for, and this binds it the way the agent does
47
+ // (manager.ts listens without a host), so the answer is the one that will matter on start.
48
+ const isPortFree = (port) => new Promise((resolve) => {
49
+ const srv = (0, node_net_1.createServer)();
50
+ srv.once('error', () => resolve(false));
51
+ srv.listen(port, () => {
52
+ srv.close(() => resolve(true));
53
+ });
54
+ });
47
55
  const prepareTags = (tags) => {
48
56
  const validTags = [];
49
57
  if (tags) {
@@ -235,14 +243,33 @@ commandAgentInstall.option('--agent-note <note>', texts_1.OPT_COMMAND_AGENT_NOTE
235
243
  commandAgentInstall.action(async (options) => {
236
244
  const AgentManager = require('../../agent/manager').default;
237
245
  options.start = options.start === 'true' || options.start === true;
238
- const hasAdminRights = await AgentManager.system.hasAdminRights();
239
- if (!hasAdminRights) {
240
- output_1.default.exitError(texts_1.ERR_AGENT_ADMIN_RIGHTS);
246
+ // `--app` installs no service: the config goes to this user's own directory and the agent
247
+ // runs as this user, so there is nothing left in the mode that needs root. A service
248
+ // install writes to LaunchDaemons/systemd/ProgramData and still does.
249
+ if (!options.app) {
250
+ const hasAdminRights = await AgentManager.system.hasAdminRights();
251
+ if (!hasAdminRights) {
252
+ output_1.default.exitError(texts_1.ERR_AGENT_ADMIN_RIGHTS);
253
+ }
241
254
  }
242
255
  const hasSystemConfig = AgentManager.system.hasSystemConfig();
243
256
  if (hasSystemConfig) {
244
257
  output_1.default.exitError(texts_1.TXT_AGENT_ALREADY_INSTALLED);
245
258
  }
259
+ // One agent per machine. The check above only sees the system config and this account's own
260
+ // standalone one - an `--app` install in another home is invisible from there, and a service
261
+ // installed on top of it would fight it for the port and the agent id.
262
+ if (!options.app) {
263
+ const apps = AgentManager.system.findAppInstalls();
264
+ if (apps.length) {
265
+ output_1.default.exitError((0, texts_1.ERR_AGENT_APP_INSTALL_PRESENT)(apps[0]));
266
+ }
267
+ }
268
+ const port = input_1.default.port(options.port);
269
+ const free = await isPortFree(port);
270
+ if (!free) {
271
+ output_1.default.exitError((0, texts_1.ERR_AGENT_PORT_TAKEN)(port));
272
+ }
246
273
  if (options.app) {
247
274
  await installApp(options);
248
275
  }
@@ -10,8 +10,8 @@ const logger_1 = __importDefault(require("../../logger"));
10
10
  const commandAgentRestart = (0, utils_1.newCommand)('restart', texts_1.DESC_COMMAND_AGENT_RESTART);
11
11
  commandAgentRestart.action(async () => {
12
12
  const AgentManager = require('../../agent/manager').default;
13
- const hasAdminRights = await AgentManager.system.hasAdminRights();
14
- if (!hasAdminRights) {
13
+ const hasRights = await AgentManager.system.hasRightsToManage();
14
+ if (!hasRights) {
15
15
  output_1.default.exitError(texts_1.ERR_AGENT_ADMIN_RIGHTS);
16
16
  }
17
17
  if (!commandAgentRestart.agentInstalled) {
@@ -13,6 +13,9 @@ commandAgentRun.option('--port <port>');
13
13
  commandAgentRun.option('--start <start>');
14
14
  commandAgentRun.action(async (options) => {
15
15
  const AgentManager = require('../../agent/manager').default;
16
+ // Only the service starts the agent this way, so its files are the system ones even when
17
+ // the user it runs as has an `--app` install of their own
18
+ AgentManager.system.serviceMode = true;
16
19
  logger_1.default.changeRootPath(AgentManager.system.getNewAgentConfigDir());
17
20
  AgentManager.start(options.id, options.host, options.token, parseInt(options.port, 10));
18
21
  });
@@ -10,8 +10,8 @@ const commandAgentStart = (0, utils_1.newCommand)('start', texts_1.DESC_COMMAND_
10
10
  commandAgentStart.action(async () => {
11
11
  const AgentManager = require('../../agent/manager').default;
12
12
  const logger = require('../../logger').default;
13
- const hasAdminRights = await AgentManager.system.hasAdminRights();
14
- if (!hasAdminRights) {
13
+ const hasRights = await AgentManager.system.hasRightsToManage();
14
+ if (!hasRights) {
15
15
  output_1.default.exitError(texts_1.ERR_AGENT_ADMIN_RIGHTS);
16
16
  }
17
17
  if (!commandAgentStart.agentInstalled) {
@@ -4,12 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const output_1 = __importDefault(require("../../output"));
7
+ const node_fs_1 = require("node:fs");
7
8
  const texts_1 = require("../../texts");
8
9
  const utils_1 = require("../../utils");
9
10
  const tunnel_1 = require("../../types/tunnel");
10
11
  const commandAgentStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_AGENT_STATUS);
11
12
  const outputStatus = (installed, standalone, version, id, running, enabled, target, tunneling, proxy, status) => {
13
+ const AgentManager = require('../../agent/manager').default;
12
14
  if (!installed) {
15
+ // Nothing loaded, yet there is a file where the install would be - it is unreadable or not
16
+ // the shape this cli writes. Worth naming rather than reporting no install at all: the
17
+ // system config takes precedence whatever state it is in, so while it sits there an `--app`
18
+ // install in this account's home is shadowed by it and every command says the same nothing.
19
+ const active = AgentManager.system.getActiveConfigPath();
20
+ if ((0, node_fs_1.existsSync)(active)) {
21
+ output_1.default.exitError((0, texts_1.ERR_AGENT_CONFIG_UNREADABLE)(active));
22
+ }
13
23
  output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
14
24
  }
15
25
  let txt = 'Installation: ';
@@ -51,6 +61,15 @@ const outputStatus = (installed, standalone, version, id, running, enabled, targ
51
61
  output_1.default.normal('Problems: ');
52
62
  output_1.default.error(status);
53
63
  }
64
+ // A config in this account's home that is not the install being managed here - see
65
+ // isUserOwnedInstall for which one wins. Asked of the resolver rather than of `standalone`
66
+ // above: an install made before those files moved keeps its config in the system directory
67
+ // and reports itself as an app, and a leftover in the home is just as inert next to it.
68
+ // Inert, but only findable if it is said out loud.
69
+ const orphan = AgentManager.system.getStandaloneConfigPath();
70
+ if (!AgentManager.system.isUserOwnedInstall() && (0, node_fs_1.existsSync)(orphan)) {
71
+ output_1.default.error((0, texts_1.TXT_AGENT_APP_INSTALL_ORPHANED)(orphan));
72
+ }
54
73
  output_1.default.exitNormal();
55
74
  };
56
75
  commandAgentStatus.action(async () => {
@@ -11,8 +11,8 @@ const commandAgentStop = (0, utils_1.newCommand)('stop', texts_1.DESC_COMMAND_AG
11
11
  commandAgentStop.action(async () => {
12
12
  const AgentManager = require('../../agent/manager').default;
13
13
  const ApiAgent = require('../../tunnel/api/agent').default;
14
- const hasAdminRights = await AgentManager.system.hasAdminRights();
15
- if (!hasAdminRights) {
14
+ const hasRights = await AgentManager.system.hasRightsToManage();
15
+ if (!hasRights) {
16
16
  output_1.default.exitError(texts_1.ERR_AGENT_ADMIN_RIGHTS);
17
17
  }
18
18
  if (!commandAgentStop.agentInstalled) {
@@ -12,8 +12,8 @@ commandAgentUninstall.action(async (options) => {
12
12
  const AgentManager = require('../../agent/manager').default;
13
13
  const ApiBuddy = require('../../tunnel/api/buddy').default;
14
14
  const ApiAgent = require('../../tunnel/api/agent').default;
15
- const hasAdminRights = await AgentManager.system.hasAdminRights();
16
- if (!hasAdminRights) {
15
+ const hasRights = await AgentManager.system.hasRightsToManage();
16
+ if (!hasRights) {
17
17
  output_1.default.exitError(texts_1.ERR_AGENT_ADMIN_RIGHTS);
18
18
  }
19
19
  const confirmed = options.force || (await output_1.default.confirm(texts_1.TXY_AGENT_CONFIRM_DELETE));
@@ -52,17 +52,14 @@ commandAgentUninstall.action(async (options) => {
52
52
  // do nothing
53
53
  }
54
54
  try {
55
+ // The host key went with clearSystemFiles above. Asking for it here by way of
56
+ // getNewAgentConfigDir would resolve against a config that is already gone, and land on the
57
+ // other install's.
55
58
  AgentManager.system.clearAgentFiles();
56
59
  }
57
60
  catch {
58
61
  // do nothing
59
62
  }
60
- try {
61
- AgentManager.system.clearNewAgentFiles();
62
- }
63
- catch {
64
- // do nothing
65
- }
66
63
  output_1.default.exitSuccess(texts_1.TXT_AGENT_DISABLED);
67
64
  });
68
65
  exports.default = commandAgentUninstall;
@@ -12,8 +12,8 @@ commandAgentUpdate.action(async () => {
12
12
  const AgentManager = require('../../agent/manager').default;
13
13
  const ApiAgent = require('../../tunnel/api/agent').default;
14
14
  const waitUntilAgentEnabled = require('../../agent/wait').default;
15
- const hasAdminRights = await AgentManager.system.hasAdminRights();
16
- if (!hasAdminRights) {
15
+ const hasRights = await AgentManager.system.hasRightsToManage();
16
+ if (!hasRights) {
17
17
  output_1.default.exitError(texts_1.ERR_AGENT_ADMIN_RIGHTS);
18
18
  }
19
19
  if (!commandAgentUpdate.agentInstalled) {
@@ -22,7 +22,10 @@ commandArtifactList.action(async (options) => {
22
22
  const response = await client.getArtifacts(workspace, scope === distro_1.SCOPE.PROJECT ? project : null);
23
23
  const artifacts = response.artifacts || [];
24
24
  if (options.format === 'json') {
25
- output_1.default.json(artifacts);
25
+ const filtered = scope === distro_1.SCOPE.PROJECT
26
+ ? artifacts.filter((a) => a.scope !== distro_1.SCOPE.WORKSPACE)
27
+ : artifacts;
28
+ output_1.default.json(filtered);
26
29
  }
27
30
  else {
28
31
  if (artifacts.length === 0) {
@@ -30,6 +33,8 @@ commandArtifactList.action(async (options) => {
30
33
  }
31
34
  const data = [['NAME', 'IDENTIFIER', 'TYPE', 'URL']];
32
35
  for (const artifact of artifacts) {
36
+ if (scope === distro_1.SCOPE.PROJECT && artifact.scope === distro_1.SCOPE.WORKSPACE)
37
+ continue;
33
38
  data.push([
34
39
  artifact.name,
35
40
  artifact.identifier,
@@ -196,7 +196,9 @@ const addEntryToZip = (dirPath, zip, entry) => {
196
196
  resolve();
197
197
  };
198
198
  rs.on('data', (chunk) => {
199
- file.push(chunk, false);
199
+ // Always a Buffer here - no encoding is set on the stream - but the event is typed for
200
+ // the ones that do set one, and a string would reach fflate as something it cannot zip
201
+ file.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk, false);
200
202
  });
201
203
  rs.on('error', (err) => {
202
204
  finish(err);
@@ -77,7 +77,7 @@ commandDistroRouteUpdate.action(async (identifier, routeId, options) => {
77
77
  changed = true;
78
78
  }
79
79
  if (!changed) {
80
- output_1.default.exitError(texts_1.ERR_COMMAND_NO_UPDATE);
80
+ output_1.default.exitError(texts_1.ERR_COMMAND_ROUTE_NO_UPDATE);
81
81
  }
82
82
  const result = await client.updateRoute(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, data.distribution_id, routeId, body);
83
83
  output_1.default.id(result.id);
@@ -27,6 +27,14 @@ commandDistroUpdate.action(async (identifier, options) => {
27
27
  const workspace = input_1.default.restApiWorkspace(options.workspace);
28
28
  const project = input_1.default.restApiProject(options.project, true);
29
29
  const scope = input_1.default.scope(project, options.scope);
30
+ const client = input_1.default.restApiTokenClient();
31
+ const data = await client.getDistributionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier);
32
+ if (!data || !data.domain) {
33
+ output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
34
+ }
35
+ if (!data || !data.distribution_id) {
36
+ output_1.default.exitError(texts_1.ERR_COMMAND_DISTRO_NOT_FOUND);
37
+ }
30
38
  const body = {};
31
39
  let changed = false;
32
40
  if (options.name) {
@@ -46,15 +54,7 @@ commandDistroUpdate.action(async (identifier, options) => {
46
54
  changed = true;
47
55
  }
48
56
  if (!changed) {
49
- output_1.default.exitError(texts_1.ERR_COMMAND_NO_UPDATE);
50
- }
51
- const client = input_1.default.restApiTokenClient();
52
- const data = await client.getDistributionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier);
53
- if (!data || !data.domain) {
54
- output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
55
- }
56
- if (!data || !data.distribution_id) {
57
- output_1.default.exitError(texts_1.ERR_COMMAND_DISTRO_NOT_FOUND);
57
+ output_1.default.exitError(texts_1.ERR_COMMAND_DISTRO_NO_UPDATE);
58
58
  }
59
59
  const result = await client.updateDistribution(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, data.distribution_id, body);
60
60
  output_1.default.identifier(result.identifier);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const cfg_1 = __importDefault(require("../../tunnel/cfg"));
7
+ const output_1 = __importDefault(require("../../output"));
8
+ const texts_1 = require("../../texts");
9
+ const utils_1 = require("../../utils");
10
+ const commandProjectGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_PROJECT_GET);
11
+ commandProjectGet.action(async () => {
12
+ const project = cfg_1.default.getProject();
13
+ if (!project) {
14
+ output_1.default.exitError(texts_1.TXT_PROJECT_NONE);
15
+ }
16
+ output_1.default.exitNormal(project);
17
+ });
18
+ exports.default = commandProjectGet;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const cfg_1 = __importDefault(require("../../tunnel/cfg"));
7
+ const output_1 = __importDefault(require("../../output"));
8
+ const texts_1 = require("../../texts");
9
+ const utils_1 = require("../../utils");
10
+ const input_1 = __importDefault(require("../../input"));
11
+ const commandProjectSet = (0, utils_1.newCommand)('set', texts_1.DESC_COMMAND_PROJECT_SET);
12
+ commandProjectSet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
13
+ commandProjectSet.argument('[project]', texts_1.ARG_COMMAND_PROJECT_NAME);
14
+ commandProjectSet.action(async (project, options) => {
15
+ output_1.default.handleSignals();
16
+ const workspace = input_1.default.restApiWorkspace(options.workspace);
17
+ const client = input_1.default.restApiTokenClient();
18
+ if (project) {
19
+ await client.getProject(workspace, project);
20
+ }
21
+ else {
22
+ const response = await client.getProjects(workspace);
23
+ project = await output_1.default.selectProject(response.projects);
24
+ }
25
+ cfg_1.default.setProject(project);
26
+ if (!project)
27
+ output_1.default.exitSuccess(texts_1.TXT_PROJECT_SET_CLEARED);
28
+ else
29
+ output_1.default.exitSuccess((0, texts_1.TXT_PROJECT_SET_SUCCESS)(project));
30
+ });
31
+ exports.default = commandProjectSet;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const utils_1 = require("../../../utils");
7
+ const texts_1 = require("../../../texts");
8
+ const input_1 = __importDefault(require("../../../input"));
9
+ const output_1 = __importDefault(require("../../../output"));
10
+ const commandSandboxGetYaml = (0, utils_1.newCommand)('yaml', texts_1.DESC_COMMAND_SANDBOX_GET_YAML);
11
+ commandSandboxGetYaml.hideVersionUpdate = true;
12
+ commandSandboxGetYaml.alias('yml');
13
+ commandSandboxGetYaml.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
14
+ commandSandboxGetYaml.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
15
+ commandSandboxGetYaml.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
16
+ commandSandboxGetYaml.action(async (identifier, options) => {
17
+ const workspace = input_1.default.restApiWorkspace(options.workspace);
18
+ const project = input_1.default.restApiProject(options.project);
19
+ const client = input_1.default.restApiTokenClient();
20
+ let result = await client.listSandboxes(workspace, project);
21
+ const sandboxes = result.sandboxes || [];
22
+ const found = sandboxes.find((s) => s.identifier === identifier);
23
+ if (!found) {
24
+ output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
25
+ }
26
+ const sandboxId = found.id;
27
+ result = await client.getSandboxYaml(workspace, sandboxId);
28
+ output_1.default.exitNormal(Buffer.from(result.yaml, 'base64').toString('utf8'));
29
+ });
30
+ exports.default = commandSandboxGetYaml;
@@ -33,9 +33,12 @@ const updateByApt = (currentVersion, latestVersion) => {
33
33
  const instructions = 'sudo apt-get update && sudo apt-get install -y bdy';
34
34
  updateMessage(currentVersion, latestVersion, instructions);
35
35
  };
36
- const updateByNpm = (isWin, currentVersion, latestVersion, env) => {
36
+ const updateByNpm = async (isWin, currentVersion, latestVersion, env) => {
37
37
  let instructions = '';
38
- if (!isWin)
38
+ // Only prefixed with sudo where npm genuinely cannot write, which a node from nvm, fnm,
39
+ // volta or a user-set prefix always can. The old version asked for a password on every
40
+ // platform but windows, including the installs that had no use for one.
41
+ if (!isWin && !(await (0, utils_1.isNpmGlobalWritable)()))
39
42
  instructions = 'sudo ';
40
43
  instructions += 'npm i -g bdy';
41
44
  if (env !== 'prod')
@@ -59,8 +62,13 @@ const updateByDownload = (platform, currentVersion, latestVersion, env) => {
59
62
  let instructions = `curl https://es.buddy.works/bdy/${env}/${latestWithoutEnv}/${packageName}`;
60
63
  if (isWin)
61
64
  instructions += ' -o bdy.zip\ntar -xf bdy.zip';
62
- else
63
- instructions += ' -o bdy.tar.gz\nsudo tar -zxf bdy.tar.gz -C /usr/local/bin/';
65
+ else {
66
+ // Same rule as the npm instructions: sudo only where the destination is not this user's to
67
+ // write. On a mac with homebrew on an intel prefix it already is.
68
+ const dest = '/usr/local/bin/';
69
+ const elevate = (0, utils_1.isPathWritable)(dest) ? '' : 'sudo ';
70
+ instructions += ` -o bdy.tar.gz\n${elevate}tar -zxf bdy.tar.gz -C ${dest}`;
71
+ }
64
72
  updateMessage(currentVersion, latestVersion, instructions);
65
73
  };
66
74
  const commandVersion = (0, utils_2.newCommand)('update');
@@ -97,7 +105,7 @@ commandVersion.action(async () => {
97
105
  }
98
106
  const isInstalled = await (0, utils_1.isInstalledByNpm)();
99
107
  if (isInstalled) {
100
- updateByNpm(isWin, currVersion, lastVersion, env);
108
+ await updateByNpm(isWin, currVersion, lastVersion, env);
101
109
  return;
102
110
  }
103
111
  else {