@infosupport/huddle-cli 0.0.0-experiment-98.46.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 +10 -0
- package/dist/index.js +34 -3
- package/dist/start.js +49 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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/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', 'out']);
|
|
18
|
+
const VALUE_FLAGS = new Set(['url', 'ide', 'name', 'image', 'workspace', 'container', 'status', 'runtime', 'experiment', 'path', 'ca-path', 'output', 'out', 'workspace-root']);
|
|
19
19
|
const BOOLEAN_FLAGS = new Set(['help', 'h', 'empty', 'i', 'interactive', 'version', 'v', 'deny', 'docker-socket', 'force', 'replace']);
|
|
20
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
|
|
@@ -127,6 +151,11 @@ Init options:
|
|
|
127
151
|
Start options:
|
|
128
152
|
--ide <intellij|rider|vscode> IDE (default: intellij)
|
|
129
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)
|
|
130
159
|
--name <name> Container name (default: devcontainer-<foldername>)
|
|
131
160
|
--image <image> Use a specific image
|
|
132
161
|
--empty Empty container without a workspace
|
|
@@ -176,7 +205,7 @@ async function main() {
|
|
|
176
205
|
console.error('Run "huddle --help" for help.');
|
|
177
206
|
process.exit(1);
|
|
178
207
|
}
|
|
179
|
-
const { positional, flags } = parsed;
|
|
208
|
+
const { positional, flags, mounts } = parsed;
|
|
180
209
|
const [cmd, sub] = positional;
|
|
181
210
|
if (flagBool(flags, 'version', 'v') || cmd === 'version') {
|
|
182
211
|
console.log(readVersion());
|
|
@@ -197,6 +226,8 @@ async function main() {
|
|
|
197
226
|
await (0, start_1.runStart)({
|
|
198
227
|
ide: flagString(flags, 'ide') ?? 'intellij',
|
|
199
228
|
workspace: flagString(flags, 'workspace') ?? startArgs[0],
|
|
229
|
+
mounts: mounts.length ? mounts.map(parseMountFlag) : undefined,
|
|
230
|
+
workspaceRoot: flagString(flags, 'workspace-root'),
|
|
200
231
|
name: flagString(flags, 'name'),
|
|
201
232
|
image: flagString(flags, 'image'),
|
|
202
233
|
empty: flagBool(flags, 'empty'),
|
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