feat(adapters): Cursor adapter — export + enhanced import (#34)#37
Merged
shreyas-lyzr merged 1 commit intoopen-gitagent:mainfrom Mar 23, 2026
Merged
Conversation
Closes open-gitagent#34. ## Export: gitagent export --format cursor Generates .cursor/rules/*.mdc files: - SOUL.md + RULES.md → <agent-name>.mdc (alwaysApply: true) - Each skill → <skill-name>.mdc (alwaysApply: false) - Skills with metadata.globs get scoped file patterns in frontmatter ## Enhanced Import: gitagent import --from cursor Reads .cursor/rules/*.mdc directory (not just legacy .cursorrules): - alwaysApply: true rules → SOUL.md - Scoped skill rules → skills/<name>/SKILL.md - Globs preserved in metadata.globs for round-trip fidelity - Falls back to .cursorrules / AGENTS.md when no .cursor/rules/ found ## Tests 14 tests across 5 suites covering: - parseMdcFile (frontmatter + body, missing frontmatter, array globs) - readCursorRules (empty dir, .mdc filtering) - exportToCursor (global rule, skill rules, globs, slugification) - exportToCursorString (file header format) ## Files - src/adapters/cursor.ts — new adapter (export + import helpers) - src/adapters/cursor.test.ts — 14 tests, all passing - src/adapters/index.ts — re-export exportToCursorString, exportToCursor - src/commands/export.ts — wire cursor case + update format list - src/commands/import.ts — enhanced importFromCursor using readCursorRules - README.md — add cursor to adapter table
Contributor
|
Reviewed and merged. Implementation is correct:
Nice work @nanookclaw — solid adapter with good test coverage. Thanks for closing #34! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #34 ([Adapter] Cursor, tagged help wanted).
What this adds
Export:
gitagent export --format cursorGenerates
.cursor/rules/*.mdcfiles from a gitagent directory:SOUL.md+RULES.md<agent-name>.mdcwithalwaysApply: trueskills/<skill-name>.mdcwithalwaysApply: falsemetadata.globsin SKILL.mdglobs:array in .mdc frontmatterSkills without
metadata.globsget no globs field (Cursor applies them globally by default).Example output for a skill with globs:
Enhanced Import:
gitagent import --from cursorReads
.cursor/rules/*.mdcdirectory (not just legacy.cursorrules):alwaysApply: truerules →SOUL.mdskills/<name>/SKILL.mdmetadata.globsfor round-trip fidelity.cursorrules→AGENTS.mdwhen no.cursor/rules/foundMapping document
SOUL.mdalwaysApply: true.mdc bodyRULES.mdalwaysApply: true.mdc bodymanifest.descriptiondescription:frontmatterskill.frontmatter.descriptiondescription:frontmatterskill.metadata.globsglobs:arraycomplianceknowledge/Tests
14 tests, 5 suites — all pass:
Covers:
parseMdcFile,readCursorRules, export global/skill rules, globs, slugification, string output format.Files changed
src/adapters/cursor.ts— new adapter (export + import helpers)src/adapters/cursor.test.ts— 14 testssrc/adapters/index.ts— re-exportexportToCursorString,exportToCursorsrc/commands/export.ts— wirecursorcase + update format listsrc/commands/import.ts— enhancedimportFromCursorusingreadCursorRulesREADME.md— addcursorto adapter tableRun:
gitagent export --format cursoris not applicable (Cursor is an IDE), so no run adapter — as noted in the issue.