refactor: rename .gitea/ to .mokogitea/ in sync engine (#28)
Universal: Cascade Main → Dev / Cascade main → branches (push) Successful in 2s

This commit was merged in pull request #28.
This commit is contained in:
2026-05-21 21:55:24 +00:00
parent 14763e3c49
commit 8095ea607b
25 changed files with 61 additions and 58 deletions
+1 -1
View File
@@ -348,7 +348,7 @@ jobs:
echo "::error file=${file}::Invalid YAML"
ERRORS=$((ERRORS + 1))
fi
done < <(find .gitea/workflows/ -name "*.yml" -o -name "*.yaml" 2>/dev/null | tr '\n' '\0')
done < <(find .mokogitea/workflows/ -name "*.yml" -o -name "*.yaml" 2>/dev/null | tr '\n' '\0')
{
echo "### Template Integrity"
+2 -2
View File
@@ -276,7 +276,7 @@ foreach ($repos as $repo) {
[$ret] = safeExec('git clone --depth 1 --branch ' . escapeshellarg($defaultBranch) . ' ' . escapeshellarg($authedUrl) . ' ' . escapeshellarg($workDir));
if ($ret !== 0) { echo "FAIL (clone)\n"; $stats['failed']++; continue; }
$manifestPath = "{$workDir}/.gitea/.mokostandards";
$manifestPath = "{$workDir}/.mokogitea/.mokostandards";
if (!file_exists($manifestPath) || !str_contains(file_get_contents($manifestPath), '<mokostandards')) {
echo "SKIP (no XML manifest)\n"; $stats['skipped']++; rmTree($workDir); continue;
}
@@ -299,7 +299,7 @@ foreach ($repos as $repo) {
file_put_contents($manifestPath, $enrichedXml);
gitCmd($workDir, 'config', 'user.name', 'gitea-actions[bot]');
gitCmd($workDir, 'config', 'user.email', 'gitea-actions[bot]@git.mokoconsulting.tech');
gitCmd($workDir, 'add', '.gitea/.mokostandards');
gitCmd($workDir, 'add', '.mokogitea/.mokostandards');
[$cr, $co] = gitCmd($workDir, 'commit', '-m', "chore: enrich .mokostandards with build/deploy/scripts\n\nAuto-detected: {$details}");
if ($cr !== 0) { echo "SKIP (no diff)\n"; $stats['skipped']++; rmTree($workDir); continue; }
+3 -3
View File
@@ -14,7 +14,7 @@
* Push XML .mokostandards manifest to all governed repositories.
*
* Uses git SSH to bypass the Gitea reverse-proxy WAF that blocks
* API requests to paths containing ".gitea".
* API requests to paths containing ".mokogitea".
*
* Usage:
* php automation/push_mokostandards_xml.php [--dry-run] [--repo NAME] [--force]
@@ -233,7 +233,7 @@ foreach ($repos as $repo) {
}
// Check if already XML and up-to-date
$manifestPath = "{$workDir}/.gitea/.mokostandards";
$manifestPath = "{$workDir}/.mokogitea/.mokostandards";
$existingIsXml = file_exists($manifestPath) && str_contains(file_get_contents($manifestPath), '<mokostandards');
if ($existingIsXml && !$force) {
$existingPlatform = $parser->extractPlatform(file_get_contents($manifestPath));
@@ -270,7 +270,7 @@ foreach ($repos as $repo) {
gitCmd($workDir, 'config', 'user.name', 'gitea-actions[bot]');
gitCmd($workDir, 'config', 'user.email', 'gitea-actions[bot]@git.mokoconsulting.tech');
gitCmd($workDir, 'add', '.gitea/.mokostandards');
gitCmd($workDir, 'add', '.mokogitea/.mokostandards');
foreach ($legacyDeleted as $lf) {
gitCmd($workDir, 'add', $lf);
}
+1 -1
View File
@@ -361,7 +361,7 @@ class RepoCleanup extends CLIApp
} catch (\Exception $e) { /* fallback to main */ }
// Check both workflow directories for retired workflows (supports dual-platform repos)
$wfDirs = array_unique(['.github/workflows', '.gitea/workflows', $this->adapter->getWorkflowDir()]);
$wfDirs = array_unique(['.github/workflows', '.mokogitea/workflows', $this->adapter->getWorkflowDir()]);
foreach (self::RETIRED_WORKFLOWS as $wf) {
foreach ($wfDirs as $wfDir) {
$path = "{$wfDir}/{$wf}";
+1 -1
View File
@@ -162,7 +162,7 @@ function restGet(string $path, string $token, ?\MokoEnterprise\ApiClient $apiCli
function detectPlatform(string $org, string $repo, string $token, ?\MokoEnterprise\ApiClient $apiClient = null): string
{
// Try platform metadata dir first, then root
foreach (['.github/.mokostandards', '.gitea/.mokostandards', '.mokostandards'] as $path) {
foreach (['.github/.mokostandards', '.mokogitea/.mokostandards', '.mokostandards'] as $path) {
$data = restGet("repos/{$org}/{$repo}/contents/{$path}", $token, $apiClient);
if (!empty($data['content'])) {
$content = base64_decode($data['content']);
+7 -4
View File
@@ -51,7 +51,7 @@ $manifestFile = null;
$candidates = [
"{$root}/.mokogitea/.manifest.xml",
"{$root}/.mokogitea/.moko-platform",
"{$root}/.gitea/.mokostandards", // legacy v4
"{$root}/.mokogitea/.mokostandards", // legacy v4
];
foreach ($candidates as $candidate) {
@@ -76,15 +76,18 @@ if ($xml === false) {
$fields = [];
if (preg_match('/^platform:\s*(.+)/m', $content, $m)) {
$fields['platform'] = trim($m[1], "
\"'");
}
if (preg_match('/^standards_version:\s*(.+)/m', $content, $m)) {
$fields['standards-version'] = trim($m[1], "
$fields['standards-version'] = trim($m[1], "
\"'");
}
if (preg_match('/^governed_repo:\s*(.+)/m', $content, $m)) {
$fields['name'] = trim($m[1], "
if (preg_match('/^governed_repo:\s*(.+)/m', $content, $m)) {
\"'");
}
} else {
// Register namespace for XPath (optional, simple path works without)
+2 -2
View File
@@ -31,8 +31,8 @@ foreach ($argv as $i => $arg) {
$repoRoot = dirname(__DIR__, 2);
$syncFile = "{$repoRoot}/lib/Enterprise/RepositorySynchronizer.php";
// Check both workflow directories for the bulk-repo-sync workflow
$bulkSyncFile = file_exists("{$repoRoot}/.gitea/workflows/bulk-repo-sync.yml")
? "{$repoRoot}/.gitea/workflows/bulk-repo-sync.yml"
$bulkSyncFile = file_exists("{$repoRoot}/.mokogitea/workflows/bulk-repo-sync.yml")
? "{$repoRoot}/.mokogitea/workflows/bulk-repo-sync.yml"
: "{$repoRoot}/.github/workflows/bulk-repo-sync.yml";
$cleanupFile = "{$repoRoot}/templates/workflows/shared/repository-cleanup.yml.template";
+2 -2
View File
@@ -50,14 +50,14 @@ interface GitPlatformAdapter
/**
* Get the workflow directory name for this platform.
*
* @return string '.github/workflows' or '.gitea/workflows'
* @return string '.github/workflows' or '.mokogitea/workflows'
*/
public function getWorkflowDir(): string;
/**
* Get the platform-specific metadata directory.
*
* @return string '.github' or '.gitea'
* @return string '.github' or '.mokogitea'
*/
public function getMetadataDir(): string;
+3 -3
View File
@@ -30,7 +30,7 @@ use RuntimeException;
* - File ops: POST for create, PUT for update (check existence first)
* - Topics: PUT with {"topics": [...]}
* - Branch protection: flat API (not rulesets)
* - Workflow dir: .gitea/workflows
* - Workflow dir: .mokogitea/workflows
*
* @package MokoStandards\Enterprise
* @version 04.06.10
@@ -62,12 +62,12 @@ class GiteaAdapter implements GitPlatformAdapter
public function getWorkflowDir(): string
{
return '.gitea/workflows';
return '.mokogitea/workflows';
}
public function getMetadataDir(): string
{
return '.gitea';
return '.mokogitea';
}
public function getRepoWebUrl(string $org, string $repo): string
+1 -1
View File
@@ -25,7 +25,7 @@ use SimpleXMLElement;
* MokoStandards Parser
*
* Reads, writes, and validates the .mokostandards repository manifest.
* The file uses XML format (no file extension) and lives at .gitea/.mokostandards.
* The file uses XML format (no file extension) and lives at .mokogitea/.mokostandards.
*
* @package MokoStandards\Enterprise
* @version 04.07.00
+3 -3
View File
@@ -287,7 +287,7 @@ class ApiPlugin extends AbstractProjectPlugin
'docker-compose.yml',
'kubernetes/*.yaml',
'tests/ or test/',
'.gitea/workflows/* or .gitea/workflows/* or .gitlab-ci.yml',
'.mokogitea/workflows/* or .gitea/workflows/* or .gitlab-ci.yml',
'middleware/ or middlewares/',
];
}
@@ -673,8 +673,8 @@ class ApiPlugin extends AbstractProjectPlugin
*/
private function hasCICD(string $projectPath): bool
{
return $this->fileExists($projectPath, '.gitea/workflows') ||
$this->fileExists($projectPath, '.gitea/workflows') ||
return $this->fileExists($projectPath, '.mokogitea/workflows') ||
$this->fileExists($projectPath, '.mokogitea/workflows') ||
$this->fileExists($projectPath, '.gitlab-ci.yml') ||
$this->fileExists($projectPath, 'Jenkinsfile') ||
$this->fileExists($projectPath, '.circleci');
+5 -5
View File
@@ -73,8 +73,8 @@ class GenericPlugin extends AbstractProjectPlugin
}
// Check for CI/CD configuration
$hasCICD = $this->fileExists($projectPath, '.gitea/workflows') ||
$this->fileExists($projectPath, '.gitea/workflows') ||
$hasCICD = $this->fileExists($projectPath, '.mokogitea/workflows') ||
$this->fileExists($projectPath, '.mokogitea/workflows') ||
$this->fileExists($projectPath, '.gitlab-ci.yml') ||
$this->fileExists($projectPath, '.travis.yml') ||
$this->fileExists($projectPath, 'Jenkinsfile') ||
@@ -275,7 +275,7 @@ class GenericPlugin extends AbstractProjectPlugin
'CONTRIBUTING.md',
'CODE_OF_CONDUCT.md',
'SECURITY.md',
'.gitea/workflows/* or .gitea/workflows/* or .gitlab-ci.yml',
'.mokogitea/workflows/* or .gitea/workflows/* or .gitlab-ci.yml',
'docs/ or documentation/',
'tests/ or test/',
];
@@ -359,8 +359,8 @@ class GenericPlugin extends AbstractProjectPlugin
*/
private function hasCICD(string $projectPath): bool
{
return $this->fileExists($projectPath, '.gitea/workflows') ||
$this->fileExists($projectPath, '.gitea/workflows') ||
return $this->fileExists($projectPath, '.mokogitea/workflows') ||
$this->fileExists($projectPath, '.mokogitea/workflows') ||
$this->fileExists($projectPath, '.gitlab-ci.yml') ||
$this->fileExists($projectPath, '.travis.yml') ||
$this->fileExists($projectPath, 'Jenkinsfile') ||
+3 -3
View File
@@ -337,7 +337,7 @@ class MobilePlugin extends AbstractProjectPlugin
'App icons for all required sizes',
'Splash screen assets',
'tests/ or __tests__/',
'.gitea/workflows/* or .gitea/workflows/* or fastlane/',
'.mokogitea/workflows/* or .gitea/workflows/* or fastlane/',
'React Native: metro.config.js',
'Flutter: analysis_options.yaml',
'iOS: Podfile',
@@ -542,8 +542,8 @@ class MobilePlugin extends AbstractProjectPlugin
*/
private function hasCICD(string $projectPath): bool
{
return $this->fileExists($projectPath, '.gitea/workflows') ||
$this->fileExists($projectPath, '.gitea/workflows') ||
return $this->fileExists($projectPath, '.mokogitea/workflows') ||
$this->fileExists($projectPath, '.mokogitea/workflows') ||
$this->fileExists($projectPath, '.gitlab-ci.yml') ||
$this->fileExists($projectPath, 'fastlane') ||
$this->fileExists($projectPath, '.circleci');
+3 -3
View File
@@ -314,7 +314,7 @@ class NodeJsPlugin extends AbstractProjectPlugin
'.nvmrc or .node-version',
'.editorconfig',
'jest.config.js or vitest.config.js',
'.gitea/workflows/* or .gitea/workflows/* or .gitlab-ci.yml',
'.mokogitea/workflows/* or .gitea/workflows/* or .gitlab-ci.yml',
];
}
@@ -511,8 +511,8 @@ class NodeJsPlugin extends AbstractProjectPlugin
*/
private function hasCICD(string $projectPath): bool
{
return $this->fileExists($projectPath, '.gitea/workflows') ||
$this->fileExists($projectPath, '.gitea/workflows') ||
return $this->fileExists($projectPath, '.mokogitea/workflows') ||
$this->fileExists($projectPath, '.mokogitea/workflows') ||
$this->fileExists($projectPath, '.gitlab-ci.yml') ||
$this->fileExists($projectPath, '.travis.yml') ||
$this->fileExists($projectPath, '.circleci/config.yml');
+3 -3
View File
@@ -323,7 +323,7 @@ class PythonPlugin extends AbstractProjectPlugin
'pytest.ini or pyproject.toml',
'.python-version or .tool-versions',
'Dockerfile',
'.gitea/workflows/* or .gitea/workflows/* or .gitlab-ci.yml',
'.mokogitea/workflows/* or .gitea/workflows/* or .gitlab-ci.yml',
];
}
@@ -532,8 +532,8 @@ class PythonPlugin extends AbstractProjectPlugin
*/
private function hasCICD(string $projectPath): bool
{
return $this->fileExists($projectPath, '.gitea/workflows') ||
$this->fileExists($projectPath, '.gitea/workflows') ||
return $this->fileExists($projectPath, '.mokogitea/workflows') ||
$this->fileExists($projectPath, '.mokogitea/workflows') ||
$this->fileExists($projectPath, '.gitlab-ci.yml') ||
$this->fileExists($projectPath, '.travis.yml') ||
$this->fileExists($projectPath, 'tox.ini');
+3 -3
View File
@@ -125,13 +125,13 @@ class ProjectMetricsCollector
// CI/CD — check both .github/workflows and .gitea/workflows
$hasGithubWf = is_dir("{$path}/.github/workflows");
$hasGiteaWf = is_dir("{$path}/.gitea/workflows");
$hasGiteaWf = is_dir("{$path}/.mokogitea/workflows");
$this->collectedMetrics['has_ci_workflows'] = ($hasGithubWf || $hasGiteaWf) ? 1 : 0;
$this->collectedMetrics['workflow_count'] =
$this->countFiles("{$path}/.github/workflows", '*.yml') +
$this->countFiles("{$path}/.github/workflows", '*.yaml') +
$this->countFiles("{$path}/.gitea/workflows", '*.yml') +
$this->countFiles("{$path}/.gitea/workflows", '*.yaml');
$this->countFiles("{$path}/.mokogitea/workflows", '*.yml') +
$this->countFiles("{$path}/.mokogitea/workflows", '*.yaml');
}
private function collectNodeJSMetrics(string $path): void
+2 -2
View File
@@ -175,7 +175,7 @@ class RepositoryHealthChecker
// Check both .github/workflows and .gitea/workflows
$githubDir = "{$path}/.github/workflows";
$giteaDir = "{$path}/.gitea/workflows";
$giteaDir = "{$path}/.mokogitea/workflows";
$hasWorkflowDir = is_dir($githubDir) || is_dir($giteaDir);
$workflowDir = is_dir($giteaDir) ? $giteaDir : $githubDir;
@@ -212,7 +212,7 @@ class RepositoryHealthChecker
// Check for security scanning workflow (CodeQL on GitHub, Trivy on Gitea)
$githubWf = "{$path}/.github/workflows";
$giteaWf = "{$path}/.gitea/workflows";
$giteaWf = "{$path}/.mokogitea/workflows";
$hasSecurityScan = false;
if (is_dir($githubWf)) {
$hasSecurityScan = !empty(glob("{$githubWf}/*codeql*.yml")) || !empty(glob("{$githubWf}/*codeql*.yaml"));
+4 -4
View File
@@ -424,7 +424,7 @@ HCL;
/**
* Read the platform slug from the remote .mokostandards manifest.
* Checks .gitea/.mokostandards, .github/.mokostandards, and root .mokostandards.
* Checks .mokogitea/.mokostandards, .github/.mokostandards, and root .mokostandards.
*
* @return string|null Platform slug or null if not found/parseable
*/
@@ -435,7 +435,7 @@ HCL;
"{$metaDir}/.mokostandards",
'.mokostandards',
];
if ($metaDir === '.gitea') {
if ($metaDir === '.mokogitea') {
$paths[] = '.github/.mokostandards';
}
@@ -769,7 +769,7 @@ HCL;
* and convert legacy YAML-like format to the new XML manifest.
*
* Handles:
* 1. Location migration: root or .github/ → .gitea/.mokostandards
* 1. Location migration: root or .github/ → .mokogitea/.mokostandards
* 2. Format migration: legacy "platform: xxx" → XML manifest
* 3. Update existing XML: refresh <governance><last-synced> timestamp
*/
@@ -786,7 +786,7 @@ HCL;
// ── Collect existing files from all legacy locations ─────────
$legacySources = ['.mokostandards'];
if ($metaDir === '.gitea') {
if ($metaDir === '.mokogitea') {
$legacySources[] = '.github/.mokostandards';
}
+2 -2
View File
@@ -275,7 +275,7 @@ class WorkflowValidatorPlugin extends ValidationPlugin
public function validate(array $context): ValidationResult
{
$workflowDir = $context['workflow_dir']
?? (is_dir('.gitea/workflows') ? '.gitea/workflows' : '.github/workflows');
?? (is_dir('.mokogitea/workflows') ? '.mokogitea/workflows' : '.github/workflows');
if (!is_dir($workflowDir)) {
return new ValidationResult($this->name, true, 'No workflows directory');
@@ -286,7 +286,7 @@ class WorkflowValidatorPlugin extends ValidationPlugin
glob($workflowDir . '/*.yml') ?: [],
glob($workflowDir . '/*.yaml') ?: []
);
$altDir = ($workflowDir === '.gitea/workflows') ? '.github/workflows' : '.gitea/workflows';
$altDir = ($workflowDir === '.mokogitea/workflows') ? '.github/workflows' : '.mokogitea/workflows';
if (is_dir($altDir)) {
$workflows = array_merge($workflows,
glob($altDir . '/*.yml') ?: [],
@@ -31,7 +31,7 @@ use MokoEnterprise\CliFramework;
* - Required root files present (README.md, CHANGELOG.md, LICENSE, CONTRIBUTING.md,
* SECURITY.md, .gitignore, .editorconfig, composer.json)
* - Required directories present (src/, docs/, tests/)
* - .gitea/.mokostandards XML governance manifest present
* - .mokogitea/.mokostandards XML governance manifest present
* - SPDX-License-Identifier header present in all PHP source files
* - No tab characters in YAML/JSON config files
* - No Windows path separators in PHP source
@@ -73,16 +73,16 @@ class ValidateStructure extends CliFramework
// ── Governance attachment ─────────────────────────────────────────
$this->section('MokoStandards governance');
$mokoFile = file_exists("{$path}/.gitea/.mokostandards")
$mokoFile = file_exists("{$path}/.mokogitea/.mokostandards")
|| file_exists("{$path}/.github/.mokostandards")
|| file_exists("{$path}/.mokostandards");
$this->status($mokoFile, '.gitea/.mokostandards (XML manifest)');
$this->status($mokoFile, '.mokogitea/.mokostandards (XML manifest)');
$mokoFile ? $passed++ : $failed++;
// Validate XML format if file exists
if ($mokoFile) {
$manifestPath = file_exists("{$path}/.gitea/.mokostandards")
? "{$path}/.gitea/.mokostandards"
$manifestPath = file_exists("{$path}/.mokogitea/.mokostandards")
? "{$path}/.mokogitea/.mokostandards"
: (file_exists("{$path}/.github/.mokostandards")
? "{$path}/.github/.mokostandards"
: "{$path}/.mokostandards");
+1 -1
View File
@@ -72,7 +72,7 @@ $giteaAdapter = new GiteaAdapter($giteaClient);
assert_true($giteaAdapter instanceof GitPlatformAdapter, 'GiteaAdapter implements GitPlatformAdapter');
assert_true($giteaAdapter->getPlatformName() === 'gitea', 'getPlatformName() returns "gitea"');
assert_true($giteaAdapter->getBaseUrl() === 'https://git.mokoconsulting.tech/api/v1', 'getBaseUrl() returns Gitea API URL');
assert_true($giteaAdapter->getWorkflowDir() === '.gitea/workflows', 'getWorkflowDir() returns .gitea/workflows');
assert_true($giteaAdapter->getWorkflowDir() === '.mokogitea/workflows', 'getWorkflowDir() returns .gitea/workflows');
assert_true($giteaAdapter->getApiClient() === $giteaClient, 'getApiClient() returns injected client');
echo "\n";
+1 -1
View File
@@ -133,7 +133,7 @@ class RepoHealthChecker extends CliFramework
$cat = 'manifest';
$this->initCategory($cat, 'Manifest & Config', 15);
$this->addCheck($cat, '.gitea/.moko-platform manifest',
$this->addCheck($cat, '.mokogitea/.moko-platform manifest',
file_exists("{$p}/.gitea/.moko-platform"), 5);
$this->addCheck($cat, 'Workflows directory',
is_dir("{$p}/.gitea/workflows") || is_dir("{$p}/.github/workflows"), 5);
+1 -1
View File
@@ -30,7 +30,7 @@ class CheckStructure extends CliFramework
private const REQUIRED_DIRS = ['docs', 'scripts'];
/** @var list<string> At least one of these workflow directories must exist. */
private const WORKFLOW_DIRS = ['.github/workflows', '.gitea/workflows'];
private const WORKFLOW_DIRS = ['.github/workflows', '.mokogitea/workflows'];
/** @var list<string> Required file paths (relative to repo root). */
private const REQUIRED_FILES = ['README.md', 'LICENSE', 'CONTRIBUTING.md', 'SECURITY.md'];
+1 -1
View File
@@ -115,7 +115,7 @@ class CheckVersionConsistency extends CliFramework
// Check both .github/workflows and .gitea/workflows
$workflowFiles = [];
foreach (['.github/workflows', '.gitea/workflows'] as $wfDir) {
foreach (['.github/workflows', '.mokogitea/workflows'] as $wfDir) {
$dir = $path . '/' . $wfDir;
if (is_dir($dir)) {
$workflowFiles = array_merge($workflowFiles, glob($dir . '/*.yml') ?: []);
+1 -1
View File
@@ -269,7 +269,7 @@ class DriftScanner extends CliFramework
// Check workflows — scan both .github/workflows and .gitea/workflows
$drift = $this->checkFileCategory($org, $repo, 'workflows', '.github/workflows', $drift, $protectedFiles, $syncExclusions);
$drift = $this->checkFileCategory($org, $repo, 'workflows_gitea', '.gitea/workflows', $drift, $protectedFiles, $syncExclusions);
$drift = $this->checkFileCategory($org, $repo, 'workflows_gitea', '.mokogitea/workflows', $drift, $protectedFiles, $syncExclusions);
// Check GitHub configs
$drift = $this->checkFileCategory($org, $repo, 'github', '.github', $drift, $protectedFiles, $syncExclusions);