napoln 0.2.7__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.
Files changed (78) hide show
  1. napoln-0.2.8/.release-please-manifest.json +3 -0
  2. {napoln-0.2.7 → napoln-0.2.8}/CHANGELOG.md +7 -0
  3. napoln-0.2.8/CLAUDE.md +1 -0
  4. {napoln-0.2.7 → napoln-0.2.8}/PKG-INFO +1 -1
  5. {napoln-0.2.7 → napoln-0.2.8}/pyproject.toml +1 -1
  6. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/__init__.py +1 -1
  7. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/commands/add.py +4 -25
  8. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/commands/install.py +16 -26
  9. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/commands/upgrade.py +1 -3
  10. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/core/linker.py +43 -0
  11. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/core/resolver.py +42 -0
  12. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/core/store.py +21 -0
  13. {napoln-0.2.7 → napoln-0.2.8}/tests/integration/test_cli.py +49 -0
  14. napoln-0.2.8/tests/unit/test_resolve_and_store.py +55 -0
  15. {napoln-0.2.7 → napoln-0.2.8}/uv.lock +422 -420
  16. napoln-0.2.7/.release-please-manifest.json +0 -3
  17. {napoln-0.2.7 → napoln-0.2.8}/.github/workflows/ci.yml +0 -0
  18. {napoln-0.2.7 → napoln-0.2.8}/.github/workflows/pr-title.yml +0 -0
  19. {napoln-0.2.7 → napoln-0.2.8}/.github/workflows/release-please.yml +0 -0
  20. {napoln-0.2.7 → napoln-0.2.8}/.github/workflows/release.yml +0 -0
  21. {napoln-0.2.7 → napoln-0.2.8}/.gitignore +0 -0
  22. {napoln-0.2.7 → napoln-0.2.8}/AGENTS.md +0 -0
  23. {napoln-0.2.7 → napoln-0.2.8}/ARCHITECTURE.md +0 -0
  24. {napoln-0.2.7 → napoln-0.2.8}/CONTRIBUTING.md +0 -0
  25. {napoln-0.2.7 → napoln-0.2.8}/LICENSE +0 -0
  26. {napoln-0.2.7 → napoln-0.2.8}/README.md +0 -0
  27. {napoln-0.2.7 → napoln-0.2.8}/justfile +0 -0
  28. {napoln-0.2.7 → napoln-0.2.8}/napoln-demo.gif +0 -0
  29. {napoln-0.2.7 → napoln-0.2.8}/release-please-config.json +0 -0
  30. {napoln-0.2.7 → napoln-0.2.8}/skills-lock.json +0 -0
  31. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/cli.py +0 -0
  32. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/commands/__init__.py +0 -0
  33. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/commands/config.py +0 -0
  34. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/commands/init.py +0 -0
  35. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/commands/list_cmd.py +0 -0
  36. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/commands/remove.py +0 -0
  37. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/commands/setup.py +0 -0
  38. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/core/__init__.py +0 -0
  39. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/core/agents.py +0 -0
  40. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/core/hasher.py +0 -0
  41. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/core/manifest.py +0 -0
  42. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/core/merger.py +0 -0
  43. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/core/validator.py +0 -0
  44. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/errors.py +0 -0
  45. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/output.py +0 -0
  46. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/prompts.py +0 -0
  47. {napoln-0.2.7 → napoln-0.2.8}/src/napoln/skills/napoln-manage/SKILL.md +0 -0
  48. {napoln-0.2.7 → napoln-0.2.8}/tests/__init__.py +0 -0
  49. {napoln-0.2.7 → napoln-0.2.8}/tests/conftest.py +0 -0
  50. {napoln-0.2.7 → napoln-0.2.8}/tests/features/config.feature +0 -0
  51. {napoln-0.2.7 → napoln-0.2.8}/tests/features/first_run.feature +0 -0
  52. {napoln-0.2.7 → napoln-0.2.8}/tests/features/init.feature +0 -0
  53. {napoln-0.2.7 → napoln-0.2.8}/tests/features/install.feature +0 -0
  54. {napoln-0.2.7 → napoln-0.2.8}/tests/features/list.feature +0 -0
  55. {napoln-0.2.7 → napoln-0.2.8}/tests/features/setup.feature +0 -0
  56. {napoln-0.2.7 → napoln-0.2.8}/tests/features/upgrade.feature +0 -0
  57. {napoln-0.2.7 → napoln-0.2.8}/tests/fixtures/invalid-skill/SKILL.md +0 -0
  58. {napoln-0.2.7 → napoln-0.2.8}/tests/fixtures/multi-skill-repo/README.md +0 -0
  59. {napoln-0.2.7 → napoln-0.2.8}/tests/fixtures/multi-skill-repo/skills/skill-a/SKILL.md +0 -0
  60. {napoln-0.2.7 → napoln-0.2.8}/tests/fixtures/multi-skill-repo/skills/skill-b/SKILL.md +0 -0
  61. {napoln-0.2.7 → napoln-0.2.8}/tests/fixtures/valid-skill/SKILL.md +0 -0
  62. {napoln-0.2.7 → napoln-0.2.8}/tests/steps/__init__.py +0 -0
  63. {napoln-0.2.7 → napoln-0.2.8}/tests/steps/conftest.py +0 -0
  64. {napoln-0.2.7 → napoln-0.2.8}/tests/steps/test_config.py +0 -0
  65. {napoln-0.2.7 → napoln-0.2.8}/tests/steps/test_first_run.py +0 -0
  66. {napoln-0.2.7 → napoln-0.2.8}/tests/steps/test_init.py +0 -0
  67. {napoln-0.2.7 → napoln-0.2.8}/tests/steps/test_install.py +0 -0
  68. {napoln-0.2.7 → napoln-0.2.8}/tests/steps/test_list.py +0 -0
  69. {napoln-0.2.7 → napoln-0.2.8}/tests/steps/test_setup.py +0 -0
  70. {napoln-0.2.7 → napoln-0.2.8}/tests/steps/test_upgrade.py +0 -0
  71. {napoln-0.2.7 → napoln-0.2.8}/tests/unit/test_agents.py +0 -0
  72. {napoln-0.2.7 → napoln-0.2.8}/tests/unit/test_hasher.py +0 -0
  73. {napoln-0.2.7 → napoln-0.2.8}/tests/unit/test_linker.py +0 -0
  74. {napoln-0.2.7 → napoln-0.2.8}/tests/unit/test_manifest.py +0 -0
  75. {napoln-0.2.7 → napoln-0.2.8}/tests/unit/test_merger.py +0 -0
  76. {napoln-0.2.7 → napoln-0.2.8}/tests/unit/test_resolver.py +0 -0
  77. {napoln-0.2.7 → napoln-0.2.8}/tests/unit/test_store.py +0 -0
  78. {napoln-0.2.7 → napoln-0.2.8}/tests/unit/test_validator.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.2.8"
