clever-tools 3.14.0 → 4.0.0

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 (93) hide show
  1. package/README.md +130 -37
  2. package/bin/clever.js +1427 -718
  3. package/package.json +61 -77
  4. package/src/clever-client/auth-bridge.js +9 -12
  5. package/src/clever-client/ng.js +1 -1
  6. package/src/clever-client/operators.js +7 -7
  7. package/src/command-options.js +6 -6
  8. package/src/command-promise-handler.js +6 -6
  9. package/src/commands/accesslogs.js +38 -29
  10. package/src/commands/activity.js +62 -40
  11. package/src/commands/addon.js +65 -69
  12. package/src/commands/applications.js +33 -31
  13. package/src/commands/cancel-deploy.js +7 -7
  14. package/src/commands/config.js +9 -7
  15. package/src/commands/console.js +3 -3
  16. package/src/commands/create.js +32 -31
  17. package/src/commands/curl.js +14 -36
  18. package/src/commands/database.js +10 -30
  19. package/src/commands/delete.js +8 -8
  20. package/src/commands/deploy.js +60 -46
  21. package/src/commands/diag.js +27 -25
  22. package/src/commands/domain.js +89 -91
  23. package/src/commands/drain.js +26 -14
  24. package/src/commands/emails.js +24 -28
  25. package/src/commands/env.js +18 -18
  26. package/src/commands/features.js +12 -18
  27. package/src/commands/keycloak.js +11 -11
  28. package/src/commands/kv.js +13 -13
  29. package/src/commands/link.js +9 -8
  30. package/src/commands/login.js +19 -27
  31. package/src/commands/logout.js +1 -1
  32. package/src/commands/logs.js +20 -12
  33. package/src/commands/makeDefault.js +5 -5
  34. package/src/commands/matomo.js +7 -7
  35. package/src/commands/metabase.js +9 -9
  36. package/src/commands/ng.js +32 -32
  37. package/src/commands/notify-email.js +11 -15
  38. package/src/commands/open.js +1 -1
  39. package/src/commands/otoroshi.js +11 -11
  40. package/src/commands/profile.js +8 -8
  41. package/src/commands/published-config.js +11 -11
  42. package/src/commands/restart.js +15 -8
  43. package/src/commands/scale.js +25 -16
  44. package/src/commands/service.js +18 -9
  45. package/src/commands/ssh-keys.js +25 -29
  46. package/src/commands/ssh.js +1 -2
  47. package/src/commands/status.js +31 -22
  48. package/src/commands/stop.js +3 -3
  49. package/src/commands/tcp-redirs.js +27 -26
  50. package/src/commands/tokens.js +44 -43
  51. package/src/commands/unlink.js +7 -5
  52. package/src/commands/version.js +2 -4
  53. package/src/commands/webhooks.js +8 -10
  54. package/src/experimental-features.js +7 -5
  55. package/src/format-table.js +46 -15
  56. package/src/initial-setup.js +2 -32
  57. package/src/initial-update-notifier.js +18 -0
  58. package/src/lib/has-param.js +16 -0
  59. package/src/lib/ng-print.js +21 -24
  60. package/src/lib/operator-commands.js +58 -53
  61. package/src/lib/prompts.js +5 -5
  62. package/src/lib/slugify.js +1 -1
  63. package/src/logger.js +24 -22
  64. package/src/models/activity.js +3 -3
  65. package/src/models/addon.js +52 -53
  66. package/src/models/app_configuration.js +34 -32
  67. package/src/models/application.js +90 -77
  68. package/src/models/application_configuration.js +19 -27
  69. package/src/models/configuration.js +30 -32
  70. package/src/models/deployments.js +9 -19
  71. package/src/models/domain.js +10 -9
  72. package/src/models/drain.js +16 -15
  73. package/src/models/exit-strategy-option.js +15 -5
  74. package/src/models/fs-utils.js +4 -3
  75. package/src/models/git.js +26 -32
  76. package/src/models/ids-resolver.js +37 -41
  77. package/src/models/isomorphic-http-with-agent.js +3 -3
  78. package/src/models/json-array.js +5 -6
  79. package/src/models/log-v4.js +44 -52
  80. package/src/models/log.js +40 -45
  81. package/src/models/namespaces.js +4 -4
  82. package/src/models/ng-resources.js +49 -39
  83. package/src/models/ng.js +41 -40
  84. package/src/models/node-dns-resolver.js +3 -3
  85. package/src/models/notification.js +7 -10
  86. package/src/models/operator.js +8 -10
  87. package/src/models/organisation.js +5 -8
  88. package/src/models/send-to-api.js +18 -11
  89. package/src/models/user.js +6 -5
  90. package/src/models/utils.js +5 -8
  91. package/src/models/variables.js +18 -20
  92. package/src/parsers.js +34 -34
  93. package/src/load-package-json.cjs +0 -5
