docdex 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/CHANGELOG.md +12 -0
- package/README.md +38 -13
- package/bin/docdex.js +5 -1
- package/lib/install.js +1 -1
- package/lib/platform.js +5 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
- Version bump for republish (0.1.3 already exists on npm).
|
|
5
|
+
|
|
6
|
+
## 0.1.3
|
|
7
|
+
- Fixed npm trusted publishing configuration (environment + registry) and aligned version bump.
|
|
8
|
+
|
|
9
|
+
## 0.1.2
|
|
10
|
+
- Broadened platform coverage in the workflow (musl, Windows) and kept npm version aligned with release tags.
|
|
11
|
+
|
|
12
|
+
## 0.1.1
|
|
13
|
+
- Updated npm README with clearer install and usage details.
|
|
14
|
+
|
|
3
15
|
## 0.1.0
|
|
4
16
|
- Initial npm scaffold for the Docdex CLI (`docdex`/`docdexd` bin).
|
|
5
17
|
- Postinstall downloader to fetch platform-specific `docdexd` binaries.
|
package/README.md
CHANGED
|
@@ -1,28 +1,53 @@
|
|
|
1
|
-
# Docdex (npm)
|
|
1
|
+
# Docdex CLI (npm)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Docdex is a lightweight, local docs indexer/searcher. It builds and serves a per-repo index of your Markdown/text files—no external services, no uploads.
|
|
4
4
|
|
|
5
|
+
## Install
|
|
5
6
|
```bash
|
|
7
|
+
# Global install
|
|
6
8
|
npm i -g docdex
|
|
7
|
-
|
|
9
|
+
|
|
10
|
+
# One-off use
|
|
8
11
|
npx docdex --version
|
|
9
12
|
```
|
|
10
13
|
|
|
11
|
-
Requirements
|
|
14
|
+
## Requirements
|
|
12
15
|
- Node.js >= 18
|
|
13
|
-
-
|
|
16
|
+
- Platforms: macOS (arm64, x64), Linux glibc (arm64, x64), Linux musl/Alpine (x64), Windows (x64). ARM64 Windows and Linux musl ARM64 can be added when artifacts are published.
|
|
17
|
+
|
|
18
|
+
## What this package does
|
|
19
|
+
- Provides a tiny JS launcher (`docdex`/`docdexd`).
|
|
20
|
+
- On install, downloads the prebuilt `docdexd` binary for your platform from the GitHub release that matches the npm package version, storing it under `dist/<platform>/docdexd`.
|
|
21
|
+
|
|
22
|
+
## What Docdex does
|
|
23
|
+
- Indexes Markdown/text files in your repo (tantivy-based) and stores the index locally.
|
|
24
|
+
- Serves search/snippet APIs over HTTP (`/search`, `/snippet`, `/healthz`) and via CLI commands.
|
|
25
|
+
- Watches files while serving to keep the index fresh.
|
|
26
|
+
- Hardened defaults: loopback bind, optional TLS/auth token, rate limits, strict state-dir perms.
|
|
27
|
+
|
|
28
|
+
## Quick usage
|
|
29
|
+
```bash
|
|
30
|
+
# Check version
|
|
31
|
+
docdex --version
|
|
32
|
+
|
|
33
|
+
# Build an index
|
|
34
|
+
docdexd index --repo /path/to/repo
|
|
14
35
|
|
|
15
|
-
|
|
16
|
-
|
|
36
|
+
# Serve HTTP API with live watching
|
|
37
|
+
docdexd serve --repo /path/to/repo --host 127.0.0.1 --port 46137 --log info
|
|
38
|
+
|
|
39
|
+
# Ad-hoc search via CLI (JSON)
|
|
40
|
+
docdexd query --repo /path/to/repo --query "otp flow" --limit 5
|
|
41
|
+
```
|
|
17
42
|
|
|
18
|
-
Environment overrides (optional)
|
|
19
|
-
- `DOCDEX_DOWNLOAD_REPO` — `owner/repo` slug hosting release assets (
|
|
20
|
-
- `DOCDEX_DOWNLOAD_BASE` —
|
|
21
|
-
- `DOCDEX_VERSION` —
|
|
43
|
+
## Environment overrides (optional)
|
|
44
|
+
- `DOCDEX_DOWNLOAD_REPO` — `owner/repo` slug hosting release assets (defaults to the linked GitHub repo).
|
|
45
|
+
- `DOCDEX_DOWNLOAD_BASE` — custom base URL for release downloads (defaults to `https://github.com/<repo>/releases/download`).
|
|
46
|
+
- `DOCDEX_VERSION` — override version/tag to download (for testing).
|
|
22
47
|
- `DOCDEX_LIBC` — force `gnu` or `musl` on Linux if auto-detection is wrong.
|
|
23
|
-
- `DOCDEX_GITHUB_TOKEN` — token for authenticated GitHub downloads (avoids rate limits/private
|
|
48
|
+
- `DOCDEX_GITHUB_TOKEN` — token for authenticated GitHub downloads (avoids rate limits/private releases).
|
|
24
49
|
|
|
25
|
-
Notes
|
|
50
|
+
## Notes
|
|
26
51
|
- Release assets are expected to be named `docdexd-<platform>.tar.gz` with a matching `.sha256`.
|
|
27
52
|
- License: MIT (see `LICENSE`).
|
|
28
53
|
- Changelog: see `CHANGELOG.md`.
|
package/bin/docdex.js
CHANGED
|
@@ -9,7 +9,11 @@ const { detectPlatformKey } = require("../lib/platform");
|
|
|
9
9
|
|
|
10
10
|
function run() {
|
|
11
11
|
const platformKey = detectPlatformKey();
|
|
12
|
-
const
|
|
12
|
+
const basePath = path.join(__dirname, "..", "dist", platformKey);
|
|
13
|
+
const binaryPath = path.join(
|
|
14
|
+
basePath,
|
|
15
|
+
process.platform === "win32" ? "docdexd.exe" : "docdexd"
|
|
16
|
+
);
|
|
13
17
|
|
|
14
18
|
if (!fs.existsSync(binaryPath)) {
|
|
15
19
|
console.error(
|
package/lib/install.js
CHANGED
|
@@ -95,7 +95,7 @@ async function main() {
|
|
|
95
95
|
await download(downloadUrl, tmpFile);
|
|
96
96
|
await extractTarball(tmpFile, distDir);
|
|
97
97
|
|
|
98
|
-
const binaryPath = path.join(distDir, "docdexd");
|
|
98
|
+
const binaryPath = path.join(distDir, process.platform === "win32" ? "docdexd.exe" : "docdexd");
|
|
99
99
|
if (!fs.existsSync(binaryPath)) {
|
|
100
100
|
throw new Error(`Downloaded archive missing binary at ${binaryPath}`);
|
|
101
101
|
}
|
package/lib/platform.js
CHANGED
|
@@ -29,6 +29,11 @@ function detectPlatformKey() {
|
|
|
29
29
|
if (arch === "x64") return `linux-x64-${libc}`;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
if (platform === "win32") {
|
|
33
|
+
if (arch === "x64") return "win32-x64";
|
|
34
|
+
if (arch === "arm64") return "win32-arm64";
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
throw new Error(`Unsupported platform: ${platform}/${arch}`);
|
|
33
38
|
}
|
|
34
39
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docdex",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Docdex CLI as an npm-installable binary wrapper.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"docdex": "bin/docdex.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
32
|
-
"url": "https://github.com/bekirdag/docdex.git"
|
|
32
|
+
"url": "git+https://github.com/bekirdag/docdex.git"
|
|
33
33
|
},
|
|
34
34
|
"bugs": {
|
|
35
35
|
"url": "https://github.com/bekirdag/docdex/issues"
|