@ghl-ai/aw 0.1.36-beta.13 ā 0.1.36-beta.14
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 +24 -13
- package/git.mjs +19 -0
- package/package.json +1 -1
package/commands/push.mjs
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
isWorktree,
|
|
19
19
|
getLocalRegistryDir,
|
|
20
20
|
commitsAheadOfMain,
|
|
21
|
+
logAheadOfMain,
|
|
21
22
|
} from '../git.mjs';
|
|
22
23
|
|
|
23
24
|
const PUSHABLE_TYPES = ['agents', 'skills', 'commands', 'evals'];
|
|
@@ -55,8 +56,14 @@ function singular(type, count) {
|
|
|
55
56
|
return count === 1 ? s : `${s}s`;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
function generatePrTitle(files) {
|
|
59
|
-
if (files.length === 0)
|
|
59
|
+
function generatePrTitle(files, awHome = null) {
|
|
60
|
+
if (files.length === 0) {
|
|
61
|
+
const commits = awHome ? logAheadOfMain(awHome) : [];
|
|
62
|
+
const count = commits.length;
|
|
63
|
+
return count > 0
|
|
64
|
+
? `feat(registry): sync ${count} unpublished commit${count > 1 ? 's' : ''}`
|
|
65
|
+
: 'feat(registry): sync current state';
|
|
66
|
+
}
|
|
60
67
|
|
|
61
68
|
const namespaces = [...new Set(files.map(f => f.namespace))];
|
|
62
69
|
|
|
@@ -81,21 +88,25 @@ function generatePrTitle(files) {
|
|
|
81
88
|
return `feat(registry): ${verb} ${files.length} files across ${namespaces.length} namespaces`;
|
|
82
89
|
}
|
|
83
90
|
|
|
84
|
-
const AW_BRANDING = `---\
|
|
91
|
+
const AW_BRANDING = `---\nš¤ Generated by [AW CLI](https://github.com/GoHighLevel/ghl-agentic-workspace)`;
|
|
85
92
|
|
|
86
|
-
function generatePrBody(files, newNamespaces) {
|
|
93
|
+
function generatePrBody(files, newNamespaces, awHome = null) {
|
|
87
94
|
const added = files.filter(f => !f.deleted);
|
|
88
95
|
const deleted = files.filter(f => f.deleted);
|
|
89
96
|
const bodyParts = [];
|
|
90
97
|
|
|
91
98
|
if (files.length === 0) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
'
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
const commits = awHome ? logAheadOfMain(awHome) : [];
|
|
100
|
+
bodyParts.push('## Unpublished Commits', '');
|
|
101
|
+
if (commits.length > 0) {
|
|
102
|
+
bodyParts.push('| Commit | Message |', '|--------|---------|');
|
|
103
|
+
for (const c of commits) {
|
|
104
|
+
bodyParts.push(`| \`${c.hash}\` | ${c.message} |`);
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
bodyParts.push('Syncing current state to registry.');
|
|
108
|
+
}
|
|
109
|
+
bodyParts.push('', AW_BRANDING);
|
|
99
110
|
return bodyParts.join('\n');
|
|
100
111
|
}
|
|
101
112
|
|
|
@@ -321,8 +332,8 @@ function doPush(files, awHome, dryRun, worktreeFlow = false, preStaged = false)
|
|
|
321
332
|
}
|
|
322
333
|
|
|
323
334
|
const commitMsg = generateCommitMsg(files);
|
|
324
|
-
const prTitle = generatePrTitle(files);
|
|
325
|
-
const prBody = generatePrBody(files, newNamespaces);
|
|
335
|
+
const prTitle = generatePrTitle(files, awHome);
|
|
336
|
+
const prBody = generatePrBody(files, newNamespaces, awHome);
|
|
326
337
|
|
|
327
338
|
const s = fmt.spinner();
|
|
328
339
|
s.start('Committing and pushing...');
|
package/git.mjs
CHANGED
|
@@ -397,6 +397,25 @@ export function commitsAheadOfMain(awHome) {
|
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
+
/**
|
|
401
|
+
* Get one-line log of commits ahead of main.
|
|
402
|
+
* Returns array of { hash, message } objects.
|
|
403
|
+
*/
|
|
404
|
+
export function logAheadOfMain(awHome) {
|
|
405
|
+
try {
|
|
406
|
+
const out = execSync(
|
|
407
|
+
`git -C "${awHome}" log ${REGISTRY_BASE_BRANCH}..HEAD --oneline`,
|
|
408
|
+
{ stdio: 'pipe', encoding: 'utf8' },
|
|
409
|
+
);
|
|
410
|
+
return out.trim().split('\n').filter(Boolean).map(line => {
|
|
411
|
+
const spaceIdx = line.indexOf(' ');
|
|
412
|
+
return { hash: line.slice(0, spaceIdx), message: line.slice(spaceIdx + 1) };
|
|
413
|
+
});
|
|
414
|
+
} catch {
|
|
415
|
+
return [];
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
400
419
|
/**
|
|
401
420
|
* Get the current branch name in awHome.
|
|
402
421
|
*/
|