@kalbi/zeicheck 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 +218 -0
- package/data/useful-life-table.json +45 -0
- package/dist/chunk-LZZKQ7B2.js +994 -0
- package/dist/chunk-LZZKQ7B2.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +131 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +259 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025
|
|
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
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# zeicheck
|
|
2
|
+
|
|
3
|
+
e-Tax (xtx) 確定申告データの整合性チェッカー。ESLintのような使い心地で、青色申告・個人事業主向けの税務申告データをルールベースで検証します。
|
|
4
|
+
|
|
5
|
+
## インストール
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g zeicheck
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使い方
|
|
12
|
+
|
|
13
|
+
### 基本的な検証
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
zeicheck check 申告データ.xtx
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### 出力例
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
/path/to/申告データ.xtx
|
|
23
|
+
|
|
24
|
+
balance-sheet/equation error 期末残高: 資産合計(3,500,000) ≠ 負債合計(0) + 資本合計(3,300,000)
|
|
25
|
+
income-statement/pl-chain error 経費合計(1,850,000) ≠ 各経費の合算(1,800,000)
|
|
26
|
+
deductions/blue-deduction-cap warning 青色申告特別控除額(650,000) > 控除前所得(500,000)
|
|
27
|
+
|
|
28
|
+
✖ 3 件の問題 (2 errors, 1 warning)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### コマンド
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# xtxファイルの検証
|
|
35
|
+
zeicheck check <file.xtx>
|
|
36
|
+
-f, --format <stylish|json> # 出力形式(デフォルト: stylish)
|
|
37
|
+
-c, --config <path> # 設定ファイルパス
|
|
38
|
+
--prior-year <file.xtx> # 前年ファイル(継続性チェック用)
|
|
39
|
+
--severity <error|warning|info> # 最低表示レベル
|
|
40
|
+
--no-color # カラー出力を無効化
|
|
41
|
+
|
|
42
|
+
# ルール一覧の表示
|
|
43
|
+
zeicheck list-rules
|
|
44
|
+
|
|
45
|
+
# ルールの詳細説明
|
|
46
|
+
zeicheck explain <rule-id>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## ルール一覧
|
|
50
|
+
|
|
51
|
+
### 貸借対照表 (Balance Sheet)
|
|
52
|
+
|
|
53
|
+
| ルールID | 説明 | 重要度 |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| `balance-sheet/equation` | 資産合計 = 負債合計 + 資本合計 | error |
|
|
56
|
+
| `balance-sheet/opening-owner-equity` | 事業主貸/借の期首残高が0 | error |
|
|
57
|
+
| `balance-sheet/motoire-kin-formula` | 元入金繰越計算の検証 | error |
|
|
58
|
+
| `balance-sheet/non-negative-cash` | 現金残高が負でないか | warning |
|
|
59
|
+
|
|
60
|
+
### 損益計算書 (Income Statement)
|
|
61
|
+
|
|
62
|
+
| ルールID | 説明 | 重要度 |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| `income-statement/pl-chain` | P/L各段階の計算検証 | error |
|
|
65
|
+
| `income-statement/expense-total` | 経費合計の一致 | error |
|
|
66
|
+
| `income-statement/cogs` | 売上原価の計算検証 | error |
|
|
67
|
+
|
|
68
|
+
### 帳票間整合性 (Cross-Statement)
|
|
69
|
+
|
|
70
|
+
| ルールID | 説明 | 重要度 |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| `cross-statement/bs-pl-bridge` | B/S⇔P/L所得金額一致 | error |
|
|
73
|
+
| `cross-statement/decision-to-return` | 決算書→申告書の転記一致 | error |
|
|
74
|
+
| `cross-statement/depreciation-sum` | 減価償却合計の一致 | error |
|
|
75
|
+
|
|
76
|
+
### 控除 (Deductions)
|
|
77
|
+
|
|
78
|
+
| ルールID | 説明 | 重要度 |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| `deductions/blue-deduction-cap` | 青色控除 ≦ 控除前所得 | warning |
|
|
81
|
+
| `deductions/blue-deduction-eligibility` | 65万円控除の適用要件 | info |
|
|
82
|
+
|
|
83
|
+
### 減価償却 (Depreciation)
|
|
84
|
+
|
|
85
|
+
| ルールID | 説明 | 重要度 |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| `depreciation/useful-life-rates` | 法定耐用年数テーブル照合 | warning |
|
|
88
|
+
| `depreciation/small-asset-threshold` | 少額資産の閾値チェック | warning |
|
|
89
|
+
|
|
90
|
+
### 継続性 (Continuity)
|
|
91
|
+
|
|
92
|
+
| ルールID | 説明 | 重要度 |
|
|
93
|
+
|---|---|---|
|
|
94
|
+
| `continuity/opening-closing-match` | 期首=前年期末の一致 | error |
|
|
95
|
+
| `continuity/year-over-year-change` | 前年比大幅変動の警告 | warning |
|
|
96
|
+
|
|
97
|
+
### 家事按分 (Home Office)
|
|
98
|
+
|
|
99
|
+
| ルールID | 説明 | 重要度 |
|
|
100
|
+
|---|---|---|
|
|
101
|
+
| `home-office/reasonable-ratio` | 家事按分率の妥当性 | warning |
|
|
102
|
+
|
|
103
|
+
## 設定
|
|
104
|
+
|
|
105
|
+
プロジェクトルートに `.zeicheckrc.json` を配置して、ルールの有効/無効やオプションをカスタマイズできます。
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"rules": {
|
|
110
|
+
"balance-sheet/equation": "error",
|
|
111
|
+
"home-office/reasonable-ratio": ["warning", { "maxRatio": 0.90 }],
|
|
112
|
+
"continuity/opening-closing-match": "off"
|
|
113
|
+
},
|
|
114
|
+
"priorYearFile": "./prior-year.xtx",
|
|
115
|
+
"format": "stylish",
|
|
116
|
+
"warningsAsErrors": false
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### ルール設定
|
|
121
|
+
|
|
122
|
+
各ルールの重要度を変更できます:
|
|
123
|
+
|
|
124
|
+
- `"error"` — エラーとして報告(終了コード1)
|
|
125
|
+
- `"warning"` — 警告として報告
|
|
126
|
+
- `"info"` — 情報として報告
|
|
127
|
+
- `"off"` — ルールを無効化
|
|
128
|
+
|
|
129
|
+
一部のルールはオプション付きで設定できます:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"rules": {
|
|
134
|
+
"home-office/reasonable-ratio": ["warning", { "maxRatio": 0.50 }]
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## 出力形式
|
|
140
|
+
|
|
141
|
+
### stylish(デフォルト)
|
|
142
|
+
|
|
143
|
+
ESLint風のカラー出力。ターミナルでの確認に適しています。
|
|
144
|
+
|
|
145
|
+
### json
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
zeicheck check data.xtx -f json
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
CI/CDパイプラインやツール連携に適したJSON形式で出力します。
|
|
152
|
+
|
|
153
|
+
## 免責事項
|
|
154
|
+
|
|
155
|
+
本ツールは確定申告データの**形式的な整合性チェック**を目的としたものであり、税務上の正確性・適法性を保証するものではありません。
|
|
156
|
+
|
|
157
|
+
- 本ツールの検証結果をもって、申告内容が税法上正しいことの証明にはなりません
|
|
158
|
+
- 検証でエラーが検出されなくても、申告内容に誤りがないことを意味するものではありません
|
|
159
|
+
- 税制改正により、ルールが最新の法令に対応していない場合があります
|
|
160
|
+
- 実際の確定申告にあたっては、必ず税理士等の専門家にご相談いただくか、国税庁の公式資料をご確認ください
|
|
161
|
+
|
|
162
|
+
**本ツールの使用によって生じたいかなる損害についても、開発者は一切の責任を負いません。**
|
|
163
|
+
|
|
164
|
+
## コントリビューション
|
|
165
|
+
|
|
166
|
+
zeicheckはコミュニティからの貢献を歓迎します!
|
|
167
|
+
|
|
168
|
+
### 貢献の方法
|
|
169
|
+
|
|
170
|
+
- **バグ報告**: [Issues](https://github.com/kalbi-org/zeicheck/issues) で報告してください。再現手順やエラーメッセージを添えていただけると助かります
|
|
171
|
+
- **機能提案**: 新しいルールや機能の要望も Issues でお気軽にどうぞ
|
|
172
|
+
- **プルリクエスト**: バグ修正、新規ルール追加、ドキュメント改善など歓迎します
|
|
173
|
+
|
|
174
|
+
### 開発環境のセットアップ
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
git clone https://github.com/kalbi-org/zeicheck.git
|
|
178
|
+
cd zeicheck
|
|
179
|
+
npm install
|
|
180
|
+
npm test # テスト実行
|
|
181
|
+
npm run build # ビルド
|
|
182
|
+
npm run typecheck # 型チェック
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### プルリクエストのガイドライン
|
|
186
|
+
|
|
187
|
+
1. 既存のテストがすべて通ることを確認してください(`npm test`)
|
|
188
|
+
2. 新しいルールを追加する場合は、対応するユニットテストも追加してください
|
|
189
|
+
3. ルールのメッセージは日本語で記述してください
|
|
190
|
+
4. コミットメッセージは変更内容が分かるように簡潔に書いてください
|
|
191
|
+
|
|
192
|
+
### 新しいルールの追加方法
|
|
193
|
+
|
|
194
|
+
1. `src/rules/<カテゴリ>/` にルールファイルを作成
|
|
195
|
+
2. `Rule` インターフェースを実装(`meta` + `check` メソッド)
|
|
196
|
+
3. `src/rules/index.ts` にルールを登録
|
|
197
|
+
4. `tests/unit/rules/<カテゴリ>/` にテストを作成
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
import type { Rule, RuleContext, RuleDiagnostic } from "../types.js";
|
|
201
|
+
|
|
202
|
+
export const myRule: Rule = {
|
|
203
|
+
meta: {
|
|
204
|
+
id: "category/my-rule",
|
|
205
|
+
name: "ルール名",
|
|
206
|
+
description: "ルールの詳細説明",
|
|
207
|
+
severity: "error",
|
|
208
|
+
},
|
|
209
|
+
check(ctx: RuleContext): RuleDiagnostic[] {
|
|
210
|
+
// 検証ロジック
|
|
211
|
+
return [];
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## ライセンス
|
|
217
|
+
|
|
218
|
+
MIT
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"buildings": {
|
|
3
|
+
"木造": { "usefulLife": 22, "straightLineRate": 0.046, "decliningRate": null },
|
|
4
|
+
"木骨モルタル造": { "usefulLife": 20, "straightLineRate": 0.050, "decliningRate": null },
|
|
5
|
+
"鉄骨鉄筋コンクリート造": { "usefulLife": 47, "straightLineRate": 0.022, "decliningRate": null },
|
|
6
|
+
"鉄筋コンクリート造": { "usefulLife": 47, "straightLineRate": 0.022, "decliningRate": null },
|
|
7
|
+
"鉄骨造(4mm超)": { "usefulLife": 34, "straightLineRate": 0.030, "decliningRate": null },
|
|
8
|
+
"鉄骨造(3mm超4mm以下)": { "usefulLife": 27, "straightLineRate": 0.038, "decliningRate": null },
|
|
9
|
+
"鉄骨造(3mm以下)": { "usefulLife": 19, "straightLineRate": 0.053, "decliningRate": null }
|
|
10
|
+
},
|
|
11
|
+
"buildingImprovements": {
|
|
12
|
+
"木造": { "usefulLife": 15, "straightLineRate": 0.067, "decliningRate": null },
|
|
13
|
+
"鉄筋コンクリート造": { "usefulLife": 15, "straightLineRate": 0.067, "decliningRate": null },
|
|
14
|
+
"その他": { "usefulLife": 15, "straightLineRate": 0.067, "decliningRate": null }
|
|
15
|
+
},
|
|
16
|
+
"furniture": {
|
|
17
|
+
"金属製(事務机等)": { "usefulLife": 15, "straightLineRate": 0.067, "decliningRate": 0.133 },
|
|
18
|
+
"その他(木製家具等)": { "usefulLife": 8, "straightLineRate": 0.125, "decliningRate": 0.250 },
|
|
19
|
+
"冷暖房用機器": { "usefulLife": 6, "straightLineRate": 0.167, "decliningRate": 0.333 },
|
|
20
|
+
"電気冷蔵庫": { "usefulLife": 6, "straightLineRate": 0.167, "decliningRate": 0.333 }
|
|
21
|
+
},
|
|
22
|
+
"vehicles": {
|
|
23
|
+
"普通自動車": { "usefulLife": 6, "straightLineRate": 0.167, "decliningRate": 0.333 },
|
|
24
|
+
"軽自動車": { "usefulLife": 4, "straightLineRate": 0.250, "decliningRate": 0.500 },
|
|
25
|
+
"二輪車(排気量125cc超)": { "usefulLife": 3, "straightLineRate": 0.334, "decliningRate": 0.667 },
|
|
26
|
+
"自転車": { "usefulLife": 2, "straightLineRate": 0.500, "decliningRate": 1.000 }
|
|
27
|
+
},
|
|
28
|
+
"tools": {
|
|
29
|
+
"測定工具": { "usefulLife": 5, "straightLineRate": 0.200, "decliningRate": 0.400 },
|
|
30
|
+
"治具": { "usefulLife": 3, "straightLineRate": 0.334, "decliningRate": 0.667 }
|
|
31
|
+
},
|
|
32
|
+
"computers": {
|
|
33
|
+
"パソコン": { "usefulLife": 4, "straightLineRate": 0.250, "decliningRate": 0.500 },
|
|
34
|
+
"サーバー": { "usefulLife": 5, "straightLineRate": 0.200, "decliningRate": 0.400 }
|
|
35
|
+
},
|
|
36
|
+
"software": {
|
|
37
|
+
"自社利用(複写販売用)": { "usefulLife": 3, "straightLineRate": 0.334, "decliningRate": null },
|
|
38
|
+
"自社利用(その他)": { "usefulLife": 5, "straightLineRate": 0.200, "decliningRate": null }
|
|
39
|
+
},
|
|
40
|
+
"machinery": {
|
|
41
|
+
"食料品製造用": { "usefulLife": 10, "straightLineRate": 0.100, "decliningRate": 0.200 },
|
|
42
|
+
"印刷用": { "usefulLife": 10, "straightLineRate": 0.100, "decliningRate": 0.200 },
|
|
43
|
+
"その他": { "usefulLife": 10, "straightLineRate": 0.100, "decliningRate": 0.200 }
|
|
44
|
+
}
|
|
45
|
+
}
|