mirror of
https://github.com/lllin000/PaperForge.git
synced 2026-07-22 06:50:53 +00:00
fix: support pip-installed setup asset deployment and optional AGENTS guide
This commit is contained in:
parent
b2da1b4b22
commit
0f3b392d0b
3 changed files with 19 additions and 1 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue