@domandigital/craft 0.16.0 → 0.18.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/CHANGELOG.md +17 -0
- package/CHARACTER.md +41 -6
- package/COPY.md +5 -0
- package/README.md +31 -1
- package/REGISTERS.md +163 -0
- package/dist/{audit-UJCUWORL.js → audit-4SFSLCKY.js} +3 -2
- package/dist/audit.cjs +1 -1
- package/dist/audit.d.cts +7 -0
- package/dist/audit.d.ts +7 -0
- package/dist/audit.js +1 -1
- package/dist/chunk-4QWEAL4G.js +1595 -0
- package/dist/{chunk-WAV6AKR4.js → chunk-6TSDYETQ.js} +4 -2
- package/dist/{chunk-TQKDCA4V.js → chunk-DARKHE6A.js} +7 -5
- package/dist/{chunk-LXDNIJFG.js → chunk-O5B5ELJH.js} +28 -20
- package/dist/chunk-QIEDBL4J.js +9 -0
- package/dist/{chunk-CVG5GSMN.js → chunk-RJVG5KA6.js} +8 -6
- package/dist/{chunk-YK2FFL6Z.js → chunk-SL5VZJ2J.js} +1 -1
- package/dist/{chunk-B2MJLGF6.js → chunk-WFB6F3BN.js} +65 -1633
- package/dist/{chunk-LWVGIJ5A.js → chunk-ZUYERAFM.js} +11 -6
- package/dist/{cli-AVYNHBFJ.js → cli-BN4IT6N2.js} +5 -3
- package/dist/{cli-PEATEW57.js → cli-GXIW7F3E.js} +7 -5
- package/dist/cli-JB4X5LAG.js +1573 -0
- package/dist/{cli-52M62QBN.js → cli-JZRQBCD4.js} +7 -5
- package/dist/{cli-3GQROFCB.js → cli-MDW7JTEF.js} +15 -10
- package/dist/{cli-CWORJYOU.js → cli-V44QEVS6.js} +12 -9
- package/dist/{cli-K4LSRYBE.js → cli-Y7Y5IROK.js} +8 -5
- package/dist/cli.js +4 -2
- package/dist/index.cjs +1549 -101
- package/dist/index.d.cts +247 -1
- package/dist/index.d.ts +247 -1
- package/dist/index.js +1529 -101
- package/package.json +3 -2
|
@@ -4,14 +4,16 @@ import {
|
|
|
4
4
|
merge,
|
|
5
5
|
resolvePages,
|
|
6
6
|
runAudit
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-DARKHE6A.js";
|
|
8
|
+
import "./chunk-SL5VZJ2J.js";
|
|
9
9
|
import "./chunk-JYNXGCYZ.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-ZUYERAFM.js";
|
|
11
11
|
import "./chunk-OQXTQQAU.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-O5B5ELJH.js";
|
|
13
|
+
import "./chunk-QIEDBL4J.js";
|
|
13
14
|
import "./chunk-WUACK2HX.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-WFB6F3BN.js";
|
|
16
|
+
import "./chunk-4QWEAL4G.js";
|
|
15
17
|
import "./chunk-QYBAVU3P.js";
|
|
16
18
|
export {
|
|
17
19
|
describeComponents,
|
|
@@ -4,12 +4,14 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
expandNullTargets,
|
|
6
6
|
loadNull
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZUYERAFM.js";
|
|
8
8
|
import "./chunk-OQXTQQAU.js";
|
|
9
9
|
import {
|
|
10
|
-
parseFlags
|
|
10
|
+
parseFlags
|
|
11
|
+
} from "./chunk-O5B5ELJH.js";
|
|
12
|
+
import {
|
|
11
13
|
toJson
|
|
12
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QIEDBL4J.js";
|
|
13
15
|
import {
|
|
14
16
|
readSnapshot
|
|
15
17
|
} from "./chunk-WUACK2HX.js";
|
|
@@ -19,7 +21,8 @@ import {
|
|
|
19
21
|
fingerprint,
|
|
20
22
|
scanSource,
|
|
21
23
|
typicality
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WFB6F3BN.js";
|
|
25
|
+
import "./chunk-4QWEAL4G.js";
|
|
23
26
|
import {
|
|
24
27
|
SNAPSHOT_VERSION
|
|
25
28
|
} from "./chunk-QYBAVU3P.js";
|
|
@@ -34,6 +37,7 @@ var LABELS = ["ai", "ai-looking", "human"];
|
|
|
34
37
|
var FLAGGED_TARGET = 0.9;
|
|
35
38
|
var HUMAN_TYPICAL_TARGET = 0.1;
|
|
36
39
|
var SURFACE = new Map(CATALOGUE.map((t) => [t.id, t.surface]));
|
|
40
|
+
var GENERATION = new Map(CATALOGUE.map((t) => [t.id, t.generation]));
|
|
37
41
|
function designTells(tells) {
|
|
38
42
|
return tells.filter((t) => SURFACE.has(t) && SURFACE.get(t) !== "copy");
|
|
39
43
|
}
|
|
@@ -70,7 +74,7 @@ function calibrate(pages, unmeasured = []) {
|
|
|
70
74
|
const tells = [...fired].map((tell) => {
|
|
71
75
|
const hits = Object.fromEntries(LABELS.map((l) => [l, pages.filter((p) => p.label === l && p.tells.includes(tell)).length]));
|
|
72
76
|
const on = hits.ai + hits["ai-looking"];
|
|
73
|
-
return { tell, hits, precision: round(on / (on + hits.human)), recall: positives ? round(on / positives) : null };
|
|
77
|
+
return { tell, generation: GENERATION.get(tell) ?? null, hits, precision: round(on / (on + hits.human)), recall: positives ? round(on / positives) : null };
|
|
74
78
|
}).sort((a, b) => b.hits.ai + b.hits["ai-looking"] + b.hits.human - (a.hits.ai + a.hits["ai-looking"] + a.hits.human) || a.tell.localeCompare(b.tell));
|
|
75
79
|
const human = byLabel.human;
|
|
76
80
|
const humanNote = missing("human") ? `; ${missing("human")} not measured, counted neither way` : "";
|
|
@@ -102,18 +106,18 @@ function formatCalibration(c, notes = []) {
|
|
|
102
106
|
lines.push("", `Not measured: ${c.unmeasured.length}. A page not measured never counts as a pass.`);
|
|
103
107
|
for (const u of c.unmeasured) lines.push(` ${u.id} (${u.label}): ${u.reason}`);
|
|
104
108
|
}
|
|
105
|
-
lines.push("", "Targets");
|
|
109
|
+
lines.push("", "Flagged is a look-closer signal, not a verdict that a site is AI-made. Nothing gates on it.", "", "Targets");
|
|
106
110
|
for (const t of c.targets) lines.push(` ${t.target.padEnd(50)} ${t.met === null ? "not known" : t.met ? "met" : "NOT MET"}`, ` ${t.detail}`);
|
|
107
111
|
lines.push("", ` ${"label".padEnd(11)} ${"pages".padStart(5)} ${"flagged".padStart(8)} ${"typical".padStart(8)} ${"tell-heavy".padStart(11)} ${"blocking".padStart(9)}`);
|
|
108
112
|
for (const s of c.labels) {
|
|
109
113
|
lines.push(` ${s.label.padEnd(11)} ${String(s.pages).padStart(5)} ${String(s.flagged).padStart(8)} ${String(s.typical ?? "-").padStart(8)} ${String(s.tellHeavy).padStart(11)} ${String(s.blocking).padStart(9)}`);
|
|
110
114
|
}
|
|
111
115
|
lines.push("", "Per tell. A hit on ai or ai-looking counts for the tell; a hit on human counts against it.");
|
|
112
|
-
lines.push(` ${"tell".padEnd(28)} ${"ai".padStart(7)} ${"ai-looking".padStart(10)} ${"human".padStart(7)} ${"precision".padStart(9)} ${"recall".padStart(7)}`);
|
|
116
|
+
lines.push(` ${"tell".padEnd(28)} ${"gen".padStart(3)} ${"ai".padStart(7)} ${"ai-looking".padStart(10)} ${"human".padStart(7)} ${"precision".padStart(9)} ${"recall".padStart(7)}`);
|
|
113
117
|
const of = (l) => c.labels.find((s) => s.label === l)?.pages ?? 0;
|
|
114
118
|
for (const t of c.tells) {
|
|
115
119
|
lines.push(
|
|
116
|
-
` ${t.tell.padEnd(28)} ${`${t.hits.ai}/${of("ai")}`.padStart(7)} ${`${t.hits["ai-looking"]}/${of("ai-looking")}`.padStart(10)} ${`${t.hits.human}/${of("human")}`.padStart(7)} ${t.precision.toFixed(2).padStart(9)} ${(t.recall === null ? "-" : t.recall.toFixed(2)).padStart(7)}`
|
|
120
|
+
` ${t.tell.padEnd(28)} ${String(t.generation ?? "-").padStart(3)} ${`${t.hits.ai}/${of("ai")}`.padStart(7)} ${`${t.hits["ai-looking"]}/${of("ai-looking")}`.padStart(10)} ${`${t.hits.human}/${of("human")}`.padStart(7)} ${t.precision.toFixed(2).padStart(9)} ${(t.recall === null ? "-" : t.recall.toFixed(2)).padStart(7)}`
|
|
117
121
|
);
|
|
118
122
|
}
|
|
119
123
|
if (!c.tells.length) lines.push(" no tell fired");
|
|
@@ -136,6 +140,7 @@ function parseLabels(raw, name) {
|
|
|
136
140
|
seen.add(p.id);
|
|
137
141
|
if (!LABELS.includes(p.label)) throw new Error(`${at} (${p.id}): "label" is one of ${LABELS.join(", ")}`);
|
|
138
142
|
if (!p.skip && !p.snapshot && !p.source && !p.url) throw new Error(`${at} (${p.id}): needs a snapshot, a source or a url, or a skip saying why not`);
|
|
143
|
+
if (p.home !== void 0 && typeof p.home !== "boolean") throw new Error(`${at} (${p.id}): "home" is true or false`);
|
|
139
144
|
}
|
|
140
145
|
if (file.null !== void 0 && (!Array.isArray(file.null) || file.null.some((n) => typeof n !== "string"))) throw new Error(`${name}: "null" is a list of paths`);
|
|
141
146
|
return file;
|
|
@@ -183,7 +188,7 @@ async function runCalibrate(args, io) {
|
|
|
183
188
|
if (toTake.length) {
|
|
184
189
|
io.err(`craft calibrate: taking ${toTake.length} snapshot${toTake.length === 1 ? "" : "s"}`);
|
|
185
190
|
try {
|
|
186
|
-
const { snapshotUrls } = await import("./audit-
|
|
191
|
+
const { snapshotUrls } = await import("./audit-4SFSLCKY.js");
|
|
187
192
|
const results = await snapshotUrls(toTake.map((t) => t.url));
|
|
188
193
|
results.forEach((r, i) => {
|
|
189
194
|
const { entry, keep } = toTake[i];
|
|
@@ -200,7 +205,7 @@ async function runCalibrate(args, io) {
|
|
|
200
205
|
}
|
|
201
206
|
}
|
|
202
207
|
const measured = labels.pages.filter((e) => snapshots.has(e.id)).map((entry) => {
|
|
203
|
-
const snap = snapshots.get(entry.id);
|
|
208
|
+
const snap = { ...snapshots.get(entry.id), home: entry.home ?? true };
|
|
204
209
|
const rendered = auditSnapshot(snap);
|
|
205
210
|
const source = entry.source && existsSync(resolve(base, entry.source)) ? scanSource([{ path: entry.source, text: readFileSync(resolve(base, entry.source), "utf8") }]) : void 0;
|
|
206
211
|
const tells = new Set([...rendered.findings, ...source?.findings ?? []].map((f) => f.tell));
|
|
@@ -3,21 +3,21 @@ import {
|
|
|
3
3
|
} from "./chunk-NTIPJ5U7.js";
|
|
4
4
|
import {
|
|
5
5
|
merge
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-DARKHE6A.js";
|
|
7
|
+
import "./chunk-SL5VZJ2J.js";
|
|
8
8
|
import "./chunk-JYNXGCYZ.js";
|
|
9
9
|
import {
|
|
10
10
|
SIBLING_AT,
|
|
11
11
|
compareToEstate,
|
|
12
12
|
loadEstate
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RJVG5KA6.js";
|
|
14
14
|
import {
|
|
15
15
|
PAGE_TYPES,
|
|
16
16
|
validateDirection
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-6TSDYETQ.js";
|
|
18
18
|
import {
|
|
19
19
|
loadNull
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-ZUYERAFM.js";
|
|
21
21
|
import "./chunk-OQXTQQAU.js";
|
|
22
22
|
import {
|
|
23
23
|
COPY_FILE,
|
|
@@ -27,9 +27,11 @@ import {
|
|
|
27
27
|
loadConfig,
|
|
28
28
|
loadExceptions,
|
|
29
29
|
parseFlags,
|
|
30
|
-
readPaths
|
|
30
|
+
readPaths
|
|
31
|
+
} from "./chunk-O5B5ELJH.js";
|
|
32
|
+
import {
|
|
31
33
|
toJson
|
|
32
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-QIEDBL4J.js";
|
|
33
35
|
import {
|
|
34
36
|
readSnapshot
|
|
35
37
|
} from "./chunk-WUACK2HX.js";
|
|
@@ -40,7 +42,8 @@ import {
|
|
|
40
42
|
fingerprint,
|
|
41
43
|
scanSource,
|
|
42
44
|
typicality
|
|
43
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-WFB6F3BN.js";
|
|
46
|
+
import "./chunk-4QWEAL4G.js";
|
|
44
47
|
import "./chunk-QYBAVU3P.js";
|
|
45
48
|
|
|
46
49
|
// src/report/cli.ts
|
|
@@ -123,7 +126,7 @@ async function runReport(command, args, io) {
|
|
|
123
126
|
if (/\.json$/i.test(target2) && existsSync(local)) {
|
|
124
127
|
snap = readSnapshot(JSON.parse(readFileSync(local, "utf8")), target2);
|
|
125
128
|
} else {
|
|
126
|
-
const { snapshotUrl } = await import("./audit-
|
|
129
|
+
const { snapshotUrl } = await import("./audit-4SFSLCKY.js");
|
|
127
130
|
snap = await snapshotUrl(target2);
|
|
128
131
|
}
|
|
129
132
|
const fp = fingerprint(snap);
|
|
@@ -7,11 +7,13 @@ import {
|
|
|
7
7
|
PROPOSED,
|
|
8
8
|
researchPrompt,
|
|
9
9
|
validateDirection
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6TSDYETQ.js";
|
|
11
|
+
import {
|
|
12
|
+
parseFlags
|
|
13
|
+
} from "./chunk-O5B5ELJH.js";
|
|
11
14
|
import {
|
|
12
|
-
parseFlags,
|
|
13
15
|
toJson
|
|
14
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-QIEDBL4J.js";
|
|
15
17
|
import {
|
|
16
18
|
readSnapshot
|
|
17
19
|
} from "./chunk-WUACK2HX.js";
|
|
@@ -24,7 +26,8 @@ import {
|
|
|
24
26
|
isCream,
|
|
25
27
|
oklchToRgb,
|
|
26
28
|
parseColour
|
|
27
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-WFB6F3BN.js";
|
|
30
|
+
import "./chunk-4QWEAL4G.js";
|
|
28
31
|
import "./chunk-QYBAVU3P.js";
|
|
29
32
|
|
|
30
33
|
// src/direction/cli.ts
|
|
@@ -205,7 +208,7 @@ var readJson = (path) => JSON.parse(readFileSync(path, "utf8"));
|
|
|
205
208
|
async function snapshotFrom(target, cwd) {
|
|
206
209
|
if (!target) return void 0;
|
|
207
210
|
if (/^https?:\/\//.test(target)) {
|
|
208
|
-
const { snapshotUrl } = await import("./audit-
|
|
211
|
+
const { snapshotUrl } = await import("./audit-4SFSLCKY.js");
|
|
209
212
|
return snapshotUrl(target);
|
|
210
213
|
}
|
|
211
214
|
return readSnapshot(readJson(resolve(cwd, target)), target);
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
run
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-O5B5ELJH.js";
|
|
5
|
+
import "./chunk-QIEDBL4J.js";
|
|
6
|
+
import "./chunk-WFB6F3BN.js";
|
|
7
|
+
import "./chunk-4QWEAL4G.js";
|
|
6
8
|
import "./chunk-QYBAVU3P.js";
|
|
7
9
|
|
|
8
10
|
// src/cli.ts
|