mirror of
https://github.com/makecindy/cindy.git
synced 2026-12-02 04:29:48 +08:00
* chore(dco): 落地 DCO 签名基础设施 仓库公开前把 DCO 从 CONTRIBUTING 里的一句要求补成可执行的门禁。PR 侧用已装到 org 的 DCO GitHub App,本仓提供它的配置、本地自查与自动签名。历史提交不受影响:只看 PR 内的 commit。 - DCO:Developer Certificate of Origin 1.1 原文,逐字未改 - .github/dco.yml:开启 individual + thirdParty remediation commit,让漏签的 PR 可以 不改写历史、保住已有 review 讨论 - .githooks/prepare-commit-msg:本地自动补签。git 没有让 commit 自动签名的配置项 (format.signOff 只作用于 format-patch / am),只能用 hook;输出排版对齐原生 git commit -s,并显式钉住 --if-exists / --if-missing,避免开发者的 trailer.ifExists 配置导致静默漏签 - scripts/install-dco-hook.mjs:把上面的 hook 复制进 hooks 目录,不覆盖他人同名 hook - scripts/check-dco.mjs:提交前自查(pnpm check:dco)。判定对齐 App——名字与邮箱都要 匹配 author 或 committer,并校验邮箱形状;刻意不识别 remediation commit,保证本地 通过则 App 必过,不会出现本地绿而 PR 红 - scripts/__tests__/check-dco.test.mjs:13 个用例,含真 git 仓库端到端 - CONTRIBUTING / README(中英)、PR 模板、AGENTS.md、development-workflow.md 写明门禁、 两种补签方式,以及 agent 自动提交同样适用 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Dash <dashhuang@gmail.com> * fix(dco): hook 改签 committer,并收紧本地自查与 hook 所有权判定 处理 review 反馈里核实成立的部分。两个真 bug: - hook 原来取 GIT_AUTHOR_IDENT,在 git commit --author=、cherry-pick 或 rebase 他人 patch 时会替原作者伪造 DCO 声明。改取 GIT_COMMITTER_IDENT——原生 git commit -s 就是 这个语义(签名是执行提交者的声明);门禁接受 author 或 committer 的签名,不影响通过。 - install-dco-hook 的所有权判定原来只看「文件含 marker」。开发者按提示把本仓逻辑合并进 自己的 hook 后,那份复合 hook 会被判成本仓的旧版本并被整份覆盖,抹掉他自己的逻辑。 改为比对开头两行(shebang + marker 注释),复合 hook 一律算 foreign 不覆盖。 三处收紧本地自查,都是为了不出现「本地绿、PR 红」: - 邮箱形状原来的单行正则会放行 validator.isEmail 拒绝的地址(连续点、下划线域名等), 现在 local part 与域名分开校验并要求字母 TLD - 签名改为 name+email 成对匹配某一个身份。原来拆成两个集合,author=Alice<a@x>、 committer=Bob<b@x> 时 `Alice <b@x>` 也能过,尽管这个身份不存在。这让本脚本比 App 更严, 偏严只会本地红、PR 绿,是安全方向 - 修复提示里的 rebase base 用完整 sha,短 sha 在大仓可能歧义 另外删掉了 check-dco.mjs 头部对 .github/workflows/dco.yml 的引用(该 workflow 已改用 DCO App,文件不存在)。 新增回归用例覆盖:--author 场景下签 committer 且与原生 -s 一致、复合 hook 判 foreign、 validator 会拒的地址逐个断言拒绝、交叉身份签名不通过。反向验证过前两项——还原任一处 修复会分别红 2 个用例。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Dash <dashhuang@gmail.com> * fix(dco): hook 安装器不再猜所有权,邮箱校验对齐 validator 字符集 第二轮 review 反馈,三处成立: - hook 所有权判定上一版按「开头两行」判断,只挡住了「把本仓逻辑合并进自己的 hook」, 挡不住「在本仓装好的 hook 后面追加自己的逻辑」——后者开头两行仍是我们的,会被判成 旧版本并整份覆盖。这两种情况在磁盘上分辨不出来,所以不再猜:内容不等于源文件就是 modified,一律要显式 --force 才覆盖,并提示先 diff。 - 邮箱形状仍比 validator.isEmail 宽松:local part 收紧到 RFC 5322 的 atext 字符集 (拒 a(b)@x.com 这类),域名 label 不再允许以连字符开头或结尾(拒 a@-foo.com)。 含方括号的 bot 地址因此也不合格,但 bot 提交在 exemptReason 就豁免了,走不到这里—— 补了交叉用例把这条钉住。 - resolveHooksDir 依赖的 --path-format 要 git 2.31+,旧版直接失败会让安装器不可用, 回落成 --git-path + show-toplevel 自己拼绝对路径。 另有一条 P1 是误报:说 commit 651e353f 没有签名,但该 sha 在远端与本地都不存在 (gh api 返回 422、git cat-file 失败),PR 的两个 commit 都带 Signed-off-by。上一轮 同一 bot 报的 ac842de1 也是同样情况,都是它在自己环境重建 commit 后检查了自己的 sha。 新增用例:追加型复合 hook 判 modified、无 --force 时拒绝覆盖且不改动文件、--force 才 覆盖、resolveHooksDir 返回绝对路径、bot 地址不合格但仍豁免、validator 会拒的新反例。 反向验证过邮箱那处——放宽 atext 会红 2 个用例。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Dash <dashhuang@gmail.com> * fix(dco): 修正旧版 git 的 hooks 路径基准,补齐邮箱长度上限与 fork 默认基准 第三轮 review 反馈,三处成立: - resolveHooksDir 的旧版 git 回落分支用仓库根去解析 `git rev-parse --git-path hooks` 的返回值,但那个相对路径是相对于**执行 git 时的 cwd**。从子目录调用时它形如 ../../.git/hooks,拿仓库根解析会向上多走几级,把 hook 装进隔壁或上层仓库的 .git/hooks——既漏装本仓,又动了别的仓库。改用同一个 cwd 解析,并把这一步抽成 resolveHooksPathFrom 以便直接断言(走到该分支需要 git < 2.31,CI 上跑不到)。 - 邮箱校验只做了字符集与连字符规则,没有长度上限:65 字符的 local part 本地放行、 validator.isEmail 拒绝。补上 local part ≤ 64、域名 ≤ 254、单个 label ≤ 63,并断言 恰好在上限的地址仍放行。 - 本地默认基准候选加 upstream/main 且排在 origin/main 之前。从 fork 干活时 origin/main 可能领先于上游,拿它当基准会把 fork 自己那些未签名的提交排除在范围外,而 PR 的真实 base 是上游。这只是本地自查的启发式,真实结论仍以 PR 上的 DCO check 为准。 另有一条 P1 是同类误报(第三次):说 commit 426347872c 没有签名,但该 sha 在远端与本地 都不存在,PR 的三个 commit 都带 Signed-off-by,DCO check 为 success。 反向验证过前两处:把 hooks 路径基准改回仓库根、或去掉长度检查,各会红 1 个用例。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Dash <dashhuang@gmail.com> * docs(dco): 修正 hook 与安装器注释里过时的 author/门禁归属表述 两处都是前几轮改动留下的文档漂移,reviewer 指出的都对: - install-dco-hook.mjs 顶部仍写「追加与 commit author 一致的 Signed-off-by」,但 hook 在 第一轮修复后已改成签 committer(与原生 git commit -s 一致)。 - 两个文件都把「PR 上的门禁」说成 scripts/check-dco.mjs。实际权威门禁是 DCO GitHub App (配置见 .github/dco.yml),check-dco.mjs 只是本地提交前自查。 只改注释,无逻辑改动。顺带全仓 grep 了同类措辞,没有其它残留。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Dash <dashhuang@gmail.com> * fix(dco): 补邮箱整体长度上限、bot 判定只认邮箱、修复丢失可执行位的 hook 第五轮 review 反馈,三处成立: - 邮箱长度上限漏了整体那一条。local part ≤ 64、域名 ≤ 254、label ≤ 63 各自满足时, 整个地址仍可能超过 validator.isEmail 的 254 上限(reviewer 给的例子是 258 字符)。 补上整体检查,并加了长度恰好 254 放行、255 拒绝的边界断言。 - isBotIdentity 不再认 author name 的 `[bot]` 后缀。`git config user.name` 谁都能设成 `Foo[bot]`,按 name 豁免等于给本地检查留一个一步就能绕过的后门,且方向是「本地绿、 PR 红」——App 判定的是不可伪造的 GitHub 账号类型。现在只认 bot 邮箱 (web-flow 的 noreply@github.com 与 `*[bot]@users.noreply.github.com`)。 - 安装器遇到「内容逐字一致但丢了可执行位」时会报「已是最新」直接返回,而 git 会静默 忽略不可执行的 hook——于是安装器说装好了,提交却一直没签名。现在这种情况会补回 执行位并说明原因,--check 也会点出「NOT executable」而不是笼统报 installed。 另有一条 P1 是同类误报(第四次):说 commit 8d8ec210 没有签名且「resolves locally」,但 该 sha 在本仓远端与本地都不存在(gh api 422、git cat-file 失败),PR 的 5 个 commit 全部 带 Signed-off-by。 顺带清理了上一轮抽函数时留在 resolveHooksPathFrom 前面的悬空注释。 反向验证过三处:去掉整体长度检查、恢复 name 后缀豁免、去掉可执行位修复,各会红 1 个用例。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Dash <dashhuang@gmail.com> * fix(dco): hook 固定 LF 检出,签名解析对齐 App 的行格式 第六轮 review 反馈,三处成立: - .githooks/ 下的 hook 没有扩展名,命不中 .gitattributes 已有的 `*.sh` / `*.mjs` 规则。Windows autocrlf 检出成 CRLF 后 `#!/bin/sh\r` 无法执行,git commit 会直接 `fatal: cannot exec`——装了 hook 的人从此提交不了。补 `.githooks/** text eol=lf`, git check-attr 已确认生效。仓库先前为 *.sh 与 *.mjs 加过同样保护并写了注释,这次是漏了。 - 签名解析比 App 宽松三处,都会造成「本地绿、PR 红」:行首空白(App 的 `^Signed-off-by:` 锚在行首,缩进行在它眼里不是签名)、冒号后多个空格(多出的空格被 App 算进 name, 与 author 比不上)、捕获值 trim(App 拿原样值比对)。正则改为与 dcoapp/app 的 `/^Signed-off-by: (.*) <(.*)>\s*$/gim` 逐字对齐,比对时签名侧只 lowercase 不 trim。 - 安装器提示的 diff 命令换成 `git diff --no-index`:git 本来就是本仓前置依赖,而 diff(1) 在部分 Windows 环境没有。 另有两条 P1 是同类误报(第五、六次,sha 7c571f80 与 be844285 在本仓远端与本地都不存在), 一条是过时反馈(bot name 豁免已在e83fca65去掉)。 CI 的 verify 之前红过一次,核实是 main 基线问题:#329 合入后有 3 条源码文本断言过时, main 上的5c1a81c已修好,但它比本 PR 那轮 CI 晚合入。已 update-branch 同步最新 main。 反向验证过两处正则修复:放宽任一处各会红 1 个用例。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Dash <dashhuang@gmail.com> * refactor(dco): classifyHook 的源文件读取改为懒求值 默认参数 `expectedContent = readHookSource()` 会在调用时就求值,于是 `classifyHook(null)`(没装 hook 这条最常见的路径)也要读一次磁盘,并且把这个判断 绑到了源文件可读上。改成先判 missing、再按需 `?? readHookSource()`。 行为不变,纯效率与依赖面收敛。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Dash <dashhuang@gmail.com> * fix(dco): 本地不再按邮箱豁免 bot,改为只豁免 merge commit reviewer 指出上一轮的邮箱豁免仍可伪造:author 邮箱是自由填写的, `999999+not-a-real-account[bot]@users.noreply.github.com` 谁都能设,而 App 认的是 GitHub 账号类型(author.type === "Bot")。按邮箱豁免等于留一个可伪造的后门,方向还是 最坏的「本地绿、PR 红」。 离线能可靠判定的豁免依据只有父提交数量,所以 exemptReason 现在只豁免 merge commit。 bot 提交在本地照常检查——方向安全(本地红、PR 绿),失败输出里解释清楚:这类地址在 PR 上由 App 按账号类型豁免,而账号类型离线取不到,所以本地不敢信一个可伪造的地址。 原 isBotIdentity 改名为 looksLikeBotAddress,语义收窄为「只用于失败输出的提示」, 并去掉了已在上一轮移除的 name 后缀判断残留说明。 同步了三处因语义变更而过时的表述:check-dco.mjs 里「bot 提交在 exemptReason 就被豁免, 走不到这里」、测试文件头的「merge/bot 豁免」、以及 CONTRIBUTING 中英两版里对 `pnpm check:dco` 保守程度的说明(现在明确列出 remediation 与 bot 两项差异)。 提交前门禁:根 pnpm test:unit 有 1 项 apps/mobile 的 startupSplashOverlay 超时失败, 与本 PR 无关——该测试单跑 3.95s、默认上限 5s,本机负载峰值 150+ 时必然 flake;定向重跑 6/6 通过。不在本 PR 混入无关修复。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Dash <dashhuang@gmail.com> --------- Signed-off-by: Dash <dashhuang@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
188 lines
8.9 KiB
JavaScript
188 lines
8.9 KiB
JavaScript
#!/usr/bin/env node
|
||
// 本地 DCO 签名 hook 安装器:把仓库里的 .githooks/prepare-commit-msg 复制进当前仓库的
|
||
// hooks 目录,让此后每次 `git commit`(含 agent 自动提交)都自动追加 Signed-off-by
|
||
// trailer——签的是 commit 的 committer,与原生 `git commit -s` 一致。这样可以避免 PR 被
|
||
// DCO check(DCO GitHub App,配置见 .github/dco.yml)拦下后返工;本地提交前的自查是
|
||
// scripts/check-dco.mjs,PR 上的权威结论则以 App 的 check 为准。
|
||
//
|
||
// 用法:
|
||
// pnpm dco:install-hook 安装 hook(已存在且被改过时会拒绝,见下)
|
||
// node scripts/install-dco-hook.mjs --check 只报告状态,不写文件
|
||
// node scripts/install-dco-hook.mjs --force 覆盖一份源自本仓但已被改动的 hook
|
||
//
|
||
// hook 的正本是 .githooks/prepare-commit-msg(普通 shell 脚本,可直接 review 与
|
||
// shellcheck);本脚本只负责复制、判断能否安全覆盖,不生成脚本内容。想跳过安装器的
|
||
// 开发者可以直接 `git config core.hooksPath .githooks`——但那会接管整个 hooks 目录,
|
||
// 所以默认走复制,与开发者已有的其他 hook 共存。
|
||
//
|
||
// hook 是纯本地便利设施:不改远端、不改 core.hooksPath,删掉已安装的文件即卸载。
|
||
|
||
import { execFileSync } from 'node:child_process';
|
||
import { chmodSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
||
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||
|
||
const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
|
||
|
||
/** 用于识别「这个 hook 是本仓装的」,据此判断可否安全覆盖。与 hook 源文件里的注释一致。 */
|
||
export const HOOK_MARKER = 'cindy-dco-signoff-hook';
|
||
export const HOOK_NAME = 'prepare-commit-msg';
|
||
export const HOOK_SOURCE_PATH = join('.githooks', HOOK_NAME);
|
||
|
||
/** hook 内容的单一事实源。 */
|
||
export function readHookSource() {
|
||
return readFileSync(join(REPO_ROOT, HOOK_SOURCE_PATH), 'utf8');
|
||
}
|
||
|
||
/**
|
||
* 把 `git rev-parse --git-path hooks` 的返回值化成绝对路径。
|
||
*
|
||
* 关键点:它给的相对路径是相对于**执行 git 时的 cwd**,不是仓库根。从子目录调用时返回的
|
||
* 是形如 `../../.git/hooks` 的路径,若拿仓库根去解析就会向上多走几级,把 hook 写进隔壁
|
||
* 或上层仓库的 .git/hooks——所以基准必须是同一个 cwd。单独抽出来是为了能直接断言这点:
|
||
* 走到这个分支需要 git < 2.31,CI 上跑不到。
|
||
*/
|
||
export function resolveHooksPathFrom(hooksPath, cwd) {
|
||
return isAbsolute(hooksPath) ? hooksPath : resolve(cwd, hooksPath);
|
||
}
|
||
|
||
/**
|
||
* hooks 目录:走 `git rev-parse --git-path hooks`,因此自动尊重已设置的 core.hooksPath;
|
||
* 多 worktree 共享 common dir,装一次全部 worktree 生效。--path-format 要 git 2.31+,
|
||
* 旧版回落到 resolveHooksPathFrom。
|
||
*/
|
||
export function resolveHooksDir(cwd = process.cwd()) {
|
||
const git = (args) => execFileSync('git', args, { cwd, encoding: 'utf8' }).trim();
|
||
try {
|
||
return git(['rev-parse', '--path-format=absolute', '--git-path', 'hooks']);
|
||
} catch {
|
||
// --path-format 要 git 2.31+,旧版回落到这里。
|
||
return resolveHooksPathFrom(git(['rev-parse', '--git-path', 'hooks']), cwd);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 返回 `missing`(没有)/ `installed`(内容与源文件逐字一致)/ `modified`(认得出源自本仓,
|
||
* 但内容已经不同)/ `foreign`(完全不是本仓的东西)。
|
||
*
|
||
* 只有 `installed` 与 `missing` 允许无条件写入。刻意不去区分「本仓装的旧版本」与「装完
|
||
* 之后被人改过」——这两者在磁盘上无法可靠分辨:无论是把本仓逻辑合并进自己的 hook,还是
|
||
* 在本仓装好的 hook 后面追加几行,得到的都是「像本仓的、但不等于源文件」。任何试图靠开头
|
||
* 几行或 marker 位置来认领它们的判定,都会在某一种组合上误判并整份覆盖,抹掉开发者的
|
||
* 逻辑。所以这里一律要求显式 --force 才覆盖。
|
||
*/
|
||
export function classifyHook(existingContent, expectedContent) {
|
||
// 先判 missing 再取源文件:默认参数会在调用时就求值,那样 `classifyHook(null)` 也要读一次
|
||
// 磁盘,还把「没装 hook」这个判断绑到源文件可读上。
|
||
if (existingContent === null) return 'missing';
|
||
const expected = expectedContent ?? readHookSource();
|
||
if (existingContent === expected) return 'installed';
|
||
return existingContent.includes(HOOK_MARKER) ? 'modified' : 'foreign';
|
||
}
|
||
|
||
export function readHook(hookPath) {
|
||
try {
|
||
return readFileSync(hookPath, 'utf8');
|
||
} catch (error) {
|
||
if (error?.code === 'ENOENT') return null;
|
||
throw error;
|
||
}
|
||
}
|
||
|
||
/** git 只执行带 owner 执行位的 hook;缺了它内容再对也不会生效。 */
|
||
export function isExecutable(hookPath) {
|
||
try {
|
||
return (statSync(hookPath).mode & 0o100) !== 0;
|
||
} catch {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
/** 供 check-dco.mjs 在本地校验通过后决定是否提示安装。探测失败一律当「已装」处理,不打扰。 */
|
||
export function isSignOffHookInstalled(cwd = process.cwd()) {
|
||
try {
|
||
const hookPath = join(resolveHooksDir(cwd), HOOK_NAME);
|
||
return classifyHook(readHook(hookPath)) !== 'missing';
|
||
} catch {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
function main() {
|
||
const checkOnly = process.argv.includes('--check');
|
||
const force = process.argv.includes('--force');
|
||
const hooksDir = resolveHooksDir();
|
||
const hookPath = join(hooksDir, HOOK_NAME);
|
||
const source = readHookSource();
|
||
const state = classifyHook(readHook(hookPath), source);
|
||
|
||
// --check 只报告,不写文件、不因状态失败:调用方要的是事实,不是门禁。
|
||
if (checkOnly) {
|
||
const executableNote =
|
||
state === 'installed' && !isExecutable(hookPath) ? ', but NOT executable — Git will ignore it' : '';
|
||
const label = {
|
||
installed: `installed, matching ${HOOK_SOURCE_PATH}${executableNote}`,
|
||
modified: "present but differs from this repo's version (older, or edited locally)",
|
||
missing: 'not installed',
|
||
foreign: 'a different prepare-commit-msg hook is present; not taken over',
|
||
}[state];
|
||
console.log(`DCO sign-off hook: ${label} (${hookPath})`);
|
||
return;
|
||
}
|
||
|
||
if (state === 'installed') {
|
||
// 内容一致但丢了可执行位(手动复制、备份恢复、chmod 0644 都会这样)时 git 会直接
|
||
// 忽略这个 hook,提交照样不带签名——而安装器如果只看内容就会报「已是最新」,把人骗过去。
|
||
if (!isExecutable(hookPath)) {
|
||
chmodSync(hookPath, 0o755);
|
||
console.log(`Restored the executable bit on ${hookPath}`);
|
||
console.log('(Git silently ignores hooks that are not executable, so commits were unsigned.)');
|
||
return;
|
||
}
|
||
console.log(`DCO sign-off hook already up to date: ${hookPath}`);
|
||
return;
|
||
}
|
||
|
||
if (state === 'foreign') {
|
||
console.error(`A ${HOOK_NAME} hook not managed by this repository already exists:`);
|
||
console.error(` ${hookPath}`);
|
||
console.error(`Leaving it untouched. Either merge the logic from ${HOOK_SOURCE_PATH} into it`);
|
||
console.error('— this installer will then keep its hands off that file, so you own keeping the');
|
||
console.error('merged copy in sync — or use `git config core.hooksPath .githooks` instead.');
|
||
process.exit(1);
|
||
}
|
||
|
||
// modified:可能是本仓的旧版本,也可能是装完之后你自己加过东西。磁盘上分辨不出来,
|
||
// 所以不猜,要求显式 --force——猜错的代价是删掉别人的 hook 逻辑。
|
||
if (state === 'modified' && !force) {
|
||
console.error(`${hookPath} came from this repository but no longer matches ${HOOK_SOURCE_PATH}.`);
|
||
console.error('It is either an older version of the hook, or a copy you have edited since.');
|
||
console.error('Not overwriting it. Compare first, then decide:');
|
||
// 用 git diff 而不是 diff(1):git 本来就是本仓的前置依赖,而 diff 在部分 Windows
|
||
// 环境里没有。
|
||
console.error(` git diff --no-index ${hookPath} ${join(REPO_ROOT, HOOK_SOURCE_PATH)}`);
|
||
console.error(' node scripts/install-dco-hook.mjs --force # overwrite with this repo\'s version');
|
||
process.exit(1);
|
||
}
|
||
|
||
mkdirSync(hooksDir, { recursive: true });
|
||
writeFileSync(hookPath, source, 'utf8');
|
||
chmodSync(hookPath, 0o755);
|
||
console.log(`${state === 'modified' ? 'Overwrote' : 'Installed'} DCO sign-off hook: ${hookPath}`);
|
||
console.log(
|
||
`Copied from ${HOOK_SOURCE_PATH}. git commit will now append Signed-off-by; ` +
|
||
'delete the installed file to uninstall.'
|
||
);
|
||
}
|
||
|
||
// 仅作为入口执行时运行;被 import 时只导出纯函数与探测函数。
|
||
const isDirectRun = process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href;
|
||
if (isDirectRun) {
|
||
try {
|
||
main();
|
||
} catch (error) {
|
||
console.error(String(error?.message ?? error));
|
||
process.exit(1);
|
||
}
|
||
}
|