|
| 1 | +import { describe, test, expect } from "bun:test" |
| 2 | +import { Command } from "../../src/command/index" |
| 3 | +import { Instance } from "../../src/project/instance" |
| 4 | +import { tmpdir } from "../fixture/fixture" |
| 5 | + |
| 6 | +async function withInstance(fn: () => Promise<void>) { |
| 7 | + await using tmp = await tmpdir({ git: true }) |
| 8 | + await Instance.provide({ directory: tmp.path, fn }) |
| 9 | +} |
| 10 | + |
| 11 | +describe("Altimate builtin commands", () => { |
| 12 | + test("all altimate-specific commands are registered", async () => { |
| 13 | + await withInstance(async () => { |
| 14 | + const commands = await Command.list() |
| 15 | + const names = commands.map((c) => c.name) |
| 16 | + // These are the altimate_change commands that must ship with the package. |
| 17 | + // Regression guard: commit 528af75 fixed discover-and-add-mcps not shipping. |
| 18 | + expect(names).toContain("configure-claude") |
| 19 | + expect(names).toContain("configure-codex") |
| 20 | + expect(names).toContain("discover-and-add-mcps") |
| 21 | + expect(names).toContain("feedback") |
| 22 | + }) |
| 23 | + }) |
| 24 | + |
| 25 | + test("Command.Default includes all altimate constants", () => { |
| 26 | + expect(Command.Default.CONFIGURE_CLAUDE).toBe("configure-claude") |
| 27 | + expect(Command.Default.CONFIGURE_CODEX).toBe("configure-codex") |
| 28 | + expect(Command.Default.DISCOVER_MCPS).toBe("discover-and-add-mcps") |
| 29 | + expect(Command.Default.FEEDBACK).toBe("feedback") |
| 30 | + }) |
| 31 | + |
| 32 | + test("discover-and-add-mcps has correct metadata and template", async () => { |
| 33 | + await withInstance(async () => { |
| 34 | + const cmd = await Command.get("discover-and-add-mcps") |
| 35 | + expect(cmd).toBeDefined() |
| 36 | + expect(cmd.name).toBe("discover-and-add-mcps") |
| 37 | + expect(cmd.source).toBe("command") |
| 38 | + expect(cmd.description).toBe("discover MCP servers from external AI tool configs and add them") |
| 39 | + const template = await cmd.template |
| 40 | + expect(template).toContain("mcp_discover") |
| 41 | + expect(cmd.hints).toContain("$ARGUMENTS") |
| 42 | + }) |
| 43 | + }) |
| 44 | + |
| 45 | + test("configure-claude has correct metadata", async () => { |
| 46 | + await withInstance(async () => { |
| 47 | + const cmd = await Command.get("configure-claude") |
| 48 | + expect(cmd).toBeDefined() |
| 49 | + expect(cmd.name).toBe("configure-claude") |
| 50 | + expect(cmd.source).toBe("command") |
| 51 | + expect(cmd.description).toBe("configure /altimate command in Claude Code") |
| 52 | + }) |
| 53 | + }) |
| 54 | + |
| 55 | + test("configure-codex has correct metadata", async () => { |
| 56 | + await withInstance(async () => { |
| 57 | + const cmd = await Command.get("configure-codex") |
| 58 | + expect(cmd).toBeDefined() |
| 59 | + expect(cmd.name).toBe("configure-codex") |
| 60 | + expect(cmd.source).toBe("command") |
| 61 | + expect(cmd.description).toBe("configure altimate skill in Codex CLI") |
| 62 | + }) |
| 63 | + }) |
| 64 | +}) |
0 commit comments