mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-17 22:24:29 +00:00
feat: tfcode
This commit is contained in:
@@ -316,7 +316,10 @@ export namespace Agent {
|
|||||||
const debugFile = (msg: string) => {
|
const debugFile = (msg: string) => {
|
||||||
const timestamp = new Date().toISOString()
|
const timestamp = new Date().toISOString()
|
||||||
const line = `[${timestamp}] ${msg}\n`
|
const line = `[${timestamp}] ${msg}\n`
|
||||||
Bun.write("/tmp/tfcode-debug.log", line).catch(() => {})
|
try {
|
||||||
|
const fs = require("fs")
|
||||||
|
fs.appendFileSync("/tmp/tfcode-debug.log", line)
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadTFPrompts(): Promise<TFPrompt[]> {
|
export async function loadTFPrompts(): Promise<TFPrompt[]> {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import { DialogHelp } from "./ui/dialog-help"
|
|||||||
import { DialogChangelog } from "./ui/dialog-changelog"
|
import { DialogChangelog } from "./ui/dialog-changelog"
|
||||||
import { CommandProvider, useCommandDialog } from "@tui/component/dialog-command"
|
import { CommandProvider, useCommandDialog } from "@tui/component/dialog-command"
|
||||||
import { DialogAgent } from "@tui/component/dialog-agent"
|
import { DialogAgent } from "@tui/component/dialog-agent"
|
||||||
import { DialogPrompts } from "@tui/component/dialog-prompts"
|
|
||||||
import { DialogSessionList } from "@tui/component/dialog-session-list"
|
import { DialogSessionList } from "@tui/component/dialog-session-list"
|
||||||
import { DialogWorkspaceList } from "@tui/component/dialog-workspace-list"
|
import { DialogWorkspaceList } from "@tui/component/dialog-workspace-list"
|
||||||
import { KeybindProvider } from "@tui/context/keybind"
|
import { KeybindProvider } from "@tui/context/keybind"
|
||||||
@@ -492,17 +491,6 @@ function App() {
|
|||||||
dialog.replace(() => <DialogMcp />)
|
dialog.replace(() => <DialogMcp />)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: "Switch prompts",
|
|
||||||
value: "prompt.list",
|
|
||||||
category: "Agent",
|
|
||||||
slash: {
|
|
||||||
name: "prompts",
|
|
||||||
},
|
|
||||||
onSelect: () => {
|
|
||||||
dialog.replace(() => <DialogPrompts />)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: "Agent cycle",
|
title: "Agent cycle",
|
||||||
value: "agent.cycle",
|
value: "agent.cycle",
|
||||||
|
|||||||
@@ -79,13 +79,18 @@ export namespace Command {
|
|||||||
const log = (msg: string) => {
|
const log = (msg: string) => {
|
||||||
const timestamp = new Date().toISOString()
|
const timestamp = new Date().toISOString()
|
||||||
const line = `[${timestamp}] ${msg}\n`
|
const line = `[${timestamp}] ${msg}\n`
|
||||||
Bun.write("/tmp/tfcode-debug.log", line).catch(() => {})
|
try {
|
||||||
|
const fs = require("fs")
|
||||||
|
fs.appendFileSync("/tmp/tfcode-debug.log", line)
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
const init = Effect.fn("Command.state")(function* (ctx) {
|
const init = Effect.fn("Command.state")(function* (ctx) {
|
||||||
const cfg = yield* Effect.promise(() => Config.get())
|
const cfg = yield* Effect.promise(() => Config.get())
|
||||||
const commands: Record<string, Info> = {}
|
const commands: Record<string, Info> = {}
|
||||||
|
|
||||||
|
log(`[Command.init] Starting command initialization`)
|
||||||
|
|
||||||
commands[Default.INIT] = {
|
commands[Default.INIT] = {
|
||||||
name: Default.INIT,
|
name: Default.INIT,
|
||||||
description: "create/update AGENTS.md",
|
description: "create/update AGENTS.md",
|
||||||
@@ -147,8 +152,14 @@ export namespace Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const skill of yield* Effect.promise(() => Skill.all())) {
|
const skills = yield* Effect.promise(() => Skill.all())
|
||||||
if (commands[skill.name]) continue
|
log(`[Command.init] Skills loaded: ${skills.length} - ${skills.map((s) => s.name).join(", ")}`)
|
||||||
|
for (const skill of skills) {
|
||||||
|
if (commands[skill.name]) {
|
||||||
|
log(`[Command.init] Skipping skill ${skill.name} - already exists`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log(`[Command.init] Adding skill as command: ${skill.name}`)
|
||||||
commands[skill.name] = {
|
commands[skill.name] = {
|
||||||
name: skill.name,
|
name: skill.name,
|
||||||
description: skill.description,
|
description: skill.description,
|
||||||
@@ -160,6 +171,14 @@ export namespace Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log(`[Command.init] Total commands: ${Object.keys(commands).length}`)
|
||||||
|
const promptsCmds = Object.values(commands).filter((c) => c.name.toLowerCase().includes("prompt"))
|
||||||
|
if (promptsCmds.length > 0) {
|
||||||
|
log(
|
||||||
|
`[Command.init] Commands with 'prompt' in name: ${promptsCmds.map((c) => `${c.name}(${c.source})`).join(", ")}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
commands,
|
commands,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,10 @@ export namespace Skill {
|
|||||||
const debugFile = (msg: string) => {
|
const debugFile = (msg: string) => {
|
||||||
const timestamp = new Date().toISOString()
|
const timestamp = new Date().toISOString()
|
||||||
const line = `[${timestamp}] ${msg}\n`
|
const line = `[${timestamp}] ${msg}\n`
|
||||||
Bun.write("/tmp/tfcode-debug.log", line).catch(() => {})
|
try {
|
||||||
|
const fs = require("fs")
|
||||||
|
fs.appendFileSync("/tmp/tfcode-debug.log", line)
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
const EXTERNAL_DIRS = [".claude", ".agents"]
|
const EXTERNAL_DIRS = [".claude", ".agents"]
|
||||||
const EXTERNAL_SKILL_PATTERN = "skills/**/SKILL.md"
|
const EXTERNAL_SKILL_PATTERN = "skills/**/SKILL.md"
|
||||||
|
|||||||
Reference in New Issue
Block a user