@rsdoctor/agent-cli
Advanced tools
| export declare function runCli(argv?: string[], options?: { | ||
| executeTool?: (request: { | ||
| toolName: string; | ||
| input: Record<string, unknown>; | ||
| dataFile: string; | ||
| }) => Promise<unknown>; | ||
| write?: (text: string) => void; | ||
| writeError?: (text: string) => void; | ||
| }): Promise<number>; | ||
| export declare function main(argv?: string[]): Promise<void>; |
| export interface Chunk { | ||
| id: number; | ||
| name: string; | ||
| size: number; | ||
| modules: unknown[]; | ||
| assets: Array<{ | ||
| name: string; | ||
| size: number; | ||
| gzipSize?: number; | ||
| }>; | ||
| } | ||
| export interface Module { | ||
| id: number; | ||
| path: string; | ||
| name: string; | ||
| webpackId?: string; | ||
| size?: Record<string, unknown>; | ||
| issuerPath?: unknown[]; | ||
| dependencies?: unknown[]; | ||
| imported?: unknown[]; | ||
| chunks?: unknown[]; | ||
| isEntry?: boolean; | ||
| bailoutReason?: unknown; | ||
| kind?: string; | ||
| concatenationModules?: unknown[]; | ||
| } | ||
| export interface Package { | ||
| id: number; | ||
| name: string; | ||
| version: string; | ||
| size?: Record<string, unknown>; | ||
| duplicates?: unknown[]; | ||
| root?: string; | ||
| } | ||
| interface PackageDependency { | ||
| id: number; | ||
| dependency: number; | ||
| package?: number; | ||
| refDependency?: number; | ||
| } | ||
| interface RsdoctorError { | ||
| id: string; | ||
| code: string; | ||
| title: string; | ||
| description: string; | ||
| level: string; | ||
| category: string; | ||
| type: string; | ||
| link?: string; | ||
| error?: unknown; | ||
| stack?: string; | ||
| packages?: unknown[]; | ||
| } | ||
| export interface RsdoctorData { | ||
| data?: { | ||
| chunkGraph?: { | ||
| chunks?: Array<{ | ||
| id: number | string; | ||
| name?: string; | ||
| size?: number; | ||
| modules?: unknown[]; | ||
| }>; | ||
| assets?: Array<{ | ||
| path?: string; | ||
| name?: string; | ||
| size?: number; | ||
| gzipSize?: number; | ||
| chunks?: unknown[]; | ||
| }>; | ||
| entrypoints?: unknown[]; | ||
| }; | ||
| moduleGraph?: { | ||
| modules?: Module[]; | ||
| dependencies?: Array<{ | ||
| module: number; | ||
| issuer: number; | ||
| }>; | ||
| exports?: unknown[]; | ||
| }; | ||
| packageGraph?: { | ||
| packages?: Package[]; | ||
| dependencies?: PackageDependency[]; | ||
| }; | ||
| errors?: RsdoctorError[]; | ||
| loader?: unknown[] | { | ||
| chartData?: unknown[]; | ||
| data?: unknown[]; | ||
| directories?: unknown[]; | ||
| directoriesData?: unknown[]; | ||
| }; | ||
| summary?: { | ||
| costs?: Array<{ | ||
| costs?: number; | ||
| }>; | ||
| }; | ||
| configs?: Array<{ | ||
| config?: unknown; | ||
| }>; | ||
| }; | ||
| } | ||
| export declare function setDataFilePath(filePath: string): void; | ||
| export declare function getDataFilePath(): string | null; | ||
| export declare function loadJsonData(filePath: string): RsdoctorData; | ||
| export declare function requireDataFile(): RsdoctorData; | ||
| export declare function getChunks(pageNumber?: number, pageSize?: number): { | ||
| total: number; | ||
| pageNumber: number; | ||
| pageSize: number; | ||
| totalPages: number; | ||
| items: Chunk[]; | ||
| }; | ||
| export declare function getChunkById(chunkId: string | number): Chunk | undefined; | ||
| export declare function getModules(): Module[]; | ||
| export declare function getModulesByPath(modulePath: string): Array<{ | ||
| id: number; | ||
| path: string; | ||
| name: string; | ||
| webpackId?: string; | ||
| }>; | ||
| export declare function getModuleById(moduleId: string): Module | undefined; | ||
| export declare function getModuleIssuerPath(moduleId: string): Array<{ | ||
| id: number; | ||
| path: string; | ||
| name: string; | ||
| }>; | ||
| export declare function getModuleExports(): unknown[]; | ||
| export declare function getPackages(): Package[]; | ||
| export declare function getPackagesFiltered(): Array<{ | ||
| id: number; | ||
| name: string; | ||
| version: string; | ||
| size: unknown; | ||
| duplicates: unknown; | ||
| }>; | ||
| export declare function getPackagesByName(packageName: string): Package[]; | ||
| export declare function getDirectDependencyPackages(): Array<{ | ||
| id: number; | ||
| name: string; | ||
| version: string; | ||
| root?: string; | ||
| size: unknown; | ||
| duplicates: unknown; | ||
| dependencyIds: number[]; | ||
| refDependencyIds: number[]; | ||
| }>; | ||
| export declare function getPackageDependencies(pageNumber?: number, pageSize?: number): { | ||
| total: number; | ||
| pageNumber: number; | ||
| pageSize: number; | ||
| totalPages: number; | ||
| items: unknown[]; | ||
| }; | ||
| export declare function getRules(): Array<{ | ||
| id: string; | ||
| code: string; | ||
| title: string; | ||
| description: string; | ||
| level: string; | ||
| category: string; | ||
| type: string; | ||
| }>; | ||
| export declare function getLoaderChartData(): unknown[]; | ||
| export declare function getLoaderDirectories(): unknown[]; | ||
| export declare function getLongLoadersByCosts(): Array<{ | ||
| costs: number; | ||
| }>; | ||
| export declare function getBuildSummary(): { | ||
| costs: Array<{ | ||
| costs?: number; | ||
| }>; | ||
| totalCost: number; | ||
| } | null; | ||
| export declare function getAssets(): unknown[]; | ||
| export declare function getEntrypoints(): unknown[]; | ||
| export declare function getBuildConfig(): unknown | null; | ||
| export declare function getErrors(): RsdoctorError[]; | ||
| export * from './datasource/tree-shaking.js'; |
| interface BailoutModule { | ||
| id: number; | ||
| path: string; | ||
| bailoutReason: unknown; | ||
| size: Record<string, number>; | ||
| chunks: unknown[]; | ||
| } | ||
| export type SideEffectsCategory = 'cjs' | 'barrel' | 'side-effects' | 'dynamic-import'; | ||
| export type RetainedModuleCategory = SideEffectsCategory | 'unknown'; | ||
| export declare const sideEffectsCategories: SideEffectsCategory[]; | ||
| export declare const retainedModuleCategories: RetainedModuleCategory[]; | ||
| export declare function getSideEffects(pageNumber?: number, pageSize?: number): { | ||
| total: number; | ||
| pageNumber: number; | ||
| pageSize: number; | ||
| totalPages: number; | ||
| nodeModules: { | ||
| count: number; | ||
| topPackages: Array<{ | ||
| name: string; | ||
| count: number; | ||
| totalSize: number; | ||
| modules: BailoutModule[]; | ||
| }>; | ||
| }; | ||
| userCode: { | ||
| count: number; | ||
| totalPages: number; | ||
| modules: BailoutModule[]; | ||
| }; | ||
| all: BailoutModule[]; | ||
| }; | ||
| export declare function getSideEffectsByCategory(category: SideEffectsCategory, pageNumber?: number, pageSize?: number): { | ||
| category: SideEffectsCategory; | ||
| total: number; | ||
| pageNumber: number; | ||
| pageSize: number; | ||
| totalPages: number; | ||
| modules: BailoutModule[]; | ||
| }; | ||
| export declare function getRetainedModules(options: { | ||
| emittedOnly?: boolean; | ||
| categories?: RetainedModuleCategory[]; | ||
| sort?: 'sourceSize' | 'parsedSize' | 'gzipSize'; | ||
| limit?: number; | ||
| filterFields?: string[]; | ||
| }): { | ||
| total: number; | ||
| emittedOnly: boolean; | ||
| categories: RetainedModuleCategory[]; | ||
| sort: string; | ||
| limit: number; | ||
| items: Array<Record<string, unknown>>; | ||
| }; | ||
| export declare function getBailoutReasonModules(pageNumber?: number, pageSize?: number, moduleFilters?: Array<string | number>): { | ||
| total: number; | ||
| pageNumber: number; | ||
| pageSize: number; | ||
| totalPages: number; | ||
| modules: BailoutModule[]; | ||
| }; | ||
| export {}; |
| export declare function listAssets(): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function diffAssets(baselineInput: string | undefined, currentInput: string | undefined): Promise<{ | ||
| ok: boolean; | ||
| data: { | ||
| note: string; | ||
| baseline: string; | ||
| current: string; | ||
| diff: unknown; | ||
| }; | ||
| description: string; | ||
| }>; | ||
| export declare function getMediaAssets(): Promise<{ | ||
| ok: boolean; | ||
| data: { | ||
| guidance: string; | ||
| chunks: unknown; | ||
| }; | ||
| description: string; | ||
| }>; |
| export declare function getSummary(): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function listEntrypoints(): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function getConfig(): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function optimizeBundle(stepInput?: string): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function getDataFileInfo(): Promise<{ | ||
| ok: boolean; | ||
| data: { | ||
| mode: string; | ||
| dataFile: string | null; | ||
| note: string; | ||
| }; | ||
| description: string; | ||
| }>; |
| interface Chunk { | ||
| size: number; | ||
| } | ||
| export declare function getLargeChunksData(chunks: Chunk[]): { | ||
| median: number; | ||
| operator: number; | ||
| minSizeMB: number; | ||
| oversized: Chunk[]; | ||
| }; | ||
| export declare function listChunks(pageNumberInput?: string, pageSizeInput?: string): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function getChunkById(chunkIdInput: string | undefined): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| }>; | ||
| export declare function findLargeChunks(): Promise<{ | ||
| ok: boolean; | ||
| data: { | ||
| median: number; | ||
| operator: number; | ||
| minSizeMB: number; | ||
| oversized: unknown[]; | ||
| }; | ||
| description: string; | ||
| }>; | ||
| export {}; |
| export declare function listErrors(): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function getErrorsByCode(codeInput: string | undefined): Promise<{ | ||
| ok: boolean; | ||
| data: unknown[]; | ||
| description: string; | ||
| }>; | ||
| export declare function getErrorsByLevel(levelInput: string | undefined): Promise<{ | ||
| ok: boolean; | ||
| data: unknown[]; | ||
| description: string; | ||
| }>; |
| export declare function getHotFiles(pageNumberInput?: string, pageSizeInput?: string, minCostsInput?: string): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function getDirectories(pageNumberInput?: string, pageSizeInput?: string, minTotalCostsInput?: string): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; |
| export declare function getModuleById(moduleIdInput: string | undefined): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function getModuleByPath(modulePathInput: string | undefined): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function getModuleIssuerPath(moduleIdInput: string | undefined): Promise<{ | ||
| ok: boolean; | ||
| data: { | ||
| moduleId: string; | ||
| issuerPath: unknown; | ||
| }; | ||
| description: string; | ||
| }>; | ||
| export declare function getModuleExports(): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function getSideEffectsHandler(pageNumberInput?: string, pageSizeInput?: string, categoryInput?: string | true): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; |
| interface Rule { | ||
| code?: string; | ||
| description?: string; | ||
| } | ||
| export declare function listPackages(pageNumberInput?: string, pageSizeInput?: string): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function getPackageByName(packageNameInput: string | undefined): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function getPackageDependencies(pageNumberInput?: string, pageSizeInput?: string): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function listDirectDependencyPackages(): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function detectDuplicatePackages(): Promise<{ | ||
| ok: boolean; | ||
| data: { | ||
| rule: Rule | null; | ||
| totalRules: number; | ||
| note?: string; | ||
| }; | ||
| description: string; | ||
| }>; | ||
| export declare function detectSimilarPackages(): Promise<{ | ||
| ok: boolean; | ||
| data: { | ||
| similarPackages: string[][]; | ||
| totalPackages: number; | ||
| note?: string; | ||
| }; | ||
| description: string; | ||
| }>; | ||
| export {}; |
| export declare function listRules(): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; |
| interface Rule { | ||
| description?: string; | ||
| code?: string; | ||
| } | ||
| export declare function getTreeShakingSummary(): Promise<{ | ||
| ok: boolean; | ||
| data: { | ||
| violations: { | ||
| e1007SideEffectsOnlyImports: Rule | null; | ||
| e1008CjsRequire: Rule | null; | ||
| e1009EsmToCjs: Rule | null; | ||
| }; | ||
| totalViolations: number; | ||
| totalRules: number; | ||
| }; | ||
| description: string; | ||
| }>; | ||
| export declare function getBailoutModules(pageNumberInput?: string, pageSizeInput?: string, modulesInput?: string | true | string[] | number[]): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function getRetainedModulesHandler(emittedOnlyInput?: string | true, categoryInput?: string | true, sortInput?: string | true, limitInput?: string, filterInput?: string | true): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export declare function getExportsAnalysis(): Promise<{ | ||
| ok: boolean; | ||
| data: unknown; | ||
| description: string; | ||
| }>; | ||
| export {}; |
| export declare function runAiCli(argv: string[], options?: { | ||
| write?: (text: string) => void; | ||
| writeError?: (text: string) => void; | ||
| }): Promise<number>; | ||
| export { describeCommandSchema, describeCommands, describeRunSubcommands, describeSubcommands, getInProcessToolExecutors, getToolCatalog, route, } from './router.js'; |
| interface SourcePaginationConfig { | ||
| page: string; | ||
| pageSize: string; | ||
| } | ||
| interface ToolCatalogEntry { | ||
| name: string; | ||
| description: string; | ||
| inputSchema: { | ||
| type: 'object'; | ||
| properties: Record<string, unknown>; | ||
| additionalProperties: boolean; | ||
| }; | ||
| buildCommand: (context: { | ||
| dataFile: string; | ||
| input: Record<string, unknown>; | ||
| }) => string[]; | ||
| sourcePagination?: SourcePaginationConfig; | ||
| } | ||
| interface InProcessToolEntry { | ||
| execute: (context: { | ||
| dataFile: string; | ||
| input: Record<string, unknown>; | ||
| }) => Promise<unknown>; | ||
| sourcePagination?: SourcePaginationConfig; | ||
| } | ||
| export declare function getToolCatalog(): ToolCatalogEntry[]; | ||
| export declare function describeRunSubcommands(): Array<{ | ||
| toolName: string; | ||
| path: string; | ||
| description: string; | ||
| args: Record<string, unknown>; | ||
| }>; | ||
| export declare function getInProcessToolExecutors(): Record<string, InProcessToolEntry>; | ||
| export declare function describeCommandSchema(commandPath: string): unknown; | ||
| export declare function describeCommands(): unknown; | ||
| export declare function describeSubcommands(): Array<{ | ||
| name: string; | ||
| path: string; | ||
| description: string; | ||
| args: Record<string, unknown>; | ||
| }>; | ||
| export declare function route(args: string[], options: { | ||
| dataFile?: string; | ||
| compact?: boolean; | ||
| describe?: boolean; | ||
| schema?: string; | ||
| argv?: string[]; | ||
| write?: (text: string) => void; | ||
| }): Promise<number>; | ||
| export {}; |
| interface Chunk { | ||
| size: number; | ||
| } | ||
| interface Loader { | ||
| costs: number; | ||
| } | ||
| export interface PaginationResult<T> { | ||
| total: number; | ||
| pageNumber: number; | ||
| pageSize: number; | ||
| totalPages: number; | ||
| items: T[]; | ||
| } | ||
| export declare const getMedianChunkSize: (list: Chunk[]) => number; | ||
| export declare const getTopThirdLoadersByCosts: (loaders: Loader[]) => Loader[]; | ||
| export declare function requireArg(value: string | undefined, name: string): string; | ||
| export declare function parseBoolean(value: string | undefined, fallback?: boolean): boolean | undefined; | ||
| export declare function parseNumber(value: string | undefined, name: string): number | undefined; | ||
| export declare function parsePositiveInt(value: string | undefined, name: string, range?: { | ||
| min?: number; | ||
| max?: number; | ||
| }): number | undefined; | ||
| export declare function parseCommaList(value: string | true | undefined): string[]; | ||
| export declare function parseModulesInput(value: string | true | string[] | number[] | undefined): Array<string | number>; | ||
| export declare function omitModulesFields<T>(value: T): T; | ||
| export declare function paginateItems<T>(items: T[], pageNumber: number, pageSize: number): PaginationResult<T>; | ||
| export declare function printResult(result: unknown, compact?: boolean): void; | ||
| export declare const createExecutor: (compact: boolean, options?: { | ||
| write?: (text: string) => void; | ||
| }) => (handler: () => Promise<unknown>) => Promise<boolean>; | ||
| export declare function parseSubcommandOptions(argv: string[]): Record<string, string | true>; | ||
| export {}; |
| export interface ToolResultControls { | ||
| filterPaths: string[]; | ||
| page?: number; | ||
| pageSize?: number; | ||
| } | ||
| interface ParsedControls { | ||
| controls: ToolResultControls; | ||
| passthroughInput: Record<string, unknown>; | ||
| paginateResult: boolean; | ||
| } | ||
| export declare function splitToolInputControls(input: Record<string, unknown>, options?: { | ||
| sourcePagination?: { | ||
| page: string; | ||
| pageSize: string; | ||
| }; | ||
| }): ParsedControls; | ||
| export declare function applyToolResultControls(result: unknown, controls: ToolResultControls, options?: { | ||
| paginateResult?: boolean; | ||
| }): unknown; | ||
| export {}; |
| export interface JsonSchema { | ||
| type: 'object'; | ||
| properties?: Record<string, unknown>; | ||
| required?: string[]; | ||
| additionalProperties?: boolean; | ||
| } | ||
| export interface ToolCommandContext { | ||
| dataFile: string; | ||
| input: Record<string, unknown>; | ||
| } | ||
| export interface ToolDefinition { | ||
| name: string; | ||
| description: string; | ||
| inputSchema: JsonSchema; | ||
| buildCommand: (context: ToolCommandContext) => string[]; | ||
| sourcePagination?: { | ||
| page: string; | ||
| pageSize: string; | ||
| }; | ||
| } | ||
| export interface ToolExecutionRequest { | ||
| toolName: string; | ||
| input: Record<string, unknown>; | ||
| dataFile: string; | ||
| } | ||
| export interface ToolExecutor { | ||
| execute: (request: ToolExecutionRequest) => Promise<unknown>; | ||
| } |
| import type { ToolDefinition, ToolExecutor } from './core/types.js'; | ||
| export declare function createRsdoctorCliToolExecutor({ tools, runCommand, }: { | ||
| tools: ToolDefinition[]; | ||
| runCommand?: (command: string[]) => Promise<string>; | ||
| }): ToolExecutor; | ||
| export declare function createInProcessRsdoctorCliToolExecutor(): ToolExecutor; |
| export * from './cli.js'; | ||
| export * from './commands/index.js'; | ||
| export * from './core/types.js'; | ||
| export * from './executor.js'; |
+5
-5
| { | ||
| "name": "@rsdoctor/agent-cli", | ||
| "version": "0.1.0", | ||
| "version": "0.1.1", | ||
| "repository": { | ||
@@ -21,7 +21,7 @@ "type": "git", | ||
| "devDependencies": { | ||
| "@rslib/core": "0.21.3", | ||
| "@rstest/core": "0.9.9", | ||
| "@types/node": "^22.8.1", | ||
| "@rslib/core": "0.21.5", | ||
| "@rstest/core": "0.10.3", | ||
| "@types/node": "^24.12.3", | ||
| "cac": "^7.0.0", | ||
| "typescript": "^5.9.2" | ||
| "typescript": "^6.0.3" | ||
| }, | ||
@@ -28,0 +28,0 @@ "publishConfig": { |
Sorry, the diff of this file is too big to display
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
132205
15.96%24
380%3543
20.84%3
50%