# lab: The Legacy GitLab Wrapper CLI

> lab is the older zaquestion GitLab wrapper, superseded by glab. Reference for lab mr create, lab ci status, token env vars, and the migration path in CI.

Source: https://latchkey.dev/learn/command-reference/lab-mr-legacy  
Updated: 2026-06-30

lab is a git wrapper for GitLab with commands like lab mr create; it is largely superseded by the official glab CLI.

lab (zaquestion/lab) was the community GitLab CLI before glab became official. Older pipelines still call it. Its verbs resemble glab but the token env vars differ.

## What it does

lab wraps git and adds GitLab commands: lab mr create opens a merge request, lab ci status shows the pipeline for the current commit, and lab mr list lists MRs. It reads credentials from LAB_CORE_TOKEN and LAB_CORE_HOST or a config file.

## Common usage

```Terminal
# non-interactive auth via env
export LAB_CORE_HOST="https://gitlab.com"
export LAB_CORE_TOKEN="$GLAB_PAT"
# open an MR from the current branch into main
lab mr create origin main -m "Add feature X"
lab ci status
```

## Options

| Command / Env | What it does |
| --- | --- |
| lab mr create <remote> <base> | Open an MR into the base branch |
| -m <msg> | Inline title/description (skips the editor) |
| lab ci status | Pipeline status of the current commit |
| LAB_CORE_HOST | Env var: GitLab host |
| LAB_CORE_TOKEN | Env var: access token |

## In CI

Set LAB_CORE_HOST and LAB_CORE_TOKEN in the environment for non-interactive auth, and pass -m so no editor opens. For anything new, migrate to glab: glab mr create --fill --yes is the modern equivalent and is actively maintained.

## Common errors in CI

"error: 401 Unauthorized" means LAB_CORE_TOKEN is missing or wrong. "GitLab host not set" means LAB_CORE_HOST is empty. An editor opening means -m was omitted. "unknown command" for a newer feature means you should switch to glab.

## Using this in CI

CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.

```.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0   # history, tags, and git describe all need this

- run: |
    git rev-parse --is-shallow-repository   # expect false
    git rev-parse --abbrev-ref HEAD          # prints HEAD when detached
```

> `git rev-parse --abbrev-ref HEAD` returns the literal string `HEAD` on a detached checkout rather than a branch name. On GitHub Actions read `github.ref_name` instead; the git command cannot know what it was checked out for.

## FAQ

### lab: The Legacy GitLab Wrapper CLI?

lab (zaquestion/lab) was the community GitLab CLI before glab became official. Older pipelines still call it. Its verbs resemble glab but the token env vars differ.

### What it does?

lab wraps git and adds GitLab commands: lab mr create opens a merge request, lab ci status shows the pipeline for the current commit, and lab mr list lists MRs. It reads credentials from LAB_CORE_TOKEN and LAB_CORE_HOST or a config file.

### In CI?

Set LAB_CORE_HOST and LAB_CORE_TOKEN in the environment for non-interactive auth, and pass -m so no editor opens. For anything new, migrate to glab: glab mr create --fill --yes is the modern equivalent and is actively maintained.

### Common errors in CI?

"error: 401 Unauthorized" means LAB_CORE_TOKEN is missing or wrong. "GitLab host not set" means LAB_CORE_HOST is empty. An editor opening means -m was omitted. "unknown command" for a newer feature means you should switch to glab.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
