smbcloud-cli 1.1.2__tar.gz → 1.2.1__tar.gz

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 (200) hide show
  1. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/Cargo.lock +17 -17
  2. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/Cargo.toml +12 -12
  3. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/PKG-INFO +1 -1
  4. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/Cargo.toml +1 -1
  5. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cli/mod.rs +11 -1
  6. smbcloud_cli-1.2.1/crates/cli/src/flags.rs +405 -0
  7. smbcloud_cli-1.2.1/crates/cli/src/gresiq.rs +345 -0
  8. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/lib.rs +2 -0
  9. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/main.rs +4 -0
  10. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/mcp.rs +191 -1
  11. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/Cargo.toml +1 -1
  12. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-deploy/Cargo.toml +1 -1
  13. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-email-sdk/Cargo.toml +1 -1
  14. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-mail/Cargo.toml +1 -1
  15. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/Cargo.toml +1 -1
  16. smbcloud_cli-1.2.1/crates/smbcloud-model/src/flags.rs +135 -0
  17. smbcloud_cli-1.2.1/crates/smbcloud-model/src/gresiq.rs +95 -0
  18. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/lib.rs +2 -0
  19. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-network/Cargo.toml +1 -1
  20. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking/Cargo.toml +1 -1
  21. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/Cargo.toml +1 -1
  22. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-utils/Cargo.toml +1 -1
  23. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/xcrs/Cargo.toml +1 -1
  24. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/README.md +0 -0
  25. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/README.md +0 -0
  26. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/account/cli.rs +0 -0
  27. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/account/forgot/mod.rs +0 -0
  28. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/account/lib.rs +0 -0
  29. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/account/login/mod.rs +0 -0
  30. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/account/login/process.rs +0 -0
  31. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/account/logout/mod.rs +0 -0
  32. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/account/me/mod.rs +0 -0
  33. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/account/mod.rs +0 -0
  34. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/account/signup/mod.rs +0 -0
  35. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/account/signup/process.rs +0 -0
  36. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/ci.rs +0 -0
  37. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-auth/auth_app.rs +0 -0
  38. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-auth/cli.rs +0 -0
  39. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-auth/mod.rs +0 -0
  40. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-auth/process.rs +0 -0
  41. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-auth/render.rs +0 -0
  42. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-auth/request.rs +0 -0
  43. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-auth/url_builder.rs +0 -0
  44. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/config.rs +0 -0
  45. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/git.rs +0 -0
  46. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/mod.rs +0 -0
  47. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/process_deploy.rs +0 -0
  48. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/process_deploy_artifact.rs +0 -0
  49. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/process_deploy_astro_ssr.rs +0 -0
  50. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/process_deploy_nextjs_ssr.rs +0 -0
  51. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/process_deploy_rails.rs +0 -0
  52. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/process_deploy_rust.rs +0 -0
  53. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/process_deploy_static_site.rs +0 -0
  54. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/process_deploy_swift.rs +0 -0
  55. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/process_migrate.rs +0 -0
  56. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/remote_messages.rs +0 -0
  57. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/setup.rs +0 -0
  58. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/setup_create_new_project.rs +0 -0
  59. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/setup_project.rs +0 -0
  60. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-deploy/setup_select_project.rs +0 -0
  61. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-mail/cli.rs +0 -0
  62. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-mail/current_project.rs +0 -0
  63. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-mail/mod.rs +0 -0
  64. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-mail/process.rs +0 -0
  65. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-mail/render.rs +0 -0
  66. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/cloud-mail/send.rs +0 -0
  67. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/controlkit.rs +0 -0
  68. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/interface.rs +0 -0
  69. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/mcp_apps/auth_app.html +0 -0
  70. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/mcp_apps/deployments.html +0 -0
  71. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/mcp_apps/inbox.html +0 -0
  72. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/mcp_xcrs.rs +0 -0
  73. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/project/cli.rs +0 -0
  74. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/project/crud_create.rs +0 -0
  75. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/project/crud_delete.rs +0 -0
  76. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/project/crud_read.rs +0 -0
  77. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/project/crud_update.rs +0 -0
  78. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/project/deploy_target.rs +0 -0
  79. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/project/deployment.rs +0 -0
  80. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/project/mod.rs +0 -0
  81. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/project/process.rs +0 -0
  82. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/run.rs +0 -0
  83. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/session_config.rs +0 -0
  84. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/tenant/cli.rs +0 -0
  85. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/tenant/mod.rs +0 -0
  86. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/tenant/process.rs +0 -0
  87. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/tenant/render.rs +0 -0
  88. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/tenant/request.rs +0 -0
  89. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/tenant/tenant_client.rs +0 -0
  90. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/tenant/url_builder.rs +0 -0
  91. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/token/clear_smb_token.rs +0 -0
  92. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/token/get_smb_token.rs +0 -0
  93. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/token/is_logged_in.rs +0 -0
  94. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/token/mod.rs +0 -0
  95. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/token/smb_token_file_path.rs +0 -0
  96. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/ui/confirm_dialog.rs +0 -0
  97. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/ui/deployment_detail_view.rs +0 -0
  98. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/ui/deployment_table.rs +0 -0
  99. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/ui/me_view.rs +0 -0
  100. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/ui/mod.rs +0 -0
  101. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/ui/plain.rs +0 -0
  102. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/ui/project_detail_view.rs +0 -0
  103. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/ui/project_table.rs +0 -0
  104. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/ui/prompt.rs +0 -0
  105. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/ui/reporter.rs +0 -0
  106. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/cli/src/ui/theme.rs +0 -0
  107. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/.gitignore +0 -0
  108. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/README.md +0 -0
  109. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/check_email.rs +0 -0
  110. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/lib.rs +0 -0
  111. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/login.rs +0 -0
  112. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/logout.rs +0 -0
  113. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/me.rs +0 -0
  114. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/oauth/get_account_status.rs +0 -0
  115. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/oauth/get_consent_url.rs +0 -0
  116. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/oauth/get_profile.rs +0 -0
  117. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/oauth/get_token.rs +0 -0
  118. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/oauth/mod.rs +0 -0
  119. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/oauth/provider.rs +0 -0
  120. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/remove.rs +0 -0
  121. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/resend_email_verification.rs +0 -0
  122. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/resend_reset_password_instruction.rs +0 -0
  123. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/reset_password.rs +0 -0
  124. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-auth/src/signup.rs +0 -0
  125. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-deploy/README.md +0 -0
  126. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-deploy/src/artifact.rs +0 -0
  127. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-deploy/src/build.rs +0 -0
  128. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-deploy/src/error.rs +0 -0
  129. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-deploy/src/known_hosts.rs +0 -0
  130. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-deploy/src/lib.rs +0 -0
  131. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-deploy/src/report.rs +0 -0
  132. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-deploy/src/runner.rs +0 -0
  133. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-deploy/src/transport.rs +0 -0
  134. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-email-sdk/README.md +0 -0
  135. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-email-sdk/src/client.rs +0 -0
  136. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-email-sdk/src/client_credentials.rs +0 -0
  137. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-email-sdk/src/error.rs +0 -0
  138. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-email-sdk/src/message.rs +0 -0
  139. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-email-sdk/src/smbcloud_email_sdk.rs +0 -0
  140. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-mail/README.md +0 -0
  141. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-mail/src/mail_app.rs +0 -0
  142. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-mail/src/mail_inbox.rs +0 -0
  143. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-mail/src/mail_message.rs +0 -0
  144. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-mail/src/request.rs +0 -0
  145. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-mail/src/smbcloud_mail.rs +0 -0
  146. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-mail/src/url_builder.rs +0 -0
  147. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/README.md +0 -0
  148. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/account.rs +0 -0
  149. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/app_auth.rs +0 -0
  150. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/artifact_deployment.rs +0 -0
  151. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/deploy_config.rs +0 -0
  152. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/deploy_config_update.rs +0 -0
  153. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/error_codes.rs +0 -0
  154. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/forgot.rs +0 -0
  155. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/frontend_app.rs +0 -0
  156. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/login.rs +0 -0
  157. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/mail.rs +0 -0
  158. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/oauth.rs +0 -0
  159. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/project.rs +0 -0
  160. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/repository.rs +0 -0
  161. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/reset_password_response.rs +0 -0
  162. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/runner.rs +0 -0
  163. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/signup.rs +0 -0
  164. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-model/src/tenant.rs +0 -0
  165. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-network/README.md +0 -0
  166. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-network/src/environment.rs +0 -0
  167. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-network/src/lib.rs +0 -0
  168. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-network/src/network.rs +0 -0
  169. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking/README.md +0 -0
  170. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking/src/constants.rs +0 -0
  171. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking/src/lib.rs +0 -0
  172. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking/src/smb_client.rs +0 -0
  173. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/README.md +0 -0
  174. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/crud_app_deploy_config.rs +0 -0
  175. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/crud_artifact_deployment.rs +0 -0
  176. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/crud_deploy_repo_create.rs +0 -0
  177. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/crud_frontend_app_create.rs +0 -0
  178. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/crud_frontend_app_deploy_config.rs +0 -0
  179. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/crud_frontend_app_read.rs +0 -0
  180. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/crud_frontend_app_update_deploy_config.rs +0 -0
  181. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/crud_project_create.rs +0 -0
  182. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/crud_project_delete.rs +0 -0
  183. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/crud_project_deployment_create.rs +0 -0
  184. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/crud_project_deployment_read.rs +0 -0
  185. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/crud_project_deployment_update.rs +0 -0
  186. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/crud_project_read.rs +0 -0
  187. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/crud_project_update.rs +0 -0
  188. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/lib.rs +0 -0
  189. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/request.rs +0 -0
  190. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-networking-project/src/url_builder.rs +0 -0
  191. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-utils/README.md +0 -0
  192. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-utils/src/config.rs +0 -0
  193. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-utils/src/lib.rs +0 -0
  194. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/smbcloud-utils/src/write_config.rs +0 -0
  195. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/xcrs/README.md +0 -0
  196. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/xcrs/src/main.rs +0 -0
  197. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/xcrs/src/mcp.rs +0 -0
  198. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/xcrs/src/webdriver.rs +0 -0
  199. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/crates/xcrs/src/xcrs.rs +0 -0
  200. {smbcloud_cli-1.1.2 → smbcloud_cli-1.2.1}/pyproject.toml +0 -0
