Files
moko-platform/cli/platform_detect.php
T
Jonathan Miller 0f7eac971f feat: add templates, cli, docs, and Gitea-first platform updates
- Add cli/, build/, release/ directories (previously in MokoStandards/api/)
- Add templates/ with workflow templates, configs, github/gitea issue templates
- Add docs/api/, docs/workflows/, docs/automation/ documentation
- Update all REPO headers to MokoStandards-API
- Update all api/definitions/ paths to definitions/ (no api/ prefix)
- Set default platform to gitea, token to GA_TOKEN
- Add syncUpdatesBetweenPlatforms() to PlatformAdapterFactory
- Update RepositorySynchronizer for new template paths
- Convert workflow template DEFGROUP to Gitea.Workflow
- Update README with full repo description and platform config

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 21:11:20 -05:00

42 lines
1.0 KiB
PHP

#!/usr/bin/env php
<?php
/* Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* FILE INFORMATION
* DEFGROUP: MokoStandards.CLI
* INGROUP: MokoStandards
* REPO: https://git.mokoconsulting.tech/mokoconsulting-tech/MokoStandards-API
* PATH: /cli/platform_detect.php
* VERSION: 04.06.00
* BRIEF: Detect platform from .mokostandards file — outputs platform string
*/
declare(strict_types=1);
$path = '.';
foreach ($argv as $i => $arg) {
if ($arg === '--path' && isset($argv[$i + 1])) $path = $argv[$i + 1];
}
$root = realpath($path) ?: $path;
// Check .github/.mokostandards first, fallback to root
$file = "{$root}/.github/.mokostandards";
if (!file_exists($file)) {
$file = "{$root}/.mokostandards";
}
if (!file_exists($file)) {
echo "unknown\n";
exit(0);
}
$content = file_get_contents($file);
if (preg_match('/^platform:\s*(.+)/m', $content, $m)) {
echo trim($m[1], " \t\n\r\"'") . "\n";
} else {
echo "unknown\n";
}
exit(0);