Skip to content

Canonicalize installed baml-core skill class fields to name: type, - #3805

Closed
ATX24 wants to merge 1 commit into
canaryfrom
cursor/skill-class-field-syntax-fd3a
Closed

ATX24 wants to merge 1 commit into
canaryfrom
cursor/skill-class-field-syntax-fd3a

Conversation

@ATX24

@ATX24 ATX24 commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request Template

Issue Reference

Please link to any related issues

  • This PR fixes/closes #[issue number]

Changes

The error

Repro command before this change:

cd baml_language
cargo run -p baml_cli -- agent install --dir "$tmpdir"
rg -n "class Point|x int|name type|formatter|x: int," "$tmpdir/.agents/skills/baml-core/SKILL.md"

Failing skill content excerpt from installed baml-core/SKILL.md:

class Point {
  x int
  y int
}

And the installed prose included the discrepancy note:

> The formatter (`baml fmt`) currently rewrites fields with a colon (`x: int,`); both forms compile, but write `x int` to match the language and the stdlib source.

Root cause

baml_language/crates/baml_cli/src/agent_command.rs normalized skill names/frontmatter and cross-skill references, but did not normalize skill body content. The default baml agent install path consumes a versioned release archive that still contains legacy name type class-field teaching in baml-core, so the installed skill remained non-canonical.

The fix

  • Added install-time skill content normalization in normalize_skills.
  • Added normalize_skill_class_field_syntax(...) to:
    • rewrite class-field prose from name type to name: type,
    • remove the obsolete formatter discrepancy note
    • canonicalize class field declarations inside fenced baml code blocks from name type to name: type,
  • Added targeted unit tests in agent_command:
    • old_class_field_style_is_canonicalized_in_skill_content
    • class_field_normalization_preserves_non_field_lines

Verification

Commands run from baml_language/:

cargo build -p baml_cli
cargo test -p baml_cli agent_command::tests::
cargo run -p baml_cli -- agent install --dir "$tmpdir"
rg -n 'name: type,|name type|x int|x: int,|value T|value: T,|currently rewrites fields' "$tmpdir/.agents/skills/baml-core/SKILL.md"
cargo fmt --all

Post-fix reproduction output excerpt:

3:... `name: type,` class fields ...
10:... class fields are `name: type,`.
98:**Class fields are `name: type,` — colon + trailing comma.**
102:  x: int, // field: `name: type,`
119:  value: T,
403:- **Class fields are `name: type,`** — colon + trailing comma.

No name type/x int matches or formatter-discrepancy note remain in the installed skill.

CodeRabbit self-review step:

  • Installed coderabbit CLI successfully.
  • CODERABBIT_API_KEY was not available in this environment (API key cannot be empty), so non-interactive auth/review could not be completed.

Testing

Please describe how you tested these changes

  • Unit tests added/updated
  • Manual testing performed
  • Tested in cloud Linux environment

Screenshots

If applicable, add screenshots to help explain your changes

N/A

PR Checklist

Please ensure you've completed these items

  • I have read and followed the contributing guidelines
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Additional Notes

Add any other context about the PR here

This is intentionally scoped to baml_language/crates/baml_cli/src/agent_command.rs and does not touch engine/.

Open in Web Open in Cursor 

Summary by CodeRabbit

  • Chores

    • Enhanced skill markdown normalization during installation to standardize class-field syntax formatting in skill content and code examples.
  • Tests

    • Added tests to verify proper normalization of skill markdown content and preservation of non-field code structures.

@vercel

vercel Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
beps Ready Ready Preview, Comment Jun 19, 2026 6:17pm
promptfiddle2 Ready Ready Preview, Comment Jun 19, 2026 6:17pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
promptfiddle Skipped Skipped Jun 19, 2026 6:17pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 713868ba-d242-4d8d-b096-c708224ddf50

📥 Commits

Reviewing files that changed from the base of the PR and between 65a66fe and 04a2bb0.

📒 Files selected for processing (1)
  • baml_language/crates/baml_cli/src/agent_command.rs

📝 Walkthrough

Walkthrough

normalize_skills in agent_command.rs gains a post-processing step that rewrites legacy class-field prose (removing obsolete formatter notes) and bare field declaration lines inside fenced baml code blocks into canonical name: type, form, using brace-depth tracking and line-shape heuristics. New tests cover both rewriting and preservation cases.

Changes

Skill markdown class-field syntax canonicalization

Layer / File(s) Summary
normalize_skills pipeline wiring and docs
baml_language/crates/baml_cli/src/agent_command.rs
Documentation comments describe the normalization pipeline stages; the per-skill content pipeline is extended to invoke new markdown normalization after normalize_skill_references, producing canonical content before Skill objects are returned.
Class-field normalization helpers and tests
baml_language/crates/baml_cli/src/agent_command.rs
New functions canonicalize prose class-field guidance (stripping obsolete formatter notes) and rewrite bare field declarations inside fenced baml code blocks to name: type, using brace-depth tracking and multi-guard line-shape heuristics; new tests verify legacy rewrites and non-field construct preservation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • BoundaryML/baml#3689: Introduced the agent install command and the foundational normalize_skills logic in agent_command.rs that this PR extends with class-field canonicalization.
  • BoundaryML/baml#3753: Modified the same normalize_skills flow in agent_command.rs with legacy parsing and reference rewriting, directly preceding this PR's additional normalization step.

Poem

🐇 Hop, hop, through the markdown field,
Where name type once stood revealed,
Now name: type, crowns each line,
Brace-depth guards keep the syntax fine.
Legacy notes swept clean away—
The formatter's rule has won the day! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Canonicalize installed baml-core skill class fields to name: type,' directly and specifically describes the main change: normalizing class field syntax in installed skills to a canonical form.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/skill-class-field-syntax-fd3a

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.

@vercel
vercel Bot temporarily deployed to Preview – beps June 19, 2026 18:11 Inactive
@github-actions

Copy link
Copy Markdown

⏭️ Performance benchmarks were skipped

Perf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to canary/main.

To run them on this PR, do any of the following, then push a commit (or re-run CI):

  • Add RUN_CODSPEED=1 to the PR description, or
  • Include run-perf or /perf in the PR title or any commit message.

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 19, 2026 18:17 Inactive
@github-actions

Copy link
Copy Markdown

No description provided.

@ATX24
ATX24 marked this pull request as ready for review June 19, 2026 19:13
@ATX24 ATX24 closed this Jun 19, 2026

This branch was previously deployed

3 inactive deployments
Preview – promptfiddle2 — 04a2bb0f Deployed Jun 19, 2026 by vercel[bot]
Preview – beps — 04a2bb0f Deployed Jun 19, 2026 by vercel[bot]
Preview – promptfiddle — 04a2bb0f Deployed Jun 19, 2026 by vercel[bot]
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