@chaim-tools/chaim 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 +201 -0
- package/README.md +211 -0
- package/dist/commands/apps/link.d.ts +26 -0
- package/dist/commands/apps/link.d.ts.map +1 -0
- package/dist/commands/apps/link.js +49 -0
- package/dist/commands/apps/link.js.map +1 -0
- package/dist/commands/apps/list.d.ts +25 -0
- package/dist/commands/apps/list.d.ts.map +1 -0
- package/dist/commands/apps/list.js +46 -0
- package/dist/commands/apps/list.js.map +1 -0
- package/dist/commands/auth/login.d.ts +29 -0
- package/dist/commands/auth/login.d.ts.map +1 -0
- package/dist/commands/auth/login.js +51 -0
- package/dist/commands/auth/login.js.map +1 -0
- package/dist/commands/auth/logout.d.ts +26 -0
- package/dist/commands/auth/logout.d.ts.map +1 -0
- package/dist/commands/auth/logout.js +49 -0
- package/dist/commands/auth/logout.js.map +1 -0
- package/dist/commands/auth/refresh.d.ts +27 -0
- package/dist/commands/auth/refresh.d.ts.map +1 -0
- package/dist/commands/auth/refresh.js +47 -0
- package/dist/commands/auth/refresh.js.map +1 -0
- package/dist/commands/auth/whoami.d.ts +28 -0
- package/dist/commands/auth/whoami.d.ts.map +1 -0
- package/dist/commands/auth/whoami.js +48 -0
- package/dist/commands/auth/whoami.js.map +1 -0
- package/dist/commands/clean.d.ts +25 -0
- package/dist/commands/clean.d.ts.map +1 -0
- package/dist/commands/clean.js +345 -0
- package/dist/commands/clean.js.map +1 -0
- package/dist/commands/config/show.d.ts +25 -0
- package/dist/commands/config/show.d.ts.map +1 -0
- package/dist/commands/config/show.js +49 -0
- package/dist/commands/config/show.js.map +1 -0
- package/dist/commands/configure.d.ts +26 -0
- package/dist/commands/configure.d.ts.map +1 -0
- package/dist/commands/configure.js +53 -0
- package/dist/commands/configure.js.map +1 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +96 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/generate.d.ts +11 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +395 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +302 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/validate.d.ts +2 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +58 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/config/types.d.ts +138 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +48 -0
- package/dist/config/types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +114 -0
- package/dist/index.js.map +1 -0
- package/dist/planned-commands.d.ts +51 -0
- package/dist/planned-commands.d.ts.map +1 -0
- package/dist/planned-commands.js +199 -0
- package/dist/planned-commands.js.map +1 -0
- package/dist/services/os-cache-paths.d.ts +15 -0
- package/dist/services/os-cache-paths.d.ts.map +1 -0
- package/dist/services/os-cache-paths.js +57 -0
- package/dist/services/os-cache-paths.js.map +1 -0
- package/dist/services/snapshot-discovery.d.ts +111 -0
- package/dist/services/snapshot-discovery.d.ts.map +1 -0
- package/dist/services/snapshot-discovery.js +249 -0
- package/dist/services/snapshot-discovery.js.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +9 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/snapshot-payload.d.ts +205 -0
- package/dist/types/snapshot-payload.d.ts.map +1 -0
- package/dist/types/snapshot-payload.js +9 -0
- package/dist/types/snapshot-payload.js.map +1 -0
- package/package.json +65 -0
- package/shared/scripts/setup.sh +47 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# chaim-cli
|
|
2
|
+
|
|
3
|
+
A **schema-driven code generation tool** that transforms `.bprint` schema snapshots into complete SDKs with DynamoDB Mapper clients, DTOs, and configuration management. Currently supports **Java** (default), with more languages coming soon.
|
|
4
|
+
|
|
5
|
+
## Prerequisite
|
|
6
|
+
|
|
7
|
+
> **IMPORTANT**: You must run `cdk synth` or `cdk deploy` in your CDK project before using this CLI.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# In your CDK project directory
|
|
11
|
+
cdk synth # Creates LOCAL snapshot in OS cache
|
|
12
|
+
# OR
|
|
13
|
+
cdk deploy # Creates LOCAL snapshot + publishes to Chaim SaaS
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The CLI reads snapshot files from the **OS cache** (`~/.chaim/cache/snapshots/`) produced by [chaim-cdk](https://github.com/chaim-tools/chaim-cdk). You can run the CLI from **any directory**.
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# 1. In your CDK project, create a snapshot
|
|
22
|
+
cd my-cdk-project
|
|
23
|
+
cdk synth
|
|
24
|
+
|
|
25
|
+
# 2. Generate SDK (run from your Java application directory)
|
|
26
|
+
cd my-java-app
|
|
27
|
+
chaim generate --package com.mycompany.myapp.model
|
|
28
|
+
|
|
29
|
+
# That's it! Your Java SDK is ready in ./src/main/java/
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install -g @chaim-tools/chaim
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## System Requirements
|
|
39
|
+
|
|
40
|
+
Run `chaim doctor` to verify your environment:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
chaim doctor
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Required:**
|
|
47
|
+
- Node.js v18+
|
|
48
|
+
- Java 11+ (for code generation)
|
|
49
|
+
- AWS CLI (configured)
|
|
50
|
+
|
|
51
|
+
## CLI Commands
|
|
52
|
+
|
|
53
|
+
### Generate SDK
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Generate all entities from snapshots (defaults to Java)
|
|
57
|
+
chaim generate --package com.mycompany.myapp.model
|
|
58
|
+
|
|
59
|
+
# Explicitly specify language
|
|
60
|
+
chaim generate --package com.mycompany.myapp.model --language java
|
|
61
|
+
|
|
62
|
+
# Filter by CDK stack name
|
|
63
|
+
chaim generate --package com.mycompany.myapp.model --stack MyStack
|
|
64
|
+
|
|
65
|
+
# Custom output directory
|
|
66
|
+
chaim generate --package com.mycompany.myapp.model --output ./generated
|
|
67
|
+
|
|
68
|
+
# Skip environment checks
|
|
69
|
+
chaim generate --package com.mycompany.myapp.model --skip-checks
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Options:**
|
|
73
|
+
|
|
74
|
+
| Option | Required | Description | Default |
|
|
75
|
+
|--------|----------|-------------|---------|
|
|
76
|
+
| `--package` | **Yes** | Package name (e.g., `com.mycompany.myapp.model` for Java) | - |
|
|
77
|
+
| `-l, --language` | No | Target language for code generation | java |
|
|
78
|
+
| `--output` | No | Output directory | ./src/main/java |
|
|
79
|
+
| `--stack` | No | Filter by CDK stack name | - |
|
|
80
|
+
| `--snapshot-dir` | No | Override snapshot directory | OS cache |
|
|
81
|
+
| `--skip-checks` | No | Skip environment checks | false |
|
|
82
|
+
|
|
83
|
+
**Supported Languages:**
|
|
84
|
+
- `java` (default) — generates Java DTOs, ChaimConfig, and ChaimMapperClient
|
|
85
|
+
|
|
86
|
+
### Other Commands
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Verify prerequisites
|
|
90
|
+
chaim init
|
|
91
|
+
|
|
92
|
+
# Validate a schema file
|
|
93
|
+
chaim validate ./schemas/user.bprint
|
|
94
|
+
|
|
95
|
+
# Check environment health
|
|
96
|
+
chaim doctor
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Snapshot Locations
|
|
100
|
+
|
|
101
|
+
Snapshots are stored in a **global OS cache**, allowing the CLI to work from any directory.
|
|
102
|
+
|
|
103
|
+
**Default locations:**
|
|
104
|
+
- macOS/Linux: `~/.chaim/cache/snapshots/`
|
|
105
|
+
- Windows: `%LOCALAPPDATA%/chaim/cache/snapshots/`
|
|
106
|
+
|
|
107
|
+
**Directory structure:**
|
|
108
|
+
```
|
|
109
|
+
~/.chaim/cache/snapshots/
|
|
110
|
+
└── aws/
|
|
111
|
+
└── {accountId}/
|
|
112
|
+
└── {region}/
|
|
113
|
+
└── {stackName}/
|
|
114
|
+
└── dynamodb/
|
|
115
|
+
└── {resourceId}.json
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Error: No Snapshot Found
|
|
119
|
+
|
|
120
|
+
If you see "No snapshot found", **you need to create a snapshot first**. Snapshots are created by `chaim-cdk`:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Navigate to your CDK project
|
|
124
|
+
cd my-cdk-project
|
|
125
|
+
|
|
126
|
+
# Create a snapshot
|
|
127
|
+
cdk synth # For development
|
|
128
|
+
# OR
|
|
129
|
+
cdk deploy # For production
|
|
130
|
+
|
|
131
|
+
# Then generate (from any directory)
|
|
132
|
+
chaim generate --package com.mycompany.myapp.model
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Common causes:**
|
|
136
|
+
- Haven't run `cdk synth` or `cdk deploy` yet
|
|
137
|
+
- Filters (`--stack`) don't match existing snapshots
|
|
138
|
+
- Snapshots in non-default location (use `--snapshot-dir`)
|
|
139
|
+
|
|
140
|
+
**Tip:** The CLI shows existing snapshots that didn't match your filters, helping you adjust.
|
|
141
|
+
|
|
142
|
+
## Generated Output
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
src/main/java/com/mycompany/myapp/model/
|
|
146
|
+
├── Users.java # Entity DTO
|
|
147
|
+
├── config/
|
|
148
|
+
│ └── ChaimConfig.java # Table configuration
|
|
149
|
+
└── mapper/
|
|
150
|
+
└── ChaimMapperClient.java # DynamoDB mapper
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Using the Generated SDK
|
|
154
|
+
|
|
155
|
+
```java
|
|
156
|
+
// Create mapper client
|
|
157
|
+
ChaimMapperClient mapper = ChaimConfig.createMapper();
|
|
158
|
+
|
|
159
|
+
// Save entity
|
|
160
|
+
User user = new User();
|
|
161
|
+
user.setUserId("user-123");
|
|
162
|
+
user.setEmail("john@example.com");
|
|
163
|
+
mapper.save(user);
|
|
164
|
+
|
|
165
|
+
// Find by ID
|
|
166
|
+
Optional<User> found = mapper.findById(User.class, "user-123");
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Optional Configuration
|
|
170
|
+
|
|
171
|
+
Create `chaim.json` to set defaults:
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"defaults": {
|
|
176
|
+
"package": "com.mycompany.myapp.model",
|
|
177
|
+
"output": "./src/main/java"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Then run without arguments:
|
|
183
|
+
```bash
|
|
184
|
+
chaim generate
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Field Type Mappings
|
|
188
|
+
|
|
189
|
+
| .bprint Type | Java Type |
|
|
190
|
+
|--------------|-----------|
|
|
191
|
+
| `string` | `String` |
|
|
192
|
+
| `number` | `Double` |
|
|
193
|
+
| `boolean` | `Boolean` |
|
|
194
|
+
| `timestamp` | `Instant` |
|
|
195
|
+
|
|
196
|
+
## Related Packages
|
|
197
|
+
|
|
198
|
+
| Package | Purpose |
|
|
199
|
+
|---------|---------|
|
|
200
|
+
| [chaim-cdk](https://github.com/chaim-tools/chaim-cdk) | AWS CDK constructs (creates snapshots) |
|
|
201
|
+
| [chaim-bprint-spec](https://github.com/chaim-tools/chaim-bprint-spec) | Schema specification |
|
|
202
|
+
| [chaim-client-java](https://github.com/chaim-tools/chaim-client-java) | Java code generation |
|
|
203
|
+
|
|
204
|
+
## Getting Help
|
|
205
|
+
|
|
206
|
+
- **Issues**: [GitHub Issues](https://github.com/chaim-tools/chaim-cli/issues)
|
|
207
|
+
- **Examples**: [chaim-examples](https://github.com/chaim-tools/chaim-examples)
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
**Chaim** means life, representing our mission: supporting the life (data) of software applications as they grow and evolve alongside businesses.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chaim apps link
|
|
3
|
+
*
|
|
4
|
+
* Purpose:
|
|
5
|
+
* Associate the CLI with a specific Chaim application. This establishes
|
|
6
|
+
* the project context so other commands know which app to operate on.
|
|
7
|
+
*
|
|
8
|
+
* Expected Sub-APIs:
|
|
9
|
+
* - Chaim API: Get application details (to validate access)
|
|
10
|
+
* - Chaim API: Get application descriptor (for caching)
|
|
11
|
+
*
|
|
12
|
+
* Local Config Read/Write:
|
|
13
|
+
* - Reads: ~/.chaim/config.json (auth profile for API calls)
|
|
14
|
+
* - Reads: ./chaim.json (check if already linked)
|
|
15
|
+
* - Writes: ./chaim.json (store appId and cached descriptor)
|
|
16
|
+
*
|
|
17
|
+
* Security:
|
|
18
|
+
* - Validate user has access to the app before linking
|
|
19
|
+
* - Do not cache sensitive app secrets locally
|
|
20
|
+
*/
|
|
21
|
+
import { Command } from 'commander';
|
|
22
|
+
/**
|
|
23
|
+
* Register the `apps link` command with the CLI program
|
|
24
|
+
*/
|
|
25
|
+
export declare function registerAppsLinkCommand(program: Command): Command;
|
|
26
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/link.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAsBjE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* chaim apps link
|
|
4
|
+
*
|
|
5
|
+
* Purpose:
|
|
6
|
+
* Associate the CLI with a specific Chaim application. This establishes
|
|
7
|
+
* the project context so other commands know which app to operate on.
|
|
8
|
+
*
|
|
9
|
+
* Expected Sub-APIs:
|
|
10
|
+
* - Chaim API: Get application details (to validate access)
|
|
11
|
+
* - Chaim API: Get application descriptor (for caching)
|
|
12
|
+
*
|
|
13
|
+
* Local Config Read/Write:
|
|
14
|
+
* - Reads: ~/.chaim/config.json (auth profile for API calls)
|
|
15
|
+
* - Reads: ./chaim.json (check if already linked)
|
|
16
|
+
* - Writes: ./chaim.json (store appId and cached descriptor)
|
|
17
|
+
*
|
|
18
|
+
* Security:
|
|
19
|
+
* - Validate user has access to the app before linking
|
|
20
|
+
* - Do not cache sensitive app secrets locally
|
|
21
|
+
*/
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.registerAppsLinkCommand = void 0;
|
|
24
|
+
/**
|
|
25
|
+
* Register the `apps link` command with the CLI program
|
|
26
|
+
*/
|
|
27
|
+
function registerAppsLinkCommand(program) {
|
|
28
|
+
const appsCmd = program.commands.find((cmd) => cmd.name() === 'apps')
|
|
29
|
+
?? program.command('apps').description('Application management commands');
|
|
30
|
+
appsCmd
|
|
31
|
+
.command('link')
|
|
32
|
+
.description('Associate CLI with a Chaim application')
|
|
33
|
+
.argument('[appId]', 'Application ID to link (prompts if not provided)')
|
|
34
|
+
.option('--force', 'Overwrite existing link without confirmation')
|
|
35
|
+
.action(async (appId, options) => {
|
|
36
|
+
console.log('Not implemented yet. See docs/CLI_ROADMAP.md');
|
|
37
|
+
// Future implementation:
|
|
38
|
+
// 1. Check if authenticated (require auth)
|
|
39
|
+
// 2. If appId not provided, prompt or list available apps
|
|
40
|
+
// 3. Call API to validate user has access to the app
|
|
41
|
+
// 4. Fetch app descriptor
|
|
42
|
+
// 5. If already linked and not --force, confirm overwrite
|
|
43
|
+
// 6. Write appId to ./chaim.json
|
|
44
|
+
// 7. Cache app descriptor for offline use
|
|
45
|
+
});
|
|
46
|
+
return program;
|
|
47
|
+
}
|
|
48
|
+
exports.registerAppsLinkCommand = registerAppsLinkCommand;
|
|
49
|
+
//# sourceMappingURL=link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.js","sourceRoot":"","sources":["../../../src/commands/apps/link.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAIH;;GAEG;AACH,SAAgB,uBAAuB,CAAC,OAAgB;IACtD,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,MAAM,CAAC;WAChE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,iCAAiC,CAAC,CAAC;IAE5E,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,wCAAwC,CAAC;SACrD,QAAQ,CAAC,SAAS,EAAE,kDAAkD,CAAC;SACvE,MAAM,CAAC,SAAS,EAAE,8CAA8C,CAAC;SACjE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAC/B,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;QAC5D,yBAAyB;QACzB,2CAA2C;QAC3C,0DAA0D;QAC1D,qDAAqD;QACrD,0BAA0B;QAC1B,0DAA0D;QAC1D,iCAAiC;QACjC,0CAA0C;IAC5C,CAAC,CAAC,CAAC;IAEL,OAAO,OAAO,CAAC;AACjB,CAAC;AAtBD,0DAsBC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chaim apps list
|
|
3
|
+
*
|
|
4
|
+
* Purpose:
|
|
5
|
+
* List all Chaim applications the authenticated user can access.
|
|
6
|
+
* Helps users discover available apps for linking.
|
|
7
|
+
*
|
|
8
|
+
* Expected Sub-APIs:
|
|
9
|
+
* - Chaim API: List applications (with pagination)
|
|
10
|
+
*
|
|
11
|
+
* Local Config Read/Write:
|
|
12
|
+
* - Reads: ~/.chaim/config.json (auth profile for API calls)
|
|
13
|
+
* - Reads: ./chaim.json (to highlight currently linked app)
|
|
14
|
+
* - Writes: None
|
|
15
|
+
*
|
|
16
|
+
* Security:
|
|
17
|
+
* - Requires authentication
|
|
18
|
+
* - Only shows apps user has access to
|
|
19
|
+
*/
|
|
20
|
+
import { Command } from 'commander';
|
|
21
|
+
/**
|
|
22
|
+
* Register the `apps list` command with the CLI program
|
|
23
|
+
*/
|
|
24
|
+
export declare function registerAppsListCommand(program: Command): Command;
|
|
25
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAoBjE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* chaim apps list
|
|
4
|
+
*
|
|
5
|
+
* Purpose:
|
|
6
|
+
* List all Chaim applications the authenticated user can access.
|
|
7
|
+
* Helps users discover available apps for linking.
|
|
8
|
+
*
|
|
9
|
+
* Expected Sub-APIs:
|
|
10
|
+
* - Chaim API: List applications (with pagination)
|
|
11
|
+
*
|
|
12
|
+
* Local Config Read/Write:
|
|
13
|
+
* - Reads: ~/.chaim/config.json (auth profile for API calls)
|
|
14
|
+
* - Reads: ./chaim.json (to highlight currently linked app)
|
|
15
|
+
* - Writes: None
|
|
16
|
+
*
|
|
17
|
+
* Security:
|
|
18
|
+
* - Requires authentication
|
|
19
|
+
* - Only shows apps user has access to
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.registerAppsListCommand = void 0;
|
|
23
|
+
/**
|
|
24
|
+
* Register the `apps list` command with the CLI program
|
|
25
|
+
*/
|
|
26
|
+
function registerAppsListCommand(program) {
|
|
27
|
+
const appsCmd = program.commands.find((cmd) => cmd.name() === 'apps')
|
|
28
|
+
?? program.command('apps').description('Application management commands');
|
|
29
|
+
appsCmd
|
|
30
|
+
.command('list')
|
|
31
|
+
.description('List applications you can access')
|
|
32
|
+
.option('--json', 'Output as JSON')
|
|
33
|
+
.option('--limit <n>', 'Maximum number of apps to show', '20')
|
|
34
|
+
.action(async (options) => {
|
|
35
|
+
console.log('Not implemented yet. See docs/CLI_ROADMAP.md');
|
|
36
|
+
// Future implementation:
|
|
37
|
+
// 1. Check if authenticated (require auth)
|
|
38
|
+
// 2. Call API to list accessible applications
|
|
39
|
+
// 3. Load repo config to check current link
|
|
40
|
+
// 4. Display apps (highlight linked app if any)
|
|
41
|
+
// 5. Support pagination for large lists
|
|
42
|
+
});
|
|
43
|
+
return program;
|
|
44
|
+
}
|
|
45
|
+
exports.registerAppsListCommand = registerAppsListCommand;
|
|
46
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/apps/list.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAIH;;GAEG;AACH,SAAgB,uBAAuB,CAAC,OAAgB;IACtD,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,MAAM,CAAC;WAChE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,iCAAiC,CAAC,CAAC;IAE5E,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,kCAAkC,CAAC;SAC/C,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,aAAa,EAAE,gCAAgC,EAAE,IAAI,CAAC;SAC7D,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;QAC5D,yBAAyB;QACzB,2CAA2C;QAC3C,8CAA8C;QAC9C,4CAA4C;QAC5C,gDAAgD;QAChD,wCAAwC;IAC1C,CAAC,CAAC,CAAC;IAEL,OAAO,OAAO,CAAC;AACjB,CAAC;AApBD,0DAoBC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chaim auth login
|
|
3
|
+
*
|
|
4
|
+
* Purpose:
|
|
5
|
+
* Authenticate a user for CLI usage via browser/device OAuth flow,
|
|
6
|
+
* obtain scoped access and refresh tokens, and store them securely.
|
|
7
|
+
*
|
|
8
|
+
* Expected Sub-APIs:
|
|
9
|
+
* - Chaim Auth API: Initiate device authorization flow
|
|
10
|
+
* - Chaim Auth API: Poll for token completion
|
|
11
|
+
* - Chaim Auth API: Exchange authorization code for tokens
|
|
12
|
+
*
|
|
13
|
+
* Local Config Read/Write:
|
|
14
|
+
* - Reads: ~/.chaim/config.json (to check existing profiles)
|
|
15
|
+
* - Writes: ~/.chaim/config.json (to add/update profile metadata)
|
|
16
|
+
* - Writes: Platform keychain or ~/.chaim/credentials (encrypted tokens)
|
|
17
|
+
*
|
|
18
|
+
* Security:
|
|
19
|
+
* - NEVER log tokens or secrets to console
|
|
20
|
+
* - Store tokens in platform keychain (preferred) or encrypted file
|
|
21
|
+
* - Clear sensitive data from memory after use
|
|
22
|
+
* - Use PKCE for OAuth flow
|
|
23
|
+
*/
|
|
24
|
+
import { Command } from 'commander';
|
|
25
|
+
/**
|
|
26
|
+
* Register the `auth login` command with the CLI program
|
|
27
|
+
*/
|
|
28
|
+
export declare function registerAuthLoginCommand(program: Command): Command;
|
|
29
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAqBlE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* chaim auth login
|
|
4
|
+
*
|
|
5
|
+
* Purpose:
|
|
6
|
+
* Authenticate a user for CLI usage via browser/device OAuth flow,
|
|
7
|
+
* obtain scoped access and refresh tokens, and store them securely.
|
|
8
|
+
*
|
|
9
|
+
* Expected Sub-APIs:
|
|
10
|
+
* - Chaim Auth API: Initiate device authorization flow
|
|
11
|
+
* - Chaim Auth API: Poll for token completion
|
|
12
|
+
* - Chaim Auth API: Exchange authorization code for tokens
|
|
13
|
+
*
|
|
14
|
+
* Local Config Read/Write:
|
|
15
|
+
* - Reads: ~/.chaim/config.json (to check existing profiles)
|
|
16
|
+
* - Writes: ~/.chaim/config.json (to add/update profile metadata)
|
|
17
|
+
* - Writes: Platform keychain or ~/.chaim/credentials (encrypted tokens)
|
|
18
|
+
*
|
|
19
|
+
* Security:
|
|
20
|
+
* - NEVER log tokens or secrets to console
|
|
21
|
+
* - Store tokens in platform keychain (preferred) or encrypted file
|
|
22
|
+
* - Clear sensitive data from memory after use
|
|
23
|
+
* - Use PKCE for OAuth flow
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.registerAuthLoginCommand = void 0;
|
|
27
|
+
/**
|
|
28
|
+
* Register the `auth login` command with the CLI program
|
|
29
|
+
*/
|
|
30
|
+
function registerAuthLoginCommand(program) {
|
|
31
|
+
const authCmd = program.commands.find((cmd) => cmd.name() === 'auth')
|
|
32
|
+
?? program.command('auth').description('Authentication commands');
|
|
33
|
+
authCmd
|
|
34
|
+
.command('login')
|
|
35
|
+
.description('Authenticate with Chaim (browser/device flow)')
|
|
36
|
+
.option('--profile <name>', 'Profile name to store credentials under', 'default')
|
|
37
|
+
.option('--no-browser', 'Use device code flow instead of browser')
|
|
38
|
+
.action(async (options) => {
|
|
39
|
+
console.log('Not implemented yet. See docs/CLI_ROADMAP.md');
|
|
40
|
+
// Future implementation:
|
|
41
|
+
// 1. Check if already logged in for this profile
|
|
42
|
+
// 2. Initiate OAuth device flow or browser flow
|
|
43
|
+
// 3. Display instructions (device code or open browser)
|
|
44
|
+
// 4. Poll for completion / handle callback
|
|
45
|
+
// 5. Store tokens securely
|
|
46
|
+
// 6. Update profile metadata in config
|
|
47
|
+
});
|
|
48
|
+
return program;
|
|
49
|
+
}
|
|
50
|
+
exports.registerAuthLoginCommand = registerAuthLoginCommand;
|
|
51
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AAIH;;GAEG;AACH,SAAgB,wBAAwB,CAAC,OAAgB;IACvD,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,MAAM,CAAC;WAChE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAEpE,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,+CAA+C,CAAC;SAC5D,MAAM,CAAC,kBAAkB,EAAE,yCAAyC,EAAE,SAAS,CAAC;SAChF,MAAM,CAAC,cAAc,EAAE,yCAAyC,CAAC;SACjE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;QAC5D,yBAAyB;QACzB,iDAAiD;QACjD,gDAAgD;QAChD,wDAAwD;QACxD,2CAA2C;QAC3C,2BAA2B;QAC3B,uCAAuC;IACzC,CAAC,CAAC,CAAC;IAEL,OAAO,OAAO,CAAC;AACjB,CAAC;AArBD,4DAqBC"}
|