@@ -53,13 +53,15 @@ defmodule MishkaChelekom.UsageRulesSyncTest do
5353
5454 # Create lib directory (required for mix)
5555 File . mkdir_p! ( Path . join ( tmp_dir , "lib" ) )
56+
5657 File . write! ( Path . join ( tmp_dir , "lib/test_project.ex" ) , """
5758 defmodule TestProject do
5859 end
5960 """ )
6061
6162 # Create config directory
6263 File . mkdir_p! ( Path . join ( tmp_dir , "config" ) )
64+
6365 File . write! ( Path . join ( tmp_dir , "config/config.exs" ) , """
6466 import Config
6567 """ )
@@ -79,11 +81,13 @@ defmodule MishkaChelekom.UsageRulesSyncTest do
7981
8082 # Get dependencies first
8183 IO . puts ( "\n >>> Running: mix deps.get" )
82- { output , exit_code } = System . cmd ( "mix" , [ "deps.get" ] ,
83- cd: tmp_dir ,
84- stderr_to_stdout: true ,
85- env: [ { "MIX_ENV" , "dev" } ]
86- )
84+
85+ { output , exit_code } =
86+ System . cmd ( "mix" , [ "deps.get" ] ,
87+ cd: tmp_dir ,
88+ stderr_to_stdout: true ,
89+ env: [ { "MIX_ENV" , "dev" } ]
90+ )
8791
8892 if exit_code != 0 do
8993 IO . puts ( "deps.get failed: #{ output } " )
@@ -94,15 +98,19 @@ defmodule MishkaChelekom.UsageRulesSyncTest do
9498
9599 # Run the sync command
96100 IO . puts ( "\n >>> Running: mix usage_rules.sync CLAUDE.md mishka_chelekom" )
97- { sync_output , sync_exit_code } = System . cmd ( "mix" , [
98- "usage_rules.sync" ,
99- "CLAUDE.md" ,
100- "mishka_chelekom"
101- ] ,
102- cd: tmp_dir ,
103- stderr_to_stdout: true ,
104- env: [ { "MIX_ENV" , "dev" } ]
105- )
101+
102+ { sync_output , sync_exit_code } =
103+ System . cmd (
104+ "mix" ,
105+ [
106+ "usage_rules.sync" ,
107+ "CLAUDE.md" ,
108+ "mishka_chelekom"
109+ ] ,
110+ cd: tmp_dir ,
111+ stderr_to_stdout: true ,
112+ env: [ { "MIX_ENV" , "dev" } ]
113+ )
106114
107115 IO . puts ( "\n --- Command Output ---" )
108116 IO . puts ( sync_output )
@@ -149,13 +157,30 @@ defmodule MishkaChelekom.UsageRulesSyncTest do
149157 "CLAUDE.md should be substantial (>5KB), got #{ content_size } bytes"
150158
151159 # Verify components are listed
152- components = [ "accordion" , "alert" , "avatar" , "badge" , "button" , "card" ,
153- "carousel" , "checkbox_field" , "combobox" , "dropdown" , "modal" ,
154- "navbar" , "pagination" , "sidebar" , "table" , "tabs" , "toast" ]
160+ components = [
161+ "accordion" ,
162+ "alert" ,
163+ "avatar" ,
164+ "badge" ,
165+ "button" ,
166+ "card" ,
167+ "carousel" ,
168+ "checkbox_field" ,
169+ "combobox" ,
170+ "dropdown" ,
171+ "modal" ,
172+ "navbar" ,
173+ "pagination" ,
174+ "sidebar" ,
175+ "table" ,
176+ "tabs" ,
177+ "toast"
178+ ]
155179
156- missing_components = Enum . filter ( components , fn c ->
157- not ( content =~ c )
158- end )
180+ missing_components =
181+ Enum . filter ( components , fn c ->
182+ not ( content =~ c )
183+ end )
159184
160185 IO . puts ( "\n >>> Checking components in generated CLAUDE.md..." )
161186 IO . puts ( ">>> Missing components: #{ inspect ( missing_components ) } " )
@@ -177,25 +202,30 @@ defmodule MishkaChelekom.UsageRulesSyncTest do
177202 IO . puts ( String . duplicate ( "=" , 60 ) )
178203
179204 # Get dependencies
180- { _output , exit_code } = System . cmd ( "mix" , [ "deps.get" ] ,
181- cd: tmp_dir ,
182- stderr_to_stdout: true ,
183- env: [ { "MIX_ENV" , "dev" } ]
184- )
205+ { _output , exit_code } =
206+ System . cmd ( "mix" , [ "deps.get" ] ,
207+ cd: tmp_dir ,
208+ stderr_to_stdout: true ,
209+ env: [ { "MIX_ENV" , "dev" } ]
210+ )
185211
186212 assert exit_code == 0
187213
188214 # Run sync with :all to get sub-rules
189215 IO . puts ( "\n >>> Running: mix usage_rules.sync FULL_RULES.md mishka_chelekom:all" )
190- { sync_output , sync_exit_code } = System . cmd ( "mix" , [
191- "usage_rules.sync" ,
192- "FULL_RULES.md" ,
193- "mishka_chelekom:all"
194- ] ,
195- cd: tmp_dir ,
196- stderr_to_stdout: true ,
197- env: [ { "MIX_ENV" , "dev" } ]
198- )
216+
217+ { sync_output , sync_exit_code } =
218+ System . cmd (
219+ "mix" ,
220+ [
221+ "usage_rules.sync" ,
222+ "FULL_RULES.md" ,
223+ "mishka_chelekom:all"
224+ ] ,
225+ cd: tmp_dir ,
226+ stderr_to_stdout: true ,
227+ env: [ { "MIX_ENV" , "dev" } ]
228+ )
199229
200230 IO . puts ( "\n --- Command Output ---" )
201231 IO . puts ( sync_output )
@@ -229,21 +259,25 @@ defmodule MishkaChelekom.UsageRulesSyncTest do
229259 IO . puts ( String . duplicate ( "=" , 60 ) )
230260
231261 # Get dependencies and run sync
232- { _output , _exit_code } = System . cmd ( "mix" , [ "deps.get" ] ,
233- cd: tmp_dir ,
234- stderr_to_stdout: true ,
235- env: [ { "MIX_ENV" , "dev" } ]
236- )
237-
238- { _sync_output , sync_exit_code } = System . cmd ( "mix" , [
239- "usage_rules.sync" ,
240- "CLAUDE.md" ,
241- "mishka_chelekom"
242- ] ,
243- cd: tmp_dir ,
244- stderr_to_stdout: true ,
245- env: [ { "MIX_ENV" , "dev" } ]
246- )
262+ { _output , _exit_code } =
263+ System . cmd ( "mix" , [ "deps.get" ] ,
264+ cd: tmp_dir ,
265+ stderr_to_stdout: true ,
266+ env: [ { "MIX_ENV" , "dev" } ]
267+ )
268+
269+ { _sync_output , sync_exit_code } =
270+ System . cmd (
271+ "mix" ,
272+ [
273+ "usage_rules.sync" ,
274+ "CLAUDE.md" ,
275+ "mishka_chelekom"
276+ ] ,
277+ cd: tmp_dir ,
278+ stderr_to_stdout: true ,
279+ env: [ { "MIX_ENV" , "dev" } ]
280+ )
247281
248282 assert sync_exit_code == 0
249283
@@ -256,25 +290,84 @@ defmodule MishkaChelekom.UsageRulesSyncTest do
256290
257291 # Count how many components are mentioned
258292 all_components = [
259- "accordion" , "alert" , "avatar" , "badge" , "banner" , "blockquote" ,
260- "breadcrumb" , "button" , "card" , "carousel" , "chat" , "checkbox_card" ,
261- "checkbox_field" , "clipboard" , "collapse" , "color_field" , "combobox" ,
262- "date_time_field" , "device_mockup" , "divider" , "drawer" , "dropdown" ,
263- "email_field" , "fieldset" , "file_field" , "footer" , "form_wrapper" ,
264- "gallery" , "image" , "indicator" , "input_field" , "jumbotron" ,
265- "keyboard" , "layout" , "list" , "mega_menu" , "menu" , "modal" ,
266- "native_select" , "navbar" , "number_field" , "overlay" , "pagination" ,
267- "password_field" , "popover" , "progress" , "radio_card" , "radio_field" ,
268- "range_field" , "rating" , "scroll_area" , "search_field" , "sidebar" ,
269- "skeleton" , "speed_dial" , "spinner" , "stepper" , "table" , "table_content" ,
270- "tabs" , "tel_field" , "text_field" , "textarea_field" , "timeline" ,
271- "toast" , "toggle_field" , "tooltip" , "typography" , "url_field" , "video"
293+ "accordion" ,
294+ "alert" ,
295+ "avatar" ,
296+ "badge" ,
297+ "banner" ,
298+ "blockquote" ,
299+ "breadcrumb" ,
300+ "button" ,
301+ "card" ,
302+ "carousel" ,
303+ "chat" ,
304+ "checkbox_card" ,
305+ "checkbox_field" ,
306+ "clipboard" ,
307+ "collapse" ,
308+ "color_field" ,
309+ "combobox" ,
310+ "date_time_field" ,
311+ "device_mockup" ,
312+ "divider" ,
313+ "drawer" ,
314+ "dropdown" ,
315+ "email_field" ,
316+ "fieldset" ,
317+ "file_field" ,
318+ "footer" ,
319+ "form_wrapper" ,
320+ "gallery" ,
321+ "image" ,
322+ "indicator" ,
323+ "input_field" ,
324+ "jumbotron" ,
325+ "keyboard" ,
326+ "layout" ,
327+ "list" ,
328+ "mega_menu" ,
329+ "menu" ,
330+ "modal" ,
331+ "native_select" ,
332+ "navbar" ,
333+ "number_field" ,
334+ "overlay" ,
335+ "pagination" ,
336+ "password_field" ,
337+ "popover" ,
338+ "progress" ,
339+ "radio_card" ,
340+ "radio_field" ,
341+ "range_field" ,
342+ "rating" ,
343+ "scroll_area" ,
344+ "search_field" ,
345+ "sidebar" ,
346+ "skeleton" ,
347+ "speed_dial" ,
348+ "spinner" ,
349+ "stepper" ,
350+ "table" ,
351+ "table_content" ,
352+ "tabs" ,
353+ "tel_field" ,
354+ "text_field" ,
355+ "textarea_field" ,
356+ "timeline" ,
357+ "toast" ,
358+ "toggle_field" ,
359+ "tooltip" ,
360+ "typography" ,
361+ "url_field" ,
362+ "video"
272363 ]
273364
274365 found_components = Enum . filter ( all_components , fn c -> content =~ c end )
275366 missing_components = all_components -- found_components
276367
277- IO . puts ( ">>> Components found in CLAUDE.md: #{ length ( found_components ) } /#{ length ( all_components ) } " )
368+ IO . puts (
369+ ">>> Components found in CLAUDE.md: #{ length ( found_components ) } /#{ length ( all_components ) } "
370+ )
278371
279372 if length ( missing_components ) > 0 do
280373 IO . puts ( ">>> Missing: #{ inspect ( Enum . take ( missing_components , 10 ) ) } ..." )
@@ -285,10 +378,20 @@ defmodule MishkaChelekom.UsageRulesSyncTest do
285378 "CLAUDE.md should reference at least 50 components, found #{ length ( found_components ) } "
286379
287380 # Verify JS hooks are mentioned
288- js_hooks = [ "Carousel" , "Clipboard" , "Collapsible" , "Combobox" , "Floating" , "ScrollArea" , "Sidebar" ]
381+ js_hooks = [
382+ "Carousel" ,
383+ "Clipboard" ,
384+ "Collapsible" ,
385+ "Combobox" ,
386+ "Floating" ,
387+ "ScrollArea" ,
388+ "Sidebar"
389+ ]
390+
289391 found_hooks = Enum . filter ( js_hooks , fn h -> content =~ h end )
290392
291393 IO . puts ( ">>> JS Hooks found: #{ length ( found_hooks ) } /#{ length ( js_hooks ) } " )
394+
292395 assert length ( found_hooks ) >= 5 ,
293396 "CLAUDE.md should mention JS hooks"
294397
0 commit comments