napoln 0.2.12__tar.gz → 0.2.13__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 (105) hide show
  1. napoln-0.2.13/.release-please-manifest.json +3 -0
  2. {napoln-0.2.12 → napoln-0.2.13}/ARCHITECTURE.md +11 -0
  3. {napoln-0.2.12 → napoln-0.2.13}/CHANGELOG.md +18 -0
  4. {napoln-0.2.12 → napoln-0.2.13}/PKG-INFO +4 -2
  5. {napoln-0.2.12 → napoln-0.2.13}/README.md +3 -1
  6. {napoln-0.2.12 → napoln-0.2.13}/pyproject.toml +1 -1
  7. {napoln-0.2.12 → napoln-0.2.13}/release-please-config.json +5 -1
  8. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/commands/add.py +17 -8
  9. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/commands/enable.py +2 -2
  10. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/commands/install.py +2 -2
  11. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/commands/upgrade.py +68 -6
  12. napoln-0.2.13/src/napoln/core/_version.py +36 -0
  13. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/core/manifest.py +5 -2
  14. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/core/merger.py +4 -0
  15. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/core/naming.py +44 -6
  16. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/core/resolver.py +127 -22
  17. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/core/store.py +0 -21
  18. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/errors.py +5 -0
  19. {napoln-0.2.12 → napoln-0.2.13}/tests/features/add.feature +41 -0
  20. {napoln-0.2.12 → napoln-0.2.13}/tests/integration/test_cli.py +9 -0
  21. napoln-0.2.13/tests/integration/test_moved_skill.py +157 -0
  22. napoln-0.2.13/tests/integration/test_skill_identity.py +82 -0
  23. {napoln-0.2.12 → napoln-0.2.13}/tests/steps/conftest.py +7 -0
  24. {napoln-0.2.12 → napoln-0.2.13}/tests/steps/test_install.py +74 -0
  25. napoln-0.2.13/tests/unit/test_core_api_boundary.py +30 -0
  26. {napoln-0.2.12 → napoln-0.2.13}/tests/unit/test_linker.py +21 -1
  27. {napoln-0.2.12 → napoln-0.2.13}/tests/unit/test_merger.py +45 -0
  28. {napoln-0.2.12 → napoln-0.2.13}/tests/unit/test_naming.py +57 -0
  29. napoln-0.2.13/tests/unit/test_resolve_and_store.py +94 -0
  30. {napoln-0.2.12 → napoln-0.2.13}/tests/unit/test_resolver.py +92 -0
  31. napoln-0.2.13/tests/unit/test_upgrade_logic.py +139 -0
  32. napoln-0.2.13/tests/unit/test_version.py +42 -0
  33. {napoln-0.2.12 → napoln-0.2.13}/uv.lock +1 -1
  34. napoln-0.2.12/.release-please-manifest.json +0 -3
  35. napoln-0.2.12/src/napoln/core/_version.py +0 -3
  36. napoln-0.2.12/tests/unit/test_resolve_and_store.py +0 -55
  37. {napoln-0.2.12 → napoln-0.2.13}/.github/workflows/ci.yml +0 -0
  38. {napoln-0.2.12 → napoln-0.2.13}/.github/workflows/pr-title.yml +0 -0
  39. {napoln-0.2.12 → napoln-0.2.13}/.github/workflows/release-please.yml +0 -0
  40. {napoln-0.2.12 → napoln-0.2.13}/.github/workflows/release.yml +0 -0
  41. {napoln-0.2.12 → napoln-0.2.13}/.gitignore +0 -0
  42. {napoln-0.2.12 → napoln-0.2.13}/AGENTS.md +0 -0
  43. {napoln-0.2.12 → napoln-0.2.13}/CLAUDE.md +0 -0
  44. {napoln-0.2.12 → napoln-0.2.13}/CONTRIBUTING.md +0 -0
  45. {napoln-0.2.12 → napoln-0.2.13}/LICENSE +0 -0
  46. {napoln-0.2.12 → napoln-0.2.13}/docs/specs/2026-04-25-enable-command.md +0 -0
  47. {napoln-0.2.12 → napoln-0.2.13}/docs/superpowers/plans/2026-04-22-code-review-diverge-critique-converge.md +0 -0
  48. {napoln-0.2.12 → napoln-0.2.13}/docs/superpowers/plans/2026-04-25-enable-command.md +0 -0
  49. {napoln-0.2.12 → napoln-0.2.13}/docs/superpowers/plans/2026-04-28-bdd-consolidation-and-unit-tests.md +0 -0
  50. {napoln-0.2.12 → napoln-0.2.13}/docs/superpowers/reviews/2026-04-22-code-review.md +0 -0
  51. {napoln-0.2.12 → napoln-0.2.13}/docs/superpowers/reviews/2026-04-29-branch-audit-bdd-consolidation.md +0 -0
  52. {napoln-0.2.12 → napoln-0.2.13}/justfile +0 -0
  53. {napoln-0.2.12 → napoln-0.2.13}/napoln-demo.gif +0 -0
  54. {napoln-0.2.12 → napoln-0.2.13}/skills-lock.json +0 -0
  55. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/__init__.py +0 -0
  56. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/cli.py +0 -0
  57. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/commands/__init__.py +0 -0
  58. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/commands/config.py +0 -0
  59. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/commands/init.py +0 -0
  60. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/commands/list_cmd.py +0 -0
  61. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/commands/remove.py +0 -0
  62. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/commands/setup.py +0 -0
  63. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/core/__init__.py +0 -0
  64. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/core/agents.py +0 -0
  65. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/core/hasher.py +0 -0
  66. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/core/home.py +0 -0
  67. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/core/linker.py +0 -0
  68. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/core/validator.py +0 -0
  69. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/output.py +0 -0
  70. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/prompts.py +0 -0
  71. {napoln-0.2.12 → napoln-0.2.13}/src/napoln/skills/napoln-manage/SKILL.md +0 -0
  72. {napoln-0.2.12 → napoln-0.2.13}/tests/__init__.py +0 -0
  73. {napoln-0.2.12 → napoln-0.2.13}/tests/conftest.py +0 -0
  74. {napoln-0.2.12 → napoln-0.2.13}/tests/features/config.feature +0 -0
  75. {napoln-0.2.12 → napoln-0.2.13}/tests/features/first_run.feature +0 -0
  76. {napoln-0.2.12 → napoln-0.2.13}/tests/features/init.feature +0 -0
  77. {napoln-0.2.12 → napoln-0.2.13}/tests/features/list.feature +0 -0
  78. {napoln-0.2.12 → napoln-0.2.13}/tests/features/remove.feature +0 -0
  79. {napoln-0.2.12 → napoln-0.2.13}/tests/features/setup.feature +0 -0
  80. {napoln-0.2.12 → napoln-0.2.13}/tests/features/sync.feature +0 -0
  81. {napoln-0.2.12 → napoln-0.2.13}/tests/features/upgrade.feature +0 -0
  82. {napoln-0.2.12 → napoln-0.2.13}/tests/fixtures/invalid-skill/SKILL.md +0 -0
  83. {napoln-0.2.12 → napoln-0.2.13}/tests/fixtures/multi-skill-repo/README.md +0 -0
  84. {napoln-0.2.12 → napoln-0.2.13}/tests/fixtures/multi-skill-repo/skills/skill-a/SKILL.md +0 -0
  85. {napoln-0.2.12 → napoln-0.2.13}/tests/fixtures/multi-skill-repo/skills/skill-b/SKILL.md +0 -0
  86. {napoln-0.2.12 → napoln-0.2.13}/tests/fixtures/valid-skill/SKILL.md +0 -0
  87. {napoln-0.2.12 → napoln-0.2.13}/tests/steps/__init__.py +0 -0
  88. {napoln-0.2.12 → napoln-0.2.13}/tests/steps/test_config.py +0 -0
  89. {napoln-0.2.12 → napoln-0.2.13}/tests/steps/test_first_run.py +0 -0
  90. {napoln-0.2.12 → napoln-0.2.13}/tests/steps/test_init.py +0 -0
  91. {napoln-0.2.12 → napoln-0.2.13}/tests/steps/test_list.py +0 -0
  92. {napoln-0.2.12 → napoln-0.2.13}/tests/steps/test_remove.py +0 -0
  93. {napoln-0.2.12 → napoln-0.2.13}/tests/steps/test_setup.py +0 -0
  94. {napoln-0.2.12 → napoln-0.2.13}/tests/steps/test_sync.py +0 -0
  95. {napoln-0.2.12 → napoln-0.2.13}/tests/steps/test_upgrade.py +0 -0
  96. {napoln-0.2.12 → napoln-0.2.13}/tests/unit/test_add_logic.py +0 -0
  97. {napoln-0.2.12 → napoln-0.2.13}/tests/unit/test_agents.py +0 -0
  98. {napoln-0.2.12 → napoln-0.2.13}/tests/unit/test_config_logic.py +0 -0
  99. {napoln-0.2.12 → napoln-0.2.13}/tests/unit/test_enable.py +0 -0
  100. {napoln-0.2.12 → napoln-0.2.13}/tests/unit/test_hasher.py +0 -0
  101. {napoln-0.2.12 → napoln-0.2.13}/tests/unit/test_list_logic.py +0 -0
  102. {napoln-0.2.12 → napoln-0.2.13}/tests/unit/test_manifest.py +0 -0
  103. {napoln-0.2.12 → napoln-0.2.13}/tests/unit/test_remove_logic.py +0 -0
  104. {napoln-0.2.12 → napoln-0.2.13}/tests/unit/test_store.py +0 -0
  105. {napoln-0.2.12 → napoln-0.2.13}/tests/unit/test_validator.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.2.13"
