Skip to content

plugin: locate core package across Copilot, VS Code, and stubbed installs - #267

Open
Çağdaş Yürekli (cagdasyurekli) wants to merge 1 commit into
microsoft:mainfrom
cagdasyurekli:fix/bootstrap-copilot-vscode-and-stub-fallback
Open

Çağdaş Yürekli (cagdasyurekli) wants to merge 1 commit into
microsoft:mainfrom
cagdasyurekli:fix/bootstrap-copilot-vscode-and-stub-fallback

Conversation

@cagdasyurekli

Copy link
Copy Markdown
Contributor

Problem

Addresses #265 and the remaining package-discovery part of #167 (left open by #241).

  1. plugin/scripts/te_bootstrap.py only inspected <home>/plugins/cache/<market>/<plugin>/<version> (Claude Code / Codex). When Copilot CLI or VS Code installs the plugin into ~/.copilot/installed-plugins/<market>/<plugin> or mirrors it under Code/agentPlugins/file-.../<hash> without symlinks (so lib/tokeneconomizer is missing or a 21-byte text stub), core_path() returned None, hooks failed open with {}, and ~/.tokeneconomizer/bin/te.json was never written.
  2. When bin/te.json is missing, the PowerShell slash commands in plugin/slash-commands/*.md threw an unhandled Get-Content ItemNotFoundException.

Fix

  • plugin/scripts/te_bootstrap.py (keeping Python 3.0 syntax and preserving _marketplace_sources behavior for existing Codex/Claude cache tests):
    • Added _extra_sources(plugin_root) to inspect:
      • Copilot installed-plugins marketplace directories (marketplaces/, .marketplaces/, plugins/marketplaces/, marketplace-cache/) and registries (config.json stripping // comments, marketplaces.json, known_marketplaces.json).
      • VS Code agentPlugins mirrors (installed.json entries including file:/// URIs, plus the user's ~/.copilot marketplaces).
      • Cross-agent ~/.claude/plugins/known_marketplaces.json (covers omp/Copilot installs sharing a local Claude checkout).
      • <TOKENECONOMIZER_HOME or ~/.tokeneconomizer>/src as a final checkout fallback.
  • plugin/slash-commands/*.md: Check Test-Path -LiteralPath $meta before reading bin\te.json, fall back to $env:COPILOT_PLUGIN_ROOT\scripts\te_bootstrap.py if available, and otherwise print a clear initialization diagnostic to stderr (reading the tail of errors.log if present).
  • plugin/README.md: Clarified under GitHub Copilot in VS Code how to supply the core package when installing without a local clone or Git symlinks.

Verification

  • Added tests in tests/test_plugin_package.py:
    • test_copilot_and_vscode_plugin_copies_find_the_core
    • test_te_bootstrap_stays_python30_compatible
    • test_powershell_slash_commands_guard_missing_te_json
    • test_powershell_slash_command_reports_cleanly_when_te_json_missing (Windows PowerShell marker)
  • Ran python -m pytest tests locally: 1247 passed, 31 skipped (Python 3.12.13, macOS).
  • Ran python scripts/dead_code.py --json: no new unreferenced or test-only symbols.

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