Skip to content

[FEATURE] Extend .gitignore coverage from apm_modules/ to deployed files #1342

@vlsi

Description

@vlsi

Is your feature request related to a problem? Please describe.

apm install and apm compile write two kinds of files:

  • Dependencies under apm_modules/. apm init already adds this to .gitignore (with a # APM dependencies comment), which is the right default.
  • Deployed primitives at the fixed paths consuming agents read: AGENTS.md, CLAUDE.md, .claude/, .cursor/, .github/instructions/, .agents/. These are equally derived from .apm/ and apm.yml, but they currently get no .gitignore treatment.

That asymmetry makes the contributor experience fail in the wrong direction:

  • New contributors see the generated files in git status and commit them, snapshotting whatever skill versions were installed at that moment.
  • Reviewers can't tell whether a CLAUDE.md diff was hand-authored or compiled.
  • Migrating from a hand-authored CLAUDE.md to APM-generated has no safe path: apm compile silently overwrites the committed file, and adding CLAUDE.md to .gitignore after the fact does not help — git ignores .gitignore rules for already-tracked files.

Describe the solution you'd like

Three coordinated changes:

  1. apm init extends the .gitignore block it already writes to cover deployed-primitive paths in addition to apm_modules/, and wraps the whole block in # >>> apm-managed >>> / # <<< apm-managed <<< markers so future apm versions can refresh the contents in place without disturbing unrelated rules.

  2. apm add-vcsignore — standalone, idempotent command that writes or refreshes the same block. For repositories that adopt apm after apm init has already run, and for CI to self-heal drift. Name is VCS-neutral on purpose; auto-detection makes the git case zero-friction (see VCS portability note below).

  3. apm compile refuses to overwrite tracked, non-ignored files, aborting with an actionable error that points at apm add-vcsignore and git rm --cached. This is the load-bearing piece — without it, (1) and (2) only protect future contributors; existing committed files keep getting overwritten without warning.

Sample .gitignore block, full error-message wording, edge cases, and open questions in the next comment.

Describe alternatives you've considered

  • Documentation only — add a "remember to update .gitignore" paragraph to the apm README.
    Cheap, but doesn't help projects migrating from a hand-authored CLAUDE.md, doesn't catch existing drift in contributor checkouts, and doesn't resolve reviewer confusion about generated vs. hand-authored diffs.
  • Pre-commit hook shipped by apm install — refuse commits that contain generated paths.
    Heavy for the problem; collides with existing user-managed pre-commit setups (husky, pre-commit, lefthook).
  • Compile to alternate paths (subdirectory or suffix, e.g. .apm/dist/CLAUDE.md) — sidesteps .gitignore entirely.
    Doesn't work: consuming agents (Claude Code, Cursor, Copilot) read fixed paths (CLAUDE.md, .cursor/rules/); APM can't redirect them. Compile-time warning without enforcement — print a notice and proceed with the overwrite anyway. Adds noise without removing the failure mode; users habituate to the warning and the committed CLAUDE.md keeps drifting.

Sample .gitignore block, full error-message wording, edge cases, VCS portability notes, and open questions in the next comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/needs-triageNew, awaiting maintainer review.type/featureNew capability, new flag, new primitive.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions