agentsbestfriend 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +31 -20
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -44555,11 +44555,11 @@ var GitActionSchema = external_exports3.enum(["log", "file_history", "blame", "d
|
|
|
44555
44555
|
function registerGitTool(server) {
|
|
44556
44556
|
server.tool("abf_git", "Query git history, blame, and diff for the project.", {
|
|
44557
44557
|
action: GitActionSchema.describe("Git action: log (recent commits), file_history, blame, diff"),
|
|
44558
|
-
|
|
44558
|
+
file_path: external_exports3.string().optional().describe("File path (required for file_history, blame; optional for diff)"),
|
|
44559
44559
|
count: external_exports3.number().int().min(1).max(100).default(10).describe("Number of commits (log, file_history)"),
|
|
44560
44560
|
line_start: external_exports3.number().int().optional().describe("Start line for blame range"),
|
|
44561
44561
|
line_end: external_exports3.number().int().optional().describe("End line for blame range")
|
|
44562
|
-
}, async ({ action,
|
|
44562
|
+
}, async ({ action, file_path, count, line_start, line_end }) => {
|
|
44563
44563
|
const cwd = process.env.ABF_PROJECT_ROOT || process.cwd();
|
|
44564
44564
|
if (!await isGitRepo(cwd)) {
|
|
44565
44565
|
return {
|
|
@@ -44580,25 +44580,25 @@ function registerGitTool(server) {
|
|
|
44580
44580
|
break;
|
|
44581
44581
|
}
|
|
44582
44582
|
case "file_history": {
|
|
44583
|
-
if (!
|
|
44584
|
-
return errorResult("file_history requires a `
|
|
44583
|
+
if (!file_path) {
|
|
44584
|
+
return errorResult("file_history requires a `file_path` parameter.");
|
|
44585
44585
|
}
|
|
44586
|
-
const history = await getFileHistory(cwd,
|
|
44586
|
+
const history = await getFileHistory(cwd, file_path, count);
|
|
44587
44587
|
text4 = `History for ${history.filePath}:
|
|
44588
44588
|
` + formatCommits(history.commits);
|
|
44589
44589
|
break;
|
|
44590
44590
|
}
|
|
44591
44591
|
case "blame": {
|
|
44592
|
-
if (!
|
|
44593
|
-
return errorResult("blame requires a `
|
|
44592
|
+
if (!file_path) {
|
|
44593
|
+
return errorResult("blame requires a `file_path` parameter.");
|
|
44594
44594
|
}
|
|
44595
44595
|
const range = line_start && line_end ? [line_start, line_end] : void 0;
|
|
44596
|
-
const blameLines = await getBlame(cwd,
|
|
44596
|
+
const blameLines = await getBlame(cwd, file_path, range);
|
|
44597
44597
|
text4 = formatBlame(blameLines);
|
|
44598
44598
|
break;
|
|
44599
44599
|
}
|
|
44600
44600
|
case "diff": {
|
|
44601
|
-
const diff = await getDiff(cwd,
|
|
44601
|
+
const diff = await getDiff(cwd, file_path);
|
|
44602
44602
|
const { filesChanged, insertions, deletions } = diff.stats;
|
|
44603
44603
|
const header = `${filesChanged} file(s) changed, +${insertions} -${deletions}`;
|
|
44604
44604
|
text4 = diff.combined ? `${header}
|
|
@@ -44641,8 +44641,8 @@ init_indexer();
|
|
|
44641
44641
|
init_llm();
|
|
44642
44642
|
var IndexActionSchema = external_exports3.enum(["status", "rebuild", "update", "summarize"]);
|
|
44643
44643
|
function registerIndexTool(server) {
|
|
44644
|
-
server.tool("abf_index", "Manage the file index: check status, trigger rebuild, incremental update, or generate LLM summaries
|
|
44645
|
-
action: IndexActionSchema.describe("status: show index info, rebuild: full re-index, update: incremental update, summarize: generate LLM file summaries (requires Ollama)")
|
|
44644
|
+
server.tool("abf_index", "Manage the file index: check status, trigger rebuild, incremental update, or generate LLM summaries. Rebuild/update will auto-generate summaries when Ollama is available.", {
|
|
44645
|
+
action: IndexActionSchema.describe("status: show index info, rebuild: full re-index, update: incremental update, summarize: (re)generate LLM file summaries (requires Ollama)")
|
|
44646
44646
|
}, async ({ action }) => {
|
|
44647
44647
|
const projectRoot = process.env.ABF_PROJECT_ROOT || process.cwd();
|
|
44648
44648
|
try {
|
|
@@ -44662,7 +44662,7 @@ function registerIndexTool(server) {
|
|
|
44662
44662
|
case "rebuild":
|
|
44663
44663
|
case "update": {
|
|
44664
44664
|
const stats = await runIndexPipeline(projectRoot);
|
|
44665
|
-
const
|
|
44665
|
+
const textParts = [
|
|
44666
44666
|
`Index ${action} complete (${stats.durationMs}ms)`,
|
|
44667
44667
|
`Discovered: ${stats.totalDiscovered}`,
|
|
44668
44668
|
`New: ${stats.indexed}`,
|
|
@@ -44670,8 +44670,19 @@ function registerIndexTool(server) {
|
|
|
44670
44670
|
`Removed: ${stats.removed}`,
|
|
44671
44671
|
`Unchanged: ${stats.skipped}`,
|
|
44672
44672
|
stats.errors > 0 ? `Errors: ${stats.errors}` : null
|
|
44673
|
-
].filter(Boolean)
|
|
44674
|
-
|
|
44673
|
+
].filter(Boolean);
|
|
44674
|
+
const provider = getLlmProvider();
|
|
44675
|
+
if (provider && await provider.isAvailable()) {
|
|
44676
|
+
try {
|
|
44677
|
+
const sumStats = await generateSummaries(projectRoot);
|
|
44678
|
+
textParts.push("", `LLM summaries: ${sumStats.generated} generated, ${sumStats.skipped} skipped${sumStats.errors > 0 ? `, ${sumStats.errors} errors` : ""} (${sumStats.durationMs}ms)`);
|
|
44679
|
+
} catch {
|
|
44680
|
+
textParts.push("", "LLM summaries: skipped (Ollama error)");
|
|
44681
|
+
}
|
|
44682
|
+
}
|
|
44683
|
+
return {
|
|
44684
|
+
content: [{ type: "text", text: textParts.join("\n") }]
|
|
44685
|
+
};
|
|
44675
44686
|
}
|
|
44676
44687
|
case "summarize": {
|
|
44677
44688
|
const stats = await generateSummaries(projectRoot);
|
|
@@ -45029,13 +45040,13 @@ function importMatchesTarget(importPath, sourceFile, targetRelPath, targetName)
|
|
|
45029
45040
|
init_search();
|
|
45030
45041
|
function registerImpactTool(server) {
|
|
45031
45042
|
server.tool("abf_impact", "Find all files and lines that reference a given symbol name. Useful for change impact analysis.", {
|
|
45032
|
-
|
|
45043
|
+
symbol: external_exports3.string().describe("The symbol (function, class, variable) name to find references for"),
|
|
45033
45044
|
file_path: external_exports3.string().optional().describe("Optional: scope search to usages of this symbol from this file")
|
|
45034
|
-
}, async ({
|
|
45045
|
+
}, async ({ symbol: symbol2, file_path }) => {
|
|
45035
45046
|
const cwd = process.env.ABF_PROJECT_ROOT || process.cwd();
|
|
45036
45047
|
try {
|
|
45037
45048
|
const results = await ripgrepSearch({
|
|
45038
|
-
query: `\\b${escapeRegex2(
|
|
45049
|
+
query: `\\b${escapeRegex2(symbol2)}\\b`,
|
|
45039
45050
|
cwd,
|
|
45040
45051
|
maxResults: 50,
|
|
45041
45052
|
regex: true,
|
|
@@ -45046,7 +45057,7 @@ function registerImpactTool(server) {
|
|
|
45046
45057
|
content: [
|
|
45047
45058
|
{
|
|
45048
45059
|
type: "text",
|
|
45049
|
-
text: `No references found for "${
|
|
45060
|
+
text: `No references found for "${symbol2}".`
|
|
45050
45061
|
}
|
|
45051
45062
|
]
|
|
45052
45063
|
};
|
|
@@ -45057,12 +45068,12 @@ function registerImpactTool(server) {
|
|
|
45057
45068
|
group.push({
|
|
45058
45069
|
line: match.lineNumber,
|
|
45059
45070
|
text: match.lineText.trim(),
|
|
45060
|
-
usage: classifyUsage(match.lineText,
|
|
45071
|
+
usage: classifyUsage(match.lineText, symbol2)
|
|
45061
45072
|
});
|
|
45062
45073
|
byFile.set(match.filePath, group);
|
|
45063
45074
|
}
|
|
45064
45075
|
const lines = [
|
|
45065
|
-
`${results.totalMatches} references to "${
|
|
45076
|
+
`${results.totalMatches} references to "${symbol2}" in ${byFile.size} files:`,
|
|
45066
45077
|
""
|
|
45067
45078
|
];
|
|
45068
45079
|
for (const [filePath, refs] of byFile) {
|