3
+ }
@@ -185,6 +185,17 @@ Following the mise model, napoln supports both global and project manifests:
185
185
 
186
186
  `napoln install` syncs both manifests automatically, similar to `mise install`.
187
187
 
188
+ ### Skill Identity
189
+
190
+ A skill has two names, and they diverge on collision:
191
+
192
+ - **Install id** — the manifest key and the placement directory name (e.g. `~/.claude/skills/repo-b:shared-name/`). When two different sources ship a skill with the same upstream name, the later one is namespaced (`<namespace>:<name>`) so placements don't clash.
193
+ - **Upstream name** — the `name:` field in SKILL.md frontmatter, which normally matches the skill's source directory name. The manifest entry stores the source directory name (or `--name`) as `name`, and writes it to `manifest.toml` only when it differs from the install id. napoln never rewrites SKILL.md on placement, so the frontmatter stays as the author wrote it (`shared-name`).
194
+
195
+ **The placement directory name is the canonical installed identity.** Anything that reads from a placement (agent loaders, linters, `napoln config doctor`) should trust the directory name and treat the frontmatter `name:` as upstream provenance only. A mismatch between the two in a collision-namespaced install is expected, not an error, and `napoln config doctor` does not warn about it.
196
+
197
+ This is pinned by `tests/integration/test_skill_identity.py`.
198
+
188
199
  ---
