
import { Global } from "@saeeol/core/global"
import { staticEnvLines, type EditorContext } from "@/saeeol/editor-context"
import type { Provider } from "@/provider/provider"
import type { InstanceContext } from "@/project/instance"

export namespace SaeeolSystemPrompt {
  export function environment(input: { ctx: InstanceContext; model: Provider.Model; editor?: EditorContext }) {
    return [
      [
        `You are powered by the model named ${input.model.api.id}. The exact model ID is ${input.model.providerID}/${input.model.api.id}`,
        `Here is some useful information about the environment you are running in:`,
        `<env>`,
        `  Is directory a git repo: ${input.ctx.project.vcs === "git" ? "yes" : "no"}`,
        `  Platform: ${process.platform}`,
        `  Today's date: ${new Date().toDateString()}`,
        `  Project config: .saeeol/command/*.md, .saeeol/agent/*.md, saeeol.json, AGENTS.md. Put new commands and agents in .saeeol/. Do not use .saeeol/ or .saeeol/.`,
        `  Global config: ${Global.Path.config}/ (same structure)`,
        ...staticEnvLines(input.editor),
        `</env>`,
      ].join("\n"),
    ]
  }
}
