napoln 0.2.6__tar.gz → 0.2.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- napoln-0.2.8/.release-please-manifest.json +3 -0
- {napoln-0.2.6 → napoln-0.2.8}/CHANGELOG.md +15 -1
- napoln-0.2.8/CLAUDE.md +1 -0
- {napoln-0.2.6 → napoln-0.2.8}/PKG-INFO +21 -2
- {napoln-0.2.6 → napoln-0.2.8}/README.md +20 -1
- {napoln-0.2.6 → napoln-0.2.8}/pyproject.toml +1 -1
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/__init__.py +1 -1
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/cli.py +11 -3
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/commands/add.py +4 -25
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/commands/install.py +16 -26
- napoln-0.2.8/src/napoln/commands/remove.py +152 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/commands/upgrade.py +1 -3
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/core/linker.py +43 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/core/resolver.py +84 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/core/store.py +21 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/skills/napoln-manage/SKILL.md +16 -2
- {napoln-0.2.6 → napoln-0.2.8}/tests/integration/test_cli.py +147 -0
- napoln-0.2.8/tests/unit/test_resolve_and_store.py +55 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/unit/test_resolver.py +57 -0
- {napoln-0.2.6 → napoln-0.2.8}/uv.lock +422 -420
- napoln-0.2.6/.release-please-manifest.json +0 -3
- napoln-0.2.6/src/napoln/commands/remove.py +0 -72
- {napoln-0.2.6 → napoln-0.2.8}/.github/workflows/ci.yml +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/.github/workflows/pr-title.yml +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/.github/workflows/release-please.yml +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/.github/workflows/release.yml +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/.gitignore +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/AGENTS.md +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/ARCHITECTURE.md +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/CONTRIBUTING.md +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/LICENSE +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/justfile +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/napoln-demo.gif +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/release-please-config.json +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/skills-lock.json +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/commands/__init__.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/commands/config.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/commands/init.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/commands/list_cmd.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/commands/setup.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/core/__init__.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/core/agents.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/core/hasher.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/core/manifest.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/core/merger.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/core/validator.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/errors.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/output.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/src/napoln/prompts.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/__init__.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/conftest.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/features/config.feature +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/features/first_run.feature +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/features/init.feature +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/features/install.feature +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/features/list.feature +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/features/setup.feature +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/features/upgrade.feature +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/fixtures/invalid-skill/SKILL.md +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/fixtures/multi-skill-repo/README.md +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/fixtures/multi-skill-repo/skills/skill-a/SKILL.md +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/fixtures/multi-skill-repo/skills/skill-b/SKILL.md +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/fixtures/valid-skill/SKILL.md +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/steps/__init__.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/steps/conftest.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/steps/test_config.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/steps/test_first_run.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/steps/test_init.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/steps/test_install.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/steps/test_list.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/steps/test_setup.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/steps/test_upgrade.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/unit/test_agents.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/unit/test_hasher.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/unit/test_linker.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/unit/test_manifest.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/unit/test_merger.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/unit/test_store.py +0 -0
- {napoln-0.2.6 → napoln-0.2.8}/tests/unit/test_validator.py +0 -0
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.8](https://github.com/raiderrobert/napoln/compare/v0.2.7...v0.2.8) (2026-04-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **install:** re-fetch skills when store is empty ([#39](https://github.com/raiderrobert/napoln/issues/39)) ([4e0a959](https://github.com/raiderrobert/napoln/commit/4e0a959f1dd5dc203ad05696fdefcd95feb633f4))
|
|
9
|
+
|
|
10
|
+
## [0.2.7](https://github.com/raiderrobert/napoln/compare/v0.2.6...v0.2.7) (2026-04-17)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **remove:** accept multiple names and --from-source ([#31](https://github.com/raiderrobert/napoln/issues/31)) ([e075639](https://github.com/raiderrobert/napoln/commit/e075639b4e04cb14a6674ab503ae70d190fc13ef))
|
|
16
|
+
|
|
3
17
|
## [0.2.6](https://github.com/raiderrobert/napoln/compare/v0.2.5...v0.2.6) (2026-04-16)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -8,8 +22,8 @@
|
|
|
8
22
|
* add asciinema demo to README ([94876fa](https://github.com/raiderrobert/napoln/commit/94876fa2ec25f5c043d00b24f37c743418cc56bf))
|
|
9
23
|
* add GIF demo of agent installing skills ([7c3d6cb](https://github.com/raiderrobert/napoln/commit/7c3d6cbde2857353fe5a7ce647cc2fddbd348ab8))
|
|
10
24
|
* move demo GIF to top of README ([33eb773](https://github.com/raiderrobert/napoln/commit/33eb773d0d1aa21392ee1b0efd0ec578901a5217))
|
|
11
|
-
* reorg ([67423c9](https://github.com/raiderrobert/napoln/commit/67423c96317c64576a508d36ed22b073ccf1b70e))
|
|
12
25
|
* restructure README like uv ([8adc744](https://github.com/raiderrobert/napoln/commit/8adc7449a6bf8b37081ef2b02887cfc246355405))
|
|
26
|
+
* reorg ([67423c9](https://github.com/raiderrobert/napoln/commit/67423c96317c64576a508d36ed22b073ccf1b70e))
|
|
13
27
|
|
|
14
28
|
## [0.2.5](https://github.com/raiderrobert/napoln/compare/v0.2.4...v0.2.5) (2026-04-16)
|
|
15
29
|
|
napoln-0.2.8/CLAUDE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
AGENTS.md
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: napoln
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: A package manager for agent skills
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -102,11 +102,30 @@ napoln upgrade code-review
|
|
|
102
102
|
# ✓ Merged 'code-review' at ~/.claude/skills/code-review (2 files updated)
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
Remove one or more skills at once:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
napoln remove design-audit design-frontend design-preflight
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Remove all skills from a specific repository:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
napoln remove --from-source raiderrobert/flow
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Combine explicit names with `--from-source` filter:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
napoln remove --from-source raiderrobert/flow design-audit
|
|
121
|
+
```
|
|
122
|
+
|
|
105
123
|
## Commands
|
|
106
124
|
|
|
107
125
|
```
|
|
108
126
|
napoln add <source> Install skills from a git repo or local path
|
|
109
|
-
napoln remove <name
|
|
127
|
+
napoln remove <name>... Remove one or more skills
|
|
128
|
+
napoln remove --from-source Remove all skills from a specific repository
|
|
110
129
|
napoln upgrade [<name>] Upgrade one or all skills
|
|
111
130
|
napoln list Show installed skills and where they are placed
|
|
112
131
|
napoln install Restore skill placements from manifests
|
|
@@ -81,11 +81,30 @@ napoln upgrade code-review
|
|
|
81
81
|
# ✓ Merged 'code-review' at ~/.claude/skills/code-review (2 files updated)
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
Remove one or more skills at once:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
napoln remove design-audit design-frontend design-preflight
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Remove all skills from a specific repository:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
napoln remove --from-source raiderrobert/flow
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Combine explicit names with `--from-source` filter:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
napoln remove --from-source raiderrobert/flow design-audit
|
|
100
|
+
```
|
|
101
|
+
|
|
84
102
|
## Commands
|
|
85
103
|
|
|
86
104
|
```
|
|
87
105
|
napoln add <source> Install skills from a git repo or local path
|
|
88
|
-
napoln remove <name
|
|
106
|
+
napoln remove <name>... Remove one or more skills
|
|
107
|
+
napoln remove --from-source Remove all skills from a specific repository
|
|
89
108
|
napoln upgrade [<name>] Upgrade one or all skills
|
|
90
109
|
napoln list Show installed skills and where they are placed
|
|
91
110
|
napoln install Restore skill placements from manifests
|
|
@@ -98,7 +98,14 @@ def add(
|
|
|
98
98
|
|
|
99
99
|
@app.command()
|
|
100
100
|
def remove(
|
|
101
|
-
name: Annotated[str, typer.Argument(help="Skill name to remove.")],
|
|
101
|
+
name: Annotated[list[str], typer.Argument(help="Skill name(s) to remove.")] = [],
|
|
102
|
+
from_source: Annotated[
|
|
103
|
+
Optional[str],
|
|
104
|
+
typer.Option(
|
|
105
|
+
"--from-source",
|
|
106
|
+
help="Remove all skills from this repository (e.g., raiderrobert/flow or https://github.com/owner/repo).",
|
|
107
|
+
),
|
|
108
|
+
] = None,
|
|
102
109
|
project: Annotated[
|
|
103
110
|
bool, typer.Option("--project", "-p", help="Remove from project scope.")
|
|
104
111
|
] = False,
|
|
@@ -107,7 +114,7 @@ def remove(
|
|
|
107
114
|
] = None,
|
|
108
115
|
dry_run: Annotated[bool, typer.Option("--dry-run", help="Show what would happen.")] = False,
|
|
109
116
|
) -> None:
|
|
110
|
-
"""Remove
|
|
117
|
+
"""Remove one or more installed skills."""
|
|
111
118
|
from napoln.commands.remove import run_remove
|
|
112
119
|
|
|
113
120
|
agent_ids = [a.strip() for a in agents.split(",")] if agents else None
|
|
@@ -115,7 +122,8 @@ def remove(
|
|
|
115
122
|
project_root = Path.cwd() if project else None
|
|
116
123
|
|
|
117
124
|
exit_code = run_remove(
|
|
118
|
-
|
|
125
|
+
names=name,
|
|
126
|
+
from_source=from_source,
|
|
119
127
|
agent_ids=agent_ids,
|
|
120
128
|
scope=scope,
|
|
121
129
|
project_root=project_root,
|
|
@@ -50,29 +50,6 @@ def _ensure_initialized(napoln_home: Path) -> None:
|
|
|
50
50
|
config_path.write_text(tomli_w.dumps(config))
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
def _write_provenance(
|
|
54
|
-
target_dir: Path,
|
|
55
|
-
source: str,
|
|
56
|
-
version: str,
|
|
57
|
-
store_hash: str,
|
|
58
|
-
link_mode: str,
|
|
59
|
-
) -> None:
|
|
60
|
-
"""Write the .napoln provenance file to a placement."""
|
|
61
|
-
from datetime import datetime, timezone
|
|
62
|
-
from napoln import __version__
|
|
63
|
-
|
|
64
|
-
now = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
65
|
-
provenance = (
|
|
66
|
-
f'source = "{source}"\n'
|
|
67
|
-
f'version = "{version}"\n'
|
|
68
|
-
f'store_hash = "{store_hash}"\n'
|
|
69
|
-
f'link_mode = "{link_mode}"\n'
|
|
70
|
-
f'installed = "{now}"\n'
|
|
71
|
-
f'napoln_version = "{__version__}"\n'
|
|
72
|
-
)
|
|
73
|
-
(target_dir / ".napoln").write_text(provenance)
|
|
74
|
-
|
|
75
|
-
|
|
76
53
|
def _install_bootstrap_skill(
|
|
77
54
|
napoln_home: Path,
|
|
78
55
|
home: Path,
|
|
@@ -108,7 +85,7 @@ def _install_bootstrap_skill(
|
|
|
108
85
|
|
|
109
86
|
for target_path, path_agents in placements_map.items():
|
|
110
87
|
link_mode = linker.place_skill(store_path, target_path)
|
|
111
|
-
|
|
88
|
+
linker.write_provenance(target_path, "bundled", "0.1.0", content_hash, link_mode)
|
|
112
89
|
for agent in path_agents:
|
|
113
90
|
agent_placements[agent.id] = manifest.AgentPlacement(
|
|
114
91
|
path=str(target_path),
|
|
@@ -188,7 +165,9 @@ def _install_single_skill(
|
|
|
188
165
|
for target_path, path_agents in placements_map.items():
|
|
189
166
|
try:
|
|
190
167
|
link_mode = linker.place_skill(store_path, target_path)
|
|
191
|
-
|
|
168
|
+
linker.write_provenance(
|
|
169
|
+
target_path, resolved.source_id, version, content_hash, link_mode
|
|
170
|
+
)
|
|
192
171
|
output.success(f"Placed '{skill_name}' in {target_path} ({link_mode})")
|
|
193
172
|
for agent in path_agents:
|
|
194
173
|
agent_placements[agent.id] = manifest.AgentPlacement(
|
|
@@ -6,6 +6,7 @@ from pathlib import Path
|
|
|
6
6
|
|
|
7
7
|
from napoln import output
|
|
8
8
|
from napoln.core import linker, manifest, store
|
|
9
|
+
from napoln.errors import NapolnError
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
def _get_napoln_home() -> Path:
|
|
@@ -29,43 +30,32 @@ def _sync_manifest(
|
|
|
29
30
|
napoln_home = _get_napoln_home()
|
|
30
31
|
|
|
31
32
|
for skill_name, entry in sorted(mf.skills.items()):
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
try:
|
|
34
|
+
store_path = store.ensure_stored(
|
|
35
|
+
skill_name, entry.version, entry.store_hash, entry.source, napoln_home
|
|
36
|
+
)
|
|
37
|
+
except (NapolnError, OSError):
|
|
37
38
|
output.warning(
|
|
38
|
-
f"Cannot restore '{skill_name}' —
|
|
39
|
-
f"Run `napoln add` to re-fetch."
|
|
39
|
+
f"Cannot restore '{skill_name}' — source unavailable. Run `napoln add` to re-fetch."
|
|
40
40
|
)
|
|
41
41
|
errors += 1
|
|
42
42
|
continue
|
|
43
43
|
|
|
44
|
-
for
|
|
44
|
+
for _agent_id, placement in entry.agents.items():
|
|
45
45
|
placement_path = Path(placement.path).expanduser()
|
|
46
46
|
|
|
47
|
-
if placement_path.exists():
|
|
48
|
-
continue
|
|
49
|
-
|
|
50
47
|
if dry_run:
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
if not placement_path.exists():
|
|
49
|
+
output.would(f"place '{skill_name}' at {placement_path}")
|
|
50
|
+
synced += 1
|
|
53
51
|
else:
|
|
54
52
|
try:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
from napoln.commands.add import _write_provenance
|
|
58
|
-
|
|
59
|
-
_write_provenance(
|
|
60
|
-
placement_path,
|
|
61
|
-
entry.source,
|
|
62
|
-
entry.version,
|
|
63
|
-
entry.store_hash,
|
|
64
|
-
link_mode,
|
|
53
|
+
result = linker.restore_placement(
|
|
54
|
+
store_path, placement_path, entry.source, entry.version, entry.store_hash
|
|
65
55
|
)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
if result is not None:
|
|
57
|
+
output.success(f"Restored '{skill_name}' to {placement_path}")
|
|
58
|
+
synced += 1
|
|
69
59
|
except Exception as e:
|
|
70
60
|
output.error(f"Failed to restore '{skill_name}' to {placement_path}: {e}")
|
|
71
61
|
errors += 1
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"""napoln remove — Remove an installed skill."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import shutil
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from napoln import output
|
|
9
|
+
from napoln.core import manifest
|
|
10
|
+
from napoln.core.resolver import normalize_source_for_match
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_napoln_home() -> Path:
|
|
14
|
+
import os
|
|
15
|
+
|
|
16
|
+
return Path(os.environ.get("NAPOLN_HOME", Path.home() / ".napoln"))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _resolve_from_source(
|
|
20
|
+
from_source: str,
|
|
21
|
+
mf: manifest.Manifest,
|
|
22
|
+
) -> list[str]:
|
|
23
|
+
"""Resolve --from-source to matching skill names.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
from_source: Source identifier (shorthand or URL).
|
|
27
|
+
mf: Current manifest.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
List of skill names that match the source.
|
|
31
|
+
"""
|
|
32
|
+
normalized = normalize_source_for_match(from_source)
|
|
33
|
+
matching_names: list[str] = []
|
|
34
|
+
|
|
35
|
+
for name, entry in mf.skills.items():
|
|
36
|
+
entry_source = normalize_source_for_match(entry.source)
|
|
37
|
+
if entry_source == normalized:
|
|
38
|
+
matching_names.append(name)
|
|
39
|
+
|
|
40
|
+
return matching_names
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def run_remove(
|
|
44
|
+
names: list[str],
|
|
45
|
+
from_source: str | None = None,
|
|
46
|
+
agent_ids: list[str] | None = None,
|
|
47
|
+
scope: str = "global",
|
|
48
|
+
project_root: Path | None = None,
|
|
49
|
+
dry_run: bool = False,
|
|
50
|
+
) -> int:
|
|
51
|
+
"""Execute the remove command.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
names: Skill names to remove.
|
|
55
|
+
from_source: If set, remove all skills from this repository.
|
|
56
|
+
agent_ids: If specified, only remove these agent placements.
|
|
57
|
+
scope: "global" or "project".
|
|
58
|
+
project_root: Project root for project scope.
|
|
59
|
+
dry_run: Show what would happen without applying.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
Exit code (0=success, 1=error).
|
|
63
|
+
"""
|
|
64
|
+
napoln_home = _get_napoln_home()
|
|
65
|
+
manifest_path = manifest.get_manifest_path(napoln_home, scope, project_root)
|
|
66
|
+
mf = manifest.read_manifest(manifest_path)
|
|
67
|
+
|
|
68
|
+
# Resolve --from-source to names and merge with explicit names
|
|
69
|
+
from_source_names = []
|
|
70
|
+
if from_source:
|
|
71
|
+
from_source_names = _resolve_from_source(from_source, mf)
|
|
72
|
+
if not from_source_names:
|
|
73
|
+
output.info(f"No skills found from '{from_source}'.")
|
|
74
|
+
# Merge with explicit names, avoid duplicates
|
|
75
|
+
existing = set(from_source_names)
|
|
76
|
+
for name in names:
|
|
77
|
+
if name not in existing:
|
|
78
|
+
from_source_names.append(name)
|
|
79
|
+
names = from_source_names
|
|
80
|
+
|
|
81
|
+
if not names:
|
|
82
|
+
output.info("No skills specified.")
|
|
83
|
+
return 0
|
|
84
|
+
|
|
85
|
+
if dry_run:
|
|
86
|
+
output.dry_run_header()
|
|
87
|
+
|
|
88
|
+
exit_code = 0
|
|
89
|
+
|
|
90
|
+
for name in names:
|
|
91
|
+
result = _remove_single(
|
|
92
|
+
name=name,
|
|
93
|
+
mf=mf,
|
|
94
|
+
manifest_path=manifest_path,
|
|
95
|
+
agent_ids=agent_ids,
|
|
96
|
+
dry_run=dry_run,
|
|
97
|
+
)
|
|
98
|
+
if result != 0:
|
|
99
|
+
exit_code = 1
|
|
100
|
+
|
|
101
|
+
if not dry_run:
|
|
102
|
+
# Write manifest once after all removals
|
|
103
|
+
manifest.write_manifest(mf, manifest_path)
|
|
104
|
+
|
|
105
|
+
return exit_code
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _remove_single(
|
|
109
|
+
name: str,
|
|
110
|
+
mf: manifest.Manifest,
|
|
111
|
+
manifest_path: Path,
|
|
112
|
+
agent_ids: list[str] | None,
|
|
113
|
+
dry_run: bool,
|
|
114
|
+
) -> int:
|
|
115
|
+
"""Remove a single skill from manifest and filesystem.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
0 on success, 1 on error.
|
|
119
|
+
"""
|
|
120
|
+
if name not in mf.skills:
|
|
121
|
+
output.info(f"'{name}' is not installed.")
|
|
122
|
+
return 0
|
|
123
|
+
|
|
124
|
+
entry = mf.skills[name]
|
|
125
|
+
|
|
126
|
+
# Determine which agents to remove
|
|
127
|
+
agents_to_remove = agent_ids if agent_ids else list(entry.agents.keys())
|
|
128
|
+
|
|
129
|
+
for agent_id in agents_to_remove:
|
|
130
|
+
if agent_id not in entry.agents:
|
|
131
|
+
continue
|
|
132
|
+
|
|
133
|
+
placement = entry.agents[agent_id]
|
|
134
|
+
placement_path = Path(placement.path).expanduser()
|
|
135
|
+
|
|
136
|
+
if dry_run:
|
|
137
|
+
output.would(f"remove placement {placement_path}")
|
|
138
|
+
else:
|
|
139
|
+
if placement_path.exists():
|
|
140
|
+
shutil.rmtree(placement_path)
|
|
141
|
+
output.success(f"Removed placement: {placement_path}")
|
|
142
|
+
else:
|
|
143
|
+
output.dim(f" Placement already gone: {placement_path}")
|
|
144
|
+
|
|
145
|
+
if dry_run:
|
|
146
|
+
return 0
|
|
147
|
+
|
|
148
|
+
# Update manifest - remove skill or just the agent placements
|
|
149
|
+
mf = manifest.remove_skill_from_manifest(mf, name, agent_ids)
|
|
150
|
+
output.success(f"Removed '{name}'")
|
|
151
|
+
|
|
152
|
+
return 0
|
|
@@ -190,9 +190,7 @@ def _upgrade_skill(
|
|
|
190
190
|
|
|
191
191
|
# Only update provenance for clean placements
|
|
192
192
|
if not placement_conflicted:
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
_write_provenance(
|
|
193
|
+
linker.write_provenance(
|
|
196
194
|
placement_path,
|
|
197
195
|
entry.source,
|
|
198
196
|
new_version,
|
|
@@ -93,3 +93,46 @@ def _use_copy_only(store_path: Path, target_dir: Path, already_copied: Path) ->
|
|
|
93
93
|
dst_file = target_dir / rel
|
|
94
94
|
dst_file.parent.mkdir(parents=True, exist_ok=True)
|
|
95
95
|
shutil.copy2(str(src_file), str(dst_file))
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def write_provenance(
|
|
99
|
+
target_dir: Path,
|
|
100
|
+
source: str,
|
|
101
|
+
version: str,
|
|
102
|
+
store_hash: str,
|
|
103
|
+
link_mode: str,
|
|
104
|
+
) -> None:
|
|
105
|
+
"""Write the .napoln provenance file to a placement."""
|
|
106
|
+
from datetime import datetime, timezone
|
|
107
|
+
|
|
108
|
+
from napoln import __version__
|
|
109
|
+
|
|
110
|
+
now = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
111
|
+
provenance = (
|
|
112
|
+
f'source = "{source}"\n'
|
|
113
|
+
f'version = "{version}"\n'
|
|
114
|
+
f'store_hash = "{store_hash}"\n'
|
|
115
|
+
f'link_mode = "{link_mode}"\n'
|
|
116
|
+
f'installed = "{now}"\n'
|
|
117
|
+
f'napoln_version = "{__version__}"\n'
|
|
118
|
+
)
|
|
119
|
+
(target_dir / ".napoln").write_text(provenance)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def restore_placement(
|
|
123
|
+
store_path: Path,
|
|
124
|
+
placement_path: Path,
|
|
125
|
+
source: str,
|
|
126
|
+
version: str,
|
|
127
|
+
store_hash: str,
|
|
128
|
+
) -> str | None:
|
|
129
|
+
"""Place a skill from the store if the placement doesn't already exist.
|
|
130
|
+
|
|
131
|
+
Returns the link mode ("clone" or "copy") if placed, or None if already present.
|
|
132
|
+
"""
|
|
133
|
+
if placement_path.exists():
|
|
134
|
+
return None
|
|
135
|
+
|
|
136
|
+
link_mode = place_skill(store_path, placement_path)
|
|
137
|
+
write_provenance(placement_path, source, version, store_hash, link_mode)
|
|
138
|
+
return link_mode
|
|
@@ -11,6 +11,7 @@ import subprocess
|
|
|
11
11
|
from dataclasses import dataclass
|
|
12
12
|
from pathlib import Path
|
|
13
13
|
|
|
14
|
+
from napoln.core.store import store_skill
|
|
14
15
|
from napoln.errors import MultipleSkillsError, ResolverError
|
|
15
16
|
|
|
16
17
|
|
|
@@ -543,3 +544,86 @@ def discover_skill_choices(repo_dir: Path) -> list[tuple[str, str, Path]]:
|
|
|
543
544
|
desc = _extract_description(skill_dir)
|
|
544
545
|
results.append((name, desc, skill_dir))
|
|
545
546
|
return results
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
def normalize_source_for_match(source: str) -> str:
|
|
550
|
+
"""Normalize a source identifier for matching against manifest entries.
|
|
551
|
+
|
|
552
|
+
- Strips https://github.com/ prefix and .git suffix from full URLs
|
|
553
|
+
- Converts GitHub shorthand (owner/repo) to normalized form
|
|
554
|
+
- Returns local paths unchanged
|
|
555
|
+
|
|
556
|
+
Args:
|
|
557
|
+
source: Source identifier (URL, shorthand, or local path).
|
|
558
|
+
|
|
559
|
+
Returns:
|
|
560
|
+
Normalized source identifier for matching.
|
|
561
|
+
"""
|
|
562
|
+
# Strip .git suffix
|
|
563
|
+
if source.endswith(".git"):
|
|
564
|
+
source = source[:-4]
|
|
565
|
+
|
|
566
|
+
# Strip URL scheme
|
|
567
|
+
if source.startswith("https://"):
|
|
568
|
+
source = source[8:]
|
|
569
|
+
elif source.startswith("http://"):
|
|
570
|
+
source = source[7:]
|
|
571
|
+
elif source.startswith("git@"):
|
|
572
|
+
# git@github.com:owner/repo -> github.com/owner/repo
|
|
573
|
+
source = source[4:].replace(":", "/")
|
|
574
|
+
|
|
575
|
+
# Check if already normalized (has host with domain, e.g. github.com/owner/repo)
|
|
576
|
+
# vs shorthand (owner/repo) which needs normalization
|
|
577
|
+
if "/" in source:
|
|
578
|
+
first_segment = source.split("/")[0]
|
|
579
|
+
# If first segment has a dot, it's likely a host (already normalized)
|
|
580
|
+
if "." in first_segment:
|
|
581
|
+
return source
|
|
582
|
+
|
|
583
|
+
# GitHub shorthand: owner/repo -> github.com/owner/repo
|
|
584
|
+
parsed = parse_source(source)
|
|
585
|
+
if parsed.source_type == "git" and parsed.host:
|
|
586
|
+
return f"{parsed.host}/{parsed.owner}/{parsed.repo}"
|
|
587
|
+
|
|
588
|
+
return source
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
def resolve_and_store(
|
|
592
|
+
source: str,
|
|
593
|
+
skill_name: str,
|
|
594
|
+
napoln_home: Path,
|
|
595
|
+
version_constraint: str | None = None,
|
|
596
|
+
) -> tuple[Path, str]:
|
|
597
|
+
"""Resolve a source and store the skill. Returns (store_path, content_hash).
|
|
598
|
+
|
|
599
|
+
Handles local paths, git sources, and the special "bundled" source.
|
|
600
|
+
Raises ResolverError or StoreError on failure.
|
|
601
|
+
"""
|
|
602
|
+
if source == "bundled":
|
|
603
|
+
skill_dir = Path(__file__).parent.parent / "skills" / skill_name
|
|
604
|
+
if not (skill_dir.exists() and (skill_dir / "SKILL.md").exists()):
|
|
605
|
+
raise ResolverError(f"Bundled skill '{skill_name}' not found")
|
|
606
|
+
return store_skill(skill_dir, skill_name, version_constraint or "0.1.0", napoln_home)
|
|
607
|
+
|
|
608
|
+
parsed = parse_source(source)
|
|
609
|
+
|
|
610
|
+
resolved: ResolvedSource
|
|
611
|
+
if parsed.source_type == "local":
|
|
612
|
+
resolved = resolve_local(parsed)
|
|
613
|
+
elif parsed.source_type == "git":
|
|
614
|
+
if version_constraint:
|
|
615
|
+
parsed.version = version_constraint
|
|
616
|
+
cache_dir = napoln_home / "cache"
|
|
617
|
+
cache_dir.mkdir(parents=True, exist_ok=True)
|
|
618
|
+
git_result = resolve_git(parsed, cache_dir)
|
|
619
|
+
if isinstance(git_result, ResolvedSource):
|
|
620
|
+
resolved = git_result
|
|
621
|
+
else:
|
|
622
|
+
matched = next((r for r in git_result if r.skill_name == skill_name), None)
|
|
623
|
+
if matched is None:
|
|
624
|
+
raise ResolverError(f"Skill '{skill_name}' not found in multi-skill repo")
|
|
625
|
+
resolved = matched
|
|
626
|
+
else:
|
|
627
|
+
raise ResolverError(f"Unsupported source type: {parsed.source_type}")
|
|
628
|
+
|
|
629
|
+
return store_skill(resolved.skill_dir, skill_name, resolved.version, napoln_home)
|
|
@@ -113,6 +113,27 @@ def list_stored_versions(skill_name: str, napoln_home: Path) -> list[tuple[str,
|
|
|
113
113
|
return versions
|
|
114
114
|
|
|
115
115
|
|
|
116
|
+
def ensure_stored(
|
|
117
|
+
skill_name: str,
|
|
118
|
+
version: str,
|
|
119
|
+
store_hash: str,
|
|
120
|
+
source: str,
|
|
121
|
+
napoln_home: Path,
|
|
122
|
+
) -> Path:
|
|
123
|
+
"""Return the store path for a skill, re-fetching from source if missing.
|
|
124
|
+
|
|
125
|
+
Raises ResolverError or StoreError if the skill can't be found or fetched.
|
|
126
|
+
"""
|
|
127
|
+
from napoln.core.resolver import resolve_and_store
|
|
128
|
+
|
|
129
|
+
store_path = get_stored_skill(skill_name, version, store_hash, napoln_home)
|
|
130
|
+
if store_path is not None:
|
|
131
|
+
return store_path
|
|
132
|
+
|
|
133
|
+
store_path, _ = resolve_and_store(source, skill_name, napoln_home, version_constraint=version)
|
|
134
|
+
return store_path
|
|
135
|
+
|
|
136
|
+
|
|
116
137
|
def verify_store_entry(store_path: Path) -> bool:
|
|
117
138
|
"""Verify a store entry's integrity by re-hashing.
|
|
118
139
|
|
|
@@ -24,7 +24,7 @@ runs. Use `uvx` to invoke it without relying on PATH:
|
|
|
24
24
|
uvx napoln add owner/repo # add (preferred — no PATH dependency)
|
|
25
25
|
uvx napoln list # list
|
|
26
26
|
uvx napoln upgrade # upgrade
|
|
27
|
-
uvx napoln remove <name
|
|
27
|
+
uvx napoln remove <name>... # remove (or --from-source)
|
|
28
28
|
uvx napoln install # sync from manifests
|
|
29
29
|
uvx napoln init my-skill # scaffold a new skill
|
|
30
30
|
uvx napoln config doctor # verify integrity
|
|
@@ -69,8 +69,22 @@ upstream also changed the same lines):
|
|
|
69
69
|
|
|
70
70
|
## Remove a Skill
|
|
71
71
|
|
|
72
|
+
Remove one or more skills:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
uvx napoln remove design-audit design-frontend design-preflight
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Remove all skills from a specific repository:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
uvx napoln remove --from-source raiderrobert/flow
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Combine explicit names with `--from-source` filter:
|
|
85
|
+
|
|
72
86
|
```bash
|
|
73
|
-
uvx napoln remove
|
|
87
|
+
uvx napoln remove --from-source raiderrobert/flow design-audit
|
|
74
88
|
```
|
|
75
89
|
|
|
76
90
|
## Scaffold a New Skill
|