indexio 0.1.2

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 ADDED
@@ -0,0 +1,14 @@
1
+ # indexio
2
+
3
+ Code search, impact analysis and MCP server for AI coding agents, as one binary.
4
+
5
+ ```bash
6
+ npm install -g indexio # or: npx indexio --help
7
+ indexio add ~/code # index every git repository under a folder
8
+ indexio setup claude # register the MCP server with Claude Code
9
+ indexio hook install # route reads and greps through the index
10
+ ```
11
+
12
+ This package downloads the prebuilt binary for your platform from the GitHub
13
+ release at install time and checks its SHA-256. Documentation, source and other
14
+ install options: https://github.com/IOServicesLabs/indexio
package/bin/indexio.js ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ const path = require("path");
4
+ const fs = require("fs");
5
+ const { spawnSync } = require("child_process");
6
+
7
+ const exe = path.join(__dirname, "..", "vendor", process.platform === "win32" ? "indexio.exe" : "indexio");
8
+ if (!fs.existsSync(exe)) {
9
+ console.error("indexio: the binary was not downloaded at install time.");
10
+ console.error("run `npm rebuild indexio` with network access, or install from https://github.com/IOServicesLabs/indexio#install");
11
+ process.exit(1);
12
+ }
13
+ const r = spawnSync(exe, process.argv.slice(2), { stdio: "inherit", windowsHide: true });
14
+ if (r.error) {
15
+ console.error(`indexio: ${r.error.message}`);
16
+ process.exit(1);
17
+ }
18
+ process.exit(r.status === null ? 1 : r.status);
package/install.js ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ // postinstall: download the indexio binary of this package's version from
3
+ // the GitHub release, check its SHA-256, and place it in vendor/.
4
+ // Nothing here runs at `indexio` time; bin/indexio.js only execs the binary.
5
+ "use strict";
6
+ const fs = require("fs");
7
+ const os = require("os");
8
+ const path = require("path");
9
+ const https = require("https");
10
+ const crypto = require("crypto");
11
+ const { execFileSync } = require("child_process");
12
+
13
+ const REPO = "IOServicesLabs/indexio";
14
+ const version = require("./package.json").version;
15
+ const platform = { linux: "linux", darwin: "macos", win32: "windows" }[process.platform];
16
+ const arch = { x64: "x86_64", arm64: "aarch64" }[process.arch];
17
+ const vendor = path.join(__dirname, "vendor");
18
+ const exe = path.join(vendor, process.platform === "win32" ? "indexio.exe" : "indexio");
19
+
20
+ function fetch(url, redirects = 5) {
21
+ return new Promise((resolve, reject) => {
22
+ https.get(url, { headers: { "User-Agent": "indexio-npm" } }, (res) => {
23
+ if ([301, 302, 307, 308].includes(res.statusCode) && res.headers.location && redirects > 0) {
24
+ res.resume();
25
+ return fetch(res.headers.location, redirects - 1).then(resolve, reject);
26
+ }
27
+ if (res.statusCode !== 200) {
28
+ res.resume();
29
+ return reject(new Error(`GET ${url}: HTTP ${res.statusCode}`));
30
+ }
31
+ const chunks = [];
32
+ res.on("data", (c) => chunks.push(c));
33
+ res.on("end", () => resolve(Buffer.concat(chunks)));
34
+ res.on("error", reject);
35
+ }).on("error", reject);
36
+ });
37
+ }
38
+
39
+ async function main() {
40
+ if (process.env.INDEXIO_SKIP_DOWNLOAD) return;
41
+ if (!platform || !arch) {
42
+ console.error(`indexio: no prebuilt binary for ${process.platform}/${process.arch}; build from source (cargo install --git https://github.com/${REPO} indexio)`);
43
+ return;
44
+ }
45
+ const name = `indexio-${version}-${platform}-${arch}`;
46
+ const ext = platform === "windows" ? "zip" : "tar.gz";
47
+ const base = `https://github.com/${REPO}/releases/download/v${version}`;
48
+ const archive = await fetch(`${base}/${name}.${ext}`);
49
+ const want = (await fetch(`${base}/${name}.${ext}.sha256`)).toString("utf8").trim().split(/\s+/)[0].toLowerCase();
50
+ const have = crypto.createHash("sha256").update(archive).digest("hex");
51
+ if (want !== have) throw new Error("checksum mismatch");
52
+
53
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "indexio-"));
54
+ const file = path.join(tmp, `${name}.${ext}`);
55
+ fs.writeFileSync(file, archive);
56
+ // bsdtar on Windows 10+ and GNU tar both extract zip and tar.gz
57
+ execFileSync("tar", ["-xf", file, "-C", tmp], { stdio: "inherit" });
58
+ fs.mkdirSync(vendor, { recursive: true });
59
+ fs.copyFileSync(path.join(tmp, name, path.basename(exe)), exe);
60
+ fs.chmodSync(exe, 0o755);
61
+ fs.rmSync(tmp, { recursive: true, force: true });
62
+ console.log(`indexio ${version} installed (${platform}-${arch})`);
63
+ }
64
+
65
+ main().catch((e) => {
66
+ console.error(`indexio: download failed: ${e.message}`);
67
+ console.error(`install it another way: https://github.com/${REPO}#install`);
68
+ // do not fail the whole npm install; the shim explains what to do
69
+ });
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "indexio",
3
+ "version": "0.1.2",
4
+ "description": "Code search, impact analysis and MCP server for AI coding agents",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/IOServicesLabs/indexio.git"
9
+ },
10
+ "homepage": "https://github.com/IOServicesLabs/indexio#readme",
11
+ "bin": {
12
+ "indexio": "bin/indexio.js"
13
+ },
14
+ "scripts": {
15
+ "postinstall": "node install.js"
16
+ },
17
+ "files": [
18
+ "bin/indexio.js",
19
+ "install.js",
20
+ "README.md"
21
+ ],
22
+ "os": [
23
+ "linux",
24
+ "darwin",
25
+ "win32"
26
+ ],
27
+ "cpu": [
28
+ "x64",
29
+ "arm64"
30
+ ],
31
+ "engines": {
32
+ "node": ">=18"
33
+ },
34
+ "keywords": [
35
+ "code-search",
36
+ "mcp",
37
+ "model-context-protocol",
38
+ "claude-code",
39
+ "index",
40
+ "impact-analysis"
41
+ ]
42
+ }