Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .surface
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,6 @@ FLAG basecamp cards update --verbose type=count
FLAG basecamp chat --account type=string
FLAG basecamp chat --agent type=bool
FLAG basecamp chat --cache-dir type=string
FLAG basecamp chat --chat type=string
FLAG basecamp chat --count type=bool
FLAG basecamp chat --hints type=bool
FLAG basecamp chat --ids-only type=bool
Expand All @@ -1569,14 +1568,14 @@ FLAG basecamp chat --no-stats type=bool
FLAG basecamp chat --profile type=string
FLAG basecamp chat --project type=string
FLAG basecamp chat --quiet type=bool
FLAG basecamp chat --room type=string
FLAG basecamp chat --stats type=bool
FLAG basecamp chat --styled type=bool
FLAG basecamp chat --todolist type=string
FLAG basecamp chat --verbose type=count
FLAG basecamp chat delete --account type=string
FLAG basecamp chat delete --agent type=bool
FLAG basecamp chat delete --cache-dir type=string
FLAG basecamp chat delete --chat type=string
FLAG basecamp chat delete --count type=bool
FLAG basecamp chat delete --force type=bool
FLAG basecamp chat delete --hints type=bool
Expand All @@ -1591,14 +1590,14 @@ FLAG basecamp chat delete --no-stats type=bool
FLAG basecamp chat delete --profile type=string
FLAG basecamp chat delete --project type=string
FLAG basecamp chat delete --quiet type=bool
FLAG basecamp chat delete --room type=string
FLAG basecamp chat delete --stats type=bool
FLAG basecamp chat delete --styled type=bool
FLAG basecamp chat delete --todolist type=string
FLAG basecamp chat delete --verbose type=count
FLAG basecamp chat line --account type=string
FLAG basecamp chat line --agent type=bool
FLAG basecamp chat line --cache-dir type=string
FLAG basecamp chat line --chat type=string
FLAG basecamp chat line --count type=bool
FLAG basecamp chat line --hints type=bool
FLAG basecamp chat line --ids-only type=bool
Expand All @@ -1612,6 +1611,7 @@ FLAG basecamp chat line --no-stats type=bool
FLAG basecamp chat line --profile type=string
FLAG basecamp chat line --project type=string
FLAG basecamp chat line --quiet type=bool
FLAG basecamp chat line --room type=string
FLAG basecamp chat line --stats type=bool
FLAG basecamp chat line --styled type=bool
FLAG basecamp chat line --todolist type=string
Expand All @@ -1620,7 +1620,6 @@ FLAG basecamp chat list --account type=string
FLAG basecamp chat list --agent type=bool
FLAG basecamp chat list --all type=bool
FLAG basecamp chat list --cache-dir type=string
FLAG basecamp chat list --chat type=string
FLAG basecamp chat list --count type=bool
FLAG basecamp chat list --hints type=bool
FLAG basecamp chat list --ids-only type=bool
Expand All @@ -1634,14 +1633,14 @@ FLAG basecamp chat list --no-stats type=bool
FLAG basecamp chat list --profile type=string
FLAG basecamp chat list --project type=string
FLAG basecamp chat list --quiet type=bool
FLAG basecamp chat list --room type=string
FLAG basecamp chat list --stats type=bool
FLAG basecamp chat list --styled type=bool
FLAG basecamp chat list --todolist type=string
FLAG basecamp chat list --verbose type=count
FLAG basecamp chat messages --account type=string
FLAG basecamp chat messages --agent type=bool
FLAG basecamp chat messages --cache-dir type=string
FLAG basecamp chat messages --chat type=string
FLAG basecamp chat messages --count type=bool
FLAG basecamp chat messages --hints type=bool
FLAG basecamp chat messages --ids-only type=bool
Expand All @@ -1656,14 +1655,14 @@ FLAG basecamp chat messages --no-stats type=bool
FLAG basecamp chat messages --profile type=string
FLAG basecamp chat messages --project type=string
FLAG basecamp chat messages --quiet type=bool
FLAG basecamp chat messages --room type=string
FLAG basecamp chat messages --stats type=bool
FLAG basecamp chat messages --styled type=bool
FLAG basecamp chat messages --todolist type=string
FLAG basecamp chat messages --verbose type=count
FLAG basecamp chat post --account type=string
FLAG basecamp chat post --agent type=bool
FLAG basecamp chat post --cache-dir type=string
FLAG basecamp chat post --chat type=string
FLAG basecamp chat post --content type=string
FLAG basecamp chat post --content-type type=string
FLAG basecamp chat post --count type=bool
Expand All @@ -1679,14 +1678,14 @@ FLAG basecamp chat post --no-stats type=bool
FLAG basecamp chat post --profile type=string
FLAG basecamp chat post --project type=string
FLAG basecamp chat post --quiet type=bool
FLAG basecamp chat post --room type=string
FLAG basecamp chat post --stats type=bool
FLAG basecamp chat post --styled type=bool
FLAG basecamp chat post --todolist type=string
FLAG basecamp chat post --verbose type=count
FLAG basecamp chat upload --account type=string
FLAG basecamp chat upload --agent type=bool
FLAG basecamp chat upload --cache-dir type=string
FLAG basecamp chat upload --chat type=string
FLAG basecamp chat upload --count type=bool
FLAG basecamp chat upload --hints type=bool
FLAG basecamp chat upload --ids-only type=bool
Expand All @@ -1700,6 +1699,7 @@ FLAG basecamp chat upload --no-stats type=bool
FLAG basecamp chat upload --profile type=string
FLAG basecamp chat upload --project type=string
FLAG basecamp chat upload --quiet type=bool
FLAG basecamp chat upload --room type=string
FLAG basecamp chat upload --stats type=bool
FLAG basecamp chat upload --styled type=bool
FLAG basecamp chat upload --todolist type=string
Expand Down
14 changes: 14 additions & 0 deletions .surface-breaking
Original file line number Diff line number Diff line change
Expand Up @@ -715,3 +715,17 @@ SUB basecamp uploads vault list
SUB basecamp uploads vaults
SUB basecamp uploads vaults create
SUB basecamp uploads vaults list
FLAG basecamp campfire --chat type=string
FLAG basecamp campfire delete --chat type=string
FLAG basecamp campfire line --chat type=string
FLAG basecamp campfire list --chat type=string
FLAG basecamp campfire messages --chat type=string
FLAG basecamp campfire post --chat type=string
FLAG basecamp campfire upload --chat type=string
FLAG basecamp chat --chat type=string
FLAG basecamp chat delete --chat type=string
FLAG basecamp chat line --chat type=string
FLAG basecamp chat list --chat type=string
FLAG basecamp chat messages --chat type=string
FLAG basecamp chat post --chat type=string
FLAG basecamp chat upload --chat type=string
15 changes: 12 additions & 3 deletions e2e/errors.bats
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,22 @@ load test_helper
assert_output_contains "Unknown option"
}

