-
Notifications
You must be signed in to change notification settings - Fork 0
Add useful tool to git repository #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add useful tool to git repository #30
Conversation
Add the Progressive Reveal CLI tool from gist to tools/progressive-reveal-cli/. This tool allows incremental exploration of files at 4 progressive levels: - Level 0: Metadata (size, type, hash, line count) - Level 1: Structure (keys, imports, classes, functions, headings) - Level 2: Preview (condensed content view) - Level 3: Full content (paginated) Features: - Smart file type detection for YAML, JSON, Markdown, Python - Regex-based grep filtering with context support - Type-aware analysis for different file formats - Safe handling of large and binary files Also add claude.md documentation to guide Claude Code usage with: - Progressive Reveal CLI installation and usage instructions - Common workflows for exploring configs, code, and docs - Tips for working with the GenesisGraph codebase - Repository structure overview This tool is particularly useful for Claude Code to efficiently explore and understand large files without needing to read entire contents.
| ) | ||
|
|
||
| # Print output | ||
| for line in output: |
Check failure
Code scanning / CodeQL
Potentially uninitialized local variable Error
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
To fix the problem, ensure that the local variable output is always initialized, regardless of the value that args.level may have. The best way is to add an else branch after the four-level branches that handles all unexpected cases, initializing output to an empty list (or an appropriate value) and potentially printing an error and exiting, or at least preventing it from being uninitialized. Only minimal changes are needed: add a final else: bloc after lines 180-181 that initializes output. No new imports or complex logic is required.
-
Copy modified lines R181-R184
| @@ -178,11 +178,14 @@ | ||
| case_sensitive=args.grep_case_sensitive, | ||
| context=args.context | ||
| ) | ||
| else: | ||
| print(f"Error: Unknown level {args.level}", file=sys.stderr) | ||
| output = [] | ||
| sys.exit(1) | ||
|
|
||
| # Print output | ||
| for line in output: | ||
| print(line) | ||
|
|
||
| except FileNotFoundError as e: | ||
| print(f"Error: {e}", file=sys.stderr) | ||
| sys.exit(1) |
| # Frontmatter detection | ||
| if i == 1 and stripped == '---': | ||
| in_frontmatter = True | ||
| frontmatter_start = True |
Check notice
Code scanning / CodeQL
Unused local variable Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
The best way to fix this problem is to remove the assignment to frontmatter_start on line 79, as setting this variable is unnecessary and its value is never used in the method. Since the right-hand side (True) produces no side effects, the whole line can be safely deleted. No other code needs to be changed, and no additional imports or definitions are required.
| @@ -65,7 +65,6 @@ | ||
| """Generate Markdown preview.""" | ||
| preview = [] | ||
| in_frontmatter = False | ||
| frontmatter_start = False | ||
| first_heading_found = False | ||
| lines_after_heading = 0 | ||
| in_code_block = False | ||
| @@ -76,7 +75,6 @@ | ||
| # Frontmatter detection | ||
| if i == 1 and stripped == '---': | ||
| in_frontmatter = True | ||
| frontmatter_start = True | ||
| preview.append((i, line)) | ||
| continue | ||
|
|
|
|
||
| # Module docstring | ||
| if self.tree and isinstance(self.tree.body[0], ast.Expr) and isinstance(self.tree.body[0].value, ast.Constant): | ||
| docstring_node = self.tree.body[0] |
Check notice
Code scanning / CodeQL
Unused local variable Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
To fix this issue, the unused variable assignment on line 71 should be removed. This means deleting the line docstring_node = self.tree.body[0]. Since the variable is neither read nor required for side effects, its removal will not alter the code’s behavior. The rest of the code in the block remains unaffected. No additional imports or changes are necessary.
-
Copy modified line R72
| @@ -68,8 +68,8 @@ | ||
|
|
||
| # Module docstring | ||
| if self.tree and isinstance(self.tree.body[0], ast.Expr) and isinstance(self.tree.body[0].value, ast.Constant): | ||
| docstring_node = self.tree.body[0] | ||
| # Find docstring in lines | ||
| # Find docstring in lines | ||
| for i, line in enumerate(self.lines[:20], 1): | ||
| if '"""' in line or "'''" in line: | ||
| preview.append((i, line)) |
| import sys | ||
| import argparse | ||
| from pathlib import Path | ||
| from typing import List, Optional, Dict, Any |
Check notice
Code scanning / CodeQL
Unused import Note
Import of 'Any' is not used.
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
To fix this issue, we should remove the unused imports Dict and Any from the statement from typing import List, Optional, Dict, Any on line 6, while keeping the necessary imports List and Optional. This will reduce unnecessary dependencies and clarify the code by only importing symbols that are actually used. The change should be made directly in the import statement on line 6 of tools/progressive-reveal-cli/reveal/cli.py. No other changes, such as additional imports or code edits, are needed.
-
Copy modified line R6
| @@ -3,7 +3,7 @@ | ||
| import sys | ||
| import argparse | ||
| from pathlib import Path | ||
| from typing import List, Optional, Dict, Any | ||
| from typing import List, Optional | ||
|
|
||
| from .core import FileSummary, create_file_summary | ||
| from .analyzers import YAMLAnalyzer, JSONAnalyzer, MarkdownAnalyzer, PythonAnalyzer, TextAnalyzer |
| """Core data models and utilities for Progressive Reveal CLI.""" | ||
|
|
||
| import hashlib | ||
| import os |
Check notice
Code scanning / CodeQL
Unused import Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
To fix this, simply remove the import os statement from line 4 of tools/progressive-reveal-cli/reveal/core.py. This will eliminate the unnecessary dependency, improve readability, and adhere to good coding practices. Ensure that only this line is removed and no functionality elsewhere is affected.
| @@ -1,7 +1,6 @@ | ||
| """Core data models and utilities for Progressive Reveal CLI.""" | ||
|
|
||
| import hashlib | ||
| import os | ||
| from dataclasses import dataclass, field | ||
| from datetime import datetime | ||
| from pathlib import Path |
| """Grep filtering utilities.""" | ||
|
|
||
| import re | ||
| from typing import List, Optional |
Check notice
Code scanning / CodeQL
Unused import Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
The best way to fix the problem is to remove the unused Optional import from the import statement on line 4, leaving only List imported from typing. This ensures the code does not create unnecessary dependencies and improves readability. The change should be made directly on the import line at the top of tools/progressive-reveal-cli/reveal/grep_filter.py, removing Optional but retaining List as it is used in type hints. No further changes or additions are required.
-
Copy modified line R4
| @@ -1,7 +1,7 @@ | ||
| """Grep filtering utilities.""" | ||
|
|
||
| import re | ||
| from typing import List, Optional | ||
| from typing import List | ||
|
|
||
|
|
||
| def apply_grep_filter( |
Add the Progressive Reveal CLI tool from gist to tools/progressive-reveal-cli/. This tool allows incremental exploration of files at 4 progressive levels:
Features:
Also add claude.md documentation to guide Claude Code usage with:
This tool is particularly useful for Claude Code to efficiently explore and understand large files without needing to read entire contents.