fix: stale manifest cleanup, resolve with project_path, AGENTS.md add docs

- remove_tracked_files: count only still-existing files as remaining;
  user-deleted files no longer prevent manifest cleanup
- init --agent: pass project_path to resolve_agent_pack so project-level
  overrides (.specify/agents/) are honored during --here init
- AGENTS.md: update agent add to show --from <path> requirement and note
  catalog fetch is not yet implemented
This commit is contained in:
Manfred Riem
2026-03-23 12:44:25 -05:00
parent ca9c73da0f
commit 38ae759568
3 changed files with 14 additions and 7 deletions

View File

@@ -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 search [query]` | Search agents by name, ID, description, or tags |
| `specify agent validate <path>` | Validate an agent pack directory | | `specify agent validate <path>` | Validate an agent pack directory |
| `specify agent export <id>` | Export an agent pack for editing | | `specify agent export <id>` | Export an agent pack for editing |
| `specify agent add <id>` | Install an agent pack from a local path | | `specify agent add <id> --from <path>` | Install an agent pack from a local directory |
| `specify agent remove <id>` | Remove a cached/override agent pack | | `specify agent remove <id>` | Remove a cached/override agent pack |
> **Note:** `specify agent add <id>` without `--from <path>` is reserved for future catalog-based installation, which is not yet implemented.
### Pack resolution order ### Pack resolution order
Agent packs resolve by priority (highest first): Agent packs resolve by priority (highest first):

View File

@@ -1877,7 +1877,7 @@ def init(
if use_agent_pack: if use_agent_pack:
from .agent_pack import resolve_agent_pack, load_bootstrap, PackResolutionError, AgentPackError from .agent_pack import resolve_agent_pack, load_bootstrap, PackResolutionError, AgentPackError
try: 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) agent_bootstrap = load_bootstrap(resolved.path, resolved.manifest)
console.print(f"[dim]Pack-based flow: {resolved.manifest.name} ({resolved.source})[/dim]") console.print(f"[dim]Pack-based flow: {resolved.manifest.name} ({resolved.source})[/dim]")
except (PackResolutionError, AgentPackError) as exc: except (PackResolutionError, AgentPackError) as exc:

View File

@@ -695,12 +695,17 @@ def remove_tracked_files(
abs_path.unlink() abs_path.unlink()
removed.append(rel_path) removed.append(rel_path)
# Clean up the install manifest only when all tracked files were # Clean up the install manifest only when no tracked files remain
# removed. If some were skipped (modified), keep the manifest so # on disk. Files already deleted by the user count as gone, not
# those files remain tracked for future teardown attempts. # as "remaining" — only files that still exist and were skipped
# (e.g. modified without --force) prevent manifest cleanup.
if manifest_file.is_file(): if manifest_file.is_file():
remaining = len(entries) - len(removed) still_on_disk = sum(
if remaining == 0: 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) manifest_file.unlink(missing_ok=True)
return removed return removed