@eldrforge/kodrdriv 1.2.14 â 1.2.17
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/dist/commands/development.js +54 -0
- package/dist/commands/development.js.map +1 -1
- package/dist/commands/publish.js +75 -1
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/tree.js +11 -1
- package/dist/commands/tree.js.map +1 -1
- package/dist/constants.js +5 -2
- package/dist/constants.js.map +1 -1
- package/dist/prompt/commit.js +3 -0
- package/dist/prompt/commit.js.map +1 -1
- package/dist/prompt/instructions/commit.md +87 -68
- package/dist/prompt/instructions/release.md +67 -21
- package/dist/util/git.js +91 -21
- package/dist/util/git.js.map +1 -1
- package/dist/util/openai.js +22 -2
- package/dist/util/openai.js.map +1 -1
- package/package.json +1 -1
|
@@ -223,6 +223,60 @@ import { KODRDRIV_DEFAULTS } from '../constants.js';
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
+
// Step 2.5: Sync with target branch (main) if it exists
|
|
227
|
+
// This is a safety net for when publish fails or user ends up on target branch
|
|
228
|
+
if (!isDryRun) {
|
|
229
|
+
var _allBranchConfig_workingBranch;
|
|
230
|
+
// Determine target branch from config
|
|
231
|
+
const targetBranch = allBranchConfig && ((_allBranchConfig_workingBranch = allBranchConfig[workingBranch]) === null || _allBranchConfig_workingBranch === void 0 ? void 0 : _allBranchConfig_workingBranch.targetBranch) || 'main';
|
|
232
|
+
const targetBranchExists = await localBranchExists(targetBranch);
|
|
233
|
+
if (targetBranchExists) {
|
|
234
|
+
logger.info(`đ Syncing ${workingBranch} with target branch '${targetBranch}'...`);
|
|
235
|
+
try {
|
|
236
|
+
await run(`git merge ${targetBranch} --ff-only`);
|
|
237
|
+
logger.info(`â
Fast-forward merged ${targetBranch} into ${workingBranch}`);
|
|
238
|
+
} catch (error) {
|
|
239
|
+
// Fast-forward failed, might need regular merge
|
|
240
|
+
if (error.message && error.message.includes('Not possible to fast-forward')) {
|
|
241
|
+
logger.warn(`â ī¸ Cannot fast-forward ${targetBranch} into ${workingBranch}`);
|
|
242
|
+
logger.info(` Attempting regular merge...`);
|
|
243
|
+
try {
|
|
244
|
+
await run(`git merge ${targetBranch} --no-ff -m "Merge ${targetBranch} into ${workingBranch} for sync"`);
|
|
245
|
+
logger.info(`â
Merged ${targetBranch} into ${workingBranch}`);
|
|
246
|
+
// Run npm install after merge
|
|
247
|
+
logger.info('đĻ Running npm install after merge...');
|
|
248
|
+
await run('npm install');
|
|
249
|
+
// Check if npm install created changes
|
|
250
|
+
const gitStatus = await run('git status --porcelain');
|
|
251
|
+
if (gitStatus.stdout.trim()) {
|
|
252
|
+
logger.info('đ Committing changes from npm install...');
|
|
253
|
+
await run('git add -A');
|
|
254
|
+
await run('git commit -m "chore: update package-lock.json after merge"');
|
|
255
|
+
}
|
|
256
|
+
} catch (mergeError) {
|
|
257
|
+
if (mergeError.message && mergeError.message.includes('CONFLICT')) {
|
|
258
|
+
logger.error(`â Merge conflicts detected when merging ${targetBranch} into ${workingBranch}`);
|
|
259
|
+
logger.error(` Please resolve the conflicts manually and then run:`);
|
|
260
|
+
logger.error(` 1. Resolve conflicts in the files`);
|
|
261
|
+
logger.error(` 2. git add <resolved-files>`);
|
|
262
|
+
logger.error(` 3. git commit`);
|
|
263
|
+
logger.error(` 4. npm install`);
|
|
264
|
+
logger.error(` 5. kodrdriv development (to continue)`);
|
|
265
|
+
throw new Error(`Merge conflicts detected when merging ${targetBranch} into ${workingBranch}. Please resolve conflicts manually.`);
|
|
266
|
+
} else {
|
|
267
|
+
throw mergeError;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
} else {
|
|
271
|
+
logger.warn(`â ī¸ Could not merge ${targetBranch} into ${workingBranch}: ${error.message}`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
logger.info(`âšī¸ Target branch '${targetBranch}' does not exist, skipping target sync`);
|
|
276
|
+
}
|
|
277
|
+
} else {
|
|
278
|
+
logger.info('Would sync working branch with target branch (main) if it exists');
|
|
279
|
+
}
|
|
226
280
|
// Step 3: Merge latest changes from development branch if it exists
|
|
227
281
|
if (!isDryRun) {
|
|
228
282
|
const developmentBranchExists = await localBranchExists('development');
|