Skip to content

feat(background-file) Add the background-file CLI option#206

Open
Victor-D wants to merge 1 commit into
alibaba:mainfrom
Victor-D:feat/background_from_file
Open

feat(background-file) Add the background-file CLI option#206
Victor-D wants to merge 1 commit into
alibaba:mainfrom
Victor-D:feat/background_from_file

Conversation

@Victor-D

@Victor-D Victor-D commented Jun 24, 2026

Copy link
Copy Markdown

feat(background-file) Add the background-file CLI option to read a local business context file

Description

Following discussion in #176 add the new -B flag :

  -b, --background string       optional requirement/business context for the review
  -B, --background-file string  path to a Markdown file used as review background (combined with --background; inline value appears first when both are set)

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • make test passes locally
  • Manual testing (describe below)

soft limit

% ./dist/opencodereview review --repo /home/USER/bitbucket/REPO_NAME --commit <commit-hash> -B /tmp/context.md
[ocr] --background-file content is 4623 characters, exceeding the recommended 2000 (continuing but review quality might be impacted)
[ocr] 2 file(s) changed, reviewing 1 in /home/USER/bitbucket/REPO_NAME
[ocr] Skipping hieradata/roles/web.eyaml — filtered by path/extension rules
[ocr] Filtered 1 file(s) by include/exclude rules

hard limit

user@HOSTNAME open-code-review % ./dist/opencodereview review --repo /home/USER/bitbucket/REPO_NAME --commit <commit-hash> -B /tmp/context.md
Error: background content is 14631 characters, exceeding the hard limit of 8000 (aborting)

I also checked I see the two prompts in the session file when using -b and -B flags.

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)
  • I have signed the CLA

Related Issues

@CLAassistant

CLAassistant commented Jun 24, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 OpenCodeReview found 2 issue(s) in this PR.

  • ✅ 2 posted as inline comment(s)
  • 📝 0 posted as summary

Comment thread cmd/opencodereview/background_file.go
Comment thread cmd/opencodereview/background_file.go
@Victor-D Victor-D force-pushed the feat/background_from_file branch 2 times, most recently from 68a516f to 2e81436 Compare June 24, 2026 14:41
@Victor-D Victor-D force-pushed the feat/background_from_file branch from 2e81436 to be6b2b1 Compare June 24, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants