napoln 0.2.2__tar.gz → 0.2.4__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.2 → napoln-0.2.4}/.github/workflows/release.yml +5 -5
- {napoln-0.2.2 → napoln-0.2.4}/.gitignore +1 -0
- napoln-0.2.4/.release-please-manifest.json +3 -0
- {napoln-0.2.2 → napoln-0.2.4}/ARCHITECTURE.md +0 -21
- {napoln-0.2.2 → napoln-0.2.4}/CHANGELOG.md +22 -0
- {napoln-0.2.2 → napoln-0.2.4}/PKG-INFO +7 -3
- {napoln-0.2.2 → napoln-0.2.4}/README.md +6 -2
- {napoln-0.2.2 → napoln-0.2.4}/pyproject.toml +1 -1
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/__init__.py +1 -1
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/cli.py +17 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/commands/add.py +40 -10
- napoln-0.2.4/src/napoln/commands/setup.py +104 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/core/agents.py +38 -4
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/prompts.py +74 -2
- napoln-0.2.4/tests/features/setup.feature +30 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/integration/test_cli.py +7 -1
- napoln-0.2.4/tests/steps/test_setup.py +130 -0
- {napoln-0.2.2 → napoln-0.2.4}/uv.lock +403 -405
- napoln-0.2.2/.release-please-manifest.json +0 -3
- napoln-0.2.2/CLI-REDESIGN.md +0 -895
- napoln-0.2.2/PROMPT.md +0 -67
- {napoln-0.2.2 → napoln-0.2.4}/.github/workflows/ci.yml +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/.github/workflows/pr-title.yml +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/.github/workflows/release-please.yml +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/AGENTS.md +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/CONTRIBUTING.md +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/LICENSE +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/SPEC.md +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/STORIES.md +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/justfile +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/release-please-config.json +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/skills-lock.json +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/commands/__init__.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/commands/config.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/commands/init.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/commands/install.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/commands/list_cmd.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/commands/remove.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/commands/upgrade.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/core/__init__.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/core/hasher.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/core/linker.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/core/manifest.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/core/merger.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/core/resolver.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/core/store.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/core/validator.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/errors.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/output.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/src/napoln/skills/napoln-manage/SKILL.md +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/__init__.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/conftest.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/features/config.feature +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/features/first_run.feature +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/features/init.feature +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/features/install.feature +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/features/list.feature +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/features/upgrade.feature +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/fixtures/invalid-skill/SKILL.md +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/fixtures/multi-skill-repo/README.md +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/fixtures/multi-skill-repo/skills/skill-a/SKILL.md +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/fixtures/multi-skill-repo/skills/skill-b/SKILL.md +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/fixtures/valid-skill/SKILL.md +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/steps/__init__.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/steps/conftest.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/steps/test_config.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/steps/test_first_run.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/steps/test_init.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/steps/test_install.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/steps/test_list.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/steps/test_upgrade.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/unit/test_agents.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/unit/test_hasher.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/unit/test_linker.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/unit/test_manifest.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/unit/test_merger.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/unit/test_resolver.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/unit/test_store.py +0 -0
- {napoln-0.2.2 → napoln-0.2.4}/tests/unit/test_validator.py +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
name: Release
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ['v*']
|
|
4
6
|
workflow_dispatch:
|
|
5
7
|
inputs:
|
|
6
8
|
tag:
|
|
@@ -19,7 +21,7 @@ jobs:
|
|
|
19
21
|
steps:
|
|
20
22
|
- uses: actions/checkout@v4
|
|
21
23
|
with:
|
|
22
|
-
ref: ${{ inputs.tag }}
|
|
24
|
+
ref: ${{ inputs.tag || github.ref_name }}
|
|
23
25
|
- uses: astral-sh/setup-uv@v6
|
|
24
26
|
- uses: extractions/setup-just@v2
|
|
25
27
|
|
|
@@ -33,9 +35,7 @@ jobs:
|
|
|
33
35
|
path: dist/
|
|
34
36
|
|
|
35
37
|
- name: Publish to PyPI
|
|
36
|
-
run: uv publish
|
|
37
|
-
env:
|
|
38
|
-
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
|
38
|
+
run: uv publish --trusted-publishing always
|
|
39
39
|
|
|
40
40
|
release:
|
|
41
41
|
name: GitHub Release
|
|
@@ -50,5 +50,5 @@ jobs:
|
|
|
50
50
|
- name: Upload to GitHub Release
|
|
51
51
|
uses: softprops/action-gh-release@v2
|
|
52
52
|
with:
|
|
53
|
-
tag_name: ${{ inputs.tag }}
|
|
53
|
+
tag_name: ${{ inputs.tag || github.ref_name }}
|
|
54
54
|
files: dist/*
|
|
@@ -417,24 +417,3 @@ napoln/
|
|
|
417
417
|
│ └── fixtures/ # Test skill directories
|
|
418
418
|
└── README.md
|
|
419
419
|
```
|
|
420
|
-
|
|
421
|
-
---
|
|
422
|
-
|
|
423
|
-
## Resolved Questions
|
|
424
|
-
|
|
425
|
-
1. **Registry at launch?** No. v0.1 ships with git-only sources. The CLI parses registry identifiers and returns a clear "not yet available" message.
|
|
426
|
-
|
|
427
|
-
2. **Lock file?** No. The manifest pins exact versions and content hashes, which provides sufficient reproducibility. A lock file adds value when there are transitive dependencies — skills don't have dependencies on other skills.
|
|
428
|
-
|
|
429
|
-
3. **Skill authoring format:** A directory with `SKILL.md`. No `napoln.toml` required. Existing skill repos work without modification.
|
|
430
|
-
|
|
431
|
-
4. **Agent-specific frontmatter:** One SKILL.md serves all agents. Agents ignore fields they don't understand.
|
|
432
|
-
|
|
433
|
-
5. **`.gitignore` strategy:** Commit the manifest, gitignore the placements. Team members run `napoln install` after clone.
|
|
434
|
-
|
|
435
|
-
## Future Considerations
|
|
436
|
-
|
|
437
|
-
- **Registry API and web UI** for discovery beyond git
|
|
438
|
-
- **Compile-to-agent adapter** if agent formats diverge significantly
|
|
439
|
-
- **Skill dependencies** and a lock file if skills ever depend on other skills
|
|
440
|
-
- **Telemetry** with opt-in collection and transparent audit
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.4](https://github.com/raiderrobert/napoln/compare/v0.2.3...v0.2.4) (2026-04-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add `napoln setup` to choose default agents ([#16](https://github.com/raiderrobert/napoln/issues/16)) ([e8d78a6](https://github.com/raiderrobert/napoln/commit/e8d78a6f74c3c2dfa6fb02d422b594bbb324645b))
|
|
9
|
+
|
|
10
|
+
## [0.2.3](https://github.com/raiderrobert/napoln/compare/v0.2.2...v0.2.3) (2026-04-15)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* mark already-installed skills as pre-checked in picker ([d615b58](https://github.com/raiderrobert/napoln/commit/d615b5814d3d13f56aeaff2ecacb4df1ce67c991))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* distinct color for checked skill picker indicator ([3e0a0d6](https://github.com/raiderrobert/napoln/commit/3e0a0d6e560606a9a0c9b8ec0d0e1c2166b166bf))
|
|
21
|
+
* skill picker indicators render cleanly across terminals ([d257369](https://github.com/raiderrobert/napoln/commit/d257369fc15a97bb37afd4bf9137499e1ddebf61))
|
|
22
|
+
* **tests:** isolate cwd in CLI fixture to prevent project-scope leakage ([#15](https://github.com/raiderrobert/napoln/issues/15)) ([5b9c2e4](https://github.com/raiderrobert/napoln/commit/5b9c2e4321b81950d9e1ae89cf49a2de53d7ac4b))
|
|
23
|
+
* use ASCII checkbox indicators in skill picker ([c3c862a](https://github.com/raiderrobert/napoln/commit/c3c862afae8fc3b03ba5d406513c8ea8a23563e7))
|
|
24
|
+
|
|
3
25
|
## [0.2.2](https://github.com/raiderrobert/napoln/compare/v0.2.1...v0.2.2) (2026-04-14)
|
|
4
26
|
|
|
5
27
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: napoln
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: A package manager for agent skills
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -33,7 +33,9 @@ A package manager for [agent skills](https://agentskills.io/specification). Inst
|
|
|
33
33
|
|
|
34
34
|
## Install
|
|
35
35
|
|
|
36
|
-
Requires Python 3.11+.
|
|
36
|
+
Requires Python 3.11+. napoln is published on [PyPI](https://pypi.org/project/napoln/).
|
|
37
|
+
|
|
38
|
+
Run without installing:
|
|
37
39
|
|
|
38
40
|
```bash
|
|
39
41
|
uvx napoln add owner/repo
|
|
@@ -42,7 +44,9 @@ uvx napoln add owner/repo
|
|
|
42
44
|
Or install globally:
|
|
43
45
|
|
|
44
46
|
```bash
|
|
45
|
-
uv tool install napoln
|
|
47
|
+
uv tool install napoln # recommended
|
|
48
|
+
pipx install napoln # alternative
|
|
49
|
+
pip install napoln # plain pip
|
|
46
50
|
```
|
|
47
51
|
|
|
48
52
|
## Quick Start
|
|
@@ -13,7 +13,9 @@ A package manager for [agent skills](https://agentskills.io/specification). Inst
|
|
|
13
13
|
|
|
14
14
|
## Install
|
|
15
15
|
|
|
16
|
-
Requires Python 3.11+.
|
|
16
|
+
Requires Python 3.11+. napoln is published on [PyPI](https://pypi.org/project/napoln/).
|
|
17
|
+
|
|
18
|
+
Run without installing:
|
|
17
19
|
|
|
18
20
|
```bash
|
|
19
21
|
uvx napoln add owner/repo
|
|
@@ -22,7 +24,9 @@ uvx napoln add owner/repo
|
|
|
22
24
|
Or install globally:
|
|
23
25
|
|
|
24
26
|
```bash
|
|
25
|
-
uv tool install napoln
|
|
27
|
+
uv tool install napoln # recommended
|
|
28
|
+
pipx install napoln # alternative
|
|
29
|
+
pip install napoln # plain pip
|
|
26
30
|
```
|
|
27
31
|
|
|
28
32
|
## Quick Start
|
|
@@ -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
|
|
|
@@ -224,14 +224,34 @@ def _pick_from_multi_skill_repo(
|
|
|
224
224
|
|
|
225
225
|
output.info(f"Found {len(err.skill_dirs)} skills in {source}")
|
|
226
226
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
227
|
+
# Collect sources already recorded in any reachable manifest so we can
|
|
228
|
+
# flag matching entries in the picker as installed.
|
|
229
|
+
installed_sources: set[str] = set()
|
|
230
|
+
for scope, root in (("global", None), ("project", Path.cwd())):
|
|
231
|
+
mf_path = manifest.get_manifest_path(napoln_home, scope, root)
|
|
232
|
+
if not mf_path.exists():
|
|
233
|
+
continue
|
|
234
|
+
try:
|
|
235
|
+
mf = manifest.read_manifest(mf_path)
|
|
236
|
+
except Exception:
|
|
237
|
+
continue
|
|
238
|
+
for entry in mf.skills.values():
|
|
239
|
+
installed_sources.add(entry.source)
|
|
240
|
+
|
|
241
|
+
source_id = f"{parsed.host}/{parsed.owner}/{parsed.repo}" if parsed.host else source
|
|
242
|
+
|
|
243
|
+
choices = []
|
|
244
|
+
for sd in sorted(err.skill_dirs, key=lambda d: d.name):
|
|
245
|
+
rel = sd.relative_to(err.repo_dir)
|
|
246
|
+
sid = f"{source_id}/{rel}" if str(rel) != "." else source_id
|
|
247
|
+
choices.append(
|
|
248
|
+
SkillChoice(
|
|
249
|
+
name=sd.name,
|
|
250
|
+
description=_extract_description(sd),
|
|
251
|
+
path=sd,
|
|
252
|
+
installed=sid in installed_sources,
|
|
253
|
+
)
|
|
232
254
|
)
|
|
233
|
-
for sd in sorted(err.skill_dirs, key=lambda d: d.name)
|
|
234
|
-
]
|
|
235
255
|
|
|
236
256
|
selected = pick_skills(choices)
|
|
237
257
|
if not selected:
|
|
@@ -240,7 +260,6 @@ def _pick_from_multi_skill_repo(
|
|
|
240
260
|
|
|
241
261
|
# Resolve the git ref for version
|
|
242
262
|
ref = parsed.version or version_constraint or ""
|
|
243
|
-
source_id = f"{parsed.host}/{parsed.owner}/{parsed.repo}" if parsed.host else source
|
|
244
263
|
|
|
245
264
|
results = []
|
|
246
265
|
for choice in selected:
|
|
@@ -330,9 +349,12 @@ def run_add(
|
|
|
330
349
|
else:
|
|
331
350
|
resolved_list = [resolved_result]
|
|
332
351
|
|
|
333
|
-
# Detect agents
|
|
352
|
+
# Detect agents — prefer configured defaults over auto-detection
|
|
353
|
+
default_agent_ids = agents_mod.load_default_agent_ids(napoln_home)
|
|
334
354
|
try:
|
|
335
|
-
agent_configs = agents_mod.resolve_agents(
|
|
355
|
+
agent_configs = agents_mod.resolve_agents(
|
|
356
|
+
agent_ids, home, project_root, scope, default_agent_ids=default_agent_ids
|
|
357
|
+
)
|
|
336
358
|
except ValueError as e:
|
|
337
359
|
output.error(str(e))
|
|
338
360
|
return 1
|
|
@@ -344,6 +366,14 @@ def run_add(
|
|
|
344
366
|
)
|
|
345
367
|
return 1
|
|
346
368
|
|
|
369
|
+
# If the user has multiple agents installed but never configured defaults,
|
|
370
|
+
# nudge them toward `napoln setup` so they don't keep spray-installing.
|
|
371
|
+
if agent_ids is None and not default_agent_ids and scope == "global" and len(agent_configs) > 1:
|
|
372
|
+
output.info(
|
|
373
|
+
f"Installing to all {len(agent_configs)} detected agents. "
|
|
374
|
+
"Run `napoln setup` to choose defaults."
|
|
375
|
+
)
|
|
376
|
+
|
|
347
377
|
if dry_run:
|
|
348
378
|
output.dry_run_header()
|
|
349
379
|
|
|
@@ -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
|
|
@@ -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:
|
|
@@ -14,6 +16,7 @@ class SkillChoice:
|
|
|
14
16
|
name: str
|
|
15
17
|
description: str
|
|
16
18
|
path: Path
|
|
19
|
+
installed: bool = False
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
def _short_description(desc: str, max_len: int = 60) -> str:
|
|
@@ -69,8 +72,16 @@ def pick_skills(choices: list[SkillChoice]) -> list[SkillChoice]:
|
|
|
69
72
|
return choices
|
|
70
73
|
|
|
71
74
|
import questionary
|
|
75
|
+
from questionary import constants as q_constants
|
|
76
|
+
from questionary.prompts import common as q_common
|
|
77
|
+
|
|
78
|
+
# Use ✓ and a blank cell as indicators. Some terminal fonts don't render
|
|
79
|
+
# the default ○/● glyphs distinctly.
|
|
80
|
+
q_constants.INDICATOR_SELECTED = "✓"
|
|
81
|
+
q_constants.INDICATOR_UNSELECTED = " "
|
|
82
|
+
q_common.INDICATOR_SELECTED = "✓"
|
|
83
|
+
q_common.INDICATOR_UNSELECTED = " "
|
|
72
84
|
|
|
73
|
-
# Find longest name for alignment
|
|
74
85
|
max_name = max(len(c.name) for c in choices) if choices else 0
|
|
75
86
|
|
|
76
87
|
options = []
|
|
@@ -82,11 +93,17 @@ def pick_skills(choices: list[SkillChoice]) -> list[SkillChoice]:
|
|
|
82
93
|
tokens: list[tuple[str, str]] = [("class:text", f"{c.name:<{max_name}}")]
|
|
83
94
|
if short:
|
|
84
95
|
tokens.append(("class:text", f" {short}"))
|
|
85
|
-
|
|
96
|
+
# Already-installed skills are pre-checked. The ✓ carries the signal.
|
|
97
|
+
options.append(questionary.Choice(title=tokens, value=c, checked=c.installed))
|
|
98
|
+
|
|
99
|
+
# prompt_toolkit's built-in default applies "reverse" to class:selected,
|
|
100
|
+
# which inverts the ✓ indicator. Explicitly cancel it.
|
|
101
|
+
style = questionary.Style([("selected", "noreverse")])
|
|
86
102
|
|
|
87
103
|
selected = questionary.checkbox(
|
|
88
104
|
"Select skills to install:",
|
|
89
105
|
choices=options,
|
|
106
|
+
style=style,
|
|
90
107
|
).ask()
|
|
91
108
|
|
|
92
109
|
if selected is None:
|
|
@@ -94,3 +111,58 @@ def pick_skills(choices: list[SkillChoice]) -> list[SkillChoice]:
|
|
|
94
111
|
return []
|
|
95
112
|
|
|
96
113
|
return selected
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def pick_agents(
|
|
117
|
+
available: list[AgentConfig],
|
|
118
|
+
preselected_ids: list[str] | None = None,
|
|
119
|
+
) -> list[AgentConfig] | None:
|
|
120
|
+
"""Interactive checkbox picker for agents.
|
|
121
|
+
|
|
122
|
+
Returns the selected agents, or None if the user cancelled (ctrl-c).
|
|
123
|
+
Returns an empty list if the user confirmed with nothing selected.
|
|
124
|
+
|
|
125
|
+
Falls back to selecting all available agents in non-TTY environments so
|
|
126
|
+
automation does not hang.
|
|
127
|
+
"""
|
|
128
|
+
if not available:
|
|
129
|
+
return []
|
|
130
|
+
|
|
131
|
+
if not sys.stdin.isatty():
|
|
132
|
+
return list(available)
|
|
133
|
+
|
|
134
|
+
import questionary
|
|
135
|
+
from questionary import constants as q_constants
|
|
136
|
+
from questionary.prompts import common as q_common
|
|
137
|
+
|
|
138
|
+
q_constants.INDICATOR_SELECTED = "✓"
|
|
139
|
+
q_constants.INDICATOR_UNSELECTED = " "
|
|
140
|
+
q_common.INDICATOR_SELECTED = "✓"
|
|
141
|
+
q_common.INDICATOR_UNSELECTED = " "
|
|
142
|
+
|
|
143
|
+
preselected = set(preselected_ids or [])
|
|
144
|
+
max_name = max(len(a.display_name) for a in available)
|
|
145
|
+
|
|
146
|
+
options = []
|
|
147
|
+
for agent in available:
|
|
148
|
+
tokens: list[tuple[str, str]] = [
|
|
149
|
+
("class:text", f"{agent.display_name:<{max_name}}"),
|
|
150
|
+
("class:text", f" ({agent.id})"),
|
|
151
|
+
]
|
|
152
|
+
options.append(
|
|
153
|
+
questionary.Choice(
|
|
154
|
+
title=tokens,
|
|
155
|
+
value=agent,
|
|
156
|
+
checked=agent.id in preselected,
|
|
157
|
+
)
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
style = questionary.Style([("selected", "noreverse")])
|
|
161
|
+
|
|
162
|
+
selected = questionary.checkbox(
|
|
163
|
+
"Default agents:",
|
|
164
|
+
choices=options,
|
|
165
|
+
style=style,
|
|
166
|
+
).ask()
|
|
167
|
+
|
|
168
|
+
return selected
|
|
@@ -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
|
|
@@ -16,7 +16,7 @@ def runner():
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
@pytest.fixture
|
|
19
|
-
def isolated_env(tmp_path):
|
|
19
|
+
def isolated_env(tmp_path, monkeypatch):
|
|
20
20
|
"""Create an isolated environment for CLI tests."""
|
|
21
21
|
home = tmp_path / "home"
|
|
22
22
|
home.mkdir()
|
|
@@ -25,6 +25,12 @@ def isolated_env(tmp_path):
|
|
|
25
25
|
# Create agent directories so auto-detect works
|
|
26
26
|
(home / ".claude").mkdir()
|
|
27
27
|
|
|
28
|
+
# Chdir into a sandbox so commands that resolve project scope via Path.cwd()
|
|
29
|
+
# (e.g. `add --project`) don't write into the real repo.
|
|
30
|
+
project = tmp_path / "project"
|
|
31
|
+
project.mkdir()
|
|
32
|
+
monkeypatch.chdir(project)
|
|
33
|
+
|
|
28
34
|
env = {
|
|
29
35
|
"HOME": str(home),
|
|
30
36
|
"NAPOLN_HOME": str(napoln_home),
|