@mmerterden/multi-agent-pipeline 23.6.0 → 24.0.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.
Files changed (167) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/README.md +61 -27
  3. package/README.tr.md +46 -12
  4. package/SECURITY.md +3 -3
  5. package/docs/architecture.md +47 -8
  6. package/docs/ecosystem.md +20 -18
  7. package/docs/engineering.md +1 -1
  8. package/docs/facts.json +8 -6
  9. package/docs/features.md +59 -15
  10. package/install/_codex-agents.mjs +13 -8
  11. package/install/_common.mjs +24 -0
  12. package/install/_dev-only-files.mjs +4 -0
  13. package/install/_mcp-register.mjs +6 -2
  14. package/install/_rewrite-tree.mjs +197 -0
  15. package/install/codex.mjs +96 -180
  16. package/install/copilot.mjs +24 -54
  17. package/install/index.mjs +29 -11
  18. package/install/templates/codex-instructions.md +21 -5
  19. package/install/templates/copilot-instructions.md +21 -14
  20. package/manifest.json +2082 -0
  21. package/package.json +6 -2
  22. package/pipeline/commands/multi-agent/SKILL.md +7 -5
  23. package/pipeline/commands/multi-agent/analysis/SKILL.md +4 -0
  24. package/pipeline/commands/multi-agent/autopilot-on/SKILL.md +31 -3
  25. package/pipeline/commands/multi-agent/autopilot-status/SKILL.md +5 -1
  26. package/pipeline/commands/multi-agent/channels/SKILL.md +16 -8
  27. package/pipeline/commands/multi-agent/log/SKILL.md +2 -0
  28. package/pipeline/commands/multi-agent/resume/SKILL.md +2 -0
  29. package/pipeline/commands/multi-agent/review-rounds/SKILL.md +94 -0
  30. package/pipeline/commands/multi-agent/stack/SKILL.md +1 -1
  31. package/pipeline/commands/multi-agent/sync/SKILL.md +3 -3
  32. package/pipeline/contract/manifest.json +1 -1
  33. package/pipeline/contract/types/index.d.ts +1 -0
  34. package/pipeline/lib/_jira-auth.sh +50 -78
  35. package/pipeline/lib/_service-account.sh +191 -0
  36. package/pipeline/lib/credential-inventory.sh +49 -37
  37. package/pipeline/lib/credential-store.sh +48 -3
  38. package/pipeline/lib/fetch-confluence.sh +76 -92
  39. package/pipeline/lib/fetch-crashlytics.sh +30 -59
  40. package/pipeline/lib/fetch-figma-annotations.sh +9 -9
  41. package/pipeline/lib/fetch-fortify.sh +77 -81
  42. package/pipeline/lib/fetch-graylog.sh +38 -77
  43. package/pipeline/lib/figma-mcp-refresh.sh +23 -4
  44. package/pipeline/lib/figma-screenshot.sh +7 -8
  45. package/pipeline/lib/figma-token.sh +39 -46
  46. package/pipeline/lib/host.mjs +138 -0
  47. package/pipeline/lib/host.sh +48 -0
  48. package/pipeline/lib/issue-fetcher.sh +25 -41
  49. package/pipeline/lib/jira-publish.sh +23 -21
  50. package/pipeline/lib/local-model.mjs +93 -0
  51. package/pipeline/lib/md2confluence-v3.py +37 -30
  52. package/pipeline/lib/model-dispatch.sh +41 -4
  53. package/pipeline/lib/model-resolve.mjs +58 -0
  54. package/pipeline/lib/post-pr-review.sh +38 -53
  55. package/pipeline/lib/reviewer-families.mjs +70 -0
  56. package/pipeline/lib/service-account.mjs +2131 -0
  57. package/pipeline/lib/service-account.sh +35 -0
  58. package/pipeline/lib/usage-names.generated.mjs +3 -0
  59. package/pipeline/lib/usage-token.mjs +64 -24
  60. package/pipeline/lib/usage-vocab.mjs +1 -1
  61. package/pipeline/lib/user-facing.mjs +11 -3
  62. package/pipeline/lib/vercel-deploy.sh +17 -26
  63. package/pipeline/multi-agent-refs/_entry-picker.md +62 -0
  64. package/pipeline/multi-agent-refs/_input-parser.md +1 -1
  65. package/pipeline/multi-agent-refs/analysis/intake.md +2 -0
  66. package/pipeline/multi-agent-refs/analysis/reusable-refs.md +1 -0
  67. package/pipeline/multi-agent-refs/analysis/unattended.md +135 -0
  68. package/pipeline/multi-agent-refs/autopilot-on/details.md +16 -0
  69. package/pipeline/multi-agent-refs/channels/generator.md +10 -2
  70. package/pipeline/multi-agent-refs/channels/menu.md +3 -1
  71. package/pipeline/multi-agent-refs/channels/preview.md +3 -1
  72. package/pipeline/multi-agent-refs/channels/reference.md +16 -2
  73. package/pipeline/multi-agent-refs/channels/report-file.md +188 -0
  74. package/pipeline/multi-agent-refs/component-dispatch.md +2 -2
  75. package/pipeline/multi-agent-refs/cross-cli-contract.md +38 -30
  76. package/pipeline/multi-agent-refs/features/autopilot-circuit-breaker.md +4 -4
  77. package/pipeline/multi-agent-refs/features/doctor.md +37 -11
  78. package/pipeline/multi-agent-refs/features/free-models.md +3 -3
  79. package/pipeline/multi-agent-refs/features/local-model.md +87 -0
  80. package/pipeline/multi-agent-refs/features/model-fallback.md +25 -10
  81. package/pipeline/multi-agent-refs/features/product-context.md +6 -5
  82. package/pipeline/multi-agent-refs/features/review-delta.md +1 -1
  83. package/pipeline/multi-agent-refs/features/review-rounds.md +40 -0
  84. package/pipeline/multi-agent-refs/features/rework-escalation.md +5 -4
  85. package/pipeline/multi-agent-refs/features/service-accounts.md +233 -0
  86. package/pipeline/multi-agent-refs/features/unattended-security.md +10 -1
  87. package/pipeline/multi-agent-refs/help/en.md +31 -2
  88. package/pipeline/multi-agent-refs/help/tr.md +31 -2
  89. package/pipeline/multi-agent-refs/orchestrator/copilot-pipeline.md +3 -2
  90. package/pipeline/multi-agent-refs/orchestrator/dispatcher.md +2 -1
  91. package/pipeline/multi-agent-refs/phases/modes.md +20 -1
  92. package/pipeline/multi-agent-refs/phases/operations.md +1 -1
  93. package/pipeline/multi-agent-refs/phases/phase-0-init.md +1 -1
  94. package/pipeline/multi-agent-refs/phases/phase-2-dev.md +4 -4
  95. package/pipeline/multi-agent-refs/phases/phase-3-review.md +7 -3
  96. package/pipeline/multi-agent-refs/phases/phase-5-report.md +12 -10
  97. package/pipeline/multi-agent-refs/phases.md +4 -3
  98. package/pipeline/multi-agent-refs/resume/details.md +2 -0
  99. package/pipeline/multi-agent-refs/review/panel.md +30 -18
  100. package/pipeline/multi-agent-refs/setup/discovery.md +17 -5
  101. package/pipeline/multi-agent-refs/setup/token-save-flow.md +21 -2
  102. package/pipeline/multi-agent-refs/sync/overview.md +11 -5
  103. package/pipeline/multi-agent-refs/tracker-contract.md +28 -10
  104. package/pipeline/office/index.html +4 -4
  105. package/pipeline/schemas/agent-state.schema.json +19 -1
  106. package/pipeline/schemas/autopilot-config.schema.json +29 -4
  107. package/pipeline/schemas/hosts.json +512 -0
  108. package/pipeline/schemas/hosts.schema.json +310 -0
  109. package/pipeline/schemas/launch.json +22 -2
  110. package/pipeline/schemas/launch.schema.json +2 -1
  111. package/pipeline/schemas/phases.json +21 -3
  112. package/pipeline/schemas/phases.schema.json +8 -0
  113. package/pipeline/schemas/prefs.schema.json +346 -7
  114. package/pipeline/schemas/token-budget.json +2 -2
  115. package/pipeline/scripts/.doctor-mut.47076.mjs +2253 -0
  116. package/pipeline/scripts/_autopilot-config.mjs +67 -4
  117. package/pipeline/scripts/_autopilot-item.mjs +67 -0
  118. package/pipeline/scripts/_autopilot-outcomes.mjs +6 -0
  119. package/pipeline/scripts/_cost.mjs +75 -3
  120. package/pipeline/scripts/analysis-sources.mjs +22 -5
  121. package/pipeline/scripts/analysis-unattended.mjs +360 -0
  122. package/pipeline/scripts/anonymize-findings.mjs +3 -7
  123. package/pipeline/scripts/autopilot-arming.mjs +19 -10
  124. package/pipeline/scripts/autopilot-intake.mjs +124 -27
  125. package/pipeline/scripts/autopilot-menubar.swift +7 -0
  126. package/pipeline/scripts/autopilot-runner.mjs +77 -48
  127. package/pipeline/scripts/autopilot-status.sh +32 -9
  128. package/pipeline/scripts/bulk-read.sh +37 -5
  129. package/pipeline/scripts/confluence-readback.mjs +15 -7
  130. package/pipeline/scripts/cost-table.json +65 -25
  131. package/pipeline/scripts/doctor.mjs +119 -32
  132. package/pipeline/scripts/entry-mode.mjs +101 -0
  133. package/pipeline/scripts/estimate.mjs +30 -16
  134. package/pipeline/scripts/feedback-send.mjs +11 -8
  135. package/pipeline/scripts/gen-facts.mjs +16 -13
  136. package/pipeline/scripts/jira-attach.sh +23 -28
  137. package/pipeline/scripts/jira-search.sh +5 -21
  138. package/pipeline/scripts/launch-request.mjs +15 -9
  139. package/pipeline/scripts/migrate-prefs.mjs +56 -0
  140. package/pipeline/scripts/phase-tracker.sh +146 -38
  141. package/pipeline/scripts/priority-review.mjs +14 -7
  142. package/pipeline/scripts/product-context.mjs +26 -7
  143. package/pipeline/scripts/prune-logs.sh +4 -2
  144. package/pipeline/scripts/report-file.mjs +285 -0
  145. package/pipeline/scripts/review-rounds.mjs +592 -0
  146. package/pipeline/scripts/rework-escalation.mjs +26 -7
  147. package/pipeline/scripts/service-read.mjs +19 -17
  148. package/pipeline/scripts/skill-siblings.mjs +17 -1
  149. package/pipeline/scripts/status-overview.mjs +20 -10
  150. package/pipeline/scripts/uninstall.mjs +145 -57
  151. package/pipeline/scripts/usage-register.mjs +34 -11
  152. package/pipeline/scripts/usage-report.mjs +31 -26
  153. package/pipeline/scripts/validate-state.mjs +19 -11
  154. package/pipeline/scripts/validate-triage.mjs +11 -1
  155. package/pipeline/scripts/work-items.mjs +25 -28
  156. package/pipeline/scripts/write-store-config.mjs +37 -11
  157. package/pipeline/skills/.skill-manifest.json +11 -7
  158. package/pipeline/skills/.skills-index.json +13 -2
  159. package/pipeline/skills/shared/README.md +4 -3
  160. package/pipeline/skills/shared/core/multi-agent/SKILL.md +14 -6
  161. package/pipeline/skills/shared/core/multi-agent-analysis/SKILL.md +2 -0
  162. package/pipeline/skills/shared/core/multi-agent-channels/SKILL.md +11 -8
  163. package/pipeline/skills/shared/core/multi-agent-resume/SKILL.md +1 -1
  164. package/pipeline/skills/shared/core/multi-agent-review-rounds/SKILL.md +92 -0
  165. package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +3 -3
  166. package/pipeline/skills/skills-index.md +2 -1
  167. package/pipeline/lib/credential-resolve.mjs +0 -75
