@vitronai/themis 0.1.0-beta.0 → 0.1.0-beta.2

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/docs/api.md CHANGED
@@ -9,6 +9,8 @@ This document defines the public API surface for Themis `0.1.0-beta.0`.
9
9
  ```bash
10
10
  themis test [options]
11
11
  themis init
12
+ themis generate [path]
13
+ themis migrate <jest|vitest>
12
14
  ```
13
15
 
14
16
  ## `themis init`
@@ -18,6 +20,137 @@ Creates:
18
20
  - `themis.config.json` with default settings
19
21
  - `tests/example.test.js` sample test (if missing)
20
22
 
23
+ ## `themis generate`
24
+
25
+ Scans a source directory and writes generated Themis unit-layer tests.
26
+
27
+ Default behavior:
28
+
29
+ - input directory: `src`
30
+ - output directory: `tests/generated`
31
+ - generated files mirror the scanned source tree with `*.generated.test.js`
32
+ - generated tests assert normalized runtime export contracts directly in generated source
33
+ - 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
34
+ - React component and hook adapters also assert inferred interaction/state contracts when event handlers or zero-argument stateful methods are available
35
+ - React and Next component adapters also emit direct DOM-state contract assertions that capture visible text, inferred roles, non-event attributes, and interaction-driven UI changes
36
+ - React and Next component adapters can also emit async behavioral flow contracts when `componentFlows` are inferred or supplied, including richer inferred input/submit/loading/success flows for common async forms
37
+ - project-level providers from `themis.generate.js` / `themis.generate.cjs` can match source files, inject shared fixture data, register runtime mocks, and wrap generated component renders for provider-aware DOM contracts and behavioral flow coverage
38
+ - provider presets can declare router, Next navigation, auth/session, React Query, Zustand, and Redux-style wrapper metadata without hand-writing every wrapper shell
39
+ - richer flow expectations can assert text transitions, attribute state, and role presence for empty, disabled, retry, error, and recovery paths
40
+ - `.themis/generate-map.json` records source-to-generated-test mappings plus scenario metadata
41
+ - `.themis/generate-last.json` stores the full machine-readable generate payload
42
+ - `.themis/generate-handoff.json` stores a compact prompt-ready handoff payload for agents
43
+ - `.themis/generate-backlog.json` stores unresolved skips, conflicts, and confidence debt with suggested remediation
44
+
45
+ ## `themis generate` options
46
+
47
+ | Option | Type | Description |
48
+ | --- | --- | --- |
49
+ | `--json` | flag | Print a machine-readable generation payload (`themis.generate.result.v1`). |
50
+ | `--plan` | flag | Alias for `--review --json`, plus persisted handoff artifacts for agent loops. |
51
+ | `--review` | flag | Preview create/update/remove decisions without writing files. |
52
+ | `--update` | flag | Refresh existing generated files only. |
53
+ | `--clean` | flag | Remove generated files for the selected scope. |
54
+ | `--changed` | flag | Limit selection to changed files in the current git worktree. |
55
+ | `--write-hints` | flag | Scaffold missing `.themis.json` hint sidecars and use them in the same generate run. |
56
+ | `--strict` | flag | Fail generation on skips, conflicts, or entries below `high` confidence. |
57
+ | `--fail-on-skips` | flag | Fail generation when any selected source file is skipped. |
58
+ | `--fail-on-conflicts` | flag | Fail generation when conflicts remain unresolved. |
59
+ | `--files <paths>` | string | Comma-separated list of explicit source files to generate for. |
60
+ | `--scenario <name>` | string | Limit generation to one adapter family. |
61
+ | `--min-confidence <level>` | string | Keep only entries at or above `low`, `medium`, or `high`. |
62
+ | `--require-confidence <level>` | string | Fail generation if selected entries fall below `low`, `medium`, or `high`. |
63
+ | `--match-source <regex>` | string | Filter candidate source files by relative path regex. |
64
+ | `--match-export <regex>` | string | Filter candidate source files by exported symbol regex. |
65
+ | `--include <regex>` | string | Include only source files whose relative path matches regex. |
66
+ | `--exclude <regex>` | string | Exclude source files whose relative path matches regex. |
67
+ | `--output <path>` | string | Output directory for generated tests (default: `tests/generated`). |
68
+ | `--force` | flag | Replace conflicting files that were not created by a prior Themis scan. |
69
+
70
+ Per-file hint sidecars are supported via `<source>.themis.json`. These can provide:
71
+
72
+ - `componentProps`
73
+ - `componentInteractions`
74
+ - `componentFlows`
75
+ - `hookArgs`
76
+ - `hookInteractions`
77
+ - `serviceArgs`
78
+ - `routeRequests`
79
+ - `routeContext`
80
+ - `includeExports`
81
+ - `excludeExports`
82
+ - `scenarios`
83
+
84
+ `componentProps` and `routeRequests`/`routeContext` also steer Next app component and Next route handler adapters.
85
+
86
+ Project-level provider modules are supported via `themis.generate.js` or `themis.generate.cjs` at the repo root. A provider can expose:
87
+
88
+ - `include` / `exclude` / `files`: source matching rules
89
+ - any of the same static fixture keys as sidecars (`componentProps`, `componentInteractions`, `componentFlows`, `hookArgs`, `hookInteractions`, `serviceArgs`, `routeRequests`, `routeContext`, `scenarios`)
90
+ - `router`: preset router wrapper metadata (`path`, `params`, `search`)
91
+ - `router`: also supports `name`, `history`, and `state`
92
+ - `nextNavigation`: preset Next navigation wrapper metadata (`pathname`, `params`, `searchParams`)
93
+ - `nextNavigation`: also supports `segment` and `locale`
94
+ - `auth`: preset auth/session wrapper metadata (`user`, `session`, `state`)
95
+ - `auth`: also supports `roles` and `permissions`
96
+ - `reactQuery`: preset React Query wrapper metadata (`clientName`, `state`, `cache`)
97
+ - `reactQuery`: also supports `status`, `fetchStatus`, and `queries`
98
+ - `zustand`: preset Zustand wrapper metadata (`name`, `state`)
99
+ - `zustand`: also supports `selectors` and `actions`
100
+ - `redux`: preset Redux wrapper metadata (`slice`, `state`)
101
+ - `redux`: also supports `selectors` and `actions`
102
+ - `applyMocks(context)`: runtime mock registration for generated tests
103
+ - `wrapRender(context)`: provider-aware render wrapping for generated React and Next component adapters
104
+
105
+ `applyMocks(context)` receives:
106
+
107
+ - `sourceFile`
108
+ - `sourcePath`
109
+ - `exportName`
110
+ - `scenario`
111
+ - `mock`
112
+ - `fn`
113
+ - `mockFetch`
114
+ - `resetFetchMocks`
115
+ - `restoreFetch`
116
+ - `useFakeTimers`
117
+ - `useRealTimers`
118
+ - `advanceTimersByTime`
119
+ - `runAllTimers`
120
+ - `flushMicrotasks`
121
+
122
+ `wrapRender(context)` receives:
123
+
124
+ - `sourceFile`
125
+ - `sourcePath`
126
+ - `exportName`
127
+ - `scenario`
128
+ - `element`
129
+ - `withProviderShell(type, element, attrs)`
130
+ - `withReactRouter(element, config?)`
131
+ - `withNextNavigation(element, config?)`
132
+ - `withAuthSession(element, config?)`
133
+ - `withReactQuery(element, config?)`
134
+ - `withZustandStore(element, config?)`
135
+ - `withReduxStore(element, config?)`
136
+
137
+ ## `themis migrate`
138
+
139
+ Scaffolds an incremental migration bridge for existing Jest or Vitest suites.
140
+
141
+ Behavior:
142
+
143
+ - writes or updates `themis.config.json`
144
+ - adds `tests/setup.themis.js` to `setupFiles`
145
+ - writes `themis.compat.js` as a local compatibility bridge
146
+ - adds `test:themis` to `package.json` when missing
147
+ - writes `.themis/migration-report.json` with detected compatibility imports and next actions
148
+ - relies on built-in runtime compatibility for `@jest/globals`, `vitest`, and `@testing-library/react`
149
+
150
+ Migration options:
151
+
152
+ - `--rewrite-imports`: rewrites matched imports from `@jest/globals`, `vitest`, and `@testing-library/react` to the local `themis.compat.js` bridge
153
+
21
154
  ## `themis test` options
22
155
 
23
156
  | Option | Type | Description |
@@ -28,20 +161,44 @@ Creates:
28
161
  | `--reporter spec\|next\|json\|agent\|html` | string | Explicit reporter override. |
29
162
  | `--workers <N>` | positive integer | Override worker count. Invalid values fail fast. |
30
163
  | `--environment node\|jsdom` | string | Override the configured test environment. |
164
+ | `--isolation worker\|in-process` | string | Select worker isolation or a zero-IPC in-process execution mode. |
165
+ | `--cache` | flag | Enable file-level result caching for in-process local loops. |
31
166
  | `-w`, `--watch` | flag | Rerun the selected suite when watched project files change. |
32
- | `-u`, `--update-snapshots` | flag | Update snapshot files when `toMatchSnapshot()` values change. |
33
167
  | `--stability <N>` | positive integer | Run selected tests `N` times and classify stability (`stable_pass`, `stable_fail`, `unstable`). |
34
168
  | `--html-output <path>` | string | Output path for `--reporter html` (default: `.themis/report.html`). |
35
169
  | `--match "<regex>"` | string | Run only tests whose full name matches regex. |
36
170
  | `--rerun-failed` | flag | Rerun failures from `.themis/failed-tests.json`. |
37
171
  | `--no-memes` | flag | Disable meme intent aliases (`cook`, `yeet`, `vibecheck`, `wipe`). |
