wogiflow 1.1.6 → 1.1.7

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.
@@ -317,21 +317,49 @@ class BaseBridge {
317
317
 
318
318
  /**
319
319
  * Generate and write the main rules file (e.g., CLAUDE.md)
320
+ * @param {Object} options - Generation options
321
+ * @param {boolean} options.force - Force overwrite even if locally modified
320
322
  */
321
- generateRulesFile() {
323
+ generateRulesFile(options = {}) {
322
324
  const config = this.readConfig();
323
325
  const content = this.generateRulesContent(config);
324
326
  const rulesFilePath = path.join(this.projectDir, this.getRulesFileName());
325
327
 
328
+ // Check for local modifications before overwriting
329
+ if (fs.existsSync(rulesFilePath) && !options.force) {
330
+ const existingContent = fs.readFileSync(rulesFilePath, 'utf-8');
331
+
332
+ // Check if file was manually modified (missing our generation marker)
333
+ const hasMarker = existingContent.includes('Generated by CLI Bridge');
334
+
335
+ if (!hasMarker) {
336
+ // File exists but wasn't generated by us - likely manually created/modified
337
+ this.log(`⚠️ ${this.getRulesFileName()} appears to be manually maintained (no generation marker)`);
338
+ this.log(` Skipping to preserve local customizations. Use --force to overwrite.`);
339
+ return false;
340
+ }
341
+
342
+ // Check if content would actually change
343
+ if (existingContent === content) {
344
+ this.log(`${this.getRulesFileName()} is up to date`);
345
+ return true;
346
+ }
347
+
348
+ // File has our marker - safe to overwrite as it's generated content
349
+ }
350
+
326
351
  fs.writeFileSync(rulesFilePath, content, 'utf-8');
327
352
  this.log(`Generated ${this.getRulesFileName()}`);
353
+ return true;
328
354
  }
329
355
 
330
356
  /**
331
357
  * Run full sync: skills, rules, and CLI-specific setup
358
+ * @param {Object} options - Sync options
359
+ * @param {boolean} options.force - Force overwrite of locally modified files
332
360
  * @returns {Object} Sync result summary
333
361
  */
334
- async sync() {
362
+ async sync(options = {}) {
335
363
  const startTime = Date.now();
336
364
  const results = {
337
365
  cliType: this.cliType,
@@ -371,10 +399,14 @@ class BaseBridge {
371
399
  results.errors.push({ step: 'knowledge-files', error: err.message });
372
400
  }
373
401
 
374
- // 5. Generate rules file
402
+ // 5. Generate rules file (respects local modifications unless --force)
375
403
  try {
376
- this.generateRulesFile();
377
- results.synced.push('rules-file');
404
+ const generated = this.generateRulesFile({ force: options.force });
405
+ if (generated) {
406
+ results.synced.push('rules-file');
407
+ } else {
408
+ results.synced.push('rules-file-skipped');
409
+ }
378
410
  } catch (err) {
379
411
  results.errors.push({ step: 'rules-file', error: err.message });
380
412
  }
@@ -136,7 +136,8 @@ async function syncBridge(options = {}) {
136
136
  };
137
137
  }
138
138
 
139
- return await bridge.sync();
139
+ // Pass through sync options (e.g., force: true to overwrite locally modified files)
140
+ return await bridge.sync({ force: options.force });
140
141
  }
141
142
 
142
143
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wogiflow",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "AI-powered development workflow management system with multi-model support",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -190,6 +190,7 @@ function normalizeCliType(input) {
190
190
  */
191
191
  async function syncBridge(options = {}) {
192
192
  const verbose = options.verbose || process.argv.includes('--verbose') || process.argv.includes('-v');
193
+ const force = options.force || process.argv.includes('--force') || process.argv.includes('-f');
193
194
 
194
195
  // Check for CLI type argument (e.g., "flow bridge sync gemini")
195
196
  const cliTypeArg = process.argv[3];
@@ -219,6 +220,7 @@ async function syncBridge(options = {}) {
219
220
 
220
221
  const result = await bridges.syncBridge({
221
222
  verbose,
223
+ force,
222
224
  projectDir: PROJECT_ROOT,
223
225
  cliType: targetCliType
224
226
  });
@@ -271,11 +273,16 @@ switch (command) {
271
273
  console.log(' status Show current bridge configuration');
272
274
  console.log(' list List available CLI bridges');
273
275
  console.log('');
276
+ console.log('Options:');
277
+ console.log(' --force, -f Overwrite locally modified rules files (CLAUDE.md, GEMINI.md, etc.)');
278
+ console.log(' --verbose, -v Show detailed output');
279
+ console.log('');
274
280
  console.log('CLI Types:');
275
281
  console.log(' claude-code, gemini-cli (or gemini), cursor, opencode, codex, kimi');
276
282
  console.log('');
277
283
  console.log('Examples:');
278
284
  console.log(' flow bridge sync # Sync default CLI from config');
279
285
  console.log(' flow bridge sync gemini # Sync Gemini CLI specifically');
286
+ console.log(' flow bridge sync --force # Force overwrite even if locally modified');
280
287
  process.exit(1);
281
288
  }