|
|
@@ -200,7 +200,45 @@ function verifyFreshInstall(tarballPath: string) {
|
|
|
"if (pkg?.id !== 'oh-my-opencode-slim') throw new Error('default export has an unexpected plugin id');",
|
|
|
"if (typeof pkg.server !== 'function') throw new Error('default export is missing a server plugin factory');",
|
|
|
"if (typeof pkg.setup !== 'function') throw new Error('default export is missing a v2 setup factory');",
|
|
|
+ 'const asyncNoop = async () => ({});',
|
|
|
+ 'const client = new Proxy({}, {',
|
|
|
+ ' get(_target, property) {',
|
|
|
+ " if (property === 'app') return { log: asyncNoop };",
|
|
|
+ " if (property === 'session') return { abort: asyncNoop };",
|
|
|
+ ' return new Proxy({}, { get: () => asyncNoop });',
|
|
|
+ ' },',
|
|
|
+ '});',
|
|
|
+ 'globalThis.fetch = async () => new Response(',
|
|
|
+ " '<!doctype html><html><head><title>Release smoke</title></head><body><main><h1>Release smoke</h1><p>packaged jsdom extraction works</p></main></body></html>',",
|
|
|
+ " { status: 200, headers: { 'content-type': 'text/html; charset=utf-8' } },",
|
|
|
+ ');',
|
|
|
+ 'const plugin = await pkg.server({',
|
|
|
+ ' client,',
|
|
|
+ ' directory: process.cwd(),',
|
|
|
+ ' worktree: process.cwd(),',
|
|
|
+ " serverUrl: new URL('http://127.0.0.1:4096'),",
|
|
|
+ '});',
|
|
|
+ 'const webfetch = plugin?.tool?.webfetch;',
|
|
|
+ "if (typeof webfetch?.execute !== 'function') throw new Error('server plugin did not register webfetch');",
|
|
|
+ 'const result = await webfetch.execute({',
|
|
|
+ " url: 'https://example.com/release-smoke',",
|
|
|
+ " format: 'markdown',",
|
|
|
+ ' timeout: 10,',
|
|
|
+ ' extract_main: true,',
|
|
|
+ " prefer_llms_txt: 'never',",
|
|
|
+ ' include_metadata: false,',
|
|
|
+ ' save_binary: false,',
|
|
|
+ '}, {',
|
|
|
+ ' ask: async () => undefined,',
|
|
|
+ ' metadata: () => undefined,',
|
|
|
+ ' abort: new AbortController().signal,',
|
|
|
+ ' directory: process.cwd(),',
|
|
|
+ " sessionID: 'release-smoke',",
|
|
|
+ '});',
|
|
|
+ "if (!String(result).includes('packaged jsdom extraction works')) throw new Error('packaged webfetch did not extract the expected document');",
|
|
|
+ 'await plugin.dispose?.();',
|
|
|
"console.log('package loads');",
|
|
|
+ "console.log('packaged webfetch constructs and extracts a document');",
|
|
|
'process.exit(0);',
|
|
|
].join('\n');
|
|
|
console.log('Importing installed package entrypoint...');
|
|
|
@@ -208,19 +246,6 @@ function verifyFreshInstall(tarballPath: string) {
|
|
|
cwd: installDir,
|
|
|
});
|
|
|
|
|
|
- const jsdomSmokeScript = [
|
|
|
- "import { JSDOM } from 'jsdom';",
|
|
|
- "const dom = new JSDOM('<p>hello</p>');",
|
|
|
- "if (dom.window.document.querySelector('p')?.textContent !== 'hello') throw new Error('JSDOM did not construct the expected document');",
|
|
|
- 'dom.window.close();',
|
|
|
- "console.log('jsdom constructs a document');",
|
|
|
- 'process.exit(0);',
|
|
|
- ].join('\n');
|
|
|
- console.log('Importing installed jsdom and constructing a document...');
|
|
|
- run('node', ['--input-type=module', '--eval', jsdomSmokeScript], {
|
|
|
- cwd: installDir,
|
|
|
- });
|
|
|
-
|
|
|
const tuiSmokeScript = [
|
|
|
"import pkg from 'oh-my-opencode-slim/tui';",
|
|
|
"if (pkg?.id !== 'oh-my-opencode-slim:tui') throw new Error('TUI export has an unexpected plugin id');",
|