@diafunc/cli 0.16.0 → 0.17.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.
@@ -4,13 +4,13 @@ import {
4
4
  PromptCancelled,
5
5
  createProgram,
6
6
  handleError
7
- } from "../chunk-SA4Y2GNR.js";
7
+ } from "../chunk-6ZOIOHSW.js";
8
8
  import {
9
9
  getUpdateNotice
10
- } from "../chunk-3XAPBWCA.js";
10
+ } from "../chunk-QWSCORJH.js";
11
11
  import {
12
12
  package_default
13
- } from "../chunk-EZMZFU5V.js";
13
+ } from "../chunk-ZT25YY7J.js";
14
14
 
15
15
  // bin/diafunc.ts
16
16
  import chalk2 from "chalk";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "./chunk-EZMZFU5V.js";
3
+ } from "./chunk-ZT25YY7J.js";
4
4
 
5
5
  // src/index.ts
6
6
  import chalk36 from "chalk";
@@ -1620,6 +1620,22 @@ function createAnalysisService(client) {
1620
1620
  body: request
1621
1621
  });
1622
1622
  },
1623
+ async patchFeatureExclusions(analysisId, request) {
1624
+ return client.request({
1625
+ method: "PATCH",
1626
+ service: SERVICE2,
1627
+ path: `/${encodeURIComponent(analysisId)}/feature-exclusions`,
1628
+ body: request
1629
+ });
1630
+ },
1631
+ async patchConfirmedInputs(analysisId, request) {
1632
+ return client.request({
1633
+ method: "PATCH",
1634
+ service: SERVICE2,
1635
+ path: `/${encodeURIComponent(analysisId)}/confirmed-inputs`,
1636
+ body: request
1637
+ });
1638
+ },
1623
1639
  async patchSegment(analysisId, request) {
1624
1640
  return client.request({
1625
1641
  method: "PATCH",
@@ -6169,7 +6185,7 @@ var HELP = [
6169
6185
  ];
6170
6186
  async function runChatRepl(options) {
6171
6187
  const { input: promptInput } = await import("@inquirer/prompts");
6172
- const { getUpdateNotice } = await import("./update-check-CBJ6R66H.js");
6188
+ const { getUpdateNotice } = await import("./update-check-5CPEMV2M.js");
6173
6189
  let sessionId = options.session;
6174
6190
  let lastReportedSession;
6175
6191
  console.log(chalk19.bold("Diafunc chat") + chalk19.dim(" \xB7 /help for commands, /quit to exit"));
@@ -7400,6 +7416,7 @@ function analysisDetails(analysis, endpoint) {
7400
7416
  targets: analysis.targets,
7401
7417
  targetKinds: analysis.targetKinds && Object.keys(analysis.targetKinds).length > 0 ? analysis.targetKinds : "detected from the data",
7402
7418
  featureExclusions: analysis.featureExclusions,
7419
+ confirmedInputs: analysis.confirmedInputs,
7403
7420
  questions: analysis.questions,
7404
7421
  segment: analysis.segment,
7405
7422
  hours: hoursText(analysis.hours),
@@ -7428,6 +7445,7 @@ function analysisDetails(analysis, endpoint) {
7428
7445
  { key: "targets", header: "Targets" },
7429
7446
  { key: "targetKinds", header: "Target kinds" },
7430
7447
  { key: "featureExclusions", header: "Excluded columns" },
7448
+ { key: "confirmedInputs", header: "Known before the outcome" },
7431
7449
  { key: "questions", header: "Questions" },
7432
7450
  { key: "segment", header: "Segment" },
7433
7451
  { key: "hours", header: "Computation time" },
@@ -8150,7 +8168,7 @@ async function updateTriggerCmd(triggerId, options, cmd) {
8150
8168
  }
8151
8169
  function registerAnalyzeCommand(program) {
8152
8170
  const analyze = program.command("analyze").description("Run and manage automatic analyses");
8153
- analyze.command("run", { isDefault: true }).description("Create an analysis from a data file, configure it and run it (the default: `analyze <file>`)").argument("[file]", "Data file to analyze (CSV, Excel, Parquet, JSON and 20+ more formats)").option("--name <name>", "Analysis name (asked for, or derived from the filename)").option("--description <text>", "Analysis description").option("--visibility <vis>", "PRIVATE or PUBLIC (default: PRIVATE)").option("--hours <hours>", `Computation time (hours). Default ${DEFAULT_HOURS}, the Standard preset; a saved preset applies when omitted`).option("--budget <credits>", `Credit budget. Default ${Number(DEFAULT_BUDGET).toLocaleString("en-US")}, the Standard preset; a saved preset applies when omitted`).option("--targets <csv>", "Comma-separated target column names (required when not interactive)").option("--questions <csv>", "Comma-separated questions to answer").option("--segment <name>", "Column to segment the analysis by").option("--introduction <markdown>", "Markdown introduction shown at the top of the notebook").option("--preset <id>", "Apply a saved preset as defaults (explicit flags override it)").action(async (file, options, cmd) => {
8171
+ analyze.command("run", { isDefault: true }).description("Create an analysis from a data file, configure it and run it (the default: `analyze <file>`)").argument("[file]", "Data file to analyze (CSV, Excel and more than 35 file formats; see `table import-formats`)").option("--name <name>", "Analysis name (asked for, or derived from the filename)").option("--description <text>", "Analysis description").option("--visibility <vis>", "PRIVATE or PUBLIC (default: PRIVATE)").option("--hours <hours>", `Computation time (hours). Default ${DEFAULT_HOURS}, the Standard preset; a saved preset applies when omitted`).option("--budget <credits>", `Credit budget. Default ${Number(DEFAULT_BUDGET).toLocaleString("en-US")}, the Standard preset; a saved preset applies when omitted`).option("--targets <csv>", "Comma-separated target column names (required when not interactive)").option("--questions <csv>", "Comma-separated questions to answer").option("--segment <name>", "Column to segment the analysis by").option("--introduction <markdown>", "Markdown introduction shown at the top of the notebook").option("--preset <id>", "Apply a saved preset as defaults (explicit flags override it)").action(async (file, options, cmd) => {
8154
8172
  try {
8155
8173
  if (!file) {
8156
8174
  analyze.help();
@@ -8304,6 +8322,34 @@ function registerAnalyzeCommand(program) {
8304
8322
  handleError(error);
8305
8323
  }
8306
8324
  });
8325
+ analyze.command("feature-exclusions").description("Set the columns every fit leaves out as an input (comma-separated; empty string leaves nothing out)").argument("<id>", "Analysis ID").argument("<csv>", "Comma-separated column names").action(async (id, csv, _options, cmd) => {
8326
+ try {
8327
+ const columns = parseCsv(csv) ?? [];
8328
+ await patchAndPrint(
8329
+ id,
8330
+ csv,
8331
+ (api, aid) => api.analysis.patchFeatureExclusions(aid, { columns }),
8332
+ "Columns left out of the fit",
8333
+ cmd
8334
+ );
8335
+ } catch (error) {
8336
+ handleError(error);
8337
+ }
8338
+ });
8339
+ analyze.command("confirmed-inputs").description("Set the columns the owner confirms as known before the outcome (comma-separated; empty string confirms nothing). A confirmed column raises no leakage concern.").argument("<id>", "Analysis ID").argument("<csv>", "Comma-separated column names").action(async (id, csv, _options, cmd) => {
8340
+ try {
8341
+ const columns = parseCsv(csv) ?? [];
8342
+ await patchAndPrint(
8343
+ id,
8344
+ csv,
8345
+ (api, aid) => api.analysis.patchConfirmedInputs(aid, { columns }),
8346
+ "Columns known before the outcome",
8347
+ cmd
8348
+ );
8349
+ } catch (error) {
8350
+ handleError(error);
8351
+ }
8352
+ });
8307
8353
  analyze.command("questions").description("Set the questions list (comma-separated)").argument("<id>", "Analysis ID").argument("<csv>", "Comma-separated questions (empty string to clear)").action(async (id, csv, _options, cmd) => {
8308
8354
  try {
8309
8355
  const questions = parseCsv(csv) ?? [];
@@ -8331,7 +8377,7 @@ function registerAnalyzeCommand(program) {
8331
8377
  handleError(error);
8332
8378
  }
8333
8379
  });
8334
- analyze.command("upload").description("Replace the analysis data with a new file (any supported format; see `table import-formats`)").argument("<id>", "Analysis ID").argument("[file]", "Data file to upload (CSV, Excel, Parquet, JSON and 20+ more formats)").option("--url <url>", "HTTPS URL to fetch the data file from, instead of a file path").action(async (id, file, options) => {
8380
+ analyze.command("upload").description("Replace the analysis data with a new file (any supported format; see `table import-formats`)").argument("<id>", "Analysis ID").argument("[file]", "Data file to upload (CSV, Excel and more than 35 file formats; see `table import-formats`)").option("--url <url>", "HTTPS URL to fetch the data file from, instead of a file path").action(async (id, file, options) => {
8335
8381
  try {
8336
8382
  await uploadData(id, file, options);
8337
8383
  } catch (error) {
@@ -9125,6 +9171,9 @@ _diafunc_completions() {
9125
9171
  *) COMPREPLY=($(compgen -W "\${subcommands}" -- "\${cur}")) ;;
9126
9172
  esac
9127
9173
  ;;
9174
+ analyze)
9175
+ COMPREPLY=($(compgen -f -- "\${cur}"))
9176
+ ;;
9128
9177
  *)
9129
9178
  COMPREPLY=($(compgen -W "\${commands}" -- "\${cur}"))
9130
9179
  ;;
@@ -9184,7 +9233,7 @@ _diafunc() {
9184
9233
  schedule) _values 'subcommand' call ;;
9185
9234
  chat) _diafunc_chat ;;
9186
9235
  admin) _diafunc_admin ;;
9187
- analyze) _files '*.csv' '*.xlsx' '*.xls' ;;
9236
+ analyze) _files ;;
9188
9237
  esac
9189
9238
  ;;
9190
9239
  esac
@@ -9667,7 +9716,7 @@ function registerShellCommand(program) {
9667
9716
  });
9668
9717
  const api = createApiClient();
9669
9718
  const { input: promptInput } = await import("@inquirer/prompts");
9670
- const { getUpdateNotice } = await import("./update-check-CBJ6R66H.js");
9719
+ const { getUpdateNotice } = await import("./update-check-5CPEMV2M.js");
9671
9720
  const resolvedLanguage = await resolveLanguage(api, fnRef.projectId, options.language);
9672
9721
  console.log(chalk31.bold("Diafunc shell") + chalk31.dim(` \xB7 function ${fnRef.entityId} \xB7 ${resolvedLanguage}`));
9673
9722
  console.log(chalk31.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
@@ -9961,6 +10010,8 @@ var INDEX = { kind: "number", min: 0, integer: true };
9961
10010
  var BY_COMMAND = {
9962
10011
  "analyze segment": { "<name>": { kind: "analysisColumns", multiple: false, allowEmpty: true } },
9963
10012
  "analyze targets": { "<csv>": { kind: "analysisColumns", multiple: true, allowEmpty: false } },
10013
+ "analyze feature-exclusions": { "<csv>": { kind: "analysisColumns", multiple: true, allowEmpty: true } },
10014
+ "analyze confirmed-inputs": { "<csv>": { kind: "analysisColumns", multiple: true, allowEmpty: true } },
9964
10015
  "analyze questions": { "<csv>": TEXT_OR_EMPTY },
9965
10016
  "analyze description": { "<text>": TEXT_OR_EMPTY },
9966
10017
  "analyze introduction": { "<markdown>": TEXT_OR_EMPTY },
@@ -10712,4 +10763,4 @@ export {
10712
10763
  PromptCancelled,
10713
10764
  createProgram
10714
10765
  };
10715
- //# sourceMappingURL=chunk-SA4Y2GNR.js.map
10766
+ //# sourceMappingURL=chunk-6ZOIOHSW.js.map