cai-exos-systems/daveadmin-exos-demo:api/tool-registry.php
api/tool-registry.php
```text
<?php
declare(strict_types=1);
require_once dirname(__DIR__) . '/auth.php';
demoRequireApiLogin();
if ($_SERVER['REQUEST_METHOD'] !== 'GET') {
http_response_code(405);
header('Content-Type: application/json; charset=UTF-8');
echo json_encode(['error' => 'Method not allowed']);
exit;
}
$registryPath = (string)demoEnv(
'EXOS_TOOL_REGISTRY_FILE',
demoSupportDir() . DIRECTORY_SEPARATOR . 'tool-creator-registry.json'
);
$registry = [];
if (is_file($registryPath)) {
$decoded = json_decode((string)file_get_contents($registryPath), true);
if (is_array($decoded)) {
$registry = $decoded;
}
}
$items = array_map(static function (array $entry): array {
return [
'id' => $entry['id'] ?? '',
'created_at' => $entry['created_at'] ?? '',
'toolset_name' => $entry['toolset_name'] ?? '',
'mission' => $entry['mission'] ?? '',
'customer' => $entry['customer'] ?? '',
'target_domains' => $entry['target_domains'] ?? [],
'tmf_apis_used' => $entry['tmf_apis_used'] ?? [],
'tool_count' => $entry['tool_count'] ?? 0,
'adapter_count' => $entry['adapter_count'] ?? 0,
'factory_status' => $entry['factory_status'] ?? 'not_configured',
'factory_stats' => $entry['factory_stats'] ?? null,
'exports' => $entry['exports'] ?? [],
];
}, array_slice($registry, 0, 20));
header('Content-Type: application/json; charset=UTF-8');
echo json_encode(['data' => $items], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
```