aicommit2 2.4.29 → 2.4.30
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/README.md +73 -31
- package/dist/cli.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<div align="center" markdown="1">
|
|
12
12
|
|
|
13
13
|
[](https://github.com/tak-bro)
|
|
14
|
-
|
|
14
|
+

|
|
15
15
|
[](https://www.npmjs.com/package/aicommit2)
|
|
16
16
|
[](https://www.npmjs.com/package/aicommit2)
|
|
17
17
|
[](#nix-installation)
|
|
@@ -448,50 +448,91 @@ Add the following to your LazyGit config file (`~/.config/lazygit/config.yml` or
|
|
|
448
448
|
|
|
449
449
|
```yaml
|
|
450
450
|
customCommands:
|
|
451
|
-
#
|
|
452
|
-
- key: "
|
|
451
|
+
# Quick commit with AI-generated subject (c in files panel)
|
|
452
|
+
- key: "c"
|
|
453
453
|
context: "files"
|
|
454
|
-
description: "
|
|
454
|
+
description: "Generate commit message with aicommit2"
|
|
455
455
|
prompts:
|
|
456
456
|
- type: "menuFromCommand"
|
|
457
457
|
title: "Select commit message"
|
|
458
458
|
key: "Commit"
|
|
459
|
-
command: "aicommit2 --output json
|
|
459
|
+
command: "aicommit2 --output json"
|
|
460
460
|
filter: '"subject":"(?P<subject>[^"]+)","body":"(?P<body>[^"]*)"'
|
|
461
461
|
valueFormat: '{{ .subject }}<SEP>{{ .body }}'
|
|
462
462
|
labelFormat: '{{ .subject }}'
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
# AI commit with editable subject and body (Shift+A in files panel)
|
|
466
|
-
- key: "A"
|
|
467
|
-
context: "files"
|
|
468
|
-
description: "AI commit (editable)"
|
|
469
|
-
prompts:
|
|
470
|
-
- type: "menuFromCommand"
|
|
471
|
-
title: "Select commit message"
|
|
472
|
-
key: "Subject"
|
|
473
|
-
command: "aicommit2 --output json"
|
|
474
|
-
filter: '"subject":"(?P<subject>[^"]+)"'
|
|
475
|
-
valueFormat: '{{ .subject }}'
|
|
476
|
-
labelFormat: '{{ .subject }}'
|
|
477
|
-
- type: "input"
|
|
478
|
-
title: "Edit subject"
|
|
479
|
-
key: "FinalSubject"
|
|
480
|
-
initialValue: '{{ .Form.Subject }}'
|
|
481
|
-
- type: "input"
|
|
482
|
-
title: "Add body (optional)"
|
|
483
|
-
key: "Body"
|
|
484
|
-
initialValue: ''
|
|
485
|
-
command: bash -c 'git commit -m "{{ .Form.FinalSubject }}" {{ if .Form.Body }}-m "{{ .Form.Body }}"{{ end }}'
|
|
463
|
+
output: "terminal"
|
|
464
|
+
command: bash -c 'MSG="{{ .Form.Commit }}" && SUBJ="${MSG%%<SEP>*}" && BODY="${MSG#*<SEP>}" && git commit -e -m "$SUBJ" ${BODY:+-m "$BODY"}'
|
|
486
465
|
```
|
|
487
466
|
|
|
467
|
+
> **Note:** This overrides LazyGit's default `c` (commit) key. You can change the key to another value (e.g., `<c-a>`) if you prefer to keep the default behavior.
|
|
468
|
+
|
|
488
469
|
#### Usage in LazyGit
|
|
489
470
|
|
|
490
471
|
1. Stage your changes in LazyGit
|
|
491
|
-
2. Press `
|
|
492
|
-
3.
|
|
472
|
+
2. Press `c` to generate AI commit messages and select one
|
|
473
|
+
3. The editor opens with the selected message for final review
|
|
474
|
+
|
|
475
|
+
#### Advanced: fzf Preview with Body
|
|
476
|
+
|
|
477
|
+
For detailed commit messages with **subject + body**, use the fzf-based approach. This uses `--include-body` (`-i`) flag to generate detailed body content and shows a preview window before committing.
|
|
478
|
+
|
|
479
|
+
**Requirements:** `jq` and `fzf` must be installed (`brew install jq fzf`).
|
|
480
|
+
|
|
481
|
+
First, create the script file at `~/.config/lazygit/scripts/aicommit_fzf.sh` (or `~/Library/Application Support/lazygit/scripts/` on macOS):
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
#!/usr/bin/env bash
|
|
485
|
+
set -euo pipefail
|
|
486
|
+
|
|
487
|
+
for cmd in aicommit2 jq fzf; do
|
|
488
|
+
if ! command -v "$cmd" >/dev/null 2>&1; then
|
|
489
|
+
echo "$cmd is required"
|
|
490
|
+
exit 1
|
|
491
|
+
fi
|
|
492
|
+
done
|
|
493
|
+
|
|
494
|
+
results_file="$(mktemp -t lazygit-aicommit-results.XXXXXX)"
|
|
495
|
+
trap 'rm -f "$results_file"' EXIT INT TERM
|
|
496
|
+
|
|
497
|
+
selected="$(
|
|
498
|
+
echo | fzf \
|
|
499
|
+
--prompt="AI commit> " \
|
|
500
|
+
--header="Select a message" \
|
|
501
|
+
--height=100% \
|
|
502
|
+
--layout=reverse \
|
|
503
|
+
--info=inline \
|
|
504
|
+
--with-nth=2.. \
|
|
505
|
+
--delimiter=$'\t' \
|
|
506
|
+
--with-shell="bash --noprofile --norc -c" \
|
|
507
|
+
--preview-window="right:60%:wrap" \
|
|
508
|
+
--preview "jq -r '.[ {1} ] | \"\(.subject)\n\n\(.body)\"' $results_file" \
|
|
509
|
+
--bind "load:unbind(load)+reload-sync#aicommit2 -i --output json 2>/dev/null | jq -s '.' > $results_file && jq -r 'to_entries[] | \"\\(.key)\\t\\(.value.subject)\"' $results_file#"
|
|
510
|
+
)" || exit 0
|
|
511
|
+
|
|
512
|
+
[ -n "$selected" ] || exit 0
|
|
513
|
+
|
|
514
|
+
index="${selected%%$'\t'*}"
|
|
515
|
+
subject="$(jq -r ".[$index].subject" "$results_file")"
|
|
516
|
+
body="$(jq -r ".[$index].body" "$results_file")"
|
|
517
|
+
|
|
518
|
+
git commit -e -m "$subject" -m "$body"
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
Make it executable: `chmod +x ~/.config/lazygit/scripts/aicommit_fzf.sh`
|
|
522
|
+
|
|
523
|
+
Then add this to your LazyGit config:
|
|
524
|
+
|
|
525
|
+
```yaml
|
|
526
|
+
customCommands:
|
|
527
|
+
# Long commit with fzf preview (Shift+C in files panel)
|
|
528
|
+
- key: "C"
|
|
529
|
+
context: "files"
|
|
530
|
+
description: "Generate commit message (long) with aicommit2"
|
|
531
|
+
output: "terminal"
|
|
532
|
+
command: "/path/to/aicommit_fzf.sh" # Update with your script path
|
|
533
|
+
```
|
|
493
534
|
|
|
494
|
-
>
|
|
535
|
+
> Thanks to [@peinan](https://github.com/peinan) for this configuration! See the [original discussion](https://github.com/tak-bro/aicommit2/issues/215#issuecomment-3982049025) and dotfiles ([config.yml](https://github.com/peinan/dotfiles/blob/main/src/.config/lazygit/config.yml), [aicommit_fzf.sh](https://github.com/peinan/dotfiles/blob/main/src/.config/lazygit/scripts/aicommit_fzf.sh)) for reference.
|
|
495
536
|
|
|
496
537
|
### Git Hooks
|
|
497
538
|
|
|
@@ -992,6 +1033,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
992
1033
|
<tr>
|
|
993
1034
|
<td align="center"><a href="https://github.com/jaytaylor"><img src="https://avatars.githubusercontent.com/jaytaylor" width="100px;" alt=""/><br /><sub><b>@jaytaylor</b></sub></a><br /><a href="https://github.com/tak-bro/aicommit2/commits?author=jaytaylor" title="Code">💻</a></td>
|
|
994
1035
|
<td align="center"><a href="https://github.com/denniswebb"><img src="https://avatars.githubusercontent.com/denniswebb" width="100px;" alt=""/><br /><sub><b>@denniswebb</b></sub></a><br /><a href="https://github.com/tak-bro/aicommit2/commits?author=denniswebb" title="Code">💻</a></td>
|
|
1036
|
+
<td align="center"><a href="https://github.com/peinan"><img src="https://avatars.githubusercontent.com/peinan" width="100px;" alt=""/><br /><sub><b>@peinan</b></sub></a><br /><a href="https://github.com/tak-bro/aicommit2/issues/215" title="Documentation">📖</a></td>
|
|
995
1037
|
</tr>
|
|
996
1038
|
</table>
|
|
997
1039
|
<!-- markdownlint-restore -->
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{command as de,cli as Mn}from"cleye";import{createRequire as Rn}from"module";import Dn from"crypto";import X from"fs";import Fe from"os";import x from"path";import{Buffer as Tr}from"node:buffer";import ge from"node:path";import Rt,{ChildProcess as jr,exec as On}from"node:child_process";import ae from"node:process";import Nn,{execSync as Ze,exec as Fn}from"child_process";import{fileURLToPath as Br}from"node:url";import _n,{constants as Gr}from"node:os";import Hr from"assert";import Ur from"events";import{createWriteStream as Ln,createReadStream as Tn,readFileSync as jn}from"node:fs";import Bn from"buffer";import Dt from"stream";import zr,{promisify as Gn}from"util";import{debuglog as Hn,promisify as Un}from"node:util";import et from"inquirer";import{of as Ot,concatMap as F,from as D,map as O,catchError as N,mergeMap as Kr,BehaviorSubject as Wr,ReplaySubject as zn,Subscription as Nt,lastValueFrom as Ft,toArray as _t,filter as Yr,Subject as Lt}from"rxjs";import _ from"fs/promises";import C from"chalk";import Kn from"@anthropic-ai/sdk";import{fromPromise as L}from"rxjs/internal/observable/innerFrom";import{xxh64 as Jr}from"@pacote/xxhash";import U from"winston";import"winston-daily-rotate-file";import Vr from"https";import Wn from"axios";import{CohereClientV2 as Yn}from"cohere-ai";import qr from"openai";import{GoogleGenerativeAI as Jn,HarmCategory as tt,HarmBlockThreshold as rt}from"@google/generative-ai";import Vn from"http";import qn from"net";import Xn from"tls";import Qn,{fileURLToPath as Zn,pathToFileURL as es}from"url";import Xr from"tty";import ts from"groq-sdk";import{Ollama as rs}from"ollama";import{fetch as os,Agent as ns}from"undici";import ot from"readline";import Qr from"figlet";import ss from"gradient-string";import Zr from"ora";import is from"inquirer-reactive-list-prompt";import{readdir as eo,stat as as,rm as cs}from"node:fs/promises";import ls from"chokidar";import{takeUntil as to,finalize as ro}from"rxjs/operators";var us="aicommit2",oo="2.4.29",ds="A Reactive CLI that generates commit messages for Git and Jujutsu with various AI",ms=["cli","ai","git","jujutsu","jj","vcs","version-control","commit","git-commit","jujutsu-commit","command-line","commandline","aipick","aicommit","aicommits","aicommit2","openai","huggingface","anthropic","claude","claude3","gemini","gemini-pro","generative-ai","mistral","ollama","llama3","llama3.2","llama3.3","gemma","llm","chatgpt","cohere","groq","codestral","perplexity","deepseek","deepseek-r1","pre-commit"],fs="MIT",ps="tak-bro/aicommit2",hs="Hyungtak Jin(@tak-bro)",gs="module",ys=["dist"],ws={aicommit2:"./dist/cli.mjs",aic2:"./dist/cli.mjs"},vs={prepare:"simple-git-hooks",build:"pkgroll --minify",lint:"eslint --cache .","type-check":"tsc",test:"tsx tests",prepack:"pnpm build && clean-pkg-json",prettier:"prettier"},Cs={"@anthropic-ai/sdk":"^0.39.0","@aws-sdk/client-bedrock-runtime":"^3.678.0","@aws-sdk/credential-providers":"^3.678.0","@dqbd/tiktoken":"^1.0.21","@google/generative-ai":"^0.24.1","@inquirer/prompts":"^3.3.2","@pacote/xxhash":"^0.3.2","@types/winston":"^2.4.4",axios:"^1.9.0",chalk:"^5.4.1",chokidar:"^4.0.3",cleye:"^1.3.4","cohere-ai":"^7.19.0","copy-paste":"^1.5.3",figlet:"^1.8.1","formdata-node":"^6.0.3","gradient-string":"^3.0.0","groq-sdk":"^0.7.0",inquirer:"9.2.8","inquirer-reactive-list-prompt":"^1.0.16",ollama:"^0.5.15",openai:"^6.3.0",ora:"^8.2.0",readline:"^1.3.0",rxjs:"^7.8.2",undici:"^7.10.0",uuid:"^9.0.1",winston:"^3.17.0","winston-daily-rotate-file":"^5.0.0"},bs={"@pvtnbr/eslint-config":"^0.33.0","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^12.0.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^10.3.5","@semantic-release/npm":"^12.0.1","@semantic-release/release-notes-generator":"^13.0.0","@types/figlet":"^1.7.0","@types/ini":"^1.3.34","@types/inquirer":"^9.0.8","@types/node":"^18.19.103","@types/uuid":"^9.0.8","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0","clean-pkg-json":"^1.3.0","conventional-changelog-conventionalcommits":"^7.0.2","conventional-commits-parser":"^5.0.0",eslint:"^8.57.1","eslint-config-prettier":"^8.10.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.31.0","eslint-plugin-jsonc":"^2.20.1","eslint-plugin-no-use-extend-native":"^0.5.0","eslint-plugin-promise":"^6.6.0","eslint-plugin-unicorn":"^49.0.0","eslint-plugin-unused-imports":"^3.2.0",execa:"^7.2.0","fs-fixture":"^1.2.0","https-proxy-agent":"^5.0.1",ini:"^3.0.1","lint-staged":"^13.3.0",manten:"^0.7.0",pkgroll:"^1.11.1",prettier:"^3.5.3","semantic-release":"^23.1.1","simple-git-hooks":"^2.13.0",tsx:"^3.14.0",typescript:"^4.9.5","undici-types":"^7.10.0"},Es={extends:["@pvtnbr","prettier"],rules:{"unicorn/no-process-exit":"off"},overrides:[{files:"./src/commands/prepare-commit-msg-hook.ts",rules:{"unicorn/prevent-abbreviations":"off"}}]},Ps={branches:["main"],plugins:[["@semantic-release/commit-analyzer",{preset:"conventionalcommits",releaseRules:[{type:"refactor",release:"patch"},{type:"chore",release:"patch"},{type:"feat",release:"patch"},{scope:"major",release:"major"},{scope:"minor",release:"minor"},{scope:"patch",release:"patch"}]}],"@semantic-release/release-notes-generator",["@semantic-release/changelog",{changelogFile:"CHANGELOG.md"}],"@semantic-release/github",["@semantic-release/git",{assets:["CHANGELOG.md"],message:"chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"}],"@semantic-release/npm"]},$s={name:us,version:oo,description:ds,keywords:ms,license:fs,repository:ps,author:hs,type:gs,files:ys,bin:ws,scripts:vs,"simple-git-hooks":{"pre-commit":"pnpm lint-staged"},"lint-staged":{"*.ts":["prettier --config ./.prettierrc --write","eslint --fix"]},dependencies:Cs,devDependencies:bs,eslintConfig:Es,release:Ps},As=Rn(import.meta.url),H=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ee(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Pe={exports:{}},Tt,no;function ks(){if(no)return Tt;no=1,Tt=o,o.sync=n;var t=X;function e(s,i){var l=i.pathExt!==void 0?i.pathExt:process.env.PATHEXT;if(!l||(l=l.split(";"),l.indexOf("")!==-1))return!0;for(var a=0;a<l.length;a++){var d=l[a].toLowerCase();if(d&&s.substr(-d.length).toLowerCase()===d)return!0}return!1}function r(s,i,l){return!s.isSymbolicLink()&&!s.isFile()?!1:e(i,l)}function o(s,i,l){t.stat(s,function(a,d){l(a,a?!1:r(d,s,i))})}function n(s,i){return r(t.statSync(s),s,i)}return Tt}var jt,so;function Ss(){if(so)return jt;so=1,jt=e,e.sync=r;var t=X;function e(s,i,l){t.stat(s,function(a,d){l(a,a?!1:o(d,i))})}function r(s,i){return o(t.statSync(s),i)}function o(s,i){return s.isFile()&&n(s,i)}function n(s,i){var l=s.mode,a=s.uid,d=s.gid,c=i.uid!==void 0?i.uid:process.getuid&&process.getuid(),u=i.gid!==void 0?i.gid:process.getgid&&process.getgid(),f=parseInt("100",8),p=parseInt("010",8),h=parseInt("001",8),g=f|p,y=l&h||l&p&&d===u||l&f&&a===c||l&g&&c===0;return y}return jt}var nt;process.platform==="win32"||H.TESTING_WINDOWS?nt=ks():nt=Ss();var xs=Bt;Bt.sync=Is;function Bt(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,n){Bt(t,e||{},function(s,i){s?n(s):o(i)})})}nt(t,e||{},function(o,n){o&&(o.code==="EACCES"||e&&e.ignoreErrors)&&(o=null,n=!1),r(o,n)})}function Is(t,e){try{return nt.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}const $e=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",io=x,Ms=$e?";":":",ao=xs,co=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),lo=(t,e)=>{const r=e.colon||Ms,o=t.match(/\//)||$e&&t.match(/\\/)?[""]:[...$e?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],n=$e?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=$e?n.split(r):[""];return $e&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:o,pathExt:s,pathExtExe:n}},uo=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});const{pathEnv:o,pathExt:n,pathExtExe:s}=lo(t,e),i=[],l=d=>new Promise((c,u)=>{if(d===o.length)return e.all&&i.length?c(i):u(co(t));const f=o[d],p=/^".*"$/.test(f)?f.slice(1,-1):f,h=io.join(p,t),g=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+h:h;c(a(g,d,0))}),a=(d,c,u)=>new Promise((f,p)=>{if(u===n.length)return f(l(c+1));const h=n[u];ao(d+h,{pathExt:s},(g,y)=>{if(!g&&y)if(e.all)i.push(d+h);else return f(d+h);return f(a(d,c,u+1))})});return r?l(0).then(d=>r(null,d),r):l(0)},Rs=(t,e)=>{e=e||{};const{pathEnv:r,pathExt:o,pathExtExe:n}=lo(t,e),s=[];for(let i=0;i<r.length;i++){const l=r[i],a=/^".*"$/.test(l)?l.slice(1,-1):l,d=io.join(a,t),c=!a&&/^\.[\\\/]/.test(t)?t.slice(0,2)+d:d;for(let u=0;u<o.length;u++){const f=c+o[u];try{if(ao.sync(f,{pathExt:n}))if(e.all)s.push(f);else return f}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw co(t)};var Ds=uo;uo.sync=Rs;var Gt={exports:{}};const mo=(t={})=>{const e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(o=>o.toUpperCase()==="PATH")||"Path"};Gt.exports=mo,Gt.exports.default=mo;var Os=Gt.exports;const fo=x,Ns=Ds,Fs=Os;function po(t,e){const r=t.options.env||process.env,o=process.cwd(),n=t.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let i;try{i=Ns.sync(t.command,{path:r[Fs({env:r})],pathExt:e?fo.delimiter:void 0})}catch{}finally{s&&process.chdir(o)}return i&&(i=fo.resolve(n?t.options.cwd:"",i)),i}function _s(t){return po(t)||po(t,!0)}var Ls=_s,Ht={};const Ut=/([()\][%!^"`<>&|;, *?])/g;function Ts(t){return t=t.replace(Ut,"^$1"),t}function js(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(Ut,"^$1"),e&&(t=t.replace(Ut,"^$1")),t}Ht.command=Ts,Ht.argument=js;var Bs=/^#!(.*)/;const Gs=Bs;var Hs=(t="")=>{const e=t.match(Gs);if(!e)return null;const[r,o]=e[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?o:o?`${n} ${o}`:n};const zt=X,Us=Hs;function zs(t){const r=Buffer.alloc(150);let o;try{o=zt.openSync(t,"r"),zt.readSync(o,r,0,150,0),zt.closeSync(o)}catch{}return Us(r.toString())}var Ks=zs;const Ws=x,ho=Ls,go=Ht,Ys=Ks,Js=process.platform==="win32",Vs=/\.(?:com|exe)$/i,qs=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Xs(t){t.file=ho(t);const e=t.file&&Ys(t.file);return e?(t.args.unshift(t.file),t.command=e,ho(t)):t.file}function Qs(t){if(!Js)return t;const e=Xs(t),r=!Vs.test(e);if(t.options.forceShell||r){const o=qs.test(e);t.command=Ws.normalize(t.command),t.command=go.command(t.command),t.args=t.args.map(s=>go.argument(s,o));const n=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${n}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Zs(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);const o={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?o:Qs(o)}var ei=Zs;const Kt=process.platform==="win32";function Wt(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function ti(t,e){if(!Kt)return;const r=t.emit;t.emit=function(o,n){if(o==="exit"){const s=yo(n,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function yo(t,e){return Kt&&t===1&&!e.file?Wt(e.original,"spawn"):null}function ri(t,e){return Kt&&t===1&&!e.file?Wt(e.original,"spawnSync"):null}var oi={hookChildProcess:ti,verifyENOENT:yo,verifyENOENTSync:ri,notFoundError:Wt};const wo=Nn,Yt=ei,Jt=oi;function vo(t,e,r){const o=Yt(t,e,r),n=wo.spawn(o.command,o.args,o.options);return Jt.hookChildProcess(n,o),n}function ni(t,e,r){const o=Yt(t,e,r),n=wo.spawnSync(o.command,o.args,o.options);return n.error=n.error||Jt.verifyENOENTSync(n.status,o),n}Pe.exports=vo,Pe.exports.spawn=vo,Pe.exports.sync=ni,Pe.exports._parse=Yt,Pe.exports._enoent=Jt;var si=Pe.exports,ii=Ee(si);function ai(t){const e=typeof t=="string"?`
|
|
2
|
+
import{command as de,cli as Mn}from"cleye";import{createRequire as Rn}from"module";import Dn from"crypto";import X from"fs";import Fe from"os";import x from"path";import{Buffer as Tr}from"node:buffer";import ge from"node:path";import Rt,{ChildProcess as jr,exec as On}from"node:child_process";import ae from"node:process";import Nn,{execSync as Ze,exec as Fn}from"child_process";import{fileURLToPath as Br}from"node:url";import _n,{constants as Gr}from"node:os";import Hr from"assert";import Ur from"events";import{createWriteStream as Ln,createReadStream as Tn,readFileSync as jn}from"node:fs";import Bn from"buffer";import Dt from"stream";import zr,{promisify as Gn}from"util";import{debuglog as Hn,promisify as Un}from"node:util";import et from"inquirer";import{of as Ot,concatMap as F,from as D,map as O,catchError as N,mergeMap as Kr,BehaviorSubject as Wr,ReplaySubject as zn,Subscription as Nt,lastValueFrom as Ft,toArray as _t,filter as Yr,Subject as Lt}from"rxjs";import _ from"fs/promises";import C from"chalk";import Kn from"@anthropic-ai/sdk";import{fromPromise as L}from"rxjs/internal/observable/innerFrom";import{xxh64 as Jr}from"@pacote/xxhash";import U from"winston";import"winston-daily-rotate-file";import Vr from"https";import Wn from"axios";import{CohereClientV2 as Yn}from"cohere-ai";import qr from"openai";import{GoogleGenerativeAI as Jn,HarmCategory as tt,HarmBlockThreshold as rt}from"@google/generative-ai";import Vn from"http";import qn from"net";import Xn from"tls";import Qn,{fileURLToPath as Zn,pathToFileURL as es}from"url";import Xr from"tty";import ts from"groq-sdk";import{Ollama as rs}from"ollama";import{fetch as os,Agent as ns}from"undici";import ot from"readline";import Qr from"figlet";import ss from"gradient-string";import Zr from"ora";import is from"inquirer-reactive-list-prompt";import{readdir as eo,stat as as,rm as cs}from"node:fs/promises";import ls from"chokidar";import{takeUntil as to,finalize as ro}from"rxjs/operators";var us="aicommit2",oo="2.4.30",ds="A Reactive CLI that generates commit messages for Git and Jujutsu with various AI",ms=["cli","ai","git","jujutsu","jj","vcs","version-control","commit","git-commit","jujutsu-commit","command-line","commandline","aipick","aicommit","aicommits","aicommit2","openai","huggingface","anthropic","claude","claude3","gemini","gemini-pro","generative-ai","mistral","ollama","llama3","llama3.2","llama3.3","gemma","llm","chatgpt","cohere","groq","codestral","perplexity","deepseek","deepseek-r1","pre-commit"],fs="MIT",ps="tak-bro/aicommit2",hs="Hyungtak Jin(@tak-bro)",gs="module",ys=["dist"],ws={aicommit2:"./dist/cli.mjs",aic2:"./dist/cli.mjs"},vs={prepare:"simple-git-hooks",build:"pkgroll --minify",lint:"eslint --cache .","type-check":"tsc",test:"tsx tests",prepack:"pnpm build && clean-pkg-json",prettier:"prettier"},Cs={"@anthropic-ai/sdk":"^0.39.0","@aws-sdk/client-bedrock-runtime":"^3.678.0","@aws-sdk/credential-providers":"^3.678.0","@dqbd/tiktoken":"^1.0.21","@google/generative-ai":"^0.24.1","@inquirer/prompts":"^3.3.2","@pacote/xxhash":"^0.3.2","@types/winston":"^2.4.4",axios:"^1.9.0",chalk:"^5.4.1",chokidar:"^4.0.3",cleye:"^1.3.4","cohere-ai":"^7.19.0","copy-paste":"^1.5.3",figlet:"^1.8.1","formdata-node":"^6.0.3","gradient-string":"^3.0.0","groq-sdk":"^0.7.0",inquirer:"9.2.8","inquirer-reactive-list-prompt":"^1.0.16",ollama:"^0.5.15",openai:"^6.3.0",ora:"^8.2.0",readline:"^1.3.0",rxjs:"^7.8.2",undici:"^7.10.0",uuid:"^9.0.1",winston:"^3.17.0","winston-daily-rotate-file":"^5.0.0"},bs={"@pvtnbr/eslint-config":"^0.33.0","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^12.0.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^10.3.5","@semantic-release/npm":"^12.0.1","@semantic-release/release-notes-generator":"^13.0.0","@types/figlet":"^1.7.0","@types/ini":"^1.3.34","@types/inquirer":"^9.0.8","@types/node":"^18.19.103","@types/uuid":"^9.0.8","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0","clean-pkg-json":"^1.3.0","conventional-changelog-conventionalcommits":"^7.0.2","conventional-commits-parser":"^5.0.0",eslint:"^8.57.1","eslint-config-prettier":"^8.10.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.31.0","eslint-plugin-jsonc":"^2.20.1","eslint-plugin-no-use-extend-native":"^0.5.0","eslint-plugin-promise":"^6.6.0","eslint-plugin-unicorn":"^49.0.0","eslint-plugin-unused-imports":"^3.2.0",execa:"^7.2.0","fs-fixture":"^1.2.0","https-proxy-agent":"^5.0.1",ini:"^3.0.1","lint-staged":"^13.3.0",manten:"^0.7.0",pkgroll:"^1.11.1",prettier:"^3.5.3","semantic-release":"^23.1.1","simple-git-hooks":"^2.13.0",tsx:"^3.14.0",typescript:"^4.9.5","undici-types":"^7.10.0"},Es={extends:["@pvtnbr","prettier"],rules:{"unicorn/no-process-exit":"off"},overrides:[{files:"./src/commands/prepare-commit-msg-hook.ts",rules:{"unicorn/prevent-abbreviations":"off"}}]},Ps={branches:["main"],plugins:[["@semantic-release/commit-analyzer",{preset:"conventionalcommits",releaseRules:[{type:"docs",release:!1},{type:"style",release:!1},{type:"test",release:!1},{type:"ci",release:!1},{type:"refactor",release:"patch"},{type:"chore",release:"patch"},{type:"feat",release:"patch"},{scope:"major",release:"major"},{scope:"minor",release:"minor"},{scope:"patch",release:"patch"}]}],"@semantic-release/release-notes-generator",["@semantic-release/changelog",{changelogFile:"CHANGELOG.md"}],"@semantic-release/github",["@semantic-release/git",{assets:["CHANGELOG.md"],message:"chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"}],"@semantic-release/npm"]},$s={name:us,version:oo,description:ds,keywords:ms,license:fs,repository:ps,author:hs,type:gs,files:ys,bin:ws,scripts:vs,"simple-git-hooks":{"pre-commit":"pnpm lint-staged"},"lint-staged":{"*.ts":["prettier --config ./.prettierrc --write","eslint --fix"]},dependencies:Cs,devDependencies:bs,eslintConfig:Es,release:Ps},As=Rn(import.meta.url),H=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ee(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Pe={exports:{}},Tt,no;function ks(){if(no)return Tt;no=1,Tt=o,o.sync=n;var t=X;function e(s,i){var l=i.pathExt!==void 0?i.pathExt:process.env.PATHEXT;if(!l||(l=l.split(";"),l.indexOf("")!==-1))return!0;for(var a=0;a<l.length;a++){var d=l[a].toLowerCase();if(d&&s.substr(-d.length).toLowerCase()===d)return!0}return!1}function r(s,i,l){return!s.isSymbolicLink()&&!s.isFile()?!1:e(i,l)}function o(s,i,l){t.stat(s,function(a,d){l(a,a?!1:r(d,s,i))})}function n(s,i){return r(t.statSync(s),s,i)}return Tt}var jt,so;function Ss(){if(so)return jt;so=1,jt=e,e.sync=r;var t=X;function e(s,i,l){t.stat(s,function(a,d){l(a,a?!1:o(d,i))})}function r(s,i){return o(t.statSync(s),i)}function o(s,i){return s.isFile()&&n(s,i)}function n(s,i){var l=s.mode,a=s.uid,d=s.gid,c=i.uid!==void 0?i.uid:process.getuid&&process.getuid(),u=i.gid!==void 0?i.gid:process.getgid&&process.getgid(),f=parseInt("100",8),p=parseInt("010",8),h=parseInt("001",8),g=f|p,y=l&h||l&p&&d===u||l&f&&a===c||l&g&&c===0;return y}return jt}var nt;process.platform==="win32"||H.TESTING_WINDOWS?nt=ks():nt=Ss();var xs=Bt;Bt.sync=Is;function Bt(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,n){Bt(t,e||{},function(s,i){s?n(s):o(i)})})}nt(t,e||{},function(o,n){o&&(o.code==="EACCES"||e&&e.ignoreErrors)&&(o=null,n=!1),r(o,n)})}function Is(t,e){try{return nt.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}const $e=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",io=x,Ms=$e?";":":",ao=xs,co=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),lo=(t,e)=>{const r=e.colon||Ms,o=t.match(/\//)||$e&&t.match(/\\/)?[""]:[...$e?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],n=$e?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=$e?n.split(r):[""];return $e&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:o,pathExt:s,pathExtExe:n}},uo=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});const{pathEnv:o,pathExt:n,pathExtExe:s}=lo(t,e),i=[],l=d=>new Promise((c,u)=>{if(d===o.length)return e.all&&i.length?c(i):u(co(t));const f=o[d],p=/^".*"$/.test(f)?f.slice(1,-1):f,h=io.join(p,t),g=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+h:h;c(a(g,d,0))}),a=(d,c,u)=>new Promise((f,p)=>{if(u===n.length)return f(l(c+1));const h=n[u];ao(d+h,{pathExt:s},(g,y)=>{if(!g&&y)if(e.all)i.push(d+h);else return f(d+h);return f(a(d,c,u+1))})});return r?l(0).then(d=>r(null,d),r):l(0)},Rs=(t,e)=>{e=e||{};const{pathEnv:r,pathExt:o,pathExtExe:n}=lo(t,e),s=[];for(let i=0;i<r.length;i++){const l=r[i],a=/^".*"$/.test(l)?l.slice(1,-1):l,d=io.join(a,t),c=!a&&/^\.[\\\/]/.test(t)?t.slice(0,2)+d:d;for(let u=0;u<o.length;u++){const f=c+o[u];try{if(ao.sync(f,{pathExt:n}))if(e.all)s.push(f);else return f}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw co(t)};var Ds=uo;uo.sync=Rs;var Gt={exports:{}};const mo=(t={})=>{const e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(o=>o.toUpperCase()==="PATH")||"Path"};Gt.exports=mo,Gt.exports.default=mo;var Os=Gt.exports;const fo=x,Ns=Ds,Fs=Os;function po(t,e){const r=t.options.env||process.env,o=process.cwd(),n=t.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let i;try{i=Ns.sync(t.command,{path:r[Fs({env:r})],pathExt:e?fo.delimiter:void 0})}catch{}finally{s&&process.chdir(o)}return i&&(i=fo.resolve(n?t.options.cwd:"",i)),i}function _s(t){return po(t)||po(t,!0)}var Ls=_s,Ht={};const Ut=/([()\][%!^"`<>&|;, *?])/g;function Ts(t){return t=t.replace(Ut,"^$1"),t}function js(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(Ut,"^$1"),e&&(t=t.replace(Ut,"^$1")),t}Ht.command=Ts,Ht.argument=js;var Bs=/^#!(.*)/;const Gs=Bs;var Hs=(t="")=>{const e=t.match(Gs);if(!e)return null;const[r,o]=e[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?o:o?`${n} ${o}`:n};const zt=X,Us=Hs;function zs(t){const r=Buffer.alloc(150);let o;try{o=zt.openSync(t,"r"),zt.readSync(o,r,0,150,0),zt.closeSync(o)}catch{}return Us(r.toString())}var Ks=zs;const Ws=x,ho=Ls,go=Ht,Ys=Ks,Js=process.platform==="win32",Vs=/\.(?:com|exe)$/i,qs=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Xs(t){t.file=ho(t);const e=t.file&&Ys(t.file);return e?(t.args.unshift(t.file),t.command=e,ho(t)):t.file}function Qs(t){if(!Js)return t;const e=Xs(t),r=!Vs.test(e);if(t.options.forceShell||r){const o=qs.test(e);t.command=Ws.normalize(t.command),t.command=go.command(t.command),t.args=t.args.map(s=>go.argument(s,o));const n=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${n}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Zs(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);const o={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?o:Qs(o)}var ei=Zs;const Kt=process.platform==="win32";function Wt(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function ti(t,e){if(!Kt)return;const r=t.emit;t.emit=function(o,n){if(o==="exit"){const s=yo(n,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function yo(t,e){return Kt&&t===1&&!e.file?Wt(e.original,"spawn"):null}function ri(t,e){return Kt&&t===1&&!e.file?Wt(e.original,"spawnSync"):null}var oi={hookChildProcess:ti,verifyENOENT:yo,verifyENOENTSync:ri,notFoundError:Wt};const wo=Nn,Yt=ei,Jt=oi;function vo(t,e,r){const o=Yt(t,e,r),n=wo.spawn(o.command,o.args,o.options);return Jt.hookChildProcess(n,o),n}function ni(t,e,r){const o=Yt(t,e,r),n=wo.spawnSync(o.command,o.args,o.options);return n.error=n.error||Jt.verifyENOENTSync(n.status,o),n}Pe.exports=vo,Pe.exports.spawn=vo,Pe.exports.sync=ni,Pe.exports._parse=Yt,Pe.exports._enoent=Jt;var si=Pe.exports,ii=Ee(si);function ai(t){const e=typeof t=="string"?`
|
|
3
3
|
`:`
|
|
4
4
|
`.charCodeAt(),r=typeof t=="string"?"\r":"\r".charCodeAt();return t[t.length-1]===e&&(t=t.slice(0,-1)),t[t.length-1]===r&&(t=t.slice(0,-1)),t}function Co(t={}){const{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(o=>o.toUpperCase()==="PATH")||"Path"}const ci=({cwd:t=ae.cwd(),path:e=ae.env[Co()],preferLocal:r=!0,execPath:o=ae.execPath,addExecPath:n=!0}={})=>{const s=t instanceof URL?Br(t):t,i=ge.resolve(s),l=[];return r&&li(l,i),n&&ui(l,o,i),[...l,e].join(ge.delimiter)},li=(t,e)=>{let r;for(;r!==e;)t.push(ge.join(e,"node_modules/.bin")),r=e,e=ge.resolve(e,"..")},ui=(t,e,r)=>{const o=e instanceof URL?Br(e):e;t.push(ge.resolve(r,o,".."))},di=({env:t=ae.env,...e}={})=>{t={...t};const r=Co({env:t});return e.path=t[r],t[r]=ci(e),t},mi=(t,e,r,o)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;const n=Object.getOwnPropertyDescriptor(t,r),s=Object.getOwnPropertyDescriptor(e,r);!fi(n,s)&&o||Object.defineProperty(t,r,s)},fi=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},pi=(t,e)=>{const r=Object.getPrototypeOf(e);r!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,r)},hi=(t,e)=>`/* Wrapped ${t}*/
|
|
5
5
|
${e}`,gi=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yi=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),wi=(t,e,r)=>{const o=r===""?"":`with ${r.trim()}() `,n=hi.bind(null,o,e.toString());Object.defineProperty(n,"name",yi),Object.defineProperty(t,"toString",{...gi,value:n})};function vi(t,e,{ignoreNonConfigurable:r=!1}={}){const{name:o}=t;for(const n of Reflect.ownKeys(e))mi(t,e,n,r);return pi(t,e),wi(t,e,o),t}const st=new WeakMap,bo=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let r,o=0;const n=t.displayName||t.name||"<anonymous>",s=function(...i){if(st.set(s,++o),o===1)r=t.apply(this,i),t=null;else if(e.throw===!0)throw new Error(`Function \`${n}\` can only be called once`);return r};return vi(s,t),st.set(s,o),s};bo.callCount=t=>{if(!st.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return st.get(t)};const Ci=()=>{const t=Po-Eo+1;return Array.from({length:t},bi)},bi=(t,e)=>({name:`SIGRT${e+1}`,number:Eo+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Eo=34,Po=64,Ei=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}],$o=()=>{const t=Ci();return[...Ei,...t].map(Pi)},Pi=({name:t,number:e,description:r,action:o,forced:n=!1,standard:s})=>{const{signals:{[t]:i}}=Gr,l=i!==void 0;return{name:t,number:l?i:e,description:r,supported:l,action:o,forced:n,standard:s}},$i=()=>{const t=$o();return Object.fromEntries(t.map(Ai))},Ai=({name:t,number:e,description:r,supported:o,action:n,forced:s,standard:i})=>[t,{name:t,number:e,description:r,supported:o,action:n,forced:s,standard:i}],ki=$i(),Si=()=>{const t=$o(),e=Po+1,r=Array.from({length:e},(o,n)=>xi(n,t));return Object.assign({},...r)},xi=(t,e)=>{const r=Ii(t,e);if(r===void 0)return{};const{name:o,description:n,supported:s,action:i,forced:l,standard:a}=r;return{[t]:{name:o,number:t,description:n,supported:s,action:i,forced:l,standard:a}}},Ii=(t,e)=>{const r=e.find(({name:o})=>Gr.signals[o]===t);return r!==void 0?r:e.find(o=>o.number===t)};Si();const Mi=({timedOut:t,timeout:e,errorCode:r,signal:o,signalDescription:n,exitCode:s,isCanceled:i})=>t?`timed out after ${e} milliseconds`:i?"was canceled":r!==void 0?`failed with ${r}`:o!==void 0?`was killed with ${o} (${n})`:s!==void 0?`failed with exit code ${s}`:"failed",it=({stdout:t,stderr:e,all:r,error:o,signal:n,exitCode:s,command:i,escapedCommand:l,timedOut:a,isCanceled:d,killed:c,parsed:{options:{timeout:u,cwd:f=ae.cwd()}}})=>{s=s===null?void 0:s,n=n===null?void 0:n;const p=n===void 0?void 0:ki[n].description,h=o&&o.code,y=`Command ${Mi({timedOut:a,timeout:u,errorCode:h,signal:n,signalDescription:p,exitCode:s,isCanceled:d})}: ${i}`,v=Object.prototype.toString.call(o)==="[object Error]",E=v?`${y}
|