wishforge-ide/apps/ide/scripts/catalog-builtin-plugins.mjs
eust-w 0ef99b1e6d style: add Prettier and EditorConfig, format the codebase
Adds prettier 3.9.8 (exact) with a shared config (single quotes,
120 columns, trailing commas), .prettierignore, .editorconfig and the
`format` / `format:check` scripts, then formats all TypeScript,
JavaScript, CSS, JSON and YAML sources.

Purely mechanical: no behaviour change. Typecheck passes, the vitest
suite and the 74 IDE node tests produce the same results as before
(socket-binding tests still cannot run inside this sandbox).
Previously the longest source line was ~3000 characters; reviewing the
following semantic changes now produces readable diffs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:32:43 +08:00

44 lines
2.0 KiB
JavaScript

// Operator-only lockfile maintenance. Input must be the exact official release
// archive; this never signs or approves an arbitrary installed runtime directory.
import { execFileSync } from 'node:child_process';
import { createHash } from 'node:crypto';
import { readFile } from 'node:fs/promises';
const source = {
url: 'https://github.com/eclipse-theia/vscode-builtin-extensions/releases/download/1.108.2/vscode-builtin-extensions-1.108.2.tar.gz',
sha256: '05a20cf3e671c8d328b04d9ce72b25688b0e762e4a3f5592f31a21ee38280367',
};
if (process.argv.length !== 3)
throw new Error('Usage: node scripts/catalog-builtin-plugins.mjs /path/to/vscode-builtin-extensions-1.108.2.tar.gz');
const archive = process.argv[2];
if (
createHash('sha256')
.update(await readFile(archive))
.digest('hex') !== source.sha256
)
throw new Error('BUILTIN_ARCHIVE_DIGEST_REJECTED');
const plugins = JSON.parse(
execFileSync(
'python3',
[
'-c',
`
import hashlib,io,json,pathlib,sys,tarfile,zipfile
plugins=[]
with tarfile.open(sys.argv[1],'r:gz') as tar:
for item in tar.getmembers():
if item.isdir(): continue
if not item.isfile() or not item.name.endswith('.vsix'): raise ValueError('Unexpected release entry')
with zipfile.ZipFile(io.BytesIO(tar.extractfile(item).read())) as z:
manifest=json.loads(z.read('extension/package.json'))
files=sorted((i.filename,hashlib.sha256(z.read(i)).hexdigest()) for i in z.infolist() if not i.is_dir())
digest=hashlib.sha256(''.join(name+'\\0'+sha+'\\n' for name,sha in files).encode()).hexdigest()
plugins.append({'directory':pathlib.PurePosixPath(item.name).stem,'id':manifest['publisher']+'.'+manifest['name'],'version':manifest['version'],'sha256':digest})
print(json.dumps(sorted(plugins,key=lambda p:p['directory'])))
`,
archive,
],
{ encoding: 'utf8', maxBuffer: 4 * 1024 * 1024 },
),
);
console.log(JSON.stringify({ schemaVersion: 1, source, plugins }, null, 2));