@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
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bash
2
+ # service-account.sh - the shell front door to pipeline/lib/service-account.mjs.
3
+ #
4
+ # Shell callers need the same answers Node callers get, and the one way to be
5
+ # sure they do is for there to be one implementation. This script resolves the
6
+ # module beside it and hands the arguments straight through; the exit status
7
+ # and both streams are the module's own.
8
+ #
9
+ # Usage:
10
+ # service-account.sh select --service S [--account ID] [--url U|--host H]
11
+ # [--environment E] [--project-id P] [--owner O]
12
+ # [--identity I] [--item NAME]
13
+ # service-account.sh token --service S (--url U|--host H) [--slot SLOT] [selectors]
14
+ # service-account.sh curl-config --service S --url U [--scheme SCHEME] [selectors]
15
+ # service-account.sh item-ref --service appstore_connect --slot password_item [--account ID]
16
+ # service-account.sh items [--service S]
17
+ # service-account.sh list [--service S]
18
+ # service-account.sh check
19
+ #
20
+ # Schemes: bearer (default), basic, basic-token-user, basic-or-bearer,
21
+ # figma-pat, fortify-token, graylog-pat.
22
+ #
23
+ # stdout: `token` the raw secret with no trailing newline, `curl-config` a curl
24
+ # config, everything else one JSON line. On a refusal stdout is empty and one
25
+ # JSON line goes to stderr.
26
+ set -euo pipefail
27
+
28
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
29
+
30
+ if ! command -v node >/dev/null 2>&1; then
31
+ printf '%s\n' '{"ok":false,"reason":"invalid-request","message":"node is not on PATH.","remedy":"Install Node, which the rest of the pipeline already needs."}' >&2
32
+ exit 3
33
+ fi
34
+
35
+ exec node "$HERE/service-account.mjs" "$@"
@@ -57,6 +57,7 @@ export const SHIPPED_COMMANDS = Object.freeze([
57
57
  "review-issue",
58
58
  "review-jira",
59
59
  "review-priority",
60
+ "review-rounds",
60
61
  "route-off",
61
62
  "route-on",
62
63
  "route-status",
@@ -171,6 +172,7 @@ export const SHIPPED_SKILLS = Object.freeze([
171
172
  "homekit-matter",
172
173
  "html-semantic",
173
174
  "humanizer",
175
+ "ink-animation",
174
176
  "ios-accessibility",
175
177
  "ios-coding-standard",
176
178
  "ios-design-review",
@@ -241,6 +243,7 @@ export const SHIPPED_SKILLS = Object.freeze([
241
243
  "multi-agent-review-issue",
242
244
  "multi-agent-review-jira",
243
245
  "multi-agent-review-priority",
246
+ "multi-agent-review-rounds",
244
247
  "multi-agent-route-off",
245
248
  "multi-agent-route-on",
246
249
  "multi-agent-route-status",
@@ -2,20 +2,29 @@
2
2
  * usage-token.mjs - the machine's usage token and where it may be sent.
3
3
  *
4
4
  * Feedback and routine sharing authenticate with the token usage registration
5
- * already stored, so neither onboards a credential of its own. Lookup order:
6
- * MULTI_AGENT_USAGE_TOKEN, an inline `usageLog.token`, then the credential
7
- * store entry named by `keychainMapping.usage_ingest`, asked of each
8
- * installed host's helper in turn (~/.claude, ~/.copilot, ~/.codex) until
9
- * one answers. The store is read by running its helper with the entry name
10
- * only; the value comes back on stdout and never reaches an argv.
5
+ * already stored, so neither onboards a credential of its own.
6
+ *
7
+ * The destination is decided before any value is produced: the account
8
+ * resolver is asked whether a usage account covers the endpoint this token is
9
+ * about to reach, and a refusal is the empty string. Only then does the
10
+ * lookup run - the environment, an inline `usageLog.token`, then the store,
11
+ * asked of each installed host's helper in turn (~/.claude, ~/.copilot,
12
+ * ~/.codex) until one answers. The store read goes through the resolver, so
13
+ * the item name is an argument and the value comes back on stdout, never an
14
+ * argv.
15
+ *
16
+ * The account's host is the endpoint the machine reports to: `usageLog.endpoint`,
17
+ * else the built-in one. A caller that sends somewhere else - a dev endpoint, a
18
+ * site the prefs do not name - is refused rather than given the token.
11
19
  *
12
20
  * @module pipeline/lib/usage-token
13
21
  */
14
22
 
15
- import { execFileSync } from "node:child_process";
16
23
  import { existsSync } from "node:fs";
17
24
  import { homedir } from "node:os";
18
25
  import { join } from "node:path";
26
+ import { resolveSecret, selectAccount } from "./service-account.mjs";
27
+ import { DEFAULT_ENDPOINT } from "./usage-endpoint.mjs";
19
28
 
20
29
  const LOOPBACK = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
21
30
  /** The host roots under the home directory, in the order their stores are asked. */
@@ -34,28 +43,59 @@ export function credentialStores(home = homedir()) {
34
43
  );
35
44
  }
36
45
 
46
+ /**
47
+ * The preferences the resolver reads for the usage account, with the endpoint
48
+ * this machine reports to filled in.
49
+ *
50
+ * A file that names no endpoint still reports somewhere: the built-in one. The
51
+ * account's host comes from that, so "nothing configured" and "configured for
52
+ * the built-in site" answer the same, and neither one widens to a host the
53
+ * caller picked for itself.
54
+ *
55
+ * @param {object} globalPrefs prefs.global
56
+ */
57
+ export function usagePrefs(globalPrefs) {
58
+ const g = globalPrefs ?? {};
59
+ const usageLog = g.usageLog ?? {};
60
+ return {
61
+ global: { ...g, usageLog: { ...usageLog, endpoint: usageLog.endpoint || DEFAULT_ENDPOINT } },
62
+ };
63
+ }
64
+
37
65
  /**
38
66
  * @param {object} globalPrefs prefs.global
39
- * @param {{env?: NodeJS.ProcessEnv, home?: string}} [opts]
40
- * @returns {string} the token, or "" when none resolves
67
+ * @param {{env?: NodeJS.ProcessEnv, home?: string, endpoint?: string}} [opts]
68
+ * `endpoint` is where the token is about to be sent; without one the
69
+ * endpoint the preferences name is the destination.
70
+ * @returns {string} the token, or "" when none resolves or the destination is refused
41
71
  */
42
- export function resolveUsageToken(globalPrefs, { env = process.env, home = homedir() } = {}) {
43
- if (env.MULTI_AGENT_USAGE_TOKEN) return env.MULTI_AGENT_USAGE_TOKEN;
72
+ export function resolveUsageToken(
73
+ globalPrefs,
74
+ { env = process.env, home = homedir(), endpoint } = {},
75
+ ) {
76
+ const prefs = usagePrefs(globalPrefs);
77
+ const url = String(endpoint || prefs.global.usageLog.endpoint || "").trim();
78
+ const request = { service: "usage_ingest", url: url || undefined };
79
+
80
+ // A value the person supplied outright - exported, or written into the
81
+ // preferences beside the endpoint - is bound the way the resolver binds an
82
+ // environment credential: to what this machine's accounts already reach, to
83
+ // the endpoint the file names, and to loopback. Handing it to the resolver
84
+ // as that credential is how one rule covers both, rather than a second check
85
+ // written here that could drift from it.
44
86
  const inline = globalPrefs?.usageLog?.token;
45
- if (typeof inline === "string" && inline.trim()) return inline.trim();
46
- const name = globalPrefs?.keychainMapping?.usage_ingest;
47
- if (typeof name !== "string" || !name.trim()) return "";
87
+ const supplied =
88
+ String(env.MULTI_AGENT_USAGE_TOKEN ?? "").trim() ||
89
+ (typeof inline === "string" ? inline.trim() : "");
90
+ if (supplied) {
91
+ const withSupplied = { ...env, MULTI_AGENT_USAGE_TOKEN: supplied };
92
+ return selectAccount(request, { prefs, env: withSupplied }).ok ? supplied : "";
93
+ }
94
+
95
+ if (!selectAccount(request, { prefs, env }).ok) return "";
48
96
  for (const store of credentialStores(home)) {
49
- try {
50
- const out = execFileSync("bash", [store, "get", name.trim()], {
51
- encoding: "utf-8",
52
- timeout: 4000,
53
- stdio: ["ignore", "pipe", "ignore"],
54
- }).trim();
55
- if (out) return out;
56
- } catch {
57
- /* this host's credential store is unavailable; try the next */
58
- }
97
+ const answer = resolveSecret(request, { prefs, env: { ...env, CRED_STORE: store } });
98
+ if (answer.ok && answer.secret.trim()) return answer.secret.trim();
59
99
  }
60
100
  return "";
61
101
  }
@@ -17,7 +17,7 @@ export const TASK_TYPES = ["component", "bugfix", "feature", "refactor", "chore"
17
17
  /** prefs.schema.json `outputLanguage`. */
18
18
  export const LANGUAGES = ["en", "tr"];
19
19
  /** The hosts the pipeline runs in (detectCli). */
20
- export const CLIS = ["claude", "codex", "copilot"];
20
+ export const CLIS = ["claude", "codex", "copilot", "local"];
21
21
  /** Operating systems the package targets, plus the constant for any other. */
22
22
  export const OPERATING_SYSTEMS = ["macos", "linux", "windows", "other"];
23
23
  /** phase-tracker.sh statuses, plus `done`, the agent-state spelling of completed. */
@@ -61,9 +61,16 @@ export function messages(table, language = outputLanguage()) {
61
61
  }
62
62
 
63
63
  /**
64
- * How this machine's CLI spells a pipeline command: the three hosts spell the
65
- * same one three ways, and a script sits in the tree it was installed into, so
66
- * its own path answers the question.
64
+ * How this machine's CLI spells a pipeline command: each host spells the same
65
+ * one its own way, and a script sits in the tree it was installed into, so its
66
+ * own path answers the question.
67
+ *
68
+ * The spellings live in `schemas/hosts.json` and this switch is held to it by
69
+ * `test/hosts-registry.test.mjs`. The table is repeated here rather than read,
70
+ * because this module is a leaf that trees copy on its own - a sandbox, a
71
+ * verification fixture, an installed tree being audited - and an import of a
72
+ * sibling plus a data file two directories up turns every one of those into a
73
+ * module-not-found before the first line runs.
67
74
  *
68
75
  * @param {string} sub - subcommand, e.g. `setup`
69
76
  * @param {string} [dir] - the calling module's directory
@@ -73,6 +80,7 @@ export function hostCommand(sub, dir = import.meta.dirname) {
73
80
  case ".copilot":
74
81
  return `/multi-agent-${sub}`;
75
82
  case ".codex":
83
+ case ".codex-local":
76
84
  return `multi-agent ${sub}`;
77
85
  default:
78
86
  return `/multi-agent:${sub}`;
@@ -22,7 +22,7 @@
22
22
  #
23
23
  # Environment:
24
24
  # VERCEL_TOKEN - required for deploy; when unset it is resolved from
25
- # prefs keychainMapping.vercel via credential-store.sh
25
+ # the Vercel account, via the account resolver
26
26
  # VERCEL_ORG_ID - optional, scopes deploys to a team
27
27
  # VERCEL_PROJECT_ID - optional, links to a specific project
28
28
  # VERCEL_DEPLOY_QUIET - when set, suppresses progress lines (raw CLI output stays redacted)
@@ -62,36 +62,27 @@ cmd_redact() {
62
62
  redact_filter
63
63
  }
64
64
 
65
- # Resolve VERCEL_TOKEN from the credential store when the environment has none.
66
- # The header has promised "resolved from prefs keychainMapping if unset" since
67
- # this wrapper was written, but nothing ever read the store: the block below
68
- # sourced the resolver only to name it in an error message. Both `doctor` and
69
- # `deploy` call this now, so the diagnostic can no longer report "unset" for a
70
- # token a deploy would have found.
65
+ # Resolve VERCEL_TOKEN from the account resolver when the environment has none.
71
66
  #
72
- # credential-store.sh takes the LOGICAL key and maps it through
73
- # prefs.global.keychainMapping itself, so `get vercel` is the whole mechanism.
74
- # Command substitution, never argv: the CLI echoes its own arguments on retry.
67
+ # Vercel's credential is for a local tool rather than an outbound request of
68
+ # ours, so the value is produced rather than a curl config. Command
69
+ # substitution, never argv: the CLI echoes its own arguments on retry.
75
70
  ma_vercel_resolve_token() {
76
71
  [ -z "${VERCEL_TOKEN:-}" ] || return 0
77
- local _r
72
+ local _r _tok
78
73
  for _r in \
79
- "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)/credential-store-resolver.sh" \
80
- "$HOME/.claude/lib/credential-store-resolver.sh" \
81
- "$HOME/.copilot/lib/credential-store-resolver.sh" \
82
- "$HOME/.codex/lib/credential-store-resolver.sh"; do
83
- [ -f "$_r" ] || continue
84
- # shellcheck source=/dev/null
85
- . "$_r" 2>/dev/null || true
86
- if [ -n "${CRED_STORE:-}" ]; then break; fi
74
+ "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)/service-account.sh" \
75
+ "$HOME/.claude/lib/service-account.sh" \
76
+ "$HOME/.copilot/lib/service-account.sh" \
77
+ "$HOME/.codex/lib/service-account.sh"; do
78
+ [ -x "$_r" ] || continue
79
+ _tok=$(bash "$_r" token --service vercel 2>/dev/null || true)
80
+ [ -n "$_tok" ] && break
87
81
  done
88
- [ -n "${CRED_STORE:-}" ] || return 0
89
- local _tok
90
- _tok=$("$CRED_STORE" get vercel 2>/dev/null || true)
91
82
  # Only export a real value. Exporting an empty VERCEL_TOKEN would hand every
92
83
  # child process a defined-but-blank variable where it previously saw none,
93
84
  # and "set to nothing" reads differently from "unset" to the Vercel CLI.
94
- [ -n "$_tok" ] || return 0
85
+ [ -n "${_tok:-}" ] || return 0
95
86
  VERCEL_TOKEN="$_tok"
96
87
  export VERCEL_TOKEN
97
88
  return 0
@@ -112,7 +103,7 @@ cmd_doctor() {
112
103
  masked=${VERCEL_TOKEN:0:4}
113
104
  echo "VERCEL_TOKEN: set (prefix=${masked}..., length=${#VERCEL_TOKEN})"
114
105
  else
115
- echo "VERCEL_TOKEN: unset - set via env or pipeline keychainMapping.vercel"
106
+ echo "VERCEL_TOKEN: unset - set it in the environment, or add a Vercel account"
116
107
  fi
117
108
 
118
109
  if [ -n "${VERCEL_ORG_ID:-}" ]; then
@@ -146,8 +137,8 @@ cmd_deploy() {
146
137
 
147
138
  ma_vercel_resolve_token
148
139
  if [ -z "${VERCEL_TOKEN:-}" ]; then
149
- echo "ERROR: VERCEL_TOKEN not set and keychainMapping.vercel resolved nothing." >&2
150
- echo "Map it once: point prefs.global.keychainMapping.vercel at the keychain item holding the token." >&2
140
+ echo "ERROR: VERCEL_TOKEN is not set and no Vercel account answered." >&2
141
+ echo "Add one once with /multi-agent:setup; it names the store item holding the token." >&2
151
142
  echo "Hint: vercel CLI accepts the token via env var; do NOT pass --token= on argv (leaks on retry)." >&2
152
143
  exit 1
153
144
  fi
@@ -0,0 +1,62 @@
1
+ ---
2
+ description: "Internal - what to do when multi-agent or analysis is invoked with no arguments."
3
+ ---
4
+
5
+ # _entry-picker - bare invocation
6
+
7
+ Read this only when the command was typed with nothing after it. A typed
8
+ argument routes exactly as before; nothing on this page applies to it.
9
+
10
+ > **Language**: picker `header` is always English (`promptLanguage` is locked
11
+ > to `"en"`); `question`, `label` and `description` follow `outputLanguage`.
12
+
13
+ ## Step 1 - decide the mode
14
+
15
+ ```bash
16
+ MODE=$(node "$HOME/.claude/scripts/entry-mode.mjs" --args "$ARGUMENTS")
17
+ ```
18
+
19
+ | Mode | What to do |
20
+ |---|---|
21
+ | `typed` | Stop reading this page. Route `$ARGUMENTS` as the command's own table says. |
22
+ | `picker` | Step 2. |
23
+ | `usage` | A modifier with no task (`autopilot` on its own, `--loop 3` on its own). Say what the command needs and stop. Never ask: the modifier would be dropped and the run would go interactive, which is the opposite of what was asked for. |
24
+ | `refuse-unattended` | Print one line saying the run was started with no task, and stop with a non-zero status. An unattended run that reaches a question waits until it times out, having produced nothing. |
25
+
26
+ ## Step 2 - ask, once
27
+
28
+ One question, four options, then hand the answer to the command's existing
29
+ chain. This replaces no step: the account, maturity and dev-context steps all
30
+ still run after it.
31
+
32
+ ### `/multi-agent`
33
+
34
+ | Option | Hands over to |
35
+ |---|---|
36
+ | My tracker items | the `jira` sub-command path |
37
+ | Unassigned issues | the `issue` sub-command path |
38
+ | Describe a task | prompt for one line of free text, then `freetext` in `_input-parser.md` |
39
+ | Show the guide | `help/SKILL.md`, and stop |
40
+
41
+ "Other" takes a pasted key, URL or `repo#N`: classify it with
42
+ `_input-parser.md` and continue as if it had been typed.
43
+
44
+ ### `/multi-agent:analysis`
45
+
46
+ | Option | Hands over to |
47
+ |---|---|
48
+ | New analysis | `analysis/intake.md`, which asks the name and the rest |
49
+ | Check a document | prompt for the path, then `check <doc>` |
50
+ | Refresh a document | prompt for the path, then `refresh <doc>` |
51
+ | Conform a document | prompt for the path, then `conform <doc>` |
52
+
53
+ "Other" takes a pasted tracker key, URL, `repo#N` or document path: classify it
54
+ with `_input-parser.md`, and treat a tracker reference as a new analysis of
55
+ that item. Either way `analysis/intake.md` runs next and asks the rest, with
56
+ whatever the reference already answered filled in rather than asked again.
57
+
58
+ ## Why it is a gate and not prose
59
+
60
+ The four answers have to come out the same on every host, and the last one has
61
+ to be reached without a model deciding it. `entry-mode.mjs` is the whole rule;
62
+ this page is how to act on each answer.
@@ -36,7 +36,7 @@ double quotes and unescape, then classify the value.
36
36
  `freetext`, and a structured token inside a sentence stays free text:
37
37
  `"PROJ-1 crashes on login"` is a task description, never an issue fetch.
38
38
  - **The closing quote** is the first `"` that is not escaped. Everything after
39
- it is modifiers: `autopilot`, `--loop N`, and the branch name that may follow
39
+ it is modifiers: `autopilot`, `--loop N`, `--review-rounds N` (1 to 3; `review-rounds.mjs parse` reads it), and the branch name that may follow
40
40
  a Jira key (`"PROJ-1" "feature/PROJ-1-desc"`). A quoted branch name is
41
41
  unquoted and unescaped the same way: strip its surrounding double quotes,
42
42
  `\"` becomes `"`, and `\\` becomes `\` before a quote or at the end. A word
@@ -2,6 +2,8 @@
2
2
 
3
3
  > The picker chain that fills `state.analysisSpec.*` before any fetch runs. Loaded by `/multi-agent:analysis`. Pipeline Phase 1 does NOT load this file: in a pipeline run the account, project, repos and task already came from the orchestrator's own Phase 0, and only the source and coverage batches below are asked (see `phase-1-plan.md` Step 4).
4
4
 
5
+ **Unattended (`<tracker-ref> autopilot`).** Ask nothing. Every step below is answered from the queued item, the repo it came from and the preferences, or the run parks on the step with its reason: the derivation contract, the evidence behind each answer and the two questions that park are `analysis/unattended.md`, loaded only on an unattended run. Nothing on this page is taken as a default because nobody answered.
6
+
5
7
  ### Phase 0 - Intake
6
8
 
7
9
  Sequential `AskUserQuestion` chain. Each answer is written to state under `state.analysisSpec.*`.
@@ -4,6 +4,7 @@ Loaded on demand by `/multi-agent:analysis`: the scripts, libraries and refs eac
4
4
 
5
5
  | Path | Reason |
6
6
  |------|--------|
7
+ | `~/.claude/scripts/analysis-unattended.mjs` | Phase 0 on an unattended run: answers every intake step from the item, the repo and the preferences, or returns the park verdict (exit 4) |
7
8
  | `~/.claude/lib/submodule-detector.sh` | Phase 0 Step 4 repo discovery |
8
9
  | `~/.claude/lib/context-link-extractor.sh` | Phase 0 Step 5 source classifier for every question's Other input (handles `local-file`, `document`, `wiki`, `standards-confluence`, `generic-doc`, `firebase-events:names`, `firebase-events:schema`, `firebase-events:console` types) |
9
10
  | `~/.claude/lib/fetch-swagger.sh`, `fetch-confluence.sh` | Phase 1 fetchers |
@@ -0,0 +1,135 @@
1
+ # Unattended analysis (`<tracker-ref> autopilot`)
2
+
3
+ > The derivation contract for `/multi-agent:analysis <ref> autopilot`, the mode
4
+ > `phases.json` declares as `analysis-autopilot`. One row per question the
5
+ > attended chain asks: what an unattended run answers instead, and from which
6
+ > evidence. A question no row can settle parks the run. Nothing here is a
7
+ > default taken because nobody answered - that is the thing this file exists to
8
+ > keep out of the analysis document.
9
+
10
+ <!-- toc -->
11
+ - [When it applies](#when-it-applies)
12
+ - [The rule](#the-rule)
13
+ - [The derivation table](#the-derivation-table)
14
+ - [Running it](#running-it)
15
+ - [Parking](#parking)
16
+ - [After intake](#after-intake)
17
+ - [What it never does](#what-it-never-does)
18
+ <!-- /toc -->
19
+
20
+ ## When it applies
21
+
22
+ The command was invoked as `<tracker-ref> autopilot`: a Jira key or
23
+ `owner/repo#N` followed by the modifier. `MULTI_AGENT_UNATTENDED=1` without the
24
+ modifier is a different contract - the background shape in
25
+ `$HOME/.claude/multi-agent-refs/picker-contract.md`, which parks on every
26
+ picker the launch request did not answer and derives nothing.
27
+
28
+ Phase 0 records the mode before anything else: `mode: "analysis"`,
29
+ `autopilot: true`, `status: "in_progress"`, `currentPhase: 0` and `sessionId`
30
+ from `MULTI_AGENT_SESSION_ID`, through `write-state.mjs`. A run with no
31
+ argument at all refuses at the entry gate (`_entry-picker.md`,
32
+ `refuse-unattended`) and never reaches a question.
33
+
34
+ ## The rule
35
+
36
+ Three outcomes per question, and only three:
37
+
38
+ | Outcome | When | Recorded as |
39
+ |---|---|---|
40
+ | **Derived** | evidence the run already holds settles it | one `decisions[]` entry with the evidence as its `why` (`features/autopilot-decisions.md`) |
41
+ | **Empty answer** | the evidence says there is nothing, and nothing is a real answer | the same, with the emptiness as the `why` |
42
+ | **Parked** | the answer would change what the document IS, and no evidence settles it | `status: awaiting_input`, the reason, and the queue lists the item as awaiting |
43
+
44
+ A fourth outcome - taking the first option because nobody is there - is not
45
+ available. An analysis document is read as a decision record, so a question
46
+ answered by option order produces a document nobody agreed to, which is worse
47
+ than no document.
48
+
49
+ ## The derivation table
50
+
51
+ Rows follow the attended chain's own order (`analysis/intake.md`), so a park
52
+ names the question the person would have been asked first.
53
+
54
+ | Step | Question | Unattended answer | Evidence |
55
+ |---|---|---|---|
56
+ | 1 | Analysis name | the item's summary, verbatim | the queued item (Jira `summary`, GitHub issue title) |
57
+ | 1b | Profile | the one profile `prefs.global.analysisProfiles` offers | the preference; **parks** when it offers more than one |
58
+ | 1b | Custom outline | the configured outline path | **parks** when the single profile is `custom` and no outline is configured |
59
+ | 2 | Account | the account whose tracker returned the item | the item's own source; it is the credential that fetched it |
60
+ | 3 | Platforms | the distinct stack tags of the repos below | the repo scan, which is what the attended step derives from before it offers to ask |
61
+ | 3 | No platform at all | a real answer, not a gap (Locked 34) | an untagged repo; the development layer and Pass B drop and Section 20 records that they await a repo |
62
+ | 4 | Repos | the repo the item was queued for | the queue entry carries exactly one repo, so there is nothing to pick between |
63
+ | 5 | Figma, Confluence, Document, Jira, Swagger | the links the item's own text carries, typed by `context-link-extractor.sh` | the item; no link is an answer, and Phase 3.3 still searches the repo before anything is called open |
64
+ | 5 | Standards | `Auto-detect from repo`, the picker's own second option | a repo is present; `none` when none is |
65
+ | 5 | Firebase | `Auto-detect from repo`, the picker's own second option | a repo is present; `none` when none is |
66
+ | 5a | UI tests | `No UI tests` | the lighter side of an opt-in: a section nobody asked for is added by re-running analysis |
67
+ | 5a | A11y depth | `Basic checklist` | the same |
68
+ | 5a | Redesign | `New work` | the same; a redesign run also reads the v1 behaviour, which is a larger run than the queue was asked for |
69
+ | 3.5 | Output destination | the local file only, written into the run's own directory | an unattended run publishes nothing outside the machine (`features/unattended-security.md`, Phase 5 and channels) |
70
+ | 3.5 | Confluence parent, Jira issue, Jira write target | not asked and not taken: no Confluence page and no Jira write happens | the same |
71
+
72
+ The two parking rows are the whole of the park surface, and both are about the
73
+ same thing: the profile selects the template the entire document is rendered
74
+ against (Locked 31). Everything else is either in the item, in the repo, in the
75
+ preferences, or legitimately empty.
76
+
77
+ ## Running it
78
+
79
+ Collect the evidence into one document and let the rules answer it:
80
+
81
+ ```bash
82
+ node "$HOME/.claude/scripts/analysis-unattended.mjs" derive \
83
+ --evidence "$RUN_DIR/analysis-evidence.json" --state "$STATE_FILE" --json
84
+ ```
85
+
86
+ The evidence document is `{ref, source, title, profiles[], outline?, repos[],
87
+ links[], outputDir}`: the queued item, `prefs.global.analysisProfiles`, the
88
+ repo and its stack tag, the typed links from the item's text, and the directory
89
+ the run may write. Exit 0 prints the resolved intake (written to
90
+ `state.analysisSpec.*`) and the `decisions[]` entries it already recorded; exit
91
+ 2 means the evidence document itself is unusable; exit 4 is a park.
92
+
93
+ ## Parking
94
+
95
+ On exit 4 the verdict names the question, the reason and the fix. Park on it and
96
+ stop - never re-ask, never fall through to an option:
97
+
98
+ ```bash
99
+ node "$HOME/.claude/scripts/gate-ledger.mjs" park --outcome awaiting-answer \
100
+ --waiting-for question --question-file "$Q_FILE" --state "$STATE_FILE"
101
+ ```
102
+
103
+ `$Q_FILE` carries the question in the shape a client answers (`id`, `stepId`,
104
+ `text` in `outputLanguage`, `kind`, `options[]` of `{id, label}`) - for the
105
+ profile park, one option per profile the preference offers. A park whose
106
+ question has no option set (the analysis name) is written with
107
+ `--waiting-for analysis-name --reason "<the verdict's reason>"` and no question
108
+ file; a person re-enters it with `/multi-agent:resume <task-id>`.
109
+
110
+ The queue lists a parked item as awaiting and never re-runs it on its own, so a
111
+ park costs one scan, not a retry loop.
112
+
113
+ ## After intake
114
+
115
+ - **Phase 3.3** is unchanged and already written for this case: bucket A still
116
+ runs its searches, and a bucket B gap is moved to C stamped
117
+ `autopilot: could not ask` (`analysis/render.md`). A search needs no person;
118
+ a judgement does.
119
+ - **Phase 4** publishes the local file and nothing else. Locked 6 still forbids
120
+ `git add` and `git commit`, so the document is delivered where it was written.
121
+ - **Phase 5** runs with `--file-only`: the report lands under the run's log
122
+ root and no channel is posted.
123
+ - The run ends at Phase 5 with `status: complete`, which is what the queue
124
+ records as `doc-delivered` - the analysis equivalent of a pull request.
125
+
126
+ ## What it never does
127
+
128
+ - Ask. There is nobody to answer, and a question that waits is a run that
129
+ produced nothing.
130
+ - Take an option because it was first. Every answer above names its evidence.
131
+ - Create a branch, a worktree, a commit or a pull request - the side-effect
132
+ contract of the analysis command is unchanged by the modifier.
133
+ - Post a Confluence page, write a Jira description or comment, or send a
134
+ channel report.
135
+ - Fetch a design source outside Phase 1 (Locked 29).
@@ -44,6 +44,22 @@ list is two lists; re-running the picker is how repos are added and removed.
44
44
  | GitHub | `gh issue list --repo <r> --label <label> --assignee @me --state open` | **assigned to you** (`githubAssignee`, `"*"` for any), so a label an issue form applies is not enough |
45
45
  | Jira | `assignee = currentUser() AND labels = "<label>" AND resolution = EMPTY AND status not in (Done, Closed, Cancelled)` | **assigned to you**, so a label somebody else adds is not enough |
46
46
 
47
+ A repo on the analysis queue is queried a second time per source, with the
48
+ analysis label in place of the development one and the same assignee rule, so
49
+ the second queue never widens who can give the machine work. `jiraJql` is the
50
+ development search only: a repo with a custom JQL still picks analysis work up
51
+ by label.
52
+
53
+ ### Why analysis is opted into and not defaulted
54
+
55
+ The two queues deliver different things - one opens a pull request, the other
56
+ writes a document - and both spend a run. A repo selected in step 3 said yes to
57
+ development work and to nothing else, so the analysis pass runs only for a repo
58
+ that said yes to it as well (`analysisQueue`, which naming an analysis label
59
+ also sets). A default here would quietly start producing documents in every
60
+ repo the picker ever touched, which is the opposite of what selecting a repo
61
+ was understood to mean.
62
+
47
63
  Two Jira caveats to say out loud when Jira is selected: labels are one global
48
64
  namespace across the whole instance and anyone can write them, so on a shared
49
65
  instance prefer a qualified name (`agent-queue-<team>`); and the Labels field has
@@ -12,6 +12,14 @@
12
12
 
13
13
  Jira is read by the person who filed the ticket and by whoever tests it, so its comment carries the four sections `channels/jira.md` fixes - `summary` (`Geliştirme Özeti`), `test_scenarios` (`Test Senaryoları`), `impact` (`Etki Analizi`) and `context_refs` (`Bağlantılar`), plus `test_run` when selected - and nothing else. Technical sections go to the PR and to Confluence, where the reader is a code reviewer. When `jira` is a selected channel, drop the technical sections from its body rather than converting them: the PR link on line 1 is how a Jira reader reaches the detail. No framework-theory paragraphs and no numbered "why this approach" lists in either body.
14
14
 
15
+ The report file takes one more body than the channels do. When `pr` is a
16
+ selected channel its body is copied there unchanged; when it is not, compose one
17
+ `Report` body in the `channels/pr.md` section order, with the PR tone, for the
18
+ file alone. The PR shape is the superset, so the summary and the test scenarios
19
+ reach disk whatever was ticked. The `Jira comment` block in that file is the
20
+ Jira body unchanged - the "never Jira" rule is about the Jira reader and nothing
21
+ here converts one body into the other. Contract: `channels/report-file.md`.
22
+
15
23
  `impact` is not a technical section in disguise. It answers four questions - what was wrong, what was changed, which areas must be tested, what else is affected - in the same plain register as the summary, and it is the part a test lead reads before deciding how wide to test.
16
24
 
17
25
  The content options are sources, not the body's shape. Which sections a PR body carries and in what order is fixed by `channels/pr.md` (`summary` -> `technical` -> `architecture` -> `impact` -> `test_scenarios` -> `test_run` -> `visuals` -> `risk` -> `dependencies` -> `build` -> `related`); the content options choose what gets gathered to fill them. A content option left unselected means a section has no source, not that the section may be reordered or renamed.
@@ -21,7 +29,7 @@ The content options are sources, not the body's shape. Which sections a PR body
21
29
  | Content option | Generated section |
22
30
  |---|---|
23
31
  | Normal analiz | `### Analysis` - impact summary from Phase 1, risks from Phase 4 (pipeline-log source, high-level only) |
24
- | Teknik analiz | `### Technical Details` - Changes (what/why per file group), Architecture (structural decisions, pattern changes), Dependencies (new imports/frameworks/packages). Source: Phase 1 planning + Phase 2 dev log + `git diff --stat`. **PR and Confluence only** - never rendered into a Jira comment. |
32
+ | Teknik analiz | `### Technical Details` - Changes (what/why per file group), Architecture (structural decisions, pattern changes), Dependencies (new imports/frameworks/packages). Source: Phase 1 planning + Phase 2 dev log + `git diff --stat`. **PR, Confluence and the local report file only** - never rendered into a Jira comment. |
25
33
  | Test senaryoları | `### Test Scenarios` - precondition / steps / expected table (4-8 rows), user perspective |
26
34
  | Test Koşumu (Xray) | `### Test Koşumu` - Xray Test Execution of the task's UI scenario run (`channels/test-run.md`) |
27
35
  | Auto-diff | Old enrich Output Template verbatim - Root Cause / Solution / Changed Files / Test Scenarios |
@@ -94,7 +102,7 @@ find /tmp -maxdepth 1 -name 'archiveguard-*.json' -o -name 'play-compliance-*.js
94
102
  -newermt "-6 hours" -print 2>/dev/null | head -1
95
103
  ```
96
104
 
97
- If a cached report exists AND any of the selected channels is PR / Jira / Confluence, append an auto-summary section:
105
+ If a cached report exists AND any of the selected channels is PR / Jira / Confluence, or a `Report` body is being composed for the report file, append an auto-summary section:
98
106
 
99
107
  | Blocker count | Appended line |
100
108
  |---|---|
@@ -50,6 +50,8 @@ After the preview prints, 3b renders the two pickers: **Channels** (PR descripti
50
50
  - "Cost özeti" unselectable if `phase-tracker.sh cost total` prints `-` (no priced token tallies; there is no `status` action) AND no `otel-spans.jsonl` exists for the task. Reason: `"(no tracker data - set MULTI_AGENT_OTEL_SPANS=1 or enable token tracking)"`.
51
51
  - "Yapılan iş özeti" unselectable if no `agent-state.json` exists for the task (post-hoc call with `--branch` + `--base-branch` flags restores partial availability). Reason: `"(no agent-state.json for {taskId})"`. **Auto-ticked** when Step 3a preview was shown - user can still uncheck before confirming the menu.
52
52
 
53
- **Defaults (first run):** PR + Jira ticked, Confluence + Wiki unticked. Content: auto-diff if pipeline log missing; otherwise normal-analiz + test-senaryoları.
53
+ One line above the picker says the report file is written on every run, and where. It is not a row and needs no tick (`channels/report-file.md`). **Zero channels ticked is a valid selection** and means file-only: the bodies are composed and written to disk, and nothing is posted. When no channel is selectable at all, print the greyed rows with their reasons as text and ask only Content.
54
+
55
+ **Defaults (first run):** PR + Jira ticked, Confluence + Wiki unticked. The report file needs no tick. Content: auto-diff if pipeline log missing; otherwise normal-analiz + test-senaryoları.
54
56
 
55
57
  Saved to `prefs.global.reportChannels` and `prefs.global.reportContent` - next run uses these as defaults.
@@ -33,6 +33,8 @@ The gate runs after the generator + humanizer and before Step 7 dispatch, in eve
33
33
  | `Approve & post` | Step 7 dispatches every previewed body verbatim |
34
34
  | `Edit` | Free-text "which channel, what should change", apply, re-render the FULL preview, re-ask (loop, no cap) |
35
35
  | `Skip channels` | multiSelect which channels to drop this run, re-render the rest, re-ask |
36
- | `Cancel` | Abort dispatch entirely; nothing is posted anywhere. Internal capture (agent-log, knowledge) is unaffected |
36
+ | `Cancel` | Abort dispatch entirely; nothing is posted anywhere. Internal capture (agent-log, knowledge) is unaffected, and the report file already written at Step 5 stays |
37
+
38
+ Under the blocks, print one line of intent: `Report file: written -> {path}`.
37
39
 
38
40
  Persisting channel prefs (Step 8) still happens on `Cancel`: selection memory and content approval are independent.