Skip to content

feat: some llms.txt improvements #382

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

araujogui
Copy link
Member

@araujogui araujogui commented Jul 31, 2025

Description

Some improvements that I found while working on landing nodejs/node#59264.

  1. Fixed a bug that multi-line paragraphs was joined together without a space between
  2. Add llm_description trimming to remove final line breaks in multi-line descriptions

Validation

npx doc-kit generate -t llms-txt -i doc/api/*.md -o out/

Related Issues

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have check code formatting with node --run format & node --run lint.
  • I've covered new added functionality with unit tests if necessary.

@Copilot Copilot AI review requested due to automatic review settings July 31, 2025 00:00
@araujogui araujogui requested a review from a team as a code owner July 31, 2025 00:00
Copy link

vercel bot commented Jul 31, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
api-docs-tooling ✅ Ready (Inspect) Visit Preview Aug 2, 2025 5:29pm

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves LLM text generation functionality by fixing text formatting issues and standardizing metadata naming conventions.

  • Fixed multi-line paragraph text joining by replacing line breaks with spaces
  • Changed llm_description to camelCase llmDescription throughout the codebase
  • Added trimming for llmDescription values to remove trailing whitespace

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/utils/unist.mjs Fixed line break handling in text transformation to prevent words from being joined without spaces
src/utils/parser/index.mjs Removed llm_description normalization as it's now camelCase
src/utils/parser/tests/index.test.mjs Updated test expectations to use camelCase llmDescription
src/metadata.mjs Changed property name from llm_description to llmDescription
src/linter/rules/missing-metadata.mjs Updated regex constant name to match camelCase convention
src/linter/rules/tests/missing-metadata.test.mjs Updated test cases and comments to use camelCase naming
src/linter/constants.mjs Renamed regex constant and updated error message to use camelCase
src/generators/llms-txt/utils/buildApiDocLink.mjs Changed to use llmDescription and added .trim() call
src/generators/llms-txt/utils/tests/buildApiDocLink.test.mjs Updated test cases to use camelCase property name
src/tests/metadata.test.mjs Updated test assertion to use camelCase property name
Comments suppressed due to low confidence (3)

src/linter/constants.mjs:5

  • The constant name llmDescription_REGEX doesn't follow consistent naming conventions. It should be LLM_DESCRIPTION_REGEX to match the existing INTRODUCED_IN_REGEX pattern.
export const llmDescription_REGEX = /<!--\s?llmDescription:.*-->/;

src/linter/rules/missing-metadata.mjs:9

  • The import name llmDescription_REGEX should be LLM_DESCRIPTION_REGEX to maintain consistency with the existing constant naming pattern.
  llmDescription_REGEX,

src/linter/rules/missing-metadata.mjs:34

  • The reference llmDescription_REGEX should be LLM_DESCRIPTION_REGEX to match the corrected constant name.
    regex: llmDescription_REGEX,

Copy link

codecov bot commented Jul 31, 2025

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 74.28%. Comparing base (9436edd) to head (62acb44).
⚠️ Report is 11 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/utils/unist.mjs 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #382      +/-   ##
==========================================
+ Coverage   70.80%   74.28%   +3.47%     
==========================================
  Files         127      118       -9     
  Lines       11620    11047     -573     
  Branches      694      697       +3     
==========================================
- Hits         8228     8206      -22     
+ Misses       3389     2838     -551     
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@araujogui araujogui changed the title Feat/llms improvements feat: some llms.txt improvements Jul 31, 2025
@araujogui
Copy link
Member Author

@nodejs/web-infra reviews please

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT !!!

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.

4 participants