loadam 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,11 +8,12 @@
8
8
 
9
9
  ```bash
10
10
  npm i -g loadam # or: npx loadam ...
11
- loadam mcp ./openapi.yaml
12
- # 8 files written → cd loadam-out/mcp && npm install && node bin.js
11
+ loadam test ./openapi.yaml --target https://api.example.com
12
+ # Interactive: prompts for missing creds, runs k6 smoke, archives the session.
13
+ loadam report --open # Single-file HTML report with charts.
13
14
  ```
14
15
 
15
- That's it. One spec → three production-grade rigs. **One engine, two surfaces:**
16
+ That's it. One spec → three production-grade rigs **plus** a session archive and an HTML report. **One engine, two surfaces:**
16
17
 
17
18
  - **Test surface** — adversarial. Break the API: load, perf, contract drift.
18
19
  - **Agent surface** — cooperative. Let LLM agents use the API safely via MCP (stdio + HTTP).
@@ -43,41 +44,53 @@ Requires Node.js 20+. The generated rigs have their own runtime requirements: **
43
44
  # 1. Inspect what loadam sees in your spec.
44
45
  loadam init ./openapi.yaml
45
46
 
46
- # 2. Generate a runnable k6 smoke + load test.
47
+ # 2. Generate + run a k6 smoke test in one shot (interactive: prompts for creds).
47
48
  loadam test ./openapi.yaml --target https://api.example.com
48
- cd loadam-out/k6 && cp .env.example .env && k6 run smoke.js
49
49
 
50
- # 3. Generate a property-based Schemathesis contract suite.
50
+ # 3. Browse archived runs and open the HTML report.
51
+ loadam history
52
+ loadam show latest
53
+ loadam report latest --open
54
+
55
+ # 4. Generate a property-based Schemathesis contract suite.
51
56
  loadam contract ./openapi.yaml --target https://api.example.com
52
57
  cd loadam-out/contract && pip install -e . && pytest
53
58
 
54
- # 4. Generate an MCP server. Read-only by default.
59
+ # 5. Generate an MCP server. Read-only by default.
55
60
  loadam mcp ./openapi.yaml
56
61
  cd loadam-out/mcp && npm install && node bin.js # stdio (Claude Desktop)
57
62
  node bin.js --http # streamable HTTP
58
63
 
59
- # 5. Detect drift between spec and live API.
64
+ # 6. Detect drift between spec and live API.
60
65
  loadam diff ./openapi.yaml --target https://api.example.com -o drift.md
61
66
  ```
62
67
 
63
- Every command supports `--json` for CI:
68
+ Every command supports `--json` for CI, and `--no-interactive` to skip prompts:
64
69
 
65
70
  ```bash
