@trayai/tray-sync-cli 1.0.13 → 1.0.15
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/api/resources/me.js +14 -0
- package/dist/api/resources/project.js +36 -0
- package/dist/commands/api/api.js +4 -0
- package/dist/commands/api/login.js +91 -0
- package/dist/commands/api/logout.js +39 -0
- package/dist/commands/api/project.js +116 -4
- package/dist/commands/api/shared.js +10 -4
- package/dist/commands/api/workflow.js +4 -4
- package/dist/commands/promote.js +2 -1
- package/dist/lib/apiAuth.js +25 -2
- package/dist/lib/apiSessionStore.js +104 -0
- package/dist/lib/browserOpener.js +24 -0
- package/dist/lib/dotenvEdit.js +31 -0
- package/dist/lib/oauth.js +125 -0
- package/dist/lib/oauthCallbackServer.js +97 -0
- package/dist/lib/oauthRefresh.js +65 -0
- package/dist/lib/promoteTarget.js +0 -24
- package/dist/lib/region.js +1 -0
- package/dist/views/api/project.v2.js +6 -0
- package/node_modules/bundle-name/index.js +5 -0
- package/node_modules/bundle-name/license +9 -0
- package/node_modules/bundle-name/package.json +45 -0
- package/node_modules/bundle-name/readme.md +23 -0
- package/node_modules/default-browser/index.d.ts +29 -0
- package/node_modules/default-browser/index.js +34 -0
- package/node_modules/default-browser/license +9 -0
- package/node_modules/default-browser/package.json +54 -0
- package/node_modules/default-browser/readme.md +24 -0
- package/node_modules/default-browser/windows.js +59 -0
- package/node_modules/default-browser-id/index.js +25 -0
- package/node_modules/default-browser-id/license +9 -0
- package/node_modules/default-browser-id/package.json +41 -0
- package/node_modules/default-browser-id/readme.md +19 -0
- package/node_modules/define-lazy-prop/index.d.ts +31 -0
- package/node_modules/define-lazy-prop/index.js +18 -0
- package/node_modules/define-lazy-prop/license +9 -0
- package/node_modules/define-lazy-prop/package.json +51 -0
- package/node_modules/define-lazy-prop/readme.md +55 -0
- package/node_modules/dotenv/CHANGELOG.md +643 -0
- package/node_modules/dotenv/LICENSE +23 -0
- package/node_modules/dotenv/README-es.md +757 -0
- package/node_modules/dotenv/README.md +812 -0
- package/node_modules/dotenv/SECURITY.md +1 -0
- package/node_modules/dotenv/config.d.ts +1 -0
- package/node_modules/dotenv/config.js +9 -0
- package/node_modules/dotenv/lib/cli-options.js +17 -0
- package/node_modules/dotenv/lib/env-options.js +28 -0
- package/node_modules/dotenv/lib/main.d.ts +179 -0
- package/node_modules/dotenv/lib/main.js +423 -0
- package/node_modules/dotenv/package.json +62 -0
- package/node_modules/dotenv/skills/dotenv/SKILL.md +200 -0
- package/node_modules/dotenv/skills/dotenvx/SKILL.md +118 -0
- package/node_modules/graceful-fs/LICENSE +15 -0
- package/node_modules/graceful-fs/README.md +143 -0
- package/node_modules/graceful-fs/clone.js +23 -0
- package/node_modules/graceful-fs/graceful-fs.js +448 -0
- package/node_modules/graceful-fs/legacy-streams.js +118 -0
- package/node_modules/graceful-fs/package.json +53 -0
- package/node_modules/graceful-fs/polyfills.js +355 -0
- package/node_modules/is-docker/cli.js +5 -0
- package/node_modules/is-docker/index.d.ts +13 -0
- package/node_modules/is-docker/index.js +29 -0
- package/node_modules/is-docker/license +9 -0
- package/node_modules/is-docker/package.json +44 -0
- package/node_modules/is-docker/readme.md +27 -0
- package/node_modules/is-in-ssh/index.d.ts +15 -0
- package/node_modules/is-in-ssh/index.js +7 -0
- package/node_modules/is-in-ssh/license +9 -0
- package/node_modules/is-in-ssh/package.json +43 -0
- package/node_modules/is-in-ssh/readme.md +43 -0
- package/node_modules/is-inside-container/cli.js +5 -0
- package/node_modules/is-inside-container/index.d.ts +13 -0
- package/node_modules/is-inside-container/index.js +23 -0
- package/node_modules/is-inside-container/license +9 -0
- package/node_modules/is-inside-container/package.json +51 -0
- package/node_modules/is-inside-container/readme.md +36 -0
- package/node_modules/is-wsl/index.d.ts +15 -0
- package/node_modules/is-wsl/index.js +36 -0
- package/node_modules/is-wsl/license +9 -0
- package/node_modules/is-wsl/package.json +58 -0
- package/node_modules/is-wsl/readme.md +21 -0
- package/node_modules/open/index.d.ts +158 -0
- package/node_modules/open/index.js +425 -0
- package/node_modules/open/license +9 -0
- package/node_modules/open/package.json +70 -0
- package/node_modules/open/readme.md +197 -0
- package/node_modules/open/xdg-open +1267 -0
- package/node_modules/powershell-utils/index.d.ts +175 -0
- package/node_modules/powershell-utils/index.js +79 -0
- package/node_modules/powershell-utils/license +9 -0
- package/node_modules/powershell-utils/package.json +47 -0
- package/node_modules/powershell-utils/readme.md +209 -0
- package/node_modules/proper-lockfile/CHANGELOG.md +108 -0
- package/node_modules/proper-lockfile/LICENSE +21 -0
- package/node_modules/proper-lockfile/README.md +183 -0
- package/node_modules/proper-lockfile/index.js +40 -0
- package/node_modules/proper-lockfile/lib/adapter.js +85 -0
- package/node_modules/proper-lockfile/lib/lockfile.js +342 -0
- package/node_modules/proper-lockfile/lib/mtime-precision.js +55 -0
- package/node_modules/proper-lockfile/package.json +71 -0
- package/node_modules/retry/.npmignore +3 -0
- package/node_modules/retry/.travis.yml +15 -0
- package/node_modules/retry/License +21 -0
- package/node_modules/retry/Makefile +18 -0
- package/node_modules/retry/README.md +227 -0
- package/node_modules/retry/equation.gif +0 -0
- package/node_modules/retry/example/dns.js +31 -0
- package/node_modules/retry/example/stop.js +40 -0
- package/node_modules/retry/index.js +1 -0
- package/node_modules/retry/lib/retry.js +100 -0
- package/node_modules/retry/lib/retry_operation.js +158 -0
- package/node_modules/retry/package.json +32 -0
- package/node_modules/retry/test/common.js +10 -0
- package/node_modules/retry/test/integration/test-forever.js +24 -0
- package/node_modules/retry/test/integration/test-retry-operation.js +258 -0
- package/node_modules/retry/test/integration/test-retry-wrap.js +101 -0
- package/node_modules/retry/test/integration/test-timeouts.js +69 -0
- package/node_modules/run-applescript/index.d.ts +66 -0
- package/node_modules/run-applescript/index.js +37 -0
- package/node_modules/run-applescript/license +9 -0
- package/node_modules/run-applescript/package.json +42 -0
- package/node_modules/run-applescript/readme.md +78 -0
- package/node_modules/signal-exit/LICENSE.txt +16 -0
- package/node_modules/signal-exit/README.md +39 -0
- package/node_modules/signal-exit/index.js +202 -0
- package/node_modules/signal-exit/package.json +38 -0
- package/node_modules/signal-exit/signals.js +53 -0
- package/node_modules/wsl-utils/index.d.ts +180 -0
- package/node_modules/wsl-utils/index.js +145 -0
- package/node_modules/wsl-utils/license +9 -0
- package/node_modules/wsl-utils/node_modules/powershell-utils/index.d.ts +122 -0
- package/node_modules/wsl-utils/node_modules/powershell-utils/index.js +58 -0
- package/node_modules/wsl-utils/node_modules/powershell-utils/license +9 -0
- package/node_modules/wsl-utils/node_modules/powershell-utils/package.json +47 -0
- package/node_modules/wsl-utils/node_modules/powershell-utils/readme.md +153 -0
- package/node_modules/wsl-utils/package.json +48 -0
- package/node_modules/wsl-utils/readme.md +223 -0
- package/node_modules/wsl-utils/utilities.js +19 -0
- package/package.json +8 -1
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# wsl-utils
|
|
2
|
+
|
|
3
|
+
> Utilities for working with [Windows Subsystem for Linux (WSL)](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux)
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install wsl-utils
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import {isWsl, powerShellPathFromWsl} from 'wsl-utils';
|
|
15
|
+
|
|
16
|
+
// Check if running in WSL
|
|
17
|
+
console.log('Is WSL:', isWsl);
|
|
18
|
+
|
|
19
|
+
// Get PowerShell path from WSL
|
|
20
|
+
console.log('PowerShell path:', await powerShellPathFromWsl());
|
|
21
|
+
//=> '/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## API
|
|
25
|
+
|
|
26
|
+
### isWsl
|
|
27
|
+
|
|
28
|
+
Type: `boolean`
|
|
29
|
+
|
|
30
|
+
Check if the current environment is Windows Subsystem for Linux (WSL).
|
|
31
|
+
|
|
32
|
+
### powerShellPathFromWsl()
|
|
33
|
+
|
|
34
|
+
Returns: `Promise<string>`
|
|
35
|
+
|
|
36
|
+
Get the PowerShell executable path in WSL environment.
|
|
37
|
+
|
|
38
|
+
### powerShellPath()
|
|
39
|
+
|
|
40
|
+
Returns: `Promise<string>`
|
|
41
|
+
|
|
42
|
+
Get the PowerShell executable path for the current environment.
|
|
43
|
+
|
|
44
|
+
Returns WSL path if in WSL, otherwise returns Windows path.
|
|
45
|
+
|
|
46
|
+
### canAccessPowerShell()
|
|
47
|
+
|
|
48
|
+
Returns: `Promise<boolean>`
|
|
49
|
+
|
|
50
|
+
Check if PowerShell is accessible in the current environment.
|
|
51
|
+
|
|
52
|
+
This is useful to determine whether Windows integration features can be used. In sandboxed WSL environments or systems where PowerShell is not accessible, this will return `false`.
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
import {canAccessPowerShell} from 'wsl-utils';
|
|
56
|
+
|
|
57
|
+
if (await canAccessPowerShell()) {
|
|
58
|
+
// Use Windows integration features
|
|
59
|
+
console.log('PowerShell is accessible');
|
|
60
|
+
} else {
|
|
61
|
+
// Fall back to Linux-native behavior
|
|
62
|
+
console.log('PowerShell is not accessible');
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### wslDefaultBrowser()
|
|
67
|
+
|
|
68
|
+
Returns: `Promise<string>`
|
|
69
|
+
|
|
70
|
+
Get the default browser in WSL.
|
|
71
|
+
|
|
72
|
+
Returns a promise that resolves to the [ProgID](https://setuserfta.com/guide-to-understanding-progids-and-file-type-associations/) of the default browser (e.g., `'ChromeHTML'`, `'FirefoxURL'`).
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
import {wslDefaultBrowser} from 'wsl-utils';
|
|
76
|
+
|
|
77
|
+
const progId = await wslDefaultBrowser();
|
|
78
|
+
//=> 'ChromeHTML'
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### wslDrivesMountPoint()
|
|
82
|
+
|
|
83
|
+
Returns: `Promise<string>`
|
|
84
|
+
|
|
85
|
+
Get the mount point for fixed drives in WSL.
|
|
86
|
+
|
|
87
|
+
### convertWslPathToWindows(path)
|
|
88
|
+
|
|
89
|
+
Returns: `Promise<string>`
|
|
90
|
+
|
|
91
|
+
Convert a WSL Linux path to a Windows-accessible path.
|
|
92
|
+
|
|
93
|
+
URLs (strings starting with a protocol like `https://`) are returned unchanged.
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
import {convertWslPathToWindows} from 'wsl-utils';
|
|
97
|
+
|
|
98
|
+
// Convert a Linux path
|
|
99
|
+
const windowsPath = await convertWslPathToWindows('/home/user/file.html');
|
|
100
|
+
//=> '\\wsl.localhost\Ubuntu\home\user\file.html'
|
|
101
|
+
|
|
102
|
+
// URLs are not converted
|
|
103
|
+
const url = await convertWslPathToWindows('https://example.com');
|
|
104
|
+
//=> 'https://example.com'
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### path
|
|
108
|
+
|
|
109
|
+
Type: `string`
|
|
110
|
+
|
|
111
|
+
The WSL path to convert (e.g., `/home/user/file.html`).
|
|
112
|
+
|
|
113
|
+
### convertWslPathToWindows(paths)
|
|
114
|
+
|
|
115
|
+
Returns: `Promise<string[]>`
|
|
116
|
+
|
|
117
|
+
Convert multiple WSL Linux paths to Windows-accessible paths.
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
import {convertWslPathToWindows} from 'wsl-utils';
|
|
121
|
+
|
|
122
|
+
const windowsPaths = await convertWslPathToWindows([
|
|
123
|
+
'/home/user/file.html',
|
|
124
|
+
'/mnt/c/Users/file.txt',
|
|
125
|
+
'https://example.com'
|
|
126
|
+
]);
|
|
127
|
+
//=> ['\\wsl.localhost\Ubuntu\home\user\file.html', 'C:\Users\file.txt', 'https://example.com']
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### paths
|
|
131
|
+
|
|
132
|
+
Type: `string[]`
|
|
133
|
+
|
|
134
|
+
The WSL paths to convert.
|
|
135
|
+
|
|
136
|
+
### isUncPath(path)
|
|
137
|
+
|
|
138
|
+
Returns: `boolean`
|
|
139
|
+
|
|
140
|
+
Check if a Windows path is a UNC path (e.g., `\\wsl.localhost\...` or `\\wsl$\...`).
|
|
141
|
+
|
|
142
|
+
UNC paths indicate the file resides on the WSL Linux filesystem rather than a Windows drive.
|
|
143
|
+
|
|
144
|
+
```js
|
|
145
|
+
import {isUncPath} from 'wsl-utils';
|
|
146
|
+
|
|
147
|
+
isUncPath('\\\\wsl.localhost\\Ubuntu\\home\\user');
|
|
148
|
+
//=> true
|
|
149
|
+
|
|
150
|
+
isUncPath('C:\\Users\\file.txt');
|
|
151
|
+
//=> false
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### path
|
|
155
|
+
|
|
156
|
+
Type: `string`
|
|
157
|
+
|
|
158
|
+
The Windows path to check.
|
|
159
|
+
|
|
160
|
+
### isPathOnWindowsFilesystem(path)
|
|
161
|
+
|
|
162
|
+
Returns: `Promise<boolean>`
|
|
163
|
+
|
|
164
|
+
Check if a WSL path maps to the Windows filesystem.
|
|
165
|
+
|
|
166
|
+
This converts the path and checks if it's on a Windows drive (e.g., `/mnt/c/...` → `C:\...`) rather than the Linux filesystem (e.g., `/home/...` → `\\wsl$\...`).
|
|
167
|
+
|
|
168
|
+
```js
|
|
169
|
+
import {isPathOnWindowsFilesystem} from 'wsl-utils';
|
|
170
|
+
|
|
171
|
+
await isPathOnWindowsFilesystem('/mnt/c/Users/file.txt');
|
|
172
|
+
//=> true
|
|
173
|
+
|
|
174
|
+
await isPathOnWindowsFilesystem('/home/user/file.txt');
|
|
175
|
+
//=> false
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
#### path
|
|
179
|
+
|
|
180
|
+
Type: `string`
|
|
181
|
+
|
|
182
|
+
The WSL path to check.
|
|
183
|
+
|
|
184
|
+
### convertWindowsPathToWsl(path)
|
|
185
|
+
|
|
186
|
+
Returns: `Promise<string>`
|
|
187
|
+
|
|
188
|
+
Convert a Windows path to a WSL Linux path.
|
|
189
|
+
|
|
190
|
+
```js
|
|
191
|
+
import {convertWindowsPathToWsl} from 'wsl-utils';
|
|
192
|
+
|
|
193
|
+
const wslPath = await convertWindowsPathToWsl('C:\\Users\\file.txt');
|
|
194
|
+
//=> '/mnt/c/Users/file.txt'
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
#### path
|
|
198
|
+
|
|
199
|
+
Type: `string`
|
|
200
|
+
|
|
201
|
+
The Windows path to convert.
|
|
202
|
+
|
|
203
|
+
### convertWindowsPathToWsl(paths)
|
|
204
|
+
|
|
205
|
+
Returns: `Promise<string[]>`
|
|
206
|
+
|
|
207
|
+
Convert multiple Windows paths to WSL Linux paths.
|
|
208
|
+
|
|
209
|
+
```js
|
|
210
|
+
import {convertWindowsPathToWsl} from 'wsl-utils';
|
|
211
|
+
|
|
212
|
+
const wslPaths = await convertWindowsPathToWsl([
|
|
213
|
+
'C:\\Users\\file.txt',
|
|
214
|
+
'D:\\Projects\\app'
|
|
215
|
+
]);
|
|
216
|
+
//=> ['/mnt/c/Users/file.txt', '/mnt/d/Projects/app']
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
#### paths
|
|
220
|
+
|
|
221
|
+
Type: `string[]`
|
|
222
|
+
|
|
223
|
+
The Windows paths to convert.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function parseMountPointFromConfig(content) {
|
|
2
|
+
for (const line of content.split('\n')) {
|
|
3
|
+
// Skip comment lines
|
|
4
|
+
if (/^\s*#/.test(line)) {
|
|
5
|
+
continue;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// Match root at start of line (after optional whitespace)
|
|
9
|
+
const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
|
|
10
|
+
if (!match) {
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return match.groups.mountPoint
|
|
15
|
+
.trim()
|
|
16
|
+
// Strip surrounding quotes
|
|
17
|
+
.replaceAll(/^["']|["']$/g, '');
|
|
18
|
+
}
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trayai/tray-sync-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "CLI tool to clone Tray projects and related assets to a local directory, and promote them between Tray environments",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tray": "dist/cli.js"
|
|
@@ -31,16 +31,23 @@
|
|
|
31
31
|
"ansis": "^4.3.1",
|
|
32
32
|
"cli-table3": "^0.6.5",
|
|
33
33
|
"commander": "~15.0.0",
|
|
34
|
+
"dotenv": "^17.4.2",
|
|
35
|
+
"open": "^11.0.2",
|
|
36
|
+
"proper-lockfile": "^4.1.2",
|
|
34
37
|
"yaml": "~2.9.0"
|
|
35
38
|
},
|
|
36
39
|
"bundleDependencies": [
|
|
37
40
|
"ansis",
|
|
38
41
|
"cli-table3",
|
|
39
42
|
"commander",
|
|
43
|
+
"dotenv",
|
|
44
|
+
"open",
|
|
45
|
+
"proper-lockfile",
|
|
40
46
|
"yaml"
|
|
41
47
|
],
|
|
42
48
|
"devDependencies": {
|
|
43
49
|
"@types/node": "^22.20.1",
|
|
50
|
+
"@types/proper-lockfile": "^4.1.4",
|
|
44
51
|
"typescript": "^5.9.3"
|
|
45
52
|
}
|
|
46
53
|
}
|