@sanity/ailf 0.1.10 → 0.1.11

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.
@@ -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;
@@ -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,
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ailf",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "restricted"