node-pagefind 0.1.0 → 0.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/README.md +50 -50
- package/dist/cli.d.ts +1187 -10
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +89 -11
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1180 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pagefind.d.ts +59 -2
- package/dist/pagefind.d.ts.map +1 -1
- package/dist/pagefind.js +397 -58
- package/dist/pagefind.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -3
- package/dist/digest.d.ts +0 -20
- package/dist/digest.d.ts.map +0 -1
- package/dist/digest.js +0 -424
- package/dist/digest.js.map +0 -1
- package/dist/utils.d.ts +0 -19
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -115
- package/dist/utils.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,84 +1,87 @@
|
|
|
1
|
-
#
|
|
1
|
+
# node-pagefind
|
|
2
2
|
|
|
3
|
-
A CLI
|
|
3
|
+
A Node.js CLI and SDK for querying [Pagefind](https://pagefind.app/) search indices. Supports both local and remote data sources with automatic version-keyed caching.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
7
|
+
- Query any Pagefind index from Node.js — local or remote
|
|
8
|
+
- CLI with `search`, `filters`, and `info` subcommands
|
|
9
|
+
- Programmatic SDK via cli-forge's `.sdk()` method
|
|
10
|
+
- `PagefindClient` class for fine-grained lifecycle control
|
|
11
|
+
- Version-keyed caching in `/tmp/node-pagefind/` with automatic invalidation
|
|
12
|
+
- Optional `--cachePath` for custom cache directories (bypasses version management)
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
npm install -
|
|
17
|
+
npm install node-pagefind
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
## Usage
|
|
20
|
+
## CLI Usage
|
|
21
21
|
|
|
22
|
-
###
|
|
22
|
+
### Search a remote site
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
|
|
25
|
+
node-pagefind search "react hooks" --url nx.dev/docs --limit 5 --excerpt
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
### Search a local build
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
4. Generate a digest for that PR
|
|
30
|
+
```bash
|
|
31
|
+
node-pagefind search "getting started" --path ./dist
|
|
32
|
+
```
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
### List available filters
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
-
|
|
36
|
+
```bash
|
|
37
|
+
node-pagefind filters --url nx.dev/docs
|
|
38
|
+
```
|
|
39
39
|
|
|
40
|
-
###
|
|
40
|
+
### Show index info
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
|
|
43
|
+
node-pagefind info --url nx.dev/docs
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
###
|
|
46
|
+
### Custom cache directory
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
|
|
49
|
+
node-pagefind search "query" --url nx.dev/docs --cachePath ./my-cache
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
## SDK Usage
|
|
53
53
|
|
|
54
|
-
The
|
|
54
|
+
The package exports a cli-forge SDK where each subcommand becomes a typed async function:
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
3. `GITHUB_TOKEN` environment variable
|
|
59
|
-
4. `gh auth token` command (requires GitHub CLI)
|
|
56
|
+
```typescript
|
|
57
|
+
import { sdk } from 'node-pagefind';
|
|
60
58
|
|
|
61
|
-
|
|
59
|
+
const result = await sdk.search({
|
|
60
|
+
query: 'react hooks',
|
|
61
|
+
url: 'https://nx.dev/docs',
|
|
62
|
+
limit: 5,
|
|
63
|
+
});
|
|
64
|
+
```
|
|
62
65
|
|
|
63
|
-
|
|
66
|
+
## PagefindClient Usage
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
- **Branch Information**: Base branch (for `git diff` commands) and head branch
|
|
67
|
-
- **Timeline Section**: Full conversation history including:
|
|
68
|
-
- Review summary with approval statistics
|
|
69
|
-
- Individual review comments with review states
|
|
70
|
-
- Nx Cloud CI links (detected and highlighted)
|
|
71
|
-
- General Comments: Issue-level comments with threaded replies
|
|
72
|
-
- File-Specific Comments\*\*: Review comments grouped by file with line numbers and ranges
|
|
73
|
-
- **AI Agent Instructions**: Context-aware guidelines based on timeline data
|
|
68
|
+
For more control over initialization and reuse across multiple queries:
|
|
74
69
|
|
|
75
|
-
|
|
70
|
+
```typescript
|
|
71
|
+
import { PagefindClient } from 'node-pagefind';
|
|
76
72
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
const client = new PagefindClient({ baseUrl: 'https://nx.dev/docs' });
|
|
74
|
+
await client.init('en');
|
|
75
|
+
|
|
76
|
+
const results = await client.search('react hooks');
|
|
77
|
+
const filters = await client.filters();
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Caching
|
|
81
|
+
|
|
82
|
+
By default, downloaded `pagefind.js` files are cached in `/tmp/node-pagefind/<version>/` with a `known-versions.json` map tracking which data source uses which version. If a version mismatch occurs at init time, the cache is invalidated and the client is re-downloaded automatically.
|
|
83
|
+
|
|
84
|
+
When `cachePath` is provided, the file is stored directly at `<cachePath>/pagefind.js` with no version management — useful for CI/CD or embedded use cases where you want deterministic control over the cache location.
|
|
82
85
|
|
|
83
86
|
## Development
|
|
84
87
|
|
|
@@ -91,7 +94,4 @@ npm run test
|
|
|
91
94
|
|
|
92
95
|
# Type check
|
|
93
96
|
npm run typecheck
|
|
94
|
-
|
|
95
|
-
# Lint
|
|
96
|
-
npm run lint
|
|
97
97
|
```
|