deepline 0.1.74 → 0.1.77

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.
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli/index.ts
4
- import { mkdtemp, rm, writeFile as writeFile4 } from "fs/promises";
5
- import { join as join12 } from "path";
6
- import { tmpdir as tmpdir4 } from "os";
4
+ import { mkdtemp as mkdtemp2, rm as rm2, writeFile as writeFile5 } from "fs/promises";
5
+ import { join as join13 } from "path";
6
+ import { tmpdir as tmpdir5 } from "os";
7
7
  import { Command as Command3 } from "commander";
8
8
 
9
9
  // src/config.ts
@@ -206,10 +206,10 @@ import { join as join2 } from "path";
206
206
 
207
207
  // src/release.ts
208
208
  var SDK_RELEASE = {
209
- version: "0.1.74",
210
- apiContract: "2026-06-dataset-column-syntax-cutover",
209
+ version: "0.1.77",
210
+ apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
211
211
  supportPolicy: {
212
- latest: "0.1.74",
212
+ latest: "0.1.77",
213
213
  minimumSupported: "0.1.53",
214
214
  deprecatedBelow: "0.1.53"
215
215
  }
@@ -556,7 +556,7 @@ function decodeSseFrame(frame) {
556
556
  return parsed;
557
557
  }
558
558
  function sleep(ms) {
559
- return new Promise((resolve12) => setTimeout(resolve12, ms));
559
+ return new Promise((resolve13) => setTimeout(resolve13, ms));
560
560
  }
561
561
 
562
562
  // src/client.ts
@@ -566,7 +566,7 @@ var EXECUTE_RESPONSE_CONTRACT_HEADER = "x-deepline-execute-response-contract";
566
566
  var V2_EXECUTE_RESPONSE_CONTRACT = "v2-tool-response";
567
567
  var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
568
568
  function sleep2(ms) {
569
- return new Promise((resolve12) => setTimeout(resolve12, ms));
569
+ return new Promise((resolve13) => setTimeout(resolve13, ms));
570
570
  }
571
571
  function isTransientCompileManifestError(error) {
572
572
  if (error instanceof DeeplineError && typeof error.statusCode === "number") {
@@ -1092,6 +1092,9 @@ var DeeplineClient = class {
1092
1092
  async checkPlayArtifact(input2) {
1093
1093
  return this.http.post("/api/v2/plays/check", input2);
1094
1094
  }
1095
+ async compileEnrichPlan(input2) {
1096
+ return this.http.post("/api/v2/enrich/compile", input2);
1097
+ }
1095
1098
  async startPlayRunFromBundle(input2) {
1096
1099
  const compilerManifest = input2.compilerManifest ?? await this.compilePlayManifest({
1097
1100
  name: input2.name,
@@ -2380,7 +2383,7 @@ function buildCandidateUrls2(url) {
2380
2383
  }
2381
2384
  }
2382
2385
  function sleep3(ms) {
2383
- return new Promise((resolve12) => setTimeout(resolve12, ms));
2386
+ return new Promise((resolve13) => setTimeout(resolve13, ms));
2384
2387
  }
2385
2388
  function printDeeplineLogo() {
2386
2389
  if (process.stdout.isTTY && (process.stdout.columns ?? 80) >= 70) {
@@ -3758,38 +3761,38 @@ function buildDatasetStats(rows, totalRows = rows.length, columns = inferColumns
3758
3761
  }
3759
3762
  }
3760
3763
  const denominator = nonEmpty + empty;
3761
- const stat3 = {
3764
+ const stat4 = {
3762
3765
  non_empty: percentText(nonEmpty, denominator),
3763
3766
  unique: valueCounts.size
3764
3767
  };
3765
3768
  const rawExecutionStats = executionStats?.columnStats[column];
3766
3769
  if (rawExecutionStats) {
3767
- stat3.execution = formatDatasetExecutionStats(
3770
+ stat4.execution = formatDatasetExecutionStats(
3768
3771
  rawExecutionStats,
3769
3772
  totalRows
3770
3773
  );
3771
3774
  }
3772
3775
  if (sampleValue !== void 0 && sampleValueType) {
3773
- stat3.sample_value = sampleValue;
3774
- stat3.sample_type = sampleValueType;
3776
+ stat4.sample_value = sampleValue;
3777
+ stat4.sample_type = sampleValueType;
3775
3778
  }
3776
3779
  if (valueCounts.size > 0 && valueCounts.size < nonEmpty) {
3777
3780
  const top = [...valueCounts.entries()].sort((left, right) => right[1] - left[1]).slice(0, 3);
3778
3781
  const topKeys = new Set(top.map(([key]) => key));
3779
3782
  const otherCount = [...valueCounts.entries()].filter(([key]) => !topKeys.has(key)).reduce((sum, [, count]) => sum + count, 0);
3780
- stat3.top_values = Object.fromEntries(
3783
+ stat4.top_values = Object.fromEntries(
3781
3784
  top.map(([key, count]) => [key, countPercentText(count, denominator)])
3782
3785
  );
3783
3786
  if (otherCount > 0) {
3784
- stat3.top_values["(other)"] = countPercentText(otherCount, denominator);
3787
+ stat4.top_values["(other)"] = countPercentText(otherCount, denominator);
3785
3788
  }
3786
3789
  if (empty > 0) {
3787
- stat3.top_values["(null)"] = countPercentText(empty, denominator);
3790
+ stat4.top_values["(null)"] = countPercentText(empty, denominator);
3788
3791
  }
3789
3792
  } else if (empty > 0 && nonEmpty > 0) {
3790
- stat3.top_values = { "(null)": countPercentText(empty, denominator) };
3793
+ stat4.top_values = { "(null)": countPercentText(empty, denominator) };
3791
3794
  }
3792
- columnStats[column] = stat3;
3795
+ columnStats[column] = stat4;
3793
3796
  }
3794
3797
  return {
3795
3798
  total_rows: totalRows,
@@ -4170,13 +4173,18 @@ function registerDbCommands(program) {
4170
4173
  "after",
4171
4174
  `
4172
4175
  Notes:
4173
- Runs SQL against the active workspace customer database through Deepline APIs.
4176
+ Agent-safe SQL for the active workspace customer database.
4177
+ Reads: SELECT, EXPLAIN, and read-only WITH can inspect permitted schemas.
4178
+ Writes: CREATE TABLE, INSERT, UPDATE, DELETE, ALTER, DROP, TRUNCATE, and
4179
+ CREATE INDEX must target schema-qualified storage tables, such as storage.agent_notes.
4180
+ If CREATE TABLE blocked (...) fails, use CREATE TABLE storage.blocked (...).
4174
4181
  Results are bounded by the server and --max-rows. Use --json for stable output.
4175
4182
  Use --format csv or --format markdown for agent-readable exports and display tables.
4176
4183
 
4177
4184
  Examples:
4178
4185
  deepline db query --sql "select * from companies limit 20"
4179
4186
  deepline db query --sql "select domain, name from companies limit 20" --json
4187
+ deepline db query --sql "create table if not exists storage.agent_notes (id text primary key, note text not null)"
4180
4188
  deepline db query --sql "select * from contacts" --max-rows 100 --json
4181
4189
  deepline db query --sql "select * from contacts limit 20" --format csv --out contacts.csv
4182
4190
  deepline db query --sql "select domain, name from companies limit 20" --format markdown
@@ -4188,12 +4196,16 @@ Examples:
4188
4196
  Notes:
4189
4197
  Requires --sql. Output is a compact table in a terminal and raw JSON with
4190
4198
  --json or when stdout is piped. The active auth workspace determines scope.
4199
+ Read permitted schemas with SELECT, EXPLAIN, or read-only WITH.
4200
+ Write only to schema-qualified storage tables. For example, use
4201
+ CREATE TABLE storage.blocked (...) instead of CREATE TABLE blocked (...).
4191
4202
  --format csv and --format markdown are explicit data/display formats and can
4192
4203
  be written directly with --out.
4193
4204
 
4194
4205
  Examples:
4195
4206
  deepline db query --sql "select * from companies limit 20"
4196
4207
  deepline db query --sql "select domain, name from companies limit 20" --json
4208
+ deepline db query --sql "create table if not exists storage.agent_notes (id text primary key, note text not null)"
4197
4209
  deepline db psql --sql "select count(*) from contacts" --json
4198
4210
  deepline db query --sql "select * from contacts limit 20" --format csv --out contacts.csv
4199
4211
  deepline db query --sql "select domain, name from companies limit 20" --format markdown
@@ -4213,210 +4225,10 @@ Examples:
4213
4225
  });
4214
4226
  }
4215
4227
 
4216
- // src/cli/commands/feedback.ts
4217
- async function handleFeedback(text, options) {
4218
- const { http } = getAuthedHttpClient();
4219
- const response = await http.post("/api/v2/cli/feedback", {
4220
- text,
4221
- environment: collectLocalEnvInfo(),
4222
- ...options.command ? { command: options.command } : {},
4223
- ...options.payload ? { payload: options.payload } : {}
4224
- });
4225
- printCommandEnvelope(
4226
- {
4227
- ...response,
4228
- render: {
4229
- sections: [
4230
- { title: "feedback", lines: ["Feedback submitted. Thank you."] }
4231
- ]
4232
- }
4233
- },
4234
- { json: options.json }
4235
- );
4236
- }
4237
- function registerFeedbackCommands(program) {
4238
- const feedback = program.command("feedback").description("Submit CLI feedback to Deepline.").addHelpText(
4239
- "after",
4240
- `
4241
- Notes:
4242
- Sends the feedback text plus local CLI environment info to Deepline support.
4243
- Use --command and --payload to attach a reproducible command shape.
4244
-
4245
- Examples:
4246
- deepline feedback "plays run failed after upload" --command "deepline plays run my.play.ts --watch"
4247
- deepline feedback "unexpected billing output" --payload '{"command":"billing usage"}' --json
4248
- `
4249
- );
4250
- feedback.argument("<text>", "Feedback text").option("--command <command>", "Command that reproduced the issue").option("--payload <payload>", "JSON or plain-text payload for the repro").option("--json", "Emit JSON output").action(handleFeedback);
4251
- program.command("provide-feedback").description("Legacy alias for `deepline feedback`.").addHelpText(
4252
- "after",
4253
- `
4254
- Notes:
4255
- Compatibility alias. Prefer deepline feedback in new scripts and docs.
4256
-
4257
- Examples:
4258
- deepline feedback "tools search returned stale results" --json
4259
- `
4260
- ).argument("<text>", "Feedback text").option("--command <command>", "Command that reproduced the issue").option("--payload <payload>", "JSON or plain-text payload for the repro").option("--json", "Emit JSON output").action(handleFeedback);
4261
- }
4262
-
4263
- // src/cli/commands/org.ts
4264
- async function fetchOrganizations(http, apiKey) {
4265
- return http.post("/api/v2/auth/cli/organizations", { api_key: apiKey });
4266
- }
4267
- function orgListLines(orgs) {
4268
- return orgs.map((org, index) => {
4269
- const current = org.is_current ? " (current)" : "";
4270
- const role = org.role ? ` [${org.role}]` : "";
4271
- return `${index + 1}. ${org.name}${role}${current}`;
4272
- });
4273
- }
4274
- async function handleOrgList(options) {
4275
- const config = resolveConfig();
4276
- const http = new HttpClient(config);
4277
- const payload = await fetchOrganizations(http, config.apiKey);
4278
- printCommandEnvelope(
4279
- {
4280
- ...payload,
4281
- render: {
4282
- sections: [
4283
- {
4284
- title: "Your organizations:",
4285
- lines: orgListLines(payload.organizations)
4286
- }
4287
- ]
4288
- }
4289
- },
4290
- { json: options.json }
4291
- );
4292
- }
4293
- async function handleOrgSwitch(selection, options) {
4294
- const config = resolveConfig();
4295
- const http = new HttpClient(config);
4296
- const payload = await fetchOrganizations(http, config.apiKey);
4297
- if (!selection && !options.orgId) {
4298
- printCommandEnvelope(
4299
- {
4300
- ...payload,
4301
- next: { switch: "deepline org switch <number>" },
4302
- render: {
4303
- sections: [
4304
- {
4305
- title: "Your organizations:",
4306
- lines: orgListLines(payload.organizations)
4307
- }
4308
- ],
4309
- actions: [{ label: "Run", command: "deepline org switch <number>" }]
4310
- }
4311
- },
4312
- { json: options.json }
4313
- );
4314
- return;
4315
- }
4316
- let target = payload.organizations.find(
4317
- (org) => org.org_id === options.orgId
4318
- );
4319
- if (!target && selection) {
4320
- const index = Number.parseInt(selection, 10);
4321
- if (Number.isFinite(index) && index >= 1 && index <= payload.organizations.length) {
4322
- target = payload.organizations[index - 1];
4323
- } else {
4324
- target = payload.organizations.find(
4325
- (org) => org.name === selection || org.org_id === selection
4326
- );
4327
- }
4328
- }
4329
- if (!target) {
4330
- throw new Error("Could not resolve the selected organization.");
4331
- }
4332
- if (target.is_current) {
4333
- printCommandEnvelope(
4334
- {
4335
- ok: true,
4336
- unchanged: true,
4337
- organization: target,
4338
- render: {
4339
- sections: [
4340
- { title: "org switch", lines: [`Already on ${target.name}.`] }
4341
- ]
4342
- }
4343
- },
4344
- { json: options.json }
4345
- );
4346
- return;
4347
- }
4348
- const switched = await http.post("/api/v2/auth/cli/switch", {
4349
- api_key: config.apiKey,
4350
- org_id: target.org_id
4351
- });
4352
- saveHostEnvValues(config.baseUrl, {
4353
- DEEPLINE_API_KEY: switched.api_key,
4354
- DEEPLINE_ACTIVE_ORG_ID: switched.org_id,
4355
- DEEPLINE_ACTIVE_ORG_NAME: switched.org_name
4356
- });
4357
- const { api_key: _apiKey, ...publicSwitched } = switched;
4358
- printCommandEnvelope(
4359
- {
4360
- ok: true,
4361
- host_env_path: hostEnvFilePath(config.baseUrl),
4362
- ...publicSwitched,
4363
- api_key_saved: true,
4364
- render: {
4365
- sections: [
4366
- {
4367
- title: "org switch",
4368
- lines: [
4369
- `Switched to ${switched.org_name}.`,
4370
- `Saved host auth in ${hostEnvFilePath(config.baseUrl)}`
4371
- ]
4372
- }
4373
- ]
4374
- }
4375
- },
4376
- { json: options.json }
4377
- );
4378
- }
4379
- function registerOrgCommands(program) {
4380
- const org = program.command("org").description("List and switch organizations.").addHelpText(
4381
- "after",
4382
- `
4383
- Notes:
4384
- Organizations are workspaces. Switching organizations mutates the saved host
4385
- auth file so later CLI commands target the selected workspace.
4386
-
4387
- Examples:
4388
- deepline org list --json
4389
- deepline org switch 2
4390
- deepline org switch --org-id org_123 --json
4391
- `
4392
- );
4393
- org.command("list").description("List your organizations.").addHelpText(
4394
- "after",
4395
- `
4396
- Notes:
4397
- Read-only. Marks the active organization when the server returns that metadata.
4398
-
4399
- Examples:
4400
- deepline org list
4401
- deepline org list --json
4402
- `
4403
- ).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleOrgList);
4404
- org.command("switch [selection]").description(
4405
- "Switch to another organization and save the new API key in the host auth file."
4406
- ).addHelpText(
4407
- "after",
4408
- `
4409
- Notes:
4410
- Mutates the saved host auth file. Selection can be a list number, exact
4411
- organization name, or organization id. Without a selection, prints choices.
4412
-
4413
- Examples:
4414
- deepline org switch
4415
- deepline org switch 2
4416
- deepline org switch --org-id org_123 --json
4417
- `
4418
- ).option("--org-id <id>", "Switch using an explicit organization id").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleOrgSwitch);
4419
- }
4228
+ // src/cli/commands/enrich.ts
4229
+ import { mkdtemp, readFile as readFile3, rm, stat as stat3, writeFile as writeFile4 } from "fs/promises";
4230
+ import { homedir as homedir4, tmpdir as tmpdir3 } from "os";
4231
+ import { join as join8, resolve as resolve11 } from "path";
4420
4232
 
4421
4233
  // src/cli/commands/play.ts
4422
4234
  import { createHash as createHash3 } from "crypto";
@@ -6721,54 +6533,54 @@ function exampleValueComment(field) {
6721
6533
  if (field === "roles" || field.endsWith("s")) return '["..."]';
6722
6534
  return '"..."';
6723
6535
  }
6724
- function generateContactInputObjectFromSchema(schema, indent, label, fallbackFields = ["first_name", "last_name", "domain"]) {
6536
+ function generateContactInputObjectFromSchema(schema, indent2, label, fallbackFields = ["first_name", "last_name", "domain"]) {
6725
6537
  const details = schemaFieldDetails(schema);
6726
6538
  const required = details.required.length ? details.required : fallbackFields;
6727
6539
  const optional = details.optional;
6728
6540
  const lines = [
6729
- `${indent}// TODO: map row fields into ${label}.`,
6730
- ...playInspectionComments(label, indent),
6731
- `${indent}// Required: ${required.join(", ") || "none declared"}.`
6541
+ `${indent2}// TODO: map row fields into ${label}.`,
6542
+ ...playInspectionComments(label, indent2),
6543
+ `${indent2}// Required: ${required.join(", ") || "none declared"}.`
6732
6544
  ];
6733
6545
  for (const field of required) {
6734
- lines.push(`${indent}// ${field}: row["TODO_SOURCE_FIELD"],`);
6546
+ lines.push(`${indent2}// ${field}: row["TODO_SOURCE_FIELD"],`);
6735
6547
  }
6736
6548
  if (optional.length > 0) {
6737
6549
  lines.push("");
6738
- lines.push(`${indent}// optional (delete unused):`);
6550
+ lines.push(`${indent2}// optional (delete unused):`);
6739
6551
  for (const field of optional) {
6740
- lines.push(`${indent}// ${field}: row["TODO_SOURCE_FIELD"],`);
6552
+ lines.push(`${indent2}// ${field}: row["TODO_SOURCE_FIELD"],`);
6741
6553
  }
6742
6554
  }
6743
6555
  return `{
6744
6556
  ${lines.join("\n")}
6745
- ${indent.slice(2)}}`;
6557
+ ${indent2.slice(2)}}`;
6746
6558
  }
6747
- function generateCompanyInputObjectFromSchema(schema, indent, label, fallbackFields = ["domain", "company_name"]) {
6559
+ function generateCompanyInputObjectFromSchema(schema, indent2, label, fallbackFields = ["domain", "company_name"]) {
6748
6560
  const details = schemaFieldDetails(schema);
6749
6561
  const required = details.required.length ? details.required : fallbackFields;
6750
6562
  const optional = details.optional;
6751
6563
  const lines = [
6752
- `${indent}// TODO: map company fields into ${label}.`,
6753
- ...playInspectionComments(label, indent),
6754
- `${indent}// Required: ${required.join(", ") || "none declared"}.`
6564
+ `${indent2}// TODO: map company fields into ${label}.`,
6565
+ ...playInspectionComments(label, indent2),
6566
+ `${indent2}// Required: ${required.join(", ") || "none declared"}.`
6755
6567
  ];
6756
6568
  for (const field of required) {
6757
- lines.push(`${indent}// ${field}: company["TODO_SOURCE_FIELD"],`);
6569
+ lines.push(`${indent2}// ${field}: company["TODO_SOURCE_FIELD"],`);
6758
6570
  }
6759
6571
  if (optional.length > 0) {
6760
6572
  lines.push("");
6761
- lines.push(`${indent}// optional (delete unused):`);
6573
+ lines.push(`${indent2}// optional (delete unused):`);
6762
6574
  for (const field of optional) {
6763
- lines.push(`${indent}// ${field}: company["TODO_SOURCE_FIELD"],`);
6575
+ lines.push(`${indent2}// ${field}: company["TODO_SOURCE_FIELD"],`);
6764
6576
  }
6765
6577
  }
6766
6578
  return `{
6767
6579
  ${lines.join("\n")}
6768
- ${indent.slice(2)}}`;
6580
+ ${indent2.slice(2)}}`;
6769
6581
  }
6770
6582
  function generateSourceProviderInputObject(input2) {
6771
- const { tool, indent, label, entity } = input2;
6583
+ const { tool, indent: indent2, label, entity } = input2;
6772
6584
  const properties = inputPropertyNames(tool?.inputSchema);
6773
6585
  const details = schemaFieldDetails(tool?.inputSchema);
6774
6586
  const required = details.required;
@@ -6789,18 +6601,18 @@ function generateSourceProviderInputObject(input2) {
6789
6601
  ].includes(field)
6790
6602
  );
6791
6603
  const lines = [
6792
- `${indent}// TODO: fill ${entity} source inputs for ${label}.`,
6793
- `${indent}// Inspect: deepline tools describe ${label} --json`
6604
+ `${indent2}// TODO: fill ${entity} source inputs for ${label}.`,
6605
+ `${indent2}// Inspect: deepline tools describe ${label} --json`
6794
6606
  ];
6795
6607
  for (const field of required) {
6796
- lines.push(`${indent}// ${field}: ${exampleValueComment(field)},`);
6608
+ lines.push(`${indent2}// ${field}: ${exampleValueComment(field)},`);
6797
6609
  }
6798
6610
  const activeTodoField = required.length === 0 ? ["query", "q", "search", "title", "role", "persona"].find(
6799
6611
  (field) => includeOptional.includes(field)
6800
6612
  ) ?? "query" : null;
6801
6613
  if (activeTodoField) {
6802
6614
  lines.push(
6803
- `${indent}// ${activeTodoField}: ${exampleValueComment(activeTodoField)},`
6615
+ `${indent2}// ${activeTodoField}: ${exampleValueComment(activeTodoField)},`
6804
6616
  );
6805
6617
  }
6806
6618
  const optionalExamples = includeOptional.filter(
@@ -6808,40 +6620,40 @@ function generateSourceProviderInputObject(input2) {
6808
6620
  );
6809
6621
  if (optionalExamples.length > 0) {
6810
6622
  lines.push("");
6811
- lines.push(`${indent}// optional - uncomment what this provider supports:`);
6623
+ lines.push(`${indent2}// optional - uncomment what this provider supports:`);
6812
6624
  for (const field of optionalExamples) {
6813
6625
  if (field === "limit" || field === "numResults" || field === "num_results" || field === "page_size") {
6814
- lines.push(`${indent}// ${field}: limit,`);
6626
+ lines.push(`${indent2}// ${field}: limit,`);
6815
6627
  } else {
6816
- lines.push(`${indent}// ${field}: ${exampleValueComment(field)},`);
6628
+ lines.push(`${indent2}// ${field}: ${exampleValueComment(field)},`);
6817
6629
  }
6818
6630
  }
6819
6631
  }
6820
6632
  if (!required.some(
6821
6633
  (field) => ["limit", "numResults", "num_results", "page_size"].includes(field)
6822
6634
  )) {
6823
- lines.push(`${indent}limit,`);
6635
+ lines.push(`${indent2}limit,`);
6824
6636
  }
6825
6637
  return `{
6826
6638
  ${lines.join("\n")}
6827
- ${indent.slice(2)}}`;
6639
+ ${indent2.slice(2)}}`;
6828
6640
  }
6829
6641
  function generatePlayInputObject(input2) {
6830
- const { schema, indent, label, entity } = input2;
6642
+ const { schema, indent: indent2, label, entity } = input2;
6831
6643
  const details = schemaFieldDetails(schema);
6832
6644
  const fallback = entity === "company" ? ["domain", "company_name"] : ["first_name", "last_name", "domain"];
6833
6645
  const required = details.required.length ? details.required : fallback;
6834
6646
  const lines = [
6835
- `${indent}// TODO: fill source play inputs for ${label}.`,
6836
- ...playInspectionComments(label, indent)
6647
+ `${indent2}// TODO: fill source play inputs for ${label}.`,
6648
+ ...playInspectionComments(label, indent2)
6837
6649
  ];
6838
6650
  for (const field of required) {
6839
- lines.push(`${indent}// ${field}: ${exampleValueComment(field)},`);
6651
+ lines.push(`${indent2}// ${field}: ${exampleValueComment(field)},`);
6840
6652
  }
6841
- if (!required.includes("limit")) lines.push(`${indent}limit,`);
6653
+ if (!required.includes("limit")) lines.push(`${indent2}limit,`);
6842
6654
  return `{
6843
6655
  ${lines.join("\n")}
6844
- ${indent.slice(2)}}`;
6656
+ ${indent2.slice(2)}}`;
6845
6657
  }
6846
6658
  function requiredPlayInputFields(play) {
6847
6659
  const schema = play?.inputSchema;
@@ -6882,8 +6694,8 @@ function finderProviderStepPrefix(finder) {
6882
6694
  function safeIdentifier(value) {
6883
6695
  return value.replace(/[^A-Za-z0-9_]+/g, "_");
6884
6696
  }
6885
- function playInspectionComments(playRef, indent) {
6886
- return [`${indent}// Inspect: deepline plays describe ${playRef} --json`];
6697
+ function playInspectionComments(playRef, indent2) {
6698
+ return [`${indent2}// Inspect: deepline plays describe ${playRef} --json`];
6887
6699
  }
6888
6700
  function accessorExpression(base, field) {
6889
6701
  return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(field) ? `${base}.${field}` : `${base}[${jsString(field)}]`;
@@ -7982,7 +7794,7 @@ function traceCliSync(phase, fields, run) {
7982
7794
  }
7983
7795
  }
7984
7796
  function sleep4(ms) {
7985
- return new Promise((resolve12) => setTimeout(resolve12, ms));
7797
+ return new Promise((resolve13) => setTimeout(resolve13, ms));
7986
7798
  }
7987
7799
  function parseReferencedPlayTarget2(target) {
7988
7800
  const trimmed = target.trim();
@@ -9625,20 +9437,20 @@ function attachDatasetStatsToResult(result, datasetStats) {
9625
9437
  };
9626
9438
  return attach(result, "");
9627
9439
  }
9628
- function formatDatasetStatsLines(datasetStats, indent = " ") {
9440
+ function formatDatasetStatsLines(datasetStats, indent2 = " ") {
9629
9441
  if (!datasetStats) {
9630
9442
  return [];
9631
9443
  }
9632
- const lines = [`${indent}summary:`];
9633
- for (const [column, stat3] of Object.entries(datasetStats.columnStats).slice(
9444
+ const lines = [`${indent2}summary:`];
9445
+ for (const [column, stat4] of Object.entries(datasetStats.columnStats).slice(
9634
9446
  0,
9635
9447
  12
9636
9448
  )) {
9637
- const topValues = stat3.top_values ? `, top_values=${Object.entries(stat3.top_values).slice(0, 3).map(([value, count]) => `${value}=${count}`).join(", ")}` : "";
9638
- const sample = stat3.sample_value !== void 0 ? `, sample_value=${JSON.stringify(stat3.sample_value)}` : "";
9639
- const execution = stat3.execution ? `, execution=${Object.entries(stat3.execution).map(([bucket, count]) => `${bucket}=${count}`).join(", ")}` : "";
9449
+ const topValues = stat4.top_values ? `, top_values=${Object.entries(stat4.top_values).slice(0, 3).map(([value, count]) => `${value}=${count}`).join(", ")}` : "";
9450
+ const sample = stat4.sample_value !== void 0 ? `, sample_value=${JSON.stringify(stat4.sample_value)}` : "";
9451
+ const execution = stat4.execution ? `, execution=${Object.entries(stat4.execution).map(([bucket, count]) => `${bucket}=${count}`).join(", ")}` : "";
9640
9452
  lines.push(
9641
- `${indent} ${column}: non_empty=${stat3.non_empty}, unique=${stat3.unique}${topValues}${sample}${execution}`
9453
+ `${indent2} ${column}: non_empty=${stat4.non_empty}, unique=${stat4.unique}${topValues}${sample}${execution}`
9642
9454
  );
9643
9455
  }
9644
9456
  return lines;
@@ -9679,7 +9491,7 @@ function formatSummaryScalarParts(record, skipKeys = /* @__PURE__ */ new Set())
9679
9491
  }
9680
9492
  return parts;
9681
9493
  }
9682
- function formatPackageDatasetSummaryLines(summary, indent = " ") {
9494
+ function formatPackageDatasetSummaryLines(summary, indent2 = " ") {
9683
9495
  const record = readRecord(summary);
9684
9496
  const columnStats = readRecord(record?.columnStats);
9685
9497
  if (!record || !columnStats) {
@@ -9688,7 +9500,7 @@ function formatPackageDatasetSummaryLines(summary, indent = " ") {
9688
9500
  const lines = [];
9689
9501
  const parts = formatSummaryScalarParts(record, /* @__PURE__ */ new Set(["columnStats"]));
9690
9502
  if (parts.length > 0) {
9691
- lines.push(`${indent}summary: ${parts.join(" ")}`);
9503
+ lines.push(`${indent2}summary: ${parts.join(" ")}`);
9692
9504
  }
9693
9505
  for (const [column, rawColumnSummary] of Object.entries(columnStats)) {
9694
9506
  const columnSummary = readRecord(rawColumnSummary);
@@ -9700,7 +9512,7 @@ function formatPackageDatasetSummaryLines(summary, indent = " ") {
9700
9512
  executionText ? `execution=${executionText}` : null
9701
9513
  ].filter(Boolean);
9702
9514
  if (columnParts.length > 0) {
9703
- lines.push(`${indent} ${column}: ${columnParts.join(" ")}`);
9515
+ lines.push(`${indent2} ${column}: ${columnParts.join(" ")}`);
9704
9516
  }
9705
9517
  }
9706
9518
  return lines;
@@ -11910,9 +11722,11 @@ Idempotent execution:
11910
11722
  .run({ key: 'domain' });
11911
11723
 
11912
11724
  Reuse needs the same play, tool id, dataset name, row key, and compatible logic.
11913
- To refresh, change the id/dataset key or set staleAfterSeconds:
11725
+ To recompute a visible cell on a later cron/user run after a window, put
11726
+ staleAfterSeconds on the cell-producing column:
11914
11727
 
11915
- .run({ key: 'domain', staleAfterSeconds: 86400 })
11728
+ .withColumn('cto', resolver, { staleAfterSeconds: 86400 })
11729
+ .run({ key: 'domain' })
11916
11730
 
11917
11731
  Examples:
11918
11732
  deepline plays run my.play.ts --input '{"domain":"stripe.com"}'
@@ -12441,7 +12255,9 @@ async function handlePlayShareStatus(args) {
12441
12255
  );
12442
12256
  return 0;
12443
12257
  }
12444
- console.log(`${status.playName}: published v${status.share.publishedVersion}`);
12258
+ console.log(
12259
+ `${status.playName}: published v${status.share.publishedVersion}`
12260
+ );
12445
12261
  console.log(` url: ${status.share.publicPath}`);
12446
12262
  console.log(` seo: ${status.share.seoIndexing}`);
12447
12263
  console.log(
@@ -12603,7 +12419,9 @@ async function handlePlayShareRegenerate(args) {
12603
12419
  async function handlePlayShareUnpublish(args) {
12604
12420
  const target = args[0];
12605
12421
  if (!target) {
12606
- console.error("Usage: deepline plays share unpublish <play> --yes [--json]");
12422
+ console.error(
12423
+ "Usage: deepline plays share unpublish <play> --yes [--json]"
12424
+ );
12607
12425
  return 2;
12608
12426
  }
12609
12427
  if (!args.includes("--yes")) {
@@ -12623,53 +12441,1194 @@ async function handlePlayShareUnpublish(args) {
12623
12441
  return 0;
12624
12442
  }
12625
12443
 
12626
- // src/cli/commands/secrets.ts
12627
- import { stdin as input, stdout as output } from "process";
12628
- var hiddenInputBuffer = "";
12629
- function normalizeSecretName(value) {
12630
- const normalized = value.trim().toUpperCase();
12631
- if (!/^[A-Z][A-Z0-9_]{1,63}$/.test(normalized)) {
12632
- throw new Error(
12633
- "Secret names must be 2-64 characters and use uppercase letters, numbers, and underscores."
12634
- );
12444
+ // src/cli/enrich-play-compiler.ts
12445
+ var RESERVED_WORDS = /* @__PURE__ */ new Set([
12446
+ "break",
12447
+ "case",
12448
+ "catch",
12449
+ "class",
12450
+ "const",
12451
+ "continue",
12452
+ "debugger",
12453
+ "default",
12454
+ "delete",
12455
+ "do",
12456
+ "else",
12457
+ "export",
12458
+ "extends",
12459
+ "finally",
12460
+ "for",
12461
+ "function",
12462
+ "if",
12463
+ "import",
12464
+ "in",
12465
+ "instanceof",
12466
+ "new",
12467
+ "return",
12468
+ "super",
12469
+ "switch",
12470
+ "this",
12471
+ "throw",
12472
+ "try",
12473
+ "typeof",
12474
+ "var",
12475
+ "void",
12476
+ "while",
12477
+ "with",
12478
+ "yield"
12479
+ ]);
12480
+ function isWaterfall(command) {
12481
+ return "with_waterfall" in command;
12482
+ }
12483
+ function safeIdentifier2(value, fallback) {
12484
+ const cleaned = value.replace(/[^A-Za-z0-9_$]/g, "_");
12485
+ const prefixed = /^[A-Za-z_$]/.test(cleaned) ? cleaned : `_${cleaned}`;
12486
+ if (!prefixed || RESERVED_WORDS.has(prefixed)) {
12487
+ return fallback;
12635
12488
  }
12636
- return normalized;
12489
+ return prefixed;
12637
12490
  }
12638
- function renderSecret(secret) {
12639
- const scope = secret.scope === "play" && secret.playName ? `play:${secret.playName}` : secret.scope;
12640
- return `${secret.name} (${scope}) - ${secret.status}${secret.hasValue ? ", set" : ", empty"}`;
12491
+ function stringLiteral(value) {
12492
+ return JSON.stringify(value);
12641
12493
  }
12642
- async function readHiddenLine(prompt) {
12643
- if (!input.isTTY || !output.isTTY) {
12644
- throw new Error(
12645
- "Secret values must be entered from an interactive TTY. Do not pipe, pass, or script secret values."
12494
+ function stableJson(value) {
12495
+ if (Array.isArray(value)) {
12496
+ return `[${value.map(stableJson).join(",")}]`;
12497
+ }
12498
+ if (value && typeof value === "object") {
12499
+ const entries = Object.entries(value).sort(
12500
+ ([left], [right]) => left.localeCompare(right)
12646
12501
  );
12502
+ return `{${entries.map(([key, entry]) => `${JSON.stringify(key)}:${stableJson(entry)}`).join(",")}}`;
12647
12503
  }
12648
- output.write(prompt);
12649
- const previousRawMode = input.isRaw;
12650
- if (typeof input.setRawMode === "function") input.setRawMode(true);
12651
- let value = "";
12652
- input.resume();
12653
- return await new Promise((resolve12, reject) => {
12654
- let settled = false;
12655
- const cleanup = () => {
12656
- input.off("data", onData);
12657
- input.off("end", onEnd);
12658
- input.off("error", onError);
12659
- if (typeof input.setRawMode === "function") {
12660
- input.setRawMode(previousRawMode);
12661
- }
12662
- };
12663
- const finish = (line) => {
12664
- if (settled) return;
12665
- settled = true;
12666
- output.write("\n");
12667
- cleanup();
12668
- resolve12(line);
12669
- };
12670
- const fail = (error) => {
12671
- if (settled) return;
12672
- settled = true;
12504
+ return JSON.stringify(value);
12505
+ }
12506
+ function indent(source, spaces) {
12507
+ const pad = " ".repeat(spaces);
12508
+ return source.split("\n").map((line) => line ? `${pad}${line}` : line).join("\n");
12509
+ }
12510
+ function commandCallId(command) {
12511
+ return `${command.alias}__${command.tool}`;
12512
+ }
12513
+ function normalizeAlias(value) {
12514
+ return value.toLowerCase().replace(/[^a-z0-9]/g, "");
12515
+ }
12516
+ function renderExecuteStep(command, options = { force: false }) {
12517
+ const alias = stringLiteral(command.alias);
12518
+ const callId = stringLiteral(commandCallId(command));
12519
+ const tool = stringLiteral(command.tool);
12520
+ const payload = stableJson(command.payload ?? {});
12521
+ const extractJs = command.extract_js ? `({ row, result, data, raw, pick, extract, target }) => { const input = row; const context = row;
12522
+ ${indent(renderJavascriptBody(command.extract_js), 6)}
12523
+ }` : "null";
12524
+ const runIfJs = command.run_if_js ? `(row) => { const input = row; const context = row;
12525
+ ${indent(renderJavascriptBody(command.run_if_js), 6)}
12526
+ }` : "null";
12527
+ const description = command.description ? `,
12528
+ description: ${stringLiteral(command.description)}` : "";
12529
+ const force = options.force ? `,
12530
+ force: true` : "";
12531
+ return [
12532
+ `async (row, stepCtx) => {`,
12533
+ ...options.precheck ? [` if (${options.precheck}) return null;`] : [],
12534
+ ` return __dlRunCommand({`,
12535
+ ` alias: ${alias},`,
12536
+ ` callId: ${callId},`,
12537
+ ` tool: ${tool},`,
12538
+ ` payload: ${payload},`,
12539
+ ` extract: ${extractJs},`,
12540
+ ` runIf: ${runIfJs},`,
12541
+ ` row,`,
12542
+ ` stepCtx${description}${force}`,
12543
+ ` });`,
12544
+ `}`
12545
+ ].join("\n");
12546
+ }
12547
+ function renderJavascriptBody(source) {
12548
+ const trimmed = source.trim();
12549
+ if (trimmed && !trimmed.includes("\n") && !trimmed.includes(";") && !/\breturn\b/.test(trimmed)) {
12550
+ return `return (${trimmed});`;
12551
+ }
12552
+ return source;
12553
+ }
12554
+ function renderWaterfallProgram(command, index, forceAliases) {
12555
+ const variableName = safeIdentifier2(
12556
+ `${command.with_waterfall}_${index}_waterfall`,
12557
+ `waterfall_${index}`
12558
+ );
12559
+ const stepLines = command.commands.map((nested, stepIndex) => {
12560
+ if (isWaterfall(nested)) {
12561
+ throw new Error("Nested with_waterfall blocks are not supported.");
12562
+ }
12563
+ if (nested.disabled) {
12564
+ return null;
12565
+ }
12566
+ const priorAliases = command.commands.slice(0, stepIndex).filter((prior) => !isWaterfall(prior)).filter((prior) => !prior.disabled).map((prior) => prior.alias);
12567
+ const minResults = typeof command.min_results === "number" ? Math.max(1, Math.trunc(command.min_results)) : 1;
12568
+ return [
12569
+ ` .step(${stringLiteral(nested.alias)},`,
12570
+ indent(
12571
+ renderExecuteStep(nested, {
12572
+ force: forceAliases.has(normalizeAlias(nested.alias)),
12573
+ precheck: priorAliases.length > 0 ? `__dlWaterfallSatisfied(row, ${stableJson(priorAliases)}, ${minResults})` : void 0
12574
+ }),
12575
+ 4
12576
+ ),
12577
+ ` )`
12578
+ ].join("\n");
12579
+ }).filter((line) => line !== null);
12580
+ const aliases = command.commands.filter((nested) => !isWaterfall(nested)).filter((nested) => !nested.disabled).map((nested) => nested.alias);
12581
+ const returnExpr = typeof command.min_results === "number" ? `__dlFirstMinResults(row, ${stableJson(aliases)}, ${Math.max(
12582
+ 1,
12583
+ Math.trunc(command.min_results)
12584
+ )})` : `__dlFirstMeaningful(row, ${stableJson(aliases)})`;
12585
+ return {
12586
+ variableName,
12587
+ hasSteps: stepLines.length > 0,
12588
+ source: [
12589
+ `const ${variableName} = steps<Record<string, unknown>>()`,
12590
+ ...stepLines,
12591
+ ` .return((row) => ${returnExpr});`
12592
+ ].join("\n")
12593
+ };
12594
+ }
12595
+ function compileEnrichConfigToPlaySource(config, options = {}) {
12596
+ const playName = options.playName ?? "deepline-enrich-v1-compat";
12597
+ const mapName = options.mapName ?? "deepline_enrich_rows";
12598
+ const forceAliases = new Set(
12599
+ [...options.forceAliases ?? []].map((alias) => normalizeAlias(alias))
12600
+ );
12601
+ const waterfalls = [];
12602
+ const mapSteps = [];
12603
+ config.commands.forEach((command, index) => {
12604
+ if (isWaterfall(command)) {
12605
+ const rendered = renderWaterfallProgram(command, index, forceAliases);
12606
+ if (!rendered.hasSteps) {
12607
+ return;
12608
+ }
12609
+ waterfalls.push({
12610
+ alias: command.with_waterfall,
12611
+ variableName: rendered.variableName,
12612
+ source: rendered.source
12613
+ });
12614
+ mapSteps.push(
12615
+ ` .step(${stringLiteral(command.with_waterfall)}, ${rendered.variableName})`
12616
+ );
12617
+ return;
12618
+ }
12619
+ if (command.disabled) {
12620
+ return;
12621
+ }
12622
+ mapSteps.push(
12623
+ [
12624
+ ` .step(${stringLiteral(command.alias)},`,
12625
+ indent(
12626
+ renderExecuteStep(command, {
12627
+ force: forceAliases.has(normalizeAlias(command.alias))
12628
+ }),
12629
+ 8
12630
+ ),
12631
+ ` )`
12632
+ ].join("\n")
12633
+ );
12634
+ });
12635
+ const waterfallSource = waterfalls.map((entry) => indent(entry.source, 4));
12636
+ const mapStepSource = mapSteps.length > 0 ? mapSteps.join("\n") : ` .step('noop', (row) => row)`;
12637
+ return [
12638
+ `import { definePlay, steps } from 'deepline';`,
12639
+ ``,
12640
+ `type EnrichInput = { file: string; rowStart?: number | null; rowEnd?: number | null };`,
12641
+ ``,
12642
+ helperSource(),
12643
+ ``,
12644
+ `export default definePlay(${stringLiteral(playName)}, async (ctx, input: EnrichInput) => {`,
12645
+ ` const allRows = await ctx.csv<Record<string, unknown>>(input.file);`,
12646
+ ` const rowStart = Number.isFinite(input.rowStart) ? Math.max(0, Math.trunc(Number(input.rowStart))) : 0;`,
12647
+ ` const rowEnd = Number.isFinite(input.rowEnd) ? Math.max(rowStart, Math.trunc(Number(input.rowEnd))) : allRows.length;`,
12648
+ ` const rows = allRows.slice(rowStart, rowEnd);`,
12649
+ ...waterfallSource,
12650
+ ` const enriched = await ctx`,
12651
+ ` .map(${stringLiteral(mapName)}, rows)`,
12652
+ mapStepSource,
12653
+ ` .run({ key: (row, index) => __dlStableRowKey(row, index + rowStart) });`,
12654
+ ` return { rows: enriched, count: await enriched.count() };`,
12655
+ `});`,
12656
+ ``
12657
+ ].join("\n");
12658
+ }
12659
+ function helperSource() {
12660
+ return [
12661
+ `function __dlGetByPath(root: unknown, path: string): unknown {`,
12662
+ ` return String(path || '')`,
12663
+ ` .replace(/\\[(\\d+)\\]/g, '.$1')`,
12664
+ ` .split('.')`,
12665
+ ` .map((part) => part.trim())`,
12666
+ ` .filter(Boolean)`,
12667
+ ` .reduce((cursor: unknown, part: string) => {`,
12668
+ ` if (!cursor || typeof cursor !== 'object') return undefined;`,
12669
+ ` const record = cursor as Record<string, unknown>;`,
12670
+ ` if (part in record) return record[part];`,
12671
+ ` const data = record.data;`,
12672
+ ` return data && typeof data === 'object' ? (data as Record<string, unknown>)[part] : undefined;`,
12673
+ ` }, root);`,
12674
+ `}`,
12675
+ ``,
12676
+ `function __dlMeaningful(value: unknown): boolean {`,
12677
+ ` return value !== null && value !== undefined && !(typeof value === 'string' && value.trim() === '') && !(Array.isArray(value) && value.length === 0);`,
12678
+ `}`,
12679
+ ``,
12680
+ `function __dlRawToolOutput(result: unknown): unknown {`,
12681
+ ` if (!result || typeof result !== 'object') return result;`,
12682
+ ` const record = result as Record<string, unknown>;`,
12683
+ ` return __dlGetByPath(record, 'toolOutput.raw') ?? __dlGetByPath(record, 'toolResponse.raw') ?? record.result ?? record.output ?? result;`,
12684
+ `}`,
12685
+ ``,
12686
+ `function __dlTemplate(value: unknown, row: Record<string, unknown>): unknown {`,
12687
+ ` if (Array.isArray(value)) return value.map((entry) => __dlTemplate(entry, row));`,
12688
+ ` if (value && typeof value === 'object') {`,
12689
+ ` return Object.fromEntries(Object.entries(value as Record<string, unknown>).map(([key, entry]) => [key, __dlTemplate(entry, row)]));`,
12690
+ ` }`,
12691
+ ` if (typeof value !== 'string') return value;`,
12692
+ ` const exact = value.match(/^\\{\\{\\s*([^{}]+?)\\s*\\}\\}$/);`,
12693
+ ` if (exact) return __dlGetByPath(row, exact[1] || '');`,
12694
+ ` return value.replace(/\\{\\{\\s*([^{}]+?)\\s*\\}\\}/g, (_match, path) => {`,
12695
+ ` const replacement = __dlGetByPath(row, String(path || ''));`,
12696
+ ` return replacement === null || replacement === undefined ? '' : String(replacement);`,
12697
+ ` });`,
12698
+ `}`,
12699
+ ``,
12700
+ `function __dlStableRowKey(row: Record<string, unknown>, index: number): string {`,
12701
+ ` for (const key of ['id', 'ID', 'email', 'Email', 'linkedin_url', 'LINKEDIN_URL', 'domain', 'DOMAIN']) {`,
12702
+ ` const value = row[key];`,
12703
+ ` if (__dlMeaningful(value)) return String(value);`,
12704
+ ` }`,
12705
+ ` return String(index);`,
12706
+ `}`,
12707
+ ``,
12708
+ `function __dlFirstMeaningful(row: Record<string, unknown>, aliases: string[]): unknown {`,
12709
+ ` for (const alias of aliases) {`,
12710
+ ` const value = row[alias];`,
12711
+ ` if (__dlMeaningful(value)) return value;`,
12712
+ ` }`,
12713
+ ` return null;`,
12714
+ `}`,
12715
+ ``,
12716
+ `function __dlFirstMinResults(row: Record<string, unknown>, aliases: string[], minResults: number): unknown {`,
12717
+ ` const values: unknown[] = [];`,
12718
+ ` for (const alias of aliases) {`,
12719
+ ` const value = row[alias];`,
12720
+ ` if (Array.isArray(value)) values.push(...value.filter(__dlMeaningful));`,
12721
+ ` else if (__dlMeaningful(value)) values.push(value);`,
12722
+ ` if (values.length >= minResults) return values.slice(0, minResults);`,
12723
+ ` }`,
12724
+ ` return values.length > 0 ? values : null;`,
12725
+ `}`,
12726
+ ``,
12727
+ `function __dlWaterfallSatisfied(row: Record<string, unknown>, aliases: string[], minResults: number): boolean {`,
12728
+ ` let count = 0;`,
12729
+ ` for (const alias of aliases) {`,
12730
+ ` const value = row[alias];`,
12731
+ ` if (Array.isArray(value)) count += value.filter(__dlMeaningful).length;`,
12732
+ ` else if (__dlMeaningful(value)) count += 1;`,
12733
+ ` if (count >= Math.max(1, Math.trunc(minResults))) return true;`,
12734
+ ` }`,
12735
+ ` return false;`,
12736
+ `}`,
12737
+ ``,
12738
+ `function __dlExtract(alias: string, result: unknown, row: Record<string, unknown>, extractor: ((args: { row: Record<string, unknown>; result: unknown; data: unknown; raw: unknown; pick: (paths: string[] | string) => unknown; extract: (paths: string[] | string) => unknown; target: (paths: string[] | string) => unknown }) => unknown) | null): unknown {`,
12739
+ ` const raw = __dlRawToolOutput(result);`,
12740
+ ` if (!extractor) return raw;`,
12741
+ ` const pick = (paths: string[] | string) => {`,
12742
+ ` const candidates = Array.isArray(paths) ? paths : [paths];`,
12743
+ ` for (const path of candidates) {`,
12744
+ ` const value = __dlGetByPath(raw, String(path));`,
12745
+ ` if (__dlMeaningful(value)) return value;`,
12746
+ ` }`,
12747
+ ` return null;`,
12748
+ ` };`,
12749
+ ` const extracted = extractor({ row, result, data: raw, raw, pick, extract: pick, target: pick });`,
12750
+ ` if (extracted && typeof extracted === 'object' && !Array.isArray(extracted) && alias in (extracted as Record<string, unknown>)) {`,
12751
+ ` return (extracted as Record<string, unknown>)[alias];`,
12752
+ ` }`,
12753
+ ` return extracted === undefined ? raw : extracted;`,
12754
+ `}`,
12755
+ ``,
12756
+ `async function __dlRunCommand(input: { alias: string; callId: string; tool: string; payload: Record<string, unknown>; extract: ((args: { row: Record<string, unknown>; result: unknown; data: unknown; raw: unknown; pick: (paths: string[] | string) => unknown; extract: (paths: string[] | string) => unknown; target: (paths: string[] | string) => unknown }) => unknown) | null; runIf: ((row: Record<string, unknown>) => unknown) | null; row: Record<string, unknown>; stepCtx: { tools: { execute: (request: Record<string, unknown>) => Promise<unknown> } }; description?: string; force?: boolean }): Promise<unknown> {`,
12757
+ ` if (input.runIf) {`,
12758
+ ` const shouldRun = input.runIf(input.row);`,
12759
+ ` if (!shouldRun) return null;`,
12760
+ ` }`,
12761
+ ` const result = await input.stepCtx.tools.execute({`,
12762
+ ` id: input.callId,`,
12763
+ ` tool: input.tool,`,
12764
+ ` input: __dlTemplate(input.payload, input.row) as Record<string, unknown>,`,
12765
+ ` ...(input.description ? { description: input.description } : {}),`,
12766
+ ` ...(input.force ? { staleAfterSeconds: 0 } : {}),`,
12767
+ ` });`,
12768
+ ` return __dlExtract(input.alias, result, input.row, input.extract);`,
12769
+ `}`
12770
+ ].join("\n");
12771
+ }
12772
+
12773
+ // src/cli/commands/enrich.ts
12774
+ var PLAN_SHAPING_OPTION_NAMES = [
12775
+ "with",
12776
+ "withWaterfall",
12777
+ "minResults",
12778
+ "endWaterfall"
12779
+ ];
12780
+ var ENRICH_DEPRECATION_NOTICE = {
12781
+ status: "deprecated",
12782
+ message: "The enrich compatibility command is deprecated. This run generates a temporary .play.ts file and executes it through plays run.",
12783
+ generatedPlayFile: "Temporary compatibility play file; deleted after the command exits.",
12784
+ printGeneratedPlayCommand: "deepline enrich <same args> --dry-run > enrich.play.ts",
12785
+ recommendedCommand: `deepline plays run enrich.play.ts --input '{"file":"<input.csv>"}'`
12786
+ };
12787
+ var ENRICH_DEPRECATION_TEXT = `${ENRICH_DEPRECATION_NOTICE.message} Print the generated play with: ${ENRICH_DEPRECATION_NOTICE.printGeneratedPlayCommand}. Then run: ${ENRICH_DEPRECATION_NOTICE.recommendedCommand}
12788
+ `;
12789
+ function optionWasProvided(args, ...flags) {
12790
+ return args.some(
12791
+ (arg) => flags.some((flag) => arg === flag || arg.startsWith(`${flag}=`))
12792
+ );
12793
+ }
12794
+ function normalizeAlias2(value) {
12795
+ return value.toLowerCase().replace(/[^a-z0-9]/g, "");
12796
+ }
12797
+ function hasPlanShapingArgs(args) {
12798
+ return optionWasProvided(args, "--with") || optionWasProvided(args, "--with-waterfall") || optionWasProvided(args, "--min-results") || optionWasProvided(args, "--end-waterfall");
12799
+ }
12800
+ function printDeprecationNotice(options) {
12801
+ if (!options.json) {
12802
+ process.stderr.write(ENRICH_DEPRECATION_TEXT);
12803
+ }
12804
+ }
12805
+ function expandAtFilePath(rawPath) {
12806
+ let expanded = rawPath.trim();
12807
+ expanded = expanded.replace(
12808
+ /\$([A-Za-z_][A-Za-z0-9_]*)|\$\{([^}]+)\}/g,
12809
+ (_match, bareName, bracedName) => process.env[bareName ?? bracedName ?? ""] ?? ""
12810
+ );
12811
+ if (expanded === "~") {
12812
+ return homedir4();
12813
+ }
12814
+ if (expanded.startsWith("~/") || expanded.startsWith("~\\")) {
12815
+ return join8(homedir4(), expanded.slice(2));
12816
+ }
12817
+ return expanded;
12818
+ }
12819
+ async function readAtFileReference(value, argumentName, strip = true) {
12820
+ if (!value.startsWith("@")) {
12821
+ return strip ? value.trim() : value.replace(/^\uFEFF/, "");
12822
+ }
12823
+ const filePath = expandAtFilePath(value.slice(1));
12824
+ if (!filePath) {
12825
+ throw new Error(`Invalid ${argumentName} value: empty @file path.`);
12826
+ }
12827
+ try {
12828
+ const text = await readFile3(filePath, "utf8");
12829
+ const normalized = text.replace(/^\uFEFF/, "");
12830
+ return strip ? normalized.trim() : normalized;
12831
+ } catch (error) {
12832
+ throw new Error(
12833
+ `Failed to read ${argumentName} file '${filePath}': ${error instanceof Error ? error.message : String(error)}`
12834
+ );
12835
+ }
12836
+ }
12837
+ function normalizeExtractJs(source) {
12838
+ return source.replace(/\\"/g, '"').replace(/\\'/g, "'");
12839
+ }
12840
+ async function normalizeWithSpec(rawSpec) {
12841
+ const raw = await readAtFileReference(rawSpec.trim(), "--with");
12842
+ let parsed;
12843
+ try {
12844
+ parsed = JSON.parse(raw);
12845
+ } catch (error) {
12846
+ throw new Error(
12847
+ `Invalid JSON payload in --with spec: ${raw} (${error instanceof Error ? error.message : String(error)})`
12848
+ );
12849
+ }
12850
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
12851
+ throw new Error("Invalid --with spec: expected JSON object.");
12852
+ }
12853
+ const spec = parsed;
12854
+ const normalized = { ...spec };
12855
+ for (const field of ["extract_js", "run_if_js"]) {
12856
+ const value = normalized[field];
12857
+ if (typeof value !== "string" || !value.trim()) {
12858
+ continue;
12859
+ }
12860
+ const fromFile = value.trim().startsWith("@") ? await readAtFileReference(value.trim(), `--with ${field}`, false) : null;
12861
+ normalized[field] = fromFile !== null ? fromFile.trim() : normalizeExtractJs(value.trim());
12862
+ }
12863
+ const tool = String(
12864
+ normalized.tool ?? normalized.tool_ref ?? normalized.tool_id ?? ""
12865
+ ).trim();
12866
+ const payload = normalized.payload;
12867
+ if (tool === "run_javascript" && payload && typeof payload === "object" && !Array.isArray(payload)) {
12868
+ const payloadRecord = payload;
12869
+ const code = payloadRecord.code;
12870
+ if (typeof code === "string" && code.trim().startsWith("@")) {
12871
+ normalized.payload = {
12872
+ ...payloadRecord,
12873
+ code: await readAtFileReference(
12874
+ code.trim(),
12875
+ "run_javascript payload.code",
12876
+ false
12877
+ )
12878
+ };
12879
+ }
12880
+ }
12881
+ return JSON.stringify(normalized);
12882
+ }
12883
+ async function expandCompiledConfigAtFiles(value) {
12884
+ if (Array.isArray(value)) {
12885
+ return Promise.all(
12886
+ value.map((entry) => expandCompiledConfigAtFiles(entry))
12887
+ );
12888
+ }
12889
+ if (!value || typeof value !== "object") {
12890
+ return value;
12891
+ }
12892
+ const record = value;
12893
+ const expanded = {};
12894
+ for (const [key, entry] of Object.entries(record)) {
12895
+ expanded[key] = await expandCompiledConfigAtFiles(entry);
12896
+ }
12897
+ for (const field of ["extract_js", "run_if_js"]) {
12898
+ const entry = expanded[field];
12899
+ if (typeof entry === "string" && entry.trim().startsWith("@")) {
12900
+ expanded[field] = (await readAtFileReference(entry.trim(), `--config ${field}`, false)).trim();
12901
+ }
12902
+ }
12903
+ const tool = String(
12904
+ expanded.tool ?? expanded.tool_ref ?? expanded.tool_id ?? ""
12905
+ ).trim();
12906
+ const payload = expanded.payload;
12907
+ if (tool === "run_javascript" && payload && typeof payload === "object" && !Array.isArray(payload)) {
12908
+ const payloadRecord = payload;
12909
+ const code = payloadRecord.code;
12910
+ if (typeof code === "string" && code.trim().startsWith("@")) {
12911
+ expanded.payload = {
12912
+ ...payloadRecord,
12913
+ code: await readAtFileReference(
12914
+ code.trim(),
12915
+ "--config run_javascript payload.code",
12916
+ false
12917
+ )
12918
+ };
12919
+ }
12920
+ }
12921
+ return expanded;
12922
+ }
12923
+ function currentEnrichArgs() {
12924
+ const index = process.argv.findIndex((arg) => arg === "enrich");
12925
+ return index >= 0 ? process.argv.slice(index + 1) : [];
12926
+ }
12927
+ async function buildPlanArgs(args) {
12928
+ const passthrough = /* @__PURE__ */ new Set([
12929
+ "--with",
12930
+ "--with-waterfall",
12931
+ "--min-results",
12932
+ "--end-waterfall"
12933
+ ]);
12934
+ const localOptionsWithValue = /* @__PURE__ */ new Set([
12935
+ "--input",
12936
+ "--csv",
12937
+ "--output",
12938
+ "--config",
12939
+ "--rows",
12940
+ "--with-force"
12941
+ ]);
12942
+ const localBooleanOptions = /* @__PURE__ */ new Set([
12943
+ "--dry-run",
12944
+ "--json",
12945
+ "--force",
12946
+ "--all",
12947
+ "--in-place"
12948
+ ]);
12949
+ const planArgs = [];
12950
+ for (let index = 0; index < args.length; index += 1) {
12951
+ const arg = args[index];
12952
+ const equalsIndex = arg.indexOf("=");
12953
+ const flag = equalsIndex >= 0 ? arg.slice(0, equalsIndex) : arg;
12954
+ const inlineValue = equalsIndex >= 0 ? arg.slice(equalsIndex + 1) : void 0;
12955
+ if (!passthrough.has(flag)) {
12956
+ if (localOptionsWithValue.has(flag)) {
12957
+ if (inlineValue === void 0) {
12958
+ const value = args[index + 1];
12959
+ if (!value || value.startsWith("--")) {
12960
+ throw new Error(`${flag} requires a value.`);
12961
+ }
12962
+ index += 1;
12963
+ }
12964
+ continue;
12965
+ }
12966
+ if (localBooleanOptions.has(flag)) {
12967
+ if (inlineValue !== void 0) {
12968
+ throw new Error(`${flag} does not accept a value.`);
12969
+ }
12970
+ continue;
12971
+ }
12972
+ if (flag.startsWith("--")) {
12973
+ throw new Error(`Unknown enrich option: ${flag}.`);
12974
+ }
12975
+ throw new Error(`Unexpected enrich argument: ${arg}.`);
12976
+ }
12977
+ planArgs.push(flag);
12978
+ if (inlineValue !== void 0) {
12979
+ planArgs.push(
12980
+ flag === "--with" ? await normalizeWithSpec(inlineValue) : inlineValue
12981
+ );
12982
+ continue;
12983
+ }
12984
+ if (flag !== "--end-waterfall") {
12985
+ const value = args[++index];
12986
+ if (!value) {
12987
+ throw new Error(`${flag} requires a value.`);
12988
+ }
12989
+ planArgs.push(flag === "--with" ? await normalizeWithSpec(value) : value);
12990
+ }
12991
+ }
12992
+ return planArgs;
12993
+ }
12994
+ async function assertInputCsvExists(inputCsv) {
12995
+ const path = resolve11(inputCsv);
12996
+ try {
12997
+ const info = await stat3(path);
12998
+ if (info.isFile()) {
12999
+ return;
13000
+ }
13001
+ throw new Error("not a file");
13002
+ } catch (error) {
13003
+ throw new Error(
13004
+ `Input CSV does not exist or is not a file: ${path}${error instanceof Error && error.message !== "not a file" ? ` (${error.message})` : ""}`
13005
+ );
13006
+ }
13007
+ }
13008
+ async function assertSafeOutputPath(inputCsv, outputPath) {
13009
+ const input2 = resolve11(inputCsv);
13010
+ const output2 = resolve11(outputPath);
13011
+ if (input2 === output2) {
13012
+ throw new Error(
13013
+ "--output must be a different path from --input. --in-place is not supported by this V2 enrich runner yet."
13014
+ );
13015
+ }
13016
+ try {
13017
+ const [inputInfo, outputInfo] = await Promise.all([
13018
+ stat3(input2),
13019
+ stat3(output2)
13020
+ ]);
13021
+ if (inputInfo.dev === outputInfo.dev && inputInfo.ino === outputInfo.ino) {
13022
+ throw new Error(
13023
+ "--output must be a different file from --input. --in-place is not supported by this V2 enrich runner yet."
13024
+ );
13025
+ }
13026
+ } catch (error) {
13027
+ if (error instanceof Error && error.message.startsWith("--output must")) {
13028
+ throw error;
13029
+ }
13030
+ const code = error && typeof error === "object" ? error.code : void 0;
13031
+ if (code === "ENOENT") {
13032
+ return;
13033
+ }
13034
+ throw error;
13035
+ }
13036
+ }
13037
+ async function readConfig(path) {
13038
+ const source = await readFile3(resolve11(path), "utf8");
13039
+ let parsed;
13040
+ try {
13041
+ parsed = JSON.parse(source);
13042
+ } catch (error) {
13043
+ throw new Error(
13044
+ `Invalid JSON in --config ${path}: ${error instanceof Error ? error.message : String(error)}`
13045
+ );
13046
+ }
13047
+ return expandCompiledConfigAtFiles(parsed);
13048
+ }
13049
+ function parseRows(value, all) {
13050
+ if (all && value) {
13051
+ throw new Error("Do not combine --rows with --all.");
13052
+ }
13053
+ if (all || !value) {
13054
+ return { rowStart: null, rowEnd: null };
13055
+ }
13056
+ const trimmed = value.trim();
13057
+ const range = trimmed.match(/^(\d*)\s*:\s*(\d*)$/);
13058
+ if (range) {
13059
+ if (!range[1] && !range[2]) {
13060
+ throw new Error(
13061
+ "--rows must be a zero-based row number or end-exclusive range like 0:10."
13062
+ );
13063
+ }
13064
+ const start = range[1] ? Number.parseInt(range[1], 10) : 0;
13065
+ const end = range[2] ? Number.parseInt(range[2], 10) : null;
13066
+ return { rowStart: start, rowEnd: end };
13067
+ }
13068
+ if (!/^\d+$/.test(trimmed)) {
13069
+ throw new Error(
13070
+ "--rows must be a zero-based row number or end-exclusive range like 0:10."
13071
+ );
13072
+ }
13073
+ const single = Number.parseInt(trimmed, 10);
13074
+ if (!Number.isFinite(single) || single < 0) {
13075
+ throw new Error(
13076
+ "--rows must be a zero-based row number or end-exclusive range like 0:10."
13077
+ );
13078
+ }
13079
+ return { rowStart: single, rowEnd: single + 1 };
13080
+ }
13081
+ function summarizePlan(config, playSource) {
13082
+ const steps = [];
13083
+ for (const command of config.commands) {
13084
+ if ("with_waterfall" in command) {
13085
+ steps.push({
13086
+ type: "waterfall",
13087
+ alias: command.with_waterfall,
13088
+ min_results: command.min_results ?? 1,
13089
+ steps: command.commands.map(
13090
+ (step) => "with_waterfall" in step ? { type: "waterfall", alias: step.with_waterfall } : { alias: step.alias, tool: step.tool, operation: step.operation }
13091
+ )
13092
+ });
13093
+ continue;
13094
+ }
13095
+ steps.push({
13096
+ type: "step",
13097
+ alias: command.alias,
13098
+ tool: command.tool,
13099
+ operation: command.operation
13100
+ });
13101
+ }
13102
+ return {
13103
+ version: config.version,
13104
+ commandCount: config.commands.length,
13105
+ steps,
13106
+ generatedPlay: playSource
13107
+ };
13108
+ }
13109
+ function collectCommandAliases(config) {
13110
+ const allAliases = /* @__PURE__ */ new Set();
13111
+ const scalarAliases = /* @__PURE__ */ new Set();
13112
+ const waterfallGroups = /* @__PURE__ */ new Map();
13113
+ for (const command of config.commands) {
13114
+ if ("with_waterfall" in command) {
13115
+ const groupAlias = normalizeAlias2(command.with_waterfall);
13116
+ if (groupAlias) {
13117
+ allAliases.add(groupAlias);
13118
+ }
13119
+ const childAliases = /* @__PURE__ */ new Set();
13120
+ for (const child of command.commands) {
13121
+ if ("with_waterfall" in child || child.disabled) {
13122
+ continue;
13123
+ }
13124
+ const childAlias = normalizeAlias2(child.alias);
13125
+ if (!childAlias) {
13126
+ continue;
13127
+ }
13128
+ allAliases.add(childAlias);
13129
+ scalarAliases.add(childAlias);
13130
+ childAliases.add(childAlias);
13131
+ }
13132
+ if (groupAlias) {
13133
+ waterfallGroups.set(groupAlias, childAliases);
13134
+ }
13135
+ continue;
13136
+ }
13137
+ if (command.disabled) {
13138
+ continue;
13139
+ }
13140
+ const alias = normalizeAlias2(command.alias);
13141
+ if (alias) {
13142
+ allAliases.add(alias);
13143
+ scalarAliases.add(alias);
13144
+ }
13145
+ }
13146
+ return { allAliases, scalarAliases, waterfallGroups };
13147
+ }
13148
+ function parseWithForceAliases(values) {
13149
+ const aliases = /* @__PURE__ */ new Set();
13150
+ for (const value of values ?? []) {
13151
+ for (const item of value.split(",")) {
13152
+ const alias = normalizeAlias2(item.trim());
13153
+ if (alias) {
13154
+ aliases.add(alias);
13155
+ }
13156
+ }
13157
+ }
13158
+ return aliases;
13159
+ }
13160
+ function resolveForceAliases(config, options) {
13161
+ const { allAliases, scalarAliases, waterfallGroups } = collectCommandAliases(config);
13162
+ if (options.force) {
13163
+ return new Set(scalarAliases);
13164
+ }
13165
+ const requested = parseWithForceAliases(options.withForce);
13166
+ const unknown = [...requested].filter((alias) => !allAliases.has(alias));
13167
+ if (unknown.length > 0) {
13168
+ throw new Error(
13169
+ `--with-force references unknown --with column alias(es): ${unknown.sort().join(", ")}.`
13170
+ );
13171
+ }
13172
+ const resolved = /* @__PURE__ */ new Set();
13173
+ for (const alias of requested) {
13174
+ const children = waterfallGroups.get(alias);
13175
+ if (children) {
13176
+ for (const child of children) {
13177
+ resolved.add(child);
13178
+ }
13179
+ } else {
13180
+ resolved.add(alias);
13181
+ }
13182
+ }
13183
+ return resolved;
13184
+ }
13185
+ function parseJsonOutput(stdout) {
13186
+ const trimmed = stdout.trim();
13187
+ if (!trimmed) return null;
13188
+ try {
13189
+ return JSON.parse(trimmed);
13190
+ } catch {
13191
+ const start = trimmed.lastIndexOf("\n{");
13192
+ if (start >= 0) {
13193
+ return JSON.parse(trimmed.slice(start + 1));
13194
+ }
13195
+ throw new Error(
13196
+ "The generated play completed but did not emit parseable JSON."
13197
+ );
13198
+ }
13199
+ }
13200
+ async function captureStdout(run) {
13201
+ const originalWrite = process.stdout.write.bind(process.stdout);
13202
+ let stdout = "";
13203
+ process.stdout.write = ((chunk, ..._args) => {
13204
+ stdout += typeof chunk === "string" ? chunk : String(chunk);
13205
+ return true;
13206
+ });
13207
+ try {
13208
+ const result = await run();
13209
+ return { result, stdout };
13210
+ } finally {
13211
+ process.stdout.write = originalWrite;
13212
+ }
13213
+ }
13214
+ async function writeOutputCsv(outputPath, status) {
13215
+ const rowsInfo = extractCanonicalRowsInfo(status);
13216
+ if (!rowsInfo) {
13217
+ throw new Error("The generated play did not return row-shaped output.");
13218
+ }
13219
+ assertCompleteRowsForCsvExport(rowsInfo, status, outputPath);
13220
+ const rows = dataExportRows(rowsInfo.rows);
13221
+ const columns = dataExportColumns(rows, rowsInfo.columns);
13222
+ await writeFile4(
13223
+ resolve11(outputPath),
13224
+ csvStringFromRows(rows, columns),
13225
+ "utf8"
13226
+ );
13227
+ return { rows: rows.length, path: resolve11(outputPath) };
13228
+ }
13229
+ function assertCompleteRowsForCsvExport(rowsInfo, status, outputPath) {
13230
+ if (rowsInfo.complete) {
13231
+ return;
13232
+ }
13233
+ const runId = status && typeof status === "object" && !Array.isArray(status) && typeof status.runId === "string" ? status.runId : null;
13234
+ const dataset = rowsInfo.source ?? "result.rows";
13235
+ const retry = runId ? ` Retry after the run finalizes its backing dataset with: deepline runs export ${runId} --dataset ${dataset} --out ${outputPath}` : "";
13236
+ throw new Error(
13237
+ `Refusing to write a partial CSV export: the run returned ${rowsInfo.rows.length} preview row(s) out of ${rowsInfo.totalRows}.${retry}`
13238
+ );
13239
+ }
13240
+ async function compileConfig(input2) {
13241
+ if (input2.options.config) {
13242
+ if (hasPlanShapingArgs(input2.args)) {
13243
+ throw new Error(
13244
+ `Do not mix --config with plan-shaping flags (${PLAN_SHAPING_OPTION_NAMES.join(", ")}). Put the plan in the config file or pass flags directly.`
13245
+ );
13246
+ }
13247
+ const config = await readConfig(input2.options.config);
13248
+ return (await input2.client.compileEnrichPlan({ config })).config;
13249
+ }
13250
+ const planArgs = await buildPlanArgs(input2.args);
13251
+ return (await input2.client.compileEnrichPlan({ plan_args: planArgs })).config;
13252
+ }
13253
+ function registerEnrichCommand(program) {
13254
+ program.command("enrich").allowUnknownOption(true).description("Run v1-style CSV enrichment through the V2 play runner.").option("--input <path>", "Input CSV path.").option("--csv <path>", "Alias for --input.").option("--output <path>", "Output CSV path.").option("--config <path>", "JSON enrich config.").option(
13255
+ "--with <json>",
13256
+ "Add a scalar enrich command.",
13257
+ (value, previous = []) => [...previous, value]
13258
+ ).option(
13259
+ "--with-waterfall <alias>",
13260
+ "Start a waterfall group.",
13261
+ (value, previous = []) => [...previous, value]
13262
+ ).option(
13263
+ "--min-results <count>",
13264
+ "Minimum list results for the current waterfall."
13265
+ ).option("--end-waterfall", "End the current waterfall group.").option(
13266
+ "--rows <range>",
13267
+ "Zero-based row number or end-exclusive range, e.g. 0:10."
13268
+ ).option("--all", "Run all rows.").option(
13269
+ "--dry-run",
13270
+ "Compile and print the generated plan without starting a run."
13271
+ ).option("--json", "Emit JSON.").option("--force", "Force rerun for all enrich aliases.").option(
13272
+ "--with-force <aliases>",
13273
+ "Force rerun for selected aliases.",
13274
+ (value, previous = []) => [...previous, value]
13275
+ ).option(
13276
+ "--in-place",
13277
+ "Not supported by the V2 enrich compatibility runner yet."
13278
+ ).action(async (options, _command) => {
13279
+ if (options.inPlace) {
13280
+ throw new Error(
13281
+ "--in-place is not supported by this V2 enrich runner yet. Use --output instead."
13282
+ );
13283
+ }
13284
+ const inputCsv = options.input ?? options.csv;
13285
+ if (!inputCsv) {
13286
+ throw new Error("Missing required --input <csv> (or --csv <csv>).");
13287
+ }
13288
+ await assertInputCsvExists(inputCsv);
13289
+ if (options.output) {
13290
+ await assertSafeOutputPath(inputCsv, options.output);
13291
+ }
13292
+ if (!options.config && !hasPlanShapingArgs(currentEnrichArgs())) {
13293
+ throw new Error("Pass --config or at least one --with enrich spec.");
13294
+ }
13295
+ const client = new DeeplineClient();
13296
+ const args = currentEnrichArgs();
13297
+ const config = await compileConfig({ client, args, options });
13298
+ const forceAliases = resolveForceAliases(config, options);
13299
+ const playSource = compileEnrichConfigToPlaySource(config, {
13300
+ forceAliases
13301
+ });
13302
+ const summary = summarizePlan(config, playSource);
13303
+ printDeprecationNotice(options);
13304
+ if (options.dryRun) {
13305
+ if (options.json) {
13306
+ printJson({
13307
+ dryRun: true,
13308
+ deprecation: ENRICH_DEPRECATION_NOTICE,
13309
+ input: resolve11(inputCsv),
13310
+ output: options.output ? resolve11(options.output) : null,
13311
+ plan: summary
13312
+ });
13313
+ return;
13314
+ }
13315
+ process.stdout.write(`${playSource}
13316
+ `);
13317
+ return;
13318
+ }
13319
+ const rows = parseRows(options.rows, options.all);
13320
+ if (options.output && options.rows) {
13321
+ throw new Error(
13322
+ "CSV export with --rows is not supported yet because it would write only the selected rows. Run without --rows or omit --output."
13323
+ );
13324
+ }
13325
+ const tempDir = await mkdtemp(join8(tmpdir3(), "deepline-enrich-play-"));
13326
+ const tempPlay = join8(tempDir, "deepline-enrich.play.ts");
13327
+ try {
13328
+ await writeFile4(tempPlay, playSource, "utf8");
13329
+ const runtimeInput = {
13330
+ file: resolve11(inputCsv),
13331
+ ...rows.rowStart !== null ? { rowStart: rows.rowStart } : {},
13332
+ ...rows.rowEnd !== null ? { rowEnd: rows.rowEnd } : {}
13333
+ };
13334
+ const runArgs = [
13335
+ "--file",
13336
+ tempPlay,
13337
+ "--input",
13338
+ JSON.stringify(runtimeInput),
13339
+ "--watch",
13340
+ "--no-open",
13341
+ "--json"
13342
+ ];
13343
+ const captured = await captureStdout(() => handlePlayRun(runArgs));
13344
+ const status = parseJsonOutput(captured.stdout);
13345
+ if (captured.result !== 0) {
13346
+ if (options.json) {
13347
+ printJson({
13348
+ deprecation: ENRICH_DEPRECATION_NOTICE,
13349
+ result: status
13350
+ });
13351
+ } else {
13352
+ process.stdout.write(captured.stdout);
13353
+ }
13354
+ process.exitCode = captured.result;
13355
+ return;
13356
+ }
13357
+ const exportResult = options.output ? await writeOutputCsv(options.output, status) : null;
13358
+ if (options.json) {
13359
+ printJson({
13360
+ ok: true,
13361
+ deprecation: ENRICH_DEPRECATION_NOTICE,
13362
+ run: status,
13363
+ output: exportResult
13364
+ });
13365
+ return;
13366
+ }
13367
+ process.stdout.write(captured.stdout);
13368
+ if (exportResult) {
13369
+ process.stderr.write(
13370
+ `Wrote ${exportResult.rows} row(s) to ${exportResult.path}
13371
+ `
13372
+ );
13373
+ }
13374
+ } finally {
13375
+ await rm(tempDir, { recursive: true, force: true });
13376
+ }
13377
+ });
13378
+ }
13379
+
13380
+ // src/cli/commands/feedback.ts
13381
+ async function handleFeedback(text, options) {
13382
+ const { http } = getAuthedHttpClient();
13383
+ const response = await http.post("/api/v2/cli/feedback", {
13384
+ text,
13385
+ environment: collectLocalEnvInfo(),
13386
+ ...options.command ? { command: options.command } : {},
13387
+ ...options.payload ? { payload: options.payload } : {}
13388
+ });
13389
+ printCommandEnvelope(
13390
+ {
13391
+ ...response,
13392
+ render: {
13393
+ sections: [
13394
+ { title: "feedback", lines: ["Feedback submitted. Thank you."] }
13395
+ ]
13396
+ }
13397
+ },
13398
+ { json: options.json }
13399
+ );
13400
+ }
13401
+ function registerFeedbackCommands(program) {
13402
+ const feedback = program.command("feedback").description("Submit CLI feedback to Deepline.").addHelpText(
13403
+ "after",
13404
+ `
13405
+ Notes:
13406
+ Sends the feedback text plus local CLI environment info to Deepline support.
13407
+ Use --command and --payload to attach a reproducible command shape.
13408
+
13409
+ Examples:
13410
+ deepline feedback "plays run failed after upload" --command "deepline plays run my.play.ts --watch"
13411
+ deepline feedback "unexpected billing output" --payload '{"command":"billing usage"}' --json
13412
+ `
13413
+ );
13414
+ feedback.argument("<text>", "Feedback text").option("--command <command>", "Command that reproduced the issue").option("--payload <payload>", "JSON or plain-text payload for the repro").option("--json", "Emit JSON output").action(handleFeedback);
13415
+ program.command("provide-feedback").description("Legacy alias for `deepline feedback`.").addHelpText(
13416
+ "after",
13417
+ `
13418
+ Notes:
13419
+ Compatibility alias. Prefer deepline feedback in new scripts and docs.
13420
+
13421
+ Examples:
13422
+ deepline feedback "tools search returned stale results" --json
13423
+ `
13424
+ ).argument("<text>", "Feedback text").option("--command <command>", "Command that reproduced the issue").option("--payload <payload>", "JSON or plain-text payload for the repro").option("--json", "Emit JSON output").action(handleFeedback);
13425
+ }
13426
+
13427
+ // src/cli/commands/org.ts
13428
+ async function fetchOrganizations(http, apiKey) {
13429
+ return http.post("/api/v2/auth/cli/organizations", { api_key: apiKey });
13430
+ }
13431
+ function orgListLines(orgs) {
13432
+ return orgs.map((org, index) => {
13433
+ const current = org.is_current ? " (current)" : "";
13434
+ const role = org.role ? ` [${org.role}]` : "";
13435
+ return `${index + 1}. ${org.name}${role}${current}`;
13436
+ });
13437
+ }
13438
+ async function handleOrgList(options) {
13439
+ const config = resolveConfig();
13440
+ const http = new HttpClient(config);
13441
+ const payload = await fetchOrganizations(http, config.apiKey);
13442
+ printCommandEnvelope(
13443
+ {
13444
+ ...payload,
13445
+ render: {
13446
+ sections: [
13447
+ {
13448
+ title: "Your organizations:",
13449
+ lines: orgListLines(payload.organizations)
13450
+ }
13451
+ ]
13452
+ }
13453
+ },
13454
+ { json: options.json }
13455
+ );
13456
+ }
13457
+ async function handleOrgSwitch(selection, options) {
13458
+ const config = resolveConfig();
13459
+ const http = new HttpClient(config);
13460
+ const payload = await fetchOrganizations(http, config.apiKey);
13461
+ if (!selection && !options.orgId) {
13462
+ printCommandEnvelope(
13463
+ {
13464
+ ...payload,
13465
+ next: { switch: "deepline org switch <number>" },
13466
+ render: {
13467
+ sections: [
13468
+ {
13469
+ title: "Your organizations:",
13470
+ lines: orgListLines(payload.organizations)
13471
+ }
13472
+ ],
13473
+ actions: [{ label: "Run", command: "deepline org switch <number>" }]
13474
+ }
13475
+ },
13476
+ { json: options.json }
13477
+ );
13478
+ return;
13479
+ }
13480
+ let target = payload.organizations.find(
13481
+ (org) => org.org_id === options.orgId
13482
+ );
13483
+ if (!target && selection) {
13484
+ const index = Number.parseInt(selection, 10);
13485
+ if (Number.isFinite(index) && index >= 1 && index <= payload.organizations.length) {
13486
+ target = payload.organizations[index - 1];
13487
+ } else {
13488
+ target = payload.organizations.find(
13489
+ (org) => org.name === selection || org.org_id === selection
13490
+ );
13491
+ }
13492
+ }
13493
+ if (!target) {
13494
+ throw new Error("Could not resolve the selected organization.");
13495
+ }
13496
+ if (target.is_current) {
13497
+ printCommandEnvelope(
13498
+ {
13499
+ ok: true,
13500
+ unchanged: true,
13501
+ organization: target,
13502
+ render: {
13503
+ sections: [
13504
+ { title: "org switch", lines: [`Already on ${target.name}.`] }
13505
+ ]
13506
+ }
13507
+ },
13508
+ { json: options.json }
13509
+ );
13510
+ return;
13511
+ }
13512
+ const switched = await http.post("/api/v2/auth/cli/switch", {
13513
+ api_key: config.apiKey,
13514
+ org_id: target.org_id
13515
+ });
13516
+ saveHostEnvValues(config.baseUrl, {
13517
+ DEEPLINE_API_KEY: switched.api_key,
13518
+ DEEPLINE_ACTIVE_ORG_ID: switched.org_id,
13519
+ DEEPLINE_ACTIVE_ORG_NAME: switched.org_name
13520
+ });
13521
+ const { api_key: _apiKey, ...publicSwitched } = switched;
13522
+ printCommandEnvelope(
13523
+ {
13524
+ ok: true,
13525
+ host_env_path: hostEnvFilePath(config.baseUrl),
13526
+ ...publicSwitched,
13527
+ api_key_saved: true,
13528
+ render: {
13529
+ sections: [
13530
+ {
13531
+ title: "org switch",
13532
+ lines: [
13533
+ `Switched to ${switched.org_name}.`,
13534
+ `Saved host auth in ${hostEnvFilePath(config.baseUrl)}`
13535
+ ]
13536
+ }
13537
+ ]
13538
+ }
13539
+ },
13540
+ { json: options.json }
13541
+ );
13542
+ }
13543
+ function registerOrgCommands(program) {
13544
+ const org = program.command("org").description("List and switch organizations.").addHelpText(
13545
+ "after",
13546
+ `
13547
+ Notes:
13548
+ Organizations are workspaces. Switching organizations mutates the saved host
13549
+ auth file so later CLI commands target the selected workspace.
13550
+
13551
+ Examples:
13552
+ deepline org list --json
13553
+ deepline org switch 2
13554
+ deepline org switch --org-id org_123 --json
13555
+ `
13556
+ );
13557
+ org.command("list").description("List your organizations.").addHelpText(
13558
+ "after",
13559
+ `
13560
+ Notes:
13561
+ Read-only. Marks the active organization when the server returns that metadata.
13562
+
13563
+ Examples:
13564
+ deepline org list
13565
+ deepline org list --json
13566
+ `
13567
+ ).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleOrgList);
13568
+ org.command("switch [selection]").description(
13569
+ "Switch to another organization and save the new API key in the host auth file."
13570
+ ).addHelpText(
13571
+ "after",
13572
+ `
13573
+ Notes:
13574
+ Mutates the saved host auth file. Selection can be a list number, exact
13575
+ organization name, or organization id. Without a selection, prints choices.
13576
+
13577
+ Examples:
13578
+ deepline org switch
13579
+ deepline org switch 2
13580
+ deepline org switch --org-id org_123 --json
13581
+ `
13582
+ ).option("--org-id <id>", "Switch using an explicit organization id").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleOrgSwitch);
13583
+ }
13584
+
13585
+ // src/cli/commands/secrets.ts
13586
+ import { stdin as input, stdout as output } from "process";
13587
+ var hiddenInputBuffer = "";
13588
+ function normalizeSecretName(value) {
13589
+ const normalized = value.trim().toUpperCase();
13590
+ if (!/^[A-Z][A-Z0-9_]{1,63}$/.test(normalized)) {
13591
+ throw new Error(
13592
+ "Secret names must be 2-64 characters and use uppercase letters, numbers, and underscores."
13593
+ );
13594
+ }
13595
+ return normalized;
13596
+ }
13597
+ function renderSecret(secret) {
13598
+ const scope = secret.scope === "play" && secret.playName ? `play:${secret.playName}` : secret.scope;
13599
+ return `${secret.name} (${scope}) - ${secret.status}${secret.hasValue ? ", set" : ", empty"}`;
13600
+ }
13601
+ async function readHiddenLine(prompt) {
13602
+ if (!input.isTTY || !output.isTTY) {
13603
+ throw new Error(
13604
+ "Secret values must be entered from an interactive TTY. Do not pipe, pass, or script secret values."
13605
+ );
13606
+ }
13607
+ output.write(prompt);
13608
+ const previousRawMode = input.isRaw;
13609
+ if (typeof input.setRawMode === "function") input.setRawMode(true);
13610
+ let value = "";
13611
+ input.resume();
13612
+ return await new Promise((resolve13, reject) => {
13613
+ let settled = false;
13614
+ const cleanup = () => {
13615
+ input.off("data", onData);
13616
+ input.off("end", onEnd);
13617
+ input.off("error", onError);
13618
+ if (typeof input.setRawMode === "function") {
13619
+ input.setRawMode(previousRawMode);
13620
+ }
13621
+ };
13622
+ const finish = (line) => {
13623
+ if (settled) return;
13624
+ settled = true;
13625
+ output.write("\n");
13626
+ cleanup();
13627
+ resolve13(line);
13628
+ };
13629
+ const fail = (error) => {
13630
+ if (settled) return;
13631
+ settled = true;
12673
13632
  output.write("\n");
12674
13633
  cleanup();
12675
13634
  reject(error);
@@ -12838,13 +13797,13 @@ Examples:
12838
13797
  // src/cli/commands/tools.ts
12839
13798
  import { Option } from "commander";
12840
13799
  import { chmodSync, mkdtempSync, writeFileSync as writeFileSync8 } from "fs";
12841
- import { tmpdir as tmpdir3 } from "os";
12842
- import { join as join9 } from "path";
13800
+ import { tmpdir as tmpdir4 } from "os";
13801
+ import { join as join10 } from "path";
12843
13802
 
12844
13803
  // src/tool-output.ts
12845
13804
  import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync7 } from "fs";
12846
- import { homedir as homedir4 } from "os";
12847
- import { join as join8 } from "path";
13805
+ import { homedir as homedir5 } from "os";
13806
+ import { join as join9 } from "path";
12848
13807
  function isPlainObject(value) {
12849
13808
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
12850
13809
  }
@@ -12940,19 +13899,19 @@ function tryConvertToList(payload, options) {
12940
13899
  return null;
12941
13900
  }
12942
13901
  function ensureOutputDir() {
12943
- const outputDir = join8(homedir4(), ".local", "share", "deepline", "data");
13902
+ const outputDir = join9(homedir5(), ".local", "share", "deepline", "data");
12944
13903
  mkdirSync4(outputDir, { recursive: true });
12945
13904
  return outputDir;
12946
13905
  }
12947
13906
  function writeJsonOutputFile(payload, stem) {
12948
13907
  const outputDir = ensureOutputDir();
12949
- const outputPath = join8(outputDir, `${stem}_${Date.now()}.json`);
13908
+ const outputPath = join9(outputDir, `${stem}_${Date.now()}.json`);
12950
13909
  writeFileSync7(outputPath, JSON.stringify(payload, null, 2), "utf-8");
12951
13910
  return outputPath;
12952
13911
  }
12953
13912
  function writeCsvOutputFile(rows, stem) {
12954
13913
  const outputDir = ensureOutputDir();
12955
- const outputPath = join8(outputDir, `${stem}_${Date.now()}.csv`);
13914
+ const outputPath = join9(outputDir, `${stem}_${Date.now()}.csv`);
12956
13915
  const seen = /* @__PURE__ */ new Set();
12957
13916
  const columns = [];
12958
13917
  for (const row of rows) {
@@ -13711,7 +14670,7 @@ function printToolExamplesOnly(tool, requestedToolId, options = {}) {
13711
14670
  const expression = stringField(firstGetter, "expression");
13712
14671
  if (expression)
13713
14672
  console.log(
13714
- `const ${safeIdentifier2(name)} = ${expression.replace(/^toolExecutionResult\./, "result.")};`
14673
+ `const ${safeIdentifier3(name)} = ${expression.replace(/^toolExecutionResult\./, "result.")};`
13715
14674
  );
13716
14675
  }
13717
14676
  console.log("```");
@@ -13780,7 +14739,7 @@ function samplePayloadForInputFields(fields) {
13780
14739
  function stableStepIdForTool(toolId) {
13781
14740
  return toolId.replace(/^[a-z0-9]+_/, "").replace(/[^a-z0-9_]+/gi, "_") || "tool_call";
13782
14741
  }
13783
- function safeIdentifier2(name) {
14742
+ function safeIdentifier3(name) {
13784
14743
  const cleaned = name.replace(/[^a-zA-Z0-9_$]+/g, "_").replace(/^[^a-zA-Z_$]+/, "");
13785
14744
  return cleaned || "value";
13786
14745
  }
@@ -14043,9 +15002,9 @@ function powerShellQuote(value) {
14043
15002
  function seedToolListScript(input2) {
14044
15003
  const stem = safeFileStem(input2.toolId);
14045
15004
  const fileName = `${stem}-workflow-seed-${Date.now()}.play.ts`;
14046
- const scriptDir = mkdtempSync(join9(tmpdir3(), "deepline-workflow-seed-"));
15005
+ const scriptDir = mkdtempSync(join10(tmpdir4(), "deepline-workflow-seed-"));
14047
15006
  chmodSync(scriptDir, 448);
14048
- const scriptPath = join9(scriptDir, fileName);
15007
+ const scriptPath = join10(scriptDir, fileName);
14049
15008
  const projectDir = `deepline/projects/${stem}-workflow`;
14050
15009
  const playName = `${stem}-workflow`;
14051
15010
  const sampleRows = input2.rows.length > 0 ? `${JSON.stringify(input2.rows.slice(0, 2)).replace(/\]$/, "")}, ...]` : "[]";
@@ -14337,7 +15296,7 @@ async function executeTool(args) {
14337
15296
  // src/cli/commands/update.ts
14338
15297
  import { spawn } from "child_process";
14339
15298
  import { existsSync as existsSync8 } from "fs";
14340
- import { dirname as dirname9, join as join10, resolve as resolve11 } from "path";
15299
+ import { dirname as dirname9, join as join11, resolve as resolve12 } from "path";
14341
15300
  function posixShellQuote(value) {
14342
15301
  return `'${value.replace(/'/g, `'\\''`)}'`;
14343
15302
  }
@@ -14356,9 +15315,9 @@ function buildSourceUpdateCommand(sourceRoot) {
14356
15315
  return `${cdCommand} && git fetch origin main --tags && git merge --ff-only origin/main`;
14357
15316
  }
14358
15317
  function findRepoBackedSdkRoot(startPath) {
14359
- let current = resolve11(startPath);
15318
+ let current = resolve12(startPath);
14360
15319
  while (true) {
14361
- if (existsSync8(join10(current, "sdk", "package.json")) && existsSync8(join10(current, "sdk", "bin", "deepline-dev.ts"))) {
15320
+ if (existsSync8(join11(current, "sdk", "package.json")) && existsSync8(join11(current, "sdk", "bin", "deepline-dev.ts"))) {
14362
15321
  return current;
14363
15322
  }
14364
15323
  const parent = dirname9(current);
@@ -14367,7 +15326,7 @@ function findRepoBackedSdkRoot(startPath) {
14367
15326
  }
14368
15327
  }
14369
15328
  function resolveUpdatePlan() {
14370
- const entrypoint = process.argv[1] ? resolve11(process.argv[1]) : "";
15329
+ const entrypoint = process.argv[1] ? resolve12(process.argv[1]) : "";
14371
15330
  const sourceRoot = entrypoint ? findRepoBackedSdkRoot(dirname9(entrypoint)) : null;
14372
15331
  if (sourceRoot) {
14373
15332
  return {
@@ -14639,8 +15598,8 @@ import {
14639
15598
  statSync as statSync2,
14640
15599
  writeFileSync as writeFileSync9
14641
15600
  } from "fs";
14642
- import { homedir as homedir5 } from "os";
14643
- import { dirname as dirname10, join as join11 } from "path";
15601
+ import { homedir as homedir6 } from "os";
15602
+ import { dirname as dirname10, join as join12 } from "path";
14644
15603
  var CHECK_TIMEOUT_MS2 = 3e3;
14645
15604
  var SDK_SKILL_NAME = "deepline-sdk";
14646
15605
  var attemptedSync = false;
@@ -14649,8 +15608,8 @@ function shouldSkipSkillsSync() {
14649
15608
  return value === "1" || value === "true" || value === "yes" || value === "on";
14650
15609
  }
14651
15610
  function sdkSkillsVersionPath(baseUrl) {
14652
- const home = process.env.HOME?.trim() || homedir5();
14653
- return join11(
15611
+ const home = process.env.HOME?.trim() || homedir6();
15612
+ return join12(
14654
15613
  home,
14655
15614
  ".local",
14656
15615
  "deepline",
@@ -14675,10 +15634,10 @@ function writeLocalSkillsVersion(baseUrl, version) {
14675
15634
  `, "utf-8");
14676
15635
  }
14677
15636
  function installedSdkSkillHasStalePositionalExecuteExamples() {
14678
- const home = process.env.HOME?.trim() || homedir5();
15637
+ const home = process.env.HOME?.trim() || homedir6();
14679
15638
  const roots = [
14680
- join11(home, ".claude", "skills", SDK_SKILL_NAME),
14681
- join11(home, ".agents", "skills", SDK_SKILL_NAME)
15639
+ join12(home, ".claude", "skills", SDK_SKILL_NAME),
15640
+ join12(home, ".agents", "skills", SDK_SKILL_NAME)
14682
15641
  ];
14683
15642
  const staleMarkers = [
14684
15643
  "ctx.tools.execute(key",
@@ -14689,9 +15648,9 @@ function installedSdkSkillHasStalePositionalExecuteExamples() {
14689
15648
  ];
14690
15649
  const scan = (dir) => {
14691
15650
  for (const entry of readdirSync2(dir)) {
14692
- const path = join11(dir, entry);
14693
- const stat3 = statSync2(path);
14694
- if (stat3.isDirectory()) {
15651
+ const path = join12(dir, entry);
15652
+ const stat4 = statSync2(path);
15653
+ if (stat4.isDirectory()) {
14695
15654
  if (scan(path)) return true;
14696
15655
  continue;
14697
15656
  }
@@ -14775,7 +15734,7 @@ function resolveSkillsInstallCommands(baseUrl) {
14775
15734
  return [npxInstall];
14776
15735
  }
14777
15736
  function runOneSkillsInstall(install) {
14778
- return new Promise((resolve12) => {
15737
+ return new Promise((resolve13) => {
14779
15738
  const child = spawn2(install.command, install.args, {
14780
15739
  stdio: ["ignore", "ignore", "pipe"],
14781
15740
  env: process.env
@@ -14785,7 +15744,7 @@ function runOneSkillsInstall(install) {
14785
15744
  stderr += chunk.toString("utf-8");
14786
15745
  });
14787
15746
  child.on("error", (error) => {
14788
- resolve12({
15747
+ resolve13({
14789
15748
  ok: false,
14790
15749
  detail: `failed to start ${install.command}: ${error.message}`,
14791
15750
  manualCommand: install.manualCommand
@@ -14793,11 +15752,11 @@ function runOneSkillsInstall(install) {
14793
15752
  });
14794
15753
  child.on("close", (code) => {
14795
15754
  if (code === 0) {
14796
- resolve12({ ok: true, detail: "", manualCommand: install.manualCommand });
15755
+ resolve13({ ok: true, detail: "", manualCommand: install.manualCommand });
14797
15756
  return;
14798
15757
  }
14799
15758
  const detail = stderr.trim();
14800
- resolve12({
15759
+ resolve13({
14801
15760
  ok: false,
14802
15761
  detail: detail ? `${install.command}: ${detail}` : `${install.command} exited ${code}`,
14803
15762
  manualCommand: install.manualCommand
@@ -14880,10 +15839,10 @@ function shouldDeferSkillsSyncForCommand() {
14880
15839
  return (command === "play" || command === "plays") && subcommand === "run" && args.includes("--json");
14881
15840
  }
14882
15841
  async function runPlayRunnerHealthCheck() {
14883
- const dir = await mkdtemp(join12(tmpdir4(), "deepline-health-play-"));
14884
- const file = join12(dir, "health-check.play.ts");
15842
+ const dir = await mkdtemp2(join13(tmpdir5(), "deepline-health-play-"));
15843
+ const file = join13(dir, "health-check.play.ts");
14885
15844
  try {
14886
- await writeFile4(
15845
+ await writeFile5(
14887
15846
  file,
14888
15847
  [
14889
15848
  "import { definePlay } from 'deepline';",
@@ -14931,7 +15890,7 @@ async function runPlayRunnerHealthCheck() {
14931
15890
  }
14932
15891
  };
14933
15892
  } finally {
14934
- await rm(dir, { recursive: true, force: true });
15893
+ await rm2(dir, { recursive: true, force: true });
14935
15894
  }
14936
15895
  }
14937
15896
  async function main() {
@@ -15008,6 +15967,7 @@ Exit codes:
15008
15967
  registerSecretsCommands(program);
15009
15968
  registerBillingCommands(program);
15010
15969
  registerOrgCommands(program);
15970
+ registerEnrichCommand(program);
15011
15971
  registerCsvCommands(program);
15012
15972
  registerDbCommands(program);
15013
15973
  registerFeedbackCommands(program);