@test "chat --chat without value shows error" {
@test "chat --room without value shows error" {
create_credentials
create_global_config '{"account_id": 99999}'

run basecamp chat messages --chat
run basecamp chat messages --room
assert_failure
assert_output_contains "--chat requires a value"
assert_output_contains "--room requires a value"
}

@test "chat --chat is rejected after rename to --room" {
create_credentials
create_global_config '{"account_id": 99999}'

run basecamp chat messages --chat 123
assert_failure
assert_output_contains "Unknown option"
}

@test "comment without recording ID shows error" {
Expand Down
10 changes: 5 additions & 5 deletions e2e/smoke/smoke_campfire.bats
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ setup_file() {
}

@test "campfire messages returns lines" {
run_smoke basecamp campfire messages --chat "$QA_CAMPFIRE" -p "$QA_PROJECT" --json
run_smoke basecamp campfire messages --room "$QA_CAMPFIRE" -p "$QA_PROJECT" --json
assert_success
assert_json_value '.ok' 'true'
}

@test "campfire post creates a message" {
run_smoke basecamp campfire post "Smoke test $(date +%s)" \
--chat "$QA_CAMPFIRE" -p "$QA_PROJECT" --json
--room "$QA_CAMPFIRE" -p "$QA_PROJECT" --json
assert_success
assert_json_value '.ok' 'true'
assert_json_not_null '.data.id'
Expand All @@ -38,7 +38,7 @@ setup_file() {
line_id=$(<"$id_file")

run_smoke basecamp campfire line "$line_id" \
--chat "$QA_CAMPFIRE" -p "$QA_PROJECT" --json
--room "$QA_CAMPFIRE" -p "$QA_PROJECT" --json
assert_success
assert_json_value '.ok' 'true'
assert_json_not_null '.data.id'
Expand All @@ -51,7 +51,7 @@ setup_file() {
line_id=$(<"$id_file")

run_smoke basecamp campfire delete "$line_id" \
--chat "$QA_CAMPFIRE" -p "$QA_PROJECT" --json
--room "$QA_CAMPFIRE" -p "$QA_PROJECT" --json
assert_success
assert_json_value '.ok' 'true'
}
Expand All @@ -61,7 +61,7 @@ setup_file() {
echo "campfire upload test $(date +%s)" > "$tmpfile"

run_smoke basecamp campfire upload "$tmpfile" \
--chat "$QA_CAMPFIRE" -p "$QA_PROJECT" --json
--room "$QA_CAMPFIRE" -p "$QA_PROJECT" --json
assert_success
assert_json_value '.ok' 'true'
}
6 changes: 3 additions & 3 deletions internal/cli/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func renderCommandHelp(cmd *cobra.Command) {
}
}

// FLAGS — local flags plus parent-scoped persistent flags (e.g. --chat,
// FLAGS — local flags plus parent-scoped persistent flags (e.g. --room,
// --project defined on a parent command). This promotes parent-scoped
// flags into the primary FLAGS section where they're immediately visible,
// rather than burying them in INHERITED FLAGS alongside root globals.
Expand All @@ -325,7 +325,7 @@ func renderCommandHelp(cmd *cobra.Command) {
}

// INHERITED FLAGS — root-level globals only. Parent-scoped persistent
// flags (--project, --chat, etc.) are promoted into FLAGS above.
// flags (--project, --room, etc.) are promoted into FLAGS above.
inherited := filterInheritedFlags(cmd)
if inherited != "" {
b.WriteString("\n")
Expand Down Expand Up @@ -388,7 +388,7 @@ func parentScopedFlags(cmd *cobra.Command) *pflag.FlagSet {

// filterInheritedFlags returns formatted flag usages for INHERITED FLAGS,
// containing only the curated subset of root-level globals. Parent-scoped
// persistent flags (--chat, --project on messages, etc.) are excluded here
// persistent flags (--room, --project on messages, etc.) are excluded here
// because parentScopedFlags promotes them into FLAGS.
func filterInheritedFlags(cmd *cobra.Command) string {
root := cmd.Root()
Expand Down
14 changes: 7 additions & 7 deletions internal/cli/help_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func TestGroupCommandShowsPersistentLocalFlags(t *testing.T) {
{"messages --in", "messages", commands.NewMessagesCmd, "--in"},
{"messages --message-board", "messages", commands.NewMessagesCmd, "--message-board"},
{"chat --project", "chat", commands.NewChatCmd, "--project"},
{"chat --chat", "chat", commands.NewChatCmd, "--chat"},
{"chat --room", "chat", commands.NewChatCmd, "--room"},
}

for _, tt := range tests {
Expand Down Expand Up @@ -185,7 +185,7 @@ func TestRootLevelLeafCommandHelp(t *testing.T) {
}

func TestLeafCommandShowsParentScopedFlagsInFLAGS(t *testing.T) {
// Parent-scoped persistent flags (--project, --chat, etc.) are promoted
// Parent-scoped persistent flags (--project, --room, etc.) are promoted
// into the FLAGS section on leaf commands, not buried in INHERITED FLAGS.
// This is a renderer-wide policy: any leaf whose parent defines persistent
// flags will show them in FLAGS.
Expand All @@ -204,10 +204,10 @@ func TestLeafCommandShowsParentScopedFlagsInFLAGS(t *testing.T) {
[]string{"--project", "--in", "--message-board"},
},
{
"chat post shows --project and --chat in FLAGS",
"chat post shows --project and --room in FLAGS",
[]string{"chat", "post", "--help"},
commands.NewChatCmd,
[]string{"--project", "--chat"},
[]string{"--project", "--room"},
},
{
"timesheet report shows date and person flags in FLAGS",
Expand Down Expand Up @@ -236,8 +236,8 @@ func TestLeafCommandShowsParentScopedFlagsInFLAGS(t *testing.T) {
}
}

func TestCampfirePostHelpShowsChatFlag(t *testing.T) {
// The campfire alias path must also show --chat in FLAGS.
func TestCampfirePostHelpShowsRoomFlag(t *testing.T) {
// The campfire alias path must also show --room in FLAGS.
isolateHelpTest(t)

var buf bytes.Buffer
Expand All @@ -249,7 +249,7 @@ func TestCampfirePostHelpShowsChatFlag(t *testing.T) {

out := buf.String()
flagsSection := extractSection(out, "FLAGS")
assert.Contains(t, flagsSection, "--chat")
assert.Contains(t, flagsSection, "--room")
assert.Contains(t, flagsSection, "--project")
}

Expand Down
Loading
Loading