66
- loadam mcp ./openapi.yaml --json | jq .toolNames
71
+ loadam test ./openapi.yaml --target $LOADAM_TARGET --no-interactive --json | jq .sessionId
67
72
  ```
68
73
 
74
+ Set `LOADAM_TARGET` once per shell to drop the `--target` flag from every invocation.
75
+
69
76
  ## Commands
70
77
 
71
- | Command | What it does | Output |
72
- | ------------------------ | ----------------------------------------------------------- | ---------------------- |
73
- | `loadam init <spec>` | Parse spec → IR with inferred resource graph | `loadam.ir.json` |
74
- | `loadam test <spec>` | Compile to k6 smoke + load scripts (stateful, ID-threading) | `loadam-out/k6/` |
75
- | `loadam contract <spec>` | Compile to a Schemathesis pytest project | `loadam-out/contract/` |
76
- | `loadam mcp <spec>` | Compile to a runnable MCP server (stdio + HTTP) | `loadam-out/mcp/` |
77
- | `loadam diff <spec>` | Probe a live API and report spec-vs-reality drift | Markdown |
78
- | `loadam auth import` | Infer an auth profile from a `curl` command | JSON / pretty |
79
- | `loadam update` | Check npm for a newer version of `loadam` | text or `--json` |
80
- | `loadam completion` | Print bash/zsh/fish completion script | stdout |
78
+ | Command | What it does | Output |
79
+ | ----------------------------- | --------------------------------------------------------------------- | --------------------------------- |
80
+ | `loadam init <spec>` | Parse spec → IR with inferred resource graph | `loadam.ir.json` |
81
+ | `loadam test <spec>` | Compile + (optionally) run k6 smoke / load; archives the session | `loadam-out/k6/` + session |
82
+ | `loadam contract <spec>` | Compile to a Schemathesis pytest project | `loadam-out/contract/` + session |
83
+ | `loadam mcp <spec>` | Compile to a runnable MCP server (stdio + HTTP) | `loadam-out/mcp/` |
84
+ | `loadam diff <spec>` | Probe a live API and report spec-vs-reality drift | Markdown + session |
85
+ | `loadam history` | List archived sessions (newest first) | table or `--json` |
86
+ | `loadam show <id\|latest>` | Show a session's metadata + inline k6/drift summary | text or `--json` |
87
+ | `loadam report <id\|latest>` | Render a single-file HTML report (charts, threshold table) | `report.html` (`--open` to view) |
88
+ | `loadam clean` | Prune session archive (`--older-than 7d`, `--dry-run` by default) | text or `--json` |
89
+ | `loadam auth import` | Infer an auth profile from a `curl` command | JSON / pretty |
90
+ | `loadam update` | Check npm for a newer version of `loadam` | text or `--json` |
91
+ | `loadam completion` | Print bash/zsh/fish completion script | stdout |
92
+
93
+ Use `--no-interactive` on `test` to skip prompts (CI-safe), and set `LOADAM_TARGET` to avoid repeating `--target`.
81
94
 
82
95
  ## What you get from `loadam mcp`
83
96
 
@@ -100,6 +113,19 @@ loadam mcp ./openapi.yaml --json | jq .toolNames
100
113
  }
101
114
  ```
102
115
 
116
+ ## Session archive & HTML reports
117
+
118
+ Every `loadam test`, `loadam contract`, and `loadam diff` invocation is archived to `./loadam-out/sessions/<id>/` with the parsed IR, the exact spec source, command flags, exit code, and any artefacts the run produced (k6 summary JSON, drift markdown, contract findings). The archive is local-only — it never leaves disk.
119
+
120
+ ```bash
121
+ loadam history # newest 20 sessions
122
+ loadam show latest # inline k6 p95 / threshold pass-fail
123
+ loadam report latest --open # one-file HTML report (charts, dark mode)
124
+ loadam clean --older-than 7d --apply # prune old runs
125
+ ```
126
+
127
+ The HTML report is a single self-contained file (no external CDNs, no JS dependencies) and is safe to drop into a CI artefact store, gh-pages, or Slack.
128
+
103
129
  ## Why loadam
104
130
 
105
131
  Most teams have an OpenAPI spec sitting in a repo and **none** of the rigs that should fall out of it. They wire each one by hand, badly, and then drift. Loadam treats the spec as the source of truth and emits everything once: load, contract, drift, agent. One shape of input, four shapes of output, zero hand-rolled boilerplate.
@@ -128,6 +154,7 @@ packages/
128
154
  test-contract/ Schemathesis compiler — emits pytest project
129
155
  test-drift/ Live probe + Markdown diff report
130
156
  mcp/ MCP compiler — emits stdio + HTTP server
157
+ report/ Pure-function HTML report renderer (no DOM dependency)
131
158
  cli/ commander-based CLI tying it all together
132
159
  ```
133
160
 
@@ -150,6 +177,7 @@ V1 (this) targets **petstore-class specs** end-to-end. Stripe-class specs (polym
150
177
 
151
178
  - [examples/basic-openapi](examples/basic-openapi/) — petstore, no auth required to generate
152
179
  - [examples/with-auth](examples/with-auth/) — bookstore with bearer auth + multi-server
180
+ - [examples/demo](examples/demo/) — a real `report.html` generated against live petstore
153
181
 
154
182
  ## Development
155
183