@@ -19,7 +19,7 @@
19
19
  # Credential resolution, in order:
20
20
  # 1. FIREBASE_TOKEN_KEY (env override)
21
21
  # 2. prefs.global.firebase.accounts[] entry whose projectId matches the URL
22
- # 3. prefs.global.keychainMapping.firebase (single-project setups)
22
+ # 3. the sole Firebase account (single-project setups)
23
23
  # 4. "${USER}_Firebase_Access_Json"
24
24
  #
25
25
  # Output (stdout, single JSON object):
@@ -148,71 +148,42 @@ if [ "$PROBE" -eq 0 ] \
148
148
  exit 4
149
149
  fi
150
150
 
151
- # Resolve the Firebase SA JSON via keychain mapping (matches Phase 0 contract).
151
+ # Resolve the Firebase service-account key for this project.
152
152
  #
153
153
  # One team routinely owns several Firebase projects - a legacy app and its
154
- # redesign, or staging next to production - and each has its own service-account
155
- # key. A single `keychainMapping.firebase` slot forced a choice, and a crash URL
156
- # from the other project then failed the project_id check as if it were a
157
- # configuration error. `global.firebase.accounts[]` maps projectId -> keychain
158
- # key, and the URL's projectId picks the key. The single slot stays the fallback,
159
- # so a one-project setup needs no config at all.
160
- PREFS="$HOME/.claude/multi-agent-preferences.json"
161
- TOKEN_KEY="${FIREBASE_TOKEN_KEY:-}"
162
- FIREBASE_ACCOUNT_LABEL=""
163
- if [ -z "$TOKEN_KEY" ] && [ -f "$PREFS" ]; then
164
- ACCOUNT_HIT=$(WANT_PROJECT="$PROJECT_ID" python3 -c "
165
- import json, os
166
- want = os.environ.get('WANT_PROJECT') or ''
167
- try:
168
- g = json.load(open('$PREFS')).get('global', {})
169
- except Exception:
170
- g = {}
171
- for a in (g.get('firebase', {}) or {}).get('accounts') or []:
172
- if isinstance(a, dict) and str(a.get('projectId') or '') == want and a.get('keychainKey'):
173
- print('%s\t%s' % (a['keychainKey'], a.get('label') or a['projectId']))
174
- break
175
- else:
176
- print('%s\t' % ((g.get('keychainMapping', {}) or {}).get('firebase') or ''))
177
- " 2>/dev/null || printf '\t')
178
- TOKEN_KEY=$(printf '%s' "$ACCOUNT_HIT" | cut -f1)
179
- FIREBASE_ACCOUNT_LABEL=$(printf '%s' "$ACCOUNT_HIT" | cut -f2)
180
- fi
181
- [ -z "$TOKEN_KEY" ] && TOKEN_KEY="${USER}_Firebase_Access_Json"
182
-
183
- # Locate the resolver with an existence check, not a `.`-chain.
184
- #
185
- # Sourcing a file that does not exist aborts the shell under `set -e` - `||` included -
186
- # so `. <candidate> || . <candidate> || { error }` reaches neither its later candidates
187
- # nor its error branch. Every fetcher used that shape starting from `$HOME/.claude/...`,
188
- # so on a Copilot-only or Codex-only install they all died with a bare exit 1 and no
189
- # message. Reordering does not help: whichever candidate is absent aborts at that point.
190
- # Checking for the file before sourcing it is the only safe form.
191
- for _cred_resolver in \
192
- "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)/credential-store-resolver.sh" \
193
- "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/../lib" 2>/dev/null && pwd)/credential-store-resolver.sh" \
194
- "$HOME/.claude/lib/credential-store-resolver.sh" \
195
- "$HOME/.copilot/lib/credential-store-resolver.sh" \
196
- "$HOME/.codex/lib/credential-store-resolver.sh"; do
197
- [ -f "$_cred_resolver" ] || continue
198
- # shellcheck source=/dev/null
199
- . "$_cred_resolver" 2>/dev/null || true
200
- # `if`, not `[ ... ] && break`: the latter is the loop body's last command and returns
201
- # 1 when CRED_STORE is still empty, which under `set -e` kills the loop on the first
202
- # candidate that does not resolve - the very case the loop exists to survive.
203
- if [ -n "${CRED_STORE:-}" ]; then break; fi
204
- done
205
- unset _cred_resolver
206
- if [ -z "${CRED_STORE:-}" ]; then
154
+ # redesign, or staging next to production - each with its own service-account
155
+ # key. The project id in the crash URL picks the account, so a URL from the
156
+ # other project resolves that project's key instead of failing the project_id
157
+ # check as if it were a configuration error.
158
+ _MA_FC_HERE="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
159
+ # shellcheck source=/dev/null
160
+ if [ -f "$_MA_FC_HERE/_service-account.sh" ]; then
161
+ . "$_MA_FC_HERE/_service-account.sh"
162
+ elif [ -f "$HOME/.claude/lib/_service-account.sh" ]; then
163
+ . "$HOME/.claude/lib/_service-account.sh"
164
+ else
207
165
  [ "$PROBE" -eq 1 ] && probe_out unreachable no-credential-helper "$PROJECT_ID"
