@ghl-ai/aw 0.1.36-beta.15 → 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 +27 -14
- package/package.json +1 -1
package/commands/push.mjs
CHANGED
|
@@ -56,25 +56,38 @@ function singular(type, count) {
|
|
|
56
56
|
return count === 1 ? s : `${s}s`;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return unique.length === 1 ? unique[0] : null;
|
|
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;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
function generatePrTitle(files, awHome = null) {
|
|
72
71
|
if (files.length === 0) {
|
|
73
72
|
const commits = awHome ? logAheadOfMain(awHome) : [];
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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}`;
|
|
78
91
|
}
|
|
79
92
|
|
|
80
93
|
const namespaces = [...new Set(files.map(f => f.namespace))];
|