Skip to content

Commit b127f5c

Browse files
authored
Merge pull request #17 from rebelopsio/chore/vendor-sdk-add-verbose
fix(agent): pass --verbose to claude subprocess
2 parents e7be5fe + 274989a commit b127f5c

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

internal/agent/options.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ func buildOptions(cfg *config.Config, opts Options) ([]claude.Option, error) {
3737
claude.WithMaxTurns(cfg.Agent.MaxTurns),
3838
claude.WithPermissionMode(cfg.Agent.PermissionMode),
3939
claude.WithAllowedTools(allowedToolPattern...),
40+
// Required by recent versions of the claude CLI when combined
41+
// with --print and --output-format=stream-json — without it the
42+
// subprocess exits immediately with "requires --verbose". The
43+
// SDK passes through cfg.Verbose to the subprocess's --verbose
44+
// flag; archy always wants this so we hardcode true.
45+
claude.WithVerbose(true),
4046
}
4147
if opts.CLIPath != "" {
4248
out = append(out, claude.WithCLIPath(opts.CLIPath))

internal/agent/options_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ func TestBuildOptions_IncludesModelMaxTurnsPermission(t *testing.T) {
4242
User: testIdentity(),
4343
})
4444
require.NoError(t, err)
45-
// 4 base options (model, max-turns, permission, allowed-tools) + 1 archy MCP server = 5.
46-
// External MCPs in baseline config = 0.
47-
assert.Equal(t, 5, applyOpts(t, opts))
45+
// 5 base options (model, max-turns, permission, allowed-tools,
46+
// verbose) + 1 archy MCP server = 6. External MCPs in baseline
47+
// config = 0.
48+
assert.Equal(t, 6, applyOpts(t, opts))
4849
}
4950

5051
func TestBuildOptions_RegistersExternalEnabledMCPServer(t *testing.T) {
@@ -54,7 +55,7 @@ func TestBuildOptions_RegistersExternalEnabledMCPServer(t *testing.T) {
5455
}
5556
opts, err := buildOptions(cfg, Options{ArchyBinaryPath: "/fake/archy", User: testIdentity()})
5657
require.NoError(t, err)
57-
assert.Equal(t, 6, applyOpts(t, opts), "5 base/archy + 1 external")
58+
assert.Equal(t, 7, applyOpts(t, opts), "6 base/archy + 1 external")
5859
}
5960

6061
func TestBuildOptions_SkipsDisabledExternalMCPServer(t *testing.T) {
@@ -64,7 +65,7 @@ func TestBuildOptions_SkipsDisabledExternalMCPServer(t *testing.T) {
6465
}
6566
opts, err := buildOptions(cfg, Options{ArchyBinaryPath: "/fake/archy", User: testIdentity()})
6667
require.NoError(t, err)
67-
assert.Equal(t, 5, applyOpts(t, opts))
68+
assert.Equal(t, 6, applyOpts(t, opts))
6869
}
6970

7071
func TestBuildOptions_ExternalServerBadScheme(t *testing.T) {

0 commit comments

Comments
 (0)