@diafunc/cli 0.22.0 → 0.23.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-LEDCBZ3S.js";
7
+ } from "../chunk-DXZN6YJJ.js";
8
8
  import {
9
9
  getUpdateNotice
10
- } from "../chunk-KIHRD6SW.js";
10
+ } from "../chunk-CBQ5OGX3.js";
11
11
  import {
12
12
  package_default
13
- } from "../chunk-5WKI5YMX.js";
13
+ } from "../chunk-KND3I4AN.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-5WKI5YMX.js";
3
+ } from "./chunk-KND3I4AN.js";
4
4
 
5
5
  // src/util/update-check.ts
6
6
  import * as fs from "fs";
@@ -72,4 +72,4 @@ async function getUpdateNotice() {
72
72
  export {
73
73
  getUpdateNotice
74
74
  };
75
- //# sourceMappingURL=chunk-KIHRD6SW.js.map
75
+ //# sourceMappingURL=chunk-CBQ5OGX3.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "./chunk-5WKI5YMX.js";
3
+ } from "./chunk-KND3I4AN.js";
4
4
 
5
5
  // src/index.ts
6
6
  import chalk37 from "chalk";
@@ -1642,11 +1642,11 @@ function createAnalysisService(client) {
1642
1642
  body: request
1643
1643
  });
1644
1644
  },
