style: fix format issues (#255)

This commit is contained in:
Carlos Florêncio
2026-02-19 22:18:01 +00:00
committed by GitHub
parent fe9298a7ad
commit 61ef224ec7
753 changed files with 35129 additions and 21169 deletions
+5 -5
View File
@@ -30,11 +30,11 @@ export async function runDev({ repoRoot, backendPort, webPort }: DevOptions): Pr
const supervisor = createProcessSupervisor();
supervisor.attachSignalHandlers();
const backendProc = spawn(
"make",
["-C", path.join("apps", "backend"), "dev"],
{ cwd: repoRoot, env: backendEnv, stdio: "inherit" },
);
const backendProc = spawn("make", ["-C", path.join("apps", "backend"), "dev"], {
cwd: repoRoot,
env: backendEnv,
stdio: "inherit",
});
supervisor.children.push(backendProc);
attachBackendExitHandler(backendProc, supervisor);
+1 -6
View File
@@ -3,12 +3,7 @@ import { execSync } from "node:child_process";
const isWindows = process.platform === "win32";
export type PlatformArch = "x64" | "arm64";
export type PlatformDir =
| "linux-x64"
| "linux-arm64"
| "macos-x64"
| "macos-arm64"
| "windows-x64";
export type PlatformDir = "linux-x64" | "linux-arm64" | "macos-x64" | "macos-arm64" | "windows-x64";
export function getBinaryName(base: string): string {
return isWindows ? `${base}.exe` : base;
+2 -5
View File
@@ -32,10 +32,7 @@ export type PortConfig = {
* @param webPort - Optional preferred web port
* @returns Resolved ports for all services
*/
export async function pickPorts(
backendPort?: number,
webPort?: number,
): Promise<PortConfig> {
export async function pickPorts(backendPort?: number, webPort?: number): Promise<PortConfig> {
const resolvedBackendPort = backendPort ?? (await pickAvailablePort(DEFAULT_BACKEND_PORT));
const resolvedWebPort = webPort ?? (await pickAvailablePort(DEFAULT_WEB_PORT));
const agentctlPort = await pickAvailablePort(DEFAULT_AGENTCTL_PORT);
@@ -165,7 +162,7 @@ export function attachBackendExitHandler(
): void {
backendProc.on("exit", (code, signal) => {
console.error(`[kandev] backend exited (code=${code}, signal=${signal})`);
const exitCode = signal ? 0 : code ?? 1;
const exitCode = signal ? 0 : (code ?? 1);
void supervisor.shutdown("backend exit").then(() => process.exit(exitCode));
});
}
+10 -7
View File
@@ -19,12 +19,7 @@ import { DATA_DIR, HEALTH_TIMEOUT_MS_RELEASE } from "./constants";
import { resolveHealthTimeoutMs, waitForHealth } from "./health";
import { getBinaryName } from "./platform";
import { createProcessSupervisor } from "./process";
import {
attachBackendExitHandler,
buildBackendEnv,
buildWebEnv,
pickPorts,
} from "./shared";
import { attachBackendExitHandler, buildBackendEnv, buildWebEnv, pickPorts } from "./shared";
import { launchWebApp } from "./web";
export type StartOptions = {
@@ -68,7 +63,15 @@ export async function runStart({
}
// Check for standalone build (Next.js standalone output)
const webServerPath = path.join(repoRoot, "apps", "web", ".next", "standalone", "web", "server.js");
const webServerPath = path.join(
repoRoot,
"apps",
"web",
".next",
"standalone",
"web",
"server.js",
);
if (!fs.existsSync(webServerPath)) {
throw new Error("Web standalone build not found. Run `make build` first.");
}
+16 -18
View File
@@ -4,24 +4,20 @@ import readline from "node:readline";
function requestJson<T>(url: string): Promise<T> {
return new Promise((resolve, reject) => {
const req = https.get(
url,
{ headers: { "User-Agent": "kandev-npx" } },
(res) => {
if (res.statusCode !== 200) {
return reject(new Error(`HTTP ${res.statusCode} fetching ${url}`));
const req = https.get(url, { headers: { "User-Agent": "kandev-npx" } }, (res) => {
if (res.statusCode !== 200) {
return reject(new Error(`HTTP ${res.statusCode} fetching ${url}`));
}
let body = "";
res.on("data", (chunk) => (body += chunk));
res.on("end", () => {
try {
resolve(JSON.parse(body) as T);
} catch {
reject(new Error(`Failed to parse JSON from ${url}`));
}
let body = "";
res.on("data", (chunk) => (body += chunk));
res.on("end", () => {
try {
resolve(JSON.parse(body) as T);
} catch {
reject(new Error(`Failed to parse JSON from ${url}`));
}
});
},
);
});
});
req.setTimeout(5000, () => {
req.destroy(new Error(`Request timed out fetching ${url}`));
});
@@ -61,7 +57,9 @@ function promptYesNo(question: string, defaultYes = false): Promise<boolean> {
const suffix = defaultYes ? "[Y/n]" : "[y/N]";
rl.question(`${question} ${suffix} `, (answer: string) => {
rl.close();
const normalized = String(answer || "").trim().toLowerCase();
const normalized = String(answer || "")
.trim()
.toLowerCase();
if (!normalized) {
resolve(Boolean(defaultYes));
return;
+3 -10
View File
@@ -7,9 +7,7 @@ let _isWSL: boolean | undefined;
function isWSL(): boolean {
if (_isWSL === undefined) {
try {
_isWSL = readFileSync("/proc/version", "utf8")
.toLowerCase()
.includes("microsoft");
_isWSL = readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft");
} catch {
_isWSL = false;
}
@@ -34,12 +32,7 @@ export function openBrowser(url: string) {
return;
}
const useCmd = process.platform === "win32" || isWSL();
const opener =
process.platform === "darwin"
? "open"
: useCmd
? "cmd.exe"
: "xdg-open";
const opener = process.platform === "darwin" ? "open" : useCmd ? "cmd.exe" : "xdg-open";
const args = useCmd ? ["/c", "start", "", url] : [url];
try {
const child = spawn(opener, args, { stdio: "ignore", detached: true });
@@ -71,7 +64,7 @@ export function launchWebApp({
proc.on("exit", (code, signal) => {
console.error(`[kandev] ${label} exited (code=${code}, signal=${signal})`);
const exitCode = signal ? 0 : code ?? 1;
const exitCode = signal ? 0 : (code ?? 1);
void supervisor.shutdown(`${label} exit`).then(() => process.exit(exitCode));
});