Automattic / Automattic/php-toolkit
Feature: Add support for .gitignore parsing and system file whitelisting
- Dominant language
- PHP
- Stars
- 22
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
### Summary
I was trying to use Obsidian to edit Markdown files, and faced a problem to sync the Obsidian vault `.obsidian`.. Because it does not exist on the server. While one could use the Gutenberg Guidelines structure for brand voice and other items, it would be useful to allow people to keep other files in their checked out repos and only push what Push MD supports.
Since Push MD does not have a `.gitignore`, this can cause ignored build artifacts or temporary files to be scanned and pushed into WordPress - and the whole push to fail.
**The proposal:**
Push MD checkout repositories can contain `.gitignore` file. And the rules here will specifically check for file paths Push MD needs, and ignore everything else.
This can also address potential issues when people have multi remote setup - one from local to their own "staging" or "pre-approval" Git server, and from there to live WordPress site.
### Features & How This Should Work
1. **`.gitignore` Pattern Parser**:
- Interpret root and sub-folder `.gitignore` files during push scan.
- Support standard pattern syntax: wildcards (`*`), directory prefixes (`/`), comments (`#`), trailing slashes, and negations (`!`).
2. **System File Whitelist Policy**:
- System configuration files (`.gitignore`, `AGENTS.md`, `CLAUDE.md`) should be explicitly whitelisted so they are preserved and never ignored, even if broad rules (like `.*` or `*.md`) exist in `.gitignore`.
- Support for posts, pages and other artifacts in a way that support for custom post types etc in future works too
3. **Seeder Integration**:
- Export `.gitignore` during checkout/seed so workspace rules remain intact.
### Acceptance Criteria
- [ ] `.gitignore` patterns correctly exclude matching files during push scan.
- [ ] Negation rules (`!pattern`) work as expected.
- [ ] System files (`.gitignore`, `AGENTS.md`, `CLAUDE.md` - and others) are explicitly whitelisted and never ignored.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the push scan and checkout/seed flow described in the issue, then inspect how repository files are currently selected and exported. Verify behavior against the listed acceptance criteria: nested .gitignore patterns and negations exclude matching files, while .gitignore, AGENTS.md, and CLAUDE.md remain preserved; confirm the rules also survive checkout/seed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, php
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100