Add --parent flag support in daemon mode (bd-2e94)

- Added Parent field to CreateArgs RPC protocol
- Updated CLI to pass parent ID to daemon instead of erroring
- Added parent ID handling in RPC server to call GetNextChildID
- Added validation to prevent both --id and --parent flags
- Added comprehensive tests for hierarchical child creation
- Resolves error: '--parent flag not yet supported in daemon mode'

Amp-Thread-ID: https://ampcode.com/threads/T-3e0f76df-4ba6-4b16-bf75-bb7ea6b19541
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-11-05 13:56:25 -08:00
parent 4ccd8fe38e
commit fc89f15ca0
4 changed files with 141 additions and 17 deletions

View File

@@ -148,22 +148,14 @@ var createCmd = &cobra.Command{
}
// If parent is specified, generate child ID
if parentID != "" {
// In daemon mode, the parent will be sent to the RPC handler
// In direct mode, we generate the child ID here
if parentID != "" && daemonClient == nil {
ctx := context.Background()
var childID string
var err error
if daemonClient != nil {
// TODO: Add RPC support for GetNextChildID (bd-171)
fmt.Fprintf(os.Stderr, "Error: --parent flag not yet supported in daemon mode\n")
childID, err := store.GetNextChildID(ctx, parentID)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
} else {
// Direct mode - use storage
childID, err = store.GetNextChildID(ctx, parentID)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
}
explicitID = childID // Set as explicit ID for the rest of the flow
}
@@ -213,6 +205,7 @@ var createCmd = &cobra.Command{
if daemonClient != nil {
createArgs := &rpc.CreateArgs{
ID: explicitID,
Parent: parentID,
Title: title,
Description: description,
IssueType: issueType,