ignore

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Global Ignore Patterns

全局忽略规则

Manage global ignore patterns for the
lint-relative-paths
linter.
管理
lint-relative-paths
linter的全局忽略规则。

Purpose

用途

Some repositories intentionally use relative paths in markdown (e.g.,
../docs/file.md
) instead of repo-root paths (e.g.,
/docs/file.md
). This command manages a global ignore file that skips path validation for matching workspaces.
有些代码仓库会有意在markdown中使用相对路径(例如
../docs/file.md
)而非仓库根路径(例如
/docs/file.md
)。本命令用于管理全局忽略文件,对匹配的工作区跳过路径校验。

Actions

操作

ActionDescriptionExample
add
Add a pattern to the global ignore file
/statusline-tools:ignore add my-repo
list
Show current patterns
/statusline-tools:ignore list
remove
Remove a pattern from the ignore file
/statusline-tools:ignore remove my-repo
操作描述示例
add
向全局忽略文件添加一条规则
/statusline-tools:ignore add my-repo
list
展示当前所有规则
/statusline-tools:ignore list
remove
从忽略文件中删除一条规则
/statusline-tools:ignore remove my-repo

Pattern Matching

规则匹配

Patterns use substring matching. A pattern matches if the workspace path contains the pattern.
Example: Pattern
alpha-forge
matches:
  • /Users/user/projects/alpha-forge
  • /Users/user/eon/alpha-forge.worktree-feature-x
  • /home/user/code/alpha-forge-v2
规则采用子串匹配机制。如果工作区路径包含该规则字符串,就会匹配成功。
示例:规则
alpha-forge
会匹配以下路径:
  • /Users/user/projects/alpha-forge
  • /Users/user/eon/alpha-forge.worktree-feature-x
  • /home/user/code/alpha-forge-v2

Ignore File Location

忽略文件位置

~/.claude/lint-relative-paths-ignore
Lines starting with
#
are comments.
~/.claude/lint-relative-paths-ignore
#
开头的行是注释。

Execution

执行逻辑

Skip Logic

跳过逻辑

  • If action + pattern provided -> execute directly
  • If only
    list
    provided -> show patterns immediately
  • If no arguments -> use AskUserQuestion flow
  • 如果提供了操作+规则参数 -> 直接执行
  • 如果仅提供了
    list
    参数 -> 立即展示现有规则
  • 如果没有参数 -> 进入AskUserQuestion流程

Workflow

工作流程

  1. Check Current State: Run
    list
    to show existing patterns
  2. Action Selection: Use AskUserQuestion to select action:
    • "Add a new pattern" -> prompt for pattern
    • "Remove an existing pattern" -> show current patterns to select
    • "Just view current patterns" -> display and exit
  3. Pattern Input: For add/remove, AskUserQuestion with examples
  4. Execute: Run the management script
  5. Verify: Confirm changes applied
  1. 检查当前状态:运行
    list
    展示已有规则
  2. 选择操作:使用AskUserQuestion选择要执行的操作:
    • "添加新规则" -> 提示输入规则
    • "删除现有规则" -> 展示当前规则供选择
    • "仅查看当前规则" -> 展示后退出
  3. 规则输入:针对添加/删除操作,通过AskUserQuestion给出示例引导输入
  4. 执行:运行管理脚本
  5. 验证:确认变更已生效

AskUserQuestion Flow (No Arguments)

交互式询问流程(无参数时)

When invoked without arguments, guide the user interactively:
Question: "What would you like to do with lint-relative-paths ignore patterns?"
Options:
  - "Add pattern" -> "Add a new repository pattern to skip path linting"
  - "List patterns" -> "Show all current ignore patterns"
  - "Remove pattern" -> "Remove an existing pattern from the ignore list"
For "Add pattern":
Question: "Enter the repository pattern to ignore"
Note: Patterns use substring matching. Example: 'alpha-forge' matches any path containing 'alpha-forge'.
当调用时没有传入参数,会以交互方式引导用户操作:
Question: "What would you like to do with lint-relative-paths ignore patterns?"
Options:
  - "Add pattern" -> "Add a new repository pattern to skip path linting"
  - "List patterns" -> "Show all current ignore patterns"
  - "Remove pattern" -> "Remove an existing pattern from the ignore list"
选择“添加规则”时:
Question: "Enter the repository pattern to ignore"
Note: Patterns use substring matching. Example: 'alpha-forge' matches any path containing 'alpha-forge'.

Direct Execution (With Arguments)

直接执行(带参数时)

Parse
$ARGUMENTS
and run the management script:
bash
/usr/bin/env bash << 'IGNORE_SCRIPT_EOF'
PLUGIN_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/cc-skills/plugins/statusline-tools}"
bash "$PLUGIN_DIR/scripts/manage-ignore.sh" $ARGUMENTS
IGNORE_SCRIPT_EOF
解析
$ARGUMENTS
并运行管理脚本:
bash
/usr/bin/env bash << 'IGNORE_SCRIPT_EOF'
PLUGIN_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/cc-skills/plugins/statusline-tools}"
bash "$PLUGIN_DIR/scripts/manage-ignore.sh" $ARGUMENTS
IGNORE_SCRIPT_EOF

Manual Editing

手动编辑

The ignore file can also be edited manually:
bash
undefined
忽略文件也可以手动编辑:
bash
undefined

View current patterns

View current patterns

cat ~/.claude/lint-relative-paths-ignore
cat ~/.claude/lint-relative-paths-ignore

Add a pattern manually

Add a pattern manually

echo "my-repo-pattern" >> ~/.claude/lint-relative-paths-ignore
undefined
echo "my-repo-pattern" >> ~/.claude/lint-relative-paths-ignore
undefined

Troubleshooting

故障排查

IssueCauseSolution
Pattern not matchingSubstring match is strictUse broader pattern (e.g.,
forge
vs
alpha-forge
)
Ignore file not found~/.claude doesn't existCreate with
mkdir -p ~/.claude
Permission deniedFile not writableCheck file permissions with
ls -la
Script not foundPlugin not installedReinstall plugin from marketplace
问题原因解决方案
规则未匹配子串匹配是严格匹配使用范围更广的规则(例如
forge
代替
alpha-forge
未找到忽略文件~/.claude目录不存在执行
mkdir -p ~/.claude
创建目录
权限被拒绝文件不可写
ls -la
检查文件权限
未找到脚本插件未安装从应用市场重新安装插件