## Setup

- Env vars (see `.env.example`): `REDMINE_URL`, `REDMINE_API_KEY`, `REDMINE_PROJECT_ID`, `REDMINE_TRACKER_BUG_ID`, `REDMINE_TRACKER_SECURITY_ID` (optional, falls back to bug), `REDMINE_ASSIGNEE_ID` (optional default owner).
- Uses the Redmine REST API with the API key for authentication.
- Ensure the API key is scoped to the project and can create issues.

## Automatic tickets on failures

- `scripts/run-test-suite.sh` now files a Redmine issue whenever any check fails. Security-related failures (npm audit, Trivy, ZAP) use the security tracker when configured.
- Issues are de-duplicated by fingerprinting the suite/target + failure details; reruns of the same failing state will re-use the open ticket instead of creating a duplicate.
- Manual wrapper for other test commands: `./scripts/run-tests-with-redmine.sh npm test` (set `TEST_NAME` or `TRACKER` to override labels).

## CLI tools

- List open tickets grouped by tracker: `REDMINE_URL=... REDMINE_API_KEY=... REDMINE_PROJECT_ID=... ./scripts/redmine-report.js list-open`
- Manual issue creation from a log file: `./scripts/redmine-report.js create-test-issue --suite my-tests --failures-file /path/to/log --tracker bug`
- Outputs go to stdout; non-zero exit code on API errors so CI can fail fast.

## Notes

- Tickets include a short fingerprint in the subject and description; keep it when editing so future runs keep de-duplicating.
- Summary/log paths are included in the issue body to help locate artifacts from the run.