Repository navigation
feat: show a compact sync plan and add a --diff flag - #937
Merged
Merged
Conversation
The plain-text and Markdown output of sync prompts now starts with a summary line and shows one row for each change, grouped by resource kind, with the size of its diff. Full diffs show only for a conflict or with the new --diff flag. A run with --yes prints only the results. add --dry-run lists the files that it creates, and --diff adds their content. JSON output does not change.
This was referenced Oct 22, 2026
ctawiah
added this pull request to stack #942
October 22, 2026 13:28
This was referenced Oct 22, 2026
ctawiah
marked this pull request as ready for review
October 22, 2026 15:03
ctawiah
requested review from
nieblara and
nkester-ld
and removed request for
a team
October 22, 2026 15:03
On a color terminal, the plan shows +N in green and -N in red. These are the colors of the added and removed lines in the diff. Piped output, Markdown, JSON, and output with NO_COLOR set have no color. Column widths ignore the color codes.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fb46607. Configure here.
A plan row shows only the first clause of an error. The error after the plan named only the first conflict or error row, so the full message of a later row did not print. For example, the hint "set upsert: true to create it" was lost. BlockingError now returns one line for each blocking row, in plan order. The first line does not change.
nkester-ld
approved these changes
Oct 22, 2026
This was referenced Oct 22, 2026
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.

Context
ldcli sync promptskeeps local prompt files in step with the variations of LaunchDarkly AI Configs. Before it writes, it shows a plan: one row for each variation, with the action that sync will take, such as a push or a pull.The plain-text plan is hard to read today:
Action:line, and a full diff. Rows that are in sync print too.add --dry-runprints every file in full.This PR gives the plan, the results, and the
addpreview a compact layout. Later PRs in this stack add tool and skill rows, and they print them with this layout.What changes
addpreview use a compact layout. JSON output does not change.No changes. N in sync.Skills,Tools, orPromptsin apply order. Rows that are in sync appear only in the count.(does not exist in LaunchDarkly)do not count.+Nin green and-Nin red. These are the colors of the added and removed lines in a diff.-o markdown,-o json, and output withNO_COLORset have no color. Column widths ignore the color codes, so the columns stay aligned.--diffflag prints each full diff. A conflict always shows its diff.sync prompts,watch,add,attach, andlinkhave the flag.--yes, only the results print. A dry run always prints the plan.Conflict: variation demo/support/concise changed on both sides., and then its diff.Note:line on stderr.-o markdownprints one table for each kind.add --dry-runlists the files and their line counts.BlockingErrornames the kind of the row, for examplecannot sync conflicted resource variation demo/support/concise. Existing error substrings still match.A plan now looks like this:
And the results of
ldcli sync prompts --yes:Design notes
diffBlocksinrender_diff.go, feeds both the diff renderer and the size counter. So a size always matches what--diffshows.+5 -1although it removes nothing.output.go.writeOutcomeOutputtakes the executed plan, so a result row can show the plan reason.conflictGroup.attachment. It always equals "more than one resource".pins search v4. A pin is the tool or skill version that a variation uses. That data comes from the apply step, so feat: apply tool and skill rows in a sync #941 adds it.Review focus
--diffoutput of its row?BlockingErrortext still match?Verification
go test ./...golangci-lint run(v2.9.0)TestPlanAndOutcomeJSONIsStablecompares the plan and outcome JSON with a saved copy, so a later change cannot change the JSON by accident.TestWritePlanReviewDiffMatchesRowSizecompares each size with the--diffoutput.I built
ldcliand ran it against a local stand-in for the LaunchDarkly API. The runs coveredadd --dry-runwith and without--diff,add, a dry run,--yes, and-o markdown. They also covered a conflict with and without--conflict local, an error row, and a stale working copy.TestDiffSizeTextColorsEachPart,TestWritePlanReviewColorsSizesOnATerminal, andTestWritePlanSizesHaveNoColorOffATerminalcover colored and plain sizes. The second test removes the color codes and compares the result with the plain plan.I ran a dry run in a 120-column pseudo-terminal.
+1was green and-1was red. WithNO_COLOR=1, with-o markdown, and through a pipe, the plan had no color.Related changes
--diffflagNote
Overview
Reworks plain-text and Markdown output for
ldcli sync promptsso plans and apply results are scannable: a one-line summary, then aligned rows grouped under Tools / Prompts (action, resource, reason, optional Size+N -Nfrom the same diff logic as rendering). In-sync resources only appear in the count.Adds
--diffon sync, watch, add, and apply-style commands to print full diffs (conflicts always show a diff).add --dry-runlists paths with line counts; with--diff, file bodies follow. Plan printing is lazy: shown before confirm, on blocking errors, when nothing applies, or on dry-run;--yesskips the plan and prints compact results only. Stale-working-copy hints move to stderrNote:lines;BlockingErroraggregates all blockers and usesResourceID.Label().JSON plan/outcome shape is unchanged (covered by stability tests). Terminal size colors respect
NO_COLORand non-TTY output.Reviewed by Cursor Bugbot for commit a576171. Bugbot is set up for automated code reviews on this repo. Configure here.