@@ -2653,7 +2653,7 @@ checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
2653
2653
 
2654
2654
  [[package]]
2655
2655
  name = "smbcloud-auth"
2656
- version = "1.1.2"
2656
+ version = "1.2.1"
2657
2657
  dependencies = [
2658
2658
  "log",
2659
2659
  "reqwest",
@@ -2668,7 +2668,7 @@ dependencies = [
2668
2668
 
2669
2669
  [[package]]
2670
2670
  name = "smbcloud-auth-sdk"
2671
- version = "1.1.2"
2671
+ version = "1.2.1"
2672
2672
  dependencies = [
2673
2673
  "base64 0.22.1",
2674
2674
  "reqwest",
@@ -2683,7 +2683,7 @@ dependencies = [
2683
2683
 
2684
2684
  [[package]]
2685
2685
  name = "smbcloud-auth-sdk-py"
2686
- version = "1.1.2"
2686
+ version = "1.2.1"
2687
2687
  dependencies = [
2688
2688
  "pyo3",
2689
2689
  "pythonize",
@@ -2697,7 +2697,7 @@ dependencies = [
2697
2697
 
2698
2698
  [[package]]
2699
2699
  name = "smbcloud-auth-sdk-wasm"
2700
- version = "1.1.2"
2700
+ version = "1.2.1"
2701
2701
  dependencies = [
2702
2702
  "serde-wasm-bindgen",
2703
2703
  "smbcloud-auth-sdk",
@@ -2710,7 +2710,7 @@ dependencies = [
2710
2710
 
2711
2711
  [[package]]
2712
2712
  name = "smbcloud-cli"
2713
- version = "1.1.2"
2713
+ version = "1.2.1"
2714
2714
  dependencies = [
2715
2715
  "anyhow",
2716
2716
  "base64 0.22.1",
@@ -2759,7 +2759,7 @@ dependencies = [
2759
2759
 
2760
2760
  [[package]]
2761
2761
  name = "smbcloud-deploy"
2762
- version = "1.1.2"
2762
+ version = "1.2.1"
2763
2763
  dependencies = [
2764
2764
  "anyhow",
2765
2765
  "ignore",
@@ -2779,7 +2779,7 @@ dependencies = [
2779
2779
 
2780
2780
  [[package]]
2781
2781
  name = "smbcloud-email-sdk"
2782
- version = "1.1.2"
2782
+ version = "1.2.1"
2783
2783
  dependencies = [
2784
2784
  "anyhow",
2785
2785
  "log",
@@ -2794,7 +2794,7 @@ dependencies = [
2794
2794
 
2795
2795
  [[package]]
2796
2796
  name = "smbcloud-gresiq"
2797
- version = "1.1.2"
2797
+ version = "1.2.1"
2798
2798
  dependencies = [
2799
2799
  "native-tls",
2800
2800
  "postgres-native-tls",
@@ -2808,7 +2808,7 @@ dependencies = [
2808
2808
 
2809
2809
  [[package]]
2810
2810
  name = "smbcloud-gresiq-sdk"
2811
- version = "1.1.2"
2811
+ version = "1.2.1"
2812
2812
  dependencies = [
2813
2813
  "anyhow",
2814
2814
  "log",
@@ -2822,7 +2822,7 @@ dependencies = [
2822
2822
 
2823
2823
  [[package]]
2824
2824
  name = "smbcloud-mail"
2825
- version = "1.1.2"
2825
+ version = "1.2.1"
2826
2826
  dependencies = [
2827
2827
  "reqwest",
2828
2828
  "serde",
@@ -2834,7 +2834,7 @@ dependencies = [
2834
2834
 
2835
2835
  [[package]]
2836
2836
  name = "smbcloud-model"
2837
- version = "1.1.2"
2837
+ version = "1.2.1"
2838
2838
  dependencies = [
2839
2839
  "chrono",
2840
2840
  "log",
@@ -2850,7 +2850,7 @@ dependencies = [
2850
2850
 
2851
2851
  [[package]]
2852
2852
  name = "smbcloud-network"
2853
- version = "1.1.2"
2853
+ version = "1.2.1"
2854
2854
  dependencies = [
2855
2855
  "clap 4.6.6",
2856
2856
  "log",
@@ -2864,7 +2864,7 @@ dependencies = [
2864
2864
 
2865
2865
  [[package]]
2866
2866
  name = "smbcloud-networking"
2867
- version = "1.1.2"
2867
+ version = "1.2.1"
2868
2868
  dependencies = [
2869
2869
  "smbcloud-network",
2870
2870
  "url-builder",
@@ -2872,7 +2872,7 @@ dependencies = [
2872
2872
 
2873
2873
  [[package]]
2874
2874
  name = "smbcloud-networking-project"
2875
- version = "1.1.2"
2875
+ version = "1.2.1"
2876
2876
  dependencies = [
2877
2877
  "anyhow",
2878
2878
  "async-trait",
@@ -2890,11 +2890,11 @@ dependencies = [
2890
2890
 
2891
2891
  [[package]]
2892
2892
  name = "smbcloud-s6n"
2893
- version = "1.1.2"
2893
+ version = "1.2.1"
2894
2894
 
2895
2895
  [[package]]
2896
2896
  name = "smbcloud-utils"
2897
- version = "1.1.2"
2897
+ version = "1.2.1"
2898
2898
  dependencies = [
2899
2899
  "anyhow",
2900
2900
  "dirs",
@@ -4142,7 +4142,7 @@ checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"
4142
4142
 
4143
4143
  [[package]]
4144
4144
  name = "xcrs"
4145
- version = "1.1.2"
4145
+ version = "1.2.1"
4146
4146
  dependencies = [
4147
4147
  "anyhow",
4148
4148
  "base64 0.22.1",
@@ -31,17 +31,17 @@ serde = "1"
31
31
  serde_json = "1.0.82"
32
32
  serde_repr = "0.1"
33
33
  sha2 = "0.10"
34
- smbcloud-auth = { version = "1.1.2", path = "crates/smbcloud-auth" }
35
- smbcloud-auth-sdk = { version = "1.1.2", path = "crates/smbcloud-auth-sdk" }
36
- smbcloud-deploy = { version = "1.1.2", path = "crates/smbcloud-deploy" }
37
- smbcloud-email-sdk = { version = "1.1.2", path = "crates/smbcloud-email-sdk" }
38
- smbcloud-gresiq-sdk = { version = "1.1.2", path = "crates/smbcloud-gresiq-sdk" }
39
- smbcloud-mail = { version = "1.1.2", path = "crates/smbcloud-mail" }
40
- smbcloud-model = { version = "1.1.2", path = "crates/smbcloud-model" }
41
- smbcloud-network = { version = "1.1.2", path = "crates/smbcloud-network" }
42
- smbcloud-networking = { version = "1.1.2", path = "crates/smbcloud-networking" }
43
- smbcloud-networking-project = { version = "1.1.2", path = "crates/smbcloud-networking-project" }
44
- smbcloud-utils = { version = "1.1.2", path = "crates/smbcloud-utils" }
34
+ smbcloud-auth = { version = "1.2.1", path = "crates/smbcloud-auth" }
35
+ smbcloud-auth-sdk = { version = "1.2.1", path = "crates/smbcloud-auth-sdk" }
36
+ smbcloud-deploy = { version = "1.2.1", path = "crates/smbcloud-deploy" }
37
+ smbcloud-email-sdk = { version = "1.2.1", path = "crates/smbcloud-email-sdk" }
38
+ smbcloud-gresiq-sdk = { version = "1.2.1", path = "crates/smbcloud-gresiq-sdk" }
39
+ smbcloud-mail = { version = "1.2.1", path = "crates/smbcloud-mail" }
40
+ smbcloud-model = { version = "1.2.1", path = "crates/smbcloud-model" }
41
+ smbcloud-network = { version = "1.2.1", path = "crates/smbcloud-network" }
42
+ smbcloud-networking = { version = "1.2.1", path = "crates/smbcloud-networking" }
43
+ smbcloud-networking-project = { version = "1.2.1", path = "crates/smbcloud-networking-project" }
44
+ smbcloud-utils = { version = "1.2.1", path = "crates/smbcloud-utils" }
45
45
  spinners = "4.1.0"
46
46
  strum = "0.27"
47
47
  strum_macros = "0.27"
@@ -59,4 +59,4 @@ uniffi = "0.31"
59
59
  url-builder = "0.1.1"
60
60
  wiremock = "0.6"
61
61
  wasm-bindgen = "0.2"
62
- xcrs = { version = "1.1.2", path = "crates/xcrs" }
62
+ xcrs = { version = "1.2.1", path = "crates/xcrs" }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: smbcloud-cli
3
- Version: 1.1.2
3
+ Version: 1.2.1
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Environment :: Console
6
6
  Classifier: Intended Audience :: Developers
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "smbcloud-cli"
3
- version = "1.1.2"
3
+ version = "1.2.1"
4
4
  edition = "2021"
5
5
  authors = ["Seto Elkahfi <seto@smbcloud.xyz>"]
6
6
  description = "smbCloud command line interface."
@@ -1,5 +1,5 @@
1
1
  use {
2
- crate::{account, cloud_auth, mail, project, run, tenant},
2
+ crate::{account, cloud_auth, flags, gresiq, mail, project, run, tenant},
3
3
  clap::{Parser, Subcommand, ValueEnum},
4
4
  smbcloud_network::environment::Environment,
5
5
  spinners::Spinner,
@@ -118,6 +118,16 @@ pub enum Commands {
118
118
  #[clap(subcommand)]
119
119
  command: tenant::cli::Commands,
120
120
  },
121
+ #[clap(about = "Manage smbCloud Flags, a project's feature flags.")]
122
+ Flags {
123
+ #[clap(subcommand)]
124
+ command: flags::Commands,
125
+ },
126
+ #[clap(about = "Manage a project's GresIQ app and its keys.")]
127
+ Gresiq {
128
+ #[clap(subcommand)]
129
+ command: gresiq::Commands,
130
+ },
121
131
  #[clap(about = "Manage smbCloud Mail.")]
122
132
  Mail {
123
133
  #[clap(subcommand)]
@@ -0,0 +1,405 @@
1
+ //! `smb flags`: smbCloud Flags, the boolean flags a project keeps in its GresIQ
2
+ //! app. The same calls back the `flags_*` MCP tools.
3
+
4
+ use crate::{
5
+ cli::CommandResult,
6
+ client, session_config,
7
+ token::get_smb_token::get_smb_token,
8
+ ui::{succeed_message, succeed_symbol},
9
+ };
10
+ use anyhow::{anyhow, Result};
11
+ use clap::Subcommand;
12
+ use console::style;
13
+ use reqwest::{Client, RequestBuilder};
14
+ use serde::{de::DeserializeOwned, Serialize};
15
+ use serde_json::Value;
16
+ use smbcloud_model::flags::{Flag, FlagEnvelope, FlagInput, FlagList, FlagTargetsInput};
17
+ use smbcloud_network::environment::Environment;
18
+ use smbcloud_networking::{constants::SMB_USER_AGENT, smb_base_url_builder};
19
+ use spinners::Spinner;
20
+
21
+ #[derive(clap::Args, Clone, Debug, Default)]
22
+ pub struct FlagFields {
23
+ #[clap(long, help = "Display name.")]
24
+ pub name: Option<String>,
25
+ #[clap(long, help = "What the flag controls.")]
26
+ pub description: Option<String>,
27
+ #[clap(long, conflicts_with = "off", help = "Switch the flag on.")]
28
+ pub on: bool,
29
+ #[clap(long, conflicts_with = "on", help = "Switch the flag off.")]
30
+ pub off: bool,
31
+ #[clap(
32
+ long,
33
+ conflicts_with = "not_overridable",
34
+ help = "Let a visitor force a variant with ?treatment= or ?control=."
35
+ )]
36
+ pub overridable: bool,
37
+ #[clap(
38
+ long,
39
+ conflicts_with = "overridable",
40
+ help = "Stop a visitor forcing a variant."
41
+ )]
42
+ pub not_overridable: bool,
43
+ #[clap(
44
+ long,
45
+ value_delimiter = ',',
46
+ help = "Emails it is on for, comma separated. Replaces the list."
47
+ )]
48
+ pub emails: Option<Vec<String>>,
49
+ #[clap(
50
+ long,
51
+ value_delimiter = ',',
52
+ help = "Email domains it is on for, comma separated. Replaces the list."
53
+ )]
54
+ pub domains: Option<Vec<String>>,
55
+ #[clap(
56
+ long,
57
+ value_parser = clap::value_parser!(u8).range(0..=100),
58
+ help = "A stable share of all users, 0 to 100."
59
+ )]
60
+ pub percent: Option<u8>,
61
+ }
62
+
63
+ impl FlagFields {
64
+ pub fn into_input(self, key: Option<String>) -> FlagInput {
65
+ FlagInput {
66
+ key,
67
+ name: self.name,
68
+ description: self.description,
69
+ on: match (self.on, self.off) {
70
+ (true, _) => Some(true),
71
+ (_, true) => Some(false),
72
+ _ => None,
73
+ },
74
+ overridable: match (self.overridable, self.not_overridable) {
75
+ (true, _) => Some(true),
76
+ (_, true) => Some(false),
77
+ _ => None,
78
+ },
79
+ targets: FlagTargetsInput {
80
+ emails: self.emails,
81
+ domains: self.domains,
82
+ percent: self.percent,
83
+ },
84
+ }
85
+ }
86
+ }
87
+
88
+ #[derive(Subcommand)]
89
+ pub enum Commands {
90
+ #[clap(about = "List a project's flags.")]
91
+ List {
92
+ #[clap(short, long, help = "Project id. Defaults to the selected project.")]
93
+ project: Option<String>,
94
+ },
95
+ #[clap(about = "Show one flag.")]
96
+ Get {
97
+ key: String,
98
+ #[clap(short, long)]
99
+ project: Option<String>,
100
+ },
101
+ #[clap(about = "Create a flag. The project needs a GresIQ app.")]
102
+ Create {
103
+ #[clap(help = "Lowercase letters, digits and underscores, starting with a letter.")]
104
+ key: String,
105
+ #[clap(short, long)]
106
+ project: Option<String>,
107
+ #[clap(flatten)]
108
+ fields: FlagFields,
109
+ },
110
+ #[clap(about = "Change a flag. Only the options you pass are changed.")]
111
+ Update {
112
+ key: String,
113
+ #[clap(short, long)]
114
+ project: Option<String>,
115
+ #[clap(flatten)]
116
+ fields: FlagFields,
117
+ },
118
+ #[clap(about = "Delete a flag.")]
119
+ Delete {
120
+ key: String,
121
+ #[clap(short, long)]
122
+ project: Option<String>,
123
+ #[clap(long, help = "Confirm the deletion.")]
124
+ yes: bool,
125
+ },
126
+ }
127
+
128
+ pub async fn process_flags(env: Environment, commands: Commands) -> Result<CommandResult> {
129
+ let token = get_smb_token(env)?;
130
+ match commands {
131
+ Commands::List { project } => {
132
+ let flags = list_flags(env, &token, &project_id(env, project)?).await?;
133
+ print_flags(&flags);
134
+ Ok(done(if flags.is_empty() {
135
+ "No flags yet."
136
+ } else {
137
+ "Done."
138
+ }))
139
+ }
140
+ Commands::Get { key, project } => {
141
+ let flag = get_flag(env, &token, &project_id(env, project)?, &key).await?;
142
+ print_flag(&flag);
143
+ Ok(done("Done."))
144
+ }
145
+ Commands::Create {
146
+ key,
147
+ project,
148
+ fields,
149
+ } => {
150
+ let flag = create_flag(
151
+ env,
152
+ &token,
153
+ &project_id(env, project)?,
154
+ fields.into_input(Some(key)),
155
+ )
156
+ .await?;
157
+ print_flag(&flag);
158
+ Ok(done("Flag created."))
159
+ }
160
+ Commands::Update {
161
+ key,
162
+ project,
163
+ fields,
164
+ } => {
165
+ let input = fields.into_input(None);
166
+ if input == FlagInput::default() {
167
+ return Err(anyhow!(
168
+ "Pass at least one of --name, --description, --on, --off, --overridable, --not-overridable, --emails, --domains or --percent."
169
+ ));
170
+ }
171
+ let flag = update_flag(env, &token, &project_id(env, project)?, &key, input).await?;
172
+ print_flag(&flag);
173
+ Ok(done("Flag updated."))
174
+ }
175
+ Commands::Delete { key, project, yes } => {
176
+ if !yes {
177
+ return Err(anyhow!(
178
+ "This deletes the flag `{key}`. Pass --yes to confirm."
179
+ ));
180
+ }
181
+ delete_flag(env, &token, &project_id(env, project)?, &key).await?;
182
+ Ok(done("Flag deleted."))
183
+ }
184
+ }
185
+ }
186
+
187
+ pub(crate) fn project_id(env: Environment, project: Option<String>) -> Result<String> {
188
+ let project = match project {
189
+ Some(project) => Some(project),
190
+ None => session_config::current_project_id(env)?,
191
+ };
192
+ project
193
+ .map(|id| id.trim().to_string())
194
+ .filter(|id| !id.is_empty())
195
+ .ok_or_else(|| anyhow!("Pass --project <id>, or select one with `smb project use`."))
196
+ }
197
+
198
+ fn flags_url(env: Environment, project_id: &str, key: Option<&str>) -> Result<String> {
199
+ let mut builder = smb_base_url_builder(env, client());
200
+ builder.add_route("v1/projects");
201
+ builder.add_route(project_id);
202
+ builder.add_route("flags");
203
+ if let Some(key) = key {
204
+ builder.add_route(key);
205
+ }
206
+ // The API resolves the project inside the caller's tenant, so a selected
207
+ // tenant has to travel with the request.
208
+ if let Some(tenant_id) = session_config::current_tenant_id(env)? {
209
+ builder.add_param("tenant_id", &tenant_id);
210
+ }
211
+ Ok(builder.build())
212
+ }
213
+
214
+ pub(crate) fn authorized(builder: RequestBuilder, token: &str) -> RequestBuilder {
215
+ builder
216
+ .header("Authorization", token)
217
+ .header("User-agent", SMB_USER_AGENT)
218
+ }
219
+
220
+ /// The API answers errors as `{ "errors": [..] }` or `{ "error": ".." }`. Say
221
+ /// what it said, since the message ("Set up GresIQ for this project first.")
222
+ /// is the useful part.
223
+ pub(crate) async fn send<T: DeserializeOwned>(builder: RequestBuilder) -> Result<T> {
224
+ let response = builder
225
+ .send()
226
+ .await
227
+ .map_err(|error| anyhow!("Couldn't reach smbCloud: {error}"))?;
228
+ let status = response.status();
229
+ let body = response.text().await?;
230
+ if !status.is_success() {
231
+ return Err(anyhow!(error_message(status.as_u16(), &body)));
232
+ }
233
+ serde_json::from_str(&body).map_err(|error| anyhow!("Unexpected answer from smbCloud: {error}"))
234
+ }
235
+
236
+ pub(crate) fn error_message(status: u16, body: &str) -> String {
237
+ let parsed: Option<Value> = serde_json::from_str(body).ok();
238
+ let message = parsed.as_ref().and_then(|value| {
239
+ value
240
+ .get("errors")
241
+ .and_then(Value::as_array)
242
+ .map(|errors| {
243
+ errors
244
+ .iter()
245
+ .filter_map(Value::as_str)
246
+ .collect::<Vec<_>>()
247
+ .join(" ")
248
+ })
249
+ .filter(|text| !text.is_empty())
250
+ .or_else(|| {
251
+ ["error", "message"]
252
+ .iter()
253
+ .find_map(|field| value.get(field).and_then(Value::as_str))
254
+ .map(str::to_string)
255
+ })
256
+ });
257
+ message.unwrap_or_else(|| format!("smbCloud answered {status}."))
258
+ }
259
+
260
+ pub(crate) async fn list_flags(env: Environment, token: &str, project: &str) -> Result<Vec<Flag>> {
261
+ let builder = authorized(Client::new().get(flags_url(env, project, None)?), token);
262
+ Ok(send::<FlagList>(builder).await?.flags)
263
+ }
264
+
265
+ pub(crate) async fn get_flag(
266
+ env: Environment,
267
+ token: &str,
268
+ project: &str,
269
+ key: &str,
270
+ ) -> Result<Flag> {
271
+ let builder = authorized(
272
+ Client::new().get(flags_url(env, project, Some(key))?),
273
+ token,
274
+ );
275
+ Ok(send::<FlagEnvelope>(builder).await?.flag)
276
+ }
277
+
278
+ #[derive(Serialize)]
279
+ struct FlagBody<'a> {
280
+ flag: &'a FlagInput,
281
+ }
282
+
283
+ pub(crate) async fn create_flag(
284
+ env: Environment,
285
+ token: &str,
286
+ project: &str,
287
+ input: FlagInput,
288
+ ) -> Result<Flag> {
289
+ let builder = authorized(Client::new().post(flags_url(env, project, None)?), token)
290
+ .json(&FlagBody { flag: &input });
291
+ Ok(send::<FlagEnvelope>(builder).await?.flag)
292
+ }
293
+
294
+ pub(crate) async fn update_flag(
295
+ env: Environment,
296
+ token: &str,
297
+ project: &str,
298
+ key: &str,
299
+ input: FlagInput,
300
+ ) -> Result<Flag> {
301
+ let builder = authorized(
302
+ Client::new().patch(flags_url(env, project, Some(key))?),
303
+ token,
304
+ )
305
+ .json(&FlagBody { flag: &input });
306
+ Ok(send::<FlagEnvelope>(builder).await?.flag)
307
+ }
308
+
309
+ pub(crate) async fn delete_flag(
310
+ env: Environment,
311
+ token: &str,
312
+ project: &str,
313
+ key: &str,
314
+ ) -> Result<()> {
315
+ let response = authorized(
316
+ Client::new().delete(flags_url(env, project, Some(key))?),
317
+ token,
318
+ )
319
+ .send()
320
+ .await
321
+ .map_err(|error| anyhow!("Couldn't reach smbCloud: {error}"))?;
322
+ let status = response.status();
323
+ if status.is_success() {
324
+ return Ok(());
325
+ }
326
+ Err(anyhow!(error_message(
327
+ status.as_u16(),
328
+ &response.text().await?
329
+ )))
330
+ }
331
+
332
+ fn print_flags(flags: &[Flag]) {
333
+ println!("\n{}", style("Flags").bold().underlined());
334
+ if flags.is_empty() {
335
+ println!("No flags yet.");
336
+ return;
337
+ }
338
+ for flag in flags {
339
+ let state = if flag.on { "on " } else { "off" };
340
+ println!("{state} {} ({})", style(&flag.key).bold(), flag.name);
341
+ }
342
+ }
343
+
344
+ fn print_flag(flag: &Flag) {
345
+ let field =
346
+ |label: &str, value: String| println!("{} {value}", style(format!("{label}:")).cyan());
347
+ println!("\n{}", style("Flag").bold().underlined());
348
+ field("Key", flag.key.clone());
349
+ field("Name", flag.name.clone());
350
+ if !flag.description.is_empty() {
351
+ field("Description", flag.description.clone());
352
+ }
353
+ field("On", flag.on.to_string());
354
+ field("Overridable", flag.overridable.to_string());
355
+ field("Emails", flag.targets.emails.join(", "));
356
+ field("Domains", flag.targets.domains.join(", "));
357
+ field("Percent", flag.targets.percent.to_string());
358
+ }
359
+
360
+ pub(crate) fn done(message: &str) -> CommandResult {
361
+ CommandResult {
362
+ spinner: Spinner::new(
363
+ spinners::Spinners::SimpleDotsScrolling,
364
+ succeed_message("Done"),
365
+ ),
366
+ symbol: succeed_symbol(),
367
+ msg: succeed_message(message),
368
+ }
369
+ }
370
+
371
+ #[cfg(test)]
372
+ mod tests {
373
+ use super::*;
374
+
375
+ #[test]
376
+ fn on_and_off_become_a_bool_and_unset_stays_unset() {
377
+ let on = FlagFields {
378
+ on: true,
379
+ ..Default::default()
380
+ };
381
+ assert_eq!(on.into_input(None).on, Some(true));
382
+ let off = FlagFields {
383
+ off: true,
384
+ ..Default::default()
385
+ };
386
+ assert_eq!(off.into_input(None).on, Some(false));
387
+ assert_eq!(FlagFields::default().into_input(None), FlagInput::default());
388
+ }
389
+
390
+ #[test]
391
+ fn api_errors_say_what_the_api_said() {
392
+ assert_eq!(
393
+ error_message(
394
+ 422,
395
+ r#"{"errors":["Set up GresIQ for this project first."]}"#
396
+ ),
397
+ "Set up GresIQ for this project first."
398
+ );
399
+ assert_eq!(
400
+ error_message(404, r#"{"error":"Flag not found"}"#),
401
+ "Flag not found"
402
+ );
403
+ assert_eq!(error_message(502, "<html>"), "smbCloud answered 502.");
404
+ }
405
+ }