@diagonal-hq/cli 0.42.21 → 0.42.23

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.
@@ -23696,6 +23696,7 @@ var SystemPermissions = {
23696
23696
  ShowDiagonalSupportChat: { uid: "01a1a9f9-1e88-730b-8e66-bd78ad4f8eb4", slug: "show_diagonal_support_chat", name: "Show Diagonal Support Chat" },
23697
23697
  SystemAdministrator: { uid: "01a1a9f9-1e88-730b-8e66-c3db071eb4d8", slug: "access_system_admin", name: "Access System Admin" },
23698
23698
  UpdateWorkspaceFields: { uid: "01a1a9f9-1e88-730b-8e66-c50e2a3d9577", slug: "update_workspace_fields", name: "Update Workspace Fields" },
23699
+ UseElementPicker: { uid: "01a20151-b531-720c-8e48-649c8eebacb1", slug: "use_element_picker", name: "Use Element Picker" },
23699
23700
  ViewAiCosts: { uid: "01a1a9f9-1e88-730b-8e66-c89571de84d5", slug: "view_ai_costs", name: "View Ai Costs" },
23700
23701
  ViewEntityGraph: { uid: "01a1a9f9-1e88-730b-8e66-ce249862be34", slug: "view_entity_graph", name: "View Entity Graph" },
23701
23702
  ViewWorkspaceAnalytics: { uid: "01a1a9f9-1e88-730b-8e66-d3284ac2edcd", slug: "view_workspace_analytics", name: "View Workspace Analytics" }
@@ -21,6 +21,9 @@ import {
21
21
  } from "./cli-chunk-KP2RSHLJ.mjs";
22
22
 
23
23
  // scripts/lib/runtime-build/api-cli.mjs
24
+ import { existsSync, readFileSync } from "node:fs";
25
+ import { join } from "node:path";
26
+ import { parseEnv } from "node:util";
24
27
  var WORKFLOWS_USAGE = "Usage: diagonal workflows [--json]";
25
28
  var RUN_USAGE = "Usage: diagonal run <path> [--input '<json object>'] [--json]";
26
29
  var LOGS_USAGE = "Usage: diagonal logs [path | execution id] [--status <success|error|exception|started|pending>] [--limit <1-100>] [--json]";
@@ -28,6 +31,22 @@ var SUCCESS = "execution.success";
28
31
  var PENDING = "execution.pending";
29
32
  var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
30
33
  var STATUSES = ["success", "error", "exception", "started", "pending"];
34
+ var WORKSPACE_ENV_KEYS = ["DIAGONAL_URL", "DIAGONAL_API_KEY"];
35
+ function withWorkspaceEnv(io) {
36
+ const file = join(io.cwd, ".env");
37
+ const setInEnvironment = WORKSPACE_ENV_KEYS.some((key) => (io.env[key] ?? "").trim() !== "");
38
+ if (setInEnvironment || !existsSync(file)) {
39
+ return io;
40
+ }
41
+ const values = parseEnv(readFileSync(file, "utf8"));
42
+ const env = { ...io.env };
43
+ for (const key of WORKSPACE_ENV_KEYS) {
44
+ if (typeof values[key] === "string") {
45
+ env[key] = values[key];
46
+ }
47
+ }
48
+ return { ...io, env };
49
+ }
31
50
  function credentials(env, stderr) {
32
51
  const url = env.DIAGONAL_URL?.trim().replace(/\/+$/, "") ?? "";
33
52
  const apiKey = env.DIAGONAL_API_KEY?.trim() ?? "";
@@ -615,6 +634,7 @@ export {
615
634
  WORKFLOWS_USAGE,
616
635
  RUN_USAGE,
617
636
  LOGS_USAGE,
637
+ withWorkspaceEnv,
618
638
  credentials,
619
639
  errorText,
620
640
  request,
@@ -4,7 +4,7 @@ import {
4
4
  SystemPermissions,
5
5
  isTimezone,
6
6
  isUrl
7
- } from "./cli-chunk-QDNFACNZ.mjs";
7
+ } from "./cli-chunk-EHIY7LHO.mjs";
8
8
  import {
9
9
  UID_PATTERN
10
10
  } from "./cli-chunk-KRD6O5UC.mjs";
@@ -2,7 +2,7 @@ import { createRequire as __diagonalCreateRequire } from 'node:module';
2
2
  const require = __diagonalCreateRequire(import.meta.url);
3
3
  import {
4
4
  stringFacts
5
- } from "./cli-chunk-QDNFACNZ.mjs";
5
+ } from "./cli-chunk-EHIY7LHO.mjs";
6
6
  import {
7
7
  readUid
8
8
  } from "./cli-chunk-KRD6O5UC.mjs";
@@ -3,7 +3,7 @@ const require = __diagonalCreateRequire(import.meta.url);
3
3
  import {
4
4
  WORKFLOW_STAGE,
5
5
  stripTypes
6
- } from "./cli-chunk-PTWPTBJL.mjs";
6
+ } from "./cli-chunk-ZCZKOXUH.mjs";
7
7
  import {
8
8
  scriptSdkRuntimeFiles
9
9
  } from "./cli-chunk-6HPUF67L.mjs";
@@ -15,7 +15,7 @@ import {
15
15
  appModuleClosure,
16
16
  isAppSpecifier,
17
17
  resolveAppSpecifier
18
- } from "./cli-chunk-QDNFACNZ.mjs";
18
+ } from "./cli-chunk-EHIY7LHO.mjs";
19
19
  import "./cli-chunk-KRD6O5UC.mjs";
20
20
  import {
21
21
  GENERATED_ASSETS_PATH
package/dist/cli.mjs CHANGED
@@ -46,7 +46,7 @@ import {
46
46
  routeBindingsSource,
47
47
  routeParamNames,
48
48
  workspace_settings_catalog_default
49
- } from "./cli-chunk-F7F5XTO6.mjs";
49
+ } from "./cli-chunk-JOTUZWUE.mjs";
50
50
  import {
51
51
  TRIGGER_TYPES,
52
52
  compareVersions,
@@ -58,7 +58,7 @@ import {
58
58
  workflowConfigObject,
59
59
  workflowMetadata,
60
60
  workspaceBuildNeeds
61
- } from "./cli-chunk-PTWPTBJL.mjs";
61
+ } from "./cli-chunk-ZCZKOXUH.mjs";
62
62
  import {
63
63
  GENERATED_NOTIFICATION_TYPES_MODULE,
64
64
  GENERATED_WORKFLOWS_MODULE,
@@ -79,7 +79,7 @@ import {
79
79
  templateSlugOf,
80
80
  workflowEntries,
81
81
  workflowNames
82
- } from "./cli-chunk-QDNFACNZ.mjs";
82
+ } from "./cli-chunk-EHIY7LHO.mjs";
83
83
  import {
84
84
  isUid,
85
85
  readDefinitionUid,
@@ -102,9 +102,10 @@ import {
102
102
  runWorkflow,
103
103
  showLogs,
104
104
  takesAssetReference,
105
+ withWorkspaceEnv,
105
106
  writeAssetCatalog,
106
107
  writeAssetEntry
107
- } from "./cli-chunk-IX4ZJ6J5.mjs";
108
+ } from "./cli-chunk-FR2ZNG34.mjs";
108
109
  import {
109
110
  ASSETS_EXPORT,
110
111
  GENERATED_ASSETS_MODULE,
@@ -11823,7 +11824,7 @@ async function checkSources() {
11823
11824
  if (existsSync4(DATA_FILE) && existsSync4(SDK_FILE)) {
11824
11825
  return { dataFile: DATA_FILE, sdkFile: SDK_FILE };
11825
11826
  }
11826
- const { checkData, scriptSdk } = await import("./cli-check-data-HCQKV3XS.mjs");
11827
+ const { checkData, scriptSdk } = await import("./cli-check-data-KCX5L24D.mjs");
11827
11828
  return { data: checkData(), sdk: scriptSdk() };
11828
11829
  }
11829
11830
  function isScriptTestPath(path) {
@@ -11843,7 +11844,7 @@ function holdsSkills(root, plan) {
11843
11844
  async function checkCheckout(root, options) {
11844
11845
  const sources = await checkSources();
11845
11846
  const plan = composePackages(root);
11846
- const testRunner = async () => (await import("./cli-workflows-DF7OE2WJ.mjs")).runBuildTests;
11847
+ const testRunner = async () => (await import("./cli-workflows-KJH52NZ5.mjs")).runBuildTests;
11847
11848
  const skillReader = async () => (await import("./cli-skill-file-PHFXSLAU.mjs")).skillFrontMatter;
11848
11849
  const finish = (checkoutRoot, buildPlan, answer, runTests2) => {
11849
11850
  const run = hasScriptTests(answer) ? runTests2(checkoutRoot, answer.tests) : null;
@@ -11929,20 +11930,20 @@ async function main(argv, io) {
11929
11930
  case "assets": {
11930
11931
  const [subcommand, ...assetArgs] = args;
11931
11932
  if (subcommand === "upload")
11932
- return (await import("./cli-assets-cli-B4ERYIRF.mjs")).uploadAsset(assetArgs, io);
11933
+ return (await import("./cli-assets-cli-KPJWOWLD.mjs")).uploadAsset(assetArgs, withWorkspaceEnv(io));
11933
11934
  if (subcommand === "list")
11934
- return (await import("./cli-assets-cli-B4ERYIRF.mjs")).listAssets(assetArgs, io);
11935
+ return (await import("./cli-assets-cli-KPJWOWLD.mjs")).listAssets(assetArgs, withWorkspaceEnv(io));
11935
11936
  io.stderr.write(`${ASSETS_UPLOAD_USAGE}
11936
11937
  ${ASSETS_LIST_USAGE}
11937
11938
  `);
11938
11939
  return 2;
11939
11940
  }
11940
11941
  case "workflows":
11941
- return listWorkflows(args, io);
11942
+ return listWorkflows(args, withWorkspaceEnv(io));
11942
11943
  case "run":
11943
- return runWorkflow(args, io);
11944
+ return runWorkflow(args, withWorkspaceEnv(io));
11944
11945
  case "logs":
11945
- return showLogs(args, io);
11946
+ return showLogs(args, withWorkspaceEnv(io));
11946
11947
  default:
11947
11948
  io.stderr.write(`${USAGE}
11948
11949
  `);
@@ -36,6 +36,7 @@ export declare const SystemPermissions: {
36
36
  readonly ShowDiagonalSupportChat: { readonly uid: "01a1a9f9-1e88-730b-8e66-bd78ad4f8eb4"; readonly slug: "show_diagonal_support_chat"; readonly name: "Show Diagonal Support Chat" };
37
37
  readonly SystemAdministrator: { readonly uid: "01a1a9f9-1e88-730b-8e66-c3db071eb4d8"; readonly slug: "access_system_admin"; readonly name: "Access System Admin" };
38
38
  readonly UpdateWorkspaceFields: { readonly uid: "01a1a9f9-1e88-730b-8e66-c50e2a3d9577"; readonly slug: "update_workspace_fields"; readonly name: "Update Workspace Fields" };
39
+ readonly UseElementPicker: { readonly uid: "01a20151-b531-720c-8e48-649c8eebacb1"; readonly slug: "use_element_picker"; readonly name: "Use Element Picker" };
39
40
  readonly ViewAiCosts: { readonly uid: "01a1a9f9-1e88-730b-8e66-c89571de84d5"; readonly slug: "view_ai_costs"; readonly name: "View Ai Costs" };
40
41
  readonly ViewEntityGraph: { readonly uid: "01a1a9f9-1e88-730b-8e66-ce249862be34"; readonly slug: "view_entity_graph"; readonly name: "View Entity Graph" };
41
42
  readonly ViewWorkspaceAnalytics: { readonly uid: "01a1a9f9-1e88-730b-8e66-d3284ac2edcd"; readonly slug: "view_workspace_analytics"; readonly name: "View Workspace Analytics" };
@@ -35,6 +35,7 @@ export const SystemPermissions = {
35
35
  ShowDiagonalSupportChat: { uid: "01a1a9f9-1e88-730b-8e66-bd78ad4f8eb4", slug: "show_diagonal_support_chat", name: "Show Diagonal Support Chat" },
36
36
  SystemAdministrator: { uid: "01a1a9f9-1e88-730b-8e66-c3db071eb4d8", slug: "access_system_admin", name: "Access System Admin" },
37
37
  UpdateWorkspaceFields: { uid: "01a1a9f9-1e88-730b-8e66-c50e2a3d9577", slug: "update_workspace_fields", name: "Update Workspace Fields" },
38
+ UseElementPicker: { uid: "01a20151-b531-720c-8e48-649c8eebacb1", slug: "use_element_picker", name: "Use Element Picker" },
38
39
  ViewAiCosts: { uid: "01a1a9f9-1e88-730b-8e66-c89571de84d5", slug: "view_ai_costs", name: "View Ai Costs" },
39
40
  ViewEntityGraph: { uid: "01a1a9f9-1e88-730b-8e66-ce249862be34", slug: "view_entity_graph", name: "View Entity Graph" },
40
41
  ViewWorkspaceAnalytics: { uid: "01a1a9f9-1e88-730b-8e66-d3284ac2edcd", slug: "view_workspace_analytics", name: "View Workspace Analytics" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagonal-hq/cli",
3
- "version": "0.42.21",
3
+ "version": "0.42.23",
4
4
  "description": "The diagonal CLI and the configuration helpers for file-based Diagonal workspaces.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {