@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/cli.js
CHANGED
|
@@ -217,6 +217,26 @@ function renderFrontmatter(template, context, filename) {
|
|
|
217
217
|
return rendered;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
// src/utils/changelog.ts
|
|
221
|
+
var RE_VERSION_WITH_DATE = /^(\d+\.\d+\.\d+)\s*\((\d{4}-\d{2}-\d{2})\)\s*:/;
|
|
222
|
+
var RE_VERSION_ONLY = /^(\d+\.\d+\.\d+)\s*:/;
|
|
223
|
+
function resolveChangelogMeta(input) {
|
|
224
|
+
if (typeof input !== "string" || input.trim() === "") {
|
|
225
|
+
return void 0;
|
|
226
|
+
}
|
|
227
|
+
for (const line of input.split(/\r?\n/)) {
|
|
228
|
+
const withDate = RE_VERSION_WITH_DATE.exec(line);
|
|
229
|
+
if (withDate !== null) {
|
|
230
|
+
return { version: withDate[1], date: withDate[2] };
|
|
231
|
+
}
|
|
232
|
+
const versionOnly = RE_VERSION_ONLY.exec(line);
|
|
233
|
+
if (versionOnly !== null) {
|
|
234
|
+
return { version: versionOnly[1], date: "" };
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return void 0;
|
|
238
|
+
}
|
|
239
|
+
|
|
220
240
|
// src/targets/registry.ts
|
|
221
241
|
var TargetRegistry = class _TargetRegistry {
|
|
222
242
|
// Map preserves insertion order — names() and allDefinitions() are
|
|
@@ -374,7 +394,8 @@ async function buildAgentNameMap(config) {
|
|
|
374
394
|
const persona = await loadPersonaYaml(yamlPath);
|
|
375
395
|
const slug = typeof persona["slug"] === "string" ? persona["slug"] : path2.basename(yamlPath, ".yaml");
|
|
376
396
|
const name = typeof persona["name"] === "string" ? persona["name"] : slug;
|
|
377
|
-
const
|
|
397
|
+
const clMeta = resolveChangelogMeta(persona["changelog"]);
|
|
398
|
+
const version = clMeta?.version ?? defaultVersion;
|
|
378
399
|
const underscoredSlug = slug.replace(/-/g, "_");
|
|
379
400
|
const key = `agent_${underscoredSlug}`;
|
|
380
401
|
agentMap[key] = `${name} v${version}`;
|
|
@@ -394,7 +415,8 @@ function buildContext(options) {
|
|
|
394
415
|
configVariables,
|
|
395
416
|
suiteVariables
|
|
396
417
|
} = options;
|
|
397
|
-
const
|
|
418
|
+
const clMeta = resolveChangelogMeta(personaMeta["changelog"]);
|
|
419
|
+
const version = clMeta?.version ?? (typeof sharedMeta["default_version"] === "string" ? sharedMeta["default_version"] : "0.0.0");
|
|
398
420
|
const merged = {
|
|
399
421
|
...configVariables ?? {},
|
|
400
422
|
...suiteVariables ?? {},
|
|
@@ -402,6 +424,9 @@ function buildContext(options) {
|
|
|
402
424
|
...personaMeta,
|
|
403
425
|
version
|
|
404
426
|
};
|
|
427
|
+
if (!("last_updated" in merged)) {
|
|
428
|
+
merged["last_updated"] = clMeta?.date ?? "";
|
|
429
|
+
}
|
|
405
430
|
const tools = Array.isArray(merged["tools"]) ? merged["tools"] : [];
|
|
406
431
|
if (!("tools_list" in merged)) {
|
|
407
432
|
merged["tools_list"] = serializeToolsList(tools);
|