172
+
173
+ Migration compatibility:
174
+
175
+ - imports from `@jest/globals` are supported at runtime
176
+ - imports from `vitest` are supported at runtime
177
+ - imports from `@testing-library/react` are supported via Themis `render`, `screen`, `fireEvent`, `waitFor`, `cleanup`, and `act`
178
+ - `themis migrate <jest|vitest>` also emits `.themis/migration-report.json` with detected files and recommended next actions
179
+
180
+ Additional option:
181
+
38
182
  | `--lexicon classic\|themis` | string | Human reporter terminology mode for `next/spec`. |
39
183
 
184
+ Execution note:
185
+
186
+ - `--watch --isolation in-process --cache` is the fastest local rerun mode
187
+ - `--isolation worker` remains the safer mode for CI and global-heavy suites
188
+
189
+ Snapshot note:
190
+
191
+ - Themis no longer supports first-party snapshot files or `-u` update flows. Prefer direct assertions and generated contract tests.
192
+
40
193
  ## Exit behavior
41
194
 
42
195
  - Exit code `0`: all selected tests passed or were skipped.
43
196
  - Exit code `1`: any selected test failed, invalid usage, or runtime error.
44
197
 
198
+ Generate-specific note:
199
+
200
+ - `themis generate` exits `1` when active generate gates fail, including unresolved conflicts in write mode.
201
+
45
202
  `--lexicon` does not affect machine payload contracts (`--json`, `--agent`, or artifacts).
46
203
 
47
204
  ## Artifacts
@@ -52,10 +209,17 @@ Each run writes to `.themis/`:
52
209
  - `failed-tests.json`: failed subset (`themis.failures.v1`)
53
210
  - `run-diff.json`: diff against the previous run
54
211
  - `run-history.json`: rolling recent-run history
212
+ - `fix-handoff.json`: deduped repair artifact for generated test failures (`themis.fix.handoff.v1`)
213
+ - `migration-report.json`: migration inventory for Jest/Vitest bridge scaffolds (`themis.migration.report.v1`)
55
214
 
56
215
  Formal schemas:
57
216
 
58
217
  - `docs/schemas/agent-result.v1.json`
218
+ - `docs/schemas/generate-result.v1.json`
219
+ - `docs/schemas/generate-map.v1.json`
220
+ - `docs/schemas/generate-handoff.v1.json`
221
+ - `docs/schemas/generate-backlog.v1.json`
222
+ - `docs/schemas/fix-handoff.v1.json`
59
223
  - `docs/schemas/failures.v1.json`
60
224
 
61
225
  Human-facing artifact:
@@ -68,6 +232,52 @@ Agent payload details:
68
232
  - `analysis.failureClusters` groups failures by shared fingerprint
