Skip to content

Testing VSCode Copilot in agent mode, implementing a CLI utility to fetch, parse and summarize news

Notifications You must be signed in to change notification settings

AnthonyClark/cli-news-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

News CLI

A command-line tool for fetching and summarizing news articles from various sources.

Installation

  1. Clone the repository
  2. Run bundle install to install dependencies
  3. Set up your OpenAI API key:
    ./bin/news configure openai.api_key your-api-key

Usage

Fetching Articles

# Fetch articles from BBC News (default: 5 articles)
./bin/news fetch bbc

# Fetch specific number of articles
./bin/news fetch bbc --limit 2

Managing Topics

# Like a topic
./bin/news topics like technology

# Dislike a topic
./bin/news topics dislike politics

List Available Sources

./bin/news sources

Development

Running Tests

# Run all tests
rake test

# Run specific test file
ruby -Ilib test/test_bbc_source.rb

Working with VCR Cassettes

The project uses VCR to record and replay HTTP interactions in tests. This ensures tests are fast and deterministic while still testing real-world scenarios.

Recording New Cassettes

To record new VCR cassettes:

  1. Delete existing cassettes you want to re-record:

    rm test/fixtures/vcr_cassettes/bbc_*.yml
  2. Run tests with recording enabled:

    VCR_RECORD=1 ruby -Ilib test/test_bbc_source.rb

Best Practices for VCR

  • Don't commit cassettes with sensitive data
  • Re-record cassettes periodically to test against real responses
  • Review cassettes before committing to ensure they don't contain sensitive data
  • Use VCR_RECORD=1 when site content changes significantly

Project Structure

bin/
  news                 # CLI executable
lib/
  news_cli/
    cli.rb            # CLI implementation
    config.rb         # Configuration management
    news_source.rb    # Base class for news sources
    summarizer.rb     # Article summarization
    sources/
      bbc.rb          # BBC news source implementation
test/
  fixtures/
    vcr_cassettes/    # VCR cassettes
  test_helper.rb      # Test configuration
  test_*             # Test files

Configuration

Configuration is stored in ~/.news_cli/config.yml and includes:

  • OpenAI API settings
  • News source configurations
  • User preferences (liked/disliked topics)

Contributing

  1. Write tests for new features
  2. Update documentation
  3. Follow the Ruby style guide
  4. Create a pull request

License

MIT License

About

Testing VSCode Copilot in agent mode, implementing a CLI utility to fetch, parse and summarize news

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages