Repository navigation
feat: let users customize the Use default directory path - #892
lucheng-hugh wants to merge 1 commit into
Conversation
Persist a user-chosen path in ~/.pi/agent/pi-web.json so the sidebar action can open a stable folder instead of always creating ~/pi-cwd-YYYYMMDD. Co-authored-by: Cursor <[email protected]>
|
Thanks @lucheng-hugh for the PR. The implementation and tests are thorough. The dated folder name is intentional, though, so I won't merge this: It keeps users out of folders that already hold their data. A first-time user will likely just click "Use default directory". A dated name almost never collides with an existing folder, so the agent won't run inside the user's own data. A configurable path gives up that guarantee. Your PR did point at a real annoyance: the dated folders clutter the home directory. agegr/pi-web#996 · feat(default-cwd): create dated… moves them to ~/pi-cwd/YYYYMMDD. It also switches to the local date (it was UTC, so in UTC+8 you got yesterday's date before 08:00) and selects the default directory through /api/cwd/validate like any other directory. Closing this in favor of agegr/pi-web#996 · feat(default-cwd): create dated…. Thanks again! |
…w project its own path setting Upstream closed agegr#892 in favour of agegr#996, so the configurable default cwd is gone: lib/default-cwd.ts, app/api/default-cwd/route.ts, lib/file-access.ts and lib/default-cwd.test.mjs are byte-identical to upstream/main again, and the DirectoryPicker Escape tweak that came with agegr#892 is reverted. "Use default directory" therefore keeps upstream's dated ~/pi-cwd/<YYYYMMDD> behaviour. The New project action that grew out of it keeps working through its own layer: - lib/default-project.ts stores defaultProjectPath in ~/.pi/agent/pi-web.json, empty meaning the built-in ~/pi-cwd (upstream's dated-folder parent). - GET/PUT /api/default-project own that setting; POST { name } creates or reuses <project directory>/<name>, and the sidebar selects the result through /api/cwd/validate like any other directory. - The Settings panel's General section now offers "Default project directory" instead of "Default directory" (settings.defaultProjectPath*).
新增「Fork-only additions (not in upstream)」一节,把散落在文件表和设计章节里的 自有内容收成一处清单:agegr#899 文件管理、新建项目目录设置(agegr#892)、目录选择器排序、 固定卡片折叠、以及 fork 文档与 .gitattributes。 顺带补上文件表里漏掉的自有文件:lib/file-mutations.ts、lib/file-archives.ts、 lib/archive-names.ts、components/PinnedCard.tsx、components/ThinkingCard.tsx、 components/NewProjectDialog.tsx。
Summary
~/.pi/agent/pi-web.json.~/pi-cwd-YYYYMMDDfolder when the setting is empty, and expand~plus{date}in custom paths.Test plan
~/pi-cwd-{date}as the placeholder and a resolved “Opens …” path.~/…path, then choose Use default directory in the project picker and confirm the sidebar cwd matches it (the folder is created if missing).{date}and confirm it expands to today’s YYYYMMDD.~/pi-cwd-YYYYMMDD.Made with Cursor