feat: add codelens-watch.py — file watcher with auto outline.json generation#1
Merged
Conversation
…eration - Watches a project folder for file changes (create/modify/delete) - Re-scans on change with configurable debounce (default 0.5s) - Outputs codelens/outline.json (per-file detail) and codelens/summary.json (aggregate) - Supports all CodeLens languages: TS, JS, TSX, Python, Rust, CSS, HTML, Vue, Svelte - Extracts: functions, classes, interfaces, types, variables, exports, imports, components - Event-driven via watchdog (with polling fallback) - Auto-ignores: node_modules, .git, dist, build, __pycache__, etc. - Single-scan mode via --once flag Usage: python3 codelens-watch.py smart-tax-assistance/app python3 codelens-watch.py ./src --debounce 1.0 --once
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Wolfvin
pushed a commit
that referenced
this pull request
Jun 11, 2026
Elimination #1: Fix critical should_ignore substring matching bug + monorepo detection - scan.py: fixed substring matching in should_ignore (node_modules matched 'node_modules_old') - framework_detect.py: +80 lines monorepo detection (nx, turborepo, lerna) - utils.py: added monorepo/CI/docs dirs to DEFAULT_IGNORE_DIRS
Wolfvin
pushed a commit
that referenced
this pull request
Jun 12, 2026
Five new features that make CodeLens zero-config and token-efficient:
1. Auto-setup: if no registry exists, any analysis command auto-runs init+scan
- No more 'run init then scan then query' — just query directly
- Auto-setup info included in response via _auto_setup field
2. Universal --top N flag: limits all list results to top N items
- Works with ANY command: smell --top 5, complexity --top 10, dead-code --top 3
- Adds truncated flags when results are cut
3. --lite flag: minimal output for AI decision-making
- query --lite returns just {status, found, action, action_reason}
- impact/refactor-safe --lite returns just {status, risk, action}
- Other commands: status + stats + top 5 items
4. --max-tokens N: truncate output to fit within token budget
- Iteratively removes largest arrays until output fits
- Falls back to minimal {status, stats} if still too large
5. --format ai: normalized output schema across all commands
- Consistent: {status, command, stats, items[], truncated, recommendations, metadata}
- Dead-code: results{cat:[]} → items[{...,_category}]
- Smell: by_category{cat:[]} → items[{...,_category}]
- One parsing pattern for all 45 commands
Also: updated SKILL-QUICK.md and SKILL.md with new features documentation
Wolfvin
pushed a commit
that referenced
this pull request
Jun 12, 2026
…e modes 6 improvements to make CodeLens the #1 AI-lovable skill: 1. Smart defaults: Auto --top 20 for 24 list-returning commands - No more 1000+ item responses by default - Override with --top 0 for unlimited or --top N for custom 2. Sort-aware --top: Items sorted by relevance before truncation - complexity: sort by cyclomatic descending - smell/secrets/perf-hint/debug-leak: sort by severity (critical first) - side-effect: sort by effect_count descending - Other: original order preserved 3. Command-specific lite modes for 10+ commands: - smell --lite: {health_score, action, top_findings[], stats} - complexity --lite: {stats, top_complex[], high_complexity_count} - dead-code --lite: {removal_safety, recommended_action, top_items[]} - debug-leak --lite: {stats, top_leaks[]} - perf-hint --lite: {risk, stats, top_hints[]} - secrets --lite: {risk, action, stats, top_findings[]} - a11y/css-deep/regex-audit/vuln-scan --lite: {risk, stats, top_items[], recommendations[]} 4. Fixed lite mode for dict-keyed results (smell, dead-code) - Previously: smell --lite returned {status, health_score} only (by_category is dict, not list) - Now: returns actionable top_findings + action field 5. Added missing keys to _LIST_KEYS: top_priority, actionable_items, etc. 6. Fixed --format ai normalizer to include by_category, top_priority, actionable_items - Previously: smell --format ai returned 0 items - Now: correctly flattens category-keyed dicts into items[] Updated SKILL-QUICK.md and SKILL.md with: - Smart Defaults documentation - Lite Mode Per Command reference table - Updated Token Budget Strategy
Wolfvin
pushed a commit
that referenced
this pull request
Jun 12, 2026
3 final improvements to make CodeLens the definitive #1 AI skill: 1. SKILL-QUICK.md compact: 390 → 141 lines (64% reduction) - Removed verbose per-command schema tables (covered by --help) - Compressed trigger maps and disambiguation into inline format - Kept only essential: flags, lite modes, decision rules, command list 2. CODELENS_AI_MODE env var: makes --format ai the default - Set CODELENS_AI_MODE=1 to auto-get normalized {stats, items[], truncated} output - Backward compatible: without env var, default is still JSON - Fixed format resolution: subparser default=None no longer overrides the CODELENS_AI_MODE default 3. Auto-setup timeout protection: - Auto-setup now caps scan at 3000 files (prevents 5+ min waits) - Uses subprocess to call scan with --max-files 3000 - Falls back to cmd_scan() directly if subprocess fails - Returns capped=true + hint in response when limit is hit - Prints progress messages to stderr for AI visibility Updated docs with CODELENS_AI_MODE and auto-setup behavior sections.
This was referenced Jun 28, 2026
Merged
Wolfvin
added a commit
that referenced
this pull request
Jul 3, 2026
Issue #170 — PR #139 needs two fixes before merge: 1. Missing @WHO/@WHAT/@PART/@entry headers on 5 new formatter files 2. Wrong command count in docs (PR #139 bumped 68→69 but added 0 commands) This commit fixes #1 by adding the standard file header to: - scripts/formatters/text.py → format_text() - scripts/formatters/vim.py → format_vim() - scripts/formatters/emacs.py → format_emacs() - scripts/formatters/junit_xml.py → format_junit_xml() - scripts/formatters/gitlab_sast.py → format_gitlab_sast() Fix #2 (wrong command count) was resolved by rebasing PR #139 on latest main (bfd7c40). The rebase took main's version of all 6 doc files (README, SKILL, SKILL-QUICK, pyproject, skill.json, graph_model.py) since PR #139's only doc changes were the wrong count bump. After rebase, sync_command_count.py --check reports clean (75 commands, matching main). Rebase conflicts resolved: - scripts/codelens.py: merged both main's 'graphml' format choice + PR #139's 5 new format choices into one add_argument() call - scripts/formatters/__init__.py: merged both main's graphml dispatch block + PR #139's 5 new format dispatch blocks into format_output() - 6 doc files: took main's version (PR #139's count bump was wrong) Verified: - 85 tests pass in test_formatters_base.py + test_formatters_phase2.py + test_command_count.py (1 deselected: test_help_lists_new_formats fails due to pre-existing -f argparse conflict on main, not a regression from this PR) - sync_command_count.py --check: clean (75 commands) - All 5 formatter modules import cleanly with new headers Findings (di luar scope, di main juga): - argparse.ArgumentError: conflicting option string: -f — main's codelens.py adds --format/-f both at subparser level (line 892) AND at global parser level (line 926). Any CLI invocation crashes. This is a pre-existing bug on main (PR #157 --diff-base introduced the global -f), NOT a regression from PR #139 or this fix. Affects test_cli.py + test_doctor.py CLI smoke tests too. Suggest separate issue to fix.
This was referenced Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What
Adds
codelens-watch.py— a standalone file watcher that monitors a project folder and auto-generatescodelens/outline.json+codelens/summary.jsonon every file change.Why
The existing
watchcommand incodelens.pyonly updates the internal.codelens/registry. This new script provides a simpler, project-focused watcher that outputs a clean, portable JSON outline directly inside the watched folder.Features
codelens/outline.json(per-file detail) +codelens/summary.json(aggregate counts)watchdog(with polling fallback)--onceflag for CI/CDUsage
Test Results
On file change: