@ghl-ai/aw 0.1.36-beta.14 → 0.1.36-beta.16
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 +31 -7
- package/package.json +1 -1
package/commands/push.mjs
CHANGED
|
@@ -56,13 +56,38 @@ function singular(type, count) {
|
|
|
56
56
|
return count === 1 ? s : `${s}s`;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
// Parse commit messages like "registry: add agents/new-dev to revex/courses/backend"
|
|
60
|
+
// into structured { verb, type, slug, namespace } objects.
|
|
61
|
+
function parseCommitFiles(commits) {
|
|
62
|
+
const result = [];
|
|
63
|
+
for (const c of commits) {
|
|
64
|
+
const m = c.message.match(/registry:\s+(add|remove|sync)\s+(agents|skills|commands|evals)\/([\w-]+)\s+(?:to|from)\s+([\w/]+)/);
|
|
65
|
+
if (m) result.push({ verb: m[1], type: m[2], slug: m[3], namespace: m[4] });
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
|
|
59
70
|
function generatePrTitle(files, awHome = null) {
|
|
60
71
|
if (files.length === 0) {
|
|
61
72
|
const commits = awHome ? logAheadOfMain(awHome) : [];
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
const parsed = parseCommitFiles(commits);
|
|
74
|
+
|
|
75
|
+
if (parsed.length === 0) return 'feat(registry): push local changes';
|
|
76
|
+
|
|
77
|
+
const namespaces = [...new Set(parsed.map(p => p.namespace))];
|
|
78
|
+
const ns = namespaces.length === 1 ? namespaces[0] : 'registry';
|
|
79
|
+
|
|
80
|
+
if (parsed.length === 1) {
|
|
81
|
+
const p = parsed[0];
|
|
82
|
+
const verb = p.verb === 'remove' ? 'remove' : 'update';
|
|
83
|
+
return `feat(${ns}): ${verb} ${p.slug} ${TYPE_SINGULAR[p.type] ?? p.type}`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const byType = groupBy(parsed, 'type');
|
|
87
|
+
const summary = Object.entries(byType)
|
|
88
|
+
.map(([t, items]) => `${items.length} ${singular(t, items.length)}`)
|
|
89
|
+
.join(', ');
|
|
90
|
+
return `feat(${ns}): sync ${summary}`;
|
|
66
91
|
}
|
|
67
92
|
|
|
68
93
|
const namespaces = [...new Set(files.map(f => f.namespace))];
|
|
@@ -97,11 +122,10 @@ function generatePrBody(files, newNamespaces, awHome = null) {
|
|
|
97
122
|
|
|
98
123
|
if (files.length === 0) {
|
|
99
124
|
const commits = awHome ? logAheadOfMain(awHome) : [];
|
|
100
|
-
bodyParts.push('##
|
|
125
|
+
bodyParts.push('## What\'s included', '');
|
|
101
126
|
if (commits.length > 0) {
|
|
102
|
-
bodyParts.push('| Commit | Message |', '|--------|---------|');
|
|
103
127
|
for (const c of commits) {
|
|
104
|
-
bodyParts.push(
|
|
128
|
+
bodyParts.push(`- \`${c.hash}\` ${c.message}`);
|
|
105
129
|
}
|
|
106
130
|
} else {
|
|
107
131
|
bodyParts.push('Syncing current state to registry.');
|