Skip to content

Seed a comprehensive .gitignore on aipm init and stop refresh-managing it - #20

Merged
mike-north merged 2 commits into
mainfrom
claude/nice-beaver-7e6144
Jun 6, 2026
Merged

mike-north merged 2 commits into
mainfrom
claude/nice-beaver-7e6144

Conversation

@mike-north

Copy link
Copy Markdown
Contributor

Resolves #19.

Problem

Two related .gitignore defects, surfaced while adopting aipm init --refresh in the template repo:

  1. Unsafe seed. A fresh aipm init wrote only a 4-line .gitignore (node_modules/, .DS_Store, *.local.*, *.tsbuildinfo). It did not ignore .env*, logs, coverage, caches, or scratch/ — so a brand-new scaffold could easily commit secrets. A safety bug, not polish.
  2. Perpetual refresh conflict. .gitignore was in the refresh-managed set, guarded by the .aipm/scaffold.json content-hash sidecar. Since users legitimately extend .gitignore, any addition diverged it from the lean canonical render, so every aipm init --refresh flagged it as a conflict forever (and --force would clobber the user's additions).

Fix

The issue's recommended seed-only approach:

  1. Comprehensive seed in renderGitignore() — now ignores .env*, *.log, coverage, common caches, and scratch/, while retaining node_modules/, *.tsbuildinfo, *.local.*, and .DS_Store. Deliberately does not ignore dist/ (toolkit build output is committed for the install/freshness contract).
  2. Dropped .gitignore from the refresh-managed set (buildManagedScaffoldFiles()) — it's now seeded directly by buildInitFiles() and owned by the user thereafter. aipm init --refresh only manages .github/workflows/ci.yml; the sidecar tracks only ci.yml. User .gitignore additions are never clobbered or perpetually flagged.

Changes

  • packages/core/src/pipeline/init-template.ts — comprehensive seed; .gitignore moved from managed set to seed-only.
  • docs/specs/scaffold-refresh-and-upgrade.md — file-ownership table (​.gitignoreNo) + prose.
  • packages/core/src/pipeline/init.test.ts — sidecar now expects only ci.yml; new test asserting the seeded .gitignore contains .env* (and other patterns) and does not ignore dist/.
  • packages/core/src/pipeline/scaffold-refresh.test.ts — re-pointed managed-file behavior tests from .gitignore to ci.yml; new test asserting .gitignore is never in refresh outcomes and user edits survive (with and without --force).
  • .changeset/gitignore-seed-only.md — minor bump to @ai-plugin-marketplace/core.

Acceptance

Verification

  • Targeted suites green: init.test.ts, scaffold-refresh.test.ts.
  • Clean build + lint + typecheck + api-report + workspace format/knip/deps all pass.
  • Note: 2 unrelated, pre-existing failures in targets/kiro/bundle.test.ts and targets/gemini/bundle.test.ts (plugin bundle README/LICENSE/steering paths) exist on main and are out of scope here.

References

A fresh `aipm init` previously wrote only a 4-line `.gitignore`, so a
brand-new scaffold could easily commit secrets. The seeded `.gitignore`
is now comprehensive — it ignores `.env*`, `*.log`, `coverage`, common
caches, and `scratch/`, while retaining `node_modules/`, `*.tsbuildinfo`,
`*.local.*`, and `.DS_Store`. Build output (`dist/`) is deliberately
still tracked, per the build/freshness contract.

`.gitignore` is also removed from the `aipm init --refresh` managed set
and is now seed-only: `init` writes it, the user owns it thereafter.
Because users legitimately extend `.gitignore`, keeping it managed caused
every refresh to report it as a perpetual conflict (and `--force` would
clobber the additions). The `.aipm/scaffold.json` sidecar now tracks only
`.github/workflows/ci.yml`.

Resolves #19.
Copilot AI review requested due to automatic review settings June 6, 2026 15:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts aipm init / aipm init --refresh scaffold ownership so .gitignore is seeded once (with a safer, more comprehensive baseline) and is no longer refresh-managed, preventing perpetual refresh conflicts and reducing the risk of accidentally committing secrets in newly scaffolded repos.

Changes:

  • Expanded the seeded .gitignore to cover .env*, logs, coverage, caches, and scratch/ (while intentionally not ignoring dist/).
  • Removed .gitignore from the refresh-managed scaffold set so refresh only manages .github/workflows/ci.yml and the sidecar tracks only that file.
  • Updated specs, tests, and added a changeset to reflect the new ownership boundary and behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/core/src/pipeline/init-template.ts Makes .gitignore a comprehensive seed-only file and removes it from buildManagedScaffoldFiles() so refresh manages only CI.
packages/core/src/pipeline/init.test.ts Updates sidecar expectations (only ci.yml) and adds a .gitignore seed safety test (.env* ignored; dist/ not ignored).
packages/core/src/pipeline/scaffold-refresh.test.ts Re-targets refresh behavior tests to ci.yml and asserts .gitignore is never reported/touched by refresh (even with --force).
docs/specs/scaffold-refresh-and-upgrade.md Updates file-ownership table and narrative to mark .gitignore as seed-only / user-owned.
.changeset/gitignore-seed-only.md Records the behavioral change and releases a minor bump for @ai-plugin-marketplace/core.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/src/pipeline/init-template.ts Outdated
Address PR review: the `.gitignore` doc comment cited `.gitattributes`
as the source of the committed-`dist/` contract, but `.gitattributes`
only marks docs/api-report as linguist-generated and `aipm init` seeds
no `.gitattributes` into consumer repos. Point at the actual spec
instead — architecture.md §P5 (committed generated outputs) and §10.5
(freshness check).
@mike-north
mike-north enabled auto-merge June 6, 2026 16:00
@mike-north
mike-north merged commit 672c017 into main Jun 6, 2026
2 checks passed
@mike-north
mike-north deleted the claude/nice-beaver-7e6144 branch June 6, 2026 16:00
@github-actions github-actions Bot mentioned this pull request Jun 6, 2026
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.

Seed a comprehensive .gitignore on aipm init and stop refresh-managing it

2 participants