Repository navigation
feat: add target flags to sync prompts and read sync flags only from the command line - #938
Merged
Merged
Conversation
cursor
Bot
force-pushed
the
ctawiah/sync-target-flags-1e8a
branch
from
October 22, 2026 04:56
47edc51 to
fec03fd
Compare
ctawiah
added this pull request to stack #942
October 22, 2026 13:28
This was referenced Oct 22, 2026
cursor
Bot
force-pushed
the
ctawiah/sync-target-flags-1e8a
branch
2 times, most recently
from
October 22, 2026 15:15
36e896d to
3881023
Compare
ctawiah
marked this pull request as ready for review
October 22, 2026 15:31
ctawiah
requested review from
nkester-ld and
tiffanylphan
and removed request for
a team
October 22, 2026 15:31
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 3881023. Configure here.
nkester-ld
approved these changes
Oct 22, 2026
…the command line sync prompts and watch take --project, --config-key, and --key, and plan only the variations that they name. The checks run before any LaunchDarkly request, and a project that the filter leaves out is not read. add and detach take the same flags instead of asking. attach and link take --project. Sync flags no longer take values from LD_* environment variables or the ldcli configuration file. Global flags such as --access-token keep that behavior.
A filtered sync plans only the variations that the filter keeps. The unused attachment check still read every local variation file. If a variation outside the filter had a missing file, its tools and skills looked unused. Then sync dropped their sync.lock entries, and with --yes it deleted their files. A full sync restores such a file. A filtered sync now keeps every tool and skill file and entry. The next full sync finds the files that no variation uses.
ctawiah
force-pushed
the
ctawiah/sync-target-flags-1e8a
branch
from
October 22, 2026 19:29
5bdd05a to
afee4d6
Compare
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. Its commands have two problems:project-key/config-key/variation-keyselectors. The project, AI Config, and variation questions have no flag, so a script cannot skip them.LD_<FLAG>environment variable or the ldcli configuration file. For example,LD_CONFLICT=bogus ldcli sync prompts --dry-runfails withinvalid conflict resolution "bogus". New flags read these sources too. ThenLD_YES, orLD_PROJECT, whichldcli config --set projectwrites, can change what a repository sync plans or applies.What changes
--project,--config-key, and--key.--keyis repeatable.sync promptsandwatch, the flags limit the plan. Local files andsync.lockrows outside the filter drop out before any read from LaunchDarkly.sync.lockstores the state that a working copy last agreed on with LaunchDarkly.addanddetach, the flags answer the questions. Without a terminal, the error names the missing flags, for example--config-key and --key are required with --no-input.attachandlink, only--projectexists. It skips the project question, and it fails if it disagrees with--to.--resolve, and--tostill work. Selectors together with target flags fail.--config-keywith no synced variations gets its own error..launchdarkly/directory,sync prompts --project demostarts the first-run add in that project.link, a 404 from the first read in the project becomesproject "demo" was not found in LaunchDarkly, or the access token cannot read it.The help examples now use the flags:
A key that is not synced fails before any request:
Design notes
validators.Validate()copies environment and configuration values into every flag and marks the flag as set.validatedArgsnow records which sync flags the command line set before that call. After the call, it resets every other sync flag to its default.BaselineStore.Loadreads the remote manifest only for the projects that the caller passes. Before, it read every project insync.lock, and a failed read there made a filtered sync fail. The remote manifest is a shared copy of the sync state in LaunchDarkly, one for each project.Savesends only the entries that changed, so sync never writes a project thatLoaddid not read.SyncAction,AddAction, andDetachAction.AttachActionandLinkActioncarry only a project key, so the sync afterattachorlinkstays a full sync.--keyhelp onaddanddetachreadsRepeat for more variations, becauseRepeat to add more variationsdid not fitdetach.Review focus
validatedArgscover every sync flag and leave every global flag alone?--projectonattachandlinkdoes not limit the sync that runs after them?Verification
go test ./...golangci-lint run(v2.9.0)TestValidatedArgsKeepsSyncFlagsFromTheCommandLineOnlyfails without the reset invalidatedArgs.TestPromptIgnoresSyncFlagsFromTheEnvironmentsetsLD_YES,LD_CONFLICT,LD_PROJECT,LD_KEY, andLD_NO_INPUT, and none of them has an effect.TestPromptReadsTheAccessTokenFromTheEnvironmentshows thatLD_ACCESS_TOKENstill works.TestPromptFilterSyncsOnlyTheNamedVariationsends no request for another project and keeps itssync.lockrow.TestPromptTargetFlagErrorsComeBeforeAnyRequestmakes sure that each targeting error sends no request.ldcliand ran it against a local stand-in for the LaunchDarkly API. The runs covered the filters, the errors,addanddetachwith each combination of flags, the--tomismatch, andLD_*variables. The request log showed no request for an error case or for a project outside the filter.Related changes
--diffflagNote
Overview
Adds
--project,--config-key, and repeatable--keytoldcli sync promptsso scripts can scope syncs and skip interactive project/config/variation prompts. Help examples move from positionalproject/config/variationselectors to these flags; mixing selectors with target flags is rejected.Scoped sync only plans and applies changes for resources inside the filter, loads remote manifests for those projects only (other
sync.lockrows stay untouched), and skips orphan attachment cleanup so tools for out-of-scope variations are not deleted. Add, detach, watch, and default sync pass asyncdomain.Filterthrough the prompt runner; attach/link accept--projectonly (post-command sync stays full-repo).Sync-specific flags (
--yes,--conflict,--dry-run, etc.) no longer inheritLD_*or ldcli config—validatedArgsresets local flags that were set only byvalidators.Validate()while global flags like--access-tokenstill use env/config. Targeting validation fails before any API call, with actionable errors for unsynced projects/configs/keys.Reviewed by Cursor Bugbot for commit 5bdd05a. Bugbot is set up for automated code reviews on this repo. Configure here.