MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / resolveVersion

Function resolveVersion

__tests__/install-ps1-version.test.ts:77–96  ·  view source on GitHub ↗

Run the shipped resolver in Windows PowerShell against the stand-in (async: the stand-in runs here).

(pinned: string)

Source from the content-addressed store, hash-verified

75
76 /** Run the shipped resolver in Windows PowerShell against the stand-in (async: the stand-in runs here). */
77 function resolveVersion(pinned: string): Promise<{ code: number; stdout: string; stderr: string }> {
78 const script = [
79 "$ErrorActionPreference = 'Stop'",
80 "$ProgressPreference = 'SilentlyContinue'",
81 extractResolver(),
82 `Resolve-CodeGraphVersion ${psq(pinned)} ${psq(REPO)} ${psq(base)} ${psq(base)}`,
83 ].join('\n');
84 const encoded = Buffer.from(script, 'utf16le').toString('base64');
85 return new Promise((resolve) => {
86 execFile(
87 'powershell.exe',
88 ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-EncodedCommand', encoded],
89 { windowsHide: true, timeout: 60_000 },
90 (err, stdout, stderr) => {
91 const code = err ? (typeof err.code === 'number' ? err.code : 1) : 0;
92 resolve({ code, stdout: stdout.trim(), stderr });
93 },
94 );
95 });
96 }
97
98 it('reads the latest release from the redirect: one HEAD, not followed, no API call', async () => {
99 const r = await resolveVersion('');

Callers 1

Calls 5

extractResolverFunction · 0.85
psqFunction · 0.85
fromMethod · 0.80
resolveFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected