Document accepted MVP decisions, add AGPL-3.0-only licensing, scaffold repository boundaries, and configure verified PSR-12 and foundation checks. Refs #1, #2, #3, #4, #5
39 lines
1.6 KiB
PHP
39 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
$root = dirname(__DIR__);
|
|
$failures = [];
|
|
$check = static function (bool $condition, string $message) use (&$failures): void {
|
|
if (!$condition) {
|
|
$failures[] = $message;
|
|
}
|
|
};
|
|
|
|
foreach (['src', 'public', 'db/migrations', 'docker', 'assets', 'tests'] as $directory) {
|
|
$check(is_dir($root . '/' . $directory), 'Missing directory: ' . $directory);
|
|
}
|
|
foreach (['README.md', 'CONTRIBUTING.md', 'LICENSE', '.editorconfig', 'phpcs.xml.dist'] as $file) {
|
|
$check(is_file($root . '/' . $file), 'Missing file: ' . $file);
|
|
}
|
|
|
|
$composer = json_decode(file_get_contents($root . '/composer.json'), true, 512, JSON_THROW_ON_ERROR);
|
|
$check($composer['license'] === 'AGPL-3.0-only', 'Composer must specify AGPL-3.0-only.');
|
|
$check(isset($composer['scripts']['lint'], $composer['scripts']['test']), 'Missing check scripts.');
|
|
|
|
$license = is_file($root . '/LICENSE') ? file_get_contents($root . '/LICENSE') : '';
|
|
$check(str_contains($license, 'GNU AFFERO GENERAL PUBLIC LICENSE'), 'Missing AGPL license text.');
|
|
$check(str_contains($license, '19 November 2007'), 'Expected AGPL version 3 text.');
|
|
$check(str_contains($license, '13. Remote Network Interaction'), 'Missing network license clause.');
|
|
|
|
$standard = simplexml_load_file($root . '/phpcs.xml.dist');
|
|
$check($standard !== false, 'Invalid PHPCS configuration.');
|
|
$check($standard !== false && (string) $standard->rule['ref'] === 'PSR12', 'PSR-12 must be enforced.');
|
|
|
|
if ($failures !== []) {
|
|
fwrite(STDERR, implode(PHP_EOL, $failures) . PHP_EOL);
|
|
exit(1);
|
|
}
|
|
|
|
echo "Foundation checks passed (not application integration tests).\n";
|