Updates for Documentation
This commit is contained in:
77
CLAUDE.md
77
CLAUDE.md
@@ -13,43 +13,47 @@ The PLC I/O Testing Platform is the first project built on this framework.
|
||||
- Gitea at 192.168.3.59:3000 for source control
|
||||
- Jython 2.7 inside Ignition; Python 3.10+ for external tooling
|
||||
- Claude Code on the Linux host (VS Code Remote to Docker host)
|
||||
- WikiJS at wikijs.primecontrols-dev.com for team documentation (`.md` files auto-sync on `git push` via `tools/publish_docs.py`)
|
||||
|
||||
## Gateway HTTP API
|
||||
|
||||
Ignition 8.3 exposes a full REST API. Use it for infrastructure-as-code configuration —
|
||||
adding DB connections, OPC connections, importing tags, managing projects, etc.
|
||||
|
||||
- **Browse**: `http://<gateway-host>:8088/openapi`
|
||||
- **Spec**: `http://<gateway-host>:8088/openapi.json`
|
||||
- **Auth header**: `X-Ignition-API-Token: <name>:<token>`
|
||||
- **Full reference**: `ignition/ignition-api.md`
|
||||
- **Skill**: `/ignition-configure` — resolves token and walks through config tasks
|
||||
|
||||
## API Key / Secrets Policy
|
||||
|
||||
**Source of truth**: `~/.config/ignition-dev/secrets.env` (chmod 600, never committed)
|
||||
**Template**: `.env.example` in repo root — update this when adding new secrets
|
||||
|
||||
### Rules
|
||||
- All secrets via environment variables — no hardcoded values in any file
|
||||
- Docker Compose references host env vars: `VAR=${VAR}` pattern
|
||||
- Python scripts use `python-dotenv` + `os.environ["KEY"]` (loud failure on missing)
|
||||
- `.env` at project root is a symlink to secrets file — listed in .gitignore
|
||||
- CI secrets live in Gitea repository secrets settings
|
||||
|
||||
### Required Variables
|
||||
See `.env.example` for full list.
|
||||
Key variables: `IGNITION_API_TOKEN`, `POSTGRES_PASSWORD` — see `.env.example` for full list.
|
||||
|
||||
## Language Rules
|
||||
|
||||
### Jython 2.7 (Inside Ignition)
|
||||
|
||||
All scripts in `ignition/project/` and gateway scripting run Jython 2.7.
|
||||
Hard constraints — violating these causes runtime errors:
|
||||
All scripts in `ignition/project/` run Jython 2.7. Top violations:
|
||||
|
||||
- NO f-strings → use `"text {}".format(val)` or `"text %s" % val`
|
||||
- NO f-strings → use `"text {}".format(val)`
|
||||
- NO walrus operator `:=`
|
||||
- NO `pathlib` → use `os.path`
|
||||
- NO type hints → no `def foo(x: int) -> str:`
|
||||
- NO `dataclasses`, `enum.auto()`, `asyncio`
|
||||
- NO dictionary unpacking `{**d1, **d2}` → use `d1.update(d2)`
|
||||
- NO `yield from` → use explicit loops
|
||||
- Imports: `system.*` for Ignition API, standard Java/Jython libs only
|
||||
|
||||
Full constraint list: [ignition/CLAUDE.md](ignition/CLAUDE.md)
|
||||
|
||||
### Python 3.10+ (External Tooling)
|
||||
|
||||
All scripts outside Ignition (test runners, utilities, CI/CD) use Python 3.10+.
|
||||
Comment the target environment at the top of every file:
|
||||
All scripts outside Ignition use Python 3.10+. Add at top of every file:
|
||||
|
||||
```python
|
||||
# env: python3.10+ (external tooling — NOT Ignition)
|
||||
@@ -63,6 +67,7 @@ Comment the target environment at the top of every file:
|
||||
4. **Never restart Ignition gateway** without explicit user confirmation.
|
||||
5. **Never `docker compose down`** without confirmation (destroys unnamed volumes).
|
||||
6. **Every change needs a verification step** — scenario run, curl, tag read.
|
||||
7. **Scan after file edits** — after editing `ignition/project/` run `POST /data/api/v1/scan/projects`; after editing `docker/gw-config/` run `POST /data/api/v1/scan/config`. Use `/ignition-configure`.
|
||||
|
||||
## Canonical Patterns (Do Not Change Without Discussion)
|
||||
|
||||
@@ -73,24 +78,13 @@ Decouples simulation from PLC I/O structure. All device test tags follow this.
|
||||
|
||||
### JSON Test Scenarios
|
||||
|
||||
Five required sections:
|
||||
- `identity` — scenario ID, version, description
|
||||
- `device` — device type, UDT path, tag references
|
||||
- `initial_state` — tag values to set before test begins
|
||||
- `sequence` — ordered steps with `delay_ms` between actions
|
||||
- `expected_outcomes` — pass/fail criteria with `tolerance`
|
||||
|
||||
Five required sections: `identity`, `device`, `initial_state`, `sequence`, `expected_outcomes`.
|
||||
See `testing/CLAUDE.md` for full schema.
|
||||
|
||||
### WebDev API
|
||||
|
||||
All external I/O goes through WebDev endpoints — never direct tag file edits at runtime:
|
||||
- `tagWrite` — write values to tags
|
||||
- `tagRead` — read tag values
|
||||
- `tagBrowse` — browse tag tree
|
||||
- `health` — gateway and connection status
|
||||
|
||||
See `webdev/CLAUDE.md` for endpoint contracts.
|
||||
`tagWrite`, `tagRead`, `tagBrowse`, `health`. See `webdev/CLAUDE.md`.
|
||||
|
||||
### Ignition as I/O Orchestrator
|
||||
|
||||
@@ -102,17 +96,23 @@ Never bypass Ignition to write directly to Modbus or PLC.
|
||||
|
||||
```
|
||||
project-root/
|
||||
├── CLAUDE.md ← you are here
|
||||
├── CLAUDE.md
|
||||
├── scripts/ ← setup.sh and utility scripts
|
||||
├── docker/
|
||||
│ ├── CLAUDE.md ← Docker Compose patterns
|
||||
│ ├── CLAUDE.md
|
||||
│ ├── docker-compose.yml
|
||||
│ ├── docker-compose.override.yml
|
||||
│ ├── gw-build/ ← custom Ignition Dockerfile
|
||||
│ ├── gw-init/ ← gateway env vars (no secrets)
|
||||
│ ├── gw-commission/ ← commissioning.json
|
||||
│ ├── gw-config/ ← gateway runtime config (bind-mounted; runtime dirs gitignored)
|
||||
│ ├── gw-secret/ ← admin password file (gitignored)
|
||||
│ └── config/
|
||||
│ ├── ignition/
|
||||
│ ├── postgres/
|
||||
│ └── traefik/
|
||||
│ ├── postgres/ ← init.sql
|
||||
│ └── traefik/ ← traefik.yml, dynamic/
|
||||
├── ignition/
|
||||
│ ├── CLAUDE.md ← Ignition project structure
|
||||
│ ├── CLAUDE.md
|
||||
│ ├── ignition-api.md ← Gateway HTTP API reference
|
||||
│ └── project/
|
||||
│ ├── com.inductiveautomation.perspective/
|
||||
│ ├── com.inductiveautomation.webdev/
|
||||
@@ -121,23 +121,14 @@ project-root/
|
||||
│ ├── script-python/
|
||||
│ └── global-props/
|
||||
├── testing/
|
||||
│ ├── CLAUDE.md ← test scenario schema & runner
|
||||
│ ├── CLAUDE.md
|
||||
│ ├── scenarios/
|
||||
│ ├── runner/
|
||||
│ └── results/
|
||||
├── webdev/
|
||||
│ ├── CLAUDE.md ← WebDev API contract
|
||||
│ ├── CLAUDE.md
|
||||
│ └── endpoints/
|
||||
├── tools/
|
||||
│ └── (Python 3.10+ external utilities)
|
||||
└── docs/
|
||||
└── (project documentation)
|
||||
```
|
||||
|
||||
## Module CLAUDE.md Files
|
||||
|
||||
Each subdirectory has its own CLAUDE.md with domain-specific rules:
|
||||
- `docker/CLAUDE.md` — container orchestration, volumes, networking
|
||||
- `ignition/CLAUDE.md` — project structure, UDTs, scripting, resources
|
||||
- `testing/CLAUDE.md` — scenario schema, test runner, results format
|
||||
- `webdev/CLAUDE.md` — API endpoint contracts, request/response formats
|
||||
Reference in New Issue
Block a user