com.elestrago.unity.package-tools 2.2.1 → 2.2.3

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/CAHNGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  ---
4
4
 
5
+ ## [2.2.3](https://gitlab.com/elestrago-pkg/package-tool/-/tags/2.2.3)
6
+
7
+ ### Fixed
8
+
9
+ - Fixed `unity-package-docs` scanner missing namespaces and types in C# files that start with a UTF-8 BOM.
10
+
11
+ ---
12
+
13
+ ## [2.2.2](https://gitlab.com/elestrago-pkg/package-tool/-/tags/2.2.2)
14
+
15
+ ### Changed
16
+
17
+ - Simplified the `Claude Skills` post-import hook to rely on self-deletion for deduplication, removing the `SessionState` guards so a re-import within the same Unity session runs again instead of being silently skipped.
18
+
19
+ ---
20
+
5
21
  ## [2.2.1](https://gitlab.com/elestrago-pkg/package-tool/-/tags/2.2.1)
6
22
 
7
23
  ### Added
@@ -7,10 +7,12 @@ using UnityEngine;
7
7
  namespace PackageTool.Samples.ClaudeSkills
8
8
  {
9
9
  /// <summary>
10
- /// Runs once after the "Claude Skills" sample is imported into a consumer project. Walks every
11
- /// skill subfolder next to this script, copies it to <c>&lt;project&gt;/.claude/skills/&lt;name&gt;</c>,
12
- /// prompting before overwriting an existing skill, and then deletes the imported sample folder so
13
- /// the operation does not repeat on subsequent domain reloads.
10
+ /// Runs after the "Claude Skills" sample is imported into a consumer project. Walks every skill
11
+ /// subfolder next to this script, copies it to <c>&lt;project&gt;/.claude/skills/&lt;name&gt;</c>,
12
+ /// prompting before overwriting an existing skill, then deletes the imported sample folder
13
+ /// (including this script itself). Self-deletion is the only dedup mechanism: once gone the type
14
+ /// can't trigger again until the consumer re-imports the sample, which is exactly when a fresh
15
+ /// run is wanted.
14
16
  /// </summary>
15
17
  [InitializeOnLoad]
16
18
  internal static class ClaudeSkillsPostImport
@@ -20,8 +22,6 @@ namespace PackageTool.Samples.ClaudeSkills
20
22
  private const string EDITOR_FOLDER_NAME = "Editor";
21
23
  private const string SCRIPT_FILE_NAME = "ClaudeSkillsPostImport.cs";
22
24
  private const string DIALOG_TITLE = "Claude Skills";
23
- private const string SESSION_GUARD_KEY_PREFIX = "PackageTool.ClaudeSkillsPostImport.Processed:";
24
- private const string SESSION_RUNNING_KEY = "PackageTool.ClaudeSkillsPostImport.Running";
25
25
 
26
26
  static ClaudeSkillsPostImport()
27
27
  {
@@ -30,27 +30,15 @@ namespace PackageTool.Samples.ClaudeSkills
30
30
 
31
31
  private static void Run()
32
32
  {
33
- // Re-entrancy guard. Multiple copies of this type (e.g. in side-by-side sample imports
34
- // each shipping their own assembly) would each schedule a delayCall; without this guard
35
- // they would race on the same sample folders and double-prompt the user.
36
- if (SessionState.GetBool(SESSION_RUNNING_KEY, false))
37
- return;
38
- SessionState.SetBool(SESSION_RUNNING_KEY, true);
39
-
40
33
  try
41
34
  {
42
35
  foreach (var sampleRootAssetPath in FindSampleRootAssetPaths())
43
36
  {
44
- // Only run from an imported sample location; never act on the source folder
45
- // inside a package author's project.
37
+ // Only act on imported sample locations; never touch the source folder inside a
38
+ // package author's project.
46
39
  if (!sampleRootAssetPath.StartsWith("Assets/Samples/", StringComparison.Ordinal))
47
40
  continue;
48
41
 
49
- var guardKey = SESSION_GUARD_KEY_PREFIX + sampleRootAssetPath;
50
- if (SessionState.GetBool(guardKey, false))
51
- continue;
52
- SessionState.SetBool(guardKey, true);
53
-
54
42
  ProcessSample(sampleRootAssetPath);
55
43
  }
56
44
  }
@@ -58,10 +46,6 @@ namespace PackageTool.Samples.ClaudeSkills
58
46
  {
59
47
  Debug.LogErrorFormat("{0} Post-import failed: {1}", LOG_PREFIX, e);
60
48
  }
61
- finally
62
- {
63
- SessionState.SetBool(SESSION_RUNNING_KEY, false);
64
- }
65
49
  }
66
50
 
67
51
  private static IEnumerable<string> FindSampleRootAssetPaths()
@@ -154,7 +154,7 @@ SUMMARY_LINE_RE = re.compile(r"^\s*///\s?(?P<text>.*)$")
154
154
 
155
155
  def parse_cs_file(path: Path, rel_path: str) -> dict:
156
156
  """Return {'types': [...], 'namespaces': set([...])} for one .cs file."""
157
- raw = path.read_text(encoding="utf-8", errors="replace")
157
+ raw = path.read_text(encoding="utf-8-sig", errors="replace")
158
158
  norm = normalize(raw)
159
159
  norm_lines = norm.split("\n")
160
160
  raw_lines = raw.split("\n")
@@ -353,7 +353,7 @@ def scan_asmdefs(package_dir: Path, repo_root: Path) -> list[dict]:
353
353
  results: list[dict] = []
354
354
  for p in package_dir.rglob("*.asmdef"):
355
355
  try:
356
- data = json.loads(p.read_text(encoding="utf-8"))
356
+ data = json.loads(p.read_text(encoding="utf-8-sig"))
357
357
  except json.JSONDecodeError:
358
358
  continue
359
359
  results.append(
@@ -383,7 +383,7 @@ def build_script_guid_map(repo_root: Path) -> dict[str, str]:
383
383
  return mapping
384
384
  for meta in assets.rglob("*.cs.meta"):
385
385
  try:
386
- text = meta.read_text(encoding="utf-8", errors="replace")
386
+ text = meta.read_text(encoding="utf-8-sig", errors="replace")
387
387
  except OSError:
388
388
  continue
389
389
  m = META_GUID_RE.search(text)
@@ -409,7 +409,7 @@ def scan_sample_dir(sample_dir: Path, repo_root: Path, package_types: set[str],
409
409
  suf = p.suffix.lower()
410
410
  if suf == ".cs":
411
411
  try:
412
- src = p.read_text(encoding="utf-8", errors="replace")
412
+ src = p.read_text(encoding="utf-8-sig", errors="replace")
413
413
  except OSError:
414
414
  continue
415
415
  norm = normalize(src)
@@ -420,7 +420,7 @@ def scan_sample_dir(sample_dir: Path, repo_root: Path, package_types: set[str],
420
420
  results.append({"path": rel, "kind": "script", "namespace": ns, "packageTypesReferenced": refs})
421
421
  elif suf in (".unity", ".prefab"):
422
422
  try:
423
- text = p.read_text(encoding="utf-8", errors="replace")
423
+ text = p.read_text(encoding="utf-8-sig", errors="replace")
424
424
  except OSError:
425
425
  continue
426
426
  guids = sorted(set(SCRIPT_REF_RE.findall(text)))
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "com.elestrago.unity.package-tools",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "displayName": "Package Tool",
5
5
  "description": "Tool for create unity packages",
6
6
  "category": "unity",
7
7
  "unity": "2021.3",
8
8
  "homepage": "https://gitlab.com/elestrago-pkg/package-tool",
9
- "documentationUrl": "https://gitlab.com/elestrago-pkg/package-tool/-/blob/2.2.1/README.md",
10
- "changelogUrl": "https://gitlab.com/elestrago-pkg/package-tool/-/blob/2.2.1/CHANGELOG.md",
11
- "licensesUrl": "https://gitlab.com/elestrago-pkg/package-tool/-/blob/2.2.1/LICENSE",
9
+ "documentationUrl": "https://gitlab.com/elestrago-pkg/package-tool/-/blob/2.2.3/README.md",
10
+ "changelogUrl": "https://gitlab.com/elestrago-pkg/package-tool/-/blob/2.2.3/CHANGELOG.md",
11
+ "licensesUrl": "https://gitlab.com/elestrago-pkg/package-tool/-/blob/2.2.3/LICENSE",
12
12
  "license": "MIT",
13
13
  "keywords": [
14
14
  "unity",