Repository navigation
[pull] main from Tencent:main - #9
Merged
Merged
Conversation
* fix(rules): write Cursor rules as .mdc with derived frontmatter
Cursor project rules must live in .cursor/rules/ as .mdc files with YAML
frontmatter (description/globs/alwaysApply); a plain .md there is silently
ignored, so team rules synced via `teamai pull` never entered a Cursor
session. RulesHandler.pullItem wrote `${name}.md` for every tool.
- pull: for Cursor, write <name>.mdc and derive frontmatter from the team
rule — a `paths:` list maps to `globs` + alwaysApply:false, and a rule
with no paths (mandatory) maps to alwaysApply:true. Other tools still
get a plain .md copy.
- push: scanLocalForPush now also reads .cursor/rules/*.mdc, comparing
markdown bodies only so a pull→push round-trip is not seen as modified;
pushItem strips the derived frontmatter when writing an .mdc back to the
team repo.
- cleanup: stale-file cleanup, removeItem, and pull.ts tombstone cleanup
handle the .mdc extension for Cursor.
Body extraction is delimiter-based, not YAML-parsed: the Cursor `globs`
value (a leading-star glob) is invalid YAML, so a strict parse would fail
and swallow the frontmatter into the body.
Fixes git.woa.com/teamai/teamai-cli#3
* fix(rules): preserve team frontmatter and cover every Cursor .mdc call site
Follow-up on the Cursor `.mdc` fix. The extension decision lived in a private
helper in rules.ts plus an inline special case in pull.ts, so the other five
writers of the same directories still assumed `.md`, and the push direction
dropped the team rule's frontmatter.
Correctness:
- pushItem now merges the Cursor body into the team file instead of replacing
it, so a body edit in `.cursor/rules/*.mdc` no longer deletes the team rule's
`paths:` scope for everyone on the next pull.
- pre-push-sync handles `.mdc`; it previously skipped Cursor entirely, so a
stale local copy was reported as "modified" and pushed over a newer team rule.
- uninstall collects rules by stem, so Cursor's `.mdc` rules are actually
removed instead of surviving uninstall.
- `globs` is emitted quoted: a glob starting with `*` is a YAML alias node, so
the frontmatter we wrote could not be parsed (gray-matter throws on it) and
Cursor could drop the rule — the exact failure this series fixes.
- Team frontmatter is parsed leniently, so a rule authored `globs: **/*.ts` is
honoured instead of silently falling back to always-on.
- An unreadable source now fails loudly rather than writing an empty rule over
the team repo (push) or a stub always-on rule (pull).
- The frontmatter regex accepts an empty `---/---` block instead of leaking the
delimiters into the body.
- local-agent reports Cursor rules again.
Behavior:
- Built-in rules deploy to Cursor as `.mdc` too; `teamai-recall` was still being
written as a `.md` Cursor ignores.
- `.cursor/rules/*.mdc` with no matching team rule is no longer offered as a new
team resource — that is where Cursor's own "New Cursor Rule" writes personal
rules.
- `.md` copies left by the pre-`.mdc` layout are swept by pull, remove,
tombstone cleanup, and uninstall.
Altitude: the per-tool extension moves to src/resources/rule-format.ts
(mirroring agentFileExtensionForTool) so all call sites share one decision.
Docs updated in both languages; the old text claimed the body was preserved
verbatim and that a Cursor push sent "just that body change" upstream.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )