Skip to content

CLI: plan metadata update (plans --rename/--update) and delete-with-task-migration #93

Description

@andrei-hasna

Split out from #31 (the optional follow-ups listed there; #31's acceptance criteria — update --plan, --clear-plan, bulk plan/move-plan, error handling, docs — are done and closed by #91).

Two plan-lifecycle gaps remain on the CLI:

1. Plans cannot be renamed or edited from the CLI

todos plans supports --add, --show, --delete, --complete, --artifact, --write-artifacts — but there is no way to change a plan's name, slug, description, or status back off completed.

The backend already exists: updatePlan(id, { name, description, status }, db) in src/db/plans.ts, covered by src/db/plans.test.ts. Only the CLI surface (and a cloud/PATCH /v1/plans/<id> path, which the fixture server in remote-entrypoint.test.ts already models) is missing.

Suggested surface, mirroring projects --update / lists --update:

todos plans --update <id-or-slug> --name "New name" --description "..." --slug new-slug
todos plans --rename <id-or-slug> "New name"     # convenience alias

2. Deleting a plan silently orphans its tasks

todos plans --delete <id> relies on ON DELETE SET NULL, so every task's plan_id quietly becomes null with no warning and no migration path. Suggested:

todos plans --delete <id> --move-tasks-to <other-plan-id>   # reassign, then delete
todos plans --delete <id>                                    # warn when tasks would be orphaned

Both should work under a remote (self_hosted/cloud) authority as well as local SQLite — see the Stage-A gating pattern and the built-entrypoint lifecycle test used by #91.

Rough size: small-to-medium. Files: src/cli/commands/task-commands.ts (or wherever plans is registered), src/cli/cloud-router.ts, src/cli/stage-a.ts, src/server/routes.ts + openapi.ts if a plan PATCH/DELETE query param is added, plus src/cli/cli-qol.test.ts and src/cli/remote-entrypoint.test.ts coverage and a README/CHANGELOG update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions