rivet-design 0.8.7 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/bin/rivet.js +11 -0
  2. package/dist/config/evaluateFlags.d.ts +6 -2
  3. package/dist/config/evaluateFlags.d.ts.map +1 -1
  4. package/dist/config/evaluateFlags.js +4 -4
  5. package/dist/config/evaluateFlags.js.map +1 -1
  6. package/dist/config/featureFlagUserKey.d.ts +11 -0
  7. package/dist/config/featureFlagUserKey.d.ts.map +1 -0
  8. package/dist/config/featureFlagUserKey.js +21 -0
  9. package/dist/config/featureFlagUserKey.js.map +1 -0
  10. package/dist/config/flags.d.ts +6 -0
  11. package/dist/config/flags.d.ts.map +1 -1
  12. package/dist/config/flags.js +2 -0
  13. package/dist/config/flags.js.map +1 -1
  14. package/dist/index.js +198 -12
  15. package/dist/index.js.map +1 -1
  16. package/dist/mcp/agent-variants/SessionStore.d.ts +121 -0
  17. package/dist/mcp/agent-variants/SessionStore.d.ts.map +1 -0
  18. package/dist/mcp/agent-variants/SessionStore.js +480 -0
  19. package/dist/mcp/agent-variants/SessionStore.js.map +1 -0
  20. package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts +187 -0
  21. package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts.map +1 -0
  22. package/dist/mcp/agent-variants/WorktreeOrchestrator.js +482 -0
  23. package/dist/mcp/agent-variants/WorktreeOrchestrator.js.map +1 -0
  24. package/dist/mcp/agent-variants/contracts.d.ts +373 -0
  25. package/dist/mcp/agent-variants/contracts.d.ts.map +1 -0
  26. package/dist/mcp/agent-variants/contracts.js +134 -0
  27. package/dist/mcp/agent-variants/contracts.js.map +1 -0
  28. package/dist/mcp/agent-variants/errors.d.ts +8 -0
  29. package/dist/mcp/agent-variants/errors.d.ts.map +1 -0
  30. package/dist/mcp/agent-variants/errors.js +30 -0
  31. package/dist/mcp/agent-variants/errors.js.map +1 -0
  32. package/dist/mcp/agent-variants/index.d.ts +11 -0
  33. package/dist/mcp/agent-variants/index.d.ts.map +1 -0
  34. package/dist/mcp/agent-variants/index.js +15 -0
  35. package/dist/mcp/agent-variants/index.js.map +1 -0
  36. package/dist/mcp/agent-variants/pendingChangesAdapter.d.ts +38 -0
  37. package/dist/mcp/agent-variants/pendingChangesAdapter.d.ts.map +1 -0
  38. package/dist/mcp/agent-variants/pendingChangesAdapter.js +79 -0
  39. package/dist/mcp/agent-variants/pendingChangesAdapter.js.map +1 -0
  40. package/dist/mcp/agent-variants/tools.d.ts +8 -0
  41. package/dist/mcp/agent-variants/tools.d.ts.map +1 -0
  42. package/dist/mcp/agent-variants/tools.js +221 -0
  43. package/dist/mcp/agent-variants/tools.js.map +1 -0
  44. package/dist/mcp/server.d.ts.map +1 -1
  45. package/dist/mcp/server.js +51 -34
  46. package/dist/mcp/server.js.map +1 -1
  47. package/dist/proxy-middleware/proxy-config.d.ts +4 -1
  48. package/dist/proxy-middleware/proxy-config.d.ts.map +1 -1
  49. package/dist/proxy-middleware/proxy-config.js +34 -5
  50. package/dist/proxy-middleware/proxy-config.js.map +1 -1
  51. package/dist/routes/agentVariants.d.ts +16 -0
  52. package/dist/routes/agentVariants.d.ts.map +1 -0
  53. package/dist/routes/agentVariants.js +234 -0
  54. package/dist/routes/agentVariants.js.map +1 -0
  55. package/dist/server.d.ts +3 -0
  56. package/dist/server.d.ts.map +1 -1
  57. package/dist/server.js +24 -8
  58. package/dist/server.js.map +1 -1
  59. package/dist/services/FeatureFlagService.d.ts +9 -5
  60. package/dist/services/FeatureFlagService.d.ts.map +1 -1
  61. package/dist/services/FeatureFlagService.js +16 -7
  62. package/dist/services/FeatureFlagService.js.map +1 -1
  63. package/dist/services/SessionBridgeService.d.ts +22 -0
  64. package/dist/services/SessionBridgeService.d.ts.map +1 -1
  65. package/dist/services/SessionBridgeService.js +58 -1
  66. package/dist/services/SessionBridgeService.js.map +1 -1
  67. package/dist/services/TelemetryService.d.ts.map +1 -1
  68. package/dist/services/TelemetryService.js +6 -1
  69. package/dist/services/TelemetryService.js.map +1 -1
  70. package/dist/services/WorktreeManager.d.ts +42 -3
  71. package/dist/services/WorktreeManager.d.ts.map +1 -1
  72. package/dist/services/WorktreeManager.js +149 -6
  73. package/dist/services/WorktreeManager.js.map +1 -1
  74. package/dist/types/change-request-types.d.ts +36 -1
  75. package/dist/types/change-request-types.d.ts.map +1 -1
  76. package/dist/utils/devServerCommand.d.ts +19 -0
  77. package/dist/utils/devServerCommand.d.ts.map +1 -0
  78. package/dist/utils/devServerCommand.js +38 -0
  79. package/dist/utils/devServerCommand.js.map +1 -0
  80. package/dist/utils/skills/claude-skill.d.ts +2 -2
  81. package/dist/utils/skills/claude-skill.d.ts.map +1 -1
  82. package/dist/utils/skills/claude-skill.js +87 -4
  83. package/dist/utils/skills/claude-skill.js.map +1 -1
  84. package/dist/utils/skills/cursor-rules.d.ts +2 -2
  85. package/dist/utils/skills/cursor-rules.d.ts.map +1 -1
  86. package/dist/utils/skills/cursor-rules.js +87 -4
  87. package/dist/utils/skills/cursor-rules.js.map +1 -1
  88. package/dist/utils/variantPreviewPort.d.ts +18 -0
  89. package/dist/utils/variantPreviewPort.d.ts.map +1 -0
  90. package/dist/utils/variantPreviewPort.js +28 -0
  91. package/dist/utils/variantPreviewPort.js.map +1 -0
  92. package/package.json +1 -1
  93. package/src/ui/dist/assets/{main-HqOyJspz.js → main-Bv0LuxKz.js} +119 -119
  94. package/src/ui/dist/assets/main-BzmseUDd.css +1 -0
  95. package/src/ui/dist/index.html +2 -2
  96. package/src/ui/dist/assets/main-DytMB3Wi.css +0 -1
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.pruneWorktrees = exports.cleanupOrphanedWorktrees = exports.WorktreeManager = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
+ const net_1 = __importDefault(require("net"));
9
10
  const simple_git_1 = require("simple-git");
10
11
  const child_process_1 = require("child_process");
11
12
  const logger_1 = require("../utils/logger");
@@ -15,9 +16,52 @@ const WORKTREE_PREFIX = 'rivet-variants';
15
16
  // Include the PID so each server instance only cleans up its own worktrees.
16
17
  const INSTANCE_PREFIX = `${WORKTREE_PREFIX}-pid${process.pid}`;
17
18
  class WorktreeManager {
18
- projectPath;
19
+ resolveProjectPath;
20
+ /**
21
+ * Accepts either a static path or a lazy getter. The getter form lets
22
+ * long-lived callers (e.g. the agent-variants orchestrator) defer the
23
+ * project path until each operation, since `bridge.getProjectPath()`
24
+ * isn't known until `open_visual_editor` runs.
25
+ */
19
26
  constructor(projectPath) {
20
- this.projectPath = projectPath;
27
+ this.resolveProjectPath =
28
+ typeof projectPath === 'string' ? () => projectPath : projectPath;
29
+ }
30
+ get projectPath() {
31
+ return this.resolveProjectPath();
32
+ }
33
+ /**
34
+ * Return the absolute git root for the repo containing this.projectPath.
35
+ * When projectPath is a subdirectory (e.g. examples/microsoft-paint inside
36
+ * rivet-core), this returns the repo root — not the subdirectory.
37
+ */
38
+ async getGitRoot() {
39
+ const root = await (0, simple_git_1.simpleGit)(this.projectPath).revparse(['--show-toplevel']);
40
+ return root.trim();
41
+ }
42
+ /**
43
+ * Return the path to the project within a worktree.
44
+ * When projectPath == gitRoot this is just worktreePath.
45
+ * When projectPath is a subdirectory (e.g. rivet-core/examples/microsoft-paint),
46
+ * this returns worktreePath/examples/microsoft-paint so the dev server starts
47
+ * from the right directory.
48
+ */
49
+ async getProjectCwdInWorktree(worktreePath) {
50
+ const gitRoot = await this.getGitRoot();
51
+ const relPath = path_1.default.relative(gitRoot, path_1.default.resolve(this.projectPath));
52
+ return relPath ? path_1.default.join(worktreePath, relPath) : worktreePath;
53
+ }
54
+ /**
55
+ * Translate an absolute path that lives inside the main project tree to its
56
+ * equivalent path inside a worktree. Paths outside the git root are returned
57
+ * unchanged so the method is safe to call on arbitrary strings.
58
+ */
59
+ async translateToWorktreePath(absPath, worktreePath) {
60
+ const gitRoot = await this.getGitRoot();
61
+ const rel = path_1.default.relative(gitRoot, absPath);
62
+ if (rel.startsWith('..') || path_1.default.isAbsolute(rel))
63
+ return absPath;
64
+ return path_1.default.join(worktreePath, rel);
21
65
  }
22
66
  /** Get diff of all uncommitted changes (staged + unstaged) vs HEAD */
23
67
  async getUncommittedPatch() {
@@ -26,7 +70,7 @@ class WorktreeManager {
26
70
  return diff;
27
71
  }
28
72
  /** Apply a patch string via stdin to the given cwd using git apply */
29
- applyPatchViaStin(patch, cwd) {
73
+ applyPatchViaStdin(patch, cwd) {
30
74
  return new Promise((resolve, reject) => {
31
75
  const cp = (0, child_process_1.spawn)('git', ['apply', '--whitespace=nowarn', '-'], { cwd, stdio: ['pipe', 'pipe', 'pipe'] });
32
76
  let stderr = '';
@@ -46,13 +90,18 @@ class WorktreeManager {
46
90
  const git = (0, simple_git_1.simpleGit)(this.projectPath);
47
91
  const patch = await this.getUncommittedPatch();
48
92
  const paths = [];
93
+ const projectCwdRelative = path_1.default.relative(await this.getGitRoot(), path_1.default.resolve(this.projectPath));
49
94
  for (let i = 0; i < count; i++) {
50
95
  const worktreePath = path_1.default.join(WORKTREE_BASE, `${INSTANCE_PREFIX}-${sessionId}-${i}`);
51
96
  try {
52
97
  await git.raw(['worktree', 'add', '--detach', worktreePath, 'HEAD']);
53
- // Symlink node_modules for faster agent context
98
+ // Symlink node_modules into the project subdirectory within the worktree
99
+ // so the dev server (which runs from that subdirectory) finds deps.
54
100
  const nodeModulesSource = path_1.default.join(this.projectPath, 'node_modules');
55
- const nodeModulesDest = path_1.default.join(worktreePath, 'node_modules');
101
+ const projectCwdInWorktree = projectCwdRelative
102
+ ? path_1.default.join(worktreePath, projectCwdRelative)
103
+ : worktreePath;
104
+ const nodeModulesDest = path_1.default.join(projectCwdInWorktree, 'node_modules');
56
105
  if (fs_1.default.existsSync(nodeModulesSource) &&
57
106
  !fs_1.default.existsSync(nodeModulesDest)) {
58
107
  fs_1.default.symlinkSync(nodeModulesSource, nodeModulesDest);
@@ -62,7 +111,7 @@ class WorktreeManager {
62
111
  // Without this, getDiff (git diff HEAD) would include the user's
63
112
  // pre-existing changes, and reverting the combined diff would wipe them.
64
113
  if (patch.trim()) {
65
- await this.applyPatchViaStin(patch, worktreePath).catch(() => {
114
+ await this.applyPatchViaStdin(patch, worktreePath).catch(() => {
66
115
  log.warn(`Could not apply uncommitted patch to worktree ${i} — working from HEAD`);
67
116
  });
68
117
  }
@@ -135,6 +184,100 @@ class WorktreeManager {
135
184
  cp.stdin.end();
136
185
  });
137
186
  }
187
+ /** Bind port 0 to get an OS-assigned free port */
188
+ getFreePort() {
189
+ return new Promise((resolve, reject) => {
190
+ const server = net_1.default.createServer();
191
+ server.listen(0, () => {
192
+ const addr = server.address();
193
+ const port = addr && typeof addr === 'object' ? addr.port : 0;
194
+ server.close(() => resolve(port));
195
+ });
196
+ server.on('error', reject);
197
+ });
198
+ }
199
+ /** Validate a diff via `git apply --check` without modifying files */
200
+ validateDiff(diff, reverse) {
201
+ if (!diff.trim())
202
+ return Promise.resolve();
203
+ return new Promise((resolve, reject) => {
204
+ const args = ['apply', '--check', '--whitespace=nowarn'];
205
+ if (reverse)
206
+ args.push('--reverse');
207
+ args.push('-');
208
+ const cp = (0, child_process_1.spawn)('git', args, {
209
+ cwd: this.projectPath,
210
+ stdio: ['pipe', 'pipe', 'pipe'],
211
+ });
212
+ let stderr = '';
213
+ cp.stderr.on('data', (d) => { stderr += d.toString(); });
214
+ cp.on('close', (code) => {
215
+ if (code !== 0)
216
+ reject(new Error(`Diff validation failed: ${stderr.trim()}`));
217
+ else
218
+ resolve();
219
+ });
220
+ cp.stdin.write(diff);
221
+ cp.stdin.end();
222
+ });
223
+ }
224
+ /**
225
+ * Spawn a dev server and poll until it responds with a non-502 HTTP status
226
+ * (max 30s). Throws on timeout.
227
+ */
228
+ async startDevServer(worktreePath, port, cmd, args, env) {
229
+ const proc = (0, child_process_1.spawn)(cmd, args, {
230
+ cwd: worktreePath,
231
+ env: { ...process.env, ...env },
232
+ stdio: 'pipe',
233
+ detached: false,
234
+ });
235
+ proc.on('error', (err) => log.warn(`Dev server error (port ${port}):`, err));
236
+ const deadline = Date.now() + 30_000;
237
+ while (Date.now() < deadline) {
238
+ try {
239
+ const res = await fetch(`http://localhost:${port}`, {
240
+ signal: AbortSignal.timeout(1_000),
241
+ });
242
+ if (res.status !== 502)
243
+ return proc;
244
+ }
245
+ catch {
246
+ // not up yet
247
+ }
248
+ await new Promise((r) => setTimeout(r, 500));
249
+ }
250
+ try {
251
+ proc.kill('SIGTERM');
252
+ }
253
+ catch { /* ignore */ }
254
+ throw new Error(`Dev server on port ${port} did not become ready within 30s`);
255
+ }
256
+ /** Stop a dev server with SIGTERM + SIGKILL fallback */
257
+ async stopDevServer(proc, timeoutMs = 5_000) {
258
+ if (proc.killed || proc.exitCode !== null || proc.pid == null)
259
+ return;
260
+ const exited = new Promise((resolve) => {
261
+ const done = () => { proc.off('exit', done); proc.off('error', done); resolve(); };
262
+ proc.once('exit', done);
263
+ proc.once('error', done);
264
+ });
265
+ try {
266
+ proc.kill('SIGTERM');
267
+ }
268
+ catch { /* ignore */ }
269
+ const timedOut = await Promise.race([
270
+ exited.then(() => false),
271
+ new Promise((r) => setTimeout(() => r(true), timeoutMs)),
272
+ ]);
273
+ if (!timedOut)
274
+ return;
275
+ try {
276
+ proc.kill('SIGKILL');
277
+ }
278
+ catch { /* ignore */ }
279
+ await exited;
280
+ }
138
281
  /** Remove all worktrees for a session */
139
282
  async cleanupSession(sessionId) {
140
283
  const git = (0, simple_git_1.simpleGit)(this.projectPath);
@@ -1 +1 @@
1
- {"version":3,"file":"WorktreeManager.js","sourceRoot":"","sources":["../../src/services/WorktreeManager.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,2CAAuC;AACvC,iDAAsC;AACtC,4CAA+C;AAE/C,MAAM,GAAG,GAAG,IAAA,qBAAY,EAAC,iBAAiB,CAAC,CAAC;AAC5C,MAAM,aAAa,GAAG,MAA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,CAAC,EAAE,CAAC;YACX,GAAG,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;CACF;AAxTD,0CAwTC;AAEM,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,IAAI,CAAC;QACH,wEAAwE;QACxE,0EAA0E;QAC1E,MAAM,OAAO,GAAG,YAAE;aACf,WAAW,CAAC,aAAa,CAAC;aAC1B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;QAChD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,YAAE,CAAC,MAAM,CAAC,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,YAAY;IACd,CAAC;AACH,CAAC,CAAC;AAbW,QAAA,wBAAwB,4BAanC;AAEF,8EAA8E;AAC9E,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,gCAAwB,CAAC,CAAC;AAE7C;;;;GAIG;AACI,MAAM,cAAc,GAAG,KAAK,EAAE,WAAmB,EAAiB,EAAE;IACzE,IAAI,CAAC;QACH,MAAM,IAAA,sBAAS,EAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACP,gDAAgD;IAClD,CAAC;AACH,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB"}
@@ -32,7 +32,7 @@ export interface TelemetryContext {
32
32
  browserSessionId?: string;
33
33
  browserDistinctId?: string;
34
34
  }
35
- export type ChangeItem = StyleChangeItem | TextChangeItem | CommentChangeItem | ChatChangeItem;
35
+ export type ChangeItem = StyleChangeItem | TextChangeItem | CommentChangeItem | ChatChangeItem | VariantChangeItem;
36
36
  /** A CSS property change with an exact before/after diff */
37
37
  export interface StyleChangeItem {
38
38
  kind: 'style';
@@ -72,6 +72,41 @@ export interface ChatChangeItem {
72
72
  /** Base64 data-URL images attached as visual reference */
73
73
  images?: string[];
74
74
  }
75
+ /**
76
+ * A user-picked variant from the agent-driven variants flow.
77
+ * Carries either a unified diff (existing-project refinement / zero-to-one)
78
+ * or a new-project handoff payload pointing at a worktree on disk.
79
+ *
80
+ * Agents apply it the same way they apply any other ChangeItem: read the
81
+ * payload, apply via their own file-write tools.
82
+ */
83
+ export interface VariantChangeItem {
84
+ kind: 'variant';
85
+ /** sessionId of the agent-variants flow that produced this pick */
86
+ sourceSessionId: string;
87
+ /** workItemId of the chosen variant within that session */
88
+ variantId: string;
89
+ /** Human label (e.g. "Spring blur") for telemetry/UX */
90
+ variantLabel: string;
91
+ /** Where the user wants the result to land on disk */
92
+ destinationPath: string;
93
+ /** Number of files in the variant's diff or scaffold output */
94
+ changedFilesCount: number;
95
+ payload: {
96
+ kind: 'diff';
97
+ /** Unified diff vs the worktree baseline; apply with `git apply` */
98
+ diff: string;
99
+ /** Refinement target (element/file/route), when applicable */
100
+ target?: {
101
+ type: 'element' | 'file' | 'route';
102
+ ref: string;
103
+ };
104
+ } | {
105
+ kind: 'new-project';
106
+ /** Absolute path to the variant's worktree (rsync/copy source) */
107
+ sourceWorktreePath: string;
108
+ };
109
+ }
75
110
  /**
76
111
  * Minimal element identity for locating the right component in source files.
77
112
  * No computedStyles — Claude reads sourceFiles directly for better fidelity
@@ -1 +1 @@
1
- {"version":3,"file":"change-request-types.d.ts","sourceRoot":"","sources":["../../src/types/change-request-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB;;;OAGG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,C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CAAC;IACX,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
1
+ {"version":3,"file":"change-request-types.d.ts","sourceRoot":"","sources":["../../src/types/change-request-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB;;;OAGG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,MAAM,UAAU,GAClB,eAAe,GACf,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd,iBAAiB,CAAC;AAEtB,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,4DAA4D;AAC5D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,UAAU,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,UAAU,CAAC;IACpB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,SAAS,CAAC;IAChB,mEAAmE;IACnE,eAAe,EAAE,MAAM,CAAC;IACxB,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,eAAe,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EACH;QACE,IAAI,EAAE,MAAM,CAAC;QACb,oEAAoE;QACpE,IAAI,EAAE,MAAM,CAAC;QACb,8DAA8D;QAC9D,MAAM,CAAC,EAAE;YAAE,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;KAC9D,GACD;QACE,IAAI,EAAE,aAAa,CAAC;QACpB,kEAAkE;QAClE,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC;CACP;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,19 @@
1
+ import type { Framework } from '../services/ProjectDetectionService';
2
+ /** Dev command + default port per framework. Single source of truth. */
3
+ export declare const FRAMEWORK_DEV_CONFIG: Record<string, {
4
+ devCommand: string;
5
+ defaultPort: number;
6
+ }>;
7
+ /**
8
+ * Build the shell command to start a framework's dev server on a specific
9
+ * port. Honors how each framework actually accepts a port:
10
+ * - CRA reads from the PORT env var (no CLI flag)
11
+ * - npm passes flags after `--` separator: `npm run dev -- --port N`
12
+ * - yarn / pnpm pass them inline: `yarn dev --port N`
13
+ */
14
+ export declare function buildDevServerCommand(framework: Framework, packageManager: string, devCommand: string, port: number): {
15
+ cmd: string;
16
+ args: string[];
17
+ env: Record<string, string>;
18
+ };
19
+ //# sourceMappingURL=devServerCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devServerCommand.d.ts","sourceRoot":"","sources":["../../src/utils/devServerCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAErE,wEAAwE;AACxE,eAAO,MAAM,oBAAoB,EAAE,MAAM,CACvC,MAAM,EACN;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAQ5C,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GACX;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAgB9D"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FRAMEWORK_DEV_CONFIG = void 0;
4
+ exports.buildDevServerCommand = buildDevServerCommand;
5
+ /** Dev command + default port per framework. Single source of truth. */
6
+ exports.FRAMEWORK_DEV_CONFIG = {
7
+ nextjs: { devCommand: 'dev', defaultPort: 3000 },
8
+ vite: { devCommand: 'dev', defaultPort: 5173 },
9
+ cra: { devCommand: 'start', defaultPort: 3000 },
10
+ remix: { devCommand: 'dev', defaultPort: 3000 },
11
+ svelte: { devCommand: 'dev', defaultPort: 5173 },
12
+ static: { devCommand: '', defaultPort: 0 },
13
+ };
14
+ /**
15
+ * Build the shell command to start a framework's dev server on a specific
16
+ * port. Honors how each framework actually accepts a port:
17
+ * - CRA reads from the PORT env var (no CLI flag)
18
+ * - npm passes flags after `--` separator: `npm run dev -- --port N`
19
+ * - yarn / pnpm pass them inline: `yarn dev --port N`
20
+ */
21
+ function buildDevServerCommand(framework, packageManager, devCommand, port) {
22
+ if (framework === 'cra') {
23
+ const args = packageManager === 'npm' ? ['run', devCommand] : [devCommand];
24
+ return { cmd: packageManager, args, env: { PORT: String(port) } };
25
+ }
26
+ if (packageManager === 'npm') {
27
+ return {
28
+ cmd: 'npm',
29
+ args: ['run', devCommand, '--', '--port', String(port)],
30
+ env: {},
31
+ };
32
+ }
33
+ if (packageManager === 'yarn') {
34
+ return { cmd: 'yarn', args: [devCommand, '--port', String(port)], env: {} };
35
+ }
36
+ return { cmd: 'pnpm', args: [devCommand, '--port', String(port)], env: {} };
37
+ }
38
+ //# sourceMappingURL=devServerCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devServerCommand.js","sourceRoot":"","sources":["../../src/utils/devServerCommand.ts"],"names":[],"mappings":";;;AAsBA,sDAqBC;AAzCD,wEAAwE;AAC3D,QAAA,oBAAoB,GAG7B;IACF,MAAM,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE;IAChD,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE;IAC9C,GAAG,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE;IAC/C,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE;IAC/C,MAAM,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE;IAChD,MAAM,E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ME = "SKILL.md";
4
- export declare const CLAUDE_SKILL_CONTENT = "---\nname: rivet\ndescription: Open the Rivet visual editor to make visual or UI changes to a running web app. Invoke when the user says \"open rivet\", \"use rivet\", \"/rivet\", or wants to visually edit their app.\n---\n\n[//]: # (rivet-skill-version: 7)\n# Rivet Visual Editor\n\nUse these tools to make visual changes to a running web app and apply them to source code.\n\n## Starting a session\n\n1. Call `detect_project` \u2014 returns project info including `framework` and `projectPath`\n2. Call `open_visual_editor({ projectPath, framework })` \u2014 do NOT pass `startPort` or any port; the tool handles port selection automatically\n4. Tell the user: \"Rivet is ready \u2014 make your visual changes and click 'Send to Claude Code'.\"\n5. Start a background monitor to auto-detect when the user sends changes (see Monitoring below).\n6. You are now free to handle other requests while the monitor runs.\n\n## Monitoring for changes\n\nAfter opening the editor, start a Monitor to watch for changes. The `open_visual_editor` response includes `rivetPort` \u2014 use it:\n\n```\nMonitor:\n description: \"Rivet changes\"\n persistent: true\n command: while sleep 2; do if curl -sf http://localhost:RIVET_PORT/api/mcp/status | grep -q '\"hasPendingIntent\":true'; then echo \"Rivet: user sent changes\"; exit 0; fi; done\n```\n\nReplace `RIVET_PORT` with the actual `rivetPort` from the `open_visual_editor` response.\n\nWhen the monitor notifies you, apply the changes (see below). After applying, **restart the monitor** to watch for the next round.\n\n## Applying changes\n\nWhen the monitor notifies you (or the user asks manually):\n\n1. Call `get_pending_changes({ sessionId })` to pick up queued changes\n2. If `hasChanges: false`, tell the user no changes are pending yet\n3. If `hasChanges: true`, apply the changes to the source files listed in `sourceFiles`\n4. Call `get_pending_changes({ sessionId, message: \"summary of changes\", refresh_git: true })` so the Rivet UI updates\n5. Hot reload happens automatically after file changes\n6. Tell the user what you changed\n7. Restart the monitor to watch for the next round\n\n## Ending a session\n\nWhen the user says they're done, call `close_visual_editor({ sessionId })`.\n\n## Rules\n\n- **Always call `detect_project` first** \u2014 never assume the dev server is running\n- **Never auto-commit** after applying visual changes \u2014 let the user decide\n- The dev server stays running after `close_visual_editor`\n";
4
+ export declare const CLAUDE_SKILL_CONTENT = "---\nname: rivet\ndescription: Rivet \u2014 two flows. Visual editor for point-and-click UI changes (\"open rivet\", \"use rivet\", \"make a visual change\"). Agent-variants for exploring N parallel design directions before committing (\"create variants of X\", \"show me 3-5 options for X\", \"build me a settings page from scratch\", \"create a new Vite todo app\", \"scaffold a Next.js dashboard\"). Pick the flow based on the user's request \u2014 see \"Picking the flow\" below.\n---\n\n[//]: # (rivet-skill-version: 12)\n# Rivet\n\nTwo flows: the **visual editor** (point-and-click changes to a running web app) and the **agent-variants flow** (explore N parallel design directions before committing).\n\n## Picking the flow\n\n| User says | Flow |\n|---|---|\n| \"open rivet\", \"make a visual change to X\" | **Visual editor** (below) |\n| \"create variants of X\", \"show me 3-5 options for X\", \"explore approaches to X\" | **Agent variants** |\n| \"build me a settings page from scratch\", \"add a feature for Y\" | **Agent variants** (no `target`) |\n| \"create a new Vite todo app\", \"scaffold a Next.js dashboard\" | **Agent variants** (`projectContext.kind=fresh`) |\n\n## Visual Editor flow\n\n## Starting a session\n\n1. Call `detect_project` \u2014 returns project info including `framework` and `projectPath`\n2. Call `open_visual_editor({ projectPath, framework })` \u2014 do NOT pass `startPort` or any port; the tool handles port selection automatically\n4. Tell the user: \"Rivet is ready \u2014 make your visual changes and click 'Send to Claude Code'.\"\n5. Start a background monitor to auto-detect when the user sends changes (see Monitoring below).\n6. You are now free to handle other requests while the monitor runs.\n\n## Monitoring for changes\n\nAfter opening the editor, start a Monitor to watch for changes. The `open_visual_editor` response includes `rivetPort` \u2014 use it:\n\n```\nMonitor:\n description: \"Rivet changes\"\n persistent: true\n command: while sleep 2; do if curl -sf http://localhost:RIVET_PORT/api/mcp/status | grep -q '\"hasPendingIntent\":true'; then echo \"Rivet: user sent changes\"; exit 0; fi; done\n```\n\nReplace `RIVET_PORT` with the actual `rivetPort` from the `open_visual_editor` response.\n\nWhen the monitor notifies you, apply the changes (see below). After applying, **restart the monitor** to watch for the next round.\n\n## Applying changes\n\nWhen the monitor notifies you (or the user asks manually):\n\n1. Call `get_pending_changes({ sessionId })` to pick up queued changes\n2. If `hasChanges: false`, tell the user no changes are pending yet\n3. If `hasChanges: true`, apply the changes to the source files listed in `sourceFiles`\n4. Call `get_pending_changes({ sessionId, message: \"summary of changes\", refresh_git: true })` so the Rivet UI updates\n5. Hot reload happens automatically after file changes\n6. Tell the user what you changed\n7. Restart the monitor to watch for the next round\n\n## Ending a session\n\nWhen the user says they're done, call `close_visual_editor({ sessionId })`.\n\n## Rules\n\n- **Always call `detect_project` first** \u2014 never assume the dev server is running\n- **Never auto-commit** after applying visual changes \u2014 let the user decide\n- The dev server stays running after `close_visual_editor`\n\n---\n\n## Agent Variants flow\n\nFor requests like *\"create variants of X\"*, *\"show me 3-5 options for the dropdown\"*, *\"build me a settings page\"*, or *\"create a new Vite todo app\"* \u2014 DO NOT generate variants natively via the Task tool or parallel tool calls. Use this protocol so the user reviews design directions IN THIS CHAT, sees the actual code variants render in parallel, and picks based on the rendered code.\n\n### Step-by-step\n\n1. **Call `propose_variants`** with:\n - `prompt`: the user's request verbatim\n - `count`: 3-5 (default 4)\n - `target` (optional): `{ type: 'element'|'file'|'route', ref }` \u2014 set this for refinement requests pinned to a specific element/file/route\n - `projectContext` (optional):\n - For brand-new projects: `{ kind: 'fresh', workspacePath: '/abs/path', framework: 'vite'|'next'|'astro'|'remix' }`\n - Otherwise omit (defaults to existing project)\n\n Response: `{ sessionId, briefWorkItem }`. The brief work item carries an `input` blob; you must run it next.\n\n2. **Run the brief work item using YOUR own LLM** \u2014 generate `count` design briefs as `{ briefId, label, body }`. Label is short (\u2264 4 words). Body is 1-2 sentences describing the design direction. Do NOT call any Rivet tool; this is your LLM doing creative work.\n\n3. **Call `report_variant_briefs`** with the briefs, plus the `workItemId` and `attempt: 0`.\n\n3.5. **Ensure the Rivet visual editor is open.** If you haven't already opened it in this session, call `detect_project` then `open_visual_editor({ projectPath, framework })` now \u2014 DON'T wait for the user to ask. The user will need the iframe open to see variants render. If a session is already active (`open_visual_editor` returns a friendly error), just continue. Once the editor opens, the chip at the bottom-center of the iframe will show generation progress.\n\n4. **Show the briefs to the user IN CHAT** as a numbered list. Ask \"Look good or want me to adjust any of them?\" \u2014 DO NOT ask which one to pick. The pick happens AFTER they've seen the actual code.\n Example:\n > Here are 4 directions:\n > 1. **Spring blur** \u2014 Apple-style spring with ambient blur and soft edges\n > 2. **Linear sharp** \u2014 Crisp, fast, minimal padding\n > 3. **Notion soft** \u2014 Rounded, calm, neutral palette\n > 4. **Monoline editorial** \u2014 Tight typography, single accent color\n > Look good, or want me to adjust any of them?\n\n5. **Wait for the user's reply.** Affirmative (\"looks good\", \"go\", \"yep\") \u2192 proceed with all briefs. Tweak request (\"make #2 feel more like Linear\") \u2192 call `approve_variant_briefs` with `selections` containing `bodyOverride` per brief, OR re-run the brief work item with new framing. Reject all \u2192 call `cancel_variants` and start over.\n\n6. **Call `approve_variant_briefs({ sessionId, briefIds: [all chosen briefs] })`**. Response: `{ stage: 'work_items_ready', codeGenWorkItemIds: [...] }` \u2014 one work item per approved brief.\n\n7. **Lease the work** with `continue_variants({ sessionId, action: 'request_work' })`. Response has `leaseId`, `leaseTtlMs`, and `leasedWorkItems[]` \u2014 one per approved brief (plus a preceding `scaffold_base` for fresh-project; lease scaffold first, succeed it, then re-lease for the code-gens).\n\n8. **Run all leased code-gen items IN PARALLEL.** The preferred mechanism in Claude Code is to spawn one Task sub-agent per leased item in a single message \u2014 they execute concurrently. Each sub-agent:\n - Reads `input.briefBody` and `input.target`\n - Edits files in `input.worktreePath` (each variant has its own isolated worktree)\n - Calls `report_variant_complete({ sessionId, workItemId, leaseId, attempt, status: 'succeeded' })` itself. On failure, status `'failed'` with error description.\n\n9. **When all variants are done (`stage: 'ready'` or `'degraded'`), tell the user the variants are ready and explain how to compare them.** Each variant has its own dev server running in an isolated worktree. The Rivet iframe shows a chip at the bottom-center: prev/label/next/check/dismiss. The user cycles between the live, running variants by clicking prev/next (the iframe re-mounts onto the variant's dev server in ~50ms via proxy retarget). When they like one, they click the check on the chip \u2014 that commits the variant.\n Example reply:\n > Variants are ready \u2014 open the Rivet preview and use the chip at the bottom of the iframe to cycle between them. Click the checkmark on the one you want and I'll apply it.\n\n You do NOT need to print diffs in chat. The user picks visually in the iframe.\n\n10. **Watch for the user's pick.** Either:\n a) Use `watch_for_changes({ sessionId })` (existing tool) which blocks until the user clicks the check on the chip, OR\n b) Start a Monitor on `http://localhost:RIVET_PORT/api/mcp/status` like the visual-editor flow does.\n When changes arrive, call `get_pending_changes({ sessionId })` and you'll see a `VariantChangeItem` in `changes[]`.\n\n11. **Apply the variant.** From the `VariantChangeItem` payload:\n - `payload.kind === 'diff'` \u2192 `git apply` the unified diff against the user's project root\n - `payload.kind === 'new-project'` \u2192 copy the contents of `payload.sourceWorktreePath` to `destinationPath`\n Tell the user which variant you applied (use `variantLabel` from the change item).\n\n You can also call `commit_variant({ sessionId, variantId })` yourself if the user expressed their pick in chat instead of clicking the chip (\"go with #2\", \"the spring one\") \u2014 same effect, just routed through the agent rather than the chip.\n\n### Rules\n\n- **Never** generate variants natively (Task sub-agents, parallel tool calls, your own creative process) without going through `propose_variants` first.\n- Always pass the user's prompt verbatim \u2014 don't paraphrase.\n- Briefs are shown as PLAIN TEXT in chat. Do not render UI, open a browser tab, or fabricate a URL.\n- The user picks AFTER seeing the variants render LIVE in the iframe, not before. Step 4 is \"look good or adjust the briefs?\"; step 9 hands off to the iframe chip for visual cycling + commit.\n- Don't dump diffs in chat by default. The iframe chip is the primary review surface. If the user explicitly asks \"show me the diffs\", then print them.\n- Step 8 (parallel code-gen) is the only step where you fan out \u2014 every other step is one tool call.\n- For fresh-project, `scaffold_base` runs first; only after it succeeds are the `code_gen` items leasable. Loop `continue_variants(action='request_work')` after each transition.\n";
5
5
  //# sourceMappingURL=claude-skill.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"claude-skill.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/claude-skill.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAGtC,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD,eAAO,MAAM,oBAAoB,k8EAsDhC,CAAC"}
1
+ {"version":3,"file":"claude-skill.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/claude-skill.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAGvC,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD,eAAO,MAAM,oBAAoB,oxTAyIhC,CAAC"}
@@ -1,19 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CLAUDE_SKILL_CONTENT = exports.CLAUDE_SKILL_FILENAME = exports.CLAUDE_SKILL_DIR = exports.CLAUDE_SKILL_VERSION = void 0;
4
- exports.CLAUDE_SKILL_VERSION = 7;
4
+ exports.CLAUDE_SKILL_VERSION = 12;
5
5
  const CLAUDE_SKILL_VERSION_MARKER = `[//]: # (rivet-skill-version: ${exports.CLAUDE_SKILL_VERSION})`;
6
6
  exports.CLAUDE_SKILL_DIR = 'rivet';
7
7
  exports.CLAUDE_SKILL_FILENAME = 'SKILL.md';
8
8
  exports.CLAUDE_SKILL_CONTENT = `---
9
9
  name: rivet
10
- description: Open the Rivet visual editor to make visual or UI changes to a running web app. Invoke when the user says "open rivet", "use rivet", "/rivet", or wants to visually edit their app.
10
+ description: Rivet two flows. Visual editor for point-and-click UI changes ("open rivet", "use rivet", "make a visual change"). Agent-variants for exploring N parallel design directions before committing ("create variants of X", "show me 3-5 options for X", "build me a settings page from scratch", "create a new Vite todo app", "scaffold a Next.js dashboard"). Pick the flow based on the user's request — see "Picking the flow" below.
11
11
  ---
12
12
 
13
13
  ${CLAUDE_SKILL_VERSION_MARKER}
14
- # Rivet Visual Editor
14
+ # Rivet
15
15
 
16
- Use these tools to make visual changes to a running web app and apply them to source code.
16
+ Two flows: the **visual editor** (point-and-click changes to a running web app) and the **agent-variants flow** (explore N parallel design directions before committing).
17
+
18
+ ## Picking the flow
19
+
20
+ | User says | Flow |
21
+ |---|---|
22
+ | "open rivet", "make a visual change to X" | **Visual editor** (below) |
23
+ | "create variants of X", "show me 3-5 options for X", "explore approaches to X" | **Agent variants** |
24
+ | "build me a settings page from scratch", "add a feature for Y" | **Agent variants** (no \`target\`) |
25
+ | "create a new Vite todo app", "scaffold a Next.js dashboard" | **Agent variants** (\`projectContext.kind=fresh\`) |
26
+
27
+ ## Visual Editor flow
17
28
 
18
29
  ## Starting a session
19
30
 
@@ -59,5 +70,77 @@ When the user says they're done, call \`close_visual_editor({ sessionId })\`.
59
70
  - **Always call \`detect_project\` first** — never assume the dev server is running
60
71
  - **Never auto-commit** after applying visual changes — let the user decide
61
72
  - The dev server stays running after \`close_visual_editor\`
73
+
74
+ ---
75
+
76
+ ## Agent Variants flow
77
+
78
+ For requests like *"create variants of X"*, *"show me 3-5 options for the dropdown"*, *"build me a settings page"*, or *"create a new Vite todo app"* — DO NOT generate variants natively via the Task tool or parallel tool calls. Use this protocol so the user reviews design directions IN THIS CHAT, sees the actual code variants render in parallel, and picks based on the rendered code.
79
+
80
+ ### Step-by-step
81
+
82
+ 1. **Call \`propose_variants\`** with:
83
+ - \`prompt\`: the user's request verbatim
84
+ - \`count\`: 3-5 (default 4)
85
+ - \`target\` (optional): \`{ type: 'element'|'file'|'route', ref }\` — set this for refinement requests pinned to a specific element/file/route
86
+ - \`projectContext\` (optional):
87
+ - For brand-new projects: \`{ kind: 'fresh', workspacePath: '/abs/path', framework: 'vite'|'next'|'astro'|'remix' }\`
88
+ - Otherwise omit (defaults to existing project)
89
+
90
+ Response: \`{ sessionId, briefWorkItem }\`. The brief work item carries an \`input\` blob; you must run it next.
91
+
92
+ 2. **Run the brief work item using YOUR own LLM** — generate \`count\` design briefs as \`{ briefId, label, body }\`. Label is short (≤ 4 words). Body is 1-2 sentences describing the design direction. Do NOT call any Rivet tool; this is your LLM doing creative work.
93
+
94
+ 3. **Call \`report_variant_briefs\`** with the briefs, plus the \`workItemId\` and \`attempt: 0\`.
95
+
96
+ 3.5. **Ensure the Rivet visual editor is open.** If you haven't already opened it in this session, call \`detect_project\` then \`open_visual_editor({ projectPath, framework })\` now — DON'T wait for the user to ask. The user will need the iframe open to see variants render. If a session is already active (\`open_visual_editor\` returns a friendly error), just continue. Once the editor opens, the chip at the bottom-center of the iframe will show generation progress.
97
+
98
+ 4. **Show the briefs to the user IN CHAT** as a numbered list. Ask "Look good or want me to adjust any of them?" — DO NOT ask which one to pick. The pick happens AFTER they've seen the actual code.
99
+ Example:
100
+ > Here are 4 directions:
101
+ > 1. **Spring blur** — Apple-style spring with ambient blur and soft edges
102
+ > 2. **Linear sharp** — Crisp, fast, minimal padding
103
+ > 3. **Notion soft** — Rounded, calm, neutral palette
104
+ > 4. **Monoline editorial** — Tight typography, single accent color
105
+ > Look good, or want me to adjust any of them?
106
+
107
+ 5. **Wait for the user's reply.** Affirmative ("looks good", "go", "yep") → proceed with all briefs. Tweak request ("make #2 feel more like Linear") → call \`approve_variant_briefs\` with \`selections\` containing \`bodyOverride\` per brief, OR re-run the brief work item with new framing. Reject all → call \`cancel_variants\` and start over.
108
+
109
+ 6. **Call \`approve_variant_briefs({ sessionId, briefIds: [all chosen briefs] })\`**. Response: \`{ stage: 'work_items_ready', codeGenWorkItemIds: [...] }\` — one work item per approved brief.
110
+
111
+ 7. **Lease the work** with \`continue_variants({ sessionId, action: 'request_work' })\`. Response has \`leaseId\`, \`leaseTtlMs\`, and \`leasedWorkItems[]\` — one per approved brief (plus a preceding \`scaffold_base\` for fresh-project; lease scaffold first, succeed it, then re-lease for the code-gens).
112
+
113
+ 8. **Run all leased code-gen items IN PARALLEL.** The preferred mechanism in Claude Code is to spawn one Task sub-agent per leased item in a single message — they execute concurrently. Each sub-agent:
114
+ - Reads \`input.briefBody\` and \`input.target\`
115
+ - Edits files in \`input.worktreePath\` (each variant has its own isolated worktree)
116
+ - Calls \`report_variant_complete({ sessionId, workItemId, leaseId, attempt, status: 'succeeded' })\` itself. On failure, status \`'failed'\` with error description.
117
+
118
+ 9. **When all variants are done (\`stage: 'ready'\` or \`'degraded'\`), tell the user the variants are ready and explain how to compare them.** Each variant has its own dev server running in an isolated worktree. The Rivet iframe shows a chip at the bottom-center: prev/label/next/check/dismiss. The user cycles between the live, running variants by clicking prev/next (the iframe re-mounts onto the variant's dev server in ~50ms via proxy retarget). When they like one, they click the check on the chip — that commits the variant.
119
+ Example reply:
120
+ > Variants are ready — open the Rivet preview and use the chip at the bottom of the iframe to cycle between them. Click the checkmark on the one you want and I'll apply it.
121
+
122
+ You do NOT need to print diffs in chat. The user picks visually in the iframe.
123
+
124
+ 10. **Watch for the user's pick.** Either:
125
+ a) Use \`watch_for_changes({ sessionId })\` (existing tool) which blocks until the user clicks the check on the chip, OR
126
+ b) Start a Monitor on \`http://localhost:RIVET_PORT/api/mcp/status\` like the visual-editor flow does.
127
+ When changes arrive, call \`get_pending_changes({ sessionId })\` and you'll see a \`VariantChangeItem\` in \`changes[]\`.
128
+
129
+ 11. **Apply the variant.** From the \`VariantChangeItem\` payload:
130
+ - \`payload.kind === 'diff'\` → \`git apply\` the unified diff against the user's project root
131
+ - \`payload.kind === 'new-project'\` → copy the contents of \`payload.sourceWorktreePath\` to \`destinationPath\`
132
+ Tell the user which variant you applied (use \`variantLabel\` from the change item).
133
+
134
+ You can also call \`commit_variant({ sessionId, variantId })\` yourself if the user expressed their pick in chat instead of clicking the chip ("go with #2", "the spring one") — same effect, just routed through the agent rather than the chip.
135
+
136
+ ### Rules
137
+
138
+ - **Never** generate variants natively (Task sub-agents, parallel tool calls, your own creative process) without going through \`propose_variants\` first.
139
+ - Always pass the user's prompt verbatim — don't paraphrase.
140
+ - Briefs are shown as PLAIN TEXT in chat. Do not render UI, open a browser tab, or fabricate a URL.
141
+ - The user picks AFTER seeing the variants render LIVE in the iframe, not before. Step 4 is "look good or adjust the briefs?"; step 9 hands off to the iframe chip for visual cycling + commit.
142
+ - Don't dump diffs in chat by default. The iframe chip is the primary review surface. If the user explicitly asks "show me the diffs", then print them.
143
+ - Step 8 (parallel code-gen) is the only step where you fan out — every other step is one tool call.
144
+ - For fresh-project, \`scaffold_base\` runs first; only after it succeeds are the \`code_gen\` items leasable. Loop \`continue_variants(action='request_work')\` after each transition.
62
145
  `;
63
146
  //# sourceMappingURL=claude-skill.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"claude-skill.js","sourceRoot":"","sources":["../../../src/utils/skills/claude-skill.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,CAAC,CAAC;AACtC,MAAM,2BAA2B,GAAG,iCAAiC,4BAAoB,GAAG,CAAC;AAEhF,QAAA,gBAAgB,GAAG,OAAO,CAAC;AAC3B,QAAA,qBAAqB,GAAG,UAAU,CAAC;AAEnC,QAAA,oBAAoB,GAAG;;;;;EAKlC,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiD5B,CAAC"}
1
+ {"version":3,"file":"claude-skill.js","sourceRoot":"","sources":["../../../src/utils/skills/claude-skill.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,EAAE,CAAC;AACvC,MAAM,2BAA2B,GAAG,iCAAiC,4BAAoB,GAAG,CAAC;AAEhF,QAAA,gBAAgB,GAAG,OAAO,CAAC;AAC3B,QAAA,qBAAqB,GAAG,UAAU,CAAC;AAEnC,QAAA,oBAAoB,GAAG;;;;;EAKlC,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoI5B,CAAC"}
@@ -1,4 +1,4 @@
1
- export declare const CURSOR_RULES_VERSION = 7;
1
+ export declare const CURSOR_RULES_VERSION = 12;
2
2
  export declare const CURSOR_RULES_FILENAME = "rivet.mdc";
3
- export declare const CURSOR_RULES_CONTENT = "---\ndescription: Rivet visual editor \u2014 apply when the user says \"open rivet\", \"open the visual editor\", or wants to make visual/UI changes to their web app\nalwaysApply: false\n---\n<!-- rivet-rules-version: 7 -->\n# Rivet Visual Editor\n\nUse these tools to make visual changes to a running web app and apply them to source code.\n\n> Tip: type `@rivet.mdc` in chat to invoke this rule manually.\n\n## Starting a session\n\n1. Call `detect_project` \u2014 returns project info including `framework` and `projectPath`\n2. Call `open_visual_editor({ projectPath, framework })` \u2014 do NOT pass `startPort` or any port; the tool handles port selection automatically\n4. Tell the user: \"Rivet is ready \u2014 make your visual changes and click 'Send to Cursor'.\"\n5. Call `watch_for_changes({ sessionId })` to wait for the user's changes.\n\n## Watching and applying\n\n1. Call `watch_for_changes({ sessionId })` \u2014 blocks until the user clicks \"Send to Cursor\"\n2. If it times out (`hasChanges: false`), call it again to keep waiting\n3. When `hasChanges: true`, apply the changes to the source files listed in `sourceFiles`\n4. Call `get_pending_changes({ sessionId, message: \"summary of changes\", refresh_git: true })` so the Rivet UI updates\n5. Hot reload happens automatically after file changes\n6. Tell the user what you changed\n7. **STOP and ask the user:** \"Want me to keep watching for more Rivet changes, or go back to normal prompting?\"\n8. If they want to keep watching, go back to step 1\n\n## Ending a session\n\nWhen the user says they're done, call `close_visual_editor({ sessionId })`.\n\n## Rules\n\n- **Always call `detect_project` first** \u2014 never assume the dev server is running\n- **Always use `watch_for_changes`** to wait for user changes \u2014 do NOT use Monitor, background shell commands, or manual polling\n- **Never auto-commit** after applying visual changes \u2014 let the user decide\n- Always stop and ask before re-entering the watch loop\n- The dev server stays running after `close_visual_editor`\n";
3
+ export declare const CURSOR_RULES_CONTENT = "---\ndescription: Rivet \u2014 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\nalwaysApply: false\n---\n<!-- rivet-rules-version: 12 -->\n# Rivet\n\nTwo flows: the **visual editor** (point-and-click changes to a running web app) and the **agent-variants flow** (explore N parallel design directions before committing).\n\n> Tip: type `@rivet.mdc` in chat to invoke this rule manually.\n\n## Picking the flow\n\n| User says | Flow |\n|---|---|\n| \"open rivet\", \"make a visual change to X\" | **Visual editor** (below) |\n| \"create variants of X\", \"show me 3-5 options for X\", \"explore approaches to X\" | **Agent variants** |\n| \"build me a settings page from scratch\", \"add a feature for Y\" | **Agent variants** (no `target`) |\n| \"create a new Vite todo app\", \"scaffold a Next.js dashboard\" | **Agent variants** (`projectContext.kind=fresh`) |\n\n## Visual Editor flow\n\n## Starting a session\n\n1. Call `detect_project` \u2014 returns project info including `framework` and `projectPath`\n2. Call `open_visual_editor({ projectPath, framework })` \u2014 do NOT pass `startPort` or any port; the tool handles port selection automatically\n4. Tell the user: \"Rivet is ready \u2014 make your visual changes and click 'Send to Cursor'.\"\n5. Call `watch_for_changes({ sessionId })` to wait for the user's changes.\n\n## Watching and applying\n\n1. Call `watch_for_changes({ sessionId })` \u2014 blocks until the user clicks \"Send to Cursor\"\n2. If it times out (`hasChanges: false`), call it again to keep waiting\n3. When `hasChanges: true`, apply the changes to the source files listed in `sourceFiles`\n4. Call `get_pending_changes({ sessionId, message: \"summary of changes\", refresh_git: true })` so the Rivet UI updates\n5. Hot reload happens automatically after file changes\n6. Tell the user what you changed\n7. **STOP and ask the user:** \"Want me to keep watching for more Rivet changes, or go back to normal prompting?\"\n8. If they want to keep watching, go back to step 1\n\n## Ending a session\n\nWhen the user says they're done, call `close_visual_editor({ sessionId })`.\n\n## Rules\n\n- **Always call `detect_project` first** \u2014 never assume the dev server is running\n- **Always use `watch_for_changes`** to wait for user changes \u2014 do NOT use Monitor, background shell commands, or manual polling\n- **Never auto-commit** after applying visual changes \u2014 let the user decide\n- Always stop and ask before re-entering the watch loop\n- The dev server stays running after `close_visual_editor`\n\n---\n\n## Agent Variants flow\n\nFor requests like *\"create variants of X\"*, *\"show me 3-5 options for the dropdown\"*, *\"build me a settings page\"*, or *\"create a new Vite todo app\"* \u2014 DO NOT generate variants natively via parallel tool calls. Use this protocol so the user reviews design directions in chat, sees the actual code variants render in parallel, and picks based on the rendered code.\n\n### Step-by-step\n\n1. **Call `propose_variants`** with:\n - `prompt`: the user's request verbatim\n - `count`: 3-5 (default 4)\n - `target` (optional): `{ type: 'element'|'file'|'route', ref }` \u2014 set this for refinement requests pinned to a specific element/file/route\n - `projectContext` (optional):\n - For brand-new projects: `{ kind: 'fresh', workspacePath: '/abs/path', framework: 'vite'|'next'|'astro'|'remix' }`\n - Otherwise omit (defaults to existing project)\n\n Response: `{ sessionId, briefWorkItem }`. The brief work item carries an `input` blob; you must run it next.\n\n2. **Run the brief work item using YOUR own LLM** \u2014 generate `count` design briefs as `{ briefId, label, body }`. Label is short (\u2264 4 words). Body is 1-2 sentences describing the design direction. Do NOT call any Rivet tool; this is your LLM doing creative work.\n\n3. **Call `report_variant_briefs`** with the briefs, plus the `workItemId` and `attempt: 0`.\n\n3.5. **Ensure the Rivet visual editor is open.** If you haven't already opened it in this session, call `detect_project` then `open_visual_editor({ projectPath, framework })` now \u2014 DON'T wait for the user to ask. The user will need the iframe open to see variants render. If a session is already active (`open_visual_editor` returns a friendly error), just continue. Once the editor opens, the chip at the bottom-center of the iframe will show generation progress.\n\n4. **Show the briefs to the user IN CHAT** as a numbered list. Ask \"Look good or want me to adjust any of them?\" \u2014 DO NOT ask which one to pick. The pick happens AFTER they've seen the actual code.\n Example:\n > Here are 4 directions:\n > 1. **Spring blur** \u2014 Apple-style spring with ambient blur and soft edges\n > 2. **Linear sharp** \u2014 Crisp, fast, minimal padding\n > 3. **Notion soft** \u2014 Rounded, calm, neutral palette\n > 4. **Monoline editorial** \u2014 Tight typography, single accent color\n > Look good, or want me to adjust any of them?\n\n5. **Wait for the user's reply.** Affirmative (\"looks good\", \"go\", \"yep\") \u2192 proceed with all briefs. Tweak request (\"make #2 feel more like Linear\") \u2192 call `approve_variant_briefs` with `selections` containing `bodyOverride` per brief, OR re-run the brief work item with new framing. Reject all \u2192 call `cancel_variants` and start over.\n\n6. **Call `approve_variant_briefs({ sessionId, briefIds: [all chosen briefs] })`**. Response: `{ stage: 'work_items_ready', codeGenWorkItemIds: [...] }` \u2014 one work item per approved brief.\n\n7. **Lease the work** with `continue_variants({ sessionId, action: 'request_work' })`. Response has `leaseId`, `leaseTtlMs`, and `leasedWorkItems[]` \u2014 one per approved brief (plus a preceding `scaffold_base` for fresh-project; lease scaffold first, succeed it, then re-lease for the code-gens).\n\n8. **Run all leased code-gen items IN PARALLEL** via parallel tool calls in a single response. For each:\n - Read `input.briefBody` and `input.target`\n - Edit files in `input.worktreePath` (each variant has its own isolated worktree)\n - Call `report_variant_complete({ sessionId, workItemId, leaseId, attempt, status: 'succeeded' })`. On failure, status `'failed'` with error description.\n\n9. **When all variants are done (`stage: 'ready'` or `'degraded'`), tell the user the variants are ready and explain how to compare them.** Each variant has its own dev server running in an isolated worktree. The Rivet iframe shows a chip at the bottom-center: prev/label/next/check/dismiss. The user cycles between the live, running variants by clicking prev/next (the iframe re-mounts onto the variant's dev server in ~50ms via proxy retarget). When they like one, they click the check on the chip \u2014 that commits the variant.\n Example reply:\n > Variants are ready \u2014 open the Rivet preview and use the chip at the bottom of the iframe to cycle between them. Click the checkmark on the one you want and I'll apply it.\n\n You do NOT need to print diffs in chat. The user picks visually in the iframe.\n\n10. **Watch for the user's pick.** Either:\n a) Use `watch_for_changes({ sessionId })` (existing tool) which blocks until the user clicks the check on the chip, OR\n b) Poll `get_pending_changes({ sessionId })` periodically.\n When `hasChanges: true`, you'll see a `VariantChangeItem` in `changes[]`.\n\n11. **Apply the variant.** From the `VariantChangeItem` payload:\n - `payload.kind === 'diff'` \u2192 `git apply` the unified diff against the user's project root\n - `payload.kind === 'new-project'` \u2192 copy the contents of `payload.sourceWorktreePath` to `destinationPath`\n Tell the user which variant you applied (use `variantLabel` from the change item).\n\n You can also call `commit_variant({ sessionId, variantId })` yourself if the user expressed their pick in chat instead of clicking the chip (\"go with #2\", \"the spring one\") \u2014 same effect, just routed through the agent rather than the chip.\n\n### Rules\n\n- **Never** generate variants natively (Task tool, parallel tool calls, your own creative process) without going through `propose_variants` first.\n- Always pass the user's prompt verbatim \u2014 don't paraphrase.\n- Briefs are shown as PLAIN TEXT in chat. Do not render UI, open a browser tab, or fabricate a URL.\n- The user picks AFTER seeing the variants render LIVE in the iframe, not before. Step 4 is \"look good or adjust the briefs?\"; step 9 hands off to the iframe chip for visual cycling + commit.\n- Don't dump diffs in chat by default. The iframe chip is the primary review surface. If the user explicitly asks \"show me the diffs\", then print them.\n- Step 8 (parallel code-gen) is the only step where you fan out \u2014 every other step is one tool call.\n- For fresh-project, `scaffold_base` runs first; only after it succeeds are the `code_gen` items leasable. Loop `continue_variants(action='request_work')` after each transition.\n";
4
4
  //# sourceMappingURL=cursor-rules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cursor-rules.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/cursor-rules.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,qBAAqB,cAAc,CAAC;AAGjD,eAAO,MAAM,oBAAoB,qhEAwChC,CAAC"}
1
+ {"version":3,"file":"cursor-rules.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/cursor-rules.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,qBAAqB,cAAc,CAAC;AAGjD,eAAO,MAAM,oBAAoB,g+RA2HhC,CAAC"}