@llman-sdd/cli 0.11.0 → 0.12.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 (45) hide show
  1. package/package.json +13 -5
  2. package/src/cli-shared.ts +85 -43
  3. package/src/commands/archive.ts +0 -9
  4. package/src/commands/change.ts +71 -33
  5. package/src/commands/init.ts +9 -11
  6. package/src/commands/list.ts +0 -2
  7. package/src/commands/project.ts +0 -6
  8. package/src/commands/review.ts +0 -1
  9. package/src/commands/self.ts +3 -1
  10. package/src/commands/show.ts +8 -46
  11. package/src/commands/spec.ts +4 -6
  12. package/src/commands/studio.ts +1315 -0
  13. package/src/commands/studioMcp.ts +862 -0
  14. package/src/commands/studioShared.ts +87 -0
  15. package/src/commands/theorem-write.ts +608 -0
  16. package/src/commands/theorem.ts +479 -0
  17. package/src/commands/validate.ts +108 -47
  18. package/src/io.ts +0 -1
  19. package/src/main.ts +3 -18
  20. package/src/program.ts +16 -12
  21. package/src/progress.ts +1 -3
  22. package/src/studio-server/changeScope.ts +295 -0
  23. package/src/studio-server/hub.ts +98 -0
  24. package/src/studio-server/negotiate.ts +60 -0
  25. package/src/studio-server/security.ts +71 -0
  26. package/src/studio-server/server.ts +1694 -0
  27. package/src/studio-server/static.ts +184 -0
  28. package/src/studio-server/syncDisk.ts +116 -0
  29. package/src/theorems/base.ts +53 -0
  30. package/src/theorems/diagnose.ts +90 -0
  31. package/src/theorems/draft.ts +252 -0
  32. package/src/theorems/os-lock.ts +364 -0
  33. package/src/theorems/paths.ts +11 -0
  34. package/src/theorems/prompts.ts +79 -0
  35. package/src/theorems/quiet.ts +21 -0
  36. package/src/theorems/runner.ts +48 -0
  37. package/src/theorems/transaction.ts +272 -0
  38. package/src/theorems/workspace.ts +103 -0
  39. package/studio-dist/index.html +14 -0
  40. package/studio-dist/static/css/index.00cf48cf.css +1 -0
  41. package/studio-dist/static/js/610.51883f69.js +218 -0
  42. package/studio-dist/static/js/610.51883f69.js.LICENSE.txt +26 -0
  43. package/studio-dist/static/js/index.c5f7c530.js +13 -0
  44. package/studio-dist/static/js/lib-react.a4b07007.js +2 -0
  45. package/studio-dist/static/js/lib-react.a4b07007.js.LICENSE.txt +49 -0
