@druumen/sessions-db 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +249 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +10 -0
  4. package/README.md +250 -0
  5. package/cli/_write-helpers.mjs +99 -0
  6. package/cli/alias.mjs +115 -0
  7. package/cli/argparse.mjs +296 -0
  8. package/cli/close.mjs +116 -0
  9. package/cli/find.mjs +185 -0
  10. package/cli/format.mjs +277 -0
  11. package/cli/link-parent.mjs +133 -0
  12. package/cli/link.mjs +132 -0
  13. package/cli/rebuild.mjs +98 -0
  14. package/cli/sessions-db-session-start-main.mjs +454 -0
  15. package/cli/sessions-db-session-start.mjs +56 -0
  16. package/cli/sessions-db.mjs +119 -0
  17. package/cli/sweep.mjs +171 -0
  18. package/cli/tree.mjs +127 -0
  19. package/lib/git-context.mjs +479 -0
  20. package/lib/identity.mjs +616 -0
  21. package/lib/index.mjs +145 -0
  22. package/lib/init.mjs +185 -0
  23. package/lib/lock.mjs +86 -0
  24. package/lib/operations.mjs +490 -0
  25. package/lib/paths.mjs +199 -0
  26. package/lib/projection.mjs +496 -0
  27. package/lib/sanitize.mjs +131 -0
  28. package/lib/storage.mjs +759 -0
  29. package/lib/sweep.mjs +209 -0
  30. package/lib/transcript.mjs +230 -0
  31. package/lib/types.mjs +276 -0
  32. package/lib/uuid.mjs +116 -0
  33. package/lib/watch.mjs +217 -0
  34. package/package.json +53 -0
  35. package/types/git-context.d.mts +98 -0
  36. package/types/identity.d.mts +658 -0
  37. package/types/index.d.mts +10 -0
  38. package/types/index.d.ts +127 -0
  39. package/types/init.d.mts +53 -0
  40. package/types/lock.d.mts +18 -0
  41. package/types/operations.d.mts +204 -0
  42. package/types/paths.d.mts +54 -0
  43. package/types/projection.d.mts +79 -0
  44. package/types/sanitize.d.mts +39 -0
  45. package/types/storage.d.mts +276 -0
  46. package/types/sweep.d.mts +58 -0
  47. package/types/transcript.d.mts +59 -0
  48. package/types/types.d.mts +255 -0
  49. package/types/uuid.d.mts +17 -0
  50. package/types/watch.d.mts +33 -0
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Watch the projection file at `rootPath` and invoke `listener` on change.
3
+ *
4
+ * Path resolution (Day 4 — symmetric with storage.mjs):
5
+ *
6
+ * - If `opts.paths.projectionJson` is provided, that's the file watched
7
+ * (anchored on `rootPath` if relative). Backward-compat with Day 1-3.
8
+ *
9
+ * - Otherwise `rootPath` is treated as a Day 4 storage root and we
10
+ * delegate to `resolveStoragePaths({ rootPath })` so the canonical
11
+ * filename + cross-platform path normalization apply uniformly.
12
+ *
13
+ * @param {string} rootPath
14
+ * @param {(event: { type: 'change' | 'rename' | 'poll', path: string }) => void} listener
15
+ * @param {{
16
+ * paths?: { projectionJson?: string },
17
+ * pollIntervalMs?: number,
18
+ * debounceMs?: number,
19
+ * }} [opts]
20
+ * @returns {{ dispose: () => void }}
21
+ */
22
+ export function watchProjection(rootPath: string, listener: (event: {
23
+ type: "change" | "rename" | "poll";
24
+ path: string;
25
+ }) => void, opts?: {
26
+ paths?: {
27
+ projectionJson?: string;
28
+ };
29
+ pollIntervalMs?: number;
30
+ debounceMs?: number;
31
+ }): {
32
+ dispose: () => void;
33
+ };