mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-30 13:54:01 +00:00
- Rename packages/opencode → packages/tfcode (directory only) - Rename bin/opencode → bin/tfcode (CLI binary) - Rename .opencode → .tfcode (config directory) - Update package.json name and bin field - Update config directory path references (.tfcode) - Keep internal code references as 'opencode' for easy upstream sync - Keep @opencode-ai/* workspace package names This minimal branding approach allows clean merges from upstream opencode repository while providing tfcode branding for users.
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import { afterEach, describe, expect, test } from "bun:test"
|
|
import { Agent } from "../../src/agent/agent"
|
|
import { Instance } from "../../src/project/instance"
|
|
import { TaskTool } from "../../src/tool/task"
|
|
import { tmpdir } from "../fixture/fixture"
|
|
|
|
afterEach(async () => {
|
|
await Instance.disposeAll()
|
|
})
|
|
|
|
describe("tool.task", () => {
|
|
test("description sorts subagents by name and is stable across calls", async () => {
|
|
await using tmp = await tmpdir({
|
|
config: {
|
|
agent: {
|
|
zebra: {
|
|
description: "Zebra agent",
|
|
mode: "subagent",
|
|
},
|
|
alpha: {
|
|
description: "Alpha agent",
|
|
mode: "subagent",
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
await Instance.provide({
|
|
directory: tmp.path,
|
|
fn: async () => {
|
|
const build = await Agent.get("build")
|
|
const first = await TaskTool.init({ agent: build })
|
|
const second = await TaskTool.init({ agent: build })
|
|
|
|
expect(first.description).toBe(second.description)
|
|
|
|
const alpha = first.description.indexOf("- alpha: Alpha agent")
|
|
const explore = first.description.indexOf("- explore:")
|
|
const general = first.description.indexOf("- general:")
|
|
const zebra = first.description.indexOf("- zebra: Zebra agent")
|
|
|
|
expect(alpha).toBeGreaterThan(-1)
|
|
expect(explore).toBeGreaterThan(alpha)
|
|
expect(general).toBeGreaterThan(explore)
|
|
expect(zebra).toBeGreaterThan(general)
|
|
},
|
|
})
|
|
})
|
|
})
|