208
- printf '%s\n' '{"status":"blocked","reason":"missing-credential-helper","service":"firebase","expected_key":"'"$TOKEN_KEY"'"}' >&2
166
+ printf '%s\n' '{"status":"blocked","reason":"missing-credential-helper","service":"firebase"}' >&2
209
167
  exit 2
210
168
  fi
211
169
 
212
- SA_JSON_RAW=$("$CRED_STORE" get "$TOKEN_KEY" 2>/dev/null || true)
170
+ FIREBASE_PICK=()
171
+ if [ -n "${FIREBASE_TOKEN_KEY:-}" ]; then
172
+ FIREBASE_PICK+=(--item "$FIREBASE_TOKEN_KEY")
173
+ elif [ -n "${PROJECT_ID:-}" ]; then
174
+ FIREBASE_PICK+=(--project-id "$PROJECT_ID")
175
+ fi
176
+
177
+ FIREBASE_ACCOUNT_LABEL=$(sa_run select --service firebase "${FIREBASE_PICK[@]+"${FIREBASE_PICK[@]}"}" |
178
+ node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{try{process.stdout.write(JSON.parse(s).account.label||"")}catch{process.stdout.write("")}})' 2>/dev/null || true)
179
+
180
+ # The key is a service-account JSON handed to a Google client, not a header we
181
+ # write, so the value is produced rather than a curl config.
182
+ SA_JSON_RAW=$(sa_token firebase "https://oauth2.googleapis.com/token" \
183
+ "${FIREBASE_PICK[@]+"${FIREBASE_PICK[@]}"}" 2>/dev/null || true)
213
184
  if [ -z "$SA_JSON_RAW" ]; then
