microsoft / microsoft/apm

[BUG] Cursor target emits quoted YAML list for globs instead of unquoted comma-separated string

Open
#3,002 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/multi-target status/accepted theme/portability triage/recommended type/bug
Dominant language
Python
Stars
3.8k
Forks
362
Avg merge
1d 17h
Merged PRs (30d)
132

Description

The Cursor target compiler (apm install / apm compile) emits the globs frontmatter field
in generated .cursor/rules/*.mdc files in a format that does not match Cursor's documented
.mdc frontmatter format (cursor.com/docs/context/rules).

Two independent deviations, both present in the same output:

  1. Quoted values. Every glob is wrapped in double quotes ("services/**/*.py"). Every
    globs example in Cursor's docs uses an unquoted plain scalar
    (globs: src/components/**/*.tsx).
  2. YAML list instead of a single string. When an instruction's applyTo contains multiple
    comma-separated globs, APM emits globs as a multi-item YAML sequence (one - "..." per
    pattern) instead of a single string with the patterns comma-joined, which is the only form
    shown anywhere in Cursor's docs (docs/**/*.md, docs/**/*.mdx).

This looks like a side effect of the fix for #1366: that fix made the Claude target correctly
split a comma-separated applyTo into a YAML list under paths:, and the same comma-split →
YAML-list logic was applied to the Cursor globs: field "for consistency across targets"
without adapting to Cursor's own native format, which never uses list syntax for globs.

To Reproduce

  1. In an APM package, create an instruction with a comma-separated applyTo, e.g.:
    ---
    description: "Python service patterns"
    applyTo: "services/**/*.py,plugins/services/**/*.py"
    ---
    
  2. Set targets: [cursor] (or include cursor among targets) in apm.yml.
  3. Run apm install <path-or-git-url-to-package> --target cursor.
  4. Open the generated .cursor/rules/<name>.mdc and inspect the frontmatter.

Expected behavior

Per Cursor's documented format, a single unquoted string, multiple patterns comma-joined:

---
description: Python service patterns
globs: services/**/*.py, plugins/services/**/*.py
---

Actual behavior

---
description: "Python service patterns"
globs:
  - "services/**/*.py"
  - "plugins/services/**/*.py"
---

(Note also the description field: non-ASCII characters — em dash, arrow — are emitted as
\uXXXX JSON-style escapes inside a double-quoted YAML scalar rather than as literal UTF-8 text
or via a single-quoted scalar. Valid YAML, but not what any Cursor doc example shows, and it
hurts readability/diffability of the generated .mdc files. Flagging alongside since it's the
same code path; split it into its own issue if unrelated.)

Environment (please complete the following information):

  • OS: Windows 11 Pro (10.0.26200)
  • APM Version: reproduced on both 0.30.0 and 0.31.0 (upgraded via self-update mid-investigation; output byte-for-byte identical on both)

Logs

No error/crash — the CLI completes normally (apm install exits 0). The bug is purely in the
generated file content shown above. Reproduced both via a git: dependency and via a local path dependency
(apm install <local-path> --target cursor) — same output either way.

Additional context

  • Both deviations are consistent across every multi-glob instruction we deployed (11 instruction
    files touched in our case), not an isolated fluke.
  • Related: #1366 (fixed the same comma-split problem for the Claude paths: field) — this looks
    like the Cursor-target follow-through from that fix landed in the wrong shape for Cursor's
    target format specifically.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Cursor target path exercised by apm install and apm compile, then reproduce the output in .cursor/rules/*.mdc using a comma-separated applyTo. Done means the generated globs field matches Cursor’s documented single comma-joined string format without the quoted YAML list; consider regression coverage for the behavior described in #1366.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, yaml
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.