Files
openclaw/scripts/generate-npm-shrinkwrap.d.mts
Peter Steinberger fe261b0f59 chore(tooling): typecheck root test/** with a dedicated tsgo lane (#104475)
* chore(types): add declaration files for scripts/lib and scripts/e2e modules

* chore(types): add declaration files for top-level script modules (a-m)

* chore(types): add declaration files for top-level script modules (n-z)

* test: use a non-secret-shaped gateway token fixture

* test: type ci workflow guard helpers for the root test lane

* chore(tooling): typecheck root test/** with a dedicated tsgo lane

- test/tsconfig/tsconfig.test.root.json: root-test program (strict unused checks,
  fixtures excluded; two Docker E2E clients that import built dist/** stay out,
  same rationale as the scripts/e2e exclusion in tsconfig.scripts.json)
- tsgo:test:root wired into tsgo:test, check:test-types, scripts/check.mjs, and
  the ci.yml test-types shard, mirroring the tsgo:scripts lane (#104348)
- changed-lane routing: test/**/*.ts (excluding fixtures) and the lane tsconfig
  now trigger 'typecheck test root' in check:changed; previously test/ paths ran
  lint only, so harness type errors surfaced first in CI (#104287 envDir case)
- burn down all 1071 latent type errors in the program: precise param/local
  types across test/scripts, test/vitest, test/e2e, and transitive scripts/e2e
  program members; 205 sibling .d.mts declaration files for imported .mjs
  modules (committed separately); zero any, zero ts-expect-error
- resolve the pre-existing testing star-export ambiguity in
  scripts/e2e/parallels/common.ts with an explicit re-export

Closes #104388

* chore(types): correct declaration fidelity per structured review

- re-derive 51 .d.mts files from implementation data flow instead of
  initializers: fix a wrong never return (runTestProjectsDelegation returns
  the child), add encoding-sensitive exec/spawn overloads (plain-gh), restore
  the full release profile union, make parsed paths string | null, add missing
  parseArgs fields via help/non-help unions, add a missing sibling declaration
  (budget-number-args), drop 15 unused lint directives
- precise install-record/tuple typing removes the type-aware oxlint
  regressions the first declarations caused in scripts/e2e implementations
- route .mts declaration edits under test/ to the testRoot lane and reference
  the test-root project from tsconfig.projects.json so tsgo:all covers it
  (closes both review findings against the lane wiring)

* chore(scripts): keep telegram runner dist typing structural for the boundary guard

* chore(types): declare runtime pack and gateway readiness exports added on main

* test: pin the importTargetPlan form of the plugin-contract plan import

The guard expectation still referenced the raw await import( form that
7ae5996bb3 (#103975) replaced with the importTargetPlan fallback helper;
the assertion fails on current main.
2026-07-11 06:15:41 -07:00

132 lines
3.6 KiB
TypeScript

#!/usr/bin/env node
/**
* Resolves the npm command invocation used by shrinkwrap generation.
*/
export function createNpmShrinkwrapCommand(
args: string[],
options?: {
comSpec?: string;
env?: NodeJS.ProcessEnv;
execPath?: string;
existsSync?: (candidate: string) => boolean;
platform?: NodeJS.Platform;
},
): {
args: string[];
command: string;
env?: NodeJS.ProcessEnv;
shell: boolean;
windowsVerbatimArguments?: boolean;
};
/**
* Reads a positive integer env override for shrinkwrap subprocess limits.
*/
export function readPositiveIntEnv(
name: unknown,
fallback: unknown,
env?: NodeJS.ProcessEnv,
): number;
/**
* Builds execFileSync options with bounded timeout and output buffer limits.
*/
export function createNpmShrinkwrapExecOptions(
invocation: unknown,
cwd: unknown,
env?: NodeJS.ProcessEnv,
): {
cwd: unknown;
env: unknown;
maxBuffer: number;
shell: unknown;
stdio: string[];
timeout: number;
windowsVerbatimArguments: unknown;
};
export function resolvePackageDirs(args: string[]): {
check: unknown;
changedPaths: string[];
jobs: number;
packageDirs: unknown[];
};
export function runBoundedTasks<Item, Result>(
items: Item[],
jobs: number,
runTask: (item: Item) => Promise<Result>,
): Promise<Result[]>;
export function resolveShrinkwrapJobs(
rawValue: unknown,
env?: NodeJS.ProcessEnv,
fallback?: number,
): number;
export function collectCurrentShrinkwrapOverrides(
shrinkwrap: unknown,
declaredDependencies?: Set<unknown>,
pnpmLockPackages?: Set<unknown>,
): unknown;
export function collectOverrideViolations(
lockfile: unknown,
overrideRules: unknown,
): {
path: string;
packageName: unknown;
actualVersion: unknown;
expectedVersion: unknown;
packagePath: {
name: unknown;
path: string;
}[];
}[];
export function collectPnpmLockViolations(
shrinkwrap: unknown,
pnpmLockPackages?: Set<unknown>,
): {
path: string;
packageKey: string;
}[];
export function disableShrinkwrappedOverrideConflictSources(
lockfile: unknown,
overrideRules: unknown,
): string[];
export function exactOverrideRulesFromOverrides(overrides: unknown): unknown;
export function exactVersionFromOverrideSpec(spec: unknown): string | null;
export function mergeOverrides(
packageOverrides: unknown,
workspaceOverrides: unknown,
pnpmLockOverrides: unknown,
): unknown;
export function applyPackageExtensionPeerMetadata(
lockfile: unknown,
packageExtensions?: unknown,
): unknown;
export function normalizeNpmVersionDrift<T>(lockfile: T): T;
export function packageJsonForShrinkwrap(
packageJson: Record<string, unknown>,
shrinkwrapOverrides: Record<string, unknown>,
): {
dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
peerDependencies?: Record<string, string>;
[key: string]: unknown;
};
export function packageDependencyInputsChanged(packageDir: unknown, changedPaths: unknown): unknown;
export function pnpmLockOverrideVersionForVersions(versions: unknown): unknown;
export function parsePnpmPackageKey(packageKey: unknown): {
name: string;
version: string;
} | null;
export function parseLockPackagePath(lockPath: unknown): {
name: unknown;
path: string;
}[];
export function readShrinkwrapOverrides(): unknown;
export function restoreCurrentPnpmLockedPackages(
generated: unknown,
current: unknown,
pnpmLockPackages?: Set<unknown>,
): unknown;
export function shouldUseLegacyPeerDepsForShrinkwrap(
packageJson: unknown,
packageExtensions?: unknown,
): boolean;
export function shrinkwrapPackageDirsForChangedPaths(changedPaths: string[]): string[];