diff --git a/paperforge/setup_wizard.py b/paperforge/setup_wizard.py index 2e3f897b..2aced603 100644 --- a/paperforge/setup_wizard.py +++ b/paperforge/setup_wizard.py @@ -1642,6 +1642,8 @@ def _deploy_flat_command( """Deploy skills in flat .md command format (OpenCode).""" imported = [] command_src = repo_root / "command" + if not (command_src.exists() and command_src.is_dir()): + command_src = repo_root / "paperforge" / "command_files" command_dst = vault / command_dir if not (command_src.exists() and command_src.is_dir()): return imported @@ -1979,6 +1981,9 @@ def headless_setup( ]: text = text.replace(old, new) agents_dst.write_text(text, encoding="utf-8") + print(f" [OK] AGENTS.md") + else: + print(f" [WARN] AGENTS.md source not found; skipping") # ========================================================================= # Phase 5: Create config files @@ -2077,7 +2082,7 @@ PADDLEOCR_MODEL=PaddleOCR-VL-1.5 "OCR dir": (pf_path / "ocr").exists(), "paperforge.json": pf_json.exists(), "Obsidian plugin": (vault / ".obsidian" / "plugins" / "paperforge" / "main.js").exists(), - "AGENTS.md": agents_dst.exists(), + "AGENTS.md": True if not agents_src.exists() else agents_dst.exists(), } failed = [k for k, v in checks.items() if not v] if failed: diff --git a/pyproject.toml b/pyproject.toml index 1d1ee052..3a31225e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,6 +53,7 @@ version = {attr = "paperforge.__version__"} paperforge = [ "py.typed", "skills/literature-qa/prompt_deep_subagent.md", + "skills/literature-qa/scripts/*.md", "skills/literature-qa/chart-reading/*.md", "skills/literature-qa/chart-reading/*", "command_files/*.md", diff --git a/tests/test_plugin_install_bootstrap.py b/tests/test_plugin_install_bootstrap.py index f8eb8d5d..5ddb64c9 100644 --- a/tests/test_plugin_install_bootstrap.py +++ b/tests/test_plugin_install_bootstrap.py @@ -35,3 +35,15 @@ def test_setup_args_global_vault_before_subcommand() -> None: f"'--vault' (pos {vault_pos}) must appear before 'setup' (pos {setup_pos}) " "in setupArgs, because --vault is a global paperforge argument" ) + + +def test_setup_wizard_flat_command_falls_back_to_packaged_command_files() -> None: + """pip-installed setup must deploy OpenCode commands from packaged command_files.""" + source = (REPO_ROOT / "paperforge" / "setup_wizard.py").read_text(encoding="utf-8") + assert 'repo_root / "paperforge" / "command_files"' in source + + +def test_setup_wizard_does_not_fail_if_agents_md_missing() -> None: + """AGENTS.md is optional for pip-installed package deployments.""" + source = (REPO_ROOT / "paperforge" / "setup_wizard.py").read_text(encoding="utf-8") + assert 'True if not agents_src.exists() else agents_dst.exists()' in source