@asagiri-design/labels-config 0.2.2
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/LICENSE +21 -0
- package/README.ja.md +387 -0
- package/README.md +387 -0
- package/dist/chunk-4ZUJQMV7.mjs +285 -0
- package/dist/chunk-DGUMSQAI.mjs +496 -0
- package/dist/chunk-DSI7SDAM.mjs +161 -0
- package/dist/chunk-QJLMZSVA.mjs +496 -0
- package/dist/chunk-QZ7TP4HQ.mjs +7 -0
- package/dist/chunk-VU2JB66N.mjs +103 -0
- package/dist/chunk-ZYHIDOG2.mjs +247 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1417 -0
- package/dist/cli.mjs +436 -0
- package/dist/config/index.d.mts +49 -0
- package/dist/config/index.d.ts +49 -0
- package/dist/config/index.js +554 -0
- package/dist/config/index.mjs +10 -0
- package/dist/github/index.d.mts +113 -0
- package/dist/github/index.d.ts +113 -0
- package/dist/github/index.js +310 -0
- package/dist/github/index.mjs +9 -0
- package/dist/index.d.mts +309 -0
- package/dist/index.d.ts +309 -0
- package/dist/index.js +306 -0
- package/dist/index.mjs +44 -0
- package/dist/types-CkwsO1Iu.d.mts +50 -0
- package/dist/types-CkwsO1Iu.d.ts +50 -0
- package/docs/API.md +309 -0
- package/docs/GETTING_STARTED.md +305 -0
- package/package.json +87 -0
- package/templates/prod-labels.json +106 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { L as LabelConfig, H as HexColor, a as LabelRegistry } from './types-CkwsO1Iu.mjs';
|
|
2
|
+
export { b as LabelCategory, f as flattenLabels, i as isCategorized } from './types-CkwsO1Iu.mjs';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Label Validation Schema
|
|
7
|
+
* Uses Zod for runtime validation with TypeScript type safety
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Label configuration schema
|
|
12
|
+
*/
|
|
13
|
+
declare const labelConfigSchema: z.ZodObject<{
|
|
14
|
+
name: z.ZodString;
|
|
15
|
+
color: z.ZodType<HexColor, z.ZodTypeDef, HexColor>;
|
|
16
|
+
description: z.ZodString;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
name: string;
|
|
19
|
+
color: string & {
|
|
20
|
+
readonly __brand: "HexColor";
|
|
21
|
+
};
|
|
22
|
+
description: string;
|
|
23
|
+
}, {
|
|
24
|
+
name: string;
|
|
25
|
+
color: string & {
|
|
26
|
+
readonly __brand: "HexColor";
|
|
27
|
+
};
|
|
28
|
+
description: string;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Label category schema
|
|
32
|
+
*/
|
|
33
|
+
declare const labelCategorySchema: z.ZodObject<{
|
|
34
|
+
category: z.ZodString;
|
|
35
|
+
labels: z.ZodArray<z.ZodObject<{
|
|
36
|
+
name: z.ZodString;
|
|
37
|
+
color: z.ZodType<HexColor, z.ZodTypeDef, HexColor>;
|
|
38
|
+
description: z.ZodString;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
name: string;
|
|
41
|
+
color: string & {
|
|
42
|
+
readonly __brand: "HexColor";
|
|
43
|
+
};
|
|
44
|
+
description: string;
|
|
45
|
+
}, {
|
|
46
|
+
name: string;
|
|
47
|
+
color: string & {
|
|
48
|
+
readonly __brand: "HexColor";
|
|
49
|
+
};
|
|
50
|
+
description: string;
|
|
51
|
+
}>, "many">;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
labels: {
|
|
54
|
+
name: string;
|
|
55
|
+
color: string & {
|
|
56
|
+
readonly __brand: "HexColor";
|
|
57
|
+
};
|
|
58
|
+
description: string;
|
|
59
|
+
}[];
|
|
60
|
+
category: string;
|
|
61
|
+
}, {
|
|
62
|
+
labels: {
|
|
63
|
+
name: string;
|
|
64
|
+
color: string & {
|
|
65
|
+
readonly __brand: "HexColor";
|
|
66
|
+
};
|
|
67
|
+
description: string;
|
|
68
|
+
}[];
|
|
69
|
+
category: string;
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* Label registry schema
|
|
73
|
+
*/
|
|
74
|
+
declare const labelRegistrySchema: z.ZodObject<{
|
|
75
|
+
version: z.ZodString;
|
|
76
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
77
|
+
labels: z.ZodUnion<[z.ZodArray<z.ZodObject<{
|
|
78
|
+
name: z.ZodString;
|
|
79
|
+
color: z.ZodType<HexColor, z.ZodTypeDef, HexColor>;
|
|
80
|
+
description: z.ZodString;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
name: string;
|
|
83
|
+
color: string & {
|
|
84
|
+
readonly __brand: "HexColor";
|
|
85
|
+
};
|
|
86
|
+
description: string;
|
|
87
|
+
}, {
|
|
88
|
+
name: string;
|
|
89
|
+
color: string & {
|
|
90
|
+
readonly __brand: "HexColor";
|
|
91
|
+
};
|
|
92
|
+
description: string;
|
|
93
|
+
}>, "many">, z.ZodArray<z.ZodObject<{
|
|
94
|
+
category: z.ZodString;
|
|
95
|
+
labels: z.ZodArray<z.ZodObject<{
|
|
96
|
+
name: z.ZodString;
|
|
97
|
+
color: z.ZodType<HexColor, z.ZodTypeDef, HexColor>;
|
|
98
|
+
description: z.ZodString;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
name: string;
|
|
101
|
+
color: string & {
|
|
102
|
+
readonly __brand: "HexColor";
|
|
103
|
+
};
|
|
104
|
+
description: string;
|
|
105
|
+
}, {
|
|
106
|
+
name: string;
|
|
107
|
+
color: string & {
|
|
108
|
+
readonly __brand: "HexColor";
|
|
109
|
+
};
|
|
110
|
+
description: string;
|
|
111
|
+
}>, "many">;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
labels: {
|
|
114
|
+
name: string;
|
|
115
|
+
color: string & {
|
|
116
|
+
readonly __brand: "HexColor";
|
|
117
|
+
};
|
|
118
|
+
description: string;
|
|
119
|
+
}[];
|
|
120
|
+
category: string;
|
|
121
|
+
}, {
|
|
122
|
+
labels: {
|
|
123
|
+
name: string;
|
|
124
|
+
color: string & {
|
|
125
|
+
readonly __brand: "HexColor";
|
|
126
|
+
};
|
|
127
|
+
description: string;
|
|
128
|
+
}[];
|
|
129
|
+
category: string;
|
|
130
|
+
}>, "many">]>;
|
|
131
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
labels: {
|
|
134
|
+
name: string;
|
|
135
|
+
color: string & {
|
|
136
|
+
readonly __brand: "HexColor";
|
|
137
|
+
};
|
|
138
|
+
description: string;
|
|
139
|
+
}[] | {
|
|
140
|
+
labels: {
|
|
141
|
+
name: string;
|
|
142
|
+
color: string & {
|
|
143
|
+
readonly __brand: "HexColor";
|
|
144
|
+
};
|
|
145
|
+
description: string;
|
|
146
|
+
}[];
|
|
147
|
+
category: string;
|
|
148
|
+
}[];
|
|
149
|
+
version: string;
|
|
150
|
+
timestamp?: string | undefined;
|
|
151
|
+
metadata?: Record<string, unknown> | undefined;
|
|
152
|
+
}, {
|
|
153
|
+
labels: {
|
|
154
|
+
name: string;
|
|
155
|
+
color: string & {
|
|
156
|
+
readonly __brand: "HexColor";
|
|
157
|
+
};
|
|
158
|
+
description: string;
|
|
159
|
+
}[] | {
|
|
160
|
+
labels: {
|
|
161
|
+
name: string;
|
|
162
|
+
color: string & {
|
|
163
|
+
readonly __brand: "HexColor";
|
|
164
|
+
};
|
|
165
|
+
description: string;
|
|
166
|
+
}[];
|
|
167
|
+
category: string;
|
|
168
|
+
}[];
|
|
169
|
+
version: string;
|
|
170
|
+
timestamp?: string | undefined;
|
|
171
|
+
metadata?: Record<string, unknown> | undefined;
|
|
172
|
+
}>;
|
|
173
|
+
/**
|
|
174
|
+
* Validates a single label configuration
|
|
175
|
+
*/
|
|
176
|
+
declare function validateLabel(label: unknown): LabelConfig;
|
|
177
|
+
/**
|
|
178
|
+
* Validates multiple labels
|
|
179
|
+
*/
|
|
180
|
+
declare function validateLabels(labels: unknown): LabelConfig[];
|
|
181
|
+
/**
|
|
182
|
+
* Validates a complete label registry
|
|
183
|
+
*/
|
|
184
|
+
declare function validateRegistry(registry: unknown): LabelRegistry;
|
|
185
|
+
/**
|
|
186
|
+
* Checks for duplicate label names
|
|
187
|
+
*/
|
|
188
|
+
declare function checkDuplicateNames(labels: LabelConfig[]): string[];
|
|
189
|
+
/**
|
|
190
|
+
* Checks for duplicate colors (case-insensitive)
|
|
191
|
+
* Normalizes colors before comparison to handle unparsed labels
|
|
192
|
+
*/
|
|
193
|
+
declare function checkDuplicateColors(labels: LabelConfig[]): string[];
|
|
194
|
+
/**
|
|
195
|
+
* Comprehensive validation with detailed error reporting
|
|
196
|
+
*/
|
|
197
|
+
declare function validateWithDetails(labels: unknown): {
|
|
198
|
+
valid: boolean;
|
|
199
|
+
labels: LabelConfig[];
|
|
200
|
+
errors: {
|
|
201
|
+
duplicateNames: string[];
|
|
202
|
+
duplicateColors: string[];
|
|
203
|
+
validationErrors?: undefined;
|
|
204
|
+
};
|
|
205
|
+
} | {
|
|
206
|
+
valid: boolean;
|
|
207
|
+
labels: never[];
|
|
208
|
+
errors: {
|
|
209
|
+
validationErrors: z.ZodIssue[];
|
|
210
|
+
duplicateNames?: undefined;
|
|
211
|
+
duplicateColors?: undefined;
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Label Manager
|
|
217
|
+
* Main class for managing label configurations
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
interface LabelManagerOptions {
|
|
221
|
+
/** Initial labels to load */
|
|
222
|
+
labels?: LabelConfig[];
|
|
223
|
+
/** Strict mode: fail on any validation error */
|
|
224
|
+
strict?: boolean;
|
|
225
|
+
}
|
|
226
|
+
declare class LabelManager {
|
|
227
|
+
private labels;
|
|
228
|
+
private strict;
|
|
229
|
+
constructor(options?: LabelManagerOptions);
|
|
230
|
+
/**
|
|
231
|
+
* Load labels from array
|
|
232
|
+
*/
|
|
233
|
+
loadLabels(labels: LabelConfig[]): void;
|
|
234
|
+
/**
|
|
235
|
+
* Load labels from registry object
|
|
236
|
+
*/
|
|
237
|
+
loadRegistry(registry: LabelRegistry): void;
|
|
238
|
+
/**
|
|
239
|
+
* Add a single label
|
|
240
|
+
*/
|
|
241
|
+
addLabel(label: LabelConfig): void;
|
|
242
|
+
/**
|
|
243
|
+
* Update an existing label
|
|
244
|
+
*/
|
|
245
|
+
updateLabel(name: string, updates: Partial<LabelConfig>): void;
|
|
246
|
+
/**
|
|
247
|
+
* Remove a label
|
|
248
|
+
*/
|
|
249
|
+
removeLabel(name: string): void;
|
|
250
|
+
/**
|
|
251
|
+
* Get a label by name
|
|
252
|
+
*/
|
|
253
|
+
getLabel(name: string): LabelConfig | undefined;
|
|
254
|
+
/**
|
|
255
|
+
* Check if label exists
|
|
256
|
+
*/
|
|
257
|
+
hasLabel(name: string): boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Get all labels
|
|
260
|
+
*/
|
|
261
|
+
getAllLabels(): LabelConfig[];
|
|
262
|
+
/**
|
|
263
|
+
* Get labels count
|
|
264
|
+
*/
|
|
265
|
+
count(): number;
|
|
266
|
+
/**
|
|
267
|
+
* Export labels as array
|
|
268
|
+
*/
|
|
269
|
+
export(): LabelConfig[];
|
|
270
|
+
/**
|
|
271
|
+
* Export as registry object
|
|
272
|
+
*/
|
|
273
|
+
exportRegistry(version?: string, metadata?: Record<string, unknown>): LabelRegistry;
|
|
274
|
+
/**
|
|
275
|
+
* Search labels by name or description
|
|
276
|
+
*/
|
|
277
|
+
search(query: string): LabelConfig[];
|
|
278
|
+
/**
|
|
279
|
+
* Find labels by color
|
|
280
|
+
*/
|
|
281
|
+
findByColor(color: string): LabelConfig[];
|
|
282
|
+
/**
|
|
283
|
+
* Clear all labels
|
|
284
|
+
*/
|
|
285
|
+
clear(): void;
|
|
286
|
+
/**
|
|
287
|
+
* Validate current state
|
|
288
|
+
*/
|
|
289
|
+
validate(): {
|
|
290
|
+
valid: boolean;
|
|
291
|
+
duplicates: string[];
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
declare const version = "0.2.2";
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @boxpistols/labels-config
|
|
299
|
+
* Comprehensive label management system for GitHub repositories
|
|
300
|
+
*/
|
|
301
|
+
|
|
302
|
+
declare const _default: {
|
|
303
|
+
LabelManager: typeof LabelManager;
|
|
304
|
+
validateLabels: typeof validateLabels;
|
|
305
|
+
validateWithDetails: typeof validateWithDetails;
|
|
306
|
+
version: string;
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
export { HexColor, LabelConfig, LabelManager, type LabelManagerOptions, LabelRegistry, checkDuplicateColors, checkDuplicateNames, _default as default, labelCategorySchema, labelConfigSchema, labelRegistrySchema, validateLabel, validateLabels, validateRegistry, validateWithDetails, version };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { L as LabelConfig, H as HexColor, a as LabelRegistry } from './types-CkwsO1Iu.js';
|
|
2
|
+
export { b as LabelCategory, f as flattenLabels, i as isCategorized } from './types-CkwsO1Iu.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Label Validation Schema
|
|
7
|
+
* Uses Zod for runtime validation with TypeScript type safety
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Label configuration schema
|
|
12
|
+
*/
|
|
13
|
+
declare const labelConfigSchema: z.ZodObject<{
|
|
14
|
+
name: z.ZodString;
|
|
15
|
+
color: z.ZodType<HexColor, z.ZodTypeDef, HexColor>;
|
|
16
|
+
description: z.ZodString;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
name: string;
|
|
19
|
+
color: string & {
|
|
20
|
+
readonly __brand: "HexColor";
|
|
21
|
+
};
|
|
22
|
+
description: string;
|
|
23
|
+
}, {
|
|
24
|
+
name: string;
|
|
25
|
+
color: string & {
|
|
26
|
+
readonly __brand: "HexColor";
|
|
27
|
+
};
|
|
28
|
+
description: string;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Label category schema
|
|
32
|
+
*/
|
|
33
|
+
declare const labelCategorySchema: z.ZodObject<{
|
|
34
|
+
category: z.ZodString;
|
|
35
|
+
labels: z.ZodArray<z.ZodObject<{
|
|
36
|
+
name: z.ZodString;
|
|
37
|
+
color: z.ZodType<HexColor, z.ZodTypeDef, HexColor>;
|
|
38
|
+
description: z.ZodString;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
name: string;
|
|
41
|
+
color: string & {
|
|
42
|
+
readonly __brand: "HexColor";
|
|
43
|
+
};
|
|
44
|
+
description: string;
|
|
45
|
+
}, {
|
|
46
|
+
name: string;
|
|
47
|
+
color: string & {
|
|
48
|
+
readonly __brand: "HexColor";
|
|
49
|
+
};
|
|
50
|
+
description: string;
|
|
51
|
+
}>, "many">;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
labels: {
|
|
54
|
+
name: string;
|
|
55
|
+
color: string & {
|
|
56
|
+
readonly __brand: "HexColor";
|
|
57
|
+
};
|
|
58
|
+
description: string;
|
|
59
|
+
}[];
|
|
60
|
+
category: string;
|
|
61
|
+
}, {
|
|
62
|
+
labels: {
|
|
63
|
+
name: string;
|
|
64
|
+
color: string & {
|
|
65
|
+
readonly __brand: "HexColor";
|
|
66
|
+
};
|
|
67
|
+
description: string;
|
|
68
|
+
}[];
|
|
69
|
+
category: string;
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* Label registry schema
|
|
73
|
+
*/
|
|
74
|
+
declare const labelRegistrySchema: z.ZodObject<{
|
|
75
|
+
version: z.ZodString;
|
|
76
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
77
|
+
labels: z.ZodUnion<[z.ZodArray<z.ZodObject<{
|
|
78
|
+
name: z.ZodString;
|
|
79
|
+
color: z.ZodType<HexColor, z.ZodTypeDef, HexColor>;
|
|
80
|
+
description: z.ZodString;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
name: string;
|
|
83
|
+
color: string & {
|
|
84
|
+
readonly __brand: "HexColor";
|
|
85
|
+
};
|
|
86
|
+
description: string;
|
|
87
|
+
}, {
|
|
88
|
+
name: string;
|
|
89
|
+
color: string & {
|
|
90
|
+
readonly __brand: "HexColor";
|
|
91
|
+
};
|
|
92
|
+
description: string;
|
|
93
|
+
}>, "many">, z.ZodArray<z.ZodObject<{
|
|
94
|
+
category: z.ZodString;
|
|
95
|
+
labels: z.ZodArray<z.ZodObject<{
|
|
96
|
+
name: z.ZodString;
|
|
97
|
+
color: z.ZodType<HexColor, z.ZodTypeDef, HexColor>;
|
|
98
|
+
description: z.ZodString;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
name: string;
|
|
101
|
+
color: string & {
|
|
102
|
+
readonly __brand: "HexColor";
|
|
103
|
+
};
|
|
104
|
+
description: string;
|
|
105
|
+
}, {
|
|
106
|
+
name: string;
|
|
107
|
+
color: string & {
|
|
108
|
+
readonly __brand: "HexColor";
|
|
109
|
+
};
|
|
110
|
+
description: string;
|
|
111
|
+
}>, "many">;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
labels: {
|
|
114
|
+
name: string;
|
|
115
|
+
color: string & {
|
|
116
|
+
readonly __brand: "HexColor";
|
|
117
|
+
};
|
|
118
|
+
description: string;
|
|
119
|
+
}[];
|
|
120
|
+
category: string;
|
|
121
|
+
}, {
|
|
122
|
+
labels: {
|
|
123
|
+
name: string;
|
|
124
|
+
color: string & {
|
|
125
|
+
readonly __brand: "HexColor";
|
|
126
|
+
};
|
|
127
|
+
description: string;
|
|
128
|
+
}[];
|
|
129
|
+
category: string;
|
|
130
|
+
}>, "many">]>;
|
|
131
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
labels: {
|
|
134
|
+
name: string;
|
|
135
|
+
color: string & {
|
|
136
|
+
readonly __brand: "HexColor";
|
|
137
|
+
};
|
|
138
|
+
description: string;
|
|
139
|
+
}[] | {
|
|
140
|
+
labels: {
|
|
141
|
+
name: string;
|
|
142
|
+
color: string & {
|
|
143
|
+
readonly __brand: "HexColor";
|
|
144
|
+
};
|
|
145
|
+
description: string;
|
|
146
|
+
}[];
|
|
147
|
+
category: string;
|
|
148
|
+
}[];
|
|
149
|
+
version: string;
|
|
150
|
+
timestamp?: string | undefined;
|
|
151
|
+
metadata?: Record<string, unknown> | undefined;
|
|
152
|
+
}, {
|
|
153
|
+
labels: {
|
|
154
|
+
name: string;
|
|
155
|
+
color: string & {
|
|
156
|
+
readonly __brand: "HexColor";
|
|
157
|
+
};
|
|
158
|
+
description: string;
|
|
159
|
+
}[] | {
|
|
160
|
+
labels: {
|
|
161
|
+
name: string;
|
|
162
|
+
color: string & {
|
|
163
|
+
readonly __brand: "HexColor";
|
|
164
|
+
};
|
|
165
|
+
description: string;
|
|
166
|
+
}[];
|
|
167
|
+
category: string;
|
|
168
|
+
}[];
|
|
169
|
+
version: string;
|
|
170
|
+
timestamp?: string | undefined;
|
|
171
|
+
metadata?: Record<string, unknown> | undefined;
|
|
172
|
+
}>;
|
|
173
|
+
/**
|
|
174
|
+
* Validates a single label configuration
|
|
175
|
+
*/
|
|
176
|
+
declare function validateLabel(label: unknown): LabelConfig;
|
|
177
|
+
/**
|
|
178
|
+
* Validates multiple labels
|
|
179
|
+
*/
|
|
180
|
+
declare function validateLabels(labels: unknown): LabelConfig[];
|
|
181
|
+
/**
|
|
182
|
+
* Validates a complete label registry
|
|
183
|
+
*/
|
|
184
|
+
declare function validateRegistry(registry: unknown): LabelRegistry;
|
|
185
|
+
/**
|
|
186
|
+
* Checks for duplicate label names
|
|
187
|
+
*/
|
|
188
|
+
declare function checkDuplicateNames(labels: LabelConfig[]): string[];
|
|
189
|
+
/**
|
|
190
|
+
* Checks for duplicate colors (case-insensitive)
|
|
191
|
+
* Normalizes colors before comparison to handle unparsed labels
|
|
192
|
+
*/
|
|
193
|
+
declare function checkDuplicateColors(labels: LabelConfig[]): string[];
|
|
194
|
+
/**
|
|
195
|
+
* Comprehensive validation with detailed error reporting
|
|
196
|
+
*/
|
|
197
|
+
declare function validateWithDetails(labels: unknown): {
|
|
198
|
+
valid: boolean;
|
|
199
|
+
labels: LabelConfig[];
|
|
200
|
+
errors: {
|
|
201
|
+
duplicateNames: string[];
|
|
202
|
+
duplicateColors: string[];
|
|
203
|
+
validationErrors?: undefined;
|
|
204
|
+
};
|
|
205
|
+
} | {
|
|
206
|
+
valid: boolean;
|
|
207
|
+
labels: never[];
|
|
208
|
+
errors: {
|
|
209
|
+
validationErrors: z.ZodIssue[];
|
|
210
|
+
duplicateNames?: undefined;
|
|
211
|
+
duplicateColors?: undefined;
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Label Manager
|
|
217
|
+
* Main class for managing label configurations
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
interface LabelManagerOptions {
|
|
221
|
+
/** Initial labels to load */
|
|
222
|
+
labels?: LabelConfig[];
|
|
223
|
+
/** Strict mode: fail on any validation error */
|
|
224
|
+
strict?: boolean;
|
|
225
|
+
}
|
|
226
|
+
declare class LabelManager {
|
|
227
|
+
private labels;
|
|
228
|
+
private strict;
|
|
229
|
+
constructor(options?: LabelManagerOptions);
|
|
230
|
+
/**
|
|
231
|
+
* Load labels from array
|
|
232
|
+
*/
|
|
233
|
+
loadLabels(labels: LabelConfig[]): void;
|
|
234
|
+
/**
|
|
235
|
+
* Load labels from registry object
|
|
236
|
+
*/
|
|
237
|
+
loadRegistry(registry: LabelRegistry): void;
|
|
238
|
+
/**
|
|
239
|
+
* Add a single label
|
|
240
|
+
*/
|
|
241
|
+
addLabel(label: LabelConfig): void;
|
|
242
|
+
/**
|
|
243
|
+
* Update an existing label
|
|
244
|
+
*/
|
|
245
|
+
updateLabel(name: string, updates: Partial<LabelConfig>): void;
|
|
246
|
+
/**
|
|
247
|
+
* Remove a label
|
|
248
|
+
*/
|
|
249
|
+
removeLabel(name: string): void;
|
|
250
|
+
/**
|
|
251
|
+
* Get a label by name
|
|
252
|
+
*/
|
|
253
|
+
getLabel(name: string): LabelConfig | undefined;
|
|
254
|
+
/**
|
|
255
|
+
* Check if label exists
|
|
256
|
+
*/
|
|
257
|
+
hasLabel(name: string): boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Get all labels
|
|
260
|
+
*/
|
|
261
|
+
getAllLabels(): LabelConfig[];
|
|
262
|
+
/**
|
|
263
|
+
* Get labels count
|
|
264
|
+
*/
|
|
265
|
+
count(): number;
|
|
266
|
+
/**
|
|
267
|
+
* Export labels as array
|
|
268
|
+
*/
|
|
269
|
+
export(): LabelConfig[];
|
|
270
|
+
/**
|
|
271
|
+
* Export as registry object
|
|
272
|
+
*/
|
|
273
|
+
exportRegistry(version?: string, metadata?: Record<string, unknown>): LabelRegistry;
|
|
274
|
+
/**
|
|
275
|
+
* Search labels by name or description
|
|
276
|
+
*/
|
|
277
|
+
search(query: string): LabelConfig[];
|
|
278
|
+
/**
|
|
279
|
+
* Find labels by color
|
|
280
|
+
*/
|
|
281
|
+
findByColor(color: string): LabelConfig[];
|
|
282
|
+
/**
|
|
283
|
+
* Clear all labels
|
|
284
|
+
*/
|
|
285
|
+
clear(): void;
|
|
286
|
+
/**
|
|
287
|
+
* Validate current state
|
|
288
|
+
*/
|
|
289
|
+
validate(): {
|
|
290
|
+
valid: boolean;
|
|
291
|
+
duplicates: string[];
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
declare const version = "0.2.2";
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @boxpistols/labels-config
|
|
299
|
+
* Comprehensive label management system for GitHub repositories
|
|
300
|
+
*/
|
|
301
|
+
|
|
302
|
+
declare const _default: {
|
|
303
|
+
LabelManager: typeof LabelManager;
|
|
304
|
+
validateLabels: typeof validateLabels;
|
|
305
|
+
validateWithDetails: typeof validateWithDetails;
|
|
306
|
+
version: string;
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
export { HexColor, LabelConfig, LabelManager, type LabelManagerOptions, LabelRegistry, checkDuplicateColors, checkDuplicateNames, _default as default, labelCategorySchema, labelConfigSchema, labelRegistrySchema, validateLabel, validateLabels, validateRegistry, validateWithDetails, version };
|