MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / source_options

Function source_options

deployments/desktop/shared/agents.py:954–1005  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

952 current_year = datetime.now().year
953 notes_root = _configured_notes_root_dir()
954 if notes_root is not None:
955 if notes_root.name == f"Daily Note {current_year}":
956 return notes_root.resolve()
957 return (notes_root / f"Daily Note {current_year}").resolve()
958 for root in _daily_note_roots():
959 candidates = []
960 if root.name == f"Daily Note {current_year}":
961 candidates.append(root)
962 candidates.append(root / f"Daily Note {current_year}")
963 for candidate in candidates:
964 if candidate.exists():
965 return candidate.resolve()
966 return None
967
968
969def _configured_reading_notes_git_dir() -> Optional[Path]:
970 if _configured_notes_root_dir() is not None:
971 return _default_reading_notes_git_dir()
972 raw = _env_text("PAPERFLOW_READING_NOTES_GIT_DIR", "")
973 if raw:
974 path = Path(raw).expanduser()
975 return (path if path.is_absolute() else PROJECT_ROOT / path).resolve()
976 return _default_reading_notes_git_dir()
977
978
979def _configured_reading_notes_git_dir_text() -> str:
980 path = _configured_reading_notes_git_dir()
981 return str(path) if path else ""
982
983
984def _env_list(name: str, default: Optional[List[str]] = None) -> List[str]:
985 raw = _env_text(name)
986 if not raw:
987 return list(default or [])
988 parsed = _load_json(raw, None)
989 if isinstance(parsed, list):
990 return [str(item).strip() for item in parsed if str(item).strip()]
991 return [item.strip() for item in re.split(r"[,;\n]", raw) if item.strip()]
992
993
994def _merge_env_file(updates: Dict[str, str]) -> None:
995 existing_lines = ENV_PATH.read_text(encoding="utf-8").splitlines() if ENV_PATH.exists() else []
996 used: Set[str] = set()
997 next_lines: List[str] = []
998
999 for line in existing_lines:
1000 stripped = line.strip()
1001 if not stripped or stripped.startswith("#") or "=" not in line:
1002 next_lines.append(line)
1003 continue
1004 key = line.split("=", 1)[0].strip()
1005 if key in updates:
1006 next_lines.append(f"{key}={_serialize_env_value(updates[key])}")
1007 used.add(key)
1008 else:

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected