@getmonoceros/workbench 1.23.2 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
id: gitlab-cli
|
|
2
|
+
name: gitlab
|
|
3
|
+
category: feature
|
|
4
|
+
displayName: GitLab CLI
|
|
5
|
+
description: 'The official GitLab CLI (`glab`) for merge requests, issues, CI/CD pipelines and releases. Targets gitlab.com or a self-managed host. Login persists across container rebuilds.'
|
|
6
|
+
documentationURL: https://gitlab.com/gitlab-org/cli
|
|
7
|
+
options:
|
|
8
|
+
version:
|
|
9
|
+
type: string
|
|
10
|
+
default: latest
|
|
11
|
+
description: 'glab release to install: `latest` (resolved from the GitLab release API at build) or a pinned version like `1.102.0`.'
|
|
12
|
+
surface: silent
|
|
13
|
+
apiToken:
|
|
14
|
+
type: string
|
|
15
|
+
default: ''
|
|
16
|
+
description: 'GitLab personal access token (scopes: `api`, `write_repository`); exported as GITLAB_TOKEN. Empty for `glab auth login` on first run.'
|
|
17
|
+
surface: env
|
|
18
|
+
host:
|
|
19
|
+
type: string
|
|
20
|
+
default: ''
|
|
21
|
+
description: 'Self-managed/Dedicated GitLab host (e.g. `gitlab.example.com`); empty targets gitlab.com. Exported as GITLAB_HOST, so every `glab` command uses it without `--hostname`.'
|
|
22
|
+
surface: yml
|
|
23
|
+
feature:
|
|
24
|
+
version: 1.0.0
|
|
25
|
+
persistentHomePaths: [.config/glab-cli]
|
|
26
|
+
vscodeExtensions: [GitLab.gitlab-workflow]
|
|
27
|
+
briefing:
|
|
28
|
+
- text: 'GitLab CLI (`glab`) — merge requests, issues, CI/CD pipelines and releases. Targets the configured GitLab host (gitlab.com unless `host` was set). Pre-authenticated when a token was set; `glab auth status` shows the active account.'
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Monoceros devcontainer feature: gitlab-cli.
|
|
3
|
+
#
|
|
4
|
+
# Installs the official GitLab CLI (`glab`) from the project's release
|
|
5
|
+
# artifacts on gitlab.com — deliberately NOT the distro apt package,
|
|
6
|
+
# which lags far behind (often ~a year). The version to install is
|
|
7
|
+
# resolved at build time: `latest` asks the GitLab release API for the
|
|
8
|
+
# newest tag; a pinned `version` installs exactly that. `monoceros
|
|
9
|
+
# upgrade` rebuilds and re-fetches, so the tool stays current (ADR 0018).
|
|
10
|
+
#
|
|
11
|
+
# Auth is via the GITLAB_TOKEN / GITLAB_HOST environment variables, which
|
|
12
|
+
# glab reads directly — so when `apiToken` (and optionally `host`) are
|
|
13
|
+
# set, a /etc/profile.d snippet is enough and no `glab auth login` step
|
|
14
|
+
# is needed. Config/login state lives at ~/.config/glab-cli, bind-mounted
|
|
15
|
+
# from the host so it survives apply rebuilds.
|
|
16
|
+
|
|
17
|
+
set -euo pipefail
|
|
18
|
+
|
|
19
|
+
VERSION="${VERSION:-latest}"
|
|
20
|
+
APITOKEN="${APITOKEN:-}"
|
|
21
|
+
HOST="${HOST:-}"
|
|
22
|
+
|
|
23
|
+
ARCH="$(dpkg --print-architecture)"
|
|
24
|
+
case "${ARCH}" in
|
|
25
|
+
amd64 | arm64) ;;
|
|
26
|
+
*)
|
|
27
|
+
echo "[gitlab-cli] unsupported architecture: ${ARCH}" >&2
|
|
28
|
+
exit 1
|
|
29
|
+
;;
|
|
30
|
+
esac
|
|
31
|
+
|
|
32
|
+
# Resolve the release tag. `latest` → newest tag from the GitLab release
|
|
33
|
+
# API; otherwise normalise the pinned value to a `v`-prefixed tag.
|
|
34
|
+
if [ "${VERSION}" = "latest" ]; then
|
|
35
|
+
echo "[gitlab-cli] resolving latest release from gitlab.com"
|
|
36
|
+
TAG="$(curl -fsSL 'https://gitlab.com/api/v4/projects/gitlab-org%2Fcli/releases/permalink/latest' | jq -r '.tag_name')"
|
|
37
|
+
if [ -z "${TAG}" ] || [ "${TAG}" = "null" ]; then
|
|
38
|
+
echo "[gitlab-cli] ERROR: could not resolve the latest glab release" >&2
|
|
39
|
+
exit 1
|
|
40
|
+
fi
|
|
41
|
+
else
|
|
42
|
+
TAG="v${VERSION#v}"
|
|
43
|
+
fi
|
|
44
|
+
VER="${TAG#v}"
|
|
45
|
+
|
|
46
|
+
URL="https://gitlab.com/gitlab-org/cli/-/releases/${TAG}/downloads/glab_${VER}_linux_${ARCH}.tar.gz"
|
|
47
|
+
echo "[gitlab-cli] downloading glab ${VER} for ${ARCH}"
|
|
48
|
+
TMP="$(mktemp -d)"
|
|
49
|
+
curl -fsSL -o "${TMP}/glab.tar.gz" "${URL}"
|
|
50
|
+
tar -xzf "${TMP}/glab.tar.gz" -C "${TMP}"
|
|
51
|
+
|
|
52
|
+
# Locate the binary in the tarball rather than assuming its layout.
|
|
53
|
+
BIN="$(find "${TMP}" -type f -name glab | head -n1)"
|
|
54
|
+
if [ -z "${BIN}" ]; then
|
|
55
|
+
echo "[gitlab-cli] ERROR: glab binary not found in the release tarball" >&2
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
install -o root -g root -m 0755 "${BIN}" /usr/local/bin/glab
|
|
59
|
+
rm -rf "${TMP}"
|
|
60
|
+
|
|
61
|
+
glab --version >/dev/null 2>&1 || {
|
|
62
|
+
echo "[gitlab-cli] ERROR: install completed but \`glab\` is not on PATH" >&2
|
|
63
|
+
exit 1
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# Auth/config via environment (glab reads GITLAB_TOKEN / GITLAB_HOST
|
|
67
|
+
# directly). We write the profile.d snippet when there is anything to
|
|
68
|
+
# export: a token, a host, or both.
|
|
69
|
+
if [ -n "${APITOKEN}" ] || [ -n "${HOST}" ]; then
|
|
70
|
+
{
|
|
71
|
+
echo "# Auto-generated by the Monoceros gitlab-cli feature."
|
|
72
|
+
if [ -n "${APITOKEN}" ]; then
|
|
73
|
+
echo "export GITLAB_TOKEN='${APITOKEN}'"
|
|
74
|
+
fi
|
|
75
|
+
if [ -n "${HOST}" ]; then
|
|
76
|
+
echo "export GITLAB_HOST='${HOST}'"
|
|
77
|
+
fi
|
|
78
|
+
} >/etc/profile.d/gitlab-cli.sh
|
|
79
|
+
chmod 0644 /etc/profile.d/gitlab-cli.sh
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
if [ -n "${APITOKEN}" ]; then
|
|
83
|
+
echo "[gitlab-cli] apiToken wired via /etc/profile.d/ → \`glab\` authenticated in login shells"
|
|
84
|
+
else
|
|
85
|
+
echo "[gitlab-cli] no apiToken set — run \`glab auth login\` once in the container; auth state persists under ~/.config/glab-cli"
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
echo "[gitlab-cli] done"
|
package/dist/bin.js
CHANGED
|
@@ -2515,6 +2515,13 @@ async function writeOpencodeConfig(targetDir, containerName2, features) {
|
|
|
2515
2515
|
...managedInstructions,
|
|
2516
2516
|
...existingInstructions.filter((i) => !managedInstructions.includes(i))
|
|
2517
2517
|
];
|
|
2518
|
+
if (typeof config.permission !== "string") {
|
|
2519
|
+
const permission = typeof config.permission === "object" && config.permission !== null ? config.permission : {};
|
|
2520
|
+
const ext = typeof permission.external_directory === "object" && permission.external_directory !== null ? permission.external_directory : {};
|
|
2521
|
+
ext[`${workspaceRoot}/projects/*`] = "allow";
|
|
2522
|
+
permission.external_directory = ext;
|
|
2523
|
+
config.permission = permission;
|
|
2524
|
+
}
|
|
2518
2525
|
if (model) {
|
|
2519
2526
|
config.model = model;
|
|
2520
2527
|
}
|
|
@@ -7220,7 +7227,7 @@ var CLI_VERSION;
|
|
|
7220
7227
|
var init_version = __esm({
|
|
7221
7228
|
"src/version.ts"() {
|
|
7222
7229
|
"use strict";
|
|
7223
|
-
CLI_VERSION = true ? "1.
|
|
7230
|
+
CLI_VERSION = true ? "1.24.0" : "dev";
|
|
7224
7231
|
}
|
|
7225
7232
|
});
|
|
7226
7233
|
|