Skip to content

feat(sync): persist local prompt workspaces - #811

Merged
ctawiah merged 1 commit into
mainfrom
ctawiah/AIC-3444/local-prompt-workspaces
Sep 29, 2026
Merged

ctawiah merged 1 commit into
mainfrom
ctawiah/AIC-3444/local-prompt-workspaces

Conversation

@ctawiah

@ctawiah ctawiah commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Context

Prompt sync needs a local representation that is easy to review in Git and safe to replace when LaunchDarkly is selected as the source of truth. This layer adds prompt wrapper parsing, rendering, and transactional file mutations on top of the manifest and reference contracts.

What changes

  • Compiles prompt wrappers under .launchdarkly/<project>/configs/<config>/.
  • Supports agent instructions, ordered completion messages, and repository-relative references.
  • Creates, replaces, and deletes wrapper files atomically.
  • Rolls back batch writes when a mutation fails.
  • Preserves external referenced prompts when wrappers are deleted.
.launchdarkly/production/configs/support/default.prompt.md

Review focus

  • Are paths and front matter validated before any file changes?
  • Do batch operations avoid partial local state?
  • Are referenced source files preserved correctly?

Verification

  • go test ./internal/sync/...
  • git diff --check

Related changes

Review the stack in this order:

  1. Sync foundations
  2. Prompt reference workspaces
  3. Prompt sync manifests
  4. Local prompt workspaces
  5. Bootstrap prompt workspaces
  6. Link and detach prompt resources
  7. Prompt reconciliation
  8. Prompt sync orchestration
  9. Prompt sync command

Note

Overview
Adds internal/sync/local to read and write prompt variations under .launchdarkly/<project>/configs/<config>/*.prompt.md, turning YAML front matter plus inline or referenced prompt bodies into SyncedResource values for reconciliation.

Compile walks project trees (with path-aware parse errors); Store supports bootstrap, add (create-only via hard link), replace, and delete with batch preflight, staging, rollback, and “changed while syncing” checks. Linked prompts use repository-relative ref paths with symlink re-validation on read; Replace can update external sources when the adapter can render them.

Shared NormalizePromptText (line endings + trim) is used in fingerprints, local render/parse, and plain-markdown adapters so server and on-disk prompts fingerprint consistently.

Reviewed by Cursor Bugbot for commit d59af3d. Bugbot is set up for automated code reviews on this repo. Configure here.

@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.

Stale Bugbot comment from a previous run.

Comment thread internal/sync/local/render.go Outdated
Comment thread internal/sync/local/delete.go
@ctawiah
ctawiah marked this pull request as draft September 24, 2026 04:33
@ctawiah
ctawiah marked this pull request as ready for review September 24, 2026 14:50
@ctawiah
ctawiah requested a review from a team as a code owner September 24, 2026 17:32
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3444/local-prompt-workspaces branch from bf4101a to a63297e Compare September 24, 2026 17:32

@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.

Stale Bugbot comment from a previous run.

Comment thread internal/sync/local/store.go
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3444/local-prompt-workspaces branch from a63297e to 5198e87 Compare September 24, 2026 17:40

@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.

Stale Bugbot comment from a previous run.

Comment thread internal/sync/local/variation.go
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3444/local-prompt-workspaces branch from 5198e87 to fba62f6 Compare September 24, 2026 17:57
@ctawiah
ctawiah removed this pull request from stack #815 September 24, 2026 17:59
@ctawiah
ctawiah changed the base branch from ctawiah/AIC-3447/sync-foundations to ctawiah/AIC-3444/prompt-sync-manifest September 24, 2026 17:59
@ctawiah
ctawiah added this pull request to stack #821 September 24, 2026 17:59
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3444/local-prompt-workspaces branch from fba62f6 to ad520c9 Compare September 25, 2026 15:31
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3444/local-prompt-workspaces branch from ad520c9 to 13ef784 Compare September 25, 2026 16:00

@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.

Stale Bugbot comment from a previous run.

Comment thread internal/sync/local/reference.go
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3444/local-prompt-workspaces branch from 13ef784 to 7c97750 Compare September 25, 2026 16:07
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3444/local-prompt-workspaces branch from 7c97750 to bb38036 Compare September 25, 2026 16:11
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3444/local-prompt-workspaces branch 2 times, most recently from 151db1c to cd28bdb Compare September 28, 2026 21:38
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3444/local-prompt-workspaces branch from cd28bdb to 73ad202 Compare September 28, 2026 21:44

@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.

Stale Bugbot comment from a previous run.

Comment thread internal/sync/local/store.go
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3444/local-prompt-workspaces branch 2 times, most recently from 3e00ff3 to 7e234ed Compare September 28, 2026 22:08

@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.

Stale Bugbot comment from a previous run.

Comment thread internal/sync/local/replace.go
Base automatically changed from ctawiah/AIC-3444/prompt-sync-manifest to main September 29, 2026 00:04
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3444/local-prompt-workspaces branch from 7e234ed to 2c2211e Compare September 29, 2026 00:04
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3444/local-prompt-workspaces branch from 2c2211e to d59af3d Compare September 29, 2026 00:10
@ctawiah
ctawiah merged commit f0155d5 into main Sep 29, 2026
10 checks passed
@ctawiah
ctawiah deleted the ctawiah/AIC-3444/local-prompt-workspaces branch September 29, 2026 00:17

@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

Reviewed by Cursor Bugbot for commit d59af3d. Configure here.

}
if err := temp.Close(); err != nil {
return fmt.Errorf("close variation %s: %w", filepath.Base(path), err)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Create path skips durability Sync

Medium Severity

createFile writes and closes the temp file, then publishes it with os.Link, without Sync(). Bootstrap then treats the directory rename as the commit point. A crash after that rename can leave already-published wrappers with empty or partial contents. stageReplacement already flushes before its commit.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by learned rule: Atomic sync writes: rename is the commit point

Reviewed by Cursor Bugbot for commit d59af3d. Configure here.

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