Skip to content

feat(cli): destination dates + accommodation free-cancellation flags - #2

Merged
akoso merged 1 commit into
fix/cli-from-json-and-login-bugsfrom
feat/destination-dates-and-free-cancellation
Jun 13, 2026
Merged

akoso merged 1 commit into
fix/cli-from-json-and-login-bugsfrom
feat/destination-dates-and-free-cancellation

Conversation

@akoso

@akoso akoso commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Surfaces two API fields the CLI didn't expose yet, and re-syncs the committed OpenAPI snapshot with the live production surface.

Stacked on #1 (the empty-2xx client fix it relies on). Base is fix/cli-from-json-and-login-bugs; retarget to main once #1 merges.

Feature 1 — destination dates

--start-date / --end-date on destinations add and edit. Accepts YYYY-MM-DD (normalized to UTC start-of-day ISO) or a full ISO date-time; maps to body startDate / endDate. Included in edit's "specify at least one of …" guard.

mna destinations edit <trip> <variant> <dest> --start-date 2026-07-07 --end-date 2026-07-15

⚠️ Backend caveat (out of scope here): PATCH destination date persistence depends on the server update handler. The CLI sends the fields correctly (unit-tested); confirm end-to-end with mna trips show <trip> --json.

Feature 2 — accommodation free-cancellation

--free-cancellation-until on options add and edit (accommodation only; clear error otherwise), merged into the body as freeCancellationUntil. For options edit it also makes --from-json optional, so updating just the date needs no JSON file:

mna options edit <trip> <variant> <dest> accommodation <opt> --free-cancellation-until 2026-07-02

OpenAPI sync

Regenerated openapi.json from the live API. The server now declares freeCancellationUntil (+ checkIn/checkOut/times) on the Create/Update accommodation DTOs — closing the contract gap so this flag is fully typed — and returns CreateOptionResultV1Dto { key } on option creation. Structurally additive vs the previous snapshot (74 new leaf paths, 0 removed/changed). schema.ts is gitignored and regenerated from this snapshot by CI.

Tests

normalizeToIsoDateTime and applyFreeCancellation unit-tested; command-level flag→body mapping tests in the client.test.ts style. bun run typecheck, bun run lint, bun test (34 pass), and bun run build all green.

Note: README.md also carries a small pre-existing install-doc note (bun run build before bun link) that was already in the working tree.

🤖 Generated with Claude Code

Surfaces two API fields the CLI didn't expose, and re-syncs the committed
OpenAPI snapshot with the live production surface.

- Destination dates: `--start-date` / `--end-date` on `destinations add` and
  `edit`, accepting YYYY-MM-DD (normalized to UTC start-of-day ISO) or a full
  ISO date-time. Mapped to body `startDate` / `endDate`; included in edit's
  "specify at least one of …" guard.
- Accommodation free-cancellation: `--free-cancellation-until` on `options add`
  and `edit` (accommodation only; clear error otherwise), merged into the body
  as `freeCancellationUntil`. For `options edit` it also makes `--from-json`
  optional, so updating just the date no longer needs a JSON file.
- Shared helpers: `normalizeToIsoDateTime` (util/dates) and `applyFreeCancellation`
  (commands/options), both unit-tested; plus command-level flag→body mapping
  tests in the client.test.ts style.
- Regenerated openapi.json snapshot from the live API: the server now declares
  `freeCancellationUntil` (+ checkIn/checkOut/times) on Create/Update
  accommodation DTOs (closing the contract gap) and returns CreateOptionResultV1Dto
  on option creation. Purely additive vs the previous snapshot.

Known caveat (backend, out of scope here): PATCH destination start/end-date
persistence — the CLI sends the fields correctly; end-to-end persistence depends
on the server update handler. Verify with `mna trips show <trip> --json`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@akoso
akoso merged commit 61e3891 into fix/cli-from-json-and-login-bugs Jun 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant