Skip to content

Commit

Permalink
feat: 🔧 add info models alias command to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Dec 21, 2024
1 parent aa7f334 commit c7958a1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 18 deletions.
36 changes: 25 additions & 11 deletions docs/src/content/docs/reference/cli/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,17 +252,6 @@ Options:
-h, --help display help for command
```

## `models`

```
Usage: genaiscript models [options]
List model information
Options:
-h, --help display help for command
```

## `cache`

```
Expand Down Expand Up @@ -515,6 +504,7 @@ Commands:
help Show help for all commands
system Show system information
env [options] [provider] Show .env information
models
```

### `info help`
Expand Down Expand Up @@ -552,3 +542,27 @@ Options:
-m, --models show models if possible
-h, --help display help for command
```

### `info models`

```
Usage: genaiscript info models [options] [command]
Options:
-h, --help display help for command
Commands:
alias Show model alias mapping
help [command] display help for command
```

#### `models alias`

```
Usage: genaiscript info models alias [options]
Show model alias mapping
Options:
-h, --help display help for command
```
18 changes: 11 additions & 7 deletions packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
} from "./parse" // Parsing functions
import { compileScript, createScript, fixScripts, listScripts } from "./scripts" // Script utilities
import { codeQuery } from "./codequery" // Code parsing and query execution
import { envInfo, modelsInfo, scriptModelInfo, systemInfo } from "./info" // Information utilities
import { envInfo, modelsInfo as modelAliasesInfo, scriptModelInfo, systemInfo } from "./info" // Information utilities
import { scriptTestList, scriptTestsView, scriptsTest } from "./test" // Test functions
import { cacheClear } from "./cache" // Cache management
import "node:console" // Importing console for side effects
Expand Down Expand Up @@ -254,7 +254,10 @@ export async function cli() {
)
.arguments("<script> [files...]")
.option("-s, --suffix <string>", "suffix for converted files")
.option("-rw, --rewrite", "rewrite input file with output (overrides suffix)")
.option(
"-rw, --rewrite",
"rewrite input file with output (overrides suffix)"
)
.option(
"-cw, --cancel-word <string>",
"cancel word which allows the LLM to notify to ignore output"
Expand Down Expand Up @@ -322,10 +325,6 @@ export async function cli() {
.option("-t, --token", "show token")
.action(scriptModelInfo) // Action to show model information

const models = program.command("models")
.description("List model information")
.action(modelsInfo)

// Define 'cache' command for cache management
const cache = program.command("cache").description("Cache management")
cache
Expand Down Expand Up @@ -450,6 +449,11 @@ export async function cli() {
.option("-e, --error", "show errors")
.option("-m, --models", "show models if possible")
.action(envInfo) // Action to show environment information

const models = info.command("models")
models
.command("alias")
.description("Show model alias mapping")
.action(modelAliasesInfo)

program.parse() // Parse command-line arguments
}

0 comments on commit c7958a1

Please sign in to comment.