Skip to content

lidge-jun/codexclaw / plugins/codexclaw/skills/repo-map

cxc-repo-map

Verified

Use for repo structure and symbol maps. Triggers: repo map, codebase overview, architecture map, 와꾸.

FileKindSize
SKILL.mdskill md4.6 KB
agents/openai.yamlconfig165 B
scripts/LICENSEother1.0 KB
scripts/NOTICE.mdmarkdown1.2 KB
scripts/importance.pyexecutablescript2.1 KB
scripts/queries/tree-sitter-language-pack/README.mdmarkdown327 B
scripts/queries/tree-sitter-language-pack/arduino-tags.scmother177 B
scripts/queries/tree-sitter-language-pack/c-tags.scmother461 B
scripts/queries/tree-sitter-language-pack/chatito-tags.scmother338 B
scripts/queries/tree-sitter-language-pack/commonlisp-tags.scmother4.6 KB
scripts/queries/tree-sitter-language-pack/cpp-tags.scmother809 B
scripts/queries/tree-sitter-language-pack/csharp-tags.scmother1.1 KB
scripts/queries/tree-sitter-language-pack/d-tags.scmother1.4 KB
scripts/queries/tree-sitter-language-pack/dart-tags.scmother2.2 KB
scripts/queries/tree-sitter-language-pack/elisp-tags.scmother246 B
scripts/queries/tree-sitter-language-pack/elixir-tags.scmother1.6 KB
scripts/queries/tree-sitter-language-pack/elm-tags.scmother953 B
scripts/queries/tree-sitter-language-pack/gleam-tags.scmother1.4 KB
scripts/queries/tree-sitter-language-pack/go-tags.scmother1.3 KB
scripts/queries/tree-sitter-language-pack/java-tags.scmother624 B
scripts/queries/tree-sitter-language-pack/javascript-tags.scmother2.3 KB
scripts/queries/tree-sitter-language-pack/lua-tags.scmother945 B
scripts/queries/tree-sitter-language-pack/ocaml-tags.scmother2.6 KB
scripts/queries/tree-sitter-language-pack/ocaml_interface-tags.scmother2.0 KB
scripts/queries/tree-sitter-language-pack/pony-tags.scmother2.1 KB
scripts/queries/tree-sitter-language-pack/properties-tags.scmother135 B
scripts/queries/tree-sitter-language-pack/python-tags.scmother437 B
scripts/queries/tree-sitter-language-pack/r-tags.scmother461 B
scripts/queries/tree-sitter-language-pack/racket-tags.scmother224 B
scripts/queries/tree-sitter-language-pack/ruby-tags.scmother1.3 KB
scripts/queries/tree-sitter-language-pack/rust-tags.scmother1.4 KB
scripts/queries/tree-sitter-language-pack/solidity-tags.scmother1.4 KB
scripts/queries/tree-sitter-language-pack/swift-tags.scmother1.4 KB
scripts/queries/tree-sitter-language-pack/udev-tags.scmother417 B
scripts/queries/tree-sitter-languages/README.mdmarkdown2.5 KB
scripts/queries/tree-sitter-languages/c-tags.scmother461 B
scripts/queries/tree-sitter-languages/c_sharp-tags.scmother1.0 KB
scripts/queries/tree-sitter-languages/cpp-tags.scmother803 B
scripts/queries/tree-sitter-languages/dart-tags.scmother2.2 KB
scripts/queries/tree-sitter-languages/elisp-tags.scmother332 B
scripts/queries/tree-sitter-languages/elixir-tags.scmother1.6 KB
scripts/queries/tree-sitter-languages/elm-tags.scmother951 B
scripts/queries/tree-sitter-languages/go-tags.scmother848 B
scripts/queries/tree-sitter-languages/hcl-tags.scmother2.1 KB
scripts/queries/tree-sitter-languages/java-tags.scmother627 B
scripts/queries/tree-sitter-languages/javascript-tags.scmother2.2 KB
scripts/queries/tree-sitter-languages/kotlin-tags.scmother632 B
scripts/queries/tree-sitter-languages/ocaml-tags.scmother2.6 KB
scripts/queries/tree-sitter-languages/ocaml_interface-tags.scmother2.0 KB
scripts/queries/tree-sitter-languages/php-tags.scmother714 B
scripts/queries/tree-sitter-languages/python-tags.scmother325 B
scripts/queries/tree-sitter-languages/ql-tags.scmother707 B
scripts/queries/tree-sitter-languages/ruby-tags.scmother1.3 KB
scripts/queries/tree-sitter-languages/rust-tags.scmother1.4 KB
scripts/queries/tree-sitter-languages/scala-tags.scmother1.7 KB
scripts/queries/tree-sitter-languages/typescript-tags.scmother1.2 KB
scripts/repomap.pyexecutablescript7.5 KB
scripts/repomap_class.pyexecutablescript21.3 KB
scripts/requirements.txtmanifest133 B
scripts/scm.pyexecutablescript1.9 KB
scripts/utils.pyexecutablescript1.6 KB

scripts/utils.py

View on GitHub
"""
Utility functions for RepoMap.
"""

import os
from pathlib import Path
from typing import Optional, List
from collections import namedtuple

# Tag namedtuple for storing parsed code definitions and references
Tag = namedtuple("Tag", "rel_fname fname line name kind".split())


def count_tokens(text: str, model_name: str = "gpt-4") -> int:
    """Count tokens in text using tiktoken."""
    if not text:
        return 0

    try:
        import tiktoken
    except ImportError:
        return max(1, len(text) // 4)
    
    try:
        encoding = tiktoken.encoding_for_model(model_name)
    except KeyError:
        # Fallback for unknown models
        encoding = tiktoken.get_encoding("cl100k_base")
    
    return len(encoding.encode(text))


def read_text(filename: str, encoding: str = "utf-8", silent: bool = False) -> Optional[str]:
    """Read text from file with error handling."""
    try:
        return Path(filename).read_text(encoding=encoding, errors='ignore')
    except FileNotFoundError:
        if not silent:
            print(f"Error: {filename} not found.")
        return None
    except IsADirectoryError:
        if not silent:
            print(f"Error: {filename} is a directory.")
        return None
    except OSError as e:
        if not silent:
            print(f"Error reading {filename}: {e}")
        return None
    except UnicodeError as e:
        if not silent:
            print(f"Error decoding {filename}: {e}")
        return None
    except Exception as e:
        if not silent:
            print(f"An unexpected error occurred while reading {filename}: {e}")
        return None
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall