@mdvp/cli 1.6.0 → 1.7.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 +15 -3
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -84,11 +84,23 @@ function apiPost(path, data, apiKey, baseUrl = API) {
|
|
|
84
84
|
async function cmdAudit(domain, { json }) {
|
|
85
85
|
domain = parseDomain(domain)
|
|
86
86
|
process.stderr.write(`${DIM}fetching ${domain}...${R}\n`)
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
|
|
88
|
+
// Try direct lookup first, fall back to full scan
|
|
89
|
+
let site = null
|
|
90
|
+
try {
|
|
91
|
+
const direct = await apiGet(`/dataset/${domain}`)
|
|
92
|
+
if (direct && direct.id) site = direct
|
|
93
|
+
} catch (_) {}
|
|
94
|
+
|
|
95
|
+
if (!site) {
|
|
96
|
+
const data = await apiGet(`/dataset?limit=1000`)
|
|
97
|
+
site = (data.sites ?? []).find((s) => s.id === domain) ?? null
|
|
98
|
+
}
|
|
99
|
+
|
|
89
100
|
if (!site) {
|
|
90
101
|
if (json) { console.log(JSON.stringify({ error: "not_in_dataset", domain }, null, 2)); process.exit(1) }
|
|
91
|
-
console.error(`${RED}not in dataset: ${domain}${R}
|
|
102
|
+
console.error(`${RED}not in dataset: ${domain}${R}`)
|
|
103
|
+
console.error(`${DIM}submit for crawl: npx @mdvp/cli submit ${domain}${R}`)
|
|
92
104
|
process.exit(1)
|
|
93
105
|
}
|
|
94
106
|
const bd = site.scores?.breakdown ?? []
|