@goflag/cli 0.2.10 → 0.2.11

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
@@ -1,9 +1,8 @@
1
- # Goflag
1
+ # goflag
2
2
 
3
- > **A lean CLI that flags the site problems humans can't catch at scale.**
4
- > Point it at a URL and get four things: broken links, missing translation pages, a robots.txt that contradicts your pages, and missing or misconfigured SEO metadata. JSON-first.
3
+ A CLI that audits a site for broken links, missing translation pages, a robots.txt that contradicts your pages, and missing or misconfigured SEO metadata — and a Next.js library that produces the HTML it would have nothing to say about.
5
4
 
6
- [![node](https://img.shields.io/badge/node-%3E%3D22-339933?logo=nodedotjs&logoColor=white)](./package.json)
5
+ [![node](https://img.shields.io/badge/node-%3E%3D22-339933?logo=nodedotjs&logoColor=white)](https://github.com/tancredesimonin/goflag/blob/main/package.json)
7
6
  [![license: MIT](https://img.shields.io/badge/license-MIT-green)](#license)
8
7
 
9
8
  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.
@@ -13,7 +12,24 @@ search: a `hreflang` that points at a 404, a canonical that silently
13
12
  de-indexes a page, a `robots.txt` that contradicts every `<meta name="robots">`
14
13
  on the site. A human cannot check those on 400 pages. That is the whole job.
15
14
 
16
- ## What it checks
15
+ ## Getting started
16
+
17
+ ```sh
18
+ npx @goflag/cli https://example.com # one-off, nothing installed
19
+ pnpm add -D @goflag/cli # then: pnpm goflag https://example.com
20
+ ```
21
+
22
+ Install it as a dev dependency once you run it more than once — in a script, in
23
+ CI, in a git hook. `npx` is for trying it. The package is `@goflag/cli`; the
24
+ command it installs is `goflag`. Everything under the brand lives in the
25
+ `@goflag` scope; the bare `goflag` name on npm is a deprecated signpost pointing
26
+ here and carries no code.
27
+
28
+ - Node `>=22`.
29
+ - Nothing else for a static audit. Headless rendering needs Chromium, which is **not** installed with goflag — `playwright` is an optional peer dependency. Add it only if you audit client-rendered pages without `--static`: `pnpm add -D playwright && pnpm exec playwright install chromium`.
30
+ - Working in this repository instead of consuming it: `pnpm install`, then see [AGENTS.md](https://github.com/tancredesimonin/goflag/blob/main/AGENTS.md).
31
+
32
+ ## What it does
17
33
 
18
34
  - **Broken links** — scrapes every crawled page, dedupes targets globally (a footer link on 500 pages is probed once), and checks each with `HEAD`→`GET` fallback, redirect-chain/loop detection, soft-404 and anti-bot (403/429) triage. Broken links are mapped back to the pages that reference them.
19
35
  - **Missing translation pages** — builds a `route × locale` matrix and flags every route that exists in one locale but is missing in another, plus hreflang reciprocity gaps (`A → B` with no `B → A`), missing `x-default`, and locale tags naming a language, script or region that does not exist. Rows are keyed by pathname, unless the site declares its translation clusters — either with `xhtml:link` in the sitemap, or with reciprocal `hreflang` between two crawled pages' `<head>`. Then those declarations decide which URLs are one page, whatever their slugs, and the run reports `diagnostics.declaredClusters`. The sitemap source survives `--coverage structural`, where the two locales of a slug-translating family are rarely both sampled; the `<head>` source needs both pages in hand and is what fixes the common site that declares properly there and nothing in its sitemap.
@@ -43,31 +59,11 @@ fails loudly rather than passing quietly. It is also why `--static` is the right
43
59
  default in CI: it needs no browser, and it cannot mistake a broken page for a
44
60
  fine one.
45
61
 
46
- ## Install
47
-
48
- Requires Node `>=22`.
49
-
50
- ```sh
51
- npx @goflag/cli https://example.com # one-off, nothing installed
52
- pnpm add -D @goflag/cli # then: pnpm goflag https://example.com
53
- ```
54
-
55
- Install it as a dev dependency once you run it more than once — in a script, in
56
- CI, in a git hook. `npx` is for trying it.
62
+ ## Where it runs
57
63
 
58
- The package is `@goflag/cli`; the command it installs is `goflag`. Everything
59
- under the brand lives in the `@goflag` scope; the bare `goflag` name on npm is a
60
- deprecated signpost pointing here and carries no code.
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.
61
65
 
62
- Headless rendering needs Chromium, which is **not** installed with goflag —
63
- `playwright` is an optional peer dependency. Add it only if you audit
64
- client-rendered pages without `--static`:
65
-
66
- ```sh
67
- pnpm add -D playwright && pnpm exec playwright install chromium
68
- ```
69
-
70
- ## Getting started
66
+ ## Your first audit
71
67
 
72
68
  Five steps, in this order. Each one is explained in full further down; this is
73
69
  the sequence.
@@ -141,15 +137,15 @@ npx @goflag/cli rules > rules.json
141
137
  ```
142
138
 
143
139
  `rules` answers a question about goflag rather than about a site: no URL, no
144
- crawl, no network. Every entry carries its scope, severity and summary; the
145
- twenty-three page rules and four prose rules also carry a rigor, the documents they
146
- cite and — where a remedy is a line of code — a fix snippet. Cross-page rules
147
- may carry them too, and the robots family does; the three hreflang and sitemap
148
- rules that predate the field still emit `rigor: null` with an empty `sources`,
149
- because choosing their citations is work nobody has done and inventing an
150
- authority is worse than admitting the gap. Write your consumer against that. The same document
151
- ships inside the package as `rules.json`, if you would rather read it than run
152
- anything.
140
+ crawl, no network. It ships fifty-six rules — twenty-three page rules,
141
+ twenty-eight site rules and five prose rules — and every entry carries its
142
+ scope, severity and summary. All but one also carry a rigor, the documents they
143
+ cite and, where a remedy is a line of code, a fix snippet. The exception is
144
+ `hreflang.sitemap-mismatch`, which emits `rigor: null` with an empty `sources`
145
+ because no specification says which of the two declarations is wrong; inventing
146
+ an authority there is worse than admitting the gap. Write your consumer against
147
+ that. The same document ships inside the package as `rules.json`, if you would
148
+ rather read it than run anything.
153
149
 
154
150
  The flag list below is data too:
155
151
 
@@ -513,7 +509,7 @@ Three rules, whichever you use:
513
509
  stages: [build, deploy, audit]
514
510
 
515
511
  variables:
516
- GOFLAG_VERSION: "0.2.10"
512
+ GOFLAG_VERSION: "0.2.11"
517
513
 
518
514
  # Before the merge: build the branch, let goflag boot it, audit that.
519
515
  seo:mr:
@@ -565,7 +561,7 @@ jobs:
565
561
  - run: corepack enable && pnpm install --frozen-lockfile
566
562
  - run: pnpm build
567
563
  - run: |
568
- npx --yes @goflag/cli@0.2.10 http://localhost:3000 \
564
+ npx --yes @goflag/cli@0.2.11 http://localhost:3000 \
569
565
  --start "pnpm start" --static --no-external \
570
566
  --baseline .goflag/baseline.json --regressions-only --max-debt 41 \
571
567
  --report goflag-report.json
@@ -612,6 +608,7 @@ console.log(report.summary);
612
608
  ```
613
609
  packages/cli/ @goflag/cli, the CLI (installs the `goflag` command)
614
610
  packages/next/ @goflag/next, the Next.js library (see below)
611
+ packages/og/ @goflag/og, the share cards and the favicon container
615
612
  apps/website/ goflag.tech, the landing page and the documentation
616
613
  tools/name-holder/ the bare `goflag` name on npm, a signpost to @goflag/cli
617
614
  ```
@@ -623,7 +620,7 @@ enforces it rather than trusting memory.
623
620
  ## The other half: `@goflag/next`
624
621
 
625
622
  goflag tells you what is wrong. It does not tell you how to stop writing it
626
- wrong. [`@goflag/next`](packages/next) is a route registry for the Next.js App
623
+ wrong. [`@goflag/next`](https://github.com/tancredesimonin/goflag/tree/main/packages/next) is a route registry for the Next.js App
627
624
  Router that produces the HTML this auditor would have nothing to say about.
628
625
 
629
626
  ```ts
@@ -641,7 +638,32 @@ held in agreement by vigilance, and their disagreement is what goflag reports as
641
638
  `hreflang.sitemap-mismatch`. Projecting both from one registry makes that
642
639
  finding unrepresentable. Full documentation at
643
640
  [goflag.tech/docs/next](https://goflag.tech/docs/next), and the API reference in
644
- [`packages/next/README.md`](packages/next/README.md).
641
+ [`packages/next/README.md`](https://github.com/tancredesimonin/goflag/blob/main/packages/next/README.md).
642
+
643
+ ## The picture: `@goflag/og`
644
+
645
+ Two of this catalogue's rules had no remedy to point at. `og.image.missing`
646
+ fired 24 times on one site and `og.image.alt` 46 times on another, and the fix
647
+ 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.
649
+
650
+ ```tsx
651
+ // app/[locale]/opengraph-image.tsx
652
+ const image = ogImage(og, async ({ params }) => {
653
+ const { locale } = await params;
654
+ return { title: t("hero.title"), alt: t("meta.ogAlt") };
655
+ });
656
+
657
+ export const generateImageMetadata = image.generateImageMetadata;
658
+ export default image.render;
659
+ ```
660
+
661
+ The core renders nothing: it returns a JSX tree that `next/og` — which already
662
+ embeds satori — turns into a PNG at build time, so nothing installs a second
663
+ renderer and a card can be unit-tested with no framework build. It also packs
664
+ the `favicon.ico` **no Next convention emits**, guarded so that a generated file
665
+ living in git is not dirtied by every commit. API reference in
666
+ [`packages/og/README.md`](packages/og/README.md).
645
667
 
646
668
  ## Develop locally
647
669
 
@@ -667,8 +689,28 @@ eslint once at the root and then fans out to any package that defines its own
667
689
  across workspace packages with `pnpm -r`. To work on one package, filter:
668
690
  `pnpm --filter @goflag/cli test`.
669
691
 
670
- The engine is framework-agnostic and lives in [`packages/cli/src/lib/core/`](packages/cli/src/lib/core) (crawl, fetch/extract, link audit, i18n) and [`packages/cli/src/lib/rules/`](packages/cli/src/lib/rules) (SEO checks). The CLI shell — orchestration, the `GoflagReport` schema, and rendering — lives in [`packages/cli/src/report/`](packages/cli/src/report) and [`packages/cli/src/cli.ts`](packages/cli/src/cli.ts).
692
+ The engine is framework-agnostic and lives in [`packages/cli/src/lib/core/`](https://github.com/tancredesimonin/goflag/tree/main/packages/cli/src/lib/core) (crawl, fetch/extract, link audit, i18n) and [`packages/cli/src/lib/rules/`](https://github.com/tancredesimonin/goflag/tree/main/packages/cli/src/lib/rules) (SEO checks). The CLI shell — orchestration, the `GoflagReport` schema, and rendering — lives in [`packages/cli/src/report/`](https://github.com/tancredesimonin/goflag/tree/main/packages/cli/src/report) and [`packages/cli/src/cli.ts`](https://github.com/tancredesimonin/goflag/blob/main/packages/cli/src/cli.ts).
693
+
694
+ ## Contributing
695
+
696
+ GitHub is a read-only mirror; the canonical repository and the CI are on GitLab,
697
+ so a pull request opened here cannot be merged. **Issues are the useful thing to
698
+ open on GitHub** — a wrong finding especially, which is the class of bug handled
699
+ first. [CONTRIBUTING.md](https://github.com/tancredesimonin/goflag/blob/main/CONTRIBUTING.md)
700
+ has the whole story, including what makes a report reproducible and what a rule
701
+ proposal needs. Vulnerabilities go to <hello@goflag.tech> rather than to an
702
+ issue — see
703
+ [SECURITY.md](https://github.com/tancredesimonin/goflag/blob/main/SECURITY.md).
671
704
 
672
705
  ## License
673
706
 
674
707
  MIT.
708
+
709
+ ## Learn more
710
+
711
+ - Strategy and goals: [STRATEGY.md](https://github.com/tancredesimonin/goflag/blob/main/STRATEGY.md)
712
+ - What comes next: [ROADMAP.md](https://github.com/tancredesimonin/goflag/blob/main/ROADMAP.md)
713
+ - Working in this repository (human or agent): [AGENTS.md](https://github.com/tancredesimonin/goflag/blob/main/AGENTS.md)
714
+ - The overall development plan: [docs/spec-and-lib-plan.md](https://github.com/tancredesimonin/goflag/blob/main/docs/spec-and-lib-plan.md)
715
+ - The rule catalogue and its architecture: [docs/rules-catalog-plan.md](https://github.com/tancredesimonin/goflag/blob/main/docs/rules-catalog-plan.md)
716
+ - Publishing `@goflag/next`: [docs/publishing.md](https://github.com/tancredesimonin/goflag/blob/main/docs/publishing.md)