Skip to content

feat(sync): add prompt reference workspaces - #817

Merged
ctawiah merged 1 commit into
mainfrom
ctawiah/AIC-3447/prompt-reference-workspaces
Sep 28, 2026
Merged

ctawiah merged 1 commit into
mainfrom
ctawiah/AIC-3447/prompt-reference-workspaces

Conversation

@ctawiah

@ctawiah ctawiah commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Context

Prompt sync needs a stable repository root and a small adapter boundary for prompt content maintained outside .launchdarkly. This layer adds those boundaries without creating local sync state or exposing a command.

What changes

  • Requires an initialized Git repository and resolves one canonical workspace root.
  • Defines the adapter contract used to parse and render external prompt formats.
  • Adds plain-markdown as the first adapter.
  • Resolves referenced files safely within the repository.

Review focus

  • Is workspace discovery predictable from nested directories?
  • Does the adapter contract leave room for additional prompt formats?
  • Are referenced paths constrained to the repository?

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
Introduces the prompt reference foundation for sync: a pluggable adapter contract (Parse/Render) with shared Prompt types, plus plain-markdown as the first format (whole file → one system message, line-ending normalization, round-trip via reference.Parse / ApplyToVariation / Render).

Adds Git-backed workspace discovery: repository.FindGitRepository (git rev-parse --show-toplevel, LC_ALL=C for stable “not a git repository” detection) and source.Resolver, which returns a canonical repo root (absolute path, symlinks resolved) or ErrGitRequired when not inside an initialized repo.

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

@nieblara nieblara left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WOO!

Non-blocking: findGitRepository reports every git failure as "not found." So if you're inside a repo but git refuses to run, say because of "detected dubious ownership" (common in containers, WSL, and CI) or a permissions error, you get told to "initialize a Git repository." That might be a bit confusing to users, and it could send an agent using these tools down the wrong path too.

One option is to split this into three cases: git isn't installed, the directory isn't a repo, and some other git error. For the last one, include the stderr from exec.ExitError. That way the error return actually gets used. Up to you!

@ctawiah
ctawiah force-pushed the ctawiah/AIC-3447/prompt-reference-workspaces branch from cd63a93 to 29b98e5 Compare September 25, 2026 15:31
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3447/prompt-reference-workspaces branch 2 times, most recently from d3d7bc2 to db54d1e Compare September 25, 2026 16:07
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3447/prompt-reference-workspaces branch from db54d1e to f6ee3d2 Compare September 28, 2026 21:35
Base automatically changed from ctawiah/AIC-3447/sync-foundations to main September 28, 2026 21:38
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3447/prompt-reference-workspaces branch 2 times, most recently from 08c675a to 8966178 Compare September 28, 2026 21:44
@ctawiah

ctawiah commented Sep 28, 2026

Copy link
Copy Markdown
Contributor Author

Addressed this feedback. Repository discovery now distinguishes a missing Git executable, an explicit “not a git repository” response, and other Git failures. Operational failures preserve Git’s stderr, with coverage for dubious ownership and errors that do not include stderr.

@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 2 potential issues.

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 8966178. Configure here.

Comment thread internal/sync/repository/git.go
Comment thread internal/sync/reference/adapters/plain_markdown/plain_markdown.go
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3447/prompt-reference-workspaces branch from 8966178 to 99a6a94 Compare September 28, 2026 21:58
@ctawiah
ctawiah merged commit 040479a into main Sep 28, 2026
10 checks passed
@ctawiah
ctawiah deleted the ctawiah/AIC-3447/prompt-reference-workspaces branch September 28, 2026 22:08
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