Files
HarvmasterandClaude Opus 5.5 fa8f775779 Restructure into a monorepo: models, VS Code extension, daemon, shared
- models/: GGUFs (Git LFS), manifest.json, model card, Apache-2.0 LICENSE + NOTICE
- extensions/vscode/: the Local Autocomplete extension (v0.5.0, publisher harvmaster)
- daemon/: acd completion daemon (bundled into the extension; also runs standalone)
- shared/: prompt layout + symbol extraction shared with the training pipeline
- scripts/: make-model-release.mjs, publish-extension-release.mjs (Gitea releases)
- README with quick start, settings, architecture, build and release instructions;
  MIT license for code; CHANGELOG

The default model manifest URL moves to models/manifest.json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 15:37:19 +00:00

44 lines
2.3 KiB
JavaScript

// Bundles ../../daemon (and ../../shared) into dist/daemon so the extension can run
// the daemon on VS Code's own Node runtime, with no separate install.
import { build } from 'esbuild'
import fs from 'node:fs'
import { createRequire } from 'node:module'
import path from 'node:path'
// @vue/compiler-sfc lazily require()s ~40 optional template engines (pug, twig, …) that we never
// use (we only call parse()). Leave anything unresolvable from inside it as a lazy external require.
const optionalVueDeps = {
name: 'optional-vue-deps',
setup(b) {
b.onResolve({ filter: /^[^./]/ }, args => {
if (!args.importer.includes('@vue/compiler-sfc') && !args.importer.includes('consolidate')) return undefined
try { createRequire(args.importer).resolve(args.path); return undefined } catch { return { path: args.path, external: true } }
})
},
}
const out = 'dist/daemon'
fs.rmSync(out, { recursive: true, force: true })
const result = await build({
entryPoints: { acd: '../../daemon/src/main.ts', 'symbols-worker': '../../daemon/src/symbols-worker.ts' },
outdir: out,
outExtension: { '.js': '.mjs' },
bundle: true,
platform: 'node',
format: 'esm',
target: 'node18',
minify: true,
legalComments: 'external',
logLevel: 'warning',
metafile: true,
plugins: [optionalVueDeps],
// Bundled CJS deps (typescript) use require/__filename/__dirname; give the ESM output real ones.
banner: { js: "import { createRequire as __cr } from 'node:module'; import { fileURLToPath as __fu } from 'node:url'; import { dirname as __dn } from 'node:path'; const require = __cr(import.meta.url); const __filename = __fu(import.meta.url); const __dirname = __dn(__filename);" },
})
fs.mkdirSync(`${out}/assets`, { recursive: true })
for (const f of ['qwen-tokenizer.json', 'qwen-tokenizer_config.json']) fs.copyFileSync(`../../daemon/assets/${f}`, `${out}/assets/${f}`)
// TypeScript looks for its lib.*.d.ts next to the executing file (the bundled worker).
const tsLib = path.dirname(createRequire(import.meta.url).resolve('../../shared/node_modules/typescript/lib/typescript.js'))
for (const f of fs.readdirSync(tsLib)) if (/^lib\..*\.d\.ts$/.test(f)) fs.copyFileSync(path.join(tsLib, f), `${out}/${f}`)
for (const [file, info] of Object.entries(result.metafile.outputs)) if (file.endsWith('.mjs')) console.log(file, (info.bytes / 1e6).toFixed(1) + ' MB')