Skip to content

feat(cmd): Allow line ranges in opencode run file attachments - #14186

Closed
ewired wants to merge 1 commit into
anomalyco:devfrom
ewired:cmd-line-range
Closed

feat(cmd): Allow line ranges in opencode run file attachments#14186
ewired wants to merge 1 commit into
anomalyco:devfrom
ewired:cmd-line-range

Conversation

@ewired

@ewiredewired commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Allows specifying line range for the opencode run CLI file attachment option -f. e.g. opencode run "Tell me the exact contents of this line range" -f path/to/file.js:59-66. It will verify whether there is a file with that exact name (for whatever strange reason someone might have that syntax in their filenames) before extracting the line number/range.

How did you verify your code works?

cd packages/opencode && bun dev run "Repeat the exact contents of the attached files" -f README.md:12 -f bunfig.toml -f package.json:11-15

It successfully repeated the given snippets and whole files.

Closes#14193

@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title Allow line ranges in opencode run file attachments doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@ewiredewired changed the title Allow line ranges in opencode run file attachmentsfeat(cmd): Allow line ranges in opencode run file attachmentsFeb 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@ewired
ewiredforce-pushed the cmd-line-range branch 4 times, most recently from d52af46 to ead6e1bCompareMarch 1, 2026 02:59
@ewired
ewiredforce-pushed the cmd-line-range branch 2 times, most recently from ebf8621 to 3d3b75eCompareApril 11, 2026 03:58
@ewired

Copy link
Copy Markdown
ContributorAuthor

Hey @rekram1-node, I think there was some confusion over whether this PR conflicts with the intention of the fff-backed autocomplete in #22458. This change actually does not touch anything related to autocomplete, the TUI, or the server. #4238 in which I added line ranges to the autocomplete/TUI was already merged a while ago. This one only touches the opencode run CLI subcommand, allowing someone to pass line ranges like -f somefile.ts:42-100 on file attachments. This patch is still ready to review, pretty minimal and clean, and shouldn't be conflicting with any other proposed feature patches.

@rekram1-node

Copy link
Copy Markdown
Collaborator

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Pass line numbers/ranges to file attachment argument in opencode run

2 participants

@ewired@rekram1-node