napoln 0.2.3__tar.gz → 0.2.5__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.5/.release-please-manifest.json +3 -0
- {napoln-0.2.3 → napoln-0.2.5}/CHANGELOG.md +20 -0
- {napoln-0.2.3 → napoln-0.2.5}/PKG-INFO +2 -3
- {napoln-0.2.3 → napoln-0.2.5}/README.md +0 -2
- {napoln-0.2.3 → napoln-0.2.5}/justfile +2 -1
- {napoln-0.2.3 → napoln-0.2.5}/pyproject.toml +3 -1
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/__init__.py +1 -1
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/cli.py +17 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/commands/add.py +17 -5
- napoln-0.2.5/src/napoln/commands/setup.py +104 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/commands/upgrade.py +5 -2
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/core/agents.py +38 -4
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/prompts.py +63 -5
- napoln-0.2.5/src/napoln/skills/napoln-manage/SKILL.md +95 -0
- napoln-0.2.5/tests/features/setup.feature +30 -0
- napoln-0.2.5/tests/steps/test_setup.py +130 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/steps/test_upgrade.py +4 -1
- {napoln-0.2.3 → napoln-0.2.5}/uv.lock +27 -1
- napoln-0.2.3/.release-please-manifest.json +0 -3
- napoln-0.2.3/SPEC.md +0 -1933
- napoln-0.2.3/STORIES.md +0 -701
- napoln-0.2.3/src/napoln/skills/napoln-manage/SKILL.md +0 -78
- {napoln-0.2.3 → napoln-0.2.5}/.github/workflows/ci.yml +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/.github/workflows/pr-title.yml +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/.github/workflows/release-please.yml +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/.github/workflows/release.yml +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/.gitignore +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/AGENTS.md +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/ARCHITECTURE.md +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/CONTRIBUTING.md +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/LICENSE +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/release-please-config.json +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/skills-lock.json +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/commands/__init__.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/commands/config.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/commands/init.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/commands/install.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/commands/list_cmd.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/commands/remove.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/core/__init__.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/core/hasher.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/core/linker.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/core/manifest.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/core/merger.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/core/resolver.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/core/store.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/core/validator.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/errors.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/src/napoln/output.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/__init__.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/conftest.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/features/config.feature +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/features/first_run.feature +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/features/init.feature +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/features/install.feature +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/features/list.feature +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/features/upgrade.feature +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/fixtures/invalid-skill/SKILL.md +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/fixtures/multi-skill-repo/README.md +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/fixtures/multi-skill-repo/skills/skill-a/SKILL.md +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/fixtures/multi-skill-repo/skills/skill-b/SKILL.md +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/fixtures/valid-skill/SKILL.md +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/integration/test_cli.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/steps/__init__.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/steps/conftest.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/steps/test_config.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/steps/test_first_run.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/steps/test_init.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/steps/test_install.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/steps/test_list.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/unit/test_agents.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/unit/test_hasher.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/unit/test_linker.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/unit/test_manifest.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/unit/test_merger.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/unit/test_resolver.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/unit/test_store.py +0 -0
- {napoln-0.2.3 → napoln-0.2.5}/tests/unit/test_validator.py +0 -0
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.5](https://github.com/raiderrobert/napoln/compare/v0.2.4...v0.2.5) (2026-04-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* change bundled skill ([dff4f1d](https://github.com/raiderrobert/napoln/commit/dff4f1d25b4dd2a0241f29b31507117a62a3620b))
|
|
9
|
+
* **tests:** block PATH agent detection in upgrade tests ([f656f33](https://github.com/raiderrobert/napoln/commit/f656f333ff1817e9218029b78b6c75f8faabe357))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Documentation
|
|
13
|
+
|
|
14
|
+
* remove spec mention ([3c3386b](https://github.com/raiderrobert/napoln/commit/3c3386ba46d3eaf6893cdf2a1c002f734be460d8))
|
|
15
|
+
|
|
16
|
+
## [0.2.4](https://github.com/raiderrobert/napoln/compare/v0.2.3...v0.2.4) (2026-04-15)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* add `napoln setup` to choose default agents ([#16](https://github.com/raiderrobert/napoln/issues/16)) ([e8d78a6](https://github.com/raiderrobert/napoln/commit/e8d78a6f74c3c2dfa6fb02d422b594bbb324645b))
|
|
22
|
+
|
|
3
23
|
## [0.2.3](https://github.com/raiderrobert/napoln/compare/v0.2.2...v0.2.3) (2026-04-15)
|
|
4
24
|
|
|
5
25
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: napoln
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: A package manager for agent skills
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -16,6 +16,7 @@ Requires-Dist: pytest-bdd>=8.1; extra == 'dev'
|
|
|
16
16
|
Requires-Dist: pytest-cov>=7.1; extra == 'dev'
|
|
17
17
|
Requires-Dist: pytest>=9.0; extra == 'dev'
|
|
18
18
|
Requires-Dist: ruff>=0.9; extra == 'dev'
|
|
19
|
+
Requires-Dist: ty>=0.0.30; extra == 'dev'
|
|
19
20
|
Description-Content-Type: text/markdown
|
|
20
21
|
|
|
21
22
|
# napoln
|
|
@@ -135,8 +136,6 @@ napoln install
|
|
|
135
136
|
`napoln install` syncs both global and project manifests automatically.
|
|
136
137
|
|
|
137
138
|
## Documentation
|
|
138
|
-
|
|
139
|
-
- [SPEC.md](SPEC.md) — Full specification: store, placement, merge, CLI, manifest schema
|
|
140
139
|
- [ARCHITECTURE.md](ARCHITECTURE.md) — Architecture decisions and prior art analysis
|
|
141
140
|
- [CONTRIBUTING.md](CONTRIBUTING.md) — Development setup, testing, how to add commands and agents
|
|
142
141
|
|
|
@@ -115,8 +115,6 @@ napoln install
|
|
|
115
115
|
`napoln install` syncs both global and project manifests automatically.
|
|
116
116
|
|
|
117
117
|
## Documentation
|
|
118
|
-
|
|
119
|
-
- [SPEC.md](SPEC.md) — Full specification: store, placement, merge, CLI, manifest schema
|
|
120
118
|
- [ARCHITECTURE.md](ARCHITECTURE.md) — Architecture decisions and prior art analysis
|
|
121
119
|
- [CONTRIBUTING.md](CONTRIBUTING.md) — Development setup, testing, how to add commands and agents
|
|
122
120
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "napoln"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.5"
|
|
4
4
|
description = "A package manager for agent skills"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -30,11 +30,13 @@ dev = [
|
|
|
30
30
|
"pytest-bdd>=8.1",
|
|
31
31
|
"pytest-cov>=7.1",
|
|
32
32
|
"ruff>=0.9",
|
|
33
|
+
"ty>=0.0.30",
|
|
33
34
|
]
|
|
34
35
|
|
|
35
36
|
[tool.pytest.ini_options]
|
|
36
37
|
testpaths = ["tests"]
|
|
37
38
|
pythonpath = ["src"]
|
|
39
|
+
addopts = "-q --tb=short"
|
|
38
40
|
|
|
39
41
|
[tool.ruff]
|
|
40
42
|
target-version = "py311"
|
|
@@ -233,6 +233,23 @@ def init(
|
|
|
233
233
|
raise typer.Exit(code=exit_code)
|
|
234
234
|
|
|
235
235
|
|
|
236
|
+
# ─── setup ────────────────────────────────────────────────────────────────────
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
@app.command()
|
|
240
|
+
def setup(
|
|
241
|
+
force: Annotated[
|
|
242
|
+
bool,
|
|
243
|
+
typer.Option("--force", help="Re-run setup even if default agents are already configured."),
|
|
244
|
+
] = False,
|
|
245
|
+
) -> None:
|
|
246
|
+
"""Choose which agents `napoln add` should install to by default."""
|
|
247
|
+
from napoln.commands.setup import run_setup
|
|
248
|
+
|
|
249
|
+
exit_code = run_setup(force=force)
|
|
250
|
+
raise typer.Exit(code=exit_code)
|
|
251
|
+
|
|
252
|
+
|
|
236
253
|
# ─── config ───────────────────────────────────────────────────────────────────
|
|
237
254
|
|
|
238
255
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
|
|
6
|
+
from typing import cast
|
|
7
7
|
|
|
8
8
|
from napoln import output
|
|
9
9
|
from napoln.core import agents as agents_mod
|
|
@@ -343,15 +343,19 @@ def run_add(
|
|
|
343
343
|
output.error(str(e), cause=e.cause, fix=e.fix)
|
|
344
344
|
return 1
|
|
345
345
|
|
|
346
|
-
# Normalize to a list
|
|
346
|
+
# Normalize to a list. ty's isinstance narrowing on a `T | list[T]` union
|
|
347
|
+
# leaves a quirky intersection, so cast through after the runtime check.
|
|
347
348
|
if isinstance(resolved_result, list):
|
|
348
|
-
resolved_list = resolved_result
|
|
349
|
+
resolved_list: list[ResolvedSource] = cast(list[ResolvedSource], resolved_result)
|
|
349
350
|
else:
|
|
350
351
|
resolved_list = [resolved_result]
|
|
351
352
|
|
|
352
|
-
# Detect agents
|
|
353
|
+
# Detect agents — prefer configured defaults over auto-detection
|
|
354
|
+
default_agent_ids = agents_mod.load_default_agent_ids(napoln_home)
|
|
353
355
|
try:
|
|
354
|
-
agent_configs = agents_mod.resolve_agents(
|
|
356
|
+
agent_configs = agents_mod.resolve_agents(
|
|
357
|
+
agent_ids, home, project_root, scope, default_agent_ids=default_agent_ids
|
|
358
|
+
)
|
|
355
359
|
except ValueError as e:
|
|
356
360
|
output.error(str(e))
|
|
357
361
|
return 1
|
|
@@ -363,6 +367,14 @@ def run_add(
|
|
|
363
367
|
)
|
|
364
368
|
return 1
|
|
365
369
|
|
|
370
|
+
# If the user has multiple agents installed but never configured defaults,
|
|
371
|
+
# nudge them toward `napoln setup` so they don't keep spray-installing.
|
|
372
|
+
if agent_ids is None and not default_agent_ids and scope == "global" and len(agent_configs) > 1:
|
|
373
|
+
output.info(
|
|
374
|
+
f"Installing to all {len(agent_configs)} detected agents. "
|
|
375
|
+
"Run `napoln setup` to choose defaults."
|
|
376
|
+
)
|
|
377
|
+
|
|
366
378
|
if dry_run:
|
|
367
379
|
output.dry_run_header()
|
|
368
380
|
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""napoln setup — One-time interactive onboarding to choose default agents."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import tomllib
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
import tomli_w
|
|
10
|
+
|
|
11
|
+
from napoln import output
|
|
12
|
+
from napoln.core import agents as agents_mod
|
|
13
|
+
from napoln.prompts import pick_agents
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_napoln_home() -> Path:
|
|
17
|
+
return Path(os.environ.get("NAPOLN_HOME", Path.home() / ".napoln"))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _ensure_initialized(napoln_home: Path) -> None:
|
|
21
|
+
napoln_home.mkdir(parents=True, exist_ok=True)
|
|
22
|
+
(napoln_home / "store").mkdir(exist_ok=True)
|
|
23
|
+
(napoln_home / "cache").mkdir(exist_ok=True)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _load_config(config_path: Path) -> dict:
|
|
27
|
+
if not config_path.exists():
|
|
28
|
+
return {}
|
|
29
|
+
try:
|
|
30
|
+
return tomllib.loads(config_path.read_text(encoding="utf-8"))
|
|
31
|
+
except (OSError, tomllib.TOMLDecodeError):
|
|
32
|
+
return {}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _write_default_agents(config_path: Path, agent_ids: list[str]) -> None:
|
|
36
|
+
data = _load_config(config_path)
|
|
37
|
+
section = data.setdefault("napoln", {})
|
|
38
|
+
section["default_agents"] = agent_ids
|
|
39
|
+
section.setdefault("default_scope", "global")
|
|
40
|
+
config_path.parent.mkdir(parents=True, exist_ok=True)
|
|
41
|
+
config_path.write_text(tomli_w.dumps(data), encoding="utf-8")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def run_setup(force: bool = False) -> int:
|
|
45
|
+
"""Run the interactive onboarding wizard.
|
|
46
|
+
|
|
47
|
+
Detects available agents, prompts the user to pick defaults, and persists
|
|
48
|
+
the selection to ``[napoln].default_agents`` in ``~/.napoln/config.toml``.
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
force: Re-run even if defaults are already configured.
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
Exit code (0 on success, 1 on cancel/error).
|
|
55
|
+
"""
|
|
56
|
+
napoln_home = _get_napoln_home()
|
|
57
|
+
home = Path(os.environ.get("HOME", Path.home()))
|
|
58
|
+
config_path = napoln_home / "config.toml"
|
|
59
|
+
|
|
60
|
+
_ensure_initialized(napoln_home)
|
|
61
|
+
|
|
62
|
+
existing = agents_mod.load_default_agent_ids(napoln_home)
|
|
63
|
+
if existing and not force:
|
|
64
|
+
names = ", ".join(agents_mod.AGENTS[aid].display_name for aid in existing)
|
|
65
|
+
output.info(f"Default agents already configured: {names}")
|
|
66
|
+
output.info("Re-run with --force to change them.")
|
|
67
|
+
return 0
|
|
68
|
+
|
|
69
|
+
detected = agents_mod.detect_agents(home)
|
|
70
|
+
if not detected:
|
|
71
|
+
output.error(
|
|
72
|
+
"No agents detected on this machine.",
|
|
73
|
+
fix=(
|
|
74
|
+
"Install one of: Claude Code, Gemini CLI, pi, Codex, Cursor — "
|
|
75
|
+
"then re-run `napoln setup`."
|
|
76
|
+
),
|
|
77
|
+
)
|
|
78
|
+
return 1
|
|
79
|
+
|
|
80
|
+
output.header("napoln setup")
|
|
81
|
+
output.info(f"Detected {len(detected)} agent(s) on this machine.")
|
|
82
|
+
|
|
83
|
+
# Only preselect agents already in config; on first run the list is empty
|
|
84
|
+
# so the user has to actively pick — having a tool installed is not the
|
|
85
|
+
# same as wanting skills installed into it.
|
|
86
|
+
selected = pick_agents(detected, preselected_ids=existing)
|
|
87
|
+
|
|
88
|
+
if selected is None:
|
|
89
|
+
output.warning("Setup cancelled.")
|
|
90
|
+
return 1
|
|
91
|
+
|
|
92
|
+
if not selected:
|
|
93
|
+
output.warning("No agents selected — defaults will not be saved.")
|
|
94
|
+
return 1
|
|
95
|
+
|
|
96
|
+
selected_ids = [a.id for a in selected]
|
|
97
|
+
_write_default_agents(config_path, selected_ids)
|
|
98
|
+
|
|
99
|
+
names = ", ".join(a.display_name for a in selected)
|
|
100
|
+
output.success(f"Saved default agents: {names}")
|
|
101
|
+
output.info(f"Wrote {config_path}")
|
|
102
|
+
output.info("Future `napoln add` commands will install to these agents by default.")
|
|
103
|
+
output.info("Override per-command with `--agents <id1,id2,...>`.")
|
|
104
|
+
return 0
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from pathlib import Path
|
|
6
|
+
from typing import cast
|
|
6
7
|
|
|
7
8
|
from napoln import output
|
|
8
9
|
from napoln.core import linker, manifest, merger, store
|
|
9
|
-
from napoln.core.resolver import parse_source, resolve_git, resolve_local
|
|
10
|
+
from napoln.core.resolver import ResolvedSource, parse_source, resolve_git, resolve_local
|
|
10
11
|
from napoln.errors import ResolverError
|
|
11
12
|
|
|
12
13
|
|
|
@@ -98,6 +99,7 @@ def _upgrade_skill(
|
|
|
98
99
|
if version_constraint:
|
|
99
100
|
parsed.version = version_constraint
|
|
100
101
|
|
|
102
|
+
resolved: ResolvedSource
|
|
101
103
|
if parsed.source_type == "local":
|
|
102
104
|
resolved = resolve_local(parsed)
|
|
103
105
|
elif parsed.source_type == "git":
|
|
@@ -107,7 +109,8 @@ def _upgrade_skill(
|
|
|
107
109
|
# during upgrade the manifest source already has a path,
|
|
108
110
|
# so we always expect a single result.
|
|
109
111
|
if isinstance(result, list):
|
|
110
|
-
|
|
112
|
+
result_list = cast(list[ResolvedSource], result)
|
|
113
|
+
match = [r for r in result_list if r.skill_name == skill_name]
|
|
111
114
|
if not match:
|
|
112
115
|
output.error(f"Skill '{skill_name}' not found in resolved sources.")
|
|
113
116
|
return 1
|
|
@@ -6,6 +6,7 @@ Supports: Claude Code, Gemini CLI, pi, Codex, Cursor.
|
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
|
|
8
8
|
import shutil
|
|
9
|
+
import tomllib
|
|
9
10
|
from dataclasses import dataclass
|
|
10
11
|
from pathlib import Path
|
|
11
12
|
|
|
@@ -137,22 +138,52 @@ def detect_agents(
|
|
|
137
138
|
return detected
|
|
138
139
|
|
|
139
140
|
|
|
141
|
+
def load_default_agent_ids(napoln_home: Path) -> list[str]:
|
|
142
|
+
"""Read configured default_agents from napoln config.toml.
|
|
143
|
+
|
|
144
|
+
Returns an empty list if the config does not exist or has no defaults set.
|
|
145
|
+
Unknown agent IDs are silently dropped (the config command validates input,
|
|
146
|
+
but a config file edited by hand may contain stale entries).
|
|
147
|
+
"""
|
|
148
|
+
config_path = napoln_home / "config.toml"
|
|
149
|
+
if not config_path.exists():
|
|
150
|
+
return []
|
|
151
|
+
try:
|
|
152
|
+
data = tomllib.loads(config_path.read_text(encoding="utf-8"))
|
|
153
|
+
except (OSError, tomllib.TOMLDecodeError):
|
|
154
|
+
return []
|
|
155
|
+
raw = data.get("napoln", {}).get("default_agents", [])
|
|
156
|
+
if not isinstance(raw, list):
|
|
157
|
+
return []
|
|
158
|
+
return [aid for aid in raw if isinstance(aid, str) and aid in AGENTS]
|
|
159
|
+
|
|
160
|
+
|
|
140
161
|
def resolve_agents(
|
|
141
|
-
agent_ids: list[str] | None,
|
|
162
|
+
agent_ids: list[str] | None,
|
|
163
|
+
home: Path,
|
|
164
|
+
project_root: Path | None = None,
|
|
165
|
+
scope: str = "global",
|
|
166
|
+
default_agent_ids: list[str] | None = None,
|
|
142
167
|
) -> list[AgentConfig]:
|
|
143
|
-
"""Resolve agent list from explicit IDs or auto-detection.
|
|
168
|
+
"""Resolve agent list from explicit IDs, configured defaults, or auto-detection.
|
|
169
|
+
|
|
170
|
+
Resolution order:
|
|
171
|
+
1. Explicit ``agent_ids`` (e.g., from ``--agents`` flag).
|
|
172
|
+
2. ``default_agent_ids`` (e.g., from ``[napoln].default_agents`` in config.toml).
|
|
173
|
+
3. Auto-detection of installed agents.
|
|
144
174
|
|
|
145
175
|
Args:
|
|
146
|
-
agent_ids: Explicit agent IDs, or None
|
|
176
|
+
agent_ids: Explicit agent IDs, or None to fall through to defaults/auto-detect.
|
|
147
177
|
home: User home directory.
|
|
148
178
|
project_root: Project root (for project-scope).
|
|
149
179
|
scope: "global" or "project".
|
|
180
|
+
default_agent_ids: Configured defaults to prefer over auto-detection.
|
|
150
181
|
|
|
151
182
|
Returns:
|
|
152
183
|
List of AgentConfig objects.
|
|
153
184
|
|
|
154
185
|
Raises:
|
|
155
|
-
ValueError: If an unknown agent ID is specified
|
|
186
|
+
ValueError: If an unknown agent ID is specified in ``agent_ids``.
|
|
156
187
|
"""
|
|
157
188
|
if agent_ids:
|
|
158
189
|
configs = []
|
|
@@ -162,6 +193,9 @@ def resolve_agents(
|
|
|
162
193
|
configs.append(AGENTS[aid])
|
|
163
194
|
return configs
|
|
164
195
|
|
|
196
|
+
if default_agent_ids:
|
|
197
|
+
return [AGENTS[aid] for aid in default_agent_ids if aid in AGENTS]
|
|
198
|
+
|
|
165
199
|
return detect_agents(home, project_root, scope)
|
|
166
200
|
|
|
167
201
|
|
|
@@ -6,6 +6,8 @@ import sys
|
|
|
6
6
|
from dataclasses import dataclass
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
|
|
9
|
+
from napoln.core.agents import AgentConfig
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
@dataclass
|
|
11
13
|
class SkillChoice:
|
|
@@ -74,11 +76,12 @@ def pick_skills(choices: list[SkillChoice]) -> list[SkillChoice]:
|
|
|
74
76
|
from questionary.prompts import common as q_common
|
|
75
77
|
|
|
76
78
|
# Use ✓ and a blank cell as indicators. Some terminal fonts don't render
|
|
77
|
-
# the default ○/● glyphs distinctly.
|
|
78
|
-
|
|
79
|
-
q_constants
|
|
80
|
-
|
|
81
|
-
q_common
|
|
79
|
+
# the default ○/● glyphs distinctly. setattr bypasses ty's complaint about
|
|
80
|
+
# questionary's Literal-typed module constants.
|
|
81
|
+
setattr(q_constants, "INDICATOR_SELECTED", "✓")
|
|
82
|
+
setattr(q_constants, "INDICATOR_UNSELECTED", " ")
|
|
83
|
+
setattr(q_common, "INDICATOR_SELECTED", "✓")
|
|
84
|
+
setattr(q_common, "INDICATOR_UNSELECTED", " ")
|
|
82
85
|
|
|
83
86
|
max_name = max(len(c.name) for c in choices) if choices else 0
|
|
84
87
|
|
|
@@ -109,3 +112,58 @@ def pick_skills(choices: list[SkillChoice]) -> list[SkillChoice]:
|
|
|
109
112
|
return []
|
|
110
113
|
|
|
111
114
|
return selected
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def pick_agents(
|
|
118
|
+
available: list[AgentConfig],
|
|
119
|
+
preselected_ids: list[str] | None = None,
|
|
120
|
+
) -> list[AgentConfig] | None:
|
|
121
|
+
"""Interactive checkbox picker for agents.
|
|
122
|
+
|
|
123
|
+
Returns the selected agents, or None if the user cancelled (ctrl-c).
|
|
124
|
+
Returns an empty list if the user confirmed with nothing selected.
|
|
125
|
+
|
|
126
|
+
Falls back to selecting all available agents in non-TTY environments so
|
|
127
|
+
automation does not hang.
|
|
128
|
+
"""
|
|
129
|
+
if not available:
|
|
130
|
+
return []
|
|
131
|
+
|
|
132
|
+
if not sys.stdin.isatty():
|
|
133
|
+
return list(available)
|
|
134
|
+
|
|
135
|
+
import questionary
|
|
136
|
+
from questionary import constants as q_constants
|
|
137
|
+
from questionary.prompts import common as q_common
|
|
138
|
+
|
|
139
|
+
setattr(q_constants, "INDICATOR_SELECTED", "✓")
|
|
140
|
+
setattr(q_constants, "INDICATOR_UNSELECTED", " ")
|
|
141
|
+
setattr(q_common, "INDICATOR_SELECTED", "✓")
|
|
142
|
+
setattr(q_common, "INDICATOR_UNSELECTED", " ")
|
|
143
|
+
|
|
144
|
+
preselected = set(preselected_ids or [])
|
|
145
|
+
max_name = max(len(a.display_name) for a in available)
|
|
146
|
+
|
|
147
|
+
options = []
|
|
148
|
+
for agent in available:
|
|
149
|
+
tokens: list[tuple[str, str]] = [
|
|
150
|
+
("class:text", f"{agent.display_name:<{max_name}}"),
|
|
151
|
+
("class:text", f" ({agent.id})"),
|
|
152
|
+
]
|
|
153
|
+
options.append(
|
|
154
|
+
questionary.Choice(
|
|
155
|
+
title=tokens,
|
|
156
|
+
value=agent,
|
|
157
|
+
checked=agent.id in preselected,
|
|
158
|
+
)
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
style = questionary.Style([("selected", "noreverse")])
|
|
162
|
+
|
|
163
|
+
selected = questionary.checkbox(
|
|
164
|
+
"Default agents:",
|
|
165
|
+
choices=options,
|
|
166
|
+
style=style,
|
|
167
|
+
).ask()
|
|
168
|
+
|
|
169
|
+
return selected
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: napoln-manage
|
|
3
|
+
description: >
|
|
4
|
+
Search for, install, upgrade, and manage agent skills using the napoln
|
|
5
|
+
package manager. Use when the user wants to find new capabilities, install
|
|
6
|
+
a skill from a git repository, check for skill updates, view local
|
|
7
|
+
modifications to installed skills, or resolve merge conflicts after upgrade.
|
|
8
|
+
metadata:
|
|
9
|
+
version: "0.1.0"
|
|
10
|
+
author: napoln
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# napoln — Skill Manager
|
|
14
|
+
|
|
15
|
+
napoln manages reusable skills for AI coding agents. When running commands
|
|
16
|
+
for the user, prefer `uvx napoln` over bare `napoln` to avoid PATH issues.
|
|
17
|
+
|
|
18
|
+
## Running Commands
|
|
19
|
+
|
|
20
|
+
napoln is installed as a Python tool and may not be in PATH when an agent
|
|
21
|
+
runs. Use `uvx` to invoke it without relying on PATH:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
uvx napoln add owner/repo # add (preferred — no PATH dependency)
|
|
25
|
+
uvx napoln list # list
|
|
26
|
+
uvx napoln upgrade # upgrade
|
|
27
|
+
uvx napoln remove <name> # remove
|
|
28
|
+
uvx napoln install # sync from manifests
|
|
29
|
+
uvx napoln init my-skill # scaffold a new skill
|
|
30
|
+
uvx napoln config doctor # verify integrity
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
If `uvx` is unavailable, fall back to `python -m napoln` or `pipx run napoln`.
|
|
34
|
+
|
|
35
|
+
## Install a Skill
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# From a git repository
|
|
39
|
+
uvx napoln add owner/repo # Interactive picker for multi-skill repos
|
|
40
|
+
uvx napoln add owner/repo --all # Install all skills from a repo
|
|
41
|
+
uvx napoln add owner/repo --skill name # Install a specific skill by name
|
|
42
|
+
uvx napoln add owner/repo@v1.2.0 # Pinned version
|
|
43
|
+
|
|
44
|
+
# From a local path
|
|
45
|
+
uvx napoln add ./path/to/skill
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Check What's Installed
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
uvx napoln list # Show all installed skills and their placements
|
|
52
|
+
uvx napoln list -v # Show full placement paths
|
|
53
|
+
uvx napoln list --json # Machine-readable output
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Upgrade Skills
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
uvx napoln upgrade # Upgrade all skills
|
|
60
|
+
uvx napoln upgrade <name> # Upgrade specific skill
|
|
61
|
+
uvx napoln upgrade --dry-run # Preview changes without applying
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If upgrade produces merge conflicts (the user customized a skill and the
|
|
65
|
+
upstream also changed the same lines):
|
|
66
|
+
1. Conflicts appear as `<<<<<<<` / `=======` / `>>>>>>>` markers in SKILL.md
|
|
67
|
+
2. Edit the file to resolve — keep the best of both versions
|
|
68
|
+
3. Run `uvx napoln upgrade <name>` again to complete the upgrade
|
|
69
|
+
|
|
70
|
+
## Remove a Skill
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
uvx napoln remove <name>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Scaffold a New Skill
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
uvx napoln init my-skill # Creates my-skill/SKILL.md
|
|
80
|
+
uvx napoln init # Creates SKILL.md in current directory
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Restore / Sync
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
uvx napoln install # Restore all placements from manifests
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Housekeeping
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
uvx napoln config # View configuration and detected agents
|
|
93
|
+
uvx napoln config doctor # Verify store integrity and placement validity
|
|
94
|
+
uvx napoln config gc # Remove unreferenced store entries
|
|
95
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Feature: Choose default agents
|
|
2
|
+
As a developer with multiple AI coding tools installed
|
|
3
|
+
I want to pick which agents napoln installs to by default
|
|
4
|
+
So that `napoln add` does not spray skills across every detected tool
|
|
5
|
+
|
|
6
|
+
Scenario: Setup persists default agents to config
|
|
7
|
+
Given Claude Code and Cursor are installed
|
|
8
|
+
When I run napoln setup with selection "claude-code"
|
|
9
|
+
Then the config contains default_agents "claude-code"
|
|
10
|
+
And the exit code is 0
|
|
11
|
+
|
|
12
|
+
Scenario: Add respects configured default agents
|
|
13
|
+
Given Claude Code and Cursor are installed
|
|
14
|
+
And default_agents is configured to "claude-code"
|
|
15
|
+
When I run napoln add with a valid local skill
|
|
16
|
+
Then the skill is placed only for Claude Code
|
|
17
|
+
And the exit code is 0
|
|
18
|
+
|
|
19
|
+
Scenario: Add hints at setup when defaults are unset and multiple agents detected
|
|
20
|
+
Given Claude Code and Cursor are installed
|
|
21
|
+
And default_agents is not configured
|
|
22
|
+
When I run napoln add with a valid local skill
|
|
23
|
+
Then the output contains "napoln setup"
|
|
24
|
+
And the exit code is 0
|
|
25
|
+
|
|
26
|
+
Scenario: Setup with no agents detected fails with guidance
|
|
27
|
+
Given no agents are installed
|
|
28
|
+
When I run napoln setup non-interactively
|
|
29
|
+
Then the output contains "No agents detected"
|
|
30
|
+
And the exit code is 1
|