substitute-eraser

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Substitute Eraser

Substitute Eraser

Scan existing codebases for placeholder tokens. Generate remediation plan.
扫描现有代码库中的占位符标记,生成修复计划。

Purpose

用途

Audit existing files for substitution tokens (TODO, FIXME, placeholder, mock, etc.) and produce actionable remediation plan. Distinct from
accept-no-substitutes
which validates agent output.
审计现有文件中的替代标记(TODO、FIXME、placeholder、mock等),并生成可执行的修复计划。与用于验证Agent输出的
accept-no-substitutes
工具不同。

Scope: Existing Files

扫描范围:现有文件

This skill scans what already exists:
  • Source code files
  • Configuration files
  • Documentation with stale placeholders
  • Test fixtures that leaked into production
Complements
accept-no-substitutes
(output validation).
此技能扫描已存在的内容:
  • 源代码文件
  • 配置文件
  • 包含过时占位符的文档
  • 泄露到生产环境中的测试夹具
补充工具
accept-no-substitutes
(输出验证工具)

Trit Assignment

Trit 分配

  • Trit: -1 (MINUS/VALIDATOR)
  • Hue: 270° (violet - deep scan)
  • Role: Codebase auditor, technical debt detector
  • Trit:-1(MINUS/VALIDATOR,验证器)
  • Hue:270°(紫色 - 深度扫描)
  • 角色:代码库审计员、技术债务检测器

Scan Workflow

扫描流程

1. Discovery

1. 发现阶段

bash
undefined
bash
undefined

Scan current directory

扫描当前目录

just substitute-scan .
just substitute-scan .

Scan specific path

扫描指定路径

just substitute-scan src/
undefined
just substitute-scan src/
undefined

2. Classification

2. 分类

SeverityTokensAction
CRITICALTODO, FIXME, placeholder, xxxMust fix before merge
WARNINGmock-, fake-, stub-* (outside tests)Review context
INFOexample_, demo_Document or remove
严重程度标记操作
CRITICAL(严重)TODO, FIXME, placeholder, xxx合并前必须修复
WARNING(警告)mock-, fake-, stub-*(测试文件外)检查上下文
INFO(信息)example_, demo_记录或移除

3. Remediation Report

3. 修复报告

Output format:
SUBSTITUTE ERASER REPORT
========================
Scanned: 142 files
Found: 23 substitutions

CRITICAL (7):
  src/auth.py:42      TODO: implement token refresh
  src/api.py:118      placeholder value
  src/db.py:55        FIXME: race condition
  ...

WARNING (12):
  src/service.py:30   mock_client (not in test file)
  ...

INFO (4):
  README.md:15        example_config
  ...

REMEDIATION PLAN:
1. [CRITICAL] src/auth.py:42 - Implement token refresh logic
2. [CRITICAL] src/api.py:118 - Replace placeholder with actual value
...
输出格式:
SUBSTITUTE ERASER REPORT
========================
已扫描: 142 files
发现: 23 substitutions

CRITICAL (7):
  src/auth.py:42      TODO: implement token refresh
  src/api.py:118      placeholder value
  src/db.py:55        FIXME: race condition
  ...

WARNING (12):
  src/service.py:30   mock_client (not in test file)
  ...

INFO (4):
  README.md:15        example_config
  ...

修复计划:
1. [CRITICAL] src/auth.py:42 - Implement token refresh logic
2. [CRITICAL] src/api.py:118 - Replace placeholder with actual value
...

Context-Aware Exceptions

上下文感知例外

Acceptable Locations

允许的位置

PatternAcceptable In
mock-*
,
fake-*
,
stub-*
*_test.py
,
test_*.py
,
/tests/
example_*
README.md
,
/docs/
,
/examples/
demo_*
/demo/
, documentation
TODO
Issue tracker references with ID
模式允许出现的位置
mock-*
,
fake-*
,
stub-*
*_test.py
,
test_*.py
,
/tests/
example_*
README.md
,
/docs/
,
/examples/
demo_*
/demo/
, 文档
TODO
带有ID的问题追踪器引用

Exception Syntax

例外语法

Mark intentional placeholders:
python
undefined
标记有意保留的占位符:
python
undefined

SUBSTITUTE-OK: mock used for test isolation

SUBSTITUTE-OK: mock used for test isolation

mock_client = MockHTTPClient()
undefined
mock_client = MockHTTPClient()
undefined

Commands

命令

bash
undefined
bash
undefined

Full scan with report

完整扫描并生成报告

just substitute-scan <path>
just substitute-scan <path>

Critical only (CI mode)

仅扫描严重问题(CI模式)

just substitute-critical <path>
just substitute-critical <path>

Generate remediation tasks

生成修复任务

just substitute-tasks <path> --output=github # GitHub issues just substitute-tasks <path> --output=linear # Linear tickets just substitute-tasks <path> --output=todo # TODO file
just substitute-tasks <path> --output=github # GitHub 议题 just substitute-tasks <path> --output=linear # Linear 工单 just substitute-tasks <path> --output=todo # TODO 文件

Interactive fix mode

交互式修复模式

just substitute-fix <path>
undefined
just substitute-fix <path>
undefined

Integration with GF(3)

与GF(3)的集成

Operates as MINUS (-1) in audit triads:
substitute-eraser(-1) + code-generator(+1) + review-coordinator(0) = 0
Emits rejection signal when scan finds violations above threshold.
在审计三元组中作为MINUS (-1)角色运行:
substitute-eraser(-1) + code-generator(+1) + review-coordinator(0) = 0
当扫描发现超过阈值的违规内容时,发出拒绝信号。

Additional Resources

额外资源

Reference Files

参考文件

  • references/patterns.md
    - Detection regex patterns (shared with accept-no-substitutes)
  • references/remediation.md
    - Fix strategies per token type
  • references/patterns.md
    - 检测正则表达式模式(与accept-no-substitutes共享)
  • references/remediation.md
    - 按标记类型分类的修复策略

Scripts

脚本

  • scripts/scan.py
    - Main scanning script
  • scripts/report.py
    - Report generation
  • scripts/scan.py
    - 主扫描脚本
  • scripts/report.py
    - 报告生成脚本