diff --git a/AGENTS.md b/AGENTS.md index 6fc9303f1..664418dea 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -453,9 +453,11 @@ specify init --here --agent gemini --ai-skills # With skills | `specify agent search [query]` | Search agents by name, ID, description, or tags | | `specify agent validate ` | Validate an agent pack directory | | `specify agent export ` | Export an agent pack for editing | -| `specify agent add ` | Install an agent pack from a local path | +| `specify agent add --from ` | Install an agent pack from a local directory | | `specify agent remove ` | Remove a cached/override agent pack | +> **Note:** `specify agent add ` without `--from ` is reserved for future catalog-based installation, which is not yet implemented. + ### Pack resolution order Agent packs resolve by priority (highest first): diff --git a/src/specify_cli/__init__.py b/src/specify_cli/__init__.py index ea432804b..f4378e743 100644 --- a/src/specify_cli/__init__.py +++ b/src/specify_cli/__init__.py @@ -1877,7 +1877,7 @@ def init( if use_agent_pack: from .agent_pack import resolve_agent_pack, load_bootstrap, PackResolutionError, AgentPackError try: - resolved = resolve_agent_pack(selected_ai) + resolved = resolve_agent_pack(selected_ai, project_path=project_path) agent_bootstrap = load_bootstrap(resolved.path, resolved.manifest) console.print(f"[dim]Pack-based flow: {resolved.manifest.name} ({resolved.source})[/dim]") except (PackResolutionError, AgentPackError) as exc: diff --git a/src/specify_cli/agent_pack.py b/src/specify_cli/agent_pack.py index 7899fba6e..d77404bf2 100644 --- a/src/specify_cli/agent_pack.py +++ b/src/specify_cli/agent_pack.py @@ -695,12 +695,17 @@ def remove_tracked_files( abs_path.unlink() removed.append(rel_path) - # Clean up the install manifest only when all tracked files were - # removed. If some were skipped (modified), keep the manifest so - # those files remain tracked for future teardown attempts. + # Clean up the install manifest only when no tracked files remain + # on disk. Files already deleted by the user count as gone, not + # as "remaining" — only files that still exist and were skipped + # (e.g. modified without --force) prevent manifest cleanup. if manifest_file.is_file(): - remaining = len(entries) - len(removed) - if remaining == 0: + still_on_disk = sum( + 1 for rel_path in entries + if (project_path / rel_path).is_file() + and rel_path not in removed + ) + if still_on_disk == 0: manifest_file.unlink(missing_ok=True) return removed