(self, plugin: PluginSource, cmd: CommandSource, result: EmitResult)
| 246 | result.written.append(self.write(rel, content)) |
| 247 | |
| 248 | def _emit_command(self, plugin: PluginSource, cmd: CommandSource, result: EmitResult) -> None: |
| 249 | cmd_id = f"{plugin.name}__{cmd.name}" |
| 250 | rel = Path(".opencode") / "commands" / f"{cmd_id}.md" |
| 251 | |
| 252 | fm: dict = { |
| 253 | "description": cmd.description or f"{cmd.name} (from {plugin.name})", |
| 254 | } |
| 255 | if cmd.argument_hint: |
| 256 | fm["argument-hint"] = cmd.argument_hint |
| 257 | # Heuristic: if command orchestrates subagents, force isolation. |
| 258 | # Word-boundary match avoids false positives on substrings like |
| 259 | # `PerformanceReviewAgent` (class name in a code snippet) or `useragent`. |
| 260 | if _SUBAGENT_KEYWORD_RE.search(cmd.body): |
| 261 | fm["subtask"] = True |
| 262 | |
| 263 | body = _rewrite_body_lowercase_tools(cmd.body).rstrip() + "\n" |
| 264 | content = _opencode_frontmatter(fm) + "\n\n" + body |
| 265 | result.written.append(self.write(rel, content)) |
no test coverage detected