Repository navigation
feat(sync): add scriptable prompt commands - #854
Conversation
ld-ahartmann
left a comment
There was a problem hiding this comment.
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.'
6d098de to
719799f
Compare
Put each shared rule in the domain package once. The rules are key validation, variation validation, lookup keys, attachment loading, version pins, and attachment comparison. A compiled local variation now holds a typed Variation instead of a JSON payload. Split the api, local, and prompt packages into files by concern. The api client uses one read helper and one write helper. The local package owns the directory layout in one file, and its writes share one staging path. The prompt package has one file for each step of a sync. Fix the manifest store. If a patch failed without a response but LaunchDarkly applied it, Update returned an empty manifest for the project. Add a golden test that pins the fingerprints that remote manifests store.
An explicit detach selector skipped validation when no resource was synced. The command then reported success and did nothing. Detach now checks each named selector first, so a selector that is not synced always fails. The empty-workspace message stays for the interactive flow.
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 8479c70. Configure here.
The refactor sent each search result through the strict decoder, which requires a positive version. One result without a version then failed the whole page, and interactive attach could not list tools or skills. Search results now use a decoder that does not check the identity. A tool result still gets the strict check when the client reads the tool again for its latest version.

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
watch,add,attach,detach, andlinksubcommands.project-key/config-key/variation-keyselectors consistently in arguments, flags, help, and validation errors.--no-inputto fail instead of opening an interactive selector or confirmation.--conflictfor a default conflict policy and repeatable--resolveflags for variation-specific choices.outputFormatthrough variation create, update, pull, fingerprint, and clear operations.abort.The old
--add,--attach-tool,--attach-skill,--detach,--link, and--watchaction flags are removed. Their workflows now use subcommands.Command examples
Add one existing LaunchDarkly variation to the workspace:
Attach a tool or skill to a variation that is already synced:
Link a Markdown file as a new variation:
Apply a default conflict policy or override one variation:
Stop syncing a variation or watch for local changes:
Running
add,attach tool,attach skill, ordetachwithout identifiers keeps the interactive selection flow.Review focus
--no-inputprevent every unexpected prompt?outputFormatconverge when it is added, changed, pulled, or removed?Verification
go test -p 1 ./cmd/sync ./internal/sync/...go test -p 1 ./...go vet ./internal/sync/... ./cmd/syncgit diff --checkRelated changes
Review the stack in this order:
Made with Cursor