@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 CHANGED
@@ -110,7 +110,8 @@ MIT
110
110
  1. Add changelog entries (do not change package.json version)
111
111
  2. Commit all changes.
112
112
  3. `npm run build`.
113
- 4. `npm version 0.0.0` - Updates package and lock versions + commit
114
- 5. `npm publish` - Publish version on NPM
115
- 6. `git push origin 0.0.0` - Add the tag in GIT
116
- 7. Add the release on Github
113
+ 4. `npm login` if necessary.
114
+ 5. `npm version 0.0.0` - Updates package and lock versions + commit.
115
+ 6. `npm publish` - Publish on NPM.
116
+ 7. `git push origin v0.0.0` - Add the tag in GIT (note the `v`).
117
+ 8. Add the release on Github
package/dist/cli.cjs CHANGED
@@ -225,6 +225,26 @@ function renderFrontmatter(template, context, filename) {
225
225
  return rendered;
226
226
  }
227
227
 
228
+ // src/utils/changelog.ts
229
+ var RE_VERSION_WITH_DATE = /^(\d+\.\d+\.\d+)\s*\((\d{4}-\d{2}-\d{2})\)\s*:/;
230
+ var RE_VERSION_ONLY = /^(\d+\.\d+\.\d+)\s*:/;
231
+ function resolveChangelogMeta(input) {
232
+ if (typeof input !== "string" || input.trim() === "") {
233
+ return void 0;
234
+ }
235
+ for (const line of input.split(/\r?\n/)) {
236
+ const withDate = RE_VERSION_WITH_DATE.exec(line);
237
+ if (withDate !== null) {
238
+ return { version: withDate[1], date: withDate[2] };
239
+ }
240
+ const versionOnly = RE_VERSION_ONLY.exec(line);
241
+ if (versionOnly !== null) {
242
+ return { version: versionOnly[1], date: "" };
243
+ }
244
+ }
245
+ return void 0;
246
+ }
247
+
228
248
  // src/targets/registry.ts
229
249
  var TargetRegistry = class _TargetRegistry {
230
250
  // Map preserves insertion order — names() and allDefinitions() are
@@ -382,7 +402,8 @@ async function buildAgentNameMap(config) {
382
402
  const persona = await loadPersonaYaml(yamlPath);
383
403
  const slug = typeof persona["slug"] === "string" ? persona["slug"] : path2__default.default.basename(yamlPath, ".yaml");
384
404
  const name = typeof persona["name"] === "string" ? persona["name"] : slug;
385
- const version = typeof persona["version"] === "string" ? persona["version"] : defaultVersion;
405
+ const clMeta = resolveChangelogMeta(persona["changelog"]);
406
+ const version = clMeta?.version ?? defaultVersion;
386
407
  const underscoredSlug = slug.replace(/-/g, "_");
387
408
  const key = `agent_${underscoredSlug}`;
388
409
  agentMap[key] = `${name} v${version}`;
@@ -402,7 +423,8 @@ function buildContext(options) {
402
423
  configVariables,
403
424
  suiteVariables
404
425
  } = options;
405
- const version = typeof personaMeta["version"] === "string" ? personaMeta["version"] : typeof sharedMeta["default_version"] === "string" ? sharedMeta["default_version"] : "0.0.0";
426
+ const clMeta = resolveChangelogMeta(personaMeta["changelog"]);
427
+ const version = clMeta?.version ?? (typeof sharedMeta["default_version"] === "string" ? sharedMeta["default_version"] : "0.0.0");
406
428
  const merged = {
407
429
  ...configVariables ?? {},
408
430
  ...suiteVariables ?? {},
@@ -410,6 +432,9 @@ function buildContext(options) {
410
432
  ...personaMeta,
411
433
  version
412
434
  };
435
+ if (!("last_updated" in merged)) {
436
+ merged["last_updated"] = clMeta?.date ?? "";
437
+ }
413
438
  const tools = Array.isArray(merged["tools"]) ? merged["tools"] : [];
414
439
  if (!("tools_list" in merged)) {
415
440
  merged["tools_list"] = serializeToolsList(tools);