eust-w 0ef99b1e6d style: add Prettier and EditorConfig, format the codebase
Adds prettier 3.9.8 (exact) with a shared config (single quotes,
120 columns, trailing commas), .prettierignore, .editorconfig and the
`format` / `format:check` scripts, then formats all TypeScript,
JavaScript, CSS, JSON and YAML sources.

Purely mechanical: no behaviour change. Typecheck passes, the vitest
suite and the 74 IDE node tests produce the same results as before
(socket-binding tests still cannot run inside this sandbox).
Previously the longest source line was ~3000 characters; reviewing the
following semantic changes now produces readable diffs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:32:43 +08:00

101 lines
2.8 KiB
JavaScript

import assert from 'node:assert/strict';
import { spawnSync } from 'node:child_process';
import { fileURLToPath } from 'node:url';
const compose = fileURLToPath(new URL('../compose.yaml', import.meta.url));
const dockerArgs = process.env.WF_DOCKER_CONTEXT ? ['--context', process.env.WF_DOCKER_CONTEXT] : [];
function docker(...args) {
const result = spawnSync('docker', [...dockerArgs, 'compose', '-f', compose, ...args], {
encoding: 'utf8',
timeout: 30000,
});
if (result.status !== 0) throw new Error(result.stderr || result.error?.message || `docker exited ${result.status}`);
return result.stdout;
}
async function get(url) {
const response = await fetch(url, { signal: AbortSignal.timeout(10000) });
assert.equal(response.status, 200, `${url}: expected 200, got ${response.status}`);
return response;
}
const checks = [
[
'postgres',
async () =>
assert.match(
docker(
'exec',
'-T',
'postgres',
'psql',
'-U',
'wishforge',
'-d',
'wishforge',
'-Atc',
'SELECT current_database()',
),
/^wishforge\s*$/,
),
],
[
'temporal gRPC',
async () =>
assert.match(
docker('exec', '-T', 'temporal', 'temporal', 'operator', 'cluster', 'health', '--address', '127.0.0.1:7233'),
/SERVING/,
),
],
[
'temporal UI',
async () => {
await get('http://127.0.0.1:8233');
},
],
[
'OIDC discovery',
async () => {
const metadata = await (
await get('http://127.0.0.1:4100/realms/wishforge/.well-known/openid-configuration')
).json();
assert.equal(metadata.issuer, 'http://127.0.0.1:4100/realms/wishforge');
assert.ok(metadata.code_challenge_methods_supported.includes('S256'));
assert.equal(metadata.authorization_response_iss_parameter_supported, true);
},
],
[
'S3 health',
async () => {
await get('http://127.0.0.1:49000/minio/health/ready');
},
],
[
'registry v2',
async () => {
await get('http://127.0.0.1:45000/v2/');
},
],
];
if (process.argv.includes('--ide'))
checks.push([
'OCT metadata',
async () => {
const metadata = await (await get('http://127.0.0.1:48100/api/meta')).json();
assert.equal(metadata.version, '0.3.1');
assert.ok(metadata.transports.includes('socket.io'));
},
]);
let failed = 0;
for (const [name, check] of checks) {
try {
await check();
console.log(`PASS ${name}`);
} catch (error) {
failed++;
console.error(`FAIL ${name}: ${error.message}`);
}
}
console.log(
`${checks.length - failed}/${checks.length} infrastructure checks passed. These checks do not verify production isolation or desktop-client OAuth.`,
);
process.exitCode = failed ? 1 : 0;