alibai 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.ja.md +115 -0
- package/README.ko.md +115 -0
- package/README.md +114 -2
- package/dist/cli.js +212 -0
- package/dist/git.js +148 -0
- package/dist/report.js +44 -0
- package/dist/run.schema.json +100 -0
- package/dist/store.js +296 -0
- package/dist/viewer.js +159 -0
- package/package.json +28 -4
- package/viewer/evidence.js +480 -0
- package/viewer/favicon.svg +6 -0
- package/viewer/fonts/IBMPlexMono-Bold-Latin1.woff2 +0 -0
- package/viewer/fonts/IBMPlexMono-Regular-Latin1.woff2 +0 -0
- package/viewer/fonts/IBMPlexMono-SemiBold-Latin1.woff2 +0 -0
- package/viewer/fonts/IBMPlexSans-Regular-Latin1.woff2 +0 -0
- package/viewer/fonts/IBMPlexSans-SemiBold-Latin1.woff2 +0 -0
- package/viewer/fonts/IBMPlexSansCondensed-Bold-Latin1.woff2 +0 -0
- package/viewer/fonts/OFL.txt +92 -0
- package/viewer/fonts/README.md +9 -0
- package/viewer/index.html +32 -0
- package/viewer/messages.js +365 -0
- package/viewer/tokens.css +66 -0
- package/viewer/viewer.css +775 -0
- package/viewer/viewer.js +708 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kut7728
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.ja.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/logo-dark.png">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/logo-light.png" alt="Alibi for AI(alibai)のロゴ" width="240">
|
|
5
|
+
</picture>
|
|
6
|
+
</h1>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/README.md">English</a> |
|
|
10
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/README.ko.md">한국어</a> |
|
|
11
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/README.ja.md">日本語</a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center"><strong>AI コーディングエージェントのテスト結果を、証拠として記録・共有できます。</strong></p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://www.npmjs.com/package/alibai"><img alt="npm の最新バージョン" src="https://img.shields.io/npm/v/alibai?color=F2C230&labelColor=14171D&label=npm%20%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3"></a>
|
|
18
|
+
<a href="https://github.com/kut7728/alibi-for-ai/releases"><img alt="GitHub の最新リリース" src="https://img.shields.io/github/v/release/kut7728/alibi-for-ai?color=F2C230&labelColor=14171D&label=GitHub%20%E3%83%AA%E3%83%AA%E3%83%BC%E3%82%B9"></a>
|
|
19
|
+
<img alt="Node.js 22 以降が必要" src="https://img.shields.io/badge/node-22%20%E4%BB%A5%E9%99%8D-4A5161?labelColor=14171D&label=Node.js">
|
|
20
|
+
<img alt="ビューアーの対応言語は英語、韓国語、日本語" src="https://img.shields.io/badge/viewer-EN%20%C2%B7%20%ED%95%9C%20%C2%B7%20%E6%97%A5-4A5161?labelColor=14171D&label=%E3%83%93%E3%83%A5%E3%83%BC%E3%82%A2%E3%83%BC">
|
|
21
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/LICENSE"><img alt="MIT ライセンス" src="https://img.shields.io/badge/license-MIT-4A5161?labelColor=14171D&label=%E3%83%A9%E3%82%A4%E3%82%BB%E3%83%B3%E3%82%B9"></a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
<p align="center">
|
|
25
|
+
<img src="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/hero.gif" alt="失敗したカートのテストを開き、スライダーで変更前後の UI を見比べ、クーポン計算の差分を確認してビューアーの言語を切り替えるデモ" width="860">
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
<p align="center">
|
|
29
|
+
<a href="https://kut7728.github.io/alibi-for-ai/?lang=ja#case/8b37f2ac-7506-4585-9d86-4a0e21c44c12">ライブデモ</a> ·
|
|
30
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/docs/assets/hero.mp4?raw=true">デモ動画をダウンロード(MP4)</a>
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
<details>
|
|
34
|
+
<summary>静止画を見る</summary>
|
|
35
|
+
|
|
36
|
+
<picture>
|
|
37
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/still-dark.png">
|
|
38
|
+
<img src="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/still-light.png" alt="カートのテストの変更前後のスクリーンショット、証拠へのコメント、HTML・PDF のエクスポートツールバー" width="860">
|
|
39
|
+
</picture>
|
|
40
|
+
|
|
41
|
+
</details>
|
|
42
|
+
|
|
43
|
+
## Alibai でできること
|
|
44
|
+
|
|
45
|
+
- スライダーで変更前後の UI を見比べ、ロジック検証の入力値、実際の結果、期待値を確認できます。
|
|
46
|
+
- テスト実行ごとにケースを作り、ローカルのブラウザービューアーで確認できます。証拠のタイムラインの上に判定と件数がまとまっており、画面は英語・韓国語・日本語に対応しています。
|
|
47
|
+
- 証拠ごとにコメントを書き、上司やクライアントに必要な証拠をレポートで共有できます。
|
|
48
|
+
|
|
49
|
+
## クイックスタート
|
|
50
|
+
|
|
51
|
+
Node.js 22 以降と Git が必要です。
|
|
52
|
+
|
|
53
|
+
1. **CLI をインストールします。**
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
npm i -g alibai
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
2. **サンプルのロジック検証を記録します。** Git 作業ツリー内で次のコマンドを実行します。
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
alibai run start --title "Cart total rounding"
|
|
63
|
+
alibai check --target calcTotal --input '[0.1,0.2]' --before 0.30000000000000004 --after 0.3 --expected 0.3 --result pass
|
|
64
|
+
alibai run end --verdict pass --summary "The cart total rounds to 0.30."
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
3. **ビューアーを開きます。** **Cart total rounding** を選ぶと、判定と記録した検証結果を確認できます。
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
alibai open
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
<a name="サンプルを試す"></a>
|
|
74
|
+
|
|
75
|
+
既存の記録をグローバルインストールなしで開くには、記録のある Git 作業ツリーで `npx alibai open` を実行します。スクリーンショット付きの記録やローカルビルドについては、[カートのサンプル](https://github.com/kut7728/alibi-for-ai/blob/main/docs/cli.md#try-the-cart-example)と[ソースからのインストール](https://github.com/kut7728/alibi-for-ai/blob/main/docs/cli.md#install-from-source)を参照してください。
|
|
76
|
+
|
|
77
|
+
## エージェントスキルの設定
|
|
78
|
+
|
|
79
|
+
Alibai をインストールしたら、[`SKILL.md`](https://github.com/kut7728/alibi-for-ai/blob/main/skills/alibai/SKILL.md) が入った `skills/alibai` ディレクトリを以下のいずれかにコピーして、エージェントに「alibai でテストして」と依頼します。
|
|
80
|
+
|
|
81
|
+
| エージェント | プロジェクト用 | ユーザー用 |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| [Claude Code](https://code.claude.com/docs/en/skills) | `.claude/skills/` | `~/.claude/skills/` |
|
|
84
|
+
| [Codex](https://learn.chatgpt.com/docs/build-skills) | `.agents/skills/` | `~/.agents/skills/` |
|
|
85
|
+
| [Cursor](https://cursor.com/docs/skills) | `.cursor/skills/` または `.agents/skills/` | `~/.cursor/skills/` または `~/.agents/skills/` |
|
|
86
|
+
|
|
87
|
+
Claude Code では `/alibai` でも呼び出せます。エージェントがスキルを自動検出できない場合は、[手動設定の手順](https://github.com/kut7728/alibi-for-ai/blob/main/docs/cli.md#agent-skill-fallbacks)を参照してください。
|
|
88
|
+
|
|
89
|
+
<a name="ブラウザーで証拠を確認する"></a>
|
|
90
|
+
|
|
91
|
+
## 証拠を共有する
|
|
92
|
+
|
|
93
|
+
1. **証拠にコメントを書きます。** **コメントする** または **⌘/Ctrl+Enter** で投稿し、**⋯** メニューから編集・削除できます。コメントには**太字**、コード、リンクを使えます。
|
|
94
|
+
2. **共有する証拠を選びます。** 各証拠を個別にチェックするか、タイムラインの上にある**すべて選択**を使います。画面下部に固定されたツールバーで選択件数を確認したり、選択を解除したりできます。
|
|
95
|
+
3. **レポートをエクスポートします。** **HTML レポート**で、ケースの概要、選んだスクリーンショット、ロジック検証、コメントが 1 つのファイルにまとまります。**PDF** を選ぶとブラウザーの印刷ダイアログが開き、**PDF として保存**できます。
|
|
96
|
+
|
|
97
|
+
記録そのものを共有するには、`.alibai/runs/` からスクリーンショットとコメントを含む実行ディレクトリを丸ごとコピーします。受け取った側は Git 作業ツリーの同じ場所に置いて `alibai open` で開けます。ライブデモに投稿したコメントは、ご利用のブラウザーに保存されます。
|
|
98
|
+
|
|
99
|
+
<a name="テストの証拠を記録する"></a>
|
|
100
|
+
|
|
101
|
+
## コマンド
|
|
102
|
+
|
|
103
|
+
| コマンド | 用途 |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `alibai run start` | テストケースの記録を開始します。 |
|
|
106
|
+
| `alibai step` | UI の操作とスクリーンショットを記録します。 |
|
|
107
|
+
| `alibai check` | ロジックの検証結果を記録します。 |
|
|
108
|
+
| `alibai run end` | 判定と概要を保存します。 |
|
|
109
|
+
| `alibai list` | 記録したケースを一覧表示します。 |
|
|
110
|
+
| `alibai open` | ローカルビューアーを開きます。 |
|
|
111
|
+
|
|
112
|
+
<a name="記録形式と-git-の比較基準"></a>
|
|
113
|
+
<a name="開発とテスト"></a>
|
|
114
|
+
|
|
115
|
+
使用例、オプション、開発環境の準備方法は [CLI リファレンス](https://github.com/kut7728/alibi-for-ai/blob/main/docs/cli.md)を参照してください。[バージョン 1 のスキーマ](https://github.com/kut7728/alibi-for-ai/blob/main/src/run.schema.json)、Git スナップショット、ハッシュ、ロックについては、[記録形式](https://github.com/kut7728/alibi-for-ai/blob/main/docs/format.md)で説明しています。バージョンごとの変更点は[変更履歴](https://github.com/kut7728/alibi-for-ai/blob/main/CHANGELOG.md)にあります。
|
package/README.ko.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/logo-dark.png">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/logo-light.png" alt="Alibi for AI (alibai) 로고" width="240">
|
|
5
|
+
</picture>
|
|
6
|
+
</h1>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/README.md">English</a> |
|
|
10
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/README.ko.md">한국어</a> |
|
|
11
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/README.ja.md">日本語</a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center"><strong>AI 코딩 에이전트의 테스트 증거를 기록하고 공유하세요.</strong></p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://www.npmjs.com/package/alibai"><img alt="npm 최신 버전" src="https://img.shields.io/npm/v/alibai?color=F2C230&labelColor=14171D&label=npm%20%EB%B2%84%EC%A0%84"></a>
|
|
18
|
+
<a href="https://github.com/kut7728/alibi-for-ai/releases"><img alt="GitHub 최신 릴리스" src="https://img.shields.io/github/v/release/kut7728/alibi-for-ai?color=F2C230&labelColor=14171D&label=GitHub%20%EB%A6%B4%EB%A6%AC%EC%8A%A4"></a>
|
|
19
|
+
<img alt="Node.js 22 이상 필요" src="https://img.shields.io/badge/node-22%20%EC%9D%B4%EC%83%81-4A5161?labelColor=14171D&label=Node.js">
|
|
20
|
+
<img alt="뷰어 지원 언어 영어, 한국어, 일본어" src="https://img.shields.io/badge/viewer-EN%20%C2%B7%20%ED%95%9C%20%C2%B7%20%E6%97%A5-4A5161?labelColor=14171D&label=%EB%B7%B0%EC%96%B4">
|
|
21
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/LICENSE"><img alt="MIT 라이선스" src="https://img.shields.io/badge/license-MIT-4A5161?labelColor=14171D&label=%EB%9D%BC%EC%9D%B4%EC%84%A0%EC%8A%A4"></a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
<p align="center">
|
|
25
|
+
<img src="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/hero.gif" alt="실패한 장바구니 테스트를 열어 UI 전후 슬라이더와 쿠폰 계산 diff를 확인하고 뷰어 언어를 바꾸는 과정" width="860">
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
<p align="center">
|
|
29
|
+
<a href="https://kut7728.github.io/alibi-for-ai/?lang=ko#case/8b37f2ac-7506-4585-9d86-4a0e21c44c12">라이브 데모</a> ·
|
|
30
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/docs/assets/hero.mp4?raw=true">데모 영상 (MP4 다운로드)</a>
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
<details>
|
|
34
|
+
<summary>정지 화면 보기</summary>
|
|
35
|
+
|
|
36
|
+
<picture>
|
|
37
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/still-dark.png">
|
|
38
|
+
<img src="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/still-light.png" alt="장바구니 테스트의 전후 스크린샷, 증거에 달린 댓글, HTML 및 PDF 내보내기 도구 모음" width="860">
|
|
39
|
+
</picture>
|
|
40
|
+
|
|
41
|
+
</details>
|
|
42
|
+
|
|
43
|
+
## Alibai로 할 수 있는 일
|
|
44
|
+
|
|
45
|
+
- 슬라이더로 변경 전후 UI 스크린샷을 비교하고, 로직 검사의 입력값과 실제 결과, 기댓값을 함께 확인합니다.
|
|
46
|
+
- 각 테스트 실행을 하나의 사건으로 기록하고 로컬 브라우저 뷰어에서 확인합니다. 증거 타임라인 위에 판정과 결과 건수가 표시되며, 영어·한국어·일본어를 지원합니다.
|
|
47
|
+
- 개별 증거에 댓글을 달고 팀 리더나 고객에게 필요한 부분만 보고서로 공유합니다.
|
|
48
|
+
|
|
49
|
+
## 빠른 시작
|
|
50
|
+
|
|
51
|
+
Node.js 22 이상과 Git이 필요합니다.
|
|
52
|
+
|
|
53
|
+
1. **CLI를 설치합니다.**
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
npm i -g alibai
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
2. **예제 로직 검사를 기록합니다.** Git 작업 트리에서 다음 명령을 실행합니다.
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
alibai run start --title "Cart total rounding"
|
|
63
|
+
alibai check --target calcTotal --input '[0.1,0.2]' --before 0.30000000000000004 --after 0.3 --expected 0.3 --result pass
|
|
64
|
+
alibai run end --verdict pass --summary "The cart total rounds to 0.30."
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
3. **뷰어를 엽니다.** **Cart total rounding**을 선택하면 판정과 기록한 검사 결과를 확인할 수 있습니다.
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
alibai open
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
<a name="예제-실행"></a>
|
|
74
|
+
|
|
75
|
+
기존 기록을 전역 설치 없이 보려면 해당 Git 작업 트리에서 `npx alibai open`을 실행합니다. 스크린샷이 있는 기록이나 로컬 빌드가 필요하면 [장바구니 예제](https://github.com/kut7728/alibi-for-ai/blob/main/docs/cli.md#try-the-cart-example)와 [소스에서 설치하기](https://github.com/kut7728/alibi-for-ai/blob/main/docs/cli.md#install-from-source)를 참고하세요.
|
|
76
|
+
|
|
77
|
+
## 에이전트 스킬 설치
|
|
78
|
+
|
|
79
|
+
Alibai를 설치한 뒤 [`SKILL.md`](https://github.com/kut7728/alibi-for-ai/blob/main/skills/alibai/SKILL.md)가 들어 있는 `skills/alibai` 디렉터리를 아래 경로 중 한 곳에 복사하고 에이전트에게 “alibai로 테스트해 줘”라고 요청합니다.
|
|
80
|
+
|
|
81
|
+
| 에이전트 | 프로젝트 경로 | 사용자 경로 |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| [Claude Code](https://code.claude.com/docs/en/skills) | `.claude/skills/` | `~/.claude/skills/` |
|
|
84
|
+
| [Codex](https://learn.chatgpt.com/docs/build-skills) | `.agents/skills/` | `~/.agents/skills/` |
|
|
85
|
+
| [Cursor](https://cursor.com/docs/skills) | `.cursor/skills/` 또는 `.agents/skills/` | `~/.cursor/skills/` 또는 `~/.agents/skills/` |
|
|
86
|
+
|
|
87
|
+
Claude Code에서는 `/alibai`로도 실행할 수 있습니다. 에이전트가 스킬을 자동으로 찾지 못하면 [수동 설정 방법](https://github.com/kut7728/alibi-for-ai/blob/main/docs/cli.md#agent-skill-fallbacks)을 참고하세요.
|
|
88
|
+
|
|
89
|
+
<a name="브라우저에서-증거-보기"></a>
|
|
90
|
+
|
|
91
|
+
## 증거 공유
|
|
92
|
+
|
|
93
|
+
1. **증거에 댓글을 답니다.** **댓글 달기** 버튼이나 **⌘/Ctrl+Enter**로 등록하고, **⋯** 메뉴로 수정하거나 삭제합니다. 댓글에는 **굵은 글씨**, 코드, 링크를 넣을 수 있습니다.
|
|
94
|
+
2. **공유할 증거를 선택합니다.** 개별 증거에 체크하거나 타임라인 위에서 **전체 선택**을 누릅니다. 화면 하단에 고정된 도구 모음에서 선택 개수를 확인하거나 선택을 해제할 수 있습니다.
|
|
95
|
+
3. **보고서를 내보냅니다.** **HTML 보고서**는 사건 요약과 선택한 스크린샷, 로직 검사, 댓글을 한 파일에 담습니다. **PDF**를 누르면 브라우저의 인쇄 창에서 **PDF로 저장**을 선택할 수 있습니다.
|
|
96
|
+
|
|
97
|
+
기록 자체를 공유하려면 `.alibai/runs/`에서 스크린샷과 댓글을 포함한 실행 디렉터리 전체를 복사합니다. 받는 사람은 자신의 Git 작업 트리에서 같은 위치에 넣고 `alibai open`으로 열 수 있습니다. 라이브 데모에 작성한 댓글은 사용 중인 브라우저에 저장됩니다.
|
|
98
|
+
|
|
99
|
+
<a name="기록하기"></a>
|
|
100
|
+
|
|
101
|
+
## 명령어
|
|
102
|
+
|
|
103
|
+
| 명령어 | 기능 |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `alibai run start` | 테스트 기록을 시작합니다. |
|
|
106
|
+
| `alibai step` | UI 단계와 스크린샷을 기록합니다. |
|
|
107
|
+
| `alibai check` | 로직 검사 결과를 기록합니다. |
|
|
108
|
+
| `alibai run end` | 판정과 요약을 저장합니다. |
|
|
109
|
+
| `alibai list` | 저장한 기록을 나열합니다. |
|
|
110
|
+
| `alibai open` | 로컬 뷰어를 엽니다. |
|
|
111
|
+
|
|
112
|
+
<a name="포맷과-git-기준"></a>
|
|
113
|
+
<a name="개발-및-테스트"></a>
|
|
114
|
+
|
|
115
|
+
예제, 옵션, 개발 환경 설정은 [CLI 레퍼런스](https://github.com/kut7728/alibi-for-ai/blob/main/docs/cli.md)를 참고하세요. [버전 1 스키마](https://github.com/kut7728/alibi-for-ai/blob/main/src/run.schema.json), Git 스냅샷, 해시와 잠금은 [기록 형식 문서](https://github.com/kut7728/alibi-for-ai/blob/main/docs/format.md)에서 설명합니다. 버전별 변경 사항은 [변경 이력](https://github.com/kut7728/alibi-for-ai/blob/main/CHANGELOG.md)에서 볼 수 있습니다.
|
package/README.md
CHANGED
|
@@ -1,3 +1,115 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/logo-dark.png">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/logo-light.png" alt="Alibi for AI (alibai) logo" width="240">
|
|
5
|
+
</picture>
|
|
6
|
+
</h1>
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/README.md">English</a> |
|
|
10
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/README.ko.md">한국어</a> |
|
|
11
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/README.ja.md">日本語</a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center"><strong>Record and share test evidence from your AI coding agent.</strong></p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://www.npmjs.com/package/alibai"><img alt="Latest npm version" src="https://img.shields.io/npm/v/alibai?color=F2C230&labelColor=14171D&label=npm%20version"></a>
|
|
18
|
+
<a href="https://github.com/kut7728/alibi-for-ai/releases"><img alt="Latest GitHub release" src="https://img.shields.io/github/v/release/kut7728/alibi-for-ai?color=F2C230&labelColor=14171D&label=GitHub%20release"></a>
|
|
19
|
+
<img alt="Requires Node.js 22 or later" src="https://img.shields.io/badge/node-%E2%89%A522-4A5161?labelColor=14171D&label=Node.js">
|
|
20
|
+
<img alt="Viewer languages are English, Korean, and Japanese" src="https://img.shields.io/badge/viewer-EN%20%C2%B7%20%ED%95%9C%20%C2%B7%20%E6%97%A5-4A5161?labelColor=14171D&label=Viewer">
|
|
21
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/LICENSE"><img alt="MIT license" src="https://img.shields.io/badge/license-MIT-4A5161?labelColor=14171D&label=License"></a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
<p align="center">
|
|
25
|
+
<img src="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/hero.gif" alt="Demo of a failing cart test showing the before-and-after screenshot slider, a coupon calculation diff, and the viewer language switcher" width="860">
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
<p align="center">
|
|
29
|
+
<a href="https://kut7728.github.io/alibi-for-ai/?lang=en#case/8b37f2ac-7506-4585-9d86-4a0e21c44c12">Live demo</a> ·
|
|
30
|
+
<a href="https://github.com/kut7728/alibi-for-ai/blob/main/docs/assets/hero.mp4?raw=true">Download demo video (MP4)</a>
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
<details>
|
|
34
|
+
<summary>View a still image</summary>
|
|
35
|
+
|
|
36
|
+
<picture>
|
|
37
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/still-dark.png">
|
|
38
|
+
<img src="https://raw.githubusercontent.com/kut7728/alibi-for-ai/main/docs/assets/still-light.png" alt="Cart test evidence with before-and-after screenshots, an exhibit comment, and the HTML and PDF export toolbar" width="860">
|
|
39
|
+
</picture>
|
|
40
|
+
|
|
41
|
+
</details>
|
|
42
|
+
|
|
43
|
+
## Why Alibai?
|
|
44
|
+
|
|
45
|
+
- Compare before-and-after UI screenshots with a slider. Review logic checks alongside their inputs, results, and expected values.
|
|
46
|
+
- Review each test run as a case in a local-only browser viewer with English, Korean, and Japanese interfaces. Its summary groups the verdict and counts above the evidence timeline.
|
|
47
|
+
- Comment on individual exhibits and send managers or clients a report containing the evidence they need.
|
|
48
|
+
|
|
49
|
+
## Quick start
|
|
50
|
+
|
|
51
|
+
You’ll need Node.js 22 or later and Git.
|
|
52
|
+
|
|
53
|
+
1. **Install the CLI.**
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
npm i -g alibai
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
2. **Record a sample logic check.** From any Git working tree, run the following commands.
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
alibai run start --title "Cart total rounding"
|
|
63
|
+
alibai check --target calcTotal --input '[0.1,0.2]' --before 0.30000000000000004 --after 0.3 --expected 0.3 --result pass
|
|
64
|
+
alibai run end --verdict pass --summary "The cart total rounds to 0.30."
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
3. **Open the viewer.** Select **Cart total rounding** to see the verdict and the recorded check.
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
alibai open
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
<a name="try-the-example"></a>
|
|
74
|
+
|
|
75
|
+
To open an existing case without a global install, run `npx alibai open` in its Git working tree. For a case with screenshots or a local build, see the [cart example](https://github.com/kut7728/alibi-for-ai/blob/main/docs/cli.md#try-the-cart-example) and [source installation](https://github.com/kut7728/alibi-for-ai/blob/main/docs/cli.md#install-from-source).
|
|
76
|
+
|
|
77
|
+
## Set up the agent skill
|
|
78
|
+
|
|
79
|
+
After installing Alibai, copy the `skills/alibai` directory containing [`SKILL.md`](https://github.com/kut7728/alibi-for-ai/blob/main/skills/alibai/SKILL.md) to one of these locations, then ask your agent to “test this with alibai.”
|
|
80
|
+
|
|
81
|
+
| Agent | Project directory | User directory |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| [Claude Code](https://code.claude.com/docs/en/skills) | `.claude/skills/` | `~/.claude/skills/` |
|
|
84
|
+
| [Codex](https://learn.chatgpt.com/docs/build-skills) | `.agents/skills/` | `~/.agents/skills/` |
|
|
85
|
+
| [Cursor](https://cursor.com/docs/skills) | `.cursor/skills/` or `.agents/skills/` | `~/.cursor/skills/` or `~/.agents/skills/` |
|
|
86
|
+
|
|
87
|
+
Claude Code also accepts `/alibai`. If your agent cannot discover the skill, see [manual setup](https://github.com/kut7728/alibi-for-ai/blob/main/docs/cli.md#agent-skill-fallbacks).
|
|
88
|
+
|
|
89
|
+
<a name="review-evidence-in-the-browser"></a>
|
|
90
|
+
|
|
91
|
+
## Share evidence
|
|
92
|
+
|
|
93
|
+
1. **Comment on an exhibit.** Use **Comment** or **⌘/Ctrl+Enter** to post. The **⋯** menu lets you edit or delete comments. Comments support **bold**, code, and links.
|
|
94
|
+
2. **Choose what to share.** Check individual exhibits or use **Select all** above the timeline. The sticky toolbar at the bottom shows the selection count and lets you clear it.
|
|
95
|
+
3. **Export the report.** Choose **HTML report** to download a self-contained file with the case summary, selected screenshots, logic checks, and comments. Choose **PDF**, then **Save as PDF** in the browser’s print dialog.
|
|
96
|
+
|
|
97
|
+
To share the case itself, copy its whole directory from `.alibai/runs/`, including screenshots and comments. The recipient can place it in the same location in their Git working tree and run `alibai open`. Comments you write in the live demo stay in your browser.
|
|
98
|
+
|
|
99
|
+
<a name="record-test-evidence"></a>
|
|
100
|
+
|
|
101
|
+
## Commands
|
|
102
|
+
|
|
103
|
+
| Command | Purpose |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `alibai run start` | Start a test case. |
|
|
106
|
+
| `alibai step` | Record a UI step with screenshots. |
|
|
107
|
+
| `alibai check` | Record a logic check. |
|
|
108
|
+
| `alibai run end` | Save the verdict and summary. |
|
|
109
|
+
| `alibai list` | List recorded cases. |
|
|
110
|
+
| `alibai open` | Open the local viewer. |
|
|
111
|
+
|
|
112
|
+
<a name="evidence-format-and-git-baseline"></a>
|
|
113
|
+
<a name="development-and-testing"></a>
|
|
114
|
+
|
|
115
|
+
See the [CLI reference](https://github.com/kut7728/alibi-for-ai/blob/main/docs/cli.md) for examples, options, and development setup. See the [run format](https://github.com/kut7728/alibi-for-ai/blob/main/docs/format.md) for the [version 1 schema](https://github.com/kut7728/alibi-for-ai/blob/main/src/run.schema.json), Git snapshots, hashing, and locking. Changes by version are in the [changelog](https://github.com/kut7728/alibi-for-ai/blob/main/CHANGELOG.md).
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const node_util_1 = require("node:util");
|
|
7
|
+
const git_1 = require("./git");
|
|
8
|
+
const report_1 = require("./report");
|
|
9
|
+
const store_1 = require("./store");
|
|
10
|
+
const viewer_1 = require("./viewer");
|
|
11
|
+
const flagNames = {
|
|
12
|
+
"run start": ["title", "platform", "agent", "base"],
|
|
13
|
+
step: ["run", "action", "before", "after", "note", "result"],
|
|
14
|
+
check: ["run", "target", "input", "before", "after", "expected", "error", "result"],
|
|
15
|
+
"run end": ["run", "verdict", "summary"],
|
|
16
|
+
list: [],
|
|
17
|
+
open: ["lang"],
|
|
18
|
+
};
|
|
19
|
+
const usage = `Usage
|
|
20
|
+
alibai run start --title <title> [--platform <platform>] [--agent <name>] [--base <ref>]
|
|
21
|
+
alibai step --action <action> [--before <file>] [--after <file>] [--note <text>] [--result <result>] [--run <id>]
|
|
22
|
+
alibai check --target <target> --input <json> --before <json> [--after <json>]
|
|
23
|
+
[--expected <json>] [--error <text>] [--result <result>] [--run <id>]
|
|
24
|
+
alibai run end --verdict <result> [--summary <text>] [--run <id>]
|
|
25
|
+
alibai list
|
|
26
|
+
alibai open [--lang <en|ko|ja>]
|
|
27
|
+
|
|
28
|
+
Provide at least one PNG, JPG, JPEG, or WebP screenshot for step.
|
|
29
|
+
Provide --after for check unless recording --error. Results and verdicts are pass, fail, or info.
|
|
30
|
+
Add --json to any command for machine-readable output.`;
|
|
31
|
+
const platforms = ["flutter", "ios", "android", "web"];
|
|
32
|
+
const results = ["pass", "fail", "info"];
|
|
33
|
+
const options = {
|
|
34
|
+
...Object.fromEntries(Object.values(flagNames).flat().map((flag) => [flag, { type: "string" }])),
|
|
35
|
+
json: { type: "boolean" },
|
|
36
|
+
help: { type: "boolean", short: "h" },
|
|
37
|
+
};
|
|
38
|
+
function textFlag(value, flag) {
|
|
39
|
+
const trimmed = value?.trim();
|
|
40
|
+
if (!trimmed)
|
|
41
|
+
throw new Error(`--${flag} requires a non-empty value.`);
|
|
42
|
+
return trimmed;
|
|
43
|
+
}
|
|
44
|
+
function choice(value, flag, allowed) {
|
|
45
|
+
const selected = allowed.find((option) => option === value);
|
|
46
|
+
if (!selected)
|
|
47
|
+
throw new Error(`--${flag} must be one of ${allowed.join(", ")}.`);
|
|
48
|
+
return selected;
|
|
49
|
+
}
|
|
50
|
+
const args = process.argv.slice(2);
|
|
51
|
+
const terminator = args.indexOf("--");
|
|
52
|
+
const trailing = terminator === -1 ? [] : args.slice(terminator + 1);
|
|
53
|
+
const { values, positionals } = (0, node_util_1.parseArgs)({
|
|
54
|
+
args: terminator === -1 ? args : args.slice(0, terminator),
|
|
55
|
+
options,
|
|
56
|
+
strict: false,
|
|
57
|
+
allowPositionals: true,
|
|
58
|
+
});
|
|
59
|
+
const json = values.json === true;
|
|
60
|
+
async function main() {
|
|
61
|
+
for (const flag of ["json", "help"]) {
|
|
62
|
+
if (typeof values[flag] === "string")
|
|
63
|
+
throw new Error(`--${flag} does not take a value.`);
|
|
64
|
+
}
|
|
65
|
+
const optionNames = Object.keys(values).filter((flag) => flag !== "json" && flag !== "help");
|
|
66
|
+
if (values.help === true || (positionals.length === 0 && trailing.length === 0 && optionNames.length === 0)) {
|
|
67
|
+
console.log(json ? JSON.stringify({ usage }) : usage);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const [first, second] = positionals;
|
|
71
|
+
const command = first === "run" ? `run ${second ?? ""}` : first;
|
|
72
|
+
if (!command || !Object.hasOwn(flagNames, command)) {
|
|
73
|
+
throw new Error(`Unknown command "${command?.trim()}". See alibai --help.`);
|
|
74
|
+
}
|
|
75
|
+
const allowed = flagNames[command];
|
|
76
|
+
for (const flag of optionNames) {
|
|
77
|
+
if (!allowed.includes(flag))
|
|
78
|
+
throw new Error(`Unknown option '--${flag}'.`);
|
|
79
|
+
if (typeof values[flag] !== "string")
|
|
80
|
+
throw new Error(`--${flag} requires a value.`);
|
|
81
|
+
}
|
|
82
|
+
const unexpected = positionals[first === "run" ? 2 : 1] ?? trailing[0];
|
|
83
|
+
if (unexpected !== undefined)
|
|
84
|
+
throw new Error(`Unexpected argument "${unexpected}".`);
|
|
85
|
+
const flags = values;
|
|
86
|
+
if (command === "open") {
|
|
87
|
+
const lang = flags.lang === undefined ? undefined : choice(flags.lang, "lang", ["en", "ko", "ja"]);
|
|
88
|
+
await (0, viewer_1.openViewer)((0, git_1.gitRoot)(), json, lang);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const root = (0, git_1.gitRoot)();
|
|
92
|
+
const store = new store_1.RunStore(root);
|
|
93
|
+
const printMutation = ({ path, run }) => {
|
|
94
|
+
console.log(json ? JSON.stringify({ id: run.id, path }) : `${run.id}\t${path}`);
|
|
95
|
+
};
|
|
96
|
+
const warnInvalid = (invalidRuns) => {
|
|
97
|
+
for (const { path, error } of invalidRuns)
|
|
98
|
+
console.error(`alibai: Skipping invalid run at ${path} (${error}).`);
|
|
99
|
+
};
|
|
100
|
+
const selectRun = async () => {
|
|
101
|
+
if (flags.run !== undefined)
|
|
102
|
+
return flags.run;
|
|
103
|
+
const { runs, invalidRuns } = await store.list();
|
|
104
|
+
warnInvalid(invalidRuns);
|
|
105
|
+
const selected = runs.find(({ run }) => run.verdict === undefined);
|
|
106
|
+
if (!selected)
|
|
107
|
+
throw new Error("No open run. Start one with alibai run start.");
|
|
108
|
+
return selected.run.id;
|
|
109
|
+
};
|
|
110
|
+
switch (command) {
|
|
111
|
+
case "run start": {
|
|
112
|
+
const title = textFlag(flags.title, "title");
|
|
113
|
+
const platform = choice(flags.platform ?? "web", "platform", platforms);
|
|
114
|
+
const agent = flags.agent === undefined ? undefined : textFlag(flags.agent, "agent");
|
|
115
|
+
const base = flags.base === undefined ? undefined : textFlag(flags.base, "base");
|
|
116
|
+
printMutation(await store.start({
|
|
117
|
+
formatVersion: 1,
|
|
118
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
119
|
+
title,
|
|
120
|
+
createdAt: new Date().toISOString(),
|
|
121
|
+
platform,
|
|
122
|
+
git: (0, git_1.gitMetadata)(root, base),
|
|
123
|
+
agent,
|
|
124
|
+
steps: [],
|
|
125
|
+
checks: [],
|
|
126
|
+
}));
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
case "step": {
|
|
130
|
+
const action = textFlag(flags.action, "action");
|
|
131
|
+
const result = choice(flags.result ?? "info", "result", results);
|
|
132
|
+
if (flags.before === undefined && flags.after === undefined) {
|
|
133
|
+
throw new Error("Provide at least one screenshot with --before or --after.");
|
|
134
|
+
}
|
|
135
|
+
for (const source of [flags.before, flags.after]) {
|
|
136
|
+
if (source !== undefined && !/^\.(?:png|jpe?g|webp)$/i.test((0, node_path_1.extname)(source))) {
|
|
137
|
+
throw new Error(`Screenshot must use a PNG, JPG, JPEG, or WebP extension: ${source}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
printMutation(await store.mutate(await selectRun(), async (run, screenshot) => {
|
|
141
|
+
const step = {
|
|
142
|
+
id: (0, node_crypto_1.randomUUID)(), order: run.steps.length + 1, action, createdAt: new Date().toISOString(),
|
|
143
|
+
note: flags.note ?? "", result,
|
|
144
|
+
};
|
|
145
|
+
if (flags.before !== undefined)
|
|
146
|
+
step.before = await screenshot(flags.before, `${step.id}-before`);
|
|
147
|
+
if (flags.after !== undefined)
|
|
148
|
+
step.after = await screenshot(flags.after, `${step.id}-after`);
|
|
149
|
+
run.steps.push(step);
|
|
150
|
+
}));
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case "check": {
|
|
154
|
+
const target = textFlag(flags.target, "target");
|
|
155
|
+
const input = (0, report_1.parseJson)(textFlag(flags.input, "input"), "--input");
|
|
156
|
+
const before = (0, report_1.parseJson)(textFlag(flags.before, "before"), "--before");
|
|
157
|
+
const expected = flags.expected === undefined ? undefined : (0, report_1.parseJson)(flags.expected, "--expected");
|
|
158
|
+
const error = flags.error === undefined ? undefined : textFlag(flags.error, "error");
|
|
159
|
+
if (flags.after === undefined && error === undefined) {
|
|
160
|
+
throw new Error("Provide --after with a JSON value or --error for an exception.");
|
|
161
|
+
}
|
|
162
|
+
const outcome = flags.after === undefined && error !== undefined
|
|
163
|
+
? { error }
|
|
164
|
+
: { after: (0, report_1.parseJson)(textFlag(flags.after, "after"), "--after"), error };
|
|
165
|
+
const result = choice(flags.result ?? "info", "result", results);
|
|
166
|
+
printMutation(await store.mutate(await selectRun(), async (run) => {
|
|
167
|
+
run.checks.push({ id: (0, node_crypto_1.randomUUID)(), target, createdAt: new Date().toISOString(), input, before, expected, result, ...outcome });
|
|
168
|
+
}));
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
case "run end": {
|
|
172
|
+
const verdict = choice(flags.verdict, "verdict", results);
|
|
173
|
+
const summary = flags.summary ?? `Verdict recorded as ${verdict}.`;
|
|
174
|
+
if (!summary.trim() || /[\r\n\u2028\u2029]/u.test(summary)) {
|
|
175
|
+
throw new Error("--summary requires one non-empty line.");
|
|
176
|
+
}
|
|
177
|
+
printMutation(await store.mutate(await selectRun(), async (run) => {
|
|
178
|
+
run.verdict = verdict;
|
|
179
|
+
run.summary = summary.trim();
|
|
180
|
+
run.endedAt = new Date().toISOString();
|
|
181
|
+
run.git.endChanges = (0, git_1.gitChanges)(root).changes;
|
|
182
|
+
}));
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
case "list": {
|
|
186
|
+
const { runs: stored, invalidRuns } = await store.list();
|
|
187
|
+
const runs = stored.map(({ path, run }) => ({
|
|
188
|
+
id: run.id,
|
|
189
|
+
path,
|
|
190
|
+
title: run.title,
|
|
191
|
+
createdAt: run.createdAt,
|
|
192
|
+
platform: run.platform,
|
|
193
|
+
verdict: run.verdict ?? null,
|
|
194
|
+
}));
|
|
195
|
+
if (json)
|
|
196
|
+
console.log(JSON.stringify({ runs, invalidRuns }));
|
|
197
|
+
else {
|
|
198
|
+
warnInvalid(invalidRuns);
|
|
199
|
+
if (runs.length === 0)
|
|
200
|
+
console.log("No runs recorded.");
|
|
201
|
+
else
|
|
202
|
+
for (const run of runs)
|
|
203
|
+
console.log(`${run.id}\t${run.verdict ?? "open"}\t${run.title}\t${run.path}`);
|
|
204
|
+
}
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
main().catch((error) => {
|
|
210
|
+
console.error(json ? JSON.stringify({ error: error.message }) : `alibai: ${error.message}`);
|
|
211
|
+
process.exitCode = 1;
|
|
212
|
+
});
|