codesight 1.5.0 → 1.5.1
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/formatter.js +3 -1
- package/dist/index.js +3 -3
- package/dist/scanner.js +28 -1
- package/package.json +1 -1
package/dist/formatter.js
CHANGED
|
@@ -239,7 +239,9 @@ function formatCombined(result, sections) {
|
|
|
239
239
|
// Token stats
|
|
240
240
|
const ts = result.tokenStats;
|
|
241
241
|
lines.push(`> ${result.routes.length} routes | ${result.schemas.length} models | ${result.components.length} components | ${result.libs.length} lib files | ${result.config.envVars.length} env vars | ${result.middleware.length} middleware | ${result.graph.edges.length} import links`);
|
|
242
|
-
|
|
242
|
+
// Round to nearest 100 to keep output deterministic across runs (avoids git conflicts in worktrees)
|
|
243
|
+
const roundTo100 = (n) => Math.round(n / 100) * 100;
|
|
244
|
+
lines.push(`> **Token savings:** this file is ~${roundTo100(ts.outputTokens).toLocaleString()} tokens. Without it, AI exploration would cost ~${roundTo100(ts.estimatedExplorationTokens).toLocaleString()} tokens. **Saves ~${roundTo100(ts.saved).toLocaleString()} tokens per conversation.**`);
|
|
243
245
|
lines.push("");
|
|
244
246
|
lines.push("---");
|
|
245
247
|
lines.push("");
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { writeOutput } from "./formatter.js";
|
|
|
15
15
|
import { generateAIConfigs } from "./generators/ai-config.js";
|
|
16
16
|
import { generateHtmlReport } from "./generators/html-report.js";
|
|
17
17
|
import { loadConfig, mergeCliConfig } from "./config.js";
|
|
18
|
-
const VERSION = "1.5.
|
|
18
|
+
const VERSION = "1.5.1";
|
|
19
19
|
const BRAND = "codesight";
|
|
20
20
|
function printHelp() {
|
|
21
21
|
console.log(`
|
|
@@ -396,9 +396,9 @@ async function main() {
|
|
|
396
396
|
const reportPath = await generateHtmlReport(result, outputDir);
|
|
397
397
|
console.log(` ${outputDirName}/report.html`);
|
|
398
398
|
if (doOpen) {
|
|
399
|
-
const {
|
|
399
|
+
const { execFile } = await import("node:child_process");
|
|
400
400
|
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
401
|
-
|
|
401
|
+
execFile(cmd, [reportPath]);
|
|
402
402
|
console.log(" Opening in browser...");
|
|
403
403
|
}
|
|
404
404
|
}
|
package/dist/scanner.js
CHANGED
|
@@ -90,7 +90,7 @@ export async function detectProject(root) {
|
|
|
90
90
|
pkg = JSON.parse(await readFile(pkgPath, "utf-8"));
|
|
91
91
|
}
|
|
92
92
|
catch { }
|
|
93
|
-
const name = pkg.name ||
|
|
93
|
+
const name = pkg.name || await resolveRepoName(root);
|
|
94
94
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
95
95
|
// Detect monorepo
|
|
96
96
|
const isMonorepo = !!(pkg.workspaces || await fileExists(join(root, "pnpm-workspace.yaml")));
|
|
@@ -429,6 +429,33 @@ async function getGoDeps(root) {
|
|
|
429
429
|
catch { }
|
|
430
430
|
return deps;
|
|
431
431
|
}
|
|
432
|
+
/**
|
|
433
|
+
* Resolve the repo name, handling git worktrees.
|
|
434
|
+
* In a worktree, basename(root) is a random name — resolve the actual repo instead.
|
|
435
|
+
*/
|
|
436
|
+
async function resolveRepoName(root) {
|
|
437
|
+
try {
|
|
438
|
+
// Check if .git is a file (worktree) vs directory (normal repo)
|
|
439
|
+
const gitPath = join(root, ".git");
|
|
440
|
+
const gitStat = await stat(gitPath);
|
|
441
|
+
if (gitStat.isFile()) {
|
|
442
|
+
// Worktree: .git is a file containing "gitdir: /path/to/main/.git/worktrees/name"
|
|
443
|
+
const gitContent = await readFile(gitPath, "utf-8");
|
|
444
|
+
const gitdirMatch = gitContent.match(/gitdir:\s*(.+)/);
|
|
445
|
+
if (gitdirMatch) {
|
|
446
|
+
// Resolve back to main repo: /repo/.git/worktrees/name -> /repo
|
|
447
|
+
const worktreeGitDir = gitdirMatch[1].trim();
|
|
448
|
+
// Go up from .git/worktrees/name to the repo root
|
|
449
|
+
const mainGitDir = join(worktreeGitDir, "..", "..");
|
|
450
|
+
const mainRepoRoot = join(mainGitDir, "..");
|
|
451
|
+
return basename(mainRepoRoot);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
catch { }
|
|
456
|
+
// Fallback: use directory name
|
|
457
|
+
return basename(root);
|
|
458
|
+
}
|
|
432
459
|
async function fileExists(path) {
|
|
433
460
|
try {
|
|
434
461
|
await stat(path);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codesight",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "See your codebase clearly. Universal AI context generator that maps routes, schema, components, dependencies, and more for Claude Code, Cursor, Copilot, Codex, and any AI coding tool.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|