/dx-hub:dx-discover-repos <work-item-id>from dx-hub
Resolves which repos a work item touches using a cascade: explicit directive, simple block, cross-repo table, then LLM fallback. Used by the KAI-HUB router to fan agents across repos.
Ships in dx-hub. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Resolve the set of repos a work item touches and emit a structured JSON array the KAI-HUB router uses to fan a worker pipeline out — one run per repo.
This skill is the multi-repo brain of the hub model. Single-repo projects never call it: their worker fires directly via its own webhook (dual-mode workers).
| Input | Source | Notes |
|---|---|---|
workItemId | skill argument | the ticket being routed |
| trigger-comment text | .ai/run-context/trigger-comment.txt if present, else fetch from the work item | the human comment that fired the hook (after @kai-<agent>) |
| repo registry | $DX_REPOS_REGISTRY (default .ai/automation/registries/repos.json) | alias → metadata; see dx-hub/shared/registry-format.md |
A JSON array, constrained to known registry aliases — never invent repos:
[
{ "alias": "brand-one", "repoId": "…", "adoProject": "Example Project",
"cloneUrl": "https://…/_git/brand-one", "branch": "development",
"reason": "explicit 'repos:' directive in trigger comment" }
]
On ambiguity or no match the skill emits a structured error object instead of an array, which the hub turns into a clarification comment on the work item:
{ "error": "ambiguous", "code": 3, "message": "project spans 2 platforms — add 'platform:' …" }
{ "error": "no-match", "code": 8, "message": "no candidate repo matched platform=… scope=… brand=…" }
First non-empty tier wins. Tiers 0–2 are deterministic (fully testable offline); tier 3 is the LLM fallback, constrained to registry aliases.
digraph discover {
"Start" [shape=box];
"Tier 0: explicit repos: directive?" [shape=diamond];
"Tier 1: simple block present?" [shape=diamond];
"Tier 1 route ok?" [shape=diamond];
"Tier 2: cross-repo table?" [shape=diamond];
"Tier 3: LLM choose from registry" [shape=box];
"Emit JSON array" [shape=doublecircle];
"Emit structured error" [shape=doublecircle];
"Start" -> "Tier 0: explicit repos: directive?";
"Tier 0: explicit repos: directive?" -> "Emit JSON array" [label="non-empty"];
"Tier 0: explicit repos: directive?" -> "Tier 1: simple block present?" [label="empty"];
"Tier 1: simple block present?" -> "Tier 1 route ok?" [label="yes"];
"Tier 1: simple block present?" -> "Tier 2: cross-repo table?" [label="no"];
"Tier 1 route ok?" -> "Emit JSON array" [label="repos resolved"];
"Tier 1 route ok?" -> "Emit structured error" [label="exit 3 / exit 8"];
"Tier 2: cross-repo table?" -> "Emit JSON array" [label="non-empty"];
"Tier 2: cross-repo table?" -> "Tier 3: LLM choose from registry" [label="empty"];
"Tier 3: LLM choose from registry" -> "Emit JSON array";
}
Run scripts/parse-explicit-repos.sh <comment-file> $DX_REPOS_REGISTRY. It reads
a repos: a, b directive a human typed after the @kai-<agent> tag and maps
each alias to its registry entry. Deterministic, no LLM. Unknown aliases are
skipped with a warning. A non-empty array wins the cascade immediately.
If the story has a ```simple block, this is a /dx-simple ticket — route by
its declared platform/brand/scope:
dx-simple/scripts/parse-simple-block.sh <raw-story.md> /tmp/block.yaml
(resolve via $PLUGIN_BASE_DIR/dx-core/skills/dx-simple/scripts/… in the
pipeline; the worker keeps this script — only the routing brain moved here).
Bridge: synthesize a config.yaml-shaped repos: block from the registry
so route-targets.sh (which reads YAML via repos_table, not JSON) can
consume it. repos.json stays the single source of truth:
jq -r '"repos:", (to_entries[] | " - name: \(.key)\n role: \(.value.role)" +
(if .value.platform then "\n platform: \(.value.platform)" else "" end) +
(if .value.brand then "\n brand: \(.value.brand)" else "" end) +
(if .value.adoProject then "\n ado-project: \(.value.adoProject)" else "" end))' \
"$DX_REPOS_REGISTRY" > /tmp/discover-repos.yaml
Build a reachability map (every alias → placeholder id; the real worker id
comes from agents.json at queue time, so the value is a filter-only stub):
MAP=$(jq -c 'to_entries | map({(.key): "x"}) | add' "$DX_REPOS_REGISTRY")
scripts/route-targets.sh /tmp/block.yaml /tmp/discover-repos.yaml "$MAP".
.repo aliases back to full registry entries and
emit the JSON array.ambiguous
structured error with the script's stderr message.no-match structured error.Branch on route-targets' exit code (handled above). Errors stop the cascade — do not fall through to tier 2/3; the hub needs the human to clarify.
Run scripts/parse-crossrepo-table.sh <triage.md|research.md> $DX_REPOS_REGISTRY.
It extracts repo aliases from the ## Cross-Repo Scope markdown table that
triage/research emit (see dx-core/shared/repo-discovery.md). Non-matching rows
are skipped. A non-empty array wins.
Only if every deterministic tier was empty. Read the work item title +
description and choose the touched repos from the registry aliases only.
List the available aliases (jq -r 'keys[]' $DX_REPOS_REGISTRY) and pick the
subset the change clearly touches. Never emit an alias not in the registry. If
nothing clearly matches, emit the no-match structured error rather than
guessing.
Each entry must carry alias, repoId, adoProject, cloneUrl, branch, reason.
Write to the run-context output file the hub reads, and return it as the
StructuredOutput result.
{ error, code, message }. The hub posts the message to the work item as a
clarification comment and queues nothing.
scripts/parse-crossrepo-table.sh (opens in a new tab)scripts/parse-explicit-repos.sh (opens in a new tab)scripts/route-targets.sh (opens in a new tab)tests/fixtures/comment-explicit.txt (opens in a new tab)tests/fixtures/comment-no-repos.txt (opens in a new tab)tests/fixtures/config-multi-platform.yaml (opens in a new tab)tests/fixtures/config-single-platform.yaml (opens in a new tab)tests/fixtures/repos-registry.json (opens in a new tab)tests/fixtures/research-crossrepo.md (opens in a new tab)tests/run-tests.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
sonnetThree short reads, in order
Other plugins' skills for the same job
npx claudepluginhub easingthemes/dx-aem-flow --plugin dx-hub5 skills in this plugin
/dx-hub-configView and edit hub configuration — add repos, fill missing defaults, adjust terminal delay. Use to manage hub settings. Trigger on "hub config", "add repo to hub", "terminal delay"./dx-hub-dispatchDispatch a ticket to several repos — open an independent Claude Code or Copilot CLI session per repo in VS Code terminals. Use for 'hub dispatch', 'work on ticket across repos'./dx-hub-initInitialize a hub directory for multi-repo orchestration. Discovers sibling repos, merges configs, validates CLI compatibility. Use when setting up hub mode for the first time. Trigger on "init hub", "set up hub", "multi-repo setup"./dx-hub-statusShow hub dispatch status — which repos are running, done, blocked or failed. Use for 'hub status', 'what's running'.