microsoft / microsoft/amplifier
[app-cli] Use InstallStateManager API instead of direct JSON manipulation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.1k
- Forks
- 261
- Avg merge
- 3h 28m
- Merged PRs (30d)
- 13
Description
Parent Issue
Part of #193 - Consolidate install-state.json manipulation with InstallStateManager
Depends on: #194 (foundation API must be merged first)
Summary
Update amplifier-app-cli to use the new InstallStateManager API from amplifier-foundation instead of directly manipulating install-state.json.
Scope: amplifier-app-cli
Files to Update
-
amplifier_app_cli/utils/update_executor.py- Replace
_invalidate_modules_with_missing_deps()function - Use
InstallStateManager.invalidate_modules_with_missing_deps()instead
- Replace
-
amplifier_app_cli/commands/reset.py- Replace direct JSON file deletion/manipulation
- Use
InstallStateManager.clear()instead
Files That Can Be Simplified
amplifier_app_cli/paths.pyget_install_state_path()may no longer be needed if all access goes throughInstallStateManager- Or keep it but only for constructing the
InstallStateManagerinstance
Changes Required
update_executor.py
Replace:
def _invalidate_modules_with_missing_deps() -> tuple[int, int]:
# ~60 lines of direct JSON manipulation
...
With:
def _invalidate_modules_with_missing_deps() -> tuple[int, int]:
from amplifier_foundation.modules.install_state import InstallStateManager
cache_dir = get_cache_dir() # or however you get the cache path
mgr = InstallStateManager(cache_dir)
return mgr.invalidate_modules_with_missing_deps()
reset.py
Replace direct file operations with:
from amplifier_foundation.modules.install_state import InstallStateManager
mgr = InstallStateManager(cache_dir)
mgr.clear()
mgr.save()
Acceptance Criteria
-
update_executor.pyusesInstallStateManager.invalidate_modules_with_missing_deps() -
reset.pyusesInstallStateManager.clear() - No direct JSON manipulation of install-state.json remains
- All existing tests pass
-
amplifier updatestill correctly invalidates stale modules -
amplifier reset --remove cachestill correctly clears install state
Benefits
- Single source of truth for install state logic
- Consistent behavior between proactive healing and explicit invalidation
- Easier to maintain and evolve the install state format
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with amplifier_app_cli/utils/update_executor.py and amplifier_app_cli/commands/reset.py, then inspect the InstallStateManager API from dependency #194. Run the existing test suite and verify that update invalidates stale modules and reset --remove cache clears install state without direct install-state.json manipulation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100