aicomputer 0.1.14 → 0.1.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/README.md +8 -2
- package/dist/chunk-5JVJROSI.js +186 -0
- package/dist/chunk-KQQUR2YX.js +655 -0
- package/dist/chunk-OWK5N76S.js +70 -0
- package/dist/index.js +730 -644
- package/dist/lib/mount-config.d.ts +69 -0
- package/dist/lib/mount-config.js +40 -0
- package/dist/lib/mount-host.d.ts +14 -0
- package/dist/lib/mount-host.js +10 -0
- package/dist/lib/mount-reconcile.d.ts +25 -0
- package/dist/lib/mount-reconcile.js +13 -0
- package/package.json +4 -3
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// src/lib/mount-host.ts
|
|
2
|
+
import { spawnSync } from "child_process";
|
|
3
|
+
function getMountHostValidationIssues() {
|
|
4
|
+
return evaluateMountHostValidation({
|
|
5
|
+
platform: process.platform,
|
|
6
|
+
hasMutagen: hasCommand("mutagen"),
|
|
7
|
+
hasSsh: hasCommand("ssh"),
|
|
8
|
+
hasScp: hasCommand("scp")
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function formatMountHostInstallGuidance(issues) {
|
|
12
|
+
const lines = [];
|
|
13
|
+
for (const issue of issues) {
|
|
14
|
+
switch (issue.code) {
|
|
15
|
+
case "unsupported-platform":
|
|
16
|
+
lines.push("Supported today: macOS and Linux terminals with Mutagen and OpenSSH installed.");
|
|
17
|
+
break;
|
|
18
|
+
case "missing-mutagen":
|
|
19
|
+
lines.push("Install Mutagen, then rerun `computer mount`.");
|
|
20
|
+
break;
|
|
21
|
+
case "missing-ssh":
|
|
22
|
+
case "missing-scp":
|
|
23
|
+
lines.push("Install OpenSSH client tools so both `ssh` and `scp` are available on PATH.");
|
|
24
|
+
break;
|
|
25
|
+
default:
|
|
26
|
+
lines.push(issue.message);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return lines;
|
|
31
|
+
}
|
|
32
|
+
function evaluateMountHostValidation(input) {
|
|
33
|
+
const issues = [];
|
|
34
|
+
if (!["darwin", "linux"].includes(input.platform)) {
|
|
35
|
+
issues.push({
|
|
36
|
+
code: "unsupported-platform",
|
|
37
|
+
message: "computer mount currently supports macOS and Linux terminals only"
|
|
38
|
+
});
|
|
39
|
+
return issues;
|
|
40
|
+
}
|
|
41
|
+
if (!input.hasMutagen) {
|
|
42
|
+
issues.push({
|
|
43
|
+
code: "missing-mutagen",
|
|
44
|
+
message: "mutagen is not installed. Install Mutagen before using computer mount."
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
if (!input.hasSsh) {
|
|
48
|
+
issues.push({
|
|
49
|
+
code: "missing-ssh",
|
|
50
|
+
message: "`ssh` is not installed or not available on PATH."
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (!input.hasScp) {
|
|
54
|
+
issues.push({
|
|
55
|
+
code: "missing-scp",
|
|
56
|
+
message: "`scp` is not installed or not available on PATH."
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return issues;
|
|
60
|
+
}
|
|
61
|
+
function hasCommand(command) {
|
|
62
|
+
const result = spawnSync("which", [command], { stdio: "ignore" });
|
|
63
|
+
return result.status === 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
getMountHostValidationIssues,
|
|
68
|
+
formatMountHostInstallGuidance,
|
|
69
|
+
evaluateMountHostValidation
|
|
70
|
+
};
|