@sanity/ailf 0.1.10 → 0.1.12

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.
@@ -92,7 +92,7 @@ export interface ResolvedConfig {
92
92
  /** Before option for comparison */
93
93
  beforeOption?: string;
94
94
  /** Task source adapter selection */
95
- taskSourceType?: "content-lake" | "yaml";
95
+ taskSourceType?: "content-lake" | "repo" | "yaml";
96
96
  /** Path to repo-based tasks directory (e.g., .ailf/tasks/) */
97
97
  repoTasksPath?: string;
98
98
  /** Report store project ID from .ailf/config.yaml reportStore block */
@@ -38,6 +38,8 @@ export interface ResolvedOptions {
38
38
  projectIdOverride?: string;
39
39
  promptfooUrl?: string;
40
40
  publishEnabled: boolean;
41
+ /** True when --publish or --no-publish was explicitly passed by the user. */
42
+ publishExplicit: boolean;
41
43
  publishTag?: string;
42
44
  readinessEnabled: boolean;
43
45
  reportDataset?: string;
@@ -51,7 +53,7 @@ export interface ResolvedOptions {
51
53
  remote: boolean;
52
54
  repoTasksPath?: string;
53
55
  taskOption?: string;
54
- taskSourceType?: "content-lake" | "yaml";
56
+ taskSourceType?: "content-lake" | "repo" | "yaml";
55
57
  urlArgs: string[];
56
58
  apiUrl: string;
57
59
  apiKey?: string;
@@ -152,6 +152,13 @@ export function computeResolvedOptions(opts) {
152
152
  // Publish: smart default — auto-publish full runs when report store is configured
153
153
  const reportStoreToken = process.env.AILF_REPORT_SANITY_API_TOKEN ?? process.env.SANITY_API_TOKEN;
154
154
  const reportStoreConfigured = Boolean(reportStoreToken);
155
+ // Track whether the user explicitly chose --publish or --no-publish.
156
+ // In remote mode, when this is false we omit the field from the API
157
+ // request so the server can apply its own default (publish when jobId
158
+ // is present). Without this, the local smart-default (which checks for
159
+ // a local Sanity token the CLI doesn't have) would send publish:false
160
+ // and suppress server-side report publishing.
161
+ const publishExplicit = opts.publish !== undefined || process.env.AILF_PUBLISH !== undefined;
155
162
  let publishEnabled;
156
163
  if (opts.publish !== undefined) {
157
164
  // Explicit --publish or --no-publish always wins
@@ -213,6 +220,7 @@ export function computeResolvedOptions(opts) {
213
220
  projectIdOverride,
214
221
  promptfooUrl: opts.promptfooUrl,
215
222
  publishEnabled,
223
+ publishExplicit,
216
224
  publishTag: opts.publishTag,
217
225
  readinessEnabled: opts.readiness,
218
226
  remote,
@@ -238,7 +246,9 @@ function resolveTaskSourceType(raw) {
238
246
  return undefined; // default — Content Lake
239
247
  if (raw === "yaml")
240
248
  return "yaml";
241
- console.error(`❌ Invalid --task-source "${raw}". Must be "yaml" or "content-lake".`);
249
+ if (raw === "repo")
250
+ return "repo";
251
+ console.error(`❌ Invalid --task-source "${raw}". Must be "yaml", "repo", or "content-lake".`);
242
252
  process.exit(1);
243
253
  }
244
254
  // ---------------------------------------------------------------------------
@@ -39,7 +39,7 @@ export function createPipelineCommand() {
39
39
  .option("--config <path>", "Load pipeline config from a JSON/YAML file (overrides most CLI flags)")
40
40
  .option("-o, --output <path>", "Write PR comment markdown to file")
41
41
  .option("--promptfoo-url <url>", "Promptfoo share URL for report")
42
- .option("--task-source <type>", "Task definition source: content-lake (default — Sanity Content Lake), yaml (tasks/*.yaml files, legacy)", "content-lake")
42
+ .option("--task-source <type>", "Task definition source: content-lake (default — Sanity Content Lake), repo (repo tasks only, no Content Lake merge), yaml (tasks/*.yaml files, legacy)", "content-lake")
43
43
  .option("--repo-tasks-path <path>", "Path to repo-based task definitions (.ailf/tasks/ directory)")
44
44
  .option("--remote", "Submit evaluation to the AILF API instead of running locally", false)
45
45
  .option("--api-url <url>", "AILF API base URL (default: https://ailf-api.sanity.build)")
@@ -119,7 +119,10 @@ function toConfigSlice(opts) {
119
119
  source: opts.source,
120
120
  compareEnabled: opts.compareEnabled,
121
121
  compareThreshold: opts.compareThreshold,
122
- publishEnabled: opts.publishEnabled,
122
+ // Only send publish preference when the user explicitly passed
123
+ // --publish or --no-publish. When omitted, the API applies its own
124
+ // default (publish: true for API-triggered jobs with a jobId).
125
+ publishEnabled: opts.publishExplicit ? opts.publishEnabled : undefined,
123
126
  publishTag: opts.publishTag,
124
127
  concurrency: opts.concurrency,
125
128
  datasetOverride: opts.datasetOverride,
@@ -78,6 +78,17 @@ function createCache(config) {
78
78
  return new ContentLakeCacheAdapter(local, createReportStore(config));
79
79
  }
80
80
  function createTaskSource(config) {
81
+ // "repo" mode — use ONLY repo tasks, no Content Lake or YAML merge.
82
+ // This is the correct mode for API-triggered inline-task evaluations
83
+ // where the caller sent their own task definitions. Without this,
84
+ // CompositeTaskSource would merge the caller's tasks with ALL Content
85
+ // Lake tasks, running the entire suite instead of just the caller's.
86
+ if (config.taskSourceType === "repo") {
87
+ if (!config.repoTasksPath) {
88
+ throw new Error('taskSourceType "repo" requires --repo-tasks-path to be set');
89
+ }
90
+ return new RepoTaskSource(config.repoTasksPath);
91
+ }
81
92
  // Primary source — selected by config.taskSourceType
82
93
  // Content Lake tasks may require the report token for access.
83
94
  const primary = config.taskSourceType === "yaml"
@@ -87,7 +98,8 @@ function createTaskSource(config) {
87
98
  process.env.SANITY_API_TOKEN ??
88
99
  undefined,
89
100
  }));
90
- // If repo tasks path is set, combine primary + repo sources
101
+ // If repo tasks path is set, combine primary + repo sources.
102
+ // This is the "augment" mode — repo tasks extend the primary source.
91
103
  if (config.repoTasksPath) {
92
104
  return new CompositeTaskSource([
93
105
  primary,
@@ -77,6 +77,10 @@ function mapDebug(debug) {
77
77
  function mapTaskSourceType(taskMode) {
78
78
  if (taskMode === "content-lake" || taskMode === "yaml")
79
79
  return taskMode;
80
- // "inline" is handled separately by the caller; maps to undefined
80
+ // "inline" means the caller sent inline tasks that will be materialized
81
+ // to a temp directory and loaded via --repo-tasks-path. Use "repo" to
82
+ // ensure ONLY those tasks are used (no Content Lake merge).
83
+ if (taskMode === "inline")
84
+ return "repo";
81
85
  return undefined;
82
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ailf",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "restricted"