code-context-graph 0.5.3 → 0.5.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.
Files changed (3) hide show
  1. package/bin/ccg.js +28 -0
  2. package/install.js +3 -3
  3. package/package.json +2 -2
package/bin/ccg.js ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require("child_process");
4
+ const path = require("path");
5
+ const fs = require("fs");
6
+
7
+ const isWindows = process.platform === "win32";
8
+ const binName = isWindows ? "ccg-binary.exe" : "ccg-binary";
9
+ const binPath = path.join(__dirname, binName);
10
+
11
+ if (!fs.existsSync(binPath)) {
12
+ console.error("Error: ccg binary not found. Please try re-installing the package.");
13
+ process.exit(1);
14
+ }
15
+
16
+ const child = spawn(binPath, process.argv.slice(2), {
17
+ stdio: "inherit",
18
+ shell: false,
19
+ });
20
+
21
+ child.on("error", (err) => {
22
+ console.error(`Failed to start ccg binary: ${err.message}`);
23
+ process.exit(1);
24
+ });
25
+
26
+ child.on("exit", (code) => {
27
+ process.exit(code || 0);
28
+ });
package/install.js CHANGED
@@ -69,11 +69,11 @@ async function install() {
69
69
  const url = getDownloadUrl(binaryName);
70
70
  const binDir = path.join(__dirname, "bin");
71
71
  const isWindows = process.platform === "win32";
72
- const binPath = path.join(binDir, isWindows ? "ccg.exe" : "ccg");
72
+ const binPath = path.join(binDir, isWindows ? "ccg-binary.exe" : "ccg-binary");
73
73
 
74
74
  // Skip if binary already exists
75
75
  if (fs.existsSync(binPath)) {
76
- console.log(`ccg already installed at ${binPath}`);
76
+ console.log(`ccg binary already installed at ${binPath}`);
77
77
  return;
78
78
  }
79
79
 
@@ -105,7 +105,7 @@ async function install() {
105
105
  execSync(`tar xzf "${tarPath}" -C "${binDir}"`, { stdio: "ignore" });
106
106
  fs.unlinkSync(tarPath);
107
107
 
108
- // Rename platform-specific binary to 'ccg' (e.g., ccg-darwin-arm64 -> ccg)
108
+ // Rename platform-specific binary to 'ccg-binary'
109
109
  const extracted = path.join(binDir, binaryName);
110
110
  if (fs.existsSync(extracted) && extracted !== binPath) {
111
111
  fs.renameSync(extracted, binPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-context-graph",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "Local code analysis tool — parse codebases into knowledge graphs with 15 language support, annotation search, and Cypher queries",
5
5
  "keywords": [
6
6
  "code-analysis",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "license": "MIT",
19
19
  "bin": {
20
- "ccg": "bin/ccg"
20
+ "ccg": "bin/ccg.js"
21
21
  },
22
22
  "scripts": {
23
23
  "postinstall": "node install.js"