@getmonoceros/workbench 1.37.12 → 1.37.14

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.
@@ -40,19 +40,31 @@ options:
40
40
  description: "Optional Bitbucket app password; only needed for twg's Bitbucket commands."
41
41
  surface: env
42
42
  feature:
43
- version: 1.2.0
43
+ version: 1.2.1
44
44
  persistentHomePaths: [.config/acli, .rovodev, .config/twg, .agents]
45
45
  vscodeExtensions: [Atlassian.atlascode]
46
- # Forge is keychain-free in a container: instead of `forge login` (which
47
- # needs libsecret), Atlassian's documented path is the FORGE_EMAIL /
48
- # FORGE_API_TOKEN env vars, read at command time. We hand them to the
49
- # workspace runtime env from the shared account options, gated on the
50
- # `forge` toggle. Sibling of a service's connectionEnv (ADR 0021).
46
+ # Forge and twg are both keychain-free in a container: instead of a
47
+ # `login` step (which needs libsecret, or a TTY for twg's OAuth),
48
+ # Atlassian's documented path is env vars read at command time. We hand
49
+ # them to the workspace runtime env from the shared account options,
50
+ # each gated on its own toggle. Sibling of a service's connectionEnv
51
+ # (ADR 0021).
52
+ # - Forge reads FORGE_EMAIL / FORGE_API_TOKEN.
53
+ # - twg reads TWG_USER / TWG_SITE / TWG_TOKEN (+ optional
54
+ # TWG_BBC_TOKEN for Bitbucket). Recent twg makes `twg login`
55
+ # OAuth-only and it aborts without a TTY, so these env vars are the
56
+ # only non-interactive auth path; there is no login hook.
51
57
  workspaceEnv:
52
58
  - whenOption: forge
53
59
  vars:
54
60
  FORGE_EMAIL: '${email}'
55
61
  FORGE_API_TOKEN: '${apiToken}'
62
+ - whenOption: twg
63
+ vars:
64
+ TWG_USER: '${email}'
65
+ TWG_SITE: '${instance}'
66
+ TWG_TOKEN: '${apiToken}'
67
+ TWG_BBC_TOKEN: '${bitbucketToken}'
56
68
  briefing:
57
69
  - whenOption: rovodev
58
70
  text: 'Atlassian Rovo Dev — invoke via `acli rovodev`. Pre-authenticated against the Atlassian account configured in the feature options (shared with twg).'
@@ -95,8 +95,9 @@ if [ "${TWG}" = "true" ]; then
95
95
  # runtime — we re-record it as node in the post-create hook
96
96
  # below.)
97
97
  # - With --skip-login / --skip-skills we keep the install
98
- # non-interactive. Login + skills happen later as the node user
99
- # so they persist into the bind-mounted home.
98
+ # non-interactive. Auth is env-var based (see the workspaceEnv
99
+ # note below, no login step); skills install later as the node
100
+ # user so they persist into the bind-mounted home.
100
101
  #
101
102
  # Heredoc (not `yes ... |`) deliberately: a long-lived `yes` left
102
103
  # writing into a closed pipe after the install script exits gets
@@ -128,49 +129,34 @@ TWG_INSTALL_INPUT
128
129
  exit 1
129
130
  }
130
131
 
132
+ # twg authenticates purely from the TWG_USER / TWG_SITE / TWG_TOKEN
133
+ # (+ optional TWG_BBC_TOKEN) env vars that the workbench injects into
134
+ # the workspace runtime env from the shared account options
135
+ # (feature.workspaceEnv, gated on the `twg` toggle): the same
136
+ # keychain-free path as Forge. There is deliberately no login step.
137
+ # Recent twg makes `twg login` OAuth-only, and it aborts without a TTY,
138
+ # which is unavailable during `monoceros apply`'s postCreate. So the
139
+ # post-create hook's only job is to (re-)install twg's agent skills as
140
+ # the node user, which needs no credentials, so it runs whenever twg is
141
+ # installed regardless of whether creds are set.
131
142
  HOOK="${POST_CREATE_DIR}/atlassian-twg.sh"
132
- if [ -n "${INSTANCE}" ] && [ -n "${EMAIL}" ] && [ -n "${APITOKEN}" ]; then
133
- cat >"${HOOK}" <<EOF
143
+ cat >"${HOOK}" <<EOF
134
144
  #!/usr/bin/env bash
135
145
  # Auto-generated by the Monoceros atlassian feature (twg).
136
- # Runs every container start. Always re-runs auth login so that
137
- # rotating the apiToken / bitbucketToken in the container yml
138
- # propagates through on the next \`monoceros apply\` without
139
- # needing to delete the previous credentials file by hand. twg's
140
- # login is a single API call; the cost is negligible compared to
141
- # the container build.
146
+ # Runs every container start. twg auth comes from the TWG_* env vars
147
+ # injected via feature.workspaceEnv; there is no login step here (recent
148
+ # twg's \`twg login\` is OAuth-only and needs a TTY). This hook only
149
+ # (re-)installs twg's agent skills as the node user.
142
150
  set -euo pipefail
