@sanity/ailf 4.0.3 → 4.0.4

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.
@@ -22,6 +22,12 @@ export interface LoadPipelineTasksOptions {
22
22
  mode: string;
23
23
  /** Optional extra directory for repo-based tasks (--repo-tasks-path) */
24
24
  repoTasksPath?: string;
25
+ /**
26
+ * When `"repo"`, load ONLY from `repoTasksPath` and skip the AILF
27
+ * bundled `tasks/${mode}/` directory. Mirrors the composition-root
28
+ * contract for `taskSourceType: "repo"` (see composition-root.ts).
29
+ */
30
+ taskSourceType?: "content-lake" | "repo";
25
31
  }
26
32
  /**
27
33
  * Load task definitions from the filesystem, matching the pipeline's
@@ -26,8 +26,13 @@ import { resolveVendoredSubdir } from "../pipeline/compiler/config-loader.js";
26
26
  * match the requested mode are excluded.
27
27
  */
28
28
  export async function loadPipelineTasks(opts) {
29
- const tasksDir = resolveVendoredSubdir(opts.rootDir, `tasks/${opts.mode}`);
30
- const dirs = [tasksDir];
29
+ const dirs = [];
30
+ if (opts.taskSourceType !== "repo") {
31
+ dirs.push(resolveVendoredSubdir(opts.rootDir, `tasks/${opts.mode}`));
32
+ }
33
+ else if (!opts.repoTasksPath) {
34
+ throw new Error('taskSourceType "repo" requires repoTasksPath to be set (no AILF defaults loaded in repo-only mode)');
35
+ }
31
36
  if (opts.repoTasksPath) {
32
37
  const repoDir = resolve(opts.repoTasksPath);
33
38
  if (!dirs.includes(repoDir)) {
@@ -51,6 +51,7 @@ export class FetchDocsStep {
51
51
  rootDir: ctx.config.rootDir,
52
52
  mode: ctx.config.mode,
53
53
  repoTasksPath: ctx.config.repoTasksPath,
54
+ taskSourceType: ctx.config.taskSourceType,
54
55
  });
55
56
  }
56
57
  // Bridge: narrow to literacy tasks for canonical doc access
@@ -259,8 +259,17 @@ export class GenerateConfigsStep {
259
259
  // Discover task files from the mode-specific directory and --repo-tasks-path.
260
260
  // Use vendored copies in dist/ when @sanity/ailf-core isn't resolvable
261
261
  // (i.e., running outside the monorepo via npx).
262
- const tasksDir = resolveVendoredSubdir(ctx.config.rootDir, `tasks/${mode}`);
263
- const dirs = [tasksDir];
262
+ //
263
+ // When taskSourceType === "repo", skip the AILF-bundled tasks/${mode}/
264
+ // directory and load ONLY from repoTasksPath. Mirrors the composition-root
265
+ // contract for repo-only mode (see composition-root.ts:392-405).
266
+ const dirs = [];
267
+ if (ctx.config.taskSourceType !== "repo") {
268
+ dirs.push(resolveVendoredSubdir(ctx.config.rootDir, `tasks/${mode}`));
269
+ }
270
+ else if (!ctx.config.repoTasksPath) {
271
+ throw new Error('taskSourceType "repo" requires repoTasksPath to be set (no AILF defaults loaded in repo-only mode)');
272
+ }
264
273
  // Also search --repo-tasks-path (e.g., .ailf/tasks/) for repo-based tasks
265
274
  if (ctx.config.repoTasksPath) {
266
275
  const repoDir = resolve(ctx.config.repoTasksPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ailf",
3
- "version": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"