Split meta architecture contracts
This commit is contained in:
46
tests/Architecture/CodexDocsContractSupport.php
Normal file
46
tests/Architecture/CodexDocsContractSupport.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Tests\Architecture;
|
||||
|
||||
trait CodexDocsContractSupport
|
||||
{
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
private function filesCoveredByDocsLinkIntegrityCheck(): array
|
||||
{
|
||||
$root = dirname(__DIR__, 2);
|
||||
$files = ['README.md'];
|
||||
$scanDirs = ['docs', '.agents'];
|
||||
|
||||
foreach ($scanDirs as $scanDir) {
|
||||
$directory = new \RecursiveDirectoryIterator(
|
||||
$root . '/' . $scanDir,
|
||||
\FilesystemIterator::SKIP_DOTS
|
||||
);
|
||||
$iterator = new \RecursiveIteratorIterator($directory);
|
||||
|
||||
foreach ($iterator as $fileInfo) {
|
||||
if (!$fileInfo->isFile()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fullPath = str_replace('\\', '/', $fileInfo->getPathname());
|
||||
if (!str_ends_with($fullPath, '.md')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$relative = ltrim(str_replace(str_replace('\\', '/', $root), '', $fullPath), '/');
|
||||
if (str_starts_with($relative, '.agents/runs/')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$files[] = $relative;
|
||||
}
|
||||
}
|
||||
|
||||
$files = array_values(array_unique($files));
|
||||
sort($files);
|
||||
return $files;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user