Skip to content

toolcraft-openapi should preserve hidden on handwritten commands #430

Description

@kamilio

Problem

toolcraft commands support hidden: true, but toolcraft-openapi loses that bit when handwritten commands are merged into a generated OpenAPI client.

In toolcraft-openapi/dist/define-client.js, cloneCommand copies fields like name, description, examples, aliases, positional, params, secrets, scope, confirm, requires, handler, and render, but does not pass hidden through to defineCommand.

That means a caller cannot add a hidden handwritten command through handwrittenCommands; it becomes visible after cloning.

Repro shape

const hiddenCommand = defineCommand({
  name: "install-skill",
  hidden: true,
  params: S.Object({}),
  handler: async () => ({ ok: true }),
});

defineClient({
  name: "example",
  baseUrl,
  auth,
  commands: generatedCommands,
  handwrittenCommands: [hiddenCommand],
});

Expected: install-skill is runnable but omitted from CLI help.
Actual: the cloned command has hidden: false and appears in help.

Why this matters

poe-agent-tools needs a hidden handwritten install command. Because the hidden flag is not preserved, it currently has to pre-dispatch the command in its handwritten CLI entrypoint instead of using the normal handwrittenCommands extension point.

Acceptance criteria

  • toolcraft-openapi preserves hidden when cloning handwritten commands.
  • Add a regression test covering a hidden handwritten command merged through defineClient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions