Repository navigation
feat!: nav list, nav get by bar, and nav set - #9
Merged
Merged
Conversation
The API's navigation routes changed (cincpro/firebird#2068): the bars are
listed at GET /navigation, one bar is read at GET /navigation/{navBarUuid}
with nested items, and PUT on the same path replaces its items.
- nav list: the bars, without items.
- nav get [NAV_BAR]: one bar, by navBarUuid or `default` (the default).
--page finds the page's bar in the list, then reads it.
- nav set <NAV_BAR> --data: replaces every item on a bar. It sends the
`items` of its input and nothing else from a read; `pageUuid` only goes
out with --page, --detach or a `pageUuid` key in the input, so a bar
stays on its page otherwise.
BREAKING CHANGE: `nav get --nav-bar` is removed; the bar is a positional
argument. `nav get` prints the new response shape (nested `items`, no
`navBars`), and an unknown bar is exit 4 instead of the default bar.
These routes do not exist before cincpro/firebird#2068 is deployed.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… the docs A save replaces every item, so the output of nav get for one bar is no longer accepted as the data for a different bar. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
cincpro/firebird#2068 is deployed to production, so the routes this uses are live.
What changed
The Firebird API's navigation routes are changing. This moves the
navcommand to the new contract and adds the command for saving a bar.nav listlists the site's navigation bars (GET /navigation):navBarUuid,name,isSiteDefault,pageUuids. No items.nav get [NAV_BAR]reads one bar and its nested items (GET /navigation/{navBarUuid}).NAV_BARis anavBarUuidordefault; with no argument it isdefault.--page <page>reads the list to find the bar that page is on, then reads that bar, ordefaultwhen the page is on none.-o jsonis the API's response unchanged. A table shows the items flattened, with a dropdown's links carrying its label in aparentcolumn and atargetcolumn (page slug, standard page path, URL or page section).-qprints everynavItemUuid.nav set <NAV_BAR> --data JSON|@file|-replaces every item on a bar (PUT /navigation/{navBarUuid}). It changes the live site at once and asks first on a terminal, like the other live writes (-yskips the question; a script or agent is not asked).--datatakes the output ofnav get -o jsonor just{"items": [...]}. Onlyitemsis sent, untouched.pageUuidis sent only when asked for:--page <page>(a uuid),--detach(null), or apageUuidkey in--data. The flags win over the key. With none of them the body has nopageUuid, so the bar stays on its page. ThepageUuidsof a read is never sent.{navBarUuid, revisionUuid}. On a terminal the note after the save names the revision to restore.docs/GUIDE.md,README.md,AGENTS.mdand the help text describe the list, get, edititems, set flow, and no longer send people tofirebird-cli api PUT /navigation.Breaking
nav get --nav-bar <uuid>is removed. The bar is now a positional argument:nav get <uuid>.nav getprints the new response shape:{navBarUuid, name, isSiteDefault, pageUuids, items}with nesteditems. The flat item list andnavBarsare gone; the bars are innav list.navBarUuidis now 404 (exit 4) instead of the default bar.Tests
cargo fmt --check,cargo clippy --all-targets -- -D warningsandcargo testpass. New end-to-end tests intests/editing.rscovernav list,nav get(default,default, a uuid,--pagewith its own bar and with the fallback, table and-q, 404), andnav set(items-only body from a full read,--page,--detach, apageUuidkey, bad input refused before any request, 400, 404 and 409).🤖 Generated with Claude Code