@goflag/cli 0.2.11 → 0.2.13

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/README.md CHANGED
@@ -5,6 +5,12 @@ A CLI that audits a site for broken links, missing translation pages, a robots.t
5
5
  [![node](https://img.shields.io/badge/node-%3E%3D22-339933?logo=nodedotjs&logoColor=white)](https://github.com/tancredesimonin/goflag/blob/main/package.json)
6
6
  [![license: MIT](https://img.shields.io/badge/license-MIT-green)](#license)
7
7
 
8
+ [![A goflag run against a site with findings: a red verdict over the crawl counts, a COVERAGE line saying how many pages of the sitemap were audited, the tally of broken links, missing translations and SEO issues, then the broken links listed under the page that references them.](https://goflag.tech/assets/hero.png)](https://goflag.tech/docs/report)
9
+
10
+ <sub>The first eleven lines of a real run. Rendered from the same transcript the
11
+ documentation site paints, which is compared to the renderers byte for byte —
12
+ so this picture cannot drift from what the command prints.</sub>
13
+
8
14
  Goflag crawls a site once and judges what it found. It is deliberately small: no dashboard, no config system, no social-preview gallery. Just the findings, as a machine-readable report you can pipe, diff, or gate CI on.
9
15
 
10
16
  It is built for the mistakes that are invisible while browsing and expensive in
@@ -61,7 +67,7 @@ fine one.
61
67
 
62
68
  ## Where it runs
63
69
 
64
- Two packages ship to npm from a tag, published by GitLab CI over OIDC with no stored credential: `@goflag/cli` (`v*`) and `@goflag/next` (`next-v*`). The documentation site `apps/website` runs at [goflag.tech](https://goflag.tech), with `develop.goflag.tech` alongside it, both deployed with Kamal onto the shared OVH host described in the `infrastructure` repository.
70
+ Three packages ship to npm from a tag, published by GitLab CI over OIDC with no stored credential: `@goflag/cli` (`v*`), `@goflag/next` (`next-v*`) and `@goflag/og` (`og-v*`). The documentation site `apps/website` runs at [goflag.tech](https://goflag.tech), with `develop.goflag.tech` alongside it, both deployed with Kamal onto the shared OVH host described in the `infrastructure` repository.
65
71
 
66
72
  ## Your first audit
67
73
 
@@ -130,6 +136,19 @@ npx @goflag/cli https://example.com --report report.json # write JSON to a
130
136
 
131
137
  The terminal view is just a render of that JSON.
132
138
 
139
+ ### Four verbs
140
+
141
+ ```sh
142
+ goflag <url> [options] # audit a site
143
+ goflag preview <url> # render its share cards, and look at them
144
+ goflag rules # print the rule catalogue as JSON
145
+ goflag flags # print the flag reference as JSON
146
+ ```
147
+
148
+ The last two answer a question about goflag rather than about a site, so they
149
+ take no URL and touch no network. `preview` takes one and audits like a normal
150
+ run — [what it writes](#goflag-preview--look-at-the-cards-before-you-ship-them) is further down.
151
+
133
152
  ### The catalogue is data too
134
153
 
135
154
  ```sh
@@ -137,7 +156,7 @@ npx @goflag/cli rules > rules.json
137
156
  ```
138
157
 
139
158
  `rules` answers a question about goflag rather than about a site: no URL, no
140
- crawl, no network. It ships fifty-six rules — twenty-three page rules,
159
+ crawl, no network. It ships fifty-eight rules — twenty-five page rules,
141
160
  twenty-eight site rules and five prose rules — and every entry carries its
142
161
  scope, severity and summary. All but one also carry a rigor, the documents they
143
162
  cite and, where a remedy is a line of code, a fix snippet. The exception is
@@ -170,7 +189,8 @@ documentation site came to quote a message the engine had stopped printing.
170
189
  --json Print the JSON report to stdout (nothing else).
171
190
  --summary, -s Roll findings up (dedup by link/rule/code). Pairs with
172
191
  --json for a compact payload; --report always writes
173
- the full report regardless.
192
+ the full report regardless. Not available with
193
+ --baseline: there the diff is the answer.
174
194
  --report <file> Write the JSON report to <file>.
175
195
  --depth <n> How far to follow links out of each page (0 = follow
176
196
  none). Sitemap URLs are seeded regardless, so --depth 0
@@ -431,6 +451,35 @@ should boot. In a monorepo audited from the root, point it at the package:
431
451
  goflag http://localhost:3000 --start "pnpm start" --start-cwd apps/web
432
452
  ```
433
453
 
454
+ ### `goflag preview` — look at the cards before you ship them
455
+
456
+ Some things are only settleable by looking. `og.image.representative` asks
457
+ whether the shared image survives being cropped to 1.91:1 — a question the
458
+ catalogue states and refuses to answer, because no rule can.
459
+
460
+ ```sh
461
+ goflag preview http://localhost:3000 --start "pnpm start"
462
+ ```
463
+
464
+ It audits like a normal run, then writes `.goflag/preview.html`: one
465
+ self-contained file showing what Google, Open Graph, X, LinkedIn, Slack, Discord
466
+ and WhatsApp make of each page, with the findings pinned on the cards they
467
+ concern and the page's JSON-LD shown beside them.
468
+
469
+ Each surface is labelled with how well its geometry is actually documented.
470
+ Three of the seven publish real numbers; Slack calls its own rendering a
471
+ "micro-approximation"; Discord publishes nothing; X's card documentation is not
472
+ reachable, and its shape changed twice since 2023. Drawing all seven with the
473
+ same confidence would be six unearned claims, so the file says which is which.
474
+
475
+ It never gates — it exits 0 unless the run itself failed — and it prints the
476
+ path it wrote, so `open "$(goflag preview http://localhost:3000)"` opens it.
477
+
478
+ An example of what it writes — a real audit, frozen, so its footer names the date it was
479
+ taken — is served at <https://goflag.tech/assets/example-preview.html>. The URL is absolute
480
+ because `prepack` copies this file into the package and npm renders it, where a relative link
481
+ is dead.
482
+
434
483
  ### Multilingual sites
435
484
 
436
485
  Discovery is seeded from the sitemap, not just from links. That matters because
@@ -509,7 +558,7 @@ Three rules, whichever you use:
509
558
  stages: [build, deploy, audit]
510
559
 
511
560
  variables:
512
- GOFLAG_VERSION: "0.2.11"
561
+ GOFLAG_VERSION: "0.2.13"
513
562
 
514
563
  # Before the merge: build the branch, let goflag boot it, audit that.
515
564
  seo:mr:
@@ -561,7 +610,7 @@ jobs:
561
610
  - run: corepack enable && pnpm install --frozen-lockfile
562
611
  - run: pnpm build
563
612
  - run: |
564
- npx --yes @goflag/cli@0.2.11 http://localhost:3000 \
613
+ npx --yes @goflag/cli@0.2.13 http://localhost:3000 \
565
614
  --start "pnpm start" --static --no-external \
566
615
  --baseline .goflag/baseline.json --regressions-only --max-debt 41 \
567
616
  --report goflag-report.json
@@ -583,6 +632,25 @@ Audit external links on a schedule instead, where nobody is waiting.
583
632
 
584
633
  ### Reading a red build
585
634
 
635
+ A red build says what moved, not what is wrong. The diff lists rule ids and
636
+ absolute page URLs; the messages and the fixes are in the report:
637
+
638
+ <!-- goflag:transcript gate -->
639
+
640
+ ```plaintext
641
+ goflag --regressions-only
642
+ REGRESSION 1 new · 13 known findings NOT gating this build · 1 resolved
643
+ baseline https://example.com/ — taken 2026-07-21T09:14:02.881Z (14 days ago)
644
+
645
+ New findings
646
+ + error seo canonical.absolute on https://example.com/pricing
647
+
648
+ Resolved
649
+ - warn seo og.image.missing on https://example.com/about
650
+ ```
651
+
652
+ <!-- /goflag:transcript -->
653
+
586
654
  The report artefact is the thing to open. It is the same JSON as `--json`, and
587
655
  it is kept whether the job passed or failed, because it is most wanted when it
588
656
  is red.
@@ -645,7 +713,7 @@ finding unrepresentable. Full documentation at
645
713
  Two of this catalogue's rules had no remedy to point at. `og.image.missing`
646
714
  fired 24 times on one site and `og.image.alt` 46 times on another, and the fix
647
715
  for both is "either an asset or a route you have to write" — which is how a rule
648
- becomes permanent debt. [`@goflag/og`](packages/og) is that route, written once.
716
+ becomes permanent debt. [`@goflag/og`](https://github.com/tancredesimonin/goflag/tree/main/packages/og) is that route, written once.
649
717
 
650
718
  ```tsx
651
719
  // app/[locale]/opengraph-image.tsx
@@ -663,7 +731,7 @@ embeds satori — turns into a PNG at build time, so nothing installs a second
663
731
  renderer and a card can be unit-tested with no framework build. It also packs
664
732
  the `favicon.ico` **no Next convention emits**, guarded so that a generated file
665
733
  living in git is not dirtied by every commit. API reference in
666
- [`packages/og/README.md`](packages/og/README.md).
734
+ [`packages/og/README.md`](https://github.com/tancredesimonin/goflag/blob/main/packages/og/README.md).
667
735
 
668
736
  ## Develop locally
669
737