mirror of
https://github.com/getpaseo/paseo.git
synced 2026-12-01 04:36:26 +00:00
* perf(cli): cut CLI startup overhead with lean client, lazy dispatch, and esbuild bundling - Add lean protocol codec and @getpaseo/client/node/lean entry that skip ws-outbound.aot.js and full Zod message schemas, and dynamically import @getpaseo/relay only for pairing-offer/E2EE targets - Replace eager command imports in packages/cli/src/cli.ts with a static command manifest + lazy dynamic imports, remove duplicate createCli() in run.ts, and lazy-load yaml/chalk in output rendering - Extract zero-Zod PID, home, and credential helpers to @getpaseo/server/daemon-files - Bundle @getpaseo/cli with esbuild code splitting (--splitting --format=esm --minify) and update scripts/trace-daemon.mjs - Fast-path complete agent UUIDs in resolveAgentEntry() via fetchAgent() without paginating archived agents * fix(client): generate zero-Zod schema defaults for lean protocol codec - Generate message-defaults.ts from Zod protocol schemas inside generate-validation-aot.mjs (50 outbound + 11 inbound tables, agent snapshot defaults, legacy transform fallbacks, and hello.rejected reasons) - Apply generated defaults in leanProtocolCodec so older daemons get the same defaulted fields as strictProtocolCodec without loading Zod or ws-outbound.aot.js - Add strict-vs-lean parity tests across legacy outbound, inbound, and status payloads - Deduplicate sync/async CLI renderer dispatch between render.ts and render-async.ts - Switch startup-boundary runtime hook test to module.registerHooks + synchronous stderr flush and it.skipIf for missing dist * fix(protocol): support prefault and reject unlisted non-pure schemas in defaults generator - Support Zod .prefault() nodes directly in message-defaults.ts (e.g., pull_request_timeline_response with omitted payload) - Fail generate:validators loudly if any new .catch() or .transform()/.preprocess() schema is added without a lean rule or explicit legacy allowlist entry - Add pull_request_timeline_response omitted-payload parity test to lean.test.ts
56 lines
1.8 KiB
JavaScript
56 lines
1.8 KiB
JavaScript
// Bundles @getpaseo/cli into a thin ESM entrypoint plus lazy code-split command chunks.
|
|
// Keeps @getpaseo/server/daemon-files bundled for zero-Zod thin RPC startup while leaving
|
|
// @getpaseo/server and its heavy subpaths external so daemon spawning and heavy commands
|
|
// resolve from the installed @getpaseo/server package.
|
|
|
|
import { readFile, rm } from "node:fs/promises";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { build } from "esbuild";
|
|
|
|
const packageRoot = fileURLToPath(new URL("..", import.meta.url));
|
|
const outDir = path.join(packageRoot, "dist");
|
|
const pkg = JSON.parse(await readFile(path.join(packageRoot, "package.json"), "utf8"));
|
|
|
|
const externalServerExceptDaemonFiles = {
|
|
name: "external-server-except-daemon-files",
|
|
setup(buildContext) {
|
|
buildContext.onResolve({ filter: /^@getpaseo\/server(\/.*)?$/ }, (args) => {
|
|
if (args.path === "@getpaseo/server/daemon-files") {
|
|
return null;
|
|
}
|
|
return { path: args.path, external: true };
|
|
});
|
|
},
|
|
};
|
|
|
|
await rm(outDir, { recursive: true, force: true });
|
|
|
|
await build({
|
|
entryPoints: {
|
|
index: path.join(packageRoot, "src/index.ts"),
|
|
},
|
|
outdir: outDir,
|
|
bundle: true,
|
|
splitting: true,
|
|
format: "esm",
|
|
minify: true,
|
|
platform: "node",
|
|
target: "node22",
|
|
chunkNames: "chunks/[name]-[hash]",
|
|
define: {
|
|
__PASEO_CLI_VERSION__: JSON.stringify(pkg.version),
|
|
},
|
|
external: [
|
|
// Optional native addons probed by `ws` at runtime.
|
|
"bufferutil",
|
|
"utf-8-validate",
|
|
],
|
|
plugins: [externalServerExceptDaemonFiles],
|
|
// Bundled CommonJS dependencies (`commander`, `ws`) call require() for Node built-ins.
|
|
banner: {
|
|
js: 'import { createRequire as __paseoCliCreateRequire } from "node:module"; const require = __paseoCliCreateRequire(import.meta.url);',
|
|
},
|
|
logLevel: "warning",
|
|
});
|