You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add pass-through args (--) forwarded verbatim to the tool
Anything after a bare '--' separator on the command line is forwarded
to the tool inside the container. Works for both 'construct' and
'construct qs'. Pass-through args are not persisted to last-used
settings and are ignored in debug mode.
Generated by construct
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,9 @@
2
2
3
3
## [Unreleased]
4
4
5
+
### Added
6
+
-**Pass-through args (`--`)** — both `construct [flags] [path] -- <tool-args>` and `construct qs [path] -- <tool-args>` now forward everything after the bare `--` separator verbatim to the tool inside the container (e.g. `construct qs -- continue-session <session-id>`). Pass-through args are not persisted to last-used settings. Debug mode (`--debug`) ignores them.
7
+
5
8
### Fixed
6
9
-**Container startup "Permission denied" errors** — the entrypoint script's heredoc that writes `~/.config/opencode/AGENTS.md` used an unquoted delimiter, causing the shell to treat backtick-wrapped paths (`` `/workspace` ``, `` `/home/agent` ``) as command substitutions. The delimiter is now quoted (`<< 'AGENTSEOF'`), preventing the errors `/workspace: Permission denied` and `/home/agent: Permission denied` on startup.
`qs` restores the last `--stack`, `--docker`, `--mcp`, and all `--port` values used for that repo. Settings are stored in `~/.construct/last-used.json`.
90
90
91
+
You can pass extra arguments to the tool after `--`. They are forwarded verbatim and are not saved to last-used:
Some tools accept flags of their own (e.g. `opencode -s <session-id>`). Currently there is no way to hand those arguments to the tool when launching via `construct` or `construct qs`.
6
+
7
+
## Solution
8
+
9
+
Support a `--` separator in both `construct` and `construct qs`. Anything after `--` is appended verbatim to the tool's `RunCmd` inside the container.
10
+
11
+
## Behaviour
12
+
13
+
```
14
+
construct [flags] [path] -- [tool-args...]
15
+
construct qs [path] -- [tool-args...]
16
+
```
17
+
18
+
- Everything after the first bare `--` token is collected as `tool-args` and appended to the container's command after `Tool.RunCmd`.
19
+
- The `[path]` positional and all `construct` flags are parsed from the portion **before**`--`.
20
+
- If `--` is absent the behaviour is identical to today (no change in the default case).
21
+
-`--debug` mode (`/bin/bash`) still ignores pass-through args — there is nothing useful to forward to a shell.
# Plain construct invocation with pass-through args
33
+
construct --stack go -- -s ses_deadbeefcafe1234abcd5678
34
+
```
35
+
36
+
## Persistence
37
+
38
+
Pass-through args are **not** persisted to `~/.construct/last-used.json`. They are one-off overrides. A subsequent bare `construct qs` will replay the saved flags without the pass-through args.
39
+
40
+
## Implementation
41
+
42
+
| File | Change |
43
+
|------|--------|
44
+
|`internal/runner/runner.go`| Add `ExtraArgs []string` to `Config`; append to `RunCmd` in `buildRunArgs` (only when not in debug mode) |
45
+
|`cmd/construct/main.go`|`splitPassthrough` helper splits `args` on `--`; `runAgent` and `runQuickstart` use it to populate `runner.Config.ExtraArgs`; usage strings updated |
46
+
47
+
## Non-goals
48
+
49
+
- No persistence of pass-through args in last-used.
50
+
- No validation of the tool args — they are forwarded verbatim.
51
+
- No pass-through support in `--debug` mode (shell is the CMD; there is nothing to forward to).
Copy file name to clipboardExpand all lines: docs/spec/quickstart-qs.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Introduce a `qs` subcommand that replays the last `--stack`, `--docker`, `--mcp`
11
11
## Behaviour
12
12
13
13
```
14
-
construct qs [path]
14
+
construct qs [path] [-- <tool-args>]
15
15
```
16
16
17
17
-`path` defaults to the current working directory.
@@ -20,6 +20,7 @@ construct qs [path]
20
20
- Errors with a clear message if no previous run has been recorded for the given path.
21
21
- Replays `--docker`, `--mcp`, and all `--port` values that were used in the last recorded invocation.
22
22
- For entries recorded before `--docker` was introduced (no `"docker"` key), defaults to `--docker none`.
23
+
- Anything after a bare `--` separator is forwarded verbatim to the tool inside the container and is **not** saved to last-used (see `docs/spec/passthrough-args.md`).
23
24
24
25
## Persistence
25
26
@@ -44,11 +45,12 @@ Settings are saved automatically at the end of argument validation in every norm
44
45
| File | Change |
45
46
|------|--------|
46
47
|`internal/config/lastused.go`| New — `SaveLastUsed`, `LoadLastUsed`, JSON read/write helpers; `DockerMode` field added |
47
-
|`cmd/construct/main.go`|`main()` routes `qs` → `runQuickstart`; `runAgent` calls `SaveLastUsed`; `runQuickstart` prints and replays all flags; help lists `qs` under Subcommands |
48
+
|`cmd/construct/main.go`|`main()` routes `qs` → `runQuickstart`; `runAgent` calls `SaveLastUsed`; `runQuickstart` prints and replays all flags; `runQuickstart` uses `splitPassthrough` to forward `--` args without saving them; help lists `qs` under Subcommands |
48
49
|`README.md`| New **Quickstart (qs)** section |
49
50
50
51
## Non-goals
51
52
52
53
- No flag to disable auto-saving.
53
54
- No `qs --stack` overrides (just use the full command instead).
54
55
- No TTY prompt to confirm before launching; the reused settings are printed to stderr.
56
+
- Pass-through args after `--` are not persisted; a subsequent bare `construct qs` replays only the saved flags.
0 commit comments