mdt

Native MoonBit CLI for translating Markdown with OpenCode or Codex

markdown
translation
opencode
cli
moon add totto2727/mdt@0.1.9
Download zip
Author
Version
0.1.9
License
MIT
Last updated
yesterday
Downloads
10
README

#mdt

A native MoonBit CLI that translates one Markdown file through the installed OpenCode or Codex CLI. It uses the provider-neutral totto2727/agent-sdk/cli contract with provider adapters, retains provider-native options only at the composition root, reuses existing authentication, and denies every OpenCode tool through OPENCODE_CONFIG_CONTENT.

#Usage

mdt <file> --lang <code> [--agent <opencode|codex>] [--model <model>] [--force]

FlagEnvironmentDescriptionDefault
--lang, -lTarget language code, such as ja or ja-JPrequired
--agentMDT_AGENTAgent CLI: opencode or codexopencode
--model, -mMDT_MODELOpenCode provider/model or Codex model IDOpenCode: opencode-go/deepseek-v4-flash; Codex: gpt-5.6-luna
--force, -fOverwrite an existing output fileoff

Command-line options override environment variables, which override the defaults.

The output is written beside the input with the normalized language tag before its extension. Existing language tags are replaced, and compound .mbt.md extensions are preserved.

README.md -> README.ja.md guide.en.md -> guide.ja.md module.mbt.md -> module.ja.mbt.md module.en.mbt.md -> module.ja.mbt.md

#Development

Enter the Nix development shell, then validate the package:

nix develop moon check moon test moon package --list

Build the installable package with nix build .#mdt.

#How it works

  1. Admiral parses the input path and options into typed command data.
  2. The CLI refuses to overwrite an existing output before starting the selected provider unless --force is present.
  3. totto2727/agent-sdk/cli sends the common translation prompt to the selected provider adapter.
  4. The OpenCode adapter starts opencode run --format json with the selected provider/model and sends a deny-all permission configuration through OPENCODE_CONFIG_CONTENT.
  5. The Codex adapter passes the selected model ID, defaults to gpt-5.6-luna, and applies approval_policy=never, --sandbox read-only, and --skip-git-repo-check.
  6. Provider JSONL text events are joined by the adapter and written to the resolved output path.

The CLI sends the whole file in one prompt. A file larger than the selected model's context window is not chunked.

#
Agent

type Agent

#
TranslateOptions

type TranslateOptions

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io