214
185
  [ "$PROBE" -eq 1 ] && probe_out no-credential nothing-stored "$PROJECT_ID"
215
- printf '%s\n' '{"status":"blocked","reason":"missing-token","service":"firebase","expected_key":"'"$TOKEN_KEY"'"}' >&2
186
+ printf '%s\n' '{"status":"blocked","reason":"missing-token","service":"firebase","projectId":"'"$PROJECT_ID"'"}' >&2
216
187
  exit 2
217
188
  fi
218
189
 
@@ -252,7 +223,7 @@ if [ -n "$SA_PROJECT" ] && [ "$SA_PROJECT" != "$PROJECT_ID" ]; then
252
223
  # with several Firebase projects in play, "project mismatch" alone does not
253
224
  # tell you whether the URL is wrong or the mapping is missing an account.
254
225
  echo "ERR: SA project_id ($SA_PROJECT) != URL project ($PROJECT_ID)" >&2
255
- echo " key used: $TOKEN_KEY${FIREBASE_ACCOUNT_LABEL:+ (account: $FIREBASE_ACCOUNT_LABEL)}" >&2
226
+ echo " account used: ${FIREBASE_ACCOUNT_LABEL:-firebase}" >&2
256
227
  echo " map this project: prefs.global.firebase.accounts[] += {\"projectId\":\"$PROJECT_ID\",\"keychainKey\":\"<keychain-key>\"}" >&2
257
228
  exit 5
258
229
  fi
@@ -69,12 +69,12 @@ for _figma_token_lib in \
69
69
  [ -f "$_figma_token_lib" ] || continue
70
70
  # shellcheck source=/dev/null
71
71
  . "$_figma_token_lib" 2>/dev/null || true
72
- if command -v resolve_figma_token >/dev/null 2>&1; then break; fi
72
+ if command -v figma_cfg >/dev/null 2>&1; then break; fi
73
73
  done
74
74
  unset _figma_token_lib
75
- if ! command -v resolve_figma_token >/dev/null 2>&1; then
76
- resolve_figma_token() { [ -n "${FIGMA_PAT:-}" ] && printf '%s' "$FIGMA_PAT"; }
77
- figma_token_remediation() { printf 'figma-token.sh not found - reinstall the pipeline, or export FIGMA_PAT.'; }
75
+ if ! command -v figma_cfg >/dev/null 2>&1; then
76
+ figma_cfg() { return 2; }
77
+ figma_token_remediation() { printf 'figma-token.sh not found - reinstall the pipeline.'; }
78
78
  fi
79
79
 
80
80
  FIGMA_API="https://api.figma.com/v1"
@@ -114,8 +114,7 @@ fi
114
114
  [ -z "$FILE_KEY" ] && die 1 "missing --file-key (or a --url to parse it from)"
115
115
  [ -z "$NODE_IDS" ] && die 1 "missing --node-id (or a --url to parse it from)"
116
116
 
117
- FIGMA_TOKEN=$(resolve_figma_token || true)
118
- if [ -z "$FIGMA_TOKEN" ]; then
117
+ if ! figma_cfg "$FIGMA_API/files/$FILE_KEY"; then
119
118
  printf '{"ok":false,"reason":"missing-token","source":"figma-rest","fileKey":"%s"}\n' "$FILE_KEY"
120
119
  die 2 "$(figma_token_remediation)"
121
120
  fi
@@ -123,9 +122,11 @@ fi
123
122
  TMPDIR_A=$(mktemp -d "${TMPDIR:-/tmp}/figma-annot.XXXXXX")
124
123
  trap 'rm -rf "$TMPDIR_A"' EXIT INT TERM
125
124
 
126
- # curl one /nodes batch (token via -K config so it never lands in argv).
125
+ # curl one /nodes batch. The config carries the URL as well as the credential,
126
+ # so the two cannot be separated and a redirect is refused, not followed.
127
127
  curl_nodes() {
128
128
  local out="$1" ids="$2" code
129
+ figma_cfg "$FIGMA_API/files/$FILE_KEY/nodes?ids=$ids" || { printf '000'; return 0; }
129
130
  # curl already writes "000" via -w on a total connection failure (and
130
131
  # still exits non-zero for it, which the inner `|| echo "000"` used to
131
132
  # catch too - so `code` became the literal string "000000", never
@@ -134,8 +135,7 @@ curl_nodes() {
134
135
  # into $code; `:-000` only fills in when curl fails before -w ever runs.
135
136
  code=$(curl -sS -o "$out" -w '%{http_code}' \
136
137
  --max-time "$HTTP_TIMEOUT" --connect-timeout 5 \
137
- -K <(printf 'header = "X-Figma-Token: %s"\n' "$FIGMA_TOKEN") \
138
- "$FIGMA_API/files/$FILE_KEY/nodes?ids=$ids") || true
138
+ --config "$FIGMA_CFG") || true
139
139
  code="${code:-000}"
140
140
  printf '%s' "$code"
141
141
  }
@@ -15,14 +15,17 @@
15
15
  # the person reading the ticket never needed the URL.
16
16
  #
17
17
  # Required configuration:
18
- # prefs.global.hosts.fortify - SSC host (e.g. ssc.example.com)
19
- # prefs.global.keychainMapping.fortify - keychain key holding the API token
18
+ # a Fortify account - its host is the SSC, its token slot
19
+ # holds the API token; add one with
20
+ # /multi-agent:setup
20
21
  # prefs.global.fortify.versionIds[] - project versions searched, in order,
21
22
  # when only an instance id is known
22
23
  #
23
24
  # Optional env:
24
25
  # FORTIFY_TIMEOUT_SECONDS default 25
25
- # FORTIFY_HOST_OVERRIDE forces the host (used by tests and CI dry-runs)
26
+ # FORTIFY_HOST_OVERRIDE names which account to use, when more than one is
27
+ # configured. It still has to be a host an account
28
+ # covers: an override picks, it does not excuse.
26
29
  # FORTIFY_AUTH_SCHEME auto|bearer|fortifytoken (default: auto)
27
30
  #
28
31
  # Output (stdout, single JSON object):
