@logickernel/agileflow 0.15.1 → 0.16.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logickernel/agileflow",
3
- "version": "0.15.1",
3
+ "version": "0.16.0",
4
4
  "description": "Automatic semantic versioning and changelog generation based on conventional commits",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/git-push.js CHANGED
@@ -14,8 +14,9 @@ const os = require('os');
14
14
  * @param {boolean} quiet - If true, suppress success message
15
15
  * @returns {Promise<void>}
16
16
  */
17
- async function pushTag(tagName, message, quiet = false) {
17
+ async function pushTag(tagName, message, quiet = false, remote = 'origin') {
18
18
  const safeTag = String(tagName).replace(/"/g, '\\"');
19
+ const safeRemote = String(remote).replace(/"/g, '\\"');
19
20
 
20
21
  // Write message to a temp file to avoid shell escaping issues with special characters
21
22
  const tempFile = path.join(os.tmpdir(), `agileflow-tag-${crypto.randomBytes(8).toString('hex')}.txt`);
@@ -25,8 +26,8 @@ async function pushTag(tagName, message, quiet = false) {
25
26
  // Create annotated tag using -F to read message from file
26
27
  execSync(`git tag -a "${safeTag}" -F "${tempFile}"`, { stdio: 'pipe' });
27
28
 
28
- // Push to origin
29
- execSync(`git push origin "${safeTag}"`, { stdio: 'pipe' });
29
+ // Push to remote
30
+ execSync(`git push "${safeRemote}" "${safeTag}"`, { stdio: 'pipe' });
30
31
 
31
32
  if (!quiet) {
32
33
  console.log(`Tag ${tagName} created and pushed successfully.`);
@@ -130,7 +130,7 @@ function makeRequest({ method, path, accessToken, body }) {
130
130
  * @param {boolean} quiet - If true, suppress success message
131
131
  * @returns {Promise<void>}
132
132
  */
133
- async function pushTag(tagName, message, quiet = false) {
133
+ async function pushTag(tagName, message, quiet = false, remote = 'origin') {
134
134
  const accessToken = process.env.AGILEFLOW_TOKEN;
135
135
  const repository = process.env.GITHUB_REPOSITORY;
136
136
  const commitSha = process.env.GITHUB_SHA;
@@ -96,7 +96,7 @@ function createTagViaAPI(tagName, message, projectPath, serverHost, accessToken,
96
96
  * @param {string} message - The tag message
97
97
  * @returns {Promise<void>}
98
98
  */
99
- async function pushTag(tagName, message, quiet = false) {
99
+ async function pushTag(tagName, message, quiet = false, remote = 'origin') {
100
100
  const accessToken = process.env.AGILEFLOW_TOKEN;
101
101
  const serverHost = process.env.CI_SERVER_HOST;
102
102
  const projectPath = process.env.CI_PROJECT_PATH;
package/src/index.js CHANGED
@@ -12,7 +12,7 @@ Usage:
12
12
 
13
13
  Commands:
14
14
  <none> Prints the current version, next version, commits, and changelog
15
- push Push a semantic version tag to the remote repository
15
+ push [remote] Push a semantic version tag to the remote repository (default: origin)
16
16
  gitlab Create a semantic version tag via GitLab API (for GitLab CI)
17
17
  github Create a semantic version tag via GitHub API (for GitHub Actions)
18
18
 
@@ -93,7 +93,7 @@ function displayVersionInfo(info, quiet) {
93
93
  * @param {string} pushType - 'push', 'gitlab', or 'github'
94
94
  * @param {{quiet: boolean}} options
95
95
  */
96
- async function handlePushCommand(pushType, options) {
96
+ async function handlePushCommand(pushType, options, remote = 'origin') {
97
97
  const info = await processVersionInfo();
98
98
 
99
99
  // Display version info
@@ -125,7 +125,7 @@ async function handlePushCommand(pushType, options) {
125
125
  console.log(`\nCreating tag ${info.newVersion}...`);
126
126
  }
127
127
 
128
- await pushModule.pushTag(info.newVersion, tagMessage, options.quiet);
128
+ await pushModule.pushTag(info.newVersion, tagMessage, options.quiet, remote);
129
129
  }
130
130
 
131
131
  async function main() {
@@ -156,7 +156,8 @@ async function main() {
156
156
 
157
157
  // Handle push commands
158
158
  if (cmd === 'push' || cmd === 'gitlab' || cmd === 'github') {
159
- await handlePushCommand(cmd, options);
159
+ const remote = rest.find(arg => !arg.startsWith('-')) || 'origin';
160
+ await handlePushCommand(cmd, options, remote);
160
161
  return;
161
162
  }
162
163
 
package/src/utils.js CHANGED
@@ -413,7 +413,12 @@ function getAllBranchCommits(branch) {
413
413
  try {
414
414
  resolvedSha = runWithOutput(`git rev-parse --verify -- origin/${branch}`).trim();
415
415
  } catch {
416
- return [];
416
+ // Last resort: use HEAD (detached HEAD in CI where remote tracking isn't set up)
417
+ try {
418
+ resolvedSha = runWithOutput('git rev-parse HEAD').trim();
419
+ } catch {
420
+ return [];
421
+ }
417
422
  }
418
423
  }
419
424