nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] Custom command frontmatter: a value ending in ">" or "|" swallows the following keys

Open addyCooks opened this issue 2 weeks ago • 1 comments

Description

The hand-written frontmatter parser treats any line that ends with > or | as the start of a YAML block scalar. A description such as Render a <Component> ends with >, so the keys after it (aliases, parameters) are read as the description's text and the command loses them without any error.

Environment

  • OS: Windows 11 Home 10.0.26300
  • Node version: v22.22.3
  • Nanocoder version: 1.32.0 (built from main at 5df35b3a)
  • Provider: Not provider-specific
  • Model: Not model-specific

Steps to Reproduce

  1. Create a command file:

     ---
     description: Render a <Component>
     aliases: [rc]
     parameters: [name]
     ---
     Body {{name}}
    
  2. Run parseCommandFile(file).

Expected Behavior

description is Render a <Component>, aliases is ["rc"], parameters is ["name"].

Actual Behavior

description: "aliases: [rc]\nparameters: [name]"

Additional Context

  • [x] I have searched existing issues to ensure this is not a duplicate
  • [x] I can reproduce this issue consistently
  • [x] This issue occurs with the latest version of nanocoder (main)

Suggested fix:

  • source/custom-commands/parser.ts:97: only start a block scalar when the value after the colon is just | or > (optionally with +/- or a number), not when the line merely ends with one.
  • Add tests for Render a <Component> and a | b.

addyCooks avatar Nov 16 '26 09:11 addyCooks

I'd like to pick this one up. The plan is to treat | and > (and variants like |-, >+, |2) as a block scalar only when they are the whole value after the colon, with tests for an inline value ending in > or | and a check that a real description: > block still works.

dodoshell avatar Nov 16 '26 10:11 dodoshell