symbio 0.2.0 → 0.2.1
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/CHANGELOG.md +5 -0
- package/LICENSE +21 -21
- package/dist/server/folder-picker.js +70 -70
- package/dist/web/index.html +12 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,11 @@ versions follow [Semantic Versioning](https://semver.org/).
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.2.1]
|
|
9
|
+
|
|
10
|
+
- Releases are published from GitHub Actions with npm trusted publishing (no tokens), with
|
|
11
|
+
provenance.
|
|
12
|
+
|
|
8
13
|
## [0.2.0]
|
|
9
14
|
|
|
10
15
|
- Installable with `npm install -g symbio`; brings its own OpenCode (pinned to 2.1.x).
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 LinKzy
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LinKzy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -6,76 +6,76 @@ import { execFile } from "node:child_process";
|
|
|
6
6
|
import { promises as fs } from "node:fs";
|
|
7
7
|
import os from "node:os";
|
|
8
8
|
import path from "node:path";
|
|
9
|
-
const WINDOWS_SCRIPT = String.raw `
|
|
10
|
-
param([string]$Initial = "", [string]$Title = "Choose the project folder")
|
|
11
|
-
$ErrorActionPreference = "Stop"
|
|
12
|
-
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
13
|
-
Add-Type -AssemblyName System.Windows.Forms
|
|
14
|
-
Add-Type -ReferencedAssemblies System.Windows.Forms -TypeDefinition @"
|
|
15
|
-
using System;
|
|
16
|
-
using System.Runtime.InteropServices;
|
|
17
|
-
using System.Windows.Forms;
|
|
18
|
-
|
|
19
|
-
public static class SymbioFolderPicker {
|
|
20
|
-
[ComImport, Guid("DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7")] private class FileOpenDialogCom {}
|
|
21
|
-
|
|
22
|
-
[ComImport, Guid("42f85136-db7e-439c-85f1-e4075d135fc8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
23
|
-
private interface IFileOpenDialog {
|
|
24
|
-
[PreserveSig] int Show(IntPtr hwndOwner);
|
|
25
|
-
void SetFileTypes(); void SetFileTypeIndex(); void GetFileTypeIndex(); void Advise(); void Unadvise();
|
|
26
|
-
void SetOptions(uint fos);
|
|
27
|
-
void GetOptions(out uint fos);
|
|
28
|
-
void SetDefaultFolder(IShellItem psi);
|
|
29
|
-
void SetFolder(IShellItem psi);
|
|
30
|
-
void GetFolder(); void GetCurrentSelection(); void SetFileName(); void GetFileName();
|
|
31
|
-
void SetTitle([MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
|
|
32
|
-
void SetOkButtonLabel([MarshalAs(UnmanagedType.LPWStr)] string pszText);
|
|
33
|
-
void SetFileNameLabel();
|
|
34
|
-
void GetResult(out IShellItem ppsi);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
[ComImport, Guid("43826d1e-e718-42ee-bc55-a1e261c37bfe"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
38
|
-
private interface IShellItem {
|
|
39
|
-
void BindToHandler(); void GetParent();
|
|
40
|
-
void GetDisplayName(uint sigdnName, [MarshalAs(UnmanagedType.LPWStr)] out string ppszName);
|
|
41
|
-
void GetAttributes(); void Compare();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
[DllImport("shell32.dll", CharSet = CharSet.Unicode, PreserveSig = false)]
|
|
45
|
-
private static extern void SHCreateItemFromParsingName(string pszPath, IntPtr pbc, [MarshalAs(UnmanagedType.LPStruct)] Guid riid, out IShellItem ppv);
|
|
46
|
-
|
|
47
|
-
public static string Pick(string initial, string title) {
|
|
48
|
-
// An invisible topmost window owns the dialog so it opens in front of the browser.
|
|
49
|
-
var owner = new Form { ShowInTaskbar = false, TopMost = true, FormBorderStyle = FormBorderStyle.None, Opacity = 0, Width = 1, Height = 1, StartPosition = FormStartPosition.CenterScreen };
|
|
50
|
-
owner.Show();
|
|
51
|
-
owner.Activate();
|
|
52
|
-
try {
|
|
53
|
-
var dialog = (IFileOpenDialog)new FileOpenDialogCom();
|
|
54
|
-
dialog.SetOptions(0x20 | 0x40 | 0x800); // PICKFOLDERS | FORCEFILESYSTEM | PATHMUSTEXIST
|
|
55
|
-
dialog.SetTitle(title);
|
|
56
|
-
dialog.SetOkButtonLabel("Select folder");
|
|
57
|
-
if (!String.IsNullOrEmpty(initial)) {
|
|
58
|
-
try {
|
|
59
|
-
IShellItem folder;
|
|
60
|
-
SHCreateItemFromParsingName(initial, IntPtr.Zero, typeof(IShellItem).GUID, out folder);
|
|
61
|
-
dialog.SetFolder(folder);
|
|
62
|
-
} catch { }
|
|
63
|
-
}
|
|
64
|
-
int hr = dialog.Show(owner.Handle);
|
|
65
|
-
if (hr != 0) return null; // cancelled
|
|
66
|
-
IShellItem result;
|
|
67
|
-
dialog.GetResult(out result);
|
|
68
|
-
string p;
|
|
69
|
-
result.GetDisplayName(0x80058000, out p); // SIGDN_FILESYSPATH
|
|
70
|
-
return p;
|
|
71
|
-
} finally {
|
|
72
|
-
owner.Close();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
"@
|
|
77
|
-
$picked = [SymbioFolderPicker]::Pick($Initial, $Title)
|
|
78
|
-
if ($picked) { [Console]::Out.Write($picked) }
|
|
9
|
+
const WINDOWS_SCRIPT = String.raw `
|
|
10
|
+
param([string]$Initial = "", [string]$Title = "Choose the project folder")
|
|
11
|
+
$ErrorActionPreference = "Stop"
|
|
12
|
+
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
13
|
+
Add-Type -AssemblyName System.Windows.Forms
|
|
14
|
+
Add-Type -ReferencedAssemblies System.Windows.Forms -TypeDefinition @"
|
|
15
|
+
using System;
|
|
16
|
+
using System.Runtime.InteropServices;
|
|
17
|
+
using System.Windows.Forms;
|
|
18
|
+
|
|
19
|
+
public static class SymbioFolderPicker {
|
|
20
|
+
[ComImport, Guid("DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7")] private class FileOpenDialogCom {}
|
|
21
|
+
|
|
22
|
+
[ComImport, Guid("42f85136-db7e-439c-85f1-e4075d135fc8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
23
|
+
private interface IFileOpenDialog {
|
|
24
|
+
[PreserveSig] int Show(IntPtr hwndOwner);
|
|
25
|
+
void SetFileTypes(); void SetFileTypeIndex(); void GetFileTypeIndex(); void Advise(); void Unadvise();
|
|
26
|
+
void SetOptions(uint fos);
|
|
27
|
+
void GetOptions(out uint fos);
|
|
28
|
+
void SetDefaultFolder(IShellItem psi);
|
|
29
|
+
void SetFolder(IShellItem psi);
|
|
30
|
+
void GetFolder(); void GetCurrentSelection(); void SetFileName(); void GetFileName();
|
|
31
|
+
void SetTitle([MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
|
|
32
|
+
void SetOkButtonLabel([MarshalAs(UnmanagedType.LPWStr)] string pszText);
|
|
33
|
+
void SetFileNameLabel();
|
|
34
|
+
void GetResult(out IShellItem ppsi);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[ComImport, Guid("43826d1e-e718-42ee-bc55-a1e261c37bfe"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
38
|
+
private interface IShellItem {
|
|
39
|
+
void BindToHandler(); void GetParent();
|
|
40
|
+
void GetDisplayName(uint sigdnName, [MarshalAs(UnmanagedType.LPWStr)] out string ppszName);
|
|
41
|
+
void GetAttributes(); void Compare();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[DllImport("shell32.dll", CharSet = CharSet.Unicode, PreserveSig = false)]
|
|
45
|
+
private static extern void SHCreateItemFromParsingName(string pszPath, IntPtr pbc, [MarshalAs(UnmanagedType.LPStruct)] Guid riid, out IShellItem ppv);
|
|
46
|
+
|
|
47
|
+
public static string Pick(string initial, string title) {
|
|
48
|
+
// An invisible topmost window owns the dialog so it opens in front of the browser.
|
|
49
|
+
var owner = new Form { ShowInTaskbar = false, TopMost = true, FormBorderStyle = FormBorderStyle.None, Opacity = 0, Width = 1, Height = 1, StartPosition = FormStartPosition.CenterScreen };
|
|
50
|
+
owner.Show();
|
|
51
|
+
owner.Activate();
|
|
52
|
+
try {
|
|
53
|
+
var dialog = (IFileOpenDialog)new FileOpenDialogCom();
|
|
54
|
+
dialog.SetOptions(0x20 | 0x40 | 0x800); // PICKFOLDERS | FORCEFILESYSTEM | PATHMUSTEXIST
|
|
55
|
+
dialog.SetTitle(title);
|
|
56
|
+
dialog.SetOkButtonLabel("Select folder");
|
|
57
|
+
if (!String.IsNullOrEmpty(initial)) {
|
|
58
|
+
try {
|
|
59
|
+
IShellItem folder;
|
|
60
|
+
SHCreateItemFromParsingName(initial, IntPtr.Zero, typeof(IShellItem).GUID, out folder);
|
|
61
|
+
dialog.SetFolder(folder);
|
|
62
|
+
} catch { }
|
|
63
|
+
}
|
|
64
|
+
int hr = dialog.Show(owner.Handle);
|
|
65
|
+
if (hr != 0) return null; // cancelled
|
|
66
|
+
IShellItem result;
|
|
67
|
+
dialog.GetResult(out result);
|
|
68
|
+
string p;
|
|
69
|
+
result.GetDisplayName(0x80058000, out p); // SIGDN_FILESYSPATH
|
|
70
|
+
return p;
|
|
71
|
+
} finally {
|
|
72
|
+
owner.Close();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
"@
|
|
77
|
+
$picked = [SymbioFolderPicker]::Pick($Initial, $Title)
|
|
78
|
+
if ($picked) { [Console]::Out.Write($picked) }
|
|
79
79
|
`;
|
|
80
80
|
let busy = false;
|
|
81
81
|
/** Opens the native folder dialog. Resolves to the chosen path, or null if cancelled. */
|
package/dist/web/index.html
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>Symbio</title>
|
|
7
|
-
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><circle cx='16' cy='16' r='12' fill='%237c6cff'/><circle cx='16' cy='16' r='5' fill='%23fff'/></svg>" />
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>Symbio</title>
|
|
7
|
+
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><circle cx='16' cy='16' r='12' fill='%237c6cff'/><circle cx='16' cy='16' r='5' fill='%23fff'/></svg>" />
|
|
8
8
|
<script type="module" crossorigin src="/assets/index-DrIslUUT.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-Cbd1sDvV.css">
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
<div id="root"></div>
|
|
13
|
-
</body>
|
|
14
|
-
</html>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|