Skip to content

t1k:unity:base:dup-scan

FieldValue
Modulebase
Version5.116.6
Effortmedium
ToolsBash, Glob, Grep, Read

Keywords: copied scaffold, copy paste across repos, cross-repo duplicates, duplicate census, duplicated code across games, jscpd csharp, template provenance, unity dup scan

/t1k:unity:base:dup-scan

Unity Cross-Repo Duplicate Census: bindings for the gamedev census

Section titled “Unity Cross-Repo Duplicate Census: bindings for the gamedev census”

Answers “what C# do our Unity games copy from each other, and where did it come from?”. The method (stages, marks, Judge, hand-off, scoping of negatives, JSON report contract) is the engine-neutral skill t1k:gamedev:reuse:duplicate-census of theonekit-gamedev (module reuse, a dependency of this module); read and follow it. This skill carries the Unity-bound tool (scripts/dup-scan.cjs) and binds the skill’s slots to it. The adapter entry is capabilities.x-dupcensus of t1k-unity-base-gamedev-adapter/gamedev-adapter.json.

Read-only. Clones land in --workdir (a temp dir); nothing is pushed or written to a scanned repo, the registry or GitHub.

SlotUnity value
commandbun .claude/skills/t1k-unity-base-dup-scan/scripts/dup-scan.cjs with --dry-run, --smoke N, --full, --repos, --config, --local, --out
requiresgh (authenticated, org read), git 2.27 or newer, bun 1.4.3 or newer, jscpd 4 or newer (bun add -g jscpd); declared in install.json; the script checks each one it will use and exits 2 naming it
sourceExt / sourceRoot.cs / Assets (the one holding the most .cs files); the report names the root repos[].assetsRoot where the neutral contract says sourceRoot (scripts/lib/report.cjs)
configscripts/dup-scan.config.json: templateRepos, templateNamePatterns, libraryTopics (theone-docs), libraryNamePatterns, vendorPathSegments, vendorMarkerFiles, vendorNamespaceRoots; the shipped vendor lists carry every full-census addition
coverageGapembedded first-party UPM packages under a repo-root Packages/ and any second Assets/ tree are never read
Terminal window
S=.claude/skills/t1k-unity-base-dup-scan/scripts
bun $S/dup-scan.cjs --dry-run # population only: counts, excluded + why
bun $S/dup-scan.cjs # SMOKE: first 5 game repos (most recently pushed)
bun $S/dup-scan.cjs --full --workdir <scratch>/dup # all game repos, only after the gate below
A `--full` run needs the smoke result shown to the user and an explicit go-ahead via `AskUserQuestion` (`rules/preview-first-batch.md`); state the smoke's per-repo seconds times the game count as the estimate. Override: the user explicitly asked for a full run in this request.
FlagDefaultUse
--org / --pushed-since-days / --sinceconfig: The1Studio / 210population window
--repos A,Bnonescan exactly these (templates still indexed unless named here)
--smoke N / --full5 / offpreview size (positive integer, else exit 2) / whole population
--min-tokens N30jscpd threshold; report it with every number
--max-lines N / --max-size S20000 / 2mbjscpd per-file limits; files over them are counted in meta.jscpdLimits and warned
--concurrency Nconfig cloneConcurrency (8)clones in flight at once (positive integer, else exit 2); per-phase seconds land in meta.phaseSeconds
--config FILEscripts/dup-scan.config.jsonoverride any key; a list you pass REPLACES the default list
--project-root DIRcwdwhere .claude/t1k-libraries-*.json is discovered
--local DIRnonescan existing checkouts offline (one subdir per repo)
--no-registry / --no-provenance / --no-jscpdoffdegrade explicitly; each is warned in the report

Output: <out>/dup-scan.json + dup-scan.md (default <workdir>/report), and a summary on stdout. Clones are reused from the same --workdir only when they carry the tool’s owner marker (.git/t1k-unity-dup-scan.owner); an existing staging/ without its marker is refused (exit 2) and an unmarked repos/<name>/ is skipped. Upgrading from a pre-marker version: pass a fresh --workdir (the default already is one) and delete the old one yourself. A dup-scan.json with schemaVersion: 1 still has sibling-fork groups inside exactGroups/nearGroups; v2 moves them to forkGroups.

Runs inline in the main session (or an inline sub-agent Bash call): dup-scan.cjs is a deterministic script invocation, read-only, smoke first. The Judge step after it is reasoning and stays with the caller. No sub-agent fan-out.

  • Framework idiom vs copy: VContainer scopes, UITemplate screen and popup presenters and service-registration blocks look alike because they are written against the same framework.
  • Vendor leak: a group that is SDK code (Facebook, PlayFab, DOTween) means a vendor root is missing; add it to vendorNamespaceRoots / vendorPathSegments in a config override and re-run.
  • Unity mechanics of a confirmed CANDIDATE: t1k-unity-base-lib-packaging#contribute (destination via t1k-lib-registry resolve).
  • The core t1k-lib-registry.cjs must be installed (or pass --no-registry); a registry that returns 0 unity rows is an error, not an empty index.
  • Package-shaped repos (no Assets/ root plus a root package.json or Runtime/*.asmdef) are moved from game to library after the clone, with a warning.