typescript-compile-check-resilient

在 npx 和 node_modules/.bin 符号链接失效的项目中,使用 TypeScript 进行编译检查。通过过滤技术仅隔离新创建或任务特定文件中的错误,忽略既有的遗留错误。

仓库最近推送
GitHub Stars
8,134
Forks
953
Issues / PRs
39

预览截图

来自skillπ 实验室的展示

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "typescript-compile-check-resilient":https://skillpi.com/zh/skills/deepskill-a0d3613dc368925a47499e6fb040ab61eab4c66c373f3ffe5b4e691961fcfd4d。安装前核对上游来源和版本:https://github.com/HKUDS/OpenSpace。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

在 npx 和 node_modules/.bin 符号链接失效的项目中,使用 TypeScript 进行编译检查。通过过滤技术仅隔离新创建或任务特定文件中的错误,忽略既有的遗留错误。

0 下载

介绍来源: third_party · HKUDS · 0.0.1 参考来源

SkillPi 解读

能完成的任务
TypeScript在 npx 和 node modules/.bin symlinks 失败的项目中进行编译检查,使用过滤技术从只新建或任务特定文件中分离出错误——忽略先前存在的遗留错误.
适合谁
`npx tsc` 以“ 找不到命令” 或权限错误失败 `node_modules/.bin/tsc` symlink 已断裂或无法解析 您只需验证 * 新建 * 或 * 任务特定 * 文件, 而不会被更广泛的代码库中先前存在的编译错误阻塞
输入和输出
当一个遗留的代码库有 先前存在的错误,全部 `tsc` 输出会很吵,并可能造成假负数。 管道通过 `grep` 从您创建或修改的文件中分离出错误 :
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: typescript-compile-check-resilient
description: TypeScript compile-checking in projects where npx and node_modules/.bin symlinks fail, with a filtering technique to isolate errors from only newly-created or task-specific files — ignoring pre-existing legacy errors.

TypeScript Compile-Check (Resilient) with File-Scoped Error Filtering

Use this workflow when you need to validate TypeScript changes in a project but the standard npx tsc or node_modules/.bin/tsc invocations fail due to broken symlinks, missing PATH entries, or environment issues.


When to Use This Skill

  • npx tsc fails with "command not found" or permission errors
  • node_modules/.bin/tsc symlink is broken or unresolvable
  • You need to validate only newly-created or task-specific files without being blocked by pre-existing compile errors in the broader codebase

Step 1 — Invoke tsc Directly via node_modules

Bypass npx and symlinks entirely by calling the TypeScript binary directly:

node_modules/typescript/bin/tsc --noEmit 2>&1; echo EXIT:$?

Why this works: The tsc CLI entry point is a plain Node.js script at node_modules/typescript/bin/tsc. It does not depend on symlinks or PATH resolution. The --noEmit flag checks types without writing output files. Capturing EXIT:$? lets you programmatically detect success (EXIT:0) vs failure (EXIT:1 or higher).

If the project uses a custom tsconfig, specify it explicitly:

node_modules/typescript/bin/tsc --noEmit --project tsconfig.json 2>&1; echo EXIT:$?

Step 2 — Filter Output to Task-Specific Files Only

When a legacy codebase has pre-existing errors, the full tsc output will be noisy and may cause false negatives. Pipe through grep to isolate errors from only the files you created or modified:

node_modules/typescript/bin/tsc --noEmit 2>&1 \
  | grep -E "(file-pattern)" ; echo EXIT:${PIPESTATUS[0]}

Examples

Single new file:

node_modules/typescript/bin/tsc --noEmit 2>&1 \
  | grep -E "settings-store\.ts"

Multiple new files (pipe-delimited pattern):

node_modules/typescript/bin/tsc --noEmit 2>&1 \
  | grep -E "(settings-keys|settings-store|preferences|SettingsModal)"

All files in a specific directory:

node_modules/typescript/bin/tsc --noEmit 2>&1 \
  | grep -E "src/features/my-feature/"

Check: no output = no errors in your files (success).


Step 3 — Capture Exit Code Correctly Through a Pipe

When grepping, the shell exit code reflects grep, not tsc. Use ${PIPESTATUS[0]} (bash) to recover the original tsc exit code:

node_modules/typescript/bin/tsc --noEmit 2>&1 \
  | grep -E "(my-file-pattern)"; echo "TSC_EXIT:${PIPESTATUS[0]}"

Or store errors explicitly:

TSC_OUTPUT=$(node_modules/typescript/bin/tsc --noEmit 2>&1)
TSC_EXIT=$?
echo "$TSC_OUTPUT" | grep -E "(settings-keys|settings-store|preferences|SettingsModal)"
echo "TSC_EXIT:$TSC_EXIT"

The second approach (storing output in a variable) is the most reliable since $? is captured before the pipe.


Step 4 — Interpret Results

Condition Meaning
TSC_EXIT:0, no grep output ✅ Full project clean, your files are fine
TSC_EXIT:1, no grep output ✅ Your files are fine; pre-existing errors elsewhere (acceptable)
TSC_EXIT:1, grep output present ❌ Your files have errors — fix them
TSC_EXIT:2 ❌ tsc configuration error (bad tsconfig, missing typescript package)

Fallback: Verify TypeScript Is Installed

If node_modules/typescript/bin/tsc does not exist:

# Check if typescript is installed
ls node_modules/typescript/bin/tsc 2>/dev/null || echo "TypeScript not installed"

# Install if needed
npm install --save-dev typescript
# or
yarn add --dev typescript

Full Example

# Store full tsc output and exit code
TSC_OUTPUT=$(node_modules/typescript/bin/tsc --noEmit 2>&1)
TSC_EXIT=$?

# Show only errors in newly-created files
NEW_FILE_ERRORS=$(echo "$TSC_OUTPUT" | grep -E "(settings-keys|settings-store|preferences|SettingsModal)")

if [ -z "$NEW_FILE_ERRORS" ]; then
  echo "✅ No TypeScript errors in new files (TSC_EXIT:$TSC_EXIT)"
else
  echo "❌ TypeScript errors in new files:"
  echo "$NEW_FILE_ERRORS"
  exit 1
fi

Notes

  • This technique is safe for CI and local environments alike.
  • The direct node_modules/typescript/bin/tsc path works on macOS, Linux, and Windows (via node node_modules/typescript/bin/tsc on Windows CMD).
  • On Windows, replace the bash script with: node node_modules/typescript/bin/tsc --noEmit
  • Always prefer --noEmit for validation-only checks to avoid side effects.

当前收录版本

0.0.1

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值78/100

亮点

  • 解决 npx 和 node_modules/.bin 符号链接失效环境下的 TypeScript 编译检查痛点
  • 提供过滤技术隔离新文件错误,避免被遗留错误干扰
  • 适用于 CI 和本地环境,具有明确的实用价值
触发精准92/100

亮点

  • description 精准描述使用场景、核心功能和特色
  • 触发词覆盖多种变体,边界清晰
  • 无 description 错位或截断问题
结构规范95/100

亮点

  • 结构清晰,包含完整的使用场景、步骤、示例和注意事项
  • 步骤划分明确,有出口条件和端到端示例
  • frontmatter 完整,文档长度适中
执行可靠88/100

亮点

  • 工具来源明确,参数正确
  • 覆盖主要异常情况并提供 fallback 方案
  • 执行流程可靠,适合自动化环境
证据可验 (前四项均值)88/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。