repo-scan
Every ecosystem has its own dependency manager, but no tool looks across C++, Android, iOS, and Web to tell you: how much code is actually yours, what's third-party, and what's dead weight.
When to Use
- Taking over a large legacy codebase and need a structural overview
- Before major refactoring — identify what's core, what's duplicate, what's dead
- Auditing third-party dependencies embedded directly in source (not declared in package managers)
- Preparing architecture decision records for monorepo reorganization
Installation
# Clone first so the pinned commit can be reviewed before installation
set -euo pipefail
REPO_SCAN_COMMIT=2742664ebcad1450c208eda0ae45d3c17fad5dd8
REPO_SCAN_INSTALL_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/skills/repo-scan"
REPO_SCAN_INSTALL_PARENT="$(dirname "$REPO_SCAN_INSTALL_DIR")"
mkdir -p "$REPO_SCAN_INSTALL_PARENT"
REPO_SCAN_TMP="$(mktemp -d "$REPO_SCAN_INSTALL_PARENT/.repo-scan-install.XXXXXX")"
REPO_SCAN_TOKEN="${REPO_SCAN_TMP##*.}"
REPO_SCAN_STAGE="$REPO_SCAN_TMP/stage-$REPO_SCAN_TOKEN"
REPO_SCAN_BACKUP="$REPO_SCAN_TMP/backup-$REPO_SCAN_TOKEN"
REPO_SCAN_LOCK="$REPO_SCAN_INSTALL_PARENT/.repo-scan-install.lock"
REPO_SCAN_KEEP_TMP=0
REPO_SCAN_LOCK_HELD=0
REPO_SCAN_MV_HAS_NO_TARGET=0
cleanup_repo_scan_install() {
if [ "$REPO_SCAN_KEEP_TMP" -eq 0 ]; then
rm -rf -- "$REPO_SCAN_TMP"
fi
if [ "$REPO_SCAN_LOCK_HELD" -eq 1 ] && ! rmdir -- "$REPO_SCAN_LOCK"; then
printf 'Could not release installation lock at %s\n' "$REPO_SCAN_LOCK" >&2
fi
}
trap cleanup_repo_scan_install EXIT
mkdir "$REPO_SCAN_TMP/mv-probe-source"
if mv -T -- "$REPO_SCAN_TMP/mv-probe-source" \
"$REPO_SCAN_TMP/mv-probe-destination" 2>/dev/null; then
REPO_SCAN_MV_HAS_NO_TARGET=1
rmdir "$REPO_SCAN_TMP/mv-probe-destination"
else
rmdir "$REPO_SCAN_TMP/mv-probe-source"
fi
move_repo_scan_dir() {
REPO_SCAN_MOVE_SOURCE=$1
REPO_SCAN_MOVE_DESTINATION=$2
REPO_SCAN_MOVE_NAME=${REPO_SCAN_MOVE_SOURCE##*/}
if [ -e "$REPO_SCAN_MOVE_DESTINATION" ] || [ -L "$REPO_SCAN_MOVE_DESTINATION" ]; then
return 1
fi
if [ "$REPO_SCAN_MV_HAS_NO_TARGET" -eq 1 ]; then
mv -T -- "$REPO_SCAN_MOVE_SOURCE" "$REPO_SCAN_MOVE_DESTINATION"
return
fi
if ! mv -- "$REPO_SCAN_MOVE_SOURCE" "$REPO_SCAN_MOVE_DESTINATION"; then
return 1
fi
if [ -e "$REPO_SCAN_MOVE_DESTINATION/$REPO_SCAN_MOVE_NAME" ] || \
[ -L "$REPO_SCAN_MOVE_DESTINATION/$REPO_SCAN_MOVE_NAME" ]; then
if ! mv -- "$REPO_SCAN_MOVE_DESTINATION/$REPO_SCAN_MOVE_NAME" \
"$REPO_SCAN_MOVE_SOURCE"; then
REPO_SCAN_KEEP_TMP=1
printf 'Move conflict recovery failed; staged data remains at %s\n' \
"$REPO_SCAN_MOVE_DESTINATION/$REPO_SCAN_MOVE_NAME" >&2
fi
return 1
fi
}
git clone --filter=blob:none --no-checkout \
https://github.com/haibindev/repo-scan.git "$REPO_SCAN_TMP/source"
git -C "$REPO_SCAN_TMP/source" checkout --detach "$REPO_SCAN_COMMIT"
mkdir -p "$REPO_SCAN_STAGE"
git -C "$REPO_SCAN_TMP/source" archive "$REPO_SCAN_COMMIT" | \
tar -xf - -C "$REPO_SCAN_STAGE"
# Review "$REPO_SCAN_TMP/source" before approving installation.
printf 'Type install to replace %s after reviewing the pinned source: ' \
"$REPO_SCAN_INSTALL_DIR" >&2
read -r REPO_SCAN_CONFIRM
if [ "$REPO_SCAN_CONFIRM" != install ]; then
printf 'Installation cancelled.\n' >&2
exit 1
fi
if ! mkdir -- "$REPO_SCAN_LOCK" 2>/dev/null; then
printf 'Another repo-scan installation holds the lock at %s\n' \
"$REPO_SCAN_LOCK" >&2
exit 1
fi
REPO_SCAN_LOCK_HELD=1
if [ -e "$REPO_SCAN_INSTALL_DIR" ] || [ -L "$REPO_SCAN_INSTALL_DIR" ]; then
move_repo_scan_dir "$REPO_SCAN_INSTALL_DIR" "$REPO_SCAN_BACKUP"
fi
if ! move_repo_scan_dir "$REPO_SCAN_STAGE" "$REPO_SCAN_INSTALL_DIR"; then
if [ -e "$REPO_SCAN_BACKUP" ] || [ -L "$REPO_SCAN_BACKUP" ]; then
if [ -e "$REPO_SCAN_INSTALL_DIR" ] || [ -L "$REPO_SCAN_INSTALL_DIR" ]; then
REPO_SCAN_KEEP_TMP=1
printf 'Replacement failed and target was recreated; previous installation preserved at %s\n' \
"$REPO_SCAN_BACKUP" >&2
elif ! move_repo_scan_dir "$REPO_SCAN_BACKUP" "$REPO_SCAN_INSTALL_DIR"; then
REPO_SCAN_KEEP_TMP=1
printf 'Replacement and rollback failed; previous installation preserved at %s\n' \
"$REPO_SCAN_BACKUP" >&2
fi
fi
exit 1
fi
Review the source before installing any agent skill.
Installation completes only the bootstrap. Reload your agent harness, then invoke repo-scan again. This ECC pointer installs the external skill but does not run a scan itself.
Core Capabilities
| Capability |
Description |
| Cross-stack scanning |
C/C++, Java/Android, iOS (OC/Swift), Web (TS/JS/Vue) in one pass |
| File classification |
Every file tagged as project code, third-party, or build artifact |
| Library detection |
50+ known libraries (FFmpeg, Boost, OpenSSL…) with version extraction |
| Four-level verdicts |
Core Asset / Extract & Merge / Rebuild / Deprecate |
| HTML reports |
Interactive dark-theme pages with drill-down navigation |
| Monorepo support |
Hierarchical scanning with summary + sub-project reports |
Analysis Depth Levels
| Level |
Files Read |
Use Case |
fast |
1-2 per module |
Quick inventory of huge directories |
standard |
2-5 per module |
Default audit with full dependency + architecture checks |
deep |
5-10 per module |
Adds thread safety, memory management, API consistency |
full |
All files |
Pre-merge comprehensive review |
How It Works
- Classify the repo surface: enumerate files, then tag each as project code, embedded third-party code, or build artifact.
- Detect embedded libraries: inspect directory names, headers, license files, and version markers to identify bundled dependencies and likely versions.
- Score each module: group files by module or subsystem, then assign one of the four verdicts based on ownership, duplication, and maintenance cost.
- Highlight structural risks: call out dead-weight artifacts, duplicated wrappers, outdated vendored code, and modules that should be extracted, rebuilt, or deprecated.
- Produce the report: return a concise summary plus the interactive HTML output with per-module drill-down so the audit can be reviewed asynchronously.
Examples
On a 50,000-file C++ monorepo:
- Found FFmpeg 2.x (2015 vintage) still in production
- Discovered the same SDK wrapper duplicated 3 times
- Identified 636 MB of committed Debug/ipch/obj build artifacts
- Classified: 3 MB project code vs 596 MB third-party
Best Practices
- Start with
standard depth for first-time audits
- Use
fast for monorepos with 100+ modules to get a quick inventory
- Run
deep incrementally on modules flagged for refactoring
- Review the cross-module analysis for duplicate detection across sub-projects
Links
1---2name: repo-scan3description: Bootstrap pointer that installs the external repo-scan skill from a pinned, reviewable commit. Use when repo-scan must be installed before running its cross-stack source-code asset audit; this ECC pointer does not perform the audit itself.4---56# repo-scan78> Every ecosystem has its own dependency manager, but no tool looks across C++, Android, iOS, and Web to tell you: how much code is actually yours, what's third-party, and what's dead weight.910## When to Use1112- Taking over a large legacy codebase and need a structural overview13- Before major refactoring — identify what's core, what's duplicate, what's dead14- Auditing third-party dependencies embedded directly in source (not declared in package managers)15- Preparing architecture decision records for monorepo reorganization1617## Installation1819```bash20# Clone first so the pinned commit can be reviewed before installation21set -euo pipefail2223REPO_SCAN_COMMIT=2742664ebcad1450c208eda0ae45d3c17fad5dd824REPO_SCAN_INSTALL_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/skills/repo-scan"25REPO_SCAN_INSTALL_PARENT="$(dirname "$REPO_SCAN_INSTALL_DIR")"26mkdir -p "$REPO_SCAN_INSTALL_PARENT"27REPO_SCAN_TMP="$(mktemp -d "$REPO_SCAN_INSTALL_PARENT/.repo-scan-install.XXXXXX")"28REPO_SCAN_TOKEN="${REPO_SCAN_TMP##*.}"29REPO_SCAN_STAGE="$REPO_SCAN_TMP/stage-$REPO_SCAN_TOKEN"30REPO_SCAN_BACKUP="$REPO_SCAN_TMP/backup-$REPO_SCAN_TOKEN"31REPO_SCAN_LOCK="$REPO_SCAN_INSTALL_PARENT/.repo-scan-install.lock"32REPO_SCAN_KEEP_TMP=033REPO_SCAN_LOCK_HELD=034REPO_SCAN_MV_HAS_NO_TARGET=035cleanup_repo_scan_install() {36 if [ "$REPO_SCAN_KEEP_TMP" -eq 0 ]; then37 rm -rf -- "$REPO_SCAN_TMP"38 fi39 if [ "$REPO_SCAN_LOCK_HELD" -eq 1 ] && ! rmdir -- "$REPO_SCAN_LOCK"; then40 printf 'Could not release installation lock at %s\n' "$REPO_SCAN_LOCK" >&241 fi42}43trap cleanup_repo_scan_install EXIT44mkdir "$REPO_SCAN_TMP/mv-probe-source"45if mv -T -- "$REPO_SCAN_TMP/mv-probe-source" \46 "$REPO_SCAN_TMP/mv-probe-destination" 2>/dev/null; then47 REPO_SCAN_MV_HAS_NO_TARGET=148 rmdir "$REPO_SCAN_TMP/mv-probe-destination"49else50 rmdir "$REPO_SCAN_TMP/mv-probe-source"51fi52move_repo_scan_dir() {53 REPO_SCAN_MOVE_SOURCE=$154 REPO_SCAN_MOVE_DESTINATION=$255 REPO_SCAN_MOVE_NAME=${REPO_SCAN_MOVE_SOURCE##*/}56 if [ -e "$REPO_SCAN_MOVE_DESTINATION" ] || [ -L "$REPO_SCAN_MOVE_DESTINATION" ]; then57 return 158 fi59 if [ "$REPO_SCAN_MV_HAS_NO_TARGET" -eq 1 ]; then60 mv -T -- "$REPO_SCAN_MOVE_SOURCE" "$REPO_SCAN_MOVE_DESTINATION"61 return62 fi63 if ! mv -- "$REPO_SCAN_MOVE_SOURCE" "$REPO_SCAN_MOVE_DESTINATION"; then64 return 165 fi66 if [ -e "$REPO_SCAN_MOVE_DESTINATION/$REPO_SCAN_MOVE_NAME" ] || \67 [ -L "$REPO_SCAN_MOVE_DESTINATION/$REPO_SCAN_MOVE_NAME" ]; then68 if ! mv -- "$REPO_SCAN_MOVE_DESTINATION/$REPO_SCAN_MOVE_NAME" \69 "$REPO_SCAN_MOVE_SOURCE"; then70 REPO_SCAN_KEEP_TMP=171 printf 'Move conflict recovery failed; staged data remains at %s\n' \72 "$REPO_SCAN_MOVE_DESTINATION/$REPO_SCAN_MOVE_NAME" >&273 fi74 return 175 fi76}7778git clone --filter=blob:none --no-checkout \79 https://github.com/haibindev/repo-scan.git "$REPO_SCAN_TMP/source"80git -C "$REPO_SCAN_TMP/source" checkout --detach "$REPO_SCAN_COMMIT"81mkdir -p "$REPO_SCAN_STAGE"82git -C "$REPO_SCAN_TMP/source" archive "$REPO_SCAN_COMMIT" | \83 tar -xf - -C "$REPO_SCAN_STAGE"8485# Review "$REPO_SCAN_TMP/source" before approving installation.86printf 'Type install to replace %s after reviewing the pinned source: ' \87 "$REPO_SCAN_INSTALL_DIR" >&288read -r REPO_SCAN_CONFIRM89if [ "$REPO_SCAN_CONFIRM" != install ]; then90 printf 'Installation cancelled.\n' >&291 exit 192fi93if ! mkdir -- "$REPO_SCAN_LOCK" 2>/dev/null; then94 printf 'Another repo-scan installation holds the lock at %s\n' \95 "$REPO_SCAN_LOCK" >&296 exit 197fi98REPO_SCAN_LOCK_HELD=199100if [ -e "$REPO_SCAN_INSTALL_DIR" ] || [ -L "$REPO_SCAN_INSTALL_DIR" ]; then101 move_repo_scan_dir "$REPO_SCAN_INSTALL_DIR" "$REPO_SCAN_BACKUP"102fi103if ! move_repo_scan_dir "$REPO_SCAN_STAGE" "$REPO_SCAN_INSTALL_DIR"; then104 if [ -e "$REPO_SCAN_BACKUP" ] || [ -L "$REPO_SCAN_BACKUP" ]; then105 if [ -e "$REPO_SCAN_INSTALL_DIR" ] || [ -L "$REPO_SCAN_INSTALL_DIR" ]; then106 REPO_SCAN_KEEP_TMP=1107 printf 'Replacement failed and target was recreated; previous installation preserved at %s\n' \108 "$REPO_SCAN_BACKUP" >&2109 elif ! move_repo_scan_dir "$REPO_SCAN_BACKUP" "$REPO_SCAN_INSTALL_DIR"; then110 REPO_SCAN_KEEP_TMP=1111 printf 'Replacement and rollback failed; previous installation preserved at %s\n' \112 "$REPO_SCAN_BACKUP" >&2113 fi114 fi115 exit 1116fi117```118119> Review the source before installing any agent skill.120121Installation completes only the bootstrap. Reload your agent harness, then invoke `repo-scan` again. This ECC pointer installs the external skill but does not run a scan itself.122123## Core Capabilities124125| Capability | Description |126|---|---|127| **Cross-stack scanning** | C/C++, Java/Android, iOS (OC/Swift), Web (TS/JS/Vue) in one pass |128| **File classification** | Every file tagged as project code, third-party, or build artifact |129| **Library detection** | 50+ known libraries (FFmpeg, Boost, OpenSSL…) with version extraction |130| **Four-level verdicts** | Core Asset / Extract & Merge / Rebuild / Deprecate |131| **HTML reports** | Interactive dark-theme pages with drill-down navigation |132| **Monorepo support** | Hierarchical scanning with summary + sub-project reports |133134## Analysis Depth Levels135136| Level | Files Read | Use Case |137|---|---|---|138| `fast` | 1-2 per module | Quick inventory of huge directories |139| `standard` | 2-5 per module | Default audit with full dependency + architecture checks |140| `deep` | 5-10 per module | Adds thread safety, memory management, API consistency |141| `full` | All files | Pre-merge comprehensive review |142143## How It Works1441451. **Classify the repo surface**: enumerate files, then tag each as project code, embedded third-party code, or build artifact.1462. **Detect embedded libraries**: inspect directory names, headers, license files, and version markers to identify bundled dependencies and likely versions.1473. **Score each module**: group files by module or subsystem, then assign one of the four verdicts based on ownership, duplication, and maintenance cost.1484. **Highlight structural risks**: call out dead-weight artifacts, duplicated wrappers, outdated vendored code, and modules that should be extracted, rebuilt, or deprecated.1495. **Produce the report**: return a concise summary plus the interactive HTML output with per-module drill-down so the audit can be reviewed asynchronously.150151## Examples152153On a 50,000-file C++ monorepo:154- Found FFmpeg 2.x (2015 vintage) still in production155- Discovered the same SDK wrapper duplicated 3 times156- Identified 636 MB of committed Debug/ipch/obj build artifacts157- Classified: 3 MB project code vs 596 MB third-party158159## Best Practices160161- Start with `standard` depth for first-time audits162- Use `fast` for monorepos with 100+ modules to get a quick inventory163- Run `deep` incrementally on modules flagged for refactoring164- Review the cross-module analysis for duplicate detection across sub-projects165166## Links167168- [GitHub Repository](https://github.com/haibindev/repo-scan)