contribute-now 0.6.0 → 0.6.1-dev.5d3631e
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/index.js +91 -89
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -664,21 +664,21 @@ LogEngine.configure({
|
|
|
664
664
|
mode: LogMode.INFO,
|
|
665
665
|
format: {
|
|
666
666
|
includeIsoTimestamp: false,
|
|
667
|
-
includeLocalTime:
|
|
667
|
+
includeLocalTime: false,
|
|
668
668
|
includeEmoji: true
|
|
669
669
|
}
|
|
670
670
|
});
|
|
671
|
-
function success(msg) {
|
|
672
|
-
LogEngine.log(msg);
|
|
671
|
+
function success(msg, emoji = "✅") {
|
|
672
|
+
LogEngine.log(msg, undefined, { emoji });
|
|
673
673
|
}
|
|
674
|
-
function error(msg) {
|
|
675
|
-
LogEngine.error(msg);
|
|
674
|
+
function error(msg, emoji = "\uD83D\uDEA8") {
|
|
675
|
+
LogEngine.error(msg, undefined, { emoji });
|
|
676
676
|
}
|
|
677
|
-
function warn(msg) {
|
|
678
|
-
LogEngine.warn(msg);
|
|
677
|
+
function warn(msg, emoji = "⚠️") {
|
|
678
|
+
LogEngine.warn(msg, undefined, { emoji });
|
|
679
679
|
}
|
|
680
|
-
function info(msg) {
|
|
681
|
-
LogEngine.info(msg);
|
|
680
|
+
function info(msg, emoji = "ℹ️") {
|
|
681
|
+
LogEngine.info(msg, undefined, { emoji });
|
|
682
682
|
}
|
|
683
683
|
function heading(msg) {
|
|
684
684
|
console.log(`
|
|
@@ -1677,8 +1677,8 @@ async function handleCurrentBranchDeletion(currentBranch, baseBranch, config) {
|
|
|
1677
1677
|
if (rebaseResult.exitCode !== 0) {
|
|
1678
1678
|
await rebaseAbort();
|
|
1679
1679
|
warn("Rebase had conflicts — aborted to keep the repo in a clean state.");
|
|
1680
|
-
info(`Your work is saved on ${pc5.bold(newBranchName)}. After cleanup, rebase manually
|
|
1681
|
-
info(` ${pc5.bold(`git checkout ${newBranchName} && git rebase ${syncSource2.ref}`)}
|
|
1680
|
+
info(`Your work is saved on ${pc5.bold(newBranchName)}. After cleanup, rebase manually:`, "");
|
|
1681
|
+
info(` ${pc5.bold(`git checkout ${newBranchName} && git rebase ${syncSource2.ref}`)}`, "");
|
|
1682
1682
|
} else {
|
|
1683
1683
|
success(`Rebased ${pc5.bold(newBranchName)} onto ${pc5.bold(syncSource2.ref)}.`);
|
|
1684
1684
|
}
|
|
@@ -1753,7 +1753,7 @@ var clean_default = defineCommand2({
|
|
|
1753
1753
|
const mergedPR = await getMergedPRForBranch(currentBranch);
|
|
1754
1754
|
if (mergedPR) {
|
|
1755
1755
|
warn(`PR #${mergedPR.number} (${pc5.bold(mergedPR.title)}) has already been merged.`);
|
|
1756
|
-
info(`Link: ${pc5.underline(mergedPR.url)}
|
|
1756
|
+
info(`Link: ${pc5.underline(mergedPR.url)}`, "");
|
|
1757
1757
|
goneCandidates.push(currentBranch);
|
|
1758
1758
|
}
|
|
1759
1759
|
}
|
|
@@ -1827,7 +1827,7 @@ ${pc5.bold("Stale branches (remote deleted, likely squash-merged):")}`);
|
|
|
1827
1827
|
}
|
|
1828
1828
|
}
|
|
1829
1829
|
if (mergedCandidates.length === 0 && goneCandidates.length === 0) {
|
|
1830
|
-
info("No branches to clean up. Everything is tidy! \uD83E\uDDF9");
|
|
1830
|
+
info("No branches to clean up. Everything is tidy!", "\uD83E\uDDF9");
|
|
1831
1831
|
}
|
|
1832
1832
|
const finalBranch = await getCurrentBranch();
|
|
1833
1833
|
if (finalBranch && protectedBranches.has(finalBranch)) {
|
|
@@ -2069,7 +2069,7 @@ ${pc6.bold("Changed files:")}`);
|
|
|
2069
2069
|
error(`Failed to commit: ${result.stderr}`);
|
|
2070
2070
|
process.exit(1);
|
|
2071
2071
|
}
|
|
2072
|
-
success(
|
|
2072
|
+
success(`Committed: ${pc6.bold(finalMessage)}`);
|
|
2073
2073
|
}
|
|
2074
2074
|
});
|
|
2075
2075
|
async function runGroupCommit(model, config) {
|
|
@@ -2176,7 +2176,7 @@ ${pc6.bold(`AI suggested ${validGroups.length} commit group(s):`)}
|
|
|
2176
2176
|
continue;
|
|
2177
2177
|
}
|
|
2178
2178
|
committed++;
|
|
2179
|
-
success(
|
|
2179
|
+
success(`Committed group ${i + 1}: ${pc6.bold(group.message)}`);
|
|
2180
2180
|
}
|
|
2181
2181
|
} else {
|
|
2182
2182
|
for (let i = 0;i < validGroups.length; i++) {
|
|
@@ -2247,7 +2247,7 @@ ${pc6.bold(`AI suggested ${validGroups.length} commit group(s):`)}
|
|
|
2247
2247
|
continue;
|
|
2248
2248
|
}
|
|
2249
2249
|
committed++;
|
|
2250
|
-
success(
|
|
2250
|
+
success(`Committed group ${i + 1}: ${pc6.bold(message)}`);
|
|
2251
2251
|
actionDone = true;
|
|
2252
2252
|
}
|
|
2253
2253
|
}
|
|
@@ -2255,8 +2255,8 @@ ${pc6.bold(`AI suggested ${validGroups.length} commit group(s):`)}
|
|
|
2255
2255
|
if (committed === 0) {
|
|
2256
2256
|
warn("No groups were committed.");
|
|
2257
2257
|
} else {
|
|
2258
|
-
|
|
2259
|
-
|
|
2258
|
+
console.log();
|
|
2259
|
+
success(`${committed} of ${validGroups.length} group(s) committed successfully.`, "\uD83C\uDF89");
|
|
2260
2260
|
}
|
|
2261
2261
|
process.exit(0);
|
|
2262
2262
|
}
|
|
@@ -2268,7 +2268,7 @@ import pc7 from "picocolors";
|
|
|
2268
2268
|
// package.json
|
|
2269
2269
|
var package_default = {
|
|
2270
2270
|
name: "contribute-now",
|
|
2271
|
-
version: "0.6.
|
|
2271
|
+
version: "0.6.1-dev.5d3631e",
|
|
2272
2272
|
description: "Developer CLI that automates git workflows — branching, syncing, committing, and PRs — with multi-workflow and commit convention support.",
|
|
2273
2273
|
type: "module",
|
|
2274
2274
|
bin: {
|
|
@@ -2731,7 +2731,7 @@ async function installHook() {
|
|
|
2731
2731
|
}
|
|
2732
2732
|
if (config.commitConvention === "none") {
|
|
2733
2733
|
warn('Commit convention is set to "none". No hook to install.');
|
|
2734
|
-
info("Change your convention with `contrib setup` first.");
|
|
2734
|
+
info("Change your convention with `contrib setup` first.", "");
|
|
2735
2735
|
process.exit(0);
|
|
2736
2736
|
}
|
|
2737
2737
|
const hookPath = getHookPath();
|
|
@@ -2751,8 +2751,8 @@ async function installHook() {
|
|
|
2751
2751
|
}
|
|
2752
2752
|
writeFileSync2(hookPath, generateHookScript(), { mode: 493 });
|
|
2753
2753
|
success(`commit-msg hook installed.`);
|
|
2754
|
-
info(`Convention: ${pc8.bold(CONVENTION_LABELS[config.commitConvention])}
|
|
2755
|
-
info(`Path: ${pc8.dim(hookPath)}
|
|
2754
|
+
info(`Convention: ${pc8.bold(CONVENTION_LABELS[config.commitConvention])}`, "");
|
|
2755
|
+
info(`Path: ${pc8.dim(hookPath)}`, "");
|
|
2756
2756
|
warn("Note: hooks can be bypassed with `git commit --no-verify`.");
|
|
2757
2757
|
}
|
|
2758
2758
|
async function uninstallHook() {
|
|
@@ -3169,7 +3169,7 @@ async function handleSave(message) {
|
|
|
3169
3169
|
return;
|
|
3170
3170
|
}
|
|
3171
3171
|
success(`Saved: ${pc10.dim(label)}`);
|
|
3172
|
-
info(`Use ${pc10.bold("contrib save --restore")} to bring them back
|
|
3172
|
+
info(`Use ${pc10.bold("contrib save --restore")} to bring them back.`, "");
|
|
3173
3173
|
}
|
|
3174
3174
|
async function handleRestore() {
|
|
3175
3175
|
heading("\uD83D\uDCBE contrib save --restore");
|
|
@@ -3214,8 +3214,8 @@ async function handleList() {
|
|
|
3214
3214
|
console.log(` ${idx} ${msg}`);
|
|
3215
3215
|
}
|
|
3216
3216
|
console.log();
|
|
3217
|
-
info(`Use ${pc10.bold("contrib save --restore")} to bring changes back
|
|
3218
|
-
info(`Use ${pc10.bold("contrib save --drop")} to discard saved changes
|
|
3217
|
+
info(`Use ${pc10.bold("contrib save --restore")} to bring changes back.`, "");
|
|
3218
|
+
info(`Use ${pc10.bold("contrib save --drop")} to discard saved changes.`, "");
|
|
3219
3219
|
}
|
|
3220
3220
|
async function handleDrop() {
|
|
3221
3221
|
heading("\uD83D\uDCBE contrib save --drop");
|
|
@@ -3425,7 +3425,7 @@ var setup_default = defineCommand8({
|
|
|
3425
3425
|
success(`Added remote ${pc11.bold(upstreamRemote)} → ${upstreamUrl}`);
|
|
3426
3426
|
} else {
|
|
3427
3427
|
error("An upstream remote URL is required for contributors.");
|
|
3428
|
-
info("Add it manually: git remote add upstream <url>");
|
|
3428
|
+
info("Add it manually: git remote add upstream <url>", "");
|
|
3429
3429
|
process.exit(1);
|
|
3430
3430
|
}
|
|
3431
3431
|
}
|
|
@@ -3441,9 +3441,9 @@ var setup_default = defineCommand8({
|
|
|
3441
3441
|
commitConvention
|
|
3442
3442
|
};
|
|
3443
3443
|
writeConfig(config);
|
|
3444
|
-
success(
|
|
3444
|
+
success(`Config written to .contributerc.json`);
|
|
3445
3445
|
const syncRemote = config.role === "contributor" ? config.upstream : config.origin;
|
|
3446
|
-
info(`Fetching ${pc11.bold(syncRemote)} to verify branch configuration
|
|
3446
|
+
info(`Fetching ${pc11.bold(syncRemote)} to verify branch configuration...`, "");
|
|
3447
3447
|
await fetchRemote(syncRemote);
|
|
3448
3448
|
const mainRef = `${syncRemote}/${config.mainBranch}`;
|
|
3449
3449
|
if (!await refExists(mainRef)) {
|
|
@@ -3565,7 +3565,7 @@ var start_default = defineCommand9({
|
|
|
3565
3565
|
info(`Creating branch: ${pc12.bold(branchName)}`);
|
|
3566
3566
|
if (await branchExists(branchName)) {
|
|
3567
3567
|
error(`Branch ${pc12.bold(branchName)} already exists.`);
|
|
3568
|
-
info(` Use ${pc12.bold(`git checkout ${branchName}`)} to switch to it, or choose a different name
|
|
3568
|
+
info(` Use ${pc12.bold(`git checkout ${branchName}`)} to switch to it, or choose a different name.`, "");
|
|
3569
3569
|
process.exit(1);
|
|
3570
3570
|
}
|
|
3571
3571
|
await fetchRemote(syncSource.remote);
|
|
@@ -3593,11 +3593,11 @@ var start_default = defineCommand9({
|
|
|
3593
3593
|
error(`Failed to create branch: ${result2.stderr}`);
|
|
3594
3594
|
process.exit(1);
|
|
3595
3595
|
}
|
|
3596
|
-
success(
|
|
3596
|
+
success(`Created ${pc12.bold(branchName)} from ${pc12.bold(syncSource.ref)}`);
|
|
3597
3597
|
return;
|
|
3598
3598
|
}
|
|
3599
3599
|
error(`Failed to update ${pc12.bold(baseBranch)}: ${updateResult.stderr}`);
|
|
3600
|
-
info("Make sure your base branch exists locally or the remote ref is available.");
|
|
3600
|
+
info("Make sure your base branch exists locally or the remote ref is available.", "");
|
|
3601
3601
|
process.exit(1);
|
|
3602
3602
|
}
|
|
3603
3603
|
const result = await createBranch(branchName, baseBranch);
|
|
@@ -3605,7 +3605,7 @@ var start_default = defineCommand9({
|
|
|
3605
3605
|
error(`Failed to create branch: ${result.stderr}`);
|
|
3606
3606
|
process.exit(1);
|
|
3607
3607
|
}
|
|
3608
|
-
success(
|
|
3608
|
+
success(`Created ${pc12.bold(branchName)} from latest ${pc12.bold(baseBranch)}`);
|
|
3609
3609
|
}
|
|
3610
3610
|
});
|
|
3611
3611
|
|
|
@@ -3870,8 +3870,8 @@ async function performSquashMerge(origin, baseBranch, featureBranch, options) {
|
|
|
3870
3870
|
warn(`Could not delete remote branch: ${delRemote.stderr.trim()}`);
|
|
3871
3871
|
}
|
|
3872
3872
|
}
|
|
3873
|
-
success(
|
|
3874
|
-
info(`Run ${pc14.bold("contrib start")} to begin a new feature
|
|
3873
|
+
success(`Squash merged ${pc14.bold(featureBranch)} into ${pc14.bold(baseBranch)} and pushed.`);
|
|
3874
|
+
info(`Run ${pc14.bold("contrib start")} to begin a new feature.`, "");
|
|
3875
3875
|
}
|
|
3876
3876
|
var submit_default = defineCommand11({
|
|
3877
3877
|
meta: {
|
|
@@ -3924,7 +3924,7 @@ var submit_default = defineCommand11({
|
|
|
3924
3924
|
const hasAnything = hasCommits || dirty;
|
|
3925
3925
|
if (!hasAnything) {
|
|
3926
3926
|
error("No local changes or commits to move. Switch to a feature branch first.");
|
|
3927
|
-
info(` Run ${pc14.bold("contrib start")} to create a new feature branch
|
|
3927
|
+
info(` Run ${pc14.bold("contrib start")} to create a new feature branch.`, "");
|
|
3928
3928
|
process.exit(1);
|
|
3929
3929
|
}
|
|
3930
3930
|
if (hasCommits) {
|
|
@@ -3983,10 +3983,10 @@ var submit_default = defineCommand11({
|
|
|
3983
3983
|
}
|
|
3984
3984
|
success(`Created ${pc14.bold(newBranchName)} with your changes.`);
|
|
3985
3985
|
await updateLocalBranch(currentBranch, remoteRef);
|
|
3986
|
-
info(`Reset ${pc14.bold(currentBranch)} back to ${pc14.bold(remoteRef)} — no damage done
|
|
3986
|
+
info(`Reset ${pc14.bold(currentBranch)} back to ${pc14.bold(remoteRef)} — no damage done.`, "");
|
|
3987
3987
|
console.log();
|
|
3988
3988
|
success(`You're now on ${pc14.bold(newBranchName)} with all your work intact.`);
|
|
3989
|
-
info(`Run ${pc14.bold("contrib submit")} again to push and create your PR
|
|
3989
|
+
info(`Run ${pc14.bold("contrib submit")} again to push and create your PR.`, "");
|
|
3990
3990
|
return;
|
|
3991
3991
|
}
|
|
3992
3992
|
heading("\uD83D\uDE80 contrib submit");
|
|
@@ -4064,11 +4064,11 @@ var submit_default = defineCommand11({
|
|
|
4064
4064
|
}
|
|
4065
4065
|
if (rebaseResult.exitCode !== 0) {
|
|
4066
4066
|
warn("Rebase encountered conflicts. Resolve them manually, then run:");
|
|
4067
|
-
info(` ${pc14.bold("git rebase --continue")}
|
|
4067
|
+
info(` ${pc14.bold("git rebase --continue")}`, "");
|
|
4068
4068
|
} else {
|
|
4069
4069
|
success(`Rebased ${pc14.bold(newBranchName)} onto ${pc14.bold(syncSource2.ref)}.`);
|
|
4070
4070
|
}
|
|
4071
|
-
info(`All your changes are preserved. Run ${pc14.bold("contrib submit")} when ready to create a new PR
|
|
4071
|
+
info(`All your changes are preserved. Run ${pc14.bold("contrib submit")} when ready to create a new PR.`, "");
|
|
4072
4072
|
return;
|
|
4073
4073
|
}
|
|
4074
4074
|
warn("Discarding local changes...");
|
|
@@ -4105,8 +4105,8 @@ var submit_default = defineCommand11({
|
|
|
4105
4105
|
error(`Failed to push: ${pushResult2.stderr}`);
|
|
4106
4106
|
if (pushResult2.stderr.includes("rejected") || pushResult2.stderr.includes("non-fast-forward")) {
|
|
4107
4107
|
warn("The remote branch has diverged. Try:");
|
|
4108
|
-
info(` git pull --rebase ${origin} ${currentBranch}
|
|
4109
|
-
info(" Then run `contrib submit` again.");
|
|
4108
|
+
info(` git pull --rebase ${origin} ${currentBranch}`, "");
|
|
4109
|
+
info(" Then run `contrib submit` again.", "");
|
|
4110
4110
|
}
|
|
4111
4111
|
process.exit(1);
|
|
4112
4112
|
}
|
|
@@ -4142,22 +4142,39 @@ ${pc14.dim("AI body preview:")}`);
|
|
|
4142
4142
|
warn(`AI unavailable: ${copilotError}`);
|
|
4143
4143
|
}
|
|
4144
4144
|
}
|
|
4145
|
-
if (!args["no-ai"]) {
|
|
4146
|
-
await tryGenerateAI();
|
|
4147
|
-
}
|
|
4148
4145
|
const CANCEL = "Cancel";
|
|
4149
4146
|
const SQUASH_LOCAL = `Squash merge to ${baseBranch} locally (no PR)`;
|
|
4150
4147
|
const REGENERATE = "Regenerate AI description";
|
|
4151
4148
|
let submitAction = "cancel";
|
|
4152
4149
|
const isMaintainer = config.role === "maintainer";
|
|
4150
|
+
if (isMaintainer) {
|
|
4151
|
+
const maintainerChoice = await selectPrompt("How would you like to submit your changes?", ["Create a PR", SQUASH_LOCAL, CANCEL]);
|
|
4152
|
+
if (maintainerChoice === CANCEL) {
|
|
4153
|
+
warn("Submit cancelled.");
|
|
4154
|
+
return;
|
|
4155
|
+
}
|
|
4156
|
+
if (maintainerChoice === SQUASH_LOCAL) {
|
|
4157
|
+
await performSquashMerge(origin, baseBranch, currentBranch, {
|
|
4158
|
+
model: args.model,
|
|
4159
|
+
convention: config.commitConvention
|
|
4160
|
+
});
|
|
4161
|
+
return;
|
|
4162
|
+
}
|
|
4163
|
+
}
|
|
4164
|
+
if (!args["no-ai"]) {
|
|
4165
|
+
await tryGenerateAI();
|
|
4166
|
+
}
|
|
4153
4167
|
let actionResolved = false;
|
|
4154
4168
|
while (!actionResolved) {
|
|
4155
4169
|
if (prTitle && prBody) {
|
|
4156
|
-
const
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4170
|
+
const action = await selectPrompt("What would you like to do with the PR description?", [
|
|
4171
|
+
"Use AI description",
|
|
4172
|
+
"Edit title",
|
|
4173
|
+
"Write manually",
|
|
4174
|
+
"Use gh --fill (auto-fill from commits)",
|
|
4175
|
+
REGENERATE,
|
|
4176
|
+
CANCEL
|
|
4177
|
+
]);
|
|
4161
4178
|
if (action === CANCEL) {
|
|
4162
4179
|
submitAction = "cancel";
|
|
4163
4180
|
actionResolved = true;
|
|
@@ -4165,9 +4182,6 @@ ${pc14.dim("AI body preview:")}`);
|
|
|
4165
4182
|
prTitle = null;
|
|
4166
4183
|
prBody = null;
|
|
4167
4184
|
await tryGenerateAI();
|
|
4168
|
-
} else if (action === SQUASH_LOCAL) {
|
|
4169
|
-
submitAction = "squash";
|
|
4170
|
-
actionResolved = true;
|
|
4171
4185
|
} else if (action === "Use AI description") {
|
|
4172
4186
|
submitAction = "create-pr";
|
|
4173
4187
|
actionResolved = true;
|
|
@@ -4186,8 +4200,6 @@ ${pc14.dim("AI body preview:")}`);
|
|
|
4186
4200
|
}
|
|
4187
4201
|
} else {
|
|
4188
4202
|
const choices = [];
|
|
4189
|
-
if (isMaintainer)
|
|
4190
|
-
choices.push(SQUASH_LOCAL);
|
|
4191
4203
|
if (!args["no-ai"])
|
|
4192
4204
|
choices.push(REGENERATE);
|
|
4193
4205
|
choices.push("Write title & body manually", "Use gh --fill (auto-fill from commits)", CANCEL);
|
|
@@ -4197,9 +4209,6 @@ ${pc14.dim("AI body preview:")}`);
|
|
|
4197
4209
|
actionResolved = true;
|
|
4198
4210
|
} else if (action === REGENERATE) {
|
|
4199
4211
|
await tryGenerateAI();
|
|
4200
|
-
} else if (action === SQUASH_LOCAL) {
|
|
4201
|
-
submitAction = "squash";
|
|
4202
|
-
actionResolved = true;
|
|
4203
4212
|
} else if (action === "Write title & body manually") {
|
|
4204
4213
|
prTitle = await inputPrompt("PR title");
|
|
4205
4214
|
prBody = await inputPrompt("PR body (markdown)");
|
|
@@ -4215,23 +4224,16 @@ ${pc14.dim("AI body preview:")}`);
|
|
|
4215
4224
|
warn("Submit cancelled.");
|
|
4216
4225
|
return;
|
|
4217
4226
|
}
|
|
4218
|
-
if (submitAction === "squash") {
|
|
4219
|
-
await performSquashMerge(origin, baseBranch, currentBranch, {
|
|
4220
|
-
model: args.model,
|
|
4221
|
-
convention: config.commitConvention
|
|
4222
|
-
});
|
|
4223
|
-
return;
|
|
4224
|
-
}
|
|
4225
4227
|
info(`Pushing ${pc14.bold(currentBranch)} to ${origin}...`);
|
|
4226
4228
|
const pushResult = await pushSetUpstream(origin, currentBranch);
|
|
4227
4229
|
if (pushResult.exitCode !== 0) {
|
|
4228
4230
|
error(`Failed to push: ${pushResult.stderr}`);
|
|
4229
4231
|
if (pushResult.stderr.includes("rejected") || pushResult.stderr.includes("non-fast-forward")) {
|
|
4230
4232
|
warn("The remote branch has diverged. Try:");
|
|
4231
|
-
info(` git pull --rebase ${origin} ${currentBranch}
|
|
4232
|
-
info(" Then run `contrib submit` again.");
|
|
4233
|
-
info("If you need to force push (use with caution):");
|
|
4234
|
-
info(` git push --force-with-lease ${origin} ${currentBranch}
|
|
4233
|
+
info(` git pull --rebase ${origin} ${currentBranch}`, "");
|
|
4234
|
+
info(" Then run `contrib submit` again.", "");
|
|
4235
|
+
info("If you need to force push (use with caution):", "");
|
|
4236
|
+
info(` git push --force-with-lease ${origin} ${currentBranch}`, "");
|
|
4235
4237
|
}
|
|
4236
4238
|
process.exit(1);
|
|
4237
4239
|
}
|
|
@@ -4240,10 +4242,10 @@ ${pc14.dim("AI body preview:")}`);
|
|
|
4240
4242
|
if (repoInfo) {
|
|
4241
4243
|
const prUrl = `https://github.com/${repoInfo.owner}/${repoInfo.repo}/compare/${baseBranch}...${currentBranch}?expand=1`;
|
|
4242
4244
|
console.log();
|
|
4243
|
-
info("Create your PR manually:");
|
|
4245
|
+
info("Create your PR manually:", "");
|
|
4244
4246
|
console.log(` ${pc14.cyan(prUrl)}`);
|
|
4245
4247
|
} else {
|
|
4246
|
-
info("gh CLI not available. Create your PR manually on GitHub.");
|
|
4248
|
+
info("gh CLI not available. Create your PR manually on GitHub.", "");
|
|
4247
4249
|
}
|
|
4248
4250
|
return;
|
|
4249
4251
|
}
|
|
@@ -4253,7 +4255,7 @@ ${pc14.dim("AI body preview:")}`);
|
|
|
4253
4255
|
error(`Failed to create PR: ${fillResult.stderr}`);
|
|
4254
4256
|
process.exit(1);
|
|
4255
4257
|
}
|
|
4256
|
-
success(
|
|
4258
|
+
success(`PR created: ${fillResult.stdout.trim()}`);
|
|
4257
4259
|
return;
|
|
4258
4260
|
}
|
|
4259
4261
|
if (!prTitle) {
|
|
@@ -4270,7 +4272,7 @@ ${pc14.dim("AI body preview:")}`);
|
|
|
4270
4272
|
error(`Failed to create PR: ${prResult.stderr}`);
|
|
4271
4273
|
process.exit(1);
|
|
4272
4274
|
}
|
|
4273
|
-
success(
|
|
4275
|
+
success(`PR created: ${prResult.stdout.trim()}`);
|
|
4274
4276
|
}
|
|
4275
4277
|
});
|
|
4276
4278
|
|
|
@@ -4360,8 +4362,8 @@ var switch_default = defineCommand12({
|
|
|
4360
4362
|
process.exit(1);
|
|
4361
4363
|
}
|
|
4362
4364
|
success(`Switched to ${pc15.bold(targetBranch)}`);
|
|
4363
|
-
info(`Your changes from ${pc15.bold(currentBranch ?? "previous branch")} are saved
|
|
4364
|
-
info(`Use ${pc15.bold("contrib save --restore")} to bring them back
|
|
4365
|
+
info(`Your changes from ${pc15.bold(currentBranch ?? "previous branch")} are saved.`, "");
|
|
4366
|
+
info(`Use ${pc15.bold("contrib save --restore")} to bring them back.`, "");
|
|
4365
4367
|
return;
|
|
4366
4368
|
}
|
|
4367
4369
|
const result = await checkoutBranch(targetBranch);
|
|
@@ -4428,8 +4430,8 @@ var sync_default = defineCommand13({
|
|
|
4428
4430
|
}
|
|
4429
4431
|
if (!await refExists(syncSource.ref)) {
|
|
4430
4432
|
error(`Remote ref ${pc16.bold(syncSource.ref)} does not exist.`);
|
|
4431
|
-
info("This can happen if the branch was renamed or deleted on the remote.");
|
|
4432
|
-
info(`Check your config: the base branch may need updating via ${pc16.bold("contrib setup")}
|
|
4433
|
+
info("This can happen if the branch was renamed or deleted on the remote.", "");
|
|
4434
|
+
info(`Check your config: the base branch may need updating via ${pc16.bold("contrib setup")}.`, "");
|
|
4433
4435
|
process.exit(1);
|
|
4434
4436
|
}
|
|
4435
4437
|
let allowMergeCommit = false;
|
|
@@ -4506,10 +4508,10 @@ var sync_default = defineCommand13({
|
|
|
4506
4508
|
const remoteRef = syncSource.ref;
|
|
4507
4509
|
await updateLocalBranch(baseBranch, remoteRef);
|
|
4508
4510
|
success(`Reset ${pc16.bold(baseBranch)} to ${pc16.bold(remoteRef)}.`);
|
|
4509
|
-
success(
|
|
4511
|
+
success(`${pc16.bold(baseBranch)} is now in sync with ${syncSource.ref}`);
|
|
4510
4512
|
console.log();
|
|
4511
|
-
info(`Your commits are safe on ${pc16.bold(newBranchName)}
|
|
4512
|
-
info(`Run ${pc16.bold(`git checkout ${newBranchName}`)} then ${pc16.bold("contrib update")} to rebase onto the synced ${pc16.bold(baseBranch)}
|
|
4513
|
+
info(`Your commits are safe on ${pc16.bold(newBranchName)}.`, "");
|
|
4514
|
+
info(`Run ${pc16.bold(`git checkout ${newBranchName}`)} then ${pc16.bold("contrib update")} to rebase onto the synced ${pc16.bold(baseBranch)}.`, "");
|
|
4513
4515
|
return;
|
|
4514
4516
|
}
|
|
4515
4517
|
allowMergeCommit = true;
|
|
@@ -4532,11 +4534,11 @@ var sync_default = defineCommand13({
|
|
|
4532
4534
|
error(`Pull failed: ${pullResult.stderr.trim()}`);
|
|
4533
4535
|
} else {
|
|
4534
4536
|
error(`Fast-forward pull failed. Your local ${pc16.bold(baseBranch)} may have diverged.`);
|
|
4535
|
-
info(`Use ${pc16.bold("contrib sync")} again and choose "Move my commits to a new feature branch" to fix this
|
|
4537
|
+
info(`Use ${pc16.bold("contrib sync")} again and choose "Move my commits to a new feature branch" to fix this.`, "");
|
|
4536
4538
|
}
|
|
4537
4539
|
process.exit(1);
|
|
4538
4540
|
}
|
|
4539
|
-
success(
|
|
4541
|
+
success(`${baseBranch} is now in sync with ${syncSource.ref}`);
|
|
4540
4542
|
if (hasDevBranch(workflow) && role === "maintainer") {
|
|
4541
4543
|
const mainDiv = await getDivergence(config.mainBranch, `${origin}/${config.mainBranch}`);
|
|
4542
4544
|
if (mainDiv.behind > 0) {
|
|
@@ -4545,7 +4547,7 @@ var sync_default = defineCommand13({
|
|
|
4545
4547
|
if (mainCoResult.exitCode === 0) {
|
|
4546
4548
|
const mainPullResult = await pullFastForwardOnly(origin, config.mainBranch);
|
|
4547
4549
|
if (mainPullResult.exitCode === 0) {
|
|
4548
|
-
success(
|
|
4550
|
+
success(`${config.mainBranch} is now in sync with ${origin}/${config.mainBranch}`);
|
|
4549
4551
|
}
|
|
4550
4552
|
}
|
|
4551
4553
|
await checkoutBranch(baseBranch);
|
|
@@ -4660,10 +4662,10 @@ var update_default = defineCommand14({
|
|
|
4660
4662
|
}
|
|
4661
4663
|
success(`Created ${pc17.bold(newBranchName)} with your changes.`);
|
|
4662
4664
|
await updateLocalBranch(currentBranch, remoteRef);
|
|
4663
|
-
info(`Reset ${pc17.bold(currentBranch)} back to ${pc17.bold(remoteRef)} — no damage done
|
|
4665
|
+
info(`Reset ${pc17.bold(currentBranch)} back to ${pc17.bold(remoteRef)} — no damage done.`, "");
|
|
4664
4666
|
console.log();
|
|
4665
4667
|
success(`You're now on ${pc17.bold(newBranchName)} with all your work intact.`);
|
|
4666
|
-
info(`Run ${pc17.bold("contrib update")} again to rebase onto latest ${pc17.bold(baseBranch)}
|
|
4668
|
+
info(`Run ${pc17.bold("contrib update")} again to rebase onto latest ${pc17.bold(baseBranch)}.`, "");
|
|
4667
4669
|
return;
|
|
4668
4670
|
}
|
|
4669
4671
|
if (await hasUncommittedChanges()) {
|
|
@@ -4674,7 +4676,7 @@ var update_default = defineCommand14({
|
|
|
4674
4676
|
const mergedPR = await getMergedPRForBranch(currentBranch);
|
|
4675
4677
|
if (mergedPR) {
|
|
4676
4678
|
warn(`PR #${mergedPR.number} (${pc17.bold(mergedPR.title)}) has already been merged.`);
|
|
4677
|
-
info(`Link: ${pc17.underline(mergedPR.url)}
|
|
4679
|
+
info(`Link: ${pc17.underline(mergedPR.url)}`, "");
|
|
4678
4680
|
const localWork = await hasLocalWork(syncSource.remote, currentBranch);
|
|
4679
4681
|
const hasWork = localWork.uncommitted || localWork.unpushedCommits > 0;
|
|
4680
4682
|
if (hasWork) {
|
|
@@ -4741,11 +4743,11 @@ var update_default = defineCommand14({
|
|
|
4741
4743
|
}
|
|
4742
4744
|
if (rebaseResult2.exitCode !== 0) {
|
|
4743
4745
|
warn("Rebase encountered conflicts. Resolve them manually, then run:");
|
|
4744
|
-
info(` ${pc17.bold("git rebase --continue")}
|
|
4746
|
+
info(` ${pc17.bold("git rebase --continue")}`, "");
|
|
4745
4747
|
} else {
|
|
4746
4748
|
success(`Rebased ${pc17.bold(newBranchName)} onto ${pc17.bold(syncSource.ref)}.`);
|
|
4747
4749
|
}
|
|
4748
|
-
info(`All your changes are preserved. Run ${pc17.bold("contrib submit")} when ready to create a new PR
|
|
4750
|
+
info(`All your changes are preserved. Run ${pc17.bold("contrib submit")} when ready to create a new PR.`, "");
|
|
4749
4751
|
return;
|
|
4750
4752
|
}
|
|
4751
4753
|
warn("Discarding local changes...");
|
|
@@ -4762,7 +4764,7 @@ var update_default = defineCommand14({
|
|
|
4762
4764
|
info(`Deleting stale branch ${pc17.bold(currentBranch)}...`);
|
|
4763
4765
|
await forceDeleteBranch(currentBranch);
|
|
4764
4766
|
success(`Deleted ${pc17.bold(currentBranch)}.`);
|
|
4765
|
-
info(`Run ${pc17.bold("contrib start")} to begin a new feature branch
|
|
4767
|
+
info(`Run ${pc17.bold("contrib start")} to begin a new feature branch.`, "");
|
|
4766
4768
|
return;
|
|
4767
4769
|
}
|
|
4768
4770
|
info(`Updating ${pc17.bold(currentBranch)} with latest ${pc17.bold(baseBranch)}...`);
|
|
@@ -4823,7 +4825,7 @@ ${pc17.bold("\uD83D\uDCA1 AI Conflict Resolution Guidance:")}`);
|
|
|
4823
4825
|
console.log(` Or abort: ${pc17.cyan("git rebase --abort")}`);
|
|
4824
4826
|
process.exit(1);
|
|
4825
4827
|
}
|
|
4826
|
-
success(
|
|
4828
|
+
success(`${pc17.bold(currentBranch)} has been rebased onto latest ${pc17.bold(baseBranch)}`);
|
|
4827
4829
|
}
|
|
4828
4830
|
});
|
|
4829
4831
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contribute-now",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1-dev.5d3631e",
|
|
4
4
|
"description": "Developer CLI that automates git workflows — branching, syncing, committing, and PRs — with multi-workflow and commit convention support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|