windmill-cli 1.586.2 → 1.586.4

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,8 +1,9 @@
1
1
  import * as dntShim from "../../../_dnt.shims.js";
2
- import { colors, Command, log, yamlStringify, Confirm, } from "../../../deps.js";
2
+ import { colors, Command, log, yamlStringify, Confirm } from "../../../deps.js";
3
3
  import { readLockfile } from "../../utils/metadata.js";
4
4
  import { SCRIPT_GUIDANCE } from "../../guidance/script_guidance.js";
5
5
  import { FLOW_GUIDANCE } from "../../guidance/flow_guidance.js";
6
+ import { getActiveWorkspaceOrFallback } from "../workspace/workspace.js";
6
7
  /**
7
8
  * Bootstrap a windmill project with a wmill.yaml file
8
9
  */
@@ -37,8 +38,7 @@ async function initAction(opts) {
37
38
  await readLockfile();
38
39
  // Offer to bind workspace profile to current branch
39
40
  if (isGitRepository()) {
40
- const { getActiveWorkspace } = await import("../workspace/workspace.js");
41
- const activeWorkspace = await getActiveWorkspace(opts);
41
+ const activeWorkspace = await getActiveWorkspaceOrFallback(opts);
42
42
  const currentBranch = getCurrentGitBranch();
43
43
  if (activeWorkspace && currentBranch) {
44
44
  // Determine binding behavior based on flags
@@ -264,6 +264,18 @@ async function whoami(_opts) {
264
264
  const activeName = await getActiveWorkspaceName(_opts);
265
265
  log.info("Active: " + colors.green.bold(activeName || "none"));
266
266
  }
267
+ export async function getActiveWorkspaceOrFallback(opts) {
268
+ let activeWorkspace = await getActiveWorkspace(opts);
269
+ if (!activeWorkspace && opts.baseUrl && opts.workspace) {
270
+ activeWorkspace = {
271
+ name: opts.workspace,
272
+ remote: opts.baseUrl,
273
+ workspaceId: opts.workspace,
274
+ token: "",
275
+ };
276
+ }
277
+ return activeWorkspace;
278
+ }
267
279
  async function bind(opts, bindWorkspace) {
268
280
  const { isGitRepository, getCurrentGitBranch } = await import("../../utils/git.js");
269
281
  if (!isGitRepository()) {
@@ -277,7 +289,7 @@ async function bind(opts, bindWorkspace) {
277
289
  }
278
290
  const { readConfigFile } = await import("../../core/conf.js");
279
291
  const config = await readConfigFile();
280
- const activeWorkspace = await getActiveWorkspace(opts);
292
+ const activeWorkspace = await getActiveWorkspaceOrFallback(opts);
281
293
  if (!activeWorkspace && bindWorkspace) {
282
294
  log.error(colors.red("No active workspace. Use 'wmill workspace add' or 'wmill workspace switch' first"));
283
295
  return;
@@ -6,7 +6,7 @@ import { getHeaders } from "../utils/utils.js";
6
6
  import { getActiveWorkspace, getWorkspaceByName, allWorkspaces, addWorkspace, } from "../commands/workspace/workspace.js";
7
7
  import { getLastUsedProfile, setLastUsedProfile } from "./branch-profiles.js";
8
8
  import { readConfigFile } from "./conf.js";
9
- import { getCurrentGitBranch, getOriginalBranchForWorkspaceForks, getWorkspaceIdForWorkspaceForkFromBranchName, isGitRepository } from "../utils/git.js";
9
+ import { getCurrentGitBranch, getOriginalBranchForWorkspaceForks, getWorkspaceIdForWorkspaceForkFromBranchName, isGitRepository, } from "../utils/git.js";
10
10
  import { WM_FORK_PREFIX } from "../main.js";
11
11
  // Helper function to select from multiple matching profiles
12
12
  async function selectFromMultipleProfiles(profiles, baseUrl, workspaceId, context, configDir) {
@@ -16,7 +16,7 @@ async function selectFromMultipleProfiles(profiles, baseUrl, workspaceId, contex
16
16
  // Check for last used profile
17
17
  const lastUsedProfileName = await getLastUsedProfile("", baseUrl, workspaceId, configDir);
18
18
  if (lastUsedProfileName) {
19
- const lastUsedProfile = profiles.find(p => p.name === lastUsedProfileName);
19
+ const lastUsedProfile = profiles.find((p) => p.name === lastUsedProfileName);
20
20
  if (lastUsedProfile) {
21
21
  log.info(colors.green(`Using last used profile '${lastUsedProfile.name}' for ${context}`));
22
22
  return lastUsedProfile;
@@ -34,12 +34,12 @@ async function selectFromMultipleProfiles(profiles, baseUrl, workspaceId, contex
34
34
  log.info(colors.yellow(`\nMultiple workspace profiles found for ${context}:`));
35
35
  const selectedName = await Select.prompt({
36
36
  message: "Select profile",
37
- options: profiles.map(p => ({
37
+ options: profiles.map((p) => ({
38
38
  name: `${p.name} (${p.workspaceId} on ${p.remote})`,
39
39
  value: p.name,
40
40
  })),
41
41
  });
42
- const selectedProfile = profiles.find(p => p.name === selectedName);
42
+ const selectedProfile = profiles.find((p) => p.name === selectedName);
43
43
  // Save selection for next time
44
44
  await setLastUsedProfile("", // No branch context for general workspace selection
45
45
  baseUrl, workspaceId, selectedProfile.name, configDir);
@@ -141,7 +141,7 @@ export async function tryResolveBranchWorkspace(opts) {
141
141
  return undefined;
142
142
  }
143
143
  log.info(`Using branch configuration for branch \`${currentBranch}\` set in gitBranches`);
144
- let { baseUrl, workspaceId } = branchConfig;
144
+ const { baseUrl, workspaceId } = branchConfig;
145
145
  let normalizedBaseUrl;
146
146
  try {
147
147
  normalizedBaseUrl = new URL(baseUrl).toString();
@@ -152,7 +152,7 @@ export async function tryResolveBranchWorkspace(opts) {
152
152
  }
153
153
  // Find all profiles matching this baseUrl and workspaceId
154
154
  const allProfiles = await allWorkspaces(opts.configDir);
155
- const matchingProfiles = allProfiles.filter(w => w.remote === normalizedBaseUrl && w.workspaceId === workspaceId);
155
+ const matchingProfiles = allProfiles.filter((w) => w.remote === normalizedBaseUrl && w.workspaceId === workspaceId);
156
156
  if (matchingProfiles.length === 0) {
157
157
  // No matching profile exists - prompt to create one
158
158
  return await createWorkspaceProfileInteractively(normalizedBaseUrl, workspaceId, currentBranch, opts, { rawBranch, isForked: !!originalBranchIfForked });
@@ -167,7 +167,7 @@ export async function tryResolveBranchWorkspace(opts) {
167
167
  // For multiple profiles, check branch-specific last used first
168
168
  const lastUsedName = await getLastUsedProfile(currentBranch, normalizedBaseUrl, workspaceId, opts.configDir);
169
169
  if (lastUsedName) {
170
- const lastUsedProfile = matchingProfiles.find(p => p.name === lastUsedName);
170
+ const lastUsedProfile = matchingProfiles.find((p) => p.name === lastUsedName);
171
171
  if (lastUsedProfile) {
172
172
  log.info(colors.green(`Using workspace profile '${lastUsedProfile.name}' for branch '${currentBranch}' (last used)`));
173
173
  return lastUsedProfile;
@@ -208,7 +208,7 @@ export async function resolveWorkspace(opts) {
208
208
  if (!existingWorkspace) {
209
209
  const { allWorkspaces } = await import("../commands/workspace/workspace.js");
210
210
  const workspaces = await allWorkspaces(opts.configDir);
211
- const matchingWorkspaces = workspaces.filter(w => w.workspaceId === opts.workspace && w.remote === normalizedBaseUrl);
211
+ const matchingWorkspaces = workspaces.filter((w) => w.workspaceId === opts.workspace && w.remote === normalizedBaseUrl);
212
212
  if (matchingWorkspaces.length >= 1) {
213
213
  existingWorkspace = await selectFromMultipleProfiles(matchingWorkspaces, normalizedBaseUrl, opts.workspace, `workspace "${opts.workspace}" on ${normalizedBaseUrl}`, opts.configDir);
214
214
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.586.2",
3
+ "version": "1.586.4",
4
4
  "description": "CLI for Windmill",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/src/commands/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,OAAO,EAIR,MAAM,kBAAkB,CAAC;AAM1B,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAuRD,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;mBAae,CAAC;AAE7B,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/src/commands/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,OAAO,EAA+B,MAAM,kBAAkB,CAAC;AAOhF,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA0QD,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;mBAae,CAAC;AAE7B,eAAe,OAAO,CAAC"}
@@ -18,6 +18,7 @@ export declare function add(opts: GlobalOptions & {
18
18
  }, workspaceName: string | undefined, workspaceId: string | undefined, remote: string | undefined): Promise<void>;
19
19
  export declare function addWorkspace(workspace: Workspace, opts: any): Promise<void>;
20
20
  export declare function removeWorkspace(name: string, silent: boolean, opts: any): Promise<void>;
21
+ export declare function getActiveWorkspaceOrFallback(opts: GlobalOptions): Promise<Workspace | undefined>;
21
22
  declare const command: Command<void, void, {
22
23
  yes?: true | undefined;
23
24
  }, [import("../../../deps/jsr.io/@windmill-labs/cliffy-command/1.0.0-rc.5/mod.js").StringType], void, void, void, Command<void, void, void, [], void, {
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../../src/src/commands/workspace/workspace.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAM/C,OAAO,EAEL,OAAO,EAMR,MAAM,kBAAkB,CAAC;AAM1B,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,aAAa,CACjC,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,SAAS,EAAE,CAAC,CAiBtB;AAgBD,wBAAsB,kBAAkB,CACtC,IAAI,GAAE,aAAa,GAAG,SAAqB,GAC1C,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAMhC;AAED,wBAAsB,kBAAkB,CACtC,aAAa,EAAE,MAAM,EACrB,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAQhC;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,aAAa,iBAqB7C;AAoCD,wBAAsB,kBAAkB,CACtC,aAAa,EAAE,MAAM,EACrB,iBAAiB,CAAC,EAAE,MAAM,iBAI3B;AAED,wBAAsB,GAAG,CACvB,IAAI,EAAE,aAAa,GAAG;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,EACD,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,MAAM,EAAE,MAAM,GAAG,SAAS,iBAuH3B;AAED,wBAAsB,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,iBAwEjE;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,GAAG,iBA6BV;AA2FD,QAAA,MAAM,OAAO;;;;;;;;oBAoDwB,CAAC;AAEtC,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../../src/src/commands/workspace/workspace.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM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,OAAO;;;;;;;;oBAoDwB,CAAC;AAEtC,eAAe,OAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/src/core/context.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EAGL,SAAS,EAGV,MAAM,oCAAoC,CAAC;AA4I5C,MAAM,MAAM,OAAO,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA6BF,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAkHhC;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,SAAS,CAAC,CA6GpB;AAGD,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBnE;AACD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAgB7B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAWlD"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/src/core/context.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EAGL,SAAS,EAGV,MAAM,oCAAoC,CAAC;AA+K5C,MAAM,MAAM,OAAO,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA6BF,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,aAAa,GAClB,OA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