system.node_info.genai.mts•525 B
system({
title: "Information about the current project",
})
export default async function (ctx: ChatGenerationContext) {
const { $ } = ctx
const { stdout: nodeVersion } = await host.exec("node", ["--version"])
const { stdout: npmVersion } = await host.exec("npm", ["--version"])
const { name, version } = (await workspace.readJSON("package.json")) || {}
if (nodeVersion) $`- node.js v${nodeVersion}`
if (npmVersion) $`- npm v${npmVersion}`
if (name) $`- package ${name} v${version || ""}`
}