@sanity/ailf 4.0.4 → 4.0.5

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.
@@ -34,11 +34,16 @@ export class FetchDocsStep {
34
34
  // a mismatch where configs reference context files that were never
35
35
  // fetched.
36
36
  //
37
- // Content Lake path: use ctx.taskSource (ContentLakeTaskSource) which
38
- // loads Studio-owned ailf.task documents via GROQ.
39
- // Filesystem path: load from .task.ts files (repo/inline tasks).
37
+ // Adapter path: ctx.taskSource handles both content-lake and repo modes.
38
+ // The composition root wires the right adapter (ContentLakeTaskSource
39
+ // or RepoTaskSource) per taskSourceType. RepoTaskSource loads BOTH
40
+ // .yaml and .task.ts files — necessary for external-consumer evals
41
+ // that materialize inline tasks as YAML (W0148).
42
+ // Filesystem path: load from .task.ts files (legacy unset path —
43
+ // AILF defaults from tasks/${mode}/ + optional repoTasksPath augment).
40
44
  let allTasks;
41
- if (ctx.config.taskSourceType === "content-lake") {
45
+ if (ctx.config.taskSourceType === "content-lake" ||
46
+ ctx.config.taskSourceType === "repo") {
42
47
  const filter = {
43
48
  ...(ctx.config.areas?.length ? { areas: ctx.config.areas } : {}),
44
49
  ...(ctx.config.tasks?.length ? { taskIds: ctx.config.tasks } : {}),
@@ -19,13 +19,14 @@ export declare class GenerateConfigsStep implements PipelineStep {
19
19
  private compileSingleMode;
20
20
  private loadTasks;
21
21
  /**
22
- * Load tasks from the Content Lake via ctx.taskSource.
22
+ * Load tasks via ctx.taskSource (the composition-root-wired adapter).
23
23
  *
24
- * The ContentLakeTaskSource adapter handles area/task/tag filtering
25
- * in the GROQ query itself, so we build a FilterOptions and pass it
26
- * through rather than filtering in-memory after loading.
24
+ * Used for both `taskSourceType === "content-lake"` (ContentLakeTaskSource)
25
+ * and `taskSourceType === "repo"` (RepoTaskSource). Filtering by
26
+ * area/task/tag is delegated to the adapter — ContentLakeTaskSource
27
+ * pushes it into the GROQ query, RepoTaskSource applies it in-memory.
27
28
  */
28
- private loadTasksFromContentLake;
29
+ private loadTasksFromAdapter;
29
30
  /**
30
31
  * Load tasks from filesystem .task.ts files.
31
32
  *
@@ -209,23 +209,30 @@ export class GenerateConfigsStep {
209
209
  // Task loading — unified for all modes
210
210
  // ---------------------------------------------------------------------------
211
211
  async loadTasks(ctx, mode, state) {
212
- // Content Lake path — use ctx.taskSource (ContentLakeTaskSource) which
213
- // loads ailf.task documents via GROQ. This is the only path that sees
214
- // Studio-owned tasks (ownership: "studio").
215
- if (ctx.config.taskSourceType === "content-lake") {
216
- return this.loadTasksFromContentLake(ctx, state);
212
+ // Adapter path — use ctx.taskSource. The composition root wires the
213
+ // right adapter for each taskSourceType:
214
+ // - "content-lake" → ContentLakeTaskSource (Studio-owned ailf.task docs)
215
+ // - "repo" → RepoTaskSource (loads .yaml AND .task.ts from repoTasksPath)
216
+ // Routing both through ctx.taskSource keeps the orchestration step
217
+ // file-format-agnostic (W0148: external-consumer evals materialize
218
+ // inline tasks as .yaml, which loadPipelineTasks can't read).
219
+ if (ctx.config.taskSourceType === "content-lake" ||
220
+ ctx.config.taskSourceType === "repo") {
221
+ return this.loadTasksFromAdapter(ctx, state);
217
222
  }
218
- // Filesystem path — load from .task.ts files (repo tasks, inline tasks).
223
+ // Filesystem path — load from .task.ts files (legacy unset path:
224
+ // AILF defaults from tasks/${mode}/ + optional repoTasksPath augment).
219
225
  return this.loadTasksFromFilesystem(ctx, mode, state);
220
226
  }
221
227
  /**
222
- * Load tasks from the Content Lake via ctx.taskSource.
228
+ * Load tasks via ctx.taskSource (the composition-root-wired adapter).
223
229
  *
224
- * The ContentLakeTaskSource adapter handles area/task/tag filtering
225
- * in the GROQ query itself, so we build a FilterOptions and pass it
226
- * through rather than filtering in-memory after loading.
230
+ * Used for both `taskSourceType === "content-lake"` (ContentLakeTaskSource)
231
+ * and `taskSourceType === "repo"` (RepoTaskSource). Filtering by
232
+ * area/task/tag is delegated to the adapter — ContentLakeTaskSource
233
+ * pushes it into the GROQ query, RepoTaskSource applies it in-memory.
227
234
  */
228
- async loadTasksFromContentLake(ctx, state) {
235
+ async loadTasksFromAdapter(ctx, state) {
229
236
  const filter = {
230
237
  ...(ctx.config.areas?.length ? { areas: ctx.config.areas } : {}),
231
238
  ...(ctx.config.tasks?.length ? { taskIds: ctx.config.tasks } : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ailf",
3
- "version": "4.0.4",
3
+ "version": "4.0.5",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"