Skip to content

Commit 4963e63

Browse files
fix: address code review feedback on scope implementation
Co-authored-by: sergio-sisternes-epam <207026618+sergio-sisternes-epam@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/apm/sessions/b5b08e0d-ae11-469c-b041-1397894f0e20
1 parent 6dfbf6d commit 4963e63

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

docs/src/content/docs/guides/scoped-installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ apm install microsoft/apm-sample-package
1919
- Lockfile: `./apm.lock.yaml`
2020
- Deployed primitives: `./.github/`, `./.claude/`, `./.cursor/`, `./.opencode/`
2121

22-
This is the standard behavior -- every collaborator who clones the repo gets the same setup.
22+
This is the standard behavior. Every collaborator who clones the repo gets the same setup.
2323

2424
## User scope (`--global`)
2525

src/apm_cli/commands/install.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ def install(ctx, packages, runtime, exclude, only, update, dry_run, force, verbo
567567
# Auto-bootstrap: create minimal apm.yml when packages specified but no apm.yml
568568
if not apm_yml_exists and packages:
569569
# Get current directory name as project name
570-
project_name = Path.cwd().name if scope is InstallScope.PROJECT else "user"
570+
project_name = Path.cwd().name if scope is InstallScope.PROJECT else Path.home().name
571571
config = _get_default_config(project_name)
572572
_create_minimal_apm_yml(config, target_path=manifest_path)
573573
logger.success(f"Created {manifest_display}")

src/apm_cli/core/scope.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ def ensure_user_dirs() -> Path:
105105

106106
# ---------------------------------------------------------------------------
107107
# Per-target user-level support information
108+
#
109+
# Registry used by downstream tooling (e.g. ``apm config``, diagnostics)
110+
# to report which targets support user-scope deployment and where files
111+
# will land. Not consumed directly by ``install`` / ``uninstall`` today,
112+
# but keeps target metadata co-located with scope logic.
108113
# ---------------------------------------------------------------------------
109114

110115
USER_SCOPE_TARGETS: Dict[str, Dict[str, object]] = {

tests/unit/test_install_command.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,14 +640,17 @@ def test_global_flag_shows_scope_info(self):
640640
os.chdir(self.original_dir)
641641

642642
def test_global_short_flag_g(self):
643-
"""-g short flag should work the same as --global."""
643+
"""-g short flag creates user dirs and shows scope info like --global."""
644644
with tempfile.TemporaryDirectory() as tmp_dir:
645645
try:
646646
os.chdir(tmp_dir)
647647
fake_home = Path(tmp_dir) / "fakehome"
648648
fake_home.mkdir()
649649
with patch.object(Path, "home", return_value=fake_home):
650650
result = self.runner.invoke(cli, ["install", "-g"])
651+
# Should create ~/.apm/ directory
652+
assert (fake_home / ".apm").is_dir()
653+
assert (fake_home / ".apm" / "apm_modules").is_dir()
651654
assert "user scope" in result.output.lower() or "~/.apm/" in result.output
652655
finally:
653656
os.chdir(self.original_dir)

0 commit comments

Comments
 (0)