@lamalibre/install-portlama-e2e-mcp 0.1.1 → 0.1.4
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/package.json +1 -1
- package/src/lib/deps.js +0 -2
- package/src/lib/multipass.js +2 -8
- package/src/tools/provision.js +15 -6
- package/src/tools/vm.js +4 -10
package/package.json
CHANGED
package/src/lib/deps.js
CHANGED
|
@@ -79,7 +79,6 @@ export const SINGLE_VM_DEPS = {
|
|
|
79
79
|
11: [3], // input-validation
|
|
80
80
|
12: [3], // user-invitations
|
|
81
81
|
13: [3], // site-lifecycle
|
|
82
|
-
14: [3], // shell-lifecycle
|
|
83
82
|
15: [3], // plugin-lifecycle
|
|
84
83
|
16: [3], // enrollment-tokens
|
|
85
84
|
};
|
|
@@ -99,7 +98,6 @@ export const THREE_VM_DEPS = {
|
|
|
99
98
|
7: [1], // site-visitor-journey
|
|
100
99
|
8: [1], // invitation-journey
|
|
101
100
|
9: [1], // agent-site-deploy
|
|
102
|
-
10: [1], // shell-lifecycle
|
|
103
101
|
11: [1], // plugin-lifecycle
|
|
104
102
|
12: [1], // enrollment-lifecycle
|
|
105
103
|
};
|
package/src/lib/multipass.js
CHANGED
|
@@ -42,15 +42,9 @@ export async function launch(name, { cpus, memory, disk }) {
|
|
|
42
42
|
]);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
/** Delete a VM and purge
|
|
45
|
+
/** Delete a VM and purge only that VM (not other users' deleted VMs). */
|
|
46
46
|
export async function deleteVm(name) {
|
|
47
|
-
await run(['delete', name], { allowFailure: true });
|
|
48
|
-
await run(['purge'], { allowFailure: true });
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** Delete a VM without purging (caller handles purge). */
|
|
52
|
-
export async function deleteVmNoPurge(name) {
|
|
53
|
-
await run(['delete', name], { allowFailure: true });
|
|
47
|
+
await run(['delete', '--purge', name], { allowFailure: true });
|
|
54
48
|
}
|
|
55
49
|
|
|
56
50
|
/** Get info for a VM as JSON. Returns null if VM doesn't exist. */
|
package/src/tools/provision.js
CHANGED
|
@@ -69,12 +69,21 @@ export const provisionHostTool = {
|
|
|
69
69
|
const tarball = await packPackage('create-portlama');
|
|
70
70
|
steps.push(`Packed installer: ${tarball}`);
|
|
71
71
|
|
|
72
|
-
// 2.
|
|
73
|
-
await mp.exec(VM_HOST, '
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
// 2. Ensure npm is available (NodeSource images ship with Node+npm)
|
|
73
|
+
const npmCheck = await mp.exec(VM_HOST, 'npm --version', { allowFailure: true });
|
|
74
|
+
if (npmCheck.exitCode !== 0) {
|
|
75
|
+
await mp.exec(VM_HOST, 'apt-get update', {
|
|
76
|
+
sudo: true,
|
|
77
|
+
timeout: 120_000,
|
|
78
|
+
});
|
|
79
|
+
await mp.exec(VM_HOST, 'apt-get install -y npm', {
|
|
80
|
+
sudo: true,
|
|
81
|
+
timeout: 120_000,
|
|
82
|
+
});
|
|
83
|
+
steps.push('npm installed on host');
|
|
84
|
+
} else {
|
|
85
|
+
steps.push(`npm already available (v${npmCheck.stdout.trim()})`);
|
|
86
|
+
}
|
|
78
87
|
|
|
79
88
|
// 3. Transfer and install
|
|
80
89
|
await mp.transfer(tarball, `${VM_HOST}:/tmp/create-portlama.tgz`);
|
package/src/tools/vm.js
CHANGED
|
@@ -30,21 +30,16 @@ export const vmCreateTool = {
|
|
|
30
30
|
|
|
31
31
|
const results = [];
|
|
32
32
|
|
|
33
|
-
// Delete existing VMs in parallel
|
|
34
|
-
let needsPurge = false;
|
|
33
|
+
// Delete existing VMs in parallel (per-VM purge, won't affect other VMs)
|
|
35
34
|
await Promise.all(
|
|
36
35
|
targets.map(async (name) => {
|
|
37
36
|
const existing = await mp.info(name);
|
|
38
37
|
if (existing) {
|
|
39
|
-
await mp.
|
|
40
|
-
needsPurge = true;
|
|
38
|
+
await mp.deleteVm(name);
|
|
41
39
|
results.push(`Deleted existing ${name}`);
|
|
42
40
|
}
|
|
43
41
|
}),
|
|
44
42
|
);
|
|
45
|
-
if (needsPurge) {
|
|
46
|
-
await mp.run(['purge'], { allowFailure: true });
|
|
47
|
-
}
|
|
48
43
|
|
|
49
44
|
// Create VMs in parallel
|
|
50
45
|
await Promise.all(
|
|
@@ -105,14 +100,13 @@ export const vmDeleteTool = {
|
|
|
105
100
|
async handler({ vms } = {}) {
|
|
106
101
|
const targets = vms ? vms.map((v) => VM_NAME_MAP[v]) : ALL_VMS;
|
|
107
102
|
|
|
108
|
-
// Delete VMs in parallel (purge
|
|
103
|
+
// Delete VMs in parallel (per-VM purge, won't affect other VMs)
|
|
109
104
|
await Promise.all(
|
|
110
105
|
targets.map(async (name) => {
|
|
111
|
-
await mp.
|
|
106
|
+
await mp.deleteVm(name);
|
|
112
107
|
removeVmState(name);
|
|
113
108
|
}),
|
|
114
109
|
);
|
|
115
|
-
await mp.run(['purge'], { allowFailure: true });
|
|
116
110
|
|
|
117
111
|
return {
|
|
118
112
|
content: [
|