@kousaku-maron/diffshape 0.0.0-stage → 0.1.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.md +56 -2
- package/dist/bin/chunk-OC4BEU5P.js +2316 -0
- package/dist/bin/dbshape.js +7 -0
- package/dist/bin/depshape.js +7 -0
- package/dist/bin/diffshape.js +7 -0
- package/dist/bin/ui/assets/index-DZnwjoaO.js +99 -0
- package/dist/bin/ui/assets/index-EuEspiv3.css +1 -0
- package/dist/bin/ui/index.html +13 -0
- package/package.json +74 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kousaku-maron
|
|
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.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
1
|
-
#
|
|
1
|
+
# diffshape
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
git の差分の「形」を、push 前のローカルレビューで確かめるためのアプリです。差分を2つの見方で、ブラウザに並べて見せます。
|
|
4
|
+
|
|
5
|
+
- **依存**([depshape](https://github.com/kousaku-maron/diffshape/tree/main/packages/depshape)): フォルダ・ファイル間の依存関係がどう変わったかを、既存の構造と並べて見せます(Go / TypeScript / JavaScript)
|
|
6
|
+
- **DB**([dbshape](https://github.com/kousaku-maron/diffshape/tree/main/packages/dbshape)): PostgreSQL のスキーマ(テーブル・カラム・制約・外部キー・CHECK の値)がどう変わったかを、ER 図の差分で見せます
|
|
7
|
+
|
|
8
|
+
どちらも git から直接ファイルを読みます。ビルドツールのインストール、DB への接続、外部サービスは要りません。事実だけを見せ、判断はレビューする人が行います。
|
|
9
|
+
|
|
10
|
+
## 使い方
|
|
11
|
+
|
|
12
|
+
解析したいリポジトリの中で実行します(Node.js 20 以上と git が必要です)。
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx @kousaku-maron/diffshape . main --merge-base
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
よく使うなら `npm install -g @kousaku-maron/diffshape` で入れておくと、次の3つのコマンドが使えます。
|
|
19
|
+
|
|
20
|
+
| コマンド | 開くもの |
|
|
21
|
+
|---|---|
|
|
22
|
+
| `diffshape` | 依存と DB の両方(左のアイコンバーで切り替え) |
|
|
23
|
+
| `depshape` | 依存だけ(`--json` で解析結果を標準出力へ) |
|
|
24
|
+
| `dbshape` | DB だけ(`--text` で要約、`--json` で差分を標準出力へ) |
|
|
25
|
+
|
|
26
|
+
比較の指定は3つとも同じです。
|
|
27
|
+
|
|
28
|
+
| 例 | 比較内容 |
|
|
29
|
+
|---|---|
|
|
30
|
+
| `diffshape` | 未コミットの変更すべて vs HEAD |
|
|
31
|
+
| `diffshape . main --merge-base` | 現在の作業ディレクトリ vs main からの分岐点(GitHub の PR と同じ見え方) |
|
|
32
|
+
| `diffshape @ main --merge-base` | HEAD(コミット済み)vs main からの分岐点 |
|
|
33
|
+
| `diffshape abc1234` | そのコミット単体の変更 |
|
|
34
|
+
| `diffshape staged` / `diffshape working` | ステージ済み / 未ステージの変更のみ |
|
|
35
|
+
|
|
36
|
+
オプション: `--merge-base`、`--schema <glob>`(スキーマの SQL ファイル。省略時はリポジトリ内のすべての `atlas.hcl` の `src` を読みます。DB が複数あるときは `--schema billing=services/billing/**/*.sql` のように名前を付けます)、`--only <dep|db>`、`--port <n>`(デフォルト 4977、使用中なら +1)、`--host`、`--no-open`
|
|
37
|
+
|
|
38
|
+
サーバーはデフォルトで `127.0.0.1` だけで待ち受け、`localhost` / `127.0.0.1` 宛て以外のリクエストは拒否します。`--host 0.0.0.0` などを指定すると、同じネットワークの他の端末からリポジトリの構成とスキーマが見えるので注意してください。
|
|
39
|
+
|
|
40
|
+
## 画面
|
|
41
|
+
|
|
42
|
+
- **左のアイコンバー**: 「依存」と「DB」を切り替えます。アイコンの数字は変更の件数、青い点は未対応のコメントがあることを示します。読むものがないモジュール(SQL ファイルがないリポジトリの DB など)は薄く表示します。表示中のモジュールは URL(`#dep` / `#db`)に残るので、再読み込みしても同じ画面が開きます
|
|
43
|
+
- **ヘッダー**: 比較の対象、「AI 用にコピー」、「再読み込み」。切り替えても、各モジュールで開いていた箱・選んだテーブル・書きかけのコメントはそのまま残ります
|
|
44
|
+
- **AI 用にコピー**: 両方のモジュールの未対応のコメントを、1つのプロンプトにまとめてコピーします(依存は import の状態と既存の依存のパターン、DB は SQL ファイルの定義位置つき)。Claude Code / Codex などにそのまま貼れます
|
|
45
|
+
- **再読み込み**: AI がファイルを書き換えたあとに、両方を解析し直します。開いていた状態はそのまま残ります
|
|
46
|
+
- **DB が複数ある monorepo**: DB モジュールの中で DB を切り替えます(`atlas.hcl` ごと、または名前付きの `--schema` ごと)
|
|
47
|
+
|
|
48
|
+
それぞれの画面の見方は、[depshape](https://github.com/kousaku-maron/diffshape/tree/main/packages/depshape) と [dbshape](https://github.com/kousaku-maron/diffshape/tree/main/packages/dbshape) の README を見てください。
|
|
49
|
+
|
|
50
|
+
## ライセンス
|
|
51
|
+
|
|
52
|
+
MIT([LICENSE](LICENSE))。次のものを同梱・利用しています。
|
|
53
|
+
|
|
54
|
+
- [React](https://react.dev/)(MIT)
|
|
55
|
+
- [dagre](https://github.com/dagrejs/dagre)(MIT): ER 図の配置
|
|
56
|
+
- [libpg-query](https://github.com/constructive-io/libpg-query-node)(MIT): SQL の解析
|
|
57
|
+
- [Feather](https://github.com/feathericons/feather)(MIT): アイコンの線画
|