plccheck 2.10.1 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,6 +15,8 @@ npx plccheck check ./path/to/project
15
15
  - `plccheck serve` (LSP server over stdio)
16
16
  - `plccheck check <files-or-folders...>`
17
17
  - `plccheck emit --target <language> <file>`
18
+ - `plccheck compile --out <exe> <file-or-folder>`
19
+ - `plccheck run <file-or-folder> [-- runtime args...]`
18
20
  - `plccheck test [--filter <text>] [--events-json] [--coverage-json <file>] [--coverage-lcov <file>] <file-or-folder>`
19
21
  - `plccheck tia <list|export|import|repair-library-dependencies|online|offline|snapshot|compile|download|trust> ...`
20
22
  - `plccheck version`
@@ -41,6 +43,20 @@ npx plccheck test ./my-plc-project --coverage-json coverage.json --coverage-lcov
41
43
 
42
44
  Note: `--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`.
43
45
 
46
+ ## Compile and Run PLC Runtime
47
+
48
+ Build a runnable PLC runtime executable:
49
+
50
+ ```bash
51
+ npx plccheck compile --out plc-run.exe ./my-plc-project
52
+ ```
53
+
54
+ Build and run it immediately, forwarding runtime flags after `--`:
55
+
56
+ ```bash
57
+ npx plccheck run ./my-plc-project -- --opcua-port 4849 --scan-period 24h
58
+ ```
59
+
44
60
  ## TIA Portal Openness
45
61
 
46
62
  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.
@@ -49,6 +65,7 @@ On Windows x64 machines with TIA Portal Openness V21 or newer, `plccheck tia` ca
49
65
  npx plccheck tia trust --json
50
66
  npx plccheck tia export --project Demo.ap21 --out exported --plc PLC_1 --delete-stale
51
67
  npx plccheck tia import --project Demo.ap21 --root exported "exported/PLC_1/Program blocks/Main.scl" --create
68
+ npx plccheck tia import --project Demo.ap21 --root exported "exported/PLC_1/Program blocks/Main.scl" --overwrite-remote-changes
52
69
  npx plccheck tia import --project Demo.ap21 --root exported --skip-library-instances "exported/PLC_1"
53
70
  npx plccheck tia import --project Demo.ap21 --root exported "exported/PLC_1/Program blocks"
54
71
  npx plccheck tia repair-library-dependencies --project Demo.ap21 --plc PLC_1 --owner CA
@@ -60,8 +77,10 @@ npx plccheck tia snapshot --project Demo.ap21 --plc PLC_1 --json
60
77
  npx plccheck tia download --project Demo.ap21 --plc PLC_1 --json
61
78
  ```
62
79
 
63
- `export` 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.
80
+ `export` 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. By default, import skips unchanged local files, skips local files whose TIA object changed while the local source stayed unchanged, and rejects files changed both locally and in TIA since the last metadata refresh. Pass `--overwrite` to import when both sides changed, or `--overwrite-remote-changes` to import when only the TIA object changed. 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.
81
+
82
+ If `tia list --json` shows `projectPath` but project commands report that TIA Openness did not expose the project, close that TIA Portal instance and rerun a verification export with `npx plccheck tia export --project <path> --out <dir>` to surface TIA's native open error. This often means the machine is missing a TIA product or add-on required by the project.
64
83
 
65
84
  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`.
66
85
 
67
- 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.
86
+ 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 ensures the current Windows user is a member of the local `Siemens TIA Openness` group, so it may require Windows administrator approval through UAC. If the UAC relaunch path is blocked, run the same command from an already elevated shell.
package/bin/plccheck.js CHANGED
@@ -49,13 +49,16 @@ const commandValueFlags = {
49
49
  check: ['--jobs', '-jobs'],
50
50
  emit: ['--target', '-target'],
51
51
  transpile: ['--from', '-from', '--to', '-to'],
52
- 'go-gen': ['--out', '-out', '--module', '-module', '--entry-ob', '-entry-ob'],
52
+ generate: ['--out', '-out', '--module', '-module', '--entry-ob', '-entry-ob'],
53
+ compile: ['--out', '-out', '--workdir', '-workdir', '--module', '-module', '--entry-ob', '-entry-ob'],
54
+ run: ['--out', '-out', '--workdir', '-workdir', '--module', '-module', '--entry-ob', '-entry-ob'],
53
55
  test: testValueFlags,
54
56
  };
55
57
 
56
58
  const pathValueFlags = [
57
59
  ...coverageValueFlags,
58
60
  '--out', '-out',
61
+ '--workdir', '-workdir',
59
62
  ];
60
63
 
61
64
  function cacheRoot() {
@@ -357,6 +360,9 @@ function resolveGoRunPaths(args, cwd) {
357
360
  const valueFlags = commandValueFlags[nextArgs[0]] || [];
358
361
  for (let i = 1; i < nextArgs.length; i++) {
359
362
  const arg = nextArgs[i];
363
+ if (nextArgs[0] === 'run' && arg === '--') {
364
+ break;
365
+ }
360
366
  if (arg.startsWith('-')) {
361
367
  const baseFlag = arg.split('=')[0];
362
368
  if (arg.includes('=')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plccheck",
3
- "version": "2.10.1",
3
+ "version": "2.11.0",
4
4
  "description": "Siemens PLC language checker + LSP CLI (SCL/ST/LAD/FBD, etc.)",
5
5
  "license": "CC-BY-NC-4.0",
6
6
  "bin": {
@@ -15,12 +15,12 @@
15
15
  "version": "node ../scripts/plccheck-npm-version-hook.mjs"
16
16
  },
17
17
  "optionalDependencies": {
18
- "@danielv123/plccheck-win-x64": "2.10.1",
19
- "@danielv123/plccheck-win-arm64": "2.10.1",
20
- "@danielv123/plccheck-linux-x64": "2.10.1",
21
- "@danielv123/plccheck-linux-arm64": "2.10.1",
22
- "@danielv123/plccheck-darwin-x64": "2.10.1",
23
- "@danielv123/plccheck-darwin-arm64": "2.10.1"
18
+ "@danielv123/plccheck-win-x64": "2.11.0",
19
+ "@danielv123/plccheck-win-arm64": "2.11.0",
20
+ "@danielv123/plccheck-linux-x64": "2.11.0",
21
+ "@danielv123/plccheck-linux-arm64": "2.11.0",
22
+ "@danielv123/plccheck-darwin-x64": "2.11.0",
23
+ "@danielv123/plccheck-darwin-arm64": "2.11.0"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",