Skip to content

feat :: (#2) setup 파일 생성 #3

Open
uson1004 wants to merge 4 commits intodevelopfrom
feature/2-프로젝트-루트-변경-로직-구현

Hidden character warning

The head ref may contain hidden characters: "feature/2-\ud504\ub85c\uc81d\ud2b8-\ub8e8\ud2b8-\ubcc0\uacbd-\ub85c\uc9c1-\uad6c\ud604"
Open

feat :: (#2) setup 파일 생성 #3
uson1004 wants to merge 4 commits intodevelopfrom
feature/2-프로젝트-루트-변경-로직-구현

Conversation

@uson1004
Copy link
Owner

@uson1004 uson1004 commented Feb 6, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced an automated setup tool that auto-detects current Android project configuration, prompts for new values, and applies comprehensive restructuring including package name updates, build file modifications, and project directory renaming
  • Documentation

    • Added extensive Korean-language documentation to README describing setup tool automation, usage steps, and post-configuration guidance

@uson1004 uson1004 self-assigned this Feb 6, 2026
@uson1004 uson1004 added the enhancement New feature or request label Feb 6, 2026
@uson1004 uson1004 linked an issue Feb 6, 2026 that may be closed by this pull request
2 tasks
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

Two new files are added to the repository. README.md receives extensive Korean documentation describing the setup.sh script's purpose, usage, and post-execution steps. A new setup.sh script is introduced for automating Android project template configuration, including package name restructuring, source directory reorganization, gradle configuration updates, resource file modifications, and project directory renaming.

Changes

Cohort / File(s) Summary
Documentation
README.md
Adds Korean-language documentation describing the setup.sh script, including automation details, usage instructions, important notes, and post-run steps.
Setup Automation
setup.sh
Introduces comprehensive Android project setup automation script with functions for detecting current project configuration, validating user input, moving/reorganizing source directories, updating package declarations and imports, modifying gradle files, renaming files and directories, and providing user-friendly logging and interaction.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Through gradle forests, packages dance and sway,
This setup script enchants them all to play,
Moving sources, renaming with gentle care,
Android dreams transformed through script's fair share!
One hop, two hops—configuration blooms so bright,
A template reborn, perfectly right! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat :: (#2) setup 파일 생성' directly and clearly indicates the main change: creation of a setup file, which matches the primary content of the PR (introducing setup.sh). The Korean description 'setup 파일 생성' (setup file creation) accurately summarizes the core contribution.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/2-프로젝트-루트-변경-로직-구현

Comment @coderabbitai help to get the list of available commands and usage tips.

@uson1004 uson1004 changed the base branch from main to develop February 6, 2026 02:08
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@README.md`:
- Line 50: Remove the stray Korean laughter character "ㅋ" from the sentence that
currently reads "Android Studio (또는 선호하는 IDE)에서 프로젝트를 엽니다.ㅋ" in the README;
update it to "Android Studio (또는 선호하는 IDE)에서 프로젝트를 엽니다." and verify surrounding
punctuation/spacing is unchanged.

In `@setup.sh`:
- Around line 184-187: The current copy step uses cp -R "$src"/* "$dst"/ which
skips dotfiles; update the block that checks the source directory (uses
variables src and dst and the ls -A test) to temporarily enable bash dotglob
(shopt -s dotglob) before running cp -R "$src"/* "$dst"/ and then disable it
(shopt -u dotglob) so hidden files like .gitkeep are included; keep the existing
presence check to avoid copying when empty.
🧹 Nitpick comments (3)
setup.sh (3)

17-61: Consider separating variable declaration and assignment.

Shellcheck SC2155 warns that combining local with command substitution masks the command's return value. While this script handles detection gracefully (checking for empty values later), separating declaration and assignment is a defensive practice.

♻️ Example fix pattern
-    local app_kt_file=$(find app/src/main/java -name "*.kt" -type f 2>/dev/null | head -1)
+    local app_kt_file
+    app_kt_file=$(find app/src/main/java -name "*.kt" -type f 2>/dev/null | head -1)

Apply the same pattern to other local var=$(...) assignments in this function and elsewhere in the script.


124-136: Sed patterns are not escaped for regex metacharacters.

The $old variable is used directly in the sed pattern, but package names contain . which is a regex metacharacter matching any character. For example, com.example.app would also technically match com_example_app.

In practice this is unlikely to cause issues for this use case, but escaping the pattern would be more robust.

♻️ Proposed fix with escaping
 replace_in_file() {
     local file="$1"
     local old="$2"
     local new="$3"
+    # Escape regex metacharacters in old pattern
+    local escaped_old
+    escaped_old=$(printf '%s\n' "$old" | sed 's/[.[\*^$()+?{|]/\\&/g')

     if [[ -f "$file" ]]; then
         if [[ "$OSTYPE" == "darwin"* ]]; then
-            sed -i '' "s|$old|$new|g" "$file"
+            sed -i '' "s|$escaped_old|$new|g" "$file"
         else
-            sed -i "s|$old|$new|g" "$file"
+            sed -i "s|$escaped_old|$new|g" "$file"
         fi
     fi
 }

406-416: Consider adding explicit error handling for directory rename.

If the mv command fails (e.g., due to permissions or the target already existing), the set -e will abort the script. Adding explicit error handling would provide a better user experience with a clear error message.

♻️ Proposed improvement
     if [[ "$CURRENT_DIR" != "$NEW_PROJECT_DIR" ]]; then
+        if [[ -e "$NEW_PROJECT_DIR" ]]; then
+            log_error "Target directory already exists: $NEW_PROJECT_DIR"
+            log_warn "Setup completed but project directory was not renamed."
+            exit 1
+        fi
         cd "$PARENT_DIR"
-        mv "$CURRENT_DIR" "$NEW_PROJECT_DIR"
+        if ! mv "$CURRENT_DIR" "$NEW_PROJECT_DIR"; then
+            log_error "Failed to rename project directory"
+            cd "$CURRENT_DIR"
+            exit 1
+        fi
         log_success "Renamed project directory: $(basename "$CURRENT_DIR") -> $NEW_PROJECT_DIR_NAME"
         cd "$NEW_PROJECT_DIR"
     fi

README.md Outdated
```bash
cd /path/to/your-new-app-name
```
2. **Android Studio (또는 선호하는 IDE)에서 프로젝트를 엽니다**.ㅋ
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove errant character "ㅋ" from documentation.

Line 50 contains "엽니다.ㅋ" where "ㅋ" appears to be an accidental keystroke (Korean slang for laughter). This should be removed from the documentation.

✏️ Proposed fix
-2.  **Android Studio (또는 선호하는 IDE)에서 프로젝트를 엽니다**.ㅋ
+2.  **Android Studio (또는 선호하는 IDE)에서 프로젝트를 엽니다**.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
2. **Android Studio (또는 선호하는 IDE)에서 프로젝트를 엽니다**.
2. **Android Studio (또는 선호하는 IDE)에서 프로젝트를 엽니다**.
🤖 Prompt for AI Agents
In `@README.md` at line 50, Remove the stray Korean laughter character "ㅋ" from
the sentence that currently reads "Android Studio (또는 선호하는 IDE)에서 프로젝트를 엽니다.ㅋ"
in the README; update it to "Android Studio (또는 선호하는 IDE)에서 프로젝트를 엽니다." and
verify surrounding punctuation/spacing is unchanged.

Comment on lines +184 to +187
# Copy all contents
if [[ -n "$(ls -A "$src" 2>/dev/null)" ]]; then
cp -R "$src"/* "$dst"/
fi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Hidden files (dotfiles) are not copied.

The glob "$src"/* does not match hidden files like .gitkeep. This could result in data loss if the source directories contain dotfiles.

🐛 Proposed fix to copy all files including hidden ones
         # Copy all contents
         if [[ -n "$(ls -A "$src" 2>/dev/null)" ]]; then
-            cp -R "$src"/* "$dst"/
+            # Copy all files including hidden files
+            cp -R "$src"/. "$dst"/
         fi

Alternatively, enable dotglob temporarily:

shopt -s dotglob
cp -R "$src"/* "$dst"/
shopt -u dotglob
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Copy all contents
if [[ -n "$(ls -A "$src" 2>/dev/null)" ]]; then
cp -R "$src"/* "$dst"/
fi
# Copy all contents
if [[ -n "$(ls -A "$src" 2>/dev/null)" ]]; then
# Copy all files including hidden files
cp -R "$src"/. "$dst"/
fi
🤖 Prompt for AI Agents
In `@setup.sh` around lines 184 - 187, The current copy step uses cp -R "$src"/*
"$dst"/ which skips dotfiles; update the block that checks the source directory
(uses variables src and dst and the ls -A test) to temporarily enable bash
dotglob (shopt -s dotglob) before running cp -R "$src"/* "$dst"/ and then
disable it (shopt -u dotglob) so hidden files like .gitkeep are included; keep
the existing presence check to avoid copying when empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

프로젝트 루트 변경 로직 구현

1 participant