Outline: Add to_llms_txt API method and --format=llms-txt CLI option#23
Outline: Add to_llms_txt API method and --format=llms-txt CLI option#23
to_llms_txt API method and --format=llms-txt CLI option#23Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThe changes introduce a new "llms-txt" output format for the Outline component, adding corresponding API and CLI options. Documentation and usage examples are updated to reflect the new format. Minor link and formatting corrections are made, and a new backlog item is added regarding future CLI subcommand naming. The build process for Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant OutlineDocument
participant llms_txt
User->>CLI: cratedb-about outline --format=llms-txt [--optional]
CLI->>OutlineDocument: to_llms_txt(optional)
OutlineDocument->>OutlineDocument: to_markdown()
OutlineDocument->>llms_txt: create_ctx(markdown, optional)
llms_txt-->>OutlineDocument: context object
OutlineDocument-->>CLI: context as string
CLI-->>User: Output llms-txt format
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (10)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
CHANGES.md(1 hunks)README.md(5 hunks)docs/backlog.md(1 hunks)src/cratedb_about/cli.py(2 hunks)src/cratedb_about/outline/cratedb-outline.yaml(1 hunks)src/cratedb_about/outline/model.py(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/cratedb_about/cli.py (1)
src/cratedb_about/outline/model.py (1)
to_llms_txt(73-76)
🪛 LanguageTool
CHANGES.md
[uncategorized] ~7-~7: You might be missing the article “the” here.
Context: ... environment variable. - Outline: Added to_llms_txt API method and `--format=ll...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
🪛 GitHub Check: codecov/patch
src/cratedb_about/outline/model.py
[warning] 74-76: src/cratedb_about/outline/model.py#L74-L76
Added lines #L74 - L76 were not covered by tests
src/cratedb_about/cli.py
[warning] 64-65: src/cratedb_about/cli.py#L64-L65
Added lines #L64 - L65 were not covered by tests
🔇 Additional comments (16)
src/cratedb_about/outline/model.py (1)
6-6: LGTM! Import added for the new functionality.The new import of
create_ctxfromllms_txtis necessary for the added conversion functionality.src/cratedb_about/cli.py (5)
34-40: LGTM! Format option updated to include the new format.The format option has been correctly updated to include the new "llms-txt" format.
41-46: LGTM! New option added for controlling optional sections.The new
--optionalflag has been added with a clear description of its purpose for the llms-txt format.
47-51: LGTM! Function signature updated correctly.The function signature has been properly updated to include the new
optionalparameter with a sensible default value ofFalse.
55-55: LGTM! Documentation updated to include the new format.The docstring has been updated to mention the new llms-txt format.
64-65: Add test coverage for the new format handling.The implementation for handling the "llms-txt" format is correct, but static analysis indicates it lacks test coverage.
Please add tests to verify that the CLI correctly handles the new format and optional flag. Consider testing both with and without the optional flag to ensure both code paths are covered.
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 64-65: src/cratedb_about/cli.py#L64-L65
Added lines #L64 - L65 were not covered by testsdocs/backlog.md (1)
14-14: LGTM! Good addition to the backlog.The new backlog item to rename the
buildsubcommand tollms-txt buildis a sensible addition to improve naming consistency, especially now that llms-txt is a formal format option.src/cratedb_about/outline/cratedb-outline.yaml (1)
219-219: LGTM! URL updated to point to the correct README.The URL has been updated to point to the README inside the
appsubdirectory, which is likely more relevant given the context.README.md (8)
36-38: Docs updated for newllms-txtoutput
The example list now correctly references[llms-txt]alongside other formats, reflecting the new output option.
46-46: CLI description includesllms-txtcontext
Theasksubcommand documentation now references the new[llms-txt]context files. This aligns with the added format support.
95-96: Quoted format argument for consistency
The CLI example for Markdown output now wraps the format in quotes, matching other examples.
97-98: Added example forllms-txtformat
The new prose and flag example correctly illustrate how to use--format="llms-txt".
99-100: Shell example forllms-txtoutput
The code block demonstrates generatingllms.txtin the new format.
101-104: Optional flag usage documented
The snippet shows how to include the optional content (--optional), producingllms-full.txt.
137-143: Python API updated withto_llms_txtcalls
Both medium and full usage examples for the newto_llms_txtmethod are correctly shown.
204-204:Details
✅ Verification successful
Verify the
[llms-txt]link target
Please confirm thathttps://llmstxt.org/is the correct and reachable URL for thellms-txtspecification.
🏁 Script executed:
#!/bin/bash # Check that the llms-txt spec URL returns HTTP 200 if ! curl -sSf -o /dev/null https://llmstxt.org/; then echo "ERROR: https://llmstxt.org/ is unreachable or returned a non-2xx status" exit 1 fi echo "Link https://llmstxt.org/ is valid"Length of output: 124
Link [llms-txt] Verified
The URLhttps://llmstxt.org/returns HTTP 200 and is reachable—no changes needed.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
CHANGES.md(1 hunks)README.md(3 hunks)docs/backlog.md(1 hunks)src/cratedb_about/build/llmstxt.py(2 hunks)src/cratedb_about/cli.py(2 hunks)src/cratedb_about/outline/cratedb-outline.yaml(1 hunks)src/cratedb_about/outline/model.py(1 hunks)tests/test_cli.py(1 hunks)tests/test_outline.py(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- tests/test_outline.py
- tests/test_cli.py
- src/cratedb_about/outline/cratedb-outline.yaml
🚧 Files skipped from review as they are similar to previous changes (4)
- docs/backlog.md
- src/cratedb_about/outline/model.py
- CHANGES.md
- README.md
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/cratedb_about/cli.py (1)
src/cratedb_about/outline/model.py (1)
to_llms_txt(72-88)
🪛 GitHub Check: codecov/patch
src/cratedb_about/cli.py
[warning] 64-65: src/cratedb_about/cli.py#L64-L65
Added lines #L64 - L65 were not covered by tests
🔇 Additional comments (8)
src/cratedb_about/build/llmstxt.py (3)
8-9: Import change looks goodThe import of
CrateDbKnowledgeOutlineis necessary for the new approach to directly build llms.txt files without subprocess calls.
35-37: Good TODO comment for future optimizationThe comment correctly identifies potential redundancy in the data processing for the two steps. This is a valid concern for future optimization.
38-40: Clean refactoring to use the API directlyThis is a good refactoring that:
- Eliminates subprocess calls (more efficient and less error-prone)
- Uses the new
to_llms_txt()API method directly- Properly handles both regular and full output variants
The code is now more maintainable and aligns well with the PR objectives.
src/cratedb_about/cli.py (5)
31-32: Fixed help text typoGood correction from "builtin" to "built-in" in the help text.
34-40: Good implementation of the new format optionThe addition of "llms-txt" to the format choices is well-implemented and follows the existing pattern.
41-46: Well-documented optional flagThe new
--optionalflag is properly implemented with clear help text explaining its purpose.
47-51: Function signature updated appropriatelyThe outline function signature has been correctly updated to include the new format option and optional parameter.
55-56: Updated docstring for consistencyThe docstring correctly lists all available output formats, including the new llms-txt format.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
CHANGES.md (1)
7-9: Nitpick: Improve clarity and consistency
Consider adding “the” before “CLI options” and including parentheses to denote the method. You may also merge into a single line for readability.- - Outline: Added `to_llms_txt` API method and CLI options `--format=llms-txt` - and `--optional`, to directly convert/expand the source outline file into - an `llms.txt` file. + - Outline: Added the `to_llms_txt()` API method and the CLI options `--format=llms-txt` and `--optional` to directly convert or expand the source outline file into an `llms.txt` file.🧰 Tools
🪛 LanguageTool
[uncategorized] ~7-~7: You might be missing the article “the” here.
Context: ... environment variable. - Outline: Addedto_llms_txtAPI method and CLI options ...(AI_EN_LECTOR_MISSING_DETERMINER_THE)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
CHANGES.md(1 hunks)README.md(3 hunks)src/cratedb_about/build/llmstxt.py(2 hunks)src/cratedb_about/cli.py(2 hunks)src/cratedb_about/outline/model.py(1 hunks)tests/assets/outline.yaml(1 hunks)tests/test_cli.py(1 hunks)tests/test_outline.py(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- tests/assets/outline.yaml
🚧 Files skipped from review as they are similar to previous changes (6)
- src/cratedb_about/outline/model.py
- README.md
- tests/test_outline.py
- tests/test_cli.py
- src/cratedb_about/build/llmstxt.py
- src/cratedb_about/cli.py
🧰 Additional context used
🪛 LanguageTool
CHANGES.md
[uncategorized] ~7-~7: You might be missing the article “the” here.
Context: ... environment variable. - Outline: Added to_llms_txt API method and CLI options ...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
🔇 Additional comments (1)
CHANGES.md (1)
7-9: Changelog entry accurately documents new API and flags
The entry now correctly includes both theto_llms_txtAPI method and the--format=llms-txtand--optionalCLI options, matching the PR objectives.🧰 Tools
🪛 LanguageTool
[uncategorized] ~7-~7: You might be missing the article “the” here.
Context: ... environment variable. - Outline: Addedto_llms_txtAPI method and CLI options ...(AI_EN_LECTOR_MISSING_DETERMINER_THE)
src/cratedb_about/cli.py
Outdated
| def outline(url: str, format_: t.Literal["markdown", "yaml", "json"] = "markdown") -> None: | ||
| @click.option( | ||
| "--optional", | ||
| "-o", |
There was a problem hiding this comment.
I wonder if -o can viewed as an alias --output. Maybe -O is a better alias for --optional?
There was a problem hiding this comment.
Good point, thanks. I've removed the alias completely per 939b770.
Use this output format to directly convert/expand the source outline file into an `llms.txt` file. It is the same like invoking the `llms_txt2ctx` program manually.
About
Provide a new output option
--format=llms-txtfor thecratedb-about outlinesubcommand to directly convert/expand the source outline file into anllms.txtfile. It is the same like invoking thellms_txt2ctxprogram manually.Along the lines, also provide the same functionality per compact Python API.
Synopsis
CLI
API