Skip to content

t1k:unity:base:lib-packaging

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

Keywords: asmdef, com.theone, contribute to library, extraction plan, lib adapter, library packaging, new unity library, scaffold upm repo, TheOne library, unity package.json, unity packaging, upm library

/t1k:unity:base:lib-packaging

Unity UPM Library Packaging — lib adapter

Section titled “Unity UPM Library Packaging — lib adapter”

The Unity half of the adapter contract (theonekit-core → t1k-lib-contribute/references/adapter-contract.md): core owns the flow, this skill owns the Unity mechanics. Every action here is planned or emitted, never executed upstream — a diff is emitted, a repo create is planned. No step of this skill runs in the consumer’s tree.

Scope: UPM package mechanics only. Flow control (hard gates, registry rows, approval order) lives in t1k-lib-contribute / t1k-lib-create — cite them, never restate them.

When it applies: the knowledge sweep returned CONTRIBUTE for generic game code, so the code lands in the lib, not the game (docs/library-first-contribute-back.md).

Registry name: t1k-unity-base-lib-packaging#contribute.

Input (from the extraction plan)Output
files + destination paths, dependency list, renamesa git diff against a temp shallow clone of the target UPM library repo

The clone lives in the scratchpad — never the consumer tree.

  1. Clone — git clone --depth 1 <library-url> "$SCRATCHPAD/lib-clone/<pkg>". Work only inside that clone.

  2. Place source — runtime code under Runtime/, editor-only code under Editor/, tests under Tests/. Apply the plan’s renames as you place; a renamed .cs takes its .meta with it (Unity pairs them by GUID).

  3. .asmdef — add references for the plan’s new dependencies, dotted TheOne.<Area> form. Check the target name for an asmdef collision first (t1k-lib-create/references/naming.md — collisions overwrite corpus rows).

  4. package.json — add the same deps under dependencies (com.theone.<area> ids), bump the version per the library’s semver practice.

  5. Emit the record — one line per contributed symbol, at column 0, exactly: reuse-search: CONTRIBUTE | symbol: <Type> | scope: <scope> | swept: <YYYY-MM-DD> (<Type> = the type/primitive placed; <scope> = what was swept, e.g. 12 assemblies; grammar: docs/reuse-search-record.md § CONTRIBUTE). This is the line the kit’s rsiSignals entry (unity-reuse-search-contribute in .claude/t1k-config-unity.json) matches to raise a studio-library candidate — do not reword or wrap it, and never put a | inside symbol:. Then git -C "$SCRATCHPAD/lib-clone/<pkg>" diff → hand the patch text to the spawner. NEVER git push, never commit to the library repo from here.

  6. Smoke — plan carries >1 symbol → run N=1 first (one symbol through steps 2–5, reuse-search: line included), surface that diff, scale only on approval. Preview-first, never silently scale.

  7. Hand off the consume side — once the library PR is merged and the version resolves on the registry, the game swaps its copy for the package with t1k-unity-base-lib-consume (dry-run first; it refuses types referenced from scenes/prefabs). Nothing here consumes.

Rollback: delete the clone (rm -rf "$SCRATCHPAD/lib-clone/<pkg>"). Nothing upstream exists to roll back — that is the point of emit-don’t-push.

Registry name: t1k-unity-base-lib-packaging#scaffold.

Name first, then create — TheOne.<Area> repo / com.theone.<area> package / dotted TheOne.<Area> asmdef, decided per t1k-lib-create/references/naming.md (capability noun, no consumer echo, no engine prefix, no corpus collision). The registry row is drafted in the same session (hard-gate condition 2 of t1k-lib-create).

PLAN-ONLY. Emit a plan document and stop:

Terminal window
bun .claude/skills/t1k-lib-create/scripts/t1k-lib-plan.cjs \
plan create-repo inputs.json
# PLAN-WRITTEN <action-id> <hash> <plan-path> — relay to spawner, never execute

--private is mandatory; the planner refuses --public. The main session runs each approved step itself.

The plan’s file list must produce studio shape:

TheOne.<Area>/
├── package.json # com.theone.<area>
├── Runtime/TheOne.<Area>.asmdef # dotted, matches repo name
├── Editor/TheOne.<Area>.Editor.asmdef
├── Tests/TheOne.<Area>.Tests.asmdef
└── .github/workflows/release.yml # theonekit-release-action caller (@v3)

Rollback: gh repo archive <owner/name> while it has no consumers — the create-repo plan’s own rollback step, run by the main session on approval.

  • Adapter contract: theonekit-core → .claude/skills/t1k-lib-contribute/references/adapter-contract.md
  • Naming: theonekit-core → .claude/skills/t1k-lib-create/references/naming.md
  • Planner: theonekit-core → .claude/skills/t1k-lib-create/scripts/t1k-lib-plan.cjs