Spaces:
Paused
Paused
File size: 1,157 Bytes
a3aed04 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | /**
* TIA-∞ Ecosystem Scanner
* Walks the QGTNL directory, maps structure, identifies modules,
* and prepares a non-destructive report for Guided Builder mode.
*/
import * as fs from "fs";
import * as path from "path";
export interface ScanResult {
path: string;
type: "file" | "directory";
size: number;
children?: ScanResult[];
}
export function scanDirectory(targetPath: string): ScanResult {
const stats = fs.statSync(targetPath);
if (stats.isFile()) {
return {
path: targetPath,
type: "file",
size: stats.size,
};
}
const children = fs.readdirSync(targetPath).map((child) => {
const childPath = path.join(targetPath, child);
return scanDirectory(childPath);
});
return {
path: targetPath,
type: "directory",
size: stats.size,
children,
};
}
export function scanQGTNL() {
const root = "/data/data/com.termux/files/home/QGTNL";
if (!fs.existsSync(root)) {
return {
status: "error",
message: "QGTNL root not found.",
};
}
const structure = scanDirectory(root);
return {
status: "ok",
scannedAt: Date.now(),
structure,
};
}
|