@@ -46,8 +49,9 @@
46
49
  # 2 missing/expired credential (orchestrator handles the Save Flow)
47
50
  # 3 network/auth failure
48
51
  # 4 bad usage
49
- # 6 not configured (prefs.global.hosts.fortify empty, or an instance-id-only
50
- # lookup with no prefs.global.fortify.versionIds to search)
52
+ # 6 not configured (no Fortify account, no account covering the host asked
53
+ # for, or an instance-id-only lookup with no prefs.global.fortify.versionIds
54
+ # to search)
51
55
  #
52
56
  # Phase 3 review gate contract:
53
57
  # Critical > 0 → blocking=true, reason="critical-findings"
@@ -79,24 +83,51 @@ while [ $# -gt 0 ]; do
79
83
  esac
80
84
  done
81
85
 
82
- # Host comes from prefs (private config); skill templates only show <ssc-host>.
86
+ # Which SSC this run talks to, and with which credential, is one decision: the
87
+ # account resolver makes it, and writes the credential only into a config
88
+ # pinned to the URL it checked.
83
89
  PREFS="$HOME/.claude/multi-agent-preferences.json"
84
- HOST="${FORTIFY_HOST_OVERRIDE:-}"
85
- if [ -z "$HOST" ] && [ -f "$PREFS" ]; then
86
- HOST=$(python3 -c "
87
- import json
88
- try:
89
- p = json.load(open('$PREFS'))
90
- print(p.get('global', {}).get('hosts', {}).get('fortify') or '')
91
- except Exception:
92
- print('')
93
- ")
90
+ _MA_FF_HERE="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
91
+ # shellcheck source=/dev/null
92
+ if [ -f "$_MA_FF_HERE/_service-account.sh" ]; then
93
+ . "$_MA_FF_HERE/_service-account.sh"
94
+ elif [ -f "$HOME/.claude/lib/_service-account.sh" ]; then
95
+ . "$HOME/.claude/lib/_service-account.sh"
96
+ else
97
+ printf '%s\n' '{"status":"blocked","reason":"missing-credential-helper","service":"fortify"}' >&2
98
+ exit 2
94
99
  fi
95
- if [ -z "$HOST" ]; then
96
- printf '%s\n' '{"status":"blocked","reason":"host-not-configured","service":"fortify","expected_pref":"global.hosts.fortify"}' >&2
97
- exit 6
100
+
101
+ SA_PICK=()
102
+ if [ -n "${FORTIFY_HOST_OVERRIDE:-}" ]; then
103
+ SA_PICK+=(--host "${FORTIFY_HOST_OVERRIDE%/}")
98
104
  fi
99
- HOST=${HOST%/} # strip trailing slash if any
105
+
106
+ fortify_blocked() {
107
+ local reason code
108
+ case "$(sa_code)" in
109
+ host-mismatch|no-account-for-target|identity-mismatch|insecure-url)
110
+ reason="host-not-allowed"; code=6 ;;
111
+ not-configured|unknown-account)
112
+ # No account exists. That is a credential still to be saved when
113
+ # something says where this SSC is - the file, or the caller's own
114
+ # override - and a missing configuration when nothing does.
115
+ if [ -n "${FORTIFY_HOST_OVERRIDE:-}" ] || [ "$(sa_field hostKnown)" = "true" ]; then
116
+ reason="missing-token"; code=2
117
+ else
118
+ reason="host-not-configured"; code=6
119
+ fi ;;
120
+ prefs-unreadable|invalid-config)
121
+ reason="host-not-configured"; code=6 ;;
122
+ store-unavailable)
123
+ reason="missing-credential-helper"; code=2 ;;
124
+ *)
125
+ reason="missing-token"; code=2 ;;
126
+ esac
127
+ printf '%s\n' '{"status":"blocked","reason":"'"$reason"'","service":"fortify","expected_pref":"global.hosts.fortify"}' >&2
128
+ exit "$code"
129
+ }
130
+
100
131
 
101
132
  # Parse URL components when present.
102
133
  if [ -n "$URL" ] && [ -z "$VERSION_ID" ]; then
@@ -144,78 +175,43 @@ if [ -z "$VERSION_ID" ] && [ -z "$VERSION_CANDIDATES" ]; then
144
175
  exit 6
145
176
  fi
146
177
 
147
- # Token via keychain mapping.
148
- TOKEN_KEY=""
149
- if [ -f "$PREFS" ]; then
150
- TOKEN_KEY=$(python3 -c "
151
- import json
152
- try:
153
- p = json.load(open('$PREFS'))
154
- print(p.get('global', {}).get('keychainMapping', {}).get('fortify') or '')
155
- except Exception:
156
- print('')
157
- ")
158
- fi
159
- [ -z "$TOKEN_KEY" ] && TOKEN_KEY="${USER}_Fortify_Access_Token"
160
-
161
- # Locate the resolver with an existence check, not a `.`-chain.
162
- #
163
- # Sourcing a file that does not exist aborts the shell under `set -e` - `||` included -
164
- # so `. <candidate> || . <candidate> || { error }` reaches neither its later candidates
165
- # nor its error branch. Every fetcher used that shape starting from `$HOME/.claude/...`,
166
- # so on a Copilot-only or Codex-only install they all died with a bare exit 1 and no
167
- # message. Reordering does not help: whichever candidate is absent aborts at that point.
168
- # Checking for the file before sourcing it is the only safe form.
169
- for _cred_resolver in \
170
- "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)/credential-store-resolver.sh" \
171
- "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/../lib" 2>/dev/null && pwd)/credential-store-resolver.sh" \
172
- "$HOME/.claude/lib/credential-store-resolver.sh" \
173
- "$HOME/.copilot/lib/credential-store-resolver.sh" \
174
- "$HOME/.codex/lib/credential-store-resolver.sh"; do
175
- [ -f "$_cred_resolver" ] || continue
176
- # shellcheck source=/dev/null
177
- . "$_cred_resolver" 2>/dev/null || true
178
- # `if`, not `[ ... ] && break`: the latter is the loop body's last command and returns
179
- # 1 when CRED_STORE is still empty, which under `set -e` kills the loop on the first
180
- # candidate that does not resolve - the very case the loop exists to survive.
181
- if [ -n "${CRED_STORE:-}" ]; then break; fi
182
- done
183
- unset _cred_resolver
184
- if [ -z "${CRED_STORE:-}" ]; then
185
- printf '%s\n' '{"status":"blocked","reason":"missing-credential-helper","service":"fortify","expected_key":"'"$TOKEN_KEY"'"}' >&2
186
- exit 2
187
- fi
188
-
189
- TOKEN=$("$CRED_STORE" get "$TOKEN_KEY" 2>/dev/null || true)
190
- if [ -z "$TOKEN" ]; then
191
- printf '%s\n' '{"status":"blocked","reason":"missing-token","service":"fortify","expected_key":"'"$TOKEN_KEY"'"}' >&2
192
- exit 2
178
+ # Settled after the invocation is known to be well formed, so a usage error is
179
+ # reported as one rather than as a credential problem.
180
+ HOST="$(sa_host fortify "${SA_PICK[@]+"${SA_PICK[@]}"}")" || fortify_blocked
181
+ if [ -z "$HOST" ]; then
182
+ printf '%s\n' '{"status":"blocked","reason":"host-not-configured","service":"fortify","expected_pref":"global.hosts.fortify"}' >&2
183
+ exit 6
193
184
  fi
