sumulige-claude 1.5.1 → 1.6.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 (223) hide show
  1. package/.claude/hooks/hook-registry.json +0 -15
  2. package/.claude/rules/coding-style.md +18 -7
  3. package/.claude/rules/hooks.md +15 -4
  4. package/.claude/rules/performance.md +15 -5
  5. package/.claude/rules/security.md +140 -4
  6. package/.claude/rules/testing.md +138 -9
  7. package/.claude/rules/web-design-standard.md +16 -5
  8. package/.claude/skills/algorithmic-art/metadata.yaml +28 -0
  9. package/.claude/skills/api-tester/SKILL.md +61 -0
  10. package/.claude/skills/api-tester/examples/basic.md +3 -0
  11. package/.claude/skills/api-tester/metadata.yaml +30 -0
  12. package/.claude/skills/api-tester/templates/default.md +3 -0
  13. package/.claude/skills/brand-guidelines/metadata.yaml +26 -0
  14. package/.claude/skills/canvas-design/metadata.yaml +27 -0
  15. package/.claude/skills/code-reviewer-123/SKILL.md +61 -0
  16. package/.claude/skills/code-reviewer-123/examples/basic.md +3 -0
  17. package/.claude/skills/code-reviewer-123/metadata.yaml +30 -0
  18. package/.claude/skills/code-reviewer-123/templates/default.md +3 -0
  19. package/.claude/skills/doc-coauthoring/metadata.yaml +27 -0
  20. package/.claude/skills/docx/metadata.yaml +30 -0
  21. package/.claude/skills/frontend-design/metadata.yaml +28 -0
  22. package/.claude/skills/internal-comms/metadata.yaml +28 -0
  23. package/.claude/skills/mcp-builder/metadata.yaml +26 -0
  24. package/.claude/skills/my-skill/SKILL.md +61 -0
  25. package/.claude/skills/my-skill/examples/basic.md +3 -0
  26. package/.claude/skills/my-skill/metadata.yaml +30 -0
  27. package/.claude/skills/my-skill/templates/default.md +3 -0
  28. package/.claude/skills/pdf/metadata.yaml +29 -0
  29. package/.claude/skills/pptx/metadata.yaml +29 -0
  30. package/.claude/skills/react-best-practices/metadata.yaml +26 -0
  31. package/.claude/skills/react-node-practices/SKILL.md +409 -0
  32. package/.claude/skills/react-node-practices/metadata.yaml +56 -0
  33. package/.claude/skills/skill-creator/metadata.yaml +25 -0
  34. package/.claude/skills/slack-gif-creator/metadata.yaml +28 -0
  35. package/.claude/skills/test-skill-name/SKILL.md +61 -0
  36. package/.claude/skills/test-skill-name/examples/basic.md +3 -0
  37. package/.claude/skills/test-skill-name/metadata.yaml +30 -0
  38. package/.claude/skills/test-skill-name/templates/default.md +3 -0
  39. package/.claude/skills/test-workflow/metadata.yaml +32 -0
  40. package/.claude/skills/theme-factory/metadata.yaml +26 -0
  41. package/.claude/skills/threejs-fundamentals/metadata.yaml +27 -0
  42. package/.claude/skills/web-artifacts-builder/metadata.yaml +30 -0
  43. package/.claude/skills/web-design-guidelines/metadata.yaml +26 -0
  44. package/.claude/skills/webapp-testing/metadata.yaml +26 -0
  45. package/.claude/skills/xlsx/metadata.yaml +29 -0
  46. package/LICENSE +21 -0
  47. package/README.md +280 -529
  48. package/cli.js +19 -3
  49. package/package.json +29 -3
  50. package/template/.codex/README.md +69 -0
  51. package/template/.codex/config.toml +56 -0
  52. package/template/AGENTS.md +94 -0
  53. package/.claude/.kickoff-hint.txt +0 -52
  54. package/.claude/.sumulige-claude-version +0 -1
  55. package/.claude/.version +0 -1
  56. package/.claude/AGENTS.md +0 -42
  57. package/.claude/ANCHORS.md +0 -40
  58. package/.claude/CLAUDE.md +0 -138
  59. package/.claude/MEMORY.md +0 -69
  60. package/.claude/PROJECT_LOG.md +0 -101
  61. package/.claude/THINKING_CHAIN_GUIDE.md +0 -287
  62. package/.claude/USAGE.md +0 -175
  63. package/.claude/boris-optimizations.md +0 -167
  64. package/.claude/handoffs/INDEX.md +0 -21
  65. package/.claude/handoffs/LATEST.md +0 -76
  66. package/.claude/handoffs/handoff_2026-01-22T13-07-04-757Z.md +0 -76
  67. package/.claude/quality-gate.json +0 -82
  68. package/.claude/rag/skill-index.json +0 -135
  69. package/.claude/settings.json +0 -99
  70. package/.claude/settings.local.json +0 -175
  71. package/.claude/templates/PROJECT_KICKOFF.md +0 -89
  72. package/.claude/templates/PROJECT_PROPOSAL.md +0 -227
  73. package/.claude/templates/TASK_PLAN.md +0 -121
  74. package/.claude/templates/hooks/README.md +0 -302
  75. package/.claude/templates/hooks/hook.sh.template +0 -94
  76. package/.claude/templates/hooks/user-prompt-submit.cjs.template +0 -116
  77. package/.claude/templates/hooks/user-response-submit.cjs.template +0 -94
  78. package/.claude/templates/hooks/validate.js +0 -173
  79. package/.claude/templates/tasks/develop.md +0 -69
  80. package/.claude/templates/tasks/research.md +0 -64
  81. package/.claude/templates/tasks/test.md +0 -96
  82. package/.claude/thinking-routes/.last-sync +0 -1
  83. package/.claude/thinking-routes/QUICKREF.md +0 -98
  84. package/.claude/workflow/document-scanner.js +0 -426
  85. package/.claude/workflow/knowledge-engine.js +0 -941
  86. package/.claude/workflow/notebooklm/browser.js +0 -1028
  87. package/.claude/workflow/phases/phase1-research.js +0 -578
  88. package/.claude/workflow/phases/phase1-research.ts +0 -465
  89. package/.claude/workflow/phases/phase2-approve.js +0 -722
  90. package/.claude/workflow/phases/phase3-plan.js +0 -1200
  91. package/.claude/workflow/phases/phase4-develop.js +0 -894
  92. package/.claude/workflow/search-cache.js +0 -230
  93. package/.claude/workflow/templates/approval.md +0 -315
  94. package/.claude/workflow/templates/development.md +0 -377
  95. package/.claude/workflow/templates/planning.md +0 -328
  96. package/.claude/workflow/templates/research.md +0 -250
  97. package/.claude/workflow/types.js +0 -37
  98. package/.claude/workflow/web-search.js +0 -278
  99. package/.claude-plugin/marketplace.json +0 -71
  100. package/.github/workflows/sync-skills.yml +0 -74
  101. package/.versionrc +0 -25
  102. package/AGENTS.md +0 -580
  103. package/CHANGELOG.md +0 -481
  104. package/CLAUDE-template.md +0 -114
  105. package/DEV_TOOLS_GUIDE.md +0 -190
  106. package/PROJECT_STRUCTURE.md +0 -266
  107. package/Q&A.md +0 -325
  108. package/config/defaults.json +0 -34
  109. package/config/official-skills.json +0 -183
  110. package/config/quality-gate.json +0 -67
  111. package/config/skill-categories.json +0 -40
  112. package/config/version-manifest.json +0 -85
  113. package/demos/power-3d-scatter.html +0 -683
  114. package/development/cache/web-search/search_1193d605f8eb364651fc2f2041b58a31.json +0 -36
  115. package/development/cache/web-search/search_3798bf06960edc125f744a1abb5b72c5.json +0 -36
  116. package/development/cache/web-search/search_37c7d4843a53f0d83f1122a6f908a2a3.json +0 -36
  117. package/development/cache/web-search/search_44166fa0153709ee168485a22aa0ab40.json +0 -36
  118. package/development/cache/web-search/search_4deaebb1f77e86a8ca066dc5a49c59fd.json +0 -36
  119. package/development/cache/web-search/search_94da91789466070a7f545612e73c7372.json +0 -36
  120. package/development/cache/web-search/search_dd5de8491b8b803a3cb01339cd210fb0.json +0 -36
  121. package/development/knowledge-base/.index.clean.json +0 -1
  122. package/development/knowledge-base/.index.json +0 -486
  123. package/development/knowledge-base/test-best-practices.md +0 -29
  124. package/development/projects/proj_mkh1pazz_ixmt1/phase1/feasibility-report.md +0 -160
  125. package/development/projects/proj_mkh4jvnb_z7rwf/phase1/feasibility-report.md +0 -160
  126. package/development/projects/proj_mkh4jxkd_ewz5a/phase1/feasibility-report.md +0 -160
  127. package/development/projects/proj_mkh4k84n_ni73k/phase1/feasibility-report.md +0 -160
  128. package/development/projects/proj_mkh4wfyd_u9w88/phase1/feasibility-report.md +0 -160
  129. package/development/projects/proj_mkh4wsbo_iahvf/development/projects/proj_mkh4xbpg_4na5w/phase1/feasibility-report.md +0 -160
  130. package/development/projects/proj_mkh4wsbo_iahvf/phase1/feasibility-report.md +0 -160
  131. package/development/projects/proj_mkh4xulg_1ka8x/phase1/feasibility-report.md +0 -160
  132. package/development/projects/proj_mkh4xwhj_gch8j/phase1/feasibility-report.md +0 -160
  133. package/development/projects/proj_mkh4y2qk_9lm8z/phase1/feasibility-report.md +0 -160
  134. package/development/projects/proj_mkh4y2qk_9lm8z/phase2/requirements.md +0 -226
  135. package/development/projects/proj_mkh4y2qk_9lm8z/phase3/PRD.md +0 -345
  136. package/development/projects/proj_mkh4y2qk_9lm8z/phase3/TASK_PLAN.md +0 -284
  137. package/development/projects/proj_mkh4y2qk_9lm8z/phase3/prototype/README.md +0 -14
  138. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/DEVELOPMENT_LOG.md +0 -35
  139. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/TASKS.md +0 -34
  140. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/.env.example +0 -5
  141. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/README.md +0 -60
  142. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/package.json +0 -25
  143. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/src/index.js +0 -70
  144. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/src/routes/index.js +0 -48
  145. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/tests/health.test.js +0 -20
  146. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/tests/jest.config.js +0 -21
  147. package/development/projects/proj_mkh7veqg_3lypc/phase1/feasibility-report.md +0 -160
  148. package/development/projects/proj_mkh7veqg_3lypc/phase2/requirements.md +0 -226
  149. package/development/projects/proj_mkh7veqg_3lypc/phase3/PRD.md +0 -345
  150. package/development/projects/proj_mkh7veqg_3lypc/phase3/TASK_PLAN.md +0 -284
  151. package/development/projects/proj_mkh7veqg_3lypc/phase3/prototype/README.md +0 -14
  152. package/development/projects/proj_mkh8k8fo_rmqn5/phase1/feasibility-report.md +0 -160
  153. package/development/projects/proj_mkh8xyhy_1vshq/phase1/feasibility-report.md +0 -178
  154. package/development/projects/proj_mkh8zddd_dhamf/phase1/feasibility-report.md +0 -377
  155. package/development/projects/proj_mkh8zddd_dhamf/phase2/requirements.md +0 -442
  156. package/development/projects/proj_mkh8zddd_dhamf/phase3/api-design.md +0 -800
  157. package/development/projects/proj_mkh8zddd_dhamf/phase3/architecture.md +0 -625
  158. package/development/projects/proj_mkh8zddd_dhamf/phase3/data-model.md +0 -830
  159. package/development/projects/proj_mkh8zddd_dhamf/phase3/risks.md +0 -957
  160. package/development/projects/proj_mkh8zddd_dhamf/phase3/wbs.md +0 -381
  161. package/development/todos/.state.json +0 -19
  162. package/development/todos/INDEX.md +0 -63
  163. package/development/todos/active/_README.md +0 -49
  164. package/development/todos/archived/_README.md +0 -11
  165. package/development/todos/backlog/_README.md +0 -11
  166. package/development/todos/backlog/mcp-integration.md +0 -35
  167. package/development/todos/completed/_README.md +0 -11
  168. package/development/todos/completed/boris-optimizations.md +0 -39
  169. package/development/todos/completed/develop/local-knowledge-index.md +0 -85
  170. package/development/todos/completed/develop/todo-system.md +0 -47
  171. package/development/todos/completed/develop/web-search-integration.md +0 -83
  172. package/development/todos/completed/test/phase1-e2e-test.md +0 -103
  173. package/docs/DEVELOPMENT.md +0 -461
  174. package/docs/MARKETPLACE.md +0 -352
  175. package/docs/RELEASE.md +0 -93
  176. package/jest.config.js +0 -63
  177. package/lib/commands.js +0 -3588
  178. package/lib/config-manager.js +0 -441
  179. package/lib/config-schema.js +0 -408
  180. package/lib/config-validator.js +0 -330
  181. package/lib/config.js +0 -122
  182. package/lib/errors.js +0 -305
  183. package/lib/incremental-sync.js +0 -274
  184. package/lib/marketplace.js +0 -487
  185. package/lib/migrations.js +0 -154
  186. package/lib/permission-audit.js +0 -255
  187. package/lib/quality-gate.js +0 -431
  188. package/lib/quality-rules.js +0 -373
  189. package/lib/utils.js +0 -150
  190. package/lib/version-check.js +0 -169
  191. package/lib/version-manifest.js +0 -171
  192. package/project-paradigm.md +0 -313
  193. package/prompts/how-to-find.md +0 -163
  194. package/prompts/linus-architect.md +0 -71
  195. package/prompts/software-architect.md +0 -173
  196. package/prompts/web-designer.md +0 -249
  197. package/scripts/fix-hooks.mjs +0 -97
  198. package/scripts/sync-external.mjs +0 -298
  199. package/scripts/sync-to-home.sh +0 -108
  200. package/scripts/update-registry.mjs +0 -325
  201. package/sources.yaml +0 -83
  202. package/tests/README.md +0 -263
  203. package/tests/commands.test.js +0 -1086
  204. package/tests/config-manager.test.js +0 -677
  205. package/tests/config-schema.test.js +0 -425
  206. package/tests/config-validator.test.js +0 -436
  207. package/tests/config.test.js +0 -100
  208. package/tests/errors.test.js +0 -477
  209. package/tests/manual/phase1-e2e.sh +0 -389
  210. package/tests/manual/phase2-test-cases.md +0 -311
  211. package/tests/manual/phase3-test-cases.md +0 -309
  212. package/tests/manual/phase4-test-cases.md +0 -414
  213. package/tests/manual/test-cases.md +0 -417
  214. package/tests/marketplace.test.js +0 -420
  215. package/tests/migrations.test.js +0 -187
  216. package/tests/quality-gate.test.js +0 -679
  217. package/tests/quality-rules.test.js +0 -619
  218. package/tests/sync-external.test.js +0 -214
  219. package/tests/update-registry.test.js +0 -251
  220. package/tests/utils.test.js +0 -171
  221. package/tests/version-check.test.js +0 -75
  222. package/tests/web-search.test.js +0 -392
  223. package/thinkinglens-silent.md +0 -138
@@ -1,425 +0,0 @@
1
- /**
2
- * Config Schema 模块单元测试
3
- * 测试 JSON Schema 定义和获取功能
4
- */
5
-
6
- const schema = require('../lib/config-schema');
7
-
8
- describe('Config Schema Module', () => {
9
- describe('exports', () => {
10
- it('should export CONFIG_SCHEMA', () => {
11
- expect(schema.CONFIG_SCHEMA).toBeDefined();
12
- expect(typeof schema.CONFIG_SCHEMA).toBe('object');
13
- });
14
-
15
- it('should export SETTINGS_SCHEMA', () => {
16
- expect(schema.SETTINGS_SCHEMA).toBeDefined();
17
- expect(typeof schema.SETTINGS_SCHEMA).toBe('object');
18
- });
19
-
20
- it('should export QUALITY_GATE_SCHEMA', () => {
21
- expect(schema.QUALITY_GATE_SCHEMA).toBeDefined();
22
- expect(typeof schema.QUALITY_GATE_SCHEMA).toBe('object');
23
- });
24
-
25
- it('should export getSchema function', () => {
26
- expect(typeof schema.getSchema).toBe('function');
27
- });
28
-
29
- it('should export getAllSchemas function', () => {
30
- expect(typeof schema.getAllSchemas).toBe('function');
31
- });
32
- });
33
-
34
- describe('getSchema', () => {
35
- it('should return CONFIG_SCHEMA for "config"', () => {
36
- const result = schema.getSchema('config');
37
- expect(result).toBe(schema.CONFIG_SCHEMA);
38
- });
39
-
40
- it('should return SETTINGS_SCHEMA for "settings"', () => {
41
- const result = schema.getSchema('settings');
42
- expect(result).toBe(schema.SETTINGS_SCHEMA);
43
- });
44
-
45
- it('should return QUALITY_GATE_SCHEMA for "quality-gate"', () => {
46
- const result = schema.getSchema('quality-gate');
47
- expect(result).toBe(schema.QUALITY_GATE_SCHEMA);
48
- });
49
-
50
- it('should return undefined for unknown schema name', () => {
51
- const result = schema.getSchema('unknown');
52
- expect(result).toBeUndefined();
53
- });
54
-
55
- it('should return undefined for empty string', () => {
56
- const result = schema.getSchema('');
57
- expect(result).toBeUndefined();
58
- });
59
-
60
- it('should return undefined for null', () => {
61
- const result = schema.getSchema(null);
62
- expect(result).toBeUndefined();
63
- });
64
- });
65
-
66
- describe('getAllSchemas', () => {
67
- it('should return all three schemas', () => {
68
- const result = schema.getAllSchemas();
69
- expect(Object.keys(result)).toHaveLength(3);
70
- expect(result.config).toBeDefined();
71
- expect(result.settings).toBeDefined();
72
- expect(result['quality-gate']).toBeDefined();
73
- });
74
-
75
- it('should return the same schema objects as exported', () => {
76
- const result = schema.getAllSchemas();
77
- expect(result.config).toBe(schema.CONFIG_SCHEMA);
78
- expect(result.settings).toBe(schema.SETTINGS_SCHEMA);
79
- expect(result['quality-gate']).toBe(schema.QUALITY_GATE_SCHEMA);
80
- });
81
- });
82
-
83
- describe('CONFIG_SCHEMA structure', () => {
84
- it('should have correct $id', () => {
85
- expect(schema.CONFIG_SCHEMA.$id).toBe('https://sumulige-claude.com/schemas/config.json');
86
- });
87
-
88
- it('should use JSON Schema Draft 7', () => {
89
- expect(schema.CONFIG_SCHEMA.$schema).toBe('http://json-schema.org/draft-07/schema#');
90
- });
91
-
92
- it('should have title', () => {
93
- expect(schema.CONFIG_SCHEMA.title).toBe('Sumulige Claude Configuration');
94
- });
95
-
96
- it('should be object type', () => {
97
- expect(schema.CONFIG_SCHEMA.type).toBe('object');
98
- });
99
-
100
- it('should require version field', () => {
101
- expect(schema.CONFIG_SCHEMA.required).toContain('version');
102
- });
103
-
104
- it('should have additionalProperties enabled', () => {
105
- expect(schema.CONFIG_SCHEMA.additionalProperties).toBe(true);
106
- });
107
- });
108
-
109
- describe('CONFIG_SCHEMA version validation', () => {
110
- const versionSchema = schema.CONFIG_SCHEMA.properties.version;
111
-
112
- it('should be string type', () => {
113
- expect(versionSchema.type).toBe('string');
114
- });
115
-
116
- it('should have semantic version pattern', () => {
117
- expect(versionSchema.pattern).toBeDefined();
118
- const pattern = new RegExp(versionSchema.pattern);
119
-
120
- // Valid versions
121
- expect(pattern.test('1.0.0')).toBe(true);
122
- expect(pattern.test('1.0.7')).toBe(true);
123
- expect(pattern.test('2.3.4')).toBe(true);
124
- expect(pattern.test('1.0.0-beta')).toBe(true);
125
- expect(pattern.test('1.0.0-alpha.1')).toBe(true);
126
- expect(pattern.test('1.0.0-rc.1')).toBe(true);
127
-
128
- // Invalid versions
129
- expect(pattern.test('1.0')).toBe(false);
130
- expect(pattern.test('1')).toBe(false);
131
- expect(pattern.test('v1.0.0')).toBe(false);
132
- expect(pattern.test('1.0.0-beta_123')).toBe(false);
133
- });
134
- });
135
-
136
- describe('CONFIG_SCHEMA model validation', () => {
137
- const modelSchema = schema.CONFIG_SCHEMA.properties.model;
138
-
139
- it('should be string type', () => {
140
- expect(modelSchema.type).toBe('string');
141
- });
142
-
143
- it('should have enum with valid Claude models', () => {
144
- expect(modelSchema.enum).toBeDefined();
145
- expect(modelSchema.enum).toContain('claude-opus-4.5');
146
- expect(modelSchema.enum).toContain('claude-opus-4-20250514');
147
- expect(modelSchema.enum).toContain('claude-opus-4-5-20251101');
148
- expect(modelSchema.enum).toContain('claude-sonnet-4.5');
149
- expect(modelSchema.enum).toContain('claude-sonnet-4-20250514');
150
- expect(modelSchema.enum).toContain('claude-sonnet-4-5-20251101');
151
- expect(modelSchema.enum).toContain('claude-haiku-4.5');
152
- });
153
- });
154
-
155
- describe('CONFIG_SCHEMA agents validation', () => {
156
- const agentsSchema = schema.CONFIG_SCHEMA.properties.agents;
157
-
158
- it('should be object type', () => {
159
- expect(agentsSchema.type).toBe('object');
160
- });
161
-
162
- it('should validate agent name pattern', () => {
163
- // The pattern is defined as a key in patternProperties
164
- const patternKey = '^[a-z][a-z0-9-]*$';
165
- expect(agentsSchema.patternProperties[patternKey]).toBeDefined();
166
-
167
- const pattern = new RegExp(patternKey);
168
-
169
- // Valid agent names
170
- expect(pattern.test('conductor')).toBe(true);
171
- expect(pattern.test('architect')).toBe(true);
172
- expect(pattern.test('my-agent')).toBe(true);
173
- expect(pattern.test('agent-123')).toBe(true);
174
- expect(pattern.test('a')).toBe(true);
175
-
176
- // Invalid agent names
177
- expect(pattern.test('Agent')).toBe(false);
178
- expect(pattern.test('123agent')).toBe(false);
179
- expect(pattern.test('_agent')).toBe(false);
180
- expect(pattern.test('agent_')).toBe(false);
181
- expect(pattern.test('agent.name')).toBe(false);
182
- });
183
-
184
- it('should require role field for agents', () => {
185
- const agentSchema = agentsSchema.patternProperties['^[a-z][a-z0-9-]*$'];
186
- expect(agentSchema.required).toContain('role');
187
- });
188
- });
189
-
190
- describe('CONFIG_SCHEMA skills validation', () => {
191
- const skillsSchema = schema.CONFIG_SCHEMA.properties.skills;
192
-
193
- it('should be array type', () => {
194
- expect(skillsSchema.type).toBe('array');
195
- });
196
-
197
- it('should validate skill repository format', () => {
198
- const itemSchema = skillsSchema.items;
199
- expect(itemSchema.pattern).toBeDefined();
200
- const pattern = new RegExp(itemSchema.pattern);
201
-
202
- // Valid formats
203
- expect(pattern.test('anthropics/skills')).toBe(true);
204
- expect(pattern.test('numman-ali/n-skills')).toBe(true);
205
- expect(pattern.test('owner/repo.name')).toBe(true);
206
- expect(pattern.test('Owner_123/repo-456')).toBe(true);
207
-
208
- // Invalid formats
209
- expect(pattern.test('owner')).toBe(false);
210
- expect(pattern.test('owner/')).toBe(false);
211
- expect(pattern.test('/repo')).toBe(false);
212
- expect(pattern.test('owner/repo/extra')).toBe(false);
213
- });
214
-
215
- it('should require unique items', () => {
216
- expect(skillsSchema.uniqueItems).toBe(true);
217
- });
218
- });
219
-
220
- describe('CONFIG_SCHEMA hooks validation', () => {
221
- const hooksSchema = schema.CONFIG_SCHEMA.properties.hooks;
222
-
223
- it('should be object type', () => {
224
- expect(hooksSchema.type).toBe('object');
225
- });
226
-
227
- it('should have preTask array property', () => {
228
- expect(hooksSchema.properties.preTask).toBeDefined();
229
- expect(hooksSchema.properties.preTask.type).toBe('array');
230
- });
231
-
232
- it('should have postTask array property', () => {
233
- expect(hooksSchema.properties.postTask).toBeDefined();
234
- expect(hooksSchema.properties.postTask.type).toBe('array');
235
- });
236
- });
237
-
238
- describe('CONFIG_SCHEMA thinkingLens validation', () => {
239
- const tlSchema = schema.CONFIG_SCHEMA.properties.thinkingLens;
240
-
241
- it('should be object type', () => {
242
- expect(tlSchema.type).toBe('object');
243
- });
244
-
245
- it('should have enabled boolean property', () => {
246
- expect(tlSchema.properties.enabled.type).toBe('boolean');
247
- });
248
-
249
- it('should have autoSync boolean property', () => {
250
- expect(tlSchema.properties.autoSync.type).toBe('boolean');
251
- });
252
-
253
- it('should validate syncInterval range', () => {
254
- const intervalSchema = tlSchema.properties.syncInterval;
255
- expect(intervalSchema.type).toBe('integer');
256
- expect(intervalSchema.minimum).toBe(1);
257
- expect(intervalSchema.maximum).toBe(300);
258
- });
259
- });
260
-
261
- describe('CONFIG_SCHEMA qualityGate validation', () => {
262
- const qgSchema = schema.CONFIG_SCHEMA.properties.qualityGate;
263
-
264
- it('should be object type', () => {
265
- expect(qgSchema.type).toBe('object');
266
- });
267
-
268
- it('should have enabled boolean property', () => {
269
- expect(qgSchema.properties.enabled.type).toBe('boolean');
270
- });
271
-
272
- it('should validate severity enum', () => {
273
- const severitySchema = qgSchema.properties.severity;
274
- expect(severitySchema.enum).toEqual(['info', 'warn', 'error', 'critical']);
275
- });
276
-
277
- it('should validate rules array structure', () => {
278
- const rulesSchema = qgSchema.properties.rules;
279
- expect(rulesSchema.type).toBe('array');
280
- expect(rulesSchema.items.required).toContain('id');
281
- });
282
-
283
- it('should validate gates trigger points', () => {
284
- const gatesSchema = qgSchema.properties.gates;
285
- expect(gatesSchema.properties.preCommit).toBeDefined();
286
- expect(gatesSchema.properties.prePush).toBeDefined();
287
- expect(gatesSchema.properties.onToolUse).toBeDefined();
288
- });
289
-
290
- it('should validate reporting format enum', () => {
291
- const reportingSchema = qgSchema.properties.reporting;
292
- expect(reportingSchema.properties.format.enum).toEqual(['console', 'json', 'markdown', 'html']);
293
- });
294
- });
295
-
296
- describe('CONFIG_SCHEMA marketplace validation', () => {
297
- const mpSchema = schema.CONFIG_SCHEMA.properties.marketplace;
298
-
299
- it('should be object type', () => {
300
- expect(mpSchema.type).toBe('object');
301
- });
302
-
303
- it('should have enabled boolean property', () => {
304
- expect(mpSchema.properties.enabled.type).toBe('boolean');
305
- });
306
-
307
- it('should have autoSync boolean property', () => {
308
- expect(mpSchema.properties.autoSync.type).toBe('boolean');
309
- });
310
-
311
- it('should validate syncInterval range (1-1440 minutes)', () => {
312
- const intervalSchema = mpSchema.properties.syncInterval;
313
- expect(intervalSchema.type).toBe('integer');
314
- expect(intervalSchema.minimum).toBe(1);
315
- expect(intervalSchema.maximum).toBe(1440);
316
- });
317
-
318
- it('should validate sources array', () => {
319
- const sourcesSchema = mpSchema.properties.sources;
320
- expect(sourcesSchema.type).toBe('array');
321
- expect(sourcesSchema.items.format).toBe('uri');
322
- });
323
- });
324
-
325
- describe('SETTINGS_SCHEMA structure', () => {
326
- it('should have correct $id', () => {
327
- expect(schema.SETTINGS_SCHEMA.$id).toBe('https://sumulige-claude.com/schemas/settings.json');
328
- });
329
-
330
- it('should use JSON Schema Draft 7', () => {
331
- expect(schema.SETTINGS_SCHEMA.$schema).toBe('http://json-schema.org/draft-07/schema#');
332
- });
333
-
334
- it('should have title', () => {
335
- expect(schema.SETTINGS_SCHEMA.title).toBe('Project Settings');
336
- });
337
-
338
- it('should be object type', () => {
339
- expect(schema.SETTINGS_SCHEMA.type).toBe('object');
340
- });
341
-
342
- it('should validate hook event names', () => {
343
- const patternProperties = schema.SETTINGS_SCHEMA.patternProperties;
344
- const eventPattern = Object.keys(patternProperties)[0];
345
-
346
- // The schema uses a single regex pattern for all events
347
- expect(eventPattern).toBe('^(UserPromptSubmit|PreToolUse|PostToolUse|AgentStop|SessionEnd)$');
348
-
349
- // Verify the pattern matches each event
350
- const pattern = new RegExp(eventPattern);
351
- expect(pattern.test('UserPromptSubmit')).toBe(true);
352
- expect(pattern.test('PreToolUse')).toBe(true);
353
- expect(pattern.test('PostToolUse')).toBe(true);
354
- expect(pattern.test('AgentStop')).toBe(true);
355
- expect(pattern.test('SessionEnd')).toBe(true);
356
-
357
- // Verify it doesn't match invalid events
358
- expect(pattern.test('InvalidEvent')).toBe(false);
359
- expect(pattern.test('usereventsubmit')).toBe(false);
360
- });
361
-
362
- it('should validate hook timeout range', () => {
363
- // Get the first event pattern's items structure
364
- const eventPattern = '^(UserPromptSubmit|PreToolUse|PostToolUse|AgentStop|SessionEnd)$';
365
- const eventSchema = schema.SETTINGS_SCHEMA.patternProperties[eventPattern];
366
- const hookItems = eventSchema.items.properties.hooks.items;
367
-
368
- expect(hookItems.properties.timeout.minimum).toBe(100);
369
- expect(hookItems.properties.timeout.maximum).toBe(60000);
370
- });
371
-
372
- it('should validate hook type enum', () => {
373
- const eventPattern = '^(UserPromptSubmit|PreToolUse|PostToolUse|AgentStop|SessionEnd)$';
374
- const eventSchema = schema.SETTINGS_SCHEMA.patternProperties[eventPattern];
375
- const hookItems = eventSchema.items.properties.hooks.items;
376
-
377
- expect(hookItems.properties.type.enum).toContain('command');
378
- });
379
- });
380
-
381
- describe('QUALITY_GATE_SCHEMA structure', () => {
382
- it('should have correct $id', () => {
383
- expect(schema.QUALITY_GATE_SCHEMA.$id).toBe('https://sumulige-claude.com/schemas/quality-gate.json');
384
- });
385
-
386
- it('should use JSON Schema Draft 7', () => {
387
- expect(schema.QUALITY_GATE_SCHEMA.$schema).toBe('http://json-schema.org/draft-07/schema#');
388
- });
389
-
390
- it('should have title', () => {
391
- expect(schema.QUALITY_GATE_SCHEMA.title).toBe('Quality Gate Configuration');
392
- });
393
-
394
- it('should be object type', () => {
395
- expect(schema.QUALITY_GATE_SCHEMA.type).toBe('object');
396
- });
397
-
398
- it('should validate severity enum with default', () => {
399
- const severitySchema = schema.QUALITY_GATE_SCHEMA.properties.severity;
400
- expect(severitySchema.enum).toEqual(['info', 'warn', 'error', 'critical']);
401
- expect(severitySchema.default).toBe('warn');
402
- });
403
-
404
- it('should validate rules array structure', () => {
405
- const rulesSchema = schema.QUALITY_GATE_SCHEMA.properties.rules;
406
- expect(rulesSchema.type).toBe('array');
407
- expect(rulesSchema.items.required).toEqual(['id']);
408
- expect(rulesSchema.items.properties.enabled.default).toBe(true);
409
- expect(rulesSchema.items.properties.severity.default).toBe('warn');
410
- });
411
-
412
- it('should validate gates with defaults', () => {
413
- const gatesSchema = schema.QUALITY_GATE_SCHEMA.properties.gates;
414
- expect(gatesSchema.properties.preCommit.default).toBe(true);
415
- expect(gatesSchema.properties.prePush.default).toBe(true);
416
- expect(gatesSchema.properties.onToolUse.default).toBe(false);
417
- });
418
-
419
- it('should validate reporting format with default', () => {
420
- const reportingSchema = schema.QUALITY_GATE_SCHEMA.properties.reporting;
421
- expect(reportingSchema.properties.format.enum).toEqual(['console', 'json', 'markdown', 'html']);
422
- expect(reportingSchema.properties.format.default).toBe('console');
423
- });
424
- });
425
- });