gityo 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +42 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1710,7 +1710,7 @@ function useColor() {
|
|
|
1710
1710
|
if (process$1.env.FORCE_COLOR || process$1.env.CLICOLOR_FORCE !== void 0) return true;
|
|
1711
1711
|
}
|
|
1712
1712
|
new Command();
|
|
1713
|
-
var version$4 = "1.1.
|
|
1713
|
+
var version$4 = "1.1.7";
|
|
1714
1714
|
const keybindingLookup = new Set(["emacs", "vim"]);
|
|
1715
1715
|
function isKeybinding(value) {
|
|
1716
1716
|
return keybindingLookup.has(value);
|
|
@@ -228985,6 +228985,7 @@ async function mainController(options = {}) {
|
|
|
228985
228985
|
if (typeof options.input === "string" && finalCommitMessage.length === 0) throw new Error("Provided commit message input cannot be empty.");
|
|
228986
228986
|
const { diffScope, files } = await getCommitFiles(git, options.scope ?? "staged-or-changes");
|
|
228987
228987
|
if (files.length === 0) return console.log("No changed files found.");
|
|
228988
|
+
console.log(source_default.dim(`${files.length} ${diffScope === "staged" ? "staged" : "changed"} file(s)`));
|
|
228988
228989
|
const diff = await getCommitDiff(git, diffScope);
|
|
228989
228990
|
if (finalCommitMessage.length > 0) {
|
|
228990
228991
|
console.log(source_default.yellow("✓ Using direct commit message"));
|
|
@@ -229161,11 +229162,18 @@ async function findPullRequest(base$2, head$1) {
|
|
|
229161
229162
|
"--limit",
|
|
229162
229163
|
"100",
|
|
229163
229164
|
"--json",
|
|
229164
|
-
"number,url,baseRefName,headRefName"
|
|
229165
|
+
"number,url,baseRefName,headRefName,commits"
|
|
229165
229166
|
])).filter((pullRequest) => pullRequest.baseRefName === base$2 && pullRequest.headRefName === head$1);
|
|
229166
229167
|
if (matches.length === 0) return null;
|
|
229167
229168
|
if (matches.length > 1) throw new Error(`Multiple open pull requests found for ${base$2} <- ${head$1}.`);
|
|
229168
|
-
|
|
229169
|
+
const match = matches[0];
|
|
229170
|
+
return {
|
|
229171
|
+
number: match.number,
|
|
229172
|
+
url: match.url,
|
|
229173
|
+
baseRefName: match.baseRefName,
|
|
229174
|
+
headRefName: match.headRefName,
|
|
229175
|
+
commitCount: match.commits.length
|
|
229176
|
+
};
|
|
229169
229177
|
}
|
|
229170
229178
|
async function createPullRequest$1(input$3) {
|
|
229171
229179
|
return exec("gh", [
|
|
@@ -236220,6 +236228,7 @@ async function createPullRequest(options) {
|
|
|
236220
236228
|
const maxDiffTokens = options.maxDiffTokens ?? DEFAULT_MAX_DIFF_TOKENS;
|
|
236221
236229
|
const compare = await fetchCompare(options.base, options.head);
|
|
236222
236230
|
if (compare.commits.length === 0) throw new Error(`No commits found between '${options.base}' and '${options.head}'.`);
|
|
236231
|
+
console.log(source_default.dim(`${compare.commits.length} commit(s) between ${options.base} and ${options.head}`));
|
|
236223
236232
|
const context = buildCompareContext(compare, maxDiffTokens);
|
|
236224
236233
|
let draft = "";
|
|
236225
236234
|
while (true) {
|
|
@@ -236240,7 +236249,7 @@ async function createPullRequest(options) {
|
|
|
236240
236249
|
body: content.body,
|
|
236241
236250
|
base: options.base,
|
|
236242
236251
|
head: options.head
|
|
236243
|
-
}), options);
|
|
236252
|
+
}), options, compare.commits.length);
|
|
236244
236253
|
console.log(pullRequest.url);
|
|
236245
236254
|
return pullRequest;
|
|
236246
236255
|
}
|
|
@@ -236251,13 +236260,14 @@ function parsePullRequestContent(text$1) {
|
|
|
236251
236260
|
body: lines.slice(1).join("\n").trim()
|
|
236252
236261
|
};
|
|
236253
236262
|
}
|
|
236254
|
-
async function resolveCreatedPullRequest(output$3, options) {
|
|
236263
|
+
async function resolveCreatedPullRequest(output$3, options, commitCount) {
|
|
236255
236264
|
const match = output$3.match(PR_URL_PATTERN);
|
|
236256
236265
|
if (match) return {
|
|
236257
236266
|
number: Number(match[1]),
|
|
236258
236267
|
url: match[0],
|
|
236259
236268
|
baseRefName: options.base,
|
|
236260
|
-
headRefName: options.head
|
|
236269
|
+
headRefName: options.head,
|
|
236270
|
+
commitCount
|
|
236261
236271
|
};
|
|
236262
236272
|
const found = await findPullRequest(options.base, options.head);
|
|
236263
236273
|
if (found) return found;
|
|
@@ -236341,8 +236351,10 @@ async function mergePullRequestController(baseArg, headArg, options = {}) {
|
|
|
236341
236351
|
scope: options.all ? "everything" : "staged-or-changes"
|
|
236342
236352
|
});
|
|
236343
236353
|
let pullRequest = await findPullRequest(branches.base, branches.head);
|
|
236344
|
-
if (pullRequest)
|
|
236345
|
-
|
|
236354
|
+
if (pullRequest) {
|
|
236355
|
+
console.log(source_default.dim(`${pullRequest.commitCount} commit(s) between ${branches.base} and ${branches.head}`));
|
|
236356
|
+
console.log(pullRequest.url);
|
|
236357
|
+
} else pullRequest = await createPullRequest({
|
|
236346
236358
|
base: branches.base,
|
|
236347
236359
|
head: branches.head,
|
|
236348
236360
|
systemPrompt,
|
|
@@ -236361,6 +236373,7 @@ async function mergePullRequestController(baseArg, headArg, options = {}) {
|
|
|
236361
236373
|
return;
|
|
236362
236374
|
}
|
|
236363
236375
|
await mergePullRequest(pullRequest.number, options.mergeMethod ?? context.config.prMergeMethod);
|
|
236376
|
+
if (options.web) await openPullRequest(pullRequest.number);
|
|
236364
236377
|
}
|
|
236365
236378
|
const toZeroIfInfinity = (value) => Number.isFinite(value) ? value : 0;
|
|
236366
236379
|
function parseNumber(milliseconds) {
|
|
@@ -236775,7 +236788,6 @@ async function releaseController(tagArg, options = {}) {
|
|
|
236775
236788
|
if (options.bump && tagArg !== void 0) throw new Error(`Use either a release tag or --${options.bump}, not both.`);
|
|
236776
236789
|
if (options.yolo && tagArg === void 0 && !options.bump) throw new Error("A release tag or --major, --minor, or --patch is required with --yolo.");
|
|
236777
236790
|
const config$5 = await loadConfig(await getRepoRoot());
|
|
236778
|
-
const languageModel = resolveLanguageModel(resolveModelConfig(config$5.models, options.model ?? config$5.releaseModel ?? config$5.model));
|
|
236779
236791
|
const releases = await listReleases(100);
|
|
236780
236792
|
let tag = tagArg?.trim() ?? "";
|
|
236781
236793
|
if (options.bump) {
|
|
@@ -236803,6 +236815,25 @@ async function releaseController(tagArg, options = {}) {
|
|
|
236803
236815
|
}
|
|
236804
236816
|
const branch = await getDefaultBranch();
|
|
236805
236817
|
if (branch.length === 0) throw new Error("Could not determine the default branch.");
|
|
236818
|
+
if (options.empty) {
|
|
236819
|
+
const headSha$1 = await getBranchHeadSha(branch);
|
|
236820
|
+
if (!options.yolo && !await dist_default({
|
|
236821
|
+
message: `Create release ${source_default.yellow.bold(tag)} on ${source_default.yellow.bold(branch)} without notes?`,
|
|
236822
|
+
default: true,
|
|
236823
|
+
theme: selectionTheme
|
|
236824
|
+
})) {
|
|
236825
|
+
console.log("Release creation cancelled.");
|
|
236826
|
+
return;
|
|
236827
|
+
}
|
|
236828
|
+
if (exists$2) await deleteRelease(tag);
|
|
236829
|
+
await createRelease({
|
|
236830
|
+
tag,
|
|
236831
|
+
target: headSha$1,
|
|
236832
|
+
notes: ""
|
|
236833
|
+
});
|
|
236834
|
+
return;
|
|
236835
|
+
}
|
|
236836
|
+
const languageModel = resolveLanguageModel(resolveModelConfig(config$5.models, options.model ?? config$5.releaseModel ?? config$5.model));
|
|
236806
236837
|
const tagIndex = releases.findIndex((release) => release.tagName === tag);
|
|
236807
236838
|
const previousTag = (tagIndex === -1 ? releases[0] : releases[tagIndex + 1])?.tagName ?? null;
|
|
236808
236839
|
const headSha = await getBranchHeadSha(branch);
|
|
@@ -236923,7 +236954,7 @@ const pr = app.command("pr").description("Create and merge GitHub pull requests.
|
|
|
236923
236954
|
pr.command("create").description("Create a pull request with an AI-generated title and body.").argument("[base-branch]", "Base branch to merge into (defaults to the repository default branch).").argument("[head-branch]", "Head branch with the changes (defaults to the current branch).").option("--model <model>", "Model key from config to use (overrides the configured model).").option("-t, --title-style <style>", "Title style key to use (defaults to \"default\").").option("-b, --body-style <style>", "Body style key to use (defaults to \"default\").").option("-y, --yolo", "Create the pull request without asking for confirmation.").option("-A, --all", "Commit all local changes, not just staged files, before continuing.").option("-w, --web", "Open the pull request in a browser.").action((baseBranch, headBranch, options) => {
|
|
236924
236955
|
handleError(() => createPullRequestController(baseBranch, headBranch, options));
|
|
236925
236956
|
});
|
|
236926
|
-
pr.command("merge").description("Create the pull request if needed, then merge it.").argument("[base-branch]", "Base branch to merge into (defaults to the repository default branch).").argument("[head-branch]", "Head branch with the changes (defaults to the current branch).").option("--model <model>", "Model key from config to use (overrides the configured model).").option("-t, --title-style <style>", "Title style key to use (defaults to \"default\").").option("-b, --body-style <style>", "Body style key to use (defaults to \"default\").").option("-y, --yolo", "Merge the pull request without asking for confirmation.").option("-A, --all", "Commit all local changes, not just staged files, before continuing.").option("-m, --merge", "Merge the commits with the base branch.").option("-r, --rebase", "Rebase the commits onto the base branch.").option("-s, --squash", "Squash the commits into one commit.").action((baseBranch, headBranch, options) => {
|
|
236957
|
+
pr.command("merge").description("Create the pull request if needed, then merge it.").argument("[base-branch]", "Base branch to merge into (defaults to the repository default branch).").argument("[head-branch]", "Head branch with the changes (defaults to the current branch).").option("--model <model>", "Model key from config to use (overrides the configured model).").option("-t, --title-style <style>", "Title style key to use (defaults to \"default\").").option("-b, --body-style <style>", "Body style key to use (defaults to \"default\").").option("-y, --yolo", "Merge the pull request without asking for confirmation.").option("-A, --all", "Commit all local changes, not just staged files, before continuing.").option("-m, --merge", "Merge the commits with the base branch.").option("-r, --rebase", "Rebase the commits onto the base branch.").option("-s, --squash", "Squash the commits into one commit.").option("-w, --web", "Open the pull request in a browser after merging.").action((baseBranch, headBranch, options) => {
|
|
236927
236958
|
if ([
|
|
236928
236959
|
options.merge,
|
|
236929
236960
|
options.rebase,
|
|
@@ -236937,7 +236968,7 @@ pr.command("merge").description("Create the pull request if needed, then merge i
|
|
|
236937
236968
|
mergeMethod: options.merge ? "merge" : options.rebase ? "rebase" : options.squash ? "squash" : void 0
|
|
236938
236969
|
}));
|
|
236939
236970
|
});
|
|
236940
|
-
app.command("release").description("Create a GitHub release with AI-generated release notes.").argument("[tag]", "Release tag to create (asks when omitted).").option("--model <model>", "Model key from config to use (overrides the configured model).").option("-y, --yolo", "Create the release without asking for confirmation (requires a tag).").option("-f, --force", "Recreate the release without asking if it already exists.").option("--major", "Bump the major version of the latest release.").option("--minor", "Bump the minor version of the latest release.").option("--patch", "Bump the patch version of the latest release.").action((tag, options) => {
|
|
236971
|
+
app.command("release").description("Create a GitHub release with AI-generated release notes.").argument("[tag]", "Release tag to create (asks when omitted).").option("--model <model>", "Model key from config to use (overrides the configured model).").option("-y, --yolo", "Create the release without asking for confirmation (requires a tag).").option("-f, --force", "Recreate the release without asking if it already exists.").option("-e, --empty", "Create the release without any release notes.").option("--major", "Bump the major version of the latest release.").option("--minor", "Bump the minor version of the latest release.").option("--patch", "Bump the patch version of the latest release.").action((tag, options) => {
|
|
236941
236972
|
if ([
|
|
236942
236973
|
options.major,
|
|
236943
236974
|
options.minor,
|