Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

newsletter-events-remove-source

БесплатноБез исполняемых скриптовНе проверен

Remove Instagram accounts or web aggregators from sources.yaml configuration

aniketpanjwaniот aniketpanjwani★ 40 звёзд на GitHub16 установок в других каталогах

Об этом скилле

## Configuration Location

All sources are stored in ~/.config/local-media-tools/sources.yaml.

Identifier Matching

Input Matches
@handle Instagram account by handle
handle (no @) Instagram account by handle
https://site.com Web aggregator by URL
"Page Name" Any source by name (asks if ambiguous)

Note: Facebook events are not stored in configuration, so there's nothing to remove.

Safety Features

  • Automatic backup before removal
  • Validation after removal
  • Automatic rollback if validation fails
  • Orphan reference cleanup (priority_handles)
What sources do you want to remove?

Examples:

  • @localvenue - Remove Instagram account
  • @venue1 @venue2 - Remove multiple Instagram accounts
  • https://events.com - Remove web aggregator
  • "Local Venue" - Remove by name (any type)

Provide the source(s) to remove:

## Step 1: Parse Identifiers

Analyze the user's input to extract sources to remove:

Instagram detection:

  • Starts with @ → Instagram handle
  • Word that looks like a handle (alphanumeric + underscores) → Instagram handle

Web Aggregator detection:

  • Any URL (http:// or https://) → Web aggregator

Name detection:

  • Quoted string → Search by name across all types

Extract multiple sources:

  • Split on commas, "and", spaces, newlines
  • Deduplicate

Step 2: Load Current Config

from pathlib import Path
import yaml

config_path = Path.home() / ".config" / "local-media-tools" / "sources.yaml"

if not config_path.exists():
    print("ERROR: sources.yaml not found. Run /newsletter-events:setup first.")
    # STOP HERE

with open(config_path) as f:
    config = yaml.safe_load(f)

Step 3: Match Sources

For each identifier, find matches:

def find_matches(identifier: str, config: dict) -> list:
    """
    Match priority:
    1. Exact Instagram handle (case-insensitive)
    2. Exact Web URL (normalized)
    3. Exact name match (any type)
    """
    matches = []
    normalized = identifier.lower().lstrip("@").strip('"\'')
    sources = config.get("sources", {})

    # Check Instagram handles
    for account in sources.get("instagram", {}).get("accounts", []):
        if account["handle"].lower() == normalized:
            matches.append({"type": "instagram", "item": account, "match": "handle"})

    # Check Web aggregators
    for source in sources.get("web_aggregators", {}).get("sources", []):
        if normalized in source["url"].lower():
            matches.append({"type": "web", "item": source, "match": "url"})

    # Check names (all types) if no URL/handle matches
    if not matches:
        for account in sources.get("instagram", {}).get("accounts", []):
            if account.get("name", "").lower() == normalized:
                matches.append({"type": "instagram", "item": account, "match": "name"})
        for source in sources.get("web_aggregators", {}).get("sources", []):
            if source.get("name", "").lower() == normalized:
                matches.append({"type": "web", "item": source, "match": "name"})

    return matches

Step 4: Handle Ambiguity

If an identifier matches multiple sources, ask the user to clarify:

Multiple sources match 'venue':
1. @venue (Instagram) - Local Venue
2. https://venue.com (Web) - Venue Events

Which one(s) to remove? (Enter numbers separated by commas, or 'all'):

Step 5: Confirm if Large Batch

If removing 4+ sources, ask for confirmation:

About to remove 5 sources:
- @localvenue (Instagram)
- @oldbar (Instagram)
- @closedgallery (Instagram)
- https://defunctsite.com (Web)
- https://oldsite.com (Web)

This cannot be undone. Continue? (y/n):

Step 6: Backup Original Config

import shutil
from datetime import datetime

backup_path = config_path.with_suffix(f".yaml.{datetime.now():%Y%m%d%H%M%S}.backup")
shutil.copy2(config_path, backup_path)

Step 7: Remove Sources

removed = []
not_found = []

for identifier, matches in matched_sources.items():
    if not matches:
        not_found.append(identifier)
        continue

    for match in matches:
        if match["type"] == "instagram":
            config["sources"]["instagram"]["accounts"] = [
                a for a in config["sources"]["instagram"]["accounts"]
                if a["handle"].lower() != match["item"]["handle"].lower()
            ]
        elif match["type"] == "web":
            config["sources"]["web_aggregators"]["sources"] = [
                s for s in config["sources"]["web_aggregators"]["sources"]
                if s["url"].lower() != match["item"]["url"].lower()
            ]
        removed.append(match)

Step 8: Clean Orphaned References

If removing an Instagram account, also clean up priority_handles:

# Get remaining handles
remaining_handles = {
    a["handle"].lower()
    for a in config["sources"]["instagr
Полный SKILL.md на GitHub

Установить newsletter-events-remove-source в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл newsletter-events-remove-source?

Remove Instagram accounts or web aggregators from sources.yaml configuration

Как установить скилл newsletter-events-remove-source?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл newsletter-events-remove-source запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить newsletter-events-remove-source с