@krawlup/cli 0.0.0-stage → 1.2.1

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 ADDED
@@ -0,0 +1,163 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@krawlup/cli` are documented here. The format
4
+ follows [Keep a Changelog](https://keepachangelog.com/) and the package
5
+ uses [semantic versioning](https://semver.org/).
6
+
7
+ ## 1.2.1 - 2026-11-03
8
+
9
+ ### Added
10
+
11
+ - **`--version` / `-v`** prints the CLI version and exits — read from
12
+ `package.json` at runtime, and the battery's User-Agent string
13
+ (`krawlup-cli/x.y.z`) now derives from the same source so the two can
14
+ never drift.
15
+
16
+ ## 1.2.0 - 2026-11-03
17
+
18
+ ### Added
19
+
20
+ - **The local battery — ten zero-cost commands that run on your machine.**
21
+ `krawlup check` composes the whole audit (TLS, security + cache headers,
22
+ SPF/DKIM/DMARC/MX with the exact record to add, AI-crawler access from
23
+ robots.txt, JSON-LD structured-data lint, the social card with the text
24
+ X/Slack will show, depth-1 broken links with redirect chains and mixed
25
+ content, and the extractable-text lens with `--as-bot` fetching as
26
+ GPTBot); the spot commands (`robots`, `mail`, `ssl`, `headers`, `text`,
27
+ `schema`, `links`, `og`) each answer one question in seconds, and
28
+ `krawlup diff` snapshots a page and reports the exact line drift on every
29
+ later run. No account, no key, no quota — nothing touches the API. Every
30
+ command takes `--json`/`--md` and exits 0 clean / 1 findings / 2 usage, so
31
+ agents and CI can gate on them. The robots parser, the strip-to-text rule
32
+ and the broken-link probe are ports of the scanner's own logic, so a
33
+ `krawlup` verdict matches a krawlup scan verdict on the same input, and
34
+ every verdict is tri-state — unmeasurable reports as unknown, never as a
35
+ false pass or fail.
36
+
37
+ - **The terminal report is now the whole report.** The free report and the
38
+ founder insights render every stored block through one set of shared
39
+ section components: AI readiness (llms.txt verdict, the per-agent robots
40
+ matrix, structured-data types, FAQ, Open Graph), the conversion checks,
41
+ the real-browser mobile layout test with capped evidence, Core Web
42
+ Vitals + the LCP element + speed opportunities, the named trust rows
43
+ (HTTPS redirect, TLS expiry, HSTS/CSP/X-Frame-Options, Safe Browsing,
44
+ OG tags, the X/Slack unfurl), CrUX field data, DR/OpenPageRank, the SEO
45
+ crawl, the 30-day screenshots as links, the cached AI First Edit card
46
+ and bottleneck, the site's category, and a per-check status block where
47
+ any check that did not succeed names itself. The founder `insights`
48
+ view gained the same sections (its scorecard planes never rendered —
49
+ the old code read a field the server never sent), and `analytics`
50
+ gained session duration, pages/session, exit pages, acquisition
51
+ channels, UTM sources and conversion goals (plan-gated server-side as
52
+ the dashboard gates them).
53
+
54
+ - **Unlimited free scans for beta testers.** `krawlup report` now rides
55
+ the CLI's session bearer on the public scan endpoints. The server
56
+ reads it optionally: anonymous callers keep the 1-scan/month device
57
+ pool, while a signed-in founder on the beta allowlist scans without a
58
+ quota. A token is only ever sent to the API base it was minted for,
59
+ and a dead session degrades to the anonymous device pool.
60
+
61
+ - **The free report renders everything the server actually sent.** The
62
+ axis rows use the site's own naming (Speed, Search & AI, Conversion)
63
+ with the primary bottleneck marked, and the block gains the rows the
64
+ web hero and Search & AI tab show: Ahrefs Authority (DR, integer
65
+ convention, ▲/▼ only from a real previous value), the Trust &
66
+ security pass counts, OpenPageRank (score · global rank · referring
67
+ domains), Lighthouse accessibility/best-practices/SEO, CrUX field
68
+ factors per device side, the five-plane scorecard breakdown, and the
69
+ cross-provider open findings (status-chipped, URL or provider
70
+ evidence as the detail line). A number the server never sent never
71
+ renders — rows drop out or say "Not checked" instead.
72
+
73
+ ### Changed
74
+
75
+ - **The free-scan allowance is read from the server, not baked in.** The
76
+ per-device monthly pool is now an admin setting
77
+ (*Settings ▸ Free Site Scanning ▸ Free scans per device / month*), so
78
+ the CLI fetches it from `GET /api/tools/public-insights/scan-config`
79
+ at startup and renders that number in the help text, the menu hint,
80
+ the report footer and its quota refusals. A failed read degrades to
81
+ "checking…" instead of inventing a figure. The pool ships at `0` (off)
82
+ unless an admin grants one; signed-in beta testers are still told
83
+ "unlimited", and a device whose pool is spent is not misreported as
84
+ having never been granted one.
85
+ - **Consistent vertical rhythm across the TUI.** Rendered blocks are
86
+ separated by one blank line, block and section headings sit on the
87
+ same two-space gutter as their rows, the live scan screen groups its
88
+ checklist, pacing bar and caption with real gaps, and the duplicate
89
+ spinner/esc hint above a running scan is gone.
90
+ - **Tables size to their content** instead of stretching to fixed caps,
91
+ and numeric columns right-align — narrow terminals stay readable
92
+ instead of truncating values mid-number.
93
+ - **The signed-out menu steps aside while a report is on screen.** The
94
+ free site report (or its refusal/error) renders alone with a single
95
+ `back` pick — or esc — to return to the menu, instead of the four
96
+ options crowding beneath the result.
97
+ - **Bar lists and score stacks share one column.** Labels pad to the
98
+ widest label in the block (long ones ellipsize at 28 cells) so the
99
+ bars and numbers start at the same offset instead of staggering down
100
+ the screen.
101
+
102
+ ### Fixed
103
+
104
+ - Help and the command list claimed the CLI gets 2 free scans per device
105
+ per month; the device cap is 1 (browsers get 2).
106
+ - The TUI command list kept promising a "free full site scan" right next
107
+ to its own "(no free CLI scans right now)". The lead is now one shared
108
+ phrase (`reportLeadPhrase`) that the help screen and the command list
109
+ both build from, so they can never disagree again.
110
+ - Both domain doors — the argv `report` command and the TUI domain input
111
+ — share one normalizer: `http://` is stripped like `https://`, trailing
112
+ slashes go, and anything that still cannot be a bare host (a path,
113
+ whitespace) is refused instead of sent to the server as a key.
114
+ - A malformed TLS expiry date is excluded from the Trust & security pass
115
+ count instead of being scored as a failing check, and the pacing bar
116
+ reads its stage spans from the pacing it was handed.
117
+
118
+ The first npm release: an interactive terminal client for your krawlup
119
+ account — and it runs the free site report before any sign-in.
120
+
121
+ - **Browser login (OAuth 2.1 + PKCE)** — no API keys. One consent in the
122
+ browser grants read / scans / listing management; refresh tokens
123
+ rotate silently; revoke from the dashboard or `krawlup logout`.
124
+ - **Interactive mode** — a streaming prompt with slash commands, tab
125
+ completion and input history; results render into your scrollback.
126
+ - **Live product pane** — `/open` opens a redraw-in-place tabbed view:
127
+ overview, insights, analytics, keywords, scan history.
128
+ - **Everything your dashboard has, over the same data path**: portfolio
129
+ table, website analytics (realtime visitors, AI crawls, conversions),
130
+ keyword rank boards + research, rescans with budget readouts,
131
+ publishing, analytics snippets, excluded pages.
132
+ - **One-shot mode** — every command works non-interactively, `--json`
133
+ included, so scripts and CI get the same surface.
134
+ - **`krawlup report <domain>`** runs the exact flow the public
135
+ /site-report page runs — refresh → live stage polling → stored report
136
+ — keyed by the CLI's own device id (`~/.krawlup/device-id`), with no
137
+ account: the per-device pool is a server setting the CLI reads and
138
+ reports at run time (the web page's browser-cookie pool is its own
139
+ number; a shared per-IP backstop bounds every run); every report read
140
+ afterwards is free and unlimited. No login, no OAuth.
141
+ - **A live scan screen** mirrors the web panel's own checklist: the six
142
+ real stages (queue wait → capture → Crux field data → Lighthouse →
143
+ scoring → history), a pacing bar that holds under 100% until the
144
+ report actually lands, queue position while waiting for a scan slot,
145
+ and `esc` to stop waiting without stopping the scan — it keeps
146
+ running on krawlup.com and any later `krawlup report <domain>` call
147
+ reads the stored result for free.
148
+ - **The full interactive report block**: the overall score, band and
149
+ verdict, scorecards, the issue list with severities, broken-link
150
+ results, Lighthouse and Crux context; narrow terminals shrink to fit.
151
+ `--md` downloads the site's markdown export; `--json` prints the raw
152
+ payload. Every refusal (quota exhausted, listed domain, rate limit)
153
+ surfaces as the server's own sentence, unedited.
154
+ - **Hardened from a full adversarial audit** — the browser actually opens
155
+ at login (printed-URL fallback when it cannot) and consents under the
156
+ server's first-party `krawlup-cli` client, forged loopback
157
+ callbacks are refused via the OAuth state check, scan refusals surface
158
+ instantly instead of polling, esc stops waiting on a running scan,
159
+ tables shrink to fit narrow terminals, session writes are atomic, and
160
+ `--json` errors print as JSON.
161
+ - Removed: the vendored local audit engine and its CI action. All
162
+ scores now come from krawlup.com itself — identical to the website,
163
+ by construction.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nowshad Hossain Rahat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,200 @@
1
- # Temporary Holding Version
1
+ # Official CLI for krawlup — manage products, insights and analytics from the terminal, with a free no-account site battery.
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ An interactive, streaming CLI for [krawlup.com](https://krawlup.com):
4
+ your products, scan scores, website analytics, keyword boards and
5
+ rescans — without leaving the terminal. Sign in once with your browser
6
+ (OAuth); everything after that is plain text at typing speed.
7
+
8
+ Runs on **Node.js** (≥ 18) or **Bun** (≥ 1.2).
9
+
10
+ ## Quick Start (Zero Install)
11
+
12
+ Run directly with your preferred package runner:
13
+
14
+ ```bash
15
+ # npm / npx
16
+ npx @krawlup/cli
17
+
18
+ # Bun
19
+ bunx @krawlup/cli
20
+
21
+ # pnpm
22
+ pnpm dlx @krawlup/cli
23
+
24
+ # Yarn
25
+ yarn dlx @krawlup/cli
26
+ ```
27
+
28
+ ## Global Installation
29
+
30
+ Install globally to make the `krawlup` binary available everywhere:
31
+
32
+ ```bash
33
+ # npm
34
+ npm install -g @krawlup/cli
35
+
36
+ # Bun
37
+ bun install -g @krawlup/cli
38
+
39
+ # pnpm
40
+ pnpm add -g @krawlup/cli
41
+
42
+ # Yarn
43
+ yarn global add @krawlup/cli
44
+ ```
45
+
46
+ Once installed, just type:
47
+
48
+ ```bash
49
+ krawlup
50
+ ```
51
+
52
+ ## What it does
53
+
54
+ `krawlup` boots to a welcome screen — the krawlup wordmark drawn as
55
+ ASCII art from the actual brand logo — with a select menu (portfolio,
56
+ products, open/scan a product, subscription…) that drops you straight
57
+ into the result. From there you're at a prompt with slash commands
58
+ (tab completes, ↑↓ recalls). Results stream into your normal
59
+ scrollback — nothing takes over the screen.
60
+
61
+ | Command | What you get |
62
+ |---|---|
63
+ | `/overview [range] [sort]` | portfolio table: visitors, views, revenue, scores — sort and range cycling |
64
+ | `/report <domain>` | **FREE full site scan + report — no login needed** (see below) |
65
+ | `/check <domain>` | **local battery — TLS, headers, mail, AI access, schema, links, OG, text (no account)** |
66
+ | `/robots <domain>` / `/mail <domain>` | AI-crawler verdicts / email records — local, no account |
67
+ | `/diff <url>` | page drift snapshots — local, no account |
68
+ | `/products` | every product, public and private |
69
+ | `/open <product>` | the live pane: redraw-in-place tabs — overview, insights, analytics, keywords, history |
70
+ | `/insights <p>` | overall score, issues, First Edit, fix cards |
71
+ | `/analytics <p> [range]` | totals + deltas, daily chart, top pages/referrers/countries/devices, realtime visitors, AI crawls |
72
+ | `/keywords <p>` | rank board with trends, stored ideas with verdicts |
73
+ | `/research <p> [seed]` | run keyword research (spends a monthly run — asks first) |
74
+ | `/scan <p>` | trigger a full re-scan and wait, streaming progress |
75
+ | `/add <url>` | readiness check + add a product |
76
+ | `/publish <p>` / `/unpublish <p>` | directory visibility |
77
+ | `/snippet <p>` | the analytics tag + excluded paths |
78
+ | `/exclude <p> /a /b` | replace the excluded pages board (`none` clears) |
79
+ | `/subscription` | plan, status, usage meters |
80
+
81
+ Everything the terminal shows comes straight from your krawlup
82
+ account's own reports — same numbers, no re-scoring, no drift.
83
+
84
+ ## The free site report (no login)
85
+
86
+ ```bash
87
+ krawlup report example.com # full scan + interactive report, nothing to sign up for
88
+ krawlup report example.com --md # same report as the site's markdown export
89
+ krawlup report example.com --json
90
+ ```
91
+
92
+ This is the same flow the public [/site-report](https://krawlup.com/site-report)
93
+ page runs, keyed by the CLI's own device id (`~/.krawlup/device-id`)
94
+ instead of a browser cookie:
95
+
96
+ - **The per-device pool is a server setting, not a CLI constant.** The
97
+ CLI reads its allowance from the API at startup and prints whatever is
98
+ in force — the admin panel's
99
+ *Settings ▸ Free Site Scanning ▸ Free scans per device / month*, which
100
+ ships at `0` (no free CLI pool). The browser page's cookie pool is its
101
+ own number, and the shared per-IP backstop still bounds every run. No
102
+ account required to try; when the pool is off the refusal says so.
103
+ - **Beta testers scan without a limit.** Sign in with `krawlup login`
104
+ before `krawlup report`; when your account is on the beta allowlist,
105
+ the CLI rides your session on the public endpoints and the server
106
+ waives the device quota (reads were already unlimited) — including
107
+ while the device pool is switched off for everyone else.
108
+ - **Every report read is free and unlimited** — once a scan has run, the
109
+ stored report (and its markdown export) never costs anything again.
110
+ - A **live scan screen** walks the real stages — queue wait → page
111
+ capture → real-user field data → Lighthouse → scoring → saving — with
112
+ a pacing bar that never claims 100% before the report exists, and
113
+ tesc to stop waiting while the scan itself keeps running server-side.
114
+ - The report block is the site's own numbers: overall score, band,
115
+ verdict, scorecards, issues with severities, broken links, Lighthouse
116
+ and Crux context. Every server refusal (quota, listed domain, rate
117
+ limit) prints as that server's exact sentence.
118
+
119
+ ## Local checks (no account, no API)
120
+
121
+ Ten commands that run entirely on **your machine** — no login, no key, no
122
+ quota, nothing touches krawlup's servers. Each takes `--json` (and `--md`
123
+ for markdown), and exits `0` when clean, `1` when a concrete finding was
124
+ measured, `2` on a usage mistake — so scripts and agents can gate on them.
125
+
126
+ ```bash
127
+ krawlup check example.com # the full battery: TLS, headers, mail records,
128
+ # AI access, schema, social card, links, text
129
+ krawlup check example.com --md # same report as shareable markdown
130
+ krawlup robots example.com --agent GPTBot --path /blog/x # "may GPTBot read this?"
131
+ krawlup mail example.com # SPF / DKIM / DMARC / MX with the fix for each gap
132
+ krawlup ssl example.com # certificate expiry, issuer, protocol
133
+ krawlup headers example.com # HSTS / CSP / framing / caching with exact fixes
134
+ krawlup text example.com # what an LLM sees (--as-bot fetches as GPTBot)
135
+ krawlup schema example.com # JSON-LD lint: types + required properties
136
+ krawlup links example.com # broken links, redirect chains, mixed content
137
+ krawlup og example.com/blog/post # social-card lint + the text X/Slack will show
138
+ krawlup diff example.com # snapshot a page; every later run reports the drift
139
+ ```
140
+
141
+ What each one is for:
142
+
143
+ - **check** — one command before a launch, a redesign, or a client call.
144
+ Everything the spot commands measure, composed, shareable.
145
+ - **robots** — nobody else's CLI answers "is GPTBot allowed here?" before
146
+ an agent crawls. Same parser as the krawlup scanner, so the verdicts match.
147
+ - **mail** — missing DMARC and SPF are the two most common real
148
+ deliverability failures; this names them in five seconds with the exact
149
+ DNS record to add.
150
+ - **diff** — watch your own (or a competitor's) page between monthly
151
+ scans: first run stores a baseline in `~/.krawlup/snapshots/`, later runs
152
+ print added/removed lines, title changes and word deltas, exit 1 on drift.
153
+
154
+ `check` needs a minute (it probes up to 40 links); the spot commands are
155
+ seconds. Every verdict is tri-state: something that could not be measured
156
+ (blocked fetch, DNS failure) reports as *unknown*, never as a pass or a fail.
157
+
158
+ ## Login
159
+
160
+ `krawlup login` (or `npx @krawlup/cli login`) opens your browser: you approve the **Krawlup TUI**
161
+ connection once (read your data, start scans, manage listings — the
162
+ consent screen lists exactly that), and the terminal picks the tokens
163
+ up on a localhost callback. Tokens rotate automatically and sit at
164
+ `~/.krawlup/session.json` (mode 0600). Revoke any time from the
165
+ dashboard's **Agent access** page, or `krawlup logout`.
166
+
167
+ In CI (or anywhere a browser is awkward), `KRAWLUP_KEY` with an agent
168
+ key from the same page works as a static escape hatch, and
169
+ `KRAWLUP_API` moves the API base (a local dev API is exempt from the
170
+ https-only rule).
171
+
172
+ ## Scriptable too
173
+
174
+ Every command runs one-shot outside interactive mode. Perfect for scripts, CI pipelines, or AI agents:
175
+
176
+ ```bash
177
+ # With global install:
178
+ krawlup insights myapp.com
179
+ krawlup analytics myapp.com 30d --json
180
+ krawlup scan myapp.com
181
+ krawlup report example.com # the free one — no login needed
182
+
183
+ # Or directly with npx / bunx:
184
+ npx @krawlup/cli overview
185
+ npx @krawlup/cli insights myapp.com
186
+ npx @krawlup/cli analytics myapp.com 30d --json
187
+ bunx @krawlup/cli scan myapp.com
188
+ ```
189
+
190
+ Same renderers, `--json` for machines, honest exit codes (2 = not
191
+ logged in, 1 = the server refused — its sentence is printed verbatim).
192
+
193
+ ## Agents
194
+
195
+ Point any MCP client at krawlup's own MCP server (`https://api.krawlup.com/mcp`)
196
+ — the terminal and your agent read the same tools.
197
+
198
+ ## License
199
+
200
+ [MIT](./LICENSE)