@@ -0,0 +1,364 @@
1
+ /**
2
+ * Cross-platform native OS lock driver for theorem .yaml files (validation r161/r189).
3
+ *
4
+ * Only .yaml files are locked; the directory stays untouched so routine git pull,
5
+ * new-file creation and worktree coordination keep working. Every external command
6
+ * goes through the injected CommandRunner port, so tests never call real sudo,
7
+ * chattr, chflags or icacls.
8
+ *
9
+ * Platform semantics:
10
+ * - linux: chattr +i / lsattr -d (attribute string must contain 'i')
11
+ * - darwin: chflags schg / stat -f '%Sf' (schg = strong, uchg = weak only)
12
+ * - win32: icacls owner SYSTEM + deny write+delete to the current user SID,
13
+ * inspected through Get-Acl so localized icacls text cannot mislead.
14
+ */
15
+ import type { TheoremLockStrength } from '@llman-sdd/core';
16
+
17
+ export type TheoremPlatform = 'linux' | 'darwin' | 'win32';
18
+
19
+ export interface CommandResult {
20
+ status: number;
21
+ stdout: string;
22
+ stderr: string;
23
+ }
24
+
25
+ export type CommandRunner = (command: string, args: readonly string[]) => CommandResult;
26
+
27
+ export interface LockCapability {
28
+ supported: boolean;
29
+ platform: TheoremPlatform;
30
+ mechanism: string;
31
+ reason?: string;
32
+ }
33
+
34
+ /**
35
+ * Ordered native command lines. Windows needs several steps (ownership, then the
36
+ * deny ACE), so a single string could not express the real recipe. Callers join
37
+ * the lines with ' && ' for display only.
38
+ */
39
+ export interface NativeLockCommands {
40
+ lock: readonly string[];
41
+ unlock: readonly string[];
42
+ inspect: readonly string[];
43
+ }
44
+
45
+ /** Display form of an ordered command list (copy-pasteable in a POSIX shell). */
46
+ export function joinCommands(commands: readonly string[]): string {
47
+ return commands.join(' && ');
48
+ }
49
+
50
+ /**
51
+ * Attribute/flag parsing is deliberately positional-safe: Linux reads the first
52
+ * whitespace-separated field of `lsattr -d`, never a fixed column offset.
53
+ */
54
+ export function parseLinuxImmutable(lsattrOutput: string): boolean {
55
+ const first = lsattrOutput.trim().split(/\s+/u)[0] ?? '';
56
+ return first.includes('i');
57
+ }
58
+
59
+ /** macOS `stat -f '%Sf'` prints a comma-separated flag list. */
60
+ export function parseDarwinFlags(statOutput: string): TheoremLockStrength {
61
+ const flags = statOutput
62
+ .trim()
63
+ .split(',')
64
+ .map((flag) => flag.trim());
65
+ if (flags.includes('schg')) return 'strong';
66
+ if (flags.includes('uchg')) return 'weak';
67
+ return 'none';
68
+ }
69
+
70
+ export function parseWindowsSid(whoamiOutput: string): string {
71
+ const match = /(S-1-(?:\d+-)+\d+)/u.exec(whoamiOutput);
72
+ return match?.[1] ?? '';
73
+ }
74
+
75
+ /**
76
+ * The win32 inspection script. Get-Acl returns typed objects, so the fields come
77
+ * back as .NET enum text ('Deny', 'Write, Delete') that no translation layer
78
+ * rewrites; a localized icacls table cannot be parsed reliably at all.
79
+ * IdentityReference prints the localized account name, so each ACE is translated
80
+ * back to its SID: the SID is stable across languages and account renames.
81
+ */
82
+ export const WINDOWS_ACL_SCRIPT =
83
+ 'Get-Acl -LiteralPath "FILE" | ForEach-Object { "OWNER=" + $_.Owner; ' +
84
+ '$_.Access | ForEach-Object { "ACE=" + $_.AccessControlType + "|" + ' +
85
+ '$_.IdentityReference.Translate([System.Security.Principal.SecurityIdentifier]).Value + "|" + ' +
86
+ '$_.FileSystemRights } }';
87
+
88
+ export function windowsAclCommand(file: string): string {
89
+ const script = WINDOWS_ACL_SCRIPT.replace('FILE', file);
90
+ return "powershell -NoProfile -NonInteractive -Command '" + script + "'";
91
+ }
92
+
93
+ /** The S-1-5-18 well-known SID and the names Windows may print for it instead. */
94
+ const WINDOWS_LOCAL_SYSTEM_SID = 'S-1-5-18';
95
+
96
+ function isSystemOwner(owner: string): boolean {
97
+ const upper = owner.toUpperCase();
98
+ return upper.includes(WINDOWS_LOCAL_SYSTEM_SID) || upper.endsWith('SYSTEM');
99
+ }
100
+
101
+ export interface WindowsAce {
102
+ type: string;
103
+ identity: string;
104
+ rights: string;
105
+ }
106
+
107
+ export interface WindowsAcl {
108
+ owner: string;
109
+ aces: WindowsAce[];
110
+ }
111
+
112
+ /** Parse the OWNER=/ACE= lines emitted by windowsAclCommand. */
113
+ export function parseWindowsAclOutput(output: string): WindowsAcl {
114
+ const acl: WindowsAcl = { owner: '', aces: [] };
115
+ for (const raw of output.split('\n')) {
116
+ const line = raw.trim();
117
+ if (line.startsWith('OWNER=')) {
118
+ acl.owner = line.slice('OWNER='.length).trim();
119
+ continue;
120
+ }
121
+ if (!line.startsWith('ACE=')) continue;
122
+ const parts = line.slice('ACE='.length).split('|');
123
+ acl.aces.push({
124
+ type: (parts[0] ?? '').trim(),
125
+ identity: (parts[1] ?? '').trim(),
126
+ rights: (parts[2] ?? '').trim(),
127
+ });
128
+ }
129
+ return acl;
130
+ }
131
+
132
+ export function parseWindowsAcl(aclOutput: string, sid: string): boolean {
133
+ const acl = parseWindowsAclOutput(aclOutput);
134
+ if (!isSystemOwner(acl.owner)) return false;
135
+ return acl.aces.some(
136
+ (ace) =>
137
+ ace.type.toLowerCase() === 'deny' &&
138
+ (sid === '' || ace.identity.includes(sid)) &&
139
+ /write/iu.test(ace.rights) &&
140
+ /delete/iu.test(ace.rights),
141
+ );
142
+ }
143
+
144
+ export function parseWindowsAttribReadOnly(attribOutput: string): boolean {
145
+ for (const raw of attribOutput.split('\n')) {
146
+ if (raw.trim() === '') continue;
147
+ const flags = raw.slice(0, 12);
148
+ if (/\bR\b/u.test(flags)) return true;
149
+ }
150
+ return false;
151
+ }
152
+
153
+ export function nativeCommands(
154
+ platform: TheoremPlatform,
155
+ files: readonly string[],
156
+ sid = '',
157
+ ): NativeLockCommands {
158
+ const quoted = files.map((file) => "'" + file + "'").join(' ');
159
+ if (platform === 'darwin') {
160
+ return {
161
+ lock: ['sudo chflags schg -- ' + quoted],
162
+ unlock: ['sudo chflags noschg -- ' + quoted],
163
+ inspect: ["stat -f '%Sf' -- " + quoted],
164
+ };
165
+ }
166
+ if (platform === 'win32') {
167
+ const sidExpr = sid === '' ? '*S-1-5-21-*' : '*' + sid;
168
+ return {
169
+ lock: [
170
+ 'icacls ' + quoted + ' /setowner "*' + WINDOWS_LOCAL_SYSTEM_SID + '"',
171
+ 'icacls ' + quoted + ' /deny "' + sidExpr + '":(W,D,WDAC,WO)',
172
+ ],
173
+ unlock: [
174
+ 'takeown /F ' + quoted,
175
+ 'icacls ' + quoted + ' /remove:d "' + sidExpr + '"',
176
+ 'icacls ' + quoted + ' /setowner "' + sidExpr + '"',
177
+ ],
178
+ inspect: files.map((file) => windowsAclCommand(file)),
179
+ };
180
+ }
181
+ return {
182
+ lock: ['sudo chattr +i -- ' + quoted],
183
+ unlock: ['sudo chattr -i -- ' + quoted],
184
+ inspect: ['lsattr -d -- ' + quoted],
185
+ };
186
+ }
187
+
188
+ // Probe tool presence through the tool itself with a harmless invocation. ~keep
189
+ // `chattr --version` exits non-zero on util-linux (it is not a real flag), so the
190
+ // probe asks for the tool's own usage output, which succeeds whenever the binary
191
+ // exists regardless of filesystem capabilities.
192
+ function toolAvailable(run: CommandRunner, tool: string): boolean {
193
+ const probe = run(tool, []);
194
+ const missing = /not found|no such file|cannot find/iu.test(probe.stderr);
195
+ return !missing;
196
+ }
197
+
198
+ const UNSUPPORTED_FS_RE = /inappropriate ioctl|operation not supported|not supported/iu;
199
+
200
+ export function probeLockCapability(
201
+ platform: TheoremPlatform,
202
+ run: CommandRunner,
203
+ directory?: string,
204
+ ): LockCapability {
205
+ if (platform === 'linux') {
206
+ if (!toolAvailable(run, 'chattr')) {
207
+ return {
208
+ supported: false,
209
+ platform,
210
+ mechanism: 'chattr +i',
211
+ reason: 'chattr is not installed on this machine',
212
+ };
213
+ }
214
+ if (directory !== undefined) {
215
+ const probe = run('lsattr', ['-d', '--', directory]);
216
+ if (UNSUPPORTED_FS_RE.test(probe.stderr)) {
217
+ return {
218
+ supported: false,
219
+ platform,
220
+ mechanism: 'chattr +i',
221
+ reason: 'filesystem does not support immutable flags (' + probe.stderr.trim() + ')',
222
+ };
223
+ }
224
+ }
225
+ return { supported: true, platform, mechanism: 'chattr +i' };
226
+ }
227
+ if (platform === 'darwin') {
228
+ if (!toolAvailable(run, 'chflags')) {
229
+ return {
230
+ supported: false,
231
+ platform,
232
+ mechanism: 'chflags schg',
233
+ reason: 'chflags is not installed on this machine',
234
+ };
235
+ }
236
+ return { supported: true, platform, mechanism: 'chflags schg' };
237
+ }
238
+ if (!toolAvailable(run, 'icacls')) {
239
+ return {
240
+ supported: false,
241
+ platform,
242
+ mechanism: 'icacls deny',
243
+ reason: 'icacls is not installed on this machine',
244
+ };
245
+ }
246
+ return { supported: true, platform, mechanism: 'icacls deny' };
247
+ }
248
+
249
+ export interface LockOptions {
250
+ platform: TheoremPlatform;
251
+ run: CommandRunner;
252
+ sid?: string;
253
+ modeOf?: (file: string) => number | null;
254
+ }
255
+
256
+ export interface LockOutcome {
257
+ ok: boolean;
258
+ strength: TheoremLockStrength;
259
+ detail: string;
260
+ }
261
+
262
+ export function applyStrongLock(files: readonly string[], options: LockOptions): LockOutcome {
263
+ if (files.length === 0) return { ok: true, strength: 'none', detail: 'no files to lock' };
264
+ const commands = nativeCommands(options.platform, files, options.sid);
265
+ for (const line of commands.lock) {
266
+ const result = runCommandLine(options.run, line);
267
+ if (result.status !== 0) {
268
+ return { ok: false, strength: 'none', detail: result.stderr.trim() || 'lock command failed' };
269
+ }
270
+ }
271
+ return { ok: true, strength: 'strong', detail: joinCommands(commands.lock) };
272
+ }
273
+
274
+ export function removeStrongLock(files: readonly string[], options: LockOptions): LockOutcome {
275
+ if (files.length === 0) return { ok: true, strength: 'none', detail: 'no files to unlock' };
276
+ const commands = nativeCommands(options.platform, files, options.sid);
277
+ for (const line of commands.unlock) {
278
+ const result = runCommandLine(options.run, line);
279
+ if (result.status !== 0) {
280
+ return {
281
+ ok: false,
282
+ strength: 'strong',
283
+ detail: result.stderr.trim() || 'unlock command failed',
284
+ };
285
+ }
286
+ }
287
+ return { ok: true, strength: 'none', detail: joinCommands(commands.unlock) };
288
+ }
289
+
290
+ function isReadOnlyMode(options: LockOptions, file: string): boolean {
291
+ if (options.modeOf === undefined) return false;
292
+ const mode = options.modeOf(file);
293
+ return mode !== null && (mode & 0o222) === 0;
294
+ }
295
+
296
+ export function inspectLock(file: string, options: LockOptions): TheoremLockStrength {
297
+ const commands = nativeCommands(options.platform, [file], options.sid);
298
+ const line = commands.inspect[0] ?? '';
299
+ const result =
300
+ line === '' ? { status: 1, stdout: '', stderr: '' } : runCommandLine(options.run, line);
301
+ if (options.platform === 'linux') {
302
+ if (result.status === 0 && parseLinuxImmutable(result.stdout)) return 'strong';
303
+ return isReadOnlyMode(options, file) ? 'weak' : 'none';
304
+ }
305
+ if (options.platform === 'darwin') {
306
+ const flags = result.status === 0 ? parseDarwinFlags(result.stdout) : 'none';
307
+ if (flags !== 'none') return flags;
308
+ return isReadOnlyMode(options, file) ? 'weak' : 'none';
309
+ }
310
+ if (result.status === 0 && parseWindowsAcl(result.stdout, options.sid ?? '')) return 'strong';
311
+ const attrib = options.run('attrib', [file]);
312
+ if (attrib.status === 0 && parseWindowsAttribReadOnly(attrib.stdout)) return 'weak';
313
+ return 'none';
314
+ }
315
+
316
+ export function applyWeakFallbackLock(
317
+ files: readonly string[],
318
+ options: Pick<LockOptions, 'platform' | 'run'>,
319
+ ): LockOutcome {
320
+ if (files.length === 0) return { ok: true, strength: 'none', detail: 'no files to lock' };
321
+ const windows = options.platform === 'win32';
322
+ const cmd = windows ? 'attrib' : 'chmod';
323
+ const args = windows ? ['+R', ...files] : ['0444', ...files];
324
+ const result = options.run(cmd, args);
325
+ if (result.status !== 0) {
326
+ return { ok: false, strength: 'none', detail: result.stderr.trim() || 'fallback lock failed' };
327
+ }
328
+ return { ok: true, strength: 'weak', detail: cmd + ' ' + args.join(' ') };
329
+ }
330
+
331
+ export function runCommandLine(run: CommandRunner, line: string): CommandResult {
332
+ const tokens = tokenizeCommand(line);
333
+ const command = tokens[0];
334
+ if (command === undefined) return { status: 1, stdout: '', stderr: 'empty command' };
335
+ return run(command, tokens.slice(1));
336
+ }
337
+
338
+ /** Minimal POSIX-ish tokenizer: whitespace splits, quote pairs group verbatim. */
339
+ export function tokenizeCommand(line: string): string[] {
340
+ const tokens: string[] = [];
341
+ let current = '';
342
+ let quote: string | null = null;
343
+ for (const char of line) {
344
+ if (quote !== null) {
345
+ if (char === quote) quote = null;
346
+ else current += char;
347
+ continue;
348
+ }
349
+ if (char === "'" || char === '"') {
350
+ quote = char;
351
+ continue;
352
+ }
353
+ if (/\s/u.test(char)) {
354
+ if (current !== '') {
355
+ tokens.push(current);
356
+ current = '';
357
+ }
358
+ continue;
359
+ }
360
+ current += char;
361
+ }
362
+ if (current !== '') tokens.push(current);
363
+ return tokens;
364
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Convert an absolute path to an instance-relative POSIX path, normalizing
3
+ * Windows separators and a trailing slash on the instance root.
4
+ */
5
+ export function toInstanceRelativePosixPath(root: string, absolute: string): string {
6
+ const normalizedRoot = root.replace(/\\/gu, '/').replace(/\/+$/u, '');
7
+ const normalized = absolute.replace(/\\/gu, '/');
8
+ return normalized.startsWith(`${normalizedRoot}/`)
9
+ ? normalized.slice(normalizedRoot.length + 1)
10
+ : normalized;
11
+ }
@@ -0,0 +1,79 @@
1
+ export interface PromptChoice<T extends string> {
2
+ name: string;
3
+ value: T;
4
+ }
5
+
6
+ export interface InputOptions {
7
+ default?: string;
8
+ validate?: (value: string) => true | string;
9
+ }
10
+
11
+ export interface SelectOptions<T extends string> {
12
+ default?: T;
13
+ }
14
+
15
+ export interface ConfirmOptions {
16
+ default?: boolean;
17
+ }
18
+
19
+ export interface EditorOptions {
20
+ default?: string;
21
+ }
22
+
23
+ export interface TheoremPromptPort {
24
+ input(message: string, options?: InputOptions): Promise<string>;
25
+ select<T extends string>(
26
+ message: string,
27
+ choices: readonly PromptChoice<T>[],
28
+ options?: SelectOptions<T>,
29
+ ): Promise<T>;
30
+ confirm(message: string, options?: ConfirmOptions): Promise<boolean>;
31
+ editor(message: string, options?: EditorOptions): Promise<string>;
32
+ }
33
+
34
+ export class PromptAborted extends Error {
35
+ constructor() {
36
+ super('prompt aborted by human');
37
+ this.name = 'PromptAborted';
38
+ }
39
+ }
40
+
41
+ /** True when the thrown value is a prompt interruption rather than a bug. */
42
+ export function isPromptAborted(error: unknown): boolean {
43
+ if (error instanceof PromptAborted) return true;
44
+ if (typeof error !== 'object' || error === null) return false;
45
+ return 'name' in error && (error as { name: unknown }).name === 'ExitPromptError';
46
+ }
47
+
48
+ async function guarded<T>(call: Promise<T>): Promise<T> {
49
+ try {
50
+ return await call;
51
+ } catch (error) {
52
+ if (isPromptAborted(error)) throw new PromptAborted();
53
+ throw error;
54
+ }
55
+ }
56
+
57
+ export async function makeInquirerPromptPort(): Promise<TheoremPromptPort> {
58
+ const { input, select, confirm, editor } = await import('@inquirer/prompts');
59
+ return {
60
+ input: (message, options = {}) =>
61
+ guarded(
62
+ input({
63
+ message,
64
+ ...(options.default === undefined ? {} : { default: options.default }),
65
+ ...(options.validate === undefined ? {} : { validate: options.validate }),
66
+ }),
67
+ ),
68
+ select: (async (message: string, choices: readonly PromptChoice<string>[], options = {}) =>
69
+ guarded(
70
+ select({
71
+ message,
72
+ choices: [...choices],
73
+ ...(options.default === undefined ? {} : { default: options.default }),
74
+ }),
75
+ )) as TheoremPromptPort['select'],
76
+ confirm: (message, options = {}) => guarded(confirm({ message, ...options })),
77
+ editor: (message, options = {}) => guarded(editor({ message, ...options })),
78
+ };
79
+ }
@@ -0,0 +1,21 @@
1
+ import type { TheoremCheckResult } from '../commands/theorem.ts';
2
+ import { RECOVERY_ACTIONS, type TheoremStateCode } from './diagnose.ts';
3
+
4
+ export type QuietAction =
5
+ | { kind: 'silent' }
6
+ | { kind: 'reminder'; message: string }
7
+ | { kind: 'report' };
8
+
9
+ const SILENT_STATES: ReadonlySet<string> = new Set(['S0_ABSENT', 'S1_EMPTY', 'S2_LOCKED_STRONG']);
10
+
11
+ export function quietAction(result: TheoremCheckResult, culprits: readonly string[]): QuietAction {
12
+ if (!result.ok) return { kind: 'report' };
13
+ if (SILENT_STATES.has(result.stateCode)) return { kind: 'silent' };
14
+ const recovery: string | undefined = RECOVERY_ACTIONS[result.stateCode as TheoremStateCode];
15
+ if (recovery === undefined) return { kind: 'report' };
16
+ const suffix = culprits.length > 0 ? ` (${culprits.join(', ')})` : '';
17
+ return {
18
+ kind: 'reminder',
19
+ message: `theorem check: ${result.stateCode}${suffix} — ${recovery}`,
20
+ };
21
+ }
@@ -0,0 +1,48 @@
1
+ import { spawnSync } from 'node:child_process';
2
+
3
+ import type { CommandResult, CommandRunner } from './os-lock.ts';
4
+
5
+ export interface RunnerOptions {
6
+ cwd?: string;
7
+ timeoutMs?: number;
8
+ interactive?: boolean;
9
+ spawn?: typeof spawnSync;
10
+ }
11
+
12
+ export const INTERACTIVE_TIMEOUT_MS = 10 * 60 * 1000;
13
+
14
+ export function makeCommandRunner(options: RunnerOptions = {}): CommandRunner {
15
+ const spawn = options.spawn ?? spawnSync;
16
+ return (command, args): CommandResult => {
17
+ if (options.interactive === true) {
18
+ const result = spawn(command, [...args], {
19
+ cwd: options.cwd,
20
+ encoding: 'utf8',
21
+ timeout: options.timeoutMs ?? INTERACTIVE_TIMEOUT_MS,
22
+ stdio: 'inherit',
23
+ });
24
+ return {
25
+ status: result.status ?? 1,
26
+ stdout: typeof result.stdout === 'string' ? result.stdout : '',
27
+ stderr: typeof result.stderr === 'string' ? result.stderr : '',
28
+ };
29
+ }
30
+ const result = spawn(command, [...args], {
31
+ cwd: options.cwd,
32
+ encoding: 'utf8',
33
+ timeout: options.timeoutMs ?? 30_000,
34
+ stdio: ['ignore', 'pipe', 'pipe'],
35
+ });
36
+ return {
37
+ status: result.status ?? 1,
38
+ stdout: result.stdout ?? '',
39
+ stderr: result.stderr ?? '',
40
+ };
41
+ };
42
+ }
43
+
44
+ export function currentPlatform(): 'linux' | 'darwin' | 'win32' {
45
+ const platform = process.platform;
46
+ if (platform === 'darwin' || platform === 'win32') return platform;
47
+ return 'linux';
48
+ }