From 9c342521cd330a77ad82f6ca2f9c9e8d715a6620 Mon Sep 17 00:00:00 2001 From: sepehr-safari Date: Mon, 13 Jul 2026 14:04:20 +0300 Subject: [PATCH] chore: retire apps/web (moved to ocpp-debugkit/website) The website now lives in its own repo, ocpp-debugkit/website, deployed at ocppdebugkit.com on the published @ocpp-debugkit/toolkit package. Remove the in-repo web app and every active reference so this repo is library + CLI only. - Delete apps/web/** - pnpm-workspace.yaml: drop apps/* and regenerate the lockfile - Remove root vercel.json (no site deploys from here) - CI: drop the Playwright browser-install + E2E steps - vitest.config.ts: drop the dead .next / apps/web excludes - Docs (README, AGENTS, CURRENT_STATE, CONTRIBUTING): point to the website repo --- .github/workflows/ci.yml | 8 - AGENTS.md | 10 +- CONTRIBUTING.md | 1 - CURRENT_STATE.md | 5 +- README.md | 9 +- apps/web/.gitignore | 47 - apps/web/CHANGELOG.md | 41 - apps/web/README.md | 47 - apps/web/eslint.config.mjs | 18 - apps/web/next.config.ts | 5 - apps/web/package.json | 32 - apps/web/playwright.config.ts | 26 - apps/web/postcss.config.mjs | 7 - apps/web/public/file.svg | 1 - apps/web/public/globe.svg | 1 - apps/web/public/next.svg | 1 - apps/web/public/vercel.svg | 1 - apps/web/public/window.svg | 1 - apps/web/src/app/docs/anonymize/page.tsx | 67 - apps/web/src/app/docs/architecture/page.tsx | 76 - apps/web/src/app/docs/ci-mode/page.tsx | 79 - apps/web/src/app/docs/cli/page.tsx | 156 - apps/web/src/app/docs/examples/page.tsx | 57 - apps/web/src/app/docs/glossary/page.tsx | 77 - apps/web/src/app/docs/layout.tsx | 44 - apps/web/src/app/docs/page.tsx | 48 - apps/web/src/app/docs/quickstart/page.tsx | 53 - .../src/app/docs/scenario-assertions/page.tsx | 108 - apps/web/src/app/docs/scenarios/page.tsx | 103 - apps/web/src/app/docs/trace-diffing/page.tsx | 65 - apps/web/src/app/docs/trace-format/page.tsx | 131 - apps/web/src/app/favicon.ico | Bin 25931 -> 0 bytes apps/web/src/app/globals.css | 26 - apps/web/src/app/inspector/page.tsx | 771 ----- apps/web/src/app/layout.tsx | 31 - apps/web/src/app/page.tsx | 176 - apps/web/tests/inspector.spec.ts | 95 - apps/web/tests/landing.spec.ts | 63 - apps/web/tests/replay.spec.ts | 66 - apps/web/tsconfig.json | 34 - pnpm-lock.yaml | 3019 +---------------- pnpm-workspace.yaml | 1 - vercel.json | 9 - vitest.config.ts | 8 +- 44 files changed, 72 insertions(+), 5552 deletions(-) delete mode 100644 apps/web/.gitignore delete mode 100644 apps/web/CHANGELOG.md delete mode 100644 apps/web/README.md delete mode 100644 apps/web/eslint.config.mjs delete mode 100644 apps/web/next.config.ts delete mode 100644 apps/web/package.json delete mode 100644 apps/web/playwright.config.ts delete mode 100644 apps/web/postcss.config.mjs delete mode 100644 apps/web/public/file.svg delete mode 100644 apps/web/public/globe.svg delete mode 100644 apps/web/public/next.svg delete mode 100644 apps/web/public/vercel.svg delete mode 100644 apps/web/public/window.svg delete mode 100644 apps/web/src/app/docs/anonymize/page.tsx delete mode 100644 apps/web/src/app/docs/architecture/page.tsx delete mode 100644 apps/web/src/app/docs/ci-mode/page.tsx delete mode 100644 apps/web/src/app/docs/cli/page.tsx delete mode 100644 apps/web/src/app/docs/examples/page.tsx delete mode 100644 apps/web/src/app/docs/glossary/page.tsx delete mode 100644 apps/web/src/app/docs/layout.tsx delete mode 100644 apps/web/src/app/docs/page.tsx delete mode 100644 apps/web/src/app/docs/quickstart/page.tsx delete mode 100644 apps/web/src/app/docs/scenario-assertions/page.tsx delete mode 100644 apps/web/src/app/docs/scenarios/page.tsx delete mode 100644 apps/web/src/app/docs/trace-diffing/page.tsx delete mode 100644 apps/web/src/app/docs/trace-format/page.tsx delete mode 100644 apps/web/src/app/favicon.ico delete mode 100644 apps/web/src/app/globals.css delete mode 100644 apps/web/src/app/inspector/page.tsx delete mode 100644 apps/web/src/app/layout.tsx delete mode 100644 apps/web/src/app/page.tsx delete mode 100644 apps/web/tests/inspector.spec.ts delete mode 100644 apps/web/tests/landing.spec.ts delete mode 100644 apps/web/tests/replay.spec.ts delete mode 100644 apps/web/tsconfig.json delete mode 100644 vercel.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4dddba..664e0a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,14 +50,6 @@ jobs: - name: Test run: pnpm test - - name: Install Playwright browsers - working-directory: apps/web - run: pnpm exec playwright install --with-deps chromium - - - name: E2E tests - working-directory: apps/web - run: pnpm test:e2e - external-fixture: name: External Fixture Test runs-on: ubuntu-latest diff --git a/AGENTS.md b/AGENTS.md index f642b79..6d57761 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -29,8 +29,6 @@ ocpp-debugkit/ │ ├── replay/ # Replay engine │ ├── react/ # Reusable React components │ └── cli/ # Command-line interface (bin: ocpp-debugkit) -├── apps/ -│ └── web/ # Single Next.js app (landing, inspector, docs, blog) ├── turbo.json # Turborepo task pipeline ├── tsconfig.base.json # Shared TypeScript strict config ├── eslint.config.js # ESLint flat config @@ -38,6 +36,9 @@ ocpp-debugkit/ └── pnpm-workspace.yaml ``` +> The website (landing, inspector, docs) lives in its own repo, +> [ocpp-debugkit/website](https://github.com/ocpp-debugkit/website). + ## Build Commands ```bash @@ -62,12 +63,9 @@ pnpm changeset # Add a changeset for release replay ← depends on core (internal) react ← depends on core, scenarios, reporter, replay (internal) cli ← depends on core, scenarios, reporter (internal; Node-only) - -apps/web (single Next.js app) - imports: @ocpp-debugkit/toolkit/core, /scenarios, /reporter, /react, /replay ``` -**Build order:** toolkit (all internal modules in one tsc pass) → app +**Build order:** toolkit — all internal modules build in one tsc pass. ## Testing Conventions diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 31e7126..3176bdb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -185,7 +185,6 @@ test/ # e.g. test/core-coverage ```bash pnpm test # Run all unit tests pnpm test:external-fixture # External fixture test (installs from tarball) -pnpm test:e2e # Playwright E2E tests (in apps/web) ``` #### Writing Tests diff --git a/CURRENT_STATE.md b/CURRENT_STATE.md index c95e41e..7e7f10b 100644 --- a/CURRENT_STATE.md +++ b/CURRENT_STATE.md @@ -239,4 +239,7 @@ examples, and contributor onboarding. | `@ocpp-debugkit/scenarios` | deprecated | 0.1.1 | | `@ocpp-debugkit/reporter` | deprecated | 0.1.1 | | `@ocpp-debugkit/cli` | deprecated | 0.1.1 | -| `apps/web` | deployed | — | + +The website (landing, inspector, docs) now lives in +[ocpp-debugkit/website](https://github.com/ocpp-debugkit/website), deployed at +ocppdebugkit.com and built on the published `@ocpp-debugkit/toolkit` package. diff --git a/README.md b/README.md index b289fdb..c1dcd3f 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,6 @@ OCPP DebugKit is a pnpm monorepo. All modules ship in a single npm package, ├── replay ← replay engine (depends on core) ├── react ← reusable React components (depends on core, scenarios, reporter) └── cli ← command-line interface (depends on core, scenarios, reporter) - │ - └── apps/web (single Next.js app) ``` | Import path | Description | @@ -65,9 +63,12 @@ OCPP DebugKit is a pnpm monorepo. All modules ship in a single npm package, | `@ocpp-debugkit/toolkit/react` | Reusable React components | | `@ocpp-debugkit/toolkit/cli` | Programmatic CLI entry (`bin: ocpp-debugkit`) | | `@ocpp-debugkit/toolkit/fixtures` | Trace fixtures for testing | -| `apps/web` | Single Next.js app (landing, inspector, docs) | -**Build order:** toolkit (all internal modules in one `tsc` pass) → app +**Build order:** toolkit — all internal modules build in one `tsc` pass. + +> The website (landing, inspector, docs) now lives in its own repo, +> [ocpp-debugkit/website](https://github.com/ocpp-debugkit/website), deployed at +> [ocppdebugkit.com](https://www.ocppdebugkit.com). ## Quickstart diff --git a/apps/web/.gitignore b/apps/web/.gitignore deleted file mode 100644 index 3f753f2..0000000 --- a/apps/web/.gitignore +++ /dev/null @@ -1,47 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.* -.yarn/* -!.yarn/patches -!.yarn/plugins -!.yarn/releases -!.yarn/versions - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* -.pnpm-debug.log* - -# env files (can opt-in for committing if needed) -.env* - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts - -# playwright -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/apps/web/CHANGELOG.md b/apps/web/CHANGELOG.md deleted file mode 100644 index befdfc9..0000000 --- a/apps/web/CHANGELOG.md +++ /dev/null @@ -1,41 +0,0 @@ -# web - -## 0.1.4 - -### Patch Changes - -- Updated dependencies [2c4d518] - - @ocpp-debugkit/toolkit@0.3.1 - -## 0.1.3 - -### Patch Changes - -- Updated dependencies [6775642] -- Updated dependencies [1b8cb39] -- Updated dependencies [c580737] -- Updated dependencies [8db857e] -- Updated dependencies [8f765f9] - - @ocpp-debugkit/toolkit@0.3.0 - -## 0.1.2 - -### Patch Changes - -- Updated dependencies [38618c7] - - @ocpp-debugkit/core@0.1.1 - - @ocpp-debugkit/scenarios@0.1.1 - - @ocpp-debugkit/reporter@0.1.1 - -## 0.1.1 - -### Patch Changes - -- Updated dependencies [07bca8c] -- Updated dependencies [9543d50] -- Updated dependencies [f2cef5d] -- Updated dependencies [805434f] -- Updated dependencies [17c2aa0] - - @ocpp-debugkit/core@0.1.0 - - @ocpp-debugkit/reporter@0.1.0 - - @ocpp-debugkit/scenarios@0.1.0 diff --git a/apps/web/README.md b/apps/web/README.md deleted file mode 100644 index 0d20c86..0000000 --- a/apps/web/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# OCPP DebugKit — Web App - -The web front-end for [OCPP DebugKit](https://github.com/ocpp-debugkit/toolkit), -a DevTools project for debugging OCPP charging session traces. - -This is a [Next.js](https://nextjs.org) app (App Router) using Tailwind CSS. It -is the only app in the monorepo and hosts the landing page, trace inspector, -and documentation. - -## Routes - -| Route | Description | -|-------|-------------| -| `/` | Landing page — hero, features, architecture, quick start | -| `/inspector` | Trace inspector — paste/upload a trace, view timeline, failures, export report | -| `/docs` | Documentation — quickstart, glossary, architecture, trace format, CLI reference, scenarios | - -## Architecture - -All trace processing happens client-side in the browser — no trace data is -uploaded to a server. The app uses workspace dependencies on -`@ocpp-debugkit/toolkit` for parsing, analysis, and report generation. - -## Development - -```bash -# From the monorepo root -pnpm install -pnpm dev -``` - -Open [http://localhost:3000](http://localhost:3000). - -## Testing - -Playwright E2E smoke tests cover the landing page, navigation, and inspector -flows: - -```bash -# From apps/web -pnpm exec playwright install --with-deps chromium -pnpm test:e2e -``` - -## License - -Apache 2.0 — see the [monorepo LICENSE](../../LICENSE). diff --git a/apps/web/eslint.config.mjs b/apps/web/eslint.config.mjs deleted file mode 100644 index 626ca82..0000000 --- a/apps/web/eslint.config.mjs +++ /dev/null @@ -1,18 +0,0 @@ -import { defineConfig, globalIgnores } from 'eslint/config'; -import nextVitals from 'eslint-config-next/core-web-vitals'; -import nextTs from 'eslint-config-next/typescript'; - -const eslintConfig = defineConfig([ - ...nextVitals, - ...nextTs, - // Override default ignores of eslint-config-next. - globalIgnores([ - // Default ignores of eslint-config-next: - '.next/**', - 'out/**', - 'build/**', - 'next-env.d.ts', - ]), -]); - -export default eslintConfig; diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts deleted file mode 100644 index 30a7faa..0000000 --- a/apps/web/next.config.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { NextConfig } from 'next'; - -const nextConfig: NextConfig = {/* config options here */}; - -export default nextConfig; diff --git a/apps/web/package.json b/apps/web/package.json deleted file mode 100644 index c5ca039..0000000 --- a/apps/web/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "web", - "version": "0.1.4", - "private": true, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "lint": "eslint", - "typecheck": "tsc --noEmit", - "clean": "rm -rf .next .turbo", - "test:e2e": "playwright test" - }, - "dependencies": { - "@ocpp-debugkit/toolkit": "workspace:*", - "next": "16.2.10", - "react": "19.2.4", - "react-dom": "19.2.4" - }, - "devDependencies": { - "@playwright/test": "^1.61.1", - "@tailwindcss/postcss": "^4", - "@tailwindcss/typography": "^0.5.20", - "@types/node": "^20", - "@types/react": "^19", - "@types/react-dom": "^19", - "eslint": "^9", - "eslint-config-next": "16.2.10", - "tailwindcss": "^4", - "typescript": "^5" - } -} diff --git a/apps/web/playwright.config.ts b/apps/web/playwright.config.ts deleted file mode 100644 index e2bf9b3..0000000 --- a/apps/web/playwright.config.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { defineConfig, devices } from '@playwright/test'; - -export default defineConfig({ - testDir: './tests', - fullyParallel: true, - forbidOnly: !!process.env.CI, - retries: process.env.CI ? 2 : 0, - workers: process.env.CI ? 1 : undefined, - reporter: 'html', - use: { - baseURL: 'http://localhost:3000', - trace: 'on-first-retry', - }, - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], - webServer: { - command: 'pnpm dev', - url: 'http://localhost:3000', - reuseExistingServer: !process.env.CI, - timeout: 120_000, - }, -}); diff --git a/apps/web/postcss.config.mjs b/apps/web/postcss.config.mjs deleted file mode 100644 index 297374d..0000000 --- a/apps/web/postcss.config.mjs +++ /dev/null @@ -1,7 +0,0 @@ -const config = { - plugins: { - '@tailwindcss/postcss': {}, - }, -}; - -export default config; diff --git a/apps/web/public/file.svg b/apps/web/public/file.svg deleted file mode 100644 index 004145c..0000000 --- a/apps/web/public/file.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/web/public/globe.svg b/apps/web/public/globe.svg deleted file mode 100644 index 567f17b..0000000 --- a/apps/web/public/globe.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/web/public/next.svg b/apps/web/public/next.svg deleted file mode 100644 index 5174b28..0000000 --- a/apps/web/public/next.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/web/public/vercel.svg b/apps/web/public/vercel.svg deleted file mode 100644 index 7705396..0000000 --- a/apps/web/public/vercel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/web/public/window.svg b/apps/web/public/window.svg deleted file mode 100644 index b2b2a44..0000000 --- a/apps/web/public/window.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/web/src/app/docs/anonymize/page.tsx b/apps/web/src/app/docs/anonymize/page.tsx deleted file mode 100644 index 3c62e20..0000000 --- a/apps/web/src/app/docs/anonymize/page.tsx +++ /dev/null @@ -1,67 +0,0 @@ -export default function AnonymizePage() { - return ( -
-

Anonymize

-

- The ocpp-debugkit anonymize command strips sensitive fields from a trace file, - making it safe to share for debugging or support purposes. -

- -

Usage

-
-        {`# Output to stdout
-ocpp-debugkit anonymize trace.json
-
-# Write to file
-ocpp-debugkit anonymize trace.json -o trace-anon.json`}
-      
- -

What Gets Anonymized

-
    -
  • - idTag — replaced with "anonymized" -
  • -
  • - chargePointSerialNumber / chargeBoxSerialNumber — replaced with{' '} - "station-anon" -
  • -
  • - stationId — replaced with "station-anon" -
  • -
  • - transactionId — replaced with sequential integers (1, 2, 3...) -
  • -
  • - identifier — replaced with "anonymized" -
  • -
  • - Email addresses — replaced with [redacted-email] -
  • -
  • - Phone numbers — replaced with [redacted-phone] -
  • -
  • - IP addresses — replaced with [redacted-ip] -
  • -
- -

Privacy Considerations

-

- Anonymization is performed locally — no data is uploaded. The anonymized trace is safe to - share in issue reports, support tickets, or public forums. -

-

- Note: Anonymization is a best-effort process. Always review the output - before sharing to ensure no sensitive data remains. -

- -

What Is NOT Anonymized

-
    -
  • Timestamps — preserved for debugging timeline issues
  • -
  • OCPP action names — preserved for structural understanding
  • -
  • Meter values — preserved for analysis (they don't identify users)
  • -
  • Error codes and descriptions — preserved for debugging
  • -
-
- ); -} diff --git a/apps/web/src/app/docs/architecture/page.tsx b/apps/web/src/app/docs/architecture/page.tsx deleted file mode 100644 index 64c0ff2..0000000 --- a/apps/web/src/app/docs/architecture/page.tsx +++ /dev/null @@ -1,76 +0,0 @@ -export default function ArchitecturePage() { - return ( -
-

Architecture

-

- OCPP DebugKit is a modular monorepo with independent packages. Each package can be used - standalone or together. -

- -

Package Structure

-
-        {`ocpp-debugkit/
-├── packages/
-│   ├── core/          # Data model, parser, normalizer, timeline, failure detection
-│   ├── scenarios/     # Predefined trace scenarios for testing
-│   ├── reporter/      # Report generators (Markdown)
-│   ├── cli/           # Command-line interface
-│   ├── replay/        # Replay engine (v0.2+)
-│   └── react/         # Reusable React components (v0.2+)
-├── apps/
-│   └── web/           # Single Next.js app (landing, inspector, docs)
-└── turbo.json          # Turborepo task pipeline`}
-      
- -

Dependency Graph

-
-        {`        core          ← everything depends on this
-       /  |  \\
-  scenarios | reporter
-       \\  |  /
-          cli
-          |
-       apps/web`}
-      
- -

Build Order

-

Packages must be built in dependency order: core → scenarios/reporter → cli → app

- -

Data Flow

-

The analysis pipeline processes traces in three stages:

-
    -
  1. - ParseparseTrace() accepts JSON Object, JSONL, or bare - array input, validates with Zod schemas, and produces normalized Event{' '} - objects. -
  2. -
  3. - AnalyzebuildSessionTimeline() groups events into - sessions, then detectFailures() checks for known failure patterns (failed - auth, connector fault, station offline). -
  4. -
  5. - ReportgenerateMarkdownReport() produces a human-readable - Markdown report with session overview, timeline, failures, and suggested steps. -
  6. -
- -

Browser-Local Processing

-

- All trace processing in the web inspector happens client-side. No trace data is uploaded to - any server. The CSMS/CLI process traces locally. -

- -

Technology Stack

-
    -
  • TypeScript (strict mode)
  • -
  • Zod for input validation
  • -
  • Vitest for testing
  • -
  • Turborepo for build orchestration
  • -
  • Next.js + Tailwind CSS for the web app
  • -
  • Commander for the CLI
  • -
  • Playwright for E2E tests
  • -
-
- ); -} diff --git a/apps/web/src/app/docs/ci-mode/page.tsx b/apps/web/src/app/docs/ci-mode/page.tsx deleted file mode 100644 index 5e5e179..0000000 --- a/apps/web/src/app/docs/ci-mode/page.tsx +++ /dev/null @@ -1,79 +0,0 @@ -export default function CiModePage() { - return ( -
-

CI Mode

-

- The ocpp-debugkit ci command runs all built-in scenarios (and optional external - scenario files) and exits with code 0 if all pass, 1 if any fail. This is designed for - integration into CI/CD pipelines. -

- -

Basic Usage

-
-        {`# Run all built-in scenarios
-ocpp-debugkit ci
-
-# Also run external scenarios from a directory
-ocpp-debugkit ci ./scenarios
-
-# JSON output for CI tooling
-ocpp-debugkit ci --format json`}
-      
- -

GitHub Actions Integration

-

Add the following step to your workflow:

-
-        {`- name: Run OCPP scenario tests
-  run: ocpp-debugkit ci --format json`}
-      
-

- The command exits 0 (pass) or 1 (fail). The JSON output can be parsed for dashboards or - notifications. -

- -

External Scenario Files

-

- Create JSON scenario files in a directory and pass the directory path to the ci{' '} - command: -

-
-        {`ocpp-debugkit ci ./scenarios`}
-      
-

Scenario file format:

-
-        {`{
-  "name": "my-scenario",
-  "description": "Custom scenario for CI testing",
-  "trace": { ... },
-  "expectedFailures": ["FAILED_AUTHORIZATION"],
-  "assertions": [
-    { "type": "event_order", "params": { "actions": ["BootNotification", "Authorize"] } }
-  ]
-}`}
-      
- -

JSON Output Format

-
-        {`{
-  "results": [
-    {
-      "name": "normal-session",
-      "passed": true,
-      "detectedFailures": [],
-      "expectedFailures": [],
-      "assertionResults": []
-    },
-    ...
-  ],
-  "allPassed": true
-}`}
-      
- -

Example Workflow

-

- See the examples/ci-example/ directory for a complete GitHub Actions workflow - with scenario files. -

-
- ); -} diff --git a/apps/web/src/app/docs/cli/page.tsx b/apps/web/src/app/docs/cli/page.tsx deleted file mode 100644 index 35d7afd..0000000 --- a/apps/web/src/app/docs/cli/page.tsx +++ /dev/null @@ -1,156 +0,0 @@ -export default function CliReferencePage() { - return ( -
-

CLI Reference

-

- The ocpp-debugkit CLI provides commands for inspecting traces, generating - reports, and running scenarios. -

- -

Installation

-
-        {`npm install -g @ocpp-debugkit/toolkit`}
-      
- -

inspect

-

- Parse and analyze an OCPP trace file. Outputs a summary with events, sessions, failures, and - warnings. -

-
-        {`ocpp-debugkit inspect `}
-      
-

Example:

-
-        {`ocpp-debugkit inspect trace.json`}
-      
- -

report

-

Generate a Markdown report from an OCPP trace file.

-
-        {`ocpp-debugkit report  [options]`}
-      
-

Options

-
    -
  • - -f, --format <format> — Report format (default: markdown) -
  • -
  • - -o, --output <file> — Write report to file (default: stdout) -
  • -
-

Example:

-
-        {`ocpp-debugkit report trace.json --output report.md`}
-      
- -

scenario list

-

List all available built-in scenarios.

-
-        {`ocpp-debugkit scenario list`}
-      
- -

scenario run

-

- Run a built-in scenario through the analysis engine. Compares detected failures against - expected failures and reports pass/fail. -

-
-        {`ocpp-debugkit scenario run `}
-      
-

Example:

-
-        {`ocpp-debugkit scenario run failed-auth`}
-      
-

- Note: scenario run runs static fixtures through the local - analysis engine only. It is not active endpoint testing, WebSocket simulation, or live - station/CSMS testing. -

-

External Scenario Files

-

Load and run an external scenario file (JSON format) instead of a built-in scenario:

-
-        {`ocpp-debugkit scenario run --file ./my-scenario.json`}
-      
- -

ci

-

- Run all built-in scenarios (and optional external scenario files from a directory), exit 0 - if all pass, 1 if any fail. Designed for CI/CD pipelines. -

-
-        {`ocpp-debugkit ci [dir] [options]`}
-      
-

Options

-
    -
  • - --format <format> — Output format: text (default) or json -
  • -
-

Examples:

-
-        {`# Run all built-in scenarios
-ocpp-debugkit ci
-
-# Also run external scenarios from a directory
-ocpp-debugkit ci ./scenarios
-
-# JSON output for CI tooling
-ocpp-debugkit ci --format json`}
-      
- -

anonymize

-

- Strip sensitive fields from a trace file. Anonymizes idTag, chargePointSerialNumber, - stationId, transactionId, and email/phone/IP patterns. -

-
-        {`ocpp-debugkit anonymize  [options]`}
-      
-

Options

-
    -
  • - -o, --output <file> — Write anonymized trace to file (default: stdout) -
  • -
-

Example:

-
-        {`ocpp-debugkit anonymize trace.json -o trace-anon.json`}
-      
- -

diff

-

Compare two trace files and show differences in events, failures, and summaries.

-
-        {`ocpp-debugkit diff   [options]`}
-      
-

Options

-
    -
  • - --format <format> — Output format: text (default) or json -
  • -
-

Example:

-
-        {`ocpp-debugkit diff trace-a.json trace-b.json`}
-      
- -

Global Options

-
    -
  • - -V, --version — output the version number -
  • -
  • - -h, --help — display help for any command -
  • -
- -

Security

-
    -
  • File paths are validated before reading
  • -
  • Input size limit: 10 MB
  • -
  • Safe JSON parsing with error handling
  • -
  • Non-sensitive error messages (no internal paths exposed)
  • -
-
- ); -} diff --git a/apps/web/src/app/docs/examples/page.tsx b/apps/web/src/app/docs/examples/page.tsx deleted file mode 100644 index cb76d34..0000000 --- a/apps/web/src/app/docs/examples/page.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import Link from 'next/link'; - -export default function ExamplesPage() { - return ( -
-

Examples

-

- Integration examples showing how to use @ocpp-debugkit/toolkit in your - projects. Each example is a standalone project in the examples/ directory of - the repository. -

- -

Available Examples

-
    -
  • - simple-trace — Parse a trace, detect failures, generate a Markdown - report. Demonstrates the core analysis pipeline. -
  • -
  • - simple-csms — Validate incoming traces (CSMS mock), check for failures. - Demonstrates message validation. -
  • -
  • - simulator-output — Process JSONL simulator output, generate an HTML - report. Demonstrates JSONL parsing and HTML report generation. -
  • -
  • - ci-example — Use ocpp-debugkit ci in GitHub Actions - workflows. Demonstrates CI integration with scenario files. -
  • -
- -

Running Examples

-

Each example is standalone. Clone the repo and run:

-
-        {`cd examples/simple-trace
-npm install
-npm start`}
-      
- -

Links

-
-
- ); -} diff --git a/apps/web/src/app/docs/glossary/page.tsx b/apps/web/src/app/docs/glossary/page.tsx deleted file mode 100644 index 753c89c..0000000 --- a/apps/web/src/app/docs/glossary/page.tsx +++ /dev/null @@ -1,77 +0,0 @@ -export default function GlossaryPage() { - return ( -
-

Glossary

-

Key OCPP and EV charging terms used throughout this project.

- -

OCPP

-

- Open Charge Point Protocol — the communication protocol between EV charging stations (Charge - Points) and charging station management systems (CSMS). OCPP 1.6 JSON is the primary - protocol supported by DebugKit. -

- -

Charge Point (CP)

-

- The physical EV charging station. Also referred to as a "station". Communicates - with the CSMS via OCPP. -

- -

CSMS

-

- Charging Station Management System — the central server that manages charging stations. Also - referred to as "the backend". -

- -

Connector

-

- A physical charging outlet on a charging station. A station may have multiple connectors - (e.g., connector 0 is typically the whole-station connector, connector 1+ are individual - charging outlets). -

- -

Transaction

-

- A single charging session, initiated by a StartTransaction request and terminated by a - StopTransaction request. Each transaction has a unique transactionId assigned by the CSMS. -

- -

Call

-

- An OCPP message type (MessageTypeId = 2) representing a request from one side to the other. - Format: [2, UniqueId, Action, Payload] -

- -

CallResult

-

- An OCPP message type (MessageTypeId = 3) representing a successful response to a Call. - Format: [3, UniqueId, Payload] -

- -

CallError

-

- An OCPP message type (MessageTypeId = 4) representing an error response to a Call. Format:{' '} - [4, UniqueId, ErrorCode, ErrorDescription, ErrorDetails] -

- -

idTag

-

- An identifier (typically an RFID card or app token) used to authorize a charging session. - The CSMS validates the idTag and returns an authorization status (Accepted, Invalid, etc.). -

- -

Trace

-

- A capture of OCPP messages exchanged between a Charge Point and CSMS over a period of time. - Traces are the primary input to DebugKit. -

- -

Direction

-

- The direction of an OCPP message: CS_TO_CSMS (station to backend),{' '} - CSMS_TO_CS (backend to station), or - UNKNOWN. -

-
- ); -} diff --git a/apps/web/src/app/docs/layout.tsx b/apps/web/src/app/docs/layout.tsx deleted file mode 100644 index 7dd0bf8..0000000 --- a/apps/web/src/app/docs/layout.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import Link from 'next/link'; - -const docPages = [ - { href: '/docs/quickstart', label: 'Quick Start' }, - { href: '/docs/glossary', label: 'Glossary' }, - { href: '/docs/architecture', label: 'Architecture' }, - { href: '/docs/trace-format', label: 'Trace Format' }, - { href: '/docs/cli', label: 'CLI Reference' }, - { href: '/docs/scenarios', label: 'Scenarios' }, -]; - -export default function DocsLayout({ children }: { children: React.ReactNode }) { - return ( -
-
-
- - OCPP DebugKit - - Docs -
-
-
- -
- {children} -
-
-
- ); -} diff --git a/apps/web/src/app/docs/page.tsx b/apps/web/src/app/docs/page.tsx deleted file mode 100644 index add8809..0000000 --- a/apps/web/src/app/docs/page.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import Link from 'next/link'; - -export default function DocsPage() { - return ( -
-

Documentation

-

- Get started with OCPP DebugKit — open-source DevTools for debugging OCPP charging sessions. -

-
    -
  • - Quick Start — Install and run your first trace - analysis -
  • -
  • - Glossary — OCPP terms explained -
  • -
  • - Architecture — Package structure and data flow -
  • -
  • - Trace Format — Accepted input formats -
  • -
  • - CLI Reference — Command-line interface -
  • -
  • - Scenarios — Predefined test scenarios -
  • -
  • - Trace Diffing — Compare two traces -
  • -
  • - Scenario Assertions — Rich assertion format -
  • -
  • - CI Mode — Run scenario tests in CI pipelines -
  • -
  • - Anonymize — Strip sensitive fields from traces -
  • -
  • - Examples — Integration examples -
  • -
-
- ); -} diff --git a/apps/web/src/app/docs/quickstart/page.tsx b/apps/web/src/app/docs/quickstart/page.tsx deleted file mode 100644 index 6b9c17c..0000000 --- a/apps/web/src/app/docs/quickstart/page.tsx +++ /dev/null @@ -1,53 +0,0 @@ -export default function QuickStartPage() { - return ( -
-

Quick Start

- -

Install the CLI

-
-        {`npm install -g @ocpp-debugkit/toolkit`}
-      
- -

Inspect a trace

-

Parse and analyze an OCPP 1.6 JSON trace file:

-
-        {`ocpp-debugkit inspect trace.json`}
-      
-

This outputs a summary with event count, sessions, and detected failures.

- -

Generate a report

-

Generate a Markdown report from a trace:

-
-        {`ocpp-debugkit report trace.json --output report.md`}
-      
- -

Run a scenario

-

Run a predefined scenario through the analysis engine:

-
-        {`# List available scenarios
-ocpp-debugkit scenario list
-
-# Run a scenario
-ocpp-debugkit scenario run failed-auth`}
-      
- -

Use the web inspector

-

- No installation required — visit the inspector and paste a trace, - upload a file, or select a sample scenario. -

- -

Use the core library

-

For programmatic use in your own TypeScript/JavaScript project:

-
-        {`import { parseTrace, buildSessionTimeline, detectFailures } from '@ocpp-debugkit/toolkit/core';
-
-const result = parseTrace(traceString);
-const sessions = buildSessionTimeline(result.events);
-const failures = detectFailures(result.events, sessions);
-
-console.log(\`Found \${failures.length} failures\`);`}
-      
-
- ); -} diff --git a/apps/web/src/app/docs/scenario-assertions/page.tsx b/apps/web/src/app/docs/scenario-assertions/page.tsx deleted file mode 100644 index 6c250f7..0000000 --- a/apps/web/src/app/docs/scenario-assertions/page.tsx +++ /dev/null @@ -1,108 +0,0 @@ -export default function ScenarioAssertionsPage() { - return ( -
-

Scenario Assertions

-

- Scenario assertions provide a declarative way to verify analysis results beyond simple - failure-code matching. They allow you to assert event ordering, counts, payload fields, - timing constraints, session state, and more. -

- -

Assertion Types

-

The following assertion types are available:

- -

event_order

-

Verify that events appear in a specific order (not necessarily consecutive).

-
-        {`{ type: 'event_order', params: { actions: ['BootNotification', 'Authorize', 'StartTransaction'] } }`}
-      
- -

event_count

-

Verify the count of events, optionally filtered by action.

-
-        {`{ type: 'event_count', params: { min: 5, max: 20 } }
-{ type: 'event_count', params: { min: 1, action: 'StartTransaction' } }`}
-      
- -

payload_field

-

- Verify a payload field value on a specific action. Supports equals (deep - equality) and contains (array/string contains). -

-
-        {`{ type: 'payload_field', params: { action: 'Authorize', field: 'idTag', equals: 'TAG-001' } }
-{ type: 'payload_field', params: { action: 'StartTransaction', field: 'connectorId', equals: 1 } }`}
-      
- -

timing

-

- Verify timing gaps between two actions. Uses minGapMs and/or{' '} - maxGapMs. -

-
-        {`{ type: 'timing', params: { actionA: 'BootNotification', actionB: 'StartTransaction', maxGapMs: 5000 } }
-{ type: 'timing', params: { actionA: 'BootNotification', actionB: 'Heartbeat', minGapMs: 5000 } }`}
-      
- -

session_state

-

Verify the session status (active, completed, or aborted).

-
-        {`{ type: 'session_state', params: { expected: 'completed' } }`}
-      
- -

failure_severity

-

Verify that a specific failure has the expected severity.

-
-        {`{ type: 'failure_severity', params: { code: 'UNRESPONSIVE_CSMS', severity: 'critical' } }`}
-      
- -

no_failures

-

Verify that no failures are detected.

-
-        {`{ type: 'no_failures', params: {} }`}
-      
- -

failure_count

-

Verify the count of detected failures, optionally filtered by code.

-
-        {`{ type: 'failure_count', params: { min: 1, max: 3 } }
-{ type: 'failure_count', params: { code: 'FAILED_AUTHORIZATION', min: 1 } }`}
-      
- -

Using Assertions in Scenarios

-

- Assertions are an optional field on the Scenario type. They are evaluated - alongside expectedFailures: -

-
-        {`{
-  name: 'my-scenario',
-  description: 'Test scenario with assertions',
-  trace: { /* ... */ },
-  expectedFailures: ['FAILED_AUTHORIZATION'],
-  assertions: [
-    { type: 'event_order', params: { actions: ['BootNotification', 'Authorize'] } },
-    { type: 'failure_count', params: { code: 'FAILED_AUTHORIZATION', min: 1, max: 1 } }
-  ]
-}`}
-      
- -

Programmatic API

-
-        {`import { evaluateScenario } from '@ocpp-debugkit/toolkit/core';
-
-const result = evaluateScenario(scenario);
-console.log(result.allPassed);           // true if all assertions + expectedFailures pass
-console.log(result.assertions);          // AssertionResult[] with pass/fail per assertion
-console.log(result.expectedFailuresPassed); // true if detected matches expected
-console.log(result.detectedFailureCodes);   // detected failure codes`}
-      
- -

Backward Compatibility

-

- Existing scenarios with only expectedFailures (no assertions{' '} - field) continue to work unchanged. The assertions field is optional. -

-
- ); -} diff --git a/apps/web/src/app/docs/scenarios/page.tsx b/apps/web/src/app/docs/scenarios/page.tsx deleted file mode 100644 index c41f054..0000000 --- a/apps/web/src/app/docs/scenarios/page.tsx +++ /dev/null @@ -1,103 +0,0 @@ -export default function ScenariosPage() { - return ( -
-

Scenarios

-

- Scenarios are predefined trace fixtures that test the analysis engine. Each scenario has a - trace and a list of expected failures. -

- -

Built-in Scenarios

-

DebugKit v0.1 includes 5 scenarios:

- -

normal-session

-

- A complete charging session: boot, authorize, start transaction, meter values, stop - transaction. No failures expected. -

-
    -
  • - expectedFailures: [] -
  • -
- -

failed-auth

-

- Failed authorization: the idTag is rejected by the CSMS. StartTransaction is not attempted. - The connector transitions to Faulted. -

-
    -
  • - expectedFailures: ["FAILED_AUTHORIZATION"] -
  • -
- -

connector-fault

-

- Connector fault during an active session: the connector reports a Faulted status - mid-charging, and the transaction stops with a fault reason. -

-
    -
  • - expectedFailures: ["CONNECTOR_FAULT"] -
  • -
- -

station-offline

-

- Station goes offline during an active session: a StartTransaction is sent but no - StopTransaction follows. -

-
    -
  • - expectedFailures: ["STATION_OFFLINE_DURING_SESSION"] -
  • -
- -

unexpected-stop-reason

-

- A stop transaction with an unexpected stop reason. This is a parser/timeline-only fixture — - no v0.1 detection rule matches it. -

-
    -
  • - expectedFailures: [] -
  • -
- -

Failure Detection Rules

-

Three detection rules are available in v0.1:

-
    -
  • - FAILED_AUTHORIZATION — Authorize response with - idTagInfo.status = "Invalid" -
  • -
  • - CONNECTOR_FAULT — StatusNotification with - status = "Faulted" during an active session -
  • -
  • - STATION_OFFLINE_DURING_SESSION — Session has StartTransaction but no - StopTransaction, or connector transitions to Unavailable/Offline during an active - transaction -
  • -
- -

Running Scenarios

-
-        {`# List all scenarios
-ocpp-debugkit scenario list
-
-# Run a specific scenario
-ocpp-debugkit scenario run connector-fault`}
-      
-

The CLI reports detected vs expected failures and shows a pass/fail result.

- -

Synthetic Data

-

- All scenario data is fully synthetic. No real station identifiers, transaction IDs, idTag - values, or personal data are used. -

-
- ); -} diff --git a/apps/web/src/app/docs/trace-diffing/page.tsx b/apps/web/src/app/docs/trace-diffing/page.tsx deleted file mode 100644 index df0c7fd..0000000 --- a/apps/web/src/app/docs/trace-diffing/page.tsx +++ /dev/null @@ -1,65 +0,0 @@ -export default function TraceDiffingPage() { - return ( -
-

Trace Diffing

-

- OCPP DebugKit can compare two parsed traces and surface differences at multiple levels: - events, failures, and session summaries. This is useful for debugging regression issues, - comparing good vs bad sessions, and tracking changes after fixes. -

- -

Programmatic API

-
-        {`import { parseTrace, diffTraces } from '@ocpp-debugkit/toolkit/core';
-
-const resultA = parseTrace(traceAJson);
-const resultB = parseTrace(traceBJson);
-const diff = diffTraces(resultA, resultB);
-
-console.log('Events only in A:', diff.onlyInA.length);
-console.log('Events only in B:', diff.onlyInB.length);
-console.log('Modified events:', diff.modified.length);
-console.log('Failures only in A:', diff.failuresOnlyInA.map(f => f.code));
-console.log('Failures only in B:', diff.failuresOnlyInB.map(f => f.code));
-`}
-      
- -

TraceDiff Output

-
    -
  • - onlyInA / onlyInB — Events present in only one trace (by - messageId) -
  • -
  • - modified — Field-level differences for events in both (timestamp, direction, - action, payload, errorCode) -
  • -
  • - failuresOnlyInA / failuresOnlyInB — Failures detected in one but - not the other -
  • -
  • - summaryDiff — Session summary differences (event count, failure count, - duration, status) -
  • -
- -

CLI Usage

-
-        {`ocpp-debugkit diff trace-a.json trace-b.json
-ocpp-debugkit diff trace-a.json trace-b.json --format json`}
-      
- -

How Matching Works

-

- Events are matched by their OCPP messageId (UniqueId). A Call and its - CallResult share the same messageId — they are compared positionally within the same - messageId group. -

-

- Payloads are compared using deep equality. Any difference in nested fields is surfaced as a - single payload modification. -

-
- ); -} diff --git a/apps/web/src/app/docs/trace-format/page.tsx b/apps/web/src/app/docs/trace-format/page.tsx deleted file mode 100644 index 9065374..0000000 --- a/apps/web/src/app/docs/trace-format/page.tsx +++ /dev/null @@ -1,131 +0,0 @@ -export default function TraceFormatPage() { - return ( -
-

Trace Format

-

- DebugKit accepts three trace formats. All formats use the OCPP 1.6 JSON message structure. -

- -

JSON Object Format

-

The primary format — a structured file with metadata and events:

-
-        {`{
-  "traceId": "trace-001",
-  "metadata": {
-    "stationId": "CS-SYNTHETIC-001",
-    "ocppVersion": "1.6",
-    "source": "csms-log"
-  },
-  "events": [
-    {
-      "timestamp": "2024-01-15T10:30:00.000Z",
-      "direction": "CS_TO_CSMS",
-      "message": [2, "msg-001", "BootNotification", {
-        "chargePointVendor": "SyntheticVendor",
-        "chargePointModel": "SM-100"
-      }]
-    },
-    {
-      "timestamp": "2024-01-15T10:30:00.500Z",
-      "direction": "CSMS_TO_CS",
-      "message": [3, "msg-001", {
-        "currentTime": "2024-01-15T10:30:00.500Z",
-        "status": "Accepted"
-      }]
-    }
-  ]
-}`}
-      
- -

JSONL Format

-

One event per line — useful for CSMS logs and streaming captures:

-
-        {`{"timestamp":"2024-01-15T10:30:00.000Z","direction":"CS_TO_CSMS","message":[2,"msg-001","BootNotification",{}]}
-{"timestamp":"2024-01-15T10:30:00.500Z","direction":"CSMS_TO_CS","message":[3,"msg-001",{"status":"Accepted"}]}`}
-      
-

Blank lines are ignored. Malformed lines produce parse warnings but don't fail.

- -

Bare Array Format

-

A JSON array of raw OCPP messages — convenience for quick testing:

-
-        {`[
-  [2, "msg-001", "BootNotification", {}],
-  [3, "msg-001", {"status": "Accepted"}]
-]`}
-      
-

Direction is inferred; timestamps are null.

- -

OCPP 1.6 JSON Message Structure

-

Three message types are supported:

-
    -
  • - Call (2): [2, UniqueId, Action, Payload] -
  • -
  • - CallResult (3): [3, UniqueId, Payload] -
  • -
  • - CallError (4):{' '} - [4, UniqueId, ErrorCode, ErrorDescription, ErrorDetails] -
  • -
- -

Timestamps

-

Accepted formats:

-
    -
  • - ISO 8601 (UTC): 2024-01-15T10:30:00.000Z -
  • -
  • - ISO 8601 (offset): 2024-01-15T12:00:00+02:00 -
  • -
  • - Unix epoch (ms): 1705312200000 -
  • -
  • - Unix epoch (s): 1705312200 -
  • -
  • - Missing/null — event timestamp is null -
  • -
- -

Limits

- - - - - - - - - - - - - - - - - -
LimitValue
Maximum input size10 MB
Maximum event count10,000
- -

Direction Inference

-

When direction is not specified, it is inferred from the action name:

-
    -
  • - CS_TO_CSMS — BootNotification, Authorize, StartTransaction, StopTransaction, - StatusNotification, MeterValues, Heartbeat, etc. -
  • -
  • - CSMS_TO_CS — Reset, RemoteStartTransaction, GetConfiguration, - ChangeConfiguration, etc. -
  • -
  • - UNKNOWN — unrecognized actions -
  • -
-

For CallResult/CallError, direction is inferred from the matching Call.

-
- ); -} diff --git a/apps/web/src/app/favicon.ico b/apps/web/src/app/favicon.ico deleted file mode 100644 index 718d6fea4835ec2d246af9800eddb7ffb276240c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25931 zcmeHv30#a{`}aL_*G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)?7rW0^5psc- zjS16yb>dFn>KPOF;imD}e!enuIniFzv}n$m2#gCCv4jM#ArwlzZ$7@9&XkFxZ4n!V zj3dyiwW4Ki2QG{@i>yuZXQizw_OkZI^-3otXC{!(lUpJF33gI60ak;Uqitp74|B6I zgg{b=Iz}WkhCGj1M=hu4#Aw173YxIVbISaoc z-nLZC*6Tgivd5V`K%GxhBsp@SUU60-rfc$=wb>zdJzXS&-5(NRRodFk;Kxk!S(O(a0e7oY=E( zAyS;Ow?6Q&XA+cnkCb{28_1N8H#?J!*$MmIwLq^*T_9-z^&UE@A(z9oGYtFy6EZef LrJugUA?W`A8`#=m diff --git a/apps/web/src/app/globals.css b/apps/web/src/app/globals.css deleted file mode 100644 index 66f3535..0000000 --- a/apps/web/src/app/globals.css +++ /dev/null @@ -1,26 +0,0 @@ -@import 'tailwindcss'; -@plugin '@tailwindcss/typography'; - -:root { - --background: #ffffff; - --foreground: #171717; -} - -@theme inline { - --color-background: var(--background); - --color-foreground: var(--foreground); - --font-sans: var(--font-geist-sans); - --font-mono: var(--font-geist-mono); -} - -@media (prefers-color-scheme: dark) { - :root { - --background: #0a0a0a; - --foreground: #ededed; - } -} - -body { - background: var(--background); - color: var(--foreground); -} diff --git a/apps/web/src/app/inspector/page.tsx b/apps/web/src/app/inspector/page.tsx deleted file mode 100644 index 233b0ae..0000000 --- a/apps/web/src/app/inspector/page.tsx +++ /dev/null @@ -1,771 +0,0 @@ -'use client'; - -import Link from 'next/link'; -import { useState, useCallback, useMemo, useRef } from 'react'; -import { - parseTrace, - buildSessionTimeline, - detectFailures, - summarizeSessions, - type Event, - type Failure, - type Session, - type SessionSummary, - type ParseWarning, - type Scenario, - ParseError, - MAX_INPUT_SIZE_BYTES, -} from '@ocpp-debugkit/toolkit/core'; -import { generateMarkdownReport, generateHtmlReport } from '@ocpp-debugkit/toolkit/reporter'; -import { scenarios } from '@ocpp-debugkit/toolkit/scenarios'; -import { ReplayEngine } from '@ocpp-debugkit/toolkit/replay'; - -// --------------------------------------------------------------------------- -// Types -// --------------------------------------------------------------------------- - -interface AnalysisState { - events: Event[]; - sessions: Session[]; - failures: Failure[]; - summaries: SessionSummary[]; - warnings: ParseWarning[]; - selectedEventId: string | null; - error: string | null; -} - -interface ReplayState { - engine: ReplayEngine | null; - currentIndex: number; - isPlaying: boolean; - speed: number; -} - -// --------------------------------------------------------------------------- -// Component -// --------------------------------------------------------------------------- - -export default function InspectorPage() { - const [input, setInput] = useState(''); - const [analysis, setAnalysis] = useState(null); - const [isAnalyzing, setIsAnalyzing] = useState(false); - const [replay, setReplay] = useState({ - engine: null, - currentIndex: 0, - isPlaying: false, - speed: 1, - }); - const [reportFormat, setReportFormat] = useState<'markdown' | 'html'>('markdown'); - const [view, setView] = useState<'inspect' | 'replay' | 'report'>('inspect'); - const timelineRef = useRef(null); - - const selectedEvent = useMemo(() => { - if (!analysis || !analysis.selectedEventId) return null; - return analysis.events.find((e) => e.id === analysis.selectedEventId) ?? null; - }, [analysis]); - - const handleAnalyze = useCallback(() => { - if (!input.trim()) { - setAnalysis({ - events: [], - sessions: [], - failures: [], - summaries: [], - warnings: [], - selectedEventId: null, - error: 'Input is empty. Paste a trace or select a sample scenario.', - }); - return; - } - - setIsAnalyzing(true); - - // Use setTimeout to let the loading state render before heavy parsing - setTimeout(() => { - try { - const result = parseTrace(input); - const sessions = buildSessionTimeline(result.events); - const failures = detectFailures(result.events, sessions); - const summaries = summarizeSessions(sessions, failures); - - setAnalysis({ - events: result.events, - sessions, - failures, - summaries, - warnings: result.warnings, - selectedEventId: null, - error: null, - }); - // Initialize replay engine - setReplay({ - engine: new ReplayEngine(result.events, failures), - currentIndex: 0, - isPlaying: false, - speed: 1, - }); - } catch (e) { - const message = - e instanceof ParseError ? e.message : e instanceof Error ? e.message : 'Unknown error'; - setAnalysis({ - events: [], - sessions: [], - failures: [], - summaries: [], - warnings: [], - selectedEventId: null, - error: message, - }); - } finally { - setIsAnalyzing(false); - } - }, 0); - }, [input]); - - const handleFileUpload = useCallback(async (file: File) => { - if (file.size > MAX_INPUT_SIZE_BYTES) { - setAnalysis({ - events: [], - sessions: [], - failures: [], - summaries: [], - warnings: [], - selectedEventId: null, - error: `File size (${file.size} bytes) exceeds the maximum allowed size (${MAX_INPUT_SIZE_BYTES} bytes).`, - }); - return; - } - const text = await file.text(); - setInput(text); - }, []); - - const handleScenarioSelect = useCallback((scenario: Scenario) => { - setInput(JSON.stringify(scenario.trace, null, 2)); - }, []); - - const handleExportReport = useCallback(() => { - if (!analysis) return; - const reportData = { - events: analysis.events, - sessions: analysis.sessions, - failures: analysis.failures, - summaries: analysis.summaries, - warnings: analysis.warnings, - }; - const isHtml = reportFormat === 'html'; - const report = isHtml ? generateHtmlReport(reportData) : generateMarkdownReport(reportData); - const blob = new Blob([report], { - type: isHtml ? 'text/html' : 'text/markdown', - }); - const url = URL.createObjectURL(blob); - const a = document.createElement('a'); - a.href = url; - a.download = isHtml ? 'ocpp-debugkit-report.html' : 'ocpp-debugkit-report.md'; - a.click(); - URL.revokeObjectURL(url); - }, [analysis, reportFormat]); - - // Replay handlers - const handleReplayStep = useCallback(() => { - if (!replay.engine) return; - const result = replay.engine.step(); - if (result) { - setReplay({ ...replay, currentIndex: result.index }); - setAnalysis((prev) => (prev ? { ...prev, selectedEventId: result.event.id } : prev)); - } - }, [replay]); - - const handleReplayStepBack = useCallback(() => { - if (!replay.engine) return; - const result = replay.engine.stepBack(); - if (result) { - setReplay({ ...replay, currentIndex: result.index }); - setAnalysis((prev) => (prev ? { ...prev, selectedEventId: result.event.id } : prev)); - } - }, [replay]); - - const handleReplayJump = useCallback( - (index: number) => { - if (!replay.engine) return; - const result = replay.engine.jumpTo(index); - if (result) { - setReplay({ ...replay, currentIndex: result.index }); - setAnalysis((prev) => (prev ? { ...prev, selectedEventId: result.event.id } : prev)); - } - }, - [replay], - ); - - const handleReplayPlay = useCallback(() => { - setReplay({ ...replay, isPlaying: true }); - }, [replay]); - - const handleReplayPause = useCallback(() => { - setReplay({ ...replay, isPlaying: false }); - }, [replay]); - - // Auto-advance replay when playing - useMemo(() => { - if (!replay.isPlaying || !replay.engine) return; - const engine = replay.engine; - const interval = setInterval(() => { - const result = engine.step(); - if (result) { - setReplay((prev) => ({ ...prev, currentIndex: result.index })); - setAnalysis((prev) => (prev ? { ...prev, selectedEventId: result.event.id } : prev)); - } else { - setReplay((prev) => ({ ...prev, isPlaying: false })); - } - }, 1000 / replay.speed); - return () => clearInterval(interval); - }, [replay.isPlaying, replay.speed]); - - // Keyboard navigation: arrow up/down to move between events - const handleKeyDown = useCallback( - (e: React.KeyboardEvent) => { - if (!analysis || analysis.events.length === 0) return; - if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp') return; - - e.preventDefault(); - const currentIndex = analysis.events.findIndex((ev) => ev.id === analysis.selectedEventId); - - let nextIndex: number; - if (e.key === 'ArrowDown') { - nextIndex = currentIndex < 0 ? 0 : Math.min(currentIndex + 1, analysis.events.length - 1); - } else { - nextIndex = currentIndex <= 0 ? 0 : currentIndex - 1; - } - - const nextEvent = analysis.events[nextIndex]; - if (nextEvent) { - setAnalysis({ ...analysis, selectedEventId: nextEvent.id }); - // Scroll the timeline to the selected event - const btn = timelineRef.current?.querySelector( - `[data-event-id="${nextEvent.id}"]`, - ); - btn?.scrollIntoView({ block: 'nearest', behavior: 'smooth' }); - } - }, - [analysis], - ); - - return ( -
- {/* Header */} -
-
-
- - OCPP DebugKit - - Inspector -
- {analysis && analysis.events.length > 0 && ( -
- - -
- )} -
-
- -
- {/* Input section */} -
- {/* Trace input */} -
- -