tuneprompt 1.0.0

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.
Files changed (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +151 -0
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +146 -0
  5. package/dist/commands/activate.d.ts +1 -0
  6. package/dist/commands/activate.js +91 -0
  7. package/dist/commands/fix.d.ts +1 -0
  8. package/dist/commands/fix.js +187 -0
  9. package/dist/commands/history.d.ts +5 -0
  10. package/dist/commands/history.js +63 -0
  11. package/dist/commands/init.d.ts +1 -0
  12. package/dist/commands/init.js +96 -0
  13. package/dist/commands/run.d.ts +9 -0
  14. package/dist/commands/run.js +216 -0
  15. package/dist/db/migrate.d.ts +2 -0
  16. package/dist/db/migrate.js +8 -0
  17. package/dist/engine/constraintExtractor.d.ts +8 -0
  18. package/dist/engine/constraintExtractor.js +54 -0
  19. package/dist/engine/loader.d.ts +5 -0
  20. package/dist/engine/loader.js +74 -0
  21. package/dist/engine/metaPrompt.d.ts +11 -0
  22. package/dist/engine/metaPrompt.js +129 -0
  23. package/dist/engine/optimizer.d.ts +26 -0
  24. package/dist/engine/optimizer.js +246 -0
  25. package/dist/engine/reporter.d.ts +7 -0
  26. package/dist/engine/reporter.js +58 -0
  27. package/dist/engine/runner.d.ts +9 -0
  28. package/dist/engine/runner.js +169 -0
  29. package/dist/engine/shadowTester.d.ts +11 -0
  30. package/dist/engine/shadowTester.js +156 -0
  31. package/dist/index.d.ts +7 -0
  32. package/dist/index.js +26 -0
  33. package/dist/providers/anthropic.d.ts +12 -0
  34. package/dist/providers/anthropic.js +51 -0
  35. package/dist/providers/base.d.ts +15 -0
  36. package/dist/providers/base.js +10 -0
  37. package/dist/providers/openai.d.ts +12 -0
  38. package/dist/providers/openai.js +58 -0
  39. package/dist/providers/openrouter.d.ts +11 -0
  40. package/dist/providers/openrouter.js +83 -0
  41. package/dist/scoring/exact-match.d.ts +1 -0
  42. package/dist/scoring/exact-match.js +8 -0
  43. package/dist/scoring/json-validator.d.ts +4 -0
  44. package/dist/scoring/json-validator.js +29 -0
  45. package/dist/scoring/semantic.d.ts +8 -0
  46. package/dist/scoring/semantic.js +107 -0
  47. package/dist/services/cloud.service.d.ts +49 -0
  48. package/dist/services/cloud.service.js +82 -0
  49. package/dist/storage/database.d.ts +10 -0
  50. package/dist/storage/database.js +179 -0
  51. package/dist/types/fix.d.ts +28 -0
  52. package/dist/types/fix.js +2 -0
  53. package/dist/types/index.d.ts +58 -0
  54. package/dist/types/index.js +2 -0
  55. package/dist/utils/analytics.d.ts +2 -0
  56. package/dist/utils/analytics.js +22 -0
  57. package/dist/utils/config.d.ts +3 -0
  58. package/dist/utils/config.js +70 -0
  59. package/dist/utils/errorHandler.d.ts +14 -0
  60. package/dist/utils/errorHandler.js +40 -0
  61. package/dist/utils/license.d.ts +40 -0
  62. package/dist/utils/license.js +207 -0
  63. package/dist/utils/storage.d.ts +2 -0
  64. package/dist/utils/storage.js +25 -0
  65. package/package.json +76 -0
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFailedTests = getFailedTests;
4
+ const database_1 = require("../storage/database");
5
+ async function getFailedTests() {
6
+ const db = new database_1.TestDatabase();
7
+ const recentRuns = db.getRecentRuns(1);
8
+ if (recentRuns.length === 0) {
9
+ return [];
10
+ }
11
+ const latestRun = recentRuns[0];
12
+ const failures = latestRun.results.filter(r => r.status === 'fail' || r.status === 'error');
13
+ return failures.map(r => ({
14
+ id: r.testCase.filePath || r.id, // Prefer filePath for targeting the correct file
15
+ description: r.testCase.description,
16
+ prompt: !r.testCase.prompt ? '' : (typeof r.testCase.prompt === 'string' ? r.testCase.prompt : r.testCase.prompt.user),
17
+ input: r.testCase.variables,
18
+ expectedOutput: typeof r.testCase.expect === 'string' ? r.testCase.expect : JSON.stringify(r.testCase.expect),
19
+ actualOutput: r.actualOutput,
20
+ score: r.score,
21
+ threshold: r.testCase.config?.threshold || 0.8,
22
+ errorType: r.testCase.config?.method || 'semantic',
23
+ errorMessage: r.error || ''
24
+ }));
25
+ }
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "tuneprompt",
3
+ "version": "1.0.0",
4
+ "description": "Industrial-grade testing framework for LLM prompts",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "tuneprompt": "./dist/cli.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "dev": "ts-node src/cli.ts",
18
+ "test": "jest",
19
+ "prepublishOnly": "npm run build"
20
+ },
21
+ "keywords": [
22
+ "llm",
23
+ "testing",
24
+ "prompts",
25
+ "ai",
26
+ "openai",
27
+ "anthropic",
28
+ "claude",
29
+ "gpt",
30
+ "prompt-engineering",
31
+ "ci-cd"
32
+ ],
33
+ "author": "CodeForgeNet",
34
+ "license": "MIT",
35
+ "type": "commonjs",
36
+ "devDependencies": {
37
+ "@types/better-sqlite3": "^7.6.13",
38
+ "@types/diff": "^7.0.2",
39
+ "@types/inquirer": "^9.0.9",
40
+ "@types/jest": "^30.0.0",
41
+ "@types/js-yaml": "^4.0.9",
42
+ "@types/lodash": "^4.17.21",
43
+ "@types/node": "^25.0.6",
44
+ "@types/uuid": "^10.0.0",
45
+ "jest": "^30.2.0",
46
+ "nodemon": "^3.1.11",
47
+ "ts-jest": "^29.4.6",
48
+ "ts-node": "^10.9.2",
49
+ "typescript": "^5.9.3"
50
+ },
51
+ "dependencies": {
52
+ "@anthropic-ai/sdk": "^0.71.2",
53
+ "@types/chokidar": "^1.7.5",
54
+ "axios": "^1.13.2",
55
+ "better-sqlite3": "^12.5.0",
56
+ "chalk": "^5.6.2",
57
+ "chalk-template": "^1.1.2",
58
+ "chokidar": "^5.0.0",
59
+ "cli-diff": "^1.0.0",
60
+ "cli-table3": "^0.6.5",
61
+ "commander": "^14.0.2",
62
+ "cosmiconfig": "^9.0.0",
63
+ "date-fns": "^4.1.0",
64
+ "diff": "^8.0.2",
65
+ "dotenv": "^17.2.3",
66
+ "inquirer": "^13.1.0",
67
+ "js-yaml": "^4.1.1",
68
+ "lodash": "^4.17.21",
69
+ "openai": "^6.16.0",
70
+ "ora": "^9.0.0",
71
+ "posthog-node": "^5.20.0",
72
+ "sqlite": "^5.1.1",
73
+ "sqlite3": "^5.1.7",
74
+ "uuid": "^13.0.0"
75
+ }
76
+ }