rivet-design 0.1.0
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.
- package/LICENSE.md +674 -0
- package/README.md +112 -0
- package/bin/rivet.js +27 -0
- package/dist/index-core.d.ts +15 -0
- package/dist/index-core.d.ts.map +1 -0
- package/dist/index-core.js +38 -0
- package/dist/index-core.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +217 -0
- package/dist/index.js.map +1 -0
- package/dist/routes/components.d.ts +2 -0
- package/dist/routes/components.d.ts.map +1 -0
- package/dist/routes/components.js +58 -0
- package/dist/routes/components.js.map +1 -0
- package/dist/routes/git.d.ts +3 -0
- package/dist/routes/git.d.ts.map +1 -0
- package/dist/routes/git.js +52 -0
- package/dist/routes/git.js.map +1 -0
- package/dist/routes/modifications.d.ts +3 -0
- package/dist/routes/modifications.d.ts.map +1 -0
- package/dist/routes/modifications.js +241 -0
- package/dist/routes/modifications.js.map +1 -0
- package/dist/routes/selection.d.ts +2 -0
- package/dist/routes/selection.d.ts.map +1 -0
- package/dist/routes/selection.js +38 -0
- package/dist/routes/selection.js.map +1 -0
- package/dist/scripts/selection-script.js +724 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +93 -0
- package/dist/server.js.map +1 -0
- package/dist/services/ComponentSearchService.d.ts +12 -0
- package/dist/services/ComponentSearchService.d.ts.map +1 -0
- package/dist/services/ComponentSearchService.js +61 -0
- package/dist/services/ComponentSearchService.js.map +1 -0
- package/dist/services/FileModificationService.d.ts +29 -0
- package/dist/services/FileModificationService.d.ts.map +1 -0
- package/dist/services/FileModificationService.js +82 -0
- package/dist/services/FileModificationService.js.map +1 -0
- package/dist/services/LLMService.d.ts +60 -0
- package/dist/services/LLMService.d.ts.map +1 -0
- package/dist/services/LLMService.js +201 -0
- package/dist/services/LLMService.js.map +1 -0
- package/dist/services/LocalGitService.d.ts +33 -0
- package/dist/services/LocalGitService.d.ts.map +1 -0
- package/dist/services/LocalGitService.js +252 -0
- package/dist/services/LocalGitService.js.map +1 -0
- package/dist/services/ProjectDetectionService.d.ts +26 -0
- package/dist/services/ProjectDetectionService.d.ts.map +1 -0
- package/dist/services/ProjectDetectionService.js +147 -0
- package/dist/services/ProjectDetectionService.js.map +1 -0
- package/dist/services/ScriptInjectionService.d.ts +8 -0
- package/dist/services/ScriptInjectionService.d.ts.map +1 -0
- package/dist/services/ScriptInjectionService.js +178 -0
- package/dist/services/ScriptInjectionService.js.map +1 -0
- package/dist/services/SessionService.d.ts +26 -0
- package/dist/services/SessionService.d.ts.map +1 -0
- package/dist/services/SessionService.js +141 -0
- package/dist/services/SessionService.js.map +1 -0
- package/dist/types/change-types.d.ts +93 -0
- package/dist/types/change-types.d.ts.map +1 -0
- package/dist/types/change-types.js +4 -0
- package/dist/types/change-types.js.map +1 -0
- package/dist/types/proxy-types.d.ts +34 -0
- package/dist/types/proxy-types.d.ts.map +1 -0
- package/dist/types/proxy-types.js +3 -0
- package/dist/types/proxy-types.js.map +1 -0
- package/dist/types/types.d.ts +15 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +3 -0
- package/dist/types/types.js.map +1 -0
- package/dist/utils/logger.d.ts +20 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +51 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +86 -0
- package/src/ui/dist/assets/main-DuNgkeFM.js +105 -0
- package/src/ui/dist/assets/main-DzZ9GWvo.css +1 -0
- package/src/ui/dist/index.html +14 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.LocalGitService = exports.RIVET_BOT_EMAIL = exports.RIVET_BOT_NAME = void 0;
|
|
37
|
+
const simple_git_1 = require("simple-git");
|
|
38
|
+
const logger_1 = require("../utils/logger");
|
|
39
|
+
const MAX_HEADER_LENGTH = 72;
|
|
40
|
+
const SELECTION_SCRIPT_PATTERN = 'rivet-selection-script';
|
|
41
|
+
exports.RIVET_BOT_NAME = 'Rivet Bot';
|
|
42
|
+
exports.RIVET_BOT_EMAIL = 'noreply@rivet.dev';
|
|
43
|
+
const log = (0, logger_1.createLogger)('LocalGitService');
|
|
44
|
+
class LocalGitService {
|
|
45
|
+
getGit(projectPath) {
|
|
46
|
+
return (0, simple_git_1.simpleGit)(projectPath);
|
|
47
|
+
}
|
|
48
|
+
async configureDefaultIdentity(projectPath) {
|
|
49
|
+
const git = this.getGit(projectPath);
|
|
50
|
+
try {
|
|
51
|
+
// Set fallback git identity for commits when no user authentication is available
|
|
52
|
+
await git.addConfig('user.name', exports.RIVET_BOT_NAME);
|
|
53
|
+
await git.addConfig('user.email', exports.RIVET_BOT_EMAIL);
|
|
54
|
+
log.info(`Configured fallback git identity: ${exports.RIVET_BOT_NAME} <${exports.RIVET_BOT_EMAIL}>`);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
log.warn('Failed to configure git identity:', error);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async createBranch(projectPath, branchName) {
|
|
61
|
+
const git = this.getGit(projectPath);
|
|
62
|
+
// Check for uncommitted changes (excluding selection script changes)
|
|
63
|
+
const status = await git.status();
|
|
64
|
+
const filesToStash = await this.getTrackedFiles(projectPath, [
|
|
65
|
+
...status.modified,
|
|
66
|
+
...status.created,
|
|
67
|
+
...status.deleted
|
|
68
|
+
], SELECTION_SCRIPT_PATTERN);
|
|
69
|
+
if (filesToStash.length > 0) {
|
|
70
|
+
log.info(`Stashing ${filesToStash.length} files (excluding selection script changes)`);
|
|
71
|
+
// Stash only specific files, not everything
|
|
72
|
+
for (const file of filesToStash) {
|
|
73
|
+
await git.add(file);
|
|
74
|
+
}
|
|
75
|
+
await git.stash(['push', '-m', 'Rivet: Stash before new branch creation']);
|
|
76
|
+
}
|
|
77
|
+
// Ensure we're on the default branch (main/master)
|
|
78
|
+
const branches = await git.branch();
|
|
79
|
+
const defaultBranch = branches.all.includes('origin/main') ? 'main' :
|
|
80
|
+
branches.all.includes('origin/master') ? 'master' :
|
|
81
|
+
'main';
|
|
82
|
+
try {
|
|
83
|
+
await git.checkout([defaultBranch]);
|
|
84
|
+
log.info(`Checked out to ${defaultBranch}`);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
log.warn(`Could not checkout ${defaultBranch}: ${error}`);
|
|
88
|
+
throw new Error(`Failed to checkout ${defaultBranch}. Please ensure your working directory is clean.`);
|
|
89
|
+
}
|
|
90
|
+
// Pull latest changes from remote
|
|
91
|
+
try {
|
|
92
|
+
await git.pull('origin', defaultBranch);
|
|
93
|
+
log.info(`Pulled latest changes from origin/${defaultBranch}`);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
log.warn(`Could not pull latest changes: ${error}`);
|
|
97
|
+
// Don't fail - might be working offline or no remote changes
|
|
98
|
+
}
|
|
99
|
+
// Create and checkout new branch from clean default branch
|
|
100
|
+
await git.checkoutLocalBranch(branchName);
|
|
101
|
+
log.info(`Created clean branch: ${branchName} from ${defaultBranch}`);
|
|
102
|
+
}
|
|
103
|
+
async commitChange(projectPath, change, userInfo) {
|
|
104
|
+
const git = this.getGit(projectPath);
|
|
105
|
+
// Configure git identity if user info provided
|
|
106
|
+
if (userInfo) {
|
|
107
|
+
await git.addConfig('user.name', userInfo.name);
|
|
108
|
+
await git.addConfig('user.email', userInfo.email);
|
|
109
|
+
log.info(`Configured git identity: ${userInfo.name} <${userInfo.email}>`);
|
|
110
|
+
}
|
|
111
|
+
// Stage only tracked files (excluding selection script changes)
|
|
112
|
+
const status = await git.status();
|
|
113
|
+
const filesToCommit = await this.getTrackedFiles(projectPath, [
|
|
114
|
+
...status.modified,
|
|
115
|
+
...status.created,
|
|
116
|
+
...status.deleted
|
|
117
|
+
], SELECTION_SCRIPT_PATTERN);
|
|
118
|
+
for (const file of filesToCommit) {
|
|
119
|
+
await git.add(file);
|
|
120
|
+
}
|
|
121
|
+
// Commit with structured message
|
|
122
|
+
const message = this.generateCommitMessage(change);
|
|
123
|
+
const result = await git.commit(message);
|
|
124
|
+
log.info(`Committed change: ${result.commit}`);
|
|
125
|
+
return result.commit;
|
|
126
|
+
}
|
|
127
|
+
generateCommitMessage(change) {
|
|
128
|
+
const type = change.type === 'css' ? 'style' : (change.type === 'multi-element' ? 'feat' : 'feat');
|
|
129
|
+
// Create a short header that fits commitlint requirements (max 100 chars)
|
|
130
|
+
const prefix = `${type}: `;
|
|
131
|
+
const availableLength = MAX_HEADER_LENGTH - prefix.length;
|
|
132
|
+
// Truncate description if needed
|
|
133
|
+
let shortDescription = change.description.toLowerCase();
|
|
134
|
+
if (shortDescription.length > availableLength) {
|
|
135
|
+
shortDescription = shortDescription.substring(0, availableLength - 3).trim() + '...';
|
|
136
|
+
}
|
|
137
|
+
const header = `${prefix}${shortDescription}`;
|
|
138
|
+
// Generate element summary
|
|
139
|
+
const elementsSummary = change.elements.length === 1
|
|
140
|
+
? (() => {
|
|
141
|
+
const el = change.elements[0];
|
|
142
|
+
return `Element: ${el.tagName}${el.id ? '#' + el.id : ''}${el.className ? '.' + el.className.split(' ')[0] : ''}
|
|
143
|
+
XPath: ${el.xpath}`;
|
|
144
|
+
})()
|
|
145
|
+
: `Elements: ${change.elements.length} elements across ${new Set(change.elements.map(el => el.filePath)).size} files
|
|
146
|
+
${change.elements.map(el => `- ${el.tagName}${el.id ? '#' + el.id : ''}${el.className ? '.' + el.className.split(' ')[0] : ''} in ${el.filePath}`).join('\n')}`;
|
|
147
|
+
return `${header}
|
|
148
|
+
|
|
149
|
+
${elementsSummary}
|
|
150
|
+
|
|
151
|
+
Generated by Rivet Visual Editor`;
|
|
152
|
+
}
|
|
153
|
+
async getCurrentBranch(projectPath) {
|
|
154
|
+
const git = this.getGit(projectPath);
|
|
155
|
+
const status = await git.status();
|
|
156
|
+
return status.current || 'main';
|
|
157
|
+
}
|
|
158
|
+
async getStatus(projectPath) {
|
|
159
|
+
const git = this.getGit(projectPath);
|
|
160
|
+
const status = await git.status();
|
|
161
|
+
return {
|
|
162
|
+
hasChanges: !status.isClean(),
|
|
163
|
+
branch: status.current || 'main',
|
|
164
|
+
files: [...status.modified, ...status.created, ...status.deleted]
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
async hasUncommittedChanges(projectPath) {
|
|
168
|
+
const status = await this.getStatus(projectPath);
|
|
169
|
+
return status.hasChanges;
|
|
170
|
+
}
|
|
171
|
+
async getRepositoryInfo(projectPath) {
|
|
172
|
+
const git = this.getGit(projectPath);
|
|
173
|
+
const remotes = await git.getRemotes(true);
|
|
174
|
+
const origin = remotes.find(remote => remote.name === 'origin');
|
|
175
|
+
if (!origin?.refs?.fetch) {
|
|
176
|
+
throw new Error('No origin remote found');
|
|
177
|
+
}
|
|
178
|
+
const remoteUrl = origin.refs.fetch;
|
|
179
|
+
const repoInfo = this.parseRepoUrl(remoteUrl);
|
|
180
|
+
return {
|
|
181
|
+
...repoInfo,
|
|
182
|
+
remoteUrl
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
parseRepoUrl(url) {
|
|
186
|
+
// Handle HTTPS URLs (https://github.com/owner/repo.git)
|
|
187
|
+
const httpsMatch = url.match(/https:\/\/github\.com\/([^\/]+)\/([^\/]+?)(?:\.git)?$/);
|
|
188
|
+
if (httpsMatch) {
|
|
189
|
+
const [, owner, repo] = httpsMatch;
|
|
190
|
+
return {
|
|
191
|
+
owner,
|
|
192
|
+
repo,
|
|
193
|
+
provider: 'github',
|
|
194
|
+
baseUrl: 'https://github.com'
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
// Handle SSH URLs (git@github.com:owner/repo.git)
|
|
198
|
+
const sshMatch = url.match(/git@github\.com:([^\/]+)\/([^\/]+?)(?:\.git)?$/);
|
|
199
|
+
if (sshMatch) {
|
|
200
|
+
const [, owner, repo] = sshMatch;
|
|
201
|
+
return {
|
|
202
|
+
owner,
|
|
203
|
+
repo,
|
|
204
|
+
provider: 'github',
|
|
205
|
+
baseUrl: 'https://github.com'
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
throw new Error(`Unsupported repository URL format: ${url}`);
|
|
209
|
+
}
|
|
210
|
+
async pushBranch(projectPath, branchName) {
|
|
211
|
+
const git = this.getGit(projectPath);
|
|
212
|
+
try {
|
|
213
|
+
await git.push('origin', branchName, ['--set-upstream']);
|
|
214
|
+
log.info(`Pushed branch to origin: ${branchName}`);
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
log.error('Failed to push branch:', error);
|
|
218
|
+
throw new Error(`Failed to push branch ${branchName}: ${error}`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
async generatePullRequestUrl(projectPath, branchName, defaultBranch = 'main') {
|
|
222
|
+
const repoInfo = await this.getRepositoryInfo(projectPath);
|
|
223
|
+
return `${repoInfo.baseUrl}/${repoInfo.owner}/${repoInfo.repo}/compare/${defaultBranch}...${branchName}?expand=1`;
|
|
224
|
+
}
|
|
225
|
+
async getTrackedFiles(projectPath, files, excludePattern) {
|
|
226
|
+
if (!excludePattern) {
|
|
227
|
+
return files;
|
|
228
|
+
}
|
|
229
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
230
|
+
const path = await Promise.resolve().then(() => __importStar(require('path')));
|
|
231
|
+
return files.filter(file => {
|
|
232
|
+
const filePath = path.join(projectPath, file);
|
|
233
|
+
try {
|
|
234
|
+
if (!fs.existsSync(filePath))
|
|
235
|
+
return false;
|
|
236
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
237
|
+
const hasPattern = content.includes(excludePattern);
|
|
238
|
+
if (hasPattern) {
|
|
239
|
+
log.debug(`Excluding ${file} - contains ${excludePattern}`);
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
log.debug(`Could not check ${file}, including anyway`);
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
exports.LocalGitService = LocalGitService;
|
|
252
|
+
//# sourceMappingURL=LocalGitService.js.map
|
|
@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,YAAY,aAAa,MAAM,UAAU,WAAW,CAAC;IACpH,CAAC;IAEO,KAAK,CAAC,eAAe,CAAC,WAAmB,EAAE,KAAe,EAAE,cAAuB;QACzF,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,EAAE,GAAG,wDAAa,IAAI,GAAC,CAAC;QAC9B,MAAM,IAAI,GAAG,wDAAa,MAAM,GAAC,CAAC;QAElC,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;YAE9C,IAAI,CAAC;gBACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;oBAAE,OAAO,KAAK,CAAC;gBAE3C,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;gBAClD,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;gBAEpD,IAAI,UAAU,EAAE,CAAC;oBACf,GAAG,CAAC,KAAK,CAAC,aAAa,IAAI,eAAe,cAAc,EAAE,CAAC,CAAC;oBAC5D,OAAO,KAAK,CAAC;gBACf,CAAC;gBAED,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,GAAG,CAAC,KAAK,CAAC,mBAAmB,IAAI,oBAAoB,CAAC,CAAC;gBACvD,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApPD,0CAoPC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type Project = {
|
|
2
|
+
id: string;
|
|
3
|
+
path: string;
|
|
4
|
+
devServerPort: number;
|
|
5
|
+
status: 'detected' | 'connected' | 'error';
|
|
6
|
+
packageManager: 'npm' | 'yarn' | 'pnpm';
|
|
7
|
+
framework: Framework;
|
|
8
|
+
};
|
|
9
|
+
export type Framework = 'nextjs' | 'vite' | 'cra' | 'remix' | 'svelte';
|
|
10
|
+
export type FrameworkConfig = {
|
|
11
|
+
name: Framework;
|
|
12
|
+
packageJsonIndicators: string[];
|
|
13
|
+
configFiles: string[];
|
|
14
|
+
devCommand: string;
|
|
15
|
+
defaultPort: number;
|
|
16
|
+
};
|
|
17
|
+
export declare class ProjectDetectionService {
|
|
18
|
+
detectFramework(projectPath: string): Framework;
|
|
19
|
+
detectPackageManager(projectPath: string): Promise<'npm' | 'yarn' | 'pnpm'>;
|
|
20
|
+
findRunningDevServer(): Promise<{
|
|
21
|
+
port: number;
|
|
22
|
+
} | null>;
|
|
23
|
+
detectProject(projectPath: string): Promise<Project>;
|
|
24
|
+
isPortActive(port: number): Promise<boolean>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=ProjectDetectionService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectDetectionService.d.ts","sourceRoot":"","sources":["../../src/services/ProjectDetectionService.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC;IAC3C,cAAc,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IACxC,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEvE,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAwCF,qBAAa,uBAAuB;IAClC,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS;IA0CzC,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IAgB3E,oBAAoB,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAyBxD,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAuBpD,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAWnD"}
|
|
@@ -0,0 +1,147 @@
|
|
|
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.ProjectDetectionService = void 0;
|
|
7
|
+
const logger_1 = require("../utils/logger");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const log = (0, logger_1.createLogger)('ProjectDetectionService');
|
|
11
|
+
const FRAMEWORK_CONFIGS = [
|
|
12
|
+
{
|
|
13
|
+
name: 'nextjs',
|
|
14
|
+
packageJsonIndicators: ['next'],
|
|
15
|
+
configFiles: ['next.config.js', 'next.config.ts', 'next.config.mjs'],
|
|
16
|
+
devCommand: 'dev',
|
|
17
|
+
defaultPort: 3000,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'vite',
|
|
21
|
+
packageJsonIndicators: ['vite'],
|
|
22
|
+
configFiles: ['vite.config.js', 'vite.config.ts'],
|
|
23
|
+
devCommand: 'dev',
|
|
24
|
+
defaultPort: 5173,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'cra',
|
|
28
|
+
packageJsonIndicators: ['react-scripts'],
|
|
29
|
+
configFiles: [],
|
|
30
|
+
devCommand: 'start',
|
|
31
|
+
defaultPort: 3000,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'remix',
|
|
35
|
+
packageJsonIndicators: ['@remix-run/'],
|
|
36
|
+
configFiles: ['remix.config.js'],
|
|
37
|
+
devCommand: 'dev',
|
|
38
|
+
defaultPort: 3000,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'svelte',
|
|
42
|
+
packageJsonIndicators: ['@sveltejs/kit', 'svelte'],
|
|
43
|
+
configFiles: ['svelte.config.js'],
|
|
44
|
+
devCommand: 'dev',
|
|
45
|
+
defaultPort: 5173,
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
class ProjectDetectionService {
|
|
49
|
+
detectFramework(projectPath) {
|
|
50
|
+
const packageJsonPath = path_1.default.join(projectPath, 'package.json');
|
|
51
|
+
log.debug(`Looking for package.json at: ${packageJsonPath}`);
|
|
52
|
+
log.debug(`Project path: ${projectPath}`);
|
|
53
|
+
if (!fs_1.default.existsSync(packageJsonPath)) {
|
|
54
|
+
throw new Error(`No package.json found at ${packageJsonPath}`);
|
|
55
|
+
}
|
|
56
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf8'));
|
|
57
|
+
const dependencies = {
|
|
58
|
+
...packageJson.dependencies,
|
|
59
|
+
...packageJson.devDependencies
|
|
60
|
+
};
|
|
61
|
+
// Check each framework config
|
|
62
|
+
for (const config of FRAMEWORK_CONFIGS) {
|
|
63
|
+
const hasIndicator = config.packageJsonIndicators.some(indicator => {
|
|
64
|
+
return Object.keys(dependencies).some(dep => dep.includes(indicator));
|
|
65
|
+
});
|
|
66
|
+
if (hasIndicator) {
|
|
67
|
+
// Double-check with config files if they exist
|
|
68
|
+
const hasConfigFile = config.configFiles.length === 0 ||
|
|
69
|
+
config.configFiles.some(configFile => fs_1.default.existsSync(path_1.default.join(projectPath, configFile)));
|
|
70
|
+
if (hasConfigFile) {
|
|
71
|
+
log.info(`Detected ${config.name} framework`);
|
|
72
|
+
return config.name;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
log.debug('Unknown framework, defaulting to Next.js');
|
|
77
|
+
return 'nextjs';
|
|
78
|
+
}
|
|
79
|
+
async detectPackageManager(projectPath) {
|
|
80
|
+
// Check for lockfiles
|
|
81
|
+
if (fs_1.default.existsSync(path_1.default.join(projectPath, 'yarn.lock'))) {
|
|
82
|
+
return 'yarn';
|
|
83
|
+
}
|
|
84
|
+
if (fs_1.default.existsSync(path_1.default.join(projectPath, 'pnpm-lock.yaml'))) {
|
|
85
|
+
return 'pnpm';
|
|
86
|
+
}
|
|
87
|
+
if (fs_1.default.existsSync(path_1.default.join(projectPath, 'package-lock.json'))) {
|
|
88
|
+
return 'npm';
|
|
89
|
+
}
|
|
90
|
+
// Default to npm
|
|
91
|
+
return 'npm';
|
|
92
|
+
}
|
|
93
|
+
async findRunningDevServer() {
|
|
94
|
+
const commonPorts = [3000, 3001, 5173, 8080, 4200, 8000];
|
|
95
|
+
for (const port of commonPorts) {
|
|
96
|
+
try {
|
|
97
|
+
const response = await fetch(`http://localhost:${port}`, {
|
|
98
|
+
method: 'HEAD',
|
|
99
|
+
signal: AbortSignal.timeout(5000)
|
|
100
|
+
});
|
|
101
|
+
if (response.ok) {
|
|
102
|
+
// Try to detect framework from response headers or content
|
|
103
|
+
log.info(`Found running dev server on port ${port}`);
|
|
104
|
+
return { port };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
// Port not accessible, continue checking
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
log.debug('No running dev server found');
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
async detectProject(projectPath) {
|
|
116
|
+
log.info(`Detecting project in: ${projectPath}`);
|
|
117
|
+
const packageManager = await this.detectPackageManager(projectPath);
|
|
118
|
+
const runningServer = await this.findRunningDevServer();
|
|
119
|
+
if (!runningServer) {
|
|
120
|
+
throw new Error('No running dev server found. Please start your dev server first (e.g., npm run dev)');
|
|
121
|
+
}
|
|
122
|
+
const project = {
|
|
123
|
+
id: path_1.default.basename(projectPath),
|
|
124
|
+
framework: this.detectFramework(projectPath),
|
|
125
|
+
path: projectPath,
|
|
126
|
+
devServerPort: runningServer.port,
|
|
127
|
+
status: 'detected',
|
|
128
|
+
packageManager
|
|
129
|
+
};
|
|
130
|
+
log.info(`Detected project:`, project);
|
|
131
|
+
return project;
|
|
132
|
+
}
|
|
133
|
+
async isPortActive(port) {
|
|
134
|
+
try {
|
|
135
|
+
const response = await fetch(`http://localhost:${port}`, {
|
|
136
|
+
method: 'HEAD',
|
|
137
|
+
signal: AbortSignal.timeout(1000)
|
|
138
|
+
});
|
|
139
|
+
return response.ok;
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.ProjectDetectionService = ProjectDetectionService;
|
|
147
|
+
//# sourceMappingURL=ProjectDetectionService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectDetectionService.js","sourceRoot":"","sources":["../../src/services/ProjectDetectionService.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAC/C,4CAAoB;AACpB,gDAAwB;AAExB,MAAM,GAAG,GAAG,IAAA,qBAAY,EAAC,yBAAyB,CAAC,CAAC;AAqBpD,MAAM,iBAAiB,GAAsB;IAC3C;QACE,IAAI,EAAE,QAAQ;QACd,qBAAqB,EAAE,CAAC,MAAM,CAAC;QAC/B,WAAW,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,CAAC;QACpE,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,IAAI;KAClB;IACD;QACE,IAAI,EAAE,MAAM;QACZ,qBAAqB,EA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Q,CAAC,WAAW,CAAC;YAC9B,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC;YAC5C,IAAI,EAAE,WAAW;YACjB,aAAa,EAAE,aAAa,CAAC,IAAI;YACjC,MAAM,EAAE,UAAU;YAClB,cAAc;SACf,CAAC;QAEF,GAAG,CAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;QACvC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAY;QAC7B,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,oBAAoB,IAAI,EAAE,EAAE;gBACvD,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;aAClC,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,EAAE,CAAC;QACrB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAtHD,0DAsHC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Framework } from './ProjectDetectionService';
|
|
2
|
+
export declare class ScriptInjectionService {
|
|
3
|
+
private selectionScript;
|
|
4
|
+
constructor();
|
|
5
|
+
injectScript(projectPath: string, framework: Framework, customInjectPath?: string, rivetPort?: number): Promise<void>;
|
|
6
|
+
removeScript(projectPath: string, framework: Framework, customInjectPath?: string): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=ScriptInjectionService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScriptInjectionService.d.ts","sourceRoot":"","sources":["../../src/services/ScriptInjectionService.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAgCtD,qBAAa,sBAAsB;IACjC,OAAO,CAAC,eAAe,CAAS;;IAa1B,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,CAAC,EAAE,MAAM,EAAE,SAAS,GAAE,MAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IA6G3H,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CA0CxG"}
|
|
@@ -0,0 +1,178 @@
|
|
|
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.ScriptInjectionService = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const logger_1 = require("../utils/logger");
|
|
10
|
+
const log = (0, logger_1.createLogger)('ScriptInjectionService');
|
|
11
|
+
const STANDARD_NEXT_INJECT_PATHS = [
|
|
12
|
+
'app/layout.tsx',
|
|
13
|
+
'src/app/layout.tsx',
|
|
14
|
+
'pages/_app.tsx',
|
|
15
|
+
'src/pages/_app.tsx',
|
|
16
|
+
// Monorepo patterns
|
|
17
|
+
'apps/web/app/layout.tsx',
|
|
18
|
+
'apps/web/src/app/layout.tsx',
|
|
19
|
+
'apps/web/pages/_app.tsx',
|
|
20
|
+
'apps/web/src/pages/_app.tsx',
|
|
21
|
+
'apps/frontend/app/layout.tsx',
|
|
22
|
+
'apps/frontend/src/app/layout.tsx',
|
|
23
|
+
'apps/frontend/pages/_app.tsx',
|
|
24
|
+
'apps/frontend/src/pages/_app.tsx',
|
|
25
|
+
'packages/web/app/layout.tsx',
|
|
26
|
+
'packages/web/src/app/layout.tsx',
|
|
27
|
+
'packages/web/pages/_app.tsx',
|
|
28
|
+
'packages/web/src/pages/_app.tsx'
|
|
29
|
+
];
|
|
30
|
+
const STANDARD_VITE_INJECT_PATHS = [
|
|
31
|
+
'index.html',
|
|
32
|
+
// Monorepo patterns
|
|
33
|
+
'apps/web/index.html',
|
|
34
|
+
'apps/frontend/index.html',
|
|
35
|
+
'packages/web/index.html'
|
|
36
|
+
];
|
|
37
|
+
class ScriptInjectionService {
|
|
38
|
+
constructor() {
|
|
39
|
+
// Load the selection script
|
|
40
|
+
try {
|
|
41
|
+
const scriptPath = path_1.default.join(__dirname, '../scripts/selection-script.js');
|
|
42
|
+
this.selectionScript = fs_1.default.readFileSync(scriptPath, 'utf8');
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
log.error('Failed to load selection script:', error);
|
|
46
|
+
this.selectionScript = '// Selection script not found';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async injectScript(projectPath, framework, customInjectPath, rivetPort = 4000) {
|
|
50
|
+
log.info('Injecting Rivet selection script...');
|
|
51
|
+
// Use custom inject path if provided, otherwise determine paths based on framework
|
|
52
|
+
let injectPaths;
|
|
53
|
+
if (customInjectPath) {
|
|
54
|
+
log.info(`Using custom inject path: ${customInjectPath}`);
|
|
55
|
+
injectPaths = [customInjectPath];
|
|
56
|
+
}
|
|
57
|
+
else if (framework === 'nextjs') {
|
|
58
|
+
injectPaths = STANDARD_NEXT_INJECT_PATHS;
|
|
59
|
+
}
|
|
60
|
+
else if (framework === 'vite') {
|
|
61
|
+
injectPaths = STANDARD_VITE_INJECT_PATHS;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// Default to Next.js paths for unknown frameworks
|
|
65
|
+
log.debug('Unknown framework, defaulting to Next.js paths');
|
|
66
|
+
injectPaths = STANDARD_NEXT_INJECT_PATHS;
|
|
67
|
+
}
|
|
68
|
+
const layoutPaths = injectPaths.map(relativePath => path_1.default.join(projectPath, relativePath));
|
|
69
|
+
let layoutPath = null;
|
|
70
|
+
for (const testPath of layoutPaths) {
|
|
71
|
+
log.debug(`🔍 Checking if file exists: ${testPath}`);
|
|
72
|
+
if (fs_1.default.existsSync(testPath)) {
|
|
73
|
+
layoutPath = testPath;
|
|
74
|
+
log.info(`✅ Found layout file at: ${layoutPath}`);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
log.debug(`❌ File does not exist: ${testPath}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (!layoutPath) {
|
|
82
|
+
log.warn('⚠️ No layout file found, skipping script injection');
|
|
83
|
+
log.debug('📂 Searched paths:', layoutPaths);
|
|
84
|
+
log.debug('🔍 Files in project root:');
|
|
85
|
+
try {
|
|
86
|
+
const rootFiles = fs_1.default.readdirSync(projectPath).filter(f => f.endsWith('.tsx') || f.endsWith('.ts') || f.endsWith('.html'));
|
|
87
|
+
log.debug(' ', rootFiles);
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
log.debug(' Could not read project root');
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
log.debug(`📖 Reading layout file: ${layoutPath}`);
|
|
96
|
+
const layoutContent = fs_1.default.readFileSync(layoutPath, 'utf8');
|
|
97
|
+
log.debug(`📄 Layout file length: ${layoutContent.length} characters`);
|
|
98
|
+
if (layoutContent.includes('rivet-selection-script')) {
|
|
99
|
+
log.info('✅ Selection script already injected');
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
log.debug('💉 Script not found, proceeding with injection...');
|
|
103
|
+
const scriptTag = `<script src="http://localhost:${rivetPort}/api/selection-script" id="rivet-selection-script"></script>`;
|
|
104
|
+
log.debug(`📝 Created script tag (${scriptTag.length} characters)`);
|
|
105
|
+
let modifiedContent;
|
|
106
|
+
let injectionMethod = '';
|
|
107
|
+
if (layoutContent.includes('</head>')) {
|
|
108
|
+
modifiedContent = layoutContent.replace('</head>', ` ${scriptTag}\n </head>`);
|
|
109
|
+
injectionMethod = 'before </head>';
|
|
110
|
+
}
|
|
111
|
+
else if (layoutContent.includes('</body>')) {
|
|
112
|
+
modifiedContent = layoutContent.replace('</body>', ` ${scriptTag}\n </body>`);
|
|
113
|
+
injectionMethod = 'before </body>';
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
// For React components, inject at the end of the return statement
|
|
117
|
+
const returnMatch = layoutContent.match(/return\s*\(\s*(<[^>]+>)/);
|
|
118
|
+
if (returnMatch) {
|
|
119
|
+
const firstTag = returnMatch[1];
|
|
120
|
+
modifiedContent = layoutContent.replace(firstTag, firstTag + `\n ${scriptTag}`);
|
|
121
|
+
injectionMethod = `after first tag: ${firstTag}`;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
log.warn('⚠️ Could not find injection point in layout file');
|
|
125
|
+
log.debug('📄 Layout file preview (first 500 chars):');
|
|
126
|
+
log.debug(layoutContent.substring(0, 500));
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
log.debug(`🎯 Injection method: ${injectionMethod}`);
|
|
131
|
+
// Write back the modified content
|
|
132
|
+
log.debug(`💾 Writing modified content back to: ${layoutPath}`);
|
|
133
|
+
fs_1.default.writeFileSync(layoutPath, modifiedContent);
|
|
134
|
+
log.info(`✅ Selection script injected into ${layoutPath} (${injectionMethod})`);
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
log.error('Failed to inject selection script:', error);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
async removeScript(projectPath, framework, customInjectPath) {
|
|
141
|
+
log.info('Removing Rivet selection script...');
|
|
142
|
+
// Use custom inject path if provided, otherwise determine paths based on framework
|
|
143
|
+
let injectPaths;
|
|
144
|
+
if (customInjectPath) {
|
|
145
|
+
log.info(`Using custom inject path for removal: ${customInjectPath}`);
|
|
146
|
+
injectPaths = [customInjectPath];
|
|
147
|
+
}
|
|
148
|
+
else if (framework === 'nextjs') {
|
|
149
|
+
injectPaths = STANDARD_NEXT_INJECT_PATHS;
|
|
150
|
+
}
|
|
151
|
+
else if (framework === 'vite') {
|
|
152
|
+
injectPaths = STANDARD_VITE_INJECT_PATHS;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
injectPaths = STANDARD_NEXT_INJECT_PATHS;
|
|
156
|
+
}
|
|
157
|
+
const layoutPaths = injectPaths.map(relativePath => path_1.default.join(projectPath, relativePath));
|
|
158
|
+
for (const layoutPath of layoutPaths) {
|
|
159
|
+
if (!fs_1.default.existsSync(layoutPath))
|
|
160
|
+
continue;
|
|
161
|
+
try {
|
|
162
|
+
const layoutContent = fs_1.default.readFileSync(layoutPath, 'utf8');
|
|
163
|
+
// Remove the injected script
|
|
164
|
+
if (layoutContent.includes('rivet-selection-script')) {
|
|
165
|
+
// Remove the entire script tag and surrounding whitespace
|
|
166
|
+
const modifiedContent = layoutContent.replace(/\s*<script[^>]*id="rivet-selection-script"[^>]*>[\s\S]*?<\/script>\s*/g, '');
|
|
167
|
+
fs_1.default.writeFileSync(layoutPath, modifiedContent);
|
|
168
|
+
log.info(`Selection script removed from ${layoutPath}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
log.error(`Failed to remove selection script from ${layoutPath}:`, error);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.ScriptInjectionService = ScriptInjectionService;
|
|
178
|
+
//# sourceMappingURL=ScriptInjectionService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScriptInjectionService.js","sourceRoot":"","sources":["../../src/services/ScriptInjectionService.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,4CAA+C;AAG/C,MAAM,GAAG,GAAG,IAAA,qBAAY,EAAC,wBAAwB,CAAC,CAAC;AAEnD,MAAM,0BAA0B,GAAG;IACjC,gBAAgB;IAChB,oBAAoB;IACpB,gBAAgB;IAChB,oBAAoB;IACpB,oBAAoB;IACpB,yBAAyB;IACzB,6BAA6B;IAC7B,yBAAyB;IACz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