scai 0.1.80 → 0.1.81
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.
|
@@ -18,11 +18,20 @@ export async function summarizeFile(filepath) {
|
|
|
18
18
|
if (matches.length > 0) {
|
|
19
19
|
const topMatch = matches[0];
|
|
20
20
|
filePathResolved = path.resolve(process.cwd(), topMatch.path);
|
|
21
|
-
console.log(`🔗 Matched file: ${path.relative(process.cwd(), filePathResolved)}`);
|
|
21
|
+
console.log(`🔗 Matched file from index: ${path.relative(process.cwd(), filePathResolved)}`);
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
// Fallback: check if it's a real file in CWD
|
|
25
|
+
const localPath = path.resolve(process.cwd(), filepath);
|
|
26
|
+
try {
|
|
27
|
+
await fs.access(localPath);
|
|
28
|
+
filePathResolved = localPath;
|
|
29
|
+
console.log(`📁 Using local file: ${path.relative(process.cwd(), localPath)}`);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
console.error(`❌ Could not find or resolve file: "${filepath}"`);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
26
35
|
}
|
|
27
36
|
}
|
|
28
37
|
// 📄 Load file content from resolved path
|
package/dist/utils/summarizer.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import columnify from "columnify";
|
|
2
2
|
export function styleOutput(summaryText) {
|
|
3
3
|
const terminalWidth = process.stdout.columns || 80;
|
|
4
|
-
//
|
|
5
|
-
const
|
|
4
|
+
// Split by line to simulate multiple rows instead of one long wrapped field
|
|
5
|
+
const lines = summaryText.trim().split('\n').map(line => ({ Summary: line }));
|
|
6
|
+
const formatted = columnify(lines, {
|
|
6
7
|
columnSplitter: ' ',
|
|
7
8
|
maxLineWidth: terminalWidth,
|
|
8
9
|
config: {
|
|
9
10
|
Summary: {
|
|
10
|
-
maxWidth: Math.floor((terminalWidth * 2) / 3),
|
|
11
|
+
maxWidth: Math.floor((terminalWidth * 2) / 3),
|
|
11
12
|
align: "left",
|
|
12
13
|
},
|
|
13
14
|
},
|