Skip to content

Commit fe3837b

Browse files
committed
chore: backup roocode config files
1 parent 28a815a commit fe3837b

10 files changed

Lines changed: 2955 additions & 1 deletion

File tree

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pnpm exec lint-staged
1+
#pnpm exec lint-staged

.roo/rules-code/rules.md

Whitespace-only changes.
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
<workflow_instructions>
2+
<mode_overview>
3+
This mode specializes in cross-platform dotfiles automation and development
4+
environment configuration. It focuses on creating robust, idempotent scripts
5+
that work seamlessly across Linux, WSL2, macOS, and Windows (Git Bash).
6+
</mode_overview>
7+
8+
<initialization_steps>
9+
<step number="1">
10+
<action>Analyze the user's request and target platforms</action>
11+
<details>
12+
Identify:
13+
- Target platforms (Linux, WSL2, macOS, Windows Git Bash)
14+
- Type of automation (installation, configuration, setup)
15+
- Required tools and dependencies
16+
- Security requirements and constraints
17+
</details>
18+
</step>
19+
20+
<step number="2">
21+
<action>Review existing project structure</action>
22+
<tools>
23+
<tool>list_files - Understand directory layout</tool>
24+
<tool>read_file - Examine existing scripts and configurations</tool>
25+
<tool>search_files - Find related patterns and implementations</tool>
26+
</tools>
27+
</step>
28+
29+
<step number="3">
30+
<action>Plan the implementation approach</action>
31+
<considerations>
32+
<consideration>Idempotency requirements</consideration>
33+
<consideration>Platform-specific variations</consideration>
34+
<consideration>Error handling and rollback strategies</consideration>
35+
<consideration>Security implications</consideration>
36+
</considerations>
37+
</step>
38+
</initialization_steps>
39+
40+
<main_workflow>
41+
<phase name="platform_detection">
42+
<description>Implement robust platform detection</description>
43+
<steps>
44+
<step>Detect OS type (Linux, macOS, Windows)</step>
45+
<step>Identify environment (native, WSL, container, Git Bash)</step>
46+
<step>Check available tools and package managers</step>
47+
<step>Determine appropriate paths and conventions</step>
48+
</steps>
49+
<code_pattern><![CDATA[
50+
# Platform detection pattern
51+
detect_platform() {
52+
case "$(uname -s)" in
53+
Linux*)
54+
if grep -qi microsoft /proc/version 2>/dev/null; then
55+
echo "wsl"
56+
elif [ -f /.dockerenv ] || [ -f /run/.containerenv ]; then
57+
echo "container"
58+
else
59+
echo "linux"
60+
fi
61+
;;
62+
Darwin*)
63+
echo "macos"
64+
;;
65+
MINGW*|MSYS*|CYGWIN*)
66+
echo "windows"
67+
;;
68+
*)
69+
echo "unknown"
70+
;;
71+
esac
72+
}
73+
]]></code_pattern>
74+
</phase>
75+
76+
<phase name="idempotent_implementation">
77+
<description>Implement changes with idempotency guarantees</description>
78+
<steps>
79+
<step>Check current state before making changes</step>
80+
<step>Use guard clauses to skip already-completed operations</step>
81+
<step>Implement atomic operations where possible</step>
82+
<step>Log all operations for debugging</step>
83+
</steps>
84+
<code_pattern><![CDATA[
85+
# Idempotent installation pattern
86+
install_tool() {
87+
local tool="$1"
88+
89+
# Guard: Check if already installed
90+
if command -v "$tool" &>/dev/null; then
91+
log_info "$tool is already installed"
92+
return 0
93+
fi
94+
95+
# Attempt installation
96+
log_info "Installing $tool..."
97+
if ! perform_installation "$tool"; then
98+
log_error "Failed to install $tool"
99+
return 1
100+
fi
101+
102+
# Verify installation
103+
if command -v "$tool" &>/dev/null; then
104+
log_success "$tool installed successfully"
105+
return 0
106+
else
107+
log_error "$tool installation verification failed"
108+
return 1
109+
fi
110+
}
111+
]]></code_pattern>
112+
</phase>
113+
114+
<phase name="shim_implementation">
115+
<description>Create shims for cross-platform compatibility</description>
116+
<steps>
117+
<step>Identify commands that need platform abstraction</step>
118+
<step>Create wrapper functions or scripts</step>
119+
<step>Implement fallback chains for missing commands</step>
120+
<step>Test shims on all target platforms</step>
121+
</steps>
122+
<code_pattern><![CDATA[
123+
# Shim pattern for cross-platform commands
124+
# Example: clipboard shim
125+
clipboard_copy() {
126+
case "$(detect_platform)" in
127+
macos)
128+
pbcopy
129+
;;
130+
linux|wsl)
131+
if command -v xclip &>/dev/null; then
132+
xclip -selection clipboard
133+
elif command -v xsel &>/dev/null; then
134+
xsel --clipboard --input
135+
elif [ -n "$WAYLAND_DISPLAY" ] && command -v wl-copy &>/dev/null; then
136+
wl-copy
137+
else
138+
log_warning "No clipboard tool available"
139+
return 1
140+
fi
141+
;;
142+
windows)
143+
clip
144+
;;
145+
esac
146+
}
147+
]]></code_pattern>
148+
</phase>
149+
150+
<phase name="security_review">
151+
<description>Apply zero-trust security practices</description>
152+
<steps>
153+
<step>Validate all inputs and environment variables</step>
154+
<step>Ensure no secrets are hardcoded</step>
155+
<step>Use secure defaults</step>
156+
<step>Implement proper permission handling</step>
157+
</steps>
158+
</phase>
159+
160+
<phase name="testing_and_validation">
161+
<description>Verify the implementation</description>
162+
<steps>
163+
<step>Test idempotency by running script multiple times</step>
164+
<step>Verify behavior on each target platform</step>
165+
<step>Check error handling paths</step>
166+
<step>Validate security requirements</step>
167+
</steps>
168+
</phase>
169+
</main_workflow>
170+
171+
<completion_criteria>
172+
<criterion>Script runs successfully on all target platforms</criterion>
173+
<criterion>Idempotency verified (multiple runs produce same result)</criterion>
174+
<criterion>Error handling covers all failure modes</criterion>
175+
<criterion>Security best practices followed</criterion>
176+
<criterion>Code is well-documented and maintainable</criterion>
177+
</completion_criteria>
178+
</workflow_instructions>

0 commit comments

Comments
 (0)