Fix CLI completion bootstrap tool imports
This commit is contained in:
@@ -5,7 +5,7 @@ import { type Effort, THINKING_EFFORTS } from "@oh-my-pi/pi-ai";
|
||||
import { APP_NAME, CONFIG_DIR_NAME, logger } from "@oh-my-pi/pi-utils";
|
||||
import chalk from "chalk";
|
||||
import { parseEffort } from "../thinking";
|
||||
import { BUILTIN_TOOLS } from "../tools";
|
||||
import { BUILTIN_TOOL_NAMES } from "../tools/builtin-names";
|
||||
import {
|
||||
OPTIONAL_FLAGS,
|
||||
OPTIONAL_VALUE_FLAGS,
|
||||
@@ -72,8 +72,8 @@ export interface Args {
|
||||
const PARSE_DEPS: ParseDeps = {
|
||||
logger,
|
||||
parseEffort,
|
||||
BUILTIN_TOOLS,
|
||||
THINKING_EFFORTS,
|
||||
builtinToolNames: BUILTIN_TOOL_NAMES,
|
||||
thinkingEfforts: THINKING_EFFORTS,
|
||||
};
|
||||
|
||||
export function parseArgs(inputArgs: string[], extensionFlags?: Map<string, { type: "boolean" | "string" }>): Args {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* knob and is keyed by flag name so it stays stable as flags are added.
|
||||
*/
|
||||
import type { ArgDescriptor, CliConfig, CommandCtor, FlagDescriptor } from "@oh-my-pi/pi-utils/cli";
|
||||
import { BUILTIN_TOOLS } from "../tools";
|
||||
import { BUILTIN_TOOL_NAMES } from "../tools/builtin-names";
|
||||
|
||||
export type Shell = "bash" | "zsh" | "fish";
|
||||
|
||||
@@ -77,7 +77,7 @@ function flagValue(name: string, desc: FlagDescriptor): ValueSource {
|
||||
if (MODEL_FLAGS[name]) return { kind: "models", multiple: false };
|
||||
if (name === "models") return { kind: "models", multiple: true };
|
||||
if (SESSION_FLAGS[name]) return { kind: "sessions" };
|
||||
if (name === "tools") return { kind: "list", values: Object.keys(BUILTIN_TOOLS) };
|
||||
if (name === "tools") return { kind: "list", values: BUILTIN_TOOL_NAMES };
|
||||
if (DIR_FLAGS[name]) return { kind: "dir" };
|
||||
if (desc.kind === "integer") return { kind: "value" };
|
||||
return { kind: "file" };
|
||||
|
||||
@@ -47,8 +47,8 @@ import type { Args } from "./args";
|
||||
export interface ParseDeps {
|
||||
logger: { warn: (message: string, meta?: Record<string, unknown>) => void };
|
||||
parseEffort: (value: string | null | undefined) => Effort | undefined;
|
||||
BUILTIN_TOOLS: Record<string, unknown>;
|
||||
THINKING_EFFORTS: readonly string[];
|
||||
builtinToolNames: readonly string[];
|
||||
thinkingEfforts: readonly string[];
|
||||
}
|
||||
|
||||
export type StringSetter = (result: Args, value: string, deps: ParseDeps) => void;
|
||||
@@ -146,12 +146,12 @@ export const STRING_SETTERS: Record<string, StringSetter> = {
|
||||
.filter(Boolean);
|
||||
const valid: string[] = [];
|
||||
for (const name of names) {
|
||||
if (name in deps.BUILTIN_TOOLS) {
|
||||
if (deps.builtinToolNames.includes(name)) {
|
||||
valid.push(name);
|
||||
} else {
|
||||
deps.logger.warn("Unknown tool passed to --tools", {
|
||||
tool: name,
|
||||
validTools: Object.keys(deps.BUILTIN_TOOLS),
|
||||
validTools: deps.builtinToolNames,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ export const STRING_SETTERS: Record<string, StringSetter> = {
|
||||
} else {
|
||||
deps.logger.warn("Invalid thinking level passed to --thinking", {
|
||||
level: value,
|
||||
validThinkingLevels: deps.THINKING_EFFORTS,
|
||||
validThinkingLevels: deps.thinkingEfforts,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user