# Pipeline Scripts  -  Category Index

The `pipeline/scripts/` directory holds 186 shell scripts + 58 Node.js `.mjs` scripts in a flat layout. v6.0.0 evaluated moving them into `smoke/`, `hooks/`, `runtime/` subdirs and decided against it: each path change would need to propagate through `package.json` globs, `install.js` deploy logic, npm scripts, sibling script calls, and CI workflow references  -  a 40+ file touch radius with high regression risk for minor polish value.

Instead, this README is a curated category index of the key scripts, not an exhaustive listing. Use it to navigate.

## Smoke scripts (151 files  -  `smoke-*.sh`)

Validate contracts. Each emits `══ <name> smoke: N passed, M failed ══` on completion (the `smoke-personal-data.sh` + `smoke-token-budget.sh` suites use `PASS:` / `warnings:` variants). Run via `npm test` (chained) or individually.

### Cross-CLI contract + parity
- `smoke-cross-cli-behavior.sh`  -  parent parity smoke, agent/skill deployment on both sides
- `smoke-commands-skills-parity.sh`  -  colon-form command ↔ dash-form skill directory parity (50 assertions)
- `smoke-compliance-skills.sh`  -  v5.8.1+ store-compliance wiring contract (45 assertions)
- `smoke-figma-cross-cli-inventory.sh`  -  figma skill cross-CLI source-tree parity (39 assertions)

### Figma pipeline (see `pipeline/scripts/README-figma-smokes.md` for the full index)
- `smoke-figma-config-schema.sh`, `smoke-figma-dispatch.sh`

### Phase contracts
- `smoke-phase-0-multi-repo.sh`  -  Phase 0 multi-repo mode fetch + worktree atomicity
- `smoke-phase-6-multi.sh`  -  Phase 6 multi-repo commit/PR cross-linking
- `smoke-phase-banner.sh` + `smoke-phase-tracker.sh`  -  Phase UI output contracts
- `smoke-phase4-triage.sh`  -  Phase 4 reviewer → triage flow
- `smoke-verify-by-test.sh`  -  Phase 4 Step 3.7 verify-by-test contract (v10.8.0)
- `smoke-handoff-contract.sh`  -  phase-boundary structured handoff + handoff-first resume (v10.8.0)
- `smoke-update-check.sh`  -  Phase 0 Step 0.6 update-check + required-floor contract (v10.9.0, floor v15.14.0)
- `smoke-context-links.sh`  -  context-link-extractor classification contract, all types (v15.14.0)
- `smoke-graylog-environments.sh`  -  Graylog prod / test instance resolution + auto fallback (v15.15.0)

### Schema + state
- `smoke-schema-validation.sh`  -  all JSON schemas validate
- `smoke-migrate-state.sh`  -  `migrate-state.mjs` runner behavior
- `smoke-pref-migration.sh`  -  prefs 2.0.0 → 2.1.0 → 2.2.0 migration chain (22 assertions)
- `smoke-write-state.sh`  -  atomic state writer concurrency

### Quality + security
- `smoke-personal-data.sh`  -  guards against corporate hostname / private Jira key / personal domain leaks (13 patterns; full catalog in the script itself)
- `smoke-pat-audit.sh`  -  PAT lookup telemetry contract
- `smoke-token-budget.sh`  -  per-phase token budget enforcement (9 phases)
- `smoke-skill-scan.sh`  -  skill security scanner tiered pattern catalog

### Command / Feature contracts
- `smoke-channels-flow.sh`  -  `/multi-agent:channels` multi-select + humanizer + Bitbucket PUT (44 assertions)
- `smoke-wiki-integration.sh`  -  v5.7+ wiki Case A/B + 4-adapter contract
- `smoke-add-detail.sh`  -  legacy Bitbucket PUT reviewer-preservation
- `smoke-issue-jira-triad.sh`  -  Issue → Jira → Wiki triad
- `smoke-url-enrichment.sh`  -  Phase 0 Step 1b URL context parsing
- `smoke-plan-approval-gate.sh`  -  Phase 2 clarification + free-text edit loop
- `smoke-push-retry.sh`  -  5-retry policy + 4-option fail flow
- `smoke-identity-isolation.sh`  -  cross-identity PAT leak guard
- `smoke-sync-delegation.sh`, `smoke-sync-parity.sh`  -  `/multi-agent:sync` behavior