1645
- async patchFeatureExclusions(analysisId, request) {
1645
+ async patchInputExclusions(analysisId, request) {
1646
1646
  return client.request({
1647
1647
  method: "PATCH",
1648
1648
  service: SERVICE2,
1649
- path: `/${encodeURIComponent(analysisId)}/feature-exclusions`,
1649
+ path: `/${encodeURIComponent(analysisId)}/input-exclusions`,
1650
1650
  body: request
1651
1651
  });
1652
1652
  },
@@ -6315,7 +6315,7 @@ var HELP = [
6315
6315
  ];
6316
6316
  async function runChatRepl(options) {
6317
6317
  const { input: promptInput } = await import("@inquirer/prompts");
6318
- const { getUpdateNotice } = await import("./update-check-RWCYYDVC.js");
6318
+ const { getUpdateNotice } = await import("./update-check-PBX3DE56.js");
6319
6319
  let sessionId = options.session;
6320
6320
  let lastReportedSession;
6321
6321
  console.log(chalk19.bold("Diafunc chat") + chalk19.dim(" \xB7 /help for commands, /quit to exit"));
@@ -7622,9 +7622,9 @@ async function promptRunFields(prompter, options) {
7622
7622
  }
7623
7623
  if (hours === void 0) {
7624
7624
  hours = await prompter.input({
7625
- message: "Time budget (hours)",
7625
+ message: "Time limit (hours)",
7626
7626
  default: depthDefault?.hours,
7627
- validate: positiveNumber("Time budget")
7627
+ validate: positiveNumber("Time limit")
7628
7628
  });
7629
7629
  }
7630
7630
  if (budget === void 0) {
@@ -7772,7 +7772,7 @@ function analysisDetails(analysis, endpoint) {
7772
7772
  dataImport: analysis.dataImport?.message ?? null,
7773
7773
  targets: analysis.targets,
7774
7774
  targetKinds: analysis.targetKinds && Object.keys(analysis.targetKinds).length > 0 ? analysis.targetKinds : "detected from the data",
7775
- featureExclusions: analysis.featureExclusions,
7775
+ inputExclusions: analysis.inputExclusions,
7776
7776
  confirmedInputs: analysis.confirmedInputs,
7777
7777
  questions: analysis.questions,
7778
7778
  segment: analysis.segment,
@@ -7803,11 +7803,11 @@ function analysisDetails(analysis, endpoint) {
7803
7803
  { key: "dataImport", header: "Data import" },
7804
7804
  { key: "targets", header: "Targets" },
7805
7805
  { key: "targetKinds", header: "Target kinds" },
7806
- { key: "featureExclusions", header: "Excluded columns" },
7806
+ { key: "inputExclusions", header: "Excluded columns" },
7807
7807
  { key: "confirmedInputs", header: "Known before the outcome" },
7808
7808
  { key: "questions", header: "Questions" },
7809
7809
  { key: "segment", header: "Segment" },
7810
- { key: "hours", header: "Time budget" },
7810
+ { key: "hours", header: "Time limit" },
7811
7811
  { key: "budget", header: "Credit budget" },
7812
7812
  { key: "constraints", header: "Constraints" },
7813
7813
  { key: "notifyByEmail", header: "Email when done" },
@@ -7864,13 +7864,16 @@ function outputsText(analysis) {
7864
7864
  if (more > 0) lines.push(`and ${formatNumber(more)} more`);
7865
7865
  return lines.join("\n");
7866
7866
  }
7867
+ function errorPercent(error) {
7868
+ return `${formatNumber(Math.round(error * 1e3) / 10)}%`;
7869
+ }
7867
7870
  function constraintsText(analysis) {
7868
7871
  const parts = [];
7869
7872
  if (analysis.minComplexity != null) parts.push(`complexity at least ${formatNumber(analysis.minComplexity)}`);
7870
7873
  if (analysis.maxComplexity != null) parts.push(`complexity at most ${formatNumber(analysis.maxComplexity)}`);
7871
7874
  if (analysis.targetComplexity != null) parts.push(`aim for complexity ${formatNumber(analysis.targetComplexity)}`);
7872
7875
  if (analysis.targetQuality != null) parts.push(`stop at quality ${qualityPercent(analysis.targetQuality)}`);
7873
- if (analysis.targetError != null) parts.push(`stop at error ${formatNumber(analysis.targetError)}`);
7876
+ if (analysis.targetError != null) parts.push(`stop at error ${errorPercent(analysis.targetError)}`);
7874
7877
  if (analysis.minMilliseconds != null) parts.push(`search at least ${formatDurationPrecise(analysis.minMilliseconds)}`);
7875
7878
  return parts.length > 0 ? parts.join(", ") : "none";
7876
7879
  }
@@ -8254,6 +8257,18 @@ function namedDepth(options) {
8254
8257
  if (options.budget?.trim()) depth.budget = options.budget.trim();
8255
8258
  return depth;
8256
8259
  }
8260
+ var REPORT_TERMS_HELP = `
8261
+ Terms:
8262
+ Quality How well the model predicts on held-out rows, marked down for the size of its
8263
+ formula. 0% is no better than always predicting the average, 100% is exact.
8264
+ While a search runs, the same measure on the training rows.
8265
+ Error How far the predictions lie from the held-out values, as a share of the miss of
8266
+ always predicting the average. 0% is exact.
8267
+ Complexity How long the formula is. A bound limits the formulas the search may return.
8268
+ Generation One round of the search: candidates are varied, measured and selected.
8269
+
8270
+ Every term: https://diafunc.com/documentation/glossary
8271
+ `;
8257
8272
  function budgetHoursOf(hours) {
8258
8273
  if (hours === null || hours === void 0) return null;
8259
8274
  const parsed = Number(hours);
@@ -9074,7 +9089,7 @@ var COLUMN_LIST_HELP = "one argument each or comma-separated; a name that contai
9074
9089
  var TARGETS_HELP = `Target column names: repeat the flag or separate them with commas; a name that contains a comma is one flag of its own, or goes in double quotes inside a list`;
9075
9090
  function registerAnalyzeCommand(program) {
9076
9091
  const analyze = program.command("analyze").description("Run and manage automatic analyses");
9077
- analyze.command("run", { isDefault: true }).description("Create an analysis from a data file, configure it and run it (the default: `analyze <file>`)").argument("[files...]", "Data file to analyze (CSV, Excel and more than 45 file formats; see `table import-formats`). Several files are combined into one table: files with the same columns are stacked, a file that shares a key adds its columns").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>", `Time budget (hours). ${STARTING_DEPTH_RULE}`).option("--budget <credits>", `Credit budget. ${STARTING_DEPTH_RULE}`).option("--targets <columns>", `${TARGETS_HELP} (required when not interactive)`, collectColumns).option("--question <text>", "A question for the analysis to answer; repeat the flag for several", collectQuestion).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)").option("--no-file-column", "With several files: do not add the column that records the file each row came from").option("--keep-duplicates", "With several files: keep rows that occur in more than one file").option("--rows-of <file>", "With several files that can be read two ways: the file in which one row is one observation").option("--as-uploaded [file]", AS_UPLOADED_HELP, collectAsUploaded).action(async (files, options, cmd) => {
9092
+ analyze.command("run", { isDefault: true }).description("Create an analysis from a data file, configure it and run it (the default: `analyze <file>`)").argument("[files...]", "Data file to analyze (CSV, Excel and more than 45 file formats; see `table import-formats`). Several files are combined into one table: files with the same columns are stacked, a file that shares a key adds its columns").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>", `Time limit (hours). ${STARTING_DEPTH_RULE}`).option("--budget <credits>", `Credit budget. ${STARTING_DEPTH_RULE}`).option("--targets <columns>", `${TARGETS_HELP} (required when not interactive)`, collectColumns).option("--question <text>", "A question for the analysis to answer; repeat the flag for several", collectQuestion).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)").option("--no-file-column", "With several files: do not add the column that records the file each row came from").option("--keep-duplicates", "With several files: keep rows that occur in more than one file").option("--rows-of <file>", "With several files that can be read two ways: the file in which one row is one observation").option("--as-uploaded [file]", AS_UPLOADED_HELP, collectAsUploaded).action(async (files, options, cmd) => {
9078
9093
  try {
9079
9094
  if (files.length === 0) {
9080
9095
  analyze.help();
@@ -9092,14 +9107,14 @@ function registerAnalyzeCommand(program) {
9092
9107
  handleError(error);
9093
9108
  }
9094
9109
  });
9095
- analyze.command("get").description("Show details of an analysis").argument("[id]", "Analysis ID (defaults to the most recent)").option("--full", "Print the introduction in full instead of abbreviating it").action(async (id, options, cmd) => {
9110
+ analyze.command("get").description("Show details of an analysis").argument("[id]", "Analysis ID (defaults to the most recent)").option("--full", "Print the introduction in full instead of abbreviating it").addHelpText("after", REPORT_TERMS_HELP).action(async (id, options, cmd) => {
9096
9111
  try {
9097
9112
  await getAnalysisDetails(id, options, cmd);
9098
9113
  } catch (error) {
9099
9114
  handleError(error);
9100
9115
  }
9101
9116
  });
9102
- analyze.command("watch").description("Follow the latest run of an analysis live").argument("[id]", "Analysis ID (defaults to the most recent)").action(async (id, _options, cmd) => {
9117
+ analyze.command("watch").description("Follow the latest run of an analysis live").argument("[id]", "Analysis ID (defaults to the most recent)").addHelpText("after", REPORT_TERMS_HELP).action(async (id, _options, cmd) => {
9103
9118
  try {
9104
9119
  await watchAnalysis(id, cmd);
9105
9120
  } catch (error) {
@@ -9120,7 +9135,7 @@ function registerAnalyzeCommand(program) {
9120
9135
  reportCommandError(error);
9121
9136
  }
9122
9137
  });
9123
- analyze.command("create").description("Create an analysis without uploading data or running it").option("--name <name>", "Analysis name").option("--description <text>", "Analysis description").option("--visibility <vis>", "PRIVATE or PUBLIC", "PRIVATE").option("--hours <hours>", `Time budget (hours). ${STARTING_DEPTH_RULE}`).option("--budget <credits>", `Credit budget. ${STARTING_DEPTH_RULE}`).option("--targets <columns>", TARGETS_HELP, collectColumns).option("--question <text>", "A question for the analysis to answer; repeat the flag for several", collectQuestion).option("--segment <name>", "Column to segment the analysis by").option("--introduction <markdown>", "Markdown introduction shown at the top of the notebook").action(async (options, cmd) => {
9138
+ analyze.command("create").description("Create an analysis without uploading data or running it").option("--name <name>", "Analysis name").option("--description <text>", "Analysis description").option("--visibility <vis>", "PRIVATE or PUBLIC", "PRIVATE").option("--hours <hours>", `Time limit (hours). ${STARTING_DEPTH_RULE}`).option("--budget <credits>", `Credit budget. ${STARTING_DEPTH_RULE}`).option("--targets <columns>", TARGETS_HELP, collectColumns).option("--question <text>", "A question for the analysis to answer; repeat the flag for several", collectQuestion).option("--segment <name>", "Column to segment the analysis by").option("--introduction <markdown>", "Markdown introduction shown at the top of the notebook").action(async (options, cmd) => {
9124
9139
  try {
9125
9140
  await createAnalysis(options, cmd);
9126
9141
  } catch (error) {
@@ -9188,7 +9203,7 @@ function registerAnalyzeCommand(program) {
9188
9203
  handleError(error);
9189
9204
  }
9190
9205
  });
9191
- analyze.command("hours").description("Set the time budget (hours) for the next run").argument("<id>", "Analysis ID").argument("<hours>", "Time budget (hours), e.g. 4").action(async (id, hours, _options, cmd) => {
9206
+ analyze.command("hours").description("Set the time limit (hours) for the next run").argument("<id>", "Analysis ID").argument("<hours>", "Time limit (hours), e.g. 4").action(async (id, hours, _options, cmd) => {
9192
9207
  try {
9193
9208
  await patchAndPrint(
9194
9209
  id,
@@ -9227,12 +9242,12 @@ function registerAnalyzeCommand(program) {
9227
9242
  handleError(error);
9228
9243
  }
9229
9244
  });
9230
- analyze.command("feature-exclusions").description("Set the columns every fit leaves out as an input (a single empty string leaves nothing out)").argument("<id>", "Analysis ID").argument("<column...>", `Column names, ${COLUMN_LIST_HELP}`).action(async (id, given, _options, cmd) => {
9245
+ analyze.command("input-exclusions").description("Set the columns every fit leaves out as an input (a single empty string leaves nothing out)").argument("<id>", "Analysis ID").argument("<column...>", `Column names, ${COLUMN_LIST_HELP}`).action(async (id, given, _options, cmd) => {
9231
9246
  try {
9232
9247
  await patchColumns(
9233
9248
  id,
9234
9249
  given,
9235
- (api, columns) => api.analysis.patchFeatureExclusions(id, { columns }),
9250
+ (api, columns) => api.analysis.patchInputExclusions(id, { columns }),
9236
9251
  "Columns left out of the fit",
9237
9252
  cmd
9238
9253
  );
@@ -9332,7 +9347,7 @@ function registerAnalyzeCommand(program) {
9332
9347
  handleError(error);
9333
9348
  }
9334
9349
  });
9335
- presets.command("save").description("Create a new preset (omit --id) or update an existing one (with --id)").requiredOption("--name <name>", "Preset name").requiredOption("--targets <columns>", TARGETS_HELP, collectColumns).requiredOption("--hours <hours>", "Time budget (hours)").requiredOption("--budget <credits>", "Credit budget").option("--question <text>", "A question for the analysis to answer; repeat the flag for several", collectQuestion).option("--segment <name>", "Column to segment the analysis by").option("--id <id>", "Existing preset ID (update mode)").action(async (options, cmd) => {
9350
+ presets.command("save").description("Create a new preset (omit --id) or update an existing one (with --id)").requiredOption("--name <name>", "Preset name").requiredOption("--targets <columns>", TARGETS_HELP, collectColumns).requiredOption("--hours <hours>", "Time limit (hours)").requiredOption("--budget <credits>", "Credit budget").option("--question <text>", "A question for the analysis to answer; repeat the flag for several", collectQuestion).option("--segment <name>", "Column to segment the analysis by").option("--id <id>", "Existing preset ID (update mode)").action(async (options, cmd) => {
9336
9351
  try {
9337
9352
  await savePreset(options, cmd);
9338
9353
  } catch (error) {
@@ -10793,7 +10808,7 @@ function registerShellCommand(program) {
10793
10808
  });
10794
10809
  const api = createApiClient();
10795
10810
  const { input: promptInput } = await import("@inquirer/prompts");
10796
- const { getUpdateNotice } = await import("./update-check-RWCYYDVC.js");
10811
+ const { getUpdateNotice } = await import("./update-check-PBX3DE56.js");
10797
10812
  const resolvedLanguage = await resolveLanguage(api, fnRef.projectId, options.language);
10798
10813
  console.log(chalk32.bold("Diafunc shell") + chalk32.dim(` \xB7 function ${fnRef.entityId} \xB7 ${resolvedLanguage}`));
10799
10814
  console.log(chalk32.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
@@ -11087,7 +11102,7 @@ var INDEX = { kind: "number", min: 0, integer: true };
11087
11102
  var BY_COMMAND = {
11088
11103
  "analyze segment": { "<name>": { kind: "analysisColumns", multiple: false, allowEmpty: true } },
11089
11104
  "analyze targets": { "<column>": { kind: "analysisColumns", multiple: true, allowEmpty: false } },
11090
- "analyze feature-exclusions": { "<column>": { kind: "analysisColumns", multiple: true, allowEmpty: true } },
11105
+ "analyze input-exclusions": { "<column>": { kind: "analysisColumns", multiple: true, allowEmpty: true } },
11091
11106
  "analyze confirmed-inputs": { "<column>": { kind: "analysisColumns", multiple: true, allowEmpty: true } },
11092
11107
  "analyze questions": { "<question>": TEXT_OR_EMPTY },
11093
11108
  "analyze description": { "<text>": TEXT_OR_EMPTY },
@@ -11843,4 +11858,4 @@ export {
11843
11858
  PromptCancelled,
11844
11859
  createProgram
11845
11860
  };
11846
- //# sourceMappingURL=chunk-LEDCBZ3S.js.map
11861
+ //# sourceMappingURL=chunk-DXZN6YJJ.js.map