189
200
 
190
201
  ## Core Workflows
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.13](https://github.com/dynamite-systems/napoln/compare/v0.2.12...v0.2.13) (2026-12-06)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **add:** don't print dry-run apply hints after an install error ([#127](https://github.com/dynamite-systems/napoln/issues/127)) ([aac470e](https://github.com/dynamite-systems/napoln/commit/aac470ee90c6264446a4b6add3e3825fecd7d73f))
9
+ * fall back to default branch when latest tag has no skills ([#137](https://github.com/dynamite-systems/napoln/issues/137)) ([8347db0](https://github.com/dynamite-systems/napoln/commit/8347db0e0b65399605802945bc6c197d92abb789))
10
+ * handle skills that move within their upstream repo ([#129](https://github.com/dynamite-systems/napoln/issues/129)) ([66d98ec](https://github.com/dynamite-systems/napoln/commit/66d98ec0649ed863b2504d4b9379be912d9be0f1))
11
+ * keep branch-pinned skills on their branch during upgrade ([#138](https://github.com/dynamite-systems/napoln/issues/138)) ([7b2406b](https://github.com/dynamite-systems/napoln/commit/7b2406b7d0fd3466a5b723ba1de3095424977264))
12
+ * skip non-Markdown files that already match upstream during merge ([#134](https://github.com/dynamite-systems/napoln/issues/134)) ([8ce4399](https://github.com/dynamite-systems/napoln/commit/8ce4399c4ef71a443ab8f8801a1b259a544d020e))
13
+ * sync runtime version and uv.lock with release metadata ([#128](https://github.com/dynamite-systems/napoln/issues/128)) ([74e0f5f](https://github.com/dynamite-systems/napoln/commit/74e0f5f2fd4258be0cd5af878290156e9dcd9443))
14
+
15
+
16
+ ### Documentation
17
+
18
+ * make placement directory the canonical skill identity ([#130](https://github.com/dynamite-systems/napoln/issues/130)) ([645cfca](https://github.com/dynamite-systems/napoln/commit/645cfcad48cdbd02d2e47ee95e7fbe5370fa3985))
19
+ * split README introduction into two paragraphs ([#123](https://github.com/dynamite-systems/napoln/issues/123)) ([945e5fb](https://github.com/dynamite-systems/napoln/commit/945e5fbc7b48a7957a70604919e29681f32b2f75))
20
+
3
21
  ## [0.2.12](https://github.com/raiderrobert/napoln/compare/v0.2.11...v0.2.12) (2026-09-22)
4
22
 
5
23
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: napoln
3
- Version: 0.2.12
3
+ Version: 0.2.13
4
4
  Summary: A package manager for agent skills
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -22,7 +22,9 @@ Description-Content-Type: text/markdown
22
22
 
23
23
  # napoln
24
24
 
25
- A package manager for [agent skills](https://agentskills.io/specification). Install from any git repo, upgrade without losing your customizations, and manage skills across every agent you use.
25
+ A package manager for [agent skills](https://agentskills.io/specification).
26
+
27
+ Install from any git repo, upgrade without losing your customizations, and manage skills across every agent you use.
26
28
 
27
29
  > *"I don't even have any good skills. You know, like nunchuck skills, bow hunting skills, computer hacking skills."*
28
30
 
@@ -1,6 +1,8 @@
1
1
  # napoln
2
2
 
3
- A package manager for [agent skills](https://agentskills.io/specification). Install from any git repo, upgrade without losing your customizations, and manage skills across every agent you use.
3
+ A package manager for [agent skills](https://agentskills.io/specification).
4
+
5
+ Install from any git repo, upgrade without losing your customizations, and manage skills across every agent you use.
4
6
 
5
7
  > *"I don't even have any good skills. You know, like nunchuck skills, bow hunting skills, computer hacking skills."*
6
8
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "napoln"
3
- version = "0.2.12"
3
+ version = "0.2.13"
4
4
  description = "A package manager for agent skills"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -5,7 +5,11 @@
5
5
  "bump-minor-pre-major": true,
6
6
  "bump-patch-for-minor-pre-major": true,
7
7
  "extra-files": [
8
- "pyproject.toml"
8
+ {
9
+ "type": "toml",
10
+ "path": "uv.lock",
11
+ "jsonpath": "$.package[?(@.name.value=='napoln')].version"
12
+ }
9
13
  ]
10
14
  }
11
15
  }
@@ -14,8 +14,8 @@ from napoln.core.resolver import (
14
14
  ParsedSource,
15
15
  ResolvedSource,
16
16
  SourceType,
17
- _extract_description,
18
- _resolve_version,
17
+ extract_description,
18
+ resolve_version,
19
19
  parse_source,
20
20
  resolve_git,
21
21
  resolve_local,
@@ -92,6 +92,9 @@ def run_add(
92
92
  else:
93
93
  resolved_list = [resolved_result]
94
94
 
95
+ if resolved_list and resolved_list[0].notice:
96
+ output.info(resolved_list[0].notice)
97
+
95
98
  # Detect agents — prefer configured defaults over auto-detection
96
99
  default_agent_ids: list[str] = agents_mod.load_default_agent_ids(napoln_home)
97
100
  agent_configs: list[agents_mod.AgentConfig]
@@ -153,14 +156,14 @@ def run_add(
153
156
  )
154
157
  if code > worst_exit:
155
158
  worst_exit = code
156
- if code <= 2:
159
+ if code != 1:
157
160
  installed_count += 1
158
161
 
159
- if dry_run:
162
+ if dry_run and installed_count:
160
163
  output.would("update manifest")
161
164
  output.dry_run_footer()
162
165
 
163
- if len(resolved_list) > 1 and not dry_run:
166
+ if len(resolved_list) > 1 and not dry_run and installed_count:
164
167
  output.success(f"Installed {installed_count} skill(s) from {source}")
165
168
 
166
169
  return worst_exit
@@ -272,7 +275,11 @@ def _install_single_skill(
272
275
  install_id: str = resolution.install_id
273
276
 
274
277
  if resolution.existing is not None:
275
- if resolution.existing.version == version and resolution.existing.store_hash:
278
+ if (
279
+ resolution.existing.source == resolved.source_id
280
+ and resolution.existing.version == version
281
+ and resolution.existing.store_hash
282
+ ):
276
283
  output.info(f"'{install_id}' v{version} is already installed.")
277
284
  return 0
278
285
  elif resolution.collision_with is not None:
@@ -352,6 +359,8 @@ def _pick_from_multi_skill_repo(
352
359
  Returns a list of ResolvedSource, or None if the user cancels.
353
360
  """
354
361
 
362
+ if err.notice:
363
+ output.info(err.notice)
355
364
  output.info(f"Found {len(err.skill_dirs)} skills in {source}")
356
365
 
357
366
  # Collect sources already recorded in any reachable manifest so we can
@@ -377,7 +386,7 @@ def _pick_from_multi_skill_repo(
377
386
  choices.append(
378
387
  SkillChoice(
379
388
  name=sd.name,
380
- description=_extract_description(sd),
389
+ description=extract_description(sd),
381
390
  path=sd,
382
391
  installed=sid in installed_sources,
383
392
  )
@@ -393,7 +402,7 @@ def _pick_from_multi_skill_repo(
393
402
 
394
403
  results = []
395
404
  for choice in selected:
396
- version = _resolve_version(choice.path, ref, err.repo_dir)
405
+ version = resolve_version(choice.path, ref, err.repo_dir)
397
406
  rel = choice.path.relative_to(err.repo_dir)
398
407
  sid = f"{source_id}/{rel}" if str(rel) != "." else source_id
399
408
  results.append(
@@ -7,7 +7,7 @@ from typing import cast
7
7
 
8
8
  from napoln import output
9
9
  from napoln.core import agents as agents_mod
10
- from napoln.core import linker, manifest, store
10
+ from napoln.core import linker, manifest, resolver
11
11
  from napoln.core.home import get_napoln_home
12
12
  from napoln.prompts import SkillChoice, pick_agents, pick_skills
13
13
 
@@ -57,7 +57,7 @@ def _place_skill_for_agent(
57
57
  """
58
58
  # Get store path - will re-fetch if needed
59
59
  try:
60
- store_path = store.ensure_stored(
60
+ store_path = resolver.ensure_stored(
61
61
  skill_name,
62
62
  skill_entry.version,
63
63
  skill_entry.store_hash,
@@ -5,7 +5,7 @@ from __future__ import annotations
5
5
  from pathlib import Path
6
6
 
7
7
  from napoln import output
8
- from napoln.core import linker, manifest, store
8
+ from napoln.core import linker, manifest, resolver
9
9
  from napoln.core.home import NAPOLN_DIR, get_napoln_home
10
10
  from napoln.errors import NapolnError
11
11
 
@@ -26,7 +26,7 @@ def _sync_manifest(
26
26
 
27
27
  for skill_name, entry in sorted(mf.skills.items()):
28
28
  try:
29
- store_path = store.ensure_stored(
29
+ store_path = resolver.ensure_stored(
30
30
  skill_name, entry.version, entry.store_hash, entry.source, napoln_home
31
31
  )
32
32
  except (NapolnError, OSError):
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import shlex
5
6
  from pathlib import Path
6
7
  from typing import cast
7
8
 
@@ -9,13 +10,14 @@ from napoln import output
9
10
  from napoln.core import linker, manifest, merger, store
10
11
  from napoln.core.home import get_napoln_home
11
12
  from napoln.core.resolver import (
13
+ ParsedSource,
12
14
  ResolvedSource,
13
15
  SourceType,
14
16
  parse_source,
15
17
  resolve_git,
16
18
  resolve_local,
17
19
  )
18
- from napoln.errors import ResolverError
20
+ from napoln.errors import ResolverError, SourcePathNotFoundError
19
21
 
20
22
 
21
23
  def run_upgrade(
@@ -94,6 +96,7 @@ def _upgrade_skill(
94
96
  project_root: Path | None,
95
97
  ) -> int:
96
98
  """Upgrade a single skill. Returns exit code."""
99
+ source = entry.source
97
100
  # Resolve new version from source
98
101
  try:
99
102
  parsed = parse_source(entry.source)
@@ -105,7 +108,16 @@ def _upgrade_skill(
105
108
  resolved = resolve_local(parsed)
106
109
  elif parsed.source_type == SourceType.GIT:
107
110
  cache_dir = napoln_home / "cache"
108
- result = resolve_git(parsed, cache_dir)
111
+ # Without --version, stay on the branch the skill was installed
112
+ # from; the manifest source carries no @ref, only entry.version.
113
+ try:
114
+ result = resolve_git(parsed, cache_dir, installed_ref=entry.version)
115
+ except SourcePathNotFoundError:
116
+ # The skill moved within its repo; look it up by name instead.
117
+ result = _rediscover_moved_skill(
118
+ parsed, cache_dir, entry.name or skill_name, entry.version, scope
119
+ )
120
+ source = result.source_id
109
121
  # resolve_git can return a list for multi-skill repos;
110
122
  # during upgrade the manifest source already has a path,
111
123
  # so we always expect a single result.
@@ -122,15 +134,23 @@ def _upgrade_skill(
122
134
  output.info(f"Cannot upgrade '{skill_name}': unsupported source type.")
123
135
  return 0
124
136
  except ResolverError as e:
125
- output.error(f"Failed to resolve update for '{skill_name}': {e}")
137
+ output.error(f"Failed to resolve update for '{skill_name}': {e}", fix=e.fix)
126
138
  return 1
127
139
 
140
+ if resolved.notice:
141
+ output.info(resolved.notice)
142
+ if source != entry.source:
143
+ output.info(f"'{skill_name}' moved upstream: {entry.source} → {source}")
144
+
128
145
  # Check if there's actually a new version
129
146
  from napoln.core.hasher import hash_skill
130
147
 
131
148
  new_hash = hash_skill(resolved.skill_dir)
132
149
  if new_hash == entry.store_hash and not force:
133
150
  output.info(f"'{skill_name}' is already up to date (v{entry.version}).")
151
+ if source != entry.source and not dry_run:
152
+ entry.source = source
153
+ manifest.write_manifest(mf, manifest_path)
134
154
  return 0
135
155
 
136
156
  new_version = resolved.version
@@ -193,7 +213,7 @@ def _upgrade_skill(
193
213
  if not placement_conflicted:
194
214
  linker.write_provenance(
195
215
  placement_path,
196
- entry.source,
216
+ source,
197
217
  new_version,
198
218
  new_content_hash,
199
219
  placement.link_mode,
@@ -208,12 +228,54 @@ def _upgrade_skill(
208
228
  f"Resolve them, then run `napoln upgrade {skill_name}` again."
209
229
  )
210
230
  else:
231
+ entry.source = source
211
232
  entry.version = new_version
212
233
  entry.store_hash = new_content_hash
213
- from napoln.core.manifest import _now_iso
234
+ from napoln.core.manifest import now_iso
214
235
 
215
- entry.updated = _now_iso()
236
+ entry.updated = now_iso()
216
237
  manifest.write_manifest(mf, manifest_path)
217
238
  output.success(f"Upgraded '{skill_name}' to v{new_version}")
218
239
 
219
240
  return 2 if has_conflicts else 0
241
+
242
+
243
+ def _rediscover_moved_skill(
244
+ parsed: ParsedSource,
245
+ cache_dir: Path,
246
+ upstream_name: str,
247
+ installed_ref: str,
248
+ scope: str,
249
+ ) -> ResolvedSource:
250
+ """Find a skill by name anywhere in its repo after its recorded path vanished.
251
+
252
+ Raises ResolverError unless exactly one skill directory matches.
253
+ """
254
+ recorded_path = parsed.path
255
+ repo_source = f"{parsed.host}/{parsed.owner}/{parsed.repo}"
256
+ flags = (" -p" if scope == "project" else "") + (
257
+ f" --version {shlex.quote(parsed.version)}" if parsed.version else ""
258
+ )
259
+ not_found = ResolverError(
260
+ f"Path '{recorded_path}' does not exist in the repository "
261
+ f"and no skill named '{upstream_name}' was found elsewhere in it",
262
+ fix=f"Check the repository, then re-add the skill:\n napoln add {repo_source}/<path>{flags}",
263
+ )
264
+ parsed.path = ""
265
+ try:
266
+ result = resolve_git(
267
+ parsed, cache_dir, skill_filter=upstream_name, installed_ref=installed_ref
268
+ )
269
+ except ResolverError:
270
+ raise not_found
271
+ if isinstance(result, list):
272
+ candidates = cast(list[ResolvedSource], result)
273
+ paths = "\n".join(f" napoln add {shlex.quote(r.source_id)}{flags}" for r in candidates)
274
+ raise ResolverError(
275
+ f"Path '{recorded_path}' does not exist in the repository "
276
+ f"and {len(candidates)} skills named '{upstream_name}' were found elsewhere in it",
277
+ fix=f"Re-add the skill from the intended location:\n{paths}",
278
+ )
279
+ if result.source_id == repo_source or result.skill_dir.name != upstream_name:
280
+ raise not_found
281
+ return result
@@ -0,0 +1,36 @@
1
+ """Version number for napoln."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import tomllib
6
+ from importlib.metadata import PackageNotFoundError, version
7
+ from pathlib import Path
8
+
9
+
10
+ def _read_pyproject_version(pyproject: Path | None = None) -> str:
11
+ """Read the package version from pyproject.toml when metadata is unavailable."""
12
+ if pyproject is None:
13
+ parents = Path(__file__).resolve().parents
14
+ if len(parents) <= 3:
15
+ return "0.0.0"
16
+ pyproject = parents[3] / "pyproject.toml"
17
+ if pyproject.is_file():
18
+ with pyproject.open("rb") as f:
19
+ data = tomllib.load(f)
20
+ project = data.get("project")
21
+ if isinstance(project, dict):
22
+ project_version = project.get("version")
23
+ if isinstance(project_version, str):
24
+ return project_version
25
+ return "0.0.0"
26
+
27
+
28
+ def _get_version() -> str:
29
+ """Return the installed napoln package version, falling back to pyproject.toml."""
30
+ try:
31
+ return version("napoln")
32
+ except PackageNotFoundError:
33
+ return _read_pyproject_version()
34
+
35
+
36
+ __version__ = _get_version()
@@ -39,6 +39,9 @@ class SkillEntry(BaseModel):
39
39
 
40
40
  `name` is the upstream skill name from SKILL.md frontmatter. Two entries
41
41
  can share the same `name` if they came from different sources.
42
+
43
+ The install id is the canonical installed identity; `name` is kept for
44
+ traceability only. See "Skill Identity" in ARCHITECTURE.md.
42
45
  """
43
46
 
44
47
  source: str
@@ -59,7 +62,7 @@ class Manifest(BaseModel):
59
62
  skills: dict[str, SkillEntry] = Field(default_factory=dict)
60
63
 
61
64
 
62
- def _now_iso() -> str:
65
+ def now_iso() -> str:
63
66
  """Return current UTC time as ISO-8601 string."""
64
67
  return datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
65
68
 
@@ -194,7 +197,7 @@ def add_skill_to_manifest(
194
197
  Returns:
195
198
  Updated manifest.
196
199
  """
197
- now = _now_iso()
200
+ now = now_iso()
198
201
  upstream = name if name is not None else install_id
199
202
 
200
203
  if install_id in manifest.skills:
@@ -209,6 +209,10 @@ def merge_skill(
209
209
  # Local changes only, upstream unchanged — no-op
210
210
  continue
211
211
 
212
+ if ours_content == theirs_content:
213
+ # Local already matches upstream — nothing to merge
214
+ continue
215
+
212
216
  # Both changed — need to merge
213
217
  if rel_path == "SKILL.md" or rel_path.endswith(".md"):
214
218
  # Three-way merge for markdown files
@@ -6,7 +6,8 @@ from dataclasses import dataclass
6
6
  from pathlib import Path
7
7
 
8
8
  from napoln.core.manifest import Manifest, SkillEntry
9
- from napoln.core.resolver import ResolvedSource, SourceType
9
+ from napoln.core.resolver import ResolvedSource, SourceType, parse_source
10
+ from napoln.errors import ResolverError
10
11
 
11
12
 
12
13
  @dataclass(frozen=True)
@@ -15,8 +16,11 @@ class InstallIdResolution:
15
16
  to the install id used as the manifest's primary key and placement directory.
16
17
 
17
18
  `existing` is set when this exact source already has an entry in the manifest
18
- (under any id). The caller can short-circuit re-installs by checking
19
- `existing.version` and `existing.store_hash`.
19
+ (under any id), or when a skill of the same upstream name from the same git
20
+ repo does and its recorded path no longer holds a skill (the skill moved
21
+ within its repo). The caller can short-circuit
22
+ re-installs by checking `existing.source`, `existing.version` and
23
+ `existing.store_hash`.
20
24
 
21
25
  `collision_with` is set when the upstream name is already taken in the
22
26
  manifest by a *different* source — the install id was namespaced and the
@@ -33,17 +37,24 @@ def resolve_install_id(
33
37
  ) -> InstallIdResolution:
34
38
  """Decide what install id to use when installing `resolved` as `upstream_name`.
35
39
 
36
- Three cases:
40
+ Four cases:
37
41
  1. This exact source is already recorded under some id → reuse that id,
38
42
  return its `existing` entry so the caller can detect a no-op re-install.
39
- 2. The upstream name is taken by a different source → namespace the install
43
+ 2. A skill with the same upstream name from the same git repo is recorded
44
+ under some id, and its recorded path no longer holds a skill in the
45
+ checkout → it moved within the repo; reuse that id and entry.
46
+ 3. The upstream name is taken by a different source → namespace the install
40
47
  id and report the conflicting source via `collision_with`.
41
- 3. Neither → install id equals `upstream_name`.
48
+ 4. None of the above → install id equals `upstream_name`.
42
49
  """
43
50
  for install_id, entry in manifest.skills.items():
44
51
  if entry.source == resolved.source_id and entry.name == upstream_name:
45
52
  return InstallIdResolution(install_id, entry, None)
46
53
 
54
+ for install_id, entry in manifest.skills.items():
55
+ if entry.name == upstream_name and _moved_within_repo(entry.source, resolved):
56
+ return InstallIdResolution(install_id, entry, None)
57
+
47
58
  conflict = manifest.skills.get(upstream_name)
48
59
  if conflict is not None and conflict.source != resolved.source_id:
49
60
  return InstallIdResolution(namespace_for(resolved, upstream_name), None, conflict.source)
@@ -51,6 +62,33 @@ def resolve_install_id(
51
62
  return InstallIdResolution(upstream_name, None, None)
52
63
 
53
64
 
65
+ def _moved_within_repo(source: str, resolved: ResolvedSource) -> bool:
66
+ """Whether manifest `source` is in the same git repo as `resolved` and its path
67
+ no longer holds a skill in the checkout `resolved` came from."""
68
+ if resolved.source_type != SourceType.GIT or resolved.parsed is None:
69
+ return False
70
+ try:
71
+ parsed = parse_source(source)
72
+ except ResolverError:
73
+ return False
74
+ if parsed.source_type != SourceType.GIT:
75
+ return False
76
+ if (parsed.host, parsed.owner, parsed.repo) != (
77
+ resolved.parsed.host,
78
+ resolved.parsed.owner,
79
+ resolved.parsed.repo,
80
+ ):
81
+ return False
82
+ repo_id = f"{parsed.host}/{parsed.owner}/{parsed.repo}"
83
+ checkout = resolved.skill_dir
84
+ for _ in Path(resolved.source_id.removeprefix(repo_id).strip("/")).parts:
85
+ checkout = checkout.parent
86
+ old_path = (
87
+ source.removeprefix(repo_id).strip("/") if source.startswith(repo_id) else parsed.path
88
+ )
89
+ return not (checkout / old_path / "SKILL.md").is_file()
90
+
91
+
54
92
  def namespace_for(resolved: ResolvedSource, skill_name: str) -> str:
55
93
  """Compute a deterministic namespaced skill name.
56
94