Skip to content

Conversation

adrianschmidt
Copy link
Contributor

@adrianschmidt adrianschmidt commented Oct 12, 2025

Summary by CodeRabbit

  • New Features

    • Automated generation of Context7-compatible component documentation with index and metadata; Context7 project config included.
    • Added an npm script to produce the Context7 markdown output.
  • Documentation

    • Added component READMEs, guides (contributing, events, theming), quick start, design guidelines, and resources; README updated with an "AI-Friendly Documentation" section.
  • Chores

    • Integrated docs generation into the publish pipeline with error handling and copying of versioned markdown artifacts.

Review:

  • Commits are atomic
  • Commits have the correct type for the changes made
  • Commits with breaking changes are marked as such

Browsers tested:

(Check any that applies, it's ok to leave boxes unchecked if testing something didn't seem relevant.)

Windows:

  • Chrome
  • Edge
  • Firefox

Linux:

  • Chrome
  • Firefox

macOS:

  • Chrome
  • Firefox
  • Safari

Mobile:

  • Chrome on Android
  • iOS

Copy link

coderabbitai bot commented Oct 12, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

Adds Context7 documentation support: new Context7 JSON config, a Stencil docs config, a script to generate markdown READMEs/INDEX/META, an npm script to run it, and integration into the publish pipeline to run and copy the generated markdown into the release docs output.

Changes

Cohort / File(s) Summary of Changes
Context7 project config
context7.json
Adds Context7 project configuration with metadata, folder mappings, exclusions, and usage rules for Lime Elements.
Docs generator script
generate-context7-docs.cjs
New script that runs a Stencil docs build, assembles guides, creates INDEX.md and META.json, writes output to www/markdown-docs, and supports a dry-run mode and error handling.
Stencil docs config
stencil.config.context7.ts
New Stencil config exporting config: Config that outputs docs-readme into www/markdown-docs, includes SASS, nodeResolve, and a docs-specific tsconfig and global style.
Publish flow integration
publish-docs.cjs
Calls the new docs generator during build; on success copies www/markdown-docs into docsDist/versions/${version}/; adds failure branches and teardown on errors.
NPM scripts
package.json
Adds "docs:context7": "node generate-context7-docs.cjs" to scripts.
README updates
README.md
Inserts an "AI-Friendly Documentation" section (twice) describing Context7-compatible markdown and links to generated docs and guidelines.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer/CI
  participant PD as publish-docs.cjs
  participant Stencil as Stencil Build
  participant Gen as generate-context7-docs.cjs
  participant FS as Filesystem

  Dev->>PD: Run publish-docs
  PD->>Stencil: Build site/docs
  alt Stencil build fails
    PD-->>Dev: Exit non-zero (teardown)
  else Build succeeds
    PD->>Gen: npm run docs:context7
    alt Context7 gen fails
      PD-->>Dev: Exit non-zero (teardown)
    else Generation succeeds
      Gen->>FS: Write www/markdown-docs (READMEs, INDEX.md, META.json)
      PD->>FS: Copy www/markdown-docs -> docsDist/versions/{version}
      PD-->>Dev: Success
    end
  end
Loading
sequenceDiagram
  autonumber
  actor CI as CI/DX
  participant Gen as generate-context7-docs.cjs
  participant Stencil as Stencil (context7 config)
  participant FS as Filesystem
  Note over Gen,Stencil: High-level doc generation flow

  CI->>Gen: Execute
  Gen->>Stencil: Build components (docs-readme)
  alt Build error
    Gen-->>CI: Exit with error
  else Build ok
    Gen->>FS: Ensure guides dir
    Gen->>FS: Copy root docs (`README.md`, `CONTRIBUTING.md`)
    Gen->>FS: Copy src guides (`src/contributing.md`, `src/events.md`, `src/theming.md`)
    Gen->>FS: Generate `INDEX.md` (version, components table, links)
    Gen->>FS: Generate `META.json` (counts, timestamp)
    Gen-->>CI: Done
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

docs

Suggested reviewers

  • jgroth
  • Kiarokh

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly states the primary change of the PR—adding Context7-compatible documentation—and the parenthetical note emphasizes the AI-readable aspect without introducing unrelated details. It is concise, specific, and directly reflects the main additions in the changeset.

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Add configuration to generate component API documentation in
markdown format using Stencil's docs-readme output target.
These markdown files will be published to gh-pages to make
component documentation available for LLM-based tools and
documentation indexers.
Copy link

Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-3703/

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
publish-docs.cjs (3)

356-358: Fix commit message when pruning old patch versions

It uses argv.remove (undefined here), producing “remove undefined”.

Apply this diff:

-        if (runCommit) {
-            commit(`chore(docs): remove ${argv.remove}`);
-        }
+        if (runCommit) {
+            commit(`chore(docs): remove old patch version ${item}`);
+        }

122-124: Avoid exposing GH_TOKEN in command line/logs

Cloning with token in URL risks leakage in logs/process args. At minimum, silence exec output; ideally use a safer auth mechanism.

Apply this minimal mitigation:

 function cloneDocsRepo() {
   if (!shell.which('git')) {
     shell.echo('Sorry, this script requires git');
     shell.exit(1);
   }
 
+  const prevSilent = shell.config.silent;
+  shell.config.silent = true;
   if (
     shell.exec(
       'git clone --single-branch --branch gh-pages https://[email protected]/Lundalogik/lime-elements.git docsDist'
     ).code !== 0
   ) {
     shell.echo('git clone failed!');
     teardown();
     shell.exit(1);
   }
+  shell.config.silent = prevSilent;
 }

Longer‑term: use GitHub Actions checkout with a separate workspace/folder, or gh auth/credential helpers to avoid embedding the token in the command.


452-453: Use shelljs rm for cross‑platform cleanup

shell.exec('rm -rf …') breaks on Windows; use shell.rm.

Apply this diff:

   shell.exec('git checkout src/index.html stencil.config.docs.ts');
   shell.echo('Removing docs repo clone in docsDist.');
-  shell.exec('rm -rf docsDist');
+  shell.rm('-rf', 'docsDist');
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d72fa7 and 17aac5e.

📒 Files selected for processing (5)
  • context7.json (1 hunks)
  • generate-context7-docs.cjs (1 hunks)
  • package.json (1 hunks)
  • publish-docs.cjs (2 hunks)
  • stencil.config.context7.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

**/*.{ts,tsx}: Imports from other files in the same module (lime-elements) must use relative paths. Using absolute paths for imports will cause the production build to fail.

Files:

  • stencil.config.context7.ts
🧠 Learnings (1)
📚 Learning: 2025-04-25T14:23:56.018Z
Learnt from: Kiarokh
PR: Lundalogik/lime-elements#3529
File: src/components/lime-ai-avatar/lime-ai-avatar.scss:1-3
Timestamp: 2025-04-25T14:23:56.018Z
Learning: In the lime-elements repository, CSS custom properties prefixed with `--lime-` are considered internal implementation details and should not be documented in JSDoc comments, while other custom properties should be documented as they are part of the public API.

Applied to files:

  • context7.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Docs / Publish Docs
  • GitHub Check: Test
  • GitHub Check: Build
🔇 Additional comments (5)
package.json (1)

26-26: Add docs generator script — looks good

Script wiring is correct and consistent with the new generator.

context7.json (1)

5-11: Confirm scope of indexed docs (only latest)

Config indexes versions/latest/markdown-docs only. If you intend Context7 to index all released versions, broaden the folder pattern; otherwise, this is fine.

publish-docs.cjs (2)

193-197: Run Context7 docs after build — good sequencing

Fail‑fast handling and teardown on error are correct.


240-248: Copying markdown docs into versioned path — good

Matches generator output path and deploy layout.

stencil.config.context7.ts (1)

10-25: Stencil Context7 docs config — LGTM

Output target, paths, and plugins look correct for docs‑readme generation.

@adrianschmidt adrianschmidt force-pushed the add-context7-compatible-docs branch 2 times, most recently from 1bb35aa to 0f9ee67 Compare October 12, 2025 21:56
@adrianschmidt adrianschmidt force-pushed the add-context7-compatible-docs branch from b36b1ac to 0282c26 Compare October 12, 2025 22:19
Create a Node.js script that generates Context7-compatible
markdown documentation by:
- Running Stencil build with context7 config
- Copying root documentation files (README, CONTRIBUTING)
- Copying guide files (contributing, events, theming)
- Generating an INDEX.md file with component catalog
- Creating META.json with version and file counts

Add npm script docs:context7 to run the generation process.
The generated documentation will be published to gh-pages
to enable LLM-based documentation indexing.
Update publish-docs.cjs to generate and publish markdown
documentation alongside Kompendium docs:
- Run npm run docs:context7 after docs:build
- Copy www/markdown-docs to docsDist/versions/{version}/

The markdown documentation will now be published to gh-pages
at /versions/{version}/markdown-docs/ for each release,
making it available for Context7 and other LLM-based
documentation indexers.
Add context7.json to configure Context7 to index documentation
from the gh-pages branch at versions/latest/markdown-docs/.

Configuration includes:
- Branch targeting: gh-pages (where docs are published)
- Folder specification: versions/latest/markdown-docs
- Exclusions: build artifacts, assets, and styles
- 14 usage rules covering web component patterns, installation,
  TypeScript support, theming, and common gotchas

This enables LLM-based tools to access accurate, version-specific
documentation for Lime Elements components.
@adrianschmidt adrianschmidt force-pushed the add-context7-compatible-docs branch from 0282c26 to 51db095 Compare October 12, 2025 22:38
@adrianschmidt adrianschmidt changed the title Add context7 compatible docs Add Context7 compatible docs (AI-readable docs) Oct 13, 2025
@adrianschmidt
Copy link
Contributor Author

@coderabbitai review

Copy link

coderabbitai bot commented Oct 13, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@adrianschmidt adrianschmidt self-assigned this Oct 13, 2025
@civing civing self-assigned this Oct 14, 2025
Copy link
Contributor

@civing civing left a comment

Choose a reason for hiding this comment

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

Great! Love it. 🥳
I must admit to not reading it thoroughly. Giving an approve nevertheless.

@civing civing enabled auto-merge (rebase) October 15, 2025 16:10
@civing civing merged commit 5d6a54d into main Oct 15, 2025
11 checks passed
@civing civing deleted the add-context7-compatible-docs branch October 15, 2025 16:13
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.

2 participants