Skip to content

Commit 275671b

Browse files
feat: dynamic version from package.json, new banner, doc URLs per command
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 88707a4 commit 275671b

11 files changed

Lines changed: 42 additions & 19 deletions

File tree

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ SGAI_CLI_DEBUG=1 scrapegraphai smart-scraper https://example.com -p "Extract dat
5252

5353
## Commands
5454

55-
### `smart-scraper` — Extract structured data from a URL
55+
### `smart-scraper` — Extract structured data from a URL [docs](https://docs.scrapegraphai.com/services/smartscraper)
5656

5757
```bash
5858
scrapegraphai smart-scraper <url> -p "Extract all product names and prices"
@@ -78,7 +78,7 @@ scrapegraphai smart-scraper https://example.com -p "Extract data" \
7878
| `--headers` | Custom headers as JSON object string |
7979
| `--plain-text` | Return plain text instead of JSON |
8080

81-
### `search-scraper` — Search the web and extract data
81+
### `search-scraper` — Search the web and extract data [docs](https://docs.scrapegraphai.com/services/searchscraper)
8282

8383
```bash
8484
scrapegraphai search-scraper "What are the top Python web frameworks?"
@@ -95,7 +95,7 @@ scrapegraphai search-scraper "Python frameworks" --no-extraction --num-results 5
9595
| `--stealth` | Bypass bot detection (+4 credits) |
9696
| `--headers` | Custom headers as JSON object string |
9797

98-
### `markdownify` — Convert a webpage to markdown
98+
### `markdownify` — Convert a webpage to markdown [docs](https://docs.scrapegraphai.com/services/markdownify)
9999

100100
```bash
101101
scrapegraphai markdownify https://example.com/article
@@ -108,7 +108,7 @@ scrapegraphai markdownify https://example.com --render-js --stealth
108108
| `--stealth` | Bypass bot detection (+4 credits) |
109109
| `--headers` | Custom headers as JSON object string |
110110

111-
### `crawl` — Crawl and extract from multiple pages
111+
### `crawl` — Crawl and extract from multiple pages [docs](https://docs.scrapegraphai.com/services/smartcrawler)
112112

113113
```bash
114114
scrapegraphai crawl https://example.com -p "Extract article titles" --max-pages 5 --depth 2
@@ -133,13 +133,13 @@ scrapegraphai crawl https://example.com -p "Extract data" \
133133
| `--render-js` | Enable JS rendering (+1 credit/page) |
134134
| `--stealth` | Bypass bot detection (+4 credits) |
135135

136-
### `sitemap` — Get all URLs from a website's sitemap
136+
### `sitemap` — Get all URLs from a website's sitemap [docs](https://docs.scrapegraphai.com/services/sitemap)
137137

138138
```bash
139139
scrapegraphai sitemap https://example.com
140140
```
141141

142-
### `scrape` — Get raw HTML content
142+
### `scrape` — Get raw HTML content [docs](https://docs.scrapegraphai.com/services/scrape)
143143

144144
```bash
145145
scrapegraphai scrape https://example.com
@@ -153,7 +153,7 @@ scrapegraphai scrape https://example.com --stealth --branding --country-code US
153153
| `--branding` | Extract branding info (+2 credits) |
154154
| `--country-code` | ISO country code for geo-targeting |
155155

156-
### `agentic-scraper` — Browser automation with AI
156+
### `agentic-scraper` — Browser automation with AI [docs](https://docs.scrapegraphai.com/services/agenticscraper)
157157

158158
```bash
159159
scrapegraphai agentic-scraper https://example.com/login \
@@ -217,7 +217,7 @@ scrapegraph-cli/
217217
│ │ ├── credits.ts
218218
│ │ └── validate.ts
219219
│ └── utils/
220-
│ └── banner.ts # ASCII banner display
220+
│ └── banner.ts # ASCII banner + version from package.json
221221
├── dist/ # Build output (git-ignored)
222222
│ └── cli.mjs # Bundled ESM with shebang
223223
├── package.json

src/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import "dotenv/config";
22
import { defineCommand, runMain } from "citty";
3-
import { showBanner } from "./utils/banner.js";
3+
import { getVersion, showBanner } from "./utils/banner.js";
44

55
showBanner();
66

77
const main = defineCommand({
88
meta: {
99
name: "scrapegraphai",
10-
version: "0.1.0",
10+
version: getVersion(),
1111
description: "ScrapeGraph AI CLI tool",
1212
},
1313
subCommands: {

src/commands/agentic-scraper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export default defineCommand({
3939
},
4040
},
4141
run: async ({ args }) => {
42+
log.docs("https://docs.scrapegraphai.com/services/agenticscraper");
4243
const key = await resolveApiKey();
4344

4445
const params: scrapegraphai.AgenticScraperParams = {

src/commands/crawl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export default defineCommand({
5454
},
5555
},
5656
run: async ({ args }) => {
57+
log.docs("https://docs.scrapegraphai.com/services/smartcrawler");
5758
const key = await resolveApiKey();
5859

5960
const params: scrapegraphai.CrawlParams = {

src/commands/markdownify.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default defineCommand({
2929
},
3030
},
3131
run: async ({ args }) => {
32+
log.docs("https://docs.scrapegraphai.com/services/markdownify");
3233
const key = await resolveApiKey();
3334

3435
const params: scrapegraphai.MarkdownifyParams = {

src/commands/scrape.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export default defineCommand({
3333
},
3434
},
3535
run: async ({ args }) => {
36+
log.docs("https://docs.scrapegraphai.com/services/scrape");
3637
const key = await resolveApiKey();
3738

3839
const params: scrapegraphai.ScrapeParams = {

src/commands/search-scraper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export default defineCommand({
3737
},
3838
},
3939
run: async ({ args }) => {
40+
log.docs("https://docs.scrapegraphai.com/services/searchscraper");
4041
const key = await resolveApiKey();
4142

4243
const params: scrapegraphai.SearchScraperParams = {

src/commands/sitemap.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default defineCommand({
1717
},
1818
},
1919
run: async ({ args }) => {
20+
log.docs("https://docs.scrapegraphai.com/services/sitemap");
2021
const key = await resolveApiKey();
2122
const s = p.spinner();
2223
s.start("Fetching sitemap");

src/commands/smart-scraper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export default defineCommand({
5555
},
5656
},
5757
run: async ({ args }) => {
58+
log.docs("https://docs.scrapegraphai.com/services/smartscraper");
5859
const key = await resolveApiKey();
5960

6061
const params: scrapegraphai.SmartScraperParams = {

src/lib/log.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export function result(data: unknown) {
1818
console.log(`\n${highlight(JSON.stringify(data, null, 2))}\n`);
1919
}
2020

21+
export function docs(url: string) {
22+
console.log(chalk.dim(`Docs: ${url}`));
23+
}
24+
2125
export function error(message?: string) {
2226
p.log.error(message ?? "Unknown error");
2327
process.exit(1);

0 commit comments

Comments
 (0)