package/README.md CHANGED
@@ -1,72 +1,165 @@
1
1
  # Clever Tools
2
2
 
3
- Deploy on Clever Cloud and control your applications, add-ons, services from command line.
3
+ [![npm version](https://img.shields.io/npm/v/clever-tools.svg)](https://www.npmjs.com/package/clever-tools)
4
+ [![Node.js requirement](https://img.shields.io/node/v/clever-tools.svg)](https://nodejs.org)
4
5
 
5
- - [Create a Clever Cloud account](https://console.clever-cloud.com)
6
+ The official CLI for [Clever Cloud](https://www.clever.cloud) - Deploy and manage your applications, add-ons, and services from the command line with modern tooling and automated workflows. The perfect developer companion, complementing the [Clever Cloud Console](https://console.clever-cloud.com).
6
7
 
7
- ## Installation
8
+ ## Quick Start
8
9
 
9
- Clever Tools are available from many channels. The simpler way to install them, if you already have Node.js on your system, is through `npm` package manager:
10
+ **Prerequisites:** Node.js 22+
10
11
 
11
- ```sh
12
+ ```bash
13
+ # Install globally
12
14
  npm install -g clever-tools
15
+
16
+ # Or use directly without installation
17
+ npx --yes clever-tools@latest version
18
+ ```
19
+
20
+ **First steps:**
21
+
22
+ ```bash
23
+ clever login
24
+ clever profile
13
25
  ```
14
26
 
15
- We also distribute binaries and packages for multiple systems and tools:
27
+ ## Key Features
28
+
29
+ - **Complete Platform Control**: Manage applications, add-ons, domains, and services from the command line
30
+ - **Real-time Monitoring**: Stream logs, monitor deployments, and check application status
31
+ - **Seamless Deployment**: Deploy directly from your local environment or CI/CD pipelines
32
+ - **Cross-platform**: Available for Linux, macOS, Windows via multiple package managers
33
+ - **API Integration**: Direct access to Clever Cloud's API with authenticated commands
34
+
35
+ ## Installation Options
36
+
37
+ For Node.js users, npm is the fastest way. For other installation methods including:
38
+
39
+ - Docker images
40
+ - Binary downloads
41
+ - Native packages (RPM, DEB)
42
+ - Package managers (Homebrew, Winget, AUR)
16
43
 
17
- * [GNU/Linux](docs/setup-systems.md#gnulinux)
18
- * [Arch Linux (AUR)](docs/setup-systems.md#arch-linux-aur)
19
- * [CentOS/Fedora (.rpm)](docs/setup-systems.md#centosfedora-rpm)
20
- * [Debian/Ubuntu (.deb)](docs/setup-systems.md#debianubuntu-deb)
21
- * [Exherbo](docs/setup-systems.md#exherbo)
22
- * [Binary (.tar.gz)](docs/setup-systems.md#other-distributions-targz)
23
- * [macOS](docs/setup-systems.md#macos)
24
- * [Homebrew](docs/setup-systems.md#homebrew)
25
- * [Binary (.tar.gz)](docs/setup-systems.md#binary-zip)
26
- * [Windows](docs/setup-systems.md#windows)
27
- * [Chocolatey](docs/setup-systems.md#chocolatey)
28
- * [Binary (.zip)](docs/setup-systems.md#binary-zip)
29
- * [Docker](docs/setup-systems.md#docker)
30
- * [Nix package manager](docs/setup-systems.md#nix-package-manager)
44
+ See our complete [setup guide](docs/setup-systems.md).
31
45
 
32
- ## Enabling autocompletion
46
+ ### Autocompletion
33
47
 
34
- The clever-tools CLI comes with a comprehensive auto-completion system. Some installation methods through package managers will try to enable it automatically. If not, use this for bash:
48
+ Enable smart autocompletion for bash or zsh:
35
49
 
36
50
  ```bash
51
+ # Bash
37
52
  clever --bash-autocomplete-script $(which clever) | sudo tee /usr/share/bash-completion/completions/clever
53
+
54
+ # Zsh
55
+ clever --zsh-autocomplete-script $(which clever) | sudo tee /usr/share/zsh/site-functions/_clever
38
56
  ```
39
57
 
40
- or that for zsh:
58
+ ## Documentation
41
59
 
42
- ```bash
43
- clever --zsh-autocomplete-script $(which clever) | sudo tee /usr/share/zsh/site-functions
44
- ```
60
+ - **[Complete CLI Documentation](https://www.clever-cloud.com/developers/doc/cli/)** - Official user guide
61
+ - **[CLI Reference](https://www.clever-cloud.com/developers/doc/reference/cli/)** - Complete command reference
62
+ - **[Deployment Examples](https://www.clever-cloud.com/developers/guides/)** - Real-world tutorials
45
63
 
46
- ## How to use
64
+ ## Basic Usage
47
65
 
48
- You can then login and check everything is working:
66
+ ### Authentication
49
67
 
50
68
  ```bash
69
+ # Interactive login
51
70
  clever login
71
+
72
+ # Non-interactive login
73
+ clever login --token <your-token> --secret <your-secret>
74
+
75
+ # Or use environment variables, idéal for CI/CD
76
+ export CLEVER_TOKEN="your-token"
77
+ export CLEVER_SECRET="your-secret"
52
78
  clever profile
53
79
  ```
54
80
 
55
- Discover how to use Clever Tools through [our documentation](docs/).
81
+ ### Application Management
56
82
 
57
- ## Examples
83
+ ```bash
84
+ # List applications
85
+ clever applications list
58
86
 
59
- Discover how to deploy many applications on Clever Cloud within [our guides](https://www.clever-cloud.com/developers/guides/).
87
+ # Create a new Node.js/Bun application
88
+ clever applications create --type node
89
+
90
+ # Link existing app to the current directory
91
+ clever link <app_id>
92
+
93
+ # Deploy current directory
94
+ clever deploy
95
+
96
+ # Monitor logs
97
+ clever logs --since 1h
98
+
99
+ # Restart an application
100
+ clever restart --app <app_id>
101
+ ```
60
102
 
61
- ## How to send feedback?
103
+ Learn more in our [Application Management Guide](https://www.clever-cloud.com/developers/doc/cli/applications/).
62
104
 
63
- [Send us an email!](mailto:support@clever-cloud.com) or [submit an issue](https://github.com/CleverCloud/clever-tools/issues).
105
+ ### Add-ons & Services Management
106
+
107
+ ```bash
108
+ # List add-ons
109
+ clever addon
110
+
111
+ # Create a PostgreSQL add-on
112
+ clever addon create postgresql-addon myPG
113
+
114
+ # Create a Cellar (S3-compatible storage) add-on
115
+ clever addon create cellar-addon myCellar
116
+
117
+ # Create and manage a Keycloak service
118
+ clever addon create keycloak myKeycloak
119
+
120
+ clever features enable operatos
121
+ clever keycloak get myKetcloak
122
+ ```
123
+
124
+ Learn more in our [Add-ons & Services Guide](https://www.clever-cloud.com/developers/doc/cli/addons/).
125
+
126
+ # Create and manage
127
+
128
+ ### API Access with clever curl and clever tokens
129
+
130
+ Access Clever Cloud's API directly through authenticated commands:
131
+
132
+ ```bash
133
+ # Get your user information
134
+ clever curl https://api.clever-cloud.com/v2/self
135
+
136
+ # Get platform summary
137
+ clever curl https://api.clever-cloud.com/v2/summary
138
+
139
+ # List your applications (with jq for filtering)
140
+ clever curl https://api.clever.cloud/v2/organisations/<ORG_ID>/applications | jq '.[].id'
141
+
142
+ # Create API tokens for external tools
143
+ clever tokens create myTokenName
144
+ clever tokens create myTokenName --expiration 2w --format json
145
+ ```
146
+
147
+ Learn more about API integration in our [API How-to Guide](https://www.clever-cloud.com/developers/api/howto).
148
+
149
+ ### Get Help
150
+
151
+ ```bash
152
+ clever help # List all commands
153
+ clever <command> --help # Get specific help
154
+ clever --format json <command> # JSON output for scripting
155
+ ```
64
156
 
65
- ## Automated releases
157
+ ## Support & Contributing
66
158
 
67
- This project uses GitHub Actions to build binaries, package them and release them automatically on the various repositories.
68
- If you want to know more or if you need to release a new version, please read [RELEASE.md](./RELEASE.md) carefully.
159
+ - **Issues & Questions**: [GitHub Issues](https://github.com/CleverCloud/clever-tools/issues)
160
+ - **Email Support**: [Ticket Center](https://console.clever-cloud.com/ticket-center-choice)
161
+ - **Contributing**: See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines
69
162
 
70
163
  ## License
71
164
 
72
- This project is licensed under the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html).
165
+ This project is licensed under the [Apache-2.0](LICENSE).