@pixeljuggle/project-context 0.0.13 → 0.1.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.
Files changed (2) hide show
  1. package/install.js +30 -5
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -7,12 +7,38 @@ const zlib = require("node:zlib");
7
7
  const tar = require("tar");
8
8
  const { pipeline } = require("node:stream/promises");
9
9
 
10
- const pkg = require("./package.json");
11
- const version = pkg.version;
12
10
  const binaryName = "project-context";
13
11
  const repo = "pixeljuggle/project-context";
14
12
 
13
+ async function getLatestVersion() {
14
+ return new Promise((resolve, reject) => {
15
+ const options = {
16
+ headers: { "User-Agent": "project-context-npm-install" },
17
+ };
18
+ https
19
+ .get(
20
+ "https://api.github.com/repos/pixeljuggle/project-context/releases/latest",
21
+ options,
22
+ (res) => {
23
+ let data = "";
24
+ res.on("data", (chunk) => (data += chunk));
25
+ res.on("end", () => {
26
+ try {
27
+ const release = JSON.parse(data);
28
+ const version = release.tag_name.replace(/^v/, "");
29
+ resolve(version);
30
+ } catch (_e) {
31
+ reject(new Error("Failed to parse latest release from GitHub"));
32
+ }
33
+ });
34
+ },
35
+ )
36
+ .on("error", reject);
37
+ });
38
+ }
39
+
15
40
  async function main() {
41
+ const version = await getLatestVersion();
16
42
  const platform = process.platform;
17
43
  const arch = process.arch;
18
44
 
@@ -20,8 +46,7 @@ async function main() {
20
46
  let goArch = arch === "x64" ? "amd64" : arch;
21
47
  if (goArch === "arm") goArch = "arm64";
22
48
 
23
- // THIS WAS THE BUG: now matches your actual release filenames (hyphen)
24
- const archiveName = `${binaryName}_${version}_${goOs}-${goArch}.tar.gz`;
49
+ const archiveName = `${binaryName}_${version}_${goOs}_${goArch}.tar.gz`;
25
50
  const url = `https://github.com/${repo}/releases/download/v${version}/${archiveName}`;
26
51
 
27
52
  const binDir = path.join(__dirname, "bin");
@@ -30,7 +55,7 @@ async function main() {
30
55
  const targetBinary = platform === "win32" ? `${binaryName}.exe` : binaryName;
31
56
  const targetPath = path.join(binDir, targetBinary);
32
57
 
33
- console.log(`📥 Downloading ${binaryName} ${version} for ${goOs}-${goArch}...`);
58
+ console.log(`Downloading ${binaryName} ${version} for ${goOs}_${goArch}...`);
34
59
 
35
60
  const response = await new Promise((resolve, reject) => {
36
61
  https
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixeljuggle/project-context",
3
- "version": "0.0.13",
3
+ "version": "0.1.1",
4
4
  "description": "Zero-dependency CLI that generates a perfect project-context.md for LLMs, code reviews, or documentation.",
5
5
  "repository": {
6
6
  "type": "git",