skills-experimental/chalk-level-boost-clamp/SKILL.md
# Chalk Level Boost/Clamp Skill Chalk Level Boost/Clamp - boostChalkLevelForXtermJs + clampChalkLevelForTmux + COLORTERM detection + tmux terminal-overrides + level 2 fallback。 ## 功能概述 从Claude Code的ink/colorize.ts提取的颜色级别调整模式,用于OpenClaw的终端颜色适配。 ## 核心机制 ### boostChalkLevelForXtermJs ```typescript /** * xterm.js (VS Code, Cursor, code-server, Coder) has supported truecolor * since 2017, but code-server/Coder containers often don't set * COLORTERM=truecolor. chalk's supports-color doesn't r
npx skillsauth add bianhaifeng789-hue/openclaw-config skills-experimental/chalk-level-boost-clampInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Chalk Level Boost/Clamp - boostChalkLevelForXtermJs + clampChalkLevelForTmux + COLORTERM detection + tmux terminal-overrides + level 2 fallback。
从Claude Code的ink/colorize.ts提取的颜色级别调整模式,用于OpenClaw的终端颜色适配。
/**
* xterm.js (VS Code, Cursor, code-server, Coder) has supported truecolor
* since 2017, but code-server/Coder containers often don't set
* COLORTERM=truecolor. chalk's supports-color doesn't recognize
* TERM_PROGRAM=vscode → falls through to 256-color regex → level 2.
*
* Gated on level === 2 (not < 3) to respect NO_COLOR / FORCE_COLOR=0.
* Must run BEFORE the tmux clamp.
*/
function boostChalkLevelForXtermJs(): boolean {
if (process.env.TERM_PROGRAM === 'vscode' && chalk.level === 2) {
chalk.level = 3
return true
}
return false
}
// xterm.js truecolor support
// COLORTERM detection workaround
// VS Code TERM_PROGRAM detection
// Respect NO_COLOR/FORCE_COLOR=0
/**
* tmux parses truecolor SGR correctly but only re-emits to outer terminal
* if outer terminal advertises Tc/RGB capability. Default tmux config
* doesn't set this → black background on dark profiles.
*
* Clamping to level 2 makes chalk emit 256-color, which tmux passes through.
*
* Users with terminal-overrides ,*:Tc get downgrade but visual difference
* imperceptible.
*/
function clampChalkLevelForTmux(): boolean {
// Escape hatch for properly configured tmux
if (process.env.CLAUDE_CODE_TMUX_TRUECOLOR) return false
if (process.env.TMUX && chalk.level > 2) {
chalk.level = 2
return true
}
return false
}
// tmux truecolor passthrough limitation
// Level 2 fallback for 256-color
// CLAUDE_CODE_TMUX_TRUECOLOR escape hatch
// Computed once at module load — terminal/tmux environment doesn't change mid-session.
// Order matters: boost first so tmux clamp can re-clamp if tmux inside VS Code.
export const CHALK_BOOSTED_FOR_XTERMJS = boostChalkLevelForXtermJs()
export const CHALK_CLAMPED_FOR_TMUX = clampChalkLevelForTmux()
// Boost BEFORE clamp
// tmux inside VS Code: boost → level 3 → clamp → level 2
// Order critical
// Gated on level === 2 (not < 3) to respect NO_COLOR / FORCE_COLOR=0
// Those yield level 0 and are explicit "no colors" request
// Don't boost from level 0
// Respect user intent
// CLAUDE_CODE_TMUX_TRUECOLOR environment variable
// Users who set terminal-overrides :Tc can skip clamp
// Explicit escape hatch
// Don't query tmux show -gv (subprocess overhead)
export const colorize = (
str: string,
color: string | undefined,
type: ColorType, // 'foreground' | 'background'
): string => {
if (!color) return str
if (color.startsWith('ansi:')) { ... }
if (RGB_REGEX.test(color)) { ... } // rgb(r,g,b)
if (ANSI_REGEX.test(color)) { ... } // ansi256(n)
// ...
}
// Multiple color format support
// ansi: prefix, rgb(), ansi256()
{
"chalkLevel": 3,
"boostedForXtermJs": true,
"clampedForTmux": false,
"termProgram": "vscode",
"tmuxEnv": null
}
boostChalkLevelForXtermJs() → clampChalkLevelForTmux() → order matters
// 先boost再clamp
// tmux in VS Code: boost→level3→clamp→level2
level === 2 (not < 3) → respect NO_COLOR/FORCE_COLOR=0
// level===2检查
// 不从level 0 boost
// 尊重no color意图
CLAUDE_CODE_TMUX_TRUECOLOR → skip clamp → user override
// 环境变量escape hatch
// 用户可跳过clamp
TERM_PROGRAM === 'vscode' + TMUX env → terminal detection
// VS Code检测
// tmux检测
// 不同terminal不同处理
ink/colorize.tsbusiness
IAA 日报飞书输出能力。 支持把固定 CSV 模板一键转换成: - 中文运营结论 - 飞书卡片 JSON - 飞书发送载荷 Use when: - 需要把 IAA 日报直接发到飞书 - 需要从 CSV 一键生成运营日报
data-ai
IAA日报分析模型 功能: - 渠道日报自动分析 - 小时级+日级ROI联动判断 - 按地区输出加量/降量/停投建议 - 按产品类型输出阈值 - 自动识别利润区/观察区/止损区 Use when: - 分析每天投放数据 - 生成运营日报结论 - 判断是否加量/降量/停投 - 对比美加澳/日韩表现 Keywords: - 日报模型, 投放日报, 加量, 降量, 停投, ROI日报, 分地区分析
data-ai
IAA固定日报分析模板 功能: - 固定字段模板(可直接贴每天数据) - 自动输出总盘结论 - 自动输出美加澳/日韩结论 - 自动给出加量/降量/停投建议 - 适配文件修复/清理两类产品 Use when: - 需要固定日报格式 - 每天复盘渠道表现 - 给运营团队出统一结论 Keywords: - 固定模板, 日报模板, ROI模板, IAA日报, 运营模板
development
# HyperlinkPool Pattern Skill HyperlinkPool Pattern - HyperlinkPool class + strings array + stringMap + Index 0 no hyperlink + intern(hyperlink) + get(id) + undefined handling + 5-minute reset + OSC8 hyperlink interning。 ## 功能概述 从Claude Code的ink/screen.ts提取的HyperlinkPool模式,用于OpenClaw的OSC8超链接池管理。 ## 核心机制 ### HyperlinkPool Class ```typescript export class HyperlinkPool { private strings: string[] = [''] // Index 0 = no hyperlink private stringMap = new Map<string, number>() // strings