Programmatic Usage
You can use lin as a library and run commands programmatically. This is useful for integrating lin into your own scripts or tools.
All commands and types are exported from the main package entry point.
The run function
Section titled “The run function”The run function allows you to execute any command.
import { run } from '@rttnd/lin'
// Simple usage: run the 'translate' command with the --silent flagawait run('translate', ['-S'])Advanced Usage
Section titled “Advanced Usage”The run function accepts an optional third argument, options, to control execution behavior. It returns a RunResult object with details about the execution.
function run(  command: keyof Commands,  rawArgs?: string[],  options?: {    dry?: boolean // default: false    output?: 'live' | 'capture' | 'silent' // default: 'live'  }): Promise<{  result: unknown  output?: string  writes?: Record<string, string>  deletes?: string[]}>dry: A boolean that, iftrue, prevents any file system modifications. Instead of writing or deleting files,runwill return the planned changes in thewritesanddeletesobjects.output: can return the console output inoutput'live'(default) - print only.'capture'- print and return captured text.'silent'- capture text without printing.
Example: Dry Run with Output Capture
Section titled “Example: Dry Run with Output Capture”Here’s how you can see what files check --fix would change, without actually modifying your disk:
import { run } from '@rttnd/lin'
const { output, writes } = await run(  'check',  ['--fix'],  { dry: true, output: 'silent' },)
console.log('--- Captured Console Output ---')console.log(output)
console.log('\n--- Files to be Written ---')for (const [file, content] of Object.entries(writes || {})) {  console.log(`File: ${file}`)  console.log(content) // content is the full file content}