feat(cli): Add tttk check validator
Statically validate a directory of tttk documents and report structured diagnostics with file/line positions, exit codes, and --json output. Checks cover code-block roles, unresolved content references, tag blocks, element names, links, anchors, and assets. Runs over the same content registry as the app.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { Command } from "commander";
|
||||
import { serveCommand } from "./commands/serve.js";
|
||||
import { compileCommand } from "./commands/compile.js";
|
||||
import { checkCommand } from "./commands/check.js";
|
||||
import { mcpCommand } from "./commands/mcp.js";
|
||||
import type { ServeOptions, CompileOptions } from "./types.js";
|
||||
|
||||
@@ -22,6 +23,16 @@ program
|
||||
.option("--host <host>", "主机地址", "0.0.0.0")
|
||||
.action(serveCommand);
|
||||
|
||||
program
|
||||
.command("check")
|
||||
.alias("lint")
|
||||
.description("校验目录内的 tttk 文档,输出结构化诊断")
|
||||
.argument("[dir]", "要校验的目录", ".")
|
||||
.option("--json", "以 JSON 输出诊断", false)
|
||||
.option("--strict", "将警告视为错误", false)
|
||||
.option("--quiet", "只报告错误", false)
|
||||
.action(checkCommand);
|
||||
|
||||
program
|
||||
.command("compile")
|
||||
.description("[未实现] 存根命令:不会生成任何输出。预览内容请使用 tttk serve")
|
||||
|
||||
Reference in New Issue
Block a user