DSH Plugins Marketplace

DSH Plugins

Plugins

/

Tools & Capabilities

/

dsh-fmt

Z

dsh-fmt

Manifest valid

DSH plugin: JSON/YAML/TOML/SQL formatter with error line/column locations

hasBundlePatch

dsh-fmt

DSH 插件:格式化 / 校验文本,支持 JSON / YAML / TOML / SQL 四种格式。纯 ESM、无构建、无原生依赖。

安装

dsh plugin --profile <name> add file:./plugins/dsh-fmt

(发布到 npm 后:dsh plugin --profile <name> add dsh-fmt)

工具

  • format_text —— 输入文本与目标格式,返回规范值 { format, ok, output, error? }。

参数

参数类型必填默认说明
textstring是-要格式化 / 校验的文本
formatenum是-json / yaml / toml / sql
indentnumber否2缩进宽度(JSON/YAML 美化;SQL 的 tab 宽度)
sqlDialectenum否standardstandard / postgresql / mysql / sqlite,仅 SQL 使用
keywordCaseenum否upperupper / lower / preserve,仅 SQL 使用

返回值

规范 JSON 值:

{
  "format": "json",       // 本次使用的格式
  "ok": true,             // 解析/格式化是否成功
  "output": "…",          // 格式化结果(ok=true)
  "error": {              // 仅 ok=false 时存在
    "message": "…",
    "line": 1,            // 可选
    "column": 2           // 可选
  }
}

解析失败不算工具失败:错误以 ok:false + error(尽力带 line/column 位置)返回,而不是抛出工具异常。

各格式示例

JSON

输入 {"b":1,"a":[1,2]},format=json,indent=2:

{
  "b": 1,
  "a": [
    1,
    2
  ]
}

非法输入 {bad 返回 ok:false,error.message 含 Node 报错原文,line/column 从报错中的 position … (line L column C) 正则提取。

YAML

输入:

a:
  b: 1
c: [x, y]

format=yaml 先 parse 校验,再 stringify 美化(流式数组会展开为块式)。解析失败捕获 YAMLParseError,取 linePos[0] 作为位置。

TOML

输入:

title="demo"
[owner]
name="t"

format=toml 先 parse 校验再 stringify 规范化;解析失败取 TomlError 的 line / column。

SQL

输入 select a,b from t where x=1 order by b,format=sql、keywordCase=upper:

SELECT
  a,
  b
FROM
  t
WHERE
  x = 1
ORDER BY
  b

sqlDialect 映射到 sql-formatter 的 language:standard→sql、postgresql→postgresql、mysql→mysql、sqlite→sqlite。

SQL 不做语法校验的说明

format_text 的 SQL 分支本身不做主动语法校验:不先解析再格式化,直接把文本交给 sql-formatter 的 format(),多数可读 SQL 都能得到规范化输出。但 sql-formatter 底层是一个完整的 SQL 解析器,遇到根本无法解析的片段会抛错——此时同样遵循「解析失败不算工具失败」的约定,返回 ok:false + error.message,而不会让工具调用失败。

License

MIT

Versions

Latest versionPublishedSize
0.1.0——

Comments

Loading…

Similar plugins

dsh-mutation-receipt

by jwilson411

DeepSeek Harness plugin: append-only JSONL of filesystem touches (path, op, sha256 before/after) with no file contents

Tools & CapabilitiesManifest valid

★ 0

MIT

JavaScript

Sep 1, 2026

dsh plugin --profile web add dsh-mutation-receipt

by builtin-pb

The single plugin you need for DSH — build, test, diagnose, and maintain DeepSeek Harness plugins and core.

Development & InfrastructureManifest valid

★ 7

MIT

JavaScript

Sep 19, 2026

dsh plugin --profile web add dsh-developer

by hellosky983

Plugin Foundry — a self-extending, everything-is-a-plugin compiler for DeepSeek Harness (DSH). Blueprint registry + scaffold/validate tools.

Tools & CapabilitiesDevelopment & InfrastructureTerminal & ClientsManifest valid

★ 2

↓ 11/wk

MIT

JavaScript

Sep 29, 2026

dsh plugin --profile web add dsh-foundry

by Qingzhou-Joshua

DeepSeek Harness plugin—a simple toolkit for developers.

Manifest valid

★ 0

MIT

TypeScript

Aug 14, 2026

dsh plugin --profile web add dsh-dev-toolbox

by Chi-hong22

DeepSeek Harness Web composer markdown editing helper: Shift+Enter list continuation with ordered-list auto-renumbering and Tab indent

Terminal & ClientsManifest valid

★ 0

MIT

JavaScript

Aug 14, 2026

dsh plugin --profile web add @chi-hong22/dsh-mdbox

by Momojie-S

DSH plugin: per-workspace .env injection for shell subprocesses

Tools & CapabilitiesManifest valid

★ 2

MIT

JavaScript

Sep 12, 2026

dsh plugin --profile web add @momojie-s/dsh-workspace-env