refactor(deadcode): delete package and script exports (#105776)

Refs #105733
This commit is contained in:
Peter Steinberger
2026-07-12 17:24:45 -07:00
committed by GitHub
parent 55067fd5e7
commit 867284dfa3
31 changed files with 184 additions and 251 deletions
+12 -2
View File
@@ -195,11 +195,21 @@ const config = {
project: ["src/**/*.ts!"],
},
"packages/gateway-client": {
entry: ["src/index.ts!"],
// Mirror package.json exports; these subpaths are published surfaces.
entry: ["src/index.ts!", "src/readiness.ts!", "src/timeouts.ts!"],
project: ["src/**/*.ts!"],
},
"packages/gateway-protocol": {
entry: ["src/index.ts!", "src/schema.ts!"],
// Mirror package.json exports; these subpaths are published surfaces.
entry: [
"src/index.ts!",
"src/client-info.ts!",
"src/connect-error-details.ts!",
"src/frame-guards.ts!",
"src/schema.ts!",
"src/startup-unavailable.ts!",
"src/version.ts!",
],
project: ["src/**/*.ts!"],
},
"packages/net-policy": {
@@ -98,6 +98,7 @@ function isThinkingPart(part: Pick<Part, "thought" | "thoughtSignature">): boole
*
* Note: this does NOT merge or move signatures across distinct response parts. It only prevents
* a signature from being overwritten with `undefined` within the same streamed block.
* @internal Directly tested provider implementation detail.
*/
export function retainThoughtSignature(
existing: string | undefined,
@@ -134,6 +135,7 @@ function resolveThoughtSignature(
/**
* Models via Google APIs that require explicit tool call IDs in function calls/responses.
* @internal Directly tested provider implementation detail.
*/
export function requiresToolCallId(modelId: string): boolean {
return modelId.startsWith("claude-") || modelId.startsWith("gpt-oss-");
@@ -158,6 +160,7 @@ function supportsMultimodalFunctionResponse(modelId: string): boolean {
/**
* Convert internal messages to Gemini Content[] format.
* @internal Directly tested provider implementation detail.
*/
export function convertMessages<T extends GoogleApiType>(
model: Model<T>,
@@ -375,6 +378,7 @@ function sanitizeForOpenApi(schema: unknown): unknown {
* anyOf, oneOf, const, etc.). Set `useParameters` to true to use the legacy `parameters`
* field instead (OpenAPI 3.03 Schema). This is needed for Cloud Code Assist with Claude
* models, where the API translates `parameters` into Anthropic's `input_schema`.
* @internal Directly tested provider implementation detail.
*/
export function convertTools(
tools: Tool[],
@@ -398,6 +402,7 @@ export function convertTools(
/**
* Map tool choice string to Gemini FunctionCallingConfigMode.
* @internal Directly tested provider implementation detail.
*/
export function mapToolChoice(choice: string): FunctionCallingConfigMode {
switch (choice) {
@@ -615,6 +620,7 @@ export function getDisabledGoogleThinkingConfig<T extends GoogleApiType>(
return { thinkingBudget: 0 };
}
/** @internal Directly tested provider implementation detail. */
export function isGemma4Model<T extends GoogleApiType>(model: Model<T>): boolean {
return /gemma-?4/.test(model.id.toLowerCase());
}
@@ -710,6 +716,7 @@ function getGoogleBudget<T extends GoogleApiType>(
/**
* Map Gemini FinishReason to our StopReason.
* @internal Directly tested provider implementation detail.
*/
export function mapStopReason(reason: FinishReason): StopReason {
switch (reason) {
@@ -740,6 +747,7 @@ export function mapStopReason(reason: FinishReason): StopReason {
}
}
/** @internal Directly tested provider implementation detail. */
export async function consumeGoogleGenerateContentStream<T extends GoogleApiType>(params: {
chunks: AsyncIterable<GenerateContentResponse>;
model: Model<T>;
+2 -2
View File
@@ -5,12 +5,12 @@ import type { GatewayEvent } from "./types.js";
type Listener<T> = (event: T) => void;
/** Replay settings for EventHub streams. */
export type EventHubOptions = {
type EventHubOptions = {
replayLimit?: number;
};
/** Per-stream options for including replayed events. */
export type EventStreamOptions = {
type EventStreamOptions = {
replay?: boolean;
};
+1 -1
View File
@@ -22,7 +22,7 @@ type GatewayClientLike = {
const RAW_EVENT_REPLAY_LIMIT = 1000;
/** Options passed through to the Gateway websocket client. */
export type GatewayClientTransportOptions = {
type GatewayClientTransportOptions = {
url?: string;
connectChallengeTimeoutMs?: number;
preauthHandshakeTimeoutMs?: number;
+2 -5
View File
@@ -113,7 +113,7 @@ type TtsUserPrefs = {
};
};
export type TtsAttemptReasonCode =
type TtsAttemptReasonCode =
| "success"
| "no_provider_registered"
| "not_configured"
@@ -122,7 +122,7 @@ export type TtsAttemptReasonCode =
| "timeout"
| "provider_error";
export type TtsProviderAttempt = {
type TtsProviderAttempt = {
provider: string;
outcome: "success" | "skipped" | "failed";
reasonCode: TtsAttemptReasonCode;
@@ -2136,6 +2136,3 @@ export const testApi = {
formatTtsProviderError,
sanitizeTtsErrorForLog,
};
/** @deprecated Use `testApi`. */
export { testApi as _test };
-1
View File
@@ -27,7 +27,6 @@ export type DetectChangedLanesOptions = {
packageJsonChangeKind?: "liveDockerTooling" | "tooling" | null;
};
export function normalizeChangedPath(inputPath: unknown): string;
export function createEmptyChangedLanes(): ChangedLanes;
export function isChangedLaneTestPath(changedPath: string): boolean;
export function detectChangedLanes(
+8 -1
View File
@@ -5,7 +5,6 @@ import { booleanFlag, parseFlagArgs, stringFlag } from "./lib/arg-utils.mjs";
import { getChangedPathFacts, normalizeChangedPath } from "./lib/changed-path-facts.mjs";
import { isDirectRunUrl } from "./lib/direct-run.mjs";
import { resolveMergeHeadDiffBase } from "./lib/merge-head-diff-base.mjs";
export { normalizeChangedPath } from "./lib/changed-path-facts.mjs";
const GIT_OUTPUT_MAX_BUFFER = 64 * 1024 * 1024;
const IMPLAUSIBLE_NO_MERGE_BASE_DIFF_PATHS = 200;
@@ -15,6 +14,7 @@ const SCRIPTS_TYPECHECK_PATH_RE =
/^(?:scripts\/.*\.(?:[cm]?ts|[cm]?tsx)|tsconfig\.scripts\.json)$/u;
const TEST_ROOT_TYPECHECK_PATH_RE =
/^(?:test\/(?!fixtures\/).*\.(?:[cm]?ts|[cm]?tsx)|test\/tsconfig\/tsconfig\.test\.root\.json)$/u;
/** @internal Shared repository-script contract. */
export const LIVE_DOCKER_AUTH_SHELL_TARGETS = [
"scripts/lib/live-docker-auth.sh",
"scripts/test-live-acp-bind-docker.sh",
@@ -35,6 +35,7 @@ const PUBLIC_EXTENSION_CONTRACT_RE =
/^(?:src\/plugin-sdk\/|src\/plugins\/contracts\/|src\/channels\/plugins\/|scripts\/lib\/plugin-sdk-entrypoints\.json$|scripts\/sync-plugin-sdk-exports\.mjs$|scripts\/generate-plugin-sdk-api-baseline\.ts$)/u;
/**
* Files whose changes are treated as release metadata only.
* @internal Shared repository-script contract.
*/
export const RELEASE_METADATA_PATHS = new Set([
"CHANGELOG.md",
@@ -63,6 +64,7 @@ export const RELEASE_METADATA_PATHS = new Set([
/**
* Creates the default changed-lanes result object.
* @internal Directly tested script implementation detail.
*/
export function createEmptyChangedLanes() {
return {
@@ -82,6 +84,7 @@ export function createEmptyChangedLanes() {
};
}
/** @internal Shared repository-script contract. */
export function isChangedLaneTestPath(changedPath) {
return getChangedPathFacts(normalizeChangedPath(changedPath)).isChangedLaneTest;
}
@@ -93,6 +96,7 @@ export function isChangedLaneTestPath(changedPath) {
*/
/**
* Classifies a list of changed paths into docs, app, extension, core, and tooling lanes.
* @internal Shared repository-script contract.
*/
export function detectChangedLanes(changedPaths, options = {}) {
const paths = [...new Set(changedPaths.map(normalizeChangedPath).filter(Boolean))]
@@ -257,6 +261,7 @@ export function detectChangedLanes(changedPaths, options = {}) {
*/
/**
* Classifies changed paths with optional package.json before/after contents.
* @internal Shared repository-script contract.
*/
export function detectChangedLanesForPaths(params) {
const base = params.staged
@@ -394,6 +399,7 @@ function classifyPackageJsonChangeFromGit(params) {
/**
* Checks whether package scripts changed only live Docker script entries.
* @internal Directly tested script implementation detail.
*/
export function isLiveDockerPackageScriptOnlyChange(before, after) {
const beforePackage = JSON.parse(before);
@@ -411,6 +417,7 @@ export function isLiveDockerPackageScriptOnlyChange(before, after) {
/**
* Checks whether package.json changes are limited to scripts.
* @internal Directly tested script implementation detail.
*/
export function isPackageScriptOnlyChange(before, after) {
const beforePackage = JSON.parse(before);
+1
View File
@@ -33,6 +33,7 @@ function shouldCopyBundledPluginMetadata(id, env, buildablePluginDirs) {
/**
* Rewrites package extension entries for bundled metadata output.
* @internal Directly tested script implementation detail.
*/
export function rewritePackageExtensions(entries) {
if (!Array.isArray(entries)) {
-120
View File
@@ -1864,126 +1864,6 @@ export const KNIP_UNUSED_EXPORT_BASELINE = [
"extensions/zalouser/src/zca-client.ts: Reactions",
"extensions/zalouser/src/zca-client.ts: Style",
"extensions/zalouser/src/zca-client.ts: ThreadType",
"packages/ai/src/providers/google-shared.ts: consumeGoogleGenerateContentStream",
"packages/ai/src/providers/google-shared.ts: convertMessages",
"packages/ai/src/providers/google-shared.ts: convertTools",
"packages/ai/src/providers/google-shared.ts: isGemma4Model",
"packages/ai/src/providers/google-shared.ts: mapStopReason",
"packages/ai/src/providers/google-shared.ts: mapToolChoice",
"packages/ai/src/providers/google-shared.ts: requiresToolCallId",
"packages/ai/src/providers/google-shared.ts: retainThoughtSignature",
"packages/gateway-client/src/timeouts.ts: clampConnectChallengeTimeoutMs",
"packages/gateway-client/src/timeouts.ts: DEFAULT_PREAUTH_HANDSHAKE_TIMEOUT_MS",
"packages/gateway-client/src/timeouts.ts: getConnectChallengeTimeoutMsFromEnv",
"packages/gateway-client/src/timeouts.ts: getPreauthHandshakeTimeoutMsFromEnv",
"packages/gateway-client/src/timeouts.ts: MAX_CONNECT_CHALLENGE_TIMEOUT_MS",
"packages/gateway-client/src/timeouts.ts: MIN_CONNECT_CHALLENGE_TIMEOUT_MS",
"packages/gateway-protocol/src/client-info.ts: GatewayClientCap",
"packages/gateway-protocol/src/client-info.ts: GatewayClientId",
"packages/gateway-protocol/src/client-info.ts: GatewayClientInfo",
"packages/gateway-protocol/src/connect-error-details.ts: ConnectErrorDetailCode",
"packages/gateway-protocol/src/connect-error-details.ts: ConnectPairingRequiredReasons",
"packages/gateway-protocol/src/connect-error-details.ts: ConnectRecoveryNextStep",
"packages/gateway-protocol/src/connect-error-details.ts: PairingConnectErrorDetails",
"packages/gateway-protocol/src/frame-guards.ts: GatewayFrame",
"packages/gateway-protocol/src/frame-guards.ts: ResponseFrame",
"packages/gateway-protocol/src/schema/frames.ts: GatewayFrame",
"packages/gateway-protocol/src/startup-unavailable.ts: GATEWAY_STARTUP_UNAVAILABLE_REASON",
"packages/gateway-protocol/src/startup-unavailable.ts: GatewayStartupUnavailableDetails",
"packages/sdk/src/event-hub.ts: EventHubOptions",
"packages/sdk/src/event-hub.ts: EventStreamOptions",
"packages/sdk/src/transport.ts: GatewayClientTransportOptions",
"packages/speech-core/src/tts.ts: _test",
"packages/speech-core/src/tts.ts: TtsAttemptReasonCode",
"packages/speech-core/src/tts.ts: TtsProviderAttempt",
"scripts/changed-lanes.mjs: createEmptyChangedLanes",
"scripts/changed-lanes.mjs: detectChangedLanes",
"scripts/changed-lanes.mjs: detectChangedLanesForPaths",
"scripts/changed-lanes.mjs: isChangedLaneTestPath",
"scripts/changed-lanes.mjs: isLiveDockerPackageScriptOnlyChange",
"scripts/changed-lanes.mjs: isPackageScriptOnlyChange",
"scripts/changed-lanes.mjs: LIVE_DOCKER_AUTH_SHELL_TARGETS",
"scripts/changed-lanes.mjs: normalizeChangedPath",
"scripts/changed-lanes.mjs: RELEASE_METADATA_PATHS",
"scripts/copy-bundled-plugin-metadata.mjs: rewritePackageExtensions",
"scripts/generate-npm-shrinkwrap.mjs: applyPackageExtensionPeerMetadata",
"scripts/generate-npm-shrinkwrap.mjs: collectCurrentShrinkwrapOverrides",
"scripts/generate-npm-shrinkwrap.mjs: collectOverrideViolations",
"scripts/generate-npm-shrinkwrap.mjs: collectPnpmLockViolations",
"scripts/generate-npm-shrinkwrap.mjs: createNpmShrinkwrapCommand",
"scripts/generate-npm-shrinkwrap.mjs: createNpmShrinkwrapExecOptions",
"scripts/generate-npm-shrinkwrap.mjs: disableShrinkwrappedOverrideConflictSources",
"scripts/generate-npm-shrinkwrap.mjs: exactOverrideRulesFromOverrides",
"scripts/generate-npm-shrinkwrap.mjs: exactVersionFromOverrideSpec",
"scripts/generate-npm-shrinkwrap.mjs: mergeOverrides",
"scripts/generate-npm-shrinkwrap.mjs: normalizeNpmVersionDrift",
"scripts/generate-npm-shrinkwrap.mjs: packageDependencyInputsChanged",
"scripts/generate-npm-shrinkwrap.mjs: parseLockPackagePath",
"scripts/generate-npm-shrinkwrap.mjs: parsePnpmPackageKey",
"scripts/generate-npm-shrinkwrap.mjs: pnpmLockOverrideVersionForVersions",
"scripts/generate-npm-shrinkwrap.mjs: readPositiveIntEnv",
"scripts/generate-npm-shrinkwrap.mjs: resolvePackageDirs",
"scripts/generate-npm-shrinkwrap.mjs: resolveShrinkwrapJobs",
"scripts/generate-npm-shrinkwrap.mjs: restoreCurrentPnpmLockedPackages",
"scripts/generate-npm-shrinkwrap.mjs: runBoundedTasks",
"scripts/generate-npm-shrinkwrap.mjs: shouldUseLegacyPeerDepsForShrinkwrap",
"scripts/generate-npm-shrinkwrap.mjs: shrinkwrapPackageDirsForChangedPaths",
"scripts/lib/arg-utils.mjs: floatFlag",
"scripts/lib/arg-utils.mjs: intFlag",
"scripts/lib/arg-utils.mjs: readFlagValue",
"scripts/lib/arg-utils.mjs: stringListFlag",
"scripts/lib/arg-utils.mjs: stripLeadingPackageManagerSeparator",
"scripts/lib/bundled-plugin-build-entries.mjs: collectRootPackageExcludedExtensionDirs",
"scripts/lib/bundled-plugin-build-entries.mjs: DOCKER_SELECTED_PLUGIN_BUILD_IDS_ENV",
"scripts/lib/bundled-plugin-build-entries.mjs: listBundledPluginBuildEntries",
"scripts/lib/bundled-plugin-build-entries.mjs: listBundledPluginPackArtifacts",
"scripts/lib/bundled-plugin-paths.mjs: BUNDLED_PLUGIN_E2E_TEST_GLOB",
"scripts/lib/bundled-plugin-paths.mjs: BUNDLED_PLUGIN_LIVE_TEST_GLOB",
"scripts/lib/bundled-plugin-paths.mjs: BUNDLED_PLUGIN_TEST_GLOB",
"scripts/lib/bundled-plugin-paths.mjs: bundledDistPluginRoot",
"scripts/lib/bundled-plugin-paths.mjs: bundledPluginCallsite",
"scripts/lib/bundled-plugin-paths.mjs: bundledPluginRoot",
"scripts/lib/direct-run.mjs: isDirectRunPath",
"scripts/lib/local-build-metadata-paths.mjs: LOCAL_BUILD_METADATA_DIST_PATHS",
"scripts/lib/merge-head-diff-base.mjs: parseArgs",
"scripts/lib/optional-bundled-clusters.mjs: optionalBundledClusterSet",
"scripts/lib/plugin-npm-package-manifest.mjs: parseRunArgs",
"scripts/lib/plugin-npm-package-manifest.mjs: resolveAugmentedPluginNpmManifest",
"scripts/lib/plugin-npm-package-manifest.mjs: resolveAugmentedPluginNpmPackageJson",
"scripts/lib/plugin-npm-package-manifest.mjs: resolvePluginNpmCommand",
"scripts/lib/plugin-npm-package-manifest.mjs: withAugmentedPluginNpmManifestForPackage",
"scripts/lib/plugin-npm-runtime-build.mjs: buildPluginNpmRuntime",
"scripts/lib/plugin-npm-runtime-build.mjs: listPublishablePluginPackageDirs",
"scripts/lib/plugin-npm-runtime-build.mjs: parseArgs",
"scripts/lib/plugin-sdk-doc-metadata.ts: resolvePluginSdkDocImportSpecifier",
"scripts/lib/plugin-sdk-entries.mjs: buildPluginSdkEntrySources",
"scripts/lib/plugin-sdk-entries.mjs: buildPluginSdkPackageExports",
"scripts/lib/plugin-sdk-entries.mjs: deprecatedBarrelPluginSdkEntrypoints",
"scripts/lib/plugin-sdk-entries.mjs: deprecatedPublicPluginSdkEntrypoints",
"scripts/lib/plugin-sdk-entries.mjs: listPluginSdkDistArtifacts",
"scripts/lib/plugin-sdk-entries.mjs: listPrivateLocalOnlyPluginSdkDistArtifacts",
"scripts/lib/plugin-sdk-entries.mjs: pluginSdkEntrypoints",
"scripts/lib/plugin-sdk-entries.mjs: pluginSdkSubpaths",
"scripts/lib/plugin-sdk-entries.mjs: privateLocalOnlyPluginSdkEntrypoints",
"scripts/lib/plugin-sdk-entries.mjs: publicPluginSdkSubpaths",
"scripts/lib/vitest-local-scheduling.mjs: detectVitestHostInfo",
"scripts/lib/vitest-local-scheduling.mjs: isCiLikeEnv",
"scripts/lib/vitest-local-scheduling.mjs: resolveLocalFullSuiteProfile",
"scripts/lib/vitest-local-scheduling.mjs: resolveLocalVitestEnv",
"scripts/lib/vitest-local-scheduling.mjs: resolveLocalVitestMaxWorkers",
"scripts/lib/vitest-local-scheduling.mjs: resolveLocalVitestScheduling",
"scripts/runtime-postbuild.mjs: copyStaticExtensionAssets",
"scripts/runtime-postbuild.mjs: LEGACY_CLI_EXIT_COMPAT_CHUNKS",
"scripts/runtime-postbuild.mjs: listStaticExtensionAssetOutputs",
"scripts/runtime-postbuild.mjs: rewriteRootRuntimeImportsToStableAliases",
"scripts/runtime-postbuild.mjs: writeLegacyCliExitCompatChunks",
"scripts/runtime-postbuild.mjs: writeLegacyRootRuntimeCompatAliases",
"scripts/runtime-postbuild.mjs: writeStableRootRuntimeAliases",
"scripts/windows-cmd-helpers.mjs: resolveWindowsPowerShellPath",
"scripts/windows-cmd-helpers.mjs: resolveWindowsSystem32Path",
"scripts/windows-cmd-helpers.mjs: resolveWindowsSystemRoot",
"scripts/write-official-channel-catalog.mjs: buildOfficialChannelCatalog",
"scripts/write-official-channel-catalog.mjs: OFFICIAL_CHANNEL_CATALOG_RELATIVE_PATH",
"src/acp/control-plane/active-turns.ts: resetAcpActiveTurnsForTests",
"src/acp/runtime/adapter-contract.testkit.ts: AcpRuntimeAdapterContractParams",
"src/acp/runtime/registry.ts: AcpRuntimeBackend",
+7
View File
@@ -403,6 +403,7 @@ function packageJsonForShrinkwrap(packageJson, shrinkwrapOverrides) {
/**
* Resolves the npm command invocation used by shrinkwrap generation.
* @internal Directly tested script implementation detail.
*/
export function createNpmShrinkwrapCommand(args, options = {}) {
return resolveNpmRunner({
@@ -417,6 +418,7 @@ export function createNpmShrinkwrapCommand(args, options = {}) {
/**
* Reads a positive integer env override for shrinkwrap subprocess limits.
* @internal Directly tested script implementation detail.
*/
export function readPositiveIntEnv(name, fallback, env = process.env) {
const text = String(env[name] ?? fallback).trim();
@@ -432,6 +434,7 @@ export function readPositiveIntEnv(name, fallback, env = process.env) {
/**
* Builds execFileSync options with bounded timeout and output buffer limits.
* @internal Directly tested script implementation detail.
*/
export function createNpmShrinkwrapExecOptions(invocation, cwd, env = process.env) {
return {
@@ -1195,6 +1198,7 @@ function listCheckChangedPaths() {
}
}
/** @internal Directly tested script implementation detail. */
export function resolvePackageDirs(args) {
const packageDirs = [];
const check = args.includes("--check");
@@ -1327,6 +1331,7 @@ function updateOrCheckPackage(packageDir, check, changedPaths = []) {
return `${label}: npm-shrinkwrap.json is current.`;
}
/** @internal Directly tested script implementation detail. */
export async function runBoundedTasks(items, jobs, runTask) {
const results = Array.from({ length: items.length });
let nextIndex = 0;
@@ -1341,6 +1346,7 @@ export async function runBoundedTasks(items, jobs, runTask) {
return results;
}
/** @internal Directly tested script implementation detail. */
export function resolveShrinkwrapJobs(
rawValue,
env = process.env,
@@ -1447,6 +1453,7 @@ function handleMainError(error) {
process.exitCode = 1;
}
/** @internal Directly tested and shared repository-script contracts. */
export {
// Test-facing helpers cover lockfile normalization, override merging, and
// changed-package detection without invoking npm.
-5
View File
@@ -29,11 +29,6 @@ export function intFlag<T extends FlagArgs>(
key: string,
options?: { min?: number },
): FlagSpec<T>;
export function floatFlag<T extends FlagArgs>(
flag: string,
key: string,
options?: { includeMin?: boolean; min?: number },
): FlagSpec<T>;
export function booleanFlag<T extends FlagArgs>(
flag: string,
key: string,
+16 -43
View File
@@ -1,5 +1,8 @@
// Shared argument parsing helpers for repository scripts.
/** Read a flag value from `--flag value` or `--flag=value` arguments. */
/**
* Read a flag value from `--flag value` or `--flag=value` arguments.
* @internal Shared repository-script contract.
*/
export function readFlagValue(args, name) {
for (let index = 0; index < args.length; index += 1) {
const arg = args[index];
@@ -13,7 +16,10 @@ export function readFlagValue(args, name) {
return undefined;
}
/** Remove the leading `--` separator inserted by package-manager script invocations. */
/**
* Remove the leading `--` separator inserted by package-manager script invocations.
* @internal Shared repository-script contract.
*/
export function stripLeadingPackageManagerSeparator(argv) {
return argv[0] === "--" ? argv.slice(1) : argv;
}
@@ -68,25 +74,6 @@ function consumeIntFlag(argv, index, flag, options = {}) {
};
}
function consumeFloatFlag(argv, index, flag, options = {}) {
const raw = readFlagOptionValue(argv, index, flag);
if (!raw) {
return null;
}
const parsed = parseFloatFlagValue(raw.value, flag);
const min = options.min ?? Number.NEGATIVE_INFINITY;
const includeMin = options.includeMin ?? true;
const isValid = Number.isFinite(parsed) && (includeMin ? parsed >= min : parsed > min);
if (!isValid) {
const comparator = includeMin ? "at least" : "greater than";
throw new Error(`${flag} must be ${comparator} ${min}`);
}
return {
nextIndex: raw.nextIndex,
value: parsed,
};
}
function readInlineFlagValue(arg, flag) {
const prefix = `${flag}=`;
return arg.startsWith(prefix) ? arg.slice(prefix.length) : null;
@@ -122,18 +109,6 @@ function parseIntegerFlagValue(raw, flag) {
return parsed;
}
function parseFloatFlagValue(raw, flag) {
const text = String(raw).trim();
if (!/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(text)) {
throw new Error(`${flag} must be a number`);
}
const parsed = Number(text);
if (!Number.isFinite(parsed)) {
throw new Error(`${flag} must be a finite number`);
}
return parsed;
}
/** Create a flag spec that assigns one string value to the parsed args object. */
export function stringFlag(flag, key, options = {}) {
return {
@@ -154,7 +129,10 @@ export function stringFlag(flag, key, options = {}) {
};
}
/** Create a flag spec that appends repeated string values to an array field. */
/**
* Create a flag spec that appends repeated string values to an array field.
* @internal Shared repository-script contract.
*/
export function stringListFlag(flag, key, options = {}) {
return {
consume(argv, index) {
@@ -194,7 +172,10 @@ function createAssignedValueFlag(flag, consumeOption) {
};
}
/** Create a flag spec that parses and assigns a safe integer value. */
/**
* Create a flag spec that parses and assigns a safe integer value.
* @internal Shared repository-script contract.
*/
export function intFlag(flag, key, options) {
return createAssignedValueFlag(flag, (argv, index) => {
const option = consumeIntFlag(argv, index, flag, options);
@@ -202,14 +183,6 @@ export function intFlag(flag, key, options) {
});
}
/** Create a flag spec that parses and assigns a finite floating-point value. */
export function floatFlag(flag, key, options) {
return createAssignedValueFlag(flag, (argv, index) => {
const option = consumeFloatFlag(argv, index, flag, options);
return option ? { ...option, key } : null;
});
}
/** Create a flag spec that assigns a fixed boolean-like value when present. */
export function booleanFlag(flag, key, value = true) {
return {
+13 -3
View File
@@ -14,6 +14,7 @@ const TOP_LEVEL_PUBLIC_SURFACE_EXTENSIONS = new Set([".ts", ".js", ".mts", ".cts
export const NON_PACKAGED_BUNDLED_PLUGIN_DIRS = new Set(["qa-channel", "qa-lab", "qa-matrix"]);
const EXCLUDED_CORE_BUNDLED_PLUGIN_DIRS = new Set(["qqbot", "whatsapp"]);
const BUNDLED_PLUGIN_BUILD_IDS_ENV = "OPENCLAW_BUNDLED_PLUGIN_BUILD_IDS";
/** @internal Shared repository-script contract. */
export const DOCKER_SELECTED_PLUGIN_BUILD_IDS_ENV = "OPENCLAW_INTERNAL_DOCKER_BUILD_PLUGIN_IDS";
const PLUGIN_ID_RE = /^[a-z0-9][a-z0-9-]*$/u;
const TOP_LEVEL_PRIVATE_TEST_SURFACE_RE =
@@ -292,7 +293,10 @@ export function collectBundledPluginBuildEntries(params = {}) {
return entries.filter((entry) => filteredBuildIds.has(entry.id));
}
/** Return buildable bundled plugin entries with optional CLI filtering applied. */
/**
* Return buildable bundled plugin entries with optional CLI filtering applied.
* @internal Directly tested script implementation detail.
*/
export function listBundledPluginBuildEntries(params = {}) {
return Object.fromEntries(
collectBundledPluginBuildEntries(params).flatMap(({ id, sourceEntries }) =>
@@ -305,7 +309,10 @@ export function listBundledPluginBuildEntries(params = {}) {
);
}
/** Collect bundled extension dirs that root package builds should exclude. */
/**
* Collect bundled extension dirs that root package builds should exclude.
* @internal Shared repository-script contract.
*/
export function collectRootPackageExcludedExtensionDirs(params = {}) {
const cwd = params.cwd ?? process.cwd();
const packageJsonPath = path.join(cwd, "package.json");
@@ -327,7 +334,10 @@ export function collectRootPackageExcludedExtensionDirs(params = {}) {
return excluded;
}
/** List package artifact files generated for bundled plugins. */
/**
* List package artifact files generated for bundled plugins.
* @internal Shared repository-script contract.
*/
export function listBundledPluginPackArtifacts(params = {}) {
const excludedPackageDirs =
params.includeRootPackageExcludedDirs === true
-5
View File
@@ -1,11 +1,6 @@
export const BUNDLED_PLUGIN_ROOT_DIR: "extensions";
export const BUNDLED_PLUGIN_PATH_PREFIX: "extensions/";
export const BUNDLED_PLUGIN_TEST_GLOB: "extensions/**/*.test.ts";
export const BUNDLED_PLUGIN_E2E_TEST_GLOB: "extensions/**/*.e2e.test.ts";
export const BUNDLED_PLUGIN_LIVE_TEST_GLOB: "extensions/**/*.live.test.ts";
export function bundledPluginRoot(pluginId: string): string;
export function bundledPluginFile(pluginId: string, relativePath: string): string;
export function bundledDistPluginRoot(pluginId: string): string;
export function bundledDistPluginFile(pluginId: string, relativePath: string): string;
export function bundledPluginCallsite(pluginId: string, relativePath: string, line: number): string;
+9 -10
View File
@@ -3,14 +3,10 @@
export const BUNDLED_PLUGIN_ROOT_DIR = "extensions";
/** Prefix for bundled plugin source paths. */
export const BUNDLED_PLUGIN_PATH_PREFIX = `${BUNDLED_PLUGIN_ROOT_DIR}/`;
/** Glob for bundled plugin unit tests. */
export const BUNDLED_PLUGIN_TEST_GLOB = `${BUNDLED_PLUGIN_ROOT_DIR}/**/*.test.ts`;
/** Glob for bundled plugin E2E tests. */
export const BUNDLED_PLUGIN_E2E_TEST_GLOB = `${BUNDLED_PLUGIN_ROOT_DIR}/**/*.e2e.test.ts`;
/** Glob for bundled plugin live tests. */
export const BUNDLED_PLUGIN_LIVE_TEST_GLOB = `${BUNDLED_PLUGIN_ROOT_DIR}/**/*.live.test.ts`;
/** Return a bundled plugin source root path. */
/**
* Return a bundled plugin source root path.
* @internal Shared test-routing script contract.
*/
export function bundledPluginRoot(pluginId) {
return `${BUNDLED_PLUGIN_PATH_PREFIX}${pluginId}`;
}
@@ -21,7 +17,7 @@ export function bundledPluginFile(pluginId, relativePath) {
}
/** Return a bundled plugin dist root path. */
export function bundledDistPluginRoot(pluginId) {
function bundledDistPluginRoot(pluginId) {
return `dist/${bundledPluginRoot(pluginId)}`;
}
@@ -30,7 +26,10 @@ export function bundledDistPluginFile(pluginId, relativePath) {
return `${bundledDistPluginRoot(pluginId)}/${relativePath}`;
}
/** Return a bundled plugin source callsite string with a line number. */
/**
* Return a bundled plugin source callsite string with a line number.
* @internal Shared repository-script contract.
*/
export function bundledPluginCallsite(pluginId, relativePath, line) {
return `${bundledPluginFile(pluginId, relativePath)}:${line}`;
}
+4 -1
View File
@@ -2,7 +2,10 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
/** Return whether a direct-run path points at the current module path. */
/**
* Return whether a direct-run path points at the current module path.
* @internal Directly tested script implementation detail.
*/
export function isDirectRunPath(directPath, modulePath, platform = process.platform) {
if (!directPath || !modulePath) {
return false;
+4 -1
View File
@@ -4,7 +4,10 @@ export const BUILD_STAMP_FILE = ".buildstamp";
/** File written after runtime postbuild sync completion. */
export const RUNTIME_POSTBUILD_STAMP_FILE = ".runtime-postbuildstamp";
/** Dist paths that contain local build metadata and should not be packaged as source. */
/**
* Dist paths that contain local build metadata and should not be packaged as source.
* @internal Shared repository-script contract.
*/
export const LOCAL_BUILD_METADATA_DIST_PATHS = Object.freeze([
`dist/${BUILD_STAMP_FILE}`,
`dist/${RUNTIME_POSTBUILD_STAMP_FILE}`,
+1
View File
@@ -68,6 +68,7 @@ function readRefValue(argv, index, optionName) {
return value;
}
/** @internal Directly tested script implementation detail. */
export function parseArgs(argv) {
const args = {
base: "",
+4 -1
View File
@@ -15,7 +15,10 @@ const optionalBundledClusters = [
"zalouser",
];
/** Bundled plugin clusters that may be excluded from size-sensitive build lanes. */
/**
* Bundled plugin clusters that may be excluded from size-sensitive build lanes.
* @internal Shared repository-script contract.
*/
export const optionalBundledClusterSet = new Set(optionalBundledClusters);
const OPTIONAL_BUNDLED_BUILD_ENV = "OPENCLAW_INCLUDE_OPTIONAL_BUNDLED";
+17 -4
View File
@@ -138,7 +138,10 @@ function listConfiguredBundledDependencyNames(packageJson) {
return [];
}
/** Resolve an npm command invocation for plugin package scripts. */
/**
* Resolve an npm command invocation for plugin package scripts.
* @internal Directly tested script implementation detail.
*/
export function resolvePluginNpmCommand(args, params = {}) {
return resolveNpmRunner({
comSpec: params.comSpec,
@@ -407,7 +410,10 @@ function installPackageLocalBundledDependencies(params) {
};
}
/** Build the package.json that should be used while packaging a plugin for npm. */
/**
* Build the package.json that should be used while packaging a plugin for npm.
* @internal Directly tested script implementation detail.
*/
export function resolveAugmentedPluginNpmPackageJson(params) {
const repoRoot = path.resolve(params.repoRoot ?? ".");
const packageDir = resolvePackageDir(repoRoot, params.packageDir);
@@ -571,7 +577,10 @@ export function mergeGeneratedChannelConfigs(manifest, generatedChannelConfigs)
};
}
/** Build the plugin manifest that should be used while packaging a plugin for npm. */
/**
* Build the plugin manifest that should be used while packaging a plugin for npm.
* @internal Directly tested script implementation detail.
*/
export function resolveAugmentedPluginNpmManifest(params) {
const repoRoot = path.resolve(params.repoRoot ?? ".");
const packageDir = resolvePackageDir(repoRoot, params.packageDir);
@@ -601,7 +610,10 @@ export function resolveAugmentedPluginNpmManifest(params) {
};
}
/** Temporarily write augmented manifest/package metadata while a packaging callback runs. */
/**
* Temporarily write augmented manifest/package metadata while a packaging callback runs.
* @internal Directly tested script implementation detail.
*/
export function withAugmentedPluginNpmManifestForPackage(params, callback) {
const repoRoot = path.resolve(params.repoRoot ?? ".");
const packageDir = resolvePackageDir(repoRoot, params.packageDir);
@@ -694,6 +706,7 @@ function readRunPackageDir(argv) {
return packageDir;
}
/** @internal Directly tested script implementation detail. */
export function parseRunArgs(argv) {
if (argv[0] === "--help" || argv[0] === "-h") {
return { help: true, packageDir: "", command: "", args: [] };
+9 -2
View File
@@ -104,7 +104,10 @@ function packageRelativePathExists(packageDir, relativePath) {
return fs.existsSync(path.join(packageDir, relativePath));
}
/** List extension package dirs whose package metadata enables artifact publishing. */
/**
* List extension package dirs whose package metadata enables artifact publishing.
* @internal Shared repository-script contract.
*/
export function listPublishablePluginPackageDirs(params = {}) {
const repoRoot = path.resolve(params.repoRoot ?? ".");
const extensionsRoot = path.join(repoRoot, "extensions");
@@ -297,7 +300,10 @@ export function resolvePluginNpmRuntimeBuildPlan(params) {
};
}
/** Build package-local runtime files and static assets for one plugin package. */
/**
* Build package-local runtime files and static assets for one plugin package.
* @internal Shared repository-script contract.
*/
export async function buildPluginNpmRuntime(params) {
const plan = resolvePluginNpmRuntimeBuildPlan(params);
if (!plan) {
@@ -359,6 +365,7 @@ function readPackageDirArg(argv) {
return { packageDir };
}
/** @internal Directly tested script implementation detail. */
export function parseArgs(argv) {
return readPackageDirArg(argv);
}
-4
View File
@@ -168,7 +168,3 @@ export const pluginSdkDocMetadata = {
} as const satisfies Record<string, PluginSdkDocMetadata>;
export type PluginSdkDocEntrypoint = keyof typeof pluginSdkDocMetadata;
export function resolvePluginSdkDocImportSpecifier(entrypoint: PluginSdkDocEntrypoint): string {
return entrypoint === "index" ? "openclaw/plugin-sdk" : `openclaw/plugin-sdk/${entrypoint}`;
}
+40 -10
View File
@@ -4,10 +4,16 @@ import deprecatedPublicPluginSdkSubpathList from "./plugin-sdk-deprecated-public
import pluginSdkEntryList from "./plugin-sdk-entrypoints.json" with { type: "json" };
import privateLocalOnlyPluginSdkSubpathList from "./plugin-sdk-private-local-only-subpaths.json" with { type: "json" };
/** All plugin SDK entrypoints, including the package root index. */
/**
* All plugin SDK entrypoints, including the package root index.
* @internal Shared repository-script contract.
*/
export const pluginSdkEntrypoints = [...pluginSdkEntryList];
/** Plugin SDK subpath entrypoints, excluding the package root index. */
/**
* Plugin SDK subpath entrypoints, excluding the package root index.
* @internal Shared test-configuration contract.
*/
export const pluginSdkSubpaths = pluginSdkEntrypoints.filter((entry) => entry !== "index");
const privateLocalOnlyPluginSdkSubpathSet = new Set(
@@ -16,7 +22,10 @@ const privateLocalOnlyPluginSdkSubpathSet = new Set(
),
);
/** Private plugin SDK entrypoints that are built locally but not exported publicly. */
/**
* Private plugin SDK entrypoints that are built locally but not exported publicly.
* @internal Shared repository-script contract.
*/
export const privateLocalOnlyPluginSdkEntrypoints = pluginSdkSubpaths.filter((entry) =>
privateLocalOnlyPluginSdkSubpathSet.has(entry),
);
@@ -26,27 +35,42 @@ export const publicPluginSdkEntrypoints = pluginSdkEntrypoints.filter(
(entry) => entry === "index" || !privateLocalOnlyPluginSdkSubpathSet.has(entry),
);
/** Public plugin SDK subpaths, excluding the package root index. */
/**
* Public plugin SDK subpaths, excluding the package root index.
* @internal Shared repository-script contract.
*/
export const publicPluginSdkSubpaths = publicPluginSdkEntrypoints.filter(
(entry) => entry !== "index",
);
/** Deprecated public plugin SDK subpaths kept for compatibility. */
/**
* Deprecated public plugin SDK subpaths kept for compatibility.
* @internal Shared repository-script contract.
*/
export const deprecatedPublicPluginSdkEntrypoints = publicPluginSdkSubpaths.filter((entry) =>
deprecatedPublicPluginSdkSubpathList.includes(entry),
);
/** Deprecated barrel entrypoints that should not be expanded further. */
/**
* Deprecated barrel entrypoints that should not be expanded further.
* @internal Shared repository-script contract.
*/
export const deprecatedBarrelPluginSdkEntrypoints = pluginSdkSubpaths.filter((entry) =>
deprecatedBarrelPluginSdkSubpathList.includes(entry),
);
/** Build tsdown entry source paths for plugin SDK entrypoints. */
/**
* Build tsdown entry source paths for plugin SDK entrypoints.
* @internal Shared repository-script contract.
*/
export function buildPluginSdkEntrySources(entries = pluginSdkEntrypoints) {
return Object.fromEntries(entries.map((entry) => [entry, `src/plugin-sdk/${entry}.ts`]));
}
/** Build package export metadata for public plugin SDK entrypoints. */
/**
* Build package export metadata for public plugin SDK entrypoints.
* @internal Shared repository-script contract.
*/
export function buildPluginSdkPackageExports() {
return Object.fromEntries(
publicPluginSdkEntrypoints.map((entry) => [
@@ -59,7 +83,10 @@ export function buildPluginSdkPackageExports() {
);
}
/** List public plugin SDK dist artifacts expected in package output. */
/**
* List public plugin SDK dist artifacts expected in package output.
* @internal Shared repository-script contract.
*/
export function listPluginSdkDistArtifacts() {
return publicPluginSdkEntrypoints.flatMap((entry) => [
`dist/plugin-sdk/${entry}.js`,
@@ -67,7 +94,10 @@ export function listPluginSdkDistArtifacts() {
]);
}
/** List private local-only plugin SDK dist artifacts expected after local builds. */
/**
* List private local-only plugin SDK dist artifacts expected after local builds.
* @internal Shared repository-script contract.
*/
export function listPrivateLocalOnlyPluginSdkDistArtifacts() {
return privateLocalOnlyPluginSdkEntrypoints.flatMap((entry) => [
`dist/plugin-sdk/${entry}.js`,
+6
View File
@@ -27,10 +27,12 @@ function isSystemThrottleDisabled(env) {
return normalized === "1" || normalized === "true";
}
/** @internal Shared repository-script contract. */
export function isCiLikeEnv(env = process.env) {
return env.CI === "true" || env.GITHUB_ACTIONS === "true";
}
/** @internal Shared repository-script contract. */
export function resolveLocalVitestEnv(env = process.env) {
const normalizedLocalCheck = env.OPENCLAW_LOCAL_CHECK?.trim().toLowerCase();
if (isCiLikeEnv(env) || (normalizedLocalCheck !== "0" && normalizedLocalCheck !== "false")) {
@@ -43,6 +45,7 @@ export function resolveLocalVitestEnv(env = process.env) {
};
}
/** @internal Directly tested script implementation detail. */
export function detectVitestHostInfo() {
return {
cpuCount:
@@ -67,6 +70,7 @@ function resolveMemoryPressureWorkerLimit(system) {
return null;
}
/** @internal Shared repository-script contract. */
export function resolveLocalVitestMaxWorkers(
env = process.env,
system = detectVitestHostInfo(),
@@ -80,6 +84,7 @@ export function resolveLocalVitestMaxWorkers(
* @param {VitestHostInfo} system
* @param {"forks" | "threads"} pool
* @returns {LocalVitestScheduling}
* @internal Shared repository-script contract.
*/
export function resolveLocalVitestScheduling(
env = process.env,
@@ -186,6 +191,7 @@ export function resolveLocalVitestScheduling(
};
}
/** @internal Shared repository-script contract. */
export function resolveLocalFullSuiteProfile(env = process.env, system = detectVitestHostInfo()) {
const scheduling = resolveLocalVitestScheduling(env, system, "threads");
return {
-2
View File
@@ -22,10 +22,8 @@ type StaticExtensionAssetParams = Pick<RuntimePostBuildParams, "rootDir" | "fs"
type LegacyCliExitCompatChunk = { dest: string; contents: string };
export function copyStaticExtensionAssets(params?: StaticExtensionAssetParams): void;
export function listStaticExtensionAssetOutputs(params?: StaticExtensionAssetParams): string[];
export const LEGACY_CLI_EXIT_COMPAT_CHUNKS: LegacyCliExitCompatChunk[];
export function listCoreRuntimePostBuildOutputs(
params?: Pick<RuntimePostBuildParams, "rootDir" | "fs"> & {
chunks?: LegacyCliExitCompatChunk[];
+7 -2
View File
@@ -16,7 +16,8 @@ import { writeTextFileIfChanged } from "./runtime-postbuild-shared.mjs";
import { stageBundledPluginRuntime } from "./stage-bundled-plugin-runtime.mjs";
import { writeOfficialChannelCatalog } from "./write-official-channel-catalog.mjs";
export { copyStaticExtensionAssets, listStaticExtensionAssetOutputs };
/** @internal Shared repository-script contract. */
export { listStaticExtensionAssetOutputs };
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const ROOT_RUNTIME_ALIAS_PATTERN = /^(?<base>.+\.(?:runtime|contract))-[A-Za-z0-9_-]+\.js$/u;
@@ -135,7 +136,7 @@ const LEGACY_PLUGIN_INSTALL_RUNTIME_COMPAT_ALIASES = [
sourceIncludes: LEGACY_PLUGIN_INSTALL_RUNTIME_MARKERS,
}));
/** Compatibility chunks kept for live gateways loading old CLI exit modules. */
export const LEGACY_CLI_EXIT_COMPAT_CHUNKS = [
const LEGACY_CLI_EXIT_COMPAT_CHUNKS = [
{
dest: "dist/memory-state-CcqRgDZU.js",
contents: "export function hasMemoryRuntime() {\n return false;\n}\n",
@@ -340,6 +341,7 @@ function buildRuntimeAliasSource(params) {
/**
* Writes stable aliases for current hashed runtime chunks.
* @internal Directly tested script implementation detail.
*/
export function writeStableRootRuntimeAliases(params = {}) {
const rootDir = params.rootDir ?? ROOT;
@@ -368,6 +370,7 @@ export function writeStableRootRuntimeAliases(params = {}) {
/**
* Rewrites hashed runtime imports to stable aliases so live updates survive swaps.
* @internal Directly tested script implementation detail.
*/
export function rewriteRootRuntimeImportsToStableAliases(params = {}) {
const rootDir = params.rootDir ?? ROOT;
@@ -495,6 +498,7 @@ function resolveLegacyRootRuntimeCompatTarget(params) {
/**
* Writes compatibility aliases for shipped hashed runtime chunk names.
* @internal Directly tested script implementation detail.
*/
export function writeLegacyRootRuntimeCompatAliases(params = {}) {
const rootDir = params.rootDir ?? ROOT;
@@ -531,6 +535,7 @@ export function writeLegacyRootRuntimeCompatAliases(params = {}) {
/**
* Writes small compatibility chunks for old CLI exit imports.
* @internal Directly tested script implementation detail.
*/
export function writeLegacyCliExitCompatChunks(params = {}) {
const rootDir = params.rootDir ?? ROOT;
-1
View File
@@ -1,5 +1,4 @@
export function resolvePathEnvKey(env: NodeJS.ProcessEnv): string;
export function resolveWindowsSystemRoot(env?: NodeJS.ProcessEnv): string;
export function resolveWindowsSystem32Path(executableName: string, env?: NodeJS.ProcessEnv): string;
export function resolveWindowsCmdExePath(env?: NodeJS.ProcessEnv): string;
export function resolveWindowsPowerShellPath(env?: NodeJS.ProcessEnv): string;
+3 -1
View File
@@ -43,7 +43,7 @@ export function resolvePathEnvKey(env) {
return Object.keys(env).find((key) => key.toLowerCase() === "path") ?? "PATH";
}
export function resolveWindowsSystemRoot(env = process.env) {
function resolveWindowsSystemRoot(env = process.env) {
return (
normalizeWindowsSystemRoot(getEnvValueCaseInsensitive(env, "SystemRoot")) ??
normalizeWindowsSystemRoot(getEnvValueCaseInsensitive(env, "WINDIR")) ??
@@ -51,6 +51,7 @@ export function resolveWindowsSystemRoot(env = process.env) {
);
}
/** @internal Shared repository-script contract. */
export function resolveWindowsSystem32Path(executableName, env = process.env) {
if (
path.win32.basename(executableName) !== executableName ||
@@ -65,6 +66,7 @@ export function resolveWindowsCmdExePath(env = process.env) {
return resolveWindowsSystem32Path("cmd.exe", env);
}
/** @internal Shared repository-script contract. */
export function resolveWindowsPowerShellPath(env = process.env) {
return path.win32.join(
resolveWindowsSystemRoot(env),
+5 -1
View File
@@ -6,7 +6,10 @@ import officialExternalChannelCatalog from "./lib/official-external-channel-cata
import { isRecord, trimString } from "./lib/record-shared.mjs";
import { writeTextFileIfChanged } from "./runtime-postbuild-shared.mjs";
/** Generated official channel catalog path in dist. */
/**
* Generated official channel catalog path in dist.
* @internal Directly tested script implementation detail.
*/
export const OFFICIAL_CHANNEL_CATALOG_RELATIVE_PATH = "dist/channel-catalog.json";
function toCatalogInstall(value, packageName) {
@@ -65,6 +68,7 @@ function getCatalogChannelId(entry) {
/**
* Collects publishable channel catalog entries from bundled and external channels.
* @internal Directly tested script implementation detail.
*/
export function buildOfficialChannelCatalog(params = {}) {
const repoRoot = params.cwd ?? params.repoRoot ?? process.cwd();
+4 -22
View File
@@ -2,7 +2,6 @@
import { describe, expect, it } from "vitest";
import {
booleanFlag,
floatFlag,
intFlag,
parseFlagArgs,
stringFlag,
@@ -20,17 +19,12 @@ describe("scripts/lib/arg-utils parseFlagArgs", () => {
it("parses inline flag assignments", () => {
const parsed = parseFlagArgs(
["--label=changed-tests", "--limit=30", "--factor=1.5"],
{ factor: 1, label: "", limit: 10 },
[
stringFlag("--label", "label"),
intFlag("--limit", "limit", { min: 1 }),
floatFlag("--factor", "factor", { min: 0, includeMin: false }),
],
["--label=changed-tests", "--limit=30"],
{ label: "", limit: 10 },
[stringFlag("--label", "label"), intFlag("--limit", "limit", { min: 1 })],
);
expect(parsed).toEqual({
factor: 1.5,
label: "changed-tests",
limit: 30,
});
@@ -105,17 +99,10 @@ describe("scripts/lib/arg-utils parseFlagArgs", () => {
parseFlagArgs(["--limit"], { limit: 10 }, [intFlag("--limit", "limit", { min: 1 })]),
).toThrow("--limit requires a value");
expect(() =>
parseFlagArgs(["--limit", "--factor", "1.5"], { factor: 1, limit: 10 }, [
parseFlagArgs(["--limit", "--factor", "1.5"], { limit: 10 }, [
intFlag("--limit", "limit", { min: 1 }),
floatFlag("--factor", "factor", { min: 0, includeMin: false }),
]),
).toThrow("--limit requires a value");
expect(() =>
parseFlagArgs(["--factor", "--limit", "2"], { factor: 1, limit: 10 }, [
intFlag("--limit", "limit", { min: 1 }),
floatFlag("--factor", "factor", { min: 0, includeMin: false }),
]),
).toThrow("--factor requires a value");
expect(() =>
parseFlagArgs(["--limit", "20files"], { limit: 10 }, [
intFlag("--limit", "limit", { min: 1 }),
@@ -124,11 +111,6 @@ describe("scripts/lib/arg-utils parseFlagArgs", () => {
expect(() =>
parseFlagArgs(["--limit", "0"], { limit: 10 }, [intFlag("--limit", "limit", { min: 1 })]),
).toThrow("--limit must be at least 1");
expect(() =>
parseFlagArgs(["--factor", "1e3"], { factor: 1 }, [
floatFlag("--factor", "factor", { min: 0, includeMin: false }),
]),
).toThrow("--factor must be a number");
});
it("can preserve the option separator for callers that need to handle it", () => {
+1 -1
View File
@@ -4,11 +4,11 @@ import path from "node:path";
import { pathToFileURL } from "node:url";
import { describe, expect, it, vi } from "vitest";
import {
copyStaticExtensionAssets,
copyStaticExtensionAssetsToRuntimeOverlay,
discoverStaticExtensionAssets,
} from "../../scripts/lib/static-extension-assets.mjs";
import {
copyStaticExtensionAssets,
listStaticExtensionAssetOutputs,
rewriteRootRuntimeImportsToStableAliases,
runRuntimePostBuild,