bootstrap: source packs from a pack-index repo; clone only selected packs

The set of packs is now owned by a dedicated pack index repo (semif-packs) instead of the agent-repo packs.json + the hardcoded setup PACK_CHOICES.

- bootstrap.sh fetches the index, then runs setup in two passes (--answers-out, then clone the selected packs, then write config) so it never clones a pack the user did not choose. essentials is always cloned; +simplex for the simplex gateway's address script; +browser for --browser. Reruns clone only the packs the config references.

- setup gains --answers-out and --pack-index; the interview's pack choices come from the index. PACK_CHOICES removed.

- delete packs.json; update README, PACKGEN.md, the packgen skill, and AGENTS.md.
This commit is contained in:
gabby committed 2026-10-14 16:13:13 +00:00
1 parent c57983f1f5
commit bf071ee529
9 files changed
+397 -139

No files matched your search

+80 -1
View File
@@ -23,6 +23,7 @@ from semif_agent.setup import (
build_config,
build_plan,
build_secrets,
load_pack_index,
plan_from_config,
run_interview,
run_setup,
@@ -200,7 +201,17 @@ def test_interview_collects_authoring_endpoints_and_packs():
"Europe/Paris", # timezone
]
)
answers = run_interview(input_fn=script, output=_silent)
# The offered packs come from the pack index (letters a,b,c,d in order).
answers = run_interview(
input_fn=script,
output=_silent,
pack_choices=[
("simplex", "SimpleX"),
("browser", "Browser"),
("nextcloud", "Nextcloud"),
("outlook", "Outlook"),
],
)
assert answers.engine_provider == "semif"
assert answers.new_skill_creation == "ask"
assert answers.llm_provider == "semif"
@@ -219,6 +230,53 @@ def test_interview_non_interactive_returns_minimum():
assert answers.gateways == []
def test_interview_without_index_offers_essentials_only():
# No pack index -> the pack question is skipped (essentials only).
script = _scripted(
[
"1", # engine: local semif
"1", # authoring: deny
"", # gateways: none
"", # timezone: host
]
)
answers = run_interview(input_fn=script, output=_silent, pack_choices=[])
assert answers.packs == ["essentials"]
# --------------------------------------------------------------------------- #
# Pack index (the source of truth for which packs exist)
# --------------------------------------------------------------------------- #
def test_load_pack_index_parses_entries(tmp_path):
index = tmp_path / "packs.json"
index.write_text(
json.dumps(
{
"packs": [
{"name": "essentials", "url": "ssh://h/pack.essentials.git"},
{
"name": "simplex",
"url": "ssh://h/pack.simplex.git",
"title": "SimpleX",
"description": "messaging",
},
{"name": "", "url": "ssh://h/ignored.git"},
]
}
)
)
choices = load_pack_index(str(index))
assert choices == [
("essentials", "essentials"),
("simplex", "SimpleX — messaging"),
]
# Missing/unreadable index -> no choices (essentials-only interview).
assert load_pack_index(None) == []
assert load_pack_index(str(tmp_path / "nope.json")) == []
# --------------------------------------------------------------------------- #
# run_setup: files, secrets, plan, idempotency
# --------------------------------------------------------------------------- #
@@ -247,6 +305,27 @@ def test_run_setup_writes_split_config_and_secrets(tmp_path):
assert reloaded["packs"]["essentials"]["enabled"] is True
def test_run_setup_answers_out_writes_answers_and_no_config(tmp_path):
# The bootstrap pre-clone pass: answers only, no packs, no config.
answers_out = tmp_path / "bootstrap-answers.json"
code = run_setup(
root=tmp_path,
path=tmp_path / "config.json",
packs=[],
yes=True,
answers_out=str(answers_out),
output=_silent,
)
assert code == 0
answers = json.loads(answers_out.read_text())
assert answers["packs"] == ["essentials"]
assert answers["engine_provider"] == "semif"
# Nothing else was written.
assert not (tmp_path / "config.json").exists()
assert not (tmp_path / "config").exists()
assert not (tmp_path / "secrets.json").exists()
def test_run_setup_answers_file_and_secrets_merge(tmp_path):
answers = {
"new_skill_creation": "allow",