kcode-cli 1.3.18 → 1.3.19

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.
package/dist/cli.js CHANGED
@@ -121560,11 +121560,30 @@ function createWindowsDirectoryPickerCommand(title) {
121560
121560
  const description = JSON.stringify(title?.trim() || "Select a project");
121561
121561
  const script = [
121562
121562
  "Add-Type -AssemblyName System.Windows.Forms",
121563
- "$dialog = New-Object System.Windows.Forms.FolderBrowserDialog",
121564
- `$dialog.Description = ${description}`,
121565
- "$dialog.ShowNewFolderButton = $false",
121566
- "if ($dialog.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) {",
121567
- " [Console]::Out.Write($dialog.SelectedPath)",
121563
+ "$owner = New-Object System.Windows.Forms.Form",
121564
+ "$owner.StartPosition = [System.Windows.Forms.FormStartPosition]::Manual",
121565
+ "$owner.Left = -32000",
121566
+ "$owner.Top = -32000",
121567
+ "$owner.Width = 1",
121568
+ "$owner.Height = 1",
121569
+ "$owner.ShowInTaskbar = $false",
121570
+ "$owner.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedToolWindow",
121571
+ "$owner.Opacity = 0",
121572
+ "$owner.TopMost = $true",
121573
+ "$null = $owner.Show()",
121574
+ "$owner.Activate()",
121575
+ "$dialog = $null",
121576
+ "try {",
121577
+ " $dialog = New-Object System.Windows.Forms.FolderBrowserDialog",
121578
+ ` $dialog.Description = ${description}`,
121579
+ " $dialog.ShowNewFolderButton = $false",
121580
+ " if ($dialog.ShowDialog($owner) -eq [System.Windows.Forms.DialogResult]::OK) {",
121581
+ " [Console]::Out.Write($dialog.SelectedPath)",
121582
+ " }",
121583
+ "} finally {",
121584
+ " if ($dialog) { $dialog.Dispose() }",
121585
+ " $owner.Close()",
121586
+ " $owner.Dispose()",
121568
121587
  "}"
121569
121588
  ].join("\n");
121570
121589
  return {
@@ -121657,6 +121676,21 @@ async function runLinuxDirectoryPicker(options2, deps) {
121657
121676
  }
121658
121677
  throw new DirectoryPickerUnsupportedError("Directory picker is unavailable on this Linux environment");
121659
121678
  }
121679
+ async function runWindowsDirectoryPicker(command3, deps) {
121680
+ if (activeWindowsPicker) {
121681
+ return null;
121682
+ }
121683
+ const task = deps.run(command3).then((result) => normalizePickedPath(result.stdout, deps.platform)).catch((error2) => {
121684
+ throw unexpectedFailure(command3, error2);
121685
+ });
121686
+ const guarded = task.finally(() => {
121687
+ if (activeWindowsPicker === guarded) {
121688
+ activeWindowsPicker = void 0;
121689
+ }
121690
+ });
121691
+ activeWindowsPicker = guarded;
121692
+ return await guarded;
121693
+ }
121660
121694
  async function pickDirectory(options2 = {}, deps = {}) {
121661
121695
  const platform3 = deps.platform ?? process7.platform;
121662
121696
  const env = deps.env ?? process7.env;
@@ -121664,12 +121698,7 @@ async function pickDirectory(options2 = {}, deps = {}) {
121664
121698
  const resolved = { platform: platform3, env, run: run2 };
121665
121699
  if (platform3 === "win32") {
121666
121700
  const command3 = createWindowsDirectoryPickerCommand(options2.title);
121667
- try {
121668
- const result = await resolved.run(command3);
121669
- return normalizePickedPath(result.stdout, platform3);
121670
- } catch (error2) {
121671
- throw unexpectedFailure(command3, error2);
121672
- }
121701
+ return await runWindowsDirectoryPicker(command3, resolved);
121673
121702
  }
121674
121703
  if (platform3 === "darwin") {
121675
121704
  const command3 = createMacDirectoryPickerCommand(options2.title);
@@ -121690,7 +121719,7 @@ async function pickDirectory(options2 = {}, deps = {}) {
121690
121719
  }
121691
121720
  throw new DirectoryPickerUnsupportedError(`Directory picker is unavailable on platform ${platform3}`);
121692
121721
  }
121693
- var DirectoryPickerUnsupportedError, DirectoryPickerExecutionError;
121722
+ var activeWindowsPicker, DirectoryPickerUnsupportedError, DirectoryPickerExecutionError;
121694
121723
  var init_picker = __esm({
121695
121724
  "../../apps/server/src/services/picker.ts"() {
121696
121725
  "use strict";