contribute-now 0.4.1-dev.23d6614 → 0.4.1-dev.6ee6f2c
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 +6 -75
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -645,17 +645,6 @@ async function getRemoteBranches() {
|
|
|
645
645
|
return stdout.trimEnd().split(`
|
|
646
646
|
`).map((line) => line.trim()).filter((line) => line.length > 0 && !line.includes(" -> "));
|
|
647
647
|
}
|
|
648
|
-
async function isBranchMergedInto(branch, base) {
|
|
649
|
-
const { exitCode } = await run(["merge-base", "--is-ancestor", branch, base]);
|
|
650
|
-
return exitCode === 0;
|
|
651
|
-
}
|
|
652
|
-
async function getLastCommitDate(branch) {
|
|
653
|
-
const { exitCode, stdout } = await run(["log", "-1", "--format=%aI", branch]);
|
|
654
|
-
if (exitCode !== 0)
|
|
655
|
-
return null;
|
|
656
|
-
const date = stdout.trim();
|
|
657
|
-
return date || null;
|
|
658
|
-
}
|
|
659
648
|
|
|
660
649
|
// src/utils/logger.ts
|
|
661
650
|
import { LogEngine, LogMode } from "@wgtechlabs/log-engine";
|
|
@@ -2244,7 +2233,7 @@ import pc7 from "picocolors";
|
|
|
2244
2233
|
// package.json
|
|
2245
2234
|
var package_default = {
|
|
2246
2235
|
name: "contribute-now",
|
|
2247
|
-
version: "0.4.1-dev.
|
|
2236
|
+
version: "0.4.1-dev.6ee6f2c",
|
|
2248
2237
|
description: "Developer CLI that automates git workflows — branching, syncing, committing, and PRs — with multi-workflow and commit convention support.",
|
|
2249
2238
|
type: "module",
|
|
2250
2239
|
bin: {
|
|
@@ -3468,20 +3457,10 @@ var status_default = defineCommand9({
|
|
|
3468
3457
|
const devLine = formatStatus(config.devBranch, devRemoteRef, devDiv.ahead, devDiv.behind);
|
|
3469
3458
|
console.log(devLine);
|
|
3470
3459
|
}
|
|
3471
|
-
|
|
3472
|
-
const isFeatureBranch = currentBranch && !protectedBranches.includes(currentBranch);
|
|
3473
|
-
let branchStatus = null;
|
|
3474
|
-
if (isFeatureBranch) {
|
|
3460
|
+
if (currentBranch && currentBranch !== mainBranch && currentBranch !== config.devBranch) {
|
|
3475
3461
|
const branchDiv = await getDivergence(currentBranch, baseBranch);
|
|
3476
3462
|
const branchLine = formatStatus(currentBranch, baseBranch, branchDiv.ahead, branchDiv.behind);
|
|
3477
3463
|
console.log(branchLine + pc12.dim(` (current ${pc12.green("*")})`));
|
|
3478
|
-
branchStatus = await detectBranchStatus(currentBranch, baseBranch, config);
|
|
3479
|
-
if (branchStatus.merged) {
|
|
3480
|
-
console.log(` ${pc12.green("✓")} ${pc12.green("Branch merged")} — ${pc12.dim(branchStatus.mergedReason ?? "all commits reachable from base")}`);
|
|
3481
|
-
}
|
|
3482
|
-
if (branchStatus.stale) {
|
|
3483
|
-
console.log(` ${pc12.yellow("⏳")} ${pc12.yellow("Branch is stale")} — ${pc12.dim(`last commit ${branchStatus.staleDaysAgo} days ago`)}`);
|
|
3484
|
-
}
|
|
3485
3464
|
} else if (currentBranch) {
|
|
3486
3465
|
console.log(pc12.dim(` (on ${pc12.bold(currentBranch)} branch)`));
|
|
3487
3466
|
}
|
|
@@ -3516,16 +3495,10 @@ var status_default = defineCommand9({
|
|
|
3516
3495
|
if (fileStatus.modified.length > 0 || fileStatus.untracked.length > 0) {
|
|
3517
3496
|
tips.push(`Run ${pc12.bold("contrib commit")} to stage and commit changes`);
|
|
3518
3497
|
}
|
|
3519
|
-
if (
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
tips.push(`Run ${pc12.bold("contrib sync")} to rebase on latest changes, or ${pc12.bold("contrib clean")} if no longer needed`);
|
|
3524
|
-
} else if (fileStatus.staged.length === 0 && fileStatus.modified.length === 0 && fileStatus.untracked.length === 0) {
|
|
3525
|
-
const branchDiv = await getDivergence(currentBranch, `${origin}/${currentBranch}`);
|
|
3526
|
-
if (branchDiv.ahead > 0) {
|
|
3527
|
-
tips.push(`Run ${pc12.bold("contrib submit")} to push and create/update your PR`);
|
|
3528
|
-
}
|
|
3498
|
+
if (fileStatus.staged.length === 0 && fileStatus.modified.length === 0 && fileStatus.untracked.length === 0 && currentBranch && currentBranch !== mainBranch && currentBranch !== config.devBranch) {
|
|
3499
|
+
const branchDiv = await getDivergence(currentBranch, `${origin}/${currentBranch}`);
|
|
3500
|
+
if (branchDiv.ahead > 0) {
|
|
3501
|
+
tips.push(`Run ${pc12.bold("contrib submit")} to push and create/update your PR`);
|
|
3529
3502
|
}
|
|
3530
3503
|
}
|
|
3531
3504
|
if (tips.length > 0) {
|
|
@@ -3551,48 +3524,6 @@ function formatStatus(branch, base, ahead, behind) {
|
|
|
3551
3524
|
}
|
|
3552
3525
|
return ` ${pc12.red("⚡")} ${label} ${pc12.yellow(`${ahead} ahead`)}${pc12.dim(", ")}${pc12.red(`${behind} behind`)} ${pc12.dim(base)}`;
|
|
3553
3526
|
}
|
|
3554
|
-
var STALE_THRESHOLD_DAYS = 14;
|
|
3555
|
-
async function detectBranchStatus(branch, baseBranch, config) {
|
|
3556
|
-
const result = { merged: false, mergedReason: null, stale: false, staleDaysAgo: null };
|
|
3557
|
-
const div = await getDivergence(branch, baseBranch);
|
|
3558
|
-
const hasWork = div.ahead > 0;
|
|
3559
|
-
if (hasWork) {
|
|
3560
|
-
if (await isBranchMergedInto(branch, baseBranch)) {
|
|
3561
|
-
result.merged = true;
|
|
3562
|
-
result.mergedReason = `all commits reachable from ${baseBranch}`;
|
|
3563
|
-
return result;
|
|
3564
|
-
}
|
|
3565
|
-
const mergedBranches = await getMergedBranches(baseBranch);
|
|
3566
|
-
if (mergedBranches.includes(branch)) {
|
|
3567
|
-
result.merged = true;
|
|
3568
|
-
result.mergedReason = `listed in merged branches of ${baseBranch}`;
|
|
3569
|
-
return result;
|
|
3570
|
-
}
|
|
3571
|
-
}
|
|
3572
|
-
const goneBranches = await getGoneBranches();
|
|
3573
|
-
if (goneBranches.includes(branch)) {
|
|
3574
|
-
result.merged = true;
|
|
3575
|
-
result.mergedReason = "remote branch deleted (likely squash-merged)";
|
|
3576
|
-
return result;
|
|
3577
|
-
}
|
|
3578
|
-
if (await checkGhInstalled()) {
|
|
3579
|
-
const mergedPR = await getMergedPRForBranch(branch);
|
|
3580
|
-
if (mergedPR) {
|
|
3581
|
-
result.merged = true;
|
|
3582
|
-
result.mergedReason = `PR #${mergedPR.number} was merged`;
|
|
3583
|
-
return result;
|
|
3584
|
-
}
|
|
3585
|
-
}
|
|
3586
|
-
const lastDate = await getLastCommitDate(branch);
|
|
3587
|
-
if (lastDate) {
|
|
3588
|
-
const daysAgo = Math.floor((Date.now() - new Date(lastDate).getTime()) / (1000 * 60 * 60 * 24));
|
|
3589
|
-
if (daysAgo >= STALE_THRESHOLD_DAYS) {
|
|
3590
|
-
result.stale = true;
|
|
3591
|
-
result.staleDaysAgo = daysAgo;
|
|
3592
|
-
}
|
|
3593
|
-
}
|
|
3594
|
-
return result;
|
|
3595
|
-
}
|
|
3596
3527
|
|
|
3597
3528
|
// src/commands/submit.ts
|
|
3598
3529
|
import { defineCommand as defineCommand10 } from "citty";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contribute-now",
|
|
3
|
-
"version": "0.4.1-dev.
|
|
3
|
+
"version": "0.4.1-dev.6ee6f2c",
|
|
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": {
|