Skip to content

Commit 6f5e6ed

Browse files
committed
feat(gitattributes): expand candidate list and update docs
- Add full list of folders/files from issue #13 to CandidateProvider - Add gitattributes command documentation to specialized-commands.rst - Update README.md with gitattributes command and table entry - Update SyncCommand docs to mention gitattributes call
1 parent 439ec4d commit 6f5e6ed

3 files changed

Lines changed: 85 additions & 10 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ composer dev-tools skills
7777
# Merges and synchronizes .gitignore files
7878
composer dev-tools gitignore
7979

80+
# Manages .gitattributes export-ignore rules for leaner package archives
81+
composer dev-tools gitattributes
82+
8083
# Generates a LICENSE file from composer.json license information
8184
composer dev-tools license
8285

@@ -105,7 +108,8 @@ automation assets.
105108
| `composer dev-tools dependencies` | Reports missing and unused Composer dependencies. |
106109
| `composer dev-tools docs` | Builds the HTML documentation site from PSR-4 code and `docs/`. |
107110
| `composer dev-tools skills` | Creates or repairs packaged skill links in `.agents/skills`. |
108-
| `composer dev-tools:sync` | Updates scripts, workflow stubs, `.editorconfig`, `.gitignore`, wiki setup, and packaged skills. |
111+
| `composer dev-tools gitattributes` | Manages export-ignore rules in .gitattributes. |
112+
| `composer dev-tools:sync` | Updates scripts, workflow stubs, `.editorconfig`, `.gitignore`, `.gitattributes`, wiki setup, and packaged skills. |
109113

110114
## 🔌 Integration
111115

docs/running/specialized-commands.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,31 @@ Important details:
177177
missing.
178178
- it calls ``gitignore`` to merge the canonical .gitignore with the project's
179179
.gitignore;
180+
- it calls ``gitattributes`` to manage export-ignore rules in .gitattributes;
180181
- it calls ``skills`` so ``.agents/skills`` contains links to the packaged
181182
skill set.
182183

184+
``gitattributes``
185+
----------------
186+
187+
Manages .gitattributes export-ignore rules for leaner Composer package archives.
188+
189+
.. code-block:: bash
190+
191+
composer dev-tools gitattributes
192+
193+
Important details:
194+
195+
- it adds export-ignore entries for repository-only files and directories;
196+
- it only adds entries for paths that actually exist in the repository;
197+
- it respects the ``extra.gitattributes.keep-in-export`` configuration to
198+
keep specific paths in exported archives;
199+
- it preserves existing custom .gitattributes rules;
200+
- it deduplicates equivalent entries and sorts them with directories before
201+
files, then alphabetically;
202+
- it uses CandidateProvider, ExistenceChecker, ExportIgnoreFilter, Merger,
203+
Reader, and Writer components from the GitAttributes namespace.
204+
183205
``gitignore``
184206
-------------
185207

src/GitAttributes/CandidateProvider.php

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,25 @@ final class CandidateProvider implements CandidateProviderInterface
3333
public function folders(): array
3434
{
3535
return [
36+
'/.changeset/',
37+
'/.circleci/',
3638
'/.devcontainer/',
3739
'/.github/',
40+
'/.gitlab/',
3841
'/.idea/',
42+
'/.php-cs-fixer.cache/',
3943
'/.vscode/',
4044
'/benchmarks/',
4145
'/build/',
4246
'/coverage/',
47+
'/docker/',
4348
'/docs/',
4449
'/examples/',
4550
'/fixtures/',
51+
'/migrations/',
4652
'/scripts/',
53+
'/src-dev/',
54+
'/stubs/',
4755
'/tests/',
4856
'/tools/',
4957
];
@@ -55,25 +63,66 @@ public function folders(): array
5563
public function files(): array
5664
{
5765
return [
66+
'/.dockerignore',
5867
'/.editorconfig',
68+
'/.env',
69+
'/.env.dist',
70+
'/.env.example',
5971
'/.gitattributes',
6072
'/.gitignore',
6173
'/.gitmodules',
74+
'/.gitlab-ci.yml',
75+
'/.php-cs-fixer.dist.php',
76+
'/.php-cs-fixer.php',
77+
'/.phpunit.result.cache',
78+
'/.styleci.yml',
79+
'/.travis.yml',
80+
'/AGENTS.md',
6281
'/CODE_OF_CONDUCT.md',
6382
'/CONTRIBUTING.md',
83+
'/Dockerfile',
84+
'/GEMINI.md',
85+
'/Governance.md',
6486
'/Makefile',
65-
'/phpunit.xml.dist',
6687
'/README.md',
67-
'/AGENTS.md',
68-
'/GEMINI.md',
69-
'/Dockerfile',
70-
'/.dockerignore',
71-
'/.env',
72-
'/docker-compose.yml',
88+
'/SECURITY.md',
89+
'/SUPPORT.md',
90+
'/UPGRADE.md',
91+
'/UPGRADING.md',
92+
'/Vagrantfile',
93+
'/bitbucket-pipelines.yml',
94+
'/codecov.yml',
95+
'/composer-normalize.json',
96+
'/composer-require-checker.json',
7397
'/docker-compose.override.yml',
98+
'/docker-compose.yaml',
99+
'/docker-compose.yml',
100+
'/docker-bake.hcl',
74101
'/docker-stack.yml',
75-
'/compose.yml',
76-
'/compose.override.yml',
102+
'/docker-stack.yaml',
103+
'/ecs.php',
104+
'/grumphp.yml',
105+
'/grumphp.yml.dist',
106+
'/infection.json',
107+
'/infection.json.dist',
108+
'/makefile',
109+
'/phpbench.json',
110+
'/phpbench.json.dist',
111+
'/phpcs.xml',
112+
'/phpcs.xml.dist',
113+
'/phpmd.xml',
114+
'/phpmd.xml.dist',
115+
'/phpstan-baseline.neon',
116+
'/phpstan-bootstrap.php',
117+
'/phpstan.neon',
118+
'/phpstan.neon.dist',
119+
'/phpunit.xml.dist',
120+
'/psalm-baseline.xml',
121+
'/psalm.xml',
122+
'/psalm.xml.dist',
123+
'/rector.php',
124+
'/renovate.json',
125+
'/renovate.json5',
77126
];
78127
}
79128

0 commit comments

Comments
 (0)