@diafunc/cli 0.6.0 → 0.7.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "./chunk-LXTNUI3L.js";
3
+ } from "./chunk-QAMANXTQ.js";
4
4
 
5
5
  // src/index.ts
6
6
  import { Command } from "commander";
@@ -777,6 +777,7 @@ function registerLogoutCommand(parent) {
777
777
  method: "POST",
778
778
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
779
779
  body: new URLSearchParams({
780
+ client_id: profile.auth.clientId,
780
781
  token: profile.auth.refreshToken,
781
782
  token_type_hint: "refresh_token"
782
783
  }).toString()
@@ -1576,9 +1577,77 @@ function createStorageService(client) {
1576
1577
  path: "/backups/full/restore",
1577
1578
  body: request
1578
1579
  });
1579
- }
1580
+ },
1580
1581
  // --- Event write ops (moved from read-only block) ---
1581
1582
  // NOTE: createEvents / consumeEvents already exist above in the Events section.
1583
+ // --- Data sources ---
1584
+ async createDataSource(request) {
1585
+ return client.request({
1586
+ method: "POST",
1587
+ service: SERVICE3,
1588
+ path: `/data-sources`,
1589
+ body: request
1590
+ });
1591
+ },
1592
+ async listDataSources(projectId) {
1593
+ return client.request({
1594
+ method: "GET",
1595
+ service: SERVICE3,
1596
+ path: `/data-sources`,
1597
+ query: projectId ? { projectId } : void 0
1598
+ });
1599
+ },
1600
+ async getDataSource(id) {
1601
+ return client.request({
1602
+ method: "GET",
1603
+ service: SERVICE3,
1604
+ path: `/data-sources/${enc(id)}`
1605
+ });
1606
+ },
1607
+ async updateDataSource(id, request) {
1608
+ return client.request({
1609
+ method: "PUT",
1610
+ service: SERVICE3,
1611
+ path: `/data-sources/${enc(id)}`,
1612
+ body: request
1613
+ });
1614
+ },
1615
+ async deleteDataSource(id) {
1616
+ await client.request({
1617
+ method: "DELETE",
1618
+ service: SERVICE3,
1619
+ path: `/data-sources/${enc(id)}`
1620
+ });
1621
+ },
1622
+ async refreshDataSource(id) {
1623
+ return client.request({
1624
+ method: "POST",
1625
+ service: SERVICE3,
1626
+ path: `/data-sources/${enc(id)}/refresh`
1627
+ });
1628
+ },
1629
+ async listDataSourceRuns(id, limit) {
1630
+ return client.request({
1631
+ method: "GET",
1632
+ service: SERVICE3,
1633
+ path: `/data-sources/${enc(id)}/runs`,
1634
+ query: limit !== void 0 ? { limit } : void 0
1635
+ });
1636
+ },
1637
+ async getDataSourceRun(id, runId) {
1638
+ return client.request({
1639
+ method: "GET",
1640
+ service: SERVICE3,
1641
+ path: `/data-sources/${enc(id)}/runs/${enc(runId)}`
1642
+ });
1643
+ },
1644
+ async listDataSourceConnectorTypes() {
1645
+ return client.request({
1646
+ method: "GET",
1647
+ service: SERVICE3,
1648
+ path: `/data-sources/types`
1649
+ });
1650
+ }
1582
1651
  };
1583
1652
  }
1584
1653
 
