mirror of
https://github.com/Twigpine/zero.git
synced 2026-11-11 18:00:54 -10:00
- replace JSON provider/model descriptors with TOML definitions and global model metadata - add provider discovery for OpenAI-compatible, gateway, and localhost catalog entries - resolve global model references, first-party ownership, and per-model transport overrides - update provider auth/header handling, dynamic discovery cache behavior, and provider command parsing - harden file/search tools and align tests/docs/build embedding with the TOML catalog
36 lines
926 B
TypeScript
36 lines
926 B
TypeScript
import { Glob } from 'bun';
|
|
import { mkdirSync } from 'fs';
|
|
|
|
const catalogFiles = [
|
|
...new Glob('src/providers/catalog/definitions/*.toml').scanSync('.'),
|
|
...new Glob('src/providers/catalog/models/*.toml').scanSync('.'),
|
|
];
|
|
|
|
mkdirSync('.zero-build', { recursive: true });
|
|
mkdirSync('dist', { recursive: true });
|
|
|
|
const catalogAssetEntrypoint = '.zero-build/provider-catalog-assets.ts';
|
|
await Bun.write(
|
|
catalogAssetEntrypoint,
|
|
catalogFiles
|
|
.map((file, index) => {
|
|
const importPath = `../${file.replaceAll('\\', '/')}`;
|
|
return `import catalogAsset${index} from '${importPath}' with { type: 'file' };\nvoid catalogAsset${index};`;
|
|
})
|
|
.join('\n')
|
|
);
|
|
|
|
const result = await Bun.build({
|
|
entrypoints: ['src/index.ts', catalogAssetEntrypoint],
|
|
compile: {
|
|
outfile: 'dist/zero',
|
|
},
|
|
});
|
|
|
|
if (!result.success) {
|
|
for (const log of result.logs) {
|
|
console.error(log);
|
|
}
|
|
process.exit(1);
|
|
}
|