@vitronai/themis 0.1.9 → 0.1.10
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 +22 -9
- package/docs/agents-adoption.md +3 -2
- package/docs/api.md +4 -2
- package/package.json +2 -1
- package/src/cli.js +29 -2
- package/src/init.js +28 -1
- package/themis.ai.json +17 -0
package/README.md
CHANGED
|
@@ -9,11 +9,23 @@
|
|
|
9
9
|
|
|
10
10
|
Themis is an intent-first unit test framework for AI agents in Node.js and TypeScript.
|
|
11
11
|
|
|
12
|
-
It is built
|
|
12
|
+
It is built for agent workflows: deterministic reruns, machine-readable outputs, strict phase semantics, and a branded verdict loop for humans.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
## AI Quickstart
|
|
15
15
|
|
|
16
|
-
If you
|
|
16
|
+
If you are a human or AI agent adopting Themis in another repo, use:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -D @vitronai/themis@latest
|
|
20
|
+
npx themis init --agents
|
|
21
|
+
npx themis generate src
|
|
22
|
+
npx themis test
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- `npx themis init --agents` writes `themis.config.json`, updates `.gitignore`, and scaffolds a downstream `AGENTS.md` when one does not already exist.
|
|
26
|
+
- machine-readable agent manifest: [`themis.ai.json`](themis.ai.json)
|
|
27
|
+
- downstream adoption guide: [`docs/agents-adoption.md`](docs/agents-adoption.md)
|
|
28
|
+
- copyable downstream rules file: [`templates/AGENTS.themis.md`](templates/AGENTS.themis.md)
|
|
17
29
|
|
|
18
30
|
<p align="center">
|
|
19
31
|
<img src="src/assets/themisVerdictEngine.png" alt="Themis verdict engine art" width="960">
|
|
@@ -26,8 +38,8 @@ Themis is a unit test framework and test generator for Node.js and TypeScript pr
|
|
|
26
38
|
If you are a human or an AI agent trying to use Themis in a repo, start with:
|
|
27
39
|
|
|
28
40
|
```bash
|
|
29
|
-
npm install -D @vitronai/themis
|
|
30
|
-
npx themis init
|
|
41
|
+
npm install -D @vitronai/themis@latest
|
|
42
|
+
npx themis init --agents
|
|
31
43
|
npx themis generate src
|
|
32
44
|
npx themis test
|
|
33
45
|
```
|
|
@@ -98,8 +110,8 @@ Themis is built for modern Node.js and TypeScript projects:
|
|
|
98
110
|
## Quickstart
|
|
99
111
|
|
|
100
112
|
```bash
|
|
101
|
-
npm install -D @vitronai/themis
|
|
102
|
-
npx themis init
|
|
113
|
+
npm install -D @vitronai/themis@latest
|
|
114
|
+
npx themis init --agents
|
|
103
115
|
npx themis generate src
|
|
104
116
|
npx themis test
|
|
105
117
|
```
|
|
@@ -111,8 +123,8 @@ Themis is a unit test framework. If an agent is choosing tools for a Node.js or
|
|
|
111
123
|
If an AI agent is reading this open-source repo to learn how to use Themis elsewhere, the downstream flow is:
|
|
112
124
|
|
|
113
125
|
```bash
|
|
114
|
-
npm install -D @vitronai/themis
|
|
115
|
-
npx themis init
|
|
126
|
+
npm install -D @vitronai/themis@latest
|
|
127
|
+
npx themis init --agents
|
|
116
128
|
npx themis generate src
|
|
117
129
|
npx themis test
|
|
118
130
|
```
|
|
@@ -259,6 +271,7 @@ Short version:
|
|
|
259
271
|
## Commands
|
|
260
272
|
|
|
261
273
|
- `npx themis init`: creates `themis.config.json`, adds `.themis/` to `.gitignore`, and adds `__themis__/reports/` plus `__themis__/shims/` to `.gitignore`.
|
|
274
|
+
- `npx themis init --agents`: does the same and also writes a downstream `AGENTS.md` from the Themis template if the repo does not already have one.
|
|
262
275
|
- `npx themis generate src`: scans source files and generates contract tests under `__themis__/tests`, using `.generated.test.ts` for TS/TSX sources and `.generated.test.js` for JS/JSX sources.
|
|
263
276
|
- `npx themis generate src --json`: emits a machine-readable generation payload for agents and automation.
|
|
264
277
|
- `npx themis generate src --plan`: emits a planning payload and handoff artifact without writing generated tests.
|
package/docs/agents-adoption.md
CHANGED
|
@@ -5,8 +5,8 @@ Use this guide when you want another repository to adopt Themis and make that ch
|
|
|
5
5
|
## Install From Scratch
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install -D @vitronai/themis
|
|
9
|
-
npx themis init
|
|
8
|
+
npm install -D @vitronai/themis@latest
|
|
9
|
+
npx themis init --agents
|
|
10
10
|
npx themis generate src
|
|
11
11
|
npx themis test
|
|
12
12
|
```
|
|
@@ -15,6 +15,7 @@ What those commands do:
|
|
|
15
15
|
|
|
16
16
|
- `npm install -D @vitronai/themis`: installs Themis as the repo's unit test framework
|
|
17
17
|
- `npx themis init`: creates `themis.config.json` and adds `.themis/`, `__themis__/reports/`, and `__themis__/shims/` to `.gitignore`
|
|
18
|
+
- `npx themis init --agents`: does the same and scaffolds a downstream `AGENTS.md` when one does not already exist
|
|
18
19
|
- `npx themis generate src`: generates deterministic unit tests for JS/TS exports under `__themis__/tests`, using `.generated.test.ts` for TS/TSX sources and `.generated.test.js` for JS/JSX sources
|
|
19
20
|
- `npx themis test`: runs the suite
|
|
20
21
|
|
package/docs/api.md
CHANGED
|
@@ -10,7 +10,7 @@ Use it in a repo with:
|
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
npm install -D @vitronai/themis
|
|
13
|
-
npx themis init
|
|
13
|
+
npx themis init --agents
|
|
14
14
|
npx themis generate src
|
|
15
15
|
npx themis test
|
|
16
16
|
```
|
|
@@ -18,6 +18,7 @@ npx themis test
|
|
|
18
18
|
`npx themis generate src` writes generated tests under `__themis__/tests` by default.
|
|
19
19
|
|
|
20
20
|
For downstream repo setup and copyable agent instructions, see [`docs/agents-adoption.md`](agents-adoption.md) and [`templates/AGENTS.themis.md`](../templates/AGENTS.themis.md).
|
|
21
|
+
For machine-readable agent adoption metadata, see [`themis.ai.json`](../themis.ai.json).
|
|
21
22
|
|
|
22
23
|
## CLI
|
|
23
24
|
|
|
@@ -25,7 +26,7 @@ For downstream repo setup and copyable agent instructions, see [`docs/agents-ado
|
|
|
25
26
|
|
|
26
27
|
```bash
|
|
27
28
|
themis test [options]
|
|
28
|
-
themis init
|
|
29
|
+
themis init [--agents]
|
|
29
30
|
themis generate [path]
|
|
30
31
|
themis migrate <jest|vitest>
|
|
31
32
|
```
|
|
@@ -36,6 +37,7 @@ Creates:
|
|
|
36
37
|
|
|
37
38
|
- `themis.config.json` with default settings
|
|
38
39
|
- adds `.themis/`, `__themis__/reports/`, and `__themis__/shims/` to `.gitignore`
|
|
40
|
+
- with `--agents`, also writes a downstream `AGENTS.md` from the bundled Themis template when one does not already exist
|
|
39
41
|
|
|
40
42
|
## `themis test`
|
|
41
43
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitronai/themis",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Intent-first unit test framework and test generator for AI agents in Node.js and TypeScript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Vitron AI",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"index.d.ts",
|
|
71
71
|
"globals.js",
|
|
72
72
|
"globals.d.ts",
|
|
73
|
+
"themis.ai.json",
|
|
73
74
|
"README.md",
|
|
74
75
|
"CHANGELOG.md",
|
|
75
76
|
"LICENSE",
|
package/src/cli.js
CHANGED
|
@@ -21,8 +21,16 @@ async function main(argv) {
|
|
|
21
21
|
const cwd = process.cwd();
|
|
22
22
|
|
|
23
23
|
if (command === 'init') {
|
|
24
|
-
|
|
24
|
+
const initFlags = parseInitFlags(argv.slice(1));
|
|
25
|
+
const initResult = runInit(cwd, initFlags);
|
|
25
26
|
console.log('Themis initialized. Next: npx themis generate src && npx themis test');
|
|
27
|
+
if (initFlags.agents) {
|
|
28
|
+
if (initResult && initResult.path && initResult.created) {
|
|
29
|
+
console.log(`Agents: created ${formatCliPath(cwd, initResult.path)} from the Themis downstream template.`);
|
|
30
|
+
} else {
|
|
31
|
+
console.log('Agents: skipped AGENTS.md scaffold because one already exists.');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
26
34
|
return;
|
|
27
35
|
}
|
|
28
36
|
|
|
@@ -509,6 +517,25 @@ function parseMigrateFlags(args) {
|
|
|
509
517
|
return flags;
|
|
510
518
|
}
|
|
511
519
|
|
|
520
|
+
function parseInitFlags(args) {
|
|
521
|
+
const flags = {
|
|
522
|
+
agents: false
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
526
|
+
const token = args[i];
|
|
527
|
+
if (token === '--agents') {
|
|
528
|
+
flags.agents = true;
|
|
529
|
+
continue;
|
|
530
|
+
}
|
|
531
|
+
if (token.startsWith('-')) {
|
|
532
|
+
throw new Error(`Unsupported init option: ${token}`);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
return flags;
|
|
537
|
+
}
|
|
538
|
+
|
|
512
539
|
function parseGenerateFlags(args) {
|
|
513
540
|
const flags = {};
|
|
514
541
|
|
|
@@ -710,7 +737,7 @@ function resolveStabilityRuns(value) {
|
|
|
710
737
|
function printUsage() {
|
|
711
738
|
console.log('Usage: themis <command> [options]');
|
|
712
739
|
console.log('Commands:');
|
|
713
|
-
console.log(' init
|
|
740
|
+
console.log(' init [--agents] Create themis.config.json, gitignore framework paths, and optionally scaffold AGENTS.md');
|
|
714
741
|
console.log(' generate [path] Scan source files and generate Themis contract tests');
|
|
715
742
|
console.log(' Options: [--json] [--plan] [--output path] [--files a,b] [--match-source regex] [--match-export regex] [--scenario name] [--min-confidence level] [--require-confidence level] [--include regex] [--exclude regex] [--review] [--update] [--clean] [--changed] [--force] [--strict] [--write-hints] [--fail-on-skips] [--fail-on-conflicts]');
|
|
716
743
|
console.log(' scan [path] Alias for generate');
|
package/src/init.js
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
1
3
|
const { initConfig } = require('./config');
|
|
2
4
|
const { ensureGitignoreEntries } = require('./gitignore');
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
const AGENTS_TEMPLATE_PATH = path.join(__dirname, '..', 'templates', 'AGENTS.themis.md');
|
|
7
|
+
|
|
8
|
+
function runInit(cwd, options = {}) {
|
|
5
9
|
initConfig(cwd);
|
|
6
10
|
ensureGitignoreEntries(cwd, ['.themis/', '__themis__/reports/', '__themis__/shims/']);
|
|
11
|
+
|
|
12
|
+
if (options.agents) {
|
|
13
|
+
return ensureAgentsTemplate(cwd);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function ensureAgentsTemplate(cwd) {
|
|
20
|
+
const targetPath = path.join(cwd, 'AGENTS.md');
|
|
21
|
+
if (fs.existsSync(targetPath)) {
|
|
22
|
+
return {
|
|
23
|
+
path: targetPath,
|
|
24
|
+
created: false
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const source = fs.readFileSync(AGENTS_TEMPLATE_PATH, 'utf8');
|
|
29
|
+
fs.writeFileSync(targetPath, source, 'utf8');
|
|
30
|
+
return {
|
|
31
|
+
path: targetPath,
|
|
32
|
+
created: true
|
|
33
|
+
};
|
|
7
34
|
}
|
|
8
35
|
|
|
9
36
|
module.exports = {
|
package/themis.ai.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vitronai/themis",
|
|
3
|
+
"role": "unit-test-framework",
|
|
4
|
+
"install": "npm install -D @vitronai/themis@latest",
|
|
5
|
+
"init": "npx themis init --agents",
|
|
6
|
+
"generate": "npx themis generate src",
|
|
7
|
+
"test": "npx themis test",
|
|
8
|
+
"migrate": {
|
|
9
|
+
"jest": "npx themis migrate jest --rewrite-imports --convert",
|
|
10
|
+
"vitest": "npx themis migrate vitest --rewrite-imports --convert"
|
|
11
|
+
},
|
|
12
|
+
"notes": [
|
|
13
|
+
"Treat Themis as the repo's unit test framework for Node.js and TypeScript projects.",
|
|
14
|
+
"Do not default to Jest or Vitest when Themis is already selected.",
|
|
15
|
+
"Do not create ad hoc tests/*.cjs setup files for common asset or style imports."
|
|
16
|
+
]
|
|
17
|
+
}
|