Skip to content

Commit 38ae759

Browse files
committed
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
1 parent ca9c73d commit 38ae759

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

AGENTS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,11 @@ specify init --here --agent gemini --ai-skills # With skills
453453
| `specify agent search [query]` | Search agents by name, ID, description, or tags |
454454
| `specify agent validate <path>` | Validate an agent pack directory |
455455
| `specify agent export <id>` | Export an agent pack for editing |
456-
| `specify agent add <id>` | Install an agent pack from a local path |
456+
| `specify agent add <id> --from <path>` | Install an agent pack from a local directory |
457457
| `specify agent remove <id>` | Remove a cached/override agent pack |
458458

459+
> **Note:** `specify agent add <id>` without `--from <path>` is reserved for future catalog-based installation, which is not yet implemented.
460+
459461
### Pack resolution order
460462

461463
Agent packs resolve by priority (highest first):

src/specify_cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1877,7 +1877,7 @@ def init(
18771877
if use_agent_pack:
18781878
from .agent_pack import resolve_agent_pack, load_bootstrap, PackResolutionError, AgentPackError
18791879
try:
1880-
resolved = resolve_agent_pack(selected_ai)
1880+
resolved = resolve_agent_pack(selected_ai, project_path=project_path)
18811881
agent_bootstrap = load_bootstrap(resolved.path, resolved.manifest)
18821882
console.print(f"[dim]Pack-based flow: {resolved.manifest.name} ({resolved.source})[/dim]")
18831883
except (PackResolutionError, AgentPackError) as exc:

src/specify_cli/agent_pack.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -695,12 +695,17 @@ def remove_tracked_files(
695695
abs_path.unlink()
696696
removed.append(rel_path)
697697

698-
# Clean up the install manifest only when all tracked files were
699-
# removed. If some were skipped (modified), keep the manifest so
700-
# those files remain tracked for future teardown attempts.
698+
# Clean up the install manifest only when no tracked files remain
699+
# on disk. Files already deleted by the user count as gone, not
700+
# as "remaining" — only files that still exist and were skipped
701+
# (e.g. modified without --force) prevent manifest cleanup.
701702
if manifest_file.is_file():
702-
remaining = len(entries) - len(removed)
703-
if remaining == 0:
703+
still_on_disk = sum(
704+
1 for rel_path in entries
705+
if (project_path / rel_path).is_file()
706+
and rel_path not in removed
707+
)
708+
if still_on_disk == 0:
704709
manifest_file.unlink(missing_ok=True)
705710
return removed
706711

0 commit comments

Comments
 (0)