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

- - -

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

- -
- ); -} 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

- -
- ); -} 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

- -

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

- -

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

- -

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 718d6fe..0000000 Binary files a/apps/web/src/app/favicon.ico and /dev/null differ 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 */} -
- -