feat(desktop): embed BoosAPI Desktop client as a subproject
Vendor the rebranded BoosAPI Desktop client (Tauri + Vue) into metapi as a monorepo subdirectory under desktop/. Source only — node_modules, dist, Cargo target and the upstream .git history are excluded. desktop/ keeps its own independent Cargo workspace (desktop/src-tauri with crates/*); it is not part of the backend boosapi crate, so a `cargo check` at the metapi root still compiles only the backend. Build the desktop app from desktop/src-tauri per desktop/README.md. Note: app icons are still placeholder assets pending the final BoosAPI logo. The updater signing keys live outside the repo and are not included.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import fs from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
export const packageRoot = path.resolve(__dirname, '..')
|
||||
export const defaultPromptsRoot = path.join(packageRoot, 'prompts')
|
||||
|
||||
export async function listPromptFiles(promptsRoot = defaultPromptsRoot) {
|
||||
const dirents = await fs.readdir(promptsRoot, { withFileTypes: true })
|
||||
return dirents
|
||||
.filter(dirent => dirent.isFile() && dirent.name.endsWith('.md'))
|
||||
.map(dirent => dirent.name)
|
||||
.sort()
|
||||
}
|
||||
|
||||
export async function listPromptNames(promptsRoot = defaultPromptsRoot) {
|
||||
return (await listPromptFiles(promptsRoot)).map(file => file.replace(/\.md$/i, ''))
|
||||
}
|
||||
|
||||
export async function resolvePromptPath(name, promptsRoot = defaultPromptsRoot) {
|
||||
const normalized = String(name ?? '').trim()
|
||||
if (!normalized)
|
||||
throw new Error('Prompt name is required')
|
||||
|
||||
const candidates = normalized.endsWith('.md')
|
||||
? [normalized]
|
||||
: [`${normalized}.md`, normalized]
|
||||
|
||||
for (const candidate of candidates) {
|
||||
const fullPath = path.join(promptsRoot, candidate)
|
||||
try {
|
||||
await fs.access(fullPath)
|
||||
return fullPath
|
||||
}
|
||||
catch {
|
||||
// continue
|
||||
}
|
||||
}
|
||||
|
||||
const available = await listPromptNames(promptsRoot)
|
||||
throw new Error(`Unknown prompt: ${normalized}. Available prompts: ${available.join(', ')}`)
|
||||
}
|
||||
|
||||
export async function readPrompt(name, promptsRoot = defaultPromptsRoot) {
|
||||
const fullPath = await resolvePromptPath(name, promptsRoot)
|
||||
const content = await fs.readFile(fullPath, 'utf8')
|
||||
return { fullPath, content }
|
||||
}
|
||||
Reference in New Issue
Block a user