69
233
  - `analysis.stability` captures multi-run classifications and per-test status sequences
70
234
  - `analysis.comparison` reports delta stats plus new and resolved failures against the previous run
235
+ - `artifacts.fixHandoff` points to `.themis/fix-handoff.json` for generated failure repair loops
236
+ - fix handoff entries include `repairStrategy`, `candidateFiles`, and `autofixCommand` for machine repair loops
237
+
238
+ ## UI Test Utilities
239
+
240
+ Themis exposes a lightweight DOM-oriented helper layer for `jsdom` tests:
241
+
242
+ - `render(input, options?)`
243
+ - `screen.getByText(text)`
244
+ - `screen.queryByText(text)`
245
+ - `screen.getByRole(role, options?)`
246
+ - `screen.queryByRole(role, options?)`
247
+ - `screen.getByLabelText(labelText)`
248
+ - `fireEvent.click(node)`
249
+ - `fireEvent.change(node, payload?)`
250
+ - `fireEvent.input(node, payload?)`
251
+ - `fireEvent.submit(node)`
252
+ - `fireEvent.keyDown(node, payload?)`
253
+ - `waitFor(assertion, options?)`
254
+ - `cleanup()`
255
+ - `useFakeTimers()`
256
+ - `useRealTimers()`
257
+ - `advanceTimersByTime(ms)`
258
+ - `runAllTimers()`
259
+ - `flushMicrotasks()`
260
+ - `mockFetch(handlerOrResponse)`
261
+ - `resetFetchMocks()`
262
+ - `restoreFetch()`
263
+
264
+ Supported DOM matchers:
265
+
266
+ - `expect(node).toHaveTextContent(text)`
267
+ - `expect(node).toHaveAttribute(name, value?)`
268
+ - `expect(node).toBeInTheDocument()`
269
+
270
+ These helpers are intentionally small and deterministic. They are designed for generated UI unit-layer tests and human-authored component tests running in Themis `jsdom` mode.
271
+
272
+ `mockFetch(...)` accepts either:
273
+
274
+ - a function `(input, init) => response`
275
+ - a Response instance
276
+ - a shorthand object like `{ status, headers, body }` or `{ status, json }`
277
+
278
+ When the handler form is used, shorthand objects returned by the handler are normalized into `Response` instances before the generated test consumes them.
279
+
280
+ The fake timer helpers only patch the current Themis runtime. They do not mutate system time outside the active test process.
71
281
 
72
282
  ## Config File (`themis.config.json`)
73
283
 
@@ -80,6 +290,7 @@ Agent payload details:
80
290
  | `environment` | `node\|jsdom` | `"node"` | Test runtime environment. |
81
291
  | `setupFiles` | `string[]` | `[]` | Files loaded before each test file. |
82
292
  | `tsconfigPath` | `string \| null` | `"tsconfig.json"` | Project tsconfig used for TSX and alias-aware transpilation. |
293
+ | `testIgnore` | `string[]` | `[]` | Regex strings matched against repo-relative paths during discovery. Matching files and directories are skipped. |
83
294
 
84
295
  ## Programmatic API
85
296
 
@@ -106,7 +317,6 @@ Options:
106
317
  - `environment?: "node" | "jsdom"`
107
318
  - `setupFiles?: string[]`
108
319
  - `tsconfigPath?: string | null`
109
- - `updateSnapshots?: boolean`
110
320
 
111
321
  ## `runTests(files, options?): Promise<RunResult>`
112
322
 
@@ -122,20 +332,79 @@ Options:
122
332
  - `environment?: "node" | "jsdom"`
123
333
  - `setupFiles?: string[]`
124
334
  - `tsconfigPath?: string | null`
125
- - `updateSnapshots?: boolean`
126
335
 
127
336
  ## `discoverTests(cwd, config): string[]`
128
337
 
129
338
  Discovers test files from config.
130
339
 
