Self-hosted workflows for coding-agent delivery. Orchestrate CodeBuddy, Codex and Claude Code with scripts and human approval gates. Includes Local workflows for coding assistants.
JavaScript agent-orchestrationagentic-workflowai-agentsai-codingclaude-codecode-reviewcodebuddycodexcoding-agentscursordeveloper-toolshuman-on-the-loopllmmcpmulti-agentsdlcself-hostedsopworkflow-automationworkflow-engine
refactor(runtime): hasClosedFrontmatter 复用 splitFrontmatter (#384)
fx-kurumiff404510ab16
diff --git a/internal/runtime/skill_frontmatter_detect_test.go b/internal/runtime/skill_frontmatter_detect_test.gonew file mode 100644index 00000000..3c3dba6d--- /dev/null+++ b/internal/runtime/skill_frontmatter_detect_test.go@@ -0,0 +1,31 @@+package runtime++import "testing"++func TestHasClosedFrontmatterMatchesSplitFrontmatter(t *testing.T) {+ cases := []struct {+ name string+ raw string+ want bool+ }{+ {"empty", "", false},+ {"no frontmatter", "# Title\nbody\n", false},+ {"unclosed", "---\nname: x\nbody\n", false},+ {"closed", "---\nname: x\n---\nbody\n", true},+ {"closed crlf", "---\r\nname: x\r\n---\r\nbody\r\n", true},+ {"leading whitespace", "\n\n ---\nname: x\n---\n", true},+ {"empty header collapses", "---\n---\n", false},+ {"dashes only", "---", false},+ }+ for _, tc := range cases {+ t.Run(tc.name, func(t *testing.T) {+ got := hasClosedFrontmatter([]byte(tc.raw))+ if got != tc.want {+ t.Fatalf("hasClosedFrontmatter(%q) = %v, want %v", tc.raw, got, tc.want)+ }+ if _, _, ok := splitFrontmatter([]byte(tc.raw)); ok != got {+ t.Fatalf("splitFrontmatter(%q) ok = %v, hasClosedFrontmatter = %v", tc.raw, ok, got)+ }+ })+ }+}diff --git a/internal/runtime/skill_md.go b/internal/runtime/skill_md.goindex c3765520..caa3b93b 100644--- a/internal/runtime/skill_md.go+++ b/internal/runtime/skill_md.go@@ -84,12 +84,8 @@ func prependSkillFrontmatter(raw []byte, id, description string) []byte {}func hasClosedFrontmatter(raw []byte) bool {- trimmed := strings.TrimSpace(string(raw))- if !strings.HasPrefix(trimmed, "---") {- return false- }- rest := strings.TrimLeft(trimmed[3:], "\r\n")- return strings.Contains(rest, "\n---")+ _, _, ok := splitFrontmatter(raw)+ return ok}func setFrontmatterField(raw []byte, key, value string) []byte {