windmill-cli 1.752.0 → 1.753.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.
Files changed (2) hide show
  1. package/esm/main.js +43 -21
  2. package/package.json +1 -1
package/esm/main.js CHANGED
@@ -16784,7 +16784,7 @@ var init_OpenAPI = __esm(() => {
16784
16784
  PASSWORD: undefined,
16785
16785
  TOKEN: getEnv3("WM_TOKEN"),
16786
16786
  USERNAME: undefined,
16787
- VERSION: "1.752.0",
16787
+ VERSION: "1.753.0",
16788
16788
  WITH_CREDENTIALS: true,
16789
16789
  interceptors: {
16790
16790
  request: new Interceptors,
@@ -26555,7 +26555,7 @@ var init_auth = __esm(async () => {
26555
26555
  });
26556
26556
 
26557
26557
  // src/core/constants.ts
26558
- var WM_FORK_PREFIX = "wm-fork", VERSION = "1.752.0";
26558
+ var WM_FORK_PREFIX = "wm-fork", VERSION = "1.753.0";
26559
26559
 
26560
26560
  // src/utils/git.ts
26561
26561
  var exports_git = {};
@@ -27493,37 +27493,47 @@ async function createWorkspaceFork2(opts, workspaceName, workspaceId = undefined
27493
27493
  info(colors.red.bold("! Workspace needs to be specified as positional argument, not as option."));
27494
27494
  return;
27495
27495
  }
27496
+ const token = workspace.token;
27497
+ if (!token) {
27498
+ throw new Error("Not logged in. Please run 'wmill workspace add' first.");
27499
+ }
27500
+ const remote = workspace.remote;
27501
+ setClient(token, remote.endsWith("/") ? remote.substring(0, remote.length - 1) : remote);
27502
+ let parentName = workspace.name;
27503
+ try {
27504
+ const fetched = await getWorkspaceName({ workspace: workspace.workspaceId });
27505
+ if (fetched)
27506
+ parentName = fetched;
27507
+ } catch {}
27508
+ const forkSuffix = "'s fork";
27509
+ const nameBase = parentName || workspace.workspaceId;
27510
+ const defaultForkName = nameBase.length + forkSuffix.length <= 50 ? `${nameBase}${forkSuffix}` : `${nameBase.slice(0, 50 - forkSuffix.length).trimEnd()}${forkSuffix}`;
27496
27511
  const branchDefaultId = renameCurrent ? branchToForkId(currentBranch) : undefined;
27497
27512
  const interactive = process10.stdin.isTTY && opts.yes !== true;
27498
27513
  if (workspaceName === undefined) {
27499
- if (branchDefaultId && !interactive) {
27500
- workspaceName = branchDefaultId;
27501
- info(`Naming the fork after the current branch: \`${workspaceName}\``);
27502
- } else {
27514
+ if (interactive) {
27503
27515
  workspaceName = await Input.prompt({
27504
- message: "Name this forked workspace:",
27505
- default: branchDefaultId
27516
+ message: "Friendly name for the forked workspace (shown in the UI, may contain spaces):",
27517
+ default: defaultForkName
27506
27518
  });
27519
+ } else {
27520
+ workspaceName = defaultForkName;
27521
+ info(`Naming the fork \`${workspaceName}\` (override with the workspace_name argument).`);
27507
27522
  }
27508
27523
  }
27509
27524
  if (!workspaceId) {
27510
- const idDefault = branchToForkId(workspaceName);
27511
- if (branchDefaultId && !interactive) {
27512
- workspaceId = idDefault;
27513
- } else {
27525
+ const idBasis = workspaceName === defaultForkName ? `${parentName}-fork` : workspaceName;
27526
+ const idDefault = branchDefaultId ?? branchToForkId(idBasis);
27527
+ if (interactive) {
27514
27528
  workspaceId = await Input.prompt({
27515
- message: `Enter the ID of this forked workspace, it will then be prefixed by ${WM_FORK_PREFIX}. It will also determine the branch name`,
27529
+ message: `Id for the forked workspace (a slug: no spaces or special characters). It will be prefixed with '${WM_FORK_PREFIX}-' and also determines the git branch name. The suggested default is normalized from the name (or the branch when converting one into the fork branch)`,
27516
27530
  default: idDefault,
27517
27531
  suggestions: [idDefault]
27518
27532
  });
27533
+ } else {
27534
+ workspaceId = idDefault;
27519
27535
  }
27520
27536
  }
27521
- const token = workspace.token;
27522
- if (!token) {
27523
- throw new Error("Not logged in. Please run 'wmill workspace add' first.");
27524
- }
27525
- const remote = workspace.remote;
27526
- setClient(token, remote.endsWith("/") ? remote.substring(0, remote.length - 1) : remote);
27527
27537
  info(colors.blue(`Creating forked workspace: ${workspaceName}...`));
27528
27538
  const trueWorkspaceId = `${WM_FORK_PREFIX}-${workspaceId}`;
27529
27539
  validateForkWorkspaceId(trueWorkspaceId);
@@ -29904,7 +29914,13 @@ var init_workspace = __esm(async () => {
29904
29914
  ]);
29905
29915
  command2 = new Command().alias("profile").description("workspace related commands").action(list3).command("switch").complete("workspace", async () => (await allWorkspaces()).map((x) => x.name)).description("Switch to another workspace").arguments("<workspace_name:string:workspace>").action(switchC).command("add").description("Add a workspace").arguments("[workspace_name:string] [workspace_id:string] [remote:string]").option("-c --create", "Create the workspace if it does not exist").option("--create-workspace-name <workspace_name:string>", "Specify the workspace name. Ignored if --create is not specified or the workspace already exists. Will default to the workspace id.").option("--create-username <username:string>", "Specify your own username in the newly created workspace. Ignored if --create is not specified, the workspace already exists or automatic username creation is enabled on the instance.", {
29906
29916
  default: "admin"
29907
- }).action(add).command("remove").description("Remove a workspace").arguments("<workspace_name:string>").action(remove).command("whoami").description("Show the currently active user").action(whoami2).command("list").description("List local workspace profiles").action(list3).command("list-remote").description("List workspaces on the remote server that you have access to").option("--as-superadmin", "List ALL workspaces on the instance (requires the token to belong to a superadmin/devops user)").action(listRemote).command("list-forks").description("List forked workspaces on the remote server").action(listForks).command("bind").description("Create or update a workspace entry in wmill.yaml from the active profile").option("--workspace <name:string>", "Workspace name (default: current branch or workspaceId)").option("--branch <branch:string>", "Git branch to associate (default: workspace name)").action((opts) => bind(opts, true)).command("unbind").description("Remove baseUrl and workspaceId from a workspace entry").option("--workspace <name:string>", "Workspace to unbind").action((opts) => bind(opts, false)).command("fork").description("Create a forked workspace").arguments("[workspace_name:string] [workspace_id:string]").option("--create-workspace-name <workspace_name:string>", "Specify the workspace name. Ignored if --create is not specified or the workspace already exists. Will default to the workspace id.").option("--color <color:string>", "Workspace color (hex code, e.g. #ff0000)").option("--datatable-behavior <behavior:string>", "How to handle datatables: skip, schema_only, or schema_and_data (default: interactive prompt)").option("--from-branch <branch:string>", "Non-interactive override for the 'turn my current working branch into the fork' workflow: base the fork on <branch> (its bound workspace is the parent) and rename the current branch onto wm-fork/<branch>/<id>. Usually unneeded — from a working branch `wmill workspace fork` offers this interactively; from a base branch it creates a fresh fork branch.").option("-y --yes", "Skip interactive prompts (defaults datatable behavior to 'skip'). On a non-base branch, requires --from-branch since the base branch can't be prompted for.").action(createWorkspaceFork2).command("delete-fork").description("Delete a forked workspace").arguments("<fork_name:string>").option("-y --yes", "Skip confirmation prompt").action(deleteWorkspaceFork).command("merge").description("Compare and deploy changes between a fork and its parent workspace").option("--direction <direction:string>", "Deploy direction: to-parent or to-fork").option("--all", "Deploy all changed items including conflicts").option("--skip-conflicts", "Skip items modified in both workspaces").option("--include <items:string>", "Comma-separated kind:path items to include (e.g. script:f/test/main,flow:f/my/flow)").option("--exclude <items:string>", "Comma-separated kind:path items to exclude").option("--preserve-on-behalf-of", "Preserve original on_behalf_of/permissioned_as values").option("-y --yes", "Non-interactive mode (deploy without prompts)").action(mergeWorkspaces).command("connect-slack").description("Non-interactively connect Slack to the active workspace using a pre-minted bot token (xoxb-...). Produces the same artifacts as the UI OAuth flow: workspace_settings fields, g/slack group, f/slack_bot folder, and the encrypted bot token variable + resource at f/slack_bot/bot_token.").option("--bot-token <bot_token:string>", "Slack bot token (xoxb-...)", { required: true }).option("--team-id <team_id:string>", "Slack team id", { required: true }).option("--team-name <team_name:string>", "Slack team name", { required: true }).action(connectSlack2).command("disconnect-slack").description("Clear slack_team_id / slack_name on the active workspace (marks the workspace as disconnected). Does NOT remove the bot token variable/resource/folder/group — delete those from the local sync folder and run 'wmill sync push' to tear them down. Does NOT remove the workspace-level OAuth override — set slack_oauth_client_id/_secret to '' in settings.yaml and push.").action(disconnectSlack2);
29917
+ }).action(add).command("remove").description("Remove a workspace").arguments("<workspace_name:string>").action(remove).command("whoami").description("Show the currently active user").action(whoami2).command("list").description("List local workspace profiles").action(list3).command("list-remote").description("List workspaces on the remote server that you have access to").option("--as-superadmin", "List ALL workspaces on the instance (requires the token to belong to a superadmin/devops user)").action(listRemote).command("list-forks").description("List forked workspaces on the remote server").action(listForks).command("bind").description("Create or update a workspace entry in wmill.yaml from the active profile").option("--workspace <name:string>", "Workspace name (default: current branch or workspaceId)").option("--branch <branch:string>", "Git branch to associate (default: workspace name)").action((opts) => bind(opts, true)).command("unbind").description("Remove baseUrl and workspaceId from a workspace entry").option("--workspace <name:string>", "Workspace to unbind").action((opts) => bind(opts, false)).command("fork").description(`Create a forked workspace from its parent workspace.
29918
+
29919
+ The parent is resolved from your current git branch, not from the active profile: run this from a git repo checked out on the branch mapped to the parent workspace in wmill.yaml's \`workspaces:\` section (a fork branch of it resolves to the same parent). \`wmill workspace switch\` does not change which workspace is forked.
29920
+
29921
+ Arguments (omit both to be prompted interactively):
29922
+ [workspace_name] Friendly display name for the fork, shown in the UI. May contain spaces, so quote it in the shell (e.g. "My Fork"). Max 50 chars. Defaults to "<parent workspace name>'s fork".
29923
+ [workspace_id] Id for the fork. Must be a slug (no spaces or special characters) and is automatically prefixed with \`wm-fork-\`, so pass just the bare slug (e.g. \`my-fork\` becomes \`wm-fork-my-fork\`). This id also determines the fork's git branch name. Defaults to a slug derived from the name — or, when you are converting an existing branch into the fork branch, from that branch.`).arguments("[workspace_name:string] [workspace_id:string]").option("--create-workspace-name <workspace_name:string>", "Specify the workspace name. Ignored if --create is not specified or the workspace already exists. Will default to the workspace id.").option("--color <color:string>", "Workspace color (hex code, e.g. #ff0000)").option("--datatable-behavior <behavior:string>", "How to handle datatables: skip, schema_only, or schema_and_data (default: interactive prompt)").option("--from-branch <branch:string>", "Non-interactive override for the 'turn my current working branch into the fork' workflow: base the fork on <branch> (its bound workspace is the parent) and rename the current branch onto wm-fork/<branch>/<id>. Usually unneeded — from a working branch `wmill workspace fork` offers this interactively; from a base branch it creates a fresh fork branch.").option("-y --yes", "Skip interactive prompts (defaults datatable behavior to 'skip'). On a non-base branch, requires --from-branch since the base branch can't be prompted for.").action(createWorkspaceFork2).command("delete-fork").description("Delete a forked workspace").arguments("<fork_name:string>").option("-y --yes", "Skip confirmation prompt").action(deleteWorkspaceFork).command("merge").description("Compare and deploy changes between a fork and its parent workspace").option("--direction <direction:string>", "Deploy direction: to-parent or to-fork").option("--all", "Deploy all changed items including conflicts").option("--skip-conflicts", "Skip items modified in both workspaces").option("--include <items:string>", "Comma-separated kind:path items to include (e.g. script:f/test/main,flow:f/my/flow)").option("--exclude <items:string>", "Comma-separated kind:path items to exclude").option("--preserve-on-behalf-of", "Preserve original on_behalf_of/permissioned_as values").option("-y --yes", "Non-interactive mode (deploy without prompts)").action(mergeWorkspaces).command("connect-slack").description("Non-interactively connect Slack to the active workspace using a pre-minted bot token (xoxb-...). Produces the same artifacts as the UI OAuth flow: workspace_settings fields, g/slack group, f/slack_bot folder, and the encrypted bot token variable + resource at f/slack_bot/bot_token.").option("--bot-token <bot_token:string>", "Slack bot token (xoxb-...)", { required: true }).option("--team-id <team_id:string>", "Slack team id", { required: true }).option("--team-name <team_name:string>", "Slack team name", { required: true }).action(connectSlack2).command("disconnect-slack").description("Clear slack_team_id / slack_name on the active workspace (marks the workspace as disconnected). Does NOT remove the bot token variable/resource/folder/group — delete those from the local sync folder and run 'wmill sync push' to tear them down. Does NOT remove the workspace-level OAuth override — set slack_oauth_client_id/_secret to '' in settings.yaml and push.").action(disconnectSlack2);
29908
29924
  workspace_default = command2;
29909
29925
  });
29910
29926
 
@@ -87685,7 +87701,13 @@ workspace related commands
87685
87701
  - \`--branch <branch:string>\` - Git branch to associate (default: workspace name)
87686
87702
  - \`workspace unbind\` - Remove baseUrl and workspaceId from a workspace entry
87687
87703
  - \`--workspace <name:string>\` - Workspace to unbind
87688
- - \`workspace fork [workspace_name:string] [workspace_id:string]\` - Create a forked workspace
87704
+ - \`workspace fork [workspace_name:string] [workspace_id:string]\` - Create a forked workspace from its parent workspace.
87705
+
87706
+ The parent is resolved from your current git branch, not from the active profile: run this from a git repo checked out on the branch mapped to the parent workspace in wmill.yaml's \`workspaces:\` section (a fork branch of it resolves to the same parent). \`wmill workspace switch\` does not change which workspace is forked.
87707
+
87708
+ Arguments (omit both to be prompted interactively):
87709
+ [workspace_name] Friendly display name for the fork, shown in the UI. May contain spaces, so quote it in the shell (e.g. "My Fork"). Max 50 chars. Defaults to "<parent workspace name>'s fork".
87710
+ [workspace_id] Id for the fork. Must be a slug (no spaces or special characters) and is automatically prefixed with \`wm-fork-\`, so pass just the bare slug (e.g. \`my-fork\` becomes \`wm-fork-my-fork\`). This id also determines the fork's git branch name. Defaults to a slug derived from the name — or, when you are converting an existing branch into the fork branch, from that branch.
87689
87711
  - \`--create-workspace-name <workspace_name:string>\` - Specify the workspace name. Ignored if --create is not specified or the workspace already exists. Will default to the workspace id.
87690
87712
  - \`--color <color:string>\` - Workspace color (hex code, e.g. #ff0000)
87691
87713
  - \`--datatable-behavior <behavior:string>\` - How to handle datatables: skip, schema_only, or schema_and_data (default: interactive prompt)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.752.0",
3
+ "version": "1.753.0",
4
4
  "description": "CLI for Windmill",
5
5
  "license": "Apache 2.0",
6
6
  "type": "module",