openairev 0.3.3 → 0.3.4

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli/init.js +20 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openairev",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Cross-model AI code reviewer — independent review for AI-assisted coding workflows",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli/init.js CHANGED
@@ -215,6 +215,24 @@ function buildToolsConfig(answers) {
215
215
  return tools;
216
216
  }
217
217
 
218
+ function upsertMarkedSection(filePath, marker, content, label) {
219
+ if (existsSync(filePath)) {
220
+ const existing = readFileSync(filePath, 'utf-8');
221
+ if (existing.includes(marker)) {
222
+ const regex = new RegExp(`${marker}[\\s\\S]*?${marker}`, 'g');
223
+ const updated = existing.replace(regex, content);
224
+ writeFileSync(filePath, updated);
225
+ console.log(`${chalk.green('✓')} OpenAIRev instructions updated in ${label}`);
226
+ } else {
227
+ writeFileSync(filePath, existing + '\n' + content + '\n');
228
+ console.log(`${chalk.green('✓')} OpenAIRev instructions appended to ${label}`);
229
+ }
230
+ } else {
231
+ writeFileSync(filePath, content + '\n');
232
+ console.log(`${chalk.green('✓')} ${label} created with OpenAIRev instructions`);
233
+ }
234
+ }
235
+
218
236
  function copyIfMissing(src, dest) {
219
237
  if (!existsSync(dest) && existsSync(src)) {
220
238
  copyFileSync(src, dest);
@@ -251,16 +269,7 @@ This project uses OpenAIRev for independent AI code review. When the user asks t
251
269
  ${marker}
252
270
  `;
253
271
 
254
- if (existsSync(claudeMdPath)) {
255
- const existing = readFileSync(claudeMdPath, 'utf-8');
256
- if (!existing.includes(marker)) {
257
- writeFileSync(claudeMdPath, existing + '\n' + instructions.trim() + '\n');
258
- console.log(`${chalk.green('✓')} OpenAIRev instructions appended to CLAUDE.md`);
259
- }
260
- } else {
261
- writeFileSync(claudeMdPath, instructions.trim() + '\n');
262
- console.log(`${chalk.green('✓')} CLAUDE.md created with OpenAIRev instructions`);
263
- }
272
+ upsertMarkedSection(claudeMdPath, marker, instructions.trim(), 'CLAUDE.md');
264
273
  }
265
274
 
266
275
  /**
@@ -314,14 +323,5 @@ This project uses OpenAIRev for independent AI code review. When the user asks t
314
323
  ${marker}
315
324
  `;
316
325
 
317
- if (existsSync(agentsMdPath)) {
318
- const existing = readFileSync(agentsMdPath, 'utf-8');
319
- if (!existing.includes(marker)) {
320
- writeFileSync(agentsMdPath, existing + '\n' + instructions.trim() + '\n');
321
- console.log(`${chalk.green('✓')} OpenAIRev instructions appended to AGENTS.md`);
322
- }
323
- } else {
324
- writeFileSync(agentsMdPath, instructions.trim() + '\n');
325
- console.log(`${chalk.green('✓')} AGENTS.md created with OpenAIRev instructions`);
326
- }
326
+ upsertMarkedSection(agentsMdPath, marker, instructions.trim(), 'AGENTS.md');
327
327
  }