feat(coding-agent): added jsonStringify helper and improved frontmatter error messages

- Added jsonStringify Handlebars helper to enable safe JSON serialization of template variables in frontmatter generation.
- Improved frontmatter parsing error messages to include source context, making debugging easier when YAML frontmatter parsing fails.
This commit is contained in:
can1357
2026-02-05 01:42:29 +01:00
parent 16ecbad940
commit 62ec0ba5bb
4 changed files with 12 additions and 7 deletions
+4 -1
View File
@@ -1,7 +1,6 @@
# Changelog
## [Unreleased]
### Added
- Added `task.maxConcurrency` setting to control concurrent limit for subagents (default: 32)
@@ -17,6 +16,10 @@
- Removed `MAX_PARALLEL_TASKS` constant and associated task count validation limit
### Fixed
- Improved frontmatter parsing error messages to include source context for better debugging
## [10.6.1] - 2026-02-04
### Added
@@ -226,6 +226,8 @@ handlebars.registerHelper("not", (value: unknown): boolean => !value);
handlebars.registerHelper("jtdToTypeScript", (schema: unknown): string => jtdToTypeScript(schema));
handlebars.registerHelper("jsonStringify", (value: unknown): string => JSON.stringify(value));
export function renderPromptTemplate(template: string, context: TemplateContext = {}): string {
const compiled = handlebars.compile(template, { noEscape: true, strict: false });
const rendered = compiled(context ?? {});
@@ -1,8 +1,8 @@
---
name: {{name}}
description: {{description}}
{{#if spawns}}spawns: {{spawns}}
{{/if}}{{#if model}}model: {{model}}
{{/if}}{{#if thinkingLevel}}thinkingLevel: {{thinkingLevel}}
name: {{jsonStringify name}}
description: {{jsonStringify description}}
{{#if spawns}}spawns: {{jsonStringify spawns}}
{{/if}}{{#if model}}model: {{jsonStringify model}}
{{/if}}{{#if thinkingLevel}}thinkingLevel: {{jsonStringify thinkingLevel}}
{{/if}}---
{{body}}
@@ -18,7 +18,7 @@ export class FrontmatterError extends Error {
error: Error,
public readonly source?: unknown,
) {
super(`Failed to parse YAML frontmatter: ${error.message}`, { cause: error });
super(`Failed to parse YAML frontmatter (${source}): ${error.message}`, { cause: error });
this.name = "FrontmatterError";
}