Skip to content

feat(sync): load local prompt variations - #788

Open
ctawiah wants to merge 5 commits into
mainfrom
ctawiah/AIC-3335/parse-local-synced-resources
Open

ctawiah wants to merge 5 commits into
mainfrom
ctawiah/AIC-3335/parse-local-synced-resources

Conversation

@ctawiah

@ctawiah ctawiah commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Context

This is the foundation for Phase 1 of code canonical sync for AI Config prompt variations. The CLI needs a stable local format that people can edit and that later planning requests can send to Gonfalon without recreating or interpreting server-owned fields.

This PR is intentionally local-only. It defines how prompt files are discovered, parsed, validated, and converted into sync resources. It does not call Gonfalon, calculate fingerprints, create plans, or apply changes.

Summary

  • Supports agent instructions and completion messages in an editor-friendly .prompt.md format.
  • Includes variation identity, name, model configuration, model values, and output format.
  • Keeps the server-owned AI Config variation comment out of local files and sync payloads.
  • Walks project directories and sorts variations by project and lookup key for stable request construction.
  • Rejects malformed or unsupported files with errors that identify the failing path.
  • Leaves canonicalization, fingerprinting, and comparison to Gonfalon.

Verification

  • go test ./internal/sync/... -count=1

Walk .launchdarkly and compile prompt variations and versioned tools into a
common resource with a stable fingerprint. Top-level system, user, and
assistant tags become messages; nested tags stay in the prompt body.
@ctawiah ctawiah changed the title feat(sync): parse local Agent Control files into SyncedResource feat(sync): parse local prompt variation files Sep 11, 2026
@ctawiah
ctawiah removed this pull request from stack #790 September 11, 2026 23:01
@ctawiah
ctawiah added this pull request to stack #795 September 11, 2026 23:01
@ctawiah
ctawiah removed this pull request from stack #795 September 11, 2026 23:51
@ctawiah ctawiah changed the title feat(sync): parse local prompt variation files feat(sync): load local prompt variations Sep 11, 2026
@ctawiah
ctawiah added this pull request to stack #799 September 11, 2026 23:51
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3335/parse-local-synced-resources branch from 2e0e6cd to faf6f4b Compare September 14, 2026 21:14
@ctawiah
ctawiah marked this pull request as ready for review September 16, 2026 21:55

@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 910e2dc. Configure here.

after, ok := consumeLineEnding(rest[index+4:])
if !ok {
after = nil
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Closing fence drops prompt body

Medium Severity

When the closing --- fence is not followed by a line ending or EOF, splitFrontMatter discards the rest of the file and returns an empty body instead of failing. consumeLineEnding already treats EOF as success, so this branch only hits trailing spaces, extra dashes, or same-line text after the closer. Compile then succeeds with empty instructions or messages, so those prompts can be synced as blank.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 910e2dc. Configure here.

})
if errors.Is(err, fs.ErrNotExist) {
return nil, nil
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Walk errors empty a project

Low Severity

compileProjectVariations treats any fs.ErrNotExist from the walk as an empty project, not only a missing configs directory. A later ReadFile miss, such as a dangling symlink to a .prompt.md file, returns nil, nil and drops variations already collected for that project instead of surfacing the path error.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 910e2dc. 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.

1 participant