wakatime / wakatime-cli

Command line interface used by all WakaTime text editor plugins
https://wakatime.com/plugins
BSD 3-Clause "New" or "Revised" License
292 stars 41 forks source link

Re-creating .wakatime-project #1103

Closed berkus closed 2 weeks ago

berkus commented 1 month ago

Hi, I am a bit confused and need some discussion to understand if the problem is with wakatime or with my setup:

Now, my project is at work, so it uses all the hide_xxx options in wakatime config, and also a pre-existing committed .wakatime-project file. BUT, every time I do editing, this file is recreated with a new unique name, I do not yet know the frequency of this change, but I can see there are A LOT of random projects reported in the UI, each with approximately 10 minutes of time logged, so I suppose this re-creation happens at about 10 minute interval.

I want to understand why it is happening and how to prevent this? Any ideas are welcome, I will test them out.

alanhamlett commented 1 month ago

The hide_project_names creates that file if it doesn't exist, but it should only create it once. One of these is happening:

  1. something is deleting the .wakatime-project file causing wakatime-cli to re-create it
  2. a bug in wakatime-cli is re-creating .wakatime-project because it thinks it doesn't exist

What version of wakatime-cli are you using? Run this to find out:

~/.wakatime/wakatime-cli --version

My guess is there's a bug in wakatime-cli where it fails reading the project file and then re-creates it.

alanhamlett commented 1 month ago

Also, are there any errors in your ~/.wakatime/wakatime.log file? Could you paste the contents here, or if it's too large email to support@wakatime.com?

alanhamlett commented 1 month ago

Let's see if #1104 fixes it. That prevents ever re-creating an already existing .wakatime-project file.

After that's merged, run rm ~/.wakatime/wakatime-cli* then restart Zed to get the new wakatime-cli version. Then if you start seeing Unknown Project on your dashboard instead of random projects it means the fix worked, but wakatime-cli is having trouble reading your .wakatime-project file for some reason.

berkus commented 1 month ago

@alanhamlett thanks for prompt response!

~/.wakatime/wakatime-cli --version fish: Unknown command

~/.wakatime/wakatime.log

{"caller":"cmd/run.go:156","func":"cmd.RunE","level":"warning","message":"one of the following parameters has to be provided: --config-read, --config-write, --entity, --file-experts, --offline-count, --print-offline-heartbeats, --sync-offline-activity, --today, --today-goal, --user-agent, --version","now":"2024-08-05T19:52:32+03:00","os/arch":"darwin/arm64","version":"v1.98.3"}
{"caller":"pkg/api/api.go:103","file":"/Users/berkus/**FILENAME REDACTED**","func":"api.isLocalIPv6","is_write":true,"level":"warning","message":"failed dialing to detect default local ip address: dial udp 143.244.210.202:80: connect: network is unreachable","now":"2024-09-09T15:55:30+03:00","os/arch":"darwin/arm64","plugin":"Zed/0.151.2 Zed-wakatime/0.1.2","time":1725886530,"version":"v1.98.3"}

nothing else in there.

alanhamlett commented 1 month ago

Where's your wakatime-cli located? Maybe the Zed extension puts it inside the LSP extension's folder?

I think you need to re-install the zed extension to get the updated wakatime-cli.

bestgopher commented 1 month ago

@alanhamlett thanks for prompt response!

~/.wakatime/wakatime-cli --version fish: Unknown command

~/.wakatime/wakatime.log

{"caller":"cmd/run.go:156","func":"cmd.RunE","level":"warning","message":"one of the following parameters has to be provided: --config-read, --config-write, --entity, --file-experts, --offline-count, --print-offline-heartbeats, --sync-offline-activity, --today, --today-goal, --user-agent, --version","now":"2024-08-05T19:52:32+03:00","os/arch":"darwin/arm64","version":"v1.98.3"}
{"caller":"pkg/api/api.go:103","file":"/Users/berkus/**FILENAME REDACTED**","func":"api.isLocalIPv6","is_write":true,"level":"warning","message":"failed dialing to detect default local ip address: dial udp 143.244.210.202:80: connect: network is unreachable","now":"2024-09-09T15:55:30+03:00","os/arch":"darwin/arm64","plugin":"Zed/0.151.2 Zed-wakatime/0.1.2","time":1725886530,"version":"v1.98.3"}

nothing else in there.

~/Library/Application Support/Zed/extensions/work/wakatime/

berkus commented 1 month ago

~/Library/Application Support/Zed/extensions/work/wakatime/

ls: ~/Library/Application Support/Zed/extensions/work/wakatime/: No such file or directory

bestgopher commented 1 month ago

~/Library/Application Support/Zed/extensions/work/wakatime/

ls: ~/Library/Application Support/Zed/extensions/work/wakatime/: No such file or directory

If you don't see it, try reinstalling and check again. image

berkus commented 2 weeks ago

Hmm, I have not seen this for a while. Must have been some botched installation or something. After reinstalling the plugin it's all clean for a while!