You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: redesign CompileContext with rich metadata and async constructor (#212)
* refactor: redesign CompileContext with rich metadata and async constructor
Replace the ad-hoc inferred_org: Option<&str> field with a properly
structured CompileContext that follows the ExecutionContext pattern:
- ado_context: Option<AdoContext> — full ADO metadata (org, project, repo)
- compile_dir: &Path — for future extensions needing path resolution
- async fn new() — resolves ADO context from git remote eagerly
- ado_org() convenience accessor
This eliminates the split where standalone.rs inferred the org inline
(30-line block) and passed it separately to generate_mcpg_config().
Now CompileContext is built once, early, and passed uniformly to all
extension methods — validate() and mcpg_servers() both receive the
same fully-populated context.
Test helpers: for_test() and for_test_with_org() avoid async in tests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: remove unused compile_dir field and simplify ado_org()
- Remove compile_dir from CompileContext (unused, was speculative).
compile_dir is still accepted by new() for ADO inference but not
stored — it can be re-added when an extension actually needs it.
- Simplify ado_org() to use and_then + ? instead of map + unwrap_or
+ filter chain. rsplit("/").next() always returns Some, so the
unwrap_or("") was unreachable.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments