@notask/unity-cli-tools 1.2.0-rc.1 → 2.0.0

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 (64) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/CHANGELOG.md +164 -164
  3. package/LICENSE +23 -23
  4. package/README.md +809 -347
  5. package/dist/cjs/errors/Result.js +76 -0
  6. package/dist/cjs/errors/UnityError.js +77 -0
  7. package/dist/cjs/errors/index.js +18 -0
  8. package/dist/cjs/events/hubEventEmitter.js +16 -16
  9. package/dist/cjs/events/hubEventParser.js +97 -27
  10. package/dist/cjs/events/patterns/implementations/bracketModulePattern.js +57 -0
  11. package/dist/cjs/events/patterns/implementations/errorPattern.js +99 -0
  12. package/dist/cjs/events/patterns/implementations/fallbackPattern.js +63 -0
  13. package/dist/cjs/events/patterns/implementations/index.js +9 -0
  14. package/dist/cjs/events/patterns/index.js +23 -0
  15. package/dist/cjs/events/patterns/patternRegistry.js +69 -0
  16. package/dist/cjs/events/patterns/statusNormalizer.js +280 -0
  17. package/dist/cjs/events/patterns/types.js +2 -0
  18. package/dist/cjs/index.js +8 -11
  19. package/dist/cjs/unityEditor.js +182 -230
  20. package/dist/cjs/unityHub.js +110 -85
  21. package/dist/cjs/utils/commandExecutor.js +8 -9
  22. package/dist/esm/errors/Result.d.ts +21 -0
  23. package/dist/esm/errors/Result.js +63 -0
  24. package/dist/esm/errors/UnityError.d.ts +36 -0
  25. package/dist/esm/errors/UnityError.js +64 -0
  26. package/dist/esm/errors/index.d.ts +2 -0
  27. package/dist/esm/errors/index.js +2 -0
  28. package/dist/esm/events/hubEventEmitter.d.ts +1 -1
  29. package/dist/esm/events/hubEventParser.d.ts +17 -3
  30. package/dist/esm/events/hubEventParser.js +97 -27
  31. package/dist/esm/events/patterns/implementations/bracketModulePattern.d.ts +11 -0
  32. package/dist/esm/events/patterns/implementations/bracketModulePattern.js +53 -0
  33. package/dist/esm/events/patterns/implementations/errorPattern.d.ts +22 -0
  34. package/dist/esm/events/patterns/implementations/errorPattern.js +95 -0
  35. package/dist/esm/events/patterns/implementations/fallbackPattern.d.ts +13 -0
  36. package/dist/esm/events/patterns/implementations/fallbackPattern.js +59 -0
  37. package/dist/esm/events/patterns/implementations/index.d.ts +3 -0
  38. package/dist/esm/events/patterns/implementations/index.js +3 -0
  39. package/dist/esm/events/patterns/index.d.ts +4 -0
  40. package/dist/esm/events/patterns/index.js +4 -0
  41. package/dist/esm/events/patterns/patternRegistry.d.ts +14 -0
  42. package/dist/esm/events/patterns/patternRegistry.js +65 -0
  43. package/dist/esm/events/patterns/statusNormalizer.d.ts +15 -0
  44. package/dist/esm/events/patterns/statusNormalizer.js +276 -0
  45. package/dist/esm/events/patterns/types.d.ts +30 -0
  46. package/dist/esm/events/patterns/types.js +1 -0
  47. package/dist/esm/index.d.ts +5 -6
  48. package/dist/esm/index.js +1 -2
  49. package/dist/esm/unityEditor.d.ts +11 -15
  50. package/dist/esm/unityEditor.js +196 -244
  51. package/dist/esm/unityHub.d.ts +13 -11
  52. package/dist/esm/unityHub.js +108 -83
  53. package/dist/esm/utils/commandExecutor.d.ts +4 -3
  54. package/dist/esm/utils/commandExecutor.js +8 -9
  55. package/package.json +70 -70
  56. package/sandbox/index.js +51 -0
  57. package/sandbox/node_modules/.package-lock.json +10495 -0
  58. package/sandbox/package.json +13 -0
  59. package/dist/cjs/configs/unityConfig.js +0 -74
  60. package/dist/cjs/unityTemplates.js +0 -29
  61. package/dist/esm/configs/unityConfig.d.ts +0 -25
  62. package/dist/esm/configs/unityConfig.js +0 -68
  63. package/dist/esm/unityTemplates.d.ts +0 -10
  64. package/dist/esm/unityTemplates.js +0 -24
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PatternRegistry = void 0;
4
+ class PatternRegistry {
5
+ patterns = [];
6
+ register(pattern) {
7
+ this.patterns.push(pattern);
8
+ this.sortPatterns();
9
+ }
10
+ registerAll(patterns) {
11
+ this.patterns.push(...patterns);
12
+ this.sortPatterns();
13
+ }
14
+ unregister(patternName) {
15
+ const initialLength = this.patterns.length;
16
+ this.patterns = this.patterns.filter((p) => p.name !== patternName);
17
+ return this.patterns.length < initialLength;
18
+ }
19
+ getPatterns(locale) {
20
+ if (!locale) {
21
+ return [...this.patterns];
22
+ }
23
+ return this.patterns.filter((p) => !p.locale || p.locale === locale);
24
+ }
25
+ match(line, locale, minConfidence = 0) {
26
+ const applicablePatterns = this.getPatterns(locale);
27
+ for (const pattern of applicablePatterns) {
28
+ try {
29
+ const match = pattern.match(line, locale);
30
+ if (match && match.confidence >= minConfidence) {
31
+ return match;
32
+ }
33
+ }
34
+ catch (error) {
35
+ console.error(`Error in pattern "${pattern.name}":`, error);
36
+ }
37
+ }
38
+ return null;
39
+ }
40
+ matchAll(line, locale) {
41
+ const applicablePatterns = this.getPatterns(locale);
42
+ const matches = [];
43
+ for (const pattern of applicablePatterns) {
44
+ try {
45
+ const match = pattern.match(line, locale);
46
+ if (match) {
47
+ matches.push(match);
48
+ }
49
+ }
50
+ catch (error) {
51
+ console.error(`Error in pattern "${pattern.name}":`, error);
52
+ }
53
+ }
54
+ return matches.sort((a, b) => b.confidence - a.confidence);
55
+ }
56
+ getPatternNames() {
57
+ return this.patterns.map((p) => p.name);
58
+ }
59
+ clear() {
60
+ this.patterns = [];
61
+ }
62
+ count() {
63
+ return this.patterns.length;
64
+ }
65
+ sortPatterns() {
66
+ this.patterns.sort((a, b) => b.priority - a.priority);
67
+ }
68
+ }
69
+ exports.PatternRegistry = PatternRegistry;
@@ -0,0 +1,280 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StatusNormalizer = void 0;
4
+ const unity_js_1 = require("../../types/unity.js");
5
+ class StatusNormalizer {
6
+ normalizations = new Map();
7
+ localeNormalizations = new Map();
8
+ unknownStatuses = new Set();
9
+ constructor() {
10
+ this.initializeDefaultNormalizations();
11
+ }
12
+ initializeDefaultNormalizations() {
13
+ this.addNormalization({
14
+ text: "queued for download",
15
+ status: unity_js_1.InstallerStatus.Queued,
16
+ });
17
+ this.addNormalization({
18
+ text: "download queued",
19
+ status: unity_js_1.InstallerStatus.Queued,
20
+ });
21
+ this.addNormalization({
22
+ text: "validating download",
23
+ status: unity_js_1.InstallerStatus.Validating,
24
+ });
25
+ this.addNormalization({
26
+ text: "validating",
27
+ status: unity_js_1.InstallerStatus.Validating,
28
+ });
29
+ this.addNormalization({
30
+ text: "in progress",
31
+ status: unity_js_1.InstallerStatus.InProgress,
32
+ });
33
+ this.addNormalization({
34
+ text: "downloading",
35
+ status: unity_js_1.InstallerStatus.Downloading,
36
+ });
37
+ this.addNormalization({
38
+ text: "download in progress",
39
+ status: unity_js_1.InstallerStatus.Downloading,
40
+ });
41
+ this.addNormalization({
42
+ text: "queued for install",
43
+ status: unity_js_1.InstallerStatus.QueuedInstall,
44
+ });
45
+ this.addNormalization({
46
+ text: "install queued",
47
+ status: unity_js_1.InstallerStatus.QueuedInstall,
48
+ });
49
+ this.addNormalization({
50
+ text: "validation installation",
51
+ status: unity_js_1.InstallerStatus.ValidatingInstall,
52
+ });
53
+ this.addNormalization({
54
+ text: "validating installation",
55
+ status: unity_js_1.InstallerStatus.ValidatingInstall,
56
+ });
57
+ this.addNormalization({
58
+ text: "installing",
59
+ status: unity_js_1.InstallerStatus.Installing,
60
+ });
61
+ this.addNormalization({
62
+ text: "install in progress",
63
+ status: unity_js_1.InstallerStatus.Installing,
64
+ });
65
+ this.addNormalization({
66
+ text: "verifying",
67
+ status: unity_js_1.InstallerStatus.Verifying,
68
+ });
69
+ this.addNormalization({
70
+ text: "installed successfully",
71
+ status: unity_js_1.InstallerStatus.Installed,
72
+ });
73
+ this.addNormalization({
74
+ text: "installed",
75
+ status: unity_js_1.InstallerStatus.Installed,
76
+ });
77
+ this.addNormalization({
78
+ text: "complete",
79
+ status: unity_js_1.InstallerStatus.Installed,
80
+ });
81
+ this.addNormalization({
82
+ text: "completed",
83
+ status: unity_js_1.InstallerStatus.Installed,
84
+ });
85
+ this.addNormalization({
86
+ text: "ダウンロード中",
87
+ status: unity_js_1.InstallerStatus.Downloading,
88
+ locale: "ja",
89
+ });
90
+ this.addNormalization({
91
+ text: "インストール中",
92
+ status: unity_js_1.InstallerStatus.Installing,
93
+ locale: "ja",
94
+ });
95
+ this.addNormalization({
96
+ text: "検証中",
97
+ status: unity_js_1.InstallerStatus.Verifying,
98
+ locale: "ja",
99
+ });
100
+ this.addNormalization({
101
+ text: "完了",
102
+ status: unity_js_1.InstallerStatus.Installed,
103
+ locale: "ja",
104
+ });
105
+ this.addNormalization({
106
+ text: "wird heruntergeladen",
107
+ status: unity_js_1.InstallerStatus.Downloading,
108
+ locale: "de",
109
+ });
110
+ this.addNormalization({
111
+ text: "wird installiert",
112
+ status: unity_js_1.InstallerStatus.Installing,
113
+ locale: "de",
114
+ });
115
+ this.addNormalization({
116
+ text: "wird überprüft",
117
+ status: unity_js_1.InstallerStatus.Verifying,
118
+ locale: "de",
119
+ });
120
+ this.addNormalization({
121
+ text: "erfolgreich installiert",
122
+ status: unity_js_1.InstallerStatus.Installed,
123
+ locale: "de",
124
+ });
125
+ this.addNormalization({
126
+ text: "téléchargement en cours",
127
+ status: unity_js_1.InstallerStatus.Downloading,
128
+ locale: "fr",
129
+ });
130
+ this.addNormalization({
131
+ text: "installation en cours",
132
+ status: unity_js_1.InstallerStatus.Installing,
133
+ locale: "fr",
134
+ });
135
+ this.addNormalization({
136
+ text: "vérification",
137
+ status: unity_js_1.InstallerStatus.Verifying,
138
+ locale: "fr",
139
+ });
140
+ this.addNormalization({
141
+ text: "installé avec succès",
142
+ status: unity_js_1.InstallerStatus.Installed,
143
+ locale: "fr",
144
+ });
145
+ this.addNormalization({
146
+ text: "descargando",
147
+ status: unity_js_1.InstallerStatus.Downloading,
148
+ locale: "es",
149
+ });
150
+ this.addNormalization({
151
+ text: "instalando",
152
+ status: unity_js_1.InstallerStatus.Installing,
153
+ locale: "es",
154
+ });
155
+ this.addNormalization({
156
+ text: "verificando",
157
+ status: unity_js_1.InstallerStatus.Verifying,
158
+ locale: "es",
159
+ });
160
+ this.addNormalization({
161
+ text: "instalado correctamente",
162
+ status: unity_js_1.InstallerStatus.Installed,
163
+ locale: "es",
164
+ });
165
+ this.addNormalization({
166
+ text: "正在下载",
167
+ status: unity_js_1.InstallerStatus.Downloading,
168
+ locale: "zh-Hans",
169
+ });
170
+ this.addNormalization({
171
+ text: "正在安装",
172
+ status: unity_js_1.InstallerStatus.Installing,
173
+ locale: "zh-Hans",
174
+ });
175
+ this.addNormalization({
176
+ text: "正在验证",
177
+ status: unity_js_1.InstallerStatus.Verifying,
178
+ locale: "zh-Hans",
179
+ });
180
+ this.addNormalization({
181
+ text: "安装成功",
182
+ status: unity_js_1.InstallerStatus.Installed,
183
+ locale: "zh-Hans",
184
+ });
185
+ this.addNormalization({
186
+ text: "正在下載",
187
+ status: unity_js_1.InstallerStatus.Downloading,
188
+ locale: "zh-Hant",
189
+ });
190
+ this.addNormalization({
191
+ text: "正在安裝",
192
+ status: unity_js_1.InstallerStatus.Installing,
193
+ locale: "zh-Hant",
194
+ });
195
+ this.addNormalization({
196
+ text: "正在驗證",
197
+ status: unity_js_1.InstallerStatus.Verifying,
198
+ locale: "zh-Hant",
199
+ });
200
+ this.addNormalization({
201
+ text: "安裝成功",
202
+ status: unity_js_1.InstallerStatus.Installed,
203
+ locale: "zh-Hant",
204
+ });
205
+ this.addNormalization({
206
+ text: "다운로드 중",
207
+ status: unity_js_1.InstallerStatus.Downloading,
208
+ locale: "ko",
209
+ });
210
+ this.addNormalization({
211
+ text: "설치 중",
212
+ status: unity_js_1.InstallerStatus.Installing,
213
+ locale: "ko",
214
+ });
215
+ this.addNormalization({
216
+ text: "확인 중",
217
+ status: unity_js_1.InstallerStatus.Verifying,
218
+ locale: "ko",
219
+ });
220
+ this.addNormalization({
221
+ text: "설치 완료",
222
+ status: unity_js_1.InstallerStatus.Installed,
223
+ locale: "ko",
224
+ });
225
+ }
226
+ addNormalization(normalization) {
227
+ const key = normalization.text.toLowerCase().trim();
228
+ if (normalization.locale) {
229
+ if (!this.localeNormalizations.has(normalization.locale)) {
230
+ this.localeNormalizations.set(normalization.locale, new Map());
231
+ }
232
+ this.localeNormalizations.get(normalization.locale).set(key, normalization.status);
233
+ }
234
+ else {
235
+ this.normalizations.set(key, normalization.status);
236
+ }
237
+ }
238
+ normalize(statusText, locale) {
239
+ const cleanText = statusText.toLowerCase().trim();
240
+ if (locale && this.localeNormalizations.has(locale)) {
241
+ const localeMap = this.localeNormalizations.get(locale);
242
+ if (localeMap.has(cleanText)) {
243
+ return localeMap.get(cleanText);
244
+ }
245
+ }
246
+ if (this.normalizations.has(cleanText)) {
247
+ return this.normalizations.get(cleanText);
248
+ }
249
+ for (const enumValue of Object.values(unity_js_1.InstallerStatus)) {
250
+ if (enumValue.toLowerCase() === cleanText) {
251
+ return enumValue;
252
+ }
253
+ }
254
+ this.unknownStatuses.add(statusText);
255
+ return null;
256
+ }
257
+ isKnownStatus(statusText, locale) {
258
+ return this.normalize(statusText, locale) !== null;
259
+ }
260
+ getUnknownStatuses() {
261
+ return Array.from(this.unknownStatuses);
262
+ }
263
+ clearUnknownStatuses() {
264
+ this.unknownStatuses.clear();
265
+ }
266
+ getNormalizationsForLocale(locale) {
267
+ if (!locale) {
268
+ return new Map(this.normalizations);
269
+ }
270
+ const result = new Map(this.normalizations);
271
+ if (this.localeNormalizations.has(locale)) {
272
+ const localeMap = this.localeNormalizations.get(locale);
273
+ for (const [key, value] of localeMap) {
274
+ result.set(key, value);
275
+ }
276
+ }
277
+ return result;
278
+ }
279
+ }
280
+ exports.StatusNormalizer = StatusNormalizer;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/cjs/index.js CHANGED
@@ -17,15 +17,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.UnityConfig = exports.UnityHubInstallerEvent = exports.UnityTemplates = exports.UnityEditor = exports.UnityHub = void 0;
21
- var unityHub_ts_1 = require("./unityHub.js");
22
- Object.defineProperty(exports, "UnityHub", { enumerable: true, get: function () { return __importDefault(unityHub_ts_1).default; } });
23
- var unityEditor_ts_1 = require("./unityEditor.js");
24
- Object.defineProperty(exports, "UnityEditor", { enumerable: true, get: function () { return __importDefault(unityEditor_ts_1).default; } });
25
- var unityTemplates_ts_1 = require("./unityTemplates.js");
26
- Object.defineProperty(exports, "UnityTemplates", { enumerable: true, get: function () { return __importDefault(unityTemplates_ts_1).default; } });
27
- var hubEventEmitter_ts_1 = require("./events/hubEventEmitter.js");
28
- Object.defineProperty(exports, "UnityHubInstallerEvent", { enumerable: true, get: function () { return hubEventEmitter_ts_1.UnityHubInstallerEvent; } });
29
- var unityConfig_ts_1 = require("./configs/unityConfig.js");
30
- Object.defineProperty(exports, "UnityConfig", { enumerable: true, get: function () { return unityConfig_ts_1.UnityConfig; } });
20
+ exports.UnityHubInstallerEvent = exports.UnityEditor = exports.UnityHub = void 0;
21
+ var unityHub_js_1 = require("./unityHub.js");
22
+ Object.defineProperty(exports, "UnityHub", { enumerable: true, get: function () { return __importDefault(unityHub_js_1).default; } });
23
+ var unityEditor_js_1 = require("./unityEditor.js");
24
+ Object.defineProperty(exports, "UnityEditor", { enumerable: true, get: function () { return __importDefault(unityEditor_js_1).default; } });
25
+ var hubEventEmitter_js_1 = require("./events/hubEventEmitter.js");
26
+ Object.defineProperty(exports, "UnityHubInstallerEvent", { enumerable: true, get: function () { return hubEventEmitter_js_1.UnityHubInstallerEvent; } });
31
27
  __exportStar(require("./types/unity.js"), exports);
28
+ __exportStar(require("./errors/index.js"), exports);