Files
Joseph Doherty b330faff03 mbproxy: cross-platform support — Linux/systemd alongside Windows
Make the service build, run, and install on Linux as a first-class
target while keeping the Windows Service + Event Log behaviour intact.

- Build: drop the hardcoded win-x64 RID — single-file publish now works
  for any RID. publish.ps1 gains -Rid; new publish.sh for Linux hosts.
- Diagnostics: DiagnosticSinkSelector picks the Error+ sink per host —
  Windows Event Log under the SCM, local syslog under systemd
  (Serilog.Sinks.SyslogMessages), none for interactive runs. The
  EventLog truncation helper is extracted so it is testable cross-OS.
- Host: Program.cs registers AddSystemd() alongside AddWindowsService().
- Config: a RID-conditioned appsettings template ships Windows or Unix
  paths; both templates are schema-validated by a test.
- Install: systemd unit (Type=exec) plus install.sh / uninstall.sh.
  Also fixes two cross-platform bugs found while testing: install.ps1
  and uninstall.ps1 used New-EventLog / Remove-EventLog (absent in
  PowerShell 7), and the E2E sim launcher hardcoded Windows venv paths.
- Docs updated across README, CLAUDE.md, and docs/ for dual-platform.

413 tests pass on Windows; 374 (all non-simulator) on Linux.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 09:41:59 -04:00

51 lines
4.6 KiB
Markdown

# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## What this repo is
A personal collection of reference material and tools for working with **AVEVA / Wonderware System Platform** (formerly Invensys / Wonderware): vendor documentation, sample projects, an active CLI codebase, and a SQL exploration of the Galaxy Repository — pulled together for offline reference and for grounding LLM-assisted work on Wonderware integrations.
## How docs are organized
This repo is consumed primarily by LLM coding agents. Documentation follows the rules in **[`DOCS-GUIDE.md`](DOCS-GUIDE.md)** — read it before adding or restructuring documentation. The short version:
- This `CLAUDE.md` is a **thin index**: it points to tools, not into them.
- Each tool has its own `README.md` at its folder root that introduces the tool and routes into its deep docs.
- Deep documentation (API references, workflows, incident notes) lives inside each tool folder.
When in doubt about where content belongs, default to pushing it deeper. `DOCS-GUIDE.md` has the full doctrine and the maintenance rules.
## Layout
- [`aalogcli/`](aalogcli/README.md) — `.NET Framework 4.8 / x86` CliFx-based CLI that reads System Platform binary logs (`*.aaLGX`) for LLM-driven debugging, built on the [aaOpenSource/aaLog](https://github.com/aaOpenSource/aaLog) reader library.
- [`aot/`](aot/README.md) — ArchestrA Object Toolkit 2014 v4.0 reference material (dev guide, API reference, sample VS solutions).
- [`graccesscli/`](graccesscli/README.md) — `.NET Framework 4.8 / x86` CliFx-based CLI for automating Galaxy configuration through the ArchestrA GRAccess COM interop.
- [`grdb/`](grdb/README.md) — SQL/DDL exploration of the Galaxy Repository SQL database (queries, schema, hierarchy/tag-name translation).
- [`histdb/`](histdb/README.md) — LLM-oriented reference for AVEVA Historian retrieval (extension tables, `wwXxx` time-domain extensions, retrieval modes/options, alarm-event SQL, REST API). Distilled from the official Historian Retrieval Guide.
- [`mbproxy/`](mbproxy/README.md) — `.NET 10` background service (Windows Service or Linux systemd unit) that proxies Modbus TCP for a fleet of ~54 DL205/DL260 PLCs: inline bidirectional BCD rewriting, single-backend-conn TxId multiplexing (lifts the H2-ECOM100 4-client cap), in-flight read coalescing, and opt-in per-tag response caching.
- [`mxaccesscli/`](mxaccesscli/README.md) — `.NET Framework 4.8 / x86` CliFx-based CLI for reading, writing, and subscribing to System Platform tags via the **MxAccess** COM proxy (`LMXProxyServerClass`).
- [`secrets/`](secrets/README.md) — Self-hosted Infisical CLI + `secret` PowerShell helper for fetching credentials from `https://infisical.dohertylan.com` instead of inlining plaintext.
## Tool / resource index
| Task | Go to |
| --- | --- |
| Read System Platform logs (last N records, last N minutes, ranges, incremental) — for LLM debugging | [`aalogcli/README.md`](aalogcli/README.md) |
| Anything AOT — object/primitive design, attributes, building, debugging, samples, API reference | [`aot/README.md`](aot/README.md) |
| Automate Galaxy configuration via GRAccess COM (CLI usage, session daemon, mutations, LLM integration) | [`graccesscli/README.md`](graccesscli/README.md) |
| Galaxy Repository SQL — connect, schema, hierarchy queries, contained-name ↔ tag-name translation | [`grdb/README.md`](grdb/README.md) |
| AVEVA Historian retrieval — SQL via `INSQL`, `wwXxx` extensions, retrieval modes/options, alarm/event SQL, REST API | [`histdb/README.md`](histdb/README.md) |
| Proxy Modbus TCP for DL205/DL260 fleet — BCD rewriting, TxId multiplexing, read coalescing, opt-in response cache, install/ops, status page | [`mbproxy/README.md`](mbproxy/README.md) |
| Read / write / subscribe to System Platform tags via MxAccess (timeouts, error categories, JSON envelope) | [`mxaccesscli/README.md`](mxaccesscli/README.md) |
| Fetch credentials from Infisical instead of using plaintext (`secret <KEY>` helper, env vars, identity reuse) | [`secrets/README.md`](secrets/README.md) |
## Maintaining this index
Authoritative rules: **[`DOCS-GUIDE.md`](DOCS-GUIDE.md)**. The short version that applies here:
- A new top-level tool requires a new `<tool>/README.md` first, then **one** row in the index above pointing to that README. Do not fan out per-file links at the root.
- A removed tool deletes its row in the same change.
- When a tool's internals change, update the tool's own README/deep docs — touch this file only if the task → tool mapping changed.
- If this file grows past ~150 lines or starts repeating tool-internal facts, refactor downward per `DOCS-GUIDE.md`.