edsger 0.21.1 → 0.21.2
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.
|
@@ -5,6 +5,19 @@
|
|
|
5
5
|
import { Octokit } from '@octokit/rest';
|
|
6
6
|
import { execSync } from 'child_process';
|
|
7
7
|
import { logInfo, logError } from '../../utils/logger.js';
|
|
8
|
+
// GitHub PR title best practice: keep under 72 characters
|
|
9
|
+
const MAX_PR_TITLE_LENGTH = 72;
|
|
10
|
+
const PR_TITLE_PREFIX = 'feat: ';
|
|
11
|
+
const MAX_FEATURE_NAME_LENGTH = MAX_PR_TITLE_LENGTH - PR_TITLE_PREFIX.length;
|
|
12
|
+
/**
|
|
13
|
+
* Truncate text to a maximum length, adding ellipsis if truncated
|
|
14
|
+
*/
|
|
15
|
+
function truncateText(text, maxLength) {
|
|
16
|
+
if (text.length <= maxLength) {
|
|
17
|
+
return text;
|
|
18
|
+
}
|
|
19
|
+
return text.slice(0, maxLength - 3) + '...';
|
|
20
|
+
}
|
|
8
21
|
/**
|
|
9
22
|
* Convert a feat/ branch name to a dev/ branch name
|
|
10
23
|
* e.g., "feat/abc123/1-database" -> "dev/abc123/1-database"
|
|
@@ -142,8 +155,9 @@ export async function createBranchPullRequest(config, devBranchName, featureName
|
|
|
142
155
|
pullRequestNumber: existingPR.number,
|
|
143
156
|
};
|
|
144
157
|
}
|
|
145
|
-
// Generate PR title and body
|
|
146
|
-
const
|
|
158
|
+
// Generate PR title and body (truncate to keep under 72 chars)
|
|
159
|
+
const truncatedName = truncateText(featureName, MAX_FEATURE_NAME_LENGTH);
|
|
160
|
+
const title = `${PR_TITLE_PREFIX}${truncatedName}`;
|
|
147
161
|
const body = `## Branch Implementation
|
|
148
162
|
|
|
149
163
|
${branchDescription}
|
|
@@ -10,6 +10,16 @@ import { prepareCustomBranchGitEnvironment, syncFeatBranchWithMain, } from '../.
|
|
|
10
10
|
import { getCurrentBranch, updateBranch, getBranches, createBranches, getBaseBranchInfo, } from '../../services/branches.js';
|
|
11
11
|
import { createBranchPullRequest, } from './branch-pr-creator.js';
|
|
12
12
|
import { getGitHubConfig } from '../../api/github.js';
|
|
13
|
+
import { getFeature } from '../../api/features/index.js';
|
|
14
|
+
/**
|
|
15
|
+
* Truncate text to a maximum length, adding ellipsis if truncated
|
|
16
|
+
*/
|
|
17
|
+
function truncateText(text, maxLength) {
|
|
18
|
+
if (text.length <= maxLength) {
|
|
19
|
+
return text;
|
|
20
|
+
}
|
|
21
|
+
return text.slice(0, maxLength - 3) + '...';
|
|
22
|
+
}
|
|
13
23
|
function userMessage(content) {
|
|
14
24
|
return {
|
|
15
25
|
type: 'user',
|
|
@@ -50,11 +60,25 @@ export const implementFeatureCode = async (options, config, checklistContext) =>
|
|
|
50
60
|
if (verbose) {
|
|
51
61
|
logInfo(`📋 Creating default branch record for feature: ${featureId}`);
|
|
52
62
|
}
|
|
63
|
+
// Fetch feature info to get the feature name for branch naming
|
|
64
|
+
let featureName = 'Feature Implementation';
|
|
65
|
+
try {
|
|
66
|
+
const featureInfo = await getFeature(featureId, verbose);
|
|
67
|
+
if (featureInfo?.name) {
|
|
68
|
+
// Truncate feature name for branch display (max 100 chars)
|
|
69
|
+
featureName = truncateText(featureInfo.name, 100);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (verbose) {
|
|
74
|
+
logInfo(`Could not fetch feature name, using default: ${error}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
53
77
|
const defaultBranchName = `dev/${featureId}`;
|
|
54
78
|
const createdBranches = await createBranches({ featureId, verbose }, [
|
|
55
79
|
{
|
|
56
|
-
name:
|
|
57
|
-
description:
|
|
80
|
+
name: featureName,
|
|
81
|
+
description: `Implementation branch for: ${featureName}`,
|
|
58
82
|
branch_name: defaultBranchName,
|
|
59
83
|
status: 'pending',
|
|
60
84
|
},
|
|
@@ -4,6 +4,19 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Octokit } from '@octokit/rest';
|
|
6
6
|
import { execSync } from 'child_process';
|
|
7
|
+
// GitHub PR title best practice: keep under 72 characters
|
|
8
|
+
const MAX_PR_TITLE_LENGTH = 72;
|
|
9
|
+
const PR_TITLE_PREFIX = 'feat: ';
|
|
10
|
+
const MAX_FEATURE_NAME_LENGTH = MAX_PR_TITLE_LENGTH - PR_TITLE_PREFIX.length;
|
|
11
|
+
/**
|
|
12
|
+
* Truncate text to a maximum length, adding ellipsis if truncated
|
|
13
|
+
*/
|
|
14
|
+
function truncateText(text, maxLength) {
|
|
15
|
+
if (text.length <= maxLength) {
|
|
16
|
+
return text;
|
|
17
|
+
}
|
|
18
|
+
return text.slice(0, maxLength - 3) + '...';
|
|
19
|
+
}
|
|
7
20
|
/**
|
|
8
21
|
* Get current Git branch name
|
|
9
22
|
*/
|
|
@@ -108,12 +121,14 @@ const switchToMainBranch = (mainBranch = 'main', verbose) => {
|
|
|
108
121
|
};
|
|
109
122
|
/**
|
|
110
123
|
* Generate pull request title from feature name
|
|
124
|
+
* Truncates to keep under 72 characters (GitHub best practice)
|
|
111
125
|
*/
|
|
112
126
|
const generatePRTitle = (featureName) => {
|
|
113
127
|
// Remove feature ID prefix if present (e.g., "FEAT-123: Feature Name" -> "Feature Name")
|
|
114
128
|
const cleanName = featureName.replace(/^[A-Z]+-\d+:\s*/, '');
|
|
115
|
-
//
|
|
116
|
-
|
|
129
|
+
// Truncate to keep total title under 72 chars
|
|
130
|
+
const truncatedName = truncateText(cleanName.toLowerCase(), MAX_FEATURE_NAME_LENGTH);
|
|
131
|
+
return `${PR_TITLE_PREFIX}${truncatedName}`;
|
|
117
132
|
};
|
|
118
133
|
/**
|
|
119
134
|
* Check if a pull request already exists from head to base
|