340
+ ## `generateTestsFromSource(cwd, options?): GenerateSummary`
341
+
342
+ Scans exported source modules and writes deterministic generated tests plus mapping artifacts.
343
+
344
+ Options:
345
+
346
+ - `targetDir?: string`
347
+ - `outputDir?: string`
348
+ - `force?: boolean`
349
+ - `writeHints?: boolean`
350
+ - `plan?: boolean`
351
+ - `review?: boolean`
352
+ - `update?: boolean`
353
+ - `clean?: boolean`
354
+ - `changed?: boolean`
355
+ - `strict?: boolean`
356
+ - `failOnSkips?: boolean`
357
+ - `failOnConflicts?: boolean`
358
+ - `requireConfidence?: string | null`
359
+ - `files?: string[] | string`
360
+ - `scenario?: string | null`
361
+ - `minConfidence?: string | null`
362
+ - `matchSource?: string | null`
363
+ - `matchExport?: string | null`
364
+ - `include?: string | null`
365
+ - `exclude?: string | null`
366
+
367
+ Generated tests can consume repo-level providers from `themis.generate.js` / `themis.generate.cjs` automatically. No extra flag is required.
368
+
369
+ Returns absolute paths for scanned files, selected generated files, removed stale generated files, skipped files, detailed per-entry actions, prompt text, and artifact locations.
370
+
371
+ Generate payload note:
372
+
373
+ - `mode.writeHints` indicates whether scaffold hint generation was enabled
374
+ - `hintFiles` reports created, updated, and unchanged scaffold sidecars for the run
375
+
376
+ ## `buildGeneratePayload(summary, cwd?): GeneratePayload`
377
+
378
+ Converts a `GenerateSummary` into the same machine-readable payload emitted by `themis generate --json`.
379
+
380
+ ## `buildGenerateBacklogPayload(summary, cwd?): GenerateBacklogPayload`
381
+
382
+ Builds the unresolved-work artifact persisted at `.themis/generate-backlog.json`.
383
+
384
+ ## `buildGenerateHandoff(payload): GenerateHandoffPayload`
385
+
386
+ Builds the compact handoff payload persisted at `.themis/generate-handoff.json`.
387
+
388
+ ## `writeGenerateArtifacts(summary, cwd?): { payload, handoff, backlog }`
389
+
390
+ Writes `.themis/generate-last.json`, `.themis/generate-handoff.json`, and `.themis/generate-backlog.json` for a generate run and returns all three payloads.
391
+
131
392
  ## `loadConfig(cwd): ThemisConfig`
132
393
 
133
394
  Loads `themis.config.json` and merges with defaults.
134
395
 
396
+ Discovery note:
397
+
398
+ - `testIgnore` is applied to repo-relative file and directory paths before descent, so patterns like `^tests/generated(?:/|$)` keep generated output out of default test runs without changing `testDir`.
399
+
135
400
  ## `initConfig(cwd): void`
136
401
 
137
402
  Creates `themis.config.json` if missing.
138
403
 
404
+ ## `runMigrate(cwd, framework): MigrationResult`
405
+
406
+ Scaffolds an incremental migration bridge for `jest` or `vitest`.
407
+
139
408
  ## `DEFAULT_CONFIG: ThemisConfig`
140
409
 
141
410
  Default configuration object used by `loadConfig` and `initConfig`.
@@ -158,7 +427,6 @@ Built-in matcher API:
158
427
  - `toHaveBeenCalled()`
159
428
  - `toHaveBeenCalledTimes(expected)`
160
429
  - `toHaveBeenCalledWith(...args)`
161
- - `toMatchSnapshot(name?)`
162
430
 
163
431
  Machine-facing note:
164
432
 
@@ -25,7 +25,7 @@
25
25
  "artifacts": {
26
26
  "type": "object",
27
27
  "additionalProperties": false,
28
- "required": ["lastRun", "failedTests", "runDiff", "runHistory"],
28
+ "required": ["lastRun", "failedTests", "runDiff", "runHistory", "fixHandoff"],
29
29
  "properties": {
30
30
  "lastRun": {
31
31
  "type": "string"
@@ -38,6 +38,9 @@
38
38
  },
39
39
  "runHistory": {
40
40
  "type": "string"
41
+ },
42
+ "fixHandoff": {
43
+ "type": "string"
41
44
  }
42
45
  }
43
46
  },
