@theholocron/cli 5.1.3 → 5.1.5
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.mjs +18 -5
- package/dist/cli.mjs.map +1 -1
- package/package.json +5 -5
package/dist/cli.mjs
CHANGED
|
@@ -9704,7 +9704,10 @@ function workTitle(input) {
|
|
|
9704
9704
|
*/
|
|
9705
9705
|
/** The longest a commit subject or pull request title may be. */
|
|
9706
9706
|
const MAX_TITLE = 100;
|
|
9707
|
-
|
|
9707
|
+
/** The last resort, when neither `--base`, the provider nor the config names a branch. */
|
|
9708
|
+
const DEFAULT_BASE = "main";
|
|
9709
|
+
/** The prerelease branch: a `feat` or `fix` merged there publishes a prerelease. */
|
|
9710
|
+
const PRERELEASE_BASE = "alpha";
|
|
9708
9711
|
const WORKTREES = ".claude/worktrees";
|
|
9709
9712
|
const row$36 = (id, status, detail) => ({
|
|
9710
9713
|
id,
|
|
@@ -9749,8 +9752,7 @@ async function runStartWork(input) {
|
|
|
9749
9752
|
print("");
|
|
9750
9753
|
const key = input.issue.trim();
|
|
9751
9754
|
if (!key) return fail("issue", "the issue is empty");
|
|
9752
|
-
|
|
9753
|
-
if (!base) return fail("base", "--base is empty");
|
|
9755
|
+
if (input.base !== void 0 && !input.base.trim()) return fail("base", "--base is empty");
|
|
9754
9756
|
if (input.onePr && !input.spec) return fail("spec", "--one-pr needs --spec: it is one pull request for the spec and the code");
|
|
9755
9757
|
let spec;
|
|
9756
9758
|
if (input.spec) {
|
|
@@ -9790,6 +9792,15 @@ async function runStartWork(input) {
|
|
|
9790
9792
|
const issues = loader.get("issues");
|
|
9791
9793
|
const source = input.noPr ? void 0 : loader.get("source");
|
|
9792
9794
|
if (source && !source.createPullRequest) return fail("pull request", `the \`${source.providerName}\` provider cannot open a pull request (\`--no-pr\` skips it)`);
|
|
9795
|
+
const configBase = input.loaded.resolved.repo?.defaultBranch?.trim() || void 0;
|
|
9796
|
+
let providerBase;
|
|
9797
|
+
let baseProblem;
|
|
9798
|
+
if (input.base === void 0 && source?.getRepo) try {
|
|
9799
|
+
providerBase = (await source.getRepo()).defaultBranch.trim() || void 0;
|
|
9800
|
+
} catch (err) {
|
|
9801
|
+
baseProblem = `could not read the default branch from \`${source.providerName}\`: ${describeError(err)}`;
|
|
9802
|
+
}
|
|
9803
|
+
const base = (input.base ?? providerBase ?? configBase ?? DEFAULT_BASE).trim();
|
|
9793
9804
|
let issue;
|
|
9794
9805
|
let record;
|
|
9795
9806
|
try {
|
|
@@ -9799,6 +9810,8 @@ async function runStartWork(input) {
|
|
|
9799
9810
|
return fail(key, `could not read the issue: ${describeError(err)}`);
|
|
9800
9811
|
}
|
|
9801
9812
|
rows.push(row$36(key, "ok", `${issue.summary} (${issue.status})`));
|
|
9813
|
+
if (providerBase && configBase && providerBase !== configBase) rows.push(row$36("base", "skip", `the config says \`${configBase}\` but \`${source?.providerName}\` says the default branch is \`${providerBase}\`; using \`${providerBase}\` (fix \`repo.defaultBranch\`)`));
|
|
9814
|
+
else if (baseProblem) rows.push(row$36("base", "skip", `${baseProblem}; using \`${base}\``));
|
|
9802
9815
|
const named = workTitle({
|
|
9803
9816
|
issueTitle: issue.summary,
|
|
9804
9817
|
...input.kind ? {
|
|
@@ -9833,7 +9846,7 @@ async function runStartWork(input) {
|
|
|
9833
9846
|
title
|
|
9834
9847
|
};
|
|
9835
9848
|
const commitSubject = spec ? `docs(specs): add the spec for ${named.subject}`.slice(0, MAX_TITLE) : title;
|
|
9836
|
-
const releaseNote = (named.type === "feat" || named.type === "fix") && base ===
|
|
9849
|
+
const releaseNote = (named.type === "feat" || named.type === "fix") && base === PRERELEASE_BASE ? `; a ${named.type} to ${base} publishes a prerelease` : "";
|
|
9837
9850
|
const summary = [
|
|
9838
9851
|
`branch ${branch}${branchExists ? " (exists)" : ""}`,
|
|
9839
9852
|
useWorktree ? `worktree ${relative(root, wtPath) || wtPath}` : "no worktree",
|
|
@@ -41002,7 +41015,7 @@ const startWorkCommand = {
|
|
|
41002
41015
|
describe: "The pull request's title, a Conventional Commit line (default: made from the issue)"
|
|
41003
41016
|
}).option("base", {
|
|
41004
41017
|
type: "string",
|
|
41005
|
-
describe: "The branch to start from and merge into (default: repo.defaultBranch)"
|
|
41018
|
+
describe: "The branch to start from and merge into (default: the source provider's default branch, else repo.defaultBranch)"
|
|
41006
41019
|
}).option("worktree", {
|
|
41007
41020
|
type: "boolean",
|
|
41008
41021
|
default: true,
|