buildx-cli 1.0.3 → 1.0.4
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 +158 -70
- package/index.cjs +2 -2
- package/index.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
# BuildX CLI
|
|
2
2
|
|
|
3
|
-
A command-line interface tool for BuildX API with authentication and schema synchronization capabilities.
|
|
3
|
+
A command-line interface tool for BuildX API with authentication, project management, and schema synchronization capabilities.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
7
|
+
- **🔐 Authentication Management**: Secure login/logout with token validation
|
|
8
|
+
- **📁 Project Management**: List, set default, and manage multiple projects
|
|
9
|
+
- **🔄 Schema Synchronization**: Generate TypeScript types from API schema
|
|
10
|
+
- **⚙️ Configuration Management**: Store settings or use environment variables
|
|
11
|
+
- **🎯 Interactive CLI**: User-friendly command-line interface with prompts
|
|
11
12
|
|
|
12
13
|
## Installation
|
|
13
14
|
|
|
15
|
+
### Using npx (Recommended)
|
|
16
|
+
```bash
|
|
17
|
+
npx buildx-cli --help
|
|
18
|
+
```
|
|
19
|
+
|
|
14
20
|
### Global Installation
|
|
15
21
|
```bash
|
|
16
22
|
npm install -g buildx-cli
|
|
@@ -20,105 +26,167 @@ npm install -g buildx-cli
|
|
|
20
26
|
```bash
|
|
21
27
|
git clone <repository-url>
|
|
22
28
|
cd buildx-cli
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
yarn install
|
|
30
|
+
yarn build
|
|
31
|
+
yarn start --help
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
1. **Configure API settings:**
|
|
37
|
+
```bash
|
|
38
|
+
npx buildx-cli config:setup
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
2. **Authenticate:**
|
|
42
|
+
```bash
|
|
43
|
+
npx buildx-cli auth:login
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
3. **List projects:**
|
|
47
|
+
```bash
|
|
48
|
+
npx buildx-cli projects:list
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
4. **Sync schema:**
|
|
52
|
+
```bash
|
|
53
|
+
npx buildx-cli schema:sync --project-id <project-id>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Configuration
|
|
57
|
+
|
|
58
|
+
### Method 1: Interactive Setup
|
|
59
|
+
```bash
|
|
60
|
+
npx buildx-cli config:setup
|
|
25
61
|
```
|
|
26
62
|
|
|
27
|
-
|
|
63
|
+
### Method 2: Environment Variables
|
|
64
|
+
Set these environment variables or add them to a `.env` file:
|
|
28
65
|
|
|
29
|
-
|
|
66
|
+
```bash
|
|
67
|
+
BUILDX_API_ENDPOINT=https://api.example.com
|
|
68
|
+
BUILDX_API_KEY=your-api-key
|
|
69
|
+
BUILDX_PROJECT_ID=your-default-project-id
|
|
70
|
+
```
|
|
30
71
|
|
|
31
|
-
|
|
72
|
+
### Method 3: Command Line Options
|
|
32
73
|
```bash
|
|
33
|
-
buildx
|
|
74
|
+
npx buildx-cli config:setup --endpoint https://api.example.com --api-key your-api-key
|
|
34
75
|
```
|
|
35
76
|
|
|
36
|
-
|
|
77
|
+
### View Current Configuration
|
|
78
|
+
```bash
|
|
79
|
+
npx buildx-cli config:show
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Clear Configuration
|
|
83
|
+
```bash
|
|
84
|
+
npx buildx-cli config:clear
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Commands
|
|
88
|
+
|
|
89
|
+
### Authentication Commands
|
|
90
|
+
|
|
91
|
+
#### Login
|
|
37
92
|
```bash
|
|
38
|
-
buildx login
|
|
93
|
+
npx buildx-cli auth:login
|
|
39
94
|
```
|
|
95
|
+
Interactive login with username/password or token.
|
|
40
96
|
|
|
41
97
|
#### Logout
|
|
42
98
|
```bash
|
|
43
|
-
buildx logout
|
|
99
|
+
npx buildx-cli auth:logout
|
|
44
100
|
```
|
|
101
|
+
Clear stored authentication.
|
|
45
102
|
|
|
46
|
-
#### Check
|
|
103
|
+
#### Check Status
|
|
47
104
|
```bash
|
|
48
|
-
buildx auth:status
|
|
105
|
+
npx buildx-cli auth:status
|
|
49
106
|
```
|
|
107
|
+
Display authentication status and user information.
|
|
50
108
|
|
|
51
|
-
###
|
|
109
|
+
### Project Management Commands
|
|
52
110
|
|
|
53
|
-
####
|
|
111
|
+
#### List Projects
|
|
54
112
|
```bash
|
|
55
|
-
buildx
|
|
113
|
+
npx buildx-cli projects:list
|
|
56
114
|
```
|
|
115
|
+
Display all available projects.
|
|
57
116
|
|
|
58
|
-
####
|
|
117
|
+
#### Set Default Project
|
|
59
118
|
```bash
|
|
60
|
-
buildx
|
|
119
|
+
npx buildx-cli projects:set-default <project-id>
|
|
61
120
|
```
|
|
121
|
+
Set the default project for operations.
|
|
62
122
|
|
|
63
|
-
####
|
|
123
|
+
#### Show Current Project
|
|
64
124
|
```bash
|
|
65
|
-
buildx
|
|
125
|
+
npx buildx-cli projects:current
|
|
66
126
|
```
|
|
127
|
+
Display the currently selected default project.
|
|
67
128
|
|
|
68
|
-
###
|
|
129
|
+
### Schema Synchronization Commands
|
|
69
130
|
|
|
70
|
-
####
|
|
131
|
+
#### Sync Schema
|
|
71
132
|
```bash
|
|
72
|
-
buildx
|
|
133
|
+
npx buildx-cli schema:sync --project-id <project-id>
|
|
73
134
|
```
|
|
74
135
|
|
|
75
|
-
####
|
|
136
|
+
#### Sync with Custom Output
|
|
76
137
|
```bash
|
|
77
|
-
buildx
|
|
138
|
+
npx buildx-cli schema:sync --project-id <project-id> --output ./src/types/generated.ts
|
|
78
139
|
```
|
|
79
140
|
|
|
80
|
-
####
|
|
141
|
+
#### Sync with Custom API URL
|
|
81
142
|
```bash
|
|
82
|
-
buildx
|
|
143
|
+
npx buildx-cli schema:sync --project-id <project-id> --api-url https://custom-api.example.com
|
|
83
144
|
```
|
|
84
145
|
|
|
85
|
-
|
|
146
|
+
### Configuration Commands
|
|
147
|
+
|
|
148
|
+
#### Setup Configuration
|
|
149
|
+
```bash
|
|
150
|
+
npx buildx-cli config:setup
|
|
151
|
+
```
|
|
152
|
+
Interactive configuration setup.
|
|
86
153
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
-
|
|
90
|
-
|
|
91
|
-
### Configuration File Structure
|
|
92
|
-
|
|
93
|
-
```json
|
|
94
|
-
{
|
|
95
|
-
"auth": {
|
|
96
|
-
"token": "your-api-token",
|
|
97
|
-
"expiresAt": "2024-01-01T00:00:00.000Z"
|
|
98
|
-
},
|
|
99
|
-
"projects": {
|
|
100
|
-
"default": "project-id",
|
|
101
|
-
"list": [
|
|
102
|
-
{
|
|
103
|
-
"id": "project-id",
|
|
104
|
-
"name": "Project Name",
|
|
105
|
-
"apiUrl": "https://api.bbb.com"
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
},
|
|
109
|
-
"sync": {
|
|
110
|
-
"outputPath": "./generated/types.ts",
|
|
111
|
-
}
|
|
112
|
-
}
|
|
154
|
+
#### Show Configuration
|
|
155
|
+
```bash
|
|
156
|
+
npx buildx-cli config:show
|
|
113
157
|
```
|
|
158
|
+
Display current configuration and sources.
|
|
159
|
+
|
|
160
|
+
#### Clear Configuration
|
|
161
|
+
```bash
|
|
162
|
+
npx buildx-cli config:clear
|
|
163
|
+
```
|
|
164
|
+
Clear all stored configuration.
|
|
165
|
+
|
|
166
|
+
## Configuration Sources
|
|
167
|
+
|
|
168
|
+
The CLI checks for configuration in this order:
|
|
169
|
+
|
|
170
|
+
1. **Stored Configuration** (via `config:setup`)
|
|
171
|
+
2. **Environment Variables** (`BUILDX_API_ENDPOINT`, `BUILDX_API_KEY`)
|
|
172
|
+
3. **`.env` File** (in current directory)
|
|
173
|
+
|
|
174
|
+
### Configuration File Location
|
|
175
|
+
- **Global config**: `~/.config/buildx-cli-nodejs/config.json`
|
|
176
|
+
|
|
177
|
+
### Environment Variables
|
|
178
|
+
- `BUILDX_API_ENDPOINT` - Your API endpoint URL
|
|
179
|
+
- `BUILDX_API_KEY` - Your API key
|
|
180
|
+
- `BUILDX_PROJECT_ID` - Default project ID (optional)
|
|
114
181
|
|
|
115
182
|
## API Endpoints
|
|
116
183
|
|
|
117
184
|
The CLI interacts with the following API endpoints:
|
|
118
185
|
|
|
119
|
-
- `
|
|
186
|
+
- `POST /auth/login` - User authentication
|
|
187
|
+
- `GET /auth/me` - Get current user info
|
|
120
188
|
- `GET /projects` - List user projects
|
|
121
|
-
- `
|
|
189
|
+
- `GET /project/:project_id/collections/schema` - Fetch project schema
|
|
122
190
|
|
|
123
191
|
## Development
|
|
124
192
|
|
|
@@ -127,6 +195,10 @@ The CLI interacts with the following API endpoints:
|
|
|
127
195
|
```
|
|
128
196
|
src/
|
|
129
197
|
├── commands/ # CLI commands
|
|
198
|
+
│ ├── auth/ # Authentication commands
|
|
199
|
+
│ ├── config/ # Configuration commands
|
|
200
|
+
│ ├── projects/ # Project management commands
|
|
201
|
+
│ └── sync.ts # Schema synchronization
|
|
130
202
|
├── services/ # Business logic services
|
|
131
203
|
├── types/ # TypeScript type definitions
|
|
132
204
|
├── utils/ # Utility functions
|
|
@@ -134,34 +206,50 @@ src/
|
|
|
134
206
|
└── index.ts # Main entry point
|
|
135
207
|
```
|
|
136
208
|
|
|
137
|
-
###
|
|
209
|
+
### Available Scripts
|
|
138
210
|
|
|
139
211
|
```bash
|
|
140
|
-
|
|
212
|
+
yarn build # Build the project
|
|
213
|
+
yarn dev # Run in development mode
|
|
214
|
+
yarn start # Run built version
|
|
215
|
+
yarn test # Run tests
|
|
216
|
+
yarn lint # Run linter
|
|
217
|
+
yarn format # Format code
|
|
141
218
|
```
|
|
142
219
|
|
|
143
|
-
###
|
|
220
|
+
### Building
|
|
144
221
|
|
|
145
222
|
```bash
|
|
146
|
-
|
|
223
|
+
yarn build
|
|
147
224
|
```
|
|
148
225
|
|
|
149
|
-
###
|
|
226
|
+
### Development Mode
|
|
150
227
|
|
|
151
228
|
```bash
|
|
152
|
-
|
|
229
|
+
yarn dev
|
|
153
230
|
```
|
|
154
231
|
|
|
155
|
-
|
|
232
|
+
## Examples
|
|
156
233
|
|
|
234
|
+
### CI/CD Pipeline
|
|
157
235
|
```bash
|
|
158
|
-
|
|
159
|
-
|
|
236
|
+
# Set environment variables
|
|
237
|
+
export BUILDX_API_ENDPOINT=https://api.example.com
|
|
238
|
+
export BUILDX_API_KEY=$CI_API_KEY
|
|
239
|
+
export BUILDX_PROJECT_ID=$CI_PROJECT_ID
|
|
160
240
|
|
|
161
|
-
|
|
241
|
+
# Run schema sync
|
|
242
|
+
npx buildx-cli schema:sync --project-id $BUILDX_PROJECT_ID --output ./src/types/api.ts
|
|
243
|
+
```
|
|
162
244
|
|
|
245
|
+
### Local Development
|
|
163
246
|
```bash
|
|
164
|
-
|
|
247
|
+
# Setup once
|
|
248
|
+
npx buildx-cli config:setup
|
|
249
|
+
|
|
250
|
+
# Use regularly
|
|
251
|
+
npx buildx-cli projects:list
|
|
252
|
+
npx buildx-cli schema:sync --project-id my-project
|
|
165
253
|
```
|
|
166
254
|
|
|
167
255
|
## Contributing
|