@@ -3626,7 +3695,7 @@ Error: ${event.content}`));
3626
3695
  }
3627
3696
  async function runChatRepl(options) {
3628
3697
  const { input: promptInput } = await import("@inquirer/prompts");
3629
- const { getUpdateNotice } = await import("./update-check-M7H4GTM7.js");
3698
+ const { getUpdateNotice } = await import("./update-check-E3YHFRKF.js");
3630
3699
  let sessionId = options.session;
3631
3700
  console.log(chalk17.bold("Diafunc chat") + chalk17.dim(" \xB7 /help for commands, /quit to exit"));
3632
3701
  if (sessionId) {
@@ -4765,15 +4834,26 @@ async function deleteTrigger(triggerId) {
4765
4834
  await api.analysis.deleteTrigger(triggerId);
4766
4835
  console.log(chalk23.green(`\u2713 Deleted trigger ${triggerId}`));
4767
4836
  }
4768
- async function toggleTrigger(triggerId, active, cmd) {
4837
+ async function updateTriggerCmd(triggerId, options, cmd) {
4769
4838
  const outputFormat = getOutputFormat14(cmd);
4770
- const lc = active.toLowerCase();
4771
- if (lc !== "true" && lc !== "false") {
4772
- console.error(chalk23.red(`Invalid active value "${active}" \u2014 must be true or false.`));
4839
+ let activeFlag;
4840
+ if (options.active !== void 0) {
4841
+ const lc = options.active.toLowerCase();
4842
+ if (lc !== "true" && lc !== "false") {
4843
+ console.error(chalk23.red(`Invalid --active value "${options.active}" \u2014 must be true or false.`));
4844
+ process.exit(1);
4845
+ }
4846
+ activeFlag = lc === "true";
4847
+ }
4848
+ if (activeFlag === void 0 && !options.schedule) {
4849
+ console.error(chalk23.red("Pass at least one of --active or --schedule."));
4773
4850
  process.exit(1);
4774
4851
  }
4775
4852
  const api = createApiClient();
4776
- const trigger = await api.analysis.updateTrigger(triggerId, { active: lc === "true" });
4853
+ const trigger = await api.analysis.updateTrigger(triggerId, {
4854
+ active: activeFlag ?? null,
4855
+ scheduleSpec: options.schedule ?? null
4856
+ });
4777
4857
  format(trigger, { format: outputFormat });
4778
4858
  }
4779
4859
  function registerAnalyzeCommand(program) {
@@ -5037,9 +5117,241 @@ function registerAnalyzeCommand(program) {
5037
5117
  handleError(error);
5038
5118
  }
5039
5119
  });
5040
- triggers.command("toggle").description("Activate or deactivate a trigger").argument("<triggerId>", "Trigger ID").requiredOption("--active <bool>", "true or false").action(async (triggerId, options, cmd) => {
5120
+ triggers.command("update").description("Update a trigger \u2014 pause/resume (--active) and/or reschedule (--schedule)").argument("<triggerId>", "Trigger ID").option("--active <bool>", "true to resume, false to pause").option("--schedule <spec>", "New schedule spec (ISO-8601 instant for ONCE, Quartz cron for CRON)").action(async (triggerId, options, cmd) => {
5041
5121
  try {
5042
- await toggleTrigger(triggerId, options.active, cmd);
5122
+ await updateTriggerCmd(triggerId, options, cmd);
5123
+ } catch (error) {
5124
+ handleError(error);
5125
+ }
5126
+ });
5127
+ }
5128
+
5129
+ // src/commands/data-sources/index.ts
5130
+ import chalk24 from "chalk";
5131
+ function getOutputFormat15(cmd) {
5132
+ const config = loadConfig();
5133
+ const globalOpts = cmd.optsWithGlobals();
5134
+ return globalOpts.output ?? config.defaults.output ?? "human";
5135
+ }
5136
+ function parseConfigPairs(pairs) {
5137
+ const out = {};
5138
+ if (!pairs) return out;
5139
+ for (const pair of pairs) {
5140
+ const idx = pair.indexOf("=");
5141
+ if (idx <= 0) {
5142
+ throw new Error(`Invalid --config "${pair}" \u2014 expected key=value.`);
5143
+ }
5144
+ const key = pair.substring(0, idx).trim();
5145
+ const value = pair.substring(idx + 1);
5146
+ if (!key) {
5147
+ throw new Error(`Invalid --config "${pair}" \u2014 empty key.`);
5148
+ }
5149
+ out[key] = value;
5150
+ }
5151
+ return out;
5152
+ }
5153
+ function dataSourceTableRow(ds) {
5154
+ return {
5155
+ id: ds.id,
5156
+ name: ds.name,
5157
+ type: ds.type,
5158
+ target: `${ds.targetEntityId}@${ds.targetEntityBranch}`,
5159
+ schedule: ds.scheduleCron ?? "manual",
5160
+ lastStatus: ds.lastRunStatus ?? "\u2014",
5161
+ lastRefreshAt: ds.lastRefreshAt ?? "\u2014"
5162
+ };
5163
+ }
5164
+ function runTableRow(run) {
5165
+ return {
5166
+ runId: run.runId,
5167
+ status: run.status,
5168
+ startedAt: run.startedAt ?? "\u2014",
5169
+ finishedAt: run.finishedAt ?? "\u2014",
5170
+ rows: run.rowsImported !== null && run.rowsImported !== void 0 ? String(run.rowsImported) : "\u2014",
5171
+ triggeredBy: run.triggeredBy ?? "\u2014"
5172
+ };
5173
+ }
5174
+ async function listDataSources(projectId, cmd) {
5175
+ const outputFormat = getOutputFormat15(cmd);
5176
+ const api = createApiClient();
5177
+ const sources = await api.storage.listDataSources(projectId);
5178
+ if (outputFormat === "human" && sources.length === 0) {
5179
+ console.log(chalk24.dim("No data sources found."));
5180
+ return;
5181
+ }
5182
+ format(sources.map(dataSourceTableRow), {
5183
+ format: outputFormat,
5184
+ columns: ["id", "name", "type", "target", "schedule", "lastStatus", "lastRefreshAt"]
5185
+ });
5186
+ }
5187
+ async function getDataSource(id, cmd) {
5188
+ const outputFormat = getOutputFormat15(cmd);
5189
+ const api = createApiClient();
5190
+ const ds = await api.storage.getDataSource(id);
5191
+ format(ds, { format: outputFormat });
5192
+ }
5193
+ async function createDataSource(options, cmd) {
5194
+ const outputFormat = getOutputFormat15(cmd);
5195
+ const api = createApiClient();
5196
+ const request = {
5197
+ projectId: options.projectId,
5198
+ projectBranch: options.projectBranch,
5199
+ targetEntityId: options.targetEntityId,
5200
+ targetEntityBranch: options.targetEntityBranch,
5201
+ name: options.name,
5202
+ type: options.type,
5203
+ config: parseConfigPairs(options.config),
5204
+ scheduleCron: options.scheduleCron ?? null
5205
+ };
5206
+ const ds = await api.storage.createDataSource(request);
5207
+ if (outputFormat === "human") {
5208
+ console.log(chalk24.green(`\u2713 Created data source ${ds.id}`));
5209
+ console.log(chalk24.dim(` Last run: ${ds.lastRunStatus ?? "\u2014"}`));
5210
+ if (ds.lastRunError) console.log(chalk24.dim(` Error: ${ds.lastRunError}`));
5211
+ } else {
5212
+ format(ds, { format: outputFormat });
5213
+ }
5214
+ }
5215
+ async function updateDataSource(id, options, cmd) {
5216
+ const outputFormat = getOutputFormat15(cmd);
5217
+ if (options.name === void 0 && options.type === void 0 && (!options.config || options.config.length === 0) && options.scheduleCron === void 0 && !options.clearSchedule) {
5218
+ throw new Error("Provide at least one of --name, --type, --config, --schedule-cron, or --clear-schedule.");
5219
+ }
5220
+ if (options.scheduleCron !== void 0 && options.clearSchedule) {
5221
+ throw new Error("--schedule-cron and --clear-schedule are mutually exclusive.");
5222
+ }
5223
+ let scheduleCron;
5224
+ if (options.clearSchedule) {
5225
+ scheduleCron = "";
5226
+ } else if (options.scheduleCron !== void 0) {
5227
+ scheduleCron = options.scheduleCron;
5228
+ } else {
5229
+ scheduleCron = null;
5230
+ }
5231
+ const request = {
5232
+ name: options.name ?? null,
5233
+ type: options.type ?? null,
5234
+ config: options.config && options.config.length > 0 ? parseConfigPairs(options.config) : null,
5235
+ scheduleCron
5236
+ };
5237
+ const api = createApiClient();
5238
+ const ds = await api.storage.updateDataSource(id, request);
5239
+ if (outputFormat === "human") {
5240
+ console.log(chalk24.green(`\u2713 Updated data source ${ds.id}`));
5241
+ } else {
5242
+ format(ds, { format: outputFormat });
5243
+ }
5244
+ }
5245
+ async function deleteDataSource(id) {
5246
+ const api = createApiClient();
5247
+ await api.storage.deleteDataSource(id);
5248
+ console.log(chalk24.green(`\u2713 Deleted data source ${id}`));
5249
+ }
5250
+ async function refreshDataSource(id, cmd) {
5251
+ const outputFormat = getOutputFormat15(cmd);
5252
+ const api = createApiClient();
5253
+ const run = await api.storage.refreshDataSource(id);
5254
+ if (outputFormat === "human") {
5255
+ console.log(chalk24.green(`\u2713 Refresh queued \u2014 run ${run.runId}, status ${run.status}`));
5256
+ if (run.errorMessage) console.log(chalk24.red(` Error: ${run.errorMessage}`));
5257
+ } else {
5258
+ format(run, { format: outputFormat });
5259
+ }
5260
+ }
5261
+ async function listRuns2(id, limit, cmd) {
5262
+ const outputFormat = getOutputFormat15(cmd);
5263
+ const api = createApiClient();
5264
+ const runs = await api.storage.listDataSourceRuns(id, limit);
5265
+ if (outputFormat === "human" && runs.length === 0) {
5266
+ console.log(chalk24.dim("No runs yet."));
5267
+ return;
5268
+ }
5269
+ format(runs.map(runTableRow), {
5270
+ format: outputFormat,
5271
+ columns: ["runId", "status", "startedAt", "finishedAt", "rows", "triggeredBy"]
5272
+ });
5273
+ }
5274
+ async function getRun(id, runId, cmd) {
5275
+ const outputFormat = getOutputFormat15(cmd);
5276
+ const api = createApiClient();
5277
+ const run = await api.storage.getDataSourceRun(id, runId);
5278
+ format(run, { format: outputFormat });
5279
+ }
5280
+ async function listConnectorTypes(cmd) {
5281
+ const outputFormat = getOutputFormat15(cmd);
5282
+ const api = createApiClient();
5283
+ const types = await api.storage.listDataSourceConnectorTypes();
5284
+ if (outputFormat === "human") {
5285
+ if (types.length === 0) {
5286
+ console.log(chalk24.dim("No connector types registered."));
5287
+ return;
5288
+ }
5289
+ for (const t of types) console.log(t);
5290
+ } else {
5291
+ format(types, { format: outputFormat });
5292
+ }
5293
+ }
5294
+ function registerDataSourcesCommands(program) {
5295
+ const dataSources = program.command("data-sources").description("Manage scheduled DataSource imports (Google Sheets, S3 URL, JDBC)");
5296
+ dataSources.command("list").description("List data sources (optionally scoped to a project)").option("--project-id <id>", "Filter by project ID").action(async (options, cmd) => {
5297
+ try {
5298
+ await listDataSources(options.projectId, cmd);
5299
+ } catch (error) {
5300
+ handleError(error);
5301
+ }
5302
+ });
5303
+ dataSources.command("get").description("Show one data source").argument("<id>", "Data source ID (UUID)").action(async (id, _options, cmd) => {
5304
+ try {
5305
+ await getDataSource(id, cmd);
5306
+ } catch (error) {
5307
+ handleError(error);
5308
+ }
5309
+ });
5310
+ dataSources.command("create").description("Create a data source (runs the initial fetch synchronously)").requiredOption("--project-id <id>", "Project ID").requiredOption("--project-branch <branch>", 'Project branch (usually "main")').requiredOption("--target-entity-id <id>", "Target table entity ID").requiredOption("--target-entity-branch <branch>", "Target table entity branch").requiredOption("--name <name>", "Display name").requiredOption("--type <type>", "Connector type (google_sheets, s3_url, jdbc)").option("--config <key=value>", "Connector config field \u2014 repeat for multiple", (value, prev = []) => prev.concat([value]), []).option("--schedule-cron <expr>", 'Quartz cron expression (e.g. "0 0 2 * * ?" for daily 02:00 UTC); omit for manual-only').action(async (options, cmd) => {
5311
+ try {
5312
+ await createDataSource(options, cmd);
5313
+ } catch (error) {
5314
+ handleError(error);
5315
+ }
5316
+ });
5317
+ dataSources.command("update").description("Update a data source (omit a flag to leave that field unchanged)").argument("<id>", "Data source ID").option("--name <name>", "New display name").option("--type <type>", "New connector type").option("--config <key=value>", 'Replace the entire config map \u2014 repeat for multiple. Send "[redacted]" as a value to keep the existing encrypted credential.', (value, prev = []) => prev.concat([value]), []).option("--schedule-cron <expr>", "New Quartz cron expression").option("--clear-schedule", "Switch this data source to manual-only").action(async (id, options, cmd) => {
5318
+ try {
5319
+ await updateDataSource(id, options, cmd);
5320
+ } catch (error) {
5321
+ handleError(error);
5322
+ }
5323
+ });
5324
+ dataSources.command("delete").description("Delete a data source (existing imported rows are kept)").argument("<id>", "Data source ID").action(async (id) => {
5325
+ try {
5326
+ await deleteDataSource(id);
5327
+ } catch (error) {
5328
+ handleError(error);
5329
+ }
5330
+ });
5331
+ dataSources.command("refresh").description("Trigger an out-of-schedule refresh now").argument("<id>", "Data source ID").action(async (id, _options, cmd) => {
5332
+ try {
5333
+ await refreshDataSource(id, cmd);
5334
+ } catch (error) {
5335
+ handleError(error);
5336
+ }
5337
+ });
5338
+ dataSources.command("runs").description("List recent runs for a data source (newest first)").argument("<id>", "Data source ID").option("--limit <n>", "Max number of runs to show", "20").action(async (id, options, cmd) => {
5339
+ try {
5340
+ await listRuns2(id, parseInt(options.limit, 10), cmd);
5341
+ } catch (error) {
5342
+ handleError(error);
5343
+ }
5344
+ });
5345
+ dataSources.command("run").description("Show one run").argument("<id>", "Data source ID").argument("<runId>", "Run ID").action(async (id, runId, _options, cmd) => {
5346
+ try {
5347
+ await getRun(id, runId, cmd);
5348
+ } catch (error) {
5349
+ handleError(error);
5350
+ }
5351
+ });
5352
+ dataSources.command("types").description("List registered connector types").action(async (_options, cmd) => {
5353
+ try {
5354
+ await listConnectorTypes(cmd);
5043
5355
  } catch (error) {
5044
5356
  handleError(error);
5045
5357
  }
@@ -5300,7 +5612,7 @@ function registerCompletionCommand(program) {
5300
5612
  }
5301
5613
 
5302
5614
  // src/commands/whoami/index.ts
5303
- import chalk24 from "chalk";
5615
+ import chalk25 from "chalk";
5304
5616
  function registerWhoamiCommand(program) {
5305
5617
  program.command("whoami").description("Show the currently authenticated user").action(async (_options, cmd) => {
5306
5618
  try {
@@ -5310,8 +5622,8 @@ function registerWhoamiCommand(program) {
5310
5622
  const api = createApiClient();
5311
5623
  const user = await api.admin.getMyUser();
5312
5624
  if (outputFormat === "human") {
5313
- console.log(chalk24.bold(user.name) + chalk24.dim(` <${user.email}>`));
5314
- console.log(chalk24.dim(` Role: ${user.role} \xB7 Remaining credits: ${user.remainingCredits} \xB7 Profile: ${config.currentProfile}`));
5625
+ console.log(chalk25.bold(user.name) + chalk25.dim(` <${user.email}>`));
5626
+ console.log(chalk25.dim(` Role: ${user.role} \xB7 Remaining credits: ${user.remainingCredits} \xB7 Profile: ${config.currentProfile}`));
5315
5627
  } else {
5316
5628
  format(user, { format: outputFormat });
5317
5629
  }
@@ -5322,8 +5634,8 @@ function registerWhoamiCommand(program) {
5322
5634
  }
5323
5635
 
5324
5636
  // src/commands/utilization/index.ts
5325
- import chalk25 from "chalk";
5326
- function getOutputFormat15(cmd) {
5637
+ import chalk26 from "chalk";
5638
+ function getOutputFormat16(cmd) {
5327
5639
  const config = loadConfig();
5328
5640
  const globalOpts = cmd.optsWithGlobals();
5329
5641
  return globalOpts.output ?? config.defaults.output ?? "human";
@@ -5331,27 +5643,27 @@ function getOutputFormat15(cmd) {
5331
5643
  function printUtilizationHuman(u, label) {
5332
5644
  const when = u.day !== null && u.day !== void 0 ? `${u.year}-${String(u.month).padStart(2, "0")}-${String(u.day).padStart(2, "0")}` : `${u.year}-${String(u.month).padStart(2, "0")}`;
5333
5645
  if (label) {
5334
- console.log(chalk25.bold(label) + " " + chalk25.dim(when));
5646
+ console.log(chalk26.bold(label) + " " + chalk26.dim(when));
5335
5647
  } else {
5336
- console.log(chalk25.bold(when));
5648
+ console.log(chalk26.bold(when));
5337
5649
  }
5338
5650
  if (u.types.length === 0) {
5339
- console.log(chalk25.dim(" (no usage)"));
5651
+ console.log(chalk26.dim(" (no usage)"));
5340
5652
  return;
5341
5653
  }
5342
5654
  for (const t of u.types) {
5343
5655
  console.log(
5344
- ` ${t.type.padEnd(24)} ${chalk25.cyan(String(t.quantity).padStart(10))} ${chalk25.dim("credits:")} ${t.credits.toFixed(2)}`
5656
+ ` ${t.type.padEnd(24)} ${chalk26.cyan(String(t.quantity).padStart(10))} ${chalk26.dim("credits:")} ${t.credits.toFixed(2)}`
5345
5657
  );
5346
5658
  }
5347
5659
  const total = u.totalCredits ?? u.types.reduce((s, t) => s + t.credits, 0);
5348
- console.log(chalk25.bold(` Total credits: ${total.toFixed(2)}`));
5660
+ console.log(chalk26.bold(` Total credits: ${total.toFixed(2)}`));
5349
5661
  }
5350
5662
  function registerUtilizationCommand(program) {
5351
5663
  const util = program.command("utilization").description("Show credit utilization");
5352
5664
  util.command("actual", { isDefault: true }).description("Show current utilization (default subcommand)").action(async (_options, cmd) => {
5353
5665
  try {
5354
- const outputFormat = getOutputFormat15(cmd);
5666
+ const outputFormat = getOutputFormat16(cmd);
5355
5667
  const api = createApiClient();
5356
5668
  const utilization = await api.admin.getActualUtilization();
5357
5669
  if (outputFormat === "human") {
@@ -5365,12 +5677,12 @@ function registerUtilizationCommand(program) {
5365
5677
  });
5366
5678
  util.command("history").description("Show utilization history").action(async (_options, cmd) => {
5367
5679
  try {
5368
- const outputFormat = getOutputFormat15(cmd);
5680
+ const outputFormat = getOutputFormat16(cmd);
5369
5681
  const api = createApiClient();
5370
5682
  const history = await api.admin.getUtilizationHistory();
5371
5683
  if (outputFormat === "human") {
5372
5684
  if (history.length === 0) {
5373
- console.log(chalk25.dim("No usage recorded."));
5685
+ console.log(chalk26.dim("No usage recorded."));
5374
5686
  return;
5375
5687
  }
5376
5688
  for (const u of history) {
@@ -5387,8 +5699,8 @@ function registerUtilizationCommand(program) {
5387
5699
  }
5388
5700
 
5389
5701
  // src/commands/entity-branch/index.ts
5390
- import chalk26 from "chalk";
5391
- function getOutputFormat16(cmd) {
5702
+ import chalk27 from "chalk";
5703
+ function getOutputFormat17(cmd) {
5392
5704
  const config = loadConfig();
5393
5705
  const globalOpts = cmd.optsWithGlobals();
5394
5706
  return globalOpts.output ?? config.defaults.output ?? "human";
@@ -5401,7 +5713,7 @@ function registerEntityBranchCommands(program) {
5401
5713
  const eb = program.command("entity-branch").description("Manage entity branches (parallel versions of a single entity)");
5402
5714
  eb.command("list").description("List branches of an entity").argument("<ref>", "Entity reference (projectId/branch/entityId)").action(async (ref, _options, cmd) => {
5403
5715
  try {
5404
- const outputFormat = getOutputFormat16(cmd);
5716
+ const outputFormat = getOutputFormat17(cmd);
5405
5717
  const overrides = getOverrides9(cmd);
5406
5718
  const resolved = parseEntityReference(ref, overrides);
5407
5719
  const api = createApiClient();
@@ -5431,7 +5743,7 @@ function registerEntityBranchCommands(program) {
5431
5743
  sourceEntityBranch: resolved.entityBranch,
5432
5744
  targetEntityBranch: targetBranch
5433
5745
  });
5434
- console.log(chalk26.green(`Entity branch "${targetBranch}" created from "${resolved.entityBranch}".`));
5746
+ console.log(chalk27.green(`Entity branch "${targetBranch}" created from "${resolved.entityBranch}".`));
5435
5747
  } catch (error) {
5436
5748
  handleError(error);
5437
5749
  }
@@ -5439,7 +5751,7 @@ function registerEntityBranchCommands(program) {
5439
5751
  }
5440
5752
 
5441
5753
  // src/commands/subscription/index.ts
5442
- function getOutputFormat17(cmd) {
5754
+ function getOutputFormat18(cmd) {
5443
5755
  const config = loadConfig();
5444
5756
  const globalOpts = cmd.optsWithGlobals();
5445
5757
  return globalOpts.output ?? config.defaults.output ?? "human";
@@ -5450,7 +5762,7 @@ function registerSubscriptionCommand(program) {
5450
5762
  try {
5451
5763
  const api = createApiClient();
5452
5764
  const s = await api.admin.getCurrentSubscription();
5453
- format(s, { format: getOutputFormat17(cmd) });
5765
+ format(s, { format: getOutputFormat18(cmd) });
5454
5766
  } catch (error) {
5455
5767
  handleError(error);
5456
5768
  }
@@ -5459,7 +5771,7 @@ function registerSubscriptionCommand(program) {
5459
5771
  try {
5460
5772
  const api = createApiClient();
5461
5773
  const s = await api.admin.getNextSubscription();
5462
- format(s, { format: getOutputFormat17(cmd) });
5774
+ format(s, { format: getOutputFormat18(cmd) });
5463
5775
  } catch (error) {
5464
5776
  handleError(error);
5465
5777
  }
@@ -5468,7 +5780,7 @@ function registerSubscriptionCommand(program) {
5468
5780
  try {
5469
5781
  const api = createApiClient();
5470
5782
  const plans = await api.admin.getSubscriptionPlans(subscriptionToken);
5471
- format(plans, { format: getOutputFormat17(cmd) });
5783
+ format(plans, { format: getOutputFormat18(cmd) });
5472
5784
  } catch (error) {
5473
5785
  handleError(error);
5474
5786
  }
@@ -5476,9 +5788,9 @@ function registerSubscriptionCommand(program) {
5476
5788
  }
5477
5789
 
5478
5790
  // src/commands/invoice/index.ts
5479
- import chalk27 from "chalk";
5791
+ import chalk28 from "chalk";
5480
5792
  import * as fs7 from "fs";
5481
- function getOutputFormat18(cmd) {
5793
+ function getOutputFormat19(cmd) {
5482
5794
  const config = loadConfig();
5483
5795
  const globalOpts = cmd.optsWithGlobals();
5484
5796
  return globalOpts.output ?? config.defaults.output ?? "human";
@@ -5490,7 +5802,7 @@ function registerInvoiceCommand(program) {
5490
5802
  const api = createApiClient();
5491
5803
  const invoices = await api.admin.getInvoices();
5492
5804
  format(invoices, {
5493
- format: getOutputFormat18(cmd),
5805
+ format: getOutputFormat19(cmd),
5494
5806
  columns: ["invoiceNumber", "issued", "periodFrom", "periodTo", "total", "status"]
5495
5807
  });
5496
5808
  } catch (error) {
@@ -5504,7 +5816,7 @@ function registerInvoiceCommand(program) {
5504
5816
  const buffer = Buffer.from(await response.arrayBuffer());
5505
5817
  const outPath = options.out ?? fileName;
5506
5818
  fs7.writeFileSync(outPath, buffer);
5507
- console.log(chalk27.green(`Invoice saved to ${outPath}`));
5819
+ console.log(chalk28.green(`Invoice saved to ${outPath}`));
5508
5820
  } catch (error) {
5509
5821
  handleError(error);
5510
5822
  }
@@ -5512,7 +5824,7 @@ function registerInvoiceCommand(program) {
5512
5824
  }
5513
5825
 
5514
5826
  // src/commands/shell/index.ts
5515
- import chalk28 from "chalk";
5827
+ import chalk29 from "chalk";
5516
5828
  import * as fs8 from "fs";
5517
5829
  import * as os3 from "os";
5518
5830
  import * as path6 from "path";
@@ -5578,21 +5890,21 @@ async function evaluate(api, fnRef, language, sourceCode) {
5578
5890
  }, false);
5579
5891
  if (result.outputs?.length) {
5580
5892
  for (const out of result.outputs) {
5581
- console.log(chalk28.dim(` [${out.type}]`) + " " + out.output);
5893
+ console.log(chalk29.dim(` [${out.type}]`) + " " + out.output);
5582
5894
  }
5583
5895
  }
5584
5896
  if (result.successful) {
5585
5897
  if (result.result) {
5586
- console.log(chalk28.green("=> ") + result.result);
5898
+ console.log(chalk29.green("=> ") + result.result);
5587
5899
  } else {
5588
- console.log(chalk28.dim("=> (no value)"));
5900
+ console.log(chalk29.dim("=> (no value)"));
5589
5901
  }
5590
5902
  const duration = result.completed - result.started;
5591
- console.log(chalk28.dim(` [${duration}ms \xB7 ${evaluationId}]`));
5903
+ console.log(chalk29.dim(` [${duration}ms \xB7 ${evaluationId}]`));
5592
5904
  } else {
5593
- console.log(chalk28.red("error: ") + result.error);
5905
+ console.log(chalk29.red("error: ") + result.error);
5594
5906
  if (result.lineNumber > 0) {
5595
- console.log(chalk28.dim(` at line ${result.lineNumber}, col ${result.columnNumber}`));
5907
+ console.log(chalk29.dim(` at line ${result.lineNumber}, col ${result.columnNumber}`));
5596
5908
  }
5597
5909
  }
5598
5910
  }
@@ -5600,9 +5912,9 @@ function registerShellCommand(program) {
5600
5912
  program.command("shell").description("Interactive REPL for function code evaluation").option("--function <ref>", "Function entity reference to use as scratch (required)").option("--language <lang>", "Source language", "JavaScript").action(async (options, cmd) => {
5601
5913
  try {
5602
5914
  if (!options.function) {
5603
- console.error(chalk28.red("Missing --function <ref>."));
5604
- console.error(chalk28.dim("Pass an existing or new function entity reference to use as the shell target."));
5605
- console.error(chalk28.dim("Example: diafunc shell --function my-project/main/scratch/main --language JavaScript"));
5915
+ console.error(chalk29.red("Missing --function <ref>."));
5916
+ console.error(chalk29.dim("Pass an existing or new function entity reference to use as the shell target."));
5917
+ console.error(chalk29.dim("Example: diafunc shell --function my-project/main/scratch/main --language JavaScript"));
5606
5918
  process.exit(1);
5607
5919
  }
5608
5920
  const config = loadConfig();
@@ -5613,18 +5925,18 @@ function registerShellCommand(program) {
5613
5925
  });
5614
5926
  const api = createApiClient();
5615
5927
  const { input: promptInput } = await import("@inquirer/prompts");
5616
- const { getUpdateNotice } = await import("./update-check-M7H4GTM7.js");
5617
- console.log(chalk28.bold("Diafunc shell") + chalk28.dim(` \xB7 function ${fnRef.entityId} \xB7 ${options.language}`));
5618
- console.log(chalk28.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
5619
- console.log(chalk28.dim("Commands: /edit (multi-line in $EDITOR), /lang <name>, /file <path>, /help, /quit"));
5928
+ const { getUpdateNotice } = await import("./update-check-E3YHFRKF.js");
5929
+ console.log(chalk29.bold("Diafunc shell") + chalk29.dim(` \xB7 function ${fnRef.entityId} \xB7 ${options.language}`));
5930
+ console.log(chalk29.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
5931
+ console.log(chalk29.dim("Commands: /edit (multi-line in $EDITOR), /lang <name>, /file <path>, /help, /quit"));
5620
5932
  const notice = await getUpdateNotice();
5621
- if (notice) console.log(chalk28.dim(notice));
5933
+ if (notice) console.log(chalk29.dim(notice));
5622
5934
  console.log();
5623
5935
  let language = options.language;
5624
5936
  for (; ; ) {
5625
5937
  let line;
5626
5938
  try {
5627
- line = await promptInput({ message: chalk28.cyan.bold(`${language} >`) });
5939
+ line = await promptInput({ message: chalk29.cyan.bold(`${language} >`) });
5628
5940
  } catch {
5629
5941
  console.log();
5630
5942
  return;
@@ -5642,54 +5954,54 @@ function registerShellCommand(program) {
5642
5954
  case "help":
5643
5955
  case "h":
5644
5956
  case "?":
5645
- console.log(chalk28.dim(" /edit open $EDITOR for multi-line code"));
5646
- console.log(chalk28.dim(" /file <path> evaluate the contents of a file"));
5647
- console.log(chalk28.dim(" /lang <name> switch language (Java, JavaScript, Kotlin, Python, Scala)"));
5648
- console.log(chalk28.dim(" /quit exit the shell"));
5957
+ console.log(chalk29.dim(" /edit open $EDITOR for multi-line code"));
5958
+ console.log(chalk29.dim(" /file <path> evaluate the contents of a file"));
5959
+ console.log(chalk29.dim(" /lang <name> switch language (Java, JavaScript, Kotlin, Python, Scala)"));
5960
+ console.log(chalk29.dim(" /quit exit the shell"));
5649
5961
  continue;
5650
5962
  case "lang":
5651
5963
  if (arg) language = arg;
5652
- console.log(chalk28.dim(`Language: ${language}`));
5964
+ console.log(chalk29.dim(`Language: ${language}`));
5653
5965
  continue;
5654
5966
  case "edit": {
5655
5967
  const sourceCode = await openInEditor("", extensionFor2(language));
5656
5968
  if (!sourceCode.trim()) {
5657
- console.log(chalk28.dim("(empty \u2014 not evaluated)"));
5969
+ console.log(chalk29.dim("(empty \u2014 not evaluated)"));
5658
5970
  continue;
5659
5971
  }
5660
5972
  try {
5661
5973
  await evaluate(api, fnRef, language, sourceCode);
5662
5974
  } catch (e) {
5663
- console.error(chalk28.red(e.message));
5975
+ console.error(chalk29.red(e.message));
5664
5976
  }
5665
5977
  continue;
5666
5978
  }
5667
5979
  case "file": {
5668
5980
  if (!arg) {
5669
- console.log(chalk28.dim("usage: /file <path>"));
5981
+ console.log(chalk29.dim("usage: /file <path>"));
5670
5982
  continue;
5671
5983
  }
5672
5984
  if (!fs8.existsSync(arg)) {
5673
- console.log(chalk28.red(`file not found: ${arg}`));
5985
+ console.log(chalk29.red(`file not found: ${arg}`));
5674
5986
  continue;
5675
5987
  }
5676
5988
  const sourceCode = fs8.readFileSync(arg, "utf-8");
5677
5989
  try {
5678
5990
  await evaluate(api, fnRef, language, sourceCode);
5679
5991
  } catch (e) {
5680
- console.error(chalk28.red(e.message));
5992
+ console.error(chalk29.red(e.message));
5681
5993
  }
5682
5994
  continue;
5683
5995
  }
5684
5996
  default:
5685
- console.log(chalk28.dim(`Unknown command: /${cmd2}. Try /help.`));
5997
+ console.log(chalk29.dim(`Unknown command: /${cmd2}. Try /help.`));
5686
5998
  continue;
5687
5999
  }
5688
6000
  }
5689
6001
  try {
5690
6002
  await evaluate(api, fnRef, language, trimmed);
5691
6003
  } catch (e) {
5692
- console.error(chalk28.red(e.message));
6004
+ console.error(chalk29.red(e.message));
5693
6005
  }
5694
6006
  }
5695
6007
  } catch (error) {
@@ -5699,7 +6011,7 @@ function registerShellCommand(program) {
5699
6011
  }
5700
6012
 
5701
6013
  // src/commands/update/index.ts
5702
- import chalk29 from "chalk";
6014
+ import chalk30 from "chalk";
5703
6015
  import * as path7 from "path";
5704
6016
  import { spawn as spawn4 } from "child_process";
5705
6017
 
@@ -5745,14 +6057,14 @@ function registerUpdateCommand(program) {
5745
6057
  const install = detectInstall();
5746
6058
  const latest = await fetchLatestVersion();
5747
6059
  if (latest === package_default.version) {
5748
- console.log(chalk29.dim(`diafunc is already at the latest version (${package_default.version}).`));
6060
+ console.log(chalk30.dim(`diafunc is already at the latest version (${package_default.version}).`));
5749
6061
  return;
5750
6062
  }
5751
- console.log(chalk29.dim(`Current: ${package_default.version} \u2192 Available: ${latest}`));
6063
+ console.log(chalk30.dim(`Current: ${package_default.version} \u2192 Available: ${latest}`));
5752
6064
  if (install.method === "npm") {
5753
6065
  console.log();
5754
6066
  console.log("Installed via npm. Upgrade with:");
5755
- console.log(chalk29.bold(` npm install -g @diafunc/cli@${latest}`));
6067
+ console.log(chalk30.bold(` npm install -g @diafunc/cli@${latest}`));
5756
6068
  return;
5757
6069
  }
5758
6070
  const installDir = path7.dirname(install.binaryPath);
@@ -5766,7 +6078,7 @@ function registerUpdateCommand(program) {
5766
6078
  }
5767
6079
 
5768
6080
  // src/commands/uninstall/index.ts
5769
- import chalk30 from "chalk";
6081
+ import chalk31 from "chalk";
5770
6082
  import { spawn as spawn5 } from "child_process";
5771
6083
  import * as fs10 from "fs";
5772
6084
  import * as os4 from "os";
@@ -5778,11 +6090,11 @@ function registerUninstallCommand(program) {
5778
6090
  const configDir = path8.join(os4.homedir(), ".diafunc");
5779
6091
  if (install.method === "npm") {
5780
6092
  console.log("Installed via npm. Remove with:");
5781
- console.log(chalk30.bold(" npm uninstall -g @diafunc/cli"));
6093
+ console.log(chalk31.bold(" npm uninstall -g @diafunc/cli"));
5782
6094
  if (fs10.existsSync(configDir)) {
5783
6095
  console.log();
5784
6096
  console.log(`Config + credentials live at ${configDir} \u2014 remove manually with:`);
5785
- console.log(chalk30.bold(` rm -rf ${configDir}`));
6097
+ console.log(chalk31.bold(` rm -rf ${configDir}`));
5786
6098
  }
5787
6099
  return;
5788
6100
  }
@@ -5792,7 +6104,7 @@ function registerUninstallCommand(program) {
5792
6104
  default: false
5793
6105
  });
5794
6106
  if (!removeBinary) {
5795
- console.log(chalk30.dim("Aborted."));
6107
+ console.log(chalk31.dim("Aborted."));
5796
6108
  return;
5797
6109
  }
5798
6110
  let removeConfig = options.purge ?? false;
@@ -5804,7 +6116,7 @@ function registerUninstallCommand(program) {
5804
6116
  }
5805
6117
  if (removeConfig && fs10.existsSync(configDir)) {
5806
6118
  fs10.rmSync(configDir, { recursive: true, force: true });
5807
- console.log(chalk30.dim(`Removed ${configDir}`));
6119
+ console.log(chalk31.dim(`Removed ${configDir}`));
5808
6120
  }
5809
6121
  if (process.platform === "win32") {
5810
6122
  const cmd = `timeout /t 2 /nobreak >nul & del /f /q "${install.binaryPath}"`;
@@ -5814,13 +6126,13 @@ function registerUninstallCommand(program) {
5814
6126
  windowsHide: true
5815
6127
  });
5816
6128
  child.unref();
5817
- console.log(chalk30.dim(`Removing ${install.binaryPath} on exit...`));
6129
+ console.log(chalk31.dim(`Removing ${install.binaryPath} on exit...`));
5818
6130
  console.log();
5819
6131
  console.log("diafunc uninstalled.");
5820
6132
  return;
5821
6133
  }
5822
6134
  fs10.rmSync(install.binaryPath, { force: true });
5823
- console.log(chalk30.dim(`Removed ${install.binaryPath}`));
6135
+ console.log(chalk31.dim(`Removed ${install.binaryPath}`));
5824
6136
  console.log();
5825
6137
  console.log("diafunc uninstalled.");
5826
6138
  } catch (error) {
@@ -5855,6 +6167,7 @@ function createProgram() {
5855
6167
  registerAdminCommands(program);
5856
6168
  registerStatusCommands(program);
5857
6169
  registerAnalyzeCommand(program);
6170
+ registerDataSourcesCommands(program);
5858
6171
  registerCompletionCommand(program);
5859
6172
  registerWhoamiCommand(program);
5860
6173
  registerUtilizationCommand(program);
@@ -5870,4 +6183,4 @@ function createProgram() {
5870
6183
  export {
5871
6184
  createProgram
5872
6185
  };
5873
- //# sourceMappingURL=chunk-SEX4YGKJ.js.map
6186
+ //# sourceMappingURL=chunk-L63Y72FJ.js.map