Skip to content

toolcraft CLI cannot restrict or rename built-in global control flags #401

Description

@kamilio

Summary

toolcraft@0.0.16 always exposes and parses built-in global flags such as --yes, --output, and --debug. Applications cannot disable, rename, or hide these flags while still using runCLI and shared Toolcraft command definitions.

Reproduction

import { defineCommand, defineGroup, S } from "toolcraft";
import { runCLI } from "toolcraft/cli";

const root = defineGroup({
  name: "example",
  children: [
    defineCommand({
      name: "hello",
      params: S.Object({}),
      handler: async () => "hello",
    }),
  ],
});

await runCLI(root, { rootUsageName: "example" });

Observed:

  • The CLI owns --yes, --output, and --debug regardless of the application's public contract.
  • ALWAYS_GLOBAL_LONG_OPTION_FLAGS and global Commander options are hardcoded in dist/cli.js.
  • An application that needs only --json / --markdown, or wants no interactive control flags, must pre-parse/rewrite argv and replace generated help/error output outside Toolcraft.

Expected

Allow applications to configure built-in CLI controls, for example:

runCLI(root, {
  controls: {
    output: false,
    yes: false,
    debug: false,
  },
});

Alternatively, support application-provided flag names/output selection while retaining Toolcraft rendering.

Why this matters

Toolcraft is intended to share definitions across CLI and MCP. Hardcoded CLI controls force downstream applications to duplicate argument validation and help generation, undermining the shared-definition model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions