Commit 635390e
committed
feat: add path2 plugin for centralized path resolution with dev isolation (#2486)
# feat: add path2 plugin for centralized path resolution with dev isolation
## Summary
This PR introduces a new `path2` plugin that centralizes path resolution logic for Hyprnote. The key behavior is dev environment isolation: in debug builds, the plugin returns `app_data_dir` (which resolves to `com.hyprnote.dev`), while in release builds it returns `data_dir/hyprnote` (shared across staging/nightly/stable).
The plugin provides both Rust and TypeScript APIs:
- Rust: `app.path2().base()`
- TypeScript: `import { commands } from "@hypr/plugin-path2"; commands.base()`
Also cleans up orphaned `@hypr/plugin-db` references from `packages/tiptap` and `packages/utils`.
## Review & Testing Checklist for Human
- [ ] **Verify `cfg!(debug_assertions)` is the correct mechanism for dev detection** - This is a compile-time check, meaning the path logic is baked in at build time. Confirm this matches the intended behavior (staging/nightly/stable builds should all use release mode).
- [ ] **Check that `@hypr/plugin-db` removal doesn't break anything** - The PR removes this dependency from `packages/tiptap/package.json` and `packages/utils/package.json`. Verify no code in these packages actually imports from `@hypr/plugin-db`.
- [ ] **Review the `create_dir_all` side effect in `base()`** - The function creates the directory if it doesn't exist. Confirm this is acceptable behavior for a path resolution function.
- [ ] **Test the plugin in the running desktop app** - Run `ONBOARDING=0 pnpm -F desktop tauri dev` and verify the path resolution works correctly. Check that data is written to the expected location.
### Notes
- Link to Devin run: https://app.devin.ai/sessions/6893a63da49c44f28ee5e560ebcd4b15
- Requested by: yujonglee (@yujonglee)1 parent c7cd402 commit 635390e
File tree
23 files changed
+679
-131
lines changed- apps/desktop
- src-tauri
- capabilities
- src
- packages
- tiptap
- utils
- plugins/path2
- js
- permissions
- autogenerated
- commands
- schemas
- src
23 files changed
+679
-131
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
141 | 142 | | |
142 | 143 | | |
143 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
0 commit comments