Repository navigation
fix(cli): set the party on variants add and variants edit - #11
Merged
Merged
Conversation
Neither command could say who was travelling, so every variant created through the CLI was stored as one adult, and the budget breakdown is worked out from that. Family trips came out wrong with no error. - New `--adults`, `--child-ages` (comma-separated or repeated) and `--no-children` flags on both commands, validated before any request: adults at least 1, ages 0-17, matching the server's validation. - `variants edit` reads the stored party and merges into it, because the API replaces `participants` wholesale. The read needs `includeAllOptions` or only the selected variant comes back. The merge keeps `numberOfRooms` and strips the `_id`s a read carries, which writes reject. - `variants add --child-ages` needs `--adults`, and a space-separated `--child-ages 8 5` is an error rather than a silently dropped child. - `variants add` without party flags says on stderr that it defaulted to one adult. - `trips show` gets a Party column. - The skill now tells agents to set the party at creation, and to verify writes with `--all-options`, since a plain read hides unselected variants. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R6BF2tkLhdyAHNtHx1mtCK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was broken
mna variants addandmna variants edithad no way to say who is travelling. The API defaults a new variant to one adult whenparticipantsis missing, and the budget breakdown is worked out from that, so every family trip created through the CLI was wrong with no error.The fix
--adults <n>--child-ages <a,b>--adultsonadd.--no-childrenedit, this is how to remove children.participantsreplaces the whole structure, sovariants editreads the stored party and merges your change into it. With no party flag it reads nothing and sends noparticipants.trips showhas a Party column, e.g.2 adults, 2 children (8, 5).SKILL.mdandcli-and-schemas.mdtell agents to set the party at creation.API behaviour the merge depends on
All of this was checked against production on the sandbox trip. The first three would each have broken a simple fetch-and-merge:
GET /v1/trips/{id}returns only the selected variant unlessincludeAllOptions=true--all-options, because the old advice made a new variant look missing._idon the party and on each child, and writes reject them with a 400PATCHwithoutnumberOfRoomserases it--adultsand--child-agesare given. There is no rooms flag, so the CLI could not restore it otherwise.Decisions worth a look
variants addwith no party flags prints a one-line note on stderr saying it defaulted to one adult.--jsonstdout is unchanged.--child-ages 8 5is an error. citty would otherwise keep 8 and quietly drop 5.--child-agesis an error, so an unset shell variable can't wipe children. Clearing them takes the explicit--no-children.--adultsstays optional onadd, so existing solo scripts keep working.openapi.jsonis not refreshed. The committed snapshot predatesparticipantson the create and update DTOs. Variant bodies are already castas never, so nothing depends on it, and a refresh would pull in unrelated changes. The read DTO already has the field.Verification
bun test: 210 pass, 0 fail (50 new).bun run typecheckandbun run lintare clean.node dist/mna.js):skills installsmoke test passed, and the installed skill contains the new docs.--adults,--child-ages(comma-separated and repeated), both together, and--no-children, re-reading the party after each.numberOfRoomssurvived partial and full edits, and that--namealone left the party alone.variants duplicatecopies the party, and that an unknown variant fails without writing.🤖 Generated with Claude Code
https://claude.ai/code/session_01R6BF2tkLhdyAHNtHx1mtCK