194
185
 
195
186
  API_BASE="https://$HOST/ssc/api/v1"
196
187
 
188
+ # Settled before the first request, outside any command substitution, so a
189
+ # missing credential exits with the contract's own status rather than reading
190
+ # as an authentication failure later.
191
+ sa_cfg fortify "$API_BASE/projectVersions" bearer "${SA_PICK[@]+"${SA_PICK[@]}"}" >/dev/null || fortify_blocked
192
+
197
193
  fortify_get() {
198
194
  # Usage: fortify_get <path-relative-to-API_BASE>
199
195
  local path="$1"
200
196
  local url="$API_BASE/$path"
201
- local resp http schemes
197
+ local resp http cfg
198
+ local -a schemes
202
199
  case "$AUTH_SCHEME" in
203
- bearer) schemes="bearer" ;;
204
- fortifytoken) schemes="fortifytoken" ;;
205
- *) schemes="bearer fortifytoken" ;;
200
+ bearer) schemes=(bearer) ;;
201
+ fortifytoken) schemes=(fortify-token) ;;
202
+ *) schemes=(bearer fortify-token) ;;
206
203
  esac
207
- for s in $schemes; do
208
- local hdr
209
- if [ "$s" = "bearer" ]; then
210
- hdr="Authorization: Bearer $TOKEN"
211
- else
212
- hdr="Authorization: FortifyToken $(printf '%s' "$TOKEN" | base64 | tr -d '\n')"
213
- fi
214
- # Auth header goes through a curl config via process substitution so the
215
- # token never appears in argv (argv is visible to ps).
204
+ for s in "${schemes[@]}"; do
205
+ # A refusal here cannot exit: this function is called from a command
206
+ # substitution, where an exit ends only the subshell. The account was
207
+ # already settled before the first request, so this reads as auth failure.
208
+ cfg="$(sa_cfg fortify "$url" "$s" "${SA_PICK[@]+"${SA_PICK[@]}"}")" || {
209
+ printf 'HTTP_AUTH_FAILED'
210
+ return 1
211
+ }
216
212
  resp=$(curl -sS --max-time "$TIMEOUT" --connect-timeout 5 -w "\n%{http_code}" \
217
- -K <(printf 'header = "%s"\n' "$hdr") \
218
- -H "Accept: application/json" "$url" 2>/dev/null || true)
213
+ --config "$cfg" \
214
+ -H "Accept: application/json" 2>/dev/null || true)
219
215
  http=$(printf '%s' "$resp" | tail -n1)
220
216
  if [ "$http" = "200" ]; then
221
217
  printf '%s' "$resp" | sed '$d'
@@ -22,12 +22,14 @@
22
22
  # `--env prod` / `--env test` pin a single instance.
23
23
  #
24
24
  # Required configuration:
25
- # prefs.global.hosts.graylog - production host (e.g. logs.example.com)
26
- # prefs.global.keychainMapping.graylog - keychain key holding the prod API token
25
+ # the prod account's host - production instance (e.g. logs.example.com)
26
+ # a graylog account scoped to prod - its token slot holds the API token
27
27
  # Optional (test environment):
28
- # prefs.global.hosts.graylogTest - test host; without it, test is skipped
29
- # prefs.global.keychainMapping.graylog_test - test token key; falls back to the prod
30
- # key when unset (shared-token deployments)
28
+ # the test account's host - test instance; without one, test is skipped
29
+ # a graylog account scoped to test - its own token. A deployment that
30
+ # issues one token for both names
31
+ # the same store item in both
32
+ # accounts
31
33
  #
32
34
  # Optional env:
33
35
  # GRAYLOG_TIMEOUT_SECONDS default 25
@@ -93,36 +95,21 @@ case "$ENVIRONMENT" in
93
95
  *) echo "ERR: --env must be auto, prod or test (got '$ENVIRONMENT')" >&2; exit 4 ;;
94
96
  esac
95
97
 
96
- # Hosts and token keys come from prefs (private config); skill templates only
97
- # show {GRAYLOG_HOST} / {GRAYLOG_TEST_HOST}.
98
- PREFS="$HOME/.claude/multi-agent-preferences.json"
99
-
100
- pref_str() {
101
- # Usage: pref_str <dotted.path.under.global> -> value or empty
102
- [ -f "$PREFS" ] || { printf ''; return 0; }
103
- PREF_PATH="$1" python3 -c "
104
- import json, os
105
- try:
106
- node = json.load(open('$PREFS')).get('global', {})
107
- for part in os.environ['PREF_PATH'].split('.'):
108
- node = node.get(part, {}) if isinstance(node, dict) else {}
109
- print(node if isinstance(node, str) else '')
110
- except Exception:
111
- print('')
112
- " 2>/dev/null || printf ''
113
- }
114
-
115
- HOST_PROD=$(pref_str hosts.graylog)
116
- HOST_TEST=$(pref_str hosts.graylogTest)
117
- HOST_PROD=${HOST_PROD%/}
118
- HOST_TEST=${HOST_TEST%/}
98
+ _MA_GL_HERE="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
99
+ # shellcheck source=/dev/null
100
+ if [ -f "$_MA_GL_HERE/_service-account.sh" ]; then
101
+ . "$_MA_GL_HERE/_service-account.sh"
102
+ elif [ -f "$HOME/.claude/lib/_service-account.sh" ]; then
103
+ . "$HOME/.claude/lib/_service-account.sh"
104
+ else
105
+ printf '%s\n' '{"status":"blocked","reason":"missing-credential-helper","service":"graylog"}' >&2
106
+ exit 2
107
+ fi
119
108
 
