@goflag/cli 0.1.0 → 0.1.4
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 +49 -11
- package/dist/{chunk-75OFMTOC.js → chunk-3777NRM4.js} +1 -1
- package/dist/chunk-3777NRM4.js.map +1 -0
- package/dist/cli.js +50 -10
- package/dist/cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-75OFMTOC.js.map +0 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> **A lean CLI that flags the site problems humans can't catch at scale.**
|
|
4
4
|
> Point it at a URL and get three things: broken links, missing translation pages, and missing/misconfigured SEO metadata. JSON-first.
|
|
5
5
|
|
|
6
|
-
[](
|
|
6
|
+
[](./package.json)
|
|
7
7
|
[](#license)
|
|
8
8
|
|
|
9
9
|
Goflag crawls a site once and runs three focused static checks over it. 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.
|
|
@@ -23,12 +23,17 @@ SPA support is built in: pages that look client-rendered are re-rendered in head
|
|
|
23
23
|
|
|
24
24
|
```
|
|
25
25
|
packages/cli/ @goflag/cli — the CLI (installs the `goflag` command)
|
|
26
|
-
|
|
27
|
-
apps/website/ documentation and marketing site (not built yet)
|
|
26
|
+
tools/name-holder/ the bare `goflag` name on npm, a signpost to @goflag/cli
|
|
28
27
|
```
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
That is the whole tree. `@goflag/next` (the Next.js library) and the
|
|
30
|
+
documentation site are planned but deliberately absent: the workspace globs
|
|
31
|
+
(`packages/*`, `apps/*`) are ready for them, and empty stubs for things that do
|
|
32
|
+
not exist are how a repository accumulates code nobody calls.
|
|
33
|
+
|
|
34
|
+
When they land, they must not import from the CLI: the two products stay
|
|
35
|
+
independently useful, and an ESLint rule enforces it rather than trusting
|
|
36
|
+
memory.
|
|
32
37
|
|
|
33
38
|
## Quick start
|
|
34
39
|
|
|
@@ -38,8 +43,10 @@ Requires Node `>=20.11`.
|
|
|
38
43
|
npx @goflag/cli https://example.com
|
|
39
44
|
```
|
|
40
45
|
|
|
41
|
-
The package is `@goflag/cli`; the command it installs is `goflag`.
|
|
42
|
-
|
|
46
|
+
The package is `@goflag/cli`; the command it installs is `goflag`. Everything
|
|
47
|
+
under the brand lives in the `@goflag` scope. The bare `goflag` name on npm is
|
|
48
|
+
claimed as a deprecated signpost pointing here — it carries no code, so install
|
|
49
|
+
the scoped package. The reasoning is in
|
|
43
50
|
[docs/spec-and-lib-plan.md](docs/spec-and-lib-plan.md#une-marque-des-outils-nommés).
|
|
44
51
|
|
|
45
52
|
You get a coloured terminal report and an exit code:
|
|
@@ -75,6 +82,8 @@ The terminal view is just a render of that JSON.
|
|
|
75
82
|
--regressions-only Weaken the gate: fail only on NEW findings relative
|
|
76
83
|
to --baseline. Requires --baseline.
|
|
77
84
|
--baseline <file> Stored report to compare against.
|
|
85
|
+
--update-baseline Write this run to --baseline and exit 0, instead of
|
|
86
|
+
judging against it.
|
|
78
87
|
--max-debt <n> Fail when the site carries more than <n> findings in
|
|
79
88
|
total, new or known.
|
|
80
89
|
--start <cmd> Boot <cmd>, wait for <url>, audit, then stop it.
|
|
@@ -90,7 +99,7 @@ The terminal view is just a render of that JSON.
|
|
|
90
99
|
-v, --version Show the version.
|
|
91
100
|
```
|
|
92
101
|
|
|
93
|
-
Headless mode needs Chromium.
|
|
102
|
+
Headless mode needs Chromium. `playwright` is an optional peer dependency; if it's missing, install it with `npx playwright install chromium` (or just run with `--static`).
|
|
94
103
|
|
|
95
104
|
### Gate on regressions, not on perfection
|
|
96
105
|
|
|
@@ -99,7 +108,7 @@ yet — so it gets switched off, or ignored. Capture a baseline once and gate on
|
|
|
99
108
|
"did this change make it worse?" instead:
|
|
100
109
|
|
|
101
110
|
```sh
|
|
102
|
-
goflag https://example.com --
|
|
111
|
+
goflag https://example.com --baseline baseline.json --update-baseline # once
|
|
103
112
|
goflag https://example.com --regressions-only --baseline baseline.json
|
|
104
113
|
```
|
|
105
114
|
|
|
@@ -129,6 +138,28 @@ goflag https://example.com --regressions-only --baseline baseline.json --max-deb
|
|
|
129
138
|
Keeping `baseline.json` in the repository helps for the same reason: adding a
|
|
130
139
|
finding to it then shows up in a diff someone reviews.
|
|
131
140
|
|
|
141
|
+
Capture it with the run that will later judge it, minus one flag:
|
|
142
|
+
|
|
143
|
+
```sh
|
|
144
|
+
goflag https://example.com --baseline baseline.json --update-baseline
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
That matters more than it looks. A baseline captured with different options than
|
|
148
|
+
the gate — a forgotten `--static`, another `--max-pages` — does not compare
|
|
149
|
+
cleanly, and the mismatch surfaces as findings that appear from nowhere. Using
|
|
150
|
+
the same command for both makes that impossible.
|
|
151
|
+
|
|
152
|
+
The same flag accepts findings you have decided to live with, and it says what
|
|
153
|
+
it accepted:
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
goflag: baseline updated — 3 newly accepted, 0 resolved, 44 findings now
|
|
157
|
+
grandfathered in baseline.json
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Refreshing a baseline is taking on debt. It prints the number so the commit that
|
|
161
|
+
does it can be read as what it is.
|
|
162
|
+
|
|
132
163
|
### Gate a merge before it ships
|
|
133
164
|
|
|
134
165
|
`--start` boots your app, waits for it to answer, audits it, and stops it — so
|
|
@@ -178,7 +209,7 @@ never means "nothing was wrong" by accident.
|
|
|
178
209
|
## Programmatic API
|
|
179
210
|
|
|
180
211
|
```ts
|
|
181
|
-
import { runAudit } from "goflag";
|
|
212
|
+
import { runAudit } from "@goflag/cli";
|
|
182
213
|
|
|
183
214
|
const report = await runAudit("https://example.com", { depth: 2 });
|
|
184
215
|
console.log(report.summary); // { brokenLinks, missingTranslations, seoIssues, verdict }
|
|
@@ -188,6 +219,9 @@ console.log(report.summary); // { brokenLinks, missingTranslations, seoIssues, v
|
|
|
188
219
|
|
|
189
220
|
## Develop locally
|
|
190
221
|
|
|
222
|
+
Requires pnpm `11.18.0` (pinned via `packageManager` — `corepack enable` picks
|
|
223
|
+
it up). Run these from the repository root:
|
|
224
|
+
|
|
191
225
|
```sh
|
|
192
226
|
pnpm install
|
|
193
227
|
pnpm dev https://example.com # run the CLI from source (tsx)
|
|
@@ -200,7 +234,11 @@ pnpm typecheck # tsc --noEmit
|
|
|
200
234
|
pnpm format # prettier
|
|
201
235
|
```
|
|
202
236
|
|
|
203
|
-
|
|
237
|
+
`lint`, `format` and `format:check` run once over the whole repository; the
|
|
238
|
+
rest fan out across workspace packages with `pnpm -r`. To work on one package,
|
|
239
|
+
filter: `pnpm --filter @goflag/cli test`.
|
|
240
|
+
|
|
241
|
+
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).
|
|
204
242
|
|
|
205
243
|
## License
|
|
206
244
|
|