MCPcopy Index your code
hub / github.com/wshobson/agents / _emit_command

Method _emit_command

tools/adapters/opencode.py:248–265  ·  view source on GitHub ↗
(self, plugin: PluginSource, cmd: CommandSource, result: EmitResult)

Source from the content-addressed store, hash-verified

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))

Callers 1

emit_pluginMethod · 0.95

Calls 3

_opencode_frontmatterFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected