Skip to content

Commit faaa32b

Browse files
committed
update normalized reading notes
1 parent 3ff96cb commit faaa32b

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

deployments/desktop/shared/agents.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,8 +850,18 @@ def _configured_reading_notes_git_branch() -> str:
850850
return _env_text("PAPERFLOW_READING_NOTES_GIT_BRANCH", "main") or "main"
851851

852852

853+
def _normalize_reading_notes_git_remote(remote_url: str) -> str:
854+
"""Prefer SSH for plain GitHub remotes so GUI sync can use the user's SSH key."""
855+
remote = str(remote_url or "").strip()
856+
match = re.fullmatch(r"https://github\.com/([^/\s]+)/([^/\s]+?)(?:\.git)?/?", remote)
857+
if not match:
858+
return remote
859+
owner, repo = match.groups()
860+
return f"git@github.com:{owner}/{repo}.git"
861+
862+
853863
def _configured_reading_notes_git_remote() -> str:
854-
return _env_text("PAPERFLOW_READING_NOTES_GIT_REMOTE", "")
864+
return _normalize_reading_notes_git_remote(_env_text("PAPERFLOW_READING_NOTES_GIT_REMOTE", ""))
855865

856866

857867
def _default_reading_notes_git_dir() -> Optional[Path]:

tests/test_desktop_gui.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ def test_desktop_save_settings_updates_env_file(tmp_path, monkeypatch: pytest.Mo
12671267
assert result["paths"]["reading_reports_dir"] == str(tmp_path / "Daily Note")
12681268
assert result["paths"]["wiki_dir"] == str(tmp_path / "Daily Note" / "wiki")
12691269
assert result["paths"]["reading_notes_git_dir"] == str(tmp_path / "Daily Note" / "Daily Note 2026")
1270-
assert result["paths"]["reading_notes_git_remote"] == "https://github.com/example/notes.git"
1270+
assert result["paths"]["reading_notes_git_remote"] == "git@github.com:example/notes.git"
12711271
assert result["paths"]["reading_notes_git_branch"] == "main"
12721272
assert result["paths"]["reading_notes_git_llm_review"] is False
12731273
assert "PAPERFLOW_CONFERENCE_ACCESS_MODE=credential" in text
@@ -1289,6 +1289,15 @@ def test_desktop_save_settings_updates_env_file(tmp_path, monkeypatch: pytest.Mo
12891289
assert result["source_preferences"]["auth_status"]["semantic_scholar_api_key"] is True
12901290

12911291

1292+
def test_desktop_normalizes_plain_github_notes_remote_to_ssh(tmp_path, monkeypatch: pytest.MonkeyPatch) -> None:
1293+
env_path = tmp_path / ".env"
1294+
env_path.write_text("PAPERFLOW_READING_NOTES_GIT_REMOTE=https://github.com/example/notes\n", encoding="utf-8")
1295+
monkeypatch.setattr(agents, "ENV_PATH", env_path)
1296+
monkeypatch.delenv("PAPERFLOW_READING_NOTES_GIT_REMOTE", raising=False)
1297+
1298+
assert agents._configured_reading_notes_git_remote() == "git@github.com:example/notes.git"
1299+
1300+
12921301
def test_desktop_settings_preserves_zero_relevance_threshold(tmp_path, monkeypatch: pytest.MonkeyPatch) -> None:
12931302
env_path = tmp_path / ".env"
12941303
env_path.write_text("PAPERFLOW_RELEVANCE_THRESHOLD=60\n", encoding="utf-8")

0 commit comments

Comments
 (0)