Lines 80-120javascript
86 throw new Error(`Unexpected positional argument: ${a} (quote the query as a single argument).`);
89 if (!out.query.trim()) {
90 throw new Error(`Usage: mla ask "<query>" [--mode answer|search|canonical|compare] [--workspace <id>] [--as-of <date>] [--max <n>] [--min <n>] [--plain]`);
94// ask-core is plain ESM; `mla` compiles to CommonJS. A literal dynamic import()
95// would be downleveled by tsc to require(), which cannot load an ESM-only
96// package on Node < 22. The Function constructor preserves a TRUE runtime
97// import() so it works on every supported Node (>=18.18). Used only by the dev
98// fallback below (ts-node, no built dist). Resolve ask-core as a sibling package
99// directory (packages/ask-core), three levels up from the compiled commands dir
100// (dist/commands -> dist -> cli -> packages).
101const trueDynamicImport = new Function("u", "return import(u)");
102function askCoreDir() {
LowEval
Package source references a known benign dynamic code generation pattern.
dist/commands/ask.jsView on unpkg · L100 103 return path.resolve(__dirname, "..", "..", "..", "ask-core");
105// The CJS bundle the build emits (scripts/bundle-esm.js -> dist/bundles/). It
106// sits a sibling level up from the compiled commands dir: dist/commands -> dist
108function bundlePath(name) {
109 return path.resolve(__dirname, "..", "bundles", name);
111function notesRoot() {
112 if (process.env.MEETLESS_NOTES_ROOT)
113 return process.env.MEETLESS_NOTES_ROOT;
114 // Best-effort: the standalone notes repo is a sibling of the code repo. A
115 // missing INDEX.md degrades to retrieval, so an imperfect guess here is
117 return path.resolve(__dirname, "..", "..", "..", "..", "..", "notes");
119// Load ask-core from its ESM source files (the original path). Kept as the dev
120// fallback for `pnpm dev` (ts-node), where no dist/bundles exists. Never reached