diff --git a/package-lock.json b/package-lock.json index 2aad6f7..eb83d6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "markdownlint-cli2": "^0.22.0", "tsup": "^8.0.2", "tsx": "^4.7.1", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "vitest": "^4.1.2" }, "engines": { @@ -3277,9 +3277,9 @@ } }, "node_modules/postcss": { - "version": "8.5.8", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.8.tgz", - "integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==", + "version": "8.5.10", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.10.tgz", + "integrity": "sha512-pMMHxBOZKFU6HgAZ4eyGnwXF/EvPGGqUr0MnZ5+99485wwW41kW91A4LOGxSHhgugZmSChL5AlElNdwlNgcnLQ==", "dev": true, "funding": [ { @@ -3825,9 +3825,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -4112,4 +4112,4 @@ } } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index c9ddd4a..1b0579d 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "markdownlint-cli2": "^0.22.0", "tsup": "^8.0.2", "tsx": "^4.7.1", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "vitest": "^4.1.2" }, "license": "Apache-2.0", diff --git a/src/cli.ts b/src/cli.ts index 2b800f0..4f9bc4e 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1021,9 +1021,11 @@ function exitWithStartupError(error: CliError): never { process.stdout.write(`${JSON.stringify(payload)}\n`); } process.exit(error.exitCode); + throw new Error("Unreachable after process.exit"); } process.stderr.write(`${error.message}\n`); process.exit(error.exitCode); + throw new Error("Unreachable after process.exit"); } function writeOutputOrThrow(content: string, output?: string): void { @@ -1064,6 +1066,7 @@ function emitUnhandledCliError(error: unknown): never { process.stdout.write(`${JSON.stringify(payload)}\n`); } process.exit(resolved.exitCode); + throw new Error("Unreachable after process.exit"); } // Non-JSON mode: agent formatting or plain text @@ -1071,10 +1074,12 @@ function emitUnhandledCliError(error: unknown): never { const help = getErrorHelp(resolved.code, resolved.message); process.stderr.write(`${formatAgentError(help, true)}\n`); process.exit(resolved.exitCode); + throw new Error("Unreachable after process.exit"); } process.stderr.write(`${resolved.message}\n`); process.exit(resolved.exitCode); + throw new Error("Unreachable after process.exit"); } const startupArgv = hideBin(process.argv); @@ -1143,7 +1148,7 @@ cli .option("timeout", { type: "number", default: 15000 }) .option("retries", { type: "number", default: 2 }) .option("retry-backoff", { type: "number", default: 400 }) - .check((args) => { + .check((args: Arguments) => { const globals = args as unknown as CliGlobals; // Always validate URL format (not just when network is enabled) // This catches invalid URLs even in preview mode @@ -1738,7 +1743,7 @@ cli .recommendCommands() .demandCommand(1) .exitProcess(false) - .fail((msg, err, y) => { + .fail((msg: string | null | undefined, err: Error | undefined, y: Argv) => { const message = err?.message ?? msg ?? "Unexpected error"; const isUsageError = !err || (err as { name?: string }).name === "YError" || (err instanceof CliError && err.exitCode === 2); @@ -1784,4 +1789,4 @@ void (async () => { } catch (error) { emitUnhandledCliError(error); } -})(); \ No newline at end of file +})(); diff --git a/src/output.ts b/src/output.ts index 6b745a6..a40de46 100644 --- a/src/output.ts +++ b/src/output.ts @@ -100,7 +100,7 @@ function resolveCliVersion(): string { const envVersion = process.env.npm_package_version?.trim(); if (envVersion) { cachedVersion = envVersion; - return cachedVersion; + return envVersion; } try { @@ -109,8 +109,9 @@ function resolveCliVersion(): string { const raw = fs.readFileSync(packagePath, "utf8"); const parsed = JSON.parse(raw) as { version?: string }; if (parsed.version && parsed.version.trim().length > 0) { - cachedVersion = parsed.version.trim(); - return cachedVersion; + const packageVersion = parsed.version.trim(); + cachedVersion = packageVersion; + return packageVersion; } } catch (error) { // no-op: fall back to default version diff --git a/tsconfig.json b/tsconfig.json index bedfd8d..15807f8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,8 @@ "exactOptionalPropertyTypes": true, "esModuleInterop": true, "skipLibCheck": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "types": ["node"] }, "include": ["src", "tests"] }