haansi 0.1.28 → 0.1.29
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/haansi.js +40 -4
- package/package.json +1 -1
package/dist/haansi.js
CHANGED
|
@@ -39,7 +39,7 @@ var require_package = __commonJS({
|
|
|
39
39
|
"package.json"(exports2, module2) {
|
|
40
40
|
module2.exports = {
|
|
41
41
|
name: "haansi",
|
|
42
|
-
version: "0.1.
|
|
42
|
+
version: "0.1.29",
|
|
43
43
|
description: "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
|
|
44
44
|
bin: {
|
|
45
45
|
haansi: "./dist/haansi.js"
|
|
@@ -945,24 +945,54 @@ function edgeScrub(content) {
|
|
|
945
945
|
}
|
|
946
946
|
return result;
|
|
947
947
|
}
|
|
948
|
+
function resolveGitBin() {
|
|
949
|
+
if (resolvedGitBin !== void 0) return resolvedGitBin;
|
|
950
|
+
for (const bin of GIT_BIN_CANDIDATES) {
|
|
951
|
+
try {
|
|
952
|
+
(0, import_child_process.execFileSync)(bin, ["--version"], { timeout: 5e3, stdio: "pipe" });
|
|
953
|
+
resolvedGitBin = bin;
|
|
954
|
+
return bin;
|
|
955
|
+
} catch {
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
resolvedGitBin = null;
|
|
959
|
+
return null;
|
|
960
|
+
}
|
|
961
|
+
function effectiveGitDir(cwd) {
|
|
962
|
+
if ((0, import_fs3.existsSync)(cwd)) return cwd;
|
|
963
|
+
const m = cwd.match(/^(.*)\/\.claude\/worktrees\/[^/]+/);
|
|
964
|
+
if (m && (0, import_fs3.existsSync)(m[1])) return m[1];
|
|
965
|
+
return cwd;
|
|
966
|
+
}
|
|
948
967
|
function extractGitInfo(projectDir, sessionTimestamp, sessionBranch) {
|
|
949
968
|
const empty = {
|
|
950
969
|
gitRemoteUrl: null,
|
|
951
970
|
gitCommit: null,
|
|
952
971
|
gitBranch: null
|
|
953
972
|
};
|
|
973
|
+
const gitBin = resolveGitBin();
|
|
974
|
+
if (!gitBin) {
|
|
975
|
+
logger.warn("Git metadata skipped \u2014 git binary not found", {
|
|
976
|
+
projectDir,
|
|
977
|
+
reason: "git-not-on-path",
|
|
978
|
+
tried: GIT_BIN_CANDIDATES
|
|
979
|
+
});
|
|
980
|
+
return empty;
|
|
981
|
+
}
|
|
982
|
+
const dir = effectiveGitDir(projectDir);
|
|
954
983
|
const opts = {
|
|
955
|
-
cwd:
|
|
984
|
+
cwd: dir,
|
|
956
985
|
timeout: 5e3,
|
|
957
986
|
encoding: "utf-8",
|
|
958
987
|
stdio: "pipe"
|
|
959
988
|
};
|
|
960
|
-
const git = (args) => (0, import_child_process.execFileSync)(
|
|
989
|
+
const git = (args) => (0, import_child_process.execFileSync)(gitBin, args, opts).trim();
|
|
961
990
|
try {
|
|
962
991
|
git(["rev-parse", "--is-inside-work-tree"]);
|
|
963
992
|
} catch (err) {
|
|
964
993
|
logger.warn("Git metadata skipped \u2014 cwd not a resolvable git repo", {
|
|
965
994
|
projectDir,
|
|
995
|
+
resolvedDir: dir,
|
|
966
996
|
reason: err?.code === "ENOENT" ? "cwd-missing" : err?.status === 128 ? "not-a-git-repo" : "git-check-failed",
|
|
967
997
|
error: err?.message?.slice(0, 200)
|
|
968
998
|
});
|
|
@@ -1205,7 +1235,7 @@ async function main() {
|
|
|
1205
1235
|
});
|
|
1206
1236
|
if (errors > 0) process.exit(1);
|
|
1207
1237
|
}
|
|
1208
|
-
var import_dotenv, import_path3, import_fs3, import_os3, import_zlib, import_child_process, logger, DEFAULT_API_URL3, CREDENTIALS_FILE3, MIN_LINES, EDGE_SCRUB_PATTERNS;
|
|
1238
|
+
var import_dotenv, import_path3, import_fs3, import_os3, import_zlib, import_child_process, logger, DEFAULT_API_URL3, CREDENTIALS_FILE3, MIN_LINES, EDGE_SCRUB_PATTERNS, GIT_BIN_CANDIDATES, resolvedGitBin;
|
|
1209
1239
|
var init_collector = __esm({
|
|
1210
1240
|
"../service-capture/claude-sessions/collector.ts"() {
|
|
1211
1241
|
"use strict";
|
|
@@ -1261,6 +1291,12 @@ var init_collector = __esm({
|
|
|
1261
1291
|
replacement: "[REDACTED:API_KEY]"
|
|
1262
1292
|
}
|
|
1263
1293
|
];
|
|
1294
|
+
GIT_BIN_CANDIDATES = [
|
|
1295
|
+
"git",
|
|
1296
|
+
"/opt/homebrew/bin/git",
|
|
1297
|
+
"/usr/local/bin/git",
|
|
1298
|
+
"/usr/bin/git"
|
|
1299
|
+
];
|
|
1264
1300
|
if (require.main === module) {
|
|
1265
1301
|
main().catch((err) => {
|
|
1266
1302
|
logger.error("Collector failed", err);
|