@pixeljuggle/project-context 0.0.11

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.
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ const { spawnSync } = require("node:child_process");
3
+ const path = require("node:path");
4
+ const fs = require("node:fs");
5
+
6
+ const binDir = path.join(__dirname);
7
+ const isWin = process.platform === "win32";
8
+ const binary = path.join(binDir, isWin ? "project-context.exe" : "project-context");
9
+
10
+ if (!fs.existsSync(binary)) {
11
+ console.error("❌ project-context binary not found. Run `npm install` again.");
12
+ process.exit(1);
13
+ }
14
+
15
+ const result = spawnSync(binary, process.argv.slice(2), {
16
+ stdio: "inherit",
17
+ env: { ...process.env },
18
+ });
19
+
20
+ process.exit(result.status ?? 0);
package/install.js ADDED
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env node
2
+
3
+ const https = require("node:https");
4
+ const fs = require("node:fs");
5
+ const path = require("node:path");
6
+ const zlib = require("node:zlib");
7
+ const tar = require("tar");
8
+ const { pipeline } = require("node:stream/promises");
9
+
10
+ const pkg = require("./package.json");
11
+ const version = pkg.version;
12
+ const binaryName = "project-context";
13
+ const repo = "pixeljuggle/project-context";
14
+
15
+ async function main() {
16
+ const platform = process.platform;
17
+ const arch = process.arch;
18
+
19
+ const goOs = platform === "win32" ? "windows" : platform;
20
+ let goArch = arch === "x64" ? "amd64" : arch;
21
+ if (goArch === "arm") goArch = "arm64";
22
+
23
+ const archiveName = `${binaryName}_${version}_${goOs}_${goArch}.tar.gz`;
24
+ const url = `https://github.com/${repo}/releases/download/v${version}/${archiveName}`;
25
+
26
+ const binDir = path.join(__dirname, "bin");
27
+ fs.mkdirSync(binDir, { recursive: true });
28
+
29
+ const targetBinary = platform === "win32" ? `${binaryName}.exe` : binaryName;
30
+ const targetPath = path.join(binDir, targetBinary);
31
+
32
+ console.log(`Downloading ${binaryName} ${version} for ${goOs}-${goArch}...`);
33
+
34
+ // Download with redirect support
35
+ const response = await new Promise((resolve, reject) => {
36
+ https
37
+ .get(url, (res) => {
38
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
39
+ return https.get(res.headers.location, resolve).on("error", reject);
40
+ }
41
+ resolve(res);
42
+ })
43
+ .on("error", reject);
44
+ });
45
+
46
+ if (response.statusCode !== 200) {
47
+ throw new Error(`Download failed with status ${response.statusCode}\nURL: ${url}`);
48
+ }
49
+
50
+ await pipeline(
51
+ response,
52
+ zlib.createGunzip(),
53
+ tar.extract({
54
+ cwd: binDir,
55
+ filter: (header) => path.basename(header) === targetBinary,
56
+ strip: 0,
57
+ }),
58
+ );
59
+
60
+ if (platform !== "win32") {
61
+ fs.chmodSync(targetPath, "755");
62
+ }
63
+
64
+ console.log(`${binaryName} ${version} installed successfully!`);
65
+ }
66
+
67
+ main()
68
+ .then(() => process.exit(0))
69
+ .catch((err) => {
70
+ console.error("❌ Failed to install project-context:", err.message);
71
+ console.error(
72
+ ` → Make sure you have released v${version} on GitHub with the .tar.gz files`,
73
+ );
74
+ process.exit(1);
75
+ });
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@pixeljuggle/project-context",
3
+ "version": "0.0.11",
4
+ "description": "Zero-dependency CLI that generates a perfect project-context.md for LLMs, code reviews, or documentation.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/pixeljuggle/project-context.git"
8
+ },
9
+ "license": "MIT",
10
+ "author": "alex",
11
+ "bin": {
12
+ "project-context": "bin/project-context.js"
13
+ },
14
+ "scripts": {
15
+ "postinstall": "node install.js"
16
+ },
17
+ "dependencies": {
18
+ "tar": "^7.5.15"
19
+ },
20
+ "files": [
21
+ "install.js",
22
+ "bin/project-context.js"
23
+ ],
24
+ "engines": {
25
+ "node": ">=18"
26
+ }
27
+ }