-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cli): Added CLI #289
feat(cli): Added CLI #289
Conversation
PR Reviewer Guide 🔍
|
PR Code Suggestions ✨
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #289 +/- ##
===========================================
- Coverage 91.71% 88.04% -3.68%
===========================================
Files 111 107 -4
Lines 2510 2308 -202
Branches 469 356 -113
===========================================
- Hits 2302 2032 -270
- Misses 208 276 +68
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Quality Gate passedIssues Measures |
## [2.1.0](v2.0.0...v2.1.0) (2024-06-27) ### 🚀 Features * **api:** Add `requireRestart` parameter ([#286](#286)) ([fb447a1](fb447a1)) * **cli:** Added CLI ([#289](#289)) ([1143d95](1143d95)) * **workflows:** Tag user on attempt's reply body ([9d01698](9d01698)) ### 🐛 Bug Fixes * **web:** Resolve encryption glitch in footer text ([#267](#267)) ([2b5cb39](2b5cb39)) ### 📚 Documentation * added running-the-web-app.md ([#269](#269)) ([755ea12](755ea12))
## [2.1.0](v2.0.0...v2.1.0) (2024-06-27) ### 🚀 Features * **api:** Add `requireRestart` parameter ([#286](#286)) ([fb447a1](fb447a1)) * **cli:** Added CLI ([#289](#289)) ([1143d95](1143d95)) * **workflows:** Tag user on attempt's reply body ([9d01698](9d01698)) ### 🐛 Bug Fixes * **web:** Resolve encryption glitch in footer text ([#267](#267)) ([2b5cb39](2b5cb39)) ### 📚 Documentation * added running-the-web-app.md ([#269](#269)) ([755ea12](755ea12))
## [2.1.0](keyshade-xyz/keyshade@v2.0.0...v2.1.0) (2024-06-27) ### 🚀 Features * **api:** Add `requireRestart` parameter ([keyshade-xyz#286](keyshade-xyz#286)) ([fb447a1](keyshade-xyz@fb447a1)) * **cli:** Added CLI ([keyshade-xyz#289](keyshade-xyz#289)) ([1143d95](keyshade-xyz@1143d95)) * **workflows:** Tag user on attempt's reply body ([9d01698](keyshade-xyz@9d01698)) ### 🐛 Bug Fixes * **web:** Resolve encryption glitch in footer text ([keyshade-xyz#267](keyshade-xyz#267)) ([2b5cb39](keyshade-xyz@2b5cb39)) ### 📚 Documentation * added running-the-web-app.md ([keyshade-xyz#269](keyshade-xyz#269)) ([755ea12](keyshade-xyz@755ea12))
User description
Description
The CLI
The main aim of this PR is to add the base keyshade CLI. Right now, the CLI is very fragile (mostly contains experimental code), but contains two of the main commands:
keyshade configure
keyshade run
These commands will allow you to configure any project of yours to be configured and used with keyshade.
Changes in API
We had to make some changes to how the API sent data to the CLI. We added a few endpoints and modified some. One of the things we would like to point out is, secrets would be sent in plain text to the users for now if the project contains the private key and the user has access to it.
Testing the CLI
PORT_NUMBER
apps/cli
and runpnpm watch
node dist/index.js configure
(fromapps/cli
)run
command usingnode dist/index.js run "node test.js"
Notice how the program will start printing the
PORT_NUMBER
value. Try adding a revision, say setting the value to something else. Observe the CLI pick the change and reflect it automatically.PR Type
Enhancement, Documentation
Description
configure
andrun
with real-time updates and configuration management.Changes walkthrough 📝
22 files
run.command.ts
Implement `RunCommand` for executing commands with real-time updates
apps/cli/src/commands/run/run.command.ts
RunCommand
class to handle therun
command.executing commands.
secret.service.ts
Enhance secret service with environment-specific methods and
notifications
apps/api/src/secret/service/secret.service.ts
flag.
variable.service.ts
Enhance variable service with environment-specific methods and
notifications
apps/api/src/variable/service/variable.service.ts
plaintext flag.
configure.command.ts
Implement `ConfigureCommand` for CLI configuration management
apps/cli/src/commands/configure/configure.command.ts
ConfigureCommand
class to handle theconfigure
command.configuration.ts
Add configuration utility functions for CLI
apps/cli/src/util/configuration.ts
configurations.
variable.controller.ts
Add endpoint for fetching all variables of a project and environment
apps/api/src/variable/controller/variable.controller.ts
updateVariable
method to useUpdateVariable
DTO.api-key.service.ts
Enhance API key update logic with authority merging
apps/api/src/api-key/service/api-key.service.ts
updateApiKey
method to merge existing and new authorities.logger.ts
Add Logger utility for formatted logging
apps/cli/src/util/logger.ts
Logger
utility with methods for logging info, error, andwarning messages.
chalk
andmoment
for formatted logging.secret.ts
Add SecretController for fetching secrets via HTTP
apps/cli/src/http/secret.ts
SecretController
for fetching secrets via HTTP.variable.ts
Add VariableController for fetching variables via HTTP
apps/cli/src/http/variable.ts
VariableController
for fetching variables via HTTP.change-notifier.socket.ts
Enhance client registration with detailed response and logging
apps/api/src/socket/change-notifier.socket.ts
registration.
index.ts
Set up CLI entry point with commander
apps/cli/src/index.ts
commander
.ConfigureCommand
andRunCommand
.auth.guard.ts
Enhance AuthGuard error handling for API key validation
apps/api/src/auth/guard/auth/auth.guard.ts
AuthGuard
for API key validation.auth.ts
Add AuthController for API key validation
apps/cli/src/http/auth.ts
AuthController
for checking API key validity via HTTP.secret.controller.ts
Add endpoint for fetching all secrets of a project and environment
apps/api/src/secret/controller/secret.controller.ts
api-key.controller.ts
Add endpoint to check API key access for live updates
apps/api/src/api-key/controller/api-key.controller.ts
socket.types.ts
Update socket types with client registration response and plaintext
flag
apps/api/src/socket/socket.types.ts
ClientRegisteredResponse
interface.isSecret
toisPlaintext
inChangeNotification
interface.run.types.d.ts
Add TypeScript definitions for run command types
apps/cli/src/commands/run/run.types.d.ts
Configuration
andClientRegisteredResponse
.configure.types.d.ts
Add TypeScript definitions for configure command types
apps/cli/src/commands/configure/configure.types.d.ts
ProjectRootConfig
andUserRootConfig
.index.ts
Export HTTP controllers for CLI
apps/cli/src/http/index.ts
SecretController
,VariableController
, andAuthController
.command.interface.ts
Define BaseCommand interface for CLI commands
apps/cli/src/commands/base/command.interface.ts
BaseCommand
interface for CLI commands.constants.ts
Add API base URL constant
apps/cli/src/util/constants.ts
API_BASE_URL
constant.5 files
.eslintrc.js
Add ESLint configuration for CLI
apps/cli/.eslintrc.js
package.json
Update package.json with CLI scripts and dependencies
package.json
package.json
Create package.json for CLI project
apps/cli/package.json
tsconfig.json
Add TypeScript configuration for CLI
apps/cli/tsconfig.json
docker-compose.yml
Add volumes to docker-compose for persistent storage
docker-compose.yml
1 files
pnpm-lock.yaml
Update dependencies and add new ones for CLI
pnpm-lock.yaml
commander
,socket.io-client
, andtypescript
.