claude-code-wakatime 3.1.3 → 3.1.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.
package/dist/index.js CHANGED
@@ -40905,9 +40905,15 @@ async function getEntityFiles(inp) {
40905
40905
  if (timestamp2 < lastHeartbeatAt) continue;
40906
40906
  const filePath = log.toolUseResult?.filePath;
40907
40907
  if (!filePath) continue;
40908
- const patches = log.toolUseResult?.structuredPatch;
40909
- if (!patches) continue;
40910
- const lineChanges = patches.map((patch) => patch.newLines - patch.oldLines).reduce((p, c) => p + c, 0);
40908
+ const patches = log.toolUseResult?.structuredPatch ?? [];
40909
+ let lineChanges;
40910
+ if (patches.length > 0) {
40911
+ lineChanges = patches.map((patch) => patch.newLines - patch.oldLines).reduce((p, c) => p + c, 0);
40912
+ } else if (log.toolUseResult?.content && !log.toolUseResult?.originalFile) {
40913
+ lineChanges = log.toolUseResult.content.split("\n").length;
40914
+ } else {
40915
+ continue;
40916
+ }
40911
40917
  const prevLineChanges = (entities.get(filePath) ?? { lineChanges: 0 }).lineChanges;
40912
40918
  entities.set(filePath, { lineChanges: prevLineChanges + lineChanges, type: "file" });
40913
40919
  } catch (err) {
@@ -41134,7 +41140,7 @@ var Options = class {
41134
41140
  };
41135
41141
 
41136
41142
  // src/version.ts
41137
- var VERSION = "3.1.3";
41143
+ var VERSION = "3.1.4";
41138
41144
 
41139
41145
  // src/dependencies.ts
41140
41146
  var import_adm_zip = __toESM(require_adm_zip());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-wakatime",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "description": "WakaTime plugin for Claude Code",
5
5
  "bin": {
6
6
  "claude-code-wakatime": "dist/index.js"
package/scripts/run CHANGED
@@ -3,6 +3,11 @@ set -eu
3
3
 
4
4
  ROOT="${CLAUDE_PLUGIN_ROOT:-$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)}"
5
5
 
6
+ # Avoid project-specific NODE_OPTIONS breaking plugin hooks.
7
+ if [ -n "${NODE_OPTIONS:-}" ]; then
8
+ unset NODE_OPTIONS
9
+ fi
10
+
6
11
  # If user provides an explicit node path, use it
7
12
  if [ -n "${NODE_BIN:-}" ] && [ -x "${NODE_BIN}" ]; then
8
13
  exec "${NODE_BIN}" "$ROOT/dist/index.js" "$@"
package/src/types.ts CHANGED
@@ -46,6 +46,7 @@ export type TranscriptLog = {
46
46
  filePath?: string;
47
47
  oldString?: string;
48
48
  newString?: string;
49
+ content?: string;
49
50
  originalFile?: string;
50
51
  structuredPatch?: [
51
52
  {
package/src/utils.ts CHANGED
@@ -70,10 +70,16 @@ export async function getEntityFiles(inp: Input | undefined): Promise<{ entities
70
70
  const filePath = log.toolUseResult?.filePath;
71
71
  if (!filePath) continue;
72
72
 
73
- const patches = log.toolUseResult?.structuredPatch;
74
- if (!patches) continue;
75
-
76
- const lineChanges = patches.map((patch) => patch.newLines - patch.oldLines).reduce((p, c) => p + c, 0);
73
+ const patches = log.toolUseResult?.structuredPatch ?? [];
74
+
75
+ let lineChanges: number;
76
+ if (patches.length > 0) {
77
+ lineChanges = patches.map((patch) => patch.newLines - patch.oldLines).reduce((p, c) => p + c, 0);
78
+ } else if (log.toolUseResult?.content && !log.toolUseResult?.originalFile) {
79
+ lineChanges = log.toolUseResult.content.split('\n').length;
80
+ } else {
81
+ continue;
82
+ }
77
83
 
78
84
  const prevLineChanges = (entities.get(filePath) ?? ({ lineChanges: 0 } as Entity)).lineChanges;
79
85
  entities.set(filePath, { lineChanges: prevLineChanges + lineChanges, type: 'file' });