@mistralys/persona-builder 2.5.0 → 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 +7 -4
- package/dist/cli.cjs +31 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +31 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +32 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -2
- package/dist/index.d.ts +51 -2
- package/dist/index.js +32 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,7 +108,10 @@ MIT
|
|
|
108
108
|
## Release Workflow
|
|
109
109
|
|
|
110
110
|
1. Add changelog entries (do not change package.json version)
|
|
111
|
-
2.
|
|
112
|
-
3. `npm
|
|
113
|
-
4. `
|
|
114
|
-
5.
|
|
111
|
+
2. Commit all changes.
|
|
112
|
+
3. `npm run build`.
|
|
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
|
@@ -73,7 +73,10 @@ function resolveConditionals(text, context) {
|
|
|
73
73
|
|
|
74
74
|
// src/engine/variables.ts
|
|
75
75
|
function resolveVariables(text, context, filename) {
|
|
76
|
-
return text.replace(
|
|
76
|
+
return text.replace(/(\\?)\{\{(\w+)\}\}/g, (match, escape, varName) => {
|
|
77
|
+
if (escape === "\\") {
|
|
78
|
+
return `{{${varName}}}`;
|
|
79
|
+
}
|
|
77
80
|
if (varName in context && context[varName] !== void 0) {
|
|
78
81
|
return String(context[varName]);
|
|
79
82
|
}
|
|
@@ -222,6 +225,26 @@ function renderFrontmatter(template, context, filename) {
|
|
|
222
225
|
return rendered;
|
|
223
226
|
}
|
|
224
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
|
+
|
|
225
248
|
// src/targets/registry.ts
|
|
226
249
|
var TargetRegistry = class _TargetRegistry {
|
|
227
250
|
// Map preserves insertion order — names() and allDefinitions() are
|
|
@@ -379,7 +402,8 @@ async function buildAgentNameMap(config) {
|
|
|
379
402
|
const persona = await loadPersonaYaml(yamlPath);
|
|
380
403
|
const slug = typeof persona["slug"] === "string" ? persona["slug"] : path2__default.default.basename(yamlPath, ".yaml");
|
|
381
404
|
const name = typeof persona["name"] === "string" ? persona["name"] : slug;
|
|
382
|
-
const
|
|
405
|
+
const clMeta = resolveChangelogMeta(persona["changelog"]);
|
|
406
|
+
const version = clMeta?.version ?? defaultVersion;
|
|
383
407
|
const underscoredSlug = slug.replace(/-/g, "_");
|
|
384
408
|
const key = `agent_${underscoredSlug}`;
|
|
385
409
|
agentMap[key] = `${name} v${version}`;
|
|
@@ -399,7 +423,8 @@ function buildContext(options) {
|
|
|
399
423
|
configVariables,
|
|
400
424
|
suiteVariables
|
|
401
425
|
} = options;
|
|
402
|
-
const
|
|
426
|
+
const clMeta = resolveChangelogMeta(personaMeta["changelog"]);
|
|
427
|
+
const version = clMeta?.version ?? (typeof sharedMeta["default_version"] === "string" ? sharedMeta["default_version"] : "0.0.0");
|
|
403
428
|
const merged = {
|
|
404
429
|
...configVariables ?? {},
|
|
405
430
|
...suiteVariables ?? {},
|
|
@@ -407,6 +432,9 @@ function buildContext(options) {
|
|
|
407
432
|
...personaMeta,
|
|
408
433
|
version
|
|
409
434
|
};
|
|
435
|
+
if (!("last_updated" in merged)) {
|
|
436
|
+
merged["last_updated"] = clMeta?.date ?? "";
|
|
437
|
+
}
|
|
410
438
|
const tools = Array.isArray(merged["tools"]) ? merged["tools"] : [];
|
|
411
439
|
if (!("tools_list" in merged)) {
|
|
412
440
|
merged["tools_list"] = serializeToolsList(tools);
|