143
- mkdir -p "\${HOME}/.config/twg"
144
- echo "[atlassian/twg] configuring twg non-interactively for ${EMAIL} @ ${INSTANCE}"
145
- # Notes on the non-interactive login dance:
146
- # - We don't try to re-record consent here as the node user. twg's
147
- # \`consent\` subcommand demands a TTY; the install-time consent
148
- # (recorded as root during the feature build) appears to be
149
- # enough for \`twg login\` itself.
150
- # - \`twg login --force\` reads Atlassian creds from TWG_USER /
151
- # TWG_SITE / TWG_TOKEN. If TWG_BBC_TOKEN is set, twg uses that
152
- # directly and skips the Bitbucket prompt. If empty, twg prompts
153
- # interactively — we feed two blank lines via heredoc so the
154
- # "Enter = skip" branch fires and we don't hang. Future twg
155
- # versions adding another optional prompt are also covered by
156
- # the second blank line.
157
- TWG_USER='${EMAIL}' \\
158
- TWG_SITE='${INSTANCE}' \\
159
- TWG_TOKEN='${APITOKEN}' \\
160
- TWG_BBC_TOKEN='${BITBUCKETTOKEN}' \\
161
- twg login --force <<'TWG_LOGIN_INPUT'
162
-
163
-
164
- TWG_LOGIN_INPUT
165
151
 
166
152
  # (Re-)install twg's agent skills. Canonical install lands in
167
153
  # /home/node/.agents/skills/twg (persisted via the feature's
168
154
  # persistentHomePaths); .agents/skills-native agents (codex, cursor,
169
155
  # gemini, copilot, …) read it directly. Agents with their own skills
170
- # dir (claude .claude/skills, opencode .opencode/skills) need an
156
+ # dir (claude -> .claude/skills, opencode -> .opencode/skills) need an
171
157
  # explicit --agent flag, so we detect which AI CLIs are present in this
172
158
  # container and pass the matching flags. This keeps the atlassian
173
- # feature decoupled from the container's feature list it reacts to
159
+ # feature decoupled from the container's feature list: it reacts to
174
160
  # whatever is actually installed. Idempotent: re-running just refreshes
175
161
  # the wrappers.
176
162
  echo "[atlassian/twg] (re-)installing twg skills"
@@ -183,11 +169,10 @@ if command -v opencode >/dev/null 2>&1; then
183
169
  fi
184
170
  twg skills install --global --yes "\${TWG_SKILL_AGENTS[@]}"
185
171
  EOF
186
- chmod 0755 "${HOOK}"
187
- echo "[atlassian/twg] post-create login hook installed"
188
- else
189
- rm -f "${HOOK}"
190
- echo "[atlassian/twg] missing instance/email/apiToken — login is manual (\`twg login\` once in the container)"
172
+ chmod 0755 "${HOOK}"
173
+ echo "[atlassian/twg] post-create skills hook installed; auth via TWG_* workspace env"
174
+ if [ -z "${INSTANCE}" ] || [ -z "${EMAIL}" ] || [ -z "${APITOKEN}" ]; then
175
+ echo "[atlassian/twg] instance/email/apiToken not all set; set them in the container yml so TWG_USER/TWG_SITE/TWG_TOKEN reach the shell (otherwise run \`twg login\` once in the container)"
191
176
  fi
192
177
  fi
193
178
 
package/dist/bin.js CHANGED
@@ -8369,7 +8369,8 @@ Fix the value in the env file (or the yml).`
8369
8369
  (repo) => !repo.gitUser
8370
8370
  );
8371
8371
  const hasResolvedContainerGitUser = containerGitOverride !== void 0;
8372
- const hasDefaultGitUser = globalConfig?.defaults?.git?.user !== void 0;
8372
+ const defaultGitUser = globalConfig?.defaults?.git?.user;
8373
+ const hasDefaultGitUser = defaultGitUser?.name !== void 0 || defaultGitUser?.email !== void 0;
8373
8374
  const idLogger = {
8374
8375
  info: logger.info,
8375
8376
  warn: logger.warn ?? logger.info
@@ -8973,7 +8974,7 @@ var CLI_VERSION;
8973
8974
  var init_version = __esm({
8974
8975
  "src/version.ts"() {
8975
8976
  "use strict";
8976
- CLI_VERSION = true ? "1.37.12" : "dev";
8977
+ CLI_VERSION = true ? "1.37.14" : "dev";
8977
8978
  }
8978
8979
  });
8979
8980