Repository navigation
feat(docs): docs llms-txt CLI for the static llms.txt check - #1132
Conversation
…Lightsage-inspired proposal Prototype only, not wired into the CLI: dokimi.opportunities turns novelty, repo_static and llms.txt findings into a ranked impact x effort queue with stable source keys and execution prompts; dokimi.llms_txt statically checks an llms.txt. docs/proposals/lightsage-inspired-features.md maps the competitor's features, ranks the gaps and lists next steps. Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
Inputs are detected by content (novelty JSON, repo_static.v1, llms.txt); --format json writes an opportunities.v1 artifact (new schema + fixture), markdown prints the ranked table. Proposal next steps updated. Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
…s an input error, escape table cells Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
…s by check, links by message Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
…hot uses the Linux type hash Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
…ure-ideas-2aea58 Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com> # Conflicts: # dokimi/docs/reference/cli-interface.json
…b.com/napetrov/dokimi into claude/lightsage-feature-ideas-2aea58
…tput; user docs page Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
Runs dokimi.llms_txt.check on a file or a directory holding llms.txt, prints a row per finding or cli_output.v1 with --json, and exits 1 when a fail finding exists. --token-budget sets the size ceiling (allowlisted: tokens' --token-budgets means fractions). Adds a feature card under 'Will the agent use it?', a guide page, a changelog fragment and tests. Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
…de wording Drop the extra brace the hand-spliced snapshot hunk added; register --token-budget in the tokens concept instead of the allowlist; say that report opportunities takes the file and checks at the default budget. Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
CLI interface change detectedThis PR changes dokimi's user-facing CLI surface (commands and/or options): + added command `dokimi docs llms-txt`
+ argument `path`
+ option `--help/-h`
+ option `--json`
+ option `--token-budget`Updated on every push; the |
|
OpenCodeReview: Commit 06cdc08 was not reviewed. This PR has reached its review limit (6 reviews). CI at `06cdc08`: 8 still running, 20 passing, 4 skipped
To review this commit: re-request review from exai-bot in the Reviewers list. Last review (212c176): 2 mediumOpen threads from the bot: 1 |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1132 +/- ##
==========================================
- Coverage 96.21% 96.21% -0.01%
==========================================
Files 502 503 +1
Lines 67062 67250 +188
Branches 11645 11678 +33
==========================================
+ Hits 64524 64704 +180
- Misses 1565 1568 +3
- Partials 973 978 +5
🚀 New features to boost your workflow:
|
Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
🟡 Changes needed · reviewed 6134334
To fix: a valid llms.txt saved with a BOM fails the new gate (line comment). Also answer the @exai-bot threads below. This branch carries #1082 at an older head (dcf5ad5), so it should merge after #1082, rebased on it.
✅ make ci-local --offline: 25,987 passed · ✅ Windows (Server 2025, Python 3.13): tests/test_llms_txt_command.py, tests/test_llms_txt.py 14 passed · ✅ strict docs build with the new nav entry
The CLI fits the docs group well: input errors exit 2, a fail exits 1 and --json gives a valid cli_output.v1.
Agreed with @exai-bot on the checker's false verdicts (indented headings, titled links and images, empty >, and 2 more) and on the report opportunities input handling and novelty rates; those fixes belong in #1082.
PRRT_kwDOVBg7g866cEp6 PRRT_kwDOVBg7g866cEp9 PRRT_kwDOVBg7g866cEqA PRRT_kwDOVBg7g866cEqE PRRT_kwDOVBg7g866cEqH PRRT_kwDOVBg7g866cEqK PRRT_kwDOVBg7g866cEqM PRRT_kwDOVBg7g866cEqO PRRT_kwDOVBg7g866cEqQ PRRT_kwDOVBg7g866cLbk PRRT_kwDOVBg7g866cLbr PRRT_kwDOVBg7g866cLb0 PRRT_kwDOVBg7g866cLb9 PRRT_kwDOVBg7g866eKTw PRRT_kwDOVBg7g866eKTz PRRT_kwDOVBg7g866eKT0 PRRT_kwDOVBg7g866eKT1 PRRT_kwDOVBg7g866fpza PRRT_kwDOVBg7g866x5qy PRRT_kwDOVBg7g866x5q2 PRRT_kwDOVBg7g866x5q5 PRRT_kwDOVBg7g866x5q6 PRRT_kwDOVBg7g866x5q9 Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
PRRT_kwDOVBg7g866oHaY PRRT_kwDOVBg7g866oHaZ PRRT_kwDOVBg7g866oHaa PRRT_kwDOVBg7g866oHab PRRT_kwDOVBg7g866oHad PRRT_kwDOVBg7g866oHah PRRT_kwDOVBg7g866oHak PRRT_kwDOVBg7g866oHap PRRT_kwDOVBg7g866oHat PRRT_kwDOVBg7g866oHaw PRRT_kwDOVBg7g866oHaz PRRT_kwDOVBg7g866x7iN PRRT_kwDOVBg7g866x7iP Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
db1c03f accepts a UTF-8 BOM on an llms.txt index and covers that input in the gate regression tests. |
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g867yZ_n Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g867yZ_v Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRR_kwDOVBg7g88AAAABaNZe2w Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
|
Re: review by vlad-perevezentsev
|
|
vchamarthi
left a comment
There was a problem hiding this comment.
@napetrov, could you fix the 2 new problems I found and the 2 small things I've marked fix before merge (in the line comments) and answer my question below? Then push and I'll take another look.
My question before I approve:
- An autolink such as
<https://acme.test/quickstart.md>is not counted as a link, so an index whose only link is an autolink fails the links check with exit 1. State indocs/llms-txt.mdthat autolinks are not counted, or count them in the check.
What I checked on a8bc54e:
- When I broke the changed code on purpose, the tests missed 1 of 12 breakages.
- The 65 changed tests pass, and fail on main as expected.
- The full test suite passes with main merged in (30,993 tests), apart from failures main has too.
- It merges cleanly onto main.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868Oxqy Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868Oxq1 Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868Oxq_ Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868OxrF Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRR_kwDOVBg7g88AAAABab4Tqw Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
|
The inline fixes cover indented examples, unreadable paths, raw HTML and paragraph links. The guide spells out the autolink rule. |
vchamarthi
left a comment
There was a problem hiding this comment.
@napetrov, could you fix the small thing I've marked fix before merge (in the line comments)? I'll approve once that's done.
What I checked on 6cf158d: the 71 changed tests pass, and fail on main as expected; the full test suite passes with main merged in (31,323 tests), apart from failures main has too; it merges cleanly onto main; when I changed the code on purpose, the tests caught all 12 changes.
| links, code_lines = _structure_lines(visible, keep_code=True) | ||
| found = _title_findings(lines) + _section_findings(lines) + _link_findings("\n".join(links), code_lines) | ||
| tokens = estimate_tokens(text) | ||
| if tokens > token_budget: |
There was a problem hiding this comment.
Fix before merge (blocking): A file of exactly --token-budget tokens gets a size warning, and no test checks that size, so changing > to >= passes every test.
Suggestion: Add a case where --token-budget equals the estimate of a short file and check that there is no size row.
I tested this patch: it fixes the problem, and the tests still pass.
Patch
--- a/dokimi/tests/test_llms_txt.py
+++ b/dokimi/tests/test_llms_txt.py
@@ -62,6 +62,11 @@
def test_size_over_budget_is_flagged():
assert "size" in _checks(GOOD + "x" * 9000) - _checks(GOOD)
assert "size" not in {f.check for f in llms_txt.check(GOOD + "x" * 9000, token_budget=10_000)}
+
+
+def test_size_at_exactly_the_budget_is_not_flagged():
+ budget = llms_txt.estimate_tokens(GOOD)
+ assert "size" not in {f.check for f in llms_txt.check(GOOD, token_budget=budget)}
def test_fenced_examples_and_images_do_not_supply_document_structure():Details
If I change if tokens > token_budget: to if tokens >= token_budget:, the tests in tests/test_llms_txt.py and tests/test_llms_txt_command.py still pass. A file of exactly the budget then gets a size warning, though docs/llms-txt.md says the limit is "at most" --token-budget tokens. test_size_over_budget_is_flagged uses a budget of 10,000 and never lands on the boundary.
…of the file An inline `<!--` with no `-->` after it is literal text in CommonMark, but the checker treated it as a comment to the end of the file and failed a valid index. It now opens a comment only when a `-->` follows or when it starts an HTML block. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
Each closing fence searched for the next code span again, walking every later backtick run, so an index with 2000 fenced examples took seconds. The inline scanner now reuses its last search when the next query comes before its result. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
… the budget edge A non-UTF-8 llms.txt must exit 2 without a traceback, the --json data.tokens and summary.warn must match the findings, and a file of exactly --token-budget tokens must not get a size warning. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
|
| p.add_argument("path", metavar="PATH", help="an llms.txt file, or a directory with llms.txt at its top") | ||
| cli_flags.add(p, "tokens", "--token-budget", type=positive_int, default=llms_txt.TOKEN_BUDGET, metavar="N", | ||
| help=f"Warn when the file is over ~N tokens (default {llms_txt.TOKEN_BUDGET})") | ||
| cli_flags.add(p, "output", "--json", action="store_true", |
There was a problem hiding this comment.
CI check Tests (py3.14) fails: Registering docs llms-txt with --json adds a leaf that is absent from both next-step classification sets. The contract test requires every JSON leaf to belong to exactly one set; the needed inventory definitions are not present in the file version available through the tools, so an exact replacement cannot safely be supplied.
Evidence: tests/test_cli_output.py::test_every_json_leaf_gives_a_next_step_or_none_by_design: Extra items in the left set: ('docs', 'llms-txt')
Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
The leaf prints next: [] by design; the intel#941 inventory test needs it in one set. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
|
xaleryb
left a comment
There was a problem hiding this comment.
Approved on 06cdc08. docs llms-txt checks the repository's llms.txt and prints next: []; we merged main, listed the leaf in LEAVES_WITHOUT_NEXT_BY_DESIGN, and our earlier commits fix a stray <!-- hiding the rest of the file, the quadratic scan over fenced examples and the exact-budget edge (both open threads). Full suite and gates are green on the merged tree. Windows smoke had not started (the hosted Windows queue was stuck); every other check passed.
Scope: This PR adds the static checker and its CLI directly against
main. #1082 owns the separate report command. This PR can land independently.Adds
dokimi docs llms-txt <path-or-file> [--json] [--token-budget N], the CLI over the static llms.txt check (dokimi.llms_txt.check).llms.txtat the top of that directory. It makes no network or model call.severity, check, file:line, message, fix), then a verdict line.--json: printscli_output.v1with kinddocs llms-txtand verdictpass/fail. The findings go underdataand also as the subject'sfindings. Tested against the schema.failfinding exists, 0 when there are only warnings, 2 when the input is missing or unreadable.--token-budgetis a new canonical spelling in thetokensconcept: an integer ceiling. It is distinct from--token-budgets, which takes fractions.LEAVESroute, registration under thedocsgroup (commands/run.py), and thecli-interface.jsonhunk for the new leaf only.docs/llms-txt.md, a documentation-index entry and a changelog fragment.The checker accepts labeled inline and reference-style Markdown links. Bare autolinks do not satisfy the link check. It skips fenced and indented code examples and HTML comments, including code spans that cross a soft line break. It reports physical line numbers. Link warnings retain code-formatted labels and inline destinations as written so existing opportunity keys stay stable.
The Markdown parser is a direct runtime dependency. The Intel CI lock re-solve retained every existing package artifact.