fix: strip handoffs frontmatter and replace $ARGUMENTS for forgecode

The forgecode agent hangs when listing commands because the 'handoffs'
frontmatter field (a Claude Code-specific feature) contains 'send: true'
entries that forge tries to act on when indexing .forge/commands/ files.

Additionally, $ARGUMENTS in command bodies was never replaced with
{{parameters}}, so user input was not passed through to commands.

Python path (agents.py):
- Add strip_frontmatter_keys: [handoffs] to the forgecode AGENT_CONFIG
  entry so register_commands drops the key before rendering

Bash path (create-release-packages.sh):
- Add extra_strip_key parameter to generate_commands; pass 'handoffs'
  for the forgecode case in build_variant
- Use regex prefix match (~ "^"extra_key":") instead of exact
  equality to handle trailing whitespace after the YAML key
- Add sed replacement of $ARGUMENTS -> $arg_format in the body
  pipeline so {{parameters}} is substituted in forgecode command files
This commit is contained in:
ericnoam
2026-03-30 21:07:20 +02:00
parent 268e9832f3
commit d83be82052
2 changed files with 12 additions and 7 deletions

View File

@@ -167,7 +167,8 @@ class CommandRegistrar:
"dir": ".forge/commands",
"format": "markdown",
"args": "{{parameters}}",
"extension": ".md"
"extension": ".md",
"strip_frontmatter_keys": ["handoffs"],
}
}
@@ -503,6 +504,9 @@ class CommandRegistrar:
frontmatter = self._adjust_script_paths(frontmatter)
for key in agent_config.get("strip_frontmatter_keys", []):
frontmatter.pop(key, None)
body = self._convert_argument_placeholder(
body, "$ARGUMENTS", agent_config["args"]
)