sumulige-claude 1.1.0 → 1.1.1

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.
@@ -0,0 +1,408 @@
1
+ /**
2
+ * Configuration Schema Definitions
3
+ *
4
+ * JSON Schema definitions for validating sumulige-claude configuration files.
5
+ * Uses JSON Schema Draft 7 specification.
6
+ *
7
+ * @module lib/config-schema
8
+ */
9
+
10
+ /**
11
+ * Main configuration schema
12
+ * Defines the structure and validation rules for ~/.claude/config.json
13
+ */
14
+ const CONFIG_SCHEMA = {
15
+ $id: 'https://sumulige-claude.com/schemas/config.json',
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Sumulige Claude Configuration',
18
+ description: 'Configuration for sumulige-claude CLI tool',
19
+
20
+ type: 'object',
21
+ required: ['version'],
22
+ additionalProperties: true,
23
+
24
+ properties: {
25
+ // Version - semantic version format
26
+ version: {
27
+ type: 'string',
28
+ pattern: '^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$',
29
+ description: 'Semantic version (e.g., 1.0.7 or 1.0.7-beta)',
30
+ },
31
+
32
+ // Model selection
33
+ model: {
34
+ type: 'string',
35
+ enum: [
36
+ 'claude-opus-4.5',
37
+ 'claude-opus-4-20250514',
38
+ 'claude-opus-4-5-20251101',
39
+ 'claude-sonnet-4.5',
40
+ 'claude-sonnet-4-20250514',
41
+ 'claude-sonnet-4-5-20251101',
42
+ 'claude-haiku-4.5'
43
+ ],
44
+ description: 'Claude model identifier to use'
45
+ },
46
+
47
+ // Agents configuration
48
+ agents: {
49
+ type: 'object',
50
+ description: 'Agent role definitions',
51
+ patternProperties: {
52
+ '^[a-z][a-z0-9-]*$': {
53
+ type: 'object',
54
+ required: ['role'],
55
+ properties: {
56
+ role: {
57
+ type: 'string',
58
+ minLength: 1,
59
+ description: 'Agent role description'
60
+ },
61
+ model: {
62
+ type: 'string',
63
+ description: 'Override default model for this agent'
64
+ }
65
+ },
66
+ additionalProperties: true
67
+ }
68
+ },
69
+ additionalProperties: true
70
+ },
71
+
72
+ // Skills array
73
+ skills: {
74
+ type: 'array',
75
+ description: 'External skill repositories to include',
76
+ items: {
77
+ type: 'string',
78
+ pattern: '^[a-zA-Z0-9_-]+/[a-zA-Z0-9_.-]+$',
79
+ description: 'Skill repository in format owner/name'
80
+ },
81
+ uniqueItems: true
82
+ },
83
+
84
+ // Hooks configuration
85
+ hooks: {
86
+ type: 'object',
87
+ description: 'Hook configuration',
88
+ properties: {
89
+ preTask: {
90
+ type: 'array',
91
+ description: 'Hooks to run before a task',
92
+ items: { type: 'string' }
93
+ },
94
+ postTask: {
95
+ type: 'array',
96
+ description: 'Hooks to run after a task',
97
+ items: { type: 'string' }
98
+ }
99
+ },
100
+ additionalProperties: true
101
+ },
102
+
103
+ // ThinkingLens configuration
104
+ thinkingLens: {
105
+ type: 'object',
106
+ description: 'ThinkingLens auto-memory system settings',
107
+ properties: {
108
+ enabled: {
109
+ type: 'boolean',
110
+ description: 'Enable ThinkingLens'
111
+ },
112
+ autoSync: {
113
+ type: 'boolean',
114
+ description: 'Automatically sync thinking routes'
115
+ },
116
+ syncInterval: {
117
+ type: 'integer',
118
+ minimum: 1,
119
+ maximum: 300,
120
+ description: 'Sync interval in conversations (1-300)'
121
+ }
122
+ },
123
+ additionalProperties: true
124
+ },
125
+
126
+ // Quality gate configuration
127
+ qualityGate: {
128
+ type: 'object',
129
+ description: 'Quality gate settings',
130
+ properties: {
131
+ enabled: {
132
+ type: 'boolean',
133
+ description: 'Enable quality gate'
134
+ },
135
+ severity: {
136
+ type: 'string',
137
+ enum: ['info', 'warn', 'error', 'critical'],
138
+ description: 'Minimum severity level for blocking'
139
+ },
140
+ rules: {
141
+ type: 'array',
142
+ description: 'Custom rule configurations',
143
+ items: {
144
+ type: 'object',
145
+ required: ['id'],
146
+ properties: {
147
+ id: { type: 'string' },
148
+ enabled: { type: 'boolean' },
149
+ severity: {
150
+ type: 'string',
151
+ enum: ['info', 'warn', 'error', 'critical']
152
+ },
153
+ config: { type: 'object' }
154
+ }
155
+ }
156
+ },
157
+ gates: {
158
+ type: 'object',
159
+ description: 'Gate trigger points',
160
+ properties: {
161
+ preCommit: { type: 'boolean' },
162
+ prePush: { type: 'boolean' },
163
+ onToolUse: { type: 'boolean' }
164
+ },
165
+ additionalProperties: true
166
+ },
167
+ reporting: {
168
+ type: 'object',
169
+ description: 'Report settings',
170
+ properties: {
171
+ format: {
172
+ type: 'string',
173
+ enum: ['console', 'json', 'markdown', 'html']
174
+ },
175
+ outputFile: { type: 'string' }
176
+ },
177
+ additionalProperties: true
178
+ }
179
+ },
180
+ additionalProperties: true
181
+ },
182
+
183
+ // Marketplace configuration
184
+ marketplace: {
185
+ type: 'object',
186
+ description: 'Skill marketplace settings',
187
+ properties: {
188
+ enabled: {
189
+ type: 'boolean',
190
+ description: 'Enable skill marketplace'
191
+ },
192
+ autoSync: {
193
+ type: 'boolean',
194
+ description: 'Auto-sync from external sources'
195
+ },
196
+ syncInterval: {
197
+ type: 'integer',
198
+ minimum: 1,
199
+ maximum: 1440,
200
+ description: 'Sync interval in minutes (1-1440)'
201
+ },
202
+ sources: {
203
+ type: 'array',
204
+ description: 'External skill sources',
205
+ items: {
206
+ type: 'string',
207
+ format: 'uri'
208
+ }
209
+ }
210
+ },
211
+ additionalProperties: true
212
+ }
213
+ },
214
+
215
+ additionalProperties: true
216
+ };
217
+
218
+ /**
219
+ * Project-level settings schema
220
+ * For .claude/settings.json in project directories
221
+ */
222
+ const SETTINGS_SCHEMA = {
223
+ $id: 'https://sumulige-claude.com/schemas/settings.json',
224
+ $schema: 'http://json-schema.org/draft-07/schema#',
225
+ title: 'Project Settings',
226
+ description: 'Claude Code project-specific settings',
227
+
228
+ type: 'object',
229
+
230
+ patternProperties: {
231
+ // Hook event names
232
+ '^(UserPromptSubmit|PreToolUse|PostToolUse|AgentStop|SessionEnd)$': {
233
+ type: 'array',
234
+ description: 'Hooks for this event',
235
+ items: {
236
+ type: 'object',
237
+ required: ['hooks'],
238
+ properties: {
239
+ matcher: {
240
+ oneOf: [
241
+ { type: 'string' },
242
+ { type: 'object' }
243
+ ]
244
+ },
245
+ hooks: {
246
+ type: 'array',
247
+ items: {
248
+ type: 'object',
249
+ required: ['type', 'command'],
250
+ properties: {
251
+ type: {
252
+ type: 'string',
253
+ enum: ['command']
254
+ },
255
+ command: {
256
+ type: 'string',
257
+ description: 'Command to execute'
258
+ },
259
+ timeout: {
260
+ type: 'number',
261
+ minimum: 100,
262
+ maximum: 60000,
263
+ description: 'Timeout in milliseconds'
264
+ }
265
+ },
266
+ additionalProperties: true
267
+ }
268
+ }
269
+ }
270
+ }
271
+ }
272
+ },
273
+
274
+ additionalProperties: true
275
+ };
276
+
277
+ /**
278
+ * Quality gate configuration schema
279
+ * For .claude/quality-gate.json
280
+ */
281
+ const QUALITY_GATE_SCHEMA = {
282
+ $id: 'https://sumulige-claude.com/schemas/quality-gate.json',
283
+ $schema: 'http://json-schema.org/draft-07/schema#',
284
+ title: 'Quality Gate Configuration',
285
+ description: 'Quality gate rules and settings',
286
+
287
+ type: 'object',
288
+
289
+ properties: {
290
+ enabled: {
291
+ type: 'boolean',
292
+ description: 'Enable quality gate'
293
+ },
294
+ severity: {
295
+ type: 'string',
296
+ enum: ['info', 'warn', 'error', 'critical'],
297
+ description: 'Minimum severity level for blocking',
298
+ default: 'warn'
299
+ },
300
+ rules: {
301
+ type: 'array',
302
+ description: 'Rule configurations',
303
+ items: {
304
+ type: 'object',
305
+ required: ['id'],
306
+ properties: {
307
+ id: {
308
+ type: 'string',
309
+ description: 'Rule identifier'
310
+ },
311
+ name: {
312
+ type: 'string',
313
+ description: 'Human-readable rule name'
314
+ },
315
+ enabled: {
316
+ type: 'boolean',
317
+ description: 'Whether the rule is enabled',
318
+ default: true
319
+ },
320
+ severity: {
321
+ type: 'string',
322
+ enum: ['info', 'warn', 'error', 'critical'],
323
+ description: 'Rule severity level',
324
+ default: 'warn'
325
+ },
326
+ config: {
327
+ type: 'object',
328
+ description: 'Rule-specific configuration'
329
+ }
330
+ }
331
+ }
332
+ },
333
+ gates: {
334
+ type: 'object',
335
+ description: 'Gate trigger points',
336
+ properties: {
337
+ preCommit: {
338
+ type: 'boolean',
339
+ description: 'Run on pre-commit',
340
+ default: true
341
+ },
342
+ prePush: {
343
+ type: 'boolean',
344
+ description: 'Run on pre-push',
345
+ default: true
346
+ },
347
+ onToolUse: {
348
+ type: 'boolean',
349
+ description: 'Run after tool use',
350
+ default: false
351
+ }
352
+ },
353
+ additionalProperties: true
354
+ },
355
+ reporting: {
356
+ type: 'object',
357
+ description: 'Report settings',
358
+ properties: {
359
+ format: {
360
+ type: 'string',
361
+ enum: ['console', 'json', 'markdown', 'html'],
362
+ default: 'console'
363
+ },
364
+ outputFile: {
365
+ type: 'string',
366
+ description: 'Output file path'
367
+ }
368
+ },
369
+ additionalProperties: true
370
+ }
371
+ },
372
+
373
+ additionalProperties: true
374
+ };
375
+
376
+ /**
377
+ * Get schema by name
378
+ * @param {string} name - Schema name ('config' | 'settings' | 'quality-gate')
379
+ * @returns {Object} JSON Schema object
380
+ */
381
+ function getSchema(name) {
382
+ const schemas = {
383
+ config: CONFIG_SCHEMA,
384
+ settings: SETTINGS_SCHEMA,
385
+ 'quality-gate': QUALITY_GATE_SCHEMA
386
+ };
387
+ return schemas[name];
388
+ }
389
+
390
+ /**
391
+ * Get all available schemas
392
+ * @returns {Object} Map of schema name to schema object
393
+ */
394
+ function getAllSchemas() {
395
+ return {
396
+ config: CONFIG_SCHEMA,
397
+ settings: SETTINGS_SCHEMA,
398
+ 'quality-gate': QUALITY_GATE_SCHEMA
399
+ };
400
+ }
401
+
402
+ module.exports = {
403
+ CONFIG_SCHEMA,
404
+ SETTINGS_SCHEMA,
405
+ QUALITY_GATE_SCHEMA,
406
+ getSchema,
407
+ getAllSchemas
408
+ };