Skip to content

feat(sync): add scriptable prompt commands - #854

Open
ctawiah wants to merge 1 commit into
ctawiah/sync-remote-manifestsfrom
ctawiah/sync-scriptable-commands
Open

ctawiah wants to merge 1 commit into
ctawiah/sync-remote-manifestsfrom
ctawiah/sync-scriptable-commands

Conversation

@ctawiah

@ctawiah ctawiah commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Context

Prompt sync currently exposes several different workflows through flags on one command. That works interactively, but it makes automation difficult because an agent must combine flags whose relationships are not obvious and can still encounter an unexpected prompt.

This layer gives each workflow a focused subcommand and a complete non-interactive path. Interactive selection remains available when identifiers are omitted, while scripts and agents can provide stable resource keys and explicit conflict policies.

What changes

  • Replaces the prompt action flags with watch, add, attach, detach, and link subcommands.
  • Uses project-key/config-key/variation-key selectors consistently in arguments, flags, help, and validation errors.
  • Adds explicit non-interactive inputs for attachment targets, linked variations, model config keys, names, and prompt content.
  • Adds --no-input to fail instead of opening an interactive selector or confirmation.
  • Adds --conflict for a default conflict policy and repeatable --resolve flags for variation-specific choices.
  • Keeps backend search for projects, configs, tools, and skills when users choose resources interactively.
  • Supports outputFormat through variation create, update, pull, fingerprint, and clear operations.
  • Preserves specific LaunchDarkly API errors while adding the project and resource context needed to correct them.
  • Includes command examples in help output for both interactive and non-interactive workflows.
  • Rejects unsafe selectors and blank link metadata before making API or filesystem changes.
  • Loads explicitly selected projects when detaching so manifest-only resources can still be removed safely.
  • Stops watch mode with an error when an explicit conflict policy chooses abort.

The old --add, --attach-tool, --attach-skill, --detach, --link, and --watch action flags are removed. Their workflows now use subcommands.

Command examples

Add one existing LaunchDarkly variation to the workspace:

ldcli sync prompt add production/support/default --no-input

Attach a tool or skill to a variation that is already synced:

ldcli sync prompt attach tool web-search \
  --to production/support/default \
  --yes --no-input

ldcli sync prompt attach skill summarize \
  --to production/support/default \
  --yes --no-input

Link a Markdown file as a new variation:

ldcli sync prompt link prompts/support.md \
  --format plain-markdown \
  --to production/support/support-agent \
  --model-config-key claude \
  --yes --no-input

Apply a default conflict policy or override one variation:

ldcli sync prompt --yes --no-input --conflict=local

ldcli sync prompt --yes --no-input \
  --conflict=abort \
  --resolve=production/support/default=launchdarkly

Stop syncing a variation or watch for local changes:

ldcli sync prompt detach production/support/default --no-input
ldcli sync prompt watch --yes --no-input

Running add, attach tool, attach skill, or detach without identifiers keeps the interactive selection flow.

Review focus

  • Are the subcommands and selector shapes easy to discover and understand?
  • Can every interactive workflow be completed deterministically with arguments and flags?
  • Does --no-input prevent every unexpected prompt?
  • Do default and per-variation conflict policies behave correctly for shared tools and skills?
  • Do explicit add, detach, attach, and link operations preserve the existing sync and manifest behavior?
  • Does outputFormat converge when it is added, changed, pulled, or removed?
  • Are API failures specific enough to identify the project and resource without hiding the server error?

Verification

  • go test -p 1 ./cmd/sync ./internal/sync/...
  • go test -p 1 ./...
  • go vet ./internal/sync/... ./cmd/sync
  • git diff --check

Related changes

Review the stack in this order:

  1. Confirm destructive watch actions
  2. Guarantee prompt fingerprint convergence
  3. Add searchable attachment API foundations
  4. Reconcile variation attachments
  5. Attach tools and skills to variations
  6. Render attachment-aware review output
  7. Safely clean unreferenced attachments
  8. Persist sync manifests in LaunchDarkly
  9. Scriptable prompt sync commands

Made with Cursor

@ctawiah
ctawiah added this pull request to stack #844 October 7, 2026 18:54
@ctawiah
ctawiah marked this pull request as ready for review October 7, 2026 19:03
@ctawiah
ctawiah requested a review from a team as a code owner October 7, 2026 19:03

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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 6d098de. Configure here.

for _, resource := range resources {
choices = append(choices, syncinteractive.Choice[Resource]{
Title: resource.ProjectKey + "/" + resource.LookupKey,
Description: string(resource.Kind),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detach succeeds for unsynced selectors

Medium Severity

Explicit detach selectors never reach validateSelections when the loaded resource list is empty, so the command prints that nothing is synced and exits successfully. A scripted detach of a missing or mistyped selector can no-op instead of failing, unlike the same selector when other resources exist.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6d098de. Configure here.

@ld-ahartmann ld-ahartmann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly looks good to me but got some agent guidance - do with it what you will:

'Explicit detach succeeds when nothing is synced. Run returns nil on an empty resource list before validateSelections, so detach production/support/default --no-input against an empty workspace is a successful no-op. The same selector fails once any other variation exists.

Validate explicit selectors first and return variation … is not synced.'

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.

2 participants