Skip to content

Bundle: Start accepting --url/ABOUT_OUTLINE_URL option#34

Merged
amotl merged 2 commits intomainfrom
relax-tests
May 15, 2025
Merged

Bundle: Start accepting --url/ABOUT_OUTLINE_URL option#34
amotl merged 2 commits intomainfrom
relax-tests

Conversation

@amotl
Copy link
Member

@amotl amotl commented May 15, 2025

The --url option was missing with the bundle subcommand yet. Now that it exists, it can be used to relax testing by not using the production outline file, no longer causing sporadic timeout errors.

amotl added 2 commits May 15, 2025 21:20
... to specify alternative input outline file.

Along the lines, also relax testing by not using the production outline
file.
@coderabbitai
Copy link

coderabbitai bot commented May 15, 2025

Walkthrough

The changes introduce and document a new --url option and ABOUT_OUTLINE_URL environment variable for the bundle command, allowing specification of an alternative outline file. The CLI option handling is refactored for consistency, and the handling of the --format option is tightened. Tests and documentation are updated accordingly.

Changes

File(s) Change Summary
CHANGES.md, README.md Updated documentation to describe the new --url option, environment variable, and clarified usage of the bundle command.
src/cratedb_about/cli.py Refactored CLI to use a reusable outline_url_option decorator for the --url option; updated bundle command to require a --format argument (now only allowing "llm"), and to accept and pass the outline URL.
src/cratedb_about/bundle/llmstxt.py Updated LllmsTxtBuilder to include an outline_url attribute and to use it when loading the outline. Improved log messages for clarity.
tests/test_cli.py Enhanced and added tests to enforce the new mandatory --format option, test the new outline URL handling, and improve error message assertions.
tests/test_outline.py, tests/assets/outline.yaml Updated test outline and assertions to match new content ("Example Domain" instead of "Testing README").

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant LllmsTxtBuilder
    participant CrateDbKnowledgeOutline

    User->>CLI: cratedb-about bundle --url <outline> --format llm --outdir <dir>
    CLI->>LllmsTxtBuilder: Instantiate with outline_url, outdir, etc.
    LllmsTxtBuilder->>CrateDbKnowledgeOutline: load(outline_url)
    CrateDbKnowledgeOutline-->>LllmsTxtBuilder: Returns outline data
    LllmsTxtBuilder->>LllmsTxtBuilder: Process and bundle files
    LllmsTxtBuilder-->>User: Bundle created in output directory
Loading

Possibly related PRs

  • crate/about#21: Adds --url option to the outline command, similar to this PR's addition for the bundle command.
  • crate/about#15: Introduces the cratedb-outline.yaml and new CLI/API for outline access, related to this PR's outline loading enhancements.

Suggested reviewers

  • kneth
  • bmunkholm

Poem

A bundle command now takes a path,
With --url or env, it finds its math.
The outline loads from near or far,
And formats now are what they are.
Tests and docs keep pace in stride—
A happy hop for code, with pride! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9286056 and 002a776.

📒 Files selected for processing (7)
  • CHANGES.md (1 hunks)
  • README.md (1 hunks)
  • src/cratedb_about/bundle/llmstxt.py (2 hunks)
  • src/cratedb_about/cli.py (3 hunks)
  • tests/assets/outline.yaml (1 hunks)
  • tests/test_cli.py (5 hunks)
  • tests/test_outline.py (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/cratedb_about/cli.py (1)
src/cratedb_about/bundle/llmstxt.py (1)
  • LllmsTxtBuilder (14-40)
🔇 Additional comments (18)
tests/assets/outline.yaml (1)

26-28: Good job updating the test data for consistency!

The changes to the outline test data from "Testing README" to "Example Domain" align well with the corresponding test updates in the test_outline.py file.

tests/test_outline.py (2)

109-109: LGTM - Test assertion updated to match new test data

The assertion correctly tests for "Example Domain" which matches the updated outline test data.


125-125: LGTM - Test assertion updated correctly

This assertion update is consistent with the changes made to the test data in outline.yaml.

CHANGES.md (1)

17-19: Well-documented changes in changelog

Great job documenting both the new --url/ABOUT_OUTLINE_URL option and the improved handling of the --format option in the changelog. This provides users with clear information about the new functionality.

src/cratedb_about/bundle/llmstxt.py (3)

19-19: New outline_url parameter added correctly

The addition of the outline_url parameter to the LllmsTxtBuilder dataclass enables the functionality described in the PR objectives.


23-23: Improved logging message

The updated log message is more descriptive and provides better information about the bundling process.


38-38: Properly implementing the outline_url parameter

The implementation correctly passes the outline_url attribute to CrateDbKnowledgeOutline.load(), which enables loading the outline from a specified URL instead of the default.

README.md (1)

156-161: Great addition of the --url option documentation!

The documentation update clearly explains how to use the new --url option for specifying an alternative input file, along with the environment variable alternative. The command example has also been updated to reflect the required --format=llm parameter.

src/cratedb_about/cli.py (5)

16-24: Well-structured reusable option decorator

Good refactoring to extract the --url option into a reusable decorator that can be applied to multiple commands. This follows the DRY principle and ensures consistent behavior across commands.


73-73: Appropriate application of the url option to bundle command

The outline_url_option decorator is correctly applied to the bundle command, implementing the PR objective of allowing URL specification for this command.


75-81: Format option is now properly restricted

The --format option has been tightened to only accept "llm" and made required, which improves the API clarity and ensures correct usage.


84-84: Bundle function signature updated to accept url parameter

The function signature properly includes the url parameter that comes from the outline_url_option decorator.


88-90: Consistent implementation of format validation and URL passing

The format validation logic has been updated to check for "llm", and the outline_url parameter is correctly passed to the LllmsTxtBuilder constructor. This ensures the URL option is properly propagated through the code flow.

tests/test_cli.py (5)

48-56: Test updated to verify URL option functionality

The test has been renamed more descriptively and updated to pass the required format parameter and the ABOUT_OUTLINE_URL environment variable. This ensures the new functionality is properly tested.


61-61: Log assertion updated to match implementation

The log assertion has been updated to expect the correct message, ensuring the test accurately verifies the logging behavior.


75-75: Format parameter added to outdir test

The required format parameter has been added to the outdir test, maintaining test consistency with the CLI changes.


85-99: Comprehensive test for missing format parameter

Good addition of a test case for when the required --format option is missing. This ensures proper error handling and user feedback when the command is used incorrectly.


114-114: Updated error message assertion

The error message assertion has been updated to match the new CLI error output format, ensuring the test accurately verifies error handling behavior.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@amotl amotl requested review from bmunkholm and kneth May 15, 2025 19:22
@amotl amotl marked this pull request as ready for review May 15, 2025 19:28
@amotl amotl merged commit 759ab11 into main May 15, 2025
6 checks passed
@amotl amotl deleted the relax-tests branch May 15, 2025 19:28
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.

1 participant