Skip to content

fix(skill): 使用 gray-matter 包解析 md 的元信息#328

Merged
zzcr merged 17 commits intodevfrom
shen/skill-just-bash
Feb 14, 2026
Merged

fix(skill): 使用 gray-matter 包解析 md 的元信息#328
zzcr merged 17 commits intodevfrom
shen/skill-just-bash

Conversation

@shenjunjian
Copy link
Collaborator

@shenjunjian shenjunjian commented Feb 13, 2026

Pull Request (OpenTiny NEXT-SDKs)

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build-related changes
  • CI-related changes
  • Documentation-related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Documentation

    • Updated formatting in the Tiny Robot Remoter guide.
  • Improvements

    • Optimized internal skill data processing logic.

@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

Warning

Rate limit exceeded

@shenjunjian has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 4 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

These changes add the gray-matter-browser dependency to parse YAML front matter from content and refactor the SDK's skill utilities to use it instead of regex-based extraction. Additionally, minor formatting improvements are applied to a documentation file and a composable function.

Changes

Cohort / File(s) Summary
Documentation & Composable Formatting
docs/guide/tiny-robot-remoter.md, packages/next-remoter/src/composable/useSkill.ts
Markdown table header alignment and ternary expression simplification; no functional changes.
Dependency & Skill Utilities Refactoring
packages/next-sdk/package.json, packages/next-sdk/skills/index.ts
Added gray-matter-browser dependency (4.0.4); replaced regex-based YAML front matter extraction with gray-matter library parsing. Updated parseSkillFrontMatter and createSkillTools execute function signature from object parameter to destructured parameters.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 With matter gray, we parse with glee,
Front matter flows more elegantly free,
Regex fades to libraries bright,
Code simplifies—ternary's tight,
A hop, a skip, refactoring's done!

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: using gray-matter package to parse YAML front matter from markdown files, which is reflected in all modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into dev

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch shen/skill-just-bash

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.

@shenjunjian shenjunjian changed the title Shen/skill just bash fix(skill): 使用 gray-matter 包解析 md 的元信息 Feb 13, 2026
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: 2

🤖 Fix all issues with AI agents
In `@packages/next-sdk/package.json`:
- Around line 52-53: The package.json entry incorrectly names the dependency
"grey-matter-browser" (British spelling) while the code imports
"gray-matter-browser" in packages/next-sdk/skills/index.ts; update the
dependency name in package.json to "gray-matter-browser" so it matches the
import and the actual npm package, then run install to verify the module
resolves.

In `@packages/next-sdk/skills/index.ts`:
- Around line 27-32: parseSkillFrontMatter currently returns
matter(content).data which can be an empty object (truthy) so callers like
getSkillOverviews won't skip it; change parseSkillFrontMatter to validate that
data.name and data.description exist and are strings (and not empty) and return
null otherwise, ensuring the function only returns { name: string; description:
string } when both fields are present; update the function's runtime checks to
coerce/validate types from matter(content).data (e.g., check typeof data.name
=== 'string' && data.name.trim() !== ''), and keep returning null for
missing/invalid frontmatter so downstream logic (getSkillOverviews) behaves
correctly.
🧹 Nitpick comments (1)
packages/next-sdk/skills/index.ts (1)

24-26: Stale comment: still references regex extraction, but implementation now uses gray-matter-browser.

-/**
- * 从主 SKILL.md 的 YAML front matter 中用正则提取 name、description
- */
+/**
+ * 从主 SKILL.md 的 YAML front matter 中提取 name、description
+ */

zzcr
zzcr previously approved these changes Feb 13, 2026
@zzcr zzcr merged commit 2688364 into dev Feb 14, 2026
2 checks passed
zzcr added a commit that referenced this pull request Feb 14, 2026
zzcr added a commit that referenced this pull request Feb 14, 2026
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

Comments