@rex0220/kintone-sql-tools 3.41.0 → 3.43.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/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # kintone-sql-tools
2
-
3
- kintone アプリを SQL 風の構文で操作するツールセットです。
4
-
5
- - kintone プラグイン(UI)
6
- - CLI(`ksql`)
7
- - MCP サーバー(AI クライアントから kintone を SQL 操作。Claude Desktop 用 MCPB 同梱)
8
- - read-only エンジン・ライブラリ(ESM / CJS / UMD)
9
-
1
+ # kintone-sql-tools
2
+
3
+ kintone アプリを SQL 風の構文で操作するツールセットです。
4
+
5
+ - kintone プラグイン(UI)
6
+ - CLI(`ksql`)
7
+ - MCP サーバー(AI クライアントから kintone を SQL 操作。Claude Desktop 用 MCPB 同梱)
8
+ - read-only エンジン・ライブラリ(ESM / CJS / UMD)
9
+
10
10
  他の kintone プラグインやカスタマイズへ read-only kSQL エンジンを組み込む場合は、
11
11
  [エンジン・ライブラリ利用ガイド](docs/ksql_engine_library.md)を参照してください。
12
12
 
@@ -15,251 +15,266 @@ engine ライブラリでは、`runQuery()` が単文の `SELECT` / `WITH` / `UN
15
15
  `CREATE` / `DROP TEMP TABLE`、`SET` / `DECLARE`、`ASSERT`、`EXPLAIN` を実行します。
16
16
  書き込み DML、DML `VALIDATE ONLY`、`IMPORT`、`APPLY` は対象外です。
17
17
  生成 AI が MCP で作った SQL を library で実行する場合は、この API 別の境界を確認してください。
18
-
19
- ## 機能概要
20
-
21
- - `SELECT`(JOIN/GROUP BY/HAVING/CTE/UNION)
22
- - `INSERT` / `UPDATE` / `UPDATE ... FROM` / `UPSERT` / `DELETE` / `REORDER`(`--allow-dml` 必須)
23
- - `EXPLAIN`
24
- - **型付きcanonical `ORDER BY`とkintone固有順を選ぶ`KORDER BY`**(v3.0.0)
25
- - **最大30桁のNUMBERをraw字句のまま比較する厳密10進primitive**(v3.3.0)
26
- - **バッチ実行(`;` 区切りの複文)と一時テーブル `CREATE TEMP TABLE #t AS SELECT ...`**
27
- - CLI / MCP: read-only バッチ + DML バッチ(一時テーブル経由の `INSERT ... SELECT` を含む)
28
- - プラグイン: read-only バッチのみ(最終結果を表示)
29
- - **`ASSERT`(実行時ゲート。DML 前の件数ガード / CLI ヘルスチェック)**
30
- - サブテーブル仮想テーブル(`APP100$明細`)
31
- - CLI 拡張 `APP@profile`
32
- - 同一 SQL 内で同一 APP の profile 混在を許可
33
- - `INSERT/UPDATE/UPSERT` 対応、`DELETE` は未対応
34
- - CLI / MCP の論理アプリ参照 `LAPP_<NAME>`
35
- - profile ごとの `logicalApps` で、同じ SQL を異なる物理アプリ ID へ安全に解決
36
- - `APP100` は常に物理 ID 100 のまま(暗黙変換なし)
37
- - `allowPhysicalAppRefs: false` で、その profile の物理 `APPxxx` 直接参照を禁止可能
38
- - `FROM` 省略 SELECT(例: `SELECT 'xxx' AS a`)
39
-
40
- > **v3.0.0は比較・ORDER BY意味論を変更するmajor releaseです。** 数字だけの文字列、`#err`数値列の非数値、取得上限時のlocal top-N、`KORDER`予約語、EXPLAINのmetadata API利用について、[v3.0.0 移行ガイド](docs/ksql_v3_migration_guide.md)を確認してください。
41
-
42
- ## インストール
43
-
44
- ## npm(グローバル)
45
-
46
- ```bash
47
- npm install -g @rex0220/kintone-sql-tools
48
- ksql --help
49
- ```
50
-
51
- ## ローカル開発
52
-
53
- ```bash
54
- npm install
55
- npm run build:cli
56
- node dist-cli/ksql.js --help
57
- ```
58
-
59
- プラグインをビルドする場合:
60
-
61
- ```bash
62
- npm run build:plugin
63
- ```
64
-
65
- ## 使い分け(CLI / Plugin)
66
-
67
- - CLI を使うケース:
68
- - DML を含むバッチ実行・SQL ファイル実行(`-f`)
69
- - CI/CD 連携
70
- - `APP@profile` を使った環境切替
71
- - `LAPP_<NAME>` を使った配置非依存 SQL
72
- - `--dry-run` / `EXPLAIN` による安全確認
73
-
74
- - Plugin を使うケース:
75
- - kintone 画面内での対話操作(read-only バッチ + 一時テーブルも利用可)
76
- - 非エンジニア向けの運用
77
- - UI で結果確認したい場合
78
-
79
- - MCP を使うケース:
80
- - Claude 等の AI クライアントから kintone を照会・更新
81
- - 一時テーブルで中間結果をサーバー内に保持し、AI のコンテキスト消費を抑えたい場合
82
- - validation / EXPLAIN で論理名から最終的な物理アプリ ID への解決を確認したい場合
83
-
84
- 言語リファレンス・レシピは MCP resources(`ksql://language-reference` / `ksql://recipes`)に加えて、read-only ツール **`ksql_docs`** でも読めます。中継環境(リモート接続のプロキシ等)が resources を通さないクライアントでは、`ksql_docs` を引数なしで呼ぶと全章キーの索引が返るので、必要な章だけ `{"section":"language-reference/05-string-number-functions"}` の形で取得してください。
85
-
86
- 注意:
87
-
88
- - `APP@profile` と `LAPP_<NAME>[@profile]` は Node.js runtime(CLI / MCP)の拡張です。plugin 側では非対応です。
89
-
90
- ## 最短実行例(CLI)
91
-
92
- ```bash
93
- node dist-cli/ksql.js --base-url https://example.cybozu.com --token xxx -e "SELECT * FROM APP100 LIMIT 5"
94
- ```
95
-
96
- `FROM` 省略 SELECT:
97
-
98
- ```bash
99
- node dist-cli/ksql.js -e "SELECT 'xxx' AS a"
100
- ```
101
-
102
- DML(確認付き):
103
-
104
- ```bash
105
- node dist-cli/ksql.js \
106
- --base-url https://example.cybozu.com \
107
- --token xxx \
108
- --allow-dml \
109
- -e "UPDATE APP100 SET 状態 = '完了' WHERE ステータス = '未着手'"
110
- ```
111
-
112
- コンソール:
113
-
114
- ```bash
115
- node dist-cli/ksql.js --console --base-url https://example.cybozu.com --token xxx
116
- ```
117
-
118
- ## 設定ファイル
119
-
120
- - 既定: `./ksql.config.json`
121
- - profile 切替: `--profile <name>`
122
-
123
- 例:
124
-
125
- ```bash
126
- node dist-cli/ksql.js --config ./ksql.config.json --profile dev -e "SELECT * FROM APP100"
127
- ```
128
-
129
- 論理アプリ参照を使う場合、profile ごとに論理名と物理 ID を定義します。
130
-
131
- ```json
132
- {
133
- "defaultProfile": "dev",
134
- "profiles": {
135
- "dev": {
136
- "baseUrl": "https://dev.example.cybozu.com",
137
- "logicalApps": { "ORDERS": 100 },
138
- "tokenMap": { "APP100": "env:DEV_ORDERS_TOKEN" }
139
- },
140
- "prod": {
141
- "baseUrl": "https://prod.example.cybozu.com",
142
- "allowPhysicalAppRefs": false,
143
- "logicalApps": { "ORDERS": 1200 },
144
- "tokenMap": { "APP1200": "env:PROD_ORDERS_TOKEN" }
145
- }
146
- }
147
- }
148
- ```
149
-
150
- ```bash
151
- node dist-cli/ksql.js --config ./ksql.config.json --profile dev -e "SELECT * FROM LAPP_ORDERS"
152
- node dist-cli/ksql.js --config ./ksql.config.json --profile prod -e "SELECT * FROM LAPP_ORDERS"
153
- ```
154
-
155
- どちらも同じ SQL ですが、前者は `APP100`、後者は `APP1200` に解決されます。`logicalApps` のキーは `LAPP_` を付けない ASCII 論理名です。`APP100`、`100`、`LAPP_ORDERS` は設定キーとして拒否されます。
156
-
157
- ## CLI オプション
158
-
159
- <!-- BEGIN_HELP_SYNC -->
160
- ```text
161
- ksql - Execute SQL against kintone apps
162
-
163
- Usage:
164
- ksql [options]
165
- ksql -e "<SQL>"
166
- ksql -f <file.sql>
167
-
168
- Options:
169
- -e, --execute <sql> Execute SQL string
170
- -f, --file <path> Execute SQL file
171
- --console Start interactive console mode
172
- --dry-run Parse and show execution plan only
173
- --var <name=value> Override a DECLARE variable (repeatable; not for secrets)
174
- --import-csv <name=path> Supply named CSV and enable IMPORT (repeatable)
175
- --import-json <name=path> Supply named JSON and enable IMPORT (repeatable)
176
- --format <type> Output format: table | json | jsonl | csv | markdown | md
177
- (batch + json: prints one JSON envelope for the whole batch)
178
- --max-records <n> Max records to fetch (default: 500)
179
- --fetch-parallel <n> Parallel page fetches per query: 1-10 (default: 3)
180
- --on-limit <mode> On record limit: error | truncate (local ORDER BY needs complete input)
181
- --temp-table-max-rows <n> Max rows per temp table (default: 10000, always errors on overflow)
182
- --timeout <ms> Request timeout in milliseconds (default: 30000)
183
- --max-concurrent <n> Max concurrent kintone requests: 1-50 (default: 10)
184
- (process-wide; fixed at first resolution; KSQL_MAX_CONCURRENT wins)
185
- --cursor-max-active <n> Max active cursors per host: 1-5 (default: 2; KSQL_CURSOR_MAX_ACTIVE wins)
186
- --retry <n> GET retry count: 0-10, 0 disables (default: 3; KSQL_RETRY wins)
187
- --retry-base-delay <ms> GET retry backoff base delay (default: 500)
188
- --retry-max-delay <ms> GET retry backoff max delay (default: 8000)
189
- --config <path> Config file path (default: ./ksql.config.json)
190
- --profile <name> Profile name in config
191
- --base-url <url> kintone base URL
192
- --guest-space-id <id> Guest space ID (uses /k/guest/<id>/v1 APIs)
193
- --auth <type> Auth type: token | userpass | auto
194
- --username <name> Login username (for userpass auth)
195
- --password <pass> Login password (for userpass auth)
196
- --token <token> Single-app token
197
- --token-map <mapping> App token map (APP100=...,APP101=...)
198
- --token-file <path> JSON file for app token map
199
- --app <id> Default app id context
200
- --diag-record-id <id> Diagnostic: GET record.json by app+id
201
- --no-header Hide table header
202
- --pretty Pretty-print JSON output
203
- --user-format <mode> User field format: full | name | code
204
- --array-format <mode> Array field format: full | join
205
- --table-format <mode> Subtable format: full | count
206
- --date-format <mode> Date format: full | local
207
- --attachment-format <mode> Attachment format: full | name | fileKey
208
- --output <path> Write output to file
209
- --no-color Disable ANSI colors
210
- --quiet Suppress non-result logs
211
- --debug Show request/response debug logs
212
- --debug-url Show only HTTP request URL debug logs
213
- --debug-headers Show request headers in debug logs (masked)
214
- --exit-on-empty Return exit code 1 when rowCount is 0
215
- --allow-dml Enable UPDATE/DELETE/INSERT/UPSERT/REORDER execution
216
- --yes Skip DML confirmation prompt
217
- --allow-without-where Allow UPDATE/DELETE without WHERE
218
- --dml-max-rows <n> Max affected parent rows for DML/APPLY guard (default: 100)
219
- --dml-max-subtable-rows <n> Max changed subtable rows for APPLY guard; multi-value fields excluded (default: 500)
220
- --continue-on-error Batch: keep executing after a statement error (read-only batch only)
221
- -h, --help Show help
222
- -v, --version Show version
223
- ```
224
- <!-- END_HELP_SYNC -->
225
-
226
- ## 最低限のトラブルシュート
227
-
228
- 1. `ArgumentError: no APPxxx found...`
229
- - `FROM` ありクエリでは `APPxxx` 指定が必要です。
230
- - `SELECT 'xxx' AS a` のような式 SELECT は実行可能です。
231
-
232
- 2. `AuthError: token is missing...`
233
- - `--token-map` / `--token-file` / config `tokenMap` を確認してください。
234
-
235
- 3. `ArgumentError: unknown field code(s)...`
236
- - フィールドコード名を確認してください(ラベル名ではなくコード)。
237
-
238
- 4. `DML is disabled`
239
- - `--allow-dml` を付けて再実行してください。
240
-
241
- 5. `@profile` を使った DELETE が失敗する
242
- - 現在 `DELETE` の `@profile` は未対応です。
243
-
244
- 6. Windows `ksql --help` 実行時にエディタが開いてしまう
245
- - `.js` 関連付けの影響の可能性があります。`ksql.cmd --help` または `node dist-cli/ksql.js --help` で確認してください。
246
-
247
- ## 機密情報の取り扱い
248
-
249
- - token / password は直書きせず、環境変数または `env:` 参照を推奨します。
250
- - `ksql.config.json` はローカル運用ファイルとして `.gitignore` 済みです。
251
- - `private.ppk` / `pluginId.txt` は `.gitignore` 済みです。
252
-
253
- ## ドキュメント
254
-
255
- - [Docs Index](docs/README.md)
256
- - [言語リファレンス](docs/ksql_language_reference.md)
257
- - [CLI / Console 仕様](docs/internal/ksql_cli_console_spec.md)
258
- - [バッチ実行・一時テーブル仕様](docs/internal/ksql_batch_temp_table_spec.md)
259
- - [MCP サーバー仕様](docs/internal/ksql_mcp_server_spec.md) / [Claude Desktop への導入(MCPB)](docs/ksql_mcpb_claude_desktop_install.md)
260
- - [APP@profile 仕様](docs/internal/cli_app_profile_spec.md)
261
- - [公開前チェックリスト](docs/internal/public_release_checklist.md)
262
-
263
- ## ライセンス
264
-
265
- MIT License. See [LICENSE](LICENSE).
18
+
19
+ ## 機能概要
20
+
21
+ - `SELECT`(JOIN/GROUP BY/HAVING/CTE/UNION)
22
+ - `INSERT` / `UPDATE` / `UPDATE ... FROM` / `UPSERT` / `DELETE` / `REORDER`(`--allow-dml` 必須)
23
+ - `EXPLAIN`
24
+ - **型付きcanonical `ORDER BY`とkintone固有順を選ぶ`KORDER BY`**(v3.0.0)
25
+ - **最大30桁のNUMBERをraw字句のまま比較する厳密10進primitive**(v3.3.0)
26
+ - **バッチ実行(`;` 区切りの複文)と一時テーブル `CREATE TEMP TABLE #t AS SELECT ...`**
27
+ - CLI / MCP: read-only バッチ + DML バッチ(一時テーブル経由の `INSERT ... SELECT` を含む)
28
+ - プラグイン: read-only バッチのみ(最終結果を表示)
29
+ - **`ASSERT`(実行時ゲート。DML 前の件数ガード / CLI ヘルスチェック)**
30
+ - サブテーブル仮想テーブル(`APP100$明細`)
31
+ - CLI 拡張 `APP@profile`
32
+ - 同一 SQL 内で同一 APP の profile 混在を許可
33
+ - `INSERT/UPDATE/UPSERT` 対応、`DELETE` は未対応
34
+ - CLI / MCP の論理アプリ参照 `LAPP_<NAME>`
35
+ - profile ごとの `logicalApps` で、同じ SQL を異なる物理アプリ ID へ安全に解決
36
+ - `APP100` は常に物理 ID 100 のまま(暗黙変換なし)
37
+ - `allowPhysicalAppRefs: false` で、その profile の物理 `APPxxx` 直接参照を禁止可能
38
+ - `FROM` 省略 SELECT(例: `SELECT 'xxx' AS a`)
39
+
40
+ > **v3.0.0は比較・ORDER BY意味論を変更するmajor releaseです。** 数字だけの文字列、`#err`数値列の非数値、取得上限時のlocal top-N、`KORDER`予約語、EXPLAINのmetadata API利用について、[v3.0.0 移行ガイド](docs/ksql_v3_migration_guide.md)を確認してください。
41
+
42
+ ## インストール
43
+
44
+ ## npm(グローバル)
45
+
46
+ ```bash
47
+ npm install -g @rex0220/kintone-sql-tools
48
+ ksql --help
49
+ ```
50
+
51
+ ## ローカル開発
52
+
53
+ ```bash
54
+ npm install
55
+ npm run build:cli
56
+ node dist-cli/ksql.js --help
57
+ ```
58
+
59
+ プラグインをビルドする場合:
60
+
61
+ ```bash
62
+ npm run build:plugin
63
+ ```
64
+
65
+ ### テストを実行するときは `KSQL_*` を外す
66
+
67
+ CLI は**環境変数を設定ファイルより優先**します(CLI 引数 → 環境変数 → 設定ファイル)。
68
+ シェルに `KSQL_USERNAME` / `KSQL_PASSWORD` / `KSQL_CONFIG` / `KSQL_PROFILE` などが
69
+ 残っていると、**テストが別の認証・別の設定で走り、リポジトリを変えていないのに
70
+ 落ちたり通ったりします**。
71
+
72
+ ```bash
73
+ env -u KSQL_USERNAME -u KSQL_PASSWORD npm test
74
+ ```
75
+
76
+ 日常の CLI 利用のために `KSQL_*` を設定している場合は、上のように外して実行してください。
77
+ **テストが落ちたら、まず `env | grep KSQL_` を確認**すると早いことがあります
78
+ (実装が読む `KSQL_*` は 32 個あります)。
79
+
80
+ ## 使い分け(CLI / Plugin)
81
+
82
+ - CLI を使うケース:
83
+ - DML を含むバッチ実行・SQL ファイル実行(`-f`)
84
+ - CI/CD 連携
85
+ - `APP@profile` を使った環境切替
86
+ - `LAPP_<NAME>` を使った配置非依存 SQL
87
+ - `--dry-run` / `EXPLAIN` による安全確認
88
+
89
+ - Plugin を使うケース:
90
+ - kintone 画面内での対話操作(read-only バッチ + 一時テーブルも利用可)
91
+ - 非エンジニア向けの運用
92
+ - UI で結果確認したい場合
93
+
94
+ - MCP を使うケース:
95
+ - Claude 等の AI クライアントから kintone を照会・更新
96
+ - 一時テーブルで中間結果をサーバー内に保持し、AI のコンテキスト消費を抑えたい場合
97
+ - validation / EXPLAIN で論理名から最終的な物理アプリ ID への解決を確認したい場合
98
+
99
+ 言語リファレンス・レシピは MCP resources(`ksql://language-reference` / `ksql://recipes`)に加えて、read-only ツール **`ksql_docs`** でも読めます。中継環境(リモート接続のプロキシ等)が resources を通さないクライアントでは、`ksql_docs` を引数なしで呼ぶと全章キーの索引が返るので、必要な章だけ `{"section":"language-reference/05-string-number-functions"}` の形で取得してください。
100
+
101
+ 注意:
102
+
103
+ - `APP@profile` と `LAPP_<NAME>[@profile]` は Node.js runtime(CLI / MCP)の拡張です。plugin 側では非対応です。
104
+
105
+ ## 最短実行例(CLI)
106
+
107
+ ```bash
108
+ node dist-cli/ksql.js --base-url https://example.cybozu.com --token xxx -e "SELECT * FROM APP100 LIMIT 5"
109
+ ```
110
+
111
+ `FROM` 省略 SELECT:
112
+
113
+ ```bash
114
+ node dist-cli/ksql.js -e "SELECT 'xxx' AS a"
115
+ ```
116
+
117
+ DML(確認付き):
118
+
119
+ ```bash
120
+ node dist-cli/ksql.js \
121
+ --base-url https://example.cybozu.com \
122
+ --token xxx \
123
+ --allow-dml \
124
+ -e "UPDATE APP100 SET 状態 = '完了' WHERE ステータス = '未着手'"
125
+ ```
126
+
127
+ コンソール:
128
+
129
+ ```bash
130
+ node dist-cli/ksql.js --console --base-url https://example.cybozu.com --token xxx
131
+ ```
132
+
133
+ ## 設定ファイル
134
+
135
+ - 既定: `./ksql.config.json`
136
+ - profile 切替: `--profile <name>`
137
+
138
+ 例:
139
+
140
+ ```bash
141
+ node dist-cli/ksql.js --config ./ksql.config.json --profile dev -e "SELECT * FROM APP100"
142
+ ```
143
+
144
+ 論理アプリ参照を使う場合、profile ごとに論理名と物理 ID を定義します。
145
+
146
+ ```json
147
+ {
148
+ "defaultProfile": "dev",
149
+ "profiles": {
150
+ "dev": {
151
+ "baseUrl": "https://dev.example.cybozu.com",
152
+ "logicalApps": { "ORDERS": 100 },
153
+ "tokenMap": { "APP100": "env:DEV_ORDERS_TOKEN" }
154
+ },
155
+ "prod": {
156
+ "baseUrl": "https://prod.example.cybozu.com",
157
+ "allowPhysicalAppRefs": false,
158
+ "logicalApps": { "ORDERS": 1200 },
159
+ "tokenMap": { "APP1200": "env:PROD_ORDERS_TOKEN" }
160
+ }
161
+ }
162
+ }
163
+ ```
164
+
165
+ ```bash
166
+ node dist-cli/ksql.js --config ./ksql.config.json --profile dev -e "SELECT * FROM LAPP_ORDERS"
167
+ node dist-cli/ksql.js --config ./ksql.config.json --profile prod -e "SELECT * FROM LAPP_ORDERS"
168
+ ```
169
+
170
+ どちらも同じ SQL ですが、前者は `APP100`、後者は `APP1200` に解決されます。`logicalApps` のキーは `LAPP_` を付けない ASCII 論理名です。`APP100`、`100`、`LAPP_ORDERS` は設定キーとして拒否されます。
171
+
172
+ ## CLI オプション
173
+
174
+ <!-- BEGIN_HELP_SYNC -->
175
+ ```text
176
+ ksql - Execute SQL against kintone apps
177
+
178
+ Usage:
179
+ ksql [options]
180
+ ksql -e "<SQL>"
181
+ ksql -f <file.sql>
182
+
183
+ Options:
184
+ -e, --execute <sql> Execute SQL string
185
+ -f, --file <path> Execute SQL file
186
+ --console Start interactive console mode
187
+ --dry-run Parse and show execution plan only
188
+ --var <name=value> Override a DECLARE variable (repeatable; not for secrets)
189
+ --import-csv <name=path> Supply named CSV and enable IMPORT (repeatable)
190
+ --import-json <name=path> Supply named JSON and enable IMPORT (repeatable)
191
+ --format <type> Output format: table | json | jsonl | csv | markdown | md
192
+ (batch + json: prints one JSON envelope for the whole batch)
193
+ --max-records <n> Max records to fetch (default: 500)
194
+ --fetch-parallel <n> Parallel page fetches per query: 1-10 (default: 3)
195
+ --on-limit <mode> On record limit: error | truncate (local ORDER BY needs complete input)
196
+ --temp-table-max-rows <n> Max rows per temp table (default: 10000, always errors on overflow)
197
+ --timeout <ms> Request timeout in milliseconds (default: 30000)
198
+ --max-concurrent <n> Max concurrent kintone requests: 1-50 (default: 10)
199
+ (process-wide; fixed at first resolution; KSQL_MAX_CONCURRENT wins)
200
+ --cursor-max-active <n> Max active cursors per host: 1-5 (default: 2; KSQL_CURSOR_MAX_ACTIVE wins)
201
+ --retry <n> GET retry count: 0-10, 0 disables (default: 3; KSQL_RETRY wins)
202
+ --retry-base-delay <ms> GET retry backoff base delay (default: 500)
203
+ --retry-max-delay <ms> GET retry backoff max delay (default: 8000)
204
+ --config <path> Config file path (default: ./ksql.config.json)
205
+ --profile <name> Profile name in config
206
+ --base-url <url> kintone base URL
207
+ --guest-space-id <id> Guest space ID (uses /k/guest/<id>/v1 APIs)
208
+ --auth <type> Auth type: token | userpass | auto
209
+ --username <name> Login username (for userpass auth)
210
+ --password <pass> Login password (for userpass auth)
211
+ --token <token> Single-app token
212
+ --token-map <mapping> App token map (APP100=...,APP101=...)
213
+ --token-file <path> JSON file for app token map
214
+ --app <id> Default app id context
215
+ --diag-record-id <id> Diagnostic: GET record.json by app+id
216
+ --no-header Hide table header
217
+ --pretty Pretty-print JSON output
218
+ --user-format <mode> User field format: full | name | code
219
+ --array-format <mode> Array field format: full | join
220
+ --table-format <mode> Subtable format: full | count
221
+ --date-format <mode> Date format: full | local
222
+ --attachment-format <mode> Attachment format: full | name | fileKey
223
+ --output <path> Write output to file
224
+ --no-color Disable ANSI colors
225
+ --quiet Suppress non-result logs
226
+ --debug Show request/response debug logs
227
+ --debug-url Show only HTTP request URL debug logs
228
+ --debug-headers Show request headers in debug logs (masked)
229
+ --exit-on-empty Return exit code 1 when rowCount is 0
230
+ --allow-dml Enable UPDATE/DELETE/INSERT/UPSERT/REORDER execution
231
+ --yes Skip DML confirmation prompt
232
+ --allow-without-where Allow UPDATE/DELETE without WHERE
233
+ --dml-max-rows <n> Max affected parent rows for DML/APPLY guard (default: 100)
234
+ --dml-max-subtable-rows <n> Max changed subtable rows for APPLY guard; multi-value fields excluded (default: 500)
235
+ --continue-on-error Batch: keep executing after a statement error (read-only batch only)
236
+ -h, --help Show help
237
+ -v, --version Show version
238
+ ```
239
+ <!-- END_HELP_SYNC -->
240
+
241
+ ## 最低限のトラブルシュート
242
+
243
+ 1. `ArgumentError: no APPxxx found...`
244
+ - `FROM` ありクエリでは `APPxxx` 指定が必要です。
245
+ - `SELECT 'xxx' AS a` のような式 SELECT は実行可能です。
246
+
247
+ 2. `AuthError: token is missing...`
248
+ - `--token-map` / `--token-file` / config の `tokenMap` を確認してください。
249
+
250
+ 3. `ArgumentError: unknown field code(s)...`
251
+ - フィールドコード名を確認してください(ラベル名ではなくコード)。
252
+
253
+ 4. `DML is disabled`
254
+ - `--allow-dml` を付けて再実行してください。
255
+
256
+ 5. `@profile` を使った DELETE が失敗する
257
+ - 現在 `DELETE` `@profile` は未対応です。
258
+
259
+ 6. Windows `ksql --help` 実行時にエディタが開いてしまう
260
+ - `.js` 関連付けの影響の可能性があります。`ksql.cmd --help` または `node dist-cli/ksql.js --help` で確認してください。
261
+
262
+ ## 機密情報の取り扱い
263
+
264
+ - token / password は直書きせず、環境変数または `env:` 参照を推奨します。
265
+ - `ksql.config.json` はローカル運用ファイルとして `.gitignore` 済みです。
266
+ - `private.ppk` / `pluginId.txt` は `.gitignore` 済みです。
267
+
268
+ ## ドキュメント
269
+
270
+ - [Docs Index](docs/README.md)
271
+ - [言語リファレンス](docs/ksql_language_reference.md)
272
+ - [CLI / Console 仕様](docs/internal/ksql_cli_console_spec.md)
273
+ - [バッチ実行・一時テーブル仕様](docs/internal/ksql_batch_temp_table_spec.md)
274
+ - [MCP サーバー仕様](docs/internal/ksql_mcp_server_spec.md) / [Claude Desktop への導入(MCPB)](docs/ksql_mcpb_claude_desktop_install.md)
275
+ - [APP@profile 仕様](docs/internal/cli_app_profile_spec.md)
276
+ - [公開前チェックリスト](docs/internal/public_release_checklist.md)
277
+
278
+ ## ライセンス
279
+
280
+ MIT License. See [LICENSE](LICENSE).