@mdvp/cli 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.mjs +10 -18
- package/package.json +3 -3
package/cli.mjs
CHANGED
|
@@ -237,29 +237,21 @@ async function cmdHire(opts) {
|
|
|
237
237
|
const workerUrl = `${API}/crawler-worker.mjs`
|
|
238
238
|
const extractUrl = `${API}/extract.js`
|
|
239
239
|
|
|
240
|
-
|
|
241
|
-
const {
|
|
242
|
-
|
|
240
|
+
const download = (url, dest) => new Promise((res, rej) => {
|
|
241
|
+
const { get: g } = pickModule(url)
|
|
242
|
+
g(url, { headers: { Accept: "text/plain" } }, (r) => {
|
|
243
243
|
let body = ""
|
|
244
244
|
r.on("data", (c) => (body += c))
|
|
245
|
-
r.on("end", () => {
|
|
246
|
-
writeFileSync(`${dir}/crawler-worker.mjs`, body)
|
|
247
|
-
res()
|
|
248
|
-
})
|
|
245
|
+
r.on("end", () => { try { writeFileSync(dest, body); res() } catch { rej(new Error("write failed")) } })
|
|
249
246
|
}).on("error", rej)
|
|
250
|
-
}).catch(() => process.stderr.write(`${DIM}Could not download worker, using local copy${R}\n`))
|
|
251
|
-
|
|
252
|
-
await new Promise((res) => {
|
|
253
|
-
get(extractUrl, { headers: { Accept: "text/plain" } }, (r) => {
|
|
254
|
-
let body = ""
|
|
255
|
-
r.on("data", (c) => (body += c))
|
|
256
|
-
r.on("end", () => {
|
|
257
|
-
try { writeFileSync(`${dir}/extract.js`, body) } catch {}
|
|
258
|
-
res()
|
|
259
|
-
})
|
|
260
|
-
}).on("error", () => res())
|
|
261
247
|
})
|
|
262
248
|
|
|
249
|
+
await download(workerUrl, `${dir}/crawler-worker.mjs`)
|
|
250
|
+
.catch(() => process.stderr.write(`${DIM}Could not download worker${R}\n`))
|
|
251
|
+
|
|
252
|
+
await download(extractUrl, `${dir}/extract.js`)
|
|
253
|
+
.catch(() => {})
|
|
254
|
+
|
|
263
255
|
if (!existsSync(`${dir}/package.json`)) {
|
|
264
256
|
writeFileSync(`${dir}/package.json`, '{"type":"module"}')
|
|
265
257
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mdvp/cli",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Machine Design Vision Protocol
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"description": "Machine Design Vision Protocol — gives agents eyes to understand design quality",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mdvp": "./cli.mjs"
|
|
7
7
|
},
|
|
@@ -23,4 +23,4 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://mdvp.tixo-digital.workers.dev",
|
|
25
25
|
"license": "MIT"
|
|
26
|
-
}
|
|
26
|
+
}
|