plccheck
v2.10.1
Published
Siemens PLC language checker + LSP CLI (SCL/ST/LAD/FBD, etc.)
Readme
plccheck
CLI wrapper for the Siemens PLC checker/LSP written in Go.
Documentation: danielv123.github.io/vscode_siemens/docs
Usage
npx plccheck check ./path/to/projectCommands
plccheck serve(LSP server over stdio)plccheck check <files-or-folders...>plccheck emit --target <language> <file>plccheck test [--filter <text>] [--events-json] [--coverage-json <file>] [--coverage-lcov <file>] <file-or-folder>plccheck tia <list|export|import|repair-library-dependencies|online|offline|snapshot|compile|download|trust> ...plccheck version
Testing and Coverage
Run tests for a PLC root:
npx plccheck test ./my-plc-projectRequest coverage artifacts in JSON and LCOV formats:
npx plccheck test ./my-plc-project --coverage-json coverage.json --coverage-lcov coverage.infoFor zero-config discovery in the Coverage Gutters VS Code extension, write the LCOV tracefile as lcov.info instead:
npx plccheck test ./my-plc-project --coverage-json coverage.json --coverage-lcov lcov.infoNote: --events-json prints a stream of execution events to stdout, while --coverage-json writes a finalized coverage report to a file. Coverage artifacts include statement, function, and branch data where runtime data is available. For AI analysis, use the file artifact from --coverage-json.
TIA Portal Openness
On Windows x64 machines with TIA Portal Openness V21 or newer, plccheck tia can attach to a running TIA project or open an explicit .ap21/.zap21 path.
npx plccheck tia trust --json
npx plccheck tia export --project Demo.ap21 --out exported --plc PLC_1 --delete-stale
npx plccheck tia import --project Demo.ap21 --root exported "exported/PLC_1/Program blocks/Main.scl" --create
npx plccheck tia import --project Demo.ap21 --root exported --skip-library-instances "exported/PLC_1"
npx plccheck tia import --project Demo.ap21 --root exported "exported/PLC_1/Program blocks"
npx plccheck tia repair-library-dependencies --project Demo.ap21 --plc PLC_1 --owner CA
npx plccheck tia compile --project Demo.ap21 --plc PLC_1 --json
npx plccheck tia online --project Demo.ap21 --plc PLC_1
npx plccheck tia online --project Demo.ap21 --plc PLC_1 --online-auth-type ProjectUser --online-user engineer --online-password-env TIA_PROJECT_PASSWORD
npx plccheck tia offline --project Demo.ap21 --plc PLC_1
npx plccheck tia snapshot --project Demo.ap21 --plc PLC_1 --json
npx plccheck tia download --project Demo.ap21 --plc PLC_1 --jsonexport writes PLC roots with .plc.json files and the TIA folder structure. import accepts one or more source files or folders, expands folders recursively, and needs --create before creating missing TIA folders or blocks. Supported direct import sources are .scl, .s7dcl, .db, .udt, .xml, .awl, .lad, and .fbd; pass the owning source file instead of .s7res resource sidecars or .meta.json metadata sidecars. Import refuses to overwrite an existing project-library type instance or one of its project-library dependencies by default; pass --skip-library-instances to leave those library-owned targets unchanged and continue importing the rest, or pass --allow-library-instance-overwrite only for an intentional mutation run. repair-library-dependencies is the safe repair path for that failure class: it recreates the named library instance's project-local dependency objects from the project library. snapshot uses TIA's online DB snapshot before moving retained values to start values, skipping safety DBs and DBs without retained members. download compiles first, uses the project-configured target, reports the selected target in JSON, and falls back to software-only changes when Siemens Openness rejects a full load because of fail-safe data.
Device actions automatically accept non-secret TLS and online-authentication modes. If the PLC requires a project/global/password user, pass --online-auth-type, --online-user where applicable, and --online-password-env <env> so the password is read from an environment variable. Without flags, the bridge also reads PLCCHECK_TIA_ONLINE_USER_TYPE or PLCCHECK_TIA_ONLINE_AUTH_TYPE, PLCCHECK_TIA_ONLINE_USER, and PLCCHECK_TIA_ONLINE_PASSWORD.
Use tia trust --install to install the Siemens Openness AllowList entry for the packaged bridge after reviewing the tia trust --json output. Installation writes HKLM and may require Windows administrator approval through UAC. If the UAC relaunch path is blocked, save the returned registryFile content as a .reg file and import it from an already elevated shell.