120
- KEY_PROD=$(pref_str keychainMapping.graylog)
121
- [ -z "$KEY_PROD" ] && KEY_PROD="${USER}_Graylog_Access_Token"
122
- # A test instance usually issues its own token, but plenty of deployments share
123
- # one; falling back to the prod key beats refusing to search test at all.
124
- KEY_TEST=$(pref_str keychainMapping.graylog_test)
125
- [ -z "$KEY_TEST" ] && KEY_TEST="$KEY_PROD"
109
+ # Each instance is an account of its own, scoped to its environment, so a test
110
+ # token can never be sent to production and the other way round.
111
+ HOST_PROD="$(sa_host graylog --environment production 2>/dev/null || true)"
112
+ HOST_TEST="$(sa_host graylog --environment test 2>/dev/null || true)"
126
113
 
127
114
  if [ -z "$TRX_ID" ] && [ -z "$CONV_ID" ]; then
128
115
  echo "ERR: no id (pass --trx <transaction-id> and/or --conv <conversation-id>)" >&2
@@ -143,33 +130,6 @@ if [ -n "$CONV_ID" ]; then
143
130
  fi
144
131
 
145
132
  # Locate the resolver with an existence check, not a `.`-chain.
146
- #
147
- # Sourcing a file that does not exist aborts the shell under `set -e` - `||` included -
148
- # so `. <candidate> || . <candidate> || { error }` reaches neither its later candidates
149
- # nor its error branch. Every fetcher used that shape starting from `$HOME/.claude/...`,
150
- # so on a Copilot-only or Codex-only install they all died with a bare exit 1 and no
151
- # message. Reordering does not help: whichever candidate is absent aborts at that point.
152
- # Checking for the file before sourcing it is the only safe form.
153
- for _cred_resolver in \
154
- "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)/credential-store-resolver.sh" \
155
- "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/../lib" 2>/dev/null && pwd)/credential-store-resolver.sh" \
156
- "$HOME/.claude/lib/credential-store-resolver.sh" \
157
- "$HOME/.copilot/lib/credential-store-resolver.sh" \
158
- "$HOME/.codex/lib/credential-store-resolver.sh"; do
159
- [ -f "$_cred_resolver" ] || continue
160
- # shellcheck source=/dev/null
161
- . "$_cred_resolver" 2>/dev/null || true
162
- # `if`, not `[ ... ] && break`: the latter is the loop body's last command and returns
163
- # 1 when CRED_STORE is still empty, which under `set -e` kills the loop on the first
164
- # candidate that does not resolve - the very case the loop exists to survive.
165
- if [ -n "${CRED_STORE:-}" ]; then break; fi
166
- done
167
- unset _cred_resolver
168
- if [ -z "${CRED_STORE:-}" ]; then
169
- printf '%s\n' '{"status":"blocked","reason":"missing-credential-helper","service":"graylog","expected_key":"'"$KEY_PROD"'"}' >&2
170
- exit 2
171
- fi
172
-
173
133
  # Graylog relative universal search, built once and reused per environment.
174
134
  ENC_QUERY=$(QUERY_IN="$QUERY" python3 -c "
175
135
  import os, urllib.parse as up
@@ -183,22 +143,20 @@ RUN_BODY=""
183
143
  RUN_HITS=0
184
144
 
185
145
  run_search() {
186
- # Usage: run_search <host> <token-key>
187
- local host="$1" token_key="$2" token url resp
188
- token=$("$CRED_STORE" get "$token_key" 2>/dev/null || true)
189
- if [ -z "$token" ]; then
146
+ # Usage: run_search <host> <environment>
147
+ local host="$1" environment="$2" url resp cfg
148
+ url="https://$host/api/$SEARCH_PATH"
149
+ # The config carries the URL as well as the credential, so this instance's
150
+ # token cannot travel to the other one, and a redirect is refused outright.
151
+ cfg=$(sa_cfg graylog "$url" graylog-pat --environment "$environment") || {
190
152
  RUN_HTTP="no-token"; RUN_BODY=""; RUN_HITS=0
191
153
  return 0
192
- fi
193
- url="https://$host/api/$SEARCH_PATH"
194
- # PAT basic auth: username=<token>, password=literal "token". The credential
195
- # goes through a curl config via process substitution so it never lands in
196
- # argv (argv is visible to ps).
154
+ }
197
155
  resp=$(curl -sS --max-time "$TIMEOUT" --connect-timeout 5 -w "\n%{http_code}" \
198
- -K <(printf 'user = "%s:token"\n' "$token") \
156
+ --config "$cfg" \
199
157
  -H "Accept: application/json" \
200
158
  -H "X-Requested-By: multi-agent-pipeline" \
201
- "$url" 2>/dev/null || true)
159
+ 2>/dev/null || true)
202
160
  RUN_HTTP=$(printf '%s' "$resp" | tail -n1)
203
161
  RUN_BODY=$(printf '%s' "$resp" | sed '$d')
204
162
  RUN_HITS=0
@@ -235,10 +193,13 @@ host_for() {
235
193
  *) printf '%s' "$HOST_PROD" ;;
236
194
  esac
237
195
  }
238
- key_for() {
196
+ # The accounts use the schema's vocabulary, which spells production in full;
197
+ # the flag and the reported environment stay the short form this script has
198
+ # always printed.
199
+ env_for() {
239
200
  case "$1" in
240
- test) printf '%s' "$KEY_TEST" ;;
241
- *) printf '%s' "$KEY_PROD" ;;
201
+ test) printf 'test' ;;
202
+ *) printf 'production' ;;
242
203
  esac
243
204
  }
244
205
 
@@ -263,7 +224,7 @@ BODY=""
263
224
  LAST_CANDIDATE="${CANDIDATES##* }"
264
225
  for _env in $CANDIDATES; do
265
226
  SEARCHED="${SEARCHED:+$SEARCHED }$_env"
