fix(setup): correct allowedTools pattern from "bd:*" to "bd *"
The Claude Code allowedTools pattern uses prefix matching with space separator,
not colon. "Bash(bd *)" matches "bd ready", "bd create", etc.
Follow-up to 3d48458.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -66,7 +66,7 @@ func InstallClaude(project bool, stealth bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add bd to allowedTools so commands don't require per-command approval
|
// Add bd to allowedTools so commands don't require per-command approval
|
||||||
if addAllowedTool(settings, "Bash(bd:*)") {
|
if addAllowedTool(settings, "Bash(bd *)") {
|
||||||
fmt.Println("✓ Added bd to allowedTools (no per-command approval needed)")
|
fmt.Println("✓ Added bd to allowedTools (no per-command approval needed)")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ func RemoveClaude(project bool) {
|
|||||||
removeHookCommand(hooks, "PreCompact", "bd prime --stealth")
|
removeHookCommand(hooks, "PreCompact", "bd prime --stealth")
|
||||||
|
|
||||||
// Remove bd from allowedTools
|
// Remove bd from allowedTools
|
||||||
removeAllowedTool(settings, "Bash(bd:*)")
|
removeAllowedTool(settings, "Bash(bd *)")
|
||||||
|
|
||||||
// Write back
|
// Write back
|
||||||
data, err = json.MarshalIndent(settings, "", " ")
|
data, err = json.MarshalIndent(settings, "", " ")
|
||||||
|
|||||||
@@ -418,25 +418,25 @@ func TestAddAllowedTool(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "add tool to empty settings",
|
name: "add tool to empty settings",
|
||||||
existingSettings: make(map[string]interface{}),
|
existingSettings: make(map[string]interface{}),
|
||||||
tool: "Bash(bd:*)",
|
tool: "Bash(bd *)",
|
||||||
wantAdded: true,
|
wantAdded: true,
|
||||||
wantLen: 1,
|
wantLen: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "add tool to existing allowedTools",
|
name: "add tool to existing allowedTools",
|
||||||
existingSettings: map[string]interface{}{
|
existingSettings: map[string]interface{}{
|
||||||
"allowedTools": []interface{}{"Bash(git:*)"},
|
"allowedTools": []interface{}{"Bash(git *)"},
|
||||||
},
|
},
|
||||||
tool: "Bash(bd:*)",
|
tool: "Bash(bd *)",
|
||||||
wantAdded: true,
|
wantAdded: true,
|
||||||
wantLen: 2,
|
wantLen: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "tool already exists",
|
name: "tool already exists",
|
||||||
existingSettings: map[string]interface{}{
|
existingSettings: map[string]interface{}{
|
||||||
"allowedTools": []interface{}{"Bash(bd:*)"},
|
"allowedTools": []interface{}{"Bash(bd *)"},
|
||||||
},
|
},
|
||||||
tool: "Bash(bd:*)",
|
tool: "Bash(bd *)",
|
||||||
wantAdded: false,
|
wantAdded: false,
|
||||||
wantLen: 1,
|
wantLen: 1,
|
||||||
},
|
},
|
||||||
@@ -483,31 +483,31 @@ func TestRemoveAllowedTool(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "remove only tool",
|
name: "remove only tool",
|
||||||
existingSettings: map[string]interface{}{
|
existingSettings: map[string]interface{}{
|
||||||
"allowedTools": []interface{}{"Bash(bd:*)"},
|
"allowedTools": []interface{}{"Bash(bd *)"},
|
||||||
},
|
},
|
||||||
tool: "Bash(bd:*)",
|
tool: "Bash(bd *)",
|
||||||
wantLen: 0,
|
wantLen: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "remove one of multiple tools",
|
name: "remove one of multiple tools",
|
||||||
existingSettings: map[string]interface{}{
|
existingSettings: map[string]interface{}{
|
||||||
"allowedTools": []interface{}{"Bash(git:*)", "Bash(bd:*)", "Bash(npm:*)"},
|
"allowedTools": []interface{}{"Bash(git *)", "Bash(bd *)", "Bash(npm *)"},
|
||||||
},
|
},
|
||||||
tool: "Bash(bd:*)",
|
tool: "Bash(bd *)",
|
||||||
wantLen: 2,
|
wantLen: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "remove non-existent tool",
|
name: "remove non-existent tool",
|
||||||
existingSettings: map[string]interface{}{
|
existingSettings: map[string]interface{}{
|
||||||
"allowedTools": []interface{}{"Bash(git:*)"},
|
"allowedTools": []interface{}{"Bash(git *)"},
|
||||||
},
|
},
|
||||||
tool: "Bash(bd:*)",
|
tool: "Bash(bd *)",
|
||||||
wantLen: 1,
|
wantLen: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "remove from empty settings",
|
name: "remove from empty settings",
|
||||||
existingSettings: make(map[string]interface{}),
|
existingSettings: make(map[string]interface{}),
|
||||||
tool: "Bash(bd:*)",
|
tool: "Bash(bd *)",
|
||||||
wantLen: 0,
|
wantLen: 0,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user