Command Reference¶
Use this page when you need a command, not background context. The normal
operator interface is make; direct CLI commands are for reproducing an
exact workflow step or debugging one tool in isolation.
Repository paths should be variables so commands survive repository transfers:
TOOL_REPO_DIR=/path/to/document-template-tool
PUBLIC_TEMPLATE_REPO_DIR=/path/to/science-europe-template-zh_Hant
TOOL_GITHUB_REPO=$(gh repo view --json nameWithOwner --jq .nameWithOwner)
For workflow context, read the matching runbook first:
Task |
Runbook |
|---|---|
First local setup |
|
Upstream tag update |
|
CI/release operation |
|
Config file ownership |
|
Parser or tree behavior changes |
|
Public repository integration |
Local Tooling¶
Command |
Purpose |
|---|---|
|
Create/update the local virtualenv and install tool dependencies. |
|
Run format check, lint, infra tests, and unit tests. |
|
Apply the configured formatter. |
|
Check formatting without changing files. |
|
Run static lint checks. |
|
Run all tests. |
|
Run CI/workflow/helper-script tests. |
|
Run package unit tests. |
Build or clean the documentation site:
make docs
make docs-clean
GitHub Pages uses make docs-clean docs through
.github/workflows/pages.yml, then verifies
that index.html exists and README.html was not generated.
DSW Stack¶
Use the local CI DSW stack only for render and preview work:
make start-ci-dsw
make ci-dsw-logs
make stop-ci-dsw
If ports conflict, set ports before starting the stack:
export DSW_CI_API_PORT=3100
export DSW_CI_MINIO_PORT=9100
export DSW_API_URL=http://localhost:3100/wizard-api
make start-ci-dsw
Template Workspace¶
These commands transform upstream Science Europe template source into the workspace shapes used by translation and regression tooling.
Command |
Purpose |
|---|---|
|
Download one upstream template tag into the workspace. |
|
Verify the compact template with |
|
Expand compact template source into translation-friendly form. |
|
Show the selected template profile and named rewrite groups applied by the latest transform. |
|
Verify the transformed workspace. |
|
Compact expanded source back into uploadable template source. |
|
Package the compact template as a |
The most common version variables are:
SOURCE_TEMPLATE_VERSION=1.30.1
SOURCE_TEMPLATE_VERSION_TAG=v1.30.1
COMPACT_TEMPLATE_DIR=workspace/document-templates/compact/dsw-science-europe-1.30.1
EXPANDED_TEMPLATE_DIR=workspace/document-templates/expanded/dsw-science-europe-1.30.1
TRANSLATION_TREE_DIR=workspace/document-templates/translation/dsw-science-europe-1.30.1
Translation Tree¶
Use these targets for local tree maintenance. They preserve source placeholders, Jinja markers, and branch metadata that normal Markdown editing must not break.
Command |
Purpose |
|---|---|
|
Build an editable translation tree from the expanded template. |
|
Build a fresh tree for migration comparison. |
|
Carry exact-match translations into a fresh tree. |
|
Validate translation-tree structure and placeholders. |
|
Render translated template source from |
|
Validate translated output against expanded source structure. |
|
Export the tree to an optional XLIFF exchange file. |
|
Import edited XLIFF targets back into the tree. |
Version branches treat translation.md as canonical. XLIFF is an optional
exchange format, not the default editing workflow.
Upstream Compatibility¶
Use these targets to discover upstream tags, build clean scaffold outputs, and verify DSW runtime compatibility.
Command |
Purpose |
|---|---|
|
List available upstream template tags. |
|
Validate transform/export/sync/package for selected refs in the active metamodel. |
|
Detect upstream refs that need a configured DSW runtime. |
|
Regenerate the workflow runtime matrix from config. |
|
Check that the workflow matrix matches config. |
|
Stage or open the unsupported-metamodel follow-up PR. |
make test-upstream-tags is an offline transform/package check. It does not
replace make render-regression-ci-plan or make verify-runtime-evidence.
Typical scheduled-discovery invocation:
make discover-upstream-compat \
UPSTREAM_TEMPLATE_DISCOVERY_REFS="v1.29.1+" \
UPSTREAM_TEMPLATE_DISCOVERY_REPORT=outputs/upstream-compat/discovery.md
If discovery finds an unsupported metamodel, the workflow opens a follow-up PR
with a report and full-validation checklist. It does not auto-merge runtime
changes.
The report is staged at
docs/compatibility/dsw-compatibility-probe.md.
Local dry-run:
make create-dsw-compat-pr \
COMPAT_PROBE_REPORT=outputs/upstream-compat/discovery.md
To push the probe PR branch, set COMPAT_PROBE_DRY_RUN=false.
Clean Scaffold Artifacts¶
Clean scaffold artifacts are generated from upstream tags before any human translation work. They are the input boundary for the public translated-template repository.
Command |
Purpose |
|---|---|
|
Build compact, expanded, translation tree, package, and metadata outputs for configured upstream refs. |
|
Render scaffold preview outputs where the configured DSW runtime supports it. |
|
Generate offline structural fingerprints across built versions. |
Example:
make build-upstream-artifacts UPSTREAM_TEMPLATE_ARTIFACT_REFS="v1.29.1+"
make generate-compat-ledger
make render-upstream-artifact-previews
Generated workspaces live under outputs/; they are build artifacts, not source
files.
Regression¶
Regression compares rendered output between a baseline template and a candidate
template. Build upstream artifacts first when the regression config points at
outputs/upstream-workspaces/....
Command |
Purpose |
|---|---|
|
Generate the active regression config from the newest built compatible version. |
|
Run the single-version CI regression path. |
|
Run the compatibility-ledger recommended version plan. |
|
Run the local configured regression path. |
|
Import one translated package ZIP and render the complete selected fixture set without cross-language output comparison. |
|
Summarize existing versioned regression and generated branch-coverage reports. |
|
Fail unless every planned version has passing regression, complete branch coverage, a strict package-preview PDF, and a verified pinned KM. |
Run the CI-style path locally:
make start-ci-dsw
make build-upstream-artifacts UPSTREAM_TEMPLATE_ARTIFACT_REFS="v1.29.1+"
make generate-compat-ledger
make render-regression-ci-plan
make render-upstream-artifact-previews
make verify-runtime-evidence
make stop-ci-dsw
Inspect one specific built version:
make render-regression-ci UPSTREAM_TEMPLATE_REGRESSION_VERSION=v1.30.1
Validate a regression plan without a DSW server:
make render-regression-ci-plan-dry-run
Validate the actual translated ZIP that will be distributed:
make start-ci-dsw
make render-translated-package-regression \
TRANSLATED_TEMPLATE_PACKAGE=/tmp/dsw-science-europe-zh-hant-1.30.1.zip \
TRANSLATED_REGRESSION_METAMODEL_VERSION=18.0 \
SOURCE_TEMPLATE_VERSION=1.30.1
make stop-ci-dsw
The target selects the pinned Knowledge Model for the requested document
template metamodel and reuses the full generated-fixture plan from
config/regression.ci.yml.
Summarize reports already written below outputs/preview/:
make summarize-regression-coverage
The command prints Markdown locally. In GitHub Actions it also appends the same
table to GITHUB_STEP_SUMMARY.
make verify-runtime-evidence is the final gate and is intentionally not
standalone on a clean checkout. It consumes the regression plan and outputs from
the preceding commands, then writes evidence.json and evidence.md below
outputs/runtime-evidence/<metamodel>/.
Render Preview¶
Render one project with an expanded source workspace:
make render-project \
PROJECT_REF=fixtures/projects/demo/test-project.json \
PROJECT_RENDER_TEMPLATE_DIR=outputs/document-templates/dsw-science-europe/v1.30.1/zh-Hant/dsw-science-europe-zh-hant-1.30.1 \
PROJECT_RENDER_OUTPUT=outputs/project-render/dsw-science-europe/v1.30.1/zh-Hant/test-project.pdf
Preview output should stay under outputs/project-render/....
Validate a published release package zip by importing it into local DSW and rendering the demo project:
make render-package \
PROJECT_REF=fixtures/projects/demo/test-project.json \
PROJECT_RENDER_TEMPLATE_PACKAGE=/tmp/dsw-science-europe-zh-hant-v1.30.1.zip \
PROJECT_RENDER_OUTPUT=outputs/project-render/dsw-science-europe/v1.30.1/zh-Hant/release-package-test-project.pdf
Use render-project for source workspaces that dsw-tdk verify can read.
Use render-package for .zip assets downloaded from GitHub Releases.
Do not unzip a release package and pass it as PROJECT_RENDER_TEMPLATE_DIR;
DSW package zips store template files inside template.json.
Public Repository Integration¶
These commands help the public translated-template repository consume clean scaffold artifacts. They do not publish to DSW.
Download clean scaffold artifacts from a tool workflow run:
TOOLING_RUN_ID=28346995193
make download-clean-scaffold-artifacts \
TOOL_GITHUB_REPO="$TOOL_GITHUB_REPO" \
CLEAN_SCAFFOLD_ARTIFACT_RUN_ID="$TOOLING_RUN_ID" \
CLEAN_SCAFFOLD_ARTIFACT_OUTPUT_DIR=/tmp/clean-scaffolds
Automated or write-enabled consumers must use an exact run id from a trusted
producer run. Omitting CLEAN_SCAFFOLD_ARTIFACT_RUN_ID performs a
latest-successful lookup; reserve that mode for manual investigation after
verifying the selected run’s event, branch, commit, and actor because
pull-request runs also upload artifacts.
The equivalent exact-run command is:
TOOLING_RUN_ID=28346995193
make download-clean-scaffold-artifacts \
TOOL_GITHUB_REPO="$TOOL_GITHUB_REPO" \
CLEAN_SCAFFOLD_ARTIFACT_RUN_ID="$TOOLING_RUN_ID" \
CLEAN_SCAFFOLD_ARTIFACT_OUTPUT_DIR=/tmp/clean-scaffolds
Validate the public repository translation config:
make validate-translation-config \
TRANSLATION_REPO="$PUBLIC_TEMPLATE_REPO_DIR"
Check that public repository docs still cover the required operations topics:
make check-translation-repository-docs \
TRANSLATION_DOCS_REPO="$PUBLIC_TEMPLATE_REPO_DIR"
Dry-run public repository branch refresh:
make sync-translation-version-branches \
TRANSLATION_REPO="$PUBLIC_TEMPLATE_REPO_DIR" \
TRANSLATION_CLEAN_ARTIFACT_ROOT=/tmp/clean-scaffolds
Check whether exact-source synchronization would still create branch updates:
make check-translation-migrations \
TRANSLATION_REPO="$PUBLIC_TEMPLATE_REPO_DIR" \
TRANSLATION_CLEAN_ARTIFACT_ROOT=/tmp/clean-scaffolds
Set TRANSLATION_MIGRATION_FAIL_ON_PENDING=true only when CI should fail on
pending cross-version synchronization changes.
Review missing or inconsistent wording across active/maintenance version branches without changing them:
make report-translation-consistency \
TRANSLATION_REPO="$PUBLIC_TEMPLATE_REPO_DIR" \
TRANSLATION_CONSISTENCY_FETCH=true
Use TRANSLATION_CONSISTENCY_VERSIONS="v1.30.0 v1.30.1" to inspect an explicit
set. JSON and Markdown outputs default to outputs/translation-consistency/.
Release Helpers¶
Stage release assets locally:
make publish-clean-scaffold-releases
The target defaults to CLEAN_SCAFFOLD_RELEASE_DRY_RUN=true, so it stages the
release tree without uploading. To publish from a trusted CI/manual context:
make publish-clean-scaffold-releases \
TOOL_GITHUB_REPO="$TOOL_GITHUB_REPO" \
CLEAN_SCAFFOLD_RELEASE_DRY_RUN=false
Direct CLI Use¶
Prefer make for routine work. Direct CLI commands are useful when you
need to reproduce exactly what CI ran, pass uncommon flags, or debug one layer
without the Makefile defaults.
The maintained CLI code lives in
src/dsw_document_template_tool/cli/.
The installed command names are declared in
pyproject.toml,
and the stable package APIs are listed in the Package Reference section of the
Sphinx navigation.
Show help:
"$TOOL_REPO_DIR/.venv/bin/dsw-template-transform" --help
"$TOOL_REPO_DIR/.venv/bin/dsw-template-tree" --help
"$TOOL_REPO_DIR/.venv/bin/dsw-template-render-project" --help
"$TOOL_REPO_DIR/.venv/bin/dsw-template-render-regression" --help
Run transform directly:
"$TOOL_REPO_DIR/.venv/bin/dsw-template-transform" expand \
--source workspace/document-templates/compact/dsw-science-europe-1.30.1 \
--output workspace/document-templates/expanded/dsw-science-europe-1.30.1
Explain the selected profile and upstream-specific rewrites:
"$TOOL_REPO_DIR/.venv/bin/dsw-template-transform" explain \
--source workspace/document-templates/expanded/dsw-science-europe-1.30.1
Run translation tree export/sync directly:
"$TOOL_REPO_DIR/.venv/bin/dsw-template-tree" export \
--source workspace/document-templates/expanded/dsw-science-europe-1.30.1 \
--output workspace/document-templates/translation/dsw-science-europe-1.30.1
"$TOOL_REPO_DIR/.venv/bin/dsw-template-tree" sync \
--tree workspace/document-templates/translation/dsw-science-europe-1.30.1 \
--source workspace/document-templates/expanded/dsw-science-europe-1.30.1 \
--output outputs/document-templates/dsw-science-europe/v1.30.1/zh-Hant/dsw-science-europe-zh-hant-1.30.1 \
--template-organization-id dsw \
--template-id science-europe-zh-hant \
--template-name "Science Europe DMP Template (zh-Hant)" \
--template-description "Science Europe DMP Template 的繁體中文化版本" \
--template-version 1.30.1
If a direct command becomes common in daily work, wrap it in make instead of
copying it into another workflow.