Skip to content

Commit 6d8e5cb

Browse files
committed
feat: add next and interaction generation review
1 parent 441e789 commit 6d8e5cb

10 files changed

Lines changed: 1192 additions & 31 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ All notable changes to this project are documented in this file.
66

77
### Changed
88

9-
- Added a first-party `themis generate` / `themis scan` code-scan flow that generates deterministic contract tests for exported modules, React components, hooks, route handlers, and Node services; emits richer machine-readable `--json` results for agents; writes `.themis/generate-map.json`, `.themis/generate-last.json`, `.themis/generate-handoff.json`, and `.themis/generate-backlog.json`; supports hint sidecars, automatic `--write-hints` scaffolding, targeted regeneration, planning mode, scenario/confidence steering, review/update/clean workflows, strict quality gates, and backlog remediation commands; and fails generated tests with direct regeneration guidance when scanned sources drift.
9+
- Added a first-party `themis generate` / `themis scan` code-scan flow that generates deterministic contract tests for exported modules, React components, hooks, Next app/router files, route handlers, and Node services; emits richer machine-readable `--json` results for agents; writes `.themis/generate-map.json`, `.themis/generate-last.json`, `.themis/generate-handoff.json`, and `.themis/generate-backlog.json`; supports interaction/state adapters for React components and hooks, automatic `--write-hints` scaffolding, targeted regeneration, planning mode, scenario/confidence steering, review/update/clean workflows, strict quality gates, and backlog remediation commands; and fails generated tests with direct regeneration guidance when scanned sources drift.
1010
- Moved the package line from alpha to beta and defined beta compatibility expectations for CLI, artifacts, and the JS/TS package surface.
1111
- Tightened npm/package positioning around Themis as an intent-first unit test framework for AI agents in Node.js and TypeScript.
1212
- Updated publish-facing docs to consistently frame Themis as an AI verdict engine for human and agent review loops.
@@ -16,6 +16,7 @@ All notable changes to this project are documented in this file.
1616
- Added project-aware JS/TS runtime support for TSX, ESM `.js`, `tsconfig` path aliases, `setupFiles`, and `jsdom` environments.
1717
- Added first-party snapshots, mocks, run-diff artifacts, and watch mode for tighter agent rerun loops.
1818
- Added an in-repo VS Code extension scaffold for artifact-driven result viewing, reruns, and HTML report opening.
19+
- Expanded the VS Code extension scaffold with generated-review navigation for source/test/hint mappings and unresolved generation backlog.
1920
- Refreshed README, AGENTS, and supporting docs to match the current package scope, JS/TS feature set, artifact contracts, and extension surface.
2021

2122
## 0.1.0-alpha.1 - 2026-02-13

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ npx themis test --watch --reporter next
9191

9292
## Code Scan
9393

94-
Themis can scan your JS/TS source tree and generate deterministic unit-layer tests for exported modules, React components, React hooks, route handlers, and Node services:
94+
Themis can scan your JS/TS source tree and generate deterministic unit-layer tests for exported modules, React components, React hooks, Next app components, Next route handlers, generic route handlers, and Node services:
9595

9696
```bash
9797
npx themis generate src
@@ -102,7 +102,8 @@ Generated files land under `tests/generated` by default. Each generated test:
102102

103103
- checks the scanned export names when Themis can resolve them exactly
104104
- snapshots a normalized runtime contract for the module surface
105-
- adds scenario adapters for React components/hooks, route handlers, and service functions when Themis can infer or read useful inputs
105+
- adds scenario adapters for React components/hooks, Next app/router files, route handlers, and service functions when Themis can infer or read useful inputs
106+
- captures React interaction and hook state-transition contracts when event handlers or stateful methods are available
106107
- fails with a regeneration hint when the source drifts after the scan
107108

108109
Themis also supports per-file generation hints with sidecars like `src/components/Button.themis.json` so humans and agents can provide props, args, route requests, and route context. When those sidecars do not exist yet, `--write-hints` can scaffold them automatically from the current source analysis.
@@ -118,7 +119,7 @@ Use these flags to control the generation loop:
118119
- `--clean`: remove generated files for the selected scope
119120
- `--changed`: target changed files in a git worktree
120121
- `--write-hints`: scaffold missing `.themis.json` sidecars so the next generate pass has explicit component props, hook args, service args, and route requests
121-
- `--scenario`: limit generation to one adapter family such as `react-hook` or `route-handler`
122+
- `--scenario`: limit generation to one adapter family such as `react-hook`, `next-app-component`, or `next-route-handler`
122123
- `--min-confidence`: keep only entries at or above a confidence threshold
123124
- `--strict`: fail the generate run on skips, conflicts, or entries below `high` confidence
124125
- `--fail-on-skips`, `--fail-on-conflicts`: turn unresolved scan debt into a non-zero exit code
@@ -167,6 +168,7 @@ See [`docs/why-themis.md`](docs/why-themis.md) for positioning, differentiators,
167168
- `npx themis generate src --clean`: removes generated tests for the selected scope.
168169
- `npx themis generate src --changed`: regenerates against changed files in the current git worktree.
169170
- `npx themis generate src --scenario react-hook --min-confidence high`: targets one adapter family at a confidence threshold.
171+
- `npx themis generate app --scenario next-route-handler`: focuses generation on Next app router request handlers.
170172
- `npx themis generate src --require-confidence high`: enforces a quality bar for all selected generated tests.
171173
- `npx themis generate src --files src/routes/ping.ts`: targets one or more explicit source files.
172174
- `npx themis generate src --match-source "routes/" --match-export "GET|POST"`: narrows generation by source path and exported symbol.
@@ -216,8 +218,9 @@ The repo now includes a thin VS Code extension scaffold at [`packages/themis-vsc
216218

217219
The extension is intentionally artifact-driven:
218220

219-
- reads `.themis/last-run.json`, `.themis/failed-tests.json`, `.themis/run-diff.json`, and `.themis/report.html`
221+
- reads `.themis/last-run.json`, `.themis/failed-tests.json`, `.themis/run-diff.json`, `.themis/generate-last.json`, `.themis/generate-map.json`, `.themis/generate-backlog.json`, and `.themis/report.html`
220222
- shows the latest verdict and failures in a sidebar
223+
- adds generated-review navigation for source/test/hint mappings plus unresolved generation backlog
221224
- reruns Themis from VS Code commands
222225
- opens the HTML report inside a webview
223226

docs/api.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Default behavior:
2929
- output directory: `tests/generated`
3030
- generated files mirror the scanned source tree with `*.generated.test.js`
3131
- generated tests snapshot normalized runtime export contracts
32-
- scenario adapters cover React components, React hooks, route handlers, and Node service functions when inputs can be inferred or hinted
32+
- scenario adapters cover React components, React hooks, Next app components, Next route handlers, generic route handlers, and Node service functions when inputs can be inferred or hinted
33+
- React component and hook adapters also snapshot inferred interaction/state contracts when event handlers or zero-argument stateful methods are available
3334
- `.themis/generate-map.json` records source-to-generated-test mappings plus scenario metadata
3435
- `.themis/generate-last.json` stores the full machine-readable generate payload
3536
- `.themis/generate-handoff.json` stores a compact prompt-ready handoff payload for agents
@@ -71,6 +72,8 @@ Per-file hint sidecars are supported via `<source>.themis.json`. These can provi
7172
- `excludeExports`
7273
- `scenarios`
7374

75+
`componentProps` and `routeRequests`/`routeContext` also steer Next app component and Next route handler adapters.
76+
7477
## `themis test` options
7578

7679
| Option | Type | Description |

docs/vscode-extension.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This is the intended shape of the editor UX:
88
- a results sidebar driven by `.themis/*` artifacts
99
- commands to run tests, rerun failures, refresh results, and open the HTML report
1010
- failure navigation that jumps from artifact data into the source file
11+
- generated-review navigation for source files, generated tests, hint sidecars, and backlog items
1112

1213
## Current MVP Scope
1314

@@ -16,7 +17,12 @@ The scaffold currently supports:
1617
- reading `.themis/last-run.json`
1718
- reading `.themis/failed-tests.json`
1819
- reading `.themis/run-diff.json`
20+
- reading `.themis/generate-last.json`
21+
- reading `.themis/generate-map.json`
22+
- reading `.themis/generate-backlog.json`
1923
- opening `.themis/report.html` in a webview
24+
- surfacing generated source/test/hint mappings in the sidebar
25+
- surfacing unresolved generate backlog and gate state in the sidebar
2026
- refreshing when `.themis/*` files change
2127

2228
The extension is intentionally thin. It shells out to Themis commands and treats the CLI plus artifacts as the canonical contract.

packages/themis-vscode/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "themis-vscode",
33
"displayName": "Themis",
4-
"description": "View Themis test results, rerun suites, and open the HTML verdict report inside VS Code.",
4+
"description": "Review Themis test and generate artifacts, rerun suites, and open the HTML verdict report inside VS Code.",
55
"version": "0.1.0-beta.0",
66
"license": "MIT",
77
"publisher": "vitron-ai",
@@ -29,7 +29,8 @@
2929
"onCommand:themis.runTests",
3030
"onCommand:themis.rerunFailed",
3131
"onCommand:themis.openHtmlReport",
32-
"onCommand:themis.refreshResults"
32+
"onCommand:themis.refreshResults",
33+
"onCommand:themis.openArtifactFile"
3334
],
3435
"contributes": {
3536
"viewsContainers": {
@@ -69,6 +70,11 @@
6970
"command": "themis.refreshResults",
7071
"title": "Themis: Refresh Results",
7172
"category": "Themis"
73+
},
74+
{
75+
"command": "themis.openArtifactFile",
76+
"title": "Themis: Open Artifact File",
77+
"category": "Themis"
7278
}
7379
],
7480
"menus": {

0 commit comments

Comments
 (0)