@rex0220/kintone-sql-tools 3.41.0 → 3.42.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 +272 -257
- package/dist-cli/ksql.js +11 -2
- package/dist-engine/index.cjs +2 -2
- package/dist-engine/index.mjs +2 -2
- package/dist-engine/ksql-engine.umd.js +2 -2
- package/dist-engine/meta/bundle-baseline.json +7 -7
- package/dist-engine/meta/cjs.json +3 -3
- package/dist-engine/meta/esm.json +3 -3
- package/dist-engine/meta/umd.json +3 -3
- package/dist-mcp/ksql-mcp.js +13 -4
- package/dist-mcpb/ksql-mcp.mcpb +0 -0
- package/package.json +1 -1
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
--
|
|
187
|
-
--
|
|
188
|
-
--
|
|
189
|
-
--
|
|
190
|
-
--
|
|
191
|
-
--
|
|
192
|
-
|
|
193
|
-
--
|
|
194
|
-
--
|
|
195
|
-
--
|
|
196
|
-
--
|
|
197
|
-
--
|
|
198
|
-
--
|
|
199
|
-
|
|
200
|
-
--
|
|
201
|
-
--
|
|
202
|
-
--
|
|
203
|
-
--
|
|
204
|
-
--
|
|
205
|
-
--
|
|
206
|
-
--
|
|
207
|
-
--
|
|
208
|
-
--
|
|
209
|
-
--
|
|
210
|
-
--
|
|
211
|
-
--
|
|
212
|
-
--
|
|
213
|
-
--
|
|
214
|
-
--
|
|
215
|
-
--
|
|
216
|
-
--
|
|
217
|
-
--
|
|
218
|
-
--
|
|
219
|
-
--
|
|
220
|
-
--
|
|
221
|
-
-
|
|
222
|
-
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
-
|
|
230
|
-
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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).
|
package/dist-cli/ksql.js
CHANGED
|
@@ -7842,12 +7842,21 @@ function applyDateAdd(dateStr, n, unit) {
|
|
|
7842
7842
|
if (!dateStr || dateStr.length < 10) return dateStr;
|
|
7843
7843
|
const { y, mo, d } = parseDateParts(dateStr);
|
|
7844
7844
|
const dt = new Date(Date.UTC(+y, +mo - 1, +d));
|
|
7845
|
+
const addCalendarUnit = (applyTarget) => {
|
|
7846
|
+
const originalDay = dt.getUTCDate();
|
|
7847
|
+
dt.setUTCDate(1);
|
|
7848
|
+
applyTarget();
|
|
7849
|
+
const endOfTargetMonth = new Date(dt.getTime());
|
|
7850
|
+
endOfTargetMonth.setUTCMonth(endOfTargetMonth.getUTCMonth() + 1);
|
|
7851
|
+
endOfTargetMonth.setUTCDate(0);
|
|
7852
|
+
dt.setUTCDate(Math.min(originalDay, endOfTargetMonth.getUTCDate()));
|
|
7853
|
+
};
|
|
7845
7854
|
switch (unit) {
|
|
7846
7855
|
case "YEAR":
|
|
7847
|
-
dt.setUTCFullYear(dt.getUTCFullYear() + n);
|
|
7856
|
+
addCalendarUnit(() => dt.setUTCFullYear(dt.getUTCFullYear() + n));
|
|
7848
7857
|
break;
|
|
7849
7858
|
case "MONTH":
|
|
7850
|
-
dt.setUTCMonth(dt.getUTCMonth() + n);
|
|
7859
|
+
addCalendarUnit(() => dt.setUTCMonth(dt.getUTCMonth() + n));
|
|
7851
7860
|
break;
|
|
7852
7861
|
case "DAY":
|
|
7853
7862
|
dt.setUTCDate(dt.getUTCDate() + n);
|