@mistralys/persona-builder 2.5.1 → 2.6.0
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/README.md +5 -4
- package/dist/cli.cjs +27 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +27 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +28 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -1
- package/dist/index.d.ts +46 -1
- package/dist/index.js +28 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -251,6 +251,26 @@ function renderFrontmatter(template, context, filename) {
|
|
|
251
251
|
return rendered;
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
+
// src/utils/changelog.ts
|
|
255
|
+
var RE_VERSION_WITH_DATE = /^(\d+\.\d+\.\d+)\s*\((\d{4}-\d{2}-\d{2})\)\s*:/;
|
|
256
|
+
var RE_VERSION_ONLY = /^(\d+\.\d+\.\d+)\s*:/;
|
|
257
|
+
function resolveChangelogMeta(input) {
|
|
258
|
+
if (typeof input !== "string" || input.trim() === "") {
|
|
259
|
+
return void 0;
|
|
260
|
+
}
|
|
261
|
+
for (const line of input.split(/\r?\n/)) {
|
|
262
|
+
const withDate = RE_VERSION_WITH_DATE.exec(line);
|
|
263
|
+
if (withDate !== null) {
|
|
264
|
+
return { version: withDate[1], date: withDate[2] };
|
|
265
|
+
}
|
|
266
|
+
const versionOnly = RE_VERSION_ONLY.exec(line);
|
|
267
|
+
if (versionOnly !== null) {
|
|
268
|
+
return { version: versionOnly[1], date: "" };
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return void 0;
|
|
272
|
+
}
|
|
273
|
+
|
|
254
274
|
// src/targets/registry.ts
|
|
255
275
|
var TargetRegistry = class _TargetRegistry {
|
|
256
276
|
// Map preserves insertion order — names() and allDefinitions() are
|
|
@@ -408,7 +428,8 @@ async function buildAgentNameMap(config) {
|
|
|
408
428
|
const persona = await loadPersonaYaml(yamlPath);
|
|
409
429
|
const slug = typeof persona["slug"] === "string" ? persona["slug"] : path4__default.default.basename(yamlPath, ".yaml");
|
|
410
430
|
const name = typeof persona["name"] === "string" ? persona["name"] : slug;
|
|
411
|
-
const
|
|
431
|
+
const clMeta = resolveChangelogMeta(persona["changelog"]);
|
|
432
|
+
const version = clMeta?.version ?? defaultVersion;
|
|
412
433
|
const underscoredSlug = slug.replace(/-/g, "_");
|
|
413
434
|
const key = `agent_${underscoredSlug}`;
|
|
414
435
|
agentMap[key] = `${name} v${version}`;
|
|
@@ -428,7 +449,8 @@ function buildContext(options) {
|
|
|
428
449
|
configVariables,
|
|
429
450
|
suiteVariables
|
|
430
451
|
} = options;
|
|
431
|
-
const
|
|
452
|
+
const clMeta = resolveChangelogMeta(personaMeta["changelog"]);
|
|
453
|
+
const version = clMeta?.version ?? (typeof sharedMeta["default_version"] === "string" ? sharedMeta["default_version"] : "0.0.0");
|
|
432
454
|
const merged = {
|
|
433
455
|
...configVariables ?? {},
|
|
434
456
|
...suiteVariables ?? {},
|
|
@@ -436,6 +458,9 @@ function buildContext(options) {
|
|
|
436
458
|
...personaMeta,
|
|
437
459
|
version
|
|
438
460
|
};
|
|
461
|
+
if (!("last_updated" in merged)) {
|
|
462
|
+
merged["last_updated"] = clMeta?.date ?? "";
|
|
463
|
+
}
|
|
439
464
|
const tools = Array.isArray(merged["tools"]) ? merged["tools"] : [];
|
|
440
465
|
if (!("tools_list" in merged)) {
|
|
441
466
|
merged["tools_list"] = serializeToolsList(tools);
|
|
@@ -723,6 +748,7 @@ exports.loadMetadata = loadMetadata;
|
|
|
723
748
|
exports.loadPartials = loadPartials;
|
|
724
749
|
exports.normalizeNewlines = normalizeNewlines;
|
|
725
750
|
exports.renderFrontmatter = renderFrontmatter;
|
|
751
|
+
exports.resolveChangelogMeta = resolveChangelogMeta;
|
|
726
752
|
exports.resolveConditionals = resolveConditionals;
|
|
727
753
|
exports.resolveFrontmatterTemplate = resolveFrontmatterTemplate;
|
|
728
754
|
exports.resolvePartials = resolvePartials;
|