anthropics / anthropics/claude-code-action

[BUG] Multiline claude_args with Bash tools containing spaces parsed incorrectly

Đang mở
#844 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug p2
Ngôn ngữ chính
TypeScript
Star
8.9k
Fork
2.1k
Merge trung bình
3 ngày 9 giờ
Pull request đã merge (30 ngày)
10

Mô tả

## Bug Description

When using multiline YAML for `claude_args` with Bash tool patterns that contain spaces (like `Bash(git diff --name-only HEAD~1)`), the SDK incorrectly parses the `--allowedTools` argument by splitting on spaces.

## Reproduction

```yaml
claude_args: |
--max-turns 15
--allowedTools Bash(git diff --name-only HEAD~1),Bash(git diff HEAD~1),Read,Glob,Grep
```

## Expected Behavior

SDK should parse `allowedTools` as:
```json
["Bash(git diff --name-only HEAD~1)", "Bash(git diff HEAD~1)", "Read", "Glob", "Grep"]
```

## Actual Behavior

SDK parses `allowedTools` as:
```json
["Bash", "git", "diff"]
```

From the logs:
```
SDK options: {
"allowedTools": [
"Bash",
"git",
"diff"
],
...
"extraArgs": {
"max-turns": "15",
"name-only": "HEAD~1"
},
...
}
```

Note that `--name-only HEAD~1` is also incorrectly parsed as a separate extraArg.

## Evidence

Full error:
```
SDK execution error: error: Claude Code process exited with code 1
```

## Workaround

Put everything on a single line with quotes:
```yaml
claude_args: --max-turns 15 --allowedTools "Bash(git diff --name-only HEAD~1),Bash(git diff HEAD~1),Read,Glob,Grep"
```

## Environment

- Action version: `anthropics/claude-code-action@v1`
- Runner: `ubuntu-latest`
- Event: `pull_request`

## Notes

The [migration guide](https://github.com/anthropics/claude-code-action/blob/main/docs/migration-guide.md) shows multiline `claude_args` examples, but they don't include Bash tools with spaces:
```yaml
claude_args: |
--max-turns 15
--allowedTools Edit,Read,Write,Bash
```

The issue appears to be that `shell-quote` (or whatever parser is used) doesn't handle the multiline + spaces-in-arguments combination correctly.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.