@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,276 @@
1
+ import { InstallerStatus } from "../../types/unity.js";
2
+ export class StatusNormalizer {
3
+ normalizations = new Map();
4
+ localeNormalizations = new Map();
5
+ unknownStatuses = new Set();
6
+ constructor() {
7
+ this.initializeDefaultNormalizations();
8
+ }
9
+ initializeDefaultNormalizations() {
10
+ this.addNormalization({
11
+ text: "queued for download",
12
+ status: InstallerStatus.Queued,
13
+ });
14
+ this.addNormalization({
15
+ text: "download queued",
16
+ status: InstallerStatus.Queued,
17
+ });
18
+ this.addNormalization({
19
+ text: "validating download",
20
+ status: InstallerStatus.Validating,
21
+ });
22
+ this.addNormalization({
23
+ text: "validating",
24
+ status: InstallerStatus.Validating,
25
+ });
26
+ this.addNormalization({
27
+ text: "in progress",
28
+ status: InstallerStatus.InProgress,
29
+ });
30
+ this.addNormalization({
31
+ text: "downloading",
32
+ status: InstallerStatus.Downloading,
33
+ });
34
+ this.addNormalization({
35
+ text: "download in progress",
36
+ status: InstallerStatus.Downloading,
37
+ });
38
+ this.addNormalization({
39
+ text: "queued for install",
40
+ status: InstallerStatus.QueuedInstall,
41
+ });
42
+ this.addNormalization({
43
+ text: "install queued",
44
+ status: InstallerStatus.QueuedInstall,
45
+ });
46
+ this.addNormalization({
47
+ text: "validation installation",
48
+ status: InstallerStatus.ValidatingInstall,
49
+ });
50
+ this.addNormalization({
51
+ text: "validating installation",
52
+ status: InstallerStatus.ValidatingInstall,
53
+ });
54
+ this.addNormalization({
55
+ text: "installing",
56
+ status: InstallerStatus.Installing,
57
+ });
58
+ this.addNormalization({
59
+ text: "install in progress",
60
+ status: InstallerStatus.Installing,
61
+ });
62
+ this.addNormalization({
63
+ text: "verifying",
64
+ status: InstallerStatus.Verifying,
65
+ });
66
+ this.addNormalization({
67
+ text: "installed successfully",
68
+ status: InstallerStatus.Installed,
69
+ });
70
+ this.addNormalization({
71
+ text: "installed",
72
+ status: InstallerStatus.Installed,
73
+ });
74
+ this.addNormalization({
75
+ text: "complete",
76
+ status: InstallerStatus.Installed,
77
+ });
78
+ this.addNormalization({
79
+ text: "completed",
80
+ status: InstallerStatus.Installed,
81
+ });
82
+ this.addNormalization({
83
+ text: "ダウンロード中",
84
+ status: InstallerStatus.Downloading,
85
+ locale: "ja",
86
+ });
87
+ this.addNormalization({
88
+ text: "インストール中",
89
+ status: InstallerStatus.Installing,
90
+ locale: "ja",
91
+ });
92
+ this.addNormalization({
93
+ text: "検証中",
94
+ status: InstallerStatus.Verifying,
95
+ locale: "ja",
96
+ });
97
+ this.addNormalization({
98
+ text: "完了",
99
+ status: InstallerStatus.Installed,
100
+ locale: "ja",
101
+ });
102
+ this.addNormalization({
103
+ text: "wird heruntergeladen",
104
+ status: InstallerStatus.Downloading,
105
+ locale: "de",
106
+ });
107
+ this.addNormalization({
108
+ text: "wird installiert",
109
+ status: InstallerStatus.Installing,
110
+ locale: "de",
111
+ });
112
+ this.addNormalization({
113
+ text: "wird überprüft",
114
+ status: InstallerStatus.Verifying,
115
+ locale: "de",
116
+ });
117
+ this.addNormalization({
118
+ text: "erfolgreich installiert",
119
+ status: InstallerStatus.Installed,
120
+ locale: "de",
121
+ });
122
+ this.addNormalization({
123
+ text: "téléchargement en cours",
124
+ status: InstallerStatus.Downloading,
125
+ locale: "fr",
126
+ });
127
+ this.addNormalization({
128
+ text: "installation en cours",
129
+ status: InstallerStatus.Installing,
130
+ locale: "fr",
131
+ });
132
+ this.addNormalization({
133
+ text: "vérification",
134
+ status: InstallerStatus.Verifying,
135
+ locale: "fr",
136
+ });
137
+ this.addNormalization({
138
+ text: "installé avec succès",
139
+ status: InstallerStatus.Installed,
140
+ locale: "fr",
141
+ });
142
+ this.addNormalization({
143
+ text: "descargando",
144
+ status: InstallerStatus.Downloading,
145
+ locale: "es",
146
+ });
147
+ this.addNormalization({
148
+ text: "instalando",
149
+ status: InstallerStatus.Installing,
150
+ locale: "es",
151
+ });
152
+ this.addNormalization({
153
+ text: "verificando",
154
+ status: InstallerStatus.Verifying,
155
+ locale: "es",
156
+ });
157
+ this.addNormalization({
158
+ text: "instalado correctamente",
159
+ status: InstallerStatus.Installed,
160
+ locale: "es",
161
+ });
162
+ this.addNormalization({
163
+ text: "正在下载",
164
+ status: InstallerStatus.Downloading,
165
+ locale: "zh-Hans",
166
+ });
167
+ this.addNormalization({
168
+ text: "正在安装",
169
+ status: InstallerStatus.Installing,
170
+ locale: "zh-Hans",
171
+ });
172
+ this.addNormalization({
173
+ text: "正在验证",
174
+ status: InstallerStatus.Verifying,
175
+ locale: "zh-Hans",
176
+ });
177
+ this.addNormalization({
178
+ text: "安装成功",
179
+ status: InstallerStatus.Installed,
180
+ locale: "zh-Hans",
181
+ });
182
+ this.addNormalization({
183
+ text: "正在下載",
184
+ status: InstallerStatus.Downloading,
185
+ locale: "zh-Hant",
186
+ });
187
+ this.addNormalization({
188
+ text: "正在安裝",
189
+ status: InstallerStatus.Installing,
190
+ locale: "zh-Hant",
191
+ });
192
+ this.addNormalization({
193
+ text: "正在驗證",
194
+ status: InstallerStatus.Verifying,
195
+ locale: "zh-Hant",
196
+ });
197
+ this.addNormalization({
198
+ text: "安裝成功",
199
+ status: InstallerStatus.Installed,
200
+ locale: "zh-Hant",
201
+ });
202
+ this.addNormalization({
203
+ text: "다운로드 중",
204
+ status: InstallerStatus.Downloading,
205
+ locale: "ko",
206
+ });
207
+ this.addNormalization({
208
+ text: "설치 중",
209
+ status: InstallerStatus.Installing,
210
+ locale: "ko",
211
+ });
212
+ this.addNormalization({
213
+ text: "확인 중",
214
+ status: InstallerStatus.Verifying,
215
+ locale: "ko",
216
+ });
217
+ this.addNormalization({
218
+ text: "설치 완료",
219
+ status: InstallerStatus.Installed,
220
+ locale: "ko",
221
+ });
222
+ }
223
+ addNormalization(normalization) {
224
+ const key = normalization.text.toLowerCase().trim();
225
+ if (normalization.locale) {
226
+ if (!this.localeNormalizations.has(normalization.locale)) {
227
+ this.localeNormalizations.set(normalization.locale, new Map());
228
+ }
229
+ this.localeNormalizations.get(normalization.locale).set(key, normalization.status);
230
+ }
231
+ else {
232
+ this.normalizations.set(key, normalization.status);
233
+ }
234
+ }
235
+ normalize(statusText, locale) {
236
+ const cleanText = statusText.toLowerCase().trim();
237
+ if (locale && this.localeNormalizations.has(locale)) {
238
+ const localeMap = this.localeNormalizations.get(locale);
239
+ if (localeMap.has(cleanText)) {
240
+ return localeMap.get(cleanText);
241
+ }
242
+ }
243
+ if (this.normalizations.has(cleanText)) {
244
+ return this.normalizations.get(cleanText);
245
+ }
246
+ for (const enumValue of Object.values(InstallerStatus)) {
247
+ if (enumValue.toLowerCase() === cleanText) {
248
+ return enumValue;
249
+ }
250
+ }
251
+ this.unknownStatuses.add(statusText);
252
+ return null;
253
+ }
254
+ isKnownStatus(statusText, locale) {
255
+ return this.normalize(statusText, locale) !== null;
256
+ }
257
+ getUnknownStatuses() {
258
+ return Array.from(this.unknownStatuses);
259
+ }
260
+ clearUnknownStatuses() {
261
+ this.unknownStatuses.clear();
262
+ }
263
+ getNormalizationsForLocale(locale) {
264
+ if (!locale) {
265
+ return new Map(this.normalizations);
266
+ }
267
+ const result = new Map(this.normalizations);
268
+ if (this.localeNormalizations.has(locale)) {
269
+ const localeMap = this.localeNormalizations.get(locale);
270
+ for (const [key, value] of localeMap) {
271
+ result.set(key, value);
272
+ }
273
+ }
274
+ return result;
275
+ }
276
+ }
@@ -0,0 +1,30 @@
1
+ import { InstallerEvent, InstallerStatus } from "../../types/unity.js";
2
+ export interface PatternMatch {
3
+ module: string;
4
+ status: InstallerStatus;
5
+ progress?: number | null;
6
+ error?: string | null;
7
+ confidence: number;
8
+ }
9
+ export interface Pattern {
10
+ priority: number;
11
+ locale?: string;
12
+ name: string;
13
+ match(line: string, locale?: string): PatternMatch | null;
14
+ }
15
+ export interface StatusNormalization {
16
+ text: string;
17
+ status: InstallerStatus;
18
+ locale?: string;
19
+ }
20
+ export interface ParserConfig {
21
+ locale: string;
22
+ logUnknownStatuses: boolean;
23
+ minConfidence: number;
24
+ useFallbackPatterns: boolean;
25
+ }
26
+ export interface ParseResult {
27
+ events: InstallerEvent[];
28
+ unknownStatuses: string[];
29
+ unparsedLines: string[];
30
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,5 @@
1
- export { default as UnityHub } from "./unityHub.ts";
2
- export { default as UnityEditor } from "./unityEditor.ts";
3
- export { default as UnityTemplates } from "./unityTemplates.ts";
4
- export { UnityHubInstallerEvent } from "./events/hubEventEmitter.ts";
5
- export { UnityConfig } from "./configs/unityConfig.ts";
6
- export * from "./types/unity.ts";
1
+ export { default as UnityHub } from "./unityHub.js";
2
+ export { default as UnityEditor } from "./unityEditor.js";
3
+ export { UnityHubInstallerEvent } from "./events/hubEventEmitter.js";
4
+ export * from "./types/unity.js";
5
+ export * from "./errors/index.js";
package/dist/esm/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  export { default as UnityHub } from "./unityHub.js";
2
2
  export { default as UnityEditor } from "./unityEditor.js";
3
- export { default as UnityTemplates } from "./unityTemplates.js";
4
3
  export { UnityHubInstallerEvent } from "./events/hubEventEmitter.js";
5
- export { UnityConfig } from "./configs/unityConfig.js";
6
4
  export * from "./types/unity.js";
5
+ export * from "./errors/index.js";
@@ -1,21 +1,17 @@
1
1
  import { ProjectInfo, TestMode, UnityBuildTarget, UnityEditorInfo } from "./types/unity.js";
2
- import { CommandOptions, CommandResult } from "./utils/commandExecutor.js";
2
+ import { CommandOptions, CommandOutput } from "./utils/commandExecutor.js";
3
+ import { Result, UnityEditorNotFoundError, UnityCommandError, UnityTestError, UnityLicenseError, UnityPackageError, UnityProjectError } from "./errors/index.js";
3
4
  declare class UnityEditor {
4
5
  static getUnityExecutablePath(version: string): string;
5
- static getUnityTemplatesPath(version: string): string;
6
6
  static isUnityVersionInstalled(version: string): Promise<boolean>;
7
- static execUnityEditorCommand(editorInfo: UnityEditorInfo, args: string[], options?: CommandOptions): Promise<CommandResult>;
8
- static executeMethod(projectInfo: ProjectInfo, method: string, args?: string[], options?: CommandOptions): Promise<CommandResult>;
9
- static runTests(projectInfo: ProjectInfo, testPlatform?: TestMode | UnityBuildTarget, testCategory?: string): Promise<{
10
- success: boolean;
11
- output: string;
12
- }>;
13
- static activateLicense(projectInfo: ProjectInfo, serial: string, username: string, password: string): Promise<boolean>;
14
- static returnLicense(projectInfo: ProjectInfo): Promise<boolean>;
15
- static exportPackage(projectInfo: ProjectInfo, assetPaths: string[], outputPath: string): Promise<boolean>;
16
- static importPackage(projectInfo: ProjectInfo, packagePath: string): Promise<boolean>;
17
- static createProject(projectInfo: ProjectInfo, quit?: boolean, useHub?: boolean): Promise<boolean>;
18
- static createProjectFromTemplate(projectInfo: ProjectInfo, templatePath: string, quit?: boolean, useHub?: boolean): Promise<boolean>;
19
- static openProject(projectInfo: ProjectInfo, useHub?: boolean, batchmode?: boolean, waitForExit?: boolean): Promise<boolean>;
7
+ static execUnityEditorCommand(editorInfo: UnityEditorInfo, args: string[], options?: CommandOptions): Promise<Result<CommandOutput, UnityEditorNotFoundError | UnityCommandError>>;
8
+ static executeMethod(projectInfo: ProjectInfo, method: string, args?: string[], options?: CommandOptions): Promise<Result<CommandOutput, UnityEditorNotFoundError | UnityCommandError>>;
9
+ static runTests(projectInfo: ProjectInfo, testPlatform?: TestMode | UnityBuildTarget, testCategory?: string): Promise<Result<string, UnityEditorNotFoundError | UnityCommandError | UnityTestError>>;
10
+ static activateLicense(projectInfo: ProjectInfo, serial: string, username: string, password: string): Promise<Result<void, UnityEditorNotFoundError | UnityCommandError | UnityLicenseError>>;
11
+ static returnLicense(projectInfo: ProjectInfo): Promise<Result<void, UnityEditorNotFoundError | UnityCommandError | UnityLicenseError>>;
12
+ static exportPackage(projectInfo: ProjectInfo, assetPaths: string[], outputPath: string): Promise<Result<void, UnityEditorNotFoundError | UnityCommandError | UnityPackageError>>;
13
+ static importPackage(projectInfo: ProjectInfo, packagePath: string): Promise<Result<void, UnityEditorNotFoundError | UnityCommandError | UnityPackageError>>;
14
+ static createProject(projectInfo: ProjectInfo, waitForExit?: boolean): Promise<Result<void, UnityEditorNotFoundError | UnityCommandError | UnityProjectError>>;
15
+ static openProject(projectInfo: ProjectInfo, useHub?: boolean, batchmode?: boolean, waitForExit?: boolean): Promise<Result<void, UnityEditorNotFoundError | UnityCommandError | UnityProjectError>>;
20
16
  }
21
17
  export default UnityEditor;