Skip to content

An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others.

chore: fix tag-extension and improve debugging (#1074)

Ralph Khreishe0d1d03f333d
diff --git a/.github/scripts/tag-extension.mjs b/.github/scripts/tag-extension.mjs
index f1623285..ee723ce3 100644
--- a/.github/scripts/tag-extension.mjs
+++ b/.github/scripts/tag-extension.mjs
@@ -62,13 +62,47 @@ assert(rootPkg.repository, 'root package.json must have a repository field');
const tag = `${pkg.name}@${pkg.version}`;
// Get repository URL from root package.json
-const repoUrl = rootPkg.repository.url;
-
-const { status, stdout, error } = spawnSync('git', ['ls-remote', repoUrl, tag]);
+// Get repository URL and clean it up for git ls-remote
+let repoUrl = rootPkg.repository.url || rootPkg.repository;
+if (typeof repoUrl === 'string') {
+ // Convert git+https://github.com/... to https://github.com/...
+ repoUrl = repoUrl.replace(/^git\+/, '');
+ // Ensure it ends with .git for proper remote access
+ if (!repoUrl.endsWith('.git')) {
+ repoUrl += '.git';
+ }
+}
-assert.equal(status, 0, error);
+console.log(`Checking remote repository: ${repoUrl} for tag: ${tag}`);
+
+let gitResult = spawnSync('git', ['ls-remote', repoUrl, tag], {
+ encoding: 'utf8',
+ env: { ...process.env }
+});
+
+if (gitResult.status !== 0) {
+ console.error('Git ls-remote failed:');
+ console.error('Exit code:', gitResult.status);
+ console.error('Error:', gitResult.error);
+ console.error('Stderr:', gitResult.stderr);
+ console.error('Command:', `git ls-remote ${repoUrl} ${tag}`);
+
+ // For CI environments, try using origin instead of the full URL
+ if (process.env.CI) {
+ console.log('Retrying with origin remote...');
+ gitResult = spawnSync('git', ['ls-remote', 'origin', tag], {
+ encoding: 'utf8'
+ });
+
+ if (gitResult.status !== 0) {
+ throw new Error(`Failed to check remote for tag ${tag}. Exit code: ${gitResult.status}`);
+ }
+ } else {
+ throw new Error(`Failed to check remote for tag ${tag}. Exit code: ${gitResult.status}`);
+ }
+}
-const exists = String(stdout).trim() !== '';
+const exists = String(gitResult.stdout).trim() !== '';
if (!exists) {
console.log(`Creating new extension tag: ${tag}`);