dogma - Sync patterns from sync.md to all repos
Syncs AI/tool ignore patterns from central sync.md to multiple repositories.
npx claudepluginhub marcel-bich/marcel-bich-claude-marketplaceignore/You are executing the /dogma:ignore:sync-all command. Your task is to sync all AI/tool patterns from sync.md to selected local repositories.
This command is ONLY available in the marketplace repository where sync.md exists.
# Script directory for token-safe utilities
SCRIPT_DIR="${CLAUDE_PLUGIN_ROOT:-$(dirname "$(dirname "$(realpath "$0")")")}/scripts"
# Check if this is the marketplace repo
MARKETPLACE_DETECTED="false"
# Method 1: Check git remote (token-safe)
if "$SCRIPT_DIR/git-remote-safe.sh" url 2>/dev/null | grep -q "marcel-bich-claude-marketplace"; then
MARKETPLACE_DETECTED="true"
fi
# Method 2: Check for sync.md in plugins/dogma/commands/
if [ -f "plugins/dogma/commands/sync.md" ]; then
MARKETPLACE_DETECTED="true"
fi
If MARKETPLACE_DETECTED is "false":
Do NOT just show an error. Instead, explain and offer to help:
/dogma:ignore:sync-all is designed for central pattern management in the
marcel-bich-claude-marketplace repo. All AI-tool patterns are maintained
in sync.md there and distributed to other repos from that location.
For adding individual patterns to this repo, use:
/dogma:ignore .aider* .continue*
This adds patterns to multiple locations at once:
- .gitignore (versioned, shared with team)
- .git/info/exclude (local only, not versioned)
To audit which patterns are missing where:
/dogma:ignore:audit
Then use AskUserQuestion:
What were you trying to achieve?
1. Add patterns to .gitignore AND .git/info/exclude -> /dogma:ignore
2. Audit which patterns are missing where -> /dogma:ignore:audit
3. Something else (please describe)
Based on user response:
/dogma:ignore [patterns]/dogma:ignore:audit for themOnly stop if user explicitly cancels.
Read the file plugins/dogma/commands/sync.md and extract all patterns from the section:
"Build comprehensive AI-file patterns list" (Step 4.5.3)
Look for the code block that contains patterns like:
[Dd][Oo][Gg][Mm][Aa]-[Pp][Ee][Rr][Mm][Ii][Ss][Ss][Ii][Oo][Nn][Ss].[Mm][Dd].[Aa][Ii][Dd][Ee][Rr]*Extract all patterns (lines that are not comments and not empty) from the patterns section.
Group patterns by category for better overview:
Sync von X Patterns aus sync.md
Kategorien:
- Dogma-specific: X patterns
- Claude Code: X patterns
- Cursor: X patterns
- ...
# Get current directory name
CURRENT_DIR=$(basename "$PWD")
# Find git repos in parent directory
PARENT_DIR=$(dirname "$PWD")
SIBLING_REPOS=""
for dir in "$PARENT_DIR"/*/; do
if [ -d "${dir}.git" ] && [ "$(basename "$dir")" != "$CURRENT_DIR" ]; then
SIBLING_REPOS="$SIBLING_REPOS$(basename "$dir")\n"
fi
done
Auf welche Repos anwenden?
Gefundene Repos in ../:
1. ../marcel-bich-claude-ideas
2. ../web-selecta-7850
3. ../another-project
Optionen:
A. Alle oben aufgelisteten Repos
C. Aktuelles Repo (dieses hier)
P. Eigenen Pfad eingeben
S. Auswahl (kommagetrennte Nummern, z.B. "1,3")
Deine Wahl:
For custom path:
Pfad eingeben (absolut oder relativ):
> ~/projects/my-repo
Validiere...
# Validate custom path
CUSTOM_PATH="${CUSTOM_PATH/#\~/$HOME}"
if [ ! -d "$CUSTOM_PATH/.git" ]; then
echo "Fehler: $CUSTOM_PATH ist kein Git-Repository"
# Ask again or abort
fi
For each selected repository:
cd "$REPO_PATH"
GITIGNORE_PATH=".gitignore"
if [ -f "$GITIGNORE_PATH" ]; then
EXISTING_CONTENT=$(cat "$GITIGNORE_PATH")
else
EXISTING_CONTENT=""
fi
For each pattern:
# Check if pattern exists
pattern_exists() {
grep -qF "$1" "$GITIGNORE_PATH" 2>/dev/null
}
Only add patterns that don't already exist.
Important: Add a section header if adding patterns for the first time:
# ======================================
# AI/Agent Files (managed by dogma:ignore:sync-all)
# ======================================
../marcel-bich-claude-ideas:
+ .aider* (.gitignore)
+ .continue* (.gitignore)
= 2 hinzugefuegt
Or if no changes needed:
../marcel-bich-claude-ideas:
= Alle Patterns bereits vorhanden
Sync von 12 Patterns aus sync.md
../marcel-bich-claude-ideas:
+ .aider* (.gitignore)
+ .continue* (.gitignore)
= 2 hinzugefuegt
../web-selecta-7850:
+ .aider* (.gitignore)
+ .codeium* (.gitignore)
= 2 hinzugefuegt
../already-configured-repo:
= Alle Patterns bereits vorhanden
Gesamt: 4 Patterns zu 2 Repos hinzugefuegt
The patterns to sync are maintained in plugins/dogma/commands/sync.md in the section "Build comprehensive AI-file patterns list".
These include patterns for: