Skip to content
Back to skills

Map Repos

BSecurity

Links the repositories and documentation folders in the projects folder to Duccio's (the second brain's) clients and projects, creating or updating client notes and project hubs. Use on the first run of the vault, after cloning new repos, or when the user asks to map or link the projects folder.

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 1, 2026
ai-agentspythonbashangularnodeterraformgitdocumentation

Works with

  • cli

Security analysis

B88/100
  • criticalSends environment variables or credentials to an external URL

Pro shows the line behind each finding and how to fix it

Scanned December 1, 2026

npx -y skills add gabrycaos/duccio --skill map-repos --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Map Repos?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Map Repos
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrycaos-map-repos/badge)](https://www.skillsdirectory.com/skills/gabrycaos-map-repos)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: map-repos
description: Links the repositories and documentation folders in the projects folder to Duccio's (the second brain's) clients and projects, creating or updating client notes and project hubs. Use on the first run of the vault, after cloning new repos, or when the user asks to map or link the projects folder.
---

# map-repos

Work from the repo root. Apply the "Writing rules" and "Git protocol" sections of `AGENTS.md`. Folder names and headings below are the English ones; in a vault of another language use the matching names from the table in "Vault language". The projects folder (the folder that holds your repos, set in `config/local.yaml`) is read-only.

Required layout: `<projects folder>/<client>/<repo>`. The first-level folder is the client (e.g. `acme`, or `personal`); repos live one to three levels below it.

## 1. Pull

Pull according to the Git protocol.

## 2. Find the candidates

```bash
# the projects folder comes from the configuration; if this fails, print its message and stop
WS="$(.venv/bin/python scripts/sbconfig.py workspace)" || exit 1
WS="$(cd -P "$WS" && pwd)" || exit 1   # physical path, so it compares with pwd -P

# Duccio itself, if it lies inside the projects folder (compare physical paths)
SB="$(pwd -P)"
case "$SB" in "$WS"/*) SB_REL="${SB#"$WS"/}" ;; *) SB_REL="" ;; esac

# look for .git without ever entering dependency, build and cache folders
find_git() {
  /usr/bin/find "$@" \( -name node_modules -o -name bower_components -o -name vendor \
    -o -name .venv -o -name venv -o -name __pycache__ -o -name .tox -o -name target \
    -o -name build -o -name dist -o -name .gradle -o -name .m2 -o -name .next -o -name .nuxt \
    -o -name .angular -o -name .svelte-kit -o -name coverage -o -name .terraform \
    -o -name Pods -o -name .cache \) -prune -o -name .git -print
}

# git repos, from 1 to 3 levels below the client folder (Duccio excluded)
find_git "$WS" -mindepth 3 -maxdepth 5 | sed "s|^$WS/||; s|/\.git\$||" | sort \
  | SB_REL="$SB_REL" awk 'BEGIN { sb = ENVIRON["SB_REL"] } sb == "" || ($0 != sb && index($0, sb "/") != 1)'

# second-level folders that are not repos and contain no repos (documentation)
for d in "$WS"/*/*/; do
  d="${d%/}"
  if [ -n "$SB_REL" ]; then
    case "$d" in "$WS/$SB_REL"|"$WS/$SB_REL"/*) continue ;; esac
  fi
  [ -e "$(dirname "$d")/.git" ] && continue
  [ -e "$d/.git" ] && continue
  find_git "$d" -maxdepth 3 | grep -q . && continue
  echo "${d#"$WS"/}"
done

# paths already linked to a hub
.venv/bin/python - <<'EOF'
import glob, sys
sys.path.insert(0, "scripts")
import sbconfig
import yaml

try:
    code = sbconfig.language()
    if code is None:
        sys.exit("vault language not configured: run scripts/setup.sh")
    folders = sbconfig.vocabulary(code).folders
except sbconfig.ConfigError as exc:
    sys.exit(str(exc))
for path in sorted(glob.glob(f"vault/{folders['clients']}/*/{folders['projects']}/*/*.md")):
    text = open(path, encoding="utf-8").read()
    if text.startswith("---\n"):
        meta = yaml.safe_load(text[4:text.find("\n---", 3)]) or {}
        for repo in meta.get("repos") or []:
            print(repo)
EOF
```

Exclude from the candidates:
- the Duccio repo and everything it contains (the commands above already skip it by its real path, whatever its folder name, and only when it lies inside the projects folder);
- repos nested inside another candidate repo (submodules): keep only the outermost;
- paths that match a pattern in `config/workspace-ignore.txt` (globs relative to the projects folder; ignore blank lines and `#`);
- paths already linked to a hub.

If nothing is left, say so and stop. If there were no candidates at all, remind the user of the required layout `<projects folder>/<client>/<repo>`.

## 3. Gather information

For each candidate:

```bash
WS="$(.venv/bin/python scripts/sbconfig.py workspace)" || exit 1
git -C "$WS/<path>" remote get-url origin 2>/dev/null
git -C "$WS/<path>" log -1 --date=short --format=%ad 2>/dev/null
```

plus the first ~20 lines of the README if there is one. For non-git folders, the list of the main files.

## 4. Propose the mapping

- **Client**: the first-level folder (e.g. `acme`) matches the client whose note has `acme` in its `workspace` list (look in the frontmatter of `vault/Clients/*/*.md`; a client can have several folders, e.g. `[acme, acme-legacy]`). If no note has that folder in `workspace`, look for an existing client by name or `aliases` (e.g. `acme` ↔ `Acme`) and propose that one. If there is none, propose a new client and ask for the readable name (`personal` → `Personal`).
- **Project**: group related candidates (common prefixes, READMEs, remotes) into projects; a project can have several repos. If an existing project matches, propose that one.
- Show the user a table `path → client → project (new/existing)` and ask for each row: confirm, correct or ignore.
- Proceed only with the confirmed or corrected rows.

## 5. Write

- Existing client that does not have the folder in `workspace`: add it to the list (with the rule on uncommitted changes).
- New client: `vault/Clients/<C>/<C>.md` from `vault/Templates/client.md`, with `workspace: [<folder>]` (several folders if the user assigns them to the same client) and a line in `## Log`.
- New project: `vault/Clients/<C>/Projects/<P>/<P>.md` from `vault/Templates/project.md`, with `client: "[[<C>]]"`, `status: active`, `repos`, an initial `## Status` drawn from the READMEs and the links to the repos in `## Sources`; add `- [[<P>]]` under `## Projects` of the client note; a Log line in both.
- Existing project: add the paths to `repos` and a Log line (with the rule on uncommitted changes).
- Ignored rows: add the path, or a pattern if the user asks for it, to `config/workspace-ignore.txt`.

## 6. Commit and push

Stage only the touched files (including `config/workspace-ignore.txt` if modified), `git commit -m "map-repos: <summary>"`, push according to the Git protocol.

Summary: clients and projects created or updated, repos linked, ignored paths, pending push.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.