scarpe 0.4.0 → 0.5.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.
- checksums.yaml +4 -4
- data/.cursor/rules/commit-style-preferences.mdc +72 -0
- data/.cursor/rules/component_context.mdc +82 -0
- data/.cursor/rules/debug-failed-tests.mdc +100 -0
- data/.cursor/rules/display_service_context.mdc +80 -0
- data/.cursor/rules/event_handling_context.mdc +100 -0
- data/.cursor/rules/git-pager-handling.mdc +64 -0
- data/.cursor/rules/lacci-context.mdc +52 -0
- data/.cursor/rules/scarpe_design_context.mdc +46 -0
- data/.cursor/rules/shoes_compatibility_context.mdc +75 -0
- data/.cursor/rules/timeout_context.mdc +78 -0
- data/.cursor/rules/update_lacci_and_wv.mdc +8 -0
- data/.cursor/rules/what_is_scarpe.mdc +22 -0
- data/.cursor/rules/writing-new-rules.mdc +73 -0
- data/CHANGELOG.md +10 -1
- data/CLAUDE.md +223 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +78 -58
- data/README.md +4 -7
- data/Rakefile +17 -25
- data/docs/SCARPE_FEATURES.md +38 -0
- data/docs/_config.yml +13 -0
- data/docs/calzini_components_and_updates.md +78 -0
- data/docs/display_service_separation.md +39 -0
- data/docs/documentation.md +43 -0
- data/docs/event_loops.md +66 -0
- data/docs/image.png +0 -0
- data/docs/index.md +118 -0
- data/docs/lacci.md +121 -0
- data/docs/scarpe_shoes_incompatibilities.md +71 -0
- data/docs/shoes_and_display_events.md +55 -0
- data/docs/shoes_implementations.md +79 -0
- data/docs/static/manual.md +5 -0
- data/docs/static/scarpe-logo.png +0 -0
- data/docs/timeouts_and_handlers.md +66 -0
- data/docs/web_archaeology.md +76 -0
- data/examples/background_with_image.rb +14 -5
- data/examples/bloopsaphone/working/feepogram.rb +1 -1
- data/examples/bloopsaphone/working/le_dance_des_rubis.rb +135 -0
- data/examples/bloopsaphone/working/pixel_dreams_in_ruby.rb +131 -0
- data/examples/bloopsaphone/working/type_rebellion.rb +157 -0
- data/examples/border.rb +1 -1
- data/examples/internal_link_navigation.rb +19 -0
- data/examples/page_navigation_single_app.rb +42 -0
- data/examples/shoes_subclass_app.rb +25 -0
- data/examples/url_routing_example.rb +67 -0
- data/lacci/Gemfile +0 -2
- data/lacci/Gemfile.lock +4 -32
- data/lacci/lacci.gemspec +1 -1
- data/lacci/lib/lacci/version.rb +1 -1
- data/lacci/lib/scarpe/niente/app.rb +12 -1
- data/lacci/lib/scarpe/niente/shoes_spec.rb +4 -5
- data/lacci/lib/scarpe/niente.rb +1 -0
- data/lacci/lib/shoes/app.rb +166 -61
- data/lacci/lib/shoes/constants.rb +1 -0
- data/lacci/lib/shoes/drawable.rb +35 -19
- data/lacci/lib/shoes/drawables/arc.rb +2 -2
- data/lacci/lib/shoes/drawables/arrow.rb +2 -2
- data/lacci/lib/shoes/drawables/border.rb +1 -1
- data/lacci/lib/shoes/drawables/button.rb +1 -1
- data/lacci/lib/shoes/drawables/edit_line.rb +1 -1
- data/lacci/lib/shoes/drawables/flow.rb +1 -1
- data/lacci/lib/shoes/drawables/line.rb +2 -2
- data/lacci/lib/shoes/drawables/link.rb +11 -1
- data/lacci/lib/shoes/drawables/oval.rb +2 -2
- data/lacci/lib/shoes/drawables/rect.rb +2 -2
- data/lacci/lib/shoes/drawables/shape.rb +2 -2
- data/lacci/lib/shoes/drawables/slot.rb +5 -3
- data/lacci/lib/shoes/drawables/stack.rb +1 -1
- data/lacci/lib/shoes/drawables/star.rb +1 -1
- data/lacci/lib/shoes/drawables/widget.rb +1 -1
- data/lacci/lib/shoes.rb +94 -17
- data/lacci/test/test_margin_helper.rb +1 -1
- data/lacci/test/test_niente_test_infra.rb +14 -0
- data/lacci/test/test_shoes_errors.rb +15 -13
- data/lib/scarpe/assets.rb +2 -1
- data/lib/scarpe/shoes_spec.rb +2 -1
- data/lib/scarpe/version.rb +1 -1
- data/lib/scarpe/wv/edit_line.rb +2 -2
- data/lib/scarpe/wv.rb +8 -1
- data/scarpe-components/Gemfile +0 -2
- data/scarpe-components/Gemfile.lock +4 -34
- data/scarpe-components/lib/scarpe/components/calzini/misc.rb +10 -2
- data/scarpe-components/lib/scarpe/components/calzini/para.rb +6 -1
- data/scarpe-components/lib/scarpe/components/calzini/slots.rb +2 -0
- data/scarpe-components/lib/scarpe/components/port_helpers.rb +30 -0
- data/scarpe-components/lib/scarpe/components/version.rb +1 -1
- data/scarpe-components/scarpe-components.gemspec +1 -1
- data/scarpe-components/test/test_port_helpers.rb +12 -0
- metadata +60 -22
- data/.rubocop.yml +0 -94
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 63b4c563ff3a88126429d53ed2be981c0cf91f0469622ae46663102459bd77f7
|
|
4
|
+
data.tar.gz: 90201e43c50859ebfe9468228fc7380245c9c18f4faba21ffb49333dc4aa7a61
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82d1332c1f875dba16af4891b9da1923e334f3b95f78faaca604783cfe907b05b9abf8bded7c4212d5e27546bbb4e4ee18ba3458ceeb8612a2f9b661bcf0a323
|
|
7
|
+
data.tar.gz: cd7814ee2024f9f69a0e21281e097e2aa4aef4805f43b271c36913cca47c32d58fdf2ac4272fce305f26c60a8753abfd9f4251dc837f20c6864b96a2bbafb76c
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
description:
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
---
|
|
6
|
+
# Commit Style Preferences
|
|
7
|
+
|
|
8
|
+
<rule>
|
|
9
|
+
name: commit_style_preferences
|
|
10
|
+
description: Guidelines for writing commit messages
|
|
11
|
+
filters:
|
|
12
|
+
- type: event
|
|
13
|
+
pattern: "pre_commit"
|
|
14
|
+
|
|
15
|
+
actions:
|
|
16
|
+
- type: suggest
|
|
17
|
+
message: |
|
|
18
|
+
# Format Requirements
|
|
19
|
+
|
|
20
|
+
1. First line (50 chars ideal):
|
|
21
|
+
- Clear, direct statement of WHAT changed
|
|
22
|
+
- Start with verb (Add, Fix, Update, etc.)
|
|
23
|
+
|
|
24
|
+
2. Empty line after header
|
|
25
|
+
|
|
26
|
+
3. Body must include:
|
|
27
|
+
- WHY the change was needed
|
|
28
|
+
- HOW it addresses the problem
|
|
29
|
+
- Technical implications
|
|
30
|
+
- Impact on stability/maintenance
|
|
31
|
+
|
|
32
|
+
4. For API changes:
|
|
33
|
+
- Explicitly state if using private/internal APIs
|
|
34
|
+
- Note any technical debt implications
|
|
35
|
+
- Include upstream context for dependency changes
|
|
36
|
+
|
|
37
|
+
examples:
|
|
38
|
+
- description: "Standard feature change"
|
|
39
|
+
input: |
|
|
40
|
+
Add request validation to UserWidget
|
|
41
|
+
|
|
42
|
+
Prevents invalid requests from reaching the database layer.
|
|
43
|
+
Adds type checking and parameter validation before processing.
|
|
44
|
+
|
|
45
|
+
Impact: Improved error handling and reduced DB load.
|
|
46
|
+
|
|
47
|
+
- description: "Private API change"
|
|
48
|
+
input: |
|
|
49
|
+
Update FrobWidget to use internal Foo::Bar API
|
|
50
|
+
|
|
51
|
+
Rails changed their implementation from X to Y. While both
|
|
52
|
+
are private APIs, this change is required to maintain
|
|
53
|
+
compatibility.
|
|
54
|
+
|
|
55
|
+
Note: Created ticket RAIL-123 to track moving to public
|
|
56
|
+
APIs when available.
|
|
57
|
+
|
|
58
|
+
- description: "Dependency update"
|
|
59
|
+
input: |
|
|
60
|
+
Bump rails to 7737f646773
|
|
61
|
+
|
|
62
|
+
Updates our rails checkout to latest main. Key changes:
|
|
63
|
+
- Journey routing internals refactored
|
|
64
|
+
- ActiveSupport::TimeZone improvements
|
|
65
|
+
- New ActionMailer configuration options
|
|
66
|
+
|
|
67
|
+
Test plan: Full CI suite + extra routing specs
|
|
68
|
+
|
|
69
|
+
metadata:
|
|
70
|
+
priority: high
|
|
71
|
+
version: 1.0
|
|
72
|
+
</rule>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
description:
|
|
3
|
+
globs: **/calzini/**/*.rb
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Component Context
|
|
7
|
+
|
|
8
|
+
<rule>
|
|
9
|
+
name: component_context
|
|
10
|
+
description: Share relevant component documentation when working with Calzini components and widgets
|
|
11
|
+
filters:
|
|
12
|
+
- type: file
|
|
13
|
+
pattern: **/*component*.rb
|
|
14
|
+
- type: file
|
|
15
|
+
pattern: **/*component*.md
|
|
16
|
+
- type: file
|
|
17
|
+
pattern: **/*calzini*.rb
|
|
18
|
+
- type: file
|
|
19
|
+
pattern: **/*calzini*.md
|
|
20
|
+
- type: file
|
|
21
|
+
pattern: **/*widget*.rb
|
|
22
|
+
- type: file
|
|
23
|
+
pattern: **/*widget*.md
|
|
24
|
+
|
|
25
|
+
actions:
|
|
26
|
+
- type: suggest
|
|
27
|
+
message: |
|
|
28
|
+
# Component Context
|
|
29
|
+
|
|
30
|
+
When working with Scarpe's component system (Calzini), consider:
|
|
31
|
+
|
|
32
|
+
1. Component Architecture
|
|
33
|
+
- [calzini_components_and_updates.md](mdc:docs/calzini_components_and_updates.md) - Core component documentation
|
|
34
|
+
- [scarpe_shoes_incompatibilities.md](mdc:docs/scarpe_shoes_incompatibilities.md) - API differences from Shoes
|
|
35
|
+
|
|
36
|
+
2. Component Lifecycle:
|
|
37
|
+
```ruby
|
|
38
|
+
class CalziniComponent
|
|
39
|
+
def initialize
|
|
40
|
+
setup_state
|
|
41
|
+
register_handlers
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def update
|
|
45
|
+
calculate_layout
|
|
46
|
+
trigger_display_update
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
3. State Management:
|
|
52
|
+
- Internal component state
|
|
53
|
+
- Props from parent components
|
|
54
|
+
- Global application state
|
|
55
|
+
- Shared resources
|
|
56
|
+
|
|
57
|
+
4. Best Practices:
|
|
58
|
+
- Keep components focused and single-purpose
|
|
59
|
+
- Handle state updates efficiently
|
|
60
|
+
- Consider compatibility with original Shoes
|
|
61
|
+
- Maintain proper event handling
|
|
62
|
+
|
|
63
|
+
5. Additional Resources:
|
|
64
|
+
- Wiki: https://github.com/scarpe-team/scarpe/wiki/ScarpeDesign.md#calzini-components-and-updates
|
|
65
|
+
- Related sections:
|
|
66
|
+
* Display Service Separation
|
|
67
|
+
* Event Loops
|
|
68
|
+
* Shoes and Display Events
|
|
69
|
+
|
|
70
|
+
examples:
|
|
71
|
+
- description: "Working with components"
|
|
72
|
+
input: |
|
|
73
|
+
When implementing components:
|
|
74
|
+
1. Follow the component lifecycle
|
|
75
|
+
2. Handle state updates properly
|
|
76
|
+
3. Consider compatibility implications
|
|
77
|
+
4. Use proper event handling patterns
|
|
78
|
+
|
|
79
|
+
metadata:
|
|
80
|
+
priority: high
|
|
81
|
+
version: 1.0
|
|
82
|
+
</rule>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: A rule to guide the debugging process when tests fail by adding puts statements, analyzing output, fixing the issue, and cleaning up.
|
|
3
|
+
globs: "**/*_test.rb"
|
|
4
|
+
---
|
|
5
|
+
# Debug Failed Tests
|
|
6
|
+
|
|
7
|
+
A rule that guides you to add debugging statements when a test fails, run the test again to understand the issue, implement a fix, and then remove the debugging statements once everything works.
|
|
8
|
+
|
|
9
|
+
<rule>
|
|
10
|
+
name: debug_failed_tests
|
|
11
|
+
description: When a test fails, add debugging statements before implementing a fix
|
|
12
|
+
filters:
|
|
13
|
+
- type: event
|
|
14
|
+
pattern: "test_failed"
|
|
15
|
+
|
|
16
|
+
actions:
|
|
17
|
+
- type: suggest
|
|
18
|
+
message: |
|
|
19
|
+
# Add debugging statements
|
|
20
|
+
|
|
21
|
+
Identify the failing test and add strategic 'puts' statements to print relevant variables, state, or execution flow information that might help diagnose the issue.
|
|
22
|
+
|
|
23
|
+
Example:
|
|
24
|
+
```ruby
|
|
25
|
+
# Before
|
|
26
|
+
def calculate_total(items)
|
|
27
|
+
items.sum { |item| item[:price] * item[:quantity] }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# After adding debugging
|
|
31
|
+
def calculate_total(items)
|
|
32
|
+
puts "Items received: #{items.inspect}"
|
|
33
|
+
total = items.sum do |item|
|
|
34
|
+
puts "Processing item: #{item[:name]}, price: #{item[:price]}, quantity: #{item[:quantity]}"
|
|
35
|
+
item[:price] * item[:quantity]
|
|
36
|
+
end
|
|
37
|
+
puts "Calculated total: #{total}"
|
|
38
|
+
total
|
|
39
|
+
end
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- type: suggest
|
|
43
|
+
message: |
|
|
44
|
+
# Run the test with debugging
|
|
45
|
+
|
|
46
|
+
Run the failing test again and analyze the debugging output to understand what's happening and why the test is failing.
|
|
47
|
+
|
|
48
|
+
- type: suggest
|
|
49
|
+
message: |
|
|
50
|
+
# Implement a fix
|
|
51
|
+
|
|
52
|
+
Now that you understand the issue better from the debugging output, implement a solution to fix the failing test.
|
|
53
|
+
|
|
54
|
+
- type: suggest
|
|
55
|
+
message: |
|
|
56
|
+
# Verify the fix
|
|
57
|
+
|
|
58
|
+
Run the test again to ensure your fix resolves the issue and the test now passes.
|
|
59
|
+
|
|
60
|
+
- type: suggest
|
|
61
|
+
message: |
|
|
62
|
+
# Clean up debugging statements
|
|
63
|
+
|
|
64
|
+
Now that the test is passing, remove all the debugging statements you added to keep the code clean and production-ready.
|
|
65
|
+
|
|
66
|
+
Example:
|
|
67
|
+
```ruby
|
|
68
|
+
# Before (with debugging)
|
|
69
|
+
def calculate_total(items)
|
|
70
|
+
puts "Items received: #{items.inspect}"
|
|
71
|
+
total = items.sum do |item|
|
|
72
|
+
puts "Processing item: #{item[:name]}, price: #{item[:price]}, quantity: #{item[:quantity]}"
|
|
73
|
+
item[:price] * item[:quantity]
|
|
74
|
+
end
|
|
75
|
+
puts "Calculated total: #{total}"
|
|
76
|
+
total
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# After (debugging removed)
|
|
80
|
+
def calculate_total(items)
|
|
81
|
+
items.sum { |item| item[:price] * item[:quantity] }
|
|
82
|
+
end
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
examples:
|
|
86
|
+
- input: |
|
|
87
|
+
# A failing test for a calculation method
|
|
88
|
+
def test_calculate_total
|
|
89
|
+
items = [
|
|
90
|
+
{ name: "Item 1", price: 10, quantity: 2 },
|
|
91
|
+
{ name: "Item 2", price: 15, quantity: 3 }
|
|
92
|
+
]
|
|
93
|
+
assert_equal 65, calculate_total(items)
|
|
94
|
+
end
|
|
95
|
+
output: "Added debugging, fixed the issue, and removed debugging statements"
|
|
96
|
+
|
|
97
|
+
metadata:
|
|
98
|
+
priority: medium
|
|
99
|
+
version: 1.0
|
|
100
|
+
</rule>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
description:
|
|
3
|
+
globs: **/*display*.rb,**/*display_service*.rb,**/*display*.md
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Display Service Context
|
|
7
|
+
|
|
8
|
+
<rule>
|
|
9
|
+
name: display_service_context
|
|
10
|
+
description: Share relevant display service documentation and implementation details when working with display service files
|
|
11
|
+
filters:
|
|
12
|
+
- type: file
|
|
13
|
+
pattern: **/*display*.rb
|
|
14
|
+
- type: file
|
|
15
|
+
pattern: **/*display_service*.rb
|
|
16
|
+
- type: file
|
|
17
|
+
pattern: **/*display*.md
|
|
18
|
+
|
|
19
|
+
actions:
|
|
20
|
+
- type: suggest
|
|
21
|
+
message: |
|
|
22
|
+
# Display Service Context
|
|
23
|
+
|
|
24
|
+
When working with Scarpe's display service, it's important to understand the core architectural decisions:
|
|
25
|
+
|
|
26
|
+
1. The display service runs as a separate process from the main application
|
|
27
|
+
2. Communication happens through a well-defined protocol
|
|
28
|
+
3. Different display implementations can be swapped out
|
|
29
|
+
4. The system supports both local and relay-based display services
|
|
30
|
+
|
|
31
|
+
Key files and concepts:
|
|
32
|
+
- [display_service_separation.md](mdc:docs/display_service_separation.md) - Core architectural documentation
|
|
33
|
+
- `Shoes::DisplayService` - Base display service class
|
|
34
|
+
- `Scarpe::Webview::DisplayService` - Webview implementation
|
|
35
|
+
- `Scarpe::Webview::RelayDisplayService` - Process separation implementation
|
|
36
|
+
|
|
37
|
+
Implementation patterns:
|
|
38
|
+
```ruby
|
|
39
|
+
# Display service singleton pattern
|
|
40
|
+
class DisplayService < Shoes::DisplayService
|
|
41
|
+
class << self
|
|
42
|
+
attr_accessor :instance
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def initialize
|
|
46
|
+
if DisplayService.instance
|
|
47
|
+
raise Shoes::Errors::SingletonError, "ERROR! This is meant to be a singleton!"
|
|
48
|
+
end
|
|
49
|
+
DisplayService.instance = self
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Event handling:
|
|
55
|
+
```ruby
|
|
56
|
+
# Event dispatch pattern
|
|
57
|
+
def dispatch_event(event_name, event_target, *args, **kwargs)
|
|
58
|
+
handlers = [
|
|
59
|
+
same_name_handlers[:any], # Same name, any target
|
|
60
|
+
same_name_handlers[event_target], # Same name, same target
|
|
61
|
+
any_name_handlers[:any], # Any name, any target
|
|
62
|
+
any_name_handlers[event_target], # Any name, same target
|
|
63
|
+
].compact.inject([], &:+)
|
|
64
|
+
handlers.each { |h| h[:handler].call(*args, **kwargs) }
|
|
65
|
+
end
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
examples:
|
|
69
|
+
- description: "Working with display service implementation"
|
|
70
|
+
input: |
|
|
71
|
+
When implementing a new display service or modifying an existing one:
|
|
72
|
+
1. Follow the singleton pattern for display service instances
|
|
73
|
+
2. Implement proper event handling and dispatch
|
|
74
|
+
3. Ensure clean process separation if using relay approach
|
|
75
|
+
4. Handle drawable creation and management consistently
|
|
76
|
+
|
|
77
|
+
metadata:
|
|
78
|
+
priority: high
|
|
79
|
+
version: 1.0
|
|
80
|
+
</rule>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Share event handling context when working with event-related files
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Event Handling Context
|
|
7
|
+
|
|
8
|
+
<rule>
|
|
9
|
+
name: event_handling_context
|
|
10
|
+
description: Share relevant event handling and testing documentation when working with event-related files
|
|
11
|
+
filters:
|
|
12
|
+
- type: file
|
|
13
|
+
pattern: **/*event*.rb
|
|
14
|
+
- type: file
|
|
15
|
+
pattern: **/*event*.md
|
|
16
|
+
- type: file
|
|
17
|
+
pattern: **/*loop*.rb
|
|
18
|
+
- type: file
|
|
19
|
+
pattern: **/*loop*.md
|
|
20
|
+
- type: file
|
|
21
|
+
pattern: **/*fiber*.rb
|
|
22
|
+
- type: file
|
|
23
|
+
pattern: **/*fiber*.md
|
|
24
|
+
- type: file
|
|
25
|
+
pattern: **/*catscradle*.rb
|
|
26
|
+
- type: file
|
|
27
|
+
pattern: **/*catscradle*.md
|
|
28
|
+
|
|
29
|
+
actions:
|
|
30
|
+
- type: suggest
|
|
31
|
+
message: |
|
|
32
|
+
# Event Handling Context
|
|
33
|
+
|
|
34
|
+
When working with Scarpe's event system, it's important to understand:
|
|
35
|
+
|
|
36
|
+
1. Event Loop Architecture
|
|
37
|
+
- [event_loops.md](mdc:docs/event_loops.md) - Core event loop documentation
|
|
38
|
+
- [shoes_and_display_events.md](mdc:docs/shoes_and_display_events.md) - Event handling details
|
|
39
|
+
- [catscradle.md](mdc:docs/yard/catscradle.md) - Fiber-based testing approach
|
|
40
|
+
|
|
41
|
+
2. Key Testing Concepts:
|
|
42
|
+
```ruby
|
|
43
|
+
# Example of Fiber-based test
|
|
44
|
+
def test_html_dom_multiple_update
|
|
45
|
+
run_test_scarpe_code(<<-'SCARPE_APP', app_test_code: <<-'TEST_CODE')
|
|
46
|
+
Shoes.app do
|
|
47
|
+
para "Hello World"
|
|
48
|
+
end
|
|
49
|
+
SCARPE_APP
|
|
50
|
+
on_heartbeat do
|
|
51
|
+
p = para()
|
|
52
|
+
assert_include dom_html, "Hello World"
|
|
53
|
+
p.replace("Goodbye World")
|
|
54
|
+
wait fully_updated
|
|
55
|
+
assert_include dom_html, "Goodbye World"
|
|
56
|
+
test_finished
|
|
57
|
+
end
|
|
58
|
+
TEST_CODE
|
|
59
|
+
end
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
3. Event Types:
|
|
63
|
+
- Mouse events (click, hover, etc.)
|
|
64
|
+
- Keyboard events
|
|
65
|
+
- Window events
|
|
66
|
+
- Custom events
|
|
67
|
+
- Heartbeat events
|
|
68
|
+
|
|
69
|
+
4. Implementation Details:
|
|
70
|
+
- Events are queued in order of arrival
|
|
71
|
+
- Priority system for critical events
|
|
72
|
+
- Fiber-based coordination for testing
|
|
73
|
+
- Cooperative multitasking approach
|
|
74
|
+
|
|
75
|
+
5. Best Practices:
|
|
76
|
+
- Keep handlers fast and focused
|
|
77
|
+
- Use Fiber-based testing for complex interactions
|
|
78
|
+
- Handle errors appropriately
|
|
79
|
+
- Maintain proper process separation
|
|
80
|
+
|
|
81
|
+
6. Additional Resources:
|
|
82
|
+
- Wiki: https://github.com/scarpe-team/scarpe/wiki/ScarpeDesign.md#event-loops
|
|
83
|
+
- Related sections:
|
|
84
|
+
* Display Service Separation
|
|
85
|
+
* Shoes and Display Events
|
|
86
|
+
* Timeouts and handlers
|
|
87
|
+
|
|
88
|
+
examples:
|
|
89
|
+
- description: "Working with event handlers"
|
|
90
|
+
input: |
|
|
91
|
+
When implementing event handling:
|
|
92
|
+
1. Consider using Fiber-based testing for complex scenarios
|
|
93
|
+
2. Keep handlers non-blocking
|
|
94
|
+
3. Use proper event dispatch patterns
|
|
95
|
+
4. Consider process separation implications
|
|
96
|
+
|
|
97
|
+
metadata:
|
|
98
|
+
priority: high
|
|
99
|
+
version: 1.0
|
|
100
|
+
</rule>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
description:
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
<rule>
|
|
7
|
+
name: git_pager_handling
|
|
8
|
+
description: When running git commands that would normally use a pager, append | cat to prevent breaking automated environments
|
|
9
|
+
|
|
10
|
+
filters:
|
|
11
|
+
- type: command
|
|
12
|
+
pattern: "^git (diff|log|show|blame)"
|
|
13
|
+
- type: command
|
|
14
|
+
pattern: "^git.*\\|(\\s+)?less"
|
|
15
|
+
- type: command
|
|
16
|
+
pattern: "^git.*\\|(\\s+)?more"
|
|
17
|
+
|
|
18
|
+
actions:
|
|
19
|
+
- type: suggest
|
|
20
|
+
message: |
|
|
21
|
+
# Git Pager Handling
|
|
22
|
+
|
|
23
|
+
When running git commands that would normally use a pager (like `git diff`, `git log`, etc.), always append `| cat` to prevent the pager from breaking the output. This is especially important in automated environments.
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Good
|
|
29
|
+
git diff HEAD~1 HEAD | cat
|
|
30
|
+
git log | cat
|
|
31
|
+
git show | cat
|
|
32
|
+
|
|
33
|
+
# Bad
|
|
34
|
+
git diff HEAD~1 HEAD
|
|
35
|
+
git log
|
|
36
|
+
git show
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Common Commands Needing `| cat`
|
|
40
|
+
|
|
41
|
+
- `git diff`
|
|
42
|
+
- `git log`
|
|
43
|
+
- `git show`
|
|
44
|
+
- `git blame`
|
|
45
|
+
- Any other git command that might produce paginated output
|
|
46
|
+
|
|
47
|
+
## Why?
|
|
48
|
+
|
|
49
|
+
The pager (usually `less` or `more`) expects user interaction, which isn't available in automated environments. Piping to `cat` ensures we get the full output without pagination.
|
|
50
|
+
|
|
51
|
+
examples:
|
|
52
|
+
- description: "Running git diff in automated environment"
|
|
53
|
+
input: |
|
|
54
|
+
git diff HEAD~1 HEAD | cat
|
|
55
|
+
|
|
56
|
+
metadata:
|
|
57
|
+
priority: high
|
|
58
|
+
version: 1.0
|
|
59
|
+
</rule>
|
|
60
|
+
|
|
61
|
+
metadata:
|
|
62
|
+
priority: high
|
|
63
|
+
version: 1.0
|
|
64
|
+
</rule>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
description:
|
|
3
|
+
globs: lacci/**/*
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Lacci Context
|
|
7
|
+
|
|
8
|
+
<rule>
|
|
9
|
+
name: lacci_context
|
|
10
|
+
description: Provides information about Lacci's purpose and operation
|
|
11
|
+
filters:
|
|
12
|
+
- type: glob
|
|
13
|
+
pattern: "lacci/**/*"
|
|
14
|
+
|
|
15
|
+
actions:
|
|
16
|
+
- type: suggest
|
|
17
|
+
message: |
|
|
18
|
+
# Working with Lacci
|
|
19
|
+
|
|
20
|
+
[lacci.md](mdc:docs/lacci.md)
|
|
21
|
+
|
|
22
|
+
You are currently working in Lacci, the Shoes4 compatibility layer for Scarpe.
|
|
23
|
+
For detailed documentation, see: docs/lacci.md
|
|
24
|
+
|
|
25
|
+
Key points to remember:
|
|
26
|
+
1. Lacci translates Shoes4 commands to display-agnostic operations
|
|
27
|
+
2. Uses Niente (null display service) for testing
|
|
28
|
+
3. Implements drawing context inheritance
|
|
29
|
+
4. Handles margins, fonts, and layout
|
|
30
|
+
|
|
31
|
+
Common patterns:
|
|
32
|
+
- Test new features with Niente first
|
|
33
|
+
- Follow existing error handling patterns
|
|
34
|
+
- Maintain backward compatibility
|
|
35
|
+
- Document changes thoroughly
|
|
36
|
+
|
|
37
|
+
examples:
|
|
38
|
+
- description: "Adding a new drawing primitive"
|
|
39
|
+
input: |
|
|
40
|
+
# Example of adding a new shape
|
|
41
|
+
module Shoes
|
|
42
|
+
class Triangle < Shape
|
|
43
|
+
def initialize(app, left, top, width, height, **styles)
|
|
44
|
+
super(app, left, top, width, height, **styles)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
metadata:
|
|
50
|
+
priority: high
|
|
51
|
+
version: 1.0
|
|
52
|
+
</rule>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Share Scarpe design context when working on related files
|
|
3
|
+
globs: docs/*.md
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Scarpe Design Context
|
|
7
|
+
|
|
8
|
+
<rule>
|
|
9
|
+
name: scarpe_design_context
|
|
10
|
+
description: Share relevant Scarpe design documentation when working on related files
|
|
11
|
+
filters:
|
|
12
|
+
- type: file
|
|
13
|
+
pattern: "docs/*.md"
|
|
14
|
+
|
|
15
|
+
actions:
|
|
16
|
+
- type: suggest
|
|
17
|
+
message: |
|
|
18
|
+
# Scarpe Design Context
|
|
19
|
+
|
|
20
|
+
When working on Scarpe-related files, it's important to consider the design principles and decisions made during its development. Here are key documents that provide context:
|
|
21
|
+
|
|
22
|
+
- @display_service_separation.md
|
|
23
|
+
- @shoes_and_display_events.md
|
|
24
|
+
- @event_loops.md
|
|
25
|
+
- @timeouts_and_handlers.md
|
|
26
|
+
- @calzini_components_and_updates.md
|
|
27
|
+
- @scarpe_shoes_incompatibilities.md
|
|
28
|
+
- @shoes_implementations.md
|
|
29
|
+
- @web_archaeology.md
|
|
30
|
+
|
|
31
|
+
These documents cover various aspects of Scarpe's design, including its relationship with Shoes, event handling, and component updates. Refer to them for a deeper understanding of the project's architecture and design choices.
|
|
32
|
+
|
|
33
|
+
examples:
|
|
34
|
+
- description: "Working on a Scarpe component"
|
|
35
|
+
input: |
|
|
36
|
+
# Working on a new Scarpe component
|
|
37
|
+
|
|
38
|
+
When creating a new component, it's crucial to understand how Scarpe handles updates and events. Refer to the following documents for guidance:
|
|
39
|
+
|
|
40
|
+
- @calzini_components_and_updates.md
|
|
41
|
+
- @shoes_and_display_events.md
|
|
42
|
+
|
|
43
|
+
metadata:
|
|
44
|
+
priority: medium
|
|
45
|
+
version: 1.0
|
|
46
|
+
</rule>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
description:
|
|
3
|
+
globs: **/*shoes*.rb,**/*shoes*.md
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Shoes Compatibility Context
|
|
7
|
+
|
|
8
|
+
<rule>
|
|
9
|
+
name: shoes_compatibility_context
|
|
10
|
+
description: Share relevant compatibility documentation when working with Shoes implementations
|
|
11
|
+
filters:
|
|
12
|
+
- type: file
|
|
13
|
+
pattern: **/*shoes*.rb
|
|
14
|
+
- type: file
|
|
15
|
+
pattern: **/*shoes*.md
|
|
16
|
+
- type: file
|
|
17
|
+
pattern: **/*compatibility*.rb
|
|
18
|
+
- type: file
|
|
19
|
+
pattern: **/*compatibility*.md
|
|
20
|
+
- type: file
|
|
21
|
+
pattern: **/*compat*.rb
|
|
22
|
+
- type: file
|
|
23
|
+
pattern: **/*compat*.md
|
|
24
|
+
|
|
25
|
+
actions:
|
|
26
|
+
- type: suggest
|
|
27
|
+
message: |
|
|
28
|
+
# Shoes Compatibility Context
|
|
29
|
+
|
|
30
|
+
When working with Shoes compatibility, consider:
|
|
31
|
+
|
|
32
|
+
1. Implementation History
|
|
33
|
+
- @docs/shoes_implementations.md - Various Shoes implementations
|
|
34
|
+
- @docs/scarpe_shoes_incompatibilities.md - Known differences
|
|
35
|
+
- @docs/web_archaeology.md - Historical context
|
|
36
|
+
|
|
37
|
+
2. Key Differences:
|
|
38
|
+
- Method names and signatures
|
|
39
|
+
- Event handling behavior
|
|
40
|
+
- Layout system changes
|
|
41
|
+
- API modifications
|
|
42
|
+
|
|
43
|
+
3. Implementation Types:
|
|
44
|
+
- Original Shoes (C/Ruby)
|
|
45
|
+
- Green Shoes (GTK+)
|
|
46
|
+
- Purple Shoes (Windows)
|
|
47
|
+
- Scarpe (Web-based)
|
|
48
|
+
|
|
49
|
+
4. Best Practices:
|
|
50
|
+
- Document incompatibilities clearly
|
|
51
|
+
- Provide migration paths when possible
|
|
52
|
+
- Consider cross-implementation testing
|
|
53
|
+
- Maintain historical context
|
|
54
|
+
|
|
55
|
+
5. Additional Resources:
|
|
56
|
+
- Wiki: https://github.com/scarpe-team/scarpe/wiki/ScarpeDesign.md#scarpe-shoes-incompatibilities
|
|
57
|
+
- Related sections:
|
|
58
|
+
* Display Service Separation
|
|
59
|
+
* Event Loops
|
|
60
|
+
* Timeouts and handlers
|
|
61
|
+
* Calzini Components
|
|
62
|
+
|
|
63
|
+
examples:
|
|
64
|
+
- description: "Working with Shoes compatibility"
|
|
65
|
+
input: |
|
|
66
|
+
When handling compatibility:
|
|
67
|
+
1. Check implementation differences
|
|
68
|
+
2. Document API changes
|
|
69
|
+
3. Consider migration paths
|
|
70
|
+
4. Test across implementations
|
|
71
|
+
|
|
72
|
+
metadata:
|
|
73
|
+
priority: high
|
|
74
|
+
version: 1.0
|
|
75
|
+
</rule>
|