@@ -47,7 +50,7 @@
47
50
  "hints": {
48
51
  "type": "object",
49
52
  "additionalProperties": false,
50
- "required": ["rerunFailed", "targetedRerun", "updateSnapshots", "diffLastRun"],
53
+ "required": ["rerunFailed", "targetedRerun", "diffLastRun", "repairGenerated"],
51
54
  "properties": {
52
55
  "rerunFailed": {
53
56
  "type": "string"
@@ -55,10 +58,10 @@
55
58
  "targetedRerun": {
56
59
  "type": "string"
57
60
  },
58
- "updateSnapshots": {
61
+ "diffLastRun": {
59
62
  "type": "string"
60
63
  },
61
- "diffLastRun": {
64
+ "repairGenerated": {
62
65
  "type": "string"
63
66
  }
64
67
  }
@@ -0,0 +1,105 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/vitron-ai/themis/docs/schemas/fix-handoff.v1.json",
4
+ "title": "Themis Fix Handoff v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema", "runId", "createdAt", "summary", "artifacts", "items", "nextActions"],
8
+ "properties": {
9
+ "schema": {
10
+ "type": "string",
11
+ "const": "themis.fix.handoff.v1"
12
+ },
13
+ "runId": {
14
+ "type": "string"
15
+ },
16
+ "createdAt": {
17
+ "type": "string"
18
+ },
19
+ "summary": {
20
+ "type": "object",
21
+ "additionalProperties": false,
22
+ "required": ["totalFailures", "generatedFailures", "staleSources", "contractFailures"],
23
+ "properties": {
24
+ "totalFailures": { "type": "number" },
25
+ "generatedFailures": { "type": "number" },
26
+ "staleSources": { "type": "number" },
27
+ "contractFailures": { "type": "number" }
28
+ }
29
+ },
30
+ "artifacts": {
31
+ "type": "object",
32
+ "additionalProperties": false,
33
+ "required": ["failedTests", "generateMap", "generateBacklog", "fixHandoff"],
34
+ "properties": {
35
+ "failedTests": { "type": "string" },
36
+ "generateMap": { "type": "string" },
37
+ "generateBacklog": { "type": "string" },
38
+ "fixHandoff": { "type": "string" }
39
+ }
40
+ },
41
+ "items": {
42
+ "type": "array",
43
+ "items": {
44
+ "type": "object",
45
+ "additionalProperties": false,
46
+ "required": [
47
+ "file",
48
+ "name",
49
+ "fullName",
50
+ "message",
51
+ "testFile",
52
+ "sourceFile",
53
+ "moduleKind",
54
+ "confidence",
55
+ "scenarios",
56
+ "hintsFile",
57
+ "category",
58
+ "failureCount",
59
+ "failedTests",
60
+ "repairStrategy",
61
+ "candidateFiles",
62
+ "suggestedAction",
63
+ "suggestedCommand",
64
+ "autofixCommand"
65
+ ],
66
+ "properties": {
67
+ "file": { "type": "string" },
68
+ "name": { "type": "string" },
69
+ "fullName": { "type": "string" },
70
+ "message": { "type": "string" },
71
+ "testFile": { "type": "string" },
72
+ "sourceFile": { "type": "string" },
73
+ "moduleKind": { "type": ["string", "null"] },
74
+ "confidence": { "type": ["string", "null"] },
75
+ "scenarios": {
76
+ "type": "array",
77
+ "items": { "type": "string" }
78
+ },
79
+ "hintsFile": { "type": ["string", "null"] },
80
+ "category": {
81
+ "type": "string",
82
+ "enum": ["source-drift", "generated-contract-failure"]
83
+ },
84
+ "failureCount": { "type": "number" },
85
+ "failedTests": {
86
+ "type": "array",
87
+ "items": { "type": "string" }
88
+ },
89
+ "repairStrategy": { "type": "string" },
90
+ "candidateFiles": {
91
+ "type": "array",
92
+ "items": { "type": "string" }
93
+ },
94
+ "suggestedAction": { "type": "string" },
95
+ "suggestedCommand": { "type": ["string", "null"] },
96
+ "autofixCommand": { "type": ["string", "null"] }
97
+ }
98
+ }
99
+ },
100
+ "nextActions": {
101
+ "type": "array",
102
+ "items": { "type": "string" }
103
+ }
104
+ }
105
+ }
@@ -0,0 +1,117 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/vitron-ai/themis/docs/schemas/generate-backlog.v1.json",
4
+ "title": "Themis Generate Backlog v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema", "source", "filters", "gates", "summary", "items"],
8
+ "properties": {
9
+ "schema": {
10
+ "type": "string",
11
+ "const": "themis.generate.backlog.v1"
12
+ },
13
+ "source": {
14
+ "type": "object",
15
+ "additionalProperties": false,
16
+ "required": ["targetDir", "outputDir"],
17
+ "properties": {
18
+ "targetDir": { "type": "string" },
19
+ "outputDir": { "type": "string" }
20
+ }
21
+ },
22
+ "filters": {
23
+ "type": "object",
24
+ "additionalProperties": false,
25
+ "required": ["plan", "changed", "files", "scenario", "minConfidence", "matchSource", "matchExport", "include", "exclude"],
26
+ "properties": {
27
+ "plan": { "type": "boolean" },
28
+ "changed": { "type": "boolean" },
29
+ "files": {
30
+ "type": "array",
31
+ "items": { "type": "string" }
32
+ },
33
+ "scenario": { "type": ["string", "null"] },
34
+ "minConfidence": { "type": ["string", "null"] },
35
+ "matchSource": { "type": ["string", "null"] },
36
+ "matchExport": { "type": ["string", "null"] },
37
+ "include": { "type": ["string", "null"] },
38
+ "exclude": { "type": ["string", "null"] }
39
+ }
40
+ },
41
+ "gates": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "required": ["strict", "failOnSkips", "failOnConflicts", "requireConfidence", "failed", "failures"],
45
+ "properties": {
46
+ "strict": { "type": "boolean" },
47
+ "failOnSkips": { "type": "boolean" },
48
+ "failOnConflicts": { "type": "boolean" },
49
+ "requireConfidence": { "type": ["string", "null"] },
50
+ "failed": { "type": "boolean" },
51
+ "failures": {
52
+ "type": "array",
53
+ "items": { "$ref": "#/$defs/gateFailure" }
54
+ }
55
+ }
56
+ },
57
+ "summary": {
58
+ "type": "object",
59
+ "additionalProperties": false,
60
+ "required": ["total", "errors", "warnings", "skipped", "conflicts", "confidence"],
61
+ "properties": {
62
+ "total": { "type": "number" },
63
+ "errors": { "type": "number" },
64
+ "warnings": { "type": "number" },
65
+ "skipped": { "type": "number" },
66
+ "conflicts": { "type": "number" },
67
+ "confidence": { "type": "number" }
68
+ }
69
+ },
70
+ "items": {
71
+ "type": "array",
72
+ "items": { "$ref": "#/$defs/backlogItem" }
73
+ }
74
+ },
75
+ "$defs": {
76
+ "gateFailure": {
77
+ "type": "object",
78
+ "additionalProperties": false,
79
+ "required": ["code", "count", "message"],
80
+ "properties": {
81
+ "code": { "type": "string" },
82
+ "count": { "type": "number" },
83
+ "message": { "type": "string" }
84
+ }
85
+ },
86
+ "backlogItem": {
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "required": [
90
+ "type",
91
+ "severity",
92
+ "sourceFile",
93
+ "testFile",
94
+ "moduleKind",
95
+ "confidence",
96
+ "stage",
97
+ "hintsFile",
98
+ "reason",
99
+ "suggestedAction",
100
+ "suggestedCommand"
101
+ ],
102
+ "properties": {
103
+ "type": { "type": "string" },
104
+ "severity": { "type": "string", "enum": ["warning", "error"] },
105
+ "sourceFile": { "type": "string" },
106
+ "testFile": { "type": ["string", "null"] },
107
+ "moduleKind": { "type": ["string", "null"] },
108
+ "confidence": { "type": ["string", "null"] },
109
+ "stage": { "type": ["string", "null"] },
110
+ "hintsFile": { "type": ["string", "null"] },
111
+ "reason": { "type": "string" },
112
+ "suggestedAction": { "type": "string" },
113
+ "suggestedCommand": { "type": ["string", "null"] }
114
+ }
115
+ }
116
+ }
117
+ }