CLI command
product
Read one Echo content product by its id, replace its fields, or delete it: the counterparts of adopting one with seed-profile.
Invocation#
echo-cli product <id>
echo-cli product edit <id> [--name <text>] [--description <text>] [--niche <text>] [--platforms <comma-list>]
echo-cli product remove <id> --confirmInputs and output#
product <id> writes one indented JSON object with id, name, description, niche, target_platforms, and created_at.
product edit <id> replaces exactly the named fields (at least one), then prints the product as it now stands. --platforms takes a comma-separated list.
product remove <id> --confirm deletes the product and prints its id and name as JSON.
State effect#
product <id> reads the one product with that exact id and changes nothing.
edit and remove first read the product and refuse an id that matches nothing; then they call Echo Web's authenticated PATCH or DELETE /api/products/<id> with ECHO_INTERNAL_BEARER at ECHO_WEB_BASE_URL. Nothing is written from the CLI process itself, and no content generation is triggered.
Refusals#
- A missing id prints "a product id is required, as `echo-cli products` prints it" and exits 2; an id that matches nothing prints "no product has id <id>; `echo-cli products` lists the ones that exist" and exits 1.
- product edit without a field prints "product edit changes nothing; name at least one of --name, --description, --niche, --platforms", an unknown flag "product edit does not take <flag>; it takes …", an empty --name "--name cannot be empty"; each exits 2 before anything is read.
- product remove without --confirm prints "product remove <id> deletes the product and cannot be undone; add --confirm" and exits 2.
- Without NEXT_PUBLIC_SUPABASE_URL or SUPABASE_SERVICE_ROLE_KEY the command prints which one is not configured and exits 1; without ECHO_WEB_BASE_URL or ECHO_INTERNAL_BEARER edit and remove do the same.
- An Echo Web refusal is printed as "Echo Web refused <method> /api/products/<id> with HTTP <status>: <its answer>" and exits 1; an answer that is not JSON as "Echo Web answered <method> /api/products/<id> with HTTP <status> and no JSON (<parse error>): <its answer>"; a successful status without success true as "Echo Web did not confirm <method> /api/products/<id>: <its answer>".