@sdsrs/code-graph 0.93.1 → 0.95.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.
Files changed (30) hide show
  1. package/claude-plugin/.claude-plugin/plugin.json +1 -1
  2. package/claude-plugin/scripts/auto-update.js +69 -9
  3. package/package.json +8 -7
  4. package/claude-plugin/scripts/adopt.test.js +0 -679
  5. package/claude-plugin/scripts/auto-update.test.js +0 -474
  6. package/claude-plugin/scripts/cg-answer.test.js +0 -309
  7. package/claude-plugin/scripts/claude-config.test.js +0 -58
  8. package/claude-plugin/scripts/covering-tests.test.js +0 -78
  9. package/claude-plugin/scripts/doctor.test.js +0 -215
  10. package/claude-plugin/scripts/find-binary.test.js +0 -246
  11. package/claude-plugin/scripts/hook-fire.test.js +0 -117
  12. package/claude-plugin/scripts/hooks.test.js +0 -230
  13. package/claude-plugin/scripts/incremental-index.test.js +0 -102
  14. package/claude-plugin/scripts/lifecycle.e2e.test.js +0 -179
  15. package/claude-plugin/scripts/lifecycle.test.js +0 -786
  16. package/claude-plugin/scripts/mcp-launcher.test.js +0 -162
  17. package/claude-plugin/scripts/mcp-stub.test.js +0 -207
  18. package/claude-plugin/scripts/post-grep-inject.test.js +0 -531
  19. package/claude-plugin/scripts/pr-impact-comment.test.js +0 -110
  20. package/claude-plugin/scripts/pre-edit-guide.test.js +0 -218
  21. package/claude-plugin/scripts/pre-grep-guide.test.js +0 -1682
  22. package/claude-plugin/scripts/pre-read-guide.test.js +0 -363
  23. package/claude-plugin/scripts/project-detect.test.js +0 -95
  24. package/claude-plugin/scripts/recommendation-log.test.js +0 -79
  25. package/claude-plugin/scripts/session-init.test.js +0 -479
  26. package/claude-plugin/scripts/statusline-composite.test.js +0 -65
  27. package/claude-plugin/scripts/statusline.test.js +0 -235
  28. package/claude-plugin/scripts/tmp-dir.test.js +0 -50
  29. package/claude-plugin/scripts/user-prompt-context.test.js +0 -743
  30. package/claude-plugin/scripts/version-utils.test.js +0 -141
@@ -4,7 +4,7 @@
4
4
  "author": {
5
5
  "name": "sdsrs"
6
6
  },
