@mmerterden/multi-agent-pipeline 23.7.0 → 24.1.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 (162) hide show
  1. package/CHANGELOG.md +60 -1
  2. package/README.md +59 -24
  3. package/README.tr.md +43 -8
  4. package/SECURITY.md +3 -3
  5. package/docs/architecture.md +41 -4
  6. package/docs/ecosystem.md +15 -13
  7. package/docs/facts.json +5 -4
  8. package/docs/features.md +67 -15
  9. package/install/_codex-agents.mjs +13 -8
  10. package/install/_common.mjs +24 -0
  11. package/install/_dev-only-files.mjs +5 -0
  12. package/install/_mcp-register.mjs +6 -2
  13. package/install/_rewrite-tree.mjs +197 -0
  14. package/install/codex.mjs +96 -180
  15. package/install/copilot.mjs +24 -54
  16. package/install/index.mjs +29 -11
  17. package/install/templates/codex-instructions.md +21 -5
  18. package/install/templates/copilot-instructions.md +21 -14
  19. package/manifest.json +2083 -0
  20. package/package.json +8 -2
  21. package/pipeline/commands/multi-agent/SKILL.md +5 -4
  22. package/pipeline/commands/multi-agent/analysis/SKILL.md +5 -1
  23. package/pipeline/commands/multi-agent/autopilot-on/SKILL.md +31 -3
  24. package/pipeline/commands/multi-agent/autopilot-status/SKILL.md +5 -1
  25. package/pipeline/commands/multi-agent/channels/SKILL.md +16 -8
  26. package/pipeline/commands/multi-agent/log/SKILL.md +2 -0
  27. package/pipeline/commands/multi-agent/stack/SKILL.md +1 -1
  28. package/pipeline/contract/CHANGELOG.md +15 -0
  29. package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
  30. package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
  31. package/pipeline/contract/fixtures/runs-awaiting-question.json +6 -1
  32. package/pipeline/contract/fixtures/runs-empty.json +1 -1
  33. package/pipeline/contract/fixtures/runs-failed.json +21 -1
  34. package/pipeline/contract/fixtures/runs-old-schema.json +18 -3
  35. package/pipeline/contract/fixtures/runs-pr-opened-redacted.json +31 -1
  36. package/pipeline/contract/fixtures/runs-pr-opened.json +31 -1
  37. package/pipeline/contract/fixtures/runs-running.json +16 -1
  38. package/pipeline/contract/manifest.json +14 -14
  39. package/pipeline/contract/types/index.d.ts +20 -1
  40. package/pipeline/lib/_jira-auth.sh +50 -78
  41. package/pipeline/lib/_service-account.sh +191 -0
  42. package/pipeline/lib/credential-inventory.sh +49 -37
  43. package/pipeline/lib/credential-store.sh +48 -3
  44. package/pipeline/lib/fetch-confluence.sh +76 -92
  45. package/pipeline/lib/fetch-crashlytics.sh +30 -59
  46. package/pipeline/lib/fetch-figma-annotations.sh +9 -9
  47. package/pipeline/lib/fetch-fortify.sh +77 -81
  48. package/pipeline/lib/fetch-graylog.sh +38 -77
  49. package/pipeline/lib/figma-mcp-refresh.sh +23 -4
  50. package/pipeline/lib/figma-screenshot.sh +7 -8
  51. package/pipeline/lib/figma-token.sh +39 -46
  52. package/pipeline/lib/host.mjs +138 -0
  53. package/pipeline/lib/host.sh +48 -0
  54. package/pipeline/lib/issue-fetcher.sh +25 -41
  55. package/pipeline/lib/jira-publish.sh +23 -21
  56. package/pipeline/lib/local-model.mjs +93 -0
  57. package/pipeline/lib/md2confluence-v3.py +37 -30
  58. package/pipeline/lib/model-dispatch.sh +41 -4
  59. package/pipeline/lib/model-resolve.mjs +58 -0
  60. package/pipeline/lib/post-pr-review.sh +38 -53
  61. package/pipeline/lib/reviewer-families.mjs +70 -0
  62. package/pipeline/lib/service-account.mjs +2131 -0
  63. package/pipeline/lib/service-account.sh +35 -0
  64. package/pipeline/lib/usage-token.mjs +64 -24
  65. package/pipeline/lib/usage-vocab.mjs +1 -1
  66. package/pipeline/lib/user-facing.mjs +11 -3
  67. package/pipeline/lib/vercel-deploy.sh +17 -26
  68. package/pipeline/multi-agent-refs/_entry-picker.md +62 -0
  69. package/pipeline/multi-agent-refs/analysis/intake.md +2 -0
  70. package/pipeline/multi-agent-refs/analysis/render.md +12 -1
  71. package/pipeline/multi-agent-refs/analysis/reusable-refs.md +1 -0
  72. package/pipeline/multi-agent-refs/analysis/unattended.md +135 -0
  73. package/pipeline/multi-agent-refs/autopilot-on/details.md +16 -0
  74. package/pipeline/multi-agent-refs/channels/generator.md +10 -2
  75. package/pipeline/multi-agent-refs/channels/menu.md +3 -1
  76. package/pipeline/multi-agent-refs/channels/preview.md +3 -1
  77. package/pipeline/multi-agent-refs/channels/reference.md +16 -2
  78. package/pipeline/multi-agent-refs/channels/report-file.md +188 -0
  79. package/pipeline/multi-agent-refs/cross-cli-contract.md +35 -27
  80. package/pipeline/multi-agent-refs/features/doctor.md +37 -11
  81. package/pipeline/multi-agent-refs/features/free-models.md +3 -3
  82. package/pipeline/multi-agent-refs/features/local-model.md +87 -0
  83. package/pipeline/multi-agent-refs/features/model-fallback.md +25 -10
  84. package/pipeline/multi-agent-refs/features/product-context.md +6 -5
  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 +36 -1
  88. package/pipeline/multi-agent-refs/help/tr.md +34 -1
  89. package/pipeline/multi-agent-refs/orchestrator/copilot-pipeline.md +2 -1
  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/phase-0-init.md +1 -0
  93. package/pipeline/multi-agent-refs/phases/phase-4-commit.md +1 -0
  94. package/pipeline/multi-agent-refs/phases/phase-5-report.md +13 -11
  95. package/pipeline/multi-agent-refs/phases.md +4 -3
  96. package/pipeline/multi-agent-refs/review/panel.md +30 -18
  97. package/pipeline/multi-agent-refs/setup/discovery.md +17 -5
  98. package/pipeline/multi-agent-refs/setup/token-save-flow.md +21 -2
  99. package/pipeline/multi-agent-refs/sync/overview.md +11 -5
  100. package/pipeline/multi-agent-refs/tracker-contract.md +64 -20
  101. package/pipeline/office/index.html +77 -4
  102. package/pipeline/schemas/activity.schema.json +63 -4
  103. package/pipeline/schemas/autopilot-config.schema.json +29 -4
  104. package/pipeline/schemas/hosts.json +512 -0
  105. package/pipeline/schemas/hosts.schema.json +310 -0
  106. package/pipeline/schemas/launch.json +22 -2
  107. package/pipeline/schemas/launch.schema.json +2 -1
  108. package/pipeline/schemas/now-lines.json +103 -0
  109. package/pipeline/schemas/now-lines.schema.json +42 -0
  110. package/pipeline/schemas/phases.json +19 -1
  111. package/pipeline/schemas/phases.schema.json +8 -0
  112. package/pipeline/schemas/prefs.schema.json +331 -4
  113. package/pipeline/schemas/runs-index.schema.json +22 -1
  114. package/pipeline/scripts/_autopilot-config.mjs +67 -4
  115. package/pipeline/scripts/_autopilot-item.mjs +67 -0
  116. package/pipeline/scripts/_autopilot-outcomes.mjs +6 -0
  117. package/pipeline/scripts/_contract-core.mjs +1 -1
  118. package/pipeline/scripts/_cost.mjs +75 -3
  119. package/pipeline/scripts/activity-snapshot.mjs +27 -1
  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 +7 -9
  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 +226 -50
  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/render-work-summary.sh +51 -1
  145. package/pipeline/scripts/report-file.mjs +285 -0
  146. package/pipeline/scripts/rework-escalation.mjs +19 -4
  147. package/pipeline/scripts/runs-index.mjs +2 -1
  148. package/pipeline/scripts/service-read.mjs +19 -17
  149. package/pipeline/scripts/skill-siblings.mjs +17 -1
  150. package/pipeline/scripts/status-overview.mjs +20 -10
  151. package/pipeline/scripts/uninstall.mjs +145 -57
  152. package/pipeline/scripts/usage-register.mjs +34 -11
  153. package/pipeline/scripts/usage-report.mjs +31 -26
  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 +4 -4
  158. package/pipeline/skills/.skills-index.json +1 -1
  159. package/pipeline/skills/shared/core/multi-agent/SKILL.md +11 -3
  160. package/pipeline/skills/shared/core/multi-agent-analysis/SKILL.md +2 -0
  161. package/pipeline/skills/shared/core/multi-agent-channels/SKILL.md +11 -8
  162. package/pipeline/lib/credential-resolve.mjs +0 -75
