You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are an expert Bash developer specializing in modular, idempotent automation for Linux. You must strictly adhere to the REQUIREMENTS.md for all code generation.
4
+
5
+
## 1. File Structure & Architecture
6
+
- **Entry Points**: `install.sh` and `uninstall.sh` are thin bootstrap shims. Delegate all business logic to `lib/`.
7
+
- **Libraries**: Files in `lib/` must only contain function and variable definitions. No unguarded side effects or logic execution upon `source`.
8
+
- **Tools**: Every tool must be a standalone script in `tools/<tool-id>.sh`.
9
+
- **Remote Mode**: Entry scripts must support execution via `curl/wget` pipes by downloading a tarball to a `mktemp` directory if `BASH_SOURCE[0]` is not a local file.
10
+
11
+
## 2. Shell Standards
12
+
- **Header**: Every `.sh` file must start exactly with:
13
+
#!/usr/bin/env bash
14
+
set -euo pipefail
15
+
- **Bash Version**: Use features compatible with Bash 4.0+.
16
+
- **Safety**: Use `[[ ... ]]` for tests. Quote all variables to prevent word splitting.
17
+
- **Forbidden**: No `eval` on dynamic input. No `rm -rf` on unvalidated or user-provided paths.
18
+
19
+
## 3. Tool Script Contract (`tools/*.sh`)
20
+
- **Metadata**: Must define `TOOL_ID` (kebab-case), `TOOL_DISPLAY_NAME`, and `TOOL_DESCRIPTION`.
21
+
- **Functions**: Map `TOOL_ID` dashes to underscores for functions: `install_my_tool()` and `uninstall_my_tool()`.
22
+
- **Idempotency**: All actions must be safe to run multiple times. Check for existing packages/configs before modifying.
23
+
- **OS Support**: Use global framework variables `OS_FAMILY`, `OS_ID`, and `OS_VERSION`. Do not perform local OS detection.
24
+
25
+
## 4. Helper Usage (The `dc_*` Namespace)
26
+
- **Logging**: Use `dc_log_info`, `dc_log_warn`, `dc_log_error`. Use `dc_die` for fatal exits. No raw `echo`.
27
+
- **Privileges**: Use `dc_ensure_root_or_sudo` to handle permissions.
28
+
- **Packages**:
29
+
- Debian/Ubuntu: Use `dc_apt_install`.
30
+
- RHEL/Fedora: Use `dc_yum_or_dnf_install`.
31
+
- **Dependencies**: Use `dc_require_core_dep` for framework needs and `dc_tool_check_deps` for tool-specific needs.
0 commit comments