Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/cli/commands/model_method_describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
import { createModelMethodDescribeRenderer } from "../../presentation/renderers/model_method_describe.ts";
import { createContext, type GlobalOptions } from "../context.ts";
import { requireInitializedRepoReadOnly } from "../repo_context.ts";
import { modelRegistry } from "../../domain/models/model.ts";

// deno-lint-ignore no-explicit-any
type AnyOptions = any;
Expand Down Expand Up @@ -58,6 +59,8 @@ export const modelMethodDescribeCommand = new Command()
outputMode: cliCtx.outputMode,
});

await modelRegistry.ensureLoaded();

const ctx = createLibSwampContext({ logger: cliCtx.logger });
const deps = createModelMethodDescribeDeps(repoDir);

Expand Down
3 changes: 3 additions & 0 deletions src/cli/commands/type_describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
import { createTypeDescribeRenderer } from "../../presentation/renderers/type_describe.ts";
import { createContext, type GlobalOptions } from "../context.ts";
import { ModelType } from "../../domain/models/model_type.ts";
import { modelRegistry } from "../../domain/models/model.ts";

// Re-export from libswamp for backward compatibility with existing importers
export { toMethodDescribeData, zodToJsonSchema } from "../../libswamp/mod.ts";
Expand All @@ -49,6 +50,8 @@ export const typeDescribeCommand = new Command()

const modelType = ModelType.create(typeArg);

await modelRegistry.ensureLoaded();

const ctx = createLibSwampContext({ logger: cliCtx.logger });
const deps = createTypeDescribeDeps();

Expand Down
3 changes: 3 additions & 0 deletions src/cli/commands/vault_type_search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
interactiveOutputMode,
} from "../context.ts";
import { getVaultTypes } from "../../domain/vaults/vault_types.ts";
import { vaultTypeRegistry } from "../../domain/vaults/vault_type_registry.ts";

// deno-lint-ignore no-explicit-any
type AnyOptions = any;
Expand All @@ -47,6 +48,8 @@ export async function vaultTypeSearchAction(
const libCtx = createLibSwampContext();
ctx.logger.debug`Searching vault types with query: ${query ?? "(none)"}`;

await vaultTypeRegistry.ensureLoaded();

const deps: VaultTypeSearchDeps = {
getVaultTypes: () => getVaultTypes(),
};
Expand Down
3 changes: 2 additions & 1 deletion src/cli/completion_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ export class ModelTypeType extends Type<string> {
return value;
}

override complete(): string[] {
override async complete(): Promise<string[]> {
await modelRegistry.ensureLoaded();
return modelRegistry.types().map((t) => t.normalized);
}
}
8 changes: 4 additions & 4 deletions src/cli/completion_types_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ Deno.test("ModelTypeType.parse handles nested type paths", () => {
assertEquals(result, "aws/ec2/instance");
});

Deno.test("ModelTypeType.complete returns registered model types", () => {
Deno.test("ModelTypeType.complete returns registered model types", async () => {
const type = new ModelTypeType();
const result = type.complete();
const result = await type.complete();

// Should return an array of strings
assertEquals(Array.isArray(result), true);
Expand All @@ -113,9 +113,9 @@ Deno.test("ModelTypeType.complete returns registered model types", () => {
assertEquals(result.includes("command/shell"), true);
});

Deno.test("ModelTypeType.complete returns registered types", () => {
Deno.test("ModelTypeType.complete returns registered types", async () => {
const type = new ModelTypeType();
const result = type.complete();
const result = await type.complete();

// Should include registered types (command/shell is built-in)
assertEquals(result.includes("command/shell"), true);
Expand Down
Loading