Command Line Interface
Introduction
A Command Line Interface (CLI) is a text-based interface that enables users to interact with a computer program. YepCode provides both a Graphic User Interface (GUI), accessible at https://cloud.yepcode.io, and a CLI for interacting with YepCode Cloud.
YepCode CLI
The YepCode Command Line Interface facilitates interaction with YepCode Cloud directly from your local workstation's command line. It's particularly useful if you prefer developing and testing processes' source code locally rather than using the web IDE of YepCode Cloud.
By using YepCode CLI, you can employ version control systems like git
to manage your code and synchronize your repository with YepCode Cloud. In essence, the CLI allows you to run commands such as clone
to download all your team workspaces, run
to test your code locally, and push
to upload changes to YepCode Cloud.
Watch the video below for an overview of how YepCode CLI can be used (Spanish version):
Video was recorded when it was needed to ask for access to install CLI. Right now is open to every YepCode user.
Installation
YepCode CLI is published on npmjs so just install it as any other nodejs package:
npm install -g @yepcode/cli
Usage
Ask for help
As with any other command-line tool, you can run the help command to display the list of available commands:
$ yepcode help
YepCode Command Line Interface
VERSION
@yepcode/cli/1.0
USAGE
$ yepcode [COMMAND]
COMMANDS
clone Clone team processes
help Display help for yepcode.
login Login to the service
logout Logout from service
...
Login to your YepCode account
Before interacting with your account, you need to log in. These credentials are personal and grant you access to your YepCode teams.
$ yepcode login
What is your yepcode email?: ada.lovelace@yepcode.io
What is your yepcode password (not stored)?: **********
🔑 Checking credentials... done
👐 Hi, Ada Lovelace!
The cli uses a local folder .yepcode
to store credentials and metadata. By default this folder is in your HOME directory, but you may configure it using the YEPCODE_CONFIG_PATH
env variable.
You can provide your credentials using the credentials prompt, or you can use the --email
and --password
options.
$ yepcode login --email your-email --password your-password
We don't yet support the external identity providers in YepCode CLI (Google Auth, Github or Microsoft).
If you have used it to create your account, you need ask for a password reset and setup one:
Logout from your YepCode account
Perform a logout to remove access to your YepCode account.
$ yepcode logout
👋 Bye!
Clone your team workspace locally
Clone one of your team workspaces using:
$ yepcode clone ada-lovelace
fetching processes...
fetching modules...
fetching credentials...
fetching variables...
🎉 ada-lovelace team processes cloned successfully!
$ cd ada-lovelace
If you don't provide parameters to the clone
command, you'll see the list of available teams.
$ yepcode clone
🏢 Allowed teams:
ada-lovelace
sandbox
Inspect the generated folder, and you'll see some folders and files:
📦 ada-lovelace
┣ 📂 credentials
┃ ┣ 📜 <credential-slug>.json
┃ ┗ 📜 ...
┣ 📂 modules
┃ ┣ 📂 <javascript-module-slug>
┃ ┃ ┗ 📜 <module-slug>.js
┃ ┣ 📂 <python-module-slug>
┃ ┃ ┗ 📜 <module-slug>.py
┃ ┣ 📂 <module-with-versions>
┃ ┃ ┣ 📂 versions
┃ ┃ ┃ ┣ 📂 v1.0
┃ ┃ ┃ ┃ ┗ 📜 <module-slug>.js
┃ ┃ ┃ ┗ 📂 ...
┃ ┃ ┗ 📜 <module-slug>.js
┃ ┗ 📂 ...
┣ 📂 processes
┃ ┣ 📂 <javascript-process-slug>
┃ ┃ ┣ 📜 README.md
┃ ┃ ┣ 📜 index.js
┃ ┃ ┣ 📜 parametersSchema.json
┃ ┃ ┗ 📜 parameters.json
┃ ┣ 📂 <python-process-slug>
┃ ┃ ┣ 📜 README.md
┃ ┃ ┣ 📜 main.py
┃ ┃ ┣ 📜 parametersSchema.json
┃ ┃ ┗ 📜 parameters.json
┃ ┣ 📂 <process-slug-with-versions>
┃ ┃ ┣ 📂 versions
┃ ┃ ┃ ┣ 📂 v1.0
┃ ┃ ┃ ┃ ┣ 📜 README.md
┃ ┃ ┃ ┃ ┣ 📜 index.js
┃ ┃ ┃ ┃ ┣ 📜 parametersSchema.json
┃ ┃ ┃ ┃ ┗ 📜 parameters.json
┃ ┃ ┃ ┗ 📂 ...
┃ ┃ ┣ 📜 README.md
┃ ┃ ┣ 📜 index.js
┃ ┃ ┣ 📜 parametersSchema.json
┃ ┃ ┗ 📜 parameters.json
┃ ┗ 📂 ...
┣ 📜 .gitignore
┣ 📜 .yepcode.json
┣ 📜 datastore.json
┗ 📜 variables.env
processes
: Processes' source code, with one folder per process, containing process files.README.md
: Markdown file with the process description.index.js
orindex.py
: Process source code in JavaScript or Python.parametersSchema.json
: Parameters schema JSON file.parameters.json
: Sample input file dynamically generated. It will be used as default input file in local executions, but you may provide another one.versions
: if process has published versions, a new folder will exists and each version folder will have a process replica with the published contents.
credentials
: Includes one file per team credential. Sensitive information won't be filled, so for local execution testing, you must fill the values.modules
: Modules' source code, with one folder per module, containing the module file.versions
: if module has published versions, a new folder will exists and each version folder will have a module replica with the published contents.
variables.env
: Includes all team variables in .env file format (KEY=VALUE).datastore.json
: YepCode datastore file..gitignore
: Auto generated gitignore file. It will be used if you create a git repo for this directory to ignore sensitive resources (credentials and variables .env)..yepcode.json
: YepCode workspace metadata file.
Sensitive credentials and variables won't be filled, so for local execution testing, you must fill the values.
.yepcode.json
is a JSON file containing workspace metadata and is not meant to be edited by the user.
Execute processes locally
Execute a process locally using the run
command:
$ yepcode run <process-slug>
To see the list of available processes, use the processes:status
command.
By default, the process is executed using the parameters.json
file located in the process folder. You may provide another input params using the --parameters
option:
$ yepcode run <process-slug> --parameters path/to/parameters.json
Manage package dependencies
YepCode support custom dependencies to use any npmjs or pypi package in your processes. Check dependencies section for more information.
In order to run a process, you need to install your team configured dependencies. You can do that with the dependencies
command:
$ yepcode dependencies [all|javascript|python]
There are two flags to manage dependencies:
--check
: Check if dependencies are installed and installed versions are up to date.--reset
: Performs a full reinstall of configured dependencies.
By default, dependencies are installed inside ~/.yepcode/dependencies
, but remember that you may configure this using the YEPCODE_CONFIG_PATH
env variable.
Pull changes from cloud
If you or your colleages have performed changes in YepCode cloud, update your local files.
Fetch all credentials from cloud and save them locally:
$ yepcode pull
fetching processes...
- [new] -> Create process name (<process-slug>)
- [updated] -> Updated process name (<process-slug>)
- [deleted] -> Deleted process name (<process-slug>)
modules are up to date.
credentials are up to date.
variables are up to date.
If you or your team have modified process both locally and in the cloud, the CLI prompts you on how to resolve conflicts:
🔥 conflictive-process-name (<process-slug>) has been modified both remote and local!
Do you want to override local changes? yes/no:
Push changes to cloud
After upgrading your processes or modules locally, update your cloud workspace from local changes using push
command.
$ yepcode push
uploading processes...
[uploaded] -> modified-process-name (<process-slug>) uploaded to remote.
[overwritten] -> conflictive-process-name (<process-slug>) overwritten in remote.
If you or your team have modified processes both locally and in the cloud, CLI prompts you on how to resolve conflicts:
🔥 conflictive-process-name (<process-slug>) has been modified both origin and local!
Do you want force push to origin? yes/no:
Add local created resources
If you have created resources on your local workspace, you can add them to keep track and after that they could be pushed to remote:
ℹ️ 1 processes only existing in local: a-new-local-process
Use command 'yepcode processes:add' to keep track of these resources
Using the yepcode processes:add
command, it will be added and then will be shown in the status log.
Add new remote cloud team
YepCode CLI is able to work with multiple remotes. This is pretty interesting to keep sync processes or modules between those environments.
Let's say that you have a YepCode staging enviroment where you test your code before going to production. You cloud clone the staging environment and then add a new remote for the production envinroment. This is done with the yepcode remote
command:
$ yepcode remote
Add a remote team workspace
USAGE
$ yepcode remote:COMMAND
COMMANDS
remote:add Add a remote team workspace
remote:set Set the active remote team workspace
After adding a new remote, it may be needed to perform a yepcode add
just to keep track of the files in this new environment. After that, you could go with a yepcode push
to deploy changes to the cloud.
Resource topics
Each workspace resource has a dedicated topic, allowing you to manage your workspace resources independently using topics (credentials, modules, processes, variables):
Topic/Command | status | pull | push |
---|---|---|---|
processes | ✅ | ✅ | ✅ |
modules | ✅ | ✅ | ✅ |
credentials | ✅ | ✅ | ✨ (just create) |
variables | ✅ | ✅ | ✨ (just create) |
List resources
You may list all available resources using the status
command:
$ yepcode processes:status
processes status:
slug name status
────────────────────────────── ────────────────────────────────── ────────────────
hello-world Hello world ✅ (up-to-date)
stripe-customers-from-supabase Stripe Customers From Supabase Bar ✅ (up-to-date)
Pull resources changes from cloud
In addition, you can fetch resources from the cloud ansd update locally:
$ yepcode credentials:pull
fetching credentials...
credentials are up to date.
Push resources changes to cloud
You can update cloud resources with local changes:
$ yepcode modules:push
updating modules...
modules up-to-date
If you or your team have modified processes both locally and in the cloud, the CLI prompts you on how to resolve conflicts using both pull
and push
commands
Update CLI
If you want to update the CLI, you can do it using the npm install
command:
$ npm install -g @yepcode/cli
If a new version is available, you will be notified to update the CLI.
$ yepcode --version
__ __ _____ _
\ \ / / / ____| | |
\ \_/ /__ _ __ | | ___ __| | ___
\ / _ \ '_ \| | / _ \ / _` |/ _ \
| | __/ |_) | |___| (_) | (_| | __/
|_|\___| .__/ \_____\___/ \__,_|\___|
| |
|_|
Update available x.y.z → X.Y.Z
Run `npm i -g @yepcode/cli` to update
@yepcode/cli/x.y.z darwin-x64 node-v16.x.x