Aller au contenu
Bastide Connexion Créer un compte
Press / to search

The bastide command line

FrançaisMarkdownv0.3.0

The bastide command drives the platform from a terminal or a continuous integration script: sign in, link a folder to a project, deploy while following the log live, and call any operation in the registry. This page explains how to install it, how to sign in, and what a script can expect from its output.

Install

npm install -g bastide && bastide login

Without installing, npx bastide login does the same. Other ways to install, including a standalone binary that needs no Node, are described with their SHA-256 checksums at https://bastide.app/installer.

When a newer version exists, the command says so once a day on standard error, in a terminal only. It never updates itself: npm install -g bastide does.

Note. The old names gs and glowsoft still work for one more version, with a warning. Your scripts should move to bastide.

Sign in

bastide login uses device authorisation (RFC 8628): no password goes through the terminal.

  1. The command prints an address and an eight-letter code, and opens your browser if it can. With --sans-navigateur (no browser), it only prints the address.
  2. The console screen Autoriser la ligne de commande (Authorise the command line), at https://console.bastide.app/appareil, shows the code. Check that it matches your terminal; if not, deny. Sign in first if needed, second factor included.
  3. Choose Autoriser (Authorise). The terminal receives a personal token valid for 90 days, carrying your rank and every scope. The code expires after ten minutes.
  4. The command stores the token and reads your organisations.

Where the token goes: to the system keychain (security on macOS, secret-tool on Linux, the credential vault on Windows). On a machine without a keychain, it goes to an identifiants.json file readable by its owner only, and login says so. The token is stored per API address.

CommandEffect
bastide loginSign in through the browser.
bastide whoamiSay where the token comes from (environment, keychain or file) and which organisations it opens.
bastide logoutRemove the token from this machine. It stays valid on the platform: revoke it from Compte (Account) if needed.

The login token appears in Compte, section "Vos jetons" (your tokens), under the name "Ligne de commande bastide (date)".

bastide link --project-id prj_01JQ8ZK4M7NP2RSTVWXYZ34567
bastide deploy

link writes .glowsoft/project.json in the current folder, with the project and organisation identifiers. Any command run in that folder or below takes from it the project you do not name. --repertoire <path> starts from another folder.

deploy runs deployment.create on the production environment (or --environment-id), at reference --ref or the environment's branch, then follows the state and the build log until a final state, and prints the address being served. --sans-suivi (no follow) returns as soon as the deployment is created. Ctrl-C stops the following, never the deployment: it carries on on the platform. Following stops by itself after thirty minutes.

bastide logs reads the environment's runtime logs; with --suivre (follow), it keeps printing incoming lines. --since and --query narrow the read.

bastide doctor compares the local folder with the deployed environment: runtime version, package manager, framework, install, build and start commands, variables present on one side only, served commit, redirects and rewrites. For each difference it gives the command that brings both sides together, and exits with code 11 if it finds one. It compares variable names, never their values.

Generated commands

Every operation in the registry is a command, with no line written for it. The path comes from the operation name: bastide <resource> <action>, with as many words as segments.

OperationCommand
project.listbastide project list --organization-id org_…
deployment.log.readbastide deployment log read --project-id prj_… --deployment-id dep_…
env.write.nonproductionbastide env write nonproduction --project-id prj_… --environment-id env_… …
service_token.createbastide service_token create --organization-id org_… …
  • Options are the input fields, written with hyphens: projectId becomes --project-id.
  • A list is given by repeating the option, or at once as JSON: --scopes project:read --scopes deploy:write, or --scopes '["project:read","deploy:write"]'. An object is given as JSON.
  • bastide aide (help) lists every command; bastide aide <command> or --aide describes its options.
  • Write operations accept --idempotency-key: see the API.

The full list, option by option, is in the command line reference.

Output and scripts

No command opens a prompt: nothing waits for keyboard input. Only login opens the browser.

  • Without options, output is meant for a person and may change layout from one version to the next. Content reported by a third party (a project name, a commit message) is followed by "(rapporté)" (reported).
  • With --json, output is the response body as the API publishes it, on one line. Its schema is the OpenAPI document's: it is a stable contract. An error is then written to standard error as {"erreur": {"code", "cause", "suite", "message", "statut", "sortie"}}.
  • deploy --json and logs --json write one JSON line per event: {"evenement":"cree",…}, {"evenement":"ligne","texte":…}, {"evenement":"etat",…}, {"evenement":"fin","deploymentId",…,"url"}.

Every error gives its cause and what to do next, most often the command to run.

Confirming an operation

A class E or I operation (see reversibility) needs --yes. Without it, the command does not send it and exits with code 12. An irreversible operation is also confirmed in two steps: the first call returns the confirmation_requise refusal with a nonce; run the same command again with --confirmation-nonce <nonce> within five minutes.

Exit codes

Codes follow the family of the cause, not the HTTP status. A number never changes meaning. bastide aide sorties lists them.

CodeMeaning
0The operation succeeded.
1A fault in the command line itself.
2The command or its options are malformed; nothing was sent.
3The machine is not configured: token, API address or project link missing.
4The platform does not recognise the token presented.
5The platform recognised the caller and refused the operation.
6The resource does not exist, or not for this caller.
7The resource's current state does not allow the operation.
8A rate or quantity cap is reached.
9The platform failed or is not ready; the call can be retried.
10The platform did not answer: address unreachable or timeout.
11doctor found at least one difference between the machine and what is deployed.
12The operation is destructive or irreversible and --yes was not given.
13deploy followed the deployment to the end: it failed, or was not put live.

A script retries on 9 and 10, and gives up on 2 to 7.

Environment variables

VariableRole
BASTIDE_TOKENThe token to present. It takes precedence over the keychain: in continuous integration nothing else is consulted. GLOWSOFT_TOKEN is accepted too.
BASTIDE_API_URLThe API address, https://api.bastide.app by default. It must start with https://. GLOWSOFT_API_URL is accepted too.
GLOWSOFT_DELAIThe timeout of one call, in seconds, from 1 to 600; 30 by default.
BASTIDE_SANS_ANNONCEWhen set, turns off the new-version notice. CI turns it off as well.

A continuous integration example is in Service accounts and tokens.

Common errors

CodeCauseFix
jeton_absentNo token: neither variable nor keychain.bastide login, or set BASTIDE_TOKEN.
projet_non_lieNo link and no --project-id.bastide link --project-id …, or pass the option.
confirmation_absenteThe operation needs --yes.Run it again with --yes if you mean it.
connexion_expireeThe login code was not approved in time.Run bastide login again.
unauthenticatedThe token expired, was revoked or disabled.bastide login again.
operation_non_servieThe operation is declared but not served yet.None: it is not available.

See also

Report a mistake on this page