rebilder 0.3.0 → 0.5.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 +12 -0
- package/README.md +23 -14
- package/dist/bin.js +66 -18
- package/dist/bin.js.map +1 -1
- package/dist/index.d.ts +14 -7
- package/dist/index.js +66 -18
- package/dist/index.js.map +1 -1
- package/package.json +9 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ Notable changes to the `rebilder` command-line tool. Exit codes are a stable con
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## 0.5.0 (2026-10-17)
|
|
8
|
+
|
|
9
|
+
- `rebilder init` wires reporting into the generated config. It reports agent visits to your Rebilder Console once you set `REBILDER_API_KEY` and `REBILDER_STORE_ID`, which a free account provides. Without the key, nothing is sent. The CLI itself still makes no network request.
|
|
10
|
+
|
|
11
|
+
## 0.4.0 (2026-10-06)
|
|
12
|
+
|
|
13
|
+
- **Scores against ARS 0.3.** Weights and check ids are unchanged. When a page does not send a Markdown copy but links one on the same site, `check` fetches that one copy. A copy that loads earns 6 of the Markdown check's 9 points. More action words count as a page's main action, such as "shop", "free trial", "get a demo" and "talk to sales". Evidence lines and fixes are written in plain language.
|
|
14
|
+
- When a page's linked Markdown copy works, **Your next steps** says so and shows how to earn the rest: send the copy from the page address too. `diff` says when its parity check compared the linked copy rather than the two requests.
|
|
15
|
+
- `rebilder init` gives the Markdown check its real weight, 9 points. It said 10.
|
|
16
|
+
- The probe budget allows seven requests per URL instead of six, so a multi-URL run has room for linked copies.
|
|
17
|
+
- The source code is public at https://github.com/rebilder/rebilder/tree/main/packages/cli. `repository` and `bugs` point there, and issues and pull requests are welcome.
|
|
18
|
+
|
|
7
19
|
## 0.3.0 (2026-09-28)
|
|
8
20
|
|
|
9
21
|
- **Requires Node.js 22 or later.** `engines.node` moves from `>=20.11.0` to `>=22`; Node.js 20 reached end of life in April 2026.
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Help AI assistants understand the business information on your website.
|
|
|
4
4
|
|
|
5
5
|
`rebilder check <url>` fetches a page the way an agent would, fetches it again
|
|
6
6
|
the way a browser would, and scores the result against
|
|
7
|
-
[the Rebilder Agent Readability Spec (ARS 0.
|
|
7
|
+
[the Rebilder Agent Readability Spec (ARS 0.3)](https://rebilder.com/spec/ars). It tells
|
|
8
8
|
you what a machine caller actually receives from your site, what that costs in
|
|
9
9
|
bytes, and which of the 22 checks you are losing points on.
|
|
10
10
|
|
|
@@ -103,9 +103,11 @@ esac
|
|
|
103
103
|
|
|
104
104
|
Per URL it makes **two requests**, an agent probe and a browser control that
|
|
105
105
|
differ in the `Accept` header **and in nothing else**, plus `/robots.txt`,
|
|
106
|
-
`/llms.txt` and `/.well-known/ucp` per origin.
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
`/llms.txt` and `/.well-known/ucp` per origin. When the page does not send a
|
|
107
|
+
Markdown copy but links one on the same site, it fetches that one copy too. A
|
|
108
|
+
copy that loads earns part of the Markdown check. Nothing else is requested;
|
|
109
|
+
there is no guessing at `/sitemap.xml` or `/mcp`. `robots.txt` is fetched first
|
|
110
|
+
and obeyed.
|
|
109
111
|
|
|
110
112
|
Same User-Agent on both probes, because that is what makes the parity check
|
|
111
113
|
meaningful and what stops a correctly installed gateway (which negotiates on
|
|
@@ -186,7 +188,7 @@ Fixes, most points first
|
|
|
186
188
|
A caller that reads the first few kilobytes should already have the fac…
|
|
187
189
|
|
|
188
190
|
Policy: robots.txt ok · assistant allow · training allow (neutral) · sitemap declared
|
|
189
|
-
ARS 0.
|
|
191
|
+
ARS 0.3.0 · ruleset 1d07a1223b34 · corpus e88662472394 · evidence b774a1e59433 · vantage public
|
|
190
192
|
|
|
191
193
|
ARS measures format and retrievability. It does not measure whether the
|
|
192
194
|
facts are true, or whether any assistant cites this page.
|
|
@@ -258,7 +260,7 @@ Fixes, most points first
|
|
|
258
260
|
Price, sizes, weights, hours, fees, lead times, dates — written out whe…
|
|
259
261
|
|
|
260
262
|
Policy: robots.txt ok · assistant allow · training allow (neutral) · sitemap declared
|
|
261
|
-
ARS 0.
|
|
263
|
+
ARS 0.3.0 · ruleset 1d07a1223b34 · corpus e88662472394 · evidence 1fe68289a133 · vantage public
|
|
262
264
|
|
|
263
265
|
ARS measures format and retrievability. It does not measure whether the
|
|
264
266
|
facts are true, or whether any assistant cites this page.
|
|
@@ -306,11 +308,11 @@ Error — —
|
|
|
306
308
|
|
|
307
309
|
Substance parity [heuristic] 3/3
|
|
308
310
|
Compared on price, currency, availability and title only — never description or free text (§3.8).
|
|
309
|
-
•
|
|
310
|
-
• Values:
|
|
311
|
+
• Facts compared: price, currency, availability, name or title [heuristic]
|
|
312
|
+
• Values: match [heuristic]
|
|
311
313
|
|
|
312
314
|
Score: 93/100 A
|
|
313
|
-
ARS 0.
|
|
315
|
+
ARS 0.3.0 · ruleset 1d07a1223b34 · corpus e88662472394 · evidence 1fe68289a133 · vantage public
|
|
314
316
|
|
|
315
317
|
ARS measures format and retrievability. It does not measure whether the
|
|
316
318
|
facts are true, or whether any assistant cites this page.
|
|
@@ -340,10 +342,10 @@ page we never scored is an `<error>`.
|
|
|
340
342
|
<property name="notice" value="ARS measures format and retrievability. It does not measure whether the facts are true, or whether any assistant cites this page."/>
|
|
341
343
|
<property name="url" value="https://basecamp-supply.example/products/alpine-trail-pack-28l"/>
|
|
342
344
|
<property name="generatedAt" value="2026-08-05T00:00:00.000Z"/>
|
|
343
|
-
<property name="tool" value="rebilder 0.
|
|
344
|
-
<property name="specVersion" value="0.
|
|
345
|
-
<property name="rulesetHash" value="
|
|
346
|
-
<property name="corpusHash" value="
|
|
345
|
+
<property name="tool" value="rebilder 0.5.0"/>
|
|
346
|
+
<property name="specVersion" value="0.3.0"/>
|
|
347
|
+
<property name="rulesetHash" value="1d07a1223b3460c3b4d37669c0970d67e9f7e60f121d861201e73dafc9b544b0"/>
|
|
348
|
+
<property name="corpusHash" value="e88662472394316deb404ff02cde136b26a08a54439c52dcd299d80bc8fd9f9e"/>
|
|
347
349
|
<property name="evidenceHash" value="e1cc1ad1476117e7335e4b608e80b4a6e1e0072ce532dd6c9b5f4cce0b2f8b19"/>
|
|
348
350
|
<property name="measuredWeight" value="63"/>
|
|
349
351
|
<property name="heuristicWeight" value="37"/>
|
|
@@ -381,6 +383,12 @@ The scaffold is a skeleton with `TODO`s, not a working config: the resolvers
|
|
|
381
383
|
return **your** source of truth, and every substantive value on a rendered page
|
|
382
384
|
comes from those fields. The gateway never invents one.
|
|
383
385
|
|
|
386
|
+
Reporting is wired in. The generated config sends agent visits to your
|
|
387
|
+
Rebilder Console from your own server once you install `@rebilder/events` and
|
|
388
|
+
set `REBILDER_STORE_ID` and `REBILDER_API_KEY`. A free account provides both at
|
|
389
|
+
[rebilder.com/console/install](https://rebilder.com/console/install). Without
|
|
390
|
+
the key, the config sends nothing. `init` itself still makes no request.
|
|
391
|
+
|
|
384
392
|
---
|
|
385
393
|
|
|
386
394
|
## `rebilder badge`
|
|
@@ -454,7 +462,7 @@ variable, and never inherited.
|
|
|
454
462
|
|
|
455
463
|
Hand-rolled ANSI (off when stdout is not a TTY, off whenever `NO_COLOR` is set,
|
|
456
464
|
on with `FORCE_COLOR`), Unicode box drawing with an ASCII fallback chosen by the
|
|
457
|
-
locale, and `node:util`'s `parseArgs`. Node ≥
|
|
465
|
+
locale, and `node:util`'s `parseArgs`. Node ≥ 22.
|
|
458
466
|
|
|
459
467
|
Colour and Unicode are decided separately because they fail in different places:
|
|
460
468
|
a pipe into a file is perfectly capable of holding `│`, and a `LANG=C` container
|
|
@@ -577,3 +585,4 @@ one command that has to be memorable.
|
|
|
577
585
|
middleware `rebilder init` scaffolds
|
|
578
586
|
- [The Rebilder Agent Readability Spec (ARS)](https://rebilder.com/spec/ars)
|
|
579
587
|
- [Our crawler policy and opt-out](https://rebilder.com/bots)
|
|
588
|
+
- [Source, issues and pull requests](https://github.com/rebilder/rebilder/tree/main/packages/cli) on GitHub
|
package/dist/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { parseArgs } from 'util';
|
|
3
|
-
import { score } from '@rebilder/agent-readability';
|
|
3
|
+
import { DEFAULT_RULESET, score } from '@rebilder/agent-readability';
|
|
4
4
|
import { readFile, writeFile } from 'fs/promises';
|
|
5
5
|
import { resolve } from 'path';
|
|
6
6
|
import { createLimiter, strictPolicy, probeStrict } from '@rebilder/agent-readability/probe';
|
|
@@ -334,8 +334,6 @@ function approxTokensOf(capture) {
|
|
|
334
334
|
const characters = capture.body?.length ?? capture.bytes;
|
|
335
335
|
return Math.round(characters / 4);
|
|
336
336
|
}
|
|
337
|
-
|
|
338
|
-
// src/commands/init.ts
|
|
339
337
|
var FRAMEWORKS = [
|
|
340
338
|
"next",
|
|
341
339
|
"node",
|
|
@@ -467,12 +465,26 @@ async function runInit(command, runtime2) {
|
|
|
467
465
|
}
|
|
468
466
|
return { ...SCAFFOLDS[framework], framework, detection };
|
|
469
467
|
}
|
|
468
|
+
var INGEST_ORIGIN = "https://api.rebilder.com";
|
|
469
|
+
var CONSOLE_INSTALL_URL = "https://rebilder.com/console/install";
|
|
470
470
|
var SHARED_NOTES = [
|
|
471
471
|
"The resolvers return your source of truth. Every substantive value \u2014 price, stock, hours, policy text \u2014 comes from these fields; the gateway never invents one.",
|
|
472
|
-
"The Apache-2.0 SDK serves without a Rebilder account or subscription.
|
|
473
|
-
|
|
472
|
+
"The Apache-2.0 SDK serves without a Rebilder account or subscription.",
|
|
473
|
+
`Reporting is wired in. Install \`@rebilder/events\`, create a free account, then set REBILDER_STORE_ID and REBILDER_API_KEY from ${CONSOLE_INSTALL_URL}. Without the key, nothing is sent.`,
|
|
474
|
+
`Run \`rebilder check <url>\` before and after to see what changed. Sending a Markdown copy from the page address is D2.1 (${DEFAULT_RULESET.weights["machine-representation.negotiated-response"] ?? 0} points) and unlocks D2.3 and D2.4.`
|
|
474
475
|
];
|
|
475
476
|
var CONFIG_BODY = `import type { GatewayConfig } from '@rebilder/gateway'
|
|
477
|
+
import { createHttpEventSink } from '@rebilder/events'
|
|
478
|
+
|
|
479
|
+
// Reports agent visits to your Rebilder Console. Free accounts include it.
|
|
480
|
+
// Copy both values from ${CONSOLE_INSTALL_URL} into your environment.
|
|
481
|
+
// Without REBILDER_API_KEY, nothing is sent.
|
|
482
|
+
const env = (name: string): string | undefined =>
|
|
483
|
+
(globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env?.[name]
|
|
484
|
+
const apiKey = env('REBILDER_API_KEY')
|
|
485
|
+
|
|
486
|
+
// Module scope, not per request: the sink batches (20 events, or every 2s).
|
|
487
|
+
const sink = apiKey ? createHttpEventSink({ url: '${INGEST_ORIGIN}', apiKey }) : null
|
|
476
488
|
|
|
477
489
|
/**
|
|
478
490
|
* Wiring to YOUR source of truth. Each resolver takes a URL and returns the
|
|
@@ -482,7 +494,7 @@ var CONFIG_BODY = `import type { GatewayConfig } from '@rebilder/gateway'
|
|
|
482
494
|
* call except a cache. Anything slower belongs in a build step.
|
|
483
495
|
*/
|
|
484
496
|
export const gatewayConfig: GatewayConfig = {
|
|
485
|
-
storeId: 'TODO-your-store-id',
|
|
497
|
+
storeId: env('REBILDER_STORE_ID') ?? 'TODO-your-store-id',
|
|
486
498
|
sources: {
|
|
487
499
|
// TODO: return your product fields, or null when the URL is not a PDP.
|
|
488
500
|
product: async (url) => {
|
|
@@ -491,8 +503,7 @@ export const gatewayConfig: GatewayConfig = {
|
|
|
491
503
|
},
|
|
492
504
|
// TODO: policies, catalog, document, collection \u2014 add the ones you have.
|
|
493
505
|
},
|
|
494
|
-
|
|
495
|
-
// onEvent: (event) => { void event },
|
|
506
|
+
onEvent: (event) => sink?.emit(event),
|
|
496
507
|
}
|
|
497
508
|
`;
|
|
498
509
|
function scaffold(suggestedPath, mount, notes) {
|
|
@@ -848,6 +859,20 @@ function statusOf(report) {
|
|
|
848
859
|
return report.kind === "rejected" ? "rejected" : report.result.outcome.kind;
|
|
849
860
|
}
|
|
850
861
|
|
|
862
|
+
// src/markdown-copy.ts
|
|
863
|
+
var NEGOTIATED_RESPONSE = "machine-representation.negotiated-response";
|
|
864
|
+
function markdownCopyOf(result) {
|
|
865
|
+
if (result.cost.negotiatedBytes !== null) return "page-address";
|
|
866
|
+
for (const dimension of result.dimensions) {
|
|
867
|
+
for (const check of dimension.checks) {
|
|
868
|
+
if (check.id === NEGOTIATED_RESPONSE) return check.earned > 0 ? "linked" : "none";
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
return "none";
|
|
872
|
+
}
|
|
873
|
+
var LINKED_COPY_NOTE = "Your linked Markdown copy works. Send it from the page address too for full credit.";
|
|
874
|
+
var LINKED_PARITY_NOTE = "This page does not send a Markdown copy itself. These facts come from the Markdown copy it links to.";
|
|
875
|
+
|
|
851
876
|
// src/format/json.ts
|
|
852
877
|
function renderJson(payload, ctx) {
|
|
853
878
|
return JSON.stringify(jsonValue(payload, ctx), null, 2) + "\n";
|
|
@@ -882,6 +907,10 @@ function jsonValue(payload, ctx) {
|
|
|
882
907
|
agent: payload.diff.agent,
|
|
883
908
|
browser: payload.diff.browser,
|
|
884
909
|
substanceParity: payload.diff.parity,
|
|
910
|
+
// Where the Markdown copy came from, so a consumer knows what the
|
|
911
|
+
// parity check compared: `page-address` (negotiation), `linked` (the
|
|
912
|
+
// copy the page links to, ARS 0.3), or `none`.
|
|
913
|
+
markdownCopy: payload.diff.result === null ? null : markdownCopyOf(payload.diff.result),
|
|
885
914
|
result: payload.diff.result
|
|
886
915
|
};
|
|
887
916
|
case "init":
|
|
@@ -1066,15 +1095,26 @@ function nextSteps(result) {
|
|
|
1066
1095
|
const missing = result.factProfile.core.filter((kind) => !found.has(kind));
|
|
1067
1096
|
const steps = [];
|
|
1068
1097
|
if (missing.length > 0) {
|
|
1069
|
-
steps.push(
|
|
1098
|
+
steps.push(
|
|
1099
|
+
`Check these business details: ${missing.join(", ")}. They were not detected in this capture (heuristic); verify the page before adding or changing content.`
|
|
1100
|
+
);
|
|
1070
1101
|
} else {
|
|
1071
|
-
steps.push(
|
|
1102
|
+
steps.push(
|
|
1103
|
+
"The expected core business details were detected (heuristic). Review their accuracy against your current products, services and policies."
|
|
1104
|
+
);
|
|
1072
1105
|
}
|
|
1073
1106
|
const first = result.recommendations[0];
|
|
1074
1107
|
if (first !== void 0) steps.push(`Start with: ${first.title}. ${first.detail}`);
|
|
1075
|
-
|
|
1076
|
-
steps.push(
|
|
1077
|
-
|
|
1108
|
+
const copy = markdownCopyOf(result);
|
|
1109
|
+
steps.push(
|
|
1110
|
+
copy === "page-address" ? "Compare the two responses with rebilder diff <url> and confirm the same business facts reach customers and assistants." : copy === "linked" ? `${LINKED_COPY_NOTE} Run rebilder init in your project to set that up, then connect your real data before deployment.` : "To connect your existing information, run rebilder init in your project. Review the generated configuration and connect your real data before deployment."
|
|
1111
|
+
);
|
|
1112
|
+
steps.push(
|
|
1113
|
+
"After updating your site, run rebilder check <url> again. Export --format markdown --out review.md to share the findings with your team."
|
|
1114
|
+
);
|
|
1115
|
+
steps.push(
|
|
1116
|
+
"This scan measures page readability; it does not measure customer demand, AI recommendations or sales."
|
|
1117
|
+
);
|
|
1078
1118
|
return steps;
|
|
1079
1119
|
}
|
|
1080
1120
|
|
|
@@ -1193,6 +1233,9 @@ function diffSection(diff) {
|
|
|
1193
1233
|
"Compared on price, currency, availability and title only \u2014 never description or free text.",
|
|
1194
1234
|
""
|
|
1195
1235
|
);
|
|
1236
|
+
if (diff.result !== null && markdownCopyOf(diff.result) === "linked") {
|
|
1237
|
+
out.push(LINKED_PARITY_NOTE, "");
|
|
1238
|
+
}
|
|
1196
1239
|
for (const evidence of diff.parity.evidence) {
|
|
1197
1240
|
out.push(
|
|
1198
1241
|
`- ${escapeCell(evidence.label)}: ${escapeCell(evidence.value)} (${basisLabel(evidence.basis)})`
|
|
@@ -1581,6 +1624,9 @@ function diffBlock(diff, pretty) {
|
|
|
1581
1624
|
"gray"
|
|
1582
1625
|
)
|
|
1583
1626
|
);
|
|
1627
|
+
if (diff.result !== null && markdownCopyOf(diff.result) === "linked") {
|
|
1628
|
+
lines.push(paint(` ${LINKED_PARITY_NOTE}`, "gray"));
|
|
1629
|
+
}
|
|
1584
1630
|
for (const evidence of diff.parity.evidence) {
|
|
1585
1631
|
lines.push(
|
|
1586
1632
|
` ${glyphs.bullet} ${evidence.label}: ${evidence.value} [${basisLabel(evidence.basis)}]`
|
|
@@ -1696,8 +1742,9 @@ var CHECK = `rebilder check <url...>
|
|
|
1696
1742
|
|
|
1697
1743
|
Probes each URL twice \u2014 an agent request and a browser control that differ in
|
|
1698
1744
|
the Accept header and in nothing else \u2014 plus /robots.txt, /llms.txt and
|
|
1699
|
-
/.well-known/ucp per origin.
|
|
1700
|
-
|
|
1745
|
+
/.well-known/ucp per origin. When the page does not send a Markdown copy but
|
|
1746
|
+
links one on the same site, that one copy is fetched too. Nothing else is
|
|
1747
|
+
requested. robots.txt is fetched first and obeyed.
|
|
1701
1748
|
|
|
1702
1749
|
OPTIONS
|
|
1703
1750
|
--format ${FORMATS.join("|")} default pretty
|
|
@@ -1723,7 +1770,8 @@ var DIFF = `rebilder diff <url>
|
|
|
1723
1770
|
|
|
1724
1771
|
Shows what the agent request received next to what the browser request
|
|
1725
1772
|
received: status, content type, decoded bytes, an estimated token count, and
|
|
1726
|
-
the D2.4 substance-parity comparison verbatim.
|
|
1773
|
+
the D2.4 substance-parity comparison verbatim. When the page links a Markdown
|
|
1774
|
+
copy instead of sending one, that comparison uses the linked copy.
|
|
1727
1775
|
|
|
1728
1776
|
It shows structure and numbers, never an excerpt of the page. --fail-on is not
|
|
1729
1777
|
supported: diff reports, it does not grade.
|
|
@@ -1776,7 +1824,7 @@ function helpText(topic) {
|
|
|
1776
1824
|
}
|
|
1777
1825
|
|
|
1778
1826
|
// src/cli.ts
|
|
1779
|
-
var CLI_VERSION = "0.
|
|
1827
|
+
var CLI_VERSION = "0.5.0";
|
|
1780
1828
|
async function runCli(argv, runtime2) {
|
|
1781
1829
|
const caps = detectCapabilities({
|
|
1782
1830
|
env: runtime2.env,
|
|
@@ -1852,7 +1900,7 @@ function buildProbe(runtime2, urlCount, flags) {
|
|
|
1852
1900
|
});
|
|
1853
1901
|
}
|
|
1854
1902
|
function budgetFor(urlCount) {
|
|
1855
|
-
return Math.max(20, urlCount *
|
|
1903
|
+
return Math.max(20, urlCount * 7 + 4);
|
|
1856
1904
|
}
|
|
1857
1905
|
function policyFor(setup, base) {
|
|
1858
1906
|
return { ...base, allowHttp: setup.allowHttp || base.allowHttp };
|