### Sub-systems
- `smoke-multi-repo-integration.sh`  -  v5.6.0 integration build + learn-once registry (20 assertions)
- `smoke-multi-repo-worktree.sh`  -  serial worktree creation with atomicity rollback
- `smoke-prefs-language.sh`  -  `prefs.global.promptLanguage` contract
- `smoke-progress-contract.sh`  -  progress-line quiet/normal/verbose
- `smoke-search.sh`  -  `/multi-agent:search` log search + smart ranking
- `smoke-subagent-validators.sh`  -  Phase 1/2 validator schemas
- `smoke-telemetry.sh`  -  opt-in telemetry contract
- `smoke-learning-curve.sh`  -  `learning-curve.mjs` metrics-trend contract
- `smoke-validator-contradiction.sh`  -  Phase 4 approved/blocking contradiction detection
- `smoke-pre-commit.sh`  -  pre-commit hook integration

## Hook scripts (3 files)
Installed into `~/.claude/scripts/` and invoked by settings.json hook configuration.

- `pre-commit-check.sh`  -  runs before `git commit` (secret scan + personal-data leak check)
- `pre-push-check.sh`  -  runs before `git push` (smoke-cross-cli-behavior + smoke-personal-data)
- `output-quality-check.sh`  -  runs after PR body / Jira comment generation (newline / HTML entity guard)

## Runtime helpers
Shell scripts invoked during pipeline execution.

- `phase-banner.sh`  -  renders phase headers
- `phase-tracker.sh`  -  live tracker state + tokens accumulation + render
- `keychain-save.sh`  -  store PAT in macOS Keychain
- `audit-log.sh` + `audit-log-rotate.sh`  -  opt-in audit trail
- `log-metric.sh`  -  opt-in metric capture
- `search-logs.sh`  -  backs `/multi-agent:search`
- `scan-skills.sh`  -  backs `/multi-agent:scan`
- `benchmark-phase-0.sh`  -  Phase 0 perf harness
- `github-ssh-setup.sh`  -  first-run SSH key setup helper
- `update-check.sh`  -  cached registry read (`dist-tags.latest` + `dist-tags.required`); always exit 0
- `require-supported-version.sh`  -  turns the `force` signal into exit 3; fails open offline
- `sync-parity-check.sh`  -  manual parity verification helper

## Node.js helpers (54 `.mjs` files)

- `aggregate-metrics.mjs`  -  collects telemetry aggregates
- `learning-curve.mjs`  -  time-bucketed trend over `metrics.jsonl` (first-pass clean rate, review cycles, rework/task, tokens/task, cache ratio); `--bucket`, `--since`, `--json`, `--markdown`
- `eval-triage.mjs`  -  runs the 11 triage eval fixtures
- `eval-mine-corpus.mjs`  -  manual maintainer CLI: mines `~/.claude/memory/multi-agent/<repo-slug>/triage-corpus.jsonl` from real runs into new triage eval fixtures (dev-only, excluded from the npm package; not part of `npm test`)
- `gen-skills-index.mjs`  -  regenerates `pipeline/skills/shared/README.md` skill catalog
- `migrate-prefs.mjs`  -  preference migration driver (v2.0.0 through v2.6.0)
- `migrate-state.mjs`  -  generic migration runner (reads `schemas/migrations/`)
- `token-budget-report.mjs`  -  per-phase token usage report
- `validate-analysis.mjs`, `validate-planning.mjs`, `validate-reviewer.mjs`, `validate-triage.mjs`  -  per-phase output validators
- `validate-schemas.mjs`  -  top-level schema validity gate (runs every schema through AJV)
- `write-state.mjs`  -  atomic state writer with concurrency safety

## Why flat layout (not `smoke/`, `hooks/`, `runtime/`)

The audit (v6.0.0 W3.3) considered moving files into subdirs for clarity. Tradeoffs:

- **Pro:** easier navigation in file tree viewers; clearer categorization at a glance.
- **Con:** every path reference would need updating  -  `npm test` glob (`pipeline/scripts/smoke-*.sh`), `install.js` `pipeline/scripts` deploy logic, every smoke's `$HERE/../..` root resolution, sibling calls between scripts, CI workflow references. 40+ file touch radius with no runtime behavior change.

Verdict: flat layout kept, this README plays the navigator role. If the script count doubles and the ratio shifts, revisit.
