@ghl-ai/aw 0.1.19 → 0.1.20
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/commands/push.mjs +25 -10
- package/package.json +1 -1
package/commands/push.mjs
CHANGED
|
@@ -113,7 +113,8 @@ export function pushCommand(args) {
|
|
|
113
113
|
const tempDir = mkdtempSync(join(tmpdir(), 'aw-upload-'));
|
|
114
114
|
|
|
115
115
|
try {
|
|
116
|
-
|
|
116
|
+
const repoUrl = repo.startsWith('http') ? repo : `https://github.com/${repo}.git`;
|
|
117
|
+
execSync(`git clone --filter=blob:none --no-checkout "${repoUrl}" "${tempDir}"`, { stdio: 'pipe' });
|
|
117
118
|
execSync(`git checkout ${REGISTRY_BASE_BRANCH}`, { cwd: tempDir, stdio: 'pipe' });
|
|
118
119
|
s.stop('Repository cloned');
|
|
119
120
|
|
|
@@ -178,20 +179,29 @@ export function pushCommand(args) {
|
|
|
178
179
|
|
|
179
180
|
const prTitle = `Add ${slug} (${parentDir}) to ${namespacePath}`;
|
|
180
181
|
const prBody = bodyParts.join('\n');
|
|
181
|
-
const prUrl = execFileSync('gh', [
|
|
182
|
-
'pr', 'create',
|
|
183
|
-
'--base', REGISTRY_BASE_BRANCH,
|
|
184
|
-
'--title', prTitle,
|
|
185
|
-
'--body', prBody,
|
|
186
|
-
], { cwd: tempDir, encoding: 'utf8' }).trim();
|
|
187
182
|
|
|
188
|
-
|
|
183
|
+
// Try gh for PR creation, fall back to manual URL
|
|
184
|
+
let prUrl;
|
|
185
|
+
try {
|
|
186
|
+
prUrl = execFileSync('gh', [
|
|
187
|
+
'pr', 'create',
|
|
188
|
+
'--base', REGISTRY_BASE_BRANCH,
|
|
189
|
+
'--title', prTitle,
|
|
190
|
+
'--body', prBody,
|
|
191
|
+
], { cwd: tempDir, encoding: 'utf8' }).trim();
|
|
192
|
+
} catch {
|
|
193
|
+
// gh not available — construct PR URL manually
|
|
194
|
+
const repoBase = repo.replace(/\.git$/, '');
|
|
195
|
+
prUrl = `https://github.com/${repoBase}/compare/${REGISTRY_BASE_BRANCH}...${branch}?expand=1`;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
s3.stop('Branch pushed');
|
|
189
199
|
|
|
190
200
|
if (newNamespace) {
|
|
191
201
|
fmt.logInfo(`New namespace ${chalk.cyan(topNamespace)} — CODEOWNERS entry added`);
|
|
192
202
|
}
|
|
193
203
|
fmt.logSuccess(`PR: ${chalk.cyan(prUrl)}`);
|
|
194
|
-
fmt.outro('Upload complete');
|
|
204
|
+
fmt.outro('Upload complete — open the link above to create the PR');
|
|
195
205
|
} catch (e) {
|
|
196
206
|
fmt.cancel(`Upload failed: ${e.message}`);
|
|
197
207
|
} finally {
|
|
@@ -200,10 +210,15 @@ export function pushCommand(args) {
|
|
|
200
210
|
}
|
|
201
211
|
|
|
202
212
|
function getGitHubUser() {
|
|
213
|
+
// Try gh first, fall back to git config
|
|
203
214
|
try {
|
|
204
215
|
return execSync('gh api user --jq .login', { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
205
216
|
} catch {
|
|
206
|
-
|
|
217
|
+
try {
|
|
218
|
+
return execSync('git config user.name', { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
219
|
+
} catch {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
207
222
|
}
|
|
208
223
|
}
|
|
209
224
|
|