@@ -131,6 +131,21 @@ export class Instances extends APIResource {
131131 return this . _client . post ( path `/instances/${ id } /start` , options ) ;
132132 }
133133
134+ /**
135+ * Returns information about a path in the guest filesystem. Useful for checking if
136+ * a path exists, its type, and permissions before performing file operations.
137+ *
138+ * @example
139+ * ```ts
140+ * const pathInfo = await client.instances.stat('id', {
141+ * path: 'path',
142+ * });
143+ * ```
144+ */
145+ stat ( id : string , query : InstanceStatParams , options ?: RequestOptions ) : APIPromise < PathInfo > {
146+ return this . _client . get ( path `/instances/${ id } /stat` , { query, ...options } ) ;
147+ }
148+
134149 /**
135150 * Stop instance (graceful shutdown)
136151 *
@@ -261,6 +276,49 @@ export namespace Instance {
261276 }
262277}
263278
279+ export interface PathInfo {
280+ /**
281+ * Whether the path exists
282+ */
283+ exists : boolean ;
284+
285+ /**
286+ * Error message if stat failed (e.g., permission denied). Only set when exists is
287+ * false due to an error rather than the path not existing.
288+ */
289+ error ?: string | null ;
290+
291+ /**
292+ * True if this is a directory
293+ */
294+ is_dir ?: boolean ;
295+
296+ /**
297+ * True if this is a regular file
298+ */
299+ is_file ?: boolean ;
300+
301+ /**
302+ * True if this is a symbolic link (only set when follow_links=false)
303+ */
304+ is_symlink ?: boolean ;
305+
306+ /**
307+ * Symlink target path (only set when is_symlink=true)
308+ */
309+ link_target ?: string | null ;
310+
311+ /**
312+ * File mode (Unix permissions)
313+ */
314+ mode ?: number ;
315+
316+ /**
317+ * File size in bytes
318+ */
319+ size ?: number ;
320+ }
321+
264322export interface PortMapping {
265323 /**
266324 * Port in the guest VM
@@ -393,17 +451,31 @@ export interface InstanceLogsParams {
393451 tail ?: number ;
394452}
395453
454+ export interface InstanceStatParams {
455+ /**
456+ * Path to stat in the guest filesystem
457+ */
458+ path : string ;
459+
460+ /**
461+ * Follow symbolic links (like stat vs lstat)
462+ */
463+ follow_links ?: boolean ;
464+ }
465+
396466Instances . Volumes = Volumes ;
397467
398468export declare namespace Instances {
399469 export {
400470 type Instance as Instance ,
471+ type PathInfo as PathInfo ,
401472 type PortMapping as PortMapping ,
402473 type VolumeMount as VolumeMount ,
403474 type InstanceListResponse as InstanceListResponse ,
404475 type InstanceLogsResponse as InstanceLogsResponse ,
405476 type InstanceCreateParams as InstanceCreateParams ,
406477 type InstanceLogsParams as InstanceLogsParams ,
478+ type InstanceStatParams as InstanceStatParams ,
407479 } ;
408480
409481 export {
0 commit comments