linkml-scaffold.sh
services/linkml-scaffoldChecked by automation only
still a draft
Written 2026-11-12 by ktl-librarian (automation). Last checked 2026-10-22 by ktl-librarian (automation).
The full record
- Checks
- 2026-10-22 by
ktl-librarian(automation)
- 2026-10-22 by
- Sources
- Depends on
- Is part of
- References
- Pointed to by
- Installing the skills (references)
- linkml-sidecar skill (depends on)
- Where a LinkML schema lives (references)
- Graph
- Open this concept in the knowledge graph
- IRI
https://w3id.org/lmodel/schema-sidecar/knowledge/services/linkml-scaffold- Licence
- CC BY 4.0
- Files
- Markdown JSON-LD Source on GitHub History on GitHub
Overview#
scripts/linkml-scaffold.sh is the driver and scripts/linkml-scaffold.py its Python half. Nothing in it is a judgement: the facts come in as environment variables that the skill’s Step 0 resolved from real sources.
The driver runs the Python half through uv run first, which reads the half’s own # /// script header and so passes over a python3 older than 3.8, such as RHEL 8’s 3.6. Without uv, it uses python3, and python as the last resort, each only when it is 3.8 or later. The half needs only the standard library, so its header names no package for a mirror to refuse. With none of these, the driver exits 2.
linkml-scaffold.sh [--dry-run] [--host DIR] [--mode plain|lokf|auto]
[--gitignored] [--adopt SCHEMA | --dummy]
[--pointers-only] [--repair PATH]
The facts are PROJ_NAME, PROJ_SLUG, PROJ_DESC, GITHUB_ORG, REPO_URL, FULL_NAME, EMAIL, LICENSE_ID, SCHEMA_ID and DOCS_URL, with BASE_IRI read from .lokf/knowledge/index.md when it is absent. With --adopt, PROJ_SLUG and SCHEMA_ID come from the schema file itself.
What it does, in order#
- Refuses a sidecar in
.linkml/, a schema project at the root or one directory down, and a.linkml/holding project files without answers. It refuses a schema the host already holds unless--adoptor--dummysays what to do. It installs around configuration files alone in.linkml/. - Checks the facts against the template’s own rules. An adopted schema’s
idis exempt, since it was chosen before. - In KTL mode, pins
.lokf/schema/lokf.yamlout of the installed toolkit, and stops whenlokf adaptcannot copy the staged dummy. - Verifies the pin: the tag must name the commit the driver records before the template runs with
--trust. - Pre-seeds the files the skill owns into a staging directory beside
.linkml/, substituting facts as literal text through Python’sstr.replace, never sed. - Runs copier for everything else, into the same staging directory.
- Neutralises the root assumptions that remain. With
--adopt, it pointsconfig.public.mk’sLINKML_SCHEMA_SOURCE_DIRat the schema’s folder, relative to.linkml/. It renamesconfig.yamltogenerators.yamland names it inconfig.public.mk, unless the host already keeps a.linkml/generators.yaml. - Moves the staged files into
.linkml/, around whatever is already there. A name both hold is a clash: nothing moves, and the run ends with exit 3. - In KTL mode, runs
lokf adaptto write.lokf/schema/<slug>.yaml, and names that copy in.lokf/justfileand as[tool.lokf] schema. - Adds the root pointers, then prints the hand-off facts.
Every line it prints starts with scaffold:, handoff: or next:. It never removes anything but its own staging directory, so a failed run leaves .linkml/ as it was.
--repair generators.yaml moves a finished project’s config.yaml to .linkml/generators.yaml: the sidecar’s, or a root project’s into .linkml/. It changes the one line of config.public.mk that names the file, and moves nothing when it cannot finish. After the move, copier update leaves the file alone, so the template’s later changes to its settings no longer arrive.
Exit codes#
0: done.2: a usage error, a bad fact or a missing tool.3: refused, because a project, a schema or a file already there stands in the way.4: copier failed.5: an overlay or a pointer failed.
The driver holds the one template pin, LINKML_TEMPLATE_REF and LINKML_TEMPLATE_SHA.