vsegments 0.1.1 → 0.1.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/README.md +31 -1
- package/TESTING.md +131 -0
- package/TROUBLESHOOTING.md +256 -0
- package/coverage/clover.xml +232 -0
- package/coverage/coverage-final.json +6 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/core.js.html +868 -0
- package/coverage/lcov-report/index.html +176 -0
- package/coverage/lcov-report/index.js.html +145 -0
- package/coverage/lcov-report/models.js.html +382 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/utils.js.html +439 -0
- package/coverage/lcov-report/visualize.js.html +631 -0
- package/coverage/lcov.info +377 -0
- package/jest.config.js +15 -0
- package/package.json +9 -2
- package/scripts/pre-deploy.js +105 -0
- package/src/core.js +37 -17
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
TN:
|
|
2
|
+
SF:src/core.js
|
|
3
|
+
FN:26,(anonymous_0)
|
|
4
|
+
FN:62,(anonymous_1)
|
|
5
|
+
FN:80,(anonymous_2)
|
|
6
|
+
FN:97,(anonymous_3)
|
|
7
|
+
FN:116,(anonymous_4)
|
|
8
|
+
FN:168,(anonymous_5)
|
|
9
|
+
FN:227,(anonymous_6)
|
|
10
|
+
FNF:7
|
|
11
|
+
FNH:3
|
|
12
|
+
FNDA:23,(anonymous_0)
|
|
13
|
+
FNDA:0,(anonymous_1)
|
|
14
|
+
FNDA:9,(anonymous_2)
|
|
15
|
+
FNDA:3,(anonymous_3)
|
|
16
|
+
FNDA:0,(anonymous_4)
|
|
17
|
+
FNDA:0,(anonymous_5)
|
|
18
|
+
FNDA:0,(anonymous_6)
|
|
19
|
+
DA:5,2
|
|
20
|
+
DA:6,2
|
|
21
|
+
DA:7,2
|
|
22
|
+
DA:8,2
|
|
23
|
+
DA:9,2
|
|
24
|
+
DA:15,2
|
|
25
|
+
DA:27,23
|
|
26
|
+
DA:29,23
|
|
27
|
+
DA:30,1
|
|
28
|
+
DA:35,22
|
|
29
|
+
DA:36,22
|
|
30
|
+
DA:37,22
|
|
31
|
+
DA:40,22
|
|
32
|
+
DA:43,22
|
|
33
|
+
DA:49,22
|
|
34
|
+
DA:63,0
|
|
35
|
+
DA:64,0
|
|
36
|
+
DA:65,0
|
|
37
|
+
DA:67,0
|
|
38
|
+
DA:81,9
|
|
39
|
+
DA:82,9
|
|
40
|
+
DA:89,9
|
|
41
|
+
DA:98,3
|
|
42
|
+
DA:100,3
|
|
43
|
+
DA:101,1
|
|
44
|
+
DA:104,3
|
|
45
|
+
DA:121,0
|
|
46
|
+
DA:124,0
|
|
47
|
+
DA:127,0
|
|
48
|
+
DA:135,0
|
|
49
|
+
DA:136,0
|
|
50
|
+
DA:143,0
|
|
51
|
+
DA:144,0
|
|
52
|
+
DA:146,0
|
|
53
|
+
DA:147,0
|
|
54
|
+
DA:151,0
|
|
55
|
+
DA:155,0
|
|
56
|
+
DA:157,0
|
|
57
|
+
DA:172,0
|
|
58
|
+
DA:175,0
|
|
59
|
+
DA:178,0
|
|
60
|
+
DA:179,0
|
|
61
|
+
DA:180,0
|
|
62
|
+
DA:183,0
|
|
63
|
+
DA:190,0
|
|
64
|
+
DA:191,0
|
|
65
|
+
DA:198,0
|
|
66
|
+
DA:199,0
|
|
67
|
+
DA:201,0
|
|
68
|
+
DA:202,0
|
|
69
|
+
DA:206,0
|
|
70
|
+
DA:210,0
|
|
71
|
+
DA:211,0
|
|
72
|
+
DA:213,0
|
|
73
|
+
DA:233,0
|
|
74
|
+
DA:236,0
|
|
75
|
+
DA:239,0
|
|
76
|
+
DA:240,0
|
|
77
|
+
DA:246,0
|
|
78
|
+
DA:253,0
|
|
79
|
+
DA:254,0
|
|
80
|
+
DA:257,0
|
|
81
|
+
DA:261,2
|
|
82
|
+
LF:63
|
|
83
|
+
LH:23
|
|
84
|
+
BRDA:26,0,0,2
|
|
85
|
+
BRDA:27,1,0,23
|
|
86
|
+
BRDA:27,1,1,2
|
|
87
|
+
BRDA:29,2,0,1
|
|
88
|
+
BRDA:29,2,1,22
|
|
89
|
+
BRDA:35,3,0,22
|
|
90
|
+
BRDA:35,3,1,21
|
|
91
|
+
BRDA:36,4,0,2
|
|
92
|
+
BRDA:36,4,1,20
|
|
93
|
+
BRDA:37,5,0,22
|
|
94
|
+
BRDA:37,5,1,17
|
|
95
|
+
BRDA:89,6,0,9
|
|
96
|
+
BRDA:89,6,1,2
|
|
97
|
+
BRDA:100,7,0,1
|
|
98
|
+
BRDA:100,7,1,2
|
|
99
|
+
BRDA:116,8,0,0
|
|
100
|
+
BRDA:118,9,0,0
|
|
101
|
+
BRDA:119,10,0,0
|
|
102
|
+
BRDA:120,11,0,0
|
|
103
|
+
BRDA:146,12,0,0
|
|
104
|
+
BRDA:146,12,1,0
|
|
105
|
+
BRDA:168,13,0,0
|
|
106
|
+
BRDA:170,14,0,0
|
|
107
|
+
BRDA:171,15,0,0
|
|
108
|
+
BRDA:201,16,0,0
|
|
109
|
+
BRDA:201,16,1,0
|
|
110
|
+
BRDA:227,17,0,0
|
|
111
|
+
BRDA:229,18,0,0
|
|
112
|
+
BRDA:230,19,0,0
|
|
113
|
+
BRDA:231,20,0,0
|
|
114
|
+
BRDA:232,21,0,0
|
|
115
|
+
BRDA:239,22,0,0
|
|
116
|
+
BRDA:239,22,1,0
|
|
117
|
+
BRDA:253,23,0,0
|
|
118
|
+
BRDA:253,23,1,0
|
|
119
|
+
BRF:35
|
|
120
|
+
BRH:15
|
|
121
|
+
end_of_record
|
|
122
|
+
TN:
|
|
123
|
+
SF:src/index.js
|
|
124
|
+
FNF:0
|
|
125
|
+
FNH:0
|
|
126
|
+
DA:12,1
|
|
127
|
+
DA:13,1
|
|
128
|
+
DA:15,1
|
|
129
|
+
DA:16,1
|
|
130
|
+
DA:17,1
|
|
131
|
+
DA:18,1
|
|
132
|
+
DA:19,1
|
|
133
|
+
DA:20,1
|
|
134
|
+
LF:8
|
|
135
|
+
LH:8
|
|
136
|
+
BRF:0
|
|
137
|
+
BRH:0
|
|
138
|
+
end_of_record
|
|
139
|
+
TN:
|
|
140
|
+
SF:src/models.js
|
|
141
|
+
FN:14,(anonymous_0)
|
|
142
|
+
FN:28,(anonymous_1)
|
|
143
|
+
FN:41,(anonymous_2)
|
|
144
|
+
FN:63,(anonymous_3)
|
|
145
|
+
FN:80,(anonymous_4)
|
|
146
|
+
FN:90,(anonymous_5)
|
|
147
|
+
FNF:6
|
|
148
|
+
FNH:6
|
|
149
|
+
FNDA:20,(anonymous_0)
|
|
150
|
+
FNDA:3,(anonymous_1)
|
|
151
|
+
FNDA:8,(anonymous_2)
|
|
152
|
+
FNDA:4,(anonymous_3)
|
|
153
|
+
FNDA:6,(anonymous_4)
|
|
154
|
+
FNDA:3,(anonymous_5)
|
|
155
|
+
DA:15,20
|
|
156
|
+
DA:16,20
|
|
157
|
+
DA:17,20
|
|
158
|
+
DA:18,20
|
|
159
|
+
DA:19,20
|
|
160
|
+
DA:29,3
|
|
161
|
+
DA:30,3
|
|
162
|
+
DA:31,3
|
|
163
|
+
DA:32,3
|
|
164
|
+
DA:33,3
|
|
165
|
+
DA:42,8
|
|
166
|
+
DA:43,8
|
|
167
|
+
DA:64,4
|
|
168
|
+
DA:65,4
|
|
169
|
+
DA:66,4
|
|
170
|
+
DA:67,4
|
|
171
|
+
DA:68,4
|
|
172
|
+
DA:69,4
|
|
173
|
+
DA:81,6
|
|
174
|
+
DA:82,6
|
|
175
|
+
DA:83,6
|
|
176
|
+
DA:91,3
|
|
177
|
+
DA:95,4
|
|
178
|
+
LF:23
|
|
179
|
+
LH:23
|
|
180
|
+
BRDA:80,0,0,4
|
|
181
|
+
BRDA:80,1,0,5
|
|
182
|
+
BRF:2
|
|
183
|
+
BRH:2
|
|
184
|
+
end_of_record
|
|
185
|
+
TN:
|
|
186
|
+
SF:src/utils.js
|
|
187
|
+
FN:13,parseJson
|
|
188
|
+
FN:30,parseBoundingBoxes
|
|
189
|
+
FN:51,parseSegmentationMasks
|
|
190
|
+
FNF:3
|
|
191
|
+
FNH:3
|
|
192
|
+
FNDA:12,parseJson
|
|
193
|
+
FNDA:5,parseBoundingBoxes
|
|
194
|
+
FNDA:2,parseSegmentationMasks
|
|
195
|
+
DA:5,3
|
|
196
|
+
DA:6,3
|
|
197
|
+
DA:14,12
|
|
198
|
+
DA:15,12
|
|
199
|
+
DA:16,13
|
|
200
|
+
DA:17,4
|
|
201
|
+
DA:18,4
|
|
202
|
+
DA:19,4
|
|
203
|
+
DA:22,12
|
|
204
|
+
DA:31,5
|
|
205
|
+
DA:32,5
|
|
206
|
+
DA:34,5
|
|
207
|
+
DA:35,5
|
|
208
|
+
DA:36,8
|
|
209
|
+
DA:37,7
|
|
210
|
+
DA:41,5
|
|
211
|
+
DA:52,2
|
|
212
|
+
DA:53,2
|
|
213
|
+
DA:55,2
|
|
214
|
+
DA:57,2
|
|
215
|
+
DA:58,3
|
|
216
|
+
DA:60,0
|
|
217
|
+
DA:61,0
|
|
218
|
+
DA:64,0
|
|
219
|
+
DA:65,0
|
|
220
|
+
DA:66,0
|
|
221
|
+
DA:67,0
|
|
222
|
+
DA:69,0
|
|
223
|
+
DA:70,0
|
|
224
|
+
DA:73,0
|
|
225
|
+
DA:74,0
|
|
226
|
+
DA:77,0
|
|
227
|
+
DA:78,0
|
|
228
|
+
DA:79,0
|
|
229
|
+
DA:80,0
|
|
230
|
+
DA:83,0
|
|
231
|
+
DA:84,0
|
|
232
|
+
DA:86,0
|
|
233
|
+
DA:87,0
|
|
234
|
+
DA:91,0
|
|
235
|
+
DA:93,0
|
|
236
|
+
DA:94,0
|
|
237
|
+
DA:95,0
|
|
238
|
+
DA:96,0
|
|
239
|
+
DA:97,0
|
|
240
|
+
DA:99,0
|
|
241
|
+
DA:100,0
|
|
242
|
+
DA:101,0
|
|
243
|
+
DA:106,0
|
|
244
|
+
DA:111,2
|
|
245
|
+
DA:114,3
|
|
246
|
+
LF:51
|
|
247
|
+
LH:23
|
|
248
|
+
BRDA:16,0,0,4
|
|
249
|
+
BRDA:16,0,1,9
|
|
250
|
+
BRDA:36,1,0,7
|
|
251
|
+
BRDA:36,1,1,1
|
|
252
|
+
BRDA:58,2,0,3
|
|
253
|
+
BRDA:58,2,1,0
|
|
254
|
+
BRDA:58,3,0,3
|
|
255
|
+
BRDA:58,3,1,2
|
|
256
|
+
BRDA:99,4,0,0
|
|
257
|
+
BRDA:99,4,1,0
|
|
258
|
+
BRDA:99,5,0,0
|
|
259
|
+
BRDA:99,5,1,0
|
|
260
|
+
BRF:12
|
|
261
|
+
BRH:7
|
|
262
|
+
end_of_record
|
|
263
|
+
TN:
|
|
264
|
+
SF:src/visualize.js
|
|
265
|
+
FN:25,plotBoundingBoxes
|
|
266
|
+
FN:39,(anonymous_1)
|
|
267
|
+
FN:66,overlayMask
|
|
268
|
+
FN:100,plotSegmentationMasks
|
|
269
|
+
FN:113,(anonymous_4)
|
|
270
|
+
FN:122,(anonymous_5)
|
|
271
|
+
FN:145,loadImageToCanvas
|
|
272
|
+
FN:171,saveCanvas
|
|
273
|
+
FNF:8
|
|
274
|
+
FNH:0
|
|
275
|
+
FNDA:0,plotBoundingBoxes
|
|
276
|
+
FNDA:0,(anonymous_1)
|
|
277
|
+
FNDA:0,overlayMask
|
|
278
|
+
FNDA:0,plotSegmentationMasks
|
|
279
|
+
FNDA:0,(anonymous_4)
|
|
280
|
+
FNDA:0,(anonymous_5)
|
|
281
|
+
FNDA:0,loadImageToCanvas
|
|
282
|
+
FNDA:0,saveCanvas
|
|
283
|
+
DA:5,2
|
|
284
|
+
DA:6,2
|
|
285
|
+
DA:7,2
|
|
286
|
+
DA:10,2
|
|
287
|
+
DA:30,0
|
|
288
|
+
DA:32,0
|
|
289
|
+
DA:33,0
|
|
290
|
+
DA:34,0
|
|
291
|
+
DA:36,0
|
|
292
|
+
DA:37,0
|
|
293
|
+
DA:39,0
|
|
294
|
+
DA:40,0
|
|
295
|
+
DA:41,0
|
|
296
|
+
DA:44,0
|
|
297
|
+
DA:45,0
|
|
298
|
+
DA:48,0
|
|
299
|
+
DA:49,0
|
|
300
|
+
DA:50,0
|
|
301
|
+
DA:54,0
|
|
302
|
+
DA:67,0
|
|
303
|
+
DA:68,0
|
|
304
|
+
DA:69,0
|
|
305
|
+
DA:72,0
|
|
306
|
+
DA:73,0
|
|
307
|
+
DA:74,0
|
|
308
|
+
DA:75,0
|
|
309
|
+
DA:78,0
|
|
310
|
+
DA:79,0
|
|
311
|
+
DA:80,0
|
|
312
|
+
DA:81,0
|
|
313
|
+
DA:82,0
|
|
314
|
+
DA:84,0
|
|
315
|
+
DA:85,0
|
|
316
|
+
DA:86,0
|
|
317
|
+
DA:90,0
|
|
318
|
+
DA:106,0
|
|
319
|
+
DA:108,0
|
|
320
|
+
DA:109,0
|
|
321
|
+
DA:110,0
|
|
322
|
+
DA:113,0
|
|
323
|
+
DA:114,0
|
|
324
|
+
DA:115,0
|
|
325
|
+
DA:119,0
|
|
326
|
+
DA:120,0
|
|
327
|
+
DA:122,0
|
|
328
|
+
DA:123,0
|
|
329
|
+
DA:126,0
|
|
330
|
+
DA:127,0
|
|
331
|
+
DA:130,0
|
|
332
|
+
DA:131,0
|
|
333
|
+
DA:132,0
|
|
334
|
+
DA:136,0
|
|
335
|
+
DA:146,0
|
|
336
|
+
DA:149,0
|
|
337
|
+
DA:150,0
|
|
338
|
+
DA:152,0
|
|
339
|
+
DA:153,0
|
|
340
|
+
DA:154,0
|
|
341
|
+
DA:155,0
|
|
342
|
+
DA:159,0
|
|
343
|
+
DA:160,0
|
|
344
|
+
DA:161,0
|
|
345
|
+
DA:163,0
|
|
346
|
+
DA:172,0
|
|
347
|
+
DA:173,0
|
|
348
|
+
DA:176,2
|
|
349
|
+
LF:66
|
|
350
|
+
LH:5
|
|
351
|
+
BRDA:25,0,0,0
|
|
352
|
+
BRDA:27,1,0,0
|
|
353
|
+
BRDA:28,2,0,0
|
|
354
|
+
BRDA:29,3,0,0
|
|
355
|
+
BRDA:48,4,0,0
|
|
356
|
+
BRDA:48,4,1,0
|
|
357
|
+
BRDA:48,5,0,0
|
|
358
|
+
BRDA:48,5,1,0
|
|
359
|
+
BRDA:80,6,0,0
|
|
360
|
+
BRDA:80,6,1,0
|
|
361
|
+
BRDA:100,7,0,0
|
|
362
|
+
BRDA:102,8,0,0
|
|
363
|
+
BRDA:103,9,0,0
|
|
364
|
+
BRDA:104,10,0,0
|
|
365
|
+
BRDA:105,11,0,0
|
|
366
|
+
BRDA:130,12,0,0
|
|
367
|
+
BRDA:130,12,1,0
|
|
368
|
+
BRDA:130,13,0,0
|
|
369
|
+
BRDA:130,13,1,0
|
|
370
|
+
BRDA:145,14,0,0
|
|
371
|
+
BRDA:152,15,0,0
|
|
372
|
+
BRDA:152,15,1,0
|
|
373
|
+
BRDA:152,16,0,0
|
|
374
|
+
BRDA:152,16,1,0
|
|
375
|
+
BRF:24
|
|
376
|
+
BRH:0
|
|
377
|
+
end_of_record
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
testEnvironment: 'node',
|
|
3
|
+
testMatch: ['**/test/**/*.test.js'],
|
|
4
|
+
coverageDirectory: 'coverage',
|
|
5
|
+
collectCoverageFrom: [
|
|
6
|
+
'src/**/*.js',
|
|
7
|
+
'!src/index.d.ts',
|
|
8
|
+
'!src/**/*.test.js'
|
|
9
|
+
],
|
|
10
|
+
coveragePathIgnorePatterns: [
|
|
11
|
+
'/node_modules/'
|
|
12
|
+
],
|
|
13
|
+
verbose: true,
|
|
14
|
+
testTimeout: 10000
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vsegments",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Visual segmentation and bounding box detection using Google Gemini AI",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
"vsegments": "./bin/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "
|
|
11
|
+
"test": "jest",
|
|
12
|
+
"test:watch": "jest --watch",
|
|
13
|
+
"test:coverage": "jest --coverage",
|
|
14
|
+
"pre-deploy": "node scripts/pre-deploy.js",
|
|
12
15
|
"lint": "eslint src/**/*.js",
|
|
13
16
|
"format": "prettier --write \"src/**/*.js\""
|
|
14
17
|
},
|
|
@@ -40,5 +43,9 @@
|
|
|
40
43
|
"@google/generative-ai": "^0.21.0",
|
|
41
44
|
"canvas": "^2.11.2",
|
|
42
45
|
"commander": "^12.0.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/jest": "^30.0.0",
|
|
49
|
+
"jest": "^30.2.0"
|
|
43
50
|
}
|
|
44
51
|
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pre-deployment verification script
|
|
5
|
+
* Run this before publishing to npm to ensure everything is ready
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { execSync } = require('child_process');
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
console.log('🔍 Running pre-deployment checks...\n');
|
|
13
|
+
|
|
14
|
+
let hasErrors = false;
|
|
15
|
+
|
|
16
|
+
// Check 1: Run tests
|
|
17
|
+
console.log('1️⃣ Running tests...');
|
|
18
|
+
try {
|
|
19
|
+
execSync('npm test', { stdio: 'inherit' });
|
|
20
|
+
console.log('✅ All tests passed\n');
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error('❌ Tests failed\n');
|
|
23
|
+
hasErrors = true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Check 2: Check for required files
|
|
27
|
+
console.log('2️⃣ Checking required files...');
|
|
28
|
+
const requiredFiles = [
|
|
29
|
+
'package.json',
|
|
30
|
+
'README.md',
|
|
31
|
+
'LICENSE',
|
|
32
|
+
'src/index.js',
|
|
33
|
+
'src/core.js',
|
|
34
|
+
'src/models.js',
|
|
35
|
+
'src/utils.js',
|
|
36
|
+
'bin/cli.js'
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
let allFilesExist = true;
|
|
40
|
+
for (const file of requiredFiles) {
|
|
41
|
+
if (!fs.existsSync(path.join(__dirname, '..', file))) {
|
|
42
|
+
console.error(`❌ Missing required file: ${file}`);
|
|
43
|
+
allFilesExist = false;
|
|
44
|
+
hasErrors = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (allFilesExist) {
|
|
48
|
+
console.log('✅ All required files present\n');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Check 3: Verify package.json
|
|
52
|
+
console.log('3️⃣ Verifying package.json...');
|
|
53
|
+
const pkg = require('../package.json');
|
|
54
|
+
const requiredFields = ['name', 'version', 'description', 'main', 'author', 'license'];
|
|
55
|
+
let allFieldsPresent = true;
|
|
56
|
+
|
|
57
|
+
for (const field of requiredFields) {
|
|
58
|
+
if (!pkg[field]) {
|
|
59
|
+
console.error(`❌ Missing required field in package.json: ${field}`);
|
|
60
|
+
allFieldsPresent = false;
|
|
61
|
+
hasErrors = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (allFieldsPresent) {
|
|
65
|
+
console.log('✅ package.json is valid\n');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Check 4: Verify dependencies
|
|
69
|
+
console.log('4️⃣ Checking dependencies...');
|
|
70
|
+
const requiredDeps = ['@google/generative-ai', 'canvas', 'commander'];
|
|
71
|
+
let allDepsPresent = true;
|
|
72
|
+
|
|
73
|
+
for (const dep of requiredDeps) {
|
|
74
|
+
if (!pkg.dependencies || !pkg.dependencies[dep]) {
|
|
75
|
+
console.error(`❌ Missing required dependency: ${dep}`);
|
|
76
|
+
allDepsPresent = false;
|
|
77
|
+
hasErrors = true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (allDepsPresent) {
|
|
81
|
+
console.log('✅ All dependencies present\n');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Check 5: Test coverage
|
|
85
|
+
console.log('5️⃣ Running test coverage...');
|
|
86
|
+
try {
|
|
87
|
+
execSync('npm run test:coverage -- --silent', { stdio: 'pipe' });
|
|
88
|
+
console.log('✅ Coverage report generated\n');
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error('❌ Coverage check failed\n');
|
|
91
|
+
hasErrors = true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Final result
|
|
95
|
+
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
96
|
+
if (hasErrors) {
|
|
97
|
+
console.log('❌ Pre-deployment checks failed!');
|
|
98
|
+
console.log('Please fix the issues above before deploying.\n');
|
|
99
|
+
process.exit(1);
|
|
100
|
+
} else {
|
|
101
|
+
console.log('✅ All pre-deployment checks passed!');
|
|
102
|
+
console.log('Your package is ready to deploy.\n');
|
|
103
|
+
console.log('To publish to npm, run: npm publish\n');
|
|
104
|
+
process.exit(0);
|
|
105
|
+
}
|
package/src/core.js
CHANGED
|
@@ -32,7 +32,7 @@ class VSegments {
|
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
this.model = options.model || 'gemini-
|
|
35
|
+
this.model = options.model || 'gemini-3-pro-preview';
|
|
36
36
|
this.temperature = options.temperature !== undefined ? options.temperature : 0.5;
|
|
37
37
|
this.maxObjects = options.maxObjects || 25;
|
|
38
38
|
|
|
@@ -131,15 +131,25 @@ If an object is present multiple times, name them according to their unique char
|
|
|
131
131
|
});
|
|
132
132
|
|
|
133
133
|
// Generate content
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
let result, response, text;
|
|
135
|
+
try {
|
|
136
|
+
result = await model.generateContent({
|
|
137
|
+
contents: [{ role: 'user', parts: [{ text: prompt }, image] }],
|
|
138
|
+
generationConfig: {
|
|
139
|
+
temperature: this.temperature,
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
response = result.response;
|
|
144
|
+
text = response.text();
|
|
145
|
+
} catch (error) {
|
|
146
|
+
if (error.status === 500) {
|
|
147
|
+
throw new Error(
|
|
148
|
+
`Google Gemini API error (500): This may be a temporary issue. Try again later or verify your API key and image. Original error: ${error.message}`
|
|
149
|
+
);
|
|
138
150
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const response = result.response;
|
|
142
|
-
const text = response.text();
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
143
153
|
|
|
144
154
|
// Parse response
|
|
145
155
|
const boxes = parseBoundingBoxes(text);
|
|
@@ -176,15 +186,25 @@ If an object is present multiple times, name them according to their unique char
|
|
|
176
186
|
});
|
|
177
187
|
|
|
178
188
|
// Generate content
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
189
|
+
let result, response, text;
|
|
190
|
+
try {
|
|
191
|
+
result = await model.generateContent({
|
|
192
|
+
contents: [{ role: 'user', parts: [{ text: prompt }, image] }],
|
|
193
|
+
generationConfig: {
|
|
194
|
+
temperature: this.temperature,
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
response = result.response;
|
|
199
|
+
text = response.text();
|
|
200
|
+
} catch (error) {
|
|
201
|
+
if (error.status === 500) {
|
|
202
|
+
throw new Error(
|
|
203
|
+
`Google Gemini API error (500): This may be a temporary issue. Try again later or verify your API key and image. Original error: ${error.message}`
|
|
204
|
+
);
|
|
183
205
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const response = result.response;
|
|
187
|
-
const text = response.text();
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
188
208
|
|
|
189
209
|
// Parse response
|
|
190
210
|
const boxes = parseBoundingBoxes(text);
|