3
+ }
@@ -1,5 +1,12 @@
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
+
3
10
  ## [0.2.7](https://github.com/raiderrobert/napoln/compare/v0.2.6...v0.2.7) (2026-04-17)
4
11
 
5
12
 
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.7
3
+ Version: 0.2.8
4
4
  Summary: A package manager for agent skills
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "napoln"
3
- version = "0.2.7"
3
+ version = "0.2.8"
4
4
  description = "A package manager for agent skills"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -1,3 +1,3 @@
1
1
  """napoln — A package manager for agent skills."""
2
2
 
3
- __version__ = "0.2.7"
3
+ __version__ = "0.2.8"
@@ -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
- _write_provenance(target_path, "bundled", "0.1.0", content_hash, link_mode)
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
- _write_provenance(target_path, resolved.source_id, version, content_hash, link_mode)
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
- store_path = store.get_stored_skill(
33
- skill_name, entry.version, entry.store_hash, napoln_home
34
- )
35
-
36
- if store_path is None:
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}' — store entry missing. "
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 agent_id, placement in entry.agents.items():
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
- output.would(f"place '{skill_name}' at {placement_path}")
52
- synced += 1
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
- link_mode = linker.place_skill(store_path, placement_path)
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
- output.success(f"Restored '{skill_name}' to {placement_path}")
68
- synced += 1
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
@@ -190,9 +190,7 @@ def _upgrade_skill(
190
190
 
191
191
  # Only update provenance for clean placements
192
192
  if not placement_conflicted:
193
- from napoln.commands.add import _write_provenance
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
 
@@ -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):
@@ -0,0 +1,55 @@
1
+ """Tests for resolve_and_store in add.py."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import pytest
6
+
7
+
8
+ @pytest.fixture
9
+ def _stored_skill(skill_builder, napoln_home):
10
+ """Use resolve_and_store to store a local skill and return the result."""
11
+ from napoln.core.resolver import resolve_and_store
12
+
13
+ skill_dir = skill_builder(name="my-skill", version="1.0.0")
14
+ return resolve_and_store(
15
+ source=str(skill_dir),
16
+ skill_name="my-skill",
17
+ napoln_home=napoln_home,
18
+ )
19
+
20
+
21
+ def test_resolve_and_store_returns_store_path(_stored_skill, napoln_home):
22
+ store_path, content_hash = _stored_skill
23
+ assert store_path.exists()
24
+ assert store_path.is_dir()
25
+ assert (store_path / "SKILL.md").exists()
26
+ assert napoln_home / "store" in store_path.parents
27
+
28
+
29
+ def test_resolve_and_store_returns_content_hash(_stored_skill):
30
+ _, content_hash = _stored_skill
31
+ assert isinstance(content_hash, str)
32
+ assert len(content_hash) > 0
33
+
34
+
35
+ def test_resolve_and_store_bundled_source(napoln_home):
36
+ from napoln.core.resolver import resolve_and_store
37
+
38
+ store_path, content_hash = resolve_and_store(
39
+ source="bundled",
40
+ skill_name="napoln-manage",
41
+ napoln_home=napoln_home,
42
+ )
43
+ assert store_path.exists()
44
+ assert (store_path / "SKILL.md").exists()
45
+
46
+
47
+ def test_resolve_and_store_bad_source(napoln_home):
48
+ from napoln.core.resolver import resolve_and_store
49
+
50
+ with pytest.raises(Exception):
51
+ resolve_and_store(
52
+ source="/nonexistent/path/to/nowhere",
53
+ skill_name="ghost",
54
+ napoln_home=napoln_home,
55
+ )