contribute-now 0.7.2-dev.d0db30a → 0.7.2-dev.e218315
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/cli.js +419 -303
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7540,6 +7540,9 @@ async function hasLocalWork(remote, branch) {
|
|
|
7540
7540
|
async function deleteRemoteBranch(remote, branch) {
|
|
7541
7541
|
return run(["push", remote, "--delete", branch]);
|
|
7542
7542
|
}
|
|
7543
|
+
async function stashChanges(message) {
|
|
7544
|
+
return run(["stash", "push", "-m", `contrib-save: ${message}`]);
|
|
7545
|
+
}
|
|
7543
7546
|
async function mergeSquash(branch) {
|
|
7544
7547
|
return run(["merge", "--squash", branch]);
|
|
7545
7548
|
}
|
|
@@ -11988,8 +11991,116 @@ ${import_picocolors8.default.bold("Stale branches (remote deleted, likely squash
|
|
|
11988
11991
|
}
|
|
11989
11992
|
});
|
|
11990
11993
|
|
|
11991
|
-
// src/commands/
|
|
11994
|
+
// src/commands/discard.ts
|
|
11992
11995
|
var import_picocolors9 = __toESM(require_picocolors(), 1);
|
|
11996
|
+
var discard_default = defineCommand({
|
|
11997
|
+
meta: {
|
|
11998
|
+
name: "discard",
|
|
11999
|
+
description: "Discard the current feature branch and return to the base branch"
|
|
12000
|
+
},
|
|
12001
|
+
args: {
|
|
12002
|
+
force: {
|
|
12003
|
+
type: "boolean",
|
|
12004
|
+
alias: "f",
|
|
12005
|
+
description: "Skip confirmation and discard immediately",
|
|
12006
|
+
default: false
|
|
12007
|
+
}
|
|
12008
|
+
},
|
|
12009
|
+
async run({ args }) {
|
|
12010
|
+
if (!await isGitRepo()) {
|
|
12011
|
+
error("Not inside a git repository.");
|
|
12012
|
+
process.exit(1);
|
|
12013
|
+
}
|
|
12014
|
+
await assertCleanGitState("discarding a branch");
|
|
12015
|
+
const config = readConfig();
|
|
12016
|
+
if (!config) {
|
|
12017
|
+
error("No repo config found. Run `contrib setup` first.");
|
|
12018
|
+
process.exit(1);
|
|
12019
|
+
}
|
|
12020
|
+
const currentBranch = await getCurrentBranch();
|
|
12021
|
+
const baseBranch = getBaseBranch(config);
|
|
12022
|
+
await projectHeading("discard", "\uD83D\uDDD1\uFE0F");
|
|
12023
|
+
if (isBranchProtected(currentBranch, config)) {
|
|
12024
|
+
error(`${import_picocolors9.default.bold(currentBranch)} is a protected branch and cannot be discarded.`);
|
|
12025
|
+
info(`Switch to a feature branch first, then run ${import_picocolors9.default.bold("contrib discard")}.`);
|
|
12026
|
+
process.exit(1);
|
|
12027
|
+
}
|
|
12028
|
+
if (currentBranch === baseBranch) {
|
|
12029
|
+
info(`You are already on ${import_picocolors9.default.bold(baseBranch)}.`);
|
|
12030
|
+
process.exit(0);
|
|
12031
|
+
}
|
|
12032
|
+
const { origin } = config;
|
|
12033
|
+
const localWork = await hasLocalWork(origin, currentBranch);
|
|
12034
|
+
const hasWork = localWork.uncommitted || localWork.unpushedCommits > 0;
|
|
12035
|
+
if (hasWork) {
|
|
12036
|
+
if (localWork.uncommitted) {
|
|
12037
|
+
warn("You have uncommitted changes in your working tree.");
|
|
12038
|
+
}
|
|
12039
|
+
if (localWork.unpushedCommits > 0) {
|
|
12040
|
+
warn(`You have ${import_picocolors9.default.bold(String(localWork.unpushedCommits))} unpushed commit${localWork.unpushedCommits !== 1 ? "s" : ""} on this branch.`);
|
|
12041
|
+
}
|
|
12042
|
+
warn("Discarding this branch will permanently lose that work.");
|
|
12043
|
+
const SAVE_FIRST = "Save my changes first (cn save), then discard";
|
|
12044
|
+
const DISCARD_ANYWAY = "Discard anyway \u2014 I do not need this work";
|
|
12045
|
+
const CANCEL = "Keep the branch, take me back";
|
|
12046
|
+
const action = await selectPrompt("This branch has unsaved work. What would you like to do?", [SAVE_FIRST, DISCARD_ANYWAY, CANCEL]);
|
|
12047
|
+
if (action === CANCEL) {
|
|
12048
|
+
info("Discard cancelled. Your branch is untouched.");
|
|
12049
|
+
process.exit(0);
|
|
12050
|
+
}
|
|
12051
|
+
if (action === SAVE_FIRST) {
|
|
12052
|
+
if (!localWork.uncommitted) {
|
|
12053
|
+
info("No uncommitted changes to stash \u2014 unpushed commits will still be lost.");
|
|
12054
|
+
const confirm = await confirmPrompt("Continue discarding the branch?");
|
|
12055
|
+
if (!confirm) {
|
|
12056
|
+
info("Discard cancelled.");
|
|
12057
|
+
process.exit(0);
|
|
12058
|
+
}
|
|
12059
|
+
} else {
|
|
12060
|
+
const stashResult = await stashChanges(`work-in-progress on ${currentBranch}`);
|
|
12061
|
+
if (stashResult.exitCode !== 0) {
|
|
12062
|
+
error(`Failed to save changes: ${stashResult.stderr}`);
|
|
12063
|
+
process.exit(1);
|
|
12064
|
+
}
|
|
12065
|
+
success(`Changes saved. Use ${import_picocolors9.default.bold("contrib save --restore")} to bring them back.`);
|
|
12066
|
+
}
|
|
12067
|
+
}
|
|
12068
|
+
} else if (!args.force) {
|
|
12069
|
+
const confirmed = await confirmPrompt(`Discard ${import_picocolors9.default.bold(currentBranch)} and return to ${import_picocolors9.default.bold(baseBranch)}?`);
|
|
12070
|
+
if (!confirmed) {
|
|
12071
|
+
info("Discard cancelled.");
|
|
12072
|
+
process.exit(0);
|
|
12073
|
+
}
|
|
12074
|
+
}
|
|
12075
|
+
const upstreamRef = await getUpstreamRef();
|
|
12076
|
+
let deleteRemote = false;
|
|
12077
|
+
if (upstreamRef) {
|
|
12078
|
+
deleteRemote = await confirmPrompt(`Also delete the remote branch ${import_picocolors9.default.bold(upstreamRef)}?`);
|
|
12079
|
+
}
|
|
12080
|
+
const checkoutResult = await checkoutBranch(baseBranch);
|
|
12081
|
+
if (checkoutResult.exitCode !== 0) {
|
|
12082
|
+
error(`Failed to switch to ${import_picocolors9.default.bold(baseBranch)}: ${checkoutResult.stderr}`);
|
|
12083
|
+
process.exit(1);
|
|
12084
|
+
}
|
|
12085
|
+
const deleteResult = await forceDeleteBranch(currentBranch);
|
|
12086
|
+
if (deleteResult.exitCode !== 0) {
|
|
12087
|
+
error(`Failed to delete branch ${import_picocolors9.default.bold(currentBranch)}: ${deleteResult.stderr}`);
|
|
12088
|
+
process.exit(1);
|
|
12089
|
+
}
|
|
12090
|
+
success(`Discarded ${import_picocolors9.default.bold(currentBranch)} and switched back to ${import_picocolors9.default.bold(baseBranch)}`);
|
|
12091
|
+
if (deleteRemote) {
|
|
12092
|
+
const remoteDeleteResult = await deleteRemoteBranch(origin, currentBranch);
|
|
12093
|
+
if (remoteDeleteResult.exitCode !== 0) {
|
|
12094
|
+
warn(`Could not delete remote branch: ${remoteDeleteResult.stderr.trim()}`);
|
|
12095
|
+
} else {
|
|
12096
|
+
success(`Deleted remote branch ${import_picocolors9.default.bold(`${origin}/${currentBranch}`)}`);
|
|
12097
|
+
}
|
|
12098
|
+
}
|
|
12099
|
+
}
|
|
12100
|
+
});
|
|
12101
|
+
|
|
12102
|
+
// src/commands/commit.ts
|
|
12103
|
+
var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
11993
12104
|
|
|
11994
12105
|
// src/utils/convention.ts
|
|
11995
12106
|
var CLEAN_COMMIT_PATTERN = /^(\uD83D\uDCE6|\uD83D\uDD27|\uD83D\uDDD1\uFE0F?|\uD83D\uDD12|\u2699\uFE0F?|\u2615|\uD83E\uDDEA|\uD83D\uDCD6|\uD83D\uDE80) (new|update|remove|security|setup|chore|test|docs|release)(!?)( \([a-zA-Z0-9][a-zA-Z0-9-]*\))?: .{1,72}$/u;
|
|
@@ -12096,9 +12207,9 @@ var commit_default = defineCommand({
|
|
|
12096
12207
|
process.exit(1);
|
|
12097
12208
|
}
|
|
12098
12209
|
console.log(`
|
|
12099
|
-
${
|
|
12210
|
+
${import_picocolors10.default.bold("Changed files:")}`);
|
|
12100
12211
|
for (const f3 of changedFiles) {
|
|
12101
|
-
console.log(` ${
|
|
12212
|
+
console.log(` ${import_picocolors10.default.dim("\u2022")} ${f3}`);
|
|
12102
12213
|
}
|
|
12103
12214
|
const stageAction = await selectPrompt("No staged changes. How would you like to stage?", [
|
|
12104
12215
|
"Stage all changes",
|
|
@@ -12140,8 +12251,8 @@ ${import_picocolors9.default.bold("Changed files:")}`);
|
|
|
12140
12251
|
const dirs = new Set(stagedFiles.map((f3) => f3.split("/")[0]));
|
|
12141
12252
|
if (dirs.size > 1) {
|
|
12142
12253
|
console.log();
|
|
12143
|
-
warn(`You're staging ${
|
|
12144
|
-
info(
|
|
12254
|
+
warn(`You're staging ${import_picocolors10.default.bold(String(stagedFiles.length))} files across ${import_picocolors10.default.bold(String(dirs.size))} directories in a single commit.`);
|
|
12255
|
+
info(import_picocolors10.default.dim("Large commits mixing different topics make history harder to read and bisect. " + "For cleaner history, consider splitting into atomic commits."));
|
|
12145
12256
|
const choice = await selectPrompt("How would you like to proceed?", [
|
|
12146
12257
|
"Continue as single commit",
|
|
12147
12258
|
"Switch to group mode (AI splits into atomic commits)",
|
|
@@ -12172,7 +12283,7 @@ ${import_picocolors9.default.bold("Changed files:")}`);
|
|
|
12172
12283
|
if (commitMessage) {
|
|
12173
12284
|
spinner.success("AI commit message generated.");
|
|
12174
12285
|
console.log(`
|
|
12175
|
-
${
|
|
12286
|
+
${import_picocolors10.default.dim("AI suggestion:")} ${import_picocolors10.default.bold(import_picocolors10.default.cyan(commitMessage))}`);
|
|
12176
12287
|
} else {
|
|
12177
12288
|
spinner.fail("AI did not return a commit message.");
|
|
12178
12289
|
warn("Falling back to manual entry.");
|
|
@@ -12200,7 +12311,7 @@ ${import_picocolors9.default.bold("Changed files:")}`);
|
|
|
12200
12311
|
if (regen) {
|
|
12201
12312
|
spinner.success("Commit message regenerated.");
|
|
12202
12313
|
console.log(`
|
|
12203
|
-
${
|
|
12314
|
+
${import_picocolors10.default.dim("AI suggestion:")} ${import_picocolors10.default.bold(import_picocolors10.default.cyan(regen))}`);
|
|
12204
12315
|
const ok = await confirmPrompt("Use this message?");
|
|
12205
12316
|
finalMessage = ok ? regen : await inputPrompt("Enter commit message manually");
|
|
12206
12317
|
} else {
|
|
@@ -12215,7 +12326,7 @@ ${import_picocolors9.default.bold("Changed files:")}`);
|
|
|
12215
12326
|
if (convention2 !== "none") {
|
|
12216
12327
|
console.log();
|
|
12217
12328
|
for (const hint of CONVENTION_FORMAT_HINTS[convention2]) {
|
|
12218
|
-
console.log(
|
|
12329
|
+
console.log(import_picocolors10.default.dim(hint));
|
|
12219
12330
|
}
|
|
12220
12331
|
console.log();
|
|
12221
12332
|
}
|
|
@@ -12239,7 +12350,7 @@ ${import_picocolors9.default.bold("Changed files:")}`);
|
|
|
12239
12350
|
error(`Failed to commit: ${result.stderr}`);
|
|
12240
12351
|
process.exit(1);
|
|
12241
12352
|
}
|
|
12242
|
-
success(`Committed: ${
|
|
12353
|
+
success(`Committed: ${import_picocolors10.default.bold(finalMessage)}`);
|
|
12243
12354
|
}
|
|
12244
12355
|
});
|
|
12245
12356
|
async function runGroupCommit(model, config) {
|
|
@@ -12256,9 +12367,9 @@ async function runGroupCommit(model, config) {
|
|
|
12256
12367
|
process.exit(1);
|
|
12257
12368
|
}
|
|
12258
12369
|
console.log(`
|
|
12259
|
-
${
|
|
12370
|
+
${import_picocolors10.default.bold("Changed files:")}`);
|
|
12260
12371
|
for (const f3 of changedFiles) {
|
|
12261
|
-
console.log(` ${
|
|
12372
|
+
console.log(` ${import_picocolors10.default.dim("\u2022")} ${f3}`);
|
|
12262
12373
|
}
|
|
12263
12374
|
const spinner = createSpinner(changedFiles.length >= BATCH_CONFIG.LARGE_CHANGESET_THRESHOLD ? `Asking AI to group ${changedFiles.length} file(s) into logical commits (using optimized batching)...` : `Asking AI to group ${changedFiles.length} file(s) into logical commits...`, {
|
|
12264
12375
|
tips: LOADING_TIPS
|
|
@@ -12304,13 +12415,13 @@ ${import_picocolors9.default.bold("Changed files:")}`);
|
|
|
12304
12415
|
let commitAll = false;
|
|
12305
12416
|
while (!proceedToCommit) {
|
|
12306
12417
|
console.log(`
|
|
12307
|
-
${
|
|
12418
|
+
${import_picocolors10.default.bold(`AI suggested ${validGroups.length} commit group(s):`)}
|
|
12308
12419
|
`);
|
|
12309
12420
|
for (let i2 = 0;i2 < validGroups.length; i2++) {
|
|
12310
12421
|
const g3 = validGroups[i2];
|
|
12311
|
-
console.log(` ${
|
|
12422
|
+
console.log(` ${import_picocolors10.default.cyan(`Group ${i2 + 1}:`)} ${import_picocolors10.default.bold(g3.message)}`);
|
|
12312
12423
|
for (const f3 of g3.files) {
|
|
12313
|
-
console.log(` ${
|
|
12424
|
+
console.log(` ${import_picocolors10.default.dim("\u2022")} ${f3}`);
|
|
12314
12425
|
}
|
|
12315
12426
|
console.log();
|
|
12316
12427
|
}
|
|
@@ -12376,16 +12487,16 @@ ${import_picocolors9.default.bold(`AI suggested ${validGroups.length} commit gro
|
|
|
12376
12487
|
continue;
|
|
12377
12488
|
}
|
|
12378
12489
|
committed++;
|
|
12379
|
-
success(`Committed group ${i2 + 1}: ${
|
|
12490
|
+
success(`Committed group ${i2 + 1}: ${import_picocolors10.default.bold(group.message)}`);
|
|
12380
12491
|
}
|
|
12381
12492
|
} else {
|
|
12382
12493
|
for (let i2 = 0;i2 < validGroups.length; i2++) {
|
|
12383
12494
|
const group = validGroups[i2];
|
|
12384
|
-
console.log(
|
|
12495
|
+
console.log(import_picocolors10.default.bold(`
|
|
12385
12496
|
\u2500\u2500 Group ${i2 + 1}/${validGroups.length} \u2500\u2500`));
|
|
12386
|
-
console.log(` ${
|
|
12497
|
+
console.log(` ${import_picocolors10.default.cyan(group.message)}`);
|
|
12387
12498
|
for (const f3 of group.files) {
|
|
12388
|
-
console.log(` ${
|
|
12499
|
+
console.log(` ${import_picocolors10.default.dim("\u2022")} ${f3}`);
|
|
12389
12500
|
}
|
|
12390
12501
|
let message = group.message;
|
|
12391
12502
|
let actionDone = false;
|
|
@@ -12409,7 +12520,7 @@ ${import_picocolors9.default.bold(`AI suggested ${validGroups.length} commit gro
|
|
|
12409
12520
|
if (newMsg) {
|
|
12410
12521
|
message = newMsg;
|
|
12411
12522
|
group.message = newMsg;
|
|
12412
|
-
regenSpinner.success(`New message: ${
|
|
12523
|
+
regenSpinner.success(`New message: ${import_picocolors10.default.bold(message)}`);
|
|
12413
12524
|
} else {
|
|
12414
12525
|
regenSpinner.fail("AI could not generate a new message. Keeping current one.");
|
|
12415
12526
|
}
|
|
@@ -12472,7 +12583,7 @@ ${import_picocolors9.default.bold(`AI suggested ${validGroups.length} commit gro
|
|
|
12472
12583
|
continue;
|
|
12473
12584
|
}
|
|
12474
12585
|
committed++;
|
|
12475
|
-
success(`Committed group ${i2 + 1}: ${
|
|
12586
|
+
success(`Committed group ${i2 + 1}: ${import_picocolors10.default.bold(message)}`);
|
|
12476
12587
|
actionDone = true;
|
|
12477
12588
|
}
|
|
12478
12589
|
}
|
|
@@ -12487,7 +12598,7 @@ ${import_picocolors9.default.bold(`AI suggested ${validGroups.length} commit gro
|
|
|
12487
12598
|
}
|
|
12488
12599
|
|
|
12489
12600
|
// src/commands/config.ts
|
|
12490
|
-
var
|
|
12601
|
+
var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
12491
12602
|
var WORKFLOW_OPTIONS = [
|
|
12492
12603
|
{ value: "clean-flow", label: WORKFLOW_DESCRIPTIONS["clean-flow"] },
|
|
12493
12604
|
{ value: "github-flow", label: WORKFLOW_DESCRIPTIONS["github-flow"] },
|
|
@@ -12703,7 +12814,7 @@ async function applyOllamaApiKeyEdit(result) {
|
|
|
12703
12814
|
if (result.ollamaApiKeyAction === "set" && result.ollamaApiKey) {
|
|
12704
12815
|
await setOllamaCloudApiKey(result.ollamaApiKey);
|
|
12705
12816
|
success("Stored Ollama Cloud API key in the local secrets store.");
|
|
12706
|
-
info(`Secrets path: ${
|
|
12817
|
+
info(`Secrets path: ${import_picocolors11.default.bold(getSecretsStorePath())}`);
|
|
12707
12818
|
return;
|
|
12708
12819
|
}
|
|
12709
12820
|
if (result.ollamaApiKeyAction === "delete") {
|
|
@@ -12716,29 +12827,29 @@ async function applyOllamaApiKeyEdit(result) {
|
|
|
12716
12827
|
}
|
|
12717
12828
|
}
|
|
12718
12829
|
function printConfigSummary(snapshot) {
|
|
12719
|
-
info(`Config source: ${
|
|
12720
|
-
info(`Config path: ${
|
|
12721
|
-
info(`Workflow: ${
|
|
12722
|
-
info(`Convention: ${
|
|
12723
|
-
info(`Role: ${
|
|
12830
|
+
info(`Config source: ${import_picocolors11.default.bold(snapshot.source)}`);
|
|
12831
|
+
info(`Config path: ${import_picocolors11.default.bold(snapshot.location)}`);
|
|
12832
|
+
info(`Workflow: ${import_picocolors11.default.bold(snapshot.workflowLabel)}`);
|
|
12833
|
+
info(`Convention: ${import_picocolors11.default.bold(snapshot.commitConventionLabel)}`);
|
|
12834
|
+
info(`Role: ${import_picocolors11.default.bold(snapshot.role)}`);
|
|
12724
12835
|
if (snapshot.devBranch) {
|
|
12725
|
-
info(`Main: ${
|
|
12836
|
+
info(`Main: ${import_picocolors11.default.bold(snapshot.mainBranch)} | Dev: ${import_picocolors11.default.bold(snapshot.devBranch)}`);
|
|
12726
12837
|
} else {
|
|
12727
|
-
info(`Main: ${
|
|
12838
|
+
info(`Main: ${import_picocolors11.default.bold(snapshot.mainBranch)}`);
|
|
12728
12839
|
}
|
|
12729
|
-
info(`Origin: ${
|
|
12730
|
-
info(`Branch prefixes: ${
|
|
12731
|
-
info(`Guides: ${
|
|
12732
|
-
info(`AI: ${
|
|
12840
|
+
info(`Origin: ${import_picocolors11.default.bold(snapshot.origin)} | Upstream: ${import_picocolors11.default.bold(snapshot.upstream)}`);
|
|
12841
|
+
info(`Branch prefixes: ${import_picocolors11.default.bold(snapshot.branchPrefixes.join(", "))}`);
|
|
12842
|
+
info(`Guides: ${import_picocolors11.default.bold(snapshot.showTips ? "shown" : "hidden")}`);
|
|
12843
|
+
info(`AI: ${import_picocolors11.default.bold(snapshot.ai.enabled ? "enabled" : "disabled")}`);
|
|
12733
12844
|
if (snapshot.ai.enabled && snapshot.ai.providerLabel) {
|
|
12734
|
-
info(`AI provider: ${
|
|
12845
|
+
info(`AI provider: ${import_picocolors11.default.bold(snapshot.ai.providerLabel)}`);
|
|
12735
12846
|
if (snapshot.ai.model) {
|
|
12736
|
-
info(`AI model: ${
|
|
12847
|
+
info(`AI model: ${import_picocolors11.default.bold(snapshot.ai.model)}`);
|
|
12737
12848
|
}
|
|
12738
12849
|
if (snapshot.ai.provider === "ollama-cloud") {
|
|
12739
|
-
info(`Ollama Cloud API key: ${
|
|
12850
|
+
info(`Ollama Cloud API key: ${import_picocolors11.default.bold(snapshot.ai.ollamaCloudApiKeyPresent ? "stored" : "missing")}`);
|
|
12740
12851
|
if (snapshot.ai.secretsPath) {
|
|
12741
|
-
info(`Secrets path: ${
|
|
12852
|
+
info(`Secrets path: ${import_picocolors11.default.bold(snapshot.ai.secretsPath)}`);
|
|
12742
12853
|
}
|
|
12743
12854
|
}
|
|
12744
12855
|
}
|
|
@@ -12814,18 +12925,18 @@ var config_default = defineCommand({
|
|
|
12814
12925
|
}
|
|
12815
12926
|
printConfigSummary(snapshot);
|
|
12816
12927
|
console.log();
|
|
12817
|
-
console.log(` ${
|
|
12928
|
+
console.log(` ${import_picocolors11.default.dim("Run `contrib config --edit` to update these settings.")}`);
|
|
12818
12929
|
console.log();
|
|
12819
12930
|
}
|
|
12820
12931
|
});
|
|
12821
12932
|
|
|
12822
12933
|
// src/commands/doctor.ts
|
|
12823
12934
|
import { execFile as execFileCb3 } from "child_process";
|
|
12824
|
-
var
|
|
12935
|
+
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
12825
12936
|
// package.json
|
|
12826
12937
|
var package_default = {
|
|
12827
12938
|
name: "contribute-now",
|
|
12828
|
-
version: "0.7.2-dev.
|
|
12939
|
+
version: "0.7.2-dev.e218315",
|
|
12829
12940
|
description: "Developer CLI that automates git workflows \u2014 branching, syncing, committing, and PRs \u2014 with multi-workflow and commit convention support.",
|
|
12830
12941
|
type: "module",
|
|
12831
12942
|
bin: {
|
|
@@ -12915,16 +13026,16 @@ async function getRepoInfoFromRemote(remote = "origin") {
|
|
|
12915
13026
|
}
|
|
12916
13027
|
|
|
12917
13028
|
// src/commands/doctor.ts
|
|
12918
|
-
var PASS = ` ${
|
|
12919
|
-
var FAIL = ` ${
|
|
12920
|
-
var WARN = ` ${
|
|
13029
|
+
var PASS = ` ${import_picocolors12.default.green("\u2714")} `;
|
|
13030
|
+
var FAIL = ` ${import_picocolors12.default.red("\u2717")} `;
|
|
13031
|
+
var WARN = ` ${import_picocolors12.default.yellow("\u26A0")} `;
|
|
12921
13032
|
function printReport(report) {
|
|
12922
13033
|
for (const section of report.sections) {
|
|
12923
13034
|
console.log(`
|
|
12924
|
-
${
|
|
13035
|
+
${import_picocolors12.default.bold(import_picocolors12.default.underline(section.title))}`);
|
|
12925
13036
|
for (const check of section.checks) {
|
|
12926
13037
|
const prefix = check.ok ? check.warning ? WARN : PASS : FAIL;
|
|
12927
|
-
const text = check.detail ? `${check.label} ${
|
|
13038
|
+
const text = check.detail ? `${check.label} ${import_picocolors12.default.dim(`\u2014 ${check.detail}`)}` : check.label;
|
|
12928
13039
|
console.log(`${prefix}${text}`);
|
|
12929
13040
|
}
|
|
12930
13041
|
}
|
|
@@ -13256,14 +13367,14 @@ var doctor_default = defineCommand({
|
|
|
13256
13367
|
const failures = total.filter((c3) => !c3.ok);
|
|
13257
13368
|
const warnings = total.filter((c3) => c3.ok && c3.warning);
|
|
13258
13369
|
if (failures.length === 0 && warnings.length === 0) {
|
|
13259
|
-
console.log(` ${
|
|
13370
|
+
console.log(` ${import_picocolors12.default.green("All checks passed!")} No issues detected.
|
|
13260
13371
|
`);
|
|
13261
13372
|
} else {
|
|
13262
13373
|
if (failures.length > 0) {
|
|
13263
|
-
console.log(` ${
|
|
13374
|
+
console.log(` ${import_picocolors12.default.red(`${failures.length} issue${failures.length !== 1 ? "s" : ""} found.`)}`);
|
|
13264
13375
|
}
|
|
13265
13376
|
if (warnings.length > 0) {
|
|
13266
|
-
console.log(` ${
|
|
13377
|
+
console.log(` ${import_picocolors12.default.yellow(`${warnings.length} warning${warnings.length !== 1 ? "s" : ""}.`)}`);
|
|
13267
13378
|
}
|
|
13268
13379
|
console.log();
|
|
13269
13380
|
}
|
|
@@ -13273,7 +13384,7 @@ var doctor_default = defineCommand({
|
|
|
13273
13384
|
// src/commands/hook.ts
|
|
13274
13385
|
import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync5, rmSync as rmSync2, writeFileSync as writeFileSync5 } from "fs";
|
|
13275
13386
|
import { join as join6 } from "path";
|
|
13276
|
-
var
|
|
13387
|
+
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
13277
13388
|
var HOOK_MARKER = "# managed by contribute-now";
|
|
13278
13389
|
function getHooksDir(cwd = process.cwd()) {
|
|
13279
13390
|
return join6(cwd, ".git", "hooks");
|
|
@@ -13365,8 +13476,8 @@ async function installHook() {
|
|
|
13365
13476
|
}
|
|
13366
13477
|
writeFileSync5(hookPath, generateHookScript(), { mode: 493 });
|
|
13367
13478
|
success(`commit-msg hook installed.`);
|
|
13368
|
-
info(`Convention: ${
|
|
13369
|
-
info(`Path: ${
|
|
13479
|
+
info(`Convention: ${import_picocolors13.default.bold(CONVENTION_LABELS[config.commitConvention])}`, "");
|
|
13480
|
+
info(`Path: ${import_picocolors13.default.dim(hookPath)}`, "");
|
|
13370
13481
|
warn("Note: hooks can be bypassed with `git commit --no-verify`.");
|
|
13371
13482
|
}
|
|
13372
13483
|
async function uninstallHook() {
|
|
@@ -13386,7 +13497,7 @@ async function uninstallHook() {
|
|
|
13386
13497
|
}
|
|
13387
13498
|
|
|
13388
13499
|
// src/commands/log.ts
|
|
13389
|
-
var
|
|
13500
|
+
var import_picocolors14 = __toESM(require_picocolors(), 1);
|
|
13390
13501
|
function getDefaultOverviewRemoteCommitCount(hasLocalUnpushedCommits) {
|
|
13391
13502
|
return hasLocalUnpushedCommits ? 10 : 20;
|
|
13392
13503
|
}
|
|
@@ -13484,9 +13595,9 @@ var log_default = defineCommand({
|
|
|
13484
13595
|
} else if (mode === "local") {
|
|
13485
13596
|
if (!compareRef) {
|
|
13486
13597
|
console.log();
|
|
13487
|
-
console.log(
|
|
13488
|
-
console.log(
|
|
13489
|
-
console.log(
|
|
13598
|
+
console.log(import_picocolors14.default.yellow(" \u26A0 Could not determine a comparison branch."));
|
|
13599
|
+
console.log(import_picocolors14.default.dim(" No upstream tracking set and no remote base branch found."));
|
|
13600
|
+
console.log(import_picocolors14.default.dim(` Use ${import_picocolors14.default.bold("contrib log --full")} to see the full commit history instead.`));
|
|
13490
13601
|
console.log();
|
|
13491
13602
|
return;
|
|
13492
13603
|
}
|
|
@@ -13505,8 +13616,8 @@ var log_default = defineCommand({
|
|
|
13505
13616
|
const remoteBranch = compareRef ?? targetBranch;
|
|
13506
13617
|
if (!remoteBranch) {
|
|
13507
13618
|
console.log();
|
|
13508
|
-
console.log(
|
|
13509
|
-
console.log(
|
|
13619
|
+
console.log(import_picocolors14.default.yellow(" \u26A0 Could not determine a remote branch to display."));
|
|
13620
|
+
console.log(import_picocolors14.default.dim(" Set an upstream tracking branch or configure your base branch first."));
|
|
13510
13621
|
console.log();
|
|
13511
13622
|
return;
|
|
13512
13623
|
}
|
|
@@ -13565,31 +13676,31 @@ async function getOverviewRemoteCommitCount(currentBranch, compareRef) {
|
|
|
13565
13676
|
}
|
|
13566
13677
|
function printModeHeader(mode, currentBranch, compareRef, usingFallback = false) {
|
|
13567
13678
|
const branch = currentBranch ?? "HEAD";
|
|
13568
|
-
const fallbackNote = usingFallback ?
|
|
13679
|
+
const fallbackNote = usingFallback ? import_picocolors14.default.yellow(" (no upstream \u2014 comparing against base branch)") : "";
|
|
13569
13680
|
switch (mode) {
|
|
13570
13681
|
case "overview":
|
|
13571
|
-
console.log(
|
|
13682
|
+
console.log(import_picocolors14.default.dim(` mode: ${import_picocolors14.default.bold("overview")} \u2014 local unpushed commits and remote branch history for ${import_picocolors14.default.bold(branch)}`) + fallbackNote);
|
|
13572
13683
|
if (compareRef) {
|
|
13573
|
-
console.log(
|
|
13684
|
+
console.log(import_picocolors14.default.dim(` remote source: ${import_picocolors14.default.bold(compareRef)}`));
|
|
13574
13685
|
}
|
|
13575
13686
|
break;
|
|
13576
13687
|
case "local":
|
|
13577
|
-
console.log(
|
|
13688
|
+
console.log(import_picocolors14.default.dim(` mode: ${import_picocolors14.default.bold("local")} \u2014 unpushed commits on ${import_picocolors14.default.bold(branch)}`) + fallbackNote);
|
|
13578
13689
|
if (compareRef) {
|
|
13579
|
-
console.log(
|
|
13690
|
+
console.log(import_picocolors14.default.dim(` comparing: ${import_picocolors14.default.bold(compareRef)} \u279C ${import_picocolors14.default.bold("HEAD")}`));
|
|
13580
13691
|
}
|
|
13581
13692
|
break;
|
|
13582
13693
|
case "remote":
|
|
13583
|
-
console.log(
|
|
13694
|
+
console.log(import_picocolors14.default.dim(` mode: ${import_picocolors14.default.bold("remote")} \u2014 remote branch history relevant to ${import_picocolors14.default.bold(branch)}`) + fallbackNote);
|
|
13584
13695
|
if (compareRef) {
|
|
13585
|
-
console.log(
|
|
13696
|
+
console.log(import_picocolors14.default.dim(` branch: ${import_picocolors14.default.bold(compareRef)}`));
|
|
13586
13697
|
}
|
|
13587
13698
|
break;
|
|
13588
13699
|
case "full":
|
|
13589
|
-
console.log(
|
|
13700
|
+
console.log(import_picocolors14.default.dim(` mode: ${import_picocolors14.default.bold("full")} \u2014 complete commit history for ${import_picocolors14.default.bold(branch)}`));
|
|
13590
13701
|
break;
|
|
13591
13702
|
case "all":
|
|
13592
|
-
console.log(
|
|
13703
|
+
console.log(import_picocolors14.default.dim(` mode: ${import_picocolors14.default.bold("all")} \u2014 commits across all branches`));
|
|
13593
13704
|
break;
|
|
13594
13705
|
}
|
|
13595
13706
|
}
|
|
@@ -13613,7 +13724,7 @@ async function renderScopedLog(options) {
|
|
|
13613
13724
|
}
|
|
13614
13725
|
console.log();
|
|
13615
13726
|
for (const entry of entries) {
|
|
13616
|
-
const hashStr =
|
|
13727
|
+
const hashStr = import_picocolors14.default.yellow(entry.hash);
|
|
13617
13728
|
const refsStr = entry.refs ? ` ${colorizeRefs(entry.refs, protectedBranches, currentBranch)}` : "";
|
|
13618
13729
|
const subjectStr = colorizeSubject(entry.subject);
|
|
13619
13730
|
console.log(` ${hashStr}${refsStr} ${subjectStr}`);
|
|
@@ -13632,10 +13743,10 @@ async function renderOverviewLog(options) {
|
|
|
13632
13743
|
usingFallback
|
|
13633
13744
|
} = options;
|
|
13634
13745
|
console.log();
|
|
13635
|
-
console.log(
|
|
13746
|
+
console.log(import_picocolors14.default.bold(import_picocolors14.default.cyan(" Local Unpushed Commits")));
|
|
13636
13747
|
if (!compareRef) {
|
|
13637
|
-
console.log(
|
|
13638
|
-
console.log(
|
|
13748
|
+
console.log(import_picocolors14.default.dim(" No comparison branch detected for local commit status."));
|
|
13749
|
+
console.log(import_picocolors14.default.dim(" Set an upstream tracking branch or run cn log --full to inspect the current branch history."));
|
|
13639
13750
|
} else {
|
|
13640
13751
|
await renderScopedLog({
|
|
13641
13752
|
mode: "local",
|
|
@@ -13647,11 +13758,11 @@ async function renderOverviewLog(options) {
|
|
|
13647
13758
|
});
|
|
13648
13759
|
}
|
|
13649
13760
|
console.log();
|
|
13650
|
-
console.log(
|
|
13761
|
+
console.log(import_picocolors14.default.bold(import_picocolors14.default.cyan(" Remote Branch History")));
|
|
13651
13762
|
if (!compareRef) {
|
|
13652
|
-
console.log(
|
|
13763
|
+
console.log(import_picocolors14.default.dim(" No remote branch detected."));
|
|
13653
13764
|
if (usingFallback) {
|
|
13654
|
-
console.log(
|
|
13765
|
+
console.log(import_picocolors14.default.dim(" Configure your base branch or upstream tracking to enable the split view."));
|
|
13655
13766
|
}
|
|
13656
13767
|
return;
|
|
13657
13768
|
}
|
|
@@ -13664,15 +13775,15 @@ async function renderOverviewLog(options) {
|
|
|
13664
13775
|
currentBranch
|
|
13665
13776
|
});
|
|
13666
13777
|
if (!hasRemoteHistory) {
|
|
13667
|
-
console.log(
|
|
13778
|
+
console.log(import_picocolors14.default.dim(" No remote history found for the selected branch."));
|
|
13668
13779
|
}
|
|
13669
13780
|
}
|
|
13670
13781
|
function printEmptyState(mode) {
|
|
13671
13782
|
console.log();
|
|
13672
13783
|
if (mode === "local") {
|
|
13673
|
-
console.log(
|
|
13784
|
+
console.log(import_picocolors14.default.dim(" No local unpushed commits \u2014 you're up to date with remote!"));
|
|
13674
13785
|
} else {
|
|
13675
|
-
console.log(
|
|
13786
|
+
console.log(import_picocolors14.default.dim(" No remote-only commits \u2014 your local branch is up to date!"));
|
|
13676
13787
|
}
|
|
13677
13788
|
console.log();
|
|
13678
13789
|
}
|
|
@@ -13681,7 +13792,7 @@ async function renderFullLog(options) {
|
|
|
13681
13792
|
if (showGraph) {
|
|
13682
13793
|
const lines = await getLogGraph({ count, all, branch: targetBranch });
|
|
13683
13794
|
if (lines.length === 0) {
|
|
13684
|
-
console.log(
|
|
13795
|
+
console.log(import_picocolors14.default.dim(" No commits found."));
|
|
13685
13796
|
console.log();
|
|
13686
13797
|
return false;
|
|
13687
13798
|
}
|
|
@@ -13692,13 +13803,13 @@ async function renderFullLog(options) {
|
|
|
13692
13803
|
} else {
|
|
13693
13804
|
const entries = await getLogEntries({ count, all, branch: targetBranch });
|
|
13694
13805
|
if (entries.length === 0) {
|
|
13695
|
-
console.log(
|
|
13806
|
+
console.log(import_picocolors14.default.dim(" No commits found."));
|
|
13696
13807
|
console.log();
|
|
13697
13808
|
return false;
|
|
13698
13809
|
}
|
|
13699
13810
|
console.log();
|
|
13700
13811
|
for (const entry of entries) {
|
|
13701
|
-
const hashStr =
|
|
13812
|
+
const hashStr = import_picocolors14.default.yellow(entry.hash);
|
|
13702
13813
|
const refsStr = entry.refs ? ` ${colorizeRefs(entry.refs, protectedBranches, currentBranch)}` : "";
|
|
13703
13814
|
const subjectStr = colorizeSubject(entry.subject);
|
|
13704
13815
|
console.log(` ${hashStr}${refsStr} ${subjectStr}`);
|
|
@@ -13710,33 +13821,33 @@ function printFooter(mode, count, overviewRemoteCount, targetBranch) {
|
|
|
13710
13821
|
console.log();
|
|
13711
13822
|
switch (mode) {
|
|
13712
13823
|
case "overview":
|
|
13713
|
-
console.log(
|
|
13824
|
+
console.log(import_picocolors14.default.dim(` Showing up to ${count} local commits and ${overviewRemoteCount} remote commits`));
|
|
13714
13825
|
break;
|
|
13715
13826
|
case "local":
|
|
13716
|
-
console.log(
|
|
13827
|
+
console.log(import_picocolors14.default.dim(` Showing up to ${count} unpushed commits`));
|
|
13717
13828
|
break;
|
|
13718
13829
|
case "remote":
|
|
13719
|
-
console.log(
|
|
13830
|
+
console.log(import_picocolors14.default.dim(` Showing ${count} most recent commits from the remote branch`));
|
|
13720
13831
|
break;
|
|
13721
13832
|
case "full":
|
|
13722
|
-
console.log(
|
|
13833
|
+
console.log(import_picocolors14.default.dim(` Showing ${count} most recent commits${targetBranch ? ` (${targetBranch})` : ""}`));
|
|
13723
13834
|
break;
|
|
13724
13835
|
case "all":
|
|
13725
|
-
console.log(
|
|
13836
|
+
console.log(import_picocolors14.default.dim(` Showing ${count} most recent commits (all branches)`));
|
|
13726
13837
|
break;
|
|
13727
13838
|
}
|
|
13728
13839
|
}
|
|
13729
13840
|
function colorizeGraphLine(line, protectedBranches, currentBranch) {
|
|
13730
13841
|
const match = line.match(/^([|/\\*\s_.-]*)([a-f0-9]{7,12})(\s+\(([^)]+)\))?\s*(.*)/);
|
|
13731
13842
|
if (!match) {
|
|
13732
|
-
return
|
|
13843
|
+
return import_picocolors14.default.cyan(line);
|
|
13733
13844
|
}
|
|
13734
13845
|
const [, graphPart = "", hash, , refs, subject = ""] = match;
|
|
13735
13846
|
const parts = [];
|
|
13736
13847
|
if (graphPart) {
|
|
13737
13848
|
parts.push(colorizeGraphChars(graphPart));
|
|
13738
13849
|
}
|
|
13739
|
-
parts.push(
|
|
13850
|
+
parts.push(import_picocolors14.default.yellow(hash));
|
|
13740
13851
|
if (refs) {
|
|
13741
13852
|
parts.push(` (${colorizeRefs(refs, protectedBranches, currentBranch)})`);
|
|
13742
13853
|
}
|
|
@@ -13747,15 +13858,15 @@ function colorizeGraphChars(graphPart) {
|
|
|
13747
13858
|
return graphPart.split("").map((ch) => {
|
|
13748
13859
|
switch (ch) {
|
|
13749
13860
|
case "*":
|
|
13750
|
-
return
|
|
13861
|
+
return import_picocolors14.default.green(ch);
|
|
13751
13862
|
case "|":
|
|
13752
|
-
return
|
|
13863
|
+
return import_picocolors14.default.cyan(ch);
|
|
13753
13864
|
case "/":
|
|
13754
13865
|
case "\\":
|
|
13755
|
-
return
|
|
13866
|
+
return import_picocolors14.default.cyan(ch);
|
|
13756
13867
|
case "-":
|
|
13757
13868
|
case "_":
|
|
13758
|
-
return
|
|
13869
|
+
return import_picocolors14.default.cyan(ch);
|
|
13759
13870
|
default:
|
|
13760
13871
|
return ch;
|
|
13761
13872
|
}
|
|
@@ -13767,46 +13878,46 @@ function colorizeRefs(refs, protectedBranches, currentBranch) {
|
|
|
13767
13878
|
if (trimmed.startsWith("HEAD ->") || trimmed === "HEAD") {
|
|
13768
13879
|
const branchName = trimmed.replace("HEAD -> ", "");
|
|
13769
13880
|
if (trimmed === "HEAD") {
|
|
13770
|
-
return
|
|
13881
|
+
return import_picocolors14.default.bold(import_picocolors14.default.cyan("HEAD"));
|
|
13771
13882
|
}
|
|
13772
|
-
return `${
|
|
13883
|
+
return `${import_picocolors14.default.bold(import_picocolors14.default.cyan("HEAD"))} ${import_picocolors14.default.dim("->")} ${colorizeRefName(branchName, protectedBranches, currentBranch)}`;
|
|
13773
13884
|
}
|
|
13774
13885
|
if (trimmed.startsWith("tag:")) {
|
|
13775
|
-
return
|
|
13886
|
+
return import_picocolors14.default.bold(import_picocolors14.default.magenta(trimmed));
|
|
13776
13887
|
}
|
|
13777
13888
|
return colorizeRefName(trimmed, protectedBranches, currentBranch);
|
|
13778
|
-
}).join(
|
|
13889
|
+
}).join(import_picocolors14.default.dim(", "));
|
|
13779
13890
|
}
|
|
13780
13891
|
function colorizeRefName(name, protectedBranches, currentBranch) {
|
|
13781
13892
|
const isRemote = name.includes("/");
|
|
13782
13893
|
const localName = isRemote ? name.split("/").slice(1).join("/") : name;
|
|
13783
13894
|
if (protectedBranches.includes(localName)) {
|
|
13784
|
-
return isRemote ?
|
|
13895
|
+
return isRemote ? import_picocolors14.default.bold(import_picocolors14.default.red(name)) : import_picocolors14.default.bold(import_picocolors14.default.red(name));
|
|
13785
13896
|
}
|
|
13786
13897
|
if (localName === currentBranch) {
|
|
13787
|
-
return
|
|
13898
|
+
return import_picocolors14.default.bold(import_picocolors14.default.green(name));
|
|
13788
13899
|
}
|
|
13789
13900
|
if (isRemote) {
|
|
13790
|
-
return
|
|
13901
|
+
return import_picocolors14.default.blue(name);
|
|
13791
13902
|
}
|
|
13792
|
-
return
|
|
13903
|
+
return import_picocolors14.default.green(name);
|
|
13793
13904
|
}
|
|
13794
13905
|
function colorizeSubject(subject) {
|
|
13795
13906
|
const emojiMatch = subject.match(/^((?:\p{Emoji_Presentation}|\p{Emoji}\uFE0F)+\s*)/u);
|
|
13796
13907
|
if (emojiMatch) {
|
|
13797
13908
|
const emoji = emojiMatch[1];
|
|
13798
13909
|
const rest = subject.slice(emoji.length);
|
|
13799
|
-
return `${emoji}${
|
|
13910
|
+
return `${emoji}${import_picocolors14.default.white(rest)}`;
|
|
13800
13911
|
}
|
|
13801
13912
|
if (subject.startsWith("Merge ")) {
|
|
13802
|
-
return
|
|
13913
|
+
return import_picocolors14.default.dim(subject);
|
|
13803
13914
|
}
|
|
13804
|
-
return
|
|
13915
|
+
return import_picocolors14.default.white(subject);
|
|
13805
13916
|
}
|
|
13806
13917
|
|
|
13807
13918
|
// src/commands/save.ts
|
|
13808
13919
|
import { execFile as execFileCb4 } from "child_process";
|
|
13809
|
-
var
|
|
13920
|
+
var import_picocolors15 = __toESM(require_picocolors(), 1);
|
|
13810
13921
|
function gitRun(args) {
|
|
13811
13922
|
return new Promise((resolve5) => {
|
|
13812
13923
|
execFileCb4("git", args, (err, stdout2, stderr) => {
|
|
@@ -13880,8 +13991,8 @@ async function handleSave(message) {
|
|
|
13880
13991
|
info("No uncommitted changes to save.");
|
|
13881
13992
|
return;
|
|
13882
13993
|
}
|
|
13883
|
-
success(`Saved: ${
|
|
13884
|
-
info(`Use ${
|
|
13994
|
+
success(`Saved: ${import_picocolors15.default.dim(label)}`);
|
|
13995
|
+
info(`Use ${import_picocolors15.default.bold("contrib save --restore")} to bring them back.`, "");
|
|
13885
13996
|
}
|
|
13886
13997
|
async function handleRestore() {
|
|
13887
13998
|
await projectHeading("save --restore", "\uD83D\uDCBE");
|
|
@@ -13897,7 +14008,7 @@ async function handleRestore() {
|
|
|
13897
14008
|
warn("You may have conflicts. Resolve them and run `git stash drop` when done.");
|
|
13898
14009
|
process.exit(1);
|
|
13899
14010
|
}
|
|
13900
|
-
success(`Restored: ${
|
|
14011
|
+
success(`Restored: ${import_picocolors15.default.dim(stashes[0].message)}`);
|
|
13901
14012
|
return;
|
|
13902
14013
|
}
|
|
13903
14014
|
const choices = stashes.map((s2) => `${s2.index} ${s2.message}`);
|
|
@@ -13910,7 +14021,7 @@ async function handleRestore() {
|
|
|
13910
14021
|
process.exit(1);
|
|
13911
14022
|
}
|
|
13912
14023
|
const match = stashes.find((s2) => String(s2.index) === idx);
|
|
13913
|
-
success(`Restored: ${
|
|
14024
|
+
success(`Restored: ${import_picocolors15.default.dim(match?.message ?? "saved changes")}`);
|
|
13914
14025
|
}
|
|
13915
14026
|
async function handleList() {
|
|
13916
14027
|
await projectHeading("save --list", "\uD83D\uDCBE");
|
|
@@ -13921,13 +14032,13 @@ async function handleList() {
|
|
|
13921
14032
|
}
|
|
13922
14033
|
console.log();
|
|
13923
14034
|
for (const s2 of stashes) {
|
|
13924
|
-
const idx =
|
|
14035
|
+
const idx = import_picocolors15.default.dim(`[${s2.index}]`);
|
|
13925
14036
|
const msg = s2.message;
|
|
13926
14037
|
console.log(` ${idx} ${msg}`);
|
|
13927
14038
|
}
|
|
13928
14039
|
console.log();
|
|
13929
|
-
info(`Use ${
|
|
13930
|
-
info(`Use ${
|
|
14040
|
+
info(`Use ${import_picocolors15.default.bold("contrib save --restore")} to bring changes back.`, "");
|
|
14041
|
+
info(`Use ${import_picocolors15.default.bold("contrib save --drop")} to discard saved changes.`, "");
|
|
13931
14042
|
}
|
|
13932
14043
|
async function handleDrop() {
|
|
13933
14044
|
await projectHeading("save --drop", "\uD83D\uDCBE");
|
|
@@ -13945,7 +14056,7 @@ async function handleDrop() {
|
|
|
13945
14056
|
process.exit(1);
|
|
13946
14057
|
}
|
|
13947
14058
|
const match = stashes.find((s2) => String(s2.index) === idx);
|
|
13948
|
-
success(`Dropped: ${
|
|
14059
|
+
success(`Dropped: ${import_picocolors15.default.dim(match?.message ?? "saved changes")}`);
|
|
13949
14060
|
}
|
|
13950
14061
|
async function getStashList() {
|
|
13951
14062
|
const result = await gitRun(["stash", "list"]);
|
|
@@ -13962,7 +14073,7 @@ async function getStashList() {
|
|
|
13962
14073
|
}
|
|
13963
14074
|
|
|
13964
14075
|
// src/commands/setup.ts
|
|
13965
|
-
var
|
|
14076
|
+
var import_picocolors16 = __toESM(require_picocolors(), 1);
|
|
13966
14077
|
async function shouldContinueSetupWithExistingConfig(options) {
|
|
13967
14078
|
const { existingConfig, hasConfigFile, confirm, onInfo, onWarn, onSuccess, summary } = options;
|
|
13968
14079
|
if (existingConfig) {
|
|
@@ -14045,7 +14156,7 @@ var setup_default = defineCommand({
|
|
|
14045
14156
|
workflow = "github-flow";
|
|
14046
14157
|
else if (workflowChoice.startsWith("Git Flow"))
|
|
14047
14158
|
workflow = "git-flow";
|
|
14048
|
-
info(`Workflow: ${
|
|
14159
|
+
info(`Workflow: ${import_picocolors16.default.bold(WORKFLOW_DESCRIPTIONS[workflow])}`);
|
|
14049
14160
|
const conventionChoice = await selectPrompt("Which commit convention should this project use?", [
|
|
14050
14161
|
`${CONVENTION_DESCRIPTIONS["clean-commit"]} (recommended)`,
|
|
14051
14162
|
CONVENTION_DESCRIPTIONS.conventional,
|
|
@@ -14075,7 +14186,7 @@ var setup_default = defineCommand({
|
|
|
14075
14186
|
try {
|
|
14076
14187
|
await setOllamaCloudApiKey(apiKey);
|
|
14077
14188
|
success("Stored Ollama Cloud API key in the local secrets store.");
|
|
14078
|
-
info(`Secrets path: ${
|
|
14189
|
+
info(`Secrets path: ${import_picocolors16.default.bold(getSecretsStorePath())}`);
|
|
14079
14190
|
} catch (err) {
|
|
14080
14191
|
const message = err instanceof Error ? err.message : String(err);
|
|
14081
14192
|
error(`Failed to store Ollama Cloud API key: ${message}`);
|
|
@@ -14137,15 +14248,15 @@ var setup_default = defineCommand({
|
|
|
14137
14248
|
detectedRole = roleChoice;
|
|
14138
14249
|
detectionSource = "user selection";
|
|
14139
14250
|
} else {
|
|
14140
|
-
info(`Detected role: ${
|
|
14141
|
-
const confirmed = await confirmPrompt(`Role detected as ${
|
|
14251
|
+
info(`Detected role: ${import_picocolors16.default.bold(detectedRole)} (via ${detectionSource})`);
|
|
14252
|
+
const confirmed = await confirmPrompt(`Role detected as ${import_picocolors16.default.bold(detectedRole)}. Is this correct?`);
|
|
14142
14253
|
if (!confirmed) {
|
|
14143
14254
|
const roleChoice = await selectPrompt("Select your role:", ["maintainer", "contributor"]);
|
|
14144
14255
|
detectedRole = roleChoice;
|
|
14145
14256
|
}
|
|
14146
14257
|
}
|
|
14147
14258
|
const defaultConfig = getDefaultConfig();
|
|
14148
|
-
info(
|
|
14259
|
+
info(import_picocolors16.default.dim("Tip: press Enter to keep the default branch name shown in each prompt."));
|
|
14149
14260
|
const mainBranchDefault = defaultConfig.mainBranch;
|
|
14150
14261
|
const mainBranch = await inputPrompt(`Main branch name (default: ${mainBranchDefault} \u2014 press Enter to keep)`, mainBranchDefault);
|
|
14151
14262
|
let devBranch;
|
|
@@ -14171,7 +14282,7 @@ var setup_default = defineCommand({
|
|
|
14171
14282
|
error("Setup cannot continue without the upstream remote for contributors.");
|
|
14172
14283
|
process.exit(1);
|
|
14173
14284
|
}
|
|
14174
|
-
success(`Added remote ${
|
|
14285
|
+
success(`Added remote ${import_picocolors16.default.bold(upstreamRemote)} \u2192 ${upstreamUrl}`);
|
|
14175
14286
|
} else {
|
|
14176
14287
|
error("An upstream remote URL is required for contributors.");
|
|
14177
14288
|
info("Add it manually: git remote add upstream <url>", "");
|
|
@@ -14194,67 +14305,67 @@ var setup_default = defineCommand({
|
|
|
14194
14305
|
showTips
|
|
14195
14306
|
};
|
|
14196
14307
|
writeConfig(config);
|
|
14197
|
-
success(`Config written to ${
|
|
14308
|
+
success(`Config written to ${import_picocolors16.default.bold(getConfigLocationLabel())}`);
|
|
14198
14309
|
info("This setup is stored locally for this clone and does not modify tracked files.", "");
|
|
14199
14310
|
const syncRemote = config.role === "contributor" ? config.upstream : config.origin;
|
|
14200
|
-
info(`Fetching ${
|
|
14311
|
+
info(`Fetching ${import_picocolors16.default.bold(syncRemote)} to verify branch configuration...`, "");
|
|
14201
14312
|
await fetchRemote(syncRemote);
|
|
14202
14313
|
const mainRef = `${syncRemote}/${config.mainBranch}`;
|
|
14203
14314
|
if (!await refExists(mainRef)) {
|
|
14204
|
-
warn(`Main branch ref ${
|
|
14315
|
+
warn(`Main branch ref ${import_picocolors16.default.bold(mainRef)} not found on remote.`);
|
|
14205
14316
|
warn("Config was saved \u2014 verify the branch name and re-run setup if needed.");
|
|
14206
14317
|
}
|
|
14207
14318
|
if (config.devBranch) {
|
|
14208
14319
|
const devRef = `${syncRemote}/${config.devBranch}`;
|
|
14209
14320
|
if (!await refExists(devRef)) {
|
|
14210
|
-
warn(`Dev branch ref ${
|
|
14321
|
+
warn(`Dev branch ref ${import_picocolors16.default.bold(devRef)} not found on remote.`);
|
|
14211
14322
|
warn("Config was saved \u2014 verify the branch name and re-run setup if needed.");
|
|
14212
14323
|
}
|
|
14213
14324
|
}
|
|
14214
14325
|
console.log();
|
|
14215
14326
|
const resolvedAIConfig = resolveAIConfig(config);
|
|
14216
|
-
info(`Workflow: ${
|
|
14217
|
-
info(`Convention: ${
|
|
14218
|
-
info(`AI: ${
|
|
14327
|
+
info(`Workflow: ${import_picocolors16.default.bold(WORKFLOW_DESCRIPTIONS[config.workflow])}`);
|
|
14328
|
+
info(`Convention: ${import_picocolors16.default.bold(CONVENTION_DESCRIPTIONS[config.commitConvention])}`);
|
|
14329
|
+
info(`AI: ${import_picocolors16.default.bold(isAIEnabled(config) ? "enabled" : "disabled")}`);
|
|
14219
14330
|
if (isAIEnabled(config)) {
|
|
14220
|
-
info(`AI provider: ${
|
|
14331
|
+
info(`AI provider: ${import_picocolors16.default.bold(resolvedAIConfig.providerLabel)}`);
|
|
14221
14332
|
if (resolvedAIConfig.model) {
|
|
14222
|
-
info(`AI model: ${
|
|
14333
|
+
info(`AI model: ${import_picocolors16.default.bold(resolvedAIConfig.model)}`);
|
|
14223
14334
|
}
|
|
14224
14335
|
}
|
|
14225
|
-
info(`Guides: ${
|
|
14226
|
-
info(`Role: ${
|
|
14336
|
+
info(`Guides: ${import_picocolors16.default.bold(shouldShowTips(config) ? "shown" : "hidden")}`);
|
|
14337
|
+
info(`Role: ${import_picocolors16.default.bold(config.role)}`);
|
|
14227
14338
|
if (config.devBranch) {
|
|
14228
|
-
info(`Main: ${
|
|
14339
|
+
info(`Main: ${import_picocolors16.default.bold(config.mainBranch)} | Dev: ${import_picocolors16.default.bold(config.devBranch)}`);
|
|
14229
14340
|
} else {
|
|
14230
|
-
info(`Main: ${
|
|
14341
|
+
info(`Main: ${import_picocolors16.default.bold(config.mainBranch)}`);
|
|
14231
14342
|
}
|
|
14232
|
-
info(`Origin: ${
|
|
14343
|
+
info(`Origin: ${import_picocolors16.default.bold(config.origin)}${config.role === "contributor" ? ` | Upstream: ${import_picocolors16.default.bold(config.upstream)}` : ""}`);
|
|
14233
14344
|
}
|
|
14234
14345
|
});
|
|
14235
14346
|
function logConfigSummary(config) {
|
|
14236
14347
|
const aiConfig = resolveAIConfig(config);
|
|
14237
|
-
info(`Workflow: ${
|
|
14238
|
-
info(`Convention: ${
|
|
14239
|
-
info(`AI: ${
|
|
14348
|
+
info(`Workflow: ${import_picocolors16.default.bold(WORKFLOW_DESCRIPTIONS[config.workflow])}`);
|
|
14349
|
+
info(`Convention: ${import_picocolors16.default.bold(CONVENTION_DESCRIPTIONS[config.commitConvention])}`);
|
|
14350
|
+
info(`AI: ${import_picocolors16.default.bold(isAIEnabled(config) ? "enabled" : "disabled")}`);
|
|
14240
14351
|
if (isAIEnabled(config)) {
|
|
14241
|
-
info(`AI provider: ${
|
|
14352
|
+
info(`AI provider: ${import_picocolors16.default.bold(aiConfig.providerLabel)}`);
|
|
14242
14353
|
if (aiConfig.model) {
|
|
14243
|
-
info(`AI model: ${
|
|
14354
|
+
info(`AI model: ${import_picocolors16.default.bold(aiConfig.model)}`);
|
|
14244
14355
|
}
|
|
14245
14356
|
}
|
|
14246
|
-
info(`Guides: ${
|
|
14247
|
-
info(`Role: ${
|
|
14357
|
+
info(`Guides: ${import_picocolors16.default.bold(shouldShowTips(config) ? "shown" : "hidden")}`);
|
|
14358
|
+
info(`Role: ${import_picocolors16.default.bold(config.role)}`);
|
|
14248
14359
|
if (config.devBranch) {
|
|
14249
|
-
info(`Main: ${
|
|
14360
|
+
info(`Main: ${import_picocolors16.default.bold(config.mainBranch)} | Dev: ${import_picocolors16.default.bold(config.devBranch)}`);
|
|
14250
14361
|
} else {
|
|
14251
|
-
info(`Main: ${
|
|
14362
|
+
info(`Main: ${import_picocolors16.default.bold(config.mainBranch)}`);
|
|
14252
14363
|
}
|
|
14253
|
-
info(`Origin: ${
|
|
14364
|
+
info(`Origin: ${import_picocolors16.default.bold(config.origin)}${config.role === "contributor" ? ` | Upstream: ${import_picocolors16.default.bold(config.upstream)}` : ""}`);
|
|
14254
14365
|
}
|
|
14255
14366
|
|
|
14256
14367
|
// src/commands/start.ts
|
|
14257
|
-
var
|
|
14368
|
+
var import_picocolors17 = __toESM(require_picocolors(), 1);
|
|
14258
14369
|
var start_default = defineCommand({
|
|
14259
14370
|
meta: {
|
|
14260
14371
|
name: "start",
|
|
@@ -14306,16 +14417,16 @@ var start_default = defineCommand({
|
|
|
14306
14417
|
warn("Start cancelled.");
|
|
14307
14418
|
process.exit(0);
|
|
14308
14419
|
}
|
|
14309
|
-
info(`Creating branch: ${
|
|
14420
|
+
info(`Creating branch: ${import_picocolors17.default.bold(branchName)}`);
|
|
14310
14421
|
await fetchRemote(syncSource.remote);
|
|
14311
14422
|
if (!await refExists(syncSource.ref)) {
|
|
14312
|
-
warn(`Remote ref ${
|
|
14423
|
+
warn(`Remote ref ${import_picocolors17.default.bold(syncSource.ref)} not found. Creating branch from local ${import_picocolors17.default.bold(baseBranch)}.`);
|
|
14313
14424
|
}
|
|
14314
14425
|
const currentBranch = await getCurrentBranch();
|
|
14315
14426
|
if (currentBranch === baseBranch && await refExists(syncSource.ref)) {
|
|
14316
14427
|
const ahead = await countCommitsAhead(baseBranch, syncSource.ref);
|
|
14317
14428
|
if (ahead > 0) {
|
|
14318
|
-
warn(`You are on ${
|
|
14429
|
+
warn(`You are on ${import_picocolors17.default.bold(baseBranch)} with ${import_picocolors17.default.bold(String(ahead))} local commit${ahead > 1 ? "s" : ""} not in ${import_picocolors17.default.bold(syncSource.ref)}.`);
|
|
14319
14430
|
info(" Syncing will discard those commits. Consider backing them up first (e.g. create a branch).");
|
|
14320
14431
|
const proceed = await confirmPrompt("Discard local commits and sync to remote?");
|
|
14321
14432
|
if (!proceed) {
|
|
@@ -14332,10 +14443,10 @@ var start_default = defineCommand({
|
|
|
14332
14443
|
error(`Failed to create branch: ${result2.stderr}`);
|
|
14333
14444
|
process.exit(1);
|
|
14334
14445
|
}
|
|
14335
|
-
success(`Created ${
|
|
14446
|
+
success(`Created ${import_picocolors17.default.bold(branchName)} from ${import_picocolors17.default.bold(syncSource.ref)}`);
|
|
14336
14447
|
return;
|
|
14337
14448
|
}
|
|
14338
|
-
error(`Failed to update ${
|
|
14449
|
+
error(`Failed to update ${import_picocolors17.default.bold(baseBranch)}: ${updateResult.stderr}`);
|
|
14339
14450
|
info("Make sure your base branch exists locally or the remote ref is available.", "");
|
|
14340
14451
|
process.exit(1);
|
|
14341
14452
|
}
|
|
@@ -14344,12 +14455,12 @@ var start_default = defineCommand({
|
|
|
14344
14455
|
error(`Failed to create branch: ${result.stderr}`);
|
|
14345
14456
|
process.exit(1);
|
|
14346
14457
|
}
|
|
14347
|
-
success(`Created ${
|
|
14458
|
+
success(`Created ${import_picocolors17.default.bold(branchName)} from latest ${import_picocolors17.default.bold(baseBranch)}`);
|
|
14348
14459
|
}
|
|
14349
14460
|
});
|
|
14350
14461
|
|
|
14351
14462
|
// src/commands/status.ts
|
|
14352
|
-
var
|
|
14463
|
+
var import_picocolors18 = __toESM(require_picocolors(), 1);
|
|
14353
14464
|
var status_default = defineCommand({
|
|
14354
14465
|
meta: {
|
|
14355
14466
|
name: "status",
|
|
@@ -14366,8 +14477,8 @@ var status_default = defineCommand({
|
|
|
14366
14477
|
process.exit(1);
|
|
14367
14478
|
}
|
|
14368
14479
|
await projectHeading("status", "\uD83D\uDCCA");
|
|
14369
|
-
console.log(` ${
|
|
14370
|
-
console.log(` ${
|
|
14480
|
+
console.log(` ${import_picocolors18.default.dim("Workflow:")} ${import_picocolors18.default.bold(WORKFLOW_DESCRIPTIONS[config.workflow])}`);
|
|
14481
|
+
console.log(` ${import_picocolors18.default.dim("Role:")} ${import_picocolors18.default.bold(config.role)}`);
|
|
14371
14482
|
console.log();
|
|
14372
14483
|
await fetchAll();
|
|
14373
14484
|
const currentBranch = await getCurrentBranch();
|
|
@@ -14376,7 +14487,7 @@ var status_default = defineCommand({
|
|
|
14376
14487
|
const isContributor = config.role === "contributor";
|
|
14377
14488
|
const [dirty, fileStatus] = await Promise.all([hasUncommittedChanges(), getFileStatus()]);
|
|
14378
14489
|
if (dirty) {
|
|
14379
|
-
console.log(` ${
|
|
14490
|
+
console.log(` ${import_picocolors18.default.yellow("\u26A0")} ${import_picocolors18.default.yellow("Uncommitted changes in working tree")}`);
|
|
14380
14491
|
console.log();
|
|
14381
14492
|
}
|
|
14382
14493
|
const mainRemote = `${origin}/${mainBranch}`;
|
|
@@ -14395,16 +14506,16 @@ var status_default = defineCommand({
|
|
|
14395
14506
|
if (isFeatureBranch) {
|
|
14396
14507
|
const branchDiv = await getDivergence(currentBranch, baseBranch);
|
|
14397
14508
|
const branchLine = formatStatus(currentBranch, baseBranch, branchDiv.ahead, branchDiv.behind);
|
|
14398
|
-
console.log(branchLine +
|
|
14509
|
+
console.log(branchLine + import_picocolors18.default.dim(` (current ${import_picocolors18.default.green("*")})`));
|
|
14399
14510
|
branchStatus = await detectBranchStatus(currentBranch, baseBranch);
|
|
14400
14511
|
if (branchStatus.merged) {
|
|
14401
|
-
console.log(` ${
|
|
14512
|
+
console.log(` ${import_picocolors18.default.green("\u2713")} ${import_picocolors18.default.green("Branch merged")} \u2014 ${import_picocolors18.default.dim(branchStatus.mergedReason ?? "all commits reachable from base")}`);
|
|
14402
14513
|
}
|
|
14403
14514
|
if (branchStatus.stale) {
|
|
14404
|
-
console.log(` ${
|
|
14515
|
+
console.log(` ${import_picocolors18.default.yellow("\u23F3")} ${import_picocolors18.default.yellow("Branch is stale")} \u2014 ${import_picocolors18.default.dim(`last commit ${branchStatus.staleDaysAgo} days ago`)}`);
|
|
14405
14516
|
}
|
|
14406
14517
|
} else if (currentBranch) {
|
|
14407
|
-
console.log(
|
|
14518
|
+
console.log(import_picocolors18.default.dim(` (on ${import_picocolors18.default.bold(currentBranch)} branch)`));
|
|
14408
14519
|
}
|
|
14409
14520
|
let branchesAligned = true;
|
|
14410
14521
|
{
|
|
@@ -14441,20 +14552,20 @@ var status_default = defineCommand({
|
|
|
14441
14552
|
}
|
|
14442
14553
|
branchesAligned = groups.size === 1;
|
|
14443
14554
|
console.log();
|
|
14444
|
-
console.log(` ${
|
|
14555
|
+
console.log(` ${import_picocolors18.default.bold("\uD83D\uDD17 Branch Alignment")}`);
|
|
14445
14556
|
for (const [hash, names] of groups) {
|
|
14446
14557
|
const short = hash.slice(0, 7);
|
|
14447
|
-
const nameStr = names.map((n2) =>
|
|
14448
|
-
console.log(` ${
|
|
14558
|
+
const nameStr = names.map((n2) => import_picocolors18.default.bold(n2)).join(import_picocolors18.default.dim(" \xB7 "));
|
|
14559
|
+
console.log(` ${import_picocolors18.default.yellow(short)} ${import_picocolors18.default.dim("\u2500\u2500")} ${nameStr}`);
|
|
14449
14560
|
const subject = await getCommitSubject(hash);
|
|
14450
14561
|
if (subject) {
|
|
14451
|
-
console.log(` ${
|
|
14562
|
+
console.log(` ${import_picocolors18.default.dim(subject)}`);
|
|
14452
14563
|
}
|
|
14453
14564
|
}
|
|
14454
14565
|
if (branchesAligned) {
|
|
14455
|
-
console.log(` ${
|
|
14566
|
+
console.log(` ${import_picocolors18.default.green("\u2713")} ${import_picocolors18.default.green("All branches aligned")} ${import_picocolors18.default.dim("\u2014 ready to start")}`);
|
|
14456
14567
|
} else {
|
|
14457
|
-
console.log(` ${
|
|
14568
|
+
console.log(` ${import_picocolors18.default.yellow("\u26A0")} ${import_picocolors18.default.yellow("Branches are not fully aligned")}`);
|
|
14458
14569
|
}
|
|
14459
14570
|
}
|
|
14460
14571
|
}
|
|
@@ -14462,41 +14573,41 @@ var status_default = defineCommand({
|
|
|
14462
14573
|
if (hasFiles) {
|
|
14463
14574
|
console.log();
|
|
14464
14575
|
if (fileStatus.staged.length > 0) {
|
|
14465
|
-
console.log(` ${
|
|
14576
|
+
console.log(` ${import_picocolors18.default.green("Staged for commit:")}`);
|
|
14466
14577
|
for (const { file, status } of fileStatus.staged) {
|
|
14467
|
-
console.log(` ${
|
|
14578
|
+
console.log(` ${import_picocolors18.default.green("+")} ${import_picocolors18.default.dim(`${status}:`)} ${file}`);
|
|
14468
14579
|
}
|
|
14469
14580
|
}
|
|
14470
14581
|
if (fileStatus.modified.length > 0) {
|
|
14471
|
-
console.log(` ${
|
|
14582
|
+
console.log(` ${import_picocolors18.default.yellow("Unstaged changes:")}`);
|
|
14472
14583
|
for (const { file, status } of fileStatus.modified) {
|
|
14473
|
-
console.log(` ${
|
|
14584
|
+
console.log(` ${import_picocolors18.default.yellow("~")} ${import_picocolors18.default.dim(`${status}:`)} ${file}`);
|
|
14474
14585
|
}
|
|
14475
14586
|
}
|
|
14476
14587
|
if (fileStatus.untracked.length > 0) {
|
|
14477
|
-
console.log(` ${
|
|
14588
|
+
console.log(` ${import_picocolors18.default.red("Untracked files:")}`);
|
|
14478
14589
|
for (const file of fileStatus.untracked) {
|
|
14479
|
-
console.log(` ${
|
|
14590
|
+
console.log(` ${import_picocolors18.default.red("?")} ${file}`);
|
|
14480
14591
|
}
|
|
14481
14592
|
}
|
|
14482
14593
|
} else if (!dirty) {
|
|
14483
|
-
console.log(` ${
|
|
14594
|
+
console.log(` ${import_picocolors18.default.green("\u2713")} ${import_picocolors18.default.dim("Working tree clean")}`);
|
|
14484
14595
|
}
|
|
14485
14596
|
console.log();
|
|
14486
14597
|
}
|
|
14487
14598
|
});
|
|
14488
14599
|
function formatStatus(branch, base, ahead, behind) {
|
|
14489
|
-
const label =
|
|
14600
|
+
const label = import_picocolors18.default.bold(branch.padEnd(20));
|
|
14490
14601
|
if (ahead === 0 && behind === 0) {
|
|
14491
|
-
return ` ${
|
|
14602
|
+
return ` ${import_picocolors18.default.green("\u2713")} ${label} ${import_picocolors18.default.dim(`in sync with ${base}`)}`;
|
|
14492
14603
|
}
|
|
14493
14604
|
if (ahead > 0 && behind === 0) {
|
|
14494
|
-
return ` ${
|
|
14605
|
+
return ` ${import_picocolors18.default.yellow("\u2191")} ${label} ${import_picocolors18.default.yellow(`${ahead} commit${ahead !== 1 ? "s" : ""} ahead of ${base}`)}`;
|
|
14495
14606
|
}
|
|
14496
14607
|
if (behind > 0 && ahead === 0) {
|
|
14497
|
-
return ` ${
|
|
14608
|
+
return ` ${import_picocolors18.default.red("\u2193")} ${label} ${import_picocolors18.default.red(`${behind} commit${behind !== 1 ? "s" : ""} behind ${base}`)}`;
|
|
14498
14609
|
}
|
|
14499
|
-
return ` ${
|
|
14610
|
+
return ` ${import_picocolors18.default.red("\u26A1")} ${label} ${import_picocolors18.default.yellow(`${ahead} ahead`)}${import_picocolors18.default.dim(", ")}${import_picocolors18.default.red(`${behind} behind`)} ${import_picocolors18.default.dim(base)}`;
|
|
14500
14611
|
}
|
|
14501
14612
|
var STALE_THRESHOLD_DAYS = 14;
|
|
14502
14613
|
async function detectBranchStatus(branch, baseBranch) {
|
|
@@ -14547,15 +14658,15 @@ async function detectBranchStatus(branch, baseBranch) {
|
|
|
14547
14658
|
}
|
|
14548
14659
|
|
|
14549
14660
|
// src/commands/submit.ts
|
|
14550
|
-
var
|
|
14661
|
+
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
14551
14662
|
async function performSquashMerge(origin, baseBranch, featureBranch, options) {
|
|
14552
|
-
info(`Checking out ${
|
|
14663
|
+
info(`Checking out ${import_picocolors19.default.bold(baseBranch)}...`);
|
|
14553
14664
|
const coResult = await checkoutBranch(baseBranch);
|
|
14554
14665
|
if (coResult.exitCode !== 0) {
|
|
14555
14666
|
error(`Failed to checkout ${baseBranch}: ${coResult.stderr}`);
|
|
14556
14667
|
process.exit(1);
|
|
14557
14668
|
}
|
|
14558
|
-
info(`Squash merging ${
|
|
14669
|
+
info(`Squash merging ${import_picocolors19.default.bold(featureBranch)} into ${import_picocolors19.default.bold(baseBranch)}...`);
|
|
14559
14670
|
const mergeResult = await mergeSquash(featureBranch);
|
|
14560
14671
|
if (mergeResult.exitCode !== 0) {
|
|
14561
14672
|
error(`Squash merge failed: ${mergeResult.stderr}`);
|
|
@@ -14575,7 +14686,7 @@ async function performSquashMerge(origin, baseBranch, featureBranch, options) {
|
|
|
14575
14686
|
message = aiMsg;
|
|
14576
14687
|
spinner.success("AI commit message generated.");
|
|
14577
14688
|
console.log(`
|
|
14578
|
-
${
|
|
14689
|
+
${import_picocolors19.default.dim("AI suggestion:")} ${import_picocolors19.default.bold(import_picocolors19.default.cyan(message))}`);
|
|
14579
14690
|
break;
|
|
14580
14691
|
}
|
|
14581
14692
|
spinner.fail("AI did not return a commit message.");
|
|
@@ -14615,7 +14726,7 @@ async function performSquashMerge(origin, baseBranch, featureBranch, options) {
|
|
|
14615
14726
|
message = regen;
|
|
14616
14727
|
spinner.success("Commit message regenerated.");
|
|
14617
14728
|
console.log(`
|
|
14618
|
-
${
|
|
14729
|
+
${import_picocolors19.default.dim("AI suggestion:")} ${import_picocolors19.default.bold(import_picocolors19.default.cyan(regen))}`);
|
|
14619
14730
|
} else {
|
|
14620
14731
|
spinner.fail("Regeneration failed.");
|
|
14621
14732
|
}
|
|
@@ -14631,13 +14742,13 @@ async function performSquashMerge(origin, baseBranch, featureBranch, options) {
|
|
|
14631
14742
|
error(`Commit failed: ${commitResult.stderr}`);
|
|
14632
14743
|
process.exit(1);
|
|
14633
14744
|
}
|
|
14634
|
-
info(`Pushing ${
|
|
14745
|
+
info(`Pushing ${import_picocolors19.default.bold(baseBranch)} to ${origin}...`);
|
|
14635
14746
|
const pushResult = await pushBranch(origin, baseBranch);
|
|
14636
14747
|
if (pushResult.exitCode !== 0) {
|
|
14637
14748
|
error(`Failed to push ${baseBranch}: ${pushResult.stderr}`);
|
|
14638
14749
|
process.exit(1);
|
|
14639
14750
|
}
|
|
14640
|
-
info(`Deleting local branch ${
|
|
14751
|
+
info(`Deleting local branch ${import_picocolors19.default.bold(featureBranch)}...`);
|
|
14641
14752
|
const delLocal = await forceDeleteBranch(featureBranch);
|
|
14642
14753
|
if (delLocal.exitCode !== 0) {
|
|
14643
14754
|
warn(`Could not delete local branch: ${delLocal.stderr.trim()}`);
|
|
@@ -14645,14 +14756,14 @@ async function performSquashMerge(origin, baseBranch, featureBranch, options) {
|
|
|
14645
14756
|
const remoteBranchRef = `${origin}/${featureBranch}`;
|
|
14646
14757
|
const remoteExists = await branchExists(remoteBranchRef);
|
|
14647
14758
|
if (remoteExists) {
|
|
14648
|
-
info(`Deleting remote branch ${
|
|
14759
|
+
info(`Deleting remote branch ${import_picocolors19.default.bold(featureBranch)}...`);
|
|
14649
14760
|
const delRemote = await deleteRemoteBranch(origin, featureBranch);
|
|
14650
14761
|
if (delRemote.exitCode !== 0) {
|
|
14651
14762
|
warn(`Could not delete remote branch: ${delRemote.stderr.trim()}`);
|
|
14652
14763
|
}
|
|
14653
14764
|
}
|
|
14654
|
-
success(`Squash merged ${
|
|
14655
|
-
info(`Run ${
|
|
14765
|
+
success(`Squash merged ${import_picocolors19.default.bold(featureBranch)} into ${import_picocolors19.default.bold(baseBranch)} and pushed.`);
|
|
14766
|
+
info(`Run ${import_picocolors19.default.bold("contrib start")} to begin a new feature.`, "");
|
|
14656
14767
|
}
|
|
14657
14768
|
var submit_default = defineCommand({
|
|
14658
14769
|
meta: {
|
|
@@ -14709,7 +14820,7 @@ var submit_default = defineCommand({
|
|
|
14709
14820
|
}
|
|
14710
14821
|
if (protectedBranches.includes(currentBranch)) {
|
|
14711
14822
|
await projectHeading("submit", "\uD83D\uDE80");
|
|
14712
|
-
warn(`You're on ${
|
|
14823
|
+
warn(`You're on ${import_picocolors19.default.bold(currentBranch)}, which is a protected branch. PRs should come from feature branches.`);
|
|
14713
14824
|
await fetchAll();
|
|
14714
14825
|
const remoteRef = `${origin}/${currentBranch}`;
|
|
14715
14826
|
const localWork = await hasLocalWork(origin, currentBranch);
|
|
@@ -14718,11 +14829,11 @@ var submit_default = defineCommand({
|
|
|
14718
14829
|
const hasAnything = hasCommits || dirty;
|
|
14719
14830
|
if (!hasAnything) {
|
|
14720
14831
|
error("No local changes or commits to move. Switch to a feature branch first.");
|
|
14721
|
-
info(` Run ${
|
|
14832
|
+
info(` Run ${import_picocolors19.default.bold("contrib start")} to create a new feature branch.`, "");
|
|
14722
14833
|
process.exit(1);
|
|
14723
14834
|
}
|
|
14724
14835
|
if (hasCommits) {
|
|
14725
|
-
info(`Found ${
|
|
14836
|
+
info(`Found ${import_picocolors19.default.bold(String(localWork.unpushedCommits))} unpushed commit${localWork.unpushedCommits !== 1 ? "s" : ""} on ${import_picocolors19.default.bold(currentBranch)}.`);
|
|
14726
14837
|
}
|
|
14727
14838
|
if (dirty) {
|
|
14728
14839
|
info("You also have uncommitted changes in the working tree.");
|
|
@@ -14752,12 +14863,12 @@ var submit_default = defineCommand({
|
|
|
14752
14863
|
error(`Failed to create branch: ${branchResult.stderr}`);
|
|
14753
14864
|
process.exit(1);
|
|
14754
14865
|
}
|
|
14755
|
-
success(`Created ${
|
|
14866
|
+
success(`Created ${import_picocolors19.default.bold(newBranchName)} with your changes.`);
|
|
14756
14867
|
await updateLocalBranch(currentBranch, remoteRef);
|
|
14757
|
-
info(`Reset ${
|
|
14868
|
+
info(`Reset ${import_picocolors19.default.bold(currentBranch)} back to ${import_picocolors19.default.bold(remoteRef)} \u2014 no damage done.`, "");
|
|
14758
14869
|
console.log();
|
|
14759
|
-
success(`You're now on ${
|
|
14760
|
-
info(`Run ${
|
|
14870
|
+
success(`You're now on ${import_picocolors19.default.bold(newBranchName)} with all your work intact.`);
|
|
14871
|
+
info(`Run ${import_picocolors19.default.bold("contrib submit")} again to push and create your PR.`, "");
|
|
14761
14872
|
return;
|
|
14762
14873
|
}
|
|
14763
14874
|
await projectHeading("submit", "\uD83D\uDE80");
|
|
@@ -14766,7 +14877,7 @@ var submit_default = defineCommand({
|
|
|
14766
14877
|
if (ghInstalled && ghAuthed) {
|
|
14767
14878
|
const mergedPR = await getMergedPRForBranch(currentBranch);
|
|
14768
14879
|
if (mergedPR) {
|
|
14769
|
-
warn(`PR #${mergedPR.number} (${
|
|
14880
|
+
warn(`PR #${mergedPR.number} (${import_picocolors19.default.bold(mergedPR.title)}) was already merged.`);
|
|
14770
14881
|
const localWork = await hasLocalWork(origin, currentBranch);
|
|
14771
14882
|
const hasWork = localWork.uncommitted || localWork.unpushedCommits > 0;
|
|
14772
14883
|
if (hasWork) {
|
|
@@ -14774,7 +14885,7 @@ var submit_default = defineCommand({
|
|
|
14774
14885
|
warn("You have uncommitted changes in your working tree.");
|
|
14775
14886
|
}
|
|
14776
14887
|
if (localWork.unpushedCommits > 0) {
|
|
14777
|
-
warn(`You have ${
|
|
14888
|
+
warn(`You have ${import_picocolors19.default.bold(String(localWork.unpushedCommits))} local commit${localWork.unpushedCommits !== 1 ? "s" : ""} not in the merged PR.`);
|
|
14778
14889
|
}
|
|
14779
14890
|
const SAVE_NEW_BRANCH = "Save changes to a new branch";
|
|
14780
14891
|
const DISCARD = "Discard all changes and clean up";
|
|
@@ -14801,10 +14912,10 @@ var submit_default = defineCommand({
|
|
|
14801
14912
|
error(`Failed to rename branch: ${renameResult.stderr}`);
|
|
14802
14913
|
process.exit(1);
|
|
14803
14914
|
}
|
|
14804
|
-
success(`Renamed ${
|
|
14915
|
+
success(`Renamed ${import_picocolors19.default.bold(currentBranch)} \u2192 ${import_picocolors19.default.bold(newBranchName)}`);
|
|
14805
14916
|
await unsetUpstream();
|
|
14806
14917
|
const syncSource2 = getSyncSource(config);
|
|
14807
|
-
info(`Syncing ${
|
|
14918
|
+
info(`Syncing ${import_picocolors19.default.bold(newBranchName)} with latest ${import_picocolors19.default.bold(baseBranch)}...`);
|
|
14808
14919
|
await fetchRemote(syncSource2.remote);
|
|
14809
14920
|
let rebaseResult;
|
|
14810
14921
|
if (staleUpstreamHash) {
|
|
@@ -14815,17 +14926,17 @@ var submit_default = defineCommand({
|
|
|
14815
14926
|
}
|
|
14816
14927
|
if (rebaseResult.exitCode !== 0) {
|
|
14817
14928
|
warn("Rebase encountered conflicts. Resolve them manually, then run:");
|
|
14818
|
-
info(` ${
|
|
14929
|
+
info(` ${import_picocolors19.default.bold("git rebase --continue")}`, "");
|
|
14819
14930
|
} else {
|
|
14820
|
-
success(`Rebased ${
|
|
14931
|
+
success(`Rebased ${import_picocolors19.default.bold(newBranchName)} onto ${import_picocolors19.default.bold(syncSource2.ref)}.`);
|
|
14821
14932
|
}
|
|
14822
|
-
info(`All your changes are preserved. Run ${
|
|
14933
|
+
info(`All your changes are preserved. Run ${import_picocolors19.default.bold("contrib submit")} when ready to create a new PR.`, "");
|
|
14823
14934
|
return;
|
|
14824
14935
|
}
|
|
14825
14936
|
warn("Discarding local changes...");
|
|
14826
14937
|
}
|
|
14827
14938
|
const syncSource = getSyncSource(config);
|
|
14828
|
-
info(`Switching to ${
|
|
14939
|
+
info(`Switching to ${import_picocolors19.default.bold(baseBranch)} and syncing...`);
|
|
14829
14940
|
await fetchRemote(syncSource.remote);
|
|
14830
14941
|
await resetHard("HEAD");
|
|
14831
14942
|
const coResult = await checkoutBranch(baseBranch);
|
|
@@ -14834,23 +14945,23 @@ var submit_default = defineCommand({
|
|
|
14834
14945
|
process.exit(1);
|
|
14835
14946
|
}
|
|
14836
14947
|
await updateLocalBranch(baseBranch, syncSource.ref);
|
|
14837
|
-
success(`Synced ${
|
|
14838
|
-
info(`Deleting stale branch ${
|
|
14948
|
+
success(`Synced ${import_picocolors19.default.bold(baseBranch)} with ${import_picocolors19.default.bold(syncSource.ref)}.`);
|
|
14949
|
+
info(`Deleting stale branch ${import_picocolors19.default.bold(currentBranch)}...`);
|
|
14839
14950
|
const delResult = await forceDeleteBranch(currentBranch);
|
|
14840
14951
|
if (delResult.exitCode === 0) {
|
|
14841
|
-
success(`Deleted ${
|
|
14952
|
+
success(`Deleted ${import_picocolors19.default.bold(currentBranch)}.`);
|
|
14842
14953
|
} else {
|
|
14843
14954
|
warn(`Could not delete branch: ${delResult.stderr.trim()}`);
|
|
14844
14955
|
}
|
|
14845
14956
|
console.log();
|
|
14846
|
-
info(`You're now on ${
|
|
14957
|
+
info(`You're now on ${import_picocolors19.default.bold(baseBranch)}. Run ${import_picocolors19.default.bold("contrib start")} to begin a new feature.`);
|
|
14847
14958
|
return;
|
|
14848
14959
|
}
|
|
14849
14960
|
}
|
|
14850
14961
|
if (ghInstalled && ghAuthed) {
|
|
14851
14962
|
const existingPR = await getPRForBranch(currentBranch);
|
|
14852
14963
|
if (existingPR) {
|
|
14853
|
-
info(`Pushing ${
|
|
14964
|
+
info(`Pushing ${import_picocolors19.default.bold(currentBranch)} to ${origin}...`);
|
|
14854
14965
|
const pushResult2 = await pushSetUpstream(origin, currentBranch);
|
|
14855
14966
|
if (pushResult2.exitCode !== 0) {
|
|
14856
14967
|
error(`Failed to push: ${pushResult2.stderr}`);
|
|
@@ -14861,8 +14972,8 @@ var submit_default = defineCommand({
|
|
|
14861
14972
|
}
|
|
14862
14973
|
process.exit(1);
|
|
14863
14974
|
}
|
|
14864
|
-
success(`Pushed changes to existing PR #${existingPR.number}: ${
|
|
14865
|
-
console.log(` ${
|
|
14975
|
+
success(`Pushed changes to existing PR #${existingPR.number}: ${import_picocolors19.default.bold(existingPR.title)}`);
|
|
14976
|
+
console.log(` ${import_picocolors19.default.cyan(existingPR.url)}`);
|
|
14866
14977
|
return;
|
|
14867
14978
|
}
|
|
14868
14979
|
}
|
|
@@ -14884,10 +14995,10 @@ var submit_default = defineCommand({
|
|
|
14884
14995
|
prBody = result.body;
|
|
14885
14996
|
spinner.success("PR description generated.");
|
|
14886
14997
|
console.log(`
|
|
14887
|
-
${
|
|
14998
|
+
${import_picocolors19.default.dim("AI title:")} ${import_picocolors19.default.bold(import_picocolors19.default.cyan(prTitle))}`);
|
|
14888
14999
|
console.log(`
|
|
14889
|
-
${
|
|
14890
|
-
console.log(
|
|
15000
|
+
${import_picocolors19.default.dim("AI body preview:")}`);
|
|
15001
|
+
console.log(import_picocolors19.default.dim(prBody.slice(0, 300) + (prBody.length > 300 ? "..." : "")));
|
|
14891
15002
|
} else {
|
|
14892
15003
|
spinner.fail("AI did not return a PR description.");
|
|
14893
15004
|
}
|
|
@@ -14998,7 +15109,7 @@ ${import_picocolors18.default.dim("AI body preview:")}`);
|
|
|
14998
15109
|
warn("Submit cancelled.");
|
|
14999
15110
|
return;
|
|
15000
15111
|
}
|
|
15001
|
-
info(`Pushing ${
|
|
15112
|
+
info(`Pushing ${import_picocolors19.default.bold(currentBranch)} to ${origin}...`);
|
|
15002
15113
|
const pushResult = await pushSetUpstream(origin, currentBranch);
|
|
15003
15114
|
if (pushResult.exitCode !== 0) {
|
|
15004
15115
|
error(`Failed to push: ${pushResult.stderr}`);
|
|
@@ -15017,7 +15128,7 @@ ${import_picocolors18.default.dim("AI body preview:")}`);
|
|
|
15017
15128
|
const prUrl = `https://github.com/${repoInfo.owner}/${repoInfo.repo}/compare/${baseBranch}...${currentBranch}?expand=1`;
|
|
15018
15129
|
console.log();
|
|
15019
15130
|
info("Create your PR manually:", "");
|
|
15020
|
-
console.log(` ${
|
|
15131
|
+
console.log(` ${import_picocolors19.default.cyan(prUrl)}`);
|
|
15021
15132
|
} else {
|
|
15022
15133
|
info("gh CLI not available. Create your PR manually on GitHub.", "");
|
|
15023
15134
|
}
|
|
@@ -15051,7 +15162,7 @@ ${import_picocolors18.default.dim("AI body preview:")}`);
|
|
|
15051
15162
|
});
|
|
15052
15163
|
|
|
15053
15164
|
// src/commands/switch.ts
|
|
15054
|
-
var
|
|
15165
|
+
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
15055
15166
|
var switch_default = defineCommand({
|
|
15056
15167
|
meta: {
|
|
15057
15168
|
name: "switch",
|
|
@@ -15083,11 +15194,11 @@ var switch_default = defineCommand({
|
|
|
15083
15194
|
const choices = localBranches.filter((b2) => b2.name !== currentBranch).map((b2) => {
|
|
15084
15195
|
const labels = [];
|
|
15085
15196
|
if (protectedBranches.includes(b2.name))
|
|
15086
|
-
labels.push(
|
|
15197
|
+
labels.push(import_picocolors20.default.red("protected"));
|
|
15087
15198
|
if (b2.upstream)
|
|
15088
|
-
labels.push(
|
|
15199
|
+
labels.push(import_picocolors20.default.dim(`\u2192 ${b2.upstream}`));
|
|
15089
15200
|
if (b2.gone)
|
|
15090
|
-
labels.push(
|
|
15201
|
+
labels.push(import_picocolors20.default.red("remote gone"));
|
|
15091
15202
|
const suffix = labels.length > 0 ? ` ${labels.join(" \xB7 ")}` : "";
|
|
15092
15203
|
return `${b2.name}${suffix}`;
|
|
15093
15204
|
});
|
|
@@ -15099,7 +15210,7 @@ var switch_default = defineCommand({
|
|
|
15099
15210
|
targetBranch = selected.split(/\s{2,}/)[0].trim();
|
|
15100
15211
|
}
|
|
15101
15212
|
if (targetBranch === currentBranch) {
|
|
15102
|
-
info(`Already on ${
|
|
15213
|
+
info(`Already on ${import_picocolors20.default.bold(targetBranch)}.`);
|
|
15103
15214
|
return;
|
|
15104
15215
|
}
|
|
15105
15216
|
if (await hasUncommittedChanges()) {
|
|
@@ -15118,7 +15229,7 @@ var switch_default = defineCommand({
|
|
|
15118
15229
|
const stashMsg = `contrib-save: auto-save from ${currentBranch}`;
|
|
15119
15230
|
try {
|
|
15120
15231
|
await exec("git", ["stash", "push", "-m", stashMsg]);
|
|
15121
|
-
info(`Saved changes: ${
|
|
15232
|
+
info(`Saved changes: ${import_picocolors20.default.dim(stashMsg)}`);
|
|
15122
15233
|
} catch {
|
|
15123
15234
|
error("Failed to save changes. Please commit or save manually.");
|
|
15124
15235
|
process.exit(1);
|
|
@@ -15134,9 +15245,9 @@ var switch_default = defineCommand({
|
|
|
15134
15245
|
}
|
|
15135
15246
|
process.exit(1);
|
|
15136
15247
|
}
|
|
15137
|
-
success(`Switched to ${
|
|
15138
|
-
info(`Your changes from ${
|
|
15139
|
-
info(`Use ${
|
|
15248
|
+
success(`Switched to ${import_picocolors20.default.bold(targetBranch)}`);
|
|
15249
|
+
info(`Your changes from ${import_picocolors20.default.bold(currentBranch ?? "previous branch")} are saved.`, "");
|
|
15250
|
+
info(`Use ${import_picocolors20.default.bold("contrib save --restore")} to bring them back.`, "");
|
|
15140
15251
|
return;
|
|
15141
15252
|
}
|
|
15142
15253
|
const result = await checkoutBranch(targetBranch);
|
|
@@ -15144,12 +15255,12 @@ var switch_default = defineCommand({
|
|
|
15144
15255
|
error(`Failed to switch to ${targetBranch}: ${result.stderr}`);
|
|
15145
15256
|
process.exit(1);
|
|
15146
15257
|
}
|
|
15147
|
-
success(`Switched to ${
|
|
15258
|
+
success(`Switched to ${import_picocolors20.default.bold(targetBranch)}`);
|
|
15148
15259
|
}
|
|
15149
15260
|
});
|
|
15150
15261
|
|
|
15151
15262
|
// src/commands/sync.ts
|
|
15152
|
-
var
|
|
15263
|
+
var import_picocolors21 = __toESM(require_picocolors(), 1);
|
|
15153
15264
|
var sync_default = defineCommand({
|
|
15154
15265
|
meta: {
|
|
15155
15266
|
name: "sync",
|
|
@@ -15201,24 +15312,24 @@ var sync_default = defineCommand({
|
|
|
15201
15312
|
await fetchRemote(origin);
|
|
15202
15313
|
}
|
|
15203
15314
|
if (!await refExists(syncSource.ref)) {
|
|
15204
|
-
error(`Remote ref ${
|
|
15315
|
+
error(`Remote ref ${import_picocolors21.default.bold(syncSource.ref)} does not exist.`);
|
|
15205
15316
|
info("This can happen if the branch was renamed or deleted on the remote.", "");
|
|
15206
|
-
info(`Check your config: the base branch may need updating via ${
|
|
15317
|
+
info(`Check your config: the base branch may need updating via ${import_picocolors21.default.bold("contrib setup")}.`, "");
|
|
15207
15318
|
process.exit(1);
|
|
15208
15319
|
}
|
|
15209
15320
|
let allowMergeCommit = false;
|
|
15210
15321
|
const div = await getDivergence(baseBranch, syncSource.ref);
|
|
15211
15322
|
if (div.ahead > 0 || div.behind > 0) {
|
|
15212
|
-
info(`${
|
|
15323
|
+
info(`${import_picocolors21.default.bold(baseBranch)} is ${import_picocolors21.default.yellow(`${div.ahead} ahead`)} and ${import_picocolors21.default.red(`${div.behind} behind`)} ${syncSource.ref}`);
|
|
15213
15324
|
} else {
|
|
15214
|
-
info(`${
|
|
15325
|
+
info(`${import_picocolors21.default.bold(baseBranch)} is already in sync with ${syncSource.ref}`);
|
|
15215
15326
|
}
|
|
15216
15327
|
if (div.ahead > 0) {
|
|
15217
15328
|
const currentBranch = await getCurrentBranch();
|
|
15218
15329
|
const protectedBranches = getProtectedBranches(config);
|
|
15219
15330
|
const isOnProtected = currentBranch && protectedBranches.includes(currentBranch);
|
|
15220
15331
|
if (isOnProtected) {
|
|
15221
|
-
warn(`You have ${
|
|
15332
|
+
warn(`You have ${import_picocolors21.default.bold(String(div.ahead))} local commit${div.ahead !== 1 ? "s" : ""} on ${import_picocolors21.default.bold(baseBranch)} that aren't on the remote.`);
|
|
15222
15333
|
info("Pulling now could create a merge commit, which breaks clean history.");
|
|
15223
15334
|
console.log();
|
|
15224
15335
|
const MOVE_BRANCH = "Move my commits to a new feature branch, then sync";
|
|
@@ -15248,7 +15359,7 @@ var sync_default = defineCommand({
|
|
|
15248
15359
|
error(`Failed to create branch: ${branchResult.stderr}`);
|
|
15249
15360
|
process.exit(1);
|
|
15250
15361
|
}
|
|
15251
|
-
success(`Created ${
|
|
15362
|
+
success(`Created ${import_picocolors21.default.bold(newBranchName)} with your commits.`);
|
|
15252
15363
|
const coResult2 = await checkoutBranch(baseBranch);
|
|
15253
15364
|
if (coResult2.exitCode !== 0) {
|
|
15254
15365
|
error(`Failed to checkout ${baseBranch}: ${coResult2.stderr}`);
|
|
@@ -15256,11 +15367,11 @@ var sync_default = defineCommand({
|
|
|
15256
15367
|
}
|
|
15257
15368
|
const remoteRef = syncSource.ref;
|
|
15258
15369
|
await updateLocalBranch(baseBranch, remoteRef);
|
|
15259
|
-
success(`Reset ${
|
|
15260
|
-
success(`${
|
|
15370
|
+
success(`Reset ${import_picocolors21.default.bold(baseBranch)} to ${import_picocolors21.default.bold(remoteRef)}.`);
|
|
15371
|
+
success(`${import_picocolors21.default.bold(baseBranch)} is now in sync with ${syncSource.ref}`);
|
|
15261
15372
|
console.log();
|
|
15262
|
-
info(`Your commits are safe on ${
|
|
15263
|
-
info(`Run ${
|
|
15373
|
+
info(`Your commits are safe on ${import_picocolors21.default.bold(newBranchName)}.`, "");
|
|
15374
|
+
info(`Run ${import_picocolors21.default.bold(`git checkout ${newBranchName}`)} then ${import_picocolors21.default.bold("contrib update")} to rebase onto the synced ${import_picocolors21.default.bold(baseBranch)}.`, "");
|
|
15264
15375
|
return;
|
|
15265
15376
|
}
|
|
15266
15377
|
allowMergeCommit = true;
|
|
@@ -15268,7 +15379,7 @@ var sync_default = defineCommand({
|
|
|
15268
15379
|
}
|
|
15269
15380
|
}
|
|
15270
15381
|
if (!args.yes) {
|
|
15271
|
-
const ok = await confirmPrompt(`This will pull ${
|
|
15382
|
+
const ok = await confirmPrompt(`This will pull ${import_picocolors21.default.bold(syncSource.ref)} into local ${import_picocolors21.default.bold(baseBranch)}.`);
|
|
15272
15383
|
if (!ok)
|
|
15273
15384
|
process.exit(0);
|
|
15274
15385
|
}
|
|
@@ -15282,8 +15393,8 @@ var sync_default = defineCommand({
|
|
|
15282
15393
|
if (allowMergeCommit) {
|
|
15283
15394
|
error(`Pull failed: ${pullResult.stderr.trim()}`);
|
|
15284
15395
|
} else {
|
|
15285
|
-
error(`Fast-forward pull failed. Your local ${
|
|
15286
|
-
info(`Use ${
|
|
15396
|
+
error(`Fast-forward pull failed. Your local ${import_picocolors21.default.bold(baseBranch)} may have diverged.`);
|
|
15397
|
+
info(`Use ${import_picocolors21.default.bold("contrib sync")} again and choose "Move my commits to a new feature branch" to fix this.`, "");
|
|
15287
15398
|
}
|
|
15288
15399
|
process.exit(1);
|
|
15289
15400
|
}
|
|
@@ -15291,7 +15402,7 @@ var sync_default = defineCommand({
|
|
|
15291
15402
|
if (hasDevBranch(workflow) && role === "maintainer") {
|
|
15292
15403
|
const mainDiv = await getDivergence(config.mainBranch, `${origin}/${config.mainBranch}`);
|
|
15293
15404
|
if (mainDiv.behind > 0) {
|
|
15294
|
-
info(`Also syncing ${
|
|
15405
|
+
info(`Also syncing ${import_picocolors21.default.bold(config.mainBranch)}...`);
|
|
15295
15406
|
const mainCoResult = await checkoutBranch(config.mainBranch);
|
|
15296
15407
|
if (mainCoResult.exitCode === 0) {
|
|
15297
15408
|
const mainPullResult = await pullFastForwardOnly(origin, config.mainBranch);
|
|
@@ -15332,20 +15443,20 @@ var sync_default = defineCommand({
|
|
|
15332
15443
|
}
|
|
15333
15444
|
}
|
|
15334
15445
|
console.log();
|
|
15335
|
-
console.log(` ${
|
|
15446
|
+
console.log(` ${import_picocolors21.default.bold("\uD83D\uDD17 Branch Alignment")}`);
|
|
15336
15447
|
for (const [hash, names] of groups) {
|
|
15337
15448
|
const short = hash.slice(0, 7);
|
|
15338
|
-
const nameStr = names.map((n2) =>
|
|
15339
|
-
console.log(` ${
|
|
15449
|
+
const nameStr = names.map((n2) => import_picocolors21.default.bold(n2)).join(import_picocolors21.default.dim(" \xB7 "));
|
|
15450
|
+
console.log(` ${import_picocolors21.default.yellow(short)} ${import_picocolors21.default.dim("\u2500\u2500")} ${nameStr}`);
|
|
15340
15451
|
const subject = await getCommitSubject(hash);
|
|
15341
15452
|
if (subject) {
|
|
15342
|
-
console.log(` ${
|
|
15453
|
+
console.log(` ${import_picocolors21.default.dim(subject)}`);
|
|
15343
15454
|
}
|
|
15344
15455
|
}
|
|
15345
15456
|
if (groups.size === 1) {
|
|
15346
|
-
console.log(` ${
|
|
15457
|
+
console.log(` ${import_picocolors21.default.green("\u2713")} ${import_picocolors21.default.green("All branches aligned")} ${import_picocolors21.default.dim("\u2014 ready to start")}`);
|
|
15347
15458
|
} else {
|
|
15348
|
-
console.log(` ${
|
|
15459
|
+
console.log(` ${import_picocolors21.default.yellow("\u26A0")} ${import_picocolors21.default.yellow("Branches are not fully aligned")}`);
|
|
15349
15460
|
}
|
|
15350
15461
|
}
|
|
15351
15462
|
}
|
|
@@ -15354,7 +15465,7 @@ var sync_default = defineCommand({
|
|
|
15354
15465
|
|
|
15355
15466
|
// src/commands/update.ts
|
|
15356
15467
|
import { readFileSync as readFileSync6 } from "fs";
|
|
15357
|
-
var
|
|
15468
|
+
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
15358
15469
|
function hasStaleBranchWorkToPreserve(uniqueCommitsAheadOfBase, hasUncommittedChanges2) {
|
|
15359
15470
|
return hasUncommittedChanges2 || uniqueCommitsAheadOfBase > 0;
|
|
15360
15471
|
}
|
|
@@ -15395,7 +15506,7 @@ var update_default = defineCommand({
|
|
|
15395
15506
|
}
|
|
15396
15507
|
if (protectedBranches.includes(currentBranch)) {
|
|
15397
15508
|
await projectHeading("update", "\uD83D\uDD03");
|
|
15398
|
-
warn(`You're on ${
|
|
15509
|
+
warn(`You're on ${import_picocolors22.default.bold(currentBranch)}, which is a protected branch. Updates (rebase) apply to feature branches.`);
|
|
15399
15510
|
await fetchAll();
|
|
15400
15511
|
const { origin } = config;
|
|
15401
15512
|
const remoteRef = `${origin}/${currentBranch}`;
|
|
@@ -15404,12 +15515,12 @@ var update_default = defineCommand({
|
|
|
15404
15515
|
const hasCommits = localWork.unpushedCommits > 0;
|
|
15405
15516
|
const hasAnything = hasCommits || dirty;
|
|
15406
15517
|
if (!hasAnything) {
|
|
15407
|
-
info(`No local changes found on ${
|
|
15408
|
-
info(`Use ${
|
|
15518
|
+
info(`No local changes found on ${import_picocolors22.default.bold(currentBranch)}.`);
|
|
15519
|
+
info(`Use ${import_picocolors22.default.bold("contrib sync")} to sync protected branches, or ${import_picocolors22.default.bold("contrib start")} to create a feature branch.`);
|
|
15409
15520
|
process.exit(1);
|
|
15410
15521
|
}
|
|
15411
15522
|
if (hasCommits) {
|
|
15412
|
-
info(`Found ${
|
|
15523
|
+
info(`Found ${import_picocolors22.default.bold(String(localWork.unpushedCommits))} unpushed commit${localWork.unpushedCommits !== 1 ? "s" : ""} on ${import_picocolors22.default.bold(currentBranch)}.`);
|
|
15413
15524
|
}
|
|
15414
15525
|
if (dirty) {
|
|
15415
15526
|
info("You also have uncommitted changes in the working tree.");
|
|
@@ -15439,12 +15550,12 @@ var update_default = defineCommand({
|
|
|
15439
15550
|
error(`Failed to create branch: ${branchResult.stderr}`);
|
|
15440
15551
|
process.exit(1);
|
|
15441
15552
|
}
|
|
15442
|
-
success(`Created ${
|
|
15553
|
+
success(`Created ${import_picocolors22.default.bold(newBranchName)} with your changes.`);
|
|
15443
15554
|
await updateLocalBranch(currentBranch, remoteRef);
|
|
15444
|
-
info(`Reset ${
|
|
15555
|
+
info(`Reset ${import_picocolors22.default.bold(currentBranch)} back to ${import_picocolors22.default.bold(remoteRef)} \u2014 no damage done.`, "");
|
|
15445
15556
|
console.log();
|
|
15446
|
-
success(`You're now on ${
|
|
15447
|
-
info(`Run ${
|
|
15557
|
+
success(`You're now on ${import_picocolors22.default.bold(newBranchName)} with all your work intact.`);
|
|
15558
|
+
info(`Run ${import_picocolors22.default.bold("contrib update")} again to rebase onto latest ${import_picocolors22.default.bold(baseBranch)}.`, "");
|
|
15448
15559
|
return;
|
|
15449
15560
|
}
|
|
15450
15561
|
if (await hasUncommittedChanges()) {
|
|
@@ -15454,8 +15565,8 @@ var update_default = defineCommand({
|
|
|
15454
15565
|
await projectHeading("update", "\uD83D\uDD03");
|
|
15455
15566
|
const mergedPR = await getMergedPRForBranch(currentBranch);
|
|
15456
15567
|
if (mergedPR) {
|
|
15457
|
-
warn(`PR #${mergedPR.number} (${
|
|
15458
|
-
info(`Link: ${
|
|
15568
|
+
warn(`PR #${mergedPR.number} (${import_picocolors22.default.bold(mergedPR.title)}) has already been merged.`);
|
|
15569
|
+
info(`Link: ${import_picocolors22.default.underline(mergedPR.url)}`, "");
|
|
15459
15570
|
const uniqueCommitsAheadOfBase = await countCommitsAhead(currentBranch, syncSource.ref);
|
|
15460
15571
|
const dirty = await hasUncommittedChanges();
|
|
15461
15572
|
const hasWork = hasStaleBranchWorkToPreserve(uniqueCommitsAheadOfBase, dirty);
|
|
@@ -15464,12 +15575,12 @@ var update_default = defineCommand({
|
|
|
15464
15575
|
info("You have uncommitted local changes.");
|
|
15465
15576
|
}
|
|
15466
15577
|
if (uniqueCommitsAheadOfBase > 0) {
|
|
15467
|
-
info(`You have ${uniqueCommitsAheadOfBase} local commit(s) not in ${
|
|
15578
|
+
info(`You have ${uniqueCommitsAheadOfBase} local commit(s) not in ${import_picocolors22.default.bold(syncSource.ref)}.`);
|
|
15468
15579
|
}
|
|
15469
15580
|
const SAVE_NEW_BRANCH = "Save changes to a new branch";
|
|
15470
15581
|
const DISCARD = "Discard all changes and clean up";
|
|
15471
15582
|
const CANCEL = "Cancel";
|
|
15472
|
-
const action = await selectPrompt(`${
|
|
15583
|
+
const action = await selectPrompt(`${import_picocolors22.default.bold(currentBranch)} is stale but has local work. What would you like to do?`, [SAVE_NEW_BRANCH, DISCARD, CANCEL]);
|
|
15473
15584
|
if (action === CANCEL) {
|
|
15474
15585
|
info("No changes made. You are still on your current branch.");
|
|
15475
15586
|
return;
|
|
@@ -15491,7 +15602,7 @@ var update_default = defineCommand({
|
|
|
15491
15602
|
error(`Failed to rename branch: ${renameResult.stderr}`);
|
|
15492
15603
|
process.exit(1);
|
|
15493
15604
|
}
|
|
15494
|
-
success(`Renamed ${
|
|
15605
|
+
success(`Renamed ${import_picocolors22.default.bold(currentBranch)} \u2192 ${import_picocolors22.default.bold(newBranchName)}`);
|
|
15495
15606
|
await unsetUpstream();
|
|
15496
15607
|
await fetchRemote(syncSource.remote);
|
|
15497
15608
|
let rebaseResult2;
|
|
@@ -15503,11 +15614,11 @@ var update_default = defineCommand({
|
|
|
15503
15614
|
}
|
|
15504
15615
|
if (rebaseResult2.exitCode !== 0) {
|
|
15505
15616
|
warn("Rebase encountered conflicts. Resolve them manually, then run:");
|
|
15506
|
-
info(` ${
|
|
15617
|
+
info(` ${import_picocolors22.default.bold("git rebase --continue")}`, "");
|
|
15507
15618
|
} else {
|
|
15508
|
-
success(`Rebased ${
|
|
15619
|
+
success(`Rebased ${import_picocolors22.default.bold(newBranchName)} onto ${import_picocolors22.default.bold(syncSource.ref)}.`);
|
|
15509
15620
|
}
|
|
15510
|
-
info(`All your changes are preserved. Run ${
|
|
15621
|
+
info(`All your changes are preserved. Run ${import_picocolors22.default.bold("contrib submit")} when ready to create a new PR.`, "");
|
|
15511
15622
|
return;
|
|
15512
15623
|
}
|
|
15513
15624
|
warn("Discarding local changes...");
|
|
@@ -15526,24 +15637,24 @@ var update_default = defineCommand({
|
|
|
15526
15637
|
process.exit(1);
|
|
15527
15638
|
}
|
|
15528
15639
|
await updateLocalBranch(baseBranch, syncSource.ref);
|
|
15529
|
-
success(`Synced ${
|
|
15530
|
-
info(`Deleting stale branch ${
|
|
15640
|
+
success(`Synced ${import_picocolors22.default.bold(baseBranch)} with ${import_picocolors22.default.bold(syncSource.ref)}.`);
|
|
15641
|
+
info(`Deleting stale branch ${import_picocolors22.default.bold(currentBranch)}...`);
|
|
15531
15642
|
await forceDeleteBranch(currentBranch);
|
|
15532
|
-
success(`Deleted ${
|
|
15533
|
-
info(`Run ${
|
|
15643
|
+
success(`Deleted ${import_picocolors22.default.bold(currentBranch)}.`);
|
|
15644
|
+
info(`Run ${import_picocolors22.default.bold("contrib start")} to begin a new feature branch.`, "");
|
|
15534
15645
|
return;
|
|
15535
15646
|
}
|
|
15536
|
-
info(`Updating ${
|
|
15647
|
+
info(`Updating ${import_picocolors22.default.bold(currentBranch)} with latest ${import_picocolors22.default.bold(baseBranch)}...`);
|
|
15537
15648
|
await fetchRemote(syncSource.remote);
|
|
15538
15649
|
if (!await refExists(syncSource.ref)) {
|
|
15539
|
-
error(`Remote ref ${
|
|
15650
|
+
error(`Remote ref ${import_picocolors22.default.bold(syncSource.ref)} does not exist.`);
|
|
15540
15651
|
error("Run `git fetch --all` and verify your remote configuration.");
|
|
15541
15652
|
process.exit(1);
|
|
15542
15653
|
}
|
|
15543
15654
|
await updateLocalBranch(baseBranch, syncSource.ref);
|
|
15544
15655
|
const rebaseStrategy = await determineRebaseStrategy(currentBranch, syncSource.ref);
|
|
15545
15656
|
if (rebaseStrategy.strategy === "onto" && rebaseStrategy.ontoOldBase) {
|
|
15546
|
-
info(
|
|
15657
|
+
info(import_picocolors22.default.dim(`Using --onto rebase (branch was based on a different ref)`));
|
|
15547
15658
|
}
|
|
15548
15659
|
const rebaseResult = rebaseStrategy.strategy === "onto" && rebaseStrategy.ontoOldBase ? await rebaseOnto(syncSource.ref, rebaseStrategy.ontoOldBase) : await rebase(syncSource.ref);
|
|
15549
15660
|
if (rebaseResult.exitCode !== 0) {
|
|
@@ -15574,10 +15685,10 @@ ${content.slice(0, 2000)}
|
|
|
15574
15685
|
if (suggestion) {
|
|
15575
15686
|
spinner.success("AI conflict guidance ready.");
|
|
15576
15687
|
console.log(`
|
|
15577
|
-
${
|
|
15578
|
-
console.log(
|
|
15688
|
+
${import_picocolors22.default.bold("\uD83D\uDCA1 AI Conflict Resolution Guidance:")}`);
|
|
15689
|
+
console.log(import_picocolors22.default.dim("\u2500".repeat(60)));
|
|
15579
15690
|
console.log(suggestion);
|
|
15580
|
-
console.log(
|
|
15691
|
+
console.log(import_picocolors22.default.dim("\u2500".repeat(60)));
|
|
15581
15692
|
console.log();
|
|
15582
15693
|
} else {
|
|
15583
15694
|
spinner.fail("AI could not analyze the conflicts.");
|
|
@@ -15585,21 +15696,21 @@ ${import_picocolors21.default.bold("\uD83D\uDCA1 AI Conflict Resolution Guidance
|
|
|
15585
15696
|
}
|
|
15586
15697
|
}
|
|
15587
15698
|
}
|
|
15588
|
-
console.log(
|
|
15699
|
+
console.log(import_picocolors22.default.bold("To resolve:"));
|
|
15589
15700
|
console.log(` 1. Fix conflicts in the affected files`);
|
|
15590
|
-
console.log(` 2. ${
|
|
15591
|
-
console.log(` 3. ${
|
|
15701
|
+
console.log(` 2. ${import_picocolors22.default.cyan("git add <resolved-files>")}`);
|
|
15702
|
+
console.log(` 3. ${import_picocolors22.default.cyan("git rebase --continue")}`);
|
|
15592
15703
|
console.log();
|
|
15593
|
-
console.log(` Or abort: ${
|
|
15704
|
+
console.log(` Or abort: ${import_picocolors22.default.cyan("git rebase --abort")}`);
|
|
15594
15705
|
process.exit(1);
|
|
15595
15706
|
}
|
|
15596
|
-
success(`${
|
|
15707
|
+
success(`${import_picocolors22.default.bold(currentBranch)} has been rebased onto latest ${import_picocolors22.default.bold(baseBranch)}`);
|
|
15597
15708
|
}
|
|
15598
15709
|
});
|
|
15599
15710
|
|
|
15600
15711
|
// src/commands/validate.ts
|
|
15601
15712
|
import { readFileSync as readFileSync7 } from "fs";
|
|
15602
|
-
var
|
|
15713
|
+
var import_picocolors23 = __toESM(require_picocolors(), 1);
|
|
15603
15714
|
var validate_default = defineCommand({
|
|
15604
15715
|
meta: {
|
|
15605
15716
|
name: "validate",
|
|
@@ -15639,7 +15750,7 @@ var validate_default = defineCommand({
|
|
|
15639
15750
|
}
|
|
15640
15751
|
const errors = getValidationError(convention);
|
|
15641
15752
|
for (const line of errors) {
|
|
15642
|
-
console.error(
|
|
15753
|
+
console.error(import_picocolors23.default.red(` \u2717 ${line}`));
|
|
15643
15754
|
}
|
|
15644
15755
|
process.exit(1);
|
|
15645
15756
|
}
|
|
@@ -17034,7 +17145,7 @@ nodeFiglet.fontsSync = function() {
|
|
|
17034
17145
|
};
|
|
17035
17146
|
|
|
17036
17147
|
// src/ui/banner.ts
|
|
17037
|
-
var
|
|
17148
|
+
var import_picocolors24 = __toESM(require_picocolors(), 1);
|
|
17038
17149
|
|
|
17039
17150
|
// src/data/announcements.json
|
|
17040
17151
|
var announcements_default = [
|
|
@@ -17086,9 +17197,9 @@ function getAuthor() {
|
|
|
17086
17197
|
}
|
|
17087
17198
|
function showBanner(variant = "small") {
|
|
17088
17199
|
const logo = variant === "big" ? LOGO_BIG : LOGO_SMALL;
|
|
17089
|
-
console.log(
|
|
17200
|
+
console.log(import_picocolors24.default.cyan(`
|
|
17090
17201
|
${logo}`));
|
|
17091
|
-
console.log(` ${
|
|
17202
|
+
console.log(` ${import_picocolors24.default.dim(`v${getVersion()}`)} ${import_picocolors24.default.dim("\u2014")} ${import_picocolors24.default.dim(`Built by ${getAuthor()}`)}`);
|
|
17092
17203
|
const announcements = getActiveAnnouncements();
|
|
17093
17204
|
if (announcements.length > 0) {
|
|
17094
17205
|
console.log();
|
|
@@ -17097,27 +17208,27 @@ ${logo}`));
|
|
|
17097
17208
|
if (variant === "big") {
|
|
17098
17209
|
const panelLines = [
|
|
17099
17210
|
{
|
|
17100
|
-
label:
|
|
17211
|
+
label: import_picocolors24.default.bold(import_picocolors24.default.cyan("Getting Started")),
|
|
17101
17212
|
rawLabel: "Getting Started",
|
|
17102
17213
|
value: "",
|
|
17103
17214
|
rawValue: ""
|
|
17104
17215
|
},
|
|
17105
17216
|
{
|
|
17106
|
-
label:
|
|
17217
|
+
label: import_picocolors24.default.cyan("cn setup"),
|
|
17107
17218
|
rawLabel: "cn setup",
|
|
17108
|
-
value:
|
|
17219
|
+
value: import_picocolors24.default.dim("configure workflow, remotes, and defaults"),
|
|
17109
17220
|
rawValue: "configure workflow, remotes, and defaults"
|
|
17110
17221
|
},
|
|
17111
17222
|
{
|
|
17112
|
-
label:
|
|
17223
|
+
label: import_picocolors24.default.cyan("cn doctor"),
|
|
17113
17224
|
rawLabel: "cn doctor",
|
|
17114
|
-
value:
|
|
17225
|
+
value: import_picocolors24.default.dim("verify your environment before doing any work"),
|
|
17115
17226
|
rawValue: "verify your environment before doing any work"
|
|
17116
17227
|
},
|
|
17117
17228
|
{
|
|
17118
|
-
label:
|
|
17229
|
+
label: import_picocolors24.default.cyan("cn start"),
|
|
17119
17230
|
rawLabel: "cn start",
|
|
17120
|
-
value:
|
|
17231
|
+
value: import_picocolors24.default.dim("create a branch and begin the next task"),
|
|
17121
17232
|
rawValue: "create a branch and begin the next task"
|
|
17122
17233
|
},
|
|
17123
17234
|
{
|
|
@@ -17127,13 +17238,13 @@ ${logo}`));
|
|
|
17127
17238
|
rawValue: ""
|
|
17128
17239
|
},
|
|
17129
17240
|
{
|
|
17130
|
-
label:
|
|
17241
|
+
label: import_picocolors24.default.bold(import_picocolors24.default.cyan("Workflow")),
|
|
17131
17242
|
rawLabel: "Workflow",
|
|
17132
17243
|
value: "",
|
|
17133
17244
|
rawValue: ""
|
|
17134
17245
|
},
|
|
17135
17246
|
{
|
|
17136
|
-
label:
|
|
17247
|
+
label: import_picocolors24.default.dim("cn setup \u2192 cn commit \u2192 cn update \u2192 cn submit"),
|
|
17137
17248
|
rawLabel: "cn setup \u2192 cn commit \u2192 cn update \u2192 cn submit",
|
|
17138
17249
|
value: "",
|
|
17139
17250
|
rawValue: ""
|
|
@@ -17158,22 +17269,22 @@ ${logo}`));
|
|
|
17158
17269
|
return Math.max(max, lineLength);
|
|
17159
17270
|
}, 0));
|
|
17160
17271
|
console.log();
|
|
17161
|
-
console.log(` ${
|
|
17272
|
+
console.log(` ${import_picocolors24.default.dim(`\u250C${"\u2500".repeat(contentWidth + 2)}\u2510`)}`);
|
|
17162
17273
|
for (const line of rows) {
|
|
17163
17274
|
if (!line.rawLabel && !line.rawValue) {
|
|
17164
|
-
console.log(` ${
|
|
17275
|
+
console.log(` ${import_picocolors24.default.dim("\u2502")} ${" ".repeat(contentWidth)} ${import_picocolors24.default.dim("\u2502")}`);
|
|
17165
17276
|
continue;
|
|
17166
17277
|
}
|
|
17167
17278
|
const left = line.rawValue ? `${line.label}${" ".repeat(Math.max(0, labelWidth - line.rawLabel.length + 2))}` : line.label;
|
|
17168
|
-
const value = line.rawValue ?
|
|
17279
|
+
const value = line.rawValue ? import_picocolors24.default.dim(line.rawValue) : "";
|
|
17169
17280
|
const rawLength = line.rawValue ? labelWidth + 2 + line.rawValue.length : line.rawLabel.length;
|
|
17170
17281
|
const trailing = " ".repeat(Math.max(0, contentWidth - rawLength));
|
|
17171
|
-
console.log(` ${
|
|
17282
|
+
console.log(` ${import_picocolors24.default.dim("\u2502")} ${left}${value}${trailing} ${import_picocolors24.default.dim("\u2502")}`);
|
|
17172
17283
|
}
|
|
17173
|
-
console.log(` ${
|
|
17284
|
+
console.log(` ${import_picocolors24.default.dim(`\u2514${"\u2500".repeat(contentWidth + 2)}\u2518`)}`);
|
|
17174
17285
|
console.log();
|
|
17175
|
-
console.log(` ${
|
|
17176
|
-
console.log(` ${
|
|
17286
|
+
console.log(` ${import_picocolors24.default.dim("Star or contribute:")} ${import_picocolors24.default.dim(linkify("gh.waren.build/contribute-now", "https://gh.waren.build/contribute-now"))}`);
|
|
17287
|
+
console.log(` ${import_picocolors24.default.dim("Sponsor:")} ${import_picocolors24.default.dim(linkify("warengonzaga.com/sponsor", "https://warengonzaga.com/sponsor"))}`);
|
|
17177
17288
|
}
|
|
17178
17289
|
console.log();
|
|
17179
17290
|
}
|
|
@@ -17205,7 +17316,7 @@ function renderAnnouncementBanner(announcement) {
|
|
|
17205
17316
|
console.log(` ${tone.border(`\u250C${"\u2500".repeat(rawWidth + 2)}\u2510`)}`);
|
|
17206
17317
|
for (const line of lines) {
|
|
17207
17318
|
const trailing = " ".repeat(Math.max(0, rawWidth - line.length));
|
|
17208
|
-
const content = line === title ? tone.title(line) :
|
|
17319
|
+
const content = line === title ? tone.title(line) : import_picocolors24.default.dim(line);
|
|
17209
17320
|
console.log(` ${tone.border("\u2502")} ${content}${trailing} ${tone.border("\u2502")}`);
|
|
17210
17321
|
}
|
|
17211
17322
|
console.log(` ${tone.border(`\u2514${"\u2500".repeat(rawWidth + 2)}\u2518`)}`);
|
|
@@ -17241,20 +17352,20 @@ function getAnnouncementTone(kind) {
|
|
|
17241
17352
|
case "info":
|
|
17242
17353
|
return {
|
|
17243
17354
|
emoji: "\u2139",
|
|
17244
|
-
border:
|
|
17245
|
-
title: (value) =>
|
|
17355
|
+
border: import_picocolors24.default.blue,
|
|
17356
|
+
title: (value) => import_picocolors24.default.bold(import_picocolors24.default.blue(value))
|
|
17246
17357
|
};
|
|
17247
17358
|
case "warning":
|
|
17248
17359
|
return {
|
|
17249
17360
|
emoji: "\uD83D\uDEA8",
|
|
17250
|
-
border:
|
|
17251
|
-
title: (value) =>
|
|
17361
|
+
border: import_picocolors24.default.red,
|
|
17362
|
+
title: (value) => import_picocolors24.default.bold(import_picocolors24.default.red(value))
|
|
17252
17363
|
};
|
|
17253
17364
|
default:
|
|
17254
17365
|
return {
|
|
17255
17366
|
emoji: "\u26A0",
|
|
17256
|
-
border:
|
|
17257
|
-
title: (value) =>
|
|
17367
|
+
border: import_picocolors24.default.yellow,
|
|
17368
|
+
title: (value) => import_picocolors24.default.bold(import_picocolors24.default.yellow(value))
|
|
17258
17369
|
};
|
|
17259
17370
|
}
|
|
17260
17371
|
}
|
|
@@ -17285,6 +17396,7 @@ if (!isVersion) {
|
|
|
17285
17396
|
"update",
|
|
17286
17397
|
"submit",
|
|
17287
17398
|
"switch",
|
|
17399
|
+
"discard",
|
|
17288
17400
|
"save",
|
|
17289
17401
|
"clean",
|
|
17290
17402
|
"status",
|
|
@@ -17321,6 +17433,7 @@ var main = defineCommand({
|
|
|
17321
17433
|
update: update_default,
|
|
17322
17434
|
submit: submit_default,
|
|
17323
17435
|
switch: switch_default,
|
|
17436
|
+
discard: discard_default,
|
|
17324
17437
|
save: save_default,
|
|
17325
17438
|
branch: branch_default,
|
|
17326
17439
|
clean: clean_default,
|
|
@@ -17336,4 +17449,7 @@ var main = defineCommand({
|
|
|
17336
17449
|
}
|
|
17337
17450
|
}
|
|
17338
17451
|
});
|
|
17339
|
-
runMain(main)
|
|
17452
|
+
runMain(main).then(() => process.exit(process.exitCode ?? 0)).catch((err) => {
|
|
17453
|
+
console.error(err);
|
|
17454
|
+
process.exit(1);
|
|
17455
|
+
});
|