266
- run_search "$(host_for "$_env")" "$(key_for "$_env")"
227
+ run_search "$(host_for "$_env")" "$(env_for "$_env")"
267
228
  HOST=$(host_for "$_env")
268
229
  ENV_USED="$_env"
269
230
  HTTP="$RUN_HTTP"
@@ -282,7 +243,7 @@ for _env in $CANDIDATES; do
282
243
  done
283
244
 
284
245
  if [ "$HTTP" = "no-token" ]; then
285
- printf '%s\n' '{"status":"blocked","reason":"missing-token","service":"graylog","expected_key":"'"$(key_for "$ENV_USED")"'"}' >&2
246
+ printf '%s\n' '{"status":"blocked","reason":"missing-token","service":"graylog","environment":"'"$(env_for "$ENV_USED")"'"}' >&2
286
247
  exit 2
287
248
  fi
288
249
 
@@ -5,7 +5,7 @@
5
5
  # expired-token decision (refs/keychain.md). Never prints token values - status lines only.
6
6
  #
7
7
  # Flow:
8
- # 1. Resolve the access-token Keychain name from prefs.global.keychainMapping.figma_mcp.
8
+ # 1. Ask the account resolver which store item each slot lives in.
9
9
  # 2. Read the refresh token from "<name>_Refresh" (written by the user's generation script).
10
10
  # 3. Read client credentials from .figma-oauth.json next to prefs.global.tokenScripts.figma_mcp.
11
11
  # 4. POST grant_type=refresh_token to the Figma token endpoint.
@@ -43,10 +43,29 @@ say() { printf '%s\n' "$*"; }
43
43
 
44
44
  [ -f "$PREFS_FILE" ] || { say "figma-mcp-refresh: prefs file missing ($PREFS_FILE)"; exit 2; }
45
45
 
46
- KEY_NAME=$(jq -r '.global.keychainMapping.figma_mcp // empty' "$PREFS_FILE")
47
- [ -n "$KEY_NAME" ] || { say "figma-mcp-refresh: keychainMapping.figma_mcp not set"; exit 2; }
46
+ # The store item each slot lives in, named by the account rather than derived
47
+ # from a key here: a second place that builds the name is a second place that
48
+ # can be renamed out from under the first.
49
+ sa_item() {
50
+ local slot="$1" script
51
+ for script in \
52
+ "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)/service-account.sh" \
53
+ "$HOME/.claude/lib/service-account.sh" \
54
+ "$HOME/.copilot/lib/service-account.sh" \
55
+ "$HOME/.codex/lib/service-account.sh"; do
56
+ [ -x "$script" ] || continue
57
+ bash "$script" item-ref --service figma_mcp --slot "$slot" 2>/dev/null |
58
+ jq -r '.itemName // empty'
59
+ return 0
60
+ done
61
+ return 0
62
+ }
63
+
64
+ KEY_NAME=$(sa_item token)
65
+ [ -n "$KEY_NAME" ] || { say "figma-mcp-refresh: no Figma MCP account is configured"; exit 2; }
48
66
 
49
- REFRESH_KEY="${KEY_NAME}_Refresh"
67
+ REFRESH_KEY=$(sa_item refresh_token)
68
+ [ -n "$REFRESH_KEY" ] || REFRESH_KEY="${KEY_NAME}_Refresh"
50
69
 
51
70
  # Locate the resolver with an existence check, not a `.`-chain.
52
71
  #
@@ -90,12 +90,12 @@ for _figma_token_lib in \
90
90
  [ -f "$_figma_token_lib" ] || continue
91
91
  # shellcheck source=/dev/null
92
92
  . "$_figma_token_lib" 2>/dev/null || true
93
- if command -v resolve_figma_token >/dev/null 2>&1; then break; fi
93
+ if command -v figma_cfg >/dev/null 2>&1; then break; fi
94
94
  done
95
95
  unset _figma_token_lib
96
- if ! command -v resolve_figma_token >/dev/null 2>&1; then
97
- resolve_figma_token() { [ -n "${FIGMA_PAT:-}" ] && printf '%s' "$FIGMA_PAT"; }
98
- figma_token_remediation() { printf 'figma-token.sh not found - reinstall the pipeline, or export FIGMA_PAT.'; }
96
+ if ! command -v figma_cfg >/dev/null 2>&1; then
97
+ figma_cfg() { return 2; }
98
+ figma_token_remediation() { printf 'figma-token.sh not found - reinstall the pipeline.'; }
99
99
  fi
100
100
 
101
101
  FIGMA_API="https://api.figma.com/v1"
@@ -206,6 +206,7 @@ PY
206
206
  curl_figma() {
207
207
  local out="$1" url="$2"
208
208
  local code attempt sleep_s
209
+ figma_cfg "$url" || { printf '000'; return 0; }
209
210
  for attempt in 1 2 3; do
210
211
  # Token header goes through a curl config via process substitution so it
211
212
  # never appears in argv (argv is visible to ps).
@@ -220,8 +221,7 @@ curl_figma() {
220
221
  # genuinely empty.
221
222
  code=$(curl -sS -o "$out" -w '%{http_code}' \
222
223
  --max-time "$HTTP_TIMEOUT" --connect-timeout 5 \
223
- -K <(printf 'header = "X-Figma-Token: %s"\n' "$FIGMA_TOKEN") \
224
- "$url") || true
224
+ --config "$FIGMA_CFG") || true
225
225
  code="${code:-000}"
226
226
  case "$code" in
227
227
  2*) printf '%s' "$code"; return 0 ;;
@@ -446,8 +446,7 @@ require_cmd python3
446
446
  # Tier 1 (Figma MCP) is not reachable from a bash script. Stay on Tier 2 (REST).
447
447
  log "INFO: Tier 1 (Figma MCP) not available from shell; using Tier 2 (REST)."
448
448
 
449
- FIGMA_TOKEN=$(resolve_figma_token || true)
450
- if [ -z "${FIGMA_TOKEN:-}" ]; then
449
+ if ! figma_cfg "$FIGMA_API/files/${FILE_KEY:-x}"; then
451
450
  log "Tier 3 (user-provided screenshot required): no PAT resolved."
452
451
  log "Hint: $(figma_token_remediation)"
453
452
  exit 3