@patcherly/nodejs-connector 2.2.8 → 2.2.10

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/node_agent.js +22 -9
  2. package/package.json +1 -1
package/node_agent.js CHANGED
@@ -193,7 +193,7 @@ const { DEFAULT_API_URL, getConfiguredServerUrl, isExplicitApiBaseConfigured } =
193
193
  * update-release-latest.yml workflow so the value baked into every released tarball matches
194
194
  * the GitHub release tag. Reported to the API on every context upload.
195
195
  */
196
- const PATCHERLY_CONNECTOR_VERSION = '2.2.8';
196
+ const PATCHERLY_CONNECTOR_VERSION = '2.2.10';
197
197
  let CENTRAL_SERVER_URL = getConfiguredServerUrl();
198
198
  const IDS_PATH = process.env.PATCHERLY_IDS_PATH || path.join(__dirname, 'patcherly_ids.json');
199
199
  const QUEUE_PATH = process.env.PATCHERLY_QUEUE_PATH || path.join(__dirname, 'patcherly_queue.jsonl');
@@ -806,15 +806,26 @@ function isPathExcluded(filePath) {
806
806
  }
807
807
 
808
808
  function extractFilePath(errorContext) {
809
- // Extract file path from error context/traceback
809
+ // Extract file path from error context/traceback. Mirrors the server-side
810
+ // extract_source_file_path() so path exclusion (incl. exclude_paths) applies
811
+ // uniformly across languages, not just Python.
810
812
  if (!errorContext) return null;
811
-
812
- // Try to extract from traceback (common format: "File \"/path/to/file.py\", line 123")
813
- const match = errorContext.match(/File\s+["']([^"']+)["']/);
814
- if (match) {
815
- return match[1];
816
- }
817
-
813
+
814
+ // Python-style traceback: File "/path/to/file.py", line 123
815
+ let match = errorContext.match(/File\s+["']([^"']+)["']/);
816
+ if (match) return match[1];
817
+ // Node stack frame: at fn (/abs/path/file.js:12:34) | at /abs/path/file.js:12:34
818
+ match = errorContext.match(/\((?:file:\/\/)?((?:\/|[A-Za-z]:[\\/])[^\s()]+?\.\w+):\d+(?::\d+)?\)/);
819
+ if (match) return match[1];
820
+ match = errorContext.match(/\bat\s+(?:file:\/\/)?((?:\/|[A-Za-z]:[\\/])[^\s()]+?\.\w+):\d+(?::\d+)?/);
821
+ if (match) return match[1];
822
+ // PHP fatal / warning: ... in /abs/path/file.php:233 | ... on line 233
823
+ match = errorContext.match(/\bin\s+((?:\/|[A-Za-z]:[\\/])[^\s:]+?\.\w+)(?::\d+|\s+on line\s+\d+)/i);
824
+ if (match) return match[1];
825
+ // Numbered stack frame: #0 /abs/path/file.php(6454):
826
+ match = errorContext.match(/#\d+\s+((?:\/|[A-Za-z]:[\\/])[^\s(]+?\.\w+)\(\d+\)/);
827
+ if (match) return match[1];
828
+
818
829
  return null;
819
830
  }
820
831
 
@@ -2041,4 +2052,6 @@ module.exports = {
2041
2052
  /** Exposed so connector log-path tests can lock the v1.47 / v2.0.0 validator contract. */
2042
2053
  validateLogPath,
2043
2054
  isSiteRootBasename,
2055
+ /** Exposed so extract_file_path.test.js can lock multi-language path extraction for exclude_paths. */
2056
+ extractFilePath,
2044
2057
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patcherly/nodejs-connector",
3
- "version": "2.2.8",
3
+ "version": "2.2.10",
4
4
  "description": "Patcherly detects bugs in real time in your app. It creates a customized AI patch, and once you approve it, backs up your code, fixes it & tests the patch for you. If anything is off, it rolls back the changes automatically, or you can always roll it back in a click. Website: https://patcherly.com · Docs: https://help.patcherly.com/connectors/nodejs/",
5
5
  "license": "MIT",
6
6
  "homepage": "https://patcherly.com",