@sanity/ailf 0.1.0 → 0.1.1

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 (125) hide show
  1. package/dist/_vendor/ailf-core/examples/index.d.ts +6 -4
  2. package/dist/_vendor/ailf-core/examples/index.js +9 -4
  3. package/dist/_vendor/ailf-core/ports/context.d.ts +4 -0
  4. package/dist/adapters/task-sources/repo-schemas.d.ts +12 -2
  5. package/dist/adapters/task-sources/repo-schemas.js +28 -2
  6. package/dist/cli.js +0 -0
  7. package/dist/commands/init.js +39 -5
  8. package/dist/commands/pipeline-action.js +44 -6
  9. package/dist/commands/publish.js +2 -1
  10. package/dist/commands/validate-tasks.js +4 -1
  11. package/dist/composition-root.js +9 -5
  12. package/dist/orchestration/build-app-context.js +2 -0
  13. package/package.json +1 -1
  14. package/dist/commands/update-quality-scores.d.ts +0 -5
  15. package/dist/commands/update-quality-scores.js +0 -20
  16. package/dist/lib/agent-behavior-report.d.ts +0 -8
  17. package/dist/lib/agent-behavior-report.js +0 -185
  18. package/dist/lib/baseline.d.ts +0 -19
  19. package/dist/lib/baseline.js +0 -153
  20. package/dist/lib/calculate-scores.d.ts +0 -23
  21. package/dist/lib/calculate-scores.js +0 -42
  22. package/dist/lib/compare.d.ts +0 -18
  23. package/dist/lib/compare.js +0 -170
  24. package/dist/lib/coverage-audit.d.ts +0 -4
  25. package/dist/lib/coverage-audit.js +0 -42
  26. package/dist/lib/discovery-report.d.ts +0 -13
  27. package/dist/lib/discovery-report.js +0 -57
  28. package/dist/lib/fetch-docs.d.ts +0 -30
  29. package/dist/lib/fetch-docs.js +0 -171
  30. package/dist/lib/generate-configs.d.ts +0 -25
  31. package/dist/lib/generate-configs.js +0 -42
  32. package/dist/lib/grader-api.d.ts +0 -21
  33. package/dist/lib/grader-api.js +0 -34
  34. package/dist/lib/grader-compare.d.ts +0 -19
  35. package/dist/lib/grader-compare.js +0 -91
  36. package/dist/lib/grader-consistency.d.ts +0 -27
  37. package/dist/lib/grader-consistency.js +0 -79
  38. package/dist/lib/grader-sensitivity.d.ts +0 -19
  39. package/dist/lib/grader-sensitivity.js +0 -75
  40. package/dist/lib/grader-validate.d.ts +0 -19
  41. package/dist/lib/grader-validate.js +0 -78
  42. package/dist/lib/measure-retrieval.d.ts +0 -14
  43. package/dist/lib/measure-retrieval.js +0 -71
  44. package/dist/lib/pr-comment.d.ts +0 -16
  45. package/dist/lib/pr-comment.js +0 -28
  46. package/dist/lib/readiness-report.d.ts +0 -13
  47. package/dist/lib/readiness-report.js +0 -108
  48. package/dist/lib/webhook-server.d.ts +0 -11
  49. package/dist/lib/webhook-server.js +0 -24
  50. package/dist/lib/weekly-digest.d.ts +0 -24
  51. package/dist/lib/weekly-digest.js +0 -148
  52. package/dist/orchestration/env-bridge.d.ts +0 -21
  53. package/dist/orchestration/env-bridge.js +0 -66
  54. package/dist/orchestration/steps/fetch-docs-shell.d.ts +0 -17
  55. package/dist/orchestration/steps/fetch-docs-shell.js +0 -30
  56. package/dist/pipeline/steps/calculate-scores-step.d.ts +0 -11
  57. package/dist/pipeline/steps/calculate-scores-step.js +0 -89
  58. package/dist/pipeline/steps/compare-step.d.ts +0 -18
  59. package/dist/pipeline/steps/compare-step.js +0 -90
  60. package/dist/pipeline/steps/eval-step.d.ts +0 -53
  61. package/dist/pipeline/steps/eval-step.js +0 -347
  62. package/dist/pipeline/steps/fetch-docs-step.d.ts +0 -11
  63. package/dist/pipeline/steps/fetch-docs-step.js +0 -84
  64. package/dist/pipeline/steps/generate-configs-step.d.ts +0 -11
  65. package/dist/pipeline/steps/generate-configs-step.js +0 -98
  66. package/dist/pipeline/steps/grader-consistency-step.d.ts +0 -21
  67. package/dist/pipeline/steps/grader-consistency-step.js +0 -74
  68. package/dist/pipeline/steps/publish-report-step.d.ts +0 -57
  69. package/dist/pipeline/steps/publish-report-step.js +0 -243
  70. package/dist/pipeline/steps/report-step.d.ts +0 -13
  71. package/dist/pipeline/steps/report-step.js +0 -56
  72. package/dist/pipeline/steps/update-scores-step.d.ts +0 -11
  73. package/dist/pipeline/steps/update-scores-step.js +0 -42
  74. package/dist/scripts/agent-behavior-report.d.ts +0 -19
  75. package/dist/scripts/agent-behavior-report.js +0 -315
  76. package/dist/scripts/baseline.d.ts +0 -43
  77. package/dist/scripts/baseline.js +0 -267
  78. package/dist/scripts/calculate-scores.d.ts +0 -166
  79. package/dist/scripts/calculate-scores.js +0 -1296
  80. package/dist/scripts/compare.d.ts +0 -22
  81. package/dist/scripts/compare.js +0 -334
  82. package/dist/scripts/coverage-audit.d.ts +0 -44
  83. package/dist/scripts/coverage-audit.js +0 -209
  84. package/dist/scripts/debug-eval.d.ts +0 -19
  85. package/dist/scripts/debug-eval.js +0 -73
  86. package/dist/scripts/discovery-report.d.ts +0 -58
  87. package/dist/scripts/discovery-report.js +0 -250
  88. package/dist/scripts/fetch-docs.d.ts +0 -35
  89. package/dist/scripts/fetch-docs.js +0 -472
  90. package/dist/scripts/generate-configs.d.ts +0 -66
  91. package/dist/scripts/generate-configs.js +0 -459
  92. package/dist/scripts/grader-api.d.ts +0 -27
  93. package/dist/scripts/grader-api.js +0 -206
  94. package/dist/scripts/grader-compare.d.ts +0 -22
  95. package/dist/scripts/grader-compare.js +0 -368
  96. package/dist/scripts/grader-consistency.d.ts +0 -20
  97. package/dist/scripts/grader-consistency.js +0 -313
  98. package/dist/scripts/grader-sensitivity.d.ts +0 -22
  99. package/dist/scripts/grader-sensitivity.js +0 -354
  100. package/dist/scripts/grader-validate.d.ts +0 -19
  101. package/dist/scripts/grader-validate.js +0 -267
  102. package/dist/scripts/measure-retrieval.d.ts +0 -10
  103. package/dist/scripts/measure-retrieval.js +0 -145
  104. package/dist/scripts/pipeline.d.ts +0 -76
  105. package/dist/scripts/pipeline.js +0 -1031
  106. package/dist/scripts/pr-comment.d.ts +0 -10
  107. package/dist/scripts/pr-comment.js +0 -510
  108. package/dist/scripts/readiness-report.d.ts +0 -88
  109. package/dist/scripts/readiness-report.js +0 -342
  110. package/dist/scripts/update-quality-scores.d.ts +0 -15
  111. package/dist/scripts/update-quality-scores.js +0 -184
  112. package/dist/scripts/validate.d.ts +0 -13
  113. package/dist/scripts/validate.js +0 -79
  114. package/dist/scripts/webhook-server.d.ts +0 -26
  115. package/dist/scripts/webhook-server.js +0 -147
  116. package/dist/scripts/weekly-digest.d.ts +0 -24
  117. package/dist/scripts/weekly-digest.js +0 -144
  118. package/dist/sinks/format-slack.d.ts +0 -64
  119. package/dist/sinks/format-slack.js +0 -306
  120. package/dist/sinks/slack-sink.d.ts +0 -27
  121. package/dist/sinks/slack-sink.js +0 -78
  122. package/dist/sinks/webhook-sink.d.ts +0 -19
  123. package/dist/sinks/webhook-sink.js +0 -50
  124. package/tasks/.expanded.agentic.yaml +0 -51
  125. package/tasks/.expanded.yaml +0 -66
@@ -1,57 +0,0 @@
1
- /**
2
- * Pipeline step: Publish evaluation report to the report store.
3
- *
4
- * This step wraps ScoreSummary + provenance into a Report, writes it to
5
- * the Sanity Content Lake (system of record), optionally auto-compares
6
- * against the most recent comparable baseline, and fans out to configured
7
- * sinks (BigQuery, Slack, webhooks, etc.).
8
- *
9
- * Opt-in via `--publish` flag or `AILF_PUBLISH=1` environment variable.
10
- * Without this flag, the pipeline writes results locally only (unchanged
11
- * from current behavior).
12
- *
13
- * Design principles:
14
- * - P1: Reports are immutable events (write-once to Sanity)
15
- * - P5: Local-first (pipeline never fails because of a store write)
16
- * - P6: Sinks are fire-and-forget (failures logged, not thrown)
17
- *
18
- * Preconditions: score-summary.json exists and is valid
19
- * Postconditions: Report written to Sanity (best-effort), sinks notified
20
- *
21
- * @see docs/design-docs/report-store/architecture.md
22
- * @see docs/design-docs/report-store/sink-architecture.md
23
- */
24
- import { type ProvenanceInput } from "../provenance.js";
25
- import type { PromptfooUrlEntry, StepResult } from "../types.js";
26
- export interface PublishOptions {
27
- /** Whether this is a debug run (debug runs don't store fingerprints) */
28
- debug?: boolean;
29
- /** Evaluation fingerprint override (computed externally by the pipeline) */
30
- evalFingerprint?: string;
31
- /** @deprecated Use `promptfooUrls` — kept for backward compatibility */
32
- promptfooUrl?: string;
33
- /** Per-mode Promptfoo share URLs */
34
- promptfooUrls?: PromptfooUrlEntry[];
35
- /** Override provenance input (for testing or custom workflows) */
36
- provenanceInput?: Partial<ProvenanceInput>;
37
- /** Sanity dataset for report storage (independent of eval dataset) */
38
- reportDataset?: string;
39
- /** Sanity project ID for report storage (independent of eval project) */
40
- reportProjectId?: string;
41
- /** Sanity API token for writes */
42
- sanityToken?: string;
43
- /** Optional human-supplied tag */
44
- tag?: string;
45
- }
46
- /**
47
- * Run the publish-report pipeline step.
48
- *
49
- * 1. Read score-summary.json
50
- * 2. Build provenance from pipeline context
51
- * 3. Create Report with generated UUID v7 ID
52
- * 4. Auto-compare against most recent comparable baseline
53
- * 5. Write to Sanity Content Lake (system of record)
54
- * 6. Fan out to configured sinks (fire-and-forget)
55
- * 7. Return step result with report ID and sink outcomes
56
- */
57
- export declare function runPublishReport(pipelineStart: number, options?: PublishOptions): Promise<StepResult>;
@@ -1,243 +0,0 @@
1
- /**
2
- * Pipeline step: Publish evaluation report to the report store.
3
- *
4
- * This step wraps ScoreSummary + provenance into a Report, writes it to
5
- * the Sanity Content Lake (system of record), optionally auto-compares
6
- * against the most recent comparable baseline, and fans out to configured
7
- * sinks (BigQuery, Slack, webhooks, etc.).
8
- *
9
- * Opt-in via `--publish` flag or `AILF_PUBLISH=1` environment variable.
10
- * Without this flag, the pipeline writes results locally only (unchanged
11
- * from current behavior).
12
- *
13
- * Design principles:
14
- * - P1: Reports are immutable events (write-once to Sanity)
15
- * - P5: Local-first (pipeline never fails because of a store write)
16
- * - P6: Sinks are fire-and-forget (failures logged, not thrown)
17
- *
18
- * Preconditions: score-summary.json exists and is valid
19
- * Postconditions: Report written to Sanity (best-effort), sinks notified
20
- *
21
- * @see docs/design-docs/report-store/architecture.md
22
- * @see docs/design-docs/report-store/sink-architecture.md
23
- */
24
- import { readFileSync } from "fs";
25
- import { dirname, resolve } from "path";
26
- import { fileURLToPath } from "url";
27
- import { checkScoreSummaryValid } from "../checks.js";
28
- import { buildProvenance } from "../provenance.js";
29
- import { generateReportId, ReportStore } from "../../report-store.js";
30
- import { loadSinks } from "../../sinks/index.js";
31
- import { withRetry } from "../../sinks/retry.js";
32
- const __dirname = dirname(fileURLToPath(import.meta.url));
33
- const ROOT = resolve(__dirname, "..", "..", "..");
34
- /**
35
- * Run the publish-report pipeline step.
36
- *
37
- * 1. Read score-summary.json
38
- * 2. Build provenance from pipeline context
39
- * 3. Create Report with generated UUID v7 ID
40
- * 4. Auto-compare against most recent comparable baseline
41
- * 5. Write to Sanity Content Lake (system of record)
42
- * 6. Fan out to configured sinks (fire-and-forget)
43
- * 7. Return step result with report ID and sink outcomes
44
- */
45
- export async function runPublishReport(pipelineStart, options = {}) {
46
- const start = Date.now();
47
- // Precondition: score summary exists
48
- const summaryIssues = checkScoreSummaryValid(ROOT);
49
- const summaryErrors = summaryIssues.filter((i) => i.severity === "error");
50
- if (summaryErrors.length > 0) {
51
- return {
52
- durationMs: Date.now() - start,
53
- error: `Score summary missing: ${summaryErrors.map((e) => e.message).join("; ")}`,
54
- status: "failed",
55
- };
56
- }
57
- // Read score summary
58
- let summary;
59
- try {
60
- const summaryPath = resolve(ROOT, "results", "latest", "score-summary.json");
61
- summary = JSON.parse(readFileSync(summaryPath, "utf-8"));
62
- }
63
- catch (err) {
64
- return {
65
- durationMs: Date.now() - start,
66
- error: `Failed to read score-summary.json: ${err instanceof Error ? err.message : String(err)}`,
67
- status: "failed",
68
- };
69
- }
70
- // Build provenance
71
- const provenanceInput = buildProvenanceInput(summary, options);
72
- const provenance = buildProvenance(provenanceInput);
73
- // Create report
74
- const now = new Date().toISOString();
75
- const reportId = generateReportId();
76
- const durationMs = Date.now() - pipelineStart;
77
- // Initialize report store — uses AILF_REPORT_* env vars, independent of
78
- // SANITY_DATASET/SANITY_PROJECT_ID which control doc evaluation.
79
- const token = options.sanityToken ??
80
- process.env.AILF_REPORT_SANITY_API_TOKEN ??
81
- process.env.SANITY_API_TOKEN;
82
- const dataset = options.reportDataset ?? process.env.AILF_REPORT_DATASET ?? undefined;
83
- const projectId = options.reportProjectId ?? process.env.AILF_REPORT_PROJECT_ID ?? undefined;
84
- const store = new ReportStore({ dataset, projectId, token });
85
- // Auto-compare against most recent comparable baseline
86
- const comparison = await store.autoCompare(summary, provenance, now);
87
- const report = {
88
- comparison: comparison ?? undefined,
89
- completedAt: now,
90
- durationMs,
91
- id: reportId,
92
- provenance,
93
- summary,
94
- tag: options.tag,
95
- };
96
- // Write to Sanity (system of record — best-effort, P5)
97
- const sanityResult = await store.write(report);
98
- // Load and run sinks (fire-and-forget, P6)
99
- const publishResult = await runSinks(report);
100
- // Build result summary
101
- const parts = [];
102
- if (sanityResult) {
103
- parts.push(`report:${sanityResult}`);
104
- }
105
- else {
106
- parts.push("Sanity write skipped (no token or unreachable)");
107
- }
108
- if (comparison) {
109
- const delta = comparison.deltas.overall;
110
- const sign = delta >= 0 ? "+" : "";
111
- parts.push(`vs baseline: ${sign}${delta.toFixed(1)}`);
112
- }
113
- if (publishResult.sinkResults.length > 0) {
114
- const succeeded = publishResult.sinkResults.filter((r) => r.result.status === "success").length;
115
- const total = publishResult.sinkResults.length;
116
- parts.push(`sinks: ${succeeded}/${total}`);
117
- }
118
- return {
119
- durationMs: Date.now() - start,
120
- status: "success",
121
- summary: `Published — ${parts.join(", ")}`,
122
- };
123
- }
124
- // ---------------------------------------------------------------------------
125
- // Sink runner
126
- // ---------------------------------------------------------------------------
127
- /**
128
- * Assemble provenance input from the score summary and pipeline context.
129
- */
130
- function buildProvenanceInput(summary, options) {
131
- const areas = summary.scores.map((s) => s.feature);
132
- const mode = (process.env.EVAL_MODE ?? "baseline");
133
- // Read document IDs from env (set by pipeline.ts from --sanity-document flags)
134
- const docIds = process.env.SANITY_DOCUMENT_IDS;
135
- const sanityDocumentIds = docIds
136
- ? docIds
137
- .split(",")
138
- .map((id) => id.trim())
139
- .filter(Boolean)
140
- : undefined;
141
- // Read task filter from env
142
- const taskFilter = process.env.EVAL_FILTER_TASKS;
143
- const taskIds = taskFilter
144
- ? taskFilter
145
- .split(",")
146
- .map((t) => t.trim())
147
- .filter(Boolean)
148
- : undefined;
149
- // Build source from summary metadata or env
150
- const source = {
151
- baseUrl: summary.source?.baseUrl ?? "https://www.sanity.io/docs",
152
- dataset: summary.source?.dataset ?? process.env.SANITY_DATASET ?? "next",
153
- documentIds: [],
154
- llmsTxt: (summary.source?.baseUrl ?? "https://www.sanity.io/docs") + "/llms.txt",
155
- name: summary.source?.name ?? "production",
156
- perspective: summary.source?.perspective ??
157
- process.env.SANITY_PERSPECTIVE ??
158
- undefined,
159
- priorityDomain: "sanity.io",
160
- projectId: summary.source?.projectId ?? process.env.SANITY_PROJECT_ID ?? "3do82whm",
161
- studioOrigin: "https://admin.sanity.io",
162
- urls: [],
163
- };
164
- // Pass through eval fingerprint for cross-environment cache lookup.
165
- // Debug runs don't store fingerprints (they evaluate a subset of tests
166
- // and would produce misleading cache hits for full runs).
167
- const evalFingerprint = !options.debug ? options.evalFingerprint : undefined;
168
- return {
169
- areas,
170
- evalFingerprint,
171
- mode,
172
- promptfooUrl: options.promptfooUrl,
173
- promptfooUrls: options.promptfooUrls,
174
- rootDir: ROOT,
175
- sanityDocumentIds,
176
- source,
177
- taskIds,
178
- ...options.provenanceInput,
179
- };
180
- }
181
- // ---------------------------------------------------------------------------
182
- // Provenance input builder
183
- // ---------------------------------------------------------------------------
184
- /**
185
- * Fan out a report to all configured sinks.
186
- *
187
- * Sinks are loaded from config/sinks.yaml. Each sink is run with retry
188
- * logic (3 attempts, exponential backoff). Failures are logged but never
189
- * block the pipeline.
190
- */
191
- async function runSinks(report) {
192
- const sinks = loadSinks();
193
- const sinkResults = [];
194
- if (sinks.length === 0) {
195
- return { report, sinkResults };
196
- }
197
- // Health check all sinks first (non-blocking)
198
- for (const sink of sinks) {
199
- if (sink.healthCheck) {
200
- try {
201
- const health = await sink.healthCheck();
202
- if (!health.healthy) {
203
- console.warn(` ⚠️ Sink ${sink.name} health check failed: ${health.reason}`);
204
- }
205
- }
206
- catch (err) {
207
- console.warn(` ⚠️ Sink ${sink.name} health check error: ${err instanceof Error ? err.message : String(err)}`);
208
- }
209
- }
210
- }
211
- // Publish to all sinks in parallel (fire-and-forget with retries)
212
- const settled = await Promise.allSettled(sinks.map(async (sink) => {
213
- const result = await withRetry(() => sink.publish(report));
214
- return { name: sink.name, result };
215
- }));
216
- for (const outcome of settled) {
217
- if (outcome.status === "fulfilled") {
218
- sinkResults.push(outcome.value);
219
- const { name, result } = outcome.value;
220
- if (result.status === "failed") {
221
- console.warn(` ⚠️ Sink ${name} failed: ${result.error}`);
222
- }
223
- else if (result.status === "skipped") {
224
- console.log(` ⏭️ Sink ${name} skipped: ${result.reason}`);
225
- }
226
- else {
227
- console.log(` ✅ Sink ${name} delivered${result.detail ? ` (${result.detail})` : ""}`);
228
- }
229
- }
230
- else {
231
- // Promise.allSettled rejection — shouldn't happen with withRetry, but just in case
232
- const error = outcome.reason instanceof Error
233
- ? outcome.reason.message
234
- : String(outcome.reason);
235
- sinkResults.push({
236
- name: "unknown",
237
- result: { error, status: "failed" },
238
- });
239
- console.warn(` ⚠️ Sink delivery error: ${error}`);
240
- }
241
- }
242
- return { report, sinkResults };
243
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Pipeline step: Generate PR comment / report from scores.
3
- *
4
- * Preconditions: score-summary.json exists
5
- * Postconditions: report markdown generated
6
- *
7
- * Cache key: results/latest/score-summary.json
8
- * Note: Report is always regenerated (not cached) since it may include
9
- * dynamic data like Promptfoo URLs. The cache infrastructure is wired up
10
- * for consistency but reports are cheap to generate.
11
- */
12
- import type { StepResult } from "../types.js";
13
- export declare function runReport(outputPath?: string, promptfooUrl?: string): StepResult;
@@ -1,56 +0,0 @@
1
- /**
2
- * Pipeline step: Generate PR comment / report from scores.
3
- *
4
- * Preconditions: score-summary.json exists
5
- * Postconditions: report markdown generated
6
- *
7
- * Cache key: results/latest/score-summary.json
8
- * Note: Report is always regenerated (not cached) since it may include
9
- * dynamic data like Promptfoo URLs. The cache infrastructure is wired up
10
- * for consistency but reports are cheap to generate.
11
- */
12
- import { execSync } from "child_process";
13
- import { dirname, resolve } from "path";
14
- import { fileURLToPath } from "url";
15
- import { checkScoreSummaryValid } from "../checks.js";
16
- const __dirname = dirname(fileURLToPath(import.meta.url));
17
- const ROOT = resolve(__dirname, "..", "..", "..");
18
- const DEFAULT_REPORT_PATH = resolve(ROOT, "results/latest/pr-comment.md");
19
- export function runReport(outputPath, promptfooUrl) {
20
- const start = Date.now();
21
- // Precondition: score summary exists
22
- const summaryIssues = checkScoreSummaryValid(ROOT);
23
- const summaryErrors = summaryIssues.filter((i) => i.severity === "error");
24
- if (summaryErrors.length > 0) {
25
- return {
26
- durationMs: Date.now() - start,
27
- error: `Score summary missing: ${summaryErrors.map((e) => e.message).join("; ")}`,
28
- status: "failed",
29
- };
30
- }
31
- // Always write to a file — use the caller's path or a default.
32
- // This avoids dumping the full PR-comment markdown into the terminal.
33
- const resolvedOutput = outputPath ?? DEFAULT_REPORT_PATH;
34
- // Execute — reports are always regenerated (cheap, may include dynamic URLs)
35
- try {
36
- const outputArg = ` --output ${resolvedOutput}`;
37
- const urlArg = promptfooUrl ? ` --promptfoo-url ${promptfooUrl}` : "";
38
- execSync(`pnpm pr-comment${outputArg}${urlArg}`, {
39
- cwd: ROOT,
40
- env: process.env,
41
- stdio: ["inherit", "ignore", "inherit"],
42
- });
43
- }
44
- catch (err) {
45
- return {
46
- durationMs: Date.now() - start,
47
- error: `pr-comment failed: ${err instanceof Error ? err.message : String(err)}`,
48
- status: "failed",
49
- };
50
- }
51
- return {
52
- durationMs: Date.now() - start,
53
- status: "success",
54
- summary: `Report written to ${resolvedOutput}`,
55
- };
56
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Pipeline step: Update QUALITY_SCORE.md from score summary.
3
- *
4
- * Preconditions: score-summary.json exists and is valid
5
- * Postconditions: QUALITY_SCORE.md is updated with latest scores
6
- *
7
- * Note: Not cached — writing to a git-tracked file is intentionally
8
- * always re-executed to ensure the file reflects the latest scores.
9
- */
10
- import type { StepResult } from "../types.js";
11
- export declare function runUpdateQualityScores(): Promise<StepResult>;
@@ -1,42 +0,0 @@
1
- /**
2
- * Pipeline step: Update QUALITY_SCORE.md from score summary.
3
- *
4
- * Preconditions: score-summary.json exists and is valid
5
- * Postconditions: QUALITY_SCORE.md is updated with latest scores
6
- *
7
- * Note: Not cached — writing to a git-tracked file is intentionally
8
- * always re-executed to ensure the file reflects the latest scores.
9
- */
10
- import { dirname, resolve } from "path";
11
- import { fileURLToPath } from "url";
12
- import { checkScoreSummaryValid } from "../checks.js";
13
- const __dirname = dirname(fileURLToPath(import.meta.url));
14
- const ROOT = resolve(__dirname, "..", "..", "..");
15
- export async function runUpdateQualityScores() {
16
- const start = Date.now();
17
- // Precondition: score summary exists and is valid
18
- const summaryIssues = checkScoreSummaryValid(ROOT);
19
- const summaryErrors = summaryIssues.filter((i) => i.severity === "error");
20
- if (summaryErrors.length > 0) {
21
- return {
22
- durationMs: Date.now() - start,
23
- error: `Score summary missing or invalid: ${summaryErrors.map((e) => e.message).join("; ")}`,
24
- status: "failed",
25
- };
26
- }
27
- // Dynamic import to avoid loading file-writing code at module parse time
28
- const { updateQualityScores } = await import("../../scripts/update-quality-scores.js");
29
- const result = updateQualityScores();
30
- if (!result.success) {
31
- return {
32
- durationMs: Date.now() - start,
33
- error: result.message,
34
- status: "failed",
35
- };
36
- }
37
- return {
38
- durationMs: Date.now() - start,
39
- status: "success",
40
- summary: result.message,
41
- };
42
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * agent-behavior-report.ts
3
- *
4
- * Standalone script that reads Promptfoo evaluation results containing
5
- * agent behavior observation data and generates a detailed report.
6
- *
7
- * This provides deeper analysis than the summary included in the main
8
- * calculate-scores report, including:
9
- *
10
- * - Per-task behavior breakdown (which specific pages each task visited)
11
- * - Canonical doc coverage (did the agent find the "right" docs?)
12
- * - Request timeline and latency analysis
13
- * - Search strategy analysis
14
- * - Cross-task navigation pattern detection
15
- *
16
- * Usage:
17
- * tsx src/scripts/agent-behavior-report.ts [results-path]
18
- */
19
- import "dotenv/config";