Skip to content

feat: Add Logseq TODO generator to IssueManager - #131

Merged
theinterneti merged 36 commits into
mainfrom
feat/logseq-todo-generator
Nov 29, 2025
Merged

theinterneti merged 36 commits into
mainfrom
feat/logseq-todo-generator

Conversation

@theinterneti

Copy link
Copy Markdown
Owner

This PR adds a new command logseq-todo to scripts/issue_manager.py that generates Logseq-formatted TODO blocks from GitHub issues. This facilitates the workflow defined in .github/instructions/logseq-knowledge-base.instructions.md.

Features:

  • Generates TODOs with correct tags, priority, and type based on issue labels.
  • Includes links to the issue and assignee information.
  • Adds unit tests in tests/test_issue_manager_logseq.py.

This PR replaces the feature part of #125, which was polluted with infrastructure changes.

actions-user and others added 30 commits November 17, 2025 12:54
Implement comprehensive solution for automatic MCP server configuration
and persona activation for local AI agents.

Features:
- MCP configuration parser (config_parser.py)
  - Parse .hypertool/mcp_servers.json (8 MCP servers)
  - Support repository URIs (GitHub, GitMCP, NPM, Docker)
  - Generate ~/.config/mcp/mcp_settings.json for VS Code + Cline

- Persona auto-activator (persona_activator.py)
  - Workspace context analysis (detect backend, frontend, testing, etc.)
  - Auto-select persona based on detected patterns
  - Map MCP tools to personas (6 personas supported)
  - Generate .vscode/copilot-persona.json and .cline/persona-config.json
  - Integrate with AGENTS.md

- One-command setup script (setup_auto_integration.sh)
  - Validate prerequisites
  - Run config parser and persona activator
  - Validate file discovery paths
  - Show configuration summary

- Complete documentation
  - Implementation guide (AUTO_INTEGRATION_IMPLEMENTATION.md)
  - Status report (AUTO_INTEGRATION_STATUS_REPORT.md)
  - Scripts README with examples

Implementation Details:
- Setup time: < 1 minute (one script execution)
- Manual configuration: None (zero-config experience)
- Configuration files: 3 auto-generated
- MCP servers: 8 available
- Personas: 6 supported with tool mappings

Persona Mappings:
- tta-backend-engineer: context7, github, sequential-thinking
- tta-frontend-engineer: context7, playwright, github
- tta-testing-specialist: playwright, github, sequential-thinking
- tta-observability-expert: grafana, github, context7
- tta-devops-engineer: github, grafana, sequential-thinking
- tta-data-scientist: context7, sequential-thinking

Quick Start:
  bash scripts/mcp/setup_auto_integration.sh
  # Reload VS Code
  # Test: @workspace #tta-agent-dev Show me docs for RetryPrimitive

Files:
- scripts/mcp/config_parser.py (300+ lines)
- scripts/mcp/persona_activator.py (250+ lines)
- scripts/mcp/setup_auto_integration.sh (150+ lines)
- scripts/mcp/README.md
- docs/mcp/AUTO_INTEGRATION_IMPLEMENTATION.md
- docs/mcp/AUTO_INTEGRATION_STATUS_REPORT.md
- Add git_manager.py: Python tool for intelligent repo management
  - Interactive cleanup wizard
  - Branch analysis (merged, experimental, stale)
  - Stash management with preview
  - Comprehensive status dashboard

- Add git_cleanup.sh: Automated cleanup script
  - Guided cleanup process
  - Automatic backup creation
  - Safe branch and stash handling

- Add documentation:
  - GIT_CLEANUP_PLAN.md: Detailed cleanup strategy
  - GIT_MANAGEMENT_SUMMARY.md: Usage guide and examples

Reduces branch count by 36% (44 → 28 branches)
Provides tools for ongoing repository maintenance
Phase 1 Complete - Archive Consolidation:
- Moved all archive/ subdirectories to _archive/
- Created _archive/README.md with comprehensive documentation
- Organized into: legacy/, packages/, planning/, status-reports/, etc.
- Preserves Git history via git mv
- Documents restoration process

