Files
dacli/src/core/log.ts
T
ssw c98ad4f425 init: TS 版 dacli v0.7 baseline (8 父命令/26+ 子命令, 0.4MB, .claude/skills/dacli-ts)
参考 boot/ 仓库结构初始化, 同步到 gitea:3000/ssw/dacli (private).

包括:
- src/  8 父命令 (form/menu/dm/dict/di/apis/doc/workflow + login/status) + core (client/crypto/help/log/types/config)
- src/schema/ FieldBuilder (从 JNPF web 源码提取, 避免 53 个手写 builder)
- tests/ vitest 单元 + playwright E2E (含 workSystem/developSystem baseline regression)
- scripts/ extract-all.mjs (从 jnpf-web 源码生成 schema) + seed-tds-baseline.ts
- doc/  architecture/plan/api/extractors/baseline/RESUME/help-system + v0.6/v0.7 changelog
- .claude/skills/dacli-ts/  Claude 集成 skill (SKILL.md + 5 references + 7 examples + 3 baseline)
- CLAUDE.md (项目说明) + README.md + prompt.md (开发任务说明书)
- 配置文件: package.json/lock, tsconfig, vitest.config, playwright.config
2026-06-12 18:26:39 +08:00

45 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* log.ts — 极简彩色日志
*/
const isTTY = process.stdout.isTTY
const C = {
reset: isTTY ? '\x1b[0m' : '',
dim: isTTY ? '\x1b[2m' : '',
red: isTTY ? '\x1b[31m' : '',
green: isTTY ? '\x1b[32m' : '',
yellow: isTTY ? '\x1b[33m' : '',
blue: isTTY ? '\x1b[34m' : '',
cyan: isTTY ? '\x1b[36m' : '',
bold: isTTY ? '\x1b[1m' : '',
}
export const log = {
info(...args: unknown[]) {
console.log(`${C.cyan}ℹ${C.reset}`, ...args)
},
ok(...args: unknown[]) {
console.log(`${C.green}✓${C.reset}`, ...args)
},
warn(...args: unknown[]) {
console.warn(`${C.yellow}!${C.reset}`, ...args)
},
error(...args: unknown[]) {
console.error(`${C.red}✗${C.reset}`, ...args)
},
dim(...args: unknown[]) {
console.log(`${C.dim}${args.join(' ')}${C.reset}`)
},
raw(s: string) {
process.stdout.write(s)
},
/** 仅在 DACLI_DEBUG=1 时打 */
debug(...args: unknown[]) {
if (process.env.DACLI_DEBUG === '1') console.error(`${C.dim}[debug]${C.reset}`, ...args)
},
}
/** JSON 美化输出 (供命令直接打到 stdout, 便于 jq 管道) */
export function printJson(v: unknown): void {
console.log(JSON.stringify(v, null, 2))
}