@ghl-ai/aw 0.1.36-beta.14 → 0.1.36-beta.15
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 +18 -7
- package/package.json +1 -1
package/commands/push.mjs
CHANGED
|
@@ -56,13 +56,25 @@ function singular(type, count) {
|
|
|
56
56
|
return count === 1 ? s : `${s}s`;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
function extractNamespaceFromCommits(commits) {
|
|
60
|
+
// Try to extract a common namespace from commit messages like
|
|
61
|
+
// "registry: add agents/foo to revex/courses/backend"
|
|
62
|
+
const matches = commits
|
|
63
|
+
.map(c => c.message.match(/\bto\s+([\w/]+)$/))
|
|
64
|
+
.filter(Boolean)
|
|
65
|
+
.map(m => m[1]);
|
|
66
|
+
if (matches.length === 0) return null;
|
|
67
|
+
const unique = [...new Set(matches)];
|
|
68
|
+
return unique.length === 1 ? unique[0] : null;
|
|
69
|
+
}
|
|
70
|
+
|
|
59
71
|
function generatePrTitle(files, awHome = null) {
|
|
60
72
|
if (files.length === 0) {
|
|
61
73
|
const commits = awHome ? logAheadOfMain(awHome) : [];
|
|
62
|
-
const
|
|
63
|
-
return
|
|
64
|
-
? `feat(
|
|
65
|
-
: 'feat(registry):
|
|
74
|
+
const ns = extractNamespaceFromCommits(commits);
|
|
75
|
+
return ns
|
|
76
|
+
? `feat(${ns}): push local changes`
|
|
77
|
+
: 'feat(registry): push local changes';
|
|
66
78
|
}
|
|
67
79
|
|
|
68
80
|
const namespaces = [...new Set(files.map(f => f.namespace))];
|
|
@@ -97,11 +109,10 @@ function generatePrBody(files, newNamespaces, awHome = null) {
|
|
|
97
109
|
|
|
98
110
|
if (files.length === 0) {
|
|
99
111
|
const commits = awHome ? logAheadOfMain(awHome) : [];
|
|
100
|
-
bodyParts.push('##
|
|
112
|
+
bodyParts.push('## What\'s included', '');
|
|
101
113
|
if (commits.length > 0) {
|
|
102
|
-
bodyParts.push('| Commit | Message |', '|--------|---------|');
|
|
103
114
|
for (const c of commits) {
|
|
104
|
-
bodyParts.push(
|
|
115
|
+
bodyParts.push(`- \`${c.hash}\` ${c.message}`);
|
|
105
116
|
}
|
|
106
117
|
} else {
|
|
107
118
|
bodyParts.push('Syncing current state to registry.');
|