Skip to content

refactor(skill): remove snakeyaml dependency with lightweight YAML parser#524

Merged
AlbumenJ merged 3 commits intoagentscope-ai:mainfrom
fang-tech:fang-tech/refactor(skill)--replace-snakeyaml-by-internal-impl
Jan 14, 2026
Merged

refactor(skill): remove snakeyaml dependency with lightweight YAML parser#524
AlbumenJ merged 3 commits intoagentscope-ai:mainfrom
fang-tech:fang-tech/refactor(skill)--replace-snakeyaml-by-internal-impl

Conversation

@fang-tech
Copy link
Contributor

AgentScope-Java Version

1.0.7-SNAPSHOT

Description

Summary

Remove the snakeyaml dependency by implementing a lightweight YAML parser for frontmatter parsing.

Changes

  • MarkdownSkillParser: Add SimpleYamlParser inner class supporting:

    • Simple key: value format parsing
    • Single/double quoted string values
    • Comment lines (#) skipping
    • Escape sequence handling
  • Type Change: Map<String, Object>Map<String, String> for metadata

  • Updated Files:

    • MarkdownSkillParser.java
    • SkillUtil.java
    • FileSystemSkillRepository.java
    • MarkdownSkillParserTest.java
  • Removed: snakeyaml dependency from agentscope-core/pom.xml

Breaking Changes

  • Nested YAML structures no longer supported (only flat key-value pairs)
  • ParsedMarkdown.getMetadata() returns Map<String, String> instead of Map<String, Object>

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

- Add SimpleYamlParser as inner class in MarkdownSkillParser
- Support simple key: value format with quoted string handling
- Change metadata type from Map<String, Object> to Map<String, String>
- Update SkillUtil and FileSystemSkillRepository accordingly
- Remove nested YAML structure tests (no longer supported)
Copy link
Contributor

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 removes the snakeyaml dependency by implementing a lightweight custom YAML parser (SimpleYamlParser) for parsing frontmatter in markdown skill files. The change simplifies the dependency footprint and restricts YAML support to flat key-value pairs with string values only.

Changes:

  • Implemented SimpleYamlParser inner class with support for simple key-value parsing, quoted strings, escape sequences, and comment handling
  • Changed metadata type from Map<String, Object> to Map<String, String> throughout the codebase
  • Removed snakeyaml dependency from agentscope-core/pom.xml

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
agentscope-core/pom.xml Removed snakeyaml dependency
agentscope-core/src/main/java/io/agentscope/core/skill/util/MarkdownSkillParser.java Added SimpleYamlParser inner class with parsing/generation methods; updated ParsedMarkdown to use Map<String, String>
agentscope-core/src/main/java/io/agentscope/core/skill/util/SkillUtil.java Simplified metadata handling due to type change from Map<String, Object> to Map<String, String>
agentscope-core/src/main/java/io/agentscope/core/skill/repository/FileSystemSkillRepository.java Updated metadata map type declaration
agentscope-core/src/test/java/io/agentscope/core/skill/util/MarkdownSkillParserTest.java Removed nested YAML tests; added tests for quoted values, comments, and values with colons; updated test assertions for new type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Jan 12, 2026

Codecov Report

❌ Patch coverage is 76.57658% with 26 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...gentscope/core/skill/util/MarkdownSkillParser.java 75.23% 12 Missing and 14 partials ⚠️

📢 Thoughts on this report? Let us know!

@AlbumenJ AlbumenJ merged commit 1a8c6e2 into agentscope-ai:main Jan 14, 2026
4 checks passed
@fang-tech fang-tech deleted the fang-tech/refactor(skill)--replace-snakeyaml-by-internal-impl branch January 23, 2026 02:51
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