Skip to content

Merge Command

Quick Start: Run batch-level integration checks on feature branches after sequant run completes. Catches cross-issue gaps that per-issue QA misses — merge conflicts, template mirroring gaps, residual patterns, and file overlaps — at zero AI cost.

  • Command: npx sequant merge [issues...] [options]
  • Requirements:
    • Feature branches exist (pushed to remote or in local worktrees)
    • GitHub CLI authenticated (gh auth login) for --post flag
  • Relationship: Runs AFTER sequant run, BEFORE /merger
sequant run 265 298 299 300 # implement
sequant merge --check # verify (this command)
/merger 265 298 299 300 # merge
Terminal window
npx sequant merge 265 298 299 300 --check

Runs Phase 1 deterministic checks: combined branch test, template mirroring, and file overlap detection.

Terminal window
npx sequant merge --check

Reads the most recent run log from .sequant/logs/ and auto-detects which issues to check.

Terminal window
npx sequant merge 265 298 299 300 --scan

Runs Phase 1 + Phase 2: adds residual pattern detection that finds instances of removed code patterns still present elsewhere in the codebase.

Terminal window
npx sequant merge 265 298 299 300 --check --post

Posts per-issue merge readiness reports as comments on each PR.

OptionDescriptionDefault
--checkRun Phase 1 deterministic checksDefault if no flag specified
--scanRun Phase 1 + Phase 2 residual pattern detection-
--reviewRun Phase 1 + 2 + 3 AI briefing (stub)-
--allRun all phases-
--postPost report to GitHub as PR comments-
--jsonOutput as JSON (for scripting)-
-v, --verboseEnable verbose output-
CodeMeaning
0All checks pass (READY)
1Warnings found (NEEDS_ATTENTION)
2Failures found (BLOCKED)
CheckWhat It DoesVerdict
Combined Branch TestCreates temp branch, merges all feature branches, runs npm test && npm run buildFAIL if merge conflict or test/build failure
Template MirroringVerifies .claude/skills/ changes have matching templates/skills/ updates (and vice versa for hooks/)WARN if unmirrored changes found
File Overlap DetectionFlags files modified by multiple issues in the batch, classifies as additive vs conflictingWARN if overlaps found

Phase 2: Residual Pattern Detection (--scan)

Section titled “Phase 2: Residual Pattern Detection (--scan)”
CheckWhat It DoesVerdict
Residual Pattern ScanExtracts removed patterns from each PR’s diff, searches codebase for remaining instancesWARN if residuals found

The residual scan uses literal string matching (minimum 8 characters) with git grep. It excludes files already modified by the PR, test files, and node_modules.

Not yet implemented. Returns a stub message directing you to use --check or --scan.

After sequant run completes a batch:

Terminal window
# 1. Run merge checks
npx sequant merge --scan
# 2. Review the report
# READY → safe to merge
# NEEDS_ATTENTION → review warnings
# BLOCKED → fix before merging
# 3. Merge passing issues
/merger 265 298 299 300

Use JSON output and exit codes for automation:

Terminal window
npx sequant merge --check --json > report.json
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "All clear to merge"
elif [ $exit_code -eq 1 ]; then
echo "Warnings found — review report.json"
else
echo "Blocked — fix issues before merging"
fi

Share results with reviewers by posting to GitHub:

Terminal window
npx sequant merge 265 298 299 300 --scan --post

Each PR receives a per-issue report showing its specific findings and the batch-level verdict.

# Merge Readiness Report
**Generated:** 2026-02-21T19:30:00.000Z
**Batch Verdict:** NEEDS_ATTENTION
## Per-Issue Verdicts
| Issue | Title | Verdict |
|-------|-------|---------|
| #265 | Audit skill files | WARN |
| #298 | Add test tautology | PASS |
## Combined Branch Test
- npm test passed on combined state
- npm run build passed on combined state
## Mirroring
- Modified .claude/skills/qa/SKILL.md but not templates/skills/qa/SKILL.md
## Overlap Detection
- src/commands/run.ts modified by issues #298, #299 (additive)
## Summary
- Errors: 0
- Warnings: 2
- Issues in batch: 4
- Checks run: 3

Returns structured JSON with all check results, per-issue verdicts, and the batch verdict. Useful for scripting and CI integration.

VerdictMeaning
PASSNo issues found for this issue
WARNWarnings found (mirroring gaps, residuals, overlaps)
FAILCritical issues (merge conflicts, test/build failures)
VerdictMeaningExit Code
READYAll issues pass, safe to merge0
NEEDS_ATTENTIONWarnings found, review before merging1
BLOCKEDCritical failures, fix before merging2

Symptoms: Error when running sequant merge without issue numbers.

Solution: Either specify issues explicitly or run sequant run first to generate a run log:

Terminal window
# Explicit issues
npx sequant merge 265 298 --check
# Or run first
npx sequant run 265 298
npx sequant merge --check

Symptoms: Error saying no branches found for specified issues.

Solution: Ensure feature branches exist — either pushed to remote or in local worktrees:

Terminal window
# Check remote branches
git branch -r | grep feature/265
# Check worktrees
git worktree list

Combined branch test reports merge conflict

Section titled “Combined branch test reports merge conflict”

Symptoms: BLOCKED verdict due to merge conflict between feature branches.

Solution: This means two feature branches modify the same file in incompatible ways. Options:

  1. Merge one branch first, then rebase the other
  2. Manually resolve the conflict before merging both
  3. If the conflict is in auto-generated files, it may resolve after merging one branch

Mirroring warnings for intentional divergences

Section titled “Mirroring warnings for intentional divergences”

Symptoms: WARN for a .claude/skills/ file that intentionally differs from templates/skills/.

Solution: Mirroring warnings are advisory. If the divergence is intentional (e.g., project-specific paths), note it in your PR description and proceed with merge.


Generated for Issue #313 on 2026-02-22