@oh-my-pi/pi-natives 15.10.4 → 15.10.6

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/native/index.d.ts CHANGED
@@ -136,7 +136,7 @@ export declare class Shell {
136
136
  * `packages/natives/native/index.js` (which derives the name from
137
137
  * `package.json#version`).
138
138
  */
139
- export declare function __piNativesV15_10_4(): void
139
+ export declare function __piNativesV15_10_6(): void
140
140
 
141
141
  /**
142
142
  * Apply conservative pre-execution rewrites to a bash command.
@@ -228,6 +228,56 @@ export interface AstFindResult {
228
228
  */
229
229
  export declare function astGrep(options: AstFindOptions): Promise<AstFindResult>
230
230
 
231
+ /**
232
+ * Match ast-grep patterns against an in-memory source string; returns a
233
+ * promise resolved on a worker thread.
234
+ *
235
+ * This is the file-free counterpart to [`ast_grep`]: callers that already hold
236
+ * the source (streaming buffers, generated code, editor contents) avoid a
237
+ * temp-file round trip. `lang` is required since there is no path to infer it
238
+ * from.
239
+ */
240
+ export declare function astMatch(options: AstMatchOptions): Promise<AstMatchResult>
241
+
242
+ /**
243
+ * Options for `astMatch`: run ast-grep patterns against an in-memory source
244
+ * string instead of files on disk.
245
+ */
246
+ export interface AstMatchOptions {
247
+ /** Source code to match against (parsed in memory, never read from disk). */
248
+ source: string
249
+ /** Language of `source` (required; e.g. "ts", "tsx", "rust", "python"). */
250
+ lang: string
251
+ /** ast-grep patterns to search for (OR across patterns). */
252
+ patterns: Array<string>
253
+ /** Rule selector for multi-rule ast-grep configurations. */
254
+ selector?: string
255
+ /** Pattern strictness; defaults to smart matching when omitted. */
256
+ strictness?: AstMatchStrictness
257
+ /** Maximum matches to return after `offset` (default applies when omitted). */
258
+ limit?: number
259
+ /** Number of leading matches to skip before applying `limit`. */
260
+ offset?: number
261
+ /** When true, include meta-variable bindings per match. */
262
+ includeMeta?: boolean
263
+ /** Optional cancellation handle (library-specific). */
264
+ signal?: unknown
265
+ /** Wall-clock timeout for the worker task in milliseconds. */
266
+ timeoutMs?: number
267
+ }
268
+
269
+ /** Result of an in-memory `astMatch` run. */
270
+ export interface AstMatchResult {
271
+ /** Page of matches after sort, offset, and limit. */
272
+ matches: Array<AstFindMatch>
273
+ /** Total matches found before paging (can exceed `matches.length`). */
274
+ totalMatches: number
275
+ /** True when results were truncated by `limit`. */
276
+ limitReached: boolean
277
+ /** Non-fatal parse or pattern-compile errors collected during the run. */
278
+ parseErrors?: Array<string>
279
+ }
280
+
231
281
  /** ast-grep pattern strictness (controls how patterns match syntax). */
232
282
  export declare enum AstMatchStrictness {
233
283
  /** Match at the concrete syntax tree level. */
@@ -428,6 +478,31 @@ export declare enum Ellipsis {
428
478
  Omit = 2
429
479
  }
430
480
 
481
+ /**
482
+ * Matching-bracket context for an arbitrary tree-sitter language.
483
+ *
484
+ * For each multi-line named node whose span crosses the visible window, return
485
+ * the boundary line sitting *outside* that window (the closer when the opener
486
+ * is shown, the opener when the closer is shown). Covers brace and indentation
487
+ * languages alike using real syntactic spans.
488
+ *
489
+ * Returns `null` when the language is unrecognized or the source fails to
490
+ * parse / carries a syntax error (caller should fall back to a lexical scan);
491
+ * a sorted, unique list of 1-indexed boundary lines otherwise.
492
+ */
493
+ export declare function enclosingBlockBoundaries(options: EnclosingBoundaryOptions): Array<number> | null
494
+
495
+ export interface EnclosingBoundaryOptions {
496
+ /** Source code to inspect. */
497
+ code: string
498
+ /** Language alias (e.g. "rust", "typescript") used before path inference. */
499
+ lang?: string
500
+ /** File path used to infer language by extension when `lang` is omitted. */
501
+ path?: string
502
+ /** 1-indexed inclusive visible line ranges (the lines actually shown). */
503
+ ranges: Array<LineRange>
504
+ }
505
+
431
506
  /**
432
507
  * Encode image bytes into a SIXEL escape sequence for terminal rendering.
433
508
  *
@@ -907,6 +982,13 @@ export declare enum KeyEventType {
907
982
  Release = 3
908
983
  }
909
984
 
985
+ export interface LineRange {
986
+ /** 1-indexed inclusive first visible line. */
987
+ startLine: number
988
+ /** 1-indexed inclusive last visible line. */
989
+ endLine: number
990
+ }
991
+
910
992
  /**
911
993
  * Walk the workspace once and return tree entries plus AGENTS.md candidates.
912
994
  *
package/native/index.js CHANGED
@@ -23,14 +23,16 @@ export const PtySession = nativeBindings.PtySession;
23
23
  export const Shell = nativeBindings.Shell;
24
24
 
25
25
  // functions
26
- export const __piNativesV15_10_4 = nativeBindings.__piNativesV15_10_4;
26
+ export const __piNativesV15_10_6 = nativeBindings.__piNativesV15_10_6;
27
27
  export const applyBashFixups = nativeBindings.applyBashFixups;
28
28
  export const astEdit = nativeBindings.astEdit;
29
29
  export const astGrep = nativeBindings.astGrep;
30
+ export const astMatch = nativeBindings.astMatch;
30
31
  export const blockRangeAt = nativeBindings.blockRangeAt;
31
32
  export const copyToClipboard = nativeBindings.copyToClipboard;
32
33
  export const countTokens = nativeBindings.countTokens;
33
34
  export const detectMacOSAppearance = nativeBindings.detectMacOSAppearance;
35
+ export const enclosingBlockBoundaries = nativeBindings.enclosingBlockBoundaries;
34
36
  export const encodeSixel = nativeBindings.encodeSixel;
35
37
  export const executeShell = nativeBindings.executeShell;
36
38
  export const extractSegments = nativeBindings.extractSegments;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-natives",
3
- "version": "15.10.4",
3
+ "version": "15.10.6",
4
4
  "description": "Native Rust bindings for grep, clipboard, image processing, syntax highlighting, PTY, and shell operations via N-API",
5
5
  "type": "module",
6
6
  "homepage": "https://omp.sh",
@@ -66,10 +66,10 @@
66
66
  }
67
67
  },
68
68
  "optionalDependencies": {
69
- "@oh-my-pi/pi-natives-linux-x64": "15.10.4",
70
- "@oh-my-pi/pi-natives-linux-arm64": "15.10.4",
71
- "@oh-my-pi/pi-natives-darwin-x64": "15.10.4",
72
- "@oh-my-pi/pi-natives-darwin-arm64": "15.10.4",
73
- "@oh-my-pi/pi-natives-win32-x64": "15.10.4"
69
+ "@oh-my-pi/pi-natives-linux-x64": "15.10.6",
70
+ "@oh-my-pi/pi-natives-linux-arm64": "15.10.6",
71
+ "@oh-my-pi/pi-natives-darwin-x64": "15.10.6",
72
+ "@oh-my-pi/pi-natives-darwin-arm64": "15.10.6",
73
+ "@oh-my-pi/pi-natives-win32-x64": "15.10.6"
74
74
  }
75
75
  }