kintone-migrator 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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +120 -0
  3. package/dist/index.js +1656 -0
  4. package/package.json +65 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hikaru Otabe
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,120 @@
1
+ # kintone-migrator
2
+
3
+ A CLI tool for migrating kintone form schemas.
4
+
5
+ Compares a YAML-defined schema file against an actual kintone app form, providing diff detection, migration, schema capture, and more.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install -g kintone-migrator
11
+ ```
12
+
13
+ Requires Node.js 22 or later.
14
+
15
+ ## Configuration
16
+
17
+ Connection details for kintone can be specified via CLI arguments or environment variables. CLI arguments take precedence.
18
+
19
+ | CLI Argument | Environment Variable | Description |
20
+ |---------|----------|------|
21
+ | `--domain`, `-d` | `KINTONE_DOMAIN` | kintone domain (e.g., `example.cybozu.com`) |
22
+ | `--username`, `-u` | `KINTONE_USERNAME` | kintone username |
23
+ | `--password`, `-p` | `KINTONE_PASSWORD` | kintone password |
24
+ | `--app-id`, `-a` | `KINTONE_APP_ID` | kintone app ID |
25
+ | `--schema-file`, `-f` | `SCHEMA_FILE_PATH` | Schema file path (default: `schema.yaml`) |
26
+
27
+ ### .env File
28
+
29
+ Environment variables can also be defined in a `.env` file and loaded with `dotenv-cli` or similar tools.
30
+
31
+ ```env
32
+ KINTONE_DOMAIN=example.cybozu.com
33
+ KINTONE_USERNAME=your_username
34
+ KINTONE_PASSWORD=your_password
35
+ KINTONE_APP_ID=123
36
+ SCHEMA_FILE_PATH=schema.yaml
37
+ ```
38
+
39
+ ## Commands
40
+
41
+ ### `diff`
42
+
43
+ Detects differences between the schema file and the current kintone form.
44
+
45
+ ```bash
46
+ kintone-migrator diff
47
+ kintone-migrator diff -d example.cybozu.com -a 123
48
+ ```
49
+
50
+ ### `migrate`
51
+
52
+ Applies schema file changes to the kintone form. Displays the diff and prompts for confirmation before execution.
53
+
54
+ ```bash
55
+ kintone-migrator migrate
56
+ ```
57
+
58
+ ### `override`
59
+
60
+ Overwrites the entire kintone form with the schema file contents. Fields not defined in the schema will be deleted.
61
+
62
+ ```bash
63
+ kintone-migrator override
64
+ ```
65
+
66
+ ### `capture`
67
+
68
+ Saves the current kintone form schema to a file.
69
+
70
+ ```bash
71
+ kintone-migrator capture
72
+ kintone-migrator capture -f my-schema.yaml
73
+ ```
74
+
75
+ ### `dump`
76
+
77
+ Dumps kintone form field definitions and layout in JSON format. For debugging purposes.
78
+
79
+ ```bash
80
+ kintone-migrator dump
81
+ ```
82
+
83
+ `fields.json` and `layout.json` will be output to the current directory.
84
+
85
+ ## Schema File
86
+
87
+ Schema files define the desired kintone form configuration in YAML format. The `layout` key at the root describes form rows, groups, subtables, and field definitions.
88
+
89
+ ```yaml
90
+ layout:
91
+ - type: ROW
92
+ fields:
93
+ - code: customer_name
94
+ type: SINGLE_LINE_TEXT
95
+ label: 顧客名
96
+ size: { width: "200" }
97
+ required: true
98
+ unique: true
99
+ - type: GROUP
100
+ code: detail_group
101
+ label: 詳細情報
102
+ openGroup: true
103
+ layout:
104
+ - type: ROW
105
+ fields:
106
+ - code: note
107
+ type: MULTI_LINE_TEXT
108
+ label: 備考
109
+ size: { width: "400" }
110
+ ```
111
+
112
+ For the full specification and all supported field types, see:
113
+
114
+ - [Schema Specification](./spec/schema.md) — format reference for all field types, layout items, decoration elements, and validation rules
115
+ - [Sample Schema (YAML)](./spec/sample_schema.yaml) — comprehensive example covering all field types
116
+ - [Sample Schema (JSON)](./spec/sample_schema.json) — equivalent example in JSON format
117
+
118
+ ## License
119
+
120
+ MIT