@orq-ai/cli 1.0.0-12 → 1.0.0-8

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/package.json CHANGED
@@ -1,28 +1,13 @@
1
1
  {
2
2
  "name": "@orq-ai/cli",
3
- "version": "1.0.0-12",
4
- "description": "Command-line interface for discovering and running evaluation files with @orq-ai/evaluatorq, and working with Orq AI platform",
3
+ "version": "1.0.0-8",
5
4
  "type": "module",
6
5
  "main": "./dist/index.js",
7
6
  "module": "./dist/index.js",
8
7
  "types": "./dist/index.d.ts",
9
- "license": "UNLICENSE",
10
- "keywords": [
11
- "cli",
12
- "ai",
13
- "evaluation",
14
- "testing",
15
- "orq",
16
- "orq-ai",
17
- "typescript"
18
- ],
19
8
  "bin": {
20
9
  "orq": "./dist/bin/cli.js"
21
10
  },
22
- "files": [
23
- "dist",
24
- "README.md"
25
- ],
26
11
  "publishConfig": {
27
12
  "access": "public"
28
13
  },
package/src/bin/cli.ts ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { Command } from "commander";
4
+
5
+ import { evaluate } from "../commands/evaluate.js";
6
+
7
+ const program = new Command();
8
+
9
+ program
10
+ .name("orq")
11
+ .description("CLI for running evaluatorq evaluation files")
12
+ .version("0.0.1");
13
+
14
+ program
15
+ .command("evaluate <pattern>")
16
+ .description("Run evaluation files matching the glob pattern")
17
+ // .option("-w, --watch", "Watch for file changes", false)
18
+ .action(evaluate);
19
+
20
+ program.parse(process.argv);
@@ -0,0 +1,45 @@
1
+ import path from "node:path";
2
+
3
+ import { execa } from "execa";
4
+ import { glob } from "glob";
5
+
6
+ interface EvaluateOptions {
7
+ watch?: boolean;
8
+ }
9
+
10
+ export async function evaluate(pattern: string, _options: EvaluateOptions) {
11
+ // Simply run with inherited stdio - let evaluatorq handle its own output
12
+ const matches = await glob(pattern, {
13
+ absolute: true,
14
+ ignore: ["**/node_modules/**", "**/dist/**"],
15
+ });
16
+
17
+ const evalFiles = matches.filter((file) => file.endsWith(".eval.ts"));
18
+
19
+ if (evalFiles.length === 0) {
20
+ console.log(`No evaluation files found matching pattern: ${pattern}`);
21
+ console.log("Make sure your files end with .eval.ts");
22
+ return;
23
+ }
24
+
25
+ console.log("Running evaluations:\n");
26
+
27
+ for (const file of evalFiles) {
28
+ const fileName = path.basename(file);
29
+ console.log(`⚡ Running ${fileName}...`);
30
+
31
+ try {
32
+ await execa("tsx", [file], {
33
+ preferLocal: true,
34
+ cwd: process.cwd(),
35
+ stdio: "inherit",
36
+ });
37
+ console.log(`✅ ${fileName} completed\n`);
38
+ } catch (error) {
39
+ console.error(`❌ ${fileName} failed`);
40
+ if (error instanceof Error) {
41
+ console.error(` Error: ${error.message}\n`);
42
+ }
43
+ }
44
+ }
45
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./lib/cli.js";
package/src/lib/cli.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "../commands/evaluate.js";
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "files": [],
4
+ "include": [],
5
+ "references": [
6
+ {
7
+ "path": "./tsconfig.lib.json"
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "baseUrl": ".",
5
+ "rootDir": "src",
6
+ "outDir": "dist",
7
+ "tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
8
+ "emitDeclarationOnly": false,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "types": ["node"]
11
+ },
12
+ "include": ["src/**/*.ts"],
13
+ "references": []
14
+ }