From ef1ecd5622784749790231a9d6c21290927c5d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C6=90=C9=94=C4=B1s3?= <8407711+w3spi5@users.noreply.github.com> Date: Sun, 25 Jan 2026 08:43:35 +0100 Subject: [PATCH] fix: Windows compatibility - CRLF handling and arithmetic exit codes --- .gitattributes | 4 ++ README.md | 101 ++++++++++++++++++++++--------------- scripts/project-install.sh | 41 +++++++++++---- 3 files changed, 95 insertions(+), 51 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..1c3a8c87 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +* text=auto eol=lf +*.sh text eol=lf +*.yml text eol=lf +*.md text eol=lf \ No newline at end of file diff --git a/README.md b/README.md index 78e2756d..e855b625 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,60 @@ -Agent OS - -## Agents that build the way you would - -[Agent OS](https://buildermethods.com/agent-os) helps you shape better specs, keeps agents aligned in a lightweight system that fits how you already build. - -Works alongside Claude Code, Cursor, Antigravity, and other AI tools. Any language, any framework. - -**Core capabilities:** - -- **Discover Standards** — Extract patterns and conventions from your codebase into documented standards -- **Deploy Standards** — Intelligently inject relevant standards based on what you're building -- **Shape Spec** — Create better plans that lead to better builds -- **Index Standards** — Keep your standards organized and discoverable - ---- - -### Documentation & Installation - -Docs, installation, usage, & best practices 👉 [It's all here](https://buildermethods.com/agent-os) - ---- - -### Follow updates & releases - -Read the [changelog](CHANGELOG.md) - -[Subscribe to be notified of major new releases of Agent OS](https://buildermethods.com/agent-os) - ---- - -### Created by Brian Casel @ Builder Methods - -Created by Brian Casel, the creator of [Builder Methods](https://buildermethods.com), where Brian helps professional software developers and teams build with AI. - -Get Brian's free resources on building with AI: -- [Builder Briefing newsletter](https://buildermethods.com) -- [YouTube](https://youtube.com/@briancasel) - -Join [Builder Methods Pro](https://buildermethods.com/pro) for official support and connect with our community of AI-first builders: - +Agent OS + +## Agents that build the way you would + +[Agent OS](https://buildermethods.com/agent-os) helps you shape better specs, keeps agents aligned in a lightweight system that fits how you already build. + +Works alongside Claude Code, Cursor, Antigravity, and other AI tools. Any language, any framework. + +**Core capabilities:** + +- **Discover Standards** — Extract patterns and conventions from your codebase into documented standards +- **Deploy Standards** — Intelligently inject relevant standards based on what you're building +- **Shape Spec** — Create better plans that lead to better builds +- **Index Standards** — Keep your standards organized and discoverable + +--- + +### Documentation & Installation + +Docs, installation, usage, & best practices 👉 [It's all here](https://buildermethods.com/agent-os) + +--- + +### Windows Users (Git Bash / MINGW) + +If the installation script exits silently after displaying "Configuration:", this is caused by Windows-style line endings (CRLF). + +**Option 1:** Convert line endings after cloning: + +```bash +find ~/agent-os -type f \( -name "*.sh" -o -name "*.yml" \) | while read f; do + tr -d '\r' < "$f" > "$f.tmp" && mv "$f.tmp" "$f" +done +``` + +**Option 2:** Configure Git before cloning: + +```bash +git config --global core.autocrlf false +``` + +--- + +### Follow updates & releases + +Read the [changelog](CHANGELOG.md) + +[Subscribe to be notified of major new releases of Agent OS](https://buildermethods.com/agent-os) + +--- + +### Created by Brian Casel @ Builder Methods + +Created by Brian Casel, the creator of [Builder Methods](https://buildermethods.com), where Brian helps professional software developers and teams build with AI. + +Get Brian's free resources on building with AI: +- [Builder Briefing newsletter](https://buildermethods.com) +- [YouTube](https://youtube.com/@briancasel) + +Join [Builder Methods Pro](https://buildermethods.com/pro) for official support and connect with our community of AI-first builders: \ No newline at end of file diff --git a/scripts/project-install.sh b/scripts/project-install.sh index 8688d4ad..cd1b2dce 100755 --- a/scripts/project-install.sh +++ b/scripts/project-install.sh @@ -5,7 +5,28 @@ # Installs Agent OS into a project's codebase # ============================================================================= -set -e +# Auto-fix CRLF line endings on Windows/MINGW +if [[ "$(uname -s)" == MINGW* ]] || [[ "$(uname -s)" == MSYS* ]]; then + SCRIPT_DIR_CHECK="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + BASE_DIR_CHECK="$(dirname "$SCRIPT_DIR_CHECK")" + + # Check if any file has CRLF + if grep -rIl $'\r' "$SCRIPT_DIR_CHECK"/*.sh "$BASE_DIR_CHECK/config.yml" >/dev/null 2>&1; then + echo "Detected Windows line endings (CRLF). Converting to Unix format (LF)..." + find "$BASE_DIR_CHECK" -type f \( -name "*.sh" -o -name "*.yml" \) | while read f; do + tr -d '\r' < "$f" > "$f.tmp" && mv "$f.tmp" "$f" + done + echo "Conversion complete. Restarting script..." + echo "" + exec "$0" "$@" + fi +fi + +# Retry mechanism: if AGENT_OS_RETRY is set, run without set -e +if [[ -z "$AGENT_OS_RETRY" ]]; then + set -e + trap 'echo ""; echo "Script failed. Retrying without strict mode..."; echo ""; AGENT_OS_RETRY=1 exec "$0" "$@"' ERR +fi # Get the directory where this script is located SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -241,11 +262,11 @@ install_standards() { grep -v "^${relative_path}|" "$sources_file" > "${sources_file}.tmp" 2>/dev/null || true mv "${sources_file}.tmp" "$sources_file" echo "${relative_path}|${profile_name}" >> "$sources_file" - ((profile_file_count++)) + ((profile_file_count++)) || true done < <(find "$profile_standards" -name "*.md" -type f ! -path "*/.backups/*" -print0 2>/dev/null) if [[ "$profile_file_count" -gt 0 ]]; then - ((profiles_used++)) + ((profiles_used++)) || true fi done <<< "$INHERITANCE_CHAIN" @@ -335,11 +356,11 @@ create_index() { local desc=$(get_existing_description "root" "$filename") if [[ -z "$desc" ]]; then desc="Needs description - run /index-standards" - ((new_count++)) + ((new_count++)) || true fi echo " $filename:" >> "$temp_file" echo " description: $desc" >> "$temp_file" - ((entry_count++)) + ((entry_count++)) || true done <<< "$root_files" echo "" >> "$temp_file" fi @@ -357,11 +378,11 @@ create_index() { local desc=$(get_existing_description "$folder_name" "$filename") if [[ -z "$desc" ]]; then desc="Needs description - run /index-standards" - ((new_count++)) + ((new_count++)) || true fi echo " $filename:" >> "$temp_file" echo " description: $desc" >> "$temp_file" - ((entry_count++)) + ((entry_count++)) || true done <<< "$md_files" echo "" >> "$temp_file" fi @@ -399,7 +420,7 @@ install_commands() { for file in "$commands_source"/*.md; do if [[ -f "$file" ]]; then cp "$file" "$commands_dest/" - ((count++)) + ((count++)) || true fi done @@ -447,7 +468,7 @@ main() { done chain_display="$chain_display"$'\n'"$indent ↳ inherits from: $profile_name" fi - ((chain_depth++)) + ((chain_depth++)) || true done <<< "$reversed_chain" echo "$chain_display" @@ -474,4 +495,4 @@ main() { } # Run main function -main "$@" +main "$@" \ No newline at end of file