Skip to content

Commit b9bb514

Browse files
committed
Support todolist name resolution and improve cross-project validation
- Resolve --list via resolveTodolistInTodoset so names like "Sprint 1" work, not just numeric IDs and URLs - Use project context from todo URL, --in flag, and config for both name resolution and cross-project validation - Use ErrUsageHint for the cross-project error to show actionable guidance - Update help text and SKILL.md placeholder to reflect name support
1 parent d6d2eff commit b9bb514

2 files changed

Lines changed: 33 additions & 5 deletions

File tree

internal/commands/todos.go

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,6 +1627,7 @@ You can pass either a todo ID or a Basecamp URL:
16271627
basecamp todos position https://3.basecamp.com/123/buckets/456/todos/789 --to 1
16281628
16291629
Move to a different todolist in the same project:
1630+
basecamp todos position 789 --to 1 --list "Sprint 1" --in myproject
16301631
basecamp todos position 789 --to 1 --list 321
16311632
basecamp todos position <todo-url> --to 1 --list <todolist-url>`,
16321633
RunE: func(cmd *cobra.Command, args []string) error {
@@ -1660,10 +1661,37 @@ Move to a different todolist in the same project:
16601661
if list != "" {
16611662
listIDStr, listProjectID := extractWithProject(list)
16621663

1664+
// Build project context: todo URL > --in flag > config
1665+
project := todoProjectID
1666+
if project == "" {
1667+
project = app.Flags.Project
1668+
}
1669+
if project == "" {
1670+
project = app.Config.ProjectID
1671+
}
1672+
16631673
// Cross-project moves are not supported by the reposition endpoint
1664-
if todoProjectID != "" && listProjectID != "" && todoProjectID != listProjectID {
1665-
return output.ErrUsage("Cannot move a todo to a list in a different project. " +
1666-
"Cross-project moves are not yet supported.")
1674+
if project != "" && listProjectID != "" && project != listProjectID {
1675+
return output.ErrUsageHint(
1676+
"Cannot move a todo to a list in a different project.",
1677+
"Pass a todolist from the same project; cross-project moves are not supported.",
1678+
)
1679+
}
1680+
1681+
// Resolve todolist name to ID when not already numeric
1682+
if !isNumeric(listIDStr) {
1683+
if project == "" {
1684+
return output.ErrUsage("--in is required to resolve todolist names")
1685+
}
1686+
resolvedProject, _, resolveErr := app.Names.ResolveProject(cmd.Context(), project)
1687+
if resolveErr != nil {
1688+
return resolveErr
1689+
}
1690+
resolved, resolveErr := resolveTodolistInTodoset(cmd, app, listIDStr, resolvedProject, "")
1691+
if resolveErr != nil {
1692+
return resolveErr
1693+
}
1694+
listIDStr = resolved
16671695
}
16681696

16691697
listID, parseErr := strconv.ParseInt(listIDStr, 10, 64)
@@ -1698,7 +1726,7 @@ Move to a different todolist in the same project:
16981726

16991727
cmd.Flags().IntVar(&position, "to", 0, "Target position, 1-based (1 = top)")
17001728
cmd.Flags().IntVar(&position, "position", 0, "Target position (alias for --to)")
1701-
cmd.Flags().StringVarP(&list, "list", "l", "", "Destination todolist ID or URL (move to a different list)")
1729+
cmd.Flags().StringVarP(&list, "list", "l", "", "Destination todolist ID, name, or URL (move to a different list)")
17021730

17031731
return cmd
17041732
}

skills/basecamp/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ basecamp unassign <id> [id...] --card --from <person> --in <project> # Remove ca
352352
basecamp assign <id> [id...] --step --to <person> --in <project> # Assign card step
353353
basecamp unassign <id> [id...] --step --from <person> --in <project> # Remove step assignee
354354
basecamp todos position <id> --to 1 # Move to top
355-
basecamp todos position <id> --to 1 --list <list> # Move to different list
355+
basecamp todos position <id> --to 1 --list <id|name|url> # Move to different list
356356
basecamp todos sweep --overdue --complete --comment "Done" --in <project>
357357
```
358358

0 commit comments

Comments
 (0)