@infosupport/huddle-cli 0.0.0-experiment-57.47.1 → 0.0.0-experiment-98.48.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/README.md +11 -1
- package/dist/config.js +4 -3
- package/dist/firewall.js +164 -3
- package/dist/images.js +13 -9
- package/dist/index.js +94 -6
- package/dist/init.js +48 -25
- package/dist/runtime.js +12 -16
- package/dist/start.js +49 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ npm install -g @infosupport/huddle-cli
|
|
|
16
16
|
huddle init
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
Pulls `ghcr.io/infosupport/huddle:latest` and starts the container. Works with Docker
|
|
19
|
+
Pulls `ghcr.io/infosupport/huddle:latest` and starts the container. Works with Docker and Podman: the runtime is detected automatically (Docker first, then Podman), or pick one explicitly with `huddle init --runtime <docker|podman>` or the `HUDDLE_RUNTIME` env var. If you run `huddle` while Huddle isn't running, you automatically get a hint to run this command.
|
|
20
20
|
|
|
21
21
|
## Starting devcontainers
|
|
22
22
|
|
|
@@ -25,10 +25,19 @@ huddle # start an IntelliJ devcontainer for the current director
|
|
|
25
25
|
huddle ./project # start for a specific directory
|
|
26
26
|
huddle --ide rider
|
|
27
27
|
huddle --ide vscode --name devcontainer-demo
|
|
28
|
+
huddle --ide vscode --mount backend=../docker-corpa --mount frontend=../frontend-consolidated-real-estate-info --name corpa-dev
|
|
28
29
|
huddle fw list
|
|
29
30
|
huddle firewall list -i
|
|
30
31
|
```
|
|
31
32
|
|
|
33
|
+
`--mount <name>=<path>` mounts an additional folder, worktree-isolated like the main workspace, under `/workspaces/<name>` in the container. Repeatable — pass one per folder. Cannot be combined with `--workspace`/`--empty`; when at least one `--mount` is given, the container's shared workspace root becomes `/workspaces` instead of `/workspaces/<leaf>`.
|
|
34
|
+
|
|
35
|
+
`--context <name>` marks one of the `--mount` folders as shared context (e.g. an AI-context/skills repo): Huddle writes a stub `/workspaces/CLAUDE.md` pointing at it, so an agent working in any of the other mounted repos picks it up as an ancestor file. `<name>` must match a declared `--mount` name; the stub is only written if `/workspaces/CLAUDE.md` doesn't already exist.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
huddle --ide vscode --mount ai=../ai-context-repo --mount backend=../backend-repo --mount frontend=../frontend-repo --context ai --name corpa-dev
|
|
39
|
+
```
|
|
40
|
+
|
|
32
41
|
Default API URL: `http://localhost:3000`. Override it with `--url` or `HUDDLE_URL`.
|
|
33
42
|
|
|
34
43
|
## Experiments
|
|
@@ -59,6 +68,7 @@ Main flags:
|
|
|
59
68
|
```text
|
|
60
69
|
--ide <intellij|rider|vscode>
|
|
61
70
|
--workspace <path>
|
|
71
|
+
--mount <name>=<path> (repeatable)
|
|
62
72
|
--name <name>
|
|
63
73
|
--image <image>
|
|
64
74
|
--empty
|
package/dist/config.js
CHANGED
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CONFIG_DIR = void 0;
|
|
6
7
|
exports.configPath = configPath;
|
|
7
8
|
exports.readConfig = readConfig;
|
|
8
9
|
exports.writeConfig = writeConfig;
|
|
@@ -12,8 +13,8 @@ exports.imageTag = imageTag;
|
|
|
12
13
|
const fs_1 = __importDefault(require("fs"));
|
|
13
14
|
const os_1 = __importDefault(require("os"));
|
|
14
15
|
const path_1 = __importDefault(require("path"));
|
|
15
|
-
|
|
16
|
-
const CONFIG_PATH = path_1.default.join(CONFIG_DIR, 'config.json');
|
|
16
|
+
exports.CONFIG_DIR = path_1.default.join(os_1.default.homedir(), '.huddle');
|
|
17
|
+
const CONFIG_PATH = path_1.default.join(exports.CONFIG_DIR, 'config.json');
|
|
17
18
|
function configPath() {
|
|
18
19
|
return CONFIG_PATH;
|
|
19
20
|
}
|
|
@@ -26,7 +27,7 @@ function readConfig() {
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
function writeConfig(config) {
|
|
29
|
-
fs_1.default.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
30
|
+
fs_1.default.mkdirSync(exports.CONFIG_DIR, { recursive: true });
|
|
30
31
|
fs_1.default.writeFileSync(CONFIG_PATH, `${JSON.stringify(config, null, 2)}\n`);
|
|
31
32
|
}
|
|
32
33
|
/** Operator-token voor API-auth: env wint, anders uit de config. */
|
package/dist/firewall.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.runFirewallList = runFirewallList;
|
|
4
7
|
exports.runFirewallAdd = runFirewallAdd;
|
|
5
8
|
exports.runFirewallDelete = runFirewallDelete;
|
|
9
|
+
exports.runFirewallExport = runFirewallExport;
|
|
10
|
+
exports.runFirewallImport = runFirewallImport;
|
|
11
|
+
exports.runFirewallGroup = runFirewallGroup;
|
|
12
|
+
exports.runFirewallFolder = runFirewallFolder;
|
|
13
|
+
const fs_1 = __importDefault(require("fs"));
|
|
6
14
|
const api_1 = require("./api");
|
|
15
|
+
const config_1 = require("./config");
|
|
7
16
|
const utils_1 = require("./utils");
|
|
8
17
|
async function runFirewallList(opts) {
|
|
9
18
|
const qs = new URLSearchParams({ status: opts.status ?? 'requested' });
|
|
@@ -56,9 +65,9 @@ async function resolveRule(rule, status, scope) {
|
|
|
56
65
|
}
|
|
57
66
|
// Creates a custom firewall rule. Supports wildcards: `*.` in the domain
|
|
58
67
|
// (e.g. `*.pkgs.dev.azure.com`) and `*` in the path pattern (e.g.
|
|
59
|
-
// `/_packaging/*/nuget/v3/*` for an Azure DevOps feed with a
|
|
60
|
-
// GUID). Defaults to 'allow';
|
|
61
|
-
// rule is global.
|
|
68
|
+
// `/_packaging/*/nuget/v3/*` for an Azure DevOps feed with a changing
|
|
69
|
+
// GUID). Defaults to 'allow'; --deny creates a block rule. Without --container
|
|
70
|
+
// the rule is global.
|
|
62
71
|
async function runFirewallAdd(opts) {
|
|
63
72
|
const domain = (opts.domain ?? '').trim();
|
|
64
73
|
if (!domain) {
|
|
@@ -135,3 +144,155 @@ function printRulesTable(rules) {
|
|
|
135
144
|
function formatTarget(rule) {
|
|
136
145
|
return rule.path_pattern ? `${rule.domain}${rule.path_pattern}` : rule.domain;
|
|
137
146
|
}
|
|
147
|
+
async function runFirewallExport(opts) {
|
|
148
|
+
const qs = new URLSearchParams();
|
|
149
|
+
if (opts.container)
|
|
150
|
+
qs.set('container', opts.container);
|
|
151
|
+
const suffix = qs.toString() ? `?${qs}` : '';
|
|
152
|
+
const doc = await (0, api_1.get)(`/api/rules/export${suffix}`);
|
|
153
|
+
const json = JSON.stringify(doc, null, 2);
|
|
154
|
+
if (opts.out) {
|
|
155
|
+
fs_1.default.writeFileSync(opts.out, `${json}\n`);
|
|
156
|
+
// Progress to stderr so a pure `--out` run leaks nothing to stdout.
|
|
157
|
+
console.error((0, utils_1.green)(`[OK] Exported ${doc.rules.length} rule(s) to ${opts.out}`));
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
console.log(json);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// Read + JSON-parse a file with uniform, actionable errors. Shared by both
|
|
164
|
+
// import paths (flat rules and groups).
|
|
165
|
+
function readJsonFile(file) {
|
|
166
|
+
let raw;
|
|
167
|
+
try {
|
|
168
|
+
raw = fs_1.default.readFileSync(file, 'utf8');
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
throw new Error(`Cannot read ${file}`);
|
|
172
|
+
}
|
|
173
|
+
try {
|
|
174
|
+
return JSON.parse(raw);
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
throw new Error(`${file} is not valid JSON`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async function runFirewallImport(opts) {
|
|
181
|
+
const doc = readJsonFile(opts.file);
|
|
182
|
+
const mode = opts.replace ? 'replace' : 'merge';
|
|
183
|
+
const qs = new URLSearchParams();
|
|
184
|
+
if (opts.container)
|
|
185
|
+
qs.set('container', opts.container);
|
|
186
|
+
const suffix = qs.toString() ? `?${qs}` : '';
|
|
187
|
+
const res = await (0, api_1.post)(`/api/rules/import${suffix}`, { mode, rules: doc.rules });
|
|
188
|
+
console.error((0, utils_1.green)(`[OK] Imported (${mode}): ${res.imported} added, ${res.updated} updated, ${res.skipped} skipped`));
|
|
189
|
+
}
|
|
190
|
+
async function resolveGroupByName(name) {
|
|
191
|
+
const groups = await (0, api_1.get)('/api/groups');
|
|
192
|
+
const match = groups.filter((g) => g.name.toLowerCase() === name.toLowerCase());
|
|
193
|
+
if (match.length === 0)
|
|
194
|
+
throw new Error(`No group named "${name}". Run \`huddle firewall group list\`.`);
|
|
195
|
+
return match[0];
|
|
196
|
+
}
|
|
197
|
+
async function runFirewallGroup(opts) {
|
|
198
|
+
const action = opts.action ?? 'list';
|
|
199
|
+
if (action === 'list') {
|
|
200
|
+
const groups = await (0, api_1.get)('/api/groups');
|
|
201
|
+
if (groups.length === 0) {
|
|
202
|
+
console.log((0, utils_1.dim)('No firewall groups yet.'));
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const headers = ['ID', 'Name', 'Rules', 'Shared', 'Source'];
|
|
206
|
+
const rows = groups.map((g) => [String(g.id), g.name, String(g.rule_count), g.shared ? 'yes' : 'no', g.source]);
|
|
207
|
+
(0, utils_1.printTable)(headers, rows);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
if (action === 'export') {
|
|
211
|
+
const name = (opts.arg ?? '').trim();
|
|
212
|
+
if (!name)
|
|
213
|
+
throw new Error('Usage: huddle firewall group export <name> [--out <file>]');
|
|
214
|
+
const g = await resolveGroupByName(name);
|
|
215
|
+
const env = await (0, api_1.get)(`/api/groups/${g.id}/export`);
|
|
216
|
+
const json = JSON.stringify(env, null, 2);
|
|
217
|
+
if (opts.out) {
|
|
218
|
+
fs_1.default.writeFileSync(opts.out, `${json}\n`);
|
|
219
|
+
console.error((0, utils_1.green)(`[OK] Exported group "${g.name}" to ${opts.out}`));
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
console.log(json);
|
|
223
|
+
}
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (action === 'import') {
|
|
227
|
+
const file = (opts.arg ?? '').trim();
|
|
228
|
+
if (!file)
|
|
229
|
+
throw new Error('Usage: huddle firewall group import <file> [--replace]');
|
|
230
|
+
const envelope = readJsonFile(file);
|
|
231
|
+
const mode = opts.replace ? 'replace' : 'merge';
|
|
232
|
+
const res = await (0, api_1.post)('/api/groups/import', { mode, envelope });
|
|
233
|
+
console.error((0, utils_1.green)(`[OK] Imported group "${res.group.name}" (${mode}): ${res.imported} added, ${res.updated} updated, ${res.skipped} skipped`));
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (action === 'apply') {
|
|
237
|
+
const name = (opts.arg ?? '').trim();
|
|
238
|
+
if (!name)
|
|
239
|
+
throw new Error('Usage: huddle firewall group apply <name> [--container <id>]');
|
|
240
|
+
const g = await resolveGroupByName(name);
|
|
241
|
+
const container = opts.container ?? null;
|
|
242
|
+
const res = await (0, api_1.post)(`/api/groups/${g.id}/apply`, { container });
|
|
243
|
+
const scope = container ? `container ${container}` : 'global';
|
|
244
|
+
console.log((0, utils_1.green)(`[OK] Applied "${g.name}" to ${scope}: ${res.applied} added, ${res.updated} updated`));
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
throw new Error(`Unknown group action: ${action}. Use list | export | import | apply.`);
|
|
248
|
+
}
|
|
249
|
+
async function runFirewallFolder(opts) {
|
|
250
|
+
const action = opts.action ?? 'show';
|
|
251
|
+
if (action === 'show') {
|
|
252
|
+
// The CLI config is the source of truth for the path.
|
|
253
|
+
const folder = (0, config_1.readConfig)().firewallRulesFolder;
|
|
254
|
+
console.log(folder ? folder : (0, utils_1.dim)('(no firewall rules folder configured)'));
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (action === 'set') {
|
|
258
|
+
const path = (opts.path ?? '').trim();
|
|
259
|
+
if (!path)
|
|
260
|
+
throw new Error('Usage: huddle firewall folder set <path>');
|
|
261
|
+
// Config-only: the gateway reads the folder at the fixed mount point the CLI
|
|
262
|
+
// binds it to; there is no DB setting. Persist here and mount on restart.
|
|
263
|
+
(0, config_1.writeConfig)({ ...(0, config_1.readConfig)(), firewallRulesFolder: path });
|
|
264
|
+
console.log((0, utils_1.green)(`[OK] Firewall rules folder set to ${(0, utils_1.cyan)(path)}`));
|
|
265
|
+
console.log((0, utils_1.dim)(' Run `huddle restart` to mount it into the gateway; it is then read on start & reload.'));
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (action === 'reload') {
|
|
269
|
+
const res = await (0, api_1.post)('/api/firewall-rules-folder/reload', {});
|
|
270
|
+
if (!res.mounted) {
|
|
271
|
+
console.log((0, utils_1.dim)('No firewall rules folder mounted. Set one with `huddle firewall folder set <path>` and run `huddle restart`.'));
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
console.log((0, utils_1.green)(`[OK] Reloaded: ${res.groups} group(s), ${res.imported} rule(s), ${res.errors.length} error(s)`));
|
|
275
|
+
for (const e of res.errors)
|
|
276
|
+
console.error((0, utils_1.red)(` [!] ${e.file}: ${e.message}`));
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (action === 'sync') {
|
|
280
|
+
// Write the portal's groups back out to the folder (app → files).
|
|
281
|
+
const res = await (0, api_1.post)('/api/firewall-rules-folder/sync', {});
|
|
282
|
+
if (!res.mounted) {
|
|
283
|
+
console.log((0, utils_1.dim)('No firewall rules folder mounted. Set one with `huddle firewall folder set <path>` and run `huddle restart`.'));
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (res.written === 0 && res.errors.length > 0) {
|
|
287
|
+
console.error((0, utils_1.red)('[!] Could not write to the folder — it may still be mounted read-only. Run `huddle restart` to remount it writable.'));
|
|
288
|
+
for (const e of res.errors)
|
|
289
|
+
console.error((0, utils_1.red)(` [!] ${e.file}: ${e.message}`));
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
console.log((0, utils_1.green)(`[OK] Synced: ${res.written} group(s) written, ${res.pruned} stale file(s) removed, ${res.errors.length} error(s)`));
|
|
293
|
+
for (const e of res.errors)
|
|
294
|
+
console.error((0, utils_1.red)(` [!] ${e.file}: ${e.message}`));
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
throw new Error(`Unknown folder action: ${action}. Use show | set | reload | sync.`);
|
|
298
|
+
}
|
package/dist/images.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveImages = resolveImages;
|
|
4
|
-
exports.
|
|
4
|
+
exports.gatewayEnvArgs = gatewayEnvArgs;
|
|
5
5
|
const config_1 = require("./config");
|
|
6
6
|
function resolveImages() {
|
|
7
7
|
const experiment = (0, config_1.activeExperiment)();
|
|
@@ -19,13 +19,17 @@ function resolveImages() {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* `-e`
|
|
23
|
-
* explicit override) the gateway must start devcontainers from the same
|
|
24
|
-
* base images the CLI just pulled.
|
|
22
|
+
* `-e KEY=val` argv pairs for the gateway container. During an experiment (or
|
|
23
|
+
* with an explicit override) the gateway must start devcontainers from the same
|
|
24
|
+
* base images the CLI just pulled. Returned as an argv array (not a shell
|
|
25
|
+
* string) so init can spawn `docker run` without a shell.
|
|
25
26
|
*/
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
function gatewayEnvArgs(resolved) {
|
|
28
|
+
const args = [];
|
|
29
|
+
for (const b of resolved.baseImages) {
|
|
30
|
+
if (b.gatewayEnv && (resolved.experiment !== undefined || process.env[b.gatewayEnv])) {
|
|
31
|
+
args.push('-e', `${b.gatewayEnv}=${b.image}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return args;
|
|
31
35
|
}
|
package/dist/index.js
CHANGED
|
@@ -15,12 +15,13 @@ const images_1 = require("./images");
|
|
|
15
15
|
const self_update_1 = require("./self-update");
|
|
16
16
|
const utils_1 = require("./utils");
|
|
17
17
|
const experiment_1 = require("./experiment");
|
|
18
|
-
const VALUE_FLAGS = new Set(['url', 'ide', 'name', 'image', 'workspace', 'container', 'status', 'runtime', 'experiment', 'path', 'ca-path', 'output']);
|
|
19
|
-
const BOOLEAN_FLAGS = new Set(['help', 'h', 'empty', 'i', 'interactive', 'version', 'v', 'deny', 'docker-socket', 'force']);
|
|
20
|
-
const COMMANDS = new Set(['start', 'firewall', 'fw', 'init', 'experiment', 'migrate', 'help', 'version']);
|
|
18
|
+
const VALUE_FLAGS = new Set(['url', 'ide', 'name', 'image', 'workspace', 'container', 'status', 'runtime', 'experiment', 'path', 'ca-path', 'output', 'out', 'workspace-root']);
|
|
19
|
+
const BOOLEAN_FLAGS = new Set(['help', 'h', 'empty', 'i', 'interactive', 'version', 'v', 'deny', 'docker-socket', 'force', 'replace']);
|
|
20
|
+
const COMMANDS = new Set(['start', 'firewall', 'fw', 'init', 'restart', 'experiment', 'migrate', 'help', 'version']);
|
|
21
21
|
function parseArgs(argv) {
|
|
22
22
|
const positional = [];
|
|
23
23
|
const flags = {};
|
|
24
|
+
const mounts = [];
|
|
24
25
|
for (let i = 0; i < argv.length; i++) {
|
|
25
26
|
const arg = argv[i];
|
|
26
27
|
if (arg === '--') {
|
|
@@ -33,6 +34,23 @@ function parseArgs(argv) {
|
|
|
33
34
|
const name = eq >= 0 ? raw.slice(0, eq) : raw;
|
|
34
35
|
if (!name)
|
|
35
36
|
throw new Error(`Invalid option: ${arg}`);
|
|
37
|
+
// Repeatable, unlike every other value flag (one `--mount host=container` per folder).
|
|
38
|
+
if (name === 'mount') {
|
|
39
|
+
let value;
|
|
40
|
+
if (eq >= 0) {
|
|
41
|
+
value = raw.slice(eq + 1);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const next = argv[i + 1];
|
|
45
|
+
if (next === undefined || next.startsWith('-')) {
|
|
46
|
+
throw new Error('Option --mount expects a value (host=container)');
|
|
47
|
+
}
|
|
48
|
+
value = next;
|
|
49
|
+
i++;
|
|
50
|
+
}
|
|
51
|
+
mounts.push(value);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
36
54
|
if (eq >= 0) {
|
|
37
55
|
flags[name] = raw.slice(eq + 1);
|
|
38
56
|
}
|
|
@@ -70,7 +88,13 @@ function parseArgs(argv) {
|
|
|
70
88
|
}
|
|
71
89
|
positional.push(arg);
|
|
72
90
|
}
|
|
73
|
-
return { positional, flags };
|
|
91
|
+
return { positional, flags, mounts };
|
|
92
|
+
}
|
|
93
|
+
function parseMountFlag(raw) {
|
|
94
|
+
const eq = raw.indexOf('=');
|
|
95
|
+
if (eq <= 0)
|
|
96
|
+
throw new Error(`Invalid --mount value "${raw}", expected host=container`);
|
|
97
|
+
return { hostPath: raw.slice(0, eq), containerPath: raw.slice(eq + 1) };
|
|
74
98
|
}
|
|
75
99
|
function readVersion() {
|
|
76
100
|
// npm always includes package.json in the published tarball, and it holds the
|
|
@@ -94,6 +118,8 @@ Usage:
|
|
|
94
118
|
huddle start [options] [folder] Explicitly start a devcontainer
|
|
95
119
|
huddle init [options] Pull the Huddle + devcontainer base images and
|
|
96
120
|
start them via Docker or Podman
|
|
121
|
+
huddle restart Recreate the gateway (e.g. to mount a changed
|
|
122
|
+
team firewall-rules folder)
|
|
97
123
|
huddle migrate [folder] Wire an existing docker-compose devcontainer
|
|
98
124
|
behind Huddle by generating an override file
|
|
99
125
|
huddle firewall list [options] Show firewall requests
|
|
@@ -102,13 +128,22 @@ Usage:
|
|
|
102
128
|
supported: *.example.com and /path/*)
|
|
103
129
|
huddle firewall delete <id> Delete a firewall rule by id (or domain;
|
|
104
130
|
narrow with --container)
|
|
131
|
+
huddle firewall export [options] Export firewall rules as JSON
|
|
132
|
+
huddle firewall import <file> Import firewall rules from a JSON file
|
|
133
|
+
huddle firewall group list List firewall groups (#69)
|
|
134
|
+
huddle firewall group export <name> Export a group as JSON (--out <file>)
|
|
135
|
+
huddle firewall group import <file> Import a group (--replace to mirror)
|
|
136
|
+
huddle firewall group apply <name> Apply a group (--container <id> or global)
|
|
137
|
+
huddle firewall folder set <path> Set the team-managed rules folder
|
|
138
|
+
huddle firewall folder reload Re-read the team-managed rules folder
|
|
139
|
+
huddle firewall folder sync Write the portal's groups back to the folder
|
|
105
140
|
huddle experiment use <nr> Activate the experimental build of issue/PR <nr>
|
|
106
141
|
and run init
|
|
107
142
|
huddle experiment reset Back to the stable release
|
|
108
143
|
huddle experiment status Show the active channel and CLI version
|
|
109
144
|
|
|
110
145
|
Init options:
|
|
111
|
-
--runtime <docker|podman
|
|
146
|
+
--runtime <docker|podman> Container runtime (default: auto-detected;
|
|
112
147
|
also via the HUDDLE_RUNTIME env var)
|
|
113
148
|
--experiment <nr> Use the experimental build of issue/PR <nr>
|
|
114
149
|
(same as "huddle experiment use <nr>")
|
|
@@ -116,6 +151,11 @@ Init options:
|
|
|
116
151
|
Start options:
|
|
117
152
|
--ide <intellij|rider|vscode> IDE (default: intellij)
|
|
118
153
|
--workspace <path> Workspace directory (default: current directory)
|
|
154
|
+
--mount <host>=<container> Mount a host folder at an absolute container path, e.g.
|
|
155
|
+
C:/projects/my-repo/backend=/workspace/backend
|
|
156
|
+
(repeatable; cannot combine with --workspace/--empty)
|
|
157
|
+
--workspace-root <path> Container path the IDE opens as project root when using
|
|
158
|
+
--mount (default: common parent of the mount targets)
|
|
119
159
|
--name <name> Container name (default: devcontainer-<foldername>)
|
|
120
160
|
--image <image> Use a specific image
|
|
121
161
|
--empty Empty container without a workspace
|
|
@@ -132,6 +172,8 @@ Migrate options:
|
|
|
132
172
|
Firewall options:
|
|
133
173
|
-i, --interactive Interactively approve/deny (list)
|
|
134
174
|
--container <name> Filter by (list) / scope to (add) a container
|
|
175
|
+
(or __global__). On import: remap all rules
|
|
176
|
+
to this scope
|
|
135
177
|
--status <requested|allow|deny> Filter by status (default: requested)
|
|
136
178
|
|
|
137
179
|
Firewall add options:
|
|
@@ -140,6 +182,11 @@ Firewall add options:
|
|
|
140
182
|
(e.g. /_packaging/*/nuget/v3/*)
|
|
141
183
|
--deny Create a block rule (default: allow)
|
|
142
184
|
|
|
185
|
+
Firewall export/import options:
|
|
186
|
+
--out <file> Write export to a file (default: stdout)
|
|
187
|
+
--replace Import in replace mode: wipe the target
|
|
188
|
+
scope first (default: merge/upsert)
|
|
189
|
+
|
|
143
190
|
Global options:
|
|
144
191
|
--url <url> Huddle URL (default: http://localhost:3000)
|
|
145
192
|
Or via the HUDDLE_URL env var
|
|
@@ -158,7 +205,7 @@ async function main() {
|
|
|
158
205
|
console.error('Run "huddle --help" for help.');
|
|
159
206
|
process.exit(1);
|
|
160
207
|
}
|
|
161
|
-
const { positional, flags } = parsed;
|
|
208
|
+
const { positional, flags, mounts } = parsed;
|
|
162
209
|
const [cmd, sub] = positional;
|
|
163
210
|
if (flagBool(flags, 'version', 'v') || cmd === 'version') {
|
|
164
211
|
console.log(readVersion());
|
|
@@ -179,6 +226,8 @@ async function main() {
|
|
|
179
226
|
await (0, start_1.runStart)({
|
|
180
227
|
ide: flagString(flags, 'ide') ?? 'intellij',
|
|
181
228
|
workspace: flagString(flags, 'workspace') ?? startArgs[0],
|
|
229
|
+
mounts: mounts.length ? mounts.map(parseMountFlag) : undefined,
|
|
230
|
+
workspaceRoot: flagString(flags, 'workspace-root'),
|
|
182
231
|
name: flagString(flags, 'name'),
|
|
183
232
|
image: flagString(flags, 'image'),
|
|
184
233
|
empty: flagBool(flags, 'empty'),
|
|
@@ -202,6 +251,15 @@ async function main() {
|
|
|
202
251
|
await (0, init_1.runInit)(initOpts, (0, images_1.resolveImages)());
|
|
203
252
|
return;
|
|
204
253
|
}
|
|
254
|
+
if (cmd === 'restart') {
|
|
255
|
+
// Stop + recreate the gateway (runInit does `rm -f` first) so changed team
|
|
256
|
+
// folders get mounted. The portal writes the paths straight into the mounted
|
|
257
|
+
// ~/.huddle/config.json, so runInit already reads the latest values here.
|
|
258
|
+
const initOpts = { runtime: flagString(flags, 'runtime') };
|
|
259
|
+
(0, experiment_1.ensureCliForChannel)(process.argv.slice(2));
|
|
260
|
+
await (0, init_1.runInit)(initOpts, (0, images_1.resolveImages)());
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
205
263
|
if (cmd === 'experiment') {
|
|
206
264
|
const subCmd = sub ?? 'status';
|
|
207
265
|
if (subCmd === 'use') {
|
|
@@ -243,6 +301,36 @@ async function main() {
|
|
|
243
301
|
container: flagString(flags, 'container'),
|
|
244
302
|
});
|
|
245
303
|
}
|
|
304
|
+
else if (subCmd === 'export') {
|
|
305
|
+
await (0, firewall_1.runFirewallExport)({
|
|
306
|
+
container: flagString(flags, 'container'),
|
|
307
|
+
out: flagString(flags, 'out'),
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
else if (subCmd === 'import') {
|
|
311
|
+
const file = positional[2];
|
|
312
|
+
if (!file) {
|
|
313
|
+
console.error('Usage: huddle firewall import <file> [--replace] [--container <id>]');
|
|
314
|
+
process.exit(1);
|
|
315
|
+
}
|
|
316
|
+
await (0, firewall_1.runFirewallImport)({
|
|
317
|
+
file,
|
|
318
|
+
replace: flagBool(flags, 'replace'),
|
|
319
|
+
container: flagString(flags, 'container'),
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
else if (subCmd === 'group' || subCmd === 'groups') {
|
|
323
|
+
await (0, firewall_1.runFirewallGroup)({
|
|
324
|
+
action: positional[2],
|
|
325
|
+
arg: positional[3],
|
|
326
|
+
out: flagString(flags, 'out'),
|
|
327
|
+
replace: flagBool(flags, 'replace'),
|
|
328
|
+
container: flagString(flags, 'container'),
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
else if (subCmd === 'folder') {
|
|
332
|
+
await (0, firewall_1.runFirewallFolder)({ action: positional[2], path: positional[3] });
|
|
333
|
+
}
|
|
246
334
|
else {
|
|
247
335
|
console.error(`Unknown firewall subcommand: ${subCmd}`);
|
|
248
336
|
process.exit(1);
|
package/dist/init.js
CHANGED
|
@@ -29,12 +29,16 @@ exports.INTERNAL_NET = 'devcontainer-net';
|
|
|
29
29
|
*/
|
|
30
30
|
exports.HOST_SOCKET_DIR = '/tmp/dc-sockets';
|
|
31
31
|
const HOST_PORT = process.env.HUDDLE_PORT ?? '3000';
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
// Run a binary with an argv array — NO shell. Values that originate from config
|
|
33
|
+
// (team-folder paths, which are writable via `huddle firewall folder set` and the
|
|
34
|
+
// authenticated settings API) must never be interpolated into a shell string, or
|
|
35
|
+
// a path containing `$()`/quotes would execute on the host. Used for `docker run`.
|
|
36
|
+
function runArgs(file, args) {
|
|
37
|
+
(0, child_process_1.execFileSync)(file, args, { stdio: 'inherit' });
|
|
34
38
|
}
|
|
35
|
-
function
|
|
39
|
+
function runArgsSilent(file, args) {
|
|
36
40
|
try {
|
|
37
|
-
(0, child_process_1.
|
|
41
|
+
(0, child_process_1.execFileSync)(file, args, { stdio: 'ignore' });
|
|
38
42
|
return true;
|
|
39
43
|
}
|
|
40
44
|
catch {
|
|
@@ -52,7 +56,7 @@ function pullBaseImages(rt, images) {
|
|
|
52
56
|
for (const image of images) {
|
|
53
57
|
console.log((0, utils_1.dim)(` Pulling ${image}`));
|
|
54
58
|
try {
|
|
55
|
-
|
|
59
|
+
runArgs(rt, ['pull', image]);
|
|
56
60
|
}
|
|
57
61
|
catch {
|
|
58
62
|
failed.push(image);
|
|
@@ -82,15 +86,15 @@ async function runInit(opts, images) {
|
|
|
82
86
|
}
|
|
83
87
|
else {
|
|
84
88
|
console.log((0, utils_1.dim)(`Pulling ${IMAGE}`));
|
|
85
|
-
|
|
89
|
+
runArgs(rt, ['pull', IMAGE]);
|
|
86
90
|
pullBaseImages(rt, images.baseImages.map((b) => b.image));
|
|
87
91
|
}
|
|
88
92
|
console.log((0, utils_1.dim)(`Volume: ${VOLUME}`));
|
|
89
|
-
|
|
93
|
+
runArgsSilent(rt, ['volume', 'inspect', VOLUME]) || runArgs(rt, ['volume', 'create', VOLUME]);
|
|
90
94
|
console.log((0, utils_1.dim)(`Network: ${exports.INTERNAL_NET}`));
|
|
91
|
-
|
|
95
|
+
runArgsSilent(rt, ['network', 'inspect', exports.INTERNAL_NET]) || runArgs(rt, ['network', 'create', '--internal', exports.INTERNAL_NET]);
|
|
92
96
|
console.log((0, utils_1.dim)(`Removing old container if it exists`));
|
|
93
|
-
|
|
97
|
+
runArgsSilent(rt, ['rm', '-f', CONTAINER]);
|
|
94
98
|
console.log((0, utils_1.dim)(`Socket directory: /tmp/dc-sockets`));
|
|
95
99
|
// The mount SOURCE must be the path on the Docker ENGINE host (on Windows:
|
|
96
100
|
// the WSL2/Linux VM), even when the CLI itself runs on Windows. The gateway
|
|
@@ -105,7 +109,7 @@ async function runInit(opts, images) {
|
|
|
105
109
|
// Desktop) and fails with "statfs: no such file or directory". So create
|
|
106
110
|
// the directory explicitly in the machine VM; the socket lives there too.
|
|
107
111
|
console.log((0, utils_1.dim)(` (Podman: creating ${hostTmpSockets} in the machine VM)`));
|
|
108
|
-
if (!
|
|
112
|
+
if (!runArgsSilent('podman', ['machine', 'ssh', `mkdir -p ${hostTmpSockets}`])) {
|
|
109
113
|
console.log((0, utils_1.yellow)(`[!] Could not create ${hostTmpSockets} in the Podman VM.`));
|
|
110
114
|
}
|
|
111
115
|
}
|
|
@@ -126,8 +130,7 @@ async function runInit(opts, images) {
|
|
|
126
130
|
// The gateway is engine-agnostic (talks the Docker-compatible API on the
|
|
127
131
|
// mounted socket), but does need to know it's Podman: it then sets
|
|
128
132
|
// `--security-opt label=disable` on every devcontainer so it can reach the
|
|
129
|
-
// SELinux-labeled proxy socket.
|
|
130
|
-
const securityOptFlags = runtime.securityOpts.map((opt) => ` --security-opt ${opt}`).join('');
|
|
133
|
+
// SELinux-labeled proxy socket. (Applied as argv below via runtime.securityOpts.)
|
|
131
134
|
// Operator token for control-plane auth. Reuse the token from the config (so an
|
|
132
135
|
// existing browser session/CLI keeps working across re-inits), otherwise
|
|
133
136
|
// generate one. We pass it to the gateway via env AND store it locally so that
|
|
@@ -145,23 +148,43 @@ async function runInit(opts, images) {
|
|
|
145
148
|
// network (moby/moby#36174). Which source IP the gateway sees for forwarded
|
|
146
149
|
// traffic no longer matters — the control plane authenticates with the
|
|
147
150
|
// operator token instead of source-IP filtering.
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
` -
|
|
158
|
-
|
|
159
|
-
` ${
|
|
151
|
+
// Team-managed folders (#69). Bind the CLI config dir (~/.huddle) read-write so
|
|
152
|
+
// the gateway/portal read and write the folder paths there (config.json is the
|
|
153
|
+
// single source of truth), then bind each configured team folder to a FIXED
|
|
154
|
+
// path so the gateway reads it without knowing the host path. The firewall-rules
|
|
155
|
+
// folder is bound read-write so the portal's "Sync to folder" can write the
|
|
156
|
+
// groups back out; extensions stay read-only (loaded, never written).
|
|
157
|
+
const fwFolder = cfg.firewallRulesFolder?.trim();
|
|
158
|
+
const extFolder = cfg.extensionsFolder?.trim();
|
|
159
|
+
if (fwFolder)
|
|
160
|
+
console.log((0, utils_1.dim)(` Mounting firewall-rules folder: ${fwFolder} -> /firewall-rules`));
|
|
161
|
+
if (extFolder)
|
|
162
|
+
console.log((0, utils_1.dim)(` Mounting extensions folder: ${extFolder} -> /extensions`));
|
|
163
|
+
// Build the container command as an argv array (runArgs → execFileSync, no
|
|
164
|
+
// shell). The folder paths below come from config and are operator-writable via
|
|
165
|
+
// the settings API, so they must never reach a shell as a string.
|
|
166
|
+
const dockerArgs = ['run', '-d', '--name', CONTAINER, '--network', runtime.defaultNetwork];
|
|
167
|
+
for (const opt of runtime.securityOpts)
|
|
168
|
+
dockerArgs.push('--security-opt', opt);
|
|
169
|
+
dockerArgs.push('-e', `HUDDLE_RUNTIME=${runtime.name}`);
|
|
170
|
+
dockerArgs.push('-e', `HUDDLE_OPERATOR_TOKEN=${operatorToken}`);
|
|
171
|
+
dockerArgs.push('-p', `${HOST_PORT}:3000`);
|
|
172
|
+
dockerArgs.push('-v', `${VOLUME}:/data`);
|
|
173
|
+
dockerArgs.push('-v', `${runtime.socketPath}:/var/run/docker.sock`);
|
|
174
|
+
dockerArgs.push('-v', `${hostTmpSockets}:/tmp/dc-sockets`);
|
|
175
|
+
dockerArgs.push('-v', `${config_1.CONFIG_DIR}:/huddle-home:rw`, '-e', 'HUDDLE_HOME_DIR=/huddle-home');
|
|
176
|
+
if (fwFolder)
|
|
177
|
+
dockerArgs.push('-v', `${fwFolder}:/firewall-rules:rw`);
|
|
178
|
+
if (extFolder)
|
|
179
|
+
dockerArgs.push('-v', `${extFolder}:/extensions:ro`);
|
|
180
|
+
dockerArgs.push(...(0, images_1.gatewayEnvArgs)(images));
|
|
181
|
+
dockerArgs.push(IMAGE);
|
|
182
|
+
runArgs(rt, dockerArgs);
|
|
160
183
|
// Attaching devcontainer-net after the container has started pollutes
|
|
161
184
|
// resolv.conf on Podman with that network's internal aardvark-DNS; the
|
|
162
185
|
// gateway cleans that up itself (see dns-egress.ts / the startup sanitize in
|
|
163
186
|
// index.ts).
|
|
164
|
-
|
|
187
|
+
runArgsSilent(rt, ['network', 'connect', exports.INTERNAL_NET, CONTAINER]);
|
|
165
188
|
console.log();
|
|
166
189
|
console.log((0, utils_1.green)(`[OK] Huddle is running at http://localhost:${HOST_PORT}`));
|
|
167
190
|
console.log();
|
package/dist/runtime.js
CHANGED
|
@@ -14,11 +14,8 @@ function commandOutput(cmd) {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
function isAvailable(runtime) {
|
|
17
|
-
// 'info' only succeeds if the daemon/machine is actually reachable.
|
|
18
|
-
|
|
19
|
-
// 'list' there instead — it equally requires a reachable daemon to succeed.
|
|
20
|
-
const probe = runtime === 'wslc' ? 'list' : 'info';
|
|
21
|
-
return commandOutput(`${runtime} ${probe}`) !== undefined;
|
|
17
|
+
// 'info' only succeeds if the daemon/machine is actually reachable.
|
|
18
|
+
return commandOutput(`${runtime} info`) !== undefined;
|
|
22
19
|
}
|
|
23
20
|
/**
|
|
24
21
|
* Determines the REAL engine behind a command, or undefined if the engine is
|
|
@@ -33,7 +30,7 @@ function detectEngine(command) {
|
|
|
33
30
|
return 'podman';
|
|
34
31
|
}
|
|
35
32
|
if (isAvailable(command))
|
|
36
|
-
return
|
|
33
|
+
return 'docker';
|
|
37
34
|
return undefined;
|
|
38
35
|
}
|
|
39
36
|
function podmanSocketPath() {
|
|
@@ -133,14 +130,14 @@ function buildRuntime(name) {
|
|
|
133
130
|
}
|
|
134
131
|
function parseRuntimeName(value) {
|
|
135
132
|
const normalized = value.toLowerCase().trim();
|
|
136
|
-
if (normalized === 'docker' || normalized === 'podman'
|
|
133
|
+
if (normalized === 'docker' || normalized === 'podman')
|
|
137
134
|
return normalized;
|
|
138
|
-
throw new Error(`Unknown container runtime: ${value}. Choose docker
|
|
135
|
+
throw new Error(`Unknown container runtime: ${value}. Choose docker or podman.`);
|
|
139
136
|
}
|
|
140
137
|
/**
|
|
141
138
|
* Determines which container runtime to use.
|
|
142
139
|
* An explicit choice (via --runtime or HUDDLE_RUNTIME) wins; otherwise it is
|
|
143
|
-
* auto-detected: Docker first, then Podman
|
|
140
|
+
* auto-detected: Docker first, then Podman.
|
|
144
141
|
*/
|
|
145
142
|
function resolveRuntime(explicit) {
|
|
146
143
|
const requested = explicit ?? process.env.HUDDLE_RUNTIME;
|
|
@@ -151,13 +148,12 @@ function resolveRuntime(explicit) {
|
|
|
151
148
|
}
|
|
152
149
|
return buildRuntime(name);
|
|
153
150
|
}
|
|
154
|
-
// Auto-detection: first look behind the docker command (which may be a
|
|
155
|
-
// Podman shim
|
|
156
|
-
//
|
|
157
|
-
|
|
158
|
-
const detected = detectEngine('docker') ?? detectEngine('podman') ?? detectEngine('wslc');
|
|
151
|
+
// Auto-detection: first look behind the `docker` command (which may be a
|
|
152
|
+
// Podman shim), then at `podman`. This way a real Docker engine wins if there
|
|
153
|
+
// is one, but we also recognize Podman when it poses as `docker`.
|
|
154
|
+
const detected = detectEngine('docker') ?? detectEngine('podman');
|
|
159
155
|
if (detected)
|
|
160
156
|
return buildRuntime(detected);
|
|
161
|
-
throw new Error('No working container runtime found. Install and start Docker
|
|
162
|
-
'or pick one explicitly with --runtime <docker|podman
|
|
157
|
+
throw new Error('No working container runtime found. Install and start Docker or Podman,\n' +
|
|
158
|
+
'or pick one explicitly with --runtime <docker|podman> or the HUDDLE_RUNTIME env var.');
|
|
163
159
|
}
|
package/dist/start.js
CHANGED
|
@@ -10,12 +10,47 @@ const api_1 = require("./api");
|
|
|
10
10
|
const utils_1 = require("./utils");
|
|
11
11
|
async function runStart(opts) {
|
|
12
12
|
const ide = parseIde(opts.ide);
|
|
13
|
-
const
|
|
14
|
-
|
|
13
|
+
const hasMounts = !!opts.mounts && opts.mounts.length > 0;
|
|
14
|
+
if (hasMounts && opts.workspace) {
|
|
15
|
+
throw new Error('Cannot combine --workspace with --mount; use --mount for every folder instead.');
|
|
16
|
+
}
|
|
17
|
+
if (hasMounts && opts.empty) {
|
|
18
|
+
throw new Error('Cannot combine --empty with --mount.');
|
|
19
|
+
}
|
|
20
|
+
const resolvedMounts = hasMounts
|
|
21
|
+
? opts.mounts.map((m) => ({ hostPath: resolveWorkspace(m.hostPath), containerPath: validateContainerPath(m.containerPath) }))
|
|
22
|
+
: undefined;
|
|
23
|
+
if (resolvedMounts) {
|
|
24
|
+
const seen = new Set();
|
|
25
|
+
for (const m of resolvedMounts) {
|
|
26
|
+
if (seen.has(m.containerPath))
|
|
27
|
+
throw new Error(`Duplicate --mount container path: ${m.containerPath}`);
|
|
28
|
+
seen.add(m.containerPath);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const workspaceRoot = opts.workspaceRoot?.trim() || undefined;
|
|
32
|
+
if (workspaceRoot && !hasMounts) {
|
|
33
|
+
throw new Error('--workspace-root requires at least one --mount.');
|
|
34
|
+
}
|
|
35
|
+
if (workspaceRoot && !workspaceRoot.startsWith('/')) {
|
|
36
|
+
throw new Error(`--workspace-root must be an absolute container path: "${workspaceRoot}".`);
|
|
37
|
+
}
|
|
38
|
+
const workspaceDir = opts.empty || hasMounts ? undefined : resolveWorkspace(opts.workspace);
|
|
39
|
+
const baseName = opts.empty
|
|
40
|
+
? 'empty'
|
|
41
|
+
: hasMounts
|
|
42
|
+
? (resolvedMounts[0].containerPath.split('/').filter(Boolean).pop() ?? 'workspace')
|
|
43
|
+
: path_1.default.basename(workspaceDir);
|
|
15
44
|
const containerName = opts.name ? validateContainerName(opts.name) : defaultContainerName(baseName);
|
|
16
45
|
console.log(`Starting ${(0, utils_1.bold)(containerName)} with ${(0, utils_1.bold)(ide)}...`);
|
|
17
46
|
if (workspaceDir)
|
|
18
47
|
console.log((0, utils_1.dim)(`Workspace: ${workspaceDir}`));
|
|
48
|
+
if (resolvedMounts) {
|
|
49
|
+
for (const m of resolvedMounts)
|
|
50
|
+
console.log((0, utils_1.dim)(`Mount ${m.hostPath} -> ${m.containerPath}`));
|
|
51
|
+
if (workspaceRoot)
|
|
52
|
+
console.log((0, utils_1.dim)(`Open IDE at: ${workspaceRoot}`));
|
|
53
|
+
}
|
|
19
54
|
let imageName = opts.image;
|
|
20
55
|
if (!imageName) {
|
|
21
56
|
const res = await (0, api_1.get)(`/api/docker/base-image?ide=${encodeURIComponent(ide)}`);
|
|
@@ -30,6 +65,11 @@ async function runStart(opts) {
|
|
|
30
65
|
if (opts.empty) {
|
|
31
66
|
body.empty = true;
|
|
32
67
|
}
|
|
68
|
+
else if (resolvedMounts) {
|
|
69
|
+
body.mounts = resolvedMounts;
|
|
70
|
+
if (workspaceRoot)
|
|
71
|
+
body.containerWorkspace = workspaceRoot;
|
|
72
|
+
}
|
|
33
73
|
else {
|
|
34
74
|
body.workspaceDir = workspaceDir;
|
|
35
75
|
}
|
|
@@ -79,6 +119,13 @@ function validateContainerName(name) {
|
|
|
79
119
|
}
|
|
80
120
|
return trimmed;
|
|
81
121
|
}
|
|
122
|
+
function validateContainerPath(path) {
|
|
123
|
+
const trimmed = (path ?? '').replace(/\\/g, '/').replace(/\/+$/, '').trim();
|
|
124
|
+
if (!trimmed.startsWith('/')) {
|
|
125
|
+
throw new Error(`Invalid --mount container path: "${path}". Use an absolute path, e.g. /workspace/backend.`);
|
|
126
|
+
}
|
|
127
|
+
return trimmed;
|
|
128
|
+
}
|
|
82
129
|
function parseIde(value) {
|
|
83
130
|
const normalized = value.toLowerCase().replace(/[ _-]+/g, '');
|
|
84
131
|
if (normalized === 'rider')
|
package/package.json
CHANGED