rpg-encoder 0.1.0

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,41 @@
1
+ # rpg-encoder
2
+
3
+ Semantic code graph for AI-assisted code understanding.
4
+
5
+ Extracts entities from your codebase, resolves dependency edges, and lifts semantic features via LLM — producing a navigable graph optimized for AI coding tools.
6
+
7
+ ## MCP Server (Claude Code, Cursor, etc.)
8
+
9
+ Add to your MCP config:
10
+
11
+ ```json
12
+ {
13
+ "mcpServers": {
14
+ "rpg": {
15
+ "command": "npx",
16
+ "args": ["-y", "-p", "rpg-encoder", "rpg-mcp-server", "/path/to/your/project"]
17
+ }
18
+ }
19
+ }
20
+ ```
21
+
22
+ ## CLI
23
+
24
+ ```bash
25
+ npx -p rpg-encoder rpg-encoder build # Build the graph
26
+ npx -p rpg-encoder rpg-encoder build --lift # Build with semantic lifting
27
+ npx -p rpg-encoder rpg-encoder search "parse config"
28
+ npx -p rpg-encoder rpg-encoder info
29
+ ```
30
+
31
+ Or install globally:
32
+
33
+ ```bash
34
+ npm install -g rpg-encoder
35
+ rpg-encoder build
36
+ rpg-mcp-server /path/to/project
37
+ ```
38
+
39
+ ## Documentation
40
+
41
+ Full docs at [github.com/userFRM/rpg-encoder](https://github.com/userFRM/rpg-encoder).
package/bin/run-mcp.js ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execFileSync } = require("child_process");
4
+ const path = require("path");
5
+
6
+ const ext = process.platform === "win32" ? ".exe" : "";
7
+ const bin = path.join(__dirname, `rpg-mcp-server${ext}`);
8
+
9
+ try {
10
+ execFileSync(bin, process.argv.slice(2), { stdio: "inherit" });
11
+ } catch (err) {
12
+ if (err.status != null) process.exit(err.status);
13
+ throw err;
14
+ }
package/bin/run.js ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execFileSync } = require("child_process");
4
+ const path = require("path");
5
+
6
+ const ext = process.platform === "win32" ? ".exe" : "";
7
+ const bin = path.join(__dirname, `rpg-encoder${ext}`);
8
+
9
+ try {
10
+ execFileSync(bin, process.argv.slice(2), { stdio: "inherit" });
11
+ } catch (err) {
12
+ if (err.status != null) process.exit(err.status);
13
+ throw err;
14
+ }
package/install.js ADDED
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require("child_process");
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const https = require("https");
7
+
8
+ const pkg = require("./package.json");
9
+ const VERSION = `v${pkg.version}`;
10
+ const REPO = "userFRM/rpg-encoder";
11
+ const BIN_DIR = path.join(__dirname, "bin");
12
+
13
+ function getTarget() {
14
+ const platform = process.platform;
15
+ const arch = process.arch;
16
+
17
+ if (platform === "darwin" && arch === "arm64") return "aarch64-apple-darwin";
18
+ if (platform === "darwin" && arch === "x64") return "x86_64-apple-darwin";
19
+ if (platform === "linux" && arch === "x64") return "x86_64-unknown-linux-gnu";
20
+ if (platform === "win32" && arch === "x64") return "x86_64-pc-windows-msvc";
21
+
22
+ throw new Error(
23
+ `Unsupported platform: ${platform}-${arch}. ` +
24
+ `Build from source: https://github.com/${REPO}#install`
25
+ );
26
+ }
27
+
28
+ function download(url, dest) {
29
+ return new Promise((resolve, reject) => {
30
+ const follow = (u) => {
31
+ https
32
+ .get(u, { headers: { "User-Agent": "rpg-encoder-npm" } }, (res) => {
33
+ if (
34
+ res.statusCode >= 300 &&
35
+ res.statusCode < 400 &&
36
+ res.headers.location
37
+ ) {
38
+ return follow(res.headers.location);
39
+ }
40
+ if (res.statusCode !== 200) {
41
+ return reject(new Error(`HTTP ${res.statusCode} for ${u}`));
42
+ }
43
+ const file = fs.createWriteStream(dest);
44
+ res.pipe(file);
45
+ file.on("finish", () => file.close(resolve));
46
+ file.on("error", reject);
47
+ })
48
+ .on("error", reject);
49
+ };
50
+ follow(url);
51
+ });
52
+ }
53
+
54
+ async function main() {
55
+ const target = getTarget();
56
+ const isWindows = process.platform === "win32";
57
+ const ext = isWindows ? "zip" : "tar.gz";
58
+ const archive = `rpg-encoder-${target}.${ext}`;
59
+ const url = `https://github.com/${REPO}/releases/download/${VERSION}/${archive}`;
60
+
61
+ fs.mkdirSync(BIN_DIR, { recursive: true });
62
+
63
+ const tmpFile = path.join(BIN_DIR, archive);
64
+
65
+ console.log(`Downloading rpg-encoder ${VERSION} for ${target}...`);
66
+
67
+ try {
68
+ await download(url, tmpFile);
69
+
70
+ // Extract using system tar (available on macOS, Linux, and modern Windows)
71
+ if (isWindows) {
72
+ execSync(`tar -xf "${tmpFile}" -C "${BIN_DIR}"`, { stdio: "ignore" });
73
+ } else {
74
+ execSync(`tar -xzf "${tmpFile}" -C "${BIN_DIR}"`, { stdio: "ignore" });
75
+ }
76
+ } catch (err) {
77
+ console.error(`Failed to download pre-built binary: ${err.message}`);
78
+ console.error(`\nYou can build from source instead:`);
79
+ console.error(` git clone https://github.com/${REPO}.git`);
80
+ console.error(` cd rpg-encoder && cargo build --release`);
81
+ process.exit(1);
82
+ } finally {
83
+ // Clean up archive
84
+ if (fs.existsSync(tmpFile)) fs.unlinkSync(tmpFile);
85
+ }
86
+
87
+ // Make binaries executable
88
+ if (!isWindows) {
89
+ for (const bin of ["rpg-encoder", "rpg-mcp-server"]) {
90
+ const p = path.join(BIN_DIR, bin);
91
+ if (fs.existsSync(p)) fs.chmodSync(p, 0o755);
92
+ }
93
+ }
94
+
95
+ console.log("rpg-encoder installed successfully.");
96
+ }
97
+
98
+ main();
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "rpg-encoder",
3
+ "version": "0.1.0",
4
+ "description": "RPG-Encoder — semantic code graph for AI-assisted code understanding",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/userFRM/rpg-encoder"
9
+ },
10
+ "homepage": "https://github.com/userFRM/rpg-encoder",
11
+ "keywords": [
12
+ "mcp",
13
+ "code-analysis",
14
+ "semantic-search",
15
+ "llm",
16
+ "tree-sitter",
17
+ "program-graph"
18
+ ],
19
+ "bin": {
20
+ "rpg-encoder": "bin/run.js",
21
+ "rpg-mcp-server": "bin/run-mcp.js"
22
+ },
23
+ "scripts": {
24
+ "postinstall": "node install.js"
25
+ },
26
+ "files": [
27
+ "bin/",
28
+ "install.js",
29
+ "README.md"
30
+ ]
31
+ }