github.com/criteo/command-launcher@v0.0.0-20230407142452-fb616f546e98/README.md (about)

     1  # Command Launcher
     2  
     3  A command launcher 🚀 made with ❤️
     4  
     5  [https://criteo.github.io/command-launcher/](https://criteo.github.io/command-launcher/)
     6  
     7  ## Why a command launcher?
     8  
     9  At Criteo, we have many teams who provides command line applications for developers. These CLI providers repeatly handle the same features and functionalities for their CLI apps, such as auto-completion, credential management, release, delivery, monitoring, etc.
    10  
    11  On developer side, they have to manually download these tools to keep them up-to-date, it is difficult for them to discover available new tools. On the other hand, different developers have developed lots of similar handy scripts/tools by themselves without an easy way to share with others to avoid "re-invent" the wheel.
    12  
    13  To improve both developer and CLI provider's experience, we developed a command launcher to solve the above issues. It has built-in features like auto-completion, credential management, progressive roll-out, and monitoring, so that the CLI app provider can focus on the functionality of their CLI app. Developers only need to download the command launcher to access all these CLI apps. The command launcher will keep their CLI application up-to-date. The dropin feature allows developers to integrate their own scripts/tools into command launcher and share with others. These scripts and tools can also benefits from built-in features like auto-completion, and monitoring.
    14  
    15  ## How it works?
    16  
    17  Command launcher is a small binary downloaded by developer in their development environment. CLI provider packages new commands or new version of command into a package, upload it to a remote repository, and update the package index of the repository. This process can be automated. More details about the remote repository, see [CLI Provider Guide](https://criteo.github.io/command-launcher/docs/overview/provider-guide/)
    18  
    19  Developers can integrate their own commands into command launcher as a "dropin" package. These dropin package will be only accessible from the developers themselves. To share such commands see [Dropin Package](https://criteo.github.io/command-launcher/docs/overview/dropin/)
    20  
    21  Developers run command launcher to access these commands, for example, you have a command called `toto`, instead of run it directly from command line, you use `cola toto`, where `cola` is the binary name of the command launcher, you can name it anything suits you. Every time you execute command launcher, it will synchronize with the remote command, and propose available updates if exists.
    22  
    23  ```
    24  
    25                             ┌──────────────────┐    Synch    ┌───────────────────────────┐
    26              ┌──────────────│ command launcher │◄────────────│ Remote Command Repository │
    27              │              └──────────────────┘             └───────────────────────────┘
    28              │                       │                                      │
    29              │            ┌──────────┼──────────┐              ┌────────────┼────────────┐
    30              ▼            ▼          ▼          ▼              ▼            ▼            ▼
    31         ┌─────────┐   ┌───────┐  ┌───────┐  ┌───────┐     ┌─────────┐  ┌─────────┐  ┌─────────┐
    32         │ dropins │   │ cmd A │  │ cmd B │  │ cmd C │     │  cmd A  │  │  cmd B  │  │  cmd C  │
    33         └────┬────┘   └───────┘  └───────┘  └───────┘     └─────────┘  └─────────┘  └─────────┘
    34       ┌──────┴──────┐
    35       ▼             ▼
    36   ┌────────┐   ┌────────┐
    37   │  cmd D │   │ cmd E  │
    38   └────────┘   └────────┘
    39  ```
    40  
    41  ## Features
    42  
    43  - **Small footprint**. Command launcher is around 10M, with no dependency to your OS.
    44  - **Technology agnostic**. It can launch commands implemented in any technology, and integrate to it with a simple manifest file.
    45  - **Auto-completion**. It supports auto-completion for all your commands installed by it.
    46  - **Auto-update**. Not only keeps itself but all its commands up-to-date.
    47  - **Credential management**. With the built-in login command, it securely passes user credential to your command.
    48  - **Progressive rollout**. Target a new version of command to a group of beta test users, and rollout progressively to all your users.
    49  - **Monitoring**. Built-in monitoring feature to monitor the usage your commands.
    50  - **Dropins**. Easy to intergrate your own command line scripts/tools by dropping your manifest in the "dropins" folder.
    51  
    52  ## Installation
    53  
    54  Pre-built binary can be downloaded from the release page. Unzip it, copy the binary into your PATH.
    55  
    56  The pre-built binary is named `cdt` (Criteo Dev Toolkit), if you want to use a different name, you can pass your prefered name in the build. See build section below.
    57  
    58  ## Contribute
    59  
    60  ### Build
    61  
    62  Requirements: golang >= 1.17
    63  
    64  You can build the command launcher with your prefered name (in the example: `Criteo Developer Toolkit`, a.k.a `cdt`).
    65  ```
    66  go build -o cdt -ldflags='-X main.version=dev -X main.appName=cdt -X "main.appLongName=Criteo Dev Toolkit"' main.go
    67  ```
    68  
    69  Or simply call the `build.sh` scripts
    70  ```
    71  ./build.sh [version] [app name] [app long name]
    72  ```
    73  
    74  ### Run tests
    75  
    76  Run unit tests
    77  
    78  ```shell
    79  go test -v ./...
    80  ```
    81  
    82  Run all integration tests
    83  
    84  ```shell
    85  ./test/integration.sh
    86  ```
    87  
    88  You can run one integration test by specify the name of the integration test file (without the .sh extension). The integration tests can be found in [`test/integration`](https://github.com/criteo/command-launcher/tree/main/test/integration) folder, for example:
    89  
    90  ```shell
    91  ./test/integration.sh test-remote
    92  ```
    93  
    94  ### Run pages locally
    95  
    96  ```
    97  cd gh-pages && npm start
    98  ```
    99  
   100  ### Run doc site locally
   101  
   102  Run `npm install` at the root, and run `npm start` in `gh-pages` folder
   103  
   104  ### Release
   105  
   106  Simply tag a commit with format 'x.y.z', and push it.
   107  
   108  ```
   109  git tag x.y.z
   110  git push origin x.y.z
   111  ```
   112  
   113  The supported release tag format:
   114  
   115  - \*.\*.\*
   116  - \*.\*.\*-\*
   117  
   118  Example: `1.0.0`, `1.0.1-preview`
   119  
   120  > Please make sure you have create an entry in [release-notes.yaml](release-notes.yaml) file so that the release will generate the new version index for auto-update.