7
- "version": "0.93.1",
7
+ "version": "0.95.0",
8
8
  "keywords": [
9
9
  "code-graph",
10
10
  "ast",
@@ -3,6 +3,7 @@
3
3
  const { execFileSync } = require('child_process');
4
4
  const fs = require('fs');
5
5
  const https = require('https');
6
+ const http = require('http');
6
7
  const crypto = require('crypto');
7
8
  const path = require('path');
8
9
  const os = require('os');
@@ -123,15 +124,34 @@ function compareVersions(a, b) {
123
124
 
124
125
  // ── GitHub API ─────────────────────────────────────────────
125
126
 
127
+ /**
128
+ * Resolve the proxy URL to use for a target URL, honoring HTTPS_PROXY/HTTP_PROXY
129
+ * (and lowercase variants) plus NO_PROXY. Returns null when no proxy applies, so
130
+ * the direct path stays byte-identical for users without a proxy configured.
131
+ * @param {string} targetUrl
132
+ * @param {NodeJS.ProcessEnv} [env]
133
+ * @returns {string|null}
134
+ */
135
+ function resolveProxy(targetUrl, env = process.env) {
136
+ let host;
137
+ try { host = new URL(targetUrl).hostname.toLowerCase(); } catch { return null; }
138
+ const noProxy = (env.NO_PROXY || env.no_proxy || '').trim();
139
+ if (noProxy === '*') return null;
140
+ for (const raw of noProxy.split(',').map(s => s.trim().toLowerCase()).filter(Boolean)) {
141
+ const bare = raw.replace(/^\*?\./, ''); // ".github.com" / "*.github.com" → "github.com"
142
+ if (host === bare || host.endsWith('.' + bare)) return null;
143
+ }
144
+ const proxy = env.HTTPS_PROXY || env.https_proxy || env.HTTP_PROXY || env.http_proxy;
145
+ return proxy && proxy.trim() ? proxy.trim() : null;
146
+ }
147
+
126
148
  function requestJson(url, timeoutMs = FETCH_TIMEOUT_MS) {
127
149
  return new Promise((resolve, reject) => {
128
- const req = https.request(url, {
129
- method: 'GET',
130
- headers: {
131
- 'Accept': 'application/vnd.github+json',
132
- 'User-Agent': 'code-graph-auto-update/1.0',
133
- },
134
- }, (res) => {
150
+ const headers = {
151
+ 'Accept': 'application/vnd.github+json',
152
+ 'User-Agent': 'code-graph-auto-update/1.0',
153
+ };
154
+ const onResponse = (res) => {
135
155
  let body = '';
136
156
  res.setEncoding('utf8');
137
157
  res.on('data', (chunk) => { body += chunk; });
@@ -142,8 +162,48 @@ function requestJson(url, timeoutMs = FETCH_TIMEOUT_MS) {
142
162
  }
143
163
  resolve({ statusCode: res.statusCode, body });
144
164
  });
145
- });
165
+ };
166
+
167
+ const proxy = resolveProxy(url);
168
+ if (proxy) {
169
+ // Node's https module ignores *_PROXY env vars. curl-based binary downloads
170
+ // already honor the proxy; tunnel the release-metadata GET over an HTTP
171
+ // CONNECT to reach parity for users behind a corporate proxy.
172
+ let pu, target;
173
+ try { pu = new URL(proxy); target = new URL(url); }
174
+ catch { reject(new Error('invalid proxy or target URL')); return; }
175
+ const connectHeaders = {};
176
+ if (pu.username) {
177
+ const cred = `${decodeURIComponent(pu.username)}:${decodeURIComponent(pu.password)}`;
178
+ connectHeaders['Proxy-Authorization'] = 'Basic ' + Buffer.from(cred).toString('base64');
179
+ }
180
+ const connectReq = http.request({
181
+ host: pu.hostname,
182
+ port: pu.port || 80,
183
+ method: 'CONNECT',
184
+ path: `${target.hostname}:${target.port || 443}`,
185
+ headers: connectHeaders,
186
+ });
187
+ connectReq.on('connect', (res, socket) => {
188
+ if (res.statusCode !== 200) {
189
+ socket.destroy();
190
+ reject(new Error(`proxy CONNECT failed: ${res.statusCode}`));
191
+ return;
192
+ }
193
+ const req = https.request(url, {
194
+ method: 'GET', headers, socket, agent: false, servername: target.hostname,
195
+ }, onResponse);
196
+ req.setTimeout(timeoutMs, () => req.destroy(new Error('request timeout')));
197
+ req.on('error', reject);
198
+ req.end();
199
+ });
200
+ connectReq.setTimeout(timeoutMs, () => connectReq.destroy(new Error('proxy connect timeout')));
201
+ connectReq.on('error', reject);
202
+ connectReq.end();
203
+ return;
204
+ }
146
205
 
206
+ const req = https.request(url, { method: 'GET', headers }, onResponse);
147
207
  req.setTimeout(timeoutMs, () => req.destroy(new Error('request timeout')));
148
208
  req.on('error', reject);
149
209
  req.end();
@@ -594,7 +654,7 @@ module.exports = {
594
654
  checkForUpdate, commandExists, isDevMode, readState, compareVersions, shouldCheck,
595
655
  getExtractedPluginVersion, readBinaryVersion, promoteVerifiedBinary,
596
656
  isSilentMode, isInstallMissingMode, isForceMode,
597
- requestJson, parseLatestRelease, fetchLatestRelease,
657
+ requestJson, resolveProxy, parseLatestRelease, fetchLatestRelease,
598
658
  downloadBinary, cachedBinaryPath, cachedBinaryNeedsUpdate, cachedBinaryStaleVsState,
599
659
  selfHealStaleBinary,
600
660
  downloadAndInstall, refreshMarketplaceClone, marketplaceCloneDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdsrs/code-graph",
3
- "version": "0.93.1",
3
+ "version": "0.95.0",
4
4
  "description": "MCP server that indexes codebases into an AST knowledge graph with semantic search, call graph traversal, and HTTP route tracing",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -24,7 +24,8 @@
24
24
  "files": [
25
25
  "bin/cli.js",
26
26
  "README.md",
27
- "claude-plugin"
27
+ "claude-plugin",
28
+ "!claude-plugin/**/*.test.js"
28
29
  ],
29
30
  "scripts": {
30
31
  "build": "cargo build --release --no-default-features && node scripts/copy-binary.js",
@@ -35,10 +36,10 @@
35
36
  "node": ">=16"
36
37
  },
37
38
  "optionalDependencies": {
38
- "@sdsrs/code-graph-linux-x64": "0.93.1",
39
- "@sdsrs/code-graph-linux-arm64": "0.93.1",
40
- "@sdsrs/code-graph-darwin-x64": "0.93.1",
41
- "@sdsrs/code-graph-darwin-arm64": "0.93.1",
42
- "@sdsrs/code-graph-win32-x64": "0.93.1"
39
+ "@sdsrs/code-graph-linux-x64": "0.95.0",
40
+ "@sdsrs/code-graph-linux-arm64": "0.95.0",
41
+ "@sdsrs/code-graph-darwin-x64": "0.95.0",
42
+ "@sdsrs/code-graph-darwin-arm64": "0.95.0",
43
+ "@sdsrs/code-graph-win32-x64": "0.95.0"
43
44
  }
44
45
  }