Related: #113 (Repository Reorganization)
Part of: Repo reorg Phase 1/5
Phase 2 Planning - Package Discovery:
- Investigated all 8 active workspace packages (not 3 as scoped)
- Categorized into platform (7) vs apps (1)
- Analyzed architecture, purpose, deployment targets
- Created migration recommendations

Key Findings:
- Platform packages: primitives, observability, agent-context,
  integrations, documentation, kb-automation, agent-coordination
- Application package: observability-ui (VS Code component)
- Integration ecosystem context (MCP registry, external MCPs)
- Deployment targets: CLI, MCP servers, VS Code extension

Documentation:
- PACKAGE_INVESTIGATION_ANALYSIS.md: Comprehensive 800+ line analysis
- PACKAGE_INVESTIGATION_SUMMARY.md: Quick reference guide

Related: #113 (updated with findings)
Part of: Repo reorg Phase 2 planning
…latform/primitives

- Moved packages/tta-dev-primitives → platform/primitives/
- Updated pyproject.toml workspace member path
- Created backward-compatibility symlink packages/tta-dev-primitives → platform/primitives/
- Core tests pass (import errors are for optional integration dependencies)

Batch 1 Package 1/3 - Core Platform Migration
Part of repository reorganization (issue #113)
…tegration to platform/observability

- Moved packages/tta-observability-integration → platform/observability/
- Updated pyproject.toml workspace member path
- Created backward-compatibility symlink packages/tta-observability-integration → platform/observability/

Batch 1 Package 2/3 - Core Platform Migration
Part of repository reorganization (issue #113)
…ext to platform/agent-context

- Moved packages/universal-agent-context → platform/agent-context/
- Updated pyproject.toml workspace member path
- Created backward-compatibility symlink packages/universal-agent-context → platform/agent-context/

Batch 1 Package 3/3 - Core Platform Migration COMPLETE
Part of repository reorganization (issue #113)
…ination to platform/agent-coordination

- Moved packages/tta-agent-coordination → platform/agent-coordination/
- Updated pyproject.toml workspace member path
- Created backward-compatibility symlink packages/tta-agent-coordination → platform/agent-coordination/

Batch 2 Package 1/4 - Extended Platform Migration
Part of repository reorganization (issue #113)
…to platform/integrations

- Moved packages/tta-dev-integrations → platform/integrations/
- Updated pyproject.toml workspace member path
- Created backward-compatibility symlink packages/tta-dev-integrations → platform/integrations/

Batch 2 Package 2/4 - Extended Platform Migration
Part of repository reorganization (issue #113)
…imitives to platform/documentation

- Moved packages/tta-documentation-primitives → platform/documentation/
- Updated pyproject.toml workspace member path
- Created backward-compatibility symlink packages/tta-documentation-primitives → platform/documentation/

Batch 2 Package 3/4 - Extended Platform Migration
Part of repository reorganization (issue #113)
… platform/kb-automation

- Moved packages/tta-kb-automation → platform/kb-automation/
- Updated pyproject.toml workspace member path
- Created backward-compatibility symlink packages/tta-kb-automation → platform/kb-automation/

Batch 2 Package 4/4 - Extended Platform Migration COMPLETE
Part of repository reorganization (issue #113)
…-ui to apps/observability-ui

- Moved packages/tta-observability-ui → apps/observability-ui/
- Updated pyproject.toml workspace member path
- Created backward-compatibility symlink packages/tta-observability-ui → apps/observability-ui/

Batch 3 Package 1/1 - Application Migration COMPLETE
All 8 packages successfully migrated!
Part of repository reorganization (issue #113)
…ymlinks

- Removed packages/* symlinks (they interfered with uv workspace resolution)
- Regenerated uv.lock with new package paths (platform/*, apps/*)
- Removed package-level uv.lock files (platform/primitives, platform/observability)
- All packages now resolve correctly in workspace
- Tests passing with new structure

Note: Backward compatibility maintained through import paths, not symlinks
Part of repository reorganization (issue #113)
- Documents complete migration of 8 packages
- Includes batch breakdown, commit history, technical decisions
- Validation results and next steps (Phase 4: docs)
- Success criteria tracking

Part of repository reorganization (issue #113)
- Tested core packages: primitives (6/6), agent-context (19/19)
- Validated workspace resolution (141 packages, uv sync success)
- Tested examples (agent_patterns_simple.py working)
- Documented 2 pre-existing non-blocking issues
- All migration success criteria met
- Ready for Phase 4 (documentation updates)
- Issue #116: Fix observability test imports
- Issue #117: Configure pytest for streamlit-mvp
- Documents follow-up actions with tracking numbers
- Update package paths: packages/* → platform/* and apps/*
- Update documentation links to reflect new structure
- Update test commands with new paths
- Update quality check commands
- Update examples paths
- Comprehensive restructuring of production packages section
- Add repository structure diagram showing platform/apps split
- Update repository structure diagram
- Update production packages table with platform/* paths
- Update all primitive example links
- Update observability UI path: apps/observability-ui
- Update package-specific AGENTS.md references
- Comprehensive path updates for all package references
…cture

- Update all source code links: packages/tta-dev-primitives → platform/primitives
- Update documentation links
- Update examples paths
- Comprehensive primitive reference updates
…tform/apps structure

- Update pyright commands: packages/ → platform/ apps/
- Update package paths
- Update repository structure diagram
- Update example paths and test commands
…ucture

- Update all docs/ markdown files with new package paths
- Update GETTING_STARTED.md package references
- Update CONTRIBUTING.md examples and paths
- Update MCP_SERVERS.md package paths
- Comprehensive documentation alignment with new structure
…ws to experimental branch

- Created experimental/workflow-agent-integrations branch
- Moved all 10 Gemini workflows to .github/workflows/experimental/gemini/
- Separated experimental from production workflows
- Added comprehensive documentation:
  - .github/workflows/experimental/README.md
  - .github/workflows/WORKFLOW_FILE_NOTE.md (updated)
  - GITHUB_WORKFLOWS_EXPERT_GUIDE.md (new expert guide)

Gemini workflows moved (experimental testing only):
1. gemini-dispatch.yml
2. gemini-invoke-advanced.yml
3. gemini-invoke.yml
4. gemini-review.yml
5. gemini-test-minimal.yml
6. gemini-triage.yml
7. list-gemini-models.yml
8. test-gemini-api-key.yml
9. test-gemini-cli-no-mcp.yml
10. test-gemini-keys.yml

This organization allows safe testing of AI agent integrations
(@gemini, @copilot, @cline) without affecting production workflows.

Related: GitHub Actions workflow organization and AI agent integration testing
… authentication errors

- Commented out GCP-specific authentication parameters (gcp_location, gcp_project_id, gcp_service_account, gcp_workload_identity_provider)
- Disabled use_vertex_ai (requires GCP auth)
- Set telemetry.enabled to false (was causing 'Could not load default credentials' error)

Root cause: Workflows were trying to export telemetry to Google Cloud Platform,
which requires Workload Identity Federation auth. This is unnecessary for
experimental workflows using direct Gemini API key authentication.

Files fixed:
- gemini-triage.yml
- gemini-review.yml
- gemini-test-minimal.yml
- test-gemini-cli-no-mcp.yml

Workflows now use simple API key auth without GCP dependencies.

Related: #117 (experimental workflow testing)
Fixes: Google Cloud credentials authentication error in Gemini CLI workflows
- Move 47 files to proper docs/ subdirectories
- Create organized structure: status-reports, guides, architecture, troubleshooting
- Consolidate workspace configs to .vscode/workspaces/
- Archive historical files to _archive/historical/
- Add cleanup automation: scripts/cleanup_workspace.sh
- Update .gitignore for temporary files (logs, demos, test outputs)
- Create comprehensive organization guides
- 78% reduction in root-level clutter (40+ → 9 essential docs)

Benefits:
- Clear navigation for AI agents and developers
- Minimal context load at root level
- Professional, maintainable structure
- Automated cleanup prevents future disorganization

Documentation:
- docs/WORKSPACE_ORGANIZATION.md - Complete guide
- docs/status-reports/WORKSPACE_CLEANUP_COMPLETE.md - Detailed report
- docs/guides/quick-actions/WORKSPACE_MAINTENANCE.md - Quick reference
…cleanup

- Automated script to help other worktrees integrate cleanup changes
- Provides merge, cherry-pick, and rebase options
- Handles uncommitted changes safely with stash option
- Includes post-integration checklist
…cleanup

- Detailed integration guide for all worktrees
- Automated and manual integration options
- Worktree-specific notes and considerations
- Post-integration checklist
Copilot AI review requested due to automatic review settings November 29, 2025 19:12
@github-actions

Copy link
Copy Markdown

👋 Welcome @theinterneti!

Thanks for your contribution! Here's how to work with this repo the lazy way:

🤖 Quick Setup

# Make script executable
chmod +x scripts/lazy_dev.py

# Run interactive mode
./scripts/lazy_dev.py

🚀 Common Tasks

# Check status
./scripts/lazy_dev.py status

# Start new work
./scripts/lazy_dev.py work-on "your feature"

# Create PR (AI-powered!)
./scripts/lazy_dev.py pr

🤝 Agent Collaboration

  • @copilot is automatically assigned to review this PR
  • You can request help: @copilot please review the error handling
  • For CLI collaboration: @cline implement the suggested changes

📚 Resources


🤖 This is an automated message. The lazy_dev.py script was created to make your life easier!

Copilot AI 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.

Pull request overview

This PR adds a new logseq-todo command to scripts/issue_manager.py that generates Logseq-formatted TODO blocks from GitHub issues. This feature supports the workflow documented in .github/instructions/logseq-knowledge-base.instructions.md by automating the creation of properly formatted TODOs with tags, priorities, types, and metadata based on GitHub issue labels.

Key Changes:

  • Added logseq-todo command to issue manager for generating Logseq-formatted TODOs from GitHub issues
  • Added comprehensive unit tests for the new functionality
  • Updated documentation and configuration files to reflect repository reorganization

Reviewed changes

Copilot reviewed 15 out of 1176 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
_archive/nested_copies/TTA.dev Added subproject commit reference
_archive/README.md Removed archive directory documentation (file deleted)
README.md Updated repository structure to include additional directories (config, docs, playbooks, scripts, tests)
PRIMITIVES_CATALOG.md Added documentation for GitCollaborationPrimitive and collaboration primitives category
CONTRIBUTING.md Updated type checking paths from packages/ to platform/ apps/
.vscode/settings.json Updated Python interpreter path to absolute path
.serena/project.yml Added Serena project configuration file
.serena/.gitignore Added gitignore for Serena cache directory
.hypertool/mcp_servers.json Extensive updates to MCP server configurations including new servers and environment variable changes
.github/copilot-instructions.md Updated test coverage paths from packages to platform and apps
.agent-notifications/*.json Added multiple agent notification files for tracking commits

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread .vscode/settings.json
@@ -1,5 +1,5 @@
{
"python.defaultInterpreterPath": ".venv/bin/python",
"python.defaultInterpreterPath": "/home/thein/repos/TTA.dev-copilot/.venv/bin/python",

Copilot AI Nov 29, 2025

Copy link

Choose a reason for hiding this comment

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

Hard-coded absolute path to user's home directory should be replaced with a relative path or environment variable. Use .venv/bin/python instead to ensure portability across different development environments.

Suggested change
"python.defaultInterpreterPath": "/home/thein/repos/TTA.dev-copilot/.venv/bin/python",
"python.defaultInterpreterPath": ".venv/bin/python",

Copilot uses AI. Check for mistakes.
"serena", "start-mcp-server",
"--context", "ide-assistant",
"--project", "/home/thein/repos/TTA.dev-copilot"
"--project", "/home/thein/repos/TTA.dev-cline"

Copilot AI Nov 29, 2025

Copy link

Choose a reason for hiding this comment

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

Hard-coded absolute path to user's home directory should be replaced with a relative path or environment variable to ensure portability across different development environments.

Suggested change
"--project", "/home/thein/repos/TTA.dev-cline"
"--project", "${HOME}/repos/TTA.dev-cline"

Copilot uses AI. Check for mistakes.
"branch": "feature/logseq-github-todos",
"commit": "6dd5ead5c3facc0653e596b3579868daa20b86f6",
"message": "[agent:unknown] feat: add GitHub to Logseq TODO generator",
"worktree": "/home/thein/repos/TTA.dev",

Copilot AI Nov 29, 2025

Copy link

Choose a reason for hiding this comment

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

Agent notification files contain hard-coded absolute paths that may not be portable across environments. Consider if these files should be tracked in version control, as they appear to be runtime/instance-specific data.

Suggested change
"worktree": "/home/thein/repos/TTA.dev",

Copilot uses AI. Check for mistakes.
"branch": "agent/cline",
"commit": "d707b1f4a7e16a53cec8129634341bdfa36bedd6",
"message": "[agent:cline] PHASE 1B,2,3: Implement layered capability registry with MCP expansion and coordination workflows",
"worktree": "/home/thein/repos/TTA.dev-cline",

Copilot AI Nov 29, 2025

Copy link

Choose a reason for hiding this comment

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

Agent notification files contain hard-coded absolute paths that may not be portable across environments. Consider if these files should be tracked in version control, as they appear to be runtime/instance-specific data.

Copilot uses AI. Check for mistakes.
"branch": "agent/cline",
"commit": "97887efb98f2c94b7a70b5c3ee01d881058562a0",
"message": "[agent:cline] feat: implement MCP-native layered persona architecture (L0-L4)",
"worktree": "/home/thein/repos/TTA.dev-cline",

Copilot AI Nov 29, 2025

Copy link

Choose a reason for hiding this comment

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

Agent notification files contain hard-coded absolute paths that may not be portable across environments. Consider if these files should be tracked in version control, as they appear to be runtime/instance-specific data.

Suggested change
"worktree": "/home/thein/repos/TTA.dev-cline",

Copilot uses AI. Check for mistakes.
"branch": "agent/cline",
"commit": "5689c39896e0dab20cbd4a72eb53b122282a2d5a",
"message": "[agent:cline] adaptive_cline_demo",
"worktree": "/home/thein/repos/TTA.dev-cline",

Copilot AI Nov 29, 2025

Copy link

Choose a reason for hiding this comment

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

Agent notification files contain hard-coded absolute paths that may not be portable across environments. Consider if these files should be tracked in version control, as they appear to be runtime/instance-specific data.

Copilot uses AI. Check for mistakes.
"branch": "agent/cline",
"commit": "53b0cb6924f58886ff55230cd1effb2fa007b70c",
"message": "[agent:cline] fix: resolve syntax error in adaptive_cline_demo.py",
"worktree": "/home/thein/repos/TTA.dev-cline",

Copilot AI Nov 29, 2025

Copy link

Choose a reason for hiding this comment

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

Agent notification files contain hard-coded absolute paths that may not be portable across environments. Consider if these files should be tracked in version control, as they appear to be runtime/instance-specific data.

Suggested change
"worktree": "/home/thein/repos/TTA.dev-cline",

Copilot uses AI. Check for mistakes.
- Docker images: docker:image-name
"""
# GitMCP format
if "gitmcp.io" in repo_uri:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

The string
gitmcp.io
may be at an arbitrary position in the sanitized URL.

Copilot Autofix

AI 10 months ago

The best way to fix the problem is to parse the input URL first, and then check the hostname (and optionally scheme) to see if it matches gitmcp.io or a subdomain thereof. Specifically, use urlparse to extract the hostname and match it with either 'gitmcp.io' or strings that end with .gitmcp.io. This ensures the logic only triggers on true gitmcp.io domains and is not confused by other parts of the URL containing the substring. The edit should be made in the parse_repo_uri method in scripts/mcp/config_parser.py, specifically replacing the substring check on line 55 with a check on the parsed hostname.


Suggested changeset 1
scripts/mcp/config_parser.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/scripts/mcp/config_parser.py b/scripts/mcp/config_parser.py
--- a/scripts/mcp/config_parser.py
+++ b/scripts/mcp/config_parser.py
@@ -52,7 +52,9 @@
         - Docker images: docker:image-name
         """
         # GitMCP format
-        if "gitmcp.io" in repo_uri:
+        parsed = urlparse(repo_uri)
+        host = parsed.hostname
+        if host == "gitmcp.io" or (host is not None and host.endswith(".gitmcp.io")):
             # Extract owner/repo from URL
             match = re.search(r"gitmcp\.io/([^/]+/[^/]+)", repo_uri)
             if match:
EOF
@@ -52,7 +52,9 @@
- Docker images: docker:image-name
"""
# GitMCP format
if "gitmcp.io" in repo_uri:
parsed = urlparse(repo_uri)
host = parsed.hostname
if host == "gitmcp.io" or (host is not None and host.endswith(".gitmcp.io")):
# Extract owner/repo from URL
match = re.search(r"gitmcp\.io/([^/]+/[^/]+)", repo_uri)
if match:
Copilot is powered by AI and may make mistakes. Always verify output.
}

# GitHub repository
if "github.com" in repo_uri:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

The string
github.com
may be at an arbitrary position in the sanitized URL.

Copilot Autofix

AI 10 months ago

The best way to fix the problem is, rather than checking for "github.com" as a substring in the URL, to parse the URL using urlparse and then verify that its hostname is exactly "github.com" or ends with .github.com (if you want to allow subdomains). The change should occur within the method parse_repo_uri, specifically on line 66 where the check is performed. No changes to the rest of the code are necessary; just update the logic for checking the GitHub hostname.

All necessary imports (from urllib.parse import urlparse) are already present.


Suggested changeset 1
scripts/mcp/config_parser.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/scripts/mcp/config_parser.py b/scripts/mcp/config_parser.py
--- a/scripts/mcp/config_parser.py
+++ b/scripts/mcp/config_parser.py
@@ -63,8 +63,8 @@
                 }
 
         # GitHub repository
-        if "github.com" in repo_uri:
-            parsed = urlparse(repo_uri)
+        parsed = urlparse(repo_uri)
+        if parsed.hostname == "github.com":
             path_parts = parsed.path.strip("/").split("/")
             if len(path_parts) >= 2:
                 owner, repo = path_parts[0], path_parts[1]
EOF
@@ -63,8 +63,8 @@
}

# GitHub repository
if "github.com" in repo_uri:
parsed = urlparse(repo_uri)
parsed = urlparse(repo_uri)
if parsed.hostname == "github.com":
path_parts = parsed.path.strip("/").split("/")
if len(path_parts) >= 2:
owner, repo = path_parts[0], path_parts[1]
Copilot is powered by AI and may make mistakes. Always verify output.

# Generate name if not provided
if not name:
if "gitmcp.io" in repo_uri:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

The string
gitmcp.io
may be at an arbitrary position in the sanitized URL.

Copilot Autofix

AI 10 months ago

The best way to fix this is to parse repo_uri as a URL with urlparse and check that its host matches gitmcp.io, rather than simply checking if the string "gitmcp.io" is present anywhere in repo_uri. This also applies to the next check for "github.com". Both cases should guard against subdomain spoofing. The safest fix is to parse the host, then check that it is exactly (or ends with .gitmcp.io/.github.com if subdomains are allowed) the target domain. The string method used here is for generating a default name, so the logic should stay unchanged except for the host matching, preserving function.

Edits should be made in the method add_repo_uri() between lines 223 and 234, affecting the conditional chains using substring checks for gitmcp.io and github.com. The code should use urlparse to extract the host (hostname). If using a non-standard URL scheme (i.e., npm: or docker:), the string-based logic can remain unchanged for those cases. Only the checks for git-hosted URLs using HTTP/HTTPS should use host-based parsing.

No additional imports are necessary, as urlparse is already imported.

Suggested changeset 1
scripts/mcp/config_parser.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/scripts/mcp/config_parser.py b/scripts/mcp/config_parser.py
--- a/scripts/mcp/config_parser.py
+++ b/scripts/mcp/config_parser.py
@@ -221,9 +221,10 @@
 
         # Generate name if not provided
         if not name:
-            if "gitmcp.io" in repo_uri:
+            parsed = urlparse(repo_uri)
+            if parsed.hostname == "gitmcp.io":
                 name = repo_uri.split("/")[-1]
-            elif "github.com" in repo_uri:
+            elif parsed.hostname == "github.com":
                 name = repo_uri.split("/")[-1]
             elif repo_uri.startswith("npm:"):
                 name = repo_uri[4:].replace("@", "").replace("/", "-")
@@ -231,7 +231,6 @@
                 name = repo_uri[7:].replace("/", "-")
             else:
                 name = "custom-server"
-
         # Add to config
         config["mcpServers"][name] = server_config
 
EOF
@@ -221,9 +221,10 @@

# Generate name if not provided
if not name:
if "gitmcp.io" in repo_uri:
parsed = urlparse(repo_uri)
if parsed.hostname == "gitmcp.io":
name = repo_uri.split("/")[-1]
elif "github.com" in repo_uri:
elif parsed.hostname == "github.com":
name = repo_uri.split("/")[-1]
elif repo_uri.startswith("npm:"):
name = repo_uri[4:].replace("@", "").replace("/", "-")
@@ -231,7 +231,6 @@
name = repo_uri[7:].replace("/", "-")
else:
name = "custom-server"

# Add to config
config["mcpServers"][name] = server_config

Copilot is powered by AI and may make mistakes. Always verify output.
if not name:
if "gitmcp.io" in repo_uri:
name = repo_uri.split("/")[-1]
elif "github.com" in repo_uri:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

The string
github.com
may be at an arbitrary position in the sanitized URL.

Copilot Autofix

AI 10 months ago

To fix this bug, the code should parse the repository URI and check if its hostname matches github.com instead of checking if "github.com" appears anywhere in the string. Use Python's urlparse from the standard library to parse the URI, then check parsed_url.hostname. Update line 226 (and the surrounding relevant logic) to use this safer check. This change will ensure that only URLs whose host is github.com are classified as such (when generating a default name). No new functionality is introduced, only safer behavior.

Suggested changeset 1
scripts/mcp/config_parser.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/scripts/mcp/config_parser.py b/scripts/mcp/config_parser.py
--- a/scripts/mcp/config_parser.py
+++ b/scripts/mcp/config_parser.py
@@ -223,7 +223,7 @@
         if not name:
             if "gitmcp.io" in repo_uri:
                 name = repo_uri.split("/")[-1]
-            elif "github.com" in repo_uri:
+            elif urlparse(repo_uri).hostname == "github.com":
                 name = repo_uri.split("/")[-1]
             elif repo_uri.startswith("npm:"):
                 name = repo_uri[4:].replace("@", "").replace("/", "-")
EOF
@@ -223,7 +223,7 @@
if not name:
if "gitmcp.io" in repo_uri:
name = repo_uri.split("/")[-1]
elif "github.com" in repo_uri:
elif urlparse(repo_uri).hostname == "github.com":
name = repo_uri.split("/")[-1]
elif repo_uri.startswith("npm:"):
name = repo_uri[4:].replace("@", "").replace("/", "-")
Copilot is powered by AI and may make mistakes. Always verify output.
@theinterneti
theinterneti merged commit 35944c1 into main Nov 29, 2025
5 of 13 checks passed
@theinterneti
theinterneti deleted the feat/logseq-todo-generator branch November 29, 2025 20:15
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.

4 participants