Skip to content

Adding cartography - #87

Merged
alvinunreal merged 1 commit into
masterfrom
cart
Jan 25, 2026
Merged

Adding cartography#87
alvinunreal merged 1 commit into
masterfrom
cart

Conversation

@alvinunreal

Copy link
Copy Markdown
Owner

Summary

Changes

@greptile-apps

greptile-apps Bot commented Jan 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

Adds a new "cartography" custom skill for repository mapping and hierarchical codemap generation. The PR introduces infrastructure for bundled custom skills (distinct from npx-installed recommended skills) and implements a Python-based tool that tracks file changes and generates empty codemap templates.

Key Changes:

  • Created src/cli/custom-skills.ts with installation logic for bundled skills
  • Integrated custom skills installation into the CLI installer flow with separate prompt
  • Implemented cartographer.py script with init, changes, and update commands for change tracking
  • Added comprehensive documentation in README and skill-specific docs

Issues Found:

  • Custom skills define allowedAgents but lack integration with the permission system (unlike recommended skills)
  • Glob pattern matching in Python script has incomplete ** support using fnmatch

Confidence Score: 3/5

  • This PR has functional issues that should be addressed before merging
  • The cartography skill won't be automatically granted permissions to the orchestrator agent due to missing integration with the permission system. Additionally, the glob pattern matching logic has bugs that will prevent proper file selection in nested directories.
  • Pay close attention to src/cli/custom-skills.ts and src/skills/cartography/scripts/cartographer.py

Important Files Changed

Filename Overview
src/cli/custom-skills.ts Introduced custom skills infrastructure with file copying logic
src/cli/install.ts Integrated custom skills installation into the interactive and non-interactive install flows
src/skills/cartography/scripts/cartographer.py Introduced Python script for repository mapping and change detection

Sequence Diagram

sequenceDiagram
    participant User
    participant Installer as install.ts
    participant CustomSkills as custom-skills.ts
    participant FileSystem as File System
    participant Cartographer as cartographer.py

    User->>Installer: Run installation
    Installer->>Installer: Ask "Install custom skills?"
    User->>Installer: Yes
    Installer->>CustomSkills: installCustomSkill(cartography, projectRoot)
    CustomSkills->>FileSystem: Check source exists at src/skills/cartography
    FileSystem-->>CustomSkills: Source exists
    CustomSkills->>CustomSkills: copyDirRecursive()
    CustomSkills->>FileSystem: Copy to ~/.config/opencode/skills/cartography
    FileSystem-->>CustomSkills: Copy complete
    CustomSkills-->>Installer: Installation succeeded
    Installer-->>User: Custom skills installed
    
    Note over User,Cartographer: Later: User invokes cartography skill
    
    User->>Cartographer: python cartographer.py init --root /repo --include "src/**/*.ts"
    Cartographer->>FileSystem: Load .gitignore patterns
    Cartographer->>FileSystem: Scan repository with rglob("*")
    Cartographer->>Cartographer: Filter files by include/exclude patterns
    Cartographer->>Cartographer: Compute MD5 hashes for each file
    Cartographer->>Cartographer: Compute folder hashes
    Cartographer->>FileSystem: Save .slim/cartography.json
    Cartographer->>FileSystem: Create empty codemap.md in each folder
    Cartographer-->>User: Initialization complete
Loading

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment thread src/cli/custom-skills.ts Outdated
Comment on lines +23 to +29
export const CUSTOM_SKILLS: CustomSkill[] = [
{
name: 'cartography',
description: 'Repository understanding and hierarchical codemap generation',
allowedAgents: ['orchestrator'],
sourcePath: 'src/skills/cartography',
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allowedAgents field is defined but never used. Unlike RECOMMENDED_SKILLS in skills.ts, custom skills don't integrate with getSkillPermissionsForAgent() in src/agents/index.ts:58. This means the cartography skill won't be automatically granted to the orchestrator agent.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cli/custom-skills.ts
Line: 23:29

Comment:
`allowedAgents` field is defined but never used. Unlike `RECOMMENDED_SKILLS` in `skills.ts`, custom skills don't integrate with `getSkillPermissionsForAgent()` in `src/agents/index.ts:58`. This means the cartography skill won't be automatically granted to the orchestrator agent.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +57 to +69
if "**" in pattern:
# Convert ** to work with fnmatch
parts = pattern.split("**")
if len(parts) == 2 and parts[0] == "" and parts[1].startswith("/"):
# Pattern like **/foo matches foo anywhere
suffix = parts[1][1:] # Remove leading /
if fnmatch(path, f"*{suffix}") or fnmatch(path, f"*/{suffix}"):
return True
elif fnmatch(path, pattern.replace("**", "*")):
return True
elif fnmatch(path, pattern) or fnmatch(os.path.basename(path), pattern):
return True
return False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ** glob pattern matching logic is incomplete. Patterns like src/**/*.ts won't correctly match nested files because fnmatch doesn't natively support **. Consider using pathlib.Path.match() or the wcmatch library for proper recursive glob matching.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/skills/cartography/scripts/cartographer.py
Line: 57:69

Comment:
The `**` glob pattern matching logic is incomplete. Patterns like `src/**/*.ts` won't correctly match nested files because `fnmatch` doesn't natively support `**`. Consider using `pathlib.Path.match()` or the `wcmatch` library for proper recursive glob matching.

How can I resolve this? If you propose a fix, please make it concise.

@alvinunreal
alvinunreal force-pushed the cart branch 3 times, most recently from e59ef77 to 5289634 Compare January 25, 2026 20:16
@alvinunreal
alvinunreal merged commit ac48a0c into master Jan 25, 2026
1 check passed
nghyane pushed a commit to nghyane/oh-my-opencode-slim that referenced this pull request Jan 31, 2026
@mhenke
mhenke deleted the cart branch July 10, 2026 16:11
mhenke pushed a commit to mhenke/oh-my-opencode-slim that referenced this pull request Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant