napoln 0.2.7__tar.gz → 0.2.9__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.7 → napoln-0.2.9}/.gitignore +3 -0
- napoln-0.2.9/.release-please-manifest.json +3 -0
- {napoln-0.2.7 → napoln-0.2.9}/CHANGELOG.md +14 -0
- napoln-0.2.9/CLAUDE.md +1 -0
- {napoln-0.2.7 → napoln-0.2.9}/PKG-INFO +9 -1
- {napoln-0.2.7 → napoln-0.2.9}/README.md +8 -0
- {napoln-0.2.7 → napoln-0.2.9}/pyproject.toml +1 -1
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/__init__.py +1 -1
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/commands/add.py +6 -32
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/commands/config.py +5 -10
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/commands/install.py +19 -34
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/commands/list_cmd.py +2 -7
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/commands/remove.py +2 -7
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/commands/setup.py +2 -5
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/commands/upgrade.py +3 -10
- napoln-0.2.9/src/napoln/core/home.py +15 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/core/linker.py +43 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/core/resolver.py +42 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/core/store.py +21 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/integration/test_cli.py +49 -0
- napoln-0.2.9/tests/unit/test_resolve_and_store.py +55 -0
- {napoln-0.2.7 → napoln-0.2.9}/uv.lock +422 -420
- napoln-0.2.7/.release-please-manifest.json +0 -3
- {napoln-0.2.7 → napoln-0.2.9}/.github/workflows/ci.yml +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/.github/workflows/pr-title.yml +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/.github/workflows/release-please.yml +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/.github/workflows/release.yml +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/AGENTS.md +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/ARCHITECTURE.md +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/CONTRIBUTING.md +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/LICENSE +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/justfile +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/napoln-demo.gif +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/release-please-config.json +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/skills-lock.json +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/cli.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/commands/__init__.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/commands/init.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/core/__init__.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/core/agents.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/core/hasher.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/core/manifest.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/core/merger.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/core/validator.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/errors.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/output.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/prompts.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/src/napoln/skills/napoln-manage/SKILL.md +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/__init__.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/conftest.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/features/config.feature +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/features/first_run.feature +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/features/init.feature +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/features/install.feature +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/features/list.feature +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/features/setup.feature +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/features/upgrade.feature +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/fixtures/invalid-skill/SKILL.md +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/fixtures/multi-skill-repo/README.md +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/fixtures/multi-skill-repo/skills/skill-a/SKILL.md +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/fixtures/multi-skill-repo/skills/skill-b/SKILL.md +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/fixtures/valid-skill/SKILL.md +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/steps/__init__.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/steps/conftest.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/steps/test_config.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/steps/test_first_run.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/steps/test_init.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/steps/test_install.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/steps/test_list.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/steps/test_setup.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/steps/test_upgrade.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/unit/test_agents.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/unit/test_hasher.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/unit/test_linker.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/unit/test_manifest.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/unit/test_merger.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/unit/test_resolver.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/unit/test_store.py +0 -0
- {napoln-0.2.7 → napoln-0.2.9}/tests/unit/test_validator.py +0 -0
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.9](https://github.com/raiderrobert/napoln/compare/v0.2.8...v0.2.9) (2026-04-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Documentation
|
|
7
|
+
|
|
8
|
+
* clarify one SKILL.md serves every agent ([#41](https://github.com/raiderrobert/napoln/issues/41)) ([9e130aa](https://github.com/raiderrobert/napoln/commit/9e130aa41cea29b802b5916949868b8f4f81de00)), closes [#10](https://github.com/raiderrobert/napoln/issues/10)
|
|
9
|
+
|
|
10
|
+
## [0.2.8](https://github.com/raiderrobert/napoln/compare/v0.2.7...v0.2.8) (2026-04-22)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **install:** re-fetch skills when store is empty ([#39](https://github.com/raiderrobert/napoln/issues/39)) ([4e0a959](https://github.com/raiderrobert/napoln/commit/4e0a959f1dd5dc203ad05696fdefcd95feb633f4))
|
|
16
|
+
|
|
3
17
|
## [0.2.7](https://github.com/raiderrobert/napoln/compare/v0.2.6...v0.2.7) (2026-04-17)
|
|
4
18
|
|
|
5
19
|
|
napoln-0.2.9/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.9
|
|
4
4
|
Summary: A package manager for agent skills
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -147,6 +147,14 @@ All mutating commands support `--dry-run`. Use `-p` for project scope on any com
|
|
|
147
147
|
|
|
148
148
|
Gemini CLI, pi, and Codex share `~/.agents/skills/` — one placement serves all three.
|
|
149
149
|
|
|
150
|
+
### One SKILL.md for every agent
|
|
151
|
+
|
|
152
|
+
A skill is a single `SKILL.md` file. Every supported agent reads the same file;
|
|
153
|
+
napoln does not fork or transform it per agent. Agent-specific frontmatter
|
|
154
|
+
fields are optional, and each agent ignores the fields it does not understand.
|
|
155
|
+
Skill authors should keep one canonical `SKILL.md` per skill rather than
|
|
156
|
+
maintaining per-agent variants.
|
|
157
|
+
|
|
150
158
|
## Team Workflow
|
|
151
159
|
|
|
152
160
|
Install with `--project` and commit the manifest:
|
|
@@ -126,6 +126,14 @@ All mutating commands support `--dry-run`. Use `-p` for project scope on any com
|
|
|
126
126
|
|
|
127
127
|
Gemini CLI, pi, and Codex share `~/.agents/skills/` — one placement serves all three.
|
|
128
128
|
|
|
129
|
+
### One SKILL.md for every agent
|
|
130
|
+
|
|
131
|
+
A skill is a single `SKILL.md` file. Every supported agent reads the same file;
|
|
132
|
+
napoln does not fork or transform it per agent. Agent-specific frontmatter
|
|
133
|
+
fields are optional, and each agent ignores the fields it does not understand.
|
|
134
|
+
Skill authors should keep one canonical `SKILL.md` per skill rather than
|
|
135
|
+
maintaining per-agent variants.
|
|
136
|
+
|
|
129
137
|
## Team Workflow
|
|
130
138
|
|
|
131
139
|
Install with `--project` and commit the manifest:
|
|
@@ -8,6 +8,7 @@ from typing import cast
|
|
|
8
8
|
from napoln import output
|
|
9
9
|
from napoln.core import agents as agents_mod
|
|
10
10
|
from napoln.core import linker, manifest, store, validator
|
|
11
|
+
from napoln.core.home import get_napoln_home
|
|
11
12
|
from napoln.core.resolver import (
|
|
12
13
|
ParsedSource,
|
|
13
14
|
ResolvedSource,
|
|
@@ -21,12 +22,6 @@ from napoln.errors import MultipleSkillsError, ResolverError
|
|
|
21
22
|
from napoln.prompts import SkillChoice, pick_skills
|
|
22
23
|
|
|
23
24
|
|
|
24
|
-
def _get_napoln_home() -> Path:
|
|
25
|
-
import os
|
|
26
|
-
|
|
27
|
-
return Path(os.environ.get("NAPOLN_HOME", Path.home() / ".napoln"))
|
|
28
|
-
|
|
29
|
-
|
|
30
25
|
def _ensure_initialized(napoln_home: Path) -> None:
|
|
31
26
|
"""Ensure napoln home directory structure exists."""
|
|
32
27
|
napoln_home.mkdir(parents=True, exist_ok=True)
|
|
@@ -50,29 +45,6 @@ def _ensure_initialized(napoln_home: Path) -> None:
|
|
|
50
45
|
config_path.write_text(tomli_w.dumps(config))
|
|
51
46
|
|
|
52
47
|
|
|
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
48
|
def _install_bootstrap_skill(
|
|
77
49
|
napoln_home: Path,
|
|
78
50
|
home: Path,
|
|
@@ -108,7 +80,7 @@ def _install_bootstrap_skill(
|
|
|
108
80
|
|
|
109
81
|
for target_path, path_agents in placements_map.items():
|
|
110
82
|
link_mode = linker.place_skill(store_path, target_path)
|
|
111
|
-
|
|
83
|
+
linker.write_provenance(target_path, "bundled", "0.1.0", content_hash, link_mode)
|
|
112
84
|
for agent in path_agents:
|
|
113
85
|
agent_placements[agent.id] = manifest.AgentPlacement(
|
|
114
86
|
path=str(target_path),
|
|
@@ -188,7 +160,9 @@ def _install_single_skill(
|
|
|
188
160
|
for target_path, path_agents in placements_map.items():
|
|
189
161
|
try:
|
|
190
162
|
link_mode = linker.place_skill(store_path, target_path)
|
|
191
|
-
|
|
163
|
+
linker.write_provenance(
|
|
164
|
+
target_path, resolved.source_id, version, content_hash, link_mode
|
|
165
|
+
)
|
|
192
166
|
output.success(f"Placed '{skill_name}' in {target_path} ({link_mode})")
|
|
193
167
|
for agent in path_agents:
|
|
194
168
|
agent_placements[agent.id] = manifest.AgentPlacement(
|
|
@@ -300,7 +274,7 @@ def run_add(
|
|
|
300
274
|
"""
|
|
301
275
|
import os
|
|
302
276
|
|
|
303
|
-
napoln_home =
|
|
277
|
+
napoln_home = get_napoln_home()
|
|
304
278
|
home = Path(os.environ.get("HOME", Path.home()))
|
|
305
279
|
|
|
306
280
|
_ensure_initialized(napoln_home)
|
|
@@ -11,12 +11,7 @@ import tomli_w
|
|
|
11
11
|
from napoln import output
|
|
12
12
|
from napoln.core import agents as agents_mod
|
|
13
13
|
from napoln.core import manifest, store
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def _get_napoln_home() -> Path:
|
|
17
|
-
import os
|
|
18
|
-
|
|
19
|
-
return Path(os.environ.get("NAPOLN_HOME", Path.home() / ".napoln"))
|
|
14
|
+
from napoln.core.home import get_napoln_home
|
|
20
15
|
|
|
21
16
|
|
|
22
17
|
# ─── config (bare) ───────────────────────────────────────────────────────────
|
|
@@ -26,7 +21,7 @@ def run_config_show() -> int:
|
|
|
26
21
|
"""Show current configuration: home, store, agents, manifests."""
|
|
27
22
|
import os
|
|
28
23
|
|
|
29
|
-
napoln_home =
|
|
24
|
+
napoln_home = get_napoln_home()
|
|
30
25
|
home = Path(os.environ.get("HOME", Path.home()))
|
|
31
26
|
|
|
32
27
|
output.header("napoln config")
|
|
@@ -77,7 +72,7 @@ def run_config_set(key: str, value: str) -> int:
|
|
|
77
72
|
|
|
78
73
|
Keys use dot notation: e.g., "napoln.default_scope"
|
|
79
74
|
"""
|
|
80
|
-
napoln_home =
|
|
75
|
+
napoln_home = get_napoln_home()
|
|
81
76
|
config_path = napoln_home / "config.toml"
|
|
82
77
|
|
|
83
78
|
if config_path.exists():
|
|
@@ -128,7 +123,7 @@ def run_config_doctor(
|
|
|
128
123
|
json_output: bool = False,
|
|
129
124
|
) -> int:
|
|
130
125
|
"""Health check: store integrity, placements, provenance, git."""
|
|
131
|
-
napoln_home =
|
|
126
|
+
napoln_home = get_napoln_home()
|
|
132
127
|
manifest_path = manifest.get_manifest_path(napoln_home, scope, project_root)
|
|
133
128
|
|
|
134
129
|
issues: list[dict] = []
|
|
@@ -253,7 +248,7 @@ def run_config_doctor(
|
|
|
253
248
|
|
|
254
249
|
def run_config_gc(dry_run: bool = False) -> int:
|
|
255
250
|
"""Remove unreferenced store entries."""
|
|
256
|
-
napoln_home =
|
|
251
|
+
napoln_home = get_napoln_home()
|
|
257
252
|
|
|
258
253
|
# Collect all referenced store entries from both manifests
|
|
259
254
|
referenced: set[str] = set()
|
|
@@ -6,12 +6,8 @@ from pathlib import Path
|
|
|
6
6
|
|
|
7
7
|
from napoln import output
|
|
8
8
|
from napoln.core import linker, manifest, store
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def _get_napoln_home() -> Path:
|
|
12
|
-
import os
|
|
13
|
-
|
|
14
|
-
return Path(os.environ.get("NAPOLN_HOME", Path.home() / ".napoln"))
|
|
9
|
+
from napoln.core.home import get_napoln_home
|
|
10
|
+
from napoln.errors import NapolnError
|
|
15
11
|
|
|
16
12
|
|
|
17
13
|
def _sync_manifest(
|
|
@@ -26,46 +22,35 @@ def _sync_manifest(
|
|
|
26
22
|
"""
|
|
27
23
|
synced = 0
|
|
28
24
|
errors = 0
|
|
29
|
-
napoln_home =
|
|
25
|
+
napoln_home = get_napoln_home()
|
|
30
26
|
|
|
31
27
|
for skill_name, entry in sorted(mf.skills.items()):
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
try:
|
|
29
|
+
store_path = store.ensure_stored(
|
|
30
|
+
skill_name, entry.version, entry.store_hash, entry.source, napoln_home
|
|
31
|
+
)
|
|
32
|
+
except (NapolnError, OSError):
|
|
37
33
|
output.warning(
|
|
38
|
-
f"Cannot restore '{skill_name}' —
|
|
39
|
-
f"Run `napoln add` to re-fetch."
|
|
34
|
+
f"Cannot restore '{skill_name}' — source unavailable. Run `napoln add` to re-fetch."
|
|
40
35
|
)
|
|
41
36
|
errors += 1
|
|
42
37
|
continue
|
|
43
38
|
|
|
44
|
-
for
|
|
39
|
+
for _agent_id, placement in entry.agents.items():
|
|
45
40
|
placement_path = Path(placement.path).expanduser()
|
|
46
41
|
|
|
47
|
-
if placement_path.exists():
|
|
48
|
-
continue
|
|
49
|
-
|
|
50
42
|
if dry_run:
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
if not placement_path.exists():
|
|
44
|
+
output.would(f"place '{skill_name}' at {placement_path}")
|
|
45
|
+
synced += 1
|
|
53
46
|
else:
|
|
54
47
|
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,
|
|
48
|
+
result = linker.restore_placement(
|
|
49
|
+
store_path, placement_path, entry.source, entry.version, entry.store_hash
|
|
65
50
|
)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
51
|
+
if result is not None:
|
|
52
|
+
output.success(f"Restored '{skill_name}' to {placement_path}")
|
|
53
|
+
synced += 1
|
|
69
54
|
except Exception as e:
|
|
70
55
|
output.error(f"Failed to restore '{skill_name}' to {placement_path}: {e}")
|
|
71
56
|
errors += 1
|
|
@@ -85,7 +70,7 @@ def run_install(
|
|
|
85
70
|
Returns:
|
|
86
71
|
Exit code (0=success, 1=errors).
|
|
87
72
|
"""
|
|
88
|
-
napoln_home =
|
|
73
|
+
napoln_home = get_napoln_home()
|
|
89
74
|
|
|
90
75
|
if dry_run:
|
|
91
76
|
output.dry_run_header()
|
|
@@ -6,12 +6,7 @@ from pathlib import Path
|
|
|
6
6
|
|
|
7
7
|
from napoln import output
|
|
8
8
|
from napoln.core import manifest
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def _get_napoln_home() -> Path:
|
|
12
|
-
import os
|
|
13
|
-
|
|
14
|
-
return Path(os.environ.get("NAPOLN_HOME", Path.home() / ".napoln"))
|
|
9
|
+
from napoln.core.home import get_napoln_home
|
|
15
10
|
|
|
16
11
|
|
|
17
12
|
def _abbreviate_path(path: str, home: str) -> str:
|
|
@@ -204,7 +199,7 @@ def run_list(
|
|
|
204
199
|
Returns:
|
|
205
200
|
Exit code (0=always).
|
|
206
201
|
"""
|
|
207
|
-
napoln_home =
|
|
202
|
+
napoln_home = get_napoln_home()
|
|
208
203
|
|
|
209
204
|
global_mf: manifest.Manifest | None = None
|
|
210
205
|
project_mf: manifest.Manifest | None = None
|
|
@@ -7,15 +7,10 @@ from pathlib import Path
|
|
|
7
7
|
|
|
8
8
|
from napoln import output
|
|
9
9
|
from napoln.core import manifest
|
|
10
|
+
from napoln.core.home import get_napoln_home
|
|
10
11
|
from napoln.core.resolver import normalize_source_for_match
|
|
11
12
|
|
|
12
13
|
|
|
13
|
-
def _get_napoln_home() -> Path:
|
|
14
|
-
import os
|
|
15
|
-
|
|
16
|
-
return Path(os.environ.get("NAPOLN_HOME", Path.home() / ".napoln"))
|
|
17
|
-
|
|
18
|
-
|
|
19
14
|
def _resolve_from_source(
|
|
20
15
|
from_source: str,
|
|
21
16
|
mf: manifest.Manifest,
|
|
@@ -61,7 +56,7 @@ def run_remove(
|
|
|
61
56
|
Returns:
|
|
62
57
|
Exit code (0=success, 1=error).
|
|
63
58
|
"""
|
|
64
|
-
napoln_home =
|
|
59
|
+
napoln_home = get_napoln_home()
|
|
65
60
|
manifest_path = manifest.get_manifest_path(napoln_home, scope, project_root)
|
|
66
61
|
mf = manifest.read_manifest(manifest_path)
|
|
67
62
|
|
|
@@ -10,13 +10,10 @@ import tomli_w
|
|
|
10
10
|
|
|
11
11
|
from napoln import output
|
|
12
12
|
from napoln.core import agents as agents_mod
|
|
13
|
+
from napoln.core.home import get_napoln_home
|
|
13
14
|
from napoln.prompts import pick_agents
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
def _get_napoln_home() -> Path:
|
|
17
|
-
return Path(os.environ.get("NAPOLN_HOME", Path.home() / ".napoln"))
|
|
18
|
-
|
|
19
|
-
|
|
20
17
|
def _ensure_initialized(napoln_home: Path) -> None:
|
|
21
18
|
napoln_home.mkdir(parents=True, exist_ok=True)
|
|
22
19
|
(napoln_home / "store").mkdir(exist_ok=True)
|
|
@@ -53,7 +50,7 @@ def run_setup(force: bool = False) -> int:
|
|
|
53
50
|
Returns:
|
|
54
51
|
Exit code (0 on success, 1 on cancel/error).
|
|
55
52
|
"""
|
|
56
|
-
napoln_home =
|
|
53
|
+
napoln_home = get_napoln_home()
|
|
57
54
|
home = Path(os.environ.get("HOME", Path.home()))
|
|
58
55
|
config_path = napoln_home / "config.toml"
|
|
59
56
|
|
|
@@ -7,16 +7,11 @@ from typing import cast
|
|
|
7
7
|
|
|
8
8
|
from napoln import output
|
|
9
9
|
from napoln.core import linker, manifest, merger, store
|
|
10
|
+
from napoln.core.home import get_napoln_home
|
|
10
11
|
from napoln.core.resolver import ResolvedSource, parse_source, resolve_git, resolve_local
|
|
11
12
|
from napoln.errors import ResolverError
|
|
12
13
|
|
|
13
14
|
|
|
14
|
-
def _get_napoln_home() -> Path:
|
|
15
|
-
import os
|
|
16
|
-
|
|
17
|
-
return Path(os.environ.get("NAPOLN_HOME", Path.home() / ".napoln"))
|
|
18
|
-
|
|
19
|
-
|
|
20
15
|
def run_upgrade(
|
|
21
16
|
name: str | None = None,
|
|
22
17
|
version_constraint: str | None = None,
|
|
@@ -33,7 +28,7 @@ def run_upgrade(
|
|
|
33
28
|
"""
|
|
34
29
|
import os
|
|
35
30
|
|
|
36
|
-
napoln_home =
|
|
31
|
+
napoln_home = get_napoln_home()
|
|
37
32
|
home = Path(os.environ.get("HOME", Path.home()))
|
|
38
33
|
manifest_path = manifest.get_manifest_path(napoln_home, scope, project_root)
|
|
39
34
|
mf = manifest.read_manifest(manifest_path)
|
|
@@ -190,9 +185,7 @@ def _upgrade_skill(
|
|
|
190
185
|
|
|
191
186
|
# Only update provenance for clean placements
|
|
192
187
|
if not placement_conflicted:
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
_write_provenance(
|
|
188
|
+
linker.write_provenance(
|
|
196
189
|
placement_path,
|
|
197
190
|
entry.source,
|
|
198
191
|
new_version,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Resolve the napoln home directory.
|
|
2
|
+
|
|
3
|
+
The home directory holds the store, cache, and global manifest.
|
|
4
|
+
Defaults to ~/.napoln/, overridable with NAPOLN_HOME.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import os
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def get_napoln_home() -> Path:
|
|
14
|
+
"""Return the configured napoln home directory."""
|
|
15
|
+
return Path(os.environ.get("NAPOLN_HOME", Path.home() / ".napoln"))
|
|
@@ -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
|
|
|
@@ -585,3 +586,44 @@ def normalize_source_for_match(source: str) -> str:
|
|
|
585
586
|
return f"{parsed.host}/{parsed.owner}/{parsed.repo}"
|
|
586
587
|
|
|
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
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
|
+
from pathlib import Path
|
|
6
7
|
|
|
7
8
|
import pytest
|
|
8
9
|
import tomli_w
|
|
@@ -334,6 +335,54 @@ class TestInstallCommand:
|
|
|
334
335
|
result = runner.invoke(app, ["install", "--global", "--dry-run"], env=env)
|
|
335
336
|
assert result.exit_code == 0
|
|
336
337
|
|
|
338
|
+
def test_install_project_from_manifest_only(self, runner, isolated_env, local_skill):
|
|
339
|
+
"""Simulate cloning a repo that has a .napoln/manifest.toml but no store.
|
|
340
|
+
|
|
341
|
+
This is the lockfile use case: someone else ran `napoln add`, committed the
|
|
342
|
+
manifest, and a new contributor clones the repo and runs `napoln install --project`.
|
|
343
|
+
The store is empty, placements don't exist, but install should re-fetch from source.
|
|
344
|
+
"""
|
|
345
|
+
home, napoln_home, env = isolated_env
|
|
346
|
+
|
|
347
|
+
from napoln.core.hasher import hash_skill
|
|
348
|
+
|
|
349
|
+
content_hash = hash_skill(local_skill)
|
|
350
|
+
manifest_dir = Path.cwd() / ".napoln"
|
|
351
|
+
manifest_dir.mkdir(parents=True, exist_ok=True)
|
|
352
|
+
|
|
353
|
+
skill_placement = home / ".claude" / "skills" / "test-skill"
|
|
354
|
+
manifest_data = {
|
|
355
|
+
"napoln": {"schema": 1},
|
|
356
|
+
"skills": {
|
|
357
|
+
"test-skill": {
|
|
358
|
+
"source": str(local_skill),
|
|
359
|
+
"version": "1.0.0",
|
|
360
|
+
"store_hash": content_hash,
|
|
361
|
+
"installed": "2026-01-01T00:00:00Z",
|
|
362
|
+
"updated": "2026-01-01T00:00:00Z",
|
|
363
|
+
"agents": {
|
|
364
|
+
"claude-code": {
|
|
365
|
+
"path": str(skill_placement),
|
|
366
|
+
"link_mode": "copy",
|
|
367
|
+
"scope": "project",
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
}
|
|
373
|
+
(manifest_dir / "manifest.toml").write_text(tomli_w.dumps(manifest_data))
|
|
374
|
+
|
|
375
|
+
# No store, no placements — fresh clone state
|
|
376
|
+
assert not (napoln_home / "store" / "test-skill").exists()
|
|
377
|
+
assert not skill_placement.exists()
|
|
378
|
+
|
|
379
|
+
result = runner.invoke(app, ["install", "--project"], env=env)
|
|
380
|
+
|
|
381
|
+
assert result.exit_code == 0
|
|
382
|
+
assert "Restored" in result.output
|
|
383
|
+
assert skill_placement.exists()
|
|
384
|
+
assert (skill_placement / "SKILL.md").exists()
|
|
385
|
+
|
|
337
386
|
|
|
338
387
|
class TestInitCommand:
|
|
339
388
|
def test_init_with_name(self, runner, tmp_path):
|