rebilder 0.5.0 → 0.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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ProbeOutcome, ProbeRejection } from '@rebilder/agent-readability/probe';
2
- import { ArsResult, ArsCheck } from '@rebilder/agent-readability';
2
+ import { ArsResult, ArsEvidence, ArsCheck } from '@rebilder/agent-readability';
3
3
 
4
4
  /**
5
5
  * exit.ts — the exit-code contract.
@@ -129,7 +129,7 @@ declare function createNodeRuntime(): CliRuntime;
129
129
  */
130
130
 
131
131
  /** Kept in step with package.json by a test, so a stale constant cannot ship. */
132
- declare const CLI_VERSION = "0.5.0";
132
+ declare const CLI_VERSION = "0.6.0";
133
133
  declare function runCli(argv: readonly string[], runtime: CliRuntime): Promise<ExitCode>;
134
134
 
135
135
  /**
@@ -154,7 +154,7 @@ declare const FORMATS: readonly ["pretty", "json", "markdown", "junit"];
154
154
  type Format = (typeof FORMATS)[number];
155
155
  declare const GRADES: readonly ["A", "B", "C", "D", "F"];
156
156
  type Grade = (typeof GRADES)[number];
157
- declare const COMMANDS: readonly ["check", "diff", "init", "badge"];
157
+ declare const COMMANDS: readonly ["check", "docs-check", "diff", "init", "badge"];
158
158
  type CommandName = (typeof COMMANDS)[number];
159
159
  interface CheckCommand {
160
160
  name: 'check';
@@ -182,13 +182,23 @@ interface InitCommand {
182
182
  out: string | null;
183
183
  format: Format;
184
184
  }
185
+ interface DocsCheckCommand {
186
+ name: 'docs-check';
187
+ url: string;
188
+ format: Format;
189
+ /** Default false. When true, blocking docs findings exit 1. */
190
+ failOnBlocking: boolean;
191
+ out: string | null;
192
+ allowPrivate: boolean;
193
+ allowHttp: boolean;
194
+ }
185
195
  interface BadgeCommand {
186
196
  name: 'badge';
187
197
  domain: string;
188
198
  format: Format;
189
199
  out: string | null;
190
200
  }
