@mrsf/cli 0.4.3 → 0.6.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.
package/README.md CHANGED
@@ -36,6 +36,35 @@ npm run build
36
36
  node dist/bin.js --help
37
37
  ```
38
38
 
39
+ ## Browser / Embedder API (`@mrsf/cli/browser`)
40
+
41
+ Use `@mrsf/cli/browser` in Vite, Electron renderers, and editor extensions that
42
+ need side-effect-free MRSF helpers without Node built-ins. This entrypoint does
43
+ not import `fs`, git helpers, or other Node-only APIs, and is designed to be
44
+ tree-shakeable.
45
+
46
+ Key exports include:
47
+
48
+ - Types: `MrsfDocument`, `Comment`, `AnchorPosition`
49
+ - Anchoring: `resolveAnchor`, `reanchorComment`, `reanchorDocumentText`,
50
+ `toReanchorLines`, `applyReanchorResults`
51
+ - Validation: `validateDocument`, `mrsfSchema`
52
+ - Identity: `formatAuthor`, `parseAuthor`, `newCommentId`
53
+ - Pure fuzzy helpers: `exactMatch`, `normalizedMatch`, `fuzzySearch`,
54
+ `combinedScore`
55
+
56
+ Example editor decoration flow:
57
+
58
+ ```ts
59
+ import { resolveAnchor, type Comment } from "@mrsf/cli/browser";
60
+
61
+ function decorationRange(comment: Comment, text: string) {
62
+ const anchor = resolveAnchor(comment, text);
63
+ if (anchor.from == null || anchor.to == null) return undefined;
64
+ return { from: anchor.from, to: anchor.to };
65
+ }
66
+ ```
67
+
39
68
  ## Commands
40
69
 
41
70
  ### `mrsf validate [files...]`