@sanity/ailf 4.4.0 → 4.5.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.
@@ -265,7 +265,13 @@ export function computeResolvedOptions(opts) {
265
265
  const apiUrl = process.env.AILF_API_URL ??
266
266
  repoConfig?.execution?.apiUrl ??
267
267
  "https://ailf-api.sanity.build";
268
- const apiKey = process.env.AILF_API_KEY ?? undefined;
268
+ // W0202 `--api-key` flag wins over the env var. The CLI's dotenv
269
+ // bootstrap (`cli.ts`) loads the project `.env` with `override: true`,
270
+ // matching the repo convention that the file is the source of truth
271
+ // (see `.claude/rules/config.md`). That convention silently squashes
272
+ // shell-set `AILF_API_KEY`, so an explicit per-run flag is the only
273
+ // ergonomic way to pick a non-default key for one invocation.
274
+ const apiKey = opts.apiKey ?? process.env.AILF_API_KEY ?? undefined;
269
275
  // Output directory (W0077 Phase 6c) — `output.dir` from .ailf/config.yaml
270
276
  // when set, otherwise <cwd>/.ailf/results/latest/.
271
277
  const outputDir = resolveOutputDir(repoConfig?.output?.dir);
@@ -60,5 +60,6 @@ export interface PipelineCliOptions {
60
60
  classification?: string;
61
61
  purpose?: string;
62
62
  label: string[];
63
+ apiKey?: string;
63
64
  }
64
65
  export declare function createRunCommand(): Command;
@@ -47,6 +47,7 @@ export function createRunCommand() {
47
47
  .option("-o, --output <path>", "Write PR comment markdown to file")
48
48
  .option("--promptfoo-url <url>", "Promptfoo share URL for report")
49
49
  .option("--remote", "Submit evaluation to the AILF API instead of running locally", false)
50
+ .option("--api-key <value>", "API key for --remote dispatch. Wins over AILF_API_KEY and any value loaded from the project .env file (W0202).")
50
51
  .option("--no-artifacts-write", "Run artifact writers in dry-run mode — log intended writes, touch no storage")
51
52
  // D0037 caller envelope (W0069) — threads through --remote so the
52
53
  // server-side pipeline attributes provenance to the caller, not the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ailf",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -55,8 +55,8 @@
55
55
  "tsx": "^4.19.2",
56
56
  "typescript": "^5.7.3",
57
57
  "vitest": "^4.1.5",
58
- "@sanity/ailf-core": "0.1.0",
59
- "@sanity/ailf-shared": "0.1.0"
58
+ "@sanity/ailf-shared": "0.1.0",
59
+ "@sanity/ailf-core": "0.1.0"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "tsc && tsx scripts/bundle-workspace-deps.ts",