scai
Version:
> **AI-powered CLI for local code analysis, commit message suggestions, and natural-language queries.** 100% local, private, GDPR-friendly, made in Denmark/EU with ❤️.
34 lines (31 loc) • 1.17 kB
JavaScript
import { generate } from "../../lib/generate.js";
import { logInputOutput } from "../../utils/promptLogHelper.js";
export const summaryModule = {
name: "summary",
description: "Generates a general summary of any file content.",
groups: ["analysis"],
run: async (input) => {
// ✅ Only care about content now
const contentStr = typeof input.content === "string"
? input.content
: JSON.stringify(input.content ?? "", null, 2);
// ❌ Removed filepath/ext/filename extraction
const prompt = `
You are an assistant specialized in summarizing files.
Your task is to summarize the following content as clearly and concisely as possible:
${contentStr}
`.trim();
const response = await generate({
content: prompt,
query: ""
});
const summary = response.data ?? "⚠️ No summary generated.";
const output = {
query: input.query, // keep query for context
content: '',
data: { summary }, // ❌ no filepath
};
logInputOutput("summary", "output", output.data);
return output;
},
};