Skip to content

Add git repo template script - #216

Merged
bubacoder merged 1 commit into
mainfrom
feature/repo-template
Nov 1, 2025
Merged

Add git repo template script#216
bubacoder merged 1 commit into
mainfrom
feature/repo-template

Conversation

@bubacoder

@bubacoder bubacoder commented Oct 31, 2025

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Chores
    • Added a utility script to copy a set of repository template and configuration files into a target repo while preserving directory structure.
    • Script ensures robust execution, creates destination directories as needed, and prints progress for each item processed.

@coderabbitai

coderabbitai Bot commented Oct 31, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a new Bash script that copies a predefined set of configuration files from a source directory to a target repository template, preserving directory structure and creating destination directories as needed; the script uses strict shell options and prints each processed path.

Changes

Cohort / File(s) Summary
New shell script
scripts/copy-repo-template.sh
Adds a Bash script (with set -euo pipefail) that enumerates config files, ensures destination directories exist, and copies each file from SOURCE to TARGET, printing paths as it processes them. A commented-out files_to_touch block remains inactive.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant DevRepo as Source directory
    participant Script as copy-repo-template.sh
    participant Template as Target repository

    DevRepo-->>Script: provide file list
    Script->>Script: for each file\ncreate dest dir if missing
    Script->>Template: copy file
    Script-->>DevRepo: log processed path
    Note over Script,Template: repeats for each configured file
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify correct quoting/escaping of file paths to avoid word-splitting or globbing.
  • Confirm set -euo pipefail behavior is appropriate for the intended usage.
  • Ensure SOURCE and TARGET are defined/documented and the file list covers required config files.
  • Review the commented-out files_to_touch block for intended purpose or removal.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "Add git repo template script" directly corresponds to the main change in the changeset, which introduces a new Bash script at scripts/copy-repo-template.sh for copying configuration files to a repository template. The title is concise, clear, and uses straightforward language without vague terminology or noise. A teammate reviewing the git history would immediately understand that this PR adds a new script for repository template management, which accurately reflects the primary objective of the change.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/repo-template

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6498530 and 88d1af4.

📒 Files selected for processing (1)
  • scripts/copy-repo-template.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/copy-repo-template.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: check

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
scripts/copy-repo-template.sh (1)

30-33: Commented-out code suggests incomplete feature.

The files_to_touch array is disabled and appears to represent future functionality. If this is not planned for the near term, consider removing it to reduce clutter. If it is planned, consider opening a tracking issue or adding a FIXME comment.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 08946d1 and 6498530.

📒 Files selected for processing (1)
  • scripts/copy-repo-template.sh (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.sh

📄 CodeRabbit inference engine (AGENTS.md)

Shell scripts must pass ShellCheck linting

Files:

  • scripts/copy-repo-template.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: check
🔇 Additional comments (4)
scripts/copy-repo-template.sh (4)

1-2: Good use of defensive shell options.

The shebang and set -euo pipefail are appropriate for a production script, ensuring errors halt execution and unset variables are caught.


8-28: Array definition is clear and well-organized.

The files array is logically grouped by category with helpful comments. The entries look reasonable for a repository template.


36-42: Copy loop lacks input validation and error context.

The loop will fail silently if SOURCE or TARGET directories don't exist, or if a source file is missing. While set -e ensures the script exits on error, the error messages could be more informative.

Consider adding validation and better error handling:

 # Copy each file, preserving directory structure
+if [[ ! -d "$SOURCE" ]]; then
+  echo "Error: SOURCE directory does not exist: $SOURCE" >&2
+  exit 1
+fi
+
 for file in "${files_to_copy[@]}"; do
   echo "$file"
   src="$SOURCE/$file"
   dst="$TARGET/$file"
+  if [[ ! -f "$src" ]]; then
+    echo "Error: Source file not found: $src" >&2
+    exit 1
+  fi
   mkdir -p "$(dirname "$dst")"
   cp "$src" "$dst"
 done

1-42: ShellCheck verification passed.

The script passes ShellCheck linting and complies with the coding guidelines requirement.

Comment thread scripts/copy-repo-template.sh Outdated
@bubacoder
bubacoder force-pushed the feature/repo-template branch from 6498530 to 88d1af4 Compare November 1, 2025 07:33
@bubacoder
bubacoder merged commit b24cce3 into main Nov 1, 2025
4 checks passed
@bubacoder
bubacoder deleted the feature/repo-template branch November 1, 2025 07:51
@coderabbitai coderabbitai Bot mentioned this pull request Dec 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant