feat(extensions): port update-agent-context to Python#3387
Merged
Conversation
Ports the agent-context extension updater to a single Python script, per github#3281 and the check-prerequisites PoC pattern from github#3302. The bash version already ran its core logic through embedded Python heredocs, so the port lifts that logic into a standalone script. Parity tests run bash and Python side by side and compare output and resulting context-file bytes. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Ports the agent-context extension’s context-file updater to a standalone Python script, alongside a new parity test suite to ensure behavior matches the existing Bash/PowerShell implementations.
Changes:
- Add
extensions/agent-context/scripts/python/update_agent_context.pyimplementing the updater logic in Python. - Add
tests/extensions/test_update_agent_context_python_parity.pyto run Bash vs Python (and some PowerShell vs Python) parity checks.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| extensions/agent-context/scripts/python/update_agent_context.py | New Python implementation of the agent-context updater (config parsing, plan resolution, section upsert, .mdc frontmatter repair). |
| tests/extensions/test_update_agent_context_python_parity.py | New parity test suite comparing Python behavior/output with Bash and PowerShell variants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ble config gate Co-authored-by: Copilot <[email protected]>
This was referenced Jul 7, 2026
Collaborator
|
Thank you! |
kanfil
added a commit
to tikalk/agentic-sdlc-spec-kit
that referenced
this pull request
Jul 8, 2026
Upstream commits merged (7): - 94c7ec2 escape TOML control chars so generated command files parse (github#3341) - 5a901a6 fall through to grep/sed when python3 is a broken stub (github#3312) - 295eb22 port update-agent-context to Python (github#3387) - ba1ce36 remove Cursor from CLI check list in README (github#3184) - 13d2cca document missing CLI flags and integrations (github#3182) - 0da969d add LLM Wiki extension to community catalog (github#3361) - a7b4391 release 0.12.8, begin 0.12.9.dev0 (github#3410) New file: src/specify_cli/_toml_string.py Conflicts: pyproject.toml (trivial version); base.py (import block — combined fork accent() with upstream _toml_string imports). Assisted-by: OpenCode (model: glm-5.2, autonomous)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Ports the agent-context extension updater to Python, per #3281. Follows the pattern from the check-prerequisites PoC (#3302): additive port, no changes to the bash or PowerShell scripts, parity tests that run both implementations side by side.
The bash version already ran its core logic through embedded Python heredocs, so this port mostly lifts that logic into a standalone script:
extensions/agent-context/scripts/python/update_agent_context.py— config parsing (context_files/context_file/markers), self-seeding frominit-options.jsonviaagent-context-defaults.json, path validation (absolute/backslash/../escape rejection), plan-path resolution (feature.jsonfirst, mtime fallback), marker upsert for all four cases (both markers, start only, end only, none), CRLF normalization, and.mdcfrontmatter repair (alwaysApply: true).tests/extensions/test_update_agent_context_python_parity.py— 22 parity tests. Bash tests compare exit code, normalized stdout/stderr, and resulting context-file bytes. PowerShell tests compare resulting file content and skip whenpwshis unavailable.Testing
uv run specify --helpuv sync && uv run pytest(3790 passed, 107 skipped)AI Disclosure
Ported and tested with GitHub Copilot CLI. I reviewed the diff and verified parity behavior manually.
Fixes #3281