From 59a6f56bfea046fb0b766916ba5fa09a8b6fd5f6 Mon Sep 17 00:00:00 2001 From: Lum1104 Date: Fri, 10 Apr 2026 11:39:45 +0800 Subject: [PATCH] feat(skill): add Phase 0.5 for .understandignore setup and review pause Co-Authored-By: Claude Opus 4.6 (1M context) --- .../skills/understand/SKILL.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/understand-anything-plugin/skills/understand/SKILL.md b/understand-anything-plugin/skills/understand/SKILL.md index be26f59..3ad7fcf 100644 --- a/understand-anything-plugin/skills/understand/SKILL.md +++ b/understand-anything-plugin/skills/understand/SKILL.md @@ -77,6 +77,37 @@ Determine whether to run a full analysis or incremental update. --- +## Phase 0.5 — Ignore Configuration + +Set up and verify the `.understandignore` file before scanning. + +1. Check if `$PROJECT_ROOT/.understand-anything/.understandignore` exists. +2. **If it does NOT exist**, generate a starter file: + - Run the following Node.js one-liner in `$PROJECT_ROOT`: + ```bash + node -e " + const fs = require('fs'); + const path = require('path'); + const root = process.cwd(); + const dirs = ['__tests__','test','tests','fixtures','testdata','docs','examples','scripts','migrations','.storybook']; + const header = '# .understandignore — patterns for files/dirs to exclude from analysis\n# Syntax: same as .gitignore (globs, # comments, ! negation, trailing / for dirs)\n# Lines below are suggestions — uncomment to activate.\n# Use ! prefix to force-include something excluded by defaults.\n#\n# Built-in defaults (always excluded unless negated):\n# node_modules/, .git/, dist/, build/, bin/, obj/, *.lock, *.min.js, etc.\n#\n'; + let body = ''; + const found = dirs.filter(d => fs.existsSync(path.join(root, d))); + if (found.length) { body += '# --- Detected directories (uncomment to exclude) ---\n\n' + found.map(d => '# ' + d + '/').join('\n') + '\n\n'; } + body += '# --- Test file patterns (uncomment to exclude) ---\n\n# *.test.*\n# *.spec.*\n# *.snap\n'; + fs.writeFileSync(path.join(root, '.understand-anything', '.understandignore'), header + body); + " + ``` + - Report to the user: + > Generated `.understand-anything/.understandignore` with suggested exclusions based on your project structure. Please review it and uncomment any patterns you'd like to exclude from analysis. When ready, confirm to continue. + - **Wait for user confirmation before proceeding.** +3. **If it already exists**, report: + > Found `.understand-anything/.understandignore`. Review it if needed, then confirm to continue. + - **Wait for user confirmation before proceeding.** +4. After confirmation, proceed to Phase 1. + +--- + ## Phase 1 — SCAN (Full analysis only) Dispatch a subagent using the `project-scanner` agent definition (at `agents/project-scanner.md`). Append the following additional context: @@ -113,6 +144,9 @@ Store the file list as `$FILE_LIST` with `fileCategory` metadata for use in Phas **Gate check:** If >100 files, inform the user and suggest scoping with a subdirectory argument. Proceed only if user confirms or add guidance that this may take a while. +If the scan result includes `filteredByIgnore > 0`, report: +> Excluded {filteredByIgnore} files via `.understandignore`. + --- ## Phase 2 — ANALYZE