-
Notifications
You must be signed in to change notification settings - Fork 189
docs: reduce llms.txt size from ~196K to ~84K characters #2470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6ae0861
docs: reduce llms.txt size from ~196K to ~84K characters
marcel-rbro 5047a57
docs: reorder llms.txt sections by importance and fix formatting
marcel-rbro aa09e42
docs: reorder llms.txt sections with Academy and Legal last
marcel-rbro 029b5d2
docs: add intro text with pricing link, clean up curated file
marcel-rbro 44025b0
chore: add llms.txt size check (warn >90K, error >100K)
marcel-rbro 0ce18ce
docs: fix Changelog nesting and missing newlines in llms.txt
marcel-rbro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import fs from 'node:fs/promises'; | ||
| import path from 'node:path'; | ||
|
|
||
| const BUILD_DIR = path.resolve('build'); | ||
| const WARN_LIMIT = 90_000; | ||
| const ERROR_LIMIT = 100_000; | ||
|
|
||
| async function checkFile(filePath) { | ||
| try { | ||
| await fs.access(filePath); | ||
| } catch { | ||
| console.error(`ERROR: ${filePath} does not exist`); | ||
| process.exitCode = 1; | ||
| return null; | ||
| } | ||
| // Use string .length for character count (not byte count) | ||
| const content = await fs.readFile(filePath, 'utf8'); | ||
| return content.length; | ||
| } | ||
|
|
||
| const llmsPath = path.join(BUILD_DIR, 'llms.txt'); | ||
| const llmsFullPath = path.join(BUILD_DIR, 'llms-full.txt'); | ||
|
|
||
| const [llmsChars, llmsFullChars] = await Promise.all([ | ||
| checkFile(llmsPath), | ||
| checkFile(llmsFullPath), | ||
| ]); | ||
|
|
||
| if (llmsChars === null || llmsFullChars === null) { | ||
| process.exit(1); | ||
| } | ||
|
|
||
| console.log(`llms.txt: ${llmsChars.toLocaleString()} characters`); | ||
| console.log(`llms-full.txt: ${llmsFullChars.toLocaleString()} characters`); | ||
|
|
||
| if (llmsChars > ERROR_LIMIT) { | ||
| console.error(`\nERROR: llms.txt exceeds ${ERROR_LIMIT.toLocaleString()} character limit`); | ||
| process.exitCode = 1; | ||
| } else if (llmsChars > WARN_LIMIT) { | ||
| console.warn(`\nWARNING: llms.txt exceeds ${WARN_LIMIT.toLocaleString()} characters — consider reducing`); | ||
| } else { | ||
| console.log(`\nOK (under ${WARN_LIMIT.toLocaleString()} character target)`); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcel-rbro @TC-MO By including the pages here, the markdown variants themselves were removed. (e.g. https://docs.apify.com/sdk.md now returns 404)
I just want to verify if this ok and if it was intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Definitely not okay, all pages need to have their Markdown counterpart (+
.md) working. Can we add integration tests to ensure these pages workThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests are not checking the homepages of the child repos, but the setup is there already:
https://github.com/apify/apify-docs/actions/runs/25109134352/workflow#L67
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could fix it: #2480