Manage the CLI environment
Table of contents
- Introduction
- What
make setupdoes - Knowing which product is selected
- The workspace
.env - The pre-flight
- Fixing common problems
Introduction
The make targets of the CLI repository run on your host, before you are inside the container. They create and repair the workspace .env, start the CLI container and open its shell. Once inside, you use splent commands instead.
The first time, run this from splent_cli/.
make setup
π οΈ SPLENT fix-workdir
[β] SPLENT_HOST_PROJECT_DIR set to /home/me/splent_workspace
...
π©Ί SPLENT CLI pre-flight
[β] Docker installed, Docker version 29.2.1, build a5c7197d72
...
β
Pre-flight passed.
π³ Starting containers...
π³ Using UID=1000 GID=1000
π§ Entering SPLENT CLI...
(detached) /workspace$
Every step is safe to run again. From then on, make cli is all you need.
What make setup does
Each step is a target you can also run alone.
| Target | What it does |
|---|---|
make setup |
Prepares .env, starts Docker and enters the CLI |
make setup-rebuild |
Tears down, rebuilds the images from scratch and enters. Destructive, asks first |
make docker-up |
Prepares .env, then starts the container |
make cli |
Enters the running container |
make help |
Lists every target |
make env-prepare |
Creates .env from the template and repairs it |
make env-check |
Validates .env |
make fix-workdir |
Repairs SPLENT_HOST_PROJECT_DIR and WORKING_DIR |
make fix-app |
Clears a dangling SPLENT_APP |
make fix-env |
Repairs, then validates |
make preflight |
Runs the host checks only |
Only make setup-rebuild removes data.
Knowing which product is selected
Inside the container, the prompt tells you.
| Prompt | Meaning |
|---|---|
(detached) /workspace$ |
No product selected |
(my_product) /workspace$ |
SPLENT_APP=my_product and the folder exists |
(my_product?) /workspace$ |
SPLENT_APP names a missing folder. Run make fix-app |
The workspace .env
splent_workspace/
βββ .env β the real file (git-ignored, host-specific)
βββ splent_cli/
β βββ .env.example β the committed template
β βββ Makefile
β βββ scripts/
βββ splent_framework/
βββ <your products>/
It sits at the workspace root, one level above splent_cli/, and starts as a copy of the committed template.
| Variable | Set by | Purpose |
|---|---|---|
WORKING_DIR |
template | The workspace inside the container, always /workspace |
SPLENT_HOST_PROJECT_DIR |
fix-workdir |
The same folder on the host. Product containers bind-mount it through the Docker socket |
SPLENT_APP |
splent product:select |
The selected productβs name. Unset means detached mode. See Another product for one command |
SPLENT_APP_DIR |
splent product:select |
The folder the selected product is checked out in, which need not be its name |
SPLENT_ENV |
splent product:up, splent product:deploy |
dev or prod, written into the productβs docker/.env, which the CLI loads while the product is selected. dev when unset |
SPLENT_FORGE_USER, SPLENT_FORGE_TOKEN |
you, or splent env:set forge |
Your forge account, to clone and release over HTTPS. GITHUB_USER and GITHUB_TOKEN are read when they are unset |
SPLENT_FORGE_HOST, SPLENT_FORGE_SSH_HOST, SPLENT_FORGE_SSH_PORT, SPLENT_FORGE_API |
you, optional | The forge that hosts the features. Empty means git.splent.io, SSH on port 2223 |
TWINE_USERNAME, TWINE_PASSWORD |
you, or splent env:set pypi |
PyPI credentials for publishing |
How the repairs write .env
env-prepare, fix-workdir, fix-app and fix-env change only the keys they repair, indented and export-prefixed ones included, and keep every other line.
- They write through a temporary file next to
.envand keep its mode, or its targetβs when.envis a symlink. - A value with spaces or shell-special characters, such as a workspace under
my projects, is written single-quoted. Docker Compose, python-dotenv and bash all read it literally. - When you cannot read and write
.env, they change nothing and exit 1.
Cannot read and write <path>, so it was left untouched.
Make it a regular file you own (for example: chmod 600 <path>), then re-run.
The pre-flight
Every target that starts or enters the container first runs the host pre-flight. It checks Docker, Compose, your git and SSH setup and the .env. A duplicate or malformed key stops it. A stale host path or a dangling product only warns and names the repair.
Fixing common problems
| Symptom | Run |
|---|---|
| You moved or renamed the workspace folder | make fix-workdir |
The prompt shows (name?) in yellow |
make fix-app |
Duplicate variable β¦ |
Keep one line, then make env-check |
.env not found |
make env-prepare |
Container is bound to another workspace |
make docker-up recreates it for this workspace |
Docker daemon is not responding |
Start Docker, then make preflight |
| The image is stale after Docker or dependency changes | make setup-rebuild |