Skip to content

soia-team/soia-open-skills / skills/soia-meta-sync-skills

soia-meta-sync-skills

Verified

按明确范围把共享技能目录软链到项目或宿主,写入前先 dry-run。触发:技能同步、同步预览、把技能链到项目

scripts/install_selection.py

View on GitHub
"""Shared, stdlib-only selection contract for meta install and sync workflows."""

from __future__ import annotations

from dataclasses import dataclass
from typing import Iterable


SCOPES = ("project", "global")
TARGET_KINDS = ("skill", "domain", "all")


@dataclass(frozen=True)
class InstallSelection:
    scope: str | None
    agents: tuple[str, ...]
    target_kind: str | None
    skills: tuple[str, ...]
    domains: tuple[str, ...]
    pending: tuple[str, ...]

    @property
    def selection_required(self) -> bool:
        return bool(self.pending)


def tokens(values: Iterable[str] | None) -> list[str]:
    result: list[str] = []
    for value in values or ():
        result.extend(part.strip() for part in value.split(",") if part.strip())
    return list(dict.fromkeys(result))


def select(
    *,
    scope: str | None,
    agents: Iterable[str] | None,
    target_kind: str | None,
    requested_skills: Iterable[str] | None,
    requested_domains: Iterable[str] | None,
    discovered: Iterable[str],
) -> InstallSelection:
    skills = tuple(tokens(requested_skills))
    domains = tuple(tokens(requested_domains))
    available = tuple(discovered)
    pending: list[str] = []
    if scope not in SCOPES:
        pending.append("scope")
    if target_kind not in TARGET_KINDS:
        pending.append("target_kind")
    if target_kind == "skill" and not skills:
        pending.append("skills")
    if target_kind == "domain" and not domains:
        pending.append("domains")
    if scope == "project" and not tuple(tokens(agents)):
        pending.append("agents")
    if skills == ("*",) and target_kind != "all":
        raise ValueError("--skills '*' requires --target-kind all")
    if target_kind == "skill":
        missing = [name for name in skills if name not in available]
        if missing:
            raise ValueError("requested skills not found in source-dir: " + ", ".join(missing))
        selected = skills
    elif target_kind == "domain":
        selected = tuple(name for name in available if any(name.startswith(f"soia-{domain}-") for domain in domains))
    elif target_kind == "all":
        selected = available
    else:
        selected = ()
    return InstallSelection(scope, tuple(tokens(agents)), target_kind, selected, domains, tuple(pending))
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall