@mmerterden/multi-agent-pipeline 11.3.2 → 11.5.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.
- package/CHANGELOG.md +141 -0
- package/README.md +1 -0
- package/index.js +9 -2
- package/install/_common.mjs +107 -5
- package/install/_telemetry.mjs +5 -23
- package/install/claude.mjs +113 -11
- package/install/copilot.mjs +75 -6
- package/package.json +4 -10
- package/pipeline/commands/multi-agent/SKILL.md +5 -1
- package/pipeline/commands/multi-agent/dev-local/SKILL.md +1 -1
- package/pipeline/commands/multi-agent/help/SKILL.md +6 -2
- package/pipeline/commands/multi-agent/review/SKILL.md +36 -4
- package/pipeline/commands/multi-agent/review-issue/SKILL.md +22 -0
- package/pipeline/commands/multi-agent/review-jira/SKILL.md +22 -0
- package/pipeline/commands/multi-agent/sync/SKILL.md +4 -4
- package/pipeline/lib/account-resolver.sh +61 -23
- package/pipeline/lib/channels-multi-repo.sh +7 -2
- package/pipeline/lib/count-lib.sh +27 -0
- package/pipeline/lib/credential-store.sh +23 -6
- package/pipeline/lib/extract-conventions.sh +27 -21
- package/pipeline/lib/fetch-confluence.sh +25 -13
- package/pipeline/lib/fetch-crashlytics.sh +30 -8
- package/pipeline/lib/fetch-fortify.sh +11 -2
- package/pipeline/lib/fetch-swagger.sh +18 -7
- package/pipeline/lib/figma-mcp-refresh.sh +26 -11
- package/pipeline/lib/figma-screenshot.sh +11 -2
- package/pipeline/lib/issue-fetcher.sh +31 -6
- package/pipeline/lib/multi-repo-pipeline.sh +84 -20
- package/pipeline/lib/plan-todos.sh +12 -3
- package/pipeline/lib/post-pr-review.sh +5 -3
- package/pipeline/lib/repo-cache.sh +53 -9
- package/pipeline/lib/review-watch.sh +26 -6
- package/pipeline/lib/shadow-git.sh +45 -4
- package/pipeline/lib/vercel-deploy.sh +10 -1
- package/pipeline/multi-agent-refs/cross-cli-contract.md +4 -4
- package/pipeline/multi-agent-refs/readiness-review.md +65 -0
- package/pipeline/scripts/audit-log-rotate.sh +38 -10
- package/pipeline/scripts/check-md-links.mjs +34 -9
- package/pipeline/scripts/diff-risk-score.mjs +4 -1
- package/pipeline/scripts/evidence-gate.mjs +10 -1
- package/pipeline/scripts/fixtures/install-layout.tsv +7 -7
- package/pipeline/scripts/fixtures/pack-expected-count.txt +1 -0
- package/pipeline/scripts/keychain-save.sh +13 -9
- package/pipeline/scripts/lint-skills.mjs +40 -2
- package/pipeline/scripts/migrate-prefs.mjs +26 -7
- package/pipeline/scripts/phase-tracker.sh +71 -0
- package/pipeline/scripts/pre-commit-check.sh +39 -0
- package/pipeline/scripts/scan-skills.sh +217 -127
- package/pipeline/scripts/smoke-bitbucket-contract.sh +21 -5
- package/pipeline/scripts/smoke-fetchers-offline.sh +382 -0
- package/pipeline/scripts/smoke-generate-issue.sh +3 -3
- package/pipeline/scripts/smoke-install-layout.sh +11 -3
- package/pipeline/scripts/smoke-lib-scripts.sh +54 -1
- package/pipeline/scripts/smoke-pack-contents.sh +140 -0
- package/pipeline/scripts/smoke-plugin-validate.sh +64 -0
- package/pipeline/scripts/smoke-review-readiness.sh +91 -0
- package/pipeline/scripts/smoke-shadow-git.sh +48 -1
- package/pipeline/scripts/smoke-skill-authoring.sh +1 -1
- package/pipeline/scripts/smoke-workflow-audit.sh +69 -0
- package/pipeline/scripts/smoke-wrapper-preservation.sh +68 -0
- package/pipeline/scripts/test-gap-scan.mjs +12 -1
- package/pipeline/scripts/triage-memory.mjs +10 -1
- package/pipeline/scripts/uninstall.mjs +105 -36
- package/pipeline/scripts/update-issue-progress.sh +60 -41
- package/pipeline/scripts/write-state.mjs +14 -4
- package/pipeline/skills/.skill-manifest.json +13 -5
- package/pipeline/skills/.skills-index.json +20 -2
- package/pipeline/skills/shared/core/multi-agent-help/SKILL.md +6 -2
- package/pipeline/skills/shared/core/multi-agent-review/SKILL.md +19 -10
- package/pipeline/skills/shared/core/multi-agent-review-issue/SKILL.md +25 -0
- package/pipeline/skills/shared/core/multi-agent-review-jira/SKILL.md +25 -0
- package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +3 -3
- package/pipeline/skills/skills-index.md +4 -2
package/install/copilot.mjs
CHANGED
|
@@ -22,7 +22,9 @@ import {
|
|
|
22
22
|
copyFile,
|
|
23
23
|
countFiles,
|
|
24
24
|
ensureDir,
|
|
25
|
+
ensureRealDir,
|
|
25
26
|
isDryRun,
|
|
27
|
+
removePipelineAgentFiles,
|
|
26
28
|
wipeDir,
|
|
27
29
|
writeFile,
|
|
28
30
|
} from "./_common.mjs";
|
|
@@ -61,17 +63,55 @@ export function installCopilot(ctx) {
|
|
|
61
63
|
installSkills({ pipelineSrc, dest: COPILOT_SKILLS, indexOnly, useSymlinks, platformFlag });
|
|
62
64
|
}
|
|
63
65
|
|
|
66
|
+
/** Start of the pipeline-managed span in copilot-instructions.md. */
|
|
67
|
+
export const INSTRUCTIONS_START_MARKER = "# Multi-Agent Development Pipeline";
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Explicit end marker written after the pipeline section (v11.4.1+). Updates
|
|
71
|
+
* replace only the start..end span, so anything the user appends AFTER the
|
|
72
|
+
* pipeline section survives. Pre-marker files fall back to
|
|
73
|
+
* `legacyTrailingContent` bounding.
|
|
74
|
+
*/
|
|
75
|
+
export const INSTRUCTIONS_END_MARKER =
|
|
76
|
+
"<!-- multi-agent-pipeline:copilot-instructions:end -->";
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Legacy files (written before the end marker existed) have no explicit
|
|
80
|
+
* terminator. Bound the pipeline span at the next top-level "# " heading
|
|
81
|
+
* after the start marker when one exists OUTSIDE fenced code blocks (the
|
|
82
|
+
* pipeline body carries bash comments like "# Bootstrap once ..." inside
|
|
83
|
+
* fences that must not be mistaken for headings); otherwise the span runs
|
|
84
|
+
* to EOF, which matches the pre-marker behavior.
|
|
85
|
+
*
|
|
86
|
+
* @param {string} section - file content from the start marker onward
|
|
87
|
+
* @returns {string} user content trailing the pipeline span ("" if none)
|
|
88
|
+
*/
|
|
89
|
+
export function legacyTrailingContent(section) {
|
|
90
|
+
const lines = section.split("\n");
|
|
91
|
+
let inFence = false;
|
|
92
|
+
for (let i = 1; i < lines.length; i++) {
|
|
93
|
+
if (/^\s*(```|~~~)/.test(lines[i])) {
|
|
94
|
+
inFence = !inFence;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (!inFence && /^# /.test(lines[i])) return lines.slice(i).join("\n");
|
|
98
|
+
}
|
|
99
|
+
return "";
|
|
100
|
+
}
|
|
101
|
+
|
|
64
102
|
function writeInstructionsFile(path) {
|
|
65
103
|
const pipelineSection = generateCopilotInstructions();
|
|
104
|
+
const managedBlock =
|
|
105
|
+
pipelineSection.trimEnd() + "\n\n" + INSTRUCTIONS_END_MARKER + "\n";
|
|
66
106
|
|
|
67
107
|
if (!existsSync(path)) {
|
|
68
|
-
writeFile(path,
|
|
108
|
+
writeFile(path, managedBlock);
|
|
69
109
|
console.log(" -> Created copilot-instructions.md with pipeline");
|
|
70
110
|
return;
|
|
71
111
|
}
|
|
72
112
|
|
|
73
113
|
let existing = readFileSync(path, "utf-8");
|
|
74
|
-
const marker =
|
|
114
|
+
const marker = INSTRUCTIONS_START_MARKER;
|
|
75
115
|
|
|
76
116
|
// Drift cleanup (v5.6.2): detect pre-v5.0 pipeline sections that predate
|
|
77
117
|
// the stable marker and strip them. These blocks ("## Multi-Agent Task
|
|
@@ -103,12 +143,26 @@ function writeInstructionsFile(path) {
|
|
|
103
143
|
}
|
|
104
144
|
|
|
105
145
|
if (existing.includes(marker)) {
|
|
106
|
-
const
|
|
107
|
-
|
|
146
|
+
const startIdx = existing.indexOf(marker);
|
|
147
|
+
const before = existing.slice(0, startIdx).trimEnd();
|
|
148
|
+
const fromStart = existing.slice(startIdx);
|
|
149
|
+
// Replace only the start..end span. User content appended AFTER the
|
|
150
|
+
// pipeline section (below the end marker, or below the next top-level
|
|
151
|
+
// heading in legacy files) is preserved.
|
|
152
|
+
const endIdx = fromStart.indexOf(INSTRUCTIONS_END_MARKER);
|
|
153
|
+
const trailing =
|
|
154
|
+
endIdx >= 0
|
|
155
|
+
? fromStart.slice(endIdx + INSTRUCTIONS_END_MARKER.length)
|
|
156
|
+
: legacyTrailingContent(fromStart);
|
|
157
|
+
let out = before.length > 0 ? before + "\n\n" : "";
|
|
158
|
+
out += managedBlock;
|
|
159
|
+
const trailingClean = trailing.replace(/^[\r\n]+/, "").trimEnd();
|
|
160
|
+
if (trailingClean.length > 0) out += "\n" + trailingClean + "\n";
|
|
161
|
+
writeFile(path, out);
|
|
108
162
|
const suffix = cleaned ? " (also scrubbed pre-v5.0 drift section)" : "";
|
|
109
163
|
console.log(` -> Updated existing pipeline section in copilot-instructions.md${suffix}`);
|
|
110
164
|
} else {
|
|
111
|
-
writeFile(path, existing.trimEnd() + "\n\n" +
|
|
165
|
+
writeFile(path, existing.trimEnd() + "\n\n" + managedBlock);
|
|
112
166
|
console.log(" -> Appended pipeline section to copilot-instructions.md");
|
|
113
167
|
}
|
|
114
168
|
}
|
|
@@ -117,6 +171,9 @@ function installScripts(pipelineSrc, dest, useSymlinks) {
|
|
|
117
171
|
console.log(" [Copilot CLI] Installing scripts...");
|
|
118
172
|
const scriptsSrc = join(pipelineSrc, "scripts");
|
|
119
173
|
if (!existsSync(scriptsSrc)) return;
|
|
174
|
+
// Replace a --link-era symlink with a real dir before wiping/copying so the
|
|
175
|
+
// install can never land inside the developer's repo checkout.
|
|
176
|
+
if (!useSymlinks) ensureRealDir(dest);
|
|
120
177
|
wipeDir(dest);
|
|
121
178
|
copyDir(scriptsSrc, dest, { exclude: DEV_ONLY_SCRIPTS, useSymlinks });
|
|
122
179
|
// Count files actually excluded, not the array length: DEV_ONLY_SCRIPTS mixes
|
|
@@ -133,7 +190,13 @@ function installAgents(pipelineSrc, dest, useSymlinks) {
|
|
|
133
190
|
console.log(" [Copilot CLI] Installing agent definitions...");
|
|
134
191
|
const agentsSrc = join(pipelineSrc, "agents");
|
|
135
192
|
if (!existsSync(agentsSrc)) return;
|
|
136
|
-
|
|
193
|
+
// ~/.copilot/agents also holds user-authored agent files. Never wipe the
|
|
194
|
+
// whole dir; remove only the pipeline-shipped agent files (name set derived
|
|
195
|
+
// from the source tree so it cannot go stale), then copy the fresh set in.
|
|
196
|
+
if (!useSymlinks) {
|
|
197
|
+
ensureRealDir(dest);
|
|
198
|
+
removePipelineAgentFiles(dest, agentsSrc);
|
|
199
|
+
}
|
|
137
200
|
copyDir(agentsSrc, dest, { useSymlinks });
|
|
138
201
|
console.log(` -> ${countFiles(agentsSrc)} files copied to ${dest}`);
|
|
139
202
|
}
|
|
@@ -142,6 +205,7 @@ function installSchemas(pipelineSrc, dest, useSymlinks) {
|
|
|
142
205
|
console.log(" [Copilot CLI] Installing JSON schemas...");
|
|
143
206
|
const schemasSrc = join(pipelineSrc, "schemas");
|
|
144
207
|
if (!existsSync(schemasSrc)) return;
|
|
208
|
+
if (!useSymlinks) ensureRealDir(dest);
|
|
145
209
|
wipeDir(dest);
|
|
146
210
|
copyDir(schemasSrc, dest, { useSymlinks });
|
|
147
211
|
console.log(` -> ${countFiles(schemasSrc)} files copied to ${dest}`);
|
|
@@ -151,6 +215,7 @@ function installLib(pipelineSrc, dest, useSymlinks) {
|
|
|
151
215
|
console.log(" [Copilot CLI] Installing shell libraries...");
|
|
152
216
|
const libSrc = join(pipelineSrc, "lib");
|
|
153
217
|
if (!existsSync(libSrc)) return;
|
|
218
|
+
if (!useSymlinks) ensureRealDir(dest);
|
|
154
219
|
wipeDir(dest);
|
|
155
220
|
copyDir(libSrc, dest, { useSymlinks });
|
|
156
221
|
console.log(` -> ${countFiles(libSrc)} files copied to ${dest}`);
|
|
@@ -160,6 +225,10 @@ function installSkills(opts) {
|
|
|
160
225
|
const { pipelineSrc, dest, indexOnly, useSymlinks, platformFlag } = opts;
|
|
161
226
|
console.log(" [Copilot CLI] Installing skills...");
|
|
162
227
|
|
|
228
|
+
// Same symlink guard as the other owned trees: never prune or copy through
|
|
229
|
+
// a --link-era symlink into the repo checkout.
|
|
230
|
+
if (!useSymlinks) ensureRealDir(dest);
|
|
231
|
+
|
|
163
232
|
if (indexOnly) {
|
|
164
233
|
try {
|
|
165
234
|
mkdirSync(dest, { recursive: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mmerterden/multi-agent-pipeline",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.5.0",
|
|
4
4
|
"description": "8-phase AI development pipeline with full orchestration on Claude Code and Copilot CLI. Analysis, planning, TDD, CLI-aware parallel review with consensus surfacing + Fable triage, default-FAIL evidence gates, secret + intent guards, per-phase cost ledger, persistent learnings memory, wiki generation, commit automation. Token-preserving uninstall.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"test:unit": "node --test test/*.test.mjs",
|
|
19
19
|
"test:smoke": "node pipeline/scripts/run-smokes.mjs",
|
|
20
20
|
"lint:skills": "node pipeline/scripts/lint-skills.mjs",
|
|
21
|
-
"test:
|
|
21
|
+
"test:quick": "node --test test/*.test.mjs && node pipeline/scripts/lint-skills.mjs",
|
|
22
|
+
"test:coverage": "c8 --check-coverage --reporter=text --reporter=lcov node --test test/*.test.mjs && c8 report",
|
|
22
23
|
"lint": "eslint .",
|
|
23
24
|
"lint:fix": "eslint . --fix",
|
|
24
25
|
"format": "prettier --write \"**/*.{js,mjs,json,md,yml}\" --ignore-path .gitignore",
|
|
@@ -69,17 +70,10 @@
|
|
|
69
70
|
"README.md",
|
|
70
71
|
"CHANGELOG.md",
|
|
71
72
|
"LICENSE",
|
|
72
|
-
"!pipeline/scripts/figma-placeholder-map.json",
|
|
73
|
-
"!pipeline/scripts/sync-figma-source.sh",
|
|
74
|
-
"!pipeline/scripts/import-figma-skills.sh",
|
|
75
|
-
"!pipeline/scripts/smoke-figma-skill-import.sh",
|
|
76
73
|
"!pipeline/scripts/smoke-figma-config-schema.sh",
|
|
77
74
|
"!pipeline/scripts/smoke-personal-data.sh",
|
|
78
75
|
"!pipeline/scripts/smoke-install-leak-gate.sh",
|
|
79
|
-
"!
|
|
80
|
-
"!pipeline/scripts/.last-figma-sync-plan.json",
|
|
81
|
-
"!docs/GENERICITY-REVIEW.md",
|
|
82
|
-
"!docs/STABILITY-FIX-PLAN.md"
|
|
76
|
+
"!docs/internal/**"
|
|
83
77
|
],
|
|
84
78
|
"devDependencies": {
|
|
85
79
|
"@eslint/js": "^10.0.1",
|
|
@@ -73,7 +73,9 @@ Lib scripts (`~/.claude/lib/`):
|
|
|
73
73
|
| `kill [id]` | Delete worktree (logs preserved). Confirm first |
|
|
74
74
|
| `clear-logs` | Clean global log directory. Keep counter |
|
|
75
75
|
| `purge` | Worktree + logs + counter - full reset (double confirm) |
|
|
76
|
-
| `review` |
|
|
76
|
+
| `review [#N\|repo#N\|PR-url\|branch]` | Parallel review of a PR or branch diff; with no input (interactive) lists open GitHub + Bitbucket PRs to multi-select. Posts per-finding inline comments + approve/needs-work on PRs. No worktree. |
|
|
77
|
+
| `review-jira [KEY\|url]` | Grade a Jira issue's readiness for the pipeline (scope / AC / repro / design / API / stack), then post the gaps as a Jira comment. Read-only on code. |
|
|
78
|
+
| `review-issue [#N\|repo#N\|url]` | Grade a GitHub issue's readiness for the pipeline, then post the gaps as an issue comment. Read-only on code. |
|
|
77
79
|
| `analysis ["<feature>"]` | Standalone feature-spec analizi: Figma / Swagger / Confluence / Jira / repo girdileri sabit 7-bölümlük şablona dökülür, humanizer'dan geçer, Local/Confluence/Jira hedef(ler)ine post edilir. Worktree veya commit yok. Dev'e zincirleme yok. |
|
|
78
80
|
| `build-optimize` | iOS-only Xcode build performance wrapper. Vendored `xcode-build-orchestrator`'a dispatch eder; benchmark + compilation / project / SPM analyzer'lar + recommend-first plan `.build-benchmark/optimization-plan.md`. Non-iOS stack'lerde fail-fast. |
|
|
79
81
|
| `channels [PR-url\|#N\|Jira-url\|Jira-id] [--channels pr,jira,confluence,wiki] [--content normal,test,auto-diff,note] [--message "..."]` | Post task report to multi-select channels (PR description, Jira comment, Confluence page, Wiki pages) with multi-select content sources. Humanizer pass per-channel. Bitbucket PR updates use reviewer-preserving PUT. Phase 7 delegates to this command; also invocable post-hoc for fixes made outside the pipeline. No worktree. |
|
|
@@ -111,6 +113,8 @@ This command uses lazy loading for token efficiency. Read the relevant sub-file
|
|
|
111
113
|
| `sync` | `$HOME/.claude/commands/multi-agent/sync/SKILL.md` |
|
|
112
114
|
| `clear-logs` | Handled inline - scan + delete agent-log.md/agent-state.json files |
|
|
113
115
|
| `review` | `$HOME/.claude/commands/multi-agent/review/SKILL.md` |
|
|
116
|
+
| `review-jira` | `$HOME/.claude/commands/multi-agent/review-jira/SKILL.md` (loads `$HOME/.claude/multi-agent-refs/readiness-review.md`) |
|
|
117
|
+
| `review-issue` | `$HOME/.claude/commands/multi-agent/review-issue/SKILL.md` (loads `$HOME/.claude/multi-agent-refs/readiness-review.md`) |
|
|
114
118
|
| `analysis` | `$HOME/.claude/commands/multi-agent/analysis/SKILL.md` |
|
|
115
119
|
| `build-optimize` | `$HOME/.claude/commands/multi-agent/build-optimize/SKILL.md` |
|
|
116
120
|
| `local` | `$HOME/.claude/commands/multi-agent/local/SKILL.md` |
|
|
@@ -20,7 +20,7 @@ Phase 7: Report → Jira / Wiki + log + knowledge/memory
|
|
|
20
20
|
|
|
21
21
|
`--dev local` skips Phase 1 (Analysis), Phase 2 (Planning + Approval Gate), Phase 4 (Review), and Phase 5 (User Test - local/autopilot variants skip the interactive test gate). It differs from `--dev` on two axes: no git worktree is created (development happens directly on the current branch in `$PROJECT_ROOT`), and the interactive User Test phase is skipped.
|
|
22
22
|
|
|
23
|
-
> **Want the quality tail afterwards?** Since this mode skips Review + Test, run [`/multi-agent:finish`](
|
|
23
|
+
> **Want the quality tail afterwards?** Since this mode skips Review + Test, run [`/multi-agent:finish`](../finish/SKILL.md) on the same branch when you're done to add parallel review, a build+test success gate, PR, and a Jira technical-analysis + test-scenario comment - without re-developing.
|
|
24
24
|
|
|
25
25
|
## When to use it
|
|
26
26
|
|
|
@@ -107,7 +107,9 @@ Status & Resume:
|
|
|
107
107
|
Post-Hoc & Side-Channel:
|
|
108
108
|
|
|
109
109
|
/multi-agent:channels Post multi-channel report (Jira / Confluence / Wiki / PR description)
|
|
110
|
-
/multi-agent:review Parallel review of
|
|
110
|
+
/multi-agent:review Parallel review of a PR or branch diff; no URL -> pick open GitHub/Bitbucket PRs
|
|
111
|
+
/multi-agent:review-jira Grade a Jira issue's pipeline-readiness -> comment the gaps on it
|
|
112
|
+
/multi-agent:review-issue Grade a GitHub issue's pipeline-readiness -> comment the gaps on it
|
|
111
113
|
/multi-agent:analysis ["analysis-name"] Feature-spec analysis (Figma + Swagger + Confluence + repos) → per-platform v3 doc (23-section Full / 7-section Lite)
|
|
112
114
|
/multi-agent:analysis-resolve [doc] Resolve Section 20 open questions of an analysis doc, one at a time with source-labeled candidates
|
|
113
115
|
/multi-agent:build-optimize iOS-only Xcode build perf wrapper → benchmark + analyze + recommend-first .build-benchmark/optimization-plan.md
|
|
@@ -319,7 +321,9 @@ Status & Resume:
|
|
|
319
321
|
Post-Hoc & Side-Channel:
|
|
320
322
|
|
|
321
323
|
/multi-agent:channels Multi-channel rapor gönder (Jira / Confluence / Wiki / PR description)
|
|
322
|
-
/multi-agent:review
|
|
324
|
+
/multi-agent:review PR veya branch diff'ini paralel review et; URL yoksa -> açık GitHub/Bitbucket PR'larını seçtir
|
|
325
|
+
/multi-agent:review-jira Jira maddesinin pipeline'a hazırlığını değerlendir -> eksikleri yorum olarak ekle
|
|
326
|
+
/multi-agent:review-issue GitHub issue'nun pipeline'a hazırlığını değerlendir -> eksikleri yorum olarak ekle
|
|
323
327
|
/multi-agent:analysis ["analysis-name"] Feature-spec analizi (Figma + Swagger + Confluence + repolar) → platform başına v3 doküman (23 bölüm Full / 7 bölüm Lite)
|
|
324
328
|
/multi-agent:analysis-resolve [doc] Analiz dokümanının Bölüm 20 açık sorularını kaynak etiketli adaylarla teker teker çözer
|
|
325
329
|
/multi-agent:build-optimize iOS-only Xcode build performance wrapper → benchmark + analiz + recommend-first .build-benchmark/optimization-plan.md
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Run parallel review on a branch's diff or a Pull Request: 2 models on Claude Code (Fable + Sonnet), 3 models on Copilot CLI (GPT + Opus + Sonnet). On PR input, posts per-finding inline comments and sets approve/needs-work review state."
|
|
3
|
-
argument-hint: "[#N | repo#N | PR-URL | branch] - optional: PR by number/URL, repo+number, or local branch. Supports GitHub and Bitbucket Server URLs. If omitted, the current branch
|
|
3
|
+
argument-hint: "[#N | repo#N | PR-URL | branch] - optional: PR by number/URL, repo+number, or local branch. Supports GitHub and Bitbucket Server URLs. If omitted (interactive), open GitHub + Bitbucket PRs are listed for multi-select; autopilot falls back to the current branch."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# multi-agent review - Review Only Mode
|
|
@@ -11,7 +11,8 @@ Skip Phase 0-3 and review a diff only. Five input shapes, two providers:
|
|
|
11
11
|
|
|
12
12
|
| Input | Resolution | PR action? |
|
|
13
13
|
|---|---|---|
|
|
14
|
-
| (empty) |
|
|
14
|
+
| (empty), interactive | **PR picker** - list open GitHub + Bitbucket PRs, multi-select which to review | Yes (per selected PR) |
|
|
15
|
+
| (empty), autopilot / no PRs found | Current branch (`HEAD` vs `origin/develop`) | No (chat only) |
|
|
15
16
|
| `feature/foo` | Named local branch | No (chat only) |
|
|
16
17
|
| `#1250` | PR number on the current repo | Yes |
|
|
17
18
|
| `repo#1250` | PR on a specific repo (GitHub `org/repo`) | Yes |
|
|
@@ -40,7 +41,8 @@ trap 'rm -f /tmp/multi-agent-review-${TASK_ID}-*' EXIT
|
|
|
40
41
|
# Pseudocode - orchestrator implements this:
|
|
41
42
|
input="$ARGUMENTS"
|
|
42
43
|
case "$input" in
|
|
43
|
-
"") kind=
|
|
44
|
+
"") kind=pick # interactive: go to Step 1a PR picker; autopilot/no-PRs falls back to branch (see 1a)
|
|
45
|
+
;;
|
|
44
46
|
https://github.com/*/pull/*) kind=pr; provider=github; org_repo=<extracted>; pr_number=<extracted> ;;
|
|
45
47
|
https://bitbucket.*/projects/*/repos/*/pull-requests/*)
|
|
46
48
|
kind=pr; provider=bitbucket-server
|
|
@@ -60,6 +62,35 @@ Save to `agent-state.review.input = { kind, provider, ref?, orgRepo?, bbServerHo
|
|
|
60
62
|
|
|
61
63
|
When `provider=github` and the diff is fetched in Step 2, also persist `agent-state.review.headCommitSha` - GitHub inline-comment posts (`POST /repos/{o}/{r}/pulls/{n}/comments`) require `commit_id`. Bitbucket Server's anchor API does not.
|
|
62
64
|
|
|
65
|
+
### 1a. No-input PR picker - interactive only
|
|
66
|
+
|
|
67
|
+
Reached when `kind=pick` (empty input). Skipped entirely in autopilot: autopilot with no ref goes straight to branch mode (`kind=branch; provider=local; ref=$(git rev-parse --abbrev-ref HEAD)`) so nothing prompts.
|
|
68
|
+
|
|
69
|
+
**List open PRs across both providers** (a provider contributes nothing if its token/CLI is absent - never hard-fail on one provider):
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# GitHub: current repo's open PRs + the user's own/requested open PRs across repos.
|
|
73
|
+
gh pr list --state open --json number,title,url,headRefName,author,updatedAt 2>/dev/null # current repo
|
|
74
|
+
gh search prs --state open --review-requested=@me --json number,title,url,repository,updatedAt 2>/dev/null
|
|
75
|
+
gh search prs --state open --author=@me --json number,title,url,repository,updatedAt 2>/dev/null
|
|
76
|
+
|
|
77
|
+
# Bitbucket Server: for each configured bitbucket repo (prefs recentRepos / dev-context),
|
|
78
|
+
# resolve creds via credential-store (see Step 2 bitbucket block) then:
|
|
79
|
+
# GET https://$host/rest/api/1.0/projects/$KEY/repos/$slug/pull-requests?state=OPEN&role=REVIEWER
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Merge into one deduped list, each row labeled with its provider and PR URL; sort by `updatedAt` desc. If the merged list is EMPTY -> tell the user "no open PRs found", fall back to branch mode, and continue.
|
|
83
|
+
|
|
84
|
+
**Select** - follow `$HOME/.claude/multi-agent-refs/picker-contract.md` (breadcrumb narrator line before the prompt), then `AskUserQuestion` `multiSelect: true`:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
question (outputLanguage): "Hangi PR('lar)ı review edeyim?"
|
|
88
|
+
header (English): "Review PRs"
|
|
89
|
+
options: one per open PR -> label "#<N> <short title>", description (outputLanguage): "<repo> · <provider> · <headRef>"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Each selected option maps back to a full `agent-state.review.input` descriptor (provider + orgRepo / bb coordinates + prNumber + raw URL), exactly as Step 1 would have parsed an explicit URL. Then **loop Steps 2-7 once per selected PR** (independent review + post each). If the user selects none, fall back to branch mode.
|
|
93
|
+
|
|
63
94
|
### 2. Fetch the diff - kind-aware
|
|
64
95
|
|
|
65
96
|
**branch mode:**
|
|
@@ -252,7 +283,8 @@ Standalone `/multi-agent:review` runs use phase id 4 (matches Phase 4 Review in
|
|
|
252
283
|
|
|
253
284
|
| Input | Mode | PR action |
|
|
254
285
|
|---|---|---|
|
|
255
|
-
| no args |
|
|
286
|
+
| no args (interactive) | PR picker (open GitHub + Bitbucket PRs, multi-select) | inline comments + approve/needs-work, per selected PR |
|
|
287
|
+
| no args (autopilot / no PRs) | branch (current) | none - chat only |
|
|
256
288
|
| `feature/foo` | branch (named) | none - chat only |
|
|
257
289
|
| `#N`, `repo#N`, GitHub PR URL | pr (github) | inline comments + approve/needs-work |
|
|
258
290
|
| Bitbucket Server PR URL | pr (bitbucket-server) | inline comments + approve/needs-work |
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Assess whether a GitHub issue is ready for multi-agent development: fetch it, grade scope / acceptance criteria / repro / design / API / stack readiness, then (after confirm) post the gaps as an issue comment. Read-only on code."
|
|
3
|
+
argument-hint: "[#N | repo#N | GitHub issue URL] - optional; with no argument, pick from open issues"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# multi-agent review-issue - GitHub issue readiness review
|
|
7
|
+
|
|
8
|
+
**Input**: $ARGUMENTS
|
|
9
|
+
|
|
10
|
+
Grades an existing GitHub issue for pipeline-readiness and comments the gaps back onto it so the reporter can fix them before a real `/multi-agent` run. No worktree, no branch, no code commits, no pipeline chaining.
|
|
11
|
+
|
|
12
|
+
## Flow
|
|
13
|
+
|
|
14
|
+
Read `$HOME/.claude/multi-agent-refs/readiness-review.md` and execute the shared readiness flow with **provider = github**:
|
|
15
|
+
|
|
16
|
+
1. Resolve the item: `#N`, `repo#N` (`org/repo#N`), or a GitHub issue URL. With no argument, offer the picker reusing the `issue` command's list (`gh issue list`) and single-select one.
|
|
17
|
+
2. Fetch + base maturity via `$HOME/.claude/lib/issue-fetcher.sh` (`gh issue view`; reuse its `maturity` output; no MCP).
|
|
18
|
+
3. Apply the readiness rubric (testable scope, acceptance criteria / DoD, repro for bugs, design reference for UI, API contract for backend, stack signal, dependencies).
|
|
19
|
+
4. Print the chat verdict (score + Blockers / Warnings / Gaps), reusing the maturity blocker-vs-warning severity contract.
|
|
20
|
+
5. Confirm, then post the gap list as an issue comment via `$HOME/.claude/multi-agent-refs/channels/issue-comment.md` (`gh issue comment "$N" --repo "$org/$repo" --body-file <file>`). Autopilot auto-posts.
|
|
21
|
+
|
|
22
|
+
Non-negotiables: verdict content + comment body follow `prefs.global.outputLanguage`; comment tone rules (no AI attribution, no em-dash / section-sign, `Ref:` never `Closes/Fixes`) per `channels/issue-comment.md`. No label change, no assignment, no issue creation, no auto-close.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Assess whether a Jira issue is ready for multi-agent development: fetch it, grade scope / acceptance criteria / repro / design / API / stack readiness, then (after confirm) post the gaps as a Jira comment. Read-only on code."
|
|
3
|
+
argument-hint: "[JIRA-KEY | Jira URL] - optional; with no argument, pick from your open Jira issues"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# multi-agent review-jira - Jira readiness review
|
|
7
|
+
|
|
8
|
+
**Input**: $ARGUMENTS
|
|
9
|
+
|
|
10
|
+
Grades an existing Jira issue for pipeline-readiness and comments the gaps back onto it so the reporter can fix them before a real `/multi-agent` run. No worktree, no branch, no code commits, no pipeline chaining. This is the inverse of `/multi-agent:create-jira`.
|
|
11
|
+
|
|
12
|
+
## Flow
|
|
13
|
+
|
|
14
|
+
Read `$HOME/.claude/multi-agent-refs/readiness-review.md` and execute the shared readiness flow with **provider = jira**:
|
|
15
|
+
|
|
16
|
+
1. Resolve the item: `KEY-123` or a `.../browse/KEY-123` URL. With no argument, offer the picker reusing the `jira` command's issue list (assignee=currentUser, open) and single-select one.
|
|
17
|
+
2. Fetch + base maturity via `$HOME/.claude/lib/issue-fetcher.sh` (reuse its `maturity` output; no MCP).
|
|
18
|
+
3. Apply the readiness rubric (testable scope, acceptance criteria / DoD, repro for bugs, design reference for UI, API contract for backend, stack signal, dependencies).
|
|
19
|
+
4. Print the chat verdict (score + Blockers / Warnings / Gaps), reusing the maturity blocker-vs-warning severity contract.
|
|
20
|
+
5. Confirm, then post the gap list as a Jira comment via `$HOME/.claude/multi-agent-refs/channels/jira.md` (`POST /rest/api/2/issue/{id}/comment`, Bearer token via `credential-store.sh`, UTF-8 verbatim, markdown->wiki). Autopilot auto-posts.
|
|
21
|
+
|
|
22
|
+
Non-negotiables: verdict content + comment body follow `prefs.global.outputLanguage`; comment tone rules (no AI attribution, no em-dash / section-sign, `Ref:` never `Closes`) per `channels/issue-comment.md`. No status change, no assignment, no issue creation.
|
|
@@ -55,7 +55,7 @@ Run every step automatically:
|
|
|
55
55
|
```
|
|
56
56
|
Step 1: PLATFORM Detect macOS / Linux / Windows (Git Bash / WSL); export PLATFORM env
|
|
57
57
|
Step 1.5: DETECT Compare timestamps, find stale targets
|
|
58
|
-
Step 2: COPILOT Claude Code -> Copilot CLI (instructions +
|
|
58
|
+
Step 2: COPILOT Claude Code -> Copilot CLI (instructions + 38 sub-command skills)
|
|
59
59
|
Step 3: REPO Claude Code -> pipeline repo (genericized, personal data scrub, bash -n on all sh)
|
|
60
60
|
Step 3c: PLUGINS pipeline shared/external -> multi-agent-plugins marketplace (rebuild knowledge/,
|
|
61
61
|
bump changed plugins' patch version, commit + push the plugins repo)
|
|
@@ -126,7 +126,7 @@ If nothing is stale → report "All targets up to date" and stop.
|
|
|
126
126
|
grep -rl "^local-only: true" ~/multi-agent-pipeline/pipeline/commands/ 2>/dev/null \
|
|
127
127
|
&& { echo "ABORT: local-only wrapper leaked into pipeline/commands"; exit 1; } || true
|
|
128
128
|
# backstop: no corporate marketplace/skill reference in the synced tree
|
|
129
|
-
grep -rniE "ai-ios-engineering-toolkit:(create-ui-component|evolve-ui-component|
|
|
129
|
+
grep -rniE "ai-ios-engineering-toolkit:(create-ui-component|evolve-ui-component|fix-bug|branch-and-pr|backlog|code-connect|figma-utility|resource-utility|component-wiki|component-docs|figma-setup)" \
|
|
130
130
|
~/multi-agent-pipeline/pipeline/commands/ 2>/dev/null \
|
|
131
131
|
&& { echo "ABORT: corporate reference leaked into pipeline/commands"; exit 1; } || true
|
|
132
132
|
```
|
|
@@ -239,13 +239,13 @@ This runs on the Claude <-> Copilot axis — the two CLIs the pipeline supports
|
|
|
239
239
|
|-------------|-------------|
|
|
240
240
|
| `~/.claude/commands/multi-agent/{cmd}/SKILL.md` | `~/.copilot/skills/multi-agent-{cmd}/SKILL.md` |
|
|
241
241
|
|
|
242
|
-
**
|
|
242
|
+
**38 commands are synced** (canonical inventory - must match `cross-cli-contract.md` section 1; drift = contract violation):
|
|
243
243
|
|
|
244
244
|
```
|
|
245
245
|
analysis, analysis-resolve, autopilot, build-optimize, channels, create-jira, delete, dev,
|
|
246
246
|
dev-autopilot, dev-local, dev-local-autopilot, diff-explain, finish, garbage-collect,
|
|
247
247
|
help, issue, jira, kill, language, local,
|
|
248
|
-
local-autopilot, log, manual-test, prune-logs, purge, refactor, resume, review,
|
|
248
|
+
local-autopilot, log, manual-test, prune-logs, purge, refactor, resume, review, review-issue, review-jira,
|
|
249
249
|
scan, search, setup, stack, status, sync, test, update
|
|
250
250
|
```
|
|
251
251
|
|
|
@@ -63,10 +63,23 @@ except Exception:
|
|
|
63
63
|
|
|
64
64
|
# 1. Pull every credential entry that looks like one of our token services.
|
|
65
65
|
# Includes token entries AND username entries (BB needs the user keychain key).
|
|
66
|
-
# Uses cross-platform credential-store wrapper (macOS/Windows/Linux backends)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
# Uses cross-platform credential-store wrapper (macOS/Windows/Linux backends),
|
|
67
|
+
# located via the shared resolver (repo checkout or either install tree) -
|
|
68
|
+
# never a hardcoded path. A missing helper degrades to an empty inventory.
|
|
69
|
+
# A pre-set CRED_STORE (tests, custom installs) is honored as-is.
|
|
70
|
+
if [ -z "${CRED_STORE:-}" ]; then
|
|
71
|
+
# shellcheck disable=SC1090,SC1091
|
|
72
|
+
. "$(cd "$(dirname "$0")" && pwd)/credential-store-resolver.sh" 2>/dev/null \
|
|
73
|
+
|| . "$HOME/.claude/lib/credential-store-resolver.sh" 2>/dev/null \
|
|
74
|
+
|| . "$HOME/.copilot/lib/credential-store-resolver.sh" 2>/dev/null \
|
|
75
|
+
|| true
|
|
76
|
+
fi
|
|
77
|
+
services=""
|
|
78
|
+
if [ -n "${CRED_STORE:-}" ]; then
|
|
79
|
+
services=$("$CRED_STORE" list 2>/dev/null \
|
|
80
|
+
| grep -E '_(Github|Jira|Bitbucket|Confluence)_[A-Za-z]+_(Token|Json|Username)$|_Github_Auth_Token$|_Github_Access_Token$|_Jira_Access_Token$|_Bitbucket_Access_Token$|_Bitbucket_Username$|_Confluence_Access_Token$' \
|
|
81
|
+
|| true)
|
|
82
|
+
fi
|
|
70
83
|
|
|
71
84
|
# 2. Compute unique prefixes (everything before the provider segment).
|
|
72
85
|
prefixes=$(printf '%s\n' "$services" \
|
|
@@ -114,14 +127,6 @@ emit_accounts() {
|
|
|
114
127
|
[ $match -eq 0 ] && continue
|
|
115
128
|
fi
|
|
116
129
|
|
|
117
|
-
# Provider list
|
|
118
|
-
local prov_json=""
|
|
119
|
-
[ -n "$gh_token" ] && prov_json="${prov_json}\"github\","
|
|
120
|
-
[ -n "$jira_token" ] && prov_json="${prov_json}\"jira\","
|
|
121
|
-
[ -n "$bb_token" ] && prov_json="${prov_json}\"bitbucket\","
|
|
122
|
-
[ -n "$conf_token" ] && prov_json="${prov_json}\"confluence\","
|
|
123
|
-
prov_json="${prov_json%,}"
|
|
124
|
-
|
|
125
130
|
# Work-account heuristic: bitbucket+jira together indicates corporate.
|
|
126
131
|
local is_work="false"
|
|
127
132
|
if [ -n "$bb_token" ] && [ -n "$jira_token" ]; then
|
|
@@ -134,18 +139,18 @@ emit_accounts() {
|
|
|
134
139
|
|
|
135
140
|
# Hosts: per-account override (prefs.global.accounts[].jiraHost) wins; falls
|
|
136
141
|
# back to global.hosts.{jira,bitbucket}; otherwise null. No hardcoded values.
|
|
137
|
-
local jira_host="
|
|
142
|
+
local jira_host="" bb_host=""
|
|
138
143
|
local per_jira per_bb
|
|
139
144
|
per_jira=$(account_host_override "$short_id" "jiraHost")
|
|
140
145
|
per_bb=$(account_host_override "$short_id" "bitbucketHost")
|
|
141
146
|
if [ -n "$jira_token" ]; then
|
|
142
|
-
if [ -n "$per_jira" ]; then jira_host="
|
|
143
|
-
elif [ -n "$prefs_jira_host" ]; then jira_host="
|
|
147
|
+
if [ -n "$per_jira" ]; then jira_host="$per_jira"
|
|
148
|
+
elif [ -n "$prefs_jira_host" ]; then jira_host="$prefs_jira_host"
|
|
144
149
|
fi
|
|
145
150
|
fi
|
|
146
151
|
if [ -n "$bb_token" ]; then
|
|
147
|
-
if [ -n "$per_bb" ]; then bb_host="
|
|
148
|
-
elif [ -n "$prefs_bb_host" ]; then bb_host="
|
|
152
|
+
if [ -n "$per_bb" ]; then bb_host="$per_bb"
|
|
153
|
+
elif [ -n "$prefs_bb_host" ]; then bb_host="$prefs_bb_host"
|
|
149
154
|
fi
|
|
150
155
|
fi
|
|
151
156
|
|
|
@@ -185,12 +190,45 @@ emit_accounts() {
|
|
|
185
190
|
[ $first -eq 0 ] && printf ','
|
|
186
191
|
first=0
|
|
187
192
|
|
|
188
|
-
printf
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
193
|
+
# Build the entry with python3 from env vars - printf-interpolated JSON
|
|
194
|
+
# has zero escaping, so a quote or backslash in a keychain service name
|
|
195
|
+
# would corrupt the whole array. Values cross into python via the
|
|
196
|
+
# environment, never via string interpolation.
|
|
197
|
+
ACC_ID="$short_id" ACC_LABEL="$label" ACC_PREFIX="$prefix" \
|
|
198
|
+
ACC_GH_TOKEN="$gh_token" ACC_JIRA_TOKEN="$jira_token" \
|
|
199
|
+
ACC_BB_TOKEN="$bb_token" ACC_CONF_TOKEN="$conf_token" \
|
|
200
|
+
ACC_BB_USER_KEY="$bb_user_key" ACC_GH_USER="$gh_user" \
|
|
201
|
+
ACC_JIRA_HOST="$jira_host" ACC_BB_HOST="$bb_host" ACC_IS_WORK="$is_work" \
|
|
202
|
+
python3 - <<'PY'
|
|
203
|
+
import json, os
|
|
204
|
+
|
|
205
|
+
def env(name):
|
|
206
|
+
return os.environ.get(name, "")
|
|
207
|
+
|
|
208
|
+
providers = []
|
|
209
|
+
if env("ACC_GH_TOKEN"): providers.append("github")
|
|
210
|
+
if env("ACC_JIRA_TOKEN"): providers.append("jira")
|
|
211
|
+
if env("ACC_BB_TOKEN"): providers.append("bitbucket")
|
|
212
|
+
if env("ACC_CONF_TOKEN"): providers.append("confluence")
|
|
213
|
+
|
|
214
|
+
print(json.dumps({
|
|
215
|
+
"id": env("ACC_ID"),
|
|
216
|
+
"label": env("ACC_LABEL"),
|
|
217
|
+
"prefix": env("ACC_PREFIX"),
|
|
218
|
+
"providers": providers,
|
|
219
|
+
"tokens": {
|
|
220
|
+
"github": env("ACC_GH_TOKEN"),
|
|
221
|
+
"jira": env("ACC_JIRA_TOKEN"),
|
|
222
|
+
"bitbucket": env("ACC_BB_TOKEN"),
|
|
223
|
+
"confluence": env("ACC_CONF_TOKEN"),
|
|
224
|
+
},
|
|
225
|
+
"userKeys": {"bitbucket": env("ACC_BB_USER_KEY")},
|
|
226
|
+
"users": {"github": env("ACC_GH_USER")},
|
|
227
|
+
"jiraHost": env("ACC_JIRA_HOST") or None,
|
|
228
|
+
"bitbucketHost": env("ACC_BB_HOST") or None,
|
|
229
|
+
"isWork": env("ACC_IS_WORK") == "true",
|
|
230
|
+
}, ensure_ascii=False), end="")
|
|
231
|
+
PY
|
|
194
232
|
done <<< "$prefixes"
|
|
195
233
|
printf ']'
|
|
196
234
|
}
|
|
@@ -26,6 +26,11 @@ STATE="${2:-}"
|
|
|
26
26
|
}
|
|
27
27
|
[ ! -f "$STATE" ] && { echo "ERR: state file not found: $STATE" >&2; exit 2; }
|
|
28
28
|
|
|
29
|
+
# count_matches: single-line numeric grep -c (the bare `grep -c || echo 0`
|
|
30
|
+
# idiom emits "0" twice on zero matches and breaks the -le comparisons below).
|
|
31
|
+
# shellcheck source=count-lib.sh disable=SC1091
|
|
32
|
+
. "$(cd "$(dirname "$0")" && pwd)/count-lib.sh"
|
|
33
|
+
|
|
29
34
|
# --- Helpers ----------------------------------------------------------------
|
|
30
35
|
# Extract the targets array from agent-state.json. Output: TSV with columns
|
|
31
36
|
# repoName, prUrl, isPrimary (1/0). One target per row.
|
|
@@ -156,7 +161,7 @@ do_render_jira() {
|
|
|
156
161
|
local urls
|
|
157
162
|
urls=$(all_pr_urls | tr ' ' '\n' | grep -v '^$' || true)
|
|
158
163
|
local count
|
|
159
|
-
count=$(printf '%s\n' "$urls" |
|
|
164
|
+
count=$(printf '%s\n' "$urls" | count_matches .)
|
|
160
165
|
|
|
161
166
|
if [ "$count" -le 1 ]; then
|
|
162
167
|
cat "$body_file"
|
|
@@ -179,7 +184,7 @@ do_render_conf() {
|
|
|
179
184
|
local urls
|
|
180
185
|
urls=$(all_pr_urls | tr ' ' '\n' | grep -v '^$' || true)
|
|
181
186
|
local count
|
|
182
|
-
count=$(printf '%s\n' "$urls" |
|
|
187
|
+
count=$(printf '%s\n' "$urls" | count_matches .)
|
|
183
188
|
|
|
184
189
|
if [ "$count" -le 1 ]; then
|
|
185
190
|
cat "$body_file"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# count-lib.sh - shared counting helper for pipeline shell scripts.
|
|
3
|
+
#
|
|
4
|
+
# Why: `grep -c` prints "0" AND exits 1 when nothing matches, so the common
|
|
5
|
+
# idiom `$(grep -c pattern file || echo 0)` emits TWO lines ("0" plus the
|
|
6
|
+
# fallback "0"). That breaks arithmetic (`$((x + 0\n0))` is a syntax error)
|
|
7
|
+
# and numeric comparisons (`[ "0\n0" -le 1 ]` silently evaluates false).
|
|
8
|
+
#
|
|
9
|
+
# count_matches guarantees single-line numeric output in every case:
|
|
10
|
+
# - match count when grep succeeds
|
|
11
|
+
# - "0" when nothing matches or grep itself errors (missing file, ...)
|
|
12
|
+
#
|
|
13
|
+
# Usage (same arguments as grep -c, file or stdin):
|
|
14
|
+
# n=$(count_matches -E 'pattern' "$file")
|
|
15
|
+
# n=$(printf '%s\n' "$blob" | count_matches .)
|
|
16
|
+
#
|
|
17
|
+
# Source from a sibling script:
|
|
18
|
+
# . "$(cd "$(dirname "$0")" && pwd)/count-lib.sh"
|
|
19
|
+
|
|
20
|
+
count_matches() {
|
|
21
|
+
local n
|
|
22
|
+
n=$(grep -c "$@" 2>/dev/null) || true
|
|
23
|
+
case "$n" in
|
|
24
|
+
'' | *[!0-9]*) n=0 ;;
|
|
25
|
+
esac
|
|
26
|
+
printf '%s\n' "$n"
|
|
27
|
+
}
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
# Subcommands:
|
|
9
9
|
# get <key> Read secret value to stdout (empty + exit 1 if missing)
|
|
10
10
|
# set <key> <value> Store secret (overwrites if exists)
|
|
11
|
+
# set <key> - Same, but read the secret from stdin. Preferred:
|
|
12
|
+
# keeps the secret off this script's argv (visible to
|
|
13
|
+
# ps). A literal "-" value cannot be stored this way.
|
|
11
14
|
# delete <key> Remove secret
|
|
12
15
|
# list List all keys (one per line)
|
|
13
16
|
# platform Print detected platform: macos | windows | linux | unknown
|
|
@@ -124,7 +127,11 @@ if (\$c) { \$c.GetNetworkCredential().Password }
|
|
|
124
127
|
|
|
125
128
|
do_set() {
|
|
126
129
|
local key="${1:-}" val="${2:-}"
|
|
127
|
-
[ -z "$key" ] && { echo "usage: $0 set <key> <value
|
|
130
|
+
[ -z "$key" ] && { echo "usage: $0 set <key> <value|->" >&2; exit 3; }
|
|
131
|
+
# "-" means: read the secret from stdin (keeps it off argv).
|
|
132
|
+
if [ "$val" = "-" ]; then
|
|
133
|
+
val=$(cat)
|
|
134
|
+
fi
|
|
128
135
|
if delegate_to_python; then
|
|
129
136
|
# Pass the value via stdin to keep it out of process listings / shell history.
|
|
130
137
|
printf '%s' "$val" | python3 "$KEYCHAIN_PY" set "$key" -
|
|
@@ -132,7 +139,15 @@ do_set() {
|
|
|
132
139
|
fi
|
|
133
140
|
case "$PLATFORM" in
|
|
134
141
|
macos)
|
|
135
|
-
security
|
|
142
|
+
# `security -i` reads the add command from stdin, so the secret never
|
|
143
|
+
# lands on the `security` argv (visible to ps). printf is a bash
|
|
144
|
+
# builtin, so no argv exposure there either. Double quotes/backslashes
|
|
145
|
+
# are escaped for security's interactive tokenizer.
|
|
146
|
+
local key_sec val_sec
|
|
147
|
+
key_sec=${key//\\/\\\\}; key_sec=${key_sec//\"/\\\"}
|
|
148
|
+
val_sec=${val//\\/\\\\}; val_sec=${val_sec//\"/\\\"}
|
|
149
|
+
printf 'add-generic-password -U -s "%s" -a "%s" -w "%s"\n' \
|
|
150
|
+
"$key_sec" "${USER:-claude}" "$val_sec" | security -i >/dev/null 2>&1
|
|
136
151
|
;;
|
|
137
152
|
linux)
|
|
138
153
|
require_cmd secret-tool "Install libsecret-tools (see doctor)."
|
|
@@ -140,11 +155,13 @@ do_set() {
|
|
|
140
155
|
;;
|
|
141
156
|
windows)
|
|
142
157
|
# Escape single quotes for PowerShell single-quoted strings ('' = literal ').
|
|
143
|
-
local key_esc="${key//\'/\'\'}"
|
|
144
|
-
#
|
|
145
|
-
|
|
158
|
+
local key_esc="${key//\'/\'\'}"
|
|
159
|
+
# The secret is piped via stdin ([Console]::In) so it never appears on
|
|
160
|
+
# the PowerShell argv (visible to process listings).
|
|
161
|
+
printf '%s' "$val" | ps_run "
|
|
146
162
|
\$ErrorActionPreference='Stop'
|
|
147
|
-
\$
|
|
163
|
+
\$raw = [Console]::In.ReadToEnd()
|
|
164
|
+
\$pwd = ConvertTo-SecureString \$raw -AsPlainText -Force
|
|
148
165
|
New-StoredCredential -Target '$key_esc' -UserName '${USER:-${USERNAME:-claude}}' -SecurePassword \$pwd -Persist LocalMachine | Out-Null
|
|
149
166
|
" >/dev/null
|
|
150
167
|
;;
|