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:
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user