191
- type Command = CheckCommand | DiffCommand | InitCommand | BadgeCommand;
201
+ type Command = CheckCommand | DocsCheckCommand | DiffCommand | InitCommand | BadgeCommand;
192
202
  type ParseResult = {
193
203
  kind: 'command';
194
204
  command: Command;
@@ -252,6 +262,101 @@ declare function outcomeSummary(report: UrlReport): string;
252
262
  /** `'scored' | 'opt-out' | 'unscored' | 'rejected'` — the coarse status. */
253
263
  declare function statusOf(report: UrlReport): 'scored' | 'opt-out' | 'unscored' | 'rejected';
254
264
 
265
+ /**
266
+ * docs-check.ts — local, zero-telemetry coding-agent documentation analyzer.
267
+ *
268
+ * Reads the `ArsEvidence` bundle produced by `@rebilder/agent-readability/probe`
269
+ * (browser request, agent `Accept: text/markdown` request, declared Markdown
270
+ * alternate, and `/llms.txt`) and reports where a coding agent following the
271
+ * documentation would succeed or get stuck.
272
+ *
273
+ * Pure analysis: no network calls of its own, no telemetry, never installs
274
+ * packages or executes code. Every regex is linear-time with bounded input.
275
+ */
276
+
277
+ type DocsFindingSeverity = 'blocking' | 'should-fix' | 'passed';
278
+ type DocsFindingCheck = 'fetch' | 'install' | 'code' | 'auth' | 'freshness';
279
+ interface DocsFinding {
280
+ /** Stable machine id, e.g. `placeholder-unexplained`. */
281
+ id: string;
282
+ check: DocsFindingCheck;
283
+ severity: DocsFindingSeverity;
284
+ title: string;
285
+ detail: string;
286
+ /** Quoted snippets or lines from the page (at most three). */
287
+ evidence: string[];
288
+ /** Actionable fix; null for a passed finding. */
289
+ fix: string | null;
290
+ }
291
+ interface DocsCheckFetchSummary {
292
+ browserStatus: number | null;
293
+ agentStatus: number | null;
294
+ agentContentType: string | null;
295
+ markdown: 'negotiated' | 'alternate' | 'none';
296
+ markdownUrl: string | null;
297
+ serverHtmlCodeBlocks: number;
298
+ llmsTxt: 'links-page' | 'links-section' | 'no-link' | 'missing' | 'unavailable';
299
+ }
300
+ interface DocsCheckReport {
301
+ url: string;
302
+ finalUrl: string;
303
+ checkedAt: string;
304
+ verdict: 'can-follow' | 'likely-stuck';
305
+ /** Titles of the blocking findings, in the order an agent hits them. */
306
+ stuckAt: string[];
307
+ /** Which representation the content checks read: Markdown when served, else server HTML. */
308
+ analyzedSource: 'markdown' | 'html';
309
+ fetch: DocsCheckFetchSummary;
310
+ installManagers: string[];
311
+ blocking: DocsFinding[];
312
+ shouldFix: DocsFinding[];
313
+ passed: DocsFinding[];
314
+ findings: DocsFinding[];
315
+ scope: string;
316
+ }
317
+ type DocsProbeStatus = 'ok' | 'unreachable' | 'policy';
318
+ type DocsCheckPayload = {
319
+ kind: 'rejected';
320
+ url: string;
321
+ failOnBlocking: boolean;
322
+ rejection: ProbeRejection;
323
+ detail: string;
324
+ } | {
325
+ kind: 'probed';
326
+ url: string;
327
+ failOnBlocking: boolean;
328
+ probeStatus: DocsProbeStatus;
329
+ probeDetail: string | null;
330
+ report: DocsCheckReport;
331
+ };
332
+ declare const DOCS_CHECK_SCOPE = "This check reads the fetched page locally on your machine. It sends no data to Rebilder, does not install packages, and runs no code.";
333
+ interface FetchedRepresentation {
334
+ status: number;
335
+ contentType: string | null;
336
+ body: string | null;
337
+ finalUrl: string;
338
+ }
339
+ interface DocsFetchFacts {
340
+ url: string;
341
+ browser: FetchedRepresentation | null;
342
+ agent: FetchedRepresentation | null;
343
+ markdown: {
344
+ source: 'negotiated' | 'alternate';
345
+ url: string;
346
+ body: string;
347
+ } | null;
348
+ llmsTxt: {
349
+ state: 'found' | 'missing' | 'unavailable';
350
+ body: string | null;
351
+ url: string;
352
+ };
353
+ }
354
+ declare function factsFromEvidence(evidence: ArsEvidence): DocsFetchFacts;
355
+ declare function analyzeDocsFacts(facts: DocsFetchFacts, checkedAt: Date): DocsCheckReport;
356
+ declare function analyzeDocsEvidence(evidence: ArsEvidence, checkedAt: Date): DocsCheckReport;
357
+ declare function runDocsCheck(command: DocsCheckCommand, probe: ProbeRunner, now: Date): Promise<DocsCheckPayload>;
358
+ declare function exitCodeForDocsCheck(payload: DocsCheckPayload): ExitCode;
359
+
255
360
  /**
256
361
  * payload.ts — what a command produced, before anyone decided how to print it.
257
362
  *
@@ -312,6 +417,9 @@ type Payload = {
312
417
  command: 'check';
313
418
  reports: UrlReport[];
314
419
  failOn: Grade | null;
420
+ } | {
421
+ command: 'docs-check';
422
+ docsCheck: DocsCheckPayload;
315
423
  } | {
316
424
  command: 'diff';
317
425
  diff: DiffPayload;
@@ -502,4 +610,4 @@ declare function detectFramework(runtime: CliRuntime): Promise<Detection>;
502
610
 
503
611
  declare const BADGE_ORIGIN = "https://rebilder.com";
504
612
 
505
- export { ARS_NOTICE, ARS_NOTICE_LINES, BADGE_ORIGIN, type BadgeCommand, type BadgeSnippet, CLI_VERSION, COMMANDS, type CheckCommand, type CliRuntime, type Command, type CommandName, type DiffCommand, type DiffPayload, type DiffSide, EXIT, type ExitCode, FORMATS, FRAMEWORKS, type Format, type FormatContext, type Framework, GRADES, type Grade, type InitCommand, type ParseResult, type Payload, type ProbeFactory, type ProbeRunner, type ProbeSetup, type Scaffold, TELEMETRY_LINES, type TermCapabilities, type UrlReport, UsageError, budgetFor, createNodeRuntime, detectCapabilities, detectFramework, exitCodeFor, helpText, meetsThreshold, nodeProbeFactory, normalizeDomain, outcomeSummary, parseCommandLine, render, runCli, statusOf, worstExit };
613
+ export { ARS_NOTICE, ARS_NOTICE_LINES, BADGE_ORIGIN, type BadgeCommand, type BadgeSnippet, CLI_VERSION, COMMANDS, type CheckCommand, type CliRuntime, type Command, type CommandName, DOCS_CHECK_SCOPE, type DiffCommand, type DiffPayload, type DiffSide, type DocsCheckCommand, type DocsCheckFetchSummary, type DocsCheckPayload, type DocsCheckReport, type DocsFetchFacts, type DocsFinding, type DocsFindingCheck, type DocsFindingSeverity, type DocsProbeStatus, EXIT, type ExitCode, FORMATS, FRAMEWORKS, type Format, type FormatContext, type Framework, GRADES, type Grade, type InitCommand, type ParseResult, type Payload, type ProbeFactory, type ProbeRunner, type ProbeSetup, type Scaffold, TELEMETRY_LINES, type TermCapabilities, type UrlReport, UsageError, analyzeDocsEvidence, analyzeDocsFacts, budgetFor, createNodeRuntime, detectCapabilities, detectFramework, exitCodeFor, exitCodeForDocsCheck, factsFromEvidence, helpText, meetsThreshold, nodeProbeFactory, normalizeDomain, outcomeSummary, parseCommandLine, render, runCli, runDocsCheck, statusOf, worstExit };