chore: release 2026.1.11-3
This commit is contained in:
11
src/entry.ts
11
src/entry.ts
@@ -21,5 +21,12 @@ if (parsed.profile) {
|
||||
process.argv = parsed.argv;
|
||||
}
|
||||
|
||||
const { runCli } = await import("./cli/run-main.js");
|
||||
await runCli(process.argv);
|
||||
import("./cli/run-main.js")
|
||||
.then(({ runCli }) => runCli(process.argv))
|
||||
.catch((error) => {
|
||||
console.error(
|
||||
"[clawdbot] Failed to start CLI:",
|
||||
error instanceof Error ? error.stack ?? error.message : error,
|
||||
);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { createRequire } from "node:module";
|
||||
|
||||
const formatCommit = (value?: string | null) => {
|
||||
if (!value) return null;
|
||||
@@ -37,6 +38,19 @@ const resolveGitHead = (startDir: string) => {
|
||||
|
||||
let cachedCommit: string | null | undefined;
|
||||
|
||||
const readCommitFromPackageJson = () => {
|
||||
try {
|
||||
const require = createRequire(import.meta.url);
|
||||
const pkg = require("../package.json") as {
|
||||
gitHead?: string;
|
||||
githead?: string;
|
||||
};
|
||||
return formatCommit(pkg.gitHead ?? pkg.githead ?? null);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export const resolveCommitHash = (
|
||||
options: { cwd?: string; env?: NodeJS.ProcessEnv } = {},
|
||||
) => {
|
||||
@@ -48,6 +62,11 @@ export const resolveCommitHash = (
|
||||
cachedCommit = normalized;
|
||||
return cachedCommit;
|
||||
}
|
||||
const pkgCommit = readCommitFromPackageJson();
|
||||
if (pkgCommit) {
|
||||
cachedCommit = pkgCommit;
|
||||
return cachedCommit;
|
||||
}
|
||||
try {
|
||||
const headPath = resolveGitHead(options.cwd ?? process.cwd());
|
||||
if (!headPath) {
|
||||
|
||||
Reference in New Issue
Block a user