feat(prompts-core): add package skeleton

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-05-24 17:16:49 +09:00
parent 87de056308
commit 4338ddb898
7 changed files with 122 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
export type {
LoadedPrompt,
LoadPromptInput,
ModelVariant,
PromptSource,
RuntimeInjection,
VariantTable,
} from "./types"
+32
View File
@@ -0,0 +1,32 @@
import { describe, expect, test } from "bun:test"
import type { LoadPromptInput, LoadedPrompt, PromptSource, RuntimeInjection } from "./types"
describe("prompt core types", () => {
test("#given loader input shape #then accepts source name variant and runtime injections", () => {
const source: PromptSource = { baseDir: "/tmp/prompts" }
const injection: RuntimeInjection = { placeholder: "{X}", resolver: () => "Y" }
const input = {
source,
name: "test",
variant: "default",
inject: [injection],
} satisfies LoadPromptInput
expect(input.source.baseDir).toBe("/tmp/prompts")
expect(input.inject[0]?.placeholder).toBe("{X}")
})
test("#given loaded prompt shape #then carries frontmatter and rendered body", () => {
const loaded = {
frontmatter: { title: "Fixture" },
body: "Prompt body",
hadFrontmatter: true,
parseError: false,
filePath: "/tmp/prompts/test/default.md",
} satisfies LoadedPrompt<{ readonly title: string }>
expect(loaded.frontmatter.title).toBe("Fixture")
expect(loaded.body).toBe("Prompt body")
})
})
+35
View File
@@ -0,0 +1,35 @@
export type ModelVariant =
| "default"
| "gpt"
| "gemini"
| "kimi"
| "glm"
| "planner"
| "opus-4-7"
| "minimax"
export type PromptSource = {
readonly baseDir: string
}
export type RuntimeInjection = {
readonly placeholder: string
readonly resolver: () => string | Promise<string>
}
export type LoadPromptInput = {
readonly source: PromptSource
readonly name: string
readonly variant: string
readonly inject?: readonly RuntimeInjection[]
}
export type LoadedPrompt<TFrontmatter = Record<string, unknown>> = {
readonly frontmatter: TFrontmatter
readonly body: string
readonly hadFrontmatter: boolean
readonly parseError: boolean
readonly filePath: string
}
export type VariantTable = Readonly<Record<string, PromptSource>>