Stage 4 Scoping - accelerate-data/migration-utility GitHub Wiki
The /scope command identifies which stored procedures write to each target table. It launches one sub-agent per table in parallel, each running the /scoping-table skill.
-
manifest.jsonmust exist (if missing, all items fail withMANIFEST_NOT_FOUND) -
catalog/tables/<item_id>.jsonmust exist for each table (if missing, the item is skipped withCATALOG_FILE_MISSING)
Pass one or more fully-qualified table names:
/scope silver.DimCustomer silver.DimProduct silver.FactInternetSales
Single-table invocation works the same way -- it is just a batch of one.
The command creates a git worktree to isolate the batch:
- Branch name:
feature/scope-<table1>-<table2>-...(lowercase, dots replaced with hyphens, truncated to 60 characters afterfeature/) - Worktree path:
../worktrees/feature/scope-<slug> - Clears
.migration-runs/and writesmeta.jsonwith command metadata
If the worktree and branch already exist, they are reused.
One sub-agent per table runs in parallel. Each sub-agent follows the /scoping-table skill pipeline:
- Reads catalog signals (
referenced_byin the table's catalog file) to identify candidate writer procedures - For each candidate, follows the procedure analysis reference to analyze the procedure's code (call graph, statement classification, persistence) and determine whether it actually writes to the target table
- Resolves the
selected_writerfrom the analysis results
For any table that errored, the command reverts partially modified catalog files:
git checkout -- catalog/tables/<item_id>.jsonThe command collects per-table results and presents a summary:
scope complete -- 3 tables processed
ok silver.DimCustomer resolved
ok silver.DimProduct resolved
!! silver.DimDate error (CATALOG_FILE_MISSING)
resolved: 2 | error: 1
If at least one item succeeded, the command asks whether to commit and open a PR. Only catalog JSON files from successful items are staged. The PR body includes a table of results with writer procedure names.
The scoping result is written directly to the table's catalog file as scoping.selected_writer:
{
"scoping": {
"selected_writer": "dbo.usp_load_dimcustomer",
"candidates": [...],
"resolution": "..."
}
}| Status | Meaning |
|---|---|
resolved |
A single writer procedure was identified |
ambiguous_multi_writer |
Multiple candidate writers found; needs manual resolution |
no_writer_found |
No procedure writes to this table |
error |
Runtime failure prevented scoping |
| Code | When |
|---|---|
MANIFEST_NOT_FOUND |
manifest.json missing -- all items fail |
CATALOG_FILE_MISSING |
Catalog file not found for a table -- item skipped |
SCOPING_FAILED |
/scoping-table skill pipeline failed -- item skipped |
Proceed to Stage 5 Profiling to classify tables and identify keys, watermarks, and PII.