@@ -94,10 +94,20 @@ if [ -f "$_MA_RP_HERE/run-paths.sh" ]; then . "$_MA_RP_HERE/run-paths.sh"; else
94
94
  # shellcheck source=/dev/null
95
95
  if [ -f "$_MA_RP_HERE/user-facing.sh" ]; then . "$_MA_RP_HERE/user-facing.sh"; else . "$HOME/.claude/lib/user-facing.sh"; fi
96
96
 
97
+ # shellcheck source=/dev/null
98
+ if [ -f "$_MA_RP_HERE/_service-account.sh" ]; then
99
+ . "$_MA_RP_HERE/_service-account.sh"
100
+ elif [ -f "$HOME/.claude/lib/_service-account.sh" ]; then
101
+ . "$HOME/.claude/lib/_service-account.sh"
102
+ fi
97
103
 
98
- # Basic-auth via a curl config fed through process substitution so the
99
- # credential never appears in argv (argv is visible to `ps` / process audit).
100
- bb_auth_cfg() { printf 'user = "%s:%s"\n' "$1" "$2"; }
104
+ # A curl config carrying the Bitbucket credential to exactly this URL. Sets
105
+ # BB_CFG rather than printing it: a caller reading it through a command
106
+ # substitution would resolve in a subshell, where a refusal cannot be reported.
107
+ BB_CFG=""
108
+ bb_cfg() {
109
+ BB_CFG="$(sa_cfg bitbucket "$1" basic)"
110
+ }
101
111
 
102
112
  TASK_ID="${1:-}"
103
113
 
@@ -257,12 +267,12 @@ compute_next_iteration() {
257
267
  # them into the same `[{body: <text>}, ...]` shape that
258
268
  # comment_exists_with_fingerprint expects so the dedupe gate is provider-agnostic.
259
269
  load_existing_comments_bitbucket() {
260
- local host="$1" project="$2" slug="$3" pr_num="$4" auth_user="$5" auth_token="$6"
270
+ local host="$1" project="$2" slug="$3" pr_num="$4"
261
271
  if [ -z "$EXISTING_COMMENTS_CACHE" ]; then
262
272
  local base="https://$host/rest/api/1.0/projects/$project/repos/$slug/pull-requests/$pr_num"
263
273
  local raw
264
- raw=$(curl -sS -m 30 -K <(bb_auth_cfg "$auth_user" "$auth_token") \
265
- "$base/activities?fromType=COMMENT&limit=100" 2>/dev/null || echo "{}")
274
+ bb_cfg "$base/activities?fromType=COMMENT&limit=100" || { EXISTING_COMMENTS_CACHE="[]"; return 0; }
275
+ raw=$(curl -sS -m 30 --config "$BB_CFG" 2>/dev/null || echo "{}")
266
276
  EXISTING_COMMENTS_CACHE=$(jq '
267
277
  def collect_texts(c):
268
278
  if c == null then []
@@ -363,55 +373,27 @@ post_github() {
363
373
  }
364
374
 
365
375
  post_bitbucket_server() {
366
- local host project slug user_slug auth_user auth_token user_key token_key prefs
376
+ local host project slug user_slug
367
377
  host=$(jq -r '.review.input.bbServerHost' "$AGENT_STATE")
368
378
  project=$(jq -r '.review.input.bbProjectKey' "$AGENT_STATE")
369
379
  slug=$(jq -r '.review.input.bbRepoSlug' "$AGENT_STATE")
370
380
 
371
- # Resolve credential keys from prefs.keychainMapping - never hardcode.
372
- prefs="$HOME/.claude/multi-agent-preferences.json"
373
- user_key=$(jq -r '.global.keychainMapping.bitbucket_user // empty' "$prefs" 2>/dev/null || true)
374
- token_key=$(jq -r '.global.keychainMapping.bitbucket_token // empty' "$prefs" 2>/dev/null || true)
381
+ local base="https://$host/rest/api/1.0/projects/$project/repos/$slug/pull-requests/$PR_NUM"
375
382
 
376
- if [ -z "$user_key" ] || [ -z "$token_key" ]; then
377
- echo "post-pr-review: global.keychainMapping.bitbucket_user / .bitbucket_token unset in $prefs" >&2
383
+ # The participant URL carries the reviewer's own name, so the username slot
384
+ # is read as a value here; the password never is.
385
+ if ! command -v sa_cfg >/dev/null 2>&1; then
386
+ echo "post-pr-review: the account resolver is not installed" >&2
378
387
  return 4
379
388
  fi
380
-
381
- # Resolve via the credential helper (macOS Keychain) - sourced lazily so this script keeps
382
- # working when run from either ~/.claude/lib or ~/.copilot/lib.
383
- # shellcheck disable=SC1090
384
- # Existence check before sourcing: `. <missing>` aborts the shell under `set -e`,
385
- # `||` included, so a `.`-chain reaches neither its later candidates nor its error
386
- # branch. The loop also covers all three hosts - the chain it replaced knew only
387
- # .claude and .copilot, so a Codex-only install could not resolve at all.
388
- for _cred_resolver in \
389
- "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)/credential-store-resolver.sh" \
390
- "$HOME/.claude/lib/credential-store-resolver.sh" \
391
- "$HOME/.copilot/lib/credential-store-resolver.sh" \
392
- "$HOME/.codex/lib/credential-store-resolver.sh"; do
393
- [ -f "$_cred_resolver" ] || continue
394
- # shellcheck source=/dev/null
395
- . "$_cred_resolver" 2>/dev/null || true
396
- if [ -n "${CRED_STORE:-}" ]; then break; fi
397
- done
398
- unset _cred_resolver
399
- if [ -z "${CRED_STORE:-}" ]; then
400
- echo "post-pr-review: credential helper not found" >&2
389
+ user_slug=$(sa_token bitbucket "$base" --slot username) || {
390
+ echo "post-pr-review: $(sa_explain)" >&2
401
391
  return 4
402
- fi
403
- resolve_credential_store || return 4
404
-
405
- auth_user=$("$CRED_STORE" get "$user_key" 2>/dev/null || true)
406
- auth_token=$("$CRED_STORE" get "$token_key" 2>/dev/null || true)
407
- user_slug="$auth_user"
408
-
409
- if [ -z "$auth_user" ] || [ -z "$auth_token" ]; then
410
- echo "post-pr-review: bitbucket creds not in credential store ($user_key / $token_key)" >&2
392
+ }
393
+ bb_cfg "$base" || {
394
+ echo "post-pr-review: $(sa_explain)" >&2
411
395
  return 4
412
- fi
413
-
414
- local base="https://$host/rest/api/1.0/projects/$project/repos/$slug/pull-requests/$PR_NUM"
396
+ }
415
397
 
416
398
  # Dedupe gate - read pref, default ON. Bitbucket uses the activities feed.
417
399
  local DEDUPE_ENABLED
@@ -420,7 +402,7 @@ post_bitbucket_server() {
420
402
  # Load existing comments on any needs_work post: dedupe needs them when
421
403
  # enabled, and the iteration counter is always derived from them.
422
404
  if [ "$DECISION" = "needs_work" ]; then
423
- load_existing_comments_bitbucket "$host" "$project" "$slug" "$PR_NUM" "$auth_user" "$auth_token"
405
+ load_existing_comments_bitbucket "$host" "$project" "$slug" "$PR_NUM"
424
406
  ITERATION=$(compute_next_iteration)
425
407
  fi
426
408
 
@@ -449,8 +431,9 @@ post_bitbucket_server() {
449
431
  if [ "$line" -gt 0 ] 2>/dev/null; then
450
432
  payload=$(jq -n --arg t "$body" --arg p "$path" --argjson l "$line" \
451
433
  '{text: $t, anchor: {path: $p, line: $l, lineType: "ADDED", fileType: "TO"}}')
452
- http=$(curl -sS -m 30 -K <(bb_auth_cfg "$auth_user" "$auth_token") -X POST \
453
- -H "Content-Type: application/json" "$base/comments" \
434
+ bb_cfg "$base/comments" || { echo "post-pr-review: $(sa_explain)" >&2; return 4; }
435
+ http=$(curl -sS -m 30 --config "$BB_CFG" -X POST \
436
+ -H "Content-Type: application/json" \
454
437
  -d "$payload" -o /dev/null -w '%{http_code}' || echo 000)
455
438
  if [ "$http" = "200" ] || [ "$http" = "201" ]; then
456
439
  inline_ok=1
@@ -461,8 +444,9 @@ post_bitbucket_server() {
461
444
 
462
445
  if [ "$inline_ok" -eq 0 ]; then
463
446
  payload=$(jq -n --arg t "$body" '{text: $t}')
464
- curl -sS -m 30 -K <(bb_auth_cfg "$auth_user" "$auth_token") -X POST \
465
- -H "Content-Type: application/json" "$base/comments" \
447
+ bb_cfg "$base/comments" || { echo "post-pr-review: $(sa_explain)" >&2; return 4; }
448
+ curl -sS -m 30 --config "$BB_CFG" -X POST \
449
+ -H "Content-Type: application/json" \
466
450
  -d "$payload" >/dev/null \
467
451
  || echo "post-pr-review: bitbucket top-level comment failed for $path:$line" >&2
468
452
  fi
@@ -476,8 +460,9 @@ post_bitbucket_server() {
476
460
  esac
477
461
 
478
462
  local http
479
- http=$(curl -sS -m 30 -K <(bb_auth_cfg "$auth_user" "$auth_token") -X PUT \
480
- -H "Content-Type: application/json" "$base/participants/$user_slug" \
463
+ bb_cfg "$base/participants/$user_slug" || { echo "post-pr-review: $(sa_explain)" >&2; return 4; }
464
+ http=$(curl -sS -m 30 --config "$BB_CFG" -X PUT \
465
+ -H "Content-Type: application/json" \
481
466
  -d "$status_payload" -o /dev/null -w '%{http_code}' || echo 000)
482
467
  case "$http" in
483
468
  200|201) ;;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * reviewer-families.mjs - the reviewer families anonymized triage may name.
3
+ *
4
+ * Triage sees `Source A/B/C`, never a model. After it decides, the label map
5
+ * writes a FAMILY back onto each finding for per-reviewer telemetry, and the
6
+ * validator refuses any other value.
7
+ *
8
+ * Both lists are derived from the host registry rather than written out here,
9
+ * so a rung added there is covered without a second edit. A hand-written list
10
+ * fails quietly for a model outside it: nothing rejects the model, it simply
11
+ * gets no family, and a finding with no reviewer passes the validator.
12
+ *
13
+ * Order is load-bearing: rung names come first, so `claude-opus-4.7` is `opus`
14
+ * and not `claude`. The vendor prefix is the fallback for a model whose rung
15
+ * name is not in its id.
16
+ *
17
+ * @module pipeline/lib/reviewer-families
18
+ */
19
+
20
+ import { HOST_IDS, REGISTRY } from "./host.mjs";
21
+
22
+ /**
23
+ * Every family a reviewer slot can produce, rung names first.
24
+ *
25
+ * Derived from the review PANEL and triage slots, not from the rung ladder: a
26
+ * rung the ladder carries but no panel seats cannot author a finding, and
27
+ * accepting it would let the validator pass a reviewer that never ran.
28
+ *
29
+ * A slot naming a model whose id carries a rung name is that rung (one host
30
+ * seats its own build of the same tier). A slot naming anything else is its
31
+ * vendor, because on that host the tier distinction is carried by effort rather
32
+ * than by the model id.
33
+ */
34
+ function buildFamilies(registry = REGISTRY, ids = HOST_IDS) {
35
+ const rungs = [];
36
+ const vendors = [];
37
+ for (const id of ids) {
38
+ const host = registry.hosts[id];
39
+ const ladder = Object.keys(host?.models?.rungs ?? {});
40
+ for (const slot of [...(host?.review?.panel ?? []), host?.review?.triage].filter(Boolean)) {
41
+ if (slot.rung) {
42
+ if (!rungs.includes(slot.rung)) rungs.push(slot.rung);
43
+ continue;
44
+ }
45
+ const model = String(slot.model ?? "").toLowerCase();
46
+ const named = ladder.find((rung) => model.includes(rung));
47
+ if (named) {
48
+ if (!rungs.includes(named)) rungs.push(named);
49
+ continue;
50
+ }
51
+ const prefix = /^([a-z]+)/.exec(model)?.[1];
52
+ if (prefix && !vendors.includes(prefix)) vendors.push(prefix);
53
+ }
54
+ }
55
+ return Object.freeze([...rungs, ...vendors.filter((v) => !rungs.includes(v))]);
56
+ }
57
+
58
+ /** @type {ReadonlyArray<string>} */
59
+ export const FAMILIES = buildFamilies();
60
+
61
+ /**
62
+ * The reviewer family a model name belongs to, or null when none matches.
63
+ *
64
+ * @param {unknown} model
65
+ * @returns {string|null}
66
+ */
67
+ export function familyOf(model) {
68
+ const m = String(model ?? "").toLowerCase();
69
+ return FAMILIES.find((f) => m.includes(f)) ?? null;
70
+ }