rivet-design 0.5.7 → 0.5.9

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 (50) hide show
  1. package/dist/index.d.ts.map +1 -1
  2. package/dist/index.js +219 -18
  3. package/dist/index.js.map +1 -1
  4. package/dist/mcp/server.d.ts +1 -5
  5. package/dist/mcp/server.d.ts.map +1 -1
  6. package/dist/mcp/server.js +20 -6
  7. package/dist/mcp/server.js.map +1 -1
  8. package/dist/server.d.ts +2 -0
  9. package/dist/server.d.ts.map +1 -1
  10. package/dist/server.js +12 -1
  11. package/dist/server.js.map +1 -1
  12. package/dist/utils/skillWriter.d.ts +10 -7
  13. package/dist/utils/skillWriter.d.ts.map +1 -1
  14. package/dist/utils/skillWriter.js +51 -53
  15. package/dist/utils/skillWriter.js.map +1 -1
  16. package/dist/utils/skills/claude-skill.d.ts +6 -0
  17. package/dist/utils/skills/claude-skill.d.ts.map +1 -0
  18. package/dist/utils/skills/claude-skill.js +49 -0
  19. package/dist/utils/skills/claude-skill.js.map +1 -0
  20. package/dist/utils/skills/cursor-rules.d.ts +5 -0
  21. package/dist/utils/skills/cursor-rules.d.ts.map +1 -0
  22. package/dist/utils/skills/cursor-rules.js +49 -0
  23. package/dist/utils/skills/cursor-rules.js.map +1 -0
  24. package/package.json +1 -1
  25. package/src/ui/dist/assets/{main-DAIpACRO.js → main-BOpG2zGa.js} +62 -62
  26. package/src/ui/dist/index.html +1 -1
  27. package/dist/routes/electron.d.ts +0 -8
  28. package/dist/routes/electron.d.ts.map +0 -1
  29. package/dist/routes/electron.js +0 -127
  30. package/dist/routes/electron.js.map +0 -1
  31. package/dist/services/ElectronBridgeService.d.ts +0 -149
  32. package/dist/services/ElectronBridgeService.d.ts.map +0 -1
  33. package/dist/services/ElectronBridgeService.js +0 -332
  34. package/dist/services/ElectronBridgeService.js.map +0 -1
  35. package/dist/services/FileModificationService.d.ts +0 -33
  36. package/dist/services/FileModificationService.d.ts.map +0 -1
  37. package/dist/services/FileModificationService.js +0 -111
  38. package/dist/services/FileModificationService.js.map +0 -1
  39. package/dist/services/LLMService.d.ts +0 -92
  40. package/dist/services/LLMService.d.ts.map +0 -1
  41. package/dist/services/LLMService.js +0 -371
  42. package/dist/services/LLMService.js.map +0 -1
  43. package/dist/services/ScriptInjectionService.d.ts +0 -8
  44. package/dist/services/ScriptInjectionService.d.ts.map +0 -1
  45. package/dist/services/ScriptInjectionService.js +0 -172
  46. package/dist/services/ScriptInjectionService.js.map +0 -1
  47. package/dist/types/proxy-types.d.ts +0 -39
  48. package/dist/types/proxy-types.d.ts.map +0 -1
  49. package/dist/types/proxy-types.js +0 -3
  50. package/dist/types/proxy-types.js.map +0 -1
@@ -1,33 +0,0 @@
1
- export type FileModification = {
2
- filePath: string;
3
- search: string;
4
- replacement: string;
5
- changes: string;
6
- };
7
- export type ModificationResult = {
8
- filePath: string;
9
- originalCode: string;
10
- modifiedCode: string;
11
- changes: string;
12
- modificationsApplied: number;
13
- };
14
- /**
15
- * Service for safely applying multiple modifications to files with proper locking
16
- * to prevent race conditions when multiple changes target the same file.
17
- */
18
- export declare class FileModificationService {
19
- private fileLocks;
20
- /**
21
- * Apply multiple modifications to files, handling concurrent access safely.
22
- * Modifications to the same file are chained sequentially.
23
- */
24
- applyModifications(modifications: FileModification[]): Promise<ModificationResult[]>;
25
- private groupModificationsByFile;
26
- private applyFileModifications;
27
- private processFileModifications;
28
- /**
29
- * Get the current lock status for debugging
30
- */
31
- getActiveLocks(): string[];
32
- }
33
- //# sourceMappingURL=FileModificationService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileModificationService.d.ts","sourceRoot":"","sources":["../../src/services/FileModificationService.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;;;GAGG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,SAAS,CAAkD;IAEnE;;;OAGG;IACG,kBAAkB,CACtB,aAAa,EAAE,gBAAgB,EAAE,GAChC,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAiBhC,OAAO,CAAC,wBAAwB;YAgBlB,sBAAsB;YAiCtB,wBAAwB;IAsDtC;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE;CAK3B"}
@@ -1,111 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FileModificationService = void 0;
7
- const promises_1 = require("fs/promises");
8
- const path_1 = __importDefault(require("path"));
9
- const logger_1 = require("../utils/logger");
10
- const log = (0, logger_1.createLogger)('FileModificationService');
11
- /**
12
- * Service for safely applying multiple modifications to files with proper locking
13
- * to prevent race conditions when multiple changes target the same file.
14
- */
15
- class FileModificationService {
16
- fileLocks = new Map();
17
- /**
18
- * Apply multiple modifications to files, handling concurrent access safely.
19
- * Modifications to the same file are chained sequentially.
20
- */
21
- async applyModifications(modifications) {
22
- const results = [];
23
- // Group modifications by file path
24
- const modsByFile = this.groupModificationsByFile(modifications);
25
- // Process each file's modifications
26
- const filePromises = Array.from(modsByFile.entries()).map(([filePath, fileMods]) => this.applyFileModifications(filePath, fileMods));
27
- const fileResults = await Promise.all(filePromises);
28
- results.push(...fileResults);
29
- return results;
30
- }
31
- groupModificationsByFile(modifications) {
32
- const grouped = new Map();
33
- for (const mod of modifications) {
34
- const normalizedPath = path_1.default.resolve(process.cwd(), mod.filePath);
35
- if (!grouped.has(normalizedPath)) {
36
- grouped.set(normalizedPath, []);
37
- }
38
- grouped.get(normalizedPath).push(mod);
39
- }
40
- return grouped;
41
- }
42
- async applyFileModifications(filePath, modifications) {
43
- const normalizedPath = path_1.default.resolve(process.cwd(), filePath);
44
- // Ensure sequential access to this file by chaining promises
45
- const previousOperation = this.fileLocks.get(normalizedPath) ||
46
- Promise.resolve({
47
- filePath: '',
48
- originalCode: '',
49
- modifiedCode: '',
50
- changes: '',
51
- modificationsApplied: 0,
52
- });
53
- const operation = previousOperation.then(async () => {
54
- return this.processFileModifications(normalizedPath, modifications);
55
- });
56
- this.fileLocks.set(normalizedPath, operation);
57
- // Clean up the lock after completion
58
- operation.finally(() => {
59
- if (this.fileLocks.get(normalizedPath) === operation) {
60
- this.fileLocks.delete(normalizedPath);
61
- }
62
- });
63
- return operation;
64
- }
65
- async processFileModifications(absolutePath, modifications) {
66
- const relativePath = path_1.default.relative(process.cwd(), absolutePath);
67
- log.debug(`Processing ${modifications.length} modification(s) for: ${relativePath}`);
68
- // Read the current file content
69
- const originalCode = await (0, promises_1.readFile)(absolutePath, 'utf-8');
70
- let currentCode = originalCode;
71
- let modificationsApplied = 0;
72
- const appliedChanges = [];
73
- // Apply modifications sequentially
74
- for (const mod of modifications) {
75
- if (currentCode.includes(mod.search)) {
76
- currentCode = currentCode.replace(mod.search, mod.replacement);
77
- modificationsApplied++;
78
- appliedChanges.push(mod.changes);
79
- log.debug(`Applied modification to ${relativePath}: ${mod.changes}`);
80
- }
81
- else {
82
- log.warn(`Search text not found in ${relativePath}, skipping: "${mod.search.substring(0, 100)}..."`);
83
- log.debug(`Full search text that failed: "${mod.search}"`);
84
- log.debug(`File content preview (first 500 chars): "${currentCode.substring(0, 500)}"`);
85
- }
86
- }
87
- // Write the final result
88
- if (modificationsApplied > 0) {
89
- await (0, promises_1.writeFile)(absolutePath, currentCode, 'utf-8');
90
- log.info(`Applied ${modificationsApplied}/${modifications.length} modifications to: ${relativePath}`);
91
- }
92
- else {
93
- log.warn(`No modifications applied to: ${relativePath}`);
94
- }
95
- return {
96
- filePath: relativePath,
97
- originalCode,
98
- modifiedCode: currentCode,
99
- changes: appliedChanges.join('; '),
100
- modificationsApplied,
101
- };
102
- }
103
- /**
104
- * Get the current lock status for debugging
105
- */
106
- getActiveLocks() {
107
- return Array.from(this.fileLocks.keys()).map((filePath) => path_1.default.relative(process.cwd(), filePath));
108
- }
109
- }
110
- exports.FileModificationService = FileModificationService;
111
- //# sourceMappingURL=FileModificationService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileModificationService.js","sourceRoot":"","sources":["../../src/services/FileModificationService.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAkD;AAClD,gDAAwB;AACxB,4CAA+C;AAE/C,MAAM,GAAG,GAAG,IAAA,qBAAY,EAAC,yBAAyB,CAAC,CAAC;AAiBpD;;;GAGG;AACH,MAAa,uBAAuB;IAC1B,SAAS,GAAG,IAAI,GAAG,EAAuC,CAAC;IAEnE;;;OAGG;IACH,KAAK,CAAC,kBAAkB,CACtB,aAAiC;QAEjC,MAAM,OAAO,GAAyB,EAAE,CAAC;QAEzC,mCAAmC;QACnC,MAAM,UAAU,GAAG,IAAI,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;QAEhE,oCAAoC;QACpC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CACvD,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAC1E,CAAC;QAEF,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC;QAE7B,OAAO,OAAO,CAAC;IACjB,CAAC;IAEO,wBAAwB,CAC9B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,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;gBAC3D,GAAG,CAAC,KAAK,CACP,4CAA4C,WAAW,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAC7E,CAAC;YACJ,CAAC;QACH,CAAC;QAED,yBAAyB;QACzB,IAAI,oBAAoB,GAAG,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAA,oBAAS,EAAC,YAAY,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;YACpD,GAAG,CAAC,IAAI,CACN,WAAW,oBAAoB,IAAI,aAAa,CAAC,MAAM,sBAAsB,YAAY,EAAE,CAC5F,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,gCAAgC,YAAY,EAAE,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO;YACL,QAAQ,EAAE,YAAY;YACtB,YAAY;YACZ,YAAY,EAAE,WAAW;YACzB,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;YAClC,oBAAoB;SACrB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CACxD,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CACvC,CAAC;IACJ,CAAC;CACF;AAzID,0DAyIC"}
@@ -1,92 +0,0 @@
1
- import { ElementContext } from '@rivet/core';
2
- import { TokenResponse } from '../types/token-types';
3
- export type AppliedModificationResult = {
4
- modifiedCode: Array<{
5
- filePath: string;
6
- modifiedCode: string;
7
- changes: string;
8
- }>;
9
- changes: string;
10
- };
11
- export type BE_BoundingRect = {
12
- x: number;
13
- y: number;
14
- width: number;
15
- height: number;
16
- top: number;
17
- left: number;
18
- right: number;
19
- bottom: number;
20
- };
21
- export type BE_ElementContext = {
22
- xpath: string;
23
- tagName: string;
24
- className: string;
25
- id: string;
26
- textContent: string;
27
- attributes: Record<string, string>;
28
- boundingRect: BE_BoundingRect;
29
- componentTree?: Array<{
30
- name: string;
31
- type: 'function' | 'class' | 'memo' | 'forwardRef' | 'context' | 'unknown';
32
- depth: number;
33
- props?: Record<string, unknown>;
34
- key?: string | number | null;
35
- }>;
36
- filePaths?: Array<{
37
- filePath: string;
38
- confidence: number;
39
- }>;
40
- };
41
- type CandidateFileContext = {
42
- filePath: string;
43
- code: string;
44
- };
45
- type LLMContext = {
46
- element: ElementContext;
47
- candidateFiles: CandidateFileContext[];
48
- };
49
- export type LLMRequest = {
50
- instruction: string;
51
- context: LLMContext;
52
- temperature?: number;
53
- };
54
- export type MultiElementLLMRequest = {
55
- instruction: string;
56
- context: LLMContext[];
57
- temperature?: number;
58
- image?: string;
59
- designTokens?: TokenResponse;
60
- };
61
- export declare class LLMService {
62
- private log;
63
- private gatewayUrl;
64
- private proxyUrl;
65
- private fileModService;
66
- private configManager;
67
- constructor(gatewayUrl?: string, proxyUrl?: string);
68
- /**
69
- * Refresh access token using refresh token
70
- */
71
- private refreshAccessToken;
72
- private makeGatewayRequest;
73
- modifyMultipleElements(request: MultiElementLLMRequest): Promise<AppliedModificationResult>;
74
- /**
75
- * Format design tokens into a readable prompt section
76
- */
77
- private formatDesignTokensSection;
78
- private buildMultiFilePrompt;
79
- private applyMultiFileModifications;
80
- /**
81
- * Type guard to validate PR description response
82
- */
83
- private isPRDescriptionResponse;
84
- /**
85
- * Generate a PR description from a git diff using LLM analysis
86
- * @param diff The git diff to analyze
87
- * @returns A markdown-formatted PR description with file-level technical summary
88
- */
89
- generatePRDescription(diff: string): Promise<string>;
90
- }
91
- export {};
92
- //# sourceMappingURL=LLMService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LLMService.d.ts","sourceRoot":"","sources":["../../src/services/LLMService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,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Property(exports, "__esModule", { value: true });
3
- exports.LLMService = void 0;
4
- const zod_1 = require("zod");
5
- const logger_1 = require("../utils/logger");
6
- const FileModificationService_1 = require("./FileModificationService");
7
- const ConfigManager_1 = require("./ConfigManager");
8
- const proxy_1 = require("../config/proxy");
9
- const ANTHROPIC_MODEL = 'claude-opus-4-5-20251101';
10
- const CLAUDE_MAX_OUTPUT_TOKENS = 16384;
11
- // Zod schema for structured LLM responses
12
- const CodeModificationSchema = zod_1.z.object({
13
- modifications: zod_1.z
14
- .array(zod_1.z.object({
15
- filePath: zod_1.z.string().describe('Target file path for this modification'),
16
- search: zod_1.z.string().describe('Exact text to find in this specific file'),
17
- replacement: zod_1.z.string().describe('Replacement text'),
18
- changes: zod_1.z.string().describe('Description of changes for this file'),
19
- }))
20
- .describe('Array of file-specific modifications (can be empty if no changes needed)'),
21
- });
22
- class LLMService {
23
- log = (0, logger_1.createLogger)('LLMService');
24
- gatewayUrl;
25
- proxyUrl;
26
- fileModService;
27
- configManager = (0, ConfigManager_1.getConfigManager)();
28
- constructor(gatewayUrl, proxyUrl) {
29
- this.gatewayUrl = gatewayUrl || proxy_1.GATEWAY_URL;
30
- this.proxyUrl = proxyUrl || proxy_1.PROXY_URL;
31
- this.fileModService = new FileModificationService_1.FileModificationService();
32
- this.log.info(`LLMService initialized with gateway URL: ${this.gatewayUrl}`);
33
- }
34
- /**
35
- * Refresh access token using refresh token
36
- */
37
- async refreshAccessToken() {
38
- const refreshToken = this.configManager.getRefreshToken();
39
- if (!refreshToken) {
40
- this.log.error('No refresh token available');
41
- return false;
42
- }
43
- try {
44
- this.log.info('Refreshing access token...');
45
- const response = await fetch(`${this.proxyUrl}/api/auth/refresh`, {
46
- method: 'POST',
47
- headers: {
48
- 'Content-Type': 'application/json',
49
- },
50
- body: JSON.stringify({ refreshToken }),
51
- });
52
- if (!response.ok) {
53
- this.log.error('Token refresh failed');
54
- return false;
55
- }
56
- const result = await response.json();
57
- if (result.success && result.token) {
58
- // Update stored tokens
59
- const email = this.configManager.getEmail() || '';
60
- this.configManager.setAuth(result.token, email, result.refreshToken);
61
- this.log.info('Access token refreshed successfully');
62
- return true;
63
- }
64
- return false;
65
- }
66
- catch (error) {
67
- this.log.error('Error refreshing token:', error);
68
- return false;
69
- }
70
- }
71
- async makeGatewayRequest(prompt, temperature, image, retryCount = 0) {
72
- // Get Supabase JWT from config
73
- const authToken = this.configManager.getAuthToken();
74
- if (!authToken) {
75
- throw new Error('Not authenticated. Please run `rivet login` to authenticate.');
76
- }
77
- // Build messages in Anthropic Messages API format
78
- const messages = [
79
- {
80
- role: 'user',
81
- content: image
82
- ? [
83
- {
84
- type: 'image',
85
- source: {
86
- type: 'base64',
87
- media_type: 'image/png',
88
- data: image,
89
- },
90
- },
91
- { type: 'text', text: prompt },
92
- ]
93
- : prompt,
94
- },
95
- ];
96
- try {
97
- // Call Rivet Gateway with Supabase JWT
98
- const response = await fetch(`${this.gatewayUrl}/v1/messages`, {
99
- method: 'POST',
100
- headers: {
101
- Authorization: `Bearer ${authToken}`,
102
- 'Content-Type': 'application/json',
103
- 'anthropic-version': '2023-06-01',
104
- },
105
- body: JSON.stringify({
106
- model: ANTHROPIC_MODEL,
107
- max_tokens: CLAUDE_MAX_OUTPUT_TOKENS,
108
- temperature: temperature || 0.7,
109
- messages,
110
- }),
111
- });
112
- // If 401 (token expired) and we haven't retried yet, try to refresh
113
- if (response.status === 401 && retryCount === 0) {
114
- this.log.warn('Token expired, attempting to refresh...');
115
- const refreshed = await this.refreshAccessToken();
116
- if (refreshed) {
117
- // Retry the request with new token
118
- return this.makeGatewayRequest(prompt, temperature, image, retryCount + 1);
119
- }
120
- throw new Error('Authentication expired. Please run `rivet logout` and `rivet login` to re-authenticate.');
121
- }
122
- // Handle 429 (rate limit / spend limit exceeded)
123
- if (response.status === 429) {
124
- const error = await response.json().catch(() => ({}));
125
- throw new Error(error.error || 'Usage limit exceeded. Please check your account.');
126
- }
127
- if (!response.ok) {
128
- const errorText = await response
129
- .text()
130
- .catch(() => 'Unable to read error');
131
- this.log.error('Gateway error response:', {
132
- status: response.status,
133
- statusText: response.statusText,
134
- body: errorText,
135
- });
136
- let errorData;
137
- try {
138
- errorData = JSON.parse(errorText);
139
- }
140
- catch {
141
- errorData = { error: errorText };
142
- }
143
- throw new Error(`Gateway request failed (${response.status}): ${errorData.error || response.statusText}`);
144
- }
145
- const result = await response.json();
146
- this.log.debug('Gateway response:', result);
147
- // Extract text content from Anthropic response
148
- const content = result.content?.[0]?.text;
149
- if (!content) {
150
- this.log.error('No content in response:', result);
151
- throw new Error('No response content from LLM');
152
- }
153
- // Parse JSON from response (LLM returns JSON string)
154
- try {
155
- return JSON.parse(content);
156
- }
157
- catch (parseError) {
158
- this.log.error('Failed to parse LLM JSON response:', {
159
- content: content.substring(0, 500),
160
- error: parseError,
161
- });
162
- throw new Error(`Failed to parse LLM response as JSON: ${parseError instanceof Error ? parseError.message : 'Unknown parse error'}`);
163
- }
164
- }
165
- catch (error) {
166
- this.log.error('Gateway request error (full):', error);
167
- if (error instanceof Error) {
168
- throw error; // Re-throw with original message
169
- }
170
- throw new Error(`Gateway request failed: ${String(error)}`);
171
- }
172
- }
173
- async modifyMultipleElements(request) {
174
- const { instruction, context, temperature, image, designTokens } = request;
175
- // Build prompt with all elements and their candidate files
176
- const prompt = this.buildMultiFilePrompt(instruction, context, image, designTokens);
177
- try {
178
- const result = await this.makeGatewayRequest(prompt, temperature, image);
179
- // Validate against multi-file schema
180
- const validation = CodeModificationSchema.safeParse(result);
181
- if (!validation.success) {
182
- this.log.error('Multi-file schema validation failed. Raw response:', result);
183
- throw new Error(`Invalid response format: ${JSON.stringify(validation.error.issues)}`);
184
- }
185
- const appliedModifications = await this.applyMultiFileModifications(validation.data.modifications);
186
- return {
187
- modifiedCode: appliedModifications,
188
- // TODO: Simplify this, changes aren't rendered in UI today
189
- changes: validation.data.modifications
190
- .map((mod) => mod.changes)
191
- .join('\n'),
192
- };
193
- }
194
- catch (error) {
195
- this.log.error('Multi-element modification error:', error);
196
- throw new Error(`Failed to modify multiple elements: ${error instanceof Error ? error.message : 'Unknown error'}`);
197
- }
198
- }
199
- /**
200
- * Format design tokens into a readable prompt section
201
- */
202
- formatDesignTokensSection(designTokens) {
203
- if (!designTokens) {
204
- return '';
205
- }
206
- const { registry, framework } = designTokens;
207
- let section = `\n\nAVAILABLE DESIGN TOKENS (${framework}):\n`;
208
- for (const [category, tokens] of Object.entries(registry)) {
209
- if (Object.keys(tokens).length === 0)
210
- continue;
211
- section += `\n${category.toUpperCase()}:\n`;
212
- for (const [tokenName, tokenValue] of Object.entries(tokens)) {
213
- if (typeof tokenValue === 'string') {
214
- // Flat token: name → value
215
- section += ` ${tokenName}: ${tokenValue}\n`;
216
- }
217
- else {
218
- // Nested token: name → { shade → value }
219
- section += ` ${tokenName}:\n`;
220
- for (const [shade, shadeValue] of Object.entries(tokenValue)) {
221
- const displayName = shade === 'DEFAULT' ? 'default' : shade;
222
- section += ` ${displayName}: ${shadeValue}\n`;
223
- }
224
- }
225
- }
226
- }
227
- section += `\nIMPORTANT: When making style changes, PREFER using these design tokens instead of hardcoded values.`;
228
- if (framework === 'tailwind') {
229
- section += `\nFor Tailwind: Use token names as utility classes (e.g., orange-500 → bg-orange-500, text-orange-500).`;
230
- }
231
- return section;
232
- }
233
- buildMultiFilePrompt(instruction, contexts, image, designTokens) {
234
- const imagePrompt = image
235
- ? '\n\nREFERENCE IMAGE: The user has provided a reference image. Use it to understand the desired design, styling, layout, or visual elements they want to implement.'
236
- : '';
237
- const tokensSection = this.formatDesignTokensSection(designTokens);
238
- return `You are a React/TypeScript expert. Analyze these files and apply changes where relevant.
239
-
240
- INSTRUCTION: ${instruction}${imagePrompt}${tokensSection}
241
-
242
- ELEMENTS AND CANDIDATE FILES:
243
- ${contexts
244
- .map((ctx, index) => {
245
- const filesSection = ctx.candidateFiles
246
- .map((file) => `
247
- ━━━ CANDIDATE: ${file.filePath} ━━━
248
- ${file.code}
249
- `)
250
- .join('\n');
251
- return `
252
- ━━━ ELEMENT ${index + 1}: <${ctx.element.tagName}> ━━━
253
- Classes: "${ctx.element.className || 'none'}"
254
- Text: "${ctx.element.textContent?.substring(0, 30) || 'none'}"
255
-
256
- CANDIDATE FILES FOR THIS ELEMENT:
257
- ${filesSection}
258
- `;
259
- })
260
- .join('\n')}
261
-
262
- REQUIREMENTS:
263
- 1. You can modify ANY of the candidate files provided
264
- 2. Choose the most appropriate file(s) based on the instruction and element context
265
- 3. Use multiple candidate files to understand the full component hierarchy and dependencies
266
- 4. Search strings must be UNIQUE (appear exactly once in file)
267
- 5. Include 2-3 lines of context to ensure uniqueness
268
- 6. Search strings must EXACTLY match the file content (including whitespace, indentation)
269
- 7. Copy search text character-for-character from the provided code
270
- 8. ALL 4 fields required: filePath, search, replacement, changes
271
-
272
- RETURN THIS JSON FORMAT:
273
- {
274
- "modifications": [
275
- {
276
- "filePath": "path/to/file.tsx",
277
- "search": "unique multi-line block",
278
- "replacement": "modified multi-line block",
279
- "changes": "description of what changed"
280
- }
281
- ]
282
- }
283
-
284
- GOOD: Search for entire JSX blocks with context
285
- GOOD: Modify underlying component code directly
286
- GOOD: Choose the most relevant candidate file based on the element and instruction
287
- BAD: Inline style changes like "style={{ marginTop: 10 }}"
288
- BAD: Single props like "title={flow.title}" (appears multiple times)
289
-
290
- If no files need modification, return: {"modifications": []}
291
-
292
- RETURN ONLY THE JSON - NO OTHER TEXT.`;
293
- }
294
- async applyMultiFileModifications(modifications) {
295
- this.log.debug(`Applying ${modifications.length} modification(s) using FileModificationService`);
296
- const results = await this.fileModService.applyModifications(modifications);
297
- return results.map((result) => ({
298
- filePath: result.filePath,
299
- modifiedCode: result.modifiedCode,
300
- changes: result.changes,
301
- }));
302
- }
303
- /**
304
- * Type guard to validate PR description response
305
- */
306
- isPRDescriptionResponse(value) {
307
- if (typeof value !== 'object' || value === null)
308
- return false;
309
- if (!('summary' in value))
310
- return false;
311
- if (!Array.isArray(value.summary))
312
- return false;
313
- return value.summary.every((item) => typeof item === 'object' &&
314
- item !== null &&
315
- typeof item.file === 'string' &&
316
- typeof item.description === 'string');
317
- }
318
- /**
319
- * Generate a PR description from a git diff using LLM analysis
320
- * @param diff The git diff to analyze
321
- * @returns A markdown-formatted PR description with file-level technical summary
322
- */
323
- async generatePRDescription(diff) {
324
- const prompt = `You are analyzing a git diff to generate a pull request description.
325
-
326
- GIT DIFF:
327
- ${diff}
328
-
329
- TASK:
330
- Generate a technical summary of the changes made in this diff. Focus on WHAT changed at the file level, not HOW it was implemented.
331
-
332
- REQUIREMENTS:
333
- 1. Group changes by file
334
- 2. For each file, describe what changed in 1-2 sentences
335
- 3. Use clear, technical language
336
- 4. Focus on user-facing changes and functionality, not implementation details
337
- 5. Format as markdown
338
-
339
- RETURN THIS JSON FORMAT:
340
- {
341
- "summary": [
342
- {
343
- "file": "path/to/file.tsx",
344
- "description": "Brief description of changes"
345
- }
346
- ]
347
- }
348
-
349
- RETURN ONLY THE JSON - NO OTHER TEXT.`;
350
- try {
351
- const result = await this.makeGatewayRequest(prompt, 0.3);
352
- // Validate response structure
353
- if (!this.isPRDescriptionResponse(result)) {
354
- this.log.error('Invalid PR description response format:', result);
355
- throw new Error('Invalid response format from LLM');
356
- }
357
- const summary = result.summary;
358
- // Format as markdown
359
- const markdownSummary = summary
360
- .map((item) => `- **${item.file}**: ${item.description}`)
361
- .join('\n');
362
- return `## Summary\n\n${markdownSummary}\n\n---\n\nšŸ¤– Generated with Rivet`;
363
- }
364
- catch (error) {
365
- this.log.error('Failed to generate PR description:', error);
366
- throw new Error(`Failed to generate PR description: ${error instanceof Error ? error.message : 'Unknown error'}`);
367
- }
368
- }
369
- }
370
- exports.LLMService = LLMService;
371
- //# sourceMappingURL=LLMService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LLMService.js","sourceRoot":"","sources":["../../src/services/LLMService.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,4CAA+C;AAE/C,uEAAoE;AACpE,mDAAmD;AACnD,2CA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CAAC,IAAI,CAAC,CAAC;YAEd,OAAO,iBAAiB,eAAe,oCAAoC,CAAC;QAC9E,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;YAC5D,MAAM,IAAI,KAAK,CACb,sCAAsC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CACjG,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAzcD,gCAycC"}
@@ -1,8 +0,0 @@
1
- export declare const RIVET_SCRIPT_REMOVAL_PATTERN: RegExp;
2
- export declare class ScriptInjectionService {
3
- private selectionScript;
4
- constructor();
5
- injectScript(projectPath: string, customInjectPath?: string, rivetPort?: number): Promise<string | null>;
6
- removeScript(projectPath: string, customInjectPath?: string): Promise<void>;
7
- }
8
- //# sourceMappingURL=ScriptInjectionService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ScriptInjectionService.d.ts","sourceRoot":"","sources":["../../src/services/ScriptInjectionService.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,4BAA4B,QACiC,CAAC;AAE3E,qBAAa,sBAAsB;IACjC,OAAO,CAAC,eAAe,CAAS;;IAa1B,YAAY,CAChB,WAAW,EAAE,MAAM,EACnB,gBAAgB,CAAC,EAAE,MAAM,EACzB,SAAS,GAAE,MAAa,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAkHnB,YAAY,CAChB,WAAW,EAAE,MAAM,EACnB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC;CAyCjB"}