[PR #3295] feat: add -f/--file flag to opencode run command #10597

Closed
opened 2026-02-16 18:15:18 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/3295

State: closed
Merged: Yes


Summary

Add support for reading and prepending file content to messages in the opencode run command using the -f/--file flag.

Changes

  • New Feature: Added -f/--file option to the run command
  • Functionality: Reads file content and prepends it to the message with proper spacing
  • Path Resolution: Resolves relative paths from current working directory
  • Error Handling: Comprehensive error handling for:
    • File not found errors
    • Permission issues
    • Other I/O failures
  • CLI Experience: Both -f (short) and --file (long) options supported

Usage

# Read file and prepend to message
opencode run -f config.json "update this configuration"

# Long form also works
opencode run --file instructions.txt "follow these instructions"

# Support multiple files
opencode run -f config.json -f schema.json -f data.json "analyze these configs"
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/3295 **State:** closed **Merged:** Yes --- ## Summary Add support for reading and prepending file content to messages in the `opencode run` command using the `-f/--file` flag. ## Changes - **New Feature**: Added `-f/--file` option to the run command - **Functionality**: Reads file content and prepends it to the message with proper spacing - **Path Resolution**: Resolves relative paths from current working directory - **Error Handling**: Comprehensive error handling for: - File not found errors - Permission issues - Other I/O failures - **CLI Experience**: Both `-f` (short) and `--file` (long) options supported ## Usage ```bash # Read file and prepend to message opencode run -f config.json "update this configuration" # Long form also works opencode run --file instructions.txt "follow these instructions" # Support multiple files opencode run -f config.json -f schema.json -f data.json "analyze these configs" ```
yindo added the pull-request label 2026-02-16 18:15:18 -05:00
yindo closed this issue 2026-02-16 18:15:18 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10597