@@ -7,6 +7,7 @@ import {detectAvailableComputeLayers} from "../../../../bindings/utils/detectAva
77import { getPlatform } from "../../../../bindings/utils/getPlatform.js" ;
88import { BuildGpu , LlamaLogLevel } from "../../../../bindings/types.js" ;
99import { getPrettyBuildGpuName } from "../../../../bindings/consts.js" ;
10+ import { getModuleVersion } from "../../../../utils/getModuleVersion.js" ;
1011
1112type InspectGpuCommand = {
1213 // no options for now
@@ -21,6 +22,29 @@ export const InspectGpuCommand: CommandModule<object, InspectGpuCommand> = {
2122 const availableComputeLayers = await detectAvailableComputeLayers ( { platform} ) ;
2223 const gpusToLogVramUsageOf : BuildGpu [ ] = [ ] ;
2324
25+ console . info ( `${ chalk . yellow ( "OS:" ) } ${ os . type ( ) } ${ os . release ( ) } ${ chalk . dim ( "(" + os . arch ( ) + ")" ) } ` ) ;
26+
27+ if ( process . versions . node != null )
28+ console . info ( `${ chalk . yellow ( "Node:" ) } ${ process . versions . node } ${ chalk . dim ( "(" + arch + ")" ) } ` ) ;
29+
30+ if ( process . versions . bun != null )
31+ console . info ( `${ chalk . yellow ( "Bun:" ) } ${ process . versions . bun } ` ) ;
32+
33+ const typeScriptVersion = await getInstalledTypescriptVersion ( ) ;
34+ if ( typeScriptVersion != null )
35+ console . info ( `${ chalk . yellow ( "TypeScript:" ) } ${ typeScriptVersion } ` ) ;
36+
37+ try {
38+ const moduleVersion = await getModuleVersion ( ) ;
39+
40+ if ( moduleVersion != null )
41+ console . info ( `${ chalk . yellow ( "node-llama-cpp:" ) } ${ moduleVersion } ` ) ;
42+ } catch ( err ) {
43+ // do nothing
44+ }
45+
46+ console . info ( ) ;
47+
2448 if ( platform === "mac" && arch === "arm64" ) {
2549 console . info ( `${ chalk . yellow ( "Metal:" ) } ${ chalk . green ( "available" ) } ` ) ;
2650 gpusToLogVramUsageOf . push ( "metal" ) ;
@@ -101,6 +125,20 @@ function getPercentageString(amount: number, total: number) {
101125 return String ( Math . floor ( ( amount / total ) * 100 * 100 ) / 100 ) ;
102126}
103127
128+ async function getInstalledTypescriptVersion ( ) {
129+ try {
130+ const ts = await import ( "typescript" ) ;
131+ const version = ts ?. version ?? ts ?. default ?. version ;
132+
133+ if ( version != null && typeof version === "string" && version . length > 0 )
134+ return version ;
135+
136+ return null ;
137+ } catch ( err ) {
138+ return null ;
139+ }
140+ }
141+
104142// // simple script to copy console logs as ansi to clipboard. Used to update the documentation
105143// import {spawn} from "child_process";
106144// const pendingLog: string[] = [];
0 commit comments