vrchat-community / creator-companion

The Entry Point for Making Things in VRChat
https://vrchat.com/home/download
63 stars 442 forks source link

[FEATURE] Create file with '<id>.json' instead of `<uuid>.json` #257

Open anatawa12 opened 1 year ago

anatawa12 commented 1 year ago

Is your feature request related to a problem? Please describe. When we see VRChatCreatorCompanion/Repos folder, there're many <uuid>.json in that folder. That's not good for understanding which json is for which repo.

Describe the solution you'd like I want VCC to create file with repo id at the time we installed the repository if it's good name for file name.

Describe alternatives you've considered Use <url>.json but url will have slashes so it's not good for file name.

Additional context Add any other context or screenshots about the feature request here.

In my own vpm client, this is implemented. In my client, if the id matches the regex [0-9a-zA-Z._-]+, try to create <id>.json and if it's not possible (e.g. already exists), fallback to <uuid>.json. As far as I know, wide range of vpm-resolver supports non uuid json name in settings.json.

orels1 commented 2 months ago

We're planning to implement this in one of the upcoming releases. The files will use the following format:

We decided to go with the id + guid chunk approach because some listings (e.g. vrlabs generated listings) use the same id with different URLs. Which is not fully supported by VCC, but can work, and this means that duplicate ids won't collide while keeping the readability.

orels1 commented 2 months ago

There will be an open beta for this change to ensure anything that interacts with these files - can update.

orels1 commented 1 month ago

This will be targeting version 2.4.0.

anatawa12 commented 1 month ago

Will it be migrated for existing repos? (I think it's not necessary)

orels1 commented 3 weeks ago

@anatawa12 yes, it will auto migrate existing jsons when they're used (old ones will simply get deleted and the new ones will get created on first save). So you dont have a bunch of old stuff sticking around for no reason.

There will also be an open beta for both CLI and VCC to make sure this goes smoothly.

orels1 commented 3 weeks ago

This is available in the VCC 2.4.0-beta.1 as well as the new CLI

VCC: https://github.com/vrchat-community/creator-companion/releases/tag/2.4.0-beta.1 CLI: dotnet tool install -g VRChat.VPM.CLI --version 0.1.28-beta.1

anatawa12 commented 3 weeks ago

It looks migration feature is broken.

it looks Path in settings.json is not updated and old file is not removed.

image

Steps to reproduce (A)

  1. launch VCC Beta Portable
  2. click "Copy Live Settings and Data"
  3. Open Manage Package page of some project to let VCC to load repository
  4. You can see <uuid>.json in settings.json and three of <id>-<random>.json in Repos directory.

Steps to reproduce (B)

  1. Manually copy VCC directory to VCCUserDataPortable directory with keeping local cached repository in Repos directory
  2. open VCC Beta Portable
  3. Open Manage Package page of some project to let VCC to load repository
  4. You can see both original repository cache file (I use ALCOM so some of cache are <id>.json and the others have <uuid>.json) and three of <id>-<random>.json in Repos directory.

Also, there are one problem with checking new behavior.

It looks "Copy Live Settings and Data" does not copy Repos direcotry. This prevent us from checking migrating .json file name. I copied %LOCALAPPDATA%\VRChatCreatorCompanion to VCCUserDataPortable and modified settings.json manually to workaround this problem.

UPDATE

I found that with CLI version of VCC, it looks path in settings.json is successfully migrated and original file looks removed.

orels1 commented 3 weeks ago

Thanks for checking. Manually copying files and updating setting.json is how this was tested, since as you mentioned - the "Copy Live Settings and Data" doesn't copy the cache.

VCC currently looks specifically for the old UUID pattern, so any other pattern will not be migrated (this is on purpose, since people can technically add repos from any local json files via CLI).

Unfortunately I am unable to reproduce neither of your scenarios on 2 different machines (they do not produce <uuid>.json files for me).

I also did what we did initially to test the migration (which is what you pointed out as well), copied all the contents of VRChatCreatorCompanion from AppData and into VCCUserDataPortable and then updated paths in settings.json and launched the 2.4.0 beta VCC. And it worked correctly as well.

Could you provide some more details? Which particular repositories do not get updated? Do they have a proper ID field?

Here are some steps for reference, maybe you can point to where am I testing differently to what you're doing.

LIVE VCC Repos Folder

image

BETA VCC Repos Folder before launching (exact copy of LIVE)

image

BETA VCC Settings file after changing paths to point to portable install

image

BETA VCC Repos Folder after launching and going to any Manage Project page or to Settings -> Packages

image

BETA VCC Settings file afterwards

image

Testing was done on 2 Windows 11 machines on 22H2 and 23H2 updates

anatawa12 commented 3 weeks ago

VCC currently looks specifically for the old UUID pattern, so any other pattern will not be migrated (this is on purpose, since people can technically add repos from any local json files via CLI).

I think that's fine, but UUID pattern files still not migrated in my environment.

Could you provide some more details?

First of all, this is the video shows How I did tested the behavior and log file for the launch. Is there anything bad I did?

20241013T145816-1b6a778aa9ff4dab84d64f39d7c67103-log.txt

https://github.com/user-attachments/assets/2fa4dac9-f6d9-4609-a6ef-63f743cfdd67

Which particular repositories do not get updated?

All repositories with <uuid>.json are not get updated.

In addition,Three of <id>-<8 hex random>.json will be generated for both repositories with <uuid>.json (generated with older VCC or older vrc-get) or <id>.json (generated with newer vrc-get).

Do they have a proper ID field?

Yes, at least for two of <uuid>.json

image

orels1 commented 1 week ago

@anatawa12 sorry just got to your video In your footage you missed one more \\Repos image As you can see your path before the <guid>.json ends in ...\\VCCUserDataPortable, while it should be ...\\VCCUserDataPortable\\Repos

Like you can see in my picture

image

orels1 commented 1 week ago

There seems to be some logic missing for updating the path if the cache file is non existent (or just points to the wrong place like in the cause you shown), but that's a bit of a different issue. I'll add handling for that in the meantime though.

anatawa12 commented 1 week ago

Oh sorry. That's my mistake and with fixed path it looks no problems with migration process

orels1 commented 1 week ago

Thank you for confirming!

orels1 commented 1 week ago

The issue with setting.json entries not being updated with the new paths if the paths were incorrect will also be fixed in 2.4.0 public release