"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CURSOR_RULES_CONTENT = exports.CURSOR_RULES_FILENAME = exports.CURSOR_RULES_VERSION = void 0;
const shared_variants_protocol_1 = require("./shared-variants-protocol");
exports.CURSOR_RULES_VERSION = 22;
exports.CURSOR_RULES_FILENAME = 'rivet.mdc';
const CURSOR_RULES_VERSION_MARKER = `rivet-rules-version: ${exports.CURSOR_RULES_VERSION}`;
const AGENT_VARIANTS_SECTION = (0, shared_variants_protocol_1.buildAgentVariantsSection)({
    inChatEmphasis: 'in chat',
    step9: `**Run all code-gen items IN PARALLEL** via parallel tool calls in a single response. For each:
   - Read \`input.briefBody\` and \`input.target\`
   - Edit files in \`input.worktreePath\` (each variant has its own isolated worktree)
   - Call \`report_variant_complete({ sessionId, workItemId, leaseId, attempt, status: 'succeeded' })\`. On failure, status \`'failed'\` with error description.`,
    step11Suffix: `When \`hasChanges: true\`, you'll see a \`VariantChangeItem\` in \`changes[]\`.`,
    nativeGenLabel: 'Task tool',
});
exports.CURSOR_RULES_CONTENT = `---
description: Rivet — apply when the user says "open rivet", "open the visual editor", "create variants", "show me options for X", "build me X from scratch", "create a new Y app", or wants to make visual/UI changes or explore design directions
alwaysApply: false
---
<!-- ${CURSOR_RULES_VERSION_MARKER} -->
# Rivet

Two flows: the **visual editor** (point-and-click changes to a web app — including an empty or HTML-only folder, which opens in static mode) and the **agent-variants flow** (explore N parallel design directions before committing).

> Tip: type \`@rivet.mdc\` in chat to invoke this rule manually.

${shared_variants_protocol_1.PICKING_THE_FLOW_TABLE}

## Visual Editor flow

## Starting a session

An **empty or HTML-only folder is a valid target** — \`detect_project\` returns \`framework: 'static'\` for it and \`open_visual_editor\` opens it in static mode (no dev server). When the user says "open rivet" / "use rivet here" in such a folder, open the editor — do NOT refuse or reroute to variants because there's "no app yet."

1. Call \`detect_project\` — returns project info including \`framework\` and \`projectPath\`
2. Call \`open_visual_editor({ projectPath, framework })\` — do NOT pass \`startPort\` or any port; the tool handles port selection automatically
3. Tell the user: "Rivet is ready — make your visual changes and click 'Send to Cursor'."
4. Call \`watch_for_changes({ sessionId })\` to wait for the user's changes.

## Watching and applying

1. Call \`watch_for_changes({ sessionId })\` — blocks until the user clicks "Send to Cursor"
2. If it times out (\`hasChanges: false\`), call it again to keep waiting
3. When \`hasChanges: true\`, apply the changes to the source files listed in \`sourceFiles\`
4. Call \`get_pending_changes({ sessionId, message: "summary of changes", refresh_git: true })\` so the Rivet UI updates
5. Hot reload happens automatically after file changes
6. Tell the user what you changed
7. **STOP and ask the user:** "Want me to keep watching for more Rivet changes, or go back to normal prompting?"
8. If they want to keep watching, go back to step 1

## Ending a session

When the user says they're done, call \`close_visual_editor({ sessionId })\`.

## Rules

- **Always call \`detect_project\` first** — never assume the dev server is running
- **Always use \`watch_for_changes\`** to wait for user changes — do NOT use Monitor, background shell commands, or manual polling
- **Never auto-commit** after applying visual changes — let the user decide
- Always stop and ask before re-entering the watch loop
- The dev server stays running after \`close_visual_editor\`

---

${AGENT_VARIANTS_SECTION}
`;
//# sourceMappingURL=cursor-rules.js.map